@ntbjs/react-components 1.2.0-rc.98 → 1.2.0-rc.99

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 (68) hide show
  1. package/{ActionButton-adaadbae.js → ActionButton-46735b89.js} +17 -17
  2. package/{Alert-b41a748e.js → Alert-13b75102.js} +36 -33
  3. package/{AssetGallery-df037aa0.js → AssetGallery-094ed34b.js} +595 -442
  4. package/{AssetPreviewTopBar-ac66b804.js → AssetPreviewTopBar-912c3469.js} +38 -35
  5. package/{Badge-4a2a9f6b.js → Badge-aec841c8.js} +67 -47
  6. package/{Button-4c60d2f4.js → Button-49f82b31.js} +77 -66
  7. package/{Checkbox-84dd9aa1.js → Checkbox-68dc38a8.js} +50 -46
  8. package/{CompactAutocompleteSelect-bf5e8820.js → CompactAutocompleteSelect-b68618b3.js} +143 -110
  9. package/{CompactStarRating-017d64cb.js → CompactStarRating-405e4508.js} +105 -90
  10. package/{CompactTextInput-8132e42d.js → CompactTextInput-0d53acdf.js} +104 -93
  11. package/{ContextMenu-4427ad11.js → ContextMenu-4ec3d9f3.js} +7 -8
  12. package/{ContextMenuItem-b5f97001.js → ContextMenuItem-ba2b697e.js} +32 -29
  13. package/{InputGroup-9d1cd295.js → InputGroup-49fbc423.js} +7 -8
  14. package/{Instructions-235aa0fc.js → Instructions-b6d3e7bd.js} +111 -97
  15. package/{MultiLevelCheckboxSelect-4f51a1a2.js → MultiLevelCheckboxSelect-f3de8047.js} +204 -143
  16. package/{MultiSelect-53089d1e.js → MultiSelect-efd60232.js} +120 -91
  17. package/{Popover-938e6bfc.js → Popover-569cd272.js} +33 -32
  18. package/{Radio-1d09e729.js → Radio-32d0513a.js} +33 -33
  19. package/{SectionSeparator-d9ae38b7.js → SectionSeparator-259a22ed.js} +7 -8
  20. package/{Switch-15d9a890.js → Switch-4a41585f.js} +40 -39
  21. package/{Tab-88f77a44.js → Tab-f499ecbc.js} +9 -10
  22. package/{Tabs-e64ecfaa.js → Tabs-a8c77f71.js} +38 -48
  23. package/{TextArea-cbe713eb.js → TextArea-a5579cc8.js} +140 -151
  24. package/{TextInput-b9414cc6.js → TextInput-0d109708.js} +70 -64
  25. package/{Tooltip-22238771.js → Tooltip-66daf6e3.js} +20 -21
  26. package/{VerificationStatusIcon-99a54d5d.js → VerificationStatusIcon-6fe95a92.js} +33 -24
  27. package/{close-1751121a.js → close-ebf2f3cf.js} +12 -8
  28. package/data/Alert/index.js +2 -3
  29. package/data/Badge/index.js +2 -3
  30. package/data/Popover/index.js +3 -4
  31. package/data/Tab/index.js +2 -3
  32. package/data/Tabs/index.js +3 -4
  33. package/data/Tooltip/index.js +3 -4
  34. package/data/index.js +9 -10
  35. package/{index-1e234d23.js → defaultTheme-ea44e34a.js} +352 -39
  36. package/edit-note-c47d292e.js +41 -0
  37. package/{expand-more-d74e2bd2.js → expand-more-94585605.js} +12 -8
  38. package/inputs/ActionButton/index.js +2 -3
  39. package/inputs/Button/index.js +6 -7
  40. package/inputs/Checkbox/index.js +2 -3
  41. package/inputs/CompactAutocompleteSelect/index.js +13 -14
  42. package/inputs/CompactStarRating/index.js +10 -11
  43. package/inputs/CompactTextInput/index.js +11 -12
  44. package/inputs/MultiSelect/index.js +4 -5
  45. package/inputs/Radio/index.js +2 -3
  46. package/inputs/Switch/index.js +2 -3
  47. package/inputs/TextArea/index.js +11 -12
  48. package/inputs/TextInput/index.js +3 -4
  49. package/inputs/index.js +28 -31
  50. package/layout/InputGroup/index.js +2 -3
  51. package/layout/SectionSeparator/index.js +2 -3
  52. package/layout/index.js +3 -4
  53. package/package.json +5 -5
  54. package/{react-select-creatable.esm-31bd2caf.js → react-select-creatable.esm-2f23d6c6.js} +1272 -1470
  55. package/{shift-away-subtle-c3c2f2b2.js → shift-away-subtle-0bed9a3c.js} +1 -1
  56. package/ssr/index.js +3 -1
  57. package/{warning-circle-478e65cc.js → warning-circle-24522402.js} +12 -8
  58. package/widgets/AssetGallery/index.js +31 -33
  59. package/widgets/AssetPreview/AssetPreviewTopBar/index.js +3 -4
  60. package/widgets/ContextMenu/ContextMenuItem/index.js +2 -3
  61. package/widgets/ContextMenu/ContextMenuItemsGroup/index.js +7 -8
  62. package/widgets/ContextMenu/index.js +2 -3
  63. package/widgets/Instructions/index.js +17 -18
  64. package/widgets/index.js +33 -35
  65. package/CompactAutocompleteSelectAsync-e76bf873.js +0 -28
  66. package/defaultTheme-8bd3e0b9.js +0 -271
  67. package/edit-note-cefe2215.js +0 -37
  68. package/inputs/CompactAutocompleteSelectAsync/index.js +0 -11
@@ -1,7 +1,6 @@
1
1
  'use strict';
2
2
 
3
3
  var React = require('react');
4
- var index$1 = require('./index-1e234d23.js');
5
4
  var reactDom = require('react-dom');
6
5
 
7
6
  function _interopNamespace(e) {
@@ -13,190 +12,228 @@ function _interopNamespace(e) {
13
12
  var d = Object.getOwnPropertyDescriptor(e, k);
14
13
  Object.defineProperty(n, k, d.get ? d : {
15
14
  enumerable: true,
16
- get: function () { return e[k]; }
15
+ get: function () {
16
+ return e[k];
17
+ }
17
18
  });
18
19
  }
19
20
  });
20
21
  }
21
- n["default"] = e;
22
+ n['default'] = e;
22
23
  return Object.freeze(n);
23
24
  }
24
25
 
25
26
  var React__namespace = /*#__PURE__*/_interopNamespace(React);
26
27
 
27
28
  function _extends() {
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]);
32
- }
33
- return n;
34
- }, _extends.apply(null, arguments);
35
- }
29
+ _extends = Object.assign ? Object.assign.bind() : function (target) {
30
+ for (var i = 1; i < arguments.length; i++) {
31
+ var source = arguments[i];
36
32
 
37
- function _typeof(o) {
38
- "@babel/helpers - typeof";
33
+ for (var key in source) {
34
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
35
+ target[key] = source[key];
36
+ }
37
+ }
38
+ }
39
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);
40
+ return target;
41
+ };
42
+ return _extends.apply(this, arguments);
45
43
  }
46
44
 
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.");
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;
54
55
  }
55
- return ("string" === r ? String : Number)(t);
56
- }
57
56
 
58
- function toPropertyKey(t) {
59
- var i = toPrimitive(t, "string");
60
- return "symbol" == _typeof(i) ? i : i + "";
57
+ return obj;
61
58
  }
62
59
 
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
- }
60
+ function ownKeys(object, enumerableOnly) {
61
+ var keys = Object.keys(object);
71
62
 
72
- function ownKeys(e, r) {
73
- var t = Object.keys(e);
74
63
  if (Object.getOwnPropertySymbols) {
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);
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);
79
68
  }
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));
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));
89
80
  });
90
81
  }
91
- return e;
82
+
83
+ return target;
92
84
  }
93
85
 
94
- function _classCallCheck(a, n) {
95
- if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
86
+ function _classCallCheck(instance, Constructor) {
87
+ if (!(instance instanceof Constructor)) {
88
+ throw new TypeError("Cannot call a class as a function");
89
+ }
96
90
  }
97
91
 
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);
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);
102
99
  }
103
100
  }
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;
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;
108
109
  }
109
110
 
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);
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);
114
117
  }
115
118
 
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, {
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, {
119
125
  constructor: {
120
- value: t,
121
- writable: !0,
122
- configurable: !0
126
+ value: subClass,
127
+ writable: true,
128
+ configurable: true
123
129
  }
124
- }), Object.defineProperty(t, "prototype", {
125
- writable: !1
126
- }), e && _setPrototypeOf(t, e);
130
+ });
131
+ Object.defineProperty(subClass, "prototype", {
132
+ writable: false
133
+ });
134
+ if (superClass) _setPrototypeOf(subClass, superClass);
127
135
  }
128
136
 
129
- function _getPrototypeOf(t) {
130
- return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) {
131
- return t.__proto__ || Object.getPrototypeOf(t);
132
- }, _getPrototypeOf(t);
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);
133
142
  }
134
143
 
135
144
  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
+
136
149
  try {
137
- var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
138
- } catch (t) {}
139
- return (_isNativeReflectConstruct = function _isNativeReflectConstruct() {
140
- return !!t;
141
- })();
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);
142
165
  }
143
166
 
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;
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;
147
173
  }
148
174
 
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);
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);
153
183
  }
154
184
 
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);
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);
165
199
  };
166
200
  }
167
201
 
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;
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;
172
210
  }
173
211
 
174
- function _arrayWithoutHoles(r) {
175
- if (Array.isArray(r)) return _arrayLikeToArray(r);
212
+ function _arrayWithoutHoles(arr) {
213
+ if (Array.isArray(arr)) return _arrayLikeToArray(arr);
176
214
  }
177
215
 
178
- function _iterableToArray(r) {
179
- if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
216
+ function _iterableToArray(iter) {
217
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
180
218
  }
181
219
 
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
- }
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);
188
227
  }
189
228
 
190
229
  function _nonIterableSpread() {
191
230
  throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
192
231
  }
193
232
 
194
- function _toConsumableArray(r) {
195
- return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();
233
+ function _toConsumableArray(arr) {
234
+ return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
196
235
  }
197
236
 
198
- var isDevelopment$2 = false;
199
-
200
237
  /*
201
238
 
202
239
  Based off glamor's StyleSheet, thanks Sunil ❤️
@@ -219,9 +256,10 @@ styleSheet.flush()
219
256
  - empties the stylesheet of all its contents
220
257
 
221
258
  */
222
-
259
+ // $FlowFixMe
223
260
  function sheetForTag(tag) {
224
261
  if (tag.sheet) {
262
+ // $FlowFixMe
225
263
  return tag.sheet;
226
264
  } // this weirdness brought to you by firefox
227
265
 
@@ -230,13 +268,10 @@ function sheetForTag(tag) {
230
268
 
231
269
  for (var i = 0; i < document.styleSheets.length; i++) {
232
270
  if (document.styleSheets[i].ownerNode === tag) {
271
+ // $FlowFixMe
233
272
  return document.styleSheets[i];
234
273
  }
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;
274
+ }
240
275
  }
241
276
 
242
277
  function createStyleElement(options) {
@@ -277,7 +312,7 @@ var StyleSheet = /*#__PURE__*/function () {
277
312
  _this.tags.push(tag);
278
313
  };
279
314
 
280
- this.isSpeedy = options.speedy === undefined ? !isDevelopment$2 : options.speedy;
315
+ this.isSpeedy = options.speedy === undefined ? process.env.NODE_ENV === 'production' : options.speedy;
281
316
  this.tags = [];
282
317
  this.ctr = 0;
283
318
  this.nonce = options.nonce; // key is the value of the data-emotion attribute, it's used to identify different sheets
@@ -305,6 +340,18 @@ var StyleSheet = /*#__PURE__*/function () {
305
340
 
306
341
  var tag = this.tags[this.tags.length - 1];
307
342
 
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
+
308
355
  if (this.isSpeedy) {
309
356
  var sheet = sheetForTag(tag);
310
357
 
@@ -313,6 +360,9 @@ var StyleSheet = /*#__PURE__*/function () {
313
360
  // the big drawback is that the css won't be editable in devtools
314
361
  sheet.insertRule(rule, sheet.cssRules.length);
315
362
  } 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
+ }
316
366
  }
317
367
  } else {
318
368
  tag.appendChild(document.createTextNode(rule));
@@ -322,13 +372,16 @@ var StyleSheet = /*#__PURE__*/function () {
322
372
  };
323
373
 
324
374
  _proto.flush = function flush() {
375
+ // $FlowFixMe
325
376
  this.tags.forEach(function (tag) {
326
- var _tag$parentNode;
327
-
328
- return (_tag$parentNode = tag.parentNode) == null ? void 0 : _tag$parentNode.removeChild(tag);
377
+ return tag.parentNode && tag.parentNode.removeChild(tag);
329
378
  });
330
379
  this.tags = [];
331
380
  this.ctr = 0;
381
+
382
+ if (process.env.NODE_ENV !== 'production') {
383
+ this._alreadyInsertedOrderInsensitiveRule = false;
384
+ }
332
385
  };
333
386
 
334
387
  return StyleSheet;
@@ -933,11 +986,11 @@ function rulesheet (callback) {
933
986
  }
934
987
 
935
988
  var weakMemoize = function weakMemoize(func) {
989
+ // $FlowFixMe flow doesn't include all non-primitive types as allowed for weakmaps
936
990
  var cache = new WeakMap();
937
991
  return function (arg) {
938
992
  if (cache.has(arg)) {
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
993
+ // $FlowFixMe
941
994
  return cache.get(arg);
942
995
  }
943
996
 
@@ -947,7 +1000,7 @@ var weakMemoize = function weakMemoize(func) {
947
1000
  };
948
1001
  };
949
1002
 
950
- function memoize(fn) {
1003
+ function memoize$1(fn) {
951
1004
  var cache = Object.create(null);
952
1005
  return function (arg) {
953
1006
  if (cache[arg] === undefined) cache[arg] = fn(arg);
@@ -955,8 +1008,6 @@ function memoize(fn) {
955
1008
  };
956
1009
  }
957
1010
 
958
- var isBrowser$3 = typeof document !== 'undefined';
959
-
960
1011
  var identifierWithPointTracking = function identifierWithPointTracking(begin, points, index) {
961
1012
  var previous = 0;
962
1013
  var character = 0;
@@ -1081,6 +1132,114 @@ var removeLabel = function removeLabel(element) {
1081
1132
  }
1082
1133
  }
1083
1134
  };
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
+ };
1084
1243
 
1085
1244
  /* eslint-disable no-fallthrough */
1086
1245
 
@@ -1294,22 +1453,9 @@ var prefixer = function prefixer(element, index, children, callback) {
1294
1453
  }
1295
1454
  };
1296
1455
 
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 () {
1456
+ var isBrowser$4 = typeof document !== 'undefined';
1457
+ var getServerStylisCache = isBrowser$4 ? undefined : weakMemoize(function () {
1458
+ return memoize$1(function () {
1313
1459
  var cache = {};
1314
1460
  return function (name) {
1315
1461
  return cache[name];
@@ -1318,22 +1464,20 @@ var getServerStylisCache = isBrowser$3 ? undefined : weakMemoize(function () {
1318
1464
  });
1319
1465
  var defaultStylisPlugins = [prefixer];
1320
1466
 
1321
- var createCache = function
1322
- /*: EmotionCache */
1323
- createCache(options
1324
- /*: Options */
1325
- ) {
1467
+ var createCache = function createCache(options) {
1326
1468
  var key = options.key;
1327
1469
 
1328
- if (isBrowser$3 && key === 'css') {
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') {
1329
1475
  var ssrStyles = document.querySelectorAll("style[data-emotion]:not([data-s])"); // get SSRed styles out of the way of React's hydration
1330
1476
  // document.head is a safe place to move them to(though note document.head is not necessarily the last place they will be)
1331
1477
  // note this very very intentionally targets all style elements regardless of the key to ensure
1332
1478
  // that creating a cache works inside of render of a React component
1333
1479
 
1334
- Array.prototype.forEach.call(ssrStyles, function (node
1335
- /*: HTMLStyleElement */
1336
- ) {
1480
+ Array.prototype.forEach.call(ssrStyles, function (node) {
1337
1481
  // we want to only move elements which have a space in the data-emotion attribute value
1338
1482
  // because that indicates that it is an Emotion 11 server-side rendered style elements
1339
1483
  // while we will already ignore Emotion 11 client-side inserted styles because of the :not([data-s]) part in the selector
@@ -1345,7 +1489,6 @@ createCache(options
1345
1489
  if (dataEmotionAttribute.indexOf(' ') === -1) {
1346
1490
  return;
1347
1491
  }
1348
-
1349
1492
  document.head.appendChild(node);
1350
1493
  node.setAttribute('data-s', '');
1351
1494
  });
@@ -1353,20 +1496,23 @@ createCache(options
1353
1496
 
1354
1497
  var stylisPlugins = options.stylisPlugins || defaultStylisPlugins;
1355
1498
 
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
+
1356
1506
  var inserted = {};
1357
1507
  var container;
1358
- /* : Node */
1359
-
1360
1508
  var nodesToHydrate = [];
1361
1509
 
1362
- if (isBrowser$3) {
1510
+ if (isBrowser$4) {
1363
1511
  container = options.container || document.head;
1364
1512
  Array.prototype.forEach.call( // this means we will ignore elements which don't have a space in them which
1365
1513
  // means that the style elements we're looking at are only Emotion 11 server-rendered style elements
1366
- document.querySelectorAll("style[data-emotion^=\"" + key + " \"]"), function (node
1367
- /*: HTMLStyleElement */
1368
- ) {
1369
- var attrib = node.getAttribute("data-emotion").split(' ');
1514
+ document.querySelectorAll("style[data-emotion^=\"" + key + " \"]"), function (node) {
1515
+ var attrib = node.getAttribute("data-emotion").split(' '); // $FlowFixMe
1370
1516
 
1371
1517
  for (var i = 1; i < attrib.length; i++) {
1372
1518
  inserted[attrib[i]] = true;
@@ -1377,19 +1523,31 @@ createCache(options
1377
1523
  }
1378
1524
 
1379
1525
  var _insert;
1380
- /*: (
1381
- selector: string,
1382
- serialized: SerializedStyles,
1383
- sheet: StyleSheet,
1384
- shouldCache: boolean
1385
- ) => string | void */
1386
-
1387
1526
 
1388
1527
  var omnipresentPlugins = [compat, removeLabel];
1389
1528
 
1390
- if (isBrowser$3) {
1529
+ if (process.env.NODE_ENV !== 'production') {
1530
+ omnipresentPlugins.push(createUnsafeSelectorsAlarm({
1531
+ get compat() {
1532
+ return cache.compat;
1533
+ }
1534
+
1535
+ }), incorrectImportAlarm);
1536
+ }
1537
+
1538
+ if (isBrowser$4) {
1391
1539
  var currentSheet;
1392
- var finalizingPlugins = [stringify, rulesheet(function (rule) {
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) {
1393
1551
  currentSheet.insert(rule);
1394
1552
  })];
1395
1553
  var serializer = middleware(omnipresentPlugins.concat(stylisPlugins, finalizingPlugins));
@@ -1398,19 +1556,17 @@ createCache(options
1398
1556
  return serialize(compile(styles), serializer);
1399
1557
  };
1400
1558
 
1401
- _insert = function
1402
- /*: void */
1403
- insert(selector
1404
- /*: string */
1405
- , serialized
1406
- /*: SerializedStyles */
1407
- , sheet
1408
- /*: StyleSheet */
1409
- , shouldCache
1410
- /*: boolean */
1411
- ) {
1559
+ _insert = function insert(selector, serialized, sheet, shouldCache) {
1412
1560
  currentSheet = sheet;
1413
1561
 
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
+
1414
1570
  stylis(selector ? selector + "{" + serialized.styles + "}" : serialized.styles);
1415
1571
 
1416
1572
  if (shouldCache) {
@@ -1424,17 +1580,12 @@ createCache(options
1424
1580
 
1425
1581
  var _stylis = function _stylis(styles) {
1426
1582
  return serialize(compile(styles), _serializer);
1427
- };
1583
+ }; // $FlowFixMe
1584
+
1428
1585
 
1429
1586
  var serverStylisCache = getServerStylisCache(stylisPlugins)(key);
1430
1587
 
1431
- var getRules = function
1432
- /*: string */
1433
- getRules(selector
1434
- /*: string */
1435
- , serialized
1436
- /*: SerializedStyles */
1437
- ) {
1588
+ var getRules = function getRules(selector, serialized) {
1438
1589
  var name = serialized.name;
1439
1590
 
1440
1591
  if (serverStylisCache[name] === undefined) {
@@ -1444,17 +1595,7 @@ createCache(options
1444
1595
  return serverStylisCache[name];
1445
1596
  };
1446
1597
 
1447
- _insert = function
1448
- /*: string | void */
1449
- _insert(selector
1450
- /*: string */
1451
- , serialized
1452
- /*: SerializedStyles */
1453
- , sheet
1454
- /*: StyleSheet */
1455
- , shouldCache
1456
- /*: boolean */
1457
- ) {
1598
+ _insert = function _insert(selector, serialized, sheet, shouldCache) {
1458
1599
  var name = serialized.name;
1459
1600
  var rules = getRules(selector, serialized);
1460
1601
 
@@ -1466,6 +1607,12 @@ createCache(options
1466
1607
  cache.inserted[name] = true;
1467
1608
  }
1468
1609
 
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
+
1469
1616
  return rules;
1470
1617
  } else {
1471
1618
  // in compat mode, we put the styles on the inserted cache so
@@ -1484,9 +1631,7 @@ createCache(options
1484
1631
  };
1485
1632
  }
1486
1633
 
1487
- var cache
1488
- /*: EmotionCache */
1489
- = {
1634
+ var cache = {
1490
1635
  key: key,
1491
1636
  sheet: new StyleSheet({
1492
1637
  key: key,
@@ -1505,7 +1650,213 @@ createCache(options
1505
1650
  return cache;
1506
1651
  };
1507
1652
 
1508
- var reactIs = index$1.reactIs.exports;
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;
1509
1860
  var FORWARD_REF_STATICS = {
1510
1861
  '$$typeof': true,
1511
1862
  render: true,
@@ -1525,8 +1876,7 @@ var TYPE_STATICS = {};
1525
1876
  TYPE_STATICS[reactIs.ForwardRef] = FORWARD_REF_STATICS;
1526
1877
  TYPE_STATICS[reactIs.Memo] = MEMO_STATICS;
1527
1878
 
1528
- var isBrowser$2 = typeof document !== 'undefined';
1529
-
1879
+ var isBrowser$3 = typeof document !== 'undefined';
1530
1880
  function getRegisteredStyles(registered, registeredStyles, classNames) {
1531
1881
  var rawClassName = '';
1532
1882
  classNames.split(' ').forEach(function (className) {
@@ -1550,7 +1900,7 @@ var registerStyles = function registerStyles(cache, serialized, isStringTag) {
1550
1900
  // in node since emotion-server relies on whether a style is in
1551
1901
  // the registered cache to know whether a style is global or not
1552
1902
  // also, note that this check will be dead code eliminated in the browser
1553
- isBrowser$2 === false && cache.compat !== undefined) && cache.registered[className] === undefined) {
1903
+ isBrowser$3 === false && cache.compat !== undefined) && cache.registered[className] === undefined) {
1554
1904
  cache.registered[className] = serialized.styles;
1555
1905
  }
1556
1906
  };
@@ -1565,14 +1915,14 @@ var insertStyles = function insertStyles(cache, serialized, isStringTag) {
1565
1915
  do {
1566
1916
  var maybeStyles = cache.insert(serialized === current ? "." + className : '', current, cache.sheet, true);
1567
1917
 
1568
- if (!isBrowser$2 && maybeStyles !== undefined) {
1918
+ if (!isBrowser$3 && maybeStyles !== undefined) {
1569
1919
  stylesForSSR += maybeStyles;
1570
1920
  }
1571
1921
 
1572
1922
  current = current.next;
1573
1923
  } while (current !== undefined);
1574
1924
 
1575
- if (!isBrowser$2 && stylesForSSR.length !== 0) {
1925
+ if (!isBrowser$3 && stylesForSSR.length !== 0) {
1576
1926
  return stylesForSSR;
1577
1927
  }
1578
1928
  }
@@ -1682,8 +2032,16 @@ var unitlessKeys = {
1682
2032
  strokeWidth: 1
1683
2033
  };
1684
2034
 
1685
- var isDevelopment$1 = false;
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
+ }
1686
2042
 
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).";
1687
2045
  var hyphenateRegex = /[A-Z]|^ms/g;
1688
2046
  var animationRegex = /_EMO_([^_]+?)_([^]*?)_EMO_/g;
1689
2047
 
@@ -1724,6 +2082,34 @@ var processStyleValue = function processStyleValue(key, value) {
1724
2082
  return value;
1725
2083
  };
1726
2084
 
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
+
1727
2113
  var noComponentSelectorMessage = 'Component selectors can only be used in conjunction with ' + '@emotion/babel-plugin, the swc Emotion plugin, or another Emotion-aware ' + 'compiler transform.';
1728
2114
 
1729
2115
  function handleInterpolation(mergedProps, registered, interpolation) {
@@ -1731,11 +2117,12 @@ function handleInterpolation(mergedProps, registered, interpolation) {
1731
2117
  return '';
1732
2118
  }
1733
2119
 
1734
- var componentSelector = interpolation;
1735
-
1736
- if (componentSelector.__emotion_styles !== undefined) {
2120
+ if (interpolation.__emotion_styles !== undefined) {
2121
+ if (process.env.NODE_ENV !== 'production' && interpolation.toString() === 'NO_COMPONENT_SELECTOR') {
2122
+ throw new Error(noComponentSelectorMessage);
2123
+ }
1737
2124
 
1738
- return componentSelector;
2125
+ return interpolation;
1739
2126
  }
1740
2127
 
1741
2128
  switch (typeof interpolation) {
@@ -1746,21 +2133,17 @@ function handleInterpolation(mergedProps, registered, interpolation) {
1746
2133
 
1747
2134
  case 'object':
1748
2135
  {
1749
- var keyframes = interpolation;
1750
-
1751
- if (keyframes.anim === 1) {
2136
+ if (interpolation.anim === 1) {
1752
2137
  cursor = {
1753
- name: keyframes.name,
1754
- styles: keyframes.styles,
2138
+ name: interpolation.name,
2139
+ styles: interpolation.styles,
1755
2140
  next: cursor
1756
2141
  };
1757
- return keyframes.name;
2142
+ return interpolation.name;
1758
2143
  }
1759
2144
 
1760
- var serializedStyles = interpolation;
1761
-
1762
- if (serializedStyles.styles !== undefined) {
1763
- var next = serializedStyles.next;
2145
+ if (interpolation.styles !== undefined) {
2146
+ var next = interpolation.next;
1764
2147
 
1765
2148
  if (next !== undefined) {
1766
2149
  // not the most efficient thing ever but this is a pretty rare case
@@ -1775,7 +2158,11 @@ function handleInterpolation(mergedProps, registered, interpolation) {
1775
2158
  }
1776
2159
  }
1777
2160
 
1778
- var styles = serializedStyles.styles + ";";
2161
+ var styles = interpolation.styles + ";";
2162
+
2163
+ if (process.env.NODE_ENV !== 'production' && interpolation.map !== undefined) {
2164
+ styles += interpolation.map;
2165
+ }
1779
2166
 
1780
2167
  return styles;
1781
2168
  }
@@ -1790,21 +2177,37 @@ function handleInterpolation(mergedProps, registered, interpolation) {
1790
2177
  var result = interpolation(mergedProps);
1791
2178
  cursor = previousCursor;
1792
2179
  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}`");
1793
2182
  }
1794
2183
 
1795
2184
  break;
1796
2185
  }
1797
- } // finalize string values (regular strings and functions interpolated into css calls)
1798
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
+ } // finalize string values (regular strings and functions interpolated into css calls)
1799
2203
 
1800
- var asString = interpolation;
1801
2204
 
1802
2205
  if (registered == null) {
1803
- return asString;
2206
+ return interpolation;
1804
2207
  }
1805
2208
 
1806
- var cached = registered[asString];
1807
- return cached !== undefined ? cached : asString;
2209
+ var cached = registered[interpolation];
2210
+ return cached !== undefined ? cached : interpolation;
1808
2211
  }
1809
2212
 
1810
2213
  function createStringFromObject(mergedProps, registered, obj) {
@@ -1815,43 +2218,44 @@ function createStringFromObject(mergedProps, registered, obj) {
1815
2218
  string += handleInterpolation(mergedProps, registered, obj[i]) + ";";
1816
2219
  }
1817
2220
  } else {
1818
- for (var key in obj) {
1819
- var value = obj[key];
2221
+ for (var _key in obj) {
2222
+ var value = obj[_key];
1820
2223
 
1821
2224
  if (typeof value !== 'object') {
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) + ";";
2225
+ if (registered != null && registered[value] !== undefined) {
2226
+ string += _key + "{" + registered[value] + "}";
2227
+ } else if (isProcessableValue(value)) {
2228
+ string += processStyleName(_key) + ":" + processStyleValue(_key, value) + ";";
1828
2229
  }
1829
2230
  } else {
1830
- if (key === 'NO_COMPONENT_SELECTOR' && isDevelopment$1) {
2231
+ if (_key === 'NO_COMPONENT_SELECTOR' && process.env.NODE_ENV !== 'production') {
1831
2232
  throw new Error(noComponentSelectorMessage);
1832
2233
  }
1833
2234
 
1834
2235
  if (Array.isArray(value) && typeof value[0] === 'string' && (registered == null || registered[value[0]] === undefined)) {
1835
2236
  for (var _i = 0; _i < value.length; _i++) {
1836
2237
  if (isProcessableValue(value[_i])) {
1837
- string += processStyleName(key) + ":" + processStyleValue(key, value[_i]) + ";";
2238
+ string += processStyleName(_key) + ":" + processStyleValue(_key, value[_i]) + ";";
1838
2239
  }
1839
2240
  }
1840
2241
  } else {
1841
2242
  var interpolated = handleInterpolation(mergedProps, registered, value);
1842
2243
 
1843
- switch (key) {
2244
+ switch (_key) {
1844
2245
  case 'animation':
1845
2246
  case 'animationName':
1846
2247
  {
1847
- string += processStyleName(key) + ":" + interpolated + ";";
2248
+ string += processStyleName(_key) + ":" + interpolated + ";";
1848
2249
  break;
1849
2250
  }
1850
2251
 
1851
2252
  default:
1852
2253
  {
2254
+ if (process.env.NODE_ENV !== 'production' && _key === 'undefined') {
2255
+ console.error(UNDEFINED_AS_OBJECT_KEY_ERROR);
2256
+ }
1853
2257
 
1854
- string += key + "{" + interpolated + "}";
2258
+ string += _key + "{" + interpolated + "}";
1855
2259
  }
1856
2260
  }
1857
2261
  }
@@ -1863,11 +2267,16 @@ function createStringFromObject(mergedProps, registered, obj) {
1863
2267
  }
1864
2268
 
1865
2269
  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
1866
2275
  // keyframes are stored on the SerializedStyles object as a linked list
1867
2276
 
1868
2277
 
1869
2278
  var cursor;
1870
- function serializeStyles(args, registered, mergedProps) {
2279
+ var serializeStyles = function serializeStyles(args, registered, mergedProps) {
1871
2280
  if (args.length === 1 && typeof args[0] === 'object' && args[0] !== null && args[0].styles !== undefined) {
1872
2281
  return args[0];
1873
2282
  }
@@ -1881,9 +2290,11 @@ function serializeStyles(args, registered, mergedProps) {
1881
2290
  stringMode = false;
1882
2291
  styles += handleInterpolation(mergedProps, registered, strings);
1883
2292
  } else {
1884
- var asTemplateStringsArr = strings;
2293
+ if (process.env.NODE_ENV !== 'production' && strings[0] === undefined) {
2294
+ console.error(ILLEGAL_ESCAPE_SEQUENCE_ERROR);
2295
+ }
1885
2296
 
1886
- styles += asTemplateStringsArr[0];
2297
+ styles += strings[0];
1887
2298
  } // we start at 1 since we've already handled the first arg
1888
2299
 
1889
2300
 
@@ -1891,47 +2302,69 @@ function serializeStyles(args, registered, mergedProps) {
1891
2302
  styles += handleInterpolation(mergedProps, registered, args[i]);
1892
2303
 
1893
2304
  if (stringMode) {
1894
- var templateStringsArr = strings;
2305
+ if (process.env.NODE_ENV !== 'production' && strings[i] === undefined) {
2306
+ console.error(ILLEGAL_ESCAPE_SEQUENCE_ERROR);
2307
+ }
1895
2308
 
1896
- styles += templateStringsArr[i];
2309
+ styles += strings[i];
1897
2310
  }
1898
2311
  }
1899
2312
 
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
+
1900
2322
 
1901
2323
  labelPattern.lastIndex = 0;
1902
2324
  var identifierName = '';
1903
2325
  var match; // https://esbench.com/bench/5b809c2cf2949800a0f61fb5
1904
2326
 
1905
2327
  while ((match = labelPattern.exec(styles)) !== null) {
1906
- identifierName += '-' + match[1];
2328
+ identifierName += '-' + // $FlowFixMe we know it's not null
2329
+ match[1];
1907
2330
  }
1908
2331
 
1909
2332
  var name = murmur2(styles) + identifierName;
1910
2333
 
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
+
1911
2347
  return {
1912
2348
  name: name,
1913
2349
  styles: styles,
1914
2350
  next: cursor
1915
2351
  };
1916
- }
2352
+ };
1917
2353
 
1918
- var isBrowser$1 = typeof document !== 'undefined';
2354
+ var isBrowser$2 = typeof document !== 'undefined';
1919
2355
 
1920
2356
  var syncFallback = function syncFallback(create) {
1921
2357
  return create();
1922
2358
  };
1923
2359
 
1924
2360
  var useInsertionEffect = React__namespace['useInsertion' + 'Effect'] ? React__namespace['useInsertion' + 'Effect'] : false;
1925
- var useInsertionEffectAlwaysWithSyncFallback = !isBrowser$1 ? syncFallback : useInsertionEffect || syncFallback;
2361
+ var useInsertionEffectAlwaysWithSyncFallback = !isBrowser$2 ? syncFallback : useInsertionEffect || syncFallback;
2362
+ var useInsertionEffectWithLayoutFallback = useInsertionEffect || React__namespace.useLayoutEffect;
1926
2363
 
1927
- var isDevelopment = false;
1928
-
1929
- var isBrowser = typeof document !== 'undefined';
2364
+ var isBrowser$1 = typeof document !== 'undefined';
2365
+ var hasOwnProperty = {}.hasOwnProperty;
1930
2366
 
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
2367
+ var EmotionCacheContext = /* #__PURE__ */React__namespace.createContext( // we're doing this to avoid preconstruct's dead code elimination in this one case
1935
2368
  // because this module is primarily intended for the browser and node
1936
2369
  // but it's also required in react native and similar environments sometimes
1937
2370
  // and we could have a special build just for that
@@ -1941,37 +2374,24 @@ typeof HTMLElement !== 'undefined' ? /* #__PURE__ */createCache({
1941
2374
  key: 'css'
1942
2375
  }) : null);
1943
2376
 
2377
+ if (process.env.NODE_ENV !== 'production') {
2378
+ EmotionCacheContext.displayName = 'EmotionCacheContext';
2379
+ }
2380
+
1944
2381
  EmotionCacheContext.Provider;
1945
2382
 
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
- ) {
2383
+ var withEmotionCache = function withEmotionCache(func) {
2384
+ // $FlowFixMe
2385
+ return /*#__PURE__*/React.forwardRef(function (props, ref) {
1958
2386
  // the cache will never be null in the browser
1959
2387
  var cache = React.useContext(EmotionCacheContext);
1960
2388
  return func(props, cache, ref);
1961
2389
  });
1962
2390
  };
1963
2391
 
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
- ) {
2392
+ if (!isBrowser$1) {
2393
+ withEmotionCache = function withEmotionCache(func) {
2394
+ return function (props) {
1975
2395
  var cache = React.useContext(EmotionCacheContext);
1976
2396
 
1977
2397
  if (cache === null) {
@@ -1995,31 +2415,81 @@ if (!isBrowser) {
1995
2415
 
1996
2416
  var ThemeContext = /* #__PURE__ */React__namespace.createContext({});
1997
2417
 
1998
- var hasOwn = {}.hasOwnProperty;
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
+ };
1999
2464
 
2000
2465
  var typePropName = '__EMOTION_TYPE_PLEASE_DO_NOT_USE__';
2001
- var createEmotionProps = function createEmotionProps(type
2002
- /*: React.ElementType */
2003
- , props
2004
- /*: Object */
2005
- ) {
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
+ }
2006
2472
 
2007
- var newProps
2008
- /*: any */
2009
- = {};
2473
+ var newProps = {};
2010
2474
 
2011
2475
  for (var key in props) {
2012
- if (hasOwn.call(props, key)) {
2476
+ if (hasOwnProperty.call(props, key)) {
2013
2477
  newProps[key] = props[key];
2014
2478
  }
2015
2479
  }
2016
2480
 
2017
- newProps[typePropName] = type; // Runtime labeling is an opt-in feature because:
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
+ }
2018
2488
 
2019
2489
  return newProps;
2020
2490
  };
2021
2491
 
2022
- var Insertion = function Insertion(_ref) {
2492
+ var Insertion$1 = function Insertion(_ref) {
2023
2493
  var cache = _ref.cache,
2024
2494
  serialized = _ref.serialized,
2025
2495
  isStringTag = _ref.isStringTag;
@@ -2028,7 +2498,7 @@ var Insertion = function Insertion(_ref) {
2028
2498
  return insertStyles(cache, serialized, isStringTag);
2029
2499
  });
2030
2500
 
2031
- if (!isBrowser && rules !== undefined) {
2501
+ if (!isBrowser$1 && rules !== undefined) {
2032
2502
  var _ref2;
2033
2503
 
2034
2504
  var serializedNames = serialized.name;
@@ -2047,9 +2517,7 @@ var Insertion = function Insertion(_ref) {
2047
2517
  return null;
2048
2518
  };
2049
2519
 
2050
- var Emotion = /* #__PURE__ */withEmotionCache(
2051
- /* <any, any> */
2052
- function (props, cache, ref) {
2520
+ var Emotion = /* #__PURE__ */withEmotionCache(function (props, cache, ref) {
2053
2521
  var cssProp = props.css; // so that using `css` from `emotion` and passing the result to the css prop works
2054
2522
  // not passing the registered cache to serializeStyles because it would
2055
2523
  // make certain babel optimisations not possible
@@ -2070,42 +2538,175 @@ function (props, cache, ref) {
2070
2538
 
2071
2539
  var serialized = serializeStyles(registeredStyles, undefined, React__namespace.useContext(ThemeContext));
2072
2540
 
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
+
2073
2549
  className += cache.key + "-" + serialized.name;
2074
2550
  var newProps = {};
2075
2551
 
2076
2552
  for (var key in props) {
2077
- if (hasOwn.call(props, key) && key !== 'css' && key !== typePropName && (!isDevelopment )) {
2553
+ if (hasOwnProperty.call(props, key) && key !== 'css' && key !== typePropName && (process.env.NODE_ENV === 'production' || key !== labelPropName)) {
2078
2554
  newProps[key] = props[key];
2079
2555
  }
2080
2556
  }
2081
2557
 
2558
+ newProps.ref = ref;
2082
2559
  newProps.className = className;
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, {
2560
+ return /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, /*#__PURE__*/React__namespace.createElement(Insertion$1, {
2089
2561
  cache: cache,
2090
2562
  serialized: serialized,
2091
2563
  isStringTag: typeof WrappedComponent === 'string'
2092
2564
  }), /*#__PURE__*/React__namespace.createElement(WrappedComponent, newProps));
2093
2565
  });
2094
2566
 
2567
+ if (process.env.NODE_ENV !== 'production') {
2568
+ Emotion.displayName = 'EmotionCssPropInternal';
2569
+ }
2570
+
2095
2571
  var Emotion$1 = Emotion;
2096
2572
 
2097
- var jsx
2098
- /*: typeof React.createElement */
2099
- = function jsx
2100
- /*: typeof React.createElement */
2101
- (type
2102
- /*: React.ElementType */
2103
- , props
2104
- /*: Object */
2105
- ) {
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) {
2106
2706
  var args = arguments;
2107
2707
 
2108
- if (props == null || !hasOwn.call(props, 'css')) {
2708
+ if (props == null || !hasOwnProperty.call(props, 'css')) {
2709
+ // $FlowFixMe
2109
2710
  return React__namespace.createElement.apply(undefined, args);
2110
2711
  }
2111
2712
 
@@ -2116,1138 +2717,412 @@ var jsx
2116
2717
 
2117
2718
  for (var i = 2; i < argsLength; i++) {
2118
2719
  createElementArgArray[i] = args[i];
2119
- }
2720
+ } // $FlowFixMe
2721
+
2120
2722
 
2121
2723
  return React__namespace.createElement.apply(null, createElementArgArray);
2122
2724
  };
2123
2725
 
2124
- /* import type { Interpolation, SerializedStyles } from '@emotion/utils' */
2125
-
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];
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;
2131
2738
  }
2132
2739
 
2133
- return serializeStyles(args);
2134
- }
2740
+ var styles = props.styles;
2741
+ var serialized = serializeStyles([styles], undefined, React__namespace.useContext(ThemeContext));
2135
2742
 
2136
- /*
2137
- type Keyframes = {|
2138
- name: string,
2139
- styles: string,
2140
- anim: 1,
2141
- toString: () => string
2142
- |} & string
2143
- */
2743
+ if (!isBrowser$1) {
2744
+ var _ref;
2144
2745
 
2145
- var keyframes = function
2146
- /*: Keyframes */
2147
- keyframes() {
2148
- var insertable = css$2.apply(void 0, arguments);
2149
- var name = "animation-" + insertable.name;
2150
- return {
2151
- name: name,
2152
- styles: "@keyframes " + name + "{" + insertable.styles + "}",
2153
- anim: 1,
2154
- toString: function toString() {
2155
- return "_EMO_" + this.name + "_" + this.styles + "_EMO_";
2746
+ var serializedNames = serialized.name;
2747
+ var serializedStyles = serialized.styles;
2748
+ var next = serialized.next;
2749
+
2750
+ while (next !== undefined) {
2751
+ serializedNames += ' ' + next.name;
2752
+ serializedStyles += next.styles;
2753
+ next = next.next;
2156
2754
  }
2157
- };
2158
- };
2159
2755
 
2160
- function _arrayWithHoles(r) {
2161
- if (Array.isArray(r)) return r;
2162
- }
2756
+ var shouldCache = cache.compat === true;
2757
+ var rules = cache.insert("", {
2758
+ name: serializedNames,
2759
+ styles: serializedStyles
2760
+ }, cache.sheet, shouldCache);
2163
2761
 
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
- }
2762
+ if (shouldCache) {
2763
+ return null;
2187
2764
  }
2188
- return a;
2189
- }
2190
- }
2191
2765
 
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
- }
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
2195
2773
 
2196
- function _slicedToArray(r, e) {
2197
- return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
2198
- }
2199
2774
 
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];
2206
- }
2207
- return t;
2208
- }
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
2209
2778
 
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
- }
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
2221
2786
 
2222
- function _taggedTemplateLiteral(e, t) {
2223
- return t || (t = e.slice(0)), Object.freeze(Object.defineProperties(e, {
2224
- raw: {
2225
- value: Object.freeze(t)
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];
2226
2791
  }
2227
- }));
2228
- }
2229
2792
 
2230
- /**
2231
- * Custom positioning reference element.
2232
- * @see https://floating-ui.com/docs/virtual-elements
2233
- */
2793
+ if (node !== null) {
2794
+ rehydrating = true; // clear the hash so this node won't be recognizable as rehydratable by other <Global/>s
2234
2795
 
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'
2251
- };
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));
2796
+ node.setAttribute('data-emotion', key);
2797
+ sheet.hydrate([node]);
2324
2798
  }
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
2338
- };
2339
- }
2340
- function getPaddingObject(padding) {
2341
- return typeof padding !== 'number' ? expandPaddingObject(padding) : {
2342
- top: padding,
2343
- right: padding,
2344
- bottom: padding,
2345
- left: padding
2346
- };
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
2364
- };
2365
- }
2366
2799
 
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 = {};
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
- };
2430
- }
2431
-
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
2800
+ sheetRef.current = [sheet, rehydrating];
2801
+ return function () {
2802
+ sheet.flush();
2510
2803
  };
2511
- }
2512
- });
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
+ }
2513
2814
 
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);
2815
+ if (serialized.next !== undefined) {
2816
+ // insert keyframes
2817
+ insertStyles(cache, serialized.next, true);
2519
2818
  }
2520
- return true;
2521
- });
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';
2522
2834
  }
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 = {};
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];
2532
2839
  }
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)));
2560
2840
 
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 {};
2841
+ return serializeStyles(args);
2842
+ }
2843
+
2844
+ var keyframes = function keyframes() {
2845
+ var insertable = css$2.apply(void 0, arguments);
2846
+ var name = "animation-" + insertable.name; // $FlowFixMe
2847
+
2848
+ return {
2849
+ name: name,
2850
+ styles: "@keyframes " + name + "{" + insertable.styles + "}",
2851
+ anim: 1,
2852
+ toString: function toString() {
2853
+ return "_EMO_" + this.name + "_" + this.styles + "_EMO_";
2613
2854
  }
2614
2855
  };
2615
2856
  };
2616
2857
 
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
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.');
2696
2879
  }
2697
- };
2698
- }
2699
2880
 
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;
2881
+ toAdd = '';
2703
2882
 
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;
2883
+ for (var k in arg) {
2884
+ if (arg[k] && k) {
2885
+ toAdd && (toAdd += ' ');
2886
+ toAdd += k;
2724
2887
  }
2725
- case 'initialPlacement':
2726
- resetPlacement = initialPlacement;
2727
- break;
2888
+ }
2728
2889
  }
2890
+
2891
+ break;
2729
2892
  }
2730
- if (placement !== resetPlacement) {
2731
- return {
2732
- reset: {
2733
- placement: resetPlacement
2734
- }
2735
- };
2893
+
2894
+ default:
2895
+ {
2896
+ toAdd = arg;
2736
2897
  }
2737
- }
2738
- return {};
2739
2898
  }
2740
- };
2899
+
2900
+ if (toAdd) {
2901
+ cls && (cls += ' ');
2902
+ cls += toAdd;
2903
+ }
2904
+ }
2905
+
2906
+ return cls;
2741
2907
  };
2742
2908
 
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
- };
2750
- }
2751
- function isAnySideFullyClipped(overflow) {
2752
- return sides.some(side => overflow[side] >= 0);
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 = {};
2909
+ function merge(registered, css, className) {
2910
+ var registeredStyles = [];
2911
+ var rawClassName = getRegisteredStyles(registered, registeredStyles, className);
2912
+
2913
+ if (registeredStyles.length < 2) {
2914
+ return className;
2762
2915
  }
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
- }
2916
+
2917
+ return rawClassName + css(registeredStyles);
2918
+ }
2919
+
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;
2807
2931
  }
2808
2932
  }
2809
- };
2810
- };
2811
2933
 
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
- };
2823
- }
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);
2934
+ if (!isBrowser$1) {
2935
+ return rules;
2834
2936
  }
2835
- prevRect = rect;
2836
- }
2837
- return groups.map(rect => rectToClientRect(getBoundingRect(rect)));
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 = {};
2937
+ });
2938
+
2939
+ if (!isBrowser$1 && rules.length !== 0) {
2940
+ var _ref2;
2941
+
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));
2847
2947
  }
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
- }
2877
2948
 
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 {};
2949
+ return null;
2950
+ };
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];
2939
2963
  }
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;
2940
2970
  };
2941
- };
2942
2971
 
2943
- // For type backwards-compatibility, the `OffsetOptions` type was also
2944
- // Derivable.
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
+ }
2945
2976
 
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
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));
2974
2982
  };
2975
- if (alignment && typeof alignmentAxis === 'number') {
2976
- crossAxis = alignment === 'end' ? alignmentAxis * -1 : alignmentAxis;
2977
- }
2978
- return isVertical ? {
2979
- x: crossAxis * crossAxisMulti,
2980
- y: mainAxis * mainAxisMulti
2981
- } : {
2982
- x: mainAxis * mainAxisMulti,
2983
- y: crossAxis * crossAxisMulti
2983
+
2984
+ var content = {
2985
+ css: css,
2986
+ cx: cx,
2987
+ theme: React__namespace.useContext(ThemeContext)
2984
2988
  };
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';
2985
2999
  }
2986
3000
 
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;
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
- };
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.');
3024
3015
  }
3025
- };
3026
- };
3027
3016
 
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 = {};
3017
+ globalContext[globalKey] = true;
3036
3018
  }
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
- };
3019
+ }
3020
+
3021
+ function _arrayWithHoles(arr) {
3022
+ if (Array.isArray(arr)) return arr;
3023
+ }
3024
+
3025
+ function _iterableToArrayLimit(arr, i) {
3026
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
3027
+
3028
+ if (_i == null) return;
3029
+ var _arr = [];
3030
+ var _n = true;
3031
+ var _d = false;
3032
+
3033
+ var _s, _e;
3034
+
3035
+ try {
3036
+ for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
3037
+ _arr.push(_s.value);
3038
+
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;
3098
3049
  }
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
3050
  }
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
- };
3051
+
3052
+ return _arr;
3053
+ }
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.");
3057
+ }
3058
+
3059
+ function _slicedToArray(arr, i) {
3060
+ return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
3061
+ }
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];
3073
+ }
3074
+
3075
+ return target;
3076
+ }
3077
+
3078
+ function _objectWithoutProperties(source, excluded) {
3079
+ if (source == null) return {};
3080
+ var target = _objectWithoutPropertiesLoose(source, excluded);
3081
+ var key, i;
3082
+
3083
+ if (Object.getOwnPropertySymbols) {
3084
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
3085
+
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];
3166
3091
  }
3167
- };
3168
- };
3092
+ }
3169
3093
 
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 = {};
3094
+ return target;
3095
+ }
3096
+
3097
+ function _taggedTemplateLiteral(strings, raw) {
3098
+ if (!raw) {
3099
+ raw = strings.slice(0);
3179
3100
  }
3180
- return {
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 {};
3101
+
3102
+ return Object.freeze(Object.defineProperties(strings, {
3103
+ raw: {
3104
+ value: Object.freeze(raw)
3248
3105
  }
3106
+ }));
3107
+ }
3108
+
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) {
3118
+ return {
3119
+ ...rect,
3120
+ top: rect.y,
3121
+ left: rect.x,
3122
+ right: rect.x + rect.width,
3123
+ bottom: rect.y + rect.height
3249
3124
  };
3250
- };
3125
+ }
3251
3126
 
3252
3127
  function getNodeName(node) {
3253
3128
  if (isNode(node)) {
@@ -3260,7 +3135,7 @@ function getNodeName(node) {
3260
3135
  }
3261
3136
  function getWindow(node) {
3262
3137
  var _node$ownerDocument;
3263
- return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
3138
+ return (node == null ? void 0 : (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
3264
3139
  }
3265
3140
  function getDocumentElement(node) {
3266
3141
  var _ref;
@@ -3444,9 +3319,8 @@ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetPar
3444
3319
  if (domElement) {
3445
3320
  const win = getWindow(domElement);
3446
3321
  const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
3447
- let currentWin = win;
3448
- let currentIFrame = currentWin.frameElement;
3449
- while (currentIFrame && offsetParent && offsetWin !== currentWin) {
3322
+ let currentIFrame = win.frameElement;
3323
+ while (currentIFrame && offsetParent && offsetWin !== win) {
3450
3324
  const iframeScale = getScale(currentIFrame);
3451
3325
  const iframeRect = currentIFrame.getBoundingClientRect();
3452
3326
  const css = getComputedStyle$1(currentIFrame);
@@ -3458,8 +3332,7 @@ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetPar
3458
3332
  height *= iframeScale.y;
3459
3333
  x += left;
3460
3334
  y += top;
3461
- currentWin = getWindow(currentIFrame);
3462
- currentIFrame = currentWin.frameElement;
3335
+ currentIFrame = getWindow(currentIFrame).frameElement;
3463
3336
  }
3464
3337
  }
3465
3338
  return rectToClientRect({
@@ -3476,9 +3349,8 @@ function observeMove(element, onMove) {
3476
3349
  let timeoutId;
3477
3350
  const root = getDocumentElement(element);
3478
3351
  function cleanup() {
3479
- var _io;
3480
3352
  clearTimeout(timeoutId);
3481
- (_io = io) == null || _io.disconnect();
3353
+ io && io.disconnect();
3482
3354
  io = null;
3483
3355
  }
3484
3356
  function refresh(skip, threshold) {
@@ -3518,11 +3390,9 @@ function observeMove(element, onMove) {
3518
3390
  return refresh();
3519
3391
  }
3520
3392
  if (!ratio) {
3521
- // If the reference is clipped, the ratio is 0. Throttle the refresh
3522
- // to prevent an infinite loop of updates.
3523
3393
  timeoutId = setTimeout(() => {
3524
3394
  refresh(false, 1e-7);
3525
- }, 1000);
3395
+ }, 100);
3526
3396
  } else {
3527
3397
  refresh(false, ratio);
3528
3398
  }
@@ -3586,8 +3456,7 @@ function autoUpdate(reference, floating, update, options) {
3586
3456
  resizeObserver.unobserve(floating);
3587
3457
  cancelAnimationFrame(reobserveFrame);
3588
3458
  reobserveFrame = requestAnimationFrame(() => {
3589
- var _resizeObserver;
3590
- (_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating);
3459
+ resizeObserver && resizeObserver.observe(floating);
3591
3460
  });
3592
3461
  }
3593
3462
  update();
@@ -3612,13 +3481,12 @@ function autoUpdate(reference, floating, update, options) {
3612
3481
  }
3613
3482
  update();
3614
3483
  return () => {
3615
- var _resizeObserver2;
3616
3484
  ancestors.forEach(ancestor => {
3617
3485
  ancestorScroll && ancestor.removeEventListener('scroll', update);
3618
3486
  ancestorResize && ancestor.removeEventListener('resize', update);
3619
3487
  });
3620
- cleanupIo == null || cleanupIo();
3621
- (_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect();
3488
+ cleanupIo && cleanupIo();
3489
+ resizeObserver && resizeObserver.disconnect();
3622
3490
  resizeObserver = null;
3623
3491
  if (animationFrame) {
3624
3492
  cancelAnimationFrame(frameId);
@@ -3626,72 +3494,6 @@ function autoUpdate(reference, floating, update, options) {
3626
3494
  };
3627
3495
  }
3628
3496
 
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
-
3695
3497
  var index = typeof document !== 'undefined' ? React.useLayoutEffect : React.useEffect;
3696
3498
 
3697
3499
  var _excluded$4 = ["className", "clearValue", "cx", "getStyles", "getClassNames", "getValue", "hasValue", "isMulti", "isRtl", "options", "selectOption", "selectProps", "setValue", "theme"];