styled-components
Version:
CSS for the <Component> Age. Style components your way with speed, strong typing, and flexibility.
3 lines (2 loc) • 32.9 kB
JavaScript
import{__spreadArray as e,__assign as t}from"tslib";import n from"@emotion/is-prop-valid";import o,{createElement as r}from"react";import*as s from"stylis";import i from"@emotion/unitless";var a="undefined"!=typeof process&&void 0!==process.env&&(process.env.REACT_APP_SC_ATTR||process.env.SC_ATTR)||"data-styled",c="active",u="data-styled-version",l="6.3.11",p="/*!sc*/\n",h="undefined"!=typeof window&&"undefined"!=typeof document,d=Boolean("boolean"==typeof SC_DISABLE_SPEEDY?SC_DISABLE_SPEEDY:"undefined"!=typeof process&&void 0!==process.env&&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&&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),f={},m="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",18:"ThemeProvider: Please make sure your useTheme hook is within a `<ThemeProvider>`"}:{};function y(){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 v(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(y.apply(void 0,e([m[t]],n,!1)).trim())}var g=1<<30,S=new Map,w=new Map,b=1,N=function(e){if(S.has(e))return S.get(e);for(;w.has(b);)b++;var t=b++;if("production"!==process.env.NODE_ENV&&((0|t)<0||t>g))throw v(16,"".concat(t));return S.set(e,t),w.set(t,e),t},E=function(e,t){b=t+1,S.set(e,t),w.set(t,e)},C=/invalid hook call/i,A=new Set,_=function(t,n){if("production"!==process.env.NODE_ENV){var r=n?' with the id of "'.concat(n,'"'):"",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.\nSee https://styled-components.com/docs/basics#define-styled-components-outside-of-the-render-method for more info.\n",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];C.test(t)?(a=!1,A.delete(s)):i.apply(void 0,e([t],n,!1))},"function"==typeof o.useState&&o.useState(null),a&&!A.has(s)&&(console.warn(s),A.add(s))}catch(e){C.test(e.message)&&A.delete(s)}finally{console.error=i}}},P=Object.freeze([]),I=Object.freeze({});function O(e,t,n){return void 0===n&&(n=I),e.theme!==n.theme&&e.theme||t||n.theme}var D=new Set(["a","abbr","address","area","article","aside","audio","b","bdi","bdo","blockquote","body","button","br","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","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","main","map","mark","menu","meter","nav","object","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","slot","small","span","strong","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","foreignObject","g","image","line","linearGradient","marker","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","switch","symbol","text","textPath","tspan","use"]),R=/[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~-]+/g,T=/(^-|-$)/g;function x(e){return e.replace(R,"-").replace(T,"")}var j=/(a)(d)/gi,k=function(e){return String.fromCharCode(e+(e>25?39:97))};function M(e){var t,n="";for(t=Math.abs(e);t>52;t=t/52|0)n=k(t%52)+n;return(k(t%52)+n).replace(j,"$1-$2")}var V,F=function(e,t){for(var n=t.length;n;)e=33*e^t.charCodeAt(--n);return e},G=function(e){return F(5381,e)};function L(e){return M(G(e)>>>0)}function B(e){return"production"!==process.env.NODE_ENV&&"string"==typeof e&&e||e.displayName||e.name||"Component"}function z(e){return"string"==typeof e&&("production"===process.env.NODE_ENV||e.charAt(0)===e.charAt(0).toLowerCase())}var $="function"==typeof Symbol&&Symbol.for,Y=$?Symbol.for("react.memo"):60115,W=$?Symbol.for("react.forward_ref"):60112,q={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},H={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},U={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},J=((V={})[W]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},V[Y]=U,V);function X(e){return("type"in(t=e)&&t.type.$$typeof)===Y?U:"$$typeof"in e?J[e.$$typeof]:q;var t}var Z=Object.defineProperty,K=Object.getOwnPropertyNames,Q=Object.getOwnPropertySymbols,ee=Object.getOwnPropertyDescriptor,te=Object.getPrototypeOf,ne=Object.prototype;function oe(e,t,n){if("string"!=typeof t){if(ne){var o=te(t);o&&o!==ne&&oe(e,o,n)}var r=K(t);Q&&(r=r.concat(Q(t)));for(var s=X(e),i=X(t),a=0;a<r.length;++a){var c=r[a];if(!(c in H||n&&n[c]||i&&c in i||s&&c in s)){var u=ee(t,c);try{Z(e,c,u)}catch(e){}}}}return e}function re(e){return"function"==typeof e}function se(e){return"object"==typeof e&&"styledComponentId"in e}function ie(e,t){return e&&t?"".concat(e," ").concat(t):e||t||""}function ae(e,t){return e.join(t||"")}function ce(e){return null!==e&&"object"==typeof e&&e.constructor.name===Object.name&&!("props"in e&&e.$$typeof)}function ue(e,t,n){if(void 0===n&&(n=!1),!n&&!ce(e)&&!Array.isArray(e))return t;if(Array.isArray(t))for(var o=0;o<t.length;o++)e[o]=ue(e[o],t[o]);else if(ce(t))for(var o in t)e[o]=ue(e[o],t[o]);return e}function le(e,t){Object.defineProperty(e,"toString",{value:t})}var pe=function(){function e(e){this.groupSizes=new Uint32Array(512),this.length=512,this.tag=e,this._cGroup=0,this._cIndex=0}return e.prototype.indexOfGroup=function(e){if(e===this._cGroup)return this._cIndex;var t=this._cIndex;if(e>this._cGroup)for(var n=this._cGroup;n<e;n++)t+=this.groupSizes[n];else for(n=this._cGroup-1;n>=e;n--)t-=this.groupSizes[n];return this._cGroup=e,this._cIndex=t,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 v(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}for(var i=this.indexOfGroup(e+1),a=0,c=(s=0,t.length);s<c;s++)this.tag.insertRule(i,t[s])&&(this.groupSizes[e]++,i++,a++);a>0&&this._cGroup>e&&(this._cIndex+=a)},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);t>0&&this._cGroup>e&&(this._cIndex-=t)}},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+=this.tag.getRule(s)+p;return t},e}(),he="style[".concat(a,"][").concat(u,'="').concat(l,'"]'),de=new RegExp("^".concat(a,'\\.g(\\d+)\\[id="([\\w\\d-]+)"\\].*?"([^"]*)')),fe=function(e){return"undefined"!=typeof ShadowRoot&&e instanceof ShadowRoot||"host"in e&&11===e.nodeType},me=function(e){if(!e)return document;if(fe(e))return e;if("getRootNode"in e){var t=e.getRootNode();if(fe(t))return t}return document},ye=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)},ve=function(e,t){for(var n,o=(null!==(n=t.textContent)&&void 0!==n?n:"").split(p),r=[],s=0,i=o.length;s<i;s++){var a=o[s].trim();if(a){var c=a.match(de);if(c){var u=0|parseInt(c[1],10),l=c[2];0!==u&&(E(l,u),ye(e,l,c[3]),e.getTag().insertRules(u,r)),r.length=0}else r.push(a)}}},ge=function(e){for(var t=me(e.options.target).querySelectorAll(he),n=0,o=t.length;n<o;n++){var r=t[n];r&&r.getAttribute(a)!==c&&(ve(e,r),r.parentNode&&r.parentNode.removeChild(r))}};function Se(){return"undefined"!=typeof __webpack_nonce__?__webpack_nonce__:null}var we=function(e){var t=document.head,n=e||t,o=document.createElement("style"),r=function(e){var t=Array.from(e.querySelectorAll("style[".concat(a,"]")));return t[t.length-1]}(n),s=void 0!==r?r.nextSibling:null;o.setAttribute(a,c),o.setAttribute(u,l);var i=Se();return i&&o.setAttribute("nonce",i),n.insertBefore(o,s),o},be=function(){function e(e){this.element=we(e),this.element.appendChild(document.createTextNode("")),this.sheet=function(e){var t;if(e.sheet)return e.sheet;for(var n=null!==(t=e.getRootNode().styleSheets)&&void 0!==t?t:document.styleSheets,o=0,r=n.length;o<r;o++){var s=n[o];if(s.ownerNode===e)return s}throw v(17)}(this.element),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 t&&t.cssText?t.cssText:""},e}(),Ne=function(){function e(e){this.element=we(e),this.nodes=this.element.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}(),Ee=function(){function e(e){this.rules=[],this.length=0}return e.prototype.insertRule=function(e,t){return e<=this.length&&(e===this.length?this.rules.push(t):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}(),Ce=h,Ae={isServer:!h,useCSSOMInjection:!d},_e=function(){function e(e,n,o){void 0===e&&(e=I),void 0===n&&(n={});var r=this;this.options=t(t({},Ae),e),this.gs=n,this.names=new Map(o),this.server=!!e.isServer,!this.server&&h&&Ce&&(Ce=!1,ge(this)),le(this,function(){return function(e){for(var t=e.getTag(),n=t.length,o="",r=function(n){var r=function(e){return w.get(e)}(n);if(void 0===r)return"continue";var s=e.names.get(r);if(void 0===s||!s.size)return"continue";var i=t.getGroup(n);if(0===i.length)return"continue";var c=a+".g"+n+'[id="'+r+'"]',u="";s.forEach(function(e){e.length>0&&(u+=e+",")}),o+=i+c+'{content:"'+u+'"}'+p},s=0;s<n;s++)r(s);return o}(r)})}return e.registerId=function(e){return N(e)},e.prototype.rehydrate=function(){!this.server&&h&&ge(this)},e.prototype.reconstructWithOptions=function(n,o){void 0===o&&(o=!0);var r=new e(t(t({},this.options),n),this.gs,o&&this.names||void 0);return!this.server&&h&&n.target!==this.options.target&&me(this.options.target)!==me(n.target)&&ge(r),r},e.prototype.allocateGSInstance=function(e){return this.gs[e]=(this.gs[e]||0)+1},e.prototype.getTag=function(){return this.tag||(this.tag=(e=function(e){var t=e.useCSSOMInjection,n=e.target;return e.isServer?new Ee(n):t?new be(n):new Ne(n)}(this.options),new pe(e)));var e},e.prototype.hasNameForId=function(e,t){var n,o;return null!==(o=null===(n=this.names.get(e))||void 0===n?void 0:n.has(t))&&void 0!==o&&o},e.prototype.registerName=function(e,t){N(e);var n=this.names.get(e);n?n.add(t):this.names.set(e,new Set([t]))},e.prototype.insertRules=function(e,t,n){this.registerName(e,t),this.getTag().insertRules(N(e),n)},e.prototype.clearNames=function(e){this.names.has(e)&&this.names.get(e).clear()},e.prototype.clearRules=function(e){this.getTag().clearGroup(N(e)),this.clearNames(e)},e.prototype.clearTag=function(){this.tag=void 0},e}(),Pe=/&/g,Ie=47,Oe=42;function De(e){if(-1===e.indexOf("}"))return!1;for(var t=e.length,n=0,o=0,r=!1,s=0;s<t;s++){var i=e.charCodeAt(s);if(0!==o||r||i!==Ie||e.charCodeAt(s+1)!==Oe)if(r)i===Oe&&e.charCodeAt(s+1)===Ie&&(r=!1,s++);else if(34!==i&&39!==i||0!==s&&92===e.charCodeAt(s-1)){if(0===o)if(123===i)n++;else if(125===i&&--n<0)return!0}else 0===o?o=i:o===i&&(o=0);else r=!0,s++}return 0!==n||0!==o}function Re(e,t){return e.map(function(e){return"rule"===e.type&&(e.value="".concat(t," ").concat(e.value),e.value=e.value.replaceAll(",",",".concat(t," ")),e.props=e.props.map(function(e){return"".concat(t," ").concat(e)})),Array.isArray(e.children)&&"@keyframes"!==e.type&&(e.children=Re(e.children,t)),e})}function Te(e){var t,n,o,r=void 0===e?I:e,i=r.options,a=void 0===i?I:i,c=r.plugins,u=void 0===c?P:c,l=function(e,o,r){return r.startsWith(n)&&r.endsWith(n)&&r.replaceAll(n,"").length>0?".".concat(t):e},p=u.slice();p.push(function(e){e.type===s.RULESET&&e.value.includes("&")&&(o||(o=new RegExp("\\".concat(n,"\\b"),"g")),e.props[0]=e.props[0].replace(Pe,n).replace(o,l))}),a.prefix&&p.push(s.prefixer),p.push(s.stringify);var h=[],d=s.middleware(p.concat(s.rulesheet(function(e){return h.push(e)}))),f=function(e,r,i,c){void 0===r&&(r=""),void 0===i&&(i=""),void 0===c&&(c="&"),t=c,n=r,o=void 0;var u=function(e){if(!De(e))return e;for(var t=e.length,n="",o=0,r=0,s=0,i=!1,a=0;a<t;a++){var c=e.charCodeAt(a);if(0!==s||i||c!==Ie||e.charCodeAt(a+1)!==Oe)if(i)c===Oe&&e.charCodeAt(a+1)===Ie&&(i=!1,a++);else if(34!==c&&39!==c||0!==a&&92===e.charCodeAt(a-1)){if(0===s)if(123===c)r++;else if(125===c){if(--r<0){for(var u=a+1;u<t;){var l=e.charCodeAt(u);if(59===l||10===l)break;u++}u<t&&59===e.charCodeAt(u)&&u++,r=0,a=u-1,o=u;continue}0===r&&(n+=e.substring(o,a+1),o=a+1)}else 59===c&&0===r&&(n+=e.substring(o,a+1),o=a+1)}else 0===s?s=c:s===c&&(s=0);else i=!0,a++}if(o<t){var p=e.substring(o);De(p)||(n+=p)}return n}(function(e){if(-1===e.indexOf("//"))return e;for(var t=e.length,n=[],o=0,r=0,s=0,i=0;r<t;){var a=e.charCodeAt(r);if(34!==a&&39!==a||0!==r&&92===e.charCodeAt(r-1))if(0===s)if(a===Ie&&r+1<t&&e.charCodeAt(r+1)===Oe){for(r+=2;r+1<t&&(e.charCodeAt(r)!==Oe||e.charCodeAt(r+1)!==Ie);)r++;r+=2}else if(40===a&&r>=3&&108==(32|e.charCodeAt(r-1))&&114==(32|e.charCodeAt(r-2))&&117==(32|e.charCodeAt(r-3)))i=1,r++;else if(i>0)41===a?i--:40===a&&i++,r++;else if(a===Oe&&r+1<t&&e.charCodeAt(r+1)===Ie)r>o&&n.push(e.substring(o,r)),o=r+=2;else if(a===Ie&&r+1<t&&e.charCodeAt(r+1)===Ie){for(r>o&&n.push(e.substring(o,r));r<t&&10!==e.charCodeAt(r);)r++;o=r}else r++;else r++;else 0===s?s=a:s===a&&(s=0),r++}return 0===o?e:(o<t&&n.push(e.substring(o)),n.join(""))}(e)),l=s.compile(i||r?"".concat(i," ").concat(r," { ").concat(u," }"):u);return a.namespace&&(l=Re(l,a.namespace)),h=[],s.serialize(l,d),h};return f.hash=u.length?u.reduce(function(e,t){return t.name||v(15),F(e,t.name)},5381).toString():"",f}var xe=new _e,je=Te(),ke=o.createContext({shouldForwardProp:void 0,styleSheet:xe,stylis:je}),Me=ke.Consumer,Ve=o.createContext(void 0);function Fe(){return o.useContext(ke)}function Ge(e){if(!o.useMemo)return e.children;var t=Fe().styleSheet,n=o.useMemo(function(){var n=t;return e.sheet?n=e.sheet:e.target&&(n=n.reconstructWithOptions({target:e.target},!1)),e.disableCSSOMInjection&&(n=n.reconstructWithOptions({useCSSOMInjection:!1})),n},[e.disableCSSOMInjection,e.sheet,e.target,t]),r=o.useMemo(function(){return Te({options:{namespace:e.namespace,prefix:e.enableVendorPrefixes},plugins:e.stylisPlugins})},[e.enableVendorPrefixes,e.namespace,e.stylisPlugins]),s=o.useMemo(function(){return{shouldForwardProp:e.shouldForwardProp,styleSheet:n,stylis:r}},[e.shouldForwardProp,n,r]);return o.createElement(ke.Provider,{value:s},o.createElement(Ve.Provider,{value:r},e.children))}var Le=function(){function e(e,t){var n=this;this.inject=function(e,t){void 0===t&&(t=je);var o=n.name+t.hash;e.hasNameForId(n.id,o)||e.insertRules(n.id,o,t(n.rules,o,"@keyframes"))},this.name=e,this.id="sc-keyframes-".concat(e),this.rules=t,le(this,function(){throw v(12,String(n.name))})}return e.prototype.getName=function(e){return void 0===e&&(e=je),this.name+e.hash},e}();function Be(e,t){return null==t||"boolean"==typeof t||""===t?"":"number"!=typeof t||0===t||e in i||e.startsWith("--")?String(t).trim():"".concat(t,"px")}var ze=function(e){return e>="A"&&e<="Z"};function $e(e){for(var t="",n=0;n<e.length;n++){var o=e[n];if(1===n&&"-"===o&&"-"===e[0])return e;ze(o)?t+="-"+o.toLowerCase():t+=o}return t.startsWith("ms-")?"-"+t:t}var Ye=function(e){return null==e||!1===e||""===e},We=function(t){var n=[];for(var o in t){var r=t[o];t.hasOwnProperty(o)&&!Ye(r)&&(Array.isArray(r)&&r.isCss||re(r)?n.push("".concat($e(o),":"),r,";"):ce(r)?n.push.apply(n,e(e(["".concat(o," {")],We(r),!1),["}"],!1)):n.push("".concat($e(o),": ").concat(Be(o,r),";")))}return n};function qe(e,t,n,o,r){if(void 0===r&&(r=[]),"string"==typeof e)return e&&r.push(e),r;if(Ye(e))return r;if(se(e))return r.push(".".concat(e.styledComponentId)),r;if(re(e)){if(!re(i=e)||i.prototype&&i.prototype.isReactComponent||!t)return r.push(e),r;var s=e(t);return"production"===process.env.NODE_ENV||"object"!=typeof s||Array.isArray(s)||s instanceof Le||ce(s)||null===s||console.error("".concat(B(e)," 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.")),qe(s,t,n,o,r)}var i;if(e instanceof Le)return n?(e.inject(n,o),r.push(e.getName(o))):r.push(e),r;if(ce(e)){for(var a=We(e),c=0;c<a.length;c++)r.push(a[c]);return r}if(!Array.isArray(e))return r.push(e.toString()),r;for(c=0;c<e.length;c++)qe(e[c],t,n,o,r);return r}function He(e){for(var t=0;t<e.length;t+=1){var n=e[t];if(re(n)&&!se(n))return!1}return!0}var Ue=G(l),Je=function(){function e(e,t,n){this.rules=e,this.staticRulesId="",this.isStatic="production"===process.env.NODE_ENV&&(void 0===n||n.isStatic)&&He(e),this.componentId=t,this.baseHash=F(Ue,t),this.baseStyle=n,_e.registerId(t)}return e.prototype.generateAndInjectStyles=function(e,t,n){var o=this.baseStyle?this.baseStyle.generateAndInjectStyles(e,t,n).className:"";if(this.isStatic&&!n.hash)if(this.staticRulesId&&t.hasNameForId(this.componentId,this.staticRulesId))o=ie(o,this.staticRulesId);else{var r=ae(qe(this.rules,e,t,n)),s=M(F(this.baseHash,r)>>>0);if(!t.hasNameForId(this.componentId,s)){var i=n(r,".".concat(s),void 0,this.componentId);t.insertRules(this.componentId,s,i)}o=ie(o,s),this.staticRulesId=s}else{for(var a=F(this.baseHash,n.hash),c="",u=0;u<this.rules.length;u++){var l=this.rules[u];if("string"==typeof l)c+=l,"production"!==process.env.NODE_ENV&&(a=F(a,l));else if(l){var p=ae(qe(l,e,t,n));a=F(F(a,String(u)),p),c+=p}}if(c){var h=M(a>>>0);if(!t.hasNameForId(this.componentId,h)){var d=n(c,".".concat(h),void 0,this.componentId);t.insertRules(this.componentId,h,d)}o=ie(o,h)}}return{className:o,css:"undefined"==typeof window?t.getTag().getGroup(N(this.componentId)):""}},e}(),Xe=o.createContext(void 0),Ze=Xe.Consumer;function Ke(){var e=o.useContext(Xe);if(!e)throw v(18);return e}function Qe(e){var n=o.useContext(Xe),r=o.useMemo(function(){return function(e,n){if(!e)throw v(14);if(re(e)){var o=e(n);if("production"!==process.env.NODE_ENV&&(null===o||Array.isArray(o)||"object"!=typeof o))throw v(7);return o}if(Array.isArray(e)||"object"!=typeof e)throw v(8);return n?t(t({},n),e):e}(e.theme,n)},[e.theme,n]);return e.children?o.createElement(Xe.Provider,{value:r},e.children):null}var et={},tt=new Set;function nt(e,s,i){var a=se(e),c=e,u=!z(e),p=s.attrs,h=void 0===p?P:p,d=s.componentId,f=void 0===d?function(e,t){var n="string"!=typeof e?"sc":x(e);et[n]=(et[n]||0)+1;var o="".concat(n,"-").concat(L(l+n+et[n]));return t?"".concat(t,"-").concat(o):o}(s.displayName,s.parentComponentId):d,m=s.displayName,y=void 0===m?function(e){return z(e)?"styled.".concat(e):"Styled(".concat(B(e),")")}(e):m,v=s.displayName&&s.componentId?"".concat(x(s.displayName),"-").concat(s.componentId):s.componentId||f,g=a&&c.attrs?c.attrs.concat(h).filter(Boolean):h,S=s.shouldForwardProp;if(a&&c.shouldForwardProp){var w=c.shouldForwardProp;if(s.shouldForwardProp){var b=s.shouldForwardProp;S=function(e,t){return w(e,t)&&b(e,t)}}else S=w}var N=new Je(i,v,a?c.componentStyle:void 0);function E(e,s){return function(e,s,i){var a=e.attrs,c=e.componentStyle,u=e.defaultProps,l=e.foldedComponentIds,p=e.styledComponentId,h=e.target,d=o.useContext(Xe),f=Fe(),m=e.shouldForwardProp||f.shouldForwardProp;"production"!==process.env.NODE_ENV&&o.useDebugValue&&o.useDebugValue(p);var y=O(s,d,u)||I,v=function(e,n,o){for(var r,s=t(t({},n),{className:void 0,theme:o}),i=0;i<e.length;i+=1){var a=re(r=e[i])?r(s):r;for(var c in a)"className"===c?s.className=ie(s.className,a[c]):"style"===c?s.style=t(t({},s.style),a[c]):s[c]=a[c]}return"className"in n&&"string"==typeof n.className&&(s.className=ie(s.className,n.className)),s}(a,s,y),g=v.as||h,S={};for(var w in v)void 0===v[w]||"$"===w[0]||"as"===w||"theme"===w&&v.theme===y||("forwardedAs"===w?S.as=v.forwardedAs:m&&!m(w,g)||(S[w]=v[w],m||"development"!==process.env.NODE_ENV||n(w)||tt.has(w)||!D.has(g)||(tt.add(w),console.warn('styled-components: it looks like an unknown prop "'.concat(w,'" is being sent through to the DOM, which will likely trigger a React console error. If you would like automatic filtering of unknown props, you can opt-into that behavior via `<StyleSheetManager shouldForwardProp={...}>` (connect an API like `@emotion/is-prop-valid`) or consider using transient props (`$` prefix for automatic filtering.)')))));var b=function(e,t){var n=Fe(),r=e.generateAndInjectStyles(t,n.styleSheet,n.stylis);return"production"!==process.env.NODE_ENV&&o.useDebugValue&&o.useDebugValue(r.className),r}(c,v),N=b.className;"production"!==process.env.NODE_ENV&&e.warnTooManyClasses&&e.warnTooManyClasses(N);var E=ie(l,p);return N&&(E+=" "+N),v.className&&(E+=" "+v.className),S[z(g)&&!D.has(g)?"class":"className"]=E,i&&(S.ref=i),r(g,S)}(C,e,s)}E.displayName=y;var C=o.forwardRef(E);return C.attrs=g,C.componentStyle=N,C.displayName=y,C.shouldForwardProp=S,C.foldedComponentIds=a?ie(c.foldedComponentIds,c.styledComponentId):"",C.styledComponentId=v,C.target=a?c.target:e,Object.defineProperty(C,"defaultProps",{get:function(){return this._foldedDefaultProps},set:function(e){this._foldedDefaultProps=a?function(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++)ue(e,r[o],!0);return e}({},c.defaultProps,e):e}}),"production"!==process.env.NODE_ENV&&(_(y,v),C.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={}}}}(y,v)),le(C,function(){return".".concat(C.styledComponentId)}),u&&oe(C,e,{attrs:!0,componentStyle:!0,displayName:!0,foldedComponentIds:!0,shouldForwardProp:!0,styledComponentId:!0,target:!0}),C}function ot(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 rt=function(e){return Object.assign(e,{isCss:!0})};function st(t){for(var n=[],o=1;o<arguments.length;o++)n[o-1]=arguments[o];if(re(t)||ce(t))return rt(qe(ot(P,e([t],n,!0))));var r=t;return 0===n.length&&1===r.length&&"string"==typeof r[0]?qe(r):rt(qe(ot(r,n)))}function it(n,o,r){if(void 0===r&&(r=I),!o)throw v(1,o);var s=function(t){for(var s=[],i=1;i<arguments.length;i++)s[i-1]=arguments[i];return n(o,r,st.apply(void 0,e([t],s,!1)))};return s.attrs=function(e){return it(n,o,t(t({},r),{attrs:Array.prototype.concat(r.attrs,e).filter(Boolean)}))},s.withConfig=function(e){return it(n,o,t(t({},r),e))},s}var at=function(e){return it(nt,e)},ct=at;D.forEach(function(e){ct[e]=at(e)});var ut=function(){function e(e,t){this.rules=e,this.componentId=t,this.isStatic=He(e),_e.registerId(this.componentId+1)}return e.prototype.createStyles=function(e,t,n,o){var r=o(ae(qe(this.rules,t,n,o)),""),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&&_e.registerId(this.componentId+e);var r=this.componentId+e;this.isStatic?n.hasNameForId(r,r)||this.createStyles(e,t,n,o):(this.removeStyles(e,n),this.createStyles(e,t,n,o))},e}();function lt(n){for(var r=[],s=1;s<arguments.length;s++)r[s-1]=arguments[s];var i=st.apply(void 0,e([n],r,!1)),a="sc-global-".concat(L(JSON.stringify(i))),c=new ut(i,a);"production"!==process.env.NODE_ENV&&_(a);var u=new WeakMap,l=function(e){var t=Fe(),n=o.useContext(Xe),r=u.get(t.styleSheet);return void 0===r&&(r=t.styleSheet.allocateGSInstance(a),u.set(t.styleSheet,r)),"production"!==process.env.NODE_ENV&&o.Children.count(e.children)&&console.warn("The global style component ".concat(a," was given child JSX. createGlobalStyle does not render children.")),"production"!==process.env.NODE_ENV&&i.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."),("undefined"==typeof window||!t.styleSheet.server)&&p(r,e,t.styleSheet,n,t.stylis),o.useLayoutEffect(function(){return t.styleSheet.server||p(r,e,t.styleSheet,n,t.stylis),function(){var e;c.removeStyles(r,t.styleSheet),e=t.styleSheet.options.target,"undefined"!=typeof document&&(null!=e?e:document).querySelectorAll('style[data-styled-global="'.concat(a,'"]')).forEach(function(e){return e.remove()})}},[r,e,t.styleSheet,n,t.stylis]),null};function p(e,n,o,r,s){if(c.isStatic)c.renderStyles(e,f,o,s);else{var i=t(t({},n),{theme:O(n,r,l.defaultProps)});c.renderStyles(e,i,o,s)}}return o.memo(l)}function pt(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=ae(st.apply(void 0,e([t],n,!1))),s=L(r);return new Le(s,r)}function ht(e){var n=o.forwardRef(function(n,r){var s=O(n,o.useContext(Xe),e.defaultProps);return"production"!==process.env.NODE_ENV&&void 0===s&&console.warn('[withTheme] You are not using a ThemeProvider nor passing a theme prop or a theme in defaultProps in component class "'.concat(B(e),'"')),o.createElement(e,t(t({},n),{theme:s,ref:r}))});return n.displayName="WithTheme(".concat(B(e),")"),oe(n,e)}var dt=function(){function e(){var e=this;this._emitSheetCSS=function(){var t=e.instance.toString();if(!t)return"";var n=Se(),o=ae([n&&'nonce="'.concat(n,'"'),"".concat(a,'="true"'),"".concat(u,'="').concat(l,'"')].filter(Boolean)," ");return"<style ".concat(o,">").concat(t,"</style>")},this.getStyleTags=function(){if(e.sealed)throw v(2);return e._emitSheetCSS()},this.getStyleElement=function(){var n;if(e.sealed)throw v(2);var r=e.instance.toString();if(!r)return[];var s=((n={})[a]="",n[u]=l,n.dangerouslySetInnerHTML={__html:r},n),i=Se();return i&&(s.nonce=i),[o.createElement("style",t({},s,{key:"sc-0-0"}))]},this.seal=function(){e.sealed=!0},this.instance=new _e({isServer:!0}),this.sealed=!1}return e.prototype.collectStyles=function(e){if(this.sealed)throw v(2);return o.createElement(Ge,{sheet:this.instance},e)},e.prototype.interleaveWithNodeStream=function(e){throw v(3)},e}(),ft={StyleSheet:_e,mainSheet:xe};"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");var mt="__sc-".concat(a,"__");"production"!==process.env.NODE_ENV&&"test"!==process.env.NODE_ENV&&"undefined"!=typeof window&&(window[mt]||(window[mt]=0),1===window[mt]&&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://styled-components.com/docs/faqs#why-am-i-getting-a-warning-about-several-instances-of-module-on-the-page for more info."),window[mt]+=1);export{dt as ServerStyleSheet,Me as StyleSheetConsumer,ke as StyleSheetContext,Ge as StyleSheetManager,Ze as ThemeConsumer,Xe as ThemeContext,Qe as ThemeProvider,ft as __PRIVATE__,lt as createGlobalStyle,st as css,ct as default,se as isStyledComponent,pt as keyframes,ct as styled,Ke as useTheme,l as version,ht as withTheme};
//# sourceMappingURL=styled-components.browser.esm.js.map