├── .gitignore ├── LICENSE ├── README.md ├── package-lock.json ├── package.json ├── public ├── dist │ ├── bundle.css │ └── bundle.js └── index.html ├── src ├── App.js ├── actions │ ├── cartActions.js │ └── catalogActions.js ├── components │ ├── Button.js │ ├── Cart.js │ ├── Catalog.js │ ├── Item.js │ └── QuantityBar.js ├── constants │ └── ActionTypes.js ├── index.js ├── reducers │ ├── cart.js │ └── catalog.js ├── store.js └── styles │ └── main.scss └── webpack.config.js /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Santhosh Sundar 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # React Shopping Cart 2 | A simple shopping cart SPA with an ability to persist cart items on page refresh. 3 | 4 | **Demo:** https://www.gigacore.in/demos/shopping-cart/ 5 | 6 | ### Under the hood 7 | 8 | * React 9 | * Redux 10 | * ES6 11 | * No DOM manipulation libraries used (such as jQuery) 12 | * SASS 13 | * Redux-Persist to store cart data on page refresh using localStorage. 14 | 15 | ### Get it runnin'! 16 | * git clone 17 | * npm i 18 | * npm start 19 | 20 | #### The MIT License (MIT) 21 | MIT © 2017 Santhosh Sundar -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-shopping-cart", 3 | "version": "1.0.0", 4 | "description": "A simple shopping cart implementation in React.js", 5 | "main": "index.js", 6 | "watch": true, 7 | "dependencies": { 8 | "react": "^16.2.0", 9 | "react-dom": "^16.2.0", 10 | "react-redux": "^5.0.7", 11 | "redux": "^3.7.2", 12 | "reset-css": "^2.2.1" 13 | }, 14 | "devDependencies": { 15 | "axios": "^0.17.1", 16 | "babel-core": "^6.26.0", 17 | "babel-loader": "^7.1.4", 18 | "babel-plugin-transform-class-properties": "^6.24.1", 19 | "babel-plugin-transform-decorators-legacy": "^1.3.4", 20 | "babel-preset-env": "^1.6.1", 21 | "babel-preset-es2015": "^6.24.1", 22 | "babel-preset-react": "^6.24.1", 23 | "babel-preset-stage-0": "^6.24.1", 24 | "css-loader": "^0.28.10", 25 | "extract-text-webpack-plugin": "2.1.2", 26 | "file-loader": "^0.11.2", 27 | "lodash": "^4.17.5", 28 | "node-sass": "^4.5.3", 29 | "redux-logger": "^3.0.6", 30 | "redux-persist": "^4.8.2", 31 | "redux-promise-middleware": "^5.0.0", 32 | "redux-thunk": "^2.2.0", 33 | "sass-loader": "^6.0.7", 34 | "uglifyjs-webpack-plugin": "^1.2.2", 35 | "webpack": "^3.11.0", 36 | "webpack-dev-server": "^2.11.2" 37 | }, 38 | "scripts": { 39 | "start": "node ./node_modules/webpack-dev-server/bin/webpack-dev-server.js" 40 | }, 41 | "author": "Santhosh Sundar", 42 | "license": "MIT" 43 | } 44 | -------------------------------------------------------------------------------- /public/dist/bundle.css: -------------------------------------------------------------------------------- 1 | /* http://meyerweb.com/eric/tools/css/reset/ 2 | v2.0 | 20110126 3 | License: none (public domain) 4 | */ 5 | html, body, div, span, applet, object, iframe, 6 | h1, h2, h3, h4, h5, h6, p, blockquote, pre, 7 | a, abbr, acronym, address, big, cite, code, 8 | del, dfn, em, img, ins, kbd, q, s, samp, 9 | small, strike, strong, sub, sup, tt, var, 10 | b, u, i, center, 11 | dl, dt, dd, ol, ul, li, 12 | fieldset, form, label, legend, 13 | table, caption, tbody, tfoot, thead, tr, th, td, 14 | article, aside, canvas, details, embed, 15 | figure, figcaption, footer, header, hgroup, 16 | menu, nav, output, ruby, section, summary, 17 | time, mark, audio, video { 18 | margin: 0; 19 | padding: 0; 20 | border: 0; 21 | font-size: 100%; 22 | font: inherit; 23 | vertical-align: baseline; } 24 | 25 | /* HTML5 display-role reset for older browsers */ 26 | article, aside, details, figcaption, figure, 27 | footer, header, hgroup, menu, nav, section { 28 | display: block; } 29 | 30 | body { 31 | line-height: 1; } 32 | 33 | ol, ul { 34 | list-style: none; } 35 | 36 | blockquote, q { 37 | quotes: none; } 38 | 39 | blockquote:before, blockquote:after, 40 | q:before, q:after { 41 | content: ''; 42 | content: none; } 43 | 44 | table { 45 | border-collapse: collapse; 46 | border-spacing: 0; } 47 | 48 | hr { 49 | border: 2px solid #666; } 50 | 51 | body { 52 | background: #fff; 53 | font-family: 'Roboto', sans-serif; } 54 | 55 | .wrap { 56 | width: 1000px; 57 | margin: 0 auto; 58 | display: flex; } 59 | 60 | .item-catalog { 61 | padding: 30px 0; 62 | display: flex; 63 | flex-direction: row; 64 | max-width: 640px; 65 | min-width: 600px; 66 | flex-wrap: wrap; } 67 | .item-catalog .item-wrapper { 68 | display: block; 69 | margin: 10px; 70 | border: solid 1px #ccc; } 71 | .item-catalog .item-wrapper .item-container .product-img img { 72 | width: 180px; 73 | height: 180px; } 74 | .item-catalog .item-wrapper .item-container .product-details { 75 | padding: 5px 0 10px 0; 76 | text-align: center; } 77 | .item-catalog .item-wrapper .item-container .product-details .brand-name, 78 | .item-catalog .item-wrapper .item-container .product-details .package-detail { 79 | font-size: 12px; 80 | padding: 5px 0; } 81 | .item-catalog .item-wrapper .item-container .product-details .brand-name { 82 | padding: 5px 0 0; } 83 | .item-catalog .item-wrapper .item-container .product-details .product-name { 84 | font-size: 16px; 85 | padding: 5px 0; } 86 | .item-catalog .item-wrapper .item-container .product-details .product-price { 87 | font-weight: bold; 88 | font-size: 16px; 89 | padding: 10px 0; } 90 | .item-catalog .item-wrapper .item-container .product-details input { 91 | background: #3f51b5; 92 | color: #fff; 93 | height: 32px; 94 | width: 120px; 95 | border-radius: 0; 96 | border: none; 97 | cursor: pointer; 98 | line-height: 30px; 99 | text-transform: uppercase; 100 | font-size: 10px; } 101 | .item-catalog .item-wrapper .item-container .product-details .quantity-bar { 102 | display: flex; 103 | width: 120px; 104 | height: 30px; 105 | margin: 0 auto; 106 | justify-content: center; 107 | border: solid 1px #ccc; } 108 | .item-catalog .item-wrapper .item-container .product-details .quantity-bar .item-quantity-meter { 109 | background: #3f51b5; 110 | color: #fff; 111 | width: 60%; 112 | font-size: 10px; 113 | display: flex; 114 | justify-content: center; 115 | align-items: center; 116 | text-transform: uppercase; } 117 | .item-catalog .item-wrapper .item-container .product-details .quantity-bar .adjust-quantity { 118 | width: 20%; 119 | display: flex; 120 | justify-content: center; 121 | align-items: center; 122 | cursor: pointer; 123 | text-transform: uppercase; } 124 | 125 | .cart { 126 | width: 300px; 127 | padding: 20px; 128 | border: solid 1px #ccc; 129 | margin: 30px; 130 | max-height: 600px; } 131 | .cart .cart-overview { 132 | display: flex; } 133 | .cart .cart-overview .item-count, 134 | .cart .cart-overview .grand-total { 135 | display: flex; 136 | flex-direction: column; 137 | align-items: center; 138 | flex-grow: 1; } 139 | .cart .cart-overview .item-count span, 140 | .cart .cart-overview .grand-total span { 141 | padding: 10px; } 142 | .cart .cart-overview .item-count .count-meter, .cart .cart-overview .item-count .total-amount, .cart .cart-overview .grand-total .count-meter, .cart .cart-overview .grand-total .total-amount { 143 | font-size: 20px; 144 | font-weight: bold; } 145 | .cart .cart-header, 146 | .cart .item-row { 147 | display: flex; 148 | font-size: 14px; 149 | border-bottom: 1px solid #ccc; 150 | padding: 10px 0; } 151 | .cart .cart-header .remove-item, 152 | .cart .item-row .remove-item { 153 | border-radius: 100%; 154 | background: #b71c1c; 155 | color: #fff; 156 | width: 16px; 157 | height: 16px; 158 | text-align: center; 159 | font-size: 13px; 160 | cursor: pointer; } 161 | .cart .cart-header .cart-item-title, 162 | .cart .item-row .cart-item-title { 163 | flex-grow: 6; } 164 | .cart .cart-header .cart-total-title, 165 | .cart .item-row .cart-total-title { 166 | text-align: right; 167 | padding: 0 20px 0 0; } 168 | .cart .cart-header .cart-quantity-title, 169 | .cart .cart-header .cart-total-title, 170 | .cart .item-row .cart-quantity-title, 171 | .cart .item-row .cart-total-title { 172 | flex-grow: 1; } 173 | .cart .item-row .cart-item-title { 174 | flex-grow: 1; 175 | max-width: 115px; } 176 | .cart .item-row .cart-quantity-title { 177 | text-align: center; } 178 | .cart .cart-header { 179 | font-weight: bold; } 180 | .cart .contains-no-items { 181 | width: 100%; 182 | height: 100%; 183 | display: flex; 184 | flex-direction: column; 185 | align-items: center; 186 | justify-content: center; } 187 | .cart h3 { 188 | font-size: 22px; 189 | font-weight: bold; 190 | padding: 0 0 20px 0; } 191 | -------------------------------------------------------------------------------- /public/dist/bundle.js: -------------------------------------------------------------------------------- 1 | !function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=36)}([function(e,t,n){"use strict";function r(e){return"[object Array]"===k.call(e)}function o(e){return"[object ArrayBuffer]"===k.call(e)}function a(e){return"undefined"!=typeof FormData&&e instanceof FormData}function i(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer}function u(e){return"string"==typeof e}function l(e){return"number"==typeof e}function c(e){return void 0===e}function s(e){return null!==e&&"object"==typeof e}function f(e){return"[object Date]"===k.call(e)}function p(e){return"[object File]"===k.call(e)}function d(e){return"[object Blob]"===k.call(e)}function h(e){return"[object Function]"===k.call(e)}function m(e){return s(e)&&h(e.pipe)}function y(e){return"undefined"!=typeof URLSearchParams&&e instanceof URLSearchParams}function v(e){return e.replace(/^\s*/,"").replace(/\s*$/,"")}function g(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)}function b(e,t){if(null!==e&&void 0!==e)if("object"!=typeof e&&(e=[e]),r(e))for(var n=0,o=e.length;n=200&&e<300}};u.headers={common:{Accept:"application/json, text/plain, */*"}},o.forEach(["delete","get","head"],function(e){u.headers[e]={}}),o.forEach(["post","put","patch"],function(e){u.headers[e]=o.merge(i)}),e.exports=u}).call(t,n(96))},function(e,t,n){"use strict";function r(e){if(null===e||void 0===e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}/* 2 | object-assign 3 | (c) Sindre Sorhus 4 | @license MIT 5 | */ 6 | var o=Object.getOwnPropertySymbols,a=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable;e.exports=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(e,t){for(var n,u,l=r(e),c=1;c=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function u(){}function l(e,t){var n={run:function(r){try{var o=e(t.getState(),r);(o!==n.props||n.error)&&(n.shouldComponentUpdate=!0,n.props=o,n.error=null)}catch(e){n.shouldComponentUpdate=!0,n.error=e}}};return n}function c(e){var t,n,c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=c.getDisplayName,p=void 0===s?function(e){return"ConnectAdvanced("+e+")"}:s,w=c.methodName,C=void 0===w?"connectAdvanced":w,E=c.renderCountProp,x=void 0===E?void 0:E,k=c.shouldHandleStateChanges,O=void 0===k||k,T=c.storeKey,S=void 0===T?"store":T,_=c.withRef,P=void 0!==_&&_,j=i(c,["getDisplayName","methodName","renderCountProp","shouldHandleStateChanges","storeKey","withRef"]),N=S+"Subscription",I=g++,D=(t={},t[S]=y.a,t[N]=y.b,t),M=(n={},n[N]=y.b,n);return function(t){d()("function"==typeof t,"You must pass a component to the function returned by "+C+". Instead received "+JSON.stringify(t));var n=t.displayName||t.name||"Component",i=p(n),c=v({},j,{getDisplayName:p,methodName:C,renderCountProp:x,shouldHandleStateChanges:O,storeKey:S,withRef:P,displayName:i,wrappedComponentName:n,WrappedComponent:t}),s=function(n){function s(e,t){r(this,s);var a=o(this,n.call(this,e,t));return a.version=I,a.state={},a.renderCount=0,a.store=e[S]||t[S],a.propsMode=Boolean(e[S]),a.setWrappedInstance=a.setWrappedInstance.bind(a),d()(a.store,'Could not find "'+S+'" in either the context or props of "'+i+'". Either wrap the root component in a , or explicitly pass "'+S+'" as a prop to "'+i+'".'),a.initSelector(),a.initSubscription(),a}return a(s,n),s.prototype.getChildContext=function(){var e,t=this.propsMode?null:this.subscription;return e={},e[N]=t||this.context[N],e},s.prototype.componentDidMount=function(){O&&(this.subscription.trySubscribe(),this.selector.run(this.props),this.selector.shouldComponentUpdate&&this.forceUpdate())},s.prototype.componentWillReceiveProps=function(e){this.selector.run(e)},s.prototype.shouldComponentUpdate=function(){return this.selector.shouldComponentUpdate},s.prototype.componentWillUnmount=function(){this.subscription&&this.subscription.tryUnsubscribe(),this.subscription=null,this.notifyNestedSubs=u,this.store=null,this.selector.run=u,this.selector.shouldComponentUpdate=!1},s.prototype.getWrappedInstance=function(){return d()(P,"To access the wrapped instance, you need to specify { withRef: true } in the options argument of the "+C+"() call."),this.wrappedInstance},s.prototype.setWrappedInstance=function(e){this.wrappedInstance=e},s.prototype.initSelector=function(){var t=e(this.store.dispatch,c);this.selector=l(t,this.store),this.selector.run(this.props)},s.prototype.initSubscription=function(){if(O){var e=(this.propsMode?this.props:this.context)[N];this.subscription=new m.a(this.store,e,this.onStateChange.bind(this)),this.notifyNestedSubs=this.subscription.notifyNestedSubs.bind(this.subscription)}},s.prototype.onStateChange=function(){this.selector.run(this.props),this.selector.shouldComponentUpdate?(this.componentDidUpdate=this.notifyNestedSubsOnComponentDidUpdate,this.setState(b)):this.notifyNestedSubs()},s.prototype.notifyNestedSubsOnComponentDidUpdate=function(){this.componentDidUpdate=void 0,this.notifyNestedSubs()},s.prototype.isSubscribed=function(){return Boolean(this.subscription)&&this.subscription.isSubscribed()},s.prototype.addExtraProps=function(e){if(!(P||x||this.propsMode&&this.subscription))return e;var t=v({},e);return P&&(t.ref=this.setWrappedInstance),x&&(t[x]=this.renderCount++),this.propsMode&&this.subscription&&(t[N]=this.subscription),t},s.prototype.render=function(){var e=this.selector;if(e.shouldComponentUpdate=!1,e.error)throw e.error;return Object(h.createElement)(t,this.addExtraProps(e.props))},s}(h.Component);return s.WrappedComponent=t,s.displayName=i,s.childContextTypes=M,s.contextTypes=D,s.propTypes=D,f()(s,t)}}t.a=c;var s=n(53),f=n.n(s),p=n(54),d=n.n(p),h=n(1),m=(n.n(h),n(55)),y=n(15),v=Object.assign||function(e){for(var t=1;t1&&void 0!==arguments[1]?arguments[1]:{},r={};return n.serial?x(t,function(e,t){try{var n=y(e),o=b.reduceRight(function(e,n){return n.out(e,t)},n);r=O(r,t,o)}catch(e){}}):r=t,e.dispatch(u(r)),r}function h(e){return""+C+e}var m=!1===t.serialize?function(e){return e}:a,y=!1===t.serialize?function(e){return e}:i,v=t.blacklist||[],g=t.whitelist||!1,b=t.transforms||[],w=t.debounce||!1,C=void 0!==t.keyPrefix?t.keyPrefix:f.a,E=t._stateInit||{},x=t._stateIterator||l,k=t._stateGetter||c,O=t._stateSetter||s,T=t.storage||Object(p.a)("local");T.keys&&!T.getAllKeys&&(T.getAllKeys=T.keys);var S=E,_=!1,P=[],j=null;return e.subscribe(function(){if(!_){var t=e.getState();x(t,function(e,r){n(r)&&k(S,r)!==k(t,r)&&-1===P.indexOf(r)&&P.push(r)});var r=P.length;null===j&&(j=setInterval(function(){if(_&&r===P.length||0===P.length)return clearInterval(j),void(j=null);var t=P.shift(),n=h(t),a=b.reduce(function(e,n){return n.in(e,t)},k(e.getState(),t));void 0!==a&&T.setItem(n,m(a),o(t))},w)),S=t}}),{rehydrate:r,pause:function(){_=!0},resume:function(){_=!1},purge:function(e){return Object(d.a)({storage:T,keyPrefix:C},e)}}}function o(e){return function(e){}}function a(e){return m()(e,null,null,function(e,t){throw new Error('\n redux-persist: cannot process cyclical state.\n Consider changing your state structure to have no cycles.\n Alternatively blacklist the corresponding reducer key.\n Cycle encounted at key "'+e+'" with value "'+t+'".\n ')})}function i(e){return JSON.parse(e)}function u(e){return{type:f.b,payload:e}}function l(e,t){return Object.keys(e).forEach(function(n){return t(e[n],n)})}function c(e,t){return e[t]}function s(e,t,n){return e[t]=n,e}t.a=r;var f=n(4),p=n(32),d=n(34),h=n(116),m=n.n(h)},function(e,t,n){"use strict";function r(e){if("object"!==("undefined"==typeof window?"undefined":l(window))||!(e in window))return!1;try{var t=window[e],n="redux-persist "+e+" test";t.setItem(n,"test"),t.getItem(n),t.removeItem(n)}catch(e){return!1}return!0}function o(){return r("localStorage")}function a(){return r("sessionStorage")}function i(e){return"local"===e?o()?window.localStorage:{getItem:c,setItem:c,removeItem:c,getAllKeys:c}:"session"===e?a()?window.sessionStorage:{getItem:c,setItem:c,removeItem:c,getAllKeys:c}:void 0}var u=n(33),l="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},c=function(){return null};t.a=function(e,t){var n=i(e);return{getAllKeys:function(e){return new Promise(function(t,r){try{for(var o=[],a=0;aR.length&&R.push(e)}function d(e,t,n,o){var a=typeof e;"undefined"!==a&&"boolean"!==a||(e=null);var i=!1;if(null===e)i=!0;else switch(a){case"string":case"number":i=!0;break;case"object":switch(e.$$typeof){case E:case x:case k:case O:i=!0}}if(i)return n(o,e,""===t?"."+h(e,0):t),1;if(i=0,t=""===t?".":t+":",Array.isArray(e))for(var u=0;uthis.eventPool.length&&this.eventPool.push(e)}function B(e){e.eventPool=[],e.getPooled=H,e.release=z}function V(e,t,n,r){return F.call(this,e,t,n,r)}function q(e,t,n,r){return F.call(this,e,t,n,r)}function K(e,t){switch(e){case"topKeyUp":return-1!==dr.indexOf(t.keyCode);case"topKeyDown":return 229!==t.keyCode;case"topKeyPress":case"topMouseDown":case"topBlur":return!0;default:return!1}}function W(e){return e=e.detail,"object"==typeof e&&"data"in e?e.data:null}function G(e,t){switch(e){case"topCompositionEnd":return W(t);case"topKeyPress":return 32!==t.which?null:(xr=!0,Cr);case"topTextInput":return e=t.data,e===Cr&&xr?null:e;default:return null}}function Q(e,t){if(kr)return"topCompositionEnd"===e||!hr&&K(e,t)?(e=U(),sr._root=null,sr._startText=null,sr._fallbackText=null,kr=!1,e):null;switch(e){case"topPaste":return null;case"topKeyPress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1Br.length&&Br.push(e)}}}function De(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n["ms"+e]="MS"+t,n["O"+e]="o"+t.toLowerCase(),n}function Me(e){if(Gr[e])return Gr[e];if(!Wr[e])return e;var t,n=Wr[e];for(t in n)if(n.hasOwnProperty(t)&&t in Qr)return Gr[e]=n[t];return""}function Re(e){return Object.prototype.hasOwnProperty.call(e,Jr)||(e[Jr]=Xr++,Yr[e[Jr]]={}),Yr[e[Jr]]}function Ae(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Ue(e,t){var n=Ae(e);e=0;for(var r;n;){if(3===n.nodeType){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Ae(n)}}function Le(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&("input"===t&&"text"===e.type||"textarea"===t||"true"===e.contentEditable)}function Fe(e,t){if(oo||null==to||to!==kn())return null;var n=to;return"selectionStart"in n&&Le(n)?n={start:n.selectionStart,end:n.selectionEnd}:window.getSelection?(n=window.getSelection(),n={anchorNode:n.anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset}):n=void 0,ro&&On(ro,n)?null:(ro=n,e=F.getPooled(eo.select,no,e,t),e.type="select",e.target=to,M(e),e)}function He(e,t,n,r){return F.call(this,e,t,n,r)}function ze(e,t,n,r){return F.call(this,e,t,n,r)}function Be(e,t,n,r){return F.call(this,e,t,n,r)}function Ve(e){var t=e.keyCode;return"charCode"in e?0===(e=e.charCode)&&13===t&&(e=13):e=t,32<=e||13===e?e:0}function qe(e,t,n,r){return F.call(this,e,t,n,r)}function Ke(e,t,n,r){return F.call(this,e,t,n,r)}function We(e,t,n,r){return F.call(this,e,t,n,r)}function Ge(e,t,n,r){return F.call(this,e,t,n,r)}function Qe(e,t,n,r){return F.call(this,e,t,n,r)}function $e(e){0>po||(e.current=fo[po],fo[po]=null,po--)}function Ye(e,t){po++,fo[po]=e.current,e.current=t}function Xe(e){return Ze(e)?yo:ho.current}function Je(e,t){var n=e.type.contextTypes;if(!n)return _n;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var o,a={};for(o in n)a[o]=t[o];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=a),a}function Ze(e){return 2===e.tag&&null!=e.type.childContextTypes}function et(e){Ze(e)&&($e(mo,e),$e(ho,e))}function tt(e,t,n){null!=ho.cursor&&r("168"),Ye(ho,t,e),Ye(mo,n,e)}function nt(e,t){var n=e.stateNode,o=e.type.childContextTypes;if("function"!=typeof n.getChildContext)return t;n=n.getChildContext();for(var a in n)a in o||r("108",Ce(e)||"Unknown",a);return Cn({},t,n)}function rt(e){if(!Ze(e))return!1;var t=e.stateNode;return t=t&&t.__reactInternalMemoizedMergedChildContext||_n,yo=ho.current,Ye(ho,t,e),Ye(mo,mo.current,e),!0}function ot(e,t){var n=e.stateNode;if(n||r("169"),t){var o=nt(e,yo);n.__reactInternalMemoizedMergedChildContext=o,$e(mo,e),$e(ho,e),Ye(ho,o,e)}else $e(mo,e);Ye(mo,t,e)}function at(e,t,n){this.tag=e,this.key=t,this.stateNode=this.type=null,this.sibling=this.child=this.return=null,this.index=0,this.memoizedState=this.updateQueue=this.memoizedProps=this.pendingProps=this.ref=null,this.internalContextTag=n,this.effectTag=0,this.lastEffect=this.firstEffect=this.nextEffect=null,this.expirationTime=0,this.alternate=null}function it(e,t,n){var r=e.alternate;return null===r?(r=new at(e.tag,e.key,e.internalContextTag),r.type=e.type,r.stateNode=e.stateNode,r.alternate=e,e.alternate=r):(r.effectTag=0,r.nextEffect=null,r.firstEffect=null,r.lastEffect=null),r.expirationTime=n,r.pendingProps=t,r.child=e.child,r.memoizedProps=e.memoizedProps,r.memoizedState=e.memoizedState,r.updateQueue=e.updateQueue,r.sibling=e.sibling,r.index=e.index,r.ref=e.ref,r}function ut(e,t,n){var o=void 0,a=e.type,i=e.key;return"function"==typeof a?(o=a.prototype&&a.prototype.isReactComponent?new at(2,i,t):new at(0,i,t),o.type=a,o.pendingProps=e.props):"string"==typeof a?(o=new at(5,i,t),o.type=a,o.pendingProps=e.props):"object"==typeof a&&null!==a&&"number"==typeof a.tag?(o=a,o.pendingProps=e.props):r("130",null==a?a:typeof a,""),o.expirationTime=n,o}function lt(e,t,n,r){return t=new at(10,r,t),t.pendingProps=e,t.expirationTime=n,t}function ct(e,t,n){return t=new at(6,null,t),t.pendingProps=e,t.expirationTime=n,t}function st(e,t,n){return t=new at(7,e.key,t),t.type=e.handler,t.pendingProps=e,t.expirationTime=n,t}function ft(e,t,n){return e=new at(9,null,t),e.expirationTime=n,e}function pt(e,t,n){return t=new at(4,e.key,t),t.pendingProps=e.children||[],t.expirationTime=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function dt(e){return function(t){try{return e(t)}catch(e){}}}function ht(e){if("undefined"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__)return!1;var t=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(t.isDisabled||!t.supportsFiber)return!0;try{var n=t.inject(e);vo=dt(function(e){return t.onCommitFiberRoot(n,e)}),go=dt(function(e){return t.onCommitFiberUnmount(n,e)})}catch(e){}return!0}function mt(e){"function"==typeof vo&&vo(e)}function yt(e){"function"==typeof go&&go(e)}function vt(e){return{baseState:e,expirationTime:0,first:null,last:null,callbackList:null,hasForceUpdate:!1,isInitialized:!1}}function gt(e,t){null===e.last?e.first=e.last=t:(e.last.next=t,e.last=t),(0===e.expirationTime||e.expirationTime>t.expirationTime)&&(e.expirationTime=t.expirationTime)}function bt(e,t){var n=e.alternate,r=e.updateQueue;null===r&&(r=e.updateQueue=vt(null)),null!==n?null===(e=n.updateQueue)&&(e=n.updateQueue=vt(null)):e=null,e=e!==r?e:null,null===e?gt(r,t):null===r.last||null===e.last?(gt(r,t),gt(e,t)):(gt(r,t),e.last=t)}function wt(e,t,n,r){return e=e.partialState,"function"==typeof e?e.call(t,n,r):e}function Ct(e,t,n,r,o,a){null!==e&&e.updateQueue===n&&(n=t.updateQueue={baseState:n.baseState,expirationTime:n.expirationTime,first:n.first,last:n.last,isInitialized:n.isInitialized,callbackList:null,hasForceUpdate:!1}),n.expirationTime=0,n.isInitialized?e=n.baseState:(e=n.baseState=t.memoizedState,n.isInitialized=!0);for(var i=!0,u=n.first,l=!1;null!==u;){var c=u.expirationTime;if(c>a){var s=n.expirationTime;(0===s||s>c)&&(n.expirationTime=c),l||(l=!0,n.baseState=e)}else l||(n.first=u.next,null===n.first&&(n.last=null)),u.isReplace?(e=wt(u,r,e,o),i=!0):(c=wt(u,r,e,o))&&(e=i?Cn({},e,c):Cn(e,c),i=!1),u.isForced&&(n.hasForceUpdate=!0),null!==u.callback&&(c=n.callbackList,null===c&&(c=n.callbackList=[]),c.push(u));u=u.next}return null!==n.callbackList?t.effectTag|=32:null!==n.first||n.hasForceUpdate||(t.updateQueue=null),l||(n.baseState=e),e}function Et(e,t){var n=e.callbackList;if(null!==n)for(e.callbackList=null,e=0;ep?(d=f,f=null):d=f.sibling;var v=m(r,f,u[p],l);if(null===v){null===f&&(f=d);break}e&&f&&null===v.alternate&&t(r,f),a=i(v,a,p),null===s?c=v:s.sibling=v,s=v,f=d}if(p===u.length)return n(r,f),c;if(null===f){for(;pd?(v=p,p=null):v=p.sibling;var b=m(a,p,g.value,c);if(null===b){p||(p=v);break}e&&p&&null===b.alternate&&t(a,p),u=i(b,u,d),null===f?s=b:f.sibling=b,f=b,p=v}if(g.done)return n(a,p),s;if(null===p){for(;!g.done;d++,g=l.next())null!==(g=h(a,g.value,c))&&(u=i(g,u,d),null===f?s=g:f.sibling=g,f=g);return s}for(p=o(a,p);!g.done;d++,g=l.next())null!==(g=y(p,a,d,g.value,c))&&(e&&null!==g.alternate&&p.delete(null===g.key?d:g.key),u=i(g,u,d),null===f?s=g:f.sibling=g,f=g);return e&&p.forEach(function(e){return t(a,e)}),s}return function(e,o,i,l){"object"==typeof i&&null!==i&&i.type===ko&&null===i.key&&(i=i.props.children);var c="object"==typeof i&&null!==i;if(c)switch(i.$$typeof){case wo:e:{var s=i.key;for(c=o;null!==c;){if(c.key===s){if(10===c.tag?i.type===ko:c.type===i.type){n(e,c.sibling),o=a(c,i.type===ko?i.props.children:i.props,l),o.ref=Ot(c,i),o.return=e,e=o;break e}n(e,c);break}t(e,c),c=c.sibling}i.type===ko?(o=lt(i.props.children,e.internalContextTag,l,i.key),o.return=e,e=o):(l=ut(i,e.internalContextTag,l),l.ref=Ot(o,i),l.return=e,e=l)}return u(e);case Co:e:{for(c=i.key;null!==o;){if(o.key===c){if(7===o.tag){n(e,o.sibling),o=a(o,i,l),o.return=e,e=o;break e}n(e,o);break}t(e,o),o=o.sibling}o=st(i,e.internalContextTag,l),o.return=e,e=o}return u(e);case Eo:e:{if(null!==o){if(9===o.tag){n(e,o.sibling),o=a(o,null,l),o.type=i.value,o.return=e,e=o;break e}n(e,o)}o=ft(i,e.internalContextTag,l),o.type=i.value,o.return=e,e=o}return u(e);case xo:e:{for(c=i.key;null!==o;){if(o.key===c){if(4===o.tag&&o.stateNode.containerInfo===i.containerInfo&&o.stateNode.implementation===i.implementation){n(e,o.sibling),o=a(o,i.children||[],l),o.return=e,e=o;break e}n(e,o);break}t(e,o),o=o.sibling}o=pt(i,e.internalContextTag,l),o.return=e,e=o}return u(e)}if("string"==typeof i||"number"==typeof i)return i=""+i,null!==o&&6===o.tag?(n(e,o.sibling),o=a(o,i,l)):(n(e,o),o=ct(i,e.internalContextTag,l)),o.return=e,e=o,u(e);if(To(i))return v(e,o,i,l);if(kt(i))return g(e,o,i,l);if(c&&Tt(e,i),void 0===i)switch(e.tag){case 2:case 1:l=e.type,r("152",l.displayName||l.name||"Component")}return n(e,o)}}function _t(e,t,n,o,a){function i(e,t,n){var r=t.expirationTime;t.child=null===e?_o(t,null,n,r):So(t,e.child,n,r)}function u(e,t){var n=t.ref;null===n||e&&e.ref===n||(t.effectTag|=128)}function l(e,t,n,r){if(u(e,t),!n)return r&&ot(t,!1),s(e,t);n=t.stateNode,zr.current=t;var o=n.render();return t.effectTag|=1,i(e,t,o),t.memoizedState=n.state,t.memoizedProps=n.props,r&&ot(t,!0),t.child}function c(e){var t=e.stateNode;t.pendingContext?tt(e,t.pendingContext,t.pendingContext!==t.context):t.context&&tt(e,t.context,!1),y(e,t.containerInfo)}function s(e,t){if(null!==e&&t.child!==e.child&&r("153"),null!==t.child){e=t.child;var n=it(e,e.pendingProps,e.expirationTime);for(t.child=n,n.return=t;null!==e.sibling;)e=e.sibling,n=n.sibling=it(e,e.pendingProps,e.expirationTime),n.return=t;n.sibling=null}return t.child}function f(e,t){switch(t.tag){case 3:c(t);break;case 2:rt(t);break;case 4:y(t,t.stateNode.containerInfo)}return null}var p=e.shouldSetTextContent,d=e.useSyncScheduling,h=e.shouldDeprioritizeSubtree,m=t.pushHostContext,y=t.pushHostContainer,v=n.enterHydrationState,g=n.resetHydrationState,b=n.tryToClaimNextHydratableInstance;e=xt(o,a,function(e,t){e.memoizedProps=t},function(e,t){e.memoizedState=t});var w=e.adoptClassInstance,C=e.constructClassInstance,E=e.mountClassInstance,x=e.updateClassInstance;return{beginWork:function(e,t,n){if(0===t.expirationTime||t.expirationTime>n)return f(e,t);switch(t.tag){case 0:null!==e&&r("155");var o=t.type,a=t.pendingProps,k=Xe(t);return k=Je(t,k),o=o(a,k),t.effectTag|=1,"object"==typeof o&&null!==o&&"function"==typeof o.render?(t.tag=2,a=rt(t),w(t,o),E(t,n),t=l(e,t,!0,a)):(t.tag=1,i(e,t,o),t.memoizedProps=a,t=t.child),t;case 1:e:{if(a=t.type,n=t.pendingProps,o=t.memoizedProps,mo.current)null===n&&(n=o);else if(null===n||o===n){t=s(e,t);break e}o=Xe(t),o=Je(t,o),a=a(n,o),t.effectTag|=1,i(e,t,a),t.memoizedProps=n,t=t.child}return t;case 2:return a=rt(t),o=void 0,null===e?t.stateNode?r("153"):(C(t,t.pendingProps),E(t,n),o=!0):o=x(e,t,n),l(e,t,o,a);case 3:return c(t),a=t.updateQueue,null!==a?(o=t.memoizedState,a=Ct(e,t,a,null,null,n),o===a?(g(),t=s(e,t)):(o=a.element,k=t.stateNode,(null===e||null===e.child)&&k.hydrate&&v(t)?(t.effectTag|=2,t.child=_o(t,null,o,n)):(g(),i(e,t,o)),t.memoizedState=a,t=t.child)):(g(),t=s(e,t)),t;case 5:m(t),null===e&&b(t),a=t.type;var O=t.memoizedProps;return o=t.pendingProps,null===o&&null===(o=O)&&r("154"),k=null!==e?e.memoizedProps:null,mo.current||null!==o&&O!==o?(O=o.children,p(a,o)?O=null:k&&p(a,k)&&(t.effectTag|=16),u(e,t),2147483647!==n&&!d&&h(a,o)?(t.expirationTime=2147483647,t=null):(i(e,t,O),t.memoizedProps=o,t=t.child)):t=s(e,t),t;case 6:return null===e&&b(t),e=t.pendingProps,null===e&&(e=t.memoizedProps),t.memoizedProps=e,null;case 8:t.tag=7;case 7:return a=t.pendingProps,mo.current?null===a&&null===(a=e&&e.memoizedProps)&&r("154"):null!==a&&t.memoizedProps!==a||(a=t.memoizedProps),o=a.children,t.stateNode=null===e?_o(t,t.stateNode,o,n):So(t,t.stateNode,o,n),t.memoizedProps=a,t.stateNode;case 9:return null;case 4:e:{if(y(t,t.stateNode.containerInfo),a=t.pendingProps,mo.current)null===a&&null==(a=e&&e.memoizedProps)&&r("154");else if(null===a||t.memoizedProps===a){t=s(e,t);break e}null===e?t.child=So(t,null,a,n):i(e,t,a),t.memoizedProps=a,t=t.child}return t;case 10:e:{if(n=t.pendingProps,mo.current)null===n&&(n=t.memoizedProps);else if(null===n||t.memoizedProps===n){t=s(e,t);break e}i(e,t,n),t.memoizedProps=n,t=t.child}return t;default:r("156")}},beginFailedWork:function(e,t,n){switch(t.tag){case 2:rt(t);break;case 3:c(t);break;default:r("157")}return t.effectTag|=64,null===e?t.child=null:t.child!==e.child&&(t.child=e.child),0===t.expirationTime||t.expirationTime>n?f(e,t):(t.firstEffect=null,t.lastEffect=null,t.child=null===e?_o(t,null,null,n):So(t,e.child,null,n),2===t.tag&&(e=t.stateNode,t.memoizedProps=e.props,t.memoizedState=e.state),t.child)}}}function Pt(e,t,n){function o(e){e.effectTag|=4}var a=e.createInstance,i=e.createTextInstance,u=e.appendInitialChild,l=e.finalizeInitialChildren,c=e.prepareUpdate,s=e.persistence,f=t.getRootHostContainer,p=t.popHostContext,d=t.getHostContext,h=t.popHostContainer,m=n.prepareToHydrateHostInstance,y=n.prepareToHydrateHostTextInstance,v=n.popHydrationState,g=void 0,b=void 0,w=void 0;return e.mutation?(g=function(){},b=function(e,t,n){(t.updateQueue=n)&&o(t)},w=function(e,t,n,r){n!==r&&o(t)}):r(s?"235":"236"),{completeWork:function(e,t,n){var s=t.pendingProps;switch(null===s?s=t.memoizedProps:2147483647===t.expirationTime&&2147483647!==n||(t.pendingProps=null),t.tag){case 1:return null;case 2:return et(t),null;case 3:return h(t),$e(mo,t),$e(ho,t),s=t.stateNode,s.pendingContext&&(s.context=s.pendingContext,s.pendingContext=null),null!==e&&null!==e.child||(v(t),t.effectTag&=-3),g(t),null;case 5:p(t),n=f();var C=t.type;if(null!==e&&null!=t.stateNode){var E=e.memoizedProps,x=t.stateNode,k=d();x=c(x,C,E,s,n,k),b(e,t,x,C,E,s,n),e.ref!==t.ref&&(t.effectTag|=128)}else{if(!s)return null===t.stateNode&&r("166"),null;if(e=d(),v(t))m(t,n,e)&&o(t);else{e=a(C,s,n,e,t);e:for(E=t.child;null!==E;){if(5===E.tag||6===E.tag)u(e,E.stateNode);else if(4!==E.tag&&null!==E.child){E.child.return=E,E=E.child;continue}if(E===t)break;for(;null===E.sibling;){if(null===E.return||E.return===t)break e;E=E.return}E.sibling.return=E.return,E=E.sibling}l(e,C,s,n)&&o(t),t.stateNode=e}null!==t.ref&&(t.effectTag|=128)}return null;case 6:if(e&&null!=t.stateNode)w(e,t,e.memoizedProps,s);else{if("string"!=typeof s)return null===t.stateNode&&r("166"),null;e=f(),n=d(),v(t)?y(t)&&o(t):t.stateNode=i(s,e,n,t)}return null;case 7:(s=t.memoizedProps)||r("165"),t.tag=8,C=[];e:for((E=t.stateNode)&&(E.return=t);null!==E;){if(5===E.tag||6===E.tag||4===E.tag)r("247");else if(9===E.tag)C.push(E.type);else if(null!==E.child){E.child.return=E,E=E.child;continue}for(;null===E.sibling;){if(null===E.return||E.return===t)break e;E=E.return}E.sibling.return=E.return,E=E.sibling}return E=s.handler,s=E(s.props,C),t.child=So(t,null!==e?e.child:null,s,n),t.child;case 8:return t.tag=7,null;case 9:case 10:return null;case 4:return h(t),g(t),null;case 0:r("167");default:r("156")}}}}function jt(e,t){function n(e){var n=e.ref;if(null!==n)try{n(null)}catch(n){t(e,n)}}function o(e){switch("function"==typeof yt&&yt(e),e.tag){case 2:n(e);var r=e.stateNode;if("function"==typeof r.componentWillUnmount)try{r.props=e.memoizedProps,r.state=e.memoizedState,r.componentWillUnmount()}catch(n){t(e,n)}break;case 5:n(e);break;case 7:a(e.stateNode);break;case 4:c&&u(e)}}function a(e){for(var t=e;;)if(o(t),null===t.child||c&&4===t.tag){if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return;t=t.return}t.sibling.return=t.return,t=t.sibling}else t.child.return=t,t=t.child}function i(e){return 5===e.tag||3===e.tag||4===e.tag}function u(e){for(var t=e,n=!1,i=void 0,u=void 0;;){if(!n){n=t.return;e:for(;;){switch(null===n&&r("160"),n.tag){case 5:i=n.stateNode,u=!1;break e;case 3:case 4:i=n.stateNode.containerInfo,u=!0;break e}n=n.return}n=!0}if(5===t.tag||6===t.tag)a(t),u?b(i,t.stateNode):g(i,t.stateNode);else if(4===t.tag?i=t.stateNode.containerInfo:o(t),null!==t.child){t.child.return=t,t=t.child;continue}if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return;t=t.return,4===t.tag&&(n=!1)}t.sibling.return=t.return,t=t.sibling}}var l=e.getPublicInstance,c=e.mutation;e=e.persistence,c||r(e?"235":"236");var s=c.commitMount,f=c.commitUpdate,p=c.resetTextContent,d=c.commitTextUpdate,h=c.appendChild,m=c.appendChildToContainer,y=c.insertBefore,v=c.insertInContainerBefore,g=c.removeChild,b=c.removeChildFromContainer;return{commitResetTextContent:function(e){p(e.stateNode)},commitPlacement:function(e){e:{for(var t=e.return;null!==t;){if(i(t)){var n=t;break e}t=t.return}r("160"),n=void 0}var o=t=void 0;switch(n.tag){case 5:t=n.stateNode,o=!1;break;case 3:case 4:t=n.stateNode.containerInfo,o=!0;break;default:r("161")}16&n.effectTag&&(p(t),n.effectTag&=-17);e:t:for(n=e;;){for(;null===n.sibling;){if(null===n.return||i(n.return)){n=null;break e}n=n.return}for(n.sibling.return=n.return,n=n.sibling;5!==n.tag&&6!==n.tag;){if(2&n.effectTag)continue t;if(null===n.child||4===n.tag)continue t;n.child.return=n,n=n.child}if(!(2&n.effectTag)){n=n.stateNode;break e}}for(var a=e;;){if(5===a.tag||6===a.tag)n?o?v(t,a.stateNode,n):y(t,a.stateNode,n):o?m(t,a.stateNode):h(t,a.stateNode);else if(4!==a.tag&&null!==a.child){a.child.return=a,a=a.child;continue}if(a===e)break;for(;null===a.sibling;){if(null===a.return||a.return===e)return;a=a.return}a.sibling.return=a.return,a=a.sibling}},commitDeletion:function(e){u(e),e.return=null,e.child=null,e.alternate&&(e.alternate.child=null,e.alternate.return=null)},commitWork:function(e,t){switch(t.tag){case 2:break;case 5:var n=t.stateNode;if(null!=n){var o=t.memoizedProps;e=null!==e?e.memoizedProps:o;var a=t.type,i=t.updateQueue;t.updateQueue=null,null!==i&&f(n,i,a,e,o,t)}break;case 6:null===t.stateNode&&r("162"),n=t.memoizedProps,d(t.stateNode,null!==e?e.memoizedProps:n,n);break;case 3:break;default:r("163")}},commitLifeCycles:function(e,t){switch(t.tag){case 2:var n=t.stateNode;if(4&t.effectTag)if(null===e)n.props=t.memoizedProps,n.state=t.memoizedState,n.componentDidMount();else{var o=e.memoizedProps;e=e.memoizedState,n.props=t.memoizedProps,n.state=t.memoizedState,n.componentDidUpdate(o,e)}t=t.updateQueue,null!==t&&Et(t,n);break;case 3:n=t.updateQueue,null!==n&&Et(n,null!==t.child?t.child.stateNode:null);break;case 5:n=t.stateNode,null===e&&4&t.effectTag&&s(n,t.type,t.memoizedProps,t);break;case 6:case 4:break;default:r("163")}},commitAttachRef:function(e){var t=e.ref;if(null!==t){var n=e.stateNode;switch(e.tag){case 5:t(l(n));break;default:t(n)}}},commitDetachRef:function(e){null!==(e=e.ref)&&e(null)}}}function Nt(e){function t(e){return e===Po&&r("174"),e}var n=e.getChildHostContext,o=e.getRootHostContext,a={current:Po},i={current:Po},u={current:Po};return{getHostContext:function(){return t(a.current)},getRootHostContainer:function(){return t(u.current)},popHostContainer:function(e){$e(a,e),$e(i,e),$e(u,e)},popHostContext:function(e){i.current===e&&($e(a,e),$e(i,e))},pushHostContainer:function(e,t){Ye(u,t,e),t=o(t),Ye(i,e,e),Ye(a,t,e)},pushHostContext:function(e){var r=t(u.current),o=t(a.current);r=n(o,e.type,r),o!==r&&(Ye(i,e,e),Ye(a,r,e))},resetHostContainer:function(){a.current=Po,u.current=Po}}}function It(e){function t(e,t){var n=new at(5,null,0);n.type="DELETED",n.stateNode=t,n.return=e,n.effectTag=8,null!==e.lastEffect?(e.lastEffect.nextEffect=n,e.lastEffect=n):e.firstEffect=e.lastEffect=n}function n(e,t){switch(e.tag){case 5:return null!==(t=i(t,e.type,e.pendingProps))&&(e.stateNode=t,!0);case 6:return null!==(t=u(t,e.pendingProps))&&(e.stateNode=t,!0);default:return!1}}function o(e){for(e=e.return;null!==e&&5!==e.tag&&3!==e.tag;)e=e.return;p=e}var a=e.shouldSetTextContent;if(!(e=e.hydration))return{enterHydrationState:function(){return!1},resetHydrationState:function(){},tryToClaimNextHydratableInstance:function(){},prepareToHydrateHostInstance:function(){r("175")},prepareToHydrateHostTextInstance:function(){r("176")},popHydrationState:function(){return!1}};var i=e.canHydrateInstance,u=e.canHydrateTextInstance,l=e.getNextHydratableSibling,c=e.getFirstHydratableChild,s=e.hydrateInstance,f=e.hydrateTextInstance,p=null,d=null,h=!1;return{enterHydrationState:function(e){return d=c(e.stateNode.containerInfo),p=e,h=!0},resetHydrationState:function(){d=p=null,h=!1},tryToClaimNextHydratableInstance:function(e){if(h){var r=d;if(r){if(!n(e,r)){if(!(r=l(r))||!n(e,r))return e.effectTag|=2,h=!1,void(p=e);t(p,d)}p=e,d=c(r)}else e.effectTag|=2,h=!1,p=e}},prepareToHydrateHostInstance:function(e,t,n){return t=s(e.stateNode,e.type,e.memoizedProps,t,n,e),e.updateQueue=t,null!==t},prepareToHydrateHostTextInstance:function(e){return f(e.stateNode,e.memoizedProps,e)},popHydrationState:function(e){if(e!==p)return!1;if(!h)return o(e),h=!0,!1;var n=e.type;if(5!==e.tag||"head"!==n&&"body"!==n&&!a(n,e.memoizedProps))for(n=d;n;)t(e,n),n=l(n);return o(e),d=p?l(e.stateNode):null,!0}}}function Dt(e){function t(e){ae=$=!0;var t=e.stateNode;if(t.current===e&&r("177"),t.isReadyForCommit=!1,zr.current=null,1i.expirationTime)&&(a=i.expirationTime),i=i.sibling;o.expirationTime=a}if(null!==t)return t;if(null!==n&&(null===n.firstEffect&&(n.firstEffect=e.firstEffect),null!==e.lastEffect&&(null!==n.lastEffect&&(n.lastEffect.nextEffect=e.firstEffect),n.lastEffect=e.lastEffect),1e))if(J<=G)for(;null!==Y;)Y=c(Y)?a(Y):o(Y);else for(;null!==Y&&!E();)Y=c(Y)?a(Y):o(Y)}else if(!(0===J||J>e))if(J<=G)for(;null!==Y;)Y=o(Y);else for(;null!==Y&&!E();)Y=o(Y)}function u(e,t){if($&&r("243"),$=!0,e.isReadyForCommit=!1,e!==X||t!==J||null===Y){for(;-1t)&&(e.expirationTime=t),null!==e.alternate&&(0===e.alternate.expirationTime||e.alternate.expirationTime>t)&&(e.alternate.expirationTime=t),null===e.return){if(3!==e.tag)break;var n=e.stateNode;!$&&n===X&&twe&&r("185"),null===o.nextScheduledRoot)o.remainingExpirationTime=a,null===le?(ue=le=o,o.nextScheduledRoot=o):(le=le.nextScheduledRoot=o,le.nextScheduledRoot=ue);else{var i=o.remainingExpirationTime;(0===i||ace)return;B(se)}var t=H()-W;ce=e,se=z(b,{timeout:10*(e-2)-t})}function g(){var e=0,t=null;if(null!==le)for(var n=le,o=ue;null!==o;){var a=o.remainingExpirationTime;if(0===a){if((null===n||null===le)&&r("244"),o===o.nextScheduledRoot){ue=le=o.nextScheduledRoot=null;break}if(o===ue)ue=a=o.nextScheduledRoot,le.nextScheduledRoot=a,o.nextScheduledRoot=null;else{if(o===le){le=n,le.nextScheduledRoot=ue,o.nextScheduledRoot=null;break}n.nextScheduledRoot=o.nextScheduledRoot,o.nextScheduledRoot=null}o=n.nextScheduledRoot}else{if((0===e||axe)&&(he=!0)}function x(e){null===pe&&r("246"),pe.remainingExpirationTime=0,me||(me=!0,ye=e)}var k=Nt(e),O=It(e),T=k.popHostContainer,S=k.popHostContext,_=k.resetHostContainer,P=_t(e,k,O,d,p),j=P.beginWork,N=P.beginFailedWork,I=Pt(e,k,O).completeWork;k=jt(e,l);var D=k.commitResetTextContent,M=k.commitPlacement,R=k.commitDeletion,A=k.commitWork,U=k.commitLifeCycles,L=k.commitAttachRef,F=k.commitDetachRef,H=e.now,z=e.scheduleDeferredCallback,B=e.cancelDeferredCallback,V=e.useSyncScheduling,q=e.prepareForCommit,K=e.resetAfterCommit,W=H(),G=2,Q=0,$=!1,Y=null,X=null,J=0,Z=null,ee=null,te=null,ne=null,re=null,oe=!1,ae=!1,ie=!1,ue=null,le=null,ce=0,se=-1,fe=!1,pe=null,de=0,he=!1,me=!1,ye=null,ve=null,ge=!1,be=!1,we=1e3,Ee=0,xe=1;return{computeAsyncExpiration:f,computeExpirationForFiber:p,scheduleWork:d,batchedUpdates:function(e,t){var n=ge;ge=!0;try{return e(t)}finally{(ge=n)||fe||w(1,null)}},unbatchedUpdates:function(e){if(ge&&!be){be=!0;try{return e()}finally{be=!1}}return e()},flushSync:function(e){var t=ge;ge=!0;try{e:{var n=Q;Q=1;try{var o=e();break e}finally{Q=n}o=void 0}return o}finally{ge=t,fe&&r("187"),w(1,null)}},deferredUpdates:function(e){var t=Q;Q=f();try{return e()}finally{Q=t}}}}function Mt(e){function t(e){return e=Te(e),null===e?null:e.stateNode}var n=e.getPublicInstance;e=Dt(e);var o=e.computeAsyncExpiration,a=e.computeExpirationForFiber,i=e.scheduleWork;return{createContainer:function(e,t){var n=new at(3,null,0);return e={current:n,containerInfo:e,pendingChildren:null,remainingExpirationTime:0,isReadyForCommit:!1,finishedWork:null,context:null,pendingContext:null,hydrate:t,nextScheduledRoot:null},n.stateNode=e},updateContainer:function(e,t,n,u){var l=t.current;if(n){n=n._reactInternalFiber;var c;e:{for(2===Ee(n)&&2===n.tag||r("170"),c=n;3!==c.tag;){if(Ze(c)){c=c.stateNode.__reactInternalMemoizedMergedChildContext;break e}(c=c.return)||r("171")}c=c.stateNode.context}n=Ze(n)?nt(n,c):c}else n=_n;null===t.context?t.context=n:t.pendingContext=n,t=u,t=void 0===t?null:t,u=null!=e&&null!=e.type&&null!=e.type.prototype&&!0===e.type.prototype.unstable_isAsyncReactComponent?o():a(l),bt(l,{expirationTime:u,partialState:{element:e},callback:t,isReplace:!1,isForced:!1,nextCallback:null,next:null}),i(l,u)},batchedUpdates:e.batchedUpdates,unbatchedUpdates:e.unbatchedUpdates,deferredUpdates:e.deferredUpdates,flushSync:e.flushSync,getPublicRootInstance:function(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return n(e.child.stateNode);default:return e.child.stateNode}},findHostInstance:t,findHostInstanceWithNoPortals:function(e){return e=Se(e),null===e?null:e.stateNode},injectIntoDevTools:function(e){var n=e.findFiberByHostInstance;return ht(Cn({},e,{findHostInstanceByFiber:function(e){return t(e)},findFiberByHostInstance:function(e){return n?n(e):null}}))}}}function Rt(e,t,n){var r=3n||r.hasOverloadedBooleanValue&&!1===n?Ft(e,t):r.mustUseProperty?e[r.propertyName]=n:(t=r.attributeName,(o=r.attributeNamespace)?e.setAttributeNS(o,t,""+n):r.hasBooleanValue||r.hasOverloadedBooleanValue&&!0===n?e.setAttribute(t,""):e.setAttribute(t,""+n))}else Lt(e,t,a(t,n)?n:null)}function Lt(e,t,n){At(t)&&(null==n?e.removeAttribute(t):e.setAttribute(t,""+n))}function Ft(e,t){var n=i(t);n?(t=n.mutationMethod)?t(e,void 0):n.mustUseProperty?e[n.propertyName]=!n.hasBooleanValue&&"":e.removeAttribute(n.attributeName):e.removeAttribute(t)}function Ht(e,t){var n=t.value,r=t.checked;return Cn({type:void 0,step:void 0,min:void 0,max:void 0},t,{defaultChecked:void 0,defaultValue:void 0,value:null!=n?n:e._wrapperState.initialValue,checked:null!=r?r:e._wrapperState.initialChecked})}function zt(e,t){var n=t.defaultValue;e._wrapperState={initialChecked:null!=t.checked?t.checked:t.defaultChecked,initialValue:null!=t.value?t.value:n,controlled:"checkbox"===t.type||"radio"===t.type?null!=t.checked:null!=t.value}}function Bt(e,t){null!=(t=t.checked)&&Ut(e,"checked",t)}function Vt(e,t){Bt(e,t);var n=t.value;null!=n?0===n&&""===e.value?e.value="0":"number"===t.type?(t=parseFloat(e.value)||0,(n!=t||n==t&&e.value!=n)&&(e.value=""+n)):e.value!==""+n&&(e.value=""+n):(null==t.value&&null!=t.defaultValue&&e.defaultValue!==""+t.defaultValue&&(e.defaultValue=""+t.defaultValue),null==t.checked&&null!=t.defaultChecked&&(e.defaultChecked=!!t.defaultChecked))}function qt(e,t){switch(t.type){case"submit":case"reset":break;case"color":case"date":case"datetime":case"datetime-local":case"month":case"time":case"week":e.value="",e.value=e.defaultValue;break;default:e.value=e.value}t=e.name,""!==t&&(e.name=""),e.defaultChecked=!e.defaultChecked,e.defaultChecked=!e.defaultChecked,""!==t&&(e.name=t)}function Kt(e){var t="";return bn.Children.forEach(e,function(e){null==e||"string"!=typeof e&&"number"!=typeof e||(t+=e)}),t}function Wt(e,t){return e=Cn({children:void 0},t),(t=Kt(t.children))&&(e.children=t),e}function Gt(e,t,n,r){if(e=e.options,t){t={};for(var o=0;o=t.length||r("93"),t=t[0]),n=""+t),null==n&&(n="")),e._wrapperState={initialValue:""+n}}function Xt(e,t){var n=t.value;null!=n&&(n=""+n,n!==e.value&&(e.value=n),null==t.defaultValue&&(e.defaultValue=n)),null!=t.defaultValue&&(e.defaultValue=t.defaultValue)}function Jt(e){var t=e.textContent;t===e._wrapperState.initialValue&&(e.value=t)}function Zt(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function en(e,t){return null==e||"http://www.w3.org/1999/xhtml"===e?Zt(t):"http://www.w3.org/2000/svg"===e&&"foreignObject"===t?"http://www.w3.org/1999/xhtml":e}function tn(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&3===n.nodeType)return void(n.nodeValue=t)}e.textContent=t}function nn(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=0===n.indexOf("--"),o=n,a=t[n];o=null==a||"boolean"==typeof a||""===a?"":r||"number"!=typeof a||0===a||Zo.hasOwnProperty(o)&&Zo[o]?(""+a).trim():a+"px","float"===n&&(n="cssFloat"),r?e.setProperty(n,o):e[n]=o}}function rn(e,t,n){t&&(ta[e]&&(null!=t.children||null!=t.dangerouslySetInnerHTML)&&r("137",e,n()),null!=t.dangerouslySetInnerHTML&&(null!=t.children&&r("60"),"object"==typeof t.dangerouslySetInnerHTML&&"__html"in t.dangerouslySetInnerHTML||r("61")),null!=t.style&&"object"!=typeof t.style&&r("62",n()))}function on(e,t){if(-1===e.indexOf("-"))return"string"==typeof t.is;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}function an(e,t){e=9===e.nodeType||11===e.nodeType?e:e.ownerDocument;var n=Re(e);t=Yn[t];for(var r=0;r<\/script>",e=e.removeChild(e.firstChild)):e="string"==typeof t.is?n.createElement(e,{is:t.is}):n.createElement(e):e=n.createElementNS(r,e),e}function ln(e,t){return(9===t.nodeType?t:t.ownerDocument).createTextNode(e)}function cn(e,t,n,r){var o=on(t,n);switch(t){case"iframe":case"object":je("topLoad","load",e);var a=n;break;case"video":case"audio":for(a in oa)oa.hasOwnProperty(a)&&je(a,oa[a],e);a=n;break;case"source":je("topError","error",e),a=n;break;case"img":case"image":je("topError","error",e),je("topLoad","load",e),a=n;break;case"form":je("topReset","reset",e),je("topSubmit","submit",e),a=n;break;case"details":je("topToggle","toggle",e),a=n;break;case"input":zt(e,n),a=Ht(e,n),je("topInvalid","invalid",e),an(r,"onChange");break;case"option":a=Wt(e,n);break;case"select":Qt(e,n),a=Cn({},n,{value:void 0}),je("topInvalid","invalid",e),an(r,"onChange");break;case"textarea":Yt(e,n),a=$t(e,n),je("topInvalid","invalid",e),an(r,"onChange");break;default:a=n}rn(t,a,ra);var i,u=a;for(i in u)if(u.hasOwnProperty(i)){var l=u[i];"style"===i?nn(e,l,ra):"dangerouslySetInnerHTML"===i?null!=(l=l?l.__html:void 0)&&Jo(e,l):"children"===i?"string"==typeof l?("textarea"!==t||""!==l)&&tn(e,l):"number"==typeof l&&tn(e,""+l):"suppressContentEditableWarning"!==i&&"suppressHydrationWarning"!==i&&"autoFocus"!==i&&($n.hasOwnProperty(i)?null!=l&&an(r,i):o?Lt(e,i,l):null!=l&&Ut(e,i,l))}switch(t){case"input":ae(e),qt(e,n);break;case"textarea":ae(e),Jt(e,n);break;case"option":null!=n.value&&e.setAttribute("value",n.value);break;case"select":e.multiple=!!n.multiple,t=n.value,null!=t?Gt(e,!!n.multiple,t,!1):null!=n.defaultValue&&Gt(e,!!n.multiple,n.defaultValue,!0);break;default:"function"==typeof a.onClick&&(e.onclick=En)}}function sn(e,t,n,r,o){var a=null;switch(t){case"input":n=Ht(e,n),r=Ht(e,r),a=[];break;case"option":n=Wt(e,n),r=Wt(e,r),a=[];break;case"select":n=Cn({},n,{value:void 0}),r=Cn({},r,{value:void 0}),a=[];break;case"textarea":n=$t(e,n),r=$t(e,r),a=[];break;default:"function"!=typeof n.onClick&&"function"==typeof r.onClick&&(e.onclick=En)}rn(t,r,ra);var i,u;e=null;for(i in n)if(!r.hasOwnProperty(i)&&n.hasOwnProperty(i)&&null!=n[i])if("style"===i)for(u in t=n[i])t.hasOwnProperty(u)&&(e||(e={}),e[u]="");else"dangerouslySetInnerHTML"!==i&&"children"!==i&&"suppressContentEditableWarning"!==i&&"suppressHydrationWarning"!==i&&"autoFocus"!==i&&($n.hasOwnProperty(i)?a||(a=[]):(a=a||[]).push(i,null));for(i in r){var l=r[i];if(t=null!=n?n[i]:void 0,r.hasOwnProperty(i)&&l!==t&&(null!=l||null!=t))if("style"===i)if(t){for(u in t)!t.hasOwnProperty(u)||l&&l.hasOwnProperty(u)||(e||(e={}),e[u]="");for(u in l)l.hasOwnProperty(u)&&t[u]!==l[u]&&(e||(e={}),e[u]=l[u])}else e||(a||(a=[]),a.push(i,e)),e=l;else"dangerouslySetInnerHTML"===i?(l=l?l.__html:void 0,t=t?t.__html:void 0,null!=l&&t!==l&&(a=a||[]).push(i,""+l)):"children"===i?t===l||"string"!=typeof l&&"number"!=typeof l||(a=a||[]).push(i,""+l):"suppressContentEditableWarning"!==i&&"suppressHydrationWarning"!==i&&($n.hasOwnProperty(i)?(null!=l&&an(o,i),a||t===l||(a=[])):(a=a||[]).push(i,l))}return e&&(a=a||[]).push("style",e),a}function fn(e,t,n,r,o){"input"===n&&"radio"===o.type&&null!=o.name&&Bt(e,o),on(n,r),r=on(n,o);for(var a=0;a=l.hasBooleanValue+l.hasNumericValue+l.hasOverloadedBooleanValue||r("50",u),i.hasOwnProperty(u)&&(l.attributeName=i[u]),a.hasOwnProperty(u)&&(l.attributeNamespace=a[u]),e.hasOwnProperty(u)&&(l.mutationMethod=e[u]),Nn[u]=l}}},Nn={},In=jn,Dn=In.MUST_USE_PROPERTY,Mn=In.HAS_BOOLEAN_VALUE,Rn=In.HAS_NUMERIC_VALUE,An=In.HAS_POSITIVE_NUMERIC_VALUE,Un=In.HAS_OVERLOADED_BOOLEAN_VALUE,Ln=In.HAS_STRING_BOOLEAN_VALUE,Fn={Properties:{allowFullScreen:Mn,async:Mn,autoFocus:Mn,autoPlay:Mn,capture:Un,checked:Dn|Mn,cols:An,contentEditable:Ln,controls:Mn,default:Mn,defer:Mn,disabled:Mn,download:Un,draggable:Ln,formNoValidate:Mn,hidden:Mn,loop:Mn,multiple:Dn|Mn,muted:Dn|Mn,noValidate:Mn,open:Mn,playsInline:Mn,readOnly:Mn,required:Mn,reversed:Mn,rows:An,rowSpan:Rn,scoped:Mn,seamless:Mn,selected:Dn|Mn,size:An,start:Rn,span:An,spellCheck:Ln,style:0,tabIndex:0,itemScope:Mn,acceptCharset:0,className:0,htmlFor:0,httpEquiv:0,value:Ln},DOMAttributeNames:{acceptCharset:"accept-charset",className:"class",htmlFor:"for",httpEquiv:"http-equiv"},DOMMutationMethods:{value:function(e,t){if(null==t)return e.removeAttribute("value");"number"!==e.type||!1===e.hasAttribute("value")?e.setAttribute("value",""+t):e.validity&&!e.validity.badInput&&e.ownerDocument.activeElement!==e&&e.setAttribute("value",""+t)}}},Hn=In.HAS_STRING_BOOLEAN_VALUE,zn={xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace"},Bn={Properties:{autoReverse:Hn,externalResourcesRequired:Hn,preserveAlpha:Hn},DOMAttributeNames:{autoReverse:"autoReverse",externalResourcesRequired:"externalResourcesRequired",preserveAlpha:"preserveAlpha"},DOMAttributeNamespaces:{xlinkActuate:zn.xlink,xlinkArcrole:zn.xlink,xlinkHref:zn.xlink,xlinkRole:zn.xlink,xlinkShow:zn.xlink,xlinkTitle:zn.xlink,xlinkType:zn.xlink,xmlBase:zn.xml,xmlLang:zn.xml,xmlSpace:zn.xml}},Vn=/[\-\:]([a-z])/g;"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode x-height xlink:actuate xlink:arcrole xlink:href xlink:role xlink:show xlink:title xlink:type xml:base xmlns:xlink xml:lang xml:space".split(" ").forEach(function(e){var t=e.replace(Vn,u);Bn.Properties[t]=0,Bn.DOMAttributeNames[t]=e}),In.injectDOMPropertyConfig(Fn),In.injectDOMPropertyConfig(Bn);var qn={_caughtError:null,_hasCaughtError:!1,_rethrowError:null,_hasRethrowError:!1,injection:{injectErrorUtils:function(e){"function"!=typeof e.invokeGuardedCallback&&r("197"),l=e.invokeGuardedCallback}},invokeGuardedCallback:function(e,t,n,r,o,a,i,u,c){l.apply(qn,arguments)},invokeGuardedCallbackAndCatchFirstError:function(e,t,n,r,o,a,i,u,l){if(qn.invokeGuardedCallback.apply(this,arguments),qn.hasCaughtError()){var c=qn.clearCaughtError();qn._hasRethrowError||(qn._hasRethrowError=!0,qn._rethrowError=c)}},rethrowCaughtError:function(){return c.apply(qn,arguments)},hasCaughtError:function(){return qn._hasCaughtError},clearCaughtError:function(){if(qn._hasCaughtError){var e=qn._caughtError;return qn._caughtError=null,qn._hasCaughtError=!1,e}r("198")}},Kn=null,Wn={},Gn=[],Qn={},$n={},Yn={},Xn=Object.freeze({plugins:Gn,eventNameDispatchConfigs:Qn,registrationNameModules:$n,registrationNameDependencies:Yn,possibleRegistrationNames:null,injectEventPluginOrder:p,injectEventPluginsByName:d}),Jn=null,Zn=null,er=null,tr=null,nr={injectEventPluginOrder:p,injectEventPluginsByName:d},rr=Object.freeze({injection:nr,getListener:w,extractEvents:C,enqueueEvents:E,processEventQueue:x}),or=Math.random().toString(36).slice(2),ar="__reactInternalInstance$"+or,ir="__reactEventHandlers$"+or,ur=Object.freeze({precacheFiberNode:function(e,t){t[ar]=e},getClosestInstanceFromNode:k,getInstanceFromNode:function(e){return e=e[ar],!e||5!==e.tag&&6!==e.tag?null:e},getNodeFromInstance:O,getFiberCurrentPropsFromNode:T,updateFiberProps:function(e,t){e[ir]=t}}),lr=Object.freeze({accumulateTwoPhaseDispatches:M,accumulateTwoPhaseDispatchesSkipTarget:function(e){y(e,N)},accumulateEnterLeaveDispatches:R,accumulateDirectDispatches:function(e){y(e,D)}}),cr=null,sr={_root:null,_startText:null,_fallbackText:null},fr="dispatchConfig _targetInst nativeEvent isDefaultPrevented isPropagationStopped _dispatchListeners _dispatchInstances".split(" "),pr={type:null,target:null,currentTarget:En.thatReturnsNull,eventPhase:null,bubbles:null,cancelable:null,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:null,isTrusted:null};Cn(F.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():"unknown"!=typeof e.returnValue&&(e.returnValue=!1),this.isDefaultPrevented=En.thatReturnsTrue)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():"unknown"!=typeof e.cancelBubble&&(e.cancelBubble=!0),this.isPropagationStopped=En.thatReturnsTrue)},persist:function(){this.isPersistent=En.thatReturnsTrue},isPersistent:En.thatReturnsFalse,destructor:function(){var e,t=this.constructor.Interface;for(e in t)this[e]=null;for(t=0;t=parseInt(vr.version(),10))}var gr,br=yr,wr=wn.canUseDOM&&(!hr||mr&&8=mr),Cr=String.fromCharCode(32),Er={beforeInput:{phasedRegistrationNames:{bubbled:"onBeforeInput",captured:"onBeforeInputCapture"},dependencies:["topCompositionEnd","topKeyPress","topTextInput","topPaste"]},compositionEnd:{phasedRegistrationNames:{bubbled:"onCompositionEnd",captured:"onCompositionEndCapture"},dependencies:"topBlur topCompositionEnd topKeyDown topKeyPress topKeyUp topMouseDown".split(" ")},compositionStart:{phasedRegistrationNames:{bubbled:"onCompositionStart",captured:"onCompositionStartCapture"},dependencies:"topBlur topCompositionStart topKeyDown topKeyPress topKeyUp topMouseDown".split(" ")},compositionUpdate:{phasedRegistrationNames:{bubbled:"onCompositionUpdate",captured:"onCompositionUpdateCapture"},dependencies:"topBlur topCompositionUpdate topKeyDown topKeyPress topKeyUp topMouseDown".split(" ")}},xr=!1,kr=!1,Or={eventTypes:Er,extractEvents:function(e,t,n,r){var o;if(hr)e:{switch(e){case"topCompositionStart":var a=Er.compositionStart;break e;case"topCompositionEnd":a=Er.compositionEnd;break e;case"topCompositionUpdate":a=Er.compositionUpdate;break e}a=void 0}else kr?K(e,n)&&(a=Er.compositionEnd):"topKeyDown"===e&&229===n.keyCode&&(a=Er.compositionStart);return a?(wr&&(kr||a!==Er.compositionStart?a===Er.compositionEnd&&kr&&(o=U()):(sr._root=r,sr._startText=L(),kr=!0)),a=V.getPooled(a,t,n,r),o?a.data=o:null!==(o=W(n))&&(a.data=o),M(a),o=a):o=null,(e=br?G(e,n):Q(e,n))?(t=q.getPooled(Er.beforeInput,t,n,r),t.data=e,M(t)):t=null,[o,t]}},Tr=null,Sr=null,_r=null,Pr={injectFiberControlledHostComponent:function(e){Tr=e}},jr=Object.freeze({injection:Pr,enqueueStateRestore:Y,restoreStateIfNeeded:X}),Nr=!1,Ir={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};wn.canUseDOM&&(gr=document.implementation&&document.implementation.hasFeature&&!0!==document.implementation.hasFeature("",""));var Dr={change:{phasedRegistrationNames:{bubbled:"onChange",captured:"onChangeCapture"},dependencies:"topBlur topChange topClick topFocus topInput topKeyDown topKeyUp topSelectionChange".split(" ")}},Mr=null,Rr=null,Ar=!1;wn.canUseDOM&&(Ar=ne("input")&&(!document.documentMode||9=document.documentMode,eo={select:{phasedRegistrationNames:{bubbled:"onSelect",captured:"onSelectCapture"},dependencies:"topBlur topContextMenu topFocus topKeyDown topKeyUp topMouseDown topMouseUp topSelectionChange".split(" ")}},to=null,no=null,ro=null,oo=!1,ao={eventTypes:eo,extractEvents:function(e,t,n,r){var o,a=r.window===r?r.document:9===r.nodeType?r:r.ownerDocument;if(!(o=!a)){e:{a=Re(a),o=Yn.onSelect;for(var i=0;i=Bo-e){if(!(-1!==Ho&&Ho<=e))return void(zo||(zo=!0,requestAnimationFrame(Wo)));Uo.didTimeout=!0}else Uo.didTimeout=!1;Ho=-1,e=Lo,Lo=null,null!==e&&e(Uo)}},!1);var Wo=function(e){zo=!1;var t=e-Bo+qo;tt&&(t=8),qo=t"+t+"",t=Xo.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}}),Zo={animationIterationCount:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},ea=["Webkit","ms","Moz","O"];Object.keys(Zo).forEach(function(e){ea.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Zo[t]=Zo[e]})});var ta=Cn({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0}),na=Yo.html,ra=En.thatReturns(""),oa={topAbort:"abort",topCanPlay:"canplay",topCanPlayThrough:"canplaythrough",topDurationChange:"durationchange",topEmptied:"emptied",topEncrypted:"encrypted",topEnded:"ended",topError:"error",topLoadedData:"loadeddata",topLoadedMetadata:"loadedmetadata",topLoadStart:"loadstart",topPause:"pause",topPlay:"play",topPlaying:"playing",topProgress:"progress",topRateChange:"ratechange",topSeeked:"seeked",topSeeking:"seeking",topStalled:"stalled",topSuspend:"suspend",topTimeUpdate:"timeupdate",topVolumeChange:"volumechange",topWaiting:"waiting"},aa=Object.freeze({createElement:un,createTextNode:ln,setInitialProperties:cn,diffProperties:sn,updateProperties:fn,diffHydratedProperties:pn,diffHydratedText:dn,warnForUnmatchedText:function(){},warnForDeletedHydratableElement:function(){},warnForDeletedHydratableText:function(){},warnForInsertedHydratedElement:function(){},warnForInsertedHydratedText:function(){},restoreControlledState:function(e,t,n){switch(t){case"input":if(Vt(e,n),t=n.name,"radio"===n.type&&null!=t){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;tr&&(o=r,r=e,e=o),o=Ue(n,e);var a=Ue(n,r);if(o&&a&&(1!==t.rangeCount||t.anchorNode!==o.node||t.anchorOffset!==o.offset||t.focusNode!==a.node||t.focusOffset!==a.offset)){var i=document.createRange();i.setStart(o.node,o.offset),t.removeAllRanges(),e>r?(t.addRange(i),t.extend(a.node,a.offset)):(i.setEnd(a.node,a.offset),t.addRange(i))}}for(t=[],e=n;e=e.parentNode;)1===e.nodeType&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(Sn(n),n=0;n0&&void 0!==arguments[0]?arguments[0]:"store",n=arguments[1],i=n||t+"Subscription",l=function(e){function n(a,i){r(this,n);var u=o(this,e.call(this,a,i));return u[t]=a.store,u}return a(n,e),n.prototype.getChildContext=function(){var e;return e={},e[t]=this[t],e[i]=null,e},n.prototype.render=function(){return u.Children.only(this.props.children)},n}(u.Component);return l.propTypes={store:s.a.isRequired,children:c.a.element.isRequired},l.childContextTypes=(e={},e[t]=s.a.isRequired,e[i]=s.b,e),l}t.a=i;var u=n(1),l=(n.n(u),n(14)),c=n.n(l),s=n(15);n(7);t.b=i()},function(e,t,n){"use strict";var r=n(5),o=n(51),a=n(52);e.exports=function(){function e(e,t,n,r,i,u){u!==a&&o(!1,"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")}function t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t};return n.checkPropTypes=r,n.PropTypes=n,n}},function(e,t,n){"use strict";function r(e,t,n,r,a,i,u,l){if(o(t),!e){var c;if(void 0===t)c=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var s=[n,r,a,i,u,l],f=0;c=new Error(t.replace(/%s/g,function(){return s[f++]})),c.name="Invariant Violation"}throw c.framesToPop=1,c}}var o=function(e){};e.exports=r},function(e,t,n){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(e,t,n){!function(t,n){e.exports=n()}(0,function(){"use strict";var e={childContextTypes:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},t={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},n=Object.defineProperty,r=Object.getOwnPropertyNames,o=Object.getOwnPropertySymbols,a=Object.getOwnPropertyDescriptor,i=Object.getPrototypeOf,u=i&&i(Object);return function l(c,s,f){if("string"!=typeof s){if(u){var p=i(s);p&&p!==u&&l(c,p,f)}var d=r(s);o&&(d=d.concat(o(s)));for(var h=0;h=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function o(e,t,n){for(var r=t.length-1;r>=0;r--){var o=t[r](e);if(o)return o}return function(t,r){throw new Error("Invalid value of type "+typeof e+" for "+n+" argument when connecting component "+r.wrappedComponentName+".")}}function a(e,t){return e===t}var i=n(16),u=n(57),l=n(58),c=n(83),s=n(84),f=n(85),p=Object.assign||function(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:{},t=e.connectHOC,n=void 0===t?i.a:t,d=e.mapStateToPropsFactories,h=void 0===d?c.a:d,m=e.mapDispatchToPropsFactories,y=void 0===m?l.a:m,v=e.mergePropsFactories,g=void 0===v?s.a:v,b=e.selectorFactory,w=void 0===b?f.a:b;return function(e,t,i){var l=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},c=l.pure,s=void 0===c||c,f=l.areStatesEqual,d=void 0===f?a:f,m=l.areOwnPropsEqual,v=void 0===m?u.a:m,b=l.areStatePropsEqual,C=void 0===b?u.a:b,E=l.areMergedPropsEqual,x=void 0===E?u.a:E,k=r(l,["pure","areStatesEqual","areOwnPropsEqual","areStatePropsEqual","areMergedPropsEqual"]),O=o(e,h,"mapStateToProps"),T=o(t,y,"mapDispatchToProps"),S=o(i,g,"mergeProps");return n(w,p({methodName:"connect",getDisplayName:function(e){return"Connect("+e+")"},shouldHandleStateChanges:Boolean(e),initMapStateToProps:O,initMapDispatchToProps:T,initMergeProps:S,pure:s,areStatesEqual:d,areOwnPropsEqual:v,areStatePropsEqual:C,areMergedPropsEqual:x},k))}}()},function(e,t,n){"use strict";function r(e,t){return e===t?0!==e||0!==t||1/e==1/t:e!==e&&t!==t}function o(e,t){if(r(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;var n=Object.keys(e),o=Object.keys(t);if(n.length!==o.length)return!1;for(var i=0;i0&&void 0!==arguments[0]?arguments[0]:{},t=arguments[1];if(l)throw l;for(var o=!1,a={},i=0;i=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function o(e,t,n,r){return function(o,a){return n(e(o,a),t(r,a),a)}}function a(e,t,n,r,o){function a(o,a){return h=o,m=a,y=e(h,m),v=t(r,m),g=n(y,v,m),d=!0,g}function i(){return y=e(h,m),t.dependsOnOwnProps&&(v=t(r,m)),g=n(y,v,m)}function u(){return e.dependsOnOwnProps&&(y=e(h,m)),t.dependsOnOwnProps&&(v=t(r,m)),g=n(y,v,m)}function l(){var t=e(h,m),r=!p(t,y);return y=t,r&&(g=n(y,v,m)),g}function c(e,t){var n=!f(t,m),r=!s(e,h);return h=e,m=t,n&&r?i():n?u():r?l():g}var s=o.areStatesEqual,f=o.areOwnPropsEqual,p=o.areStatePropsEqual,d=!1,h=void 0,m=void 0,y=void 0,v=void 0,g=void 0;return function(e,t){return d?c(e,t):a(e,t)}}function i(e,t){var n=t.initMapStateToProps,i=t.initMapDispatchToProps,u=t.initMergeProps,l=r(t,["initMapStateToProps","initMapDispatchToProps","initMergeProps"]),c=n(e,l),s=i(e,l),f=u(e,l);return(l.pure?a:o)(c,s,f,e,l)}t.a=i;n(86)},function(e,t,n){"use strict";n(7)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u,l,c=function(){function e(e,t){for(var n=0;n 26 | * @license MIT 27 | */ 28 | e.exports=function(e){return null!=e&&(n(e)||r(e)||!!e._isBuffer)}},function(e,t,n){"use strict";function r(e){this.defaults=e,this.interceptors={request:new i,response:new i}}var o=n(11),a=n(0),i=n(105),u=n(106);r.prototype.request=function(e){"string"==typeof e&&(e=a.merge({url:arguments[0]},arguments[1])),e=a.merge(o,this.defaults,{method:"get"},e),e.method=e.method.toLowerCase();var t=[u,void 0],n=Promise.resolve(e);for(this.interceptors.request.forEach(function(e){t.unshift(e.fulfilled,e.rejected)}),this.interceptors.response.forEach(function(e){t.push(e.fulfilled,e.rejected)});t.length;)n=n.then(t.shift(),t.shift());return n},a.forEach(["delete","get","head","options"],function(e){r.prototype[e]=function(t,n){return this.request(a.merge(n||{},{method:e,url:t}))}}),a.forEach(["post","put","patch"],function(e){r.prototype[e]=function(t,n,r){return this.request(a.merge(r||{},{method:e,url:t,data:n}))}}),e.exports=r},function(e,t){function n(){throw new Error("setTimeout has not been defined")}function r(){throw new Error("clearTimeout has not been defined")}function o(e){if(s===setTimeout)return setTimeout(e,0);if((s===n||!s)&&setTimeout)return s=setTimeout,setTimeout(e,0);try{return s(e,0)}catch(t){try{return s.call(null,e,0)}catch(t){return s.call(this,e,0)}}}function a(e){if(f===clearTimeout)return clearTimeout(e);if((f===r||!f)&&clearTimeout)return f=clearTimeout,clearTimeout(e);try{return f(e)}catch(t){try{return f.call(null,e)}catch(t){return f.call(this,e)}}}function i(){m&&d&&(m=!1,d.length?h=d.concat(h):y=-1,h.length&&u())}function u(){if(!m){var e=o(i);m=!0;for(var t=h.length;t;){for(d=h,h=[];++y1)for(var n=1;n=0)return;i[t]="set-cookie"===t?(i[t]?i[t]:[]).concat([n]):i[t]?i[t]+", "+n:n}}),i):i}},function(e,t,n){"use strict";var r=n(0);e.exports=r.isStandardBrowserEnv()?function(){function e(e){var t=e;return n&&(o.setAttribute("href",t),t=o.href),o.setAttribute("href",t),{href:o.href,protocol:o.protocol?o.protocol.replace(/:$/,""):"",host:o.host,search:o.search?o.search.replace(/^\?/,""):"",hash:o.hash?o.hash.replace(/^#/,""):"",hostname:o.hostname,port:o.port,pathname:"/"===o.pathname.charAt(0)?o.pathname:"/"+o.pathname}}var t,n=/(msie|trident)/i.test(navigator.userAgent),o=document.createElement("a");return t=e(window.location.href),function(n){var o=r.isString(n)?e(n):n;return o.protocol===t.protocol&&o.host===t.host}}():function(){return function(){return!0}}()},function(e,t,n){"use strict";function r(){this.message="String contains an invalid character"}function o(e){for(var t,n,o=String(e),i="",u=0,l=a;o.charAt(0|u)||(l="=",u%1);i+=l.charAt(63&t>>8-u%1*8)){if((n=o.charCodeAt(u+=.75))>255)throw new r;t=t<<8|n}return i}var a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";r.prototype=new Error,r.prototype.code=5,r.prototype.name="InvalidCharacterError",e.exports=o},function(e,t,n){"use strict";var r=n(0);e.exports=r.isStandardBrowserEnv()?function(){return{write:function(e,t,n,o,a,i){var u=[];u.push(e+"="+encodeURIComponent(t)),r.isNumber(n)&&u.push("expires="+new Date(n).toGMTString()),r.isString(o)&&u.push("path="+o),r.isString(a)&&u.push("domain="+a),!0===i&&u.push("secure"),document.cookie=u.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}()},function(e,t,n){"use strict";function r(){this.handlers=[]}var o=n(0);r.prototype.use=function(e,t){return this.handlers.push({fulfilled:e,rejected:t}),this.handlers.length-1},r.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},r.prototype.forEach=function(e){o.forEach(this.handlers,function(t){null!==t&&e(t)})},e.exports=r},function(e,t,n){"use strict";function r(e){e.cancelToken&&e.cancelToken.throwIfRequested()}var o=n(0),a=n(107),i=n(28),u=n(11),l=n(108),c=n(109);e.exports=function(e){return r(e),e.baseURL&&!l(e.url)&&(e.url=c(e.baseURL,e.url)),e.headers=e.headers||{},e.data=a(e.data,e.headers,e.transformRequest),e.headers=o.merge(e.headers.common||{},e.headers[e.method]||{},e.headers||{}),o.forEach(["delete","get","head","post","put","patch","common"],function(t){delete e.headers[t]}),(e.adapter||u.adapter)(e).then(function(t){return r(e),t.data=a(t.data,t.headers,e.transformResponse),t},function(t){return i(t)||(r(e),t&&t.response&&(t.response.data=a(t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)})}},function(e,t,n){"use strict";var r=n(0);e.exports=function(e,t,n){return r.forEach(n,function(n){e=n(e,t)}),e}},function(e,t,n){"use strict";e.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}},function(e,t,n){"use strict";e.exports=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}},function(e,t,n){"use strict";function r(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise(function(e){t=e});var n=this;e(function(e){n.reason||(n.reason=new o(e),t(n.reason))})}var o=n(29);r.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},r.source=function(){var e;return{token:new r(function(t){e=t}),cancel:e}},e.exports=r},function(e,t,n){"use strict";e.exports=function(e){return function(t){return e.apply(null,t)}}},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i,u,l=function(){function e(e,t){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{},n=t.stateReconciler||a;return function(t){return function(n,r,o){var a=t(e(n),r,o);return c({},a,{replaceReducer:function(t){return a.replaceReducer(e(t))}})}}}function o(e){var t=e.slice(1);t.length>0&&console.log("\n redux-persist/autoRehydrate: %d actions were fired before rehydration completed. This can be a symptom of a race\n condition where the rehydrate action may overwrite the previously affected state. Consider running these actions\n after rehydration:\n ",t.length,t)}function a(e,t,n,r){var o=c({},n);return Object.keys(t).forEach(function(a){if(e.hasOwnProperty(a)){if("object"===l(e[a])&&!t[a])return void(r&&console.log("redux-persist/autoRehydrate: sub state for key `%s` is falsy but initial state is an object, skipping autoRehydrate.",a));if(e[a]!==n[a])return r&&console.log("redux-persist/autoRehydrate: sub state for key `%s` modified, skipping autoRehydrate.",a),void(o[a]=n[a]);Object(u.a)(t[a])&&Object(u.a)(e[a])?o[a]=c({},e[a],t[a]):o[a]=t[a],r&&console.log("redux-persist/autoRehydrate: key `%s`, rehydrated to ",a,o[a])}}),o}t.a=r;var i=n(4),u=n(115),l="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},c=Object.assign||function(e){for(var t=1;t0){var i=n.indexOf(this);~i?n.splice(i+1):n.push(this),~i?r.splice(i,1/0,o):r.push(o),~n.indexOf(a)&&(a=t.call(this,o,a))}else n.push(a);return null==e?a:e.call(this,o,a)}}t=e.exports=n,t.getSerialize=r},function(e,t,n){"use strict";function r(e,t){function n(e){return!(!o||-1!==o.indexOf(e))||!(!a||-1===a.indexOf(e))}var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=r.whitelist||null,a=r.blacklist||null;return{in:function(t,r){return!n(r)&&e?e(t,r):t},out:function(e,r){return!n(r)&&t?t(e,r):e}}}t.a=r},function(e,t,n){"use strict";function r(e){function t(e,t){f.resume(),r&&r(e,t)}var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments[2],a=!n.skipRestore,s=null,f=Object(u.a)(e,n);return f.pause(),a?Object(l.a)(function(){Object(i.a)(n,function(n,r){if(n)return void t(n);s&&("*"===s?r={}:s.forEach(function(e){return delete r[e]}));try{e.dispatch(o(r,n))}finally{t(n,r)}})}):Object(l.a)(t),c({},f,{purge:function(e){return s=e||"*",f.purge(e)}})}function o(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return{type:a.b,payload:e,error:t}}t.a=r;var a=n(4),i=n(35),u=n(31),l=n(33),c=Object.assign||function(e){for(var t=1;t=t.length?n(new u(h,w,new i(void 0,e[w]))):s(e[w],t[w],n,r,h,w,d);for(;w=0?(s(e[o],t[o],n,r,h,o,d),E=l(E,i)):s(e[o],void 0,n,r,h,o,d)}),E.forEach(function(e){s(void 0,t[e],n,r,h,e,d)})}d.length=d.length-1}else e!==t&&("number"===y&&isNaN(e)&&isNaN(t)||n(new o(h,e,t)))}function f(e,t,n,r){return r=r||[],s(e,t,function(e){e&&r.push(e)},n),r.length?r:void 0}function p(e,t,n){if(n.path&&n.path.length){var r,o=e[t],a=n.path.length-1;for(r=0;r0&&void 0!==arguments[0]?arguments[0]:{},t=Object.assign({},M,e),n=t.logger,r=t.stateTransformer,o=t.errorTransformer,a=t.predicate,i=t.logErrors,u=t.diffPredicate;if(void 0===n)return function(){return function(e){return function(t){return e(t)}}};if(e.getState&&e.dispatch)return console.error("[redux-logger] redux-logger not installed. Make sure to pass logger instance as middleware:\n// Logger with default options\nimport { logger } from 'redux-logger'\nconst store = createStore(\n reducer,\n applyMiddleware(logger)\n)\n// Or you can create your own logger with custom options http://bit.ly/redux-logger-options\nimport createLogger from 'redux-logger'\nconst logger = createLogger({\n // ...options\n});\nconst store = createStore(\n reducer,\n applyMiddleware(logger)\n)\n"),function(){return function(e){return function(t){return e(t)}}};var l=[];return function(e){var n=e.getState;return function(e){return function(c){if("function"==typeof a&&!a(n,c))return e(c);var s={};l.push(s),s.started=P.now(),s.startedTime=new Date,s.prevState=r(n()),s.action=c;var f=void 0;if(i)try{f=e(c)}catch(e){s.error=o(e)}else f=e(c);s.took=P.now()-s.started,s.nextState=r(n());var p=t.diff&&"function"==typeof u?u(n,c):t.diff;if(E(l,Object.assign({},t,{diff:p})),l.length=0,s.error)throw s.error;return f}}}}var k,O,T=function(e,t){return new Array(t+1).join(e)},S=function(e,t){return T("0",t-e.toString().length)+e},_=function(e){return S(e.getHours(),2)+":"+S(e.getMinutes(),2)+":"+S(e.getSeconds(),2)+"."+S(e.getMilliseconds(),3)},P="undefined"!=typeof performance&&null!==performance&&"function"==typeof performance.now?performance:Date,j="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},N=function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t0&&void 0!==arguments[0]?arguments[0]:{},t=e.dispatch,n=e.getState;return"function"==typeof t||"function"==typeof n?x()({dispatch:t,getState:n}):void console.error("\n[redux-logger v3] BREAKING CHANGE\n[redux-logger v3] Since 3.0.0 redux-logger exports by default logger with default settings.\n[redux-logger v3] Change\n[redux-logger v3] import createLogger from 'redux-logger'\n[redux-logger v3] to\n[redux-logger v3] import { createLogger } from 'redux-logger'\n")};t.defaults=M,t.createLogger=x,t.logger=R,t.default=R,Object.defineProperty(t,"__esModule",{value:!0})})}).call(t,n(3))},function(e,t,n){"use strict";function r(e){return function(t){var n=t.dispatch,r=t.getState;return function(t){return function(o){return"function"==typeof o?o(n,r,e):t(o)}}}}t.__esModule=!0;var o=r();o.withExtraArgument=r,t.default=o},function(e,t,n){"use strict";function r(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.promiseTypeSuffixes||s,n=e.promiseTypeDelimiter||"_";return function(e){var r=e.dispatch;return function(e){return function(u){var l=void 0,c=void 0;if(!u.payload)return e(u);var s=u.payload;if(Object(o.a)(s))l=s;else if(Object(o.a)(s.promise))l=s.promise,c=s.data;else{if("function"!=typeof s&&"function"!=typeof s.promise)return e(u);if(l=s.promise?s.promise():s(),c=s.promise?s.data:void 0,!Object(o.a)(l))return e(i({},u,{payload:l}))}var f=u.type,p=u.meta,d=a(t,3),h=d[0],m=d[1],y=d[2],v=function(e,t){return i({type:[f,t?y:m].join(n)},null===e||void 0===e?{}:{payload:e},void 0!==p?{meta:p}:{},t?{error:!0}:{})},g=function(e){var t=v(e,!0);throw r(t),e},b=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=v(e,!1);return r(t),{value:e,action:t}};return e(i({type:[f,h].join(n)},void 0!==c?{payload:c}:{},void 0!==p?{meta:p}:{})),l.then(b,g)}}}}Object.defineProperty(t,"__esModule",{value:!0}),n.d(t,"PENDING",function(){return u}),n.d(t,"FULFILLED",function(){return l}),n.d(t,"REJECTED",function(){return c}),t.default=r;var o=n(122),a=function(){function e(e,t){var n=[],r=!0,o=!1,a=void 0;try{for(var i,u=e[Symbol.iterator]();!(r=(i=u.next()).done)&&(n.push(i.value),!t||n.length!==t);r=!0);}catch(e){o=!0,a=e}finally{try{!r&&u.return&&u.return()}finally{if(o)throw a}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),i=Object.assign||function(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:[],t=arguments[1];switch(t.type){case"ADD_TO_CART":return[].concat(r(e),[t.payload]);case"UPDATE_CART":return e.map(function(n,o){return o!==t.index?n:[].concat(r(e),r(t.payload))});case"REMOVE_ITEM":var n=e.findIndex(function(e){return e.item===t.payload});return e.filter(function(e,t){return t!=n})}return e}Object.defineProperty(t,"__esModule",{value:!0}),t.default=o},function(e,t,n){"use strict";function r(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{items:[]},t=arguments[1];switch(t.type){case"FETCH_ITEMS":return o({},e);case"FETCH_ITEMS_FULFILLED":if(0===e.items.length)return o({},e,{items:t.payload});break;case"SYNC_QUANTITY":var n=t.payload,r=n.quantity,a=n.item;return e.items.map(function(e){return e.productName===a?e.quantity=r:null}),o({},e)}return e}Object.defineProperty(t,"__esModule",{value:!0});var o=Object.assign||function(e){for(var t=1;t (/Users/ssund6/Documents/Github/react-shopping-cart/node_modules/node-sass/lib/index.js:14:35)\n at Module._compile (module.js:649:30)\n at Object.Module._extensions..js (module.js:660:10)\n at Module.load (module.js:561:32)\n at tryModuleLoad (module.js:501:12)\n at Function.Module._load (module.js:493:3)\n at Module.require (module.js:593:17)\n at require (internal/module.js:11:18)\n at Object. (/Users/ssund6/Documents/Github/react-shopping-cart/node_modules/sass-loader/lib/loader.js:3:14)\n at Module._compile (module.js:649:30)\n at Object.Module._extensions..js (module.js:660:10)\n at Module.load (module.js:561:32)\n at tryModuleLoad (module.js:501:12)\n at Function.Module._load (module.js:493:3)\n at Module.require (module.js:593:17)\n at require (internal/module.js:11:18)\n at loadLoader (/Users/ssund6/Documents/Github/react-shopping-cart/node_modules/loader-runner/lib/loadLoader.js:13:17)\n at iteratePitchingLoaders (/Users/ssund6/Documents/Github/react-shopping-cart/node_modules/loader-runner/lib/LoaderRunner.js:169:2)\n at iteratePitchingLoaders (/Users/ssund6/Documents/Github/react-shopping-cart/node_modules/loader-runner/lib/LoaderRunner.js:165:10)\n at /Users/ssund6/Documents/Github/react-shopping-cart/node_modules/loader-runner/lib/LoaderRunner.js:173:18\n at loadLoader (/Users/ssund6/Documents/Github/react-shopping-cart/node_modules/loader-runner/lib/loadLoader.js:36:3)\n at iteratePitchingLoaders (/Users/ssund6/Documents/Github/react-shopping-cart/node_modules/loader-runner/lib/LoaderRunner.js:169:2)\n at runLoaders (/Users/ssund6/Documents/Github/react-shopping-cart/node_modules/loader-runner/lib/LoaderRunner.js:362:2)\n at NormalModule.doBuild (/Users/ssund6/Documents/Github/react-shopping-cart/node_modules/webpack/lib/NormalModule.js:182:3)\n at NormalModule.build (/Users/ssund6/Documents/Github/react-shopping-cart/node_modules/webpack/lib/NormalModule.js:275:15)\n at Compilation.buildModule (/Users/ssund6/Documents/Github/react-shopping-cart/node_modules/webpack/lib/Compilation.js:151:10)\n at moduleFactory.create (/Users/ssund6/Documents/Github/react-shopping-cart/node_modules/webpack/lib/Compilation.js:454:10)\n at factory (/Users/ssund6/Documents/Github/react-shopping-cart/node_modules/webpack/lib/NormalModuleFactory.js:243:5)\n at applyPluginsAsyncWaterfall (/Users/ssund6/Documents/Github/react-shopping-cart/node_modules/webpack/lib/NormalModuleFactory.js:94:13)\n at runLoaders (/Users/ssund6/Documents/Github/react-shopping-cart/node_modules/webpack/lib/NormalModule.js:195:19)\n at /Users/ssund6/Documents/Github/react-shopping-cart/node_modules/loader-runner/lib/LoaderRunner.js:364:11\n at /Users/ssund6/Documents/Github/react-shopping-cart/node_modules/loader-runner/lib/LoaderRunner.js:170:18\n at loadLoader (/Users/ssund6/Documents/Github/react-shopping-cart/node_modules/loader-runner/lib/loadLoader.js:27:11)\n at iteratePitchingLoaders (/Users/ssund6/Documents/Github/react-shopping-cart/node_modules/loader-runner/lib/LoaderRunner.js:169:2)\n at iteratePitchingLoaders (/Users/ssund6/Documents/Github/react-shopping-cart/node_modules/loader-runner/lib/LoaderRunner.js:165:10)\n at /Users/ssund6/Documents/Github/react-shopping-cart/node_modules/loader-runner/lib/LoaderRunner.js:173:18\n at loadLoader (/Users/ssund6/Documents/Github/react-shopping-cart/node_modules/loader-runner/lib/loadLoader.js:36:3)\n at iteratePitchingLoaders (/Users/ssund6/Documents/Github/react-shopping-cart/node_modules/loader-runner/lib/LoaderRunner.js:169:2)\n at runLoaders (/Users/ssund6/Documents/Github/react-shopping-cart/node_modules/loader-runner/lib/LoaderRunner.js:362:2)\n at NormalModule.doBuild (/Users/ssund6/Documents/Github/react-shopping-cart/node_modules/webpack/lib/NormalModule.js:182:3)\n at NormalModule.build (/Users/ssund6/Documents/Github/react-shopping-cart/node_modules/webpack/lib/NormalModule.js:275:15)\n at Compilation.buildModule (/Users/ssund6/Documents/Github/react-shopping-cart/node_modules/webpack/lib/Compilation.js:151:10)\n at moduleFactory.create (/Users/ssund6/Documents/Github/react-shopping-cart/node_modules/webpack/lib/Compilation.js:454:10)\n at factory (/Users/ssund6/Documents/Github/react-shopping-cart/node_modules/webpack/lib/NormalModuleFactory.js:243:5)\n at applyPluginsAsyncWaterfall (/Users/ssund6/Documents/Github/react-shopping-cart/node_modules/webpack/lib/NormalModuleFactory.js:94:13)\n at /Users/ssund6/Documents/Github/react-shopping-cart/node_modules/tapable/lib/Tapable.js:268:11\n at NormalModuleFactory.params.normalModuleFactory.plugin (/Users/ssund6/Documents/Github/react-shopping-cart/node_modules/webpack/lib/CompatibilityPlugin.js:52:5)\n at NormalModuleFactory.applyPluginsAsyncWaterfall (/Users/ssund6/Documents/Github/react-shopping-cart/node_modules/tapable/lib/Tapable.js:272:13)\n at resolver (/Users/ssund6/Documents/Github/react-shopping-cart/node_modules/webpack/lib/NormalModuleFactory.js:69:10)\n at process.nextTick (/Users/ssund6/Documents/Github/react-shopping-cart/node_modules/webpack/lib/NormalModuleFactory.js:196:7)\n at process._tickCallback (internal/process/next_tick.js:112:11)")}]); -------------------------------------------------------------------------------- /public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | ACME Corp 10 | 11 | 12 |
13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/App.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import Catalog from './components/Catalog'; 3 | import Cart from './components/Cart'; 4 | 5 | import { connect } from 'react-redux'; 6 | import { getData } from './actions/catalogActions'; 7 | 8 | @connect((store) => { 9 | return { 10 | items: store.catalog, 11 | cartItems: store.cart 12 | } 13 | }) 14 | 15 | class App extends Component { 16 | 17 | componentDidMount() { 18 | this.props.dispatch(getData()); 19 | } 20 | 21 | render() { 22 | 23 | const { items, cartItems } = this.props; 24 | 25 | return ( 26 | items === undefined ? ( 27 |
Loading...
28 | ) : ( 29 |
30 | 31 | 32 |
33 | ) 34 | ) 35 | } 36 | } 37 | 38 | export default App; -------------------------------------------------------------------------------- /src/actions/cartActions.js: -------------------------------------------------------------------------------- 1 | import { ADD_TO_CART, UPDATE_CART, REMOVE_ITEM, UPDATE_QUANTITY } from '../constants/ActionTypes'; 2 | 3 | export function addToCart(payload) { 4 | return { 5 | type: ADD_TO_CART, 6 | payload: payload 7 | } 8 | } 9 | 10 | export function updateCart(payload) { 11 | return { 12 | type: UPDATE_CART, 13 | payload: payload 14 | } 15 | } 16 | 17 | export function removeItem(payload) { 18 | return { 19 | type: REMOVE_ITEM, 20 | payload: payload 21 | } 22 | } 23 | 24 | export function updateQuantity(payload) { 25 | return { 26 | type: UPDATE_QUANTITY, 27 | payload: payload 28 | } 29 | } -------------------------------------------------------------------------------- /src/actions/catalogActions.js: -------------------------------------------------------------------------------- 1 | import { FETCH_ITEMS, FETCH_ITEMS_FULFILLED, FETCH_ITMS_REJECTED, SYNC_QUANTITY } from '../constants/ActionTypes'; 2 | import axios from "axios"; 3 | 4 | export function getData(payload) { 5 | return function(dispatch) { 6 | dispatch({ type: FETCH_ITEMS }); 7 | axios.get("https://api.myjson.com/bins/19dvvv") 8 | .then((response) => { 9 | dispatch({type: FETCH_ITEMS_FULFILLED, payload: response.data}) 10 | }) 11 | .catch((err) => { 12 | dispatch({type: FETCH_ITMS_REJECTED, payload: err}) 13 | }) 14 | } 15 | } 16 | 17 | export function syncQuantity(payload) { 18 | return { 19 | type: SYNC_QUANTITY, 20 | payload: payload 21 | } 22 | } -------------------------------------------------------------------------------- /src/components/Button.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | 3 | const Button = ({ onClick }) => { 4 | return ( 5 | 6 | ) 7 | } 8 | 9 | export default Button; -------------------------------------------------------------------------------- /src/components/Cart.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import { connect } from 'react-redux'; 3 | 4 | import { removeItem } from './../actions/cartActions'; 5 | import { syncQuantity } from './../actions/catalogActions'; 6 | 7 | @connect((store) => { 8 | return { 9 | itemsList: store.cart 10 | } 11 | }) 12 | 13 | export default class Cart extends Component { 14 | 15 | _removeFromCart(item) { 16 | this.props.dispatch(removeItem(item)); 17 | this.props.dispatch(syncQuantity({"item": item, "quantity": 0})); 18 | } 19 | 20 | render() { 21 | 22 | const { itemsList } = this.props; 23 | let subTotals = []; 24 | 25 | itemsList.map((item) => { 26 | subTotals.push(item.quantity * item.price); 27 | }); 28 | 29 | return ( 30 |
31 | {itemsList.length !== 0 ? ( 32 |
33 |

Your Cart Summary

34 | 35 |
36 |
37 | Item(s) in cart 38 | {itemsList.length} 39 |
40 | 41 |
42 | Grand Total (INR) 43 | {subTotals.reduce((accumulator, currentValue) => accumulator + currentValue)} 44 |
45 |
46 | 47 |
48 | 49 |
50 |
Item
51 |
Quantity
52 |
Total (INR)
53 |
54 | 55 | {itemsList && itemsList.map((item, i) => ( 56 |
57 |
{item.brand}
{item.item}
58 |
{item.quantity}
59 |
{item.quantity * item.price}
60 |
{this._removeFromCart(item.item)}}>x
61 |
62 | ))} 63 |
64 | ) : ( 65 |
66 |

Oops! Your cart is empty!

67 |

Add items to proceed

68 |
69 | )} 70 |
71 | ) 72 | } 73 | } -------------------------------------------------------------------------------- /src/components/Catalog.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import Item from './Item'; 3 | 4 | import { connect } from 'react-redux'; 5 | 6 | export default class Catalog extends Component { 7 | render() { 8 | const { items } = this.props; 9 | 10 | //First fetch returns items inside the items. Post cart update, returns items. 11 | //TODO: Revisit to optimize the structure on first fetch 12 | const catalogItems = items.items ? items.items : items; 13 | 14 | return ( 15 |
16 | {catalogItems && catalogItems.map((item, i) => ( 17 | 22 | ))} 23 |
24 | ) 25 | } 26 | } -------------------------------------------------------------------------------- /src/components/Item.js: -------------------------------------------------------------------------------- 1 | import React, { Component, PropTypes } from 'react'; 2 | import { connect } from 'react-redux'; 3 | 4 | import Button from './Button'; 5 | import QuantityBar from './QuantityBar'; 6 | 7 | import { addToCart } from './../actions/cartActions'; 8 | import { syncQuantity } from './../actions/catalogActions'; 9 | 10 | @connect((store) => { 11 | return { 12 | cataLog: store.catalog 13 | } 14 | }) 15 | 16 | export default class Item extends Component { 17 | 18 | constructor(props) { 19 | super(props); 20 | } 21 | 22 | _addToCart = (price, brandName, productName, quantity) => { 23 | const itemDetails = { 24 | item: productName, 25 | quantity: quantity, 26 | price: price, 27 | brand: brandName 28 | } 29 | 30 | this.setState({ 31 | quantity: 1 32 | }) 33 | 34 | const syncCatalog = { 35 | item: productName, 36 | quantity: quantity 37 | } 38 | 39 | this.props.dispatch(addToCart(itemDetails)); 40 | this.props.dispatch(syncQuantity(syncCatalog)); 41 | }; 42 | 43 | render() { 44 | const { productImage, brandName, productName, packageDetail, price, quantity } = this.props; 45 | 46 | return ( 47 |
48 |
49 |
50 | {productName} 51 |
52 |
53 |
54 | {brandName} 55 |
56 |
57 | {productName} 58 |
59 |
60 | {packageDetail} 61 |
62 |
63 | INR {price} 64 |
65 | {(quantity === 0 || quantity === undefined) ?
67 |
68 |
69 | ) 70 | } 71 | } -------------------------------------------------------------------------------- /src/components/QuantityBar.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import { connect } from 'react-redux'; 3 | 4 | import { updateCart, removeItem } from './../actions/cartActions'; 5 | import { syncQuantity } from './../actions/catalogActions'; 6 | 7 | @connect((store) => { 8 | return { 9 | itemsInStore: store.cart 10 | } 11 | }) 12 | 13 | export default class QuantityBar extends Component { 14 | 15 | constructor(props) { 16 | super(props); 17 | 18 | this.state = { 19 | currentQuantity: 1 20 | } 21 | } 22 | 23 | componentDidMount() { 24 | const { itemsInStore } = this.props; 25 | const currentItem = itemsInStore.find(this._getCurrentItemQuantity); 26 | 27 | //Checks if there are any items present and assigns respective quantity value, else defaults to 0 28 | this.setState({ 29 | currentQuantity: currentItem ? currentItem.quantity : 0 30 | }); 31 | 32 | } 33 | 34 | _getCurrentItemQuantity = (cart) => { 35 | const { item } = this.props; 36 | return cart.item === item; 37 | } 38 | 39 | _updateQuantity = (change) => { 40 | const { itemsInStore, item } = this.props; 41 | const currentItem = itemsInStore.find(this._getCurrentItemQuantity); 42 | let { quantity } = currentItem; 43 | 44 | switch(change) { 45 | case "increment": { 46 | quantity = quantity + 1; 47 | break; 48 | } 49 | case "decrement": { 50 | quantity = quantity - 1; 51 | if(quantity === 0 || quantity === undefined) this.props.dispatch(removeItem(item)); 52 | } 53 | } 54 | 55 | this.setState({ 56 | currentQuantity: quantity 57 | }) 58 | 59 | const updatedItemDetails = Object.assign(currentItem, {quantity: quantity}); 60 | 61 | const syncCatalog = { 62 | item: item, 63 | quantity: quantity 64 | } 65 | 66 | this.props.dispatch(updateCart(updatedItemDetails)); 67 | this.props.dispatch(syncQuantity(syncCatalog)); 68 | } 69 | 70 | render() { 71 | 72 | const { currentQuantity } = this.state; 73 | 74 | const { quantityAdded } = this.props; 75 | 76 | return ( 77 |
78 |
{ this._updateQuantity('decrement') }} > 79 | - 80 |
81 |
82 | {currentQuantity} in cart 83 |
84 |
{ this._updateQuantity('increment') }}> 85 | + 86 |
87 |
88 | ) 89 | } 90 | } -------------------------------------------------------------------------------- /src/constants/ActionTypes.js: -------------------------------------------------------------------------------- 1 | // Cart Actions 2 | export const ADD_TO_CART = 'ADD_TO_CART'; 3 | export const UPDATE_CART = 'UPDATE_CART'; 4 | export const REMOVE_ITEM = 'REMOVE_ITEM'; 5 | export const UPDATE_QUANTITY = 'UPDATE_QUANTITY'; 6 | 7 | // Catalog Actions 8 | export const FETCH_ITEMS = 'FETCH_ITEMS'; 9 | export const FETCH_ITEMS_FULFILLED = 'FETCH_ITEMS_FULFILLED'; 10 | export const FETCH_ITMS_REJECTED = 'FETCH_ITMS_REJECTED'; 11 | export const SYNC_QUANTITY = 'SYNC_QUANTITY'; 12 | 13 | -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { render } from 'react-dom'; 3 | import { Provider } from 'react-redux'; 4 | 5 | import App from './App'; 6 | 7 | import store from './store'; 8 | 9 | render( 10 | 11 | 12 | , document.getElementById('root') 13 | ); -------------------------------------------------------------------------------- /src/reducers/cart.js: -------------------------------------------------------------------------------- 1 | export default function reducer(state = [], action) { 2 | 3 | // Our goal here is to perform actions on cart items using "Immutable update patterns" 4 | // Mutating the State directly can lead to performance issues as it could unnecessarily 5 | // re-render the component. 6 | 7 | switch (action.type) { 8 | case "ADD_TO_CART": { 9 | 10 | // This adds new item to the cart array, in this the State without mutating it. 11 | return [ 12 | ...state, action.payload 13 | ] 14 | break; 15 | } 16 | case "UPDATE_CART": { 17 | 18 | // This finds the item that is already available in the cart array and updates 19 | // the item's quantity without mutating directly the State 20 | 21 | return state.map((item, index) => { 22 | if(index !== action.index) { 23 | return item; 24 | } 25 | 26 | return [ 27 | ...state, 28 | ...action.payload 29 | ] 30 | }); 31 | } 32 | case "REMOVE_ITEM": { 33 | 34 | // Removes the item from cart array without directly mutating the state. 35 | // The Array.prototype.filter() method prevents us from mutating the array 36 | 37 | const itemIndex = state.findIndex(i => i.item === action.payload); 38 | return state.filter((item, index) => index != itemIndex); 39 | } 40 | } 41 | 42 | return state; 43 | } -------------------------------------------------------------------------------- /src/reducers/catalog.js: -------------------------------------------------------------------------------- 1 | export default function reducer(state = { 2 | items: [] 3 | }, action) { 4 | switch (action.type) { 5 | case "FETCH_ITEMS": { 6 | return { 7 | ...state 8 | } 9 | } 10 | case "FETCH_ITEMS_FULFILLED": { 11 | if(state.items.length === 0 ) { 12 | return { 13 | ...state, 14 | items: action.payload 15 | } 16 | } 17 | break; 18 | } 19 | case "SYNC_QUANTITY": { 20 | const { quantity, item } = action.payload; 21 | state.items.map(thisItem => thisItem.productName === item ? thisItem.quantity = quantity : null) 22 | 23 | return { 24 | ...state 25 | } 26 | } 27 | } 28 | 29 | return state; 30 | } -------------------------------------------------------------------------------- /src/store.js: -------------------------------------------------------------------------------- 1 | import { compose, applyMiddleware, createStore } from 'redux'; 2 | import { autoRehydrate, persistStore } from 'redux-persist'; 3 | 4 | import { createLogger } from "redux-logger" 5 | import thunk from "redux-thunk" 6 | import promise from "redux-promise-middleware" 7 | 8 | import reducer from './reducers'; 9 | 10 | const middleware = applyMiddleware(promise(), thunk, createLogger()) 11 | 12 | let store = compose( 13 | autoRehydrate() 14 | )(createStore)(reducer, middleware) 15 | 16 | persistStore(store); 17 | 18 | 19 | export default store; -------------------------------------------------------------------------------- /src/styles/main.scss: -------------------------------------------------------------------------------- 1 | /* http://meyerweb.com/eric/tools/css/reset/ 2 | v2.0 | 20110126 3 | License: none (public domain) 4 | */ 5 | 6 | html, body, div, span, applet, object, iframe, 7 | h1, h2, h3, h4, h5, h6, p, blockquote, pre, 8 | a, abbr, acronym, address, big, cite, code, 9 | del, dfn, em, img, ins, kbd, q, s, samp, 10 | small, strike, strong, sub, sup, tt, var, 11 | b, u, i, center, 12 | dl, dt, dd, ol, ul, li, 13 | fieldset, form, label, legend, 14 | table, caption, tbody, tfoot, thead, tr, th, td, 15 | article, aside, canvas, details, embed, 16 | figure, figcaption, footer, header, hgroup, 17 | menu, nav, output, ruby, section, summary, 18 | time, mark, audio, video { 19 | margin: 0; 20 | padding: 0; 21 | border: 0; 22 | font-size: 100%; 23 | font: inherit; 24 | vertical-align: baseline; 25 | } 26 | /* HTML5 display-role reset for older browsers */ 27 | article, aside, details, figcaption, figure, 28 | footer, header, hgroup, menu, nav, section { 29 | display: block; 30 | } 31 | body { 32 | line-height: 1; 33 | } 34 | ol, ul { 35 | list-style: none; 36 | } 37 | blockquote, q { 38 | quotes: none; 39 | } 40 | blockquote:before, blockquote:after, 41 | q:before, q:after { 42 | content: ''; 43 | content: none; 44 | } 45 | table { 46 | border-collapse: collapse; 47 | border-spacing: 0; 48 | } 49 | 50 | hr { 51 | border: 2px solid #666; 52 | } 53 | 54 | body { 55 | background: #fff; 56 | font-family: 'Roboto', sans-serif; 57 | } 58 | 59 | .wrap { 60 | width: 1000px; 61 | margin: 0 auto; 62 | display: flex; 63 | } 64 | 65 | .item-catalog { 66 | padding: 30px 0; 67 | display: flex; 68 | flex-direction: row; 69 | max-width: 640px; 70 | min-width: 600px; 71 | flex-wrap: wrap; 72 | 73 | .item-wrapper { 74 | display: block; 75 | margin: 10px; 76 | border: solid 1px #ccc; 77 | 78 | .item-container { 79 | .product-img { 80 | img { 81 | width: 180px; 82 | height: 180px; 83 | } 84 | } 85 | 86 | .product-details { 87 | padding: 5px 0 10px 0; 88 | text-align: center; 89 | 90 | .brand-name, 91 | .package-detail { 92 | font-size: 12px; 93 | padding: 5px 0; 94 | } 95 | 96 | .brand-name { 97 | padding: 5px 0 0; 98 | } 99 | .product-name { 100 | font-size: 16px; 101 | padding: 5px 0; 102 | } 103 | .product-price { 104 | font-weight: bold; 105 | font-size: 16px; 106 | padding: 10px 0; 107 | } 108 | input { 109 | background: #3f51b5; 110 | color: #fff; 111 | height: 32px; 112 | width: 120px; 113 | border-radius: 0; 114 | border: none; 115 | cursor: pointer; 116 | line-height: 30px; 117 | text-transform: uppercase; 118 | font-size: 10px; 119 | } 120 | .quantity-bar { 121 | display: flex; 122 | width: 120px; 123 | height: 30px; 124 | margin: 0 auto; 125 | justify-content: center; 126 | border: solid 1px #ccc; 127 | 128 | .item-quantity-meter { 129 | background: #3f51b5; 130 | color: #fff; 131 | width: 60%; 132 | font-size: 10px; 133 | display: flex; 134 | justify-content: center; 135 | align-items: center; 136 | text-transform: uppercase; 137 | } 138 | 139 | .adjust-quantity { 140 | width: 20%; 141 | display: flex; 142 | justify-content: center; 143 | align-items: center; 144 | cursor: pointer; 145 | text-transform: uppercase; 146 | } 147 | } 148 | } 149 | } 150 | } 151 | } 152 | 153 | .cart { 154 | width: 300px; 155 | padding: 20px; 156 | border: solid 1px #ccc; 157 | margin: 30px; 158 | max-height: 600px; 159 | 160 | .cart-overview { 161 | display: flex; 162 | 163 | .item-count, 164 | .grand-total { 165 | display: flex; 166 | flex-direction: column; 167 | align-items: center; 168 | flex-grow: 1; 169 | 170 | span { 171 | padding: 10px; 172 | } 173 | } 174 | 175 | .item-count, .grand-total { 176 | .count-meter, .total-amount { 177 | font-size: 20px; 178 | font-weight: bold; 179 | } 180 | } 181 | } 182 | 183 | .cart-header, 184 | .item-row { 185 | display: flex; 186 | font-size: 14px; 187 | border-bottom: 1px solid #ccc; 188 | padding: 10px 0; 189 | 190 | .remove-item { 191 | border-radius: 100%; 192 | background: #b71c1c; 193 | color: #fff; 194 | width: 16px; 195 | height: 16px; 196 | text-align: center; 197 | font-size: 13px; 198 | cursor: pointer; 199 | } 200 | 201 | .cart-item-title { 202 | flex-grow: 6; 203 | } 204 | 205 | .cart-total-title { 206 | text-align: right; 207 | padding: 0 20px 0 0; 208 | } 209 | 210 | .cart-quantity-title, 211 | .cart-total-title { 212 | flex-grow: 1; 213 | } 214 | } 215 | 216 | .item-row { 217 | .cart-item-title { 218 | flex-grow: 1; 219 | max-width: 115px; 220 | } 221 | 222 | .cart-quantity-title { 223 | text-align: center; 224 | } 225 | } 226 | 227 | .cart-header { 228 | font-weight: bold; 229 | } 230 | 231 | .contains-no-items { 232 | width: 100%; 233 | height: 100%; 234 | display: flex; 235 | flex-direction: column; 236 | align-items: center; 237 | justify-content: center; 238 | } 239 | 240 | h3 { 241 | font-size: 22px; 242 | font-weight: bold; 243 | padding: 0 0 20px 0; 244 | } 245 | } -------------------------------------------------------------------------------- /webpack.config.js: -------------------------------------------------------------------------------- 1 | const path = require("path"); 2 | const ExtractTextPlugin = require('extract-text-webpack-plugin'); 3 | const UglifyJsPlugin = require('uglifyjs-webpack-plugin') 4 | const webpack = require('webpack'); 5 | 6 | module.exports = { 7 | entry: ['./src/index.js', './src/styles/main.scss'], 8 | output: { 9 | filename: 'bundle.js', 10 | path: path.resolve(__dirname, './public/dist') 11 | }, 12 | module: { 13 | rules: [ 14 | { 15 | test: /\.scss/, 16 | loader: ExtractTextPlugin.extract(['css-loader', 'sass-loader']) 17 | }, 18 | { 19 | test: /\.js$/, 20 | exclude: /node_modules/, 21 | loader: 'babel-loader', 22 | options: { 23 | presets: ["react", "stage-0", "es2015"], 24 | plugins: ["transform-class-properties", "transform-decorators-legacy"] 25 | } 26 | } 27 | ] 28 | }, 29 | devServer: { 30 | contentBase: './public/' 31 | }, 32 | plugins: [ 33 | new ExtractTextPlugin("bundle.css"), 34 | new webpack.DefinePlugin({ 35 | 'process.env.NODE_ENV': JSON.stringify('production') 36 | }), 37 | new webpack.optimize.UglifyJsPlugin() 38 | ] 39 | } --------------------------------------------------------------------------------