styled-components 6.0.0-beta.8 → 6.0.0-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/dist/base.d.ts +2 -8
  2. package/dist/constructors/constructWithOptions.d.ts +10 -7
  3. package/dist/constructors/styled.d.ts +176 -176
  4. package/dist/hoc/withTheme.d.ts +1 -1
  5. package/dist/index.d.ts +1 -1
  6. package/dist/models/ComponentStyle.d.ts +0 -1
  7. package/dist/models/StyleSheetManager.d.ts +27 -9
  8. package/dist/models/ThemeProvider.d.ts +4 -3
  9. package/dist/native/index.d.ts +26 -27
  10. package/dist/sheet/GroupedTag.d.ts +1 -1
  11. package/dist/sheet/Sheet.d.ts +3 -3
  12. package/dist/sheet/types.d.ts +1 -1
  13. package/dist/styled-components-macro.cjs.js +5 -6
  14. package/dist/styled-components-macro.cjs.js.map +1 -1
  15. package/dist/styled-components-macro.esm.js +0 -1
  16. package/dist/styled-components-macro.esm.js.map +1 -1
  17. package/dist/styled-components.browser.cjs.js +1 -1844
  18. package/dist/styled-components.browser.cjs.js.map +1 -1
  19. package/dist/styled-components.browser.esm.js +1 -1818
  20. package/dist/styled-components.browser.esm.js.map +1 -1
  21. package/dist/styled-components.cjs.js +1 -1864
  22. package/dist/styled-components.cjs.js.map +1 -1
  23. package/dist/styled-components.esm.js +1 -1838
  24. package/dist/styled-components.esm.js.map +1 -1
  25. package/dist/styled-components.js +269 -249
  26. package/dist/styled-components.js.map +1 -1
  27. package/dist/styled-components.min.js +1 -1
  28. package/dist/styled-components.min.js.map +1 -1
  29. package/dist/test/types.d.ts +9 -0
  30. package/dist/test/utils.d.ts +176 -176
  31. package/dist/tsconfig.tsbuildinfo +1 -1
  32. package/dist/types.d.ts +34 -41
  33. package/dist/utils/determineTheme.d.ts +4 -2
  34. package/dist/utils/domElements.d.ts +1 -1
  35. package/dist/utils/flatten.d.ts +1 -1
  36. package/dist/utils/hoist.d.ts +3 -3
  37. package/dist/utils/isFunction.d.ts +1 -1
  38. package/dist/utils/isPlainObject.d.ts +1 -1
  39. package/dist/utils/isStatelessFunction.d.ts +1 -1
  40. package/dist/utils/joinStrings.d.ts +2 -1
  41. package/dist/utils/stylis.d.ts +1 -1
  42. package/native/dist/base.d.ts +2 -8
  43. package/native/dist/constructors/constructWithOptions.d.ts +10 -7
  44. package/native/dist/constructors/styled.d.ts +176 -176
  45. package/native/dist/hoc/withTheme.d.ts +1 -1
  46. package/native/dist/index.d.ts +1 -1
  47. package/native/dist/models/ComponentStyle.d.ts +0 -1
  48. package/native/dist/models/StyleSheetManager.d.ts +27 -9
  49. package/native/dist/models/ThemeProvider.d.ts +4 -3
  50. package/native/dist/native/index.d.ts +26 -27
  51. package/native/dist/sheet/GroupedTag.d.ts +1 -1
  52. package/native/dist/sheet/Sheet.d.ts +3 -3
  53. package/native/dist/sheet/types.d.ts +1 -1
  54. package/native/dist/styled-components.native.cjs.js +1 -1305
  55. package/native/dist/styled-components.native.cjs.js.map +1 -1
  56. package/native/dist/styled-components.native.esm.js +1 -1287
  57. package/native/dist/styled-components.native.esm.js.map +1 -1
  58. package/native/dist/test/types.d.ts +9 -0
  59. package/native/dist/test/utils.d.ts +176 -176
  60. package/native/dist/types.d.ts +34 -41
  61. package/native/dist/utils/determineTheme.d.ts +4 -2
  62. package/native/dist/utils/domElements.d.ts +1 -1
  63. package/native/dist/utils/flatten.d.ts +1 -1
  64. package/native/dist/utils/hoist.d.ts +3 -3
  65. package/native/dist/utils/isFunction.d.ts +1 -1
  66. package/native/dist/utils/isPlainObject.d.ts +1 -1
  67. package/native/dist/utils/isStatelessFunction.d.ts +1 -1
  68. package/native/dist/utils/joinStrings.d.ts +2 -1
  69. package/native/dist/utils/stylis.d.ts +1 -1
  70. package/package.json +22 -34
  71. package/dist/hooks/useTheme.d.ts +0 -3
@@ -4,26 +4,24 @@
4
4
  (global = global || self, global.styled = factory(global.React));
5
5
  })(this, (function (React) { 'use strict';
6
6
 
7
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
-
9
- var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
10
-
11
- var SC_ATTR = (typeof process !== 'undefined' && (process.env.REACT_APP_SC_ATTR || process.env.SC_ATTR)) ||
7
+ var SC_ATTR = (typeof process !== 'undefined' && typeof process.env !== 'undefined' && (process.env.REACT_APP_SC_ATTR || process.env.SC_ATTR)) ||
12
8
  'data-styled';
13
9
  var SC_ATTR_ACTIVE = 'active';
14
10
  var SC_ATTR_VERSION = 'data-styled-version';
15
- var SC_VERSION = "6.0.0-beta.8";
11
+ var SC_VERSION = "6.0.0-rc.0";
16
12
  var SPLITTER = '/*!sc*/\n';
17
13
  var IS_BROWSER = typeof window !== 'undefined' && 'HTMLElement' in window;
18
14
  var DISABLE_SPEEDY = Boolean(typeof SC_DISABLE_SPEEDY === 'boolean'
19
15
  ? SC_DISABLE_SPEEDY
20
16
  : typeof process !== 'undefined' &&
17
+ typeof process.env !== 'undefined' &&
21
18
  typeof process.env.REACT_APP_SC_DISABLE_SPEEDY !== 'undefined' &&
22
19
  process.env.REACT_APP_SC_DISABLE_SPEEDY !== ''
23
20
  ? process.env.REACT_APP_SC_DISABLE_SPEEDY === 'false'
24
21
  ? false
25
22
  : process.env.REACT_APP_SC_DISABLE_SPEEDY
26
23
  : typeof process !== 'undefined' &&
24
+ typeof process.env !== 'undefined' &&
27
25
  typeof process.env.SC_DISABLE_SPEEDY !== 'undefined' &&
28
26
  process.env.SC_DISABLE_SPEEDY !== ''
29
27
  ? process.env.SC_DISABLE_SPEEDY === 'false'
@@ -162,17 +160,10 @@
162
160
  }
163
161
  }
164
162
  var ruleIndex = this.indexOfGroup(group + 1);
165
- if (Array.isArray(rules)) {
166
- for (var i = 0, l = rules.length; i < l; i++) {
167
- if (this.tag.insertRule(ruleIndex, rules[i])) {
168
- this.groupSizes[group]++;
169
- ruleIndex++;
170
- }
171
- }
172
- }
173
- else {
174
- if (this.tag.insertRule(ruleIndex, rules)) {
163
+ for (var i = 0, l = rules.length; i < l; i++) {
164
+ if (this.tag.insertRule(ruleIndex, rules[i])) {
175
165
  this.groupSizes[group]++;
166
+ ruleIndex++;
176
167
  }
177
168
  }
178
169
  };
@@ -266,7 +257,6 @@
266
257
  var names = content.split(',');
267
258
  var name;
268
259
  for (var i = 0, l = names.length; i < l; i++) {
269
- // eslint-disable-next-line
270
260
  if ((name = names[i])) {
271
261
  sheet.registerName(id, name);
272
262
  }
@@ -375,10 +365,10 @@
375
365
  };
376
366
  var CSSOMTag = /** @class */ (function () {
377
367
  function CSSOMTag(target) {
378
- var element = (this.element = makeStyleTag(target));
368
+ this.element = makeStyleTag(target);
379
369
  // Avoid Edge bug where empty style elements don't create sheets
380
- element.appendChild(document.createTextNode(''));
381
- this.sheet = getSheet(element);
370
+ this.element.appendChild(document.createTextNode(''));
371
+ this.sheet = getSheet(this.element);
382
372
  this.length = 0;
383
373
  }
384
374
  CSSOMTag.prototype.insertRule = function (index, rule) {
@@ -398,7 +388,7 @@
398
388
  CSSOMTag.prototype.getRule = function (index) {
399
389
  var rule = this.sheet.cssRules[index];
400
390
  // Avoid IE11 quirk where cssText is inaccessible on some invalid rules
401
- if (rule !== undefined && typeof rule.cssText === 'string') {
391
+ if (rule && rule.cssText) {
402
392
  return rule.cssText;
403
393
  }
404
394
  else {
@@ -410,8 +400,8 @@
410
400
  /** A Tag that emulates the CSSStyleSheet API but uses text nodes */
411
401
  var TextTag = /** @class */ (function () {
412
402
  function TextTag(target) {
413
- var element = (this.element = makeStyleTag(target));
414
- this.nodes = element.childNodes;
403
+ this.element = makeStyleTag(target);
404
+ this.nodes = this.element.childNodes;
415
405
  this.length = 0;
416
406
  }
417
407
  TextTag.prototype.insertRule = function (index, rule) {
@@ -598,7 +588,7 @@
598
588
  return true;
599
589
  };
600
590
 
601
- var e="-ms-";var r="-moz-";var a="-webkit-";var n="comm";var c="rule";var s="decl";var i="@import";var h="@keyframes";var $=Math.abs;var k=String.fromCharCode;var g=Object.assign;function m(e,r){return C(e,0)^45?(((r<<2^C(e,0))<<2^C(e,1))<<2^C(e,2))<<2^C(e,3):0}function x(e){return e.trim()}function y(e,r){return (e=r.exec(e))?e[0]:e}function j(e,r,a){return e.replace(r,a)}function z(e,r){return e.indexOf(r)}function C(e,r){return e.charCodeAt(r)|0}function O(e,r,a){return e.slice(r,a)}function A(e){return e.length}function M(e){return e.length}function S(e,r){return r.push(e),e}function q(e,r){return e.map(r).join("")}var B=1;var D=1;var E=0;var F=0;var G=0;var H="";function I(e,r,a,n,c,s,t){return {value:e,root:r,parent:a,type:n,props:c,children:s,line:B,column:D,length:t,return:""}}function J(e,r){return g(I("",null,null,"",null,null,0),e,{length:-e.length},r)}function K(){return G}function L(){G=F>0?C(H,--F):0;if(D--,G===10)D=1,B--;return G}function N(){G=F<E?C(H,F++):0;if(D++,G===10)D=1,B++;return G}function P(){return C(H,F)}function Q(){return F}function R(e,r){return O(H,e,r)}function T(e){switch(e){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function U(e){return B=D=1,E=A(H=e),F=0,[]}function V(e){return H="",e}function W(e){return x(R(F-1,ee(e===91?e+2:e===40?e+1:e)))}function Y(e){while(G=P())if(G<33)N();else break;return T(e)>2||T(G)>3?"":" "}function _(e,r){while(--r&&N())if(G<48||G>102||G>57&&G<65||G>70&&G<97)break;return R(e,Q()+(r<6&&P()==32&&N()==32))}function ee(e){while(N())switch(G){case e:return F;case 34:case 39:if(e!==34&&e!==39)ee(G);break;case 40:if(e===41)ee(e);break;case 92:N();break}return F}function re(e,r){while(N())if(e+G===47+10)break;else if(e+G===42+42&&P()===47)break;return "/*"+R(r,F-1)+"*"+k(e===47?e:N())}function ae(e){while(!T(P()))N();return R(e,F)}function ne(e){return V(ce("",null,null,null,[""],e=U(e),0,[0],e))}function ce(e,r,a,n,c,s,t,u,i){var f=0;var o=0;var l=t;var v=0;var p=0;var h=0;var b=1;var w=1;var d=1;var $=0;var g="";var m=c;var x=s;var y=n;var O=g;while(w)switch(h=$,$=N()){case 40:if(h!=108&&C(O,l-1)==58){if(z(O+=j(W($),"&","&\f"),"&\f")!=-1)d=-1;break}case 34:case 39:case 91:O+=W($);break;case 9:case 10:case 13:case 32:O+=Y(h);break;case 92:O+=_(Q()-1,7);continue;case 47:switch(P()){case 42:case 47:S(te(re(N(),Q()),r,a),i);break;default:O+="/";}break;case 123*b:u[f++]=A(O)*d;case 125*b:case 59:case 0:switch($){case 0:case 125:w=0;case 59+o:if(p>0&&A(O)-l)S(p>32?ue(O+";",n,a,l-1):ue(j(O," ","")+";",n,a,l-2),i);break;case 59:O+=";";default:S(y=se(O,r,a,f,o,c,u,g,m=[],x=[],l),s);if($===123)if(o===0)ce(O,r,y,y,m,s,l,u,x);else switch(v===99&&C(O,3)===110?100:v){case 100:case 109:case 115:ce(e,y,y,n&&S(se(e,y,y,0,0,c,u,g,c,m=[],l),x),c,x,l,u,n?m:x);break;default:ce(O,y,y,y,[""],x,0,u,x);}}f=o=p=0,b=d=1,g=O="",l=t;break;case 58:l=1+A(O),p=h;default:if(b<1)if($==123)--b;else if($==125&&b++==0&&L()==125)continue;switch(O+=k($),$*b){case 38:d=o>0?1:(O+="\f",-1);break;case 44:u[f++]=(A(O)-1)*d,d=1;break;case 64:if(P()===45)O+=W(N());v=P(),o=l=A(g=O+=ae(Q())),$++;break;case 45:if(h===45&&A(O)==2)b=0;}}return s}function se(e,r,a,n,s,t,u,i,f,o,l){var v=s-1;var p=s===0?t:[""];var h=M(p);for(var b=0,w=0,d=0;b<n;++b)for(var k=0,g=O(e,v+1,v=$(w=u[b])),m=e;k<h;++k)if(m=x(w>0?p[k]+" "+g:j(g,/&\f/g,p[k])))f[d++]=m;return I(e,r,a,s===0?c:i,f,o,l)}function te(e,r,a){return I(e,r,a,n,k(K()),O(e,2,-2),0)}function ue(e,r,a,n){return I(e,r,a,s,O(e,0,n),O(e,n+1,-1),n)}function ie(n,c,s){switch(m(n,c)){case 5103:return a+"print-"+n+n;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 6391:case 5879:case 5623:case 6135:case 4599:case 4855:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:return a+n+n;case 4789:return r+n+n;case 5349:case 4246:case 4810:case 6968:case 2756:return a+n+r+n+e+n+n;case 5936:switch(C(n,c+11)){case 114:return a+n+e+j(n,/[svh]\w+-[tblr]{2}/,"tb")+n;case 108:return a+n+e+j(n,/[svh]\w+-[tblr]{2}/,"tb-rl")+n;case 45:return a+n+e+j(n,/[svh]\w+-[tblr]{2}/,"lr")+n}case 6828:case 4268:case 2903:return a+n+e+n+n;case 6165:return a+n+e+"flex-"+n+n;case 5187:return a+n+j(n,/(\w+).+(:[^]+)/,a+"box-$1$2"+e+"flex-$1$2")+n;case 5443:return a+n+e+"flex-item-"+j(n,/flex-|-self/g,"")+(!y(n,/flex-|baseline/)?e+"grid-row-"+j(n,/flex-|-self/g,""):"")+n;case 4675:return a+n+e+"flex-line-pack"+j(n,/align-content|flex-|-self/g,"")+n;case 5548:return a+n+e+j(n,"shrink","negative")+n;case 5292:return a+n+e+j(n,"basis","preferred-size")+n;case 6060:return a+"box-"+j(n,"-grow","")+a+n+e+j(n,"grow","positive")+n;case 4554:return a+j(n,/([^-])(transform)/g,"$1"+a+"$2")+n;case 6187:return j(j(j(n,/(zoom-|grab)/,a+"$1"),/(image-set)/,a+"$1"),n,"")+n;case 5495:case 3959:return j(n,/(image-set\([^]*)/,a+"$1"+"$`$1");case 4968:return j(j(n,/(.+:)(flex-)?(.*)/,a+"box-pack:$3"+e+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+a+n+n;case 4200:if(!y(n,/flex-|baseline/))return e+"grid-column-align"+O(n,c)+n;break;case 2592:case 3360:return e+j(n,"template-","")+n;case 4384:case 3616:if(s&&s.some((function(e,r){return c=r,y(e.props,/grid-\w+-end/)}))){return ~z(n+(s=s[c].value),"span")?n:e+j(n,"-start","")+n+e+"grid-row-span:"+(~z(s,"span")?y(s,/\d+/):+y(s,/\d+/)-+y(n,/\d+/))+";"}return e+j(n,"-start","")+n;case 4896:case 4128:return s&&s.some((function(e){return y(e.props,/grid-\w+-start/)}))?n:e+j(j(n,"-end","-span"),"span ","")+n;case 4095:case 3583:case 4068:case 2532:return j(n,/(.+)-inline(.+)/,a+"$1$2")+n;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(A(n)-1-c>6)switch(C(n,c+1)){case 109:if(C(n,c+4)!==45)break;case 102:return j(n,/(.+:)(.+)-([^]+)/,"$1"+a+"$2-$3"+"$1"+r+(C(n,c+3)==108?"$3":"$2-$3"))+n;case 115:return ~z(n,"stretch")?ie(j(n,"stretch","fill-available"),c,s)+n:n}break;case 5152:case 5920:return j(n,/(.+?):(\d+)(\s*\/\s*(span)?\s*(\d+))?(.*)/,(function(r,a,c,s,t,u,i){return e+a+":"+c+i+(s?e+a+"-span:"+(t?u:+u-+c)+i:"")+n}));case 4949:if(C(n,c+6)===121)return j(n,":",":"+a)+n;break;case 6444:switch(C(n,C(n,14)===45?18:11)){case 120:return j(n,/(.+:)([^;\s!]+)(;|(\s+)?!.+)?/,"$1"+a+(C(n,14)===45?"inline-":"")+"box$3"+"$1"+a+"$2$3"+"$1"+e+"$2box$3")+n;case 100:return j(n,":",":"+e)+n}break;case 5719:case 2647:case 2135:case 3927:case 2391:return j(n,"scroll-","scroll-snap-")+n}return n}function fe(e,r){var a="";var n=M(e);for(var c=0;c<n;c++)a+=r(e[c],c,e,r)||"";return a}function oe(e,r,a,t){switch(e.type){case i:case s:return e.return=e.return||e.value;case n:return "";case h:return e.return=e.value+"{"+fe(e.children,t)+"}";case c:e.value=e.props.join(",");}return A(a=fe(e.children,t))?e.return=e.value+"{"+a+"}":""}function le(e){var r=M(e);return function(a,n,c,s){var t="";for(var u=0;u<r;u++)t+=e[u](a,n,c,s)||"";return t}}function pe(n,t,u,i){if(n.length>-1)if(!n.return)switch(n.type){case s:n.return=ie(n.value,n.length,u);return;case h:return fe([J(n,{value:j(n.value,"@","@"+a)})],i);case c:if(n.length)return q(n.props,(function(c){switch(y(c,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return fe([J(n,{props:[j(c,/:(read-\w+)/,":"+r+"$1")]})],i);case"::placeholder":return fe([J(n,{props:[j(c,/:(plac\w+)/,":"+a+"input-$1")]}),J(n,{props:[j(c,/:(plac\w+)/,":"+r+"$1")]}),J(n,{props:[j(c,/:(plac\w+)/,e+"input-$1")]})],i)}return ""}))}}
591
+ var e="-ms-";var r="-moz-";var a="-webkit-";var n="comm";var c="rule";var s="decl";var i="@import";var h="@keyframes";var $=Math.abs;var g=String.fromCharCode;var k=Object.assign;function m(e,r){return C(e,0)^45?(((r<<2^C(e,0))<<2^C(e,1))<<2^C(e,2))<<2^C(e,3):0}function x(e){return e.trim()}function y(e,r){return (e=r.exec(e))?e[0]:e}function j(e,r,a){return e.replace(r,a)}function z(e,r){return e.indexOf(r)}function C(e,r){return e.charCodeAt(r)|0}function O(e,r,a){return e.slice(r,a)}function A(e){return e.length}function M(e){return e.length}function S(e,r){return r.push(e),e}function q(e,r){return e.map(r).join("")}var B=1;var D=1;var E=0;var F=0;var G=0;var H="";function I(e,r,a,n,c,s,t){return {value:e,root:r,parent:a,type:n,props:c,children:s,line:B,column:D,length:t,return:""}}function J(e,r){return k(I("",null,null,"",null,null,0),e,{length:-e.length},r)}function K(){return G}function L(){G=F>0?C(H,--F):0;if(D--,G===10)D=1,B--;return G}function N(){G=F<E?C(H,F++):0;if(D++,G===10)D=1,B++;return G}function P(){return C(H,F)}function Q(){return F}function R(e,r){return O(H,e,r)}function T(e){switch(e){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function U(e){return B=D=1,E=A(H=e),F=0,[]}function V(e){return H="",e}function W(e){return x(R(F-1,ee(e===91?e+2:e===40?e+1:e)))}function Y(e){while(G=P())if(G<33)N();else break;return T(e)>2||T(G)>3?"":" "}function _(e,r){while(--r&&N())if(G<48||G>102||G>57&&G<65||G>70&&G<97)break;return R(e,Q()+(r<6&&P()==32&&N()==32))}function ee(e){while(N())switch(G){case e:return F;case 34:case 39:if(e!==34&&e!==39)ee(G);break;case 40:if(e===41)ee(e);break;case 92:N();break}return F}function re(e,r){while(N())if(e+G===47+10)break;else if(e+G===42+42&&P()===47)break;return "/*"+R(r,F-1)+"*"+g(e===47?e:N())}function ae(e){while(!T(P()))N();return R(e,F)}function ne(e){return V(ce("",null,null,null,[""],e=U(e),0,[0],e))}function ce(e,r,a,n,c,s,t,u,i){var f=0;var o=0;var l=t;var v=0;var p=0;var h=0;var b=1;var w=1;var d=1;var $=0;var k="";var m=c;var x=s;var y=n;var O=k;while(w)switch(h=$,$=N()){case 40:if(h!=108&&C(O,l-1)==58){if(z(O+=j(W($),"&","&\f"),"&\f")!=-1)d=-1;break}case 34:case 39:case 91:O+=W($);break;case 9:case 10:case 13:case 32:O+=Y(h);break;case 92:O+=_(Q()-1,7);continue;case 47:switch(P()){case 42:case 47:S(te(re(N(),Q()),r,a),i);break;default:O+="/";}break;case 123*b:u[f++]=A(O)*d;case 125*b:case 59:case 0:switch($){case 0:case 125:w=0;case 59+o:if(d==-1)O=j(O,/\f/g,"");if(p>0&&A(O)-l)S(p>32?ue(O+";",n,a,l-1):ue(j(O," ","")+";",n,a,l-2),i);break;case 59:O+=";";default:S(y=se(O,r,a,f,o,c,u,k,m=[],x=[],l),s);if($===123)if(o===0)ce(O,r,y,y,m,s,l,u,x);else switch(v===99&&C(O,3)===110?100:v){case 100:case 109:case 115:ce(e,y,y,n&&S(se(e,y,y,0,0,c,u,k,c,m=[],l),x),c,x,l,u,n?m:x);break;default:ce(O,y,y,y,[""],x,0,u,x);}}f=o=p=0,b=d=1,k=O="",l=t;break;case 58:l=1+A(O),p=h;default:if(b<1)if($==123)--b;else if($==125&&b++==0&&L()==125)continue;switch(O+=g($),$*b){case 38:d=o>0?1:(O+="\f",-1);break;case 44:u[f++]=(A(O)-1)*d,d=1;break;case 64:if(P()===45)O+=W(N());v=P(),o=l=A(k=O+=ae(Q())),$++;break;case 45:if(h===45&&A(O)==2)b=0;}}return s}function se(e,r,a,n,s,t,u,i,f,o,l){var v=s-1;var p=s===0?t:[""];var h=M(p);for(var b=0,w=0,d=0;b<n;++b)for(var g=0,k=O(e,v+1,v=$(w=u[b])),m=e;g<h;++g)if(m=x(w>0?p[g]+" "+k:j(k,/&\f/g,p[g])))f[d++]=m;return I(e,r,a,s===0?c:i,f,o,l)}function te(e,r,a){return I(e,r,a,n,g(K()),O(e,2,-2),0)}function ue(e,r,a,n){return I(e,r,a,s,O(e,0,n),O(e,n+1,-1),n)}function ie(n,c,s){switch(m(n,c)){case 5103:return a+"print-"+n+n;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 6391:case 5879:case 5623:case 6135:case 4599:case 4855:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:return a+n+n;case 4789:return r+n+n;case 5349:case 4246:case 4810:case 6968:case 2756:return a+n+r+n+e+n+n;case 5936:switch(C(n,c+11)){case 114:return a+n+e+j(n,/[svh]\w+-[tblr]{2}/,"tb")+n;case 108:return a+n+e+j(n,/[svh]\w+-[tblr]{2}/,"tb-rl")+n;case 45:return a+n+e+j(n,/[svh]\w+-[tblr]{2}/,"lr")+n}case 6828:case 4268:case 2903:return a+n+e+n+n;case 6165:return a+n+e+"flex-"+n+n;case 5187:return a+n+j(n,/(\w+).+(:[^]+)/,a+"box-$1$2"+e+"flex-$1$2")+n;case 5443:return a+n+e+"flex-item-"+j(n,/flex-|-self/g,"")+(!y(n,/flex-|baseline/)?e+"grid-row-"+j(n,/flex-|-self/g,""):"")+n;case 4675:return a+n+e+"flex-line-pack"+j(n,/align-content|flex-|-self/g,"")+n;case 5548:return a+n+e+j(n,"shrink","negative")+n;case 5292:return a+n+e+j(n,"basis","preferred-size")+n;case 6060:return a+"box-"+j(n,"-grow","")+a+n+e+j(n,"grow","positive")+n;case 4554:return a+j(n,/([^-])(transform)/g,"$1"+a+"$2")+n;case 6187:return j(j(j(n,/(zoom-|grab)/,a+"$1"),/(image-set)/,a+"$1"),n,"")+n;case 5495:case 3959:return j(n,/(image-set\([^]*)/,a+"$1"+"$`$1");case 4968:return j(j(n,/(.+:)(flex-)?(.*)/,a+"box-pack:$3"+e+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+a+n+n;case 4200:if(!y(n,/flex-|baseline/))return e+"grid-column-align"+O(n,c)+n;break;case 2592:case 3360:return e+j(n,"template-","")+n;case 4384:case 3616:if(s&&s.some((function(e,r){return c=r,y(e.props,/grid-\w+-end/)}))){return ~z(n+(s=s[c].value),"span")?n:e+j(n,"-start","")+n+e+"grid-row-span:"+(~z(s,"span")?y(s,/\d+/):+y(s,/\d+/)-+y(n,/\d+/))+";"}return e+j(n,"-start","")+n;case 4896:case 4128:return s&&s.some((function(e){return y(e.props,/grid-\w+-start/)}))?n:e+j(j(n,"-end","-span"),"span ","")+n;case 4095:case 3583:case 4068:case 2532:return j(n,/(.+)-inline(.+)/,a+"$1$2")+n;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(A(n)-1-c>6)switch(C(n,c+1)){case 109:if(C(n,c+4)!==45)break;case 102:return j(n,/(.+:)(.+)-([^]+)/,"$1"+a+"$2-$3"+"$1"+r+(C(n,c+3)==108?"$3":"$2-$3"))+n;case 115:return ~z(n,"stretch")?ie(j(n,"stretch","fill-available"),c,s)+n:n}break;case 5152:case 5920:return j(n,/(.+?):(\d+)(\s*\/\s*(span)?\s*(\d+))?(.*)/,(function(r,a,c,s,t,u,i){return e+a+":"+c+i+(s?e+a+"-span:"+(t?u:+u-+c)+i:"")+n}));case 4949:if(C(n,c+6)===121)return j(n,":",":"+a)+n;break;case 6444:switch(C(n,C(n,14)===45?18:11)){case 120:return j(n,/(.+:)([^;\s!]+)(;|(\s+)?!.+)?/,"$1"+a+(C(n,14)===45?"inline-":"")+"box$3"+"$1"+a+"$2$3"+"$1"+e+"$2box$3")+n;case 100:return j(n,":",":"+e)+n}break;case 5719:case 2647:case 2135:case 3927:case 2391:return j(n,"scroll-","scroll-snap-")+n}return n}function fe(e,r){var a="";var n=M(e);for(var c=0;c<n;c++)a+=r(e[c],c,e,r)||"";return a}function oe(e,r,a,t){switch(e.type){case i:case s:return e.return=e.return||e.value;case n:return "";case h:return e.return=e.value+"{"+fe(e.children,t)+"}";case c:e.value=e.props.join(",");}return A(a=fe(e.children,t))?e.return=e.value+"{"+a+"}":""}function le(e){var r=M(e);return function(a,n,c,s){var t="";for(var u=0;u<r;u++)t+=e[u](a,n,c,s)||"";return t}}function pe(n,t,u,i){if(n.length>-1)if(!n.return)switch(n.type){case s:n.return=ie(n.value,n.length,u);return;case h:return fe([J(n,{value:j(n.value,"@","@"+a)})],i);case c:if(n.length)return q(n.props,(function(c){switch(y(c,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return fe([J(n,{props:[j(c,/:(read-\w+)/,":"+r+"$1")]})],i);case"::placeholder":return fe([J(n,{props:[j(c,/:(plac\w+)/,":"+a+"input-$1")]}),J(n,{props:[j(c,/:(plac\w+)/,":"+r+"$1")]}),J(n,{props:[j(c,/:(plac\w+)/,e+"input-$1")]})],i)}return ""}))}}
602
592
 
603
593
  var SEED$1 = 5381;
604
594
  // When we have separate strings it's useful to run a progressive
@@ -616,26 +606,60 @@
616
606
  return phash(SEED$1, x);
617
607
  };
618
608
 
609
+ var AMP_REGEX = /&/g;
619
610
  var COMMENT_REGEX = /^\s*\/\/.*$/gm;
620
- var COMPLEX_SELECTOR_PREFIX = [':', '[', '.', '#'];
621
611
  /**
622
612
  * Serialize stylis output as an array of css strings. It is important that rules are
623
613
  * separated when using CSSOM injection.
624
614
  */
625
615
  function serialize(children, callback) {
626
- return children.map(function (c, i) { return callback(c, i, children, callback); }).filter(Boolean);
616
+ var ret = [];
617
+ for (var i = 0, result = void 0; i < children.length; i += 1) {
618
+ result = callback(children[i], i, children, callback);
619
+ if (result)
620
+ ret.push(result);
621
+ }
622
+ return ret;
623
+ }
624
+ /**
625
+ * Takes an element and recurses through it's rules added the namespace to the start of each selector.
626
+ * Takes into account media queries by recursing through child rules if they are present.
627
+ */
628
+ function recursivelySetNamepace(compiled, namespace) {
629
+ return compiled.map(function (rule) {
630
+ if (rule.type === 'rule') {
631
+ // add the namespace to the start
632
+ rule.value = "".concat(namespace, " ").concat(rule.value);
633
+ // add the namespace after each comma for subsequent selectors.
634
+ // @ts-expect-error we target modern browsers but intentionally transpile to ES5 for speed
635
+ rule.value = rule.value.replaceAll(',', ",".concat(namespace, " "));
636
+ rule.props = rule.props.map(function (prop) {
637
+ return "".concat(namespace, " ").concat(prop);
638
+ });
639
+ }
640
+ if (Array.isArray(rule.children) && rule.type !== '@keyframes') {
641
+ rule.children = recursivelySetNamepace(rule.children, namespace);
642
+ }
643
+ return rule;
644
+ });
627
645
  }
628
646
  function createStylisInstance(_a) {
629
647
  var _b = _a === void 0 ? EMPTY_OBJECT : _a, _c = _b.options, options = _c === void 0 ? EMPTY_OBJECT : _c, _d = _b.plugins, plugins = _d === void 0 ? EMPTY_ARRAY : _d;
630
648
  var _componentId;
631
649
  var _selector;
632
650
  var _selectorRegexp;
633
- var _consecutiveSelfRefRegExp;
634
651
  var selfReferenceReplacer = function (match, offset, string) {
635
652
  if (
636
- // do not replace the first occurrence if it is complex (has a modifier)
637
- (offset === 0 ? !COMPLEX_SELECTOR_PREFIX.includes(string[_selector.length]) : true) && // no consecutive self refs (.b.b); that is a precedence boost and treated differently
638
- !string.match(_consecutiveSelfRefRegExp)) {
653
+ /**
654
+ * We only want to refer to the static class directly in the following scenarios:
655
+ *
656
+ * 1. The selector is alone on the line `& { color: red; }`
657
+ * 2. The selector is part of a self-reference selector `& + & { color: red; }`
658
+ */
659
+ string === _selector ||
660
+ (string.startsWith(_selector) &&
661
+ string.endsWith(_selector) &&
662
+ string.replaceAll(_selector, '').length > 0)) {
639
663
  return ".".concat(_componentId);
640
664
  }
641
665
  return match;
@@ -654,10 +678,20 @@
654
678
  */
655
679
  var selfReferenceReplacementPlugin = function (element) {
656
680
  if (element.type === c && element.value.includes('&')) {
657
- var props = element.props;
658
- props[0] = props[0].replace(_selectorRegexp, selfReferenceReplacer);
681
+ element.props[0] = element.props[0]
682
+ // catch any hanging references that stylis missed
683
+ .replace(AMP_REGEX, _selector)
684
+ .replace(_selectorRegexp, selfReferenceReplacer);
659
685
  }
660
686
  };
687
+ var middlewares = plugins.slice();
688
+ /**
689
+ * Enables automatic vendor-prefixing for styles.
690
+ */
691
+ if (options.prefix) {
692
+ middlewares.unshift(pe);
693
+ }
694
+ middlewares.push(selfReferenceReplacementPlugin, oe);
661
695
  var stringifyRules = function (css, selector,
662
696
  /**
663
697
  * This "prefix" referes to a _selector_ prefix.
@@ -666,25 +700,18 @@
666
700
  if (selector === void 0) { selector = ''; }
667
701
  if (prefix === void 0) { prefix = ''; }
668
702
  if (componentId === void 0) { componentId = '&'; }
669
- var flatCSS = css.replace(COMMENT_REGEX, '');
670
703
  // stylis has no concept of state to be passed to plugins
671
704
  // but since JS is single-threaded, we can rely on that to ensure
672
705
  // these properties stay in sync with the current stylis run
673
706
  _componentId = componentId;
674
707
  _selector = selector;
675
708
  _selectorRegexp = new RegExp("\\".concat(_selector, "\\b"), 'g');
676
- _consecutiveSelfRefRegExp = new RegExp("(\\".concat(_selector, "\\b){2,}"));
677
- var middlewares = plugins.slice();
678
- /**
679
- * Enables automatic vendor-prefixing for styles.
680
- */
681
- if (options.prefix || options.prefix === undefined) {
682
- middlewares.unshift(pe);
709
+ var flatCSS = css.replace(COMMENT_REGEX, '');
710
+ var compiled = ne(prefix || selector ? "".concat(prefix, " ").concat(selector, " { ").concat(flatCSS, " }") : flatCSS);
711
+ if (options.namespace) {
712
+ compiled = recursivelySetNamepace(compiled, options.namespace);
683
713
  }
684
- middlewares.push(selfReferenceReplacementPlugin, oe);
685
- return serialize(ne(options.namespace || prefix || selector
686
- ? "".concat(options.namespace ? options.namespace + ' ' : '').concat(prefix, " ").concat(selector, " { ").concat(flatCSS, " }")
687
- : flatCSS), le(middlewares));
714
+ return serialize(compiled, le(middlewares));
688
715
  };
689
716
  stringifyRules.hash = plugins.length
690
717
  ? plugins
@@ -699,24 +726,24 @@
699
726
  return stringifyRules;
700
727
  }
701
728
 
702
- var StyleSheetContext = React__default["default"].createContext(undefined);
703
- var StyleSheetConsumer = StyleSheetContext.Consumer;
704
- var StylisContext = React__default["default"].createContext(undefined);
705
729
  var mainSheet = new StyleSheet();
706
730
  var mainStylis = createStylisInstance();
707
- function useStyleSheet() {
708
- return React.useContext(StyleSheetContext) || mainSheet;
709
- }
710
- function useStylis() {
711
- return React.useContext(StylisContext) || mainStylis;
731
+ var StyleSheetContext = React.createContext({
732
+ shouldForwardProp: undefined,
733
+ styleSheet: mainSheet,
734
+ stylis: mainStylis,
735
+ });
736
+ var StyleSheetConsumer = StyleSheetContext.Consumer;
737
+ var StylisContext = React.createContext(undefined);
738
+ function useStyleSheetContext() {
739
+ return React.useContext(StyleSheetContext);
712
740
  }
713
741
  function StyleSheetManager(props) {
714
742
  var _a = React.useState(props.stylisPlugins), plugins = _a[0], setPlugins = _a[1];
715
- var contextStyleSheet = useStyleSheet();
716
- var styleSheet = React.useMemo(function () {
717
- var sheet = contextStyleSheet;
743
+ var styleSheet = useStyleSheetContext().styleSheet;
744
+ var resolvedStyleSheet = React.useMemo(function () {
745
+ var sheet = styleSheet;
718
746
  if (props.sheet) {
719
- // eslint-disable-next-line prefer-destructuring
720
747
  sheet = props.sheet;
721
748
  }
722
749
  else if (props.target) {
@@ -726,20 +753,19 @@
726
753
  sheet = sheet.reconstructWithOptions({ useCSSOMInjection: false });
727
754
  }
728
755
  return sheet;
729
- }, [props.disableCSSOMInjection, props.sheet, props.target]);
756
+ }, [props.disableCSSOMInjection, props.sheet, props.target, styleSheet]);
730
757
  var stylis = React.useMemo(function () {
731
758
  return createStylisInstance({
732
- options: { namespace: props.namespace, prefix: !props.disableVendorPrefixes },
759
+ options: { namespace: props.namespace, prefix: props.enableVendorPrefixes },
733
760
  plugins: plugins,
734
761
  });
735
- }, [props.disableVendorPrefixes, props.namespace, plugins]);
762
+ }, [props.enableVendorPrefixes, props.namespace, plugins]);
736
763
  React.useEffect(function () {
737
764
  if (!shallowequal(plugins, props.stylisPlugins))
738
765
  setPlugins(props.stylisPlugins);
739
766
  }, [props.stylisPlugins]);
740
- return (React__default["default"].createElement(StyleSheetContext.Provider, { value: styleSheet },
741
- React__default["default"].createElement(StylisContext.Provider, { value: stylis }, React__default["default"].Children.only(props.children)
742
- )));
767
+ return (React.createElement(StyleSheetContext.Provider, { value: { shouldForwardProp: props.shouldForwardProp, styleSheet: resolvedStyleSheet, stylis: stylis } },
768
+ React.createElement(StylisContext.Provider, { value: stylis }, props.children)));
743
769
  }
744
770
 
745
771
  var Keyframes = /** @class */ (function () {
@@ -821,8 +847,8 @@
821
847
  if (value == null || typeof value === 'boolean' || value === '') {
822
848
  return '';
823
849
  }
824
- if (typeof value === 'number' && value !== 0 && !(name in unitlessKeys)) {
825
- return "".concat(value, "px"); // Presumes implicit 'px' suffix for unitless numbers
850
+ if (typeof value === 'number' && value !== 0 && !(name in unitlessKeys) && !name.startsWith('--')) {
851
+ return "".concat(value, "px"); // Presumes implicit 'px' suffix for unitless numbers except for CSS variables
826
852
  }
827
853
  return String(value).trim();
828
854
  }
@@ -834,14 +860,7 @@
834
860
  'Component');
835
861
  }
836
862
 
837
- /**
838
- * inlined version of
839
- * https://github.com/facebook/fbjs/blob/master/packages/fbjs/src/core/hyphenateStyleName.js
840
- */
841
- var uppercaseCheck = /[A-Z]/;
842
- var uppercasePattern = /[A-Z]/g;
843
- var msPattern = /^ms-/;
844
- var prefixAndLowerCase = function (char) { return "-".concat(char.toLowerCase()); };
863
+ var isUpper = function (c) { return c >= 'A' && c <= 'Z'; };
845
864
  /**
846
865
  * Hyphenates a camelcased CSS property name, for example:
847
866
  *
@@ -856,9 +875,21 @@
856
875
  * is converted to `-ms-`.
857
876
  */
858
877
  function hyphenateStyleName(string) {
859
- return uppercaseCheck.test(string) && !string.startsWith('--')
860
- ? string.replace(uppercasePattern, prefixAndLowerCase).replace(msPattern, '-ms-')
861
- : string;
878
+ var output = '';
879
+ for (var i = 0; i < string.length; i++) {
880
+ var c = string[i];
881
+ // Check for CSS variable prefix
882
+ if (i === 1 && c === '-' && string[0] === '-') {
883
+ return string;
884
+ }
885
+ if (isUpper(c)) {
886
+ output += '-' + c.toLowerCase();
887
+ }
888
+ else {
889
+ output += c;
890
+ }
891
+ }
892
+ return output.startsWith('ms-') ? '-' + output : output;
862
893
  }
863
894
 
864
895
  function isFunction(test) {
@@ -868,16 +899,13 @@
868
899
  function isPlainObject(x) {
869
900
  return (x !== null &&
870
901
  typeof x === 'object' &&
871
- /* a check for empty prototype would be more typical, but that
872
- doesn't play well with objects created in different vm contexts */
873
- (!x.constructor || x.constructor.name === 'Object') &&
874
- (x.toString ? x.toString() : Object.prototype.toString.call(x)) === '[object Object]' &&
902
+ x.constructor.name === Object.name &&
875
903
  /* check for reasonable markers that the object isn't an element for react & preact/compat */
876
- !('props' in x && (x.$$typeof || x.constructor === undefined)));
904
+ !('props' in x && x.$$typeof));
877
905
  }
878
906
 
879
907
  function isStatelessFunction(test) {
880
- return typeof test === 'function' && !(test.prototype && test.prototype.isReactComponent);
908
+ return isFunction(test) && !(test.prototype && test.prototype.isReactComponent);
881
909
  }
882
910
 
883
911
  function isStyledComponent(target) {
@@ -890,34 +918,26 @@
890
918
  var isFalsish = function (chunk) {
891
919
  return chunk === undefined || chunk === null || chunk === false || chunk === '';
892
920
  };
893
- var objToCssArray = function (obj, prevKey) {
921
+ var objToCssArray = function (obj) {
894
922
  var rules = [];
895
923
  for (var key in obj) {
896
- if (!obj.hasOwnProperty(key) || isFalsish(obj[key]))
924
+ var val = obj[key];
925
+ if (!obj.hasOwnProperty(key) || isFalsish(val))
897
926
  continue;
898
- if ((Array.isArray(obj[key]) && obj[key].isCss) || isFunction(obj[key])) {
899
- rules.push("".concat(hyphenateStyleName(key), ":"), obj[key], ';');
927
+ // @ts-expect-error Property 'isCss' does not exist on type 'any[]'
928
+ if ((Array.isArray(val) && val.isCss) || isFunction(val)) {
929
+ rules.push("".concat(hyphenateStyleName(key), ":"), val, ';');
900
930
  }
901
- else if (isPlainObject(obj[key])) {
902
- rules.push.apply(rules, objToCssArray(obj[key], key));
931
+ else if (isPlainObject(val)) {
932
+ rules.push.apply(rules, __spreadArray(__spreadArray(["".concat(key, " {")], objToCssArray(val), false), ['}'], false));
903
933
  }
904
934
  else {
905
- rules.push("".concat(hyphenateStyleName(key), ": ").concat(addUnitIfNeeded(key, obj[key]), ";"));
935
+ rules.push("".concat(hyphenateStyleName(key), ": ").concat(addUnitIfNeeded(key, val), ";"));
906
936
  }
907
937
  }
908
- return prevKey ? __spreadArray(__spreadArray(["".concat(prevKey, " {")], rules, true), ['}'], false) : rules;
938
+ return rules;
909
939
  };
910
940
  function flatten(chunk, executionContext, styleSheet, stylisInstance) {
911
- if (Array.isArray(chunk)) {
912
- var ruleSet = [];
913
- for (var i = 0, len = chunk.length, result = void 0; i < len; i += 1) {
914
- result = flatten(chunk[i], executionContext, styleSheet, stylisInstance);
915
- if (result.length === 0)
916
- continue;
917
- ruleSet.push.apply(ruleSet, result);
918
- }
919
- return ruleSet;
920
- }
921
941
  if (isFalsish(chunk)) {
922
942
  return [];
923
943
  }
@@ -928,14 +948,13 @@
928
948
  /* Either execute or defer the function */
929
949
  if (isFunction(chunk)) {
930
950
  if (isStatelessFunction(chunk) && executionContext) {
931
- var chunkFn = chunk;
932
- var result = chunkFn(executionContext);
951
+ var result = chunk(executionContext);
933
952
  if (typeof result === 'object' &&
934
953
  !Array.isArray(result) &&
935
954
  !(result instanceof Keyframes) &&
936
- !isPlainObject(result)) {
937
- // eslint-disable-next-line no-console
938
- console.error("".concat(getComponentName(chunkFn), " is not a styled component and cannot be referred to via component selector. See https://www.styled-components.com/docs/advanced#referring-to-other-components for more details."));
955
+ !isPlainObject(result) &&
956
+ result !== null) {
957
+ console.error("".concat(getComponentName(chunk), " is not a styled component and cannot be referred to via component selector. See https://www.styled-components.com/docs/advanced#referring-to-other-components for more details."));
939
958
  }
940
959
  return flatten(result, executionContext, styleSheet, stylisInstance);
941
960
  }
@@ -953,7 +972,16 @@
953
972
  }
954
973
  }
955
974
  /* Handle objects */
956
- return isPlainObject(chunk) ? objToCssArray(chunk) : [chunk.toString()];
975
+ if (isPlainObject(chunk)) {
976
+ return objToCssArray(chunk);
977
+ }
978
+ if (!Array.isArray(chunk)) {
979
+ return [chunk.toString()];
980
+ }
981
+ /* Handle objects */
982
+ return chunk.flatMap(function (chunklet) {
983
+ return flatten(chunklet, executionContext, styleSheet, stylisInstance);
984
+ });
957
985
  }
958
986
 
959
987
  function isStaticRules(rules) {
@@ -968,6 +996,23 @@
968
996
  return true;
969
997
  }
970
998
 
999
+ /**
1000
+ * Convenience function for joining strings to form className chains
1001
+ */
1002
+ function joinStrings(a, b) {
1003
+ return a && b ? "".concat(a, " ").concat(b) : a || b || '';
1004
+ }
1005
+ function joinStringArray(arr, sep) {
1006
+ if (arr.length === 0) {
1007
+ return '';
1008
+ }
1009
+ var result = arr[0];
1010
+ for (var i = 1; i < arr.length; i++) {
1011
+ result += sep ? sep + arr[i] : arr[i];
1012
+ }
1013
+ return result;
1014
+ }
1015
+
971
1016
  var GlobalStyle = /** @class */ (function () {
972
1017
  function GlobalStyle(rules, componentId) {
973
1018
  this.rules = rules;
@@ -978,8 +1023,8 @@
978
1023
  StyleSheet.registerId(this.componentId + 1);
979
1024
  }
980
1025
  GlobalStyle.prototype.createStyles = function (instance, executionContext, styleSheet, stylis) {
981
- var flatCSS = flatten(this.rules, executionContext, styleSheet, stylis);
982
- var css = stylis(flatCSS.join(''), '');
1026
+ var flatCSS = joinStringArray(flatten(this.rules, executionContext, styleSheet, stylis));
1027
+ var css = stylis(flatCSS, '');
983
1028
  var id = this.componentId + instance;
984
1029
  // NOTE: We use the id as a name as well, since these rules never change
985
1030
  styleSheet.insertRules(id, id, css);
@@ -997,7 +1042,7 @@
997
1042
  return GlobalStyle;
998
1043
  }());
999
1044
 
1000
- var ThemeContext = React__default["default"].createContext(undefined);
1045
+ var ThemeContext = React.createContext(undefined);
1001
1046
  var ThemeConsumer = ThemeContext.Consumer;
1002
1047
  function mergeTheme(theme, outerTheme) {
1003
1048
  if (!theme) {
@@ -1016,16 +1061,19 @@
1016
1061
  }
1017
1062
  return outerTheme ? __assign(__assign({}, outerTheme), theme) : theme;
1018
1063
  }
1064
+ function useTheme() {
1065
+ return React.useContext(ThemeContext);
1066
+ }
1019
1067
  /**
1020
1068
  * Provide a theme to an entire react component tree via context
1021
1069
  */
1022
1070
  function ThemeProvider(props) {
1023
- var outerTheme = React.useContext(ThemeContext);
1071
+ var outerTheme = useTheme();
1024
1072
  var themeContext = React.useMemo(function () { return mergeTheme(props.theme, outerTheme); }, [props.theme, outerTheme]);
1025
1073
  if (!props.children) {
1026
1074
  return null;
1027
1075
  }
1028
- return React__default["default"].createElement(ThemeContext.Provider, { value: themeContext }, props.children);
1076
+ return React.createElement(ThemeContext.Provider, { value: themeContext }, props.children);
1029
1077
  }
1030
1078
 
1031
1079
  var invalidHookCallRe = /invalid hook call/i;
@@ -1060,10 +1108,8 @@
1060
1108
  };
1061
1109
  // We purposefully call `useRef` outside of a component and expect it to throw
1062
1110
  // If it doesn't, then we're inside another component.
1063
- // eslint-disable-next-line react-hooks/rules-of-hooks
1064
1111
  React.useRef();
1065
1112
  if (didNotCallInvalidHook_1 && !seen.has(message_1)) {
1066
- // eslint-disable-next-line no-console
1067
1113
  console.warn(message_1);
1068
1114
  seen.add(message_1);
1069
1115
  }
@@ -1155,31 +1201,27 @@
1155
1201
  checkDynamicCreation(styledComponentId);
1156
1202
  }
1157
1203
  var GlobalStyleComponent = function (props) {
1158
- var styleSheet = useStyleSheet();
1159
- var stylis = useStylis();
1160
- var theme = React__default["default"].useContext(ThemeContext);
1161
- var instanceRef = React__default["default"].useRef(styleSheet.allocateGSInstance(styledComponentId));
1204
+ var ssc = useStyleSheetContext();
1205
+ var theme = useTheme();
1206
+ var instanceRef = React.useRef(ssc.styleSheet.allocateGSInstance(styledComponentId));
1162
1207
  var instance = instanceRef.current;
1163
- if (React__default["default"].Children.count(props.children)) {
1164
- // eslint-disable-next-line no-console
1208
+ if (React.Children.count(props.children)) {
1165
1209
  console.warn("The global style component ".concat(styledComponentId, " was given child JSX. createGlobalStyle does not render children."));
1166
1210
  }
1167
1211
  if (rules.some(function (rule) { return typeof rule === 'string' && rule.indexOf('@import') !== -1; })) {
1168
- // eslint-disable-next-line no-console
1169
1212
  console.warn("Please do not use @import CSS syntax in createGlobalStyle at this time, as the CSSOM APIs we use in production do not handle it well. Instead, we recommend using a library such as react-helmet to inject a typical <link> meta tag to the stylesheet, or simply embedding it manually in your index.html <head> section for a simpler app.");
1170
1213
  }
1171
- if (styleSheet.server) {
1172
- renderStyles(instance, props, styleSheet, theme, stylis);
1214
+ if (ssc.styleSheet.server) {
1215
+ renderStyles(instance, props, ssc.styleSheet, theme, ssc.stylis);
1173
1216
  }
1174
1217
  {
1175
- // eslint-disable-next-line react-hooks/rules-of-hooks
1176
1218
  // @ts-expect-error still using React 17 types for the time being
1177
- (React__default["default"].useInsertionEffect || React__default["default"].useLayoutEffect)(function () {
1178
- if (!styleSheet.server) {
1179
- renderStyles(instance, props, styleSheet, theme, stylis);
1180
- return function () { return globalStyle.removeStyles(instance, styleSheet); };
1219
+ (React.useInsertionEffect || React.useLayoutEffect)(function () {
1220
+ if (!ssc.styleSheet.server) {
1221
+ renderStyles(instance, props, ssc.styleSheet, theme, ssc.stylis);
1222
+ return function () { return globalStyle.removeStyles(instance, ssc.styleSheet); };
1181
1223
  }
1182
- }, [instance, props, styleSheet, theme, stylis]);
1224
+ }, [instance, props, ssc.styleSheet, theme, ssc.stylis]);
1183
1225
  }
1184
1226
  return null;
1185
1227
  };
@@ -1192,7 +1234,7 @@
1192
1234
  globalStyle.renderStyles(instance, context, styleSheet, stylis);
1193
1235
  }
1194
1236
  }
1195
- return React__default["default"].memo(GlobalStyleComponent);
1237
+ return React.memo(GlobalStyleComponent);
1196
1238
  }
1197
1239
 
1198
1240
  function keyframes(strings) {
@@ -1203,10 +1245,9 @@
1203
1245
  /* Warning if you've used keyframes on React Native */
1204
1246
  if (typeof navigator !== 'undefined' &&
1205
1247
  navigator.product === 'ReactNative') {
1206
- // eslint-disable-next-line no-console
1207
1248
  console.warn('`keyframes` cannot be used on ReactNative, only on the web. To do animation in ReactNative please use Animated.');
1208
1249
  }
1209
- var rules = css.apply(void 0, __spreadArray([strings], interpolations, false)).join('');
1250
+ var rules = joinStringArray(css.apply(void 0, __spreadArray([strings], interpolations, false)));
1210
1251
  var name = generateComponentId(rules);
1211
1252
  return new Keyframes(name, rules);
1212
1253
  }
@@ -1317,21 +1358,18 @@
1317
1358
  }
1318
1359
 
1319
1360
  function withTheme(Component) {
1320
- var WithTheme = React__default["default"].forwardRef(function (props, ref) {
1321
- var theme = React__default["default"].useContext(ThemeContext);
1361
+ var WithTheme = React.forwardRef(function (props, ref) {
1362
+ var theme = useTheme();
1322
1363
  var themeProp = determineTheme(props, theme, Component.defaultProps);
1323
1364
  if (themeProp === undefined) {
1324
- // eslint-disable-next-line no-console
1325
1365
  console.warn("[withTheme] You are not using a ThemeProvider nor passing a theme prop or a theme in defaultProps in component class \"".concat(getComponentName(Component), "\""));
1326
1366
  }
1327
- return React__default["default"].createElement(Component, __assign({}, props, { theme: themeProp, ref: ref }));
1367
+ return React.createElement(Component, __assign({}, props, { theme: themeProp, ref: ref }));
1328
1368
  });
1329
1369
  WithTheme.displayName = "WithTheme(".concat(getComponentName(Component), ")");
1330
1370
  return hoistNonReactStatics(WithTheme, Component);
1331
1371
  }
1332
1372
 
1333
- var useTheme = function () { return React.useContext(ThemeContext); };
1334
-
1335
1373
  var ServerStyleSheet = /** @class */ (function () {
1336
1374
  function ServerStyleSheet() {
1337
1375
  var _this = this;
@@ -1343,7 +1381,7 @@
1343
1381
  "".concat(SC_ATTR, "=\"true\""),
1344
1382
  "".concat(SC_ATTR_VERSION, "=\"").concat(SC_VERSION, "\""),
1345
1383
  ];
1346
- var htmlAttr = attrs.filter(Boolean).join(' ');
1384
+ var htmlAttr = joinStringArray(attrs.filter(Boolean), ' ');
1347
1385
  return "<style ".concat(htmlAttr, ">").concat(css, "</style>");
1348
1386
  };
1349
1387
  this.getStyleTags = function () {
@@ -1369,7 +1407,7 @@
1369
1407
  props.nonce = nonce;
1370
1408
  }
1371
1409
  // v4 returned an array for this fn, so we'll do the same for v5 for backward compat
1372
- return [React__default["default"].createElement("style", __assign({}, props, { key: "sc-0-0" }))];
1410
+ return [React.createElement("style", __assign({}, props, { key: "sc-0-0" }))];
1373
1411
  };
1374
1412
  this.seal = function () {
1375
1413
  _this.sealed = true;
@@ -1381,9 +1419,8 @@
1381
1419
  if (this.sealed) {
1382
1420
  throw throwStyledComponentsError(2);
1383
1421
  }
1384
- return React__default["default"].createElement(StyleSheetManager, { sheet: this.instance }, children);
1422
+ return React.createElement(StyleSheetManager, { sheet: this.instance }, children);
1385
1423
  };
1386
- // eslint-disable-next-line consistent-return
1387
1424
  // @ts-expect-error alternate return types are not possible due to code transformation
1388
1425
  ServerStyleSheet.prototype.interleaveWithNodeStream = function (input) {
1389
1426
  {
@@ -1393,7 +1430,6 @@
1393
1430
  return ServerStyleSheet;
1394
1431
  }());
1395
1432
 
1396
- /* eslint-disable */
1397
1433
  var __PRIVATE__ = {
1398
1434
  StyleSheet: StyleSheet,
1399
1435
  mainSheet: mainSheet,
@@ -1403,30 +1439,23 @@
1403
1439
  /* Warning if you've imported this file on React Native */
1404
1440
  if (typeof navigator !== 'undefined' &&
1405
1441
  navigator.product === 'ReactNative') {
1406
- // eslint-disable-next-line no-console
1407
- console.warn("It looks like you've imported 'styled-components' on React Native.\n" +
1408
- "Perhaps you're looking to import 'styled-components/native'?\n" +
1409
- 'Read more about this at https://www.styled-components.com/docs/basics#react-native');
1442
+ console.warn("It looks like you've imported 'styled-components' on React Native.\nPerhaps you're looking to import 'styled-components/native'?\nRead more about this at https://www.styled-components.com/docs/basics#react-native");
1410
1443
  }
1444
+ var windowGlobalKey = "__sc-".concat(SC_ATTR, "__");
1411
1445
  /* Warning if there are several instances of styled-components */
1412
1446
  if (typeof window !== 'undefined') {
1413
- window['__styled-components-init__'] || (window['__styled-components-init__'] = 0);
1414
- if (window['__styled-components-init__'] === 1) {
1415
- // eslint-disable-next-line no-console
1416
- console.warn("It looks like there are several instances of 'styled-components' initialized in this application. " +
1417
- 'This may cause dynamic styles to not render properly, errors during the rehydration process, ' +
1418
- 'a missing theme prop, and makes your application bigger without good reason.\n\n' +
1419
- 'See https://s-c.sh/2BAXzed for more info.');
1420
- }
1421
- window['__styled-components-init__'] += 1;
1447
+ // @ts-expect-error dynamic key not in window object
1448
+ window[windowGlobalKey] || (window[windowGlobalKey] = 0);
1449
+ // @ts-expect-error dynamic key not in window object
1450
+ if (window[windowGlobalKey] === 1) {
1451
+ console.warn("It looks like there are several instances of 'styled-components' initialized in this application. This may cause dynamic styles to not render properly, errors during the rehydration process, a missing theme prop, and makes your application bigger without good reason.\n\nSee https://s-c.sh/2BAXzed for more info.");
1452
+ }
1453
+ // @ts-expect-error dynamic key not in window object
1454
+ window[windowGlobalKey] += 1;
1422
1455
  }
1423
1456
 
1424
1457
  var secondary = /*#__PURE__*/Object.freeze({
1425
1458
  __proto__: null,
1426
- createGlobalStyle: createGlobalStyle,
1427
- css: css,
1428
- isStyledComponent: isStyledComponent,
1429
- keyframes: keyframes,
1430
1459
  ServerStyleSheet: ServerStyleSheet,
1431
1460
  StyleSheetConsumer: StyleSheetConsumer,
1432
1461
  StyleSheetContext: StyleSheetContext,
@@ -1434,10 +1463,14 @@
1434
1463
  ThemeConsumer: ThemeConsumer,
1435
1464
  ThemeContext: ThemeContext,
1436
1465
  ThemeProvider: ThemeProvider,
1466
+ __PRIVATE__: __PRIVATE__,
1467
+ createGlobalStyle: createGlobalStyle,
1468
+ css: css,
1469
+ isStyledComponent: isStyledComponent,
1470
+ keyframes: keyframes,
1437
1471
  useTheme: useTheme,
1438
1472
  version: SC_VERSION,
1439
- withTheme: withTheme,
1440
- __PRIVATE__: __PRIVATE__
1473
+ withTheme: withTheme
1441
1474
  });
1442
1475
 
1443
1476
  var LIMIT = 200;
@@ -1449,7 +1482,6 @@
1449
1482
  generatedClasses[className] = true;
1450
1483
  if (Object.keys(generatedClasses).length >= LIMIT) {
1451
1484
  // Unable to find latestRule in test environment.
1452
- /* eslint-disable no-console, prefer-template */
1453
1485
  var parsedIdString = componentId ? " with the id of \"".concat(componentId, "\"") : '';
1454
1486
  console.warn("Over ".concat(LIMIT, " classes were generated for component ").concat(displayName).concat(parsedIdString, ".\n") +
1455
1487
  'Consider using the attrs method, together with a style object for frequently changed styles.\n' +
@@ -1468,7 +1500,7 @@
1468
1500
  });
1469
1501
 
1470
1502
  // Thanks to ReactDOMFactories for this handy list!
1471
- var domElements = [
1503
+ var domElements = new Set([
1472
1504
  'a',
1473
1505
  'abbr',
1474
1506
  'address',
@@ -1579,6 +1611,7 @@
1579
1611
  'track',
1580
1612
  'u',
1581
1613
  'ul',
1614
+ 'use',
1582
1615
  'var',
1583
1616
  'video',
1584
1617
  'wbr',
@@ -1603,7 +1636,7 @@
1603
1636
  'svg',
1604
1637
  'text',
1605
1638
  'tspan',
1606
- ];
1639
+ ]);
1607
1640
 
1608
1641
  // Source: https://www.w3.org/TR/cssom-1/#serialize-an-identifier
1609
1642
  // Control characters and non-letter first symbols are not supported
@@ -1629,17 +1662,6 @@
1629
1662
  return isTag(target) ? "styled.".concat(target) : "Styled(".concat(getComponentName(target), ")");
1630
1663
  }
1631
1664
 
1632
- /**
1633
- * Convenience function for joining strings to form className chains
1634
- */
1635
- function joinStrings() {
1636
- var args = [];
1637
- for (var _i = 0; _i < arguments.length; _i++) {
1638
- args[_i] = arguments[_i];
1639
- }
1640
- return args.filter(Boolean).join(' ');
1641
- }
1642
-
1643
1665
  function mixinRecursively(target, source, forceMerge) {
1644
1666
  if (forceMerge === void 0) { forceMerge = false; }
1645
1667
  /* only merge into POJOs, Arrays, but for top level objects only
@@ -1682,74 +1704,61 @@
1682
1704
  */
1683
1705
  var ComponentStyle = /** @class */ (function () {
1684
1706
  function ComponentStyle(rules, componentId, baseStyle) {
1685
- this.names = [];
1686
1707
  this.rules = rules;
1687
1708
  this.staticRulesId = '';
1688
1709
  this.isStatic =
1689
1710
  "development" === 'production' ;
1690
1711
  this.componentId = componentId;
1691
- // SC_VERSION gives us isolation between multiple runtimes on the page at once
1692
- // this is improved further with use of the babel plugin "namespace" feature
1693
1712
  this.baseHash = phash(SEED, componentId);
1694
1713
  this.baseStyle = baseStyle;
1695
1714
  // NOTE: This registers the componentId, which ensures a consistent order
1696
1715
  // for this component's styles compared to others
1697
1716
  StyleSheet.registerId(componentId);
1698
1717
  }
1699
- /*
1700
- * Flattens a rule set into valid CSS
1701
- * Hashes it, wraps the whole chunk in a .hash1234 {}
1702
- * Returns the hash to be injected on render()
1703
- * */
1704
1718
  ComponentStyle.prototype.generateAndInjectStyles = function (executionContext, styleSheet, stylis) {
1705
- var componentId = this.componentId;
1706
- this.names.length = 0;
1707
- if (this.baseStyle) {
1708
- this.names.push(this.baseStyle.generateAndInjectStyles(executionContext, styleSheet, stylis));
1709
- }
1719
+ var names = this.baseStyle
1720
+ ? this.baseStyle.generateAndInjectStyles(executionContext, styleSheet, stylis)
1721
+ : '';
1710
1722
  // force dynamic classnames if user-supplied stylis plugins are in use
1711
1723
  if (this.isStatic && !stylis.hash) {
1712
- if (this.staticRulesId && styleSheet.hasNameForId(componentId, this.staticRulesId)) {
1713
- this.names.push(this.staticRulesId);
1724
+ if (this.staticRulesId && styleSheet.hasNameForId(this.componentId, this.staticRulesId)) {
1725
+ names = joinStrings(names, this.staticRulesId);
1714
1726
  }
1715
1727
  else {
1716
- var cssStatic = flatten(this.rules, executionContext, styleSheet, stylis).join('');
1728
+ var cssStatic = joinStringArray(flatten(this.rules, executionContext, styleSheet, stylis));
1717
1729
  var name_1 = generateAlphabeticName(phash(this.baseHash, cssStatic) >>> 0);
1718
- if (!styleSheet.hasNameForId(componentId, name_1)) {
1719
- var cssStaticFormatted = stylis(cssStatic, ".".concat(name_1), undefined, componentId);
1720
- styleSheet.insertRules(componentId, name_1, cssStaticFormatted);
1730
+ if (!styleSheet.hasNameForId(this.componentId, name_1)) {
1731
+ var cssStaticFormatted = stylis(cssStatic, ".".concat(name_1), undefined, this.componentId);
1732
+ styleSheet.insertRules(this.componentId, name_1, cssStaticFormatted);
1721
1733
  }
1722
- this.names.push(name_1);
1734
+ names = joinStrings(names, name_1);
1723
1735
  this.staticRulesId = name_1;
1724
1736
  }
1725
1737
  }
1726
1738
  else {
1727
- var length_1 = this.rules.length;
1728
1739
  var dynamicHash = phash(this.baseHash, stylis.hash);
1729
1740
  var css = '';
1730
- for (var i = 0; i < length_1; i++) {
1741
+ for (var i = 0; i < this.rules.length; i++) {
1731
1742
  var partRule = this.rules[i];
1732
1743
  if (typeof partRule === 'string') {
1733
1744
  css += partRule;
1734
1745
  dynamicHash = phash(dynamicHash, partRule);
1735
1746
  }
1736
1747
  else if (partRule) {
1737
- var partChunk = flatten(partRule, executionContext, styleSheet, stylis);
1738
- var partString = Array.isArray(partChunk) ? partChunk.join('') : partChunk;
1748
+ var partString = joinStringArray(flatten(partRule, executionContext, styleSheet, stylis));
1739
1749
  dynamicHash = phash(dynamicHash, partString);
1740
1750
  css += partString;
1741
1751
  }
1742
1752
  }
1743
1753
  if (css) {
1744
1754
  var name_2 = generateAlphabeticName(dynamicHash >>> 0);
1745
- if (!styleSheet.hasNameForId(componentId, name_2)) {
1746
- var cssFormatted = stylis(css, ".".concat(name_2), undefined, componentId);
1747
- styleSheet.insertRules(componentId, name_2, cssFormatted);
1755
+ if (!styleSheet.hasNameForId(this.componentId, name_2)) {
1756
+ styleSheet.insertRules(this.componentId, name_2, stylis(css, ".".concat(name_2), undefined, this.componentId));
1748
1757
  }
1749
- this.names.push(name_2);
1758
+ names = joinStrings(names, name_2);
1750
1759
  }
1751
1760
  }
1752
- return this.names.join(' ');
1761
+ return names;
1753
1762
  };
1754
1763
  return ComponentStyle;
1755
1764
  }());
@@ -1766,67 +1775,75 @@
1766
1775
  SC_VERSION + name + identifiers[name]));
1767
1776
  return parentComponentId ? "".concat(parentComponentId, "-").concat(componentId) : componentId;
1768
1777
  }
1769
- function useInjectedStyle(componentStyle, isStatic, resolvedAttrs, warnTooManyClasses) {
1770
- var styleSheet = useStyleSheet();
1771
- var stylis = useStylis();
1772
- var className = componentStyle.generateAndInjectStyles(isStatic ? EMPTY_OBJECT : resolvedAttrs, styleSheet, stylis);
1773
- // eslint-disable-next-line react-hooks/rules-of-hooks
1778
+ function useInjectedStyle(componentStyle, isStatic, resolvedAttrs) {
1779
+ var ssc = useStyleSheetContext();
1780
+ var className = componentStyle.generateAndInjectStyles(isStatic ? EMPTY_OBJECT : resolvedAttrs, ssc.styleSheet, ssc.stylis);
1774
1781
  React.useDebugValue(className);
1775
- if (!isStatic && warnTooManyClasses) {
1776
- warnTooManyClasses(className);
1777
- }
1778
1782
  return className;
1779
1783
  }
1780
- function useStyledComponentImpl(forwardedComponent, props, forwardedRef, isStatic) {
1781
- var componentAttrs = forwardedComponent.attrs, componentStyle = forwardedComponent.componentStyle, defaultProps = forwardedComponent.defaultProps, foldedComponentIds = forwardedComponent.foldedComponentIds, shouldForwardProp = forwardedComponent.shouldForwardProp, styledComponentId = forwardedComponent.styledComponentId, target = forwardedComponent.target;
1782
- // eslint-disable-next-line react-hooks/rules-of-hooks
1783
- React.useDebugValue(styledComponentId);
1784
- // NOTE: the non-hooks version only subscribes to this when !componentStyle.isStatic,
1785
- // but that'd be against the rules-of-hooks. We could be naughty and do it anyway as it
1786
- // should be an immutable value, but behave for now.
1787
- var theme = determineTheme(props, React.useContext(ThemeContext), defaultProps) || EMPTY_OBJECT;
1788
- var context = componentAttrs.reduce(function (p, attrDef) {
1789
- var resolvedAttrDef = typeof attrDef === 'function' ? attrDef(p) : attrDef;
1790
- /* eslint-disable guard-for-in */
1784
+ function resolveContext(attrs, props, theme) {
1785
+ var context = __assign(__assign({}, props), {
1786
+ // unset, add `props.className` back at the end so props always "wins"
1787
+ className: undefined, theme: theme });
1788
+ var attrDef;
1789
+ for (var i = 0; i < attrs.length; i += 1) {
1790
+ attrDef = attrs[i];
1791
+ var resolvedAttrDef = isFunction(attrDef) ? attrDef(context) : attrDef;
1791
1792
  for (var key in resolvedAttrDef) {
1792
1793
  // @ts-expect-error bad types
1793
- p[key] =
1794
+ context[key] =
1794
1795
  key === 'className'
1795
- ? joinStrings(p[key], resolvedAttrDef[key])
1796
+ ? joinStrings(context[key], resolvedAttrDef[key])
1796
1797
  : key === 'style'
1797
- ? __assign(__assign({}, p[key]), resolvedAttrDef[key]) : resolvedAttrDef[key];
1798
+ ? __assign(__assign({}, context[key]), resolvedAttrDef[key]) : resolvedAttrDef[key];
1798
1799
  }
1799
- /* eslint-enable guard-for-in */
1800
- return p;
1801
- }, __assign(__assign({}, props), { theme: theme }));
1802
- var generatedClassName = useInjectedStyle(componentStyle, isStatic, context, forwardedComponent.warnTooManyClasses );
1803
- var refToForward = forwardedRef;
1800
+ }
1801
+ if (props.className) {
1802
+ context.className = joinStrings(context.className, props.className);
1803
+ }
1804
+ return context;
1805
+ }
1806
+ function useStyledComponentImpl(forwardedComponent, props, forwardedRef, isStatic) {
1807
+ var componentAttrs = forwardedComponent.attrs, componentStyle = forwardedComponent.componentStyle, defaultProps = forwardedComponent.defaultProps, foldedComponentIds = forwardedComponent.foldedComponentIds, styledComponentId = forwardedComponent.styledComponentId, target = forwardedComponent.target;
1808
+ var contextTheme = useTheme();
1809
+ var ssc = useStyleSheetContext();
1810
+ var shouldForwardProp = forwardedComponent.shouldForwardProp || ssc.shouldForwardProp;
1811
+ React.useDebugValue(styledComponentId);
1812
+ // NOTE: the non-hooks version only subscribes to this when !componentStyle.isStatic,
1813
+ // but that'd be against the rules-of-hooks. We could be naughty and do it anyway as it
1814
+ // should be an immutable value, but behave for now.
1815
+ var theme = determineTheme(props, contextTheme, defaultProps) || EMPTY_OBJECT;
1816
+ var context = resolveContext(componentAttrs, props, theme);
1804
1817
  var elementToBeCreated = context.as || target;
1805
- var isTargetTag = isTag(elementToBeCreated);
1806
1818
  var propsForElement = {};
1807
- // eslint-disable-next-line guard-for-in
1808
1819
  for (var key in context) {
1809
- // @ts-expect-error for..in iterates strings instead of keyof
1810
1820
  if (context[key] === undefined) ;
1811
1821
  else if (key[0] === '$' || key === 'as' || key === 'theme') ;
1812
1822
  else if (key === 'forwardedAs') {
1813
1823
  propsForElement.as = context.forwardedAs;
1814
1824
  }
1815
1825
  else if (!shouldForwardProp || shouldForwardProp(key, elementToBeCreated)) {
1816
- // @ts-expect-error for..in iterates strings instead of keyof
1817
1826
  propsForElement[key] = context[key];
1818
1827
  }
1819
1828
  }
1829
+ var generatedClassName = useInjectedStyle(componentStyle, isStatic, context);
1830
+ if (!isStatic && forwardedComponent.warnTooManyClasses) {
1831
+ forwardedComponent.warnTooManyClasses(generatedClassName);
1832
+ }
1833
+ var classString = joinStrings(foldedComponentIds, styledComponentId);
1834
+ if (generatedClassName) {
1835
+ classString += ' ' + generatedClassName;
1836
+ }
1837
+ if (context.className) {
1838
+ classString += ' ' + context.className;
1839
+ }
1820
1840
  propsForElement[
1821
1841
  // handle custom elements which React doesn't properly alias
1822
- isTargetTag &&
1823
- domElements.indexOf(elementToBeCreated) === -1
1842
+ isTag(elementToBeCreated) &&
1843
+ !domElements.has(elementToBeCreated)
1824
1844
  ? 'class'
1825
- : 'className'] = foldedComponentIds
1826
- .concat(styledComponentId, generatedClassName !== styledComponentId ? generatedClassName : '', context.className || '')
1827
- .filter(Boolean)
1828
- .join(' ');
1829
- propsForElement.ref = refToForward;
1845
+ : 'className'] = classString;
1846
+ propsForElement.ref = forwardedRef;
1830
1847
  return React.createElement(elementToBeCreated, propsForElement);
1831
1848
  }
1832
1849
  function createStyledComponent(target, options, rules) {
@@ -1839,9 +1856,7 @@
1839
1856
  : options.componentId || componentId;
1840
1857
  // fold the underlying StyledComponent attrs up (implicit extend)
1841
1858
  var finalAttrs = isTargetStyledComp && styledComponentTarget.attrs
1842
- ? styledComponentTarget.attrs
1843
- .concat(attrs)
1844
- .filter(Boolean)
1859
+ ? styledComponentTarget.attrs.concat(attrs).filter(Boolean)
1845
1860
  : attrs;
1846
1861
  var shouldForwardProp = options.shouldForwardProp;
1847
1862
  if (isTargetStyledComp && styledComponentTarget.shouldForwardProp) {
@@ -1863,7 +1878,6 @@
1863
1878
  // and shouldn't be increasing the number of class names
1864
1879
  var isStatic = componentStyle.isStatic && attrs.length === 0;
1865
1880
  function forwardRef(props, ref) {
1866
- // eslint-disable-next-line
1867
1881
  return useStyledComponentImpl(WrappedStyledComponent, props, ref, isStatic);
1868
1882
  }
1869
1883
  forwardRef.displayName = displayName;
@@ -1871,7 +1885,7 @@
1871
1885
  * forwardRef creates a new interim component, which we'll take advantage of
1872
1886
  * instead of extending ParentComponent to create _another_ interim class
1873
1887
  */
1874
- var WrappedStyledComponent = React__default["default"].forwardRef(forwardRef);
1888
+ var WrappedStyledComponent = React.forwardRef(forwardRef);
1875
1889
  WrappedStyledComponent.attrs = finalAttrs;
1876
1890
  WrappedStyledComponent.componentStyle = componentStyle;
1877
1891
  WrappedStyledComponent.displayName = displayName;
@@ -1879,8 +1893,8 @@
1879
1893
  // this static is used to preserve the cascade of static classes for component selector
1880
1894
  // purposes; this is especially important with usage of the css prop
1881
1895
  WrappedStyledComponent.foldedComponentIds = isTargetStyledComp
1882
- ? styledComponentTarget.foldedComponentIds.concat(styledComponentTarget.styledComponentId)
1883
- : EMPTY_ARRAY;
1896
+ ? joinStrings(styledComponentTarget.foldedComponentIds, styledComponentTarget.styledComponentId)
1897
+ : '';
1884
1898
  WrappedStyledComponent.styledComponentId = styledComponentId;
1885
1899
  // fold the underlying StyledComponent target up since we folded the styles
1886
1900
  WrappedStyledComponent.target = isTargetStyledComp ? styledComponentTarget.target : target;
@@ -1898,7 +1912,13 @@
1898
1912
  checkDynamicCreation(displayName, styledComponentId);
1899
1913
  WrappedStyledComponent.warnTooManyClasses = createWarnTooManyClasses(displayName, styledComponentId);
1900
1914
  }
1901
- WrappedStyledComponent.toString = function () { return ".".concat(WrappedStyledComponent.styledComponentId); };
1915
+ // If the Object prototype is frozen, the "toString" property is non-writable. This means that any objects which inherit this property
1916
+ // cannot have the property changed using an assignment. If using strict mode, attempting that will cause an error. If not using strict
1917
+ // mode, attempting that will be silently ignored.
1918
+ // However, we can still explicitly shadow the prototype's "toString" property by defining a new "toString" property on this object.
1919
+ Object.defineProperty(WrappedStyledComponent, 'toString', {
1920
+ value: function () { return ".".concat(WrappedStyledComponent.styledComponentId); },
1921
+ });
1902
1922
  if (isCompositeComponent) {
1903
1923
  var compositeComponentTarget = target;
1904
1924
  hoistNonReactStatics(WrappedStyledComponent, compositeComponentTarget, {