@ntbjs/react-components 1.2.0-rc.82 → 1.2.0-rc.83

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 (65) hide show
  1. package/{ActionButton-46735b89.js → ActionButton-a9316775.js} +10 -11
  2. package/{Alert-13b75102.js → Alert-d69a3f95.js} +20 -24
  3. package/{AssetGallery-14556429.js → AssetGallery-26d11836.js} +338 -493
  4. package/{AssetPreviewTopBar-912c3469.js → AssetPreviewTopBar-c9e45035.js} +27 -31
  5. package/{Badge-aec841c8.js → Badge-cbbff6b8.js} +28 -49
  6. package/{Button-49f82b31.js → Button-39607724.js} +53 -65
  7. package/{Checkbox-68dc38a8.js → Checkbox-ad9c9e54.js} +30 -35
  8. package/{CompactAutocompleteSelect-ccde6a60.js → CompactAutocompleteSelect-b8718825.js} +82 -114
  9. package/{CompactStarRating-b1b15bd1.js → CompactStarRating-bbe8800b.js} +71 -87
  10. package/{CompactTextInput-9b36b1b1.js → CompactTextInput-72224756.js} +67 -79
  11. package/{ContextMenu-4ec3d9f3.js → ContextMenu-4eb8fdc5.js} +6 -6
  12. package/{ContextMenuItem-ba2b697e.js → ContextMenuItem-c536b460.js} +22 -26
  13. package/{InputGroup-49fbc423.js → InputGroup-a89a0ea3.js} +6 -6
  14. package/{Instructions-86834a28.js → Instructions-cfb1dcd7.js} +66 -81
  15. package/{MultiLevelCheckboxSelect-448cd692.js → MultiLevelCheckboxSelect-654c291b.js} +102 -164
  16. package/{MultiSelect-efd60232.js → MultiSelect-149a817b.js} +71 -101
  17. package/{Popover-569cd272.js → Popover-c5e425a7.js} +19 -21
  18. package/{Radio-32d0513a.js → Radio-55db4781.js} +21 -22
  19. package/{SectionSeparator-259a22ed.js → SectionSeparator-af8dc1ce.js} +6 -6
  20. package/{Switch-4a41585f.js → Switch-04ecd8d0.js} +25 -27
  21. package/{Tab-f499ecbc.js → Tab-e43241f0.js} +7 -7
  22. package/{Tabs-3c6c784d.js → Tabs-21e0079f.js} +23 -37
  23. package/{TextArea-767dc470.js → TextArea-c2620d92.js} +73 -97
  24. package/{TextInput-0d109708.js → TextInput-9a995449.js} +41 -48
  25. package/{Tooltip-66daf6e3.js → Tooltip-a68a7e49.js} +13 -13
  26. package/{VerificationStatusIcon-6fe95a92.js → VerificationStatusIcon-3bae6e2f.js} +20 -30
  27. package/{close-ebf2f3cf.js → close-1751121a.js} +8 -12
  28. package/data/Alert/index.js +2 -2
  29. package/data/Badge/index.js +2 -2
  30. package/data/Popover/index.js +3 -3
  31. package/data/Tab/index.js +2 -2
  32. package/data/Tabs/index.js +3 -3
  33. package/data/Tooltip/index.js +3 -3
  34. package/data/index.js +9 -9
  35. package/{defaultTheme-ea44e34a.js → defaultTheme-cd01e6c2.js} +212 -260
  36. package/edit-note-cefe2215.js +37 -0
  37. package/{expand-more-94585605.js → expand-more-d74e2bd2.js} +8 -12
  38. package/inputs/ActionButton/index.js +2 -2
  39. package/inputs/Button/index.js +6 -6
  40. package/inputs/Checkbox/index.js +2 -2
  41. package/inputs/CompactAutocompleteSelect/index.js +13 -13
  42. package/inputs/CompactStarRating/index.js +10 -10
  43. package/inputs/CompactTextInput/index.js +11 -11
  44. package/inputs/MultiSelect/index.js +4 -4
  45. package/inputs/Radio/index.js +2 -2
  46. package/inputs/Switch/index.js +2 -2
  47. package/inputs/TextArea/index.js +11 -11
  48. package/inputs/TextInput/index.js +3 -3
  49. package/inputs/index.js +28 -28
  50. package/layout/InputGroup/index.js +2 -2
  51. package/layout/SectionSeparator/index.js +2 -2
  52. package/layout/index.js +3 -3
  53. package/package.json +3 -3
  54. package/{react-select-creatable.esm-2f23d6c6.js → react-select-creatable.esm-66ca61dc.js} +1470 -1272
  55. package/{shift-away-subtle-0bed9a3c.js → shift-away-subtle-631cd794.js} +1 -1
  56. package/ssr/index.js +1 -3
  57. package/{warning-circle-24522402.js → warning-circle-478e65cc.js} +8 -12
  58. package/widgets/AssetGallery/index.js +31 -31
  59. package/widgets/AssetPreview/AssetPreviewTopBar/index.js +3 -3
  60. package/widgets/ContextMenu/ContextMenuItem/index.js +2 -2
  61. package/widgets/ContextMenu/ContextMenuItemsGroup/index.js +6 -6
  62. package/widgets/ContextMenu/index.js +2 -2
  63. package/widgets/Instructions/index.js +17 -17
  64. package/widgets/index.js +33 -33
  65. package/edit-note-c47d292e.js +0 -41
@@ -1,6 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var React = require('react');
4
+ var defaultTheme$1 = require('./defaultTheme-cd01e6c2.js');
4
5
  var reactDom = require('react-dom');
5
6
 
6
7
  function _interopNamespace(e) {
@@ -12,228 +13,190 @@ function _interopNamespace(e) {
12
13
  var d = Object.getOwnPropertyDescriptor(e, k);
13
14
  Object.defineProperty(n, k, d.get ? d : {
14
15
  enumerable: true,
15
- get: function () {
16
- return e[k];
17
- }
16
+ get: function () { return e[k]; }
18
17
  });
19
18
  }
20
19
  });
21
20
  }
22
- n['default'] = e;
21
+ n["default"] = e;
23
22
  return Object.freeze(n);
24
23
  }
25
24
 
26
25
  var React__namespace = /*#__PURE__*/_interopNamespace(React);
27
26
 
28
27
  function _extends() {
29
- _extends = Object.assign ? Object.assign.bind() : function (target) {
30
- for (var i = 1; i < arguments.length; i++) {
31
- var source = arguments[i];
32
-
33
- for (var key in source) {
34
- if (Object.prototype.hasOwnProperty.call(source, key)) {
35
- target[key] = source[key];
36
- }
37
- }
28
+ return _extends = Object.assign ? Object.assign.bind() : function (n) {
29
+ for (var e = 1; e < arguments.length; e++) {
30
+ var t = arguments[e];
31
+ for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
38
32
  }
33
+ return n;
34
+ }, _extends.apply(null, arguments);
35
+ }
39
36
 
40
- return target;
41
- };
42
- return _extends.apply(this, arguments);
37
+ function _typeof(o) {
38
+ "@babel/helpers - typeof";
39
+
40
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
41
+ return typeof o;
42
+ } : function (o) {
43
+ return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
44
+ }, _typeof(o);
43
45
  }
44
46
 
45
- function _defineProperty(obj, key, value) {
46
- if (key in obj) {
47
- Object.defineProperty(obj, key, {
48
- value: value,
49
- enumerable: true,
50
- configurable: true,
51
- writable: true
52
- });
53
- } else {
54
- obj[key] = value;
47
+ function toPrimitive(t, r) {
48
+ if ("object" != _typeof(t) || !t) return t;
49
+ var e = t[Symbol.toPrimitive];
50
+ if (void 0 !== e) {
51
+ var i = e.call(t, r || "default");
52
+ if ("object" != _typeof(i)) return i;
53
+ throw new TypeError("@@toPrimitive must return a primitive value.");
55
54
  }
55
+ return ("string" === r ? String : Number)(t);
56
+ }
56
57
 
57
- return obj;
58
+ function toPropertyKey(t) {
59
+ var i = toPrimitive(t, "string");
60
+ return "symbol" == _typeof(i) ? i : i + "";
58
61
  }
59
62
 
60
- function ownKeys(object, enumerableOnly) {
61
- var keys = Object.keys(object);
63
+ function _defineProperty(e, r, t) {
64
+ return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
65
+ value: t,
66
+ enumerable: !0,
67
+ configurable: !0,
68
+ writable: !0
69
+ }) : e[r] = t, e;
70
+ }
62
71
 
72
+ function ownKeys(e, r) {
73
+ var t = Object.keys(e);
63
74
  if (Object.getOwnPropertySymbols) {
64
- var symbols = Object.getOwnPropertySymbols(object);
65
- enumerableOnly && (symbols = symbols.filter(function (sym) {
66
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
67
- })), keys.push.apply(keys, symbols);
75
+ var o = Object.getOwnPropertySymbols(e);
76
+ r && (o = o.filter(function (r) {
77
+ return Object.getOwnPropertyDescriptor(e, r).enumerable;
78
+ })), t.push.apply(t, o);
68
79
  }
69
-
70
- return keys;
71
- }
72
-
73
- function _objectSpread2(target) {
74
- for (var i = 1; i < arguments.length; i++) {
75
- var source = null != arguments[i] ? arguments[i] : {};
76
- i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
77
- _defineProperty(target, key, source[key]);
78
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
79
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
80
+ return t;
81
+ }
82
+ function _objectSpread2(e) {
83
+ for (var r = 1; r < arguments.length; r++) {
84
+ var t = null != arguments[r] ? arguments[r] : {};
85
+ r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {
86
+ _defineProperty(e, r, t[r]);
87
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
88
+ Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
80
89
  });
81
90
  }
82
-
83
- return target;
91
+ return e;
84
92
  }
85
93
 
86
- function _classCallCheck(instance, Constructor) {
87
- if (!(instance instanceof Constructor)) {
88
- throw new TypeError("Cannot call a class as a function");
89
- }
94
+ function _classCallCheck(a, n) {
95
+ if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
90
96
  }
91
97
 
92
- function _defineProperties(target, props) {
93
- for (var i = 0; i < props.length; i++) {
94
- var descriptor = props[i];
95
- descriptor.enumerable = descriptor.enumerable || false;
96
- descriptor.configurable = true;
97
- if ("value" in descriptor) descriptor.writable = true;
98
- Object.defineProperty(target, descriptor.key, descriptor);
98
+ function _defineProperties(e, r) {
99
+ for (var t = 0; t < r.length; t++) {
100
+ var o = r[t];
101
+ o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, toPropertyKey(o.key), o);
99
102
  }
100
103
  }
101
-
102
- function _createClass(Constructor, protoProps, staticProps) {
103
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
104
- if (staticProps) _defineProperties(Constructor, staticProps);
105
- Object.defineProperty(Constructor, "prototype", {
106
- writable: false
107
- });
108
- return Constructor;
104
+ function _createClass(e, r, t) {
105
+ return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", {
106
+ writable: !1
107
+ }), e;
109
108
  }
110
109
 
111
- function _setPrototypeOf(o, p) {
112
- _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
113
- o.__proto__ = p;
114
- return o;
115
- };
116
- return _setPrototypeOf(o, p);
110
+ function _setPrototypeOf(t, e) {
111
+ return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
112
+ return t.__proto__ = e, t;
113
+ }, _setPrototypeOf(t, e);
117
114
  }
118
115
 
119
- function _inherits(subClass, superClass) {
120
- if (typeof superClass !== "function" && superClass !== null) {
121
- throw new TypeError("Super expression must either be null or a function");
122
- }
123
-
124
- subClass.prototype = Object.create(superClass && superClass.prototype, {
116
+ function _inherits(t, e) {
117
+ if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
118
+ t.prototype = Object.create(e && e.prototype, {
125
119
  constructor: {
126
- value: subClass,
127
- writable: true,
128
- configurable: true
120
+ value: t,
121
+ writable: !0,
122
+ configurable: !0
129
123
  }
130
- });
131
- Object.defineProperty(subClass, "prototype", {
132
- writable: false
133
- });
134
- if (superClass) _setPrototypeOf(subClass, superClass);
124
+ }), Object.defineProperty(t, "prototype", {
125
+ writable: !1
126
+ }), e && _setPrototypeOf(t, e);
135
127
  }
136
128
 
137
- function _getPrototypeOf(o) {
138
- _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
139
- return o.__proto__ || Object.getPrototypeOf(o);
140
- };
141
- return _getPrototypeOf(o);
129
+ function _getPrototypeOf(t) {
130
+ return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) {
131
+ return t.__proto__ || Object.getPrototypeOf(t);
132
+ }, _getPrototypeOf(t);
142
133
  }
143
134
 
144
135
  function _isNativeReflectConstruct() {
145
- if (typeof Reflect === "undefined" || !Reflect.construct) return false;
146
- if (Reflect.construct.sham) return false;
147
- if (typeof Proxy === "function") return true;
148
-
149
136
  try {
150
- Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
151
- return true;
152
- } catch (e) {
153
- return false;
154
- }
155
- }
156
-
157
- function _typeof(obj) {
158
- "@babel/helpers - typeof";
159
-
160
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
161
- return typeof obj;
162
- } : function (obj) {
163
- return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
164
- }, _typeof(obj);
137
+ var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
138
+ } catch (t) {}
139
+ return (_isNativeReflectConstruct = function _isNativeReflectConstruct() {
140
+ return !!t;
141
+ })();
165
142
  }
166
143
 
167
- function _assertThisInitialized(self) {
168
- if (self === void 0) {
169
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
170
- }
171
-
172
- return self;
144
+ function _assertThisInitialized(e) {
145
+ if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
146
+ return e;
173
147
  }
174
148
 
175
- function _possibleConstructorReturn(self, call) {
176
- if (call && (_typeof(call) === "object" || typeof call === "function")) {
177
- return call;
178
- } else if (call !== void 0) {
179
- throw new TypeError("Derived constructors may only return object or undefined");
180
- }
181
-
182
- return _assertThisInitialized(self);
149
+ function _possibleConstructorReturn(t, e) {
150
+ if (e && ("object" == _typeof(e) || "function" == typeof e)) return e;
151
+ if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined");
152
+ return _assertThisInitialized(t);
183
153
  }
184
154
 
185
- function _createSuper(Derived) {
186
- var hasNativeReflectConstruct = _isNativeReflectConstruct();
187
- return function _createSuperInternal() {
188
- var Super = _getPrototypeOf(Derived),
189
- result;
190
-
191
- if (hasNativeReflectConstruct) {
192
- var NewTarget = _getPrototypeOf(this).constructor;
193
- result = Reflect.construct(Super, arguments, NewTarget);
194
- } else {
195
- result = Super.apply(this, arguments);
196
- }
197
-
198
- return _possibleConstructorReturn(this, result);
155
+ function _createSuper(t) {
156
+ var r = _isNativeReflectConstruct();
157
+ return function () {
158
+ var e,
159
+ o = _getPrototypeOf(t);
160
+ if (r) {
161
+ var s = _getPrototypeOf(this).constructor;
162
+ e = Reflect.construct(o, arguments, s);
163
+ } else e = o.apply(this, arguments);
164
+ return _possibleConstructorReturn(this, e);
199
165
  };
200
166
  }
201
167
 
202
- function _arrayLikeToArray(arr, len) {
203
- if (len == null || len > arr.length) len = arr.length;
204
-
205
- for (var i = 0, arr2 = new Array(len); i < len; i++) {
206
- arr2[i] = arr[i];
207
- }
208
-
209
- return arr2;
168
+ function _arrayLikeToArray(r, a) {
169
+ (null == a || a > r.length) && (a = r.length);
170
+ for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
171
+ return n;
210
172
  }
211
173
 
212
- function _arrayWithoutHoles(arr) {
213
- if (Array.isArray(arr)) return _arrayLikeToArray(arr);
174
+ function _arrayWithoutHoles(r) {
175
+ if (Array.isArray(r)) return _arrayLikeToArray(r);
214
176
  }
215
177
 
216
- function _iterableToArray(iter) {
217
- if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
178
+ function _iterableToArray(r) {
179
+ if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
218
180
  }
219
181
 
220
- function _unsupportedIterableToArray(o, minLen) {
221
- if (!o) return;
222
- if (typeof o === "string") return _arrayLikeToArray(o, minLen);
223
- var n = Object.prototype.toString.call(o).slice(8, -1);
224
- if (n === "Object" && o.constructor) n = o.constructor.name;
225
- if (n === "Map" || n === "Set") return Array.from(o);
226
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
182
+ function _unsupportedIterableToArray(r, a) {
183
+ if (r) {
184
+ if ("string" == typeof r) return _arrayLikeToArray(r, a);
185
+ var t = {}.toString.call(r).slice(8, -1);
186
+ 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;
187
+ }
227
188
  }
228
189
 
229
190
  function _nonIterableSpread() {
230
191
  throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
231
192
  }
232
193
 
233
- function _toConsumableArray(arr) {
234
- return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
194
+ function _toConsumableArray(r) {
195
+ return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();
235
196
  }
236
197
 
198
+ var isDevelopment$2 = false;
199
+
237
200
  /*
238
201
 
239
202
  Based off glamor's StyleSheet, thanks Sunil ❤️
@@ -256,10 +219,9 @@ styleSheet.flush()
256
219
  - empties the stylesheet of all its contents
257
220
 
258
221
  */
259
- // $FlowFixMe
222
+
260
223
  function sheetForTag(tag) {
261
224
  if (tag.sheet) {
262
- // $FlowFixMe
263
225
  return tag.sheet;
264
226
  } // this weirdness brought to you by firefox
265
227
 
@@ -268,10 +230,13 @@ function sheetForTag(tag) {
268
230
 
269
231
  for (var i = 0; i < document.styleSheets.length; i++) {
270
232
  if (document.styleSheets[i].ownerNode === tag) {
271
- // $FlowFixMe
272
233
  return document.styleSheets[i];
273
234
  }
274
- }
235
+ } // this function should always return with a value
236
+ // TS can't understand it though so we make it stop complaining here
237
+
238
+
239
+ return undefined;
275
240
  }
276
241
 
277
242
  function createStyleElement(options) {
@@ -312,7 +277,7 @@ var StyleSheet = /*#__PURE__*/function () {
312
277
  _this.tags.push(tag);
313
278
  };
314
279
 
315
- this.isSpeedy = options.speedy === undefined ? process.env.NODE_ENV === 'production' : options.speedy;
280
+ this.isSpeedy = options.speedy === undefined ? !isDevelopment$2 : options.speedy;
316
281
  this.tags = [];
317
282
  this.ctr = 0;
318
283
  this.nonce = options.nonce; // key is the value of the data-emotion attribute, it's used to identify different sheets
@@ -340,18 +305,6 @@ var StyleSheet = /*#__PURE__*/function () {
340
305
 
341
306
  var tag = this.tags[this.tags.length - 1];
342
307
 
343
- if (process.env.NODE_ENV !== 'production') {
344
- var isImportRule = rule.charCodeAt(0) === 64 && rule.charCodeAt(1) === 105;
345
-
346
- if (isImportRule && this._alreadyInsertedOrderInsensitiveRule) {
347
- // this would only cause problem in speedy mode
348
- // but we don't want enabling speedy to affect the observable behavior
349
- // so we report this error at all times
350
- console.error("You're attempting to insert the following rule:\n" + rule + '\n\n`@import` rules must be before all other types of rules in a stylesheet but other rules have already been inserted. Please ensure that `@import` rules are before all other rules.');
351
- }
352
- this._alreadyInsertedOrderInsensitiveRule = this._alreadyInsertedOrderInsensitiveRule || !isImportRule;
353
- }
354
-
355
308
  if (this.isSpeedy) {
356
309
  var sheet = sheetForTag(tag);
357
310
 
@@ -360,9 +313,6 @@ var StyleSheet = /*#__PURE__*/function () {
360
313
  // the big drawback is that the css won't be editable in devtools
361
314
  sheet.insertRule(rule, sheet.cssRules.length);
362
315
  } catch (e) {
363
- if (process.env.NODE_ENV !== 'production' && !/:(-moz-placeholder|-moz-focus-inner|-moz-focusring|-ms-input-placeholder|-moz-read-write|-moz-read-only|-ms-clear|-ms-expand|-ms-reveal){/.test(rule)) {
364
- console.error("There was a problem inserting the following rule: \"" + rule + "\"", e);
365
- }
366
316
  }
367
317
  } else {
368
318
  tag.appendChild(document.createTextNode(rule));
@@ -372,16 +322,13 @@ var StyleSheet = /*#__PURE__*/function () {
372
322
  };
373
323
 
374
324
  _proto.flush = function flush() {
375
- // $FlowFixMe
376
325
  this.tags.forEach(function (tag) {
377
- return tag.parentNode && tag.parentNode.removeChild(tag);
326
+ var _tag$parentNode;
327
+
328
+ return (_tag$parentNode = tag.parentNode) == null ? void 0 : _tag$parentNode.removeChild(tag);
378
329
  });
379
330
  this.tags = [];
380
331
  this.ctr = 0;
381
-
382
- if (process.env.NODE_ENV !== 'production') {
383
- this._alreadyInsertedOrderInsensitiveRule = false;
384
- }
385
332
  };
386
333
 
387
334
  return StyleSheet;
@@ -986,11 +933,11 @@ function rulesheet (callback) {
986
933
  }
987
934
 
988
935
  var weakMemoize = function weakMemoize(func) {
989
- // $FlowFixMe flow doesn't include all non-primitive types as allowed for weakmaps
990
936
  var cache = new WeakMap();
991
937
  return function (arg) {
992
938
  if (cache.has(arg)) {
993
- // $FlowFixMe
939
+ // Use non-null assertion because we just checked that the cache `has` it
940
+ // This allows us to remove `undefined` from the return value
994
941
  return cache.get(arg);
995
942
  }
996
943
 
@@ -1000,7 +947,7 @@ var weakMemoize = function weakMemoize(func) {
1000
947
  };
1001
948
  };
1002
949
 
1003
- function memoize$1(fn) {
950
+ function memoize(fn) {
1004
951
  var cache = Object.create(null);
1005
952
  return function (arg) {
1006
953
  if (cache[arg] === undefined) cache[arg] = fn(arg);
@@ -1008,6 +955,8 @@ function memoize$1(fn) {
1008
955
  };
1009
956
  }
1010
957
 
958
+ var isBrowser$3 = typeof document !== 'undefined';
959
+
1011
960
  var identifierWithPointTracking = function identifierWithPointTracking(begin, points, index) {
1012
961
  var previous = 0;
1013
962
  var character = 0;
@@ -1132,114 +1081,6 @@ var removeLabel = function removeLabel(element) {
1132
1081
  }
1133
1082
  }
1134
1083
  };
1135
- var ignoreFlag = 'emotion-disable-server-rendering-unsafe-selector-warning-please-do-not-use-this-the-warning-exists-for-a-reason';
1136
-
1137
- var isIgnoringComment = function isIgnoringComment(element) {
1138
- return element.type === 'comm' && element.children.indexOf(ignoreFlag) > -1;
1139
- };
1140
-
1141
- var createUnsafeSelectorsAlarm = function createUnsafeSelectorsAlarm(cache) {
1142
- return function (element, index, children) {
1143
- if (element.type !== 'rule' || cache.compat) return;
1144
- var unsafePseudoClasses = element.value.match(/(:first|:nth|:nth-last)-child/g);
1145
-
1146
- if (unsafePseudoClasses) {
1147
- var isNested = !!element.parent; // in nested rules comments become children of the "auto-inserted" rule and that's always the `element.parent`
1148
- //
1149
- // considering this input:
1150
- // .a {
1151
- // .b /* comm */ {}
1152
- // color: hotpink;
1153
- // }
1154
- // we get output corresponding to this:
1155
- // .a {
1156
- // & {
1157
- // /* comm */
1158
- // color: hotpink;
1159
- // }
1160
- // .b {}
1161
- // }
1162
-
1163
- var commentContainer = isNested ? element.parent.children : // global rule at the root level
1164
- children;
1165
-
1166
- for (var i = commentContainer.length - 1; i >= 0; i--) {
1167
- var node = commentContainer[i];
1168
-
1169
- if (node.line < element.line) {
1170
- break;
1171
- } // it is quite weird but comments are *usually* put at `column: element.column - 1`
1172
- // so we seek *from the end* for the node that is earlier than the rule's `element` and check that
1173
- // this will also match inputs like this:
1174
- // .a {
1175
- // /* comm */
1176
- // .b {}
1177
- // }
1178
- //
1179
- // but that is fine
1180
- //
1181
- // it would be the easiest to change the placement of the comment to be the first child of the rule:
1182
- // .a {
1183
- // .b { /* comm */ }
1184
- // }
1185
- // with such inputs we wouldn't have to search for the comment at all
1186
- // TODO: consider changing this comment placement in the next major version
1187
-
1188
-
1189
- if (node.column < element.column) {
1190
- if (isIgnoringComment(node)) {
1191
- return;
1192
- }
1193
-
1194
- break;
1195
- }
1196
- }
1197
-
1198
- unsafePseudoClasses.forEach(function (unsafePseudoClass) {
1199
- console.error("The pseudo class \"" + unsafePseudoClass + "\" is potentially unsafe when doing server-side rendering. Try changing it to \"" + unsafePseudoClass.split('-child')[0] + "-of-type\".");
1200
- });
1201
- }
1202
- };
1203
- };
1204
-
1205
- var isImportRule = function isImportRule(element) {
1206
- return element.type.charCodeAt(1) === 105 && element.type.charCodeAt(0) === 64;
1207
- };
1208
-
1209
- var isPrependedWithRegularRules = function isPrependedWithRegularRules(index, children) {
1210
- for (var i = index - 1; i >= 0; i--) {
1211
- if (!isImportRule(children[i])) {
1212
- return true;
1213
- }
1214
- }
1215
-
1216
- return false;
1217
- }; // use this to remove incorrect elements from further processing
1218
- // so they don't get handed to the `sheet` (or anything else)
1219
- // as that could potentially lead to additional logs which in turn could be overhelming to the user
1220
-
1221
-
1222
- var nullifyElement = function nullifyElement(element) {
1223
- element.type = '';
1224
- element.value = '';
1225
- element["return"] = '';
1226
- element.children = '';
1227
- element.props = '';
1228
- };
1229
-
1230
- var incorrectImportAlarm = function incorrectImportAlarm(element, index, children) {
1231
- if (!isImportRule(element)) {
1232
- return;
1233
- }
1234
-
1235
- if (element.parent) {
1236
- console.error("`@import` rules can't be nested inside other rules. Please move it to the top level and put it before regular rules. Keep in mind that they can only be used within global styles.");
1237
- nullifyElement(element);
1238
- } else if (isPrependedWithRegularRules(index, children)) {
1239
- console.error("`@import` rules can't be after other rules. Please put your `@import` rules before your other rules.");
1240
- nullifyElement(element);
1241
- }
1242
- };
1243
1084
 
1244
1085
  /* eslint-disable no-fallthrough */
1245
1086
 
@@ -1453,9 +1294,22 @@ var prefixer = function prefixer(element, index, children, callback) {
1453
1294
  }
1454
1295
  };
1455
1296
 
1456
- var isBrowser$4 = typeof document !== 'undefined';
1457
- var getServerStylisCache = isBrowser$4 ? undefined : weakMemoize(function () {
1458
- return memoize$1(function () {
1297
+ /* import type { StylisPlugin } from './types' */
1298
+
1299
+ /*
1300
+ export type Options = {
1301
+ nonce?: string,
1302
+ stylisPlugins?: StylisPlugin[],
1303
+ key: string,
1304
+ container?: HTMLElement,
1305
+ speedy?: boolean,
1306
+ prepend?: boolean,
1307
+ insertionPoint?: HTMLElement
1308
+ }
1309
+ */
1310
+
1311
+ var getServerStylisCache = isBrowser$3 ? undefined : weakMemoize(function () {
1312
+ return memoize(function () {
1459
1313
  var cache = {};
1460
1314
  return function (name) {
1461
1315
  return cache[name];
@@ -1464,20 +1318,22 @@ var getServerStylisCache = isBrowser$4 ? undefined : weakMemoize(function () {
1464
1318
  });
1465
1319
  var defaultStylisPlugins = [prefixer];
1466
1320
 
1467
- var createCache = function createCache(options) {
1321
+ var createCache = function
1322
+ /*: EmotionCache */
1323
+ createCache(options
1324
+ /*: Options */
1325
+ ) {
1468
1326
  var key = options.key;
1469
1327
 
1470
- if (process.env.NODE_ENV !== 'production' && !key) {
1471
- throw new Error("You have to configure `key` for your cache. Please make sure it's unique (and not equal to 'css') as it's used for linking styles to your cache.\n" + "If multiple caches share the same key they might \"fight\" for each other's style elements.");
1472
- }
1473
-
1474
- if (isBrowser$4 && key === 'css') {
1328
+ if (isBrowser$3 && key === 'css') {
1475
1329
  var ssrStyles = document.querySelectorAll("style[data-emotion]:not([data-s])"); // get SSRed styles out of the way of React's hydration
1476
1330
  // document.head is a safe place to move them to(though note document.head is not necessarily the last place they will be)
1477
1331
  // note this very very intentionally targets all style elements regardless of the key to ensure
1478
1332
  // that creating a cache works inside of render of a React component
1479
1333
 
1480
- Array.prototype.forEach.call(ssrStyles, function (node) {
1334
+ Array.prototype.forEach.call(ssrStyles, function (node
1335
+ /*: HTMLStyleElement */
1336
+ ) {
1481
1337
  // we want to only move elements which have a space in the data-emotion attribute value
1482
1338
  // because that indicates that it is an Emotion 11 server-side rendered style elements
1483
1339
  // while we will already ignore Emotion 11 client-side inserted styles because of the :not([data-s]) part in the selector
@@ -1489,6 +1345,7 @@ var createCache = function createCache(options) {
1489
1345
  if (dataEmotionAttribute.indexOf(' ') === -1) {
1490
1346
  return;
1491
1347
  }
1348
+
1492
1349
  document.head.appendChild(node);
1493
1350
  node.setAttribute('data-s', '');
1494
1351
  });
@@ -1496,23 +1353,20 @@ var createCache = function createCache(options) {
1496
1353
 
1497
1354
  var stylisPlugins = options.stylisPlugins || defaultStylisPlugins;
1498
1355
 
1499
- if (process.env.NODE_ENV !== 'production') {
1500
- // $FlowFixMe
1501
- if (/[^a-z-]/.test(key)) {
1502
- throw new Error("Emotion key must only contain lower case alphabetical characters and - but \"" + key + "\" was passed");
1503
- }
1504
- }
1505
-
1506
1356
  var inserted = {};
1507
1357
  var container;
1358
+ /* : Node */
1359
+
1508
1360
  var nodesToHydrate = [];
1509
1361
 
1510
- if (isBrowser$4) {
1362
+ if (isBrowser$3) {
1511
1363
  container = options.container || document.head;
1512
1364
  Array.prototype.forEach.call( // this means we will ignore elements which don't have a space in them which
1513
1365
  // means that the style elements we're looking at are only Emotion 11 server-rendered style elements
1514
- document.querySelectorAll("style[data-emotion^=\"" + key + " \"]"), function (node) {
1515
- var attrib = node.getAttribute("data-emotion").split(' '); // $FlowFixMe
1366
+ document.querySelectorAll("style[data-emotion^=\"" + key + " \"]"), function (node
1367
+ /*: HTMLStyleElement */
1368
+ ) {
1369
+ var attrib = node.getAttribute("data-emotion").split(' ');
1516
1370
 
1517
1371
  for (var i = 1; i < attrib.length; i++) {
1518
1372
  inserted[attrib[i]] = true;
@@ -1523,31 +1377,19 @@ var createCache = function createCache(options) {
1523
1377
  }
1524
1378
 
1525
1379
  var _insert;
1380
+ /*: (
1381
+ selector: string,
1382
+ serialized: SerializedStyles,
1383
+ sheet: StyleSheet,
1384
+ shouldCache: boolean
1385
+ ) => string | void */
1526
1386
 
1527
- var omnipresentPlugins = [compat, removeLabel];
1528
-
1529
- if (process.env.NODE_ENV !== 'production') {
1530
- omnipresentPlugins.push(createUnsafeSelectorsAlarm({
1531
- get compat() {
1532
- return cache.compat;
1533
- }
1534
1387
 
1535
- }), incorrectImportAlarm);
1536
- }
1388
+ var omnipresentPlugins = [compat, removeLabel];
1537
1389
 
1538
- if (isBrowser$4) {
1390
+ if (isBrowser$3) {
1539
1391
  var currentSheet;
1540
- var finalizingPlugins = [stringify, process.env.NODE_ENV !== 'production' ? function (element) {
1541
- if (!element.root) {
1542
- if (element["return"]) {
1543
- currentSheet.insert(element["return"]);
1544
- } else if (element.value && element.type !== COMMENT) {
1545
- // insert empty rule in non-production environments
1546
- // so @emotion/jest can grab `key` from the (JS)DOM for caches without any rules inserted yet
1547
- currentSheet.insert(element.value + "{}");
1548
- }
1549
- }
1550
- } : rulesheet(function (rule) {
1392
+ var finalizingPlugins = [stringify, rulesheet(function (rule) {
1551
1393
  currentSheet.insert(rule);
1552
1394
  })];
1553
1395
  var serializer = middleware(omnipresentPlugins.concat(stylisPlugins, finalizingPlugins));
@@ -1556,17 +1398,19 @@ var createCache = function createCache(options) {
1556
1398
  return serialize(compile(styles), serializer);
1557
1399
  };
1558
1400
 
1559
- _insert = function insert(selector, serialized, sheet, shouldCache) {
1401
+ _insert = function
1402
+ /*: void */
1403
+ insert(selector
1404
+ /*: string */
1405
+ , serialized
1406
+ /*: SerializedStyles */
1407
+ , sheet
1408
+ /*: StyleSheet */
1409
+ , shouldCache
1410
+ /*: boolean */
1411
+ ) {
1560
1412
  currentSheet = sheet;
1561
1413
 
1562
- if (process.env.NODE_ENV !== 'production' && serialized.map !== undefined) {
1563
- currentSheet = {
1564
- insert: function insert(rule) {
1565
- sheet.insert(rule + serialized.map);
1566
- }
1567
- };
1568
- }
1569
-
1570
1414
  stylis(selector ? selector + "{" + serialized.styles + "}" : serialized.styles);
1571
1415
 
1572
1416
  if (shouldCache) {
@@ -1580,12 +1424,17 @@ var createCache = function createCache(options) {
1580
1424
 
1581
1425
  var _stylis = function _stylis(styles) {
1582
1426
  return serialize(compile(styles), _serializer);
1583
- }; // $FlowFixMe
1584
-
1427
+ };
1585
1428
 
1586
1429
  var serverStylisCache = getServerStylisCache(stylisPlugins)(key);
1587
1430
 
1588
- var getRules = function getRules(selector, serialized) {
1431
+ var getRules = function
1432
+ /*: string */
1433
+ getRules(selector
1434
+ /*: string */
1435
+ , serialized
1436
+ /*: SerializedStyles */
1437
+ ) {
1589
1438
  var name = serialized.name;
1590
1439
 
1591
1440
  if (serverStylisCache[name] === undefined) {
@@ -1595,7 +1444,17 @@ var createCache = function createCache(options) {
1595
1444
  return serverStylisCache[name];
1596
1445
  };
1597
1446
 
1598
- _insert = function _insert(selector, serialized, sheet, shouldCache) {
1447
+ _insert = function
1448
+ /*: string | void */
1449
+ _insert(selector
1450
+ /*: string */
1451
+ , serialized
1452
+ /*: SerializedStyles */
1453
+ , sheet
1454
+ /*: StyleSheet */
1455
+ , shouldCache
1456
+ /*: boolean */
1457
+ ) {
1599
1458
  var name = serialized.name;
1600
1459
  var rules = getRules(selector, serialized);
1601
1460
 
@@ -1607,12 +1466,6 @@ var createCache = function createCache(options) {
1607
1466
  cache.inserted[name] = true;
1608
1467
  }
1609
1468
 
1610
- if ( // using === development instead of !== production
1611
- // because if people do ssr in tests, the source maps showing up would be annoying
1612
- process.env.NODE_ENV === 'development' && serialized.map !== undefined) {
1613
- return rules + serialized.map;
1614
- }
1615
-
1616
1469
  return rules;
1617
1470
  } else {
1618
1471
  // in compat mode, we put the styles on the inserted cache so
@@ -1631,7 +1484,9 @@ var createCache = function createCache(options) {
1631
1484
  };
1632
1485
  }
1633
1486
 
1634
- var cache = {
1487
+ var cache
1488
+ /*: EmotionCache */
1489
+ = {
1635
1490
  key: key,
1636
1491
  sheet: new StyleSheet({
1637
1492
  key: key,
@@ -1650,213 +1505,7 @@ var createCache = function createCache(options) {
1650
1505
  return cache;
1651
1506
  };
1652
1507
 
1653
- var reactIs$1 = {exports: {}};
1654
-
1655
- var reactIs_production_min = {};
1656
-
1657
- /** @license React v16.13.1
1658
- * react-is.production.min.js
1659
- *
1660
- * Copyright (c) Facebook, Inc. and its affiliates.
1661
- *
1662
- * This source code is licensed under the MIT license found in the
1663
- * LICENSE file in the root directory of this source tree.
1664
- */
1665
- var b="function"===typeof Symbol&&Symbol.for,c=b?Symbol.for("react.element"):60103,d=b?Symbol.for("react.portal"):60106,e=b?Symbol.for("react.fragment"):60107,f=b?Symbol.for("react.strict_mode"):60108,g=b?Symbol.for("react.profiler"):60114,h=b?Symbol.for("react.provider"):60109,k=b?Symbol.for("react.context"):60110,l=b?Symbol.for("react.async_mode"):60111,m=b?Symbol.for("react.concurrent_mode"):60111,n=b?Symbol.for("react.forward_ref"):60112,p=b?Symbol.for("react.suspense"):60113,q=b?
1666
- Symbol.for("react.suspense_list"):60120,r=b?Symbol.for("react.memo"):60115,t=b?Symbol.for("react.lazy"):60116,v=b?Symbol.for("react.block"):60121,w$1=b?Symbol.for("react.fundamental"):60117,x=b?Symbol.for("react.responder"):60118,y=b?Symbol.for("react.scope"):60119;
1667
- function z(a){if("object"===typeof a&&null!==a){var u=a.$$typeof;switch(u){case c:switch(a=a.type,a){case l:case m:case e:case g:case f:case p:return a;default:switch(a=a&&a.$$typeof,a){case k:case n:case t:case r:case h:return a;default:return u}}case d:return u}}}function A(a){return z(a)===m}reactIs_production_min.AsyncMode=l;reactIs_production_min.ConcurrentMode=m;reactIs_production_min.ContextConsumer=k;reactIs_production_min.ContextProvider=h;reactIs_production_min.Element=c;reactIs_production_min.ForwardRef=n;reactIs_production_min.Fragment=e;reactIs_production_min.Lazy=t;reactIs_production_min.Memo=r;reactIs_production_min.Portal=d;
1668
- reactIs_production_min.Profiler=g;reactIs_production_min.StrictMode=f;reactIs_production_min.Suspense=p;reactIs_production_min.isAsyncMode=function(a){return A(a)||z(a)===l};reactIs_production_min.isConcurrentMode=A;reactIs_production_min.isContextConsumer=function(a){return z(a)===k};reactIs_production_min.isContextProvider=function(a){return z(a)===h};reactIs_production_min.isElement=function(a){return "object"===typeof a&&null!==a&&a.$$typeof===c};reactIs_production_min.isForwardRef=function(a){return z(a)===n};reactIs_production_min.isFragment=function(a){return z(a)===e};reactIs_production_min.isLazy=function(a){return z(a)===t};
1669
- reactIs_production_min.isMemo=function(a){return z(a)===r};reactIs_production_min.isPortal=function(a){return z(a)===d};reactIs_production_min.isProfiler=function(a){return z(a)===g};reactIs_production_min.isStrictMode=function(a){return z(a)===f};reactIs_production_min.isSuspense=function(a){return z(a)===p};
1670
- reactIs_production_min.isValidElementType=function(a){return "string"===typeof a||"function"===typeof a||a===e||a===m||a===g||a===f||a===p||a===q||"object"===typeof a&&null!==a&&(a.$$typeof===t||a.$$typeof===r||a.$$typeof===h||a.$$typeof===k||a.$$typeof===n||a.$$typeof===w$1||a.$$typeof===x||a.$$typeof===y||a.$$typeof===v)};reactIs_production_min.typeOf=z;
1671
-
1672
- var reactIs_development = {};
1673
-
1674
- /** @license React v16.13.1
1675
- * react-is.development.js
1676
- *
1677
- * Copyright (c) Facebook, Inc. and its affiliates.
1678
- *
1679
- * This source code is licensed under the MIT license found in the
1680
- * LICENSE file in the root directory of this source tree.
1681
- */
1682
-
1683
-
1684
-
1685
- if (process.env.NODE_ENV !== "production") {
1686
- (function() {
1687
-
1688
- // The Symbol used to tag the ReactElement-like types. If there is no native Symbol
1689
- // nor polyfill, then a plain number is used for performance.
1690
- var hasSymbol = typeof Symbol === 'function' && Symbol.for;
1691
- var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
1692
- var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
1693
- var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
1694
- var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
1695
- var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
1696
- var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
1697
- var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary
1698
- // (unstable) APIs that have been removed. Can we remove the symbols?
1699
-
1700
- var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;
1701
- var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
1702
- var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
1703
- var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
1704
- var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;
1705
- var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
1706
- var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
1707
- var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9;
1708
- var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5;
1709
- var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6;
1710
- var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7;
1711
-
1712
- function isValidElementType(type) {
1713
- return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
1714
- type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_BLOCK_TYPE);
1715
- }
1716
-
1717
- function typeOf(object) {
1718
- if (typeof object === 'object' && object !== null) {
1719
- var $$typeof = object.$$typeof;
1720
-
1721
- switch ($$typeof) {
1722
- case REACT_ELEMENT_TYPE:
1723
- var type = object.type;
1724
-
1725
- switch (type) {
1726
- case REACT_ASYNC_MODE_TYPE:
1727
- case REACT_CONCURRENT_MODE_TYPE:
1728
- case REACT_FRAGMENT_TYPE:
1729
- case REACT_PROFILER_TYPE:
1730
- case REACT_STRICT_MODE_TYPE:
1731
- case REACT_SUSPENSE_TYPE:
1732
- return type;
1733
-
1734
- default:
1735
- var $$typeofType = type && type.$$typeof;
1736
-
1737
- switch ($$typeofType) {
1738
- case REACT_CONTEXT_TYPE:
1739
- case REACT_FORWARD_REF_TYPE:
1740
- case REACT_LAZY_TYPE:
1741
- case REACT_MEMO_TYPE:
1742
- case REACT_PROVIDER_TYPE:
1743
- return $$typeofType;
1744
-
1745
- default:
1746
- return $$typeof;
1747
- }
1748
-
1749
- }
1750
-
1751
- case REACT_PORTAL_TYPE:
1752
- return $$typeof;
1753
- }
1754
- }
1755
-
1756
- return undefined;
1757
- } // AsyncMode is deprecated along with isAsyncMode
1758
-
1759
- var AsyncMode = REACT_ASYNC_MODE_TYPE;
1760
- var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
1761
- var ContextConsumer = REACT_CONTEXT_TYPE;
1762
- var ContextProvider = REACT_PROVIDER_TYPE;
1763
- var Element = REACT_ELEMENT_TYPE;
1764
- var ForwardRef = REACT_FORWARD_REF_TYPE;
1765
- var Fragment = REACT_FRAGMENT_TYPE;
1766
- var Lazy = REACT_LAZY_TYPE;
1767
- var Memo = REACT_MEMO_TYPE;
1768
- var Portal = REACT_PORTAL_TYPE;
1769
- var Profiler = REACT_PROFILER_TYPE;
1770
- var StrictMode = REACT_STRICT_MODE_TYPE;
1771
- var Suspense = REACT_SUSPENSE_TYPE;
1772
- var hasWarnedAboutDeprecatedIsAsyncMode = false; // AsyncMode should be deprecated
1773
-
1774
- function isAsyncMode(object) {
1775
- {
1776
- if (!hasWarnedAboutDeprecatedIsAsyncMode) {
1777
- hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint
1778
-
1779
- console['warn']('The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 17+. Update your code to use ' + 'ReactIs.isConcurrentMode() instead. It has the exact same API.');
1780
- }
1781
- }
1782
-
1783
- return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE;
1784
- }
1785
- function isConcurrentMode(object) {
1786
- return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;
1787
- }
1788
- function isContextConsumer(object) {
1789
- return typeOf(object) === REACT_CONTEXT_TYPE;
1790
- }
1791
- function isContextProvider(object) {
1792
- return typeOf(object) === REACT_PROVIDER_TYPE;
1793
- }
1794
- function isElement(object) {
1795
- return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
1796
- }
1797
- function isForwardRef(object) {
1798
- return typeOf(object) === REACT_FORWARD_REF_TYPE;
1799
- }
1800
- function isFragment(object) {
1801
- return typeOf(object) === REACT_FRAGMENT_TYPE;
1802
- }
1803
- function isLazy(object) {
1804
- return typeOf(object) === REACT_LAZY_TYPE;
1805
- }
1806
- function isMemo(object) {
1807
- return typeOf(object) === REACT_MEMO_TYPE;
1808
- }
1809
- function isPortal(object) {
1810
- return typeOf(object) === REACT_PORTAL_TYPE;
1811
- }
1812
- function isProfiler(object) {
1813
- return typeOf(object) === REACT_PROFILER_TYPE;
1814
- }
1815
- function isStrictMode(object) {
1816
- return typeOf(object) === REACT_STRICT_MODE_TYPE;
1817
- }
1818
- function isSuspense(object) {
1819
- return typeOf(object) === REACT_SUSPENSE_TYPE;
1820
- }
1821
-
1822
- reactIs_development.AsyncMode = AsyncMode;
1823
- reactIs_development.ConcurrentMode = ConcurrentMode;
1824
- reactIs_development.ContextConsumer = ContextConsumer;
1825
- reactIs_development.ContextProvider = ContextProvider;
1826
- reactIs_development.Element = Element;
1827
- reactIs_development.ForwardRef = ForwardRef;
1828
- reactIs_development.Fragment = Fragment;
1829
- reactIs_development.Lazy = Lazy;
1830
- reactIs_development.Memo = Memo;
1831
- reactIs_development.Portal = Portal;
1832
- reactIs_development.Profiler = Profiler;
1833
- reactIs_development.StrictMode = StrictMode;
1834
- reactIs_development.Suspense = Suspense;
1835
- reactIs_development.isAsyncMode = isAsyncMode;
1836
- reactIs_development.isConcurrentMode = isConcurrentMode;
1837
- reactIs_development.isContextConsumer = isContextConsumer;
1838
- reactIs_development.isContextProvider = isContextProvider;
1839
- reactIs_development.isElement = isElement;
1840
- reactIs_development.isForwardRef = isForwardRef;
1841
- reactIs_development.isFragment = isFragment;
1842
- reactIs_development.isLazy = isLazy;
1843
- reactIs_development.isMemo = isMemo;
1844
- reactIs_development.isPortal = isPortal;
1845
- reactIs_development.isProfiler = isProfiler;
1846
- reactIs_development.isStrictMode = isStrictMode;
1847
- reactIs_development.isSuspense = isSuspense;
1848
- reactIs_development.isValidElementType = isValidElementType;
1849
- reactIs_development.typeOf = typeOf;
1850
- })();
1851
- }
1852
-
1853
- if (process.env.NODE_ENV === 'production') {
1854
- reactIs$1.exports = reactIs_production_min;
1855
- } else {
1856
- reactIs$1.exports = reactIs_development;
1857
- }
1858
-
1859
- var reactIs = reactIs$1.exports;
1508
+ var reactIs = defaultTheme$1.reactIs.exports;
1860
1509
  var FORWARD_REF_STATICS = {
1861
1510
  '$$typeof': true,
1862
1511
  render: true,
@@ -1876,7 +1525,8 @@ var TYPE_STATICS = {};
1876
1525
  TYPE_STATICS[reactIs.ForwardRef] = FORWARD_REF_STATICS;
1877
1526
  TYPE_STATICS[reactIs.Memo] = MEMO_STATICS;
1878
1527
 
1879
- var isBrowser$3 = typeof document !== 'undefined';
1528
+ var isBrowser$2 = typeof document !== 'undefined';
1529
+
1880
1530
  function getRegisteredStyles(registered, registeredStyles, classNames) {
1881
1531
  var rawClassName = '';
1882
1532
  classNames.split(' ').forEach(function (className) {
@@ -1900,7 +1550,7 @@ var registerStyles = function registerStyles(cache, serialized, isStringTag) {
1900
1550
  // in node since emotion-server relies on whether a style is in
1901
1551
  // the registered cache to know whether a style is global or not
1902
1552
  // also, note that this check will be dead code eliminated in the browser
1903
- isBrowser$3 === false && cache.compat !== undefined) && cache.registered[className] === undefined) {
1553
+ isBrowser$2 === false && cache.compat !== undefined) && cache.registered[className] === undefined) {
1904
1554
  cache.registered[className] = serialized.styles;
1905
1555
  }
1906
1556
  };
@@ -1915,14 +1565,14 @@ var insertStyles = function insertStyles(cache, serialized, isStringTag) {
1915
1565
  do {
1916
1566
  var maybeStyles = cache.insert(serialized === current ? "." + className : '', current, cache.sheet, true);
1917
1567
 
1918
- if (!isBrowser$3 && maybeStyles !== undefined) {
1568
+ if (!isBrowser$2 && maybeStyles !== undefined) {
1919
1569
  stylesForSSR += maybeStyles;
1920
1570
  }
1921
1571
 
1922
1572
  current = current.next;
1923
1573
  } while (current !== undefined);
1924
1574
 
1925
- if (!isBrowser$3 && stylesForSSR.length !== 0) {
1575
+ if (!isBrowser$2 && stylesForSSR.length !== 0) {
1926
1576
  return stylesForSSR;
1927
1577
  }
1928
1578
  }
@@ -2032,16 +1682,8 @@ var unitlessKeys = {
2032
1682
  strokeWidth: 1
2033
1683
  };
2034
1684
 
2035
- function memoize(fn) {
2036
- var cache = Object.create(null);
2037
- return function (arg) {
2038
- if (cache[arg] === undefined) cache[arg] = fn(arg);
2039
- return cache[arg];
2040
- };
2041
- }
1685
+ var isDevelopment$1 = false;
2042
1686
 
2043
- var ILLEGAL_ESCAPE_SEQUENCE_ERROR = "You have illegal escape sequence in your template literal, most likely inside content's property value.\nBecause you write your CSS inside a JavaScript string you actually have to do double escaping, so for example \"content: '\\00d7';\" should become \"content: '\\\\00d7';\".\nYou can read more about this here:\nhttps://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#ES2018_revision_of_illegal_escape_sequences";
2044
- var UNDEFINED_AS_OBJECT_KEY_ERROR = "You have passed in falsy value as style object's key (can happen when in example you pass unexported component as computed key).";
2045
1687
  var hyphenateRegex = /[A-Z]|^ms/g;
2046
1688
  var animationRegex = /_EMO_([^_]+?)_([^]*?)_EMO_/g;
2047
1689
 
@@ -2082,34 +1724,6 @@ var processStyleValue = function processStyleValue(key, value) {
2082
1724
  return value;
2083
1725
  };
2084
1726
 
2085
- if (process.env.NODE_ENV !== 'production') {
2086
- var contentValuePattern = /(var|attr|counters?|url|element|(((repeating-)?(linear|radial))|conic)-gradient)\(|(no-)?(open|close)-quote/;
2087
- var contentValues = ['normal', 'none', 'initial', 'inherit', 'unset'];
2088
- var oldProcessStyleValue = processStyleValue;
2089
- var msPattern = /^-ms-/;
2090
- var hyphenPattern = /-(.)/g;
2091
- var hyphenatedCache = {};
2092
-
2093
- processStyleValue = function processStyleValue(key, value) {
2094
- if (key === 'content') {
2095
- if (typeof value !== 'string' || contentValues.indexOf(value) === -1 && !contentValuePattern.test(value) && (value.charAt(0) !== value.charAt(value.length - 1) || value.charAt(0) !== '"' && value.charAt(0) !== "'")) {
2096
- throw new Error("You seem to be using a value for 'content' without quotes, try replacing it with `content: '\"" + value + "\"'`");
2097
- }
2098
- }
2099
-
2100
- var processed = oldProcessStyleValue(key, value);
2101
-
2102
- if (processed !== '' && !isCustomProperty(key) && key.indexOf('-') !== -1 && hyphenatedCache[key] === undefined) {
2103
- hyphenatedCache[key] = true;
2104
- console.error("Using kebab-case for css properties in objects is not supported. Did you mean " + key.replace(msPattern, 'ms-').replace(hyphenPattern, function (str, _char) {
2105
- return _char.toUpperCase();
2106
- }) + "?");
2107
- }
2108
-
2109
- return processed;
2110
- };
2111
- }
2112
-
2113
1727
  var noComponentSelectorMessage = 'Component selectors can only be used in conjunction with ' + '@emotion/babel-plugin, the swc Emotion plugin, or another Emotion-aware ' + 'compiler transform.';
2114
1728
 
2115
1729
  function handleInterpolation(mergedProps, registered, interpolation) {
@@ -2117,12 +1731,11 @@ function handleInterpolation(mergedProps, registered, interpolation) {
2117
1731
  return '';
2118
1732
  }
2119
1733
 
2120
- if (interpolation.__emotion_styles !== undefined) {
2121
- if (process.env.NODE_ENV !== 'production' && interpolation.toString() === 'NO_COMPONENT_SELECTOR') {
2122
- throw new Error(noComponentSelectorMessage);
2123
- }
1734
+ var componentSelector = interpolation;
2124
1735
 
2125
- return interpolation;
1736
+ if (componentSelector.__emotion_styles !== undefined) {
1737
+
1738
+ return componentSelector;
2126
1739
  }
2127
1740
 
2128
1741
  switch (typeof interpolation) {
@@ -2133,17 +1746,21 @@ function handleInterpolation(mergedProps, registered, interpolation) {
2133
1746
 
2134
1747
  case 'object':
2135
1748
  {
2136
- if (interpolation.anim === 1) {
1749
+ var keyframes = interpolation;
1750
+
1751
+ if (keyframes.anim === 1) {
2137
1752
  cursor = {
2138
- name: interpolation.name,
2139
- styles: interpolation.styles,
1753
+ name: keyframes.name,
1754
+ styles: keyframes.styles,
2140
1755
  next: cursor
2141
1756
  };
2142
- return interpolation.name;
1757
+ return keyframes.name;
2143
1758
  }
2144
1759
 
2145
- if (interpolation.styles !== undefined) {
2146
- var next = interpolation.next;
1760
+ var serializedStyles = interpolation;
1761
+
1762
+ if (serializedStyles.styles !== undefined) {
1763
+ var next = serializedStyles.next;
2147
1764
 
2148
1765
  if (next !== undefined) {
2149
1766
  // not the most efficient thing ever but this is a pretty rare case
@@ -2158,11 +1775,7 @@ function handleInterpolation(mergedProps, registered, interpolation) {
2158
1775
  }
2159
1776
  }
2160
1777
 
2161
- var styles = interpolation.styles + ";";
2162
-
2163
- if (process.env.NODE_ENV !== 'production' && interpolation.map !== undefined) {
2164
- styles += interpolation.map;
2165
- }
1778
+ var styles = serializedStyles.styles + ";";
2166
1779
 
2167
1780
  return styles;
2168
1781
  }
@@ -2177,37 +1790,21 @@ function handleInterpolation(mergedProps, registered, interpolation) {
2177
1790
  var result = interpolation(mergedProps);
2178
1791
  cursor = previousCursor;
2179
1792
  return handleInterpolation(mergedProps, registered, result);
2180
- } else if (process.env.NODE_ENV !== 'production') {
2181
- console.error('Functions that are interpolated in css calls will be stringified.\n' + 'If you want to have a css call based on props, create a function that returns a css call like this\n' + 'let dynamicStyle = (props) => css`color: ${props.color}`\n' + 'It can be called directly with props or interpolated in a styled call like this\n' + "let SomeComponent = styled('div')`${dynamicStyle}`");
2182
1793
  }
2183
1794
 
2184
1795
  break;
2185
1796
  }
2186
-
2187
- case 'string':
2188
- if (process.env.NODE_ENV !== 'production') {
2189
- var matched = [];
2190
- var replaced = interpolation.replace(animationRegex, function (match, p1, p2) {
2191
- var fakeVarName = "animation" + matched.length;
2192
- matched.push("const " + fakeVarName + " = keyframes`" + p2.replace(/^@keyframes animation-\w+/, '') + "`");
2193
- return "${" + fakeVarName + "}";
2194
- });
2195
-
2196
- if (matched.length) {
2197
- console.error('`keyframes` output got interpolated into plain string, please wrap it with `css`.\n\n' + 'Instead of doing this:\n\n' + [].concat(matched, ["`" + replaced + "`"]).join('\n') + '\n\nYou should wrap it with `css` like this:\n\n' + ("css`" + replaced + "`"));
2198
- }
2199
- }
2200
-
2201
- break;
2202
1797
  } // finalize string values (regular strings and functions interpolated into css calls)
2203
1798
 
2204
1799
 
1800
+ var asString = interpolation;
1801
+
2205
1802
  if (registered == null) {
2206
- return interpolation;
1803
+ return asString;
2207
1804
  }
2208
1805
 
2209
- var cached = registered[interpolation];
2210
- return cached !== undefined ? cached : interpolation;
1806
+ var cached = registered[asString];
1807
+ return cached !== undefined ? cached : asString;
2211
1808
  }
2212
1809
 
2213
1810
  function createStringFromObject(mergedProps, registered, obj) {
@@ -2218,44 +1815,43 @@ function createStringFromObject(mergedProps, registered, obj) {
2218
1815
  string += handleInterpolation(mergedProps, registered, obj[i]) + ";";
2219
1816
  }
2220
1817
  } else {
2221
- for (var _key in obj) {
2222
- var value = obj[_key];
1818
+ for (var key in obj) {
1819
+ var value = obj[key];
2223
1820
 
2224
1821
  if (typeof value !== 'object') {
2225
- if (registered != null && registered[value] !== undefined) {
2226
- string += _key + "{" + registered[value] + "}";
2227
- } else if (isProcessableValue(value)) {
2228
- string += processStyleName(_key) + ":" + processStyleValue(_key, value) + ";";
1822
+ var asString = value;
1823
+
1824
+ if (registered != null && registered[asString] !== undefined) {
1825
+ string += key + "{" + registered[asString] + "}";
1826
+ } else if (isProcessableValue(asString)) {
1827
+ string += processStyleName(key) + ":" + processStyleValue(key, asString) + ";";
2229
1828
  }
2230
1829
  } else {
2231
- if (_key === 'NO_COMPONENT_SELECTOR' && process.env.NODE_ENV !== 'production') {
1830
+ if (key === 'NO_COMPONENT_SELECTOR' && isDevelopment$1) {
2232
1831
  throw new Error(noComponentSelectorMessage);
2233
1832
  }
2234
1833
 
2235
1834
  if (Array.isArray(value) && typeof value[0] === 'string' && (registered == null || registered[value[0]] === undefined)) {
2236
1835
  for (var _i = 0; _i < value.length; _i++) {
2237
1836
  if (isProcessableValue(value[_i])) {
2238
- string += processStyleName(_key) + ":" + processStyleValue(_key, value[_i]) + ";";
1837
+ string += processStyleName(key) + ":" + processStyleValue(key, value[_i]) + ";";
2239
1838
  }
2240
1839
  }
2241
1840
  } else {
2242
1841
  var interpolated = handleInterpolation(mergedProps, registered, value);
2243
1842
 
2244
- switch (_key) {
1843
+ switch (key) {
2245
1844
  case 'animation':
2246
1845
  case 'animationName':
2247
1846
  {
2248
- string += processStyleName(_key) + ":" + interpolated + ";";
1847
+ string += processStyleName(key) + ":" + interpolated + ";";
2249
1848
  break;
2250
1849
  }
2251
1850
 
2252
1851
  default:
2253
1852
  {
2254
- if (process.env.NODE_ENV !== 'production' && _key === 'undefined') {
2255
- console.error(UNDEFINED_AS_OBJECT_KEY_ERROR);
2256
- }
2257
1853
 
2258
- string += _key + "{" + interpolated + "}";
1854
+ string += key + "{" + interpolated + "}";
2259
1855
  }
2260
1856
  }
2261
1857
  }
@@ -2267,16 +1863,11 @@ function createStringFromObject(mergedProps, registered, obj) {
2267
1863
  }
2268
1864
 
2269
1865
  var labelPattern = /label:\s*([^\s;\n{]+)\s*(;|$)/g;
2270
- var sourceMapPattern;
2271
-
2272
- if (process.env.NODE_ENV !== 'production') {
2273
- sourceMapPattern = /\/\*#\ssourceMappingURL=data:application\/json;\S+\s+\*\//g;
2274
- } // this is the cursor for keyframes
2275
1866
  // keyframes are stored on the SerializedStyles object as a linked list
2276
1867
 
2277
1868
 
2278
1869
  var cursor;
2279
- var serializeStyles = function serializeStyles(args, registered, mergedProps) {
1870
+ function serializeStyles(args, registered, mergedProps) {
2280
1871
  if (args.length === 1 && typeof args[0] === 'object' && args[0] !== null && args[0].styles !== undefined) {
2281
1872
  return args[0];
2282
1873
  }
@@ -2290,11 +1881,9 @@ var serializeStyles = function serializeStyles(args, registered, mergedProps) {
2290
1881
  stringMode = false;
2291
1882
  styles += handleInterpolation(mergedProps, registered, strings);
2292
1883
  } else {
2293
- if (process.env.NODE_ENV !== 'production' && strings[0] === undefined) {
2294
- console.error(ILLEGAL_ESCAPE_SEQUENCE_ERROR);
2295
- }
1884
+ var asTemplateStringsArr = strings;
2296
1885
 
2297
- styles += strings[0];
1886
+ styles += asTemplateStringsArr[0];
2298
1887
  } // we start at 1 since we've already handled the first arg
2299
1888
 
2300
1889
 
@@ -2302,69 +1891,47 @@ var serializeStyles = function serializeStyles(args, registered, mergedProps) {
2302
1891
  styles += handleInterpolation(mergedProps, registered, args[i]);
2303
1892
 
2304
1893
  if (stringMode) {
2305
- if (process.env.NODE_ENV !== 'production' && strings[i] === undefined) {
2306
- console.error(ILLEGAL_ESCAPE_SEQUENCE_ERROR);
2307
- }
1894
+ var templateStringsArr = strings;
2308
1895
 
2309
- styles += strings[i];
1896
+ styles += templateStringsArr[i];
2310
1897
  }
2311
1898
  }
2312
1899
 
2313
- var sourceMap;
2314
-
2315
- if (process.env.NODE_ENV !== 'production') {
2316
- styles = styles.replace(sourceMapPattern, function (match) {
2317
- sourceMap = match;
2318
- return '';
2319
- });
2320
- } // using a global regex with .exec is stateful so lastIndex has to be reset each time
2321
-
2322
1900
 
2323
1901
  labelPattern.lastIndex = 0;
2324
1902
  var identifierName = '';
2325
1903
  var match; // https://esbench.com/bench/5b809c2cf2949800a0f61fb5
2326
1904
 
2327
1905
  while ((match = labelPattern.exec(styles)) !== null) {
2328
- identifierName += '-' + // $FlowFixMe we know it's not null
2329
- match[1];
1906
+ identifierName += '-' + match[1];
2330
1907
  }
2331
1908
 
2332
1909
  var name = murmur2(styles) + identifierName;
2333
1910
 
2334
- if (process.env.NODE_ENV !== 'production') {
2335
- // $FlowFixMe SerializedStyles type doesn't have toString property (and we don't want to add it)
2336
- return {
2337
- name: name,
2338
- styles: styles,
2339
- map: sourceMap,
2340
- next: cursor,
2341
- toString: function toString() {
2342
- return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop).";
2343
- }
2344
- };
2345
- }
2346
-
2347
1911
  return {
2348
1912
  name: name,
2349
1913
  styles: styles,
2350
1914
  next: cursor
2351
1915
  };
2352
- };
1916
+ }
2353
1917
 
2354
- var isBrowser$2 = typeof document !== 'undefined';
1918
+ var isBrowser$1 = typeof document !== 'undefined';
2355
1919
 
2356
1920
  var syncFallback = function syncFallback(create) {
2357
1921
  return create();
2358
1922
  };
2359
1923
 
2360
1924
  var useInsertionEffect = React__namespace['useInsertion' + 'Effect'] ? React__namespace['useInsertion' + 'Effect'] : false;
2361
- var useInsertionEffectAlwaysWithSyncFallback = !isBrowser$2 ? syncFallback : useInsertionEffect || syncFallback;
2362
- var useInsertionEffectWithLayoutFallback = useInsertionEffect || React__namespace.useLayoutEffect;
1925
+ var useInsertionEffectAlwaysWithSyncFallback = !isBrowser$1 ? syncFallback : useInsertionEffect || syncFallback;
2363
1926
 
2364
- var isBrowser$1 = typeof document !== 'undefined';
2365
- var hasOwnProperty = {}.hasOwnProperty;
1927
+ var isDevelopment = false;
1928
+
1929
+ var isBrowser = typeof document !== 'undefined';
2366
1930
 
2367
- var EmotionCacheContext = /* #__PURE__ */React__namespace.createContext( // we're doing this to avoid preconstruct's dead code elimination in this one case
1931
+ /* import { type EmotionCache } from '@emotion/utils' */
1932
+ var EmotionCacheContext
1933
+ /*: React.Context<EmotionCache | null> */
1934
+ = /* #__PURE__ */React__namespace.createContext( // we're doing this to avoid preconstruct's dead code elimination in this one case
2368
1935
  // because this module is primarily intended for the browser and node
2369
1936
  // but it's also required in react native and similar environments sometimes
2370
1937
  // and we could have a special build just for that
@@ -2374,24 +1941,37 @@ typeof HTMLElement !== 'undefined' ? /* #__PURE__ */createCache({
2374
1941
  key: 'css'
2375
1942
  }) : null);
2376
1943
 
2377
- if (process.env.NODE_ENV !== 'production') {
2378
- EmotionCacheContext.displayName = 'EmotionCacheContext';
2379
- }
2380
-
2381
1944
  EmotionCacheContext.Provider;
2382
1945
 
2383
- var withEmotionCache = function withEmotionCache(func) {
2384
- // $FlowFixMe
2385
- return /*#__PURE__*/React.forwardRef(function (props, ref) {
1946
+ var withEmotionCache = function withEmotionCache
1947
+ /* <Props, Ref: React.Ref<*>> */
1948
+ (func
1949
+ /*: (props: Props, cache: EmotionCache, ref: Ref) => React.Node */
1950
+ )
1951
+ /*: React.AbstractComponent<Props> */
1952
+ {
1953
+ return /*#__PURE__*/React.forwardRef(function (props
1954
+ /*: Props */
1955
+ , ref
1956
+ /*: Ref */
1957
+ ) {
2386
1958
  // the cache will never be null in the browser
2387
1959
  var cache = React.useContext(EmotionCacheContext);
2388
1960
  return func(props, cache, ref);
2389
1961
  });
2390
1962
  };
2391
1963
 
2392
- if (!isBrowser$1) {
2393
- withEmotionCache = function withEmotionCache(func) {
2394
- return function (props) {
1964
+ if (!isBrowser) {
1965
+ withEmotionCache = function withEmotionCache
1966
+ /* <Props> */
1967
+ (func
1968
+ /*: (props: Props, cache: EmotionCache) => React.Node */
1969
+ )
1970
+ /*: React.StatelessFunctionalComponent<Props> */
1971
+ {
1972
+ return function (props
1973
+ /*: Props */
1974
+ ) {
2395
1975
  var cache = React.useContext(EmotionCacheContext);
2396
1976
 
2397
1977
  if (cache === null) {
@@ -2415,81 +1995,31 @@ if (!isBrowser$1) {
2415
1995
 
2416
1996
  var ThemeContext = /* #__PURE__ */React__namespace.createContext({});
2417
1997
 
2418
- if (process.env.NODE_ENV !== 'production') {
2419
- ThemeContext.displayName = 'EmotionThemeContext';
2420
- }
2421
-
2422
- var getLastPart = function getLastPart(functionName) {
2423
- // The match may be something like 'Object.createEmotionProps' or
2424
- // 'Loader.prototype.render'
2425
- var parts = functionName.split('.');
2426
- return parts[parts.length - 1];
2427
- };
2428
-
2429
- var getFunctionNameFromStackTraceLine = function getFunctionNameFromStackTraceLine(line) {
2430
- // V8
2431
- var match = /^\s+at\s+([A-Za-z0-9$.]+)\s/.exec(line);
2432
- if (match) return getLastPart(match[1]); // Safari / Firefox
2433
-
2434
- match = /^([A-Za-z0-9$.]+)@/.exec(line);
2435
- if (match) return getLastPart(match[1]);
2436
- return undefined;
2437
- };
2438
-
2439
- var internalReactFunctionNames = /* #__PURE__ */new Set(['renderWithHooks', 'processChild', 'finishClassComponent', 'renderToString']); // These identifiers come from error stacks, so they have to be valid JS
2440
- // identifiers, thus we only need to replace what is a valid character for JS,
2441
- // but not for CSS.
2442
-
2443
- var sanitizeIdentifier = function sanitizeIdentifier(identifier) {
2444
- return identifier.replace(/\$/g, '-');
2445
- };
2446
-
2447
- var getLabelFromStackTrace = function getLabelFromStackTrace(stackTrace) {
2448
- if (!stackTrace) return undefined;
2449
- var lines = stackTrace.split('\n');
2450
-
2451
- for (var i = 0; i < lines.length; i++) {
2452
- var functionName = getFunctionNameFromStackTraceLine(lines[i]); // The first line of V8 stack traces is just "Error"
2453
-
2454
- if (!functionName) continue; // If we reach one of these, we have gone too far and should quit
2455
-
2456
- if (internalReactFunctionNames.has(functionName)) break; // The component name is the first function in the stack that starts with an
2457
- // uppercase letter
2458
-
2459
- if (/^[A-Z]/.test(functionName)) return sanitizeIdentifier(functionName);
2460
- }
2461
-
2462
- return undefined;
2463
- };
1998
+ var hasOwn = {}.hasOwnProperty;
2464
1999
 
2465
2000
  var typePropName = '__EMOTION_TYPE_PLEASE_DO_NOT_USE__';
2466
- var labelPropName = '__EMOTION_LABEL_PLEASE_DO_NOT_USE__';
2467
- var createEmotionProps = function createEmotionProps(type, props) {
2468
- if (process.env.NODE_ENV !== 'production' && typeof props.css === 'string' && // check if there is a css declaration
2469
- props.css.indexOf(':') !== -1) {
2470
- throw new Error("Strings are not allowed as css prop values, please wrap it in a css template literal from '@emotion/react' like this: css`" + props.css + "`");
2471
- }
2001
+ var createEmotionProps = function createEmotionProps(type
2002
+ /*: React.ElementType */
2003
+ , props
2004
+ /*: Object */
2005
+ ) {
2472
2006
 
2473
- var newProps = {};
2007
+ var newProps
2008
+ /*: any */
2009
+ = {};
2474
2010
 
2475
2011
  for (var key in props) {
2476
- if (hasOwnProperty.call(props, key)) {
2012
+ if (hasOwn.call(props, key)) {
2477
2013
  newProps[key] = props[key];
2478
2014
  }
2479
2015
  }
2480
2016
 
2481
- newProps[typePropName] = type; // For performance, only call getLabelFromStackTrace in development and when
2482
- // the label hasn't already been computed
2483
-
2484
- if (process.env.NODE_ENV !== 'production' && !!props.css && (typeof props.css !== 'object' || typeof props.css.name !== 'string' || props.css.name.indexOf('-') === -1)) {
2485
- var label = getLabelFromStackTrace(new Error().stack);
2486
- if (label) newProps[labelPropName] = label;
2487
- }
2017
+ newProps[typePropName] = type; // Runtime labeling is an opt-in feature because:
2488
2018
 
2489
2019
  return newProps;
2490
2020
  };
2491
2021
 
2492
- var Insertion$1 = function Insertion(_ref) {
2022
+ var Insertion = function Insertion(_ref) {
2493
2023
  var cache = _ref.cache,
2494
2024
  serialized = _ref.serialized,
2495
2025
  isStringTag = _ref.isStringTag;
@@ -2498,7 +2028,7 @@ var Insertion$1 = function Insertion(_ref) {
2498
2028
  return insertStyles(cache, serialized, isStringTag);
2499
2029
  });
2500
2030
 
2501
- if (!isBrowser$1 && rules !== undefined) {
2031
+ if (!isBrowser && rules !== undefined) {
2502
2032
  var _ref2;
2503
2033
 
2504
2034
  var serializedNames = serialized.name;
@@ -2517,7 +2047,9 @@ var Insertion$1 = function Insertion(_ref) {
2517
2047
  return null;
2518
2048
  };
2519
2049
 
2520
- var Emotion = /* #__PURE__ */withEmotionCache(function (props, cache, ref) {
2050
+ var Emotion = /* #__PURE__ */withEmotionCache(
2051
+ /* <any, any> */
2052
+ function (props, cache, ref) {
2521
2053
  var cssProp = props.css; // so that using `css` from `emotion` and passing the result to the css prop works
2522
2054
  // not passing the registered cache to serializeStyles because it would
2523
2055
  // make certain babel optimisations not possible
@@ -2538,175 +2070,42 @@ var Emotion = /* #__PURE__ */withEmotionCache(function (props, cache, ref) {
2538
2070
 
2539
2071
  var serialized = serializeStyles(registeredStyles, undefined, React__namespace.useContext(ThemeContext));
2540
2072
 
2541
- if (process.env.NODE_ENV !== 'production' && serialized.name.indexOf('-') === -1) {
2542
- var labelFromStack = props[labelPropName];
2543
-
2544
- if (labelFromStack) {
2545
- serialized = serializeStyles([serialized, 'label:' + labelFromStack + ';']);
2546
- }
2547
- }
2548
-
2549
2073
  className += cache.key + "-" + serialized.name;
2550
2074
  var newProps = {};
2551
2075
 
2552
2076
  for (var key in props) {
2553
- if (hasOwnProperty.call(props, key) && key !== 'css' && key !== typePropName && (process.env.NODE_ENV === 'production' || key !== labelPropName)) {
2077
+ if (hasOwn.call(props, key) && key !== 'css' && key !== typePropName && (!isDevelopment )) {
2554
2078
  newProps[key] = props[key];
2555
2079
  }
2556
2080
  }
2557
2081
 
2558
- newProps.ref = ref;
2559
2082
  newProps.className = className;
2560
- return /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, /*#__PURE__*/React__namespace.createElement(Insertion$1, {
2083
+
2084
+ if (ref) {
2085
+ newProps.ref = ref;
2086
+ }
2087
+
2088
+ return /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, /*#__PURE__*/React__namespace.createElement(Insertion, {
2561
2089
  cache: cache,
2562
2090
  serialized: serialized,
2563
2091
  isStringTag: typeof WrappedComponent === 'string'
2564
2092
  }), /*#__PURE__*/React__namespace.createElement(WrappedComponent, newProps));
2565
2093
  });
2566
2094
 
2567
- if (process.env.NODE_ENV !== 'production') {
2568
- Emotion.displayName = 'EmotionCssPropInternal';
2569
- }
2570
-
2571
2095
  var Emotion$1 = Emotion;
2572
2096
 
2573
- var pkg = {
2574
- name: "@emotion/react",
2575
- version: "11.11.1",
2576
- main: "dist/emotion-react.cjs.js",
2577
- module: "dist/emotion-react.esm.js",
2578
- browser: {
2579
- "./dist/emotion-react.esm.js": "./dist/emotion-react.browser.esm.js"
2580
- },
2581
- exports: {
2582
- ".": {
2583
- module: {
2584
- worker: "./dist/emotion-react.worker.esm.js",
2585
- browser: "./dist/emotion-react.browser.esm.js",
2586
- "default": "./dist/emotion-react.esm.js"
2587
- },
2588
- "import": "./dist/emotion-react.cjs.mjs",
2589
- "default": "./dist/emotion-react.cjs.js"
2590
- },
2591
- "./jsx-runtime": {
2592
- module: {
2593
- worker: "./jsx-runtime/dist/emotion-react-jsx-runtime.worker.esm.js",
2594
- browser: "./jsx-runtime/dist/emotion-react-jsx-runtime.browser.esm.js",
2595
- "default": "./jsx-runtime/dist/emotion-react-jsx-runtime.esm.js"
2596
- },
2597
- "import": "./jsx-runtime/dist/emotion-react-jsx-runtime.cjs.mjs",
2598
- "default": "./jsx-runtime/dist/emotion-react-jsx-runtime.cjs.js"
2599
- },
2600
- "./_isolated-hnrs": {
2601
- module: {
2602
- worker: "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.worker.esm.js",
2603
- browser: "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.browser.esm.js",
2604
- "default": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.esm.js"
2605
- },
2606
- "import": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.cjs.mjs",
2607
- "default": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.cjs.js"
2608
- },
2609
- "./jsx-dev-runtime": {
2610
- module: {
2611
- worker: "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.worker.esm.js",
2612
- browser: "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.browser.esm.js",
2613
- "default": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.esm.js"
2614
- },
2615
- "import": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.cjs.mjs",
2616
- "default": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.cjs.js"
2617
- },
2618
- "./package.json": "./package.json",
2619
- "./types/css-prop": "./types/css-prop.d.ts",
2620
- "./macro": {
2621
- types: {
2622
- "import": "./macro.d.mts",
2623
- "default": "./macro.d.ts"
2624
- },
2625
- "default": "./macro.js"
2626
- }
2627
- },
2628
- types: "types/index.d.ts",
2629
- files: [
2630
- "src",
2631
- "dist",
2632
- "jsx-runtime",
2633
- "jsx-dev-runtime",
2634
- "_isolated-hnrs",
2635
- "types/*.d.ts",
2636
- "macro.*"
2637
- ],
2638
- sideEffects: false,
2639
- author: "Emotion Contributors",
2640
- license: "MIT",
2641
- scripts: {
2642
- "test:typescript": "dtslint types"
2643
- },
2644
- dependencies: {
2645
- "@babel/runtime": "^7.18.3",
2646
- "@emotion/babel-plugin": "^11.11.0",
2647
- "@emotion/cache": "^11.11.0",
2648
- "@emotion/serialize": "^1.1.2",
2649
- "@emotion/use-insertion-effect-with-fallbacks": "^1.0.1",
2650
- "@emotion/utils": "^1.2.1",
2651
- "@emotion/weak-memoize": "^0.3.1",
2652
- "hoist-non-react-statics": "^3.3.1"
2653
- },
2654
- peerDependencies: {
2655
- react: ">=16.8.0"
2656
- },
2657
- peerDependenciesMeta: {
2658
- "@types/react": {
2659
- optional: true
2660
- }
2661
- },
2662
- devDependencies: {
2663
- "@definitelytyped/dtslint": "0.0.112",
2664
- "@emotion/css": "11.11.0",
2665
- "@emotion/css-prettifier": "1.1.3",
2666
- "@emotion/server": "11.11.0",
2667
- "@emotion/styled": "11.11.0",
2668
- "html-tag-names": "^1.1.2",
2669
- react: "16.14.0",
2670
- "svg-tag-names": "^1.1.1",
2671
- typescript: "^4.5.5"
2672
- },
2673
- repository: "https://github.com/emotion-js/emotion/tree/main/packages/react",
2674
- publishConfig: {
2675
- access: "public"
2676
- },
2677
- "umd:main": "dist/emotion-react.umd.min.js",
2678
- preconstruct: {
2679
- entrypoints: [
2680
- "./index.js",
2681
- "./jsx-runtime.js",
2682
- "./jsx-dev-runtime.js",
2683
- "./_isolated-hnrs.js"
2684
- ],
2685
- umdName: "emotionReact",
2686
- exports: {
2687
- envConditions: [
2688
- "browser",
2689
- "worker"
2690
- ],
2691
- extra: {
2692
- "./types/css-prop": "./types/css-prop.d.ts",
2693
- "./macro": {
2694
- types: {
2695
- "import": "./macro.d.mts",
2696
- "default": "./macro.d.ts"
2697
- },
2698
- "default": "./macro.js"
2699
- }
2700
- }
2701
- }
2702
- }
2703
- };
2704
-
2705
- var jsx = function jsx(type, props) {
2097
+ var jsx
2098
+ /*: typeof React.createElement */
2099
+ = function jsx
2100
+ /*: typeof React.createElement */
2101
+ (type
2102
+ /*: React.ElementType */
2103
+ , props
2104
+ /*: Object */
2105
+ ) {
2706
2106
  var args = arguments;
2707
2107
 
2708
- if (props == null || !hasOwnProperty.call(props, 'css')) {
2709
- // $FlowFixMe
2108
+ if (props == null || !hasOwn.call(props, 'css')) {
2710
2109
  return React__namespace.createElement.apply(undefined, args);
2711
2110
  }
2712
2111
 
@@ -2717,134 +2116,37 @@ var jsx = function jsx(type, props) {
2717
2116
 
2718
2117
  for (var i = 2; i < argsLength; i++) {
2719
2118
  createElementArgArray[i] = args[i];
2720
- } // $FlowFixMe
2721
-
2119
+ }
2722
2120
 
2723
2121
  return React__namespace.createElement.apply(null, createElementArgArray);
2724
2122
  };
2725
2123
 
2726
- var warnedAboutCssPropForGlobal = false; // maintain place over rerenders.
2727
- // initial render from browser, insertBefore context.sheet.tags[0] or if a style hasn't been inserted there yet, appendChild
2728
- // initial client-side render from SSR, use place of hydrating tag
2729
-
2730
- var Global = /* #__PURE__ */withEmotionCache(function (props, cache) {
2731
- if (process.env.NODE_ENV !== 'production' && !warnedAboutCssPropForGlobal && ( // check for className as well since the user is
2732
- // probably using the custom createElement which
2733
- // means it will be turned into a className prop
2734
- // $FlowFixMe I don't really want to add it to the type since it shouldn't be used
2735
- props.className || props.css)) {
2736
- console.error("It looks like you're using the css prop on Global, did you mean to use the styles prop instead?");
2737
- warnedAboutCssPropForGlobal = true;
2738
- }
2124
+ /* import type { Interpolation, SerializedStyles } from '@emotion/utils' */
2739
2125
 
2740
- var styles = props.styles;
2741
- var serialized = serializeStyles([styles], undefined, React__namespace.useContext(ThemeContext));
2126
+ function css$2()
2127
+ /*: SerializedStyles */
2128
+ {
2129
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
2130
+ args[_key] = arguments[_key];
2131
+ }
2742
2132
 
2743
- if (!isBrowser$1) {
2744
- var _ref;
2133
+ return serializeStyles(args);
2134
+ }
2745
2135
 
2746
- var serializedNames = serialized.name;
2747
- var serializedStyles = serialized.styles;
2748
- var next = serialized.next;
2136
+ /*
2137
+ type Keyframes = {|
2138
+ name: string,
2139
+ styles: string,
2140
+ anim: 1,
2141
+ toString: () => string
2142
+ |} & string
2143
+ */
2749
2144
 
2750
- while (next !== undefined) {
2751
- serializedNames += ' ' + next.name;
2752
- serializedStyles += next.styles;
2753
- next = next.next;
2754
- }
2755
-
2756
- var shouldCache = cache.compat === true;
2757
- var rules = cache.insert("", {
2758
- name: serializedNames,
2759
- styles: serializedStyles
2760
- }, cache.sheet, shouldCache);
2761
-
2762
- if (shouldCache) {
2763
- return null;
2764
- }
2765
-
2766
- return /*#__PURE__*/React__namespace.createElement("style", (_ref = {}, _ref["data-emotion"] = cache.key + "-global " + serializedNames, _ref.dangerouslySetInnerHTML = {
2767
- __html: rules
2768
- }, _ref.nonce = cache.sheet.nonce, _ref));
2769
- } // yes, i know these hooks are used conditionally
2770
- // but it is based on a constant that will never change at runtime
2771
- // it's effectively like having two implementations and switching them out
2772
- // so it's not actually breaking anything
2773
-
2774
-
2775
- var sheetRef = React__namespace.useRef();
2776
- useInsertionEffectWithLayoutFallback(function () {
2777
- var key = cache.key + "-global"; // use case of https://github.com/emotion-js/emotion/issues/2675
2778
-
2779
- var sheet = new cache.sheet.constructor({
2780
- key: key,
2781
- nonce: cache.sheet.nonce,
2782
- container: cache.sheet.container,
2783
- speedy: cache.sheet.isSpeedy
2784
- });
2785
- var rehydrating = false; // $FlowFixMe
2786
-
2787
- var node = document.querySelector("style[data-emotion=\"" + key + " " + serialized.name + "\"]");
2788
-
2789
- if (cache.sheet.tags.length) {
2790
- sheet.before = cache.sheet.tags[0];
2791
- }
2792
-
2793
- if (node !== null) {
2794
- rehydrating = true; // clear the hash so this node won't be recognizable as rehydratable by other <Global/>s
2795
-
2796
- node.setAttribute('data-emotion', key);
2797
- sheet.hydrate([node]);
2798
- }
2799
-
2800
- sheetRef.current = [sheet, rehydrating];
2801
- return function () {
2802
- sheet.flush();
2803
- };
2804
- }, [cache]);
2805
- useInsertionEffectWithLayoutFallback(function () {
2806
- var sheetRefCurrent = sheetRef.current;
2807
- var sheet = sheetRefCurrent[0],
2808
- rehydrating = sheetRefCurrent[1];
2809
-
2810
- if (rehydrating) {
2811
- sheetRefCurrent[1] = false;
2812
- return;
2813
- }
2814
-
2815
- if (serialized.next !== undefined) {
2816
- // insert keyframes
2817
- insertStyles(cache, serialized.next, true);
2818
- }
2819
-
2820
- if (sheet.tags.length) {
2821
- // if this doesn't exist then it will be null so the style element will be appended
2822
- var element = sheet.tags[sheet.tags.length - 1].nextElementSibling;
2823
- sheet.before = element;
2824
- sheet.flush();
2825
- }
2826
-
2827
- cache.insert("", serialized, sheet, false);
2828
- }, [cache, serialized.name]);
2829
- return null;
2830
- });
2831
-
2832
- if (process.env.NODE_ENV !== 'production') {
2833
- Global.displayName = 'EmotionGlobal';
2834
- }
2835
-
2836
- function css$2() {
2837
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
2838
- args[_key] = arguments[_key];
2839
- }
2840
-
2841
- return serializeStyles(args);
2842
- }
2843
-
2844
- var keyframes = function keyframes() {
2145
+ var keyframes = function
2146
+ /*: Keyframes */
2147
+ keyframes() {
2845
2148
  var insertable = css$2.apply(void 0, arguments);
2846
- var name = "animation-" + insertable.name; // $FlowFixMe
2847
-
2149
+ var name = "animation-" + insertable.name;
2848
2150
  return {
2849
2151
  name: name,
2850
2152
  styles: "@keyframes " + name + "{" + insertable.styles + "}",
@@ -2855,274 +2157,1097 @@ var keyframes = function keyframes() {
2855
2157
  };
2856
2158
  };
2857
2159
 
2858
- var classnames = function classnames(args) {
2859
- var len = args.length;
2860
- var i = 0;
2861
- var cls = '';
2862
-
2863
- for (; i < len; i++) {
2864
- var arg = args[i];
2865
- if (arg == null) continue;
2866
- var toAdd = void 0;
2867
-
2868
- switch (typeof arg) {
2869
- case 'boolean':
2870
- break;
2871
-
2872
- case 'object':
2873
- {
2874
- if (Array.isArray(arg)) {
2875
- toAdd = classnames(arg);
2876
- } else {
2877
- if (process.env.NODE_ENV !== 'production' && arg.styles !== undefined && arg.name !== undefined) {
2878
- console.error('You have passed styles created with `css` from `@emotion/react` package to the `cx`.\n' + '`cx` is meant to compose class names (strings) so you should convert those styles to a class name by passing them to the `css` received from <ClassNames/> component.');
2879
- }
2880
-
2881
- toAdd = '';
2882
-
2883
- for (var k in arg) {
2884
- if (arg[k] && k) {
2885
- toAdd && (toAdd += ' ');
2886
- toAdd += k;
2887
- }
2888
- }
2889
- }
2890
-
2891
- break;
2892
- }
2893
-
2894
- default:
2895
- {
2896
- toAdd = arg;
2897
- }
2898
- }
2160
+ function _arrayWithHoles(r) {
2161
+ if (Array.isArray(r)) return r;
2162
+ }
2899
2163
 
2900
- if (toAdd) {
2901
- cls && (cls += ' ');
2902
- cls += toAdd;
2164
+ function _iterableToArrayLimit(r, l) {
2165
+ var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
2166
+ if (null != t) {
2167
+ var e,
2168
+ n,
2169
+ i,
2170
+ u,
2171
+ a = [],
2172
+ f = !0,
2173
+ o = !1;
2174
+ try {
2175
+ if (i = (t = t.call(r)).next, 0 === l) {
2176
+ if (Object(t) !== t) return;
2177
+ f = !1;
2178
+ } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
2179
+ } catch (r) {
2180
+ o = !0, n = r;
2181
+ } finally {
2182
+ try {
2183
+ if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return;
2184
+ } finally {
2185
+ if (o) throw n;
2186
+ }
2903
2187
  }
2188
+ return a;
2904
2189
  }
2190
+ }
2905
2191
 
2906
- return cls;
2907
- };
2192
+ function _nonIterableRest() {
2193
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2194
+ }
2908
2195
 
2909
- function merge(registered, css, className) {
2910
- var registeredStyles = [];
2911
- var rawClassName = getRegisteredStyles(registered, registeredStyles, className);
2196
+ function _slicedToArray(r, e) {
2197
+ return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
2198
+ }
2912
2199
 
2913
- if (registeredStyles.length < 2) {
2914
- return className;
2200
+ function _objectWithoutPropertiesLoose(r, e) {
2201
+ if (null == r) return {};
2202
+ var t = {};
2203
+ for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
2204
+ if (e.includes(n)) continue;
2205
+ t[n] = r[n];
2915
2206
  }
2916
-
2917
- return rawClassName + css(registeredStyles);
2207
+ return t;
2918
2208
  }
2919
2209
 
2920
- var Insertion = function Insertion(_ref) {
2921
- var cache = _ref.cache,
2922
- serializedArr = _ref.serializedArr;
2923
- var rules = useInsertionEffectAlwaysWithSyncFallback(function () {
2924
- var rules = '';
2925
-
2926
- for (var i = 0; i < serializedArr.length; i++) {
2927
- var res = insertStyles(cache, serializedArr[i], false);
2928
-
2929
- if (!isBrowser$1 && res !== undefined) {
2930
- rules += res;
2931
- }
2932
- }
2210
+ function _objectWithoutProperties(e, t) {
2211
+ if (null == e) return {};
2212
+ var o,
2213
+ r,
2214
+ i = _objectWithoutPropertiesLoose(e, t);
2215
+ if (Object.getOwnPropertySymbols) {
2216
+ var s = Object.getOwnPropertySymbols(e);
2217
+ for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
2218
+ }
2219
+ return i;
2220
+ }
2933
2221
 
2934
- if (!isBrowser$1) {
2935
- return rules;
2222
+ function _taggedTemplateLiteral(e, t) {
2223
+ return t || (t = e.slice(0)), Object.freeze(Object.defineProperties(e, {
2224
+ raw: {
2225
+ value: Object.freeze(t)
2936
2226
  }
2937
- });
2938
-
2939
- if (!isBrowser$1 && rules.length !== 0) {
2940
- var _ref2;
2227
+ }));
2228
+ }
2941
2229
 
2942
- return /*#__PURE__*/React__namespace.createElement("style", (_ref2 = {}, _ref2["data-emotion"] = cache.key + " " + serializedArr.map(function (serialized) {
2943
- return serialized.name;
2944
- }).join(' '), _ref2.dangerouslySetInnerHTML = {
2945
- __html: rules
2946
- }, _ref2.nonce = cache.sheet.nonce, _ref2));
2947
- }
2230
+ /**
2231
+ * Custom positioning reference element.
2232
+ * @see https://floating-ui.com/docs/virtual-elements
2233
+ */
2948
2234
 
2949
- return null;
2235
+ const sides = ['top', 'right', 'bottom', 'left'];
2236
+ const alignments = ['start', 'end'];
2237
+ const placements = /*#__PURE__*/sides.reduce((acc, side) => acc.concat(side, side + "-" + alignments[0], side + "-" + alignments[1]), []);
2238
+ const min = Math.min;
2239
+ const max = Math.max;
2240
+ const round = Math.round;
2241
+ const floor = Math.floor;
2242
+ const createCoords = v => ({
2243
+ x: v,
2244
+ y: v
2245
+ });
2246
+ const oppositeSideMap = {
2247
+ left: 'right',
2248
+ right: 'left',
2249
+ bottom: 'top',
2250
+ top: 'bottom'
2950
2251
  };
2951
-
2952
- var ClassNames = /* #__PURE__ */withEmotionCache(function (props, cache) {
2953
- var hasRendered = false;
2954
- var serializedArr = [];
2955
-
2956
- var css = function css() {
2957
- if (hasRendered && process.env.NODE_ENV !== 'production') {
2958
- throw new Error('css can only be used during render');
2959
- }
2960
-
2961
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
2962
- args[_key] = arguments[_key];
2252
+ const oppositeAlignmentMap = {
2253
+ start: 'end',
2254
+ end: 'start'
2255
+ };
2256
+ function clamp(start, value, end) {
2257
+ return max(start, min(value, end));
2258
+ }
2259
+ function evaluate(value, param) {
2260
+ return typeof value === 'function' ? value(param) : value;
2261
+ }
2262
+ function getSide(placement) {
2263
+ return placement.split('-')[0];
2264
+ }
2265
+ function getAlignment(placement) {
2266
+ return placement.split('-')[1];
2267
+ }
2268
+ function getOppositeAxis(axis) {
2269
+ return axis === 'x' ? 'y' : 'x';
2270
+ }
2271
+ function getAxisLength(axis) {
2272
+ return axis === 'y' ? 'height' : 'width';
2273
+ }
2274
+ function getSideAxis(placement) {
2275
+ return ['top', 'bottom'].includes(getSide(placement)) ? 'y' : 'x';
2276
+ }
2277
+ function getAlignmentAxis(placement) {
2278
+ return getOppositeAxis(getSideAxis(placement));
2279
+ }
2280
+ function getAlignmentSides(placement, rects, rtl) {
2281
+ if (rtl === void 0) {
2282
+ rtl = false;
2283
+ }
2284
+ const alignment = getAlignment(placement);
2285
+ const alignmentAxis = getAlignmentAxis(placement);
2286
+ const length = getAxisLength(alignmentAxis);
2287
+ let mainAlignmentSide = alignmentAxis === 'x' ? alignment === (rtl ? 'end' : 'start') ? 'right' : 'left' : alignment === 'start' ? 'bottom' : 'top';
2288
+ if (rects.reference[length] > rects.floating[length]) {
2289
+ mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
2290
+ }
2291
+ return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];
2292
+ }
2293
+ function getExpandedPlacements(placement) {
2294
+ const oppositePlacement = getOppositePlacement(placement);
2295
+ return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
2296
+ }
2297
+ function getOppositeAlignmentPlacement(placement) {
2298
+ return placement.replace(/start|end/g, alignment => oppositeAlignmentMap[alignment]);
2299
+ }
2300
+ function getSideList(side, isStart, rtl) {
2301
+ const lr = ['left', 'right'];
2302
+ const rl = ['right', 'left'];
2303
+ const tb = ['top', 'bottom'];
2304
+ const bt = ['bottom', 'top'];
2305
+ switch (side) {
2306
+ case 'top':
2307
+ case 'bottom':
2308
+ if (rtl) return isStart ? rl : lr;
2309
+ return isStart ? lr : rl;
2310
+ case 'left':
2311
+ case 'right':
2312
+ return isStart ? tb : bt;
2313
+ default:
2314
+ return [];
2315
+ }
2316
+ }
2317
+ function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
2318
+ const alignment = getAlignment(placement);
2319
+ let list = getSideList(getSide(placement), direction === 'start', rtl);
2320
+ if (alignment) {
2321
+ list = list.map(side => side + "-" + alignment);
2322
+ if (flipAlignment) {
2323
+ list = list.concat(list.map(getOppositeAlignmentPlacement));
2963
2324
  }
2964
-
2965
- var serialized = serializeStyles(args, cache.registered);
2966
- serializedArr.push(serialized); // registration has to happen here as the result of this might get consumed by `cx`
2967
-
2968
- registerStyles(cache, serialized, false);
2969
- return cache.key + "-" + serialized.name;
2325
+ }
2326
+ return list;
2327
+ }
2328
+ function getOppositePlacement(placement) {
2329
+ return placement.replace(/left|right|bottom|top/g, side => oppositeSideMap[side]);
2330
+ }
2331
+ function expandPaddingObject(padding) {
2332
+ return {
2333
+ top: 0,
2334
+ right: 0,
2335
+ bottom: 0,
2336
+ left: 0,
2337
+ ...padding
2970
2338
  };
2971
-
2972
- var cx = function cx() {
2973
- if (hasRendered && process.env.NODE_ENV !== 'production') {
2974
- throw new Error('cx can only be used during render');
2975
- }
2976
-
2977
- for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
2978
- args[_key2] = arguments[_key2];
2979
- }
2980
-
2981
- return merge(cache.registered, css, classnames(args));
2339
+ }
2340
+ function getPaddingObject(padding) {
2341
+ return typeof padding !== 'number' ? expandPaddingObject(padding) : {
2342
+ top: padding,
2343
+ right: padding,
2344
+ bottom: padding,
2345
+ left: padding
2982
2346
  };
2983
-
2984
- var content = {
2985
- css: css,
2986
- cx: cx,
2987
- theme: React__namespace.useContext(ThemeContext)
2347
+ }
2348
+ function rectToClientRect(rect) {
2349
+ const {
2350
+ x,
2351
+ y,
2352
+ width,
2353
+ height
2354
+ } = rect;
2355
+ return {
2356
+ width,
2357
+ height,
2358
+ top: y,
2359
+ left: x,
2360
+ right: x + width,
2361
+ bottom: y + height,
2362
+ x,
2363
+ y
2988
2364
  };
2989
- var ele = props.children(content);
2990
- hasRendered = true;
2991
- return /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, /*#__PURE__*/React__namespace.createElement(Insertion, {
2992
- cache: cache,
2993
- serializedArr: serializedArr
2994
- }), ele);
2995
- });
2996
-
2997
- if (process.env.NODE_ENV !== 'production') {
2998
- ClassNames.displayName = 'EmotionClassNames';
2999
2365
  }
3000
2366
 
3001
- if (process.env.NODE_ENV !== 'production') {
3002
- var isBrowser = typeof document !== 'undefined'; // #1727, #2905 for some reason Jest and Vitest evaluate modules twice if some consuming module gets mocked
3003
-
3004
- var isTestEnv = typeof jest !== 'undefined' || typeof vi !== 'undefined';
3005
-
3006
- if (isBrowser && !isTestEnv) {
3007
- // globalThis has wide browser support - https://caniuse.com/?search=globalThis, Node.js 12 and later
3008
- var globalContext = // $FlowIgnore
3009
- typeof globalThis !== 'undefined' ? globalThis // eslint-disable-line no-undef
3010
- : isBrowser ? window : global;
3011
- var globalKey = "__EMOTION_REACT_" + pkg.version.split('.')[0] + "__";
3012
-
3013
- if (globalContext[globalKey]) {
3014
- console.warn('You are loading @emotion/react when it is already loaded. Running ' + 'multiple instances may cause problems. This can happen if multiple ' + 'versions are used, or if multiple builds of the same version are ' + 'used.');
3015
- }
3016
-
3017
- globalContext[globalKey] = true;
2367
+ /**
2368
+ * Resolves with an object of overflow side offsets that determine how much the
2369
+ * element is overflowing a given clipping boundary on each side.
2370
+ * - positive = overflowing the boundary by that number of pixels
2371
+ * - negative = how many pixels left before it will overflow
2372
+ * - 0 = lies flush with the boundary
2373
+ * @see https://floating-ui.com/docs/detectOverflow
2374
+ */
2375
+ async function detectOverflow(state, options) {
2376
+ var _await$platform$isEle;
2377
+ if (options === void 0) {
2378
+ options = {};
3018
2379
  }
2380
+ const {
2381
+ x,
2382
+ y,
2383
+ platform,
2384
+ rects,
2385
+ elements,
2386
+ strategy
2387
+ } = state;
2388
+ const {
2389
+ boundary = 'clippingAncestors',
2390
+ rootBoundary = 'viewport',
2391
+ elementContext = 'floating',
2392
+ altBoundary = false,
2393
+ padding = 0
2394
+ } = evaluate(options, state);
2395
+ const paddingObject = getPaddingObject(padding);
2396
+ const altContext = elementContext === 'floating' ? 'reference' : 'floating';
2397
+ const element = elements[altBoundary ? altContext : elementContext];
2398
+ const clippingClientRect = rectToClientRect(await platform.getClippingRect({
2399
+ element: ((_await$platform$isEle = await (platform.isElement == null ? void 0 : platform.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || (await (platform.getDocumentElement == null ? void 0 : platform.getDocumentElement(elements.floating))),
2400
+ boundary,
2401
+ rootBoundary,
2402
+ strategy
2403
+ }));
2404
+ const rect = elementContext === 'floating' ? {
2405
+ x,
2406
+ y,
2407
+ width: rects.floating.width,
2408
+ height: rects.floating.height
2409
+ } : rects.reference;
2410
+ const offsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating));
2411
+ const offsetScale = (await (platform.isElement == null ? void 0 : platform.isElement(offsetParent))) ? (await (platform.getScale == null ? void 0 : platform.getScale(offsetParent))) || {
2412
+ x: 1,
2413
+ y: 1
2414
+ } : {
2415
+ x: 1,
2416
+ y: 1
2417
+ };
2418
+ const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
2419
+ elements,
2420
+ rect,
2421
+ offsetParent,
2422
+ strategy
2423
+ }) : rect);
2424
+ return {
2425
+ top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
2426
+ bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
2427
+ left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
2428
+ right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
2429
+ };
3019
2430
  }
3020
2431
 
3021
- function _arrayWithHoles(arr) {
3022
- if (Array.isArray(arr)) return arr;
3023
- }
2432
+ /**
2433
+ * Provides data to position an inner element of the floating element so that it
2434
+ * appears centered to the reference element.
2435
+ * @see https://floating-ui.com/docs/arrow
2436
+ */
2437
+ const arrow = options => ({
2438
+ name: 'arrow',
2439
+ options,
2440
+ async fn(state) {
2441
+ const {
2442
+ x,
2443
+ y,
2444
+ placement,
2445
+ rects,
2446
+ platform,
2447
+ elements,
2448
+ middlewareData
2449
+ } = state;
2450
+ // Since `element` is required, we don't Partial<> the type.
2451
+ const {
2452
+ element,
2453
+ padding = 0
2454
+ } = evaluate(options, state) || {};
2455
+ if (element == null) {
2456
+ return {};
2457
+ }
2458
+ const paddingObject = getPaddingObject(padding);
2459
+ const coords = {
2460
+ x,
2461
+ y
2462
+ };
2463
+ const axis = getAlignmentAxis(placement);
2464
+ const length = getAxisLength(axis);
2465
+ const arrowDimensions = await platform.getDimensions(element);
2466
+ const isYAxis = axis === 'y';
2467
+ const minProp = isYAxis ? 'top' : 'left';
2468
+ const maxProp = isYAxis ? 'bottom' : 'right';
2469
+ const clientProp = isYAxis ? 'clientHeight' : 'clientWidth';
2470
+ const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];
2471
+ const startDiff = coords[axis] - rects.reference[axis];
2472
+ const arrowOffsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(element));
2473
+ let clientSize = arrowOffsetParent ? arrowOffsetParent[clientProp] : 0;
2474
+
2475
+ // DOM platform can return `window` as the `offsetParent`.
2476
+ if (!clientSize || !(await (platform.isElement == null ? void 0 : platform.isElement(arrowOffsetParent)))) {
2477
+ clientSize = elements.floating[clientProp] || rects.floating[length];
2478
+ }
2479
+ const centerToReference = endDiff / 2 - startDiff / 2;
2480
+
2481
+ // If the padding is large enough that it causes the arrow to no longer be
2482
+ // centered, modify the padding so that it is centered.
2483
+ const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1;
2484
+ const minPadding = min(paddingObject[minProp], largestPossiblePadding);
2485
+ const maxPadding = min(paddingObject[maxProp], largestPossiblePadding);
2486
+
2487
+ // Make sure the arrow doesn't overflow the floating element if the center
2488
+ // point is outside the floating element's bounds.
2489
+ const min$1 = minPadding;
2490
+ const max = clientSize - arrowDimensions[length] - maxPadding;
2491
+ const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
2492
+ const offset = clamp(min$1, center, max);
2493
+
2494
+ // If the reference is small enough that the arrow's padding causes it to
2495
+ // to point to nothing for an aligned placement, adjust the offset of the
2496
+ // floating element itself. To ensure `shift()` continues to take action,
2497
+ // a single reset is performed when this is true.
2498
+ const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset && rects.reference[length] / 2 - (center < min$1 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0;
2499
+ const alignmentOffset = shouldAddOffset ? center < min$1 ? center - min$1 : center - max : 0;
2500
+ return {
2501
+ [axis]: coords[axis] + alignmentOffset,
2502
+ data: {
2503
+ [axis]: offset,
2504
+ centerOffset: center - offset - alignmentOffset,
2505
+ ...(shouldAddOffset && {
2506
+ alignmentOffset
2507
+ })
2508
+ },
2509
+ reset: shouldAddOffset
2510
+ };
2511
+ }
2512
+ });
3024
2513
 
3025
- function _iterableToArrayLimit(arr, i) {
3026
- var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
2514
+ function getPlacementList(alignment, autoAlignment, allowedPlacements) {
2515
+ const allowedPlacementsSortedByAlignment = alignment ? [...allowedPlacements.filter(placement => getAlignment(placement) === alignment), ...allowedPlacements.filter(placement => getAlignment(placement) !== alignment)] : allowedPlacements.filter(placement => getSide(placement) === placement);
2516
+ return allowedPlacementsSortedByAlignment.filter(placement => {
2517
+ if (alignment) {
2518
+ return getAlignment(placement) === alignment || (autoAlignment ? getOppositeAlignmentPlacement(placement) !== placement : false);
2519
+ }
2520
+ return true;
2521
+ });
2522
+ }
2523
+ /**
2524
+ * Optimizes the visibility of the floating element by choosing the placement
2525
+ * that has the most space available automatically, without needing to specify a
2526
+ * preferred placement. Alternative to `flip`.
2527
+ * @see https://floating-ui.com/docs/autoPlacement
2528
+ */
2529
+ const autoPlacement = function (options) {
2530
+ if (options === void 0) {
2531
+ options = {};
2532
+ }
2533
+ return {
2534
+ name: 'autoPlacement',
2535
+ options,
2536
+ async fn(state) {
2537
+ var _middlewareData$autoP, _middlewareData$autoP2, _placementsThatFitOnE;
2538
+ const {
2539
+ rects,
2540
+ middlewareData,
2541
+ placement,
2542
+ platform,
2543
+ elements
2544
+ } = state;
2545
+ const {
2546
+ crossAxis = false,
2547
+ alignment,
2548
+ allowedPlacements = placements,
2549
+ autoAlignment = true,
2550
+ ...detectOverflowOptions
2551
+ } = evaluate(options, state);
2552
+ const placements$1 = alignment !== undefined || allowedPlacements === placements ? getPlacementList(alignment || null, autoAlignment, allowedPlacements) : allowedPlacements;
2553
+ const overflow = await detectOverflow(state, detectOverflowOptions);
2554
+ const currentIndex = ((_middlewareData$autoP = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP.index) || 0;
2555
+ const currentPlacement = placements$1[currentIndex];
2556
+ if (currentPlacement == null) {
2557
+ return {};
2558
+ }
2559
+ const alignmentSides = getAlignmentSides(currentPlacement, rects, await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating)));
3027
2560
 
3028
- if (_i == null) return;
3029
- var _arr = [];
3030
- var _n = true;
3031
- var _d = false;
2561
+ // Make `computeCoords` start from the right place.
2562
+ if (placement !== currentPlacement) {
2563
+ return {
2564
+ reset: {
2565
+ placement: placements$1[0]
2566
+ }
2567
+ };
2568
+ }
2569
+ const currentOverflows = [overflow[getSide(currentPlacement)], overflow[alignmentSides[0]], overflow[alignmentSides[1]]];
2570
+ const allOverflows = [...(((_middlewareData$autoP2 = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP2.overflows) || []), {
2571
+ placement: currentPlacement,
2572
+ overflows: currentOverflows
2573
+ }];
2574
+ const nextPlacement = placements$1[currentIndex + 1];
2575
+
2576
+ // There are more placements to check.
2577
+ if (nextPlacement) {
2578
+ return {
2579
+ data: {
2580
+ index: currentIndex + 1,
2581
+ overflows: allOverflows
2582
+ },
2583
+ reset: {
2584
+ placement: nextPlacement
2585
+ }
2586
+ };
2587
+ }
2588
+ const placementsSortedByMostSpace = allOverflows.map(d => {
2589
+ const alignment = getAlignment(d.placement);
2590
+ return [d.placement, alignment && crossAxis ?
2591
+ // Check along the mainAxis and main crossAxis side.
2592
+ d.overflows.slice(0, 2).reduce((acc, v) => acc + v, 0) :
2593
+ // Check only the mainAxis.
2594
+ d.overflows[0], d.overflows];
2595
+ }).sort((a, b) => a[1] - b[1]);
2596
+ const placementsThatFitOnEachSide = placementsSortedByMostSpace.filter(d => d[2].slice(0,
2597
+ // Aligned placements should not check their opposite crossAxis
2598
+ // side.
2599
+ getAlignment(d[0]) ? 2 : 3).every(v => v <= 0));
2600
+ const resetPlacement = ((_placementsThatFitOnE = placementsThatFitOnEachSide[0]) == null ? void 0 : _placementsThatFitOnE[0]) || placementsSortedByMostSpace[0][0];
2601
+ if (resetPlacement !== placement) {
2602
+ return {
2603
+ data: {
2604
+ index: currentIndex + 1,
2605
+ overflows: allOverflows
2606
+ },
2607
+ reset: {
2608
+ placement: resetPlacement
2609
+ }
2610
+ };
2611
+ }
2612
+ return {};
2613
+ }
2614
+ };
2615
+ };
3032
2616
 
3033
- var _s, _e;
2617
+ /**
2618
+ * Optimizes the visibility of the floating element by flipping the `placement`
2619
+ * in order to keep it in view when the preferred placement(s) will overflow the
2620
+ * clipping boundary. Alternative to `autoPlacement`.
2621
+ * @see https://floating-ui.com/docs/flip
2622
+ */
2623
+ const flip = function (options) {
2624
+ if (options === void 0) {
2625
+ options = {};
2626
+ }
2627
+ return {
2628
+ name: 'flip',
2629
+ options,
2630
+ async fn(state) {
2631
+ var _middlewareData$arrow, _middlewareData$flip;
2632
+ const {
2633
+ placement,
2634
+ middlewareData,
2635
+ rects,
2636
+ initialPlacement,
2637
+ platform,
2638
+ elements
2639
+ } = state;
2640
+ const {
2641
+ mainAxis: checkMainAxis = true,
2642
+ crossAxis: checkCrossAxis = true,
2643
+ fallbackPlacements: specifiedFallbackPlacements,
2644
+ fallbackStrategy = 'bestFit',
2645
+ fallbackAxisSideDirection = 'none',
2646
+ flipAlignment = true,
2647
+ ...detectOverflowOptions
2648
+ } = evaluate(options, state);
2649
+
2650
+ // If a reset by the arrow was caused due to an alignment offset being
2651
+ // added, we should skip any logic now since `flip()` has already done its
2652
+ // work.
2653
+ // https://github.com/floating-ui/floating-ui/issues/2549#issuecomment-1719601643
2654
+ if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
2655
+ return {};
2656
+ }
2657
+ const side = getSide(placement);
2658
+ const initialSideAxis = getSideAxis(initialPlacement);
2659
+ const isBasePlacement = getSide(initialPlacement) === initialPlacement;
2660
+ const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
2661
+ const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
2662
+ const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== 'none';
2663
+ if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) {
2664
+ fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
2665
+ }
2666
+ const placements = [initialPlacement, ...fallbackPlacements];
2667
+ const overflow = await detectOverflow(state, detectOverflowOptions);
2668
+ const overflows = [];
2669
+ let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
2670
+ if (checkMainAxis) {
2671
+ overflows.push(overflow[side]);
2672
+ }
2673
+ if (checkCrossAxis) {
2674
+ const sides = getAlignmentSides(placement, rects, rtl);
2675
+ overflows.push(overflow[sides[0]], overflow[sides[1]]);
2676
+ }
2677
+ overflowsData = [...overflowsData, {
2678
+ placement,
2679
+ overflows
2680
+ }];
2681
+
2682
+ // One or more sides is overflowing.
2683
+ if (!overflows.every(side => side <= 0)) {
2684
+ var _middlewareData$flip2, _overflowsData$filter;
2685
+ const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
2686
+ const nextPlacement = placements[nextIndex];
2687
+ if (nextPlacement) {
2688
+ // Try next placement and re-run the lifecycle.
2689
+ return {
2690
+ data: {
2691
+ index: nextIndex,
2692
+ overflows: overflowsData
2693
+ },
2694
+ reset: {
2695
+ placement: nextPlacement
2696
+ }
2697
+ };
2698
+ }
3034
2699
 
3035
- try {
3036
- for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
3037
- _arr.push(_s.value);
2700
+ // First, find the candidates that fit on the mainAxis side of overflow,
2701
+ // then find the placement that fits the best on the main crossAxis side.
2702
+ let resetPlacement = (_overflowsData$filter = overflowsData.filter(d => d.overflows[0] <= 0).sort((a, b) => a.overflows[1] - b.overflows[1])[0]) == null ? void 0 : _overflowsData$filter.placement;
3038
2703
 
3039
- if (i && _arr.length === i) break;
3040
- }
3041
- } catch (err) {
3042
- _d = true;
3043
- _e = err;
3044
- } finally {
3045
- try {
3046
- if (!_n && _i["return"] != null) _i["return"]();
3047
- } finally {
3048
- if (_d) throw _e;
2704
+ // Otherwise fallback.
2705
+ if (!resetPlacement) {
2706
+ switch (fallbackStrategy) {
2707
+ case 'bestFit':
2708
+ {
2709
+ var _overflowsData$filter2;
2710
+ const placement = (_overflowsData$filter2 = overflowsData.filter(d => {
2711
+ if (hasFallbackAxisSideDirection) {
2712
+ const currentSideAxis = getSideAxis(d.placement);
2713
+ return currentSideAxis === initialSideAxis ||
2714
+ // Create a bias to the `y` side axis due to horizontal
2715
+ // reading directions favoring greater width.
2716
+ currentSideAxis === 'y';
2717
+ }
2718
+ return true;
2719
+ }).map(d => [d.placement, d.overflows.filter(overflow => overflow > 0).reduce((acc, overflow) => acc + overflow, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$filter2[0];
2720
+ if (placement) {
2721
+ resetPlacement = placement;
2722
+ }
2723
+ break;
2724
+ }
2725
+ case 'initialPlacement':
2726
+ resetPlacement = initialPlacement;
2727
+ break;
2728
+ }
2729
+ }
2730
+ if (placement !== resetPlacement) {
2731
+ return {
2732
+ reset: {
2733
+ placement: resetPlacement
2734
+ }
2735
+ };
2736
+ }
2737
+ }
2738
+ return {};
3049
2739
  }
3050
- }
2740
+ };
2741
+ };
3051
2742
 
3052
- return _arr;
2743
+ function getSideOffsets(overflow, rect) {
2744
+ return {
2745
+ top: overflow.top - rect.height,
2746
+ right: overflow.right - rect.width,
2747
+ bottom: overflow.bottom - rect.height,
2748
+ left: overflow.left - rect.width
2749
+ };
3053
2750
  }
3054
-
3055
- function _nonIterableRest() {
3056
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2751
+ function isAnySideFullyClipped(overflow) {
2752
+ return sides.some(side => overflow[side] >= 0);
3057
2753
  }
2754
+ /**
2755
+ * Provides data to hide the floating element in applicable situations, such as
2756
+ * when it is not in the same clipping context as the reference element.
2757
+ * @see https://floating-ui.com/docs/hide
2758
+ */
2759
+ const hide = function (options) {
2760
+ if (options === void 0) {
2761
+ options = {};
2762
+ }
2763
+ return {
2764
+ name: 'hide',
2765
+ options,
2766
+ async fn(state) {
2767
+ const {
2768
+ rects
2769
+ } = state;
2770
+ const {
2771
+ strategy = 'referenceHidden',
2772
+ ...detectOverflowOptions
2773
+ } = evaluate(options, state);
2774
+ switch (strategy) {
2775
+ case 'referenceHidden':
2776
+ {
2777
+ const overflow = await detectOverflow(state, {
2778
+ ...detectOverflowOptions,
2779
+ elementContext: 'reference'
2780
+ });
2781
+ const offsets = getSideOffsets(overflow, rects.reference);
2782
+ return {
2783
+ data: {
2784
+ referenceHiddenOffsets: offsets,
2785
+ referenceHidden: isAnySideFullyClipped(offsets)
2786
+ }
2787
+ };
2788
+ }
2789
+ case 'escaped':
2790
+ {
2791
+ const overflow = await detectOverflow(state, {
2792
+ ...detectOverflowOptions,
2793
+ altBoundary: true
2794
+ });
2795
+ const offsets = getSideOffsets(overflow, rects.floating);
2796
+ return {
2797
+ data: {
2798
+ escapedOffsets: offsets,
2799
+ escaped: isAnySideFullyClipped(offsets)
2800
+ }
2801
+ };
2802
+ }
2803
+ default:
2804
+ {
2805
+ return {};
2806
+ }
2807
+ }
2808
+ }
2809
+ };
2810
+ };
3058
2811
 
3059
- function _slicedToArray(arr, i) {
3060
- return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
2812
+ function getBoundingRect(rects) {
2813
+ const minX = min(...rects.map(rect => rect.left));
2814
+ const minY = min(...rects.map(rect => rect.top));
2815
+ const maxX = max(...rects.map(rect => rect.right));
2816
+ const maxY = max(...rects.map(rect => rect.bottom));
2817
+ return {
2818
+ x: minX,
2819
+ y: minY,
2820
+ width: maxX - minX,
2821
+ height: maxY - minY
2822
+ };
3061
2823
  }
3062
-
3063
- function _objectWithoutPropertiesLoose(source, excluded) {
3064
- if (source == null) return {};
3065
- var target = {};
3066
- var sourceKeys = Object.keys(source);
3067
- var key, i;
3068
-
3069
- for (i = 0; i < sourceKeys.length; i++) {
3070
- key = sourceKeys[i];
3071
- if (excluded.indexOf(key) >= 0) continue;
3072
- target[key] = source[key];
2824
+ function getRectsByLine(rects) {
2825
+ const sortedRects = rects.slice().sort((a, b) => a.y - b.y);
2826
+ const groups = [];
2827
+ let prevRect = null;
2828
+ for (let i = 0; i < sortedRects.length; i++) {
2829
+ const rect = sortedRects[i];
2830
+ if (!prevRect || rect.y - prevRect.y > prevRect.height / 2) {
2831
+ groups.push([rect]);
2832
+ } else {
2833
+ groups[groups.length - 1].push(rect);
2834
+ }
2835
+ prevRect = rect;
3073
2836
  }
3074
-
3075
- return target;
2837
+ return groups.map(rect => rectToClientRect(getBoundingRect(rect)));
3076
2838
  }
2839
+ /**
2840
+ * Provides improved positioning for inline reference elements that can span
2841
+ * over multiple lines, such as hyperlinks or range selections.
2842
+ * @see https://floating-ui.com/docs/inline
2843
+ */
2844
+ const inline = function (options) {
2845
+ if (options === void 0) {
2846
+ options = {};
2847
+ }
2848
+ return {
2849
+ name: 'inline',
2850
+ options,
2851
+ async fn(state) {
2852
+ const {
2853
+ placement,
2854
+ elements,
2855
+ rects,
2856
+ platform,
2857
+ strategy
2858
+ } = state;
2859
+ // A MouseEvent's client{X,Y} coords can be up to 2 pixels off a
2860
+ // ClientRect's bounds, despite the event listener being triggered. A
2861
+ // padding of 2 seems to handle this issue.
2862
+ const {
2863
+ padding = 2,
2864
+ x,
2865
+ y
2866
+ } = evaluate(options, state);
2867
+ const nativeClientRects = Array.from((await (platform.getClientRects == null ? void 0 : platform.getClientRects(elements.reference))) || []);
2868
+ const clientRects = getRectsByLine(nativeClientRects);
2869
+ const fallback = rectToClientRect(getBoundingRect(nativeClientRects));
2870
+ const paddingObject = getPaddingObject(padding);
2871
+ function getBoundingClientRect() {
2872
+ // There are two rects and they are disjoined.
2873
+ if (clientRects.length === 2 && clientRects[0].left > clientRects[1].right && x != null && y != null) {
2874
+ // Find the first rect in which the point is fully inside.
2875
+ return clientRects.find(rect => x > rect.left - paddingObject.left && x < rect.right + paddingObject.right && y > rect.top - paddingObject.top && y < rect.bottom + paddingObject.bottom) || fallback;
2876
+ }
3077
2877
 
3078
- function _objectWithoutProperties(source, excluded) {
3079
- if (source == null) return {};
3080
- var target = _objectWithoutPropertiesLoose(source, excluded);
3081
- var key, i;
2878
+ // There are 2 or more connected rects.
2879
+ if (clientRects.length >= 2) {
2880
+ if (getSideAxis(placement) === 'y') {
2881
+ const firstRect = clientRects[0];
2882
+ const lastRect = clientRects[clientRects.length - 1];
2883
+ const isTop = getSide(placement) === 'top';
2884
+ const top = firstRect.top;
2885
+ const bottom = lastRect.bottom;
2886
+ const left = isTop ? firstRect.left : lastRect.left;
2887
+ const right = isTop ? firstRect.right : lastRect.right;
2888
+ const width = right - left;
2889
+ const height = bottom - top;
2890
+ return {
2891
+ top,
2892
+ bottom,
2893
+ left,
2894
+ right,
2895
+ width,
2896
+ height,
2897
+ x: left,
2898
+ y: top
2899
+ };
2900
+ }
2901
+ const isLeftSide = getSide(placement) === 'left';
2902
+ const maxRight = max(...clientRects.map(rect => rect.right));
2903
+ const minLeft = min(...clientRects.map(rect => rect.left));
2904
+ const measureRects = clientRects.filter(rect => isLeftSide ? rect.left === minLeft : rect.right === maxRight);
2905
+ const top = measureRects[0].top;
2906
+ const bottom = measureRects[measureRects.length - 1].bottom;
2907
+ const left = minLeft;
2908
+ const right = maxRight;
2909
+ const width = right - left;
2910
+ const height = bottom - top;
2911
+ return {
2912
+ top,
2913
+ bottom,
2914
+ left,
2915
+ right,
2916
+ width,
2917
+ height,
2918
+ x: left,
2919
+ y: top
2920
+ };
2921
+ }
2922
+ return fallback;
2923
+ }
2924
+ const resetRects = await platform.getElementRects({
2925
+ reference: {
2926
+ getBoundingClientRect
2927
+ },
2928
+ floating: elements.floating,
2929
+ strategy
2930
+ });
2931
+ if (rects.reference.x !== resetRects.reference.x || rects.reference.y !== resetRects.reference.y || rects.reference.width !== resetRects.reference.width || rects.reference.height !== resetRects.reference.height) {
2932
+ return {
2933
+ reset: {
2934
+ rects: resetRects
2935
+ }
2936
+ };
2937
+ }
2938
+ return {};
2939
+ }
2940
+ };
2941
+ };
3082
2942
 
3083
- if (Object.getOwnPropertySymbols) {
3084
- var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
2943
+ // For type backwards-compatibility, the `OffsetOptions` type was also
2944
+ // Derivable.
3085
2945
 
3086
- for (i = 0; i < sourceSymbolKeys.length; i++) {
3087
- key = sourceSymbolKeys[i];
3088
- if (excluded.indexOf(key) >= 0) continue;
3089
- if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
3090
- target[key] = source[key];
3091
- }
2946
+ async function convertValueToCoords(state, options) {
2947
+ const {
2948
+ placement,
2949
+ platform,
2950
+ elements
2951
+ } = state;
2952
+ const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
2953
+ const side = getSide(placement);
2954
+ const alignment = getAlignment(placement);
2955
+ const isVertical = getSideAxis(placement) === 'y';
2956
+ const mainAxisMulti = ['left', 'top'].includes(side) ? -1 : 1;
2957
+ const crossAxisMulti = rtl && isVertical ? -1 : 1;
2958
+ const rawValue = evaluate(options, state);
2959
+
2960
+ // eslint-disable-next-line prefer-const
2961
+ let {
2962
+ mainAxis,
2963
+ crossAxis,
2964
+ alignmentAxis
2965
+ } = typeof rawValue === 'number' ? {
2966
+ mainAxis: rawValue,
2967
+ crossAxis: 0,
2968
+ alignmentAxis: null
2969
+ } : {
2970
+ mainAxis: 0,
2971
+ crossAxis: 0,
2972
+ alignmentAxis: null,
2973
+ ...rawValue
2974
+ };
2975
+ if (alignment && typeof alignmentAxis === 'number') {
2976
+ crossAxis = alignment === 'end' ? alignmentAxis * -1 : alignmentAxis;
3092
2977
  }
3093
-
3094
- return target;
2978
+ return isVertical ? {
2979
+ x: crossAxis * crossAxisMulti,
2980
+ y: mainAxis * mainAxisMulti
2981
+ } : {
2982
+ x: mainAxis * mainAxisMulti,
2983
+ y: crossAxis * crossAxisMulti
2984
+ };
3095
2985
  }
3096
2986
 
3097
- function _taggedTemplateLiteral(strings, raw) {
3098
- if (!raw) {
3099
- raw = strings.slice(0);
2987
+ /**
2988
+ * Modifies the placement by translating the floating element along the
2989
+ * specified axes.
2990
+ * A number (shorthand for `mainAxis` or distance), or an axes configuration
2991
+ * object may be passed.
2992
+ * @see https://floating-ui.com/docs/offset
2993
+ */
2994
+ const offset = function (options) {
2995
+ if (options === void 0) {
2996
+ options = 0;
3100
2997
  }
2998
+ return {
2999
+ name: 'offset',
3000
+ options,
3001
+ async fn(state) {
3002
+ var _middlewareData$offse, _middlewareData$arrow;
3003
+ const {
3004
+ x,
3005
+ y,
3006
+ placement,
3007
+ middlewareData
3008
+ } = state;
3009
+ const diffCoords = await convertValueToCoords(state, options);
3010
+
3011
+ // If the placement is the same and the arrow caused an alignment offset
3012
+ // then we don't need to change the positioning coordinates.
3013
+ if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
3014
+ return {};
3015
+ }
3016
+ return {
3017
+ x: x + diffCoords.x,
3018
+ y: y + diffCoords.y,
3019
+ data: {
3020
+ ...diffCoords,
3021
+ placement
3022
+ }
3023
+ };
3024
+ }
3025
+ };
3026
+ };
3101
3027
 
3102
- return Object.freeze(Object.defineProperties(strings, {
3103
- raw: {
3104
- value: Object.freeze(raw)
3028
+ /**
3029
+ * Optimizes the visibility of the floating element by shifting it in order to
3030
+ * keep it in view when it will overflow the clipping boundary.
3031
+ * @see https://floating-ui.com/docs/shift
3032
+ */
3033
+ const shift = function (options) {
3034
+ if (options === void 0) {
3035
+ options = {};
3036
+ }
3037
+ return {
3038
+ name: 'shift',
3039
+ options,
3040
+ async fn(state) {
3041
+ const {
3042
+ x,
3043
+ y,
3044
+ placement
3045
+ } = state;
3046
+ const {
3047
+ mainAxis: checkMainAxis = true,
3048
+ crossAxis: checkCrossAxis = false,
3049
+ limiter = {
3050
+ fn: _ref => {
3051
+ let {
3052
+ x,
3053
+ y
3054
+ } = _ref;
3055
+ return {
3056
+ x,
3057
+ y
3058
+ };
3059
+ }
3060
+ },
3061
+ ...detectOverflowOptions
3062
+ } = evaluate(options, state);
3063
+ const coords = {
3064
+ x,
3065
+ y
3066
+ };
3067
+ const overflow = await detectOverflow(state, detectOverflowOptions);
3068
+ const crossAxis = getSideAxis(getSide(placement));
3069
+ const mainAxis = getOppositeAxis(crossAxis);
3070
+ let mainAxisCoord = coords[mainAxis];
3071
+ let crossAxisCoord = coords[crossAxis];
3072
+ if (checkMainAxis) {
3073
+ const minSide = mainAxis === 'y' ? 'top' : 'left';
3074
+ const maxSide = mainAxis === 'y' ? 'bottom' : 'right';
3075
+ const min = mainAxisCoord + overflow[minSide];
3076
+ const max = mainAxisCoord - overflow[maxSide];
3077
+ mainAxisCoord = clamp(min, mainAxisCoord, max);
3078
+ }
3079
+ if (checkCrossAxis) {
3080
+ const minSide = crossAxis === 'y' ? 'top' : 'left';
3081
+ const maxSide = crossAxis === 'y' ? 'bottom' : 'right';
3082
+ const min = crossAxisCoord + overflow[minSide];
3083
+ const max = crossAxisCoord - overflow[maxSide];
3084
+ crossAxisCoord = clamp(min, crossAxisCoord, max);
3085
+ }
3086
+ const limitedCoords = limiter.fn({
3087
+ ...state,
3088
+ [mainAxis]: mainAxisCoord,
3089
+ [crossAxis]: crossAxisCoord
3090
+ });
3091
+ return {
3092
+ ...limitedCoords,
3093
+ data: {
3094
+ x: limitedCoords.x - x,
3095
+ y: limitedCoords.y - y
3096
+ }
3097
+ };
3105
3098
  }
3106
- }));
3107
- }
3099
+ };
3100
+ };
3101
+ /**
3102
+ * Built-in `limiter` that will stop `shift()` at a certain point.
3103
+ */
3104
+ const limitShift = function (options) {
3105
+ if (options === void 0) {
3106
+ options = {};
3107
+ }
3108
+ return {
3109
+ options,
3110
+ fn(state) {
3111
+ const {
3112
+ x,
3113
+ y,
3114
+ placement,
3115
+ rects,
3116
+ middlewareData
3117
+ } = state;
3118
+ const {
3119
+ offset = 0,
3120
+ mainAxis: checkMainAxis = true,
3121
+ crossAxis: checkCrossAxis = true
3122
+ } = evaluate(options, state);
3123
+ const coords = {
3124
+ x,
3125
+ y
3126
+ };
3127
+ const crossAxis = getSideAxis(placement);
3128
+ const mainAxis = getOppositeAxis(crossAxis);
3129
+ let mainAxisCoord = coords[mainAxis];
3130
+ let crossAxisCoord = coords[crossAxis];
3131
+ const rawOffset = evaluate(offset, state);
3132
+ const computedOffset = typeof rawOffset === 'number' ? {
3133
+ mainAxis: rawOffset,
3134
+ crossAxis: 0
3135
+ } : {
3136
+ mainAxis: 0,
3137
+ crossAxis: 0,
3138
+ ...rawOffset
3139
+ };
3140
+ if (checkMainAxis) {
3141
+ const len = mainAxis === 'y' ? 'height' : 'width';
3142
+ const limitMin = rects.reference[mainAxis] - rects.floating[len] + computedOffset.mainAxis;
3143
+ const limitMax = rects.reference[mainAxis] + rects.reference[len] - computedOffset.mainAxis;
3144
+ if (mainAxisCoord < limitMin) {
3145
+ mainAxisCoord = limitMin;
3146
+ } else if (mainAxisCoord > limitMax) {
3147
+ mainAxisCoord = limitMax;
3148
+ }
3149
+ }
3150
+ if (checkCrossAxis) {
3151
+ var _middlewareData$offse, _middlewareData$offse2;
3152
+ const len = mainAxis === 'y' ? 'width' : 'height';
3153
+ const isOriginSide = ['top', 'left'].includes(getSide(placement));
3154
+ const limitMin = rects.reference[crossAxis] - rects.floating[len] + (isOriginSide ? ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse[crossAxis]) || 0 : 0) + (isOriginSide ? 0 : computedOffset.crossAxis);
3155
+ const limitMax = rects.reference[crossAxis] + rects.reference[len] + (isOriginSide ? 0 : ((_middlewareData$offse2 = middlewareData.offset) == null ? void 0 : _middlewareData$offse2[crossAxis]) || 0) - (isOriginSide ? computedOffset.crossAxis : 0);
3156
+ if (crossAxisCoord < limitMin) {
3157
+ crossAxisCoord = limitMin;
3158
+ } else if (crossAxisCoord > limitMax) {
3159
+ crossAxisCoord = limitMax;
3160
+ }
3161
+ }
3162
+ return {
3163
+ [mainAxis]: mainAxisCoord,
3164
+ [crossAxis]: crossAxisCoord
3165
+ };
3166
+ }
3167
+ };
3168
+ };
3108
3169
 
3109
- const min = Math.min;
3110
- const max = Math.max;
3111
- const round = Math.round;
3112
- const floor = Math.floor;
3113
- const createCoords = v => ({
3114
- x: v,
3115
- y: v
3116
- });
3117
- function rectToClientRect(rect) {
3170
+ /**
3171
+ * Provides data that allows you to change the size of the floating element —
3172
+ * for instance, prevent it from overflowing the clipping boundary or match the
3173
+ * width of the reference element.
3174
+ * @see https://floating-ui.com/docs/size
3175
+ */
3176
+ const size = function (options) {
3177
+ if (options === void 0) {
3178
+ options = {};
3179
+ }
3118
3180
  return {
3119
- ...rect,
3120
- top: rect.y,
3121
- left: rect.x,
3122
- right: rect.x + rect.width,
3123
- bottom: rect.y + rect.height
3181
+ name: 'size',
3182
+ options,
3183
+ async fn(state) {
3184
+ const {
3185
+ placement,
3186
+ rects,
3187
+ platform,
3188
+ elements
3189
+ } = state;
3190
+ const {
3191
+ apply = () => {},
3192
+ ...detectOverflowOptions
3193
+ } = evaluate(options, state);
3194
+ const overflow = await detectOverflow(state, detectOverflowOptions);
3195
+ const side = getSide(placement);
3196
+ const alignment = getAlignment(placement);
3197
+ const isYAxis = getSideAxis(placement) === 'y';
3198
+ const {
3199
+ width,
3200
+ height
3201
+ } = rects.floating;
3202
+ let heightSide;
3203
+ let widthSide;
3204
+ if (side === 'top' || side === 'bottom') {
3205
+ heightSide = side;
3206
+ widthSide = alignment === ((await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating))) ? 'start' : 'end') ? 'left' : 'right';
3207
+ } else {
3208
+ widthSide = side;
3209
+ heightSide = alignment === 'end' ? 'top' : 'bottom';
3210
+ }
3211
+ const maximumClippingHeight = height - overflow.top - overflow.bottom;
3212
+ const maximumClippingWidth = width - overflow.left - overflow.right;
3213
+ const overflowAvailableHeight = min(height - overflow[heightSide], maximumClippingHeight);
3214
+ const overflowAvailableWidth = min(width - overflow[widthSide], maximumClippingWidth);
3215
+ const noShift = !state.middlewareData.shift;
3216
+ let availableHeight = overflowAvailableHeight;
3217
+ let availableWidth = overflowAvailableWidth;
3218
+ if (isYAxis) {
3219
+ availableWidth = alignment || noShift ? min(overflowAvailableWidth, maximumClippingWidth) : maximumClippingWidth;
3220
+ } else {
3221
+ availableHeight = alignment || noShift ? min(overflowAvailableHeight, maximumClippingHeight) : maximumClippingHeight;
3222
+ }
3223
+ if (noShift && !alignment) {
3224
+ const xMin = max(overflow.left, 0);
3225
+ const xMax = max(overflow.right, 0);
3226
+ const yMin = max(overflow.top, 0);
3227
+ const yMax = max(overflow.bottom, 0);
3228
+ if (isYAxis) {
3229
+ availableWidth = width - 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max(overflow.left, overflow.right));
3230
+ } else {
3231
+ availableHeight = height - 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max(overflow.top, overflow.bottom));
3232
+ }
3233
+ }
3234
+ await apply({
3235
+ ...state,
3236
+ availableWidth,
3237
+ availableHeight
3238
+ });
3239
+ const nextDimensions = await platform.getDimensions(elements.floating);
3240
+ if (width !== nextDimensions.width || height !== nextDimensions.height) {
3241
+ return {
3242
+ reset: {
3243
+ rects: true
3244
+ }
3245
+ };
3246
+ }
3247
+ return {};
3248
+ }
3124
3249
  };
3125
- }
3250
+ };
3126
3251
 
3127
3252
  function getNodeName(node) {
3128
3253
  if (isNode(node)) {
@@ -3135,7 +3260,7 @@ function getNodeName(node) {
3135
3260
  }
3136
3261
  function getWindow(node) {
3137
3262
  var _node$ownerDocument;
3138
- return (node == null ? void 0 : (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
3263
+ return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
3139
3264
  }
3140
3265
  function getDocumentElement(node) {
3141
3266
  var _ref;
@@ -3319,8 +3444,9 @@ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetPar
3319
3444
  if (domElement) {
3320
3445
  const win = getWindow(domElement);
3321
3446
  const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
3322
- let currentIFrame = win.frameElement;
3323
- while (currentIFrame && offsetParent && offsetWin !== win) {
3447
+ let currentWin = win;
3448
+ let currentIFrame = currentWin.frameElement;
3449
+ while (currentIFrame && offsetParent && offsetWin !== currentWin) {
3324
3450
  const iframeScale = getScale(currentIFrame);
3325
3451
  const iframeRect = currentIFrame.getBoundingClientRect();
3326
3452
  const css = getComputedStyle$1(currentIFrame);
@@ -3332,7 +3458,8 @@ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetPar
3332
3458
  height *= iframeScale.y;
3333
3459
  x += left;
3334
3460
  y += top;
3335
- currentIFrame = getWindow(currentIFrame).frameElement;
3461
+ currentWin = getWindow(currentIFrame);
3462
+ currentIFrame = currentWin.frameElement;
3336
3463
  }
3337
3464
  }
3338
3465
  return rectToClientRect({
@@ -3349,8 +3476,9 @@ function observeMove(element, onMove) {
3349
3476
  let timeoutId;
3350
3477
  const root = getDocumentElement(element);
3351
3478
  function cleanup() {
3479
+ var _io;
3352
3480
  clearTimeout(timeoutId);
3353
- io && io.disconnect();
3481
+ (_io = io) == null || _io.disconnect();
3354
3482
  io = null;
3355
3483
  }
3356
3484
  function refresh(skip, threshold) {
@@ -3390,9 +3518,11 @@ function observeMove(element, onMove) {
3390
3518
  return refresh();
3391
3519
  }
3392
3520
  if (!ratio) {
3521
+ // If the reference is clipped, the ratio is 0. Throttle the refresh
3522
+ // to prevent an infinite loop of updates.
3393
3523
  timeoutId = setTimeout(() => {
3394
3524
  refresh(false, 1e-7);
3395
- }, 100);
3525
+ }, 1000);
3396
3526
  } else {
3397
3527
  refresh(false, ratio);
3398
3528
  }
@@ -3456,7 +3586,8 @@ function autoUpdate(reference, floating, update, options) {
3456
3586
  resizeObserver.unobserve(floating);
3457
3587
  cancelAnimationFrame(reobserveFrame);
3458
3588
  reobserveFrame = requestAnimationFrame(() => {
3459
- resizeObserver && resizeObserver.observe(floating);
3589
+ var _resizeObserver;
3590
+ (_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating);
3460
3591
  });
3461
3592
  }
3462
3593
  update();
@@ -3481,12 +3612,13 @@ function autoUpdate(reference, floating, update, options) {
3481
3612
  }
3482
3613
  update();
3483
3614
  return () => {
3615
+ var _resizeObserver2;
3484
3616
  ancestors.forEach(ancestor => {
3485
3617
  ancestorScroll && ancestor.removeEventListener('scroll', update);
3486
3618
  ancestorResize && ancestor.removeEventListener('resize', update);
3487
3619
  });
3488
- cleanupIo && cleanupIo();
3489
- resizeObserver && resizeObserver.disconnect();
3620
+ cleanupIo == null || cleanupIo();
3621
+ (_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect();
3490
3622
  resizeObserver = null;
3491
3623
  if (animationFrame) {
3492
3624
  cancelAnimationFrame(frameId);
@@ -3494,6 +3626,72 @@ function autoUpdate(reference, floating, update, options) {
3494
3626
  };
3495
3627
  }
3496
3628
 
3629
+ /**
3630
+ * Modifies the placement by translating the floating element along the
3631
+ * specified axes.
3632
+ * A number (shorthand for `mainAxis` or distance), or an axes configuration
3633
+ * object may be passed.
3634
+ * @see https://floating-ui.com/docs/offset
3635
+ */
3636
+ offset;
3637
+
3638
+ /**
3639
+ * Optimizes the visibility of the floating element by choosing the placement
3640
+ * that has the most space available automatically, without needing to specify a
3641
+ * preferred placement. Alternative to `flip`.
3642
+ * @see https://floating-ui.com/docs/autoPlacement
3643
+ */
3644
+ autoPlacement;
3645
+
3646
+ /**
3647
+ * Optimizes the visibility of the floating element by shifting it in order to
3648
+ * keep it in view when it will overflow the clipping boundary.
3649
+ * @see https://floating-ui.com/docs/shift
3650
+ */
3651
+ shift;
3652
+
3653
+ /**
3654
+ * Optimizes the visibility of the floating element by flipping the `placement`
3655
+ * in order to keep it in view when the preferred placement(s) will overflow the
3656
+ * clipping boundary. Alternative to `autoPlacement`.
3657
+ * @see https://floating-ui.com/docs/flip
3658
+ */
3659
+ flip;
3660
+
3661
+ /**
3662
+ * Provides data that allows you to change the size of the floating element —
3663
+ * for instance, prevent it from overflowing the clipping boundary or match the
3664
+ * width of the reference element.
3665
+ * @see https://floating-ui.com/docs/size
3666
+ */
3667
+ size;
3668
+
3669
+ /**
3670
+ * Provides data to hide the floating element in applicable situations, such as
3671
+ * when it is not in the same clipping context as the reference element.
3672
+ * @see https://floating-ui.com/docs/hide
3673
+ */
3674
+ hide;
3675
+
3676
+ /**
3677
+ * Provides data to position an inner element of the floating element so that it
3678
+ * appears centered to the reference element.
3679
+ * @see https://floating-ui.com/docs/arrow
3680
+ */
3681
+ arrow;
3682
+
3683
+ /**
3684
+ * Provides improved positioning for inline reference elements that can span
3685
+ * over multiple lines, such as hyperlinks or range selections.
3686
+ * @see https://floating-ui.com/docs/inline
3687
+ */
3688
+ inline;
3689
+
3690
+ /**
3691
+ * Built-in `limiter` that will stop `shift()` at a certain point.
3692
+ */
3693
+ limitShift;
3694
+
3497
3695
  var index = typeof document !== 'undefined' ? React.useLayoutEffect : React.useEffect;
3498
3696
 
3499
3697
  var _excluded$4 = ["className", "clearValue", "cx", "getStyles", "getClassNames", "getValue", "hasValue", "isMulti", "isRtl", "options", "selectOption", "selectProps", "setValue", "theme"];