react-test-renderer 16.8.0-alpha.1 → 16.8.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,9 +1,13 @@
1
1
  {
2
2
  "name": "react-test-renderer",
3
- "version": "16.8.0-alpha.1",
3
+ "version": "16.8.3",
4
4
  "description": "React package for snapshot testing.",
5
5
  "main": "index.js",
6
- "repository": "facebook/react",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/facebook/react.git",
9
+ "directory": "packages/react-test-renderer"
10
+ },
7
11
  "keywords": [
8
12
  "react",
9
13
  "react-native",
@@ -17,8 +21,8 @@
17
21
  "dependencies": {
18
22
  "object-assign": "^4.1.1",
19
23
  "prop-types": "^15.6.2",
20
- "react-is": "^16.8.0-alpha.1",
21
- "scheduler": "^0.13.0-alpha.1"
24
+ "react-is": "^16.8.3",
25
+ "scheduler": "^0.13.3"
22
26
  },
23
27
  "peerDependencies": {
24
28
  "react": "^16.0.0"
@@ -1,4 +1,4 @@
1
- /** @license React v16.8.0-alpha.1
1
+ /** @license React v16.8.3
2
2
  * react-test-renderer-shallow.development.js
3
3
  *
4
4
  * Copyright (c) Facebook, Inc. and its affiliates.
@@ -452,13 +452,80 @@ function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
452
452
 
453
453
  var checkPropTypes_1 = checkPropTypes;
454
454
 
455
+ var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
456
+
457
+ // Prevent newer renderers from RTE when used with older react package versions.
458
+ // Current owner and dispatcher used to share the same ref,
459
+ // but PR #14548 split them out to better support the react-debug-tools package.
460
+ if (!ReactSharedInternals.hasOwnProperty('ReactCurrentDispatcher')) {
461
+ ReactSharedInternals.ReactCurrentDispatcher = {
462
+ current: null
463
+ };
464
+ }
465
+
466
+ /**
467
+ * Similar to invariant but only logs a warning if the condition is not met.
468
+ * This can be used to log issues in development environments in critical
469
+ * paths. Removing the logging code for production environments will keep the
470
+ * same logic and follow the same code paths.
471
+ */
472
+
473
+ var warning = warningWithoutStack$1;
474
+
475
+ {
476
+ warning = function (condition, format) {
477
+ if (condition) {
478
+ return;
479
+ }
480
+ var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
481
+ var stack = ReactDebugCurrentFrame.getStackAddendum();
482
+ // eslint-disable-next-line react-internal/warning-and-invariant-args
483
+
484
+ for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
485
+ args[_key - 2] = arguments[_key];
486
+ }
487
+
488
+ warningWithoutStack$1.apply(undefined, [false, format + '%s'].concat(args, [stack]));
489
+ };
490
+ }
491
+
492
+ var warning$1 = warning;
493
+
455
494
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
456
495
 
496
+ var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
497
+
498
+
499
+ var RE_RENDER_LIMIT = 25;
500
+
457
501
  var emptyObject = {};
458
502
  {
459
503
  Object.freeze(emptyObject);
460
504
  }
461
505
 
506
+ // In DEV, this is the name of the currently executing primitive hook
507
+ var currentHookNameInDev = void 0;
508
+
509
+ function areHookInputsEqual(nextDeps, prevDeps) {
510
+ if (prevDeps === null) {
511
+ warning$1(false, '%s received a final argument during this render, but not during ' + 'the previous render. Even though the final argument is optional, ' + 'its type cannot change between renders.', currentHookNameInDev);
512
+ return false;
513
+ }
514
+
515
+ // Don't bother comparing lengths in prod because these arrays should be
516
+ // passed inline.
517
+ if (nextDeps.length !== prevDeps.length) {
518
+ warning$1(false, 'The final argument passed to %s changed size between renders. The ' + 'order and size of this array must remain constant.\n\n' + 'Previous: %s\n' + 'Incoming: %s', currentHookNameInDev, '[' + nextDeps.join(', ') + ']', '[' + prevDeps.join(', ') + ']');
519
+ }
520
+ for (var i = 0; i < prevDeps.length && i < nextDeps.length; i++) {
521
+ if (is(nextDeps[i], prevDeps[i])) {
522
+ continue;
523
+ }
524
+ return false;
525
+ }
526
+ return true;
527
+ }
528
+
462
529
  var Updater = function () {
463
530
  function Updater(renderer) {
464
531
  _classCallCheck(this, Updater);
@@ -525,6 +592,18 @@ var Updater = function () {
525
592
  return Updater;
526
593
  }();
527
594
 
595
+ function createHook() {
596
+ return {
597
+ memoizedState: null,
598
+ queue: null,
599
+ next: null
600
+ };
601
+ }
602
+
603
+ function basicStateReducer(state, action) {
604
+ return typeof action === 'function' ? action(state) : action;
605
+ }
606
+
528
607
  var ReactShallowRenderer = function () {
529
608
  function ReactShallowRenderer() {
530
609
  _classCallCheck(this, ReactShallowRenderer);
@@ -537,8 +616,233 @@ var ReactShallowRenderer = function () {
537
616
  this._rendering = false;
538
617
  this._forcedUpdate = false;
539
618
  this._updater = new Updater(this);
619
+ this._dispatcher = this._createDispatcher();
620
+ this._workInProgressHook = null;
621
+ this._firstWorkInProgressHook = null;
622
+ this._isReRender = false;
623
+ this._didScheduleRenderPhaseUpdate = false;
624
+ this._renderPhaseUpdates = null;
625
+ this._currentlyRenderingComponent = null;
626
+ this._numberOfReRenders = 0;
627
+ this._previousComponentIdentity = null;
540
628
  }
541
629
 
630
+ ReactShallowRenderer.prototype._validateCurrentlyRenderingComponent = function _validateCurrentlyRenderingComponent() {
631
+ !(this._currentlyRenderingComponent !== null) ? invariant(false, 'Hooks can only be called inside the body of a function component. (https://fb.me/react-invalid-hook-call)') : void 0;
632
+ };
633
+
634
+ ReactShallowRenderer.prototype._createDispatcher = function _createDispatcher() {
635
+ var _this = this;
636
+
637
+ var useReducer = function (reducer, initialArg, init) {
638
+ _this._validateCurrentlyRenderingComponent();
639
+ _this._createWorkInProgressHook();
640
+ var workInProgressHook = _this._workInProgressHook;
641
+ if (_this._isReRender) {
642
+ // This is a re-render. Apply the new render phase updates to the previous
643
+ var _queue = workInProgressHook.queue;
644
+ var _dispatch = _queue.dispatch;
645
+ if (_this._renderPhaseUpdates !== null) {
646
+ // Render phase updates are stored in a map of queue -> linked list
647
+ var firstRenderPhaseUpdate = _this._renderPhaseUpdates.get(_queue);
648
+ if (firstRenderPhaseUpdate !== undefined) {
649
+ _this._renderPhaseUpdates.delete(_queue);
650
+ var newState = workInProgressHook.memoizedState;
651
+ var update = firstRenderPhaseUpdate;
652
+ do {
653
+ // Process this render phase update. We don't have to check the
654
+ // priority because it will always be the same as the current
655
+ // render's.
656
+ var _action = update.action;
657
+ newState = reducer(newState, _action);
658
+ update = update.next;
659
+ } while (update !== null);
660
+
661
+ workInProgressHook.memoizedState = newState;
662
+
663
+ return [newState, _dispatch];
664
+ }
665
+ }
666
+ return [workInProgressHook.memoizedState, _dispatch];
667
+ } else {
668
+ var initialState = void 0;
669
+ if (reducer === basicStateReducer) {
670
+ // Special case for `useState`.
671
+ initialState = typeof initialArg === 'function' ? initialArg() : initialArg;
672
+ } else {
673
+ initialState = init !== undefined ? init(initialArg) : initialArg;
674
+ }
675
+ workInProgressHook.memoizedState = initialState;
676
+ var _queue2 = workInProgressHook.queue = {
677
+ last: null,
678
+ dispatch: null
679
+ };
680
+ var _dispatch2 = _queue2.dispatch = _this._dispatchAction.bind(_this, _this._currentlyRenderingComponent, _queue2);
681
+ return [workInProgressHook.memoizedState, _dispatch2];
682
+ }
683
+ };
684
+
685
+ var useState = function (initialState) {
686
+ return useReducer(basicStateReducer,
687
+ // useReducer has a special case to support lazy useState initializers
688
+ initialState);
689
+ };
690
+
691
+ var useMemo = function (nextCreate, deps) {
692
+ _this._validateCurrentlyRenderingComponent();
693
+ _this._createWorkInProgressHook();
694
+
695
+ var nextDeps = deps !== undefined ? deps : null;
696
+
697
+ if (_this._workInProgressHook !== null && _this._workInProgressHook.memoizedState !== null) {
698
+ var prevState = _this._workInProgressHook.memoizedState;
699
+ var prevDeps = prevState[1];
700
+ if (nextDeps !== null) {
701
+ if (areHookInputsEqual(nextDeps, prevDeps)) {
702
+ return prevState[0];
703
+ }
704
+ }
705
+ }
706
+
707
+ var nextValue = nextCreate();
708
+ _this._workInProgressHook.memoizedState = [nextValue, nextDeps];
709
+ return nextValue;
710
+ };
711
+
712
+ var useRef = function (initialValue) {
713
+ _this._validateCurrentlyRenderingComponent();
714
+ _this._createWorkInProgressHook();
715
+ var previousRef = _this._workInProgressHook.memoizedState;
716
+ if (previousRef === null) {
717
+ var ref = { current: initialValue };
718
+ {
719
+ Object.seal(ref);
720
+ }
721
+ _this._workInProgressHook.memoizedState = ref;
722
+ return ref;
723
+ } else {
724
+ return previousRef;
725
+ }
726
+ };
727
+
728
+ var readContext = function (context, observedBits) {
729
+ return context._currentValue;
730
+ };
731
+
732
+ var noOp = function () {
733
+ _this._validateCurrentlyRenderingComponent();
734
+ };
735
+
736
+ var identity = function (fn) {
737
+ return fn;
738
+ };
739
+
740
+ return {
741
+ readContext: readContext,
742
+ useCallback: identity,
743
+ useContext: function (context) {
744
+ _this._validateCurrentlyRenderingComponent();
745
+ return readContext(context);
746
+ },
747
+ useDebugValue: noOp,
748
+ useEffect: noOp,
749
+ useImperativeHandle: noOp,
750
+ useLayoutEffect: noOp,
751
+ useMemo: useMemo,
752
+ useReducer: useReducer,
753
+ useRef: useRef,
754
+ useState: useState
755
+ };
756
+ };
757
+
758
+ ReactShallowRenderer.prototype._dispatchAction = function _dispatchAction(componentIdentity, queue, action) {
759
+ !(this._numberOfReRenders < RE_RENDER_LIMIT) ? invariant(false, 'Too many re-renders. React limits the number of renders to prevent an infinite loop.') : void 0;
760
+
761
+ if (componentIdentity === this._currentlyRenderingComponent) {
762
+ // This is a render phase update. Stash it in a lazily-created map of
763
+ // queue -> linked list of updates. After this render pass, we'll restart
764
+ // and apply the stashed updates on top of the work-in-progress hook.
765
+ this._didScheduleRenderPhaseUpdate = true;
766
+ var update = {
767
+ action: action,
768
+ next: null
769
+ };
770
+ var renderPhaseUpdates = this._renderPhaseUpdates;
771
+ if (renderPhaseUpdates === null) {
772
+ this._renderPhaseUpdates = renderPhaseUpdates = new Map();
773
+ }
774
+ var firstRenderPhaseUpdate = renderPhaseUpdates.get(queue);
775
+ if (firstRenderPhaseUpdate === undefined) {
776
+ renderPhaseUpdates.set(queue, update);
777
+ } else {
778
+ // Append the update to the end of the list.
779
+ var lastRenderPhaseUpdate = firstRenderPhaseUpdate;
780
+ while (lastRenderPhaseUpdate.next !== null) {
781
+ lastRenderPhaseUpdate = lastRenderPhaseUpdate.next;
782
+ }
783
+ lastRenderPhaseUpdate.next = update;
784
+ }
785
+ } else {
786
+ // This means an update has happened after the function component has
787
+ // returned. On the server this is a no-op. In React Fiber, the update
788
+ // would be scheduled for a future render.
789
+ }
790
+ };
791
+
792
+ ReactShallowRenderer.prototype._createWorkInProgressHook = function _createWorkInProgressHook() {
793
+ if (this._workInProgressHook === null) {
794
+ // This is the first hook in the list
795
+ if (this._firstWorkInProgressHook === null) {
796
+ this._isReRender = false;
797
+ this._firstWorkInProgressHook = this._workInProgressHook = createHook();
798
+ } else {
799
+ // There's already a work-in-progress. Reuse it.
800
+ this._isReRender = true;
801
+ this._workInProgressHook = this._firstWorkInProgressHook;
802
+ }
803
+ } else {
804
+ if (this._workInProgressHook.next === null) {
805
+ this._isReRender = false;
806
+ // Append to the end of the list
807
+ this._workInProgressHook = this._workInProgressHook.next = createHook();
808
+ } else {
809
+ // There's already a work-in-progress. Reuse it.
810
+ this._isReRender = true;
811
+ this._workInProgressHook = this._workInProgressHook.next;
812
+ }
813
+ }
814
+ return this._workInProgressHook;
815
+ };
816
+
817
+ ReactShallowRenderer.prototype._prepareToUseHooks = function _prepareToUseHooks(componentIdentity) {
818
+ if (this._previousComponentIdentity !== null && this._previousComponentIdentity !== componentIdentity) {
819
+ this._firstWorkInProgressHook = null;
820
+ }
821
+ this._currentlyRenderingComponent = componentIdentity;
822
+ this._previousComponentIdentity = componentIdentity;
823
+ };
824
+
825
+ ReactShallowRenderer.prototype._finishHooks = function _finishHooks(element, context) {
826
+ if (this._didScheduleRenderPhaseUpdate) {
827
+ // Updates were scheduled during the render phase. They are stored in
828
+ // the `renderPhaseUpdates` map. Call the component again, reusing the
829
+ // work-in-progress hooks and applying the additional updates on top. Keep
830
+ // restarting until no more updates are scheduled.
831
+ this._didScheduleRenderPhaseUpdate = false;
832
+ this._numberOfReRenders += 1;
833
+
834
+ // Start over from the beginning of the list
835
+ this._workInProgressHook = null;
836
+ this._rendering = false;
837
+ this.render(element, context);
838
+ } else {
839
+ this._currentlyRenderingComponent = null;
840
+ this._workInProgressHook = null;
841
+ this._renderPhaseUpdates = null;
842
+ this._numberOfReRenders = 0;
843
+ }
844
+ };
845
+
542
846
  ReactShallowRenderer.prototype.getMountedInstance = function getMountedInstance() {
543
847
  return this._instance;
544
848
  };
@@ -551,6 +855,7 @@ var ReactShallowRenderer = function () {
551
855
  var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : emptyObject;
552
856
 
553
857
  !React.isValidElement(element) ? invariant(false, 'ReactShallowRenderer render(): Invalid component element.%s', typeof element === 'function' ? ' Instead of passing a component class, make sure to instantiate ' + 'it by passing it to React.createElement.' : '') : void 0;
858
+ element = element;
554
859
  // Show a special message for host elements since it's a common case.
555
860
  !(typeof element.type !== 'string') ? invariant(false, 'ReactShallowRenderer render(): Shallow rendering works only with custom components, not primitives (%s). Instead of calling `.render(el)` and inspecting the rendered output, look at `el.props` directly instead.', element.type) : void 0;
556
861
  !(isForwardRef(element) || typeof element.type === 'function') ? invariant(false, 'ReactShallowRenderer render(): Shallow rendering works only with custom components, but the provided element type was `%s`.', Array.isArray(element.type) ? 'array' : element.type === null ? 'null' : typeof element.type) : void 0;
@@ -571,7 +876,12 @@ var ReactShallowRenderer = function () {
571
876
  } else if (shouldConstruct(element.type)) {
572
877
  this._instance = new element.type(element.props, this._context, this._updater);
573
878
 
574
- this._updateStateFromStaticLifecycle(element.props);
879
+ if (typeof element.type.getDerivedStateFromProps === 'function') {
880
+ var partialState = element.type.getDerivedStateFromProps.call(null, element.props, this._instance.state);
881
+ if (partialState != null) {
882
+ this._instance.state = _assign({}, this._instance.state, partialState);
883
+ }
884
+ }
575
885
 
576
886
  if (element.type.hasOwnProperty('contextTypes')) {
577
887
  currentlyValidatingElement = element;
@@ -583,7 +893,15 @@ var ReactShallowRenderer = function () {
583
893
 
584
894
  this._mountClassComponent(element, this._context);
585
895
  } else {
586
- this._rendered = element.type.call(undefined, element.props, this._context);
896
+ var prevDispatcher = ReactCurrentDispatcher.current;
897
+ ReactCurrentDispatcher.current = this._dispatcher;
898
+ this._prepareToUseHooks(element.type);
899
+ try {
900
+ this._rendered = element.type.call(undefined, element.props, this._context);
901
+ } finally {
902
+ ReactCurrentDispatcher.current = prevDispatcher;
903
+ }
904
+ this._finishHooks(element, context);
587
905
  }
588
906
  }
589
907
 
@@ -600,6 +918,8 @@ var ReactShallowRenderer = function () {
600
918
  }
601
919
  }
602
920
 
921
+ this._firstWorkInProgressHook = null;
922
+ this._previousComponentIdentity = null;
603
923
  this._context = null;
604
924
  this._element = null;
605
925
  this._newState = null;
@@ -658,10 +978,15 @@ var ReactShallowRenderer = function () {
658
978
  }
659
979
  }
660
980
  }
661
- this._updateStateFromStaticLifecycle(props);
662
981
 
663
982
  // Read state after cWRP in case it calls setState
664
983
  var state = this._newState || oldState;
984
+ if (typeof type.getDerivedStateFromProps === 'function') {
985
+ var partialState = type.getDerivedStateFromProps.call(null, props, state);
986
+ if (partialState != null) {
987
+ state = _assign({}, state, partialState);
988
+ }
989
+ }
665
990
 
666
991
  var shouldUpdate = true;
667
992
  if (this._forcedUpdate) {
@@ -689,6 +1014,7 @@ var ReactShallowRenderer = function () {
689
1014
  this._instance.context = context;
690
1015
  this._instance.props = props;
691
1016
  this._instance.state = state;
1017
+ this._newState = null;
692
1018
 
693
1019
  if (shouldUpdate) {
694
1020
  this._rendered = this._instance.render();
@@ -697,21 +1023,6 @@ var ReactShallowRenderer = function () {
697
1023
  // because DOM refs are not available.
698
1024
  };
699
1025
 
700
- ReactShallowRenderer.prototype._updateStateFromStaticLifecycle = function _updateStateFromStaticLifecycle(props) {
701
- var type = this._element.type;
702
-
703
-
704
- if (typeof type.getDerivedStateFromProps === 'function') {
705
- var oldState = this._newState || this._instance.state;
706
- var partialState = type.getDerivedStateFromProps.call(null, props, oldState);
707
-
708
- if (partialState != null) {
709
- var newState = _assign({}, oldState, partialState);
710
- this._instance.state = this._newState = newState;
711
- }
712
- }
713
- };
714
-
715
1026
  return ReactShallowRenderer;
716
1027
  }();
717
1028
 
@@ -753,7 +1064,7 @@ function shouldConstruct(Component) {
753
1064
  }
754
1065
 
755
1066
  function getMaskedContext(contextTypes, unmaskedContext) {
756
- if (!contextTypes) {
1067
+ if (!contextTypes || !unmaskedContext) {
757
1068
  return emptyObject;
758
1069
  }
759
1070
  var context = {};
@@ -1,4 +1,4 @@
1
- /** @license React v16.8.0-alpha.1
1
+ /** @license React v16.8.3
2
2
  * react-test-renderer-shallow.production.min.js
3
3
  *
4
4
  * Copyright (c) Facebook, Inc. and its affiliates.
@@ -6,18 +6,25 @@
6
6
  * This source code is licensed under the MIT license found in the
7
7
  * LICENSE file in the root directory of this source tree.
8
8
  */
9
- 'use strict';(function(g,e){"object"===typeof exports&&"undefined"!==typeof module?module.exports=e(require("react")):"function"===typeof define&&define.amd?define(["react"],e):g.ReactShallowRenderer=e(g.React)})(this,function(g){function e(a,b,f,d,c,h,g,x){if(!a){a=void 0;if(void 0===b)a=Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var w=[f,d,c,h,g,x],e=0;a=Error(b.replace(/%s/g,function(){return w[e++]}));
10
- a.name="Invariant Violation"}a.framesToPop=1;throw a;}}function n(a){for(var b=arguments.length-1,f="https://reactjs.org/docs/error-decoder.html?invariant="+a,d=0;d<b;d++)f+="&args[]="+encodeURIComponent(arguments[d+1]);e(!1,"Minified React error #"+a+"; visit %s for the full message or use the non-minified dev environment for full errors and additional helpful warnings. ",f)}function q(a){if("object"===typeof a&&null!==a){var b=a.$$typeof;switch(b){case y:switch(a=a.type,a){case z:case A:case B:case C:case D:case E:return a;
11
- default:switch(a=a&&a.$$typeof,a){case F:case p:case G:return a;default:return b}}case H:case I:case J:return b}}}function r(a,b){return a===b&&(0!==a||1/a===1/b)||a!==a&&b!==b}function t(a,b){if(r(a,b))return!0;if("object"!==typeof a||null===a||"object"!==typeof b||null===b)return!1;var f=Object.keys(a),d=Object.keys(b);if(f.length!==d.length)return!1;for(d=0;d<f.length;d++)if(!K.call(b,f[d])||!r(a[f[d]],b[f[d]]))return!1;return!0}function u(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");
12
- }var v=g.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.assign,c="function"===typeof Symbol&&Symbol.for,y=c?Symbol.for("react.element"):60103,J=c?Symbol.for("react.portal"):60106,B=c?Symbol.for("react.fragment"):60107,D=c?Symbol.for("react.strict_mode"):60108,C=c?Symbol.for("react.profiler"):60114,G=c?Symbol.for("react.provider"):60109,F=c?Symbol.for("react.context"):60110,z=c?Symbol.for("react.async_mode"):60111,A=c?Symbol.for("react.concurrent_mode"):60111,p=c?Symbol.for("react.forward_ref"):
13
- 60112,E=c?Symbol.for("react.suspense"):60113,I=c?Symbol.for("react.memo"):60115,H=c?Symbol.for("react.lazy"):60116,K=Object.prototype.hasOwnProperty,l={},L=function(){function a(b){u(this,a);this._renderer=b;this._callbacks=[]}a.prototype._enqueueCallback=function(b,a){"function"===typeof b&&a&&this._callbacks.push({callback:b,publicInstance:a})};a.prototype._invokeCallbacks=function(){var b=this._callbacks;this._callbacks=[];b.forEach(function(b){b.callback.call(b.publicInstance)})};a.prototype.isMounted=
14
- function(b){return!!this._renderer._element};a.prototype.enqueueForceUpdate=function(b,a,d){this._enqueueCallback(a,b);this._renderer._forcedUpdate=!0;this._renderer.render(this._renderer._element,this._renderer._context)};a.prototype.enqueueReplaceState=function(b,a,d,c){this._enqueueCallback(d,b);this._renderer._newState=a;this._renderer.render(this._renderer._element,this._renderer._context)};a.prototype.enqueueSetState=function(b,a,d,c){this._enqueueCallback(d,b);d=this._renderer._newState||b.state;
15
- "function"===typeof a&&(a=a.call(b,d,b.props));null!==a&&void 0!==a&&(this._renderer._newState=v({},d,a),this._renderer.render(this._renderer._element,this._renderer._context))};return a}(),m=function(){function a(){u(this,a);this._rendered=this._newState=this._instance=this._element=this._context=null;this._forcedUpdate=this._rendering=!1;this._updater=new L(this)}a.prototype.getMountedInstance=function(){return this._instance};a.prototype.getRenderOutput=function(){return this._rendered};a.prototype.render=
16
- function(b){var a=1<arguments.length&&void 0!==arguments[1]?arguments[1]:l;g.isValidElement(b)?void 0:n("12","function"===typeof b?" Instead of passing a component class, make sure to instantiate it by passing it to React.createElement.":"");"string"===typeof b.type?n("13",b.type):void 0;q(b)!==p&&"function"!==typeof b.type?n("249",Array.isArray(b.type)?"array":null===b.type?"null":typeof b.type):void 0;if(!this._rendering){this._rendering=!0;this._element=b;var d=b.type.contextTypes;if(d){var c=
17
- {},h;for(h in d)c[h]=a[h];a=c}else a=l;this._context=a;this._instance?this._updateClassComponent(b,this._context):q(b)===p?this._rendered=b.type.render(b.props,b.ref):(a=b.type,a.prototype&&a.prototype.isReactComponent?(this._instance=new b.type(b.props,this._context,this._updater),this._updateStateFromStaticLifecycle(b.props),b.type.hasOwnProperty("contextTypes"),this._mountClassComponent(b,this._context)):this._rendered=b.type.call(void 0,b.props,this._context));this._rendering=!1;this._updater._invokeCallbacks();
18
- return this.getRenderOutput()}};a.prototype.unmount=function(){this._instance&&"function"===typeof this._instance.componentWillUnmount&&this._instance.componentWillUnmount();this._instance=this._rendered=this._newState=this._element=this._context=null};a.prototype._mountClassComponent=function(b,a){this._instance.context=a;this._instance.props=b.props;this._instance.state=this._instance.state||null;this._instance.updater=this._updater;if("function"===typeof this._instance.UNSAFE_componentWillMount||
19
- "function"===typeof this._instance.componentWillMount)a=this._newState,"function"!==typeof b.type.getDerivedStateFromProps&&"function"!==typeof this._instance.getSnapshotBeforeUpdate&&("function"===typeof this._instance.componentWillMount&&this._instance.componentWillMount(),"function"===typeof this._instance.UNSAFE_componentWillMount&&this._instance.UNSAFE_componentWillMount()),a!==this._newState&&(this._instance.state=this._newState||l);this._rendered=this._instance.render()};a.prototype._updateClassComponent=
20
- function(a,c){var b=a.props,f=a.type,h=this._instance.state||l,g=this._instance.props;g!==b&&"function"!==typeof a.type.getDerivedStateFromProps&&"function"!==typeof this._instance.getSnapshotBeforeUpdate&&("function"===typeof this._instance.componentWillReceiveProps&&this._instance.componentWillReceiveProps(b,c),"function"===typeof this._instance.UNSAFE_componentWillReceiveProps&&this._instance.UNSAFE_componentWillReceiveProps(b,c));this._updateStateFromStaticLifecycle(b);var e=this._newState||h,
21
- k=!0;this._forcedUpdate?(k=!0,this._forcedUpdate=!1):"function"===typeof this._instance.shouldComponentUpdate?k=!!this._instance.shouldComponentUpdate(b,e,c):f.prototype&&f.prototype.isPureReactComponent&&(k=!t(g,b)||!t(h,e));k&&"function"!==typeof a.type.getDerivedStateFromProps&&"function"!==typeof this._instance.getSnapshotBeforeUpdate&&("function"===typeof this._instance.componentWillUpdate&&this._instance.componentWillUpdate(b,e,c),"function"===typeof this._instance.UNSAFE_componentWillUpdate&&
22
- this._instance.UNSAFE_componentWillUpdate(b,e,c));this._instance.context=c;this._instance.props=b;this._instance.state=e;k&&(this._rendered=this._instance.render())};a.prototype._updateStateFromStaticLifecycle=function(a){var b=this._element.type;if("function"===typeof b.getDerivedStateFromProps){var c=this._newState||this._instance.state;a=b.getDerivedStateFromProps.call(null,a,c);null!=a&&(c=v({},c,a),this._instance.state=this._newState=c)}};return a}();m.createRenderer=function(){return new m};
23
- c=(c={default:m},m)||c;return c.default||c});
9
+ 'use strict';(function(k,l){"object"===typeof exports&&"undefined"!==typeof module?module.exports=l(require("react")):"function"===typeof define&&define.amd?define(["react"],l):k.ReactShallowRenderer=l(k.React)})(this,function(k){function l(a,b,e,c,g,A,d,h){if(!a){a=void 0;if(void 0===b)a=Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var f=[e,c,g,A,d,h],B=0;a=Error(b.replace(/%s/g,function(){return f[B++]}));
10
+ a.name="Invariant Violation"}a.framesToPop=1;throw a;}}function m(a){for(var b=arguments.length-1,e="https://reactjs.org/docs/error-decoder.html?invariant="+a,c=0;c<b;c++)e+="&args[]="+encodeURIComponent(arguments[c+1]);l(!1,"Minified React error #"+a+"; visit %s for the full message or use the non-minified dev environment for full errors and additional helpful warnings. ",e)}function v(a){if("object"===typeof a&&null!==a){var b=a.$$typeof;switch(b){case C:switch(a=a.type,a){case D:case E:case F:case G:case H:case I:return a;
11
+ default:switch(a=a&&a.$$typeof,a){case J:case q:case K:return a;default:return b}}case L:case M:case N:return b}}}function r(a,b){return a===b&&(0!==a||1/a===1/b)||a!==a&&b!==b}function w(a,b){if(r(a,b))return!0;if("object"!==typeof a||null===a||"object"!==typeof b||null===b)return!1;var e=Object.keys(a),c=Object.keys(b);if(e.length!==c.length)return!1;for(c=0;c<e.length;c++)if(!O.call(b,e[c])||!r(a[e[c]],b[e[c]]))return!1;return!0}function x(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");
12
+ }function y(){return{memoizedState:null,queue:null,next:null}}function z(a,b){return"function"===typeof b?b(a):b}var t=k.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.assign,d="function"===typeof Symbol&&Symbol.for,C=d?Symbol.for("react.element"):60103,N=d?Symbol.for("react.portal"):60106,F=d?Symbol.for("react.fragment"):60107,H=d?Symbol.for("react.strict_mode"):60108,G=d?Symbol.for("react.profiler"):60114,K=d?Symbol.for("react.provider"):60109,J=d?Symbol.for("react.context"):60110,D=d?Symbol.for("react.async_mode"):
13
+ 60111,E=d?Symbol.for("react.concurrent_mode"):60111,q=d?Symbol.for("react.forward_ref"):60112,I=d?Symbol.for("react.suspense"):60113,M=d?Symbol.for("react.memo"):60115,L=d?Symbol.for("react.lazy"):60116,O=Object.prototype.hasOwnProperty;d=k.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;d.hasOwnProperty("ReactCurrentDispatcher")||(d.ReactCurrentDispatcher={current:null});var u=d.ReactCurrentDispatcher,n={},P=function(){function a(b){x(this,a);this._renderer=b;this._callbacks=[]}a.prototype._enqueueCallback=
14
+ function(b,a){"function"===typeof b&&a&&this._callbacks.push({callback:b,publicInstance:a})};a.prototype._invokeCallbacks=function(){var b=this._callbacks;this._callbacks=[];b.forEach(function(b){b.callback.call(b.publicInstance)})};a.prototype.isMounted=function(b){return!!this._renderer._element};a.prototype.enqueueForceUpdate=function(b,a,c){this._enqueueCallback(a,b);this._renderer._forcedUpdate=!0;this._renderer.render(this._renderer._element,this._renderer._context)};a.prototype.enqueueReplaceState=
15
+ function(b,a,c,g){this._enqueueCallback(c,b);this._renderer._newState=a;this._renderer.render(this._renderer._element,this._renderer._context)};a.prototype.enqueueSetState=function(b,a,c,g){this._enqueueCallback(c,b);c=this._renderer._newState||b.state;"function"===typeof a&&(a=a.call(b,c,b.props));null!==a&&void 0!==a&&(this._renderer._newState=t({},c,a),this._renderer.render(this._renderer._element,this._renderer._context))};return a}(),p=function(){function a(){x(this,a);this._rendered=this._newState=
16
+ this._instance=this._element=this._context=null;this._forcedUpdate=this._rendering=!1;this._updater=new P(this);this._dispatcher=this._createDispatcher();this._firstWorkInProgressHook=this._workInProgressHook=null;this._didScheduleRenderPhaseUpdate=this._isReRender=!1;this._currentlyRenderingComponent=this._renderPhaseUpdates=null;this._numberOfReRenders=0;this._previousComponentIdentity=null}a.prototype._validateCurrentlyRenderingComponent=function(){null===this._currentlyRenderingComponent?m("307"):
17
+ void 0};a.prototype._createDispatcher=function(){var b=this,a=function(a,c,e){b._validateCurrentlyRenderingComponent();b._createWorkInProgressHook();var g=b._workInProgressHook;if(b._isReRender){var f=g.queue;c=f.dispatch;if(null!==b._renderPhaseUpdates&&(e=b._renderPhaseUpdates.get(f),void 0!==e)){b._renderPhaseUpdates.delete(f);f=g.memoizedState;do f=a(f,e.action),e=e.next;while(null!==e);g.memoizedState=f;return[f,c]}return[g.memoizedState,c]}a=a===z?"function"===typeof c?c():c:void 0!==e?e(c):
18
+ c;g.memoizedState=a;a=g.queue={last:null,dispatch:null};a=a.dispatch=b._dispatchAction.bind(b,b._currentlyRenderingComponent,a);return[g.memoizedState,a]},c=function(){b._validateCurrentlyRenderingComponent()};return{readContext:function(b,a){return b._currentValue},useCallback:function(b){return b},useContext:function(a){b._validateCurrentlyRenderingComponent();return a._currentValue},useDebugValue:c,useEffect:c,useImperativeHandle:c,useLayoutEffect:c,useMemo:function(a,c){b._validateCurrentlyRenderingComponent();
19
+ b._createWorkInProgressHook();c=void 0!==c?c:null;if(null!==b._workInProgressHook&&null!==b._workInProgressHook.memoizedState){var e=b._workInProgressHook.memoizedState,g=e[1];if(null!==c){a:if(null===g)g=!1;else{for(var f=0;f<g.length&&f<c.length;f++)if(!r(c[f],g[f])){g=!1;break a}g=!0}if(g)return e[0]}}a=a();b._workInProgressHook.memoizedState=[a,c];return a},useReducer:a,useRef:function(a){b._validateCurrentlyRenderingComponent();b._createWorkInProgressHook();var c=b._workInProgressHook.memoizedState;
20
+ return null===c?(a={current:a},b._workInProgressHook.memoizedState=a):c},useState:function(b){return a(z,b)}}};a.prototype._dispatchAction=function(b,a,c){25>this._numberOfReRenders?void 0:m("301");if(b===this._currentlyRenderingComponent){this._didScheduleRenderPhaseUpdate=!0;b={action:c,next:null};c=this._renderPhaseUpdates;null===c&&(this._renderPhaseUpdates=c=new Map);var e=c.get(a);if(void 0===e)c.set(a,b);else{for(a=e;null!==a.next;)a=a.next;a.next=b}}};a.prototype._createWorkInProgressHook=
21
+ function(){null===this._workInProgressHook?null===this._firstWorkInProgressHook?(this._isReRender=!1,this._firstWorkInProgressHook=this._workInProgressHook=y()):(this._isReRender=!0,this._workInProgressHook=this._firstWorkInProgressHook):null===this._workInProgressHook.next?(this._isReRender=!1,this._workInProgressHook=this._workInProgressHook.next=y()):(this._isReRender=!0,this._workInProgressHook=this._workInProgressHook.next);return this._workInProgressHook};a.prototype._prepareToUseHooks=function(b){null!==
22
+ this._previousComponentIdentity&&this._previousComponentIdentity!==b&&(this._firstWorkInProgressHook=null);this._previousComponentIdentity=this._currentlyRenderingComponent=b};a.prototype._finishHooks=function(b,a){this._didScheduleRenderPhaseUpdate?(this._didScheduleRenderPhaseUpdate=!1,this._numberOfReRenders+=1,this._workInProgressHook=null,this._rendering=!1,this.render(b,a)):(this._renderPhaseUpdates=this._workInProgressHook=this._currentlyRenderingComponent=null,this._numberOfReRenders=0)};
23
+ a.prototype.getMountedInstance=function(){return this._instance};a.prototype.getRenderOutput=function(){return this._rendered};a.prototype.render=function(b){var a=1<arguments.length&&void 0!==arguments[1]?arguments[1]:n;k.isValidElement(b)?void 0:m("12","function"===typeof b?" Instead of passing a component class, make sure to instantiate it by passing it to React.createElement.":"");"string"===typeof b.type?m("13",b.type):void 0;v(b)!==q&&"function"!==typeof b.type?m("249",Array.isArray(b.type)?
24
+ "array":null===b.type?"null":typeof b.type):void 0;if(!this._rendering){this._rendering=!0;this._element=b;var c;if((c=b.type.contextTypes)&&a){var g={},d;for(d in c)g[d]=a[d];c=g}else c=n;this._context=c;if(this._instance)this._updateClassComponent(b,this._context);else if(v(b)===q)this._rendered=b.type.render(b.props,b.ref);else if(c=b.type,c.prototype&&c.prototype.isReactComponent)this._instance=new b.type(b.props,this._context,this._updater),"function"===typeof b.type.getDerivedStateFromProps&&
25
+ (a=b.type.getDerivedStateFromProps.call(null,b.props,this._instance.state),null!=a&&(this._instance.state=t({},this._instance.state,a))),b.type.hasOwnProperty("contextTypes"),this._mountClassComponent(b,this._context);else{c=u.current;u.current=this._dispatcher;this._prepareToUseHooks(b.type);try{this._rendered=b.type.call(void 0,b.props,this._context)}finally{u.current=c}this._finishHooks(b,a)}this._rendering=!1;this._updater._invokeCallbacks();return this.getRenderOutput()}};a.prototype.unmount=
26
+ function(){this._instance&&"function"===typeof this._instance.componentWillUnmount&&this._instance.componentWillUnmount();this._instance=this._rendered=this._newState=this._element=this._context=this._previousComponentIdentity=this._firstWorkInProgressHook=null};a.prototype._mountClassComponent=function(b,a){this._instance.context=a;this._instance.props=b.props;this._instance.state=this._instance.state||null;this._instance.updater=this._updater;if("function"===typeof this._instance.UNSAFE_componentWillMount||
27
+ "function"===typeof this._instance.componentWillMount)a=this._newState,"function"!==typeof b.type.getDerivedStateFromProps&&"function"!==typeof this._instance.getSnapshotBeforeUpdate&&("function"===typeof this._instance.componentWillMount&&this._instance.componentWillMount(),"function"===typeof this._instance.UNSAFE_componentWillMount&&this._instance.UNSAFE_componentWillMount()),a!==this._newState&&(this._instance.state=this._newState||n);this._rendered=this._instance.render()};a.prototype._updateClassComponent=
28
+ function(a,e){var b=a.props,d=a.type,k=this._instance.state||n,l=this._instance.props;l!==b&&"function"!==typeof a.type.getDerivedStateFromProps&&"function"!==typeof this._instance.getSnapshotBeforeUpdate&&("function"===typeof this._instance.componentWillReceiveProps&&this._instance.componentWillReceiveProps(b,e),"function"===typeof this._instance.UNSAFE_componentWillReceiveProps&&this._instance.UNSAFE_componentWillReceiveProps(b,e));var h=this._newState||k;if("function"===typeof d.getDerivedStateFromProps){var f=
29
+ d.getDerivedStateFromProps.call(null,b,h);null!=f&&(h=t({},h,f))}f=!0;this._forcedUpdate?(f=!0,this._forcedUpdate=!1):"function"===typeof this._instance.shouldComponentUpdate?f=!!this._instance.shouldComponentUpdate(b,h,e):d.prototype&&d.prototype.isPureReactComponent&&(f=!w(l,b)||!w(k,h));f&&"function"!==typeof a.type.getDerivedStateFromProps&&"function"!==typeof this._instance.getSnapshotBeforeUpdate&&("function"===typeof this._instance.componentWillUpdate&&this._instance.componentWillUpdate(b,
30
+ h,e),"function"===typeof this._instance.UNSAFE_componentWillUpdate&&this._instance.UNSAFE_componentWillUpdate(b,h,e));this._instance.context=e;this._instance.props=b;this._instance.state=h;this._newState=null;f&&(this._rendered=this._instance.render())};return a}();p.createRenderer=function(){return new p};d=(d={default:p},p)||d;return d.default||d});