UNPKG

12 kBJavaScriptView Raw
1/** @license React v16.11.0
2 * react-test-renderer-shallow.production.min.js
3 *
4 * Copyright (c) Facebook, Inc. and its affiliates.
5 *
6 * This source code is licensed under the MIT license found in the
7 * LICENSE file in the root directory of this source tree.
8 */
9
10'use strict';var h=require("object-assign"),l=require("react"),m=require("react-is"),n=require("prop-types/checkPropTypes");function p(c){for(var d="https://reactjs.org/docs/error-decoder.html?invariant="+c,a=1;a<arguments.length;a++)d+="&args[]="+encodeURIComponent(arguments[a]);return"Minified React error #"+c+"; visit "+d+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}
11var r=/^(.*)[\\\/]/,t="function"===typeof Symbol&&Symbol.for,u=t?Symbol.for("react.portal"):60106,v=t?Symbol.for("react.fragment"):60107,w=t?Symbol.for("react.strict_mode"):60108,x=t?Symbol.for("react.profiler"):60114,y=t?Symbol.for("react.provider"):60109,z=t?Symbol.for("react.context"):60110,A=t?Symbol.for("react.forward_ref"):60112,B=t?Symbol.for("react.suspense"):60113,C=t?Symbol.for("react.suspense_list"):60120,D=t?Symbol.for("react.memo"):60115,E=t?Symbol.for("react.lazy"):60116,F=l.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
12F.hasOwnProperty("ReactCurrentDispatcher")||(F.ReactCurrentDispatcher={current:null});F.hasOwnProperty("ReactCurrentBatchConfig")||(F.ReactCurrentBatchConfig={suspense:null});
13function G(c){if(null==c)return null;if("function"===typeof c)return c.displayName||c.name||null;if("string"===typeof c)return c;switch(c){case v:return"Fragment";case u:return"Portal";case x:return"Profiler";case w:return"StrictMode";case B:return"Suspense";case C:return"SuspenseList"}if("object"===typeof c)switch(c.$$typeof){case z:return"Context.Consumer";case y:return"Context.Provider";case A:var d=c.render;d=d.displayName||d.name||"";return c.displayName||(""!==d?"ForwardRef("+d+")":"ForwardRef");
14case D:return G(c.type);case E:if(c=1===c._status?c._result:null)return G(c)}return null}function H(c,d){return c===d&&(0!==c||1/c===1/d)||c!==c&&d!==d}var I="function"===typeof Object.is?Object.is:H,J=Object.prototype.hasOwnProperty;function K(c,d){if(I(c,d))return!0;if("object"!==typeof c||null===c||"object"!==typeof d||null===d)return!1;var a=Object.keys(c),b=Object.keys(d);if(a.length!==b.length)return!1;for(b=0;b<a.length;b++)if(!J.call(d,a[b])||!I(c[a[b]],d[a[b]]))return!1;return!0}
15var L=F.ReactCurrentDispatcher,M={},N=function(){function c(a){this._renderer=a;this._callbacks=[]}var d=c.prototype;d._enqueueCallback=function(a,b){"function"===typeof a&&b&&this._callbacks.push({callback:a,publicInstance:b})};d._invokeCallbacks=function(){var a=this._callbacks;this._callbacks=[];a.forEach(function(a){a.callback.call(a.publicInstance)})};d.isMounted=function(){return!!this._renderer._element};d.enqueueForceUpdate=function(a,b){this._enqueueCallback(b,a);this._renderer._forcedUpdate=
16!0;this._renderer.render(this._renderer._element,this._renderer._context)};d.enqueueReplaceState=function(a,b,e){this._enqueueCallback(e,a);this._renderer._newState=b;this._renderer.render(this._renderer._element,this._renderer._context)};d.enqueueSetState=function(a,b,e){this._enqueueCallback(e,a);e=this._renderer._newState||a.state;"function"===typeof b&&(b=b.call(a,e,a.props));null!==b&&void 0!==b&&(this._renderer._newState=h({},e,{},b),this._renderer.render(this._renderer._element,this._renderer._context))};
17return c}();function O(){return{memoizedState:null,queue:null,next:null}}function P(c,d){return"function"===typeof d?d(c):d}
18var S=function(){function c(){this._reset()}var d=c.prototype;d._reset=function(){this._rendered=this._newState=this._instance=this._element=this._context=null;this._forcedUpdate=this._rendering=!1;this._updater=new N(this);this._dispatcher=this._createDispatcher();this._firstWorkInProgressHook=this._workInProgressHook=null;this._didScheduleRenderPhaseUpdate=this._isReRender=!1;this._renderPhaseUpdates=null;this._numberOfReRenders=0};d._validateCurrentlyRenderingComponent=function(){if(!this._rendering||
19this._instance)throw Error(p(321));};d._createDispatcher=function(){function a(){e._validateCurrentlyRenderingComponent()}function b(a,b,c){e._validateCurrentlyRenderingComponent();e._createWorkInProgressHook();var d=e._workInProgressHook;if(e._isReRender){c=d.queue;b=c.dispatch;if(0<e._numberOfReRenders){if(null!==e._renderPhaseUpdates){var f=e._renderPhaseUpdates.get(c);if(void 0!==f){e._renderPhaseUpdates.delete(c);c=d.memoizedState;do c=a(c,f.action),f=f.next;while(null!==f);d.memoizedState=c;
20return[c,b]}}return[d.memoizedState,b]}f=d.memoizedState;var q=c.first;if(null!==q){do f=a(f,q.action),q=q.next;while(null!==q);c.first=null;d.memoizedState=f}return[f,b]}a=a===P?"function"===typeof b?b():b:void 0!==c?c(b):b;d.memoizedState=a;a=d.queue={first:null,dispatch:null};a=a.dispatch=e._dispatchAction.bind(e,a);return[d.memoizedState,a]}var e=this;return{readContext:function(a){return a._currentValue},useCallback:function(a){return a},useContext:function(a){e._validateCurrentlyRenderingComponent();
21return a._currentValue},useDebugValue:a,useEffect:a,useImperativeHandle:a,useLayoutEffect:a,useMemo:function(a,b){e._validateCurrentlyRenderingComponent();e._createWorkInProgressHook();b=void 0!==b?b:null;if(null!==e._workInProgressHook&&null!==e._workInProgressHook.memoizedState){var c=e._workInProgressHook.memoizedState,d=c[1];if(null!==b){a:if(null===d)d=!1;else{for(var f=0;f<d.length&&f<b.length;f++)if(!I(b[f],d[f])){d=!1;break a}d=!0}if(d)return c[0]}}a=a();e._workInProgressHook.memoizedState=
22[a,b];return a},useReducer:b,useRef:function(a){e._validateCurrentlyRenderingComponent();e._createWorkInProgressHook();var b=e._workInProgressHook.memoizedState;return null===b?(a={current:a},e._workInProgressHook.memoizedState=a):b},useState:function(a){return b(P,a)},useResponder:function(a,b){return{props:b,responder:a}},useTransition:function(){e._validateCurrentlyRenderingComponent();return[function(a){a()},!1]},useDeferredValue:function(a){e._validateCurrentlyRenderingComponent();return a}}};
23d._dispatchAction=function(a,b){if(!(25>this._numberOfReRenders))throw Error(p(301));if(this._rendering){this._didScheduleRenderPhaseUpdate=!0;b={action:b,next:null};var e=this._renderPhaseUpdates;null===e&&(this._renderPhaseUpdates=e=new Map);var c=e.get(a);if(void 0===c)e.set(a,b);else{for(a=c;null!==a.next;)a=a.next;a.next=b}}else{b={action:b,next:null};e=a.first;if(null===e)a.first=b;else{for(;null!==e.next;)e=e.next;e.next=b}this.render(this._element,this._context)}};d._createWorkInProgressHook=
24function(){null===this._workInProgressHook?null===this._firstWorkInProgressHook?(this._isReRender=!1,this._firstWorkInProgressHook=this._workInProgressHook=O()):(this._isReRender=!0,this._workInProgressHook=this._firstWorkInProgressHook):null===this._workInProgressHook.next?(this._isReRender=!1,this._workInProgressHook=this._workInProgressHook.next=O()):(this._isReRender=!0,this._workInProgressHook=this._workInProgressHook.next);return this._workInProgressHook};d._finishHooks=function(a,b){this._didScheduleRenderPhaseUpdate?
25(this._didScheduleRenderPhaseUpdate=!1,this._numberOfReRenders+=1,this._workInProgressHook=null,this._rendering=!1,this.render(a,b)):(this._renderPhaseUpdates=this._workInProgressHook=null,this._numberOfReRenders=0)};d.getMountedInstance=function(){return this._instance};d.getRenderOutput=function(){return this._rendered};d.render=function(a){var b=1<arguments.length&&void 0!==arguments[1]?arguments[1]:M;if(!l.isValidElement(a))throw Error(p(12,"function"===typeof a?" Instead of passing a component class, make sure to instantiate it by passing it to React.createElement.":
26""));if("string"===typeof a.type)throw Error(p(13,a.type));if(!m.isForwardRef(a)&&"function"!==typeof a.type&&!m.isMemo(a.type))throw Error(p(249,Array.isArray(a.type)?"array":null===a.type?"null":typeof a.type));if(!this._rendering){null!=this._element&&this._element.type!==a.type&&this._reset();var e=m.isMemo(a.type)?a.type.type:a.type,c=this._element;this._rendering=!0;this._element=a;var d;if((d=e.contextTypes)&&b){var k={},g;for(g in d)k[g]=b[g];d=k}else d=M;this._context=d;m.isMemo(a.type)&&
27e.propTypes&&(Q=a,n(e.propTypes,a.props,"prop",G(e),R));if(this._instance)this._updateClassComponent(e,a,this._context);else if(e.prototype&&e.prototype.isReactComponent)this._instance=new e(a.props,this._context,this._updater),"function"===typeof e.getDerivedStateFromProps&&(b=e.getDerivedStateFromProps.call(null,a.props,this._instance.state),null!=b&&(this._instance.state=h({},this._instance.state,b))),e.contextTypes&&(Q=a,b=(b=this._instance)&&b.constructor,n(e.contextTypes,this._context,"context",
28e.displayName||b&&b.displayName||e.name||b&&b.name||null,R),Q=null),this._mountClassComponent(e,a,this._context);else if(d=!0,m.isMemo(a.type)&&null!==c&&(a.type.compare||K)(c.props,a.props)&&(d=!1),d){c=L.current;L.current=this._dispatcher;try{if(e.$$typeof===m.ForwardRef){if("function"!==typeof e.render)throw Error(p(322,typeof e.render));this._rendered=e.render.call(void 0,a.props,a.ref)}else this._rendered=e(a.props,this._context)}finally{L.current=c}this._finishHooks(a,b)}this._rendering=!1;
29this._updater._invokeCallbacks();return this.getRenderOutput()}};d.unmount=function(){this._instance&&"function"===typeof this._instance.componentWillUnmount&&this._instance.componentWillUnmount();this._reset()};d._mountClassComponent=function(a,b,c){this._instance.context=c;this._instance.props=b.props;this._instance.state=this._instance.state||null;this._instance.updater=this._updater;if("function"===typeof this._instance.UNSAFE_componentWillMount||"function"===typeof this._instance.componentWillMount)b=
30this._newState,"function"!==typeof a.getDerivedStateFromProps&&"function"!==typeof this._instance.getSnapshotBeforeUpdate&&("function"===typeof this._instance.componentWillMount&&this._instance.componentWillMount(),"function"===typeof this._instance.UNSAFE_componentWillMount&&this._instance.UNSAFE_componentWillMount()),b!==this._newState&&(this._instance.state=this._newState||M);this._rendered=this._instance.render()};d._updateClassComponent=function(a,b,c){b=b.props;var d=this._instance.state||M,
31e=this._instance.props;e!==b&&"function"!==typeof a.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));var k=this._newState||d;if("function"===typeof a.getDerivedStateFromProps){var g=a.getDerivedStateFromProps.call(null,b,k);null!=g&&
32(k=h({},k,g))}g=!0;this._forcedUpdate?(g=!0,this._forcedUpdate=!1):"function"===typeof this._instance.shouldComponentUpdate?g=!!this._instance.shouldComponentUpdate(b,k,c):a.prototype&&a.prototype.isPureReactComponent&&(g=!K(e,b)||!K(d,k));g&&"function"!==typeof a.getDerivedStateFromProps&&"function"!==typeof this._instance.getSnapshotBeforeUpdate&&("function"===typeof this._instance.componentWillUpdate&&this._instance.componentWillUpdate(b,k,c),"function"===typeof this._instance.UNSAFE_componentWillUpdate&&
33this._instance.UNSAFE_componentWillUpdate(b,k,c));this._instance.context=c;this._instance.props=b;this._instance.state=k;this._newState=null;g&&(this._rendered=this._instance.render())};return c}();S.createRenderer=function(){return new S};var Q=null;function T(c){if(null==c)return"#empty";if("string"===typeof c||"number"===typeof c)return"#text";if("string"===typeof c.type)return c.type;c=m.isMemo(c.type)?c.type.type:c.type;return c.displayName||c.name||"Unknown"}
34function R(){var c="";if(Q){var d=T(Q),a=Q._owner,b=Q._source;a=a&&G(a.type);var e="";b?e=" (at "+b.fileName.replace(r,"")+":"+b.lineNumber+")":a&&(e=" (created by "+a+")");c+="\n in "+(d||"Unknown")+e}return c}var U={default:S},V=U&&S||U;module.exports=V.default||V;