react-redux.js 107 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834
  1. (function (global, factory) {
  2. typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('react-dom')) :
  3. typeof define === 'function' && define.amd ? define(['exports', 'react', 'react-dom'], factory) :
  4. (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.ReactRedux = {}, global.React, global.ReactDOM));
  5. })(this, (function (exports, React, reactDom) { 'use strict';
  6. function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
  7. var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
  8. var propTypes = {exports: {}};
  9. var reactIs$3 = {exports: {}};
  10. var reactIs_development$2 = {};
  11. /** @license React v16.13.1
  12. * react-is.development.js
  13. *
  14. * Copyright (c) Facebook, Inc. and its affiliates.
  15. *
  16. * This source code is licensed under the MIT license found in the
  17. * LICENSE file in the root directory of this source tree.
  18. */
  19. {
  20. (function() {
  21. // The Symbol used to tag the ReactElement-like types. If there is no native Symbol
  22. // nor polyfill, then a plain number is used for performance.
  23. var hasSymbol = typeof Symbol === 'function' && Symbol.for;
  24. var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
  25. var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
  26. var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
  27. var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
  28. var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
  29. var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
  30. var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary
  31. // (unstable) APIs that have been removed. Can we remove the symbols?
  32. var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;
  33. var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
  34. var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
  35. var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
  36. var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;
  37. var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
  38. var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
  39. var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9;
  40. var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5;
  41. var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6;
  42. var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7;
  43. function isValidElementType(type) {
  44. return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
  45. type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_BLOCK_TYPE);
  46. }
  47. function typeOf(object) {
  48. if (typeof object === 'object' && object !== null) {
  49. var $$typeof = object.$$typeof;
  50. switch ($$typeof) {
  51. case REACT_ELEMENT_TYPE:
  52. var type = object.type;
  53. switch (type) {
  54. case REACT_ASYNC_MODE_TYPE:
  55. case REACT_CONCURRENT_MODE_TYPE:
  56. case REACT_FRAGMENT_TYPE:
  57. case REACT_PROFILER_TYPE:
  58. case REACT_STRICT_MODE_TYPE:
  59. case REACT_SUSPENSE_TYPE:
  60. return type;
  61. default:
  62. var $$typeofType = type && type.$$typeof;
  63. switch ($$typeofType) {
  64. case REACT_CONTEXT_TYPE:
  65. case REACT_FORWARD_REF_TYPE:
  66. case REACT_LAZY_TYPE:
  67. case REACT_MEMO_TYPE:
  68. case REACT_PROVIDER_TYPE:
  69. return $$typeofType;
  70. default:
  71. return $$typeof;
  72. }
  73. }
  74. case REACT_PORTAL_TYPE:
  75. return $$typeof;
  76. }
  77. }
  78. return undefined;
  79. } // AsyncMode is deprecated along with isAsyncMode
  80. var AsyncMode = REACT_ASYNC_MODE_TYPE;
  81. var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
  82. var ContextConsumer = REACT_CONTEXT_TYPE;
  83. var ContextProvider = REACT_PROVIDER_TYPE;
  84. var Element = REACT_ELEMENT_TYPE;
  85. var ForwardRef = REACT_FORWARD_REF_TYPE;
  86. var Fragment = REACT_FRAGMENT_TYPE;
  87. var Lazy = REACT_LAZY_TYPE;
  88. var Memo = REACT_MEMO_TYPE;
  89. var Portal = REACT_PORTAL_TYPE;
  90. var Profiler = REACT_PROFILER_TYPE;
  91. var StrictMode = REACT_STRICT_MODE_TYPE;
  92. var Suspense = REACT_SUSPENSE_TYPE;
  93. var hasWarnedAboutDeprecatedIsAsyncMode = false; // AsyncMode should be deprecated
  94. function isAsyncMode(object) {
  95. {
  96. if (!hasWarnedAboutDeprecatedIsAsyncMode) {
  97. hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint
  98. console['warn']('The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 17+. Update your code to use ' + 'ReactIs.isConcurrentMode() instead. It has the exact same API.');
  99. }
  100. }
  101. return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE;
  102. }
  103. function isConcurrentMode(object) {
  104. return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;
  105. }
  106. function isContextConsumer(object) {
  107. return typeOf(object) === REACT_CONTEXT_TYPE;
  108. }
  109. function isContextProvider(object) {
  110. return typeOf(object) === REACT_PROVIDER_TYPE;
  111. }
  112. function isElement(object) {
  113. return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
  114. }
  115. function isForwardRef(object) {
  116. return typeOf(object) === REACT_FORWARD_REF_TYPE;
  117. }
  118. function isFragment(object) {
  119. return typeOf(object) === REACT_FRAGMENT_TYPE;
  120. }
  121. function isLazy(object) {
  122. return typeOf(object) === REACT_LAZY_TYPE;
  123. }
  124. function isMemo(object) {
  125. return typeOf(object) === REACT_MEMO_TYPE;
  126. }
  127. function isPortal(object) {
  128. return typeOf(object) === REACT_PORTAL_TYPE;
  129. }
  130. function isProfiler(object) {
  131. return typeOf(object) === REACT_PROFILER_TYPE;
  132. }
  133. function isStrictMode(object) {
  134. return typeOf(object) === REACT_STRICT_MODE_TYPE;
  135. }
  136. function isSuspense(object) {
  137. return typeOf(object) === REACT_SUSPENSE_TYPE;
  138. }
  139. reactIs_development$2.AsyncMode = AsyncMode;
  140. reactIs_development$2.ConcurrentMode = ConcurrentMode;
  141. reactIs_development$2.ContextConsumer = ContextConsumer;
  142. reactIs_development$2.ContextProvider = ContextProvider;
  143. reactIs_development$2.Element = Element;
  144. reactIs_development$2.ForwardRef = ForwardRef;
  145. reactIs_development$2.Fragment = Fragment;
  146. reactIs_development$2.Lazy = Lazy;
  147. reactIs_development$2.Memo = Memo;
  148. reactIs_development$2.Portal = Portal;
  149. reactIs_development$2.Profiler = Profiler;
  150. reactIs_development$2.StrictMode = StrictMode;
  151. reactIs_development$2.Suspense = Suspense;
  152. reactIs_development$2.isAsyncMode = isAsyncMode;
  153. reactIs_development$2.isConcurrentMode = isConcurrentMode;
  154. reactIs_development$2.isContextConsumer = isContextConsumer;
  155. reactIs_development$2.isContextProvider = isContextProvider;
  156. reactIs_development$2.isElement = isElement;
  157. reactIs_development$2.isForwardRef = isForwardRef;
  158. reactIs_development$2.isFragment = isFragment;
  159. reactIs_development$2.isLazy = isLazy;
  160. reactIs_development$2.isMemo = isMemo;
  161. reactIs_development$2.isPortal = isPortal;
  162. reactIs_development$2.isProfiler = isProfiler;
  163. reactIs_development$2.isStrictMode = isStrictMode;
  164. reactIs_development$2.isSuspense = isSuspense;
  165. reactIs_development$2.isValidElementType = isValidElementType;
  166. reactIs_development$2.typeOf = typeOf;
  167. })();
  168. }
  169. {
  170. reactIs$3.exports = reactIs_development$2;
  171. }
  172. /*
  173. object-assign
  174. (c) Sindre Sorhus
  175. @license MIT
  176. */
  177. /* eslint-disable no-unused-vars */
  178. var getOwnPropertySymbols$1 = Object.getOwnPropertySymbols;
  179. var hasOwnProperty = Object.prototype.hasOwnProperty;
  180. var propIsEnumerable = Object.prototype.propertyIsEnumerable;
  181. function toObject(val) {
  182. if (val === null || val === undefined) {
  183. throw new TypeError('Object.assign cannot be called with null or undefined');
  184. }
  185. return Object(val);
  186. }
  187. function shouldUseNative() {
  188. try {
  189. if (!Object.assign) {
  190. return false;
  191. }
  192. // Detect buggy property enumeration order in older V8 versions.
  193. // https://bugs.chromium.org/p/v8/issues/detail?id=4118
  194. var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
  195. test1[5] = 'de';
  196. if (Object.getOwnPropertyNames(test1)[0] === '5') {
  197. return false;
  198. }
  199. // https://bugs.chromium.org/p/v8/issues/detail?id=3056
  200. var test2 = {};
  201. for (var i = 0; i < 10; i++) {
  202. test2['_' + String.fromCharCode(i)] = i;
  203. }
  204. var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
  205. return test2[n];
  206. });
  207. if (order2.join('') !== '0123456789') {
  208. return false;
  209. }
  210. // https://bugs.chromium.org/p/v8/issues/detail?id=3056
  211. var test3 = {};
  212. 'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
  213. test3[letter] = letter;
  214. });
  215. if (Object.keys(Object.assign({}, test3)).join('') !==
  216. 'abcdefghijklmnopqrst') {
  217. return false;
  218. }
  219. return true;
  220. } catch (err) {
  221. // We don't expect any of the above to throw, but better to be safe.
  222. return false;
  223. }
  224. }
  225. var objectAssign = shouldUseNative() ? Object.assign : function (target, source) {
  226. var from;
  227. var to = toObject(target);
  228. var symbols;
  229. for (var s = 1; s < arguments.length; s++) {
  230. from = Object(arguments[s]);
  231. for (var key in from) {
  232. if (hasOwnProperty.call(from, key)) {
  233. to[key] = from[key];
  234. }
  235. }
  236. if (getOwnPropertySymbols$1) {
  237. symbols = getOwnPropertySymbols$1(from);
  238. for (var i = 0; i < symbols.length; i++) {
  239. if (propIsEnumerable.call(from, symbols[i])) {
  240. to[symbols[i]] = from[symbols[i]];
  241. }
  242. }
  243. }
  244. }
  245. return to;
  246. };
  247. /**
  248. * Copyright (c) 2013-present, Facebook, Inc.
  249. *
  250. * This source code is licensed under the MIT license found in the
  251. * LICENSE file in the root directory of this source tree.
  252. */
  253. var ReactPropTypesSecret$2 = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
  254. var ReactPropTypesSecret_1 = ReactPropTypesSecret$2;
  255. /**
  256. * Copyright (c) 2013-present, Facebook, Inc.
  257. *
  258. * This source code is licensed under the MIT license found in the
  259. * LICENSE file in the root directory of this source tree.
  260. */
  261. var printWarning$1 = function() {};
  262. {
  263. var ReactPropTypesSecret$1 = ReactPropTypesSecret_1;
  264. var loggedTypeFailures = {};
  265. var has$1 = Function.call.bind(Object.prototype.hasOwnProperty);
  266. printWarning$1 = function(text) {
  267. var message = 'Warning: ' + text;
  268. if (typeof console !== 'undefined') {
  269. console.error(message);
  270. }
  271. try {
  272. // --- Welcome to debugging React ---
  273. // This error was thrown as a convenience so that you can use this stack
  274. // to find the callsite that caused this warning to fire.
  275. throw new Error(message);
  276. } catch (x) {}
  277. };
  278. }
  279. /**
  280. * Assert that the values match with the type specs.
  281. * Error messages are memorized and will only be shown once.
  282. *
  283. * @param {object} typeSpecs Map of name to a ReactPropType
  284. * @param {object} values Runtime values that need to be type-checked
  285. * @param {string} location e.g. "prop", "context", "child context"
  286. * @param {string} componentName Name of the component for error messages.
  287. * @param {?Function} getStack Returns the component stack.
  288. * @private
  289. */
  290. function checkPropTypes$1(typeSpecs, values, location, componentName, getStack) {
  291. {
  292. for (var typeSpecName in typeSpecs) {
  293. if (has$1(typeSpecs, typeSpecName)) {
  294. var error;
  295. // Prop type validation may throw. In case they do, we don't want to
  296. // fail the render phase where it didn't fail before. So we log it.
  297. // After these have been cleaned up, we'll let them throw.
  298. try {
  299. // This is intentionally an invariant that gets caught. It's the same
  300. // behavior as without this statement except with a better message.
  301. if (typeof typeSpecs[typeSpecName] !== 'function') {
  302. var err = Error(
  303. (componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' +
  304. 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.'
  305. );
  306. err.name = 'Invariant Violation';
  307. throw err;
  308. }
  309. error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret$1);
  310. } catch (ex) {
  311. error = ex;
  312. }
  313. if (error && !(error instanceof Error)) {
  314. printWarning$1(
  315. (componentName || 'React class') + ': type specification of ' +
  316. location + ' `' + typeSpecName + '` is invalid; the type checker ' +
  317. 'function must return `null` or an `Error` but returned a ' + typeof error + '. ' +
  318. 'You may have forgotten to pass an argument to the type checker ' +
  319. 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' +
  320. 'shape all require an argument).'
  321. );
  322. }
  323. if (error instanceof Error && !(error.message in loggedTypeFailures)) {
  324. // Only monitor this failure once because there tends to be a lot of the
  325. // same error.
  326. loggedTypeFailures[error.message] = true;
  327. var stack = getStack ? getStack() : '';
  328. printWarning$1(
  329. 'Failed ' + location + ' type: ' + error.message + (stack != null ? stack : '')
  330. );
  331. }
  332. }
  333. }
  334. }
  335. }
  336. /**
  337. * Resets warning cache when testing.
  338. *
  339. * @private
  340. */
  341. checkPropTypes$1.resetWarningCache = function() {
  342. {
  343. loggedTypeFailures = {};
  344. }
  345. };
  346. var checkPropTypes_1 = checkPropTypes$1;
  347. /**
  348. * Copyright (c) 2013-present, Facebook, Inc.
  349. *
  350. * This source code is licensed under the MIT license found in the
  351. * LICENSE file in the root directory of this source tree.
  352. */
  353. var ReactIs$1 = reactIs$3.exports;
  354. var assign = objectAssign;
  355. var ReactPropTypesSecret = ReactPropTypesSecret_1;
  356. var checkPropTypes = checkPropTypes_1;
  357. var has = Function.call.bind(Object.prototype.hasOwnProperty);
  358. var printWarning = function() {};
  359. {
  360. printWarning = function(text) {
  361. var message = 'Warning: ' + text;
  362. if (typeof console !== 'undefined') {
  363. console.error(message);
  364. }
  365. try {
  366. // --- Welcome to debugging React ---
  367. // This error was thrown as a convenience so that you can use this stack
  368. // to find the callsite that caused this warning to fire.
  369. throw new Error(message);
  370. } catch (x) {}
  371. };
  372. }
  373. function emptyFunctionThatReturnsNull() {
  374. return null;
  375. }
  376. var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
  377. /* global Symbol */
  378. var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
  379. var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
  380. /**
  381. * Returns the iterator method function contained on the iterable object.
  382. *
  383. * Be sure to invoke the function with the iterable as context:
  384. *
  385. * var iteratorFn = getIteratorFn(myIterable);
  386. * if (iteratorFn) {
  387. * var iterator = iteratorFn.call(myIterable);
  388. * ...
  389. * }
  390. *
  391. * @param {?object} maybeIterable
  392. * @return {?function}
  393. */
  394. function getIteratorFn(maybeIterable) {
  395. var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
  396. if (typeof iteratorFn === 'function') {
  397. return iteratorFn;
  398. }
  399. }
  400. /**
  401. * Collection of methods that allow declaration and validation of props that are
  402. * supplied to React components. Example usage:
  403. *
  404. * var Props = require('ReactPropTypes');
  405. * var MyArticle = React.createClass({
  406. * propTypes: {
  407. * // An optional string prop named "description".
  408. * description: Props.string,
  409. *
  410. * // A required enum prop named "category".
  411. * category: Props.oneOf(['News','Photos']).isRequired,
  412. *
  413. * // A prop named "dialog" that requires an instance of Dialog.
  414. * dialog: Props.instanceOf(Dialog).isRequired
  415. * },
  416. * render: function() { ... }
  417. * });
  418. *
  419. * A more formal specification of how these methods are used:
  420. *
  421. * type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)
  422. * decl := ReactPropTypes.{type}(.isRequired)?
  423. *
  424. * Each and every declaration produces a function with the same signature. This
  425. * allows the creation of custom validation functions. For example:
  426. *
  427. * var MyLink = React.createClass({
  428. * propTypes: {
  429. * // An optional string or URI prop named "href".
  430. * href: function(props, propName, componentName) {
  431. * var propValue = props[propName];
  432. * if (propValue != null && typeof propValue !== 'string' &&
  433. * !(propValue instanceof URI)) {
  434. * return new Error(
  435. * 'Expected a string or an URI for ' + propName + ' in ' +
  436. * componentName
  437. * );
  438. * }
  439. * }
  440. * },
  441. * render: function() {...}
  442. * });
  443. *
  444. * @internal
  445. */
  446. var ANONYMOUS = '<<anonymous>>';
  447. // Important!
  448. // Keep this list in sync with production version in `./factoryWithThrowingShims.js`.
  449. var ReactPropTypes = {
  450. array: createPrimitiveTypeChecker('array'),
  451. bool: createPrimitiveTypeChecker('boolean'),
  452. func: createPrimitiveTypeChecker('function'),
  453. number: createPrimitiveTypeChecker('number'),
  454. object: createPrimitiveTypeChecker('object'),
  455. string: createPrimitiveTypeChecker('string'),
  456. symbol: createPrimitiveTypeChecker('symbol'),
  457. any: createAnyTypeChecker(),
  458. arrayOf: createArrayOfTypeChecker,
  459. element: createElementTypeChecker(),
  460. elementType: createElementTypeTypeChecker(),
  461. instanceOf: createInstanceTypeChecker,
  462. node: createNodeChecker(),
  463. objectOf: createObjectOfTypeChecker,
  464. oneOf: createEnumTypeChecker,
  465. oneOfType: createUnionTypeChecker,
  466. shape: createShapeTypeChecker,
  467. exact: createStrictShapeTypeChecker,
  468. };
  469. /**
  470. * inlined Object.is polyfill to avoid requiring consumers ship their own
  471. * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
  472. */
  473. /*eslint-disable no-self-compare*/
  474. function is(x, y) {
  475. // SameValue algorithm
  476. if (x === y) {
  477. // Steps 1-5, 7-10
  478. // Steps 6.b-6.e: +0 != -0
  479. return x !== 0 || 1 / x === 1 / y;
  480. } else {
  481. // Step 6.a: NaN == NaN
  482. return x !== x && y !== y;
  483. }
  484. }
  485. /*eslint-enable no-self-compare*/
  486. /**
  487. * We use an Error-like object for backward compatibility as people may call
  488. * PropTypes directly and inspect their output. However, we don't use real
  489. * Errors anymore. We don't inspect their stack anyway, and creating them
  490. * is prohibitively expensive if they are created too often, such as what
  491. * happens in oneOfType() for any type before the one that matched.
  492. */
  493. function PropTypeError(message) {
  494. this.message = message;
  495. this.stack = '';
  496. }
  497. // Make `instanceof Error` still work for returned errors.
  498. PropTypeError.prototype = Error.prototype;
  499. function createChainableTypeChecker(validate) {
  500. {
  501. var manualPropTypeCallCache = {};
  502. var manualPropTypeWarningCount = 0;
  503. }
  504. function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
  505. componentName = componentName || ANONYMOUS;
  506. propFullName = propFullName || propName;
  507. if (secret !== ReactPropTypesSecret) {
  508. if (throwOnDirectAccess) {
  509. // New behavior only for users of `prop-types` package
  510. var err = new Error(
  511. 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
  512. 'Use `PropTypes.checkPropTypes()` to call them. ' +
  513. 'Read more at http://fb.me/use-check-prop-types'
  514. );
  515. err.name = 'Invariant Violation';
  516. throw err;
  517. } else if (typeof console !== 'undefined') {
  518. // Old behavior for people using React.PropTypes
  519. var cacheKey = componentName + ':' + propName;
  520. if (
  521. !manualPropTypeCallCache[cacheKey] &&
  522. // Avoid spamming the console because they are often not actionable except for lib authors
  523. manualPropTypeWarningCount < 3
  524. ) {
  525. printWarning(
  526. 'You are manually calling a React.PropTypes validation ' +
  527. 'function for the `' + propFullName + '` prop on `' + componentName + '`. This is deprecated ' +
  528. 'and will throw in the standalone `prop-types` package. ' +
  529. 'You may be seeing this warning due to a third-party PropTypes ' +
  530. 'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.'
  531. );
  532. manualPropTypeCallCache[cacheKey] = true;
  533. manualPropTypeWarningCount++;
  534. }
  535. }
  536. }
  537. if (props[propName] == null) {
  538. if (isRequired) {
  539. if (props[propName] === null) {
  540. return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));
  541. }
  542. return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));
  543. }
  544. return null;
  545. } else {
  546. return validate(props, propName, componentName, location, propFullName);
  547. }
  548. }
  549. var chainedCheckType = checkType.bind(null, false);
  550. chainedCheckType.isRequired = checkType.bind(null, true);
  551. return chainedCheckType;
  552. }
  553. function createPrimitiveTypeChecker(expectedType) {
  554. function validate(props, propName, componentName, location, propFullName, secret) {
  555. var propValue = props[propName];
  556. var propType = getPropType(propValue);
  557. if (propType !== expectedType) {
  558. // `propValue` being instance of, say, date/regexp, pass the 'object'
  559. // check, but we can offer a more precise error message here rather than
  560. // 'of type `object`'.
  561. var preciseType = getPreciseType(propValue);
  562. return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'));
  563. }
  564. return null;
  565. }
  566. return createChainableTypeChecker(validate);
  567. }
  568. function createAnyTypeChecker() {
  569. return createChainableTypeChecker(emptyFunctionThatReturnsNull);
  570. }
  571. function createArrayOfTypeChecker(typeChecker) {
  572. function validate(props, propName, componentName, location, propFullName) {
  573. if (typeof typeChecker !== 'function') {
  574. return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');
  575. }
  576. var propValue = props[propName];
  577. if (!Array.isArray(propValue)) {
  578. var propType = getPropType(propValue);
  579. return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
  580. }
  581. for (var i = 0; i < propValue.length; i++) {
  582. var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret);
  583. if (error instanceof Error) {
  584. return error;
  585. }
  586. }
  587. return null;
  588. }
  589. return createChainableTypeChecker(validate);
  590. }
  591. function createElementTypeChecker() {
  592. function validate(props, propName, componentName, location, propFullName) {
  593. var propValue = props[propName];
  594. if (!isValidElement(propValue)) {
  595. var propType = getPropType(propValue);
  596. return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));
  597. }
  598. return null;
  599. }
  600. return createChainableTypeChecker(validate);
  601. }
  602. function createElementTypeTypeChecker() {
  603. function validate(props, propName, componentName, location, propFullName) {
  604. var propValue = props[propName];
  605. if (!ReactIs$1.isValidElementType(propValue)) {
  606. var propType = getPropType(propValue);
  607. return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement type.'));
  608. }
  609. return null;
  610. }
  611. return createChainableTypeChecker(validate);
  612. }
  613. function createInstanceTypeChecker(expectedClass) {
  614. function validate(props, propName, componentName, location, propFullName) {
  615. if (!(props[propName] instanceof expectedClass)) {
  616. var expectedClassName = expectedClass.name || ANONYMOUS;
  617. var actualClassName = getClassName(props[propName]);
  618. return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
  619. }
  620. return null;
  621. }
  622. return createChainableTypeChecker(validate);
  623. }
  624. function createEnumTypeChecker(expectedValues) {
  625. if (!Array.isArray(expectedValues)) {
  626. {
  627. if (arguments.length > 1) {
  628. printWarning(
  629. 'Invalid arguments supplied to oneOf, expected an array, got ' + arguments.length + ' arguments. ' +
  630. 'A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).'
  631. );
  632. } else {
  633. printWarning('Invalid argument supplied to oneOf, expected an array.');
  634. }
  635. }
  636. return emptyFunctionThatReturnsNull;
  637. }
  638. function validate(props, propName, componentName, location, propFullName) {
  639. var propValue = props[propName];
  640. for (var i = 0; i < expectedValues.length; i++) {
  641. if (is(propValue, expectedValues[i])) {
  642. return null;
  643. }
  644. }
  645. var valuesString = JSON.stringify(expectedValues, function replacer(key, value) {
  646. var type = getPreciseType(value);
  647. if (type === 'symbol') {
  648. return String(value);
  649. }
  650. return value;
  651. });
  652. return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + String(propValue) + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
  653. }
  654. return createChainableTypeChecker(validate);
  655. }
  656. function createObjectOfTypeChecker(typeChecker) {
  657. function validate(props, propName, componentName, location, propFullName) {
  658. if (typeof typeChecker !== 'function') {
  659. return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');
  660. }
  661. var propValue = props[propName];
  662. var propType = getPropType(propValue);
  663. if (propType !== 'object') {
  664. return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
  665. }
  666. for (var key in propValue) {
  667. if (has(propValue, key)) {
  668. var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
  669. if (error instanceof Error) {
  670. return error;
  671. }
  672. }
  673. }
  674. return null;
  675. }
  676. return createChainableTypeChecker(validate);
  677. }
  678. function createUnionTypeChecker(arrayOfTypeCheckers) {
  679. if (!Array.isArray(arrayOfTypeCheckers)) {
  680. printWarning('Invalid argument supplied to oneOfType, expected an instance of array.') ;
  681. return emptyFunctionThatReturnsNull;
  682. }
  683. for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
  684. var checker = arrayOfTypeCheckers[i];
  685. if (typeof checker !== 'function') {
  686. printWarning(
  687. 'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' +
  688. 'received ' + getPostfixForTypeWarning(checker) + ' at index ' + i + '.'
  689. );
  690. return emptyFunctionThatReturnsNull;
  691. }
  692. }
  693. function validate(props, propName, componentName, location, propFullName) {
  694. for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
  695. var checker = arrayOfTypeCheckers[i];
  696. if (checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret) == null) {
  697. return null;
  698. }
  699. }
  700. return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.'));
  701. }
  702. return createChainableTypeChecker(validate);
  703. }
  704. function createNodeChecker() {
  705. function validate(props, propName, componentName, location, propFullName) {
  706. if (!isNode(props[propName])) {
  707. return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
  708. }
  709. return null;
  710. }
  711. return createChainableTypeChecker(validate);
  712. }
  713. function createShapeTypeChecker(shapeTypes) {
  714. function validate(props, propName, componentName, location, propFullName) {
  715. var propValue = props[propName];
  716. var propType = getPropType(propValue);
  717. if (propType !== 'object') {
  718. return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
  719. }
  720. for (var key in shapeTypes) {
  721. var checker = shapeTypes[key];
  722. if (!checker) {
  723. continue;
  724. }
  725. var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
  726. if (error) {
  727. return error;
  728. }
  729. }
  730. return null;
  731. }
  732. return createChainableTypeChecker(validate);
  733. }
  734. function createStrictShapeTypeChecker(shapeTypes) {
  735. function validate(props, propName, componentName, location, propFullName) {
  736. var propValue = props[propName];
  737. var propType = getPropType(propValue);
  738. if (propType !== 'object') {
  739. return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
  740. }
  741. // We need to check all keys in case some are required but missing from
  742. // props.
  743. var allKeys = assign({}, props[propName], shapeTypes);
  744. for (var key in allKeys) {
  745. var checker = shapeTypes[key];
  746. if (!checker) {
  747. return new PropTypeError(
  748. 'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' +
  749. '\nBad object: ' + JSON.stringify(props[propName], null, ' ') +
  750. '\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ')
  751. );
  752. }
  753. var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
  754. if (error) {
  755. return error;
  756. }
  757. }
  758. return null;
  759. }
  760. return createChainableTypeChecker(validate);
  761. }
  762. function isNode(propValue) {
  763. switch (typeof propValue) {
  764. case 'number':
  765. case 'string':
  766. case 'undefined':
  767. return true;
  768. case 'boolean':
  769. return !propValue;
  770. case 'object':
  771. if (Array.isArray(propValue)) {
  772. return propValue.every(isNode);
  773. }
  774. if (propValue === null || isValidElement(propValue)) {
  775. return true;
  776. }
  777. var iteratorFn = getIteratorFn(propValue);
  778. if (iteratorFn) {
  779. var iterator = iteratorFn.call(propValue);
  780. var step;
  781. if (iteratorFn !== propValue.entries) {
  782. while (!(step = iterator.next()).done) {
  783. if (!isNode(step.value)) {
  784. return false;
  785. }
  786. }
  787. } else {
  788. // Iterator will provide entry [k,v] tuples rather than values.
  789. while (!(step = iterator.next()).done) {
  790. var entry = step.value;
  791. if (entry) {
  792. if (!isNode(entry[1])) {
  793. return false;
  794. }
  795. }
  796. }
  797. }
  798. } else {
  799. return false;
  800. }
  801. return true;
  802. default:
  803. return false;
  804. }
  805. }
  806. function isSymbol(propType, propValue) {
  807. // Native Symbol.
  808. if (propType === 'symbol') {
  809. return true;
  810. }
  811. // falsy value can't be a Symbol
  812. if (!propValue) {
  813. return false;
  814. }
  815. // 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol'
  816. if (propValue['@@toStringTag'] === 'Symbol') {
  817. return true;
  818. }
  819. // Fallback for non-spec compliant Symbols which are polyfilled.
  820. if (typeof Symbol === 'function' && propValue instanceof Symbol) {
  821. return true;
  822. }
  823. return false;
  824. }
  825. // Equivalent of `typeof` but with special handling for array and regexp.
  826. function getPropType(propValue) {
  827. var propType = typeof propValue;
  828. if (Array.isArray(propValue)) {
  829. return 'array';
  830. }
  831. if (propValue instanceof RegExp) {
  832. // Old webkits (at least until Android 4.0) return 'function' rather than
  833. // 'object' for typeof a RegExp. We'll normalize this here so that /bla/
  834. // passes PropTypes.object.
  835. return 'object';
  836. }
  837. if (isSymbol(propType, propValue)) {
  838. return 'symbol';
  839. }
  840. return propType;
  841. }
  842. // This handles more types than `getPropType`. Only used for error messages.
  843. // See `createPrimitiveTypeChecker`.
  844. function getPreciseType(propValue) {
  845. if (typeof propValue === 'undefined' || propValue === null) {
  846. return '' + propValue;
  847. }
  848. var propType = getPropType(propValue);
  849. if (propType === 'object') {
  850. if (propValue instanceof Date) {
  851. return 'date';
  852. } else if (propValue instanceof RegExp) {
  853. return 'regexp';
  854. }
  855. }
  856. return propType;
  857. }
  858. // Returns a string that is postfixed to a warning about an invalid type.
  859. // For example, "undefined" or "of type array"
  860. function getPostfixForTypeWarning(value) {
  861. var type = getPreciseType(value);
  862. switch (type) {
  863. case 'array':
  864. case 'object':
  865. return 'an ' + type;
  866. case 'boolean':
  867. case 'date':
  868. case 'regexp':
  869. return 'a ' + type;
  870. default:
  871. return type;
  872. }
  873. }
  874. // Returns class name of the object, if any.
  875. function getClassName(propValue) {
  876. if (!propValue.constructor || !propValue.constructor.name) {
  877. return ANONYMOUS;
  878. }
  879. return propValue.constructor.name;
  880. }
  881. ReactPropTypes.checkPropTypes = checkPropTypes;
  882. ReactPropTypes.resetWarningCache = checkPropTypes.resetWarningCache;
  883. ReactPropTypes.PropTypes = ReactPropTypes;
  884. return ReactPropTypes;
  885. };
  886. /**
  887. * Copyright (c) 2013-present, Facebook, Inc.
  888. *
  889. * This source code is licensed under the MIT license found in the
  890. * LICENSE file in the root directory of this source tree.
  891. */
  892. {
  893. var ReactIs = reactIs$3.exports;
  894. // By explicitly using `prop-types` you are opting into new development behavior.
  895. // http://fb.me/prop-types-in-prod
  896. var throwOnDirectAccess = true;
  897. propTypes.exports = factoryWithTypeCheckers(ReactIs.isElement, throwOnDirectAccess);
  898. }
  899. var PropTypes = propTypes.exports;
  900. var ReactReduxContext = /*#__PURE__*/React__default["default"].createContext(null);
  901. {
  902. ReactReduxContext.displayName = 'ReactRedux';
  903. }
  904. // Default to a dummy "batch" implementation that just runs the callback
  905. function defaultNoopBatch(callback) {
  906. callback();
  907. }
  908. var batch = defaultNoopBatch; // Allow injecting another batching function later
  909. var setBatch = function setBatch(newBatch) {
  910. return batch = newBatch;
  911. }; // Supply a getter just to skip dealing with ESM bindings
  912. var getBatch = function getBatch() {
  913. return batch;
  914. };
  915. // well as nesting subscriptions of descendant components, so that we can ensure the
  916. // ancestor components re-render before descendants
  917. function createListenerCollection() {
  918. var batch = getBatch();
  919. var first = null;
  920. var last = null;
  921. return {
  922. clear: function clear() {
  923. first = null;
  924. last = null;
  925. },
  926. notify: function notify() {
  927. batch(function () {
  928. var listener = first;
  929. while (listener) {
  930. listener.callback();
  931. listener = listener.next;
  932. }
  933. });
  934. },
  935. get: function get() {
  936. var listeners = [];
  937. var listener = first;
  938. while (listener) {
  939. listeners.push(listener);
  940. listener = listener.next;
  941. }
  942. return listeners;
  943. },
  944. subscribe: function subscribe(callback) {
  945. var isSubscribed = true;
  946. var listener = last = {
  947. callback: callback,
  948. next: null,
  949. prev: last
  950. };
  951. if (listener.prev) {
  952. listener.prev.next = listener;
  953. } else {
  954. first = listener;
  955. }
  956. return function unsubscribe() {
  957. if (!isSubscribed || first === null) return;
  958. isSubscribed = false;
  959. if (listener.next) {
  960. listener.next.prev = listener.prev;
  961. } else {
  962. last = listener.prev;
  963. }
  964. if (listener.prev) {
  965. listener.prev.next = listener.next;
  966. } else {
  967. first = listener.next;
  968. }
  969. };
  970. }
  971. };
  972. }
  973. var nullListeners = {
  974. notify: function notify() {},
  975. get: function get() {
  976. return [];
  977. }
  978. };
  979. function createSubscription(store, parentSub) {
  980. var unsubscribe;
  981. var listeners = nullListeners;
  982. function addNestedSub(listener) {
  983. trySubscribe();
  984. return listeners.subscribe(listener);
  985. }
  986. function notifyNestedSubs() {
  987. listeners.notify();
  988. }
  989. function handleChangeWrapper() {
  990. if (subscription.onStateChange) {
  991. subscription.onStateChange();
  992. }
  993. }
  994. function isSubscribed() {
  995. return Boolean(unsubscribe);
  996. }
  997. function trySubscribe() {
  998. if (!unsubscribe) {
  999. unsubscribe = parentSub ? parentSub.addNestedSub(handleChangeWrapper) : store.subscribe(handleChangeWrapper);
  1000. listeners = createListenerCollection();
  1001. }
  1002. }
  1003. function tryUnsubscribe() {
  1004. if (unsubscribe) {
  1005. unsubscribe();
  1006. unsubscribe = undefined;
  1007. listeners.clear();
  1008. listeners = nullListeners;
  1009. }
  1010. }
  1011. var subscription = {
  1012. addNestedSub: addNestedSub,
  1013. notifyNestedSubs: notifyNestedSubs,
  1014. handleChangeWrapper: handleChangeWrapper,
  1015. isSubscribed: isSubscribed,
  1016. trySubscribe: trySubscribe,
  1017. tryUnsubscribe: tryUnsubscribe,
  1018. getListeners: function getListeners() {
  1019. return listeners;
  1020. }
  1021. };
  1022. return subscription;
  1023. }
  1024. // To get around it, we can conditionally useEffect on the server (no-op) and
  1025. // useLayoutEffect in the browser. We need useLayoutEffect to ensure the store
  1026. // subscription callback always has the selector from the latest render commit
  1027. // available, otherwise a store update may happen between render and the effect,
  1028. // which may cause missed updates; we also must ensure the store subscription
  1029. // is created synchronously, otherwise a store update may occur before the
  1030. // subscription is created and an inconsistent state may be observed
  1031. var useIsomorphicLayoutEffect = typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined' ? React.useLayoutEffect : React.useEffect;
  1032. function Provider(_ref) {
  1033. var store = _ref.store,
  1034. context = _ref.context,
  1035. children = _ref.children;
  1036. var contextValue = React.useMemo(function () {
  1037. var subscription = createSubscription(store);
  1038. subscription.onStateChange = subscription.notifyNestedSubs;
  1039. return {
  1040. store: store,
  1041. subscription: subscription
  1042. };
  1043. }, [store]);
  1044. var previousState = React.useMemo(function () {
  1045. return store.getState();
  1046. }, [store]);
  1047. useIsomorphicLayoutEffect(function () {
  1048. var subscription = contextValue.subscription;
  1049. subscription.trySubscribe();
  1050. if (previousState !== store.getState()) {
  1051. subscription.notifyNestedSubs();
  1052. }
  1053. return function () {
  1054. subscription.tryUnsubscribe();
  1055. subscription.onStateChange = null;
  1056. };
  1057. }, [contextValue, previousState]);
  1058. var Context = context || ReactReduxContext;
  1059. return /*#__PURE__*/React__default["default"].createElement(Context.Provider, {
  1060. value: contextValue
  1061. }, children);
  1062. }
  1063. {
  1064. Provider.propTypes = {
  1065. store: PropTypes.shape({
  1066. subscribe: PropTypes.func.isRequired,
  1067. dispatch: PropTypes.func.isRequired,
  1068. getState: PropTypes.func.isRequired
  1069. }),
  1070. context: PropTypes.object,
  1071. children: PropTypes.any
  1072. };
  1073. }
  1074. function _extends() {
  1075. _extends = Object.assign || function (target) {
  1076. for (var i = 1; i < arguments.length; i++) {
  1077. var source = arguments[i];
  1078. for (var key in source) {
  1079. if (Object.prototype.hasOwnProperty.call(source, key)) {
  1080. target[key] = source[key];
  1081. }
  1082. }
  1083. }
  1084. return target;
  1085. };
  1086. return _extends.apply(this, arguments);
  1087. }
  1088. function _objectWithoutPropertiesLoose(source, excluded) {
  1089. if (source == null) return {};
  1090. var target = {};
  1091. var sourceKeys = Object.keys(source);
  1092. var key, i;
  1093. for (i = 0; i < sourceKeys.length; i++) {
  1094. key = sourceKeys[i];
  1095. if (excluded.indexOf(key) >= 0) continue;
  1096. target[key] = source[key];
  1097. }
  1098. return target;
  1099. }
  1100. var reactIs$2 = {exports: {}};
  1101. var reactIs_development$1 = {};
  1102. /** @license React v16.13.1
  1103. * react-is.development.js
  1104. *
  1105. * Copyright (c) Facebook, Inc. and its affiliates.
  1106. *
  1107. * This source code is licensed under the MIT license found in the
  1108. * LICENSE file in the root directory of this source tree.
  1109. */
  1110. {
  1111. (function() {
  1112. // The Symbol used to tag the ReactElement-like types. If there is no native Symbol
  1113. // nor polyfill, then a plain number is used for performance.
  1114. var hasSymbol = typeof Symbol === 'function' && Symbol.for;
  1115. var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
  1116. var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
  1117. var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
  1118. var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
  1119. var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
  1120. var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
  1121. var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary
  1122. // (unstable) APIs that have been removed. Can we remove the symbols?
  1123. var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;
  1124. var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
  1125. var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
  1126. var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
  1127. var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;
  1128. var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
  1129. var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
  1130. var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9;
  1131. var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5;
  1132. var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6;
  1133. var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7;
  1134. function isValidElementType(type) {
  1135. return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
  1136. type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_BLOCK_TYPE);
  1137. }
  1138. function typeOf(object) {
  1139. if (typeof object === 'object' && object !== null) {
  1140. var $$typeof = object.$$typeof;
  1141. switch ($$typeof) {
  1142. case REACT_ELEMENT_TYPE:
  1143. var type = object.type;
  1144. switch (type) {
  1145. case REACT_ASYNC_MODE_TYPE:
  1146. case REACT_CONCURRENT_MODE_TYPE:
  1147. case REACT_FRAGMENT_TYPE:
  1148. case REACT_PROFILER_TYPE:
  1149. case REACT_STRICT_MODE_TYPE:
  1150. case REACT_SUSPENSE_TYPE:
  1151. return type;
  1152. default:
  1153. var $$typeofType = type && type.$$typeof;
  1154. switch ($$typeofType) {
  1155. case REACT_CONTEXT_TYPE:
  1156. case REACT_FORWARD_REF_TYPE:
  1157. case REACT_LAZY_TYPE:
  1158. case REACT_MEMO_TYPE:
  1159. case REACT_PROVIDER_TYPE:
  1160. return $$typeofType;
  1161. default:
  1162. return $$typeof;
  1163. }
  1164. }
  1165. case REACT_PORTAL_TYPE:
  1166. return $$typeof;
  1167. }
  1168. }
  1169. return undefined;
  1170. } // AsyncMode is deprecated along with isAsyncMode
  1171. var AsyncMode = REACT_ASYNC_MODE_TYPE;
  1172. var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
  1173. var ContextConsumer = REACT_CONTEXT_TYPE;
  1174. var ContextProvider = REACT_PROVIDER_TYPE;
  1175. var Element = REACT_ELEMENT_TYPE;
  1176. var ForwardRef = REACT_FORWARD_REF_TYPE;
  1177. var Fragment = REACT_FRAGMENT_TYPE;
  1178. var Lazy = REACT_LAZY_TYPE;
  1179. var Memo = REACT_MEMO_TYPE;
  1180. var Portal = REACT_PORTAL_TYPE;
  1181. var Profiler = REACT_PROFILER_TYPE;
  1182. var StrictMode = REACT_STRICT_MODE_TYPE;
  1183. var Suspense = REACT_SUSPENSE_TYPE;
  1184. var hasWarnedAboutDeprecatedIsAsyncMode = false; // AsyncMode should be deprecated
  1185. function isAsyncMode(object) {
  1186. {
  1187. if (!hasWarnedAboutDeprecatedIsAsyncMode) {
  1188. hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint
  1189. console['warn']('The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 17+. Update your code to use ' + 'ReactIs.isConcurrentMode() instead. It has the exact same API.');
  1190. }
  1191. }
  1192. return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE;
  1193. }
  1194. function isConcurrentMode(object) {
  1195. return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;
  1196. }
  1197. function isContextConsumer(object) {
  1198. return typeOf(object) === REACT_CONTEXT_TYPE;
  1199. }
  1200. function isContextProvider(object) {
  1201. return typeOf(object) === REACT_PROVIDER_TYPE;
  1202. }
  1203. function isElement(object) {
  1204. return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
  1205. }
  1206. function isForwardRef(object) {
  1207. return typeOf(object) === REACT_FORWARD_REF_TYPE;
  1208. }
  1209. function isFragment(object) {
  1210. return typeOf(object) === REACT_FRAGMENT_TYPE;
  1211. }
  1212. function isLazy(object) {
  1213. return typeOf(object) === REACT_LAZY_TYPE;
  1214. }
  1215. function isMemo(object) {
  1216. return typeOf(object) === REACT_MEMO_TYPE;
  1217. }
  1218. function isPortal(object) {
  1219. return typeOf(object) === REACT_PORTAL_TYPE;
  1220. }
  1221. function isProfiler(object) {
  1222. return typeOf(object) === REACT_PROFILER_TYPE;
  1223. }
  1224. function isStrictMode(object) {
  1225. return typeOf(object) === REACT_STRICT_MODE_TYPE;
  1226. }
  1227. function isSuspense(object) {
  1228. return typeOf(object) === REACT_SUSPENSE_TYPE;
  1229. }
  1230. reactIs_development$1.AsyncMode = AsyncMode;
  1231. reactIs_development$1.ConcurrentMode = ConcurrentMode;
  1232. reactIs_development$1.ContextConsumer = ContextConsumer;
  1233. reactIs_development$1.ContextProvider = ContextProvider;
  1234. reactIs_development$1.Element = Element;
  1235. reactIs_development$1.ForwardRef = ForwardRef;
  1236. reactIs_development$1.Fragment = Fragment;
  1237. reactIs_development$1.Lazy = Lazy;
  1238. reactIs_development$1.Memo = Memo;
  1239. reactIs_development$1.Portal = Portal;
  1240. reactIs_development$1.Profiler = Profiler;
  1241. reactIs_development$1.StrictMode = StrictMode;
  1242. reactIs_development$1.Suspense = Suspense;
  1243. reactIs_development$1.isAsyncMode = isAsyncMode;
  1244. reactIs_development$1.isConcurrentMode = isConcurrentMode;
  1245. reactIs_development$1.isContextConsumer = isContextConsumer;
  1246. reactIs_development$1.isContextProvider = isContextProvider;
  1247. reactIs_development$1.isElement = isElement;
  1248. reactIs_development$1.isForwardRef = isForwardRef;
  1249. reactIs_development$1.isFragment = isFragment;
  1250. reactIs_development$1.isLazy = isLazy;
  1251. reactIs_development$1.isMemo = isMemo;
  1252. reactIs_development$1.isPortal = isPortal;
  1253. reactIs_development$1.isProfiler = isProfiler;
  1254. reactIs_development$1.isStrictMode = isStrictMode;
  1255. reactIs_development$1.isSuspense = isSuspense;
  1256. reactIs_development$1.isValidElementType = isValidElementType;
  1257. reactIs_development$1.typeOf = typeOf;
  1258. })();
  1259. }
  1260. {
  1261. reactIs$2.exports = reactIs_development$1;
  1262. }
  1263. var reactIs$1 = reactIs$2.exports;
  1264. /**
  1265. * Copyright 2015, Yahoo! Inc.
  1266. * Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
  1267. */
  1268. var REACT_STATICS = {
  1269. childContextTypes: true,
  1270. contextType: true,
  1271. contextTypes: true,
  1272. defaultProps: true,
  1273. displayName: true,
  1274. getDefaultProps: true,
  1275. getDerivedStateFromError: true,
  1276. getDerivedStateFromProps: true,
  1277. mixins: true,
  1278. propTypes: true,
  1279. type: true
  1280. };
  1281. var KNOWN_STATICS = {
  1282. name: true,
  1283. length: true,
  1284. prototype: true,
  1285. caller: true,
  1286. callee: true,
  1287. arguments: true,
  1288. arity: true
  1289. };
  1290. var FORWARD_REF_STATICS = {
  1291. '$$typeof': true,
  1292. render: true,
  1293. defaultProps: true,
  1294. displayName: true,
  1295. propTypes: true
  1296. };
  1297. var MEMO_STATICS = {
  1298. '$$typeof': true,
  1299. compare: true,
  1300. defaultProps: true,
  1301. displayName: true,
  1302. propTypes: true,
  1303. type: true
  1304. };
  1305. var TYPE_STATICS = {};
  1306. TYPE_STATICS[reactIs$1.ForwardRef] = FORWARD_REF_STATICS;
  1307. TYPE_STATICS[reactIs$1.Memo] = MEMO_STATICS;
  1308. function getStatics(component) {
  1309. // React v16.11 and below
  1310. if (reactIs$1.isMemo(component)) {
  1311. return MEMO_STATICS;
  1312. } // React v16.12 and above
  1313. return TYPE_STATICS[component['$$typeof']] || REACT_STATICS;
  1314. }
  1315. var defineProperty = Object.defineProperty;
  1316. var getOwnPropertyNames = Object.getOwnPropertyNames;
  1317. var getOwnPropertySymbols = Object.getOwnPropertySymbols;
  1318. var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
  1319. var getPrototypeOf = Object.getPrototypeOf;
  1320. var objectPrototype = Object.prototype;
  1321. function hoistNonReactStatics(targetComponent, sourceComponent, blacklist) {
  1322. if (typeof sourceComponent !== 'string') {
  1323. // don't hoist over string (html) components
  1324. if (objectPrototype) {
  1325. var inheritedComponent = getPrototypeOf(sourceComponent);
  1326. if (inheritedComponent && inheritedComponent !== objectPrototype) {
  1327. hoistNonReactStatics(targetComponent, inheritedComponent, blacklist);
  1328. }
  1329. }
  1330. var keys = getOwnPropertyNames(sourceComponent);
  1331. if (getOwnPropertySymbols) {
  1332. keys = keys.concat(getOwnPropertySymbols(sourceComponent));
  1333. }
  1334. var targetStatics = getStatics(targetComponent);
  1335. var sourceStatics = getStatics(sourceComponent);
  1336. for (var i = 0; i < keys.length; ++i) {
  1337. var key = keys[i];
  1338. if (!KNOWN_STATICS[key] && !(blacklist && blacklist[key]) && !(sourceStatics && sourceStatics[key]) && !(targetStatics && targetStatics[key])) {
  1339. var descriptor = getOwnPropertyDescriptor(sourceComponent, key);
  1340. try {
  1341. // Avoid failures from read-only properties
  1342. defineProperty(targetComponent, key, descriptor);
  1343. } catch (e) {}
  1344. }
  1345. }
  1346. }
  1347. return targetComponent;
  1348. }
  1349. var hoistNonReactStatics_cjs = hoistNonReactStatics;
  1350. var reactIs = {exports: {}};
  1351. var reactIs_development = {};
  1352. /** @license React v17.0.2
  1353. * react-is.development.js
  1354. *
  1355. * Copyright (c) Facebook, Inc. and its affiliates.
  1356. *
  1357. * This source code is licensed under the MIT license found in the
  1358. * LICENSE file in the root directory of this source tree.
  1359. */
  1360. {
  1361. (function() {
  1362. // ATTENTION
  1363. // When adding new symbols to this file,
  1364. // Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'
  1365. // The Symbol used to tag the ReactElement-like types. If there is no native Symbol
  1366. // nor polyfill, then a plain number is used for performance.
  1367. var REACT_ELEMENT_TYPE = 0xeac7;
  1368. var REACT_PORTAL_TYPE = 0xeaca;
  1369. var REACT_FRAGMENT_TYPE = 0xeacb;
  1370. var REACT_STRICT_MODE_TYPE = 0xeacc;
  1371. var REACT_PROFILER_TYPE = 0xead2;
  1372. var REACT_PROVIDER_TYPE = 0xeacd;
  1373. var REACT_CONTEXT_TYPE = 0xeace;
  1374. var REACT_FORWARD_REF_TYPE = 0xead0;
  1375. var REACT_SUSPENSE_TYPE = 0xead1;
  1376. var REACT_SUSPENSE_LIST_TYPE = 0xead8;
  1377. var REACT_MEMO_TYPE = 0xead3;
  1378. var REACT_LAZY_TYPE = 0xead4;
  1379. var REACT_BLOCK_TYPE = 0xead9;
  1380. var REACT_SERVER_BLOCK_TYPE = 0xeada;
  1381. var REACT_FUNDAMENTAL_TYPE = 0xead5;
  1382. var REACT_DEBUG_TRACING_MODE_TYPE = 0xeae1;
  1383. var REACT_LEGACY_HIDDEN_TYPE = 0xeae3;
  1384. if (typeof Symbol === 'function' && Symbol.for) {
  1385. var symbolFor = Symbol.for;
  1386. REACT_ELEMENT_TYPE = symbolFor('react.element');
  1387. REACT_PORTAL_TYPE = symbolFor('react.portal');
  1388. REACT_FRAGMENT_TYPE = symbolFor('react.fragment');
  1389. REACT_STRICT_MODE_TYPE = symbolFor('react.strict_mode');
  1390. REACT_PROFILER_TYPE = symbolFor('react.profiler');
  1391. REACT_PROVIDER_TYPE = symbolFor('react.provider');
  1392. REACT_CONTEXT_TYPE = symbolFor('react.context');
  1393. REACT_FORWARD_REF_TYPE = symbolFor('react.forward_ref');
  1394. REACT_SUSPENSE_TYPE = symbolFor('react.suspense');
  1395. REACT_SUSPENSE_LIST_TYPE = symbolFor('react.suspense_list');
  1396. REACT_MEMO_TYPE = symbolFor('react.memo');
  1397. REACT_LAZY_TYPE = symbolFor('react.lazy');
  1398. REACT_BLOCK_TYPE = symbolFor('react.block');
  1399. REACT_SERVER_BLOCK_TYPE = symbolFor('react.server.block');
  1400. REACT_FUNDAMENTAL_TYPE = symbolFor('react.fundamental');
  1401. symbolFor('react.scope');
  1402. symbolFor('react.opaque.id');
  1403. REACT_DEBUG_TRACING_MODE_TYPE = symbolFor('react.debug_trace_mode');
  1404. symbolFor('react.offscreen');
  1405. REACT_LEGACY_HIDDEN_TYPE = symbolFor('react.legacy_hidden');
  1406. }
  1407. // Filter certain DOM attributes (e.g. src, href) if their values are empty strings.
  1408. var enableScopeAPI = false; // Experimental Create Event Handle API.
  1409. function isValidElementType(type) {
  1410. if (typeof type === 'string' || typeof type === 'function') {
  1411. return true;
  1412. } // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).
  1413. if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || type === REACT_DEBUG_TRACING_MODE_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || type === REACT_LEGACY_HIDDEN_TYPE || enableScopeAPI ) {
  1414. return true;
  1415. }
  1416. if (typeof type === 'object' && type !== null) {
  1417. if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_BLOCK_TYPE || type[0] === REACT_SERVER_BLOCK_TYPE) {
  1418. return true;
  1419. }
  1420. }
  1421. return false;
  1422. }
  1423. function typeOf(object) {
  1424. if (typeof object === 'object' && object !== null) {
  1425. var $$typeof = object.$$typeof;
  1426. switch ($$typeof) {
  1427. case REACT_ELEMENT_TYPE:
  1428. var type = object.type;
  1429. switch (type) {
  1430. case REACT_FRAGMENT_TYPE:
  1431. case REACT_PROFILER_TYPE:
  1432. case REACT_STRICT_MODE_TYPE:
  1433. case REACT_SUSPENSE_TYPE:
  1434. case REACT_SUSPENSE_LIST_TYPE:
  1435. return type;
  1436. default:
  1437. var $$typeofType = type && type.$$typeof;
  1438. switch ($$typeofType) {
  1439. case REACT_CONTEXT_TYPE:
  1440. case REACT_FORWARD_REF_TYPE:
  1441. case REACT_LAZY_TYPE:
  1442. case REACT_MEMO_TYPE:
  1443. case REACT_PROVIDER_TYPE:
  1444. return $$typeofType;
  1445. default:
  1446. return $$typeof;
  1447. }
  1448. }
  1449. case REACT_PORTAL_TYPE:
  1450. return $$typeof;
  1451. }
  1452. }
  1453. return undefined;
  1454. }
  1455. var ContextConsumer = REACT_CONTEXT_TYPE;
  1456. var ContextProvider = REACT_PROVIDER_TYPE;
  1457. var Element = REACT_ELEMENT_TYPE;
  1458. var ForwardRef = REACT_FORWARD_REF_TYPE;
  1459. var Fragment = REACT_FRAGMENT_TYPE;
  1460. var Lazy = REACT_LAZY_TYPE;
  1461. var Memo = REACT_MEMO_TYPE;
  1462. var Portal = REACT_PORTAL_TYPE;
  1463. var Profiler = REACT_PROFILER_TYPE;
  1464. var StrictMode = REACT_STRICT_MODE_TYPE;
  1465. var Suspense = REACT_SUSPENSE_TYPE;
  1466. var hasWarnedAboutDeprecatedIsAsyncMode = false;
  1467. var hasWarnedAboutDeprecatedIsConcurrentMode = false; // AsyncMode should be deprecated
  1468. function isAsyncMode(object) {
  1469. {
  1470. if (!hasWarnedAboutDeprecatedIsAsyncMode) {
  1471. hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint
  1472. console['warn']('The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 18+.');
  1473. }
  1474. }
  1475. return false;
  1476. }
  1477. function isConcurrentMode(object) {
  1478. {
  1479. if (!hasWarnedAboutDeprecatedIsConcurrentMode) {
  1480. hasWarnedAboutDeprecatedIsConcurrentMode = true; // Using console['warn'] to evade Babel and ESLint
  1481. console['warn']('The ReactIs.isConcurrentMode() alias has been deprecated, ' + 'and will be removed in React 18+.');
  1482. }
  1483. }
  1484. return false;
  1485. }
  1486. function isContextConsumer(object) {
  1487. return typeOf(object) === REACT_CONTEXT_TYPE;
  1488. }
  1489. function isContextProvider(object) {
  1490. return typeOf(object) === REACT_PROVIDER_TYPE;
  1491. }
  1492. function isElement(object) {
  1493. return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
  1494. }
  1495. function isForwardRef(object) {
  1496. return typeOf(object) === REACT_FORWARD_REF_TYPE;
  1497. }
  1498. function isFragment(object) {
  1499. return typeOf(object) === REACT_FRAGMENT_TYPE;
  1500. }
  1501. function isLazy(object) {
  1502. return typeOf(object) === REACT_LAZY_TYPE;
  1503. }
  1504. function isMemo(object) {
  1505. return typeOf(object) === REACT_MEMO_TYPE;
  1506. }
  1507. function isPortal(object) {
  1508. return typeOf(object) === REACT_PORTAL_TYPE;
  1509. }
  1510. function isProfiler(object) {
  1511. return typeOf(object) === REACT_PROFILER_TYPE;
  1512. }
  1513. function isStrictMode(object) {
  1514. return typeOf(object) === REACT_STRICT_MODE_TYPE;
  1515. }
  1516. function isSuspense(object) {
  1517. return typeOf(object) === REACT_SUSPENSE_TYPE;
  1518. }
  1519. reactIs_development.ContextConsumer = ContextConsumer;
  1520. reactIs_development.ContextProvider = ContextProvider;
  1521. reactIs_development.Element = Element;
  1522. reactIs_development.ForwardRef = ForwardRef;
  1523. reactIs_development.Fragment = Fragment;
  1524. reactIs_development.Lazy = Lazy;
  1525. reactIs_development.Memo = Memo;
  1526. reactIs_development.Portal = Portal;
  1527. reactIs_development.Profiler = Profiler;
  1528. reactIs_development.StrictMode = StrictMode;
  1529. reactIs_development.Suspense = Suspense;
  1530. reactIs_development.isAsyncMode = isAsyncMode;
  1531. reactIs_development.isConcurrentMode = isConcurrentMode;
  1532. reactIs_development.isContextConsumer = isContextConsumer;
  1533. reactIs_development.isContextProvider = isContextProvider;
  1534. reactIs_development.isElement = isElement;
  1535. reactIs_development.isForwardRef = isForwardRef;
  1536. reactIs_development.isFragment = isFragment;
  1537. reactIs_development.isLazy = isLazy;
  1538. reactIs_development.isMemo = isMemo;
  1539. reactIs_development.isPortal = isPortal;
  1540. reactIs_development.isProfiler = isProfiler;
  1541. reactIs_development.isStrictMode = isStrictMode;
  1542. reactIs_development.isSuspense = isSuspense;
  1543. reactIs_development.isValidElementType = isValidElementType;
  1544. reactIs_development.typeOf = typeOf;
  1545. })();
  1546. }
  1547. {
  1548. reactIs.exports = reactIs_development;
  1549. }
  1550. var _excluded$2 = ["getDisplayName", "methodName", "renderCountProp", "shouldHandleStateChanges", "storeKey", "withRef", "forwardRef", "context"],
  1551. _excluded2 = ["reactReduxForwardedRef"];
  1552. var EMPTY_ARRAY = [];
  1553. var NO_SUBSCRIPTION_ARRAY = [null, null];
  1554. var stringifyComponent = function stringifyComponent(Comp) {
  1555. try {
  1556. return JSON.stringify(Comp);
  1557. } catch (err) {
  1558. return String(Comp);
  1559. }
  1560. };
  1561. function storeStateUpdatesReducer(state, action) {
  1562. var updateCount = state[1];
  1563. return [action.payload, updateCount + 1];
  1564. }
  1565. function useIsomorphicLayoutEffectWithArgs(effectFunc, effectArgs, dependencies) {
  1566. useIsomorphicLayoutEffect(function () {
  1567. return effectFunc.apply(void 0, effectArgs);
  1568. }, dependencies);
  1569. }
  1570. function captureWrapperProps(lastWrapperProps, lastChildProps, renderIsScheduled, wrapperProps, actualChildProps, childPropsFromStoreUpdate, notifyNestedSubs) {
  1571. // We want to capture the wrapper props and child props we used for later comparisons
  1572. lastWrapperProps.current = wrapperProps;
  1573. lastChildProps.current = actualChildProps;
  1574. renderIsScheduled.current = false; // If the render was from a store update, clear out that reference and cascade the subscriber update
  1575. if (childPropsFromStoreUpdate.current) {
  1576. childPropsFromStoreUpdate.current = null;
  1577. notifyNestedSubs();
  1578. }
  1579. }
  1580. function subscribeUpdates(shouldHandleStateChanges, store, subscription, childPropsSelector, lastWrapperProps, lastChildProps, renderIsScheduled, childPropsFromStoreUpdate, notifyNestedSubs, forceComponentUpdateDispatch) {
  1581. // If we're not subscribed to the store, nothing to do here
  1582. if (!shouldHandleStateChanges) return; // Capture values for checking if and when this component unmounts
  1583. var didUnsubscribe = false;
  1584. var lastThrownError = null; // We'll run this callback every time a store subscription update propagates to this component
  1585. var checkForUpdates = function checkForUpdates() {
  1586. if (didUnsubscribe) {
  1587. // Don't run stale listeners.
  1588. // Redux doesn't guarantee unsubscriptions happen until next dispatch.
  1589. return;
  1590. }
  1591. var latestStoreState = store.getState();
  1592. var newChildProps, error;
  1593. try {
  1594. // Actually run the selector with the most recent store state and wrapper props
  1595. // to determine what the child props should be
  1596. newChildProps = childPropsSelector(latestStoreState, lastWrapperProps.current);
  1597. } catch (e) {
  1598. error = e;
  1599. lastThrownError = e;
  1600. }
  1601. if (!error) {
  1602. lastThrownError = null;
  1603. } // If the child props haven't changed, nothing to do here - cascade the subscription update
  1604. if (newChildProps === lastChildProps.current) {
  1605. if (!renderIsScheduled.current) {
  1606. notifyNestedSubs();
  1607. }
  1608. } else {
  1609. // Save references to the new child props. Note that we track the "child props from store update"
  1610. // as a ref instead of a useState/useReducer because we need a way to determine if that value has
  1611. // been processed. If this went into useState/useReducer, we couldn't clear out the value without
  1612. // forcing another re-render, which we don't want.
  1613. lastChildProps.current = newChildProps;
  1614. childPropsFromStoreUpdate.current = newChildProps;
  1615. renderIsScheduled.current = true; // If the child props _did_ change (or we caught an error), this wrapper component needs to re-render
  1616. forceComponentUpdateDispatch({
  1617. type: 'STORE_UPDATED',
  1618. payload: {
  1619. error: error
  1620. }
  1621. });
  1622. }
  1623. }; // Actually subscribe to the nearest connected ancestor (or store)
  1624. subscription.onStateChange = checkForUpdates;
  1625. subscription.trySubscribe(); // Pull data from the store after first render in case the store has
  1626. // changed since we began.
  1627. checkForUpdates();
  1628. var unsubscribeWrapper = function unsubscribeWrapper() {
  1629. didUnsubscribe = true;
  1630. subscription.tryUnsubscribe();
  1631. subscription.onStateChange = null;
  1632. if (lastThrownError) {
  1633. // It's possible that we caught an error due to a bad mapState function, but the
  1634. // parent re-rendered without this component and we're about to unmount.
  1635. // This shouldn't happen as long as we do top-down subscriptions correctly, but
  1636. // if we ever do those wrong, this throw will surface the error in our tests.
  1637. // In that case, throw the error from here so it doesn't get lost.
  1638. throw lastThrownError;
  1639. }
  1640. };
  1641. return unsubscribeWrapper;
  1642. }
  1643. var initStateUpdates = function initStateUpdates() {
  1644. return [null, 0];
  1645. };
  1646. function connectAdvanced(
  1647. /*
  1648. selectorFactory is a func that is responsible for returning the selector function used to
  1649. compute new props from state, props, and dispatch. For example:
  1650. export default connectAdvanced((dispatch, options) => (state, props) => ({
  1651. thing: state.things[props.thingId],
  1652. saveThing: fields => dispatch(actionCreators.saveThing(props.thingId, fields)),
  1653. }))(YourComponent)
  1654. Access to dispatch is provided to the factory so selectorFactories can bind actionCreators
  1655. outside of their selector as an optimization. Options passed to connectAdvanced are passed to
  1656. the selectorFactory, along with displayName and WrappedComponent, as the second argument.
  1657. Note that selectorFactory is responsible for all caching/memoization of inbound and outbound
  1658. props. Do not use connectAdvanced directly without memoizing results between calls to your
  1659. selector, otherwise the Connect component will re-render on every state or props change.
  1660. */
  1661. selectorFactory, // options object:
  1662. _ref) {
  1663. if (_ref === void 0) {
  1664. _ref = {};
  1665. }
  1666. var _ref2 = _ref,
  1667. _ref2$getDisplayName = _ref2.getDisplayName,
  1668. getDisplayName = _ref2$getDisplayName === void 0 ? function (name) {
  1669. return "ConnectAdvanced(" + name + ")";
  1670. } : _ref2$getDisplayName,
  1671. _ref2$methodName = _ref2.methodName,
  1672. methodName = _ref2$methodName === void 0 ? 'connectAdvanced' : _ref2$methodName,
  1673. _ref2$renderCountProp = _ref2.renderCountProp,
  1674. renderCountProp = _ref2$renderCountProp === void 0 ? undefined : _ref2$renderCountProp,
  1675. _ref2$shouldHandleSta = _ref2.shouldHandleStateChanges,
  1676. shouldHandleStateChanges = _ref2$shouldHandleSta === void 0 ? true : _ref2$shouldHandleSta,
  1677. _ref2$storeKey = _ref2.storeKey,
  1678. storeKey = _ref2$storeKey === void 0 ? 'store' : _ref2$storeKey,
  1679. _ref2$withRef = _ref2.withRef,
  1680. withRef = _ref2$withRef === void 0 ? false : _ref2$withRef,
  1681. _ref2$forwardRef = _ref2.forwardRef,
  1682. forwardRef = _ref2$forwardRef === void 0 ? false : _ref2$forwardRef,
  1683. _ref2$context = _ref2.context,
  1684. context = _ref2$context === void 0 ? ReactReduxContext : _ref2$context,
  1685. connectOptions = _objectWithoutPropertiesLoose(_ref2, _excluded$2);
  1686. {
  1687. if (renderCountProp !== undefined) {
  1688. throw new Error("renderCountProp is removed. render counting is built into the latest React Dev Tools profiling extension");
  1689. }
  1690. if (withRef) {
  1691. throw new Error('withRef is removed. To access the wrapped instance, use a ref on the connected component');
  1692. }
  1693. var customStoreWarningMessage = 'To use a custom Redux store for specific components, create a custom React context with ' + "React.createContext(), and pass the context object to React Redux's Provider and specific components" + ' like: <Provider context={MyContext}><ConnectedComponent context={MyContext} /></Provider>. ' + 'You may also pass a {context : MyContext} option to connect';
  1694. if (storeKey !== 'store') {
  1695. throw new Error('storeKey has been removed and does not do anything. ' + customStoreWarningMessage);
  1696. }
  1697. }
  1698. var Context = context;
  1699. return function wrapWithConnect(WrappedComponent) {
  1700. if (!reactIs.exports.isValidElementType(WrappedComponent)) {
  1701. throw new Error("You must pass a component to the function returned by " + (methodName + ". Instead received " + stringifyComponent(WrappedComponent)));
  1702. }
  1703. var wrappedComponentName = WrappedComponent.displayName || WrappedComponent.name || 'Component';
  1704. var displayName = getDisplayName(wrappedComponentName);
  1705. var selectorFactoryOptions = _extends({}, connectOptions, {
  1706. getDisplayName: getDisplayName,
  1707. methodName: methodName,
  1708. renderCountProp: renderCountProp,
  1709. shouldHandleStateChanges: shouldHandleStateChanges,
  1710. storeKey: storeKey,
  1711. displayName: displayName,
  1712. wrappedComponentName: wrappedComponentName,
  1713. WrappedComponent: WrappedComponent
  1714. });
  1715. var pure = connectOptions.pure;
  1716. function createChildSelector(store) {
  1717. return selectorFactory(store.dispatch, selectorFactoryOptions);
  1718. } // If we aren't running in "pure" mode, we don't want to memoize values.
  1719. // To avoid conditionally calling hooks, we fall back to a tiny wrapper
  1720. // that just executes the given callback immediately.
  1721. var usePureOnlyMemo = pure ? React.useMemo : function (callback) {
  1722. return callback();
  1723. };
  1724. function ConnectFunction(props) {
  1725. var _useMemo = React.useMemo(function () {
  1726. // Distinguish between actual "data" props that were passed to the wrapper component,
  1727. // and values needed to control behavior (forwarded refs, alternate context instances).
  1728. // To maintain the wrapperProps object reference, memoize this destructuring.
  1729. var reactReduxForwardedRef = props.reactReduxForwardedRef,
  1730. wrapperProps = _objectWithoutPropertiesLoose(props, _excluded2);
  1731. return [props.context, reactReduxForwardedRef, wrapperProps];
  1732. }, [props]),
  1733. propsContext = _useMemo[0],
  1734. reactReduxForwardedRef = _useMemo[1],
  1735. wrapperProps = _useMemo[2];
  1736. var ContextToUse = React.useMemo(function () {
  1737. // Users may optionally pass in a custom context instance to use instead of our ReactReduxContext.
  1738. // Memoize the check that determines which context instance we should use.
  1739. return propsContext && propsContext.Consumer && reactIs.exports.isContextConsumer( /*#__PURE__*/React__default["default"].createElement(propsContext.Consumer, null)) ? propsContext : Context;
  1740. }, [propsContext, Context]); // Retrieve the store and ancestor subscription via context, if available
  1741. var contextValue = React.useContext(ContextToUse); // The store _must_ exist as either a prop or in context.
  1742. // We'll check to see if it _looks_ like a Redux store first.
  1743. // This allows us to pass through a `store` prop that is just a plain value.
  1744. var didStoreComeFromProps = Boolean(props.store) && Boolean(props.store.getState) && Boolean(props.store.dispatch);
  1745. var didStoreComeFromContext = Boolean(contextValue) && Boolean(contextValue.store);
  1746. if (!didStoreComeFromProps && !didStoreComeFromContext) {
  1747. throw new Error("Could not find \"store\" in the context of " + ("\"" + displayName + "\". Either wrap the root component in a <Provider>, ") + "or pass a custom React context provider to <Provider> and the corresponding " + ("React context consumer to " + displayName + " in connect options."));
  1748. } // Based on the previous check, one of these must be true
  1749. var store = didStoreComeFromProps ? props.store : contextValue.store;
  1750. var childPropsSelector = React.useMemo(function () {
  1751. // The child props selector needs the store reference as an input.
  1752. // Re-create this selector whenever the store changes.
  1753. return createChildSelector(store);
  1754. }, [store]);
  1755. var _useMemo2 = React.useMemo(function () {
  1756. if (!shouldHandleStateChanges) return NO_SUBSCRIPTION_ARRAY; // This Subscription's source should match where store came from: props vs. context. A component
  1757. // connected to the store via props shouldn't use subscription from context, or vice versa.
  1758. // This Subscription's source should match where store came from: props vs. context. A component
  1759. // connected to the store via props shouldn't use subscription from context, or vice versa.
  1760. var subscription = createSubscription(store, didStoreComeFromProps ? null : contextValue.subscription); // `notifyNestedSubs` is duplicated to handle the case where the component is unmounted in
  1761. // the middle of the notification loop, where `subscription` will then be null. This can
  1762. // probably be avoided if Subscription's listeners logic is changed to not call listeners
  1763. // that have been unsubscribed in the middle of the notification loop.
  1764. // `notifyNestedSubs` is duplicated to handle the case where the component is unmounted in
  1765. // the middle of the notification loop, where `subscription` will then be null. This can
  1766. // probably be avoided if Subscription's listeners logic is changed to not call listeners
  1767. // that have been unsubscribed in the middle of the notification loop.
  1768. var notifyNestedSubs = subscription.notifyNestedSubs.bind(subscription);
  1769. return [subscription, notifyNestedSubs];
  1770. }, [store, didStoreComeFromProps, contextValue]),
  1771. subscription = _useMemo2[0],
  1772. notifyNestedSubs = _useMemo2[1]; // Determine what {store, subscription} value should be put into nested context, if necessary,
  1773. // and memoize that value to avoid unnecessary context updates.
  1774. var overriddenContextValue = React.useMemo(function () {
  1775. if (didStoreComeFromProps) {
  1776. // This component is directly subscribed to a store from props.
  1777. // We don't want descendants reading from this store - pass down whatever
  1778. // the existing context value is from the nearest connected ancestor.
  1779. return contextValue;
  1780. } // Otherwise, put this component's subscription instance into context, so that
  1781. // connected descendants won't update until after this component is done
  1782. return _extends({}, contextValue, {
  1783. subscription: subscription
  1784. });
  1785. }, [didStoreComeFromProps, contextValue, subscription]); // We need to force this wrapper component to re-render whenever a Redux store update
  1786. // causes a change to the calculated child component props (or we caught an error in mapState)
  1787. var _useReducer = React.useReducer(storeStateUpdatesReducer, EMPTY_ARRAY, initStateUpdates),
  1788. _useReducer$ = _useReducer[0],
  1789. previousStateUpdateResult = _useReducer$[0],
  1790. forceComponentUpdateDispatch = _useReducer[1]; // Propagate any mapState/mapDispatch errors upwards
  1791. if (previousStateUpdateResult && previousStateUpdateResult.error) {
  1792. throw previousStateUpdateResult.error;
  1793. } // Set up refs to coordinate values between the subscription effect and the render logic
  1794. var lastChildProps = React.useRef();
  1795. var lastWrapperProps = React.useRef(wrapperProps);
  1796. var childPropsFromStoreUpdate = React.useRef();
  1797. var renderIsScheduled = React.useRef(false);
  1798. var actualChildProps = usePureOnlyMemo(function () {
  1799. // Tricky logic here:
  1800. // - This render may have been triggered by a Redux store update that produced new child props
  1801. // - However, we may have gotten new wrapper props after that
  1802. // If we have new child props, and the same wrapper props, we know we should use the new child props as-is.
  1803. // But, if we have new wrapper props, those might change the child props, so we have to recalculate things.
  1804. // So, we'll use the child props from store update only if the wrapper props are the same as last time.
  1805. if (childPropsFromStoreUpdate.current && wrapperProps === lastWrapperProps.current) {
  1806. return childPropsFromStoreUpdate.current;
  1807. } // TODO We're reading the store directly in render() here. Bad idea?
  1808. // This will likely cause Bad Things (TM) to happen in Concurrent Mode.
  1809. // Note that we do this because on renders _not_ caused by store updates, we need the latest store state
  1810. // to determine what the child props should be.
  1811. return childPropsSelector(store.getState(), wrapperProps);
  1812. }, [store, previousStateUpdateResult, wrapperProps]); // We need this to execute synchronously every time we re-render. However, React warns
  1813. // about useLayoutEffect in SSR, so we try to detect environment and fall back to
  1814. // just useEffect instead to avoid the warning, since neither will run anyway.
  1815. useIsomorphicLayoutEffectWithArgs(captureWrapperProps, [lastWrapperProps, lastChildProps, renderIsScheduled, wrapperProps, actualChildProps, childPropsFromStoreUpdate, notifyNestedSubs]); // Our re-subscribe logic only runs when the store/subscription setup changes
  1816. useIsomorphicLayoutEffectWithArgs(subscribeUpdates, [shouldHandleStateChanges, store, subscription, childPropsSelector, lastWrapperProps, lastChildProps, renderIsScheduled, childPropsFromStoreUpdate, notifyNestedSubs, forceComponentUpdateDispatch], [store, subscription, childPropsSelector]); // Now that all that's done, we can finally try to actually render the child component.
  1817. // We memoize the elements for the rendered child component as an optimization.
  1818. var renderedWrappedComponent = React.useMemo(function () {
  1819. return /*#__PURE__*/React__default["default"].createElement(WrappedComponent, _extends({}, actualChildProps, {
  1820. ref: reactReduxForwardedRef
  1821. }));
  1822. }, [reactReduxForwardedRef, WrappedComponent, actualChildProps]); // If React sees the exact same element reference as last time, it bails out of re-rendering
  1823. // that child, same as if it was wrapped in React.memo() or returned false from shouldComponentUpdate.
  1824. var renderedChild = React.useMemo(function () {
  1825. if (shouldHandleStateChanges) {
  1826. // If this component is subscribed to store updates, we need to pass its own
  1827. // subscription instance down to our descendants. That means rendering the same
  1828. // Context instance, and putting a different value into the context.
  1829. return /*#__PURE__*/React__default["default"].createElement(ContextToUse.Provider, {
  1830. value: overriddenContextValue
  1831. }, renderedWrappedComponent);
  1832. }
  1833. return renderedWrappedComponent;
  1834. }, [ContextToUse, renderedWrappedComponent, overriddenContextValue]);
  1835. return renderedChild;
  1836. } // If we're in "pure" mode, ensure our wrapper component only re-renders when incoming props have changed.
  1837. var Connect = pure ? React__default["default"].memo(ConnectFunction) : ConnectFunction;
  1838. Connect.WrappedComponent = WrappedComponent;
  1839. Connect.displayName = ConnectFunction.displayName = displayName;
  1840. if (forwardRef) {
  1841. var forwarded = React__default["default"].forwardRef(function forwardConnectRef(props, ref) {
  1842. return /*#__PURE__*/React__default["default"].createElement(Connect, _extends({}, props, {
  1843. reactReduxForwardedRef: ref
  1844. }));
  1845. });
  1846. forwarded.displayName = displayName;
  1847. forwarded.WrappedComponent = WrappedComponent;
  1848. return hoistNonReactStatics_cjs(forwarded, WrappedComponent);
  1849. }
  1850. return hoistNonReactStatics_cjs(Connect, WrappedComponent);
  1851. };
  1852. }
  1853. function is(x, y) {
  1854. if (x === y) {
  1855. return x !== 0 || y !== 0 || 1 / x === 1 / y;
  1856. } else {
  1857. return x !== x && y !== y;
  1858. }
  1859. }
  1860. function shallowEqual(objA, objB) {
  1861. if (is(objA, objB)) return true;
  1862. if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) {
  1863. return false;
  1864. }
  1865. var keysA = Object.keys(objA);
  1866. var keysB = Object.keys(objB);
  1867. if (keysA.length !== keysB.length) return false;
  1868. for (var i = 0; i < keysA.length; i++) {
  1869. if (!Object.prototype.hasOwnProperty.call(objB, keysA[i]) || !is(objA[keysA[i]], objB[keysA[i]])) {
  1870. return false;
  1871. }
  1872. }
  1873. return true;
  1874. }
  1875. function bindActionCreators(actionCreators, dispatch) {
  1876. var boundActionCreators = {};
  1877. var _loop = function _loop(key) {
  1878. var actionCreator = actionCreators[key];
  1879. if (typeof actionCreator === 'function') {
  1880. boundActionCreators[key] = function () {
  1881. return dispatch(actionCreator.apply(void 0, arguments));
  1882. };
  1883. }
  1884. };
  1885. for (var key in actionCreators) {
  1886. _loop(key);
  1887. }
  1888. return boundActionCreators;
  1889. }
  1890. /**
  1891. * @param {any} obj The object to inspect.
  1892. * @returns {boolean} True if the argument appears to be a plain object.
  1893. */
  1894. function isPlainObject(obj) {
  1895. if (typeof obj !== 'object' || obj === null) return false;
  1896. var proto = Object.getPrototypeOf(obj);
  1897. if (proto === null) return true;
  1898. var baseProto = proto;
  1899. while (Object.getPrototypeOf(baseProto) !== null) {
  1900. baseProto = Object.getPrototypeOf(baseProto);
  1901. }
  1902. return proto === baseProto;
  1903. }
  1904. /**
  1905. * Prints a warning in the console if it exists.
  1906. *
  1907. * @param {String} message The warning message.
  1908. * @returns {void}
  1909. */
  1910. function warning(message) {
  1911. /* eslint-disable no-console */
  1912. if (typeof console !== 'undefined' && typeof console.error === 'function') {
  1913. console.error(message);
  1914. }
  1915. /* eslint-enable no-console */
  1916. try {
  1917. // This error was thrown as a convenience so that if you enable
  1918. // "break on all exceptions" in your console,
  1919. // it would pause the execution at this line.
  1920. throw new Error(message);
  1921. /* eslint-disable no-empty */
  1922. } catch (e) {}
  1923. /* eslint-enable no-empty */
  1924. }
  1925. function verifyPlainObject(value, displayName, methodName) {
  1926. if (!isPlainObject(value)) {
  1927. warning(methodName + "() in " + displayName + " must return a plain object. Instead received " + value + ".");
  1928. }
  1929. }
  1930. function wrapMapToPropsConstant(getConstant) {
  1931. return function initConstantSelector(dispatch, options) {
  1932. var constant = getConstant(dispatch, options);
  1933. function constantSelector() {
  1934. return constant;
  1935. }
  1936. constantSelector.dependsOnOwnProps = false;
  1937. return constantSelector;
  1938. };
  1939. } // dependsOnOwnProps is used by createMapToPropsProxy to determine whether to pass props as args
  1940. // to the mapToProps function being wrapped. It is also used by makePurePropsSelector to determine
  1941. // whether mapToProps needs to be invoked when props have changed.
  1942. //
  1943. // A length of one signals that mapToProps does not depend on props from the parent component.
  1944. // A length of zero is assumed to mean mapToProps is getting args via arguments or ...args and
  1945. // therefore not reporting its length accurately..
  1946. function getDependsOnOwnProps(mapToProps) {
  1947. return mapToProps.dependsOnOwnProps !== null && mapToProps.dependsOnOwnProps !== undefined ? Boolean(mapToProps.dependsOnOwnProps) : mapToProps.length !== 1;
  1948. } // Used by whenMapStateToPropsIsFunction and whenMapDispatchToPropsIsFunction,
  1949. // this function wraps mapToProps in a proxy function which does several things:
  1950. //
  1951. // * Detects whether the mapToProps function being called depends on props, which
  1952. // is used by selectorFactory to decide if it should reinvoke on props changes.
  1953. //
  1954. // * On first call, handles mapToProps if returns another function, and treats that
  1955. // new function as the true mapToProps for subsequent calls.
  1956. //
  1957. // * On first call, verifies the first result is a plain object, in order to warn
  1958. // the developer that their mapToProps function is not returning a valid result.
  1959. //
  1960. function wrapMapToPropsFunc(mapToProps, methodName) {
  1961. return function initProxySelector(dispatch, _ref) {
  1962. var displayName = _ref.displayName;
  1963. var proxy = function mapToPropsProxy(stateOrDispatch, ownProps) {
  1964. return proxy.dependsOnOwnProps ? proxy.mapToProps(stateOrDispatch, ownProps) : proxy.mapToProps(stateOrDispatch);
  1965. }; // allow detectFactoryAndVerify to get ownProps
  1966. proxy.dependsOnOwnProps = true;
  1967. proxy.mapToProps = function detectFactoryAndVerify(stateOrDispatch, ownProps) {
  1968. proxy.mapToProps = mapToProps;
  1969. proxy.dependsOnOwnProps = getDependsOnOwnProps(mapToProps);
  1970. var props = proxy(stateOrDispatch, ownProps);
  1971. if (typeof props === 'function') {
  1972. proxy.mapToProps = props;
  1973. proxy.dependsOnOwnProps = getDependsOnOwnProps(props);
  1974. props = proxy(stateOrDispatch, ownProps);
  1975. }
  1976. verifyPlainObject(props, displayName, methodName);
  1977. return props;
  1978. };
  1979. return proxy;
  1980. };
  1981. }
  1982. function whenMapDispatchToPropsIsFunction(mapDispatchToProps) {
  1983. return typeof mapDispatchToProps === 'function' ? wrapMapToPropsFunc(mapDispatchToProps, 'mapDispatchToProps') : undefined;
  1984. }
  1985. function whenMapDispatchToPropsIsMissing(mapDispatchToProps) {
  1986. return !mapDispatchToProps ? wrapMapToPropsConstant(function (dispatch) {
  1987. return {
  1988. dispatch: dispatch
  1989. };
  1990. }) : undefined;
  1991. }
  1992. function whenMapDispatchToPropsIsObject(mapDispatchToProps) {
  1993. return mapDispatchToProps && typeof mapDispatchToProps === 'object' ? wrapMapToPropsConstant(function (dispatch) {
  1994. return bindActionCreators(mapDispatchToProps, dispatch);
  1995. }) : undefined;
  1996. }
  1997. var defaultMapDispatchToPropsFactories = [whenMapDispatchToPropsIsFunction, whenMapDispatchToPropsIsMissing, whenMapDispatchToPropsIsObject];
  1998. function whenMapStateToPropsIsFunction(mapStateToProps) {
  1999. return typeof mapStateToProps === 'function' ? wrapMapToPropsFunc(mapStateToProps, 'mapStateToProps') : undefined;
  2000. }
  2001. function whenMapStateToPropsIsMissing(mapStateToProps) {
  2002. return !mapStateToProps ? wrapMapToPropsConstant(function () {
  2003. return {};
  2004. }) : undefined;
  2005. }
  2006. var defaultMapStateToPropsFactories = [whenMapStateToPropsIsFunction, whenMapStateToPropsIsMissing];
  2007. function defaultMergeProps(stateProps, dispatchProps, ownProps) {
  2008. return _extends({}, ownProps, stateProps, dispatchProps);
  2009. }
  2010. function wrapMergePropsFunc(mergeProps) {
  2011. return function initMergePropsProxy(dispatch, _ref) {
  2012. var displayName = _ref.displayName,
  2013. pure = _ref.pure,
  2014. areMergedPropsEqual = _ref.areMergedPropsEqual;
  2015. var hasRunOnce = false;
  2016. var mergedProps;
  2017. return function mergePropsProxy(stateProps, dispatchProps, ownProps) {
  2018. var nextMergedProps = mergeProps(stateProps, dispatchProps, ownProps);
  2019. if (hasRunOnce) {
  2020. if (!pure || !areMergedPropsEqual(nextMergedProps, mergedProps)) mergedProps = nextMergedProps;
  2021. } else {
  2022. hasRunOnce = true;
  2023. mergedProps = nextMergedProps;
  2024. verifyPlainObject(mergedProps, displayName, 'mergeProps');
  2025. }
  2026. return mergedProps;
  2027. };
  2028. };
  2029. }
  2030. function whenMergePropsIsFunction(mergeProps) {
  2031. return typeof mergeProps === 'function' ? wrapMergePropsFunc(mergeProps) : undefined;
  2032. }
  2033. function whenMergePropsIsOmitted(mergeProps) {
  2034. return !mergeProps ? function () {
  2035. return defaultMergeProps;
  2036. } : undefined;
  2037. }
  2038. var defaultMergePropsFactories = [whenMergePropsIsFunction, whenMergePropsIsOmitted];
  2039. function verify(selector, methodName, displayName) {
  2040. if (!selector) {
  2041. throw new Error("Unexpected value for " + methodName + " in " + displayName + ".");
  2042. } else if (methodName === 'mapStateToProps' || methodName === 'mapDispatchToProps') {
  2043. if (!Object.prototype.hasOwnProperty.call(selector, 'dependsOnOwnProps')) {
  2044. warning("The selector for " + methodName + " of " + displayName + " did not specify a value for dependsOnOwnProps.");
  2045. }
  2046. }
  2047. }
  2048. function verifySubselectors(mapStateToProps, mapDispatchToProps, mergeProps, displayName) {
  2049. verify(mapStateToProps, 'mapStateToProps', displayName);
  2050. verify(mapDispatchToProps, 'mapDispatchToProps', displayName);
  2051. verify(mergeProps, 'mergeProps', displayName);
  2052. }
  2053. var _excluded$1 = ["initMapStateToProps", "initMapDispatchToProps", "initMergeProps"];
  2054. function impureFinalPropsSelectorFactory(mapStateToProps, mapDispatchToProps, mergeProps, dispatch) {
  2055. return function impureFinalPropsSelector(state, ownProps) {
  2056. return mergeProps(mapStateToProps(state, ownProps), mapDispatchToProps(dispatch, ownProps), ownProps);
  2057. };
  2058. }
  2059. function pureFinalPropsSelectorFactory(mapStateToProps, mapDispatchToProps, mergeProps, dispatch, _ref) {
  2060. var areStatesEqual = _ref.areStatesEqual,
  2061. areOwnPropsEqual = _ref.areOwnPropsEqual,
  2062. areStatePropsEqual = _ref.areStatePropsEqual;
  2063. var hasRunAtLeastOnce = false;
  2064. var state;
  2065. var ownProps;
  2066. var stateProps;
  2067. var dispatchProps;
  2068. var mergedProps;
  2069. function handleFirstCall(firstState, firstOwnProps) {
  2070. state = firstState;
  2071. ownProps = firstOwnProps;
  2072. stateProps = mapStateToProps(state, ownProps);
  2073. dispatchProps = mapDispatchToProps(dispatch, ownProps);
  2074. mergedProps = mergeProps(stateProps, dispatchProps, ownProps);
  2075. hasRunAtLeastOnce = true;
  2076. return mergedProps;
  2077. }
  2078. function handleNewPropsAndNewState() {
  2079. stateProps = mapStateToProps(state, ownProps);
  2080. if (mapDispatchToProps.dependsOnOwnProps) dispatchProps = mapDispatchToProps(dispatch, ownProps);
  2081. mergedProps = mergeProps(stateProps, dispatchProps, ownProps);
  2082. return mergedProps;
  2083. }
  2084. function handleNewProps() {
  2085. if (mapStateToProps.dependsOnOwnProps) stateProps = mapStateToProps(state, ownProps);
  2086. if (mapDispatchToProps.dependsOnOwnProps) dispatchProps = mapDispatchToProps(dispatch, ownProps);
  2087. mergedProps = mergeProps(stateProps, dispatchProps, ownProps);
  2088. return mergedProps;
  2089. }
  2090. function handleNewState() {
  2091. var nextStateProps = mapStateToProps(state, ownProps);
  2092. var statePropsChanged = !areStatePropsEqual(nextStateProps, stateProps);
  2093. stateProps = nextStateProps;
  2094. if (statePropsChanged) mergedProps = mergeProps(stateProps, dispatchProps, ownProps);
  2095. return mergedProps;
  2096. }
  2097. function handleSubsequentCalls(nextState, nextOwnProps) {
  2098. var propsChanged = !areOwnPropsEqual(nextOwnProps, ownProps);
  2099. var stateChanged = !areStatesEqual(nextState, state);
  2100. state = nextState;
  2101. ownProps = nextOwnProps;
  2102. if (propsChanged && stateChanged) return handleNewPropsAndNewState();
  2103. if (propsChanged) return handleNewProps();
  2104. if (stateChanged) return handleNewState();
  2105. return mergedProps;
  2106. }
  2107. return function pureFinalPropsSelector(nextState, nextOwnProps) {
  2108. return hasRunAtLeastOnce ? handleSubsequentCalls(nextState, nextOwnProps) : handleFirstCall(nextState, nextOwnProps);
  2109. };
  2110. } // TODO: Add more comments
  2111. // If pure is true, the selector returned by selectorFactory will memoize its results,
  2112. // allowing connectAdvanced's shouldComponentUpdate to return false if final
  2113. // props have not changed. If false, the selector will always return a new
  2114. // object and shouldComponentUpdate will always return true.
  2115. function finalPropsSelectorFactory(dispatch, _ref2) {
  2116. var initMapStateToProps = _ref2.initMapStateToProps,
  2117. initMapDispatchToProps = _ref2.initMapDispatchToProps,
  2118. initMergeProps = _ref2.initMergeProps,
  2119. options = _objectWithoutPropertiesLoose(_ref2, _excluded$1);
  2120. var mapStateToProps = initMapStateToProps(dispatch, options);
  2121. var mapDispatchToProps = initMapDispatchToProps(dispatch, options);
  2122. var mergeProps = initMergeProps(dispatch, options);
  2123. {
  2124. verifySubselectors(mapStateToProps, mapDispatchToProps, mergeProps, options.displayName);
  2125. }
  2126. var selectorFactory = options.pure ? pureFinalPropsSelectorFactory : impureFinalPropsSelectorFactory;
  2127. return selectorFactory(mapStateToProps, mapDispatchToProps, mergeProps, dispatch, options);
  2128. }
  2129. var _excluded = ["pure", "areStatesEqual", "areOwnPropsEqual", "areStatePropsEqual", "areMergedPropsEqual"];
  2130. /*
  2131. connect is a facade over connectAdvanced. It turns its args into a compatible
  2132. selectorFactory, which has the signature:
  2133. (dispatch, options) => (nextState, nextOwnProps) => nextFinalProps
  2134. connect passes its args to connectAdvanced as options, which will in turn pass them to
  2135. selectorFactory each time a Connect component instance is instantiated or hot reloaded.
  2136. selectorFactory returns a final props selector from its mapStateToProps,
  2137. mapStateToPropsFactories, mapDispatchToProps, mapDispatchToPropsFactories, mergeProps,
  2138. mergePropsFactories, and pure args.
  2139. The resulting final props selector is called by the Connect component instance whenever
  2140. it receives new props or store state.
  2141. */
  2142. function match(arg, factories, name) {
  2143. for (var i = factories.length - 1; i >= 0; i--) {
  2144. var result = factories[i](arg);
  2145. if (result) return result;
  2146. }
  2147. return function (dispatch, options) {
  2148. throw new Error("Invalid value of type " + typeof arg + " for " + name + " argument when connecting component " + options.wrappedComponentName + ".");
  2149. };
  2150. }
  2151. function strictEqual(a, b) {
  2152. return a === b;
  2153. } // createConnect with default args builds the 'official' connect behavior. Calling it with
  2154. // different options opens up some testing and extensibility scenarios
  2155. function createConnect(_temp) {
  2156. var _ref = _temp === void 0 ? {} : _temp,
  2157. _ref$connectHOC = _ref.connectHOC,
  2158. connectHOC = _ref$connectHOC === void 0 ? connectAdvanced : _ref$connectHOC,
  2159. _ref$mapStateToPropsF = _ref.mapStateToPropsFactories,
  2160. mapStateToPropsFactories = _ref$mapStateToPropsF === void 0 ? defaultMapStateToPropsFactories : _ref$mapStateToPropsF,
  2161. _ref$mapDispatchToPro = _ref.mapDispatchToPropsFactories,
  2162. mapDispatchToPropsFactories = _ref$mapDispatchToPro === void 0 ? defaultMapDispatchToPropsFactories : _ref$mapDispatchToPro,
  2163. _ref$mergePropsFactor = _ref.mergePropsFactories,
  2164. mergePropsFactories = _ref$mergePropsFactor === void 0 ? defaultMergePropsFactories : _ref$mergePropsFactor,
  2165. _ref$selectorFactory = _ref.selectorFactory,
  2166. selectorFactory = _ref$selectorFactory === void 0 ? finalPropsSelectorFactory : _ref$selectorFactory;
  2167. return function connect(mapStateToProps, mapDispatchToProps, mergeProps, _ref2) {
  2168. if (_ref2 === void 0) {
  2169. _ref2 = {};
  2170. }
  2171. var _ref3 = _ref2,
  2172. _ref3$pure = _ref3.pure,
  2173. pure = _ref3$pure === void 0 ? true : _ref3$pure,
  2174. _ref3$areStatesEqual = _ref3.areStatesEqual,
  2175. areStatesEqual = _ref3$areStatesEqual === void 0 ? strictEqual : _ref3$areStatesEqual,
  2176. _ref3$areOwnPropsEqua = _ref3.areOwnPropsEqual,
  2177. areOwnPropsEqual = _ref3$areOwnPropsEqua === void 0 ? shallowEqual : _ref3$areOwnPropsEqua,
  2178. _ref3$areStatePropsEq = _ref3.areStatePropsEqual,
  2179. areStatePropsEqual = _ref3$areStatePropsEq === void 0 ? shallowEqual : _ref3$areStatePropsEq,
  2180. _ref3$areMergedPropsE = _ref3.areMergedPropsEqual,
  2181. areMergedPropsEqual = _ref3$areMergedPropsE === void 0 ? shallowEqual : _ref3$areMergedPropsE,
  2182. extraOptions = _objectWithoutPropertiesLoose(_ref3, _excluded);
  2183. var initMapStateToProps = match(mapStateToProps, mapStateToPropsFactories, 'mapStateToProps');
  2184. var initMapDispatchToProps = match(mapDispatchToProps, mapDispatchToPropsFactories, 'mapDispatchToProps');
  2185. var initMergeProps = match(mergeProps, mergePropsFactories, 'mergeProps');
  2186. return connectHOC(selectorFactory, _extends({
  2187. // used in error messages
  2188. methodName: 'connect',
  2189. // used to compute Connect's displayName from the wrapped component's displayName.
  2190. getDisplayName: function getDisplayName(name) {
  2191. return "Connect(" + name + ")";
  2192. },
  2193. // if mapStateToProps is falsy, the Connect component doesn't subscribe to store state changes
  2194. shouldHandleStateChanges: Boolean(mapStateToProps),
  2195. // passed through to selectorFactory
  2196. initMapStateToProps: initMapStateToProps,
  2197. initMapDispatchToProps: initMapDispatchToProps,
  2198. initMergeProps: initMergeProps,
  2199. pure: pure,
  2200. areStatesEqual: areStatesEqual,
  2201. areOwnPropsEqual: areOwnPropsEqual,
  2202. areStatePropsEqual: areStatePropsEqual,
  2203. areMergedPropsEqual: areMergedPropsEqual
  2204. }, extraOptions));
  2205. };
  2206. }
  2207. var connect = /*#__PURE__*/createConnect();
  2208. /**
  2209. * A hook to access the value of the `ReactReduxContext`. This is a low-level
  2210. * hook that you should usually not need to call directly.
  2211. *
  2212. * @returns {any} the value of the `ReactReduxContext`
  2213. *
  2214. * @example
  2215. *
  2216. * import React from 'react'
  2217. * import { useReduxContext } from 'react-redux'
  2218. *
  2219. * export const CounterComponent = ({ value }) => {
  2220. * const { store } = useReduxContext()
  2221. * return <div>{store.getState()}</div>
  2222. * }
  2223. */
  2224. function useReduxContext() {
  2225. var contextValue = React.useContext(ReactReduxContext);
  2226. if (!contextValue) {
  2227. throw new Error('could not find react-redux context value; please ensure the component is wrapped in a <Provider>');
  2228. }
  2229. return contextValue;
  2230. }
  2231. /**
  2232. * Hook factory, which creates a `useStore` hook bound to a given context.
  2233. *
  2234. * @param {React.Context} [context=ReactReduxContext] Context passed to your `<Provider>`.
  2235. * @returns {Function} A `useStore` hook bound to the specified context.
  2236. */
  2237. function createStoreHook(context) {
  2238. if (context === void 0) {
  2239. context = ReactReduxContext;
  2240. }
  2241. var useReduxContext$1 = context === ReactReduxContext ? useReduxContext : function () {
  2242. return React.useContext(context);
  2243. };
  2244. return function useStore() {
  2245. var _useReduxContext = useReduxContext$1(),
  2246. store = _useReduxContext.store;
  2247. return store;
  2248. };
  2249. }
  2250. /**
  2251. * A hook to access the redux store.
  2252. *
  2253. * @returns {any} the redux store
  2254. *
  2255. * @example
  2256. *
  2257. * import React from 'react'
  2258. * import { useStore } from 'react-redux'
  2259. *
  2260. * export const ExampleComponent = () => {
  2261. * const store = useStore()
  2262. * return <div>{store.getState()}</div>
  2263. * }
  2264. */
  2265. var useStore = /*#__PURE__*/createStoreHook();
  2266. /**
  2267. * Hook factory, which creates a `useDispatch` hook bound to a given context.
  2268. *
  2269. * @param {React.Context} [context=ReactReduxContext] Context passed to your `<Provider>`.
  2270. * @returns {Function} A `useDispatch` hook bound to the specified context.
  2271. */
  2272. function createDispatchHook(context) {
  2273. if (context === void 0) {
  2274. context = ReactReduxContext;
  2275. }
  2276. var useStore$1 = context === ReactReduxContext ? useStore : createStoreHook(context);
  2277. return function useDispatch() {
  2278. var store = useStore$1();
  2279. return store.dispatch;
  2280. };
  2281. }
  2282. /**
  2283. * A hook to access the redux `dispatch` function.
  2284. *
  2285. * @returns {any|function} redux store's `dispatch` function
  2286. *
  2287. * @example
  2288. *
  2289. * import React, { useCallback } from 'react'
  2290. * import { useDispatch } from 'react-redux'
  2291. *
  2292. * export const CounterComponent = ({ value }) => {
  2293. * const dispatch = useDispatch()
  2294. * const increaseCounter = useCallback(() => dispatch({ type: 'increase-counter' }), [])
  2295. * return (
  2296. * <div>
  2297. * <span>{value}</span>
  2298. * <button onClick={increaseCounter}>Increase counter</button>
  2299. * </div>
  2300. * )
  2301. * }
  2302. */
  2303. var useDispatch = /*#__PURE__*/createDispatchHook();
  2304. var refEquality = function refEquality(a, b) {
  2305. return a === b;
  2306. };
  2307. function useSelectorWithStoreAndSubscription(selector, equalityFn, store, contextSub) {
  2308. var _useReducer = React.useReducer(function (s) {
  2309. return s + 1;
  2310. }, 0),
  2311. forceRender = _useReducer[1];
  2312. var subscription = React.useMemo(function () {
  2313. return createSubscription(store, contextSub);
  2314. }, [store, contextSub]);
  2315. var latestSubscriptionCallbackError = React.useRef();
  2316. var latestSelector = React.useRef();
  2317. var latestStoreState = React.useRef();
  2318. var latestSelectedState = React.useRef();
  2319. var storeState = store.getState();
  2320. var selectedState;
  2321. try {
  2322. if (selector !== latestSelector.current || storeState !== latestStoreState.current || latestSubscriptionCallbackError.current) {
  2323. var newSelectedState = selector(storeState); // ensure latest selected state is reused so that a custom equality function can result in identical references
  2324. if (latestSelectedState.current === undefined || !equalityFn(newSelectedState, latestSelectedState.current)) {
  2325. selectedState = newSelectedState;
  2326. } else {
  2327. selectedState = latestSelectedState.current;
  2328. }
  2329. } else {
  2330. selectedState = latestSelectedState.current;
  2331. }
  2332. } catch (err) {
  2333. if (latestSubscriptionCallbackError.current) {
  2334. err.message += "\nThe error may be correlated with this previous error:\n" + latestSubscriptionCallbackError.current.stack + "\n\n";
  2335. }
  2336. throw err;
  2337. }
  2338. useIsomorphicLayoutEffect(function () {
  2339. latestSelector.current = selector;
  2340. latestStoreState.current = storeState;
  2341. latestSelectedState.current = selectedState;
  2342. latestSubscriptionCallbackError.current = undefined;
  2343. });
  2344. useIsomorphicLayoutEffect(function () {
  2345. function checkForUpdates() {
  2346. try {
  2347. var newStoreState = store.getState(); // Avoid calling selector multiple times if the store's state has not changed
  2348. if (newStoreState === latestStoreState.current) {
  2349. return;
  2350. }
  2351. var _newSelectedState = latestSelector.current(newStoreState);
  2352. if (equalityFn(_newSelectedState, latestSelectedState.current)) {
  2353. return;
  2354. }
  2355. latestSelectedState.current = _newSelectedState;
  2356. latestStoreState.current = newStoreState;
  2357. } catch (err) {
  2358. // we ignore all errors here, since when the component
  2359. // is re-rendered, the selectors are called again, and
  2360. // will throw again, if neither props nor store state
  2361. // changed
  2362. latestSubscriptionCallbackError.current = err;
  2363. }
  2364. forceRender();
  2365. }
  2366. subscription.onStateChange = checkForUpdates;
  2367. subscription.trySubscribe();
  2368. checkForUpdates();
  2369. return function () {
  2370. return subscription.tryUnsubscribe();
  2371. };
  2372. }, [store, subscription]);
  2373. return selectedState;
  2374. }
  2375. /**
  2376. * Hook factory, which creates a `useSelector` hook bound to a given context.
  2377. *
  2378. * @param {React.Context} [context=ReactReduxContext] Context passed to your `<Provider>`.
  2379. * @returns {Function} A `useSelector` hook bound to the specified context.
  2380. */
  2381. function createSelectorHook(context) {
  2382. if (context === void 0) {
  2383. context = ReactReduxContext;
  2384. }
  2385. var useReduxContext$1 = context === ReactReduxContext ? useReduxContext : function () {
  2386. return React.useContext(context);
  2387. };
  2388. return function useSelector(selector, equalityFn) {
  2389. if (equalityFn === void 0) {
  2390. equalityFn = refEquality;
  2391. }
  2392. {
  2393. if (!selector) {
  2394. throw new Error("You must pass a selector to useSelector");
  2395. }
  2396. if (typeof selector !== 'function') {
  2397. throw new Error("You must pass a function as a selector to useSelector");
  2398. }
  2399. if (typeof equalityFn !== 'function') {
  2400. throw new Error("You must pass a function as an equality function to useSelector");
  2401. }
  2402. }
  2403. var _useReduxContext = useReduxContext$1(),
  2404. store = _useReduxContext.store,
  2405. contextSub = _useReduxContext.subscription;
  2406. var selectedState = useSelectorWithStoreAndSubscription(selector, equalityFn, store, contextSub);
  2407. React.useDebugValue(selectedState);
  2408. return selectedState;
  2409. };
  2410. }
  2411. /**
  2412. * A hook to access the redux store's state. This hook takes a selector function
  2413. * as an argument. The selector is called with the store state.
  2414. *
  2415. * This hook takes an optional equality comparison function as the second parameter
  2416. * that allows you to customize the way the selected state is compared to determine
  2417. * whether the component needs to be re-rendered.
  2418. *
  2419. * @param {Function} selector the selector function
  2420. * @param {Function=} equalityFn the function that will be used to determine equality
  2421. *
  2422. * @returns {any} the selected state
  2423. *
  2424. * @example
  2425. *
  2426. * import React from 'react'
  2427. * import { useSelector } from 'react-redux'
  2428. *
  2429. * export const CounterComponent = () => {
  2430. * const counter = useSelector(state => state.counter)
  2431. * return <div>{counter}</div>
  2432. * }
  2433. */
  2434. var useSelector = /*#__PURE__*/createSelectorHook();
  2435. // with standard React renderers (ReactDOM, React Native)
  2436. setBatch(reactDom.unstable_batchedUpdates);
  2437. Object.defineProperty(exports, 'batch', {
  2438. enumerable: true,
  2439. get: function () { return reactDom.unstable_batchedUpdates; }
  2440. });
  2441. exports.Provider = Provider;
  2442. exports.ReactReduxContext = ReactReduxContext;
  2443. exports.connect = connect;
  2444. exports.connectAdvanced = connectAdvanced;
  2445. exports.createDispatchHook = createDispatchHook;
  2446. exports.createSelectorHook = createSelectorHook;
  2447. exports.createStoreHook = createStoreHook;
  2448. exports.shallowEqual = shallowEqual;
  2449. exports.useDispatch = useDispatch;
  2450. exports.useSelector = useSelector;
  2451. exports.useStore = useStore;
  2452. Object.defineProperty(exports, '__esModule', { value: true });
  2453. }));