UNPKG

@swat-sccs/react-simple-snackbar

Version:
16 lines (15 loc) 35.5 kB
import e,{useState as t,createContext as n,useContext as r}from"react";import o from"react-dom";function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function i(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,i,c=[],s=!0,u=!1;try{if(a=(n=n.call(e)).next,0===t);else for(;!(s=(r=a.call(n)).done)&&(c.push(r.value),c.length!==t);s=!0);}catch(e){u=!0,o=e}finally{try{if(!s&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw o}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return a(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?a(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function c(){return c=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},c.apply(null,arguments)}function s(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}function u(e,t){return u=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},u(e,t)}function p(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,u(e,t)}function l(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var f,b={exports:{}},d={exports:{}},y={};var m,v,h,_,k,g,x,E,S,O,w,N,C,T,j,P={}; /** @license React v16.13.1 * react-is.development.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */function $(){return v||(v=1,"production"===process.env.NODE_ENV?d.exports=function(){if(f)return y;f=1;var e="function"==typeof Symbol&&Symbol.for,t=e?Symbol.for("react.element"):60103,n=e?Symbol.for("react.portal"):60106,r=e?Symbol.for("react.fragment"):60107,o=e?Symbol.for("react.strict_mode"):60108,a=e?Symbol.for("react.profiler"):60114,i=e?Symbol.for("react.provider"):60109,c=e?Symbol.for("react.context"):60110,s=e?Symbol.for("react.async_mode"):60111,u=e?Symbol.for("react.concurrent_mode"):60111,p=e?Symbol.for("react.forward_ref"):60112,l=e?Symbol.for("react.suspense"):60113,b=e?Symbol.for("react.suspense_list"):60120,d=e?Symbol.for("react.memo"):60115,m=e?Symbol.for("react.lazy"):60116,v=e?Symbol.for("react.block"):60121,h=e?Symbol.for("react.fundamental"):60117,_=e?Symbol.for("react.responder"):60118,k=e?Symbol.for("react.scope"):60119;function g(e){if("object"==typeof e&&null!==e){var f=e.$$typeof;switch(f){case t:switch(e=e.type){case s:case u:case r:case a:case o:case l:return e;default:switch(e=e&&e.$$typeof){case c:case p:case m:case d:case i:return e;default:return f}}case n:return f}}}function x(e){return g(e)===u}return y.AsyncMode=s,y.ConcurrentMode=u,y.ContextConsumer=c,y.ContextProvider=i,y.Element=t,y.ForwardRef=p,y.Fragment=r,y.Lazy=m,y.Memo=d,y.Portal=n,y.Profiler=a,y.StrictMode=o,y.Suspense=l,y.isAsyncMode=function(e){return x(e)||g(e)===s},y.isConcurrentMode=x,y.isContextConsumer=function(e){return g(e)===c},y.isContextProvider=function(e){return g(e)===i},y.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===t},y.isForwardRef=function(e){return g(e)===p},y.isFragment=function(e){return g(e)===r},y.isLazy=function(e){return g(e)===m},y.isMemo=function(e){return g(e)===d},y.isPortal=function(e){return g(e)===n},y.isProfiler=function(e){return g(e)===a},y.isStrictMode=function(e){return g(e)===o},y.isSuspense=function(e){return g(e)===l},y.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===r||e===u||e===a||e===o||e===l||e===b||"object"==typeof e&&null!==e&&(e.$$typeof===m||e.$$typeof===d||e.$$typeof===i||e.$$typeof===c||e.$$typeof===p||e.$$typeof===h||e.$$typeof===_||e.$$typeof===k||e.$$typeof===v)},y.typeOf=g,y}():d.exports=(m||(m=1,"production"!==process.env.NODE_ENV&&function(){var e="function"==typeof Symbol&&Symbol.for,t=e?Symbol.for("react.element"):60103,n=e?Symbol.for("react.portal"):60106,r=e?Symbol.for("react.fragment"):60107,o=e?Symbol.for("react.strict_mode"):60108,a=e?Symbol.for("react.profiler"):60114,i=e?Symbol.for("react.provider"):60109,c=e?Symbol.for("react.context"):60110,s=e?Symbol.for("react.async_mode"):60111,u=e?Symbol.for("react.concurrent_mode"):60111,p=e?Symbol.for("react.forward_ref"):60112,l=e?Symbol.for("react.suspense"):60113,f=e?Symbol.for("react.suspense_list"):60120,b=e?Symbol.for("react.memo"):60115,d=e?Symbol.for("react.lazy"):60116,y=e?Symbol.for("react.block"):60121,m=e?Symbol.for("react.fundamental"):60117,v=e?Symbol.for("react.responder"):60118,h=e?Symbol.for("react.scope"):60119;function _(e){if("object"==typeof e&&null!==e){var f=e.$$typeof;switch(f){case t:var y=e.type;switch(y){case s:case u:case r:case a:case o:case l:return y;default:var m=y&&y.$$typeof;switch(m){case c:case p:case d:case b:case i:return m;default:return f}}case n:return f}}}var k=s,g=u,x=c,E=i,S=t,O=p,w=r,N=d,C=b,T=n,j=a,$=o,R=l,A=!1;function D(e){return _(e)===u}P.AsyncMode=k,P.ConcurrentMode=g,P.ContextConsumer=x,P.ContextProvider=E,P.Element=S,P.ForwardRef=O,P.Fragment=w,P.Lazy=N,P.Memo=C,P.Portal=T,P.Profiler=j,P.StrictMode=$,P.Suspense=R,P.isAsyncMode=function(e){return A||(A=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),D(e)||_(e)===s},P.isConcurrentMode=D,P.isContextConsumer=function(e){return _(e)===c},P.isContextProvider=function(e){return _(e)===i},P.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===t},P.isForwardRef=function(e){return _(e)===p},P.isFragment=function(e){return _(e)===r},P.isLazy=function(e){return _(e)===d},P.isMemo=function(e){return _(e)===b},P.isPortal=function(e){return _(e)===n},P.isProfiler=function(e){return _(e)===a},P.isStrictMode=function(e){return _(e)===o},P.isSuspense=function(e){return _(e)===l},P.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===r||e===u||e===a||e===o||e===l||e===f||"object"==typeof e&&null!==e&&(e.$$typeof===d||e.$$typeof===b||e.$$typeof===i||e.$$typeof===c||e.$$typeof===p||e.$$typeof===m||e.$$typeof===v||e.$$typeof===h||e.$$typeof===y)},P.typeOf=_}()),P)),d.exports} /* object-assign (c) Sindre Sorhus @license MIT */function R(){if(_)return h;_=1;var e=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable;return h=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map((function(e){return t[e]})).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach((function(e){r[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return!1}}()?Object.assign:function(r,o){for(var a,i,c=function(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(r),s=1;s<arguments.length;s++){for(var u in a=Object(arguments[s]))t.call(a,u)&&(c[u]=a[u]);if(e){i=e(a);for(var p=0;p<i.length;p++)n.call(a,i[p])&&(c[i[p]]=a[i[p]])}}return c},h}function A(){if(g)return k;g=1;return k="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"}function D(){return E?x:(E=1,x=Function.call.bind(Object.prototype.hasOwnProperty))}function M(){if(O)return S;O=1;var e=function(){};if("production"!==process.env.NODE_ENV){var t=A(),n={},r=D();e=function(e){var t="Warning: "+e;"undefined"!=typeof console&&console.error(t);try{throw new Error(t)}catch(e){}}}function o(o,a,i,c,s){if("production"!==process.env.NODE_ENV)for(var u in o)if(r(o,u)){var p;try{if("function"!=typeof o[u]){var l=Error((c||"React class")+": "+i+" type `"+u+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof o[u]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw l.name="Invariant Violation",l}p=o[u](a,u,c,i,null,t)}catch(e){p=e}if(!p||p instanceof Error||e((c||"React class")+": type specification of "+i+" `"+u+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof p+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),p instanceof Error&&!(p.message in n)){n[p.message]=!0;var f=s?s():"";e("Failed "+i+" type: "+p.message+(null!=f?f:""))}}}return o.resetWarningCache=function(){"production"!==process.env.NODE_ENV&&(n={})},S=o}function I(){if(N)return w;N=1;var e=$(),t=R(),n=A(),r=D(),o=M(),a=function(){};function i(){return null}return"production"!==process.env.NODE_ENV&&(a=function(e){var t="Warning: "+e;"undefined"!=typeof console&&console.error(t);try{throw new Error(t)}catch(e){}}),w=function(c,s){var u="function"==typeof Symbol&&Symbol.iterator;var p="<<anonymous>>",l={array:y("array"),bigint:y("bigint"),bool:y("boolean"),func:y("function"),number:y("number"),object:y("object"),string:y("string"),symbol:y("symbol"),any:d(i),arrayOf:function(e){return d((function(t,r,o,a,i){if("function"!=typeof e)return new b("Property `"+i+"` of component `"+o+"` has invalid PropType notation inside arrayOf.");var c=t[r];if(!Array.isArray(c))return new b("Invalid "+a+" `"+i+"` of type `"+h(c)+"` supplied to `"+o+"`, expected an array.");for(var s=0;s<c.length;s++){var u=e(c,s,o,a,i+"["+s+"]",n);if(u instanceof Error)return u}return null}))},element:d((function(e,t,n,r,o){var a=e[t];return c(a)?null:new b("Invalid "+r+" `"+o+"` of type `"+h(a)+"` supplied to `"+n+"`, expected a single ReactElement.")})),elementType:d((function(t,n,r,o,a){var i=t[n];return e.isValidElementType(i)?null:new b("Invalid "+o+" `"+a+"` of type `"+h(i)+"` supplied to `"+r+"`, expected a single ReactElement type.")})),instanceOf:function(e){return d((function(t,n,r,o,a){if(!(t[n]instanceof e)){var i=e.name||p;return new b("Invalid "+o+" `"+a+"` of type `"+(((c=t[n]).constructor&&c.constructor.name?c.constructor.name:p)+"` supplied to `")+r+"`, expected instance of `"+i+"`.")}var c;return null}))},node:d((function(e,t,n,r,o){return v(e[t])?null:new b("Invalid "+r+" `"+o+"` supplied to `"+n+"`, expected a ReactNode.")})),objectOf:function(e){return d((function(t,o,a,i,c){if("function"!=typeof e)return new b("Property `"+c+"` of component `"+a+"` has invalid PropType notation inside objectOf.");var s=t[o],u=h(s);if("object"!==u)return new b("Invalid "+i+" `"+c+"` of type `"+u+"` supplied to `"+a+"`, expected an object.");for(var p in s)if(r(s,p)){var l=e(s,p,a,i,c+"."+p,n);if(l instanceof Error)return l}return null}))},oneOf:function(e){if(!Array.isArray(e))return"production"!==process.env.NODE_ENV&&a(arguments.length>1?"Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).":"Invalid argument supplied to oneOf, expected an array."),i;return d((function(t,n,r,o,a){for(var i=t[n],c=0;c<e.length;c++)if(f(i,e[c]))return null;var s=JSON.stringify(e,(function(e,t){return"symbol"===_(t)?String(t):t}));return new b("Invalid "+o+" `"+a+"` of value `"+String(i)+"` supplied to `"+r+"`, expected one of "+s+".")}))},oneOfType:function(e){if(!Array.isArray(e))return"production"!==process.env.NODE_ENV&&a("Invalid argument supplied to oneOfType, expected an instance of array."),i;for(var t=0;t<e.length;t++){var o=e[t];if("function"!=typeof o)return a("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+k(o)+" at index "+t+"."),i}return d((function(t,o,a,i,c){for(var s=[],u=0;u<e.length;u++){var p=(0,e[u])(t,o,a,i,c,n);if(null==p)return null;p.data&&r(p.data,"expectedType")&&s.push(p.data.expectedType)}return new b("Invalid "+i+" `"+c+"` supplied to `"+a+"`"+(s.length>0?", expected one of type ["+s.join(", ")+"]":"")+".")}))},shape:function(e){return d((function(t,r,o,a,i){var c=t[r],s=h(c);if("object"!==s)return new b("Invalid "+a+" `"+i+"` of type `"+s+"` supplied to `"+o+"`, expected `object`.");for(var u in e){var p=e[u];if("function"!=typeof p)return m(o,a,i,u,_(p));var l=p(c,u,o,a,i+"."+u,n);if(l)return l}return null}))},exact:function(e){return d((function(o,a,i,c,s){var u=o[a],p=h(u);if("object"!==p)return new b("Invalid "+c+" `"+s+"` of type `"+p+"` supplied to `"+i+"`, expected `object`.");var l=t({},o[a],e);for(var f in l){var d=e[f];if(r(e,f)&&"function"!=typeof d)return m(i,c,s,f,_(d));if(!d)return new b("Invalid "+c+" `"+s+"` key `"+f+"` supplied to `"+i+"`.\nBad object: "+JSON.stringify(o[a],null," ")+"\nValid keys: "+JSON.stringify(Object.keys(e),null," "));var y=d(u,f,i,c,s+"."+f,n);if(y)return y}return null}))}};function f(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function b(e,t){this.message=e,this.data=t&&"object"==typeof t?t:{},this.stack=""}function d(e){if("production"!==process.env.NODE_ENV)var t={},r=0;function o(o,i,c,u,l,f,d){if(u=u||p,f=f||c,d!==n){if(s){var y=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw y.name="Invariant Violation",y}if("production"!==process.env.NODE_ENV&&"undefined"!=typeof console){var m=u+":"+c;!t[m]&&r<3&&(a("You are manually calling a React.PropTypes validation function for the `"+f+"` prop on `"+u+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),t[m]=!0,r++)}}return null==i[c]?o?null===i[c]?new b("The "+l+" `"+f+"` is marked as required in `"+u+"`, but its value is `null`."):new b("The "+l+" `"+f+"` is marked as required in `"+u+"`, but its value is `undefined`."):null:e(i,c,u,l,f)}var i=o.bind(null,!1);return i.isRequired=o.bind(null,!0),i}function y(e){return d((function(t,n,r,o,a,i){var c=t[n];return h(c)!==e?new b("Invalid "+o+" `"+a+"` of type `"+_(c)+"` supplied to `"+r+"`, expected `"+e+"`.",{expectedType:e}):null}))}function m(e,t,n,r,o){return new b((e||"React class")+": "+t+" type `"+n+"."+r+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+o+"`.")}function v(e){switch(typeof e){case"number":case"string":case"undefined":return!0;case"boolean":return!e;case"object":if(Array.isArray(e))return e.every(v);if(null===e||c(e))return!0;var t=function(e){var t=e&&(u&&e[u]||e["@@iterator"]);if("function"==typeof t)return t}(e);if(!t)return!1;var n,r=t.call(e);if(t!==e.entries){for(;!(n=r.next()).done;)if(!v(n.value))return!1}else for(;!(n=r.next()).done;){var o=n.value;if(o&&!v(o[1]))return!1}return!0;default:return!1}}function h(e){var t=typeof e;return Array.isArray(e)?"array":e instanceof RegExp?"object":function(e,t){return"symbol"===e||!!t&&("Symbol"===t["@@toStringTag"]||"function"==typeof Symbol&&t instanceof Symbol)}(t,e)?"symbol":t}function _(e){if(null==e)return""+e;var t=h(e);if("object"===t){if(e instanceof Date)return"date";if(e instanceof RegExp)return"regexp"}return t}function k(e){var t=_(e);switch(t){case"array":case"object":return"an "+t;case"boolean":case"date":case"regexp":return"a "+t;default:return t}}return b.prototype=Error.prototype,l.checkPropTypes=o,l.resetWarningCache=o.resetWarningCache,l.PropTypes=l,l},w}function L(){if(T)return C;T=1;var e=A();function t(){}function n(){}return n.resetWarningCache=t,C=function(){function r(t,n,r,o,a,i){if(i!==e){var c=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw c.name="Invariant Violation",c}}function o(){return r}r.isRequired=r;var a={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:o,element:r,elementType:r,instanceOf:o,node:r,objectOf:o,oneOf:o,oneOfType:o,shape:o,exact:o,checkPropTypes:n,resetWarningCache:t};return a.PropTypes=a,a}}function V(){if(j)return b.exports;if(j=1,"production"!==process.env.NODE_ENV){var e=$();b.exports=I()(e.isElement,true)}else b.exports=L()();return b.exports}var z=l(V());function U(e,t){return e.replace(new RegExp("(^|\\s)"+t+"(?:\\s|$)","g"),"$1").replace(/\s+/g," ").replace(/^\s*|\s*$/g,"")}var F=!1,W="production"!==process.env.NODE_ENV?z.oneOfType([z.number,z.shape({enter:z.number,exit:z.number,appear:z.number}).isRequired]):null,Y="production"!==process.env.NODE_ENV?z.oneOfType([z.string,z.shape({enter:z.string,exit:z.string,active:z.string}),z.shape({enter:z.string,enterDone:z.string,enterActive:z.string,exit:z.string,exitDone:z.string,exitActive:z.string})]):null,q=e.createContext(null),H=function(e){return e.scrollTop},B="unmounted",J="exited",X="entering",G="entered",Q="exiting",Z=function(t){function n(e,n){var r;r=t.call(this,e,n)||this;var o,a=n&&!n.isMounting?e.enter:e.appear;return r.appearStatus=null,e.in?a?(o=J,r.appearStatus=X):o=G:o=e.unmountOnExit||e.mountOnEnter?B:J,r.state={status:o},r.nextCallback=null,r}p(n,t),n.getDerivedStateFromProps=function(e,t){return e.in&&t.status===B?{status:J}:null};var r=n.prototype;return r.componentDidMount=function(){this.updateStatus(!0,this.appearStatus)},r.componentDidUpdate=function(e){var t=null;if(e!==this.props){var n=this.state.status;this.props.in?n!==X&&n!==G&&(t=X):n!==X&&n!==G||(t=Q)}this.updateStatus(!1,t)},r.componentWillUnmount=function(){this.cancelNextCallback()},r.getTimeouts=function(){var e,t,n,r=this.props.timeout;return e=t=n=r,null!=r&&"number"!=typeof r&&(e=r.exit,t=r.enter,n=void 0!==r.appear?r.appear:t),{exit:e,enter:t,appear:n}},r.updateStatus=function(e,t){if(void 0===e&&(e=!1),null!==t)if(this.cancelNextCallback(),t===X){if(this.props.unmountOnExit||this.props.mountOnEnter){var n=this.props.nodeRef?this.props.nodeRef.current:o.findDOMNode(this);n&&H(n)}this.performEnter(e)}else this.performExit();else this.props.unmountOnExit&&this.state.status===J&&this.setState({status:B})},r.performEnter=function(e){var t=this,n=this.props.enter,r=this.context?this.context.isMounting:e,a=this.props.nodeRef?[r]:[o.findDOMNode(this),r],i=a[0],c=a[1],s=this.getTimeouts(),u=r?s.appear:s.enter;!e&&!n||F?this.safeSetState({status:G},(function(){t.props.onEntered(i)})):(this.props.onEnter(i,c),this.safeSetState({status:X},(function(){t.props.onEntering(i,c),t.onTransitionEnd(u,(function(){t.safeSetState({status:G},(function(){t.props.onEntered(i,c)}))}))})))},r.performExit=function(){var e=this,t=this.props.exit,n=this.getTimeouts(),r=this.props.nodeRef?void 0:o.findDOMNode(this);t&&!F?(this.props.onExit(r),this.safeSetState({status:Q},(function(){e.props.onExiting(r),e.onTransitionEnd(n.exit,(function(){e.safeSetState({status:J},(function(){e.props.onExited(r)}))}))}))):this.safeSetState({status:J},(function(){e.props.onExited(r)}))},r.cancelNextCallback=function(){null!==this.nextCallback&&(this.nextCallback.cancel(),this.nextCallback=null)},r.safeSetState=function(e,t){t=this.setNextCallback(t),this.setState(e,t)},r.setNextCallback=function(e){var t=this,n=!0;return this.nextCallback=function(r){n&&(n=!1,t.nextCallback=null,e(r))},this.nextCallback.cancel=function(){n=!1},this.nextCallback},r.onTransitionEnd=function(e,t){this.setNextCallback(t);var n=this.props.nodeRef?this.props.nodeRef.current:o.findDOMNode(this),r=null==e&&!this.props.addEndListener;if(n&&!r){if(this.props.addEndListener){var a=this.props.nodeRef?[this.nextCallback]:[n,this.nextCallback],i=a[0],c=a[1];this.props.addEndListener(i,c)}null!=e&&setTimeout(this.nextCallback,e)}else setTimeout(this.nextCallback,0)},r.render=function(){var t=this.state.status;if(t===B)return null;var n=this.props,r=n.children;n.in,n.mountOnEnter,n.unmountOnExit,n.appear,n.enter,n.exit,n.timeout,n.addEndListener,n.onEnter,n.onEntering,n.onEntered,n.onExit,n.onExiting,n.onExited,n.nodeRef;var o=s(n,["children","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]);return e.createElement(q.Provider,{value:null},"function"==typeof r?r(t,o):e.cloneElement(e.Children.only(r),o))},n}(e.Component);function K(){}Z.contextType=q,Z.propTypes="production"!==process.env.NODE_ENV?{nodeRef:z.shape({current:"undefined"==typeof Element?z.any:function(e,t,n,r,o,a){var i=e[t];return z.instanceOf(i&&"ownerDocument"in i?i.ownerDocument.defaultView.Element:Element)(e,t,n,r,o,a)}}),children:z.oneOfType([z.func.isRequired,z.element.isRequired]).isRequired,in:z.bool,mountOnEnter:z.bool,unmountOnExit:z.bool,appear:z.bool,enter:z.bool,exit:z.bool,timeout:function(e){var t=W;e.addEndListener||(t=t.isRequired);for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return t.apply(void 0,[e].concat(r))},addEndListener:z.func,onEnter:z.func,onEntering:z.func,onEntered:z.func,onExit:z.func,onExiting:z.func,onExited:z.func}:{},Z.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:K,onEntering:K,onEntered:K,onExit:K,onExiting:K,onExited:K},Z.UNMOUNTED=B,Z.EXITED=J,Z.ENTERING=X,Z.ENTERED=G,Z.EXITING=Q;var ee=function(e,t){return e&&t&&t.split(" ").forEach((function(t){return r=t,void((n=e).classList?n.classList.add(r):function(e,t){return e.classList?!!t&&e.classList.contains(t):-1!==(" "+(e.className.baseVal||e.className)+" ").indexOf(" "+t+" ")}(n,r)||("string"==typeof n.className?n.className=n.className+" "+r:n.setAttribute("class",(n.className&&n.className.baseVal||"")+" "+r)));var n,r}))},te=function(e,t){return e&&t&&t.split(" ").forEach((function(t){return r=t,void((n=e).classList?n.classList.remove(r):"string"==typeof n.className?n.className=U(n.className,r):n.setAttribute("class",U(n.className&&n.className.baseVal||"",r)));var n,r}))},ne=function(t){function n(){for(var e,n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(e=t.call.apply(t,[this].concat(r))||this).appliedClasses={appear:{},enter:{},exit:{}},e.onEnter=function(t,n){var r=e.resolveArguments(t,n),o=r[0],a=r[1];e.removeClasses(o,"exit"),e.addClass(o,a?"appear":"enter","base"),e.props.onEnter&&e.props.onEnter(t,n)},e.onEntering=function(t,n){var r=e.resolveArguments(t,n),o=r[0],a=r[1]?"appear":"enter";e.addClass(o,a,"active"),e.props.onEntering&&e.props.onEntering(t,n)},e.onEntered=function(t,n){var r=e.resolveArguments(t,n),o=r[0],a=r[1]?"appear":"enter";e.removeClasses(o,a),e.addClass(o,a,"done"),e.props.onEntered&&e.props.onEntered(t,n)},e.onExit=function(t){var n=e.resolveArguments(t)[0];e.removeClasses(n,"appear"),e.removeClasses(n,"enter"),e.addClass(n,"exit","base"),e.props.onExit&&e.props.onExit(t)},e.onExiting=function(t){var n=e.resolveArguments(t)[0];e.addClass(n,"exit","active"),e.props.onExiting&&e.props.onExiting(t)},e.onExited=function(t){var n=e.resolveArguments(t)[0];e.removeClasses(n,"exit"),e.addClass(n,"exit","done"),e.props.onExited&&e.props.onExited(t)},e.resolveArguments=function(t,n){return e.props.nodeRef?[e.props.nodeRef.current,t]:[t,n]},e.getClassNames=function(t){var n=e.props.classNames,r="string"==typeof n,o=r?""+(r&&n?n+"-":"")+t:n[t];return{baseClassName:o,activeClassName:r?o+"-active":n[t+"Active"],doneClassName:r?o+"-done":n[t+"Done"]}},e}p(n,t);var r=n.prototype;return r.addClass=function(e,t,n){var r=this.getClassNames(t)[n+"ClassName"],o=this.getClassNames("enter").doneClassName;"appear"===t&&"done"===n&&o&&(r+=" "+o),"active"===n&&e&&H(e),r&&(this.appliedClasses[t][n]=r,ee(e,r))},r.removeClasses=function(e,t){var n=this.appliedClasses[t],r=n.base,o=n.active,a=n.done;this.appliedClasses[t]={},r&&te(e,r),o&&te(e,o),a&&te(e,a)},r.render=function(){var t=this.props;t.classNames;var n=s(t,["classNames"]);return e.createElement(Z,c({},n,{onEnter:this.onEnter,onEntered:this.onEntered,onEntering:this.onEntering,onExit:this.onExit,onExiting:this.onExiting,onExited:this.onExited}))},n}(e.Component);ne.defaultProps={classNames:""},ne.propTypes="production"!==process.env.NODE_ENV?c({},Z.propTypes,{classNames:Y,onEnter:z.func,onEntering:z.func,onEntered:z.func,onExit:z.func,onExiting:z.func,onExited:z.func}):{};var re={"snackbar-wrapper":"Snackbar_snackbar-wrapper__5rl6v","snackbar-wrapper-top-left":"Snackbar_snackbar-wrapper-top-left__dyTY4","snackbar-wrapper-top-center":"Snackbar_snackbar-wrapper-top-center__uX1a7","snackbar-wrapper-top-right":"Snackbar_snackbar-wrapper-top-right__2O3B0","snackbar-wrapper-bottom-left":"Snackbar_snackbar-wrapper-bottom-left__aciU-","snackbar-wrapper-bottom-center":"Snackbar_snackbar-wrapper-bottom-center__SuvvA","snackbar-wrapper-bottom-right":"Snackbar_snackbar-wrapper-bottom-right__YOHld",snackbar:"Snackbar_snackbar__hUtZQ",snackbar__text:"Snackbar_snackbar__text__WHs6f",snackbar__close:"Snackbar_snackbar__close__MHi-F","snackbar-enter":"Snackbar_snackbar-enter__-Io9J","snackbar-exit-active":"Snackbar_snackbar-exit-active__OMtPz","snackbar-enter-active":"Snackbar_snackbar-enter-active__3ljOf","snackbar-enter-top-left":"Snackbar_snackbar-enter-top-left__LUwFD","snackbar-enter-top-center":"Snackbar_snackbar-enter-top-center__tWEd0","snackbar-enter-top-right":"Snackbar_snackbar-enter-top-right__JsSWy","snackbar-exit-active-top-left":"Snackbar_snackbar-exit-active-top-left__-8spx","snackbar-exit-active-top-center":"Snackbar_snackbar-exit-active-top-center__vFXoc","snackbar-exit-active-top-right":"Snackbar_snackbar-exit-active-top-right__BMNpy","snackbar-enter-bottom-left":"Snackbar_snackbar-enter-bottom-left__3pLTp","snackbar-enter-bottom-center":"Snackbar_snackbar-enter-bottom-center__DEtdz","snackbar-enter-bottom-right":"Snackbar_snackbar-enter-bottom-right__yOoNL","snackbar-exit-active-bottom-left":"Snackbar_snackbar-exit-active-bottom-left__iR4iz","snackbar-exit-active-bottom-center":"Snackbar_snackbar-exit-active-bottom-center__H0OUM","snackbar-exit-active-bottom-right":"Snackbar_snackbar-exit-active-bottom-right__ypOjm","snackbar-enter-active-top-left":"Snackbar_snackbar-enter-active-top-left__DfYqP","snackbar-enter-active-top-center":"Snackbar_snackbar-enter-active-top-center__SfUj2","snackbar-enter-active-top-right":"Snackbar_snackbar-enter-active-top-right__gt2W5","snackbar-enter-active-bottom-left":"Snackbar_snackbar-enter-active-bottom-left__OGeNk","snackbar-enter-active-bottom-center":"Snackbar_snackbar-enter-active-bottom-center__d3H-v","snackbar-enter-active-bottom-right":"Snackbar_snackbar-enter-active-bottom-right__rr1zf"};!function(e,t){void 0===t&&(t={});var n=t.insertAt;if("undefined"!=typeof document){var r=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===n&&r.firstChild?r.insertBefore(o,r.firstChild):r.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}('.Snackbar_snackbar-wrapper__5rl6v{align-items:center;display:flex;left:0;margin:8px;pointer-events:none;position:fixed;right:0;transition:opacity .15s,transform .15s;z-index:1}.Snackbar_snackbar-wrapper-top-center__uX1a7,.Snackbar_snackbar-wrapper-top-left__dyTY4,.Snackbar_snackbar-wrapper-top-right__2O3B0{top:8px}.Snackbar_snackbar-wrapper-bottom-center__SuvvA,.Snackbar_snackbar-wrapper-bottom-left__aciU-,.Snackbar_snackbar-wrapper-bottom-right__YOHld{bottom:8px}.Snackbar_snackbar-wrapper-bottom-left__aciU-,.Snackbar_snackbar-wrapper-top-left__dyTY4{justify-content:flex-start}.Snackbar_snackbar-wrapper-bottom-center__SuvvA,.Snackbar_snackbar-wrapper-top-center__uX1a7{justify-content:center}.Snackbar_snackbar-wrapper-bottom-right__YOHld,.Snackbar_snackbar-wrapper-top-right__2O3B0{justify-content:flex-end}.Snackbar_snackbar__hUtZQ{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;align-items:center;background-color:#333;border-radius:4px;box-shadow:0 3px 5px -1px rgba(0,0,0,.2),0 6px 10px 0 rgba(0,0,0,.14),0 1px 18px 0 rgba(0,0,0,.12);color:hsla(0,0%,100%,.87);display:flex;font-family:sans-serif;font-size:14px;font-weight:400;justify-content:flex-start;letter-spacing:.25px;line-height:20px;max-width:672px;min-width:334px;text-align:left}@media (max-width:344px),(max-width:480px){.Snackbar_snackbar__hUtZQ{min-width:100%}}.Snackbar_snackbar__text__WHs6f{flex-grow:1;margin:0;padding:14px 16px;pointer-events:auto}.Snackbar_snackbar__close__MHi-F{-webkit-tap-highlight-color:transparent;align-items:center;background-color:transparent;border:none;box-sizing:border-box;color:hsla(0,0%,100%,.87);cursor:pointer;display:flex;flex-shrink:0;font-size:12px;height:36px;justify-content:center;margin:0 8px 0 0;outline:none;padding:8px;pointer-events:auto;position:relative;width:36px}.Snackbar_snackbar__close__MHi-F:before{background-color:#fff;border-radius:50%;content:"";height:100%;left:0;opacity:0;position:absolute;top:0;transition:opacity .12s linear;width:100%}@media (hover:hover){.Snackbar_snackbar__close__MHi-F:hover:before{opacity:.08}}.Snackbar_snackbar-enter__-Io9J,.Snackbar_snackbar-exit-active__OMtPz{opacity:0}.Snackbar_snackbar-enter-active__3ljOf{opacity:1}.Snackbar_snackbar-enter-top-center__tWEd0,.Snackbar_snackbar-enter-top-left__LUwFD,.Snackbar_snackbar-enter-top-right__JsSWy,.Snackbar_snackbar-exit-active-top-center__vFXoc,.Snackbar_snackbar-exit-active-top-left__-8spx,.Snackbar_snackbar-exit-active-top-right__BMNpy{transform:translateY(-16px)}.Snackbar_snackbar-enter-bottom-center__DEtdz,.Snackbar_snackbar-enter-bottom-left__3pLTp,.Snackbar_snackbar-enter-bottom-right__yOoNL,.Snackbar_snackbar-exit-active-bottom-center__H0OUM,.Snackbar_snackbar-exit-active-bottom-left__iR4iz,.Snackbar_snackbar-exit-active-bottom-right__ypOjm{transform:translateY(16px)}.Snackbar_snackbar-enter-active-bottom-center__d3H-v,.Snackbar_snackbar-enter-active-bottom-left__OGeNk,.Snackbar_snackbar-enter-active-bottom-right__rr1zf,.Snackbar_snackbar-enter-active-top-center__SfUj2,.Snackbar_snackbar-enter-active-top-left__DfYqP,.Snackbar_snackbar-enter-active-top-right__gt2W5{transform:translateY(0)}');var oe="bottom-center",ae=5e3,ie=["top-left","top-center","top-right","bottom-left","bottom-center","bottom-right"],ce=n(null);function se(n){var r=n.children,o=i(t(!1),2),a=o[0],c=o[1],s=i(t(null),2),u=s[0],p=s[1],l=i(t(""),2),f=l[0],b=l[1],d=i(t(ae),2),y=d[0],m=d[1],v=i(t(oe),2),h=v[0],_=v[1],k=i(t({}),2),g=k[0],x=k[1],E=i(t({}),2),S=E[0],O=E[1],w=function(e,t,n,r,o){b(e),m(t),_(n),x(r),O(o),c(!0)},N=function(){c(!1)},C=e.useRef(null);return e.createElement(ce.Provider,{value:{openSnackbar:function(e,t,n,r,o){!0===a?(c(!1),setTimeout((function(){w(e,t,n,r,o)}),250)):w(e,t,n,r,o)},closeSnackbar:N}},r,e.createElement(ne,{in:a,timeout:150,nodeRef:C,mountOnEnter:!0,unmountOnExit:!0,onEnter:function(){clearTimeout(u),p(setTimeout((function(){return c(!1)}),y))},className:"".concat(re["snackbar-wrapper"]," ").concat(re["snackbar-wrapper-".concat(h)]),classNames:{enter:"".concat(re["snackbar-enter"]," ").concat(re["snackbar-enter-".concat(h)]),enterActive:"".concat(re["snackbar-enter-active"]," ").concat(re["snackbar-enter-active-".concat(h)]),exitActive:"".concat(re["snackbar-exit-active"]," ").concat(re["snackbar-exit-active-".concat(h)])}},e.createElement("div",{ref:C},e.createElement("div",{className:re.snackbar,style:g},e.createElement("div",{className:re.snackbar__text},f),e.createElement("button",{onClick:N,className:re.snackbar__close,style:S},e.createElement(ue,null))))))}var ue=function(){return e.createElement("svg",{width:"1em",height:"1em",viewBox:"0 0 12 12"},e.createElement("path",{fill:"currentColor",d:"M11.73 1.58L7.31 6l4.42 4.42-1.06 1.06-4.42-4.42-4.42 4.42-1.06-1.06L5.19 6 .77 1.58 1.83.52l4.42 4.42L10.67.52z",fillRule:"evenodd"}))},pe=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.position,n=void 0===t?oe:t,o=e.style,a=void 0===o?{}:o,i=e.closeStyle,c=void 0===i?{}:i,s=r(ce),u=s.openSnackbar,p=s.closeSnackbar;return ie.includes(n)||(n=oe),[function(){u(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",arguments.length>1&&void 0!==arguments[1]?arguments[1]:ae,n,a,c)},p]};function le(e){return le="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},le(e)}function fe(e){var t=function(e,t){if("object"!=le(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t);if("object"!=le(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==le(t)?t:t+""}function be(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,fe(r.key),r)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function de(e,t){if(t&&("object"==le(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function ye(e){return ye=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},ye(e)}function me(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(me=function(){return!!e})()}function ve(t){var n,r,o,a,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=i.position,p=void 0===s?oe:s,l=i.style,f=void 0===l?{}:l,b=i.closeStyle,d=void 0===b?{}:b;return n=function(){function n(e){var t,r,o,a;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),r=this,a=[e],o=ye(o=n),(t=de(r,me()?Reflect.construct(o,a||[],ye(r).constructor):o.apply(r,a))).open=t.open.bind(t),t.close=t.close.bind(t),t}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&u(e,t)}(n,e.Component),be(n,[{key:"open",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ae,n=this.context.openSnackbar;ie.includes(p)||(p=oe),n(e,t,p,f,d)}},{key:"close",value:function(){(0,this.context.closeSnackbar)()}},{key:"render",value:function(){return e.createElement(t,c({openSnackbar:this.open,closeSnackbar:this.close},this.props))}}])}(),r=n,a=ce,(o=fe(o="contextType"))in r?Object.defineProperty(r,o,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[o]=a,n}export{se as SnackbarProvider,pe as useSnackbar,ve as withSnackbar}; //# sourceMappingURL=index.es.js.map