styled-components 6.0.0-beta.1 → 6.0.0-beta.2

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 (46) hide show
  1. package/dist/constructors/constructWithOptions.d.ts +16 -21
  2. package/dist/constructors/css.d.ts +2 -2
  3. package/dist/constructors/styled.d.ts +179 -179
  4. package/dist/models/StyledComponent.d.ts +1 -1
  5. package/dist/models/StyledNativeComponent.d.ts +2 -2
  6. package/dist/native/index.d.ts +29 -29
  7. package/dist/styled-components-macro.cjs.js +47 -1
  8. package/dist/styled-components-macro.cjs.js.map +1 -1
  9. package/dist/styled-components-macro.esm.js +38 -1
  10. package/dist/styled-components-macro.esm.js.map +1 -1
  11. package/dist/styled-components.browser.cjs.js +1854 -1
  12. package/dist/styled-components.browser.cjs.js.map +1 -1
  13. package/dist/styled-components.browser.esm.js +1829 -1
  14. package/dist/styled-components.browser.esm.js.map +1 -1
  15. package/dist/styled-components.cjs.js +1874 -1
  16. package/dist/styled-components.cjs.js.map +1 -1
  17. package/dist/styled-components.esm.js +1849 -1
  18. package/dist/styled-components.esm.js.map +1 -1
  19. package/dist/styled-components.js +2074 -1
  20. package/dist/styled-components.js.map +1 -1
  21. package/dist/styled-components.min.js +1 -1
  22. package/dist/styled-components.min.js.map +1 -1
  23. package/dist/test/utils.d.ts +178 -178
  24. package/dist/tsconfig.tsbuildinfo +1 -1
  25. package/dist/types.d.ts +32 -43
  26. package/dist/utils/generateDisplayName.d.ts +1 -1
  27. package/dist/utils/getComponentName.d.ts +1 -1
  28. package/dist/utils/isStyledComponent.d.ts +1 -1
  29. package/dist/utils/isTag.d.ts +1 -1
  30. package/native/dist/constructors/constructWithOptions.d.ts +16 -21
  31. package/native/dist/constructors/css.d.ts +2 -2
  32. package/native/dist/constructors/styled.d.ts +179 -179
  33. package/native/dist/models/StyledComponent.d.ts +1 -1
  34. package/native/dist/models/StyledNativeComponent.d.ts +2 -2
  35. package/native/dist/native/index.d.ts +29 -29
  36. package/native/dist/styled-components.native.cjs.js +6 -10
  37. package/native/dist/styled-components.native.cjs.js.map +1 -1
  38. package/native/dist/styled-components.native.esm.js +6 -10
  39. package/native/dist/styled-components.native.esm.js.map +1 -1
  40. package/native/dist/test/utils.d.ts +178 -178
  41. package/native/dist/types.d.ts +32 -43
  42. package/native/dist/utils/generateDisplayName.d.ts +1 -1
  43. package/native/dist/utils/getComponentName.d.ts +1 -1
  44. package/native/dist/utils/isStyledComponent.d.ts +1 -1
  45. package/native/dist/utils/isTag.d.ts +1 -1
  46. package/package.json +1 -2
@@ -1,2 +1,1855 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),t=require("@emotion/is-prop-valid"),n=require("react"),o=require("shallowequal"),r=require("stylis"),s=require("@emotion/unitless");function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=/*#__PURE__*/i(t),c=/*#__PURE__*/i(n),u=/*#__PURE__*/i(o),l=/*#__PURE__*/i(s),p="undefined"!=typeof process&&(process.env.REACT_APP_SC_ATTR||process.env.SC_ATTR)||"data-styled",d="6.0.0-beta.1",h="undefined"!=typeof window&&"HTMLElement"in window,f=Boolean("boolean"==typeof SC_DISABLE_SPEEDY?SC_DISABLE_SPEEDY:"undefined"!=typeof process&&void 0!==process.env.REACT_APP_SC_DISABLE_SPEEDY&&""!==process.env.REACT_APP_SC_DISABLE_SPEEDY?"false"!==process.env.REACT_APP_SC_DISABLE_SPEEDY&&process.env.REACT_APP_SC_DISABLE_SPEEDY:"undefined"!=typeof process&&void 0!==process.env.SC_DISABLE_SPEEDY&&""!==process.env.SC_DISABLE_SPEEDY?"false"!==process.env.SC_DISABLE_SPEEDY&&process.env.SC_DISABLE_SPEEDY:"production"!==process.env.NODE_ENV),y={},m=/invalid hook call/i,v=new Set,g=function(t,o){if("production"!==process.env.NODE_ENV){var r=o?' with the id of "'.concat(o,'"'):"",s="The component ".concat(t).concat(r," has been created dynamically.\n")+"You may see this warning because you've called styled inside another component.\nTo resolve this only create new StyledComponents outside of any render method and function component.",i=console.error;try{var a=!0;console.error=function(t){for(var n=[],o=1;o<arguments.length;o++)n[o-1]=arguments[o];m.test(t)?(a=!1,v.delete(s)):i.apply(void 0,e.__spreadArray([t],n,!1))},n.useRef(),a&&!v.has(s)&&(console.warn(s),v.add(s))}catch(e){m.test(e.message)&&v.delete(s)}finally{console.error=i}}},S=Object.freeze([]),_=Object.freeze({});function w(e,t,n){return void 0===n&&(n=_),e.theme!==n.theme&&e.theme||t||n.theme}var b=["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","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","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","marker","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"],E=/[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~-]+/g,N=/(^-|-$)/g;function C(e){return e.replace(E,"-").replace(N,"")}var A=/(a)(d)/gi,P=function(e){return String.fromCharCode(e+(e>25?39:97))};function I(e){var t,n="";for(t=Math.abs(e);t>52;t=t/52|0)n=P(t%52)+n;return(P(t%52)+n).replace(A,"$1-$2")}var x,O=function(e,t){for(var n=t.length;n;)e=33*e^t.charCodeAt(--n);return e},R=function(e){return O(5381,e)};function D(e){return I(R(e)>>>0)}function T(e){return"production"!==process.env.NODE_ENV&&"string"==typeof e&&e||e.displayName||e.name||"Component"}function j(e){return"string"==typeof e&&("production"===process.env.NODE_ENV||e.charAt(0)===e.charAt(0).toLowerCase())}var k="function"==typeof Symbol&&Symbol.for,V=k?Symbol.for("react.memo"):60115,M=k?Symbol.for("react.forward_ref"):60112,B={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},$={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},z={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},L=((x={})[M]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},x[V]=z,x);function G(e){return("type"in(t=e)&&t.type.$$typeof)===V?z:"$$typeof"in e?L[e.$$typeof]:B;var t}var F=Object.defineProperty,q=Object.getOwnPropertyNames,Y=Object.getOwnPropertySymbols,H=Object.getOwnPropertyDescriptor,W=Object.getPrototypeOf,U=Object.prototype;function J(e,t,n){if("string"!=typeof t){if(U){var o=W(t);o&&o!==U&&J(e,o,n)}var r=q(t);Y&&(r=r.concat(Y(t)));for(var s=G(e),i=G(t),a=0;a<r.length;++a){var c=r[a];if(!(c in $||n&&n[c]||i&&c in i||s&&c in s)){var u=H(t,c);try{F(e,c,u)}catch(e){}}}}return e}function X(e){return"object"==typeof e&&"styledComponentId"in e}function Z(e){return!(null===e||"object"!=typeof e||e.constructor&&"Object"!==e.constructor.name||"[object Object]"!==(e.toString?e.toString():Object.prototype.toString.call(e))||"props"in e&&(e.$$typeof||void 0===e.constructor))}function K(e,t,n){if(void 0===n&&(n=!1),!n&&!Z(e)&&!Array.isArray(e))return t;if(Array.isArray(t))for(var o=0;o<t.length;o++)e[o]=K(e[o],t[o]);else if(Z(t))for(var o in t)e[o]=K(e[o],t[o]);return e}var Q="production"!==process.env.NODE_ENV?{1:"Cannot create styled-component for component: %s.\n\n",2:"Can't collect styles once you've consumed a `ServerStyleSheet`'s styles! `ServerStyleSheet` is a one off instance for each server-side render cycle.\n\n- Are you trying to reuse it across renders?\n- Are you accidentally calling collectStyles twice?\n\n",3:"Streaming SSR is only supported in a Node.js environment; Please do not try to call this method in the browser.\n\n",4:"The `StyleSheetManager` expects a valid target or sheet prop!\n\n- Does this error occur on the client and is your target falsy?\n- Does this error occur on the server and is the sheet falsy?\n\n",5:"The clone method cannot be used on the client!\n\n- Are you running in a client-like environment on the server?\n- Are you trying to run SSR on the client?\n\n",6:"Trying to insert a new style tag, but the given Node is unmounted!\n\n- Are you using a custom target that isn't mounted?\n- Does your document not have a valid head element?\n- Have you accidentally removed a style tag manually?\n\n",7:'ThemeProvider: Please return an object from your "theme" prop function, e.g.\n\n```js\ntheme={() => ({})}\n```\n\n',8:'ThemeProvider: Please make your "theme" prop an object.\n\n',9:"Missing document `<head>`\n\n",10:"Cannot find a StyleSheet instance. Usually this happens if there are multiple copies of styled-components loaded at once. Check out this issue for how to troubleshoot and fix the common cases where this situation can happen: https://github.com/styled-components/styled-components/issues/1941#issuecomment-417862021\n\n",11:"_This error was replaced with a dev-time warning, it will be deleted for v4 final._ [createGlobalStyle] received children which will not be rendered. Please use the component without passing children elements.\n\n",12:"It seems you are interpolating a keyframe declaration (%s) into an untagged string. This was supported in styled-components v3, but is not longer supported in v4 as keyframes are now injected on-demand. Please wrap your string in the css\\`\\` helper which ensures the styles are injected correctly. See https://www.styled-components.com/docs/api#css\n\n",13:"%s 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.\n\n",14:'ThemeProvider: "theme" prop is required.\n\n',15:"A stylis plugin has been supplied that is not named. We need a name for each plugin to be able to prevent styling collisions between different stylis configurations within the same app. Before you pass your plugin to `<StyleSheetManager stylisPlugins={[]}>`, please make sure each plugin is uniquely-named, e.g.\n\n```js\nObject.defineProperty(importedPlugin, 'name', { value: 'some-unique-name' });\n```\n\n",16:"Reached the limit of how many styled components may be created at group %s.\nYou may only create up to 1,073,741,824 components. If you're creating components dynamically,\nas for instance in your render method then you may be running into this limitation.\n\n",17:"CSSStyleSheet could not be found on HTMLStyleElement.\nHas styled-components' style tag been unmounted or altered by another script?\n"}:{};function ee(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var n=e[0],o=[],r=1,s=e.length;r<s;r+=1)o.push(e[r]);return o.forEach(function(e){n=n.replace(/%[a-z]/,e)}),n}function te(t){for(var n=[],o=1;o<arguments.length;o++)n[o-1]=arguments[o];return"production"===process.env.NODE_ENV?new Error("An error occurred. See https://github.com/styled-components/styled-components/blob/main/packages/styled-components/src/utils/errors.md#".concat(t," for more information.").concat(n.length>0?" Args: ".concat(n.join(", ")):"")):new Error(ee.apply(void 0,e.__spreadArray([Q[t]],n,!1)).trim())}var ne=function(){function e(e){this.groupSizes=new Uint32Array(512),this.length=512,this.tag=e}return e.prototype.indexOfGroup=function(e){for(var t=0,n=0;n<e;n++)t+=this.groupSizes[n];return t},e.prototype.insertRules=function(e,t){if(e>=this.groupSizes.length){for(var n=this.groupSizes,o=n.length,r=o;e>=r;)if((r<<=1)<0)throw te(16,"".concat(e));this.groupSizes=new Uint32Array(r),this.groupSizes.set(n),this.length=r;for(var s=o;s<r;s++)this.groupSizes[s]=0}var i=this.indexOfGroup(e+1);if(Array.isArray(t)){s=0;for(var a=t.length;s<a;s++)this.tag.insertRule(i,t[s])&&(this.groupSizes[e]++,i++)}else this.tag.insertRule(i,t)&&this.groupSizes[e]++},e.prototype.clearGroup=function(e){if(e<this.length){var t=this.groupSizes[e],n=this.indexOfGroup(e),o=n+t;this.groupSizes[e]=0;for(var r=n;r<o;r++)this.tag.deleteRule(n)}},e.prototype.getGroup=function(e){var t="";if(e>=this.length||0===this.groupSizes[e])return t;for(var n=this.groupSizes[e],o=this.indexOfGroup(e),r=o+n,s=o;s<r;s++)t+="".concat(this.tag.getRule(s)).concat("/*!sc*/\n");return t},e}(),oe=new Map,re=new Map,se=1,ie=function(e){if(oe.has(e))return oe.get(e);for(;re.has(se);)se++;var t=se++;if("production"!==process.env.NODE_ENV&&((0|t)<0||t>1073741824))throw te(16,"".concat(t));return oe.set(e,t),re.set(t,e),t},ae=function(e,t){oe.set(e,t),re.set(t,e)},ce="style[".concat(p,"][").concat("data-styled-version",'="').concat(d,'"]'),ue=new RegExp("^".concat(p,'\\.g(\\d+)\\[id="([\\w\\d-]+)"\\].*?"([^"]*)')),le=function(e,t,n){for(var o,r=n.split(","),s=0,i=r.length;s<i;s++)(o=r[s])&&e.registerName(t,o)},pe=function(e,t){for(var n,o=(null!==(n=t.textContent)&&void 0!==n?n:"").split("/*!sc*/\n"),r=[],s=0,i=o.length;s<i;s++){var a=o[s].trim();if(a){var c=a.match(ue);if(c){var u=0|parseInt(c[1],10),l=c[2];0!==u&&(ae(l,u),le(e,l,c[3]),e.getTag().insertRules(u,r)),r.length=0}else r.push(a)}}};function de(){return"undefined"!=typeof __webpack_nonce__?__webpack_nonce__:null}var he=function(e){var t=document.head,n=e||t,o=document.createElement("style"),r=function(e){for(var t=e.childNodes,n=t.length;n>=0;n--){var o=t[n];if(o&&1===o.nodeType&&o.hasAttribute(p))return o}}(n),s=void 0!==r?r.nextSibling:null;o.setAttribute(p,"active"),o.setAttribute("data-styled-version",d);var i=de();return i&&o.setAttribute("nonce",i),n.insertBefore(o,s),o},fe=function(){function e(e){var t=this.element=he(e);t.appendChild(document.createTextNode("")),this.sheet=function(e){if(e.sheet)return e.sheet;for(var t=document.styleSheets,n=0,o=t.length;n<o;n++){var r=t[n];if(r.ownerNode===e)return r}throw te(17)}(t),this.length=0}return e.prototype.insertRule=function(e,t){try{return this.sheet.insertRule(t,e),this.length++,!0}catch(e){return!1}},e.prototype.deleteRule=function(e){this.sheet.deleteRule(e),this.length--},e.prototype.getRule=function(e){var t=this.sheet.cssRules[e];return void 0!==t&&"string"==typeof t.cssText?t.cssText:""},e}(),ye=function(){function e(e){var t=this.element=he(e);this.nodes=t.childNodes,this.length=0}return e.prototype.insertRule=function(e,t){if(e<=this.length&&e>=0){var n=document.createTextNode(t);return this.element.insertBefore(n,this.nodes[e]||null),this.length++,!0}return!1},e.prototype.deleteRule=function(e){this.element.removeChild(this.nodes[e]),this.length--},e.prototype.getRule=function(e){return e<this.length?this.nodes[e].textContent:""},e}(),me=function(){function e(e){this.rules=[],this.length=0}return e.prototype.insertRule=function(e,t){return e<=this.length&&(this.rules.splice(e,0,t),this.length++,!0)},e.prototype.deleteRule=function(e){this.rules.splice(e,1),this.length--},e.prototype.getRule=function(e){return e<this.length?this.rules[e]:""},e}(),ve=h,ge={isServer:!h,useCSSOMInjection:!f},Se=function(){function t(t,n,o){void 0===t&&(t=_),void 0===n&&(n={}),this.options=e.__assign(e.__assign({},ge),t),this.gs=n,this.names=new Map(o),this.server=!!t.isServer,!this.server&&h&&ve&&(ve=!1,function(e){for(var t=document.querySelectorAll(ce),n=0,o=t.length;n<o;n++){var r=t[n];r&&"active"!==r.getAttribute(p)&&(pe(e,r),r.parentNode&&r.parentNode.removeChild(r))}}(this))}return t.registerId=function(e){return ie(e)},t.prototype.reconstructWithOptions=function(n,o){return void 0===o&&(o=!0),new t(e.__assign(e.__assign({},this.options),n),this.gs,o&&this.names||void 0)},t.prototype.allocateGSInstance=function(e){return this.gs[e]=(this.gs[e]||0)+1},t.prototype.getTag=function(){return this.tag||(this.tag=(e=function(e){var t=e.useCSSOMInjection,n=e.target;return e.isServer?new me(n):t?new fe(n):new ye(n)}(this.options),new ne(e)));var e},t.prototype.hasNameForId=function(e,t){return this.names.has(e)&&this.names.get(e).has(t)},t.prototype.registerName=function(e,t){if(ie(e),this.names.has(e))this.names.get(e).add(t);else{var n=new Set;n.add(t),this.names.set(e,n)}},t.prototype.insertRules=function(e,t,n){this.registerName(e,t),this.getTag().insertRules(ie(e),n)},t.prototype.clearNames=function(e){this.names.has(e)&&this.names.get(e).clear()},t.prototype.clearRules=function(e){this.getTag().clearGroup(ie(e)),this.clearNames(e)},t.prototype.clearTag=function(){this.tag=void 0},t.prototype.toString=function(){return function(e){for(var t=e.getTag(),n=t.length,o="",r=function(n){var r=function(e){return re.get(e)}(n);if(void 0===r)return"continue";var s=e.names.get(r),i=t.getGroup(n);if(void 0===s||0===i.length)return"continue";var a="".concat(p,".g").concat(n,'[id="').concat(r,'"]'),c="";void 0!==s&&s.forEach(function(e){e.length>0&&(c+="".concat(e,","))}),o+="".concat(i).concat(a,'{content:"').concat(c,'"}').concat("/*!sc*/\n")},s=0;s<n;s++)r(s);return o}(this)},t}(),_e=/^\s*\/\/.*$/gm,we=[":","[",".","#"];function be(e){var t,n,o,s,i=void 0===e?_:e,a=i.options,c=void 0===a?_:a,u=i.plugins,l=void 0===u?S:u,p=function(e,o,r){return 0===o&&we.includes(r[n.length])||r.match(s)?e:".".concat(t)},d=function(e){if(e.type===r.RULESET&&e.value.includes("&")){var t=e.props;t[0]=t[0].replace(o,p)}},h=function(e,i,a,u){void 0===i&&(i=""),void 0===a&&(a=""),void 0===u&&(u="&");var p=e.replace(_e,"");t=u,n=i,o=new RegExp("\\".concat(n,"\\b"),"g"),s=new RegExp("(\\".concat(n,"\\b){2,}"));var h,f,y=l.slice();return(c.prefix||void 0===c.prefix)&&y.unshift(r.prefixer),y.push(d,r.stringify),h=r.compile(a||i?"".concat(a," ").concat(i," { ").concat(p," }"):p),f=r.middleware(y),h.map(function(e,t){return f(e,t,h,f)}).filter(Boolean)};return h.hash=l.length?l.reduce(function(e,t){return t.name||te(15),O(e,t.name)},5381).toString():"",h}var Ee=c.default.createContext(void 0),Ne=Ee.Consumer,Ce=c.default.createContext(void 0),Ae=new Se,Pe=be();function Ie(){return n.useContext(Ee)||Ae}function xe(){return n.useContext(Ce)||Pe}function Oe(e){var t=n.useState(e.stylisPlugins),o=t[0],r=t[1],s=Ie(),i=n.useMemo(function(){var t=s;return e.sheet?t=e.sheet:e.target&&(t=t.reconstructWithOptions({target:e.target},!1)),e.disableCSSOMInjection&&(t=t.reconstructWithOptions({useCSSOMInjection:!1})),t},[e.disableCSSOMInjection,e.sheet,e.target]),a=n.useMemo(function(){return be({options:{prefix:!e.disableVendorPrefixes},plugins:o})},[e.disableVendorPrefixes,o]);return n.useEffect(function(){u.default(o,e.stylisPlugins)||r(e.stylisPlugins)},[e.stylisPlugins]),c.default.createElement(Ee.Provider,{value:i},c.default.createElement(Ce.Provider,{value:a},"production"!==process.env.NODE_ENV?c.default.Children.only(e.children):e.children))}var Re=function(){function e(e,t){var n=this;this.inject=function(e,t){void 0===t&&(t=Pe);var o=n.name+t.hash;e.hasNameForId(n.id,o)||e.insertRules(n.id,o,t(n.rules,o,"@keyframes"))},this.toString=function(){throw te(12,String(n.name))},this.name=e,this.id="sc-keyframes-".concat(e),this.rules=t}return e.prototype.getName=function(e){return void 0===e&&(e=Pe),this.name+e.hash},e}(),De=/([A-Z])/,Te=/([A-Z])/g,je=/^ms-/,ke=function(e){return"-".concat(e.toLowerCase())};function Ve(e){return De.test(e)?e.replace(Te,ke).replace(je,"-ms-"):e}function Me(e){return"function"==typeof e}var Be=function(e){return null==e||!1===e||""===e},$e=function(t,n){var o,r=[];for(var s in t)t.hasOwnProperty(s)&&!Be(t[s])&&(Array.isArray(t[s])&&t[s].isCss||Me(t[s])?r.push("".concat(Ve(s),":"),t[s],";"):Z(t[s])?r.push.apply(r,$e(t[s],s)):r.push("".concat(Ve(s),": ").concat(null==(o=t[s])||"boolean"==typeof o||""===o?"":"number"!=typeof o||0===o||s in l.default?String(o).trim():"".concat(o,"px"),";")));return n?e.__spreadArray(e.__spreadArray(["".concat(n," {")],r,!0),["}"],!1):r};function ze(e,t,n,o){if(Array.isArray(e)){for(var r=[],s=0,i=e.length,a=void 0;s<i;s+=1)""!==(a=ze(e[s],t,n,o))&&(Array.isArray(a)?r.push.apply(r,a):r.push(a));return r}if(Be(e))return"";if(X(e))return".".concat(e.styledComponentId);if(Me(e)){if("function"!=typeof(u=e)||u.prototype&&u.prototype.isReactComponent||!t)return e;var c=e;return a=c(t),"production"===process.env.NODE_ENV||"object"!=typeof a||Array.isArray(a)||a instanceof Re||Z(a)||console.error("".concat(T(c)," 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.")),ze(a,t,n,o)}var u;return e instanceof Re?n?(e.inject(n,o),e.getName(o)):e:Z(e)?$e(e):e.toString()}function Le(e){for(var t=0;t<e.length;t+=1){var n=e[t];if(Me(n)&&!X(n))return!1}return!0}var Ge=R(d),Fe=function(){function e(e,t,n){this.names=[],this.rules=e,this.staticRulesId="",this.isStatic="production"===process.env.NODE_ENV&&(void 0===n||n.isStatic)&&Le(e),this.componentId=t,this.baseHash=O(Ge,t),this.baseStyle=n,Se.registerId(t)}return e.prototype.generateAndInjectStyles=function(e,t,n){var o=this.componentId;if(this.names.length=0,this.baseStyle&&this.names.push(this.baseStyle.generateAndInjectStyles(e,t,n)),this.isStatic&&!n.hash)if(this.staticRulesId&&t.hasNameForId(o,this.staticRulesId))this.names.push(this.staticRulesId);else{var r=ze(this.rules,e,t,n).join(""),s=I(O(this.baseHash,r)>>>0);if(!t.hasNameForId(o,s)){var i=n(r,".".concat(s),void 0,o);t.insertRules(o,s,i)}this.names.push(s),this.staticRulesId=s}else{for(var a=this.rules.length,c=O(this.baseHash,n.hash),u="",l=0;l<a;l++){var p=this.rules[l];if("string"==typeof p)u+=p,"production"!==process.env.NODE_ENV&&(c=O(c,p));else if(p){var d=ze(p,e,t,n),h=Array.isArray(d)?d.join(""):d;c=O(c,h),u+=h}}if(u){var f=I(c>>>0);if(!t.hasNameForId(o,f)){var y=n(u,".".concat(f),void 0,o);t.insertRules(o,f,y)}this.names.push(f)}}return this.names.join(" ")},e}(),qe=c.default.createContext(void 0),Ye=qe.Consumer,He={};function We(t,o,r){var s=X(t),i=t,u=!j(t),l=o.attrs,p=void 0===l?S:l,h=o.componentId,f=void 0===h?function(e,t){var n="string"!=typeof e?"sc":C(e);He[n]=(He[n]||0)+1;var o="".concat(n,"-").concat(D(d+n+He[n]));return t?"".concat(t,"-").concat(o):o}(o.displayName,o.parentComponentId):h,y=o.displayName,m=void 0===y?function(e){return j(e)?"styled.".concat(e):"Styled(".concat(T(e),")")}(t):y,v=o.displayName&&o.componentId?"".concat(C(o.displayName),"-").concat(o.componentId):o.componentId||f,E=s&&i.attrs?i.attrs.concat(p).filter(Boolean):p,N=o.shouldForwardProp;if(s&&i.shouldForwardProp){var A=i.shouldForwardProp;if(o.shouldForwardProp){var P=o.shouldForwardProp;N=function(e,t,n){return A(e,t,n)&&P(e,t,n)}}else N=A}var I=new Fe(r,v,s?i.componentStyle:void 0),x=I.isStatic&&0===p.length;function O(t,o){return function(t,o,r,s){var i=t.attrs,c=t.componentStyle,u=t.defaultProps,l=t.foldedComponentIds,p=t.shouldForwardProp,d=t.styledComponentId,h=t.target;"production"!==process.env.NODE_ENV&&n.useDebugValue(d);var f=function(t,n,o){void 0===t&&(t=_);var r=e.__assign(e.__assign({},n),{theme:t});return o.forEach(function(t){var n,o,s,i="function"==typeof t?t(r):t;for(n in i)r[n]="className"===n?(s=i[n],(o=r[n])&&s?"".concat(o," ").concat(s):o||s):"style"===n?e.__assign(e.__assign({},r[n]),i[n]):i[n]}),r}(w(o,n.useContext(qe),u)||_,o,i),y=function(e,t,o,r){var s=Ie(),i=xe(),a=e.generateAndInjectStyles(t?_:o,s,i);return"production"!==process.env.NODE_ENV&&n.useDebugValue(a),"production"!==process.env.NODE_ENV&&!t&&r&&r(a),a}(c,s,f,"production"!==process.env.NODE_ENV?t.warnTooManyClasses:void 0),m=r,v=f.$as||f.as||h,g=j(v),S={};for(var E in f)"$"!==E[0]&&"as"!==E&&"theme"!==E&&("forwardedAs"===E?S.as=f[E]:(p?p(E,a.default,v):!g||a.default(E))&&(S[E]=f[E]));return S[g&&-1===b.indexOf(v)?"class":"className"]=l.concat(d,y!==d?y:null,f.className).filter(Boolean).join(" "),S.ref=m,n.createElement(v,S)}(R,t,o,x)}O.displayName=m;var R=c.default.forwardRef(O);return R.attrs=E,R.componentStyle=I,R.displayName=m,R.shouldForwardProp=N,R.foldedComponentIds=s?i.foldedComponentIds.concat(i.styledComponentId):S,R.styledComponentId=v,R.target=s?i.target:t,R.withComponent=function(t){var n=o.componentId,s=e.__rest(o,["componentId"]),i=n&&"".concat(n,"-").concat(j(t)?t:C(T(t)));return We(t,e.__assign(e.__assign({},s),{attrs:E,componentId:i}),r)},Object.defineProperty(R,"defaultProps",{get:function(){return this._foldedDefaultProps},set:function(e){this._foldedDefaultProps=s?function(e){void 0===e&&(e={});for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];for(var o=0,r=t;o<r.length;o++)K(e,r[o],!0);return e}({},i.defaultProps,e):e}}),"production"!==process.env.NODE_ENV&&(g(m,v),R.warnTooManyClasses=function(e,t){var n={},o=!1;return function(r){if(!o&&(n[r]=!0,Object.keys(n).length>=200)){var s=t?' with the id of "'.concat(t,'"'):"";console.warn("Over ".concat(200," classes were generated for component ").concat(e).concat(s,".\n")+"Consider using the attrs method, together with a style object for frequently changed styles.\nExample:\n const Component = styled.div.attrs(props => ({\n style: {\n background: props.background,\n },\n }))`width: 100%;`\n\n <Component />"),o=!0,n={}}}}(m,v)),R.toString=function(){return".".concat(R.styledComponentId)},u&&J(R,t,{attrs:!0,componentStyle:!0,displayName:!0,foldedComponentIds:!0,shouldForwardProp:!0,styledComponentId:!0,target:!0,withComponent:!0}),R}function Ue(e,t){for(var n=[e[0]],o=0,r=t.length;o<r;o+=1)n.push(t[o],e[o+1]);return n}var Je=function(e){return Array.isArray(e)&&(e.isCss=!0),e};function Xe(t){for(var n=[],o=1;o<arguments.length;o++)n[o-1]=arguments[o];if(Me(t)||Z(t)){var r=t;return Je(ze(Ue(S,e.__spreadArray([r],n,!0))))}var s=t;return 0===n.length&&1===s.length&&"string"==typeof s[0]?s:Je(ze(Ue(s,n)))}function Ze(t,n,o){if(void 0===o&&(o=_),!n)throw te(1,n);var r=function(r){for(var s=[],i=1;i<arguments.length;i++)s[i-1]=arguments[i];return t(n,o,Xe.apply(void 0,e.__spreadArray([r],s,!1)))};return r.attrs=function(r){return Ze(t,n,e.__assign(e.__assign({},o),{attrs:Array.prototype.concat(o.attrs,r).filter(Boolean)}))},r.withConfig=function(r){return Ze(t,n,e.__assign(e.__assign({},o),r))},r}var Ke=function(e){return Ze(We,e)},Qe=Ke;b.forEach(function(e){Qe[e]=Ke(e)});var et=function(){function e(e,t){this.rules=e,this.componentId=t,this.isStatic=Le(e),Se.registerId(this.componentId+1)}return e.prototype.createStyles=function(e,t,n,o){var r=o(ze(this.rules,t,n,o).join(""),""),s=this.componentId+e;n.insertRules(s,s,r)},e.prototype.removeStyles=function(e,t){t.clearRules(this.componentId+e)},e.prototype.renderStyles=function(e,t,n,o){e>2&&Se.registerId(this.componentId+e),this.removeStyles(e,n),this.createStyles(e,t,n,o)},e}(),tt=function(){function t(){var t=this;this._emitSheetCSS=function(){var e=t.instance.toString(),n=de(),o=[n&&'nonce="'.concat(n,'"'),"".concat(p,'="true"'),"".concat("data-styled-version",'="').concat(d,'"')].filter(Boolean).join(" ");return"<style ".concat(o,">").concat(e,"</style>")},this.getStyleTags=function(){if(t.sealed)throw te(2);return t._emitSheetCSS()},this.getStyleElement=function(){var n;if(t.sealed)throw te(2);var o=((n={})[p]="",n["data-styled-version"]=d,n.dangerouslySetInnerHTML={__html:t.instance.toString()},n),r=de();return r&&(o.nonce=r),[c.default.createElement("style",e.__assign({},o,{key:"sc-0-0"}))]},this.seal=function(){t.sealed=!0},this.instance=new Se({isServer:!0}),this.sealed=!1}return t.prototype.collectStyles=function(e){if(this.sealed)throw te(2);return c.default.createElement(Oe,{sheet:this.instance},e)},t.prototype.interleaveWithNodeStream=function(e){throw te(3)},t}(),nt={StyleSheet:Se,mainSheet:Ae};"production"!==process.env.NODE_ENV&&"undefined"!=typeof navigator&&"ReactNative"===navigator.product&&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"),"production"!==process.env.NODE_ENV&&"test"!==process.env.NODE_ENV&&"undefined"!=typeof window&&(window["__styled-components-init__"]||(window["__styled-components-init__"]=0),1===window["__styled-components-init__"]&&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."),window["__styled-components-init__"]+=1),exports.ServerStyleSheet=tt,exports.StyleSheetConsumer=Ne,exports.StyleSheetContext=Ee,exports.StyleSheetManager=Oe,exports.ThemeConsumer=Ye,exports.ThemeContext=qe,exports.ThemeProvider=function(t){var o=n.useContext(qe),r=n.useMemo(function(){return function(t,n){if(!t)throw te(14);if(Me(t)){var o=t(n);if("production"!==process.env.NODE_ENV&&(null===o||Array.isArray(o)||"object"!=typeof o))throw te(7);return o}if(Array.isArray(t)||"object"!=typeof t)throw te(8);return n?e.__assign(e.__assign({},n),t):t}(t.theme,o)},[t.theme,o]);return t.children?c.default.createElement(qe.Provider,{value:r},t.children):null},exports.__PRIVATE__=nt,exports.createGlobalStyle=function(t){for(var n=[],o=1;o<arguments.length;o++)n[o-1]=arguments[o];var r=Xe.apply(void 0,e.__spreadArray([t],n,!1)),s="sc-global-".concat(D(JSON.stringify(r))),i=new et(r,s);"production"!==process.env.NODE_ENV&&g(s);var a=function(e){var t=Ie(),n=xe(),o=c.default.useContext(qe),a=c.default.useRef(t.allocateGSInstance(s)).current;return"production"!==process.env.NODE_ENV&&c.default.Children.count(e.children)&&console.warn("The global style component ".concat(s," was given child JSX. createGlobalStyle does not render children.")),"production"!==process.env.NODE_ENV&&r.some(function(e){return"string"==typeof e&&-1!==e.indexOf("@import")})&&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."),t.server&&u(a,e,t,o,n),(c.default.useInsertionEffect||c.default.useLayoutEffect)(function(){if(!t.server)return u(a,e,t,o,n),function(){return i.removeStyles(a,t)}},[a,e,t,o,n]),null};function u(t,n,o,r,s){if(i.isStatic)i.renderStyles(t,y,o,s);else{var c=e.__assign(e.__assign({},n),{theme:w(n,r,a.defaultProps)});i.renderStyles(t,c,o,s)}}return c.default.memo(a)},exports.css=Xe,exports.default=Qe,exports.isStyledComponent=X,exports.keyframes=function(t){for(var n=[],o=1;o<arguments.length;o++)n[o-1]=arguments[o];"production"!==process.env.NODE_ENV&&"undefined"!=typeof navigator&&"ReactNative"===navigator.product&&console.warn("`keyframes` cannot be used on ReactNative, only on the web. To do animation in ReactNative please use Animated.");var r=Xe.apply(void 0,e.__spreadArray([t],n,!1)).join(""),s=D(r);return new Re(s,r)},exports.useTheme=function(){return n.useContext(qe)},exports.version=d,exports.withTheme=function(t){var n=c.default.forwardRef(function(n,o){var r=w(n,c.default.useContext(qe),t.defaultProps);return"production"!==process.env.NODE_ENV&&void 0===r&&console.warn('[withTheme] You are not using a ThemeProvider nor passing a theme prop or a theme in defaultProps in component class "'.concat(T(t),'"')),c.default.createElement(t,e.__assign({},n,{theme:r,ref:o}))});return n.displayName="WithTheme(".concat(T(t),")"),J(n,t)};
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var tslib = require('tslib');
6
+ var React = require('react');
7
+ var shallowequal = require('shallowequal');
8
+ var stylis = require('stylis');
9
+ var unitless = require('@emotion/unitless');
10
+
11
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
12
+
13
+ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
14
+ var shallowequal__default = /*#__PURE__*/_interopDefaultLegacy(shallowequal);
15
+ var unitless__default = /*#__PURE__*/_interopDefaultLegacy(unitless);
16
+
17
+ var SC_ATTR = (typeof process !== 'undefined' && (process.env.REACT_APP_SC_ATTR || process.env.SC_ATTR)) ||
18
+ 'data-styled';
19
+ var SC_ATTR_ACTIVE = 'active';
20
+ var SC_ATTR_VERSION = 'data-styled-version';
21
+ var SC_VERSION = "6.0.0-beta.2";
22
+ var SPLITTER = '/*!sc*/\n';
23
+ var IS_BROWSER = typeof window !== 'undefined' && 'HTMLElement' in window;
24
+ var DISABLE_SPEEDY = Boolean(typeof SC_DISABLE_SPEEDY === 'boolean'
25
+ ? SC_DISABLE_SPEEDY
26
+ : typeof process !== 'undefined' &&
27
+ typeof process.env.REACT_APP_SC_DISABLE_SPEEDY !== 'undefined' &&
28
+ process.env.REACT_APP_SC_DISABLE_SPEEDY !== ''
29
+ ? process.env.REACT_APP_SC_DISABLE_SPEEDY === 'false'
30
+ ? false
31
+ : process.env.REACT_APP_SC_DISABLE_SPEEDY
32
+ : typeof process !== 'undefined' &&
33
+ typeof process.env.SC_DISABLE_SPEEDY !== 'undefined' &&
34
+ process.env.SC_DISABLE_SPEEDY !== ''
35
+ ? process.env.SC_DISABLE_SPEEDY === 'false'
36
+ ? false
37
+ : process.env.SC_DISABLE_SPEEDY
38
+ : process.env.NODE_ENV !== 'production');
39
+ // Shared empty execution context when generating static styles
40
+ var STATIC_EXECUTION_CONTEXT = {};
41
+
42
+ var invalidHookCallRe = /invalid hook call/i;
43
+ var seen = new Set();
44
+ var checkDynamicCreation = function (displayName, componentId) {
45
+ if (process.env.NODE_ENV !== 'production') {
46
+ var parsedIdString = componentId ? " with the id of \"".concat(componentId, "\"") : '';
47
+ var message_1 = "The component ".concat(displayName).concat(parsedIdString, " has been created dynamically.\n") +
48
+ "You may see this warning because you've called styled inside another component.\n" +
49
+ 'To resolve this only create new StyledComponents outside of any render method and function component.';
50
+ // If a hook is called outside of a component:
51
+ // React 17 and earlier throw an error
52
+ // React 18 and above use console.error
53
+ var originalConsoleError_1 = console.error;
54
+ try {
55
+ var didNotCallInvalidHook_1 = true;
56
+ console.error = function (consoleErrorMessage) {
57
+ var consoleErrorArgs = [];
58
+ for (var _i = 1; _i < arguments.length; _i++) {
59
+ consoleErrorArgs[_i - 1] = arguments[_i];
60
+ }
61
+ // The error here is expected, since we're expecting anything that uses `checkDynamicCreation` to
62
+ // be called outside of a React component.
63
+ if (invalidHookCallRe.test(consoleErrorMessage)) {
64
+ didNotCallInvalidHook_1 = false;
65
+ // This shouldn't happen, but resets `warningSeen` if we had this error happen intermittently
66
+ seen.delete(message_1);
67
+ }
68
+ else {
69
+ originalConsoleError_1.apply(void 0, tslib.__spreadArray([consoleErrorMessage], consoleErrorArgs, false));
70
+ }
71
+ };
72
+ // We purposefully call `useRef` outside of a component and expect it to throw
73
+ // If it doesn't, then we're inside another component.
74
+ // eslint-disable-next-line react-hooks/rules-of-hooks
75
+ React.useRef();
76
+ if (didNotCallInvalidHook_1 && !seen.has(message_1)) {
77
+ // eslint-disable-next-line no-console
78
+ console.warn(message_1);
79
+ seen.add(message_1);
80
+ }
81
+ }
82
+ catch (error) {
83
+ // The error here is expected, since we're expecting anything that uses `checkDynamicCreation` to
84
+ // be called outside of a React component.
85
+ if (invalidHookCallRe.test(error.message)) {
86
+ // This shouldn't happen, but resets `warningSeen` if we had this error happen intermittently
87
+ seen.delete(message_1);
88
+ }
89
+ }
90
+ finally {
91
+ console.error = originalConsoleError_1;
92
+ }
93
+ }
94
+ };
95
+
96
+ var LIMIT = 200;
97
+ var createWarnTooManyClasses = (function (displayName, componentId) {
98
+ var generatedClasses = {};
99
+ var warningSeen = false;
100
+ return function (className) {
101
+ if (!warningSeen) {
102
+ generatedClasses[className] = true;
103
+ if (Object.keys(generatedClasses).length >= LIMIT) {
104
+ // Unable to find latestRule in test environment.
105
+ /* eslint-disable no-console, prefer-template */
106
+ var parsedIdString = componentId ? " with the id of \"".concat(componentId, "\"") : '';
107
+ console.warn("Over ".concat(LIMIT, " classes were generated for component ").concat(displayName).concat(parsedIdString, ".\n") +
108
+ 'Consider using the attrs method, together with a style object for frequently changed styles.\n' +
109
+ 'Example:\n' +
110
+ ' const Component = styled.div.attrs(props => ({\n' +
111
+ ' style: {\n' +
112
+ ' background: props.background,\n' +
113
+ ' },\n' +
114
+ ' }))`width: 100%;`\n\n' +
115
+ ' <Component />');
116
+ warningSeen = true;
117
+ generatedClasses = {};
118
+ }
119
+ }
120
+ };
121
+ });
122
+
123
+ var EMPTY_ARRAY = Object.freeze([]);
124
+ var EMPTY_OBJECT = Object.freeze({});
125
+
126
+ function determineTheme(props, providedTheme, defaultProps) {
127
+ if (defaultProps === void 0) { defaultProps = EMPTY_OBJECT; }
128
+ return (props.theme !== defaultProps.theme && props.theme) || providedTheme || defaultProps.theme;
129
+ }
130
+
131
+ // Thanks to ReactDOMFactories for this handy list!
132
+ var domElements = [
133
+ 'a',
134
+ 'abbr',
135
+ 'address',
136
+ 'area',
137
+ 'article',
138
+ 'aside',
139
+ 'audio',
140
+ 'b',
141
+ 'base',
142
+ 'bdi',
143
+ 'bdo',
144
+ 'big',
145
+ 'blockquote',
146
+ 'body',
147
+ 'br',
148
+ 'button',
149
+ 'canvas',
150
+ 'caption',
151
+ 'cite',
152
+ 'code',
153
+ 'col',
154
+ 'colgroup',
155
+ 'data',
156
+ 'datalist',
157
+ 'dd',
158
+ 'del',
159
+ 'details',
160
+ 'dfn',
161
+ 'dialog',
162
+ 'div',
163
+ 'dl',
164
+ 'dt',
165
+ 'em',
166
+ 'embed',
167
+ 'fieldset',
168
+ 'figcaption',
169
+ 'figure',
170
+ 'footer',
171
+ 'form',
172
+ 'h1',
173
+ 'h2',
174
+ 'h3',
175
+ 'h4',
176
+ 'h5',
177
+ 'h6',
178
+ 'head',
179
+ 'header',
180
+ 'hgroup',
181
+ 'hr',
182
+ 'html',
183
+ 'i',
184
+ 'iframe',
185
+ 'img',
186
+ 'input',
187
+ 'ins',
188
+ 'kbd',
189
+ 'keygen',
190
+ 'label',
191
+ 'legend',
192
+ 'li',
193
+ 'link',
194
+ 'main',
195
+ 'map',
196
+ 'mark',
197
+ 'menu',
198
+ 'menuitem',
199
+ 'meta',
200
+ 'meter',
201
+ 'nav',
202
+ 'noscript',
203
+ 'object',
204
+ 'ol',
205
+ 'optgroup',
206
+ 'option',
207
+ 'output',
208
+ 'p',
209
+ 'param',
210
+ 'picture',
211
+ 'pre',
212
+ 'progress',
213
+ 'q',
214
+ 'rp',
215
+ 'rt',
216
+ 'ruby',
217
+ 's',
218
+ 'samp',
219
+ 'script',
220
+ 'section',
221
+ 'select',
222
+ 'small',
223
+ 'source',
224
+ 'span',
225
+ 'strong',
226
+ 'style',
227
+ 'sub',
228
+ 'summary',
229
+ 'sup',
230
+ 'table',
231
+ 'tbody',
232
+ 'td',
233
+ 'textarea',
234
+ 'tfoot',
235
+ 'th',
236
+ 'thead',
237
+ 'time',
238
+ 'title',
239
+ 'tr',
240
+ 'track',
241
+ 'u',
242
+ 'ul',
243
+ 'var',
244
+ 'video',
245
+ 'wbr',
246
+ 'circle',
247
+ 'clipPath',
248
+ 'defs',
249
+ 'ellipse',
250
+ 'foreignObject',
251
+ 'g',
252
+ 'image',
253
+ 'line',
254
+ 'linearGradient',
255
+ 'marker',
256
+ 'mask',
257
+ 'path',
258
+ 'pattern',
259
+ 'polygon',
260
+ 'polyline',
261
+ 'radialGradient',
262
+ 'rect',
263
+ 'stop',
264
+ 'svg',
265
+ 'text',
266
+ 'tspan',
267
+ ];
268
+
269
+ // Source: https://www.w3.org/TR/cssom-1/#serialize-an-identifier
270
+ // Control characters and non-letter first symbols are not supported
271
+ var escapeRegex = /[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~-]+/g;
272
+ var dashesAtEnds = /(^-|-$)/g;
273
+ /**
274
+ * TODO: Explore using CSS.escape when it becomes more available
275
+ * in evergreen browsers.
276
+ */
277
+ function escape(str) {
278
+ return str // Replace all possible CSS selectors
279
+ .replace(escapeRegex, '-') // Remove extraneous hyphens at the start and end
280
+ .replace(dashesAtEnds, '');
281
+ }
282
+
283
+ var AD_REPLACER_R = /(a)(d)/gi;
284
+ /* This is the "capacity" of our alphabet i.e. 2x26 for all letters plus their capitalised
285
+ * counterparts */
286
+ var charsLength = 52;
287
+ /* start at 75 for 'a' until 'z' (25) and then start at 65 for capitalised letters */
288
+ var getAlphabeticChar = function (code) { return String.fromCharCode(code + (code > 25 ? 39 : 97)); };
289
+ /* input a number, usually a hash and convert it to base-52 */
290
+ function generateAlphabeticName(code) {
291
+ var name = '';
292
+ var x;
293
+ /* get a char and divide by alphabet-length */
294
+ for (x = Math.abs(code); x > charsLength; x = (x / charsLength) | 0) {
295
+ name = getAlphabeticChar(x % charsLength) + name;
296
+ }
297
+ return (getAlphabeticChar(x % charsLength) + name).replace(AD_REPLACER_R, '$1-$2');
298
+ }
299
+
300
+ var SEED$1 = 5381;
301
+ // When we have separate strings it's useful to run a progressive
302
+ // version of djb2 where we pretend that we're still looping over
303
+ // the same string
304
+ var phash = function (h, x) {
305
+ var i = x.length;
306
+ while (i) {
307
+ h = (h * 33) ^ x.charCodeAt(--i);
308
+ }
309
+ return h;
310
+ };
311
+ // This is a djb2 hashing function
312
+ var hash = function (x) {
313
+ return phash(SEED$1, x);
314
+ };
315
+
316
+ function generateComponentId(str) {
317
+ return generateAlphabeticName(hash(str) >>> 0);
318
+ }
319
+
320
+ function getComponentName(target) {
321
+ return ((process.env.NODE_ENV !== 'production' ? typeof target === 'string' && target : false) ||
322
+ target.displayName ||
323
+ target.name ||
324
+ 'Component');
325
+ }
326
+
327
+ function isTag(target) {
328
+ return (typeof target === 'string' &&
329
+ (process.env.NODE_ENV !== 'production'
330
+ ? target.charAt(0) === target.charAt(0).toLowerCase()
331
+ : true));
332
+ }
333
+
334
+ function generateDisplayName(target) {
335
+ return isTag(target) ? "styled.".concat(target) : "Styled(".concat(getComponentName(target), ")");
336
+ }
337
+
338
+ var _a;
339
+ var hasSymbol = typeof Symbol === 'function' && Symbol.for;
340
+ // copied from react-is
341
+ var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
342
+ var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
343
+ /**
344
+ * Adapted from hoist-non-react-statics to avoid the react-is dependency.
345
+ */
346
+ var REACT_STATICS = {
347
+ childContextTypes: true,
348
+ contextType: true,
349
+ contextTypes: true,
350
+ defaultProps: true,
351
+ displayName: true,
352
+ getDefaultProps: true,
353
+ getDerivedStateFromError: true,
354
+ getDerivedStateFromProps: true,
355
+ mixins: true,
356
+ propTypes: true,
357
+ type: true,
358
+ };
359
+ var KNOWN_STATICS = {
360
+ name: true,
361
+ length: true,
362
+ prototype: true,
363
+ caller: true,
364
+ callee: true,
365
+ arguments: true,
366
+ arity: true,
367
+ };
368
+ var FORWARD_REF_STATICS = {
369
+ $$typeof: true,
370
+ render: true,
371
+ defaultProps: true,
372
+ displayName: true,
373
+ propTypes: true,
374
+ };
375
+ var MEMO_STATICS = {
376
+ $$typeof: true,
377
+ compare: true,
378
+ defaultProps: true,
379
+ displayName: true,
380
+ propTypes: true,
381
+ type: true,
382
+ };
383
+ var TYPE_STATICS = (_a = {},
384
+ _a[REACT_FORWARD_REF_TYPE] = FORWARD_REF_STATICS,
385
+ _a[REACT_MEMO_TYPE] = MEMO_STATICS,
386
+ _a);
387
+ // adapted from react-is
388
+ function isMemo(object) {
389
+ var $$typeofType = 'type' in object && object.type.$$typeof;
390
+ return $$typeofType === REACT_MEMO_TYPE;
391
+ }
392
+ function getStatics(component) {
393
+ // React v16.11 and below
394
+ if (isMemo(component)) {
395
+ return MEMO_STATICS;
396
+ }
397
+ // React v16.12 and above
398
+ return '$$typeof' in component
399
+ ? TYPE_STATICS[component['$$typeof']]
400
+ : REACT_STATICS;
401
+ }
402
+ var defineProperty = Object.defineProperty;
403
+ var getOwnPropertyNames = Object.getOwnPropertyNames;
404
+ var getOwnPropertySymbols = Object.getOwnPropertySymbols;
405
+ var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
406
+ var getPrototypeOf = Object.getPrototypeOf;
407
+ var objectPrototype = Object.prototype;
408
+ function hoistNonReactStatics(targetComponent, sourceComponent, excludelist) {
409
+ if (typeof sourceComponent !== 'string') {
410
+ // don't hoist over string (html) components
411
+ if (objectPrototype) {
412
+ var inheritedComponent = getPrototypeOf(sourceComponent);
413
+ if (inheritedComponent && inheritedComponent !== objectPrototype) {
414
+ hoistNonReactStatics(targetComponent, inheritedComponent, excludelist);
415
+ }
416
+ }
417
+ var keys = getOwnPropertyNames(sourceComponent);
418
+ if (getOwnPropertySymbols) {
419
+ keys = keys.concat(getOwnPropertySymbols(sourceComponent));
420
+ }
421
+ var targetStatics = getStatics(targetComponent);
422
+ var sourceStatics = getStatics(sourceComponent);
423
+ for (var i = 0; i < keys.length; ++i) {
424
+ var key = keys[i];
425
+ if (!(key in KNOWN_STATICS) &&
426
+ !(excludelist && excludelist[key]) &&
427
+ !(sourceStatics && key in sourceStatics) &&
428
+ !(targetStatics && key in targetStatics)) {
429
+ var descriptor = getOwnPropertyDescriptor(sourceComponent, key);
430
+ try {
431
+ // Avoid failures from read-only properties
432
+ defineProperty(targetComponent, key, descriptor);
433
+ }
434
+ catch (e) {
435
+ /* ignore */
436
+ }
437
+ }
438
+ }
439
+ }
440
+ return targetComponent;
441
+ }
442
+
443
+ function isStyledComponent(target) {
444
+ return typeof target === 'object' && 'styledComponentId' in target;
445
+ }
446
+
447
+ /**
448
+ * Convenience function for joining strings to form className chains
449
+ */
450
+ function joinStrings(a, b) {
451
+ return a && b ? "".concat(a, " ").concat(b) : a || b;
452
+ }
453
+
454
+ function isPlainObject(x) {
455
+ return (x !== null &&
456
+ typeof x === 'object' &&
457
+ /* a check for empty prototype would be more typical, but that
458
+ doesn't play well with objects created in different vm contexts */
459
+ (!x.constructor || x.constructor.name === 'Object') &&
460
+ (x.toString ? x.toString() : Object.prototype.toString.call(x)) === '[object Object]' &&
461
+ /* check for reasonable markers that the object isn't an element for react & preact/compat */
462
+ !('props' in x && (x.$$typeof || x.constructor === undefined)));
463
+ }
464
+
465
+ function mixinRecursively(target, source, forceMerge) {
466
+ if (forceMerge === void 0) { forceMerge = false; }
467
+ /* only merge into POJOs, Arrays, but for top level objects only
468
+ * allow to merge into anything by passing forceMerge = true */
469
+ if (!forceMerge && !isPlainObject(target) && !Array.isArray(target)) {
470
+ return source;
471
+ }
472
+ if (Array.isArray(source)) {
473
+ for (var key = 0; key < source.length; key++) {
474
+ target[key] = mixinRecursively(target[key], source[key]);
475
+ }
476
+ }
477
+ else if (isPlainObject(source)) {
478
+ for (var key in source) {
479
+ target[key] = mixinRecursively(target[key], source[key]);
480
+ }
481
+ }
482
+ return target;
483
+ }
484
+ /**
485
+ * Arrays & POJOs merged recursively, other objects and value types are overridden
486
+ * If target is not a POJO or an Array, it will get source properties injected via shallow merge
487
+ * Source objects applied left to right. Mutates & returns target. Similar to lodash merge.
488
+ */
489
+ function mixinDeep(target) {
490
+ if (target === void 0) { target = {}; }
491
+ var sources = [];
492
+ for (var _i = 1; _i < arguments.length; _i++) {
493
+ sources[_i - 1] = arguments[_i];
494
+ }
495
+ for (var _a = 0, sources_1 = sources; _a < sources_1.length; _a++) {
496
+ var source = sources_1[_a];
497
+ mixinRecursively(target, source, true);
498
+ }
499
+ return target;
500
+ }
501
+
502
+ var errorMap = {
503
+ '1': 'Cannot create styled-component for component: %s.\n\n',
504
+ '2': "Can't collect styles once you've consumed a `ServerStyleSheet`'s styles! `ServerStyleSheet` is a one off instance for each server-side render cycle.\n\n- Are you trying to reuse it across renders?\n- Are you accidentally calling collectStyles twice?\n\n",
505
+ '3': 'Streaming SSR is only supported in a Node.js environment; Please do not try to call this method in the browser.\n\n',
506
+ '4': 'The `StyleSheetManager` expects a valid target or sheet prop!\n\n- Does this error occur on the client and is your target falsy?\n- Does this error occur on the server and is the sheet falsy?\n\n',
507
+ '5': 'The clone method cannot be used on the client!\n\n- Are you running in a client-like environment on the server?\n- Are you trying to run SSR on the client?\n\n',
508
+ '6': "Trying to insert a new style tag, but the given Node is unmounted!\n\n- Are you using a custom target that isn't mounted?\n- Does your document not have a valid head element?\n- Have you accidentally removed a style tag manually?\n\n",
509
+ '7': 'ThemeProvider: Please return an object from your "theme" prop function, e.g.\n\n```js\ntheme={() => ({})}\n```\n\n',
510
+ '8': 'ThemeProvider: Please make your "theme" prop an object.\n\n',
511
+ '9': 'Missing document `<head>`\n\n',
512
+ '10': 'Cannot find a StyleSheet instance. Usually this happens if there are multiple copies of styled-components loaded at once. Check out this issue for how to troubleshoot and fix the common cases where this situation can happen: https://github.com/styled-components/styled-components/issues/1941#issuecomment-417862021\n\n',
513
+ '11': '_This error was replaced with a dev-time warning, it will be deleted for v4 final._ [createGlobalStyle] received children which will not be rendered. Please use the component without passing children elements.\n\n',
514
+ '12': 'It seems you are interpolating a keyframe declaration (%s) into an untagged string. This was supported in styled-components v3, but is not longer supported in v4 as keyframes are now injected on-demand. Please wrap your string in the css\\`\\` helper which ensures the styles are injected correctly. See https://www.styled-components.com/docs/api#css\n\n',
515
+ '13': '%s 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.\n\n',
516
+ '14': 'ThemeProvider: "theme" prop is required.\n\n',
517
+ '15': "A stylis plugin has been supplied that is not named. We need a name for each plugin to be able to prevent styling collisions between different stylis configurations within the same app. Before you pass your plugin to `<StyleSheetManager stylisPlugins={[]}>`, please make sure each plugin is uniquely-named, e.g.\n\n```js\nObject.defineProperty(importedPlugin, 'name', { value: 'some-unique-name' });\n```\n\n",
518
+ '16': "Reached the limit of how many styled components may be created at group %s.\nYou may only create up to 1,073,741,824 components. If you're creating components dynamically,\nas for instance in your render method then you may be running into this limitation.\n\n",
519
+ '17': "CSSStyleSheet could not be found on HTMLStyleElement.\nHas styled-components' style tag been unmounted or altered by another script?\n",
520
+ };
521
+
522
+ var ERRORS = process.env.NODE_ENV !== 'production' ? errorMap : {};
523
+ /**
524
+ * super basic version of sprintf
525
+ */
526
+ function format() {
527
+ var args = [];
528
+ for (var _i = 0; _i < arguments.length; _i++) {
529
+ args[_i] = arguments[_i];
530
+ }
531
+ var a = args[0];
532
+ var b = [];
533
+ for (var c = 1, len = args.length; c < len; c += 1) {
534
+ b.push(args[c]);
535
+ }
536
+ b.forEach(function (d) {
537
+ a = a.replace(/%[a-z]/, d);
538
+ });
539
+ return a;
540
+ }
541
+ /**
542
+ * Create an error file out of errors.md for development and a simple web link to the full errors
543
+ * in production mode.
544
+ */
545
+ function throwStyledComponentsError(code) {
546
+ var interpolations = [];
547
+ for (var _i = 1; _i < arguments.length; _i++) {
548
+ interpolations[_i - 1] = arguments[_i];
549
+ }
550
+ if (process.env.NODE_ENV === 'production') {
551
+ return new Error("An error occurred. See https://github.com/styled-components/styled-components/blob/main/packages/styled-components/src/utils/errors.md#".concat(code, " for more information.").concat(interpolations.length > 0 ? " Args: ".concat(interpolations.join(', ')) : ''));
552
+ }
553
+ else {
554
+ return new Error(format.apply(void 0, tslib.__spreadArray([ERRORS[code]], interpolations, false)).trim());
555
+ }
556
+ }
557
+
558
+ /** Create a GroupedTag with an underlying Tag implementation */
559
+ var makeGroupedTag = function (tag) {
560
+ return new DefaultGroupedTag(tag);
561
+ };
562
+ var BASE_SIZE = 1 << 9;
563
+ var DefaultGroupedTag = /** @class */ (function () {
564
+ function DefaultGroupedTag(tag) {
565
+ this.groupSizes = new Uint32Array(BASE_SIZE);
566
+ this.length = BASE_SIZE;
567
+ this.tag = tag;
568
+ }
569
+ DefaultGroupedTag.prototype.indexOfGroup = function (group) {
570
+ var index = 0;
571
+ for (var i = 0; i < group; i++) {
572
+ index += this.groupSizes[i];
573
+ }
574
+ return index;
575
+ };
576
+ DefaultGroupedTag.prototype.insertRules = function (group, rules) {
577
+ if (group >= this.groupSizes.length) {
578
+ var oldBuffer = this.groupSizes;
579
+ var oldSize = oldBuffer.length;
580
+ var newSize = oldSize;
581
+ while (group >= newSize) {
582
+ newSize <<= 1;
583
+ if (newSize < 0) {
584
+ throw throwStyledComponentsError(16, "".concat(group));
585
+ }
586
+ }
587
+ this.groupSizes = new Uint32Array(newSize);
588
+ this.groupSizes.set(oldBuffer);
589
+ this.length = newSize;
590
+ for (var i = oldSize; i < newSize; i++) {
591
+ this.groupSizes[i] = 0;
592
+ }
593
+ }
594
+ var ruleIndex = this.indexOfGroup(group + 1);
595
+ if (Array.isArray(rules)) {
596
+ for (var i = 0, l = rules.length; i < l; i++) {
597
+ if (this.tag.insertRule(ruleIndex, rules[i])) {
598
+ this.groupSizes[group]++;
599
+ ruleIndex++;
600
+ }
601
+ }
602
+ }
603
+ else {
604
+ if (this.tag.insertRule(ruleIndex, rules)) {
605
+ this.groupSizes[group]++;
606
+ }
607
+ }
608
+ };
609
+ DefaultGroupedTag.prototype.clearGroup = function (group) {
610
+ if (group < this.length) {
611
+ var length_1 = this.groupSizes[group];
612
+ var startIndex = this.indexOfGroup(group);
613
+ var endIndex = startIndex + length_1;
614
+ this.groupSizes[group] = 0;
615
+ for (var i = startIndex; i < endIndex; i++) {
616
+ this.tag.deleteRule(startIndex);
617
+ }
618
+ }
619
+ };
620
+ DefaultGroupedTag.prototype.getGroup = function (group) {
621
+ var css = '';
622
+ if (group >= this.length || this.groupSizes[group] === 0) {
623
+ return css;
624
+ }
625
+ var length = this.groupSizes[group];
626
+ var startIndex = this.indexOfGroup(group);
627
+ var endIndex = startIndex + length;
628
+ for (var i = startIndex; i < endIndex; i++) {
629
+ css += "".concat(this.tag.getRule(i)).concat(SPLITTER);
630
+ }
631
+ return css;
632
+ };
633
+ return DefaultGroupedTag;
634
+ }());
635
+
636
+ var MAX_SMI = 1 << (31 - 1);
637
+ var groupIDRegister = new Map();
638
+ var reverseRegister = new Map();
639
+ var nextFreeGroup = 1;
640
+ var getGroupForId = function (id) {
641
+ if (groupIDRegister.has(id)) {
642
+ return groupIDRegister.get(id);
643
+ }
644
+ while (reverseRegister.has(nextFreeGroup)) {
645
+ nextFreeGroup++;
646
+ }
647
+ var group = nextFreeGroup++;
648
+ if (process.env.NODE_ENV !== 'production' && ((group | 0) < 0 || group > MAX_SMI)) {
649
+ throw throwStyledComponentsError(16, "".concat(group));
650
+ }
651
+ groupIDRegister.set(id, group);
652
+ reverseRegister.set(group, id);
653
+ return group;
654
+ };
655
+ var getIdForGroup = function (group) {
656
+ return reverseRegister.get(group);
657
+ };
658
+ var setGroupForId = function (id, group) {
659
+ groupIDRegister.set(id, group);
660
+ reverseRegister.set(group, id);
661
+ };
662
+
663
+ var SELECTOR = "style[".concat(SC_ATTR, "][").concat(SC_ATTR_VERSION, "=\"").concat(SC_VERSION, "\"]");
664
+ var MARKER_RE = new RegExp("^".concat(SC_ATTR, "\\.g(\\d+)\\[id=\"([\\w\\d-]+)\"\\].*?\"([^\"]*)"));
665
+ var outputSheet = function (sheet) {
666
+ var tag = sheet.getTag();
667
+ var length = tag.length;
668
+ var css = '';
669
+ var _loop_1 = function (group) {
670
+ var id = getIdForGroup(group);
671
+ if (id === undefined)
672
+ return "continue";
673
+ var names = sheet.names.get(id);
674
+ var rules = tag.getGroup(group);
675
+ if (names === undefined || rules.length === 0)
676
+ return "continue";
677
+ var selector = "".concat(SC_ATTR, ".g").concat(group, "[id=\"").concat(id, "\"]");
678
+ var content = '';
679
+ if (names !== undefined) {
680
+ names.forEach(function (name) {
681
+ if (name.length > 0) {
682
+ content += "".concat(name, ",");
683
+ }
684
+ });
685
+ }
686
+ // NOTE: It's easier to collect rules and have the marker
687
+ // after the actual rules to simplify the rehydration
688
+ css += "".concat(rules).concat(selector, "{content:\"").concat(content, "\"}").concat(SPLITTER);
689
+ };
690
+ for (var group = 0; group < length; group++) {
691
+ _loop_1(group);
692
+ }
693
+ return css;
694
+ };
695
+ var rehydrateNamesFromContent = function (sheet, id, content) {
696
+ var names = content.split(',');
697
+ var name;
698
+ for (var i = 0, l = names.length; i < l; i++) {
699
+ // eslint-disable-next-line
700
+ if ((name = names[i])) {
701
+ sheet.registerName(id, name);
702
+ }
703
+ }
704
+ };
705
+ var rehydrateSheetFromTag = function (sheet, style) {
706
+ var _a;
707
+ var parts = ((_a = style.textContent) !== null && _a !== void 0 ? _a : '').split(SPLITTER);
708
+ var rules = [];
709
+ for (var i = 0, l = parts.length; i < l; i++) {
710
+ var part = parts[i].trim();
711
+ if (!part)
712
+ continue;
713
+ var marker = part.match(MARKER_RE);
714
+ if (marker) {
715
+ var group = parseInt(marker[1], 10) | 0;
716
+ var id = marker[2];
717
+ if (group !== 0) {
718
+ // Rehydrate componentId to group index mapping
719
+ setGroupForId(id, group);
720
+ // Rehydrate names and rules
721
+ // looks like: data-styled.g11[id="idA"]{content:"nameA,"}
722
+ rehydrateNamesFromContent(sheet, id, marker[3]);
723
+ sheet.getTag().insertRules(group, rules);
724
+ }
725
+ rules.length = 0;
726
+ }
727
+ else {
728
+ rules.push(part);
729
+ }
730
+ }
731
+ };
732
+ var rehydrateSheet = function (sheet) {
733
+ var nodes = document.querySelectorAll(SELECTOR);
734
+ for (var i = 0, l = nodes.length; i < l; i++) {
735
+ var node = nodes[i];
736
+ if (node && node.getAttribute(SC_ATTR) !== SC_ATTR_ACTIVE) {
737
+ rehydrateSheetFromTag(sheet, node);
738
+ if (node.parentNode) {
739
+ node.parentNode.removeChild(node);
740
+ }
741
+ }
742
+ }
743
+ };
744
+
745
+ function getNonce() {
746
+ return typeof __webpack_nonce__ !== 'undefined' ? __webpack_nonce__ : null;
747
+ }
748
+
749
+ var ELEMENT_TYPE = 1;
750
+ /* Node.ELEMENT_TYPE */
751
+ /** Find last style element if any inside target */
752
+ var findLastStyleTag = function (target) {
753
+ var childNodes = target.childNodes;
754
+ for (var i = childNodes.length; i >= 0; i--) {
755
+ var child = childNodes[i];
756
+ if (child && child.nodeType === ELEMENT_TYPE && child.hasAttribute(SC_ATTR)) {
757
+ return child;
758
+ }
759
+ }
760
+ return undefined;
761
+ };
762
+ /** Create a style element inside `target` or <head> after the last */
763
+ var makeStyleTag = function (target) {
764
+ var head = document.head;
765
+ var parent = target || head;
766
+ var style = document.createElement('style');
767
+ var prevStyle = findLastStyleTag(parent);
768
+ var nextSibling = prevStyle !== undefined ? prevStyle.nextSibling : null;
769
+ style.setAttribute(SC_ATTR, SC_ATTR_ACTIVE);
770
+ style.setAttribute(SC_ATTR_VERSION, SC_VERSION);
771
+ var nonce = getNonce();
772
+ if (nonce)
773
+ style.setAttribute('nonce', nonce);
774
+ parent.insertBefore(style, nextSibling);
775
+ return style;
776
+ };
777
+ /** Get the CSSStyleSheet instance for a given style element */
778
+ var getSheet = function (tag) {
779
+ if (tag.sheet) {
780
+ return tag.sheet;
781
+ }
782
+ // Avoid Firefox quirk where the style element might not have a sheet property
783
+ var styleSheets = document.styleSheets;
784
+ for (var i = 0, l = styleSheets.length; i < l; i++) {
785
+ var sheet = styleSheets[i];
786
+ if (sheet.ownerNode === tag) {
787
+ return sheet;
788
+ }
789
+ }
790
+ throw throwStyledComponentsError(17);
791
+ };
792
+
793
+ /** Create a CSSStyleSheet-like tag depending on the environment */
794
+ var makeTag = function (_a) {
795
+ var isServer = _a.isServer, useCSSOMInjection = _a.useCSSOMInjection, target = _a.target;
796
+ if (isServer) {
797
+ return new VirtualTag(target);
798
+ }
799
+ else if (useCSSOMInjection) {
800
+ return new CSSOMTag(target);
801
+ }
802
+ else {
803
+ return new TextTag(target);
804
+ }
805
+ };
806
+ var CSSOMTag = /** @class */ (function () {
807
+ function CSSOMTag(target) {
808
+ var element = (this.element = makeStyleTag(target));
809
+ // Avoid Edge bug where empty style elements don't create sheets
810
+ element.appendChild(document.createTextNode(''));
811
+ this.sheet = getSheet(element);
812
+ this.length = 0;
813
+ }
814
+ CSSOMTag.prototype.insertRule = function (index, rule) {
815
+ try {
816
+ this.sheet.insertRule(rule, index);
817
+ this.length++;
818
+ return true;
819
+ }
820
+ catch (_error) {
821
+ return false;
822
+ }
823
+ };
824
+ CSSOMTag.prototype.deleteRule = function (index) {
825
+ this.sheet.deleteRule(index);
826
+ this.length--;
827
+ };
828
+ CSSOMTag.prototype.getRule = function (index) {
829
+ var rule = this.sheet.cssRules[index];
830
+ // Avoid IE11 quirk where cssText is inaccessible on some invalid rules
831
+ if (rule !== undefined && typeof rule.cssText === 'string') {
832
+ return rule.cssText;
833
+ }
834
+ else {
835
+ return '';
836
+ }
837
+ };
838
+ return CSSOMTag;
839
+ }());
840
+ /** A Tag that emulates the CSSStyleSheet API but uses text nodes */
841
+ var TextTag = /** @class */ (function () {
842
+ function TextTag(target) {
843
+ var element = (this.element = makeStyleTag(target));
844
+ this.nodes = element.childNodes;
845
+ this.length = 0;
846
+ }
847
+ TextTag.prototype.insertRule = function (index, rule) {
848
+ if (index <= this.length && index >= 0) {
849
+ var node = document.createTextNode(rule);
850
+ var refNode = this.nodes[index];
851
+ this.element.insertBefore(node, refNode || null);
852
+ this.length++;
853
+ return true;
854
+ }
855
+ else {
856
+ return false;
857
+ }
858
+ };
859
+ TextTag.prototype.deleteRule = function (index) {
860
+ this.element.removeChild(this.nodes[index]);
861
+ this.length--;
862
+ };
863
+ TextTag.prototype.getRule = function (index) {
864
+ if (index < this.length) {
865
+ return this.nodes[index].textContent;
866
+ }
867
+ else {
868
+ return '';
869
+ }
870
+ };
871
+ return TextTag;
872
+ }());
873
+ /** A completely virtual (server-side) Tag that doesn't manipulate the DOM */
874
+ var VirtualTag = /** @class */ (function () {
875
+ function VirtualTag(_target) {
876
+ this.rules = [];
877
+ this.length = 0;
878
+ }
879
+ VirtualTag.prototype.insertRule = function (index, rule) {
880
+ if (index <= this.length) {
881
+ this.rules.splice(index, 0, rule);
882
+ this.length++;
883
+ return true;
884
+ }
885
+ else {
886
+ return false;
887
+ }
888
+ };
889
+ VirtualTag.prototype.deleteRule = function (index) {
890
+ this.rules.splice(index, 1);
891
+ this.length--;
892
+ };
893
+ VirtualTag.prototype.getRule = function (index) {
894
+ if (index < this.length) {
895
+ return this.rules[index];
896
+ }
897
+ else {
898
+ return '';
899
+ }
900
+ };
901
+ return VirtualTag;
902
+ }());
903
+
904
+ var SHOULD_REHYDRATE = IS_BROWSER;
905
+ var defaultOptions = {
906
+ isServer: !IS_BROWSER,
907
+ useCSSOMInjection: !DISABLE_SPEEDY,
908
+ };
909
+ /** Contains the main stylesheet logic for stringification and caching */
910
+ var StyleSheet = /** @class */ (function () {
911
+ function StyleSheet(options, globalStyles, names) {
912
+ if (options === void 0) { options = EMPTY_OBJECT; }
913
+ if (globalStyles === void 0) { globalStyles = {}; }
914
+ this.options = tslib.__assign(tslib.__assign({}, defaultOptions), options);
915
+ this.gs = globalStyles;
916
+ this.names = new Map(names);
917
+ this.server = !!options.isServer;
918
+ // We rehydrate only once and use the sheet that is created first
919
+ if (!this.server && IS_BROWSER && SHOULD_REHYDRATE) {
920
+ SHOULD_REHYDRATE = false;
921
+ rehydrateSheet(this);
922
+ }
923
+ }
924
+ /** Register a group ID to give it an index */
925
+ StyleSheet.registerId = function (id) {
926
+ return getGroupForId(id);
927
+ };
928
+ StyleSheet.prototype.reconstructWithOptions = function (options, withNames) {
929
+ if (withNames === void 0) { withNames = true; }
930
+ return new StyleSheet(tslib.__assign(tslib.__assign({}, this.options), options), this.gs, (withNames && this.names) || undefined);
931
+ };
932
+ StyleSheet.prototype.allocateGSInstance = function (id) {
933
+ return (this.gs[id] = (this.gs[id] || 0) + 1);
934
+ };
935
+ /** Lazily initialises a GroupedTag for when it's actually needed */
936
+ StyleSheet.prototype.getTag = function () {
937
+ return this.tag || (this.tag = makeGroupedTag(makeTag(this.options)));
938
+ };
939
+ /** Check whether a name is known for caching */
940
+ StyleSheet.prototype.hasNameForId = function (id, name) {
941
+ return this.names.has(id) && this.names.get(id).has(name);
942
+ };
943
+ /** Mark a group's name as known for caching */
944
+ StyleSheet.prototype.registerName = function (id, name) {
945
+ getGroupForId(id);
946
+ if (!this.names.has(id)) {
947
+ var groupNames = new Set();
948
+ groupNames.add(name);
949
+ this.names.set(id, groupNames);
950
+ }
951
+ else {
952
+ this.names.get(id).add(name);
953
+ }
954
+ };
955
+ /** Insert new rules which also marks the name as known */
956
+ StyleSheet.prototype.insertRules = function (id, name, rules) {
957
+ this.registerName(id, name);
958
+ this.getTag().insertRules(getGroupForId(id), rules);
959
+ };
960
+ /** Clears all cached names for a given group ID */
961
+ StyleSheet.prototype.clearNames = function (id) {
962
+ if (this.names.has(id)) {
963
+ this.names.get(id).clear();
964
+ }
965
+ };
966
+ /** Clears all rules for a given group ID */
967
+ StyleSheet.prototype.clearRules = function (id) {
968
+ this.getTag().clearGroup(getGroupForId(id));
969
+ this.clearNames(id);
970
+ };
971
+ /** Clears the entire tag which deletes all rules but not its names */
972
+ StyleSheet.prototype.clearTag = function () {
973
+ // NOTE: This does not clear the names, since it's only used during SSR
974
+ // so that we can continuously output only new rules
975
+ this.tag = undefined;
976
+ };
977
+ /** Outputs the current sheet as a CSS string with markers for SSR */
978
+ StyleSheet.prototype.toString = function () {
979
+ return outputSheet(this);
980
+ };
981
+ return StyleSheet;
982
+ }());
983
+
984
+ var COMMENT_REGEX = /^\s*\/\/.*$/gm;
985
+ var COMPLEX_SELECTOR_PREFIX = [':', '[', '.', '#'];
986
+ /**
987
+ * Serialize stylis output as an array of css strings. It is important that rules are
988
+ * separated when using CSSOM injection.
989
+ */
990
+ function serialize(children, callback) {
991
+ return children.map(function (c, i) { return callback(c, i, children, callback); }).filter(Boolean);
992
+ }
993
+ function createStylisInstance(_a) {
994
+ 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;
995
+ var _componentId;
996
+ var _selector;
997
+ var _selectorRegexp;
998
+ var _consecutiveSelfRefRegExp;
999
+ var selfReferenceReplacer = function (match, offset, string) {
1000
+ if (
1001
+ // do not replace the first occurrence if it is complex (has a modifier)
1002
+ (offset === 0 ? !COMPLEX_SELECTOR_PREFIX.includes(string[_selector.length]) : true) && // no consecutive self refs (.b.b); that is a precedence boost and treated differently
1003
+ !string.match(_consecutiveSelfRefRegExp)) {
1004
+ return ".".concat(_componentId);
1005
+ }
1006
+ return match;
1007
+ };
1008
+ /**
1009
+ * When writing a style like
1010
+ *
1011
+ * & + & {
1012
+ * color: red;
1013
+ * }
1014
+ *
1015
+ * The second ampersand should be a reference to the static component class. stylis
1016
+ * has no knowledge of static class so we have to intelligently replace the base selector.
1017
+ *
1018
+ * https://github.com/thysultan/stylis.js/tree/v4.0.2#abstract-syntax-structure
1019
+ */
1020
+ var selfReferenceReplacementPlugin = function (element) {
1021
+ if (element.type === stylis.RULESET && element.value.includes('&')) {
1022
+ var props = element.props;
1023
+ props[0] = props[0].replace(_selectorRegexp, selfReferenceReplacer);
1024
+ }
1025
+ };
1026
+ var stringifyRules = function (css, selector, prefix, componentId) {
1027
+ if (selector === void 0) { selector = ''; }
1028
+ if (prefix === void 0) { prefix = ''; }
1029
+ if (componentId === void 0) { componentId = '&'; }
1030
+ var flatCSS = css.replace(COMMENT_REGEX, '');
1031
+ // stylis has no concept of state to be passed to plugins
1032
+ // but since JS is single-threaded, we can rely on that to ensure
1033
+ // these properties stay in sync with the current stylis run
1034
+ _componentId = componentId;
1035
+ _selector = selector;
1036
+ _selectorRegexp = new RegExp("\\".concat(_selector, "\\b"), 'g');
1037
+ _consecutiveSelfRefRegExp = new RegExp("(\\".concat(_selector, "\\b){2,}"));
1038
+ var middlewares = plugins.slice();
1039
+ if (options.prefix || options.prefix === undefined) {
1040
+ middlewares.unshift(stylis.prefixer);
1041
+ }
1042
+ middlewares.push(selfReferenceReplacementPlugin, stylis.stringify);
1043
+ return serialize(stylis.compile(prefix || selector ? "".concat(prefix, " ").concat(selector, " { ").concat(flatCSS, " }") : flatCSS), stylis.middleware(middlewares));
1044
+ };
1045
+ stringifyRules.hash = plugins.length
1046
+ ? plugins
1047
+ .reduce(function (acc, plugin) {
1048
+ if (!plugin.name) {
1049
+ throwStyledComponentsError(15);
1050
+ }
1051
+ return phash(acc, plugin.name);
1052
+ }, SEED$1)
1053
+ .toString()
1054
+ : '';
1055
+ return stringifyRules;
1056
+ }
1057
+
1058
+ var StyleSheetContext = React__default["default"].createContext(undefined);
1059
+ var StyleSheetConsumer = StyleSheetContext.Consumer;
1060
+ var StylisContext = React__default["default"].createContext(undefined);
1061
+ StylisContext.Consumer;
1062
+ var mainSheet = new StyleSheet();
1063
+ var mainStylis = createStylisInstance();
1064
+ function useStyleSheet() {
1065
+ return React.useContext(StyleSheetContext) || mainSheet;
1066
+ }
1067
+ function useStylis() {
1068
+ return React.useContext(StylisContext) || mainStylis;
1069
+ }
1070
+ function StyleSheetManager(props) {
1071
+ var _a = React.useState(props.stylisPlugins), plugins = _a[0], setPlugins = _a[1];
1072
+ var contextStyleSheet = useStyleSheet();
1073
+ var styleSheet = React.useMemo(function () {
1074
+ var sheet = contextStyleSheet;
1075
+ if (props.sheet) {
1076
+ // eslint-disable-next-line prefer-destructuring
1077
+ sheet = props.sheet;
1078
+ }
1079
+ else if (props.target) {
1080
+ sheet = sheet.reconstructWithOptions({ target: props.target }, false);
1081
+ }
1082
+ if (props.disableCSSOMInjection) {
1083
+ sheet = sheet.reconstructWithOptions({ useCSSOMInjection: false });
1084
+ }
1085
+ return sheet;
1086
+ }, [props.disableCSSOMInjection, props.sheet, props.target]);
1087
+ var stylis = React.useMemo(function () {
1088
+ return createStylisInstance({
1089
+ options: { prefix: !props.disableVendorPrefixes },
1090
+ plugins: plugins,
1091
+ });
1092
+ }, [props.disableVendorPrefixes, plugins]);
1093
+ React.useEffect(function () {
1094
+ if (!shallowequal__default["default"](plugins, props.stylisPlugins))
1095
+ setPlugins(props.stylisPlugins);
1096
+ }, [props.stylisPlugins]);
1097
+ return (React__default["default"].createElement(StyleSheetContext.Provider, { value: styleSheet },
1098
+ React__default["default"].createElement(StylisContext.Provider, { value: stylis }, process.env.NODE_ENV !== 'production'
1099
+ ? React__default["default"].Children.only(props.children)
1100
+ : props.children)));
1101
+ }
1102
+
1103
+ var Keyframes = /** @class */ (function () {
1104
+ function Keyframes(name, rules) {
1105
+ var _this = this;
1106
+ this.inject = function (styleSheet, stylisInstance) {
1107
+ if (stylisInstance === void 0) { stylisInstance = mainStylis; }
1108
+ var resolvedName = _this.name + stylisInstance.hash;
1109
+ if (!styleSheet.hasNameForId(_this.id, resolvedName)) {
1110
+ styleSheet.insertRules(_this.id, resolvedName, stylisInstance(_this.rules, resolvedName, '@keyframes'));
1111
+ }
1112
+ };
1113
+ this.toString = function () {
1114
+ throw throwStyledComponentsError(12, String(_this.name));
1115
+ };
1116
+ this.name = name;
1117
+ this.id = "sc-keyframes-".concat(name);
1118
+ this.rules = rules;
1119
+ }
1120
+ Keyframes.prototype.getName = function (stylisInstance) {
1121
+ if (stylisInstance === void 0) { stylisInstance = mainStylis; }
1122
+ return this.name + stylisInstance.hash;
1123
+ };
1124
+ return Keyframes;
1125
+ }());
1126
+
1127
+ // Taken from https://github.com/facebook/react/blob/b87aabdfe1b7461e7331abb3601d9e6bb27544bc/packages/react-dom/src/shared/dangerousStyleValue.js
1128
+ function addUnitIfNeeded(name, value) {
1129
+ // https://github.com/amilajack/eslint-plugin-flowtype-errors/issues/133
1130
+ if (value == null || typeof value === 'boolean' || value === '') {
1131
+ return '';
1132
+ }
1133
+ if (typeof value === 'number' && value !== 0 && !(name in unitless__default["default"])) {
1134
+ return "".concat(value, "px"); // Presumes implicit 'px' suffix for unitless numbers
1135
+ }
1136
+ return String(value).trim();
1137
+ }
1138
+
1139
+ /**
1140
+ * inlined version of
1141
+ * https://github.com/facebook/fbjs/blob/master/packages/fbjs/src/core/hyphenateStyleName.js
1142
+ */
1143
+ var uppercaseCheck = /([A-Z])/;
1144
+ var uppercasePattern = /([A-Z])/g;
1145
+ var msPattern = /^ms-/;
1146
+ var prefixAndLowerCase = function (char) { return "-".concat(char.toLowerCase()); };
1147
+ /**
1148
+ * Hyphenates a camelcased CSS property name, for example:
1149
+ *
1150
+ * > hyphenateStyleName('backgroundColor')
1151
+ * < "background-color"
1152
+ * > hyphenateStyleName('MozTransition')
1153
+ * < "-moz-transition"
1154
+ * > hyphenateStyleName('msTransition')
1155
+ * < "-ms-transition"
1156
+ *
1157
+ * As Modernizr suggests (http://modernizr.com/docs/#prefixed), an `ms` prefix
1158
+ * is converted to `-ms-`.
1159
+ */
1160
+ function hyphenateStyleName(string) {
1161
+ return uppercaseCheck.test(string)
1162
+ ? string.replace(uppercasePattern, prefixAndLowerCase).replace(msPattern, '-ms-')
1163
+ : string;
1164
+ }
1165
+
1166
+ function isFunction(test) {
1167
+ return typeof test === 'function';
1168
+ }
1169
+
1170
+ function isStatelessFunction(test) {
1171
+ return typeof test === 'function' && !(test.prototype && test.prototype.isReactComponent);
1172
+ }
1173
+
1174
+ /**
1175
+ * It's falsish not falsy because 0 is allowed.
1176
+ */
1177
+ var isFalsish = function (chunk) {
1178
+ return chunk === undefined || chunk === null || chunk === false || chunk === '';
1179
+ };
1180
+ var objToCssArray = function (obj, prevKey) {
1181
+ var rules = [];
1182
+ for (var key in obj) {
1183
+ if (!obj.hasOwnProperty(key) || isFalsish(obj[key]))
1184
+ continue;
1185
+ if ((Array.isArray(obj[key]) && obj[key].isCss) || isFunction(obj[key])) {
1186
+ rules.push("".concat(hyphenateStyleName(key), ":"), obj[key], ';');
1187
+ }
1188
+ else if (isPlainObject(obj[key])) {
1189
+ rules.push.apply(rules, objToCssArray(obj[key], key));
1190
+ }
1191
+ else {
1192
+ rules.push("".concat(hyphenateStyleName(key), ": ").concat(addUnitIfNeeded(key, obj[key]), ";"));
1193
+ }
1194
+ }
1195
+ return prevKey ? tslib.__spreadArray(tslib.__spreadArray(["".concat(prevKey, " {")], rules, true), ['}'], false) : rules;
1196
+ };
1197
+ function flatten(chunk, executionContext, styleSheet, stylisInstance) {
1198
+ if (Array.isArray(chunk)) {
1199
+ var ruleSet = [];
1200
+ for (var i = 0, len = chunk.length, result = void 0; i < len; i += 1) {
1201
+ result = flatten(chunk[i], executionContext, styleSheet, stylisInstance);
1202
+ if (result === '')
1203
+ continue;
1204
+ else if (Array.isArray(result))
1205
+ ruleSet.push.apply(ruleSet, result);
1206
+ else
1207
+ ruleSet.push(result);
1208
+ }
1209
+ return ruleSet;
1210
+ }
1211
+ if (isFalsish(chunk)) {
1212
+ return '';
1213
+ }
1214
+ /* Handle other components */
1215
+ if (isStyledComponent(chunk)) {
1216
+ return ".".concat(chunk.styledComponentId);
1217
+ }
1218
+ /* Either execute or defer the function */
1219
+ if (isFunction(chunk)) {
1220
+ if (isStatelessFunction(chunk) && executionContext) {
1221
+ var chunkFn = chunk;
1222
+ var result = chunkFn(executionContext);
1223
+ if (process.env.NODE_ENV !== 'production' &&
1224
+ typeof result === 'object' &&
1225
+ !Array.isArray(result) &&
1226
+ !(result instanceof Keyframes) &&
1227
+ !isPlainObject(result)) {
1228
+ // eslint-disable-next-line no-console
1229
+ 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."));
1230
+ }
1231
+ return flatten(result, executionContext, styleSheet, stylisInstance);
1232
+ }
1233
+ else
1234
+ return chunk;
1235
+ }
1236
+ if (chunk instanceof Keyframes) {
1237
+ if (styleSheet) {
1238
+ chunk.inject(styleSheet, stylisInstance);
1239
+ return chunk.getName(stylisInstance);
1240
+ }
1241
+ else
1242
+ return chunk;
1243
+ }
1244
+ /* Handle objects */
1245
+ return isPlainObject(chunk) ? objToCssArray(chunk) : chunk.toString();
1246
+ }
1247
+
1248
+ function isStaticRules(rules) {
1249
+ for (var i = 0; i < rules.length; i += 1) {
1250
+ var rule = rules[i];
1251
+ if (isFunction(rule) &&
1252
+ !isStyledComponent(rule)) {
1253
+ // functions are allowed to be static if they're just being
1254
+ // used to get the classname of a nested styled component
1255
+ return false;
1256
+ }
1257
+ }
1258
+ return true;
1259
+ }
1260
+
1261
+ var SEED = hash(SC_VERSION);
1262
+ /**
1263
+ * ComponentStyle is all the CSS-specific stuff, not the React-specific stuff.
1264
+ */
1265
+ var ComponentStyle = /** @class */ (function () {
1266
+ function ComponentStyle(rules, componentId, baseStyle) {
1267
+ this.names = [];
1268
+ this.rules = rules;
1269
+ this.staticRulesId = '';
1270
+ this.isStatic =
1271
+ process.env.NODE_ENV === 'production' &&
1272
+ (baseStyle === undefined || baseStyle.isStatic) &&
1273
+ isStaticRules(rules);
1274
+ this.componentId = componentId;
1275
+ // SC_VERSION gives us isolation between multiple runtimes on the page at once
1276
+ // this is improved further with use of the babel plugin "namespace" feature
1277
+ this.baseHash = phash(SEED, componentId);
1278
+ this.baseStyle = baseStyle;
1279
+ // NOTE: This registers the componentId, which ensures a consistent order
1280
+ // for this component's styles compared to others
1281
+ StyleSheet.registerId(componentId);
1282
+ }
1283
+ /*
1284
+ * Flattens a rule set into valid CSS
1285
+ * Hashes it, wraps the whole chunk in a .hash1234 {}
1286
+ * Returns the hash to be injected on render()
1287
+ * */
1288
+ ComponentStyle.prototype.generateAndInjectStyles = function (executionContext, styleSheet, stylis) {
1289
+ var componentId = this.componentId;
1290
+ this.names.length = 0;
1291
+ if (this.baseStyle) {
1292
+ this.names.push(this.baseStyle.generateAndInjectStyles(executionContext, styleSheet, stylis));
1293
+ }
1294
+ // force dynamic classnames if user-supplied stylis plugins are in use
1295
+ if (this.isStatic && !stylis.hash) {
1296
+ if (this.staticRulesId && styleSheet.hasNameForId(componentId, this.staticRulesId)) {
1297
+ this.names.push(this.staticRulesId);
1298
+ }
1299
+ else {
1300
+ var cssStatic = flatten(this.rules, executionContext, styleSheet, stylis).join('');
1301
+ var name_1 = generateAlphabeticName(phash(this.baseHash, cssStatic) >>> 0);
1302
+ if (!styleSheet.hasNameForId(componentId, name_1)) {
1303
+ var cssStaticFormatted = stylis(cssStatic, ".".concat(name_1), undefined, componentId);
1304
+ styleSheet.insertRules(componentId, name_1, cssStaticFormatted);
1305
+ }
1306
+ this.names.push(name_1);
1307
+ this.staticRulesId = name_1;
1308
+ }
1309
+ }
1310
+ else {
1311
+ var length_1 = this.rules.length;
1312
+ var dynamicHash = phash(this.baseHash, stylis.hash);
1313
+ var css = '';
1314
+ for (var i = 0; i < length_1; i++) {
1315
+ var partRule = this.rules[i];
1316
+ if (typeof partRule === 'string') {
1317
+ css += partRule;
1318
+ if (process.env.NODE_ENV !== 'production')
1319
+ dynamicHash = phash(dynamicHash, partRule);
1320
+ }
1321
+ else if (partRule) {
1322
+ var partChunk = flatten(partRule, executionContext, styleSheet, stylis);
1323
+ var partString = Array.isArray(partChunk) ? partChunk.join('') : partChunk;
1324
+ dynamicHash = phash(dynamicHash, partString);
1325
+ css += partString;
1326
+ }
1327
+ }
1328
+ if (css) {
1329
+ var name_2 = generateAlphabeticName(dynamicHash >>> 0);
1330
+ if (!styleSheet.hasNameForId(componentId, name_2)) {
1331
+ var cssFormatted = stylis(css, ".".concat(name_2), undefined, componentId);
1332
+ styleSheet.insertRules(componentId, name_2, cssFormatted);
1333
+ }
1334
+ this.names.push(name_2);
1335
+ }
1336
+ }
1337
+ return this.names.join(' ');
1338
+ };
1339
+ return ComponentStyle;
1340
+ }());
1341
+
1342
+ var ThemeContext = React__default["default"].createContext(undefined);
1343
+ var ThemeConsumer = ThemeContext.Consumer;
1344
+ function mergeTheme(theme, outerTheme) {
1345
+ if (!theme) {
1346
+ throw throwStyledComponentsError(14);
1347
+ }
1348
+ if (isFunction(theme)) {
1349
+ var themeFn = theme;
1350
+ var mergedTheme = themeFn(outerTheme);
1351
+ if (process.env.NODE_ENV !== 'production' &&
1352
+ (mergedTheme === null || Array.isArray(mergedTheme) || typeof mergedTheme !== 'object')) {
1353
+ throw throwStyledComponentsError(7);
1354
+ }
1355
+ return mergedTheme;
1356
+ }
1357
+ if (Array.isArray(theme) || typeof theme !== 'object') {
1358
+ throw throwStyledComponentsError(8);
1359
+ }
1360
+ return outerTheme ? tslib.__assign(tslib.__assign({}, outerTheme), theme) : theme;
1361
+ }
1362
+ /**
1363
+ * Provide a theme to an entire react component tree via context
1364
+ */
1365
+ function ThemeProvider(props) {
1366
+ var outerTheme = React.useContext(ThemeContext);
1367
+ var themeContext = React.useMemo(function () { return mergeTheme(props.theme, outerTheme); }, [props.theme, outerTheme]);
1368
+ if (!props.children) {
1369
+ return null;
1370
+ }
1371
+ return React__default["default"].createElement(ThemeContext.Provider, { value: themeContext }, props.children);
1372
+ }
1373
+
1374
+ var identifiers = {};
1375
+ /* We depend on components having unique IDs */
1376
+ function generateId(displayName, parentComponentId) {
1377
+ var name = typeof displayName !== 'string' ? 'sc' : escape(displayName);
1378
+ // Ensure that no displayName can lead to duplicate componentIds
1379
+ identifiers[name] = (identifiers[name] || 0) + 1;
1380
+ var componentId = "".concat(name, "-").concat(generateComponentId(
1381
+ // SC_VERSION gives us isolation between multiple runtimes on the page at once
1382
+ // this is improved further with use of the babel plugin "namespace" feature
1383
+ SC_VERSION + name + identifiers[name]));
1384
+ return parentComponentId ? "".concat(parentComponentId, "-").concat(componentId) : componentId;
1385
+ }
1386
+ function useResolvedAttrs(theme, props, attrs) {
1387
+ if (theme === void 0) { theme = EMPTY_OBJECT; }
1388
+ // NOTE: can't memoize this
1389
+ // returns [context, resolvedAttrs]
1390
+ // where resolvedAttrs is only the things injected by the attrs themselves
1391
+ var context = tslib.__assign(tslib.__assign({}, props), { theme: theme });
1392
+ attrs.forEach(function (attrDef) {
1393
+ // @ts-expect-error narrowing isn't working properly for some reason
1394
+ var resolvedAttrDef = typeof attrDef === 'function' ? attrDef(context) : attrDef;
1395
+ var key;
1396
+ /* eslint-disable guard-for-in */
1397
+ for (key in resolvedAttrDef) {
1398
+ // @ts-expect-error bad types
1399
+ context[key] =
1400
+ key === 'className'
1401
+ ? joinStrings(context[key], resolvedAttrDef[key])
1402
+ : key === 'style'
1403
+ ? tslib.__assign(tslib.__assign({}, context[key]), resolvedAttrDef[key]) : resolvedAttrDef[key];
1404
+ }
1405
+ /* eslint-enable guard-for-in */
1406
+ });
1407
+ return context;
1408
+ }
1409
+ function useInjectedStyle(componentStyle, isStatic, resolvedAttrs, warnTooManyClasses) {
1410
+ var styleSheet = useStyleSheet();
1411
+ var stylis = useStylis();
1412
+ var className = isStatic
1413
+ ? componentStyle.generateAndInjectStyles(EMPTY_OBJECT, styleSheet, stylis)
1414
+ : componentStyle.generateAndInjectStyles(resolvedAttrs, styleSheet, stylis);
1415
+ // eslint-disable-next-line react-hooks/rules-of-hooks
1416
+ if (process.env.NODE_ENV !== 'production')
1417
+ React.useDebugValue(className);
1418
+ if (process.env.NODE_ENV !== 'production' && !isStatic && warnTooManyClasses) {
1419
+ warnTooManyClasses(className);
1420
+ }
1421
+ return className;
1422
+ }
1423
+ function useStyledComponentImpl(forwardedComponent, props, forwardedRef, isStatic) {
1424
+ var componentAttrs = forwardedComponent.attrs, componentStyle = forwardedComponent.componentStyle, defaultProps = forwardedComponent.defaultProps, foldedComponentIds = forwardedComponent.foldedComponentIds, shouldForwardProp = forwardedComponent.shouldForwardProp, styledComponentId = forwardedComponent.styledComponentId, target = forwardedComponent.target;
1425
+ // eslint-disable-next-line react-hooks/rules-of-hooks
1426
+ if (process.env.NODE_ENV !== 'production')
1427
+ React.useDebugValue(styledComponentId);
1428
+ // NOTE: the non-hooks version only subscribes to this when !componentStyle.isStatic,
1429
+ // but that'd be against the rules-of-hooks. We could be naughty and do it anyway as it
1430
+ // should be an immutable value, but behave for now.
1431
+ var theme = determineTheme(props, React.useContext(ThemeContext), defaultProps);
1432
+ var context = useResolvedAttrs(theme || EMPTY_OBJECT, props, componentAttrs);
1433
+ var generatedClassName = useInjectedStyle(componentStyle, isStatic, context, process.env.NODE_ENV !== 'production' ? forwardedComponent.warnTooManyClasses : undefined);
1434
+ var refToForward = forwardedRef;
1435
+ var elementToBeCreated = context.$as || context.as || target;
1436
+ var isTargetTag = isTag(elementToBeCreated);
1437
+ var propsForElement = {};
1438
+ // eslint-disable-next-line guard-for-in
1439
+ for (var key in context) {
1440
+ if (key[0] === '$' || key === 'as' || key === 'theme')
1441
+ continue;
1442
+ else if (key === 'forwardedAs') {
1443
+ propsForElement.as = context[key];
1444
+ }
1445
+ else if (shouldForwardProp ? shouldForwardProp(key, elementToBeCreated) : true) {
1446
+ // Don't pass through non HTML tags through to HTML elements
1447
+ propsForElement[key] = context[key];
1448
+ }
1449
+ }
1450
+ propsForElement[
1451
+ // handle custom elements which React doesn't properly alias
1452
+ isTargetTag &&
1453
+ domElements.indexOf(elementToBeCreated) === -1
1454
+ ? 'class'
1455
+ : 'className'] = foldedComponentIds
1456
+ .concat(styledComponentId, (generatedClassName !== styledComponentId ? generatedClassName : null), context.className)
1457
+ .filter(Boolean)
1458
+ .join(' ');
1459
+ propsForElement.ref = refToForward;
1460
+ return React.createElement(elementToBeCreated, propsForElement);
1461
+ }
1462
+ function createStyledComponent(target, options, rules) {
1463
+ var isTargetStyledComp = isStyledComponent(target);
1464
+ var styledComponentTarget = target;
1465
+ var isCompositeComponent = !isTag(target);
1466
+ var _a = options.attrs, attrs = _a === void 0 ? EMPTY_ARRAY : _a, _b = options.componentId, componentId = _b === void 0 ? generateId(options.displayName, options.parentComponentId) : _b, _c = options.displayName, displayName = _c === void 0 ? generateDisplayName(target) : _c;
1467
+ var styledComponentId = options.displayName && options.componentId
1468
+ ? "".concat(escape(options.displayName), "-").concat(options.componentId)
1469
+ : options.componentId || componentId;
1470
+ // fold the underlying StyledComponent attrs up (implicit extend)
1471
+ var finalAttrs = isTargetStyledComp && styledComponentTarget.attrs
1472
+ ? styledComponentTarget.attrs.concat(attrs).filter(Boolean)
1473
+ : attrs;
1474
+ var shouldForwardProp = options.shouldForwardProp;
1475
+ if (isTargetStyledComp && styledComponentTarget.shouldForwardProp) {
1476
+ var shouldForwardPropFn_1 = styledComponentTarget.shouldForwardProp;
1477
+ if (options.shouldForwardProp) {
1478
+ var passedShouldForwardPropFn_1 = options.shouldForwardProp;
1479
+ // compose nested shouldForwardProp calls
1480
+ shouldForwardProp = function (prop, elementToBeCreated) {
1481
+ return shouldForwardPropFn_1(prop, elementToBeCreated) &&
1482
+ passedShouldForwardPropFn_1(prop, elementToBeCreated);
1483
+ };
1484
+ }
1485
+ else {
1486
+ shouldForwardProp = shouldForwardPropFn_1;
1487
+ }
1488
+ }
1489
+ var componentStyle = new ComponentStyle(rules, styledComponentId, isTargetStyledComp ? styledComponentTarget.componentStyle : undefined);
1490
+ // statically styled-components don't need to build an execution context object,
1491
+ // and shouldn't be increasing the number of class names
1492
+ var isStatic = componentStyle.isStatic && attrs.length === 0;
1493
+ function forwardRef(props, ref) {
1494
+ // eslint-disable-next-line
1495
+ return useStyledComponentImpl(WrappedStyledComponent, props, ref, isStatic);
1496
+ }
1497
+ forwardRef.displayName = displayName;
1498
+ /**
1499
+ * forwardRef creates a new interim component, which we'll take advantage of
1500
+ * instead of extending ParentComponent to create _another_ interim class
1501
+ */
1502
+ var WrappedStyledComponent = React__default["default"].forwardRef(forwardRef);
1503
+ WrappedStyledComponent.attrs = finalAttrs;
1504
+ WrappedStyledComponent.componentStyle = componentStyle;
1505
+ WrappedStyledComponent.displayName = displayName;
1506
+ WrappedStyledComponent.shouldForwardProp = shouldForwardProp;
1507
+ // this static is used to preserve the cascade of static classes for component selector
1508
+ // purposes; this is especially important with usage of the css prop
1509
+ WrappedStyledComponent.foldedComponentIds = isTargetStyledComp
1510
+ ? styledComponentTarget.foldedComponentIds.concat(styledComponentTarget.styledComponentId)
1511
+ : EMPTY_ARRAY;
1512
+ WrappedStyledComponent.styledComponentId = styledComponentId;
1513
+ // fold the underlying StyledComponent target up since we folded the styles
1514
+ WrappedStyledComponent.target = isTargetStyledComp ? styledComponentTarget.target : target;
1515
+ WrappedStyledComponent.withComponent = function withComponent(tag) {
1516
+ var previousComponentId = options.componentId, optionsToCopy = tslib.__rest(options, ["componentId"]);
1517
+ var newComponentId = previousComponentId &&
1518
+ "".concat(previousComponentId, "-").concat(isTag(tag) ? tag : escape(getComponentName(tag)));
1519
+ var newOptions = tslib.__assign(tslib.__assign({}, optionsToCopy), { attrs: finalAttrs, componentId: newComponentId });
1520
+ return createStyledComponent(tag, newOptions, rules);
1521
+ };
1522
+ Object.defineProperty(WrappedStyledComponent, 'defaultProps', {
1523
+ get: function () {
1524
+ return this._foldedDefaultProps;
1525
+ },
1526
+ set: function (obj) {
1527
+ this._foldedDefaultProps = isTargetStyledComp
1528
+ ? mixinDeep({}, styledComponentTarget.defaultProps, obj)
1529
+ : obj;
1530
+ },
1531
+ });
1532
+ if (process.env.NODE_ENV !== 'production') {
1533
+ checkDynamicCreation(displayName, styledComponentId);
1534
+ WrappedStyledComponent.warnTooManyClasses = createWarnTooManyClasses(displayName, styledComponentId);
1535
+ }
1536
+ WrappedStyledComponent.toString = function () { return ".".concat(WrappedStyledComponent.styledComponentId); };
1537
+ if (isCompositeComponent) {
1538
+ var compositeComponentTarget = target;
1539
+ hoistNonReactStatics(WrappedStyledComponent, compositeComponentTarget, {
1540
+ // all SC-specific things should not be hoisted
1541
+ attrs: true,
1542
+ componentStyle: true,
1543
+ displayName: true,
1544
+ foldedComponentIds: true,
1545
+ shouldForwardProp: true,
1546
+ styledComponentId: true,
1547
+ target: true,
1548
+ withComponent: true,
1549
+ });
1550
+ }
1551
+ return WrappedStyledComponent;
1552
+ }
1553
+
1554
+ function interleave(strings, interpolations) {
1555
+ var result = [strings[0]];
1556
+ for (var i = 0, len = interpolations.length; i < len; i += 1) {
1557
+ result.push(interpolations[i], strings[i + 1]);
1558
+ }
1559
+ return result;
1560
+ }
1561
+
1562
+ /**
1563
+ * Used when flattening object styles to determine if we should
1564
+ * expand an array of styles.
1565
+ */
1566
+ var addTag = function (arg) {
1567
+ if (Array.isArray(arg)) {
1568
+ // eslint-disable-next-line no-param-reassign
1569
+ arg.isCss = true;
1570
+ }
1571
+ return arg;
1572
+ };
1573
+ function css(styles) {
1574
+ var interpolations = [];
1575
+ for (var _i = 1; _i < arguments.length; _i++) {
1576
+ interpolations[_i - 1] = arguments[_i];
1577
+ }
1578
+ if (isFunction(styles) || isPlainObject(styles)) {
1579
+ var styleFunctionOrObject = styles;
1580
+ return addTag(flatten(interleave(EMPTY_ARRAY, tslib.__spreadArray([
1581
+ styleFunctionOrObject
1582
+ ], interpolations, true))));
1583
+ }
1584
+ var styleStringArray = styles;
1585
+ if (interpolations.length === 0 &&
1586
+ styleStringArray.length === 1 &&
1587
+ typeof styleStringArray[0] === 'string') {
1588
+ return styleStringArray;
1589
+ }
1590
+ return addTag(flatten(interleave(styleStringArray, interpolations)));
1591
+ }
1592
+
1593
+ function constructWithOptions(componentConstructor, tag, options) {
1594
+ if (options === void 0) { options = EMPTY_OBJECT; }
1595
+ // We trust that the tag is a valid component as long as it isn't falsish
1596
+ // Typically the tag here is a string or function (i.e. class or pure function component)
1597
+ // However a component may also be an object if it uses another utility, e.g. React.memo
1598
+ // React will output an appropriate warning however if the `tag` isn't valid
1599
+ if (!tag) {
1600
+ throw throwStyledComponentsError(1, tag);
1601
+ }
1602
+ /* This is callable directly as a template function */
1603
+ var templateFunction = function (initialStyles) {
1604
+ var interpolations = [];
1605
+ for (var _i = 1; _i < arguments.length; _i++) {
1606
+ interpolations[_i - 1] = arguments[_i];
1607
+ }
1608
+ return componentConstructor(tag, options, css.apply(void 0, tslib.__spreadArray([initialStyles], interpolations, false)));
1609
+ };
1610
+ /* Modify/inject new props at runtime */
1611
+ templateFunction.attrs = function (attrs) {
1612
+ return constructWithOptions(componentConstructor, tag, tslib.__assign(tslib.__assign({}, options), { attrs: Array.prototype.concat(options.attrs, attrs).filter(Boolean) }));
1613
+ };
1614
+ /**
1615
+ * If config methods are called, wrap up a new template function and merge options */
1616
+ templateFunction.withConfig = function (config) {
1617
+ return constructWithOptions(componentConstructor, tag, tslib.__assign(tslib.__assign({}, options), config));
1618
+ };
1619
+ return templateFunction;
1620
+ }
1621
+
1622
+ var baseStyled = function (tag) {
1623
+ return constructWithOptions(createStyledComponent, tag);
1624
+ };
1625
+ var styled = baseStyled;
1626
+ // Shorthands for all valid HTML Elements
1627
+ domElements.forEach(function (domElement) {
1628
+ // @ts-expect-error someday they'll handle imperative assignment properly
1629
+ styled[domElement] = baseStyled(domElement);
1630
+ });
1631
+
1632
+ var GlobalStyle = /** @class */ (function () {
1633
+ function GlobalStyle(rules, componentId) {
1634
+ this.rules = rules;
1635
+ this.componentId = componentId;
1636
+ this.isStatic = isStaticRules(rules);
1637
+ // pre-register the first instance to ensure global styles
1638
+ // load before component ones
1639
+ StyleSheet.registerId(this.componentId + 1);
1640
+ }
1641
+ GlobalStyle.prototype.createStyles = function (instance, executionContext, styleSheet, stylis) {
1642
+ var flatCSS = flatten(this.rules, executionContext, styleSheet, stylis);
1643
+ var css = stylis(flatCSS.join(''), '');
1644
+ var id = this.componentId + instance;
1645
+ // NOTE: We use the id as a name as well, since these rules never change
1646
+ styleSheet.insertRules(id, id, css);
1647
+ };
1648
+ GlobalStyle.prototype.removeStyles = function (instance, styleSheet) {
1649
+ styleSheet.clearRules(this.componentId + instance);
1650
+ };
1651
+ GlobalStyle.prototype.renderStyles = function (instance, executionContext, styleSheet, stylis) {
1652
+ if (instance > 2)
1653
+ StyleSheet.registerId(this.componentId + instance);
1654
+ // NOTE: Remove old styles, then inject the new ones
1655
+ this.removeStyles(instance, styleSheet);
1656
+ this.createStyles(instance, executionContext, styleSheet, stylis);
1657
+ };
1658
+ return GlobalStyle;
1659
+ }());
1660
+
1661
+ function createGlobalStyle(strings) {
1662
+ var interpolations = [];
1663
+ for (var _i = 1; _i < arguments.length; _i++) {
1664
+ interpolations[_i - 1] = arguments[_i];
1665
+ }
1666
+ var rules = css.apply(void 0, tslib.__spreadArray([strings], interpolations, false));
1667
+ var styledComponentId = "sc-global-".concat(generateComponentId(JSON.stringify(rules)));
1668
+ var globalStyle = new GlobalStyle(rules, styledComponentId);
1669
+ if (process.env.NODE_ENV !== 'production') {
1670
+ checkDynamicCreation(styledComponentId);
1671
+ }
1672
+ var GlobalStyleComponent = function (props) {
1673
+ var styleSheet = useStyleSheet();
1674
+ var stylis = useStylis();
1675
+ var theme = React__default["default"].useContext(ThemeContext);
1676
+ var instanceRef = React__default["default"].useRef(styleSheet.allocateGSInstance(styledComponentId));
1677
+ var instance = instanceRef.current;
1678
+ if (process.env.NODE_ENV !== 'production' && React__default["default"].Children.count(props.children)) {
1679
+ // eslint-disable-next-line no-console
1680
+ console.warn("The global style component ".concat(styledComponentId, " was given child JSX. createGlobalStyle does not render children."));
1681
+ }
1682
+ if (process.env.NODE_ENV !== 'production' &&
1683
+ rules.some(function (rule) { return typeof rule === 'string' && rule.indexOf('@import') !== -1; })) {
1684
+ // eslint-disable-next-line no-console
1685
+ 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.");
1686
+ }
1687
+ if (styleSheet.server) {
1688
+ renderStyles(instance, props, styleSheet, theme, stylis);
1689
+ }
1690
+ {
1691
+ // eslint-disable-next-line react-hooks/rules-of-hooks
1692
+ // @ts-expect-error still using React 17 types for the time being
1693
+ (React__default["default"].useInsertionEffect || React__default["default"].useLayoutEffect)(function () {
1694
+ if (!styleSheet.server) {
1695
+ renderStyles(instance, props, styleSheet, theme, stylis);
1696
+ return function () { return globalStyle.removeStyles(instance, styleSheet); };
1697
+ }
1698
+ }, [instance, props, styleSheet, theme, stylis]);
1699
+ }
1700
+ return null;
1701
+ };
1702
+ function renderStyles(instance, props, styleSheet, theme, stylis) {
1703
+ if (globalStyle.isStatic) {
1704
+ globalStyle.renderStyles(instance, STATIC_EXECUTION_CONTEXT, styleSheet, stylis);
1705
+ }
1706
+ else {
1707
+ var context = tslib.__assign(tslib.__assign({}, props), { theme: determineTheme(props, theme, GlobalStyleComponent.defaultProps) });
1708
+ globalStyle.renderStyles(instance, context, styleSheet, stylis);
1709
+ }
1710
+ }
1711
+ return React__default["default"].memo(GlobalStyleComponent);
1712
+ }
1713
+
1714
+ function keyframes(strings) {
1715
+ var interpolations = [];
1716
+ for (var _i = 1; _i < arguments.length; _i++) {
1717
+ interpolations[_i - 1] = arguments[_i];
1718
+ }
1719
+ /* Warning if you've used keyframes on React Native */
1720
+ if (process.env.NODE_ENV !== 'production' &&
1721
+ typeof navigator !== 'undefined' &&
1722
+ navigator.product === 'ReactNative') {
1723
+ // eslint-disable-next-line no-console
1724
+ console.warn('`keyframes` cannot be used on ReactNative, only on the web. To do animation in ReactNative please use Animated.');
1725
+ }
1726
+ var rules = css.apply(void 0, tslib.__spreadArray([strings], interpolations, false)).join('');
1727
+ var name = generateComponentId(rules);
1728
+ return new Keyframes(name, rules);
1729
+ }
1730
+
1731
+ function withTheme(Component) {
1732
+ var WithTheme = React__default["default"].forwardRef(function (props, ref) {
1733
+ var theme = React__default["default"].useContext(ThemeContext);
1734
+ var themeProp = determineTheme(props, theme, Component.defaultProps);
1735
+ if (process.env.NODE_ENV !== 'production' && themeProp === undefined) {
1736
+ // eslint-disable-next-line no-console
1737
+ 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), "\""));
1738
+ }
1739
+ return React__default["default"].createElement(Component, tslib.__assign({}, props, { theme: themeProp, ref: ref }));
1740
+ });
1741
+ WithTheme.displayName = "WithTheme(".concat(getComponentName(Component), ")");
1742
+ return hoistNonReactStatics(WithTheme, Component);
1743
+ }
1744
+
1745
+ var useTheme = function () { return React.useContext(ThemeContext); };
1746
+
1747
+ var ServerStyleSheet = /** @class */ (function () {
1748
+ function ServerStyleSheet() {
1749
+ var _this = this;
1750
+ this._emitSheetCSS = function () {
1751
+ var css = _this.instance.toString();
1752
+ var nonce = getNonce();
1753
+ var attrs = [
1754
+ nonce && "nonce=\"".concat(nonce, "\""),
1755
+ "".concat(SC_ATTR, "=\"true\""),
1756
+ "".concat(SC_ATTR_VERSION, "=\"").concat(SC_VERSION, "\""),
1757
+ ];
1758
+ var htmlAttr = attrs.filter(Boolean).join(' ');
1759
+ return "<style ".concat(htmlAttr, ">").concat(css, "</style>");
1760
+ };
1761
+ this.getStyleTags = function () {
1762
+ if (_this.sealed) {
1763
+ throw throwStyledComponentsError(2);
1764
+ }
1765
+ return _this._emitSheetCSS();
1766
+ };
1767
+ this.getStyleElement = function () {
1768
+ var _a;
1769
+ if (_this.sealed) {
1770
+ throw throwStyledComponentsError(2);
1771
+ }
1772
+ var props = (_a = {},
1773
+ _a[SC_ATTR] = '',
1774
+ _a[SC_ATTR_VERSION] = SC_VERSION,
1775
+ _a.dangerouslySetInnerHTML = {
1776
+ __html: _this.instance.toString(),
1777
+ },
1778
+ _a);
1779
+ var nonce = getNonce();
1780
+ if (nonce) {
1781
+ props.nonce = nonce;
1782
+ }
1783
+ // v4 returned an array for this fn, so we'll do the same for v5 for backward compat
1784
+ return [React__default["default"].createElement("style", tslib.__assign({}, props, { key: "sc-0-0" }))];
1785
+ };
1786
+ this.seal = function () {
1787
+ _this.sealed = true;
1788
+ };
1789
+ this.instance = new StyleSheet({ isServer: true });
1790
+ this.sealed = false;
1791
+ }
1792
+ ServerStyleSheet.prototype.collectStyles = function (children) {
1793
+ if (this.sealed) {
1794
+ throw throwStyledComponentsError(2);
1795
+ }
1796
+ return React__default["default"].createElement(StyleSheetManager, { sheet: this.instance }, children);
1797
+ };
1798
+ // eslint-disable-next-line consistent-return
1799
+ // @ts-expect-error alternate return types are not possible due to code transformation
1800
+ ServerStyleSheet.prototype.interleaveWithNodeStream = function (input) {
1801
+ {
1802
+ throw throwStyledComponentsError(3);
1803
+ }
1804
+ };
1805
+ return ServerStyleSheet;
1806
+ }());
1807
+
1808
+ /* eslint-disable */
1809
+ var __PRIVATE__ = {
1810
+ StyleSheet: StyleSheet,
1811
+ mainSheet: mainSheet,
1812
+ };
1813
+
1814
+ /* Import singletons */
1815
+ /* Warning if you've imported this file on React Native */
1816
+ if (process.env.NODE_ENV !== 'production' &&
1817
+ typeof navigator !== 'undefined' &&
1818
+ navigator.product === 'ReactNative') {
1819
+ // eslint-disable-next-line no-console
1820
+ console.warn("It looks like you've imported 'styled-components' on React Native.\n" +
1821
+ "Perhaps you're looking to import 'styled-components/native'?\n" +
1822
+ 'Read more about this at https://www.styled-components.com/docs/basics#react-native');
1823
+ }
1824
+ /* Warning if there are several instances of styled-components */
1825
+ if (process.env.NODE_ENV !== 'production' &&
1826
+ process.env.NODE_ENV !== 'test' &&
1827
+ typeof window !== 'undefined') {
1828
+ window['__styled-components-init__'] || (window['__styled-components-init__'] = 0);
1829
+ if (window['__styled-components-init__'] === 1) {
1830
+ // eslint-disable-next-line no-console
1831
+ console.warn("It looks like there are several instances of 'styled-components' initialized in this application. " +
1832
+ 'This may cause dynamic styles to not render properly, errors during the rehydration process, ' +
1833
+ 'a missing theme prop, and makes your application bigger without good reason.\n\n' +
1834
+ 'See https://s-c.sh/2BAXzed for more info.');
1835
+ }
1836
+ window['__styled-components-init__'] += 1;
1837
+ }
1838
+
1839
+ exports.ServerStyleSheet = ServerStyleSheet;
1840
+ exports.StyleSheetConsumer = StyleSheetConsumer;
1841
+ exports.StyleSheetContext = StyleSheetContext;
1842
+ exports.StyleSheetManager = StyleSheetManager;
1843
+ exports.ThemeConsumer = ThemeConsumer;
1844
+ exports.ThemeContext = ThemeContext;
1845
+ exports.ThemeProvider = ThemeProvider;
1846
+ exports.__PRIVATE__ = __PRIVATE__;
1847
+ exports.createGlobalStyle = createGlobalStyle;
1848
+ exports.css = css;
1849
+ exports["default"] = styled;
1850
+ exports.isStyledComponent = isStyledComponent;
1851
+ exports.keyframes = keyframes;
1852
+ exports.useTheme = useTheme;
1853
+ exports.version = SC_VERSION;
1854
+ exports.withTheme = withTheme;
2
1855
  //# sourceMappingURL=styled-components.browser.cjs.js.map