UNPKG

182 kBJavaScriptView Raw
1'use strict';
2
3Object.defineProperty(exports, '__esModule', {
4 value: true
5});
6
7var React = require('react');
8
9var memoize$1 = require('memoizerific');
10
11var clientLogger = require('@storybook/client-logger');
12
13function _interopDefaultLegacy(e) {
14 return e && typeof e === 'object' && 'default' in e ? e : {
15 'default': e
16 };
17}
18
19function _interopNamespace(e) {
20 if (e && e.__esModule) return e;
21 var n = Object.create(null);
22
23 if (e) {
24 Object.keys(e).forEach(function (k) {
25 if (k !== 'default') {
26 var d = Object.getOwnPropertyDescriptor(e, k);
27 Object.defineProperty(n, k, d.get ? d : {
28 enumerable: true,
29 get: function () {
30 return e[k];
31 }
32 });
33 }
34 });
35 }
36
37 n["default"] = e;
38 return Object.freeze(n);
39}
40
41var React__namespace = /*#__PURE__*/_interopNamespace(React);
42
43var memoize__default = /*#__PURE__*/_interopDefaultLegacy(memoize$1);
44
45function _extends$1() {
46 _extends$1 = Object.assign || function (target) {
47 for (var i = 1; i < arguments.length; i++) {
48 var source = arguments[i];
49
50 for (var key in source) {
51 if (Object.prototype.hasOwnProperty.call(source, key)) {
52 target[key] = source[key];
53 }
54 }
55 }
56
57 return target;
58 };
59
60 return _extends$1.apply(this, arguments);
61}
62
63function memoize(fn) {
64 var cache = Object.create(null);
65 return function (arg) {
66 if (cache[arg] === undefined) cache[arg] = fn(arg);
67 return cache[arg];
68 };
69}
70
71var reactPropsRegex = /^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|download|draggable|encType|enterKeyHint|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/; // https://esbench.com/bench/5bfee68a4cd7e6009ef61d23
72
73var isPropValid = /* #__PURE__ */memoize(function (prop) {
74 return reactPropsRegex.test(prop) || prop.charCodeAt(0) === 111
75 /* o */
76 && prop.charCodeAt(1) === 110
77 /* n */
78 && prop.charCodeAt(2) < 91;
79}
80/* Z+1 */
81);
82/*
83
84Based off glamor's StyleSheet, thanks Sunil ❤️
85
86high performance StyleSheet for css-in-js systems
87
88- uses multiple style tags behind the scenes for millions of rules
89- uses `insertRule` for appending in production for *much* faster performance
90
91// usage
92
93import { StyleSheet } from '@emotion/sheet'
94
95let styleSheet = new StyleSheet({ key: '', container: document.head })
96
97styleSheet.insert('#box { border: 1px solid red; }')
98- appends a css rule into the stylesheet
99
100styleSheet.flush()
101- empties the stylesheet of all its contents
102
103*/
104// $FlowFixMe
105
106function sheetForTag$1(tag) {
107 if (tag.sheet) {
108 // $FlowFixMe
109 return tag.sheet;
110 } // this weirdness brought to you by firefox
111
112 /* istanbul ignore next */
113
114
115 for (var i = 0; i < document.styleSheets.length; i++) {
116 if (document.styleSheets[i].ownerNode === tag) {
117 // $FlowFixMe
118 return document.styleSheets[i];
119 }
120 }
121}
122
123function createStyleElement$1(options) {
124 var tag = document.createElement('style');
125 tag.setAttribute('data-emotion', options.key);
126
127 if (options.nonce !== undefined) {
128 tag.setAttribute('nonce', options.nonce);
129 }
130
131 tag.appendChild(document.createTextNode(''));
132 tag.setAttribute('data-s', '');
133 return tag;
134}
135
136var StyleSheet$1 = /*#__PURE__*/function () {
137 function StyleSheet(options) {
138 var _this = this;
139
140 this._insertTag = function (tag) {
141 var before;
142
143 if (_this.tags.length === 0) {
144 if (_this.insertionPoint) {
145 before = _this.insertionPoint.nextSibling;
146 } else if (_this.prepend) {
147 before = _this.container.firstChild;
148 } else {
149 before = _this.before;
150 }
151 } else {
152 before = _this.tags[_this.tags.length - 1].nextSibling;
153 }
154
155 _this.container.insertBefore(tag, before);
156
157 _this.tags.push(tag);
158 };
159
160 this.isSpeedy = options.speedy === undefined ? process.env.NODE_ENV === 'production' : options.speedy;
161 this.tags = [];
162 this.ctr = 0;
163 this.nonce = options.nonce; // key is the value of the data-emotion attribute, it's used to identify different sheets
164
165 this.key = options.key;
166 this.container = options.container;
167 this.prepend = options.prepend;
168 this.insertionPoint = options.insertionPoint;
169 this.before = null;
170 }
171
172 var _proto = StyleSheet.prototype;
173
174 _proto.hydrate = function hydrate(nodes) {
175 nodes.forEach(this._insertTag);
176 };
177
178 _proto.insert = function insert(rule) {
179 // the max length is how many rules we have per style tag, it's 65000 in speedy mode
180 // it's 1 in dev because we insert source maps that map a single rule to a location
181 // and you can only have one source map per style tag
182 if (this.ctr % (this.isSpeedy ? 65000 : 1) === 0) {
183 this._insertTag(createStyleElement$1(this));
184 }
185
186 var tag = this.tags[this.tags.length - 1];
187
188 if (process.env.NODE_ENV !== 'production') {
189 var isImportRule = rule.charCodeAt(0) === 64 && rule.charCodeAt(1) === 105;
190
191 if (isImportRule && this._alreadyInsertedOrderInsensitiveRule) {
192 // this would only cause problem in speedy mode
193 // but we don't want enabling speedy to affect the observable behavior
194 // so we report this error at all times
195 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.');
196 }
197
198 this._alreadyInsertedOrderInsensitiveRule = this._alreadyInsertedOrderInsensitiveRule || !isImportRule;
199 }
200
201 if (this.isSpeedy) {
202 var sheet = sheetForTag$1(tag);
203
204 try {
205 // this is the ultrafast version, works across browsers
206 // the big drawback is that the css won't be editable in devtools
207 sheet.insertRule(rule, sheet.cssRules.length);
208 } catch (e) {
209 if (process.env.NODE_ENV !== 'production' && !/:(-moz-placeholder|-moz-focus-inner|-moz-focusring|-ms-input-placeholder|-moz-read-write|-moz-read-only|-ms-clear){/.test(rule)) {
210 console.error("There was a problem inserting the following rule: \"" + rule + "\"", e);
211 }
212 }
213 } else {
214 tag.appendChild(document.createTextNode(rule));
215 }
216
217 this.ctr++;
218 };
219
220 _proto.flush = function flush() {
221 // $FlowFixMe
222 this.tags.forEach(function (tag) {
223 return tag.parentNode && tag.parentNode.removeChild(tag);
224 });
225 this.tags = [];
226 this.ctr = 0;
227
228 if (process.env.NODE_ENV !== 'production') {
229 this._alreadyInsertedOrderInsensitiveRule = false;
230 }
231 };
232
233 return StyleSheet;
234}();
235
236var MS = '-ms-';
237var MOZ = '-moz-';
238var WEBKIT = '-webkit-';
239var COMMENT = 'comm';
240var RULESET = 'rule';
241var DECLARATION = 'decl';
242var IMPORT = '@import';
243var KEYFRAMES = '@keyframes';
244/**
245 * @param {number}
246 * @return {number}
247 */
248
249var abs = Math.abs;
250/**
251 * @param {number}
252 * @return {string}
253 */
254
255var from = String.fromCharCode;
256/**
257 * @param {object}
258 * @return {object}
259 */
260
261var assign = Object.assign;
262/**
263 * @param {string} value
264 * @param {number} length
265 * @return {number}
266 */
267
268function hash(value, length) {
269 return (((length << 2 ^ charat(value, 0)) << 2 ^ charat(value, 1)) << 2 ^ charat(value, 2)) << 2 ^ charat(value, 3);
270}
271/**
272 * @param {string} value
273 * @return {string}
274 */
275
276
277function trim(value) {
278 return value.trim();
279}
280/**
281 * @param {string} value
282 * @param {RegExp} pattern
283 * @return {string?}
284 */
285
286
287function match(value, pattern) {
288 return (value = pattern.exec(value)) ? value[0] : value;
289}
290/**
291 * @param {string} value
292 * @param {(string|RegExp)} pattern
293 * @param {string} replacement
294 * @return {string}
295 */
296
297
298function replace(value, pattern, replacement) {
299 return value.replace(pattern, replacement);
300}
301/**
302 * @param {string} value
303 * @param {string} search
304 * @return {number}
305 */
306
307
308function indexof(value, search) {
309 return value.indexOf(search);
310}
311/**
312 * @param {string} value
313 * @param {number} index
314 * @return {number}
315 */
316
317
318function charat(value, index) {
319 return value.charCodeAt(index) | 0;
320}
321/**
322 * @param {string} value
323 * @param {number} begin
324 * @param {number} end
325 * @return {string}
326 */
327
328
329function substr(value, begin, end) {
330 return value.slice(begin, end);
331}
332/**
333 * @param {string} value
334 * @return {number}
335 */
336
337
338function strlen(value) {
339 return value.length;
340}
341/**
342 * @param {any[]} value
343 * @return {number}
344 */
345
346
347function sizeof(value) {
348 return value.length;
349}
350/**
351 * @param {any} value
352 * @param {any[]} array
353 * @return {any}
354 */
355
356
357function append(value, array) {
358 return array.push(value), value;
359}
360/**
361 * @param {string[]} array
362 * @param {function} callback
363 * @return {string}
364 */
365
366
367function combine(array, callback) {
368 return array.map(callback).join('');
369}
370
371var line = 1;
372var column = 1;
373var length = 0;
374var position = 0;
375var character = 0;
376var characters = '';
377/**
378 * @param {string} value
379 * @param {object | null} root
380 * @param {object | null} parent
381 * @param {string} type
382 * @param {string[] | string} props
383 * @param {object[] | string} children
384 * @param {number} length
385 */
386
387function node(value, root, parent, type, props, children, length) {
388 return {
389 value: value,
390 root: root,
391 parent: parent,
392 type: type,
393 props: props,
394 children: children,
395 line: line,
396 column: column,
397 length: length,
398 return: ''
399 };
400}
401/**
402 * @param {object} root
403 * @param {object} props
404 * @return {object}
405 */
406
407
408function copy(root, props) {
409 return assign(node('', null, null, '', null, null, 0), root, {
410 length: -root.length
411 }, props);
412}
413/**
414 * @return {number}
415 */
416
417
418function char() {
419 return character;
420}
421/**
422 * @return {number}
423 */
424
425
426function prev() {
427 character = position > 0 ? charat(characters, --position) : 0;
428 if (column--, character === 10) column = 1, line--;
429 return character;
430}
431/**
432 * @return {number}
433 */
434
435
436function next() {
437 character = position < length ? charat(characters, position++) : 0;
438 if (column++, character === 10) column = 1, line++;
439 return character;
440}
441/**
442 * @return {number}
443 */
444
445
446function peek() {
447 return charat(characters, position);
448}
449/**
450 * @return {number}
451 */
452
453
454function caret() {
455 return position;
456}
457/**
458 * @param {number} begin
459 * @param {number} end
460 * @return {string}
461 */
462
463
464function slice(begin, end) {
465 return substr(characters, begin, end);
466}
467/**
468 * @param {number} type
469 * @return {number}
470 */
471
472
473function token(type) {
474 switch (type) {
475 // \0 \t \n \r \s whitespace token
476 case 0:
477 case 9:
478 case 10:
479 case 13:
480 case 32:
481 return 5;
482 // ! + , / > @ ~ isolate token
483
484 case 33:
485 case 43:
486 case 44:
487 case 47:
488 case 62:
489 case 64:
490 case 126: // ; { } breakpoint token
491
492 case 59:
493 case 123:
494 case 125:
495 return 4;
496 // : accompanied token
497
498 case 58:
499 return 3;
500 // " ' ( [ opening delimit token
501
502 case 34:
503 case 39:
504 case 40:
505 case 91:
506 return 2;
507 // ) ] closing delimit token
508
509 case 41:
510 case 93:
511 return 1;
512 }
513
514 return 0;
515}
516/**
517 * @param {string} value
518 * @return {any[]}
519 */
520
521
522function alloc(value) {
523 return line = column = 1, length = strlen(characters = value), position = 0, [];
524}
525/**
526 * @param {any} value
527 * @return {any}
528 */
529
530
531function dealloc(value) {
532 return characters = '', value;
533}
534/**
535 * @param {number} type
536 * @return {string}
537 */
538
539
540function delimit(type) {
541 return trim(slice(position - 1, delimiter(type === 91 ? type + 2 : type === 40 ? type + 1 : type)));
542}
543/**
544 * @param {number} type
545 * @return {string}
546 */
547
548
549function whitespace(type) {
550 while (character = peek()) if (character < 33) next();else break;
551
552 return token(type) > 2 || token(character) > 3 ? '' : ' ';
553}
554/**
555 * @param {number} index
556 * @param {number} count
557 * @return {string}
558 */
559
560
561function escaping(index, count) {
562 while (--count && next()) // not 0-9 A-F a-f
563 if (character < 48 || character > 102 || character > 57 && character < 65 || character > 70 && character < 97) break;
564
565 return slice(index, caret() + (count < 6 && peek() == 32 && next() == 32));
566}
567/**
568 * @param {number} type
569 * @return {number}
570 */
571
572
573function delimiter(type) {
574 while (next()) switch (character) {
575 // ] ) " '
576 case type:
577 return position;
578 // " '
579
580 case 34:
581 case 39:
582 if (type !== 34 && type !== 39) delimiter(character);
583 break;
584 // (
585
586 case 40:
587 if (type === 41) delimiter(type);
588 break;
589 // \
590
591 case 92:
592 next();
593 break;
594 }
595
596 return position;
597}
598/**
599 * @param {number} type
600 * @param {number} index
601 * @return {number}
602 */
603
604
605function commenter(type, index) {
606 while (next()) // //
607 if (type + character === 47 + 10) break; // /*
608 else if (type + character === 42 + 42 && peek() === 47) break;
609
610 return '/*' + slice(index, position - 1) + '*' + from(type === 47 ? type : next());
611}
612/**
613 * @param {number} index
614 * @return {string}
615 */
616
617
618function identifier(index) {
619 while (!token(peek())) next();
620
621 return slice(index, position);
622}
623/**
624 * @param {string} value
625 * @return {object[]}
626 */
627
628
629function compile(value) {
630 return dealloc(parse('', null, null, null, [''], value = alloc(value), 0, [0], value));
631}
632/**
633 * @param {string} value
634 * @param {object} root
635 * @param {object?} parent
636 * @param {string[]} rule
637 * @param {string[]} rules
638 * @param {string[]} rulesets
639 * @param {number[]} pseudo
640 * @param {number[]} points
641 * @param {string[]} declarations
642 * @return {object}
643 */
644
645
646function parse(value, root, parent, rule, rules, rulesets, pseudo, points, declarations) {
647 var index = 0;
648 var offset = 0;
649 var length = pseudo;
650 var atrule = 0;
651 var property = 0;
652 var previous = 0;
653 var variable = 1;
654 var scanning = 1;
655 var ampersand = 1;
656 var character = 0;
657 var type = '';
658 var props = rules;
659 var children = rulesets;
660 var reference = rule;
661 var characters = type;
662
663 while (scanning) switch (previous = character, character = next()) {
664 // (
665 case 40:
666 if (previous != 108 && characters.charCodeAt(length - 1) == 58) {
667 if (indexof(characters += replace(delimit(character), '&', '&\f'), '&\f') != -1) ampersand = -1;
668 break;
669 }
670
671 // " ' [
672
673 case 34:
674 case 39:
675 case 91:
676 characters += delimit(character);
677 break;
678 // \t \n \r \s
679
680 case 9:
681 case 10:
682 case 13:
683 case 32:
684 characters += whitespace(previous);
685 break;
686 // \
687
688 case 92:
689 characters += escaping(caret() - 1, 7);
690 continue;
691 // /
692
693 case 47:
694 switch (peek()) {
695 case 42:
696 case 47:
697 append(comment(commenter(next(), caret()), root, parent), declarations);
698 break;
699
700 default:
701 characters += '/';
702 }
703
704 break;
705 // {
706
707 case 123 * variable:
708 points[index++] = strlen(characters) * ampersand;
709 // } ; \0
710
711 case 125 * variable:
712 case 59:
713 case 0:
714 switch (character) {
715 // \0 }
716 case 0:
717 case 125:
718 scanning = 0;
719 // ;
720
721 case 59 + offset:
722 if (property > 0 && strlen(characters) - length) append(property > 32 ? declaration(characters + ';', rule, parent, length - 1) : declaration(replace(characters, ' ', '') + ';', rule, parent, length - 2), declarations);
723 break;
724 // @ ;
725
726 case 59:
727 characters += ';';
728 // { rule/at-rule
729
730 default:
731 append(reference = ruleset(characters, root, parent, index, offset, rules, points, type, props = [], children = [], length), rulesets);
732 if (character === 123) if (offset === 0) parse(characters, root, reference, reference, props, rulesets, length, points, children);else switch (atrule) {
733 // d m s
734 case 100:
735 case 109:
736 case 115:
737 parse(value, reference, reference, rule && append(ruleset(value, reference, reference, 0, 0, rules, points, type, rules, props = [], length), children), rules, children, length, points, rule ? props : children);
738 break;
739
740 default:
741 parse(characters, reference, reference, reference, [''], children, 0, points, children);
742 }
743 }
744
745 index = offset = property = 0, variable = ampersand = 1, type = characters = '', length = pseudo;
746 break;
747 // :
748
749 case 58:
750 length = 1 + strlen(characters), property = previous;
751
752 default:
753 if (variable < 1) if (character == 123) --variable;else if (character == 125 && variable++ == 0 && prev() == 125) continue;
754
755 switch (characters += from(character), character * variable) {
756 // &
757 case 38:
758 ampersand = offset > 0 ? 1 : (characters += '\f', -1);
759 break;
760 // ,
761
762 case 44:
763 points[index++] = (strlen(characters) - 1) * ampersand, ampersand = 1;
764 break;
765 // @
766
767 case 64:
768 // -
769 if (peek() === 45) characters += delimit(next());
770 atrule = peek(), offset = length = strlen(type = characters += identifier(caret())), character++;
771 break;
772 // -
773
774 case 45:
775 if (previous === 45 && strlen(characters) == 2) variable = 0;
776 }
777
778 }
779
780 return rulesets;
781}
782/**
783 * @param {string} value
784 * @param {object} root
785 * @param {object?} parent
786 * @param {number} index
787 * @param {number} offset
788 * @param {string[]} rules
789 * @param {number[]} points
790 * @param {string} type
791 * @param {string[]} props
792 * @param {string[]} children
793 * @param {number} length
794 * @return {object}
795 */
796
797
798function ruleset(value, root, parent, index, offset, rules, points, type, props, children, length) {
799 var post = offset - 1;
800 var rule = offset === 0 ? rules : [''];
801 var size = sizeof(rule);
802
803 for (var i = 0, j = 0, k = 0; i < index; ++i) for (var x = 0, y = substr(value, post + 1, post = abs(j = points[i])), z = value; x < size; ++x) if (z = trim(j > 0 ? rule[x] + ' ' + y : replace(y, /&\f/g, rule[x]))) props[k++] = z;
804
805 return node(value, root, parent, offset === 0 ? RULESET : type, props, children, length);
806}
807/**
808 * @param {number} value
809 * @param {object} root
810 * @param {object?} parent
811 * @return {object}
812 */
813
814
815function comment(value, root, parent) {
816 return node(value, root, parent, COMMENT, from(char()), substr(value, 2, -2), 0);
817}
818/**
819 * @param {string} value
820 * @param {object} root
821 * @param {object?} parent
822 * @param {number} length
823 * @return {object}
824 */
825
826
827function declaration(value, root, parent, length) {
828 return node(value, root, parent, DECLARATION, substr(value, 0, length), substr(value, length + 1, -1), length);
829}
830/**
831 * @param {string} value
832 * @param {number} length
833 * @return {string}
834 */
835
836
837function prefix(value, length) {
838 switch (hash(value, length)) {
839 // color-adjust
840 case 5103:
841 return WEBKIT + 'print-' + value + value;
842 // animation, animation-(delay|direction|duration|fill-mode|iteration-count|name|play-state|timing-function)
843
844 case 5737:
845 case 4201:
846 case 3177:
847 case 3433:
848 case 1641:
849 case 4457:
850 case 2921: // text-decoration, filter, clip-path, backface-visibility, column, box-decoration-break
851
852 case 5572:
853 case 6356:
854 case 5844:
855 case 3191:
856 case 6645:
857 case 3005: // mask, mask-image, mask-(mode|clip|size), mask-(repeat|origin), mask-position, mask-composite,
858
859 case 6391:
860 case 5879:
861 case 5623:
862 case 6135:
863 case 4599:
864 case 4855: // background-clip, columns, column-(count|fill|gap|rule|rule-color|rule-style|rule-width|span|width)
865
866 case 4215:
867 case 6389:
868 case 5109:
869 case 5365:
870 case 5621:
871 case 3829:
872 return WEBKIT + value + value;
873 // appearance, user-select, transform, hyphens, text-size-adjust
874
875 case 5349:
876 case 4246:
877 case 4810:
878 case 6968:
879 case 2756:
880 return WEBKIT + value + MOZ + value + MS + value + value;
881 // flex, flex-direction
882
883 case 6828:
884 case 4268:
885 return WEBKIT + value + MS + value + value;
886 // order
887
888 case 6165:
889 return WEBKIT + value + MS + 'flex-' + value + value;
890 // align-items
891
892 case 5187:
893 return WEBKIT + value + replace(value, /(\w+).+(:[^]+)/, WEBKIT + 'box-$1$2' + MS + 'flex-$1$2') + value;
894 // align-self
895
896 case 5443:
897 return WEBKIT + value + MS + 'flex-item-' + replace(value, /flex-|-self/, '') + value;
898 // align-content
899
900 case 4675:
901 return WEBKIT + value + MS + 'flex-line-pack' + replace(value, /align-content|flex-|-self/, '') + value;
902 // flex-shrink
903
904 case 5548:
905 return WEBKIT + value + MS + replace(value, 'shrink', 'negative') + value;
906 // flex-basis
907
908 case 5292:
909 return WEBKIT + value + MS + replace(value, 'basis', 'preferred-size') + value;
910 // flex-grow
911
912 case 6060:
913 return WEBKIT + 'box-' + replace(value, '-grow', '') + WEBKIT + value + MS + replace(value, 'grow', 'positive') + value;
914 // transition
915
916 case 4554:
917 return WEBKIT + replace(value, /([^-])(transform)/g, '$1' + WEBKIT + '$2') + value;
918 // cursor
919
920 case 6187:
921 return replace(replace(replace(value, /(zoom-|grab)/, WEBKIT + '$1'), /(image-set)/, WEBKIT + '$1'), value, '') + value;
922 // background, background-image
923
924 case 5495:
925 case 3959:
926 return replace(value, /(image-set\([^]*)/, WEBKIT + '$1' + '$`$1');
927 // justify-content
928
929 case 4968:
930 return replace(replace(value, /(.+:)(flex-)?(.*)/, WEBKIT + 'box-pack:$3' + MS + 'flex-pack:$3'), /s.+-b[^;]+/, 'justify') + WEBKIT + value + value;
931 // (margin|padding)-inline-(start|end)
932
933 case 4095:
934 case 3583:
935 case 4068:
936 case 2532:
937 return replace(value, /(.+)-inline(.+)/, WEBKIT + '$1$2') + value;
938 // (min|max)?(width|height|inline-size|block-size)
939
940 case 8116:
941 case 7059:
942 case 5753:
943 case 5535:
944 case 5445:
945 case 5701:
946 case 4933:
947 case 4677:
948 case 5533:
949 case 5789:
950 case 5021:
951 case 4765:
952 // stretch, max-content, min-content, fill-available
953 if (strlen(value) - 1 - length > 6) switch (charat(value, length + 1)) {
954 // (m)ax-content, (m)in-content
955 case 109:
956 // -
957 if (charat(value, length + 4) !== 45) break;
958 // (f)ill-available, (f)it-content
959
960 case 102:
961 return replace(value, /(.+:)(.+)-([^]+)/, '$1' + WEBKIT + '$2-$3' + '$1' + MOZ + (charat(value, length + 3) == 108 ? '$3' : '$2-$3')) + value;
962 // (s)tretch
963
964 case 115:
965 return ~indexof(value, 'stretch') ? prefix(replace(value, 'stretch', 'fill-available'), length) + value : value;
966 }
967 break;
968 // position: sticky
969
970 case 4949:
971 // (s)ticky?
972 if (charat(value, length + 1) !== 115) break;
973 // display: (flex|inline-flex)
974
975 case 6444:
976 switch (charat(value, strlen(value) - 3 - (~indexof(value, '!important') && 10))) {
977 // stic(k)y
978 case 107:
979 return replace(value, ':', ':' + WEBKIT) + value;
980 // (inline-)?fl(e)x
981
982 case 101:
983 return replace(value, /(.+:)([^;!]+)(;|!.+)?/, '$1' + WEBKIT + (charat(value, 14) === 45 ? 'inline-' : '') + 'box$3' + '$1' + WEBKIT + '$2$3' + '$1' + MS + '$2box$3') + value;
984 }
985
986 break;
987 // writing-mode
988
989 case 5936:
990 switch (charat(value, length + 11)) {
991 // vertical-l(r)
992 case 114:
993 return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, 'tb') + value;
994 // vertical-r(l)
995
996 case 108:
997 return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, 'tb-rl') + value;
998 // horizontal(-)tb
999
1000 case 45:
1001 return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, 'lr') + value;
1002 }
1003
1004 return WEBKIT + value + MS + value + value;
1005 }
1006
1007 return value;
1008}
1009/**
1010 * @param {object[]} children
1011 * @param {function} callback
1012 * @return {string}
1013 */
1014
1015
1016function serialize(children, callback) {
1017 var output = '';
1018 var length = sizeof(children);
1019
1020 for (var i = 0; i < length; i++) output += callback(children[i], i, children, callback) || '';
1021
1022 return output;
1023}
1024/**
1025 * @param {object} element
1026 * @param {number} index
1027 * @param {object[]} children
1028 * @param {function} callback
1029 * @return {string}
1030 */
1031
1032
1033function stringify(element, index, children, callback) {
1034 switch (element.type) {
1035 case IMPORT:
1036 case DECLARATION:
1037 return element.return = element.return || element.value;
1038
1039 case COMMENT:
1040 return '';
1041
1042 case KEYFRAMES:
1043 return element.return = element.value + '{' + serialize(element.children, callback) + '}';
1044
1045 case RULESET:
1046 element.value = element.props.join(',');
1047 }
1048
1049 return strlen(children = serialize(element.children, callback)) ? element.return = element.value + '{' + children + '}' : '';
1050}
1051/**
1052 * @param {function[]} collection
1053 * @return {function}
1054 */
1055
1056
1057function middleware(collection) {
1058 var length = sizeof(collection);
1059 return function (element, index, children, callback) {
1060 var output = '';
1061
1062 for (var i = 0; i < length; i++) output += collection[i](element, index, children, callback) || '';
1063
1064 return output;
1065 };
1066}
1067/**
1068 * @param {function} callback
1069 * @return {function}
1070 */
1071
1072
1073function rulesheet(callback) {
1074 return function (element) {
1075 if (!element.root) if (element = element.return) callback(element);
1076 };
1077}
1078/**
1079 * @param {object} element
1080 * @param {number} index
1081 * @param {object[]} children
1082 * @param {function} callback
1083 */
1084
1085
1086function prefixer(element, index, children, callback) {
1087 if (element.length > -1) if (!element.return) switch (element.type) {
1088 case DECLARATION:
1089 element.return = prefix(element.value, element.length);
1090 break;
1091
1092 case KEYFRAMES:
1093 return serialize([copy(element, {
1094 value: replace(element.value, '@', '@' + WEBKIT)
1095 })], callback);
1096
1097 case RULESET:
1098 if (element.length) return combine(element.props, function (value) {
1099 switch (match(value, /(::plac\w+|:read-\w+)/)) {
1100 // :read-(only|write)
1101 case ':read-only':
1102 case ':read-write':
1103 return serialize([copy(element, {
1104 props: [replace(value, /:(read-\w+)/, ':' + MOZ + '$1')]
1105 })], callback);
1106 // :placeholder
1107
1108 case '::placeholder':
1109 return serialize([copy(element, {
1110 props: [replace(value, /:(plac\w+)/, ':' + WEBKIT + 'input-$1')]
1111 }), copy(element, {
1112 props: [replace(value, /:(plac\w+)/, ':' + MOZ + '$1')]
1113 }), copy(element, {
1114 props: [replace(value, /:(plac\w+)/, MS + 'input-$1')]
1115 })], callback);
1116 }
1117
1118 return '';
1119 });
1120 }
1121}
1122
1123var weakMemoize = function weakMemoize(func) {
1124 // $FlowFixMe flow doesn't include all non-primitive types as allowed for weakmaps
1125 var cache = new WeakMap();
1126 return function (arg) {
1127 if (cache.has(arg)) {
1128 // $FlowFixMe
1129 return cache.get(arg);
1130 }
1131
1132 var ret = func(arg);
1133 cache.set(arg, ret);
1134 return ret;
1135 };
1136};
1137
1138var last = function last(arr) {
1139 return arr.length ? arr[arr.length - 1] : null;
1140}; // based on https://github.com/thysultan/stylis.js/blob/e6843c373ebcbbfade25ebcc23f540ed8508da0a/src/Tokenizer.js#L239-L244
1141
1142
1143var identifierWithPointTracking = function identifierWithPointTracking(begin, points, index) {
1144 var previous = 0;
1145 var character = 0;
1146
1147 while (true) {
1148 previous = character;
1149 character = peek(); // &\f
1150
1151 if (previous === 38 && character === 12) {
1152 points[index] = 1;
1153 }
1154
1155 if (token(character)) {
1156 break;
1157 }
1158
1159 next();
1160 }
1161
1162 return slice(begin, position);
1163};
1164
1165var toRules = function toRules(parsed, points) {
1166 // pretend we've started with a comma
1167 var index = -1;
1168 var character = 44;
1169
1170 do {
1171 switch (token(character)) {
1172 case 0:
1173 // &\f
1174 if (character === 38 && peek() === 12) {
1175 // this is not 100% correct, we don't account for literal sequences here - like for example quoted strings
1176 // stylis inserts \f after & to know when & where it should replace this sequence with the context selector
1177 // and when it should just concatenate the outer and inner selectors
1178 // it's very unlikely for this sequence to actually appear in a different context, so we just leverage this fact here
1179 points[index] = 1;
1180 }
1181
1182 parsed[index] += identifierWithPointTracking(position - 1, points, index);
1183 break;
1184
1185 case 2:
1186 parsed[index] += delimit(character);
1187 break;
1188
1189 case 4:
1190 // comma
1191 if (character === 44) {
1192 // colon
1193 parsed[++index] = peek() === 58 ? '&\f' : '';
1194 points[index] = parsed[index].length;
1195 break;
1196 }
1197
1198 // fallthrough
1199
1200 default:
1201 parsed[index] += from(character);
1202 }
1203 } while (character = next());
1204
1205 return parsed;
1206};
1207
1208var getRules = function getRules(value, points) {
1209 return dealloc(toRules(alloc(value), points));
1210}; // WeakSet would be more appropriate, but only WeakMap is supported in IE11
1211
1212
1213var fixedElements = /* #__PURE__ */new WeakMap();
1214
1215var compat = function compat(element) {
1216 if (element.type !== 'rule' || !element.parent || // positive .length indicates that this rule contains pseudo
1217 // negative .length indicates that this rule has been already prefixed
1218 element.length < 1) {
1219 return;
1220 }
1221
1222 var value = element.value,
1223 parent = element.parent;
1224 var isImplicitRule = element.column === parent.column && element.line === parent.line;
1225
1226 while (parent.type !== 'rule') {
1227 parent = parent.parent;
1228 if (!parent) return;
1229 } // short-circuit for the simplest case
1230
1231
1232 if (element.props.length === 1 && value.charCodeAt(0) !== 58
1233 /* colon */
1234 && !fixedElements.get(parent)) {
1235 return;
1236 } // if this is an implicitly inserted rule (the one eagerly inserted at the each new nested level)
1237 // then the props has already been manipulated beforehand as they that array is shared between it and its "rule parent"
1238
1239
1240 if (isImplicitRule) {
1241 return;
1242 }
1243
1244 fixedElements.set(element, true);
1245 var points = [];
1246 var rules = getRules(value, points);
1247 var parentRules = parent.props;
1248
1249 for (var i = 0, k = 0; i < rules.length; i++) {
1250 for (var j = 0; j < parentRules.length; j++, k++) {
1251 element.props[k] = points[i] ? rules[i].replace(/&\f/g, parentRules[j]) : parentRules[j] + " " + rules[i];
1252 }
1253 }
1254};
1255
1256var removeLabel = function removeLabel(element) {
1257 if (element.type === 'decl') {
1258 var value = element.value;
1259
1260 if ( // charcode for l
1261 value.charCodeAt(0) === 108 && // charcode for b
1262 value.charCodeAt(2) === 98) {
1263 // this ignores label
1264 element["return"] = '';
1265 element.value = '';
1266 }
1267 }
1268};
1269
1270var ignoreFlag = 'emotion-disable-server-rendering-unsafe-selector-warning-please-do-not-use-this-the-warning-exists-for-a-reason';
1271
1272var isIgnoringComment = function isIgnoringComment(element) {
1273 return !!element && element.type === 'comm' && element.children.indexOf(ignoreFlag) > -1;
1274};
1275
1276var createUnsafeSelectorsAlarm = function createUnsafeSelectorsAlarm(cache) {
1277 return function (element, index, children) {
1278 if (element.type !== 'rule') return;
1279 var unsafePseudoClasses = element.value.match(/(:first|:nth|:nth-last)-child/g);
1280
1281 if (unsafePseudoClasses && cache.compat !== true) {
1282 var prevElement = index > 0 ? children[index - 1] : null;
1283
1284 if (prevElement && isIgnoringComment(last(prevElement.children))) {
1285 return;
1286 }
1287
1288 unsafePseudoClasses.forEach(function (unsafePseudoClass) {
1289 console.error("The pseudo class \"" + unsafePseudoClass + "\" is potentially unsafe when doing server-side rendering. Try changing it to \"" + unsafePseudoClass.split('-child')[0] + "-of-type\".");
1290 });
1291 }
1292 };
1293};
1294
1295var isImportRule = function isImportRule(element) {
1296 return element.type.charCodeAt(1) === 105 && element.type.charCodeAt(0) === 64;
1297};
1298
1299var isPrependedWithRegularRules = function isPrependedWithRegularRules(index, children) {
1300 for (var i = index - 1; i >= 0; i--) {
1301 if (!isImportRule(children[i])) {
1302 return true;
1303 }
1304 }
1305
1306 return false;
1307}; // use this to remove incorrect elements from further processing
1308// so they don't get handed to the `sheet` (or anything else)
1309// as that could potentially lead to additional logs which in turn could be overhelming to the user
1310
1311
1312var nullifyElement = function nullifyElement(element) {
1313 element.type = '';
1314 element.value = '';
1315 element["return"] = '';
1316 element.children = '';
1317 element.props = '';
1318};
1319
1320var incorrectImportAlarm = function incorrectImportAlarm(element, index, children) {
1321 if (!isImportRule(element)) {
1322 return;
1323 }
1324
1325 if (element.parent) {
1326 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.");
1327 nullifyElement(element);
1328 } else if (isPrependedWithRegularRules(index, children)) {
1329 console.error("`@import` rules can't be after other rules. Please put your `@import` rules before your other rules.");
1330 nullifyElement(element);
1331 }
1332};
1333
1334var isBrowser$6 = typeof document !== 'undefined';
1335var getServerStylisCache = isBrowser$6 ? undefined : weakMemoize(function () {
1336 return memoize(function () {
1337 var cache = {};
1338 return function (name) {
1339 return cache[name];
1340 };
1341 });
1342});
1343var defaultStylisPlugins = [prefixer];
1344
1345var createCache = function createCache(options) {
1346 var key = options.key;
1347
1348 if (process.env.NODE_ENV !== 'production' && !key) {
1349 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.");
1350 }
1351
1352 if (isBrowser$6 && key === 'css') {
1353 var ssrStyles = document.querySelectorAll("style[data-emotion]:not([data-s])"); // get SSRed styles out of the way of React's hydration
1354 // document.head is a safe place to move them to(though note document.head is not necessarily the last place they will be)
1355 // note this very very intentionally targets all style elements regardless of the key to ensure
1356 // that creating a cache works inside of render of a React component
1357
1358 Array.prototype.forEach.call(ssrStyles, function (node) {
1359 // we want to only move elements which have a space in the data-emotion attribute value
1360 // because that indicates that it is an Emotion 11 server-side rendered style elements
1361 // while we will already ignore Emotion 11 client-side inserted styles because of the :not([data-s]) part in the selector
1362 // Emotion 10 client-side inserted styles did not have data-s (but importantly did not have a space in their data-emotion attributes)
1363 // so checking for the space ensures that loading Emotion 11 after Emotion 10 has inserted some styles
1364 // will not result in the Emotion 10 styles being destroyed
1365 var dataEmotionAttribute = node.getAttribute('data-emotion');
1366
1367 if (dataEmotionAttribute.indexOf(' ') === -1) {
1368 return;
1369 }
1370
1371 document.head.appendChild(node);
1372 node.setAttribute('data-s', '');
1373 });
1374 }
1375
1376 var stylisPlugins = options.stylisPlugins || defaultStylisPlugins;
1377
1378 if (process.env.NODE_ENV !== 'production') {
1379 // $FlowFixMe
1380 if (/[^a-z-]/.test(key)) {
1381 throw new Error("Emotion key must only contain lower case alphabetical characters and - but \"" + key + "\" was passed");
1382 }
1383 }
1384
1385 var inserted = {}; // $FlowFixMe
1386
1387 var container;
1388 var nodesToHydrate = [];
1389
1390 if (isBrowser$6) {
1391 container = options.container || document.head;
1392 Array.prototype.forEach.call( // this means we will ignore elements which don't have a space in them which
1393 // means that the style elements we're looking at are only Emotion 11 server-rendered style elements
1394 document.querySelectorAll("style[data-emotion^=\"" + key + " \"]"), function (node) {
1395 var attrib = node.getAttribute("data-emotion").split(' '); // $FlowFixMe
1396
1397 for (var i = 1; i < attrib.length; i++) {
1398 inserted[attrib[i]] = true;
1399 }
1400
1401 nodesToHydrate.push(node);
1402 });
1403 }
1404
1405 var _insert;
1406
1407 var omnipresentPlugins = [compat, removeLabel];
1408
1409 if (process.env.NODE_ENV !== 'production') {
1410 omnipresentPlugins.push(createUnsafeSelectorsAlarm({
1411 get compat() {
1412 return cache.compat;
1413 }
1414
1415 }), incorrectImportAlarm);
1416 }
1417
1418 if (isBrowser$6) {
1419 var currentSheet;
1420 var finalizingPlugins = [stringify, process.env.NODE_ENV !== 'production' ? function (element) {
1421 if (!element.root) {
1422 if (element["return"]) {
1423 currentSheet.insert(element["return"]);
1424 } else if (element.value && element.type !== COMMENT) {
1425 // insert empty rule in non-production environments
1426 // so @emotion/jest can grab `key` from the (JS)DOM for caches without any rules inserted yet
1427 currentSheet.insert(element.value + "{}");
1428 }
1429 }
1430 } : rulesheet(function (rule) {
1431 currentSheet.insert(rule);
1432 })];
1433 var serializer = middleware(omnipresentPlugins.concat(stylisPlugins, finalizingPlugins));
1434
1435 var stylis = function stylis(styles) {
1436 return serialize(compile(styles), serializer);
1437 };
1438
1439 _insert = function insert(selector, serialized, sheet, shouldCache) {
1440 currentSheet = sheet;
1441
1442 if (process.env.NODE_ENV !== 'production' && serialized.map !== undefined) {
1443 currentSheet = {
1444 insert: function insert(rule) {
1445 sheet.insert(rule + serialized.map);
1446 }
1447 };
1448 }
1449
1450 stylis(selector ? selector + "{" + serialized.styles + "}" : serialized.styles);
1451
1452 if (shouldCache) {
1453 cache.inserted[serialized.name] = true;
1454 }
1455 };
1456 } else {
1457 var _finalizingPlugins = [stringify];
1458
1459 var _serializer = middleware(omnipresentPlugins.concat(stylisPlugins, _finalizingPlugins));
1460
1461 var _stylis = function _stylis(styles) {
1462 return serialize(compile(styles), _serializer);
1463 }; // $FlowFixMe
1464
1465
1466 var serverStylisCache = getServerStylisCache(stylisPlugins)(key);
1467
1468 var getRules = function getRules(selector, serialized) {
1469 var name = serialized.name;
1470
1471 if (serverStylisCache[name] === undefined) {
1472 serverStylisCache[name] = _stylis(selector ? selector + "{" + serialized.styles + "}" : serialized.styles);
1473 }
1474
1475 return serverStylisCache[name];
1476 };
1477
1478 _insert = function _insert(selector, serialized, sheet, shouldCache) {
1479 var name = serialized.name;
1480 var rules = getRules(selector, serialized);
1481
1482 if (cache.compat === undefined) {
1483 // in regular mode, we don't set the styles on the inserted cache
1484 // since we don't need to and that would be wasting memory
1485 // we return them so that they are rendered in a style tag
1486 if (shouldCache) {
1487 cache.inserted[name] = true;
1488 }
1489
1490 if ( // using === development instead of !== production
1491 // because if people do ssr in tests, the source maps showing up would be annoying
1492 process.env.NODE_ENV === 'development' && serialized.map !== undefined) {
1493 return rules + serialized.map;
1494 }
1495
1496 return rules;
1497 } else {
1498 // in compat mode, we put the styles on the inserted cache so
1499 // that emotion-server can pull out the styles
1500 // except when we don't want to cache it which was in Global but now
1501 // is nowhere but we don't want to do a major right now
1502 // and just in case we're going to leave the case here
1503 // it's also not affecting client side bundle size
1504 // so it's really not a big deal
1505 if (shouldCache) {
1506 cache.inserted[name] = rules;
1507 } else {
1508 return rules;
1509 }
1510 }
1511 };
1512 }
1513
1514 var cache = {
1515 key: key,
1516 sheet: new StyleSheet$1({
1517 key: key,
1518 container: container,
1519 nonce: options.nonce,
1520 speedy: options.speedy,
1521 prepend: options.prepend,
1522 insertionPoint: options.insertionPoint
1523 }),
1524 nonce: options.nonce,
1525 inserted: inserted,
1526 registered: {},
1527 insert: _insert
1528 };
1529 cache.sheet.hydrate(nodesToHydrate);
1530 return cache;
1531};
1532
1533var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
1534var reactIs$1 = {
1535 exports: {}
1536};
1537var reactIs_production_min = {};
1538/** @license React v16.13.1
1539 * react-is.production.min.js
1540 *
1541 * Copyright (c) Facebook, Inc. and its affiliates.
1542 *
1543 * This source code is licensed under the MIT license found in the
1544 * LICENSE file in the root directory of this source tree.
1545 */
1546
1547var b = "function" === typeof Symbol && Symbol.for,
1548 c = b ? Symbol.for("react.element") : 60103,
1549 d = b ? Symbol.for("react.portal") : 60106,
1550 e = b ? Symbol.for("react.fragment") : 60107,
1551 f = b ? Symbol.for("react.strict_mode") : 60108,
1552 g = b ? Symbol.for("react.profiler") : 60114,
1553 h = b ? Symbol.for("react.provider") : 60109,
1554 k = b ? Symbol.for("react.context") : 60110,
1555 l = b ? Symbol.for("react.async_mode") : 60111,
1556 m = b ? Symbol.for("react.concurrent_mode") : 60111,
1557 n = b ? Symbol.for("react.forward_ref") : 60112,
1558 p = b ? Symbol.for("react.suspense") : 60113,
1559 q = b ? Symbol.for("react.suspense_list") : 60120,
1560 r = b ? Symbol.for("react.memo") : 60115,
1561 t = b ? Symbol.for("react.lazy") : 60116,
1562 v = b ? Symbol.for("react.block") : 60121,
1563 w = b ? Symbol.for("react.fundamental") : 60117,
1564 x = b ? Symbol.for("react.responder") : 60118,
1565 y = b ? Symbol.for("react.scope") : 60119;
1566
1567function z(a) {
1568 if ("object" === typeof a && null !== a) {
1569 var u = a.$$typeof;
1570
1571 switch (u) {
1572 case c:
1573 switch (a = a.type, a) {
1574 case l:
1575 case m:
1576 case e:
1577 case g:
1578 case f:
1579 case p:
1580 return a;
1581
1582 default:
1583 switch (a = a && a.$$typeof, a) {
1584 case k:
1585 case n:
1586 case t:
1587 case r:
1588 case h:
1589 return a;
1590
1591 default:
1592 return u;
1593 }
1594
1595 }
1596
1597 case d:
1598 return u;
1599 }
1600 }
1601}
1602
1603function A(a) {
1604 return z(a) === m;
1605}
1606
1607reactIs_production_min.AsyncMode = l;
1608reactIs_production_min.ConcurrentMode = m;
1609reactIs_production_min.ContextConsumer = k;
1610reactIs_production_min.ContextProvider = h;
1611reactIs_production_min.Element = c;
1612reactIs_production_min.ForwardRef = n;
1613reactIs_production_min.Fragment = e;
1614reactIs_production_min.Lazy = t;
1615reactIs_production_min.Memo = r;
1616reactIs_production_min.Portal = d;
1617reactIs_production_min.Profiler = g;
1618reactIs_production_min.StrictMode = f;
1619reactIs_production_min.Suspense = p;
1620
1621reactIs_production_min.isAsyncMode = function (a) {
1622 return A(a) || z(a) === l;
1623};
1624
1625reactIs_production_min.isConcurrentMode = A;
1626
1627reactIs_production_min.isContextConsumer = function (a) {
1628 return z(a) === k;
1629};
1630
1631reactIs_production_min.isContextProvider = function (a) {
1632 return z(a) === h;
1633};
1634
1635reactIs_production_min.isElement = function (a) {
1636 return "object" === typeof a && null !== a && a.$$typeof === c;
1637};
1638
1639reactIs_production_min.isForwardRef = function (a) {
1640 return z(a) === n;
1641};
1642
1643reactIs_production_min.isFragment = function (a) {
1644 return z(a) === e;
1645};
1646
1647reactIs_production_min.isLazy = function (a) {
1648 return z(a) === t;
1649};
1650
1651reactIs_production_min.isMemo = function (a) {
1652 return z(a) === r;
1653};
1654
1655reactIs_production_min.isPortal = function (a) {
1656 return z(a) === d;
1657};
1658
1659reactIs_production_min.isProfiler = function (a) {
1660 return z(a) === g;
1661};
1662
1663reactIs_production_min.isStrictMode = function (a) {
1664 return z(a) === f;
1665};
1666
1667reactIs_production_min.isSuspense = function (a) {
1668 return z(a) === p;
1669};
1670
1671reactIs_production_min.isValidElementType = function (a) {
1672 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 || a.$$typeof === x || a.$$typeof === y || a.$$typeof === v);
1673};
1674
1675reactIs_production_min.typeOf = z;
1676var reactIs_development = {};
1677/** @license React v16.13.1
1678 * react-is.development.js
1679 *
1680 * Copyright (c) Facebook, Inc. and its affiliates.
1681 *
1682 * This source code is licensed under the MIT license found in the
1683 * LICENSE file in the root directory of this source tree.
1684 */
1685
1686if (process.env.NODE_ENV !== "production") {
1687 (function () {
1688 // nor polyfill, then a plain number is used for performance.
1689 var hasSymbol = typeof Symbol === 'function' && Symbol.for;
1690 var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
1691 var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
1692 var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
1693 var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
1694 var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
1695 var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
1696 var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary
1697 // (unstable) APIs that have been removed. Can we remove the symbols?
1698
1699 var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;
1700 var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
1701 var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
1702 var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
1703 var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;
1704 var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
1705 var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
1706 var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9;
1707 var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5;
1708 var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6;
1709 var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7;
1710
1711 function isValidElementType(type) {
1712 return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
1713 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);
1714 }
1715
1716 function typeOf(object) {
1717 if (typeof object === 'object' && object !== null) {
1718 var $$typeof = object.$$typeof;
1719
1720 switch ($$typeof) {
1721 case REACT_ELEMENT_TYPE:
1722 var type = object.type;
1723
1724 switch (type) {
1725 case REACT_ASYNC_MODE_TYPE:
1726 case REACT_CONCURRENT_MODE_TYPE:
1727 case REACT_FRAGMENT_TYPE:
1728 case REACT_PROFILER_TYPE:
1729 case REACT_STRICT_MODE_TYPE:
1730 case REACT_SUSPENSE_TYPE:
1731 return type;
1732
1733 default:
1734 var $$typeofType = type && type.$$typeof;
1735
1736 switch ($$typeofType) {
1737 case REACT_CONTEXT_TYPE:
1738 case REACT_FORWARD_REF_TYPE:
1739 case REACT_LAZY_TYPE:
1740 case REACT_MEMO_TYPE:
1741 case REACT_PROVIDER_TYPE:
1742 return $$typeofType;
1743
1744 default:
1745 return $$typeof;
1746 }
1747
1748 }
1749
1750 case REACT_PORTAL_TYPE:
1751 return $$typeof;
1752 }
1753 }
1754
1755 return undefined;
1756 } // AsyncMode is deprecated along with isAsyncMode
1757
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 return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE;
1783 }
1784
1785 function isConcurrentMode(object) {
1786 return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;
1787 }
1788
1789 function isContextConsumer(object) {
1790 return typeOf(object) === REACT_CONTEXT_TYPE;
1791 }
1792
1793 function isContextProvider(object) {
1794 return typeOf(object) === REACT_PROVIDER_TYPE;
1795 }
1796
1797 function isElement(object) {
1798 return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
1799 }
1800
1801 function isForwardRef(object) {
1802 return typeOf(object) === REACT_FORWARD_REF_TYPE;
1803 }
1804
1805 function isFragment(object) {
1806 return typeOf(object) === REACT_FRAGMENT_TYPE;
1807 }
1808
1809 function isLazy(object) {
1810 return typeOf(object) === REACT_LAZY_TYPE;
1811 }
1812
1813 function isMemo(object) {
1814 return typeOf(object) === REACT_MEMO_TYPE;
1815 }
1816
1817 function isPortal(object) {
1818 return typeOf(object) === REACT_PORTAL_TYPE;
1819 }
1820
1821 function isProfiler(object) {
1822 return typeOf(object) === REACT_PROFILER_TYPE;
1823 }
1824
1825 function isStrictMode(object) {
1826 return typeOf(object) === REACT_STRICT_MODE_TYPE;
1827 }
1828
1829 function isSuspense(object) {
1830 return typeOf(object) === REACT_SUSPENSE_TYPE;
1831 }
1832
1833 reactIs_development.AsyncMode = AsyncMode;
1834 reactIs_development.ConcurrentMode = ConcurrentMode;
1835 reactIs_development.ContextConsumer = ContextConsumer;
1836 reactIs_development.ContextProvider = ContextProvider;
1837 reactIs_development.Element = Element;
1838 reactIs_development.ForwardRef = ForwardRef;
1839 reactIs_development.Fragment = Fragment;
1840 reactIs_development.Lazy = Lazy;
1841 reactIs_development.Memo = Memo;
1842 reactIs_development.Portal = Portal;
1843 reactIs_development.Profiler = Profiler;
1844 reactIs_development.StrictMode = StrictMode;
1845 reactIs_development.Suspense = Suspense;
1846 reactIs_development.isAsyncMode = isAsyncMode;
1847 reactIs_development.isConcurrentMode = isConcurrentMode;
1848 reactIs_development.isContextConsumer = isContextConsumer;
1849 reactIs_development.isContextProvider = isContextProvider;
1850 reactIs_development.isElement = isElement;
1851 reactIs_development.isForwardRef = isForwardRef;
1852 reactIs_development.isFragment = isFragment;
1853 reactIs_development.isLazy = isLazy;
1854 reactIs_development.isMemo = isMemo;
1855 reactIs_development.isPortal = isPortal;
1856 reactIs_development.isProfiler = isProfiler;
1857 reactIs_development.isStrictMode = isStrictMode;
1858 reactIs_development.isSuspense = isSuspense;
1859 reactIs_development.isValidElementType = isValidElementType;
1860 reactIs_development.typeOf = typeOf;
1861 })();
1862}
1863
1864if (process.env.NODE_ENV === 'production') {
1865 reactIs$1.exports = reactIs_production_min;
1866} else {
1867 reactIs$1.exports = reactIs_development;
1868}
1869
1870var reactIs = reactIs$1.exports;
1871/**
1872 * Copyright 2015, Yahoo! Inc.
1873 * Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
1874 */
1875
1876var REACT_STATICS = {
1877 childContextTypes: true,
1878 contextType: true,
1879 contextTypes: true,
1880 defaultProps: true,
1881 displayName: true,
1882 getDefaultProps: true,
1883 getDerivedStateFromError: true,
1884 getDerivedStateFromProps: true,
1885 mixins: true,
1886 propTypes: true,
1887 type: true
1888};
1889var KNOWN_STATICS = {
1890 name: true,
1891 length: true,
1892 prototype: true,
1893 caller: true,
1894 callee: true,
1895 arguments: true,
1896 arity: true
1897};
1898var FORWARD_REF_STATICS = {
1899 '$$typeof': true,
1900 render: true,
1901 defaultProps: true,
1902 displayName: true,
1903 propTypes: true
1904};
1905var MEMO_STATICS = {
1906 '$$typeof': true,
1907 compare: true,
1908 defaultProps: true,
1909 displayName: true,
1910 propTypes: true,
1911 type: true
1912};
1913var TYPE_STATICS = {};
1914TYPE_STATICS[reactIs.ForwardRef] = FORWARD_REF_STATICS;
1915TYPE_STATICS[reactIs.Memo] = MEMO_STATICS;
1916
1917function getStatics(component) {
1918 // React v16.11 and below
1919 if (reactIs.isMemo(component)) {
1920 return MEMO_STATICS;
1921 } // React v16.12 and above
1922
1923
1924 return TYPE_STATICS[component['$$typeof']] || REACT_STATICS;
1925}
1926
1927var defineProperty = Object.defineProperty;
1928var getOwnPropertyNames = Object.getOwnPropertyNames;
1929var getOwnPropertySymbols = Object.getOwnPropertySymbols;
1930var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
1931var getPrototypeOf = Object.getPrototypeOf;
1932var objectPrototype = Object.prototype;
1933
1934function hoistNonReactStatics$2(targetComponent, sourceComponent, blacklist) {
1935 if (typeof sourceComponent !== 'string') {
1936 // don't hoist over string (html) components
1937 if (objectPrototype) {
1938 var inheritedComponent = getPrototypeOf(sourceComponent);
1939
1940 if (inheritedComponent && inheritedComponent !== objectPrototype) {
1941 hoistNonReactStatics$2(targetComponent, inheritedComponent, blacklist);
1942 }
1943 }
1944
1945 var keys = getOwnPropertyNames(sourceComponent);
1946
1947 if (getOwnPropertySymbols) {
1948 keys = keys.concat(getOwnPropertySymbols(sourceComponent));
1949 }
1950
1951 var targetStatics = getStatics(targetComponent);
1952 var sourceStatics = getStatics(sourceComponent);
1953
1954 for (var i = 0; i < keys.length; ++i) {
1955 var key = keys[i];
1956
1957 if (!KNOWN_STATICS[key] && !(blacklist && blacklist[key]) && !(sourceStatics && sourceStatics[key]) && !(targetStatics && targetStatics[key])) {
1958 var descriptor = getOwnPropertyDescriptor(sourceComponent, key);
1959
1960 try {
1961 // Avoid failures from read-only properties
1962 defineProperty(targetComponent, key, descriptor);
1963 } catch (e) {}
1964 }
1965 }
1966 }
1967
1968 return targetComponent;
1969}
1970
1971var hoistNonReactStatics_cjs = hoistNonReactStatics$2; // and if this module doesn't actually contain any logic of its own
1972// then Rollup just use 'hoist-non-react-statics' directly in other chunks
1973
1974var hoistNonReactStatics = function (targetComponent, sourceComponent) {
1975 return hoistNonReactStatics_cjs(targetComponent, sourceComponent);
1976};
1977
1978var hoistNonReactStatics$1 = hoistNonReactStatics;
1979var isBrowser$5 = typeof document !== 'undefined';
1980
1981function getRegisteredStyles$1(registered, registeredStyles, classNames) {
1982 var rawClassName = '';
1983 classNames.split(' ').forEach(function (className) {
1984 if (registered[className] !== undefined) {
1985 registeredStyles.push(registered[className] + ";");
1986 } else {
1987 rawClassName += className + " ";
1988 }
1989 });
1990 return rawClassName;
1991}
1992
1993var registerStyles$1 = function registerStyles(cache, serialized, isStringTag) {
1994 var className = cache.key + "-" + serialized.name;
1995
1996 if ( // we only need to add the styles to the registered cache if the
1997 // class name could be used further down
1998 // the tree but if it's a string tag, we know it won't
1999 // so we don't have to add it to registered cache.
2000 // this improves memory usage since we can avoid storing the whole style string
2001 (isStringTag === false || // we need to always store it if we're in compat mode and
2002 // in node since emotion-server relies on whether a style is in
2003 // the registered cache to know whether a style is global or not
2004 // also, note that this check will be dead code eliminated in the browser
2005 isBrowser$5 === false && cache.compat !== undefined) && cache.registered[className] === undefined) {
2006 cache.registered[className] = serialized.styles;
2007 }
2008};
2009
2010var insertStyles$1 = function insertStyles(cache, serialized, isStringTag) {
2011 registerStyles$1(cache, serialized, isStringTag);
2012 var className = cache.key + "-" + serialized.name;
2013
2014 if (cache.inserted[serialized.name] === undefined) {
2015 var stylesForSSR = '';
2016 var current = serialized;
2017
2018 do {
2019 var maybeStyles = cache.insert(serialized === current ? "." + className : '', current, cache.sheet, true);
2020
2021 if (!isBrowser$5 && maybeStyles !== undefined) {
2022 stylesForSSR += maybeStyles;
2023 }
2024
2025 current = current.next;
2026 } while (current !== undefined);
2027
2028 if (!isBrowser$5 && stylesForSSR.length !== 0) {
2029 return stylesForSSR;
2030 }
2031 }
2032};
2033/* eslint-disable */
2034// Inspired by https://github.com/garycourt/murmurhash-js
2035// Ported from https://github.com/aappleby/smhasher/blob/61a0530f28277f2e850bfc39600ce61d02b518de/src/MurmurHash2.cpp#L37-L86
2036
2037
2038function murmur2(str) {
2039 // 'm' and 'r' are mixing constants generated offline.
2040 // They're not really 'magic', they just happen to work well.
2041 // const m = 0x5bd1e995;
2042 // const r = 24;
2043 // Initialize the hash
2044 var h = 0; // Mix 4 bytes at a time into the hash
2045
2046 var k,
2047 i = 0,
2048 len = str.length;
2049
2050 for (; len >= 4; ++i, len -= 4) {
2051 k = str.charCodeAt(i) & 0xff | (str.charCodeAt(++i) & 0xff) << 8 | (str.charCodeAt(++i) & 0xff) << 16 | (str.charCodeAt(++i) & 0xff) << 24;
2052 k =
2053 /* Math.imul(k, m): */
2054 (k & 0xffff) * 0x5bd1e995 + ((k >>> 16) * 0xe995 << 16);
2055 k ^=
2056 /* k >>> r: */
2057 k >>> 24;
2058 h =
2059 /* Math.imul(k, m): */
2060 (k & 0xffff) * 0x5bd1e995 + ((k >>> 16) * 0xe995 << 16) ^
2061 /* Math.imul(h, m): */
2062 (h & 0xffff) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16);
2063 } // Handle the last few bytes of the input array
2064
2065
2066 switch (len) {
2067 case 3:
2068 h ^= (str.charCodeAt(i + 2) & 0xff) << 16;
2069
2070 case 2:
2071 h ^= (str.charCodeAt(i + 1) & 0xff) << 8;
2072
2073 case 1:
2074 h ^= str.charCodeAt(i) & 0xff;
2075 h =
2076 /* Math.imul(h, m): */
2077 (h & 0xffff) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16);
2078 } // Do a few final mixes of the hash to ensure the last few
2079 // bytes are well-incorporated.
2080
2081
2082 h ^= h >>> 13;
2083 h =
2084 /* Math.imul(h, m): */
2085 (h & 0xffff) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16);
2086 return ((h ^ h >>> 15) >>> 0).toString(36);
2087}
2088
2089var unitlessKeys = {
2090 animationIterationCount: 1,
2091 borderImageOutset: 1,
2092 borderImageSlice: 1,
2093 borderImageWidth: 1,
2094 boxFlex: 1,
2095 boxFlexGroup: 1,
2096 boxOrdinalGroup: 1,
2097 columnCount: 1,
2098 columns: 1,
2099 flex: 1,
2100 flexGrow: 1,
2101 flexPositive: 1,
2102 flexShrink: 1,
2103 flexNegative: 1,
2104 flexOrder: 1,
2105 gridRow: 1,
2106 gridRowEnd: 1,
2107 gridRowSpan: 1,
2108 gridRowStart: 1,
2109 gridColumn: 1,
2110 gridColumnEnd: 1,
2111 gridColumnSpan: 1,
2112 gridColumnStart: 1,
2113 msGridRow: 1,
2114 msGridRowSpan: 1,
2115 msGridColumn: 1,
2116 msGridColumnSpan: 1,
2117 fontWeight: 1,
2118 lineHeight: 1,
2119 opacity: 1,
2120 order: 1,
2121 orphans: 1,
2122 tabSize: 1,
2123 widows: 1,
2124 zIndex: 1,
2125 zoom: 1,
2126 WebkitLineClamp: 1,
2127 // SVG-related properties
2128 fillOpacity: 1,
2129 floodOpacity: 1,
2130 stopOpacity: 1,
2131 strokeDasharray: 1,
2132 strokeDashoffset: 1,
2133 strokeMiterlimit: 1,
2134 strokeOpacity: 1,
2135 strokeWidth: 1
2136};
2137var ILLEGAL_ESCAPE_SEQUENCE_ERROR$2 = "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";
2138var UNDEFINED_AS_OBJECT_KEY_ERROR$1 = "You have passed in falsy value as style object's key (can happen when in example you pass unexported component as computed key).";
2139var hyphenateRegex$1 = /[A-Z]|^ms/g;
2140var animationRegex$1 = /_EMO_([^_]+?)_([^]*?)_EMO_/g;
2141
2142var isCustomProperty$1 = function isCustomProperty(property) {
2143 return property.charCodeAt(1) === 45;
2144};
2145
2146var isProcessableValue$1 = function isProcessableValue(value) {
2147 return value != null && typeof value !== 'boolean';
2148};
2149
2150var processStyleName$1 = /* #__PURE__ */memoize(function (styleName) {
2151 return isCustomProperty$1(styleName) ? styleName : styleName.replace(hyphenateRegex$1, '-$&').toLowerCase();
2152});
2153
2154var processStyleValue$1 = function processStyleValue(key, value) {
2155 switch (key) {
2156 case 'animation':
2157 case 'animationName':
2158 {
2159 if (typeof value === 'string') {
2160 return value.replace(animationRegex$1, function (match, p1, p2) {
2161 cursor$1 = {
2162 name: p1,
2163 styles: p2,
2164 next: cursor$1
2165 };
2166 return p1;
2167 });
2168 }
2169 }
2170 }
2171
2172 if (unitlessKeys[key] !== 1 && !isCustomProperty$1(key) && typeof value === 'number' && value !== 0) {
2173 return value + 'px';
2174 }
2175
2176 return value;
2177};
2178
2179if (process.env.NODE_ENV !== 'production') {
2180 var contentValuePattern$1 = /(attr|counters?|url|(((repeating-)?(linear|radial))|conic)-gradient)\(|(no-)?(open|close)-quote/;
2181 var contentValues$1 = ['normal', 'none', 'initial', 'inherit', 'unset'];
2182 var oldProcessStyleValue$1 = processStyleValue$1;
2183 var msPattern$1 = /^-ms-/;
2184 var hyphenPattern$1 = /-(.)/g;
2185 var hyphenatedCache$1 = {};
2186
2187 processStyleValue$1 = function processStyleValue(key, value) {
2188 if (key === 'content') {
2189 if (typeof value !== 'string' || contentValues$1.indexOf(value) === -1 && !contentValuePattern$1.test(value) && (value.charAt(0) !== value.charAt(value.length - 1) || value.charAt(0) !== '"' && value.charAt(0) !== "'")) {
2190 throw new Error("You seem to be using a value for 'content' without quotes, try replacing it with `content: '\"" + value + "\"'`");
2191 }
2192 }
2193
2194 var processed = oldProcessStyleValue$1(key, value);
2195
2196 if (processed !== '' && !isCustomProperty$1(key) && key.indexOf('-') !== -1 && hyphenatedCache$1[key] === undefined) {
2197 hyphenatedCache$1[key] = true;
2198 console.error("Using kebab-case for css properties in objects is not supported. Did you mean " + key.replace(msPattern$1, 'ms-').replace(hyphenPattern$1, function (str, _char) {
2199 return _char.toUpperCase();
2200 }) + "?");
2201 }
2202
2203 return processed;
2204 };
2205}
2206
2207function handleInterpolation$1(mergedProps, registered, interpolation) {
2208 if (interpolation == null) {
2209 return '';
2210 }
2211
2212 if (interpolation.__emotion_styles !== undefined) {
2213 if (process.env.NODE_ENV !== 'production' && interpolation.toString() === 'NO_COMPONENT_SELECTOR') {
2214 throw new Error('Component selectors can only be used in conjunction with @emotion/babel-plugin.');
2215 }
2216
2217 return interpolation;
2218 }
2219
2220 switch (typeof interpolation) {
2221 case 'boolean':
2222 {
2223 return '';
2224 }
2225
2226 case 'object':
2227 {
2228 if (interpolation.anim === 1) {
2229 cursor$1 = {
2230 name: interpolation.name,
2231 styles: interpolation.styles,
2232 next: cursor$1
2233 };
2234 return interpolation.name;
2235 }
2236
2237 if (interpolation.styles !== undefined) {
2238 var next = interpolation.next;
2239
2240 if (next !== undefined) {
2241 // not the most efficient thing ever but this is a pretty rare case
2242 // and there will be very few iterations of this generally
2243 while (next !== undefined) {
2244 cursor$1 = {
2245 name: next.name,
2246 styles: next.styles,
2247 next: cursor$1
2248 };
2249 next = next.next;
2250 }
2251 }
2252
2253 var styles = interpolation.styles + ";";
2254
2255 if (process.env.NODE_ENV !== 'production' && interpolation.map !== undefined) {
2256 styles += interpolation.map;
2257 }
2258
2259 return styles;
2260 }
2261
2262 return createStringFromObject$1(mergedProps, registered, interpolation);
2263 }
2264
2265 case 'function':
2266 {
2267 if (mergedProps !== undefined) {
2268 var previousCursor = cursor$1;
2269 var result = interpolation(mergedProps);
2270 cursor$1 = previousCursor;
2271 return handleInterpolation$1(mergedProps, registered, result);
2272 } else if (process.env.NODE_ENV !== 'production') {
2273 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}`");
2274 }
2275
2276 break;
2277 }
2278
2279 case 'string':
2280 if (process.env.NODE_ENV !== 'production') {
2281 var matched = [];
2282 var replaced = interpolation.replace(animationRegex$1, function (match, p1, p2) {
2283 var fakeVarName = "animation" + matched.length;
2284 matched.push("const " + fakeVarName + " = keyframes`" + p2.replace(/^@keyframes animation-\w+/, '') + "`");
2285 return "${" + fakeVarName + "}";
2286 });
2287
2288 if (matched.length) {
2289 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 + "`"));
2290 }
2291 }
2292
2293 break;
2294 } // finalize string values (regular strings and functions interpolated into css calls)
2295
2296
2297 if (registered == null) {
2298 return interpolation;
2299 }
2300
2301 var cached = registered[interpolation];
2302 return cached !== undefined ? cached : interpolation;
2303}
2304
2305function createStringFromObject$1(mergedProps, registered, obj) {
2306 var string = '';
2307
2308 if (Array.isArray(obj)) {
2309 for (var i = 0; i < obj.length; i++) {
2310 string += handleInterpolation$1(mergedProps, registered, obj[i]) + ";";
2311 }
2312 } else {
2313 for (var _key in obj) {
2314 var value = obj[_key];
2315
2316 if (typeof value !== 'object') {
2317 if (registered != null && registered[value] !== undefined) {
2318 string += _key + "{" + registered[value] + "}";
2319 } else if (isProcessableValue$1(value)) {
2320 string += processStyleName$1(_key) + ":" + processStyleValue$1(_key, value) + ";";
2321 }
2322 } else {
2323 if (_key === 'NO_COMPONENT_SELECTOR' && process.env.NODE_ENV !== 'production') {
2324 throw new Error('Component selectors can only be used in conjunction with @emotion/babel-plugin.');
2325 }
2326
2327 if (Array.isArray(value) && typeof value[0] === 'string' && (registered == null || registered[value[0]] === undefined)) {
2328 for (var _i = 0; _i < value.length; _i++) {
2329 if (isProcessableValue$1(value[_i])) {
2330 string += processStyleName$1(_key) + ":" + processStyleValue$1(_key, value[_i]) + ";";
2331 }
2332 }
2333 } else {
2334 var interpolated = handleInterpolation$1(mergedProps, registered, value);
2335
2336 switch (_key) {
2337 case 'animation':
2338 case 'animationName':
2339 {
2340 string += processStyleName$1(_key) + ":" + interpolated + ";";
2341 break;
2342 }
2343
2344 default:
2345 {
2346 if (process.env.NODE_ENV !== 'production' && _key === 'undefined') {
2347 console.error(UNDEFINED_AS_OBJECT_KEY_ERROR$1);
2348 }
2349
2350 string += _key + "{" + interpolated + "}";
2351 }
2352 }
2353 }
2354 }
2355 }
2356 }
2357
2358 return string;
2359}
2360
2361var labelPattern$1 = /label:\s*([^\s;\n{]+)\s*(;|$)/g;
2362var sourceMapPattern$1;
2363
2364if (process.env.NODE_ENV !== 'production') {
2365 sourceMapPattern$1 = /\/\*#\ssourceMappingURL=data:application\/json;\S+\s+\*\//g;
2366} // this is the cursor for keyframes
2367// keyframes are stored on the SerializedStyles object as a linked list
2368
2369
2370var cursor$1;
2371
2372var serializeStyles$1 = function serializeStyles(args, registered, mergedProps) {
2373 if (args.length === 1 && typeof args[0] === 'object' && args[0] !== null && args[0].styles !== undefined) {
2374 return args[0];
2375 }
2376
2377 var stringMode = true;
2378 var styles = '';
2379 cursor$1 = undefined;
2380 var strings = args[0];
2381
2382 if (strings == null || strings.raw === undefined) {
2383 stringMode = false;
2384 styles += handleInterpolation$1(mergedProps, registered, strings);
2385 } else {
2386 if (process.env.NODE_ENV !== 'production' && strings[0] === undefined) {
2387 console.error(ILLEGAL_ESCAPE_SEQUENCE_ERROR$2);
2388 }
2389
2390 styles += strings[0];
2391 } // we start at 1 since we've already handled the first arg
2392
2393
2394 for (var i = 1; i < args.length; i++) {
2395 styles += handleInterpolation$1(mergedProps, registered, args[i]);
2396
2397 if (stringMode) {
2398 if (process.env.NODE_ENV !== 'production' && strings[i] === undefined) {
2399 console.error(ILLEGAL_ESCAPE_SEQUENCE_ERROR$2);
2400 }
2401
2402 styles += strings[i];
2403 }
2404 }
2405
2406 var sourceMap;
2407
2408 if (process.env.NODE_ENV !== 'production') {
2409 styles = styles.replace(sourceMapPattern$1, function (match) {
2410 sourceMap = match;
2411 return '';
2412 });
2413 } // using a global regex with .exec is stateful so lastIndex has to be reset each time
2414
2415
2416 labelPattern$1.lastIndex = 0;
2417 var identifierName = '';
2418 var match; // https://esbench.com/bench/5b809c2cf2949800a0f61fb5
2419
2420 while ((match = labelPattern$1.exec(styles)) !== null) {
2421 identifierName += '-' + // $FlowFixMe we know it's not null
2422 match[1];
2423 }
2424
2425 var name = murmur2(styles) + identifierName;
2426
2427 if (process.env.NODE_ENV !== 'production') {
2428 // $FlowFixMe SerializedStyles type doesn't have toString property (and we don't want to add it)
2429 return {
2430 name: name,
2431 styles: styles,
2432 map: sourceMap,
2433 next: cursor$1,
2434 toString: function toString() {
2435 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).";
2436 }
2437 };
2438 }
2439
2440 return {
2441 name: name,
2442 styles: styles,
2443 next: cursor$1
2444 };
2445};
2446
2447var isBrowser$4 = typeof document !== 'undefined';
2448var hasOwnProperty$1 = {}.hasOwnProperty;
2449var EmotionCacheContext = /* #__PURE__ */React.createContext( // we're doing this to avoid preconstruct's dead code elimination in this one case
2450// because this module is primarily intended for the browser and node
2451// but it's also required in react native and similar environments sometimes
2452// and we could have a special build just for that
2453// but this is much easier and the native packages
2454// might use a different theme context in the future anyway
2455typeof HTMLElement !== 'undefined' ? /* #__PURE__ */createCache({
2456 key: 'css'
2457}) : null);
2458
2459if (process.env.NODE_ENV !== 'production') {
2460 EmotionCacheContext.displayName = 'EmotionCacheContext';
2461}
2462
2463var CacheProvider = EmotionCacheContext.Provider;
2464
2465var withEmotionCache = function withEmotionCache(func) {
2466 // $FlowFixMe
2467 return /*#__PURE__*/React.forwardRef(function (props, ref) {
2468 // the cache will never be null in the browser
2469 var cache = React.useContext(EmotionCacheContext);
2470 return func(props, cache, ref);
2471 });
2472};
2473
2474if (!isBrowser$4) {
2475 withEmotionCache = function withEmotionCache(func) {
2476 return function (props) {
2477 var cache = React.useContext(EmotionCacheContext);
2478
2479 if (cache === null) {
2480 // yes, we're potentially creating this on every render
2481 // it doesn't actually matter though since it's only on the server
2482 // so there will only every be a single render
2483 // that could change in the future because of suspense and etc. but for now,
2484 // this works and i don't want to optimise for a future thing that we aren't sure about
2485 cache = createCache({
2486 key: 'css'
2487 });
2488 return /*#__PURE__*/React.createElement(EmotionCacheContext.Provider, {
2489 value: cache
2490 }, func(props, cache));
2491 } else {
2492 return func(props, cache);
2493 }
2494 };
2495 };
2496}
2497
2498var ThemeContext = /* #__PURE__ */React.createContext({});
2499
2500if (process.env.NODE_ENV !== 'production') {
2501 ThemeContext.displayName = 'EmotionThemeContext';
2502}
2503
2504var useTheme$1 = function useTheme() {
2505 return React.useContext(ThemeContext);
2506};
2507
2508var getTheme = function getTheme(outerTheme, theme) {
2509 if (typeof theme === 'function') {
2510 var mergedTheme = theme(outerTheme);
2511
2512 if (process.env.NODE_ENV !== 'production' && (mergedTheme == null || typeof mergedTheme !== 'object' || Array.isArray(mergedTheme))) {
2513 throw new Error('[ThemeProvider] Please return an object from your theme function, i.e. theme={() => ({})}!');
2514 }
2515
2516 return mergedTheme;
2517 }
2518
2519 if (process.env.NODE_ENV !== 'production' && (theme == null || typeof theme !== 'object' || Array.isArray(theme))) {
2520 throw new Error('[ThemeProvider] Please make your theme prop a plain object');
2521 }
2522
2523 return _extends$1({}, outerTheme, theme);
2524};
2525
2526var createCacheWithTheme = /* #__PURE__ */weakMemoize(function (outerTheme) {
2527 return weakMemoize(function (theme) {
2528 return getTheme(outerTheme, theme);
2529 });
2530});
2531
2532var ThemeProvider = function ThemeProvider(props) {
2533 var theme = React.useContext(ThemeContext);
2534
2535 if (props.theme !== theme) {
2536 theme = createCacheWithTheme(theme)(props.theme);
2537 }
2538
2539 return /*#__PURE__*/React.createElement(ThemeContext.Provider, {
2540 value: theme
2541 }, props.children);
2542};
2543
2544function withTheme$1(Component) {
2545 var componentName = Component.displayName || Component.name || 'Component';
2546
2547 var render = function render(props, ref) {
2548 var theme = React.useContext(ThemeContext);
2549 return /*#__PURE__*/React.createElement(Component, _extends$1({
2550 theme: theme,
2551 ref: ref
2552 }, props));
2553 }; // $FlowFixMe
2554
2555
2556 var WithTheme = /*#__PURE__*/React.forwardRef(render);
2557 WithTheme.displayName = "WithTheme(" + componentName + ")";
2558 return hoistNonReactStatics$1(WithTheme, Component);
2559}
2560
2561var getLastPart = function getLastPart(functionName) {
2562 // The match may be something like 'Object.createEmotionProps' or
2563 // 'Loader.prototype.render'
2564 var parts = functionName.split('.');
2565 return parts[parts.length - 1];
2566};
2567
2568var getFunctionNameFromStackTraceLine = function getFunctionNameFromStackTraceLine(line) {
2569 // V8
2570 var match = /^\s+at\s+([A-Za-z0-9$.]+)\s/.exec(line);
2571 if (match) return getLastPart(match[1]); // Safari / Firefox
2572
2573 match = /^([A-Za-z0-9$.]+)@/.exec(line);
2574 if (match) return getLastPart(match[1]);
2575 return undefined;
2576};
2577
2578var internalReactFunctionNames = /* #__PURE__ */new Set(['renderWithHooks', 'processChild', 'finishClassComponent', 'renderToString']); // These identifiers come from error stacks, so they have to be valid JS
2579// identifiers, thus we only need to replace what is a valid character for JS,
2580// but not for CSS.
2581
2582var sanitizeIdentifier = function sanitizeIdentifier(identifier) {
2583 return identifier.replace(/\$/g, '-');
2584};
2585
2586var getLabelFromStackTrace = function getLabelFromStackTrace(stackTrace) {
2587 if (!stackTrace) return undefined;
2588 var lines = stackTrace.split('\n');
2589
2590 for (var i = 0; i < lines.length; i++) {
2591 var functionName = getFunctionNameFromStackTraceLine(lines[i]); // The first line of V8 stack traces is just "Error"
2592
2593 if (!functionName) continue; // If we reach one of these, we have gone too far and should quit
2594
2595 if (internalReactFunctionNames.has(functionName)) break; // The component name is the first function in the stack that starts with an
2596 // uppercase letter
2597
2598 if (/^[A-Z]/.test(functionName)) return sanitizeIdentifier(functionName);
2599 }
2600
2601 return undefined;
2602};
2603
2604var isBrowser$1$1 = typeof document !== 'undefined';
2605var useInsertionEffect$2 = React__namespace['useInsertion' + 'Effect'] ? React__namespace['useInsertion' + 'Effect'] : function useInsertionEffect(create) {
2606 create();
2607};
2608
2609function useInsertionEffectMaybe$1(create) {
2610 if (!isBrowser$1$1) {
2611 return create();
2612 }
2613
2614 useInsertionEffect$2(create);
2615}
2616
2617var typePropName = '__EMOTION_TYPE_PLEASE_DO_NOT_USE__';
2618var labelPropName = '__EMOTION_LABEL_PLEASE_DO_NOT_USE__';
2619
2620var createEmotionProps = function createEmotionProps(type, props) {
2621 if (process.env.NODE_ENV !== 'production' && typeof props.css === 'string' && // check if there is a css declaration
2622 props.css.indexOf(':') !== -1) {
2623 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 + "`");
2624 }
2625
2626 var newProps = {};
2627
2628 for (var key in props) {
2629 if (hasOwnProperty$1.call(props, key)) {
2630 newProps[key] = props[key];
2631 }
2632 }
2633
2634 newProps[typePropName] = type; // For performance, only call getLabelFromStackTrace in development and when
2635 // the label hasn't already been computed
2636
2637 if (process.env.NODE_ENV !== 'production' && !!props.css && (typeof props.css !== 'object' || typeof props.css.name !== 'string' || props.css.name.indexOf('-') === -1)) {
2638 var label = getLabelFromStackTrace(new Error().stack);
2639 if (label) newProps[labelPropName] = label;
2640 }
2641
2642 return newProps;
2643};
2644
2645var Insertion$2 = function Insertion(_ref) {
2646 var cache = _ref.cache,
2647 serialized = _ref.serialized,
2648 isStringTag = _ref.isStringTag;
2649 registerStyles$1(cache, serialized, isStringTag);
2650 var rules = useInsertionEffectMaybe$1(function () {
2651 return insertStyles$1(cache, serialized, isStringTag);
2652 });
2653
2654 if (!isBrowser$4 && rules !== undefined) {
2655 var _ref2;
2656
2657 var serializedNames = serialized.name;
2658 var next = serialized.next;
2659
2660 while (next !== undefined) {
2661 serializedNames += ' ' + next.name;
2662 next = next.next;
2663 }
2664
2665 return /*#__PURE__*/React.createElement("style", (_ref2 = {}, _ref2["data-emotion"] = cache.key + " " + serializedNames, _ref2.dangerouslySetInnerHTML = {
2666 __html: rules
2667 }, _ref2.nonce = cache.sheet.nonce, _ref2));
2668 }
2669
2670 return null;
2671};
2672
2673var Emotion = /* #__PURE__ */withEmotionCache(function (props, cache, ref) {
2674 var cssProp = props.css; // so that using `css` from `emotion` and passing the result to the css prop works
2675 // not passing the registered cache to serializeStyles because it would
2676 // make certain babel optimisations not possible
2677
2678 if (typeof cssProp === 'string' && cache.registered[cssProp] !== undefined) {
2679 cssProp = cache.registered[cssProp];
2680 }
2681
2682 var WrappedComponent = props[typePropName];
2683 var registeredStyles = [cssProp];
2684 var className = '';
2685
2686 if (typeof props.className === 'string') {
2687 className = getRegisteredStyles$1(cache.registered, registeredStyles, props.className);
2688 } else if (props.className != null) {
2689 className = props.className + " ";
2690 }
2691
2692 var serialized = serializeStyles$1(registeredStyles, undefined, React.useContext(ThemeContext));
2693
2694 if (process.env.NODE_ENV !== 'production' && serialized.name.indexOf('-') === -1) {
2695 var labelFromStack = props[labelPropName];
2696
2697 if (labelFromStack) {
2698 serialized = serializeStyles$1([serialized, 'label:' + labelFromStack + ';']);
2699 }
2700 }
2701
2702 className += cache.key + "-" + serialized.name;
2703 var newProps = {};
2704
2705 for (var key in props) {
2706 if (hasOwnProperty$1.call(props, key) && key !== 'css' && key !== typePropName && (process.env.NODE_ENV === 'production' || key !== labelPropName)) {
2707 newProps[key] = props[key];
2708 }
2709 }
2710
2711 newProps.ref = ref;
2712 newProps.className = className;
2713 return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Insertion$2, {
2714 cache: cache,
2715 serialized: serialized,
2716 isStringTag: typeof WrappedComponent === 'string'
2717 }), /*#__PURE__*/React.createElement(WrappedComponent, newProps));
2718});
2719
2720if (process.env.NODE_ENV !== 'production') {
2721 Emotion.displayName = 'EmotionCssPropInternal';
2722}
2723/*
2724
2725Based off glamor's StyleSheet, thanks Sunil ❤️
2726
2727high performance StyleSheet for css-in-js systems
2728
2729- uses multiple style tags behind the scenes for millions of rules
2730- uses `insertRule` for appending in production for *much* faster performance
2731
2732// usage
2733
2734import { StyleSheet } from '@emotion/sheet'
2735
2736let styleSheet = new StyleSheet({ key: '', container: document.head })
2737
2738styleSheet.insert('#box { border: 1px solid red; }')
2739- appends a css rule into the stylesheet
2740
2741styleSheet.flush()
2742- empties the stylesheet of all its contents
2743
2744*/
2745// $FlowFixMe
2746
2747
2748function sheetForTag(tag) {
2749 if (tag.sheet) {
2750 // $FlowFixMe
2751 return tag.sheet;
2752 } // this weirdness brought to you by firefox
2753
2754 /* istanbul ignore next */
2755
2756
2757 for (var i = 0; i < document.styleSheets.length; i++) {
2758 if (document.styleSheets[i].ownerNode === tag) {
2759 // $FlowFixMe
2760 return document.styleSheets[i];
2761 }
2762 }
2763}
2764
2765function createStyleElement(options) {
2766 var tag = document.createElement('style');
2767 tag.setAttribute('data-emotion', options.key);
2768
2769 if (options.nonce !== undefined) {
2770 tag.setAttribute('nonce', options.nonce);
2771 }
2772
2773 tag.appendChild(document.createTextNode(''));
2774 tag.setAttribute('data-s', '');
2775 return tag;
2776}
2777
2778var StyleSheet = /*#__PURE__*/function () {
2779 function StyleSheet(options) {
2780 var _this = this;
2781
2782 this._insertTag = function (tag) {
2783 var before;
2784
2785 if (_this.tags.length === 0) {
2786 if (_this.insertionPoint) {
2787 before = _this.insertionPoint.nextSibling;
2788 } else if (_this.prepend) {
2789 before = _this.container.firstChild;
2790 } else {
2791 before = _this.before;
2792 }
2793 } else {
2794 before = _this.tags[_this.tags.length - 1].nextSibling;
2795 }
2796
2797 _this.container.insertBefore(tag, before);
2798
2799 _this.tags.push(tag);
2800 };
2801
2802 this.isSpeedy = options.speedy === undefined ? process.env.NODE_ENV === 'production' : options.speedy;
2803 this.tags = [];
2804 this.ctr = 0;
2805 this.nonce = options.nonce; // key is the value of the data-emotion attribute, it's used to identify different sheets
2806
2807 this.key = options.key;
2808 this.container = options.container;
2809 this.prepend = options.prepend;
2810 this.insertionPoint = options.insertionPoint;
2811 this.before = null;
2812 }
2813
2814 var _proto = StyleSheet.prototype;
2815
2816 _proto.hydrate = function hydrate(nodes) {
2817 nodes.forEach(this._insertTag);
2818 };
2819
2820 _proto.insert = function insert(rule) {
2821 // the max length is how many rules we have per style tag, it's 65000 in speedy mode
2822 // it's 1 in dev because we insert source maps that map a single rule to a location
2823 // and you can only have one source map per style tag
2824 if (this.ctr % (this.isSpeedy ? 65000 : 1) === 0) {
2825 this._insertTag(createStyleElement(this));
2826 }
2827
2828 var tag = this.tags[this.tags.length - 1];
2829
2830 if (process.env.NODE_ENV !== 'production') {
2831 var isImportRule = rule.charCodeAt(0) === 64 && rule.charCodeAt(1) === 105;
2832
2833 if (isImportRule && this._alreadyInsertedOrderInsensitiveRule) {
2834 // this would only cause problem in speedy mode
2835 // but we don't want enabling speedy to affect the observable behavior
2836 // so we report this error at all times
2837 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.');
2838 }
2839
2840 this._alreadyInsertedOrderInsensitiveRule = this._alreadyInsertedOrderInsensitiveRule || !isImportRule;
2841 }
2842
2843 if (this.isSpeedy) {
2844 var sheet = sheetForTag(tag);
2845
2846 try {
2847 // this is the ultrafast version, works across browsers
2848 // the big drawback is that the css won't be editable in devtools
2849 sheet.insertRule(rule, sheet.cssRules.length);
2850 } catch (e) {
2851 if (process.env.NODE_ENV !== 'production' && !/:(-moz-placeholder|-moz-focus-inner|-moz-focusring|-ms-input-placeholder|-moz-read-write|-moz-read-only|-ms-clear){/.test(rule)) {
2852 console.error("There was a problem inserting the following rule: \"" + rule + "\"", e);
2853 }
2854 }
2855 } else {
2856 tag.appendChild(document.createTextNode(rule));
2857 }
2858
2859 this.ctr++;
2860 };
2861
2862 _proto.flush = function flush() {
2863 // $FlowFixMe
2864 this.tags.forEach(function (tag) {
2865 return tag.parentNode && tag.parentNode.removeChild(tag);
2866 });
2867 this.tags = [];
2868 this.ctr = 0;
2869
2870 if (process.env.NODE_ENV !== 'production') {
2871 this._alreadyInsertedOrderInsensitiveRule = false;
2872 }
2873 };
2874
2875 return StyleSheet;
2876}();
2877
2878var pkg = {
2879 name: "@emotion/react",
2880 version: "11.8.1",
2881 main: "dist/emotion-react.cjs.js",
2882 module: "dist/emotion-react.esm.js",
2883 browser: {
2884 "./dist/emotion-react.cjs.js": "./dist/emotion-react.browser.cjs.js",
2885 "./dist/emotion-react.esm.js": "./dist/emotion-react.browser.esm.js"
2886 },
2887 types: "types/index.d.ts",
2888 files: ["src", "dist", "jsx-runtime", "jsx-dev-runtime", "_isolated-hnrs", "types/*.d.ts", "macro.js", "macro.d.ts", "macro.js.flow"],
2889 sideEffects: false,
2890 author: "Emotion Contributors",
2891 license: "MIT",
2892 scripts: {
2893 "test:typescript": "dtslint types"
2894 },
2895 dependencies: {
2896 "@babel/runtime": "^7.13.10",
2897 "@emotion/babel-plugin": "^11.7.1",
2898 "@emotion/cache": "^11.7.1",
2899 "@emotion/serialize": "^1.0.2",
2900 "@emotion/sheet": "^1.1.0",
2901 "@emotion/utils": "^1.1.0",
2902 "@emotion/weak-memoize": "^0.2.5",
2903 "hoist-non-react-statics": "^3.3.1"
2904 },
2905 peerDependencies: {
2906 "@babel/core": "^7.0.0",
2907 react: ">=16.8.0"
2908 },
2909 peerDependenciesMeta: {
2910 "@babel/core": {
2911 optional: true
2912 },
2913 "@types/react": {
2914 optional: true
2915 }
2916 },
2917 devDependencies: {
2918 "@babel/core": "^7.13.10",
2919 "@emotion/css": "11.7.1",
2920 "@emotion/css-prettifier": "1.0.1",
2921 "@emotion/server": "11.4.0",
2922 "@emotion/styled": "11.8.1",
2923 "@types/react": "^16.9.11",
2924 dtslint: "^0.3.0",
2925 "html-tag-names": "^1.1.2",
2926 react: "16.14.0",
2927 "svg-tag-names": "^1.1.1"
2928 },
2929 repository: "https://github.com/emotion-js/emotion/tree/main/packages/react",
2930 publishConfig: {
2931 access: "public"
2932 },
2933 "umd:main": "dist/emotion-react.umd.min.js",
2934 preconstruct: {
2935 entrypoints: ["./index.js", "./jsx-runtime.js", "./jsx-dev-runtime.js", "./_isolated-hnrs.js"],
2936 umdName: "emotionReact"
2937 }
2938};
2939
2940var jsx = function jsx(type, props) {
2941 var args = arguments;
2942
2943 if (props == null || !hasOwnProperty$1.call(props, 'css')) {
2944 // $FlowFixMe
2945 return React.createElement.apply(undefined, args);
2946 }
2947
2948 var argsLength = args.length;
2949 var createElementArgArray = new Array(argsLength);
2950 createElementArgArray[0] = Emotion;
2951 createElementArgArray[1] = createEmotionProps(type, props);
2952
2953 for (var i = 2; i < argsLength; i++) {
2954 createElementArgArray[i] = args[i];
2955 } // $FlowFixMe
2956
2957
2958 return React.createElement.apply(null, createElementArgArray);
2959};
2960
2961var useInsertionEffect$1 = React__namespace['useInsertion' + 'Effect'] ? React__namespace['useInsertion' + 'Effect'] : React.useLayoutEffect;
2962var warnedAboutCssPropForGlobal = false; // maintain place over rerenders.
2963// initial render from browser, insertBefore context.sheet.tags[0] or if a style hasn't been inserted there yet, appendChild
2964// initial client-side render from SSR, use place of hydrating tag
2965
2966var Global$1 = /* #__PURE__ */withEmotionCache(function (props, cache) {
2967 if (process.env.NODE_ENV !== 'production' && !warnedAboutCssPropForGlobal && ( // check for className as well since the user is
2968 // probably using the custom createElement which
2969 // means it will be turned into a className prop
2970 // $FlowFixMe I don't really want to add it to the type since it shouldn't be used
2971 props.className || props.css)) {
2972 console.error("It looks like you're using the css prop on Global, did you mean to use the styles prop instead?");
2973 warnedAboutCssPropForGlobal = true;
2974 }
2975
2976 var styles = props.styles;
2977 var serialized = serializeStyles$1([styles], undefined, React.useContext(ThemeContext));
2978
2979 if (!isBrowser$4) {
2980 var _ref;
2981
2982 var serializedNames = serialized.name;
2983 var serializedStyles = serialized.styles;
2984 var next = serialized.next;
2985
2986 while (next !== undefined) {
2987 serializedNames += ' ' + next.name;
2988 serializedStyles += next.styles;
2989 next = next.next;
2990 }
2991
2992 var shouldCache = cache.compat === true;
2993 var rules = cache.insert("", {
2994 name: serializedNames,
2995 styles: serializedStyles
2996 }, cache.sheet, shouldCache);
2997
2998 if (shouldCache) {
2999 return null;
3000 }
3001
3002 return /*#__PURE__*/React.createElement("style", (_ref = {}, _ref["data-emotion"] = cache.key + "-global " + serializedNames, _ref.dangerouslySetInnerHTML = {
3003 __html: rules
3004 }, _ref.nonce = cache.sheet.nonce, _ref));
3005 } // yes, i know these hooks are used conditionally
3006 // but it is based on a constant that will never change at runtime
3007 // it's effectively like having two implementations and switching them out
3008 // so it's not actually breaking anything
3009
3010
3011 var sheetRef = React.useRef();
3012 useInsertionEffect$1(function () {
3013 var key = cache.key + "-global";
3014 var sheet = new StyleSheet({
3015 key: key,
3016 nonce: cache.sheet.nonce,
3017 container: cache.sheet.container,
3018 speedy: cache.sheet.isSpeedy
3019 });
3020 var rehydrating = false; // $FlowFixMe
3021
3022 var node = document.querySelector("style[data-emotion=\"" + key + " " + serialized.name + "\"]");
3023
3024 if (cache.sheet.tags.length) {
3025 sheet.before = cache.sheet.tags[0];
3026 }
3027
3028 if (node !== null) {
3029 rehydrating = true; // clear the hash so this node won't be recognizable as rehydratable by other <Global/>s
3030
3031 node.setAttribute('data-emotion', key);
3032 sheet.hydrate([node]);
3033 }
3034
3035 sheetRef.current = [sheet, rehydrating];
3036 return function () {
3037 sheet.flush();
3038 };
3039 }, [cache]);
3040 useInsertionEffect$1(function () {
3041 var sheetRefCurrent = sheetRef.current;
3042 var sheet = sheetRefCurrent[0],
3043 rehydrating = sheetRefCurrent[1];
3044
3045 if (rehydrating) {
3046 sheetRefCurrent[1] = false;
3047 return;
3048 }
3049
3050 if (serialized.next !== undefined) {
3051 // insert keyframes
3052 insertStyles$1(cache, serialized.next, true);
3053 }
3054
3055 if (sheet.tags.length) {
3056 // if this doesn't exist then it will be null so the style element will be appended
3057 var element = sheet.tags[sheet.tags.length - 1].nextElementSibling;
3058 sheet.before = element;
3059 sheet.flush();
3060 }
3061
3062 cache.insert("", serialized, sheet, false);
3063 }, [cache, serialized.name]);
3064 return null;
3065});
3066
3067if (process.env.NODE_ENV !== 'production') {
3068 Global$1.displayName = 'EmotionGlobal';
3069}
3070
3071function css() {
3072 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
3073 args[_key] = arguments[_key];
3074 }
3075
3076 return serializeStyles$1(args);
3077}
3078
3079var keyframes = function keyframes() {
3080 var insertable = css.apply(void 0, arguments);
3081 var name = "animation-" + insertable.name; // $FlowFixMe
3082
3083 return {
3084 name: name,
3085 styles: "@keyframes " + name + "{" + insertable.styles + "}",
3086 anim: 1,
3087 toString: function toString() {
3088 return "_EMO_" + this.name + "_" + this.styles + "_EMO_";
3089 }
3090 };
3091};
3092
3093var classnames = function classnames(args) {
3094 var len = args.length;
3095 var i = 0;
3096 var cls = '';
3097
3098 for (; i < len; i++) {
3099 var arg = args[i];
3100 if (arg == null) continue;
3101 var toAdd = void 0;
3102
3103 switch (typeof arg) {
3104 case 'boolean':
3105 break;
3106
3107 case 'object':
3108 {
3109 if (Array.isArray(arg)) {
3110 toAdd = classnames(arg);
3111 } else {
3112 if (process.env.NODE_ENV !== 'production' && arg.styles !== undefined && arg.name !== undefined) {
3113 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.');
3114 }
3115
3116 toAdd = '';
3117
3118 for (var k in arg) {
3119 if (arg[k] && k) {
3120 toAdd && (toAdd += ' ');
3121 toAdd += k;
3122 }
3123 }
3124 }
3125
3126 break;
3127 }
3128
3129 default:
3130 {
3131 toAdd = arg;
3132 }
3133 }
3134
3135 if (toAdd) {
3136 cls && (cls += ' ');
3137 cls += toAdd;
3138 }
3139 }
3140
3141 return cls;
3142};
3143
3144function merge(registered, css, className) {
3145 var registeredStyles = [];
3146 var rawClassName = getRegisteredStyles$1(registered, registeredStyles, className);
3147
3148 if (registeredStyles.length < 2) {
3149 return className;
3150 }
3151
3152 return rawClassName + css(registeredStyles);
3153}
3154
3155var Insertion$1 = function Insertion(_ref) {
3156 var cache = _ref.cache,
3157 serializedArr = _ref.serializedArr;
3158 var rules = useInsertionEffectMaybe$1(function () {
3159 var rules = '';
3160
3161 for (var i = 0; i < serializedArr.length; i++) {
3162 var res = insertStyles$1(cache, serializedArr[i], false);
3163
3164 if (!isBrowser$4 && res !== undefined) {
3165 rules += res;
3166 }
3167 }
3168
3169 if (!isBrowser$4) {
3170 return rules;
3171 }
3172 });
3173
3174 if (!isBrowser$4 && rules.length !== 0) {
3175 var _ref2;
3176
3177 return /*#__PURE__*/React.createElement("style", (_ref2 = {}, _ref2["data-emotion"] = cache.key + " " + serializedArr.map(function (serialized) {
3178 return serialized.name;
3179 }).join(' '), _ref2.dangerouslySetInnerHTML = {
3180 __html: rules
3181 }, _ref2.nonce = cache.sheet.nonce, _ref2));
3182 }
3183
3184 return null;
3185};
3186
3187var ClassNames = /* #__PURE__ */withEmotionCache(function (props, cache) {
3188 var hasRendered = false;
3189 var serializedArr = [];
3190
3191 var css = function css() {
3192 if (hasRendered && process.env.NODE_ENV !== 'production') {
3193 throw new Error('css can only be used during render');
3194 }
3195
3196 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
3197 args[_key] = arguments[_key];
3198 }
3199
3200 var serialized = serializeStyles$1(args, cache.registered);
3201 serializedArr.push(serialized); // registration has to happen here as the result of this might get consumed by `cx`
3202
3203 registerStyles$1(cache, serialized, false);
3204 return cache.key + "-" + serialized.name;
3205 };
3206
3207 var cx = function cx() {
3208 if (hasRendered && process.env.NODE_ENV !== 'production') {
3209 throw new Error('cx can only be used during render');
3210 }
3211
3212 for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
3213 args[_key2] = arguments[_key2];
3214 }
3215
3216 return merge(cache.registered, css, classnames(args));
3217 };
3218
3219 var content = {
3220 css: css,
3221 cx: cx,
3222 theme: React.useContext(ThemeContext)
3223 };
3224 var ele = props.children(content);
3225 hasRendered = true;
3226 return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Insertion$1, {
3227 cache: cache,
3228 serializedArr: serializedArr
3229 }), ele);
3230});
3231
3232if (process.env.NODE_ENV !== 'production') {
3233 ClassNames.displayName = 'EmotionClassNames';
3234}
3235
3236if (process.env.NODE_ENV !== 'production') {
3237 var isBrowser$3 = typeof document !== 'undefined'; // #1727 for some reason Jest evaluates modules twice if some consuming module gets mocked with jest.mock
3238
3239 var isJest = typeof jest !== 'undefined';
3240
3241 if (isBrowser$3 && !isJest) {
3242 // globalThis has wide browser support - https://caniuse.com/?search=globalThis, Node.js 12 and later
3243 var globalContext = // $FlowIgnore
3244 typeof globalThis !== 'undefined' ? globalThis // eslint-disable-line no-undef
3245 : isBrowser$3 ? window : global;
3246 var globalKey = "__EMOTION_REACT_" + pkg.version.split('.')[0] + "__";
3247
3248 if (globalContext[globalKey]) {
3249 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.');
3250 }
3251
3252 globalContext[globalKey] = true;
3253 }
3254}
3255
3256var isBrowser$2 = typeof document !== 'undefined';
3257
3258function getRegisteredStyles(registered, registeredStyles, classNames) {
3259 var rawClassName = '';
3260 classNames.split(' ').forEach(function (className) {
3261 if (registered[className] !== undefined) {
3262 registeredStyles.push(registered[className] + ";");
3263 } else {
3264 rawClassName += className + " ";
3265 }
3266 });
3267 return rawClassName;
3268}
3269
3270var registerStyles = function registerStyles(cache, serialized, isStringTag) {
3271 var className = cache.key + "-" + serialized.name;
3272
3273 if ( // we only need to add the styles to the registered cache if the
3274 // class name could be used further down
3275 // the tree but if it's a string tag, we know it won't
3276 // so we don't have to add it to registered cache.
3277 // this improves memory usage since we can avoid storing the whole style string
3278 (isStringTag === false || // we need to always store it if we're in compat mode and
3279 // in node since emotion-server relies on whether a style is in
3280 // the registered cache to know whether a style is global or not
3281 // also, note that this check will be dead code eliminated in the browser
3282 isBrowser$2 === false && cache.compat !== undefined) && cache.registered[className] === undefined) {
3283 cache.registered[className] = serialized.styles;
3284 }
3285};
3286
3287var insertStyles = function insertStyles(cache, serialized, isStringTag) {
3288 registerStyles(cache, serialized, isStringTag);
3289 var className = cache.key + "-" + serialized.name;
3290
3291 if (cache.inserted[serialized.name] === undefined) {
3292 var stylesForSSR = '';
3293 var current = serialized;
3294
3295 do {
3296 var maybeStyles = cache.insert(serialized === current ? "." + className : '', current, cache.sheet, true);
3297
3298 if (!isBrowser$2 && maybeStyles !== undefined) {
3299 stylesForSSR += maybeStyles;
3300 }
3301
3302 current = current.next;
3303 } while (current !== undefined);
3304
3305 if (!isBrowser$2 && stylesForSSR.length !== 0) {
3306 return stylesForSSR;
3307 }
3308 }
3309};
3310
3311var ILLEGAL_ESCAPE_SEQUENCE_ERROR$1 = "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";
3312var 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).";
3313var hyphenateRegex = /[A-Z]|^ms/g;
3314var animationRegex = /_EMO_([^_]+?)_([^]*?)_EMO_/g;
3315
3316var isCustomProperty = function isCustomProperty(property) {
3317 return property.charCodeAt(1) === 45;
3318};
3319
3320var isProcessableValue = function isProcessableValue(value) {
3321 return value != null && typeof value !== 'boolean';
3322};
3323
3324var processStyleName = /* #__PURE__ */memoize(function (styleName) {
3325 return isCustomProperty(styleName) ? styleName : styleName.replace(hyphenateRegex, '-$&').toLowerCase();
3326});
3327
3328var processStyleValue = function processStyleValue(key, value) {
3329 switch (key) {
3330 case 'animation':
3331 case 'animationName':
3332 {
3333 if (typeof value === 'string') {
3334 return value.replace(animationRegex, function (match, p1, p2) {
3335 cursor = {
3336 name: p1,
3337 styles: p2,
3338 next: cursor
3339 };
3340 return p1;
3341 });
3342 }
3343 }
3344 }
3345
3346 if (unitlessKeys[key] !== 1 && !isCustomProperty(key) && typeof value === 'number' && value !== 0) {
3347 return value + 'px';
3348 }
3349
3350 return value;
3351};
3352
3353if (process.env.NODE_ENV !== 'production') {
3354 var contentValuePattern = /(attr|counters?|url|(((repeating-)?(linear|radial))|conic)-gradient)\(|(no-)?(open|close)-quote/;
3355 var contentValues = ['normal', 'none', 'initial', 'inherit', 'unset'];
3356 var oldProcessStyleValue = processStyleValue;
3357 var msPattern = /^-ms-/;
3358 var hyphenPattern = /-(.)/g;
3359 var hyphenatedCache = {};
3360
3361 processStyleValue = function processStyleValue(key, value) {
3362 if (key === 'content') {
3363 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) !== "'")) {
3364 throw new Error("You seem to be using a value for 'content' without quotes, try replacing it with `content: '\"" + value + "\"'`");
3365 }
3366 }
3367
3368 var processed = oldProcessStyleValue(key, value);
3369
3370 if (processed !== '' && !isCustomProperty(key) && key.indexOf('-') !== -1 && hyphenatedCache[key] === undefined) {
3371 hyphenatedCache[key] = true;
3372 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) {
3373 return _char.toUpperCase();
3374 }) + "?");
3375 }
3376
3377 return processed;
3378 };
3379}
3380
3381function handleInterpolation(mergedProps, registered, interpolation) {
3382 if (interpolation == null) {
3383 return '';
3384 }
3385
3386 if (interpolation.__emotion_styles !== undefined) {
3387 if (process.env.NODE_ENV !== 'production' && interpolation.toString() === 'NO_COMPONENT_SELECTOR') {
3388 throw new Error('Component selectors can only be used in conjunction with @emotion/babel-plugin.');
3389 }
3390
3391 return interpolation;
3392 }
3393
3394 switch (typeof interpolation) {
3395 case 'boolean':
3396 {
3397 return '';
3398 }
3399
3400 case 'object':
3401 {
3402 if (interpolation.anim === 1) {
3403 cursor = {
3404 name: interpolation.name,
3405 styles: interpolation.styles,
3406 next: cursor
3407 };
3408 return interpolation.name;
3409 }
3410
3411 if (interpolation.styles !== undefined) {
3412 var next = interpolation.next;
3413
3414 if (next !== undefined) {
3415 // not the most efficient thing ever but this is a pretty rare case
3416 // and there will be very few iterations of this generally
3417 while (next !== undefined) {
3418 cursor = {
3419 name: next.name,
3420 styles: next.styles,
3421 next: cursor
3422 };
3423 next = next.next;
3424 }
3425 }
3426
3427 var styles = interpolation.styles + ";";
3428
3429 if (process.env.NODE_ENV !== 'production' && interpolation.map !== undefined) {
3430 styles += interpolation.map;
3431 }
3432
3433 return styles;
3434 }
3435
3436 return createStringFromObject(mergedProps, registered, interpolation);
3437 }
3438
3439 case 'function':
3440 {
3441 if (mergedProps !== undefined) {
3442 var previousCursor = cursor;
3443 var result = interpolation(mergedProps);
3444 cursor = previousCursor;
3445 return handleInterpolation(mergedProps, registered, result);
3446 } else if (process.env.NODE_ENV !== 'production') {
3447 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}`");
3448 }
3449
3450 break;
3451 }
3452
3453 case 'string':
3454 if (process.env.NODE_ENV !== 'production') {
3455 var matched = [];
3456 var replaced = interpolation.replace(animationRegex, function (match, p1, p2) {
3457 var fakeVarName = "animation" + matched.length;
3458 matched.push("const " + fakeVarName + " = keyframes`" + p2.replace(/^@keyframes animation-\w+/, '') + "`");
3459 return "${" + fakeVarName + "}";
3460 });
3461
3462 if (matched.length) {
3463 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 + "`"));
3464 }
3465 }
3466
3467 break;
3468 } // finalize string values (regular strings and functions interpolated into css calls)
3469
3470
3471 if (registered == null) {
3472 return interpolation;
3473 }
3474
3475 var cached = registered[interpolation];
3476 return cached !== undefined ? cached : interpolation;
3477}
3478
3479function createStringFromObject(mergedProps, registered, obj) {
3480 var string = '';
3481
3482 if (Array.isArray(obj)) {
3483 for (var i = 0; i < obj.length; i++) {
3484 string += handleInterpolation(mergedProps, registered, obj[i]) + ";";
3485 }
3486 } else {
3487 for (var _key in obj) {
3488 var value = obj[_key];
3489
3490 if (typeof value !== 'object') {
3491 if (registered != null && registered[value] !== undefined) {
3492 string += _key + "{" + registered[value] + "}";
3493 } else if (isProcessableValue(value)) {
3494 string += processStyleName(_key) + ":" + processStyleValue(_key, value) + ";";
3495 }
3496 } else {
3497 if (_key === 'NO_COMPONENT_SELECTOR' && process.env.NODE_ENV !== 'production') {
3498 throw new Error('Component selectors can only be used in conjunction with @emotion/babel-plugin.');
3499 }
3500
3501 if (Array.isArray(value) && typeof value[0] === 'string' && (registered == null || registered[value[0]] === undefined)) {
3502 for (var _i = 0; _i < value.length; _i++) {
3503 if (isProcessableValue(value[_i])) {
3504 string += processStyleName(_key) + ":" + processStyleValue(_key, value[_i]) + ";";
3505 }
3506 }
3507 } else {
3508 var interpolated = handleInterpolation(mergedProps, registered, value);
3509
3510 switch (_key) {
3511 case 'animation':
3512 case 'animationName':
3513 {
3514 string += processStyleName(_key) + ":" + interpolated + ";";
3515 break;
3516 }
3517
3518 default:
3519 {
3520 if (process.env.NODE_ENV !== 'production' && _key === 'undefined') {
3521 console.error(UNDEFINED_AS_OBJECT_KEY_ERROR);
3522 }
3523
3524 string += _key + "{" + interpolated + "}";
3525 }
3526 }
3527 }
3528 }
3529 }
3530 }
3531
3532 return string;
3533}
3534
3535var labelPattern = /label:\s*([^\s;\n{]+)\s*(;|$)/g;
3536var sourceMapPattern;
3537
3538if (process.env.NODE_ENV !== 'production') {
3539 sourceMapPattern = /\/\*#\ssourceMappingURL=data:application\/json;\S+\s+\*\//g;
3540} // this is the cursor for keyframes
3541// keyframes are stored on the SerializedStyles object as a linked list
3542
3543
3544var cursor;
3545
3546var serializeStyles = function serializeStyles(args, registered, mergedProps) {
3547 if (args.length === 1 && typeof args[0] === 'object' && args[0] !== null && args[0].styles !== undefined) {
3548 return args[0];
3549 }
3550
3551 var stringMode = true;
3552 var styles = '';
3553 cursor = undefined;
3554 var strings = args[0];
3555
3556 if (strings == null || strings.raw === undefined) {
3557 stringMode = false;
3558 styles += handleInterpolation(mergedProps, registered, strings);
3559 } else {
3560 if (process.env.NODE_ENV !== 'production' && strings[0] === undefined) {
3561 console.error(ILLEGAL_ESCAPE_SEQUENCE_ERROR$1);
3562 }
3563
3564 styles += strings[0];
3565 } // we start at 1 since we've already handled the first arg
3566
3567
3568 for (var i = 1; i < args.length; i++) {
3569 styles += handleInterpolation(mergedProps, registered, args[i]);
3570
3571 if (stringMode) {
3572 if (process.env.NODE_ENV !== 'production' && strings[i] === undefined) {
3573 console.error(ILLEGAL_ESCAPE_SEQUENCE_ERROR$1);
3574 }
3575
3576 styles += strings[i];
3577 }
3578 }
3579
3580 var sourceMap;
3581
3582 if (process.env.NODE_ENV !== 'production') {
3583 styles = styles.replace(sourceMapPattern, function (match) {
3584 sourceMap = match;
3585 return '';
3586 });
3587 } // using a global regex with .exec is stateful so lastIndex has to be reset each time
3588
3589
3590 labelPattern.lastIndex = 0;
3591 var identifierName = '';
3592 var match; // https://esbench.com/bench/5b809c2cf2949800a0f61fb5
3593
3594 while ((match = labelPattern.exec(styles)) !== null) {
3595 identifierName += '-' + // $FlowFixMe we know it's not null
3596 match[1];
3597 }
3598
3599 var name = murmur2(styles) + identifierName;
3600
3601 if (process.env.NODE_ENV !== 'production') {
3602 // $FlowFixMe SerializedStyles type doesn't have toString property (and we don't want to add it)
3603 return {
3604 name: name,
3605 styles: styles,
3606 map: sourceMap,
3607 next: cursor,
3608 toString: function toString() {
3609 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).";
3610 }
3611 };
3612 }
3613
3614 return {
3615 name: name,
3616 styles: styles,
3617 next: cursor
3618 };
3619};
3620
3621var testOmitPropsOnStringTag = isPropValid;
3622
3623var testOmitPropsOnComponent = function testOmitPropsOnComponent(key) {
3624 return key !== 'theme';
3625};
3626
3627var getDefaultShouldForwardProp = function getDefaultShouldForwardProp(tag) {
3628 return typeof tag === 'string' && // 96 is one less than the char code
3629 // for "a" so this is checking that
3630 // it's a lowercase character
3631 tag.charCodeAt(0) > 96 ? testOmitPropsOnStringTag : testOmitPropsOnComponent;
3632};
3633
3634var composeShouldForwardProps = function composeShouldForwardProps(tag, options, isReal) {
3635 var shouldForwardProp;
3636
3637 if (options) {
3638 var optionsShouldForwardProp = options.shouldForwardProp;
3639 shouldForwardProp = tag.__emotion_forwardProp && optionsShouldForwardProp ? function (propName) {
3640 return tag.__emotion_forwardProp(propName) && optionsShouldForwardProp(propName);
3641 } : optionsShouldForwardProp;
3642 }
3643
3644 if (typeof shouldForwardProp !== 'function' && isReal) {
3645 shouldForwardProp = tag.__emotion_forwardProp;
3646 }
3647
3648 return shouldForwardProp;
3649};
3650
3651var isBrowser = typeof document !== 'undefined';
3652var useInsertionEffect = React__namespace['useInsertion' + 'Effect'] ? React__namespace['useInsertion' + 'Effect'] : function useInsertionEffect(create) {
3653 create();
3654};
3655
3656function useInsertionEffectMaybe(create) {
3657 if (!isBrowser) {
3658 return create();
3659 }
3660
3661 useInsertionEffect(create);
3662}
3663
3664var 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";
3665var isBrowser$1 = typeof document !== 'undefined';
3666
3667var Insertion = function Insertion(_ref) {
3668 var cache = _ref.cache,
3669 serialized = _ref.serialized,
3670 isStringTag = _ref.isStringTag;
3671 registerStyles(cache, serialized, isStringTag);
3672 var rules = useInsertionEffectMaybe(function () {
3673 return insertStyles(cache, serialized, isStringTag);
3674 });
3675
3676 if (!isBrowser$1 && rules !== undefined) {
3677 var _ref2;
3678
3679 var serializedNames = serialized.name;
3680 var next = serialized.next;
3681
3682 while (next !== undefined) {
3683 serializedNames += ' ' + next.name;
3684 next = next.next;
3685 }
3686
3687 return /*#__PURE__*/React.createElement("style", (_ref2 = {}, _ref2["data-emotion"] = cache.key + " " + serializedNames, _ref2.dangerouslySetInnerHTML = {
3688 __html: rules
3689 }, _ref2.nonce = cache.sheet.nonce, _ref2));
3690 }
3691
3692 return null;
3693};
3694
3695var createStyled = function createStyled(tag, options) {
3696 if (process.env.NODE_ENV !== 'production') {
3697 if (tag === undefined) {
3698 throw new Error('You are trying to create a styled element with an undefined component.\nYou may have forgotten to import it.');
3699 }
3700 }
3701
3702 var isReal = tag.__emotion_real === tag;
3703 var baseTag = isReal && tag.__emotion_base || tag;
3704 var identifierName;
3705 var targetClassName;
3706
3707 if (options !== undefined) {
3708 identifierName = options.label;
3709 targetClassName = options.target;
3710 }
3711
3712 var shouldForwardProp = composeShouldForwardProps(tag, options, isReal);
3713 var defaultShouldForwardProp = shouldForwardProp || getDefaultShouldForwardProp(baseTag);
3714 var shouldUseAs = !defaultShouldForwardProp('as');
3715 return function () {
3716 var args = arguments;
3717 var styles = isReal && tag.__emotion_styles !== undefined ? tag.__emotion_styles.slice(0) : [];
3718
3719 if (identifierName !== undefined) {
3720 styles.push("label:" + identifierName + ";");
3721 }
3722
3723 if (args[0] == null || args[0].raw === undefined) {
3724 styles.push.apply(styles, args);
3725 } else {
3726 if (process.env.NODE_ENV !== 'production' && args[0][0] === undefined) {
3727 console.error(ILLEGAL_ESCAPE_SEQUENCE_ERROR);
3728 }
3729
3730 styles.push(args[0][0]);
3731 var len = args.length;
3732 var i = 1;
3733
3734 for (; i < len; i++) {
3735 if (process.env.NODE_ENV !== 'production' && args[0][i] === undefined) {
3736 console.error(ILLEGAL_ESCAPE_SEQUENCE_ERROR);
3737 }
3738
3739 styles.push(args[i], args[0][i]);
3740 }
3741 } // $FlowFixMe: we need to cast StatelessFunctionalComponent to our PrivateStyledComponent class
3742
3743
3744 var Styled = withEmotionCache(function (props, cache, ref) {
3745 var FinalTag = shouldUseAs && props.as || baseTag;
3746 var className = '';
3747 var classInterpolations = [];
3748 var mergedProps = props;
3749
3750 if (props.theme == null) {
3751 mergedProps = {};
3752
3753 for (var key in props) {
3754 mergedProps[key] = props[key];
3755 }
3756
3757 mergedProps.theme = React.useContext(ThemeContext);
3758 }
3759
3760 if (typeof props.className === 'string') {
3761 className = getRegisteredStyles(cache.registered, classInterpolations, props.className);
3762 } else if (props.className != null) {
3763 className = props.className + " ";
3764 }
3765
3766 var serialized = serializeStyles(styles.concat(classInterpolations), cache.registered, mergedProps);
3767 className += cache.key + "-" + serialized.name;
3768
3769 if (targetClassName !== undefined) {
3770 className += " " + targetClassName;
3771 }
3772
3773 var finalShouldForwardProp = shouldUseAs && shouldForwardProp === undefined ? getDefaultShouldForwardProp(FinalTag) : defaultShouldForwardProp;
3774 var newProps = {};
3775
3776 for (var _key in props) {
3777 if (shouldUseAs && _key === 'as') continue;
3778
3779 if ( // $FlowFixMe
3780 finalShouldForwardProp(_key)) {
3781 newProps[_key] = props[_key];
3782 }
3783 }
3784
3785 newProps.className = className;
3786 newProps.ref = ref;
3787 return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Insertion, {
3788 cache: cache,
3789 serialized: serialized,
3790 isStringTag: typeof FinalTag === 'string'
3791 }), /*#__PURE__*/React.createElement(FinalTag, newProps));
3792 });
3793 Styled.displayName = identifierName !== undefined ? identifierName : "Styled(" + (typeof baseTag === 'string' ? baseTag : baseTag.displayName || baseTag.name || 'Component') + ")";
3794 Styled.defaultProps = tag.defaultProps;
3795 Styled.__emotion_real = Styled;
3796 Styled.__emotion_base = baseTag;
3797 Styled.__emotion_styles = styles;
3798 Styled.__emotion_forwardProp = shouldForwardProp;
3799 Object.defineProperty(Styled, 'toString', {
3800 value: function value() {
3801 if (targetClassName === undefined && process.env.NODE_ENV !== 'production') {
3802 return 'NO_COMPONENT_SELECTOR';
3803 } // $FlowFixMe: coerce undefined to string
3804
3805
3806 return "." + targetClassName;
3807 }
3808 });
3809
3810 Styled.withComponent = function (nextTag, nextOptions) {
3811 return createStyled(nextTag, _extends$1({}, options, nextOptions, {
3812 shouldForwardProp: composeShouldForwardProps(Styled, nextOptions, true)
3813 })).apply(void 0, styles);
3814 };
3815
3816 return Styled;
3817 };
3818};
3819
3820var tags = ['a', 'abbr', 'address', 'area', 'article', 'aside', 'audio', 'b', 'base', 'bdi', 'bdo', 'big', 'blockquote', 'body', 'br', 'button', 'canvas', 'caption', 'cite', 'code', 'col', 'colgroup', 'data', 'datalist', 'dd', 'del', 'details', 'dfn', 'dialog', 'div', 'dl', 'dt', 'em', 'embed', 'fieldset', 'figcaption', 'figure', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'i', 'iframe', 'img', 'input', 'ins', 'kbd', 'keygen', 'label', 'legend', 'li', 'link', 'main', 'map', 'mark', 'marquee', 'menu', 'menuitem', 'meta', 'meter', 'nav', 'noscript', 'object', 'ol', 'optgroup', 'option', 'output', 'p', 'param', 'picture', 'pre', 'progress', 'q', 'rp', 'rt', 'ruby', 's', 'samp', 'script', 'section', 'select', 'small', 'source', 'span', 'strong', 'style', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'textarea', 'tfoot', 'th', 'thead', 'time', 'title', 'tr', 'track', 'u', 'ul', 'var', 'video', 'wbr', // SVG
3821'circle', 'clipPath', 'defs', 'ellipse', 'foreignObject', 'g', 'image', 'line', 'linearGradient', 'mask', 'path', 'pattern', 'polygon', 'polyline', 'radialGradient', 'rect', 'stop', 'svg', 'text', 'tspan'];
3822var newStyled = createStyled.bind();
3823tags.forEach(function (tagName) {
3824 // $FlowFixMe: we can ignore this because its exposed type is defined by the CreateStyled type
3825 newStyled[tagName] = newStyled(tagName);
3826});
3827
3828function _extends() {
3829 _extends = Object.assign || function (target) {
3830 for (var i = 1; i < arguments.length; i++) {
3831 var source = arguments[i];
3832
3833 for (var key in source) {
3834 if (Object.prototype.hasOwnProperty.call(source, key)) {
3835 target[key] = source[key];
3836 }
3837 }
3838 }
3839
3840 return target;
3841 };
3842
3843 return _extends.apply(this, arguments);
3844}
3845
3846function _assertThisInitialized(self) {
3847 if (self === void 0) {
3848 throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
3849 }
3850
3851 return self;
3852}
3853
3854function _setPrototypeOf(o, p) {
3855 _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
3856 o.__proto__ = p;
3857 return o;
3858 };
3859
3860 return _setPrototypeOf(o, p);
3861}
3862
3863function _inheritsLoose(subClass, superClass) {
3864 subClass.prototype = Object.create(superClass.prototype);
3865 subClass.prototype.constructor = subClass;
3866
3867 _setPrototypeOf(subClass, superClass);
3868}
3869
3870function _getPrototypeOf(o) {
3871 _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
3872 return o.__proto__ || Object.getPrototypeOf(o);
3873 };
3874 return _getPrototypeOf(o);
3875}
3876
3877function _isNativeFunction(fn) {
3878 return Function.toString.call(fn).indexOf("[native code]") !== -1;
3879}
3880
3881function _isNativeReflectConstruct() {
3882 if (typeof Reflect === "undefined" || !Reflect.construct) return false;
3883 if (Reflect.construct.sham) return false;
3884 if (typeof Proxy === "function") return true;
3885
3886 try {
3887 Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
3888 return true;
3889 } catch (e) {
3890 return false;
3891 }
3892}
3893
3894function _construct(Parent, args, Class) {
3895 if (_isNativeReflectConstruct()) {
3896 _construct = Reflect.construct;
3897 } else {
3898 _construct = function _construct(Parent, args, Class) {
3899 var a = [null];
3900 a.push.apply(a, args);
3901 var Constructor = Function.bind.apply(Parent, a);
3902 var instance = new Constructor();
3903 if (Class) _setPrototypeOf(instance, Class.prototype);
3904 return instance;
3905 };
3906 }
3907
3908 return _construct.apply(null, arguments);
3909}
3910
3911function _wrapNativeSuper(Class) {
3912 var _cache = typeof Map === "function" ? new Map() : undefined;
3913
3914 _wrapNativeSuper = function _wrapNativeSuper(Class) {
3915 if (Class === null || !_isNativeFunction(Class)) return Class;
3916
3917 if (typeof Class !== "function") {
3918 throw new TypeError("Super expression must either be null or a function");
3919 }
3920
3921 if (typeof _cache !== "undefined") {
3922 if (_cache.has(Class)) return _cache.get(Class);
3923
3924 _cache.set(Class, Wrapper);
3925 }
3926
3927 function Wrapper() {
3928 return _construct(Class, arguments, _getPrototypeOf(this).constructor);
3929 }
3930
3931 Wrapper.prototype = Object.create(Class.prototype, {
3932 constructor: {
3933 value: Wrapper,
3934 enumerable: false,
3935 writable: true,
3936 configurable: true
3937 }
3938 });
3939 return _setPrototypeOf(Wrapper, Class);
3940 };
3941
3942 return _wrapNativeSuper(Class);
3943}
3944/**
3945 * Parse errors.md and turn it into a simple hash of code: message
3946 * @private
3947 */
3948
3949
3950var ERRORS = {
3951 "1": "Passed invalid arguments to hsl, please pass multiple numbers e.g. hsl(360, 0.75, 0.4) or an object e.g. rgb({ hue: 255, saturation: 0.4, lightness: 0.75 }).\n\n",
3952 "2": "Passed invalid arguments to hsla, please pass multiple numbers e.g. hsla(360, 0.75, 0.4, 0.7) or an object e.g. rgb({ hue: 255, saturation: 0.4, lightness: 0.75, alpha: 0.7 }).\n\n",
3953 "3": "Passed an incorrect argument to a color function, please pass a string representation of a color.\n\n",
3954 "4": "Couldn't generate valid rgb string from %s, it returned %s.\n\n",
3955 "5": "Couldn't parse the color string. Please provide the color as a string in hex, rgb, rgba, hsl or hsla notation.\n\n",
3956 "6": "Passed invalid arguments to rgb, please pass multiple numbers e.g. rgb(255, 205, 100) or an object e.g. rgb({ red: 255, green: 205, blue: 100 }).\n\n",
3957 "7": "Passed invalid arguments to rgba, please pass multiple numbers e.g. rgb(255, 205, 100, 0.75) or an object e.g. rgb({ red: 255, green: 205, blue: 100, alpha: 0.75 }).\n\n",
3958 "8": "Passed invalid argument to toColorString, please pass a RgbColor, RgbaColor, HslColor or HslaColor object.\n\n",
3959 "9": "Please provide a number of steps to the modularScale helper.\n\n",
3960 "10": "Please pass a number or one of the predefined scales to the modularScale helper as the ratio.\n\n",
3961 "11": "Invalid value passed as base to modularScale, expected number or em string but got \"%s\"\n\n",
3962 "12": "Expected a string ending in \"px\" or a number passed as the first argument to %s(), got \"%s\" instead.\n\n",
3963 "13": "Expected a string ending in \"px\" or a number passed as the second argument to %s(), got \"%s\" instead.\n\n",
3964 "14": "Passed invalid pixel value (\"%s\") to %s(), please pass a value like \"12px\" or 12.\n\n",
3965 "15": "Passed invalid base value (\"%s\") to %s(), please pass a value like \"12px\" or 12.\n\n",
3966 "16": "You must provide a template to this method.\n\n",
3967 "17": "You passed an unsupported selector state to this method.\n\n",
3968 "18": "minScreen and maxScreen must be provided as stringified numbers with the same units.\n\n",
3969 "19": "fromSize and toSize must be provided as stringified numbers with the same units.\n\n",
3970 "20": "expects either an array of objects or a single object with the properties prop, fromSize, and toSize.\n\n",
3971 "21": "expects the objects in the first argument array to have the properties `prop`, `fromSize`, and `toSize`.\n\n",
3972 "22": "expects the first argument object to have the properties `prop`, `fromSize`, and `toSize`.\n\n",
3973 "23": "fontFace expects a name of a font-family.\n\n",
3974 "24": "fontFace expects either the path to the font file(s) or a name of a local copy.\n\n",
3975 "25": "fontFace expects localFonts to be an array.\n\n",
3976 "26": "fontFace expects fileFormats to be an array.\n\n",
3977 "27": "radialGradient requries at least 2 color-stops to properly render.\n\n",
3978 "28": "Please supply a filename to retinaImage() as the first argument.\n\n",
3979 "29": "Passed invalid argument to triangle, please pass correct pointingDirection e.g. 'right'.\n\n",
3980 "30": "Passed an invalid value to `height` or `width`. Please provide a pixel based unit.\n\n",
3981 "31": "The animation shorthand only takes 8 arguments. See the specification for more information: http://mdn.io/animation\n\n",
3982 "32": "To pass multiple animations please supply them in arrays, e.g. animation(['rotate', '2s'], ['move', '1s'])\nTo pass a single animation please supply them in simple values, e.g. animation('rotate', '2s')\n\n",
3983 "33": "The animation shorthand arrays can only have 8 elements. See the specification for more information: http://mdn.io/animation\n\n",
3984 "34": "borderRadius expects a radius value as a string or number as the second argument.\n\n",
3985 "35": "borderRadius expects one of \"top\", \"bottom\", \"left\" or \"right\" as the first argument.\n\n",
3986 "36": "Property must be a string value.\n\n",
3987 "37": "Syntax Error at %s.\n\n",
3988 "38": "Formula contains a function that needs parentheses at %s.\n\n",
3989 "39": "Formula is missing closing parenthesis at %s.\n\n",
3990 "40": "Formula has too many closing parentheses at %s.\n\n",
3991 "41": "All values in a formula must have the same unit or be unitless.\n\n",
3992 "42": "Please provide a number of steps to the modularScale helper.\n\n",
3993 "43": "Please pass a number or one of the predefined scales to the modularScale helper as the ratio.\n\n",
3994 "44": "Invalid value passed as base to modularScale, expected number or em/rem string but got %s.\n\n",
3995 "45": "Passed invalid argument to hslToColorString, please pass a HslColor or HslaColor object.\n\n",
3996 "46": "Passed invalid argument to rgbToColorString, please pass a RgbColor or RgbaColor object.\n\n",
3997 "47": "minScreen and maxScreen must be provided as stringified numbers with the same units.\n\n",
3998 "48": "fromSize and toSize must be provided as stringified numbers with the same units.\n\n",
3999 "49": "Expects either an array of objects or a single object with the properties prop, fromSize, and toSize.\n\n",
4000 "50": "Expects the objects in the first argument array to have the properties prop, fromSize, and toSize.\n\n",
4001 "51": "Expects the first argument object to have the properties prop, fromSize, and toSize.\n\n",
4002 "52": "fontFace expects either the path to the font file(s) or a name of a local copy.\n\n",
4003 "53": "fontFace expects localFonts to be an array.\n\n",
4004 "54": "fontFace expects fileFormats to be an array.\n\n",
4005 "55": "fontFace expects a name of a font-family.\n\n",
4006 "56": "linearGradient requries at least 2 color-stops to properly render.\n\n",
4007 "57": "radialGradient requries at least 2 color-stops to properly render.\n\n",
4008 "58": "Please supply a filename to retinaImage() as the first argument.\n\n",
4009 "59": "Passed invalid argument to triangle, please pass correct pointingDirection e.g. 'right'.\n\n",
4010 "60": "Passed an invalid value to `height` or `width`. Please provide a pixel based unit.\n\n",
4011 "61": "Property must be a string value.\n\n",
4012 "62": "borderRadius expects a radius value as a string or number as the second argument.\n\n",
4013 "63": "borderRadius expects one of \"top\", \"bottom\", \"left\" or \"right\" as the first argument.\n\n",
4014 "64": "The animation shorthand only takes 8 arguments. See the specification for more information: http://mdn.io/animation.\n\n",
4015 "65": "To pass multiple animations please supply them in arrays, e.g. animation(['rotate', '2s'], ['move', '1s'])\\nTo pass a single animation please supply them in simple values, e.g. animation('rotate', '2s').\n\n",
4016 "66": "The animation shorthand arrays can only have 8 elements. See the specification for more information: http://mdn.io/animation.\n\n",
4017 "67": "You must provide a template to this method.\n\n",
4018 "68": "You passed an unsupported selector state to this method.\n\n",
4019 "69": "Expected a string ending in \"px\" or a number passed as the first argument to %s(), got %s instead.\n\n",
4020 "70": "Expected a string ending in \"px\" or a number passed as the second argument to %s(), got %s instead.\n\n",
4021 "71": "Passed invalid pixel value %s to %s(), please pass a value like \"12px\" or 12.\n\n",
4022 "72": "Passed invalid base value %s to %s(), please pass a value like \"12px\" or 12.\n\n",
4023 "73": "Please provide a valid CSS variable.\n\n",
4024 "74": "CSS variable not found and no default was provided.\n\n",
4025 "75": "important requires a valid style object, got a %s instead.\n\n",
4026 "76": "fromSize and toSize must be provided as stringified numbers with the same units as minScreen and maxScreen.\n\n",
4027 "77": "remToPx expects a value in \"rem\" but you provided it in \"%s\".\n\n",
4028 "78": "base must be set in \"px\" or \"%\" but you set it in \"%s\".\n"
4029};
4030/**
4031 * super basic version of sprintf
4032 * @private
4033 */
4034
4035function format() {
4036 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
4037 args[_key] = arguments[_key];
4038 }
4039
4040 var a = args[0];
4041 var b = [];
4042 var c;
4043
4044 for (c = 1; c < args.length; c += 1) {
4045 b.push(args[c]);
4046 }
4047
4048 b.forEach(function (d) {
4049 a = a.replace(/%[a-z]/, d);
4050 });
4051 return a;
4052}
4053/**
4054 * Create an error file out of errors.md for development and a simple web link to the full errors
4055 * in production mode.
4056 * @private
4057 */
4058
4059
4060var PolishedError = /*#__PURE__*/function (_Error) {
4061 _inheritsLoose(PolishedError, _Error);
4062
4063 function PolishedError(code) {
4064 var _this;
4065
4066 if (process.env.NODE_ENV === 'production') {
4067 _this = _Error.call(this, "An error occurred. See https://github.com/styled-components/polished/blob/main/src/internalHelpers/errors.md#" + code + " for more information.") || this;
4068 } else {
4069 for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
4070 args[_key2 - 1] = arguments[_key2];
4071 }
4072
4073 _this = _Error.call(this, format.apply(void 0, [ERRORS[code]].concat(args))) || this;
4074 }
4075
4076 return _assertThisInitialized(_this);
4077 }
4078
4079 return PolishedError;
4080}( /*#__PURE__*/_wrapNativeSuper(Error));
4081
4082function colorToInt(color) {
4083 return Math.round(color * 255);
4084}
4085
4086function convertToInt(red, green, blue) {
4087 return colorToInt(red) + "," + colorToInt(green) + "," + colorToInt(blue);
4088}
4089
4090function hslToRgb(hue, saturation, lightness, convert) {
4091 if (convert === void 0) {
4092 convert = convertToInt;
4093 }
4094
4095 if (saturation === 0) {
4096 // achromatic
4097 return convert(lightness, lightness, lightness);
4098 } // formulae from https://en.wikipedia.org/wiki/HSL_and_HSV
4099
4100
4101 var huePrime = (hue % 360 + 360) % 360 / 60;
4102 var chroma = (1 - Math.abs(2 * lightness - 1)) * saturation;
4103 var secondComponent = chroma * (1 - Math.abs(huePrime % 2 - 1));
4104 var red = 0;
4105 var green = 0;
4106 var blue = 0;
4107
4108 if (huePrime >= 0 && huePrime < 1) {
4109 red = chroma;
4110 green = secondComponent;
4111 } else if (huePrime >= 1 && huePrime < 2) {
4112 red = secondComponent;
4113 green = chroma;
4114 } else if (huePrime >= 2 && huePrime < 3) {
4115 green = chroma;
4116 blue = secondComponent;
4117 } else if (huePrime >= 3 && huePrime < 4) {
4118 green = secondComponent;
4119 blue = chroma;
4120 } else if (huePrime >= 4 && huePrime < 5) {
4121 red = secondComponent;
4122 blue = chroma;
4123 } else if (huePrime >= 5 && huePrime < 6) {
4124 red = chroma;
4125 blue = secondComponent;
4126 }
4127
4128 var lightnessModification = lightness - chroma / 2;
4129 var finalRed = red + lightnessModification;
4130 var finalGreen = green + lightnessModification;
4131 var finalBlue = blue + lightnessModification;
4132 return convert(finalRed, finalGreen, finalBlue);
4133}
4134
4135var namedColorMap = {
4136 aliceblue: 'f0f8ff',
4137 antiquewhite: 'faebd7',
4138 aqua: '00ffff',
4139 aquamarine: '7fffd4',
4140 azure: 'f0ffff',
4141 beige: 'f5f5dc',
4142 bisque: 'ffe4c4',
4143 black: '000',
4144 blanchedalmond: 'ffebcd',
4145 blue: '0000ff',
4146 blueviolet: '8a2be2',
4147 brown: 'a52a2a',
4148 burlywood: 'deb887',
4149 cadetblue: '5f9ea0',
4150 chartreuse: '7fff00',
4151 chocolate: 'd2691e',
4152 coral: 'ff7f50',
4153 cornflowerblue: '6495ed',
4154 cornsilk: 'fff8dc',
4155 crimson: 'dc143c',
4156 cyan: '00ffff',
4157 darkblue: '00008b',
4158 darkcyan: '008b8b',
4159 darkgoldenrod: 'b8860b',
4160 darkgray: 'a9a9a9',
4161 darkgreen: '006400',
4162 darkgrey: 'a9a9a9',
4163 darkkhaki: 'bdb76b',
4164 darkmagenta: '8b008b',
4165 darkolivegreen: '556b2f',
4166 darkorange: 'ff8c00',
4167 darkorchid: '9932cc',
4168 darkred: '8b0000',
4169 darksalmon: 'e9967a',
4170 darkseagreen: '8fbc8f',
4171 darkslateblue: '483d8b',
4172 darkslategray: '2f4f4f',
4173 darkslategrey: '2f4f4f',
4174 darkturquoise: '00ced1',
4175 darkviolet: '9400d3',
4176 deeppink: 'ff1493',
4177 deepskyblue: '00bfff',
4178 dimgray: '696969',
4179 dimgrey: '696969',
4180 dodgerblue: '1e90ff',
4181 firebrick: 'b22222',
4182 floralwhite: 'fffaf0',
4183 forestgreen: '228b22',
4184 fuchsia: 'ff00ff',
4185 gainsboro: 'dcdcdc',
4186 ghostwhite: 'f8f8ff',
4187 gold: 'ffd700',
4188 goldenrod: 'daa520',
4189 gray: '808080',
4190 green: '008000',
4191 greenyellow: 'adff2f',
4192 grey: '808080',
4193 honeydew: 'f0fff0',
4194 hotpink: 'ff69b4',
4195 indianred: 'cd5c5c',
4196 indigo: '4b0082',
4197 ivory: 'fffff0',
4198 khaki: 'f0e68c',
4199 lavender: 'e6e6fa',
4200 lavenderblush: 'fff0f5',
4201 lawngreen: '7cfc00',
4202 lemonchiffon: 'fffacd',
4203 lightblue: 'add8e6',
4204 lightcoral: 'f08080',
4205 lightcyan: 'e0ffff',
4206 lightgoldenrodyellow: 'fafad2',
4207 lightgray: 'd3d3d3',
4208 lightgreen: '90ee90',
4209 lightgrey: 'd3d3d3',
4210 lightpink: 'ffb6c1',
4211 lightsalmon: 'ffa07a',
4212 lightseagreen: '20b2aa',
4213 lightskyblue: '87cefa',
4214 lightslategray: '789',
4215 lightslategrey: '789',
4216 lightsteelblue: 'b0c4de',
4217 lightyellow: 'ffffe0',
4218 lime: '0f0',
4219 limegreen: '32cd32',
4220 linen: 'faf0e6',
4221 magenta: 'f0f',
4222 maroon: '800000',
4223 mediumaquamarine: '66cdaa',
4224 mediumblue: '0000cd',
4225 mediumorchid: 'ba55d3',
4226 mediumpurple: '9370db',
4227 mediumseagreen: '3cb371',
4228 mediumslateblue: '7b68ee',
4229 mediumspringgreen: '00fa9a',
4230 mediumturquoise: '48d1cc',
4231 mediumvioletred: 'c71585',
4232 midnightblue: '191970',
4233 mintcream: 'f5fffa',
4234 mistyrose: 'ffe4e1',
4235 moccasin: 'ffe4b5',
4236 navajowhite: 'ffdead',
4237 navy: '000080',
4238 oldlace: 'fdf5e6',
4239 olive: '808000',
4240 olivedrab: '6b8e23',
4241 orange: 'ffa500',
4242 orangered: 'ff4500',
4243 orchid: 'da70d6',
4244 palegoldenrod: 'eee8aa',
4245 palegreen: '98fb98',
4246 paleturquoise: 'afeeee',
4247 palevioletred: 'db7093',
4248 papayawhip: 'ffefd5',
4249 peachpuff: 'ffdab9',
4250 peru: 'cd853f',
4251 pink: 'ffc0cb',
4252 plum: 'dda0dd',
4253 powderblue: 'b0e0e6',
4254 purple: '800080',
4255 rebeccapurple: '639',
4256 red: 'f00',
4257 rosybrown: 'bc8f8f',
4258 royalblue: '4169e1',
4259 saddlebrown: '8b4513',
4260 salmon: 'fa8072',
4261 sandybrown: 'f4a460',
4262 seagreen: '2e8b57',
4263 seashell: 'fff5ee',
4264 sienna: 'a0522d',
4265 silver: 'c0c0c0',
4266 skyblue: '87ceeb',
4267 slateblue: '6a5acd',
4268 slategray: '708090',
4269 slategrey: '708090',
4270 snow: 'fffafa',
4271 springgreen: '00ff7f',
4272 steelblue: '4682b4',
4273 tan: 'd2b48c',
4274 teal: '008080',
4275 thistle: 'd8bfd8',
4276 tomato: 'ff6347',
4277 turquoise: '40e0d0',
4278 violet: 'ee82ee',
4279 wheat: 'f5deb3',
4280 white: 'fff',
4281 whitesmoke: 'f5f5f5',
4282 yellow: 'ff0',
4283 yellowgreen: '9acd32'
4284};
4285/**
4286 * Checks if a string is a CSS named color and returns its equivalent hex value, otherwise returns the original color.
4287 * @private
4288 */
4289
4290function nameToHex(color) {
4291 if (typeof color !== 'string') return color;
4292 var normalizedColorName = color.toLowerCase();
4293 return namedColorMap[normalizedColorName] ? "#" + namedColorMap[normalizedColorName] : color;
4294}
4295
4296var hexRegex = /^#[a-fA-F0-9]{6}$/;
4297var hexRgbaRegex = /^#[a-fA-F0-9]{8}$/;
4298var reducedHexRegex = /^#[a-fA-F0-9]{3}$/;
4299var reducedRgbaHexRegex = /^#[a-fA-F0-9]{4}$/;
4300var rgbRegex = /^rgb\(\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*\)$/i;
4301var rgbaRegex = /^rgb(?:a)?\(\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,|\/)\s*([-+]?\d*[.]?\d+[%]?)\s*\)$/i;
4302var hslRegex = /^hsl\(\s*(\d{0,3}[.]?[0-9]+(?:deg)?)\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*\)$/i;
4303var hslaRegex = /^hsl(?:a)?\(\s*(\d{0,3}[.]?[0-9]+(?:deg)?)\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,|\/)\s*([-+]?\d*[.]?\d+[%]?)\s*\)$/i;
4304/**
4305 * Returns an RgbColor or RgbaColor object. This utility function is only useful
4306 * if want to extract a color component. With the color util `toColorString` you
4307 * can convert a RgbColor or RgbaColor object back to a string.
4308 *
4309 * @example
4310 * // Assigns `{ red: 255, green: 0, blue: 0 }` to color1
4311 * const color1 = parseToRgb('rgb(255, 0, 0)');
4312 * // Assigns `{ red: 92, green: 102, blue: 112, alpha: 0.75 }` to color2
4313 * const color2 = parseToRgb('hsla(210, 10%, 40%, 0.75)');
4314 */
4315
4316function parseToRgb(color) {
4317 if (typeof color !== 'string') {
4318 throw new PolishedError(3);
4319 }
4320
4321 var normalizedColor = nameToHex(color);
4322
4323 if (normalizedColor.match(hexRegex)) {
4324 return {
4325 red: parseInt("" + normalizedColor[1] + normalizedColor[2], 16),
4326 green: parseInt("" + normalizedColor[3] + normalizedColor[4], 16),
4327 blue: parseInt("" + normalizedColor[5] + normalizedColor[6], 16)
4328 };
4329 }
4330
4331 if (normalizedColor.match(hexRgbaRegex)) {
4332 var alpha = parseFloat((parseInt("" + normalizedColor[7] + normalizedColor[8], 16) / 255).toFixed(2));
4333 return {
4334 red: parseInt("" + normalizedColor[1] + normalizedColor[2], 16),
4335 green: parseInt("" + normalizedColor[3] + normalizedColor[4], 16),
4336 blue: parseInt("" + normalizedColor[5] + normalizedColor[6], 16),
4337 alpha: alpha
4338 };
4339 }
4340
4341 if (normalizedColor.match(reducedHexRegex)) {
4342 return {
4343 red: parseInt("" + normalizedColor[1] + normalizedColor[1], 16),
4344 green: parseInt("" + normalizedColor[2] + normalizedColor[2], 16),
4345 blue: parseInt("" + normalizedColor[3] + normalizedColor[3], 16)
4346 };
4347 }
4348
4349 if (normalizedColor.match(reducedRgbaHexRegex)) {
4350 var _alpha = parseFloat((parseInt("" + normalizedColor[4] + normalizedColor[4], 16) / 255).toFixed(2));
4351
4352 return {
4353 red: parseInt("" + normalizedColor[1] + normalizedColor[1], 16),
4354 green: parseInt("" + normalizedColor[2] + normalizedColor[2], 16),
4355 blue: parseInt("" + normalizedColor[3] + normalizedColor[3], 16),
4356 alpha: _alpha
4357 };
4358 }
4359
4360 var rgbMatched = rgbRegex.exec(normalizedColor);
4361
4362 if (rgbMatched) {
4363 return {
4364 red: parseInt("" + rgbMatched[1], 10),
4365 green: parseInt("" + rgbMatched[2], 10),
4366 blue: parseInt("" + rgbMatched[3], 10)
4367 };
4368 }
4369
4370 var rgbaMatched = rgbaRegex.exec(normalizedColor.substring(0, 50));
4371
4372 if (rgbaMatched) {
4373 return {
4374 red: parseInt("" + rgbaMatched[1], 10),
4375 green: parseInt("" + rgbaMatched[2], 10),
4376 blue: parseInt("" + rgbaMatched[3], 10),
4377 alpha: parseFloat("" + rgbaMatched[4]) > 1 ? parseFloat("" + rgbaMatched[4]) / 100 : parseFloat("" + rgbaMatched[4])
4378 };
4379 }
4380
4381 var hslMatched = hslRegex.exec(normalizedColor);
4382
4383 if (hslMatched) {
4384 var hue = parseInt("" + hslMatched[1], 10);
4385 var saturation = parseInt("" + hslMatched[2], 10) / 100;
4386 var lightness = parseInt("" + hslMatched[3], 10) / 100;
4387 var rgbColorString = "rgb(" + hslToRgb(hue, saturation, lightness) + ")";
4388 var hslRgbMatched = rgbRegex.exec(rgbColorString);
4389
4390 if (!hslRgbMatched) {
4391 throw new PolishedError(4, normalizedColor, rgbColorString);
4392 }
4393
4394 return {
4395 red: parseInt("" + hslRgbMatched[1], 10),
4396 green: parseInt("" + hslRgbMatched[2], 10),
4397 blue: parseInt("" + hslRgbMatched[3], 10)
4398 };
4399 }
4400
4401 var hslaMatched = hslaRegex.exec(normalizedColor.substring(0, 50));
4402
4403 if (hslaMatched) {
4404 var _hue = parseInt("" + hslaMatched[1], 10);
4405
4406 var _saturation = parseInt("" + hslaMatched[2], 10) / 100;
4407
4408 var _lightness = parseInt("" + hslaMatched[3], 10) / 100;
4409
4410 var _rgbColorString = "rgb(" + hslToRgb(_hue, _saturation, _lightness) + ")";
4411
4412 var _hslRgbMatched = rgbRegex.exec(_rgbColorString);
4413
4414 if (!_hslRgbMatched) {
4415 throw new PolishedError(4, normalizedColor, _rgbColorString);
4416 }
4417
4418 return {
4419 red: parseInt("" + _hslRgbMatched[1], 10),
4420 green: parseInt("" + _hslRgbMatched[2], 10),
4421 blue: parseInt("" + _hslRgbMatched[3], 10),
4422 alpha: parseFloat("" + hslaMatched[4]) > 1 ? parseFloat("" + hslaMatched[4]) / 100 : parseFloat("" + hslaMatched[4])
4423 };
4424 }
4425
4426 throw new PolishedError(5);
4427}
4428
4429function rgbToHsl(color) {
4430 // make sure rgb are contained in a set of [0, 255]
4431 var red = color.red / 255;
4432 var green = color.green / 255;
4433 var blue = color.blue / 255;
4434 var max = Math.max(red, green, blue);
4435 var min = Math.min(red, green, blue);
4436 var lightness = (max + min) / 2;
4437
4438 if (max === min) {
4439 // achromatic
4440 if (color.alpha !== undefined) {
4441 return {
4442 hue: 0,
4443 saturation: 0,
4444 lightness: lightness,
4445 alpha: color.alpha
4446 };
4447 } else {
4448 return {
4449 hue: 0,
4450 saturation: 0,
4451 lightness: lightness
4452 };
4453 }
4454 }
4455
4456 var hue;
4457 var delta = max - min;
4458 var saturation = lightness > 0.5 ? delta / (2 - max - min) : delta / (max + min);
4459
4460 switch (max) {
4461 case red:
4462 hue = (green - blue) / delta + (green < blue ? 6 : 0);
4463 break;
4464
4465 case green:
4466 hue = (blue - red) / delta + 2;
4467 break;
4468
4469 default:
4470 // blue case
4471 hue = (red - green) / delta + 4;
4472 break;
4473 }
4474
4475 hue *= 60;
4476
4477 if (color.alpha !== undefined) {
4478 return {
4479 hue: hue,
4480 saturation: saturation,
4481 lightness: lightness,
4482 alpha: color.alpha
4483 };
4484 }
4485
4486 return {
4487 hue: hue,
4488 saturation: saturation,
4489 lightness: lightness
4490 };
4491}
4492/**
4493 * Returns an HslColor or HslaColor object. This utility function is only useful
4494 * if want to extract a color component. With the color util `toColorString` you
4495 * can convert a HslColor or HslaColor object back to a string.
4496 *
4497 * @example
4498 * // Assigns `{ hue: 0, saturation: 1, lightness: 0.5 }` to color1
4499 * const color1 = parseToHsl('rgb(255, 0, 0)');
4500 * // Assigns `{ hue: 128, saturation: 1, lightness: 0.5, alpha: 0.75 }` to color2
4501 * const color2 = parseToHsl('hsla(128, 100%, 50%, 0.75)');
4502 */
4503
4504
4505function parseToHsl(color) {
4506 // Note: At a later stage we can optimize this function as right now a hsl
4507 // color would be parsed converted to rgb values and converted back to hsl.
4508 return rgbToHsl(parseToRgb(color));
4509}
4510/**
4511 * Reduces hex values if possible e.g. #ff8866 to #f86
4512 * @private
4513 */
4514
4515
4516var reduceHexValue = function reduceHexValue(value) {
4517 if (value.length === 7 && value[1] === value[2] && value[3] === value[4] && value[5] === value[6]) {
4518 return "#" + value[1] + value[3] + value[5];
4519 }
4520
4521 return value;
4522};
4523
4524var reduceHexValue$1 = reduceHexValue;
4525
4526function numberToHex(value) {
4527 var hex = value.toString(16);
4528 return hex.length === 1 ? "0" + hex : hex;
4529}
4530
4531function colorToHex(color) {
4532 return numberToHex(Math.round(color * 255));
4533}
4534
4535function convertToHex(red, green, blue) {
4536 return reduceHexValue$1("#" + colorToHex(red) + colorToHex(green) + colorToHex(blue));
4537}
4538
4539function hslToHex(hue, saturation, lightness) {
4540 return hslToRgb(hue, saturation, lightness, convertToHex);
4541}
4542/**
4543 * Returns a string value for the color. The returned result is the smallest possible hex notation.
4544 *
4545 * @example
4546 * // Styles as object usage
4547 * const styles = {
4548 * background: hsl(359, 0.75, 0.4),
4549 * background: hsl({ hue: 360, saturation: 0.75, lightness: 0.4 }),
4550 * }
4551 *
4552 * // styled-components usage
4553 * const div = styled.div`
4554 * background: ${hsl(359, 0.75, 0.4)};
4555 * background: ${hsl({ hue: 360, saturation: 0.75, lightness: 0.4 })};
4556 * `
4557 *
4558 * // CSS in JS Output
4559 *
4560 * element {
4561 * background: "#b3191c";
4562 * background: "#b3191c";
4563 * }
4564 */
4565
4566
4567function hsl(value, saturation, lightness) {
4568 if (typeof value === 'number' && typeof saturation === 'number' && typeof lightness === 'number') {
4569 return hslToHex(value, saturation, lightness);
4570 } else if (typeof value === 'object' && saturation === undefined && lightness === undefined) {
4571 return hslToHex(value.hue, value.saturation, value.lightness);
4572 }
4573
4574 throw new PolishedError(1);
4575}
4576/**
4577 * Returns a string value for the color. The returned result is the smallest possible rgba or hex notation.
4578 *
4579 * @example
4580 * // Styles as object usage
4581 * const styles = {
4582 * background: hsla(359, 0.75, 0.4, 0.7),
4583 * background: hsla({ hue: 360, saturation: 0.75, lightness: 0.4, alpha: 0,7 }),
4584 * background: hsla(359, 0.75, 0.4, 1),
4585 * }
4586 *
4587 * // styled-components usage
4588 * const div = styled.div`
4589 * background: ${hsla(359, 0.75, 0.4, 0.7)};
4590 * background: ${hsla({ hue: 360, saturation: 0.75, lightness: 0.4, alpha: 0,7 })};
4591 * background: ${hsla(359, 0.75, 0.4, 1)};
4592 * `
4593 *
4594 * // CSS in JS Output
4595 *
4596 * element {
4597 * background: "rgba(179,25,28,0.7)";
4598 * background: "rgba(179,25,28,0.7)";
4599 * background: "#b3191c";
4600 * }
4601 */
4602
4603
4604function hsla(value, saturation, lightness, alpha) {
4605 if (typeof value === 'number' && typeof saturation === 'number' && typeof lightness === 'number' && typeof alpha === 'number') {
4606 return alpha >= 1 ? hslToHex(value, saturation, lightness) : "rgba(" + hslToRgb(value, saturation, lightness) + "," + alpha + ")";
4607 } else if (typeof value === 'object' && saturation === undefined && lightness === undefined && alpha === undefined) {
4608 return value.alpha >= 1 ? hslToHex(value.hue, value.saturation, value.lightness) : "rgba(" + hslToRgb(value.hue, value.saturation, value.lightness) + "," + value.alpha + ")";
4609 }
4610
4611 throw new PolishedError(2);
4612}
4613/**
4614 * Returns a string value for the color. The returned result is the smallest possible hex notation.
4615 *
4616 * @example
4617 * // Styles as object usage
4618 * const styles = {
4619 * background: rgb(255, 205, 100),
4620 * background: rgb({ red: 255, green: 205, blue: 100 }),
4621 * }
4622 *
4623 * // styled-components usage
4624 * const div = styled.div`
4625 * background: ${rgb(255, 205, 100)};
4626 * background: ${rgb({ red: 255, green: 205, blue: 100 })};
4627 * `
4628 *
4629 * // CSS in JS Output
4630 *
4631 * element {
4632 * background: "#ffcd64";
4633 * background: "#ffcd64";
4634 * }
4635 */
4636
4637
4638function rgb(value, green, blue) {
4639 if (typeof value === 'number' && typeof green === 'number' && typeof blue === 'number') {
4640 return reduceHexValue$1("#" + numberToHex(value) + numberToHex(green) + numberToHex(blue));
4641 } else if (typeof value === 'object' && green === undefined && blue === undefined) {
4642 return reduceHexValue$1("#" + numberToHex(value.red) + numberToHex(value.green) + numberToHex(value.blue));
4643 }
4644
4645 throw new PolishedError(6);
4646}
4647/**
4648 * Returns a string value for the color. The returned result is the smallest possible rgba or hex notation.
4649 *
4650 * Can also be used to fade a color by passing a hex value or named CSS color along with an alpha value.
4651 *
4652 * @example
4653 * // Styles as object usage
4654 * const styles = {
4655 * background: rgba(255, 205, 100, 0.7),
4656 * background: rgba({ red: 255, green: 205, blue: 100, alpha: 0.7 }),
4657 * background: rgba(255, 205, 100, 1),
4658 * background: rgba('#ffffff', 0.4),
4659 * background: rgba('black', 0.7),
4660 * }
4661 *
4662 * // styled-components usage
4663 * const div = styled.div`
4664 * background: ${rgba(255, 205, 100, 0.7)};
4665 * background: ${rgba({ red: 255, green: 205, blue: 100, alpha: 0.7 })};
4666 * background: ${rgba(255, 205, 100, 1)};
4667 * background: ${rgba('#ffffff', 0.4)};
4668 * background: ${rgba('black', 0.7)};
4669 * `
4670 *
4671 * // CSS in JS Output
4672 *
4673 * element {
4674 * background: "rgba(255,205,100,0.7)";
4675 * background: "rgba(255,205,100,0.7)";
4676 * background: "#ffcd64";
4677 * background: "rgba(255,255,255,0.4)";
4678 * background: "rgba(0,0,0,0.7)";
4679 * }
4680 */
4681
4682
4683function rgba(firstValue, secondValue, thirdValue, fourthValue) {
4684 if (typeof firstValue === 'string' && typeof secondValue === 'number') {
4685 var rgbValue = parseToRgb(firstValue);
4686 return "rgba(" + rgbValue.red + "," + rgbValue.green + "," + rgbValue.blue + "," + secondValue + ")";
4687 } else if (typeof firstValue === 'number' && typeof secondValue === 'number' && typeof thirdValue === 'number' && typeof fourthValue === 'number') {
4688 return fourthValue >= 1 ? rgb(firstValue, secondValue, thirdValue) : "rgba(" + firstValue + "," + secondValue + "," + thirdValue + "," + fourthValue + ")";
4689 } else if (typeof firstValue === 'object' && secondValue === undefined && thirdValue === undefined && fourthValue === undefined) {
4690 return firstValue.alpha >= 1 ? rgb(firstValue.red, firstValue.green, firstValue.blue) : "rgba(" + firstValue.red + "," + firstValue.green + "," + firstValue.blue + "," + firstValue.alpha + ")";
4691 }
4692
4693 throw new PolishedError(7);
4694}
4695
4696var isRgb = function isRgb(color) {
4697 return typeof color.red === 'number' && typeof color.green === 'number' && typeof color.blue === 'number' && (typeof color.alpha !== 'number' || typeof color.alpha === 'undefined');
4698};
4699
4700var isRgba = function isRgba(color) {
4701 return typeof color.red === 'number' && typeof color.green === 'number' && typeof color.blue === 'number' && typeof color.alpha === 'number';
4702};
4703
4704var isHsl = function isHsl(color) {
4705 return typeof color.hue === 'number' && typeof color.saturation === 'number' && typeof color.lightness === 'number' && (typeof color.alpha !== 'number' || typeof color.alpha === 'undefined');
4706};
4707
4708var isHsla = function isHsla(color) {
4709 return typeof color.hue === 'number' && typeof color.saturation === 'number' && typeof color.lightness === 'number' && typeof color.alpha === 'number';
4710};
4711/**
4712 * Converts a RgbColor, RgbaColor, HslColor or HslaColor object to a color string.
4713 * This util is useful in case you only know on runtime which color object is
4714 * used. Otherwise we recommend to rely on `rgb`, `rgba`, `hsl` or `hsla`.
4715 *
4716 * @example
4717 * // Styles as object usage
4718 * const styles = {
4719 * background: toColorString({ red: 255, green: 205, blue: 100 }),
4720 * background: toColorString({ red: 255, green: 205, blue: 100, alpha: 0.72 }),
4721 * background: toColorString({ hue: 240, saturation: 1, lightness: 0.5 }),
4722 * background: toColorString({ hue: 360, saturation: 0.75, lightness: 0.4, alpha: 0.72 }),
4723 * }
4724 *
4725 * // styled-components usage
4726 * const div = styled.div`
4727 * background: ${toColorString({ red: 255, green: 205, blue: 100 })};
4728 * background: ${toColorString({ red: 255, green: 205, blue: 100, alpha: 0.72 })};
4729 * background: ${toColorString({ hue: 240, saturation: 1, lightness: 0.5 })};
4730 * background: ${toColorString({ hue: 360, saturation: 0.75, lightness: 0.4, alpha: 0.72 })};
4731 * `
4732 *
4733 * // CSS in JS Output
4734 * element {
4735 * background: "#ffcd64";
4736 * background: "rgba(255,205,100,0.72)";
4737 * background: "#00f";
4738 * background: "rgba(179,25,25,0.72)";
4739 * }
4740 */
4741
4742
4743function toColorString(color) {
4744 if (typeof color !== 'object') throw new PolishedError(8);
4745 if (isRgba(color)) return rgba(color);
4746 if (isRgb(color)) return rgb(color);
4747 if (isHsla(color)) return hsla(color);
4748 if (isHsl(color)) return hsl(color);
4749 throw new PolishedError(8);
4750} // Type definitions taken from https://github.com/gcanti/flow-static-land/blob/master/src/Fun.js
4751// eslint-disable-next-line no-unused-vars
4752// eslint-disable-next-line no-unused-vars
4753// eslint-disable-next-line no-redeclare
4754
4755
4756function curried(f, length, acc) {
4757 return function fn() {
4758 // eslint-disable-next-line prefer-rest-params
4759 var combined = acc.concat(Array.prototype.slice.call(arguments));
4760 return combined.length >= length ? f.apply(this, combined) : curried(f, length, combined);
4761 };
4762} // eslint-disable-next-line no-redeclare
4763
4764
4765function curry(f) {
4766 // eslint-disable-line no-redeclare
4767 return curried(f, f.length, []);
4768}
4769
4770function guard(lowerBoundary, upperBoundary, value) {
4771 return Math.max(lowerBoundary, Math.min(upperBoundary, value));
4772}
4773/**
4774 * Returns a string value for the darkened color.
4775 *
4776 * @example
4777 * // Styles as object usage
4778 * const styles = {
4779 * background: darken(0.2, '#FFCD64'),
4780 * background: darken('0.2', 'rgba(255,205,100,0.7)'),
4781 * }
4782 *
4783 * // styled-components usage
4784 * const div = styled.div`
4785 * background: ${darken(0.2, '#FFCD64')};
4786 * background: ${darken('0.2', 'rgba(255,205,100,0.7)')};
4787 * `
4788 *
4789 * // CSS in JS Output
4790 *
4791 * element {
4792 * background: "#ffbd31";
4793 * background: "rgba(255,189,49,0.7)";
4794 * }
4795 */
4796
4797
4798function darken(amount, color) {
4799 if (color === 'transparent') return color;
4800 var hslColor = parseToHsl(color);
4801 return toColorString(_extends({}, hslColor, {
4802 lightness: guard(0, 1, hslColor.lightness - parseFloat(amount))
4803 }));
4804} // prettier-ignore
4805
4806
4807var curriedDarken = /*#__PURE__*/curry
4808/* ::<number | string, string, string> */
4809(darken);
4810var curriedDarken$1 = curriedDarken;
4811/**
4812 * Returns a string value for the lightened color.
4813 *
4814 * @example
4815 * // Styles as object usage
4816 * const styles = {
4817 * background: lighten(0.2, '#CCCD64'),
4818 * background: lighten('0.2', 'rgba(204,205,100,0.7)'),
4819 * }
4820 *
4821 * // styled-components usage
4822 * const div = styled.div`
4823 * background: ${lighten(0.2, '#FFCD64')};
4824 * background: ${lighten('0.2', 'rgba(204,205,100,0.7)')};
4825 * `
4826 *
4827 * // CSS in JS Output
4828 *
4829 * element {
4830 * background: "#e5e6b1";
4831 * background: "rgba(229,230,177,0.7)";
4832 * }
4833 */
4834
4835function lighten(amount, color) {
4836 if (color === 'transparent') return color;
4837 var hslColor = parseToHsl(color);
4838 return toColorString(_extends({}, hslColor, {
4839 lightness: guard(0, 1, hslColor.lightness + parseFloat(amount))
4840 }));
4841} // prettier-ignore
4842
4843
4844var curriedLighten = /*#__PURE__*/curry
4845/* ::<number | string, string, string> */
4846(lighten);
4847var curriedLighten$1 = curriedLighten;
4848/**
4849 * Increases the opacity of a color. Its range for the amount is between 0 to 1.
4850 *
4851 *
4852 * @example
4853 * // Styles as object usage
4854 * const styles = {
4855 * background: opacify(0.1, 'rgba(255, 255, 255, 0.9)');
4856 * background: opacify(0.2, 'hsla(0, 0%, 100%, 0.5)'),
4857 * background: opacify('0.5', 'rgba(255, 0, 0, 0.2)'),
4858 * }
4859 *
4860 * // styled-components usage
4861 * const div = styled.div`
4862 * background: ${opacify(0.1, 'rgba(255, 255, 255, 0.9)')};
4863 * background: ${opacify(0.2, 'hsla(0, 0%, 100%, 0.5)')},
4864 * background: ${opacify('0.5', 'rgba(255, 0, 0, 0.2)')},
4865 * `
4866 *
4867 * // CSS in JS Output
4868 *
4869 * element {
4870 * background: "#fff";
4871 * background: "rgba(255,255,255,0.7)";
4872 * background: "rgba(255,0,0,0.7)";
4873 * }
4874 */
4875
4876function opacify(amount, color) {
4877 if (color === 'transparent') return color;
4878 var parsedColor = parseToRgb(color);
4879 var alpha = typeof parsedColor.alpha === 'number' ? parsedColor.alpha : 1;
4880
4881 var colorWithAlpha = _extends({}, parsedColor, {
4882 alpha: guard(0, 1, (alpha * 100 + parseFloat(amount) * 100) / 100)
4883 });
4884
4885 return rgba(colorWithAlpha);
4886} // prettier-ignore
4887
4888
4889var curriedOpacify = /*#__PURE__*/curry
4890/* ::<number | string, string, string> */
4891(opacify);
4892var curriedOpacify$1 = curriedOpacify;
4893/**
4894 * Decreases the opacity of a color. Its range for the amount is between 0 to 1.
4895 *
4896 *
4897 * @example
4898 * // Styles as object usage
4899 * const styles = {
4900 * background: transparentize(0.1, '#fff'),
4901 * background: transparentize(0.2, 'hsl(0, 0%, 100%)'),
4902 * background: transparentize('0.5', 'rgba(255, 0, 0, 0.8)'),
4903 * }
4904 *
4905 * // styled-components usage
4906 * const div = styled.div`
4907 * background: ${transparentize(0.1, '#fff')};
4908 * background: ${transparentize(0.2, 'hsl(0, 0%, 100%)')};
4909 * background: ${transparentize('0.5', 'rgba(255, 0, 0, 0.8)')};
4910 * `
4911 *
4912 * // CSS in JS Output
4913 *
4914 * element {
4915 * background: "rgba(255,255,255,0.9)";
4916 * background: "rgba(255,255,255,0.8)";
4917 * background: "rgba(255,0,0,0.3)";
4918 * }
4919 */
4920
4921function transparentize(amount, color) {
4922 if (color === 'transparent') return color;
4923 var parsedColor = parseToRgb(color);
4924 var alpha = typeof parsedColor.alpha === 'number' ? parsedColor.alpha : 1;
4925
4926 var colorWithAlpha = _extends({}, parsedColor, {
4927 alpha: guard(0, 1, +(alpha * 100 - parseFloat(amount) * 100).toFixed(2) / 100)
4928 });
4929
4930 return rgba(colorWithAlpha);
4931} // prettier-ignore
4932
4933
4934var curriedTransparentize = /*#__PURE__*/curry
4935/* ::<number | string, string, string> */
4936(transparentize);
4937var curriedTransparentize$1 = curriedTransparentize;
4938const color = {
4939 // Official color palette
4940 primary: '#FF4785',
4941 secondary: '#1EA7FD',
4942 tertiary: '#FAFBFC',
4943 ancillary: '#22a699',
4944 // Complimentary
4945 orange: '#FC521F',
4946 gold: '#FFAE00',
4947 green: '#66BF3C',
4948 seafoam: '#37D5D3',
4949 purple: '#6F2CAC',
4950 ultraviolet: '#2A0481',
4951 // Monochrome
4952 lightest: '#FFFFFF',
4953 lighter: '#F8F8F8',
4954 light: '#F3F3F3',
4955 mediumlight: '#EEEEEE',
4956 medium: '#DDDDDD',
4957 mediumdark: '#999999',
4958 dark: '#666666',
4959 darker: '#444444',
4960 darkest: '#333333',
4961 // For borders
4962 border: 'rgba(0,0,0,.1)',
4963 // Status
4964 positive: '#66BF3C',
4965 negative: '#FF4400',
4966 warning: '#E69D00',
4967 critical: '#FFFFFF',
4968 defaultText: '#333333',
4969 inverseText: '#FFFFFF'
4970};
4971const background = {
4972 app: '#F6F9FC',
4973 bar: '#FFFFFF',
4974 content: color.lightest,
4975 gridCellSize: 10,
4976 hoverable: curriedTransparentize$1(0.93, color.secondary),
4977 // Notification, error, and warning backgrounds
4978 positive: '#E1FFD4',
4979 negative: '#FEDED2',
4980 warning: '#FFF5CF',
4981 critical: '#FF4400'
4982};
4983const typography = {
4984 fonts: {
4985 base: ['"Nunito Sans"', '-apple-system', '".SFNSText-Regular"', '"San Francisco"', 'BlinkMacSystemFont', '"Segoe UI"', '"Helvetica Neue"', 'Helvetica', 'Arial', 'sans-serif'].join(', '),
4986 mono: ['ui-monospace', 'Menlo', 'Monaco', '"Roboto Mono"', '"Oxygen Mono"', '"Ubuntu Monospace"', '"Source Code Pro"', '"Droid Sans Mono"', '"Courier New"', 'monospace'].join(', ')
4987 },
4988 weight: {
4989 regular: 400,
4990 bold: 700,
4991 black: 900
4992 },
4993 size: {
4994 s1: 12,
4995 s2: 14,
4996 s3: 16,
4997 m1: 20,
4998 m2: 24,
4999 m3: 28,
5000 l1: 32,
5001 l2: 40,
5002 l3: 48,
5003 code: 90
5004 }
5005};
5006const createReset = memoize__default["default"](1)(({
5007 typography
5008}) => ({
5009 body: {
5010 fontFamily: typography.fonts.base,
5011 fontSize: typography.size.s3,
5012 margin: 0,
5013 WebkitFontSmoothing: 'antialiased',
5014 MozOsxFontSmoothing: 'grayscale',
5015 WebkitTapHighlightColor: 'rgba(0, 0, 0, 0)',
5016 WebkitOverflowScrolling: 'touch'
5017 },
5018 '*': {
5019 boxSizing: 'border-box'
5020 },
5021 'h1, h2, h3, h4, h5, h6': {
5022 fontWeight: typography.weight.regular,
5023 margin: 0,
5024 padding: 0
5025 },
5026 'button, input, textarea, select': {
5027 fontFamily: 'inherit',
5028 fontSize: 'inherit',
5029 boxSizing: 'border-box'
5030 },
5031 sub: {
5032 fontSize: '0.8em',
5033 bottom: '-0.2em'
5034 },
5035 sup: {
5036 fontSize: '0.8em',
5037 top: '-0.2em'
5038 },
5039 'b, strong': {
5040 fontWeight: typography.weight.bold
5041 },
5042 hr: {
5043 border: 'none',
5044 borderTop: '1px solid silver',
5045 clear: 'both',
5046 marginBottom: '1.25rem'
5047 },
5048 code: {
5049 fontFamily: typography.fonts.mono,
5050 WebkitFontSmoothing: 'antialiased',
5051 MozOsxFontSmoothing: 'grayscale',
5052 display: 'inline-block',
5053 paddingLeft: 2,
5054 paddingRight: 2,
5055 verticalAlign: 'baseline',
5056 color: 'inherit'
5057 },
5058 pre: {
5059 fontFamily: typography.fonts.mono,
5060 WebkitFontSmoothing: 'antialiased',
5061 MozOsxFontSmoothing: 'grayscale',
5062 lineHeight: '18px',
5063 padding: '11px 1rem',
5064 whiteSpace: 'pre-wrap',
5065 color: 'inherit',
5066 borderRadius: 3,
5067 margin: '1rem 0'
5068 }
5069}));
5070const createGlobal = memoize__default["default"](1)(({
5071 color,
5072 background,
5073 typography
5074}) => {
5075 const resetStyles = createReset({
5076 typography
5077 });
5078 return Object.assign(Object.assign({}, resetStyles), {
5079 body: Object.assign(Object.assign({}, resetStyles.body), {
5080 color: color.defaultText,
5081 background: background.app,
5082 overflow: 'hidden'
5083 }),
5084 hr: Object.assign(Object.assign({}, resetStyles.hr), {
5085 borderTop: `1px solid ${color.border}`
5086 })
5087 });
5088});
5089const theme$1 = {
5090 base: 'light',
5091 // Storybook-specific color palette
5092 colorPrimary: '#FF4785',
5093 colorSecondary: '#1EA7FD',
5094 // UI
5095 appBg: background.app,
5096 appContentBg: color.lightest,
5097 appBorderColor: color.border,
5098 appBorderRadius: 4,
5099 // Fonts
5100 fontBase: typography.fonts.base,
5101 fontCode: typography.fonts.mono,
5102 // Text colors
5103 textColor: color.darkest,
5104 textInverseColor: color.lightest,
5105 textMutedColor: color.dark,
5106 // Toolbar default and active colors
5107 barTextColor: color.mediumdark,
5108 barSelectedColor: color.secondary,
5109 barBg: color.lightest,
5110 // Form colors
5111 inputBg: color.lightest,
5112 inputBorder: color.border,
5113 inputTextColor: color.darkest,
5114 inputBorderRadius: 4
5115};
5116const theme = {
5117 base: 'dark',
5118 // Storybook-specific color palette
5119 colorPrimary: '#FF4785',
5120 colorSecondary: '#1EA7FD',
5121 // UI
5122 appBg: '#2f2f2f',
5123 appContentBg: color.darkest,
5124 appBorderColor: 'rgba(255,255,255,.1)',
5125 appBorderRadius: 4,
5126 // Fonts
5127 fontBase: typography.fonts.base,
5128 fontCode: typography.fonts.mono,
5129 // Text colors
5130 textColor: color.lightest,
5131 textInverseColor: color.darkest,
5132 textMutedColor: color.mediumdark,
5133 // Toolbar default and active colors
5134 barTextColor: '#999999',
5135 barSelectedColor: color.secondary,
5136 barBg: color.darkest,
5137 // Form colors
5138 inputBg: '#3f3f3f',
5139 inputBorder: 'rgba(0,0,0,.3)',
5140 inputTextColor: color.lightest,
5141 inputBorderRadius: 4
5142};
5143var win;
5144
5145if (typeof window !== "undefined") {
5146 win = window;
5147} else if (typeof commonjsGlobal !== "undefined") {
5148 win = commonjsGlobal;
5149} else if (typeof self !== "undefined") {
5150 win = self;
5151} else {
5152 win = {};
5153}
5154
5155var window_1 = win;
5156const {
5157 window: globalWindow
5158} = window_1;
5159
5160const mkColor = color => ({
5161 color
5162}); // Check if it is a string. This is for the sake of warning users
5163// and the successive guarding logics that use String methods.
5164
5165
5166const isColorString = color => {
5167 if (typeof color !== 'string') {
5168 clientLogger.logger.warn(`Color passed to theme object should be a string. Instead ` + `${color}(${typeof color}) was passed.`);
5169 return false;
5170 }
5171
5172 return true;
5173}; // Passing arguments that can't be converted to RGB such as linear-gradient
5174// to library polished's functions such as lighten or darken throws the error
5175// that crashes the entire storybook. It needs to be guarded when arguments
5176// of those functions are from user input.
5177
5178
5179const isValidColorForPolished = color => {
5180 return !/(gradient|var|calc)/.test(color);
5181};
5182
5183const applyPolished = (type, color) => {
5184 if (type === 'darken') {
5185 return rgba(`${curriedDarken$1(1, color)}`, 0.95);
5186 }
5187
5188 if (type === 'lighten') {
5189 return rgba(`${curriedLighten$1(1, color)}`, 0.95);
5190 }
5191
5192 return color;
5193};
5194
5195const colorFactory = type => color => {
5196 if (!isColorString(color)) {
5197 return color;
5198 }
5199
5200 if (!isValidColorForPolished(color)) {
5201 return color;
5202 } // Guard anything that is not working with polished.
5203
5204
5205 try {
5206 return applyPolished(type, color);
5207 } catch (error) {
5208 return color;
5209 }
5210};
5211
5212const lightenColor = colorFactory('lighten');
5213const darkenColor = colorFactory('darken'); // The default color scheme is light so unless the preferred color
5214// scheme is set to dark we always want to use the light theme
5215
5216const getPreferredColorScheme = () => {
5217 if (!globalWindow || !globalWindow.matchMedia) return 'light';
5218 const isDarkThemePreferred = globalWindow.matchMedia('(prefers-color-scheme: dark)').matches;
5219 if (isDarkThemePreferred) return 'dark';
5220 return 'light';
5221}; // This generates theme variables in the correct shape for the UI
5222
5223
5224const themes = {
5225 light: theme$1,
5226 dark: theme,
5227 normal: theme$1
5228};
5229const preferredColorScheme = getPreferredColorScheme();
5230
5231const create$1 = (vars = {
5232 base: preferredColorScheme
5233}, rest) => {
5234 const inherit = Object.assign(Object.assign(Object.assign(Object.assign({}, themes[preferredColorScheme]), themes[vars.base] || {}), vars), {
5235 base: themes[vars.base] ? vars.base : preferredColorScheme
5236 });
5237 return Object.assign(Object.assign(Object.assign({}, rest), inherit), {
5238 barSelectedColor: vars.barSelectedColor || inherit.colorSecondary
5239 });
5240};
5241/*! *****************************************************************************
5242Copyright (c) Microsoft Corporation.
5243
5244Permission to use, copy, modify, and/or distribute this software for any
5245purpose with or without fee is hereby granted.
5246
5247THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
5248REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
5249AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
5250INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
5251LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
5252OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
5253PERFORMANCE OF THIS SOFTWARE.
5254***************************************************************************** */
5255
5256
5257function __rest(s, e) {
5258 var t = {};
5259
5260 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
5261
5262 if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
5263 if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
5264 }
5265 return t;
5266}
5267
5268const easing = {
5269 rubber: 'cubic-bezier(0.175, 0.885, 0.335, 1.05)'
5270};
5271const rotate360 = keyframes`
5272 from {
5273 transform: rotate(0deg);
5274 }
5275 to {
5276 transform: rotate(360deg);
5277 }
5278`;
5279const glow = keyframes`
5280 0%, 100% { opacity: 1; }
5281 50% { opacity: .4; }
5282`;
5283const float = keyframes`
5284 0% { transform: translateY(1px); }
5285 25% { transform: translateY(0px); }
5286 50% { transform: translateY(-3px); }
5287 100% { transform: translateY(1px); }
5288`;
5289const jiggle = keyframes`
5290 0%, 100% { transform:translate3d(0,0,0); }
5291 12.5%, 62.5% { transform:translate3d(-4px,0,0); }
5292 37.5%, 87.5% { transform: translate3d(4px,0,0); }
5293`;
5294const inlineGlow = css`
5295 animation: ${glow} 1.5s ease-in-out infinite;
5296 color: transparent;
5297 cursor: progress;
5298`; // hover & active state for links and buttons
5299
5300const hoverable = css`
5301 transition: all 150ms ease-out;
5302 transform: translate3d(0, 0, 0);
5303
5304 &:hover {
5305 transform: translate3d(0, -2px, 0);
5306 }
5307
5308 &:active {
5309 transform: translate3d(0, 0, 0);
5310 }
5311`;
5312const animation = {
5313 rotate360,
5314 glow,
5315 float,
5316 jiggle,
5317 inlineGlow,
5318 hoverable
5319};
5320const chromeDark = {
5321 BASE_FONT_FAMILY: 'Menlo, monospace',
5322 BASE_FONT_SIZE: '11px',
5323 BASE_LINE_HEIGHT: 1.2,
5324 BASE_BACKGROUND_COLOR: 'rgb(36, 36, 36)',
5325 BASE_COLOR: 'rgb(213, 213, 213)',
5326 OBJECT_PREVIEW_ARRAY_MAX_PROPERTIES: 10,
5327 OBJECT_PREVIEW_OBJECT_MAX_PROPERTIES: 5,
5328 OBJECT_NAME_COLOR: 'rgb(227, 110, 236)',
5329 OBJECT_VALUE_NULL_COLOR: 'rgb(127, 127, 127)',
5330 OBJECT_VALUE_UNDEFINED_COLOR: 'rgb(127, 127, 127)',
5331 OBJECT_VALUE_REGEXP_COLOR: 'rgb(233, 63, 59)',
5332 OBJECT_VALUE_STRING_COLOR: 'rgb(233, 63, 59)',
5333 OBJECT_VALUE_SYMBOL_COLOR: 'rgb(233, 63, 59)',
5334 OBJECT_VALUE_NUMBER_COLOR: 'hsl(252, 100%, 75%)',
5335 OBJECT_VALUE_BOOLEAN_COLOR: 'hsl(252, 100%, 75%)',
5336 OBJECT_VALUE_FUNCTION_PREFIX_COLOR: 'rgb(85, 106, 242)',
5337 HTML_TAG_COLOR: 'rgb(93, 176, 215)',
5338 HTML_TAGNAME_COLOR: 'rgb(93, 176, 215)',
5339 HTML_TAGNAME_TEXT_TRANSFORM: 'lowercase',
5340 HTML_ATTRIBUTE_NAME_COLOR: 'rgb(155, 187, 220)',
5341 HTML_ATTRIBUTE_VALUE_COLOR: 'rgb(242, 151, 102)',
5342 HTML_COMMENT_COLOR: 'rgb(137, 137, 137)',
5343 HTML_DOCTYPE_COLOR: 'rgb(192, 192, 192)',
5344 ARROW_COLOR: 'rgb(145, 145, 145)',
5345 ARROW_MARGIN_RIGHT: 3,
5346 ARROW_FONT_SIZE: 12,
5347 ARROW_ANIMATION_DURATION: '0',
5348 TREENODE_FONT_FAMILY: 'Menlo, monospace',
5349 TREENODE_FONT_SIZE: '11px',
5350 TREENODE_LINE_HEIGHT: 1.2,
5351 TREENODE_PADDING_LEFT: 12,
5352 TABLE_BORDER_COLOR: 'rgb(85, 85, 85)',
5353 TABLE_TH_BACKGROUND_COLOR: 'rgb(44, 44, 44)',
5354 TABLE_TH_HOVER_COLOR: 'rgb(48, 48, 48)',
5355 TABLE_SORT_ICON_COLOR: 'black',
5356 TABLE_DATA_BACKGROUND_IMAGE: 'linear-gradient(rgba(255, 255, 255, 0), rgba(255, 255, 255, 0) 50%, rgba(51, 139, 255, 0.0980392) 50%, rgba(51, 139, 255, 0.0980392))',
5357 TABLE_DATA_BACKGROUND_SIZE: '128px 32px'
5358};
5359const chromeLight = {
5360 BASE_FONT_FAMILY: 'Menlo, monospace',
5361 BASE_FONT_SIZE: '11px',
5362 BASE_LINE_HEIGHT: 1.2,
5363 BASE_BACKGROUND_COLOR: 'white',
5364 BASE_COLOR: 'black',
5365 OBJECT_PREVIEW_ARRAY_MAX_PROPERTIES: 10,
5366 OBJECT_PREVIEW_OBJECT_MAX_PROPERTIES: 5,
5367 OBJECT_NAME_COLOR: 'rgb(136, 19, 145)',
5368 OBJECT_VALUE_NULL_COLOR: 'rgb(128, 128, 128)',
5369 OBJECT_VALUE_UNDEFINED_COLOR: 'rgb(128, 128, 128)',
5370 OBJECT_VALUE_REGEXP_COLOR: 'rgb(196, 26, 22)',
5371 OBJECT_VALUE_STRING_COLOR: 'rgb(196, 26, 22)',
5372 OBJECT_VALUE_SYMBOL_COLOR: 'rgb(196, 26, 22)',
5373 OBJECT_VALUE_NUMBER_COLOR: 'rgb(28, 0, 207)',
5374 OBJECT_VALUE_BOOLEAN_COLOR: 'rgb(28, 0, 207)',
5375 OBJECT_VALUE_FUNCTION_PREFIX_COLOR: 'rgb(13, 34, 170)',
5376 HTML_TAG_COLOR: 'rgb(168, 148, 166)',
5377 HTML_TAGNAME_COLOR: 'rgb(136, 18, 128)',
5378 HTML_TAGNAME_TEXT_TRANSFORM: 'lowercase',
5379 HTML_ATTRIBUTE_NAME_COLOR: 'rgb(153, 69, 0)',
5380 HTML_ATTRIBUTE_VALUE_COLOR: 'rgb(26, 26, 166)',
5381 HTML_COMMENT_COLOR: 'rgb(35, 110, 37)',
5382 HTML_DOCTYPE_COLOR: 'rgb(192, 192, 192)',
5383 ARROW_COLOR: '#6e6e6e',
5384 ARROW_MARGIN_RIGHT: 3,
5385 ARROW_FONT_SIZE: 12,
5386 ARROW_ANIMATION_DURATION: '0',
5387 TREENODE_FONT_FAMILY: 'Menlo, monospace',
5388 TREENODE_FONT_SIZE: '11px',
5389 TREENODE_LINE_HEIGHT: 1.2,
5390 TREENODE_PADDING_LEFT: 12,
5391 TABLE_BORDER_COLOR: '#aaa',
5392 TABLE_TH_BACKGROUND_COLOR: '#eee',
5393 TABLE_TH_HOVER_COLOR: 'hsla(0, 0%, 90%, 1)',
5394 TABLE_SORT_ICON_COLOR: '#6e6e6e',
5395 TABLE_DATA_BACKGROUND_IMAGE: 'linear-gradient(to bottom, white, white 50%, rgb(234, 243, 255) 50%, rgb(234, 243, 255))',
5396 TABLE_DATA_BACKGROUND_SIZE: '128px 32px'
5397};
5398
5399const convertColors = colors => Object.entries(colors).reduce((acc, [k, v]) => Object.assign(Object.assign({}, acc), {
5400 [k]: mkColor(v)
5401}), {});
5402
5403const create = ({
5404 colors,
5405 mono
5406}) => {
5407 const colorsObjs = convertColors(colors);
5408 return {
5409 token: {
5410 fontFamily: mono,
5411 WebkitFontSmoothing: 'antialiased',
5412 '&.tag': colorsObjs.red3,
5413 '&.comment': Object.assign(Object.assign({}, colorsObjs.green1), {
5414 fontStyle: 'italic'
5415 }),
5416 '&.prolog': Object.assign(Object.assign({}, colorsObjs.green1), {
5417 fontStyle: 'italic'
5418 }),
5419 '&.doctype': Object.assign(Object.assign({}, colorsObjs.green1), {
5420 fontStyle: 'italic'
5421 }),
5422 '&.cdata': Object.assign(Object.assign({}, colorsObjs.green1), {
5423 fontStyle: 'italic'
5424 }),
5425 '&.string': colorsObjs.red1,
5426 '&.url': colorsObjs.cyan1,
5427 '&.symbol': colorsObjs.cyan1,
5428 '&.number': colorsObjs.cyan1,
5429 '&.boolean': colorsObjs.cyan1,
5430 '&.variable': colorsObjs.cyan1,
5431 '&.constant': colorsObjs.cyan1,
5432 '&.inserted': colorsObjs.cyan1,
5433 '&.atrule': colorsObjs.blue1,
5434 '&.keyword': colorsObjs.blue1,
5435 '&.attr-value': colorsObjs.blue1,
5436 '&.punctuation': colorsObjs.gray1,
5437 '&.operator': colorsObjs.gray1,
5438 '&.function': colorsObjs.gray1,
5439 '&.deleted': colorsObjs.red2,
5440 '&.important': {
5441 fontWeight: 'bold'
5442 },
5443 '&.bold': {
5444 fontWeight: 'bold'
5445 },
5446 '&.italic': {
5447 fontStyle: 'italic'
5448 },
5449 '&.class-name': colorsObjs.cyan2,
5450 '&.selector': colorsObjs.red3,
5451 '&.attr-name': colorsObjs.red4,
5452 '&.property': colorsObjs.red4,
5453 '&.regex': colorsObjs.red4,
5454 '&.entity': colorsObjs.red4,
5455 '&.directive.tag .tag': Object.assign({
5456 background: '#ffff00'
5457 }, colorsObjs.gray1)
5458 },
5459 'language-json .token.boolean': colorsObjs.blue1,
5460 'language-json .token.number': colorsObjs.blue1,
5461 'language-json .token.property': colorsObjs.cyan2,
5462 namespace: {
5463 opacity: 0.7
5464 }
5465 };
5466};
5467
5468const lightSyntaxColors = {
5469 green1: '#008000',
5470 red1: '#A31515',
5471 red2: '#9a050f',
5472 red3: '#800000',
5473 red4: '#ff0000',
5474 gray1: '#393A34',
5475 cyan1: '#36acaa',
5476 cyan2: '#2B91AF',
5477 blue1: '#0000ff',
5478 blue2: '#00009f'
5479};
5480const darkSyntaxColors = {
5481 green1: '#7C7C7C',
5482 red1: '#92C379',
5483 red2: '#9a050f',
5484 red3: '#A8FF60',
5485 red4: '#96CBFE',
5486 gray1: '#EDEDED',
5487 cyan1: '#C6C5FE',
5488 cyan2: '#FFFFB6',
5489 blue1: '#B474DD',
5490 blue2: '#00009f'
5491};
5492
5493const createColors = vars => ({
5494 // Changeable colors
5495 primary: vars.colorPrimary,
5496 secondary: vars.colorSecondary,
5497 tertiary: color.tertiary,
5498 ancillary: color.ancillary,
5499 // Complimentary
5500 orange: color.orange,
5501 gold: color.gold,
5502 green: color.green,
5503 seafoam: color.seafoam,
5504 purple: color.purple,
5505 ultraviolet: color.ultraviolet,
5506 // Monochrome
5507 lightest: color.lightest,
5508 lighter: color.lighter,
5509 light: color.light,
5510 mediumlight: color.mediumlight,
5511 medium: color.medium,
5512 mediumdark: color.mediumdark,
5513 dark: color.dark,
5514 darker: color.darker,
5515 darkest: color.darkest,
5516 // For borders
5517 border: color.border,
5518 // Status
5519 positive: color.positive,
5520 negative: color.negative,
5521 warning: color.warning,
5522 critical: color.critical,
5523 defaultText: vars.textColor || color.darkest,
5524 inverseText: vars.textInverseColor || color.lightest
5525});
5526
5527const convert = (inherit = themes[getPreferredColorScheme()]) => {
5528 const {
5529 base,
5530 colorPrimary,
5531 colorSecondary,
5532 appBg,
5533 appContentBg,
5534 appBorderColor,
5535 appBorderRadius,
5536 fontBase,
5537 fontCode,
5538 textColor,
5539 textInverseColor,
5540 barTextColor,
5541 barSelectedColor,
5542 barBg,
5543 inputBg,
5544 inputBorder,
5545 inputTextColor,
5546 inputBorderRadius,
5547 brandTitle,
5548 brandUrl,
5549 brandImage,
5550 brandTarget,
5551 gridCellSize
5552 } = inherit,
5553 rest = __rest(inherit, ["base", "colorPrimary", "colorSecondary", "appBg", "appContentBg", "appBorderColor", "appBorderRadius", "fontBase", "fontCode", "textColor", "textInverseColor", "barTextColor", "barSelectedColor", "barBg", "inputBg", "inputBorder", "inputTextColor", "inputBorderRadius", "brandTitle", "brandUrl", "brandImage", "brandTarget", "gridCellSize"]);
5554
5555 return Object.assign(Object.assign({}, rest || {}), {
5556 base,
5557 color: createColors(inherit),
5558 background: {
5559 app: appBg,
5560 bar: barBg,
5561 content: appContentBg,
5562 gridCellSize: gridCellSize || background.gridCellSize,
5563 hoverable: background.hoverable,
5564 positive: background.positive,
5565 negative: background.negative,
5566 warning: background.warning,
5567 critical: background.critical
5568 },
5569 typography: {
5570 fonts: {
5571 base: fontBase,
5572 mono: fontCode
5573 },
5574 weight: typography.weight,
5575 size: typography.size
5576 },
5577 animation,
5578 easing,
5579 input: {
5580 border: inputBorder,
5581 background: inputBg,
5582 color: inputTextColor,
5583 borderRadius: inputBorderRadius
5584 },
5585 // UI
5586 layoutMargin: 10,
5587 appBorderColor,
5588 appBorderRadius,
5589 // Toolbar default/active colors
5590 barTextColor,
5591 barSelectedColor: barSelectedColor || colorSecondary,
5592 barBg,
5593 // Brand logo/text
5594 brand: {
5595 title: brandTitle,
5596 url: brandUrl,
5597 image: brandImage || (brandTitle ? null : undefined),
5598 target: brandTarget
5599 },
5600 code: create({
5601 colors: base === 'light' ? lightSyntaxColors : darkSyntaxColors,
5602 mono: fontCode
5603 }),
5604 // Addon actions theme
5605 // API example https://github.com/xyc/react-inspector/blob/master/src/styles/themes/chromeLight.js
5606 addonActionsTheme: Object.assign(Object.assign({}, base === 'light' ? chromeLight : chromeDark), {
5607 BASE_FONT_FAMILY: fontCode,
5608 BASE_FONT_SIZE: typography.size.s2 - 1,
5609 BASE_LINE_HEIGHT: '18px',
5610 BASE_BACKGROUND_COLOR: 'transparent',
5611 BASE_COLOR: textColor,
5612 ARROW_COLOR: curriedOpacify$1(0.2, appBorderColor),
5613 ARROW_MARGIN_RIGHT: 4,
5614 ARROW_FONT_SIZE: 8,
5615 TREENODE_FONT_FAMILY: fontCode,
5616 TREENODE_FONT_SIZE: typography.size.s2 - 1,
5617 TREENODE_LINE_HEIGHT: '18px',
5618 TREENODE_PADDING_LEFT: 12
5619 })
5620 });
5621};
5622
5623const isEmpty = o => Object.keys(o).length === 0;
5624
5625const isObject = o => o != null && typeof o === 'object';
5626
5627const hasOwnProperty = (o, ...args) => Object.prototype.hasOwnProperty.call(o, ...args);
5628
5629const deletedDiff = (lhs, rhs) => {
5630 if (lhs === rhs || !isObject(lhs) || !isObject(rhs)) return {};
5631 const l = lhs;
5632 const r = rhs;
5633 return Object.keys(l).reduce((acc, key) => {
5634 if (hasOwnProperty(r, key)) {
5635 const difference = deletedDiff(l[key], r[key]);
5636 if (isObject(difference) && isEmpty(difference)) return acc;
5637 acc[key] = difference;
5638 return acc;
5639 }
5640
5641 acc[key] = undefined;
5642 return acc;
5643 }, {});
5644};
5645
5646function dedent(templ) {
5647 var values = [];
5648
5649 for (var _i = 1; _i < arguments.length; _i++) {
5650 values[_i - 1] = arguments[_i];
5651 }
5652
5653 var strings = Array.from(typeof templ === 'string' ? [templ] : templ);
5654 strings[strings.length - 1] = strings[strings.length - 1].replace(/\r?\n([\t ]*)$/, '');
5655 var indentLengths = strings.reduce(function (arr, str) {
5656 var matches = str.match(/\n([\t ]+|(?!\s).)/g);
5657
5658 if (matches) {
5659 return arr.concat(matches.map(function (match) {
5660 var _a, _b;
5661
5662 return (_b = (_a = match.match(/[\t ]/g)) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;
5663 }));
5664 }
5665
5666 return arr;
5667 }, []);
5668
5669 if (indentLengths.length) {
5670 var pattern_1 = new RegExp("\n[\t ]{" + Math.min.apply(Math, indentLengths) + "}", 'g');
5671 strings = strings.map(function (str) {
5672 return str.replace(pattern_1, '\n');
5673 });
5674 }
5675
5676 strings[0] = strings[0].replace(/^\r?\n/, '');
5677 var string = strings[0];
5678 values.forEach(function (value, i) {
5679 var endentations = string.match(/(?:^|\n)( *)$/);
5680 var endentation = endentations ? endentations[1] : '';
5681 var indentedValue = value;
5682
5683 if (typeof value === 'string' && value.includes('\n')) {
5684 indentedValue = String(value).split('\n').map(function (str, i) {
5685 return i === 0 ? str : "" + endentation + str;
5686 }).join('\n');
5687 }
5688
5689 string += indentedValue + strings[i + 1];
5690 });
5691 return string;
5692}
5693
5694const ensure = input => {
5695 if (!input) {
5696 return convert(theme$1);
5697 }
5698
5699 const missing = deletedDiff(theme$1, input);
5700
5701 if (Object.keys(missing).length) {
5702 clientLogger.logger.warn(dedent`
5703 Your theme is missing properties, you should update your theme!
5704
5705 theme-data missing:
5706 `, missing);
5707 }
5708
5709 return convert(input);
5710}; // eslint-disable-next-line @typescript-eslint/triple-slash-reference
5711
5712
5713const useTheme = useTheme$1;
5714const withTheme = withTheme$1;
5715const Global = Global$1;
5716const styled = newStyled;
5717const ignoreSsrWarning = '/* emotion-disable-server-rendering-unsafe-selector-warning-please-do-not-use-this-the-warning-exists-for-a-reason */';
5718exports.CacheProvider = CacheProvider;
5719exports.ClassNames = ClassNames;
5720exports.Global = Global;
5721exports.ThemeProvider = ThemeProvider;
5722exports.background = background;
5723exports.color = color;
5724exports.convert = convert;
5725exports.create = create$1;
5726exports.createCache = createCache;
5727exports.createGlobal = createGlobal;
5728exports.createReset = createReset;
5729exports.css = css;
5730exports.darken = darkenColor;
5731exports.ensure = ensure;
5732exports.ignoreSsrWarning = ignoreSsrWarning;
5733exports.isPropValid = isPropValid;
5734exports.jsx = jsx;
5735exports.keyframes = keyframes;
5736exports.lighten = lightenColor;
5737exports.styled = styled;
5738exports.themes = themes;
5739exports.typography = typography;
5740exports.useTheme = useTheme;
5741exports.withTheme = withTheme;