wp/wp-includes/js/dist/vendor/react-dom.js
changeset 18 be944660c56a
parent 16 a86126ab1dd4
child 19 3d72ae0968f4
equal deleted inserted replaced
17:34716fd837a4 18:be944660c56a
     1 /** @license React v16.9.0
     1 /** @license React v16.13.1
     2  * react-dom.development.js
     2  * react-dom.development.js
     3  *
     3  *
     4  * Copyright (c) Facebook, Inc. and its affiliates.
     4  * Copyright (c) Facebook, Inc. and its affiliates.
     5  *
     5  *
     6  * This source code is licensed under the MIT license found in the
     6  * This source code is licensed under the MIT license found in the
     8  */
     8  */
     9 
     9 
    10 'use strict';
    10 'use strict';
    11 
    11 
    12 (function (global, factory) {
    12 (function (global, factory) {
    13 	typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('react')) :
    13   typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react')) :
    14 	typeof define === 'function' && define.amd ? define(['react'], factory) :
    14   typeof define === 'function' && define.amd ? define(['exports', 'react'], factory) :
    15 	(global.ReactDOM = factory(global.React));
    15   (global = global || self, factory(global.ReactDOM = {}, global.React));
    16 }(this, (function (React) { 'use strict';
    16 }(this, (function (exports, React) { 'use strict';
    17 
    17 
    18 // Do not require this module directly! Use normal `invariant` calls with
    18   var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; // Prevent newer renderers from RTE when used with older react package versions.
    19 // template literal strings. The messages will be converted to ReactError during
    19   // Current owner and dispatcher used to share the same ref,
    20 // build, and in production they will be minified.
    20   // but PR #14548 split them out to better support the react-debug-tools package.
    21 
    21 
    22 // Do not require this module directly! Use normal `invariant` calls with
    22   if (!ReactSharedInternals.hasOwnProperty('ReactCurrentDispatcher')) {
    23 // template literal strings. The messages will be converted to ReactError during
    23     ReactSharedInternals.ReactCurrentDispatcher = {
    24 // build, and in production they will be minified.
    24       current: null
    25 
    25     };
    26 function ReactError(error) {
    26   }
    27   error.name = 'Invariant Violation';
    27 
    28   return error;
    28   if (!ReactSharedInternals.hasOwnProperty('ReactCurrentBatchConfig')) {
    29 }
    29     ReactSharedInternals.ReactCurrentBatchConfig = {
    30 
    30       suspense: null
    31 /**
    31     };
    32  * Use invariant() to assert state which your program assumes to be true.
    32   }
    33  *
    33 
    34  * Provide sprintf-style format (only %s is supported) and arguments
    34   // by calls to these methods by a Babel plugin.
    35  * to provide information about what broke and what you were
    35   //
    36  * expecting.
    36   // In PROD (or in packages without access to React internals),
    37  *
    37   // they are left as they are instead.
    38  * The invariant message will be stripped in production, but the invariant
    38 
    39  * will remain to ensure logic does not differ in production.
    39   function warn(format) {
    40  */
    40     {
    41 
    41       for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
    42 (function () {
    42         args[_key - 1] = arguments[_key];
       
    43       }
       
    44 
       
    45       printWarning('warn', format, args);
       
    46     }
       
    47   }
       
    48   function error(format) {
       
    49     {
       
    50       for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
       
    51         args[_key2 - 1] = arguments[_key2];
       
    52       }
       
    53 
       
    54       printWarning('error', format, args);
       
    55     }
       
    56   }
       
    57 
       
    58   function printWarning(level, format, args) {
       
    59     // When changing this logic, you might want to also
       
    60     // update consoleWithStackDev.www.js as well.
       
    61     {
       
    62       var hasExistingStack = args.length > 0 && typeof args[args.length - 1] === 'string' && args[args.length - 1].indexOf('\n    in') === 0;
       
    63 
       
    64       if (!hasExistingStack) {
       
    65         var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
       
    66         var stack = ReactDebugCurrentFrame.getStackAddendum();
       
    67 
       
    68         if (stack !== '') {
       
    69           format += '%s';
       
    70           args = args.concat([stack]);
       
    71         }
       
    72       }
       
    73 
       
    74       var argsWithFormat = args.map(function (item) {
       
    75         return '' + item;
       
    76       }); // Careful: RN currently depends on this prefix
       
    77 
       
    78       argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
       
    79       // breaks IE9: https://github.com/facebook/react/issues/13610
       
    80       // eslint-disable-next-line react-internal/no-production-logging
       
    81 
       
    82       Function.prototype.apply.call(console[level], console, argsWithFormat);
       
    83 
       
    84       try {
       
    85         // --- Welcome to debugging React ---
       
    86         // This error was thrown as a convenience so that you can use this stack
       
    87         // to find the callsite that caused this warning to fire.
       
    88         var argIndex = 0;
       
    89         var message = 'Warning: ' + format.replace(/%s/g, function () {
       
    90           return args[argIndex++];
       
    91         });
       
    92         throw new Error(message);
       
    93       } catch (x) {}
       
    94     }
       
    95   }
       
    96 
    43   if (!React) {
    97   if (!React) {
    44     {
    98     {
    45       throw ReactError(Error('ReactDOM was loaded before React. Make sure you load the React package before loading ReactDOM.'));
    99       throw Error( "ReactDOM was loaded before React. Make sure you load the React package before loading ReactDOM." );
    46     }
   100     }
    47   }
   101   }
    48 })();
   102 
    49 
   103   var invokeGuardedCallbackImpl = function (name, func, context, a, b, c, d, e, f) {
    50 /**
   104     var funcArgs = Array.prototype.slice.call(arguments, 3);
    51  * Injectable ordering of event plugins.
   105 
    52  */
   106     try {
    53 var eventPluginOrder = null;
   107       func.apply(context, funcArgs);
    54 
   108     } catch (error) {
    55 /**
   109       this.onError(error);
    56  * Injectable mapping from names to event plugin modules.
   110     }
    57  */
   111   };
    58 var namesToPlugins = {};
       
    59 
       
    60 /**
       
    61  * Recomputes the plugin list using the injected plugins and plugin ordering.
       
    62  *
       
    63  * @private
       
    64  */
       
    65 function recomputePluginOrdering() {
       
    66   if (!eventPluginOrder) {
       
    67     // Wait until an `eventPluginOrder` is injected.
       
    68     return;
       
    69   }
       
    70   for (var pluginName in namesToPlugins) {
       
    71     var pluginModule = namesToPlugins[pluginName];
       
    72     var pluginIndex = eventPluginOrder.indexOf(pluginName);
       
    73     (function () {
       
    74       if (!(pluginIndex > -1)) {
       
    75         {
       
    76           throw ReactError(Error('EventPluginRegistry: Cannot inject event plugins that do not exist in the plugin ordering, `' + pluginName + '`.'));
       
    77         }
       
    78       }
       
    79     })();
       
    80     if (plugins[pluginIndex]) {
       
    81       continue;
       
    82     }
       
    83     (function () {
       
    84       if (!pluginModule.extractEvents) {
       
    85         {
       
    86           throw ReactError(Error('EventPluginRegistry: Event plugins must implement an `extractEvents` method, but `' + pluginName + '` does not.'));
       
    87         }
       
    88       }
       
    89     })();
       
    90     plugins[pluginIndex] = pluginModule;
       
    91     var publishedEvents = pluginModule.eventTypes;
       
    92     for (var eventName in publishedEvents) {
       
    93       (function () {
       
    94         if (!publishEventForPlugin(publishedEvents[eventName], pluginModule, eventName)) {
       
    95           {
       
    96             throw ReactError(Error('EventPluginRegistry: Failed to publish event `' + eventName + '` for plugin `' + pluginName + '`.'));
       
    97           }
       
    98         }
       
    99       })();
       
   100     }
       
   101   }
       
   102 }
       
   103 
       
   104 /**
       
   105  * Publishes an event so that it can be dispatched by the supplied plugin.
       
   106  *
       
   107  * @param {object} dispatchConfig Dispatch configuration for the event.
       
   108  * @param {object} PluginModule Plugin publishing the event.
       
   109  * @return {boolean} True if the event was successfully published.
       
   110  * @private
       
   111  */
       
   112 function publishEventForPlugin(dispatchConfig, pluginModule, eventName) {
       
   113   (function () {
       
   114     if (!!eventNameDispatchConfigs.hasOwnProperty(eventName)) {
       
   115       {
       
   116         throw ReactError(Error('EventPluginHub: More than one plugin attempted to publish the same event name, `' + eventName + '`.'));
       
   117       }
       
   118     }
       
   119   })();
       
   120   eventNameDispatchConfigs[eventName] = dispatchConfig;
       
   121 
       
   122   var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames;
       
   123   if (phasedRegistrationNames) {
       
   124     for (var phaseName in phasedRegistrationNames) {
       
   125       if (phasedRegistrationNames.hasOwnProperty(phaseName)) {
       
   126         var phasedRegistrationName = phasedRegistrationNames[phaseName];
       
   127         publishRegistrationName(phasedRegistrationName, pluginModule, eventName);
       
   128       }
       
   129     }
       
   130     return true;
       
   131   } else if (dispatchConfig.registrationName) {
       
   132     publishRegistrationName(dispatchConfig.registrationName, pluginModule, eventName);
       
   133     return true;
       
   134   }
       
   135   return false;
       
   136 }
       
   137 
       
   138 /**
       
   139  * Publishes a registration name that is used to identify dispatched events.
       
   140  *
       
   141  * @param {string} registrationName Registration name to add.
       
   142  * @param {object} PluginModule Plugin publishing the event.
       
   143  * @private
       
   144  */
       
   145 function publishRegistrationName(registrationName, pluginModule, eventName) {
       
   146   (function () {
       
   147     if (!!registrationNameModules[registrationName]) {
       
   148       {
       
   149         throw ReactError(Error('EventPluginHub: More than one plugin attempted to publish the same registration name, `' + registrationName + '`.'));
       
   150       }
       
   151     }
       
   152   })();
       
   153   registrationNameModules[registrationName] = pluginModule;
       
   154   registrationNameDependencies[registrationName] = pluginModule.eventTypes[eventName].dependencies;
       
   155 
   112 
   156   {
   113   {
   157     var lowerCasedName = registrationName.toLowerCase();
   114     // In DEV mode, we swap out invokeGuardedCallback for a special version
   158     possibleRegistrationNames[lowerCasedName] = registrationName;
   115     // that plays more nicely with the browser's DevTools. The idea is to preserve
   159 
   116     // "Pause on exceptions" behavior. Because React wraps all user-provided
   160     if (registrationName === 'onDoubleClick') {
   117     // functions in invokeGuardedCallback, and the production version of
   161       possibleRegistrationNames.ondblclick = registrationName;
   118     // invokeGuardedCallback uses a try-catch, all user exceptions are treated
   162     }
   119     // like caught exceptions, and the DevTools won't pause unless the developer
   163   }
   120     // takes the extra step of enabling pause on caught exceptions. This is
   164 }
   121     // unintuitive, though, because even though React has caught the error, from
   165 
   122     // the developer's perspective, the error is uncaught.
   166 /**
   123     //
   167  * Registers plugins so that they can extract and dispatch events.
   124     // To preserve the expected "Pause on exceptions" behavior, we don't use a
   168  *
   125     // try-catch in DEV. Instead, we synchronously dispatch a fake event to a fake
   169  * @see {EventPluginHub}
   126     // DOM node, and call the user-provided callback from inside an event handler
   170  */
   127     // for that fake event. If the callback throws, the error is "captured" using
   171 
   128     // a global event handler. But because the error happens in a different
   172 /**
   129     // event loop context, it does not interrupt the normal program flow.
   173  * Ordered list of injected plugins.
   130     // Effectively, this gives us try-catch behavior without actually using
   174  */
   131     // try-catch. Neat!
   175 var plugins = [];
   132     // Check that the browser supports the APIs we need to implement our special
   176 
   133     // DEV version of invokeGuardedCallback
   177 /**
   134     if (typeof window !== 'undefined' && typeof window.dispatchEvent === 'function' && typeof document !== 'undefined' && typeof document.createEvent === 'function') {
   178  * Mapping from event name to dispatch config
   135       var fakeNode = document.createElement('react');
   179  */
   136 
   180 var eventNameDispatchConfigs = {};
   137       var invokeGuardedCallbackDev = function (name, func, context, a, b, c, d, e, f) {
   181 
   138         // If document doesn't exist we know for sure we will crash in this method
   182 /**
   139         // when we call document.createEvent(). However this can cause confusing
   183  * Mapping from registration name to plugin module
   140         // errors: https://github.com/facebookincubator/create-react-app/issues/3482
   184  */
   141         // So we preemptively throw with a better message instead.
   185 var registrationNameModules = {};
       
   186 
       
   187 /**
       
   188  * Mapping from registration name to event name
       
   189  */
       
   190 var registrationNameDependencies = {};
       
   191 
       
   192 /**
       
   193  * Mapping from lowercase registration names to the properly cased version,
       
   194  * used to warn in the case of missing event handlers. Available
       
   195  * only in true.
       
   196  * @type {Object}
       
   197  */
       
   198 var possibleRegistrationNames = {};
       
   199 // Trust the developer to only use possibleRegistrationNames in true
       
   200 
       
   201 /**
       
   202  * Injects an ordering of plugins (by plugin name). This allows the ordering
       
   203  * to be decoupled from injection of the actual plugins so that ordering is
       
   204  * always deterministic regardless of packaging, on-the-fly injection, etc.
       
   205  *
       
   206  * @param {array} InjectedEventPluginOrder
       
   207  * @internal
       
   208  * @see {EventPluginHub.injection.injectEventPluginOrder}
       
   209  */
       
   210 function injectEventPluginOrder(injectedEventPluginOrder) {
       
   211   (function () {
       
   212     if (!!eventPluginOrder) {
       
   213       {
       
   214         throw ReactError(Error('EventPluginRegistry: Cannot inject event plugin ordering more than once. You are likely trying to load more than one copy of React.'));
       
   215       }
       
   216     }
       
   217   })();
       
   218   // Clone the ordering so it cannot be dynamically mutated.
       
   219   eventPluginOrder = Array.prototype.slice.call(injectedEventPluginOrder);
       
   220   recomputePluginOrdering();
       
   221 }
       
   222 
       
   223 /**
       
   224  * Injects plugins to be used by `EventPluginHub`. The plugin names must be
       
   225  * in the ordering injected by `injectEventPluginOrder`.
       
   226  *
       
   227  * Plugins can be injected as part of page initialization or on-the-fly.
       
   228  *
       
   229  * @param {object} injectedNamesToPlugins Map from names to plugin modules.
       
   230  * @internal
       
   231  * @see {EventPluginHub.injection.injectEventPluginsByName}
       
   232  */
       
   233 function injectEventPluginsByName(injectedNamesToPlugins) {
       
   234   var isOrderingDirty = false;
       
   235   for (var pluginName in injectedNamesToPlugins) {
       
   236     if (!injectedNamesToPlugins.hasOwnProperty(pluginName)) {
       
   237       continue;
       
   238     }
       
   239     var pluginModule = injectedNamesToPlugins[pluginName];
       
   240     if (!namesToPlugins.hasOwnProperty(pluginName) || namesToPlugins[pluginName] !== pluginModule) {
       
   241       (function () {
       
   242         if (!!namesToPlugins[pluginName]) {
       
   243           {
       
   244             throw ReactError(Error('EventPluginRegistry: Cannot inject two different event plugins using the same name, `' + pluginName + '`.'));
       
   245           }
       
   246         }
       
   247       })();
       
   248       namesToPlugins[pluginName] = pluginModule;
       
   249       isOrderingDirty = true;
       
   250     }
       
   251   }
       
   252   if (isOrderingDirty) {
       
   253     recomputePluginOrdering();
       
   254   }
       
   255 }
       
   256 
       
   257 var invokeGuardedCallbackImpl = function (name, func, context, a, b, c, d, e, f) {
       
   258   var funcArgs = Array.prototype.slice.call(arguments, 3);
       
   259   try {
       
   260     func.apply(context, funcArgs);
       
   261   } catch (error) {
       
   262     this.onError(error);
       
   263   }
       
   264 };
       
   265 
       
   266 {
       
   267   // In DEV mode, we swap out invokeGuardedCallback for a special version
       
   268   // that plays more nicely with the browser's DevTools. The idea is to preserve
       
   269   // "Pause on exceptions" behavior. Because React wraps all user-provided
       
   270   // functions in invokeGuardedCallback, and the production version of
       
   271   // invokeGuardedCallback uses a try-catch, all user exceptions are treated
       
   272   // like caught exceptions, and the DevTools won't pause unless the developer
       
   273   // takes the extra step of enabling pause on caught exceptions. This is
       
   274   // unintuitive, though, because even though React has caught the error, from
       
   275   // the developer's perspective, the error is uncaught.
       
   276   //
       
   277   // To preserve the expected "Pause on exceptions" behavior, we don't use a
       
   278   // try-catch in DEV. Instead, we synchronously dispatch a fake event to a fake
       
   279   // DOM node, and call the user-provided callback from inside an event handler
       
   280   // for that fake event. If the callback throws, the error is "captured" using
       
   281   // a global event handler. But because the error happens in a different
       
   282   // event loop context, it does not interrupt the normal program flow.
       
   283   // Effectively, this gives us try-catch behavior without actually using
       
   284   // try-catch. Neat!
       
   285 
       
   286   // Check that the browser supports the APIs we need to implement our special
       
   287   // DEV version of invokeGuardedCallback
       
   288   if (typeof window !== 'undefined' && typeof window.dispatchEvent === 'function' && typeof document !== 'undefined' && typeof document.createEvent === 'function') {
       
   289     var fakeNode = document.createElement('react');
       
   290 
       
   291     var invokeGuardedCallbackDev = function (name, func, context, a, b, c, d, e, f) {
       
   292       // If document doesn't exist we know for sure we will crash in this method
       
   293       // when we call document.createEvent(). However this can cause confusing
       
   294       // errors: https://github.com/facebookincubator/create-react-app/issues/3482
       
   295       // So we preemptively throw with a better message instead.
       
   296       (function () {
       
   297         if (!(typeof document !== 'undefined')) {
   142         if (!(typeof document !== 'undefined')) {
   298           {
   143           {
   299             throw ReactError(Error('The `document` global was defined when React was initialized, but is not defined anymore. This can happen in a test environment if a component schedules an update from an asynchronous callback, but the test has already finished running. To solve this, you can either unmount the component at the end of your test (and ensure that any asynchronous operations get canceled in `componentWillUnmount`), or you can change the test itself to be asynchronous.'));
   144             throw Error( "The `document` global was defined when React was initialized, but is not defined anymore. This can happen in a test environment if a component schedules an update from an asynchronous callback, but the test has already finished running. To solve this, you can either unmount the component at the end of your test (and ensure that any asynchronous operations get canceled in `componentWillUnmount`), or you can change the test itself to be asynchronous." );
   300           }
   145           }
   301         }
   146         }
   302       })();
   147 
   303       var evt = document.createEvent('Event');
   148         var evt = document.createEvent('Event'); // Keeps track of whether the user-provided callback threw an error. We
   304 
   149         // set this to true at the beginning, then set it to false right after
   305       // Keeps track of whether the user-provided callback threw an error. We
   150         // calling the function. If the function errors, `didError` will never be
   306       // set this to true at the beginning, then set it to false right after
   151         // set to false. This strategy works even if the browser is flaky and
   307       // calling the function. If the function errors, `didError` will never be
   152         // fails to call our global error handler, because it doesn't rely on
   308       // set to false. This strategy works even if the browser is flaky and
   153         // the error event at all.
   309       // fails to call our global error handler, because it doesn't rely on
   154 
   310       // the error event at all.
   155         var didError = true; // Keeps track of the value of window.event so that we can reset it
   311       var didError = true;
   156         // during the callback to let user code access window.event in the
   312 
   157         // browsers that support it.
   313       // Keeps track of the value of window.event so that we can reset it
   158 
   314       // during the callback to let user code access window.event in the
   159         var windowEvent = window.event; // Keeps track of the descriptor of window.event to restore it after event
   315       // browsers that support it.
   160         // dispatching: https://github.com/facebook/react/issues/13688
   316       var windowEvent = window.event;
   161 
   317 
   162         var windowEventDescriptor = Object.getOwnPropertyDescriptor(window, 'event'); // Create an event handler for our fake event. We will synchronously
   318       // Keeps track of the descriptor of window.event to restore it after event
   163         // dispatch our fake event using `dispatchEvent`. Inside the handler, we
   319       // dispatching: https://github.com/facebook/react/issues/13688
   164         // call the user-provided callback.
   320       var windowEventDescriptor = Object.getOwnPropertyDescriptor(window, 'event');
   165 
   321 
   166         var funcArgs = Array.prototype.slice.call(arguments, 3);
   322       // Create an event handler for our fake event. We will synchronously
   167 
   323       // dispatch our fake event using `dispatchEvent`. Inside the handler, we
   168         function callCallback() {
   324       // call the user-provided callback.
   169           // We immediately remove the callback from event listeners so that
   325       var funcArgs = Array.prototype.slice.call(arguments, 3);
   170           // nested `invokeGuardedCallback` calls do not clash. Otherwise, a
   326       function callCallback() {
   171           // nested call would trigger the fake event handlers of any call higher
   327         // We immediately remove the callback from event listeners so that
   172           // in the stack.
   328         // nested `invokeGuardedCallback` calls do not clash. Otherwise, a
   173           fakeNode.removeEventListener(evtType, callCallback, false); // We check for window.hasOwnProperty('event') to prevent the
   329         // nested call would trigger the fake event handlers of any call higher
   174           // window.event assignment in both IE <= 10 as they throw an error
   330         // in the stack.
   175           // "Member not found" in strict mode, and in Firefox which does not
   331         fakeNode.removeEventListener(evtType, callCallback, false);
   176           // support window.event.
   332 
   177 
   333         // We check for window.hasOwnProperty('event') to prevent the
   178           if (typeof window.event !== 'undefined' && window.hasOwnProperty('event')) {
   334         // window.event assignment in both IE <= 10 as they throw an error
   179             window.event = windowEvent;
   335         // "Member not found" in strict mode, and in Firefox which does not
       
   336         // support window.event.
       
   337         if (typeof window.event !== 'undefined' && window.hasOwnProperty('event')) {
       
   338           window.event = windowEvent;
       
   339         }
       
   340 
       
   341         func.apply(context, funcArgs);
       
   342         didError = false;
       
   343       }
       
   344 
       
   345       // Create a global error event handler. We use this to capture the value
       
   346       // that was thrown. It's possible that this error handler will fire more
       
   347       // than once; for example, if non-React code also calls `dispatchEvent`
       
   348       // and a handler for that event throws. We should be resilient to most of
       
   349       // those cases. Even if our error event handler fires more than once, the
       
   350       // last error event is always used. If the callback actually does error,
       
   351       // we know that the last error event is the correct one, because it's not
       
   352       // possible for anything else to have happened in between our callback
       
   353       // erroring and the code that follows the `dispatchEvent` call below. If
       
   354       // the callback doesn't error, but the error event was fired, we know to
       
   355       // ignore it because `didError` will be false, as described above.
       
   356       var error = void 0;
       
   357       // Use this to track whether the error event is ever called.
       
   358       var didSetError = false;
       
   359       var isCrossOriginError = false;
       
   360 
       
   361       function handleWindowError(event) {
       
   362         error = event.error;
       
   363         didSetError = true;
       
   364         if (error === null && event.colno === 0 && event.lineno === 0) {
       
   365           isCrossOriginError = true;
       
   366         }
       
   367         if (event.defaultPrevented) {
       
   368           // Some other error handler has prevented default.
       
   369           // Browsers silence the error report if this happens.
       
   370           // We'll remember this to later decide whether to log it or not.
       
   371           if (error != null && typeof error === 'object') {
       
   372             try {
       
   373               error._suppressLogging = true;
       
   374             } catch (inner) {
       
   375               // Ignore.
       
   376             }
       
   377           }
   180           }
   378         }
   181 
   379       }
   182           func.apply(context, funcArgs);
   380 
   183           didError = false;
   381       // Create a fake event type.
   184         } // Create a global error event handler. We use this to capture the value
   382       var evtType = 'react-' + (name ? name : 'invokeguardedcallback');
   185         // that was thrown. It's possible that this error handler will fire more
   383 
   186         // than once; for example, if non-React code also calls `dispatchEvent`
   384       // Attach our event handlers
   187         // and a handler for that event throws. We should be resilient to most of
   385       window.addEventListener('error', handleWindowError);
   188         // those cases. Even if our error event handler fires more than once, the
   386       fakeNode.addEventListener(evtType, callCallback, false);
   189         // last error event is always used. If the callback actually does error,
   387 
   190         // we know that the last error event is the correct one, because it's not
   388       // Synchronously dispatch our fake event. If the user-provided function
   191         // possible for anything else to have happened in between our callback
   389       // errors, it will trigger our global error handler.
   192         // erroring and the code that follows the `dispatchEvent` call below. If
   390       evt.initEvent(evtType, false, false);
   193         // the callback doesn't error, but the error event was fired, we know to
   391       fakeNode.dispatchEvent(evt);
   194         // ignore it because `didError` will be false, as described above.
   392 
   195 
   393       if (windowEventDescriptor) {
   196 
   394         Object.defineProperty(window, 'event', windowEventDescriptor);
   197         var error; // Use this to track whether the error event is ever called.
   395       }
   198 
   396 
   199         var didSetError = false;
   397       if (didError) {
   200         var isCrossOriginError = false;
   398         if (!didSetError) {
   201 
   399           // The callback errored, but the error event never fired.
   202         function handleWindowError(event) {
   400           error = new Error('An error was thrown inside one of your components, but React ' + "doesn't know what it was. This is likely due to browser " + 'flakiness. React does its best to preserve the "Pause on ' + 'exceptions" behavior of the DevTools, which requires some ' + "DEV-mode only tricks. It's possible that these don't work in " + 'your browser. Try triggering the error in production mode, ' + 'or switching to a modern browser. If you suspect that this is ' + 'actually an issue with React, please file an issue.');
   203           error = event.error;
   401         } else if (isCrossOriginError) {
   204           didSetError = true;
   402           error = new Error("A cross-origin error was thrown. React doesn't have access to " + 'the actual error object in development. ' + 'See https://fb.me/react-crossorigin-error for more information.');
   205 
   403         }
   206           if (error === null && event.colno === 0 && event.lineno === 0) {
   404         this.onError(error);
   207             isCrossOriginError = true;
   405       }
       
   406 
       
   407       // Remove our event listeners
       
   408       window.removeEventListener('error', handleWindowError);
       
   409     };
       
   410 
       
   411     invokeGuardedCallbackImpl = invokeGuardedCallbackDev;
       
   412   }
       
   413 }
       
   414 
       
   415 var invokeGuardedCallbackImpl$1 = invokeGuardedCallbackImpl;
       
   416 
       
   417 // Used by Fiber to simulate a try-catch.
       
   418 var hasError = false;
       
   419 var caughtError = null;
       
   420 
       
   421 // Used by event system to capture/rethrow the first error.
       
   422 var hasRethrowError = false;
       
   423 var rethrowError = null;
       
   424 
       
   425 var reporter = {
       
   426   onError: function (error) {
       
   427     hasError = true;
       
   428     caughtError = error;
       
   429   }
       
   430 };
       
   431 
       
   432 /**
       
   433  * Call a function while guarding against errors that happens within it.
       
   434  * Returns an error if it throws, otherwise null.
       
   435  *
       
   436  * In production, this is implemented using a try-catch. The reason we don't
       
   437  * use a try-catch directly is so that we can swap out a different
       
   438  * implementation in DEV mode.
       
   439  *
       
   440  * @param {String} name of the guard to use for logging or debugging
       
   441  * @param {Function} func The function to invoke
       
   442  * @param {*} context The context to use when calling the function
       
   443  * @param {...*} args Arguments for function
       
   444  */
       
   445 function invokeGuardedCallback(name, func, context, a, b, c, d, e, f) {
       
   446   hasError = false;
       
   447   caughtError = null;
       
   448   invokeGuardedCallbackImpl$1.apply(reporter, arguments);
       
   449 }
       
   450 
       
   451 /**
       
   452  * Same as invokeGuardedCallback, but instead of returning an error, it stores
       
   453  * it in a global so it can be rethrown by `rethrowCaughtError` later.
       
   454  * TODO: See if caughtError and rethrowError can be unified.
       
   455  *
       
   456  * @param {String} name of the guard to use for logging or debugging
       
   457  * @param {Function} func The function to invoke
       
   458  * @param {*} context The context to use when calling the function
       
   459  * @param {...*} args Arguments for function
       
   460  */
       
   461 function invokeGuardedCallbackAndCatchFirstError(name, func, context, a, b, c, d, e, f) {
       
   462   invokeGuardedCallback.apply(this, arguments);
       
   463   if (hasError) {
       
   464     var error = clearCaughtError();
       
   465     if (!hasRethrowError) {
       
   466       hasRethrowError = true;
       
   467       rethrowError = error;
       
   468     }
       
   469   }
       
   470 }
       
   471 
       
   472 /**
       
   473  * During execution of guarded functions we will capture the first error which
       
   474  * we will rethrow to be handled by the top level error handler.
       
   475  */
       
   476 function rethrowCaughtError() {
       
   477   if (hasRethrowError) {
       
   478     var error = rethrowError;
       
   479     hasRethrowError = false;
       
   480     rethrowError = null;
       
   481     throw error;
       
   482   }
       
   483 }
       
   484 
       
   485 function hasCaughtError() {
       
   486   return hasError;
       
   487 }
       
   488 
       
   489 function clearCaughtError() {
       
   490   if (hasError) {
       
   491     var error = caughtError;
       
   492     hasError = false;
       
   493     caughtError = null;
       
   494     return error;
       
   495   } else {
       
   496     (function () {
       
   497       {
       
   498         {
       
   499           throw ReactError(Error('clearCaughtError was called but no error was captured. This error is likely caused by a bug in React. Please file an issue.'));
       
   500         }
       
   501       }
       
   502     })();
       
   503   }
       
   504 }
       
   505 
       
   506 /**
       
   507  * Similar to invariant but only logs a warning if the condition is not met.
       
   508  * This can be used to log issues in development environments in critical
       
   509  * paths. Removing the logging code for production environments will keep the
       
   510  * same logic and follow the same code paths.
       
   511  */
       
   512 
       
   513 var warningWithoutStack = function () {};
       
   514 
       
   515 {
       
   516   warningWithoutStack = function (condition, format) {
       
   517     for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
       
   518       args[_key - 2] = arguments[_key];
       
   519     }
       
   520 
       
   521     if (format === undefined) {
       
   522       throw new Error('`warningWithoutStack(condition, format, ...args)` requires a warning ' + 'message argument');
       
   523     }
       
   524     if (args.length > 8) {
       
   525       // Check before the condition to catch violations early.
       
   526       throw new Error('warningWithoutStack() currently supports at most 8 arguments.');
       
   527     }
       
   528     if (condition) {
       
   529       return;
       
   530     }
       
   531     if (typeof console !== 'undefined') {
       
   532       var argsWithFormat = args.map(function (item) {
       
   533         return '' + item;
       
   534       });
       
   535       argsWithFormat.unshift('Warning: ' + format);
       
   536 
       
   537       // We intentionally don't use spread (or .apply) directly because it
       
   538       // breaks IE9: https://github.com/facebook/react/issues/13610
       
   539       Function.prototype.apply.call(console.error, console, argsWithFormat);
       
   540     }
       
   541     try {
       
   542       // --- Welcome to debugging React ---
       
   543       // This error was thrown as a convenience so that you can use this stack
       
   544       // to find the callsite that caused this warning to fire.
       
   545       var argIndex = 0;
       
   546       var message = 'Warning: ' + format.replace(/%s/g, function () {
       
   547         return args[argIndex++];
       
   548       });
       
   549       throw new Error(message);
       
   550     } catch (x) {}
       
   551   };
       
   552 }
       
   553 
       
   554 var warningWithoutStack$1 = warningWithoutStack;
       
   555 
       
   556 var getFiberCurrentPropsFromNode = null;
       
   557 var getInstanceFromNode = null;
       
   558 var getNodeFromInstance = null;
       
   559 
       
   560 function setComponentTree(getFiberCurrentPropsFromNodeImpl, getInstanceFromNodeImpl, getNodeFromInstanceImpl) {
       
   561   getFiberCurrentPropsFromNode = getFiberCurrentPropsFromNodeImpl;
       
   562   getInstanceFromNode = getInstanceFromNodeImpl;
       
   563   getNodeFromInstance = getNodeFromInstanceImpl;
       
   564   {
       
   565     !(getNodeFromInstance && getInstanceFromNode) ? warningWithoutStack$1(false, 'EventPluginUtils.setComponentTree(...): Injected ' + 'module is missing getNodeFromInstance or getInstanceFromNode.') : void 0;
       
   566   }
       
   567 }
       
   568 
       
   569 var validateEventDispatches = void 0;
       
   570 {
       
   571   validateEventDispatches = function (event) {
       
   572     var dispatchListeners = event._dispatchListeners;
       
   573     var dispatchInstances = event._dispatchInstances;
       
   574 
       
   575     var listenersIsArr = Array.isArray(dispatchListeners);
       
   576     var listenersLen = listenersIsArr ? dispatchListeners.length : dispatchListeners ? 1 : 0;
       
   577 
       
   578     var instancesIsArr = Array.isArray(dispatchInstances);
       
   579     var instancesLen = instancesIsArr ? dispatchInstances.length : dispatchInstances ? 1 : 0;
       
   580 
       
   581     !(instancesIsArr === listenersIsArr && instancesLen === listenersLen) ? warningWithoutStack$1(false, 'EventPluginUtils: Invalid `event`.') : void 0;
       
   582   };
       
   583 }
       
   584 
       
   585 /**
       
   586  * Dispatch the event to the listener.
       
   587  * @param {SyntheticEvent} event SyntheticEvent to handle
       
   588  * @param {function} listener Application-level callback
       
   589  * @param {*} inst Internal component instance
       
   590  */
       
   591 function executeDispatch(event, listener, inst) {
       
   592   var type = event.type || 'unknown-event';
       
   593   event.currentTarget = getNodeFromInstance(inst);
       
   594   invokeGuardedCallbackAndCatchFirstError(type, listener, undefined, event);
       
   595   event.currentTarget = null;
       
   596 }
       
   597 
       
   598 /**
       
   599  * Standard/simple iteration through an event's collected dispatches.
       
   600  */
       
   601 function executeDispatchesInOrder(event) {
       
   602   var dispatchListeners = event._dispatchListeners;
       
   603   var dispatchInstances = event._dispatchInstances;
       
   604   {
       
   605     validateEventDispatches(event);
       
   606   }
       
   607   if (Array.isArray(dispatchListeners)) {
       
   608     for (var i = 0; i < dispatchListeners.length; i++) {
       
   609       if (event.isPropagationStopped()) {
       
   610         break;
       
   611       }
       
   612       // Listeners and Instances are two parallel arrays that are always in sync.
       
   613       executeDispatch(event, dispatchListeners[i], dispatchInstances[i]);
       
   614     }
       
   615   } else if (dispatchListeners) {
       
   616     executeDispatch(event, dispatchListeners, dispatchInstances);
       
   617   }
       
   618   event._dispatchListeners = null;
       
   619   event._dispatchInstances = null;
       
   620 }
       
   621 
       
   622 /**
       
   623  * @see executeDispatchesInOrderStopAtTrueImpl
       
   624  */
       
   625 
       
   626 
       
   627 /**
       
   628  * Execution of a "direct" dispatch - there must be at most one dispatch
       
   629  * accumulated on the event or it is considered an error. It doesn't really make
       
   630  * sense for an event with multiple dispatches (bubbled) to keep track of the
       
   631  * return values at each dispatch execution, but it does tend to make sense when
       
   632  * dealing with "direct" dispatches.
       
   633  *
       
   634  * @return {*} The return value of executing the single dispatch.
       
   635  */
       
   636 
       
   637 
       
   638 /**
       
   639  * @param {SyntheticEvent} event
       
   640  * @return {boolean} True iff number of dispatches accumulated is greater than 0.
       
   641  */
       
   642 
       
   643 /**
       
   644  * Accumulates items that must not be null or undefined into the first one. This
       
   645  * is used to conserve memory by avoiding array allocations, and thus sacrifices
       
   646  * API cleanness. Since `current` can be null before being passed in and not
       
   647  * null after this function, make sure to assign it back to `current`:
       
   648  *
       
   649  * `a = accumulateInto(a, b);`
       
   650  *
       
   651  * This API should be sparingly used. Try `accumulate` for something cleaner.
       
   652  *
       
   653  * @return {*|array<*>} An accumulation of items.
       
   654  */
       
   655 
       
   656 function accumulateInto(current, next) {
       
   657   (function () {
       
   658     if (!(next != null)) {
       
   659       {
       
   660         throw ReactError(Error('accumulateInto(...): Accumulated items must not be null or undefined.'));
       
   661       }
       
   662     }
       
   663   })();
       
   664 
       
   665   if (current == null) {
       
   666     return next;
       
   667   }
       
   668 
       
   669   // Both are not empty. Warning: Never call x.concat(y) when you are not
       
   670   // certain that x is an Array (x could be a string with concat method).
       
   671   if (Array.isArray(current)) {
       
   672     if (Array.isArray(next)) {
       
   673       current.push.apply(current, next);
       
   674       return current;
       
   675     }
       
   676     current.push(next);
       
   677     return current;
       
   678   }
       
   679 
       
   680   if (Array.isArray(next)) {
       
   681     // A bit too dangerous to mutate `next`.
       
   682     return [current].concat(next);
       
   683   }
       
   684 
       
   685   return [current, next];
       
   686 }
       
   687 
       
   688 /**
       
   689  * @param {array} arr an "accumulation" of items which is either an Array or
       
   690  * a single item. Useful when paired with the `accumulate` module. This is a
       
   691  * simple utility that allows us to reason about a collection of items, but
       
   692  * handling the case when there is exactly one item (and we do not need to
       
   693  * allocate an array).
       
   694  * @param {function} cb Callback invoked with each element or a collection.
       
   695  * @param {?} [scope] Scope used as `this` in a callback.
       
   696  */
       
   697 function forEachAccumulated(arr, cb, scope) {
       
   698   if (Array.isArray(arr)) {
       
   699     arr.forEach(cb, scope);
       
   700   } else if (arr) {
       
   701     cb.call(scope, arr);
       
   702   }
       
   703 }
       
   704 
       
   705 /**
       
   706  * Internal queue of events that have accumulated their dispatches and are
       
   707  * waiting to have their dispatches executed.
       
   708  */
       
   709 var eventQueue = null;
       
   710 
       
   711 /**
       
   712  * Dispatches an event and releases it back into the pool, unless persistent.
       
   713  *
       
   714  * @param {?object} event Synthetic event to be dispatched.
       
   715  * @private
       
   716  */
       
   717 var executeDispatchesAndRelease = function (event) {
       
   718   if (event) {
       
   719     executeDispatchesInOrder(event);
       
   720 
       
   721     if (!event.isPersistent()) {
       
   722       event.constructor.release(event);
       
   723     }
       
   724   }
       
   725 };
       
   726 var executeDispatchesAndReleaseTopLevel = function (e) {
       
   727   return executeDispatchesAndRelease(e);
       
   728 };
       
   729 
       
   730 function runEventsInBatch(events) {
       
   731   if (events !== null) {
       
   732     eventQueue = accumulateInto(eventQueue, events);
       
   733   }
       
   734 
       
   735   // Set `eventQueue` to null before processing it so that we can tell if more
       
   736   // events get enqueued while processing.
       
   737   var processingEventQueue = eventQueue;
       
   738   eventQueue = null;
       
   739 
       
   740   if (!processingEventQueue) {
       
   741     return;
       
   742   }
       
   743 
       
   744   forEachAccumulated(processingEventQueue, executeDispatchesAndReleaseTopLevel);
       
   745   (function () {
       
   746     if (!!eventQueue) {
       
   747       {
       
   748         throw ReactError(Error('processEventQueue(): Additional events were enqueued while processing an event queue. Support for this has not yet been implemented.'));
       
   749       }
       
   750     }
       
   751   })();
       
   752   // This would be a good time to rethrow if any of the event handlers threw.
       
   753   rethrowCaughtError();
       
   754 }
       
   755 
       
   756 function isInteractive(tag) {
       
   757   return tag === 'button' || tag === 'input' || tag === 'select' || tag === 'textarea';
       
   758 }
       
   759 
       
   760 function shouldPreventMouseEvent(name, type, props) {
       
   761   switch (name) {
       
   762     case 'onClick':
       
   763     case 'onClickCapture':
       
   764     case 'onDoubleClick':
       
   765     case 'onDoubleClickCapture':
       
   766     case 'onMouseDown':
       
   767     case 'onMouseDownCapture':
       
   768     case 'onMouseMove':
       
   769     case 'onMouseMoveCapture':
       
   770     case 'onMouseUp':
       
   771     case 'onMouseUpCapture':
       
   772       return !!(props.disabled && isInteractive(type));
       
   773     default:
       
   774       return false;
       
   775   }
       
   776 }
       
   777 
       
   778 /**
       
   779  * This is a unified interface for event plugins to be installed and configured.
       
   780  *
       
   781  * Event plugins can implement the following properties:
       
   782  *
       
   783  *   `extractEvents` {function(string, DOMEventTarget, string, object): *}
       
   784  *     Required. When a top-level event is fired, this method is expected to
       
   785  *     extract synthetic events that will in turn be queued and dispatched.
       
   786  *
       
   787  *   `eventTypes` {object}
       
   788  *     Optional, plugins that fire events must publish a mapping of registration
       
   789  *     names that are used to register listeners. Values of this mapping must
       
   790  *     be objects that contain `registrationName` or `phasedRegistrationNames`.
       
   791  *
       
   792  *   `executeDispatch` {function(object, function, string)}
       
   793  *     Optional, allows plugins to override how an event gets dispatched. By
       
   794  *     default, the listener is simply invoked.
       
   795  *
       
   796  * Each plugin that is injected into `EventsPluginHub` is immediately operable.
       
   797  *
       
   798  * @public
       
   799  */
       
   800 
       
   801 /**
       
   802  * Methods for injecting dependencies.
       
   803  */
       
   804 var injection = {
       
   805   /**
       
   806    * @param {array} InjectedEventPluginOrder
       
   807    * @public
       
   808    */
       
   809   injectEventPluginOrder: injectEventPluginOrder,
       
   810 
       
   811   /**
       
   812    * @param {object} injectedNamesToPlugins Map from names to plugin modules.
       
   813    */
       
   814   injectEventPluginsByName: injectEventPluginsByName
       
   815 };
       
   816 
       
   817 /**
       
   818  * @param {object} inst The instance, which is the source of events.
       
   819  * @param {string} registrationName Name of listener (e.g. `onClick`).
       
   820  * @return {?function} The stored callback.
       
   821  */
       
   822 function getListener(inst, registrationName) {
       
   823   var listener = void 0;
       
   824 
       
   825   // TODO: shouldPreventMouseEvent is DOM-specific and definitely should not
       
   826   // live here; needs to be moved to a better place soon
       
   827   var stateNode = inst.stateNode;
       
   828   if (!stateNode) {
       
   829     // Work in progress (ex: onload events in incremental mode).
       
   830     return null;
       
   831   }
       
   832   var props = getFiberCurrentPropsFromNode(stateNode);
       
   833   if (!props) {
       
   834     // Work in progress.
       
   835     return null;
       
   836   }
       
   837   listener = props[registrationName];
       
   838   if (shouldPreventMouseEvent(registrationName, inst.type, props)) {
       
   839     return null;
       
   840   }
       
   841   (function () {
       
   842     if (!(!listener || typeof listener === 'function')) {
       
   843       {
       
   844         throw ReactError(Error('Expected `' + registrationName + '` listener to be a function, instead got a value of `' + typeof listener + '` type.'));
       
   845       }
       
   846     }
       
   847   })();
       
   848   return listener;
       
   849 }
       
   850 
       
   851 /**
       
   852  * Allows registered plugins an opportunity to extract events from top-level
       
   853  * native browser events.
       
   854  *
       
   855  * @return {*} An accumulation of synthetic events.
       
   856  * @internal
       
   857  */
       
   858 function extractPluginEvents(topLevelType, targetInst, nativeEvent, nativeEventTarget) {
       
   859   var events = null;
       
   860   for (var i = 0; i < plugins.length; i++) {
       
   861     // Not every plugin in the ordering may be loaded at runtime.
       
   862     var possiblePlugin = plugins[i];
       
   863     if (possiblePlugin) {
       
   864       var extractedEvents = possiblePlugin.extractEvents(topLevelType, targetInst, nativeEvent, nativeEventTarget);
       
   865       if (extractedEvents) {
       
   866         events = accumulateInto(events, extractedEvents);
       
   867       }
       
   868     }
       
   869   }
       
   870   return events;
       
   871 }
       
   872 
       
   873 function runExtractedPluginEventsInBatch(topLevelType, targetInst, nativeEvent, nativeEventTarget) {
       
   874   var events = extractPluginEvents(topLevelType, targetInst, nativeEvent, nativeEventTarget);
       
   875   runEventsInBatch(events);
       
   876 }
       
   877 
       
   878 var FunctionComponent = 0;
       
   879 var ClassComponent = 1;
       
   880 var IndeterminateComponent = 2; // Before we know whether it is function or class
       
   881 var HostRoot = 3; // Root of a host tree. Could be nested inside another node.
       
   882 var HostPortal = 4; // A subtree. Could be an entry point to a different renderer.
       
   883 var HostComponent = 5;
       
   884 var HostText = 6;
       
   885 var Fragment = 7;
       
   886 var Mode = 8;
       
   887 var ContextConsumer = 9;
       
   888 var ContextProvider = 10;
       
   889 var ForwardRef = 11;
       
   890 var Profiler = 12;
       
   891 var SuspenseComponent = 13;
       
   892 var MemoComponent = 14;
       
   893 var SimpleMemoComponent = 15;
       
   894 var LazyComponent = 16;
       
   895 var IncompleteClassComponent = 17;
       
   896 var DehydratedSuspenseComponent = 18;
       
   897 var SuspenseListComponent = 19;
       
   898 var FundamentalComponent = 20;
       
   899 
       
   900 var randomKey = Math.random().toString(36).slice(2);
       
   901 var internalInstanceKey = '__reactInternalInstance$' + randomKey;
       
   902 var internalEventHandlersKey = '__reactEventHandlers$' + randomKey;
       
   903 
       
   904 function precacheFiberNode(hostInst, node) {
       
   905   node[internalInstanceKey] = hostInst;
       
   906 }
       
   907 
       
   908 /**
       
   909  * Given a DOM node, return the closest ReactDOMComponent or
       
   910  * ReactDOMTextComponent instance ancestor.
       
   911  */
       
   912 function getClosestInstanceFromNode(node) {
       
   913   if (node[internalInstanceKey]) {
       
   914     return node[internalInstanceKey];
       
   915   }
       
   916 
       
   917   while (!node[internalInstanceKey]) {
       
   918     if (node.parentNode) {
       
   919       node = node.parentNode;
       
   920     } else {
       
   921       // Top of the tree. This node must not be part of a React tree (or is
       
   922       // unmounted, potentially).
       
   923       return null;
       
   924     }
       
   925   }
       
   926 
       
   927   var inst = node[internalInstanceKey];
       
   928   if (inst.tag === HostComponent || inst.tag === HostText) {
       
   929     // In Fiber, this will always be the deepest root.
       
   930     return inst;
       
   931   }
       
   932 
       
   933   return null;
       
   934 }
       
   935 
       
   936 /**
       
   937  * Given a DOM node, return the ReactDOMComponent or ReactDOMTextComponent
       
   938  * instance, or null if the node was not rendered by this React.
       
   939  */
       
   940 function getInstanceFromNode$1(node) {
       
   941   var inst = node[internalInstanceKey];
       
   942   if (inst) {
       
   943     if (inst.tag === HostComponent || inst.tag === HostText) {
       
   944       return inst;
       
   945     } else {
       
   946       return null;
       
   947     }
       
   948   }
       
   949   return null;
       
   950 }
       
   951 
       
   952 /**
       
   953  * Given a ReactDOMComponent or ReactDOMTextComponent, return the corresponding
       
   954  * DOM node.
       
   955  */
       
   956 function getNodeFromInstance$1(inst) {
       
   957   if (inst.tag === HostComponent || inst.tag === HostText) {
       
   958     // In Fiber this, is just the state node right now. We assume it will be
       
   959     // a host component or host text.
       
   960     return inst.stateNode;
       
   961   }
       
   962 
       
   963   // Without this first invariant, passing a non-DOM-component triggers the next
       
   964   // invariant for a missing parent, which is super confusing.
       
   965   (function () {
       
   966     {
       
   967       {
       
   968         throw ReactError(Error('getNodeFromInstance: Invalid argument.'));
       
   969       }
       
   970     }
       
   971   })();
       
   972 }
       
   973 
       
   974 function getFiberCurrentPropsFromNode$1(node) {
       
   975   return node[internalEventHandlersKey] || null;
       
   976 }
       
   977 
       
   978 function updateFiberProps(node, props) {
       
   979   node[internalEventHandlersKey] = props;
       
   980 }
       
   981 
       
   982 function getParent(inst) {
       
   983   do {
       
   984     inst = inst.return;
       
   985     // TODO: If this is a HostRoot we might want to bail out.
       
   986     // That is depending on if we want nested subtrees (layers) to bubble
       
   987     // events to their parent. We could also go through parentNode on the
       
   988     // host node but that wouldn't work for React Native and doesn't let us
       
   989     // do the portal feature.
       
   990   } while (inst && inst.tag !== HostComponent);
       
   991   if (inst) {
       
   992     return inst;
       
   993   }
       
   994   return null;
       
   995 }
       
   996 
       
   997 /**
       
   998  * Return the lowest common ancestor of A and B, or null if they are in
       
   999  * different trees.
       
  1000  */
       
  1001 function getLowestCommonAncestor(instA, instB) {
       
  1002   var depthA = 0;
       
  1003   for (var tempA = instA; tempA; tempA = getParent(tempA)) {
       
  1004     depthA++;
       
  1005   }
       
  1006   var depthB = 0;
       
  1007   for (var tempB = instB; tempB; tempB = getParent(tempB)) {
       
  1008     depthB++;
       
  1009   }
       
  1010 
       
  1011   // If A is deeper, crawl up.
       
  1012   while (depthA - depthB > 0) {
       
  1013     instA = getParent(instA);
       
  1014     depthA--;
       
  1015   }
       
  1016 
       
  1017   // If B is deeper, crawl up.
       
  1018   while (depthB - depthA > 0) {
       
  1019     instB = getParent(instB);
       
  1020     depthB--;
       
  1021   }
       
  1022 
       
  1023   // Walk in lockstep until we find a match.
       
  1024   var depth = depthA;
       
  1025   while (depth--) {
       
  1026     if (instA === instB || instA === instB.alternate) {
       
  1027       return instA;
       
  1028     }
       
  1029     instA = getParent(instA);
       
  1030     instB = getParent(instB);
       
  1031   }
       
  1032   return null;
       
  1033 }
       
  1034 
       
  1035 /**
       
  1036  * Return if A is an ancestor of B.
       
  1037  */
       
  1038 
       
  1039 
       
  1040 /**
       
  1041  * Return the parent instance of the passed-in instance.
       
  1042  */
       
  1043 
       
  1044 
       
  1045 /**
       
  1046  * Simulates the traversal of a two-phase, capture/bubble event dispatch.
       
  1047  */
       
  1048 function traverseTwoPhase(inst, fn, arg) {
       
  1049   var path = [];
       
  1050   while (inst) {
       
  1051     path.push(inst);
       
  1052     inst = getParent(inst);
       
  1053   }
       
  1054   var i = void 0;
       
  1055   for (i = path.length; i-- > 0;) {
       
  1056     fn(path[i], 'captured', arg);
       
  1057   }
       
  1058   for (i = 0; i < path.length; i++) {
       
  1059     fn(path[i], 'bubbled', arg);
       
  1060   }
       
  1061 }
       
  1062 
       
  1063 /**
       
  1064  * Traverses the ID hierarchy and invokes the supplied `cb` on any IDs that
       
  1065  * should would receive a `mouseEnter` or `mouseLeave` event.
       
  1066  *
       
  1067  * Does not invoke the callback on the nearest common ancestor because nothing
       
  1068  * "entered" or "left" that element.
       
  1069  */
       
  1070 function traverseEnterLeave(from, to, fn, argFrom, argTo) {
       
  1071   var common = from && to ? getLowestCommonAncestor(from, to) : null;
       
  1072   var pathFrom = [];
       
  1073   while (true) {
       
  1074     if (!from) {
       
  1075       break;
       
  1076     }
       
  1077     if (from === common) {
       
  1078       break;
       
  1079     }
       
  1080     var alternate = from.alternate;
       
  1081     if (alternate !== null && alternate === common) {
       
  1082       break;
       
  1083     }
       
  1084     pathFrom.push(from);
       
  1085     from = getParent(from);
       
  1086   }
       
  1087   var pathTo = [];
       
  1088   while (true) {
       
  1089     if (!to) {
       
  1090       break;
       
  1091     }
       
  1092     if (to === common) {
       
  1093       break;
       
  1094     }
       
  1095     var _alternate = to.alternate;
       
  1096     if (_alternate !== null && _alternate === common) {
       
  1097       break;
       
  1098     }
       
  1099     pathTo.push(to);
       
  1100     to = getParent(to);
       
  1101   }
       
  1102   for (var i = 0; i < pathFrom.length; i++) {
       
  1103     fn(pathFrom[i], 'bubbled', argFrom);
       
  1104   }
       
  1105   for (var _i = pathTo.length; _i-- > 0;) {
       
  1106     fn(pathTo[_i], 'captured', argTo);
       
  1107   }
       
  1108 }
       
  1109 
       
  1110 /**
       
  1111  * Some event types have a notion of different registration names for different
       
  1112  * "phases" of propagation. This finds listeners by a given phase.
       
  1113  */
       
  1114 function listenerAtPhase(inst, event, propagationPhase) {
       
  1115   var registrationName = event.dispatchConfig.phasedRegistrationNames[propagationPhase];
       
  1116   return getListener(inst, registrationName);
       
  1117 }
       
  1118 
       
  1119 /**
       
  1120  * A small set of propagation patterns, each of which will accept a small amount
       
  1121  * of information, and generate a set of "dispatch ready event objects" - which
       
  1122  * are sets of events that have already been annotated with a set of dispatched
       
  1123  * listener functions/ids. The API is designed this way to discourage these
       
  1124  * propagation strategies from actually executing the dispatches, since we
       
  1125  * always want to collect the entire set of dispatches before executing even a
       
  1126  * single one.
       
  1127  */
       
  1128 
       
  1129 /**
       
  1130  * Tags a `SyntheticEvent` with dispatched listeners. Creating this function
       
  1131  * here, allows us to not have to bind or create functions for each event.
       
  1132  * Mutating the event's members allows us to not have to create a wrapping
       
  1133  * "dispatch" object that pairs the event with the listener.
       
  1134  */
       
  1135 function accumulateDirectionalDispatches(inst, phase, event) {
       
  1136   {
       
  1137     !inst ? warningWithoutStack$1(false, 'Dispatching inst must not be null') : void 0;
       
  1138   }
       
  1139   var listener = listenerAtPhase(inst, event, phase);
       
  1140   if (listener) {
       
  1141     event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);
       
  1142     event._dispatchInstances = accumulateInto(event._dispatchInstances, inst);
       
  1143   }
       
  1144 }
       
  1145 
       
  1146 /**
       
  1147  * Collect dispatches (must be entirely collected before dispatching - see unit
       
  1148  * tests). Lazily allocate the array to conserve memory.  We must loop through
       
  1149  * each event and perform the traversal for each one. We cannot perform a
       
  1150  * single traversal for the entire collection of events because each event may
       
  1151  * have a different target.
       
  1152  */
       
  1153 function accumulateTwoPhaseDispatchesSingle(event) {
       
  1154   if (event && event.dispatchConfig.phasedRegistrationNames) {
       
  1155     traverseTwoPhase(event._targetInst, accumulateDirectionalDispatches, event);
       
  1156   }
       
  1157 }
       
  1158 
       
  1159 /**
       
  1160  * Accumulates without regard to direction, does not look for phased
       
  1161  * registration names. Same as `accumulateDirectDispatchesSingle` but without
       
  1162  * requiring that the `dispatchMarker` be the same as the dispatched ID.
       
  1163  */
       
  1164 function accumulateDispatches(inst, ignoredDirection, event) {
       
  1165   if (inst && event && event.dispatchConfig.registrationName) {
       
  1166     var registrationName = event.dispatchConfig.registrationName;
       
  1167     var listener = getListener(inst, registrationName);
       
  1168     if (listener) {
       
  1169       event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);
       
  1170       event._dispatchInstances = accumulateInto(event._dispatchInstances, inst);
       
  1171     }
       
  1172   }
       
  1173 }
       
  1174 
       
  1175 /**
       
  1176  * Accumulates dispatches on an `SyntheticEvent`, but only for the
       
  1177  * `dispatchMarker`.
       
  1178  * @param {SyntheticEvent} event
       
  1179  */
       
  1180 function accumulateDirectDispatchesSingle(event) {
       
  1181   if (event && event.dispatchConfig.registrationName) {
       
  1182     accumulateDispatches(event._targetInst, null, event);
       
  1183   }
       
  1184 }
       
  1185 
       
  1186 function accumulateTwoPhaseDispatches(events) {
       
  1187   forEachAccumulated(events, accumulateTwoPhaseDispatchesSingle);
       
  1188 }
       
  1189 
       
  1190 
       
  1191 
       
  1192 function accumulateEnterLeaveDispatches(leave, enter, from, to) {
       
  1193   traverseEnterLeave(from, to, accumulateDispatches, leave, enter);
       
  1194 }
       
  1195 
       
  1196 function accumulateDirectDispatches(events) {
       
  1197   forEachAccumulated(events, accumulateDirectDispatchesSingle);
       
  1198 }
       
  1199 
       
  1200 var canUseDOM = !!(typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined');
       
  1201 
       
  1202 // Do not use the below two methods directly!
       
  1203 // Instead use constants exported from DOMTopLevelEventTypes in ReactDOM.
       
  1204 // (It is the only module that is allowed to access these methods.)
       
  1205 
       
  1206 function unsafeCastStringToDOMTopLevelType(topLevelType) {
       
  1207   return topLevelType;
       
  1208 }
       
  1209 
       
  1210 function unsafeCastDOMTopLevelTypeToString(topLevelType) {
       
  1211   return topLevelType;
       
  1212 }
       
  1213 
       
  1214 /**
       
  1215  * Generate a mapping of standard vendor prefixes using the defined style property and event name.
       
  1216  *
       
  1217  * @param {string} styleProp
       
  1218  * @param {string} eventName
       
  1219  * @returns {object}
       
  1220  */
       
  1221 function makePrefixMap(styleProp, eventName) {
       
  1222   var prefixes = {};
       
  1223 
       
  1224   prefixes[styleProp.toLowerCase()] = eventName.toLowerCase();
       
  1225   prefixes['Webkit' + styleProp] = 'webkit' + eventName;
       
  1226   prefixes['Moz' + styleProp] = 'moz' + eventName;
       
  1227 
       
  1228   return prefixes;
       
  1229 }
       
  1230 
       
  1231 /**
       
  1232  * A list of event names to a configurable list of vendor prefixes.
       
  1233  */
       
  1234 var vendorPrefixes = {
       
  1235   animationend: makePrefixMap('Animation', 'AnimationEnd'),
       
  1236   animationiteration: makePrefixMap('Animation', 'AnimationIteration'),
       
  1237   animationstart: makePrefixMap('Animation', 'AnimationStart'),
       
  1238   transitionend: makePrefixMap('Transition', 'TransitionEnd')
       
  1239 };
       
  1240 
       
  1241 /**
       
  1242  * Event names that have already been detected and prefixed (if applicable).
       
  1243  */
       
  1244 var prefixedEventNames = {};
       
  1245 
       
  1246 /**
       
  1247  * Element to check for prefixes on.
       
  1248  */
       
  1249 var style = {};
       
  1250 
       
  1251 /**
       
  1252  * Bootstrap if a DOM exists.
       
  1253  */
       
  1254 if (canUseDOM) {
       
  1255   style = document.createElement('div').style;
       
  1256 
       
  1257   // On some platforms, in particular some releases of Android 4.x,
       
  1258   // the un-prefixed "animation" and "transition" properties are defined on the
       
  1259   // style object but the events that fire will still be prefixed, so we need
       
  1260   // to check if the un-prefixed events are usable, and if not remove them from the map.
       
  1261   if (!('AnimationEvent' in window)) {
       
  1262     delete vendorPrefixes.animationend.animation;
       
  1263     delete vendorPrefixes.animationiteration.animation;
       
  1264     delete vendorPrefixes.animationstart.animation;
       
  1265   }
       
  1266 
       
  1267   // Same as above
       
  1268   if (!('TransitionEvent' in window)) {
       
  1269     delete vendorPrefixes.transitionend.transition;
       
  1270   }
       
  1271 }
       
  1272 
       
  1273 /**
       
  1274  * Attempts to determine the correct vendor prefixed event name.
       
  1275  *
       
  1276  * @param {string} eventName
       
  1277  * @returns {string}
       
  1278  */
       
  1279 function getVendorPrefixedEventName(eventName) {
       
  1280   if (prefixedEventNames[eventName]) {
       
  1281     return prefixedEventNames[eventName];
       
  1282   } else if (!vendorPrefixes[eventName]) {
       
  1283     return eventName;
       
  1284   }
       
  1285 
       
  1286   var prefixMap = vendorPrefixes[eventName];
       
  1287 
       
  1288   for (var styleProp in prefixMap) {
       
  1289     if (prefixMap.hasOwnProperty(styleProp) && styleProp in style) {
       
  1290       return prefixedEventNames[eventName] = prefixMap[styleProp];
       
  1291     }
       
  1292   }
       
  1293 
       
  1294   return eventName;
       
  1295 }
       
  1296 
       
  1297 /**
       
  1298  * To identify top level events in ReactDOM, we use constants defined by this
       
  1299  * module. This is the only module that uses the unsafe* methods to express
       
  1300  * that the constants actually correspond to the browser event names. This lets
       
  1301  * us save some bundle size by avoiding a top level type -> event name map.
       
  1302  * The rest of ReactDOM code should import top level types from this file.
       
  1303  */
       
  1304 var TOP_ABORT = unsafeCastStringToDOMTopLevelType('abort');
       
  1305 var TOP_ANIMATION_END = unsafeCastStringToDOMTopLevelType(getVendorPrefixedEventName('animationend'));
       
  1306 var TOP_ANIMATION_ITERATION = unsafeCastStringToDOMTopLevelType(getVendorPrefixedEventName('animationiteration'));
       
  1307 var TOP_ANIMATION_START = unsafeCastStringToDOMTopLevelType(getVendorPrefixedEventName('animationstart'));
       
  1308 var TOP_BLUR = unsafeCastStringToDOMTopLevelType('blur');
       
  1309 var TOP_CAN_PLAY = unsafeCastStringToDOMTopLevelType('canplay');
       
  1310 var TOP_CAN_PLAY_THROUGH = unsafeCastStringToDOMTopLevelType('canplaythrough');
       
  1311 var TOP_CANCEL = unsafeCastStringToDOMTopLevelType('cancel');
       
  1312 var TOP_CHANGE = unsafeCastStringToDOMTopLevelType('change');
       
  1313 var TOP_CLICK = unsafeCastStringToDOMTopLevelType('click');
       
  1314 var TOP_CLOSE = unsafeCastStringToDOMTopLevelType('close');
       
  1315 var TOP_COMPOSITION_END = unsafeCastStringToDOMTopLevelType('compositionend');
       
  1316 var TOP_COMPOSITION_START = unsafeCastStringToDOMTopLevelType('compositionstart');
       
  1317 var TOP_COMPOSITION_UPDATE = unsafeCastStringToDOMTopLevelType('compositionupdate');
       
  1318 var TOP_CONTEXT_MENU = unsafeCastStringToDOMTopLevelType('contextmenu');
       
  1319 var TOP_COPY = unsafeCastStringToDOMTopLevelType('copy');
       
  1320 var TOP_CUT = unsafeCastStringToDOMTopLevelType('cut');
       
  1321 var TOP_DOUBLE_CLICK = unsafeCastStringToDOMTopLevelType('dblclick');
       
  1322 var TOP_AUX_CLICK = unsafeCastStringToDOMTopLevelType('auxclick');
       
  1323 var TOP_DRAG = unsafeCastStringToDOMTopLevelType('drag');
       
  1324 var TOP_DRAG_END = unsafeCastStringToDOMTopLevelType('dragend');
       
  1325 var TOP_DRAG_ENTER = unsafeCastStringToDOMTopLevelType('dragenter');
       
  1326 var TOP_DRAG_EXIT = unsafeCastStringToDOMTopLevelType('dragexit');
       
  1327 var TOP_DRAG_LEAVE = unsafeCastStringToDOMTopLevelType('dragleave');
       
  1328 var TOP_DRAG_OVER = unsafeCastStringToDOMTopLevelType('dragover');
       
  1329 var TOP_DRAG_START = unsafeCastStringToDOMTopLevelType('dragstart');
       
  1330 var TOP_DROP = unsafeCastStringToDOMTopLevelType('drop');
       
  1331 var TOP_DURATION_CHANGE = unsafeCastStringToDOMTopLevelType('durationchange');
       
  1332 var TOP_EMPTIED = unsafeCastStringToDOMTopLevelType('emptied');
       
  1333 var TOP_ENCRYPTED = unsafeCastStringToDOMTopLevelType('encrypted');
       
  1334 var TOP_ENDED = unsafeCastStringToDOMTopLevelType('ended');
       
  1335 var TOP_ERROR = unsafeCastStringToDOMTopLevelType('error');
       
  1336 var TOP_FOCUS = unsafeCastStringToDOMTopLevelType('focus');
       
  1337 var TOP_GOT_POINTER_CAPTURE = unsafeCastStringToDOMTopLevelType('gotpointercapture');
       
  1338 var TOP_INPUT = unsafeCastStringToDOMTopLevelType('input');
       
  1339 var TOP_INVALID = unsafeCastStringToDOMTopLevelType('invalid');
       
  1340 var TOP_KEY_DOWN = unsafeCastStringToDOMTopLevelType('keydown');
       
  1341 var TOP_KEY_PRESS = unsafeCastStringToDOMTopLevelType('keypress');
       
  1342 var TOP_KEY_UP = unsafeCastStringToDOMTopLevelType('keyup');
       
  1343 var TOP_LOAD = unsafeCastStringToDOMTopLevelType('load');
       
  1344 var TOP_LOAD_START = unsafeCastStringToDOMTopLevelType('loadstart');
       
  1345 var TOP_LOADED_DATA = unsafeCastStringToDOMTopLevelType('loadeddata');
       
  1346 var TOP_LOADED_METADATA = unsafeCastStringToDOMTopLevelType('loadedmetadata');
       
  1347 var TOP_LOST_POINTER_CAPTURE = unsafeCastStringToDOMTopLevelType('lostpointercapture');
       
  1348 var TOP_MOUSE_DOWN = unsafeCastStringToDOMTopLevelType('mousedown');
       
  1349 var TOP_MOUSE_MOVE = unsafeCastStringToDOMTopLevelType('mousemove');
       
  1350 var TOP_MOUSE_OUT = unsafeCastStringToDOMTopLevelType('mouseout');
       
  1351 var TOP_MOUSE_OVER = unsafeCastStringToDOMTopLevelType('mouseover');
       
  1352 var TOP_MOUSE_UP = unsafeCastStringToDOMTopLevelType('mouseup');
       
  1353 var TOP_PASTE = unsafeCastStringToDOMTopLevelType('paste');
       
  1354 var TOP_PAUSE = unsafeCastStringToDOMTopLevelType('pause');
       
  1355 var TOP_PLAY = unsafeCastStringToDOMTopLevelType('play');
       
  1356 var TOP_PLAYING = unsafeCastStringToDOMTopLevelType('playing');
       
  1357 var TOP_POINTER_CANCEL = unsafeCastStringToDOMTopLevelType('pointercancel');
       
  1358 var TOP_POINTER_DOWN = unsafeCastStringToDOMTopLevelType('pointerdown');
       
  1359 
       
  1360 
       
  1361 var TOP_POINTER_MOVE = unsafeCastStringToDOMTopLevelType('pointermove');
       
  1362 var TOP_POINTER_OUT = unsafeCastStringToDOMTopLevelType('pointerout');
       
  1363 var TOP_POINTER_OVER = unsafeCastStringToDOMTopLevelType('pointerover');
       
  1364 var TOP_POINTER_UP = unsafeCastStringToDOMTopLevelType('pointerup');
       
  1365 var TOP_PROGRESS = unsafeCastStringToDOMTopLevelType('progress');
       
  1366 var TOP_RATE_CHANGE = unsafeCastStringToDOMTopLevelType('ratechange');
       
  1367 var TOP_RESET = unsafeCastStringToDOMTopLevelType('reset');
       
  1368 var TOP_SCROLL = unsafeCastStringToDOMTopLevelType('scroll');
       
  1369 var TOP_SEEKED = unsafeCastStringToDOMTopLevelType('seeked');
       
  1370 var TOP_SEEKING = unsafeCastStringToDOMTopLevelType('seeking');
       
  1371 var TOP_SELECTION_CHANGE = unsafeCastStringToDOMTopLevelType('selectionchange');
       
  1372 var TOP_STALLED = unsafeCastStringToDOMTopLevelType('stalled');
       
  1373 var TOP_SUBMIT = unsafeCastStringToDOMTopLevelType('submit');
       
  1374 var TOP_SUSPEND = unsafeCastStringToDOMTopLevelType('suspend');
       
  1375 var TOP_TEXT_INPUT = unsafeCastStringToDOMTopLevelType('textInput');
       
  1376 var TOP_TIME_UPDATE = unsafeCastStringToDOMTopLevelType('timeupdate');
       
  1377 var TOP_TOGGLE = unsafeCastStringToDOMTopLevelType('toggle');
       
  1378 var TOP_TOUCH_CANCEL = unsafeCastStringToDOMTopLevelType('touchcancel');
       
  1379 var TOP_TOUCH_END = unsafeCastStringToDOMTopLevelType('touchend');
       
  1380 var TOP_TOUCH_MOVE = unsafeCastStringToDOMTopLevelType('touchmove');
       
  1381 var TOP_TOUCH_START = unsafeCastStringToDOMTopLevelType('touchstart');
       
  1382 var TOP_TRANSITION_END = unsafeCastStringToDOMTopLevelType(getVendorPrefixedEventName('transitionend'));
       
  1383 var TOP_VOLUME_CHANGE = unsafeCastStringToDOMTopLevelType('volumechange');
       
  1384 var TOP_WAITING = unsafeCastStringToDOMTopLevelType('waiting');
       
  1385 var TOP_WHEEL = unsafeCastStringToDOMTopLevelType('wheel');
       
  1386 
       
  1387 // List of events that need to be individually attached to media elements.
       
  1388 // Note that events in this list will *not* be listened to at the top level
       
  1389 // unless they're explicitly whitelisted in `ReactBrowserEventEmitter.listenTo`.
       
  1390 var mediaEventTypes = [TOP_ABORT, TOP_CAN_PLAY, TOP_CAN_PLAY_THROUGH, TOP_DURATION_CHANGE, TOP_EMPTIED, TOP_ENCRYPTED, TOP_ENDED, TOP_ERROR, TOP_LOADED_DATA, TOP_LOADED_METADATA, TOP_LOAD_START, TOP_PAUSE, TOP_PLAY, TOP_PLAYING, TOP_PROGRESS, TOP_RATE_CHANGE, TOP_SEEKED, TOP_SEEKING, TOP_STALLED, TOP_SUSPEND, TOP_TIME_UPDATE, TOP_VOLUME_CHANGE, TOP_WAITING];
       
  1391 
       
  1392 function getRawEventName(topLevelType) {
       
  1393   return unsafeCastDOMTopLevelTypeToString(topLevelType);
       
  1394 }
       
  1395 
       
  1396 /**
       
  1397  * These variables store information about text content of a target node,
       
  1398  * allowing comparison of content before and after a given event.
       
  1399  *
       
  1400  * Identify the node where selection currently begins, then observe
       
  1401  * both its text content and its current position in the DOM. Since the
       
  1402  * browser may natively replace the target node during composition, we can
       
  1403  * use its position to find its replacement.
       
  1404  *
       
  1405  *
       
  1406  */
       
  1407 
       
  1408 var root = null;
       
  1409 var startText = null;
       
  1410 var fallbackText = null;
       
  1411 
       
  1412 function initialize(nativeEventTarget) {
       
  1413   root = nativeEventTarget;
       
  1414   startText = getText();
       
  1415   return true;
       
  1416 }
       
  1417 
       
  1418 function reset() {
       
  1419   root = null;
       
  1420   startText = null;
       
  1421   fallbackText = null;
       
  1422 }
       
  1423 
       
  1424 function getData() {
       
  1425   if (fallbackText) {
       
  1426     return fallbackText;
       
  1427   }
       
  1428 
       
  1429   var start = void 0;
       
  1430   var startValue = startText;
       
  1431   var startLength = startValue.length;
       
  1432   var end = void 0;
       
  1433   var endValue = getText();
       
  1434   var endLength = endValue.length;
       
  1435 
       
  1436   for (start = 0; start < startLength; start++) {
       
  1437     if (startValue[start] !== endValue[start]) {
       
  1438       break;
       
  1439     }
       
  1440   }
       
  1441 
       
  1442   var minEnd = startLength - start;
       
  1443   for (end = 1; end <= minEnd; end++) {
       
  1444     if (startValue[startLength - end] !== endValue[endLength - end]) {
       
  1445       break;
       
  1446     }
       
  1447   }
       
  1448 
       
  1449   var sliceTail = end > 1 ? 1 - end : undefined;
       
  1450   fallbackText = endValue.slice(start, sliceTail);
       
  1451   return fallbackText;
       
  1452 }
       
  1453 
       
  1454 function getText() {
       
  1455   if ('value' in root) {
       
  1456     return root.value;
       
  1457   }
       
  1458   return root.textContent;
       
  1459 }
       
  1460 
       
  1461 var ReactInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
       
  1462 
       
  1463 var _assign = ReactInternals.assign;
       
  1464 
       
  1465 /* eslint valid-typeof: 0 */
       
  1466 
       
  1467 var EVENT_POOL_SIZE = 10;
       
  1468 
       
  1469 /**
       
  1470  * @interface Event
       
  1471  * @see http://www.w3.org/TR/DOM-Level-3-Events/
       
  1472  */
       
  1473 var EventInterface = {
       
  1474   type: null,
       
  1475   target: null,
       
  1476   // currentTarget is set when dispatching; no use in copying it here
       
  1477   currentTarget: function () {
       
  1478     return null;
       
  1479   },
       
  1480   eventPhase: null,
       
  1481   bubbles: null,
       
  1482   cancelable: null,
       
  1483   timeStamp: function (event) {
       
  1484     return event.timeStamp || Date.now();
       
  1485   },
       
  1486   defaultPrevented: null,
       
  1487   isTrusted: null
       
  1488 };
       
  1489 
       
  1490 function functionThatReturnsTrue() {
       
  1491   return true;
       
  1492 }
       
  1493 
       
  1494 function functionThatReturnsFalse() {
       
  1495   return false;
       
  1496 }
       
  1497 
       
  1498 /**
       
  1499  * Synthetic events are dispatched by event plugins, typically in response to a
       
  1500  * top-level event delegation handler.
       
  1501  *
       
  1502  * These systems should generally use pooling to reduce the frequency of garbage
       
  1503  * collection. The system should check `isPersistent` to determine whether the
       
  1504  * event should be released into the pool after being dispatched. Users that
       
  1505  * need a persisted event should invoke `persist`.
       
  1506  *
       
  1507  * Synthetic events (and subclasses) implement the DOM Level 3 Events API by
       
  1508  * normalizing browser quirks. Subclasses do not necessarily have to implement a
       
  1509  * DOM interface; custom application-specific events can also subclass this.
       
  1510  *
       
  1511  * @param {object} dispatchConfig Configuration used to dispatch this event.
       
  1512  * @param {*} targetInst Marker identifying the event target.
       
  1513  * @param {object} nativeEvent Native browser event.
       
  1514  * @param {DOMEventTarget} nativeEventTarget Target node.
       
  1515  */
       
  1516 function SyntheticEvent(dispatchConfig, targetInst, nativeEvent, nativeEventTarget) {
       
  1517   {
       
  1518     // these have a getter/setter for warnings
       
  1519     delete this.nativeEvent;
       
  1520     delete this.preventDefault;
       
  1521     delete this.stopPropagation;
       
  1522     delete this.isDefaultPrevented;
       
  1523     delete this.isPropagationStopped;
       
  1524   }
       
  1525 
       
  1526   this.dispatchConfig = dispatchConfig;
       
  1527   this._targetInst = targetInst;
       
  1528   this.nativeEvent = nativeEvent;
       
  1529 
       
  1530   var Interface = this.constructor.Interface;
       
  1531   for (var propName in Interface) {
       
  1532     if (!Interface.hasOwnProperty(propName)) {
       
  1533       continue;
       
  1534     }
       
  1535     {
       
  1536       delete this[propName]; // this has a getter/setter for warnings
       
  1537     }
       
  1538     var normalize = Interface[propName];
       
  1539     if (normalize) {
       
  1540       this[propName] = normalize(nativeEvent);
       
  1541     } else {
       
  1542       if (propName === 'target') {
       
  1543         this.target = nativeEventTarget;
       
  1544       } else {
       
  1545         this[propName] = nativeEvent[propName];
       
  1546       }
       
  1547     }
       
  1548   }
       
  1549 
       
  1550   var defaultPrevented = nativeEvent.defaultPrevented != null ? nativeEvent.defaultPrevented : nativeEvent.returnValue === false;
       
  1551   if (defaultPrevented) {
       
  1552     this.isDefaultPrevented = functionThatReturnsTrue;
       
  1553   } else {
       
  1554     this.isDefaultPrevented = functionThatReturnsFalse;
       
  1555   }
       
  1556   this.isPropagationStopped = functionThatReturnsFalse;
       
  1557   return this;
       
  1558 }
       
  1559 
       
  1560 _assign(SyntheticEvent.prototype, {
       
  1561   preventDefault: function () {
       
  1562     this.defaultPrevented = true;
       
  1563     var event = this.nativeEvent;
       
  1564     if (!event) {
       
  1565       return;
       
  1566     }
       
  1567 
       
  1568     if (event.preventDefault) {
       
  1569       event.preventDefault();
       
  1570     } else if (typeof event.returnValue !== 'unknown') {
       
  1571       event.returnValue = false;
       
  1572     }
       
  1573     this.isDefaultPrevented = functionThatReturnsTrue;
       
  1574   },
       
  1575 
       
  1576   stopPropagation: function () {
       
  1577     var event = this.nativeEvent;
       
  1578     if (!event) {
       
  1579       return;
       
  1580     }
       
  1581 
       
  1582     if (event.stopPropagation) {
       
  1583       event.stopPropagation();
       
  1584     } else if (typeof event.cancelBubble !== 'unknown') {
       
  1585       // The ChangeEventPlugin registers a "propertychange" event for
       
  1586       // IE. This event does not support bubbling or cancelling, and
       
  1587       // any references to cancelBubble throw "Member not found".  A
       
  1588       // typeof check of "unknown" circumvents this issue (and is also
       
  1589       // IE specific).
       
  1590       event.cancelBubble = true;
       
  1591     }
       
  1592 
       
  1593     this.isPropagationStopped = functionThatReturnsTrue;
       
  1594   },
       
  1595 
       
  1596   /**
       
  1597    * We release all dispatched `SyntheticEvent`s after each event loop, adding
       
  1598    * them back into the pool. This allows a way to hold onto a reference that
       
  1599    * won't be added back into the pool.
       
  1600    */
       
  1601   persist: function () {
       
  1602     this.isPersistent = functionThatReturnsTrue;
       
  1603   },
       
  1604 
       
  1605   /**
       
  1606    * Checks if this event should be released back into the pool.
       
  1607    *
       
  1608    * @return {boolean} True if this should not be released, false otherwise.
       
  1609    */
       
  1610   isPersistent: functionThatReturnsFalse,
       
  1611 
       
  1612   /**
       
  1613    * `PooledClass` looks for `destructor` on each instance it releases.
       
  1614    */
       
  1615   destructor: function () {
       
  1616     var Interface = this.constructor.Interface;
       
  1617     for (var propName in Interface) {
       
  1618       {
       
  1619         Object.defineProperty(this, propName, getPooledWarningPropertyDefinition(propName, Interface[propName]));
       
  1620       }
       
  1621     }
       
  1622     this.dispatchConfig = null;
       
  1623     this._targetInst = null;
       
  1624     this.nativeEvent = null;
       
  1625     this.isDefaultPrevented = functionThatReturnsFalse;
       
  1626     this.isPropagationStopped = functionThatReturnsFalse;
       
  1627     this._dispatchListeners = null;
       
  1628     this._dispatchInstances = null;
       
  1629     {
       
  1630       Object.defineProperty(this, 'nativeEvent', getPooledWarningPropertyDefinition('nativeEvent', null));
       
  1631       Object.defineProperty(this, 'isDefaultPrevented', getPooledWarningPropertyDefinition('isDefaultPrevented', functionThatReturnsFalse));
       
  1632       Object.defineProperty(this, 'isPropagationStopped', getPooledWarningPropertyDefinition('isPropagationStopped', functionThatReturnsFalse));
       
  1633       Object.defineProperty(this, 'preventDefault', getPooledWarningPropertyDefinition('preventDefault', function () {}));
       
  1634       Object.defineProperty(this, 'stopPropagation', getPooledWarningPropertyDefinition('stopPropagation', function () {}));
       
  1635     }
       
  1636   }
       
  1637 });
       
  1638 
       
  1639 SyntheticEvent.Interface = EventInterface;
       
  1640 
       
  1641 /**
       
  1642  * Helper to reduce boilerplate when creating subclasses.
       
  1643  */
       
  1644 SyntheticEvent.extend = function (Interface) {
       
  1645   var Super = this;
       
  1646 
       
  1647   var E = function () {};
       
  1648   E.prototype = Super.prototype;
       
  1649   var prototype = new E();
       
  1650 
       
  1651   function Class() {
       
  1652     return Super.apply(this, arguments);
       
  1653   }
       
  1654   _assign(prototype, Class.prototype);
       
  1655   Class.prototype = prototype;
       
  1656   Class.prototype.constructor = Class;
       
  1657 
       
  1658   Class.Interface = _assign({}, Super.Interface, Interface);
       
  1659   Class.extend = Super.extend;
       
  1660   addEventPoolingTo(Class);
       
  1661 
       
  1662   return Class;
       
  1663 };
       
  1664 
       
  1665 addEventPoolingTo(SyntheticEvent);
       
  1666 
       
  1667 /**
       
  1668  * Helper to nullify syntheticEvent instance properties when destructing
       
  1669  *
       
  1670  * @param {String} propName
       
  1671  * @param {?object} getVal
       
  1672  * @return {object} defineProperty object
       
  1673  */
       
  1674 function getPooledWarningPropertyDefinition(propName, getVal) {
       
  1675   var isFunction = typeof getVal === 'function';
       
  1676   return {
       
  1677     configurable: true,
       
  1678     set: set,
       
  1679     get: get
       
  1680   };
       
  1681 
       
  1682   function set(val) {
       
  1683     var action = isFunction ? 'setting the method' : 'setting the property';
       
  1684     warn(action, 'This is effectively a no-op');
       
  1685     return val;
       
  1686   }
       
  1687 
       
  1688   function get() {
       
  1689     var action = isFunction ? 'accessing the method' : 'accessing the property';
       
  1690     var result = isFunction ? 'This is a no-op function' : 'This is set to null';
       
  1691     warn(action, result);
       
  1692     return getVal;
       
  1693   }
       
  1694 
       
  1695   function warn(action, result) {
       
  1696     var warningCondition = false;
       
  1697     !warningCondition ? warningWithoutStack$1(false, "This synthetic event is reused for performance reasons. If you're seeing this, " + "you're %s `%s` on a released/nullified synthetic event. %s. " + 'If you must keep the original synthetic event around, use event.persist(). ' + 'See https://fb.me/react-event-pooling for more information.', action, propName, result) : void 0;
       
  1698   }
       
  1699 }
       
  1700 
       
  1701 function getPooledEvent(dispatchConfig, targetInst, nativeEvent, nativeInst) {
       
  1702   var EventConstructor = this;
       
  1703   if (EventConstructor.eventPool.length) {
       
  1704     var instance = EventConstructor.eventPool.pop();
       
  1705     EventConstructor.call(instance, dispatchConfig, targetInst, nativeEvent, nativeInst);
       
  1706     return instance;
       
  1707   }
       
  1708   return new EventConstructor(dispatchConfig, targetInst, nativeEvent, nativeInst);
       
  1709 }
       
  1710 
       
  1711 function releasePooledEvent(event) {
       
  1712   var EventConstructor = this;
       
  1713   (function () {
       
  1714     if (!(event instanceof EventConstructor)) {
       
  1715       {
       
  1716         throw ReactError(Error('Trying to release an event instance into a pool of a different type.'));
       
  1717       }
       
  1718     }
       
  1719   })();
       
  1720   event.destructor();
       
  1721   if (EventConstructor.eventPool.length < EVENT_POOL_SIZE) {
       
  1722     EventConstructor.eventPool.push(event);
       
  1723   }
       
  1724 }
       
  1725 
       
  1726 function addEventPoolingTo(EventConstructor) {
       
  1727   EventConstructor.eventPool = [];
       
  1728   EventConstructor.getPooled = getPooledEvent;
       
  1729   EventConstructor.release = releasePooledEvent;
       
  1730 }
       
  1731 
       
  1732 /**
       
  1733  * @interface Event
       
  1734  * @see http://www.w3.org/TR/DOM-Level-3-Events/#events-compositionevents
       
  1735  */
       
  1736 var SyntheticCompositionEvent = SyntheticEvent.extend({
       
  1737   data: null
       
  1738 });
       
  1739 
       
  1740 /**
       
  1741  * @interface Event
       
  1742  * @see http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105
       
  1743  *      /#events-inputevents
       
  1744  */
       
  1745 var SyntheticInputEvent = SyntheticEvent.extend({
       
  1746   data: null
       
  1747 });
       
  1748 
       
  1749 var END_KEYCODES = [9, 13, 27, 32]; // Tab, Return, Esc, Space
       
  1750 var START_KEYCODE = 229;
       
  1751 
       
  1752 var canUseCompositionEvent = canUseDOM && 'CompositionEvent' in window;
       
  1753 
       
  1754 var documentMode = null;
       
  1755 if (canUseDOM && 'documentMode' in document) {
       
  1756   documentMode = document.documentMode;
       
  1757 }
       
  1758 
       
  1759 // Webkit offers a very useful `textInput` event that can be used to
       
  1760 // directly represent `beforeInput`. The IE `textinput` event is not as
       
  1761 // useful, so we don't use it.
       
  1762 var canUseTextInputEvent = canUseDOM && 'TextEvent' in window && !documentMode;
       
  1763 
       
  1764 // In IE9+, we have access to composition events, but the data supplied
       
  1765 // by the native compositionend event may be incorrect. Japanese ideographic
       
  1766 // spaces, for instance (\u3000) are not recorded correctly.
       
  1767 var useFallbackCompositionData = canUseDOM && (!canUseCompositionEvent || documentMode && documentMode > 8 && documentMode <= 11);
       
  1768 
       
  1769 var SPACEBAR_CODE = 32;
       
  1770 var SPACEBAR_CHAR = String.fromCharCode(SPACEBAR_CODE);
       
  1771 
       
  1772 // Events and their corresponding property names.
       
  1773 var eventTypes = {
       
  1774   beforeInput: {
       
  1775     phasedRegistrationNames: {
       
  1776       bubbled: 'onBeforeInput',
       
  1777       captured: 'onBeforeInputCapture'
       
  1778     },
       
  1779     dependencies: [TOP_COMPOSITION_END, TOP_KEY_PRESS, TOP_TEXT_INPUT, TOP_PASTE]
       
  1780   },
       
  1781   compositionEnd: {
       
  1782     phasedRegistrationNames: {
       
  1783       bubbled: 'onCompositionEnd',
       
  1784       captured: 'onCompositionEndCapture'
       
  1785     },
       
  1786     dependencies: [TOP_BLUR, TOP_COMPOSITION_END, TOP_KEY_DOWN, TOP_KEY_PRESS, TOP_KEY_UP, TOP_MOUSE_DOWN]
       
  1787   },
       
  1788   compositionStart: {
       
  1789     phasedRegistrationNames: {
       
  1790       bubbled: 'onCompositionStart',
       
  1791       captured: 'onCompositionStartCapture'
       
  1792     },
       
  1793     dependencies: [TOP_BLUR, TOP_COMPOSITION_START, TOP_KEY_DOWN, TOP_KEY_PRESS, TOP_KEY_UP, TOP_MOUSE_DOWN]
       
  1794   },
       
  1795   compositionUpdate: {
       
  1796     phasedRegistrationNames: {
       
  1797       bubbled: 'onCompositionUpdate',
       
  1798       captured: 'onCompositionUpdateCapture'
       
  1799     },
       
  1800     dependencies: [TOP_BLUR, TOP_COMPOSITION_UPDATE, TOP_KEY_DOWN, TOP_KEY_PRESS, TOP_KEY_UP, TOP_MOUSE_DOWN]
       
  1801   }
       
  1802 };
       
  1803 
       
  1804 // Track whether we've ever handled a keypress on the space key.
       
  1805 var hasSpaceKeypress = false;
       
  1806 
       
  1807 /**
       
  1808  * Return whether a native keypress event is assumed to be a command.
       
  1809  * This is required because Firefox fires `keypress` events for key commands
       
  1810  * (cut, copy, select-all, etc.) even though no character is inserted.
       
  1811  */
       
  1812 function isKeypressCommand(nativeEvent) {
       
  1813   return (nativeEvent.ctrlKey || nativeEvent.altKey || nativeEvent.metaKey) &&
       
  1814   // ctrlKey && altKey is equivalent to AltGr, and is not a command.
       
  1815   !(nativeEvent.ctrlKey && nativeEvent.altKey);
       
  1816 }
       
  1817 
       
  1818 /**
       
  1819  * Translate native top level events into event types.
       
  1820  *
       
  1821  * @param {string} topLevelType
       
  1822  * @return {object}
       
  1823  */
       
  1824 function getCompositionEventType(topLevelType) {
       
  1825   switch (topLevelType) {
       
  1826     case TOP_COMPOSITION_START:
       
  1827       return eventTypes.compositionStart;
       
  1828     case TOP_COMPOSITION_END:
       
  1829       return eventTypes.compositionEnd;
       
  1830     case TOP_COMPOSITION_UPDATE:
       
  1831       return eventTypes.compositionUpdate;
       
  1832   }
       
  1833 }
       
  1834 
       
  1835 /**
       
  1836  * Does our fallback best-guess model think this event signifies that
       
  1837  * composition has begun?
       
  1838  *
       
  1839  * @param {string} topLevelType
       
  1840  * @param {object} nativeEvent
       
  1841  * @return {boolean}
       
  1842  */
       
  1843 function isFallbackCompositionStart(topLevelType, nativeEvent) {
       
  1844   return topLevelType === TOP_KEY_DOWN && nativeEvent.keyCode === START_KEYCODE;
       
  1845 }
       
  1846 
       
  1847 /**
       
  1848  * Does our fallback mode think that this event is the end of composition?
       
  1849  *
       
  1850  * @param {string} topLevelType
       
  1851  * @param {object} nativeEvent
       
  1852  * @return {boolean}
       
  1853  */
       
  1854 function isFallbackCompositionEnd(topLevelType, nativeEvent) {
       
  1855   switch (topLevelType) {
       
  1856     case TOP_KEY_UP:
       
  1857       // Command keys insert or clear IME input.
       
  1858       return END_KEYCODES.indexOf(nativeEvent.keyCode) !== -1;
       
  1859     case TOP_KEY_DOWN:
       
  1860       // Expect IME keyCode on each keydown. If we get any other
       
  1861       // code we must have exited earlier.
       
  1862       return nativeEvent.keyCode !== START_KEYCODE;
       
  1863     case TOP_KEY_PRESS:
       
  1864     case TOP_MOUSE_DOWN:
       
  1865     case TOP_BLUR:
       
  1866       // Events are not possible without cancelling IME.
       
  1867       return true;
       
  1868     default:
       
  1869       return false;
       
  1870   }
       
  1871 }
       
  1872 
       
  1873 /**
       
  1874  * Google Input Tools provides composition data via a CustomEvent,
       
  1875  * with the `data` property populated in the `detail` object. If this
       
  1876  * is available on the event object, use it. If not, this is a plain
       
  1877  * composition event and we have nothing special to extract.
       
  1878  *
       
  1879  * @param {object} nativeEvent
       
  1880  * @return {?string}
       
  1881  */
       
  1882 function getDataFromCustomEvent(nativeEvent) {
       
  1883   var detail = nativeEvent.detail;
       
  1884   if (typeof detail === 'object' && 'data' in detail) {
       
  1885     return detail.data;
       
  1886   }
       
  1887   return null;
       
  1888 }
       
  1889 
       
  1890 /**
       
  1891  * Check if a composition event was triggered by Korean IME.
       
  1892  * Our fallback mode does not work well with IE's Korean IME,
       
  1893  * so just use native composition events when Korean IME is used.
       
  1894  * Although CompositionEvent.locale property is deprecated,
       
  1895  * it is available in IE, where our fallback mode is enabled.
       
  1896  *
       
  1897  * @param {object} nativeEvent
       
  1898  * @return {boolean}
       
  1899  */
       
  1900 function isUsingKoreanIME(nativeEvent) {
       
  1901   return nativeEvent.locale === 'ko';
       
  1902 }
       
  1903 
       
  1904 // Track the current IME composition status, if any.
       
  1905 var isComposing = false;
       
  1906 
       
  1907 /**
       
  1908  * @return {?object} A SyntheticCompositionEvent.
       
  1909  */
       
  1910 function extractCompositionEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget) {
       
  1911   var eventType = void 0;
       
  1912   var fallbackData = void 0;
       
  1913 
       
  1914   if (canUseCompositionEvent) {
       
  1915     eventType = getCompositionEventType(topLevelType);
       
  1916   } else if (!isComposing) {
       
  1917     if (isFallbackCompositionStart(topLevelType, nativeEvent)) {
       
  1918       eventType = eventTypes.compositionStart;
       
  1919     }
       
  1920   } else if (isFallbackCompositionEnd(topLevelType, nativeEvent)) {
       
  1921     eventType = eventTypes.compositionEnd;
       
  1922   }
       
  1923 
       
  1924   if (!eventType) {
       
  1925     return null;
       
  1926   }
       
  1927 
       
  1928   if (useFallbackCompositionData && !isUsingKoreanIME(nativeEvent)) {
       
  1929     // The current composition is stored statically and must not be
       
  1930     // overwritten while composition continues.
       
  1931     if (!isComposing && eventType === eventTypes.compositionStart) {
       
  1932       isComposing = initialize(nativeEventTarget);
       
  1933     } else if (eventType === eventTypes.compositionEnd) {
       
  1934       if (isComposing) {
       
  1935         fallbackData = getData();
       
  1936       }
       
  1937     }
       
  1938   }
       
  1939 
       
  1940   var event = SyntheticCompositionEvent.getPooled(eventType, targetInst, nativeEvent, nativeEventTarget);
       
  1941 
       
  1942   if (fallbackData) {
       
  1943     // Inject data generated from fallback path into the synthetic event.
       
  1944     // This matches the property of native CompositionEventInterface.
       
  1945     event.data = fallbackData;
       
  1946   } else {
       
  1947     var customData = getDataFromCustomEvent(nativeEvent);
       
  1948     if (customData !== null) {
       
  1949       event.data = customData;
       
  1950     }
       
  1951   }
       
  1952 
       
  1953   accumulateTwoPhaseDispatches(event);
       
  1954   return event;
       
  1955 }
       
  1956 
       
  1957 /**
       
  1958  * @param {TopLevelType} topLevelType Number from `TopLevelType`.
       
  1959  * @param {object} nativeEvent Native browser event.
       
  1960  * @return {?string} The string corresponding to this `beforeInput` event.
       
  1961  */
       
  1962 function getNativeBeforeInputChars(topLevelType, nativeEvent) {
       
  1963   switch (topLevelType) {
       
  1964     case TOP_COMPOSITION_END:
       
  1965       return getDataFromCustomEvent(nativeEvent);
       
  1966     case TOP_KEY_PRESS:
       
  1967       /**
       
  1968        * If native `textInput` events are available, our goal is to make
       
  1969        * use of them. However, there is a special case: the spacebar key.
       
  1970        * In Webkit, preventing default on a spacebar `textInput` event
       
  1971        * cancels character insertion, but it *also* causes the browser
       
  1972        * to fall back to its default spacebar behavior of scrolling the
       
  1973        * page.
       
  1974        *
       
  1975        * Tracking at:
       
  1976        * https://code.google.com/p/chromium/issues/detail?id=355103
       
  1977        *
       
  1978        * To avoid this issue, use the keypress event as if no `textInput`
       
  1979        * event is available.
       
  1980        */
       
  1981       var which = nativeEvent.which;
       
  1982       if (which !== SPACEBAR_CODE) {
       
  1983         return null;
       
  1984       }
       
  1985 
       
  1986       hasSpaceKeypress = true;
       
  1987       return SPACEBAR_CHAR;
       
  1988 
       
  1989     case TOP_TEXT_INPUT:
       
  1990       // Record the characters to be added to the DOM.
       
  1991       var chars = nativeEvent.data;
       
  1992 
       
  1993       // If it's a spacebar character, assume that we have already handled
       
  1994       // it at the keypress level and bail immediately. Android Chrome
       
  1995       // doesn't give us keycodes, so we need to ignore it.
       
  1996       if (chars === SPACEBAR_CHAR && hasSpaceKeypress) {
       
  1997         return null;
       
  1998       }
       
  1999 
       
  2000       return chars;
       
  2001 
       
  2002     default:
       
  2003       // For other native event types, do nothing.
       
  2004       return null;
       
  2005   }
       
  2006 }
       
  2007 
       
  2008 /**
       
  2009  * For browsers that do not provide the `textInput` event, extract the
       
  2010  * appropriate string to use for SyntheticInputEvent.
       
  2011  *
       
  2012  * @param {number} topLevelType Number from `TopLevelEventTypes`.
       
  2013  * @param {object} nativeEvent Native browser event.
       
  2014  * @return {?string} The fallback string for this `beforeInput` event.
       
  2015  */
       
  2016 function getFallbackBeforeInputChars(topLevelType, nativeEvent) {
       
  2017   // If we are currently composing (IME) and using a fallback to do so,
       
  2018   // try to extract the composed characters from the fallback object.
       
  2019   // If composition event is available, we extract a string only at
       
  2020   // compositionevent, otherwise extract it at fallback events.
       
  2021   if (isComposing) {
       
  2022     if (topLevelType === TOP_COMPOSITION_END || !canUseCompositionEvent && isFallbackCompositionEnd(topLevelType, nativeEvent)) {
       
  2023       var chars = getData();
       
  2024       reset();
       
  2025       isComposing = false;
       
  2026       return chars;
       
  2027     }
       
  2028     return null;
       
  2029   }
       
  2030 
       
  2031   switch (topLevelType) {
       
  2032     case TOP_PASTE:
       
  2033       // If a paste event occurs after a keypress, throw out the input
       
  2034       // chars. Paste events should not lead to BeforeInput events.
       
  2035       return null;
       
  2036     case TOP_KEY_PRESS:
       
  2037       /**
       
  2038        * As of v27, Firefox may fire keypress events even when no character
       
  2039        * will be inserted. A few possibilities:
       
  2040        *
       
  2041        * - `which` is `0`. Arrow keys, Esc key, etc.
       
  2042        *
       
  2043        * - `which` is the pressed key code, but no char is available.
       
  2044        *   Ex: 'AltGr + d` in Polish. There is no modified character for
       
  2045        *   this key combination and no character is inserted into the
       
  2046        *   document, but FF fires the keypress for char code `100` anyway.
       
  2047        *   No `input` event will occur.
       
  2048        *
       
  2049        * - `which` is the pressed key code, but a command combination is
       
  2050        *   being used. Ex: `Cmd+C`. No character is inserted, and no
       
  2051        *   `input` event will occur.
       
  2052        */
       
  2053       if (!isKeypressCommand(nativeEvent)) {
       
  2054         // IE fires the `keypress` event when a user types an emoji via
       
  2055         // Touch keyboard of Windows.  In such a case, the `char` property
       
  2056         // holds an emoji character like `\uD83D\uDE0A`.  Because its length
       
  2057         // is 2, the property `which` does not represent an emoji correctly.
       
  2058         // In such a case, we directly return the `char` property instead of
       
  2059         // using `which`.
       
  2060         if (nativeEvent.char && nativeEvent.char.length > 1) {
       
  2061           return nativeEvent.char;
       
  2062         } else if (nativeEvent.which) {
       
  2063           return String.fromCharCode(nativeEvent.which);
       
  2064         }
       
  2065       }
       
  2066       return null;
       
  2067     case TOP_COMPOSITION_END:
       
  2068       return useFallbackCompositionData && !isUsingKoreanIME(nativeEvent) ? null : nativeEvent.data;
       
  2069     default:
       
  2070       return null;
       
  2071   }
       
  2072 }
       
  2073 
       
  2074 /**
       
  2075  * Extract a SyntheticInputEvent for `beforeInput`, based on either native
       
  2076  * `textInput` or fallback behavior.
       
  2077  *
       
  2078  * @return {?object} A SyntheticInputEvent.
       
  2079  */
       
  2080 function extractBeforeInputEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget) {
       
  2081   var chars = void 0;
       
  2082 
       
  2083   if (canUseTextInputEvent) {
       
  2084     chars = getNativeBeforeInputChars(topLevelType, nativeEvent);
       
  2085   } else {
       
  2086     chars = getFallbackBeforeInputChars(topLevelType, nativeEvent);
       
  2087   }
       
  2088 
       
  2089   // If no characters are being inserted, no BeforeInput event should
       
  2090   // be fired.
       
  2091   if (!chars) {
       
  2092     return null;
       
  2093   }
       
  2094 
       
  2095   var event = SyntheticInputEvent.getPooled(eventTypes.beforeInput, targetInst, nativeEvent, nativeEventTarget);
       
  2096 
       
  2097   event.data = chars;
       
  2098   accumulateTwoPhaseDispatches(event);
       
  2099   return event;
       
  2100 }
       
  2101 
       
  2102 /**
       
  2103  * Create an `onBeforeInput` event to match
       
  2104  * http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105/#events-inputevents.
       
  2105  *
       
  2106  * This event plugin is based on the native `textInput` event
       
  2107  * available in Chrome, Safari, Opera, and IE. This event fires after
       
  2108  * `onKeyPress` and `onCompositionEnd`, but before `onInput`.
       
  2109  *
       
  2110  * `beforeInput` is spec'd but not implemented in any browsers, and
       
  2111  * the `input` event does not provide any useful information about what has
       
  2112  * actually been added, contrary to the spec. Thus, `textInput` is the best
       
  2113  * available event to identify the characters that have actually been inserted
       
  2114  * into the target node.
       
  2115  *
       
  2116  * This plugin is also responsible for emitting `composition` events, thus
       
  2117  * allowing us to share composition fallback code for both `beforeInput` and
       
  2118  * `composition` event types.
       
  2119  */
       
  2120 var BeforeInputEventPlugin = {
       
  2121   eventTypes: eventTypes,
       
  2122 
       
  2123   extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
       
  2124     var composition = extractCompositionEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget);
       
  2125 
       
  2126     var beforeInput = extractBeforeInputEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget);
       
  2127 
       
  2128     if (composition === null) {
       
  2129       return beforeInput;
       
  2130     }
       
  2131 
       
  2132     if (beforeInput === null) {
       
  2133       return composition;
       
  2134     }
       
  2135 
       
  2136     return [composition, beforeInput];
       
  2137   }
       
  2138 };
       
  2139 
       
  2140 // Use to restore controlled state after a change event has fired.
       
  2141 
       
  2142 var restoreImpl = null;
       
  2143 var restoreTarget = null;
       
  2144 var restoreQueue = null;
       
  2145 
       
  2146 function restoreStateOfTarget(target) {
       
  2147   // We perform this translation at the end of the event loop so that we
       
  2148   // always receive the correct fiber here
       
  2149   var internalInstance = getInstanceFromNode(target);
       
  2150   if (!internalInstance) {
       
  2151     // Unmounted
       
  2152     return;
       
  2153   }
       
  2154   (function () {
       
  2155     if (!(typeof restoreImpl === 'function')) {
       
  2156       {
       
  2157         throw ReactError(Error('setRestoreImplementation() needs to be called to handle a target for controlled events. This error is likely caused by a bug in React. Please file an issue.'));
       
  2158       }
       
  2159     }
       
  2160   })();
       
  2161   var props = getFiberCurrentPropsFromNode(internalInstance.stateNode);
       
  2162   restoreImpl(internalInstance.stateNode, internalInstance.type, props);
       
  2163 }
       
  2164 
       
  2165 function setRestoreImplementation(impl) {
       
  2166   restoreImpl = impl;
       
  2167 }
       
  2168 
       
  2169 function enqueueStateRestore(target) {
       
  2170   if (restoreTarget) {
       
  2171     if (restoreQueue) {
       
  2172       restoreQueue.push(target);
       
  2173     } else {
       
  2174       restoreQueue = [target];
       
  2175     }
       
  2176   } else {
       
  2177     restoreTarget = target;
       
  2178   }
       
  2179 }
       
  2180 
       
  2181 function needsStateRestore() {
       
  2182   return restoreTarget !== null || restoreQueue !== null;
       
  2183 }
       
  2184 
       
  2185 function restoreStateIfNeeded() {
       
  2186   if (!restoreTarget) {
       
  2187     return;
       
  2188   }
       
  2189   var target = restoreTarget;
       
  2190   var queuedTargets = restoreQueue;
       
  2191   restoreTarget = null;
       
  2192   restoreQueue = null;
       
  2193 
       
  2194   restoreStateOfTarget(target);
       
  2195   if (queuedTargets) {
       
  2196     for (var i = 0; i < queuedTargets.length; i++) {
       
  2197       restoreStateOfTarget(queuedTargets[i]);
       
  2198     }
       
  2199   }
       
  2200 }
       
  2201 
       
  2202 var enableUserTimingAPI = true;
       
  2203 
       
  2204 // Helps identify side effects in begin-phase lifecycle hooks and setState reducers:
       
  2205 var debugRenderPhaseSideEffects = false;
       
  2206 
       
  2207 // In some cases, StrictMode should also double-render lifecycles.
       
  2208 // This can be confusing for tests though,
       
  2209 // And it can be bad for performance in production.
       
  2210 // This feature flag can be used to control the behavior:
       
  2211 var debugRenderPhaseSideEffectsForStrictMode = true;
       
  2212 
       
  2213 // To preserve the "Pause on caught exceptions" behavior of the debugger, we
       
  2214 // replay the begin phase of a failed component inside invokeGuardedCallback.
       
  2215 var replayFailedUnitOfWorkWithInvokeGuardedCallback = true;
       
  2216 
       
  2217 // Warn about deprecated, async-unsafe lifecycles; relates to RFC #6:
       
  2218 var warnAboutDeprecatedLifecycles = true;
       
  2219 
       
  2220 // Gather advanced timing metrics for Profiler subtrees.
       
  2221 var enableProfilerTimer = true;
       
  2222 
       
  2223 // Trace which interactions trigger each commit.
       
  2224 var enableSchedulerTracing = true;
       
  2225 
       
  2226 // Only used in www builds.
       
  2227 var enableSuspenseServerRenderer = false; // TODO: true? Here it might just be false.
       
  2228 
       
  2229 // Only used in www builds.
       
  2230 
       
  2231 
       
  2232 // Only used in www builds.
       
  2233 
       
  2234 
       
  2235 // Disable javascript: URL strings in href for XSS protection.
       
  2236 var disableJavaScriptURLs = false;
       
  2237 
       
  2238 // React Fire: prevent the value and checked attributes from syncing
       
  2239 // with their related DOM properties
       
  2240 var disableInputAttributeSyncing = false;
       
  2241 
       
  2242 // These APIs will no longer be "unstable" in the upcoming 16.7 release,
       
  2243 // Control this behavior with a flag to support 16.6 minor releases in the meanwhile.
       
  2244 var enableStableConcurrentModeAPIs = false;
       
  2245 
       
  2246 var warnAboutShorthandPropertyCollision = false;
       
  2247 
       
  2248 // See https://github.com/react-native-community/discussions-and-proposals/issues/72 for more information
       
  2249 // This is a flag so we can fix warnings in RN core before turning it on
       
  2250 
       
  2251 
       
  2252 // Experimental React Flare event system and event components support.
       
  2253 var enableFlareAPI = false;
       
  2254 
       
  2255 // Experimental Host Component support.
       
  2256 var enableFundamentalAPI = false;
       
  2257 
       
  2258 // New API for JSX transforms to target - https://github.com/reactjs/rfcs/pull/107
       
  2259 
       
  2260 
       
  2261 // We will enforce mocking scheduler with scheduler/unstable_mock at some point. (v17?)
       
  2262 // Till then, we warn about the missing mock, but still fallback to a sync mode compatible version
       
  2263 var warnAboutUnmockedScheduler = false;
       
  2264 // Temporary flag to revert the fix in #15650
       
  2265 var revertPassiveEffectsChange = false;
       
  2266 
       
  2267 // For tests, we flush suspense fallbacks in an act scope;
       
  2268 // *except* in some of our own tests, where we test incremental loading states.
       
  2269 var flushSuspenseFallbacksInTests = true;
       
  2270 
       
  2271 // Changes priority of some events like mousemove to user-blocking priority,
       
  2272 // but without making them discrete. The flag exists in case it causes
       
  2273 // starvation problems.
       
  2274 var enableUserBlockingEvents = false;
       
  2275 
       
  2276 // Add a callback property to suspense to notify which promises are currently
       
  2277 // in the update queue. This allows reporting and tracing of what is causing
       
  2278 // the user to see a loading state.
       
  2279 var enableSuspenseCallback = false;
       
  2280 
       
  2281 // Part of the simplification of React.createElement so we can eventually move
       
  2282 // from React.createElement to React.jsx
       
  2283 // https://github.com/reactjs/rfcs/blob/createlement-rfc/text/0000-create-element-changes.md
       
  2284 var warnAboutDefaultPropsOnFunctionComponents = false;
       
  2285 
       
  2286 var disableLegacyContext = false;
       
  2287 
       
  2288 var disableSchedulerTimeoutBasedOnReactExpirationTime = false;
       
  2289 
       
  2290 // Used as a way to call batchedUpdates when we don't have a reference to
       
  2291 // the renderer. Such as when we're dispatching events or if third party
       
  2292 // libraries need to call batchedUpdates. Eventually, this API will go away when
       
  2293 // everything is batched by default. We'll then have a similar API to opt-out of
       
  2294 // scheduled work and instead do synchronous work.
       
  2295 
       
  2296 // Defaults
       
  2297 var batchedUpdatesImpl = function (fn, bookkeeping) {
       
  2298   return fn(bookkeeping);
       
  2299 };
       
  2300 var discreteUpdatesImpl = function (fn, a, b, c) {
       
  2301   return fn(a, b, c);
       
  2302 };
       
  2303 var flushDiscreteUpdatesImpl = function () {};
       
  2304 var batchedEventUpdatesImpl = batchedUpdatesImpl;
       
  2305 
       
  2306 var isInsideEventHandler = false;
       
  2307 
       
  2308 function finishEventHandler() {
       
  2309   // Here we wait until all updates have propagated, which is important
       
  2310   // when using controlled components within layers:
       
  2311   // https://github.com/facebook/react/issues/1698
       
  2312   // Then we restore state of any controlled component.
       
  2313   var controlledComponentsHavePendingUpdates = needsStateRestore();
       
  2314   if (controlledComponentsHavePendingUpdates) {
       
  2315     // If a controlled event was fired, we may need to restore the state of
       
  2316     // the DOM node back to the controlled value. This is necessary when React
       
  2317     // bails out of the update without touching the DOM.
       
  2318     flushDiscreteUpdatesImpl();
       
  2319     restoreStateIfNeeded();
       
  2320   }
       
  2321 }
       
  2322 
       
  2323 function batchedUpdates(fn, bookkeeping) {
       
  2324   if (isInsideEventHandler) {
       
  2325     // If we are currently inside another batch, we need to wait until it
       
  2326     // fully completes before restoring state.
       
  2327     return fn(bookkeeping);
       
  2328   }
       
  2329   isInsideEventHandler = true;
       
  2330   try {
       
  2331     return batchedUpdatesImpl(fn, bookkeeping);
       
  2332   } finally {
       
  2333     isInsideEventHandler = false;
       
  2334     finishEventHandler();
       
  2335   }
       
  2336 }
       
  2337 
       
  2338 function batchedEventUpdates(fn, a, b) {
       
  2339   if (isInsideEventHandler) {
       
  2340     // If we are currently inside another batch, we need to wait until it
       
  2341     // fully completes before restoring state.
       
  2342     return fn(a, b);
       
  2343   }
       
  2344   isInsideEventHandler = true;
       
  2345   try {
       
  2346     return batchedEventUpdatesImpl(fn, a, b);
       
  2347   } finally {
       
  2348     isInsideEventHandler = false;
       
  2349     finishEventHandler();
       
  2350   }
       
  2351 }
       
  2352 
       
  2353 function discreteUpdates(fn, a, b, c) {
       
  2354   var prevIsInsideEventHandler = isInsideEventHandler;
       
  2355   isInsideEventHandler = true;
       
  2356   try {
       
  2357     return discreteUpdatesImpl(fn, a, b, c);
       
  2358   } finally {
       
  2359     isInsideEventHandler = prevIsInsideEventHandler;
       
  2360     if (!isInsideEventHandler) {
       
  2361       finishEventHandler();
       
  2362     }
       
  2363   }
       
  2364 }
       
  2365 
       
  2366 var lastFlushedEventTimeStamp = 0;
       
  2367 function flushDiscreteUpdatesIfNeeded(timeStamp) {
       
  2368   // event.timeStamp isn't overly reliable due to inconsistencies in
       
  2369   // how different browsers have historically provided the time stamp.
       
  2370   // Some browsers provide high-resolution time stamps for all events,
       
  2371   // some provide low-resolution time stamps for all events. FF < 52
       
  2372   // even mixes both time stamps together. Some browsers even report
       
  2373   // negative time stamps or time stamps that are 0 (iOS9) in some cases.
       
  2374   // Given we are only comparing two time stamps with equality (!==),
       
  2375   // we are safe from the resolution differences. If the time stamp is 0
       
  2376   // we bail-out of preventing the flush, which can affect semantics,
       
  2377   // such as if an earlier flush removes or adds event listeners that
       
  2378   // are fired in the subsequent flush. However, this is the same
       
  2379   // behaviour as we had before this change, so the risks are low.
       
  2380   if (!isInsideEventHandler && (!enableFlareAPI || timeStamp === 0 || lastFlushedEventTimeStamp !== timeStamp)) {
       
  2381     lastFlushedEventTimeStamp = timeStamp;
       
  2382     flushDiscreteUpdatesImpl();
       
  2383   }
       
  2384 }
       
  2385 
       
  2386 function setBatchingImplementation(_batchedUpdatesImpl, _discreteUpdatesImpl, _flushDiscreteUpdatesImpl, _batchedEventUpdatesImpl) {
       
  2387   batchedUpdatesImpl = _batchedUpdatesImpl;
       
  2388   discreteUpdatesImpl = _discreteUpdatesImpl;
       
  2389   flushDiscreteUpdatesImpl = _flushDiscreteUpdatesImpl;
       
  2390   batchedEventUpdatesImpl = _batchedEventUpdatesImpl;
       
  2391 }
       
  2392 
       
  2393 /**
       
  2394  * @see http://www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary
       
  2395  */
       
  2396 var supportedInputTypes = {
       
  2397   color: true,
       
  2398   date: true,
       
  2399   datetime: true,
       
  2400   'datetime-local': true,
       
  2401   email: true,
       
  2402   month: true,
       
  2403   number: true,
       
  2404   password: true,
       
  2405   range: true,
       
  2406   search: true,
       
  2407   tel: true,
       
  2408   text: true,
       
  2409   time: true,
       
  2410   url: true,
       
  2411   week: true
       
  2412 };
       
  2413 
       
  2414 function isTextInputElement(elem) {
       
  2415   var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase();
       
  2416 
       
  2417   if (nodeName === 'input') {
       
  2418     return !!supportedInputTypes[elem.type];
       
  2419   }
       
  2420 
       
  2421   if (nodeName === 'textarea') {
       
  2422     return true;
       
  2423   }
       
  2424 
       
  2425   return false;
       
  2426 }
       
  2427 
       
  2428 /**
       
  2429  * HTML nodeType values that represent the type of the node
       
  2430  */
       
  2431 
       
  2432 var ELEMENT_NODE = 1;
       
  2433 var TEXT_NODE = 3;
       
  2434 var COMMENT_NODE = 8;
       
  2435 var DOCUMENT_NODE = 9;
       
  2436 var DOCUMENT_FRAGMENT_NODE = 11;
       
  2437 
       
  2438 /**
       
  2439  * Gets the target node from a native browser event by accounting for
       
  2440  * inconsistencies in browser DOM APIs.
       
  2441  *
       
  2442  * @param {object} nativeEvent Native browser event.
       
  2443  * @return {DOMEventTarget} Target node.
       
  2444  */
       
  2445 function getEventTarget(nativeEvent) {
       
  2446   // Fallback to nativeEvent.srcElement for IE9
       
  2447   // https://github.com/facebook/react/issues/12506
       
  2448   var target = nativeEvent.target || nativeEvent.srcElement || window;
       
  2449 
       
  2450   // Normalize SVG <use> element events #4963
       
  2451   if (target.correspondingUseElement) {
       
  2452     target = target.correspondingUseElement;
       
  2453   }
       
  2454 
       
  2455   // Safari may fire events on text nodes (Node.TEXT_NODE is 3).
       
  2456   // @see http://www.quirksmode.org/js/events_properties.html
       
  2457   return target.nodeType === TEXT_NODE ? target.parentNode : target;
       
  2458 }
       
  2459 
       
  2460 /**
       
  2461  * Checks if an event is supported in the current execution environment.
       
  2462  *
       
  2463  * NOTE: This will not work correctly for non-generic events such as `change`,
       
  2464  * `reset`, `load`, `error`, and `select`.
       
  2465  *
       
  2466  * Borrows from Modernizr.
       
  2467  *
       
  2468  * @param {string} eventNameSuffix Event name, e.g. "click".
       
  2469  * @return {boolean} True if the event is supported.
       
  2470  * @internal
       
  2471  * @license Modernizr 3.0.0pre (Custom Build) | MIT
       
  2472  */
       
  2473 function isEventSupported(eventNameSuffix) {
       
  2474   if (!canUseDOM) {
       
  2475     return false;
       
  2476   }
       
  2477 
       
  2478   var eventName = 'on' + eventNameSuffix;
       
  2479   var isSupported = eventName in document;
       
  2480 
       
  2481   if (!isSupported) {
       
  2482     var element = document.createElement('div');
       
  2483     element.setAttribute(eventName, 'return;');
       
  2484     isSupported = typeof element[eventName] === 'function';
       
  2485   }
       
  2486 
       
  2487   return isSupported;
       
  2488 }
       
  2489 
       
  2490 function isCheckable(elem) {
       
  2491   var type = elem.type;
       
  2492   var nodeName = elem.nodeName;
       
  2493   return nodeName && nodeName.toLowerCase() === 'input' && (type === 'checkbox' || type === 'radio');
       
  2494 }
       
  2495 
       
  2496 function getTracker(node) {
       
  2497   return node._valueTracker;
       
  2498 }
       
  2499 
       
  2500 function detachTracker(node) {
       
  2501   node._valueTracker = null;
       
  2502 }
       
  2503 
       
  2504 function getValueFromNode(node) {
       
  2505   var value = '';
       
  2506   if (!node) {
       
  2507     return value;
       
  2508   }
       
  2509 
       
  2510   if (isCheckable(node)) {
       
  2511     value = node.checked ? 'true' : 'false';
       
  2512   } else {
       
  2513     value = node.value;
       
  2514   }
       
  2515 
       
  2516   return value;
       
  2517 }
       
  2518 
       
  2519 function trackValueOnNode(node) {
       
  2520   var valueField = isCheckable(node) ? 'checked' : 'value';
       
  2521   var descriptor = Object.getOwnPropertyDescriptor(node.constructor.prototype, valueField);
       
  2522 
       
  2523   var currentValue = '' + node[valueField];
       
  2524 
       
  2525   // if someone has already defined a value or Safari, then bail
       
  2526   // and don't track value will cause over reporting of changes,
       
  2527   // but it's better then a hard failure
       
  2528   // (needed for certain tests that spyOn input values and Safari)
       
  2529   if (node.hasOwnProperty(valueField) || typeof descriptor === 'undefined' || typeof descriptor.get !== 'function' || typeof descriptor.set !== 'function') {
       
  2530     return;
       
  2531   }
       
  2532   var get = descriptor.get,
       
  2533       set = descriptor.set;
       
  2534 
       
  2535   Object.defineProperty(node, valueField, {
       
  2536     configurable: true,
       
  2537     get: function () {
       
  2538       return get.call(this);
       
  2539     },
       
  2540     set: function (value) {
       
  2541       currentValue = '' + value;
       
  2542       set.call(this, value);
       
  2543     }
       
  2544   });
       
  2545   // We could've passed this the first time
       
  2546   // but it triggers a bug in IE11 and Edge 14/15.
       
  2547   // Calling defineProperty() again should be equivalent.
       
  2548   // https://github.com/facebook/react/issues/11768
       
  2549   Object.defineProperty(node, valueField, {
       
  2550     enumerable: descriptor.enumerable
       
  2551   });
       
  2552 
       
  2553   var tracker = {
       
  2554     getValue: function () {
       
  2555       return currentValue;
       
  2556     },
       
  2557     setValue: function (value) {
       
  2558       currentValue = '' + value;
       
  2559     },
       
  2560     stopTracking: function () {
       
  2561       detachTracker(node);
       
  2562       delete node[valueField];
       
  2563     }
       
  2564   };
       
  2565   return tracker;
       
  2566 }
       
  2567 
       
  2568 function track(node) {
       
  2569   if (getTracker(node)) {
       
  2570     return;
       
  2571   }
       
  2572 
       
  2573   // TODO: Once it's just Fiber we can move this to node._wrapperState
       
  2574   node._valueTracker = trackValueOnNode(node);
       
  2575 }
       
  2576 
       
  2577 function updateValueIfChanged(node) {
       
  2578   if (!node) {
       
  2579     return false;
       
  2580   }
       
  2581 
       
  2582   var tracker = getTracker(node);
       
  2583   // if there is no tracker at this point it's unlikely
       
  2584   // that trying again will succeed
       
  2585   if (!tracker) {
       
  2586     return true;
       
  2587   }
       
  2588 
       
  2589   var lastValue = tracker.getValue();
       
  2590   var nextValue = getValueFromNode(node);
       
  2591   if (nextValue !== lastValue) {
       
  2592     tracker.setValue(nextValue);
       
  2593     return true;
       
  2594   }
       
  2595   return false;
       
  2596 }
       
  2597 
       
  2598 var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
       
  2599 
       
  2600 // Prevent newer renderers from RTE when used with older react package versions.
       
  2601 // Current owner and dispatcher used to share the same ref,
       
  2602 // but PR #14548 split them out to better support the react-debug-tools package.
       
  2603 if (!ReactSharedInternals.hasOwnProperty('ReactCurrentDispatcher')) {
       
  2604   ReactSharedInternals.ReactCurrentDispatcher = {
       
  2605     current: null
       
  2606   };
       
  2607 }
       
  2608 if (!ReactSharedInternals.hasOwnProperty('ReactCurrentBatchConfig')) {
       
  2609   ReactSharedInternals.ReactCurrentBatchConfig = {
       
  2610     suspense: null
       
  2611   };
       
  2612 }
       
  2613 
       
  2614 var BEFORE_SLASH_RE = /^(.*)[\\\/]/;
       
  2615 
       
  2616 var describeComponentFrame = function (name, source, ownerName) {
       
  2617   var sourceInfo = '';
       
  2618   if (source) {
       
  2619     var path = source.fileName;
       
  2620     var fileName = path.replace(BEFORE_SLASH_RE, '');
       
  2621     {
       
  2622       // In DEV, include code for a common special case:
       
  2623       // prefer "folder/index.js" instead of just "index.js".
       
  2624       if (/^index\./.test(fileName)) {
       
  2625         var match = path.match(BEFORE_SLASH_RE);
       
  2626         if (match) {
       
  2627           var pathBeforeSlash = match[1];
       
  2628           if (pathBeforeSlash) {
       
  2629             var folderName = pathBeforeSlash.replace(BEFORE_SLASH_RE, '');
       
  2630             fileName = folderName + '/' + fileName;
       
  2631           }
   208           }
  2632         }
   209 
  2633       }
   210           if (event.defaultPrevented) {
  2634     }
   211             // Some other error handler has prevented default.
  2635     sourceInfo = ' (at ' + fileName + ':' + source.lineNumber + ')';
   212             // Browsers silence the error report if this happens.
  2636   } else if (ownerName) {
   213             // We'll remember this to later decide whether to log it or not.
  2637     sourceInfo = ' (created by ' + ownerName + ')';
   214             if (error != null && typeof error === 'object') {
  2638   }
   215               try {
  2639   return '\n    in ' + (name || 'Unknown') + sourceInfo;
   216                 error._suppressLogging = true;
  2640 };
   217               } catch (inner) {// Ignore.
  2641 
       
  2642 // The Symbol used to tag the ReactElement-like types. If there is no native Symbol
       
  2643 // nor polyfill, then a plain number is used for performance.
       
  2644 var hasSymbol = typeof Symbol === 'function' && Symbol.for;
       
  2645 
       
  2646 var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
       
  2647 var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
       
  2648 var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
       
  2649 var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
       
  2650 var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
       
  2651 var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
       
  2652 var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace;
       
  2653 // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary
       
  2654 // (unstable) APIs that have been removed. Can we remove the symbols?
       
  2655 
       
  2656 var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
       
  2657 var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
       
  2658 var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
       
  2659 var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;
       
  2660 var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
       
  2661 var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
       
  2662 var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5;
       
  2663 var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6;
       
  2664 
       
  2665 var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
       
  2666 var FAUX_ITERATOR_SYMBOL = '@@iterator';
       
  2667 
       
  2668 function getIteratorFn(maybeIterable) {
       
  2669   if (maybeIterable === null || typeof maybeIterable !== 'object') {
       
  2670     return null;
       
  2671   }
       
  2672   var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
       
  2673   if (typeof maybeIterator === 'function') {
       
  2674     return maybeIterator;
       
  2675   }
       
  2676   return null;
       
  2677 }
       
  2678 
       
  2679 var Pending = 0;
       
  2680 var Resolved = 1;
       
  2681 var Rejected = 2;
       
  2682 
       
  2683 function refineResolvedLazyComponent(lazyComponent) {
       
  2684   return lazyComponent._status === Resolved ? lazyComponent._result : null;
       
  2685 }
       
  2686 
       
  2687 function getWrappedName(outerType, innerType, wrapperName) {
       
  2688   var functionName = innerType.displayName || innerType.name || '';
       
  2689   return outerType.displayName || (functionName !== '' ? wrapperName + '(' + functionName + ')' : wrapperName);
       
  2690 }
       
  2691 
       
  2692 function getComponentName(type) {
       
  2693   if (type == null) {
       
  2694     // Host root, text node or just invalid type.
       
  2695     return null;
       
  2696   }
       
  2697   {
       
  2698     if (typeof type.tag === 'number') {
       
  2699       warningWithoutStack$1(false, 'Received an unexpected object in getComponentName(). ' + 'This is likely a bug in React. Please file an issue.');
       
  2700     }
       
  2701   }
       
  2702   if (typeof type === 'function') {
       
  2703     return type.displayName || type.name || null;
       
  2704   }
       
  2705   if (typeof type === 'string') {
       
  2706     return type;
       
  2707   }
       
  2708   switch (type) {
       
  2709     case REACT_FRAGMENT_TYPE:
       
  2710       return 'Fragment';
       
  2711     case REACT_PORTAL_TYPE:
       
  2712       return 'Portal';
       
  2713     case REACT_PROFILER_TYPE:
       
  2714       return 'Profiler';
       
  2715     case REACT_STRICT_MODE_TYPE:
       
  2716       return 'StrictMode';
       
  2717     case REACT_SUSPENSE_TYPE:
       
  2718       return 'Suspense';
       
  2719     case REACT_SUSPENSE_LIST_TYPE:
       
  2720       return 'SuspenseList';
       
  2721   }
       
  2722   if (typeof type === 'object') {
       
  2723     switch (type.$$typeof) {
       
  2724       case REACT_CONTEXT_TYPE:
       
  2725         return 'Context.Consumer';
       
  2726       case REACT_PROVIDER_TYPE:
       
  2727         return 'Context.Provider';
       
  2728       case REACT_FORWARD_REF_TYPE:
       
  2729         return getWrappedName(type, type.render, 'ForwardRef');
       
  2730       case REACT_MEMO_TYPE:
       
  2731         return getComponentName(type.type);
       
  2732       case REACT_LAZY_TYPE:
       
  2733         {
       
  2734           var thenable = type;
       
  2735           var resolvedThenable = refineResolvedLazyComponent(thenable);
       
  2736           if (resolvedThenable) {
       
  2737             return getComponentName(resolvedThenable);
       
  2738           }
       
  2739           break;
       
  2740         }
       
  2741     }
       
  2742   }
       
  2743   return null;
       
  2744 }
       
  2745 
       
  2746 var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
       
  2747 
       
  2748 function describeFiber(fiber) {
       
  2749   switch (fiber.tag) {
       
  2750     case HostRoot:
       
  2751     case HostPortal:
       
  2752     case HostText:
       
  2753     case Fragment:
       
  2754     case ContextProvider:
       
  2755     case ContextConsumer:
       
  2756       return '';
       
  2757     default:
       
  2758       var owner = fiber._debugOwner;
       
  2759       var source = fiber._debugSource;
       
  2760       var name = getComponentName(fiber.type);
       
  2761       var ownerName = null;
       
  2762       if (owner) {
       
  2763         ownerName = getComponentName(owner.type);
       
  2764       }
       
  2765       return describeComponentFrame(name, source, ownerName);
       
  2766   }
       
  2767 }
       
  2768 
       
  2769 function getStackByFiberInDevAndProd(workInProgress) {
       
  2770   var info = '';
       
  2771   var node = workInProgress;
       
  2772   do {
       
  2773     info += describeFiber(node);
       
  2774     node = node.return;
       
  2775   } while (node);
       
  2776   return info;
       
  2777 }
       
  2778 
       
  2779 var current = null;
       
  2780 var phase = null;
       
  2781 
       
  2782 function getCurrentFiberOwnerNameInDevOrNull() {
       
  2783   {
       
  2784     if (current === null) {
       
  2785       return null;
       
  2786     }
       
  2787     var owner = current._debugOwner;
       
  2788     if (owner !== null && typeof owner !== 'undefined') {
       
  2789       return getComponentName(owner.type);
       
  2790     }
       
  2791   }
       
  2792   return null;
       
  2793 }
       
  2794 
       
  2795 function getCurrentFiberStackInDev() {
       
  2796   {
       
  2797     if (current === null) {
       
  2798       return '';
       
  2799     }
       
  2800     // Safe because if current fiber exists, we are reconciling,
       
  2801     // and it is guaranteed to be the work-in-progress version.
       
  2802     return getStackByFiberInDevAndProd(current);
       
  2803   }
       
  2804   return '';
       
  2805 }
       
  2806 
       
  2807 function resetCurrentFiber() {
       
  2808   {
       
  2809     ReactDebugCurrentFrame.getCurrentStack = null;
       
  2810     current = null;
       
  2811     phase = null;
       
  2812   }
       
  2813 }
       
  2814 
       
  2815 function setCurrentFiber(fiber) {
       
  2816   {
       
  2817     ReactDebugCurrentFrame.getCurrentStack = getCurrentFiberStackInDev;
       
  2818     current = fiber;
       
  2819     phase = null;
       
  2820   }
       
  2821 }
       
  2822 
       
  2823 function setCurrentPhase(lifeCyclePhase) {
       
  2824   {
       
  2825     phase = lifeCyclePhase;
       
  2826   }
       
  2827 }
       
  2828 
       
  2829 /**
       
  2830  * Similar to invariant but only logs a warning if the condition is not met.
       
  2831  * This can be used to log issues in development environments in critical
       
  2832  * paths. Removing the logging code for production environments will keep the
       
  2833  * same logic and follow the same code paths.
       
  2834  */
       
  2835 
       
  2836 var warning = warningWithoutStack$1;
       
  2837 
       
  2838 {
       
  2839   warning = function (condition, format) {
       
  2840     if (condition) {
       
  2841       return;
       
  2842     }
       
  2843     var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
       
  2844     var stack = ReactDebugCurrentFrame.getStackAddendum();
       
  2845     // eslint-disable-next-line react-internal/warning-and-invariant-args
       
  2846 
       
  2847     for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
       
  2848       args[_key - 2] = arguments[_key];
       
  2849     }
       
  2850 
       
  2851     warningWithoutStack$1.apply(undefined, [false, format + '%s'].concat(args, [stack]));
       
  2852   };
       
  2853 }
       
  2854 
       
  2855 var warning$1 = warning;
       
  2856 
       
  2857 // A reserved attribute.
       
  2858 // It is handled by React separately and shouldn't be written to the DOM.
       
  2859 var RESERVED = 0;
       
  2860 
       
  2861 // A simple string attribute.
       
  2862 // Attributes that aren't in the whitelist are presumed to have this type.
       
  2863 var STRING = 1;
       
  2864 
       
  2865 // A string attribute that accepts booleans in React. In HTML, these are called
       
  2866 // "enumerated" attributes with "true" and "false" as possible values.
       
  2867 // When true, it should be set to a "true" string.
       
  2868 // When false, it should be set to a "false" string.
       
  2869 var BOOLEANISH_STRING = 2;
       
  2870 
       
  2871 // A real boolean attribute.
       
  2872 // When true, it should be present (set either to an empty string or its name).
       
  2873 // When false, it should be omitted.
       
  2874 var BOOLEAN = 3;
       
  2875 
       
  2876 // An attribute that can be used as a flag as well as with a value.
       
  2877 // When true, it should be present (set either to an empty string or its name).
       
  2878 // When false, it should be omitted.
       
  2879 // For any other value, should be present with that value.
       
  2880 var OVERLOADED_BOOLEAN = 4;
       
  2881 
       
  2882 // An attribute that must be numeric or parse as a numeric.
       
  2883 // When falsy, it should be removed.
       
  2884 var NUMERIC = 5;
       
  2885 
       
  2886 // An attribute that must be positive numeric or parse as a positive numeric.
       
  2887 // When falsy, it should be removed.
       
  2888 var POSITIVE_NUMERIC = 6;
       
  2889 
       
  2890 /* eslint-disable max-len */
       
  2891 var ATTRIBUTE_NAME_START_CHAR = ':A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD';
       
  2892 /* eslint-enable max-len */
       
  2893 var ATTRIBUTE_NAME_CHAR = ATTRIBUTE_NAME_START_CHAR + '\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040';
       
  2894 
       
  2895 
       
  2896 var ROOT_ATTRIBUTE_NAME = 'data-reactroot';
       
  2897 var VALID_ATTRIBUTE_NAME_REGEX = new RegExp('^[' + ATTRIBUTE_NAME_START_CHAR + '][' + ATTRIBUTE_NAME_CHAR + ']*$');
       
  2898 
       
  2899 var hasOwnProperty = Object.prototype.hasOwnProperty;
       
  2900 var illegalAttributeNameCache = {};
       
  2901 var validatedAttributeNameCache = {};
       
  2902 
       
  2903 function isAttributeNameSafe(attributeName) {
       
  2904   if (hasOwnProperty.call(validatedAttributeNameCache, attributeName)) {
       
  2905     return true;
       
  2906   }
       
  2907   if (hasOwnProperty.call(illegalAttributeNameCache, attributeName)) {
       
  2908     return false;
       
  2909   }
       
  2910   if (VALID_ATTRIBUTE_NAME_REGEX.test(attributeName)) {
       
  2911     validatedAttributeNameCache[attributeName] = true;
       
  2912     return true;
       
  2913   }
       
  2914   illegalAttributeNameCache[attributeName] = true;
       
  2915   {
       
  2916     warning$1(false, 'Invalid attribute name: `%s`', attributeName);
       
  2917   }
       
  2918   return false;
       
  2919 }
       
  2920 
       
  2921 function shouldIgnoreAttribute(name, propertyInfo, isCustomComponentTag) {
       
  2922   if (propertyInfo !== null) {
       
  2923     return propertyInfo.type === RESERVED;
       
  2924   }
       
  2925   if (isCustomComponentTag) {
       
  2926     return false;
       
  2927   }
       
  2928   if (name.length > 2 && (name[0] === 'o' || name[0] === 'O') && (name[1] === 'n' || name[1] === 'N')) {
       
  2929     return true;
       
  2930   }
       
  2931   return false;
       
  2932 }
       
  2933 
       
  2934 function shouldRemoveAttributeWithWarning(name, value, propertyInfo, isCustomComponentTag) {
       
  2935   if (propertyInfo !== null && propertyInfo.type === RESERVED) {
       
  2936     return false;
       
  2937   }
       
  2938   switch (typeof value) {
       
  2939     case 'function':
       
  2940     // $FlowIssue symbol is perfectly valid here
       
  2941     case 'symbol':
       
  2942       // eslint-disable-line
       
  2943       return true;
       
  2944     case 'boolean':
       
  2945       {
       
  2946         if (isCustomComponentTag) {
       
  2947           return false;
       
  2948         }
       
  2949         if (propertyInfo !== null) {
       
  2950           return !propertyInfo.acceptsBooleans;
       
  2951         } else {
       
  2952           var prefix = name.toLowerCase().slice(0, 5);
       
  2953           return prefix !== 'data-' && prefix !== 'aria-';
       
  2954         }
       
  2955       }
       
  2956     default:
       
  2957       return false;
       
  2958   }
       
  2959 }
       
  2960 
       
  2961 function shouldRemoveAttribute(name, value, propertyInfo, isCustomComponentTag) {
       
  2962   if (value === null || typeof value === 'undefined') {
       
  2963     return true;
       
  2964   }
       
  2965   if (shouldRemoveAttributeWithWarning(name, value, propertyInfo, isCustomComponentTag)) {
       
  2966     return true;
       
  2967   }
       
  2968   if (isCustomComponentTag) {
       
  2969     return false;
       
  2970   }
       
  2971   if (propertyInfo !== null) {
       
  2972     switch (propertyInfo.type) {
       
  2973       case BOOLEAN:
       
  2974         return !value;
       
  2975       case OVERLOADED_BOOLEAN:
       
  2976         return value === false;
       
  2977       case NUMERIC:
       
  2978         return isNaN(value);
       
  2979       case POSITIVE_NUMERIC:
       
  2980         return isNaN(value) || value < 1;
       
  2981     }
       
  2982   }
       
  2983   return false;
       
  2984 }
       
  2985 
       
  2986 function getPropertyInfo(name) {
       
  2987   return properties.hasOwnProperty(name) ? properties[name] : null;
       
  2988 }
       
  2989 
       
  2990 function PropertyInfoRecord(name, type, mustUseProperty, attributeName, attributeNamespace, sanitizeURL) {
       
  2991   this.acceptsBooleans = type === BOOLEANISH_STRING || type === BOOLEAN || type === OVERLOADED_BOOLEAN;
       
  2992   this.attributeName = attributeName;
       
  2993   this.attributeNamespace = attributeNamespace;
       
  2994   this.mustUseProperty = mustUseProperty;
       
  2995   this.propertyName = name;
       
  2996   this.type = type;
       
  2997   this.sanitizeURL = sanitizeURL;
       
  2998 }
       
  2999 
       
  3000 // When adding attributes to this list, be sure to also add them to
       
  3001 // the `possibleStandardNames` module to ensure casing and incorrect
       
  3002 // name warnings.
       
  3003 var properties = {};
       
  3004 
       
  3005 // These props are reserved by React. They shouldn't be written to the DOM.
       
  3006 ['children', 'dangerouslySetInnerHTML',
       
  3007 // TODO: This prevents the assignment of defaultValue to regular
       
  3008 // elements (not just inputs). Now that ReactDOMInput assigns to the
       
  3009 // defaultValue property -- do we need this?
       
  3010 'defaultValue', 'defaultChecked', 'innerHTML', 'suppressContentEditableWarning', 'suppressHydrationWarning', 'style'].forEach(function (name) {
       
  3011   properties[name] = new PropertyInfoRecord(name, RESERVED, false, // mustUseProperty
       
  3012   name, // attributeName
       
  3013   null, // attributeNamespace
       
  3014   false);
       
  3015 } // sanitizeURL
       
  3016 );
       
  3017 
       
  3018 // A few React string attributes have a different name.
       
  3019 // This is a mapping from React prop names to the attribute names.
       
  3020 [['acceptCharset', 'accept-charset'], ['className', 'class'], ['htmlFor', 'for'], ['httpEquiv', 'http-equiv']].forEach(function (_ref) {
       
  3021   var name = _ref[0],
       
  3022       attributeName = _ref[1];
       
  3023 
       
  3024   properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
       
  3025   attributeName, // attributeName
       
  3026   null, // attributeNamespace
       
  3027   false);
       
  3028 } // sanitizeURL
       
  3029 );
       
  3030 
       
  3031 // These are "enumerated" HTML attributes that accept "true" and "false".
       
  3032 // In React, we let users pass `true` and `false` even though technically
       
  3033 // these aren't boolean attributes (they are coerced to strings).
       
  3034 ['contentEditable', 'draggable', 'spellCheck', 'value'].forEach(function (name) {
       
  3035   properties[name] = new PropertyInfoRecord(name, BOOLEANISH_STRING, false, // mustUseProperty
       
  3036   name.toLowerCase(), // attributeName
       
  3037   null, // attributeNamespace
       
  3038   false);
       
  3039 } // sanitizeURL
       
  3040 );
       
  3041 
       
  3042 // These are "enumerated" SVG attributes that accept "true" and "false".
       
  3043 // In React, we let users pass `true` and `false` even though technically
       
  3044 // these aren't boolean attributes (they are coerced to strings).
       
  3045 // Since these are SVG attributes, their attribute names are case-sensitive.
       
  3046 ['autoReverse', 'externalResourcesRequired', 'focusable', 'preserveAlpha'].forEach(function (name) {
       
  3047   properties[name] = new PropertyInfoRecord(name, BOOLEANISH_STRING, false, // mustUseProperty
       
  3048   name, // attributeName
       
  3049   null, // attributeNamespace
       
  3050   false);
       
  3051 } // sanitizeURL
       
  3052 );
       
  3053 
       
  3054 // These are HTML boolean attributes.
       
  3055 ['allowFullScreen', 'async',
       
  3056 // Note: there is a special case that prevents it from being written to the DOM
       
  3057 // on the client side because the browsers are inconsistent. Instead we call focus().
       
  3058 'autoFocus', 'autoPlay', 'controls', 'default', 'defer', 'disabled', 'disablePictureInPicture', 'formNoValidate', 'hidden', 'loop', 'noModule', 'noValidate', 'open', 'playsInline', 'readOnly', 'required', 'reversed', 'scoped', 'seamless',
       
  3059 // Microdata
       
  3060 'itemScope'].forEach(function (name) {
       
  3061   properties[name] = new PropertyInfoRecord(name, BOOLEAN, false, // mustUseProperty
       
  3062   name.toLowerCase(), // attributeName
       
  3063   null, // attributeNamespace
       
  3064   false);
       
  3065 } // sanitizeURL
       
  3066 );
       
  3067 
       
  3068 // These are the few React props that we set as DOM properties
       
  3069 // rather than attributes. These are all booleans.
       
  3070 ['checked',
       
  3071 // Note: `option.selected` is not updated if `select.multiple` is
       
  3072 // disabled with `removeAttribute`. We have special logic for handling this.
       
  3073 'multiple', 'muted', 'selected'].forEach(function (name) {
       
  3074   properties[name] = new PropertyInfoRecord(name, BOOLEAN, true, // mustUseProperty
       
  3075   name, // attributeName
       
  3076   null, // attributeNamespace
       
  3077   false);
       
  3078 } // sanitizeURL
       
  3079 );
       
  3080 
       
  3081 // These are HTML attributes that are "overloaded booleans": they behave like
       
  3082 // booleans, but can also accept a string value.
       
  3083 ['capture', 'download'].forEach(function (name) {
       
  3084   properties[name] = new PropertyInfoRecord(name, OVERLOADED_BOOLEAN, false, // mustUseProperty
       
  3085   name, // attributeName
       
  3086   null, // attributeNamespace
       
  3087   false);
       
  3088 } // sanitizeURL
       
  3089 );
       
  3090 
       
  3091 // These are HTML attributes that must be positive numbers.
       
  3092 ['cols', 'rows', 'size', 'span'].forEach(function (name) {
       
  3093   properties[name] = new PropertyInfoRecord(name, POSITIVE_NUMERIC, false, // mustUseProperty
       
  3094   name, // attributeName
       
  3095   null, // attributeNamespace
       
  3096   false);
       
  3097 } // sanitizeURL
       
  3098 );
       
  3099 
       
  3100 // These are HTML attributes that must be numbers.
       
  3101 ['rowSpan', 'start'].forEach(function (name) {
       
  3102   properties[name] = new PropertyInfoRecord(name, NUMERIC, false, // mustUseProperty
       
  3103   name.toLowerCase(), // attributeName
       
  3104   null, // attributeNamespace
       
  3105   false);
       
  3106 } // sanitizeURL
       
  3107 );
       
  3108 
       
  3109 var CAMELIZE = /[\-\:]([a-z])/g;
       
  3110 var capitalize = function (token) {
       
  3111   return token[1].toUpperCase();
       
  3112 };
       
  3113 
       
  3114 // This is a list of all SVG attributes that need special casing, namespacing,
       
  3115 // or boolean value assignment. Regular attributes that just accept strings
       
  3116 // and have the same names are omitted, just like in the HTML whitelist.
       
  3117 // Some of these attributes can be hard to find. This list was created by
       
  3118 // scrapping the MDN documentation.
       
  3119 ['accent-height', 'alignment-baseline', 'arabic-form', 'baseline-shift', 'cap-height', 'clip-path', 'clip-rule', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'dominant-baseline', 'enable-background', 'fill-opacity', 'fill-rule', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'glyph-name', 'glyph-orientation-horizontal', 'glyph-orientation-vertical', 'horiz-adv-x', 'horiz-origin-x', 'image-rendering', 'letter-spacing', 'lighting-color', 'marker-end', 'marker-mid', 'marker-start', 'overline-position', 'overline-thickness', 'paint-order', 'panose-1', 'pointer-events', 'rendering-intent', 'shape-rendering', 'stop-color', 'stop-opacity', 'strikethrough-position', 'strikethrough-thickness', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke-width', 'text-anchor', 'text-decoration', 'text-rendering', 'underline-position', 'underline-thickness', 'unicode-bidi', 'unicode-range', 'units-per-em', 'v-alphabetic', 'v-hanging', 'v-ideographic', 'v-mathematical', 'vector-effect', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'word-spacing', 'writing-mode', 'xmlns:xlink', 'x-height'].forEach(function (attributeName) {
       
  3120   var name = attributeName.replace(CAMELIZE, capitalize);
       
  3121   properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
       
  3122   attributeName, null, // attributeNamespace
       
  3123   false);
       
  3124 } // sanitizeURL
       
  3125 );
       
  3126 
       
  3127 // String SVG attributes with the xlink namespace.
       
  3128 ['xlink:actuate', 'xlink:arcrole', 'xlink:role', 'xlink:show', 'xlink:title', 'xlink:type'].forEach(function (attributeName) {
       
  3129   var name = attributeName.replace(CAMELIZE, capitalize);
       
  3130   properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
       
  3131   attributeName, 'http://www.w3.org/1999/xlink', false);
       
  3132 } // sanitizeURL
       
  3133 );
       
  3134 
       
  3135 // String SVG attributes with the xml namespace.
       
  3136 ['xml:base', 'xml:lang', 'xml:space'].forEach(function (attributeName) {
       
  3137   var name = attributeName.replace(CAMELIZE, capitalize);
       
  3138   properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
       
  3139   attributeName, 'http://www.w3.org/XML/1998/namespace', false);
       
  3140 } // sanitizeURL
       
  3141 );
       
  3142 
       
  3143 // These attribute exists both in HTML and SVG.
       
  3144 // The attribute name is case-sensitive in SVG so we can't just use
       
  3145 // the React name like we do for attributes that exist only in HTML.
       
  3146 ['tabIndex', 'crossOrigin'].forEach(function (attributeName) {
       
  3147   properties[attributeName] = new PropertyInfoRecord(attributeName, STRING, false, // mustUseProperty
       
  3148   attributeName.toLowerCase(), // attributeName
       
  3149   null, // attributeNamespace
       
  3150   false);
       
  3151 } // sanitizeURL
       
  3152 );
       
  3153 
       
  3154 // These attributes accept URLs. These must not allow javascript: URLS.
       
  3155 // These will also need to accept Trusted Types object in the future.
       
  3156 var xlinkHref = 'xlinkHref';
       
  3157 properties[xlinkHref] = new PropertyInfoRecord('xlinkHref', STRING, false, // mustUseProperty
       
  3158 'xlink:href', 'http://www.w3.org/1999/xlink', true);
       
  3159 
       
  3160 ['src', 'href', 'action', 'formAction'].forEach(function (attributeName) {
       
  3161   properties[attributeName] = new PropertyInfoRecord(attributeName, STRING, false, // mustUseProperty
       
  3162   attributeName.toLowerCase(), // attributeName
       
  3163   null, // attributeNamespace
       
  3164   true);
       
  3165 } // sanitizeURL
       
  3166 );
       
  3167 
       
  3168 var ReactDebugCurrentFrame$1 = null;
       
  3169 {
       
  3170   ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
       
  3171 }
       
  3172 
       
  3173 // A javascript: URL can contain leading C0 control or \u0020 SPACE,
       
  3174 // and any newline or tab are filtered out as if they're not part of the URL.
       
  3175 // https://url.spec.whatwg.org/#url-parsing
       
  3176 // Tab or newline are defined as \r\n\t:
       
  3177 // https://infra.spec.whatwg.org/#ascii-tab-or-newline
       
  3178 // A C0 control is a code point in the range \u0000 NULL to \u001F
       
  3179 // INFORMATION SEPARATOR ONE, inclusive:
       
  3180 // https://infra.spec.whatwg.org/#c0-control-or-space
       
  3181 
       
  3182 /* eslint-disable max-len */
       
  3183 var isJavaScriptProtocol = /^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*\:/i;
       
  3184 
       
  3185 var didWarn = false;
       
  3186 
       
  3187 function sanitizeURL(url) {
       
  3188   if (disableJavaScriptURLs) {
       
  3189     (function () {
       
  3190       if (!!isJavaScriptProtocol.test(url)) {
       
  3191         {
       
  3192           throw ReactError(Error('React has blocked a javascript: URL as a security precaution.' + (ReactDebugCurrentFrame$1.getStackAddendum())));
       
  3193         }
       
  3194       }
       
  3195     })();
       
  3196   } else if (true && !didWarn && isJavaScriptProtocol.test(url)) {
       
  3197     didWarn = true;
       
  3198     warning$1(false, 'A future version of React will block javascript: URLs as a security precaution. ' + 'Use event handlers instead if you can. If you need to generate unsafe HTML try ' + 'using dangerouslySetInnerHTML instead. React was passed %s.', JSON.stringify(url));
       
  3199   }
       
  3200 }
       
  3201 
       
  3202 /**
       
  3203  * Get the value for a property on a node. Only used in DEV for SSR validation.
       
  3204  * The "expected" argument is used as a hint of what the expected value is.
       
  3205  * Some properties have multiple equivalent values.
       
  3206  */
       
  3207 function getValueForProperty(node, name, expected, propertyInfo) {
       
  3208   {
       
  3209     if (propertyInfo.mustUseProperty) {
       
  3210       var propertyName = propertyInfo.propertyName;
       
  3211 
       
  3212       return node[propertyName];
       
  3213     } else {
       
  3214       if (!disableJavaScriptURLs && propertyInfo.sanitizeURL) {
       
  3215         // If we haven't fully disabled javascript: URLs, and if
       
  3216         // the hydration is successful of a javascript: URL, we
       
  3217         // still want to warn on the client.
       
  3218         sanitizeURL('' + expected);
       
  3219       }
       
  3220 
       
  3221       var attributeName = propertyInfo.attributeName;
       
  3222 
       
  3223       var stringValue = null;
       
  3224 
       
  3225       if (propertyInfo.type === OVERLOADED_BOOLEAN) {
       
  3226         if (node.hasAttribute(attributeName)) {
       
  3227           var value = node.getAttribute(attributeName);
       
  3228           if (value === '') {
       
  3229             return true;
       
  3230           }
       
  3231           if (shouldRemoveAttribute(name, expected, propertyInfo, false)) {
       
  3232             return value;
       
  3233           }
       
  3234           if (value === '' + expected) {
       
  3235             return expected;
       
  3236           }
       
  3237           return value;
       
  3238         }
       
  3239       } else if (node.hasAttribute(attributeName)) {
       
  3240         if (shouldRemoveAttribute(name, expected, propertyInfo, false)) {
       
  3241           // We had an attribute but shouldn't have had one, so read it
       
  3242           // for the error message.
       
  3243           return node.getAttribute(attributeName);
       
  3244         }
       
  3245         if (propertyInfo.type === BOOLEAN) {
       
  3246           // If this was a boolean, it doesn't matter what the value is
       
  3247           // the fact that we have it is the same as the expected.
       
  3248           return expected;
       
  3249         }
       
  3250         // Even if this property uses a namespace we use getAttribute
       
  3251         // because we assume its namespaced name is the same as our config.
       
  3252         // To use getAttributeNS we need the local name which we don't have
       
  3253         // in our config atm.
       
  3254         stringValue = node.getAttribute(attributeName);
       
  3255       }
       
  3256 
       
  3257       if (shouldRemoveAttribute(name, expected, propertyInfo, false)) {
       
  3258         return stringValue === null ? expected : stringValue;
       
  3259       } else if (stringValue === '' + expected) {
       
  3260         return expected;
       
  3261       } else {
       
  3262         return stringValue;
       
  3263       }
       
  3264     }
       
  3265   }
       
  3266 }
       
  3267 
       
  3268 /**
       
  3269  * Get the value for a attribute on a node. Only used in DEV for SSR validation.
       
  3270  * The third argument is used as a hint of what the expected value is. Some
       
  3271  * attributes have multiple equivalent values.
       
  3272  */
       
  3273 function getValueForAttribute(node, name, expected) {
       
  3274   {
       
  3275     if (!isAttributeNameSafe(name)) {
       
  3276       return;
       
  3277     }
       
  3278     if (!node.hasAttribute(name)) {
       
  3279       return expected === undefined ? undefined : null;
       
  3280     }
       
  3281     var value = node.getAttribute(name);
       
  3282     if (value === '' + expected) {
       
  3283       return expected;
       
  3284     }
       
  3285     return value;
       
  3286   }
       
  3287 }
       
  3288 
       
  3289 /**
       
  3290  * Sets the value for a property on a node.
       
  3291  *
       
  3292  * @param {DOMElement} node
       
  3293  * @param {string} name
       
  3294  * @param {*} value
       
  3295  */
       
  3296 function setValueForProperty(node, name, value, isCustomComponentTag) {
       
  3297   var propertyInfo = getPropertyInfo(name);
       
  3298   if (shouldIgnoreAttribute(name, propertyInfo, isCustomComponentTag)) {
       
  3299     return;
       
  3300   }
       
  3301   if (shouldRemoveAttribute(name, value, propertyInfo, isCustomComponentTag)) {
       
  3302     value = null;
       
  3303   }
       
  3304   // If the prop isn't in the special list, treat it as a simple attribute.
       
  3305   if (isCustomComponentTag || propertyInfo === null) {
       
  3306     if (isAttributeNameSafe(name)) {
       
  3307       var _attributeName = name;
       
  3308       if (value === null) {
       
  3309         node.removeAttribute(_attributeName);
       
  3310       } else {
       
  3311         node.setAttribute(_attributeName, '' + value);
       
  3312       }
       
  3313     }
       
  3314     return;
       
  3315   }
       
  3316   var mustUseProperty = propertyInfo.mustUseProperty;
       
  3317 
       
  3318   if (mustUseProperty) {
       
  3319     var propertyName = propertyInfo.propertyName;
       
  3320 
       
  3321     if (value === null) {
       
  3322       var type = propertyInfo.type;
       
  3323 
       
  3324       node[propertyName] = type === BOOLEAN ? false : '';
       
  3325     } else {
       
  3326       // Contrary to `setAttribute`, object properties are properly
       
  3327       // `toString`ed by IE8/9.
       
  3328       node[propertyName] = value;
       
  3329     }
       
  3330     return;
       
  3331   }
       
  3332   // The rest are treated as attributes with special cases.
       
  3333   var attributeName = propertyInfo.attributeName,
       
  3334       attributeNamespace = propertyInfo.attributeNamespace;
       
  3335 
       
  3336   if (value === null) {
       
  3337     node.removeAttribute(attributeName);
       
  3338   } else {
       
  3339     var _type = propertyInfo.type;
       
  3340 
       
  3341     var attributeValue = void 0;
       
  3342     if (_type === BOOLEAN || _type === OVERLOADED_BOOLEAN && value === true) {
       
  3343       attributeValue = '';
       
  3344     } else {
       
  3345       // `setAttribute` with objects becomes only `[object]` in IE8/9,
       
  3346       // ('' + value) makes it output the correct toString()-value.
       
  3347       attributeValue = '' + value;
       
  3348       if (propertyInfo.sanitizeURL) {
       
  3349         sanitizeURL(attributeValue);
       
  3350       }
       
  3351     }
       
  3352     if (attributeNamespace) {
       
  3353       node.setAttributeNS(attributeNamespace, attributeName, attributeValue);
       
  3354     } else {
       
  3355       node.setAttribute(attributeName, attributeValue);
       
  3356     }
       
  3357   }
       
  3358 }
       
  3359 
       
  3360 // Flow does not allow string concatenation of most non-string types. To work
       
  3361 // around this limitation, we use an opaque type that can only be obtained by
       
  3362 // passing the value through getToStringValue first.
       
  3363 function toString(value) {
       
  3364   return '' + value;
       
  3365 }
       
  3366 
       
  3367 function getToStringValue(value) {
       
  3368   switch (typeof value) {
       
  3369     case 'boolean':
       
  3370     case 'number':
       
  3371     case 'object':
       
  3372     case 'string':
       
  3373     case 'undefined':
       
  3374       return value;
       
  3375     default:
       
  3376       // function, symbol are assigned as empty strings
       
  3377       return '';
       
  3378   }
       
  3379 }
       
  3380 
       
  3381 /**
       
  3382  * Copyright (c) 2013-present, Facebook, Inc.
       
  3383  *
       
  3384  * This source code is licensed under the MIT license found in the
       
  3385  * LICENSE file in the root directory of this source tree.
       
  3386  */
       
  3387 
       
  3388 
       
  3389 
       
  3390 var ReactPropTypesSecret$1 = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
       
  3391 
       
  3392 var ReactPropTypesSecret_1 = ReactPropTypesSecret$1;
       
  3393 
       
  3394 /**
       
  3395  * Copyright (c) 2013-present, Facebook, Inc.
       
  3396  *
       
  3397  * This source code is licensed under the MIT license found in the
       
  3398  * LICENSE file in the root directory of this source tree.
       
  3399  */
       
  3400 
       
  3401 
       
  3402 
       
  3403 var printWarning = function() {};
       
  3404 
       
  3405 {
       
  3406   var ReactPropTypesSecret = ReactPropTypesSecret_1;
       
  3407   var loggedTypeFailures = {};
       
  3408 
       
  3409   printWarning = function(text) {
       
  3410     var message = 'Warning: ' + text;
       
  3411     if (typeof console !== 'undefined') {
       
  3412       console.error(message);
       
  3413     }
       
  3414     try {
       
  3415       // --- Welcome to debugging React ---
       
  3416       // This error was thrown as a convenience so that you can use this stack
       
  3417       // to find the callsite that caused this warning to fire.
       
  3418       throw new Error(message);
       
  3419     } catch (x) {}
       
  3420   };
       
  3421 }
       
  3422 
       
  3423 /**
       
  3424  * Assert that the values match with the type specs.
       
  3425  * Error messages are memorized and will only be shown once.
       
  3426  *
       
  3427  * @param {object} typeSpecs Map of name to a ReactPropType
       
  3428  * @param {object} values Runtime values that need to be type-checked
       
  3429  * @param {string} location e.g. "prop", "context", "child context"
       
  3430  * @param {string} componentName Name of the component for error messages.
       
  3431  * @param {?Function} getStack Returns the component stack.
       
  3432  * @private
       
  3433  */
       
  3434 function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
       
  3435   {
       
  3436     for (var typeSpecName in typeSpecs) {
       
  3437       if (typeSpecs.hasOwnProperty(typeSpecName)) {
       
  3438         var error;
       
  3439         // Prop type validation may throw. In case they do, we don't want to
       
  3440         // fail the render phase where it didn't fail before. So we log it.
       
  3441         // After these have been cleaned up, we'll let them throw.
       
  3442         try {
       
  3443           // This is intentionally an invariant that gets caught. It's the same
       
  3444           // behavior as without this statement except with a better message.
       
  3445           if (typeof typeSpecs[typeSpecName] !== 'function') {
       
  3446             var err = Error(
       
  3447               (componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' +
       
  3448               'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.'
       
  3449             );
       
  3450             err.name = 'Invariant Violation';
       
  3451             throw err;
       
  3452           }
       
  3453           error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);
       
  3454         } catch (ex) {
       
  3455           error = ex;
       
  3456         }
       
  3457         if (error && !(error instanceof Error)) {
       
  3458           printWarning(
       
  3459             (componentName || 'React class') + ': type specification of ' +
       
  3460             location + ' `' + typeSpecName + '` is invalid; the type checker ' +
       
  3461             'function must return `null` or an `Error` but returned a ' + typeof error + '. ' +
       
  3462             'You may have forgotten to pass an argument to the type checker ' +
       
  3463             'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' +
       
  3464             'shape all require an argument).'
       
  3465           );
       
  3466 
       
  3467         }
       
  3468         if (error instanceof Error && !(error.message in loggedTypeFailures)) {
       
  3469           // Only monitor this failure once because there tends to be a lot of the
       
  3470           // same error.
       
  3471           loggedTypeFailures[error.message] = true;
       
  3472 
       
  3473           var stack = getStack ? getStack() : '';
       
  3474 
       
  3475           printWarning(
       
  3476             'Failed ' + location + ' type: ' + error.message + (stack != null ? stack : '')
       
  3477           );
       
  3478         }
       
  3479       }
       
  3480     }
       
  3481   }
       
  3482 }
       
  3483 
       
  3484 var checkPropTypes_1 = checkPropTypes;
       
  3485 
       
  3486 var ReactDebugCurrentFrame$2 = null;
       
  3487 
       
  3488 var ReactControlledValuePropTypes = {
       
  3489   checkPropTypes: null
       
  3490 };
       
  3491 
       
  3492 {
       
  3493   ReactDebugCurrentFrame$2 = ReactSharedInternals.ReactDebugCurrentFrame;
       
  3494 
       
  3495   var hasReadOnlyValue = {
       
  3496     button: true,
       
  3497     checkbox: true,
       
  3498     image: true,
       
  3499     hidden: true,
       
  3500     radio: true,
       
  3501     reset: true,
       
  3502     submit: true
       
  3503   };
       
  3504 
       
  3505   var propTypes = {
       
  3506     value: function (props, propName, componentName) {
       
  3507       if (hasReadOnlyValue[props.type] || props.onChange || props.readOnly || props.disabled || props[propName] == null || enableFlareAPI && props.listeners) {
       
  3508         return null;
       
  3509       }
       
  3510       return new Error('You provided a `value` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultValue`. Otherwise, ' + 'set either `onChange` or `readOnly`.');
       
  3511     },
       
  3512     checked: function (props, propName, componentName) {
       
  3513       if (props.onChange || props.readOnly || props.disabled || props[propName] == null || enableFlareAPI && props.listeners) {
       
  3514         return null;
       
  3515       }
       
  3516       return new Error('You provided a `checked` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultChecked`. Otherwise, ' + 'set either `onChange` or `readOnly`.');
       
  3517     }
       
  3518   };
       
  3519 
       
  3520   /**
       
  3521    * Provide a linked `value` attribute for controlled forms. You should not use
       
  3522    * this outside of the ReactDOM controlled form components.
       
  3523    */
       
  3524   ReactControlledValuePropTypes.checkPropTypes = function (tagName, props) {
       
  3525     checkPropTypes_1(propTypes, props, 'prop', tagName, ReactDebugCurrentFrame$2.getStackAddendum);
       
  3526   };
       
  3527 }
       
  3528 
       
  3529 // TODO: direct imports like some-package/src/* are bad. Fix me.
       
  3530 var didWarnValueDefaultValue = false;
       
  3531 var didWarnCheckedDefaultChecked = false;
       
  3532 var didWarnControlledToUncontrolled = false;
       
  3533 var didWarnUncontrolledToControlled = false;
       
  3534 
       
  3535 function isControlled(props) {
       
  3536   var usesChecked = props.type === 'checkbox' || props.type === 'radio';
       
  3537   return usesChecked ? props.checked != null : props.value != null;
       
  3538 }
       
  3539 
       
  3540 /**
       
  3541  * Implements an <input> host component that allows setting these optional
       
  3542  * props: `checked`, `value`, `defaultChecked`, and `defaultValue`.
       
  3543  *
       
  3544  * If `checked` or `value` are not supplied (or null/undefined), user actions
       
  3545  * that affect the checked state or value will trigger updates to the element.
       
  3546  *
       
  3547  * If they are supplied (and not null/undefined), the rendered element will not
       
  3548  * trigger updates to the element. Instead, the props must change in order for
       
  3549  * the rendered element to be updated.
       
  3550  *
       
  3551  * The rendered element will be initialized as unchecked (or `defaultChecked`)
       
  3552  * with an empty value (or `defaultValue`).
       
  3553  *
       
  3554  * See http://www.w3.org/TR/2012/WD-html5-20121025/the-input-element.html
       
  3555  */
       
  3556 
       
  3557 function getHostProps(element, props) {
       
  3558   var node = element;
       
  3559   var checked = props.checked;
       
  3560 
       
  3561   var hostProps = _assign({}, props, {
       
  3562     defaultChecked: undefined,
       
  3563     defaultValue: undefined,
       
  3564     value: undefined,
       
  3565     checked: checked != null ? checked : node._wrapperState.initialChecked
       
  3566   });
       
  3567 
       
  3568   return hostProps;
       
  3569 }
       
  3570 
       
  3571 function initWrapperState(element, props) {
       
  3572   {
       
  3573     ReactControlledValuePropTypes.checkPropTypes('input', props);
       
  3574 
       
  3575     if (props.checked !== undefined && props.defaultChecked !== undefined && !didWarnCheckedDefaultChecked) {
       
  3576       warning$1(false, '%s contains an input of type %s with both checked and defaultChecked props. ' + 'Input elements must be either controlled or uncontrolled ' + '(specify either the checked prop, or the defaultChecked prop, but not ' + 'both). Decide between using a controlled or uncontrolled input ' + 'element and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components', getCurrentFiberOwnerNameInDevOrNull() || 'A component', props.type);
       
  3577       didWarnCheckedDefaultChecked = true;
       
  3578     }
       
  3579     if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValueDefaultValue) {
       
  3580       warning$1(false, '%s contains an input of type %s with both value and defaultValue props. ' + 'Input elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled input ' + 'element and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components', getCurrentFiberOwnerNameInDevOrNull() || 'A component', props.type);
       
  3581       didWarnValueDefaultValue = true;
       
  3582     }
       
  3583   }
       
  3584 
       
  3585   var node = element;
       
  3586   var defaultValue = props.defaultValue == null ? '' : props.defaultValue;
       
  3587 
       
  3588   node._wrapperState = {
       
  3589     initialChecked: props.checked != null ? props.checked : props.defaultChecked,
       
  3590     initialValue: getToStringValue(props.value != null ? props.value : defaultValue),
       
  3591     controlled: isControlled(props)
       
  3592   };
       
  3593 }
       
  3594 
       
  3595 function updateChecked(element, props) {
       
  3596   var node = element;
       
  3597   var checked = props.checked;
       
  3598   if (checked != null) {
       
  3599     setValueForProperty(node, 'checked', checked, false);
       
  3600   }
       
  3601 }
       
  3602 
       
  3603 function updateWrapper(element, props) {
       
  3604   var node = element;
       
  3605   {
       
  3606     var _controlled = isControlled(props);
       
  3607 
       
  3608     if (!node._wrapperState.controlled && _controlled && !didWarnUncontrolledToControlled) {
       
  3609       warning$1(false, 'A component is changing an uncontrolled input of type %s to be controlled. ' + 'Input elements should not switch from uncontrolled to controlled (or vice versa). ' + 'Decide between using a controlled or uncontrolled input ' + 'element for the lifetime of the component. More info: https://fb.me/react-controlled-components', props.type);
       
  3610       didWarnUncontrolledToControlled = true;
       
  3611     }
       
  3612     if (node._wrapperState.controlled && !_controlled && !didWarnControlledToUncontrolled) {
       
  3613       warning$1(false, 'A component is changing a controlled input of type %s to be uncontrolled. ' + 'Input elements should not switch from controlled to uncontrolled (or vice versa). ' + 'Decide between using a controlled or uncontrolled input ' + 'element for the lifetime of the component. More info: https://fb.me/react-controlled-components', props.type);
       
  3614       didWarnControlledToUncontrolled = true;
       
  3615     }
       
  3616   }
       
  3617 
       
  3618   updateChecked(element, props);
       
  3619 
       
  3620   var value = getToStringValue(props.value);
       
  3621   var type = props.type;
       
  3622 
       
  3623   if (value != null) {
       
  3624     if (type === 'number') {
       
  3625       if (value === 0 && node.value === '' ||
       
  3626       // We explicitly want to coerce to number here if possible.
       
  3627       // eslint-disable-next-line
       
  3628       node.value != value) {
       
  3629         node.value = toString(value);
       
  3630       }
       
  3631     } else if (node.value !== toString(value)) {
       
  3632       node.value = toString(value);
       
  3633     }
       
  3634   } else if (type === 'submit' || type === 'reset') {
       
  3635     // Submit/reset inputs need the attribute removed completely to avoid
       
  3636     // blank-text buttons.
       
  3637     node.removeAttribute('value');
       
  3638     return;
       
  3639   }
       
  3640 
       
  3641   if (disableInputAttributeSyncing) {
       
  3642     // When not syncing the value attribute, React only assigns a new value
       
  3643     // whenever the defaultValue React prop has changed. When not present,
       
  3644     // React does nothing
       
  3645     if (props.hasOwnProperty('defaultValue')) {
       
  3646       setDefaultValue(node, props.type, getToStringValue(props.defaultValue));
       
  3647     }
       
  3648   } else {
       
  3649     // When syncing the value attribute, the value comes from a cascade of
       
  3650     // properties:
       
  3651     //  1. The value React property
       
  3652     //  2. The defaultValue React property
       
  3653     //  3. Otherwise there should be no change
       
  3654     if (props.hasOwnProperty('value')) {
       
  3655       setDefaultValue(node, props.type, value);
       
  3656     } else if (props.hasOwnProperty('defaultValue')) {
       
  3657       setDefaultValue(node, props.type, getToStringValue(props.defaultValue));
       
  3658     }
       
  3659   }
       
  3660 
       
  3661   if (disableInputAttributeSyncing) {
       
  3662     // When not syncing the checked attribute, the attribute is directly
       
  3663     // controllable from the defaultValue React property. It needs to be
       
  3664     // updated as new props come in.
       
  3665     if (props.defaultChecked == null) {
       
  3666       node.removeAttribute('checked');
       
  3667     } else {
       
  3668       node.defaultChecked = !!props.defaultChecked;
       
  3669     }
       
  3670   } else {
       
  3671     // When syncing the checked attribute, it only changes when it needs
       
  3672     // to be removed, such as transitioning from a checkbox into a text input
       
  3673     if (props.checked == null && props.defaultChecked != null) {
       
  3674       node.defaultChecked = !!props.defaultChecked;
       
  3675     }
       
  3676   }
       
  3677 }
       
  3678 
       
  3679 function postMountWrapper(element, props, isHydrating) {
       
  3680   var node = element;
       
  3681 
       
  3682   // Do not assign value if it is already set. This prevents user text input
       
  3683   // from being lost during SSR hydration.
       
  3684   if (props.hasOwnProperty('value') || props.hasOwnProperty('defaultValue')) {
       
  3685     var type = props.type;
       
  3686     var isButton = type === 'submit' || type === 'reset';
       
  3687 
       
  3688     // Avoid setting value attribute on submit/reset inputs as it overrides the
       
  3689     // default value provided by the browser. See: #12872
       
  3690     if (isButton && (props.value === undefined || props.value === null)) {
       
  3691       return;
       
  3692     }
       
  3693 
       
  3694     var _initialValue = toString(node._wrapperState.initialValue);
       
  3695 
       
  3696     // Do not assign value if it is already set. This prevents user text input
       
  3697     // from being lost during SSR hydration.
       
  3698     if (!isHydrating) {
       
  3699       if (disableInputAttributeSyncing) {
       
  3700         var value = getToStringValue(props.value);
       
  3701 
       
  3702         // When not syncing the value attribute, the value property points
       
  3703         // directly to the React prop. Only assign it if it exists.
       
  3704         if (value != null) {
       
  3705           // Always assign on buttons so that it is possible to assign an
       
  3706           // empty string to clear button text.
       
  3707           //
       
  3708           // Otherwise, do not re-assign the value property if is empty. This
       
  3709           // potentially avoids a DOM write and prevents Firefox (~60.0.1) from
       
  3710           // prematurely marking required inputs as invalid. Equality is compared
       
  3711           // to the current value in case the browser provided value is not an
       
  3712           // empty string.
       
  3713           if (isButton || value !== node.value) {
       
  3714             node.value = toString(value);
       
  3715           }
       
  3716         }
       
  3717       } else {
       
  3718         // When syncing the value attribute, the value property should use
       
  3719         // the wrapperState._initialValue property. This uses:
       
  3720         //
       
  3721         //   1. The value React property when present
       
  3722         //   2. The defaultValue React property when present
       
  3723         //   3. An empty string
       
  3724         if (_initialValue !== node.value) {
       
  3725           node.value = _initialValue;
       
  3726         }
       
  3727       }
       
  3728     }
       
  3729 
       
  3730     if (disableInputAttributeSyncing) {
       
  3731       // When not syncing the value attribute, assign the value attribute
       
  3732       // directly from the defaultValue React property (when present)
       
  3733       var defaultValue = getToStringValue(props.defaultValue);
       
  3734       if (defaultValue != null) {
       
  3735         node.defaultValue = toString(defaultValue);
       
  3736       }
       
  3737     } else {
       
  3738       // Otherwise, the value attribute is synchronized to the property,
       
  3739       // so we assign defaultValue to the same thing as the value property
       
  3740       // assignment step above.
       
  3741       node.defaultValue = _initialValue;
       
  3742     }
       
  3743   }
       
  3744 
       
  3745   // Normally, we'd just do `node.checked = node.checked` upon initial mount, less this bug
       
  3746   // this is needed to work around a chrome bug where setting defaultChecked
       
  3747   // will sometimes influence the value of checked (even after detachment).
       
  3748   // Reference: https://bugs.chromium.org/p/chromium/issues/detail?id=608416
       
  3749   // We need to temporarily unset name to avoid disrupting radio button groups.
       
  3750   var name = node.name;
       
  3751   if (name !== '') {
       
  3752     node.name = '';
       
  3753   }
       
  3754 
       
  3755   if (disableInputAttributeSyncing) {
       
  3756     // When not syncing the checked attribute, the checked property
       
  3757     // never gets assigned. It must be manually set. We don't want
       
  3758     // to do this when hydrating so that existing user input isn't
       
  3759     // modified
       
  3760     if (!isHydrating) {
       
  3761       updateChecked(element, props);
       
  3762     }
       
  3763 
       
  3764     // Only assign the checked attribute if it is defined. This saves
       
  3765     // a DOM write when controlling the checked attribute isn't needed
       
  3766     // (text inputs, submit/reset)
       
  3767     if (props.hasOwnProperty('defaultChecked')) {
       
  3768       node.defaultChecked = !node.defaultChecked;
       
  3769       node.defaultChecked = !!props.defaultChecked;
       
  3770     }
       
  3771   } else {
       
  3772     // When syncing the checked attribute, both the checked property and
       
  3773     // attribute are assigned at the same time using defaultChecked. This uses:
       
  3774     //
       
  3775     //   1. The checked React property when present
       
  3776     //   2. The defaultChecked React property when present
       
  3777     //   3. Otherwise, false
       
  3778     node.defaultChecked = !node.defaultChecked;
       
  3779     node.defaultChecked = !!node._wrapperState.initialChecked;
       
  3780   }
       
  3781 
       
  3782   if (name !== '') {
       
  3783     node.name = name;
       
  3784   }
       
  3785 }
       
  3786 
       
  3787 function restoreControlledState(element, props) {
       
  3788   var node = element;
       
  3789   updateWrapper(node, props);
       
  3790   updateNamedCousins(node, props);
       
  3791 }
       
  3792 
       
  3793 function updateNamedCousins(rootNode, props) {
       
  3794   var name = props.name;
       
  3795   if (props.type === 'radio' && name != null) {
       
  3796     var queryRoot = rootNode;
       
  3797 
       
  3798     while (queryRoot.parentNode) {
       
  3799       queryRoot = queryRoot.parentNode;
       
  3800     }
       
  3801 
       
  3802     // If `rootNode.form` was non-null, then we could try `form.elements`,
       
  3803     // but that sometimes behaves strangely in IE8. We could also try using
       
  3804     // `form.getElementsByName`, but that will only return direct children
       
  3805     // and won't include inputs that use the HTML5 `form=` attribute. Since
       
  3806     // the input might not even be in a form. It might not even be in the
       
  3807     // document. Let's just use the local `querySelectorAll` to ensure we don't
       
  3808     // miss anything.
       
  3809     var group = queryRoot.querySelectorAll('input[name=' + JSON.stringify('' + name) + '][type="radio"]');
       
  3810 
       
  3811     for (var i = 0; i < group.length; i++) {
       
  3812       var otherNode = group[i];
       
  3813       if (otherNode === rootNode || otherNode.form !== rootNode.form) {
       
  3814         continue;
       
  3815       }
       
  3816       // This will throw if radio buttons rendered by different copies of React
       
  3817       // and the same name are rendered into the same form (same as #1939).
       
  3818       // That's probably okay; we don't support it just as we don't support
       
  3819       // mixing React radio buttons with non-React ones.
       
  3820       var otherProps = getFiberCurrentPropsFromNode$1(otherNode);
       
  3821       (function () {
       
  3822         if (!otherProps) {
       
  3823           {
       
  3824             throw ReactError(Error('ReactDOMInput: Mixing React and non-React radio inputs with the same `name` is not supported.'));
       
  3825           }
       
  3826         }
       
  3827       })();
       
  3828 
       
  3829       // We need update the tracked value on the named cousin since the value
       
  3830       // was changed but the input saw no event or value set
       
  3831       updateValueIfChanged(otherNode);
       
  3832 
       
  3833       // If this is a controlled radio button group, forcing the input that
       
  3834       // was previously checked to update will cause it to be come re-checked
       
  3835       // as appropriate.
       
  3836       updateWrapper(otherNode, otherProps);
       
  3837     }
       
  3838   }
       
  3839 }
       
  3840 
       
  3841 // In Chrome, assigning defaultValue to certain input types triggers input validation.
       
  3842 // For number inputs, the display value loses trailing decimal points. For email inputs,
       
  3843 // Chrome raises "The specified value <x> is not a valid email address".
       
  3844 //
       
  3845 // Here we check to see if the defaultValue has actually changed, avoiding these problems
       
  3846 // when the user is inputting text
       
  3847 //
       
  3848 // https://github.com/facebook/react/issues/7253
       
  3849 function setDefaultValue(node, type, value) {
       
  3850   if (
       
  3851   // Focused number inputs synchronize on blur. See ChangeEventPlugin.js
       
  3852   type !== 'number' || node.ownerDocument.activeElement !== node) {
       
  3853     if (value == null) {
       
  3854       node.defaultValue = toString(node._wrapperState.initialValue);
       
  3855     } else if (node.defaultValue !== toString(value)) {
       
  3856       node.defaultValue = toString(value);
       
  3857     }
       
  3858   }
       
  3859 }
       
  3860 
       
  3861 var eventTypes$1 = {
       
  3862   change: {
       
  3863     phasedRegistrationNames: {
       
  3864       bubbled: 'onChange',
       
  3865       captured: 'onChangeCapture'
       
  3866     },
       
  3867     dependencies: [TOP_BLUR, TOP_CHANGE, TOP_CLICK, TOP_FOCUS, TOP_INPUT, TOP_KEY_DOWN, TOP_KEY_UP, TOP_SELECTION_CHANGE]
       
  3868   }
       
  3869 };
       
  3870 
       
  3871 function createAndAccumulateChangeEvent(inst, nativeEvent, target) {
       
  3872   var event = SyntheticEvent.getPooled(eventTypes$1.change, inst, nativeEvent, target);
       
  3873   event.type = 'change';
       
  3874   // Flag this event loop as needing state restore.
       
  3875   enqueueStateRestore(target);
       
  3876   accumulateTwoPhaseDispatches(event);
       
  3877   return event;
       
  3878 }
       
  3879 /**
       
  3880  * For IE shims
       
  3881  */
       
  3882 var activeElement = null;
       
  3883 var activeElementInst = null;
       
  3884 
       
  3885 /**
       
  3886  * SECTION: handle `change` event
       
  3887  */
       
  3888 function shouldUseChangeEvent(elem) {
       
  3889   var nodeName = elem.nodeName && elem.nodeName.toLowerCase();
       
  3890   return nodeName === 'select' || nodeName === 'input' && elem.type === 'file';
       
  3891 }
       
  3892 
       
  3893 function manualDispatchChangeEvent(nativeEvent) {
       
  3894   var event = createAndAccumulateChangeEvent(activeElementInst, nativeEvent, getEventTarget(nativeEvent));
       
  3895 
       
  3896   // If change and propertychange bubbled, we'd just bind to it like all the
       
  3897   // other events and have it go through ReactBrowserEventEmitter. Since it
       
  3898   // doesn't, we manually listen for the events and so we have to enqueue and
       
  3899   // process the abstract event manually.
       
  3900   //
       
  3901   // Batching is necessary here in order to ensure that all event handlers run
       
  3902   // before the next rerender (including event handlers attached to ancestor
       
  3903   // elements instead of directly on the input). Without this, controlled
       
  3904   // components don't work properly in conjunction with event bubbling because
       
  3905   // the component is rerendered and the value reverted before all the event
       
  3906   // handlers can run. See https://github.com/facebook/react/issues/708.
       
  3907   batchedUpdates(runEventInBatch, event);
       
  3908 }
       
  3909 
       
  3910 function runEventInBatch(event) {
       
  3911   runEventsInBatch(event);
       
  3912 }
       
  3913 
       
  3914 function getInstIfValueChanged(targetInst) {
       
  3915   var targetNode = getNodeFromInstance$1(targetInst);
       
  3916   if (updateValueIfChanged(targetNode)) {
       
  3917     return targetInst;
       
  3918   }
       
  3919 }
       
  3920 
       
  3921 function getTargetInstForChangeEvent(topLevelType, targetInst) {
       
  3922   if (topLevelType === TOP_CHANGE) {
       
  3923     return targetInst;
       
  3924   }
       
  3925 }
       
  3926 
       
  3927 /**
       
  3928  * SECTION: handle `input` event
       
  3929  */
       
  3930 var isInputEventSupported = false;
       
  3931 if (canUseDOM) {
       
  3932   // IE9 claims to support the input event but fails to trigger it when
       
  3933   // deleting text, so we ignore its input events.
       
  3934   isInputEventSupported = isEventSupported('input') && (!document.documentMode || document.documentMode > 9);
       
  3935 }
       
  3936 
       
  3937 /**
       
  3938  * (For IE <=9) Starts tracking propertychange events on the passed-in element
       
  3939  * and override the value property so that we can distinguish user events from
       
  3940  * value changes in JS.
       
  3941  */
       
  3942 function startWatchingForValueChange(target, targetInst) {
       
  3943   activeElement = target;
       
  3944   activeElementInst = targetInst;
       
  3945   activeElement.attachEvent('onpropertychange', handlePropertyChange);
       
  3946 }
       
  3947 
       
  3948 /**
       
  3949  * (For IE <=9) Removes the event listeners from the currently-tracked element,
       
  3950  * if any exists.
       
  3951  */
       
  3952 function stopWatchingForValueChange() {
       
  3953   if (!activeElement) {
       
  3954     return;
       
  3955   }
       
  3956   activeElement.detachEvent('onpropertychange', handlePropertyChange);
       
  3957   activeElement = null;
       
  3958   activeElementInst = null;
       
  3959 }
       
  3960 
       
  3961 /**
       
  3962  * (For IE <=9) Handles a propertychange event, sending a `change` event if
       
  3963  * the value of the active element has changed.
       
  3964  */
       
  3965 function handlePropertyChange(nativeEvent) {
       
  3966   if (nativeEvent.propertyName !== 'value') {
       
  3967     return;
       
  3968   }
       
  3969   if (getInstIfValueChanged(activeElementInst)) {
       
  3970     manualDispatchChangeEvent(nativeEvent);
       
  3971   }
       
  3972 }
       
  3973 
       
  3974 function handleEventsForInputEventPolyfill(topLevelType, target, targetInst) {
       
  3975   if (topLevelType === TOP_FOCUS) {
       
  3976     // In IE9, propertychange fires for most input events but is buggy and
       
  3977     // doesn't fire when text is deleted, but conveniently, selectionchange
       
  3978     // appears to fire in all of the remaining cases so we catch those and
       
  3979     // forward the event if the value has changed
       
  3980     // In either case, we don't want to call the event handler if the value
       
  3981     // is changed from JS so we redefine a setter for `.value` that updates
       
  3982     // our activeElementValue variable, allowing us to ignore those changes
       
  3983     //
       
  3984     // stopWatching() should be a noop here but we call it just in case we
       
  3985     // missed a blur event somehow.
       
  3986     stopWatchingForValueChange();
       
  3987     startWatchingForValueChange(target, targetInst);
       
  3988   } else if (topLevelType === TOP_BLUR) {
       
  3989     stopWatchingForValueChange();
       
  3990   }
       
  3991 }
       
  3992 
       
  3993 // For IE8 and IE9.
       
  3994 function getTargetInstForInputEventPolyfill(topLevelType, targetInst) {
       
  3995   if (topLevelType === TOP_SELECTION_CHANGE || topLevelType === TOP_KEY_UP || topLevelType === TOP_KEY_DOWN) {
       
  3996     // On the selectionchange event, the target is just document which isn't
       
  3997     // helpful for us so just check activeElement instead.
       
  3998     //
       
  3999     // 99% of the time, keydown and keyup aren't necessary. IE8 fails to fire
       
  4000     // propertychange on the first input event after setting `value` from a
       
  4001     // script and fires only keydown, keypress, keyup. Catching keyup usually
       
  4002     // gets it and catching keydown lets us fire an event for the first
       
  4003     // keystroke if user does a key repeat (it'll be a little delayed: right
       
  4004     // before the second keystroke). Other input methods (e.g., paste) seem to
       
  4005     // fire selectionchange normally.
       
  4006     return getInstIfValueChanged(activeElementInst);
       
  4007   }
       
  4008 }
       
  4009 
       
  4010 /**
       
  4011  * SECTION: handle `click` event
       
  4012  */
       
  4013 function shouldUseClickEvent(elem) {
       
  4014   // Use the `click` event to detect changes to checkbox and radio inputs.
       
  4015   // This approach works across all browsers, whereas `change` does not fire
       
  4016   // until `blur` in IE8.
       
  4017   var nodeName = elem.nodeName;
       
  4018   return nodeName && nodeName.toLowerCase() === 'input' && (elem.type === 'checkbox' || elem.type === 'radio');
       
  4019 }
       
  4020 
       
  4021 function getTargetInstForClickEvent(topLevelType, targetInst) {
       
  4022   if (topLevelType === TOP_CLICK) {
       
  4023     return getInstIfValueChanged(targetInst);
       
  4024   }
       
  4025 }
       
  4026 
       
  4027 function getTargetInstForInputOrChangeEvent(topLevelType, targetInst) {
       
  4028   if (topLevelType === TOP_INPUT || topLevelType === TOP_CHANGE) {
       
  4029     return getInstIfValueChanged(targetInst);
       
  4030   }
       
  4031 }
       
  4032 
       
  4033 function handleControlledInputBlur(node) {
       
  4034   var state = node._wrapperState;
       
  4035 
       
  4036   if (!state || !state.controlled || node.type !== 'number') {
       
  4037     return;
       
  4038   }
       
  4039 
       
  4040   if (!disableInputAttributeSyncing) {
       
  4041     // If controlled, assign the value attribute to the current value on blur
       
  4042     setDefaultValue(node, 'number', node.value);
       
  4043   }
       
  4044 }
       
  4045 
       
  4046 /**
       
  4047  * This plugin creates an `onChange` event that normalizes change events
       
  4048  * across form elements. This event fires at a time when it's possible to
       
  4049  * change the element's value without seeing a flicker.
       
  4050  *
       
  4051  * Supported elements are:
       
  4052  * - input (see `isTextInputElement`)
       
  4053  * - textarea
       
  4054  * - select
       
  4055  */
       
  4056 var ChangeEventPlugin = {
       
  4057   eventTypes: eventTypes$1,
       
  4058 
       
  4059   _isInputEventSupported: isInputEventSupported,
       
  4060 
       
  4061   extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
       
  4062     var targetNode = targetInst ? getNodeFromInstance$1(targetInst) : window;
       
  4063 
       
  4064     var getTargetInstFunc = void 0,
       
  4065         handleEventFunc = void 0;
       
  4066     if (shouldUseChangeEvent(targetNode)) {
       
  4067       getTargetInstFunc = getTargetInstForChangeEvent;
       
  4068     } else if (isTextInputElement(targetNode)) {
       
  4069       if (isInputEventSupported) {
       
  4070         getTargetInstFunc = getTargetInstForInputOrChangeEvent;
       
  4071       } else {
       
  4072         getTargetInstFunc = getTargetInstForInputEventPolyfill;
       
  4073         handleEventFunc = handleEventsForInputEventPolyfill;
       
  4074       }
       
  4075     } else if (shouldUseClickEvent(targetNode)) {
       
  4076       getTargetInstFunc = getTargetInstForClickEvent;
       
  4077     }
       
  4078 
       
  4079     if (getTargetInstFunc) {
       
  4080       var inst = getTargetInstFunc(topLevelType, targetInst);
       
  4081       if (inst) {
       
  4082         var event = createAndAccumulateChangeEvent(inst, nativeEvent, nativeEventTarget);
       
  4083         return event;
       
  4084       }
       
  4085     }
       
  4086 
       
  4087     if (handleEventFunc) {
       
  4088       handleEventFunc(topLevelType, targetNode, targetInst);
       
  4089     }
       
  4090 
       
  4091     // When blurring, set the value attribute for number inputs
       
  4092     if (topLevelType === TOP_BLUR) {
       
  4093       handleControlledInputBlur(targetNode);
       
  4094     }
       
  4095   }
       
  4096 };
       
  4097 
       
  4098 /**
       
  4099  * Module that is injectable into `EventPluginHub`, that specifies a
       
  4100  * deterministic ordering of `EventPlugin`s. A convenient way to reason about
       
  4101  * plugins, without having to package every one of them. This is better than
       
  4102  * having plugins be ordered in the same order that they are injected because
       
  4103  * that ordering would be influenced by the packaging order.
       
  4104  * `ResponderEventPlugin` must occur before `SimpleEventPlugin` so that
       
  4105  * preventing default on events is convenient in `SimpleEventPlugin` handlers.
       
  4106  */
       
  4107 var DOMEventPluginOrder = ['ResponderEventPlugin', 'SimpleEventPlugin', 'EnterLeaveEventPlugin', 'ChangeEventPlugin', 'SelectEventPlugin', 'BeforeInputEventPlugin'];
       
  4108 
       
  4109 var SyntheticUIEvent = SyntheticEvent.extend({
       
  4110   view: null,
       
  4111   detail: null
       
  4112 });
       
  4113 
       
  4114 var modifierKeyToProp = {
       
  4115   Alt: 'altKey',
       
  4116   Control: 'ctrlKey',
       
  4117   Meta: 'metaKey',
       
  4118   Shift: 'shiftKey'
       
  4119 };
       
  4120 
       
  4121 // Older browsers (Safari <= 10, iOS Safari <= 10.2) do not support
       
  4122 // getModifierState. If getModifierState is not supported, we map it to a set of
       
  4123 // modifier keys exposed by the event. In this case, Lock-keys are not supported.
       
  4124 /**
       
  4125  * Translation from modifier key to the associated property in the event.
       
  4126  * @see http://www.w3.org/TR/DOM-Level-3-Events/#keys-Modifiers
       
  4127  */
       
  4128 
       
  4129 function modifierStateGetter(keyArg) {
       
  4130   var syntheticEvent = this;
       
  4131   var nativeEvent = syntheticEvent.nativeEvent;
       
  4132   if (nativeEvent.getModifierState) {
       
  4133     return nativeEvent.getModifierState(keyArg);
       
  4134   }
       
  4135   var keyProp = modifierKeyToProp[keyArg];
       
  4136   return keyProp ? !!nativeEvent[keyProp] : false;
       
  4137 }
       
  4138 
       
  4139 function getEventModifierState(nativeEvent) {
       
  4140   return modifierStateGetter;
       
  4141 }
       
  4142 
       
  4143 var previousScreenX = 0;
       
  4144 var previousScreenY = 0;
       
  4145 // Use flags to signal movementX/Y has already been set
       
  4146 var isMovementXSet = false;
       
  4147 var isMovementYSet = false;
       
  4148 
       
  4149 /**
       
  4150  * @interface MouseEvent
       
  4151  * @see http://www.w3.org/TR/DOM-Level-3-Events/
       
  4152  */
       
  4153 var SyntheticMouseEvent = SyntheticUIEvent.extend({
       
  4154   screenX: null,
       
  4155   screenY: null,
       
  4156   clientX: null,
       
  4157   clientY: null,
       
  4158   pageX: null,
       
  4159   pageY: null,
       
  4160   ctrlKey: null,
       
  4161   shiftKey: null,
       
  4162   altKey: null,
       
  4163   metaKey: null,
       
  4164   getModifierState: getEventModifierState,
       
  4165   button: null,
       
  4166   buttons: null,
       
  4167   relatedTarget: function (event) {
       
  4168     return event.relatedTarget || (event.fromElement === event.srcElement ? event.toElement : event.fromElement);
       
  4169   },
       
  4170   movementX: function (event) {
       
  4171     if ('movementX' in event) {
       
  4172       return event.movementX;
       
  4173     }
       
  4174 
       
  4175     var screenX = previousScreenX;
       
  4176     previousScreenX = event.screenX;
       
  4177 
       
  4178     if (!isMovementXSet) {
       
  4179       isMovementXSet = true;
       
  4180       return 0;
       
  4181     }
       
  4182 
       
  4183     return event.type === 'mousemove' ? event.screenX - screenX : 0;
       
  4184   },
       
  4185   movementY: function (event) {
       
  4186     if ('movementY' in event) {
       
  4187       return event.movementY;
       
  4188     }
       
  4189 
       
  4190     var screenY = previousScreenY;
       
  4191     previousScreenY = event.screenY;
       
  4192 
       
  4193     if (!isMovementYSet) {
       
  4194       isMovementYSet = true;
       
  4195       return 0;
       
  4196     }
       
  4197 
       
  4198     return event.type === 'mousemove' ? event.screenY - screenY : 0;
       
  4199   }
       
  4200 });
       
  4201 
       
  4202 /**
       
  4203  * @interface PointerEvent
       
  4204  * @see http://www.w3.org/TR/pointerevents/
       
  4205  */
       
  4206 var SyntheticPointerEvent = SyntheticMouseEvent.extend({
       
  4207   pointerId: null,
       
  4208   width: null,
       
  4209   height: null,
       
  4210   pressure: null,
       
  4211   tangentialPressure: null,
       
  4212   tiltX: null,
       
  4213   tiltY: null,
       
  4214   twist: null,
       
  4215   pointerType: null,
       
  4216   isPrimary: null
       
  4217 });
       
  4218 
       
  4219 var eventTypes$2 = {
       
  4220   mouseEnter: {
       
  4221     registrationName: 'onMouseEnter',
       
  4222     dependencies: [TOP_MOUSE_OUT, TOP_MOUSE_OVER]
       
  4223   },
       
  4224   mouseLeave: {
       
  4225     registrationName: 'onMouseLeave',
       
  4226     dependencies: [TOP_MOUSE_OUT, TOP_MOUSE_OVER]
       
  4227   },
       
  4228   pointerEnter: {
       
  4229     registrationName: 'onPointerEnter',
       
  4230     dependencies: [TOP_POINTER_OUT, TOP_POINTER_OVER]
       
  4231   },
       
  4232   pointerLeave: {
       
  4233     registrationName: 'onPointerLeave',
       
  4234     dependencies: [TOP_POINTER_OUT, TOP_POINTER_OVER]
       
  4235   }
       
  4236 };
       
  4237 
       
  4238 var EnterLeaveEventPlugin = {
       
  4239   eventTypes: eventTypes$2,
       
  4240 
       
  4241   /**
       
  4242    * For almost every interaction we care about, there will be both a top-level
       
  4243    * `mouseover` and `mouseout` event that occurs. Only use `mouseout` so that
       
  4244    * we do not extract duplicate events. However, moving the mouse into the
       
  4245    * browser from outside will not fire a `mouseout` event. In this case, we use
       
  4246    * the `mouseover` top-level event.
       
  4247    */
       
  4248   extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
       
  4249     var isOverEvent = topLevelType === TOP_MOUSE_OVER || topLevelType === TOP_POINTER_OVER;
       
  4250     var isOutEvent = topLevelType === TOP_MOUSE_OUT || topLevelType === TOP_POINTER_OUT;
       
  4251 
       
  4252     if (isOverEvent && (nativeEvent.relatedTarget || nativeEvent.fromElement)) {
       
  4253       return null;
       
  4254     }
       
  4255 
       
  4256     if (!isOutEvent && !isOverEvent) {
       
  4257       // Must not be a mouse or pointer in or out - ignoring.
       
  4258       return null;
       
  4259     }
       
  4260 
       
  4261     var win = void 0;
       
  4262     if (nativeEventTarget.window === nativeEventTarget) {
       
  4263       // `nativeEventTarget` is probably a window object.
       
  4264       win = nativeEventTarget;
       
  4265     } else {
       
  4266       // TODO: Figure out why `ownerDocument` is sometimes undefined in IE8.
       
  4267       var doc = nativeEventTarget.ownerDocument;
       
  4268       if (doc) {
       
  4269         win = doc.defaultView || doc.parentWindow;
       
  4270       } else {
       
  4271         win = window;
       
  4272       }
       
  4273     }
       
  4274 
       
  4275     var from = void 0;
       
  4276     var to = void 0;
       
  4277     if (isOutEvent) {
       
  4278       from = targetInst;
       
  4279       var related = nativeEvent.relatedTarget || nativeEvent.toElement;
       
  4280       to = related ? getClosestInstanceFromNode(related) : null;
       
  4281     } else {
       
  4282       // Moving to a node from outside the window.
       
  4283       from = null;
       
  4284       to = targetInst;
       
  4285     }
       
  4286 
       
  4287     if (from === to) {
       
  4288       // Nothing pertains to our managed components.
       
  4289       return null;
       
  4290     }
       
  4291 
       
  4292     var eventInterface = void 0,
       
  4293         leaveEventType = void 0,
       
  4294         enterEventType = void 0,
       
  4295         eventTypePrefix = void 0;
       
  4296 
       
  4297     if (topLevelType === TOP_MOUSE_OUT || topLevelType === TOP_MOUSE_OVER) {
       
  4298       eventInterface = SyntheticMouseEvent;
       
  4299       leaveEventType = eventTypes$2.mouseLeave;
       
  4300       enterEventType = eventTypes$2.mouseEnter;
       
  4301       eventTypePrefix = 'mouse';
       
  4302     } else if (topLevelType === TOP_POINTER_OUT || topLevelType === TOP_POINTER_OVER) {
       
  4303       eventInterface = SyntheticPointerEvent;
       
  4304       leaveEventType = eventTypes$2.pointerLeave;
       
  4305       enterEventType = eventTypes$2.pointerEnter;
       
  4306       eventTypePrefix = 'pointer';
       
  4307     }
       
  4308 
       
  4309     var fromNode = from == null ? win : getNodeFromInstance$1(from);
       
  4310     var toNode = to == null ? win : getNodeFromInstance$1(to);
       
  4311 
       
  4312     var leave = eventInterface.getPooled(leaveEventType, from, nativeEvent, nativeEventTarget);
       
  4313     leave.type = eventTypePrefix + 'leave';
       
  4314     leave.target = fromNode;
       
  4315     leave.relatedTarget = toNode;
       
  4316 
       
  4317     var enter = eventInterface.getPooled(enterEventType, to, nativeEvent, nativeEventTarget);
       
  4318     enter.type = eventTypePrefix + 'enter';
       
  4319     enter.target = toNode;
       
  4320     enter.relatedTarget = fromNode;
       
  4321 
       
  4322     accumulateEnterLeaveDispatches(leave, enter, from, to);
       
  4323 
       
  4324     return [leave, enter];
       
  4325   }
       
  4326 };
       
  4327 
       
  4328 /**
       
  4329  * inlined Object.is polyfill to avoid requiring consumers ship their own
       
  4330  * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
       
  4331  */
       
  4332 function is(x, y) {
       
  4333   return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y // eslint-disable-line no-self-compare
       
  4334   ;
       
  4335 }
       
  4336 
       
  4337 var hasOwnProperty$1 = Object.prototype.hasOwnProperty;
       
  4338 
       
  4339 /**
       
  4340  * Performs equality by iterating through keys on an object and returning false
       
  4341  * when any key has values which are not strictly equal between the arguments.
       
  4342  * Returns true when the values of all keys are strictly equal.
       
  4343  */
       
  4344 function shallowEqual(objA, objB) {
       
  4345   if (is(objA, objB)) {
       
  4346     return true;
       
  4347   }
       
  4348 
       
  4349   if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) {
       
  4350     return false;
       
  4351   }
       
  4352 
       
  4353   var keysA = Object.keys(objA);
       
  4354   var keysB = Object.keys(objB);
       
  4355 
       
  4356   if (keysA.length !== keysB.length) {
       
  4357     return false;
       
  4358   }
       
  4359 
       
  4360   // Test for A's keys different from B.
       
  4361   for (var i = 0; i < keysA.length; i++) {
       
  4362     if (!hasOwnProperty$1.call(objB, keysA[i]) || !is(objA[keysA[i]], objB[keysA[i]])) {
       
  4363       return false;
       
  4364     }
       
  4365   }
       
  4366 
       
  4367   return true;
       
  4368 }
       
  4369 
       
  4370 var ReactInternals$1 = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
       
  4371 
       
  4372 var _ReactInternals$Sched = ReactInternals$1.Scheduler;
       
  4373 var unstable_cancelCallback = _ReactInternals$Sched.unstable_cancelCallback;
       
  4374 var unstable_now = _ReactInternals$Sched.unstable_now;
       
  4375 var unstable_scheduleCallback = _ReactInternals$Sched.unstable_scheduleCallback;
       
  4376 var unstable_shouldYield = _ReactInternals$Sched.unstable_shouldYield;
       
  4377 var unstable_requestPaint = _ReactInternals$Sched.unstable_requestPaint;
       
  4378 var unstable_getFirstCallbackNode = _ReactInternals$Sched.unstable_getFirstCallbackNode;
       
  4379 var unstable_runWithPriority = _ReactInternals$Sched.unstable_runWithPriority;
       
  4380 var unstable_next = _ReactInternals$Sched.unstable_next;
       
  4381 var unstable_continueExecution = _ReactInternals$Sched.unstable_continueExecution;
       
  4382 var unstable_pauseExecution = _ReactInternals$Sched.unstable_pauseExecution;
       
  4383 var unstable_getCurrentPriorityLevel = _ReactInternals$Sched.unstable_getCurrentPriorityLevel;
       
  4384 var unstable_ImmediatePriority = _ReactInternals$Sched.unstable_ImmediatePriority;
       
  4385 var unstable_UserBlockingPriority = _ReactInternals$Sched.unstable_UserBlockingPriority;
       
  4386 var unstable_NormalPriority = _ReactInternals$Sched.unstable_NormalPriority;
       
  4387 var unstable_LowPriority = _ReactInternals$Sched.unstable_LowPriority;
       
  4388 var unstable_IdlePriority = _ReactInternals$Sched.unstable_IdlePriority;
       
  4389 var unstable_forceFrameRate = _ReactInternals$Sched.unstable_forceFrameRate;
       
  4390 var unstable_flushAllWithoutAsserting = _ReactInternals$Sched.unstable_flushAllWithoutAsserting;
       
  4391 
       
  4392 var PLUGIN_EVENT_SYSTEM = 1;
       
  4393 var RESPONDER_EVENT_SYSTEM = 1 << 1;
       
  4394 var IS_PASSIVE = 1 << 2;
       
  4395 var IS_ACTIVE = 1 << 3;
       
  4396 var PASSIVE_NOT_SUPPORTED = 1 << 4;
       
  4397 
       
  4398 function createResponderListener(responder, props) {
       
  4399   var eventResponderListener = {
       
  4400     responder: responder,
       
  4401     props: props
       
  4402   };
       
  4403   {
       
  4404     Object.freeze(eventResponderListener);
       
  4405   }
       
  4406   return eventResponderListener;
       
  4407 }
       
  4408 
       
  4409 function isFiberSuspenseAndTimedOut(fiber) {
       
  4410   return fiber.tag === SuspenseComponent && fiber.memoizedState !== null;
       
  4411 }
       
  4412 
       
  4413 function getSuspenseFallbackChild(fiber) {
       
  4414   return fiber.child.sibling.child;
       
  4415 }
       
  4416 
       
  4417 
       
  4418 
       
  4419 
       
  4420 
       
  4421 function createResponderInstance(responder, responderProps, responderState, target, fiber) {
       
  4422   return {
       
  4423     fiber: fiber,
       
  4424     props: responderProps,
       
  4425     responder: responder,
       
  4426     rootEventTypes: null,
       
  4427     state: responderState,
       
  4428     target: target
       
  4429   };
       
  4430 }
       
  4431 
       
  4432 var DiscreteEvent = 0;
       
  4433 var UserBlockingEvent = 1;
       
  4434 var ContinuousEvent = 2;
       
  4435 
       
  4436 // Intentionally not named imports because Rollup would use dynamic dispatch for
       
  4437 // CommonJS interop named imports.
       
  4438 var UserBlockingPriority$1 = unstable_UserBlockingPriority;
       
  4439 var runWithPriority$1 = unstable_runWithPriority;
       
  4440 
       
  4441 
       
  4442 var listenToResponderEventTypesImpl = void 0;
       
  4443 
       
  4444 function setListenToResponderEventTypes(_listenToResponderEventTypesImpl) {
       
  4445   listenToResponderEventTypesImpl = _listenToResponderEventTypesImpl;
       
  4446 }
       
  4447 
       
  4448 var activeTimeouts = new Map();
       
  4449 var rootEventTypesToEventResponderInstances = new Map();
       
  4450 var ownershipChangeListeners = new Set();
       
  4451 
       
  4452 var globalOwner = null;
       
  4453 
       
  4454 var currentTimeStamp = 0;
       
  4455 var currentTimers = new Map();
       
  4456 var currentInstance = null;
       
  4457 var currentEventQueue = null;
       
  4458 var currentEventQueuePriority = ContinuousEvent;
       
  4459 var currentTimerIDCounter = 0;
       
  4460 var currentDocument = null;
       
  4461 
       
  4462 var eventResponderContext = {
       
  4463   dispatchEvent: function (eventValue, eventListener, eventPriority) {
       
  4464     validateResponderContext();
       
  4465     validateEventValue(eventValue);
       
  4466     if (eventPriority < currentEventQueuePriority) {
       
  4467       currentEventQueuePriority = eventPriority;
       
  4468     }
       
  4469     currentEventQueue.push(createEventQueueItem(eventValue, eventListener));
       
  4470   },
       
  4471   isTargetWithinResponder: function (target) {
       
  4472     validateResponderContext();
       
  4473     if (target != null) {
       
  4474       var fiber = getClosestInstanceFromNode(target);
       
  4475       var responderFiber = currentInstance.fiber;
       
  4476 
       
  4477       while (fiber !== null) {
       
  4478         if (fiber === responderFiber || fiber.alternate === responderFiber) {
       
  4479           return true;
       
  4480         }
       
  4481         fiber = fiber.return;
       
  4482       }
       
  4483     }
       
  4484     return false;
       
  4485   },
       
  4486   isTargetWithinResponderScope: function (target) {
       
  4487     validateResponderContext();
       
  4488     var componentInstance = currentInstance;
       
  4489     var responder = componentInstance.responder;
       
  4490 
       
  4491     if (target != null) {
       
  4492       var fiber = getClosestInstanceFromNode(target);
       
  4493       var responderFiber = currentInstance.fiber;
       
  4494 
       
  4495       while (fiber !== null) {
       
  4496         if (fiber === responderFiber || fiber.alternate === responderFiber) {
       
  4497           return true;
       
  4498         }
       
  4499         if (doesFiberHaveResponder(fiber, responder)) {
       
  4500           return false;
       
  4501         }
       
  4502         fiber = fiber.return;
       
  4503       }
       
  4504     }
       
  4505     return false;
       
  4506   },
       
  4507   isTargetWithinNode: function (childTarget, parentTarget) {
       
  4508     validateResponderContext();
       
  4509     var childFiber = getClosestInstanceFromNode(childTarget);
       
  4510     var parentFiber = getClosestInstanceFromNode(parentTarget);
       
  4511     var parentAlternateFiber = parentFiber.alternate;
       
  4512 
       
  4513     var node = childFiber;
       
  4514     while (node !== null) {
       
  4515       if (node === parentFiber || node === parentAlternateFiber) {
       
  4516         return true;
       
  4517       }
       
  4518       node = node.return;
       
  4519     }
       
  4520     return false;
       
  4521   },
       
  4522   addRootEventTypes: function (rootEventTypes) {
       
  4523     validateResponderContext();
       
  4524     var activeDocument = getActiveDocument();
       
  4525     listenToResponderEventTypesImpl(rootEventTypes, activeDocument);
       
  4526     for (var i = 0; i < rootEventTypes.length; i++) {
       
  4527       var rootEventType = rootEventTypes[i];
       
  4528       var eventResponderInstance = currentInstance;
       
  4529       registerRootEventType(rootEventType, eventResponderInstance);
       
  4530     }
       
  4531   },
       
  4532   removeRootEventTypes: function (rootEventTypes) {
       
  4533     validateResponderContext();
       
  4534     for (var i = 0; i < rootEventTypes.length; i++) {
       
  4535       var rootEventType = rootEventTypes[i];
       
  4536       var rootEventResponders = rootEventTypesToEventResponderInstances.get(rootEventType);
       
  4537       var rootEventTypesSet = currentInstance.rootEventTypes;
       
  4538       if (rootEventTypesSet !== null) {
       
  4539         rootEventTypesSet.delete(rootEventType);
       
  4540       }
       
  4541       if (rootEventResponders !== undefined) {
       
  4542         rootEventResponders.delete(currentInstance);
       
  4543       }
       
  4544     }
       
  4545   },
       
  4546   hasOwnership: function () {
       
  4547     validateResponderContext();
       
  4548     return globalOwner === currentInstance;
       
  4549   },
       
  4550   requestGlobalOwnership: function () {
       
  4551     validateResponderContext();
       
  4552     if (globalOwner !== null) {
       
  4553       return false;
       
  4554     }
       
  4555     globalOwner = currentInstance;
       
  4556     triggerOwnershipListeners();
       
  4557     return true;
       
  4558   },
       
  4559   releaseOwnership: function () {
       
  4560     validateResponderContext();
       
  4561     return releaseOwnershipForEventResponderInstance(currentInstance);
       
  4562   },
       
  4563   setTimeout: function (func, delay) {
       
  4564     validateResponderContext();
       
  4565     if (currentTimers === null) {
       
  4566       currentTimers = new Map();
       
  4567     }
       
  4568     var timeout = currentTimers.get(delay);
       
  4569 
       
  4570     var timerId = currentTimerIDCounter++;
       
  4571     if (timeout === undefined) {
       
  4572       var _timers = new Map();
       
  4573       var _id = setTimeout(function () {
       
  4574         processTimers(_timers, delay);
       
  4575       }, delay);
       
  4576       timeout = {
       
  4577         id: _id,
       
  4578         timers: _timers
       
  4579       };
       
  4580       currentTimers.set(delay, timeout);
       
  4581     }
       
  4582     timeout.timers.set(timerId, {
       
  4583       instance: currentInstance,
       
  4584       func: func,
       
  4585       id: timerId,
       
  4586       timeStamp: currentTimeStamp
       
  4587     });
       
  4588     activeTimeouts.set(timerId, timeout);
       
  4589     return timerId;
       
  4590   },
       
  4591   clearTimeout: function (timerId) {
       
  4592     validateResponderContext();
       
  4593     var timeout = activeTimeouts.get(timerId);
       
  4594 
       
  4595     if (timeout !== undefined) {
       
  4596       var _timers2 = timeout.timers;
       
  4597       _timers2.delete(timerId);
       
  4598       if (_timers2.size === 0) {
       
  4599         clearTimeout(timeout.id);
       
  4600       }
       
  4601     }
       
  4602   },
       
  4603   getFocusableElementsInScope: function (deep) {
       
  4604     validateResponderContext();
       
  4605     var focusableElements = [];
       
  4606     var eventResponderInstance = currentInstance;
       
  4607     var currentResponder = eventResponderInstance.responder;
       
  4608     var focusScopeFiber = eventResponderInstance.fiber;
       
  4609     if (deep) {
       
  4610       var deepNode = focusScopeFiber.return;
       
  4611       while (deepNode !== null) {
       
  4612         if (doesFiberHaveResponder(deepNode, currentResponder)) {
       
  4613           focusScopeFiber = deepNode;
       
  4614         }
       
  4615         deepNode = deepNode.return;
       
  4616       }
       
  4617     }
       
  4618     var child = focusScopeFiber.child;
       
  4619 
       
  4620     if (child !== null) {
       
  4621       collectFocusableElements(child, focusableElements);
       
  4622     }
       
  4623     return focusableElements;
       
  4624   },
       
  4625 
       
  4626   getActiveDocument: getActiveDocument,
       
  4627   objectAssign: _assign,
       
  4628   getTimeStamp: function () {
       
  4629     validateResponderContext();
       
  4630     return currentTimeStamp;
       
  4631   },
       
  4632   isTargetWithinHostComponent: function (target, elementType) {
       
  4633     validateResponderContext();
       
  4634     var fiber = getClosestInstanceFromNode(target);
       
  4635 
       
  4636     while (fiber !== null) {
       
  4637       if (fiber.tag === HostComponent && fiber.type === elementType) {
       
  4638         return true;
       
  4639       }
       
  4640       fiber = fiber.return;
       
  4641     }
       
  4642     return false;
       
  4643   },
       
  4644 
       
  4645   enqueueStateRestore: enqueueStateRestore
       
  4646 };
       
  4647 
       
  4648 function validateEventValue(eventValue) {
       
  4649   if (typeof eventValue === 'object' && eventValue !== null) {
       
  4650     var target = eventValue.target,
       
  4651         type = eventValue.type,
       
  4652         _timeStamp = eventValue.timeStamp;
       
  4653 
       
  4654 
       
  4655     if (target == null || type == null || _timeStamp == null) {
       
  4656       throw new Error('context.dispatchEvent: "target", "timeStamp", and "type" fields on event object are required.');
       
  4657     }
       
  4658     var showWarning = function (name) {
       
  4659       {
       
  4660         warning$1(false, '%s is not available on event objects created from event responder modules (React Flare). ' + 'Try wrapping in a conditional, i.e. `if (event.type !== "press") { event.%s }`', name, name);
       
  4661       }
       
  4662     };
       
  4663     eventValue.preventDefault = function () {
       
  4664       {
       
  4665         showWarning('preventDefault()');
       
  4666       }
       
  4667     };
       
  4668     eventValue.stopPropagation = function () {
       
  4669       {
       
  4670         showWarning('stopPropagation()');
       
  4671       }
       
  4672     };
       
  4673     eventValue.isDefaultPrevented = function () {
       
  4674       {
       
  4675         showWarning('isDefaultPrevented()');
       
  4676       }
       
  4677     };
       
  4678     eventValue.isPropagationStopped = function () {
       
  4679       {
       
  4680         showWarning('isPropagationStopped()');
       
  4681       }
       
  4682     };
       
  4683     // $FlowFixMe: we don't need value, Flow thinks we do
       
  4684     Object.defineProperty(eventValue, 'nativeEvent', {
       
  4685       get: function () {
       
  4686         {
       
  4687           showWarning('nativeEvent');
       
  4688         }
       
  4689       }
       
  4690     });
       
  4691   }
       
  4692 }
       
  4693 
       
  4694 function collectFocusableElements(node, focusableElements) {
       
  4695   if (isFiberSuspenseAndTimedOut(node)) {
       
  4696     var fallbackChild = getSuspenseFallbackChild(node);
       
  4697     if (fallbackChild !== null) {
       
  4698       collectFocusableElements(fallbackChild, focusableElements);
       
  4699     }
       
  4700   } else {
       
  4701     if (isFiberHostComponentFocusable(node)) {
       
  4702       focusableElements.push(node.stateNode);
       
  4703     } else {
       
  4704       var child = node.child;
       
  4705 
       
  4706       if (child !== null) {
       
  4707         collectFocusableElements(child, focusableElements);
       
  4708       }
       
  4709     }
       
  4710   }
       
  4711   var sibling = node.sibling;
       
  4712 
       
  4713   if (sibling !== null) {
       
  4714     collectFocusableElements(sibling, focusableElements);
       
  4715   }
       
  4716 }
       
  4717 
       
  4718 function createEventQueueItem(value, listener) {
       
  4719   return {
       
  4720     value: value,
       
  4721     listener: listener
       
  4722   };
       
  4723 }
       
  4724 
       
  4725 function doesFiberHaveResponder(fiber, responder) {
       
  4726   if (fiber.tag === HostComponent) {
       
  4727     var dependencies = fiber.dependencies;
       
  4728     if (dependencies !== null) {
       
  4729       var respondersMap = dependencies.responders;
       
  4730       if (respondersMap !== null && respondersMap.has(responder)) {
       
  4731         return true;
       
  4732       }
       
  4733     }
       
  4734   }
       
  4735   return false;
       
  4736 }
       
  4737 
       
  4738 function getActiveDocument() {
       
  4739   return currentDocument;
       
  4740 }
       
  4741 
       
  4742 function releaseOwnershipForEventResponderInstance(eventResponderInstance) {
       
  4743   if (globalOwner === eventResponderInstance) {
       
  4744     globalOwner = null;
       
  4745     triggerOwnershipListeners();
       
  4746     return true;
       
  4747   }
       
  4748   return false;
       
  4749 }
       
  4750 
       
  4751 function isFiberHostComponentFocusable(fiber) {
       
  4752   if (fiber.tag !== HostComponent) {
       
  4753     return false;
       
  4754   }
       
  4755   var type = fiber.type,
       
  4756       memoizedProps = fiber.memoizedProps;
       
  4757 
       
  4758   if (memoizedProps.tabIndex === -1 || memoizedProps.disabled) {
       
  4759     return false;
       
  4760   }
       
  4761   if (memoizedProps.tabIndex === 0 || memoizedProps.contentEditable === true) {
       
  4762     return true;
       
  4763   }
       
  4764   if (type === 'a' || type === 'area') {
       
  4765     return !!memoizedProps.href && memoizedProps.rel !== 'ignore';
       
  4766   }
       
  4767   if (type === 'input') {
       
  4768     return memoizedProps.type !== 'hidden' && memoizedProps.type !== 'file';
       
  4769   }
       
  4770   return type === 'button' || type === 'textarea' || type === 'object' || type === 'select' || type === 'iframe' || type === 'embed';
       
  4771 }
       
  4772 
       
  4773 function processTimers(timers, delay) {
       
  4774   var timersArr = Array.from(timers.values());
       
  4775   currentEventQueuePriority = ContinuousEvent;
       
  4776   try {
       
  4777     for (var i = 0; i < timersArr.length; i++) {
       
  4778       var _timersArr$i = timersArr[i],
       
  4779           _instance = _timersArr$i.instance,
       
  4780           _func = _timersArr$i.func,
       
  4781           _id2 = _timersArr$i.id,
       
  4782           _timeStamp2 = _timersArr$i.timeStamp;
       
  4783 
       
  4784       currentInstance = _instance;
       
  4785       currentEventQueue = [];
       
  4786       currentTimeStamp = _timeStamp2 + delay;
       
  4787       try {
       
  4788         _func();
       
  4789       } finally {
       
  4790         activeTimeouts.delete(_id2);
       
  4791       }
       
  4792     }
       
  4793     processEventQueue();
       
  4794   } finally {
       
  4795     currentTimers = null;
       
  4796     currentInstance = null;
       
  4797     currentEventQueue = null;
       
  4798     currentTimeStamp = 0;
       
  4799   }
       
  4800 }
       
  4801 
       
  4802 function createDOMResponderEvent(topLevelType, nativeEvent, nativeEventTarget, passive, passiveSupported) {
       
  4803   var _ref = nativeEvent,
       
  4804       pointerType = _ref.pointerType;
       
  4805 
       
  4806   var eventPointerType = '';
       
  4807   var pointerId = null;
       
  4808 
       
  4809   if (pointerType !== undefined) {
       
  4810     eventPointerType = pointerType;
       
  4811     pointerId = nativeEvent.pointerId;
       
  4812   } else if (nativeEvent.key !== undefined) {
       
  4813     eventPointerType = 'keyboard';
       
  4814   } else if (nativeEvent.button !== undefined) {
       
  4815     eventPointerType = 'mouse';
       
  4816   } else if (nativeEvent.changedTouches !== undefined) {
       
  4817     eventPointerType = 'touch';
       
  4818   }
       
  4819 
       
  4820   return {
       
  4821     nativeEvent: nativeEvent,
       
  4822     passive: passive,
       
  4823     passiveSupported: passiveSupported,
       
  4824     pointerId: pointerId,
       
  4825     pointerType: eventPointerType,
       
  4826     responderTarget: null,
       
  4827     target: nativeEventTarget,
       
  4828     type: topLevelType
       
  4829   };
       
  4830 }
       
  4831 
       
  4832 function processEvents(eventQueue) {
       
  4833   for (var i = 0, length = eventQueue.length; i < length; i++) {
       
  4834     var _eventQueue$i = eventQueue[i],
       
  4835         _value = _eventQueue$i.value,
       
  4836         _listener = _eventQueue$i.listener;
       
  4837 
       
  4838     var type = typeof _value === 'object' && _value !== null ? _value.type : '';
       
  4839     invokeGuardedCallbackAndCatchFirstError(type, _listener, undefined, _value);
       
  4840   }
       
  4841 }
       
  4842 
       
  4843 function processEventQueue() {
       
  4844   var eventQueue = currentEventQueue;
       
  4845   if (eventQueue.length === 0) {
       
  4846     return;
       
  4847   }
       
  4848   switch (currentEventQueuePriority) {
       
  4849     case DiscreteEvent:
       
  4850       {
       
  4851         flushDiscreteUpdatesIfNeeded(currentTimeStamp);
       
  4852         discreteUpdates(function () {
       
  4853           batchedEventUpdates(processEvents, eventQueue);
       
  4854         });
       
  4855         break;
       
  4856       }
       
  4857     case UserBlockingEvent:
       
  4858       {
       
  4859         if (enableUserBlockingEvents) {
       
  4860           runWithPriority$1(UserBlockingPriority$1, batchedEventUpdates.bind(null, processEvents, eventQueue));
       
  4861         } else {
       
  4862           batchedEventUpdates(processEvents, eventQueue);
       
  4863         }
       
  4864         break;
       
  4865       }
       
  4866     case ContinuousEvent:
       
  4867       {
       
  4868         batchedEventUpdates(processEvents, eventQueue);
       
  4869         break;
       
  4870       }
       
  4871   }
       
  4872 }
       
  4873 
       
  4874 function responderEventTypesContainType(eventTypes, type) {
       
  4875   for (var i = 0, len = eventTypes.length; i < len; i++) {
       
  4876     if (eventTypes[i] === type) {
       
  4877       return true;
       
  4878     }
       
  4879   }
       
  4880   return false;
       
  4881 }
       
  4882 
       
  4883 function validateResponderTargetEventTypes(eventType, responder) {
       
  4884   var targetEventTypes = responder.targetEventTypes;
       
  4885   // Validate the target event type exists on the responder
       
  4886 
       
  4887   if (targetEventTypes !== null) {
       
  4888     return responderEventTypesContainType(targetEventTypes, eventType);
       
  4889   }
       
  4890   return false;
       
  4891 }
       
  4892 
       
  4893 function validateOwnership(responderInstance) {
       
  4894   return globalOwner === null || globalOwner === responderInstance;
       
  4895 }
       
  4896 
       
  4897 function traverseAndHandleEventResponderInstances(topLevelType, targetFiber, nativeEvent, nativeEventTarget, eventSystemFlags) {
       
  4898   var isPassiveEvent = (eventSystemFlags & IS_PASSIVE) !== 0;
       
  4899   var isPassiveSupported = (eventSystemFlags & PASSIVE_NOT_SUPPORTED) === 0;
       
  4900   var isPassive = isPassiveEvent || !isPassiveSupported;
       
  4901   var eventType = isPassive ? topLevelType : topLevelType + '_active';
       
  4902 
       
  4903   // Trigger event responders in this order:
       
  4904   // - Bubble target responder phase
       
  4905   // - Root responder phase
       
  4906 
       
  4907   var visitedResponders = new Set();
       
  4908   var responderEvent = createDOMResponderEvent(topLevelType, nativeEvent, nativeEventTarget, isPassiveEvent, isPassiveSupported);
       
  4909   var node = targetFiber;
       
  4910   while (node !== null) {
       
  4911     var _node = node,
       
  4912         dependencies = _node.dependencies,
       
  4913         tag = _node.tag;
       
  4914 
       
  4915     if (tag === HostComponent && dependencies !== null) {
       
  4916       var respondersMap = dependencies.responders;
       
  4917       if (respondersMap !== null) {
       
  4918         var responderInstances = Array.from(respondersMap.values());
       
  4919         for (var i = 0, length = responderInstances.length; i < length; i++) {
       
  4920           var responderInstance = responderInstances[i];
       
  4921 
       
  4922           if (validateOwnership(responderInstance)) {
       
  4923             var props = responderInstance.props,
       
  4924                 responder = responderInstance.responder,
       
  4925                 state = responderInstance.state,
       
  4926                 target = responderInstance.target;
       
  4927 
       
  4928             if (!visitedResponders.has(responder) && validateResponderTargetEventTypes(eventType, responder)) {
       
  4929               visitedResponders.add(responder);
       
  4930               var onEvent = responder.onEvent;
       
  4931               if (onEvent !== null) {
       
  4932                 currentInstance = responderInstance;
       
  4933                 responderEvent.responderTarget = target;
       
  4934                 onEvent(responderEvent, eventResponderContext, props, state);
       
  4935               }
   218               }
  4936             }
   219             }
  4937           }
   220           }
  4938         }
   221         } // Create a fake event type.
  4939       }
   222 
  4940     }
   223 
  4941     node = node.return;
   224         var evtType = "react-" + (name ? name : 'invokeguardedcallback'); // Attach our event handlers
  4942   }
   225 
  4943   // Root phase
   226         window.addEventListener('error', handleWindowError);
  4944   var rootEventResponderInstances = rootEventTypesToEventResponderInstances.get(eventType);
   227         fakeNode.addEventListener(evtType, callCallback, false); // Synchronously dispatch our fake event. If the user-provided function
  4945   if (rootEventResponderInstances !== undefined) {
   228         // errors, it will trigger our global error handler.
  4946     var _responderInstances = Array.from(rootEventResponderInstances);
   229 
  4947 
   230         evt.initEvent(evtType, false, false);
  4948     for (var _i = 0; _i < _responderInstances.length; _i++) {
   231         fakeNode.dispatchEvent(evt);
  4949       var _responderInstance = _responderInstances[_i];
   232 
  4950       if (!validateOwnership(_responderInstance)) {
   233         if (windowEventDescriptor) {
       
   234           Object.defineProperty(window, 'event', windowEventDescriptor);
       
   235         }
       
   236 
       
   237         if (didError) {
       
   238           if (!didSetError) {
       
   239             // The callback errored, but the error event never fired.
       
   240             error = new Error('An error was thrown inside one of your components, but React ' + "doesn't know what it was. This is likely due to browser " + 'flakiness. React does its best to preserve the "Pause on ' + 'exceptions" behavior of the DevTools, which requires some ' + "DEV-mode only tricks. It's possible that these don't work in " + 'your browser. Try triggering the error in production mode, ' + 'or switching to a modern browser. If you suspect that this is ' + 'actually an issue with React, please file an issue.');
       
   241           } else if (isCrossOriginError) {
       
   242             error = new Error("A cross-origin error was thrown. React doesn't have access to " + 'the actual error object in development. ' + 'See https://fb.me/react-crossorigin-error for more information.');
       
   243           }
       
   244 
       
   245           this.onError(error);
       
   246         } // Remove our event listeners
       
   247 
       
   248 
       
   249         window.removeEventListener('error', handleWindowError);
       
   250       };
       
   251 
       
   252       invokeGuardedCallbackImpl = invokeGuardedCallbackDev;
       
   253     }
       
   254   }
       
   255 
       
   256   var invokeGuardedCallbackImpl$1 = invokeGuardedCallbackImpl;
       
   257 
       
   258   var hasError = false;
       
   259   var caughtError = null; // Used by event system to capture/rethrow the first error.
       
   260 
       
   261   var hasRethrowError = false;
       
   262   var rethrowError = null;
       
   263   var reporter = {
       
   264     onError: function (error) {
       
   265       hasError = true;
       
   266       caughtError = error;
       
   267     }
       
   268   };
       
   269   /**
       
   270    * Call a function while guarding against errors that happens within it.
       
   271    * Returns an error if it throws, otherwise null.
       
   272    *
       
   273    * In production, this is implemented using a try-catch. The reason we don't
       
   274    * use a try-catch directly is so that we can swap out a different
       
   275    * implementation in DEV mode.
       
   276    *
       
   277    * @param {String} name of the guard to use for logging or debugging
       
   278    * @param {Function} func The function to invoke
       
   279    * @param {*} context The context to use when calling the function
       
   280    * @param {...*} args Arguments for function
       
   281    */
       
   282 
       
   283   function invokeGuardedCallback(name, func, context, a, b, c, d, e, f) {
       
   284     hasError = false;
       
   285     caughtError = null;
       
   286     invokeGuardedCallbackImpl$1.apply(reporter, arguments);
       
   287   }
       
   288   /**
       
   289    * Same as invokeGuardedCallback, but instead of returning an error, it stores
       
   290    * it in a global so it can be rethrown by `rethrowCaughtError` later.
       
   291    * TODO: See if caughtError and rethrowError can be unified.
       
   292    *
       
   293    * @param {String} name of the guard to use for logging or debugging
       
   294    * @param {Function} func The function to invoke
       
   295    * @param {*} context The context to use when calling the function
       
   296    * @param {...*} args Arguments for function
       
   297    */
       
   298 
       
   299   function invokeGuardedCallbackAndCatchFirstError(name, func, context, a, b, c, d, e, f) {
       
   300     invokeGuardedCallback.apply(this, arguments);
       
   301 
       
   302     if (hasError) {
       
   303       var error = clearCaughtError();
       
   304 
       
   305       if (!hasRethrowError) {
       
   306         hasRethrowError = true;
       
   307         rethrowError = error;
       
   308       }
       
   309     }
       
   310   }
       
   311   /**
       
   312    * During execution of guarded functions we will capture the first error which
       
   313    * we will rethrow to be handled by the top level error handler.
       
   314    */
       
   315 
       
   316   function rethrowCaughtError() {
       
   317     if (hasRethrowError) {
       
   318       var error = rethrowError;
       
   319       hasRethrowError = false;
       
   320       rethrowError = null;
       
   321       throw error;
       
   322     }
       
   323   }
       
   324   function hasCaughtError() {
       
   325     return hasError;
       
   326   }
       
   327   function clearCaughtError() {
       
   328     if (hasError) {
       
   329       var error = caughtError;
       
   330       hasError = false;
       
   331       caughtError = null;
       
   332       return error;
       
   333     } else {
       
   334       {
       
   335         {
       
   336           throw Error( "clearCaughtError was called but no error was captured. This error is likely caused by a bug in React. Please file an issue." );
       
   337         }
       
   338       }
       
   339     }
       
   340   }
       
   341 
       
   342   var getFiberCurrentPropsFromNode = null;
       
   343   var getInstanceFromNode = null;
       
   344   var getNodeFromInstance = null;
       
   345   function setComponentTree(getFiberCurrentPropsFromNodeImpl, getInstanceFromNodeImpl, getNodeFromInstanceImpl) {
       
   346     getFiberCurrentPropsFromNode = getFiberCurrentPropsFromNodeImpl;
       
   347     getInstanceFromNode = getInstanceFromNodeImpl;
       
   348     getNodeFromInstance = getNodeFromInstanceImpl;
       
   349 
       
   350     {
       
   351       if (!getNodeFromInstance || !getInstanceFromNode) {
       
   352         error('EventPluginUtils.setComponentTree(...): Injected ' + 'module is missing getNodeFromInstance or getInstanceFromNode.');
       
   353       }
       
   354     }
       
   355   }
       
   356   var validateEventDispatches;
       
   357 
       
   358   {
       
   359     validateEventDispatches = function (event) {
       
   360       var dispatchListeners = event._dispatchListeners;
       
   361       var dispatchInstances = event._dispatchInstances;
       
   362       var listenersIsArr = Array.isArray(dispatchListeners);
       
   363       var listenersLen = listenersIsArr ? dispatchListeners.length : dispatchListeners ? 1 : 0;
       
   364       var instancesIsArr = Array.isArray(dispatchInstances);
       
   365       var instancesLen = instancesIsArr ? dispatchInstances.length : dispatchInstances ? 1 : 0;
       
   366 
       
   367       if (instancesIsArr !== listenersIsArr || instancesLen !== listenersLen) {
       
   368         error('EventPluginUtils: Invalid `event`.');
       
   369       }
       
   370     };
       
   371   }
       
   372   /**
       
   373    * Dispatch the event to the listener.
       
   374    * @param {SyntheticEvent} event SyntheticEvent to handle
       
   375    * @param {function} listener Application-level callback
       
   376    * @param {*} inst Internal component instance
       
   377    */
       
   378 
       
   379 
       
   380   function executeDispatch(event, listener, inst) {
       
   381     var type = event.type || 'unknown-event';
       
   382     event.currentTarget = getNodeFromInstance(inst);
       
   383     invokeGuardedCallbackAndCatchFirstError(type, listener, undefined, event);
       
   384     event.currentTarget = null;
       
   385   }
       
   386   /**
       
   387    * Standard/simple iteration through an event's collected dispatches.
       
   388    */
       
   389 
       
   390   function executeDispatchesInOrder(event) {
       
   391     var dispatchListeners = event._dispatchListeners;
       
   392     var dispatchInstances = event._dispatchInstances;
       
   393 
       
   394     {
       
   395       validateEventDispatches(event);
       
   396     }
       
   397 
       
   398     if (Array.isArray(dispatchListeners)) {
       
   399       for (var i = 0; i < dispatchListeners.length; i++) {
       
   400         if (event.isPropagationStopped()) {
       
   401           break;
       
   402         } // Listeners and Instances are two parallel arrays that are always in sync.
       
   403 
       
   404 
       
   405         executeDispatch(event, dispatchListeners[i], dispatchInstances[i]);
       
   406       }
       
   407     } else if (dispatchListeners) {
       
   408       executeDispatch(event, dispatchListeners, dispatchInstances);
       
   409     }
       
   410 
       
   411     event._dispatchListeners = null;
       
   412     event._dispatchInstances = null;
       
   413   }
       
   414 
       
   415   var FunctionComponent = 0;
       
   416   var ClassComponent = 1;
       
   417   var IndeterminateComponent = 2; // Before we know whether it is function or class
       
   418 
       
   419   var HostRoot = 3; // Root of a host tree. Could be nested inside another node.
       
   420 
       
   421   var HostPortal = 4; // A subtree. Could be an entry point to a different renderer.
       
   422 
       
   423   var HostComponent = 5;
       
   424   var HostText = 6;
       
   425   var Fragment = 7;
       
   426   var Mode = 8;
       
   427   var ContextConsumer = 9;
       
   428   var ContextProvider = 10;
       
   429   var ForwardRef = 11;
       
   430   var Profiler = 12;
       
   431   var SuspenseComponent = 13;
       
   432   var MemoComponent = 14;
       
   433   var SimpleMemoComponent = 15;
       
   434   var LazyComponent = 16;
       
   435   var IncompleteClassComponent = 17;
       
   436   var DehydratedFragment = 18;
       
   437   var SuspenseListComponent = 19;
       
   438   var FundamentalComponent = 20;
       
   439   var ScopeComponent = 21;
       
   440   var Block = 22;
       
   441 
       
   442   /**
       
   443    * Injectable ordering of event plugins.
       
   444    */
       
   445   var eventPluginOrder = null;
       
   446   /**
       
   447    * Injectable mapping from names to event plugin modules.
       
   448    */
       
   449 
       
   450   var namesToPlugins = {};
       
   451   /**
       
   452    * Recomputes the plugin list using the injected plugins and plugin ordering.
       
   453    *
       
   454    * @private
       
   455    */
       
   456 
       
   457   function recomputePluginOrdering() {
       
   458     if (!eventPluginOrder) {
       
   459       // Wait until an `eventPluginOrder` is injected.
       
   460       return;
       
   461     }
       
   462 
       
   463     for (var pluginName in namesToPlugins) {
       
   464       var pluginModule = namesToPlugins[pluginName];
       
   465       var pluginIndex = eventPluginOrder.indexOf(pluginName);
       
   466 
       
   467       if (!(pluginIndex > -1)) {
       
   468         {
       
   469           throw Error( "EventPluginRegistry: Cannot inject event plugins that do not exist in the plugin ordering, `" + pluginName + "`." );
       
   470         }
       
   471       }
       
   472 
       
   473       if (plugins[pluginIndex]) {
  4951         continue;
   474         continue;
  4952       }
   475       }
  4953       var _props = _responderInstance.props,
   476 
  4954           _responder = _responderInstance.responder,
   477       if (!pluginModule.extractEvents) {
  4955           _state = _responderInstance.state,
   478         {
  4956           _target = _responderInstance.target;
   479           throw Error( "EventPluginRegistry: Event plugins must implement an `extractEvents` method, but `" + pluginName + "` does not." );
  4957 
   480         }
  4958       var onRootEvent = _responder.onRootEvent;
   481       }
  4959       if (onRootEvent !== null) {
   482 
  4960         currentInstance = _responderInstance;
   483       plugins[pluginIndex] = pluginModule;
  4961         responderEvent.responderTarget = _target;
   484       var publishedEvents = pluginModule.eventTypes;
  4962         onRootEvent(responderEvent, eventResponderContext, _props, _state);
   485 
  4963       }
   486       for (var eventName in publishedEvents) {
  4964     }
   487         if (!publishEventForPlugin(publishedEvents[eventName], pluginModule, eventName)) {
  4965   }
   488           {
  4966 }
   489             throw Error( "EventPluginRegistry: Failed to publish event `" + eventName + "` for plugin `" + pluginName + "`." );
  4967 
   490           }
  4968 function triggerOwnershipListeners() {
   491         }
  4969   var listeningInstances = Array.from(ownershipChangeListeners);
   492       }
  4970   var previousInstance = currentInstance;
   493     }
  4971   var previousEventQueuePriority = currentEventQueuePriority;
   494   }
  4972   var previousEventQueue = currentEventQueue;
   495   /**
  4973   try {
   496    * Publishes an event so that it can be dispatched by the supplied plugin.
  4974     for (var i = 0; i < listeningInstances.length; i++) {
   497    *
  4975       var _instance2 = listeningInstances[i];
   498    * @param {object} dispatchConfig Dispatch configuration for the event.
  4976       var props = _instance2.props,
   499    * @param {object} PluginModule Plugin publishing the event.
  4977           responder = _instance2.responder,
   500    * @return {boolean} True if the event was successfully published.
  4978           state = _instance2.state;
   501    * @private
  4979 
   502    */
  4980       currentInstance = _instance2;
   503 
  4981       currentEventQueuePriority = ContinuousEvent;
   504 
  4982       currentEventQueue = [];
   505   function publishEventForPlugin(dispatchConfig, pluginModule, eventName) {
  4983       var onOwnershipChange = responder.onOwnershipChange;
   506     if (!!eventNameDispatchConfigs.hasOwnProperty(eventName)) {
  4984       if (onOwnershipChange !== null) {
   507       {
  4985         onOwnershipChange(eventResponderContext, props, state);
   508         throw Error( "EventPluginRegistry: More than one plugin attempted to publish the same event name, `" + eventName + "`." );
  4986       }
   509       }
  4987     }
   510     }
  4988     processEventQueue();
   511 
  4989   } finally {
   512     eventNameDispatchConfigs[eventName] = dispatchConfig;
  4990     currentInstance = previousInstance;
   513     var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames;
  4991     currentEventQueue = previousEventQueue;
   514 
  4992     currentEventQueuePriority = previousEventQueuePriority;
   515     if (phasedRegistrationNames) {
  4993   }
   516       for (var phaseName in phasedRegistrationNames) {
  4994 }
   517         if (phasedRegistrationNames.hasOwnProperty(phaseName)) {
  4995 
   518           var phasedRegistrationName = phasedRegistrationNames[phaseName];
  4996 function mountEventResponder(responder, responderInstance, props, state) {
   519           publishRegistrationName(phasedRegistrationName, pluginModule, eventName);
  4997   if (responder.onOwnershipChange !== null) {
   520         }
  4998     ownershipChangeListeners.add(responderInstance);
   521       }
  4999   }
   522 
  5000   var onMount = responder.onMount;
   523       return true;
  5001   if (onMount !== null) {
   524     } else if (dispatchConfig.registrationName) {
  5002     currentEventQueuePriority = ContinuousEvent;
   525       publishRegistrationName(dispatchConfig.registrationName, pluginModule, eventName);
  5003     currentInstance = responderInstance;
   526       return true;
  5004     currentEventQueue = [];
   527     }
       
   528 
       
   529     return false;
       
   530   }
       
   531   /**
       
   532    * Publishes a registration name that is used to identify dispatched events.
       
   533    *
       
   534    * @param {string} registrationName Registration name to add.
       
   535    * @param {object} PluginModule Plugin publishing the event.
       
   536    * @private
       
   537    */
       
   538 
       
   539 
       
   540   function publishRegistrationName(registrationName, pluginModule, eventName) {
       
   541     if (!!registrationNameModules[registrationName]) {
       
   542       {
       
   543         throw Error( "EventPluginRegistry: More than one plugin attempted to publish the same registration name, `" + registrationName + "`." );
       
   544       }
       
   545     }
       
   546 
       
   547     registrationNameModules[registrationName] = pluginModule;
       
   548     registrationNameDependencies[registrationName] = pluginModule.eventTypes[eventName].dependencies;
       
   549 
       
   550     {
       
   551       var lowerCasedName = registrationName.toLowerCase();
       
   552       possibleRegistrationNames[lowerCasedName] = registrationName;
       
   553 
       
   554       if (registrationName === 'onDoubleClick') {
       
   555         possibleRegistrationNames.ondblclick = registrationName;
       
   556       }
       
   557     }
       
   558   }
       
   559   /**
       
   560    * Registers plugins so that they can extract and dispatch events.
       
   561    */
       
   562 
       
   563   /**
       
   564    * Ordered list of injected plugins.
       
   565    */
       
   566 
       
   567 
       
   568   var plugins = [];
       
   569   /**
       
   570    * Mapping from event name to dispatch config
       
   571    */
       
   572 
       
   573   var eventNameDispatchConfigs = {};
       
   574   /**
       
   575    * Mapping from registration name to plugin module
       
   576    */
       
   577 
       
   578   var registrationNameModules = {};
       
   579   /**
       
   580    * Mapping from registration name to event name
       
   581    */
       
   582 
       
   583   var registrationNameDependencies = {};
       
   584   /**
       
   585    * Mapping from lowercase registration names to the properly cased version,
       
   586    * used to warn in the case of missing event handlers. Available
       
   587    * only in true.
       
   588    * @type {Object}
       
   589    */
       
   590 
       
   591   var possibleRegistrationNames =  {} ; // Trust the developer to only use possibleRegistrationNames in true
       
   592 
       
   593   /**
       
   594    * Injects an ordering of plugins (by plugin name). This allows the ordering
       
   595    * to be decoupled from injection of the actual plugins so that ordering is
       
   596    * always deterministic regardless of packaging, on-the-fly injection, etc.
       
   597    *
       
   598    * @param {array} InjectedEventPluginOrder
       
   599    * @internal
       
   600    */
       
   601 
       
   602   function injectEventPluginOrder(injectedEventPluginOrder) {
       
   603     if (!!eventPluginOrder) {
       
   604       {
       
   605         throw Error( "EventPluginRegistry: Cannot inject event plugin ordering more than once. You are likely trying to load more than one copy of React." );
       
   606       }
       
   607     } // Clone the ordering so it cannot be dynamically mutated.
       
   608 
       
   609 
       
   610     eventPluginOrder = Array.prototype.slice.call(injectedEventPluginOrder);
       
   611     recomputePluginOrdering();
       
   612   }
       
   613   /**
       
   614    * Injects plugins to be used by plugin event system. The plugin names must be
       
   615    * in the ordering injected by `injectEventPluginOrder`.
       
   616    *
       
   617    * Plugins can be injected as part of page initialization or on-the-fly.
       
   618    *
       
   619    * @param {object} injectedNamesToPlugins Map from names to plugin modules.
       
   620    * @internal
       
   621    */
       
   622 
       
   623   function injectEventPluginsByName(injectedNamesToPlugins) {
       
   624     var isOrderingDirty = false;
       
   625 
       
   626     for (var pluginName in injectedNamesToPlugins) {
       
   627       if (!injectedNamesToPlugins.hasOwnProperty(pluginName)) {
       
   628         continue;
       
   629       }
       
   630 
       
   631       var pluginModule = injectedNamesToPlugins[pluginName];
       
   632 
       
   633       if (!namesToPlugins.hasOwnProperty(pluginName) || namesToPlugins[pluginName] !== pluginModule) {
       
   634         if (!!namesToPlugins[pluginName]) {
       
   635           {
       
   636             throw Error( "EventPluginRegistry: Cannot inject two different event plugins using the same name, `" + pluginName + "`." );
       
   637           }
       
   638         }
       
   639 
       
   640         namesToPlugins[pluginName] = pluginModule;
       
   641         isOrderingDirty = true;
       
   642       }
       
   643     }
       
   644 
       
   645     if (isOrderingDirty) {
       
   646       recomputePluginOrdering();
       
   647     }
       
   648   }
       
   649 
       
   650   var canUseDOM = !!(typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined');
       
   651 
       
   652   var ReactInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
       
   653   var _assign = ReactInternals.assign;
       
   654 
       
   655   var PLUGIN_EVENT_SYSTEM = 1;
       
   656   var IS_REPLAYED = 1 << 5;
       
   657   var IS_FIRST_ANCESTOR = 1 << 6;
       
   658 
       
   659   var restoreImpl = null;
       
   660   var restoreTarget = null;
       
   661   var restoreQueue = null;
       
   662 
       
   663   function restoreStateOfTarget(target) {
       
   664     // We perform this translation at the end of the event loop so that we
       
   665     // always receive the correct fiber here
       
   666     var internalInstance = getInstanceFromNode(target);
       
   667 
       
   668     if (!internalInstance) {
       
   669       // Unmounted
       
   670       return;
       
   671     }
       
   672 
       
   673     if (!(typeof restoreImpl === 'function')) {
       
   674       {
       
   675         throw Error( "setRestoreImplementation() needs to be called to handle a target for controlled events. This error is likely caused by a bug in React. Please file an issue." );
       
   676       }
       
   677     }
       
   678 
       
   679     var stateNode = internalInstance.stateNode; // Guard against Fiber being unmounted.
       
   680 
       
   681     if (stateNode) {
       
   682       var _props = getFiberCurrentPropsFromNode(stateNode);
       
   683 
       
   684       restoreImpl(internalInstance.stateNode, internalInstance.type, _props);
       
   685     }
       
   686   }
       
   687 
       
   688   function setRestoreImplementation(impl) {
       
   689     restoreImpl = impl;
       
   690   }
       
   691   function enqueueStateRestore(target) {
       
   692     if (restoreTarget) {
       
   693       if (restoreQueue) {
       
   694         restoreQueue.push(target);
       
   695       } else {
       
   696         restoreQueue = [target];
       
   697       }
       
   698     } else {
       
   699       restoreTarget = target;
       
   700     }
       
   701   }
       
   702   function needsStateRestore() {
       
   703     return restoreTarget !== null || restoreQueue !== null;
       
   704   }
       
   705   function restoreStateIfNeeded() {
       
   706     if (!restoreTarget) {
       
   707       return;
       
   708     }
       
   709 
       
   710     var target = restoreTarget;
       
   711     var queuedTargets = restoreQueue;
       
   712     restoreTarget = null;
       
   713     restoreQueue = null;
       
   714     restoreStateOfTarget(target);
       
   715 
       
   716     if (queuedTargets) {
       
   717       for (var i = 0; i < queuedTargets.length; i++) {
       
   718         restoreStateOfTarget(queuedTargets[i]);
       
   719       }
       
   720     }
       
   721   }
       
   722 
       
   723   var enableProfilerTimer = true; // Trace which interactions trigger each commit.
       
   724 
       
   725   var enableDeprecatedFlareAPI = false; // Experimental Host Component support.
       
   726 
       
   727   var enableFundamentalAPI = false; // Experimental Scope support.
       
   728   var warnAboutStringRefs = false;
       
   729 
       
   730   // the renderer. Such as when we're dispatching events or if third party
       
   731   // libraries need to call batchedUpdates. Eventually, this API will go away when
       
   732   // everything is batched by default. We'll then have a similar API to opt-out of
       
   733   // scheduled work and instead do synchronous work.
       
   734   // Defaults
       
   735 
       
   736   var batchedUpdatesImpl = function (fn, bookkeeping) {
       
   737     return fn(bookkeeping);
       
   738   };
       
   739 
       
   740   var discreteUpdatesImpl = function (fn, a, b, c, d) {
       
   741     return fn(a, b, c, d);
       
   742   };
       
   743 
       
   744   var flushDiscreteUpdatesImpl = function () {};
       
   745 
       
   746   var batchedEventUpdatesImpl = batchedUpdatesImpl;
       
   747   var isInsideEventHandler = false;
       
   748   var isBatchingEventUpdates = false;
       
   749 
       
   750   function finishEventHandler() {
       
   751     // Here we wait until all updates have propagated, which is important
       
   752     // when using controlled components within layers:
       
   753     // https://github.com/facebook/react/issues/1698
       
   754     // Then we restore state of any controlled component.
       
   755     var controlledComponentsHavePendingUpdates = needsStateRestore();
       
   756 
       
   757     if (controlledComponentsHavePendingUpdates) {
       
   758       // If a controlled event was fired, we may need to restore the state of
       
   759       // the DOM node back to the controlled value. This is necessary when React
       
   760       // bails out of the update without touching the DOM.
       
   761       flushDiscreteUpdatesImpl();
       
   762       restoreStateIfNeeded();
       
   763     }
       
   764   }
       
   765 
       
   766   function batchedUpdates(fn, bookkeeping) {
       
   767     if (isInsideEventHandler) {
       
   768       // If we are currently inside another batch, we need to wait until it
       
   769       // fully completes before restoring state.
       
   770       return fn(bookkeeping);
       
   771     }
       
   772 
       
   773     isInsideEventHandler = true;
       
   774 
  5005     try {
   775     try {
  5006       onMount(eventResponderContext, props, state);
   776       return batchedUpdatesImpl(fn, bookkeeping);
  5007       processEventQueue();
       
  5008     } finally {
   777     } finally {
  5009       currentEventQueue = null;
   778       isInsideEventHandler = false;
  5010       currentInstance = null;
   779       finishEventHandler();
  5011       currentTimers = null;
   780     }
  5012     }
   781   }
  5013   }
   782   function batchedEventUpdates(fn, a, b) {
  5014 }
   783     if (isBatchingEventUpdates) {
  5015 
   784       // If we are currently inside another batch, we need to wait until it
  5016 function unmountEventResponder(responderInstance) {
   785       // fully completes before restoring state.
  5017   var responder = responderInstance.responder;
   786       return fn(a, b);
  5018   var onUnmount = responder.onUnmount;
   787     }
  5019   if (onUnmount !== null) {
   788 
  5020     var props = responderInstance.props,
   789     isBatchingEventUpdates = true;
  5021         state = responderInstance.state;
   790 
  5022 
       
  5023     currentEventQueue = [];
       
  5024     currentEventQueuePriority = ContinuousEvent;
       
  5025     currentInstance = responderInstance;
       
  5026     try {
   791     try {
  5027       onUnmount(eventResponderContext, props, state);
   792       return batchedEventUpdatesImpl(fn, a, b);
  5028       processEventQueue();
       
  5029     } finally {
   793     } finally {
  5030       currentEventQueue = null;
   794       isBatchingEventUpdates = false;
  5031       currentInstance = null;
   795       finishEventHandler();
  5032       currentTimers = null;
   796     }
  5033     }
   797   } // This is for the React Flare event system
  5034   }
   798   function discreteUpdates(fn, a, b, c, d) {
  5035   releaseOwnershipForEventResponderInstance(responderInstance);
   799     var prevIsInsideEventHandler = isInsideEventHandler;
  5036   if (responder.onOwnershipChange !== null) {
   800     isInsideEventHandler = true;
  5037     ownershipChangeListeners.delete(responderInstance);
   801 
  5038   }
   802     try {
  5039   var rootEventTypesSet = responderInstance.rootEventTypes;
   803       return discreteUpdatesImpl(fn, a, b, c, d);
  5040   if (rootEventTypesSet !== null) {
   804     } finally {
  5041     var rootEventTypes = Array.from(rootEventTypesSet);
   805       isInsideEventHandler = prevIsInsideEventHandler;
  5042 
   806 
  5043     for (var i = 0; i < rootEventTypes.length; i++) {
   807       if (!isInsideEventHandler) {
  5044       var topLevelEventType = rootEventTypes[i];
   808         finishEventHandler();
  5045       var rootEventResponderInstances = rootEventTypesToEventResponderInstances.get(topLevelEventType);
   809       }
  5046       if (rootEventResponderInstances !== undefined) {
   810     }
  5047         rootEventResponderInstances.delete(responderInstance);
   811   }
  5048       }
   812   function flushDiscreteUpdatesIfNeeded(timeStamp) {
  5049     }
   813     // event.timeStamp isn't overly reliable due to inconsistencies in
  5050   }
   814     // how different browsers have historically provided the time stamp.
  5051 }
   815     // Some browsers provide high-resolution time stamps for all events,
  5052 
   816     // some provide low-resolution time stamps for all events. FF < 52
  5053 function validateResponderContext() {
   817     // even mixes both time stamps together. Some browsers even report
  5054   (function () {
   818     // negative time stamps or time stamps that are 0 (iOS9) in some cases.
  5055     if (!(currentInstance !== null)) {
   819     // Given we are only comparing two time stamps with equality (!==),
       
   820     // we are safe from the resolution differences. If the time stamp is 0
       
   821     // we bail-out of preventing the flush, which can affect semantics,
       
   822     // such as if an earlier flush removes or adds event listeners that
       
   823     // are fired in the subsequent flush. However, this is the same
       
   824     // behaviour as we had before this change, so the risks are low.
       
   825     if (!isInsideEventHandler && (!enableDeprecatedFlareAPI  )) {
       
   826       flushDiscreteUpdatesImpl();
       
   827     }
       
   828   }
       
   829   function setBatchingImplementation(_batchedUpdatesImpl, _discreteUpdatesImpl, _flushDiscreteUpdatesImpl, _batchedEventUpdatesImpl) {
       
   830     batchedUpdatesImpl = _batchedUpdatesImpl;
       
   831     discreteUpdatesImpl = _discreteUpdatesImpl;
       
   832     flushDiscreteUpdatesImpl = _flushDiscreteUpdatesImpl;
       
   833     batchedEventUpdatesImpl = _batchedEventUpdatesImpl;
       
   834   }
       
   835 
       
   836   var DiscreteEvent = 0;
       
   837   var UserBlockingEvent = 1;
       
   838   var ContinuousEvent = 2;
       
   839 
       
   840   var ReactInternals$1 = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
       
   841   var _ReactInternals$Sched = ReactInternals$1.Scheduler,
       
   842       unstable_cancelCallback = _ReactInternals$Sched.unstable_cancelCallback,
       
   843       unstable_now = _ReactInternals$Sched.unstable_now,
       
   844       unstable_scheduleCallback = _ReactInternals$Sched.unstable_scheduleCallback,
       
   845       unstable_shouldYield = _ReactInternals$Sched.unstable_shouldYield,
       
   846       unstable_requestPaint = _ReactInternals$Sched.unstable_requestPaint,
       
   847       unstable_getFirstCallbackNode = _ReactInternals$Sched.unstable_getFirstCallbackNode,
       
   848       unstable_runWithPriority = _ReactInternals$Sched.unstable_runWithPriority,
       
   849       unstable_next = _ReactInternals$Sched.unstable_next,
       
   850       unstable_continueExecution = _ReactInternals$Sched.unstable_continueExecution,
       
   851       unstable_pauseExecution = _ReactInternals$Sched.unstable_pauseExecution,
       
   852       unstable_getCurrentPriorityLevel = _ReactInternals$Sched.unstable_getCurrentPriorityLevel,
       
   853       unstable_ImmediatePriority = _ReactInternals$Sched.unstable_ImmediatePriority,
       
   854       unstable_UserBlockingPriority = _ReactInternals$Sched.unstable_UserBlockingPriority,
       
   855       unstable_NormalPriority = _ReactInternals$Sched.unstable_NormalPriority,
       
   856       unstable_LowPriority = _ReactInternals$Sched.unstable_LowPriority,
       
   857       unstable_IdlePriority = _ReactInternals$Sched.unstable_IdlePriority,
       
   858       unstable_forceFrameRate = _ReactInternals$Sched.unstable_forceFrameRate,
       
   859       unstable_flushAllWithoutAsserting = _ReactInternals$Sched.unstable_flushAllWithoutAsserting;
       
   860 
       
   861   // A reserved attribute.
       
   862   // It is handled by React separately and shouldn't be written to the DOM.
       
   863   var RESERVED = 0; // A simple string attribute.
       
   864   // Attributes that aren't in the whitelist are presumed to have this type.
       
   865 
       
   866   var STRING = 1; // A string attribute that accepts booleans in React. In HTML, these are called
       
   867   // "enumerated" attributes with "true" and "false" as possible values.
       
   868   // When true, it should be set to a "true" string.
       
   869   // When false, it should be set to a "false" string.
       
   870 
       
   871   var BOOLEANISH_STRING = 2; // A real boolean attribute.
       
   872   // When true, it should be present (set either to an empty string or its name).
       
   873   // When false, it should be omitted.
       
   874 
       
   875   var BOOLEAN = 3; // An attribute that can be used as a flag as well as with a value.
       
   876   // When true, it should be present (set either to an empty string or its name).
       
   877   // When false, it should be omitted.
       
   878   // For any other value, should be present with that value.
       
   879 
       
   880   var OVERLOADED_BOOLEAN = 4; // An attribute that must be numeric or parse as a numeric.
       
   881   // When falsy, it should be removed.
       
   882 
       
   883   var NUMERIC = 5; // An attribute that must be positive numeric or parse as a positive numeric.
       
   884   // When falsy, it should be removed.
       
   885 
       
   886   var POSITIVE_NUMERIC = 6;
       
   887 
       
   888   /* eslint-disable max-len */
       
   889   var ATTRIBUTE_NAME_START_CHAR = ":A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD";
       
   890   /* eslint-enable max-len */
       
   891 
       
   892   var ATTRIBUTE_NAME_CHAR = ATTRIBUTE_NAME_START_CHAR + "\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040";
       
   893   var ROOT_ATTRIBUTE_NAME = 'data-reactroot';
       
   894   var VALID_ATTRIBUTE_NAME_REGEX = new RegExp('^[' + ATTRIBUTE_NAME_START_CHAR + '][' + ATTRIBUTE_NAME_CHAR + ']*$');
       
   895   var hasOwnProperty = Object.prototype.hasOwnProperty;
       
   896   var illegalAttributeNameCache = {};
       
   897   var validatedAttributeNameCache = {};
       
   898   function isAttributeNameSafe(attributeName) {
       
   899     if (hasOwnProperty.call(validatedAttributeNameCache, attributeName)) {
       
   900       return true;
       
   901     }
       
   902 
       
   903     if (hasOwnProperty.call(illegalAttributeNameCache, attributeName)) {
       
   904       return false;
       
   905     }
       
   906 
       
   907     if (VALID_ATTRIBUTE_NAME_REGEX.test(attributeName)) {
       
   908       validatedAttributeNameCache[attributeName] = true;
       
   909       return true;
       
   910     }
       
   911 
       
   912     illegalAttributeNameCache[attributeName] = true;
       
   913 
       
   914     {
       
   915       error('Invalid attribute name: `%s`', attributeName);
       
   916     }
       
   917 
       
   918     return false;
       
   919   }
       
   920   function shouldIgnoreAttribute(name, propertyInfo, isCustomComponentTag) {
       
   921     if (propertyInfo !== null) {
       
   922       return propertyInfo.type === RESERVED;
       
   923     }
       
   924 
       
   925     if (isCustomComponentTag) {
       
   926       return false;
       
   927     }
       
   928 
       
   929     if (name.length > 2 && (name[0] === 'o' || name[0] === 'O') && (name[1] === 'n' || name[1] === 'N')) {
       
   930       return true;
       
   931     }
       
   932 
       
   933     return false;
       
   934   }
       
   935   function shouldRemoveAttributeWithWarning(name, value, propertyInfo, isCustomComponentTag) {
       
   936     if (propertyInfo !== null && propertyInfo.type === RESERVED) {
       
   937       return false;
       
   938     }
       
   939 
       
   940     switch (typeof value) {
       
   941       case 'function': // $FlowIssue symbol is perfectly valid here
       
   942 
       
   943       case 'symbol':
       
   944         // eslint-disable-line
       
   945         return true;
       
   946 
       
   947       case 'boolean':
       
   948         {
       
   949           if (isCustomComponentTag) {
       
   950             return false;
       
   951           }
       
   952 
       
   953           if (propertyInfo !== null) {
       
   954             return !propertyInfo.acceptsBooleans;
       
   955           } else {
       
   956             var prefix = name.toLowerCase().slice(0, 5);
       
   957             return prefix !== 'data-' && prefix !== 'aria-';
       
   958           }
       
   959         }
       
   960 
       
   961       default:
       
   962         return false;
       
   963     }
       
   964   }
       
   965   function shouldRemoveAttribute(name, value, propertyInfo, isCustomComponentTag) {
       
   966     if (value === null || typeof value === 'undefined') {
       
   967       return true;
       
   968     }
       
   969 
       
   970     if (shouldRemoveAttributeWithWarning(name, value, propertyInfo, isCustomComponentTag)) {
       
   971       return true;
       
   972     }
       
   973 
       
   974     if (isCustomComponentTag) {
       
   975       return false;
       
   976     }
       
   977 
       
   978     if (propertyInfo !== null) {
       
   979       switch (propertyInfo.type) {
       
   980         case BOOLEAN:
       
   981           return !value;
       
   982 
       
   983         case OVERLOADED_BOOLEAN:
       
   984           return value === false;
       
   985 
       
   986         case NUMERIC:
       
   987           return isNaN(value);
       
   988 
       
   989         case POSITIVE_NUMERIC:
       
   990           return isNaN(value) || value < 1;
       
   991       }
       
   992     }
       
   993 
       
   994     return false;
       
   995   }
       
   996   function getPropertyInfo(name) {
       
   997     return properties.hasOwnProperty(name) ? properties[name] : null;
       
   998   }
       
   999 
       
  1000   function PropertyInfoRecord(name, type, mustUseProperty, attributeName, attributeNamespace, sanitizeURL) {
       
  1001     this.acceptsBooleans = type === BOOLEANISH_STRING || type === BOOLEAN || type === OVERLOADED_BOOLEAN;
       
  1002     this.attributeName = attributeName;
       
  1003     this.attributeNamespace = attributeNamespace;
       
  1004     this.mustUseProperty = mustUseProperty;
       
  1005     this.propertyName = name;
       
  1006     this.type = type;
       
  1007     this.sanitizeURL = sanitizeURL;
       
  1008   } // When adding attributes to this list, be sure to also add them to
       
  1009   // the `possibleStandardNames` module to ensure casing and incorrect
       
  1010   // name warnings.
       
  1011 
       
  1012 
       
  1013   var properties = {}; // These props are reserved by React. They shouldn't be written to the DOM.
       
  1014 
       
  1015   var reservedProps = ['children', 'dangerouslySetInnerHTML', // TODO: This prevents the assignment of defaultValue to regular
       
  1016   // elements (not just inputs). Now that ReactDOMInput assigns to the
       
  1017   // defaultValue property -- do we need this?
       
  1018   'defaultValue', 'defaultChecked', 'innerHTML', 'suppressContentEditableWarning', 'suppressHydrationWarning', 'style'];
       
  1019 
       
  1020   reservedProps.forEach(function (name) {
       
  1021     properties[name] = new PropertyInfoRecord(name, RESERVED, false, // mustUseProperty
       
  1022     name, // attributeName
       
  1023     null, // attributeNamespace
       
  1024     false);
       
  1025   }); // A few React string attributes have a different name.
       
  1026   // This is a mapping from React prop names to the attribute names.
       
  1027 
       
  1028   [['acceptCharset', 'accept-charset'], ['className', 'class'], ['htmlFor', 'for'], ['httpEquiv', 'http-equiv']].forEach(function (_ref) {
       
  1029     var name = _ref[0],
       
  1030         attributeName = _ref[1];
       
  1031     properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
       
  1032     attributeName, // attributeName
       
  1033     null, // attributeNamespace
       
  1034     false);
       
  1035   }); // These are "enumerated" HTML attributes that accept "true" and "false".
       
  1036   // In React, we let users pass `true` and `false` even though technically
       
  1037   // these aren't boolean attributes (they are coerced to strings).
       
  1038 
       
  1039   ['contentEditable', 'draggable', 'spellCheck', 'value'].forEach(function (name) {
       
  1040     properties[name] = new PropertyInfoRecord(name, BOOLEANISH_STRING, false, // mustUseProperty
       
  1041     name.toLowerCase(), // attributeName
       
  1042     null, // attributeNamespace
       
  1043     false);
       
  1044   }); // These are "enumerated" SVG attributes that accept "true" and "false".
       
  1045   // In React, we let users pass `true` and `false` even though technically
       
  1046   // these aren't boolean attributes (they are coerced to strings).
       
  1047   // Since these are SVG attributes, their attribute names are case-sensitive.
       
  1048 
       
  1049   ['autoReverse', 'externalResourcesRequired', 'focusable', 'preserveAlpha'].forEach(function (name) {
       
  1050     properties[name] = new PropertyInfoRecord(name, BOOLEANISH_STRING, false, // mustUseProperty
       
  1051     name, // attributeName
       
  1052     null, // attributeNamespace
       
  1053     false);
       
  1054   }); // These are HTML boolean attributes.
       
  1055 
       
  1056   ['allowFullScreen', 'async', // Note: there is a special case that prevents it from being written to the DOM
       
  1057   // on the client side because the browsers are inconsistent. Instead we call focus().
       
  1058   'autoFocus', 'autoPlay', 'controls', 'default', 'defer', 'disabled', 'disablePictureInPicture', 'formNoValidate', 'hidden', 'loop', 'noModule', 'noValidate', 'open', 'playsInline', 'readOnly', 'required', 'reversed', 'scoped', 'seamless', // Microdata
       
  1059   'itemScope'].forEach(function (name) {
       
  1060     properties[name] = new PropertyInfoRecord(name, BOOLEAN, false, // mustUseProperty
       
  1061     name.toLowerCase(), // attributeName
       
  1062     null, // attributeNamespace
       
  1063     false);
       
  1064   }); // These are the few React props that we set as DOM properties
       
  1065   // rather than attributes. These are all booleans.
       
  1066 
       
  1067   ['checked', // Note: `option.selected` is not updated if `select.multiple` is
       
  1068   // disabled with `removeAttribute`. We have special logic for handling this.
       
  1069   'multiple', 'muted', 'selected' // NOTE: if you add a camelCased prop to this list,
       
  1070   // you'll need to set attributeName to name.toLowerCase()
       
  1071   // instead in the assignment below.
       
  1072   ].forEach(function (name) {
       
  1073     properties[name] = new PropertyInfoRecord(name, BOOLEAN, true, // mustUseProperty
       
  1074     name, // attributeName
       
  1075     null, // attributeNamespace
       
  1076     false);
       
  1077   }); // These are HTML attributes that are "overloaded booleans": they behave like
       
  1078   // booleans, but can also accept a string value.
       
  1079 
       
  1080   ['capture', 'download' // NOTE: if you add a camelCased prop to this list,
       
  1081   // you'll need to set attributeName to name.toLowerCase()
       
  1082   // instead in the assignment below.
       
  1083   ].forEach(function (name) {
       
  1084     properties[name] = new PropertyInfoRecord(name, OVERLOADED_BOOLEAN, false, // mustUseProperty
       
  1085     name, // attributeName
       
  1086     null, // attributeNamespace
       
  1087     false);
       
  1088   }); // These are HTML attributes that must be positive numbers.
       
  1089 
       
  1090   ['cols', 'rows', 'size', 'span' // NOTE: if you add a camelCased prop to this list,
       
  1091   // you'll need to set attributeName to name.toLowerCase()
       
  1092   // instead in the assignment below.
       
  1093   ].forEach(function (name) {
       
  1094     properties[name] = new PropertyInfoRecord(name, POSITIVE_NUMERIC, false, // mustUseProperty
       
  1095     name, // attributeName
       
  1096     null, // attributeNamespace
       
  1097     false);
       
  1098   }); // These are HTML attributes that must be numbers.
       
  1099 
       
  1100   ['rowSpan', 'start'].forEach(function (name) {
       
  1101     properties[name] = new PropertyInfoRecord(name, NUMERIC, false, // mustUseProperty
       
  1102     name.toLowerCase(), // attributeName
       
  1103     null, // attributeNamespace
       
  1104     false);
       
  1105   });
       
  1106   var CAMELIZE = /[\-\:]([a-z])/g;
       
  1107 
       
  1108   var capitalize = function (token) {
       
  1109     return token[1].toUpperCase();
       
  1110   }; // This is a list of all SVG attributes that need special casing, namespacing,
       
  1111   // or boolean value assignment. Regular attributes that just accept strings
       
  1112   // and have the same names are omitted, just like in the HTML whitelist.
       
  1113   // Some of these attributes can be hard to find. This list was created by
       
  1114   // scraping the MDN documentation.
       
  1115 
       
  1116 
       
  1117   ['accent-height', 'alignment-baseline', 'arabic-form', 'baseline-shift', 'cap-height', 'clip-path', 'clip-rule', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'dominant-baseline', 'enable-background', 'fill-opacity', 'fill-rule', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'glyph-name', 'glyph-orientation-horizontal', 'glyph-orientation-vertical', 'horiz-adv-x', 'horiz-origin-x', 'image-rendering', 'letter-spacing', 'lighting-color', 'marker-end', 'marker-mid', 'marker-start', 'overline-position', 'overline-thickness', 'paint-order', 'panose-1', 'pointer-events', 'rendering-intent', 'shape-rendering', 'stop-color', 'stop-opacity', 'strikethrough-position', 'strikethrough-thickness', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke-width', 'text-anchor', 'text-decoration', 'text-rendering', 'underline-position', 'underline-thickness', 'unicode-bidi', 'unicode-range', 'units-per-em', 'v-alphabetic', 'v-hanging', 'v-ideographic', 'v-mathematical', 'vector-effect', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'word-spacing', 'writing-mode', 'xmlns:xlink', 'x-height' // NOTE: if you add a camelCased prop to this list,
       
  1118   // you'll need to set attributeName to name.toLowerCase()
       
  1119   // instead in the assignment below.
       
  1120   ].forEach(function (attributeName) {
       
  1121     var name = attributeName.replace(CAMELIZE, capitalize);
       
  1122     properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
       
  1123     attributeName, null, // attributeNamespace
       
  1124     false);
       
  1125   }); // String SVG attributes with the xlink namespace.
       
  1126 
       
  1127   ['xlink:actuate', 'xlink:arcrole', 'xlink:role', 'xlink:show', 'xlink:title', 'xlink:type' // NOTE: if you add a camelCased prop to this list,
       
  1128   // you'll need to set attributeName to name.toLowerCase()
       
  1129   // instead in the assignment below.
       
  1130   ].forEach(function (attributeName) {
       
  1131     var name = attributeName.replace(CAMELIZE, capitalize);
       
  1132     properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
       
  1133     attributeName, 'http://www.w3.org/1999/xlink', false);
       
  1134   }); // String SVG attributes with the xml namespace.
       
  1135 
       
  1136   ['xml:base', 'xml:lang', 'xml:space' // NOTE: if you add a camelCased prop to this list,
       
  1137   // you'll need to set attributeName to name.toLowerCase()
       
  1138   // instead in the assignment below.
       
  1139   ].forEach(function (attributeName) {
       
  1140     var name = attributeName.replace(CAMELIZE, capitalize);
       
  1141     properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
       
  1142     attributeName, 'http://www.w3.org/XML/1998/namespace', false);
       
  1143   }); // These attribute exists both in HTML and SVG.
       
  1144   // The attribute name is case-sensitive in SVG so we can't just use
       
  1145   // the React name like we do for attributes that exist only in HTML.
       
  1146 
       
  1147   ['tabIndex', 'crossOrigin'].forEach(function (attributeName) {
       
  1148     properties[attributeName] = new PropertyInfoRecord(attributeName, STRING, false, // mustUseProperty
       
  1149     attributeName.toLowerCase(), // attributeName
       
  1150     null, // attributeNamespace
       
  1151     false);
       
  1152   }); // These attributes accept URLs. These must not allow javascript: URLS.
       
  1153   // These will also need to accept Trusted Types object in the future.
       
  1154 
       
  1155   var xlinkHref = 'xlinkHref';
       
  1156   properties[xlinkHref] = new PropertyInfoRecord('xlinkHref', STRING, false, // mustUseProperty
       
  1157   'xlink:href', 'http://www.w3.org/1999/xlink', true);
       
  1158   ['src', 'href', 'action', 'formAction'].forEach(function (attributeName) {
       
  1159     properties[attributeName] = new PropertyInfoRecord(attributeName, STRING, false, // mustUseProperty
       
  1160     attributeName.toLowerCase(), // attributeName
       
  1161     null, // attributeNamespace
       
  1162     true);
       
  1163   });
       
  1164 
       
  1165   var ReactDebugCurrentFrame = null;
       
  1166 
       
  1167   {
       
  1168     ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
       
  1169   } // A javascript: URL can contain leading C0 control or \u0020 SPACE,
       
  1170   // and any newline or tab are filtered out as if they're not part of the URL.
       
  1171   // https://url.spec.whatwg.org/#url-parsing
       
  1172   // Tab or newline are defined as \r\n\t:
       
  1173   // https://infra.spec.whatwg.org/#ascii-tab-or-newline
       
  1174   // A C0 control is a code point in the range \u0000 NULL to \u001F
       
  1175   // INFORMATION SEPARATOR ONE, inclusive:
       
  1176   // https://infra.spec.whatwg.org/#c0-control-or-space
       
  1177 
       
  1178   /* eslint-disable max-len */
       
  1179 
       
  1180 
       
  1181   var isJavaScriptProtocol = /^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*\:/i;
       
  1182   var didWarn = false;
       
  1183 
       
  1184   function sanitizeURL(url) {
       
  1185     {
       
  1186       if (!didWarn && isJavaScriptProtocol.test(url)) {
       
  1187         didWarn = true;
       
  1188 
       
  1189         error('A future version of React will block javascript: URLs as a security precaution. ' + 'Use event handlers instead if you can. If you need to generate unsafe HTML try ' + 'using dangerouslySetInnerHTML instead. React was passed %s.', JSON.stringify(url));
       
  1190       }
       
  1191     }
       
  1192   }
       
  1193 
       
  1194   /**
       
  1195    * Get the value for a property on a node. Only used in DEV for SSR validation.
       
  1196    * The "expected" argument is used as a hint of what the expected value is.
       
  1197    * Some properties have multiple equivalent values.
       
  1198    */
       
  1199   function getValueForProperty(node, name, expected, propertyInfo) {
       
  1200     {
       
  1201       if (propertyInfo.mustUseProperty) {
       
  1202         var propertyName = propertyInfo.propertyName;
       
  1203         return node[propertyName];
       
  1204       } else {
       
  1205         if ( propertyInfo.sanitizeURL) {
       
  1206           // If we haven't fully disabled javascript: URLs, and if
       
  1207           // the hydration is successful of a javascript: URL, we
       
  1208           // still want to warn on the client.
       
  1209           sanitizeURL('' + expected);
       
  1210         }
       
  1211 
       
  1212         var attributeName = propertyInfo.attributeName;
       
  1213         var stringValue = null;
       
  1214 
       
  1215         if (propertyInfo.type === OVERLOADED_BOOLEAN) {
       
  1216           if (node.hasAttribute(attributeName)) {
       
  1217             var value = node.getAttribute(attributeName);
       
  1218 
       
  1219             if (value === '') {
       
  1220               return true;
       
  1221             }
       
  1222 
       
  1223             if (shouldRemoveAttribute(name, expected, propertyInfo, false)) {
       
  1224               return value;
       
  1225             }
       
  1226 
       
  1227             if (value === '' + expected) {
       
  1228               return expected;
       
  1229             }
       
  1230 
       
  1231             return value;
       
  1232           }
       
  1233         } else if (node.hasAttribute(attributeName)) {
       
  1234           if (shouldRemoveAttribute(name, expected, propertyInfo, false)) {
       
  1235             // We had an attribute but shouldn't have had one, so read it
       
  1236             // for the error message.
       
  1237             return node.getAttribute(attributeName);
       
  1238           }
       
  1239 
       
  1240           if (propertyInfo.type === BOOLEAN) {
       
  1241             // If this was a boolean, it doesn't matter what the value is
       
  1242             // the fact that we have it is the same as the expected.
       
  1243             return expected;
       
  1244           } // Even if this property uses a namespace we use getAttribute
       
  1245           // because we assume its namespaced name is the same as our config.
       
  1246           // To use getAttributeNS we need the local name which we don't have
       
  1247           // in our config atm.
       
  1248 
       
  1249 
       
  1250           stringValue = node.getAttribute(attributeName);
       
  1251         }
       
  1252 
       
  1253         if (shouldRemoveAttribute(name, expected, propertyInfo, false)) {
       
  1254           return stringValue === null ? expected : stringValue;
       
  1255         } else if (stringValue === '' + expected) {
       
  1256           return expected;
       
  1257         } else {
       
  1258           return stringValue;
       
  1259         }
       
  1260       }
       
  1261     }
       
  1262   }
       
  1263   /**
       
  1264    * Get the value for a attribute on a node. Only used in DEV for SSR validation.
       
  1265    * The third argument is used as a hint of what the expected value is. Some
       
  1266    * attributes have multiple equivalent values.
       
  1267    */
       
  1268 
       
  1269   function getValueForAttribute(node, name, expected) {
       
  1270     {
       
  1271       if (!isAttributeNameSafe(name)) {
       
  1272         return;
       
  1273       }
       
  1274 
       
  1275       if (!node.hasAttribute(name)) {
       
  1276         return expected === undefined ? undefined : null;
       
  1277       }
       
  1278 
       
  1279       var value = node.getAttribute(name);
       
  1280 
       
  1281       if (value === '' + expected) {
       
  1282         return expected;
       
  1283       }
       
  1284 
       
  1285       return value;
       
  1286     }
       
  1287   }
       
  1288   /**
       
  1289    * Sets the value for a property on a node.
       
  1290    *
       
  1291    * @param {DOMElement} node
       
  1292    * @param {string} name
       
  1293    * @param {*} value
       
  1294    */
       
  1295 
       
  1296   function setValueForProperty(node, name, value, isCustomComponentTag) {
       
  1297     var propertyInfo = getPropertyInfo(name);
       
  1298 
       
  1299     if (shouldIgnoreAttribute(name, propertyInfo, isCustomComponentTag)) {
       
  1300       return;
       
  1301     }
       
  1302 
       
  1303     if (shouldRemoveAttribute(name, value, propertyInfo, isCustomComponentTag)) {
       
  1304       value = null;
       
  1305     } // If the prop isn't in the special list, treat it as a simple attribute.
       
  1306 
       
  1307 
       
  1308     if (isCustomComponentTag || propertyInfo === null) {
       
  1309       if (isAttributeNameSafe(name)) {
       
  1310         var _attributeName = name;
       
  1311 
       
  1312         if (value === null) {
       
  1313           node.removeAttribute(_attributeName);
       
  1314         } else {
       
  1315           node.setAttribute(_attributeName,  '' + value);
       
  1316         }
       
  1317       }
       
  1318 
       
  1319       return;
       
  1320     }
       
  1321 
       
  1322     var mustUseProperty = propertyInfo.mustUseProperty;
       
  1323 
       
  1324     if (mustUseProperty) {
       
  1325       var propertyName = propertyInfo.propertyName;
       
  1326 
       
  1327       if (value === null) {
       
  1328         var type = propertyInfo.type;
       
  1329         node[propertyName] = type === BOOLEAN ? false : '';
       
  1330       } else {
       
  1331         // Contrary to `setAttribute`, object properties are properly
       
  1332         // `toString`ed by IE8/9.
       
  1333         node[propertyName] = value;
       
  1334       }
       
  1335 
       
  1336       return;
       
  1337     } // The rest are treated as attributes with special cases.
       
  1338 
       
  1339 
       
  1340     var attributeName = propertyInfo.attributeName,
       
  1341         attributeNamespace = propertyInfo.attributeNamespace;
       
  1342 
       
  1343     if (value === null) {
       
  1344       node.removeAttribute(attributeName);
       
  1345     } else {
       
  1346       var _type = propertyInfo.type;
       
  1347       var attributeValue;
       
  1348 
       
  1349       if (_type === BOOLEAN || _type === OVERLOADED_BOOLEAN && value === true) {
       
  1350         // If attribute type is boolean, we know for sure it won't be an execution sink
       
  1351         // and we won't require Trusted Type here.
       
  1352         attributeValue = '';
       
  1353       } else {
       
  1354         // `setAttribute` with objects becomes only `[object]` in IE8/9,
       
  1355         // ('' + value) makes it output the correct toString()-value.
       
  1356         {
       
  1357           attributeValue = '' + value;
       
  1358         }
       
  1359 
       
  1360         if (propertyInfo.sanitizeURL) {
       
  1361           sanitizeURL(attributeValue.toString());
       
  1362         }
       
  1363       }
       
  1364 
       
  1365       if (attributeNamespace) {
       
  1366         node.setAttributeNS(attributeNamespace, attributeName, attributeValue);
       
  1367       } else {
       
  1368         node.setAttribute(attributeName, attributeValue);
       
  1369       }
       
  1370     }
       
  1371   }
       
  1372 
       
  1373   var BEFORE_SLASH_RE = /^(.*)[\\\/]/;
       
  1374   function describeComponentFrame (name, source, ownerName) {
       
  1375     var sourceInfo = '';
       
  1376 
       
  1377     if (source) {
       
  1378       var path = source.fileName;
       
  1379       var fileName = path.replace(BEFORE_SLASH_RE, '');
       
  1380 
  5056       {
  1381       {
  5057         throw ReactError(Error('An event responder context was used outside of an event cycle. Use context.setTimeout() to use asynchronous responder context outside of event cycle .'));
  1382         // In DEV, include code for a common special case:
  5058       }
  1383         // prefer "folder/index.js" instead of just "index.js".
  5059     }
  1384         if (/^index\./.test(fileName)) {
  5060   })();
  1385           var match = path.match(BEFORE_SLASH_RE);
  5061 }
  1386 
  5062 
  1387           if (match) {
  5063 function dispatchEventForResponderEventSystem(topLevelType, targetFiber, nativeEvent, nativeEventTarget, eventSystemFlags) {
  1388             var pathBeforeSlash = match[1];
  5064   if (enableFlareAPI) {
  1389 
  5065     var previousEventQueue = currentEventQueue;
  1390             if (pathBeforeSlash) {
  5066     var previousInstance = currentInstance;
  1391               var folderName = pathBeforeSlash.replace(BEFORE_SLASH_RE, '');
  5067     var previousTimers = currentTimers;
  1392               fileName = folderName + '/' + fileName;
  5068     var previousTimeStamp = currentTimeStamp;
  1393             }
  5069     var previousDocument = currentDocument;
  1394           }
  5070     var previousEventQueuePriority = currentEventQueuePriority;
  1395         }
  5071     currentTimers = null;
  1396       }
  5072     currentEventQueue = [];
  1397 
  5073     currentEventQueuePriority = ContinuousEvent;
  1398       sourceInfo = ' (at ' + fileName + ':' + source.lineNumber + ')';
  5074     // nodeType 9 is DOCUMENT_NODE
  1399     } else if (ownerName) {
  5075     currentDocument = nativeEventTarget.nodeType === 9 ? nativeEventTarget : nativeEventTarget.ownerDocument;
  1400       sourceInfo = ' (created by ' + ownerName + ')';
  5076     // We might want to control timeStamp another way here
  1401     }
  5077     currentTimeStamp = nativeEvent.timeStamp;
  1402 
  5078     try {
  1403     return '\n    in ' + (name || 'Unknown') + sourceInfo;
  5079       traverseAndHandleEventResponderInstances(topLevelType, targetFiber, nativeEvent, nativeEventTarget, eventSystemFlags);
  1404   }
  5080       processEventQueue();
  1405 
  5081     } finally {
  1406   // The Symbol used to tag the ReactElement-like types. If there is no native Symbol
  5082       currentTimers = previousTimers;
  1407   // nor polyfill, then a plain number is used for performance.
  5083       currentInstance = previousInstance;
  1408   var hasSymbol = typeof Symbol === 'function' && Symbol.for;
  5084       currentEventQueue = previousEventQueue;
  1409   var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
  5085       currentTimeStamp = previousTimeStamp;
  1410   var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
  5086       currentDocument = previousDocument;
  1411   var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
  5087       currentEventQueuePriority = previousEventQueuePriority;
  1412   var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
  5088     }
  1413   var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
  5089   }
  1414   var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
  5090 }
  1415   var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary
  5091 
  1416   var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
  5092 function addRootEventTypesForResponderInstance(responderInstance, rootEventTypes) {
  1417   var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
  5093   for (var i = 0; i < rootEventTypes.length; i++) {
  1418   var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
  5094     var rootEventType = rootEventTypes[i];
  1419   var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;
  5095     registerRootEventType(rootEventType, responderInstance);
  1420   var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
  5096   }
  1421   var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
  5097 }
  1422   var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9;
  5098 
  1423   var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
  5099 function registerRootEventType(rootEventType, eventResponderInstance) {
  1424   var FAUX_ITERATOR_SYMBOL = '@@iterator';
  5100   var rootEventResponderInstances = rootEventTypesToEventResponderInstances.get(rootEventType);
  1425   function getIteratorFn(maybeIterable) {
  5101   if (rootEventResponderInstances === undefined) {
  1426     if (maybeIterable === null || typeof maybeIterable !== 'object') {
  5102     rootEventResponderInstances = new Set();
  1427       return null;
  5103     rootEventTypesToEventResponderInstances.set(rootEventType, rootEventResponderInstances);
  1428     }
  5104   }
  1429 
  5105   var rootEventTypesSet = eventResponderInstance.rootEventTypes;
  1430     var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
  5106   if (rootEventTypesSet === null) {
  1431 
  5107     rootEventTypesSet = eventResponderInstance.rootEventTypes = new Set();
  1432     if (typeof maybeIterator === 'function') {
  5108   }
  1433       return maybeIterator;
  5109   (function () {
  1434     }
  5110     if (!!rootEventTypesSet.has(rootEventType)) {
  1435 
       
  1436     return null;
       
  1437   }
       
  1438 
       
  1439   var Uninitialized = -1;
       
  1440   var Pending = 0;
       
  1441   var Resolved = 1;
       
  1442   var Rejected = 2;
       
  1443   function refineResolvedLazyComponent(lazyComponent) {
       
  1444     return lazyComponent._status === Resolved ? lazyComponent._result : null;
       
  1445   }
       
  1446   function initializeLazyComponentType(lazyComponent) {
       
  1447     if (lazyComponent._status === Uninitialized) {
       
  1448       lazyComponent._status = Pending;
       
  1449       var ctor = lazyComponent._ctor;
       
  1450       var thenable = ctor();
       
  1451       lazyComponent._result = thenable;
       
  1452       thenable.then(function (moduleObject) {
       
  1453         if (lazyComponent._status === Pending) {
       
  1454           var defaultExport = moduleObject.default;
       
  1455 
       
  1456           {
       
  1457             if (defaultExport === undefined) {
       
  1458               error('lazy: Expected the result of a dynamic import() call. ' + 'Instead received: %s\n\nYour code should look like: \n  ' + "const MyComponent = lazy(() => import('./MyComponent'))", moduleObject);
       
  1459             }
       
  1460           }
       
  1461 
       
  1462           lazyComponent._status = Resolved;
       
  1463           lazyComponent._result = defaultExport;
       
  1464         }
       
  1465       }, function (error) {
       
  1466         if (lazyComponent._status === Pending) {
       
  1467           lazyComponent._status = Rejected;
       
  1468           lazyComponent._result = error;
       
  1469         }
       
  1470       });
       
  1471     }
       
  1472   }
       
  1473 
       
  1474   function getWrappedName(outerType, innerType, wrapperName) {
       
  1475     var functionName = innerType.displayName || innerType.name || '';
       
  1476     return outerType.displayName || (functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName);
       
  1477   }
       
  1478 
       
  1479   function getComponentName(type) {
       
  1480     if (type == null) {
       
  1481       // Host root, text node or just invalid type.
       
  1482       return null;
       
  1483     }
       
  1484 
       
  1485     {
       
  1486       if (typeof type.tag === 'number') {
       
  1487         error('Received an unexpected object in getComponentName(). ' + 'This is likely a bug in React. Please file an issue.');
       
  1488       }
       
  1489     }
       
  1490 
       
  1491     if (typeof type === 'function') {
       
  1492       return type.displayName || type.name || null;
       
  1493     }
       
  1494 
       
  1495     if (typeof type === 'string') {
       
  1496       return type;
       
  1497     }
       
  1498 
       
  1499     switch (type) {
       
  1500       case REACT_FRAGMENT_TYPE:
       
  1501         return 'Fragment';
       
  1502 
       
  1503       case REACT_PORTAL_TYPE:
       
  1504         return 'Portal';
       
  1505 
       
  1506       case REACT_PROFILER_TYPE:
       
  1507         return "Profiler";
       
  1508 
       
  1509       case REACT_STRICT_MODE_TYPE:
       
  1510         return 'StrictMode';
       
  1511 
       
  1512       case REACT_SUSPENSE_TYPE:
       
  1513         return 'Suspense';
       
  1514 
       
  1515       case REACT_SUSPENSE_LIST_TYPE:
       
  1516         return 'SuspenseList';
       
  1517     }
       
  1518 
       
  1519     if (typeof type === 'object') {
       
  1520       switch (type.$$typeof) {
       
  1521         case REACT_CONTEXT_TYPE:
       
  1522           return 'Context.Consumer';
       
  1523 
       
  1524         case REACT_PROVIDER_TYPE:
       
  1525           return 'Context.Provider';
       
  1526 
       
  1527         case REACT_FORWARD_REF_TYPE:
       
  1528           return getWrappedName(type, type.render, 'ForwardRef');
       
  1529 
       
  1530         case REACT_MEMO_TYPE:
       
  1531           return getComponentName(type.type);
       
  1532 
       
  1533         case REACT_BLOCK_TYPE:
       
  1534           return getComponentName(type.render);
       
  1535 
       
  1536         case REACT_LAZY_TYPE:
       
  1537           {
       
  1538             var thenable = type;
       
  1539             var resolvedThenable = refineResolvedLazyComponent(thenable);
       
  1540 
       
  1541             if (resolvedThenable) {
       
  1542               return getComponentName(resolvedThenable);
       
  1543             }
       
  1544 
       
  1545             break;
       
  1546           }
       
  1547       }
       
  1548     }
       
  1549 
       
  1550     return null;
       
  1551   }
       
  1552 
       
  1553   var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
       
  1554 
       
  1555   function describeFiber(fiber) {
       
  1556     switch (fiber.tag) {
       
  1557       case HostRoot:
       
  1558       case HostPortal:
       
  1559       case HostText:
       
  1560       case Fragment:
       
  1561       case ContextProvider:
       
  1562       case ContextConsumer:
       
  1563         return '';
       
  1564 
       
  1565       default:
       
  1566         var owner = fiber._debugOwner;
       
  1567         var source = fiber._debugSource;
       
  1568         var name = getComponentName(fiber.type);
       
  1569         var ownerName = null;
       
  1570 
       
  1571         if (owner) {
       
  1572           ownerName = getComponentName(owner.type);
       
  1573         }
       
  1574 
       
  1575         return describeComponentFrame(name, source, ownerName);
       
  1576     }
       
  1577   }
       
  1578 
       
  1579   function getStackByFiberInDevAndProd(workInProgress) {
       
  1580     var info = '';
       
  1581     var node = workInProgress;
       
  1582 
       
  1583     do {
       
  1584       info += describeFiber(node);
       
  1585       node = node.return;
       
  1586     } while (node);
       
  1587 
       
  1588     return info;
       
  1589   }
       
  1590   var current = null;
       
  1591   var isRendering = false;
       
  1592   function getCurrentFiberOwnerNameInDevOrNull() {
       
  1593     {
       
  1594       if (current === null) {
       
  1595         return null;
       
  1596       }
       
  1597 
       
  1598       var owner = current._debugOwner;
       
  1599 
       
  1600       if (owner !== null && typeof owner !== 'undefined') {
       
  1601         return getComponentName(owner.type);
       
  1602       }
       
  1603     }
       
  1604 
       
  1605     return null;
       
  1606   }
       
  1607   function getCurrentFiberStackInDev() {
       
  1608     {
       
  1609       if (current === null) {
       
  1610         return '';
       
  1611       } // Safe because if current fiber exists, we are reconciling,
       
  1612       // and it is guaranteed to be the work-in-progress version.
       
  1613 
       
  1614 
       
  1615       return getStackByFiberInDevAndProd(current);
       
  1616     }
       
  1617   }
       
  1618   function resetCurrentFiber() {
       
  1619     {
       
  1620       ReactDebugCurrentFrame$1.getCurrentStack = null;
       
  1621       current = null;
       
  1622       isRendering = false;
       
  1623     }
       
  1624   }
       
  1625   function setCurrentFiber(fiber) {
       
  1626     {
       
  1627       ReactDebugCurrentFrame$1.getCurrentStack = getCurrentFiberStackInDev;
       
  1628       current = fiber;
       
  1629       isRendering = false;
       
  1630     }
       
  1631   }
       
  1632   function setIsRendering(rendering) {
       
  1633     {
       
  1634       isRendering = rendering;
       
  1635     }
       
  1636   }
       
  1637 
       
  1638   // Flow does not allow string concatenation of most non-string types. To work
       
  1639   // around this limitation, we use an opaque type that can only be obtained by
       
  1640   // passing the value through getToStringValue first.
       
  1641   function toString(value) {
       
  1642     return '' + value;
       
  1643   }
       
  1644   function getToStringValue(value) {
       
  1645     switch (typeof value) {
       
  1646       case 'boolean':
       
  1647       case 'number':
       
  1648       case 'object':
       
  1649       case 'string':
       
  1650       case 'undefined':
       
  1651         return value;
       
  1652 
       
  1653       default:
       
  1654         // function, symbol are assigned as empty strings
       
  1655         return '';
       
  1656     }
       
  1657   }
       
  1658 
       
  1659   /**
       
  1660    * Copyright (c) 2013-present, Facebook, Inc.
       
  1661    *
       
  1662    * This source code is licensed under the MIT license found in the
       
  1663    * LICENSE file in the root directory of this source tree.
       
  1664    */
       
  1665 
       
  1666   var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
       
  1667 
       
  1668   var ReactPropTypesSecret_1 = ReactPropTypesSecret;
       
  1669 
       
  1670   var printWarning$1 = function() {};
       
  1671 
       
  1672   {
       
  1673     var ReactPropTypesSecret$1 = ReactPropTypesSecret_1;
       
  1674     var loggedTypeFailures = {};
       
  1675     var has = Function.call.bind(Object.prototype.hasOwnProperty);
       
  1676 
       
  1677     printWarning$1 = function(text) {
       
  1678       var message = 'Warning: ' + text;
       
  1679       if (typeof console !== 'undefined') {
       
  1680         console.error(message);
       
  1681       }
       
  1682       try {
       
  1683         // --- Welcome to debugging React ---
       
  1684         // This error was thrown as a convenience so that you can use this stack
       
  1685         // to find the callsite that caused this warning to fire.
       
  1686         throw new Error(message);
       
  1687       } catch (x) {}
       
  1688     };
       
  1689   }
       
  1690 
       
  1691   /**
       
  1692    * Assert that the values match with the type specs.
       
  1693    * Error messages are memorized and will only be shown once.
       
  1694    *
       
  1695    * @param {object} typeSpecs Map of name to a ReactPropType
       
  1696    * @param {object} values Runtime values that need to be type-checked
       
  1697    * @param {string} location e.g. "prop", "context", "child context"
       
  1698    * @param {string} componentName Name of the component for error messages.
       
  1699    * @param {?Function} getStack Returns the component stack.
       
  1700    * @private
       
  1701    */
       
  1702   function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
       
  1703     {
       
  1704       for (var typeSpecName in typeSpecs) {
       
  1705         if (has(typeSpecs, typeSpecName)) {
       
  1706           var error;
       
  1707           // Prop type validation may throw. In case they do, we don't want to
       
  1708           // fail the render phase where it didn't fail before. So we log it.
       
  1709           // After these have been cleaned up, we'll let them throw.
       
  1710           try {
       
  1711             // This is intentionally an invariant that gets caught. It's the same
       
  1712             // behavior as without this statement except with a better message.
       
  1713             if (typeof typeSpecs[typeSpecName] !== 'function') {
       
  1714               var err = Error(
       
  1715                 (componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' +
       
  1716                 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.'
       
  1717               );
       
  1718               err.name = 'Invariant Violation';
       
  1719               throw err;
       
  1720             }
       
  1721             error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret$1);
       
  1722           } catch (ex) {
       
  1723             error = ex;
       
  1724           }
       
  1725           if (error && !(error instanceof Error)) {
       
  1726             printWarning$1(
       
  1727               (componentName || 'React class') + ': type specification of ' +
       
  1728               location + ' `' + typeSpecName + '` is invalid; the type checker ' +
       
  1729               'function must return `null` or an `Error` but returned a ' + typeof error + '. ' +
       
  1730               'You may have forgotten to pass an argument to the type checker ' +
       
  1731               'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' +
       
  1732               'shape all require an argument).'
       
  1733             );
       
  1734           }
       
  1735           if (error instanceof Error && !(error.message in loggedTypeFailures)) {
       
  1736             // Only monitor this failure once because there tends to be a lot of the
       
  1737             // same error.
       
  1738             loggedTypeFailures[error.message] = true;
       
  1739 
       
  1740             var stack = getStack ? getStack() : '';
       
  1741 
       
  1742             printWarning$1(
       
  1743               'Failed ' + location + ' type: ' + error.message + (stack != null ? stack : '')
       
  1744             );
       
  1745           }
       
  1746         }
       
  1747       }
       
  1748     }
       
  1749   }
       
  1750 
       
  1751   /**
       
  1752    * Resets warning cache when testing.
       
  1753    *
       
  1754    * @private
       
  1755    */
       
  1756   checkPropTypes.resetWarningCache = function() {
       
  1757     {
       
  1758       loggedTypeFailures = {};
       
  1759     }
       
  1760   };
       
  1761 
       
  1762   var checkPropTypes_1 = checkPropTypes;
       
  1763 
       
  1764   var ReactDebugCurrentFrame$2 = null;
       
  1765   var ReactControlledValuePropTypes = {
       
  1766     checkPropTypes: null
       
  1767   };
       
  1768 
       
  1769   {
       
  1770     ReactDebugCurrentFrame$2 = ReactSharedInternals.ReactDebugCurrentFrame;
       
  1771     var hasReadOnlyValue = {
       
  1772       button: true,
       
  1773       checkbox: true,
       
  1774       image: true,
       
  1775       hidden: true,
       
  1776       radio: true,
       
  1777       reset: true,
       
  1778       submit: true
       
  1779     };
       
  1780     var propTypes = {
       
  1781       value: function (props, propName, componentName) {
       
  1782         if (hasReadOnlyValue[props.type] || props.onChange || props.readOnly || props.disabled || props[propName] == null || enableDeprecatedFlareAPI ) {
       
  1783           return null;
       
  1784         }
       
  1785 
       
  1786         return new Error('You provided a `value` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultValue`. Otherwise, ' + 'set either `onChange` or `readOnly`.');
       
  1787       },
       
  1788       checked: function (props, propName, componentName) {
       
  1789         if (props.onChange || props.readOnly || props.disabled || props[propName] == null || enableDeprecatedFlareAPI ) {
       
  1790           return null;
       
  1791         }
       
  1792 
       
  1793         return new Error('You provided a `checked` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultChecked`. Otherwise, ' + 'set either `onChange` or `readOnly`.');
       
  1794       }
       
  1795     };
       
  1796     /**
       
  1797      * Provide a linked `value` attribute for controlled forms. You should not use
       
  1798      * this outside of the ReactDOM controlled form components.
       
  1799      */
       
  1800 
       
  1801     ReactControlledValuePropTypes.checkPropTypes = function (tagName, props) {
       
  1802       checkPropTypes_1(propTypes, props, 'prop', tagName, ReactDebugCurrentFrame$2.getStackAddendum);
       
  1803     };
       
  1804   }
       
  1805 
       
  1806   function isCheckable(elem) {
       
  1807     var type = elem.type;
       
  1808     var nodeName = elem.nodeName;
       
  1809     return nodeName && nodeName.toLowerCase() === 'input' && (type === 'checkbox' || type === 'radio');
       
  1810   }
       
  1811 
       
  1812   function getTracker(node) {
       
  1813     return node._valueTracker;
       
  1814   }
       
  1815 
       
  1816   function detachTracker(node) {
       
  1817     node._valueTracker = null;
       
  1818   }
       
  1819 
       
  1820   function getValueFromNode(node) {
       
  1821     var value = '';
       
  1822 
       
  1823     if (!node) {
       
  1824       return value;
       
  1825     }
       
  1826 
       
  1827     if (isCheckable(node)) {
       
  1828       value = node.checked ? 'true' : 'false';
       
  1829     } else {
       
  1830       value = node.value;
       
  1831     }
       
  1832 
       
  1833     return value;
       
  1834   }
       
  1835 
       
  1836   function trackValueOnNode(node) {
       
  1837     var valueField = isCheckable(node) ? 'checked' : 'value';
       
  1838     var descriptor = Object.getOwnPropertyDescriptor(node.constructor.prototype, valueField);
       
  1839     var currentValue = '' + node[valueField]; // if someone has already defined a value or Safari, then bail
       
  1840     // and don't track value will cause over reporting of changes,
       
  1841     // but it's better then a hard failure
       
  1842     // (needed for certain tests that spyOn input values and Safari)
       
  1843 
       
  1844     if (node.hasOwnProperty(valueField) || typeof descriptor === 'undefined' || typeof descriptor.get !== 'function' || typeof descriptor.set !== 'function') {
       
  1845       return;
       
  1846     }
       
  1847 
       
  1848     var get = descriptor.get,
       
  1849         set = descriptor.set;
       
  1850     Object.defineProperty(node, valueField, {
       
  1851       configurable: true,
       
  1852       get: function () {
       
  1853         return get.call(this);
       
  1854       },
       
  1855       set: function (value) {
       
  1856         currentValue = '' + value;
       
  1857         set.call(this, value);
       
  1858       }
       
  1859     }); // We could've passed this the first time
       
  1860     // but it triggers a bug in IE11 and Edge 14/15.
       
  1861     // Calling defineProperty() again should be equivalent.
       
  1862     // https://github.com/facebook/react/issues/11768
       
  1863 
       
  1864     Object.defineProperty(node, valueField, {
       
  1865       enumerable: descriptor.enumerable
       
  1866     });
       
  1867     var tracker = {
       
  1868       getValue: function () {
       
  1869         return currentValue;
       
  1870       },
       
  1871       setValue: function (value) {
       
  1872         currentValue = '' + value;
       
  1873       },
       
  1874       stopTracking: function () {
       
  1875         detachTracker(node);
       
  1876         delete node[valueField];
       
  1877       }
       
  1878     };
       
  1879     return tracker;
       
  1880   }
       
  1881 
       
  1882   function track(node) {
       
  1883     if (getTracker(node)) {
       
  1884       return;
       
  1885     } // TODO: Once it's just Fiber we can move this to node._wrapperState
       
  1886 
       
  1887 
       
  1888     node._valueTracker = trackValueOnNode(node);
       
  1889   }
       
  1890   function updateValueIfChanged(node) {
       
  1891     if (!node) {
       
  1892       return false;
       
  1893     }
       
  1894 
       
  1895     var tracker = getTracker(node); // if there is no tracker at this point it's unlikely
       
  1896     // that trying again will succeed
       
  1897 
       
  1898     if (!tracker) {
       
  1899       return true;
       
  1900     }
       
  1901 
       
  1902     var lastValue = tracker.getValue();
       
  1903     var nextValue = getValueFromNode(node);
       
  1904 
       
  1905     if (nextValue !== lastValue) {
       
  1906       tracker.setValue(nextValue);
       
  1907       return true;
       
  1908     }
       
  1909 
       
  1910     return false;
       
  1911   }
       
  1912 
       
  1913   var didWarnValueDefaultValue = false;
       
  1914   var didWarnCheckedDefaultChecked = false;
       
  1915   var didWarnControlledToUncontrolled = false;
       
  1916   var didWarnUncontrolledToControlled = false;
       
  1917 
       
  1918   function isControlled(props) {
       
  1919     var usesChecked = props.type === 'checkbox' || props.type === 'radio';
       
  1920     return usesChecked ? props.checked != null : props.value != null;
       
  1921   }
       
  1922   /**
       
  1923    * Implements an <input> host component that allows setting these optional
       
  1924    * props: `checked`, `value`, `defaultChecked`, and `defaultValue`.
       
  1925    *
       
  1926    * If `checked` or `value` are not supplied (or null/undefined), user actions
       
  1927    * that affect the checked state or value will trigger updates to the element.
       
  1928    *
       
  1929    * If they are supplied (and not null/undefined), the rendered element will not
       
  1930    * trigger updates to the element. Instead, the props must change in order for
       
  1931    * the rendered element to be updated.
       
  1932    *
       
  1933    * The rendered element will be initialized as unchecked (or `defaultChecked`)
       
  1934    * with an empty value (or `defaultValue`).
       
  1935    *
       
  1936    * See http://www.w3.org/TR/2012/WD-html5-20121025/the-input-element.html
       
  1937    */
       
  1938 
       
  1939 
       
  1940   function getHostProps(element, props) {
       
  1941     var node = element;
       
  1942     var checked = props.checked;
       
  1943 
       
  1944     var hostProps = _assign({}, props, {
       
  1945       defaultChecked: undefined,
       
  1946       defaultValue: undefined,
       
  1947       value: undefined,
       
  1948       checked: checked != null ? checked : node._wrapperState.initialChecked
       
  1949     });
       
  1950 
       
  1951     return hostProps;
       
  1952   }
       
  1953   function initWrapperState(element, props) {
       
  1954     {
       
  1955       ReactControlledValuePropTypes.checkPropTypes('input', props);
       
  1956 
       
  1957       if (props.checked !== undefined && props.defaultChecked !== undefined && !didWarnCheckedDefaultChecked) {
       
  1958         error('%s contains an input of type %s with both checked and defaultChecked props. ' + 'Input elements must be either controlled or uncontrolled ' + '(specify either the checked prop, or the defaultChecked prop, but not ' + 'both). Decide between using a controlled or uncontrolled input ' + 'element and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components', getCurrentFiberOwnerNameInDevOrNull() || 'A component', props.type);
       
  1959 
       
  1960         didWarnCheckedDefaultChecked = true;
       
  1961       }
       
  1962 
       
  1963       if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValueDefaultValue) {
       
  1964         error('%s contains an input of type %s with both value and defaultValue props. ' + 'Input elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled input ' + 'element and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components', getCurrentFiberOwnerNameInDevOrNull() || 'A component', props.type);
       
  1965 
       
  1966         didWarnValueDefaultValue = true;
       
  1967       }
       
  1968     }
       
  1969 
       
  1970     var node = element;
       
  1971     var defaultValue = props.defaultValue == null ? '' : props.defaultValue;
       
  1972     node._wrapperState = {
       
  1973       initialChecked: props.checked != null ? props.checked : props.defaultChecked,
       
  1974       initialValue: getToStringValue(props.value != null ? props.value : defaultValue),
       
  1975       controlled: isControlled(props)
       
  1976     };
       
  1977   }
       
  1978   function updateChecked(element, props) {
       
  1979     var node = element;
       
  1980     var checked = props.checked;
       
  1981 
       
  1982     if (checked != null) {
       
  1983       setValueForProperty(node, 'checked', checked, false);
       
  1984     }
       
  1985   }
       
  1986   function updateWrapper(element, props) {
       
  1987     var node = element;
       
  1988 
       
  1989     {
       
  1990       var controlled = isControlled(props);
       
  1991 
       
  1992       if (!node._wrapperState.controlled && controlled && !didWarnUncontrolledToControlled) {
       
  1993         error('A component is changing an uncontrolled input of type %s to be controlled. ' + 'Input elements should not switch from uncontrolled to controlled (or vice versa). ' + 'Decide between using a controlled or uncontrolled input ' + 'element for the lifetime of the component. More info: https://fb.me/react-controlled-components', props.type);
       
  1994 
       
  1995         didWarnUncontrolledToControlled = true;
       
  1996       }
       
  1997 
       
  1998       if (node._wrapperState.controlled && !controlled && !didWarnControlledToUncontrolled) {
       
  1999         error('A component is changing a controlled input of type %s to be uncontrolled. ' + 'Input elements should not switch from controlled to uncontrolled (or vice versa). ' + 'Decide between using a controlled or uncontrolled input ' + 'element for the lifetime of the component. More info: https://fb.me/react-controlled-components', props.type);
       
  2000 
       
  2001         didWarnControlledToUncontrolled = true;
       
  2002       }
       
  2003     }
       
  2004 
       
  2005     updateChecked(element, props);
       
  2006     var value = getToStringValue(props.value);
       
  2007     var type = props.type;
       
  2008 
       
  2009     if (value != null) {
       
  2010       if (type === 'number') {
       
  2011         if (value === 0 && node.value === '' || // We explicitly want to coerce to number here if possible.
       
  2012         // eslint-disable-next-line
       
  2013         node.value != value) {
       
  2014           node.value = toString(value);
       
  2015         }
       
  2016       } else if (node.value !== toString(value)) {
       
  2017         node.value = toString(value);
       
  2018       }
       
  2019     } else if (type === 'submit' || type === 'reset') {
       
  2020       // Submit/reset inputs need the attribute removed completely to avoid
       
  2021       // blank-text buttons.
       
  2022       node.removeAttribute('value');
       
  2023       return;
       
  2024     }
       
  2025 
       
  2026     {
       
  2027       // When syncing the value attribute, the value comes from a cascade of
       
  2028       // properties:
       
  2029       //  1. The value React property
       
  2030       //  2. The defaultValue React property
       
  2031       //  3. Otherwise there should be no change
       
  2032       if (props.hasOwnProperty('value')) {
       
  2033         setDefaultValue(node, props.type, value);
       
  2034       } else if (props.hasOwnProperty('defaultValue')) {
       
  2035         setDefaultValue(node, props.type, getToStringValue(props.defaultValue));
       
  2036       }
       
  2037     }
       
  2038 
       
  2039     {
       
  2040       // When syncing the checked attribute, it only changes when it needs
       
  2041       // to be removed, such as transitioning from a checkbox into a text input
       
  2042       if (props.checked == null && props.defaultChecked != null) {
       
  2043         node.defaultChecked = !!props.defaultChecked;
       
  2044       }
       
  2045     }
       
  2046   }
       
  2047   function postMountWrapper(element, props, isHydrating) {
       
  2048     var node = element; // Do not assign value if it is already set. This prevents user text input
       
  2049     // from being lost during SSR hydration.
       
  2050 
       
  2051     if (props.hasOwnProperty('value') || props.hasOwnProperty('defaultValue')) {
       
  2052       var type = props.type;
       
  2053       var isButton = type === 'submit' || type === 'reset'; // Avoid setting value attribute on submit/reset inputs as it overrides the
       
  2054       // default value provided by the browser. See: #12872
       
  2055 
       
  2056       if (isButton && (props.value === undefined || props.value === null)) {
       
  2057         return;
       
  2058       }
       
  2059 
       
  2060       var initialValue = toString(node._wrapperState.initialValue); // Do not assign value if it is already set. This prevents user text input
       
  2061       // from being lost during SSR hydration.
       
  2062 
       
  2063       if (!isHydrating) {
       
  2064         {
       
  2065           // When syncing the value attribute, the value property should use
       
  2066           // the wrapperState._initialValue property. This uses:
       
  2067           //
       
  2068           //   1. The value React property when present
       
  2069           //   2. The defaultValue React property when present
       
  2070           //   3. An empty string
       
  2071           if (initialValue !== node.value) {
       
  2072             node.value = initialValue;
       
  2073           }
       
  2074         }
       
  2075       }
       
  2076 
  5111       {
  2077       {
  5112         throw ReactError(Error('addRootEventTypes() found a duplicate root event type of "' + rootEventType + '". This might be because the event type exists in the event responder "rootEventTypes" array or because of a previous addRootEventTypes() using this root event type.'));
  2078         // Otherwise, the value attribute is synchronized to the property,
  5113       }
  2079         // so we assign defaultValue to the same thing as the value property
  5114     }
  2080         // assignment step above.
  5115   })();
  2081         node.defaultValue = initialValue;
  5116   rootEventTypesSet.add(rootEventType);
  2082       }
  5117   rootEventResponderInstances.add(eventResponderInstance);
  2083     } // Normally, we'd just do `node.checked = node.checked` upon initial mount, less this bug
  5118 }
  2084     // this is needed to work around a chrome bug where setting defaultChecked
  5119 
  2085     // will sometimes influence the value of checked (even after detachment).
  5120 /**
  2086     // Reference: https://bugs.chromium.org/p/chromium/issues/detail?id=608416
  5121  * `ReactInstanceMap` maintains a mapping from a public facing stateful
  2087     // We need to temporarily unset name to avoid disrupting radio button groups.
  5122  * instance (key) and the internal representation (value). This allows public
  2088 
  5123  * methods to accept the user facing instance as an argument and map them back
  2089 
  5124  * to internal methods.
  2090     var name = node.name;
  5125  *
  2091 
  5126  * Note that this module is currently shared and assumed to be stateless.
  2092     if (name !== '') {
  5127  * If this becomes an actual Map, that will break.
  2093       node.name = '';
  5128  */
  2094     }
  5129 
  2095 
  5130 /**
  2096     {
  5131  * This API should be called `delete` but we'd have to make sure to always
  2097       // When syncing the checked attribute, both the checked property and
  5132  * transform these to strings for IE support. When this transform is fully
  2098       // attribute are assigned at the same time using defaultChecked. This uses:
  5133  * supported we can rename it.
  2099       //
  5134  */
  2100       //   1. The checked React property when present
  5135 
  2101       //   2. The defaultChecked React property when present
  5136 
  2102       //   3. Otherwise, false
  5137 function get(key) {
  2103       node.defaultChecked = !node.defaultChecked;
  5138   return key._reactInternalFiber;
  2104       node.defaultChecked = !!node._wrapperState.initialChecked;
  5139 }
  2105     }
  5140 
  2106 
  5141 function has(key) {
  2107     if (name !== '') {
  5142   return key._reactInternalFiber !== undefined;
  2108       node.name = name;
  5143 }
  2109     }
  5144 
  2110   }
  5145 function set(key, value) {
  2111   function restoreControlledState(element, props) {
  5146   key._reactInternalFiber = value;
  2112     var node = element;
  5147 }
  2113     updateWrapper(node, props);
  5148 
  2114     updateNamedCousins(node, props);
  5149 // Don't change these two values. They're used by React Dev Tools.
  2115   }
  5150 var NoEffect = /*              */0;
  2116 
  5151 var PerformedWork = /*         */1;
  2117   function updateNamedCousins(rootNode, props) {
  5152 
  2118     var name = props.name;
  5153 // You can change the rest (and add more).
  2119 
  5154 var Placement = /*             */2;
  2120     if (props.type === 'radio' && name != null) {
  5155 var Update = /*                */4;
  2121       var queryRoot = rootNode;
  5156 var PlacementAndUpdate = /*    */6;
  2122 
  5157 var Deletion = /*              */8;
  2123       while (queryRoot.parentNode) {
  5158 var ContentReset = /*          */16;
  2124         queryRoot = queryRoot.parentNode;
  5159 var Callback = /*              */32;
  2125       } // If `rootNode.form` was non-null, then we could try `form.elements`,
  5160 var DidCapture = /*            */64;
  2126       // but that sometimes behaves strangely in IE8. We could also try using
  5161 var Ref = /*                   */128;
  2127       // `form.getElementsByName`, but that will only return direct children
  5162 var Snapshot = /*              */256;
  2128       // and won't include inputs that use the HTML5 `form=` attribute. Since
  5163 var Passive = /*               */512;
  2129       // the input might not even be in a form. It might not even be in the
  5164 
  2130       // document. Let's just use the local `querySelectorAll` to ensure we don't
  5165 // Passive & Update & Callback & Ref & Snapshot
  2131       // miss anything.
  5166 var LifecycleEffectMask = /*   */932;
  2132 
  5167 
  2133 
  5168 // Union of all host effects
  2134       var group = queryRoot.querySelectorAll('input[name=' + JSON.stringify('' + name) + '][type="radio"]');
  5169 var HostEffectMask = /*        */1023;
  2135 
  5170 
  2136       for (var i = 0; i < group.length; i++) {
  5171 var Incomplete = /*            */1024;
  2137         var otherNode = group[i];
  5172 var ShouldCapture = /*         */2048;
  2138 
  5173 
  2139         if (otherNode === rootNode || otherNode.form !== rootNode.form) {
  5174 var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner;
  2140           continue;
  5175 
  2141         } // This will throw if radio buttons rendered by different copies of React
  5176 var MOUNTING = 1;
  2142         // and the same name are rendered into the same form (same as #1939).
  5177 var MOUNTED = 2;
  2143         // That's probably okay; we don't support it just as we don't support
  5178 var UNMOUNTED = 3;
  2144         // mixing React radio buttons with non-React ones.
  5179 
  2145 
  5180 function isFiberMountedImpl(fiber) {
  2146 
  5181   var node = fiber;
  2147         var otherProps = getFiberCurrentPropsFromNode$1(otherNode);
  5182   if (!fiber.alternate) {
  2148 
  5183     // If there is no alternate, this might be a new tree that isn't inserted
  2149         if (!otherProps) {
  5184     // yet. If it is, then it will have a pending insertion effect on it.
  2150           {
  5185     if ((node.effectTag & Placement) !== NoEffect) {
  2151             throw Error( "ReactDOMInput: Mixing React and non-React radio inputs with the same `name` is not supported." );
  5186       return MOUNTING;
  2152           }
  5187     }
  2153         } // We need update the tracked value on the named cousin since the value
  5188     while (node.return) {
  2154         // was changed but the input saw no event or value set
  5189       node = node.return;
  2155 
  5190       if ((node.effectTag & Placement) !== NoEffect) {
  2156 
  5191         return MOUNTING;
  2157         updateValueIfChanged(otherNode); // If this is a controlled radio button group, forcing the input that
  5192       }
  2158         // was previously checked to update will cause it to be come re-checked
  5193     }
  2159         // as appropriate.
  5194   } else {
  2160 
  5195     while (node.return) {
  2161         updateWrapper(otherNode, otherProps);
  5196       node = node.return;
  2162       }
  5197     }
  2163     }
  5198   }
  2164   } // In Chrome, assigning defaultValue to certain input types triggers input validation.
  5199   if (node.tag === HostRoot) {
  2165   // For number inputs, the display value loses trailing decimal points. For email inputs,
  5200     // TODO: Check if this was a nested HostRoot when used with
  2166   // Chrome raises "The specified value <x> is not a valid email address".
  5201     // renderContainerIntoSubtree.
  2167   //
  5202     return MOUNTED;
  2168   // Here we check to see if the defaultValue has actually changed, avoiding these problems
  5203   }
  2169   // when the user is inputting text
  5204   // If we didn't hit the root, that means that we're in an disconnected tree
  2170   //
  5205   // that has been unmounted.
  2171   // https://github.com/facebook/react/issues/7253
  5206   return UNMOUNTED;
  2172 
  5207 }
  2173 
  5208 
  2174   function setDefaultValue(node, type, value) {
  5209 function isFiberMounted(fiber) {
  2175     if ( // Focused number inputs synchronize on blur. See ChangeEventPlugin.js
  5210   return isFiberMountedImpl(fiber) === MOUNTED;
  2176     type !== 'number' || node.ownerDocument.activeElement !== node) {
  5211 }
  2177       if (value == null) {
  5212 
  2178         node.defaultValue = toString(node._wrapperState.initialValue);
  5213 function isMounted(component) {
  2179       } else if (node.defaultValue !== toString(value)) {
       
  2180         node.defaultValue = toString(value);
       
  2181       }
       
  2182     }
       
  2183   }
       
  2184 
       
  2185   var didWarnSelectedSetOnOption = false;
       
  2186   var didWarnInvalidChild = false;
       
  2187 
       
  2188   function flattenChildren(children) {
       
  2189     var content = ''; // Flatten children. We'll warn if they are invalid
       
  2190     // during validateProps() which runs for hydration too.
       
  2191     // Note that this would throw on non-element objects.
       
  2192     // Elements are stringified (which is normally irrelevant
       
  2193     // but matters for <fbt>).
       
  2194 
       
  2195     React.Children.forEach(children, function (child) {
       
  2196       if (child == null) {
       
  2197         return;
       
  2198       }
       
  2199 
       
  2200       content += child; // Note: we don't warn about invalid children here.
       
  2201       // Instead, this is done separately below so that
       
  2202       // it happens during the hydration codepath too.
       
  2203     });
       
  2204     return content;
       
  2205   }
       
  2206   /**
       
  2207    * Implements an <option> host component that warns when `selected` is set.
       
  2208    */
       
  2209 
       
  2210 
       
  2211   function validateProps(element, props) {
       
  2212     {
       
  2213       // This mirrors the codepath above, but runs for hydration too.
       
  2214       // Warn about invalid children here so that client and hydration are consistent.
       
  2215       // TODO: this seems like it could cause a DEV-only throw for hydration
       
  2216       // if children contains a non-element object. We should try to avoid that.
       
  2217       if (typeof props.children === 'object' && props.children !== null) {
       
  2218         React.Children.forEach(props.children, function (child) {
       
  2219           if (child == null) {
       
  2220             return;
       
  2221           }
       
  2222 
       
  2223           if (typeof child === 'string' || typeof child === 'number') {
       
  2224             return;
       
  2225           }
       
  2226 
       
  2227           if (typeof child.type !== 'string') {
       
  2228             return;
       
  2229           }
       
  2230 
       
  2231           if (!didWarnInvalidChild) {
       
  2232             didWarnInvalidChild = true;
       
  2233 
       
  2234             error('Only strings and numbers are supported as <option> children.');
       
  2235           }
       
  2236         });
       
  2237       } // TODO: Remove support for `selected` in <option>.
       
  2238 
       
  2239 
       
  2240       if (props.selected != null && !didWarnSelectedSetOnOption) {
       
  2241         error('Use the `defaultValue` or `value` props on <select> instead of ' + 'setting `selected` on <option>.');
       
  2242 
       
  2243         didWarnSelectedSetOnOption = true;
       
  2244       }
       
  2245     }
       
  2246   }
       
  2247   function postMountWrapper$1(element, props) {
       
  2248     // value="" should make a value attribute (#6219)
       
  2249     if (props.value != null) {
       
  2250       element.setAttribute('value', toString(getToStringValue(props.value)));
       
  2251     }
       
  2252   }
       
  2253   function getHostProps$1(element, props) {
       
  2254     var hostProps = _assign({
       
  2255       children: undefined
       
  2256     }, props);
       
  2257 
       
  2258     var content = flattenChildren(props.children);
       
  2259 
       
  2260     if (content) {
       
  2261       hostProps.children = content;
       
  2262     }
       
  2263 
       
  2264     return hostProps;
       
  2265   }
       
  2266 
       
  2267   var didWarnValueDefaultValue$1;
       
  2268 
  5214   {
  2269   {
  5215     var owner = ReactCurrentOwner$1.current;
  2270     didWarnValueDefaultValue$1 = false;
  5216     if (owner !== null && owner.tag === ClassComponent) {
  2271   }
  5217       var ownerFiber = owner;
  2272 
  5218       var instance = ownerFiber.stateNode;
  2273   function getDeclarationErrorAddendum() {
  5219       !instance._warnedAboutRefsInRender ? warningWithoutStack$1(false, '%s is accessing isMounted inside its render() function. ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', getComponentName(ownerFiber.type) || 'A component') : void 0;
  2274     var ownerName = getCurrentFiberOwnerNameInDevOrNull();
  5220       instance._warnedAboutRefsInRender = true;
  2275 
  5221     }
  2276     if (ownerName) {
  5222   }
  2277       return '\n\nCheck the render method of `' + ownerName + '`.';
  5223 
  2278     }
  5224   var fiber = get(component);
  2279 
  5225   if (!fiber) {
  2280     return '';
  5226     return false;
  2281   }
  5227   }
  2282 
  5228   return isFiberMountedImpl(fiber) === MOUNTED;
  2283   var valuePropNames = ['value', 'defaultValue'];
  5229 }
  2284   /**
  5230 
  2285    * Validation function for `value` and `defaultValue`.
  5231 function assertIsMounted(fiber) {
  2286    */
  5232   (function () {
  2287 
  5233     if (!(isFiberMountedImpl(fiber) === MOUNTED)) {
  2288   function checkSelectPropTypes(props) {
       
  2289     {
       
  2290       ReactControlledValuePropTypes.checkPropTypes('select', props);
       
  2291 
       
  2292       for (var i = 0; i < valuePropNames.length; i++) {
       
  2293         var propName = valuePropNames[i];
       
  2294 
       
  2295         if (props[propName] == null) {
       
  2296           continue;
       
  2297         }
       
  2298 
       
  2299         var isArray = Array.isArray(props[propName]);
       
  2300 
       
  2301         if (props.multiple && !isArray) {
       
  2302           error('The `%s` prop supplied to <select> must be an array if ' + '`multiple` is true.%s', propName, getDeclarationErrorAddendum());
       
  2303         } else if (!props.multiple && isArray) {
       
  2304           error('The `%s` prop supplied to <select> must be a scalar ' + 'value if `multiple` is false.%s', propName, getDeclarationErrorAddendum());
       
  2305         }
       
  2306       }
       
  2307     }
       
  2308   }
       
  2309 
       
  2310   function updateOptions(node, multiple, propValue, setDefaultSelected) {
       
  2311     var options = node.options;
       
  2312 
       
  2313     if (multiple) {
       
  2314       var selectedValues = propValue;
       
  2315       var selectedValue = {};
       
  2316 
       
  2317       for (var i = 0; i < selectedValues.length; i++) {
       
  2318         // Prefix to avoid chaos with special keys.
       
  2319         selectedValue['$' + selectedValues[i]] = true;
       
  2320       }
       
  2321 
       
  2322       for (var _i = 0; _i < options.length; _i++) {
       
  2323         var selected = selectedValue.hasOwnProperty('$' + options[_i].value);
       
  2324 
       
  2325         if (options[_i].selected !== selected) {
       
  2326           options[_i].selected = selected;
       
  2327         }
       
  2328 
       
  2329         if (selected && setDefaultSelected) {
       
  2330           options[_i].defaultSelected = true;
       
  2331         }
       
  2332       }
       
  2333     } else {
       
  2334       // Do not set `select.value` as exact behavior isn't consistent across all
       
  2335       // browsers for all cases.
       
  2336       var _selectedValue = toString(getToStringValue(propValue));
       
  2337 
       
  2338       var defaultSelected = null;
       
  2339 
       
  2340       for (var _i2 = 0; _i2 < options.length; _i2++) {
       
  2341         if (options[_i2].value === _selectedValue) {
       
  2342           options[_i2].selected = true;
       
  2343 
       
  2344           if (setDefaultSelected) {
       
  2345             options[_i2].defaultSelected = true;
       
  2346           }
       
  2347 
       
  2348           return;
       
  2349         }
       
  2350 
       
  2351         if (defaultSelected === null && !options[_i2].disabled) {
       
  2352           defaultSelected = options[_i2];
       
  2353         }
       
  2354       }
       
  2355 
       
  2356       if (defaultSelected !== null) {
       
  2357         defaultSelected.selected = true;
       
  2358       }
       
  2359     }
       
  2360   }
       
  2361   /**
       
  2362    * Implements a <select> host component that allows optionally setting the
       
  2363    * props `value` and `defaultValue`. If `multiple` is false, the prop must be a
       
  2364    * stringable. If `multiple` is true, the prop must be an array of stringables.
       
  2365    *
       
  2366    * If `value` is not supplied (or null/undefined), user actions that change the
       
  2367    * selected option will trigger updates to the rendered options.
       
  2368    *
       
  2369    * If it is supplied (and not null/undefined), the rendered options will not
       
  2370    * update in response to user actions. Instead, the `value` prop must change in
       
  2371    * order for the rendered options to update.
       
  2372    *
       
  2373    * If `defaultValue` is provided, any options with the supplied values will be
       
  2374    * selected.
       
  2375    */
       
  2376 
       
  2377 
       
  2378   function getHostProps$2(element, props) {
       
  2379     return _assign({}, props, {
       
  2380       value: undefined
       
  2381     });
       
  2382   }
       
  2383   function initWrapperState$1(element, props) {
       
  2384     var node = element;
       
  2385 
       
  2386     {
       
  2387       checkSelectPropTypes(props);
       
  2388     }
       
  2389 
       
  2390     node._wrapperState = {
       
  2391       wasMultiple: !!props.multiple
       
  2392     };
       
  2393 
       
  2394     {
       
  2395       if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValueDefaultValue$1) {
       
  2396         error('Select elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled select ' + 'element and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components');
       
  2397 
       
  2398         didWarnValueDefaultValue$1 = true;
       
  2399       }
       
  2400     }
       
  2401   }
       
  2402   function postMountWrapper$2(element, props) {
       
  2403     var node = element;
       
  2404     node.multiple = !!props.multiple;
       
  2405     var value = props.value;
       
  2406 
       
  2407     if (value != null) {
       
  2408       updateOptions(node, !!props.multiple, value, false);
       
  2409     } else if (props.defaultValue != null) {
       
  2410       updateOptions(node, !!props.multiple, props.defaultValue, true);
       
  2411     }
       
  2412   }
       
  2413   function postUpdateWrapper(element, props) {
       
  2414     var node = element;
       
  2415     var wasMultiple = node._wrapperState.wasMultiple;
       
  2416     node._wrapperState.wasMultiple = !!props.multiple;
       
  2417     var value = props.value;
       
  2418 
       
  2419     if (value != null) {
       
  2420       updateOptions(node, !!props.multiple, value, false);
       
  2421     } else if (wasMultiple !== !!props.multiple) {
       
  2422       // For simplicity, reapply `defaultValue` if `multiple` is toggled.
       
  2423       if (props.defaultValue != null) {
       
  2424         updateOptions(node, !!props.multiple, props.defaultValue, true);
       
  2425       } else {
       
  2426         // Revert the select back to its default unselected state.
       
  2427         updateOptions(node, !!props.multiple, props.multiple ? [] : '', false);
       
  2428       }
       
  2429     }
       
  2430   }
       
  2431   function restoreControlledState$1(element, props) {
       
  2432     var node = element;
       
  2433     var value = props.value;
       
  2434 
       
  2435     if (value != null) {
       
  2436       updateOptions(node, !!props.multiple, value, false);
       
  2437     }
       
  2438   }
       
  2439 
       
  2440   var didWarnValDefaultVal = false;
       
  2441 
       
  2442   /**
       
  2443    * Implements a <textarea> host component that allows setting `value`, and
       
  2444    * `defaultValue`. This differs from the traditional DOM API because value is
       
  2445    * usually set as PCDATA children.
       
  2446    *
       
  2447    * If `value` is not supplied (or null/undefined), user actions that affect the
       
  2448    * value will trigger updates to the element.
       
  2449    *
       
  2450    * If `value` is supplied (and not null/undefined), the rendered element will
       
  2451    * not trigger updates to the element. Instead, the `value` prop must change in
       
  2452    * order for the rendered element to be updated.
       
  2453    *
       
  2454    * The rendered element will be initialized with an empty value, the prop
       
  2455    * `defaultValue` if specified, or the children content (deprecated).
       
  2456    */
       
  2457   function getHostProps$3(element, props) {
       
  2458     var node = element;
       
  2459 
       
  2460     if (!(props.dangerouslySetInnerHTML == null)) {
  5234       {
  2461       {
  5235         throw ReactError(Error('Unable to find node on an unmounted component.'));
  2462         throw Error( "`dangerouslySetInnerHTML` does not make sense on <textarea>." );
  5236       }
  2463       }
  5237     }
  2464     } // Always set children to the same thing. In IE9, the selection range will
  5238   })();
  2465     // get reset if `textContent` is mutated.  We could add a check in setTextContent
  5239 }
  2466     // to only set the value if/when the value differs from the node value (which would
  5240 
  2467     // completely solve this IE9 bug), but Sebastian+Sophie seemed to like this
  5241 function findCurrentFiberUsingSlowPath(fiber) {
  2468     // solution. The value can be a boolean or object so that's why it's forced
  5242   var alternate = fiber.alternate;
  2469     // to be a string.
  5243   if (!alternate) {
  2470 
  5244     // If there is no alternate, then we only need to check if it is mounted.
  2471 
  5245     var state = isFiberMountedImpl(fiber);
  2472     var hostProps = _assign({}, props, {
  5246     (function () {
  2473       value: undefined,
  5247       if (!(state !== UNMOUNTED)) {
  2474       defaultValue: undefined,
       
  2475       children: toString(node._wrapperState.initialValue)
       
  2476     });
       
  2477 
       
  2478     return hostProps;
       
  2479   }
       
  2480   function initWrapperState$2(element, props) {
       
  2481     var node = element;
       
  2482 
       
  2483     {
       
  2484       ReactControlledValuePropTypes.checkPropTypes('textarea', props);
       
  2485 
       
  2486       if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValDefaultVal) {
       
  2487         error('%s contains a textarea with both value and defaultValue props. ' + 'Textarea elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled textarea ' + 'and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components', getCurrentFiberOwnerNameInDevOrNull() || 'A component');
       
  2488 
       
  2489         didWarnValDefaultVal = true;
       
  2490       }
       
  2491     }
       
  2492 
       
  2493     var initialValue = props.value; // Only bother fetching default value if we're going to use it
       
  2494 
       
  2495     if (initialValue == null) {
       
  2496       var children = props.children,
       
  2497           defaultValue = props.defaultValue;
       
  2498 
       
  2499       if (children != null) {
  5248         {
  2500         {
  5249           throw ReactError(Error('Unable to find node on an unmounted component.'));
  2501           error('Use the `defaultValue` or `value` props instead of setting ' + 'children on <textarea>.');
  5250         }
  2502         }
  5251       }
  2503 
  5252     })();
  2504         {
  5253     if (state === MOUNTING) {
  2505           if (!(defaultValue == null)) {
  5254       return null;
  2506             {
  5255     }
  2507               throw Error( "If you supply `defaultValue` on a <textarea>, do not pass children." );
  5256     return fiber;
  2508             }
  5257   }
  2509           }
  5258   // If we have two possible branches, we'll walk backwards up to the root
  2510 
  5259   // to see what path the root points to. On the way we may hit one of the
  2511           if (Array.isArray(children)) {
  5260   // special cases and we'll deal with them.
  2512             if (!(children.length <= 1)) {
  5261   var a = fiber;
  2513               {
  5262   var b = alternate;
  2514                 throw Error( "<textarea> can only have at most one child." );
  5263   while (true) {
  2515               }
  5264     var parentA = a.return;
  2516             }
  5265     if (parentA === null) {
  2517 
  5266       // We're at the root.
  2518             children = children[0];
  5267       break;
  2519           }
  5268     }
  2520 
  5269     var parentB = parentA.alternate;
  2521           defaultValue = children;
  5270     if (parentB === null) {
  2522         }
  5271       // There is no alternate. This is an unusual case. Currently, it only
  2523       }
  5272       // happens when a Suspense component is hidden. An extra fragment fiber
  2524 
  5273       // is inserted in between the Suspense fiber and its children. Skip
  2525       if (defaultValue == null) {
  5274       // over this extra fragment fiber and proceed to the next parent.
  2526         defaultValue = '';
  5275       var nextParent = parentA.return;
  2527       }
  5276       if (nextParent !== null) {
  2528 
  5277         a = b = nextParent;
  2529       initialValue = defaultValue;
  5278         continue;
  2530     }
  5279       }
  2531 
  5280       // If there's no parent, we're at the root.
  2532     node._wrapperState = {
  5281       break;
  2533       initialValue: getToStringValue(initialValue)
  5282     }
  2534     };
  5283 
  2535   }
  5284     // If both copies of the parent fiber point to the same child, we can
  2536   function updateWrapper$1(element, props) {
  5285     // assume that the child is current. This happens when we bailout on low
  2537     var node = element;
  5286     // priority: the bailed out fiber's child reuses the current child.
  2538     var value = getToStringValue(props.value);
  5287     if (parentA.child === parentB.child) {
  2539     var defaultValue = getToStringValue(props.defaultValue);
  5288       var child = parentA.child;
  2540 
  5289       while (child) {
  2541     if (value != null) {
  5290         if (child === a) {
  2542       // Cast `value` to a string to ensure the value is set correctly. While
  5291           // We've determined that A is the current branch.
  2543       // browsers typically do this as necessary, jsdom doesn't.
  5292           assertIsMounted(parentA);
  2544       var newValue = toString(value); // To avoid side effects (such as losing text selection), only set value if changed
  5293           return fiber;
  2545 
  5294         }
  2546       if (newValue !== node.value) {
  5295         if (child === b) {
  2547         node.value = newValue;
  5296           // We've determined that B is the current branch.
  2548       }
  5297           assertIsMounted(parentA);
  2549 
  5298           return alternate;
  2550       if (props.defaultValue == null && node.defaultValue !== newValue) {
  5299         }
  2551         node.defaultValue = newValue;
  5300         child = child.sibling;
  2552       }
  5301       }
  2553     }
  5302       // We should never have an alternate for any mounting node. So the only
  2554 
  5303       // way this could possibly happen is if this was unmounted, if at all.
  2555     if (defaultValue != null) {
  5304       (function () {
  2556       node.defaultValue = toString(defaultValue);
       
  2557     }
       
  2558   }
       
  2559   function postMountWrapper$3(element, props) {
       
  2560     var node = element; // This is in postMount because we need access to the DOM node, which is not
       
  2561     // available until after the component has mounted.
       
  2562 
       
  2563     var textContent = node.textContent; // Only set node.value if textContent is equal to the expected
       
  2564     // initial value. In IE10/IE11 there is a bug where the placeholder attribute
       
  2565     // will populate textContent as well.
       
  2566     // https://developer.microsoft.com/microsoft-edge/platform/issues/101525/
       
  2567 
       
  2568     if (textContent === node._wrapperState.initialValue) {
       
  2569       if (textContent !== '' && textContent !== null) {
       
  2570         node.value = textContent;
       
  2571       }
       
  2572     }
       
  2573   }
       
  2574   function restoreControlledState$2(element, props) {
       
  2575     // DOM component is still mounted; update
       
  2576     updateWrapper$1(element, props);
       
  2577   }
       
  2578 
       
  2579   var HTML_NAMESPACE = 'http://www.w3.org/1999/xhtml';
       
  2580   var MATH_NAMESPACE = 'http://www.w3.org/1998/Math/MathML';
       
  2581   var SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
       
  2582   var Namespaces = {
       
  2583     html: HTML_NAMESPACE,
       
  2584     mathml: MATH_NAMESPACE,
       
  2585     svg: SVG_NAMESPACE
       
  2586   }; // Assumes there is no parent namespace.
       
  2587 
       
  2588   function getIntrinsicNamespace(type) {
       
  2589     switch (type) {
       
  2590       case 'svg':
       
  2591         return SVG_NAMESPACE;
       
  2592 
       
  2593       case 'math':
       
  2594         return MATH_NAMESPACE;
       
  2595 
       
  2596       default:
       
  2597         return HTML_NAMESPACE;
       
  2598     }
       
  2599   }
       
  2600   function getChildNamespace(parentNamespace, type) {
       
  2601     if (parentNamespace == null || parentNamespace === HTML_NAMESPACE) {
       
  2602       // No (or default) parent namespace: potential entry point.
       
  2603       return getIntrinsicNamespace(type);
       
  2604     }
       
  2605 
       
  2606     if (parentNamespace === SVG_NAMESPACE && type === 'foreignObject') {
       
  2607       // We're leaving SVG.
       
  2608       return HTML_NAMESPACE;
       
  2609     } // By default, pass namespace below.
       
  2610 
       
  2611 
       
  2612     return parentNamespace;
       
  2613   }
       
  2614 
       
  2615   /* globals MSApp */
       
  2616 
       
  2617   /**
       
  2618    * Create a function which has 'unsafe' privileges (required by windows8 apps)
       
  2619    */
       
  2620   var createMicrosoftUnsafeLocalFunction = function (func) {
       
  2621     if (typeof MSApp !== 'undefined' && MSApp.execUnsafeLocalFunction) {
       
  2622       return function (arg0, arg1, arg2, arg3) {
       
  2623         MSApp.execUnsafeLocalFunction(function () {
       
  2624           return func(arg0, arg1, arg2, arg3);
       
  2625         });
       
  2626       };
       
  2627     } else {
       
  2628       return func;
       
  2629     }
       
  2630   };
       
  2631 
       
  2632   var reusableSVGContainer;
       
  2633   /**
       
  2634    * Set the innerHTML property of a node
       
  2635    *
       
  2636    * @param {DOMElement} node
       
  2637    * @param {string} html
       
  2638    * @internal
       
  2639    */
       
  2640 
       
  2641   var setInnerHTML = createMicrosoftUnsafeLocalFunction(function (node, html) {
       
  2642     if (node.namespaceURI === Namespaces.svg) {
       
  2643 
       
  2644       if (!('innerHTML' in node)) {
       
  2645         // IE does not have innerHTML for SVG nodes, so instead we inject the
       
  2646         // new markup in a temp node and then move the child nodes across into
       
  2647         // the target node
       
  2648         reusableSVGContainer = reusableSVGContainer || document.createElement('div');
       
  2649         reusableSVGContainer.innerHTML = '<svg>' + html.valueOf().toString() + '</svg>';
       
  2650         var svgNode = reusableSVGContainer.firstChild;
       
  2651 
       
  2652         while (node.firstChild) {
       
  2653           node.removeChild(node.firstChild);
       
  2654         }
       
  2655 
       
  2656         while (svgNode.firstChild) {
       
  2657           node.appendChild(svgNode.firstChild);
       
  2658         }
       
  2659 
       
  2660         return;
       
  2661       }
       
  2662     }
       
  2663 
       
  2664     node.innerHTML = html;
       
  2665   });
       
  2666 
       
  2667   /**
       
  2668    * HTML nodeType values that represent the type of the node
       
  2669    */
       
  2670   var ELEMENT_NODE = 1;
       
  2671   var TEXT_NODE = 3;
       
  2672   var COMMENT_NODE = 8;
       
  2673   var DOCUMENT_NODE = 9;
       
  2674   var DOCUMENT_FRAGMENT_NODE = 11;
       
  2675 
       
  2676   /**
       
  2677    * Set the textContent property of a node. For text updates, it's faster
       
  2678    * to set the `nodeValue` of the Text node directly instead of using
       
  2679    * `.textContent` which will remove the existing node and create a new one.
       
  2680    *
       
  2681    * @param {DOMElement} node
       
  2682    * @param {string} text
       
  2683    * @internal
       
  2684    */
       
  2685 
       
  2686   var setTextContent = function (node, text) {
       
  2687     if (text) {
       
  2688       var firstChild = node.firstChild;
       
  2689 
       
  2690       if (firstChild && firstChild === node.lastChild && firstChild.nodeType === TEXT_NODE) {
       
  2691         firstChild.nodeValue = text;
       
  2692         return;
       
  2693       }
       
  2694     }
       
  2695 
       
  2696     node.textContent = text;
       
  2697   };
       
  2698 
       
  2699   // Do not use the below two methods directly!
       
  2700   // Instead use constants exported from DOMTopLevelEventTypes in ReactDOM.
       
  2701   // (It is the only module that is allowed to access these methods.)
       
  2702   function unsafeCastStringToDOMTopLevelType(topLevelType) {
       
  2703     return topLevelType;
       
  2704   }
       
  2705   function unsafeCastDOMTopLevelTypeToString(topLevelType) {
       
  2706     return topLevelType;
       
  2707   }
       
  2708 
       
  2709   /**
       
  2710    * Generate a mapping of standard vendor prefixes using the defined style property and event name.
       
  2711    *
       
  2712    * @param {string} styleProp
       
  2713    * @param {string} eventName
       
  2714    * @returns {object}
       
  2715    */
       
  2716 
       
  2717   function makePrefixMap(styleProp, eventName) {
       
  2718     var prefixes = {};
       
  2719     prefixes[styleProp.toLowerCase()] = eventName.toLowerCase();
       
  2720     prefixes['Webkit' + styleProp] = 'webkit' + eventName;
       
  2721     prefixes['Moz' + styleProp] = 'moz' + eventName;
       
  2722     return prefixes;
       
  2723   }
       
  2724   /**
       
  2725    * A list of event names to a configurable list of vendor prefixes.
       
  2726    */
       
  2727 
       
  2728 
       
  2729   var vendorPrefixes = {
       
  2730     animationend: makePrefixMap('Animation', 'AnimationEnd'),
       
  2731     animationiteration: makePrefixMap('Animation', 'AnimationIteration'),
       
  2732     animationstart: makePrefixMap('Animation', 'AnimationStart'),
       
  2733     transitionend: makePrefixMap('Transition', 'TransitionEnd')
       
  2734   };
       
  2735   /**
       
  2736    * Event names that have already been detected and prefixed (if applicable).
       
  2737    */
       
  2738 
       
  2739   var prefixedEventNames = {};
       
  2740   /**
       
  2741    * Element to check for prefixes on.
       
  2742    */
       
  2743 
       
  2744   var style = {};
       
  2745   /**
       
  2746    * Bootstrap if a DOM exists.
       
  2747    */
       
  2748 
       
  2749   if (canUseDOM) {
       
  2750     style = document.createElement('div').style; // On some platforms, in particular some releases of Android 4.x,
       
  2751     // the un-prefixed "animation" and "transition" properties are defined on the
       
  2752     // style object but the events that fire will still be prefixed, so we need
       
  2753     // to check if the un-prefixed events are usable, and if not remove them from the map.
       
  2754 
       
  2755     if (!('AnimationEvent' in window)) {
       
  2756       delete vendorPrefixes.animationend.animation;
       
  2757       delete vendorPrefixes.animationiteration.animation;
       
  2758       delete vendorPrefixes.animationstart.animation;
       
  2759     } // Same as above
       
  2760 
       
  2761 
       
  2762     if (!('TransitionEvent' in window)) {
       
  2763       delete vendorPrefixes.transitionend.transition;
       
  2764     }
       
  2765   }
       
  2766   /**
       
  2767    * Attempts to determine the correct vendor prefixed event name.
       
  2768    *
       
  2769    * @param {string} eventName
       
  2770    * @returns {string}
       
  2771    */
       
  2772 
       
  2773 
       
  2774   function getVendorPrefixedEventName(eventName) {
       
  2775     if (prefixedEventNames[eventName]) {
       
  2776       return prefixedEventNames[eventName];
       
  2777     } else if (!vendorPrefixes[eventName]) {
       
  2778       return eventName;
       
  2779     }
       
  2780 
       
  2781     var prefixMap = vendorPrefixes[eventName];
       
  2782 
       
  2783     for (var styleProp in prefixMap) {
       
  2784       if (prefixMap.hasOwnProperty(styleProp) && styleProp in style) {
       
  2785         return prefixedEventNames[eventName] = prefixMap[styleProp];
       
  2786       }
       
  2787     }
       
  2788 
       
  2789     return eventName;
       
  2790   }
       
  2791 
       
  2792   /**
       
  2793    * To identify top level events in ReactDOM, we use constants defined by this
       
  2794    * module. This is the only module that uses the unsafe* methods to express
       
  2795    * that the constants actually correspond to the browser event names. This lets
       
  2796    * us save some bundle size by avoiding a top level type -> event name map.
       
  2797    * The rest of ReactDOM code should import top level types from this file.
       
  2798    */
       
  2799 
       
  2800   var TOP_ABORT = unsafeCastStringToDOMTopLevelType('abort');
       
  2801   var TOP_ANIMATION_END = unsafeCastStringToDOMTopLevelType(getVendorPrefixedEventName('animationend'));
       
  2802   var TOP_ANIMATION_ITERATION = unsafeCastStringToDOMTopLevelType(getVendorPrefixedEventName('animationiteration'));
       
  2803   var TOP_ANIMATION_START = unsafeCastStringToDOMTopLevelType(getVendorPrefixedEventName('animationstart'));
       
  2804   var TOP_BLUR = unsafeCastStringToDOMTopLevelType('blur');
       
  2805   var TOP_CAN_PLAY = unsafeCastStringToDOMTopLevelType('canplay');
       
  2806   var TOP_CAN_PLAY_THROUGH = unsafeCastStringToDOMTopLevelType('canplaythrough');
       
  2807   var TOP_CANCEL = unsafeCastStringToDOMTopLevelType('cancel');
       
  2808   var TOP_CHANGE = unsafeCastStringToDOMTopLevelType('change');
       
  2809   var TOP_CLICK = unsafeCastStringToDOMTopLevelType('click');
       
  2810   var TOP_CLOSE = unsafeCastStringToDOMTopLevelType('close');
       
  2811   var TOP_COMPOSITION_END = unsafeCastStringToDOMTopLevelType('compositionend');
       
  2812   var TOP_COMPOSITION_START = unsafeCastStringToDOMTopLevelType('compositionstart');
       
  2813   var TOP_COMPOSITION_UPDATE = unsafeCastStringToDOMTopLevelType('compositionupdate');
       
  2814   var TOP_CONTEXT_MENU = unsafeCastStringToDOMTopLevelType('contextmenu');
       
  2815   var TOP_COPY = unsafeCastStringToDOMTopLevelType('copy');
       
  2816   var TOP_CUT = unsafeCastStringToDOMTopLevelType('cut');
       
  2817   var TOP_DOUBLE_CLICK = unsafeCastStringToDOMTopLevelType('dblclick');
       
  2818   var TOP_AUX_CLICK = unsafeCastStringToDOMTopLevelType('auxclick');
       
  2819   var TOP_DRAG = unsafeCastStringToDOMTopLevelType('drag');
       
  2820   var TOP_DRAG_END = unsafeCastStringToDOMTopLevelType('dragend');
       
  2821   var TOP_DRAG_ENTER = unsafeCastStringToDOMTopLevelType('dragenter');
       
  2822   var TOP_DRAG_EXIT = unsafeCastStringToDOMTopLevelType('dragexit');
       
  2823   var TOP_DRAG_LEAVE = unsafeCastStringToDOMTopLevelType('dragleave');
       
  2824   var TOP_DRAG_OVER = unsafeCastStringToDOMTopLevelType('dragover');
       
  2825   var TOP_DRAG_START = unsafeCastStringToDOMTopLevelType('dragstart');
       
  2826   var TOP_DROP = unsafeCastStringToDOMTopLevelType('drop');
       
  2827   var TOP_DURATION_CHANGE = unsafeCastStringToDOMTopLevelType('durationchange');
       
  2828   var TOP_EMPTIED = unsafeCastStringToDOMTopLevelType('emptied');
       
  2829   var TOP_ENCRYPTED = unsafeCastStringToDOMTopLevelType('encrypted');
       
  2830   var TOP_ENDED = unsafeCastStringToDOMTopLevelType('ended');
       
  2831   var TOP_ERROR = unsafeCastStringToDOMTopLevelType('error');
       
  2832   var TOP_FOCUS = unsafeCastStringToDOMTopLevelType('focus');
       
  2833   var TOP_GOT_POINTER_CAPTURE = unsafeCastStringToDOMTopLevelType('gotpointercapture');
       
  2834   var TOP_INPUT = unsafeCastStringToDOMTopLevelType('input');
       
  2835   var TOP_INVALID = unsafeCastStringToDOMTopLevelType('invalid');
       
  2836   var TOP_KEY_DOWN = unsafeCastStringToDOMTopLevelType('keydown');
       
  2837   var TOP_KEY_PRESS = unsafeCastStringToDOMTopLevelType('keypress');
       
  2838   var TOP_KEY_UP = unsafeCastStringToDOMTopLevelType('keyup');
       
  2839   var TOP_LOAD = unsafeCastStringToDOMTopLevelType('load');
       
  2840   var TOP_LOAD_START = unsafeCastStringToDOMTopLevelType('loadstart');
       
  2841   var TOP_LOADED_DATA = unsafeCastStringToDOMTopLevelType('loadeddata');
       
  2842   var TOP_LOADED_METADATA = unsafeCastStringToDOMTopLevelType('loadedmetadata');
       
  2843   var TOP_LOST_POINTER_CAPTURE = unsafeCastStringToDOMTopLevelType('lostpointercapture');
       
  2844   var TOP_MOUSE_DOWN = unsafeCastStringToDOMTopLevelType('mousedown');
       
  2845   var TOP_MOUSE_MOVE = unsafeCastStringToDOMTopLevelType('mousemove');
       
  2846   var TOP_MOUSE_OUT = unsafeCastStringToDOMTopLevelType('mouseout');
       
  2847   var TOP_MOUSE_OVER = unsafeCastStringToDOMTopLevelType('mouseover');
       
  2848   var TOP_MOUSE_UP = unsafeCastStringToDOMTopLevelType('mouseup');
       
  2849   var TOP_PASTE = unsafeCastStringToDOMTopLevelType('paste');
       
  2850   var TOP_PAUSE = unsafeCastStringToDOMTopLevelType('pause');
       
  2851   var TOP_PLAY = unsafeCastStringToDOMTopLevelType('play');
       
  2852   var TOP_PLAYING = unsafeCastStringToDOMTopLevelType('playing');
       
  2853   var TOP_POINTER_CANCEL = unsafeCastStringToDOMTopLevelType('pointercancel');
       
  2854   var TOP_POINTER_DOWN = unsafeCastStringToDOMTopLevelType('pointerdown');
       
  2855   var TOP_POINTER_MOVE = unsafeCastStringToDOMTopLevelType('pointermove');
       
  2856   var TOP_POINTER_OUT = unsafeCastStringToDOMTopLevelType('pointerout');
       
  2857   var TOP_POINTER_OVER = unsafeCastStringToDOMTopLevelType('pointerover');
       
  2858   var TOP_POINTER_UP = unsafeCastStringToDOMTopLevelType('pointerup');
       
  2859   var TOP_PROGRESS = unsafeCastStringToDOMTopLevelType('progress');
       
  2860   var TOP_RATE_CHANGE = unsafeCastStringToDOMTopLevelType('ratechange');
       
  2861   var TOP_RESET = unsafeCastStringToDOMTopLevelType('reset');
       
  2862   var TOP_SCROLL = unsafeCastStringToDOMTopLevelType('scroll');
       
  2863   var TOP_SEEKED = unsafeCastStringToDOMTopLevelType('seeked');
       
  2864   var TOP_SEEKING = unsafeCastStringToDOMTopLevelType('seeking');
       
  2865   var TOP_SELECTION_CHANGE = unsafeCastStringToDOMTopLevelType('selectionchange');
       
  2866   var TOP_STALLED = unsafeCastStringToDOMTopLevelType('stalled');
       
  2867   var TOP_SUBMIT = unsafeCastStringToDOMTopLevelType('submit');
       
  2868   var TOP_SUSPEND = unsafeCastStringToDOMTopLevelType('suspend');
       
  2869   var TOP_TEXT_INPUT = unsafeCastStringToDOMTopLevelType('textInput');
       
  2870   var TOP_TIME_UPDATE = unsafeCastStringToDOMTopLevelType('timeupdate');
       
  2871   var TOP_TOGGLE = unsafeCastStringToDOMTopLevelType('toggle');
       
  2872   var TOP_TOUCH_CANCEL = unsafeCastStringToDOMTopLevelType('touchcancel');
       
  2873   var TOP_TOUCH_END = unsafeCastStringToDOMTopLevelType('touchend');
       
  2874   var TOP_TOUCH_MOVE = unsafeCastStringToDOMTopLevelType('touchmove');
       
  2875   var TOP_TOUCH_START = unsafeCastStringToDOMTopLevelType('touchstart');
       
  2876   var TOP_TRANSITION_END = unsafeCastStringToDOMTopLevelType(getVendorPrefixedEventName('transitionend'));
       
  2877   var TOP_VOLUME_CHANGE = unsafeCastStringToDOMTopLevelType('volumechange');
       
  2878   var TOP_WAITING = unsafeCastStringToDOMTopLevelType('waiting');
       
  2879   var TOP_WHEEL = unsafeCastStringToDOMTopLevelType('wheel'); // List of events that need to be individually attached to media elements.
       
  2880   // Note that events in this list will *not* be listened to at the top level
       
  2881   // unless they're explicitly whitelisted in `ReactBrowserEventEmitter.listenTo`.
       
  2882 
       
  2883   var mediaEventTypes = [TOP_ABORT, TOP_CAN_PLAY, TOP_CAN_PLAY_THROUGH, TOP_DURATION_CHANGE, TOP_EMPTIED, TOP_ENCRYPTED, TOP_ENDED, TOP_ERROR, TOP_LOADED_DATA, TOP_LOADED_METADATA, TOP_LOAD_START, TOP_PAUSE, TOP_PLAY, TOP_PLAYING, TOP_PROGRESS, TOP_RATE_CHANGE, TOP_SEEKED, TOP_SEEKING, TOP_STALLED, TOP_SUSPEND, TOP_TIME_UPDATE, TOP_VOLUME_CHANGE, TOP_WAITING];
       
  2884   function getRawEventName(topLevelType) {
       
  2885     return unsafeCastDOMTopLevelTypeToString(topLevelType);
       
  2886   }
       
  2887 
       
  2888   var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map; // prettier-ignore
       
  2889 
       
  2890   var elementListenerMap = new PossiblyWeakMap();
       
  2891   function getListenerMapForElement(element) {
       
  2892     var listenerMap = elementListenerMap.get(element);
       
  2893 
       
  2894     if (listenerMap === undefined) {
       
  2895       listenerMap = new Map();
       
  2896       elementListenerMap.set(element, listenerMap);
       
  2897     }
       
  2898 
       
  2899     return listenerMap;
       
  2900   }
       
  2901 
       
  2902   /**
       
  2903    * `ReactInstanceMap` maintains a mapping from a public facing stateful
       
  2904    * instance (key) and the internal representation (value). This allows public
       
  2905    * methods to accept the user facing instance as an argument and map them back
       
  2906    * to internal methods.
       
  2907    *
       
  2908    * Note that this module is currently shared and assumed to be stateless.
       
  2909    * If this becomes an actual Map, that will break.
       
  2910    */
       
  2911   function get(key) {
       
  2912     return key._reactInternalFiber;
       
  2913   }
       
  2914   function has$1(key) {
       
  2915     return key._reactInternalFiber !== undefined;
       
  2916   }
       
  2917   function set(key, value) {
       
  2918     key._reactInternalFiber = value;
       
  2919   }
       
  2920 
       
  2921   // Don't change these two values. They're used by React Dev Tools.
       
  2922   var NoEffect =
       
  2923   /*              */
       
  2924   0;
       
  2925   var PerformedWork =
       
  2926   /*         */
       
  2927   1; // You can change the rest (and add more).
       
  2928 
       
  2929   var Placement =
       
  2930   /*             */
       
  2931   2;
       
  2932   var Update =
       
  2933   /*                */
       
  2934   4;
       
  2935   var PlacementAndUpdate =
       
  2936   /*    */
       
  2937   6;
       
  2938   var Deletion =
       
  2939   /*              */
       
  2940   8;
       
  2941   var ContentReset =
       
  2942   /*          */
       
  2943   16;
       
  2944   var Callback =
       
  2945   /*              */
       
  2946   32;
       
  2947   var DidCapture =
       
  2948   /*            */
       
  2949   64;
       
  2950   var Ref =
       
  2951   /*                   */
       
  2952   128;
       
  2953   var Snapshot =
       
  2954   /*              */
       
  2955   256;
       
  2956   var Passive =
       
  2957   /*               */
       
  2958   512;
       
  2959   var Hydrating =
       
  2960   /*             */
       
  2961   1024;
       
  2962   var HydratingAndUpdate =
       
  2963   /*    */
       
  2964   1028; // Passive & Update & Callback & Ref & Snapshot
       
  2965 
       
  2966   var LifecycleEffectMask =
       
  2967   /*   */
       
  2968   932; // Union of all host effects
       
  2969 
       
  2970   var HostEffectMask =
       
  2971   /*        */
       
  2972   2047;
       
  2973   var Incomplete =
       
  2974   /*            */
       
  2975   2048;
       
  2976   var ShouldCapture =
       
  2977   /*         */
       
  2978   4096;
       
  2979 
       
  2980   var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
       
  2981   function getNearestMountedFiber(fiber) {
       
  2982     var node = fiber;
       
  2983     var nearestMounted = fiber;
       
  2984 
       
  2985     if (!fiber.alternate) {
       
  2986       // If there is no alternate, this might be a new tree that isn't inserted
       
  2987       // yet. If it is, then it will have a pending insertion effect on it.
       
  2988       var nextNode = node;
       
  2989 
       
  2990       do {
       
  2991         node = nextNode;
       
  2992 
       
  2993         if ((node.effectTag & (Placement | Hydrating)) !== NoEffect) {
       
  2994           // This is an insertion or in-progress hydration. The nearest possible
       
  2995           // mounted fiber is the parent but we need to continue to figure out
       
  2996           // if that one is still mounted.
       
  2997           nearestMounted = node.return;
       
  2998         }
       
  2999 
       
  3000         nextNode = node.return;
       
  3001       } while (nextNode);
       
  3002     } else {
       
  3003       while (node.return) {
       
  3004         node = node.return;
       
  3005       }
       
  3006     }
       
  3007 
       
  3008     if (node.tag === HostRoot) {
       
  3009       // TODO: Check if this was a nested HostRoot when used with
       
  3010       // renderContainerIntoSubtree.
       
  3011       return nearestMounted;
       
  3012     } // If we didn't hit the root, that means that we're in an disconnected tree
       
  3013     // that has been unmounted.
       
  3014 
       
  3015 
       
  3016     return null;
       
  3017   }
       
  3018   function getSuspenseInstanceFromFiber(fiber) {
       
  3019     if (fiber.tag === SuspenseComponent) {
       
  3020       var suspenseState = fiber.memoizedState;
       
  3021 
       
  3022       if (suspenseState === null) {
       
  3023         var current = fiber.alternate;
       
  3024 
       
  3025         if (current !== null) {
       
  3026           suspenseState = current.memoizedState;
       
  3027         }
       
  3028       }
       
  3029 
       
  3030       if (suspenseState !== null) {
       
  3031         return suspenseState.dehydrated;
       
  3032       }
       
  3033     }
       
  3034 
       
  3035     return null;
       
  3036   }
       
  3037   function getContainerFromFiber(fiber) {
       
  3038     return fiber.tag === HostRoot ? fiber.stateNode.containerInfo : null;
       
  3039   }
       
  3040   function isFiberMounted(fiber) {
       
  3041     return getNearestMountedFiber(fiber) === fiber;
       
  3042   }
       
  3043   function isMounted(component) {
       
  3044     {
       
  3045       var owner = ReactCurrentOwner.current;
       
  3046 
       
  3047       if (owner !== null && owner.tag === ClassComponent) {
       
  3048         var ownerFiber = owner;
       
  3049         var instance = ownerFiber.stateNode;
       
  3050 
       
  3051         if (!instance._warnedAboutRefsInRender) {
       
  3052           error('%s is accessing isMounted inside its render() function. ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', getComponentName(ownerFiber.type) || 'A component');
       
  3053         }
       
  3054 
       
  3055         instance._warnedAboutRefsInRender = true;
       
  3056       }
       
  3057     }
       
  3058 
       
  3059     var fiber = get(component);
       
  3060 
       
  3061     if (!fiber) {
       
  3062       return false;
       
  3063     }
       
  3064 
       
  3065     return getNearestMountedFiber(fiber) === fiber;
       
  3066   }
       
  3067 
       
  3068   function assertIsMounted(fiber) {
       
  3069     if (!(getNearestMountedFiber(fiber) === fiber)) {
       
  3070       {
       
  3071         throw Error( "Unable to find node on an unmounted component." );
       
  3072       }
       
  3073     }
       
  3074   }
       
  3075 
       
  3076   function findCurrentFiberUsingSlowPath(fiber) {
       
  3077     var alternate = fiber.alternate;
       
  3078 
       
  3079     if (!alternate) {
       
  3080       // If there is no alternate, then we only need to check if it is mounted.
       
  3081       var nearestMounted = getNearestMountedFiber(fiber);
       
  3082 
       
  3083       if (!(nearestMounted !== null)) {
       
  3084         {
       
  3085           throw Error( "Unable to find node on an unmounted component." );
       
  3086         }
       
  3087       }
       
  3088 
       
  3089       if (nearestMounted !== fiber) {
       
  3090         return null;
       
  3091       }
       
  3092 
       
  3093       return fiber;
       
  3094     } // If we have two possible branches, we'll walk backwards up to the root
       
  3095     // to see what path the root points to. On the way we may hit one of the
       
  3096     // special cases and we'll deal with them.
       
  3097 
       
  3098 
       
  3099     var a = fiber;
       
  3100     var b = alternate;
       
  3101 
       
  3102     while (true) {
       
  3103       var parentA = a.return;
       
  3104 
       
  3105       if (parentA === null) {
       
  3106         // We're at the root.
       
  3107         break;
       
  3108       }
       
  3109 
       
  3110       var parentB = parentA.alternate;
       
  3111 
       
  3112       if (parentB === null) {
       
  3113         // There is no alternate. This is an unusual case. Currently, it only
       
  3114         // happens when a Suspense component is hidden. An extra fragment fiber
       
  3115         // is inserted in between the Suspense fiber and its children. Skip
       
  3116         // over this extra fragment fiber and proceed to the next parent.
       
  3117         var nextParent = parentA.return;
       
  3118 
       
  3119         if (nextParent !== null) {
       
  3120           a = b = nextParent;
       
  3121           continue;
       
  3122         } // If there's no parent, we're at the root.
       
  3123 
       
  3124 
       
  3125         break;
       
  3126       } // If both copies of the parent fiber point to the same child, we can
       
  3127       // assume that the child is current. This happens when we bailout on low
       
  3128       // priority: the bailed out fiber's child reuses the current child.
       
  3129 
       
  3130 
       
  3131       if (parentA.child === parentB.child) {
       
  3132         var child = parentA.child;
       
  3133 
       
  3134         while (child) {
       
  3135           if (child === a) {
       
  3136             // We've determined that A is the current branch.
       
  3137             assertIsMounted(parentA);
       
  3138             return fiber;
       
  3139           }
       
  3140 
       
  3141           if (child === b) {
       
  3142             // We've determined that B is the current branch.
       
  3143             assertIsMounted(parentA);
       
  3144             return alternate;
       
  3145           }
       
  3146 
       
  3147           child = child.sibling;
       
  3148         } // We should never have an alternate for any mounting node. So the only
       
  3149         // way this could possibly happen is if this was unmounted, if at all.
       
  3150 
       
  3151 
  5305         {
  3152         {
  5306           {
  3153           {
  5307             throw ReactError(Error('Unable to find node on an unmounted component.'));
  3154             throw Error( "Unable to find node on an unmounted component." );
  5308           }
  3155           }
  5309         }
  3156         }
  5310       })();
  3157       }
  5311     }
  3158 
  5312 
  3159       if (a.return !== b.return) {
  5313     if (a.return !== b.return) {
  3160         // The return pointer of A and the return pointer of B point to different
  5314       // The return pointer of A and the return pointer of B point to different
  3161         // fibers. We assume that return pointers never criss-cross, so A must
  5315       // fibers. We assume that return pointers never criss-cross, so A must
  3162         // belong to the child set of A.return, and B must belong to the child
  5316       // belong to the child set of A.return, and B must belong to the child
  3163         // set of B.return.
  5317       // set of B.return.
  3164         a = parentA;
  5318       a = parentA;
  3165         b = parentB;
  5319       b = parentB;
  3166       } else {
  5320     } else {
  3167         // The return pointers point to the same fiber. We'll have to use the
  5321       // The return pointers point to the same fiber. We'll have to use the
  3168         // default, slow path: scan the child sets of each parent alternate to see
  5322       // default, slow path: scan the child sets of each parent alternate to see
  3169         // which child belongs to which set.
  5323       // which child belongs to which set.
  3170         //
  5324       //
  3171         // Search parent A's child set
  5325       // Search parent A's child set
  3172         var didFindChild = false;
  5326       var didFindChild = false;
  3173         var _child = parentA.child;
  5327       var _child = parentA.child;
  3174 
  5328       while (_child) {
       
  5329         if (_child === a) {
       
  5330           didFindChild = true;
       
  5331           a = parentA;
       
  5332           b = parentB;
       
  5333           break;
       
  5334         }
       
  5335         if (_child === b) {
       
  5336           didFindChild = true;
       
  5337           b = parentA;
       
  5338           a = parentB;
       
  5339           break;
       
  5340         }
       
  5341         _child = _child.sibling;
       
  5342       }
       
  5343       if (!didFindChild) {
       
  5344         // Search parent B's child set
       
  5345         _child = parentB.child;
       
  5346         while (_child) {
  3175         while (_child) {
  5347           if (_child === a) {
  3176           if (_child === a) {
  5348             didFindChild = true;
  3177             didFindChild = true;
  5349             a = parentB;
  3178             a = parentA;
  5350             b = parentA;
  3179             b = parentB;
  5351             break;
  3180             break;
  5352           }
  3181           }
       
  3182 
  5353           if (_child === b) {
  3183           if (_child === b) {
  5354             didFindChild = true;
  3184             didFindChild = true;
  5355             b = parentB;
  3185             b = parentA;
  5356             a = parentA;
  3186             a = parentB;
  5357             break;
  3187             break;
  5358           }
  3188           }
       
  3189 
  5359           _child = _child.sibling;
  3190           _child = _child.sibling;
  5360         }
  3191         }
  5361         (function () {
  3192 
       
  3193         if (!didFindChild) {
       
  3194           // Search parent B's child set
       
  3195           _child = parentB.child;
       
  3196 
       
  3197           while (_child) {
       
  3198             if (_child === a) {
       
  3199               didFindChild = true;
       
  3200               a = parentB;
       
  3201               b = parentA;
       
  3202               break;
       
  3203             }
       
  3204 
       
  3205             if (_child === b) {
       
  3206               didFindChild = true;
       
  3207               b = parentB;
       
  3208               a = parentA;
       
  3209               break;
       
  3210             }
       
  3211 
       
  3212             _child = _child.sibling;
       
  3213           }
       
  3214 
  5362           if (!didFindChild) {
  3215           if (!didFindChild) {
  5363             {
  3216             {
  5364               throw ReactError(Error('Child was not found in either parent set. This indicates a bug in React related to the return pointer. Please file an issue.'));
  3217               throw Error( "Child was not found in either parent set. This indicates a bug in React related to the return pointer. Please file an issue." );
  5365             }
  3218             }
  5366           }
  3219           }
  5367         })();
  3220         }
  5368       }
  3221       }
  5369     }
  3222 
  5370 
       
  5371     (function () {
       
  5372       if (!(a.alternate === b)) {
  3223       if (!(a.alternate === b)) {
  5373         {
  3224         {
  5374           throw ReactError(Error('Return fibers should always be each others\' alternates. This error is likely caused by a bug in React. Please file an issue.'));
  3225           throw Error( "Return fibers should always be each others' alternates. This error is likely caused by a bug in React. Please file an issue." );
  5375         }
  3226         }
  5376       }
  3227       }
  5377     })();
  3228     } // If the root is not a host container, we're in a disconnected tree. I.e.
  5378   }
  3229     // unmounted.
  5379   // If the root is not a host container, we're in a disconnected tree. I.e.
  3230 
  5380   // unmounted.
  3231 
  5381   (function () {
       
  5382     if (!(a.tag === HostRoot)) {
  3232     if (!(a.tag === HostRoot)) {
  5383       {
  3233       {
  5384         throw ReactError(Error('Unable to find node on an unmounted component.'));
  3234         throw Error( "Unable to find node on an unmounted component." );
  5385       }
  3235       }
  5386     }
  3236     }
  5387   })();
  3237 
  5388   if (a.stateNode.current === a) {
  3238     if (a.stateNode.current === a) {
  5389     // We've determined that A is the current branch.
  3239       // We've determined that A is the current branch.
  5390     return fiber;
  3240       return fiber;
  5391   }
  3241     } // Otherwise B has to be current branch.
  5392   // Otherwise B has to be current branch.
  3242 
  5393   return alternate;
  3243 
  5394 }
  3244     return alternate;
  5395 
  3245   }
  5396 function findCurrentHostFiber(parent) {
  3246   function findCurrentHostFiber(parent) {
  5397   var currentParent = findCurrentFiberUsingSlowPath(parent);
  3247     var currentParent = findCurrentFiberUsingSlowPath(parent);
  5398   if (!currentParent) {
  3248 
       
  3249     if (!currentParent) {
       
  3250       return null;
       
  3251     } // Next we'll drill down this component to find the first HostComponent/Text.
       
  3252 
       
  3253 
       
  3254     var node = currentParent;
       
  3255 
       
  3256     while (true) {
       
  3257       if (node.tag === HostComponent || node.tag === HostText) {
       
  3258         return node;
       
  3259       } else if (node.child) {
       
  3260         node.child.return = node;
       
  3261         node = node.child;
       
  3262         continue;
       
  3263       }
       
  3264 
       
  3265       if (node === currentParent) {
       
  3266         return null;
       
  3267       }
       
  3268 
       
  3269       while (!node.sibling) {
       
  3270         if (!node.return || node.return === currentParent) {
       
  3271           return null;
       
  3272         }
       
  3273 
       
  3274         node = node.return;
       
  3275       }
       
  3276 
       
  3277       node.sibling.return = node.return;
       
  3278       node = node.sibling;
       
  3279     } // Flow needs the return null here, but ESLint complains about it.
       
  3280     // eslint-disable-next-line no-unreachable
       
  3281 
       
  3282 
  5399     return null;
  3283     return null;
  5400   }
  3284   }
  5401 
  3285   function findCurrentHostFiberWithNoPortals(parent) {
  5402   // Next we'll drill down this component to find the first HostComponent/Text.
  3286     var currentParent = findCurrentFiberUsingSlowPath(parent);
  5403   var node = currentParent;
  3287 
  5404   while (true) {
  3288     if (!currentParent) {
  5405     if (node.tag === HostComponent || node.tag === HostText) {
       
  5406       return node;
       
  5407     } else if (node.child) {
       
  5408       node.child.return = node;
       
  5409       node = node.child;
       
  5410       continue;
       
  5411     }
       
  5412     if (node === currentParent) {
       
  5413       return null;
  3289       return null;
  5414     }
  3290     } // Next we'll drill down this component to find the first HostComponent/Text.
  5415     while (!node.sibling) {
  3291 
  5416       if (!node.return || node.return === currentParent) {
  3292 
       
  3293     var node = currentParent;
       
  3294 
       
  3295     while (true) {
       
  3296       if (node.tag === HostComponent || node.tag === HostText || enableFundamentalAPI ) {
       
  3297         return node;
       
  3298       } else if (node.child && node.tag !== HostPortal) {
       
  3299         node.child.return = node;
       
  3300         node = node.child;
       
  3301         continue;
       
  3302       }
       
  3303 
       
  3304       if (node === currentParent) {
  5417         return null;
  3305         return null;
  5418       }
  3306       }
  5419       node = node.return;
  3307 
  5420     }
  3308       while (!node.sibling) {
  5421     node.sibling.return = node.return;
  3309         if (!node.return || node.return === currentParent) {
  5422     node = node.sibling;
  3310           return null;
  5423   }
  3311         }
  5424   // Flow needs the return null here, but ESLint complains about it.
  3312 
  5425   // eslint-disable-next-line no-unreachable
  3313         node = node.return;
  5426   return null;
  3314       }
  5427 }
  3315 
  5428 
  3316       node.sibling.return = node.return;
  5429 function findCurrentHostFiberWithNoPortals(parent) {
  3317       node = node.sibling;
  5430   var currentParent = findCurrentFiberUsingSlowPath(parent);
  3318     } // Flow needs the return null here, but ESLint complains about it.
  5431   if (!currentParent) {
  3319     // eslint-disable-next-line no-unreachable
       
  3320 
       
  3321 
  5432     return null;
  3322     return null;
  5433   }
  3323   }
  5434 
  3324 
  5435   // Next we'll drill down this component to find the first HostComponent/Text.
  3325   /**
  5436   var node = currentParent;
  3326    * Accumulates items that must not be null or undefined into the first one. This
  5437   while (true) {
  3327    * is used to conserve memory by avoiding array allocations, and thus sacrifices
  5438     if (node.tag === HostComponent || node.tag === HostText || node.tag === FundamentalComponent) {
  3328    * API cleanness. Since `current` can be null before being passed in and not
  5439       return node;
  3329    * null after this function, make sure to assign it back to `current`:
  5440     } else if (node.child && node.tag !== HostPortal) {
  3330    *
  5441       node.child.return = node;
  3331    * `a = accumulateInto(a, b);`
  5442       node = node.child;
  3332    *
  5443       continue;
  3333    * This API should be sparingly used. Try `accumulate` for something cleaner.
  5444     }
  3334    *
  5445     if (node === currentParent) {
  3335    * @return {*|array<*>} An accumulation of items.
       
  3336    */
       
  3337 
       
  3338   function accumulateInto(current, next) {
       
  3339     if (!(next != null)) {
       
  3340       {
       
  3341         throw Error( "accumulateInto(...): Accumulated items must not be null or undefined." );
       
  3342       }
       
  3343     }
       
  3344 
       
  3345     if (current == null) {
       
  3346       return next;
       
  3347     } // Both are not empty. Warning: Never call x.concat(y) when you are not
       
  3348     // certain that x is an Array (x could be a string with concat method).
       
  3349 
       
  3350 
       
  3351     if (Array.isArray(current)) {
       
  3352       if (Array.isArray(next)) {
       
  3353         current.push.apply(current, next);
       
  3354         return current;
       
  3355       }
       
  3356 
       
  3357       current.push(next);
       
  3358       return current;
       
  3359     }
       
  3360 
       
  3361     if (Array.isArray(next)) {
       
  3362       // A bit too dangerous to mutate `next`.
       
  3363       return [current].concat(next);
       
  3364     }
       
  3365 
       
  3366     return [current, next];
       
  3367   }
       
  3368 
       
  3369   /**
       
  3370    * @param {array} arr an "accumulation" of items which is either an Array or
       
  3371    * a single item. Useful when paired with the `accumulate` module. This is a
       
  3372    * simple utility that allows us to reason about a collection of items, but
       
  3373    * handling the case when there is exactly one item (and we do not need to
       
  3374    * allocate an array).
       
  3375    * @param {function} cb Callback invoked with each element or a collection.
       
  3376    * @param {?} [scope] Scope used as `this` in a callback.
       
  3377    */
       
  3378   function forEachAccumulated(arr, cb, scope) {
       
  3379     if (Array.isArray(arr)) {
       
  3380       arr.forEach(cb, scope);
       
  3381     } else if (arr) {
       
  3382       cb.call(scope, arr);
       
  3383     }
       
  3384   }
       
  3385 
       
  3386   /**
       
  3387    * Internal queue of events that have accumulated their dispatches and are
       
  3388    * waiting to have their dispatches executed.
       
  3389    */
       
  3390 
       
  3391   var eventQueue = null;
       
  3392   /**
       
  3393    * Dispatches an event and releases it back into the pool, unless persistent.
       
  3394    *
       
  3395    * @param {?object} event Synthetic event to be dispatched.
       
  3396    * @private
       
  3397    */
       
  3398 
       
  3399   var executeDispatchesAndRelease = function (event) {
       
  3400     if (event) {
       
  3401       executeDispatchesInOrder(event);
       
  3402 
       
  3403       if (!event.isPersistent()) {
       
  3404         event.constructor.release(event);
       
  3405       }
       
  3406     }
       
  3407   };
       
  3408 
       
  3409   var executeDispatchesAndReleaseTopLevel = function (e) {
       
  3410     return executeDispatchesAndRelease(e);
       
  3411   };
       
  3412 
       
  3413   function runEventsInBatch(events) {
       
  3414     if (events !== null) {
       
  3415       eventQueue = accumulateInto(eventQueue, events);
       
  3416     } // Set `eventQueue` to null before processing it so that we can tell if more
       
  3417     // events get enqueued while processing.
       
  3418 
       
  3419 
       
  3420     var processingEventQueue = eventQueue;
       
  3421     eventQueue = null;
       
  3422 
       
  3423     if (!processingEventQueue) {
       
  3424       return;
       
  3425     }
       
  3426 
       
  3427     forEachAccumulated(processingEventQueue, executeDispatchesAndReleaseTopLevel);
       
  3428 
       
  3429     if (!!eventQueue) {
       
  3430       {
       
  3431         throw Error( "processEventQueue(): Additional events were enqueued while processing an event queue. Support for this has not yet been implemented." );
       
  3432       }
       
  3433     } // This would be a good time to rethrow if any of the event handlers threw.
       
  3434 
       
  3435 
       
  3436     rethrowCaughtError();
       
  3437   }
       
  3438 
       
  3439   /**
       
  3440    * Gets the target node from a native browser event by accounting for
       
  3441    * inconsistencies in browser DOM APIs.
       
  3442    *
       
  3443    * @param {object} nativeEvent Native browser event.
       
  3444    * @return {DOMEventTarget} Target node.
       
  3445    */
       
  3446 
       
  3447   function getEventTarget(nativeEvent) {
       
  3448     // Fallback to nativeEvent.srcElement for IE9
       
  3449     // https://github.com/facebook/react/issues/12506
       
  3450     var target = nativeEvent.target || nativeEvent.srcElement || window; // Normalize SVG <use> element events #4963
       
  3451 
       
  3452     if (target.correspondingUseElement) {
       
  3453       target = target.correspondingUseElement;
       
  3454     } // Safari may fire events on text nodes (Node.TEXT_NODE is 3).
       
  3455     // @see http://www.quirksmode.org/js/events_properties.html
       
  3456 
       
  3457 
       
  3458     return target.nodeType === TEXT_NODE ? target.parentNode : target;
       
  3459   }
       
  3460 
       
  3461   /**
       
  3462    * Checks if an event is supported in the current execution environment.
       
  3463    *
       
  3464    * NOTE: This will not work correctly for non-generic events such as `change`,
       
  3465    * `reset`, `load`, `error`, and `select`.
       
  3466    *
       
  3467    * Borrows from Modernizr.
       
  3468    *
       
  3469    * @param {string} eventNameSuffix Event name, e.g. "click".
       
  3470    * @return {boolean} True if the event is supported.
       
  3471    * @internal
       
  3472    * @license Modernizr 3.0.0pre (Custom Build) | MIT
       
  3473    */
       
  3474 
       
  3475   function isEventSupported(eventNameSuffix) {
       
  3476     if (!canUseDOM) {
       
  3477       return false;
       
  3478     }
       
  3479 
       
  3480     var eventName = 'on' + eventNameSuffix;
       
  3481     var isSupported = eventName in document;
       
  3482 
       
  3483     if (!isSupported) {
       
  3484       var element = document.createElement('div');
       
  3485       element.setAttribute(eventName, 'return;');
       
  3486       isSupported = typeof element[eventName] === 'function';
       
  3487     }
       
  3488 
       
  3489     return isSupported;
       
  3490   }
       
  3491 
       
  3492   /**
       
  3493    * Summary of `DOMEventPluginSystem` event handling:
       
  3494    *
       
  3495    *  - Top-level delegation is used to trap most native browser events. This
       
  3496    *    may only occur in the main thread and is the responsibility of
       
  3497    *    ReactDOMEventListener, which is injected and can therefore support
       
  3498    *    pluggable event sources. This is the only work that occurs in the main
       
  3499    *    thread.
       
  3500    *
       
  3501    *  - We normalize and de-duplicate events to account for browser quirks. This
       
  3502    *    may be done in the worker thread.
       
  3503    *
       
  3504    *  - Forward these native events (with the associated top-level type used to
       
  3505    *    trap it) to `EventPluginRegistry`, which in turn will ask plugins if they want
       
  3506    *    to extract any synthetic events.
       
  3507    *
       
  3508    *  - The `EventPluginRegistry` will then process each event by annotating them with
       
  3509    *    "dispatches", a sequence of listeners and IDs that care about that event.
       
  3510    *
       
  3511    *  - The `EventPluginRegistry` then dispatches the events.
       
  3512    *
       
  3513    * Overview of React and the event system:
       
  3514    *
       
  3515    * +------------+    .
       
  3516    * |    DOM     |    .
       
  3517    * +------------+    .
       
  3518    *       |           .
       
  3519    *       v           .
       
  3520    * +------------+    .
       
  3521    * | ReactEvent |    .
       
  3522    * |  Listener  |    .
       
  3523    * +------------+    .                         +-----------+
       
  3524    *       |           .               +--------+|SimpleEvent|
       
  3525    *       |           .               |         |Plugin     |
       
  3526    * +-----|------+    .               v         +-----------+
       
  3527    * |     |      |    .    +--------------+                    +------------+
       
  3528    * |     +-----------.--->|PluginRegistry|                    |    Event   |
       
  3529    * |            |    .    |              |     +-----------+  | Propagators|
       
  3530    * | ReactEvent |    .    |              |     |TapEvent   |  |------------|
       
  3531    * |  Emitter   |    .    |              |<---+|Plugin     |  |other plugin|
       
  3532    * |            |    .    |              |     +-----------+  |  utilities |
       
  3533    * |     +-----------.--->|              |                    +------------+
       
  3534    * |     |      |    .    +--------------+
       
  3535    * +-----|------+    .                ^        +-----------+
       
  3536    *       |           .                |        |Enter/Leave|
       
  3537    *       +           .                +-------+|Plugin     |
       
  3538    * +-------------+   .                         +-----------+
       
  3539    * | application |   .
       
  3540    * |-------------|   .
       
  3541    * |             |   .
       
  3542    * |             |   .
       
  3543    * +-------------+   .
       
  3544    *                   .
       
  3545    *    React Core     .  General Purpose Event Plugin System
       
  3546    */
       
  3547 
       
  3548   var CALLBACK_BOOKKEEPING_POOL_SIZE = 10;
       
  3549   var callbackBookkeepingPool = [];
       
  3550 
       
  3551   function releaseTopLevelCallbackBookKeeping(instance) {
       
  3552     instance.topLevelType = null;
       
  3553     instance.nativeEvent = null;
       
  3554     instance.targetInst = null;
       
  3555     instance.ancestors.length = 0;
       
  3556 
       
  3557     if (callbackBookkeepingPool.length < CALLBACK_BOOKKEEPING_POOL_SIZE) {
       
  3558       callbackBookkeepingPool.push(instance);
       
  3559     }
       
  3560   } // Used to store ancestor hierarchy in top level callback
       
  3561 
       
  3562 
       
  3563   function getTopLevelCallbackBookKeeping(topLevelType, nativeEvent, targetInst, eventSystemFlags) {
       
  3564     if (callbackBookkeepingPool.length) {
       
  3565       var instance = callbackBookkeepingPool.pop();
       
  3566       instance.topLevelType = topLevelType;
       
  3567       instance.eventSystemFlags = eventSystemFlags;
       
  3568       instance.nativeEvent = nativeEvent;
       
  3569       instance.targetInst = targetInst;
       
  3570       return instance;
       
  3571     }
       
  3572 
       
  3573     return {
       
  3574       topLevelType: topLevelType,
       
  3575       eventSystemFlags: eventSystemFlags,
       
  3576       nativeEvent: nativeEvent,
       
  3577       targetInst: targetInst,
       
  3578       ancestors: []
       
  3579     };
       
  3580   }
       
  3581   /**
       
  3582    * Find the deepest React component completely containing the root of the
       
  3583    * passed-in instance (for use when entire React trees are nested within each
       
  3584    * other). If React trees are not nested, returns null.
       
  3585    */
       
  3586 
       
  3587 
       
  3588   function findRootContainerNode(inst) {
       
  3589     if (inst.tag === HostRoot) {
       
  3590       return inst.stateNode.containerInfo;
       
  3591     } // TODO: It may be a good idea to cache this to prevent unnecessary DOM
       
  3592     // traversal, but caching is difficult to do correctly without using a
       
  3593     // mutation observer to listen for all DOM changes.
       
  3594 
       
  3595 
       
  3596     while (inst.return) {
       
  3597       inst = inst.return;
       
  3598     }
       
  3599 
       
  3600     if (inst.tag !== HostRoot) {
       
  3601       // This can happen if we're in a detached tree.
  5446       return null;
  3602       return null;
  5447     }
  3603     }
  5448     while (!node.sibling) {
  3604 
  5449       if (!node.return || node.return === currentParent) {
  3605     return inst.stateNode.containerInfo;
  5450         return null;
  3606   }
  5451       }
  3607   /**
  5452       node = node.return;
  3608    * Allows registered plugins an opportunity to extract events from top-level
  5453     }
  3609    * native browser events.
  5454     node.sibling.return = node.return;
  3610    *
  5455     node = node.sibling;
  3611    * @return {*} An accumulation of synthetic events.
  5456   }
  3612    * @internal
  5457   // Flow needs the return null here, but ESLint complains about it.
  3613    */
  5458   // eslint-disable-next-line no-unreachable
  3614 
  5459   return null;
  3615 
  5460 }
  3616   function extractPluginEvents(topLevelType, targetInst, nativeEvent, nativeEventTarget, eventSystemFlags) {
  5461 
  3617     var events = null;
  5462 function addEventBubbleListener(element, eventType, listener) {
  3618 
  5463   element.addEventListener(eventType, listener, false);
  3619     for (var i = 0; i < plugins.length; i++) {
  5464 }
  3620       // Not every plugin in the ordering may be loaded at runtime.
  5465 
  3621       var possiblePlugin = plugins[i];
  5466 function addEventCaptureListener(element, eventType, listener) {
  3622 
  5467   element.addEventListener(eventType, listener, true);
  3623       if (possiblePlugin) {
  5468 }
  3624         var extractedEvents = possiblePlugin.extractEvents(topLevelType, targetInst, nativeEvent, nativeEventTarget, eventSystemFlags);
  5469 
  3625 
  5470 function addEventCaptureListenerWithPassiveFlag(element, eventType, listener, passive) {
  3626         if (extractedEvents) {
  5471   element.addEventListener(eventType, listener, {
  3627           events = accumulateInto(events, extractedEvents);
  5472     capture: true,
  3628         }
  5473     passive: passive
  3629       }
  5474   });
  3630     }
  5475 }
  3631 
  5476 
  3632     return events;
  5477 /**
  3633   }
  5478  * @interface Event
  3634 
  5479  * @see http://www.w3.org/TR/css3-animations/#AnimationEvent-interface
  3635   function runExtractedPluginEventsInBatch(topLevelType, targetInst, nativeEvent, nativeEventTarget, eventSystemFlags) {
  5480  * @see https://developer.mozilla.org/en-US/docs/Web/API/AnimationEvent
  3636     var events = extractPluginEvents(topLevelType, targetInst, nativeEvent, nativeEventTarget, eventSystemFlags);
  5481  */
  3637     runEventsInBatch(events);
  5482 var SyntheticAnimationEvent = SyntheticEvent.extend({
  3638   }
  5483   animationName: null,
  3639 
  5484   elapsedTime: null,
  3640   function handleTopLevel(bookKeeping) {
  5485   pseudoElement: null
  3641     var targetInst = bookKeeping.targetInst; // Loop through the hierarchy, in case there's any nested components.
  5486 });
  3642     // It's important that we build the array of ancestors before calling any
  5487 
  3643     // event handlers, because event handlers can modify the DOM, leading to
  5488 /**
  3644     // inconsistencies with ReactMount's node cache. See #1105.
  5489  * @interface Event
  3645 
  5490  * @see http://www.w3.org/TR/clipboard-apis/
  3646     var ancestor = targetInst;
  5491  */
  3647 
  5492 var SyntheticClipboardEvent = SyntheticEvent.extend({
  3648     do {
  5493   clipboardData: function (event) {
  3649       if (!ancestor) {
  5494     return 'clipboardData' in event ? event.clipboardData : window.clipboardData;
  3650         var ancestors = bookKeeping.ancestors;
  5495   }
  3651         ancestors.push(ancestor);
  5496 });
       
  5497 
       
  5498 /**
       
  5499  * @interface FocusEvent
       
  5500  * @see http://www.w3.org/TR/DOM-Level-3-Events/
       
  5501  */
       
  5502 var SyntheticFocusEvent = SyntheticUIEvent.extend({
       
  5503   relatedTarget: null
       
  5504 });
       
  5505 
       
  5506 /**
       
  5507  * `charCode` represents the actual "character code" and is safe to use with
       
  5508  * `String.fromCharCode`. As such, only keys that correspond to printable
       
  5509  * characters produce a valid `charCode`, the only exception to this is Enter.
       
  5510  * The Tab-key is considered non-printable and does not have a `charCode`,
       
  5511  * presumably because it does not produce a tab-character in browsers.
       
  5512  *
       
  5513  * @param {object} nativeEvent Native browser event.
       
  5514  * @return {number} Normalized `charCode` property.
       
  5515  */
       
  5516 function getEventCharCode(nativeEvent) {
       
  5517   var charCode = void 0;
       
  5518   var keyCode = nativeEvent.keyCode;
       
  5519 
       
  5520   if ('charCode' in nativeEvent) {
       
  5521     charCode = nativeEvent.charCode;
       
  5522 
       
  5523     // FF does not set `charCode` for the Enter-key, check against `keyCode`.
       
  5524     if (charCode === 0 && keyCode === 13) {
       
  5525       charCode = 13;
       
  5526     }
       
  5527   } else {
       
  5528     // IE8 does not implement `charCode`, but `keyCode` has the correct value.
       
  5529     charCode = keyCode;
       
  5530   }
       
  5531 
       
  5532   // IE and Edge (on Windows) and Chrome / Safari (on Windows and Linux)
       
  5533   // report Enter as charCode 10 when ctrl is pressed.
       
  5534   if (charCode === 10) {
       
  5535     charCode = 13;
       
  5536   }
       
  5537 
       
  5538   // Some non-printable keys are reported in `charCode`/`keyCode`, discard them.
       
  5539   // Must not discard the (non-)printable Enter-key.
       
  5540   if (charCode >= 32 || charCode === 13) {
       
  5541     return charCode;
       
  5542   }
       
  5543 
       
  5544   return 0;
       
  5545 }
       
  5546 
       
  5547 /**
       
  5548  * Normalization of deprecated HTML5 `key` values
       
  5549  * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names
       
  5550  */
       
  5551 var normalizeKey = {
       
  5552   Esc: 'Escape',
       
  5553   Spacebar: ' ',
       
  5554   Left: 'ArrowLeft',
       
  5555   Up: 'ArrowUp',
       
  5556   Right: 'ArrowRight',
       
  5557   Down: 'ArrowDown',
       
  5558   Del: 'Delete',
       
  5559   Win: 'OS',
       
  5560   Menu: 'ContextMenu',
       
  5561   Apps: 'ContextMenu',
       
  5562   Scroll: 'ScrollLock',
       
  5563   MozPrintableKey: 'Unidentified'
       
  5564 };
       
  5565 
       
  5566 /**
       
  5567  * Translation from legacy `keyCode` to HTML5 `key`
       
  5568  * Only special keys supported, all others depend on keyboard layout or browser
       
  5569  * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names
       
  5570  */
       
  5571 var translateToKey = {
       
  5572   '8': 'Backspace',
       
  5573   '9': 'Tab',
       
  5574   '12': 'Clear',
       
  5575   '13': 'Enter',
       
  5576   '16': 'Shift',
       
  5577   '17': 'Control',
       
  5578   '18': 'Alt',
       
  5579   '19': 'Pause',
       
  5580   '20': 'CapsLock',
       
  5581   '27': 'Escape',
       
  5582   '32': ' ',
       
  5583   '33': 'PageUp',
       
  5584   '34': 'PageDown',
       
  5585   '35': 'End',
       
  5586   '36': 'Home',
       
  5587   '37': 'ArrowLeft',
       
  5588   '38': 'ArrowUp',
       
  5589   '39': 'ArrowRight',
       
  5590   '40': 'ArrowDown',
       
  5591   '45': 'Insert',
       
  5592   '46': 'Delete',
       
  5593   '112': 'F1',
       
  5594   '113': 'F2',
       
  5595   '114': 'F3',
       
  5596   '115': 'F4',
       
  5597   '116': 'F5',
       
  5598   '117': 'F6',
       
  5599   '118': 'F7',
       
  5600   '119': 'F8',
       
  5601   '120': 'F9',
       
  5602   '121': 'F10',
       
  5603   '122': 'F11',
       
  5604   '123': 'F12',
       
  5605   '144': 'NumLock',
       
  5606   '145': 'ScrollLock',
       
  5607   '224': 'Meta'
       
  5608 };
       
  5609 
       
  5610 /**
       
  5611  * @param {object} nativeEvent Native browser event.
       
  5612  * @return {string} Normalized `key` property.
       
  5613  */
       
  5614 function getEventKey(nativeEvent) {
       
  5615   if (nativeEvent.key) {
       
  5616     // Normalize inconsistent values reported by browsers due to
       
  5617     // implementations of a working draft specification.
       
  5618 
       
  5619     // FireFox implements `key` but returns `MozPrintableKey` for all
       
  5620     // printable characters (normalized to `Unidentified`), ignore it.
       
  5621     var key = normalizeKey[nativeEvent.key] || nativeEvent.key;
       
  5622     if (key !== 'Unidentified') {
       
  5623       return key;
       
  5624     }
       
  5625   }
       
  5626 
       
  5627   // Browser does not implement `key`, polyfill as much of it as we can.
       
  5628   if (nativeEvent.type === 'keypress') {
       
  5629     var charCode = getEventCharCode(nativeEvent);
       
  5630 
       
  5631     // The enter-key is technically both printable and non-printable and can
       
  5632     // thus be captured by `keypress`, no other non-printable key should.
       
  5633     return charCode === 13 ? 'Enter' : String.fromCharCode(charCode);
       
  5634   }
       
  5635   if (nativeEvent.type === 'keydown' || nativeEvent.type === 'keyup') {
       
  5636     // While user keyboard layout determines the actual meaning of each
       
  5637     // `keyCode` value, almost all function keys have a universal value.
       
  5638     return translateToKey[nativeEvent.keyCode] || 'Unidentified';
       
  5639   }
       
  5640   return '';
       
  5641 }
       
  5642 
       
  5643 /**
       
  5644  * @interface KeyboardEvent
       
  5645  * @see http://www.w3.org/TR/DOM-Level-3-Events/
       
  5646  */
       
  5647 var SyntheticKeyboardEvent = SyntheticUIEvent.extend({
       
  5648   key: getEventKey,
       
  5649   location: null,
       
  5650   ctrlKey: null,
       
  5651   shiftKey: null,
       
  5652   altKey: null,
       
  5653   metaKey: null,
       
  5654   repeat: null,
       
  5655   locale: null,
       
  5656   getModifierState: getEventModifierState,
       
  5657   // Legacy Interface
       
  5658   charCode: function (event) {
       
  5659     // `charCode` is the result of a KeyPress event and represents the value of
       
  5660     // the actual printable character.
       
  5661 
       
  5662     // KeyPress is deprecated, but its replacement is not yet final and not
       
  5663     // implemented in any major browser. Only KeyPress has charCode.
       
  5664     if (event.type === 'keypress') {
       
  5665       return getEventCharCode(event);
       
  5666     }
       
  5667     return 0;
       
  5668   },
       
  5669   keyCode: function (event) {
       
  5670     // `keyCode` is the result of a KeyDown/Up event and represents the value of
       
  5671     // physical keyboard key.
       
  5672 
       
  5673     // The actual meaning of the value depends on the users' keyboard layout
       
  5674     // which cannot be detected. Assuming that it is a US keyboard layout
       
  5675     // provides a surprisingly accurate mapping for US and European users.
       
  5676     // Due to this, it is left to the user to implement at this time.
       
  5677     if (event.type === 'keydown' || event.type === 'keyup') {
       
  5678       return event.keyCode;
       
  5679     }
       
  5680     return 0;
       
  5681   },
       
  5682   which: function (event) {
       
  5683     // `which` is an alias for either `keyCode` or `charCode` depending on the
       
  5684     // type of the event.
       
  5685     if (event.type === 'keypress') {
       
  5686       return getEventCharCode(event);
       
  5687     }
       
  5688     if (event.type === 'keydown' || event.type === 'keyup') {
       
  5689       return event.keyCode;
       
  5690     }
       
  5691     return 0;
       
  5692   }
       
  5693 });
       
  5694 
       
  5695 /**
       
  5696  * @interface DragEvent
       
  5697  * @see http://www.w3.org/TR/DOM-Level-3-Events/
       
  5698  */
       
  5699 var SyntheticDragEvent = SyntheticMouseEvent.extend({
       
  5700   dataTransfer: null
       
  5701 });
       
  5702 
       
  5703 /**
       
  5704  * @interface TouchEvent
       
  5705  * @see http://www.w3.org/TR/touch-events/
       
  5706  */
       
  5707 var SyntheticTouchEvent = SyntheticUIEvent.extend({
       
  5708   touches: null,
       
  5709   targetTouches: null,
       
  5710   changedTouches: null,
       
  5711   altKey: null,
       
  5712   metaKey: null,
       
  5713   ctrlKey: null,
       
  5714   shiftKey: null,
       
  5715   getModifierState: getEventModifierState
       
  5716 });
       
  5717 
       
  5718 /**
       
  5719  * @interface Event
       
  5720  * @see http://www.w3.org/TR/2009/WD-css3-transitions-20090320/#transition-events-
       
  5721  * @see https://developer.mozilla.org/en-US/docs/Web/API/TransitionEvent
       
  5722  */
       
  5723 var SyntheticTransitionEvent = SyntheticEvent.extend({
       
  5724   propertyName: null,
       
  5725   elapsedTime: null,
       
  5726   pseudoElement: null
       
  5727 });
       
  5728 
       
  5729 /**
       
  5730  * @interface WheelEvent
       
  5731  * @see http://www.w3.org/TR/DOM-Level-3-Events/
       
  5732  */
       
  5733 var SyntheticWheelEvent = SyntheticMouseEvent.extend({
       
  5734   deltaX: function (event) {
       
  5735     return 'deltaX' in event ? event.deltaX : // Fallback to `wheelDeltaX` for Webkit and normalize (right is positive).
       
  5736     'wheelDeltaX' in event ? -event.wheelDeltaX : 0;
       
  5737   },
       
  5738   deltaY: function (event) {
       
  5739     return 'deltaY' in event ? event.deltaY : // Fallback to `wheelDeltaY` for Webkit and normalize (down is positive).
       
  5740     'wheelDeltaY' in event ? -event.wheelDeltaY : // Fallback to `wheelDelta` for IE<9 and normalize (down is positive).
       
  5741     'wheelDelta' in event ? -event.wheelDelta : 0;
       
  5742   },
       
  5743 
       
  5744   deltaZ: null,
       
  5745 
       
  5746   // Browsers without "deltaMode" is reporting in raw wheel delta where one
       
  5747   // notch on the scroll is always +/- 120, roughly equivalent to pixels.
       
  5748   // A good approximation of DOM_DELTA_LINE (1) is 5% of viewport size or
       
  5749   // ~40 pixels, for DOM_DELTA_SCREEN (2) it is 87.5% of viewport size.
       
  5750   deltaMode: null
       
  5751 });
       
  5752 
       
  5753 /**
       
  5754  * Turns
       
  5755  * ['abort', ...]
       
  5756  * into
       
  5757  * eventTypes = {
       
  5758  *   'abort': {
       
  5759  *     phasedRegistrationNames: {
       
  5760  *       bubbled: 'onAbort',
       
  5761  *       captured: 'onAbortCapture',
       
  5762  *     },
       
  5763  *     dependencies: [TOP_ABORT],
       
  5764  *   },
       
  5765  *   ...
       
  5766  * };
       
  5767  * topLevelEventsToDispatchConfig = new Map([
       
  5768  *   [TOP_ABORT, { sameConfig }],
       
  5769  * ]);
       
  5770  */
       
  5771 
       
  5772 var eventTuples = [
       
  5773 // Discrete events
       
  5774 [TOP_BLUR, 'blur', DiscreteEvent], [TOP_CANCEL, 'cancel', DiscreteEvent], [TOP_CLICK, 'click', DiscreteEvent], [TOP_CLOSE, 'close', DiscreteEvent], [TOP_CONTEXT_MENU, 'contextMenu', DiscreteEvent], [TOP_COPY, 'copy', DiscreteEvent], [TOP_CUT, 'cut', DiscreteEvent], [TOP_AUX_CLICK, 'auxClick', DiscreteEvent], [TOP_DOUBLE_CLICK, 'doubleClick', DiscreteEvent], [TOP_DRAG_END, 'dragEnd', DiscreteEvent], [TOP_DRAG_START, 'dragStart', DiscreteEvent], [TOP_DROP, 'drop', DiscreteEvent], [TOP_FOCUS, 'focus', DiscreteEvent], [TOP_INPUT, 'input', DiscreteEvent], [TOP_INVALID, 'invalid', DiscreteEvent], [TOP_KEY_DOWN, 'keyDown', DiscreteEvent], [TOP_KEY_PRESS, 'keyPress', DiscreteEvent], [TOP_KEY_UP, 'keyUp', DiscreteEvent], [TOP_MOUSE_DOWN, 'mouseDown', DiscreteEvent], [TOP_MOUSE_UP, 'mouseUp', DiscreteEvent], [TOP_PASTE, 'paste', DiscreteEvent], [TOP_PAUSE, 'pause', DiscreteEvent], [TOP_PLAY, 'play', DiscreteEvent], [TOP_POINTER_CANCEL, 'pointerCancel', DiscreteEvent], [TOP_POINTER_DOWN, 'pointerDown', DiscreteEvent], [TOP_POINTER_UP, 'pointerUp', DiscreteEvent], [TOP_RATE_CHANGE, 'rateChange', DiscreteEvent], [TOP_RESET, 'reset', DiscreteEvent], [TOP_SEEKED, 'seeked', DiscreteEvent], [TOP_SUBMIT, 'submit', DiscreteEvent], [TOP_TOUCH_CANCEL, 'touchCancel', DiscreteEvent], [TOP_TOUCH_END, 'touchEnd', DiscreteEvent], [TOP_TOUCH_START, 'touchStart', DiscreteEvent], [TOP_VOLUME_CHANGE, 'volumeChange', DiscreteEvent],
       
  5775 
       
  5776 // User-blocking events
       
  5777 [TOP_DRAG, 'drag', UserBlockingEvent], [TOP_DRAG_ENTER, 'dragEnter', UserBlockingEvent], [TOP_DRAG_EXIT, 'dragExit', UserBlockingEvent], [TOP_DRAG_LEAVE, 'dragLeave', UserBlockingEvent], [TOP_DRAG_OVER, 'dragOver', UserBlockingEvent], [TOP_MOUSE_MOVE, 'mouseMove', UserBlockingEvent], [TOP_MOUSE_OUT, 'mouseOut', UserBlockingEvent], [TOP_MOUSE_OVER, 'mouseOver', UserBlockingEvent], [TOP_POINTER_MOVE, 'pointerMove', UserBlockingEvent], [TOP_POINTER_OUT, 'pointerOut', UserBlockingEvent], [TOP_POINTER_OVER, 'pointerOver', UserBlockingEvent], [TOP_SCROLL, 'scroll', UserBlockingEvent], [TOP_TOGGLE, 'toggle', UserBlockingEvent], [TOP_TOUCH_MOVE, 'touchMove', UserBlockingEvent], [TOP_WHEEL, 'wheel', UserBlockingEvent],
       
  5778 
       
  5779 // Continuous events
       
  5780 [TOP_ABORT, 'abort', ContinuousEvent], [TOP_ANIMATION_END, 'animationEnd', ContinuousEvent], [TOP_ANIMATION_ITERATION, 'animationIteration', ContinuousEvent], [TOP_ANIMATION_START, 'animationStart', ContinuousEvent], [TOP_CAN_PLAY, 'canPlay', ContinuousEvent], [TOP_CAN_PLAY_THROUGH, 'canPlayThrough', ContinuousEvent], [TOP_DURATION_CHANGE, 'durationChange', ContinuousEvent], [TOP_EMPTIED, 'emptied', ContinuousEvent], [TOP_ENCRYPTED, 'encrypted', ContinuousEvent], [TOP_ENDED, 'ended', ContinuousEvent], [TOP_ERROR, 'error', ContinuousEvent], [TOP_GOT_POINTER_CAPTURE, 'gotPointerCapture', ContinuousEvent], [TOP_LOAD, 'load', ContinuousEvent], [TOP_LOADED_DATA, 'loadedData', ContinuousEvent], [TOP_LOADED_METADATA, 'loadedMetadata', ContinuousEvent], [TOP_LOAD_START, 'loadStart', ContinuousEvent], [TOP_LOST_POINTER_CAPTURE, 'lostPointerCapture', ContinuousEvent], [TOP_PLAYING, 'playing', ContinuousEvent], [TOP_PROGRESS, 'progress', ContinuousEvent], [TOP_SEEKING, 'seeking', ContinuousEvent], [TOP_STALLED, 'stalled', ContinuousEvent], [TOP_SUSPEND, 'suspend', ContinuousEvent], [TOP_TIME_UPDATE, 'timeUpdate', ContinuousEvent], [TOP_TRANSITION_END, 'transitionEnd', ContinuousEvent], [TOP_WAITING, 'waiting', ContinuousEvent]];
       
  5781 
       
  5782 var eventTypes$4 = {};
       
  5783 var topLevelEventsToDispatchConfig = {};
       
  5784 
       
  5785 for (var i = 0; i < eventTuples.length; i++) {
       
  5786   var eventTuple = eventTuples[i];
       
  5787   var topEvent = eventTuple[0];
       
  5788   var event = eventTuple[1];
       
  5789   var eventPriority = eventTuple[2];
       
  5790 
       
  5791   var capitalizedEvent = event[0].toUpperCase() + event.slice(1);
       
  5792   var onEvent = 'on' + capitalizedEvent;
       
  5793 
       
  5794   var config = {
       
  5795     phasedRegistrationNames: {
       
  5796       bubbled: onEvent,
       
  5797       captured: onEvent + 'Capture'
       
  5798     },
       
  5799     dependencies: [topEvent],
       
  5800     eventPriority: eventPriority
       
  5801   };
       
  5802   eventTypes$4[event] = config;
       
  5803   topLevelEventsToDispatchConfig[topEvent] = config;
       
  5804 }
       
  5805 
       
  5806 // Only used in DEV for exhaustiveness validation.
       
  5807 var knownHTMLTopLevelTypes = [TOP_ABORT, TOP_CANCEL, TOP_CAN_PLAY, TOP_CAN_PLAY_THROUGH, TOP_CLOSE, TOP_DURATION_CHANGE, TOP_EMPTIED, TOP_ENCRYPTED, TOP_ENDED, TOP_ERROR, TOP_INPUT, TOP_INVALID, TOP_LOAD, TOP_LOADED_DATA, TOP_LOADED_METADATA, TOP_LOAD_START, TOP_PAUSE, TOP_PLAY, TOP_PLAYING, TOP_PROGRESS, TOP_RATE_CHANGE, TOP_RESET, TOP_SEEKED, TOP_SEEKING, TOP_STALLED, TOP_SUBMIT, TOP_SUSPEND, TOP_TIME_UPDATE, TOP_TOGGLE, TOP_VOLUME_CHANGE, TOP_WAITING];
       
  5808 
       
  5809 var SimpleEventPlugin = {
       
  5810   eventTypes: eventTypes$4,
       
  5811 
       
  5812   getEventPriority: function (topLevelType) {
       
  5813     var config = topLevelEventsToDispatchConfig[topLevelType];
       
  5814     return config !== undefined ? config.eventPriority : ContinuousEvent;
       
  5815   },
       
  5816 
       
  5817 
       
  5818   extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
       
  5819     var dispatchConfig = topLevelEventsToDispatchConfig[topLevelType];
       
  5820     if (!dispatchConfig) {
       
  5821       return null;
       
  5822     }
       
  5823     var EventConstructor = void 0;
       
  5824     switch (topLevelType) {
       
  5825       case TOP_KEY_PRESS:
       
  5826         // Firefox creates a keypress event for function keys too. This removes
       
  5827         // the unwanted keypress events. Enter is however both printable and
       
  5828         // non-printable. One would expect Tab to be as well (but it isn't).
       
  5829         if (getEventCharCode(nativeEvent) === 0) {
       
  5830           return null;
       
  5831         }
       
  5832       /* falls through */
       
  5833       case TOP_KEY_DOWN:
       
  5834       case TOP_KEY_UP:
       
  5835         EventConstructor = SyntheticKeyboardEvent;
       
  5836         break;
  3652         break;
  5837       case TOP_BLUR:
  3653       }
  5838       case TOP_FOCUS:
  3654 
  5839         EventConstructor = SyntheticFocusEvent;
  3655       var root = findRootContainerNode(ancestor);
       
  3656 
       
  3657       if (!root) {
  5840         break;
  3658         break;
  5841       case TOP_CLICK:
  3659       }
  5842         // Firefox creates a click event on right mouse clicks. This removes the
  3660 
  5843         // unwanted click events.
  3661       var tag = ancestor.tag;
  5844         if (nativeEvent.button === 2) {
  3662 
  5845           return null;
  3663       if (tag === HostComponent || tag === HostText) {
  5846         }
  3664         bookKeeping.ancestors.push(ancestor);
  5847       /* falls through */
  3665       }
  5848       case TOP_AUX_CLICK:
  3666 
  5849       case TOP_DOUBLE_CLICK:
  3667       ancestor = getClosestInstanceFromNode(root);
  5850       case TOP_MOUSE_DOWN:
  3668     } while (ancestor);
  5851       case TOP_MOUSE_MOVE:
  3669 
  5852       case TOP_MOUSE_UP:
  3670     for (var i = 0; i < bookKeeping.ancestors.length; i++) {
  5853       // TODO: Disabled elements should not respond to mouse events
  3671       targetInst = bookKeeping.ancestors[i];
  5854       /* falls through */
  3672       var eventTarget = getEventTarget(bookKeeping.nativeEvent);
  5855       case TOP_MOUSE_OUT:
  3673       var topLevelType = bookKeeping.topLevelType;
  5856       case TOP_MOUSE_OVER:
  3674       var nativeEvent = bookKeeping.nativeEvent;
  5857       case TOP_CONTEXT_MENU:
  3675       var eventSystemFlags = bookKeeping.eventSystemFlags; // If this is the first ancestor, we mark it on the system flags
  5858         EventConstructor = SyntheticMouseEvent;
  3676 
  5859         break;
  3677       if (i === 0) {
  5860       case TOP_DRAG:
  3678         eventSystemFlags |= IS_FIRST_ANCESTOR;
  5861       case TOP_DRAG_END:
  3679       }
  5862       case TOP_DRAG_ENTER:
  3680 
  5863       case TOP_DRAG_EXIT:
  3681       runExtractedPluginEventsInBatch(topLevelType, targetInst, nativeEvent, eventTarget, eventSystemFlags);
  5864       case TOP_DRAG_LEAVE:
  3682     }
  5865       case TOP_DRAG_OVER:
  3683   }
  5866       case TOP_DRAG_START:
  3684 
  5867       case TOP_DROP:
  3685   function dispatchEventForLegacyPluginEventSystem(topLevelType, eventSystemFlags, nativeEvent, targetInst) {
  5868         EventConstructor = SyntheticDragEvent;
  3686     var bookKeeping = getTopLevelCallbackBookKeeping(topLevelType, nativeEvent, targetInst, eventSystemFlags);
  5869         break;
  3687 
  5870       case TOP_TOUCH_CANCEL:
  3688     try {
  5871       case TOP_TOUCH_END:
  3689       // Event queue being processed in the same cycle allows
  5872       case TOP_TOUCH_MOVE:
  3690       // `preventDefault`.
  5873       case TOP_TOUCH_START:
  3691       batchedEventUpdates(handleTopLevel, bookKeeping);
  5874         EventConstructor = SyntheticTouchEvent;
  3692     } finally {
  5875         break;
  3693       releaseTopLevelCallbackBookKeeping(bookKeeping);
  5876       case TOP_ANIMATION_END:
  3694     }
  5877       case TOP_ANIMATION_ITERATION:
  3695   }
  5878       case TOP_ANIMATION_START:
  3696   /**
  5879         EventConstructor = SyntheticAnimationEvent;
  3697    * We listen for bubbled touch events on the document object.
  5880         break;
  3698    *
  5881       case TOP_TRANSITION_END:
  3699    * Firefox v8.01 (and possibly others) exhibited strange behavior when
  5882         EventConstructor = SyntheticTransitionEvent;
  3700    * mounting `onmousemove` events at some node that was not the document
  5883         break;
  3701    * element. The symptoms were that if your mouse is not moving over something
  5884       case TOP_SCROLL:
  3702    * contained within that mount point (for example on the background) the
  5885         EventConstructor = SyntheticUIEvent;
  3703    * top-level listeners for `onmousemove` won't be called. However, if you
  5886         break;
  3704    * register the `mousemove` on the document object, then it will of course
  5887       case TOP_WHEEL:
  3705    * catch all `mousemove`s. This along with iOS quirks, justifies restricting
  5888         EventConstructor = SyntheticWheelEvent;
  3706    * top-level listeners to the document object only, at least for these
  5889         break;
  3707    * movement types of events and possibly all events.
  5890       case TOP_COPY:
  3708    *
  5891       case TOP_CUT:
  3709    * @see http://www.quirksmode.org/blog/archives/2010/09/click_event_del.html
  5892       case TOP_PASTE:
  3710    *
  5893         EventConstructor = SyntheticClipboardEvent;
  3711    * Also, `keyup`/`keypress`/`keydown` do not bubble to the window on IE, but
  5894         break;
  3712    * they bubble to document.
  5895       case TOP_GOT_POINTER_CAPTURE:
  3713    *
  5896       case TOP_LOST_POINTER_CAPTURE:
  3714    * @param {string} registrationName Name of listener (e.g. `onClick`).
  5897       case TOP_POINTER_CANCEL:
  3715    * @param {object} mountAt Container where to mount the listener
  5898       case TOP_POINTER_DOWN:
  3716    */
  5899       case TOP_POINTER_MOVE:
  3717 
  5900       case TOP_POINTER_OUT:
  3718   function legacyListenToEvent(registrationName, mountAt) {
  5901       case TOP_POINTER_OVER:
  3719     var listenerMap = getListenerMapForElement(mountAt);
  5902       case TOP_POINTER_UP:
  3720     var dependencies = registrationNameDependencies[registrationName];
  5903         EventConstructor = SyntheticPointerEvent;
  3721 
  5904         break;
  3722     for (var i = 0; i < dependencies.length; i++) {
  5905       default:
  3723       var dependency = dependencies[i];
  5906         {
  3724       legacyListenToTopLevelEvent(dependency, mountAt, listenerMap);
  5907           if (knownHTMLTopLevelTypes.indexOf(topLevelType) === -1) {
  3725     }
  5908             warningWithoutStack$1(false, 'SimpleEventPlugin: Unhandled event type, `%s`. This warning ' + 'is likely caused by a bug in React. Please file an issue.', topLevelType);
  3726   }
  5909           }
  3727   function legacyListenToTopLevelEvent(topLevelType, mountAt, listenerMap) {
  5910         }
  3728     if (!listenerMap.has(topLevelType)) {
  5911         // HTML Events
  3729       switch (topLevelType) {
  5912         // @see http://www.w3.org/TR/html5/index.html#events-0
       
  5913         EventConstructor = SyntheticEvent;
       
  5914         break;
       
  5915     }
       
  5916     var event = EventConstructor.getPooled(dispatchConfig, targetInst, nativeEvent, nativeEventTarget);
       
  5917     accumulateTwoPhaseDispatches(event);
       
  5918     return event;
       
  5919   }
       
  5920 };
       
  5921 
       
  5922 var passiveBrowserEventsSupported = false;
       
  5923 
       
  5924 // Check if browser support events with passive listeners
       
  5925 // https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#Safely_detecting_option_support
       
  5926 if (enableFlareAPI && canUseDOM) {
       
  5927   try {
       
  5928     var options = {};
       
  5929     // $FlowFixMe: Ignore Flow complaining about needing a value
       
  5930     Object.defineProperty(options, 'passive', {
       
  5931       get: function () {
       
  5932         passiveBrowserEventsSupported = true;
       
  5933       }
       
  5934     });
       
  5935     window.addEventListener('test', options, options);
       
  5936     window.removeEventListener('test', options, options);
       
  5937   } catch (e) {
       
  5938     passiveBrowserEventsSupported = false;
       
  5939   }
       
  5940 }
       
  5941 
       
  5942 // Intentionally not named imports because Rollup would use dynamic dispatch for
       
  5943 // CommonJS interop named imports.
       
  5944 var UserBlockingPriority = unstable_UserBlockingPriority;
       
  5945 var runWithPriority = unstable_runWithPriority;
       
  5946 var getEventPriority = SimpleEventPlugin.getEventPriority;
       
  5947 
       
  5948 
       
  5949 var CALLBACK_BOOKKEEPING_POOL_SIZE = 10;
       
  5950 var callbackBookkeepingPool = [];
       
  5951 
       
  5952 /**
       
  5953  * Find the deepest React component completely containing the root of the
       
  5954  * passed-in instance (for use when entire React trees are nested within each
       
  5955  * other). If React trees are not nested, returns null.
       
  5956  */
       
  5957 function findRootContainerNode(inst) {
       
  5958   // TODO: It may be a good idea to cache this to prevent unnecessary DOM
       
  5959   // traversal, but caching is difficult to do correctly without using a
       
  5960   // mutation observer to listen for all DOM changes.
       
  5961   while (inst.return) {
       
  5962     inst = inst.return;
       
  5963   }
       
  5964   if (inst.tag !== HostRoot) {
       
  5965     // This can happen if we're in a detached tree.
       
  5966     return null;
       
  5967   }
       
  5968   return inst.stateNode.containerInfo;
       
  5969 }
       
  5970 
       
  5971 // Used to store ancestor hierarchy in top level callback
       
  5972 function getTopLevelCallbackBookKeeping(topLevelType, nativeEvent, targetInst) {
       
  5973   if (callbackBookkeepingPool.length) {
       
  5974     var instance = callbackBookkeepingPool.pop();
       
  5975     instance.topLevelType = topLevelType;
       
  5976     instance.nativeEvent = nativeEvent;
       
  5977     instance.targetInst = targetInst;
       
  5978     return instance;
       
  5979   }
       
  5980   return {
       
  5981     topLevelType: topLevelType,
       
  5982     nativeEvent: nativeEvent,
       
  5983     targetInst: targetInst,
       
  5984     ancestors: []
       
  5985   };
       
  5986 }
       
  5987 
       
  5988 function releaseTopLevelCallbackBookKeeping(instance) {
       
  5989   instance.topLevelType = null;
       
  5990   instance.nativeEvent = null;
       
  5991   instance.targetInst = null;
       
  5992   instance.ancestors.length = 0;
       
  5993   if (callbackBookkeepingPool.length < CALLBACK_BOOKKEEPING_POOL_SIZE) {
       
  5994     callbackBookkeepingPool.push(instance);
       
  5995   }
       
  5996 }
       
  5997 
       
  5998 function handleTopLevel(bookKeeping) {
       
  5999   var targetInst = bookKeeping.targetInst;
       
  6000 
       
  6001   // Loop through the hierarchy, in case there's any nested components.
       
  6002   // It's important that we build the array of ancestors before calling any
       
  6003   // event handlers, because event handlers can modify the DOM, leading to
       
  6004   // inconsistencies with ReactMount's node cache. See #1105.
       
  6005   var ancestor = targetInst;
       
  6006   do {
       
  6007     if (!ancestor) {
       
  6008       var _ancestors = bookKeeping.ancestors;
       
  6009       _ancestors.push(ancestor);
       
  6010       break;
       
  6011     }
       
  6012     var root = findRootContainerNode(ancestor);
       
  6013     if (!root) {
       
  6014       break;
       
  6015     }
       
  6016     bookKeeping.ancestors.push(ancestor);
       
  6017     ancestor = getClosestInstanceFromNode(root);
       
  6018   } while (ancestor);
       
  6019 
       
  6020   for (var i = 0; i < bookKeeping.ancestors.length; i++) {
       
  6021     targetInst = bookKeeping.ancestors[i];
       
  6022     var eventTarget = getEventTarget(bookKeeping.nativeEvent);
       
  6023     var _topLevelType = bookKeeping.topLevelType;
       
  6024     var _nativeEvent = bookKeeping.nativeEvent;
       
  6025 
       
  6026     runExtractedPluginEventsInBatch(_topLevelType, targetInst, _nativeEvent, eventTarget);
       
  6027   }
       
  6028 }
       
  6029 
       
  6030 // TODO: can we stop exporting these?
       
  6031 var _enabled = true;
       
  6032 
       
  6033 function setEnabled(enabled) {
       
  6034   _enabled = !!enabled;
       
  6035 }
       
  6036 
       
  6037 function isEnabled() {
       
  6038   return _enabled;
       
  6039 }
       
  6040 
       
  6041 function trapBubbledEvent(topLevelType, element) {
       
  6042   trapEventForPluginEventSystem(element, topLevelType, false);
       
  6043 }
       
  6044 
       
  6045 function trapCapturedEvent(topLevelType, element) {
       
  6046   trapEventForPluginEventSystem(element, topLevelType, true);
       
  6047 }
       
  6048 
       
  6049 function trapEventForResponderEventSystem(element, topLevelType, passive) {
       
  6050   if (enableFlareAPI) {
       
  6051     var rawEventName = getRawEventName(topLevelType);
       
  6052     var eventFlags = RESPONDER_EVENT_SYSTEM;
       
  6053 
       
  6054     // If passive option is not supported, then the event will be
       
  6055     // active and not passive, but we flag it as using not being
       
  6056     // supported too. This way the responder event plugins know,
       
  6057     // and can provide polyfills if needed.
       
  6058     if (passive) {
       
  6059       if (passiveBrowserEventsSupported) {
       
  6060         eventFlags |= IS_PASSIVE;
       
  6061       } else {
       
  6062         eventFlags |= IS_ACTIVE;
       
  6063         eventFlags |= PASSIVE_NOT_SUPPORTED;
       
  6064         passive = false;
       
  6065       }
       
  6066     } else {
       
  6067       eventFlags |= IS_ACTIVE;
       
  6068     }
       
  6069     // Check if interactive and wrap in discreteUpdates
       
  6070     var listener = dispatchEvent.bind(null, topLevelType, eventFlags);
       
  6071     if (passiveBrowserEventsSupported) {
       
  6072       addEventCaptureListenerWithPassiveFlag(element, rawEventName, listener, passive);
       
  6073     } else {
       
  6074       addEventCaptureListener(element, rawEventName, listener);
       
  6075     }
       
  6076   }
       
  6077 }
       
  6078 
       
  6079 function trapEventForPluginEventSystem(element, topLevelType, capture) {
       
  6080   var listener = void 0;
       
  6081   switch (getEventPriority(topLevelType)) {
       
  6082     case DiscreteEvent:
       
  6083       listener = dispatchDiscreteEvent.bind(null, topLevelType, PLUGIN_EVENT_SYSTEM);
       
  6084       break;
       
  6085     case UserBlockingEvent:
       
  6086       listener = dispatchUserBlockingUpdate.bind(null, topLevelType, PLUGIN_EVENT_SYSTEM);
       
  6087       break;
       
  6088     case ContinuousEvent:
       
  6089     default:
       
  6090       listener = dispatchEvent.bind(null, topLevelType, PLUGIN_EVENT_SYSTEM);
       
  6091       break;
       
  6092   }
       
  6093 
       
  6094   var rawEventName = getRawEventName(topLevelType);
       
  6095   if (capture) {
       
  6096     addEventCaptureListener(element, rawEventName, listener);
       
  6097   } else {
       
  6098     addEventBubbleListener(element, rawEventName, listener);
       
  6099   }
       
  6100 }
       
  6101 
       
  6102 function dispatchDiscreteEvent(topLevelType, eventSystemFlags, nativeEvent) {
       
  6103   flushDiscreteUpdatesIfNeeded(nativeEvent.timeStamp);
       
  6104   discreteUpdates(dispatchEvent, topLevelType, eventSystemFlags, nativeEvent);
       
  6105 }
       
  6106 
       
  6107 function dispatchUserBlockingUpdate(topLevelType, eventSystemFlags, nativeEvent) {
       
  6108   if (enableUserBlockingEvents) {
       
  6109     runWithPriority(UserBlockingPriority, dispatchEvent.bind(null, topLevelType, eventSystemFlags, nativeEvent));
       
  6110   } else {
       
  6111     dispatchEvent(topLevelType, eventSystemFlags, nativeEvent);
       
  6112   }
       
  6113 }
       
  6114 
       
  6115 function dispatchEventForPluginEventSystem(topLevelType, eventSystemFlags, nativeEvent, targetInst) {
       
  6116   var bookKeeping = getTopLevelCallbackBookKeeping(topLevelType, nativeEvent, targetInst);
       
  6117 
       
  6118   try {
       
  6119     // Event queue being processed in the same cycle allows
       
  6120     // `preventDefault`.
       
  6121     batchedEventUpdates(handleTopLevel, bookKeeping);
       
  6122   } finally {
       
  6123     releaseTopLevelCallbackBookKeeping(bookKeeping);
       
  6124   }
       
  6125 }
       
  6126 
       
  6127 function dispatchEvent(topLevelType, eventSystemFlags, nativeEvent) {
       
  6128   if (!_enabled) {
       
  6129     return;
       
  6130   }
       
  6131   var nativeEventTarget = getEventTarget(nativeEvent);
       
  6132   var targetInst = getClosestInstanceFromNode(nativeEventTarget);
       
  6133 
       
  6134   if (targetInst !== null && typeof targetInst.tag === 'number' && !isFiberMounted(targetInst)) {
       
  6135     // If we get an event (ex: img onload) before committing that
       
  6136     // component's mount, ignore it for now (that is, treat it as if it was an
       
  6137     // event on a non-React tree). We might also consider queueing events and
       
  6138     // dispatching them after the mount.
       
  6139     targetInst = null;
       
  6140   }
       
  6141 
       
  6142   if (enableFlareAPI) {
       
  6143     if (eventSystemFlags === PLUGIN_EVENT_SYSTEM) {
       
  6144       dispatchEventForPluginEventSystem(topLevelType, eventSystemFlags, nativeEvent, targetInst);
       
  6145     } else {
       
  6146       // React Flare event system
       
  6147       dispatchEventForResponderEventSystem(topLevelType, targetInst, nativeEvent, nativeEventTarget, eventSystemFlags);
       
  6148     }
       
  6149   } else {
       
  6150     dispatchEventForPluginEventSystem(topLevelType, eventSystemFlags, nativeEvent, targetInst);
       
  6151   }
       
  6152 }
       
  6153 
       
  6154 /**
       
  6155  * Summary of `ReactBrowserEventEmitter` event handling:
       
  6156  *
       
  6157  *  - Top-level delegation is used to trap most native browser events. This
       
  6158  *    may only occur in the main thread and is the responsibility of
       
  6159  *    ReactDOMEventListener, which is injected and can therefore support
       
  6160  *    pluggable event sources. This is the only work that occurs in the main
       
  6161  *    thread.
       
  6162  *
       
  6163  *  - We normalize and de-duplicate events to account for browser quirks. This
       
  6164  *    may be done in the worker thread.
       
  6165  *
       
  6166  *  - Forward these native events (with the associated top-level type used to
       
  6167  *    trap it) to `EventPluginHub`, which in turn will ask plugins if they want
       
  6168  *    to extract any synthetic events.
       
  6169  *
       
  6170  *  - The `EventPluginHub` will then process each event by annotating them with
       
  6171  *    "dispatches", a sequence of listeners and IDs that care about that event.
       
  6172  *
       
  6173  *  - The `EventPluginHub` then dispatches the events.
       
  6174  *
       
  6175  * Overview of React and the event system:
       
  6176  *
       
  6177  * +------------+    .
       
  6178  * |    DOM     |    .
       
  6179  * +------------+    .
       
  6180  *       |           .
       
  6181  *       v           .
       
  6182  * +------------+    .
       
  6183  * | ReactEvent |    .
       
  6184  * |  Listener  |    .
       
  6185  * +------------+    .                         +-----------+
       
  6186  *       |           .               +--------+|SimpleEvent|
       
  6187  *       |           .               |         |Plugin     |
       
  6188  * +-----|------+    .               v         +-----------+
       
  6189  * |     |      |    .    +--------------+                    +------------+
       
  6190  * |     +-----------.--->|EventPluginHub|                    |    Event   |
       
  6191  * |            |    .    |              |     +-----------+  | Propagators|
       
  6192  * | ReactEvent |    .    |              |     |TapEvent   |  |------------|
       
  6193  * |  Emitter   |    .    |              |<---+|Plugin     |  |other plugin|
       
  6194  * |            |    .    |              |     +-----------+  |  utilities |
       
  6195  * |     +-----------.--->|              |                    +------------+
       
  6196  * |     |      |    .    +--------------+
       
  6197  * +-----|------+    .                ^        +-----------+
       
  6198  *       |           .                |        |Enter/Leave|
       
  6199  *       +           .                +-------+|Plugin     |
       
  6200  * +-------------+   .                         +-----------+
       
  6201  * | application |   .
       
  6202  * |-------------|   .
       
  6203  * |             |   .
       
  6204  * |             |   .
       
  6205  * +-------------+   .
       
  6206  *                   .
       
  6207  *    React Core     .  General Purpose Event Plugin System
       
  6208  */
       
  6209 
       
  6210 var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map;
       
  6211 var elementListeningSets = new PossiblyWeakMap();
       
  6212 
       
  6213 function getListeningSetForElement(element) {
       
  6214   var listeningSet = elementListeningSets.get(element);
       
  6215   if (listeningSet === undefined) {
       
  6216     listeningSet = new Set();
       
  6217     elementListeningSets.set(element, listeningSet);
       
  6218   }
       
  6219   return listeningSet;
       
  6220 }
       
  6221 
       
  6222 /**
       
  6223  * We listen for bubbled touch events on the document object.
       
  6224  *
       
  6225  * Firefox v8.01 (and possibly others) exhibited strange behavior when
       
  6226  * mounting `onmousemove` events at some node that was not the document
       
  6227  * element. The symptoms were that if your mouse is not moving over something
       
  6228  * contained within that mount point (for example on the background) the
       
  6229  * top-level listeners for `onmousemove` won't be called. However, if you
       
  6230  * register the `mousemove` on the document object, then it will of course
       
  6231  * catch all `mousemove`s. This along with iOS quirks, justifies restricting
       
  6232  * top-level listeners to the document object only, at least for these
       
  6233  * movement types of events and possibly all events.
       
  6234  *
       
  6235  * @see http://www.quirksmode.org/blog/archives/2010/09/click_event_del.html
       
  6236  *
       
  6237  * Also, `keyup`/`keypress`/`keydown` do not bubble to the window on IE, but
       
  6238  * they bubble to document.
       
  6239  *
       
  6240  * @param {string} registrationName Name of listener (e.g. `onClick`).
       
  6241  * @param {object} mountAt Container where to mount the listener
       
  6242  */
       
  6243 function listenTo(registrationName, mountAt) {
       
  6244   var listeningSet = getListeningSetForElement(mountAt);
       
  6245   var dependencies = registrationNameDependencies[registrationName];
       
  6246 
       
  6247   for (var i = 0; i < dependencies.length; i++) {
       
  6248     var dependency = dependencies[i];
       
  6249     if (!listeningSet.has(dependency)) {
       
  6250       switch (dependency) {
       
  6251         case TOP_SCROLL:
  3730         case TOP_SCROLL:
  6252           trapCapturedEvent(TOP_SCROLL, mountAt);
  3731           trapCapturedEvent(TOP_SCROLL, mountAt);
  6253           break;
  3732           break;
       
  3733 
  6254         case TOP_FOCUS:
  3734         case TOP_FOCUS:
  6255         case TOP_BLUR:
  3735         case TOP_BLUR:
  6256           trapCapturedEvent(TOP_FOCUS, mountAt);
  3736           trapCapturedEvent(TOP_FOCUS, mountAt);
  6257           trapCapturedEvent(TOP_BLUR, mountAt);
  3737           trapCapturedEvent(TOP_BLUR, mountAt); // We set the flag for a single dependency later in this function,
  6258           // We set the flag for a single dependency later in this function,
       
  6259           // but this ensures we mark both as attached rather than just one.
  3738           // but this ensures we mark both as attached rather than just one.
  6260           listeningSet.add(TOP_BLUR);
  3739 
  6261           listeningSet.add(TOP_FOCUS);
  3740           listenerMap.set(TOP_BLUR, null);
       
  3741           listenerMap.set(TOP_FOCUS, null);
  6262           break;
  3742           break;
       
  3743 
  6263         case TOP_CANCEL:
  3744         case TOP_CANCEL:
  6264         case TOP_CLOSE:
  3745         case TOP_CLOSE:
  6265           if (isEventSupported(getRawEventName(dependency))) {
  3746           if (isEventSupported(getRawEventName(topLevelType))) {
  6266             trapCapturedEvent(dependency, mountAt);
  3747             trapCapturedEvent(topLevelType, mountAt);
  6267           }
  3748           }
       
  3749 
  6268           break;
  3750           break;
       
  3751 
  6269         case TOP_INVALID:
  3752         case TOP_INVALID:
  6270         case TOP_SUBMIT:
  3753         case TOP_SUBMIT:
  6271         case TOP_RESET:
  3754         case TOP_RESET:
  6272           // We listen to them on the target DOM elements.
  3755           // We listen to them on the target DOM elements.
  6273           // Some of them bubble so we don't want them to fire twice.
  3756           // Some of them bubble so we don't want them to fire twice.
  6274           break;
  3757           break;
       
  3758 
  6275         default:
  3759         default:
  6276           // By default, listen on the top level to all non-media events.
  3760           // By default, listen on the top level to all non-media events.
  6277           // Media events don't bubble so adding the listener wouldn't do anything.
  3761           // Media events don't bubble so adding the listener wouldn't do anything.
  6278           var isMediaEvent = mediaEventTypes.indexOf(dependency) !== -1;
  3762           var isMediaEvent = mediaEventTypes.indexOf(topLevelType) !== -1;
       
  3763 
  6279           if (!isMediaEvent) {
  3764           if (!isMediaEvent) {
  6280             trapBubbledEvent(dependency, mountAt);
  3765             trapBubbledEvent(topLevelType, mountAt);
  6281           }
  3766           }
       
  3767 
  6282           break;
  3768           break;
  6283       }
  3769       }
  6284       listeningSet.add(dependency);
  3770 
  6285     }
  3771       listenerMap.set(topLevelType, null);
  6286   }
  3772     }
  6287 }
  3773   }
  6288 
  3774   function isListeningToAllDependencies(registrationName, mountAt) {
  6289 function isListeningToAllDependencies(registrationName, mountAt) {
  3775     var listenerMap = getListenerMapForElement(mountAt);
  6290   var listeningSet = getListeningSetForElement(mountAt);
  3776     var dependencies = registrationNameDependencies[registrationName];
  6291   var dependencies = registrationNameDependencies[registrationName];
  3777 
  6292 
  3778     for (var i = 0; i < dependencies.length; i++) {
  6293   for (var i = 0; i < dependencies.length; i++) {
  3779       var dependency = dependencies[i];
  6294     var dependency = dependencies[i];
  3780 
  6295     if (!listeningSet.has(dependency)) {
  3781       if (!listenerMap.has(dependency)) {
       
  3782         return false;
       
  3783       }
       
  3784     }
       
  3785 
       
  3786     return true;
       
  3787   }
       
  3788 
       
  3789   var attemptUserBlockingHydration;
       
  3790   function setAttemptUserBlockingHydration(fn) {
       
  3791     attemptUserBlockingHydration = fn;
       
  3792   }
       
  3793   var attemptContinuousHydration;
       
  3794   function setAttemptContinuousHydration(fn) {
       
  3795     attemptContinuousHydration = fn;
       
  3796   }
       
  3797   var attemptHydrationAtCurrentPriority;
       
  3798   function setAttemptHydrationAtCurrentPriority(fn) {
       
  3799     attemptHydrationAtCurrentPriority = fn;
       
  3800   } // TODO: Upgrade this definition once we're on a newer version of Flow that
       
  3801   var hasScheduledReplayAttempt = false; // The queue of discrete events to be replayed.
       
  3802 
       
  3803   var queuedDiscreteEvents = []; // Indicates if any continuous event targets are non-null for early bailout.
       
  3804   // if the last target was dehydrated.
       
  3805 
       
  3806   var queuedFocus = null;
       
  3807   var queuedDrag = null;
       
  3808   var queuedMouse = null; // For pointer events there can be one latest event per pointerId.
       
  3809 
       
  3810   var queuedPointers = new Map();
       
  3811   var queuedPointerCaptures = new Map(); // We could consider replaying selectionchange and touchmoves too.
       
  3812 
       
  3813   var queuedExplicitHydrationTargets = [];
       
  3814   function hasQueuedDiscreteEvents() {
       
  3815     return queuedDiscreteEvents.length > 0;
       
  3816   }
       
  3817   var discreteReplayableEvents = [TOP_MOUSE_DOWN, TOP_MOUSE_UP, TOP_TOUCH_CANCEL, TOP_TOUCH_END, TOP_TOUCH_START, TOP_AUX_CLICK, TOP_DOUBLE_CLICK, TOP_POINTER_CANCEL, TOP_POINTER_DOWN, TOP_POINTER_UP, TOP_DRAG_END, TOP_DRAG_START, TOP_DROP, TOP_COMPOSITION_END, TOP_COMPOSITION_START, TOP_KEY_DOWN, TOP_KEY_PRESS, TOP_KEY_UP, TOP_INPUT, TOP_TEXT_INPUT, TOP_CLOSE, TOP_CANCEL, TOP_COPY, TOP_CUT, TOP_PASTE, TOP_CLICK, TOP_CHANGE, TOP_CONTEXT_MENU, TOP_RESET, TOP_SUBMIT];
       
  3818   var continuousReplayableEvents = [TOP_FOCUS, TOP_BLUR, TOP_DRAG_ENTER, TOP_DRAG_LEAVE, TOP_MOUSE_OVER, TOP_MOUSE_OUT, TOP_POINTER_OVER, TOP_POINTER_OUT, TOP_GOT_POINTER_CAPTURE, TOP_LOST_POINTER_CAPTURE];
       
  3819   function isReplayableDiscreteEvent(eventType) {
       
  3820     return discreteReplayableEvents.indexOf(eventType) > -1;
       
  3821   }
       
  3822 
       
  3823   function trapReplayableEventForDocument(topLevelType, document, listenerMap) {
       
  3824     legacyListenToTopLevelEvent(topLevelType, document, listenerMap);
       
  3825   }
       
  3826 
       
  3827   function eagerlyTrapReplayableEvents(container, document) {
       
  3828     var listenerMapForDoc = getListenerMapForElement(document); // Discrete
       
  3829 
       
  3830     discreteReplayableEvents.forEach(function (topLevelType) {
       
  3831       trapReplayableEventForDocument(topLevelType, document, listenerMapForDoc);
       
  3832     }); // Continuous
       
  3833 
       
  3834     continuousReplayableEvents.forEach(function (topLevelType) {
       
  3835       trapReplayableEventForDocument(topLevelType, document, listenerMapForDoc);
       
  3836     });
       
  3837   }
       
  3838 
       
  3839   function createQueuedReplayableEvent(blockedOn, topLevelType, eventSystemFlags, container, nativeEvent) {
       
  3840     return {
       
  3841       blockedOn: blockedOn,
       
  3842       topLevelType: topLevelType,
       
  3843       eventSystemFlags: eventSystemFlags | IS_REPLAYED,
       
  3844       nativeEvent: nativeEvent,
       
  3845       container: container
       
  3846     };
       
  3847   }
       
  3848 
       
  3849   function queueDiscreteEvent(blockedOn, topLevelType, eventSystemFlags, container, nativeEvent) {
       
  3850     var queuedEvent = createQueuedReplayableEvent(blockedOn, topLevelType, eventSystemFlags, container, nativeEvent);
       
  3851     queuedDiscreteEvents.push(queuedEvent);
       
  3852   } // Resets the replaying for this type of continuous event to no event.
       
  3853 
       
  3854   function clearIfContinuousEvent(topLevelType, nativeEvent) {
       
  3855     switch (topLevelType) {
       
  3856       case TOP_FOCUS:
       
  3857       case TOP_BLUR:
       
  3858         queuedFocus = null;
       
  3859         break;
       
  3860 
       
  3861       case TOP_DRAG_ENTER:
       
  3862       case TOP_DRAG_LEAVE:
       
  3863         queuedDrag = null;
       
  3864         break;
       
  3865 
       
  3866       case TOP_MOUSE_OVER:
       
  3867       case TOP_MOUSE_OUT:
       
  3868         queuedMouse = null;
       
  3869         break;
       
  3870 
       
  3871       case TOP_POINTER_OVER:
       
  3872       case TOP_POINTER_OUT:
       
  3873         {
       
  3874           var pointerId = nativeEvent.pointerId;
       
  3875           queuedPointers.delete(pointerId);
       
  3876           break;
       
  3877         }
       
  3878 
       
  3879       case TOP_GOT_POINTER_CAPTURE:
       
  3880       case TOP_LOST_POINTER_CAPTURE:
       
  3881         {
       
  3882           var _pointerId = nativeEvent.pointerId;
       
  3883           queuedPointerCaptures.delete(_pointerId);
       
  3884           break;
       
  3885         }
       
  3886     }
       
  3887   }
       
  3888 
       
  3889   function accumulateOrCreateContinuousQueuedReplayableEvent(existingQueuedEvent, blockedOn, topLevelType, eventSystemFlags, container, nativeEvent) {
       
  3890     if (existingQueuedEvent === null || existingQueuedEvent.nativeEvent !== nativeEvent) {
       
  3891       var queuedEvent = createQueuedReplayableEvent(blockedOn, topLevelType, eventSystemFlags, container, nativeEvent);
       
  3892 
       
  3893       if (blockedOn !== null) {
       
  3894         var _fiber2 = getInstanceFromNode$1(blockedOn);
       
  3895 
       
  3896         if (_fiber2 !== null) {
       
  3897           // Attempt to increase the priority of this target.
       
  3898           attemptContinuousHydration(_fiber2);
       
  3899         }
       
  3900       }
       
  3901 
       
  3902       return queuedEvent;
       
  3903     } // If we have already queued this exact event, then it's because
       
  3904     // the different event systems have different DOM event listeners.
       
  3905     // We can accumulate the flags and store a single event to be
       
  3906     // replayed.
       
  3907 
       
  3908 
       
  3909     existingQueuedEvent.eventSystemFlags |= eventSystemFlags;
       
  3910     return existingQueuedEvent;
       
  3911   }
       
  3912 
       
  3913   function queueIfContinuousEvent(blockedOn, topLevelType, eventSystemFlags, container, nativeEvent) {
       
  3914     // These set relatedTarget to null because the replayed event will be treated as if we
       
  3915     // moved from outside the window (no target) onto the target once it hydrates.
       
  3916     // Instead of mutating we could clone the event.
       
  3917     switch (topLevelType) {
       
  3918       case TOP_FOCUS:
       
  3919         {
       
  3920           var focusEvent = nativeEvent;
       
  3921           queuedFocus = accumulateOrCreateContinuousQueuedReplayableEvent(queuedFocus, blockedOn, topLevelType, eventSystemFlags, container, focusEvent);
       
  3922           return true;
       
  3923         }
       
  3924 
       
  3925       case TOP_DRAG_ENTER:
       
  3926         {
       
  3927           var dragEvent = nativeEvent;
       
  3928           queuedDrag = accumulateOrCreateContinuousQueuedReplayableEvent(queuedDrag, blockedOn, topLevelType, eventSystemFlags, container, dragEvent);
       
  3929           return true;
       
  3930         }
       
  3931 
       
  3932       case TOP_MOUSE_OVER:
       
  3933         {
       
  3934           var mouseEvent = nativeEvent;
       
  3935           queuedMouse = accumulateOrCreateContinuousQueuedReplayableEvent(queuedMouse, blockedOn, topLevelType, eventSystemFlags, container, mouseEvent);
       
  3936           return true;
       
  3937         }
       
  3938 
       
  3939       case TOP_POINTER_OVER:
       
  3940         {
       
  3941           var pointerEvent = nativeEvent;
       
  3942           var pointerId = pointerEvent.pointerId;
       
  3943           queuedPointers.set(pointerId, accumulateOrCreateContinuousQueuedReplayableEvent(queuedPointers.get(pointerId) || null, blockedOn, topLevelType, eventSystemFlags, container, pointerEvent));
       
  3944           return true;
       
  3945         }
       
  3946 
       
  3947       case TOP_GOT_POINTER_CAPTURE:
       
  3948         {
       
  3949           var _pointerEvent = nativeEvent;
       
  3950           var _pointerId2 = _pointerEvent.pointerId;
       
  3951           queuedPointerCaptures.set(_pointerId2, accumulateOrCreateContinuousQueuedReplayableEvent(queuedPointerCaptures.get(_pointerId2) || null, blockedOn, topLevelType, eventSystemFlags, container, _pointerEvent));
       
  3952           return true;
       
  3953         }
       
  3954     }
       
  3955 
       
  3956     return false;
       
  3957   } // Check if this target is unblocked. Returns true if it's unblocked.
       
  3958 
       
  3959   function attemptExplicitHydrationTarget(queuedTarget) {
       
  3960     // TODO: This function shares a lot of logic with attemptToDispatchEvent.
       
  3961     // Try to unify them. It's a bit tricky since it would require two return
       
  3962     // values.
       
  3963     var targetInst = getClosestInstanceFromNode(queuedTarget.target);
       
  3964 
       
  3965     if (targetInst !== null) {
       
  3966       var nearestMounted = getNearestMountedFiber(targetInst);
       
  3967 
       
  3968       if (nearestMounted !== null) {
       
  3969         var tag = nearestMounted.tag;
       
  3970 
       
  3971         if (tag === SuspenseComponent) {
       
  3972           var instance = getSuspenseInstanceFromFiber(nearestMounted);
       
  3973 
       
  3974           if (instance !== null) {
       
  3975             // We're blocked on hydrating this boundary.
       
  3976             // Increase its priority.
       
  3977             queuedTarget.blockedOn = instance;
       
  3978             unstable_runWithPriority(queuedTarget.priority, function () {
       
  3979               attemptHydrationAtCurrentPriority(nearestMounted);
       
  3980             });
       
  3981             return;
       
  3982           }
       
  3983         } else if (tag === HostRoot) {
       
  3984           var root = nearestMounted.stateNode;
       
  3985 
       
  3986           if (root.hydrate) {
       
  3987             queuedTarget.blockedOn = getContainerFromFiber(nearestMounted); // We don't currently have a way to increase the priority of
       
  3988             // a root other than sync.
       
  3989 
       
  3990             return;
       
  3991           }
       
  3992         }
       
  3993       }
       
  3994     }
       
  3995 
       
  3996     queuedTarget.blockedOn = null;
       
  3997   }
       
  3998 
       
  3999   function attemptReplayContinuousQueuedEvent(queuedEvent) {
       
  4000     if (queuedEvent.blockedOn !== null) {
  6296       return false;
  4001       return false;
  6297     }
  4002     }
  6298   }
  4003 
  6299   return true;
  4004     var nextBlockedOn = attemptToDispatchEvent(queuedEvent.topLevelType, queuedEvent.eventSystemFlags, queuedEvent.container, queuedEvent.nativeEvent);
  6300 }
  4005 
  6301 
  4006     if (nextBlockedOn !== null) {
  6302 function getActiveElement(doc) {
  4007       // We're still blocked. Try again later.
  6303   doc = doc || (typeof document !== 'undefined' ? document : undefined);
  4008       var _fiber3 = getInstanceFromNode$1(nextBlockedOn);
  6304   if (typeof doc === 'undefined') {
  4009 
       
  4010       if (_fiber3 !== null) {
       
  4011         attemptContinuousHydration(_fiber3);
       
  4012       }
       
  4013 
       
  4014       queuedEvent.blockedOn = nextBlockedOn;
       
  4015       return false;
       
  4016     }
       
  4017 
       
  4018     return true;
       
  4019   }
       
  4020 
       
  4021   function attemptReplayContinuousQueuedEventInMap(queuedEvent, key, map) {
       
  4022     if (attemptReplayContinuousQueuedEvent(queuedEvent)) {
       
  4023       map.delete(key);
       
  4024     }
       
  4025   }
       
  4026 
       
  4027   function replayUnblockedEvents() {
       
  4028     hasScheduledReplayAttempt = false; // First replay discrete events.
       
  4029 
       
  4030     while (queuedDiscreteEvents.length > 0) {
       
  4031       var nextDiscreteEvent = queuedDiscreteEvents[0];
       
  4032 
       
  4033       if (nextDiscreteEvent.blockedOn !== null) {
       
  4034         // We're still blocked.
       
  4035         // Increase the priority of this boundary to unblock
       
  4036         // the next discrete event.
       
  4037         var _fiber4 = getInstanceFromNode$1(nextDiscreteEvent.blockedOn);
       
  4038 
       
  4039         if (_fiber4 !== null) {
       
  4040           attemptUserBlockingHydration(_fiber4);
       
  4041         }
       
  4042 
       
  4043         break;
       
  4044       }
       
  4045 
       
  4046       var nextBlockedOn = attemptToDispatchEvent(nextDiscreteEvent.topLevelType, nextDiscreteEvent.eventSystemFlags, nextDiscreteEvent.container, nextDiscreteEvent.nativeEvent);
       
  4047 
       
  4048       if (nextBlockedOn !== null) {
       
  4049         // We're still blocked. Try again later.
       
  4050         nextDiscreteEvent.blockedOn = nextBlockedOn;
       
  4051       } else {
       
  4052         // We've successfully replayed the first event. Let's try the next one.
       
  4053         queuedDiscreteEvents.shift();
       
  4054       }
       
  4055     } // Next replay any continuous events.
       
  4056 
       
  4057 
       
  4058     if (queuedFocus !== null && attemptReplayContinuousQueuedEvent(queuedFocus)) {
       
  4059       queuedFocus = null;
       
  4060     }
       
  4061 
       
  4062     if (queuedDrag !== null && attemptReplayContinuousQueuedEvent(queuedDrag)) {
       
  4063       queuedDrag = null;
       
  4064     }
       
  4065 
       
  4066     if (queuedMouse !== null && attemptReplayContinuousQueuedEvent(queuedMouse)) {
       
  4067       queuedMouse = null;
       
  4068     }
       
  4069 
       
  4070     queuedPointers.forEach(attemptReplayContinuousQueuedEventInMap);
       
  4071     queuedPointerCaptures.forEach(attemptReplayContinuousQueuedEventInMap);
       
  4072   }
       
  4073 
       
  4074   function scheduleCallbackIfUnblocked(queuedEvent, unblocked) {
       
  4075     if (queuedEvent.blockedOn === unblocked) {
       
  4076       queuedEvent.blockedOn = null;
       
  4077 
       
  4078       if (!hasScheduledReplayAttempt) {
       
  4079         hasScheduledReplayAttempt = true; // Schedule a callback to attempt replaying as many events as are
       
  4080         // now unblocked. This first might not actually be unblocked yet.
       
  4081         // We could check it early to avoid scheduling an unnecessary callback.
       
  4082 
       
  4083         unstable_scheduleCallback(unstable_NormalPriority, replayUnblockedEvents);
       
  4084       }
       
  4085     }
       
  4086   }
       
  4087 
       
  4088   function retryIfBlockedOn(unblocked) {
       
  4089     // Mark anything that was blocked on this as no longer blocked
       
  4090     // and eligible for a replay.
       
  4091     if (queuedDiscreteEvents.length > 0) {
       
  4092       scheduleCallbackIfUnblocked(queuedDiscreteEvents[0], unblocked); // This is a exponential search for each boundary that commits. I think it's
       
  4093       // worth it because we expect very few discrete events to queue up and once
       
  4094       // we are actually fully unblocked it will be fast to replay them.
       
  4095 
       
  4096       for (var i = 1; i < queuedDiscreteEvents.length; i++) {
       
  4097         var queuedEvent = queuedDiscreteEvents[i];
       
  4098 
       
  4099         if (queuedEvent.blockedOn === unblocked) {
       
  4100           queuedEvent.blockedOn = null;
       
  4101         }
       
  4102       }
       
  4103     }
       
  4104 
       
  4105     if (queuedFocus !== null) {
       
  4106       scheduleCallbackIfUnblocked(queuedFocus, unblocked);
       
  4107     }
       
  4108 
       
  4109     if (queuedDrag !== null) {
       
  4110       scheduleCallbackIfUnblocked(queuedDrag, unblocked);
       
  4111     }
       
  4112 
       
  4113     if (queuedMouse !== null) {
       
  4114       scheduleCallbackIfUnblocked(queuedMouse, unblocked);
       
  4115     }
       
  4116 
       
  4117     var unblock = function (queuedEvent) {
       
  4118       return scheduleCallbackIfUnblocked(queuedEvent, unblocked);
       
  4119     };
       
  4120 
       
  4121     queuedPointers.forEach(unblock);
       
  4122     queuedPointerCaptures.forEach(unblock);
       
  4123 
       
  4124     for (var _i = 0; _i < queuedExplicitHydrationTargets.length; _i++) {
       
  4125       var queuedTarget = queuedExplicitHydrationTargets[_i];
       
  4126 
       
  4127       if (queuedTarget.blockedOn === unblocked) {
       
  4128         queuedTarget.blockedOn = null;
       
  4129       }
       
  4130     }
       
  4131 
       
  4132     while (queuedExplicitHydrationTargets.length > 0) {
       
  4133       var nextExplicitTarget = queuedExplicitHydrationTargets[0];
       
  4134 
       
  4135       if (nextExplicitTarget.blockedOn !== null) {
       
  4136         // We're still blocked.
       
  4137         break;
       
  4138       } else {
       
  4139         attemptExplicitHydrationTarget(nextExplicitTarget);
       
  4140 
       
  4141         if (nextExplicitTarget.blockedOn === null) {
       
  4142           // We're unblocked.
       
  4143           queuedExplicitHydrationTargets.shift();
       
  4144         }
       
  4145       }
       
  4146     }
       
  4147   }
       
  4148 
       
  4149   function addEventBubbleListener(element, eventType, listener) {
       
  4150     element.addEventListener(eventType, listener, false);
       
  4151   }
       
  4152   function addEventCaptureListener(element, eventType, listener) {
       
  4153     element.addEventListener(eventType, listener, true);
       
  4154   }
       
  4155 
       
  4156   // do it in two places, which duplicates logic
       
  4157   // and increases the bundle size, we do it all
       
  4158   // here once. If we remove or refactor the
       
  4159   // SimpleEventPlugin, we should also remove or
       
  4160   // update the below line.
       
  4161 
       
  4162   var simpleEventPluginEventTypes = {};
       
  4163   var topLevelEventsToDispatchConfig = new Map();
       
  4164   var eventPriorities = new Map(); // We store most of the events in this module in pairs of two strings so we can re-use
       
  4165   // the code required to apply the same logic for event prioritization and that of the
       
  4166   // SimpleEventPlugin. This complicates things slightly, but the aim is to reduce code
       
  4167   // duplication (for which there would be quite a bit). For the events that are not needed
       
  4168   // for the SimpleEventPlugin (otherDiscreteEvents) we process them separately as an
       
  4169   // array of top level events.
       
  4170   // Lastly, we ignore prettier so we can keep the formatting sane.
       
  4171   // prettier-ignore
       
  4172 
       
  4173   var discreteEventPairsForSimpleEventPlugin = [TOP_BLUR, 'blur', TOP_CANCEL, 'cancel', TOP_CLICK, 'click', TOP_CLOSE, 'close', TOP_CONTEXT_MENU, 'contextMenu', TOP_COPY, 'copy', TOP_CUT, 'cut', TOP_AUX_CLICK, 'auxClick', TOP_DOUBLE_CLICK, 'doubleClick', TOP_DRAG_END, 'dragEnd', TOP_DRAG_START, 'dragStart', TOP_DROP, 'drop', TOP_FOCUS, 'focus', TOP_INPUT, 'input', TOP_INVALID, 'invalid', TOP_KEY_DOWN, 'keyDown', TOP_KEY_PRESS, 'keyPress', TOP_KEY_UP, 'keyUp', TOP_MOUSE_DOWN, 'mouseDown', TOP_MOUSE_UP, 'mouseUp', TOP_PASTE, 'paste', TOP_PAUSE, 'pause', TOP_PLAY, 'play', TOP_POINTER_CANCEL, 'pointerCancel', TOP_POINTER_DOWN, 'pointerDown', TOP_POINTER_UP, 'pointerUp', TOP_RATE_CHANGE, 'rateChange', TOP_RESET, 'reset', TOP_SEEKED, 'seeked', TOP_SUBMIT, 'submit', TOP_TOUCH_CANCEL, 'touchCancel', TOP_TOUCH_END, 'touchEnd', TOP_TOUCH_START, 'touchStart', TOP_VOLUME_CHANGE, 'volumeChange'];
       
  4174   var otherDiscreteEvents = [TOP_CHANGE, TOP_SELECTION_CHANGE, TOP_TEXT_INPUT, TOP_COMPOSITION_START, TOP_COMPOSITION_END, TOP_COMPOSITION_UPDATE]; // prettier-ignore
       
  4175 
       
  4176   var userBlockingPairsForSimpleEventPlugin = [TOP_DRAG, 'drag', TOP_DRAG_ENTER, 'dragEnter', TOP_DRAG_EXIT, 'dragExit', TOP_DRAG_LEAVE, 'dragLeave', TOP_DRAG_OVER, 'dragOver', TOP_MOUSE_MOVE, 'mouseMove', TOP_MOUSE_OUT, 'mouseOut', TOP_MOUSE_OVER, 'mouseOver', TOP_POINTER_MOVE, 'pointerMove', TOP_POINTER_OUT, 'pointerOut', TOP_POINTER_OVER, 'pointerOver', TOP_SCROLL, 'scroll', TOP_TOGGLE, 'toggle', TOP_TOUCH_MOVE, 'touchMove', TOP_WHEEL, 'wheel']; // prettier-ignore
       
  4177 
       
  4178   var continuousPairsForSimpleEventPlugin = [TOP_ABORT, 'abort', TOP_ANIMATION_END, 'animationEnd', TOP_ANIMATION_ITERATION, 'animationIteration', TOP_ANIMATION_START, 'animationStart', TOP_CAN_PLAY, 'canPlay', TOP_CAN_PLAY_THROUGH, 'canPlayThrough', TOP_DURATION_CHANGE, 'durationChange', TOP_EMPTIED, 'emptied', TOP_ENCRYPTED, 'encrypted', TOP_ENDED, 'ended', TOP_ERROR, 'error', TOP_GOT_POINTER_CAPTURE, 'gotPointerCapture', TOP_LOAD, 'load', TOP_LOADED_DATA, 'loadedData', TOP_LOADED_METADATA, 'loadedMetadata', TOP_LOAD_START, 'loadStart', TOP_LOST_POINTER_CAPTURE, 'lostPointerCapture', TOP_PLAYING, 'playing', TOP_PROGRESS, 'progress', TOP_SEEKING, 'seeking', TOP_STALLED, 'stalled', TOP_SUSPEND, 'suspend', TOP_TIME_UPDATE, 'timeUpdate', TOP_TRANSITION_END, 'transitionEnd', TOP_WAITING, 'waiting'];
       
  4179   /**
       
  4180    * Turns
       
  4181    * ['abort', ...]
       
  4182    * into
       
  4183    * eventTypes = {
       
  4184    *   'abort': {
       
  4185    *     phasedRegistrationNames: {
       
  4186    *       bubbled: 'onAbort',
       
  4187    *       captured: 'onAbortCapture',
       
  4188    *     },
       
  4189    *     dependencies: [TOP_ABORT],
       
  4190    *   },
       
  4191    *   ...
       
  4192    * };
       
  4193    * topLevelEventsToDispatchConfig = new Map([
       
  4194    *   [TOP_ABORT, { sameConfig }],
       
  4195    * ]);
       
  4196    */
       
  4197 
       
  4198   function processSimpleEventPluginPairsByPriority(eventTypes, priority) {
       
  4199     // As the event types are in pairs of two, we need to iterate
       
  4200     // through in twos. The events are in pairs of two to save code
       
  4201     // and improve init perf of processing this array, as it will
       
  4202     // result in far fewer object allocations and property accesses
       
  4203     // if we only use three arrays to process all the categories of
       
  4204     // instead of tuples.
       
  4205     for (var i = 0; i < eventTypes.length; i += 2) {
       
  4206       var topEvent = eventTypes[i];
       
  4207       var event = eventTypes[i + 1];
       
  4208       var capitalizedEvent = event[0].toUpperCase() + event.slice(1);
       
  4209       var onEvent = 'on' + capitalizedEvent;
       
  4210       var config = {
       
  4211         phasedRegistrationNames: {
       
  4212           bubbled: onEvent,
       
  4213           captured: onEvent + 'Capture'
       
  4214         },
       
  4215         dependencies: [topEvent],
       
  4216         eventPriority: priority
       
  4217       };
       
  4218       eventPriorities.set(topEvent, priority);
       
  4219       topLevelEventsToDispatchConfig.set(topEvent, config);
       
  4220       simpleEventPluginEventTypes[event] = config;
       
  4221     }
       
  4222   }
       
  4223 
       
  4224   function processTopEventPairsByPriority(eventTypes, priority) {
       
  4225     for (var i = 0; i < eventTypes.length; i++) {
       
  4226       eventPriorities.set(eventTypes[i], priority);
       
  4227     }
       
  4228   } // SimpleEventPlugin
       
  4229 
       
  4230 
       
  4231   processSimpleEventPluginPairsByPriority(discreteEventPairsForSimpleEventPlugin, DiscreteEvent);
       
  4232   processSimpleEventPluginPairsByPriority(userBlockingPairsForSimpleEventPlugin, UserBlockingEvent);
       
  4233   processSimpleEventPluginPairsByPriority(continuousPairsForSimpleEventPlugin, ContinuousEvent); // Not used by SimpleEventPlugin
       
  4234 
       
  4235   processTopEventPairsByPriority(otherDiscreteEvents, DiscreteEvent);
       
  4236   function getEventPriorityForPluginSystem(topLevelType) {
       
  4237     var priority = eventPriorities.get(topLevelType); // Default to a ContinuousEvent. Note: we might
       
  4238     // want to warn if we can't detect the priority
       
  4239     // for the event.
       
  4240 
       
  4241     return priority === undefined ? ContinuousEvent : priority;
       
  4242   }
       
  4243 
       
  4244   // Intentionally not named imports because Rollup would use dynamic dispatch for
       
  4245   var UserBlockingPriority = unstable_UserBlockingPriority,
       
  4246       runWithPriority = unstable_runWithPriority; // TODO: can we stop exporting these?
       
  4247 
       
  4248   var _enabled = true;
       
  4249   function setEnabled(enabled) {
       
  4250     _enabled = !!enabled;
       
  4251   }
       
  4252   function isEnabled() {
       
  4253     return _enabled;
       
  4254   }
       
  4255   function trapBubbledEvent(topLevelType, element) {
       
  4256     trapEventForPluginEventSystem(element, topLevelType, false);
       
  4257   }
       
  4258   function trapCapturedEvent(topLevelType, element) {
       
  4259     trapEventForPluginEventSystem(element, topLevelType, true);
       
  4260   }
       
  4261 
       
  4262   function trapEventForPluginEventSystem(container, topLevelType, capture) {
       
  4263     var listener;
       
  4264 
       
  4265     switch (getEventPriorityForPluginSystem(topLevelType)) {
       
  4266       case DiscreteEvent:
       
  4267         listener = dispatchDiscreteEvent.bind(null, topLevelType, PLUGIN_EVENT_SYSTEM, container);
       
  4268         break;
       
  4269 
       
  4270       case UserBlockingEvent:
       
  4271         listener = dispatchUserBlockingUpdate.bind(null, topLevelType, PLUGIN_EVENT_SYSTEM, container);
       
  4272         break;
       
  4273 
       
  4274       case ContinuousEvent:
       
  4275       default:
       
  4276         listener = dispatchEvent.bind(null, topLevelType, PLUGIN_EVENT_SYSTEM, container);
       
  4277         break;
       
  4278     }
       
  4279 
       
  4280     var rawEventName = getRawEventName(topLevelType);
       
  4281 
       
  4282     if (capture) {
       
  4283       addEventCaptureListener(container, rawEventName, listener);
       
  4284     } else {
       
  4285       addEventBubbleListener(container, rawEventName, listener);
       
  4286     }
       
  4287   }
       
  4288 
       
  4289   function dispatchDiscreteEvent(topLevelType, eventSystemFlags, container, nativeEvent) {
       
  4290     flushDiscreteUpdatesIfNeeded(nativeEvent.timeStamp);
       
  4291     discreteUpdates(dispatchEvent, topLevelType, eventSystemFlags, container, nativeEvent);
       
  4292   }
       
  4293 
       
  4294   function dispatchUserBlockingUpdate(topLevelType, eventSystemFlags, container, nativeEvent) {
       
  4295     runWithPriority(UserBlockingPriority, dispatchEvent.bind(null, topLevelType, eventSystemFlags, container, nativeEvent));
       
  4296   }
       
  4297 
       
  4298   function dispatchEvent(topLevelType, eventSystemFlags, container, nativeEvent) {
       
  4299     if (!_enabled) {
       
  4300       return;
       
  4301     }
       
  4302 
       
  4303     if (hasQueuedDiscreteEvents() && isReplayableDiscreteEvent(topLevelType)) {
       
  4304       // If we already have a queue of discrete events, and this is another discrete
       
  4305       // event, then we can't dispatch it regardless of its target, since they
       
  4306       // need to dispatch in order.
       
  4307       queueDiscreteEvent(null, // Flags that we're not actually blocked on anything as far as we know.
       
  4308       topLevelType, eventSystemFlags, container, nativeEvent);
       
  4309       return;
       
  4310     }
       
  4311 
       
  4312     var blockedOn = attemptToDispatchEvent(topLevelType, eventSystemFlags, container, nativeEvent);
       
  4313 
       
  4314     if (blockedOn === null) {
       
  4315       // We successfully dispatched this event.
       
  4316       clearIfContinuousEvent(topLevelType, nativeEvent);
       
  4317       return;
       
  4318     }
       
  4319 
       
  4320     if (isReplayableDiscreteEvent(topLevelType)) {
       
  4321       // This this to be replayed later once the target is available.
       
  4322       queueDiscreteEvent(blockedOn, topLevelType, eventSystemFlags, container, nativeEvent);
       
  4323       return;
       
  4324     }
       
  4325 
       
  4326     if (queueIfContinuousEvent(blockedOn, topLevelType, eventSystemFlags, container, nativeEvent)) {
       
  4327       return;
       
  4328     } // We need to clear only if we didn't queue because
       
  4329     // queueing is accummulative.
       
  4330 
       
  4331 
       
  4332     clearIfContinuousEvent(topLevelType, nativeEvent); // This is not replayable so we'll invoke it but without a target,
       
  4333     // in case the event system needs to trace it.
       
  4334 
       
  4335     {
       
  4336       dispatchEventForLegacyPluginEventSystem(topLevelType, eventSystemFlags, nativeEvent, null);
       
  4337     }
       
  4338   } // Attempt dispatching an event. Returns a SuspenseInstance or Container if it's blocked.
       
  4339 
       
  4340   function attemptToDispatchEvent(topLevelType, eventSystemFlags, container, nativeEvent) {
       
  4341     // TODO: Warn if _enabled is false.
       
  4342     var nativeEventTarget = getEventTarget(nativeEvent);
       
  4343     var targetInst = getClosestInstanceFromNode(nativeEventTarget);
       
  4344 
       
  4345     if (targetInst !== null) {
       
  4346       var nearestMounted = getNearestMountedFiber(targetInst);
       
  4347 
       
  4348       if (nearestMounted === null) {
       
  4349         // This tree has been unmounted already. Dispatch without a target.
       
  4350         targetInst = null;
       
  4351       } else {
       
  4352         var tag = nearestMounted.tag;
       
  4353 
       
  4354         if (tag === SuspenseComponent) {
       
  4355           var instance = getSuspenseInstanceFromFiber(nearestMounted);
       
  4356 
       
  4357           if (instance !== null) {
       
  4358             // Queue the event to be replayed later. Abort dispatching since we
       
  4359             // don't want this event dispatched twice through the event system.
       
  4360             // TODO: If this is the first discrete event in the queue. Schedule an increased
       
  4361             // priority for this boundary.
       
  4362             return instance;
       
  4363           } // This shouldn't happen, something went wrong but to avoid blocking
       
  4364           // the whole system, dispatch the event without a target.
       
  4365           // TODO: Warn.
       
  4366 
       
  4367 
       
  4368           targetInst = null;
       
  4369         } else if (tag === HostRoot) {
       
  4370           var root = nearestMounted.stateNode;
       
  4371 
       
  4372           if (root.hydrate) {
       
  4373             // If this happens during a replay something went wrong and it might block
       
  4374             // the whole system.
       
  4375             return getContainerFromFiber(nearestMounted);
       
  4376           }
       
  4377 
       
  4378           targetInst = null;
       
  4379         } else if (nearestMounted !== targetInst) {
       
  4380           // If we get an event (ex: img onload) before committing that
       
  4381           // component's mount, ignore it for now (that is, treat it as if it was an
       
  4382           // event on a non-React tree). We might also consider queueing events and
       
  4383           // dispatching them after the mount.
       
  4384           targetInst = null;
       
  4385         }
       
  4386       }
       
  4387     }
       
  4388 
       
  4389     {
       
  4390       dispatchEventForLegacyPluginEventSystem(topLevelType, eventSystemFlags, nativeEvent, targetInst);
       
  4391     } // We're not blocked on anything.
       
  4392 
       
  4393 
  6305     return null;
  4394     return null;
  6306   }
  4395   }
  6307   try {
  4396 
  6308     return doc.activeElement || doc.body;
  4397   // List derived from Gecko source code:
  6309   } catch (e) {
  4398   // https://github.com/mozilla/gecko-dev/blob/4e638efc71/layout/style/test/property_database.js
  6310     return doc.body;
  4399   var shorthandToLonghand = {
  6311   }
  4400     animation: ['animationDelay', 'animationDirection', 'animationDuration', 'animationFillMode', 'animationIterationCount', 'animationName', 'animationPlayState', 'animationTimingFunction'],
  6312 }
  4401     background: ['backgroundAttachment', 'backgroundClip', 'backgroundColor', 'backgroundImage', 'backgroundOrigin', 'backgroundPositionX', 'backgroundPositionY', 'backgroundRepeat', 'backgroundSize'],
  6313 
  4402     backgroundPosition: ['backgroundPositionX', 'backgroundPositionY'],
  6314 /**
  4403     border: ['borderBottomColor', 'borderBottomStyle', 'borderBottomWidth', 'borderImageOutset', 'borderImageRepeat', 'borderImageSlice', 'borderImageSource', 'borderImageWidth', 'borderLeftColor', 'borderLeftStyle', 'borderLeftWidth', 'borderRightColor', 'borderRightStyle', 'borderRightWidth', 'borderTopColor', 'borderTopStyle', 'borderTopWidth'],
  6315  * Given any node return the first leaf node without children.
  4404     borderBlockEnd: ['borderBlockEndColor', 'borderBlockEndStyle', 'borderBlockEndWidth'],
  6316  *
  4405     borderBlockStart: ['borderBlockStartColor', 'borderBlockStartStyle', 'borderBlockStartWidth'],
  6317  * @param {DOMElement|DOMTextNode} node
  4406     borderBottom: ['borderBottomColor', 'borderBottomStyle', 'borderBottomWidth'],
  6318  * @return {DOMElement|DOMTextNode}
  4407     borderColor: ['borderBottomColor', 'borderLeftColor', 'borderRightColor', 'borderTopColor'],
  6319  */
  4408     borderImage: ['borderImageOutset', 'borderImageRepeat', 'borderImageSlice', 'borderImageSource', 'borderImageWidth'],
  6320 function getLeafNode(node) {
  4409     borderInlineEnd: ['borderInlineEndColor', 'borderInlineEndStyle', 'borderInlineEndWidth'],
  6321   while (node && node.firstChild) {
  4410     borderInlineStart: ['borderInlineStartColor', 'borderInlineStartStyle', 'borderInlineStartWidth'],
  6322     node = node.firstChild;
  4411     borderLeft: ['borderLeftColor', 'borderLeftStyle', 'borderLeftWidth'],
  6323   }
  4412     borderRadius: ['borderBottomLeftRadius', 'borderBottomRightRadius', 'borderTopLeftRadius', 'borderTopRightRadius'],
  6324   return node;
  4413     borderRight: ['borderRightColor', 'borderRightStyle', 'borderRightWidth'],
  6325 }
  4414     borderStyle: ['borderBottomStyle', 'borderLeftStyle', 'borderRightStyle', 'borderTopStyle'],
  6326 
  4415     borderTop: ['borderTopColor', 'borderTopStyle', 'borderTopWidth'],
  6327 /**
  4416     borderWidth: ['borderBottomWidth', 'borderLeftWidth', 'borderRightWidth', 'borderTopWidth'],
  6328  * Get the next sibling within a container. This will walk up the
  4417     columnRule: ['columnRuleColor', 'columnRuleStyle', 'columnRuleWidth'],
  6329  * DOM if a node's siblings have been exhausted.
  4418     columns: ['columnCount', 'columnWidth'],
  6330  *
  4419     flex: ['flexBasis', 'flexGrow', 'flexShrink'],
  6331  * @param {DOMElement|DOMTextNode} node
  4420     flexFlow: ['flexDirection', 'flexWrap'],
  6332  * @return {?DOMElement|DOMTextNode}
  4421     font: ['fontFamily', 'fontFeatureSettings', 'fontKerning', 'fontLanguageOverride', 'fontSize', 'fontSizeAdjust', 'fontStretch', 'fontStyle', 'fontVariant', 'fontVariantAlternates', 'fontVariantCaps', 'fontVariantEastAsian', 'fontVariantLigatures', 'fontVariantNumeric', 'fontVariantPosition', 'fontWeight', 'lineHeight'],
  6333  */
  4422     fontVariant: ['fontVariantAlternates', 'fontVariantCaps', 'fontVariantEastAsian', 'fontVariantLigatures', 'fontVariantNumeric', 'fontVariantPosition'],
  6334 function getSiblingNode(node) {
  4423     gap: ['columnGap', 'rowGap'],
  6335   while (node) {
  4424     grid: ['gridAutoColumns', 'gridAutoFlow', 'gridAutoRows', 'gridTemplateAreas', 'gridTemplateColumns', 'gridTemplateRows'],
  6336     if (node.nextSibling) {
  4425     gridArea: ['gridColumnEnd', 'gridColumnStart', 'gridRowEnd', 'gridRowStart'],
  6337       return node.nextSibling;
  4426     gridColumn: ['gridColumnEnd', 'gridColumnStart'],
  6338     }
  4427     gridColumnGap: ['columnGap'],
  6339     node = node.parentNode;
  4428     gridGap: ['columnGap', 'rowGap'],
  6340   }
  4429     gridRow: ['gridRowEnd', 'gridRowStart'],
  6341 }
  4430     gridRowGap: ['rowGap'],
  6342 
  4431     gridTemplate: ['gridTemplateAreas', 'gridTemplateColumns', 'gridTemplateRows'],
  6343 /**
  4432     listStyle: ['listStyleImage', 'listStylePosition', 'listStyleType'],
  6344  * Get object describing the nodes which contain characters at offset.
  4433     margin: ['marginBottom', 'marginLeft', 'marginRight', 'marginTop'],
  6345  *
  4434     marker: ['markerEnd', 'markerMid', 'markerStart'],
  6346  * @param {DOMElement|DOMTextNode} root
  4435     mask: ['maskClip', 'maskComposite', 'maskImage', 'maskMode', 'maskOrigin', 'maskPositionX', 'maskPositionY', 'maskRepeat', 'maskSize'],
  6347  * @param {number} offset
  4436     maskPosition: ['maskPositionX', 'maskPositionY'],
  6348  * @return {?object}
  4437     outline: ['outlineColor', 'outlineStyle', 'outlineWidth'],
  6349  */
  4438     overflow: ['overflowX', 'overflowY'],
  6350 function getNodeForCharacterOffset(root, offset) {
  4439     padding: ['paddingBottom', 'paddingLeft', 'paddingRight', 'paddingTop'],
  6351   var node = getLeafNode(root);
  4440     placeContent: ['alignContent', 'justifyContent'],
  6352   var nodeStart = 0;
  4441     placeItems: ['alignItems', 'justifyItems'],
  6353   var nodeEnd = 0;
  4442     placeSelf: ['alignSelf', 'justifySelf'],
  6354 
  4443     textDecoration: ['textDecorationColor', 'textDecorationLine', 'textDecorationStyle'],
  6355   while (node) {
  4444     textEmphasis: ['textEmphasisColor', 'textEmphasisStyle'],
  6356     if (node.nodeType === TEXT_NODE) {
  4445     transition: ['transitionDelay', 'transitionDuration', 'transitionProperty', 'transitionTimingFunction'],
  6357       nodeEnd = nodeStart + node.textContent.length;
  4446     wordWrap: ['overflowWrap']
  6358 
       
  6359       if (nodeStart <= offset && nodeEnd >= offset) {
       
  6360         return {
       
  6361           node: node,
       
  6362           offset: offset - nodeStart
       
  6363         };
       
  6364       }
       
  6365 
       
  6366       nodeStart = nodeEnd;
       
  6367     }
       
  6368 
       
  6369     node = getLeafNode(getSiblingNode(node));
       
  6370   }
       
  6371 }
       
  6372 
       
  6373 /**
       
  6374  * @param {DOMElement} outerNode
       
  6375  * @return {?object}
       
  6376  */
       
  6377 function getOffsets(outerNode) {
       
  6378   var ownerDocument = outerNode.ownerDocument;
       
  6379 
       
  6380   var win = ownerDocument && ownerDocument.defaultView || window;
       
  6381   var selection = win.getSelection && win.getSelection();
       
  6382 
       
  6383   if (!selection || selection.rangeCount === 0) {
       
  6384     return null;
       
  6385   }
       
  6386 
       
  6387   var anchorNode = selection.anchorNode,
       
  6388       anchorOffset = selection.anchorOffset,
       
  6389       focusNode = selection.focusNode,
       
  6390       focusOffset = selection.focusOffset;
       
  6391 
       
  6392   // In Firefox, anchorNode and focusNode can be "anonymous divs", e.g. the
       
  6393   // up/down buttons on an <input type="number">. Anonymous divs do not seem to
       
  6394   // expose properties, triggering a "Permission denied error" if any of its
       
  6395   // properties are accessed. The only seemingly possible way to avoid erroring
       
  6396   // is to access a property that typically works for non-anonymous divs and
       
  6397   // catch any error that may otherwise arise. See
       
  6398   // https://bugzilla.mozilla.org/show_bug.cgi?id=208427
       
  6399 
       
  6400   try {
       
  6401     /* eslint-disable no-unused-expressions */
       
  6402     anchorNode.nodeType;
       
  6403     focusNode.nodeType;
       
  6404     /* eslint-enable no-unused-expressions */
       
  6405   } catch (e) {
       
  6406     return null;
       
  6407   }
       
  6408 
       
  6409   return getModernOffsetsFromPoints(outerNode, anchorNode, anchorOffset, focusNode, focusOffset);
       
  6410 }
       
  6411 
       
  6412 /**
       
  6413  * Returns {start, end} where `start` is the character/codepoint index of
       
  6414  * (anchorNode, anchorOffset) within the textContent of `outerNode`, and
       
  6415  * `end` is the index of (focusNode, focusOffset).
       
  6416  *
       
  6417  * Returns null if you pass in garbage input but we should probably just crash.
       
  6418  *
       
  6419  * Exported only for testing.
       
  6420  */
       
  6421 function getModernOffsetsFromPoints(outerNode, anchorNode, anchorOffset, focusNode, focusOffset) {
       
  6422   var length = 0;
       
  6423   var start = -1;
       
  6424   var end = -1;
       
  6425   var indexWithinAnchor = 0;
       
  6426   var indexWithinFocus = 0;
       
  6427   var node = outerNode;
       
  6428   var parentNode = null;
       
  6429 
       
  6430   outer: while (true) {
       
  6431     var next = null;
       
  6432 
       
  6433     while (true) {
       
  6434       if (node === anchorNode && (anchorOffset === 0 || node.nodeType === TEXT_NODE)) {
       
  6435         start = length + anchorOffset;
       
  6436       }
       
  6437       if (node === focusNode && (focusOffset === 0 || node.nodeType === TEXT_NODE)) {
       
  6438         end = length + focusOffset;
       
  6439       }
       
  6440 
       
  6441       if (node.nodeType === TEXT_NODE) {
       
  6442         length += node.nodeValue.length;
       
  6443       }
       
  6444 
       
  6445       if ((next = node.firstChild) === null) {
       
  6446         break;
       
  6447       }
       
  6448       // Moving from `node` to its first child `next`.
       
  6449       parentNode = node;
       
  6450       node = next;
       
  6451     }
       
  6452 
       
  6453     while (true) {
       
  6454       if (node === outerNode) {
       
  6455         // If `outerNode` has children, this is always the second time visiting
       
  6456         // it. If it has no children, this is still the first loop, and the only
       
  6457         // valid selection is anchorNode and focusNode both equal to this node
       
  6458         // and both offsets 0, in which case we will have handled above.
       
  6459         break outer;
       
  6460       }
       
  6461       if (parentNode === anchorNode && ++indexWithinAnchor === anchorOffset) {
       
  6462         start = length;
       
  6463       }
       
  6464       if (parentNode === focusNode && ++indexWithinFocus === focusOffset) {
       
  6465         end = length;
       
  6466       }
       
  6467       if ((next = node.nextSibling) !== null) {
       
  6468         break;
       
  6469       }
       
  6470       node = parentNode;
       
  6471       parentNode = node.parentNode;
       
  6472     }
       
  6473 
       
  6474     // Moving from `node` to its next sibling `next`.
       
  6475     node = next;
       
  6476   }
       
  6477 
       
  6478   if (start === -1 || end === -1) {
       
  6479     // This should never happen. (Would happen if the anchor/focus nodes aren't
       
  6480     // actually inside the passed-in node.)
       
  6481     return null;
       
  6482   }
       
  6483 
       
  6484   return {
       
  6485     start: start,
       
  6486     end: end
       
  6487   };
  4447   };
  6488 }
  4448 
  6489 
  4449   /**
  6490 /**
  4450    * CSS properties which accept numbers but are not in units of "px".
  6491  * In modern non-IE browsers, we can support both forward and backward
  4451    */
  6492  * selections.
  4452   var isUnitlessNumber = {
  6493  *
  4453     animationIterationCount: true,
  6494  * Note: IE10+ supports the Selection object, but it does not support
  4454     borderImageOutset: true,
  6495  * the `extend` method, which means that even in modern IE, it's not possible
  4455     borderImageSlice: true,
  6496  * to programmatically create a backward selection. Thus, for all IE
  4456     borderImageWidth: true,
  6497  * versions, we use the old IE API to create our selections.
  4457     boxFlex: true,
  6498  *
  4458     boxFlexGroup: true,
  6499  * @param {DOMElement|DOMTextNode} node
  4459     boxOrdinalGroup: true,
  6500  * @param {object} offsets
  4460     columnCount: true,
  6501  */
  4461     columns: true,
  6502 function setOffsets(node, offsets) {
  4462     flex: true,
  6503   var doc = node.ownerDocument || document;
  4463     flexGrow: true,
  6504   var win = doc && doc.defaultView || window;
  4464     flexPositive: true,
  6505 
  4465     flexShrink: true,
  6506   // Edge fails with "Object expected" in some scenarios.
  4466     flexNegative: true,
  6507   // (For instance: TinyMCE editor used in a list component that supports pasting to add more,
  4467     flexOrder: true,
  6508   // fails when pasting 100+ items)
  4468     gridArea: true,
  6509   if (!win.getSelection) {
  4469     gridRow: true,
  6510     return;
  4470     gridRowEnd: true,
  6511   }
  4471     gridRowSpan: true,
  6512 
  4472     gridRowStart: true,
  6513   var selection = win.getSelection();
  4473     gridColumn: true,
  6514   var length = node.textContent.length;
  4474     gridColumnEnd: true,
  6515   var start = Math.min(offsets.start, length);
  4475     gridColumnSpan: true,
  6516   var end = offsets.end === undefined ? start : Math.min(offsets.end, length);
  4476     gridColumnStart: true,
  6517 
  4477     fontWeight: true,
  6518   // IE 11 uses modern selection, but doesn't support the extend method.
  4478     lineClamp: true,
  6519   // Flip backward selections, so we can set with a single range.
  4479     lineHeight: true,
  6520   if (!selection.extend && start > end) {
  4480     opacity: true,
  6521     var temp = end;
  4481     order: true,
  6522     end = start;
  4482     orphans: true,
  6523     start = temp;
  4483     tabSize: true,
  6524   }
  4484     widows: true,
  6525 
  4485     zIndex: true,
  6526   var startMarker = getNodeForCharacterOffset(node, start);
  4486     zoom: true,
  6527   var endMarker = getNodeForCharacterOffset(node, end);
  4487     // SVG-related properties
  6528 
  4488     fillOpacity: true,
  6529   if (startMarker && endMarker) {
  4489     floodOpacity: true,
  6530     if (selection.rangeCount === 1 && selection.anchorNode === startMarker.node && selection.anchorOffset === startMarker.offset && selection.focusNode === endMarker.node && selection.focusOffset === endMarker.offset) {
  4490     stopOpacity: true,
  6531       return;
  4491     strokeDasharray: true,
  6532     }
  4492     strokeDashoffset: true,
  6533     var range = doc.createRange();
  4493     strokeMiterlimit: true,
  6534     range.setStart(startMarker.node, startMarker.offset);
  4494     strokeOpacity: true,
  6535     selection.removeAllRanges();
  4495     strokeWidth: true
  6536 
       
  6537     if (start > end) {
       
  6538       selection.addRange(range);
       
  6539       selection.extend(endMarker.node, endMarker.offset);
       
  6540     } else {
       
  6541       range.setEnd(endMarker.node, endMarker.offset);
       
  6542       selection.addRange(range);
       
  6543     }
       
  6544   }
       
  6545 }
       
  6546 
       
  6547 function isTextNode(node) {
       
  6548   return node && node.nodeType === TEXT_NODE;
       
  6549 }
       
  6550 
       
  6551 function containsNode(outerNode, innerNode) {
       
  6552   if (!outerNode || !innerNode) {
       
  6553     return false;
       
  6554   } else if (outerNode === innerNode) {
       
  6555     return true;
       
  6556   } else if (isTextNode(outerNode)) {
       
  6557     return false;
       
  6558   } else if (isTextNode(innerNode)) {
       
  6559     return containsNode(outerNode, innerNode.parentNode);
       
  6560   } else if ('contains' in outerNode) {
       
  6561     return outerNode.contains(innerNode);
       
  6562   } else if (outerNode.compareDocumentPosition) {
       
  6563     return !!(outerNode.compareDocumentPosition(innerNode) & 16);
       
  6564   } else {
       
  6565     return false;
       
  6566   }
       
  6567 }
       
  6568 
       
  6569 function isInDocument(node) {
       
  6570   return node && node.ownerDocument && containsNode(node.ownerDocument.documentElement, node);
       
  6571 }
       
  6572 
       
  6573 function isSameOriginFrame(iframe) {
       
  6574   try {
       
  6575     // Accessing the contentDocument of a HTMLIframeElement can cause the browser
       
  6576     // to throw, e.g. if it has a cross-origin src attribute.
       
  6577     // Safari will show an error in the console when the access results in "Blocked a frame with origin". e.g:
       
  6578     // iframe.contentDocument.defaultView;
       
  6579     // A safety way is to access one of the cross origin properties: Window or Location
       
  6580     // Which might result in "SecurityError" DOM Exception and it is compatible to Safari.
       
  6581     // https://html.spec.whatwg.org/multipage/browsers.html#integration-with-idl
       
  6582 
       
  6583     return typeof iframe.contentWindow.location.href === 'string';
       
  6584   } catch (err) {
       
  6585     return false;
       
  6586   }
       
  6587 }
       
  6588 
       
  6589 function getActiveElementDeep() {
       
  6590   var win = window;
       
  6591   var element = getActiveElement();
       
  6592   while (element instanceof win.HTMLIFrameElement) {
       
  6593     if (isSameOriginFrame(element)) {
       
  6594       win = element.contentWindow;
       
  6595     } else {
       
  6596       return element;
       
  6597     }
       
  6598     element = getActiveElement(win.document);
       
  6599   }
       
  6600   return element;
       
  6601 }
       
  6602 
       
  6603 /**
       
  6604  * @ReactInputSelection: React input selection module. Based on Selection.js,
       
  6605  * but modified to be suitable for react and has a couple of bug fixes (doesn't
       
  6606  * assume buttons have range selections allowed).
       
  6607  * Input selection module for React.
       
  6608  */
       
  6609 
       
  6610 /**
       
  6611  * @hasSelectionCapabilities: we get the element types that support selection
       
  6612  * from https://html.spec.whatwg.org/#do-not-apply, looking at `selectionStart`
       
  6613  * and `selectionEnd` rows.
       
  6614  */
       
  6615 function hasSelectionCapabilities(elem) {
       
  6616   var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase();
       
  6617   return nodeName && (nodeName === 'input' && (elem.type === 'text' || elem.type === 'search' || elem.type === 'tel' || elem.type === 'url' || elem.type === 'password') || nodeName === 'textarea' || elem.contentEditable === 'true');
       
  6618 }
       
  6619 
       
  6620 function getSelectionInformation() {
       
  6621   var focusedElem = getActiveElementDeep();
       
  6622   return {
       
  6623     focusedElem: focusedElem,
       
  6624     selectionRange: hasSelectionCapabilities(focusedElem) ? getSelection$1(focusedElem) : null
       
  6625   };
  4496   };
  6626 }
  4497   /**
  6627 
  4498    * @param {string} prefix vendor-specific prefix, eg: Webkit
  6628 /**
  4499    * @param {string} key style name, eg: transitionDuration
  6629  * @restoreSelection: If any selection information was potentially lost,
  4500    * @return {string} style name prefixed with `prefix`, properly camelCased, eg:
  6630  * restore it. This is useful when performing operations that could remove dom
  4501    * WebkitTransitionDuration
  6631  * nodes and place them back in, resulting in focus being lost.
  4502    */
  6632  */
  4503 
  6633 function restoreSelection(priorSelectionInformation) {
  4504   function prefixKey(prefix, key) {
  6634   var curFocusedElem = getActiveElementDeep();
  4505     return prefix + key.charAt(0).toUpperCase() + key.substring(1);
  6635   var priorFocusedElem = priorSelectionInformation.focusedElem;
  4506   }
  6636   var priorSelectionRange = priorSelectionInformation.selectionRange;
  4507   /**
  6637   if (curFocusedElem !== priorFocusedElem && isInDocument(priorFocusedElem)) {
  4508    * Support style names that may come passed in prefixed by adding permutations
  6638     if (priorSelectionRange !== null && hasSelectionCapabilities(priorFocusedElem)) {
  4509    * of vendor prefixes.
  6639       setSelection(priorFocusedElem, priorSelectionRange);
  4510    */
  6640     }
  4511 
  6641 
  4512 
  6642     // Focusing a node can change the scroll position, which is undesirable
  4513   var prefixes = ['Webkit', 'ms', 'Moz', 'O']; // Using Object.keys here, or else the vanilla for-in loop makes IE8 go into an
  6643     var ancestors = [];
  4514   // infinite loop, because it iterates over the newly added props too.
  6644     var ancestor = priorFocusedElem;
  4515 
  6645     while (ancestor = ancestor.parentNode) {
  4516   Object.keys(isUnitlessNumber).forEach(function (prop) {
  6646       if (ancestor.nodeType === ELEMENT_NODE) {
  4517     prefixes.forEach(function (prefix) {
  6647         ancestors.push({
  4518       isUnitlessNumber[prefixKey(prefix, prop)] = isUnitlessNumber[prop];
  6648           element: ancestor,
  4519     });
  6649           left: ancestor.scrollLeft,
       
  6650           top: ancestor.scrollTop
       
  6651         });
       
  6652       }
       
  6653     }
       
  6654 
       
  6655     if (typeof priorFocusedElem.focus === 'function') {
       
  6656       priorFocusedElem.focus();
       
  6657     }
       
  6658 
       
  6659     for (var i = 0; i < ancestors.length; i++) {
       
  6660       var info = ancestors[i];
       
  6661       info.element.scrollLeft = info.left;
       
  6662       info.element.scrollTop = info.top;
       
  6663     }
       
  6664   }
       
  6665 }
       
  6666 
       
  6667 /**
       
  6668  * @getSelection: Gets the selection bounds of a focused textarea, input or
       
  6669  * contentEditable node.
       
  6670  * -@input: Look up selection bounds of this input
       
  6671  * -@return {start: selectionStart, end: selectionEnd}
       
  6672  */
       
  6673 function getSelection$1(input) {
       
  6674   var selection = void 0;
       
  6675 
       
  6676   if ('selectionStart' in input) {
       
  6677     // Modern browser with input or textarea.
       
  6678     selection = {
       
  6679       start: input.selectionStart,
       
  6680       end: input.selectionEnd
       
  6681     };
       
  6682   } else {
       
  6683     // Content editable or old IE textarea.
       
  6684     selection = getOffsets(input);
       
  6685   }
       
  6686 
       
  6687   return selection || { start: 0, end: 0 };
       
  6688 }
       
  6689 
       
  6690 /**
       
  6691  * @setSelection: Sets the selection bounds of a textarea or input and focuses
       
  6692  * the input.
       
  6693  * -@input     Set selection bounds of this input or textarea
       
  6694  * -@offsets   Object of same form that is returned from get*
       
  6695  */
       
  6696 function setSelection(input, offsets) {
       
  6697   var start = offsets.start,
       
  6698       end = offsets.end;
       
  6699 
       
  6700   if (end === undefined) {
       
  6701     end = start;
       
  6702   }
       
  6703 
       
  6704   if ('selectionStart' in input) {
       
  6705     input.selectionStart = start;
       
  6706     input.selectionEnd = Math.min(end, input.value.length);
       
  6707   } else {
       
  6708     setOffsets(input, offsets);
       
  6709   }
       
  6710 }
       
  6711 
       
  6712 var skipSelectionChangeEvent = canUseDOM && 'documentMode' in document && document.documentMode <= 11;
       
  6713 
       
  6714 var eventTypes$3 = {
       
  6715   select: {
       
  6716     phasedRegistrationNames: {
       
  6717       bubbled: 'onSelect',
       
  6718       captured: 'onSelectCapture'
       
  6719     },
       
  6720     dependencies: [TOP_BLUR, TOP_CONTEXT_MENU, TOP_DRAG_END, TOP_FOCUS, TOP_KEY_DOWN, TOP_KEY_UP, TOP_MOUSE_DOWN, TOP_MOUSE_UP, TOP_SELECTION_CHANGE]
       
  6721   }
       
  6722 };
       
  6723 
       
  6724 var activeElement$1 = null;
       
  6725 var activeElementInst$1 = null;
       
  6726 var lastSelection = null;
       
  6727 var mouseDown = false;
       
  6728 
       
  6729 /**
       
  6730  * Get an object which is a unique representation of the current selection.
       
  6731  *
       
  6732  * The return value will not be consistent across nodes or browsers, but
       
  6733  * two identical selections on the same node will return identical objects.
       
  6734  *
       
  6735  * @param {DOMElement} node
       
  6736  * @return {object}
       
  6737  */
       
  6738 function getSelection(node) {
       
  6739   if ('selectionStart' in node && hasSelectionCapabilities(node)) {
       
  6740     return {
       
  6741       start: node.selectionStart,
       
  6742       end: node.selectionEnd
       
  6743     };
       
  6744   } else {
       
  6745     var win = node.ownerDocument && node.ownerDocument.defaultView || window;
       
  6746     var selection = win.getSelection();
       
  6747     return {
       
  6748       anchorNode: selection.anchorNode,
       
  6749       anchorOffset: selection.anchorOffset,
       
  6750       focusNode: selection.focusNode,
       
  6751       focusOffset: selection.focusOffset
       
  6752     };
       
  6753   }
       
  6754 }
       
  6755 
       
  6756 /**
       
  6757  * Get document associated with the event target.
       
  6758  *
       
  6759  * @param {object} nativeEventTarget
       
  6760  * @return {Document}
       
  6761  */
       
  6762 function getEventTargetDocument(eventTarget) {
       
  6763   return eventTarget.window === eventTarget ? eventTarget.document : eventTarget.nodeType === DOCUMENT_NODE ? eventTarget : eventTarget.ownerDocument;
       
  6764 }
       
  6765 
       
  6766 /**
       
  6767  * Poll selection to see whether it's changed.
       
  6768  *
       
  6769  * @param {object} nativeEvent
       
  6770  * @param {object} nativeEventTarget
       
  6771  * @return {?SyntheticEvent}
       
  6772  */
       
  6773 function constructSelectEvent(nativeEvent, nativeEventTarget) {
       
  6774   // Ensure we have the right element, and that the user is not dragging a
       
  6775   // selection (this matches native `select` event behavior). In HTML5, select
       
  6776   // fires only on input and textarea thus if there's no focused element we
       
  6777   // won't dispatch.
       
  6778   var doc = getEventTargetDocument(nativeEventTarget);
       
  6779 
       
  6780   if (mouseDown || activeElement$1 == null || activeElement$1 !== getActiveElement(doc)) {
       
  6781     return null;
       
  6782   }
       
  6783 
       
  6784   // Only fire when selection has actually changed.
       
  6785   var currentSelection = getSelection(activeElement$1);
       
  6786   if (!lastSelection || !shallowEqual(lastSelection, currentSelection)) {
       
  6787     lastSelection = currentSelection;
       
  6788 
       
  6789     var syntheticEvent = SyntheticEvent.getPooled(eventTypes$3.select, activeElementInst$1, nativeEvent, nativeEventTarget);
       
  6790 
       
  6791     syntheticEvent.type = 'select';
       
  6792     syntheticEvent.target = activeElement$1;
       
  6793 
       
  6794     accumulateTwoPhaseDispatches(syntheticEvent);
       
  6795 
       
  6796     return syntheticEvent;
       
  6797   }
       
  6798 
       
  6799   return null;
       
  6800 }
       
  6801 
       
  6802 /**
       
  6803  * This plugin creates an `onSelect` event that normalizes select events
       
  6804  * across form elements.
       
  6805  *
       
  6806  * Supported elements are:
       
  6807  * - input (see `isTextInputElement`)
       
  6808  * - textarea
       
  6809  * - contentEditable
       
  6810  *
       
  6811  * This differs from native browser implementations in the following ways:
       
  6812  * - Fires on contentEditable fields as well as inputs.
       
  6813  * - Fires for collapsed selection.
       
  6814  * - Fires after user input.
       
  6815  */
       
  6816 var SelectEventPlugin = {
       
  6817   eventTypes: eventTypes$3,
       
  6818 
       
  6819   extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
       
  6820     var doc = getEventTargetDocument(nativeEventTarget);
       
  6821     // Track whether all listeners exists for this plugin. If none exist, we do
       
  6822     // not extract events. See #3639.
       
  6823     if (!doc || !isListeningToAllDependencies('onSelect', doc)) {
       
  6824       return null;
       
  6825     }
       
  6826 
       
  6827     var targetNode = targetInst ? getNodeFromInstance$1(targetInst) : window;
       
  6828 
       
  6829     switch (topLevelType) {
       
  6830       // Track the input node that has focus.
       
  6831       case TOP_FOCUS:
       
  6832         if (isTextInputElement(targetNode) || targetNode.contentEditable === 'true') {
       
  6833           activeElement$1 = targetNode;
       
  6834           activeElementInst$1 = targetInst;
       
  6835           lastSelection = null;
       
  6836         }
       
  6837         break;
       
  6838       case TOP_BLUR:
       
  6839         activeElement$1 = null;
       
  6840         activeElementInst$1 = null;
       
  6841         lastSelection = null;
       
  6842         break;
       
  6843       // Don't fire the event while the user is dragging. This matches the
       
  6844       // semantics of the native select event.
       
  6845       case TOP_MOUSE_DOWN:
       
  6846         mouseDown = true;
       
  6847         break;
       
  6848       case TOP_CONTEXT_MENU:
       
  6849       case TOP_MOUSE_UP:
       
  6850       case TOP_DRAG_END:
       
  6851         mouseDown = false;
       
  6852         return constructSelectEvent(nativeEvent, nativeEventTarget);
       
  6853       // Chrome and IE fire non-standard event when selection is changed (and
       
  6854       // sometimes when it hasn't). IE's event fires out of order with respect
       
  6855       // to key and input events on deletion, so we discard it.
       
  6856       //
       
  6857       // Firefox doesn't support selectionchange, so check selection status
       
  6858       // after each key entry. The selection changes after keydown and before
       
  6859       // keyup, but we check on keydown as well in the case of holding down a
       
  6860       // key, when multiple keydown events are fired but only one keyup is.
       
  6861       // This is also our approach for IE handling, for the reason above.
       
  6862       case TOP_SELECTION_CHANGE:
       
  6863         if (skipSelectionChangeEvent) {
       
  6864           break;
       
  6865         }
       
  6866       // falls through
       
  6867       case TOP_KEY_DOWN:
       
  6868       case TOP_KEY_UP:
       
  6869         return constructSelectEvent(nativeEvent, nativeEventTarget);
       
  6870     }
       
  6871 
       
  6872     return null;
       
  6873   }
       
  6874 };
       
  6875 
       
  6876 /**
       
  6877  * Inject modules for resolving DOM hierarchy and plugin ordering.
       
  6878  */
       
  6879 injection.injectEventPluginOrder(DOMEventPluginOrder);
       
  6880 setComponentTree(getFiberCurrentPropsFromNode$1, getInstanceFromNode$1, getNodeFromInstance$1);
       
  6881 
       
  6882 /**
       
  6883  * Some important event plugins included by default (without having to require
       
  6884  * them).
       
  6885  */
       
  6886 injection.injectEventPluginsByName({
       
  6887   SimpleEventPlugin: SimpleEventPlugin,
       
  6888   EnterLeaveEventPlugin: EnterLeaveEventPlugin,
       
  6889   ChangeEventPlugin: ChangeEventPlugin,
       
  6890   SelectEventPlugin: SelectEventPlugin,
       
  6891   BeforeInputEventPlugin: BeforeInputEventPlugin
       
  6892 });
       
  6893 
       
  6894 function endsWith(subject, search) {
       
  6895   var length = subject.length;
       
  6896   return subject.substring(length - search.length, length) === search;
       
  6897 }
       
  6898 
       
  6899 var didWarnSelectedSetOnOption = false;
       
  6900 var didWarnInvalidChild = false;
       
  6901 
       
  6902 function flattenChildren(children) {
       
  6903   var content = '';
       
  6904 
       
  6905   // Flatten children. We'll warn if they are invalid
       
  6906   // during validateProps() which runs for hydration too.
       
  6907   // Note that this would throw on non-element objects.
       
  6908   // Elements are stringified (which is normally irrelevant
       
  6909   // but matters for <fbt>).
       
  6910   React.Children.forEach(children, function (child) {
       
  6911     if (child == null) {
       
  6912       return;
       
  6913     }
       
  6914     content += child;
       
  6915     // Note: we don't warn about invalid children here.
       
  6916     // Instead, this is done separately below so that
       
  6917     // it happens during the hydration codepath too.
       
  6918   });
  4520   });
  6919 
  4521 
  6920   return content;
  4522   /**
  6921 }
  4523    * Convert a value into the proper css writable value. The style name `name`
  6922 
  4524    * should be logical (no hyphens), as specified
  6923 /**
  4525    * in `CSSProperty.isUnitlessNumber`.
  6924  * Implements an <option> host component that warns when `selected` is set.
  4526    *
  6925  */
  4527    * @param {string} name CSS property name such as `topMargin`.
  6926 
  4528    * @param {*} value CSS property value such as `10px`.
  6927 function validateProps(element, props) {
  4529    * @return {string} Normalized style value with dimensions applied.
       
  4530    */
       
  4531 
       
  4532   function dangerousStyleValue(name, value, isCustomProperty) {
       
  4533     // Note that we've removed escapeTextForBrowser() calls here since the
       
  4534     // whole string will be escaped when the attribute is injected into
       
  4535     // the markup. If you provide unsafe user data here they can inject
       
  4536     // arbitrary CSS which may be problematic (I couldn't repro this):
       
  4537     // https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet
       
  4538     // http://www.thespanner.co.uk/2007/11/26/ultimate-xss-css-injection/
       
  4539     // This is not an XSS hole but instead a potential CSS injection issue
       
  4540     // which has lead to a greater discussion about how we're going to
       
  4541     // trust URLs moving forward. See #2115901
       
  4542     var isEmpty = value == null || typeof value === 'boolean' || value === '';
       
  4543 
       
  4544     if (isEmpty) {
       
  4545       return '';
       
  4546     }
       
  4547 
       
  4548     if (!isCustomProperty && typeof value === 'number' && value !== 0 && !(isUnitlessNumber.hasOwnProperty(name) && isUnitlessNumber[name])) {
       
  4549       return value + 'px'; // Presumes implicit 'px' suffix for unitless numbers
       
  4550     }
       
  4551 
       
  4552     return ('' + value).trim();
       
  4553   }
       
  4554 
       
  4555   var uppercasePattern = /([A-Z])/g;
       
  4556   var msPattern = /^ms-/;
       
  4557   /**
       
  4558    * Hyphenates a camelcased CSS property name, for example:
       
  4559    *
       
  4560    *   > hyphenateStyleName('backgroundColor')
       
  4561    *   < "background-color"
       
  4562    *   > hyphenateStyleName('MozTransition')
       
  4563    *   < "-moz-transition"
       
  4564    *   > hyphenateStyleName('msTransition')
       
  4565    *   < "-ms-transition"
       
  4566    *
       
  4567    * As Modernizr suggests (http://modernizr.com/docs/#prefixed), an `ms` prefix
       
  4568    * is converted to `-ms-`.
       
  4569    */
       
  4570 
       
  4571   function hyphenateStyleName(name) {
       
  4572     return name.replace(uppercasePattern, '-$1').toLowerCase().replace(msPattern, '-ms-');
       
  4573   }
       
  4574 
       
  4575   var warnValidStyle = function () {};
       
  4576 
  6928   {
  4577   {
  6929     // This mirrors the codepath above, but runs for hydration too.
  4578     // 'msTransform' is correct, but the other prefixes should be capitalized
  6930     // Warn about invalid children here so that client and hydration are consistent.
  4579     var badVendoredStyleNamePattern = /^(?:webkit|moz|o)[A-Z]/;
  6931     // TODO: this seems like it could cause a DEV-only throw for hydration
  4580     var msPattern$1 = /^-ms-/;
  6932     // if children contains a non-element object. We should try to avoid that.
  4581     var hyphenPattern = /-(.)/g; // style values shouldn't contain a semicolon
  6933     if (typeof props.children === 'object' && props.children !== null) {
  4582 
  6934       React.Children.forEach(props.children, function (child) {
  4583     var badStyleValueWithSemicolonPattern = /;\s*$/;
  6935         if (child == null) {
  4584     var warnedStyleNames = {};
  6936           return;
  4585     var warnedStyleValues = {};
  6937         }
  4586     var warnedForNaNValue = false;
  6938         if (typeof child === 'string' || typeof child === 'number') {
  4587     var warnedForInfinityValue = false;
  6939           return;
  4588 
  6940         }
  4589     var camelize = function (string) {
  6941         if (typeof child.type !== 'string') {
  4590       return string.replace(hyphenPattern, function (_, character) {
  6942           return;
  4591         return character.toUpperCase();
  6943         }
       
  6944         if (!didWarnInvalidChild) {
       
  6945           didWarnInvalidChild = true;
       
  6946           warning$1(false, 'Only strings and numbers are supported as <option> children.');
       
  6947         }
       
  6948       });
       
  6949     }
       
  6950 
       
  6951     // TODO: Remove support for `selected` in <option>.
       
  6952     if (props.selected != null && !didWarnSelectedSetOnOption) {
       
  6953       warning$1(false, 'Use the `defaultValue` or `value` props on <select> instead of ' + 'setting `selected` on <option>.');
       
  6954       didWarnSelectedSetOnOption = true;
       
  6955     }
       
  6956   }
       
  6957 }
       
  6958 
       
  6959 function postMountWrapper$1(element, props) {
       
  6960   // value="" should make a value attribute (#6219)
       
  6961   if (props.value != null) {
       
  6962     element.setAttribute('value', toString(getToStringValue(props.value)));
       
  6963   }
       
  6964 }
       
  6965 
       
  6966 function getHostProps$1(element, props) {
       
  6967   var hostProps = _assign({ children: undefined }, props);
       
  6968   var content = flattenChildren(props.children);
       
  6969 
       
  6970   if (content) {
       
  6971     hostProps.children = content;
       
  6972   }
       
  6973 
       
  6974   return hostProps;
       
  6975 }
       
  6976 
       
  6977 // TODO: direct imports like some-package/src/* are bad. Fix me.
       
  6978 var didWarnValueDefaultValue$1 = void 0;
       
  6979 
       
  6980 {
       
  6981   didWarnValueDefaultValue$1 = false;
       
  6982 }
       
  6983 
       
  6984 function getDeclarationErrorAddendum() {
       
  6985   var ownerName = getCurrentFiberOwnerNameInDevOrNull();
       
  6986   if (ownerName) {
       
  6987     return '\n\nCheck the render method of `' + ownerName + '`.';
       
  6988   }
       
  6989   return '';
       
  6990 }
       
  6991 
       
  6992 var valuePropNames = ['value', 'defaultValue'];
       
  6993 
       
  6994 /**
       
  6995  * Validation function for `value` and `defaultValue`.
       
  6996  */
       
  6997 function checkSelectPropTypes(props) {
       
  6998   ReactControlledValuePropTypes.checkPropTypes('select', props);
       
  6999 
       
  7000   for (var i = 0; i < valuePropNames.length; i++) {
       
  7001     var propName = valuePropNames[i];
       
  7002     if (props[propName] == null) {
       
  7003       continue;
       
  7004     }
       
  7005     var isArray = Array.isArray(props[propName]);
       
  7006     if (props.multiple && !isArray) {
       
  7007       warning$1(false, 'The `%s` prop supplied to <select> must be an array if ' + '`multiple` is true.%s', propName, getDeclarationErrorAddendum());
       
  7008     } else if (!props.multiple && isArray) {
       
  7009       warning$1(false, 'The `%s` prop supplied to <select> must be a scalar ' + 'value if `multiple` is false.%s', propName, getDeclarationErrorAddendum());
       
  7010     }
       
  7011   }
       
  7012 }
       
  7013 
       
  7014 function updateOptions(node, multiple, propValue, setDefaultSelected) {
       
  7015   var options = node.options;
       
  7016 
       
  7017   if (multiple) {
       
  7018     var selectedValues = propValue;
       
  7019     var selectedValue = {};
       
  7020     for (var i = 0; i < selectedValues.length; i++) {
       
  7021       // Prefix to avoid chaos with special keys.
       
  7022       selectedValue['$' + selectedValues[i]] = true;
       
  7023     }
       
  7024     for (var _i = 0; _i < options.length; _i++) {
       
  7025       var selected = selectedValue.hasOwnProperty('$' + options[_i].value);
       
  7026       if (options[_i].selected !== selected) {
       
  7027         options[_i].selected = selected;
       
  7028       }
       
  7029       if (selected && setDefaultSelected) {
       
  7030         options[_i].defaultSelected = true;
       
  7031       }
       
  7032     }
       
  7033   } else {
       
  7034     // Do not set `select.value` as exact behavior isn't consistent across all
       
  7035     // browsers for all cases.
       
  7036     var _selectedValue = toString(getToStringValue(propValue));
       
  7037     var defaultSelected = null;
       
  7038     for (var _i2 = 0; _i2 < options.length; _i2++) {
       
  7039       if (options[_i2].value === _selectedValue) {
       
  7040         options[_i2].selected = true;
       
  7041         if (setDefaultSelected) {
       
  7042           options[_i2].defaultSelected = true;
       
  7043         }
       
  7044         return;
       
  7045       }
       
  7046       if (defaultSelected === null && !options[_i2].disabled) {
       
  7047         defaultSelected = options[_i2];
       
  7048       }
       
  7049     }
       
  7050     if (defaultSelected !== null) {
       
  7051       defaultSelected.selected = true;
       
  7052     }
       
  7053   }
       
  7054 }
       
  7055 
       
  7056 /**
       
  7057  * Implements a <select> host component that allows optionally setting the
       
  7058  * props `value` and `defaultValue`. If `multiple` is false, the prop must be a
       
  7059  * stringable. If `multiple` is true, the prop must be an array of stringables.
       
  7060  *
       
  7061  * If `value` is not supplied (or null/undefined), user actions that change the
       
  7062  * selected option will trigger updates to the rendered options.
       
  7063  *
       
  7064  * If it is supplied (and not null/undefined), the rendered options will not
       
  7065  * update in response to user actions. Instead, the `value` prop must change in
       
  7066  * order for the rendered options to update.
       
  7067  *
       
  7068  * If `defaultValue` is provided, any options with the supplied values will be
       
  7069  * selected.
       
  7070  */
       
  7071 
       
  7072 function getHostProps$2(element, props) {
       
  7073   return _assign({}, props, {
       
  7074     value: undefined
       
  7075   });
       
  7076 }
       
  7077 
       
  7078 function initWrapperState$1(element, props) {
       
  7079   var node = element;
       
  7080   {
       
  7081     checkSelectPropTypes(props);
       
  7082   }
       
  7083 
       
  7084   node._wrapperState = {
       
  7085     wasMultiple: !!props.multiple
       
  7086   };
       
  7087 
       
  7088   {
       
  7089     if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValueDefaultValue$1) {
       
  7090       warning$1(false, 'Select elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled select ' + 'element and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components');
       
  7091       didWarnValueDefaultValue$1 = true;
       
  7092     }
       
  7093   }
       
  7094 }
       
  7095 
       
  7096 function postMountWrapper$2(element, props) {
       
  7097   var node = element;
       
  7098   node.multiple = !!props.multiple;
       
  7099   var value = props.value;
       
  7100   if (value != null) {
       
  7101     updateOptions(node, !!props.multiple, value, false);
       
  7102   } else if (props.defaultValue != null) {
       
  7103     updateOptions(node, !!props.multiple, props.defaultValue, true);
       
  7104   }
       
  7105 }
       
  7106 
       
  7107 function postUpdateWrapper(element, props) {
       
  7108   var node = element;
       
  7109   var wasMultiple = node._wrapperState.wasMultiple;
       
  7110   node._wrapperState.wasMultiple = !!props.multiple;
       
  7111 
       
  7112   var value = props.value;
       
  7113   if (value != null) {
       
  7114     updateOptions(node, !!props.multiple, value, false);
       
  7115   } else if (wasMultiple !== !!props.multiple) {
       
  7116     // For simplicity, reapply `defaultValue` if `multiple` is toggled.
       
  7117     if (props.defaultValue != null) {
       
  7118       updateOptions(node, !!props.multiple, props.defaultValue, true);
       
  7119     } else {
       
  7120       // Revert the select back to its default unselected state.
       
  7121       updateOptions(node, !!props.multiple, props.multiple ? [] : '', false);
       
  7122     }
       
  7123   }
       
  7124 }
       
  7125 
       
  7126 function restoreControlledState$2(element, props) {
       
  7127   var node = element;
       
  7128   var value = props.value;
       
  7129 
       
  7130   if (value != null) {
       
  7131     updateOptions(node, !!props.multiple, value, false);
       
  7132   }
       
  7133 }
       
  7134 
       
  7135 var didWarnValDefaultVal = false;
       
  7136 
       
  7137 /**
       
  7138  * Implements a <textarea> host component that allows setting `value`, and
       
  7139  * `defaultValue`. This differs from the traditional DOM API because value is
       
  7140  * usually set as PCDATA children.
       
  7141  *
       
  7142  * If `value` is not supplied (or null/undefined), user actions that affect the
       
  7143  * value will trigger updates to the element.
       
  7144  *
       
  7145  * If `value` is supplied (and not null/undefined), the rendered element will
       
  7146  * not trigger updates to the element. Instead, the `value` prop must change in
       
  7147  * order for the rendered element to be updated.
       
  7148  *
       
  7149  * The rendered element will be initialized with an empty value, the prop
       
  7150  * `defaultValue` if specified, or the children content (deprecated).
       
  7151  */
       
  7152 
       
  7153 function getHostProps$3(element, props) {
       
  7154   var node = element;
       
  7155   (function () {
       
  7156     if (!(props.dangerouslySetInnerHTML == null)) {
       
  7157       {
       
  7158         throw ReactError(Error('`dangerouslySetInnerHTML` does not make sense on <textarea>.'));
       
  7159       }
       
  7160     }
       
  7161   })();
       
  7162 
       
  7163   // Always set children to the same thing. In IE9, the selection range will
       
  7164   // get reset if `textContent` is mutated.  We could add a check in setTextContent
       
  7165   // to only set the value if/when the value differs from the node value (which would
       
  7166   // completely solve this IE9 bug), but Sebastian+Sophie seemed to like this
       
  7167   // solution. The value can be a boolean or object so that's why it's forced
       
  7168   // to be a string.
       
  7169   var hostProps = _assign({}, props, {
       
  7170     value: undefined,
       
  7171     defaultValue: undefined,
       
  7172     children: toString(node._wrapperState.initialValue)
       
  7173   });
       
  7174 
       
  7175   return hostProps;
       
  7176 }
       
  7177 
       
  7178 function initWrapperState$2(element, props) {
       
  7179   var node = element;
       
  7180   {
       
  7181     ReactControlledValuePropTypes.checkPropTypes('textarea', props);
       
  7182     if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValDefaultVal) {
       
  7183       warning$1(false, '%s contains a textarea with both value and defaultValue props. ' + 'Textarea elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled textarea ' + 'and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components', getCurrentFiberOwnerNameInDevOrNull() || 'A component');
       
  7184       didWarnValDefaultVal = true;
       
  7185     }
       
  7186   }
       
  7187 
       
  7188   var initialValue = props.value;
       
  7189 
       
  7190   // Only bother fetching default value if we're going to use it
       
  7191   if (initialValue == null) {
       
  7192     var defaultValue = props.defaultValue;
       
  7193     // TODO (yungsters): Remove support for children content in <textarea>.
       
  7194     var children = props.children;
       
  7195     if (children != null) {
       
  7196       {
       
  7197         warning$1(false, 'Use the `defaultValue` or `value` props instead of setting ' + 'children on <textarea>.');
       
  7198       }
       
  7199       (function () {
       
  7200         if (!(defaultValue == null)) {
       
  7201           {
       
  7202             throw ReactError(Error('If you supply `defaultValue` on a <textarea>, do not pass children.'));
       
  7203           }
       
  7204         }
       
  7205       })();
       
  7206       if (Array.isArray(children)) {
       
  7207         (function () {
       
  7208           if (!(children.length <= 1)) {
       
  7209             {
       
  7210               throw ReactError(Error('<textarea> can only have at most one child.'));
       
  7211             }
       
  7212           }
       
  7213         })();
       
  7214         children = children[0];
       
  7215       }
       
  7216 
       
  7217       defaultValue = children;
       
  7218     }
       
  7219     if (defaultValue == null) {
       
  7220       defaultValue = '';
       
  7221     }
       
  7222     initialValue = defaultValue;
       
  7223   }
       
  7224 
       
  7225   node._wrapperState = {
       
  7226     initialValue: getToStringValue(initialValue)
       
  7227   };
       
  7228 }
       
  7229 
       
  7230 function updateWrapper$1(element, props) {
       
  7231   var node = element;
       
  7232   var value = getToStringValue(props.value);
       
  7233   var defaultValue = getToStringValue(props.defaultValue);
       
  7234   if (value != null) {
       
  7235     // Cast `value` to a string to ensure the value is set correctly. While
       
  7236     // browsers typically do this as necessary, jsdom doesn't.
       
  7237     var newValue = toString(value);
       
  7238     // To avoid side effects (such as losing text selection), only set value if changed
       
  7239     if (newValue !== node.value) {
       
  7240       node.value = newValue;
       
  7241     }
       
  7242     if (props.defaultValue == null && node.defaultValue !== newValue) {
       
  7243       node.defaultValue = newValue;
       
  7244     }
       
  7245   }
       
  7246   if (defaultValue != null) {
       
  7247     node.defaultValue = toString(defaultValue);
       
  7248   }
       
  7249 }
       
  7250 
       
  7251 function postMountWrapper$3(element, props) {
       
  7252   var node = element;
       
  7253   // This is in postMount because we need access to the DOM node, which is not
       
  7254   // available until after the component has mounted.
       
  7255   var textContent = node.textContent;
       
  7256 
       
  7257   // Only set node.value if textContent is equal to the expected
       
  7258   // initial value. In IE10/IE11 there is a bug where the placeholder attribute
       
  7259   // will populate textContent as well.
       
  7260   // https://developer.microsoft.com/microsoft-edge/platform/issues/101525/
       
  7261   if (textContent === node._wrapperState.initialValue) {
       
  7262     node.value = textContent;
       
  7263   }
       
  7264 }
       
  7265 
       
  7266 function restoreControlledState$3(element, props) {
       
  7267   // DOM component is still mounted; update
       
  7268   updateWrapper$1(element, props);
       
  7269 }
       
  7270 
       
  7271 var HTML_NAMESPACE$1 = 'http://www.w3.org/1999/xhtml';
       
  7272 var MATH_NAMESPACE = 'http://www.w3.org/1998/Math/MathML';
       
  7273 var SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
       
  7274 
       
  7275 var Namespaces = {
       
  7276   html: HTML_NAMESPACE$1,
       
  7277   mathml: MATH_NAMESPACE,
       
  7278   svg: SVG_NAMESPACE
       
  7279 };
       
  7280 
       
  7281 // Assumes there is no parent namespace.
       
  7282 function getIntrinsicNamespace(type) {
       
  7283   switch (type) {
       
  7284     case 'svg':
       
  7285       return SVG_NAMESPACE;
       
  7286     case 'math':
       
  7287       return MATH_NAMESPACE;
       
  7288     default:
       
  7289       return HTML_NAMESPACE$1;
       
  7290   }
       
  7291 }
       
  7292 
       
  7293 function getChildNamespace(parentNamespace, type) {
       
  7294   if (parentNamespace == null || parentNamespace === HTML_NAMESPACE$1) {
       
  7295     // No (or default) parent namespace: potential entry point.
       
  7296     return getIntrinsicNamespace(type);
       
  7297   }
       
  7298   if (parentNamespace === SVG_NAMESPACE && type === 'foreignObject') {
       
  7299     // We're leaving SVG.
       
  7300     return HTML_NAMESPACE$1;
       
  7301   }
       
  7302   // By default, pass namespace below.
       
  7303   return parentNamespace;
       
  7304 }
       
  7305 
       
  7306 /* globals MSApp */
       
  7307 
       
  7308 /**
       
  7309  * Create a function which has 'unsafe' privileges (required by windows8 apps)
       
  7310  */
       
  7311 var createMicrosoftUnsafeLocalFunction = function (func) {
       
  7312   if (typeof MSApp !== 'undefined' && MSApp.execUnsafeLocalFunction) {
       
  7313     return function (arg0, arg1, arg2, arg3) {
       
  7314       MSApp.execUnsafeLocalFunction(function () {
       
  7315         return func(arg0, arg1, arg2, arg3);
       
  7316       });
  4592       });
  7317     };
  4593     };
  7318   } else {
  4594 
  7319     return func;
  4595     var warnHyphenatedStyleName = function (name) {
  7320   }
  4596       if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
  7321 };
  4597         return;
  7322 
  4598       }
  7323 // SVG temp container for IE lacking innerHTML
  4599 
  7324 var reusableSVGContainer = void 0;
  4600       warnedStyleNames[name] = true;
  7325 
  4601 
  7326 /**
  4602       error('Unsupported style property %s. Did you mean %s?', name, // As Andi Smith suggests
  7327  * Set the innerHTML property of a node
  4603       // (http://www.andismith.com/blog/2012/02/modernizr-prefixed/), an `-ms` prefix
  7328  *
  4604       // is converted to lowercase `ms`.
  7329  * @param {DOMElement} node
  4605       camelize(name.replace(msPattern$1, 'ms-')));
  7330  * @param {string} html
  4606     };
  7331  * @internal
  4607 
  7332  */
  4608     var warnBadVendoredStyleName = function (name) {
  7333 var setInnerHTML = createMicrosoftUnsafeLocalFunction(function (node, html) {
  4609       if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
  7334   // IE does not have innerHTML for SVG nodes, so instead we inject the
  4610         return;
  7335   // new markup in a temp node and then move the child nodes across into
  4611       }
  7336   // the target node
  4612 
  7337 
  4613       warnedStyleNames[name] = true;
  7338   if (node.namespaceURI === Namespaces.svg && !('innerHTML' in node)) {
  4614 
  7339     reusableSVGContainer = reusableSVGContainer || document.createElement('div');
  4615       error('Unsupported vendor-prefixed style property %s. Did you mean %s?', name, name.charAt(0).toUpperCase() + name.slice(1));
  7340     reusableSVGContainer.innerHTML = '<svg>' + html + '</svg>';
  4616     };
  7341     var svgNode = reusableSVGContainer.firstChild;
  4617 
  7342     while (node.firstChild) {
  4618     var warnStyleValueWithSemicolon = function (name, value) {
  7343       node.removeChild(node.firstChild);
  4619       if (warnedStyleValues.hasOwnProperty(value) && warnedStyleValues[value]) {
  7344     }
  4620         return;
  7345     while (svgNode.firstChild) {
  4621       }
  7346       node.appendChild(svgNode.firstChild);
  4622 
  7347     }
  4623       warnedStyleValues[value] = true;
  7348   } else {
  4624 
  7349     node.innerHTML = html;
  4625       error("Style property values shouldn't contain a semicolon. " + 'Try "%s: %s" instead.', name, value.replace(badStyleValueWithSemicolonPattern, ''));
  7350   }
  4626     };
  7351 });
  4627 
  7352 
  4628     var warnStyleValueIsNaN = function (name, value) {
  7353 /**
  4629       if (warnedForNaNValue) {
  7354  * Set the textContent property of a node. For text updates, it's faster
  4630         return;
  7355  * to set the `nodeValue` of the Text node directly instead of using
  4631       }
  7356  * `.textContent` which will remove the existing node and create a new one.
  4632 
  7357  *
  4633       warnedForNaNValue = true;
  7358  * @param {DOMElement} node
  4634 
  7359  * @param {string} text
  4635       error('`NaN` is an invalid value for the `%s` css style property.', name);
  7360  * @internal
  4636     };
  7361  */
  4637 
  7362 var setTextContent = function (node, text) {
  4638     var warnStyleValueIsInfinity = function (name, value) {
  7363   if (text) {
  4639       if (warnedForInfinityValue) {
  7364     var firstChild = node.firstChild;
  4640         return;
  7365 
  4641       }
  7366     if (firstChild && firstChild === node.lastChild && firstChild.nodeType === TEXT_NODE) {
  4642 
  7367       firstChild.nodeValue = text;
  4643       warnedForInfinityValue = true;
  7368       return;
  4644 
  7369     }
  4645       error('`Infinity` is an invalid value for the `%s` css style property.', name);
  7370   }
  4646     };
  7371   node.textContent = text;
  4647 
  7372 };
  4648     warnValidStyle = function (name, value) {
  7373 
  4649       if (name.indexOf('-') > -1) {
  7374 // List derived from Gecko source code:
  4650         warnHyphenatedStyleName(name);
  7375 // https://github.com/mozilla/gecko-dev/blob/4e638efc71/layout/style/test/property_database.js
  4651       } else if (badVendoredStyleNamePattern.test(name)) {
  7376 var shorthandToLonghand = {
  4652         warnBadVendoredStyleName(name);
  7377   animation: ['animationDelay', 'animationDirection', 'animationDuration', 'animationFillMode', 'animationIterationCount', 'animationName', 'animationPlayState', 'animationTimingFunction'],
  4653       } else if (badStyleValueWithSemicolonPattern.test(value)) {
  7378   background: ['backgroundAttachment', 'backgroundClip', 'backgroundColor', 'backgroundImage', 'backgroundOrigin', 'backgroundPositionX', 'backgroundPositionY', 'backgroundRepeat', 'backgroundSize'],
  4654         warnStyleValueWithSemicolon(name, value);
  7379   backgroundPosition: ['backgroundPositionX', 'backgroundPositionY'],
  4655       }
  7380   border: ['borderBottomColor', 'borderBottomStyle', 'borderBottomWidth', 'borderImageOutset', 'borderImageRepeat', 'borderImageSlice', 'borderImageSource', 'borderImageWidth', 'borderLeftColor', 'borderLeftStyle', 'borderLeftWidth', 'borderRightColor', 'borderRightStyle', 'borderRightWidth', 'borderTopColor', 'borderTopStyle', 'borderTopWidth'],
  4656 
  7381   borderBlockEnd: ['borderBlockEndColor', 'borderBlockEndStyle', 'borderBlockEndWidth'],
  4657       if (typeof value === 'number') {
  7382   borderBlockStart: ['borderBlockStartColor', 'borderBlockStartStyle', 'borderBlockStartWidth'],
  4658         if (isNaN(value)) {
  7383   borderBottom: ['borderBottomColor', 'borderBottomStyle', 'borderBottomWidth'],
  4659           warnStyleValueIsNaN(name, value);
  7384   borderColor: ['borderBottomColor', 'borderLeftColor', 'borderRightColor', 'borderTopColor'],
  4660         } else if (!isFinite(value)) {
  7385   borderImage: ['borderImageOutset', 'borderImageRepeat', 'borderImageSlice', 'borderImageSource', 'borderImageWidth'],
  4661           warnStyleValueIsInfinity(name, value);
  7386   borderInlineEnd: ['borderInlineEndColor', 'borderInlineEndStyle', 'borderInlineEndWidth'],
  4662         }
  7387   borderInlineStart: ['borderInlineStartColor', 'borderInlineStartStyle', 'borderInlineStartWidth'],
  4663       }
  7388   borderLeft: ['borderLeftColor', 'borderLeftStyle', 'borderLeftWidth'],
  4664     };
  7389   borderRadius: ['borderBottomLeftRadius', 'borderBottomRightRadius', 'borderTopLeftRadius', 'borderTopRightRadius'],
  4665   }
  7390   borderRight: ['borderRightColor', 'borderRightStyle', 'borderRightWidth'],
  4666 
  7391   borderStyle: ['borderBottomStyle', 'borderLeftStyle', 'borderRightStyle', 'borderTopStyle'],
  4667   var warnValidStyle$1 = warnValidStyle;
  7392   borderTop: ['borderTopColor', 'borderTopStyle', 'borderTopWidth'],
  4668 
  7393   borderWidth: ['borderBottomWidth', 'borderLeftWidth', 'borderRightWidth', 'borderTopWidth'],
  4669   /**
  7394   columnRule: ['columnRuleColor', 'columnRuleStyle', 'columnRuleWidth'],
  4670    * Operations for dealing with CSS properties.
  7395   columns: ['columnCount', 'columnWidth'],
  4671    */
  7396   flex: ['flexBasis', 'flexGrow', 'flexShrink'],
  4672 
  7397   flexFlow: ['flexDirection', 'flexWrap'],
  4673   /**
  7398   font: ['fontFamily', 'fontFeatureSettings', 'fontKerning', 'fontLanguageOverride', 'fontSize', 'fontSizeAdjust', 'fontStretch', 'fontStyle', 'fontVariant', 'fontVariantAlternates', 'fontVariantCaps', 'fontVariantEastAsian', 'fontVariantLigatures', 'fontVariantNumeric', 'fontVariantPosition', 'fontWeight', 'lineHeight'],
  4674    * This creates a string that is expected to be equivalent to the style
  7399   fontVariant: ['fontVariantAlternates', 'fontVariantCaps', 'fontVariantEastAsian', 'fontVariantLigatures', 'fontVariantNumeric', 'fontVariantPosition'],
  4675    * attribute generated by server-side rendering. It by-passes warnings and
  7400   gap: ['columnGap', 'rowGap'],
  4676    * security checks so it's not safe to use this value for anything other than
  7401   grid: ['gridAutoColumns', 'gridAutoFlow', 'gridAutoRows', 'gridTemplateAreas', 'gridTemplateColumns', 'gridTemplateRows'],
  4677    * comparison. It is only used in DEV for SSR validation.
  7402   gridArea: ['gridColumnEnd', 'gridColumnStart', 'gridRowEnd', 'gridRowStart'],
  4678    */
  7403   gridColumn: ['gridColumnEnd', 'gridColumnStart'],
  4679 
  7404   gridColumnGap: ['columnGap'],
  4680   function createDangerousStringForStyles(styles) {
  7405   gridGap: ['columnGap', 'rowGap'],
  4681     {
  7406   gridRow: ['gridRowEnd', 'gridRowStart'],
  4682       var serialized = '';
  7407   gridRowGap: ['rowGap'],
  4683       var delimiter = '';
  7408   gridTemplate: ['gridTemplateAreas', 'gridTemplateColumns', 'gridTemplateRows'],
  4684 
  7409   listStyle: ['listStyleImage', 'listStylePosition', 'listStyleType'],
  4685       for (var styleName in styles) {
  7410   margin: ['marginBottom', 'marginLeft', 'marginRight', 'marginTop'],
  4686         if (!styles.hasOwnProperty(styleName)) {
  7411   marker: ['markerEnd', 'markerMid', 'markerStart'],
  4687           continue;
  7412   mask: ['maskClip', 'maskComposite', 'maskImage', 'maskMode', 'maskOrigin', 'maskPositionX', 'maskPositionY', 'maskRepeat', 'maskSize'],
  4688         }
  7413   maskPosition: ['maskPositionX', 'maskPositionY'],
  4689 
  7414   outline: ['outlineColor', 'outlineStyle', 'outlineWidth'],
  4690         var styleValue = styles[styleName];
  7415   overflow: ['overflowX', 'overflowY'],
  4691 
  7416   padding: ['paddingBottom', 'paddingLeft', 'paddingRight', 'paddingTop'],
  4692         if (styleValue != null) {
  7417   placeContent: ['alignContent', 'justifyContent'],
  4693           var isCustomProperty = styleName.indexOf('--') === 0;
  7418   placeItems: ['alignItems', 'justifyItems'],
  4694           serialized += delimiter + (isCustomProperty ? styleName : hyphenateStyleName(styleName)) + ':';
  7419   placeSelf: ['alignSelf', 'justifySelf'],
  4695           serialized += dangerousStyleValue(styleName, styleValue, isCustomProperty);
  7420   textDecoration: ['textDecorationColor', 'textDecorationLine', 'textDecorationStyle'],
  4696           delimiter = ';';
  7421   textEmphasis: ['textEmphasisColor', 'textEmphasisStyle'],
  4697         }
  7422   transition: ['transitionDelay', 'transitionDuration', 'transitionProperty', 'transitionTimingFunction'],
  4698       }
  7423   wordWrap: ['overflowWrap']
  4699 
  7424 };
  4700       return serialized || null;
  7425 
  4701     }
  7426 /**
  4702   }
  7427  * CSS properties which accept numbers but are not in units of "px".
  4703   /**
  7428  */
  4704    * Sets the value for multiple styles on a node.  If a value is specified as
  7429 var isUnitlessNumber = {
  4705    * '' (empty string), the corresponding style property will be unset.
  7430   animationIterationCount: true,
  4706    *
  7431   borderImageOutset: true,
  4707    * @param {DOMElement} node
  7432   borderImageSlice: true,
  4708    * @param {object} styles
  7433   borderImageWidth: true,
  4709    */
  7434   boxFlex: true,
  4710 
  7435   boxFlexGroup: true,
  4711   function setValueForStyles(node, styles) {
  7436   boxOrdinalGroup: true,
  4712     var style = node.style;
  7437   columnCount: true,
  4713 
  7438   columns: true,
       
  7439   flex: true,
       
  7440   flexGrow: true,
       
  7441   flexPositive: true,
       
  7442   flexShrink: true,
       
  7443   flexNegative: true,
       
  7444   flexOrder: true,
       
  7445   gridArea: true,
       
  7446   gridRow: true,
       
  7447   gridRowEnd: true,
       
  7448   gridRowSpan: true,
       
  7449   gridRowStart: true,
       
  7450   gridColumn: true,
       
  7451   gridColumnEnd: true,
       
  7452   gridColumnSpan: true,
       
  7453   gridColumnStart: true,
       
  7454   fontWeight: true,
       
  7455   lineClamp: true,
       
  7456   lineHeight: true,
       
  7457   opacity: true,
       
  7458   order: true,
       
  7459   orphans: true,
       
  7460   tabSize: true,
       
  7461   widows: true,
       
  7462   zIndex: true,
       
  7463   zoom: true,
       
  7464 
       
  7465   // SVG-related properties
       
  7466   fillOpacity: true,
       
  7467   floodOpacity: true,
       
  7468   stopOpacity: true,
       
  7469   strokeDasharray: true,
       
  7470   strokeDashoffset: true,
       
  7471   strokeMiterlimit: true,
       
  7472   strokeOpacity: true,
       
  7473   strokeWidth: true
       
  7474 };
       
  7475 
       
  7476 /**
       
  7477  * @param {string} prefix vendor-specific prefix, eg: Webkit
       
  7478  * @param {string} key style name, eg: transitionDuration
       
  7479  * @return {string} style name prefixed with `prefix`, properly camelCased, eg:
       
  7480  * WebkitTransitionDuration
       
  7481  */
       
  7482 function prefixKey(prefix, key) {
       
  7483   return prefix + key.charAt(0).toUpperCase() + key.substring(1);
       
  7484 }
       
  7485 
       
  7486 /**
       
  7487  * Support style names that may come passed in prefixed by adding permutations
       
  7488  * of vendor prefixes.
       
  7489  */
       
  7490 var prefixes = ['Webkit', 'ms', 'Moz', 'O'];
       
  7491 
       
  7492 // Using Object.keys here, or else the vanilla for-in loop makes IE8 go into an
       
  7493 // infinite loop, because it iterates over the newly added props too.
       
  7494 Object.keys(isUnitlessNumber).forEach(function (prop) {
       
  7495   prefixes.forEach(function (prefix) {
       
  7496     isUnitlessNumber[prefixKey(prefix, prop)] = isUnitlessNumber[prop];
       
  7497   });
       
  7498 });
       
  7499 
       
  7500 /**
       
  7501  * Convert a value into the proper css writable value. The style name `name`
       
  7502  * should be logical (no hyphens), as specified
       
  7503  * in `CSSProperty.isUnitlessNumber`.
       
  7504  *
       
  7505  * @param {string} name CSS property name such as `topMargin`.
       
  7506  * @param {*} value CSS property value such as `10px`.
       
  7507  * @return {string} Normalized style value with dimensions applied.
       
  7508  */
       
  7509 function dangerousStyleValue(name, value, isCustomProperty) {
       
  7510   // Note that we've removed escapeTextForBrowser() calls here since the
       
  7511   // whole string will be escaped when the attribute is injected into
       
  7512   // the markup. If you provide unsafe user data here they can inject
       
  7513   // arbitrary CSS which may be problematic (I couldn't repro this):
       
  7514   // https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet
       
  7515   // http://www.thespanner.co.uk/2007/11/26/ultimate-xss-css-injection/
       
  7516   // This is not an XSS hole but instead a potential CSS injection issue
       
  7517   // which has lead to a greater discussion about how we're going to
       
  7518   // trust URLs moving forward. See #2115901
       
  7519 
       
  7520   var isEmpty = value == null || typeof value === 'boolean' || value === '';
       
  7521   if (isEmpty) {
       
  7522     return '';
       
  7523   }
       
  7524 
       
  7525   if (!isCustomProperty && typeof value === 'number' && value !== 0 && !(isUnitlessNumber.hasOwnProperty(name) && isUnitlessNumber[name])) {
       
  7526     return value + 'px'; // Presumes implicit 'px' suffix for unitless numbers
       
  7527   }
       
  7528 
       
  7529   return ('' + value).trim();
       
  7530 }
       
  7531 
       
  7532 var uppercasePattern = /([A-Z])/g;
       
  7533 var msPattern = /^ms-/;
       
  7534 
       
  7535 /**
       
  7536  * Hyphenates a camelcased CSS property name, for example:
       
  7537  *
       
  7538  *   > hyphenateStyleName('backgroundColor')
       
  7539  *   < "background-color"
       
  7540  *   > hyphenateStyleName('MozTransition')
       
  7541  *   < "-moz-transition"
       
  7542  *   > hyphenateStyleName('msTransition')
       
  7543  *   < "-ms-transition"
       
  7544  *
       
  7545  * As Modernizr suggests (http://modernizr.com/docs/#prefixed), an `ms` prefix
       
  7546  * is converted to `-ms-`.
       
  7547  */
       
  7548 function hyphenateStyleName(name) {
       
  7549   return name.replace(uppercasePattern, '-$1').toLowerCase().replace(msPattern, '-ms-');
       
  7550 }
       
  7551 
       
  7552 var warnValidStyle = function () {};
       
  7553 
       
  7554 {
       
  7555   // 'msTransform' is correct, but the other prefixes should be capitalized
       
  7556   var badVendoredStyleNamePattern = /^(?:webkit|moz|o)[A-Z]/;
       
  7557   var msPattern$1 = /^-ms-/;
       
  7558   var hyphenPattern = /-(.)/g;
       
  7559 
       
  7560   // style values shouldn't contain a semicolon
       
  7561   var badStyleValueWithSemicolonPattern = /;\s*$/;
       
  7562 
       
  7563   var warnedStyleNames = {};
       
  7564   var warnedStyleValues = {};
       
  7565   var warnedForNaNValue = false;
       
  7566   var warnedForInfinityValue = false;
       
  7567 
       
  7568   var camelize = function (string) {
       
  7569     return string.replace(hyphenPattern, function (_, character) {
       
  7570       return character.toUpperCase();
       
  7571     });
       
  7572   };
       
  7573 
       
  7574   var warnHyphenatedStyleName = function (name) {
       
  7575     if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
       
  7576       return;
       
  7577     }
       
  7578 
       
  7579     warnedStyleNames[name] = true;
       
  7580     warning$1(false, 'Unsupported style property %s. Did you mean %s?', name,
       
  7581     // As Andi Smith suggests
       
  7582     // (http://www.andismith.com/blog/2012/02/modernizr-prefixed/), an `-ms` prefix
       
  7583     // is converted to lowercase `ms`.
       
  7584     camelize(name.replace(msPattern$1, 'ms-')));
       
  7585   };
       
  7586 
       
  7587   var warnBadVendoredStyleName = function (name) {
       
  7588     if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
       
  7589       return;
       
  7590     }
       
  7591 
       
  7592     warnedStyleNames[name] = true;
       
  7593     warning$1(false, 'Unsupported vendor-prefixed style property %s. Did you mean %s?', name, name.charAt(0).toUpperCase() + name.slice(1));
       
  7594   };
       
  7595 
       
  7596   var warnStyleValueWithSemicolon = function (name, value) {
       
  7597     if (warnedStyleValues.hasOwnProperty(value) && warnedStyleValues[value]) {
       
  7598       return;
       
  7599     }
       
  7600 
       
  7601     warnedStyleValues[value] = true;
       
  7602     warning$1(false, "Style property values shouldn't contain a semicolon. " + 'Try "%s: %s" instead.', name, value.replace(badStyleValueWithSemicolonPattern, ''));
       
  7603   };
       
  7604 
       
  7605   var warnStyleValueIsNaN = function (name, value) {
       
  7606     if (warnedForNaNValue) {
       
  7607       return;
       
  7608     }
       
  7609 
       
  7610     warnedForNaNValue = true;
       
  7611     warning$1(false, '`NaN` is an invalid value for the `%s` css style property.', name);
       
  7612   };
       
  7613 
       
  7614   var warnStyleValueIsInfinity = function (name, value) {
       
  7615     if (warnedForInfinityValue) {
       
  7616       return;
       
  7617     }
       
  7618 
       
  7619     warnedForInfinityValue = true;
       
  7620     warning$1(false, '`Infinity` is an invalid value for the `%s` css style property.', name);
       
  7621   };
       
  7622 
       
  7623   warnValidStyle = function (name, value) {
       
  7624     if (name.indexOf('-') > -1) {
       
  7625       warnHyphenatedStyleName(name);
       
  7626     } else if (badVendoredStyleNamePattern.test(name)) {
       
  7627       warnBadVendoredStyleName(name);
       
  7628     } else if (badStyleValueWithSemicolonPattern.test(value)) {
       
  7629       warnStyleValueWithSemicolon(name, value);
       
  7630     }
       
  7631 
       
  7632     if (typeof value === 'number') {
       
  7633       if (isNaN(value)) {
       
  7634         warnStyleValueIsNaN(name, value);
       
  7635       } else if (!isFinite(value)) {
       
  7636         warnStyleValueIsInfinity(name, value);
       
  7637       }
       
  7638     }
       
  7639   };
       
  7640 }
       
  7641 
       
  7642 var warnValidStyle$1 = warnValidStyle;
       
  7643 
       
  7644 /**
       
  7645  * Operations for dealing with CSS properties.
       
  7646  */
       
  7647 
       
  7648 /**
       
  7649  * This creates a string that is expected to be equivalent to the style
       
  7650  * attribute generated by server-side rendering. It by-passes warnings and
       
  7651  * security checks so it's not safe to use this value for anything other than
       
  7652  * comparison. It is only used in DEV for SSR validation.
       
  7653  */
       
  7654 function createDangerousStringForStyles(styles) {
       
  7655   {
       
  7656     var serialized = '';
       
  7657     var delimiter = '';
       
  7658     for (var styleName in styles) {
  4714     for (var styleName in styles) {
  7659       if (!styles.hasOwnProperty(styleName)) {
  4715       if (!styles.hasOwnProperty(styleName)) {
  7660         continue;
  4716         continue;
  7661       }
  4717       }
  7662       var styleValue = styles[styleName];
  4718 
  7663       if (styleValue != null) {
  4719       var isCustomProperty = styleName.indexOf('--') === 0;
  7664         var isCustomProperty = styleName.indexOf('--') === 0;
  4720 
  7665         serialized += delimiter + (isCustomProperty ? styleName : hyphenateStyleName(styleName)) + ':';
  4721       {
  7666         serialized += dangerousStyleValue(styleName, styleValue, isCustomProperty);
  4722         if (!isCustomProperty) {
  7667 
  4723           warnValidStyle$1(styleName, styles[styleName]);
  7668         delimiter = ';';
  4724         }
  7669       }
  4725       }
  7670     }
  4726 
  7671     return serialized || null;
  4727       var styleValue = dangerousStyleValue(styleName, styles[styleName], isCustomProperty);
  7672   }
  4728 
  7673 }
  4729       if (styleName === 'float') {
  7674 
  4730         styleName = 'cssFloat';
  7675 /**
  4731       }
  7676  * Sets the value for multiple styles on a node.  If a value is specified as
  4732 
  7677  * '' (empty string), the corresponding style property will be unset.
  4733       if (isCustomProperty) {
  7678  *
  4734         style.setProperty(styleName, styleValue);
  7679  * @param {DOMElement} node
  4735       } else {
  7680  * @param {object} styles
  4736         style[styleName] = styleValue;
  7681  */
  4737       }
  7682 function setValueForStyles(node, styles) {
  4738     }
  7683   var style = node.style;
  4739   }
  7684   for (var styleName in styles) {
  4740 
  7685     if (!styles.hasOwnProperty(styleName)) {
  4741   function isValueEmpty(value) {
  7686       continue;
  4742     return value == null || typeof value === 'boolean' || value === '';
  7687     }
  4743   }
  7688     var isCustomProperty = styleName.indexOf('--') === 0;
  4744   /**
       
  4745    * Given {color: 'red', overflow: 'hidden'} returns {
       
  4746    *   color: 'color',
       
  4747    *   overflowX: 'overflow',
       
  4748    *   overflowY: 'overflow',
       
  4749    * }. This can be read as "the overflowY property was set by the overflow
       
  4750    * shorthand". That is, the values are the property that each was derived from.
       
  4751    */
       
  4752 
       
  4753 
       
  4754   function expandShorthandMap(styles) {
       
  4755     var expanded = {};
       
  4756 
       
  4757     for (var key in styles) {
       
  4758       var longhands = shorthandToLonghand[key] || [key];
       
  4759 
       
  4760       for (var i = 0; i < longhands.length; i++) {
       
  4761         expanded[longhands[i]] = key;
       
  4762       }
       
  4763     }
       
  4764 
       
  4765     return expanded;
       
  4766   }
       
  4767   /**
       
  4768    * When mixing shorthand and longhand property names, we warn during updates if
       
  4769    * we expect an incorrect result to occur. In particular, we warn for:
       
  4770    *
       
  4771    * Updating a shorthand property (longhand gets overwritten):
       
  4772    *   {font: 'foo', fontVariant: 'bar'} -> {font: 'baz', fontVariant: 'bar'}
       
  4773    *   becomes .style.font = 'baz'
       
  4774    * Removing a shorthand property (longhand gets lost too):
       
  4775    *   {font: 'foo', fontVariant: 'bar'} -> {fontVariant: 'bar'}
       
  4776    *   becomes .style.font = ''
       
  4777    * Removing a longhand property (should revert to shorthand; doesn't):
       
  4778    *   {font: 'foo', fontVariant: 'bar'} -> {font: 'foo'}
       
  4779    *   becomes .style.fontVariant = ''
       
  4780    */
       
  4781 
       
  4782 
       
  4783   function validateShorthandPropertyCollisionInDev(styleUpdates, nextStyles) {
  7689     {
  4784     {
  7690       if (!isCustomProperty) {
  4785 
  7691         warnValidStyle$1(styleName, styles[styleName]);
  4786       if (!nextStyles) {
  7692       }
  4787         return;
  7693     }
  4788       }
  7694     var styleValue = dangerousStyleValue(styleName, styles[styleName], isCustomProperty);
  4789 
  7695     if (styleName === 'float') {
  4790       var expandedUpdates = expandShorthandMap(styleUpdates);
  7696       styleName = 'cssFloat';
  4791       var expandedStyles = expandShorthandMap(nextStyles);
  7697     }
  4792       var warnedAbout = {};
  7698     if (isCustomProperty) {
  4793 
  7699       style.setProperty(styleName, styleValue);
  4794       for (var key in expandedUpdates) {
  7700     } else {
  4795         var originalKey = expandedUpdates[key];
  7701       style[styleName] = styleValue;
  4796         var correctOriginalKey = expandedStyles[key];
  7702     }
  4797 
  7703   }
  4798         if (correctOriginalKey && originalKey !== correctOriginalKey) {
  7704 }
  4799           var warningKey = originalKey + ',' + correctOriginalKey;
  7705 
  4800 
  7706 function isValueEmpty(value) {
  4801           if (warnedAbout[warningKey]) {
  7707   return value == null || typeof value === 'boolean' || value === '';
  4802             continue;
  7708 }
  4803           }
  7709 
  4804 
  7710 /**
  4805           warnedAbout[warningKey] = true;
  7711  * Given {color: 'red', overflow: 'hidden'} returns {
  4806 
  7712  *   color: 'color',
  4807           error('%s a style property during rerender (%s) when a ' + 'conflicting property is set (%s) can lead to styling bugs. To ' + "avoid this, don't mix shorthand and non-shorthand properties " + 'for the same value; instead, replace the shorthand with ' + 'separate values.', isValueEmpty(styleUpdates[originalKey]) ? 'Removing' : 'Updating', originalKey, correctOriginalKey);
  7713  *   overflowX: 'overflow',
  4808         }
  7714  *   overflowY: 'overflow',
  4809       }
  7715  * }. This can be read as "the overflowY property was set by the overflow
  4810     }
  7716  * shorthand". That is, the values are the property that each was derived from.
  4811   }
  7717  */
  4812 
  7718 function expandShorthandMap(styles) {
  4813   // For HTML, certain tags should omit their close tag. We keep a whitelist for
  7719   var expanded = {};
  4814   // those special-case tags.
  7720   for (var key in styles) {
  4815   var omittedCloseTags = {
  7721     var longhands = shorthandToLonghand[key] || [key];
  4816     area: true,
  7722     for (var i = 0; i < longhands.length; i++) {
  4817     base: true,
  7723       expanded[longhands[i]] = key;
  4818     br: true,
  7724     }
  4819     col: true,
  7725   }
  4820     embed: true,
  7726   return expanded;
  4821     hr: true,
  7727 }
  4822     img: true,
  7728 
  4823     input: true,
  7729 /**
  4824     keygen: true,
  7730  * When mixing shorthand and longhand property names, we warn during updates if
  4825     link: true,
  7731  * we expect an incorrect result to occur. In particular, we warn for:
  4826     meta: true,
  7732  *
  4827     param: true,
  7733  * Updating a shorthand property (longhand gets overwritten):
  4828     source: true,
  7734  *   {font: 'foo', fontVariant: 'bar'} -> {font: 'baz', fontVariant: 'bar'}
  4829     track: true,
  7735  *   becomes .style.font = 'baz'
  4830     wbr: true // NOTE: menuitem's close tag should be omitted, but that causes problems.
  7736  * Removing a shorthand property (longhand gets lost too):
  4831 
  7737  *   {font: 'foo', fontVariant: 'bar'} -> {fontVariant: 'bar'}
  4832   };
  7738  *   becomes .style.font = ''
  4833 
  7739  * Removing a longhand property (should revert to shorthand; doesn't):
  4834   // `omittedCloseTags` except that `menuitem` should still have its closing tag.
  7740  *   {font: 'foo', fontVariant: 'bar'} -> {font: 'foo'}
  4835 
  7741  *   becomes .style.fontVariant = ''
  4836   var voidElementTags = _assign({
  7742  */
  4837     menuitem: true
  7743 function validateShorthandPropertyCollisionInDev(styleUpdates, nextStyles) {
  4838   }, omittedCloseTags);
  7744   if (!warnAboutShorthandPropertyCollision) {
  4839 
  7745     return;
  4840   var HTML = '__html';
  7746   }
  4841   var ReactDebugCurrentFrame$3 = null;
  7747 
  4842 
  7748   if (!nextStyles) {
  4843   {
  7749     return;
  4844     ReactDebugCurrentFrame$3 = ReactSharedInternals.ReactDebugCurrentFrame;
  7750   }
  4845   }
  7751 
  4846 
  7752   var expandedUpdates = expandShorthandMap(styleUpdates);
  4847   function assertValidProps(tag, props) {
  7753   var expandedStyles = expandShorthandMap(nextStyles);
  4848     if (!props) {
  7754   var warnedAbout = {};
  4849       return;
  7755   for (var key in expandedUpdates) {
  4850     } // Note the use of `==` which checks for null or undefined.
  7756     var originalKey = expandedUpdates[key];
  4851 
  7757     var correctOriginalKey = expandedStyles[key];
  4852 
  7758     if (correctOriginalKey && originalKey !== correctOriginalKey) {
  4853     if (voidElementTags[tag]) {
  7759       var warningKey = originalKey + ',' + correctOriginalKey;
       
  7760       if (warnedAbout[warningKey]) {
       
  7761         continue;
       
  7762       }
       
  7763       warnedAbout[warningKey] = true;
       
  7764       warning$1(false, '%s a style property during rerender (%s) when a ' + 'conflicting property is set (%s) can lead to styling bugs. To ' + "avoid this, don't mix shorthand and non-shorthand properties " + 'for the same value; instead, replace the shorthand with ' + 'separate values.', isValueEmpty(styleUpdates[originalKey]) ? 'Removing' : 'Updating', originalKey, correctOriginalKey);
       
  7765     }
       
  7766   }
       
  7767 }
       
  7768 
       
  7769 // For HTML, certain tags should omit their close tag. We keep a whitelist for
       
  7770 // those special-case tags.
       
  7771 
       
  7772 var omittedCloseTags = {
       
  7773   area: true,
       
  7774   base: true,
       
  7775   br: true,
       
  7776   col: true,
       
  7777   embed: true,
       
  7778   hr: true,
       
  7779   img: true,
       
  7780   input: true,
       
  7781   keygen: true,
       
  7782   link: true,
       
  7783   meta: true,
       
  7784   param: true,
       
  7785   source: true,
       
  7786   track: true,
       
  7787   wbr: true
       
  7788   // NOTE: menuitem's close tag should be omitted, but that causes problems.
       
  7789 };
       
  7790 
       
  7791 // For HTML, certain tags cannot have children. This has the same purpose as
       
  7792 // `omittedCloseTags` except that `menuitem` should still have its closing tag.
       
  7793 
       
  7794 var voidElementTags = _assign({
       
  7795   menuitem: true
       
  7796 }, omittedCloseTags);
       
  7797 
       
  7798 // TODO: We can remove this if we add invariantWithStack()
       
  7799 // or add stack by default to invariants where possible.
       
  7800 var HTML$1 = '__html';
       
  7801 
       
  7802 var ReactDebugCurrentFrame$3 = null;
       
  7803 {
       
  7804   ReactDebugCurrentFrame$3 = ReactSharedInternals.ReactDebugCurrentFrame;
       
  7805 }
       
  7806 
       
  7807 function assertValidProps(tag, props) {
       
  7808   if (!props) {
       
  7809     return;
       
  7810   }
       
  7811   // Note the use of `==` which checks for null or undefined.
       
  7812   if (voidElementTags[tag]) {
       
  7813     (function () {
       
  7814       if (!(props.children == null && props.dangerouslySetInnerHTML == null)) {
  4854       if (!(props.children == null && props.dangerouslySetInnerHTML == null)) {
  7815         {
  4855         {
  7816           throw ReactError(Error(tag + ' is a void element tag and must neither have `children` nor use `dangerouslySetInnerHTML`.' + (ReactDebugCurrentFrame$3.getStackAddendum())));
  4856           throw Error( tag + " is a void element tag and must neither have `children` nor use `dangerouslySetInnerHTML`." + ( ReactDebugCurrentFrame$3.getStackAddendum() ) );
  7817         }
  4857         }
  7818       }
  4858       }
  7819     })();
  4859     }
  7820   }
  4860 
  7821   if (props.dangerouslySetInnerHTML != null) {
  4861     if (props.dangerouslySetInnerHTML != null) {
  7822     (function () {
       
  7823       if (!(props.children == null)) {
  4862       if (!(props.children == null)) {
  7824         {
  4863         {
  7825           throw ReactError(Error('Can only set one of `children` or `props.dangerouslySetInnerHTML`.'));
  4864           throw Error( "Can only set one of `children` or `props.dangerouslySetInnerHTML`." );
  7826         }
  4865         }
  7827       }
  4866       }
  7828     })();
  4867 
  7829     (function () {
  4868       if (!(typeof props.dangerouslySetInnerHTML === 'object' && HTML in props.dangerouslySetInnerHTML)) {
  7830       if (!(typeof props.dangerouslySetInnerHTML === 'object' && HTML$1 in props.dangerouslySetInnerHTML)) {
       
  7831         {
  4869         {
  7832           throw ReactError(Error('`props.dangerouslySetInnerHTML` must be in the form `{__html: ...}`. Please visit https://fb.me/react-invariant-dangerously-set-inner-html for more information.'));
  4870           throw Error( "`props.dangerouslySetInnerHTML` must be in the form `{__html: ...}`. Please visit https://fb.me/react-invariant-dangerously-set-inner-html for more information." );
  7833         }
  4871         }
  7834       }
  4872       }
  7835     })();
  4873     }
  7836   }
  4874 
  7837   {
  4875     {
  7838     !(props.suppressContentEditableWarning || !props.contentEditable || props.children == null) ? warning$1(false, 'A component is `contentEditable` and contains `children` managed by ' + 'React. It is now your responsibility to guarantee that none of ' + 'those nodes are unexpectedly modified or duplicated. This is ' + 'probably not intentional.') : void 0;
  4876       if (!props.suppressContentEditableWarning && props.contentEditable && props.children != null) {
  7839   }
  4877         error('A component is `contentEditable` and contains `children` managed by ' + 'React. It is now your responsibility to guarantee that none of ' + 'those nodes are unexpectedly modified or duplicated. This is ' + 'probably not intentional.');
  7840   (function () {
  4878       }
       
  4879     }
       
  4880 
  7841     if (!(props.style == null || typeof props.style === 'object')) {
  4881     if (!(props.style == null || typeof props.style === 'object')) {
  7842       {
  4882       {
  7843         throw ReactError(Error('The `style` prop expects a mapping from style properties to values, not a string. For example, style={{marginRight: spacing + \'em\'}} when using JSX.' + (ReactDebugCurrentFrame$3.getStackAddendum())));
  4883         throw Error( "The `style` prop expects a mapping from style properties to values, not a string. For example, style={{marginRight: spacing + 'em'}} when using JSX." + ( ReactDebugCurrentFrame$3.getStackAddendum() ) );
  7844       }
  4884       }
  7845     }
  4885     }
  7846   })();
  4886   }
  7847 }
  4887 
  7848 
  4888   function isCustomComponent(tagName, props) {
  7849 function isCustomComponent(tagName, props) {
  4889     if (tagName.indexOf('-') === -1) {
  7850   if (tagName.indexOf('-') === -1) {
  4890       return typeof props.is === 'string';
  7851     return typeof props.is === 'string';
  4891     }
  7852   }
  4892 
  7853   switch (tagName) {
  4893     switch (tagName) {
  7854     // These are reserved SVG and MathML elements.
  4894       // These are reserved SVG and MathML elements.
  7855     // We don't mind this whitelist too much because we expect it to never grow.
  4895       // We don't mind this whitelist too much because we expect it to never grow.
  7856     // The alternative is to track the namespace in a few places which is convoluted.
  4896       // The alternative is to track the namespace in a few places which is convoluted.
  7857     // https://w3c.github.io/webcomponents/spec/custom/#custom-elements-core-concepts
  4897       // https://w3c.github.io/webcomponents/spec/custom/#custom-elements-core-concepts
  7858     case 'annotation-xml':
  4898       case 'annotation-xml':
  7859     case 'color-profile':
  4899       case 'color-profile':
  7860     case 'font-face':
  4900       case 'font-face':
  7861     case 'font-face-src':
  4901       case 'font-face-src':
  7862     case 'font-face-uri':
  4902       case 'font-face-uri':
  7863     case 'font-face-format':
  4903       case 'font-face-format':
  7864     case 'font-face-name':
  4904       case 'font-face-name':
  7865     case 'missing-glyph':
  4905       case 'missing-glyph':
  7866       return false;
  4906         return false;
  7867     default:
  4907 
  7868       return true;
  4908       default:
  7869   }
  4909         return true;
  7870 }
  4910     }
  7871 
  4911   }
  7872 // When adding attributes to the HTML or SVG whitelist, be sure to
  4912 
  7873 // also add them to this module to ensure casing and incorrect name
  4913   // When adding attributes to the HTML or SVG whitelist, be sure to
  7874 // warnings.
  4914   // also add them to this module to ensure casing and incorrect name
  7875 var possibleStandardNames = {
  4915   // warnings.
  7876   // HTML
  4916   var possibleStandardNames = {
  7877   accept: 'accept',
  4917     // HTML
  7878   acceptcharset: 'acceptCharset',
  4918     accept: 'accept',
  7879   'accept-charset': 'acceptCharset',
  4919     acceptcharset: 'acceptCharset',
  7880   accesskey: 'accessKey',
  4920     'accept-charset': 'acceptCharset',
  7881   action: 'action',
  4921     accesskey: 'accessKey',
  7882   allowfullscreen: 'allowFullScreen',
  4922     action: 'action',
  7883   alt: 'alt',
  4923     allowfullscreen: 'allowFullScreen',
  7884   as: 'as',
  4924     alt: 'alt',
  7885   async: 'async',
  4925     as: 'as',
  7886   autocapitalize: 'autoCapitalize',
  4926     async: 'async',
  7887   autocomplete: 'autoComplete',
  4927     autocapitalize: 'autoCapitalize',
  7888   autocorrect: 'autoCorrect',
  4928     autocomplete: 'autoComplete',
  7889   autofocus: 'autoFocus',
  4929     autocorrect: 'autoCorrect',
  7890   autoplay: 'autoPlay',
  4930     autofocus: 'autoFocus',
  7891   autosave: 'autoSave',
  4931     autoplay: 'autoPlay',
  7892   capture: 'capture',
  4932     autosave: 'autoSave',
  7893   cellpadding: 'cellPadding',
  4933     capture: 'capture',
  7894   cellspacing: 'cellSpacing',
  4934     cellpadding: 'cellPadding',
  7895   challenge: 'challenge',
  4935     cellspacing: 'cellSpacing',
  7896   charset: 'charSet',
  4936     challenge: 'challenge',
  7897   checked: 'checked',
  4937     charset: 'charSet',
  7898   children: 'children',
  4938     checked: 'checked',
  7899   cite: 'cite',
  4939     children: 'children',
  7900   class: 'className',
  4940     cite: 'cite',
  7901   classid: 'classID',
  4941     class: 'className',
  7902   classname: 'className',
  4942     classid: 'classID',
  7903   cols: 'cols',
  4943     classname: 'className',
  7904   colspan: 'colSpan',
  4944     cols: 'cols',
  7905   content: 'content',
  4945     colspan: 'colSpan',
  7906   contenteditable: 'contentEditable',
  4946     content: 'content',
  7907   contextmenu: 'contextMenu',
  4947     contenteditable: 'contentEditable',
  7908   controls: 'controls',
  4948     contextmenu: 'contextMenu',
  7909   controlslist: 'controlsList',
  4949     controls: 'controls',
  7910   coords: 'coords',
  4950     controlslist: 'controlsList',
  7911   crossorigin: 'crossOrigin',
  4951     coords: 'coords',
  7912   dangerouslysetinnerhtml: 'dangerouslySetInnerHTML',
  4952     crossorigin: 'crossOrigin',
  7913   data: 'data',
  4953     dangerouslysetinnerhtml: 'dangerouslySetInnerHTML',
  7914   datetime: 'dateTime',
  4954     data: 'data',
  7915   default: 'default',
  4955     datetime: 'dateTime',
  7916   defaultchecked: 'defaultChecked',
  4956     default: 'default',
  7917   defaultvalue: 'defaultValue',
  4957     defaultchecked: 'defaultChecked',
  7918   defer: 'defer',
  4958     defaultvalue: 'defaultValue',
  7919   dir: 'dir',
  4959     defer: 'defer',
  7920   disabled: 'disabled',
  4960     dir: 'dir',
  7921   disablepictureinpicture: 'disablePictureInPicture',
  4961     disabled: 'disabled',
  7922   download: 'download',
  4962     disablepictureinpicture: 'disablePictureInPicture',
  7923   draggable: 'draggable',
  4963     download: 'download',
  7924   enctype: 'encType',
  4964     draggable: 'draggable',
  7925   for: 'htmlFor',
  4965     enctype: 'encType',
  7926   form: 'form',
  4966     for: 'htmlFor',
  7927   formmethod: 'formMethod',
  4967     form: 'form',
  7928   formaction: 'formAction',
  4968     formmethod: 'formMethod',
  7929   formenctype: 'formEncType',
  4969     formaction: 'formAction',
  7930   formnovalidate: 'formNoValidate',
  4970     formenctype: 'formEncType',
  7931   formtarget: 'formTarget',
  4971     formnovalidate: 'formNoValidate',
  7932   frameborder: 'frameBorder',
  4972     formtarget: 'formTarget',
  7933   headers: 'headers',
  4973     frameborder: 'frameBorder',
  7934   height: 'height',
  4974     headers: 'headers',
  7935   hidden: 'hidden',
  4975     height: 'height',
  7936   high: 'high',
  4976     hidden: 'hidden',
  7937   href: 'href',
  4977     high: 'high',
  7938   hreflang: 'hrefLang',
  4978     href: 'href',
  7939   htmlfor: 'htmlFor',
  4979     hreflang: 'hrefLang',
  7940   httpequiv: 'httpEquiv',
  4980     htmlfor: 'htmlFor',
  7941   'http-equiv': 'httpEquiv',
  4981     httpequiv: 'httpEquiv',
  7942   icon: 'icon',
  4982     'http-equiv': 'httpEquiv',
  7943   id: 'id',
  4983     icon: 'icon',
  7944   innerhtml: 'innerHTML',
  4984     id: 'id',
  7945   inputmode: 'inputMode',
  4985     innerhtml: 'innerHTML',
  7946   integrity: 'integrity',
  4986     inputmode: 'inputMode',
  7947   is: 'is',
  4987     integrity: 'integrity',
  7948   itemid: 'itemID',
  4988     is: 'is',
  7949   itemprop: 'itemProp',
  4989     itemid: 'itemID',
  7950   itemref: 'itemRef',
  4990     itemprop: 'itemProp',
  7951   itemscope: 'itemScope',
  4991     itemref: 'itemRef',
  7952   itemtype: 'itemType',
  4992     itemscope: 'itemScope',
  7953   keyparams: 'keyParams',
  4993     itemtype: 'itemType',
  7954   keytype: 'keyType',
  4994     keyparams: 'keyParams',
  7955   kind: 'kind',
  4995     keytype: 'keyType',
  7956   label: 'label',
  4996     kind: 'kind',
  7957   lang: 'lang',
  4997     label: 'label',
  7958   list: 'list',
  4998     lang: 'lang',
  7959   loop: 'loop',
  4999     list: 'list',
  7960   low: 'low',
  5000     loop: 'loop',
  7961   manifest: 'manifest',
  5001     low: 'low',
  7962   marginwidth: 'marginWidth',
  5002     manifest: 'manifest',
  7963   marginheight: 'marginHeight',
  5003     marginwidth: 'marginWidth',
  7964   max: 'max',
  5004     marginheight: 'marginHeight',
  7965   maxlength: 'maxLength',
  5005     max: 'max',
  7966   media: 'media',
  5006     maxlength: 'maxLength',
  7967   mediagroup: 'mediaGroup',
  5007     media: 'media',
  7968   method: 'method',
  5008     mediagroup: 'mediaGroup',
  7969   min: 'min',
  5009     method: 'method',
  7970   minlength: 'minLength',
  5010     min: 'min',
  7971   multiple: 'multiple',
  5011     minlength: 'minLength',
  7972   muted: 'muted',
  5012     multiple: 'multiple',
  7973   name: 'name',
  5013     muted: 'muted',
  7974   nomodule: 'noModule',
  5014     name: 'name',
  7975   nonce: 'nonce',
  5015     nomodule: 'noModule',
  7976   novalidate: 'noValidate',
  5016     nonce: 'nonce',
  7977   open: 'open',
  5017     novalidate: 'noValidate',
  7978   optimum: 'optimum',
  5018     open: 'open',
  7979   pattern: 'pattern',
  5019     optimum: 'optimum',
  7980   placeholder: 'placeholder',
  5020     pattern: 'pattern',
  7981   playsinline: 'playsInline',
  5021     placeholder: 'placeholder',
  7982   poster: 'poster',
  5022     playsinline: 'playsInline',
  7983   preload: 'preload',
  5023     poster: 'poster',
  7984   profile: 'profile',
  5024     preload: 'preload',
  7985   radiogroup: 'radioGroup',
  5025     profile: 'profile',
  7986   readonly: 'readOnly',
  5026     radiogroup: 'radioGroup',
  7987   referrerpolicy: 'referrerPolicy',
  5027     readonly: 'readOnly',
  7988   rel: 'rel',
  5028     referrerpolicy: 'referrerPolicy',
  7989   required: 'required',
  5029     rel: 'rel',
  7990   reversed: 'reversed',
  5030     required: 'required',
  7991   role: 'role',
  5031     reversed: 'reversed',
  7992   rows: 'rows',
  5032     role: 'role',
  7993   rowspan: 'rowSpan',
  5033     rows: 'rows',
  7994   sandbox: 'sandbox',
  5034     rowspan: 'rowSpan',
  7995   scope: 'scope',
  5035     sandbox: 'sandbox',
  7996   scoped: 'scoped',
  5036     scope: 'scope',
  7997   scrolling: 'scrolling',
  5037     scoped: 'scoped',
  7998   seamless: 'seamless',
  5038     scrolling: 'scrolling',
  7999   selected: 'selected',
  5039     seamless: 'seamless',
  8000   shape: 'shape',
  5040     selected: 'selected',
  8001   size: 'size',
  5041     shape: 'shape',
  8002   sizes: 'sizes',
  5042     size: 'size',
  8003   span: 'span',
  5043     sizes: 'sizes',
  8004   spellcheck: 'spellCheck',
  5044     span: 'span',
  8005   src: 'src',
  5045     spellcheck: 'spellCheck',
  8006   srcdoc: 'srcDoc',
  5046     src: 'src',
  8007   srclang: 'srcLang',
  5047     srcdoc: 'srcDoc',
  8008   srcset: 'srcSet',
  5048     srclang: 'srcLang',
  8009   start: 'start',
  5049     srcset: 'srcSet',
  8010   step: 'step',
  5050     start: 'start',
  8011   style: 'style',
  5051     step: 'step',
  8012   summary: 'summary',
  5052     style: 'style',
  8013   tabindex: 'tabIndex',
  5053     summary: 'summary',
  8014   target: 'target',
  5054     tabindex: 'tabIndex',
  8015   title: 'title',
  5055     target: 'target',
  8016   type: 'type',
  5056     title: 'title',
  8017   usemap: 'useMap',
  5057     type: 'type',
  8018   value: 'value',
  5058     usemap: 'useMap',
  8019   width: 'width',
  5059     value: 'value',
  8020   wmode: 'wmode',
  5060     width: 'width',
  8021   wrap: 'wrap',
  5061     wmode: 'wmode',
  8022 
  5062     wrap: 'wrap',
  8023   // SVG
  5063     // SVG
  8024   about: 'about',
  5064     about: 'about',
  8025   accentheight: 'accentHeight',
  5065     accentheight: 'accentHeight',
  8026   'accent-height': 'accentHeight',
  5066     'accent-height': 'accentHeight',
  8027   accumulate: 'accumulate',
  5067     accumulate: 'accumulate',
  8028   additive: 'additive',
  5068     additive: 'additive',
  8029   alignmentbaseline: 'alignmentBaseline',
  5069     alignmentbaseline: 'alignmentBaseline',
  8030   'alignment-baseline': 'alignmentBaseline',
  5070     'alignment-baseline': 'alignmentBaseline',
  8031   allowreorder: 'allowReorder',
  5071     allowreorder: 'allowReorder',
  8032   alphabetic: 'alphabetic',
  5072     alphabetic: 'alphabetic',
  8033   amplitude: 'amplitude',
  5073     amplitude: 'amplitude',
  8034   arabicform: 'arabicForm',
  5074     arabicform: 'arabicForm',
  8035   'arabic-form': 'arabicForm',
  5075     'arabic-form': 'arabicForm',
  8036   ascent: 'ascent',
  5076     ascent: 'ascent',
  8037   attributename: 'attributeName',
  5077     attributename: 'attributeName',
  8038   attributetype: 'attributeType',
  5078     attributetype: 'attributeType',
  8039   autoreverse: 'autoReverse',
  5079     autoreverse: 'autoReverse',
  8040   azimuth: 'azimuth',
  5080     azimuth: 'azimuth',
  8041   basefrequency: 'baseFrequency',
  5081     basefrequency: 'baseFrequency',
  8042   baselineshift: 'baselineShift',
  5082     baselineshift: 'baselineShift',
  8043   'baseline-shift': 'baselineShift',
  5083     'baseline-shift': 'baselineShift',
  8044   baseprofile: 'baseProfile',
  5084     baseprofile: 'baseProfile',
  8045   bbox: 'bbox',
  5085     bbox: 'bbox',
  8046   begin: 'begin',
  5086     begin: 'begin',
  8047   bias: 'bias',
  5087     bias: 'bias',
  8048   by: 'by',
  5088     by: 'by',
  8049   calcmode: 'calcMode',
  5089     calcmode: 'calcMode',
  8050   capheight: 'capHeight',
  5090     capheight: 'capHeight',
  8051   'cap-height': 'capHeight',
  5091     'cap-height': 'capHeight',
  8052   clip: 'clip',
  5092     clip: 'clip',
  8053   clippath: 'clipPath',
  5093     clippath: 'clipPath',
  8054   'clip-path': 'clipPath',
  5094     'clip-path': 'clipPath',
  8055   clippathunits: 'clipPathUnits',
  5095     clippathunits: 'clipPathUnits',
  8056   cliprule: 'clipRule',
  5096     cliprule: 'clipRule',
  8057   'clip-rule': 'clipRule',
  5097     'clip-rule': 'clipRule',
  8058   color: 'color',
  5098     color: 'color',
  8059   colorinterpolation: 'colorInterpolation',
  5099     colorinterpolation: 'colorInterpolation',
  8060   'color-interpolation': 'colorInterpolation',
  5100     'color-interpolation': 'colorInterpolation',
  8061   colorinterpolationfilters: 'colorInterpolationFilters',
  5101     colorinterpolationfilters: 'colorInterpolationFilters',
  8062   'color-interpolation-filters': 'colorInterpolationFilters',
  5102     'color-interpolation-filters': 'colorInterpolationFilters',
  8063   colorprofile: 'colorProfile',
  5103     colorprofile: 'colorProfile',
  8064   'color-profile': 'colorProfile',
  5104     'color-profile': 'colorProfile',
  8065   colorrendering: 'colorRendering',
  5105     colorrendering: 'colorRendering',
  8066   'color-rendering': 'colorRendering',
  5106     'color-rendering': 'colorRendering',
  8067   contentscripttype: 'contentScriptType',
  5107     contentscripttype: 'contentScriptType',
  8068   contentstyletype: 'contentStyleType',
  5108     contentstyletype: 'contentStyleType',
  8069   cursor: 'cursor',
  5109     cursor: 'cursor',
  8070   cx: 'cx',
  5110     cx: 'cx',
  8071   cy: 'cy',
  5111     cy: 'cy',
  8072   d: 'd',
  5112     d: 'd',
  8073   datatype: 'datatype',
  5113     datatype: 'datatype',
  8074   decelerate: 'decelerate',
  5114     decelerate: 'decelerate',
  8075   descent: 'descent',
  5115     descent: 'descent',
  8076   diffuseconstant: 'diffuseConstant',
  5116     diffuseconstant: 'diffuseConstant',
  8077   direction: 'direction',
  5117     direction: 'direction',
  8078   display: 'display',
  5118     display: 'display',
  8079   divisor: 'divisor',
  5119     divisor: 'divisor',
  8080   dominantbaseline: 'dominantBaseline',
  5120     dominantbaseline: 'dominantBaseline',
  8081   'dominant-baseline': 'dominantBaseline',
  5121     'dominant-baseline': 'dominantBaseline',
  8082   dur: 'dur',
  5122     dur: 'dur',
  8083   dx: 'dx',
  5123     dx: 'dx',
  8084   dy: 'dy',
  5124     dy: 'dy',
  8085   edgemode: 'edgeMode',
  5125     edgemode: 'edgeMode',
  8086   elevation: 'elevation',
  5126     elevation: 'elevation',
  8087   enablebackground: 'enableBackground',
  5127     enablebackground: 'enableBackground',
  8088   'enable-background': 'enableBackground',
  5128     'enable-background': 'enableBackground',
  8089   end: 'end',
  5129     end: 'end',
  8090   exponent: 'exponent',
  5130     exponent: 'exponent',
  8091   externalresourcesrequired: 'externalResourcesRequired',
  5131     externalresourcesrequired: 'externalResourcesRequired',
  8092   fill: 'fill',
  5132     fill: 'fill',
  8093   fillopacity: 'fillOpacity',
  5133     fillopacity: 'fillOpacity',
  8094   'fill-opacity': 'fillOpacity',
  5134     'fill-opacity': 'fillOpacity',
  8095   fillrule: 'fillRule',
  5135     fillrule: 'fillRule',
  8096   'fill-rule': 'fillRule',
  5136     'fill-rule': 'fillRule',
  8097   filter: 'filter',
  5137     filter: 'filter',
  8098   filterres: 'filterRes',
  5138     filterres: 'filterRes',
  8099   filterunits: 'filterUnits',
  5139     filterunits: 'filterUnits',
  8100   floodopacity: 'floodOpacity',
  5140     floodopacity: 'floodOpacity',
  8101   'flood-opacity': 'floodOpacity',
  5141     'flood-opacity': 'floodOpacity',
  8102   floodcolor: 'floodColor',
  5142     floodcolor: 'floodColor',
  8103   'flood-color': 'floodColor',
  5143     'flood-color': 'floodColor',
  8104   focusable: 'focusable',
  5144     focusable: 'focusable',
  8105   fontfamily: 'fontFamily',
  5145     fontfamily: 'fontFamily',
  8106   'font-family': 'fontFamily',
  5146     'font-family': 'fontFamily',
  8107   fontsize: 'fontSize',
  5147     fontsize: 'fontSize',
  8108   'font-size': 'fontSize',
  5148     'font-size': 'fontSize',
  8109   fontsizeadjust: 'fontSizeAdjust',
  5149     fontsizeadjust: 'fontSizeAdjust',
  8110   'font-size-adjust': 'fontSizeAdjust',
  5150     'font-size-adjust': 'fontSizeAdjust',
  8111   fontstretch: 'fontStretch',
  5151     fontstretch: 'fontStretch',
  8112   'font-stretch': 'fontStretch',
  5152     'font-stretch': 'fontStretch',
  8113   fontstyle: 'fontStyle',
  5153     fontstyle: 'fontStyle',
  8114   'font-style': 'fontStyle',
  5154     'font-style': 'fontStyle',
  8115   fontvariant: 'fontVariant',
  5155     fontvariant: 'fontVariant',
  8116   'font-variant': 'fontVariant',
  5156     'font-variant': 'fontVariant',
  8117   fontweight: 'fontWeight',
  5157     fontweight: 'fontWeight',
  8118   'font-weight': 'fontWeight',
  5158     'font-weight': 'fontWeight',
  8119   format: 'format',
  5159     format: 'format',
  8120   from: 'from',
  5160     from: 'from',
  8121   fx: 'fx',
  5161     fx: 'fx',
  8122   fy: 'fy',
  5162     fy: 'fy',
  8123   g1: 'g1',
  5163     g1: 'g1',
  8124   g2: 'g2',
  5164     g2: 'g2',
  8125   glyphname: 'glyphName',
  5165     glyphname: 'glyphName',
  8126   'glyph-name': 'glyphName',
  5166     'glyph-name': 'glyphName',
  8127   glyphorientationhorizontal: 'glyphOrientationHorizontal',
  5167     glyphorientationhorizontal: 'glyphOrientationHorizontal',
  8128   'glyph-orientation-horizontal': 'glyphOrientationHorizontal',
  5168     'glyph-orientation-horizontal': 'glyphOrientationHorizontal',
  8129   glyphorientationvertical: 'glyphOrientationVertical',
  5169     glyphorientationvertical: 'glyphOrientationVertical',
  8130   'glyph-orientation-vertical': 'glyphOrientationVertical',
  5170     'glyph-orientation-vertical': 'glyphOrientationVertical',
  8131   glyphref: 'glyphRef',
  5171     glyphref: 'glyphRef',
  8132   gradienttransform: 'gradientTransform',
  5172     gradienttransform: 'gradientTransform',
  8133   gradientunits: 'gradientUnits',
  5173     gradientunits: 'gradientUnits',
  8134   hanging: 'hanging',
  5174     hanging: 'hanging',
  8135   horizadvx: 'horizAdvX',
  5175     horizadvx: 'horizAdvX',
  8136   'horiz-adv-x': 'horizAdvX',
  5176     'horiz-adv-x': 'horizAdvX',
  8137   horizoriginx: 'horizOriginX',
  5177     horizoriginx: 'horizOriginX',
  8138   'horiz-origin-x': 'horizOriginX',
  5178     'horiz-origin-x': 'horizOriginX',
  8139   ideographic: 'ideographic',
  5179     ideographic: 'ideographic',
  8140   imagerendering: 'imageRendering',
  5180     imagerendering: 'imageRendering',
  8141   'image-rendering': 'imageRendering',
  5181     'image-rendering': 'imageRendering',
  8142   in2: 'in2',
  5182     in2: 'in2',
  8143   in: 'in',
  5183     in: 'in',
  8144   inlist: 'inlist',
  5184     inlist: 'inlist',
  8145   intercept: 'intercept',
  5185     intercept: 'intercept',
  8146   k1: 'k1',
  5186     k1: 'k1',
  8147   k2: 'k2',
  5187     k2: 'k2',
  8148   k3: 'k3',
  5188     k3: 'k3',
  8149   k4: 'k4',
  5189     k4: 'k4',
  8150   k: 'k',
  5190     k: 'k',
  8151   kernelmatrix: 'kernelMatrix',
  5191     kernelmatrix: 'kernelMatrix',
  8152   kernelunitlength: 'kernelUnitLength',
  5192     kernelunitlength: 'kernelUnitLength',
  8153   kerning: 'kerning',
  5193     kerning: 'kerning',
  8154   keypoints: 'keyPoints',
  5194     keypoints: 'keyPoints',
  8155   keysplines: 'keySplines',
  5195     keysplines: 'keySplines',
  8156   keytimes: 'keyTimes',
  5196     keytimes: 'keyTimes',
  8157   lengthadjust: 'lengthAdjust',
  5197     lengthadjust: 'lengthAdjust',
  8158   letterspacing: 'letterSpacing',
  5198     letterspacing: 'letterSpacing',
  8159   'letter-spacing': 'letterSpacing',
  5199     'letter-spacing': 'letterSpacing',
  8160   lightingcolor: 'lightingColor',
  5200     lightingcolor: 'lightingColor',
  8161   'lighting-color': 'lightingColor',
  5201     'lighting-color': 'lightingColor',
  8162   limitingconeangle: 'limitingConeAngle',
  5202     limitingconeangle: 'limitingConeAngle',
  8163   local: 'local',
  5203     local: 'local',
  8164   markerend: 'markerEnd',
  5204     markerend: 'markerEnd',
  8165   'marker-end': 'markerEnd',
  5205     'marker-end': 'markerEnd',
  8166   markerheight: 'markerHeight',
  5206     markerheight: 'markerHeight',
  8167   markermid: 'markerMid',
  5207     markermid: 'markerMid',
  8168   'marker-mid': 'markerMid',
  5208     'marker-mid': 'markerMid',
  8169   markerstart: 'markerStart',
  5209     markerstart: 'markerStart',
  8170   'marker-start': 'markerStart',
  5210     'marker-start': 'markerStart',
  8171   markerunits: 'markerUnits',
  5211     markerunits: 'markerUnits',
  8172   markerwidth: 'markerWidth',
  5212     markerwidth: 'markerWidth',
  8173   mask: 'mask',
  5213     mask: 'mask',
  8174   maskcontentunits: 'maskContentUnits',
  5214     maskcontentunits: 'maskContentUnits',
  8175   maskunits: 'maskUnits',
  5215     maskunits: 'maskUnits',
  8176   mathematical: 'mathematical',
  5216     mathematical: 'mathematical',
  8177   mode: 'mode',
  5217     mode: 'mode',
  8178   numoctaves: 'numOctaves',
  5218     numoctaves: 'numOctaves',
  8179   offset: 'offset',
  5219     offset: 'offset',
  8180   opacity: 'opacity',
  5220     opacity: 'opacity',
  8181   operator: 'operator',
  5221     operator: 'operator',
  8182   order: 'order',
  5222     order: 'order',
  8183   orient: 'orient',
  5223     orient: 'orient',
  8184   orientation: 'orientation',
  5224     orientation: 'orientation',
  8185   origin: 'origin',
  5225     origin: 'origin',
  8186   overflow: 'overflow',
  5226     overflow: 'overflow',
  8187   overlineposition: 'overlinePosition',
  5227     overlineposition: 'overlinePosition',
  8188   'overline-position': 'overlinePosition',
  5228     'overline-position': 'overlinePosition',
  8189   overlinethickness: 'overlineThickness',
  5229     overlinethickness: 'overlineThickness',
  8190   'overline-thickness': 'overlineThickness',
  5230     'overline-thickness': 'overlineThickness',
  8191   paintorder: 'paintOrder',
  5231     paintorder: 'paintOrder',
  8192   'paint-order': 'paintOrder',
  5232     'paint-order': 'paintOrder',
  8193   panose1: 'panose1',
  5233     panose1: 'panose1',
  8194   'panose-1': 'panose1',
  5234     'panose-1': 'panose1',
  8195   pathlength: 'pathLength',
  5235     pathlength: 'pathLength',
  8196   patterncontentunits: 'patternContentUnits',
  5236     patterncontentunits: 'patternContentUnits',
  8197   patterntransform: 'patternTransform',
  5237     patterntransform: 'patternTransform',
  8198   patternunits: 'patternUnits',
  5238     patternunits: 'patternUnits',
  8199   pointerevents: 'pointerEvents',
  5239     pointerevents: 'pointerEvents',
  8200   'pointer-events': 'pointerEvents',
  5240     'pointer-events': 'pointerEvents',
  8201   points: 'points',
  5241     points: 'points',
  8202   pointsatx: 'pointsAtX',
  5242     pointsatx: 'pointsAtX',
  8203   pointsaty: 'pointsAtY',
  5243     pointsaty: 'pointsAtY',
  8204   pointsatz: 'pointsAtZ',
  5244     pointsatz: 'pointsAtZ',
  8205   prefix: 'prefix',
  5245     prefix: 'prefix',
  8206   preservealpha: 'preserveAlpha',
  5246     preservealpha: 'preserveAlpha',
  8207   preserveaspectratio: 'preserveAspectRatio',
  5247     preserveaspectratio: 'preserveAspectRatio',
  8208   primitiveunits: 'primitiveUnits',
  5248     primitiveunits: 'primitiveUnits',
  8209   property: 'property',
  5249     property: 'property',
  8210   r: 'r',
  5250     r: 'r',
  8211   radius: 'radius',
  5251     radius: 'radius',
  8212   refx: 'refX',
  5252     refx: 'refX',
  8213   refy: 'refY',
  5253     refy: 'refY',
  8214   renderingintent: 'renderingIntent',
  5254     renderingintent: 'renderingIntent',
  8215   'rendering-intent': 'renderingIntent',
  5255     'rendering-intent': 'renderingIntent',
  8216   repeatcount: 'repeatCount',
  5256     repeatcount: 'repeatCount',
  8217   repeatdur: 'repeatDur',
  5257     repeatdur: 'repeatDur',
  8218   requiredextensions: 'requiredExtensions',
  5258     requiredextensions: 'requiredExtensions',
  8219   requiredfeatures: 'requiredFeatures',
  5259     requiredfeatures: 'requiredFeatures',
  8220   resource: 'resource',
  5260     resource: 'resource',
  8221   restart: 'restart',
  5261     restart: 'restart',
  8222   result: 'result',
  5262     result: 'result',
  8223   results: 'results',
  5263     results: 'results',
  8224   rotate: 'rotate',
  5264     rotate: 'rotate',
  8225   rx: 'rx',
  5265     rx: 'rx',
  8226   ry: 'ry',
  5266     ry: 'ry',
  8227   scale: 'scale',
  5267     scale: 'scale',
  8228   security: 'security',
  5268     security: 'security',
  8229   seed: 'seed',
  5269     seed: 'seed',
  8230   shaperendering: 'shapeRendering',
  5270     shaperendering: 'shapeRendering',
  8231   'shape-rendering': 'shapeRendering',
  5271     'shape-rendering': 'shapeRendering',
  8232   slope: 'slope',
  5272     slope: 'slope',
  8233   spacing: 'spacing',
  5273     spacing: 'spacing',
  8234   specularconstant: 'specularConstant',
  5274     specularconstant: 'specularConstant',
  8235   specularexponent: 'specularExponent',
  5275     specularexponent: 'specularExponent',
  8236   speed: 'speed',
  5276     speed: 'speed',
  8237   spreadmethod: 'spreadMethod',
  5277     spreadmethod: 'spreadMethod',
  8238   startoffset: 'startOffset',
  5278     startoffset: 'startOffset',
  8239   stddeviation: 'stdDeviation',
  5279     stddeviation: 'stdDeviation',
  8240   stemh: 'stemh',
  5280     stemh: 'stemh',
  8241   stemv: 'stemv',
  5281     stemv: 'stemv',
  8242   stitchtiles: 'stitchTiles',
  5282     stitchtiles: 'stitchTiles',
  8243   stopcolor: 'stopColor',
  5283     stopcolor: 'stopColor',
  8244   'stop-color': 'stopColor',
  5284     'stop-color': 'stopColor',
  8245   stopopacity: 'stopOpacity',
  5285     stopopacity: 'stopOpacity',
  8246   'stop-opacity': 'stopOpacity',
  5286     'stop-opacity': 'stopOpacity',
  8247   strikethroughposition: 'strikethroughPosition',
  5287     strikethroughposition: 'strikethroughPosition',
  8248   'strikethrough-position': 'strikethroughPosition',
  5288     'strikethrough-position': 'strikethroughPosition',
  8249   strikethroughthickness: 'strikethroughThickness',
  5289     strikethroughthickness: 'strikethroughThickness',
  8250   'strikethrough-thickness': 'strikethroughThickness',
  5290     'strikethrough-thickness': 'strikethroughThickness',
  8251   string: 'string',
  5291     string: 'string',
  8252   stroke: 'stroke',
  5292     stroke: 'stroke',
  8253   strokedasharray: 'strokeDasharray',
  5293     strokedasharray: 'strokeDasharray',
  8254   'stroke-dasharray': 'strokeDasharray',
  5294     'stroke-dasharray': 'strokeDasharray',
  8255   strokedashoffset: 'strokeDashoffset',
  5295     strokedashoffset: 'strokeDashoffset',
  8256   'stroke-dashoffset': 'strokeDashoffset',
  5296     'stroke-dashoffset': 'strokeDashoffset',
  8257   strokelinecap: 'strokeLinecap',
  5297     strokelinecap: 'strokeLinecap',
  8258   'stroke-linecap': 'strokeLinecap',
  5298     'stroke-linecap': 'strokeLinecap',
  8259   strokelinejoin: 'strokeLinejoin',
  5299     strokelinejoin: 'strokeLinejoin',
  8260   'stroke-linejoin': 'strokeLinejoin',
  5300     'stroke-linejoin': 'strokeLinejoin',
  8261   strokemiterlimit: 'strokeMiterlimit',
  5301     strokemiterlimit: 'strokeMiterlimit',
  8262   'stroke-miterlimit': 'strokeMiterlimit',
  5302     'stroke-miterlimit': 'strokeMiterlimit',
  8263   strokewidth: 'strokeWidth',
  5303     strokewidth: 'strokeWidth',
  8264   'stroke-width': 'strokeWidth',
  5304     'stroke-width': 'strokeWidth',
  8265   strokeopacity: 'strokeOpacity',
  5305     strokeopacity: 'strokeOpacity',
  8266   'stroke-opacity': 'strokeOpacity',
  5306     'stroke-opacity': 'strokeOpacity',
  8267   suppresscontenteditablewarning: 'suppressContentEditableWarning',
  5307     suppresscontenteditablewarning: 'suppressContentEditableWarning',
  8268   suppresshydrationwarning: 'suppressHydrationWarning',
  5308     suppresshydrationwarning: 'suppressHydrationWarning',
  8269   surfacescale: 'surfaceScale',
  5309     surfacescale: 'surfaceScale',
  8270   systemlanguage: 'systemLanguage',
  5310     systemlanguage: 'systemLanguage',
  8271   tablevalues: 'tableValues',
  5311     tablevalues: 'tableValues',
  8272   targetx: 'targetX',
  5312     targetx: 'targetX',
  8273   targety: 'targetY',
  5313     targety: 'targetY',
  8274   textanchor: 'textAnchor',
  5314     textanchor: 'textAnchor',
  8275   'text-anchor': 'textAnchor',
  5315     'text-anchor': 'textAnchor',
  8276   textdecoration: 'textDecoration',
  5316     textdecoration: 'textDecoration',
  8277   'text-decoration': 'textDecoration',
  5317     'text-decoration': 'textDecoration',
  8278   textlength: 'textLength',
  5318     textlength: 'textLength',
  8279   textrendering: 'textRendering',
  5319     textrendering: 'textRendering',
  8280   'text-rendering': 'textRendering',
  5320     'text-rendering': 'textRendering',
  8281   to: 'to',
  5321     to: 'to',
  8282   transform: 'transform',
  5322     transform: 'transform',
  8283   typeof: 'typeof',
  5323     typeof: 'typeof',
  8284   u1: 'u1',
  5324     u1: 'u1',
  8285   u2: 'u2',
  5325     u2: 'u2',
  8286   underlineposition: 'underlinePosition',
  5326     underlineposition: 'underlinePosition',
  8287   'underline-position': 'underlinePosition',
  5327     'underline-position': 'underlinePosition',
  8288   underlinethickness: 'underlineThickness',
  5328     underlinethickness: 'underlineThickness',
  8289   'underline-thickness': 'underlineThickness',
  5329     'underline-thickness': 'underlineThickness',
  8290   unicode: 'unicode',
  5330     unicode: 'unicode',
  8291   unicodebidi: 'unicodeBidi',
  5331     unicodebidi: 'unicodeBidi',
  8292   'unicode-bidi': 'unicodeBidi',
  5332     'unicode-bidi': 'unicodeBidi',
  8293   unicoderange: 'unicodeRange',
  5333     unicoderange: 'unicodeRange',
  8294   'unicode-range': 'unicodeRange',
  5334     'unicode-range': 'unicodeRange',
  8295   unitsperem: 'unitsPerEm',
  5335     unitsperem: 'unitsPerEm',
  8296   'units-per-em': 'unitsPerEm',
  5336     'units-per-em': 'unitsPerEm',
  8297   unselectable: 'unselectable',
  5337     unselectable: 'unselectable',
  8298   valphabetic: 'vAlphabetic',
  5338     valphabetic: 'vAlphabetic',
  8299   'v-alphabetic': 'vAlphabetic',
  5339     'v-alphabetic': 'vAlphabetic',
  8300   values: 'values',
  5340     values: 'values',
  8301   vectoreffect: 'vectorEffect',
  5341     vectoreffect: 'vectorEffect',
  8302   'vector-effect': 'vectorEffect',
  5342     'vector-effect': 'vectorEffect',
  8303   version: 'version',
  5343     version: 'version',
  8304   vertadvy: 'vertAdvY',
  5344     vertadvy: 'vertAdvY',
  8305   'vert-adv-y': 'vertAdvY',
  5345     'vert-adv-y': 'vertAdvY',
  8306   vertoriginx: 'vertOriginX',
  5346     vertoriginx: 'vertOriginX',
  8307   'vert-origin-x': 'vertOriginX',
  5347     'vert-origin-x': 'vertOriginX',
  8308   vertoriginy: 'vertOriginY',
  5348     vertoriginy: 'vertOriginY',
  8309   'vert-origin-y': 'vertOriginY',
  5349     'vert-origin-y': 'vertOriginY',
  8310   vhanging: 'vHanging',
  5350     vhanging: 'vHanging',
  8311   'v-hanging': 'vHanging',
  5351     'v-hanging': 'vHanging',
  8312   videographic: 'vIdeographic',
  5352     videographic: 'vIdeographic',
  8313   'v-ideographic': 'vIdeographic',
  5353     'v-ideographic': 'vIdeographic',
  8314   viewbox: 'viewBox',
  5354     viewbox: 'viewBox',
  8315   viewtarget: 'viewTarget',
  5355     viewtarget: 'viewTarget',
  8316   visibility: 'visibility',
  5356     visibility: 'visibility',
  8317   vmathematical: 'vMathematical',
  5357     vmathematical: 'vMathematical',
  8318   'v-mathematical': 'vMathematical',
  5358     'v-mathematical': 'vMathematical',
  8319   vocab: 'vocab',
  5359     vocab: 'vocab',
  8320   widths: 'widths',
  5360     widths: 'widths',
  8321   wordspacing: 'wordSpacing',
  5361     wordspacing: 'wordSpacing',
  8322   'word-spacing': 'wordSpacing',
  5362     'word-spacing': 'wordSpacing',
  8323   writingmode: 'writingMode',
  5363     writingmode: 'writingMode',
  8324   'writing-mode': 'writingMode',
  5364     'writing-mode': 'writingMode',
  8325   x1: 'x1',
  5365     x1: 'x1',
  8326   x2: 'x2',
  5366     x2: 'x2',
  8327   x: 'x',
  5367     x: 'x',
  8328   xchannelselector: 'xChannelSelector',
  5368     xchannelselector: 'xChannelSelector',
  8329   xheight: 'xHeight',
  5369     xheight: 'xHeight',
  8330   'x-height': 'xHeight',
  5370     'x-height': 'xHeight',
  8331   xlinkactuate: 'xlinkActuate',
  5371     xlinkactuate: 'xlinkActuate',
  8332   'xlink:actuate': 'xlinkActuate',
  5372     'xlink:actuate': 'xlinkActuate',
  8333   xlinkarcrole: 'xlinkArcrole',
  5373     xlinkarcrole: 'xlinkArcrole',
  8334   'xlink:arcrole': 'xlinkArcrole',
  5374     'xlink:arcrole': 'xlinkArcrole',
  8335   xlinkhref: 'xlinkHref',
  5375     xlinkhref: 'xlinkHref',
  8336   'xlink:href': 'xlinkHref',
  5376     'xlink:href': 'xlinkHref',
  8337   xlinkrole: 'xlinkRole',
  5377     xlinkrole: 'xlinkRole',
  8338   'xlink:role': 'xlinkRole',
  5378     'xlink:role': 'xlinkRole',
  8339   xlinkshow: 'xlinkShow',
  5379     xlinkshow: 'xlinkShow',
  8340   'xlink:show': 'xlinkShow',
  5380     'xlink:show': 'xlinkShow',
  8341   xlinktitle: 'xlinkTitle',
  5381     xlinktitle: 'xlinkTitle',
  8342   'xlink:title': 'xlinkTitle',
  5382     'xlink:title': 'xlinkTitle',
  8343   xlinktype: 'xlinkType',
  5383     xlinktype: 'xlinkType',
  8344   'xlink:type': 'xlinkType',
  5384     'xlink:type': 'xlinkType',
  8345   xmlbase: 'xmlBase',
  5385     xmlbase: 'xmlBase',
  8346   'xml:base': 'xmlBase',
  5386     'xml:base': 'xmlBase',
  8347   xmllang: 'xmlLang',
  5387     xmllang: 'xmlLang',
  8348   'xml:lang': 'xmlLang',
  5388     'xml:lang': 'xmlLang',
  8349   xmlns: 'xmlns',
  5389     xmlns: 'xmlns',
  8350   'xml:space': 'xmlSpace',
  5390     'xml:space': 'xmlSpace',
  8351   xmlnsxlink: 'xmlnsXlink',
  5391     xmlnsxlink: 'xmlnsXlink',
  8352   'xmlns:xlink': 'xmlnsXlink',
  5392     'xmlns:xlink': 'xmlnsXlink',
  8353   xmlspace: 'xmlSpace',
  5393     xmlspace: 'xmlSpace',
  8354   y1: 'y1',
  5394     y1: 'y1',
  8355   y2: 'y2',
  5395     y2: 'y2',
  8356   y: 'y',
  5396     y: 'y',
  8357   ychannelselector: 'yChannelSelector',
  5397     ychannelselector: 'yChannelSelector',
  8358   z: 'z',
  5398     z: 'z',
  8359   zoomandpan: 'zoomAndPan'
  5399     zoomandpan: 'zoomAndPan'
  8360 };
  5400   };
  8361 
  5401 
  8362 var ariaProperties = {
  5402   var ariaProperties = {
  8363   'aria-current': 0, // state
  5403     'aria-current': 0,
  8364   'aria-details': 0,
  5404     // state
  8365   'aria-disabled': 0, // state
  5405     'aria-details': 0,
  8366   'aria-hidden': 0, // state
  5406     'aria-disabled': 0,
  8367   'aria-invalid': 0, // state
  5407     // state
  8368   'aria-keyshortcuts': 0,
  5408     'aria-hidden': 0,
  8369   'aria-label': 0,
  5409     // state
  8370   'aria-roledescription': 0,
  5410     'aria-invalid': 0,
  8371   // Widget Attributes
  5411     // state
  8372   'aria-autocomplete': 0,
  5412     'aria-keyshortcuts': 0,
  8373   'aria-checked': 0,
  5413     'aria-label': 0,
  8374   'aria-expanded': 0,
  5414     'aria-roledescription': 0,
  8375   'aria-haspopup': 0,
  5415     // Widget Attributes
  8376   'aria-level': 0,
  5416     'aria-autocomplete': 0,
  8377   'aria-modal': 0,
  5417     'aria-checked': 0,
  8378   'aria-multiline': 0,
  5418     'aria-expanded': 0,
  8379   'aria-multiselectable': 0,
  5419     'aria-haspopup': 0,
  8380   'aria-orientation': 0,
  5420     'aria-level': 0,
  8381   'aria-placeholder': 0,
  5421     'aria-modal': 0,
  8382   'aria-pressed': 0,
  5422     'aria-multiline': 0,
  8383   'aria-readonly': 0,
  5423     'aria-multiselectable': 0,
  8384   'aria-required': 0,
  5424     'aria-orientation': 0,
  8385   'aria-selected': 0,
  5425     'aria-placeholder': 0,
  8386   'aria-sort': 0,
  5426     'aria-pressed': 0,
  8387   'aria-valuemax': 0,
  5427     'aria-readonly': 0,
  8388   'aria-valuemin': 0,
  5428     'aria-required': 0,
  8389   'aria-valuenow': 0,
  5429     'aria-selected': 0,
  8390   'aria-valuetext': 0,
  5430     'aria-sort': 0,
  8391   // Live Region Attributes
  5431     'aria-valuemax': 0,
  8392   'aria-atomic': 0,
  5432     'aria-valuemin': 0,
  8393   'aria-busy': 0,
  5433     'aria-valuenow': 0,
  8394   'aria-live': 0,
  5434     'aria-valuetext': 0,
  8395   'aria-relevant': 0,
  5435     // Live Region Attributes
  8396   // Drag-and-Drop Attributes
  5436     'aria-atomic': 0,
  8397   'aria-dropeffect': 0,
  5437     'aria-busy': 0,
  8398   'aria-grabbed': 0,
  5438     'aria-live': 0,
  8399   // Relationship Attributes
  5439     'aria-relevant': 0,
  8400   'aria-activedescendant': 0,
  5440     // Drag-and-Drop Attributes
  8401   'aria-colcount': 0,
  5441     'aria-dropeffect': 0,
  8402   'aria-colindex': 0,
  5442     'aria-grabbed': 0,
  8403   'aria-colspan': 0,
  5443     // Relationship Attributes
  8404   'aria-controls': 0,
  5444     'aria-activedescendant': 0,
  8405   'aria-describedby': 0,
  5445     'aria-colcount': 0,
  8406   'aria-errormessage': 0,
  5446     'aria-colindex': 0,
  8407   'aria-flowto': 0,
  5447     'aria-colspan': 0,
  8408   'aria-labelledby': 0,
  5448     'aria-controls': 0,
  8409   'aria-owns': 0,
  5449     'aria-describedby': 0,
  8410   'aria-posinset': 0,
  5450     'aria-errormessage': 0,
  8411   'aria-rowcount': 0,
  5451     'aria-flowto': 0,
  8412   'aria-rowindex': 0,
  5452     'aria-labelledby': 0,
  8413   'aria-rowspan': 0,
  5453     'aria-owns': 0,
  8414   'aria-setsize': 0
  5454     'aria-posinset': 0,
  8415 };
  5455     'aria-rowcount': 0,
  8416 
  5456     'aria-rowindex': 0,
  8417 var warnedProperties = {};
  5457     'aria-rowspan': 0,
  8418 var rARIA = new RegExp('^(aria)-[' + ATTRIBUTE_NAME_CHAR + ']*$');
  5458     'aria-setsize': 0
  8419 var rARIACamel = new RegExp('^(aria)[A-Z][' + ATTRIBUTE_NAME_CHAR + ']*$');
  5459   };
  8420 
  5460 
  8421 var hasOwnProperty$2 = Object.prototype.hasOwnProperty;
  5461   var warnedProperties = {};
  8422 
  5462   var rARIA = new RegExp('^(aria)-[' + ATTRIBUTE_NAME_CHAR + ']*$');
  8423 function validateProperty(tagName, name) {
  5463   var rARIACamel = new RegExp('^(aria)[A-Z][' + ATTRIBUTE_NAME_CHAR + ']*$');
  8424   if (hasOwnProperty$2.call(warnedProperties, name) && warnedProperties[name]) {
  5464   var hasOwnProperty$1 = Object.prototype.hasOwnProperty;
       
  5465 
       
  5466   function validateProperty(tagName, name) {
       
  5467     {
       
  5468       if (hasOwnProperty$1.call(warnedProperties, name) && warnedProperties[name]) {
       
  5469         return true;
       
  5470       }
       
  5471 
       
  5472       if (rARIACamel.test(name)) {
       
  5473         var ariaName = 'aria-' + name.slice(4).toLowerCase();
       
  5474         var correctName = ariaProperties.hasOwnProperty(ariaName) ? ariaName : null; // If this is an aria-* attribute, but is not listed in the known DOM
       
  5475         // DOM properties, then it is an invalid aria-* attribute.
       
  5476 
       
  5477         if (correctName == null) {
       
  5478           error('Invalid ARIA attribute `%s`. ARIA attributes follow the pattern aria-* and must be lowercase.', name);
       
  5479 
       
  5480           warnedProperties[name] = true;
       
  5481           return true;
       
  5482         } // aria-* attributes should be lowercase; suggest the lowercase version.
       
  5483 
       
  5484 
       
  5485         if (name !== correctName) {
       
  5486           error('Invalid ARIA attribute `%s`. Did you mean `%s`?', name, correctName);
       
  5487 
       
  5488           warnedProperties[name] = true;
       
  5489           return true;
       
  5490         }
       
  5491       }
       
  5492 
       
  5493       if (rARIA.test(name)) {
       
  5494         var lowerCasedName = name.toLowerCase();
       
  5495         var standardName = ariaProperties.hasOwnProperty(lowerCasedName) ? lowerCasedName : null; // If this is an aria-* attribute, but is not listed in the known DOM
       
  5496         // DOM properties, then it is an invalid aria-* attribute.
       
  5497 
       
  5498         if (standardName == null) {
       
  5499           warnedProperties[name] = true;
       
  5500           return false;
       
  5501         } // aria-* attributes should be lowercase; suggest the lowercase version.
       
  5502 
       
  5503 
       
  5504         if (name !== standardName) {
       
  5505           error('Unknown ARIA attribute `%s`. Did you mean `%s`?', name, standardName);
       
  5506 
       
  5507           warnedProperties[name] = true;
       
  5508           return true;
       
  5509         }
       
  5510       }
       
  5511     }
       
  5512 
  8425     return true;
  5513     return true;
  8426   }
  5514   }
  8427 
  5515 
  8428   if (rARIACamel.test(name)) {
  5516   function warnInvalidARIAProps(type, props) {
  8429     var ariaName = 'aria-' + name.slice(4).toLowerCase();
  5517     {
  8430     var correctName = ariaProperties.hasOwnProperty(ariaName) ? ariaName : null;
  5518       var invalidProps = [];
  8431 
  5519 
  8432     // If this is an aria-* attribute, but is not listed in the known DOM
  5520       for (var key in props) {
  8433     // DOM properties, then it is an invalid aria-* attribute.
  5521         var isValid = validateProperty(type, key);
  8434     if (correctName == null) {
  5522 
  8435       warning$1(false, 'Invalid ARIA attribute `%s`. ARIA attributes follow the pattern aria-* and must be lowercase.', name);
  5523         if (!isValid) {
  8436       warnedProperties[name] = true;
  5524           invalidProps.push(key);
  8437       return true;
  5525         }
  8438     }
  5526       }
  8439     // aria-* attributes should be lowercase; suggest the lowercase version.
  5527 
  8440     if (name !== correctName) {
  5528       var unknownPropString = invalidProps.map(function (prop) {
  8441       warning$1(false, 'Invalid ARIA attribute `%s`. Did you mean `%s`?', name, correctName);
  5529         return '`' + prop + '`';
  8442       warnedProperties[name] = true;
  5530       }).join(', ');
  8443       return true;
  5531 
  8444     }
  5532       if (invalidProps.length === 1) {
  8445   }
  5533         error('Invalid aria prop %s on <%s> tag. ' + 'For details, see https://fb.me/invalid-aria-prop', unknownPropString, type);
  8446 
  5534       } else if (invalidProps.length > 1) {
  8447   if (rARIA.test(name)) {
  5535         error('Invalid aria props %s on <%s> tag. ' + 'For details, see https://fb.me/invalid-aria-prop', unknownPropString, type);
  8448     var lowerCasedName = name.toLowerCase();
  5536       }
  8449     var standardName = ariaProperties.hasOwnProperty(lowerCasedName) ? lowerCasedName : null;
  5537     }
  8450 
  5538   }
  8451     // If this is an aria-* attribute, but is not listed in the known DOM
  5539 
  8452     // DOM properties, then it is an invalid aria-* attribute.
  5540   function validateProperties(type, props) {
  8453     if (standardName == null) {
  5541     if (isCustomComponent(type, props)) {
  8454       warnedProperties[name] = true;
  5542       return;
  8455       return false;
  5543     }
  8456     }
  5544 
  8457     // aria-* attributes should be lowercase; suggest the lowercase version.
  5545     warnInvalidARIAProps(type, props);
  8458     if (name !== standardName) {
  5546   }
  8459       warning$1(false, 'Unknown ARIA attribute `%s`. Did you mean `%s`?', name, standardName);
  5547 
  8460       warnedProperties[name] = true;
  5548   var didWarnValueNull = false;
  8461       return true;
  5549   function validateProperties$1(type, props) {
  8462     }
  5550     {
  8463   }
  5551       if (type !== 'input' && type !== 'textarea' && type !== 'select') {
  8464 
  5552         return;
  8465   return true;
  5553       }
  8466 }
  5554 
  8467 
  5555       if (props != null && props.value === null && !didWarnValueNull) {
  8468 function warnInvalidARIAProps(type, props) {
  5556         didWarnValueNull = true;
  8469   var invalidProps = [];
  5557 
  8470 
  5558         if (type === 'select' && props.multiple) {
  8471   for (var key in props) {
  5559           error('`value` prop on `%s` should not be null. ' + 'Consider using an empty array when `multiple` is set to `true` ' + 'to clear the component or `undefined` for uncontrolled components.', type);
  8472     var isValid = validateProperty(type, key);
  5560         } else {
  8473     if (!isValid) {
  5561           error('`value` prop on `%s` should not be null. ' + 'Consider using an empty string to clear the component or `undefined` ' + 'for uncontrolled components.', type);
  8474       invalidProps.push(key);
  5562         }
  8475     }
  5563       }
  8476   }
  5564     }
  8477 
  5565   }
  8478   var unknownPropString = invalidProps.map(function (prop) {
  5566 
  8479     return '`' + prop + '`';
  5567   var validateProperty$1 = function () {};
  8480   }).join(', ');
  5568 
  8481 
  5569   {
  8482   if (invalidProps.length === 1) {
  5570     var warnedProperties$1 = {};
  8483     warning$1(false, 'Invalid aria prop %s on <%s> tag. ' + 'For details, see https://fb.me/invalid-aria-prop', unknownPropString, type);
  5571     var _hasOwnProperty = Object.prototype.hasOwnProperty;
  8484   } else if (invalidProps.length > 1) {
  5572     var EVENT_NAME_REGEX = /^on./;
  8485     warning$1(false, 'Invalid aria props %s on <%s> tag. ' + 'For details, see https://fb.me/invalid-aria-prop', unknownPropString, type);
  5573     var INVALID_EVENT_NAME_REGEX = /^on[^A-Z]/;
  8486   }
  5574     var rARIA$1 = new RegExp('^(aria)-[' + ATTRIBUTE_NAME_CHAR + ']*$');
  8487 }
  5575     var rARIACamel$1 = new RegExp('^(aria)[A-Z][' + ATTRIBUTE_NAME_CHAR + ']*$');
  8488 
  5576 
  8489 function validateProperties(type, props) {
  5577     validateProperty$1 = function (tagName, name, value, canUseEventSystem) {
  8490   if (isCustomComponent(type, props)) {
  5578       if (_hasOwnProperty.call(warnedProperties$1, name) && warnedProperties$1[name]) {
  8491     return;
       
  8492   }
       
  8493   warnInvalidARIAProps(type, props);
       
  8494 }
       
  8495 
       
  8496 var didWarnValueNull = false;
       
  8497 
       
  8498 function validateProperties$1(type, props) {
       
  8499   if (type !== 'input' && type !== 'textarea' && type !== 'select') {
       
  8500     return;
       
  8501   }
       
  8502 
       
  8503   if (props != null && props.value === null && !didWarnValueNull) {
       
  8504     didWarnValueNull = true;
       
  8505     if (type === 'select' && props.multiple) {
       
  8506       warning$1(false, '`value` prop on `%s` should not be null. ' + 'Consider using an empty array when `multiple` is set to `true` ' + 'to clear the component or `undefined` for uncontrolled components.', type);
       
  8507     } else {
       
  8508       warning$1(false, '`value` prop on `%s` should not be null. ' + 'Consider using an empty string to clear the component or `undefined` ' + 'for uncontrolled components.', type);
       
  8509     }
       
  8510   }
       
  8511 }
       
  8512 
       
  8513 var validateProperty$1 = function () {};
       
  8514 
       
  8515 {
       
  8516   var warnedProperties$1 = {};
       
  8517   var _hasOwnProperty = Object.prototype.hasOwnProperty;
       
  8518   var EVENT_NAME_REGEX = /^on./;
       
  8519   var INVALID_EVENT_NAME_REGEX = /^on[^A-Z]/;
       
  8520   var rARIA$1 = new RegExp('^(aria)-[' + ATTRIBUTE_NAME_CHAR + ']*$');
       
  8521   var rARIACamel$1 = new RegExp('^(aria)[A-Z][' + ATTRIBUTE_NAME_CHAR + ']*$');
       
  8522 
       
  8523   validateProperty$1 = function (tagName, name, value, canUseEventSystem) {
       
  8524     if (_hasOwnProperty.call(warnedProperties$1, name) && warnedProperties$1[name]) {
       
  8525       return true;
       
  8526     }
       
  8527 
       
  8528     var lowerCasedName = name.toLowerCase();
       
  8529     if (lowerCasedName === 'onfocusin' || lowerCasedName === 'onfocusout') {
       
  8530       warning$1(false, 'React uses onFocus and onBlur instead of onFocusIn and onFocusOut. ' + 'All React events are normalized to bubble, so onFocusIn and onFocusOut ' + 'are not needed/supported by React.');
       
  8531       warnedProperties$1[name] = true;
       
  8532       return true;
       
  8533     }
       
  8534 
       
  8535     // We can't rely on the event system being injected on the server.
       
  8536     if (canUseEventSystem) {
       
  8537       if (registrationNameModules.hasOwnProperty(name)) {
       
  8538         return true;
  5579         return true;
  8539       }
  5580       }
  8540       var registrationName = possibleRegistrationNames.hasOwnProperty(lowerCasedName) ? possibleRegistrationNames[lowerCasedName] : null;
  5581 
  8541       if (registrationName != null) {
  5582       var lowerCasedName = name.toLowerCase();
  8542         warning$1(false, 'Invalid event handler property `%s`. Did you mean `%s`?', name, registrationName);
  5583 
       
  5584       if (lowerCasedName === 'onfocusin' || lowerCasedName === 'onfocusout') {
       
  5585         error('React uses onFocus and onBlur instead of onFocusIn and onFocusOut. ' + 'All React events are normalized to bubble, so onFocusIn and onFocusOut ' + 'are not needed/supported by React.');
       
  5586 
  8543         warnedProperties$1[name] = true;
  5587         warnedProperties$1[name] = true;
  8544         return true;
  5588         return true;
  8545       }
  5589       } // We can't rely on the event system being injected on the server.
  8546       if (EVENT_NAME_REGEX.test(name)) {
  5590 
  8547         warning$1(false, 'Unknown event handler property `%s`. It will be ignored.', name);
  5591 
       
  5592       if (canUseEventSystem) {
       
  5593         if (registrationNameModules.hasOwnProperty(name)) {
       
  5594           return true;
       
  5595         }
       
  5596 
       
  5597         var registrationName = possibleRegistrationNames.hasOwnProperty(lowerCasedName) ? possibleRegistrationNames[lowerCasedName] : null;
       
  5598 
       
  5599         if (registrationName != null) {
       
  5600           error('Invalid event handler property `%s`. Did you mean `%s`?', name, registrationName);
       
  5601 
       
  5602           warnedProperties$1[name] = true;
       
  5603           return true;
       
  5604         }
       
  5605 
       
  5606         if (EVENT_NAME_REGEX.test(name)) {
       
  5607           error('Unknown event handler property `%s`. It will be ignored.', name);
       
  5608 
       
  5609           warnedProperties$1[name] = true;
       
  5610           return true;
       
  5611         }
       
  5612       } else if (EVENT_NAME_REGEX.test(name)) {
       
  5613         // If no event plugins have been injected, we are in a server environment.
       
  5614         // So we can't tell if the event name is correct for sure, but we can filter
       
  5615         // out known bad ones like `onclick`. We can't suggest a specific replacement though.
       
  5616         if (INVALID_EVENT_NAME_REGEX.test(name)) {
       
  5617           error('Invalid event handler property `%s`. ' + 'React events use the camelCase naming convention, for example `onClick`.', name);
       
  5618         }
       
  5619 
  8548         warnedProperties$1[name] = true;
  5620         warnedProperties$1[name] = true;
  8549         return true;
  5621         return true;
  8550       }
  5622       } // Let the ARIA attribute hook validate ARIA attributes
  8551     } else if (EVENT_NAME_REGEX.test(name)) {
  5623 
  8552       // If no event plugins have been injected, we are in a server environment.
  5624 
  8553       // So we can't tell if the event name is correct for sure, but we can filter
  5625       if (rARIA$1.test(name) || rARIACamel$1.test(name)) {
  8554       // out known bad ones like `onclick`. We can't suggest a specific replacement though.
  5626         return true;
  8555       if (INVALID_EVENT_NAME_REGEX.test(name)) {
  5627       }
  8556         warning$1(false, 'Invalid event handler property `%s`. ' + 'React events use the camelCase naming convention, for example `onClick`.', name);
  5628 
  8557       }
  5629       if (lowerCasedName === 'innerhtml') {
  8558       warnedProperties$1[name] = true;
  5630         error('Directly setting property `innerHTML` is not permitted. ' + 'For more information, lookup documentation on `dangerouslySetInnerHTML`.');
  8559       return true;
  5631 
  8560     }
       
  8561 
       
  8562     // Let the ARIA attribute hook validate ARIA attributes
       
  8563     if (rARIA$1.test(name) || rARIACamel$1.test(name)) {
       
  8564       return true;
       
  8565     }
       
  8566 
       
  8567     if (lowerCasedName === 'innerhtml') {
       
  8568       warning$1(false, 'Directly setting property `innerHTML` is not permitted. ' + 'For more information, lookup documentation on `dangerouslySetInnerHTML`.');
       
  8569       warnedProperties$1[name] = true;
       
  8570       return true;
       
  8571     }
       
  8572 
       
  8573     if (lowerCasedName === 'aria') {
       
  8574       warning$1(false, 'The `aria` attribute is reserved for future use in React. ' + 'Pass individual `aria-` attributes instead.');
       
  8575       warnedProperties$1[name] = true;
       
  8576       return true;
       
  8577     }
       
  8578 
       
  8579     if (lowerCasedName === 'is' && value !== null && value !== undefined && typeof value !== 'string') {
       
  8580       warning$1(false, 'Received a `%s` for a string attribute `is`. If this is expected, cast ' + 'the value to a string.', typeof value);
       
  8581       warnedProperties$1[name] = true;
       
  8582       return true;
       
  8583     }
       
  8584 
       
  8585     if (typeof value === 'number' && isNaN(value)) {
       
  8586       warning$1(false, 'Received NaN for the `%s` attribute. If this is expected, cast ' + 'the value to a string.', name);
       
  8587       warnedProperties$1[name] = true;
       
  8588       return true;
       
  8589     }
       
  8590 
       
  8591     var propertyInfo = getPropertyInfo(name);
       
  8592     var isReserved = propertyInfo !== null && propertyInfo.type === RESERVED;
       
  8593 
       
  8594     // Known attributes should match the casing specified in the property config.
       
  8595     if (possibleStandardNames.hasOwnProperty(lowerCasedName)) {
       
  8596       var standardName = possibleStandardNames[lowerCasedName];
       
  8597       if (standardName !== name) {
       
  8598         warning$1(false, 'Invalid DOM property `%s`. Did you mean `%s`?', name, standardName);
       
  8599         warnedProperties$1[name] = true;
  5632         warnedProperties$1[name] = true;
  8600         return true;
  5633         return true;
  8601       }
  5634       }
  8602     } else if (!isReserved && name !== lowerCasedName) {
  5635 
  8603       // Unknown attributes should have lowercase casing since that's how they
  5636       if (lowerCasedName === 'aria') {
  8604       // will be cased anyway with server rendering.
  5637         error('The `aria` attribute is reserved for future use in React. ' + 'Pass individual `aria-` attributes instead.');
  8605       warning$1(false, 'React does not recognize the `%s` prop on a DOM element. If you ' + 'intentionally want it to appear in the DOM as a custom ' + 'attribute, spell it as lowercase `%s` instead. ' + 'If you accidentally passed it from a parent component, remove ' + 'it from the DOM element.', name, lowerCasedName);
  5638 
  8606       warnedProperties$1[name] = true;
  5639         warnedProperties$1[name] = true;
       
  5640         return true;
       
  5641       }
       
  5642 
       
  5643       if (lowerCasedName === 'is' && value !== null && value !== undefined && typeof value !== 'string') {
       
  5644         error('Received a `%s` for a string attribute `is`. If this is expected, cast ' + 'the value to a string.', typeof value);
       
  5645 
       
  5646         warnedProperties$1[name] = true;
       
  5647         return true;
       
  5648       }
       
  5649 
       
  5650       if (typeof value === 'number' && isNaN(value)) {
       
  5651         error('Received NaN for the `%s` attribute. If this is expected, cast ' + 'the value to a string.', name);
       
  5652 
       
  5653         warnedProperties$1[name] = true;
       
  5654         return true;
       
  5655       }
       
  5656 
       
  5657       var propertyInfo = getPropertyInfo(name);
       
  5658       var isReserved = propertyInfo !== null && propertyInfo.type === RESERVED; // Known attributes should match the casing specified in the property config.
       
  5659 
       
  5660       if (possibleStandardNames.hasOwnProperty(lowerCasedName)) {
       
  5661         var standardName = possibleStandardNames[lowerCasedName];
       
  5662 
       
  5663         if (standardName !== name) {
       
  5664           error('Invalid DOM property `%s`. Did you mean `%s`?', name, standardName);
       
  5665 
       
  5666           warnedProperties$1[name] = true;
       
  5667           return true;
       
  5668         }
       
  5669       } else if (!isReserved && name !== lowerCasedName) {
       
  5670         // Unknown attributes should have lowercase casing since that's how they
       
  5671         // will be cased anyway with server rendering.
       
  5672         error('React does not recognize the `%s` prop on a DOM element. If you ' + 'intentionally want it to appear in the DOM as a custom ' + 'attribute, spell it as lowercase `%s` instead. ' + 'If you accidentally passed it from a parent component, remove ' + 'it from the DOM element.', name, lowerCasedName);
       
  5673 
       
  5674         warnedProperties$1[name] = true;
       
  5675         return true;
       
  5676       }
       
  5677 
       
  5678       if (typeof value === 'boolean' && shouldRemoveAttributeWithWarning(name, value, propertyInfo, false)) {
       
  5679         if (value) {
       
  5680           error('Received `%s` for a non-boolean attribute `%s`.\n\n' + 'If you want to write it to the DOM, pass a string instead: ' + '%s="%s" or %s={value.toString()}.', value, name, name, value, name);
       
  5681         } else {
       
  5682           error('Received `%s` for a non-boolean attribute `%s`.\n\n' + 'If you want to write it to the DOM, pass a string instead: ' + '%s="%s" or %s={value.toString()}.\n\n' + 'If you used to conditionally omit it with %s={condition && value}, ' + 'pass %s={condition ? value : undefined} instead.', value, name, name, value, name, name, name);
       
  5683         }
       
  5684 
       
  5685         warnedProperties$1[name] = true;
       
  5686         return true;
       
  5687       } // Now that we've validated casing, do not validate
       
  5688       // data types for reserved props
       
  5689 
       
  5690 
       
  5691       if (isReserved) {
       
  5692         return true;
       
  5693       } // Warn when a known attribute is a bad type
       
  5694 
       
  5695 
       
  5696       if (shouldRemoveAttributeWithWarning(name, value, propertyInfo, false)) {
       
  5697         warnedProperties$1[name] = true;
       
  5698         return false;
       
  5699       } // Warn when passing the strings 'false' or 'true' into a boolean prop
       
  5700 
       
  5701 
       
  5702       if ((value === 'false' || value === 'true') && propertyInfo !== null && propertyInfo.type === BOOLEAN) {
       
  5703         error('Received the string `%s` for the boolean attribute `%s`. ' + '%s ' + 'Did you mean %s={%s}?', value, name, value === 'false' ? 'The browser will interpret it as a truthy value.' : 'Although this works, it will not work as expected if you pass the string "false".', name, value);
       
  5704 
       
  5705         warnedProperties$1[name] = true;
       
  5706         return true;
       
  5707       }
       
  5708 
  8607       return true;
  5709       return true;
  8608     }
  5710     };
  8609 
  5711   }
  8610     if (typeof value === 'boolean' && shouldRemoveAttributeWithWarning(name, value, propertyInfo, false)) {
  5712 
  8611       if (value) {
  5713   var warnUnknownProperties = function (type, props, canUseEventSystem) {
  8612         warning$1(false, 'Received `%s` for a non-boolean attribute `%s`.\n\n' + 'If you want to write it to the DOM, pass a string instead: ' + '%s="%s" or %s={value.toString()}.', value, name, name, value, name);
  5714     {
       
  5715       var unknownProps = [];
       
  5716 
       
  5717       for (var key in props) {
       
  5718         var isValid = validateProperty$1(type, key, props[key], canUseEventSystem);
       
  5719 
       
  5720         if (!isValid) {
       
  5721           unknownProps.push(key);
       
  5722         }
       
  5723       }
       
  5724 
       
  5725       var unknownPropString = unknownProps.map(function (prop) {
       
  5726         return '`' + prop + '`';
       
  5727       }).join(', ');
       
  5728 
       
  5729       if (unknownProps.length === 1) {
       
  5730         error('Invalid value for prop %s on <%s> tag. Either remove it from the element, ' + 'or pass a string or number value to keep it in the DOM. ' + 'For details, see https://fb.me/react-attribute-behavior', unknownPropString, type);
       
  5731       } else if (unknownProps.length > 1) {
       
  5732         error('Invalid values for props %s on <%s> tag. Either remove them from the element, ' + 'or pass a string or number value to keep them in the DOM. ' + 'For details, see https://fb.me/react-attribute-behavior', unknownPropString, type);
       
  5733       }
       
  5734     }
       
  5735   };
       
  5736 
       
  5737   function validateProperties$2(type, props, canUseEventSystem) {
       
  5738     if (isCustomComponent(type, props)) {
       
  5739       return;
       
  5740     }
       
  5741 
       
  5742     warnUnknownProperties(type, props, canUseEventSystem);
       
  5743   }
       
  5744 
       
  5745   var didWarnInvalidHydration = false;
       
  5746   var DANGEROUSLY_SET_INNER_HTML = 'dangerouslySetInnerHTML';
       
  5747   var SUPPRESS_CONTENT_EDITABLE_WARNING = 'suppressContentEditableWarning';
       
  5748   var SUPPRESS_HYDRATION_WARNING = 'suppressHydrationWarning';
       
  5749   var AUTOFOCUS = 'autoFocus';
       
  5750   var CHILDREN = 'children';
       
  5751   var STYLE = 'style';
       
  5752   var HTML$1 = '__html';
       
  5753   var HTML_NAMESPACE$1 = Namespaces.html;
       
  5754   var warnedUnknownTags;
       
  5755   var suppressHydrationWarning;
       
  5756   var validatePropertiesInDevelopment;
       
  5757   var warnForTextDifference;
       
  5758   var warnForPropDifference;
       
  5759   var warnForExtraAttributes;
       
  5760   var warnForInvalidEventListener;
       
  5761   var canDiffStyleForHydrationWarning;
       
  5762   var normalizeMarkupForTextOrAttribute;
       
  5763   var normalizeHTML;
       
  5764 
       
  5765   {
       
  5766     warnedUnknownTags = {
       
  5767       // Chrome is the only major browser not shipping <time>. But as of July
       
  5768       // 2017 it intends to ship it due to widespread usage. We intentionally
       
  5769       // *don't* warn for <time> even if it's unrecognized by Chrome because
       
  5770       // it soon will be, and many apps have been using it anyway.
       
  5771       time: true,
       
  5772       // There are working polyfills for <dialog>. Let people use it.
       
  5773       dialog: true,
       
  5774       // Electron ships a custom <webview> tag to display external web content in
       
  5775       // an isolated frame and process.
       
  5776       // This tag is not present in non Electron environments such as JSDom which
       
  5777       // is often used for testing purposes.
       
  5778       // @see https://electronjs.org/docs/api/webview-tag
       
  5779       webview: true
       
  5780     };
       
  5781 
       
  5782     validatePropertiesInDevelopment = function (type, props) {
       
  5783       validateProperties(type, props);
       
  5784       validateProperties$1(type, props);
       
  5785       validateProperties$2(type, props,
       
  5786       /* canUseEventSystem */
       
  5787       true);
       
  5788     }; // IE 11 parses & normalizes the style attribute as opposed to other
       
  5789     // browsers. It adds spaces and sorts the properties in some
       
  5790     // non-alphabetical order. Handling that would require sorting CSS
       
  5791     // properties in the client & server versions or applying
       
  5792     // `expectedStyle` to a temporary DOM node to read its `style` attribute
       
  5793     // normalized. Since it only affects IE, we're skipping style warnings
       
  5794     // in that browser completely in favor of doing all that work.
       
  5795     // See https://github.com/facebook/react/issues/11807
       
  5796 
       
  5797 
       
  5798     canDiffStyleForHydrationWarning = canUseDOM && !document.documentMode; // HTML parsing normalizes CR and CRLF to LF.
       
  5799     // It also can turn \u0000 into \uFFFD inside attributes.
       
  5800     // https://www.w3.org/TR/html5/single-page.html#preprocessing-the-input-stream
       
  5801     // If we have a mismatch, it might be caused by that.
       
  5802     // We will still patch up in this case but not fire the warning.
       
  5803 
       
  5804     var NORMALIZE_NEWLINES_REGEX = /\r\n?/g;
       
  5805     var NORMALIZE_NULL_AND_REPLACEMENT_REGEX = /\u0000|\uFFFD/g;
       
  5806 
       
  5807     normalizeMarkupForTextOrAttribute = function (markup) {
       
  5808       var markupString = typeof markup === 'string' ? markup : '' + markup;
       
  5809       return markupString.replace(NORMALIZE_NEWLINES_REGEX, '\n').replace(NORMALIZE_NULL_AND_REPLACEMENT_REGEX, '');
       
  5810     };
       
  5811 
       
  5812     warnForTextDifference = function (serverText, clientText) {
       
  5813       if (didWarnInvalidHydration) {
       
  5814         return;
       
  5815       }
       
  5816 
       
  5817       var normalizedClientText = normalizeMarkupForTextOrAttribute(clientText);
       
  5818       var normalizedServerText = normalizeMarkupForTextOrAttribute(serverText);
       
  5819 
       
  5820       if (normalizedServerText === normalizedClientText) {
       
  5821         return;
       
  5822       }
       
  5823 
       
  5824       didWarnInvalidHydration = true;
       
  5825 
       
  5826       error('Text content did not match. Server: "%s" Client: "%s"', normalizedServerText, normalizedClientText);
       
  5827     };
       
  5828 
       
  5829     warnForPropDifference = function (propName, serverValue, clientValue) {
       
  5830       if (didWarnInvalidHydration) {
       
  5831         return;
       
  5832       }
       
  5833 
       
  5834       var normalizedClientValue = normalizeMarkupForTextOrAttribute(clientValue);
       
  5835       var normalizedServerValue = normalizeMarkupForTextOrAttribute(serverValue);
       
  5836 
       
  5837       if (normalizedServerValue === normalizedClientValue) {
       
  5838         return;
       
  5839       }
       
  5840 
       
  5841       didWarnInvalidHydration = true;
       
  5842 
       
  5843       error('Prop `%s` did not match. Server: %s Client: %s', propName, JSON.stringify(normalizedServerValue), JSON.stringify(normalizedClientValue));
       
  5844     };
       
  5845 
       
  5846     warnForExtraAttributes = function (attributeNames) {
       
  5847       if (didWarnInvalidHydration) {
       
  5848         return;
       
  5849       }
       
  5850 
       
  5851       didWarnInvalidHydration = true;
       
  5852       var names = [];
       
  5853       attributeNames.forEach(function (name) {
       
  5854         names.push(name);
       
  5855       });
       
  5856 
       
  5857       error('Extra attributes from the server: %s', names);
       
  5858     };
       
  5859 
       
  5860     warnForInvalidEventListener = function (registrationName, listener) {
       
  5861       if (listener === false) {
       
  5862         error('Expected `%s` listener to be a function, instead got `false`.\n\n' + 'If you used to conditionally omit it with %s={condition && value}, ' + 'pass %s={condition ? value : undefined} instead.', registrationName, registrationName, registrationName);
  8613       } else {
  5863       } else {
  8614         warning$1(false, 'Received `%s` for a non-boolean attribute `%s`.\n\n' + 'If you want to write it to the DOM, pass a string instead: ' + '%s="%s" or %s={value.toString()}.\n\n' + 'If you used to conditionally omit it with %s={condition && value}, ' + 'pass %s={condition ? value : undefined} instead.', value, name, name, value, name, name, name);
  5864         error('Expected `%s` listener to be a function, instead got a value of `%s` type.', registrationName, typeof listener);
  8615       }
  5865       }
  8616       warnedProperties$1[name] = true;
  5866     }; // Parse the HTML and read it back to normalize the HTML string so that it
  8617       return true;
  5867     // can be used for comparison.
  8618     }
  5868 
  8619 
  5869 
  8620     // Now that we've validated casing, do not validate
  5870     normalizeHTML = function (parent, html) {
  8621     // data types for reserved props
  5871       // We could have created a separate document here to avoid
  8622     if (isReserved) {
  5872       // re-initializing custom elements if they exist. But this breaks
  8623       return true;
  5873       // how <noscript> is being handled. So we use the same document.
  8624     }
  5874       // See the discussion in https://github.com/facebook/react/pull/11157.
  8625 
  5875       var testElement = parent.namespaceURI === HTML_NAMESPACE$1 ? parent.ownerDocument.createElement(parent.tagName) : parent.ownerDocument.createElementNS(parent.namespaceURI, parent.tagName);
  8626     // Warn when a known attribute is a bad type
  5876       testElement.innerHTML = html;
  8627     if (shouldRemoveAttributeWithWarning(name, value, propertyInfo, false)) {
  5877       return testElement.innerHTML;
  8628       warnedProperties$1[name] = true;
  5878     };
  8629       return false;
  5879   }
  8630     }
  5880 
  8631 
  5881   function ensureListeningTo(rootContainerElement, registrationName) {
  8632     // Warn when passing the strings 'false' or 'true' into a boolean prop
  5882     var isDocumentOrFragment = rootContainerElement.nodeType === DOCUMENT_NODE || rootContainerElement.nodeType === DOCUMENT_FRAGMENT_NODE;
  8633     if ((value === 'false' || value === 'true') && propertyInfo !== null && propertyInfo.type === BOOLEAN) {
  5883     var doc = isDocumentOrFragment ? rootContainerElement : rootContainerElement.ownerDocument;
  8634       warning$1(false, 'Received the string `%s` for the boolean attribute `%s`. ' + '%s ' + 'Did you mean %s={%s}?', value, name, value === 'false' ? 'The browser will interpret it as a truthy value.' : 'Although this works, it will not work as expected if you pass the string "false".', name, value);
  5884     legacyListenToEvent(registrationName, doc);
  8635       warnedProperties$1[name] = true;
  5885   }
  8636       return true;
  5886 
  8637     }
  5887   function getOwnerDocumentFromRootContainer(rootContainerElement) {
  8638 
  5888     return rootContainerElement.nodeType === DOCUMENT_NODE ? rootContainerElement : rootContainerElement.ownerDocument;
  8639     return true;
  5889   }
  8640   };
  5890 
  8641 }
  5891   function noop() {}
  8642 
  5892 
  8643 var warnUnknownProperties = function (type, props, canUseEventSystem) {
  5893   function trapClickOnNonInteractiveElement(node) {
  8644   var unknownProps = [];
  5894     // Mobile Safari does not fire properly bubble click events on
  8645   for (var key in props) {
  5895     // non-interactive elements, which means delegated click listeners do not
  8646     var isValid = validateProperty$1(type, key, props[key], canUseEventSystem);
  5896     // fire. The workaround for this bug involves attaching an empty click
  8647     if (!isValid) {
  5897     // listener on the target node.
  8648       unknownProps.push(key);
  5898     // http://www.quirksmode.org/blog/archives/2010/09/click_event_del.html
  8649     }
  5899     // Just set it using the onclick property so that we don't have to manage any
  8650   }
  5900     // bookkeeping for it. Not sure if we need to clear it when the listener is
  8651 
  5901     // removed.
  8652   var unknownPropString = unknownProps.map(function (prop) {
  5902     // TODO: Only do this for the relevant Safaris maybe?
  8653     return '`' + prop + '`';
  5903     node.onclick = noop;
  8654   }).join(', ');
  5904   }
  8655   if (unknownProps.length === 1) {
  5905 
  8656     warning$1(false, 'Invalid value for prop %s on <%s> tag. Either remove it from the element, ' + 'or pass a string or number value to keep it in the DOM. ' + 'For details, see https://fb.me/react-attribute-behavior', unknownPropString, type);
  5906   function setInitialDOMProperties(tag, domElement, rootContainerElement, nextProps, isCustomComponentTag) {
  8657   } else if (unknownProps.length > 1) {
  5907     for (var propKey in nextProps) {
  8658     warning$1(false, 'Invalid values for props %s on <%s> tag. Either remove them from the element, ' + 'or pass a string or number value to keep them in the DOM. ' + 'For details, see https://fb.me/react-attribute-behavior', unknownPropString, type);
  5908       if (!nextProps.hasOwnProperty(propKey)) {
  8659   }
  5909         continue;
  8660 };
  5910       }
  8661 
  5911 
  8662 function validateProperties$2(type, props, canUseEventSystem) {
  5912       var nextProp = nextProps[propKey];
  8663   if (isCustomComponent(type, props)) {
  5913 
  8664     return;
  5914       if (propKey === STYLE) {
  8665   }
  5915         {
  8666   warnUnknownProperties(type, props, canUseEventSystem);
  5916           if (nextProp) {
  8667 }
  5917             // Freeze the next style object so that we can assume it won't be
  8668 
  5918             // mutated. We have already warned for this in the past.
  8669 // TODO: direct imports like some-package/src/* are bad. Fix me.
  5919             Object.freeze(nextProp);
  8670 var didWarnInvalidHydration = false;
  5920           }
  8671 var didWarnShadyDOM = false;
  5921         } // Relies on `updateStylesByID` not mutating `styleUpdates`.
  8672 
  5922 
  8673 var DANGEROUSLY_SET_INNER_HTML = 'dangerouslySetInnerHTML';
  5923 
  8674 var SUPPRESS_CONTENT_EDITABLE_WARNING = 'suppressContentEditableWarning';
  5924         setValueForStyles(domElement, nextProp);
  8675 var SUPPRESS_HYDRATION_WARNING$1 = 'suppressHydrationWarning';
  5925       } else if (propKey === DANGEROUSLY_SET_INNER_HTML) {
  8676 var AUTOFOCUS = 'autoFocus';
  5926         var nextHtml = nextProp ? nextProp[HTML$1] : undefined;
  8677 var CHILDREN = 'children';
  5927 
  8678 var STYLE$1 = 'style';
  5928         if (nextHtml != null) {
  8679 var HTML = '__html';
  5929           setInnerHTML(domElement, nextHtml);
  8680 var LISTENERS = 'listeners';
  5930         }
  8681 
  5931       } else if (propKey === CHILDREN) {
  8682 var HTML_NAMESPACE = Namespaces.html;
  5932         if (typeof nextProp === 'string') {
  8683 
  5933           // Avoid setting initial textContent when the text is empty. In IE11 setting
  8684 
  5934           // textContent on a <textarea> will cause the placeholder to not
  8685 var warnedUnknownTags = void 0;
  5935           // show within the <textarea> until it has been focused and blurred again.
  8686 var suppressHydrationWarning = void 0;
  5936           // https://github.com/facebook/react/issues/6731#issuecomment-254874553
  8687 
  5937           var canSetTextContent = tag !== 'textarea' || nextProp !== '';
  8688 var validatePropertiesInDevelopment = void 0;
  5938 
  8689 var warnForTextDifference = void 0;
  5939           if (canSetTextContent) {
  8690 var warnForPropDifference = void 0;
  5940             setTextContent(domElement, nextProp);
  8691 var warnForExtraAttributes = void 0;
  5941           }
  8692 var warnForInvalidEventListener = void 0;
  5942         } else if (typeof nextProp === 'number') {
  8693 var canDiffStyleForHydrationWarning = void 0;
  5943           setTextContent(domElement, '' + nextProp);
  8694 
  5944         }
  8695 var normalizeMarkupForTextOrAttribute = void 0;
  5945       } else if ( propKey === SUPPRESS_CONTENT_EDITABLE_WARNING || propKey === SUPPRESS_HYDRATION_WARNING) ; else if (propKey === AUTOFOCUS) ; else if (registrationNameModules.hasOwnProperty(propKey)) {
  8696 var normalizeHTML = void 0;
  5946         if (nextProp != null) {
  8697 
  5947           if ( typeof nextProp !== 'function') {
  8698 {
  5948             warnForInvalidEventListener(propKey, nextProp);
  8699   warnedUnknownTags = {
  5949           }
  8700     // Chrome is the only major browser not shipping <time>. But as of July
  5950 
  8701     // 2017 it intends to ship it due to widespread usage. We intentionally
  5951           ensureListeningTo(rootContainerElement, propKey);
  8702     // *don't* warn for <time> even if it's unrecognized by Chrome because
  5952         }
  8703     // it soon will be, and many apps have been using it anyway.
  5953       } else if (nextProp != null) {
  8704     time: true,
  5954         setValueForProperty(domElement, propKey, nextProp, isCustomComponentTag);
  8705     // There are working polyfills for <dialog>. Let people use it.
  5955       }
  8706     dialog: true,
  5956     }
  8707     // Electron ships a custom <webview> tag to display external web content in
  5957   }
  8708     // an isolated frame and process.
  5958 
  8709     // This tag is not present in non Electron environments such as JSDom which
  5959   function updateDOMProperties(domElement, updatePayload, wasCustomComponentTag, isCustomComponentTag) {
  8710     // is often used for testing purposes.
  5960     // TODO: Handle wasCustomComponentTag
  8711     // @see https://electronjs.org/docs/api/webview-tag
  5961     for (var i = 0; i < updatePayload.length; i += 2) {
  8712     webview: true
  5962       var propKey = updatePayload[i];
  8713   };
  5963       var propValue = updatePayload[i + 1];
  8714 
  5964 
  8715   validatePropertiesInDevelopment = function (type, props) {
  5965       if (propKey === STYLE) {
  8716     validateProperties(type, props);
  5966         setValueForStyles(domElement, propValue);
  8717     validateProperties$1(type, props);
  5967       } else if (propKey === DANGEROUSLY_SET_INNER_HTML) {
  8718     validateProperties$2(type, props, /* canUseEventSystem */true);
  5968         setInnerHTML(domElement, propValue);
  8719   };
  5969       } else if (propKey === CHILDREN) {
  8720 
  5970         setTextContent(domElement, propValue);
  8721   // IE 11 parses & normalizes the style attribute as opposed to other
  5971       } else {
  8722   // browsers. It adds spaces and sorts the properties in some
  5972         setValueForProperty(domElement, propKey, propValue, isCustomComponentTag);
  8723   // non-alphabetical order. Handling that would require sorting CSS
  5973       }
  8724   // properties in the client & server versions or applying
  5974     }
  8725   // `expectedStyle` to a temporary DOM node to read its `style` attribute
  5975   }
  8726   // normalized. Since it only affects IE, we're skipping style warnings
  5976 
  8727   // in that browser completely in favor of doing all that work.
  5977   function createElement(type, props, rootContainerElement, parentNamespace) {
  8728   // See https://github.com/facebook/react/issues/11807
  5978     var isCustomComponentTag; // We create tags in the namespace of their parent container, except HTML
  8729   canDiffStyleForHydrationWarning = canUseDOM && !document.documentMode;
  5979     // tags get no namespace.
  8730 
  5980 
  8731   // HTML parsing normalizes CR and CRLF to LF.
  5981     var ownerDocument = getOwnerDocumentFromRootContainer(rootContainerElement);
  8732   // It also can turn \u0000 into \uFFFD inside attributes.
  5982     var domElement;
  8733   // https://www.w3.org/TR/html5/single-page.html#preprocessing-the-input-stream
  5983     var namespaceURI = parentNamespace;
  8734   // If we have a mismatch, it might be caused by that.
  5984 
  8735   // We will still patch up in this case but not fire the warning.
  5985     if (namespaceURI === HTML_NAMESPACE$1) {
  8736   var NORMALIZE_NEWLINES_REGEX = /\r\n?/g;
  5986       namespaceURI = getIntrinsicNamespace(type);
  8737   var NORMALIZE_NULL_AND_REPLACEMENT_REGEX = /\u0000|\uFFFD/g;
  5987     }
  8738 
  5988 
  8739   normalizeMarkupForTextOrAttribute = function (markup) {
  5989     if (namespaceURI === HTML_NAMESPACE$1) {
  8740     var markupString = typeof markup === 'string' ? markup : '' + markup;
  5990       {
  8741     return markupString.replace(NORMALIZE_NEWLINES_REGEX, '\n').replace(NORMALIZE_NULL_AND_REPLACEMENT_REGEX, '');
  5991         isCustomComponentTag = isCustomComponent(type, props); // Should this check be gated by parent namespace? Not sure we want to
  8742   };
  5992         // allow <SVG> or <mATH>.
  8743 
  5993 
  8744   warnForTextDifference = function (serverText, clientText) {
  5994         if (!isCustomComponentTag && type !== type.toLowerCase()) {
  8745     if (didWarnInvalidHydration) {
  5995           error('<%s /> is using incorrect casing. ' + 'Use PascalCase for React components, ' + 'or lowercase for HTML elements.', type);
  8746       return;
  5996         }
  8747     }
  5997       }
  8748     var normalizedClientText = normalizeMarkupForTextOrAttribute(clientText);
  5998 
  8749     var normalizedServerText = normalizeMarkupForTextOrAttribute(serverText);
  5999       if (type === 'script') {
  8750     if (normalizedServerText === normalizedClientText) {
  6000         // Create the script via .innerHTML so its "parser-inserted" flag is
  8751       return;
  6001         // set to true and it does not execute
  8752     }
  6002         var div = ownerDocument.createElement('div');
  8753     didWarnInvalidHydration = true;
  6003 
  8754     warningWithoutStack$1(false, 'Text content did not match. Server: "%s" Client: "%s"', normalizedServerText, normalizedClientText);
  6004         div.innerHTML = '<script><' + '/script>'; // eslint-disable-line
  8755   };
  6005         // This is guaranteed to yield a script element.
  8756 
  6006 
  8757   warnForPropDifference = function (propName, serverValue, clientValue) {
  6007         var firstChild = div.firstChild;
  8758     if (didWarnInvalidHydration) {
  6008         domElement = div.removeChild(firstChild);
  8759       return;
  6009       } else if (typeof props.is === 'string') {
  8760     }
  6010         // $FlowIssue `createElement` should be updated for Web Components
  8761     var normalizedClientValue = normalizeMarkupForTextOrAttribute(clientValue);
  6011         domElement = ownerDocument.createElement(type, {
  8762     var normalizedServerValue = normalizeMarkupForTextOrAttribute(serverValue);
  6012           is: props.is
  8763     if (normalizedServerValue === normalizedClientValue) {
  6013         });
  8764       return;
  6014       } else {
  8765     }
  6015         // Separate else branch instead of using `props.is || undefined` above because of a Firefox bug.
  8766     didWarnInvalidHydration = true;
  6016         // See discussion in https://github.com/facebook/react/pull/6896
  8767     warningWithoutStack$1(false, 'Prop `%s` did not match. Server: %s Client: %s', propName, JSON.stringify(normalizedServerValue), JSON.stringify(normalizedClientValue));
  6017         // and discussion in https://bugzilla.mozilla.org/show_bug.cgi?id=1276240
  8768   };
  6018         domElement = ownerDocument.createElement(type); // Normally attributes are assigned in `setInitialDOMProperties`, however the `multiple` and `size`
  8769 
  6019         // attributes on `select`s needs to be added before `option`s are inserted.
  8770   warnForExtraAttributes = function (attributeNames) {
  6020         // This prevents:
  8771     if (didWarnInvalidHydration) {
  6021         // - a bug where the `select` does not scroll to the correct option because singular
  8772       return;
  6022         //  `select` elements automatically pick the first item #13222
  8773     }
  6023         // - a bug where the `select` set the first item as selected despite the `size` attribute #14239
  8774     didWarnInvalidHydration = true;
  6024         // See https://github.com/facebook/react/issues/13222
  8775     var names = [];
  6025         // and https://github.com/facebook/react/issues/14239
  8776     attributeNames.forEach(function (name) {
  6026 
  8777       names.push(name);
  6027         if (type === 'select') {
  8778     });
  6028           var node = domElement;
  8779     warningWithoutStack$1(false, 'Extra attributes from the server: %s', names);
  6029 
  8780   };
  6030           if (props.multiple) {
  8781 
  6031             node.multiple = true;
  8782   warnForInvalidEventListener = function (registrationName, listener) {
  6032           } else if (props.size) {
  8783     if (listener === false) {
  6033             // Setting a size greater than 1 causes a select to behave like `multiple=true`, where
  8784       warning$1(false, 'Expected `%s` listener to be a function, instead got `false`.\n\n' + 'If you used to conditionally omit it with %s={condition && value}, ' + 'pass %s={condition ? value : undefined} instead.', registrationName, registrationName, registrationName);
  6034             // it is possible that no option is selected.
       
  6035             //
       
  6036             // This is only necessary when a select in "single selection mode".
       
  6037             node.size = props.size;
       
  6038           }
       
  6039         }
       
  6040       }
  8785     } else {
  6041     } else {
  8786       warning$1(false, 'Expected `%s` listener to be a function, instead got a value of `%s` type.', registrationName, typeof listener);
  6042       domElement = ownerDocument.createElementNS(namespaceURI, type);
  8787     }
  6043     }
  8788   };
  6044 
  8789 
       
  8790   // Parse the HTML and read it back to normalize the HTML string so that it
       
  8791   // can be used for comparison.
       
  8792   normalizeHTML = function (parent, html) {
       
  8793     // We could have created a separate document here to avoid
       
  8794     // re-initializing custom elements if they exist. But this breaks
       
  8795     // how <noscript> is being handled. So we use the same document.
       
  8796     // See the discussion in https://github.com/facebook/react/pull/11157.
       
  8797     var testElement = parent.namespaceURI === HTML_NAMESPACE ? parent.ownerDocument.createElement(parent.tagName) : parent.ownerDocument.createElementNS(parent.namespaceURI, parent.tagName);
       
  8798     testElement.innerHTML = html;
       
  8799     return testElement.innerHTML;
       
  8800   };
       
  8801 }
       
  8802 
       
  8803 function ensureListeningTo(rootContainerElement, registrationName) {
       
  8804   var isDocumentOrFragment = rootContainerElement.nodeType === DOCUMENT_NODE || rootContainerElement.nodeType === DOCUMENT_FRAGMENT_NODE;
       
  8805   var doc = isDocumentOrFragment ? rootContainerElement : rootContainerElement.ownerDocument;
       
  8806   listenTo(registrationName, doc);
       
  8807 }
       
  8808 
       
  8809 function getOwnerDocumentFromRootContainer(rootContainerElement) {
       
  8810   return rootContainerElement.nodeType === DOCUMENT_NODE ? rootContainerElement : rootContainerElement.ownerDocument;
       
  8811 }
       
  8812 
       
  8813 function noop() {}
       
  8814 
       
  8815 function trapClickOnNonInteractiveElement(node) {
       
  8816   // Mobile Safari does not fire properly bubble click events on
       
  8817   // non-interactive elements, which means delegated click listeners do not
       
  8818   // fire. The workaround for this bug involves attaching an empty click
       
  8819   // listener on the target node.
       
  8820   // http://www.quirksmode.org/blog/archives/2010/09/click_event_del.html
       
  8821   // Just set it using the onclick property so that we don't have to manage any
       
  8822   // bookkeeping for it. Not sure if we need to clear it when the listener is
       
  8823   // removed.
       
  8824   // TODO: Only do this for the relevant Safaris maybe?
       
  8825   node.onclick = noop;
       
  8826 }
       
  8827 
       
  8828 function setInitialDOMProperties(tag, domElement, rootContainerElement, nextProps, isCustomComponentTag) {
       
  8829   for (var propKey in nextProps) {
       
  8830     if (!nextProps.hasOwnProperty(propKey)) {
       
  8831       continue;
       
  8832     }
       
  8833     var nextProp = nextProps[propKey];
       
  8834     if (propKey === STYLE$1) {
       
  8835       {
       
  8836         if (nextProp) {
       
  8837           // Freeze the next style object so that we can assume it won't be
       
  8838           // mutated. We have already warned for this in the past.
       
  8839           Object.freeze(nextProp);
       
  8840         }
       
  8841       }
       
  8842       // Relies on `updateStylesByID` not mutating `styleUpdates`.
       
  8843       setValueForStyles(domElement, nextProp);
       
  8844     } else if (propKey === DANGEROUSLY_SET_INNER_HTML) {
       
  8845       var nextHtml = nextProp ? nextProp[HTML] : undefined;
       
  8846       if (nextHtml != null) {
       
  8847         setInnerHTML(domElement, nextHtml);
       
  8848       }
       
  8849     } else if (propKey === CHILDREN) {
       
  8850       if (typeof nextProp === 'string') {
       
  8851         // Avoid setting initial textContent when the text is empty. In IE11 setting
       
  8852         // textContent on a <textarea> will cause the placeholder to not
       
  8853         // show within the <textarea> until it has been focused and blurred again.
       
  8854         // https://github.com/facebook/react/issues/6731#issuecomment-254874553
       
  8855         var canSetTextContent = tag !== 'textarea' || nextProp !== '';
       
  8856         if (canSetTextContent) {
       
  8857           setTextContent(domElement, nextProp);
       
  8858         }
       
  8859       } else if (typeof nextProp === 'number') {
       
  8860         setTextContent(domElement, '' + nextProp);
       
  8861       }
       
  8862     } else if (enableFlareAPI && propKey === LISTENERS || propKey === SUPPRESS_CONTENT_EDITABLE_WARNING || propKey === SUPPRESS_HYDRATION_WARNING$1) {
       
  8863       // Noop
       
  8864     } else if (propKey === AUTOFOCUS) {
       
  8865       // We polyfill it separately on the client during commit.
       
  8866       // We could have excluded it in the property list instead of
       
  8867       // adding a special case here, but then it wouldn't be emitted
       
  8868       // on server rendering (but we *do* want to emit it in SSR).
       
  8869     } else if (registrationNameModules.hasOwnProperty(propKey)) {
       
  8870       if (nextProp != null) {
       
  8871         if (true && typeof nextProp !== 'function') {
       
  8872           warnForInvalidEventListener(propKey, nextProp);
       
  8873         }
       
  8874         ensureListeningTo(rootContainerElement, propKey);
       
  8875       }
       
  8876     } else if (nextProp != null) {
       
  8877       setValueForProperty(domElement, propKey, nextProp, isCustomComponentTag);
       
  8878     }
       
  8879   }
       
  8880 }
       
  8881 
       
  8882 function updateDOMProperties(domElement, updatePayload, wasCustomComponentTag, isCustomComponentTag) {
       
  8883   // TODO: Handle wasCustomComponentTag
       
  8884   for (var i = 0; i < updatePayload.length; i += 2) {
       
  8885     var propKey = updatePayload[i];
       
  8886     var propValue = updatePayload[i + 1];
       
  8887     if (propKey === STYLE$1) {
       
  8888       setValueForStyles(domElement, propValue);
       
  8889     } else if (propKey === DANGEROUSLY_SET_INNER_HTML) {
       
  8890       setInnerHTML(domElement, propValue);
       
  8891     } else if (propKey === CHILDREN) {
       
  8892       setTextContent(domElement, propValue);
       
  8893     } else {
       
  8894       setValueForProperty(domElement, propKey, propValue, isCustomComponentTag);
       
  8895     }
       
  8896   }
       
  8897 }
       
  8898 
       
  8899 function createElement(type, props, rootContainerElement, parentNamespace) {
       
  8900   var isCustomComponentTag = void 0;
       
  8901 
       
  8902   // We create tags in the namespace of their parent container, except HTML
       
  8903   // tags get no namespace.
       
  8904   var ownerDocument = getOwnerDocumentFromRootContainer(rootContainerElement);
       
  8905   var domElement = void 0;
       
  8906   var namespaceURI = parentNamespace;
       
  8907   if (namespaceURI === HTML_NAMESPACE) {
       
  8908     namespaceURI = getIntrinsicNamespace(type);
       
  8909   }
       
  8910   if (namespaceURI === HTML_NAMESPACE) {
       
  8911     {
  6045     {
  8912       isCustomComponentTag = isCustomComponent(type, props);
  6046       if (namespaceURI === HTML_NAMESPACE$1) {
  8913       // Should this check be gated by parent namespace? Not sure we want to
  6047         if (!isCustomComponentTag && Object.prototype.toString.call(domElement) === '[object HTMLUnknownElement]' && !Object.prototype.hasOwnProperty.call(warnedUnknownTags, type)) {
  8914       // allow <SVG> or <mATH>.
  6048           warnedUnknownTags[type] = true;
  8915       !(isCustomComponentTag || type === type.toLowerCase()) ? warning$1(false, '<%s /> is using incorrect casing. ' + 'Use PascalCase for React components, ' + 'or lowercase for HTML elements.', type) : void 0;
  6049 
  8916     }
  6050           error('The tag <%s> is unrecognized in this browser. ' + 'If you meant to render a React component, start its name with ' + 'an uppercase letter.', type);
  8917 
  6051         }
  8918     if (type === 'script') {
  6052       }
  8919       // Create the script via .innerHTML so its "parser-inserted" flag is
  6053     }
  8920       // set to true and it does not execute
  6054 
  8921       var div = ownerDocument.createElement('div');
  6055     return domElement;
  8922       div.innerHTML = '<script><' + '/script>'; // eslint-disable-line
  6056   }
  8923       // This is guaranteed to yield a script element.
  6057   function createTextNode(text, rootContainerElement) {
  8924       var firstChild = div.firstChild;
  6058     return getOwnerDocumentFromRootContainer(rootContainerElement).createTextNode(text);
  8925       domElement = div.removeChild(firstChild);
  6059   }
  8926     } else if (typeof props.is === 'string') {
  6060   function setInitialProperties(domElement, tag, rawProps, rootContainerElement) {
  8927       // $FlowIssue `createElement` should be updated for Web Components
  6061     var isCustomComponentTag = isCustomComponent(tag, rawProps);
  8928       domElement = ownerDocument.createElement(type, { is: props.is });
  6062 
  8929     } else {
  6063     {
  8930       // Separate else branch instead of using `props.is || undefined` above because of a Firefox bug.
  6064       validatePropertiesInDevelopment(tag, rawProps);
  8931       // See discussion in https://github.com/facebook/react/pull/6896
  6065     } // TODO: Make sure that we check isMounted before firing any of these events.
  8932       // and discussion in https://bugzilla.mozilla.org/show_bug.cgi?id=1276240
  6066 
  8933       domElement = ownerDocument.createElement(type);
  6067 
  8934       // Normally attributes are assigned in `setInitialDOMProperties`, however the `multiple` and `size`
  6068     var props;
  8935       // attributes on `select`s needs to be added before `option`s are inserted.
  6069 
  8936       // This prevents:
  6070     switch (tag) {
  8937       // - a bug where the `select` does not scroll to the correct option because singular
  6071       case 'iframe':
  8938       //  `select` elements automatically pick the first item #13222
  6072       case 'object':
  8939       // - a bug where the `select` set the first item as selected despite the `size` attribute #14239
  6073       case 'embed':
  8940       // See https://github.com/facebook/react/issues/13222
  6074         trapBubbledEvent(TOP_LOAD, domElement);
  8941       // and https://github.com/facebook/react/issues/14239
  6075         props = rawProps;
  8942       if (type === 'select') {
  6076         break;
  8943         var node = domElement;
  6077 
  8944         if (props.multiple) {
  6078       case 'video':
  8945           node.multiple = true;
  6079       case 'audio':
  8946         } else if (props.size) {
  6080         // Create listener for each media event
  8947           // Setting a size greater than 1 causes a select to behave like `multiple=true`, where
  6081         for (var i = 0; i < mediaEventTypes.length; i++) {
  8948           // it is possible that no option is selected.
  6082           trapBubbledEvent(mediaEventTypes[i], domElement);
  8949           //
  6083         }
  8950           // This is only necessary when a select in "single selection mode".
  6084 
  8951           node.size = props.size;
  6085         props = rawProps;
  8952         }
  6086         break;
  8953       }
  6087 
  8954     }
  6088       case 'source':
  8955   } else {
  6089         trapBubbledEvent(TOP_ERROR, domElement);
  8956     domElement = ownerDocument.createElementNS(namespaceURI, type);
  6090         props = rawProps;
  8957   }
  6091         break;
  8958 
  6092 
  8959   {
  6093       case 'img':
  8960     if (namespaceURI === HTML_NAMESPACE) {
  6094       case 'image':
  8961       if (!isCustomComponentTag && Object.prototype.toString.call(domElement) === '[object HTMLUnknownElement]' && !Object.prototype.hasOwnProperty.call(warnedUnknownTags, type)) {
  6095       case 'link':
  8962         warnedUnknownTags[type] = true;
  6096         trapBubbledEvent(TOP_ERROR, domElement);
  8963         warning$1(false, 'The tag <%s> is unrecognized in this browser. ' + 'If you meant to render a React component, start its name with ' + 'an uppercase letter.', type);
  6097         trapBubbledEvent(TOP_LOAD, domElement);
  8964       }
  6098         props = rawProps;
  8965     }
  6099         break;
  8966   }
  6100 
  8967 
  6101       case 'form':
  8968   return domElement;
  6102         trapBubbledEvent(TOP_RESET, domElement);
  8969 }
  6103         trapBubbledEvent(TOP_SUBMIT, domElement);
  8970 
  6104         props = rawProps;
  8971 function createTextNode(text, rootContainerElement) {
  6105         break;
  8972   return getOwnerDocumentFromRootContainer(rootContainerElement).createTextNode(text);
  6106 
  8973 }
  6107       case 'details':
  8974 
  6108         trapBubbledEvent(TOP_TOGGLE, domElement);
  8975 function setInitialProperties(domElement, tag, rawProps, rootContainerElement) {
  6109         props = rawProps;
  8976   var isCustomComponentTag = isCustomComponent(tag, rawProps);
  6110         break;
  8977   {
  6111 
  8978     validatePropertiesInDevelopment(tag, rawProps);
  6112       case 'input':
  8979     if (isCustomComponentTag && !didWarnShadyDOM && domElement.shadyRoot) {
  6113         initWrapperState(domElement, rawProps);
  8980       warning$1(false, '%s is using shady DOM. Using shady DOM with React can ' + 'cause things to break subtly.', getCurrentFiberOwnerNameInDevOrNull() || 'A component');
  6114         props = getHostProps(domElement, rawProps);
  8981       didWarnShadyDOM = true;
  6115         trapBubbledEvent(TOP_INVALID, domElement); // For controlled components we always need to ensure we're listening
  8982     }
  6116         // to onChange. Even if there is no listener.
  8983   }
  6117 
  8984 
  6118         ensureListeningTo(rootContainerElement, 'onChange');
  8985   // TODO: Make sure that we check isMounted before firing any of these events.
  6119         break;
  8986   var props = void 0;
  6120 
  8987   switch (tag) {
  6121       case 'option':
  8988     case 'iframe':
  6122         validateProps(domElement, rawProps);
  8989     case 'object':
  6123         props = getHostProps$1(domElement, rawProps);
  8990     case 'embed':
  6124         break;
  8991       trapBubbledEvent(TOP_LOAD, domElement);
  6125 
  8992       props = rawProps;
  6126       case 'select':
  8993       break;
  6127         initWrapperState$1(domElement, rawProps);
  8994     case 'video':
  6128         props = getHostProps$2(domElement, rawProps);
  8995     case 'audio':
  6129         trapBubbledEvent(TOP_INVALID, domElement); // For controlled components we always need to ensure we're listening
  8996       // Create listener for each media event
  6130         // to onChange. Even if there is no listener.
  8997       for (var i = 0; i < mediaEventTypes.length; i++) {
  6131 
  8998         trapBubbledEvent(mediaEventTypes[i], domElement);
  6132         ensureListeningTo(rootContainerElement, 'onChange');
  8999       }
  6133         break;
  9000       props = rawProps;
  6134 
  9001       break;
  6135       case 'textarea':
  9002     case 'source':
  6136         initWrapperState$2(domElement, rawProps);
  9003       trapBubbledEvent(TOP_ERROR, domElement);
  6137         props = getHostProps$3(domElement, rawProps);
  9004       props = rawProps;
  6138         trapBubbledEvent(TOP_INVALID, domElement); // For controlled components we always need to ensure we're listening
  9005       break;
  6139         // to onChange. Even if there is no listener.
  9006     case 'img':
  6140 
  9007     case 'image':
  6141         ensureListeningTo(rootContainerElement, 'onChange');
  9008     case 'link':
  6142         break;
  9009       trapBubbledEvent(TOP_ERROR, domElement);
  6143 
  9010       trapBubbledEvent(TOP_LOAD, domElement);
  6144       default:
  9011       props = rawProps;
  6145         props = rawProps;
  9012       break;
  6146     }
  9013     case 'form':
  6147 
  9014       trapBubbledEvent(TOP_RESET, domElement);
  6148     assertValidProps(tag, props);
  9015       trapBubbledEvent(TOP_SUBMIT, domElement);
  6149     setInitialDOMProperties(tag, domElement, rootContainerElement, props, isCustomComponentTag);
  9016       props = rawProps;
  6150 
  9017       break;
  6151     switch (tag) {
  9018     case 'details':
  6152       case 'input':
  9019       trapBubbledEvent(TOP_TOGGLE, domElement);
  6153         // TODO: Make sure we check if this is still unmounted or do any clean
  9020       props = rawProps;
  6154         // up necessary since we never stop tracking anymore.
  9021       break;
  6155         track(domElement);
  9022     case 'input':
  6156         postMountWrapper(domElement, rawProps, false);
  9023       initWrapperState(domElement, rawProps);
  6157         break;
  9024       props = getHostProps(domElement, rawProps);
  6158 
  9025       trapBubbledEvent(TOP_INVALID, domElement);
  6159       case 'textarea':
  9026       // For controlled components we always need to ensure we're listening
  6160         // TODO: Make sure we check if this is still unmounted or do any clean
  9027       // to onChange. Even if there is no listener.
  6161         // up necessary since we never stop tracking anymore.
  9028       ensureListeningTo(rootContainerElement, 'onChange');
  6162         track(domElement);
  9029       break;
  6163         postMountWrapper$3(domElement);
  9030     case 'option':
  6164         break;
  9031       validateProps(domElement, rawProps);
  6165 
  9032       props = getHostProps$1(domElement, rawProps);
  6166       case 'option':
  9033       break;
  6167         postMountWrapper$1(domElement, rawProps);
  9034     case 'select':
  6168         break;
  9035       initWrapperState$1(domElement, rawProps);
  6169 
  9036       props = getHostProps$2(domElement, rawProps);
  6170       case 'select':
  9037       trapBubbledEvent(TOP_INVALID, domElement);
  6171         postMountWrapper$2(domElement, rawProps);
  9038       // For controlled components we always need to ensure we're listening
  6172         break;
  9039       // to onChange. Even if there is no listener.
  6173 
  9040       ensureListeningTo(rootContainerElement, 'onChange');
  6174       default:
  9041       break;
  6175         if (typeof props.onClick === 'function') {
  9042     case 'textarea':
  6176           // TODO: This cast may not be sound for SVG, MathML or custom elements.
  9043       initWrapperState$2(domElement, rawProps);
  6177           trapClickOnNonInteractiveElement(domElement);
  9044       props = getHostProps$3(domElement, rawProps);
  6178         }
  9045       trapBubbledEvent(TOP_INVALID, domElement);
  6179 
  9046       // For controlled components we always need to ensure we're listening
  6180         break;
  9047       // to onChange. Even if there is no listener.
  6181     }
  9048       ensureListeningTo(rootContainerElement, 'onChange');
  6182   } // Calculate the diff between the two objects.
  9049       break;
  6183 
  9050     default:
  6184   function diffProperties(domElement, tag, lastRawProps, nextRawProps, rootContainerElement) {
  9051       props = rawProps;
  6185     {
  9052   }
  6186       validatePropertiesInDevelopment(tag, nextRawProps);
  9053 
  6187     }
  9054   assertValidProps(tag, props);
  6188 
  9055 
  6189     var updatePayload = null;
  9056   setInitialDOMProperties(tag, domElement, rootContainerElement, props, isCustomComponentTag);
  6190     var lastProps;
  9057 
  6191     var nextProps;
  9058   switch (tag) {
  6192 
  9059     case 'input':
  6193     switch (tag) {
  9060       // TODO: Make sure we check if this is still unmounted or do any clean
  6194       case 'input':
  9061       // up necessary since we never stop tracking anymore.
  6195         lastProps = getHostProps(domElement, lastRawProps);
  9062       track(domElement);
  6196         nextProps = getHostProps(domElement, nextRawProps);
  9063       postMountWrapper(domElement, rawProps, false);
       
  9064       break;
       
  9065     case 'textarea':
       
  9066       // TODO: Make sure we check if this is still unmounted or do any clean
       
  9067       // up necessary since we never stop tracking anymore.
       
  9068       track(domElement);
       
  9069       postMountWrapper$3(domElement, rawProps);
       
  9070       break;
       
  9071     case 'option':
       
  9072       postMountWrapper$1(domElement, rawProps);
       
  9073       break;
       
  9074     case 'select':
       
  9075       postMountWrapper$2(domElement, rawProps);
       
  9076       break;
       
  9077     default:
       
  9078       if (typeof props.onClick === 'function') {
       
  9079         // TODO: This cast may not be sound for SVG, MathML or custom elements.
       
  9080         trapClickOnNonInteractiveElement(domElement);
       
  9081       }
       
  9082       break;
       
  9083   }
       
  9084 }
       
  9085 
       
  9086 // Calculate the diff between the two objects.
       
  9087 function diffProperties(domElement, tag, lastRawProps, nextRawProps, rootContainerElement) {
       
  9088   {
       
  9089     validatePropertiesInDevelopment(tag, nextRawProps);
       
  9090   }
       
  9091 
       
  9092   var updatePayload = null;
       
  9093 
       
  9094   var lastProps = void 0;
       
  9095   var nextProps = void 0;
       
  9096   switch (tag) {
       
  9097     case 'input':
       
  9098       lastProps = getHostProps(domElement, lastRawProps);
       
  9099       nextProps = getHostProps(domElement, nextRawProps);
       
  9100       updatePayload = [];
       
  9101       break;
       
  9102     case 'option':
       
  9103       lastProps = getHostProps$1(domElement, lastRawProps);
       
  9104       nextProps = getHostProps$1(domElement, nextRawProps);
       
  9105       updatePayload = [];
       
  9106       break;
       
  9107     case 'select':
       
  9108       lastProps = getHostProps$2(domElement, lastRawProps);
       
  9109       nextProps = getHostProps$2(domElement, nextRawProps);
       
  9110       updatePayload = [];
       
  9111       break;
       
  9112     case 'textarea':
       
  9113       lastProps = getHostProps$3(domElement, lastRawProps);
       
  9114       nextProps = getHostProps$3(domElement, nextRawProps);
       
  9115       updatePayload = [];
       
  9116       break;
       
  9117     default:
       
  9118       lastProps = lastRawProps;
       
  9119       nextProps = nextRawProps;
       
  9120       if (typeof lastProps.onClick !== 'function' && typeof nextProps.onClick === 'function') {
       
  9121         // TODO: This cast may not be sound for SVG, MathML or custom elements.
       
  9122         trapClickOnNonInteractiveElement(domElement);
       
  9123       }
       
  9124       break;
       
  9125   }
       
  9126 
       
  9127   assertValidProps(tag, nextProps);
       
  9128 
       
  9129   var propKey = void 0;
       
  9130   var styleName = void 0;
       
  9131   var styleUpdates = null;
       
  9132   for (propKey in lastProps) {
       
  9133     if (nextProps.hasOwnProperty(propKey) || !lastProps.hasOwnProperty(propKey) || lastProps[propKey] == null) {
       
  9134       continue;
       
  9135     }
       
  9136     if (propKey === STYLE$1) {
       
  9137       var lastStyle = lastProps[propKey];
       
  9138       for (styleName in lastStyle) {
       
  9139         if (lastStyle.hasOwnProperty(styleName)) {
       
  9140           if (!styleUpdates) {
       
  9141             styleUpdates = {};
       
  9142           }
       
  9143           styleUpdates[styleName] = '';
       
  9144         }
       
  9145       }
       
  9146     } else if (propKey === DANGEROUSLY_SET_INNER_HTML || propKey === CHILDREN) {
       
  9147       // Noop. This is handled by the clear text mechanism.
       
  9148     } else if (enableFlareAPI && propKey === LISTENERS || propKey === SUPPRESS_CONTENT_EDITABLE_WARNING || propKey === SUPPRESS_HYDRATION_WARNING$1) {
       
  9149       // Noop
       
  9150     } else if (propKey === AUTOFOCUS) {
       
  9151       // Noop. It doesn't work on updates anyway.
       
  9152     } else if (registrationNameModules.hasOwnProperty(propKey)) {
       
  9153       // This is a special case. If any listener updates we need to ensure
       
  9154       // that the "current" fiber pointer gets updated so we need a commit
       
  9155       // to update this element.
       
  9156       if (!updatePayload) {
       
  9157         updatePayload = [];
  6197         updatePayload = [];
  9158       }
  6198         break;
  9159     } else {
  6199 
  9160       // For all other deleted properties we add it to the queue. We use
  6200       case 'option':
  9161       // the whitelist in the commit phase instead.
  6201         lastProps = getHostProps$1(domElement, lastRawProps);
  9162       (updatePayload = updatePayload || []).push(propKey, null);
  6202         nextProps = getHostProps$1(domElement, nextRawProps);
  9163     }
  6203         updatePayload = [];
  9164   }
  6204         break;
  9165   for (propKey in nextProps) {
  6205 
  9166     var nextProp = nextProps[propKey];
  6206       case 'select':
  9167     var lastProp = lastProps != null ? lastProps[propKey] : undefined;
  6207         lastProps = getHostProps$2(domElement, lastRawProps);
  9168     if (!nextProps.hasOwnProperty(propKey) || nextProp === lastProp || nextProp == null && lastProp == null) {
  6208         nextProps = getHostProps$2(domElement, nextRawProps);
  9169       continue;
  6209         updatePayload = [];
  9170     }
  6210         break;
  9171     if (propKey === STYLE$1) {
  6211 
  9172       {
  6212       case 'textarea':
  9173         if (nextProp) {
  6213         lastProps = getHostProps$3(domElement, lastRawProps);
  9174           // Freeze the next style object so that we can assume it won't be
  6214         nextProps = getHostProps$3(domElement, nextRawProps);
  9175           // mutated. We have already warned for this in the past.
  6215         updatePayload = [];
  9176           Object.freeze(nextProp);
  6216         break;
  9177         }
  6217 
  9178       }
  6218       default:
  9179       if (lastProp) {
  6219         lastProps = lastRawProps;
  9180         // Unset styles on `lastProp` but not on `nextProp`.
  6220         nextProps = nextRawProps;
  9181         for (styleName in lastProp) {
  6221 
  9182           if (lastProp.hasOwnProperty(styleName) && (!nextProp || !nextProp.hasOwnProperty(styleName))) {
  6222         if (typeof lastProps.onClick !== 'function' && typeof nextProps.onClick === 'function') {
       
  6223           // TODO: This cast may not be sound for SVG, MathML or custom elements.
       
  6224           trapClickOnNonInteractiveElement(domElement);
       
  6225         }
       
  6226 
       
  6227         break;
       
  6228     }
       
  6229 
       
  6230     assertValidProps(tag, nextProps);
       
  6231     var propKey;
       
  6232     var styleName;
       
  6233     var styleUpdates = null;
       
  6234 
       
  6235     for (propKey in lastProps) {
       
  6236       if (nextProps.hasOwnProperty(propKey) || !lastProps.hasOwnProperty(propKey) || lastProps[propKey] == null) {
       
  6237         continue;
       
  6238       }
       
  6239 
       
  6240       if (propKey === STYLE) {
       
  6241         var lastStyle = lastProps[propKey];
       
  6242 
       
  6243         for (styleName in lastStyle) {
       
  6244           if (lastStyle.hasOwnProperty(styleName)) {
  9183             if (!styleUpdates) {
  6245             if (!styleUpdates) {
  9184               styleUpdates = {};
  6246               styleUpdates = {};
  9185             }
  6247             }
       
  6248 
  9186             styleUpdates[styleName] = '';
  6249             styleUpdates[styleName] = '';
  9187           }
  6250           }
  9188         }
  6251         }
  9189         // Update styles that changed since `lastProp`.
  6252       } else if (propKey === DANGEROUSLY_SET_INNER_HTML || propKey === CHILDREN) ; else if ( propKey === SUPPRESS_CONTENT_EDITABLE_WARNING || propKey === SUPPRESS_HYDRATION_WARNING) ; else if (propKey === AUTOFOCUS) ; else if (registrationNameModules.hasOwnProperty(propKey)) {
  9190         for (styleName in nextProp) {
  6253         // This is a special case. If any listener updates we need to ensure
  9191           if (nextProp.hasOwnProperty(styleName) && lastProp[styleName] !== nextProp[styleName]) {
  6254         // that the "current" fiber pointer gets updated so we need a commit
  9192             if (!styleUpdates) {
  6255         // to update this element.
  9193               styleUpdates = {};
  6256         if (!updatePayload) {
       
  6257           updatePayload = [];
       
  6258         }
       
  6259       } else {
       
  6260         // For all other deleted properties we add it to the queue. We use
       
  6261         // the whitelist in the commit phase instead.
       
  6262         (updatePayload = updatePayload || []).push(propKey, null);
       
  6263       }
       
  6264     }
       
  6265 
       
  6266     for (propKey in nextProps) {
       
  6267       var nextProp = nextProps[propKey];
       
  6268       var lastProp = lastProps != null ? lastProps[propKey] : undefined;
       
  6269 
       
  6270       if (!nextProps.hasOwnProperty(propKey) || nextProp === lastProp || nextProp == null && lastProp == null) {
       
  6271         continue;
       
  6272       }
       
  6273 
       
  6274       if (propKey === STYLE) {
       
  6275         {
       
  6276           if (nextProp) {
       
  6277             // Freeze the next style object so that we can assume it won't be
       
  6278             // mutated. We have already warned for this in the past.
       
  6279             Object.freeze(nextProp);
       
  6280           }
       
  6281         }
       
  6282 
       
  6283         if (lastProp) {
       
  6284           // Unset styles on `lastProp` but not on `nextProp`.
       
  6285           for (styleName in lastProp) {
       
  6286             if (lastProp.hasOwnProperty(styleName) && (!nextProp || !nextProp.hasOwnProperty(styleName))) {
       
  6287               if (!styleUpdates) {
       
  6288                 styleUpdates = {};
       
  6289               }
       
  6290 
       
  6291               styleUpdates[styleName] = '';
  9194             }
  6292             }
  9195             styleUpdates[styleName] = nextProp[styleName];
  6293           } // Update styles that changed since `lastProp`.
       
  6294 
       
  6295 
       
  6296           for (styleName in nextProp) {
       
  6297             if (nextProp.hasOwnProperty(styleName) && lastProp[styleName] !== nextProp[styleName]) {
       
  6298               if (!styleUpdates) {
       
  6299                 styleUpdates = {};
       
  6300               }
       
  6301 
       
  6302               styleUpdates[styleName] = nextProp[styleName];
       
  6303             }
  9196           }
  6304           }
       
  6305         } else {
       
  6306           // Relies on `updateStylesByID` not mutating `styleUpdates`.
       
  6307           if (!styleUpdates) {
       
  6308             if (!updatePayload) {
       
  6309               updatePayload = [];
       
  6310             }
       
  6311 
       
  6312             updatePayload.push(propKey, styleUpdates);
       
  6313           }
       
  6314 
       
  6315           styleUpdates = nextProp;
       
  6316         }
       
  6317       } else if (propKey === DANGEROUSLY_SET_INNER_HTML) {
       
  6318         var nextHtml = nextProp ? nextProp[HTML$1] : undefined;
       
  6319         var lastHtml = lastProp ? lastProp[HTML$1] : undefined;
       
  6320 
       
  6321         if (nextHtml != null) {
       
  6322           if (lastHtml !== nextHtml) {
       
  6323             (updatePayload = updatePayload || []).push(propKey, nextHtml);
       
  6324           }
       
  6325         }
       
  6326       } else if (propKey === CHILDREN) {
       
  6327         if (lastProp !== nextProp && (typeof nextProp === 'string' || typeof nextProp === 'number')) {
       
  6328           (updatePayload = updatePayload || []).push(propKey, '' + nextProp);
       
  6329         }
       
  6330       } else if ( propKey === SUPPRESS_CONTENT_EDITABLE_WARNING || propKey === SUPPRESS_HYDRATION_WARNING) ; else if (registrationNameModules.hasOwnProperty(propKey)) {
       
  6331         if (nextProp != null) {
       
  6332           // We eagerly listen to this even though we haven't committed yet.
       
  6333           if ( typeof nextProp !== 'function') {
       
  6334             warnForInvalidEventListener(propKey, nextProp);
       
  6335           }
       
  6336 
       
  6337           ensureListeningTo(rootContainerElement, propKey);
       
  6338         }
       
  6339 
       
  6340         if (!updatePayload && lastProp !== nextProp) {
       
  6341           // This is a special case. If any listener updates we need to ensure
       
  6342           // that the "current" props pointer gets updated so we need a commit
       
  6343           // to update this element.
       
  6344           updatePayload = [];
  9197         }
  6345         }
  9198       } else {
  6346       } else {
  9199         // Relies on `updateStylesByID` not mutating `styleUpdates`.
  6347         // For any other property we always add it to the queue and then we
  9200         if (!styleUpdates) {
  6348         // filter it out using the whitelist during the commit.
  9201           if (!updatePayload) {
  6349         (updatePayload = updatePayload || []).push(propKey, nextProp);
  9202             updatePayload = [];
  6350       }
       
  6351     }
       
  6352 
       
  6353     if (styleUpdates) {
       
  6354       {
       
  6355         validateShorthandPropertyCollisionInDev(styleUpdates, nextProps[STYLE]);
       
  6356       }
       
  6357 
       
  6358       (updatePayload = updatePayload || []).push(STYLE, styleUpdates);
       
  6359     }
       
  6360 
       
  6361     return updatePayload;
       
  6362   } // Apply the diff.
       
  6363 
       
  6364   function updateProperties(domElement, updatePayload, tag, lastRawProps, nextRawProps) {
       
  6365     // Update checked *before* name.
       
  6366     // In the middle of an update, it is possible to have multiple checked.
       
  6367     // When a checked radio tries to change name, browser makes another radio's checked false.
       
  6368     if (tag === 'input' && nextRawProps.type === 'radio' && nextRawProps.name != null) {
       
  6369       updateChecked(domElement, nextRawProps);
       
  6370     }
       
  6371 
       
  6372     var wasCustomComponentTag = isCustomComponent(tag, lastRawProps);
       
  6373     var isCustomComponentTag = isCustomComponent(tag, nextRawProps); // Apply the diff.
       
  6374 
       
  6375     updateDOMProperties(domElement, updatePayload, wasCustomComponentTag, isCustomComponentTag); // TODO: Ensure that an update gets scheduled if any of the special props
       
  6376     // changed.
       
  6377 
       
  6378     switch (tag) {
       
  6379       case 'input':
       
  6380         // Update the wrapper around inputs *after* updating props. This has to
       
  6381         // happen after `updateDOMProperties`. Otherwise HTML5 input validations
       
  6382         // raise warnings and prevent the new value from being assigned.
       
  6383         updateWrapper(domElement, nextRawProps);
       
  6384         break;
       
  6385 
       
  6386       case 'textarea':
       
  6387         updateWrapper$1(domElement, nextRawProps);
       
  6388         break;
       
  6389 
       
  6390       case 'select':
       
  6391         // <select> value update needs to occur after <option> children
       
  6392         // reconciliation
       
  6393         postUpdateWrapper(domElement, nextRawProps);
       
  6394         break;
       
  6395     }
       
  6396   }
       
  6397 
       
  6398   function getPossibleStandardName(propName) {
       
  6399     {
       
  6400       var lowerCasedName = propName.toLowerCase();
       
  6401 
       
  6402       if (!possibleStandardNames.hasOwnProperty(lowerCasedName)) {
       
  6403         return null;
       
  6404       }
       
  6405 
       
  6406       return possibleStandardNames[lowerCasedName] || null;
       
  6407     }
       
  6408   }
       
  6409 
       
  6410   function diffHydratedProperties(domElement, tag, rawProps, parentNamespace, rootContainerElement) {
       
  6411     var isCustomComponentTag;
       
  6412     var extraAttributeNames;
       
  6413 
       
  6414     {
       
  6415       suppressHydrationWarning = rawProps[SUPPRESS_HYDRATION_WARNING] === true;
       
  6416       isCustomComponentTag = isCustomComponent(tag, rawProps);
       
  6417       validatePropertiesInDevelopment(tag, rawProps);
       
  6418     } // TODO: Make sure that we check isMounted before firing any of these events.
       
  6419 
       
  6420 
       
  6421     switch (tag) {
       
  6422       case 'iframe':
       
  6423       case 'object':
       
  6424       case 'embed':
       
  6425         trapBubbledEvent(TOP_LOAD, domElement);
       
  6426         break;
       
  6427 
       
  6428       case 'video':
       
  6429       case 'audio':
       
  6430         // Create listener for each media event
       
  6431         for (var i = 0; i < mediaEventTypes.length; i++) {
       
  6432           trapBubbledEvent(mediaEventTypes[i], domElement);
       
  6433         }
       
  6434 
       
  6435         break;
       
  6436 
       
  6437       case 'source':
       
  6438         trapBubbledEvent(TOP_ERROR, domElement);
       
  6439         break;
       
  6440 
       
  6441       case 'img':
       
  6442       case 'image':
       
  6443       case 'link':
       
  6444         trapBubbledEvent(TOP_ERROR, domElement);
       
  6445         trapBubbledEvent(TOP_LOAD, domElement);
       
  6446         break;
       
  6447 
       
  6448       case 'form':
       
  6449         trapBubbledEvent(TOP_RESET, domElement);
       
  6450         trapBubbledEvent(TOP_SUBMIT, domElement);
       
  6451         break;
       
  6452 
       
  6453       case 'details':
       
  6454         trapBubbledEvent(TOP_TOGGLE, domElement);
       
  6455         break;
       
  6456 
       
  6457       case 'input':
       
  6458         initWrapperState(domElement, rawProps);
       
  6459         trapBubbledEvent(TOP_INVALID, domElement); // For controlled components we always need to ensure we're listening
       
  6460         // to onChange. Even if there is no listener.
       
  6461 
       
  6462         ensureListeningTo(rootContainerElement, 'onChange');
       
  6463         break;
       
  6464 
       
  6465       case 'option':
       
  6466         validateProps(domElement, rawProps);
       
  6467         break;
       
  6468 
       
  6469       case 'select':
       
  6470         initWrapperState$1(domElement, rawProps);
       
  6471         trapBubbledEvent(TOP_INVALID, domElement); // For controlled components we always need to ensure we're listening
       
  6472         // to onChange. Even if there is no listener.
       
  6473 
       
  6474         ensureListeningTo(rootContainerElement, 'onChange');
       
  6475         break;
       
  6476 
       
  6477       case 'textarea':
       
  6478         initWrapperState$2(domElement, rawProps);
       
  6479         trapBubbledEvent(TOP_INVALID, domElement); // For controlled components we always need to ensure we're listening
       
  6480         // to onChange. Even if there is no listener.
       
  6481 
       
  6482         ensureListeningTo(rootContainerElement, 'onChange');
       
  6483         break;
       
  6484     }
       
  6485 
       
  6486     assertValidProps(tag, rawProps);
       
  6487 
       
  6488     {
       
  6489       extraAttributeNames = new Set();
       
  6490       var attributes = domElement.attributes;
       
  6491 
       
  6492       for (var _i = 0; _i < attributes.length; _i++) {
       
  6493         var name = attributes[_i].name.toLowerCase();
       
  6494 
       
  6495         switch (name) {
       
  6496           // Built-in SSR attribute is whitelisted
       
  6497           case 'data-reactroot':
       
  6498             break;
       
  6499           // Controlled attributes are not validated
       
  6500           // TODO: Only ignore them on controlled tags.
       
  6501 
       
  6502           case 'value':
       
  6503             break;
       
  6504 
       
  6505           case 'checked':
       
  6506             break;
       
  6507 
       
  6508           case 'selected':
       
  6509             break;
       
  6510 
       
  6511           default:
       
  6512             // Intentionally use the original name.
       
  6513             // See discussion in https://github.com/facebook/react/pull/10676.
       
  6514             extraAttributeNames.add(attributes[_i].name);
       
  6515         }
       
  6516       }
       
  6517     }
       
  6518 
       
  6519     var updatePayload = null;
       
  6520 
       
  6521     for (var propKey in rawProps) {
       
  6522       if (!rawProps.hasOwnProperty(propKey)) {
       
  6523         continue;
       
  6524       }
       
  6525 
       
  6526       var nextProp = rawProps[propKey];
       
  6527 
       
  6528       if (propKey === CHILDREN) {
       
  6529         // For text content children we compare against textContent. This
       
  6530         // might match additional HTML that is hidden when we read it using
       
  6531         // textContent. E.g. "foo" will match "f<span>oo</span>" but that still
       
  6532         // satisfies our requirement. Our requirement is not to produce perfect
       
  6533         // HTML and attributes. Ideally we should preserve structure but it's
       
  6534         // ok not to if the visible content is still enough to indicate what
       
  6535         // even listeners these nodes might be wired up to.
       
  6536         // TODO: Warn if there is more than a single textNode as a child.
       
  6537         // TODO: Should we use domElement.firstChild.nodeValue to compare?
       
  6538         if (typeof nextProp === 'string') {
       
  6539           if (domElement.textContent !== nextProp) {
       
  6540             if ( !suppressHydrationWarning) {
       
  6541               warnForTextDifference(domElement.textContent, nextProp);
       
  6542             }
       
  6543 
       
  6544             updatePayload = [CHILDREN, nextProp];
  9203           }
  6545           }
  9204           updatePayload.push(propKey, styleUpdates);
  6546         } else if (typeof nextProp === 'number') {
  9205         }
  6547           if (domElement.textContent !== '' + nextProp) {
  9206         styleUpdates = nextProp;
  6548             if ( !suppressHydrationWarning) {
  9207       }
  6549               warnForTextDifference(domElement.textContent, nextProp);
  9208     } else if (propKey === DANGEROUSLY_SET_INNER_HTML) {
  6550             }
  9209       var nextHtml = nextProp ? nextProp[HTML] : undefined;
  6551 
  9210       var lastHtml = lastProp ? lastProp[HTML] : undefined;
  6552             updatePayload = [CHILDREN, '' + nextProp];
  9211       if (nextHtml != null) {
  6553           }
  9212         if (lastHtml !== nextHtml) {
  6554         }
  9213           (updatePayload = updatePayload || []).push(propKey, '' + nextHtml);
  6555       } else if (registrationNameModules.hasOwnProperty(propKey)) {
  9214         }
  6556         if (nextProp != null) {
       
  6557           if ( typeof nextProp !== 'function') {
       
  6558             warnForInvalidEventListener(propKey, nextProp);
       
  6559           }
       
  6560 
       
  6561           ensureListeningTo(rootContainerElement, propKey);
       
  6562         }
       
  6563       } else if ( // Convince Flow we've calculated it (it's DEV-only in this method.)
       
  6564       typeof isCustomComponentTag === 'boolean') {
       
  6565         // Validate that the properties correspond to their expected values.
       
  6566         var serverValue = void 0;
       
  6567         var propertyInfo = getPropertyInfo(propKey);
       
  6568 
       
  6569         if (suppressHydrationWarning) ; else if ( propKey === SUPPRESS_CONTENT_EDITABLE_WARNING || propKey === SUPPRESS_HYDRATION_WARNING || // Controlled attributes are not validated
       
  6570         // TODO: Only ignore them on controlled tags.
       
  6571         propKey === 'value' || propKey === 'checked' || propKey === 'selected') ; else if (propKey === DANGEROUSLY_SET_INNER_HTML) {
       
  6572           var serverHTML = domElement.innerHTML;
       
  6573           var nextHtml = nextProp ? nextProp[HTML$1] : undefined;
       
  6574           var expectedHTML = normalizeHTML(domElement, nextHtml != null ? nextHtml : '');
       
  6575 
       
  6576           if (expectedHTML !== serverHTML) {
       
  6577             warnForPropDifference(propKey, serverHTML, expectedHTML);
       
  6578           }
       
  6579         } else if (propKey === STYLE) {
       
  6580           // $FlowFixMe - Should be inferred as not undefined.
       
  6581           extraAttributeNames.delete(propKey);
       
  6582 
       
  6583           if (canDiffStyleForHydrationWarning) {
       
  6584             var expectedStyle = createDangerousStringForStyles(nextProp);
       
  6585             serverValue = domElement.getAttribute('style');
       
  6586 
       
  6587             if (expectedStyle !== serverValue) {
       
  6588               warnForPropDifference(propKey, serverValue, expectedStyle);
       
  6589             }
       
  6590           }
       
  6591         } else if (isCustomComponentTag) {
       
  6592           // $FlowFixMe - Should be inferred as not undefined.
       
  6593           extraAttributeNames.delete(propKey.toLowerCase());
       
  6594           serverValue = getValueForAttribute(domElement, propKey, nextProp);
       
  6595 
       
  6596           if (nextProp !== serverValue) {
       
  6597             warnForPropDifference(propKey, serverValue, nextProp);
       
  6598           }
       
  6599         } else if (!shouldIgnoreAttribute(propKey, propertyInfo, isCustomComponentTag) && !shouldRemoveAttribute(propKey, nextProp, propertyInfo, isCustomComponentTag)) {
       
  6600           var isMismatchDueToBadCasing = false;
       
  6601 
       
  6602           if (propertyInfo !== null) {
       
  6603             // $FlowFixMe - Should be inferred as not undefined.
       
  6604             extraAttributeNames.delete(propertyInfo.attributeName);
       
  6605             serverValue = getValueForProperty(domElement, propKey, nextProp, propertyInfo);
       
  6606           } else {
       
  6607             var ownNamespace = parentNamespace;
       
  6608 
       
  6609             if (ownNamespace === HTML_NAMESPACE$1) {
       
  6610               ownNamespace = getIntrinsicNamespace(tag);
       
  6611             }
       
  6612 
       
  6613             if (ownNamespace === HTML_NAMESPACE$1) {
       
  6614               // $FlowFixMe - Should be inferred as not undefined.
       
  6615               extraAttributeNames.delete(propKey.toLowerCase());
       
  6616             } else {
       
  6617               var standardName = getPossibleStandardName(propKey);
       
  6618 
       
  6619               if (standardName !== null && standardName !== propKey) {
       
  6620                 // If an SVG prop is supplied with bad casing, it will
       
  6621                 // be successfully parsed from HTML, but will produce a mismatch
       
  6622                 // (and would be incorrectly rendered on the client).
       
  6623                 // However, we already warn about bad casing elsewhere.
       
  6624                 // So we'll skip the misleading extra mismatch warning in this case.
       
  6625                 isMismatchDueToBadCasing = true; // $FlowFixMe - Should be inferred as not undefined.
       
  6626 
       
  6627                 extraAttributeNames.delete(standardName);
       
  6628               } // $FlowFixMe - Should be inferred as not undefined.
       
  6629 
       
  6630 
       
  6631               extraAttributeNames.delete(propKey);
       
  6632             }
       
  6633 
       
  6634             serverValue = getValueForAttribute(domElement, propKey, nextProp);
       
  6635           }
       
  6636 
       
  6637           if (nextProp !== serverValue && !isMismatchDueToBadCasing) {
       
  6638             warnForPropDifference(propKey, serverValue, nextProp);
       
  6639           }
       
  6640         }
       
  6641       }
       
  6642     }
       
  6643 
       
  6644     {
       
  6645       // $FlowFixMe - Should be inferred as not undefined.
       
  6646       if (extraAttributeNames.size > 0 && !suppressHydrationWarning) {
       
  6647         // $FlowFixMe - Should be inferred as not undefined.
       
  6648         warnForExtraAttributes(extraAttributeNames);
       
  6649       }
       
  6650     }
       
  6651 
       
  6652     switch (tag) {
       
  6653       case 'input':
       
  6654         // TODO: Make sure we check if this is still unmounted or do any clean
       
  6655         // up necessary since we never stop tracking anymore.
       
  6656         track(domElement);
       
  6657         postMountWrapper(domElement, rawProps, true);
       
  6658         break;
       
  6659 
       
  6660       case 'textarea':
       
  6661         // TODO: Make sure we check if this is still unmounted or do any clean
       
  6662         // up necessary since we never stop tracking anymore.
       
  6663         track(domElement);
       
  6664         postMountWrapper$3(domElement);
       
  6665         break;
       
  6666 
       
  6667       case 'select':
       
  6668       case 'option':
       
  6669         // For input and textarea we current always set the value property at
       
  6670         // post mount to force it to diverge from attributes. However, for
       
  6671         // option and select we don't quite do the same thing and select
       
  6672         // is not resilient to the DOM state changing so we don't do that here.
       
  6673         // TODO: Consider not doing this for input and textarea.
       
  6674         break;
       
  6675 
       
  6676       default:
       
  6677         if (typeof rawProps.onClick === 'function') {
       
  6678           // TODO: This cast may not be sound for SVG, MathML or custom elements.
       
  6679           trapClickOnNonInteractiveElement(domElement);
       
  6680         }
       
  6681 
       
  6682         break;
       
  6683     }
       
  6684 
       
  6685     return updatePayload;
       
  6686   }
       
  6687   function diffHydratedText(textNode, text) {
       
  6688     var isDifferent = textNode.nodeValue !== text;
       
  6689     return isDifferent;
       
  6690   }
       
  6691   function warnForUnmatchedText(textNode, text) {
       
  6692     {
       
  6693       warnForTextDifference(textNode.nodeValue, text);
       
  6694     }
       
  6695   }
       
  6696   function warnForDeletedHydratableElement(parentNode, child) {
       
  6697     {
       
  6698       if (didWarnInvalidHydration) {
       
  6699         return;
       
  6700       }
       
  6701 
       
  6702       didWarnInvalidHydration = true;
       
  6703 
       
  6704       error('Did not expect server HTML to contain a <%s> in <%s>.', child.nodeName.toLowerCase(), parentNode.nodeName.toLowerCase());
       
  6705     }
       
  6706   }
       
  6707   function warnForDeletedHydratableText(parentNode, child) {
       
  6708     {
       
  6709       if (didWarnInvalidHydration) {
       
  6710         return;
       
  6711       }
       
  6712 
       
  6713       didWarnInvalidHydration = true;
       
  6714 
       
  6715       error('Did not expect server HTML to contain the text node "%s" in <%s>.', child.nodeValue, parentNode.nodeName.toLowerCase());
       
  6716     }
       
  6717   }
       
  6718   function warnForInsertedHydratedElement(parentNode, tag, props) {
       
  6719     {
       
  6720       if (didWarnInvalidHydration) {
       
  6721         return;
       
  6722       }
       
  6723 
       
  6724       didWarnInvalidHydration = true;
       
  6725 
       
  6726       error('Expected server HTML to contain a matching <%s> in <%s>.', tag, parentNode.nodeName.toLowerCase());
       
  6727     }
       
  6728   }
       
  6729   function warnForInsertedHydratedText(parentNode, text) {
       
  6730     {
       
  6731       if (text === '') {
       
  6732         // We expect to insert empty text nodes since they're not represented in
       
  6733         // the HTML.
       
  6734         // TODO: Remove this special case if we can just avoid inserting empty
       
  6735         // text nodes.
       
  6736         return;
       
  6737       }
       
  6738 
       
  6739       if (didWarnInvalidHydration) {
       
  6740         return;
       
  6741       }
       
  6742 
       
  6743       didWarnInvalidHydration = true;
       
  6744 
       
  6745       error('Expected server HTML to contain a matching text node for "%s" in <%s>.', text, parentNode.nodeName.toLowerCase());
       
  6746     }
       
  6747   }
       
  6748   function restoreControlledState$3(domElement, tag, props) {
       
  6749     switch (tag) {
       
  6750       case 'input':
       
  6751         restoreControlledState(domElement, props);
       
  6752         return;
       
  6753 
       
  6754       case 'textarea':
       
  6755         restoreControlledState$2(domElement, props);
       
  6756         return;
       
  6757 
       
  6758       case 'select':
       
  6759         restoreControlledState$1(domElement, props);
       
  6760         return;
       
  6761     }
       
  6762   }
       
  6763 
       
  6764   function getActiveElement(doc) {
       
  6765     doc = doc || (typeof document !== 'undefined' ? document : undefined);
       
  6766 
       
  6767     if (typeof doc === 'undefined') {
       
  6768       return null;
       
  6769     }
       
  6770 
       
  6771     try {
       
  6772       return doc.activeElement || doc.body;
       
  6773     } catch (e) {
       
  6774       return doc.body;
       
  6775     }
       
  6776   }
       
  6777 
       
  6778   /**
       
  6779    * Given any node return the first leaf node without children.
       
  6780    *
       
  6781    * @param {DOMElement|DOMTextNode} node
       
  6782    * @return {DOMElement|DOMTextNode}
       
  6783    */
       
  6784 
       
  6785   function getLeafNode(node) {
       
  6786     while (node && node.firstChild) {
       
  6787       node = node.firstChild;
       
  6788     }
       
  6789 
       
  6790     return node;
       
  6791   }
       
  6792   /**
       
  6793    * Get the next sibling within a container. This will walk up the
       
  6794    * DOM if a node's siblings have been exhausted.
       
  6795    *
       
  6796    * @param {DOMElement|DOMTextNode} node
       
  6797    * @return {?DOMElement|DOMTextNode}
       
  6798    */
       
  6799 
       
  6800 
       
  6801   function getSiblingNode(node) {
       
  6802     while (node) {
       
  6803       if (node.nextSibling) {
       
  6804         return node.nextSibling;
       
  6805       }
       
  6806 
       
  6807       node = node.parentNode;
       
  6808     }
       
  6809   }
       
  6810   /**
       
  6811    * Get object describing the nodes which contain characters at offset.
       
  6812    *
       
  6813    * @param {DOMElement|DOMTextNode} root
       
  6814    * @param {number} offset
       
  6815    * @return {?object}
       
  6816    */
       
  6817 
       
  6818 
       
  6819   function getNodeForCharacterOffset(root, offset) {
       
  6820     var node = getLeafNode(root);
       
  6821     var nodeStart = 0;
       
  6822     var nodeEnd = 0;
       
  6823 
       
  6824     while (node) {
       
  6825       if (node.nodeType === TEXT_NODE) {
       
  6826         nodeEnd = nodeStart + node.textContent.length;
       
  6827 
       
  6828         if (nodeStart <= offset && nodeEnd >= offset) {
       
  6829           return {
       
  6830             node: node,
       
  6831             offset: offset - nodeStart
       
  6832           };
       
  6833         }
       
  6834 
       
  6835         nodeStart = nodeEnd;
       
  6836       }
       
  6837 
       
  6838       node = getLeafNode(getSiblingNode(node));
       
  6839     }
       
  6840   }
       
  6841 
       
  6842   /**
       
  6843    * @param {DOMElement} outerNode
       
  6844    * @return {?object}
       
  6845    */
       
  6846 
       
  6847   function getOffsets(outerNode) {
       
  6848     var ownerDocument = outerNode.ownerDocument;
       
  6849     var win = ownerDocument && ownerDocument.defaultView || window;
       
  6850     var selection = win.getSelection && win.getSelection();
       
  6851 
       
  6852     if (!selection || selection.rangeCount === 0) {
       
  6853       return null;
       
  6854     }
       
  6855 
       
  6856     var anchorNode = selection.anchorNode,
       
  6857         anchorOffset = selection.anchorOffset,
       
  6858         focusNode = selection.focusNode,
       
  6859         focusOffset = selection.focusOffset; // In Firefox, anchorNode and focusNode can be "anonymous divs", e.g. the
       
  6860     // up/down buttons on an <input type="number">. Anonymous divs do not seem to
       
  6861     // expose properties, triggering a "Permission denied error" if any of its
       
  6862     // properties are accessed. The only seemingly possible way to avoid erroring
       
  6863     // is to access a property that typically works for non-anonymous divs and
       
  6864     // catch any error that may otherwise arise. See
       
  6865     // https://bugzilla.mozilla.org/show_bug.cgi?id=208427
       
  6866 
       
  6867     try {
       
  6868       /* eslint-disable no-unused-expressions */
       
  6869       anchorNode.nodeType;
       
  6870       focusNode.nodeType;
       
  6871       /* eslint-enable no-unused-expressions */
       
  6872     } catch (e) {
       
  6873       return null;
       
  6874     }
       
  6875 
       
  6876     return getModernOffsetsFromPoints(outerNode, anchorNode, anchorOffset, focusNode, focusOffset);
       
  6877   }
       
  6878   /**
       
  6879    * Returns {start, end} where `start` is the character/codepoint index of
       
  6880    * (anchorNode, anchorOffset) within the textContent of `outerNode`, and
       
  6881    * `end` is the index of (focusNode, focusOffset).
       
  6882    *
       
  6883    * Returns null if you pass in garbage input but we should probably just crash.
       
  6884    *
       
  6885    * Exported only for testing.
       
  6886    */
       
  6887 
       
  6888   function getModernOffsetsFromPoints(outerNode, anchorNode, anchorOffset, focusNode, focusOffset) {
       
  6889     var length = 0;
       
  6890     var start = -1;
       
  6891     var end = -1;
       
  6892     var indexWithinAnchor = 0;
       
  6893     var indexWithinFocus = 0;
       
  6894     var node = outerNode;
       
  6895     var parentNode = null;
       
  6896 
       
  6897     outer: while (true) {
       
  6898       var next = null;
       
  6899 
       
  6900       while (true) {
       
  6901         if (node === anchorNode && (anchorOffset === 0 || node.nodeType === TEXT_NODE)) {
       
  6902           start = length + anchorOffset;
       
  6903         }
       
  6904 
       
  6905         if (node === focusNode && (focusOffset === 0 || node.nodeType === TEXT_NODE)) {
       
  6906           end = length + focusOffset;
       
  6907         }
       
  6908 
       
  6909         if (node.nodeType === TEXT_NODE) {
       
  6910           length += node.nodeValue.length;
       
  6911         }
       
  6912 
       
  6913         if ((next = node.firstChild) === null) {
       
  6914           break;
       
  6915         } // Moving from `node` to its first child `next`.
       
  6916 
       
  6917 
       
  6918         parentNode = node;
       
  6919         node = next;
       
  6920       }
       
  6921 
       
  6922       while (true) {
       
  6923         if (node === outerNode) {
       
  6924           // If `outerNode` has children, this is always the second time visiting
       
  6925           // it. If it has no children, this is still the first loop, and the only
       
  6926           // valid selection is anchorNode and focusNode both equal to this node
       
  6927           // and both offsets 0, in which case we will have handled above.
       
  6928           break outer;
       
  6929         }
       
  6930 
       
  6931         if (parentNode === anchorNode && ++indexWithinAnchor === anchorOffset) {
       
  6932           start = length;
       
  6933         }
       
  6934 
       
  6935         if (parentNode === focusNode && ++indexWithinFocus === focusOffset) {
       
  6936           end = length;
       
  6937         }
       
  6938 
       
  6939         if ((next = node.nextSibling) !== null) {
       
  6940           break;
       
  6941         }
       
  6942 
       
  6943         node = parentNode;
       
  6944         parentNode = node.parentNode;
       
  6945       } // Moving from `node` to its next sibling `next`.
       
  6946 
       
  6947 
       
  6948       node = next;
       
  6949     }
       
  6950 
       
  6951     if (start === -1 || end === -1) {
       
  6952       // This should never happen. (Would happen if the anchor/focus nodes aren't
       
  6953       // actually inside the passed-in node.)
       
  6954       return null;
       
  6955     }
       
  6956 
       
  6957     return {
       
  6958       start: start,
       
  6959       end: end
       
  6960     };
       
  6961   }
       
  6962   /**
       
  6963    * In modern non-IE browsers, we can support both forward and backward
       
  6964    * selections.
       
  6965    *
       
  6966    * Note: IE10+ supports the Selection object, but it does not support
       
  6967    * the `extend` method, which means that even in modern IE, it's not possible
       
  6968    * to programmatically create a backward selection. Thus, for all IE
       
  6969    * versions, we use the old IE API to create our selections.
       
  6970    *
       
  6971    * @param {DOMElement|DOMTextNode} node
       
  6972    * @param {object} offsets
       
  6973    */
       
  6974 
       
  6975   function setOffsets(node, offsets) {
       
  6976     var doc = node.ownerDocument || document;
       
  6977     var win = doc && doc.defaultView || window; // Edge fails with "Object expected" in some scenarios.
       
  6978     // (For instance: TinyMCE editor used in a list component that supports pasting to add more,
       
  6979     // fails when pasting 100+ items)
       
  6980 
       
  6981     if (!win.getSelection) {
       
  6982       return;
       
  6983     }
       
  6984 
       
  6985     var selection = win.getSelection();
       
  6986     var length = node.textContent.length;
       
  6987     var start = Math.min(offsets.start, length);
       
  6988     var end = offsets.end === undefined ? start : Math.min(offsets.end, length); // IE 11 uses modern selection, but doesn't support the extend method.
       
  6989     // Flip backward selections, so we can set with a single range.
       
  6990 
       
  6991     if (!selection.extend && start > end) {
       
  6992       var temp = end;
       
  6993       end = start;
       
  6994       start = temp;
       
  6995     }
       
  6996 
       
  6997     var startMarker = getNodeForCharacterOffset(node, start);
       
  6998     var endMarker = getNodeForCharacterOffset(node, end);
       
  6999 
       
  7000     if (startMarker && endMarker) {
       
  7001       if (selection.rangeCount === 1 && selection.anchorNode === startMarker.node && selection.anchorOffset === startMarker.offset && selection.focusNode === endMarker.node && selection.focusOffset === endMarker.offset) {
       
  7002         return;
       
  7003       }
       
  7004 
       
  7005       var range = doc.createRange();
       
  7006       range.setStart(startMarker.node, startMarker.offset);
       
  7007       selection.removeAllRanges();
       
  7008 
       
  7009       if (start > end) {
       
  7010         selection.addRange(range);
       
  7011         selection.extend(endMarker.node, endMarker.offset);
  9215       } else {
  7012       } else {
  9216         // TODO: It might be too late to clear this if we have children
  7013         range.setEnd(endMarker.node, endMarker.offset);
  9217         // inserted already.
  7014         selection.addRange(range);
  9218       }
  7015       }
  9219     } else if (propKey === CHILDREN) {
  7016     }
  9220       if (lastProp !== nextProp && (typeof nextProp === 'string' || typeof nextProp === 'number')) {
  7017   }
  9221         (updatePayload = updatePayload || []).push(propKey, '' + nextProp);
  7018 
  9222       }
  7019   function isTextNode(node) {
  9223     } else if (enableFlareAPI && propKey === LISTENERS || propKey === SUPPRESS_CONTENT_EDITABLE_WARNING || propKey === SUPPRESS_HYDRATION_WARNING$1) {
  7020     return node && node.nodeType === TEXT_NODE;
  9224       // Noop
  7021   }
  9225     } else if (registrationNameModules.hasOwnProperty(propKey)) {
  7022 
  9226       if (nextProp != null) {
  7023   function containsNode(outerNode, innerNode) {
  9227         // We eagerly listen to this even though we haven't committed yet.
  7024     if (!outerNode || !innerNode) {
  9228         if (true && typeof nextProp !== 'function') {
  7025       return false;
  9229           warnForInvalidEventListener(propKey, nextProp);
  7026     } else if (outerNode === innerNode) {
  9230         }
  7027       return true;
  9231         ensureListeningTo(rootContainerElement, propKey);
  7028     } else if (isTextNode(outerNode)) {
  9232       }
  7029       return false;
  9233       if (!updatePayload && lastProp !== nextProp) {
  7030     } else if (isTextNode(innerNode)) {
  9234         // This is a special case. If any listener updates we need to ensure
  7031       return containsNode(outerNode, innerNode.parentNode);
  9235         // that the "current" props pointer gets updated so we need a commit
  7032     } else if ('contains' in outerNode) {
  9236         // to update this element.
  7033       return outerNode.contains(innerNode);
  9237         updatePayload = [];
  7034     } else if (outerNode.compareDocumentPosition) {
  9238       }
  7035       return !!(outerNode.compareDocumentPosition(innerNode) & 16);
  9239     } else {
  7036     } else {
  9240       // For any other property we always add it to the queue and then we
  7037       return false;
  9241       // filter it out using the whitelist during the commit.
  7038     }
  9242       (updatePayload = updatePayload || []).push(propKey, nextProp);
  7039   }
  9243     }
  7040 
  9244   }
  7041   function isInDocument(node) {
  9245   if (styleUpdates) {
  7042     return node && node.ownerDocument && containsNode(node.ownerDocument.documentElement, node);
       
  7043   }
       
  7044 
       
  7045   function isSameOriginFrame(iframe) {
       
  7046     try {
       
  7047       // Accessing the contentDocument of a HTMLIframeElement can cause the browser
       
  7048       // to throw, e.g. if it has a cross-origin src attribute.
       
  7049       // Safari will show an error in the console when the access results in "Blocked a frame with origin". e.g:
       
  7050       // iframe.contentDocument.defaultView;
       
  7051       // A safety way is to access one of the cross origin properties: Window or Location
       
  7052       // Which might result in "SecurityError" DOM Exception and it is compatible to Safari.
       
  7053       // https://html.spec.whatwg.org/multipage/browsers.html#integration-with-idl
       
  7054       return typeof iframe.contentWindow.location.href === 'string';
       
  7055     } catch (err) {
       
  7056       return false;
       
  7057     }
       
  7058   }
       
  7059 
       
  7060   function getActiveElementDeep() {
       
  7061     var win = window;
       
  7062     var element = getActiveElement();
       
  7063 
       
  7064     while (element instanceof win.HTMLIFrameElement) {
       
  7065       if (isSameOriginFrame(element)) {
       
  7066         win = element.contentWindow;
       
  7067       } else {
       
  7068         return element;
       
  7069       }
       
  7070 
       
  7071       element = getActiveElement(win.document);
       
  7072     }
       
  7073 
       
  7074     return element;
       
  7075   }
       
  7076   /**
       
  7077    * @ReactInputSelection: React input selection module. Based on Selection.js,
       
  7078    * but modified to be suitable for react and has a couple of bug fixes (doesn't
       
  7079    * assume buttons have range selections allowed).
       
  7080    * Input selection module for React.
       
  7081    */
       
  7082 
       
  7083   /**
       
  7084    * @hasSelectionCapabilities: we get the element types that support selection
       
  7085    * from https://html.spec.whatwg.org/#do-not-apply, looking at `selectionStart`
       
  7086    * and `selectionEnd` rows.
       
  7087    */
       
  7088 
       
  7089 
       
  7090   function hasSelectionCapabilities(elem) {
       
  7091     var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase();
       
  7092     return nodeName && (nodeName === 'input' && (elem.type === 'text' || elem.type === 'search' || elem.type === 'tel' || elem.type === 'url' || elem.type === 'password') || nodeName === 'textarea' || elem.contentEditable === 'true');
       
  7093   }
       
  7094   function getSelectionInformation() {
       
  7095     var focusedElem = getActiveElementDeep();
       
  7096     return {
       
  7097       // Used by Flare
       
  7098       activeElementDetached: null,
       
  7099       focusedElem: focusedElem,
       
  7100       selectionRange: hasSelectionCapabilities(focusedElem) ? getSelection(focusedElem) : null
       
  7101     };
       
  7102   }
       
  7103   /**
       
  7104    * @restoreSelection: If any selection information was potentially lost,
       
  7105    * restore it. This is useful when performing operations that could remove dom
       
  7106    * nodes and place them back in, resulting in focus being lost.
       
  7107    */
       
  7108 
       
  7109   function restoreSelection(priorSelectionInformation) {
       
  7110     var curFocusedElem = getActiveElementDeep();
       
  7111     var priorFocusedElem = priorSelectionInformation.focusedElem;
       
  7112     var priorSelectionRange = priorSelectionInformation.selectionRange;
       
  7113 
       
  7114     if (curFocusedElem !== priorFocusedElem && isInDocument(priorFocusedElem)) {
       
  7115       if (priorSelectionRange !== null && hasSelectionCapabilities(priorFocusedElem)) {
       
  7116         setSelection(priorFocusedElem, priorSelectionRange);
       
  7117       } // Focusing a node can change the scroll position, which is undesirable
       
  7118 
       
  7119 
       
  7120       var ancestors = [];
       
  7121       var ancestor = priorFocusedElem;
       
  7122 
       
  7123       while (ancestor = ancestor.parentNode) {
       
  7124         if (ancestor.nodeType === ELEMENT_NODE) {
       
  7125           ancestors.push({
       
  7126             element: ancestor,
       
  7127             left: ancestor.scrollLeft,
       
  7128             top: ancestor.scrollTop
       
  7129           });
       
  7130         }
       
  7131       }
       
  7132 
       
  7133       if (typeof priorFocusedElem.focus === 'function') {
       
  7134         priorFocusedElem.focus();
       
  7135       }
       
  7136 
       
  7137       for (var i = 0; i < ancestors.length; i++) {
       
  7138         var info = ancestors[i];
       
  7139         info.element.scrollLeft = info.left;
       
  7140         info.element.scrollTop = info.top;
       
  7141       }
       
  7142     }
       
  7143   }
       
  7144   /**
       
  7145    * @getSelection: Gets the selection bounds of a focused textarea, input or
       
  7146    * contentEditable node.
       
  7147    * -@input: Look up selection bounds of this input
       
  7148    * -@return {start: selectionStart, end: selectionEnd}
       
  7149    */
       
  7150 
       
  7151   function getSelection(input) {
       
  7152     var selection;
       
  7153 
       
  7154     if ('selectionStart' in input) {
       
  7155       // Modern browser with input or textarea.
       
  7156       selection = {
       
  7157         start: input.selectionStart,
       
  7158         end: input.selectionEnd
       
  7159       };
       
  7160     } else {
       
  7161       // Content editable or old IE textarea.
       
  7162       selection = getOffsets(input);
       
  7163     }
       
  7164 
       
  7165     return selection || {
       
  7166       start: 0,
       
  7167       end: 0
       
  7168     };
       
  7169   }
       
  7170   /**
       
  7171    * @setSelection: Sets the selection bounds of a textarea or input and focuses
       
  7172    * the input.
       
  7173    * -@input     Set selection bounds of this input or textarea
       
  7174    * -@offsets   Object of same form that is returned from get*
       
  7175    */
       
  7176 
       
  7177   function setSelection(input, offsets) {
       
  7178     var start = offsets.start,
       
  7179         end = offsets.end;
       
  7180 
       
  7181     if (end === undefined) {
       
  7182       end = start;
       
  7183     }
       
  7184 
       
  7185     if ('selectionStart' in input) {
       
  7186       input.selectionStart = start;
       
  7187       input.selectionEnd = Math.min(end, input.value.length);
       
  7188     } else {
       
  7189       setOffsets(input, offsets);
       
  7190     }
       
  7191   }
       
  7192 
       
  7193   var validateDOMNesting = function () {};
       
  7194 
       
  7195   var updatedAncestorInfo = function () {};
       
  7196 
       
  7197   {
       
  7198     // This validation code was written based on the HTML5 parsing spec:
       
  7199     // https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-scope
       
  7200     //
       
  7201     // Note: this does not catch all invalid nesting, nor does it try to (as it's
       
  7202     // not clear what practical benefit doing so provides); instead, we warn only
       
  7203     // for cases where the parser will give a parse tree differing from what React
       
  7204     // intended. For example, <b><div></div></b> is invalid but we don't warn
       
  7205     // because it still parses correctly; we do warn for other cases like nested
       
  7206     // <p> tags where the beginning of the second element implicitly closes the
       
  7207     // first, causing a confusing mess.
       
  7208     // https://html.spec.whatwg.org/multipage/syntax.html#special
       
  7209     var specialTags = ['address', 'applet', 'area', 'article', 'aside', 'base', 'basefont', 'bgsound', 'blockquote', 'body', 'br', 'button', 'caption', 'center', 'col', 'colgroup', 'dd', 'details', 'dir', 'div', 'dl', 'dt', 'embed', 'fieldset', 'figcaption', 'figure', 'footer', 'form', 'frame', 'frameset', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'iframe', 'img', 'input', 'isindex', 'li', 'link', 'listing', 'main', 'marquee', 'menu', 'menuitem', 'meta', 'nav', 'noembed', 'noframes', 'noscript', 'object', 'ol', 'p', 'param', 'plaintext', 'pre', 'script', 'section', 'select', 'source', 'style', 'summary', 'table', 'tbody', 'td', 'template', 'textarea', 'tfoot', 'th', 'thead', 'title', 'tr', 'track', 'ul', 'wbr', 'xmp']; // https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-scope
       
  7210 
       
  7211     var inScopeTags = ['applet', 'caption', 'html', 'table', 'td', 'th', 'marquee', 'object', 'template', // https://html.spec.whatwg.org/multipage/syntax.html#html-integration-point
       
  7212     // TODO: Distinguish by namespace here -- for <title>, including it here
       
  7213     // errs on the side of fewer warnings
       
  7214     'foreignObject', 'desc', 'title']; // https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-button-scope
       
  7215 
       
  7216     var buttonScopeTags = inScopeTags.concat(['button']); // https://html.spec.whatwg.org/multipage/syntax.html#generate-implied-end-tags
       
  7217 
       
  7218     var impliedEndTags = ['dd', 'dt', 'li', 'option', 'optgroup', 'p', 'rp', 'rt'];
       
  7219     var emptyAncestorInfo = {
       
  7220       current: null,
       
  7221       formTag: null,
       
  7222       aTagInScope: null,
       
  7223       buttonTagInScope: null,
       
  7224       nobrTagInScope: null,
       
  7225       pTagInButtonScope: null,
       
  7226       listItemTagAutoclosing: null,
       
  7227       dlItemTagAutoclosing: null
       
  7228     };
       
  7229 
       
  7230     updatedAncestorInfo = function (oldInfo, tag) {
       
  7231       var ancestorInfo = _assign({}, oldInfo || emptyAncestorInfo);
       
  7232 
       
  7233       var info = {
       
  7234         tag: tag
       
  7235       };
       
  7236 
       
  7237       if (inScopeTags.indexOf(tag) !== -1) {
       
  7238         ancestorInfo.aTagInScope = null;
       
  7239         ancestorInfo.buttonTagInScope = null;
       
  7240         ancestorInfo.nobrTagInScope = null;
       
  7241       }
       
  7242 
       
  7243       if (buttonScopeTags.indexOf(tag) !== -1) {
       
  7244         ancestorInfo.pTagInButtonScope = null;
       
  7245       } // See rules for 'li', 'dd', 'dt' start tags in
       
  7246       // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inbody
       
  7247 
       
  7248 
       
  7249       if (specialTags.indexOf(tag) !== -1 && tag !== 'address' && tag !== 'div' && tag !== 'p') {
       
  7250         ancestorInfo.listItemTagAutoclosing = null;
       
  7251         ancestorInfo.dlItemTagAutoclosing = null;
       
  7252       }
       
  7253 
       
  7254       ancestorInfo.current = info;
       
  7255 
       
  7256       if (tag === 'form') {
       
  7257         ancestorInfo.formTag = info;
       
  7258       }
       
  7259 
       
  7260       if (tag === 'a') {
       
  7261         ancestorInfo.aTagInScope = info;
       
  7262       }
       
  7263 
       
  7264       if (tag === 'button') {
       
  7265         ancestorInfo.buttonTagInScope = info;
       
  7266       }
       
  7267 
       
  7268       if (tag === 'nobr') {
       
  7269         ancestorInfo.nobrTagInScope = info;
       
  7270       }
       
  7271 
       
  7272       if (tag === 'p') {
       
  7273         ancestorInfo.pTagInButtonScope = info;
       
  7274       }
       
  7275 
       
  7276       if (tag === 'li') {
       
  7277         ancestorInfo.listItemTagAutoclosing = info;
       
  7278       }
       
  7279 
       
  7280       if (tag === 'dd' || tag === 'dt') {
       
  7281         ancestorInfo.dlItemTagAutoclosing = info;
       
  7282       }
       
  7283 
       
  7284       return ancestorInfo;
       
  7285     };
       
  7286     /**
       
  7287      * Returns whether
       
  7288      */
       
  7289 
       
  7290 
       
  7291     var isTagValidWithParent = function (tag, parentTag) {
       
  7292       // First, let's check if we're in an unusual parsing mode...
       
  7293       switch (parentTag) {
       
  7294         // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inselect
       
  7295         case 'select':
       
  7296           return tag === 'option' || tag === 'optgroup' || tag === '#text';
       
  7297 
       
  7298         case 'optgroup':
       
  7299           return tag === 'option' || tag === '#text';
       
  7300         // Strictly speaking, seeing an <option> doesn't mean we're in a <select>
       
  7301         // but
       
  7302 
       
  7303         case 'option':
       
  7304           return tag === '#text';
       
  7305         // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intd
       
  7306         // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-incaption
       
  7307         // No special behavior since these rules fall back to "in body" mode for
       
  7308         // all except special table nodes which cause bad parsing behavior anyway.
       
  7309         // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intr
       
  7310 
       
  7311         case 'tr':
       
  7312           return tag === 'th' || tag === 'td' || tag === 'style' || tag === 'script' || tag === 'template';
       
  7313         // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intbody
       
  7314 
       
  7315         case 'tbody':
       
  7316         case 'thead':
       
  7317         case 'tfoot':
       
  7318           return tag === 'tr' || tag === 'style' || tag === 'script' || tag === 'template';
       
  7319         // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-incolgroup
       
  7320 
       
  7321         case 'colgroup':
       
  7322           return tag === 'col' || tag === 'template';
       
  7323         // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intable
       
  7324 
       
  7325         case 'table':
       
  7326           return tag === 'caption' || tag === 'colgroup' || tag === 'tbody' || tag === 'tfoot' || tag === 'thead' || tag === 'style' || tag === 'script' || tag === 'template';
       
  7327         // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inhead
       
  7328 
       
  7329         case 'head':
       
  7330           return tag === 'base' || tag === 'basefont' || tag === 'bgsound' || tag === 'link' || tag === 'meta' || tag === 'title' || tag === 'noscript' || tag === 'noframes' || tag === 'style' || tag === 'script' || tag === 'template';
       
  7331         // https://html.spec.whatwg.org/multipage/semantics.html#the-html-element
       
  7332 
       
  7333         case 'html':
       
  7334           return tag === 'head' || tag === 'body' || tag === 'frameset';
       
  7335 
       
  7336         case 'frameset':
       
  7337           return tag === 'frame';
       
  7338 
       
  7339         case '#document':
       
  7340           return tag === 'html';
       
  7341       } // Probably in the "in body" parsing mode, so we outlaw only tag combos
       
  7342       // where the parsing rules cause implicit opens or closes to be added.
       
  7343       // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inbody
       
  7344 
       
  7345 
       
  7346       switch (tag) {
       
  7347         case 'h1':
       
  7348         case 'h2':
       
  7349         case 'h3':
       
  7350         case 'h4':
       
  7351         case 'h5':
       
  7352         case 'h6':
       
  7353           return parentTag !== 'h1' && parentTag !== 'h2' && parentTag !== 'h3' && parentTag !== 'h4' && parentTag !== 'h5' && parentTag !== 'h6';
       
  7354 
       
  7355         case 'rp':
       
  7356         case 'rt':
       
  7357           return impliedEndTags.indexOf(parentTag) === -1;
       
  7358 
       
  7359         case 'body':
       
  7360         case 'caption':
       
  7361         case 'col':
       
  7362         case 'colgroup':
       
  7363         case 'frameset':
       
  7364         case 'frame':
       
  7365         case 'head':
       
  7366         case 'html':
       
  7367         case 'tbody':
       
  7368         case 'td':
       
  7369         case 'tfoot':
       
  7370         case 'th':
       
  7371         case 'thead':
       
  7372         case 'tr':
       
  7373           // These tags are only valid with a few parents that have special child
       
  7374           // parsing rules -- if we're down here, then none of those matched and
       
  7375           // so we allow it only if we don't know what the parent is, as all other
       
  7376           // cases are invalid.
       
  7377           return parentTag == null;
       
  7378       }
       
  7379 
       
  7380       return true;
       
  7381     };
       
  7382     /**
       
  7383      * Returns whether
       
  7384      */
       
  7385 
       
  7386 
       
  7387     var findInvalidAncestorForTag = function (tag, ancestorInfo) {
       
  7388       switch (tag) {
       
  7389         case 'address':
       
  7390         case 'article':
       
  7391         case 'aside':
       
  7392         case 'blockquote':
       
  7393         case 'center':
       
  7394         case 'details':
       
  7395         case 'dialog':
       
  7396         case 'dir':
       
  7397         case 'div':
       
  7398         case 'dl':
       
  7399         case 'fieldset':
       
  7400         case 'figcaption':
       
  7401         case 'figure':
       
  7402         case 'footer':
       
  7403         case 'header':
       
  7404         case 'hgroup':
       
  7405         case 'main':
       
  7406         case 'menu':
       
  7407         case 'nav':
       
  7408         case 'ol':
       
  7409         case 'p':
       
  7410         case 'section':
       
  7411         case 'summary':
       
  7412         case 'ul':
       
  7413         case 'pre':
       
  7414         case 'listing':
       
  7415         case 'table':
       
  7416         case 'hr':
       
  7417         case 'xmp':
       
  7418         case 'h1':
       
  7419         case 'h2':
       
  7420         case 'h3':
       
  7421         case 'h4':
       
  7422         case 'h5':
       
  7423         case 'h6':
       
  7424           return ancestorInfo.pTagInButtonScope;
       
  7425 
       
  7426         case 'form':
       
  7427           return ancestorInfo.formTag || ancestorInfo.pTagInButtonScope;
       
  7428 
       
  7429         case 'li':
       
  7430           return ancestorInfo.listItemTagAutoclosing;
       
  7431 
       
  7432         case 'dd':
       
  7433         case 'dt':
       
  7434           return ancestorInfo.dlItemTagAutoclosing;
       
  7435 
       
  7436         case 'button':
       
  7437           return ancestorInfo.buttonTagInScope;
       
  7438 
       
  7439         case 'a':
       
  7440           // Spec says something about storing a list of markers, but it sounds
       
  7441           // equivalent to this check.
       
  7442           return ancestorInfo.aTagInScope;
       
  7443 
       
  7444         case 'nobr':
       
  7445           return ancestorInfo.nobrTagInScope;
       
  7446       }
       
  7447 
       
  7448       return null;
       
  7449     };
       
  7450 
       
  7451     var didWarn$1 = {};
       
  7452 
       
  7453     validateDOMNesting = function (childTag, childText, ancestorInfo) {
       
  7454       ancestorInfo = ancestorInfo || emptyAncestorInfo;
       
  7455       var parentInfo = ancestorInfo.current;
       
  7456       var parentTag = parentInfo && parentInfo.tag;
       
  7457 
       
  7458       if (childText != null) {
       
  7459         if (childTag != null) {
       
  7460           error('validateDOMNesting: when childText is passed, childTag should be null');
       
  7461         }
       
  7462 
       
  7463         childTag = '#text';
       
  7464       }
       
  7465 
       
  7466       var invalidParent = isTagValidWithParent(childTag, parentTag) ? null : parentInfo;
       
  7467       var invalidAncestor = invalidParent ? null : findInvalidAncestorForTag(childTag, ancestorInfo);
       
  7468       var invalidParentOrAncestor = invalidParent || invalidAncestor;
       
  7469 
       
  7470       if (!invalidParentOrAncestor) {
       
  7471         return;
       
  7472       }
       
  7473 
       
  7474       var ancestorTag = invalidParentOrAncestor.tag;
       
  7475       var addendum = getCurrentFiberStackInDev();
       
  7476       var warnKey = !!invalidParent + '|' + childTag + '|' + ancestorTag + '|' + addendum;
       
  7477 
       
  7478       if (didWarn$1[warnKey]) {
       
  7479         return;
       
  7480       }
       
  7481 
       
  7482       didWarn$1[warnKey] = true;
       
  7483       var tagDisplayName = childTag;
       
  7484       var whitespaceInfo = '';
       
  7485 
       
  7486       if (childTag === '#text') {
       
  7487         if (/\S/.test(childText)) {
       
  7488           tagDisplayName = 'Text nodes';
       
  7489         } else {
       
  7490           tagDisplayName = 'Whitespace text nodes';
       
  7491           whitespaceInfo = " Make sure you don't have any extra whitespace between tags on " + 'each line of your source code.';
       
  7492         }
       
  7493       } else {
       
  7494         tagDisplayName = '<' + childTag + '>';
       
  7495       }
       
  7496 
       
  7497       if (invalidParent) {
       
  7498         var info = '';
       
  7499 
       
  7500         if (ancestorTag === 'table' && childTag === 'tr') {
       
  7501           info += ' Add a <tbody>, <thead> or <tfoot> to your code to match the DOM tree generated by ' + 'the browser.';
       
  7502         }
       
  7503 
       
  7504         error('validateDOMNesting(...): %s cannot appear as a child of <%s>.%s%s', tagDisplayName, ancestorTag, whitespaceInfo, info);
       
  7505       } else {
       
  7506         error('validateDOMNesting(...): %s cannot appear as a descendant of ' + '<%s>.', tagDisplayName, ancestorTag);
       
  7507       }
       
  7508     };
       
  7509   }
       
  7510 
       
  7511   var SUPPRESS_HYDRATION_WARNING$1;
       
  7512 
       
  7513   {
       
  7514     SUPPRESS_HYDRATION_WARNING$1 = 'suppressHydrationWarning';
       
  7515   }
       
  7516 
       
  7517   var SUSPENSE_START_DATA = '$';
       
  7518   var SUSPENSE_END_DATA = '/$';
       
  7519   var SUSPENSE_PENDING_START_DATA = '$?';
       
  7520   var SUSPENSE_FALLBACK_START_DATA = '$!';
       
  7521   var STYLE$1 = 'style';
       
  7522   var eventsEnabled = null;
       
  7523   var selectionInformation = null;
       
  7524 
       
  7525   function shouldAutoFocusHostComponent(type, props) {
       
  7526     switch (type) {
       
  7527       case 'button':
       
  7528       case 'input':
       
  7529       case 'select':
       
  7530       case 'textarea':
       
  7531         return !!props.autoFocus;
       
  7532     }
       
  7533 
       
  7534     return false;
       
  7535   }
       
  7536   function getRootHostContext(rootContainerInstance) {
       
  7537     var type;
       
  7538     var namespace;
       
  7539     var nodeType = rootContainerInstance.nodeType;
       
  7540 
       
  7541     switch (nodeType) {
       
  7542       case DOCUMENT_NODE:
       
  7543       case DOCUMENT_FRAGMENT_NODE:
       
  7544         {
       
  7545           type = nodeType === DOCUMENT_NODE ? '#document' : '#fragment';
       
  7546           var root = rootContainerInstance.documentElement;
       
  7547           namespace = root ? root.namespaceURI : getChildNamespace(null, '');
       
  7548           break;
       
  7549         }
       
  7550 
       
  7551       default:
       
  7552         {
       
  7553           var container = nodeType === COMMENT_NODE ? rootContainerInstance.parentNode : rootContainerInstance;
       
  7554           var ownNamespace = container.namespaceURI || null;
       
  7555           type = container.tagName;
       
  7556           namespace = getChildNamespace(ownNamespace, type);
       
  7557           break;
       
  7558         }
       
  7559     }
       
  7560 
  9246     {
  7561     {
  9247       validateShorthandPropertyCollisionInDev(styleUpdates, nextProps[STYLE$1]);
  7562       var validatedTag = type.toLowerCase();
  9248     }
  7563       var ancestorInfo = updatedAncestorInfo(null, validatedTag);
  9249     (updatePayload = updatePayload || []).push(STYLE$1, styleUpdates);
  7564       return {
  9250   }
  7565         namespace: namespace,
  9251   return updatePayload;
  7566         ancestorInfo: ancestorInfo
  9252 }
  7567       };
  9253 
  7568     }
  9254 // Apply the diff.
  7569   }
  9255 function updateProperties(domElement, updatePayload, tag, lastRawProps, nextRawProps) {
  7570   function getChildHostContext(parentHostContext, type, rootContainerInstance) {
  9256   // Update checked *before* name.
  7571     {
  9257   // In the middle of an update, it is possible to have multiple checked.
  7572       var parentHostContextDev = parentHostContext;
  9258   // When a checked radio tries to change name, browser makes another radio's checked false.
  7573       var namespace = getChildNamespace(parentHostContextDev.namespace, type);
  9259   if (tag === 'input' && nextRawProps.type === 'radio' && nextRawProps.name != null) {
  7574       var ancestorInfo = updatedAncestorInfo(parentHostContextDev.ancestorInfo, type);
  9260     updateChecked(domElement, nextRawProps);
  7575       return {
  9261   }
  7576         namespace: namespace,
  9262 
  7577         ancestorInfo: ancestorInfo
  9263   var wasCustomComponentTag = isCustomComponent(tag, lastRawProps);
  7578       };
  9264   var isCustomComponentTag = isCustomComponent(tag, nextRawProps);
  7579     }
  9265   // Apply the diff.
  7580   }
  9266   updateDOMProperties(domElement, updatePayload, wasCustomComponentTag, isCustomComponentTag);
  7581   function getPublicInstance(instance) {
  9267 
  7582     return instance;
  9268   // TODO: Ensure that an update gets scheduled if any of the special props
  7583   }
  9269   // changed.
  7584   function prepareForCommit(containerInfo) {
  9270   switch (tag) {
  7585     eventsEnabled = isEnabled();
  9271     case 'input':
  7586     selectionInformation = getSelectionInformation();
  9272       // Update the wrapper around inputs *after* updating props. This has to
  7587     setEnabled(false);
  9273       // happen after `updateDOMProperties`. Otherwise HTML5 input validations
  7588   }
  9274       // raise warnings and prevent the new value from being assigned.
  7589   function resetAfterCommit(containerInfo) {
  9275       updateWrapper(domElement, nextRawProps);
  7590     restoreSelection(selectionInformation);
  9276       break;
  7591     setEnabled(eventsEnabled);
  9277     case 'textarea':
  7592     eventsEnabled = null;
  9278       updateWrapper$1(domElement, nextRawProps);
  7593 
  9279       break;
  7594     selectionInformation = null;
  9280     case 'select':
  7595   }
  9281       // <select> value update needs to occur after <option> children
  7596   function createInstance(type, props, rootContainerInstance, hostContext, internalInstanceHandle) {
  9282       // reconciliation
  7597     var parentNamespace;
  9283       postUpdateWrapper(domElement, nextRawProps);
  7598 
  9284       break;
  7599     {
  9285   }
  7600       // TODO: take namespace into account when validating.
  9286 }
  7601       var hostContextDev = hostContext;
  9287 
  7602       validateDOMNesting(type, null, hostContextDev.ancestorInfo);
  9288 function getPossibleStandardName(propName) {
  7603 
  9289   {
  7604       if (typeof props.children === 'string' || typeof props.children === 'number') {
  9290     var lowerCasedName = propName.toLowerCase();
  7605         var string = '' + props.children;
  9291     if (!possibleStandardNames.hasOwnProperty(lowerCasedName)) {
  7606         var ownAncestorInfo = updatedAncestorInfo(hostContextDev.ancestorInfo, type);
       
  7607         validateDOMNesting(null, string, ownAncestorInfo);
       
  7608       }
       
  7609 
       
  7610       parentNamespace = hostContextDev.namespace;
       
  7611     }
       
  7612 
       
  7613     var domElement = createElement(type, props, rootContainerInstance, parentNamespace);
       
  7614     precacheFiberNode(internalInstanceHandle, domElement);
       
  7615     updateFiberProps(domElement, props);
       
  7616     return domElement;
       
  7617   }
       
  7618   function appendInitialChild(parentInstance, child) {
       
  7619     parentInstance.appendChild(child);
       
  7620   }
       
  7621   function finalizeInitialChildren(domElement, type, props, rootContainerInstance, hostContext) {
       
  7622     setInitialProperties(domElement, type, props, rootContainerInstance);
       
  7623     return shouldAutoFocusHostComponent(type, props);
       
  7624   }
       
  7625   function prepareUpdate(domElement, type, oldProps, newProps, rootContainerInstance, hostContext) {
       
  7626     {
       
  7627       var hostContextDev = hostContext;
       
  7628 
       
  7629       if (typeof newProps.children !== typeof oldProps.children && (typeof newProps.children === 'string' || typeof newProps.children === 'number')) {
       
  7630         var string = '' + newProps.children;
       
  7631         var ownAncestorInfo = updatedAncestorInfo(hostContextDev.ancestorInfo, type);
       
  7632         validateDOMNesting(null, string, ownAncestorInfo);
       
  7633       }
       
  7634     }
       
  7635 
       
  7636     return diffProperties(domElement, type, oldProps, newProps, rootContainerInstance);
       
  7637   }
       
  7638   function shouldSetTextContent(type, props) {
       
  7639     return type === 'textarea' || type === 'option' || type === 'noscript' || typeof props.children === 'string' || typeof props.children === 'number' || typeof props.dangerouslySetInnerHTML === 'object' && props.dangerouslySetInnerHTML !== null && props.dangerouslySetInnerHTML.__html != null;
       
  7640   }
       
  7641   function shouldDeprioritizeSubtree(type, props) {
       
  7642     return !!props.hidden;
       
  7643   }
       
  7644   function createTextInstance(text, rootContainerInstance, hostContext, internalInstanceHandle) {
       
  7645     {
       
  7646       var hostContextDev = hostContext;
       
  7647       validateDOMNesting(null, text, hostContextDev.ancestorInfo);
       
  7648     }
       
  7649 
       
  7650     var textNode = createTextNode(text, rootContainerInstance);
       
  7651     precacheFiberNode(internalInstanceHandle, textNode);
       
  7652     return textNode;
       
  7653   }
       
  7654   // if a component just imports ReactDOM (e.g. for findDOMNode).
       
  7655   // Some environments might not have setTimeout or clearTimeout.
       
  7656 
       
  7657   var scheduleTimeout = typeof setTimeout === 'function' ? setTimeout : undefined;
       
  7658   var cancelTimeout = typeof clearTimeout === 'function' ? clearTimeout : undefined;
       
  7659   var noTimeout = -1; // -------------------
       
  7660   function commitMount(domElement, type, newProps, internalInstanceHandle) {
       
  7661     // Despite the naming that might imply otherwise, this method only
       
  7662     // fires if there is an `Update` effect scheduled during mounting.
       
  7663     // This happens if `finalizeInitialChildren` returns `true` (which it
       
  7664     // does to implement the `autoFocus` attribute on the client). But
       
  7665     // there are also other cases when this might happen (such as patching
       
  7666     // up text content during hydration mismatch). So we'll check this again.
       
  7667     if (shouldAutoFocusHostComponent(type, newProps)) {
       
  7668       domElement.focus();
       
  7669     }
       
  7670   }
       
  7671   function commitUpdate(domElement, updatePayload, type, oldProps, newProps, internalInstanceHandle) {
       
  7672     // Update the props handle so that we know which props are the ones with
       
  7673     // with current event handlers.
       
  7674     updateFiberProps(domElement, newProps); // Apply the diff to the DOM node.
       
  7675 
       
  7676     updateProperties(domElement, updatePayload, type, oldProps, newProps);
       
  7677   }
       
  7678   function resetTextContent(domElement) {
       
  7679     setTextContent(domElement, '');
       
  7680   }
       
  7681   function commitTextUpdate(textInstance, oldText, newText) {
       
  7682     textInstance.nodeValue = newText;
       
  7683   }
       
  7684   function appendChild(parentInstance, child) {
       
  7685     parentInstance.appendChild(child);
       
  7686   }
       
  7687   function appendChildToContainer(container, child) {
       
  7688     var parentNode;
       
  7689 
       
  7690     if (container.nodeType === COMMENT_NODE) {
       
  7691       parentNode = container.parentNode;
       
  7692       parentNode.insertBefore(child, container);
       
  7693     } else {
       
  7694       parentNode = container;
       
  7695       parentNode.appendChild(child);
       
  7696     } // This container might be used for a portal.
       
  7697     // If something inside a portal is clicked, that click should bubble
       
  7698     // through the React tree. However, on Mobile Safari the click would
       
  7699     // never bubble through the *DOM* tree unless an ancestor with onclick
       
  7700     // event exists. So we wouldn't see it and dispatch it.
       
  7701     // This is why we ensure that non React root containers have inline onclick
       
  7702     // defined.
       
  7703     // https://github.com/facebook/react/issues/11918
       
  7704 
       
  7705 
       
  7706     var reactRootContainer = container._reactRootContainer;
       
  7707 
       
  7708     if ((reactRootContainer === null || reactRootContainer === undefined) && parentNode.onclick === null) {
       
  7709       // TODO: This cast may not be sound for SVG, MathML or custom elements.
       
  7710       trapClickOnNonInteractiveElement(parentNode);
       
  7711     }
       
  7712   }
       
  7713   function insertBefore(parentInstance, child, beforeChild) {
       
  7714     parentInstance.insertBefore(child, beforeChild);
       
  7715   }
       
  7716   function insertInContainerBefore(container, child, beforeChild) {
       
  7717     if (container.nodeType === COMMENT_NODE) {
       
  7718       container.parentNode.insertBefore(child, beforeChild);
       
  7719     } else {
       
  7720       container.insertBefore(child, beforeChild);
       
  7721     }
       
  7722   }
       
  7723   function removeChild(parentInstance, child) {
       
  7724     parentInstance.removeChild(child);
       
  7725   }
       
  7726   function removeChildFromContainer(container, child) {
       
  7727     if (container.nodeType === COMMENT_NODE) {
       
  7728       container.parentNode.removeChild(child);
       
  7729     } else {
       
  7730       container.removeChild(child);
       
  7731     }
       
  7732   }
       
  7733 
       
  7734   function hideInstance(instance) {
       
  7735     // pass host context to this method?
       
  7736 
       
  7737 
       
  7738     instance = instance;
       
  7739     var style = instance.style;
       
  7740 
       
  7741     if (typeof style.setProperty === 'function') {
       
  7742       style.setProperty('display', 'none', 'important');
       
  7743     } else {
       
  7744       style.display = 'none';
       
  7745     }
       
  7746   }
       
  7747   function hideTextInstance(textInstance) {
       
  7748     textInstance.nodeValue = '';
       
  7749   }
       
  7750   function unhideInstance(instance, props) {
       
  7751     instance = instance;
       
  7752     var styleProp = props[STYLE$1];
       
  7753     var display = styleProp !== undefined && styleProp !== null && styleProp.hasOwnProperty('display') ? styleProp.display : null;
       
  7754     instance.style.display = dangerousStyleValue('display', display);
       
  7755   }
       
  7756   function unhideTextInstance(textInstance, text) {
       
  7757     textInstance.nodeValue = text;
       
  7758   } // -------------------
       
  7759   function canHydrateInstance(instance, type, props) {
       
  7760     if (instance.nodeType !== ELEMENT_NODE || type.toLowerCase() !== instance.nodeName.toLowerCase()) {
  9292       return null;
  7761       return null;
  9293     }
  7762     } // This has now been refined to an element node.
  9294     return possibleStandardNames[lowerCasedName] || null;
  7763 
  9295   }
  7764 
  9296   return null;
  7765     return instance;
  9297 }
  7766   }
  9298 
  7767   function canHydrateTextInstance(instance, text) {
  9299 function diffHydratedProperties(domElement, tag, rawProps, parentNamespace, rootContainerElement) {
  7768     if (text === '' || instance.nodeType !== TEXT_NODE) {
  9300   var isCustomComponentTag = void 0;
  7769       // Empty strings are not parsed by HTML so there won't be a correct match here.
  9301   var extraAttributeNames = void 0;
  7770       return null;
  9302 
  7771     } // This has now been refined to a text node.
  9303   {
  7772 
  9304     suppressHydrationWarning = rawProps[SUPPRESS_HYDRATION_WARNING$1] === true;
  7773 
  9305     isCustomComponentTag = isCustomComponent(tag, rawProps);
  7774     return instance;
  9306     validatePropertiesInDevelopment(tag, rawProps);
  7775   }
  9307     if (isCustomComponentTag && !didWarnShadyDOM && domElement.shadyRoot) {
  7776   function isSuspenseInstancePending(instance) {
  9308       warning$1(false, '%s is using shady DOM. Using shady DOM with React can ' + 'cause things to break subtly.', getCurrentFiberOwnerNameInDevOrNull() || 'A component');
  7777     return instance.data === SUSPENSE_PENDING_START_DATA;
  9309       didWarnShadyDOM = true;
  7778   }
  9310     }
  7779   function isSuspenseInstanceFallback(instance) {
  9311   }
  7780     return instance.data === SUSPENSE_FALLBACK_START_DATA;
  9312 
  7781   }
  9313   // TODO: Make sure that we check isMounted before firing any of these events.
  7782 
  9314   switch (tag) {
  7783   function getNextHydratable(node) {
  9315     case 'iframe':
  7784     // Skip non-hydratable nodes.
  9316     case 'object':
  7785     for (; node != null; node = node.nextSibling) {
  9317     case 'embed':
  7786       var nodeType = node.nodeType;
  9318       trapBubbledEvent(TOP_LOAD, domElement);
  7787 
  9319       break;
  7788       if (nodeType === ELEMENT_NODE || nodeType === TEXT_NODE) {
  9320     case 'video':
  7789         break;
  9321     case 'audio':
  7790       }
  9322       // Create listener for each media event
  7791     }
  9323       for (var i = 0; i < mediaEventTypes.length; i++) {
  7792 
  9324         trapBubbledEvent(mediaEventTypes[i], domElement);
  7793     return node;
  9325       }
  7794   }
  9326       break;
  7795 
  9327     case 'source':
  7796   function getNextHydratableSibling(instance) {
  9328       trapBubbledEvent(TOP_ERROR, domElement);
  7797     return getNextHydratable(instance.nextSibling);
  9329       break;
  7798   }
  9330     case 'img':
  7799   function getFirstHydratableChild(parentInstance) {
  9331     case 'image':
  7800     return getNextHydratable(parentInstance.firstChild);
  9332     case 'link':
  7801   }
  9333       trapBubbledEvent(TOP_ERROR, domElement);
  7802   function hydrateInstance(instance, type, props, rootContainerInstance, hostContext, internalInstanceHandle) {
  9334       trapBubbledEvent(TOP_LOAD, domElement);
  7803     precacheFiberNode(internalInstanceHandle, instance); // TODO: Possibly defer this until the commit phase where all the events
  9335       break;
  7804     // get attached.
  9336     case 'form':
  7805 
  9337       trapBubbledEvent(TOP_RESET, domElement);
  7806     updateFiberProps(instance, props);
  9338       trapBubbledEvent(TOP_SUBMIT, domElement);
  7807     var parentNamespace;
  9339       break;
  7808 
  9340     case 'details':
  7809     {
  9341       trapBubbledEvent(TOP_TOGGLE, domElement);
  7810       var hostContextDev = hostContext;
  9342       break;
  7811       parentNamespace = hostContextDev.namespace;
  9343     case 'input':
  7812     }
  9344       initWrapperState(domElement, rawProps);
  7813 
  9345       trapBubbledEvent(TOP_INVALID, domElement);
  7814     return diffHydratedProperties(instance, type, props, parentNamespace, rootContainerInstance);
  9346       // For controlled components we always need to ensure we're listening
  7815   }
  9347       // to onChange. Even if there is no listener.
  7816   function hydrateTextInstance(textInstance, text, internalInstanceHandle) {
  9348       ensureListeningTo(rootContainerElement, 'onChange');
  7817     precacheFiberNode(internalInstanceHandle, textInstance);
  9349       break;
  7818     return diffHydratedText(textInstance, text);
  9350     case 'option':
  7819   }
  9351       validateProps(domElement, rawProps);
  7820   function getNextHydratableInstanceAfterSuspenseInstance(suspenseInstance) {
  9352       break;
  7821     var node = suspenseInstance.nextSibling; // Skip past all nodes within this suspense boundary.
  9353     case 'select':
  7822     // There might be nested nodes so we need to keep track of how
  9354       initWrapperState$1(domElement, rawProps);
  7823     // deep we are and only break out when we're back on top.
  9355       trapBubbledEvent(TOP_INVALID, domElement);
  7824 
  9356       // For controlled components we always need to ensure we're listening
  7825     var depth = 0;
  9357       // to onChange. Even if there is no listener.
  7826 
  9358       ensureListeningTo(rootContainerElement, 'onChange');
  7827     while (node) {
  9359       break;
  7828       if (node.nodeType === COMMENT_NODE) {
  9360     case 'textarea':
  7829         var data = node.data;
  9361       initWrapperState$2(domElement, rawProps);
  7830 
  9362       trapBubbledEvent(TOP_INVALID, domElement);
  7831         if (data === SUSPENSE_END_DATA) {
  9363       // For controlled components we always need to ensure we're listening
  7832           if (depth === 0) {
  9364       // to onChange. Even if there is no listener.
  7833             return getNextHydratableSibling(node);
  9365       ensureListeningTo(rootContainerElement, 'onChange');
  7834           } else {
  9366       break;
  7835             depth--;
  9367   }
  7836           }
  9368 
  7837         } else if (data === SUSPENSE_START_DATA || data === SUSPENSE_FALLBACK_START_DATA || data === SUSPENSE_PENDING_START_DATA) {
  9369   assertValidProps(tag, rawProps);
  7838           depth++;
  9370 
  7839         }
  9371   {
  7840       }
  9372     extraAttributeNames = new Set();
  7841 
  9373     var attributes = domElement.attributes;
  7842       node = node.nextSibling;
  9374     for (var _i = 0; _i < attributes.length; _i++) {
  7843     } // TODO: Warn, we didn't find the end comment boundary.
  9375       var name = attributes[_i].name.toLowerCase();
  7844 
  9376       switch (name) {
  7845 
  9377         // Built-in SSR attribute is whitelisted
  7846     return null;
  9378         case 'data-reactroot':
  7847   } // Returns the SuspenseInstance if this node is a direct child of a
       
  7848   // SuspenseInstance. I.e. if its previous sibling is a Comment with
       
  7849   // SUSPENSE_x_START_DATA. Otherwise, null.
       
  7850 
       
  7851   function getParentSuspenseInstance(targetInstance) {
       
  7852     var node = targetInstance.previousSibling; // Skip past all nodes within this suspense boundary.
       
  7853     // There might be nested nodes so we need to keep track of how
       
  7854     // deep we are and only break out when we're back on top.
       
  7855 
       
  7856     var depth = 0;
       
  7857 
       
  7858     while (node) {
       
  7859       if (node.nodeType === COMMENT_NODE) {
       
  7860         var data = node.data;
       
  7861 
       
  7862         if (data === SUSPENSE_START_DATA || data === SUSPENSE_FALLBACK_START_DATA || data === SUSPENSE_PENDING_START_DATA) {
       
  7863           if (depth === 0) {
       
  7864             return node;
       
  7865           } else {
       
  7866             depth--;
       
  7867           }
       
  7868         } else if (data === SUSPENSE_END_DATA) {
       
  7869           depth++;
       
  7870         }
       
  7871       }
       
  7872 
       
  7873       node = node.previousSibling;
       
  7874     }
       
  7875 
       
  7876     return null;
       
  7877   }
       
  7878   function commitHydratedContainer(container) {
       
  7879     // Retry if any event replaying was blocked on this.
       
  7880     retryIfBlockedOn(container);
       
  7881   }
       
  7882   function commitHydratedSuspenseInstance(suspenseInstance) {
       
  7883     // Retry if any event replaying was blocked on this.
       
  7884     retryIfBlockedOn(suspenseInstance);
       
  7885   }
       
  7886   function didNotMatchHydratedContainerTextInstance(parentContainer, textInstance, text) {
       
  7887     {
       
  7888       warnForUnmatchedText(textInstance, text);
       
  7889     }
       
  7890   }
       
  7891   function didNotMatchHydratedTextInstance(parentType, parentProps, parentInstance, textInstance, text) {
       
  7892     if ( parentProps[SUPPRESS_HYDRATION_WARNING$1] !== true) {
       
  7893       warnForUnmatchedText(textInstance, text);
       
  7894     }
       
  7895   }
       
  7896   function didNotHydrateContainerInstance(parentContainer, instance) {
       
  7897     {
       
  7898       if (instance.nodeType === ELEMENT_NODE) {
       
  7899         warnForDeletedHydratableElement(parentContainer, instance);
       
  7900       } else if (instance.nodeType === COMMENT_NODE) ; else {
       
  7901         warnForDeletedHydratableText(parentContainer, instance);
       
  7902       }
       
  7903     }
       
  7904   }
       
  7905   function didNotHydrateInstance(parentType, parentProps, parentInstance, instance) {
       
  7906     if ( parentProps[SUPPRESS_HYDRATION_WARNING$1] !== true) {
       
  7907       if (instance.nodeType === ELEMENT_NODE) {
       
  7908         warnForDeletedHydratableElement(parentInstance, instance);
       
  7909       } else if (instance.nodeType === COMMENT_NODE) ; else {
       
  7910         warnForDeletedHydratableText(parentInstance, instance);
       
  7911       }
       
  7912     }
       
  7913   }
       
  7914   function didNotFindHydratableContainerInstance(parentContainer, type, props) {
       
  7915     {
       
  7916       warnForInsertedHydratedElement(parentContainer, type);
       
  7917     }
       
  7918   }
       
  7919   function didNotFindHydratableContainerTextInstance(parentContainer, text) {
       
  7920     {
       
  7921       warnForInsertedHydratedText(parentContainer, text);
       
  7922     }
       
  7923   }
       
  7924   function didNotFindHydratableInstance(parentType, parentProps, parentInstance, type, props) {
       
  7925     if ( parentProps[SUPPRESS_HYDRATION_WARNING$1] !== true) {
       
  7926       warnForInsertedHydratedElement(parentInstance, type);
       
  7927     }
       
  7928   }
       
  7929   function didNotFindHydratableTextInstance(parentType, parentProps, parentInstance, text) {
       
  7930     if ( parentProps[SUPPRESS_HYDRATION_WARNING$1] !== true) {
       
  7931       warnForInsertedHydratedText(parentInstance, text);
       
  7932     }
       
  7933   }
       
  7934   function didNotFindHydratableSuspenseInstance(parentType, parentProps, parentInstance) {
       
  7935     if ( parentProps[SUPPRESS_HYDRATION_WARNING$1] !== true) ;
       
  7936   }
       
  7937 
       
  7938   var randomKey = Math.random().toString(36).slice(2);
       
  7939   var internalInstanceKey = '__reactInternalInstance$' + randomKey;
       
  7940   var internalEventHandlersKey = '__reactEventHandlers$' + randomKey;
       
  7941   var internalContainerInstanceKey = '__reactContainere$' + randomKey;
       
  7942   function precacheFiberNode(hostInst, node) {
       
  7943     node[internalInstanceKey] = hostInst;
       
  7944   }
       
  7945   function markContainerAsRoot(hostRoot, node) {
       
  7946     node[internalContainerInstanceKey] = hostRoot;
       
  7947   }
       
  7948   function unmarkContainerAsRoot(node) {
       
  7949     node[internalContainerInstanceKey] = null;
       
  7950   }
       
  7951   function isContainerMarkedAsRoot(node) {
       
  7952     return !!node[internalContainerInstanceKey];
       
  7953   } // Given a DOM node, return the closest HostComponent or HostText fiber ancestor.
       
  7954   // If the target node is part of a hydrated or not yet rendered subtree, then
       
  7955   // this may also return a SuspenseComponent or HostRoot to indicate that.
       
  7956   // Conceptually the HostRoot fiber is a child of the Container node. So if you
       
  7957   // pass the Container node as the targetNode, you will not actually get the
       
  7958   // HostRoot back. To get to the HostRoot, you need to pass a child of it.
       
  7959   // The same thing applies to Suspense boundaries.
       
  7960 
       
  7961   function getClosestInstanceFromNode(targetNode) {
       
  7962     var targetInst = targetNode[internalInstanceKey];
       
  7963 
       
  7964     if (targetInst) {
       
  7965       // Don't return HostRoot or SuspenseComponent here.
       
  7966       return targetInst;
       
  7967     } // If the direct event target isn't a React owned DOM node, we need to look
       
  7968     // to see if one of its parents is a React owned DOM node.
       
  7969 
       
  7970 
       
  7971     var parentNode = targetNode.parentNode;
       
  7972 
       
  7973     while (parentNode) {
       
  7974       // We'll check if this is a container root that could include
       
  7975       // React nodes in the future. We need to check this first because
       
  7976       // if we're a child of a dehydrated container, we need to first
       
  7977       // find that inner container before moving on to finding the parent
       
  7978       // instance. Note that we don't check this field on  the targetNode
       
  7979       // itself because the fibers are conceptually between the container
       
  7980       // node and the first child. It isn't surrounding the container node.
       
  7981       // If it's not a container, we check if it's an instance.
       
  7982       targetInst = parentNode[internalContainerInstanceKey] || parentNode[internalInstanceKey];
       
  7983 
       
  7984       if (targetInst) {
       
  7985         // Since this wasn't the direct target of the event, we might have
       
  7986         // stepped past dehydrated DOM nodes to get here. However they could
       
  7987         // also have been non-React nodes. We need to answer which one.
       
  7988         // If we the instance doesn't have any children, then there can't be
       
  7989         // a nested suspense boundary within it. So we can use this as a fast
       
  7990         // bailout. Most of the time, when people add non-React children to
       
  7991         // the tree, it is using a ref to a child-less DOM node.
       
  7992         // Normally we'd only need to check one of the fibers because if it
       
  7993         // has ever gone from having children to deleting them or vice versa
       
  7994         // it would have deleted the dehydrated boundary nested inside already.
       
  7995         // However, since the HostRoot starts out with an alternate it might
       
  7996         // have one on the alternate so we need to check in case this was a
       
  7997         // root.
       
  7998         var alternate = targetInst.alternate;
       
  7999 
       
  8000         if (targetInst.child !== null || alternate !== null && alternate.child !== null) {
       
  8001           // Next we need to figure out if the node that skipped past is
       
  8002           // nested within a dehydrated boundary and if so, which one.
       
  8003           var suspenseInstance = getParentSuspenseInstance(targetNode);
       
  8004 
       
  8005           while (suspenseInstance !== null) {
       
  8006             // We found a suspense instance. That means that we haven't
       
  8007             // hydrated it yet. Even though we leave the comments in the
       
  8008             // DOM after hydrating, and there are boundaries in the DOM
       
  8009             // that could already be hydrated, we wouldn't have found them
       
  8010             // through this pass since if the target is hydrated it would
       
  8011             // have had an internalInstanceKey on it.
       
  8012             // Let's get the fiber associated with the SuspenseComponent
       
  8013             // as the deepest instance.
       
  8014             var targetSuspenseInst = suspenseInstance[internalInstanceKey];
       
  8015 
       
  8016             if (targetSuspenseInst) {
       
  8017               return targetSuspenseInst;
       
  8018             } // If we don't find a Fiber on the comment, it might be because
       
  8019             // we haven't gotten to hydrate it yet. There might still be a
       
  8020             // parent boundary that hasn't above this one so we need to find
       
  8021             // the outer most that is known.
       
  8022 
       
  8023 
       
  8024             suspenseInstance = getParentSuspenseInstance(suspenseInstance); // If we don't find one, then that should mean that the parent
       
  8025             // host component also hasn't hydrated yet. We can return it
       
  8026             // below since it will bail out on the isMounted check later.
       
  8027           }
       
  8028         }
       
  8029 
       
  8030         return targetInst;
       
  8031       }
       
  8032 
       
  8033       targetNode = parentNode;
       
  8034       parentNode = targetNode.parentNode;
       
  8035     }
       
  8036 
       
  8037     return null;
       
  8038   }
       
  8039   /**
       
  8040    * Given a DOM node, return the ReactDOMComponent or ReactDOMTextComponent
       
  8041    * instance, or null if the node was not rendered by this React.
       
  8042    */
       
  8043 
       
  8044   function getInstanceFromNode$1(node) {
       
  8045     var inst = node[internalInstanceKey] || node[internalContainerInstanceKey];
       
  8046 
       
  8047     if (inst) {
       
  8048       if (inst.tag === HostComponent || inst.tag === HostText || inst.tag === SuspenseComponent || inst.tag === HostRoot) {
       
  8049         return inst;
       
  8050       } else {
       
  8051         return null;
       
  8052       }
       
  8053     }
       
  8054 
       
  8055     return null;
       
  8056   }
       
  8057   /**
       
  8058    * Given a ReactDOMComponent or ReactDOMTextComponent, return the corresponding
       
  8059    * DOM node.
       
  8060    */
       
  8061 
       
  8062   function getNodeFromInstance$1(inst) {
       
  8063     if (inst.tag === HostComponent || inst.tag === HostText) {
       
  8064       // In Fiber this, is just the state node right now. We assume it will be
       
  8065       // a host component or host text.
       
  8066       return inst.stateNode;
       
  8067     } // Without this first invariant, passing a non-DOM-component triggers the next
       
  8068     // invariant for a missing parent, which is super confusing.
       
  8069 
       
  8070 
       
  8071     {
       
  8072       {
       
  8073         throw Error( "getNodeFromInstance: Invalid argument." );
       
  8074       }
       
  8075     }
       
  8076   }
       
  8077   function getFiberCurrentPropsFromNode$1(node) {
       
  8078     return node[internalEventHandlersKey] || null;
       
  8079   }
       
  8080   function updateFiberProps(node, props) {
       
  8081     node[internalEventHandlersKey] = props;
       
  8082   }
       
  8083 
       
  8084   function getParent(inst) {
       
  8085     do {
       
  8086       inst = inst.return; // TODO: If this is a HostRoot we might want to bail out.
       
  8087       // That is depending on if we want nested subtrees (layers) to bubble
       
  8088       // events to their parent. We could also go through parentNode on the
       
  8089       // host node but that wouldn't work for React Native and doesn't let us
       
  8090       // do the portal feature.
       
  8091     } while (inst && inst.tag !== HostComponent);
       
  8092 
       
  8093     if (inst) {
       
  8094       return inst;
       
  8095     }
       
  8096 
       
  8097     return null;
       
  8098   }
       
  8099   /**
       
  8100    * Return the lowest common ancestor of A and B, or null if they are in
       
  8101    * different trees.
       
  8102    */
       
  8103 
       
  8104 
       
  8105   function getLowestCommonAncestor(instA, instB) {
       
  8106     var depthA = 0;
       
  8107 
       
  8108     for (var tempA = instA; tempA; tempA = getParent(tempA)) {
       
  8109       depthA++;
       
  8110     }
       
  8111 
       
  8112     var depthB = 0;
       
  8113 
       
  8114     for (var tempB = instB; tempB; tempB = getParent(tempB)) {
       
  8115       depthB++;
       
  8116     } // If A is deeper, crawl up.
       
  8117 
       
  8118 
       
  8119     while (depthA - depthB > 0) {
       
  8120       instA = getParent(instA);
       
  8121       depthA--;
       
  8122     } // If B is deeper, crawl up.
       
  8123 
       
  8124 
       
  8125     while (depthB - depthA > 0) {
       
  8126       instB = getParent(instB);
       
  8127       depthB--;
       
  8128     } // Walk in lockstep until we find a match.
       
  8129 
       
  8130 
       
  8131     var depth = depthA;
       
  8132 
       
  8133     while (depth--) {
       
  8134       if (instA === instB || instA === instB.alternate) {
       
  8135         return instA;
       
  8136       }
       
  8137 
       
  8138       instA = getParent(instA);
       
  8139       instB = getParent(instB);
       
  8140     }
       
  8141 
       
  8142     return null;
       
  8143   }
       
  8144   /**
       
  8145    * Simulates the traversal of a two-phase, capture/bubble event dispatch.
       
  8146    */
       
  8147 
       
  8148   function traverseTwoPhase(inst, fn, arg) {
       
  8149     var path = [];
       
  8150 
       
  8151     while (inst) {
       
  8152       path.push(inst);
       
  8153       inst = getParent(inst);
       
  8154     }
       
  8155 
       
  8156     var i;
       
  8157 
       
  8158     for (i = path.length; i-- > 0;) {
       
  8159       fn(path[i], 'captured', arg);
       
  8160     }
       
  8161 
       
  8162     for (i = 0; i < path.length; i++) {
       
  8163       fn(path[i], 'bubbled', arg);
       
  8164     }
       
  8165   }
       
  8166   /**
       
  8167    * Traverses the ID hierarchy and invokes the supplied `cb` on any IDs that
       
  8168    * should would receive a `mouseEnter` or `mouseLeave` event.
       
  8169    *
       
  8170    * Does not invoke the callback on the nearest common ancestor because nothing
       
  8171    * "entered" or "left" that element.
       
  8172    */
       
  8173 
       
  8174   function traverseEnterLeave(from, to, fn, argFrom, argTo) {
       
  8175     var common = from && to ? getLowestCommonAncestor(from, to) : null;
       
  8176     var pathFrom = [];
       
  8177 
       
  8178     while (true) {
       
  8179       if (!from) {
       
  8180         break;
       
  8181       }
       
  8182 
       
  8183       if (from === common) {
       
  8184         break;
       
  8185       }
       
  8186 
       
  8187       var alternate = from.alternate;
       
  8188 
       
  8189       if (alternate !== null && alternate === common) {
       
  8190         break;
       
  8191       }
       
  8192 
       
  8193       pathFrom.push(from);
       
  8194       from = getParent(from);
       
  8195     }
       
  8196 
       
  8197     var pathTo = [];
       
  8198 
       
  8199     while (true) {
       
  8200       if (!to) {
       
  8201         break;
       
  8202       }
       
  8203 
       
  8204       if (to === common) {
       
  8205         break;
       
  8206       }
       
  8207 
       
  8208       var _alternate = to.alternate;
       
  8209 
       
  8210       if (_alternate !== null && _alternate === common) {
       
  8211         break;
       
  8212       }
       
  8213 
       
  8214       pathTo.push(to);
       
  8215       to = getParent(to);
       
  8216     }
       
  8217 
       
  8218     for (var i = 0; i < pathFrom.length; i++) {
       
  8219       fn(pathFrom[i], 'bubbled', argFrom);
       
  8220     }
       
  8221 
       
  8222     for (var _i = pathTo.length; _i-- > 0;) {
       
  8223       fn(pathTo[_i], 'captured', argTo);
       
  8224     }
       
  8225   }
       
  8226 
       
  8227   function isInteractive(tag) {
       
  8228     return tag === 'button' || tag === 'input' || tag === 'select' || tag === 'textarea';
       
  8229   }
       
  8230 
       
  8231   function shouldPreventMouseEvent(name, type, props) {
       
  8232     switch (name) {
       
  8233       case 'onClick':
       
  8234       case 'onClickCapture':
       
  8235       case 'onDoubleClick':
       
  8236       case 'onDoubleClickCapture':
       
  8237       case 'onMouseDown':
       
  8238       case 'onMouseDownCapture':
       
  8239       case 'onMouseMove':
       
  8240       case 'onMouseMoveCapture':
       
  8241       case 'onMouseUp':
       
  8242       case 'onMouseUpCapture':
       
  8243       case 'onMouseEnter':
       
  8244         return !!(props.disabled && isInteractive(type));
       
  8245 
       
  8246       default:
       
  8247         return false;
       
  8248     }
       
  8249   }
       
  8250   /**
       
  8251    * @param {object} inst The instance, which is the source of events.
       
  8252    * @param {string} registrationName Name of listener (e.g. `onClick`).
       
  8253    * @return {?function} The stored callback.
       
  8254    */
       
  8255 
       
  8256 
       
  8257   function getListener(inst, registrationName) {
       
  8258     var listener; // TODO: shouldPreventMouseEvent is DOM-specific and definitely should not
       
  8259     // live here; needs to be moved to a better place soon
       
  8260 
       
  8261     var stateNode = inst.stateNode;
       
  8262 
       
  8263     if (!stateNode) {
       
  8264       // Work in progress (ex: onload events in incremental mode).
       
  8265       return null;
       
  8266     }
       
  8267 
       
  8268     var props = getFiberCurrentPropsFromNode(stateNode);
       
  8269 
       
  8270     if (!props) {
       
  8271       // Work in progress.
       
  8272       return null;
       
  8273     }
       
  8274 
       
  8275     listener = props[registrationName];
       
  8276 
       
  8277     if (shouldPreventMouseEvent(registrationName, inst.type, props)) {
       
  8278       return null;
       
  8279     }
       
  8280 
       
  8281     if (!(!listener || typeof listener === 'function')) {
       
  8282       {
       
  8283         throw Error( "Expected `" + registrationName + "` listener to be a function, instead got a value of `" + typeof listener + "` type." );
       
  8284       }
       
  8285     }
       
  8286 
       
  8287     return listener;
       
  8288   }
       
  8289 
       
  8290   /**
       
  8291    * Some event types have a notion of different registration names for different
       
  8292    * "phases" of propagation. This finds listeners by a given phase.
       
  8293    */
       
  8294   function listenerAtPhase(inst, event, propagationPhase) {
       
  8295     var registrationName = event.dispatchConfig.phasedRegistrationNames[propagationPhase];
       
  8296     return getListener(inst, registrationName);
       
  8297   }
       
  8298   /**
       
  8299    * A small set of propagation patterns, each of which will accept a small amount
       
  8300    * of information, and generate a set of "dispatch ready event objects" - which
       
  8301    * are sets of events that have already been annotated with a set of dispatched
       
  8302    * listener functions/ids. The API is designed this way to discourage these
       
  8303    * propagation strategies from actually executing the dispatches, since we
       
  8304    * always want to collect the entire set of dispatches before executing even a
       
  8305    * single one.
       
  8306    */
       
  8307 
       
  8308   /**
       
  8309    * Tags a `SyntheticEvent` with dispatched listeners. Creating this function
       
  8310    * here, allows us to not have to bind or create functions for each event.
       
  8311    * Mutating the event's members allows us to not have to create a wrapping
       
  8312    * "dispatch" object that pairs the event with the listener.
       
  8313    */
       
  8314 
       
  8315 
       
  8316   function accumulateDirectionalDispatches(inst, phase, event) {
       
  8317     {
       
  8318       if (!inst) {
       
  8319         error('Dispatching inst must not be null');
       
  8320       }
       
  8321     }
       
  8322 
       
  8323     var listener = listenerAtPhase(inst, event, phase);
       
  8324 
       
  8325     if (listener) {
       
  8326       event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);
       
  8327       event._dispatchInstances = accumulateInto(event._dispatchInstances, inst);
       
  8328     }
       
  8329   }
       
  8330   /**
       
  8331    * Collect dispatches (must be entirely collected before dispatching - see unit
       
  8332    * tests). Lazily allocate the array to conserve memory.  We must loop through
       
  8333    * each event and perform the traversal for each one. We cannot perform a
       
  8334    * single traversal for the entire collection of events because each event may
       
  8335    * have a different target.
       
  8336    */
       
  8337 
       
  8338 
       
  8339   function accumulateTwoPhaseDispatchesSingle(event) {
       
  8340     if (event && event.dispatchConfig.phasedRegistrationNames) {
       
  8341       traverseTwoPhase(event._targetInst, accumulateDirectionalDispatches, event);
       
  8342     }
       
  8343   }
       
  8344   /**
       
  8345    * Accumulates without regard to direction, does not look for phased
       
  8346    * registration names. Same as `accumulateDirectDispatchesSingle` but without
       
  8347    * requiring that the `dispatchMarker` be the same as the dispatched ID.
       
  8348    */
       
  8349 
       
  8350 
       
  8351   function accumulateDispatches(inst, ignoredDirection, event) {
       
  8352     if (inst && event && event.dispatchConfig.registrationName) {
       
  8353       var registrationName = event.dispatchConfig.registrationName;
       
  8354       var listener = getListener(inst, registrationName);
       
  8355 
       
  8356       if (listener) {
       
  8357         event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);
       
  8358         event._dispatchInstances = accumulateInto(event._dispatchInstances, inst);
       
  8359       }
       
  8360     }
       
  8361   }
       
  8362   /**
       
  8363    * Accumulates dispatches on an `SyntheticEvent`, but only for the
       
  8364    * `dispatchMarker`.
       
  8365    * @param {SyntheticEvent} event
       
  8366    */
       
  8367 
       
  8368 
       
  8369   function accumulateDirectDispatchesSingle(event) {
       
  8370     if (event && event.dispatchConfig.registrationName) {
       
  8371       accumulateDispatches(event._targetInst, null, event);
       
  8372     }
       
  8373   }
       
  8374 
       
  8375   function accumulateTwoPhaseDispatches(events) {
       
  8376     forEachAccumulated(events, accumulateTwoPhaseDispatchesSingle);
       
  8377   }
       
  8378   function accumulateEnterLeaveDispatches(leave, enter, from, to) {
       
  8379     traverseEnterLeave(from, to, accumulateDispatches, leave, enter);
       
  8380   }
       
  8381   function accumulateDirectDispatches(events) {
       
  8382     forEachAccumulated(events, accumulateDirectDispatchesSingle);
       
  8383   }
       
  8384 
       
  8385   /**
       
  8386    * These variables store information about text content of a target node,
       
  8387    * allowing comparison of content before and after a given event.
       
  8388    *
       
  8389    * Identify the node where selection currently begins, then observe
       
  8390    * both its text content and its current position in the DOM. Since the
       
  8391    * browser may natively replace the target node during composition, we can
       
  8392    * use its position to find its replacement.
       
  8393    *
       
  8394    *
       
  8395    */
       
  8396   var root = null;
       
  8397   var startText = null;
       
  8398   var fallbackText = null;
       
  8399   function initialize(nativeEventTarget) {
       
  8400     root = nativeEventTarget;
       
  8401     startText = getText();
       
  8402     return true;
       
  8403   }
       
  8404   function reset() {
       
  8405     root = null;
       
  8406     startText = null;
       
  8407     fallbackText = null;
       
  8408   }
       
  8409   function getData() {
       
  8410     if (fallbackText) {
       
  8411       return fallbackText;
       
  8412     }
       
  8413 
       
  8414     var start;
       
  8415     var startValue = startText;
       
  8416     var startLength = startValue.length;
       
  8417     var end;
       
  8418     var endValue = getText();
       
  8419     var endLength = endValue.length;
       
  8420 
       
  8421     for (start = 0; start < startLength; start++) {
       
  8422       if (startValue[start] !== endValue[start]) {
       
  8423         break;
       
  8424       }
       
  8425     }
       
  8426 
       
  8427     var minEnd = startLength - start;
       
  8428 
       
  8429     for (end = 1; end <= minEnd; end++) {
       
  8430       if (startValue[startLength - end] !== endValue[endLength - end]) {
       
  8431         break;
       
  8432       }
       
  8433     }
       
  8434 
       
  8435     var sliceTail = end > 1 ? 1 - end : undefined;
       
  8436     fallbackText = endValue.slice(start, sliceTail);
       
  8437     return fallbackText;
       
  8438   }
       
  8439   function getText() {
       
  8440     if ('value' in root) {
       
  8441       return root.value;
       
  8442     }
       
  8443 
       
  8444     return root.textContent;
       
  8445   }
       
  8446 
       
  8447   var EVENT_POOL_SIZE = 10;
       
  8448   /**
       
  8449    * @interface Event
       
  8450    * @see http://www.w3.org/TR/DOM-Level-3-Events/
       
  8451    */
       
  8452 
       
  8453   var EventInterface = {
       
  8454     type: null,
       
  8455     target: null,
       
  8456     // currentTarget is set when dispatching; no use in copying it here
       
  8457     currentTarget: function () {
       
  8458       return null;
       
  8459     },
       
  8460     eventPhase: null,
       
  8461     bubbles: null,
       
  8462     cancelable: null,
       
  8463     timeStamp: function (event) {
       
  8464       return event.timeStamp || Date.now();
       
  8465     },
       
  8466     defaultPrevented: null,
       
  8467     isTrusted: null
       
  8468   };
       
  8469 
       
  8470   function functionThatReturnsTrue() {
       
  8471     return true;
       
  8472   }
       
  8473 
       
  8474   function functionThatReturnsFalse() {
       
  8475     return false;
       
  8476   }
       
  8477   /**
       
  8478    * Synthetic events are dispatched by event plugins, typically in response to a
       
  8479    * top-level event delegation handler.
       
  8480    *
       
  8481    * These systems should generally use pooling to reduce the frequency of garbage
       
  8482    * collection. The system should check `isPersistent` to determine whether the
       
  8483    * event should be released into the pool after being dispatched. Users that
       
  8484    * need a persisted event should invoke `persist`.
       
  8485    *
       
  8486    * Synthetic events (and subclasses) implement the DOM Level 3 Events API by
       
  8487    * normalizing browser quirks. Subclasses do not necessarily have to implement a
       
  8488    * DOM interface; custom application-specific events can also subclass this.
       
  8489    *
       
  8490    * @param {object} dispatchConfig Configuration used to dispatch this event.
       
  8491    * @param {*} targetInst Marker identifying the event target.
       
  8492    * @param {object} nativeEvent Native browser event.
       
  8493    * @param {DOMEventTarget} nativeEventTarget Target node.
       
  8494    */
       
  8495 
       
  8496 
       
  8497   function SyntheticEvent(dispatchConfig, targetInst, nativeEvent, nativeEventTarget) {
       
  8498     {
       
  8499       // these have a getter/setter for warnings
       
  8500       delete this.nativeEvent;
       
  8501       delete this.preventDefault;
       
  8502       delete this.stopPropagation;
       
  8503       delete this.isDefaultPrevented;
       
  8504       delete this.isPropagationStopped;
       
  8505     }
       
  8506 
       
  8507     this.dispatchConfig = dispatchConfig;
       
  8508     this._targetInst = targetInst;
       
  8509     this.nativeEvent = nativeEvent;
       
  8510     var Interface = this.constructor.Interface;
       
  8511 
       
  8512     for (var propName in Interface) {
       
  8513       if (!Interface.hasOwnProperty(propName)) {
       
  8514         continue;
       
  8515       }
       
  8516 
       
  8517       {
       
  8518         delete this[propName]; // this has a getter/setter for warnings
       
  8519       }
       
  8520 
       
  8521       var normalize = Interface[propName];
       
  8522 
       
  8523       if (normalize) {
       
  8524         this[propName] = normalize(nativeEvent);
       
  8525       } else {
       
  8526         if (propName === 'target') {
       
  8527           this.target = nativeEventTarget;
       
  8528         } else {
       
  8529           this[propName] = nativeEvent[propName];
       
  8530         }
       
  8531       }
       
  8532     }
       
  8533 
       
  8534     var defaultPrevented = nativeEvent.defaultPrevented != null ? nativeEvent.defaultPrevented : nativeEvent.returnValue === false;
       
  8535 
       
  8536     if (defaultPrevented) {
       
  8537       this.isDefaultPrevented = functionThatReturnsTrue;
       
  8538     } else {
       
  8539       this.isDefaultPrevented = functionThatReturnsFalse;
       
  8540     }
       
  8541 
       
  8542     this.isPropagationStopped = functionThatReturnsFalse;
       
  8543     return this;
       
  8544   }
       
  8545 
       
  8546   _assign(SyntheticEvent.prototype, {
       
  8547     preventDefault: function () {
       
  8548       this.defaultPrevented = true;
       
  8549       var event = this.nativeEvent;
       
  8550 
       
  8551       if (!event) {
       
  8552         return;
       
  8553       }
       
  8554 
       
  8555       if (event.preventDefault) {
       
  8556         event.preventDefault();
       
  8557       } else if (typeof event.returnValue !== 'unknown') {
       
  8558         event.returnValue = false;
       
  8559       }
       
  8560 
       
  8561       this.isDefaultPrevented = functionThatReturnsTrue;
       
  8562     },
       
  8563     stopPropagation: function () {
       
  8564       var event = this.nativeEvent;
       
  8565 
       
  8566       if (!event) {
       
  8567         return;
       
  8568       }
       
  8569 
       
  8570       if (event.stopPropagation) {
       
  8571         event.stopPropagation();
       
  8572       } else if (typeof event.cancelBubble !== 'unknown') {
       
  8573         // The ChangeEventPlugin registers a "propertychange" event for
       
  8574         // IE. This event does not support bubbling or cancelling, and
       
  8575         // any references to cancelBubble throw "Member not found".  A
       
  8576         // typeof check of "unknown" circumvents this issue (and is also
       
  8577         // IE specific).
       
  8578         event.cancelBubble = true;
       
  8579       }
       
  8580 
       
  8581       this.isPropagationStopped = functionThatReturnsTrue;
       
  8582     },
       
  8583 
       
  8584     /**
       
  8585      * We release all dispatched `SyntheticEvent`s after each event loop, adding
       
  8586      * them back into the pool. This allows a way to hold onto a reference that
       
  8587      * won't be added back into the pool.
       
  8588      */
       
  8589     persist: function () {
       
  8590       this.isPersistent = functionThatReturnsTrue;
       
  8591     },
       
  8592 
       
  8593     /**
       
  8594      * Checks if this event should be released back into the pool.
       
  8595      *
       
  8596      * @return {boolean} True if this should not be released, false otherwise.
       
  8597      */
       
  8598     isPersistent: functionThatReturnsFalse,
       
  8599 
       
  8600     /**
       
  8601      * `PooledClass` looks for `destructor` on each instance it releases.
       
  8602      */
       
  8603     destructor: function () {
       
  8604       var Interface = this.constructor.Interface;
       
  8605 
       
  8606       for (var propName in Interface) {
       
  8607         {
       
  8608           Object.defineProperty(this, propName, getPooledWarningPropertyDefinition(propName, Interface[propName]));
       
  8609         }
       
  8610       }
       
  8611 
       
  8612       this.dispatchConfig = null;
       
  8613       this._targetInst = null;
       
  8614       this.nativeEvent = null;
       
  8615       this.isDefaultPrevented = functionThatReturnsFalse;
       
  8616       this.isPropagationStopped = functionThatReturnsFalse;
       
  8617       this._dispatchListeners = null;
       
  8618       this._dispatchInstances = null;
       
  8619 
       
  8620       {
       
  8621         Object.defineProperty(this, 'nativeEvent', getPooledWarningPropertyDefinition('nativeEvent', null));
       
  8622         Object.defineProperty(this, 'isDefaultPrevented', getPooledWarningPropertyDefinition('isDefaultPrevented', functionThatReturnsFalse));
       
  8623         Object.defineProperty(this, 'isPropagationStopped', getPooledWarningPropertyDefinition('isPropagationStopped', functionThatReturnsFalse));
       
  8624         Object.defineProperty(this, 'preventDefault', getPooledWarningPropertyDefinition('preventDefault', function () {}));
       
  8625         Object.defineProperty(this, 'stopPropagation', getPooledWarningPropertyDefinition('stopPropagation', function () {}));
       
  8626       }
       
  8627     }
       
  8628   });
       
  8629 
       
  8630   SyntheticEvent.Interface = EventInterface;
       
  8631   /**
       
  8632    * Helper to reduce boilerplate when creating subclasses.
       
  8633    */
       
  8634 
       
  8635   SyntheticEvent.extend = function (Interface) {
       
  8636     var Super = this;
       
  8637 
       
  8638     var E = function () {};
       
  8639 
       
  8640     E.prototype = Super.prototype;
       
  8641     var prototype = new E();
       
  8642 
       
  8643     function Class() {
       
  8644       return Super.apply(this, arguments);
       
  8645     }
       
  8646 
       
  8647     _assign(prototype, Class.prototype);
       
  8648 
       
  8649     Class.prototype = prototype;
       
  8650     Class.prototype.constructor = Class;
       
  8651     Class.Interface = _assign({}, Super.Interface, Interface);
       
  8652     Class.extend = Super.extend;
       
  8653     addEventPoolingTo(Class);
       
  8654     return Class;
       
  8655   };
       
  8656 
       
  8657   addEventPoolingTo(SyntheticEvent);
       
  8658   /**
       
  8659    * Helper to nullify syntheticEvent instance properties when destructing
       
  8660    *
       
  8661    * @param {String} propName
       
  8662    * @param {?object} getVal
       
  8663    * @return {object} defineProperty object
       
  8664    */
       
  8665 
       
  8666   function getPooledWarningPropertyDefinition(propName, getVal) {
       
  8667     var isFunction = typeof getVal === 'function';
       
  8668     return {
       
  8669       configurable: true,
       
  8670       set: set,
       
  8671       get: get
       
  8672     };
       
  8673 
       
  8674     function set(val) {
       
  8675       var action = isFunction ? 'setting the method' : 'setting the property';
       
  8676       warn(action, 'This is effectively a no-op');
       
  8677       return val;
       
  8678     }
       
  8679 
       
  8680     function get() {
       
  8681       var action = isFunction ? 'accessing the method' : 'accessing the property';
       
  8682       var result = isFunction ? 'This is a no-op function' : 'This is set to null';
       
  8683       warn(action, result);
       
  8684       return getVal;
       
  8685     }
       
  8686 
       
  8687     function warn(action, result) {
       
  8688       {
       
  8689         error("This synthetic event is reused for performance reasons. If you're seeing this, " + "you're %s `%s` on a released/nullified synthetic event. %s. " + 'If you must keep the original synthetic event around, use event.persist(). ' + 'See https://fb.me/react-event-pooling for more information.', action, propName, result);
       
  8690       }
       
  8691     }
       
  8692   }
       
  8693 
       
  8694   function getPooledEvent(dispatchConfig, targetInst, nativeEvent, nativeInst) {
       
  8695     var EventConstructor = this;
       
  8696 
       
  8697     if (EventConstructor.eventPool.length) {
       
  8698       var instance = EventConstructor.eventPool.pop();
       
  8699       EventConstructor.call(instance, dispatchConfig, targetInst, nativeEvent, nativeInst);
       
  8700       return instance;
       
  8701     }
       
  8702 
       
  8703     return new EventConstructor(dispatchConfig, targetInst, nativeEvent, nativeInst);
       
  8704   }
       
  8705 
       
  8706   function releasePooledEvent(event) {
       
  8707     var EventConstructor = this;
       
  8708 
       
  8709     if (!(event instanceof EventConstructor)) {
       
  8710       {
       
  8711         throw Error( "Trying to release an event instance into a pool of a different type." );
       
  8712       }
       
  8713     }
       
  8714 
       
  8715     event.destructor();
       
  8716 
       
  8717     if (EventConstructor.eventPool.length < EVENT_POOL_SIZE) {
       
  8718       EventConstructor.eventPool.push(event);
       
  8719     }
       
  8720   }
       
  8721 
       
  8722   function addEventPoolingTo(EventConstructor) {
       
  8723     EventConstructor.eventPool = [];
       
  8724     EventConstructor.getPooled = getPooledEvent;
       
  8725     EventConstructor.release = releasePooledEvent;
       
  8726   }
       
  8727 
       
  8728   /**
       
  8729    * @interface Event
       
  8730    * @see http://www.w3.org/TR/DOM-Level-3-Events/#events-compositionevents
       
  8731    */
       
  8732 
       
  8733   var SyntheticCompositionEvent = SyntheticEvent.extend({
       
  8734     data: null
       
  8735   });
       
  8736 
       
  8737   /**
       
  8738    * @interface Event
       
  8739    * @see http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105
       
  8740    *      /#events-inputevents
       
  8741    */
       
  8742 
       
  8743   var SyntheticInputEvent = SyntheticEvent.extend({
       
  8744     data: null
       
  8745   });
       
  8746 
       
  8747   var END_KEYCODES = [9, 13, 27, 32]; // Tab, Return, Esc, Space
       
  8748 
       
  8749   var START_KEYCODE = 229;
       
  8750   var canUseCompositionEvent = canUseDOM && 'CompositionEvent' in window;
       
  8751   var documentMode = null;
       
  8752 
       
  8753   if (canUseDOM && 'documentMode' in document) {
       
  8754     documentMode = document.documentMode;
       
  8755   } // Webkit offers a very useful `textInput` event that can be used to
       
  8756   // directly represent `beforeInput`. The IE `textinput` event is not as
       
  8757   // useful, so we don't use it.
       
  8758 
       
  8759 
       
  8760   var canUseTextInputEvent = canUseDOM && 'TextEvent' in window && !documentMode; // In IE9+, we have access to composition events, but the data supplied
       
  8761   // by the native compositionend event may be incorrect. Japanese ideographic
       
  8762   // spaces, for instance (\u3000) are not recorded correctly.
       
  8763 
       
  8764   var useFallbackCompositionData = canUseDOM && (!canUseCompositionEvent || documentMode && documentMode > 8 && documentMode <= 11);
       
  8765   var SPACEBAR_CODE = 32;
       
  8766   var SPACEBAR_CHAR = String.fromCharCode(SPACEBAR_CODE); // Events and their corresponding property names.
       
  8767 
       
  8768   var eventTypes = {
       
  8769     beforeInput: {
       
  8770       phasedRegistrationNames: {
       
  8771         bubbled: 'onBeforeInput',
       
  8772         captured: 'onBeforeInputCapture'
       
  8773       },
       
  8774       dependencies: [TOP_COMPOSITION_END, TOP_KEY_PRESS, TOP_TEXT_INPUT, TOP_PASTE]
       
  8775     },
       
  8776     compositionEnd: {
       
  8777       phasedRegistrationNames: {
       
  8778         bubbled: 'onCompositionEnd',
       
  8779         captured: 'onCompositionEndCapture'
       
  8780       },
       
  8781       dependencies: [TOP_BLUR, TOP_COMPOSITION_END, TOP_KEY_DOWN, TOP_KEY_PRESS, TOP_KEY_UP, TOP_MOUSE_DOWN]
       
  8782     },
       
  8783     compositionStart: {
       
  8784       phasedRegistrationNames: {
       
  8785         bubbled: 'onCompositionStart',
       
  8786         captured: 'onCompositionStartCapture'
       
  8787       },
       
  8788       dependencies: [TOP_BLUR, TOP_COMPOSITION_START, TOP_KEY_DOWN, TOP_KEY_PRESS, TOP_KEY_UP, TOP_MOUSE_DOWN]
       
  8789     },
       
  8790     compositionUpdate: {
       
  8791       phasedRegistrationNames: {
       
  8792         bubbled: 'onCompositionUpdate',
       
  8793         captured: 'onCompositionUpdateCapture'
       
  8794       },
       
  8795       dependencies: [TOP_BLUR, TOP_COMPOSITION_UPDATE, TOP_KEY_DOWN, TOP_KEY_PRESS, TOP_KEY_UP, TOP_MOUSE_DOWN]
       
  8796     }
       
  8797   }; // Track whether we've ever handled a keypress on the space key.
       
  8798 
       
  8799   var hasSpaceKeypress = false;
       
  8800   /**
       
  8801    * Return whether a native keypress event is assumed to be a command.
       
  8802    * This is required because Firefox fires `keypress` events for key commands
       
  8803    * (cut, copy, select-all, etc.) even though no character is inserted.
       
  8804    */
       
  8805 
       
  8806   function isKeypressCommand(nativeEvent) {
       
  8807     return (nativeEvent.ctrlKey || nativeEvent.altKey || nativeEvent.metaKey) && // ctrlKey && altKey is equivalent to AltGr, and is not a command.
       
  8808     !(nativeEvent.ctrlKey && nativeEvent.altKey);
       
  8809   }
       
  8810   /**
       
  8811    * Translate native top level events into event types.
       
  8812    *
       
  8813    * @param {string} topLevelType
       
  8814    * @return {object}
       
  8815    */
       
  8816 
       
  8817 
       
  8818   function getCompositionEventType(topLevelType) {
       
  8819     switch (topLevelType) {
       
  8820       case TOP_COMPOSITION_START:
       
  8821         return eventTypes.compositionStart;
       
  8822 
       
  8823       case TOP_COMPOSITION_END:
       
  8824         return eventTypes.compositionEnd;
       
  8825 
       
  8826       case TOP_COMPOSITION_UPDATE:
       
  8827         return eventTypes.compositionUpdate;
       
  8828     }
       
  8829   }
       
  8830   /**
       
  8831    * Does our fallback best-guess model think this event signifies that
       
  8832    * composition has begun?
       
  8833    *
       
  8834    * @param {string} topLevelType
       
  8835    * @param {object} nativeEvent
       
  8836    * @return {boolean}
       
  8837    */
       
  8838 
       
  8839 
       
  8840   function isFallbackCompositionStart(topLevelType, nativeEvent) {
       
  8841     return topLevelType === TOP_KEY_DOWN && nativeEvent.keyCode === START_KEYCODE;
       
  8842   }
       
  8843   /**
       
  8844    * Does our fallback mode think that this event is the end of composition?
       
  8845    *
       
  8846    * @param {string} topLevelType
       
  8847    * @param {object} nativeEvent
       
  8848    * @return {boolean}
       
  8849    */
       
  8850 
       
  8851 
       
  8852   function isFallbackCompositionEnd(topLevelType, nativeEvent) {
       
  8853     switch (topLevelType) {
       
  8854       case TOP_KEY_UP:
       
  8855         // Command keys insert or clear IME input.
       
  8856         return END_KEYCODES.indexOf(nativeEvent.keyCode) !== -1;
       
  8857 
       
  8858       case TOP_KEY_DOWN:
       
  8859         // Expect IME keyCode on each keydown. If we get any other
       
  8860         // code we must have exited earlier.
       
  8861         return nativeEvent.keyCode !== START_KEYCODE;
       
  8862 
       
  8863       case TOP_KEY_PRESS:
       
  8864       case TOP_MOUSE_DOWN:
       
  8865       case TOP_BLUR:
       
  8866         // Events are not possible without cancelling IME.
       
  8867         return true;
       
  8868 
       
  8869       default:
       
  8870         return false;
       
  8871     }
       
  8872   }
       
  8873   /**
       
  8874    * Google Input Tools provides composition data via a CustomEvent,
       
  8875    * with the `data` property populated in the `detail` object. If this
       
  8876    * is available on the event object, use it. If not, this is a plain
       
  8877    * composition event and we have nothing special to extract.
       
  8878    *
       
  8879    * @param {object} nativeEvent
       
  8880    * @return {?string}
       
  8881    */
       
  8882 
       
  8883 
       
  8884   function getDataFromCustomEvent(nativeEvent) {
       
  8885     var detail = nativeEvent.detail;
       
  8886 
       
  8887     if (typeof detail === 'object' && 'data' in detail) {
       
  8888       return detail.data;
       
  8889     }
       
  8890 
       
  8891     return null;
       
  8892   }
       
  8893   /**
       
  8894    * Check if a composition event was triggered by Korean IME.
       
  8895    * Our fallback mode does not work well with IE's Korean IME,
       
  8896    * so just use native composition events when Korean IME is used.
       
  8897    * Although CompositionEvent.locale property is deprecated,
       
  8898    * it is available in IE, where our fallback mode is enabled.
       
  8899    *
       
  8900    * @param {object} nativeEvent
       
  8901    * @return {boolean}
       
  8902    */
       
  8903 
       
  8904 
       
  8905   function isUsingKoreanIME(nativeEvent) {
       
  8906     return nativeEvent.locale === 'ko';
       
  8907   } // Track the current IME composition status, if any.
       
  8908 
       
  8909 
       
  8910   var isComposing = false;
       
  8911   /**
       
  8912    * @return {?object} A SyntheticCompositionEvent.
       
  8913    */
       
  8914 
       
  8915   function extractCompositionEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget) {
       
  8916     var eventType;
       
  8917     var fallbackData;
       
  8918 
       
  8919     if (canUseCompositionEvent) {
       
  8920       eventType = getCompositionEventType(topLevelType);
       
  8921     } else if (!isComposing) {
       
  8922       if (isFallbackCompositionStart(topLevelType, nativeEvent)) {
       
  8923         eventType = eventTypes.compositionStart;
       
  8924       }
       
  8925     } else if (isFallbackCompositionEnd(topLevelType, nativeEvent)) {
       
  8926       eventType = eventTypes.compositionEnd;
       
  8927     }
       
  8928 
       
  8929     if (!eventType) {
       
  8930       return null;
       
  8931     }
       
  8932 
       
  8933     if (useFallbackCompositionData && !isUsingKoreanIME(nativeEvent)) {
       
  8934       // The current composition is stored statically and must not be
       
  8935       // overwritten while composition continues.
       
  8936       if (!isComposing && eventType === eventTypes.compositionStart) {
       
  8937         isComposing = initialize(nativeEventTarget);
       
  8938       } else if (eventType === eventTypes.compositionEnd) {
       
  8939         if (isComposing) {
       
  8940           fallbackData = getData();
       
  8941         }
       
  8942       }
       
  8943     }
       
  8944 
       
  8945     var event = SyntheticCompositionEvent.getPooled(eventType, targetInst, nativeEvent, nativeEventTarget);
       
  8946 
       
  8947     if (fallbackData) {
       
  8948       // Inject data generated from fallback path into the synthetic event.
       
  8949       // This matches the property of native CompositionEventInterface.
       
  8950       event.data = fallbackData;
       
  8951     } else {
       
  8952       var customData = getDataFromCustomEvent(nativeEvent);
       
  8953 
       
  8954       if (customData !== null) {
       
  8955         event.data = customData;
       
  8956       }
       
  8957     }
       
  8958 
       
  8959     accumulateTwoPhaseDispatches(event);
       
  8960     return event;
       
  8961   }
       
  8962   /**
       
  8963    * @param {TopLevelType} topLevelType Number from `TopLevelType`.
       
  8964    * @param {object} nativeEvent Native browser event.
       
  8965    * @return {?string} The string corresponding to this `beforeInput` event.
       
  8966    */
       
  8967 
       
  8968 
       
  8969   function getNativeBeforeInputChars(topLevelType, nativeEvent) {
       
  8970     switch (topLevelType) {
       
  8971       case TOP_COMPOSITION_END:
       
  8972         return getDataFromCustomEvent(nativeEvent);
       
  8973 
       
  8974       case TOP_KEY_PRESS:
       
  8975         /**
       
  8976          * If native `textInput` events are available, our goal is to make
       
  8977          * use of them. However, there is a special case: the spacebar key.
       
  8978          * In Webkit, preventing default on a spacebar `textInput` event
       
  8979          * cancels character insertion, but it *also* causes the browser
       
  8980          * to fall back to its default spacebar behavior of scrolling the
       
  8981          * page.
       
  8982          *
       
  8983          * Tracking at:
       
  8984          * https://code.google.com/p/chromium/issues/detail?id=355103
       
  8985          *
       
  8986          * To avoid this issue, use the keypress event as if no `textInput`
       
  8987          * event is available.
       
  8988          */
       
  8989         var which = nativeEvent.which;
       
  8990 
       
  8991         if (which !== SPACEBAR_CODE) {
       
  8992           return null;
       
  8993         }
       
  8994 
       
  8995         hasSpaceKeypress = true;
       
  8996         return SPACEBAR_CHAR;
       
  8997 
       
  8998       case TOP_TEXT_INPUT:
       
  8999         // Record the characters to be added to the DOM.
       
  9000         var chars = nativeEvent.data; // If it's a spacebar character, assume that we have already handled
       
  9001         // it at the keypress level and bail immediately. Android Chrome
       
  9002         // doesn't give us keycodes, so we need to ignore it.
       
  9003 
       
  9004         if (chars === SPACEBAR_CHAR && hasSpaceKeypress) {
       
  9005           return null;
       
  9006         }
       
  9007 
       
  9008         return chars;
       
  9009 
       
  9010       default:
       
  9011         // For other native event types, do nothing.
       
  9012         return null;
       
  9013     }
       
  9014   }
       
  9015   /**
       
  9016    * For browsers that do not provide the `textInput` event, extract the
       
  9017    * appropriate string to use for SyntheticInputEvent.
       
  9018    *
       
  9019    * @param {number} topLevelType Number from `TopLevelEventTypes`.
       
  9020    * @param {object} nativeEvent Native browser event.
       
  9021    * @return {?string} The fallback string for this `beforeInput` event.
       
  9022    */
       
  9023 
       
  9024 
       
  9025   function getFallbackBeforeInputChars(topLevelType, nativeEvent) {
       
  9026     // If we are currently composing (IME) and using a fallback to do so,
       
  9027     // try to extract the composed characters from the fallback object.
       
  9028     // If composition event is available, we extract a string only at
       
  9029     // compositionevent, otherwise extract it at fallback events.
       
  9030     if (isComposing) {
       
  9031       if (topLevelType === TOP_COMPOSITION_END || !canUseCompositionEvent && isFallbackCompositionEnd(topLevelType, nativeEvent)) {
       
  9032         var chars = getData();
       
  9033         reset();
       
  9034         isComposing = false;
       
  9035         return chars;
       
  9036       }
       
  9037 
       
  9038       return null;
       
  9039     }
       
  9040 
       
  9041     switch (topLevelType) {
       
  9042       case TOP_PASTE:
       
  9043         // If a paste event occurs after a keypress, throw out the input
       
  9044         // chars. Paste events should not lead to BeforeInput events.
       
  9045         return null;
       
  9046 
       
  9047       case TOP_KEY_PRESS:
       
  9048         /**
       
  9049          * As of v27, Firefox may fire keypress events even when no character
       
  9050          * will be inserted. A few possibilities:
       
  9051          *
       
  9052          * - `which` is `0`. Arrow keys, Esc key, etc.
       
  9053          *
       
  9054          * - `which` is the pressed key code, but no char is available.
       
  9055          *   Ex: 'AltGr + d` in Polish. There is no modified character for
       
  9056          *   this key combination and no character is inserted into the
       
  9057          *   document, but FF fires the keypress for char code `100` anyway.
       
  9058          *   No `input` event will occur.
       
  9059          *
       
  9060          * - `which` is the pressed key code, but a command combination is
       
  9061          *   being used. Ex: `Cmd+C`. No character is inserted, and no
       
  9062          *   `input` event will occur.
       
  9063          */
       
  9064         if (!isKeypressCommand(nativeEvent)) {
       
  9065           // IE fires the `keypress` event when a user types an emoji via
       
  9066           // Touch keyboard of Windows.  In such a case, the `char` property
       
  9067           // holds an emoji character like `\uD83D\uDE0A`.  Because its length
       
  9068           // is 2, the property `which` does not represent an emoji correctly.
       
  9069           // In such a case, we directly return the `char` property instead of
       
  9070           // using `which`.
       
  9071           if (nativeEvent.char && nativeEvent.char.length > 1) {
       
  9072             return nativeEvent.char;
       
  9073           } else if (nativeEvent.which) {
       
  9074             return String.fromCharCode(nativeEvent.which);
       
  9075           }
       
  9076         }
       
  9077 
       
  9078         return null;
       
  9079 
       
  9080       case TOP_COMPOSITION_END:
       
  9081         return useFallbackCompositionData && !isUsingKoreanIME(nativeEvent) ? null : nativeEvent.data;
       
  9082 
       
  9083       default:
       
  9084         return null;
       
  9085     }
       
  9086   }
       
  9087   /**
       
  9088    * Extract a SyntheticInputEvent for `beforeInput`, based on either native
       
  9089    * `textInput` or fallback behavior.
       
  9090    *
       
  9091    * @return {?object} A SyntheticInputEvent.
       
  9092    */
       
  9093 
       
  9094 
       
  9095   function extractBeforeInputEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget) {
       
  9096     var chars;
       
  9097 
       
  9098     if (canUseTextInputEvent) {
       
  9099       chars = getNativeBeforeInputChars(topLevelType, nativeEvent);
       
  9100     } else {
       
  9101       chars = getFallbackBeforeInputChars(topLevelType, nativeEvent);
       
  9102     } // If no characters are being inserted, no BeforeInput event should
       
  9103     // be fired.
       
  9104 
       
  9105 
       
  9106     if (!chars) {
       
  9107       return null;
       
  9108     }
       
  9109 
       
  9110     var event = SyntheticInputEvent.getPooled(eventTypes.beforeInput, targetInst, nativeEvent, nativeEventTarget);
       
  9111     event.data = chars;
       
  9112     accumulateTwoPhaseDispatches(event);
       
  9113     return event;
       
  9114   }
       
  9115   /**
       
  9116    * Create an `onBeforeInput` event to match
       
  9117    * http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105/#events-inputevents.
       
  9118    *
       
  9119    * This event plugin is based on the native `textInput` event
       
  9120    * available in Chrome, Safari, Opera, and IE. This event fires after
       
  9121    * `onKeyPress` and `onCompositionEnd`, but before `onInput`.
       
  9122    *
       
  9123    * `beforeInput` is spec'd but not implemented in any browsers, and
       
  9124    * the `input` event does not provide any useful information about what has
       
  9125    * actually been added, contrary to the spec. Thus, `textInput` is the best
       
  9126    * available event to identify the characters that have actually been inserted
       
  9127    * into the target node.
       
  9128    *
       
  9129    * This plugin is also responsible for emitting `composition` events, thus
       
  9130    * allowing us to share composition fallback code for both `beforeInput` and
       
  9131    * `composition` event types.
       
  9132    */
       
  9133 
       
  9134 
       
  9135   var BeforeInputEventPlugin = {
       
  9136     eventTypes: eventTypes,
       
  9137     extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget, eventSystemFlags) {
       
  9138       var composition = extractCompositionEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget);
       
  9139       var beforeInput = extractBeforeInputEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget);
       
  9140 
       
  9141       if (composition === null) {
       
  9142         return beforeInput;
       
  9143       }
       
  9144 
       
  9145       if (beforeInput === null) {
       
  9146         return composition;
       
  9147       }
       
  9148 
       
  9149       return [composition, beforeInput];
       
  9150     }
       
  9151   };
       
  9152 
       
  9153   /**
       
  9154    * @see http://www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary
       
  9155    */
       
  9156   var supportedInputTypes = {
       
  9157     color: true,
       
  9158     date: true,
       
  9159     datetime: true,
       
  9160     'datetime-local': true,
       
  9161     email: true,
       
  9162     month: true,
       
  9163     number: true,
       
  9164     password: true,
       
  9165     range: true,
       
  9166     search: true,
       
  9167     tel: true,
       
  9168     text: true,
       
  9169     time: true,
       
  9170     url: true,
       
  9171     week: true
       
  9172   };
       
  9173 
       
  9174   function isTextInputElement(elem) {
       
  9175     var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase();
       
  9176 
       
  9177     if (nodeName === 'input') {
       
  9178       return !!supportedInputTypes[elem.type];
       
  9179     }
       
  9180 
       
  9181     if (nodeName === 'textarea') {
       
  9182       return true;
       
  9183     }
       
  9184 
       
  9185     return false;
       
  9186   }
       
  9187 
       
  9188   var eventTypes$1 = {
       
  9189     change: {
       
  9190       phasedRegistrationNames: {
       
  9191         bubbled: 'onChange',
       
  9192         captured: 'onChangeCapture'
       
  9193       },
       
  9194       dependencies: [TOP_BLUR, TOP_CHANGE, TOP_CLICK, TOP_FOCUS, TOP_INPUT, TOP_KEY_DOWN, TOP_KEY_UP, TOP_SELECTION_CHANGE]
       
  9195     }
       
  9196   };
       
  9197 
       
  9198   function createAndAccumulateChangeEvent(inst, nativeEvent, target) {
       
  9199     var event = SyntheticEvent.getPooled(eventTypes$1.change, inst, nativeEvent, target);
       
  9200     event.type = 'change'; // Flag this event loop as needing state restore.
       
  9201 
       
  9202     enqueueStateRestore(target);
       
  9203     accumulateTwoPhaseDispatches(event);
       
  9204     return event;
       
  9205   }
       
  9206   /**
       
  9207    * For IE shims
       
  9208    */
       
  9209 
       
  9210 
       
  9211   var activeElement = null;
       
  9212   var activeElementInst = null;
       
  9213   /**
       
  9214    * SECTION: handle `change` event
       
  9215    */
       
  9216 
       
  9217   function shouldUseChangeEvent(elem) {
       
  9218     var nodeName = elem.nodeName && elem.nodeName.toLowerCase();
       
  9219     return nodeName === 'select' || nodeName === 'input' && elem.type === 'file';
       
  9220   }
       
  9221 
       
  9222   function manualDispatchChangeEvent(nativeEvent) {
       
  9223     var event = createAndAccumulateChangeEvent(activeElementInst, nativeEvent, getEventTarget(nativeEvent)); // If change and propertychange bubbled, we'd just bind to it like all the
       
  9224     // other events and have it go through ReactBrowserEventEmitter. Since it
       
  9225     // doesn't, we manually listen for the events and so we have to enqueue and
       
  9226     // process the abstract event manually.
       
  9227     //
       
  9228     // Batching is necessary here in order to ensure that all event handlers run
       
  9229     // before the next rerender (including event handlers attached to ancestor
       
  9230     // elements instead of directly on the input). Without this, controlled
       
  9231     // components don't work properly in conjunction with event bubbling because
       
  9232     // the component is rerendered and the value reverted before all the event
       
  9233     // handlers can run. See https://github.com/facebook/react/issues/708.
       
  9234 
       
  9235     batchedUpdates(runEventInBatch, event);
       
  9236   }
       
  9237 
       
  9238   function runEventInBatch(event) {
       
  9239     runEventsInBatch(event);
       
  9240   }
       
  9241 
       
  9242   function getInstIfValueChanged(targetInst) {
       
  9243     var targetNode = getNodeFromInstance$1(targetInst);
       
  9244 
       
  9245     if (updateValueIfChanged(targetNode)) {
       
  9246       return targetInst;
       
  9247     }
       
  9248   }
       
  9249 
       
  9250   function getTargetInstForChangeEvent(topLevelType, targetInst) {
       
  9251     if (topLevelType === TOP_CHANGE) {
       
  9252       return targetInst;
       
  9253     }
       
  9254   }
       
  9255   /**
       
  9256    * SECTION: handle `input` event
       
  9257    */
       
  9258 
       
  9259 
       
  9260   var isInputEventSupported = false;
       
  9261 
       
  9262   if (canUseDOM) {
       
  9263     // IE9 claims to support the input event but fails to trigger it when
       
  9264     // deleting text, so we ignore its input events.
       
  9265     isInputEventSupported = isEventSupported('input') && (!document.documentMode || document.documentMode > 9);
       
  9266   }
       
  9267   /**
       
  9268    * (For IE <=9) Starts tracking propertychange events on the passed-in element
       
  9269    * and override the value property so that we can distinguish user events from
       
  9270    * value changes in JS.
       
  9271    */
       
  9272 
       
  9273 
       
  9274   function startWatchingForValueChange(target, targetInst) {
       
  9275     activeElement = target;
       
  9276     activeElementInst = targetInst;
       
  9277     activeElement.attachEvent('onpropertychange', handlePropertyChange);
       
  9278   }
       
  9279   /**
       
  9280    * (For IE <=9) Removes the event listeners from the currently-tracked element,
       
  9281    * if any exists.
       
  9282    */
       
  9283 
       
  9284 
       
  9285   function stopWatchingForValueChange() {
       
  9286     if (!activeElement) {
       
  9287       return;
       
  9288     }
       
  9289 
       
  9290     activeElement.detachEvent('onpropertychange', handlePropertyChange);
       
  9291     activeElement = null;
       
  9292     activeElementInst = null;
       
  9293   }
       
  9294   /**
       
  9295    * (For IE <=9) Handles a propertychange event, sending a `change` event if
       
  9296    * the value of the active element has changed.
       
  9297    */
       
  9298 
       
  9299 
       
  9300   function handlePropertyChange(nativeEvent) {
       
  9301     if (nativeEvent.propertyName !== 'value') {
       
  9302       return;
       
  9303     }
       
  9304 
       
  9305     if (getInstIfValueChanged(activeElementInst)) {
       
  9306       manualDispatchChangeEvent(nativeEvent);
       
  9307     }
       
  9308   }
       
  9309 
       
  9310   function handleEventsForInputEventPolyfill(topLevelType, target, targetInst) {
       
  9311     if (topLevelType === TOP_FOCUS) {
       
  9312       // In IE9, propertychange fires for most input events but is buggy and
       
  9313       // doesn't fire when text is deleted, but conveniently, selectionchange
       
  9314       // appears to fire in all of the remaining cases so we catch those and
       
  9315       // forward the event if the value has changed
       
  9316       // In either case, we don't want to call the event handler if the value
       
  9317       // is changed from JS so we redefine a setter for `.value` that updates
       
  9318       // our activeElementValue variable, allowing us to ignore those changes
       
  9319       //
       
  9320       // stopWatching() should be a noop here but we call it just in case we
       
  9321       // missed a blur event somehow.
       
  9322       stopWatchingForValueChange();
       
  9323       startWatchingForValueChange(target, targetInst);
       
  9324     } else if (topLevelType === TOP_BLUR) {
       
  9325       stopWatchingForValueChange();
       
  9326     }
       
  9327   } // For IE8 and IE9.
       
  9328 
       
  9329 
       
  9330   function getTargetInstForInputEventPolyfill(topLevelType, targetInst) {
       
  9331     if (topLevelType === TOP_SELECTION_CHANGE || topLevelType === TOP_KEY_UP || topLevelType === TOP_KEY_DOWN) {
       
  9332       // On the selectionchange event, the target is just document which isn't
       
  9333       // helpful for us so just check activeElement instead.
       
  9334       //
       
  9335       // 99% of the time, keydown and keyup aren't necessary. IE8 fails to fire
       
  9336       // propertychange on the first input event after setting `value` from a
       
  9337       // script and fires only keydown, keypress, keyup. Catching keyup usually
       
  9338       // gets it and catching keydown lets us fire an event for the first
       
  9339       // keystroke if user does a key repeat (it'll be a little delayed: right
       
  9340       // before the second keystroke). Other input methods (e.g., paste) seem to
       
  9341       // fire selectionchange normally.
       
  9342       return getInstIfValueChanged(activeElementInst);
       
  9343     }
       
  9344   }
       
  9345   /**
       
  9346    * SECTION: handle `click` event
       
  9347    */
       
  9348 
       
  9349 
       
  9350   function shouldUseClickEvent(elem) {
       
  9351     // Use the `click` event to detect changes to checkbox and radio inputs.
       
  9352     // This approach works across all browsers, whereas `change` does not fire
       
  9353     // until `blur` in IE8.
       
  9354     var nodeName = elem.nodeName;
       
  9355     return nodeName && nodeName.toLowerCase() === 'input' && (elem.type === 'checkbox' || elem.type === 'radio');
       
  9356   }
       
  9357 
       
  9358   function getTargetInstForClickEvent(topLevelType, targetInst) {
       
  9359     if (topLevelType === TOP_CLICK) {
       
  9360       return getInstIfValueChanged(targetInst);
       
  9361     }
       
  9362   }
       
  9363 
       
  9364   function getTargetInstForInputOrChangeEvent(topLevelType, targetInst) {
       
  9365     if (topLevelType === TOP_INPUT || topLevelType === TOP_CHANGE) {
       
  9366       return getInstIfValueChanged(targetInst);
       
  9367     }
       
  9368   }
       
  9369 
       
  9370   function handleControlledInputBlur(node) {
       
  9371     var state = node._wrapperState;
       
  9372 
       
  9373     if (!state || !state.controlled || node.type !== 'number') {
       
  9374       return;
       
  9375     }
       
  9376 
       
  9377     {
       
  9378       // If controlled, assign the value attribute to the current value on blur
       
  9379       setDefaultValue(node, 'number', node.value);
       
  9380     }
       
  9381   }
       
  9382   /**
       
  9383    * This plugin creates an `onChange` event that normalizes change events
       
  9384    * across form elements. This event fires at a time when it's possible to
       
  9385    * change the element's value without seeing a flicker.
       
  9386    *
       
  9387    * Supported elements are:
       
  9388    * - input (see `isTextInputElement`)
       
  9389    * - textarea
       
  9390    * - select
       
  9391    */
       
  9392 
       
  9393 
       
  9394   var ChangeEventPlugin = {
       
  9395     eventTypes: eventTypes$1,
       
  9396     _isInputEventSupported: isInputEventSupported,
       
  9397     extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget, eventSystemFlags) {
       
  9398       var targetNode = targetInst ? getNodeFromInstance$1(targetInst) : window;
       
  9399       var getTargetInstFunc, handleEventFunc;
       
  9400 
       
  9401       if (shouldUseChangeEvent(targetNode)) {
       
  9402         getTargetInstFunc = getTargetInstForChangeEvent;
       
  9403       } else if (isTextInputElement(targetNode)) {
       
  9404         if (isInputEventSupported) {
       
  9405           getTargetInstFunc = getTargetInstForInputOrChangeEvent;
       
  9406         } else {
       
  9407           getTargetInstFunc = getTargetInstForInputEventPolyfill;
       
  9408           handleEventFunc = handleEventsForInputEventPolyfill;
       
  9409         }
       
  9410       } else if (shouldUseClickEvent(targetNode)) {
       
  9411         getTargetInstFunc = getTargetInstForClickEvent;
       
  9412       }
       
  9413 
       
  9414       if (getTargetInstFunc) {
       
  9415         var inst = getTargetInstFunc(topLevelType, targetInst);
       
  9416 
       
  9417         if (inst) {
       
  9418           var event = createAndAccumulateChangeEvent(inst, nativeEvent, nativeEventTarget);
       
  9419           return event;
       
  9420         }
       
  9421       }
       
  9422 
       
  9423       if (handleEventFunc) {
       
  9424         handleEventFunc(topLevelType, targetNode, targetInst);
       
  9425       } // When blurring, set the value attribute for number inputs
       
  9426 
       
  9427 
       
  9428       if (topLevelType === TOP_BLUR) {
       
  9429         handleControlledInputBlur(targetNode);
       
  9430       }
       
  9431     }
       
  9432   };
       
  9433 
       
  9434   var SyntheticUIEvent = SyntheticEvent.extend({
       
  9435     view: null,
       
  9436     detail: null
       
  9437   });
       
  9438 
       
  9439   /**
       
  9440    * Translation from modifier key to the associated property in the event.
       
  9441    * @see http://www.w3.org/TR/DOM-Level-3-Events/#keys-Modifiers
       
  9442    */
       
  9443   var modifierKeyToProp = {
       
  9444     Alt: 'altKey',
       
  9445     Control: 'ctrlKey',
       
  9446     Meta: 'metaKey',
       
  9447     Shift: 'shiftKey'
       
  9448   }; // Older browsers (Safari <= 10, iOS Safari <= 10.2) do not support
       
  9449   // getModifierState. If getModifierState is not supported, we map it to a set of
       
  9450   // modifier keys exposed by the event. In this case, Lock-keys are not supported.
       
  9451 
       
  9452   function modifierStateGetter(keyArg) {
       
  9453     var syntheticEvent = this;
       
  9454     var nativeEvent = syntheticEvent.nativeEvent;
       
  9455 
       
  9456     if (nativeEvent.getModifierState) {
       
  9457       return nativeEvent.getModifierState(keyArg);
       
  9458     }
       
  9459 
       
  9460     var keyProp = modifierKeyToProp[keyArg];
       
  9461     return keyProp ? !!nativeEvent[keyProp] : false;
       
  9462   }
       
  9463 
       
  9464   function getEventModifierState(nativeEvent) {
       
  9465     return modifierStateGetter;
       
  9466   }
       
  9467 
       
  9468   var previousScreenX = 0;
       
  9469   var previousScreenY = 0; // Use flags to signal movementX/Y has already been set
       
  9470 
       
  9471   var isMovementXSet = false;
       
  9472   var isMovementYSet = false;
       
  9473   /**
       
  9474    * @interface MouseEvent
       
  9475    * @see http://www.w3.org/TR/DOM-Level-3-Events/
       
  9476    */
       
  9477 
       
  9478   var SyntheticMouseEvent = SyntheticUIEvent.extend({
       
  9479     screenX: null,
       
  9480     screenY: null,
       
  9481     clientX: null,
       
  9482     clientY: null,
       
  9483     pageX: null,
       
  9484     pageY: null,
       
  9485     ctrlKey: null,
       
  9486     shiftKey: null,
       
  9487     altKey: null,
       
  9488     metaKey: null,
       
  9489     getModifierState: getEventModifierState,
       
  9490     button: null,
       
  9491     buttons: null,
       
  9492     relatedTarget: function (event) {
       
  9493       return event.relatedTarget || (event.fromElement === event.srcElement ? event.toElement : event.fromElement);
       
  9494     },
       
  9495     movementX: function (event) {
       
  9496       if ('movementX' in event) {
       
  9497         return event.movementX;
       
  9498       }
       
  9499 
       
  9500       var screenX = previousScreenX;
       
  9501       previousScreenX = event.screenX;
       
  9502 
       
  9503       if (!isMovementXSet) {
       
  9504         isMovementXSet = true;
       
  9505         return 0;
       
  9506       }
       
  9507 
       
  9508       return event.type === 'mousemove' ? event.screenX - screenX : 0;
       
  9509     },
       
  9510     movementY: function (event) {
       
  9511       if ('movementY' in event) {
       
  9512         return event.movementY;
       
  9513       }
       
  9514 
       
  9515       var screenY = previousScreenY;
       
  9516       previousScreenY = event.screenY;
       
  9517 
       
  9518       if (!isMovementYSet) {
       
  9519         isMovementYSet = true;
       
  9520         return 0;
       
  9521       }
       
  9522 
       
  9523       return event.type === 'mousemove' ? event.screenY - screenY : 0;
       
  9524     }
       
  9525   });
       
  9526 
       
  9527   /**
       
  9528    * @interface PointerEvent
       
  9529    * @see http://www.w3.org/TR/pointerevents/
       
  9530    */
       
  9531 
       
  9532   var SyntheticPointerEvent = SyntheticMouseEvent.extend({
       
  9533     pointerId: null,
       
  9534     width: null,
       
  9535     height: null,
       
  9536     pressure: null,
       
  9537     tangentialPressure: null,
       
  9538     tiltX: null,
       
  9539     tiltY: null,
       
  9540     twist: null,
       
  9541     pointerType: null,
       
  9542     isPrimary: null
       
  9543   });
       
  9544 
       
  9545   var eventTypes$2 = {
       
  9546     mouseEnter: {
       
  9547       registrationName: 'onMouseEnter',
       
  9548       dependencies: [TOP_MOUSE_OUT, TOP_MOUSE_OVER]
       
  9549     },
       
  9550     mouseLeave: {
       
  9551       registrationName: 'onMouseLeave',
       
  9552       dependencies: [TOP_MOUSE_OUT, TOP_MOUSE_OVER]
       
  9553     },
       
  9554     pointerEnter: {
       
  9555       registrationName: 'onPointerEnter',
       
  9556       dependencies: [TOP_POINTER_OUT, TOP_POINTER_OVER]
       
  9557     },
       
  9558     pointerLeave: {
       
  9559       registrationName: 'onPointerLeave',
       
  9560       dependencies: [TOP_POINTER_OUT, TOP_POINTER_OVER]
       
  9561     }
       
  9562   };
       
  9563   var EnterLeaveEventPlugin = {
       
  9564     eventTypes: eventTypes$2,
       
  9565 
       
  9566     /**
       
  9567      * For almost every interaction we care about, there will be both a top-level
       
  9568      * `mouseover` and `mouseout` event that occurs. Only use `mouseout` so that
       
  9569      * we do not extract duplicate events. However, moving the mouse into the
       
  9570      * browser from outside will not fire a `mouseout` event. In this case, we use
       
  9571      * the `mouseover` top-level event.
       
  9572      */
       
  9573     extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget, eventSystemFlags) {
       
  9574       var isOverEvent = topLevelType === TOP_MOUSE_OVER || topLevelType === TOP_POINTER_OVER;
       
  9575       var isOutEvent = topLevelType === TOP_MOUSE_OUT || topLevelType === TOP_POINTER_OUT;
       
  9576 
       
  9577       if (isOverEvent && (eventSystemFlags & IS_REPLAYED) === 0 && (nativeEvent.relatedTarget || nativeEvent.fromElement)) {
       
  9578         // If this is an over event with a target, then we've already dispatched
       
  9579         // the event in the out event of the other target. If this is replayed,
       
  9580         // then it's because we couldn't dispatch against this target previously
       
  9581         // so we have to do it now instead.
       
  9582         return null;
       
  9583       }
       
  9584 
       
  9585       if (!isOutEvent && !isOverEvent) {
       
  9586         // Must not be a mouse or pointer in or out - ignoring.
       
  9587         return null;
       
  9588       }
       
  9589 
       
  9590       var win;
       
  9591 
       
  9592       if (nativeEventTarget.window === nativeEventTarget) {
       
  9593         // `nativeEventTarget` is probably a window object.
       
  9594         win = nativeEventTarget;
       
  9595       } else {
       
  9596         // TODO: Figure out why `ownerDocument` is sometimes undefined in IE8.
       
  9597         var doc = nativeEventTarget.ownerDocument;
       
  9598 
       
  9599         if (doc) {
       
  9600           win = doc.defaultView || doc.parentWindow;
       
  9601         } else {
       
  9602           win = window;
       
  9603         }
       
  9604       }
       
  9605 
       
  9606       var from;
       
  9607       var to;
       
  9608 
       
  9609       if (isOutEvent) {
       
  9610         from = targetInst;
       
  9611         var related = nativeEvent.relatedTarget || nativeEvent.toElement;
       
  9612         to = related ? getClosestInstanceFromNode(related) : null;
       
  9613 
       
  9614         if (to !== null) {
       
  9615           var nearestMounted = getNearestMountedFiber(to);
       
  9616 
       
  9617           if (to !== nearestMounted || to.tag !== HostComponent && to.tag !== HostText) {
       
  9618             to = null;
       
  9619           }
       
  9620         }
       
  9621       } else {
       
  9622         // Moving to a node from outside the window.
       
  9623         from = null;
       
  9624         to = targetInst;
       
  9625       }
       
  9626 
       
  9627       if (from === to) {
       
  9628         // Nothing pertains to our managed components.
       
  9629         return null;
       
  9630       }
       
  9631 
       
  9632       var eventInterface, leaveEventType, enterEventType, eventTypePrefix;
       
  9633 
       
  9634       if (topLevelType === TOP_MOUSE_OUT || topLevelType === TOP_MOUSE_OVER) {
       
  9635         eventInterface = SyntheticMouseEvent;
       
  9636         leaveEventType = eventTypes$2.mouseLeave;
       
  9637         enterEventType = eventTypes$2.mouseEnter;
       
  9638         eventTypePrefix = 'mouse';
       
  9639       } else if (topLevelType === TOP_POINTER_OUT || topLevelType === TOP_POINTER_OVER) {
       
  9640         eventInterface = SyntheticPointerEvent;
       
  9641         leaveEventType = eventTypes$2.pointerLeave;
       
  9642         enterEventType = eventTypes$2.pointerEnter;
       
  9643         eventTypePrefix = 'pointer';
       
  9644       }
       
  9645 
       
  9646       var fromNode = from == null ? win : getNodeFromInstance$1(from);
       
  9647       var toNode = to == null ? win : getNodeFromInstance$1(to);
       
  9648       var leave = eventInterface.getPooled(leaveEventType, from, nativeEvent, nativeEventTarget);
       
  9649       leave.type = eventTypePrefix + 'leave';
       
  9650       leave.target = fromNode;
       
  9651       leave.relatedTarget = toNode;
       
  9652       var enter = eventInterface.getPooled(enterEventType, to, nativeEvent, nativeEventTarget);
       
  9653       enter.type = eventTypePrefix + 'enter';
       
  9654       enter.target = toNode;
       
  9655       enter.relatedTarget = fromNode;
       
  9656       accumulateEnterLeaveDispatches(leave, enter, from, to); // If we are not processing the first ancestor, then we
       
  9657       // should not process the same nativeEvent again, as we
       
  9658       // will have already processed it in the first ancestor.
       
  9659 
       
  9660       if ((eventSystemFlags & IS_FIRST_ANCESTOR) === 0) {
       
  9661         return [leave];
       
  9662       }
       
  9663 
       
  9664       return [leave, enter];
       
  9665     }
       
  9666   };
       
  9667 
       
  9668   /**
       
  9669    * inlined Object.is polyfill to avoid requiring consumers ship their own
       
  9670    * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
       
  9671    */
       
  9672   function is(x, y) {
       
  9673     return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y // eslint-disable-line no-self-compare
       
  9674     ;
       
  9675   }
       
  9676 
       
  9677   var objectIs = typeof Object.is === 'function' ? Object.is : is;
       
  9678 
       
  9679   var hasOwnProperty$2 = Object.prototype.hasOwnProperty;
       
  9680   /**
       
  9681    * Performs equality by iterating through keys on an object and returning false
       
  9682    * when any key has values which are not strictly equal between the arguments.
       
  9683    * Returns true when the values of all keys are strictly equal.
       
  9684    */
       
  9685 
       
  9686   function shallowEqual(objA, objB) {
       
  9687     if (objectIs(objA, objB)) {
       
  9688       return true;
       
  9689     }
       
  9690 
       
  9691     if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) {
       
  9692       return false;
       
  9693     }
       
  9694 
       
  9695     var keysA = Object.keys(objA);
       
  9696     var keysB = Object.keys(objB);
       
  9697 
       
  9698     if (keysA.length !== keysB.length) {
       
  9699       return false;
       
  9700     } // Test for A's keys different from B.
       
  9701 
       
  9702 
       
  9703     for (var i = 0; i < keysA.length; i++) {
       
  9704       if (!hasOwnProperty$2.call(objB, keysA[i]) || !objectIs(objA[keysA[i]], objB[keysA[i]])) {
       
  9705         return false;
       
  9706       }
       
  9707     }
       
  9708 
       
  9709     return true;
       
  9710   }
       
  9711 
       
  9712   var skipSelectionChangeEvent = canUseDOM && 'documentMode' in document && document.documentMode <= 11;
       
  9713   var eventTypes$3 = {
       
  9714     select: {
       
  9715       phasedRegistrationNames: {
       
  9716         bubbled: 'onSelect',
       
  9717         captured: 'onSelectCapture'
       
  9718       },
       
  9719       dependencies: [TOP_BLUR, TOP_CONTEXT_MENU, TOP_DRAG_END, TOP_FOCUS, TOP_KEY_DOWN, TOP_KEY_UP, TOP_MOUSE_DOWN, TOP_MOUSE_UP, TOP_SELECTION_CHANGE]
       
  9720     }
       
  9721   };
       
  9722   var activeElement$1 = null;
       
  9723   var activeElementInst$1 = null;
       
  9724   var lastSelection = null;
       
  9725   var mouseDown = false;
       
  9726   /**
       
  9727    * Get an object which is a unique representation of the current selection.
       
  9728    *
       
  9729    * The return value will not be consistent across nodes or browsers, but
       
  9730    * two identical selections on the same node will return identical objects.
       
  9731    *
       
  9732    * @param {DOMElement} node
       
  9733    * @return {object}
       
  9734    */
       
  9735 
       
  9736   function getSelection$1(node) {
       
  9737     if ('selectionStart' in node && hasSelectionCapabilities(node)) {
       
  9738       return {
       
  9739         start: node.selectionStart,
       
  9740         end: node.selectionEnd
       
  9741       };
       
  9742     } else {
       
  9743       var win = node.ownerDocument && node.ownerDocument.defaultView || window;
       
  9744       var selection = win.getSelection();
       
  9745       return {
       
  9746         anchorNode: selection.anchorNode,
       
  9747         anchorOffset: selection.anchorOffset,
       
  9748         focusNode: selection.focusNode,
       
  9749         focusOffset: selection.focusOffset
       
  9750       };
       
  9751     }
       
  9752   }
       
  9753   /**
       
  9754    * Get document associated with the event target.
       
  9755    *
       
  9756    * @param {object} nativeEventTarget
       
  9757    * @return {Document}
       
  9758    */
       
  9759 
       
  9760 
       
  9761   function getEventTargetDocument(eventTarget) {
       
  9762     return eventTarget.window === eventTarget ? eventTarget.document : eventTarget.nodeType === DOCUMENT_NODE ? eventTarget : eventTarget.ownerDocument;
       
  9763   }
       
  9764   /**
       
  9765    * Poll selection to see whether it's changed.
       
  9766    *
       
  9767    * @param {object} nativeEvent
       
  9768    * @param {object} nativeEventTarget
       
  9769    * @return {?SyntheticEvent}
       
  9770    */
       
  9771 
       
  9772 
       
  9773   function constructSelectEvent(nativeEvent, nativeEventTarget) {
       
  9774     // Ensure we have the right element, and that the user is not dragging a
       
  9775     // selection (this matches native `select` event behavior). In HTML5, select
       
  9776     // fires only on input and textarea thus if there's no focused element we
       
  9777     // won't dispatch.
       
  9778     var doc = getEventTargetDocument(nativeEventTarget);
       
  9779 
       
  9780     if (mouseDown || activeElement$1 == null || activeElement$1 !== getActiveElement(doc)) {
       
  9781       return null;
       
  9782     } // Only fire when selection has actually changed.
       
  9783 
       
  9784 
       
  9785     var currentSelection = getSelection$1(activeElement$1);
       
  9786 
       
  9787     if (!lastSelection || !shallowEqual(lastSelection, currentSelection)) {
       
  9788       lastSelection = currentSelection;
       
  9789       var syntheticEvent = SyntheticEvent.getPooled(eventTypes$3.select, activeElementInst$1, nativeEvent, nativeEventTarget);
       
  9790       syntheticEvent.type = 'select';
       
  9791       syntheticEvent.target = activeElement$1;
       
  9792       accumulateTwoPhaseDispatches(syntheticEvent);
       
  9793       return syntheticEvent;
       
  9794     }
       
  9795 
       
  9796     return null;
       
  9797   }
       
  9798   /**
       
  9799    * This plugin creates an `onSelect` event that normalizes select events
       
  9800    * across form elements.
       
  9801    *
       
  9802    * Supported elements are:
       
  9803    * - input (see `isTextInputElement`)
       
  9804    * - textarea
       
  9805    * - contentEditable
       
  9806    *
       
  9807    * This differs from native browser implementations in the following ways:
       
  9808    * - Fires on contentEditable fields as well as inputs.
       
  9809    * - Fires for collapsed selection.
       
  9810    * - Fires after user input.
       
  9811    */
       
  9812 
       
  9813 
       
  9814   var SelectEventPlugin = {
       
  9815     eventTypes: eventTypes$3,
       
  9816     extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget, eventSystemFlags, container) {
       
  9817       var containerOrDoc = container || getEventTargetDocument(nativeEventTarget); // Track whether all listeners exists for this plugin. If none exist, we do
       
  9818       // not extract events. See #3639.
       
  9819 
       
  9820       if (!containerOrDoc || !isListeningToAllDependencies('onSelect', containerOrDoc)) {
       
  9821         return null;
       
  9822       }
       
  9823 
       
  9824       var targetNode = targetInst ? getNodeFromInstance$1(targetInst) : window;
       
  9825 
       
  9826       switch (topLevelType) {
       
  9827         // Track the input node that has focus.
       
  9828         case TOP_FOCUS:
       
  9829           if (isTextInputElement(targetNode) || targetNode.contentEditable === 'true') {
       
  9830             activeElement$1 = targetNode;
       
  9831             activeElementInst$1 = targetInst;
       
  9832             lastSelection = null;
       
  9833           }
       
  9834 
  9379           break;
  9835           break;
  9380         // Controlled attributes are not validated
  9836 
  9381         // TODO: Only ignore them on controlled tags.
  9837         case TOP_BLUR:
  9382         case 'value':
  9838           activeElement$1 = null;
       
  9839           activeElementInst$1 = null;
       
  9840           lastSelection = null;
  9383           break;
  9841           break;
  9384         case 'checked':
  9842         // Don't fire the event while the user is dragging. This matches the
       
  9843         // semantics of the native select event.
       
  9844 
       
  9845         case TOP_MOUSE_DOWN:
       
  9846           mouseDown = true;
  9385           break;
  9847           break;
  9386         case 'selected':
  9848 
       
  9849         case TOP_CONTEXT_MENU:
       
  9850         case TOP_MOUSE_UP:
       
  9851         case TOP_DRAG_END:
       
  9852           mouseDown = false;
       
  9853           return constructSelectEvent(nativeEvent, nativeEventTarget);
       
  9854         // Chrome and IE fire non-standard event when selection is changed (and
       
  9855         // sometimes when it hasn't). IE's event fires out of order with respect
       
  9856         // to key and input events on deletion, so we discard it.
       
  9857         //
       
  9858         // Firefox doesn't support selectionchange, so check selection status
       
  9859         // after each key entry. The selection changes after keydown and before
       
  9860         // keyup, but we check on keydown as well in the case of holding down a
       
  9861         // key, when multiple keydown events are fired but only one keyup is.
       
  9862         // This is also our approach for IE handling, for the reason above.
       
  9863 
       
  9864         case TOP_SELECTION_CHANGE:
       
  9865           if (skipSelectionChangeEvent) {
       
  9866             break;
       
  9867           }
       
  9868 
       
  9869         // falls through
       
  9870 
       
  9871         case TOP_KEY_DOWN:
       
  9872         case TOP_KEY_UP:
       
  9873           return constructSelectEvent(nativeEvent, nativeEventTarget);
       
  9874       }
       
  9875 
       
  9876       return null;
       
  9877     }
       
  9878   };
       
  9879 
       
  9880   /**
       
  9881    * @interface Event
       
  9882    * @see http://www.w3.org/TR/css3-animations/#AnimationEvent-interface
       
  9883    * @see https://developer.mozilla.org/en-US/docs/Web/API/AnimationEvent
       
  9884    */
       
  9885 
       
  9886   var SyntheticAnimationEvent = SyntheticEvent.extend({
       
  9887     animationName: null,
       
  9888     elapsedTime: null,
       
  9889     pseudoElement: null
       
  9890   });
       
  9891 
       
  9892   /**
       
  9893    * @interface Event
       
  9894    * @see http://www.w3.org/TR/clipboard-apis/
       
  9895    */
       
  9896 
       
  9897   var SyntheticClipboardEvent = SyntheticEvent.extend({
       
  9898     clipboardData: function (event) {
       
  9899       return 'clipboardData' in event ? event.clipboardData : window.clipboardData;
       
  9900     }
       
  9901   });
       
  9902 
       
  9903   /**
       
  9904    * @interface FocusEvent
       
  9905    * @see http://www.w3.org/TR/DOM-Level-3-Events/
       
  9906    */
       
  9907 
       
  9908   var SyntheticFocusEvent = SyntheticUIEvent.extend({
       
  9909     relatedTarget: null
       
  9910   });
       
  9911 
       
  9912   /**
       
  9913    * `charCode` represents the actual "character code" and is safe to use with
       
  9914    * `String.fromCharCode`. As such, only keys that correspond to printable
       
  9915    * characters produce a valid `charCode`, the only exception to this is Enter.
       
  9916    * The Tab-key is considered non-printable and does not have a `charCode`,
       
  9917    * presumably because it does not produce a tab-character in browsers.
       
  9918    *
       
  9919    * @param {object} nativeEvent Native browser event.
       
  9920    * @return {number} Normalized `charCode` property.
       
  9921    */
       
  9922   function getEventCharCode(nativeEvent) {
       
  9923     var charCode;
       
  9924     var keyCode = nativeEvent.keyCode;
       
  9925 
       
  9926     if ('charCode' in nativeEvent) {
       
  9927       charCode = nativeEvent.charCode; // FF does not set `charCode` for the Enter-key, check against `keyCode`.
       
  9928 
       
  9929       if (charCode === 0 && keyCode === 13) {
       
  9930         charCode = 13;
       
  9931       }
       
  9932     } else {
       
  9933       // IE8 does not implement `charCode`, but `keyCode` has the correct value.
       
  9934       charCode = keyCode;
       
  9935     } // IE and Edge (on Windows) and Chrome / Safari (on Windows and Linux)
       
  9936     // report Enter as charCode 10 when ctrl is pressed.
       
  9937 
       
  9938 
       
  9939     if (charCode === 10) {
       
  9940       charCode = 13;
       
  9941     } // Some non-printable keys are reported in `charCode`/`keyCode`, discard them.
       
  9942     // Must not discard the (non-)printable Enter-key.
       
  9943 
       
  9944 
       
  9945     if (charCode >= 32 || charCode === 13) {
       
  9946       return charCode;
       
  9947     }
       
  9948 
       
  9949     return 0;
       
  9950   }
       
  9951 
       
  9952   /**
       
  9953    * Normalization of deprecated HTML5 `key` values
       
  9954    * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names
       
  9955    */
       
  9956 
       
  9957   var normalizeKey = {
       
  9958     Esc: 'Escape',
       
  9959     Spacebar: ' ',
       
  9960     Left: 'ArrowLeft',
       
  9961     Up: 'ArrowUp',
       
  9962     Right: 'ArrowRight',
       
  9963     Down: 'ArrowDown',
       
  9964     Del: 'Delete',
       
  9965     Win: 'OS',
       
  9966     Menu: 'ContextMenu',
       
  9967     Apps: 'ContextMenu',
       
  9968     Scroll: 'ScrollLock',
       
  9969     MozPrintableKey: 'Unidentified'
       
  9970   };
       
  9971   /**
       
  9972    * Translation from legacy `keyCode` to HTML5 `key`
       
  9973    * Only special keys supported, all others depend on keyboard layout or browser
       
  9974    * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names
       
  9975    */
       
  9976 
       
  9977   var translateToKey = {
       
  9978     '8': 'Backspace',
       
  9979     '9': 'Tab',
       
  9980     '12': 'Clear',
       
  9981     '13': 'Enter',
       
  9982     '16': 'Shift',
       
  9983     '17': 'Control',
       
  9984     '18': 'Alt',
       
  9985     '19': 'Pause',
       
  9986     '20': 'CapsLock',
       
  9987     '27': 'Escape',
       
  9988     '32': ' ',
       
  9989     '33': 'PageUp',
       
  9990     '34': 'PageDown',
       
  9991     '35': 'End',
       
  9992     '36': 'Home',
       
  9993     '37': 'ArrowLeft',
       
  9994     '38': 'ArrowUp',
       
  9995     '39': 'ArrowRight',
       
  9996     '40': 'ArrowDown',
       
  9997     '45': 'Insert',
       
  9998     '46': 'Delete',
       
  9999     '112': 'F1',
       
 10000     '113': 'F2',
       
 10001     '114': 'F3',
       
 10002     '115': 'F4',
       
 10003     '116': 'F5',
       
 10004     '117': 'F6',
       
 10005     '118': 'F7',
       
 10006     '119': 'F8',
       
 10007     '120': 'F9',
       
 10008     '121': 'F10',
       
 10009     '122': 'F11',
       
 10010     '123': 'F12',
       
 10011     '144': 'NumLock',
       
 10012     '145': 'ScrollLock',
       
 10013     '224': 'Meta'
       
 10014   };
       
 10015   /**
       
 10016    * @param {object} nativeEvent Native browser event.
       
 10017    * @return {string} Normalized `key` property.
       
 10018    */
       
 10019 
       
 10020   function getEventKey(nativeEvent) {
       
 10021     if (nativeEvent.key) {
       
 10022       // Normalize inconsistent values reported by browsers due to
       
 10023       // implementations of a working draft specification.
       
 10024       // FireFox implements `key` but returns `MozPrintableKey` for all
       
 10025       // printable characters (normalized to `Unidentified`), ignore it.
       
 10026       var key = normalizeKey[nativeEvent.key] || nativeEvent.key;
       
 10027 
       
 10028       if (key !== 'Unidentified') {
       
 10029         return key;
       
 10030       }
       
 10031     } // Browser does not implement `key`, polyfill as much of it as we can.
       
 10032 
       
 10033 
       
 10034     if (nativeEvent.type === 'keypress') {
       
 10035       var charCode = getEventCharCode(nativeEvent); // The enter-key is technically both printable and non-printable and can
       
 10036       // thus be captured by `keypress`, no other non-printable key should.
       
 10037 
       
 10038       return charCode === 13 ? 'Enter' : String.fromCharCode(charCode);
       
 10039     }
       
 10040 
       
 10041     if (nativeEvent.type === 'keydown' || nativeEvent.type === 'keyup') {
       
 10042       // While user keyboard layout determines the actual meaning of each
       
 10043       // `keyCode` value, almost all function keys have a universal value.
       
 10044       return translateToKey[nativeEvent.keyCode] || 'Unidentified';
       
 10045     }
       
 10046 
       
 10047     return '';
       
 10048   }
       
 10049 
       
 10050   /**
       
 10051    * @interface KeyboardEvent
       
 10052    * @see http://www.w3.org/TR/DOM-Level-3-Events/
       
 10053    */
       
 10054 
       
 10055   var SyntheticKeyboardEvent = SyntheticUIEvent.extend({
       
 10056     key: getEventKey,
       
 10057     location: null,
       
 10058     ctrlKey: null,
       
 10059     shiftKey: null,
       
 10060     altKey: null,
       
 10061     metaKey: null,
       
 10062     repeat: null,
       
 10063     locale: null,
       
 10064     getModifierState: getEventModifierState,
       
 10065     // Legacy Interface
       
 10066     charCode: function (event) {
       
 10067       // `charCode` is the result of a KeyPress event and represents the value of
       
 10068       // the actual printable character.
       
 10069       // KeyPress is deprecated, but its replacement is not yet final and not
       
 10070       // implemented in any major browser. Only KeyPress has charCode.
       
 10071       if (event.type === 'keypress') {
       
 10072         return getEventCharCode(event);
       
 10073       }
       
 10074 
       
 10075       return 0;
       
 10076     },
       
 10077     keyCode: function (event) {
       
 10078       // `keyCode` is the result of a KeyDown/Up event and represents the value of
       
 10079       // physical keyboard key.
       
 10080       // The actual meaning of the value depends on the users' keyboard layout
       
 10081       // which cannot be detected. Assuming that it is a US keyboard layout
       
 10082       // provides a surprisingly accurate mapping for US and European users.
       
 10083       // Due to this, it is left to the user to implement at this time.
       
 10084       if (event.type === 'keydown' || event.type === 'keyup') {
       
 10085         return event.keyCode;
       
 10086       }
       
 10087 
       
 10088       return 0;
       
 10089     },
       
 10090     which: function (event) {
       
 10091       // `which` is an alias for either `keyCode` or `charCode` depending on the
       
 10092       // type of the event.
       
 10093       if (event.type === 'keypress') {
       
 10094         return getEventCharCode(event);
       
 10095       }
       
 10096 
       
 10097       if (event.type === 'keydown' || event.type === 'keyup') {
       
 10098         return event.keyCode;
       
 10099       }
       
 10100 
       
 10101       return 0;
       
 10102     }
       
 10103   });
       
 10104 
       
 10105   /**
       
 10106    * @interface DragEvent
       
 10107    * @see http://www.w3.org/TR/DOM-Level-3-Events/
       
 10108    */
       
 10109 
       
 10110   var SyntheticDragEvent = SyntheticMouseEvent.extend({
       
 10111     dataTransfer: null
       
 10112   });
       
 10113 
       
 10114   /**
       
 10115    * @interface TouchEvent
       
 10116    * @see http://www.w3.org/TR/touch-events/
       
 10117    */
       
 10118 
       
 10119   var SyntheticTouchEvent = SyntheticUIEvent.extend({
       
 10120     touches: null,
       
 10121     targetTouches: null,
       
 10122     changedTouches: null,
       
 10123     altKey: null,
       
 10124     metaKey: null,
       
 10125     ctrlKey: null,
       
 10126     shiftKey: null,
       
 10127     getModifierState: getEventModifierState
       
 10128   });
       
 10129 
       
 10130   /**
       
 10131    * @interface Event
       
 10132    * @see http://www.w3.org/TR/2009/WD-css3-transitions-20090320/#transition-events-
       
 10133    * @see https://developer.mozilla.org/en-US/docs/Web/API/TransitionEvent
       
 10134    */
       
 10135 
       
 10136   var SyntheticTransitionEvent = SyntheticEvent.extend({
       
 10137     propertyName: null,
       
 10138     elapsedTime: null,
       
 10139     pseudoElement: null
       
 10140   });
       
 10141 
       
 10142   /**
       
 10143    * @interface WheelEvent
       
 10144    * @see http://www.w3.org/TR/DOM-Level-3-Events/
       
 10145    */
       
 10146 
       
 10147   var SyntheticWheelEvent = SyntheticMouseEvent.extend({
       
 10148     deltaX: function (event) {
       
 10149       return 'deltaX' in event ? event.deltaX : // Fallback to `wheelDeltaX` for Webkit and normalize (right is positive).
       
 10150       'wheelDeltaX' in event ? -event.wheelDeltaX : 0;
       
 10151     },
       
 10152     deltaY: function (event) {
       
 10153       return 'deltaY' in event ? event.deltaY : // Fallback to `wheelDeltaY` for Webkit and normalize (down is positive).
       
 10154       'wheelDeltaY' in event ? -event.wheelDeltaY : // Fallback to `wheelDelta` for IE<9 and normalize (down is positive).
       
 10155       'wheelDelta' in event ? -event.wheelDelta : 0;
       
 10156     },
       
 10157     deltaZ: null,
       
 10158     // Browsers without "deltaMode" is reporting in raw wheel delta where one
       
 10159     // notch on the scroll is always +/- 120, roughly equivalent to pixels.
       
 10160     // A good approximation of DOM_DELTA_LINE (1) is 5% of viewport size or
       
 10161     // ~40 pixels, for DOM_DELTA_SCREEN (2) it is 87.5% of viewport size.
       
 10162     deltaMode: null
       
 10163   });
       
 10164 
       
 10165   var knownHTMLTopLevelTypes = [TOP_ABORT, TOP_CANCEL, TOP_CAN_PLAY, TOP_CAN_PLAY_THROUGH, TOP_CLOSE, TOP_DURATION_CHANGE, TOP_EMPTIED, TOP_ENCRYPTED, TOP_ENDED, TOP_ERROR, TOP_INPUT, TOP_INVALID, TOP_LOAD, TOP_LOADED_DATA, TOP_LOADED_METADATA, TOP_LOAD_START, TOP_PAUSE, TOP_PLAY, TOP_PLAYING, TOP_PROGRESS, TOP_RATE_CHANGE, TOP_RESET, TOP_SEEKED, TOP_SEEKING, TOP_STALLED, TOP_SUBMIT, TOP_SUSPEND, TOP_TIME_UPDATE, TOP_TOGGLE, TOP_VOLUME_CHANGE, TOP_WAITING];
       
 10166   var SimpleEventPlugin = {
       
 10167     // simpleEventPluginEventTypes gets populated from
       
 10168     // the DOMEventProperties module.
       
 10169     eventTypes: simpleEventPluginEventTypes,
       
 10170     extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget, eventSystemFlags) {
       
 10171       var dispatchConfig = topLevelEventsToDispatchConfig.get(topLevelType);
       
 10172 
       
 10173       if (!dispatchConfig) {
       
 10174         return null;
       
 10175       }
       
 10176 
       
 10177       var EventConstructor;
       
 10178 
       
 10179       switch (topLevelType) {
       
 10180         case TOP_KEY_PRESS:
       
 10181           // Firefox creates a keypress event for function keys too. This removes
       
 10182           // the unwanted keypress events. Enter is however both printable and
       
 10183           // non-printable. One would expect Tab to be as well (but it isn't).
       
 10184           if (getEventCharCode(nativeEvent) === 0) {
       
 10185             return null;
       
 10186           }
       
 10187 
       
 10188         /* falls through */
       
 10189 
       
 10190         case TOP_KEY_DOWN:
       
 10191         case TOP_KEY_UP:
       
 10192           EventConstructor = SyntheticKeyboardEvent;
  9387           break;
 10193           break;
       
 10194 
       
 10195         case TOP_BLUR:
       
 10196         case TOP_FOCUS:
       
 10197           EventConstructor = SyntheticFocusEvent;
       
 10198           break;
       
 10199 
       
 10200         case TOP_CLICK:
       
 10201           // Firefox creates a click event on right mouse clicks. This removes the
       
 10202           // unwanted click events.
       
 10203           if (nativeEvent.button === 2) {
       
 10204             return null;
       
 10205           }
       
 10206 
       
 10207         /* falls through */
       
 10208 
       
 10209         case TOP_AUX_CLICK:
       
 10210         case TOP_DOUBLE_CLICK:
       
 10211         case TOP_MOUSE_DOWN:
       
 10212         case TOP_MOUSE_MOVE:
       
 10213         case TOP_MOUSE_UP: // TODO: Disabled elements should not respond to mouse events
       
 10214 
       
 10215         /* falls through */
       
 10216 
       
 10217         case TOP_MOUSE_OUT:
       
 10218         case TOP_MOUSE_OVER:
       
 10219         case TOP_CONTEXT_MENU:
       
 10220           EventConstructor = SyntheticMouseEvent;
       
 10221           break;
       
 10222 
       
 10223         case TOP_DRAG:
       
 10224         case TOP_DRAG_END:
       
 10225         case TOP_DRAG_ENTER:
       
 10226         case TOP_DRAG_EXIT:
       
 10227         case TOP_DRAG_LEAVE:
       
 10228         case TOP_DRAG_OVER:
       
 10229         case TOP_DRAG_START:
       
 10230         case TOP_DROP:
       
 10231           EventConstructor = SyntheticDragEvent;
       
 10232           break;
       
 10233 
       
 10234         case TOP_TOUCH_CANCEL:
       
 10235         case TOP_TOUCH_END:
       
 10236         case TOP_TOUCH_MOVE:
       
 10237         case TOP_TOUCH_START:
       
 10238           EventConstructor = SyntheticTouchEvent;
       
 10239           break;
       
 10240 
       
 10241         case TOP_ANIMATION_END:
       
 10242         case TOP_ANIMATION_ITERATION:
       
 10243         case TOP_ANIMATION_START:
       
 10244           EventConstructor = SyntheticAnimationEvent;
       
 10245           break;
       
 10246 
       
 10247         case TOP_TRANSITION_END:
       
 10248           EventConstructor = SyntheticTransitionEvent;
       
 10249           break;
       
 10250 
       
 10251         case TOP_SCROLL:
       
 10252           EventConstructor = SyntheticUIEvent;
       
 10253           break;
       
 10254 
       
 10255         case TOP_WHEEL:
       
 10256           EventConstructor = SyntheticWheelEvent;
       
 10257           break;
       
 10258 
       
 10259         case TOP_COPY:
       
 10260         case TOP_CUT:
       
 10261         case TOP_PASTE:
       
 10262           EventConstructor = SyntheticClipboardEvent;
       
 10263           break;
       
 10264 
       
 10265         case TOP_GOT_POINTER_CAPTURE:
       
 10266         case TOP_LOST_POINTER_CAPTURE:
       
 10267         case TOP_POINTER_CANCEL:
       
 10268         case TOP_POINTER_DOWN:
       
 10269         case TOP_POINTER_MOVE:
       
 10270         case TOP_POINTER_OUT:
       
 10271         case TOP_POINTER_OVER:
       
 10272         case TOP_POINTER_UP:
       
 10273           EventConstructor = SyntheticPointerEvent;
       
 10274           break;
       
 10275 
  9388         default:
 10276         default:
  9389           // Intentionally use the original name.
 10277           {
  9390           // See discussion in https://github.com/facebook/react/pull/10676.
 10278             if (knownHTMLTopLevelTypes.indexOf(topLevelType) === -1) {
  9391           extraAttributeNames.add(attributes[_i].name);
 10279               error('SimpleEventPlugin: Unhandled event type, `%s`. This warning ' + 'is likely caused by a bug in React. Please file an issue.', topLevelType);
  9392       }
       
  9393     }
       
  9394   }
       
  9395 
       
  9396   var updatePayload = null;
       
  9397   for (var propKey in rawProps) {
       
  9398     if (!rawProps.hasOwnProperty(propKey)) {
       
  9399       continue;
       
  9400     }
       
  9401     var nextProp = rawProps[propKey];
       
  9402     if (propKey === CHILDREN) {
       
  9403       // For text content children we compare against textContent. This
       
  9404       // might match additional HTML that is hidden when we read it using
       
  9405       // textContent. E.g. "foo" will match "f<span>oo</span>" but that still
       
  9406       // satisfies our requirement. Our requirement is not to produce perfect
       
  9407       // HTML and attributes. Ideally we should preserve structure but it's
       
  9408       // ok not to if the visible content is still enough to indicate what
       
  9409       // even listeners these nodes might be wired up to.
       
  9410       // TODO: Warn if there is more than a single textNode as a child.
       
  9411       // TODO: Should we use domElement.firstChild.nodeValue to compare?
       
  9412       if (typeof nextProp === 'string') {
       
  9413         if (domElement.textContent !== nextProp) {
       
  9414           if (true && !suppressHydrationWarning) {
       
  9415             warnForTextDifference(domElement.textContent, nextProp);
       
  9416           }
       
  9417           updatePayload = [CHILDREN, nextProp];
       
  9418         }
       
  9419       } else if (typeof nextProp === 'number') {
       
  9420         if (domElement.textContent !== '' + nextProp) {
       
  9421           if (true && !suppressHydrationWarning) {
       
  9422             warnForTextDifference(domElement.textContent, nextProp);
       
  9423           }
       
  9424           updatePayload = [CHILDREN, '' + nextProp];
       
  9425         }
       
  9426       }
       
  9427     } else if (registrationNameModules.hasOwnProperty(propKey)) {
       
  9428       if (nextProp != null) {
       
  9429         if (true && typeof nextProp !== 'function') {
       
  9430           warnForInvalidEventListener(propKey, nextProp);
       
  9431         }
       
  9432         ensureListeningTo(rootContainerElement, propKey);
       
  9433       }
       
  9434     } else if (true &&
       
  9435     // Convince Flow we've calculated it (it's DEV-only in this method.)
       
  9436     typeof isCustomComponentTag === 'boolean') {
       
  9437       // Validate that the properties correspond to their expected values.
       
  9438       var serverValue = void 0;
       
  9439       var propertyInfo = getPropertyInfo(propKey);
       
  9440       if (suppressHydrationWarning) {
       
  9441         // Don't bother comparing. We're ignoring all these warnings.
       
  9442       } else if (enableFlareAPI && propKey === LISTENERS || propKey === SUPPRESS_CONTENT_EDITABLE_WARNING || propKey === SUPPRESS_HYDRATION_WARNING$1 ||
       
  9443       // Controlled attributes are not validated
       
  9444       // TODO: Only ignore them on controlled tags.
       
  9445       propKey === 'value' || propKey === 'checked' || propKey === 'selected') {
       
  9446         // Noop
       
  9447       } else if (propKey === DANGEROUSLY_SET_INNER_HTML) {
       
  9448         var serverHTML = domElement.innerHTML;
       
  9449         var nextHtml = nextProp ? nextProp[HTML] : undefined;
       
  9450         var expectedHTML = normalizeHTML(domElement, nextHtml != null ? nextHtml : '');
       
  9451         if (expectedHTML !== serverHTML) {
       
  9452           warnForPropDifference(propKey, serverHTML, expectedHTML);
       
  9453         }
       
  9454       } else if (propKey === STYLE$1) {
       
  9455         // $FlowFixMe - Should be inferred as not undefined.
       
  9456         extraAttributeNames.delete(propKey);
       
  9457 
       
  9458         if (canDiffStyleForHydrationWarning) {
       
  9459           var expectedStyle = createDangerousStringForStyles(nextProp);
       
  9460           serverValue = domElement.getAttribute('style');
       
  9461           if (expectedStyle !== serverValue) {
       
  9462             warnForPropDifference(propKey, serverValue, expectedStyle);
       
  9463           }
       
  9464         }
       
  9465       } else if (isCustomComponentTag) {
       
  9466         // $FlowFixMe - Should be inferred as not undefined.
       
  9467         extraAttributeNames.delete(propKey.toLowerCase());
       
  9468         serverValue = getValueForAttribute(domElement, propKey, nextProp);
       
  9469 
       
  9470         if (nextProp !== serverValue) {
       
  9471           warnForPropDifference(propKey, serverValue, nextProp);
       
  9472         }
       
  9473       } else if (!shouldIgnoreAttribute(propKey, propertyInfo, isCustomComponentTag) && !shouldRemoveAttribute(propKey, nextProp, propertyInfo, isCustomComponentTag)) {
       
  9474         var isMismatchDueToBadCasing = false;
       
  9475         if (propertyInfo !== null) {
       
  9476           // $FlowFixMe - Should be inferred as not undefined.
       
  9477           extraAttributeNames.delete(propertyInfo.attributeName);
       
  9478           serverValue = getValueForProperty(domElement, propKey, nextProp, propertyInfo);
       
  9479         } else {
       
  9480           var ownNamespace = parentNamespace;
       
  9481           if (ownNamespace === HTML_NAMESPACE) {
       
  9482             ownNamespace = getIntrinsicNamespace(tag);
       
  9483           }
       
  9484           if (ownNamespace === HTML_NAMESPACE) {
       
  9485             // $FlowFixMe - Should be inferred as not undefined.
       
  9486             extraAttributeNames.delete(propKey.toLowerCase());
       
  9487           } else {
       
  9488             var standardName = getPossibleStandardName(propKey);
       
  9489             if (standardName !== null && standardName !== propKey) {
       
  9490               // If an SVG prop is supplied with bad casing, it will
       
  9491               // be successfully parsed from HTML, but will produce a mismatch
       
  9492               // (and would be incorrectly rendered on the client).
       
  9493               // However, we already warn about bad casing elsewhere.
       
  9494               // So we'll skip the misleading extra mismatch warning in this case.
       
  9495               isMismatchDueToBadCasing = true;
       
  9496               // $FlowFixMe - Should be inferred as not undefined.
       
  9497               extraAttributeNames.delete(standardName);
       
  9498             }
 10280             }
  9499             // $FlowFixMe - Should be inferred as not undefined.
 10281           } // HTML Events
  9500             extraAttributeNames.delete(propKey);
 10282           // @see http://www.w3.org/TR/html5/index.html#events-0
  9501           }
 10283 
  9502           serverValue = getValueForAttribute(domElement, propKey, nextProp);
 10284 
  9503         }
 10285           EventConstructor = SyntheticEvent;
  9504 
 10286           break;
  9505         if (nextProp !== serverValue && !isMismatchDueToBadCasing) {
 10287       }
  9506           warnForPropDifference(propKey, serverValue, nextProp);
 10288 
  9507         }
 10289       var event = EventConstructor.getPooled(dispatchConfig, targetInst, nativeEvent, nativeEventTarget);
  9508       }
 10290       accumulateTwoPhaseDispatches(event);
  9509     }
 10291       return event;
  9510   }
 10292     }
  9511 
       
  9512   {
       
  9513     // $FlowFixMe - Should be inferred as not undefined.
       
  9514     if (extraAttributeNames.size > 0 && !suppressHydrationWarning) {
       
  9515       // $FlowFixMe - Should be inferred as not undefined.
       
  9516       warnForExtraAttributes(extraAttributeNames);
       
  9517     }
       
  9518   }
       
  9519 
       
  9520   switch (tag) {
       
  9521     case 'input':
       
  9522       // TODO: Make sure we check if this is still unmounted or do any clean
       
  9523       // up necessary since we never stop tracking anymore.
       
  9524       track(domElement);
       
  9525       postMountWrapper(domElement, rawProps, true);
       
  9526       break;
       
  9527     case 'textarea':
       
  9528       // TODO: Make sure we check if this is still unmounted or do any clean
       
  9529       // up necessary since we never stop tracking anymore.
       
  9530       track(domElement);
       
  9531       postMountWrapper$3(domElement, rawProps);
       
  9532       break;
       
  9533     case 'select':
       
  9534     case 'option':
       
  9535       // For input and textarea we current always set the value property at
       
  9536       // post mount to force it to diverge from attributes. However, for
       
  9537       // option and select we don't quite do the same thing and select
       
  9538       // is not resilient to the DOM state changing so we don't do that here.
       
  9539       // TODO: Consider not doing this for input and textarea.
       
  9540       break;
       
  9541     default:
       
  9542       if (typeof rawProps.onClick === 'function') {
       
  9543         // TODO: This cast may not be sound for SVG, MathML or custom elements.
       
  9544         trapClickOnNonInteractiveElement(domElement);
       
  9545       }
       
  9546       break;
       
  9547   }
       
  9548 
       
  9549   return updatePayload;
       
  9550 }
       
  9551 
       
  9552 function diffHydratedText(textNode, text) {
       
  9553   var isDifferent = textNode.nodeValue !== text;
       
  9554   return isDifferent;
       
  9555 }
       
  9556 
       
  9557 function warnForUnmatchedText(textNode, text) {
       
  9558   {
       
  9559     warnForTextDifference(textNode.nodeValue, text);
       
  9560   }
       
  9561 }
       
  9562 
       
  9563 function warnForDeletedHydratableElement(parentNode, child) {
       
  9564   {
       
  9565     if (didWarnInvalidHydration) {
       
  9566       return;
       
  9567     }
       
  9568     didWarnInvalidHydration = true;
       
  9569     warningWithoutStack$1(false, 'Did not expect server HTML to contain a <%s> in <%s>.', child.nodeName.toLowerCase(), parentNode.nodeName.toLowerCase());
       
  9570   }
       
  9571 }
       
  9572 
       
  9573 function warnForDeletedHydratableText(parentNode, child) {
       
  9574   {
       
  9575     if (didWarnInvalidHydration) {
       
  9576       return;
       
  9577     }
       
  9578     didWarnInvalidHydration = true;
       
  9579     warningWithoutStack$1(false, 'Did not expect server HTML to contain the text node "%s" in <%s>.', child.nodeValue, parentNode.nodeName.toLowerCase());
       
  9580   }
       
  9581 }
       
  9582 
       
  9583 function warnForInsertedHydratedElement(parentNode, tag, props) {
       
  9584   {
       
  9585     if (didWarnInvalidHydration) {
       
  9586       return;
       
  9587     }
       
  9588     didWarnInvalidHydration = true;
       
  9589     warningWithoutStack$1(false, 'Expected server HTML to contain a matching <%s> in <%s>.', tag, parentNode.nodeName.toLowerCase());
       
  9590   }
       
  9591 }
       
  9592 
       
  9593 function warnForInsertedHydratedText(parentNode, text) {
       
  9594   {
       
  9595     if (text === '') {
       
  9596       // We expect to insert empty text nodes since they're not represented in
       
  9597       // the HTML.
       
  9598       // TODO: Remove this special case if we can just avoid inserting empty
       
  9599       // text nodes.
       
  9600       return;
       
  9601     }
       
  9602     if (didWarnInvalidHydration) {
       
  9603       return;
       
  9604     }
       
  9605     didWarnInvalidHydration = true;
       
  9606     warningWithoutStack$1(false, 'Expected server HTML to contain a matching text node for "%s" in <%s>.', text, parentNode.nodeName.toLowerCase());
       
  9607   }
       
  9608 }
       
  9609 
       
  9610 function restoreControlledState$1(domElement, tag, props) {
       
  9611   switch (tag) {
       
  9612     case 'input':
       
  9613       restoreControlledState(domElement, props);
       
  9614       return;
       
  9615     case 'textarea':
       
  9616       restoreControlledState$3(domElement, props);
       
  9617       return;
       
  9618     case 'select':
       
  9619       restoreControlledState$2(domElement, props);
       
  9620       return;
       
  9621   }
       
  9622 }
       
  9623 
       
  9624 function listenToEventResponderEventTypes(eventTypes, element) {
       
  9625   if (enableFlareAPI) {
       
  9626     // Get the listening Set for this element. We use this to track
       
  9627     // what events we're listening to.
       
  9628     var listeningSet = getListeningSetForElement(element);
       
  9629 
       
  9630     // Go through each target event type of the event responder
       
  9631     for (var i = 0, length = eventTypes.length; i < length; ++i) {
       
  9632       var eventType = eventTypes[i];
       
  9633       var isPassive = !endsWith(eventType, '_active');
       
  9634       var eventKey = isPassive ? eventType + '_passive' : eventType;
       
  9635       var targetEventType = isPassive ? eventType : eventType.substring(0, eventType.length - 7);
       
  9636       if (!listeningSet.has(eventKey)) {
       
  9637         trapEventForResponderEventSystem(element, targetEventType, isPassive);
       
  9638         listeningSet.add(eventKey);
       
  9639       }
       
  9640     }
       
  9641   }
       
  9642 }
       
  9643 
       
  9644 // We can remove this once the event API is stable and out of a flag
       
  9645 if (enableFlareAPI) {
       
  9646   setListenToResponderEventTypes(listenToEventResponderEventTypes);
       
  9647 }
       
  9648 
       
  9649 // TODO: direct imports like some-package/src/* are bad. Fix me.
       
  9650 var validateDOMNesting = function () {};
       
  9651 var updatedAncestorInfo = function () {};
       
  9652 
       
  9653 {
       
  9654   // This validation code was written based on the HTML5 parsing spec:
       
  9655   // https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-scope
       
  9656   //
       
  9657   // Note: this does not catch all invalid nesting, nor does it try to (as it's
       
  9658   // not clear what practical benefit doing so provides); instead, we warn only
       
  9659   // for cases where the parser will give a parse tree differing from what React
       
  9660   // intended. For example, <b><div></div></b> is invalid but we don't warn
       
  9661   // because it still parses correctly; we do warn for other cases like nested
       
  9662   // <p> tags where the beginning of the second element implicitly closes the
       
  9663   // first, causing a confusing mess.
       
  9664 
       
  9665   // https://html.spec.whatwg.org/multipage/syntax.html#special
       
  9666   var specialTags = ['address', 'applet', 'area', 'article', 'aside', 'base', 'basefont', 'bgsound', 'blockquote', 'body', 'br', 'button', 'caption', 'center', 'col', 'colgroup', 'dd', 'details', 'dir', 'div', 'dl', 'dt', 'embed', 'fieldset', 'figcaption', 'figure', 'footer', 'form', 'frame', 'frameset', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'iframe', 'img', 'input', 'isindex', 'li', 'link', 'listing', 'main', 'marquee', 'menu', 'menuitem', 'meta', 'nav', 'noembed', 'noframes', 'noscript', 'object', 'ol', 'p', 'param', 'plaintext', 'pre', 'script', 'section', 'select', 'source', 'style', 'summary', 'table', 'tbody', 'td', 'template', 'textarea', 'tfoot', 'th', 'thead', 'title', 'tr', 'track', 'ul', 'wbr', 'xmp'];
       
  9667 
       
  9668   // https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-scope
       
  9669   var inScopeTags = ['applet', 'caption', 'html', 'table', 'td', 'th', 'marquee', 'object', 'template',
       
  9670 
       
  9671   // https://html.spec.whatwg.org/multipage/syntax.html#html-integration-point
       
  9672   // TODO: Distinguish by namespace here -- for <title>, including it here
       
  9673   // errs on the side of fewer warnings
       
  9674   'foreignObject', 'desc', 'title'];
       
  9675 
       
  9676   // https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-button-scope
       
  9677   var buttonScopeTags = inScopeTags.concat(['button']);
       
  9678 
       
  9679   // https://html.spec.whatwg.org/multipage/syntax.html#generate-implied-end-tags
       
  9680   var impliedEndTags = ['dd', 'dt', 'li', 'option', 'optgroup', 'p', 'rp', 'rt'];
       
  9681 
       
  9682   var emptyAncestorInfo = {
       
  9683     current: null,
       
  9684 
       
  9685     formTag: null,
       
  9686     aTagInScope: null,
       
  9687     buttonTagInScope: null,
       
  9688     nobrTagInScope: null,
       
  9689     pTagInButtonScope: null,
       
  9690 
       
  9691     listItemTagAutoclosing: null,
       
  9692     dlItemTagAutoclosing: null
       
  9693   };
 10293   };
  9694 
 10294 
  9695   updatedAncestorInfo = function (oldInfo, tag) {
 10295   /**
  9696     var ancestorInfo = _assign({}, oldInfo || emptyAncestorInfo);
 10296    * Specifies a deterministic ordering of `EventPlugin`s. A convenient way to
  9697     var info = { tag: tag };
 10297    * reason about plugins, without having to package every one of them. This
  9698 
 10298    * is better than having plugins be ordered in the same order that they
  9699     if (inScopeTags.indexOf(tag) !== -1) {
 10299    * are injected because that ordering would be influenced by the packaging order.
  9700       ancestorInfo.aTagInScope = null;
 10300    * `ResponderEventPlugin` must occur before `SimpleEventPlugin` so that
  9701       ancestorInfo.buttonTagInScope = null;
 10301    * preventing default on events is convenient in `SimpleEventPlugin` handlers.
  9702       ancestorInfo.nobrTagInScope = null;
 10302    */
  9703     }
 10303 
  9704     if (buttonScopeTags.indexOf(tag) !== -1) {
 10304   var DOMEventPluginOrder = ['ResponderEventPlugin', 'SimpleEventPlugin', 'EnterLeaveEventPlugin', 'ChangeEventPlugin', 'SelectEventPlugin', 'BeforeInputEventPlugin'];
  9705       ancestorInfo.pTagInButtonScope = null;
 10305   /**
  9706     }
 10306    * Inject modules for resolving DOM hierarchy and plugin ordering.
  9707 
 10307    */
  9708     // See rules for 'li', 'dd', 'dt' start tags in
 10308 
  9709     // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inbody
 10309   injectEventPluginOrder(DOMEventPluginOrder);
  9710     if (specialTags.indexOf(tag) !== -1 && tag !== 'address' && tag !== 'div' && tag !== 'p') {
 10310   setComponentTree(getFiberCurrentPropsFromNode$1, getInstanceFromNode$1, getNodeFromInstance$1);
  9711       ancestorInfo.listItemTagAutoclosing = null;
 10311   /**
  9712       ancestorInfo.dlItemTagAutoclosing = null;
 10312    * Some important event plugins included by default (without having to require
  9713     }
 10313    * them).
  9714 
 10314    */
  9715     ancestorInfo.current = info;
 10315 
  9716 
 10316   injectEventPluginsByName({
  9717     if (tag === 'form') {
 10317     SimpleEventPlugin: SimpleEventPlugin,
  9718       ancestorInfo.formTag = info;
 10318     EnterLeaveEventPlugin: EnterLeaveEventPlugin,
  9719     }
 10319     ChangeEventPlugin: ChangeEventPlugin,
  9720     if (tag === 'a') {
 10320     SelectEventPlugin: SelectEventPlugin,
  9721       ancestorInfo.aTagInScope = info;
 10321     BeforeInputEventPlugin: BeforeInputEventPlugin
  9722     }
 10322   });
  9723     if (tag === 'button') {
 10323 
  9724       ancestorInfo.buttonTagInScope = info;
 10324   // Prefix measurements so that it's possible to filter them.
  9725     }
 10325   // Longer prefixes are hard to read in DevTools.
  9726     if (tag === 'nobr') {
 10326   var reactEmoji = "\u269B";
  9727       ancestorInfo.nobrTagInScope = info;
 10327   var warningEmoji = "\u26D4";
  9728     }
 10328   var supportsUserTiming = typeof performance !== 'undefined' && typeof performance.mark === 'function' && typeof performance.clearMarks === 'function' && typeof performance.measure === 'function' && typeof performance.clearMeasures === 'function'; // Keep track of current fiber so that we know the path to unwind on pause.
  9729     if (tag === 'p') {
 10329   // TODO: this looks the same as nextUnitOfWork in scheduler. Can we unify them?
  9730       ancestorInfo.pTagInButtonScope = info;
 10330 
  9731     }
 10331   var currentFiber = null; // If we're in the middle of user code, which fiber and method is it?
  9732     if (tag === 'li') {
 10332   // Reusing `currentFiber` would be confusing for this because user code fiber
  9733       ancestorInfo.listItemTagAutoclosing = info;
 10333   // can change during commit phase too, but we don't need to unwind it (since
  9734     }
 10334   // lifecycles in the commit phase don't resemble a tree).
  9735     if (tag === 'dd' || tag === 'dt') {
 10335 
  9736       ancestorInfo.dlItemTagAutoclosing = info;
 10336   var currentPhase = null;
  9737     }
 10337   var currentPhaseFiber = null; // Did lifecycle hook schedule an update? This is often a performance problem,
  9738 
 10338   // so we will keep track of it, and include it in the report.
  9739     return ancestorInfo;
 10339   // Track commits caused by cascading updates.
       
 10340 
       
 10341   var isCommitting = false;
       
 10342   var hasScheduledUpdateInCurrentCommit = false;
       
 10343   var hasScheduledUpdateInCurrentPhase = false;
       
 10344   var commitCountInCurrentWorkLoop = 0;
       
 10345   var effectCountInCurrentCommit = 0;
       
 10346   // to avoid stretch the commit phase with measurement overhead.
       
 10347 
       
 10348   var labelsInCurrentCommit = new Set();
       
 10349 
       
 10350   var formatMarkName = function (markName) {
       
 10351     return reactEmoji + " " + markName;
  9740   };
 10352   };
  9741 
 10353 
  9742   /**
 10354   var formatLabel = function (label, warning) {
  9743    * Returns whether
 10355     var prefix = warning ? warningEmoji + " " : reactEmoji + " ";
  9744    */
 10356     var suffix = warning ? " Warning: " + warning : '';
  9745   var isTagValidWithParent = function (tag, parentTag) {
 10357     return "" + prefix + label + suffix;
  9746     // First, let's check if we're in an unusual parsing mode...
 10358   };
  9747     switch (parentTag) {
 10359 
  9748       // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inselect
 10360   var beginMark = function (markName) {
  9749       case 'select':
 10361     performance.mark(formatMarkName(markName));
  9750         return tag === 'option' || tag === 'optgroup' || tag === '#text';
 10362   };
  9751       case 'optgroup':
 10363 
  9752         return tag === 'option' || tag === '#text';
 10364   var clearMark = function (markName) {
  9753       // Strictly speaking, seeing an <option> doesn't mean we're in a <select>
 10365     performance.clearMarks(formatMarkName(markName));
  9754       // but
 10366   };
  9755       case 'option':
 10367 
  9756         return tag === '#text';
 10368   var endMark = function (label, markName, warning) {
  9757       // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intd
 10369     var formattedMarkName = formatMarkName(markName);
  9758       // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-incaption
 10370     var formattedLabel = formatLabel(label, warning);
  9759       // No special behavior since these rules fall back to "in body" mode for
 10371 
  9760       // all except special table nodes which cause bad parsing behavior anyway.
 10372     try {
  9761 
 10373       performance.measure(formattedLabel, formattedMarkName);
  9762       // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intr
 10374     } catch (err) {} // If previous mark was missing for some reason, this will throw.
  9763       case 'tr':
 10375     // This could only happen if React crashed in an unexpected place earlier.
  9764         return tag === 'th' || tag === 'td' || tag === 'style' || tag === 'script' || tag === 'template';
 10376     // Don't pile on with more errors.
  9765       // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intbody
 10377     // Clear marks immediately to avoid growing buffer.
  9766       case 'tbody':
 10378 
  9767       case 'thead':
 10379 
  9768       case 'tfoot':
 10380     performance.clearMarks(formattedMarkName);
  9769         return tag === 'tr' || tag === 'style' || tag === 'script' || tag === 'template';
 10381     performance.clearMeasures(formattedLabel);
  9770       // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-incolgroup
 10382   };
  9771       case 'colgroup':
 10383 
  9772         return tag === 'col' || tag === 'template';
 10384   var getFiberMarkName = function (label, debugID) {
  9773       // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intable
 10385     return label + " (#" + debugID + ")";
  9774       case 'table':
 10386   };
  9775         return tag === 'caption' || tag === 'colgroup' || tag === 'tbody' || tag === 'tfoot' || tag === 'thead' || tag === 'style' || tag === 'script' || tag === 'template';
 10387 
  9776       // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inhead
 10388   var getFiberLabel = function (componentName, isMounted, phase) {
  9777       case 'head':
 10389     if (phase === null) {
  9778         return tag === 'base' || tag === 'basefont' || tag === 'bgsound' || tag === 'link' || tag === 'meta' || tag === 'title' || tag === 'noscript' || tag === 'noframes' || tag === 'style' || tag === 'script' || tag === 'template';
 10390       // These are composite component total time measurements.
  9779       // https://html.spec.whatwg.org/multipage/semantics.html#the-html-element
 10391       return componentName + " [" + (isMounted ? 'update' : 'mount') + "]";
  9780       case 'html':
 10392     } else {
  9781         return tag === 'head' || tag === 'body' || tag === 'frameset';
 10393       // Composite component methods.
  9782       case 'frameset':
 10394       return componentName + "." + phase;
  9783         return tag === 'frame';
 10395     }
  9784       case '#document':
 10396   };
  9785         return tag === 'html';
 10397 
  9786     }
 10398   var beginFiberMark = function (fiber, phase) {
  9787 
 10399     var componentName = getComponentName(fiber.type) || 'Unknown';
  9788     // Probably in the "in body" parsing mode, so we outlaw only tag combos
 10400     var debugID = fiber._debugID;
  9789     // where the parsing rules cause implicit opens or closes to be added.
 10401     var isMounted = fiber.alternate !== null;
  9790     // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inbody
 10402     var label = getFiberLabel(componentName, isMounted, phase);
  9791     switch (tag) {
 10403 
  9792       case 'h1':
 10404     if (isCommitting && labelsInCurrentCommit.has(label)) {
  9793       case 'h2':
 10405       // During the commit phase, we don't show duplicate labels because
  9794       case 'h3':
 10406       // there is a fixed overhead for every measurement, and we don't
  9795       case 'h4':
 10407       // want to stretch the commit phase beyond necessary.
  9796       case 'h5':
 10408       return false;
  9797       case 'h6':
 10409     }
  9798         return parentTag !== 'h1' && parentTag !== 'h2' && parentTag !== 'h3' && parentTag !== 'h4' && parentTag !== 'h5' && parentTag !== 'h6';
 10410 
  9799 
 10411     labelsInCurrentCommit.add(label);
  9800       case 'rp':
 10412     var markName = getFiberMarkName(label, debugID);
  9801       case 'rt':
 10413     beginMark(markName);
  9802         return impliedEndTags.indexOf(parentTag) === -1;
       
  9803 
       
  9804       case 'body':
       
  9805       case 'caption':
       
  9806       case 'col':
       
  9807       case 'colgroup':
       
  9808       case 'frameset':
       
  9809       case 'frame':
       
  9810       case 'head':
       
  9811       case 'html':
       
  9812       case 'tbody':
       
  9813       case 'td':
       
  9814       case 'tfoot':
       
  9815       case 'th':
       
  9816       case 'thead':
       
  9817       case 'tr':
       
  9818         // These tags are only valid with a few parents that have special child
       
  9819         // parsing rules -- if we're down here, then none of those matched and
       
  9820         // so we allow it only if we don't know what the parent is, as all other
       
  9821         // cases are invalid.
       
  9822         return parentTag == null;
       
  9823     }
       
  9824 
       
  9825     return true;
 10414     return true;
  9826   };
 10415   };
  9827 
 10416 
  9828   /**
 10417   var clearFiberMark = function (fiber, phase) {
  9829    * Returns whether
 10418     var componentName = getComponentName(fiber.type) || 'Unknown';
  9830    */
 10419     var debugID = fiber._debugID;
  9831   var findInvalidAncestorForTag = function (tag, ancestorInfo) {
 10420     var isMounted = fiber.alternate !== null;
  9832     switch (tag) {
 10421     var label = getFiberLabel(componentName, isMounted, phase);
  9833       case 'address':
 10422     var markName = getFiberMarkName(label, debugID);
  9834       case 'article':
 10423     clearMark(markName);
  9835       case 'aside':
       
  9836       case 'blockquote':
       
  9837       case 'center':
       
  9838       case 'details':
       
  9839       case 'dialog':
       
  9840       case 'dir':
       
  9841       case 'div':
       
  9842       case 'dl':
       
  9843       case 'fieldset':
       
  9844       case 'figcaption':
       
  9845       case 'figure':
       
  9846       case 'footer':
       
  9847       case 'header':
       
  9848       case 'hgroup':
       
  9849       case 'main':
       
  9850       case 'menu':
       
  9851       case 'nav':
       
  9852       case 'ol':
       
  9853       case 'p':
       
  9854       case 'section':
       
  9855       case 'summary':
       
  9856       case 'ul':
       
  9857       case 'pre':
       
  9858       case 'listing':
       
  9859       case 'table':
       
  9860       case 'hr':
       
  9861       case 'xmp':
       
  9862       case 'h1':
       
  9863       case 'h2':
       
  9864       case 'h3':
       
  9865       case 'h4':
       
  9866       case 'h5':
       
  9867       case 'h6':
       
  9868         return ancestorInfo.pTagInButtonScope;
       
  9869 
       
  9870       case 'form':
       
  9871         return ancestorInfo.formTag || ancestorInfo.pTagInButtonScope;
       
  9872 
       
  9873       case 'li':
       
  9874         return ancestorInfo.listItemTagAutoclosing;
       
  9875 
       
  9876       case 'dd':
       
  9877       case 'dt':
       
  9878         return ancestorInfo.dlItemTagAutoclosing;
       
  9879 
       
  9880       case 'button':
       
  9881         return ancestorInfo.buttonTagInScope;
       
  9882 
       
  9883       case 'a':
       
  9884         // Spec says something about storing a list of markers, but it sounds
       
  9885         // equivalent to this check.
       
  9886         return ancestorInfo.aTagInScope;
       
  9887 
       
  9888       case 'nobr':
       
  9889         return ancestorInfo.nobrTagInScope;
       
  9890     }
       
  9891 
       
  9892     return null;
       
  9893   };
 10424   };
  9894 
 10425 
  9895   var didWarn$1 = {};
 10426   var endFiberMark = function (fiber, phase, warning) {
  9896 
 10427     var componentName = getComponentName(fiber.type) || 'Unknown';
  9897   validateDOMNesting = function (childTag, childText, ancestorInfo) {
 10428     var debugID = fiber._debugID;
  9898     ancestorInfo = ancestorInfo || emptyAncestorInfo;
 10429     var isMounted = fiber.alternate !== null;
  9899     var parentInfo = ancestorInfo.current;
 10430     var label = getFiberLabel(componentName, isMounted, phase);
  9900     var parentTag = parentInfo && parentInfo.tag;
 10431     var markName = getFiberMarkName(label, debugID);
  9901 
 10432     endMark(label, markName, warning);
  9902     if (childText != null) {
 10433   };
  9903       !(childTag == null) ? warningWithoutStack$1(false, 'validateDOMNesting: when childText is passed, childTag should be null') : void 0;
 10434 
  9904       childTag = '#text';
 10435   var shouldIgnoreFiber = function (fiber) {
  9905     }
 10436     // Host components should be skipped in the timeline.
  9906 
 10437     // We could check typeof fiber.type, but does this work with RN?
  9907     var invalidParent = isTagValidWithParent(childTag, parentTag) ? null : parentInfo;
 10438     switch (fiber.tag) {
  9908     var invalidAncestor = invalidParent ? null : findInvalidAncestorForTag(childTag, ancestorInfo);
 10439       case HostRoot:
  9909     var invalidParentOrAncestor = invalidParent || invalidAncestor;
 10440       case HostComponent:
  9910     if (!invalidParentOrAncestor) {
 10441       case HostText:
       
 10442       case HostPortal:
       
 10443       case Fragment:
       
 10444       case ContextProvider:
       
 10445       case ContextConsumer:
       
 10446       case Mode:
       
 10447         return true;
       
 10448 
       
 10449       default:
       
 10450         return false;
       
 10451     }
       
 10452   };
       
 10453 
       
 10454   var clearPendingPhaseMeasurement = function () {
       
 10455     if (currentPhase !== null && currentPhaseFiber !== null) {
       
 10456       clearFiberMark(currentPhaseFiber, currentPhase);
       
 10457     }
       
 10458 
       
 10459     currentPhaseFiber = null;
       
 10460     currentPhase = null;
       
 10461     hasScheduledUpdateInCurrentPhase = false;
       
 10462   };
       
 10463 
       
 10464   var pauseTimers = function () {
       
 10465     // Stops all currently active measurements so that they can be resumed
       
 10466     // if we continue in a later deferred loop from the same unit of work.
       
 10467     var fiber = currentFiber;
       
 10468 
       
 10469     while (fiber) {
       
 10470       if (fiber._debugIsCurrentlyTiming) {
       
 10471         endFiberMark(fiber, null, null);
       
 10472       }
       
 10473 
       
 10474       fiber = fiber.return;
       
 10475     }
       
 10476   };
       
 10477 
       
 10478   var resumeTimersRecursively = function (fiber) {
       
 10479     if (fiber.return !== null) {
       
 10480       resumeTimersRecursively(fiber.return);
       
 10481     }
       
 10482 
       
 10483     if (fiber._debugIsCurrentlyTiming) {
       
 10484       beginFiberMark(fiber, null);
       
 10485     }
       
 10486   };
       
 10487 
       
 10488   var resumeTimers = function () {
       
 10489     // Resumes all measurements that were active during the last deferred loop.
       
 10490     if (currentFiber !== null) {
       
 10491       resumeTimersRecursively(currentFiber);
       
 10492     }
       
 10493   };
       
 10494 
       
 10495   function recordEffect() {
       
 10496     {
       
 10497       effectCountInCurrentCommit++;
       
 10498     }
       
 10499   }
       
 10500   function recordScheduleUpdate() {
       
 10501     {
       
 10502       if (isCommitting) {
       
 10503         hasScheduledUpdateInCurrentCommit = true;
       
 10504       }
       
 10505 
       
 10506       if (currentPhase !== null && currentPhase !== 'componentWillMount' && currentPhase !== 'componentWillReceiveProps') {
       
 10507         hasScheduledUpdateInCurrentPhase = true;
       
 10508       }
       
 10509     }
       
 10510   }
       
 10511   function startWorkTimer(fiber) {
       
 10512     {
       
 10513       if (!supportsUserTiming || shouldIgnoreFiber(fiber)) {
       
 10514         return;
       
 10515       } // If we pause, this is the fiber to unwind from.
       
 10516 
       
 10517 
       
 10518       currentFiber = fiber;
       
 10519 
       
 10520       if (!beginFiberMark(fiber, null)) {
       
 10521         return;
       
 10522       }
       
 10523 
       
 10524       fiber._debugIsCurrentlyTiming = true;
       
 10525     }
       
 10526   }
       
 10527   function cancelWorkTimer(fiber) {
       
 10528     {
       
 10529       if (!supportsUserTiming || shouldIgnoreFiber(fiber)) {
       
 10530         return;
       
 10531       } // Remember we shouldn't complete measurement for this fiber.
       
 10532       // Otherwise flamechart will be deep even for small updates.
       
 10533 
       
 10534 
       
 10535       fiber._debugIsCurrentlyTiming = false;
       
 10536       clearFiberMark(fiber, null);
       
 10537     }
       
 10538   }
       
 10539   function stopWorkTimer(fiber) {
       
 10540     {
       
 10541       if (!supportsUserTiming || shouldIgnoreFiber(fiber)) {
       
 10542         return;
       
 10543       } // If we pause, its parent is the fiber to unwind from.
       
 10544 
       
 10545 
       
 10546       currentFiber = fiber.return;
       
 10547 
       
 10548       if (!fiber._debugIsCurrentlyTiming) {
       
 10549         return;
       
 10550       }
       
 10551 
       
 10552       fiber._debugIsCurrentlyTiming = false;
       
 10553       endFiberMark(fiber, null, null);
       
 10554     }
       
 10555   }
       
 10556   function stopFailedWorkTimer(fiber) {
       
 10557     {
       
 10558       if (!supportsUserTiming || shouldIgnoreFiber(fiber)) {
       
 10559         return;
       
 10560       } // If we pause, its parent is the fiber to unwind from.
       
 10561 
       
 10562 
       
 10563       currentFiber = fiber.return;
       
 10564 
       
 10565       if (!fiber._debugIsCurrentlyTiming) {
       
 10566         return;
       
 10567       }
       
 10568 
       
 10569       fiber._debugIsCurrentlyTiming = false;
       
 10570       var warning = fiber.tag === SuspenseComponent ? 'Rendering was suspended' : 'An error was thrown inside this error boundary';
       
 10571       endFiberMark(fiber, null, warning);
       
 10572     }
       
 10573   }
       
 10574   function startPhaseTimer(fiber, phase) {
       
 10575     {
       
 10576       if (!supportsUserTiming) {
       
 10577         return;
       
 10578       }
       
 10579 
       
 10580       clearPendingPhaseMeasurement();
       
 10581 
       
 10582       if (!beginFiberMark(fiber, phase)) {
       
 10583         return;
       
 10584       }
       
 10585 
       
 10586       currentPhaseFiber = fiber;
       
 10587       currentPhase = phase;
       
 10588     }
       
 10589   }
       
 10590   function stopPhaseTimer() {
       
 10591     {
       
 10592       if (!supportsUserTiming) {
       
 10593         return;
       
 10594       }
       
 10595 
       
 10596       if (currentPhase !== null && currentPhaseFiber !== null) {
       
 10597         var warning = hasScheduledUpdateInCurrentPhase ? 'Scheduled a cascading update' : null;
       
 10598         endFiberMark(currentPhaseFiber, currentPhase, warning);
       
 10599       }
       
 10600 
       
 10601       currentPhase = null;
       
 10602       currentPhaseFiber = null;
       
 10603     }
       
 10604   }
       
 10605   function startWorkLoopTimer(nextUnitOfWork) {
       
 10606     {
       
 10607       currentFiber = nextUnitOfWork;
       
 10608 
       
 10609       if (!supportsUserTiming) {
       
 10610         return;
       
 10611       }
       
 10612 
       
 10613       commitCountInCurrentWorkLoop = 0; // This is top level call.
       
 10614       // Any other measurements are performed within.
       
 10615 
       
 10616       beginMark('(React Tree Reconciliation)'); // Resume any measurements that were in progress during the last loop.
       
 10617 
       
 10618       resumeTimers();
       
 10619     }
       
 10620   }
       
 10621   function stopWorkLoopTimer(interruptedBy, didCompleteRoot) {
       
 10622     {
       
 10623       if (!supportsUserTiming) {
       
 10624         return;
       
 10625       }
       
 10626 
       
 10627       var warning = null;
       
 10628 
       
 10629       if (interruptedBy !== null) {
       
 10630         if (interruptedBy.tag === HostRoot) {
       
 10631           warning = 'A top-level update interrupted the previous render';
       
 10632         } else {
       
 10633           var componentName = getComponentName(interruptedBy.type) || 'Unknown';
       
 10634           warning = "An update to " + componentName + " interrupted the previous render";
       
 10635         }
       
 10636       } else if (commitCountInCurrentWorkLoop > 1) {
       
 10637         warning = 'There were cascading updates';
       
 10638       }
       
 10639 
       
 10640       commitCountInCurrentWorkLoop = 0;
       
 10641       var label = didCompleteRoot ? '(React Tree Reconciliation: Completed Root)' : '(React Tree Reconciliation: Yielded)'; // Pause any measurements until the next loop.
       
 10642 
       
 10643       pauseTimers();
       
 10644       endMark(label, '(React Tree Reconciliation)', warning);
       
 10645     }
       
 10646   }
       
 10647   function startCommitTimer() {
       
 10648     {
       
 10649       if (!supportsUserTiming) {
       
 10650         return;
       
 10651       }
       
 10652 
       
 10653       isCommitting = true;
       
 10654       hasScheduledUpdateInCurrentCommit = false;
       
 10655       labelsInCurrentCommit.clear();
       
 10656       beginMark('(Committing Changes)');
       
 10657     }
       
 10658   }
       
 10659   function stopCommitTimer() {
       
 10660     {
       
 10661       if (!supportsUserTiming) {
       
 10662         return;
       
 10663       }
       
 10664 
       
 10665       var warning = null;
       
 10666 
       
 10667       if (hasScheduledUpdateInCurrentCommit) {
       
 10668         warning = 'Lifecycle hook scheduled a cascading update';
       
 10669       } else if (commitCountInCurrentWorkLoop > 0) {
       
 10670         warning = 'Caused by a cascading update in earlier commit';
       
 10671       }
       
 10672 
       
 10673       hasScheduledUpdateInCurrentCommit = false;
       
 10674       commitCountInCurrentWorkLoop++;
       
 10675       isCommitting = false;
       
 10676       labelsInCurrentCommit.clear();
       
 10677       endMark('(Committing Changes)', '(Committing Changes)', warning);
       
 10678     }
       
 10679   }
       
 10680   function startCommitSnapshotEffectsTimer() {
       
 10681     {
       
 10682       if (!supportsUserTiming) {
       
 10683         return;
       
 10684       }
       
 10685 
       
 10686       effectCountInCurrentCommit = 0;
       
 10687       beginMark('(Committing Snapshot Effects)');
       
 10688     }
       
 10689   }
       
 10690   function stopCommitSnapshotEffectsTimer() {
       
 10691     {
       
 10692       if (!supportsUserTiming) {
       
 10693         return;
       
 10694       }
       
 10695 
       
 10696       var count = effectCountInCurrentCommit;
       
 10697       effectCountInCurrentCommit = 0;
       
 10698       endMark("(Committing Snapshot Effects: " + count + " Total)", '(Committing Snapshot Effects)', null);
       
 10699     }
       
 10700   }
       
 10701   function startCommitHostEffectsTimer() {
       
 10702     {
       
 10703       if (!supportsUserTiming) {
       
 10704         return;
       
 10705       }
       
 10706 
       
 10707       effectCountInCurrentCommit = 0;
       
 10708       beginMark('(Committing Host Effects)');
       
 10709     }
       
 10710   }
       
 10711   function stopCommitHostEffectsTimer() {
       
 10712     {
       
 10713       if (!supportsUserTiming) {
       
 10714         return;
       
 10715       }
       
 10716 
       
 10717       var count = effectCountInCurrentCommit;
       
 10718       effectCountInCurrentCommit = 0;
       
 10719       endMark("(Committing Host Effects: " + count + " Total)", '(Committing Host Effects)', null);
       
 10720     }
       
 10721   }
       
 10722   function startCommitLifeCyclesTimer() {
       
 10723     {
       
 10724       if (!supportsUserTiming) {
       
 10725         return;
       
 10726       }
       
 10727 
       
 10728       effectCountInCurrentCommit = 0;
       
 10729       beginMark('(Calling Lifecycle Methods)');
       
 10730     }
       
 10731   }
       
 10732   function stopCommitLifeCyclesTimer() {
       
 10733     {
       
 10734       if (!supportsUserTiming) {
       
 10735         return;
       
 10736       }
       
 10737 
       
 10738       var count = effectCountInCurrentCommit;
       
 10739       effectCountInCurrentCommit = 0;
       
 10740       endMark("(Calling Lifecycle Methods: " + count + " Total)", '(Calling Lifecycle Methods)', null);
       
 10741     }
       
 10742   }
       
 10743 
       
 10744   var valueStack = [];
       
 10745   var fiberStack;
       
 10746 
       
 10747   {
       
 10748     fiberStack = [];
       
 10749   }
       
 10750 
       
 10751   var index = -1;
       
 10752 
       
 10753   function createCursor(defaultValue) {
       
 10754     return {
       
 10755       current: defaultValue
       
 10756     };
       
 10757   }
       
 10758 
       
 10759   function pop(cursor, fiber) {
       
 10760     if (index < 0) {
       
 10761       {
       
 10762         error('Unexpected pop.');
       
 10763       }
       
 10764 
  9911       return;
 10765       return;
  9912     }
 10766     }
  9913 
 10767 
  9914     var ancestorTag = invalidParentOrAncestor.tag;
       
  9915     var addendum = getCurrentFiberStackInDev();
       
  9916 
       
  9917     var warnKey = !!invalidParent + '|' + childTag + '|' + ancestorTag + '|' + addendum;
       
  9918     if (didWarn$1[warnKey]) {
       
  9919       return;
       
  9920     }
       
  9921     didWarn$1[warnKey] = true;
       
  9922 
       
  9923     var tagDisplayName = childTag;
       
  9924     var whitespaceInfo = '';
       
  9925     if (childTag === '#text') {
       
  9926       if (/\S/.test(childText)) {
       
  9927         tagDisplayName = 'Text nodes';
       
  9928       } else {
       
  9929         tagDisplayName = 'Whitespace text nodes';
       
  9930         whitespaceInfo = " Make sure you don't have any extra whitespace between tags on " + 'each line of your source code.';
       
  9931       }
       
  9932     } else {
       
  9933       tagDisplayName = '<' + childTag + '>';
       
  9934     }
       
  9935 
       
  9936     if (invalidParent) {
       
  9937       var info = '';
       
  9938       if (ancestorTag === 'table' && childTag === 'tr') {
       
  9939         info += ' Add a <tbody> to your code to match the DOM tree generated by ' + 'the browser.';
       
  9940       }
       
  9941       warningWithoutStack$1(false, 'validateDOMNesting(...): %s cannot appear as a child of <%s>.%s%s%s', tagDisplayName, ancestorTag, whitespaceInfo, info, addendum);
       
  9942     } else {
       
  9943       warningWithoutStack$1(false, 'validateDOMNesting(...): %s cannot appear as a descendant of ' + '<%s>.%s', tagDisplayName, ancestorTag, addendum);
       
  9944     }
       
  9945   };
       
  9946 }
       
  9947 
       
  9948 // Renderers that don't support persistence
       
  9949 // can re-export everything from this module.
       
  9950 
       
  9951 function shim() {
       
  9952   (function () {
       
  9953     {
 10768     {
       
 10769       if (fiber !== fiberStack[index]) {
       
 10770         error('Unexpected Fiber popped.');
       
 10771       }
       
 10772     }
       
 10773 
       
 10774     cursor.current = valueStack[index];
       
 10775     valueStack[index] = null;
       
 10776 
       
 10777     {
       
 10778       fiberStack[index] = null;
       
 10779     }
       
 10780 
       
 10781     index--;
       
 10782   }
       
 10783 
       
 10784   function push(cursor, value, fiber) {
       
 10785     index++;
       
 10786     valueStack[index] = cursor.current;
       
 10787 
       
 10788     {
       
 10789       fiberStack[index] = fiber;
       
 10790     }
       
 10791 
       
 10792     cursor.current = value;
       
 10793   }
       
 10794 
       
 10795   var warnedAboutMissingGetChildContext;
       
 10796 
       
 10797   {
       
 10798     warnedAboutMissingGetChildContext = {};
       
 10799   }
       
 10800 
       
 10801   var emptyContextObject = {};
       
 10802 
       
 10803   {
       
 10804     Object.freeze(emptyContextObject);
       
 10805   } // A cursor to the current merged context object on the stack.
       
 10806 
       
 10807 
       
 10808   var contextStackCursor = createCursor(emptyContextObject); // A cursor to a boolean indicating whether the context has changed.
       
 10809 
       
 10810   var didPerformWorkStackCursor = createCursor(false); // Keep track of the previous context object that was on the stack.
       
 10811   // We use this to get access to the parent context after we have already
       
 10812   // pushed the next context provider, and now need to merge their contexts.
       
 10813 
       
 10814   var previousContext = emptyContextObject;
       
 10815 
       
 10816   function getUnmaskedContext(workInProgress, Component, didPushOwnContextIfProvider) {
       
 10817     {
       
 10818       if (didPushOwnContextIfProvider && isContextProvider(Component)) {
       
 10819         // If the fiber is a context provider itself, when we read its context
       
 10820         // we may have already pushed its own child context on the stack. A context
       
 10821         // provider should not "see" its own child context. Therefore we read the
       
 10822         // previous (parent) context instead for a context provider.
       
 10823         return previousContext;
       
 10824       }
       
 10825 
       
 10826       return contextStackCursor.current;
       
 10827     }
       
 10828   }
       
 10829 
       
 10830   function cacheContext(workInProgress, unmaskedContext, maskedContext) {
       
 10831     {
       
 10832       var instance = workInProgress.stateNode;
       
 10833       instance.__reactInternalMemoizedUnmaskedChildContext = unmaskedContext;
       
 10834       instance.__reactInternalMemoizedMaskedChildContext = maskedContext;
       
 10835     }
       
 10836   }
       
 10837 
       
 10838   function getMaskedContext(workInProgress, unmaskedContext) {
       
 10839     {
       
 10840       var type = workInProgress.type;
       
 10841       var contextTypes = type.contextTypes;
       
 10842 
       
 10843       if (!contextTypes) {
       
 10844         return emptyContextObject;
       
 10845       } // Avoid recreating masked context unless unmasked context has changed.
       
 10846       // Failing to do this will result in unnecessary calls to componentWillReceiveProps.
       
 10847       // This may trigger infinite loops if componentWillReceiveProps calls setState.
       
 10848 
       
 10849 
       
 10850       var instance = workInProgress.stateNode;
       
 10851 
       
 10852       if (instance && instance.__reactInternalMemoizedUnmaskedChildContext === unmaskedContext) {
       
 10853         return instance.__reactInternalMemoizedMaskedChildContext;
       
 10854       }
       
 10855 
       
 10856       var context = {};
       
 10857 
       
 10858       for (var key in contextTypes) {
       
 10859         context[key] = unmaskedContext[key];
       
 10860       }
       
 10861 
  9954       {
 10862       {
  9955         throw ReactError(Error('The current renderer does not support persistence. This error is likely caused by a bug in React. Please file an issue.'));
 10863         var name = getComponentName(type) || 'Unknown';
  9956       }
 10864         checkPropTypes_1(contextTypes, context, 'context', name, getCurrentFiberStackInDev);
  9957     }
 10865       } // Cache unmasked context so we can avoid recreating masked context unless necessary.
  9958   })();
 10866       // Context is created before the class component is instantiated so check for instance.
  9959 }
 10867 
  9960 
 10868 
  9961 // Persistence (when unsupported)
 10869       if (instance) {
  9962 var supportsPersistence = false;
 10870         cacheContext(workInProgress, unmaskedContext, context);
  9963 var cloneInstance = shim;
 10871       }
  9964 var cloneFundamentalInstance = shim;
 10872 
  9965 var createContainerChildSet = shim;
 10873       return context;
  9966 var appendChildToContainerChildSet = shim;
 10874     }
  9967 var finalizeContainerChildren = shim;
 10875   }
  9968 var replaceContainerChildren = shim;
 10876 
  9969 var cloneHiddenInstance = shim;
 10877   function hasContextChanged() {
  9970 var cloneHiddenTextInstance = shim;
       
  9971 
       
  9972 var SUPPRESS_HYDRATION_WARNING = void 0;
       
  9973 {
       
  9974   SUPPRESS_HYDRATION_WARNING = 'suppressHydrationWarning';
       
  9975 }
       
  9976 
       
  9977 var SUSPENSE_START_DATA = '$';
       
  9978 var SUSPENSE_END_DATA = '/$';
       
  9979 var SUSPENSE_PENDING_START_DATA = '$?';
       
  9980 var SUSPENSE_FALLBACK_START_DATA = '$!';
       
  9981 
       
  9982 var STYLE = 'style';
       
  9983 
       
  9984 var eventsEnabled = null;
       
  9985 var selectionInformation = null;
       
  9986 
       
  9987 function shouldAutoFocusHostComponent(type, props) {
       
  9988   switch (type) {
       
  9989     case 'button':
       
  9990     case 'input':
       
  9991     case 'select':
       
  9992     case 'textarea':
       
  9993       return !!props.autoFocus;
       
  9994   }
       
  9995   return false;
       
  9996 }
       
  9997 
       
  9998 function getRootHostContext(rootContainerInstance) {
       
  9999   var type = void 0;
       
 10000   var namespace = void 0;
       
 10001   var nodeType = rootContainerInstance.nodeType;
       
 10002   switch (nodeType) {
       
 10003     case DOCUMENT_NODE:
       
 10004     case DOCUMENT_FRAGMENT_NODE:
       
 10005       {
       
 10006         type = nodeType === DOCUMENT_NODE ? '#document' : '#fragment';
       
 10007         var root = rootContainerInstance.documentElement;
       
 10008         namespace = root ? root.namespaceURI : getChildNamespace(null, '');
       
 10009         break;
       
 10010       }
       
 10011     default:
       
 10012       {
       
 10013         var container = nodeType === COMMENT_NODE ? rootContainerInstance.parentNode : rootContainerInstance;
       
 10014         var ownNamespace = container.namespaceURI || null;
       
 10015         type = container.tagName;
       
 10016         namespace = getChildNamespace(ownNamespace, type);
       
 10017         break;
       
 10018       }
       
 10019   }
       
 10020   {
       
 10021     var validatedTag = type.toLowerCase();
       
 10022     var _ancestorInfo = updatedAncestorInfo(null, validatedTag);
       
 10023     return { namespace: namespace, ancestorInfo: _ancestorInfo };
       
 10024   }
       
 10025   return namespace;
       
 10026 }
       
 10027 
       
 10028 function getChildHostContext(parentHostContext, type, rootContainerInstance) {
       
 10029   {
       
 10030     var parentHostContextDev = parentHostContext;
       
 10031     var _namespace = getChildNamespace(parentHostContextDev.namespace, type);
       
 10032     var _ancestorInfo2 = updatedAncestorInfo(parentHostContextDev.ancestorInfo, type);
       
 10033     return { namespace: _namespace, ancestorInfo: _ancestorInfo2 };
       
 10034   }
       
 10035   var parentNamespace = parentHostContext;
       
 10036   return getChildNamespace(parentNamespace, type);
       
 10037 }
       
 10038 
       
 10039 function getPublicInstance(instance) {
       
 10040   return instance;
       
 10041 }
       
 10042 
       
 10043 function prepareForCommit(containerInfo) {
       
 10044   eventsEnabled = isEnabled();
       
 10045   selectionInformation = getSelectionInformation();
       
 10046   setEnabled(false);
       
 10047 }
       
 10048 
       
 10049 function resetAfterCommit(containerInfo) {
       
 10050   restoreSelection(selectionInformation);
       
 10051   selectionInformation = null;
       
 10052   setEnabled(eventsEnabled);
       
 10053   eventsEnabled = null;
       
 10054 }
       
 10055 
       
 10056 function createInstance(type, props, rootContainerInstance, hostContext, internalInstanceHandle) {
       
 10057   var parentNamespace = void 0;
       
 10058   {
       
 10059     // TODO: take namespace into account when validating.
       
 10060     var hostContextDev = hostContext;
       
 10061     validateDOMNesting(type, null, hostContextDev.ancestorInfo);
       
 10062     if (typeof props.children === 'string' || typeof props.children === 'number') {
       
 10063       var string = '' + props.children;
       
 10064       var ownAncestorInfo = updatedAncestorInfo(hostContextDev.ancestorInfo, type);
       
 10065       validateDOMNesting(null, string, ownAncestorInfo);
       
 10066     }
       
 10067     parentNamespace = hostContextDev.namespace;
       
 10068   }
       
 10069   var domElement = createElement(type, props, rootContainerInstance, parentNamespace);
       
 10070   precacheFiberNode(internalInstanceHandle, domElement);
       
 10071   updateFiberProps(domElement, props);
       
 10072   return domElement;
       
 10073 }
       
 10074 
       
 10075 function appendInitialChild(parentInstance, child) {
       
 10076   parentInstance.appendChild(child);
       
 10077 }
       
 10078 
       
 10079 function finalizeInitialChildren(domElement, type, props, rootContainerInstance, hostContext) {
       
 10080   setInitialProperties(domElement, type, props, rootContainerInstance);
       
 10081   return shouldAutoFocusHostComponent(type, props);
       
 10082 }
       
 10083 
       
 10084 function prepareUpdate(domElement, type, oldProps, newProps, rootContainerInstance, hostContext) {
       
 10085   {
       
 10086     var hostContextDev = hostContext;
       
 10087     if (typeof newProps.children !== typeof oldProps.children && (typeof newProps.children === 'string' || typeof newProps.children === 'number')) {
       
 10088       var string = '' + newProps.children;
       
 10089       var ownAncestorInfo = updatedAncestorInfo(hostContextDev.ancestorInfo, type);
       
 10090       validateDOMNesting(null, string, ownAncestorInfo);
       
 10091     }
       
 10092   }
       
 10093   return diffProperties(domElement, type, oldProps, newProps, rootContainerInstance);
       
 10094 }
       
 10095 
       
 10096 function shouldSetTextContent(type, props) {
       
 10097   return type === 'textarea' || type === 'option' || type === 'noscript' || typeof props.children === 'string' || typeof props.children === 'number' || typeof props.dangerouslySetInnerHTML === 'object' && props.dangerouslySetInnerHTML !== null && props.dangerouslySetInnerHTML.__html != null;
       
 10098 }
       
 10099 
       
 10100 function shouldDeprioritizeSubtree(type, props) {
       
 10101   return !!props.hidden;
       
 10102 }
       
 10103 
       
 10104 function createTextInstance(text, rootContainerInstance, hostContext, internalInstanceHandle) {
       
 10105   {
       
 10106     var hostContextDev = hostContext;
       
 10107     validateDOMNesting(null, text, hostContextDev.ancestorInfo);
       
 10108   }
       
 10109   var textNode = createTextNode(text, rootContainerInstance);
       
 10110   precacheFiberNode(internalInstanceHandle, textNode);
       
 10111   return textNode;
       
 10112 }
       
 10113 
       
 10114 var isPrimaryRenderer = true;
       
 10115 var warnsIfNotActing = true;
       
 10116 // This initialization code may run even on server environments
       
 10117 // if a component just imports ReactDOM (e.g. for findDOMNode).
       
 10118 // Some environments might not have setTimeout or clearTimeout.
       
 10119 var scheduleTimeout = typeof setTimeout === 'function' ? setTimeout : undefined;
       
 10120 var cancelTimeout = typeof clearTimeout === 'function' ? clearTimeout : undefined;
       
 10121 var noTimeout = -1;
       
 10122 
       
 10123 // -------------------
       
 10124 //     Mutation
       
 10125 // -------------------
       
 10126 
       
 10127 var supportsMutation = true;
       
 10128 
       
 10129 function commitMount(domElement, type, newProps, internalInstanceHandle) {
       
 10130   // Despite the naming that might imply otherwise, this method only
       
 10131   // fires if there is an `Update` effect scheduled during mounting.
       
 10132   // This happens if `finalizeInitialChildren` returns `true` (which it
       
 10133   // does to implement the `autoFocus` attribute on the client). But
       
 10134   // there are also other cases when this might happen (such as patching
       
 10135   // up text content during hydration mismatch). So we'll check this again.
       
 10136   if (shouldAutoFocusHostComponent(type, newProps)) {
       
 10137     domElement.focus();
       
 10138   }
       
 10139 }
       
 10140 
       
 10141 function commitUpdate(domElement, updatePayload, type, oldProps, newProps, internalInstanceHandle) {
       
 10142   // Update the props handle so that we know which props are the ones with
       
 10143   // with current event handlers.
       
 10144   updateFiberProps(domElement, newProps);
       
 10145   // Apply the diff to the DOM node.
       
 10146   updateProperties(domElement, updatePayload, type, oldProps, newProps);
       
 10147 }
       
 10148 
       
 10149 function resetTextContent(domElement) {
       
 10150   setTextContent(domElement, '');
       
 10151 }
       
 10152 
       
 10153 function commitTextUpdate(textInstance, oldText, newText) {
       
 10154   textInstance.nodeValue = newText;
       
 10155 }
       
 10156 
       
 10157 function appendChild(parentInstance, child) {
       
 10158   parentInstance.appendChild(child);
       
 10159 }
       
 10160 
       
 10161 function appendChildToContainer(container, child) {
       
 10162   var parentNode = void 0;
       
 10163   if (container.nodeType === COMMENT_NODE) {
       
 10164     parentNode = container.parentNode;
       
 10165     parentNode.insertBefore(child, container);
       
 10166   } else {
       
 10167     parentNode = container;
       
 10168     parentNode.appendChild(child);
       
 10169   }
       
 10170   // This container might be used for a portal.
       
 10171   // If something inside a portal is clicked, that click should bubble
       
 10172   // through the React tree. However, on Mobile Safari the click would
       
 10173   // never bubble through the *DOM* tree unless an ancestor with onclick
       
 10174   // event exists. So we wouldn't see it and dispatch it.
       
 10175   // This is why we ensure that non React root containers have inline onclick
       
 10176   // defined.
       
 10177   // https://github.com/facebook/react/issues/11918
       
 10178   var reactRootContainer = container._reactRootContainer;
       
 10179   if ((reactRootContainer === null || reactRootContainer === undefined) && parentNode.onclick === null) {
       
 10180     // TODO: This cast may not be sound for SVG, MathML or custom elements.
       
 10181     trapClickOnNonInteractiveElement(parentNode);
       
 10182   }
       
 10183 }
       
 10184 
       
 10185 function insertBefore(parentInstance, child, beforeChild) {
       
 10186   parentInstance.insertBefore(child, beforeChild);
       
 10187 }
       
 10188 
       
 10189 function insertInContainerBefore(container, child, beforeChild) {
       
 10190   if (container.nodeType === COMMENT_NODE) {
       
 10191     container.parentNode.insertBefore(child, beforeChild);
       
 10192   } else {
       
 10193     container.insertBefore(child, beforeChild);
       
 10194   }
       
 10195 }
       
 10196 
       
 10197 function removeChild(parentInstance, child) {
       
 10198   parentInstance.removeChild(child);
       
 10199 }
       
 10200 
       
 10201 function removeChildFromContainer(container, child) {
       
 10202   if (container.nodeType === COMMENT_NODE) {
       
 10203     container.parentNode.removeChild(child);
       
 10204   } else {
       
 10205     container.removeChild(child);
       
 10206   }
       
 10207 }
       
 10208 
       
 10209 function clearSuspenseBoundary(parentInstance, suspenseInstance) {
       
 10210   var node = suspenseInstance;
       
 10211   // Delete all nodes within this suspense boundary.
       
 10212   // There might be nested nodes so we need to keep track of how
       
 10213   // deep we are and only break out when we're back on top.
       
 10214   var depth = 0;
       
 10215   do {
       
 10216     var nextNode = node.nextSibling;
       
 10217     parentInstance.removeChild(node);
       
 10218     if (nextNode && nextNode.nodeType === COMMENT_NODE) {
       
 10219       var data = nextNode.data;
       
 10220       if (data === SUSPENSE_END_DATA) {
       
 10221         if (depth === 0) {
       
 10222           parentInstance.removeChild(nextNode);
       
 10223           return;
       
 10224         } else {
       
 10225           depth--;
       
 10226         }
       
 10227       } else if (data === SUSPENSE_START_DATA || data === SUSPENSE_PENDING_START_DATA || data === SUSPENSE_FALLBACK_START_DATA) {
       
 10228         depth++;
       
 10229       }
       
 10230     }
       
 10231     node = nextNode;
       
 10232   } while (node);
       
 10233   // TODO: Warn, we didn't find the end comment boundary.
       
 10234 }
       
 10235 
       
 10236 function clearSuspenseBoundaryFromContainer(container, suspenseInstance) {
       
 10237   if (container.nodeType === COMMENT_NODE) {
       
 10238     clearSuspenseBoundary(container.parentNode, suspenseInstance);
       
 10239   } else if (container.nodeType === ELEMENT_NODE) {
       
 10240     clearSuspenseBoundary(container, suspenseInstance);
       
 10241   } else {
       
 10242     // Document nodes should never contain suspense boundaries.
       
 10243   }
       
 10244 }
       
 10245 
       
 10246 function hideInstance(instance) {
       
 10247   // TODO: Does this work for all element types? What about MathML? Should we
       
 10248   // pass host context to this method?
       
 10249   instance = instance;
       
 10250   var style = instance.style;
       
 10251   if (typeof style.setProperty === 'function') {
       
 10252     style.setProperty('display', 'none', 'important');
       
 10253   } else {
       
 10254     style.display = 'none';
       
 10255   }
       
 10256 }
       
 10257 
       
 10258 function hideTextInstance(textInstance) {
       
 10259   textInstance.nodeValue = '';
       
 10260 }
       
 10261 
       
 10262 function unhideInstance(instance, props) {
       
 10263   instance = instance;
       
 10264   var styleProp = props[STYLE];
       
 10265   var display = styleProp !== undefined && styleProp !== null && styleProp.hasOwnProperty('display') ? styleProp.display : null;
       
 10266   instance.style.display = dangerousStyleValue('display', display);
       
 10267 }
       
 10268 
       
 10269 function unhideTextInstance(textInstance, text) {
       
 10270   textInstance.nodeValue = text;
       
 10271 }
       
 10272 
       
 10273 // -------------------
       
 10274 //     Hydration
       
 10275 // -------------------
       
 10276 
       
 10277 var supportsHydration = true;
       
 10278 
       
 10279 function canHydrateInstance(instance, type, props) {
       
 10280   if (instance.nodeType !== ELEMENT_NODE || type.toLowerCase() !== instance.nodeName.toLowerCase()) {
       
 10281     return null;
       
 10282   }
       
 10283   // This has now been refined to an element node.
       
 10284   return instance;
       
 10285 }
       
 10286 
       
 10287 function canHydrateTextInstance(instance, text) {
       
 10288   if (text === '' || instance.nodeType !== TEXT_NODE) {
       
 10289     // Empty strings are not parsed by HTML so there won't be a correct match here.
       
 10290     return null;
       
 10291   }
       
 10292   // This has now been refined to a text node.
       
 10293   return instance;
       
 10294 }
       
 10295 
       
 10296 function canHydrateSuspenseInstance(instance) {
       
 10297   if (instance.nodeType !== COMMENT_NODE) {
       
 10298     // Empty strings are not parsed by HTML so there won't be a correct match here.
       
 10299     return null;
       
 10300   }
       
 10301   // This has now been refined to a suspense node.
       
 10302   return instance;
       
 10303 }
       
 10304 
       
 10305 function isSuspenseInstancePending(instance) {
       
 10306   return instance.data === SUSPENSE_PENDING_START_DATA;
       
 10307 }
       
 10308 
       
 10309 function isSuspenseInstanceFallback(instance) {
       
 10310   return instance.data === SUSPENSE_FALLBACK_START_DATA;
       
 10311 }
       
 10312 
       
 10313 function registerSuspenseInstanceRetry(instance, callback) {
       
 10314   instance._reactRetry = callback;
       
 10315 }
       
 10316 
       
 10317 function getNextHydratable(node) {
       
 10318   // Skip non-hydratable nodes.
       
 10319   for (; node != null; node = node.nextSibling) {
       
 10320     var nodeType = node.nodeType;
       
 10321     if (nodeType === ELEMENT_NODE || nodeType === TEXT_NODE) {
       
 10322       break;
       
 10323     }
       
 10324     if (enableSuspenseServerRenderer) {
       
 10325       if (nodeType === COMMENT_NODE) {
       
 10326         break;
       
 10327       }
       
 10328       var nodeData = node.data;
       
 10329       if (nodeData === SUSPENSE_START_DATA || nodeData === SUSPENSE_FALLBACK_START_DATA || nodeData === SUSPENSE_PENDING_START_DATA) {
       
 10330         break;
       
 10331       }
       
 10332     }
       
 10333   }
       
 10334   return node;
       
 10335 }
       
 10336 
       
 10337 function getNextHydratableSibling(instance) {
       
 10338   return getNextHydratable(instance.nextSibling);
       
 10339 }
       
 10340 
       
 10341 function getFirstHydratableChild(parentInstance) {
       
 10342   return getNextHydratable(parentInstance.firstChild);
       
 10343 }
       
 10344 
       
 10345 function hydrateInstance(instance, type, props, rootContainerInstance, hostContext, internalInstanceHandle) {
       
 10346   precacheFiberNode(internalInstanceHandle, instance);
       
 10347   // TODO: Possibly defer this until the commit phase where all the events
       
 10348   // get attached.
       
 10349   updateFiberProps(instance, props);
       
 10350   var parentNamespace = void 0;
       
 10351   {
       
 10352     var hostContextDev = hostContext;
       
 10353     parentNamespace = hostContextDev.namespace;
       
 10354   }
       
 10355   return diffHydratedProperties(instance, type, props, parentNamespace, rootContainerInstance);
       
 10356 }
       
 10357 
       
 10358 function hydrateTextInstance(textInstance, text, internalInstanceHandle) {
       
 10359   precacheFiberNode(internalInstanceHandle, textInstance);
       
 10360   return diffHydratedText(textInstance, text);
       
 10361 }
       
 10362 
       
 10363 function getNextHydratableInstanceAfterSuspenseInstance(suspenseInstance) {
       
 10364   var node = suspenseInstance.nextSibling;
       
 10365   // Skip past all nodes within this suspense boundary.
       
 10366   // There might be nested nodes so we need to keep track of how
       
 10367   // deep we are and only break out when we're back on top.
       
 10368   var depth = 0;
       
 10369   while (node) {
       
 10370     if (node.nodeType === COMMENT_NODE) {
       
 10371       var data = node.data;
       
 10372       if (data === SUSPENSE_END_DATA) {
       
 10373         if (depth === 0) {
       
 10374           return getNextHydratableSibling(node);
       
 10375         } else {
       
 10376           depth--;
       
 10377         }
       
 10378       } else if (data === SUSPENSE_START_DATA) {
       
 10379         depth++;
       
 10380       }
       
 10381     }
       
 10382     node = node.nextSibling;
       
 10383   }
       
 10384   // TODO: Warn, we didn't find the end comment boundary.
       
 10385   return null;
       
 10386 }
       
 10387 
       
 10388 function didNotMatchHydratedContainerTextInstance(parentContainer, textInstance, text) {
       
 10389   {
       
 10390     warnForUnmatchedText(textInstance, text);
       
 10391   }
       
 10392 }
       
 10393 
       
 10394 function didNotMatchHydratedTextInstance(parentType, parentProps, parentInstance, textInstance, text) {
       
 10395   if (true && parentProps[SUPPRESS_HYDRATION_WARNING] !== true) {
       
 10396     warnForUnmatchedText(textInstance, text);
       
 10397   }
       
 10398 }
       
 10399 
       
 10400 function didNotHydrateContainerInstance(parentContainer, instance) {
       
 10401   {
       
 10402     if (instance.nodeType === ELEMENT_NODE) {
       
 10403       warnForDeletedHydratableElement(parentContainer, instance);
       
 10404     } else if (instance.nodeType === COMMENT_NODE) {
       
 10405       // TODO: warnForDeletedHydratableSuspenseBoundary
       
 10406     } else {
       
 10407       warnForDeletedHydratableText(parentContainer, instance);
       
 10408     }
       
 10409   }
       
 10410 }
       
 10411 
       
 10412 function didNotHydrateInstance(parentType, parentProps, parentInstance, instance) {
       
 10413   if (true && parentProps[SUPPRESS_HYDRATION_WARNING] !== true) {
       
 10414     if (instance.nodeType === ELEMENT_NODE) {
       
 10415       warnForDeletedHydratableElement(parentInstance, instance);
       
 10416     } else if (instance.nodeType === COMMENT_NODE) {
       
 10417       // TODO: warnForDeletedHydratableSuspenseBoundary
       
 10418     } else {
       
 10419       warnForDeletedHydratableText(parentInstance, instance);
       
 10420     }
       
 10421   }
       
 10422 }
       
 10423 
       
 10424 function didNotFindHydratableContainerInstance(parentContainer, type, props) {
       
 10425   {
       
 10426     warnForInsertedHydratedElement(parentContainer, type, props);
       
 10427   }
       
 10428 }
       
 10429 
       
 10430 function didNotFindHydratableContainerTextInstance(parentContainer, text) {
       
 10431   {
       
 10432     warnForInsertedHydratedText(parentContainer, text);
       
 10433   }
       
 10434 }
       
 10435 
       
 10436 
       
 10437 
       
 10438 function didNotFindHydratableInstance(parentType, parentProps, parentInstance, type, props) {
       
 10439   if (true && parentProps[SUPPRESS_HYDRATION_WARNING] !== true) {
       
 10440     warnForInsertedHydratedElement(parentInstance, type, props);
       
 10441   }
       
 10442 }
       
 10443 
       
 10444 function didNotFindHydratableTextInstance(parentType, parentProps, parentInstance, text) {
       
 10445   if (true && parentProps[SUPPRESS_HYDRATION_WARNING] !== true) {
       
 10446     warnForInsertedHydratedText(parentInstance, text);
       
 10447   }
       
 10448 }
       
 10449 
       
 10450 function didNotFindHydratableSuspenseInstance(parentType, parentProps, parentInstance) {
       
 10451   if (true && parentProps[SUPPRESS_HYDRATION_WARNING] !== true) {
       
 10452     // TODO: warnForInsertedHydratedSuspense(parentInstance);
       
 10453   }
       
 10454 }
       
 10455 
       
 10456 function mountResponderInstance(responder, responderInstance, responderProps, responderState, instance, rootContainerInstance) {
       
 10457   // Listen to events
       
 10458   var doc = rootContainerInstance.ownerDocument;
       
 10459   var documentBody = doc.body || doc;
       
 10460   var _ref = responder,
       
 10461       rootEventTypes = _ref.rootEventTypes,
       
 10462       targetEventTypes = _ref.targetEventTypes;
       
 10463 
       
 10464   if (targetEventTypes !== null) {
       
 10465     listenToEventResponderEventTypes(targetEventTypes, documentBody);
       
 10466   }
       
 10467   if (rootEventTypes !== null) {
       
 10468     addRootEventTypesForResponderInstance(responderInstance, rootEventTypes);
       
 10469     listenToEventResponderEventTypes(rootEventTypes, documentBody);
       
 10470   }
       
 10471   mountEventResponder(responder, responderInstance, responderProps, responderState);
       
 10472   return responderInstance;
       
 10473 }
       
 10474 
       
 10475 function unmountResponderInstance(responderInstance) {
       
 10476   if (enableFlareAPI) {
       
 10477     // TODO stop listening to targetEventTypes
       
 10478     unmountEventResponder(responderInstance);
       
 10479   }
       
 10480 }
       
 10481 
       
 10482 function getFundamentalComponentInstance(fundamentalInstance) {
       
 10483   if (enableFundamentalAPI) {
       
 10484     var currentFiber = fundamentalInstance.currentFiber,
       
 10485         impl = fundamentalInstance.impl,
       
 10486         _props = fundamentalInstance.props,
       
 10487         state = fundamentalInstance.state;
       
 10488 
       
 10489     var instance = impl.getInstance(null, _props, state);
       
 10490     precacheFiberNode(currentFiber, instance);
       
 10491     return instance;
       
 10492   }
       
 10493   // Because of the flag above, this gets around the Flow error;
       
 10494   return null;
       
 10495 }
       
 10496 
       
 10497 function mountFundamentalComponent(fundamentalInstance) {
       
 10498   if (enableFundamentalAPI) {
       
 10499     var impl = fundamentalInstance.impl,
       
 10500         instance = fundamentalInstance.instance,
       
 10501         _props2 = fundamentalInstance.props,
       
 10502         state = fundamentalInstance.state;
       
 10503 
       
 10504     var onMount = impl.onMount;
       
 10505     if (onMount !== undefined) {
       
 10506       onMount(null, instance, _props2, state);
       
 10507     }
       
 10508   }
       
 10509 }
       
 10510 
       
 10511 function shouldUpdateFundamentalComponent(fundamentalInstance) {
       
 10512   if (enableFundamentalAPI) {
       
 10513     var impl = fundamentalInstance.impl,
       
 10514         prevProps = fundamentalInstance.prevProps,
       
 10515         _props3 = fundamentalInstance.props,
       
 10516         state = fundamentalInstance.state;
       
 10517 
       
 10518     var shouldUpdate = impl.shouldUpdate;
       
 10519     if (shouldUpdate !== undefined) {
       
 10520       return shouldUpdate(null, prevProps, _props3, state);
       
 10521     }
       
 10522   }
       
 10523   return true;
       
 10524 }
       
 10525 
       
 10526 function updateFundamentalComponent(fundamentalInstance) {
       
 10527   if (enableFundamentalAPI) {
       
 10528     var impl = fundamentalInstance.impl,
       
 10529         instance = fundamentalInstance.instance,
       
 10530         prevProps = fundamentalInstance.prevProps,
       
 10531         _props4 = fundamentalInstance.props,
       
 10532         state = fundamentalInstance.state;
       
 10533 
       
 10534     var onUpdate = impl.onUpdate;
       
 10535     if (onUpdate !== undefined) {
       
 10536       onUpdate(null, instance, prevProps, _props4, state);
       
 10537     }
       
 10538   }
       
 10539 }
       
 10540 
       
 10541 function unmountFundamentalComponent(fundamentalInstance) {
       
 10542   if (enableFundamentalAPI) {
       
 10543     var impl = fundamentalInstance.impl,
       
 10544         instance = fundamentalInstance.instance,
       
 10545         _props5 = fundamentalInstance.props,
       
 10546         state = fundamentalInstance.state;
       
 10547 
       
 10548     var onUnmount = impl.onUnmount;
       
 10549     if (onUnmount !== undefined) {
       
 10550       onUnmount(null, instance, _props5, state);
       
 10551     }
       
 10552   }
       
 10553 }
       
 10554 
       
 10555 // Prefix measurements so that it's possible to filter them.
       
 10556 // Longer prefixes are hard to read in DevTools.
       
 10557 var reactEmoji = '\u269B';
       
 10558 var warningEmoji = '\u26D4';
       
 10559 var supportsUserTiming = typeof performance !== 'undefined' && typeof performance.mark === 'function' && typeof performance.clearMarks === 'function' && typeof performance.measure === 'function' && typeof performance.clearMeasures === 'function';
       
 10560 
       
 10561 // Keep track of current fiber so that we know the path to unwind on pause.
       
 10562 // TODO: this looks the same as nextUnitOfWork in scheduler. Can we unify them?
       
 10563 var currentFiber = null;
       
 10564 // If we're in the middle of user code, which fiber and method is it?
       
 10565 // Reusing `currentFiber` would be confusing for this because user code fiber
       
 10566 // can change during commit phase too, but we don't need to unwind it (since
       
 10567 // lifecycles in the commit phase don't resemble a tree).
       
 10568 var currentPhase = null;
       
 10569 var currentPhaseFiber = null;
       
 10570 // Did lifecycle hook schedule an update? This is often a performance problem,
       
 10571 // so we will keep track of it, and include it in the report.
       
 10572 // Track commits caused by cascading updates.
       
 10573 var isCommitting = false;
       
 10574 var hasScheduledUpdateInCurrentCommit = false;
       
 10575 var hasScheduledUpdateInCurrentPhase = false;
       
 10576 var commitCountInCurrentWorkLoop = 0;
       
 10577 var effectCountInCurrentCommit = 0;
       
 10578 var isWaitingForCallback = false;
       
 10579 // During commits, we only show a measurement once per method name
       
 10580 // to avoid stretch the commit phase with measurement overhead.
       
 10581 var labelsInCurrentCommit = new Set();
       
 10582 
       
 10583 var formatMarkName = function (markName) {
       
 10584   return reactEmoji + ' ' + markName;
       
 10585 };
       
 10586 
       
 10587 var formatLabel = function (label, warning) {
       
 10588   var prefix = warning ? warningEmoji + ' ' : reactEmoji + ' ';
       
 10589   var suffix = warning ? ' Warning: ' + warning : '';
       
 10590   return '' + prefix + label + suffix;
       
 10591 };
       
 10592 
       
 10593 var beginMark = function (markName) {
       
 10594   performance.mark(formatMarkName(markName));
       
 10595 };
       
 10596 
       
 10597 var clearMark = function (markName) {
       
 10598   performance.clearMarks(formatMarkName(markName));
       
 10599 };
       
 10600 
       
 10601 var endMark = function (label, markName, warning) {
       
 10602   var formattedMarkName = formatMarkName(markName);
       
 10603   var formattedLabel = formatLabel(label, warning);
       
 10604   try {
       
 10605     performance.measure(formattedLabel, formattedMarkName);
       
 10606   } catch (err) {}
       
 10607   // If previous mark was missing for some reason, this will throw.
       
 10608   // This could only happen if React crashed in an unexpected place earlier.
       
 10609   // Don't pile on with more errors.
       
 10610 
       
 10611   // Clear marks immediately to avoid growing buffer.
       
 10612   performance.clearMarks(formattedMarkName);
       
 10613   performance.clearMeasures(formattedLabel);
       
 10614 };
       
 10615 
       
 10616 var getFiberMarkName = function (label, debugID) {
       
 10617   return label + ' (#' + debugID + ')';
       
 10618 };
       
 10619 
       
 10620 var getFiberLabel = function (componentName, isMounted, phase) {
       
 10621   if (phase === null) {
       
 10622     // These are composite component total time measurements.
       
 10623     return componentName + ' [' + (isMounted ? 'update' : 'mount') + ']';
       
 10624   } else {
       
 10625     // Composite component methods.
       
 10626     return componentName + '.' + phase;
       
 10627   }
       
 10628 };
       
 10629 
       
 10630 var beginFiberMark = function (fiber, phase) {
       
 10631   var componentName = getComponentName(fiber.type) || 'Unknown';
       
 10632   var debugID = fiber._debugID;
       
 10633   var isMounted = fiber.alternate !== null;
       
 10634   var label = getFiberLabel(componentName, isMounted, phase);
       
 10635 
       
 10636   if (isCommitting && labelsInCurrentCommit.has(label)) {
       
 10637     // During the commit phase, we don't show duplicate labels because
       
 10638     // there is a fixed overhead for every measurement, and we don't
       
 10639     // want to stretch the commit phase beyond necessary.
       
 10640     return false;
       
 10641   }
       
 10642   labelsInCurrentCommit.add(label);
       
 10643 
       
 10644   var markName = getFiberMarkName(label, debugID);
       
 10645   beginMark(markName);
       
 10646   return true;
       
 10647 };
       
 10648 
       
 10649 var clearFiberMark = function (fiber, phase) {
       
 10650   var componentName = getComponentName(fiber.type) || 'Unknown';
       
 10651   var debugID = fiber._debugID;
       
 10652   var isMounted = fiber.alternate !== null;
       
 10653   var label = getFiberLabel(componentName, isMounted, phase);
       
 10654   var markName = getFiberMarkName(label, debugID);
       
 10655   clearMark(markName);
       
 10656 };
       
 10657 
       
 10658 var endFiberMark = function (fiber, phase, warning) {
       
 10659   var componentName = getComponentName(fiber.type) || 'Unknown';
       
 10660   var debugID = fiber._debugID;
       
 10661   var isMounted = fiber.alternate !== null;
       
 10662   var label = getFiberLabel(componentName, isMounted, phase);
       
 10663   var markName = getFiberMarkName(label, debugID);
       
 10664   endMark(label, markName, warning);
       
 10665 };
       
 10666 
       
 10667 var shouldIgnoreFiber = function (fiber) {
       
 10668   // Host components should be skipped in the timeline.
       
 10669   // We could check typeof fiber.type, but does this work with RN?
       
 10670   switch (fiber.tag) {
       
 10671     case HostRoot:
       
 10672     case HostComponent:
       
 10673     case HostText:
       
 10674     case HostPortal:
       
 10675     case Fragment:
       
 10676     case ContextProvider:
       
 10677     case ContextConsumer:
       
 10678     case Mode:
       
 10679       return true;
       
 10680     default:
       
 10681       return false;
       
 10682   }
       
 10683 };
       
 10684 
       
 10685 var clearPendingPhaseMeasurement = function () {
       
 10686   if (currentPhase !== null && currentPhaseFiber !== null) {
       
 10687     clearFiberMark(currentPhaseFiber, currentPhase);
       
 10688   }
       
 10689   currentPhaseFiber = null;
       
 10690   currentPhase = null;
       
 10691   hasScheduledUpdateInCurrentPhase = false;
       
 10692 };
       
 10693 
       
 10694 var pauseTimers = function () {
       
 10695   // Stops all currently active measurements so that they can be resumed
       
 10696   // if we continue in a later deferred loop from the same unit of work.
       
 10697   var fiber = currentFiber;
       
 10698   while (fiber) {
       
 10699     if (fiber._debugIsCurrentlyTiming) {
       
 10700       endFiberMark(fiber, null, null);
       
 10701     }
       
 10702     fiber = fiber.return;
       
 10703   }
       
 10704 };
       
 10705 
       
 10706 var resumeTimersRecursively = function (fiber) {
       
 10707   if (fiber.return !== null) {
       
 10708     resumeTimersRecursively(fiber.return);
       
 10709   }
       
 10710   if (fiber._debugIsCurrentlyTiming) {
       
 10711     beginFiberMark(fiber, null);
       
 10712   }
       
 10713 };
       
 10714 
       
 10715 var resumeTimers = function () {
       
 10716   // Resumes all measurements that were active during the last deferred loop.
       
 10717   if (currentFiber !== null) {
       
 10718     resumeTimersRecursively(currentFiber);
       
 10719   }
       
 10720 };
       
 10721 
       
 10722 function recordEffect() {
       
 10723   if (enableUserTimingAPI) {
       
 10724     effectCountInCurrentCommit++;
       
 10725   }
       
 10726 }
       
 10727 
       
 10728 function recordScheduleUpdate() {
       
 10729   if (enableUserTimingAPI) {
       
 10730     if (isCommitting) {
       
 10731       hasScheduledUpdateInCurrentCommit = true;
       
 10732     }
       
 10733     if (currentPhase !== null && currentPhase !== 'componentWillMount' && currentPhase !== 'componentWillReceiveProps') {
       
 10734       hasScheduledUpdateInCurrentPhase = true;
       
 10735     }
       
 10736   }
       
 10737 }
       
 10738 
       
 10739 function startRequestCallbackTimer() {
       
 10740   if (enableUserTimingAPI) {
       
 10741     if (supportsUserTiming && !isWaitingForCallback) {
       
 10742       isWaitingForCallback = true;
       
 10743       beginMark('(Waiting for async callback...)');
       
 10744     }
       
 10745   }
       
 10746 }
       
 10747 
       
 10748 function stopRequestCallbackTimer(didExpire) {
       
 10749   if (enableUserTimingAPI) {
       
 10750     if (supportsUserTiming) {
       
 10751       isWaitingForCallback = false;
       
 10752       var warning = didExpire ? 'Update expired; will flush synchronously' : null;
       
 10753       endMark('(Waiting for async callback...)', '(Waiting for async callback...)', warning);
       
 10754     }
       
 10755   }
       
 10756 }
       
 10757 
       
 10758 function startWorkTimer(fiber) {
       
 10759   if (enableUserTimingAPI) {
       
 10760     if (!supportsUserTiming || shouldIgnoreFiber(fiber)) {
       
 10761       return;
       
 10762     }
       
 10763     // If we pause, this is the fiber to unwind from.
       
 10764     currentFiber = fiber;
       
 10765     if (!beginFiberMark(fiber, null)) {
       
 10766       return;
       
 10767     }
       
 10768     fiber._debugIsCurrentlyTiming = true;
       
 10769   }
       
 10770 }
       
 10771 
       
 10772 function cancelWorkTimer(fiber) {
       
 10773   if (enableUserTimingAPI) {
       
 10774     if (!supportsUserTiming || shouldIgnoreFiber(fiber)) {
       
 10775       return;
       
 10776     }
       
 10777     // Remember we shouldn't complete measurement for this fiber.
       
 10778     // Otherwise flamechart will be deep even for small updates.
       
 10779     fiber._debugIsCurrentlyTiming = false;
       
 10780     clearFiberMark(fiber, null);
       
 10781   }
       
 10782 }
       
 10783 
       
 10784 function stopWorkTimer(fiber) {
       
 10785   if (enableUserTimingAPI) {
       
 10786     if (!supportsUserTiming || shouldIgnoreFiber(fiber)) {
       
 10787       return;
       
 10788     }
       
 10789     // If we pause, its parent is the fiber to unwind from.
       
 10790     currentFiber = fiber.return;
       
 10791     if (!fiber._debugIsCurrentlyTiming) {
       
 10792       return;
       
 10793     }
       
 10794     fiber._debugIsCurrentlyTiming = false;
       
 10795     endFiberMark(fiber, null, null);
       
 10796   }
       
 10797 }
       
 10798 
       
 10799 function stopFailedWorkTimer(fiber) {
       
 10800   if (enableUserTimingAPI) {
       
 10801     if (!supportsUserTiming || shouldIgnoreFiber(fiber)) {
       
 10802       return;
       
 10803     }
       
 10804     // If we pause, its parent is the fiber to unwind from.
       
 10805     currentFiber = fiber.return;
       
 10806     if (!fiber._debugIsCurrentlyTiming) {
       
 10807       return;
       
 10808     }
       
 10809     fiber._debugIsCurrentlyTiming = false;
       
 10810     var warning = fiber.tag === SuspenseComponent || fiber.tag === DehydratedSuspenseComponent ? 'Rendering was suspended' : 'An error was thrown inside this error boundary';
       
 10811     endFiberMark(fiber, null, warning);
       
 10812   }
       
 10813 }
       
 10814 
       
 10815 function startPhaseTimer(fiber, phase) {
       
 10816   if (enableUserTimingAPI) {
       
 10817     if (!supportsUserTiming) {
       
 10818       return;
       
 10819     }
       
 10820     clearPendingPhaseMeasurement();
       
 10821     if (!beginFiberMark(fiber, phase)) {
       
 10822       return;
       
 10823     }
       
 10824     currentPhaseFiber = fiber;
       
 10825     currentPhase = phase;
       
 10826   }
       
 10827 }
       
 10828 
       
 10829 function stopPhaseTimer() {
       
 10830   if (enableUserTimingAPI) {
       
 10831     if (!supportsUserTiming) {
       
 10832       return;
       
 10833     }
       
 10834     if (currentPhase !== null && currentPhaseFiber !== null) {
       
 10835       var warning = hasScheduledUpdateInCurrentPhase ? 'Scheduled a cascading update' : null;
       
 10836       endFiberMark(currentPhaseFiber, currentPhase, warning);
       
 10837     }
       
 10838     currentPhase = null;
       
 10839     currentPhaseFiber = null;
       
 10840   }
       
 10841 }
       
 10842 
       
 10843 function startWorkLoopTimer(nextUnitOfWork) {
       
 10844   if (enableUserTimingAPI) {
       
 10845     currentFiber = nextUnitOfWork;
       
 10846     if (!supportsUserTiming) {
       
 10847       return;
       
 10848     }
       
 10849     commitCountInCurrentWorkLoop = 0;
       
 10850     // This is top level call.
       
 10851     // Any other measurements are performed within.
       
 10852     beginMark('(React Tree Reconciliation)');
       
 10853     // Resume any measurements that were in progress during the last loop.
       
 10854     resumeTimers();
       
 10855   }
       
 10856 }
       
 10857 
       
 10858 function stopWorkLoopTimer(interruptedBy, didCompleteRoot) {
       
 10859   if (enableUserTimingAPI) {
       
 10860     if (!supportsUserTiming) {
       
 10861       return;
       
 10862     }
       
 10863     var warning = null;
       
 10864     if (interruptedBy !== null) {
       
 10865       if (interruptedBy.tag === HostRoot) {
       
 10866         warning = 'A top-level update interrupted the previous render';
       
 10867       } else {
       
 10868         var componentName = getComponentName(interruptedBy.type) || 'Unknown';
       
 10869         warning = 'An update to ' + componentName + ' interrupted the previous render';
       
 10870       }
       
 10871     } else if (commitCountInCurrentWorkLoop > 1) {
       
 10872       warning = 'There were cascading updates';
       
 10873     }
       
 10874     commitCountInCurrentWorkLoop = 0;
       
 10875     var label = didCompleteRoot ? '(React Tree Reconciliation: Completed Root)' : '(React Tree Reconciliation: Yielded)';
       
 10876     // Pause any measurements until the next loop.
       
 10877     pauseTimers();
       
 10878     endMark(label, '(React Tree Reconciliation)', warning);
       
 10879   }
       
 10880 }
       
 10881 
       
 10882 function startCommitTimer() {
       
 10883   if (enableUserTimingAPI) {
       
 10884     if (!supportsUserTiming) {
       
 10885       return;
       
 10886     }
       
 10887     isCommitting = true;
       
 10888     hasScheduledUpdateInCurrentCommit = false;
       
 10889     labelsInCurrentCommit.clear();
       
 10890     beginMark('(Committing Changes)');
       
 10891   }
       
 10892 }
       
 10893 
       
 10894 function stopCommitTimer() {
       
 10895   if (enableUserTimingAPI) {
       
 10896     if (!supportsUserTiming) {
       
 10897       return;
       
 10898     }
       
 10899 
       
 10900     var warning = null;
       
 10901     if (hasScheduledUpdateInCurrentCommit) {
       
 10902       warning = 'Lifecycle hook scheduled a cascading update';
       
 10903     } else if (commitCountInCurrentWorkLoop > 0) {
       
 10904       warning = 'Caused by a cascading update in earlier commit';
       
 10905     }
       
 10906     hasScheduledUpdateInCurrentCommit = false;
       
 10907     commitCountInCurrentWorkLoop++;
       
 10908     isCommitting = false;
       
 10909     labelsInCurrentCommit.clear();
       
 10910 
       
 10911     endMark('(Committing Changes)', '(Committing Changes)', warning);
       
 10912   }
       
 10913 }
       
 10914 
       
 10915 function startCommitSnapshotEffectsTimer() {
       
 10916   if (enableUserTimingAPI) {
       
 10917     if (!supportsUserTiming) {
       
 10918       return;
       
 10919     }
       
 10920     effectCountInCurrentCommit = 0;
       
 10921     beginMark('(Committing Snapshot Effects)');
       
 10922   }
       
 10923 }
       
 10924 
       
 10925 function stopCommitSnapshotEffectsTimer() {
       
 10926   if (enableUserTimingAPI) {
       
 10927     if (!supportsUserTiming) {
       
 10928       return;
       
 10929     }
       
 10930     var count = effectCountInCurrentCommit;
       
 10931     effectCountInCurrentCommit = 0;
       
 10932     endMark('(Committing Snapshot Effects: ' + count + ' Total)', '(Committing Snapshot Effects)', null);
       
 10933   }
       
 10934 }
       
 10935 
       
 10936 function startCommitHostEffectsTimer() {
       
 10937   if (enableUserTimingAPI) {
       
 10938     if (!supportsUserTiming) {
       
 10939       return;
       
 10940     }
       
 10941     effectCountInCurrentCommit = 0;
       
 10942     beginMark('(Committing Host Effects)');
       
 10943   }
       
 10944 }
       
 10945 
       
 10946 function stopCommitHostEffectsTimer() {
       
 10947   if (enableUserTimingAPI) {
       
 10948     if (!supportsUserTiming) {
       
 10949       return;
       
 10950     }
       
 10951     var count = effectCountInCurrentCommit;
       
 10952     effectCountInCurrentCommit = 0;
       
 10953     endMark('(Committing Host Effects: ' + count + ' Total)', '(Committing Host Effects)', null);
       
 10954   }
       
 10955 }
       
 10956 
       
 10957 function startCommitLifeCyclesTimer() {
       
 10958   if (enableUserTimingAPI) {
       
 10959     if (!supportsUserTiming) {
       
 10960       return;
       
 10961     }
       
 10962     effectCountInCurrentCommit = 0;
       
 10963     beginMark('(Calling Lifecycle Methods)');
       
 10964   }
       
 10965 }
       
 10966 
       
 10967 function stopCommitLifeCyclesTimer() {
       
 10968   if (enableUserTimingAPI) {
       
 10969     if (!supportsUserTiming) {
       
 10970       return;
       
 10971     }
       
 10972     var count = effectCountInCurrentCommit;
       
 10973     effectCountInCurrentCommit = 0;
       
 10974     endMark('(Calling Lifecycle Methods: ' + count + ' Total)', '(Calling Lifecycle Methods)', null);
       
 10975   }
       
 10976 }
       
 10977 
       
 10978 var valueStack = [];
       
 10979 
       
 10980 var fiberStack = void 0;
       
 10981 
       
 10982 {
       
 10983   fiberStack = [];
       
 10984 }
       
 10985 
       
 10986 var index = -1;
       
 10987 
       
 10988 function createCursor(defaultValue) {
       
 10989   return {
       
 10990     current: defaultValue
       
 10991   };
       
 10992 }
       
 10993 
       
 10994 function pop(cursor, fiber) {
       
 10995   if (index < 0) {
       
 10996     {
 10878     {
 10997       warningWithoutStack$1(false, 'Unexpected pop.');
 10879       return didPerformWorkStackCursor.current;
 10998     }
 10880     }
 10999     return;
 10881   }
 11000   }
 10882 
 11001 
 10883   function isContextProvider(type) {
 11002   {
       
 11003     if (fiber !== fiberStack[index]) {
       
 11004       warningWithoutStack$1(false, 'Unexpected Fiber popped.');
       
 11005     }
       
 11006   }
       
 11007 
       
 11008   cursor.current = valueStack[index];
       
 11009 
       
 11010   valueStack[index] = null;
       
 11011 
       
 11012   {
       
 11013     fiberStack[index] = null;
       
 11014   }
       
 11015 
       
 11016   index--;
       
 11017 }
       
 11018 
       
 11019 function push(cursor, value, fiber) {
       
 11020   index++;
       
 11021 
       
 11022   valueStack[index] = cursor.current;
       
 11023 
       
 11024   {
       
 11025     fiberStack[index] = fiber;
       
 11026   }
       
 11027 
       
 11028   cursor.current = value;
       
 11029 }
       
 11030 
       
 11031 var warnedAboutMissingGetChildContext = void 0;
       
 11032 
       
 11033 {
       
 11034   warnedAboutMissingGetChildContext = {};
       
 11035 }
       
 11036 
       
 11037 var emptyContextObject = {};
       
 11038 {
       
 11039   Object.freeze(emptyContextObject);
       
 11040 }
       
 11041 
       
 11042 // A cursor to the current merged context object on the stack.
       
 11043 var contextStackCursor = createCursor(emptyContextObject);
       
 11044 // A cursor to a boolean indicating whether the context has changed.
       
 11045 var didPerformWorkStackCursor = createCursor(false);
       
 11046 // Keep track of the previous context object that was on the stack.
       
 11047 // We use this to get access to the parent context after we have already
       
 11048 // pushed the next context provider, and now need to merge their contexts.
       
 11049 var previousContext = emptyContextObject;
       
 11050 
       
 11051 function getUnmaskedContext(workInProgress, Component, didPushOwnContextIfProvider) {
       
 11052   if (disableLegacyContext) {
       
 11053     return emptyContextObject;
       
 11054   } else {
       
 11055     if (didPushOwnContextIfProvider && isContextProvider(Component)) {
       
 11056       // If the fiber is a context provider itself, when we read its context
       
 11057       // we may have already pushed its own child context on the stack. A context
       
 11058       // provider should not "see" its own child context. Therefore we read the
       
 11059       // previous (parent) context instead for a context provider.
       
 11060       return previousContext;
       
 11061     }
       
 11062     return contextStackCursor.current;
       
 11063   }
       
 11064 }
       
 11065 
       
 11066 function cacheContext(workInProgress, unmaskedContext, maskedContext) {
       
 11067   if (disableLegacyContext) {
       
 11068     return;
       
 11069   } else {
       
 11070     var instance = workInProgress.stateNode;
       
 11071     instance.__reactInternalMemoizedUnmaskedChildContext = unmaskedContext;
       
 11072     instance.__reactInternalMemoizedMaskedChildContext = maskedContext;
       
 11073   }
       
 11074 }
       
 11075 
       
 11076 function getMaskedContext(workInProgress, unmaskedContext) {
       
 11077   if (disableLegacyContext) {
       
 11078     return emptyContextObject;
       
 11079   } else {
       
 11080     var type = workInProgress.type;
       
 11081     var contextTypes = type.contextTypes;
       
 11082     if (!contextTypes) {
       
 11083       return emptyContextObject;
       
 11084     }
       
 11085 
       
 11086     // Avoid recreating masked context unless unmasked context has changed.
       
 11087     // Failing to do this will result in unnecessary calls to componentWillReceiveProps.
       
 11088     // This may trigger infinite loops if componentWillReceiveProps calls setState.
       
 11089     var instance = workInProgress.stateNode;
       
 11090     if (instance && instance.__reactInternalMemoizedUnmaskedChildContext === unmaskedContext) {
       
 11091       return instance.__reactInternalMemoizedMaskedChildContext;
       
 11092     }
       
 11093 
       
 11094     var context = {};
       
 11095     for (var key in contextTypes) {
       
 11096       context[key] = unmaskedContext[key];
       
 11097     }
       
 11098 
       
 11099     {
 10884     {
 11100       var name = getComponentName(type) || 'Unknown';
 10885       var childContextTypes = type.childContextTypes;
 11101       checkPropTypes_1(contextTypes, context, 'context', name, getCurrentFiberStackInDev);
 10886       return childContextTypes !== null && childContextTypes !== undefined;
 11102     }
 10887     }
 11103 
 10888   }
 11104     // Cache unmasked context so we can avoid recreating masked context unless necessary.
 10889 
 11105     // Context is created before the class component is instantiated so check for instance.
 10890   function popContext(fiber) {
 11106     if (instance) {
 10891     {
 11107       cacheContext(workInProgress, unmaskedContext, context);
 10892       pop(didPerformWorkStackCursor, fiber);
 11108     }
 10893       pop(contextStackCursor, fiber);
 11109 
 10894     }
 11110     return context;
 10895   }
 11111   }
 10896 
 11112 }
 10897   function popTopLevelContextObject(fiber) {
 11113 
 10898     {
 11114 function hasContextChanged() {
 10899       pop(didPerformWorkStackCursor, fiber);
 11115   if (disableLegacyContext) {
 10900       pop(contextStackCursor, fiber);
 11116     return false;
 10901     }
 11117   } else {
 10902   }
 11118     return didPerformWorkStackCursor.current;
 10903 
 11119   }
 10904   function pushTopLevelContextObject(fiber, context, didChange) {
 11120 }
 10905     {
 11121 
       
 11122 function isContextProvider(type) {
       
 11123   if (disableLegacyContext) {
       
 11124     return false;
       
 11125   } else {
       
 11126     var childContextTypes = type.childContextTypes;
       
 11127     return childContextTypes !== null && childContextTypes !== undefined;
       
 11128   }
       
 11129 }
       
 11130 
       
 11131 function popContext(fiber) {
       
 11132   if (disableLegacyContext) {
       
 11133     return;
       
 11134   } else {
       
 11135     pop(didPerformWorkStackCursor, fiber);
       
 11136     pop(contextStackCursor, fiber);
       
 11137   }
       
 11138 }
       
 11139 
       
 11140 function popTopLevelContextObject(fiber) {
       
 11141   if (disableLegacyContext) {
       
 11142     return;
       
 11143   } else {
       
 11144     pop(didPerformWorkStackCursor, fiber);
       
 11145     pop(contextStackCursor, fiber);
       
 11146   }
       
 11147 }
       
 11148 
       
 11149 function pushTopLevelContextObject(fiber, context, didChange) {
       
 11150   if (disableLegacyContext) {
       
 11151     return;
       
 11152   } else {
       
 11153     (function () {
       
 11154       if (!(contextStackCursor.current === emptyContextObject)) {
 10906       if (!(contextStackCursor.current === emptyContextObject)) {
 11155         {
 10907         {
 11156           throw ReactError(Error('Unexpected context found on stack. This error is likely caused by a bug in React. Please file an issue.'));
 10908           throw Error( "Unexpected context found on stack. This error is likely caused by a bug in React. Please file an issue." );
 11157         }
 10909         }
 11158       }
 10910       }
 11159     })();
 10911 
 11160 
 10912       push(contextStackCursor, context, fiber);
 11161     push(contextStackCursor, context, fiber);
 10913       push(didPerformWorkStackCursor, didChange, fiber);
 11162     push(didPerformWorkStackCursor, didChange, fiber);
 10914     }
 11163   }
 10915   }
 11164 }
 10916 
 11165 
 10917   function processChildContext(fiber, type, parentContext) {
 11166 function processChildContext(fiber, type, parentContext) {
       
 11167   if (disableLegacyContext) {
       
 11168     return parentContext;
       
 11169   } else {
       
 11170     var instance = fiber.stateNode;
       
 11171     var childContextTypes = type.childContextTypes;
       
 11172 
       
 11173     // TODO (bvaughn) Replace this behavior with an invariant() in the future.
       
 11174     // It has only been added in Fiber to match the (unintentional) behavior in Stack.
       
 11175     if (typeof instance.getChildContext !== 'function') {
       
 11176       {
       
 11177         var componentName = getComponentName(type) || 'Unknown';
       
 11178 
       
 11179         if (!warnedAboutMissingGetChildContext[componentName]) {
       
 11180           warnedAboutMissingGetChildContext[componentName] = true;
       
 11181           warningWithoutStack$1(false, '%s.childContextTypes is specified but there is no getChildContext() method ' + 'on the instance. You can either define getChildContext() on %s or remove ' + 'childContextTypes from it.', componentName, componentName);
       
 11182         }
       
 11183       }
       
 11184       return parentContext;
       
 11185     }
       
 11186 
       
 11187     var childContext = void 0;
       
 11188     {
 10918     {
 11189       setCurrentPhase('getChildContext');
 10919       var instance = fiber.stateNode;
 11190     }
 10920       var childContextTypes = type.childContextTypes; // TODO (bvaughn) Replace this behavior with an invariant() in the future.
 11191     startPhaseTimer(fiber, 'getChildContext');
 10921       // It has only been added in Fiber to match the (unintentional) behavior in Stack.
 11192     childContext = instance.getChildContext();
 10922 
 11193     stopPhaseTimer();
 10923       if (typeof instance.getChildContext !== 'function') {
 11194     {
 10924         {
 11195       setCurrentPhase(null);
 10925           var componentName = getComponentName(type) || 'Unknown';
 11196     }
 10926 
 11197     for (var contextKey in childContext) {
 10927           if (!warnedAboutMissingGetChildContext[componentName]) {
 11198       (function () {
 10928             warnedAboutMissingGetChildContext[componentName] = true;
       
 10929 
       
 10930             error('%s.childContextTypes is specified but there is no getChildContext() method ' + 'on the instance. You can either define getChildContext() on %s or remove ' + 'childContextTypes from it.', componentName, componentName);
       
 10931           }
       
 10932         }
       
 10933 
       
 10934         return parentContext;
       
 10935       }
       
 10936 
       
 10937       var childContext;
       
 10938       startPhaseTimer(fiber, 'getChildContext');
       
 10939       childContext = instance.getChildContext();
       
 10940       stopPhaseTimer();
       
 10941 
       
 10942       for (var contextKey in childContext) {
 11199         if (!(contextKey in childContextTypes)) {
 10943         if (!(contextKey in childContextTypes)) {
 11200           {
 10944           {
 11201             throw ReactError(Error((getComponentName(type) || 'Unknown') + '.getChildContext(): key "' + contextKey + '" is not defined in childContextTypes.'));
 10945             throw Error( (getComponentName(type) || 'Unknown') + ".getChildContext(): key \"" + contextKey + "\" is not defined in childContextTypes." );
 11202           }
 10946           }
 11203         }
 10947         }
 11204       })();
 10948       }
 11205     }
 10949 
       
 10950       {
       
 10951         var name = getComponentName(type) || 'Unknown';
       
 10952         checkPropTypes_1(childContextTypes, childContext, 'child context', name, // In practice, there is one case in which we won't get a stack. It's when
       
 10953         // somebody calls unstable_renderSubtreeIntoContainer() and we process
       
 10954         // context from the parent component instance. The stack will be missing
       
 10955         // because it's outside of the reconciliation, and so the pointer has not
       
 10956         // been set. This is rare and doesn't matter. We'll also remove that API.
       
 10957         getCurrentFiberStackInDev);
       
 10958       }
       
 10959 
       
 10960       return _assign({}, parentContext, {}, childContext);
       
 10961     }
       
 10962   }
       
 10963 
       
 10964   function pushContextProvider(workInProgress) {
 11206     {
 10965     {
 11207       var name = getComponentName(type) || 'Unknown';
 10966       var instance = workInProgress.stateNode; // We push the context as early as possible to ensure stack integrity.
 11208       checkPropTypes_1(childContextTypes, childContext, 'child context', name,
 10967       // If the instance does not exist yet, we will push null at first,
 11209       // In practice, there is one case in which we won't get a stack. It's when
 10968       // and replace it on the stack later when invalidating the context.
 11210       // somebody calls unstable_renderSubtreeIntoContainer() and we process
 10969 
 11211       // context from the parent component instance. The stack will be missing
 10970       var memoizedMergedChildContext = instance && instance.__reactInternalMemoizedMergedChildContext || emptyContextObject; // Remember the parent context so we can merge with it later.
 11212       // because it's outside of the reconciliation, and so the pointer has not
 10971       // Inherit the parent's did-perform-work value to avoid inadvertently blocking updates.
 11213       // been set. This is rare and doesn't matter. We'll also remove that API.
 10972 
 11214       getCurrentFiberStackInDev);
 10973       previousContext = contextStackCursor.current;
 11215     }
 10974       push(contextStackCursor, memoizedMergedChildContext, workInProgress);
 11216 
 10975       push(didPerformWorkStackCursor, didPerformWorkStackCursor.current, workInProgress);
 11217     return _assign({}, parentContext, childContext);
 10976       return true;
 11218   }
 10977     }
 11219 }
 10978   }
 11220 
 10979 
 11221 function pushContextProvider(workInProgress) {
 10980   function invalidateContextProvider(workInProgress, type, didChange) {
 11222   if (disableLegacyContext) {
 10981     {
 11223     return false;
 10982       var instance = workInProgress.stateNode;
 11224   } else {
 10983 
 11225     var instance = workInProgress.stateNode;
       
 11226     // We push the context as early as possible to ensure stack integrity.
       
 11227     // If the instance does not exist yet, we will push null at first,
       
 11228     // and replace it on the stack later when invalidating the context.
       
 11229     var memoizedMergedChildContext = instance && instance.__reactInternalMemoizedMergedChildContext || emptyContextObject;
       
 11230 
       
 11231     // Remember the parent context so we can merge with it later.
       
 11232     // Inherit the parent's did-perform-work value to avoid inadvertently blocking updates.
       
 11233     previousContext = contextStackCursor.current;
       
 11234     push(contextStackCursor, memoizedMergedChildContext, workInProgress);
       
 11235     push(didPerformWorkStackCursor, didPerformWorkStackCursor.current, workInProgress);
       
 11236 
       
 11237     return true;
       
 11238   }
       
 11239 }
       
 11240 
       
 11241 function invalidateContextProvider(workInProgress, type, didChange) {
       
 11242   if (disableLegacyContext) {
       
 11243     return;
       
 11244   } else {
       
 11245     var instance = workInProgress.stateNode;
       
 11246     (function () {
       
 11247       if (!instance) {
 10984       if (!instance) {
 11248         {
 10985         {
 11249           throw ReactError(Error('Expected to have an instance by this point. This error is likely caused by a bug in React. Please file an issue.'));
 10986           throw Error( "Expected to have an instance by this point. This error is likely caused by a bug in React. Please file an issue." );
 11250         }
 10987         }
 11251       }
 10988       }
 11252     })();
 10989 
 11253 
 10990       if (didChange) {
 11254     if (didChange) {
 10991         // Merge parent and own context.
 11255       // Merge parent and own context.
 10992         // Skip this if we're not updating due to sCU.
 11256       // Skip this if we're not updating due to sCU.
 10993         // This avoids unnecessarily recomputing memoized values.
 11257       // This avoids unnecessarily recomputing memoized values.
 10994         var mergedContext = processChildContext(workInProgress, type, previousContext);
 11258       var mergedContext = processChildContext(workInProgress, type, previousContext);
 10995         instance.__reactInternalMemoizedMergedChildContext = mergedContext; // Replace the old (or empty) context with the new one.
 11259       instance.__reactInternalMemoizedMergedChildContext = mergedContext;
 10996         // It is important to unwind the context in the reverse order.
 11260 
 10997 
 11261       // Replace the old (or empty) context with the new one.
 10998         pop(didPerformWorkStackCursor, workInProgress);
 11262       // It is important to unwind the context in the reverse order.
 10999         pop(contextStackCursor, workInProgress); // Now push the new context and mark that it has changed.
 11263       pop(didPerformWorkStackCursor, workInProgress);
 11000 
 11264       pop(contextStackCursor, workInProgress);
 11001         push(contextStackCursor, mergedContext, workInProgress);
 11265       // Now push the new context and mark that it has changed.
 11002         push(didPerformWorkStackCursor, didChange, workInProgress);
 11266       push(contextStackCursor, mergedContext, workInProgress);
 11003       } else {
 11267       push(didPerformWorkStackCursor, didChange, workInProgress);
 11004         pop(didPerformWorkStackCursor, workInProgress);
 11268     } else {
 11005         push(didPerformWorkStackCursor, didChange, workInProgress);
 11269       pop(didPerformWorkStackCursor, workInProgress);
 11006       }
 11270       push(didPerformWorkStackCursor, didChange, workInProgress);
 11007     }
 11271     }
 11008   }
 11272   }
 11009 
 11273 }
 11010   function findCurrentUnmaskedContext(fiber) {
 11274 
 11011     {
 11275 function findCurrentUnmaskedContext(fiber) {
 11012       // Currently this is only used with renderSubtreeIntoContainer; not sure if it
 11276   if (disableLegacyContext) {
 11013       // makes sense elsewhere
 11277     return emptyContextObject;
       
 11278   } else {
       
 11279     // Currently this is only used with renderSubtreeIntoContainer; not sure if it
       
 11280     // makes sense elsewhere
       
 11281     (function () {
       
 11282       if (!(isFiberMounted(fiber) && fiber.tag === ClassComponent)) {
 11014       if (!(isFiberMounted(fiber) && fiber.tag === ClassComponent)) {
 11283         {
 11015         {
 11284           throw ReactError(Error('Expected subtree parent to be a mounted class component. This error is likely caused by a bug in React. Please file an issue.'));
 11016           throw Error( "Expected subtree parent to be a mounted class component. This error is likely caused by a bug in React. Please file an issue." );
 11285         }
 11017         }
 11286       }
 11018       }
 11287     })();
 11019 
 11288 
 11020       var node = fiber;
 11289     var node = fiber;
 11021 
 11290     do {
 11022       do {
 11291       switch (node.tag) {
 11023         switch (node.tag) {
 11292         case HostRoot:
 11024           case HostRoot:
 11293           return node.stateNode.context;
 11025             return node.stateNode.context;
       
 11026 
       
 11027           case ClassComponent:
       
 11028             {
       
 11029               var Component = node.type;
       
 11030 
       
 11031               if (isContextProvider(Component)) {
       
 11032                 return node.stateNode.__reactInternalMemoizedMergedChildContext;
       
 11033               }
       
 11034 
       
 11035               break;
       
 11036             }
       
 11037         }
       
 11038 
       
 11039         node = node.return;
       
 11040       } while (node !== null);
       
 11041 
       
 11042       {
       
 11043         {
       
 11044           throw Error( "Found unexpected detached subtree parent. This error is likely caused by a bug in React. Please file an issue." );
       
 11045         }
       
 11046       }
       
 11047     }
       
 11048   }
       
 11049 
       
 11050   var LegacyRoot = 0;
       
 11051   var BlockingRoot = 1;
       
 11052   var ConcurrentRoot = 2;
       
 11053 
       
 11054   var ReactInternals$2 = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
       
 11055   var _ReactInternals$Sched$1 = ReactInternals$2.SchedulerTracing,
       
 11056       __interactionsRef = _ReactInternals$Sched$1.__interactionsRef,
       
 11057       __subscriberRef = _ReactInternals$Sched$1.__subscriberRef,
       
 11058       unstable_clear = _ReactInternals$Sched$1.unstable_clear,
       
 11059       unstable_getCurrent = _ReactInternals$Sched$1.unstable_getCurrent,
       
 11060       unstable_getThreadID = _ReactInternals$Sched$1.unstable_getThreadID,
       
 11061       unstable_subscribe = _ReactInternals$Sched$1.unstable_subscribe,
       
 11062       unstable_trace = _ReactInternals$Sched$1.unstable_trace,
       
 11063       unstable_unsubscribe = _ReactInternals$Sched$1.unstable_unsubscribe,
       
 11064       unstable_wrap = _ReactInternals$Sched$1.unstable_wrap;
       
 11065 
       
 11066   var Scheduler_runWithPriority = unstable_runWithPriority,
       
 11067       Scheduler_scheduleCallback = unstable_scheduleCallback,
       
 11068       Scheduler_cancelCallback = unstable_cancelCallback,
       
 11069       Scheduler_shouldYield = unstable_shouldYield,
       
 11070       Scheduler_requestPaint = unstable_requestPaint,
       
 11071       Scheduler_now = unstable_now,
       
 11072       Scheduler_getCurrentPriorityLevel = unstable_getCurrentPriorityLevel,
       
 11073       Scheduler_ImmediatePriority = unstable_ImmediatePriority,
       
 11074       Scheduler_UserBlockingPriority = unstable_UserBlockingPriority,
       
 11075       Scheduler_NormalPriority = unstable_NormalPriority,
       
 11076       Scheduler_LowPriority = unstable_LowPriority,
       
 11077       Scheduler_IdlePriority = unstable_IdlePriority;
       
 11078 
       
 11079   {
       
 11080     // Provide explicit error message when production+profiling bundle of e.g.
       
 11081     // react-dom is used with production (non-profiling) bundle of
       
 11082     // scheduler/tracing
       
 11083     if (!(__interactionsRef != null && __interactionsRef.current != null)) {
       
 11084       {
       
 11085         throw Error( "It is not supported to run the profiling version of a renderer (for example, `react-dom/profiling`) without also replacing the `scheduler/tracing` module with `scheduler/tracing-profiling`. Your bundler might have a setting for aliasing both modules. Learn more at http://fb.me/react-profiling" );
       
 11086       }
       
 11087     }
       
 11088   }
       
 11089 
       
 11090   var fakeCallbackNode = {}; // Except for NoPriority, these correspond to Scheduler priorities. We use
       
 11091   // ascending numbers so we can compare them like numbers. They start at 90 to
       
 11092   // avoid clashing with Scheduler's priorities.
       
 11093 
       
 11094   var ImmediatePriority = 99;
       
 11095   var UserBlockingPriority$1 = 98;
       
 11096   var NormalPriority = 97;
       
 11097   var LowPriority = 96;
       
 11098   var IdlePriority = 95; // NoPriority is the absence of priority. Also React-only.
       
 11099 
       
 11100   var NoPriority = 90;
       
 11101   var shouldYield = Scheduler_shouldYield;
       
 11102   var requestPaint = // Fall back gracefully if we're running an older version of Scheduler.
       
 11103   Scheduler_requestPaint !== undefined ? Scheduler_requestPaint : function () {};
       
 11104   var syncQueue = null;
       
 11105   var immediateQueueCallbackNode = null;
       
 11106   var isFlushingSyncQueue = false;
       
 11107   var initialTimeMs = Scheduler_now(); // If the initial timestamp is reasonably small, use Scheduler's `now` directly.
       
 11108   // This will be the case for modern browsers that support `performance.now`. In
       
 11109   // older browsers, Scheduler falls back to `Date.now`, which returns a Unix
       
 11110   // timestamp. In that case, subtract the module initialization time to simulate
       
 11111   // the behavior of performance.now and keep our times small enough to fit
       
 11112   // within 32 bits.
       
 11113   // TODO: Consider lifting this into Scheduler.
       
 11114 
       
 11115   var now = initialTimeMs < 10000 ? Scheduler_now : function () {
       
 11116     return Scheduler_now() - initialTimeMs;
       
 11117   };
       
 11118   function getCurrentPriorityLevel() {
       
 11119     switch (Scheduler_getCurrentPriorityLevel()) {
       
 11120       case Scheduler_ImmediatePriority:
       
 11121         return ImmediatePriority;
       
 11122 
       
 11123       case Scheduler_UserBlockingPriority:
       
 11124         return UserBlockingPriority$1;
       
 11125 
       
 11126       case Scheduler_NormalPriority:
       
 11127         return NormalPriority;
       
 11128 
       
 11129       case Scheduler_LowPriority:
       
 11130         return LowPriority;
       
 11131 
       
 11132       case Scheduler_IdlePriority:
       
 11133         return IdlePriority;
       
 11134 
       
 11135       default:
       
 11136         {
       
 11137           {
       
 11138             throw Error( "Unknown priority level." );
       
 11139           }
       
 11140         }
       
 11141 
       
 11142     }
       
 11143   }
       
 11144 
       
 11145   function reactPriorityToSchedulerPriority(reactPriorityLevel) {
       
 11146     switch (reactPriorityLevel) {
       
 11147       case ImmediatePriority:
       
 11148         return Scheduler_ImmediatePriority;
       
 11149 
       
 11150       case UserBlockingPriority$1:
       
 11151         return Scheduler_UserBlockingPriority;
       
 11152 
       
 11153       case NormalPriority:
       
 11154         return Scheduler_NormalPriority;
       
 11155 
       
 11156       case LowPriority:
       
 11157         return Scheduler_LowPriority;
       
 11158 
       
 11159       case IdlePriority:
       
 11160         return Scheduler_IdlePriority;
       
 11161 
       
 11162       default:
       
 11163         {
       
 11164           {
       
 11165             throw Error( "Unknown priority level." );
       
 11166           }
       
 11167         }
       
 11168 
       
 11169     }
       
 11170   }
       
 11171 
       
 11172   function runWithPriority$1(reactPriorityLevel, fn) {
       
 11173     var priorityLevel = reactPriorityToSchedulerPriority(reactPriorityLevel);
       
 11174     return Scheduler_runWithPriority(priorityLevel, fn);
       
 11175   }
       
 11176   function scheduleCallback(reactPriorityLevel, callback, options) {
       
 11177     var priorityLevel = reactPriorityToSchedulerPriority(reactPriorityLevel);
       
 11178     return Scheduler_scheduleCallback(priorityLevel, callback, options);
       
 11179   }
       
 11180   function scheduleSyncCallback(callback) {
       
 11181     // Push this callback into an internal queue. We'll flush these either in
       
 11182     // the next tick, or earlier if something calls `flushSyncCallbackQueue`.
       
 11183     if (syncQueue === null) {
       
 11184       syncQueue = [callback]; // Flush the queue in the next tick, at the earliest.
       
 11185 
       
 11186       immediateQueueCallbackNode = Scheduler_scheduleCallback(Scheduler_ImmediatePriority, flushSyncCallbackQueueImpl);
       
 11187     } else {
       
 11188       // Push onto existing queue. Don't need to schedule a callback because
       
 11189       // we already scheduled one when we created the queue.
       
 11190       syncQueue.push(callback);
       
 11191     }
       
 11192 
       
 11193     return fakeCallbackNode;
       
 11194   }
       
 11195   function cancelCallback(callbackNode) {
       
 11196     if (callbackNode !== fakeCallbackNode) {
       
 11197       Scheduler_cancelCallback(callbackNode);
       
 11198     }
       
 11199   }
       
 11200   function flushSyncCallbackQueue() {
       
 11201     if (immediateQueueCallbackNode !== null) {
       
 11202       var node = immediateQueueCallbackNode;
       
 11203       immediateQueueCallbackNode = null;
       
 11204       Scheduler_cancelCallback(node);
       
 11205     }
       
 11206 
       
 11207     flushSyncCallbackQueueImpl();
       
 11208   }
       
 11209 
       
 11210   function flushSyncCallbackQueueImpl() {
       
 11211     if (!isFlushingSyncQueue && syncQueue !== null) {
       
 11212       // Prevent re-entrancy.
       
 11213       isFlushingSyncQueue = true;
       
 11214       var i = 0;
       
 11215 
       
 11216       try {
       
 11217         var _isSync = true;
       
 11218         var queue = syncQueue;
       
 11219         runWithPriority$1(ImmediatePriority, function () {
       
 11220           for (; i < queue.length; i++) {
       
 11221             var callback = queue[i];
       
 11222 
       
 11223             do {
       
 11224               callback = callback(_isSync);
       
 11225             } while (callback !== null);
       
 11226           }
       
 11227         });
       
 11228         syncQueue = null;
       
 11229       } catch (error) {
       
 11230         // If something throws, leave the remaining callbacks on the queue.
       
 11231         if (syncQueue !== null) {
       
 11232           syncQueue = syncQueue.slice(i + 1);
       
 11233         } // Resume flushing in the next tick
       
 11234 
       
 11235 
       
 11236         Scheduler_scheduleCallback(Scheduler_ImmediatePriority, flushSyncCallbackQueue);
       
 11237         throw error;
       
 11238       } finally {
       
 11239         isFlushingSyncQueue = false;
       
 11240       }
       
 11241     }
       
 11242   }
       
 11243 
       
 11244   var NoMode = 0;
       
 11245   var StrictMode = 1; // TODO: Remove BlockingMode and ConcurrentMode by reading from the root
       
 11246   // tag instead
       
 11247 
       
 11248   var BlockingMode = 2;
       
 11249   var ConcurrentMode = 4;
       
 11250   var ProfileMode = 8;
       
 11251 
       
 11252   // Max 31 bit integer. The max integer size in V8 for 32-bit systems.
       
 11253   // Math.pow(2, 30) - 1
       
 11254   // 0b111111111111111111111111111111
       
 11255   var MAX_SIGNED_31_BIT_INT = 1073741823;
       
 11256 
       
 11257   var NoWork = 0; // TODO: Think of a better name for Never. The key difference with Idle is that
       
 11258   // Never work can be committed in an inconsistent state without tearing the UI.
       
 11259   // The main example is offscreen content, like a hidden subtree. So one possible
       
 11260   // name is Offscreen. However, it also includes dehydrated Suspense boundaries,
       
 11261   // which are inconsistent in the sense that they haven't finished yet, but
       
 11262   // aren't visibly inconsistent because the server rendered HTML matches what the
       
 11263   // hydrated tree would look like.
       
 11264 
       
 11265   var Never = 1; // Idle is slightly higher priority than Never. It must completely finish in
       
 11266   // order to be consistent.
       
 11267 
       
 11268   var Idle = 2; // Continuous Hydration is slightly higher than Idle and is used to increase
       
 11269   // priority of hover targets.
       
 11270 
       
 11271   var ContinuousHydration = 3;
       
 11272   var Sync = MAX_SIGNED_31_BIT_INT;
       
 11273   var Batched = Sync - 1;
       
 11274   var UNIT_SIZE = 10;
       
 11275   var MAGIC_NUMBER_OFFSET = Batched - 1; // 1 unit of expiration time represents 10ms.
       
 11276 
       
 11277   function msToExpirationTime(ms) {
       
 11278     // Always subtract from the offset so that we don't clash with the magic number for NoWork.
       
 11279     return MAGIC_NUMBER_OFFSET - (ms / UNIT_SIZE | 0);
       
 11280   }
       
 11281   function expirationTimeToMs(expirationTime) {
       
 11282     return (MAGIC_NUMBER_OFFSET - expirationTime) * UNIT_SIZE;
       
 11283   }
       
 11284 
       
 11285   function ceiling(num, precision) {
       
 11286     return ((num / precision | 0) + 1) * precision;
       
 11287   }
       
 11288 
       
 11289   function computeExpirationBucket(currentTime, expirationInMs, bucketSizeMs) {
       
 11290     return MAGIC_NUMBER_OFFSET - ceiling(MAGIC_NUMBER_OFFSET - currentTime + expirationInMs / UNIT_SIZE, bucketSizeMs / UNIT_SIZE);
       
 11291   } // TODO: This corresponds to Scheduler's NormalPriority, not LowPriority. Update
       
 11292   // the names to reflect.
       
 11293 
       
 11294 
       
 11295   var LOW_PRIORITY_EXPIRATION = 5000;
       
 11296   var LOW_PRIORITY_BATCH_SIZE = 250;
       
 11297   function computeAsyncExpiration(currentTime) {
       
 11298     return computeExpirationBucket(currentTime, LOW_PRIORITY_EXPIRATION, LOW_PRIORITY_BATCH_SIZE);
       
 11299   }
       
 11300   function computeSuspenseExpiration(currentTime, timeoutMs) {
       
 11301     // TODO: Should we warn if timeoutMs is lower than the normal pri expiration time?
       
 11302     return computeExpirationBucket(currentTime, timeoutMs, LOW_PRIORITY_BATCH_SIZE);
       
 11303   } // We intentionally set a higher expiration time for interactive updates in
       
 11304   // dev than in production.
       
 11305   //
       
 11306   // If the main thread is being blocked so long that you hit the expiration,
       
 11307   // it's a problem that could be solved with better scheduling.
       
 11308   //
       
 11309   // People will be more likely to notice this and fix it with the long
       
 11310   // expiration time in development.
       
 11311   //
       
 11312   // In production we opt for better UX at the risk of masking scheduling
       
 11313   // problems, by expiring fast.
       
 11314 
       
 11315   var HIGH_PRIORITY_EXPIRATION =  500 ;
       
 11316   var HIGH_PRIORITY_BATCH_SIZE = 100;
       
 11317   function computeInteractiveExpiration(currentTime) {
       
 11318     return computeExpirationBucket(currentTime, HIGH_PRIORITY_EXPIRATION, HIGH_PRIORITY_BATCH_SIZE);
       
 11319   }
       
 11320   function inferPriorityFromExpirationTime(currentTime, expirationTime) {
       
 11321     if (expirationTime === Sync) {
       
 11322       return ImmediatePriority;
       
 11323     }
       
 11324 
       
 11325     if (expirationTime === Never || expirationTime === Idle) {
       
 11326       return IdlePriority;
       
 11327     }
       
 11328 
       
 11329     var msUntil = expirationTimeToMs(expirationTime) - expirationTimeToMs(currentTime);
       
 11330 
       
 11331     if (msUntil <= 0) {
       
 11332       return ImmediatePriority;
       
 11333     }
       
 11334 
       
 11335     if (msUntil <= HIGH_PRIORITY_EXPIRATION + HIGH_PRIORITY_BATCH_SIZE) {
       
 11336       return UserBlockingPriority$1;
       
 11337     }
       
 11338 
       
 11339     if (msUntil <= LOW_PRIORITY_EXPIRATION + LOW_PRIORITY_BATCH_SIZE) {
       
 11340       return NormalPriority;
       
 11341     } // TODO: Handle LowPriority
       
 11342     // Assume anything lower has idle priority
       
 11343 
       
 11344 
       
 11345     return IdlePriority;
       
 11346   }
       
 11347 
       
 11348   var ReactStrictModeWarnings = {
       
 11349     recordUnsafeLifecycleWarnings: function (fiber, instance) {},
       
 11350     flushPendingUnsafeLifecycleWarnings: function () {},
       
 11351     recordLegacyContextWarning: function (fiber, instance) {},
       
 11352     flushLegacyContextWarning: function () {},
       
 11353     discardPendingWarnings: function () {}
       
 11354   };
       
 11355 
       
 11356   {
       
 11357     var findStrictRoot = function (fiber) {
       
 11358       var maybeStrictRoot = null;
       
 11359       var node = fiber;
       
 11360 
       
 11361       while (node !== null) {
       
 11362         if (node.mode & StrictMode) {
       
 11363           maybeStrictRoot = node;
       
 11364         }
       
 11365 
       
 11366         node = node.return;
       
 11367       }
       
 11368 
       
 11369       return maybeStrictRoot;
       
 11370     };
       
 11371 
       
 11372     var setToSortedString = function (set) {
       
 11373       var array = [];
       
 11374       set.forEach(function (value) {
       
 11375         array.push(value);
       
 11376       });
       
 11377       return array.sort().join(', ');
       
 11378     };
       
 11379 
       
 11380     var pendingComponentWillMountWarnings = [];
       
 11381     var pendingUNSAFE_ComponentWillMountWarnings = [];
       
 11382     var pendingComponentWillReceivePropsWarnings = [];
       
 11383     var pendingUNSAFE_ComponentWillReceivePropsWarnings = [];
       
 11384     var pendingComponentWillUpdateWarnings = [];
       
 11385     var pendingUNSAFE_ComponentWillUpdateWarnings = []; // Tracks components we have already warned about.
       
 11386 
       
 11387     var didWarnAboutUnsafeLifecycles = new Set();
       
 11388 
       
 11389     ReactStrictModeWarnings.recordUnsafeLifecycleWarnings = function (fiber, instance) {
       
 11390       // Dedup strategy: Warn once per component.
       
 11391       if (didWarnAboutUnsafeLifecycles.has(fiber.type)) {
       
 11392         return;
       
 11393       }
       
 11394 
       
 11395       if (typeof instance.componentWillMount === 'function' && // Don't warn about react-lifecycles-compat polyfilled components.
       
 11396       instance.componentWillMount.__suppressDeprecationWarning !== true) {
       
 11397         pendingComponentWillMountWarnings.push(fiber);
       
 11398       }
       
 11399 
       
 11400       if (fiber.mode & StrictMode && typeof instance.UNSAFE_componentWillMount === 'function') {
       
 11401         pendingUNSAFE_ComponentWillMountWarnings.push(fiber);
       
 11402       }
       
 11403 
       
 11404       if (typeof instance.componentWillReceiveProps === 'function' && instance.componentWillReceiveProps.__suppressDeprecationWarning !== true) {
       
 11405         pendingComponentWillReceivePropsWarnings.push(fiber);
       
 11406       }
       
 11407 
       
 11408       if (fiber.mode & StrictMode && typeof instance.UNSAFE_componentWillReceiveProps === 'function') {
       
 11409         pendingUNSAFE_ComponentWillReceivePropsWarnings.push(fiber);
       
 11410       }
       
 11411 
       
 11412       if (typeof instance.componentWillUpdate === 'function' && instance.componentWillUpdate.__suppressDeprecationWarning !== true) {
       
 11413         pendingComponentWillUpdateWarnings.push(fiber);
       
 11414       }
       
 11415 
       
 11416       if (fiber.mode & StrictMode && typeof instance.UNSAFE_componentWillUpdate === 'function') {
       
 11417         pendingUNSAFE_ComponentWillUpdateWarnings.push(fiber);
       
 11418       }
       
 11419     };
       
 11420 
       
 11421     ReactStrictModeWarnings.flushPendingUnsafeLifecycleWarnings = function () {
       
 11422       // We do an initial pass to gather component names
       
 11423       var componentWillMountUniqueNames = new Set();
       
 11424 
       
 11425       if (pendingComponentWillMountWarnings.length > 0) {
       
 11426         pendingComponentWillMountWarnings.forEach(function (fiber) {
       
 11427           componentWillMountUniqueNames.add(getComponentName(fiber.type) || 'Component');
       
 11428           didWarnAboutUnsafeLifecycles.add(fiber.type);
       
 11429         });
       
 11430         pendingComponentWillMountWarnings = [];
       
 11431       }
       
 11432 
       
 11433       var UNSAFE_componentWillMountUniqueNames = new Set();
       
 11434 
       
 11435       if (pendingUNSAFE_ComponentWillMountWarnings.length > 0) {
       
 11436         pendingUNSAFE_ComponentWillMountWarnings.forEach(function (fiber) {
       
 11437           UNSAFE_componentWillMountUniqueNames.add(getComponentName(fiber.type) || 'Component');
       
 11438           didWarnAboutUnsafeLifecycles.add(fiber.type);
       
 11439         });
       
 11440         pendingUNSAFE_ComponentWillMountWarnings = [];
       
 11441       }
       
 11442 
       
 11443       var componentWillReceivePropsUniqueNames = new Set();
       
 11444 
       
 11445       if (pendingComponentWillReceivePropsWarnings.length > 0) {
       
 11446         pendingComponentWillReceivePropsWarnings.forEach(function (fiber) {
       
 11447           componentWillReceivePropsUniqueNames.add(getComponentName(fiber.type) || 'Component');
       
 11448           didWarnAboutUnsafeLifecycles.add(fiber.type);
       
 11449         });
       
 11450         pendingComponentWillReceivePropsWarnings = [];
       
 11451       }
       
 11452 
       
 11453       var UNSAFE_componentWillReceivePropsUniqueNames = new Set();
       
 11454 
       
 11455       if (pendingUNSAFE_ComponentWillReceivePropsWarnings.length > 0) {
       
 11456         pendingUNSAFE_ComponentWillReceivePropsWarnings.forEach(function (fiber) {
       
 11457           UNSAFE_componentWillReceivePropsUniqueNames.add(getComponentName(fiber.type) || 'Component');
       
 11458           didWarnAboutUnsafeLifecycles.add(fiber.type);
       
 11459         });
       
 11460         pendingUNSAFE_ComponentWillReceivePropsWarnings = [];
       
 11461       }
       
 11462 
       
 11463       var componentWillUpdateUniqueNames = new Set();
       
 11464 
       
 11465       if (pendingComponentWillUpdateWarnings.length > 0) {
       
 11466         pendingComponentWillUpdateWarnings.forEach(function (fiber) {
       
 11467           componentWillUpdateUniqueNames.add(getComponentName(fiber.type) || 'Component');
       
 11468           didWarnAboutUnsafeLifecycles.add(fiber.type);
       
 11469         });
       
 11470         pendingComponentWillUpdateWarnings = [];
       
 11471       }
       
 11472 
       
 11473       var UNSAFE_componentWillUpdateUniqueNames = new Set();
       
 11474 
       
 11475       if (pendingUNSAFE_ComponentWillUpdateWarnings.length > 0) {
       
 11476         pendingUNSAFE_ComponentWillUpdateWarnings.forEach(function (fiber) {
       
 11477           UNSAFE_componentWillUpdateUniqueNames.add(getComponentName(fiber.type) || 'Component');
       
 11478           didWarnAboutUnsafeLifecycles.add(fiber.type);
       
 11479         });
       
 11480         pendingUNSAFE_ComponentWillUpdateWarnings = [];
       
 11481       } // Finally, we flush all the warnings
       
 11482       // UNSAFE_ ones before the deprecated ones, since they'll be 'louder'
       
 11483 
       
 11484 
       
 11485       if (UNSAFE_componentWillMountUniqueNames.size > 0) {
       
 11486         var sortedNames = setToSortedString(UNSAFE_componentWillMountUniqueNames);
       
 11487 
       
 11488         error('Using UNSAFE_componentWillMount in strict mode is not recommended and may indicate bugs in your code. ' + 'See https://fb.me/react-unsafe-component-lifecycles for details.\n\n' + '* Move code with side effects to componentDidMount, and set initial state in the constructor.\n' + '\nPlease update the following components: %s', sortedNames);
       
 11489       }
       
 11490 
       
 11491       if (UNSAFE_componentWillReceivePropsUniqueNames.size > 0) {
       
 11492         var _sortedNames = setToSortedString(UNSAFE_componentWillReceivePropsUniqueNames);
       
 11493 
       
 11494         error('Using UNSAFE_componentWillReceiveProps in strict mode is not recommended ' + 'and may indicate bugs in your code. ' + 'See https://fb.me/react-unsafe-component-lifecycles for details.\n\n' + '* Move data fetching code or side effects to componentDidUpdate.\n' + "* If you're updating state whenever props change, " + 'refactor your code to use memoization techniques or move it to ' + 'static getDerivedStateFromProps. Learn more at: https://fb.me/react-derived-state\n' + '\nPlease update the following components: %s', _sortedNames);
       
 11495       }
       
 11496 
       
 11497       if (UNSAFE_componentWillUpdateUniqueNames.size > 0) {
       
 11498         var _sortedNames2 = setToSortedString(UNSAFE_componentWillUpdateUniqueNames);
       
 11499 
       
 11500         error('Using UNSAFE_componentWillUpdate in strict mode is not recommended ' + 'and may indicate bugs in your code. ' + 'See https://fb.me/react-unsafe-component-lifecycles for details.\n\n' + '* Move data fetching code or side effects to componentDidUpdate.\n' + '\nPlease update the following components: %s', _sortedNames2);
       
 11501       }
       
 11502 
       
 11503       if (componentWillMountUniqueNames.size > 0) {
       
 11504         var _sortedNames3 = setToSortedString(componentWillMountUniqueNames);
       
 11505 
       
 11506         warn('componentWillMount has been renamed, and is not recommended for use. ' + 'See https://fb.me/react-unsafe-component-lifecycles for details.\n\n' + '* Move code with side effects to componentDidMount, and set initial state in the constructor.\n' + '* Rename componentWillMount to UNSAFE_componentWillMount to suppress ' + 'this warning in non-strict mode. In React 17.x, only the UNSAFE_ name will work. ' + 'To rename all deprecated lifecycles to their new names, you can run ' + '`npx react-codemod rename-unsafe-lifecycles` in your project source folder.\n' + '\nPlease update the following components: %s', _sortedNames3);
       
 11507       }
       
 11508 
       
 11509       if (componentWillReceivePropsUniqueNames.size > 0) {
       
 11510         var _sortedNames4 = setToSortedString(componentWillReceivePropsUniqueNames);
       
 11511 
       
 11512         warn('componentWillReceiveProps has been renamed, and is not recommended for use. ' + 'See https://fb.me/react-unsafe-component-lifecycles for details.\n\n' + '* Move data fetching code or side effects to componentDidUpdate.\n' + "* If you're updating state whenever props change, refactor your " + 'code to use memoization techniques or move it to ' + 'static getDerivedStateFromProps. Learn more at: https://fb.me/react-derived-state\n' + '* Rename componentWillReceiveProps to UNSAFE_componentWillReceiveProps to suppress ' + 'this warning in non-strict mode. In React 17.x, only the UNSAFE_ name will work. ' + 'To rename all deprecated lifecycles to their new names, you can run ' + '`npx react-codemod rename-unsafe-lifecycles` in your project source folder.\n' + '\nPlease update the following components: %s', _sortedNames4);
       
 11513       }
       
 11514 
       
 11515       if (componentWillUpdateUniqueNames.size > 0) {
       
 11516         var _sortedNames5 = setToSortedString(componentWillUpdateUniqueNames);
       
 11517 
       
 11518         warn('componentWillUpdate has been renamed, and is not recommended for use. ' + 'See https://fb.me/react-unsafe-component-lifecycles for details.\n\n' + '* Move data fetching code or side effects to componentDidUpdate.\n' + '* Rename componentWillUpdate to UNSAFE_componentWillUpdate to suppress ' + 'this warning in non-strict mode. In React 17.x, only the UNSAFE_ name will work. ' + 'To rename all deprecated lifecycles to their new names, you can run ' + '`npx react-codemod rename-unsafe-lifecycles` in your project source folder.\n' + '\nPlease update the following components: %s', _sortedNames5);
       
 11519       }
       
 11520     };
       
 11521 
       
 11522     var pendingLegacyContextWarning = new Map(); // Tracks components we have already warned about.
       
 11523 
       
 11524     var didWarnAboutLegacyContext = new Set();
       
 11525 
       
 11526     ReactStrictModeWarnings.recordLegacyContextWarning = function (fiber, instance) {
       
 11527       var strictRoot = findStrictRoot(fiber);
       
 11528 
       
 11529       if (strictRoot === null) {
       
 11530         error('Expected to find a StrictMode component in a strict mode tree. ' + 'This error is likely caused by a bug in React. Please file an issue.');
       
 11531 
       
 11532         return;
       
 11533       } // Dedup strategy: Warn once per component.
       
 11534 
       
 11535 
       
 11536       if (didWarnAboutLegacyContext.has(fiber.type)) {
       
 11537         return;
       
 11538       }
       
 11539 
       
 11540       var warningsForRoot = pendingLegacyContextWarning.get(strictRoot);
       
 11541 
       
 11542       if (fiber.type.contextTypes != null || fiber.type.childContextTypes != null || instance !== null && typeof instance.getChildContext === 'function') {
       
 11543         if (warningsForRoot === undefined) {
       
 11544           warningsForRoot = [];
       
 11545           pendingLegacyContextWarning.set(strictRoot, warningsForRoot);
       
 11546         }
       
 11547 
       
 11548         warningsForRoot.push(fiber);
       
 11549       }
       
 11550     };
       
 11551 
       
 11552     ReactStrictModeWarnings.flushLegacyContextWarning = function () {
       
 11553       pendingLegacyContextWarning.forEach(function (fiberArray, strictRoot) {
       
 11554         if (fiberArray.length === 0) {
       
 11555           return;
       
 11556         }
       
 11557 
       
 11558         var firstFiber = fiberArray[0];
       
 11559         var uniqueNames = new Set();
       
 11560         fiberArray.forEach(function (fiber) {
       
 11561           uniqueNames.add(getComponentName(fiber.type) || 'Component');
       
 11562           didWarnAboutLegacyContext.add(fiber.type);
       
 11563         });
       
 11564         var sortedNames = setToSortedString(uniqueNames);
       
 11565         var firstComponentStack = getStackByFiberInDevAndProd(firstFiber);
       
 11566 
       
 11567         error('Legacy context API has been detected within a strict-mode tree.' + '\n\nThe old API will be supported in all 16.x releases, but applications ' + 'using it should migrate to the new version.' + '\n\nPlease update the following components: %s' + '\n\nLearn more about this warning here: https://fb.me/react-legacy-context' + '%s', sortedNames, firstComponentStack);
       
 11568       });
       
 11569     };
       
 11570 
       
 11571     ReactStrictModeWarnings.discardPendingWarnings = function () {
       
 11572       pendingComponentWillMountWarnings = [];
       
 11573       pendingUNSAFE_ComponentWillMountWarnings = [];
       
 11574       pendingComponentWillReceivePropsWarnings = [];
       
 11575       pendingUNSAFE_ComponentWillReceivePropsWarnings = [];
       
 11576       pendingComponentWillUpdateWarnings = [];
       
 11577       pendingUNSAFE_ComponentWillUpdateWarnings = [];
       
 11578       pendingLegacyContextWarning = new Map();
       
 11579     };
       
 11580   }
       
 11581 
       
 11582   var resolveFamily = null; // $FlowFixMe Flow gets confused by a WeakSet feature check below.
       
 11583 
       
 11584   var failedBoundaries = null;
       
 11585   var setRefreshHandler = function (handler) {
       
 11586     {
       
 11587       resolveFamily = handler;
       
 11588     }
       
 11589   };
       
 11590   function resolveFunctionForHotReloading(type) {
       
 11591     {
       
 11592       if (resolveFamily === null) {
       
 11593         // Hot reloading is disabled.
       
 11594         return type;
       
 11595       }
       
 11596 
       
 11597       var family = resolveFamily(type);
       
 11598 
       
 11599       if (family === undefined) {
       
 11600         return type;
       
 11601       } // Use the latest known implementation.
       
 11602 
       
 11603 
       
 11604       return family.current;
       
 11605     }
       
 11606   }
       
 11607   function resolveClassForHotReloading(type) {
       
 11608     // No implementation differences.
       
 11609     return resolveFunctionForHotReloading(type);
       
 11610   }
       
 11611   function resolveForwardRefForHotReloading(type) {
       
 11612     {
       
 11613       if (resolveFamily === null) {
       
 11614         // Hot reloading is disabled.
       
 11615         return type;
       
 11616       }
       
 11617 
       
 11618       var family = resolveFamily(type);
       
 11619 
       
 11620       if (family === undefined) {
       
 11621         // Check if we're dealing with a real forwardRef. Don't want to crash early.
       
 11622         if (type !== null && type !== undefined && typeof type.render === 'function') {
       
 11623           // ForwardRef is special because its resolved .type is an object,
       
 11624           // but it's possible that we only have its inner render function in the map.
       
 11625           // If that inner render function is different, we'll build a new forwardRef type.
       
 11626           var currentRender = resolveFunctionForHotReloading(type.render);
       
 11627 
       
 11628           if (type.render !== currentRender) {
       
 11629             var syntheticType = {
       
 11630               $$typeof: REACT_FORWARD_REF_TYPE,
       
 11631               render: currentRender
       
 11632             };
       
 11633 
       
 11634             if (type.displayName !== undefined) {
       
 11635               syntheticType.displayName = type.displayName;
       
 11636             }
       
 11637 
       
 11638             return syntheticType;
       
 11639           }
       
 11640         }
       
 11641 
       
 11642         return type;
       
 11643       } // Use the latest known implementation.
       
 11644 
       
 11645 
       
 11646       return family.current;
       
 11647     }
       
 11648   }
       
 11649   function isCompatibleFamilyForHotReloading(fiber, element) {
       
 11650     {
       
 11651       if (resolveFamily === null) {
       
 11652         // Hot reloading is disabled.
       
 11653         return false;
       
 11654       }
       
 11655 
       
 11656       var prevType = fiber.elementType;
       
 11657       var nextType = element.type; // If we got here, we know types aren't === equal.
       
 11658 
       
 11659       var needsCompareFamilies = false;
       
 11660       var $$typeofNextType = typeof nextType === 'object' && nextType !== null ? nextType.$$typeof : null;
       
 11661 
       
 11662       switch (fiber.tag) {
 11294         case ClassComponent:
 11663         case ClassComponent:
 11295           {
 11664           {
 11296             var Component = node.type;
 11665             if (typeof nextType === 'function') {
 11297             if (isContextProvider(Component)) {
 11666               needsCompareFamilies = true;
 11298               return node.stateNode.__reactInternalMemoizedMergedChildContext;
       
 11299             }
 11667             }
       
 11668 
 11300             break;
 11669             break;
 11301           }
 11670           }
 11302       }
 11671 
       
 11672         case FunctionComponent:
       
 11673           {
       
 11674             if (typeof nextType === 'function') {
       
 11675               needsCompareFamilies = true;
       
 11676             } else if ($$typeofNextType === REACT_LAZY_TYPE) {
       
 11677               // We don't know the inner type yet.
       
 11678               // We're going to assume that the lazy inner type is stable,
       
 11679               // and so it is sufficient to avoid reconciling it away.
       
 11680               // We're not going to unwrap or actually use the new lazy type.
       
 11681               needsCompareFamilies = true;
       
 11682             }
       
 11683 
       
 11684             break;
       
 11685           }
       
 11686 
       
 11687         case ForwardRef:
       
 11688           {
       
 11689             if ($$typeofNextType === REACT_FORWARD_REF_TYPE) {
       
 11690               needsCompareFamilies = true;
       
 11691             } else if ($$typeofNextType === REACT_LAZY_TYPE) {
       
 11692               needsCompareFamilies = true;
       
 11693             }
       
 11694 
       
 11695             break;
       
 11696           }
       
 11697 
       
 11698         case MemoComponent:
       
 11699         case SimpleMemoComponent:
       
 11700           {
       
 11701             if ($$typeofNextType === REACT_MEMO_TYPE) {
       
 11702               // TODO: if it was but can no longer be simple,
       
 11703               // we shouldn't set this.
       
 11704               needsCompareFamilies = true;
       
 11705             } else if ($$typeofNextType === REACT_LAZY_TYPE) {
       
 11706               needsCompareFamilies = true;
       
 11707             }
       
 11708 
       
 11709             break;
       
 11710           }
       
 11711 
       
 11712         default:
       
 11713           return false;
       
 11714       } // Check if both types have a family and it's the same one.
       
 11715 
       
 11716 
       
 11717       if (needsCompareFamilies) {
       
 11718         // Note: memo() and forwardRef() we'll compare outer rather than inner type.
       
 11719         // This means both of them need to be registered to preserve state.
       
 11720         // If we unwrapped and compared the inner types for wrappers instead,
       
 11721         // then we would risk falsely saying two separate memo(Foo)
       
 11722         // calls are equivalent because they wrap the same Foo function.
       
 11723         var prevFamily = resolveFamily(prevType);
       
 11724 
       
 11725         if (prevFamily !== undefined && prevFamily === resolveFamily(nextType)) {
       
 11726           return true;
       
 11727         }
       
 11728       }
       
 11729 
       
 11730       return false;
       
 11731     }
       
 11732   }
       
 11733   function markFailedErrorBoundaryForHotReloading(fiber) {
       
 11734     {
       
 11735       if (resolveFamily === null) {
       
 11736         // Hot reloading is disabled.
       
 11737         return;
       
 11738       }
       
 11739 
       
 11740       if (typeof WeakSet !== 'function') {
       
 11741         return;
       
 11742       }
       
 11743 
       
 11744       if (failedBoundaries === null) {
       
 11745         failedBoundaries = new WeakSet();
       
 11746       }
       
 11747 
       
 11748       failedBoundaries.add(fiber);
       
 11749     }
       
 11750   }
       
 11751   var scheduleRefresh = function (root, update) {
       
 11752     {
       
 11753       if (resolveFamily === null) {
       
 11754         // Hot reloading is disabled.
       
 11755         return;
       
 11756       }
       
 11757 
       
 11758       var staleFamilies = update.staleFamilies,
       
 11759           updatedFamilies = update.updatedFamilies;
       
 11760       flushPassiveEffects();
       
 11761       flushSync(function () {
       
 11762         scheduleFibersWithFamiliesRecursively(root.current, updatedFamilies, staleFamilies);
       
 11763       });
       
 11764     }
       
 11765   };
       
 11766   var scheduleRoot = function (root, element) {
       
 11767     {
       
 11768       if (root.context !== emptyContextObject) {
       
 11769         // Super edge case: root has a legacy _renderSubtree context
       
 11770         // but we don't know the parentComponent so we can't pass it.
       
 11771         // Just ignore. We'll delete this with _renderSubtree code path later.
       
 11772         return;
       
 11773       }
       
 11774 
       
 11775       flushPassiveEffects();
       
 11776       syncUpdates(function () {
       
 11777         updateContainer(element, root, null, null);
       
 11778       });
       
 11779     }
       
 11780   };
       
 11781 
       
 11782   function scheduleFibersWithFamiliesRecursively(fiber, updatedFamilies, staleFamilies) {
       
 11783     {
       
 11784       var alternate = fiber.alternate,
       
 11785           child = fiber.child,
       
 11786           sibling = fiber.sibling,
       
 11787           tag = fiber.tag,
       
 11788           type = fiber.type;
       
 11789       var candidateType = null;
       
 11790 
       
 11791       switch (tag) {
       
 11792         case FunctionComponent:
       
 11793         case SimpleMemoComponent:
       
 11794         case ClassComponent:
       
 11795           candidateType = type;
       
 11796           break;
       
 11797 
       
 11798         case ForwardRef:
       
 11799           candidateType = type.render;
       
 11800           break;
       
 11801       }
       
 11802 
       
 11803       if (resolveFamily === null) {
       
 11804         throw new Error('Expected resolveFamily to be set during hot reload.');
       
 11805       }
       
 11806 
       
 11807       var needsRender = false;
       
 11808       var needsRemount = false;
       
 11809 
       
 11810       if (candidateType !== null) {
       
 11811         var family = resolveFamily(candidateType);
       
 11812 
       
 11813         if (family !== undefined) {
       
 11814           if (staleFamilies.has(family)) {
       
 11815             needsRemount = true;
       
 11816           } else if (updatedFamilies.has(family)) {
       
 11817             if (tag === ClassComponent) {
       
 11818               needsRemount = true;
       
 11819             } else {
       
 11820               needsRender = true;
       
 11821             }
       
 11822           }
       
 11823         }
       
 11824       }
       
 11825 
       
 11826       if (failedBoundaries !== null) {
       
 11827         if (failedBoundaries.has(fiber) || alternate !== null && failedBoundaries.has(alternate)) {
       
 11828           needsRemount = true;
       
 11829         }
       
 11830       }
       
 11831 
       
 11832       if (needsRemount) {
       
 11833         fiber._debugNeedsRemount = true;
       
 11834       }
       
 11835 
       
 11836       if (needsRemount || needsRender) {
       
 11837         scheduleWork(fiber, Sync);
       
 11838       }
       
 11839 
       
 11840       if (child !== null && !needsRemount) {
       
 11841         scheduleFibersWithFamiliesRecursively(child, updatedFamilies, staleFamilies);
       
 11842       }
       
 11843 
       
 11844       if (sibling !== null) {
       
 11845         scheduleFibersWithFamiliesRecursively(sibling, updatedFamilies, staleFamilies);
       
 11846       }
       
 11847     }
       
 11848   }
       
 11849 
       
 11850   var findHostInstancesForRefresh = function (root, families) {
       
 11851     {
       
 11852       var hostInstances = new Set();
       
 11853       var types = new Set(families.map(function (family) {
       
 11854         return family.current;
       
 11855       }));
       
 11856       findHostInstancesForMatchingFibersRecursively(root.current, types, hostInstances);
       
 11857       return hostInstances;
       
 11858     }
       
 11859   };
       
 11860 
       
 11861   function findHostInstancesForMatchingFibersRecursively(fiber, types, hostInstances) {
       
 11862     {
       
 11863       var child = fiber.child,
       
 11864           sibling = fiber.sibling,
       
 11865           tag = fiber.tag,
       
 11866           type = fiber.type;
       
 11867       var candidateType = null;
       
 11868 
       
 11869       switch (tag) {
       
 11870         case FunctionComponent:
       
 11871         case SimpleMemoComponent:
       
 11872         case ClassComponent:
       
 11873           candidateType = type;
       
 11874           break;
       
 11875 
       
 11876         case ForwardRef:
       
 11877           candidateType = type.render;
       
 11878           break;
       
 11879       }
       
 11880 
       
 11881       var didMatch = false;
       
 11882 
       
 11883       if (candidateType !== null) {
       
 11884         if (types.has(candidateType)) {
       
 11885           didMatch = true;
       
 11886         }
       
 11887       }
       
 11888 
       
 11889       if (didMatch) {
       
 11890         // We have a match. This only drills down to the closest host components.
       
 11891         // There's no need to search deeper because for the purpose of giving
       
 11892         // visual feedback, "flashing" outermost parent rectangles is sufficient.
       
 11893         findHostInstancesForFiberShallowly(fiber, hostInstances);
       
 11894       } else {
       
 11895         // If there's no match, maybe there will be one further down in the child tree.
       
 11896         if (child !== null) {
       
 11897           findHostInstancesForMatchingFibersRecursively(child, types, hostInstances);
       
 11898         }
       
 11899       }
       
 11900 
       
 11901       if (sibling !== null) {
       
 11902         findHostInstancesForMatchingFibersRecursively(sibling, types, hostInstances);
       
 11903       }
       
 11904     }
       
 11905   }
       
 11906 
       
 11907   function findHostInstancesForFiberShallowly(fiber, hostInstances) {
       
 11908     {
       
 11909       var foundHostInstances = findChildHostInstancesForFiberShallowly(fiber, hostInstances);
       
 11910 
       
 11911       if (foundHostInstances) {
       
 11912         return;
       
 11913       } // If we didn't find any host children, fallback to closest host parent.
       
 11914 
       
 11915 
       
 11916       var node = fiber;
       
 11917 
       
 11918       while (true) {
       
 11919         switch (node.tag) {
       
 11920           case HostComponent:
       
 11921             hostInstances.add(node.stateNode);
       
 11922             return;
       
 11923 
       
 11924           case HostPortal:
       
 11925             hostInstances.add(node.stateNode.containerInfo);
       
 11926             return;
       
 11927 
       
 11928           case HostRoot:
       
 11929             hostInstances.add(node.stateNode.containerInfo);
       
 11930             return;
       
 11931         }
       
 11932 
       
 11933         if (node.return === null) {
       
 11934           throw new Error('Expected to reach root first.');
       
 11935         }
       
 11936 
       
 11937         node = node.return;
       
 11938       }
       
 11939     }
       
 11940   }
       
 11941 
       
 11942   function findChildHostInstancesForFiberShallowly(fiber, hostInstances) {
       
 11943     {
       
 11944       var node = fiber;
       
 11945       var foundHostInstances = false;
       
 11946 
       
 11947       while (true) {
       
 11948         if (node.tag === HostComponent) {
       
 11949           // We got a match.
       
 11950           foundHostInstances = true;
       
 11951           hostInstances.add(node.stateNode); // There may still be more, so keep searching.
       
 11952         } else if (node.child !== null) {
       
 11953           node.child.return = node;
       
 11954           node = node.child;
       
 11955           continue;
       
 11956         }
       
 11957 
       
 11958         if (node === fiber) {
       
 11959           return foundHostInstances;
       
 11960         }
       
 11961 
       
 11962         while (node.sibling === null) {
       
 11963           if (node.return === null || node.return === fiber) {
       
 11964             return foundHostInstances;
       
 11965           }
       
 11966 
       
 11967           node = node.return;
       
 11968         }
       
 11969 
       
 11970         node.sibling.return = node.return;
       
 11971         node = node.sibling;
       
 11972       }
       
 11973     }
       
 11974 
       
 11975     return false;
       
 11976   }
       
 11977 
       
 11978   function resolveDefaultProps(Component, baseProps) {
       
 11979     if (Component && Component.defaultProps) {
       
 11980       // Resolve default props. Taken from ReactElement
       
 11981       var props = _assign({}, baseProps);
       
 11982 
       
 11983       var defaultProps = Component.defaultProps;
       
 11984 
       
 11985       for (var propName in defaultProps) {
       
 11986         if (props[propName] === undefined) {
       
 11987           props[propName] = defaultProps[propName];
       
 11988         }
       
 11989       }
       
 11990 
       
 11991       return props;
       
 11992     }
       
 11993 
       
 11994     return baseProps;
       
 11995   }
       
 11996   function readLazyComponentType(lazyComponent) {
       
 11997     initializeLazyComponentType(lazyComponent);
       
 11998 
       
 11999     if (lazyComponent._status !== Resolved) {
       
 12000       throw lazyComponent._result;
       
 12001     }
       
 12002 
       
 12003     return lazyComponent._result;
       
 12004   }
       
 12005 
       
 12006   var valueCursor = createCursor(null);
       
 12007   var rendererSigil;
       
 12008 
       
 12009   {
       
 12010     // Use this to detect multiple renderers using the same context
       
 12011     rendererSigil = {};
       
 12012   }
       
 12013 
       
 12014   var currentlyRenderingFiber = null;
       
 12015   var lastContextDependency = null;
       
 12016   var lastContextWithAllBitsObserved = null;
       
 12017   var isDisallowedContextReadInDEV = false;
       
 12018   function resetContextDependencies() {
       
 12019     // This is called right before React yields execution, to ensure `readContext`
       
 12020     // cannot be called outside the render phase.
       
 12021     currentlyRenderingFiber = null;
       
 12022     lastContextDependency = null;
       
 12023     lastContextWithAllBitsObserved = null;
       
 12024 
       
 12025     {
       
 12026       isDisallowedContextReadInDEV = false;
       
 12027     }
       
 12028   }
       
 12029   function enterDisallowedContextReadInDEV() {
       
 12030     {
       
 12031       isDisallowedContextReadInDEV = true;
       
 12032     }
       
 12033   }
       
 12034   function exitDisallowedContextReadInDEV() {
       
 12035     {
       
 12036       isDisallowedContextReadInDEV = false;
       
 12037     }
       
 12038   }
       
 12039   function pushProvider(providerFiber, nextValue) {
       
 12040     var context = providerFiber.type._context;
       
 12041 
       
 12042     {
       
 12043       push(valueCursor, context._currentValue, providerFiber);
       
 12044       context._currentValue = nextValue;
       
 12045 
       
 12046       {
       
 12047         if (context._currentRenderer !== undefined && context._currentRenderer !== null && context._currentRenderer !== rendererSigil) {
       
 12048           error('Detected multiple renderers concurrently rendering the ' + 'same context provider. This is currently unsupported.');
       
 12049         }
       
 12050 
       
 12051         context._currentRenderer = rendererSigil;
       
 12052       }
       
 12053     }
       
 12054   }
       
 12055   function popProvider(providerFiber) {
       
 12056     var currentValue = valueCursor.current;
       
 12057     pop(valueCursor, providerFiber);
       
 12058     var context = providerFiber.type._context;
       
 12059 
       
 12060     {
       
 12061       context._currentValue = currentValue;
       
 12062     }
       
 12063   }
       
 12064   function calculateChangedBits(context, newValue, oldValue) {
       
 12065     if (objectIs(oldValue, newValue)) {
       
 12066       // No change
       
 12067       return 0;
       
 12068     } else {
       
 12069       var changedBits = typeof context._calculateChangedBits === 'function' ? context._calculateChangedBits(oldValue, newValue) : MAX_SIGNED_31_BIT_INT;
       
 12070 
       
 12071       {
       
 12072         if ((changedBits & MAX_SIGNED_31_BIT_INT) !== changedBits) {
       
 12073           error('calculateChangedBits: Expected the return value to be a ' + '31-bit integer. Instead received: %s', changedBits);
       
 12074         }
       
 12075       }
       
 12076 
       
 12077       return changedBits | 0;
       
 12078     }
       
 12079   }
       
 12080   function scheduleWorkOnParentPath(parent, renderExpirationTime) {
       
 12081     // Update the child expiration time of all the ancestors, including
       
 12082     // the alternates.
       
 12083     var node = parent;
       
 12084 
       
 12085     while (node !== null) {
       
 12086       var alternate = node.alternate;
       
 12087 
       
 12088       if (node.childExpirationTime < renderExpirationTime) {
       
 12089         node.childExpirationTime = renderExpirationTime;
       
 12090 
       
 12091         if (alternate !== null && alternate.childExpirationTime < renderExpirationTime) {
       
 12092           alternate.childExpirationTime = renderExpirationTime;
       
 12093         }
       
 12094       } else if (alternate !== null && alternate.childExpirationTime < renderExpirationTime) {
       
 12095         alternate.childExpirationTime = renderExpirationTime;
       
 12096       } else {
       
 12097         // Neither alternate was updated, which means the rest of the
       
 12098         // ancestor path already has sufficient priority.
       
 12099         break;
       
 12100       }
       
 12101 
 11303       node = node.return;
 12102       node = node.return;
 11304     } while (node !== null);
 12103     }
 11305     (function () {
 12104   }
       
 12105   function propagateContextChange(workInProgress, context, changedBits, renderExpirationTime) {
       
 12106     var fiber = workInProgress.child;
       
 12107 
       
 12108     if (fiber !== null) {
       
 12109       // Set the return pointer of the child to the work-in-progress fiber.
       
 12110       fiber.return = workInProgress;
       
 12111     }
       
 12112 
       
 12113     while (fiber !== null) {
       
 12114       var nextFiber = void 0; // Visit this fiber.
       
 12115 
       
 12116       var list = fiber.dependencies;
       
 12117 
       
 12118       if (list !== null) {
       
 12119         nextFiber = fiber.child;
       
 12120         var dependency = list.firstContext;
       
 12121 
       
 12122         while (dependency !== null) {
       
 12123           // Check if the context matches.
       
 12124           if (dependency.context === context && (dependency.observedBits & changedBits) !== 0) {
       
 12125             // Match! Schedule an update on this fiber.
       
 12126             if (fiber.tag === ClassComponent) {
       
 12127               // Schedule a force update on the work-in-progress.
       
 12128               var update = createUpdate(renderExpirationTime, null);
       
 12129               update.tag = ForceUpdate; // TODO: Because we don't have a work-in-progress, this will add the
       
 12130               // update to the current fiber, too, which means it will persist even if
       
 12131               // this render is thrown away. Since it's a race condition, not sure it's
       
 12132               // worth fixing.
       
 12133 
       
 12134               enqueueUpdate(fiber, update);
       
 12135             }
       
 12136 
       
 12137             if (fiber.expirationTime < renderExpirationTime) {
       
 12138               fiber.expirationTime = renderExpirationTime;
       
 12139             }
       
 12140 
       
 12141             var alternate = fiber.alternate;
       
 12142 
       
 12143             if (alternate !== null && alternate.expirationTime < renderExpirationTime) {
       
 12144               alternate.expirationTime = renderExpirationTime;
       
 12145             }
       
 12146 
       
 12147             scheduleWorkOnParentPath(fiber.return, renderExpirationTime); // Mark the expiration time on the list, too.
       
 12148 
       
 12149             if (list.expirationTime < renderExpirationTime) {
       
 12150               list.expirationTime = renderExpirationTime;
       
 12151             } // Since we already found a match, we can stop traversing the
       
 12152             // dependency list.
       
 12153 
       
 12154 
       
 12155             break;
       
 12156           }
       
 12157 
       
 12158           dependency = dependency.next;
       
 12159         }
       
 12160       } else if (fiber.tag === ContextProvider) {
       
 12161         // Don't scan deeper if this is a matching provider
       
 12162         nextFiber = fiber.type === workInProgress.type ? null : fiber.child;
       
 12163       } else {
       
 12164         // Traverse down.
       
 12165         nextFiber = fiber.child;
       
 12166       }
       
 12167 
       
 12168       if (nextFiber !== null) {
       
 12169         // Set the return pointer of the child to the work-in-progress fiber.
       
 12170         nextFiber.return = fiber;
       
 12171       } else {
       
 12172         // No child. Traverse to next sibling.
       
 12173         nextFiber = fiber;
       
 12174 
       
 12175         while (nextFiber !== null) {
       
 12176           if (nextFiber === workInProgress) {
       
 12177             // We're back to the root of this subtree. Exit.
       
 12178             nextFiber = null;
       
 12179             break;
       
 12180           }
       
 12181 
       
 12182           var sibling = nextFiber.sibling;
       
 12183 
       
 12184           if (sibling !== null) {
       
 12185             // Set the return pointer of the sibling to the work-in-progress fiber.
       
 12186             sibling.return = nextFiber.return;
       
 12187             nextFiber = sibling;
       
 12188             break;
       
 12189           } // No more siblings. Traverse up.
       
 12190 
       
 12191 
       
 12192           nextFiber = nextFiber.return;
       
 12193         }
       
 12194       }
       
 12195 
       
 12196       fiber = nextFiber;
       
 12197     }
       
 12198   }
       
 12199   function prepareToReadContext(workInProgress, renderExpirationTime) {
       
 12200     currentlyRenderingFiber = workInProgress;
       
 12201     lastContextDependency = null;
       
 12202     lastContextWithAllBitsObserved = null;
       
 12203     var dependencies = workInProgress.dependencies;
       
 12204 
       
 12205     if (dependencies !== null) {
       
 12206       var firstContext = dependencies.firstContext;
       
 12207 
       
 12208       if (firstContext !== null) {
       
 12209         if (dependencies.expirationTime >= renderExpirationTime) {
       
 12210           // Context list has a pending update. Mark that this fiber performed work.
       
 12211           markWorkInProgressReceivedUpdate();
       
 12212         } // Reset the work-in-progress list
       
 12213 
       
 12214 
       
 12215         dependencies.firstContext = null;
       
 12216       }
       
 12217     }
       
 12218   }
       
 12219   function readContext(context, observedBits) {
       
 12220     {
       
 12221       // This warning would fire if you read context inside a Hook like useMemo.
       
 12222       // Unlike the class check below, it's not enforced in production for perf.
       
 12223       if (isDisallowedContextReadInDEV) {
       
 12224         error('Context can only be read while React is rendering. ' + 'In classes, you can read it in the render method or getDerivedStateFromProps. ' + 'In function components, you can read it directly in the function body, but not ' + 'inside Hooks like useReducer() or useMemo().');
       
 12225       }
       
 12226     }
       
 12227 
       
 12228     if (lastContextWithAllBitsObserved === context) ; else if (observedBits === false || observedBits === 0) ; else {
       
 12229       var resolvedObservedBits; // Avoid deopting on observable arguments or heterogeneous types.
       
 12230 
       
 12231       if (typeof observedBits !== 'number' || observedBits === MAX_SIGNED_31_BIT_INT) {
       
 12232         // Observe all updates.
       
 12233         lastContextWithAllBitsObserved = context;
       
 12234         resolvedObservedBits = MAX_SIGNED_31_BIT_INT;
       
 12235       } else {
       
 12236         resolvedObservedBits = observedBits;
       
 12237       }
       
 12238 
       
 12239       var contextItem = {
       
 12240         context: context,
       
 12241         observedBits: resolvedObservedBits,
       
 12242         next: null
       
 12243       };
       
 12244 
       
 12245       if (lastContextDependency === null) {
       
 12246         if (!(currentlyRenderingFiber !== null)) {
       
 12247           {
       
 12248             throw Error( "Context can only be read while React is rendering. In classes, you can read it in the render method or getDerivedStateFromProps. In function components, you can read it directly in the function body, but not inside Hooks like useReducer() or useMemo()." );
       
 12249           }
       
 12250         } // This is the first dependency for this component. Create a new list.
       
 12251 
       
 12252 
       
 12253         lastContextDependency = contextItem;
       
 12254         currentlyRenderingFiber.dependencies = {
       
 12255           expirationTime: NoWork,
       
 12256           firstContext: contextItem,
       
 12257           responders: null
       
 12258         };
       
 12259       } else {
       
 12260         // Append a new context item.
       
 12261         lastContextDependency = lastContextDependency.next = contextItem;
       
 12262       }
       
 12263     }
       
 12264 
       
 12265     return  context._currentValue ;
       
 12266   }
       
 12267 
       
 12268   var UpdateState = 0;
       
 12269   var ReplaceState = 1;
       
 12270   var ForceUpdate = 2;
       
 12271   var CaptureUpdate = 3; // Global state that is reset at the beginning of calling `processUpdateQueue`.
       
 12272   // It should only be read right after calling `processUpdateQueue`, via
       
 12273   // `checkHasForceUpdateAfterProcessing`.
       
 12274 
       
 12275   var hasForceUpdate = false;
       
 12276   var didWarnUpdateInsideUpdate;
       
 12277   var currentlyProcessingQueue;
       
 12278 
       
 12279   {
       
 12280     didWarnUpdateInsideUpdate = false;
       
 12281     currentlyProcessingQueue = null;
       
 12282   }
       
 12283 
       
 12284   function initializeUpdateQueue(fiber) {
       
 12285     var queue = {
       
 12286       baseState: fiber.memoizedState,
       
 12287       baseQueue: null,
       
 12288       shared: {
       
 12289         pending: null
       
 12290       },
       
 12291       effects: null
       
 12292     };
       
 12293     fiber.updateQueue = queue;
       
 12294   }
       
 12295   function cloneUpdateQueue(current, workInProgress) {
       
 12296     // Clone the update queue from current. Unless it's already a clone.
       
 12297     var queue = workInProgress.updateQueue;
       
 12298     var currentQueue = current.updateQueue;
       
 12299 
       
 12300     if (queue === currentQueue) {
       
 12301       var clone = {
       
 12302         baseState: currentQueue.baseState,
       
 12303         baseQueue: currentQueue.baseQueue,
       
 12304         shared: currentQueue.shared,
       
 12305         effects: currentQueue.effects
       
 12306       };
       
 12307       workInProgress.updateQueue = clone;
       
 12308     }
       
 12309   }
       
 12310   function createUpdate(expirationTime, suspenseConfig) {
       
 12311     var update = {
       
 12312       expirationTime: expirationTime,
       
 12313       suspenseConfig: suspenseConfig,
       
 12314       tag: UpdateState,
       
 12315       payload: null,
       
 12316       callback: null,
       
 12317       next: null
       
 12318     };
       
 12319     update.next = update;
       
 12320 
       
 12321     {
       
 12322       update.priority = getCurrentPriorityLevel();
       
 12323     }
       
 12324 
       
 12325     return update;
       
 12326   }
       
 12327   function enqueueUpdate(fiber, update) {
       
 12328     var updateQueue = fiber.updateQueue;
       
 12329 
       
 12330     if (updateQueue === null) {
       
 12331       // Only occurs if the fiber has been unmounted.
       
 12332       return;
       
 12333     }
       
 12334 
       
 12335     var sharedQueue = updateQueue.shared;
       
 12336     var pending = sharedQueue.pending;
       
 12337 
       
 12338     if (pending === null) {
       
 12339       // This is the first update. Create a circular list.
       
 12340       update.next = update;
       
 12341     } else {
       
 12342       update.next = pending.next;
       
 12343       pending.next = update;
       
 12344     }
       
 12345 
       
 12346     sharedQueue.pending = update;
       
 12347 
       
 12348     {
       
 12349       if (currentlyProcessingQueue === sharedQueue && !didWarnUpdateInsideUpdate) {
       
 12350         error('An update (setState, replaceState, or forceUpdate) was scheduled ' + 'from inside an update function. Update functions should be pure, ' + 'with zero side-effects. Consider using componentDidUpdate or a ' + 'callback.');
       
 12351 
       
 12352         didWarnUpdateInsideUpdate = true;
       
 12353       }
       
 12354     }
       
 12355   }
       
 12356   function enqueueCapturedUpdate(workInProgress, update) {
       
 12357     var current = workInProgress.alternate;
       
 12358 
       
 12359     if (current !== null) {
       
 12360       // Ensure the work-in-progress queue is a clone
       
 12361       cloneUpdateQueue(current, workInProgress);
       
 12362     } // Captured updates go only on the work-in-progress queue.
       
 12363 
       
 12364 
       
 12365     var queue = workInProgress.updateQueue; // Append the update to the end of the list.
       
 12366 
       
 12367     var last = queue.baseQueue;
       
 12368 
       
 12369     if (last === null) {
       
 12370       queue.baseQueue = update.next = update;
       
 12371       update.next = update;
       
 12372     } else {
       
 12373       update.next = last.next;
       
 12374       last.next = update;
       
 12375     }
       
 12376   }
       
 12377 
       
 12378   function getStateFromUpdate(workInProgress, queue, update, prevState, nextProps, instance) {
       
 12379     switch (update.tag) {
       
 12380       case ReplaceState:
       
 12381         {
       
 12382           var payload = update.payload;
       
 12383 
       
 12384           if (typeof payload === 'function') {
       
 12385             // Updater function
       
 12386             {
       
 12387               enterDisallowedContextReadInDEV();
       
 12388 
       
 12389               if ( workInProgress.mode & StrictMode) {
       
 12390                 payload.call(instance, prevState, nextProps);
       
 12391               }
       
 12392             }
       
 12393 
       
 12394             var nextState = payload.call(instance, prevState, nextProps);
       
 12395 
       
 12396             {
       
 12397               exitDisallowedContextReadInDEV();
       
 12398             }
       
 12399 
       
 12400             return nextState;
       
 12401           } // State object
       
 12402 
       
 12403 
       
 12404           return payload;
       
 12405         }
       
 12406 
       
 12407       case CaptureUpdate:
       
 12408         {
       
 12409           workInProgress.effectTag = workInProgress.effectTag & ~ShouldCapture | DidCapture;
       
 12410         }
       
 12411       // Intentional fallthrough
       
 12412 
       
 12413       case UpdateState:
       
 12414         {
       
 12415           var _payload = update.payload;
       
 12416           var partialState;
       
 12417 
       
 12418           if (typeof _payload === 'function') {
       
 12419             // Updater function
       
 12420             {
       
 12421               enterDisallowedContextReadInDEV();
       
 12422 
       
 12423               if ( workInProgress.mode & StrictMode) {
       
 12424                 _payload.call(instance, prevState, nextProps);
       
 12425               }
       
 12426             }
       
 12427 
       
 12428             partialState = _payload.call(instance, prevState, nextProps);
       
 12429 
       
 12430             {
       
 12431               exitDisallowedContextReadInDEV();
       
 12432             }
       
 12433           } else {
       
 12434             // Partial state object
       
 12435             partialState = _payload;
       
 12436           }
       
 12437 
       
 12438           if (partialState === null || partialState === undefined) {
       
 12439             // Null and undefined are treated as no-ops.
       
 12440             return prevState;
       
 12441           } // Merge the partial state and the previous state.
       
 12442 
       
 12443 
       
 12444           return _assign({}, prevState, partialState);
       
 12445         }
       
 12446 
       
 12447       case ForceUpdate:
       
 12448         {
       
 12449           hasForceUpdate = true;
       
 12450           return prevState;
       
 12451         }
       
 12452     }
       
 12453 
       
 12454     return prevState;
       
 12455   }
       
 12456 
       
 12457   function processUpdateQueue(workInProgress, props, instance, renderExpirationTime) {
       
 12458     // This is always non-null on a ClassComponent or HostRoot
       
 12459     var queue = workInProgress.updateQueue;
       
 12460     hasForceUpdate = false;
       
 12461 
       
 12462     {
       
 12463       currentlyProcessingQueue = queue.shared;
       
 12464     } // The last rebase update that is NOT part of the base state.
       
 12465 
       
 12466 
       
 12467     var baseQueue = queue.baseQueue; // The last pending update that hasn't been processed yet.
       
 12468 
       
 12469     var pendingQueue = queue.shared.pending;
       
 12470 
       
 12471     if (pendingQueue !== null) {
       
 12472       // We have new updates that haven't been processed yet.
       
 12473       // We'll add them to the base queue.
       
 12474       if (baseQueue !== null) {
       
 12475         // Merge the pending queue and the base queue.
       
 12476         var baseFirst = baseQueue.next;
       
 12477         var pendingFirst = pendingQueue.next;
       
 12478         baseQueue.next = pendingFirst;
       
 12479         pendingQueue.next = baseFirst;
       
 12480       }
       
 12481 
       
 12482       baseQueue = pendingQueue;
       
 12483       queue.shared.pending = null; // TODO: Pass `current` as argument
       
 12484 
       
 12485       var current = workInProgress.alternate;
       
 12486 
       
 12487       if (current !== null) {
       
 12488         var currentQueue = current.updateQueue;
       
 12489 
       
 12490         if (currentQueue !== null) {
       
 12491           currentQueue.baseQueue = pendingQueue;
       
 12492         }
       
 12493       }
       
 12494     } // These values may change as we process the queue.
       
 12495 
       
 12496 
       
 12497     if (baseQueue !== null) {
       
 12498       var first = baseQueue.next; // Iterate through the list of updates to compute the result.
       
 12499 
       
 12500       var newState = queue.baseState;
       
 12501       var newExpirationTime = NoWork;
       
 12502       var newBaseState = null;
       
 12503       var newBaseQueueFirst = null;
       
 12504       var newBaseQueueLast = null;
       
 12505 
       
 12506       if (first !== null) {
       
 12507         var update = first;
       
 12508 
       
 12509         do {
       
 12510           var updateExpirationTime = update.expirationTime;
       
 12511 
       
 12512           if (updateExpirationTime < renderExpirationTime) {
       
 12513             // Priority is insufficient. Skip this update. If this is the first
       
 12514             // skipped update, the previous update/state is the new base
       
 12515             // update/state.
       
 12516             var clone = {
       
 12517               expirationTime: update.expirationTime,
       
 12518               suspenseConfig: update.suspenseConfig,
       
 12519               tag: update.tag,
       
 12520               payload: update.payload,
       
 12521               callback: update.callback,
       
 12522               next: null
       
 12523             };
       
 12524 
       
 12525             if (newBaseQueueLast === null) {
       
 12526               newBaseQueueFirst = newBaseQueueLast = clone;
       
 12527               newBaseState = newState;
       
 12528             } else {
       
 12529               newBaseQueueLast = newBaseQueueLast.next = clone;
       
 12530             } // Update the remaining priority in the queue.
       
 12531 
       
 12532 
       
 12533             if (updateExpirationTime > newExpirationTime) {
       
 12534               newExpirationTime = updateExpirationTime;
       
 12535             }
       
 12536           } else {
       
 12537             // This update does have sufficient priority.
       
 12538             if (newBaseQueueLast !== null) {
       
 12539               var _clone = {
       
 12540                 expirationTime: Sync,
       
 12541                 // This update is going to be committed so we never want uncommit it.
       
 12542                 suspenseConfig: update.suspenseConfig,
       
 12543                 tag: update.tag,
       
 12544                 payload: update.payload,
       
 12545                 callback: update.callback,
       
 12546                 next: null
       
 12547               };
       
 12548               newBaseQueueLast = newBaseQueueLast.next = _clone;
       
 12549             } // Mark the event time of this update as relevant to this render pass.
       
 12550             // TODO: This should ideally use the true event time of this update rather than
       
 12551             // its priority which is a derived and not reverseable value.
       
 12552             // TODO: We should skip this update if it was already committed but currently
       
 12553             // we have no way of detecting the difference between a committed and suspended
       
 12554             // update here.
       
 12555 
       
 12556 
       
 12557             markRenderEventTimeAndConfig(updateExpirationTime, update.suspenseConfig); // Process this update.
       
 12558 
       
 12559             newState = getStateFromUpdate(workInProgress, queue, update, newState, props, instance);
       
 12560             var callback = update.callback;
       
 12561 
       
 12562             if (callback !== null) {
       
 12563               workInProgress.effectTag |= Callback;
       
 12564               var effects = queue.effects;
       
 12565 
       
 12566               if (effects === null) {
       
 12567                 queue.effects = [update];
       
 12568               } else {
       
 12569                 effects.push(update);
       
 12570               }
       
 12571             }
       
 12572           }
       
 12573 
       
 12574           update = update.next;
       
 12575 
       
 12576           if (update === null || update === first) {
       
 12577             pendingQueue = queue.shared.pending;
       
 12578 
       
 12579             if (pendingQueue === null) {
       
 12580               break;
       
 12581             } else {
       
 12582               // An update was scheduled from inside a reducer. Add the new
       
 12583               // pending updates to the end of the list and keep processing.
       
 12584               update = baseQueue.next = pendingQueue.next;
       
 12585               pendingQueue.next = first;
       
 12586               queue.baseQueue = baseQueue = pendingQueue;
       
 12587               queue.shared.pending = null;
       
 12588             }
       
 12589           }
       
 12590         } while (true);
       
 12591       }
       
 12592 
       
 12593       if (newBaseQueueLast === null) {
       
 12594         newBaseState = newState;
       
 12595       } else {
       
 12596         newBaseQueueLast.next = newBaseQueueFirst;
       
 12597       }
       
 12598 
       
 12599       queue.baseState = newBaseState;
       
 12600       queue.baseQueue = newBaseQueueLast; // Set the remaining expiration time to be whatever is remaining in the queue.
       
 12601       // This should be fine because the only two other things that contribute to
       
 12602       // expiration time are props and context. We're already in the middle of the
       
 12603       // begin phase by the time we start processing the queue, so we've already
       
 12604       // dealt with the props. Context in components that specify
       
 12605       // shouldComponentUpdate is tricky; but we'll have to account for
       
 12606       // that regardless.
       
 12607 
       
 12608       markUnprocessedUpdateTime(newExpirationTime);
       
 12609       workInProgress.expirationTime = newExpirationTime;
       
 12610       workInProgress.memoizedState = newState;
       
 12611     }
       
 12612 
       
 12613     {
       
 12614       currentlyProcessingQueue = null;
       
 12615     }
       
 12616   }
       
 12617 
       
 12618   function callCallback(callback, context) {
       
 12619     if (!(typeof callback === 'function')) {
       
 12620       {
       
 12621         throw Error( "Invalid argument passed as callback. Expected a function. Instead received: " + callback );
       
 12622       }
       
 12623     }
       
 12624 
       
 12625     callback.call(context);
       
 12626   }
       
 12627 
       
 12628   function resetHasForceUpdateBeforeProcessing() {
       
 12629     hasForceUpdate = false;
       
 12630   }
       
 12631   function checkHasForceUpdateAfterProcessing() {
       
 12632     return hasForceUpdate;
       
 12633   }
       
 12634   function commitUpdateQueue(finishedWork, finishedQueue, instance) {
       
 12635     // Commit the effects
       
 12636     var effects = finishedQueue.effects;
       
 12637     finishedQueue.effects = null;
       
 12638 
       
 12639     if (effects !== null) {
       
 12640       for (var i = 0; i < effects.length; i++) {
       
 12641         var effect = effects[i];
       
 12642         var callback = effect.callback;
       
 12643 
       
 12644         if (callback !== null) {
       
 12645           effect.callback = null;
       
 12646           callCallback(callback, instance);
       
 12647         }
       
 12648       }
       
 12649     }
       
 12650   }
       
 12651 
       
 12652   var ReactCurrentBatchConfig = ReactSharedInternals.ReactCurrentBatchConfig;
       
 12653   function requestCurrentSuspenseConfig() {
       
 12654     return ReactCurrentBatchConfig.suspense;
       
 12655   }
       
 12656 
       
 12657   var fakeInternalInstance = {};
       
 12658   var isArray = Array.isArray; // React.Component uses a shared frozen object by default.
       
 12659   // We'll use it to determine whether we need to initialize legacy refs.
       
 12660 
       
 12661   var emptyRefsObject = new React.Component().refs;
       
 12662   var didWarnAboutStateAssignmentForComponent;
       
 12663   var didWarnAboutUninitializedState;
       
 12664   var didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate;
       
 12665   var didWarnAboutLegacyLifecyclesAndDerivedState;
       
 12666   var didWarnAboutUndefinedDerivedState;
       
 12667   var warnOnUndefinedDerivedState;
       
 12668   var warnOnInvalidCallback;
       
 12669   var didWarnAboutDirectlyAssigningPropsToState;
       
 12670   var didWarnAboutContextTypeAndContextTypes;
       
 12671   var didWarnAboutInvalidateContextType;
       
 12672 
       
 12673   {
       
 12674     didWarnAboutStateAssignmentForComponent = new Set();
       
 12675     didWarnAboutUninitializedState = new Set();
       
 12676     didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate = new Set();
       
 12677     didWarnAboutLegacyLifecyclesAndDerivedState = new Set();
       
 12678     didWarnAboutDirectlyAssigningPropsToState = new Set();
       
 12679     didWarnAboutUndefinedDerivedState = new Set();
       
 12680     didWarnAboutContextTypeAndContextTypes = new Set();
       
 12681     didWarnAboutInvalidateContextType = new Set();
       
 12682     var didWarnOnInvalidCallback = new Set();
       
 12683 
       
 12684     warnOnInvalidCallback = function (callback, callerName) {
       
 12685       if (callback === null || typeof callback === 'function') {
       
 12686         return;
       
 12687       }
       
 12688 
       
 12689       var key = callerName + "_" + callback;
       
 12690 
       
 12691       if (!didWarnOnInvalidCallback.has(key)) {
       
 12692         didWarnOnInvalidCallback.add(key);
       
 12693 
       
 12694         error('%s(...): Expected the last optional `callback` argument to be a ' + 'function. Instead received: %s.', callerName, callback);
       
 12695       }
       
 12696     };
       
 12697 
       
 12698     warnOnUndefinedDerivedState = function (type, partialState) {
       
 12699       if (partialState === undefined) {
       
 12700         var componentName = getComponentName(type) || 'Component';
       
 12701 
       
 12702         if (!didWarnAboutUndefinedDerivedState.has(componentName)) {
       
 12703           didWarnAboutUndefinedDerivedState.add(componentName);
       
 12704 
       
 12705           error('%s.getDerivedStateFromProps(): A valid state object (or null) must be returned. ' + 'You have returned undefined.', componentName);
       
 12706         }
       
 12707       }
       
 12708     }; // This is so gross but it's at least non-critical and can be removed if
       
 12709     // it causes problems. This is meant to give a nicer error message for
       
 12710     // ReactDOM15.unstable_renderSubtreeIntoContainer(reactDOM16Component,
       
 12711     // ...)) which otherwise throws a "_processChildContext is not a function"
       
 12712     // exception.
       
 12713 
       
 12714 
       
 12715     Object.defineProperty(fakeInternalInstance, '_processChildContext', {
       
 12716       enumerable: false,
       
 12717       value: function () {
       
 12718         {
       
 12719           {
       
 12720             throw Error( "_processChildContext is not available in React 16+. This likely means you have multiple copies of React and are attempting to nest a React 15 tree inside a React 16 tree using unstable_renderSubtreeIntoContainer, which isn't supported. Try to make sure you have only one copy of React (and ideally, switch to ReactDOM.createPortal)." );
       
 12721           }
       
 12722         }
       
 12723       }
       
 12724     });
       
 12725     Object.freeze(fakeInternalInstance);
       
 12726   }
       
 12727 
       
 12728   function applyDerivedStateFromProps(workInProgress, ctor, getDerivedStateFromProps, nextProps) {
       
 12729     var prevState = workInProgress.memoizedState;
       
 12730 
       
 12731     {
       
 12732       if ( workInProgress.mode & StrictMode) {
       
 12733         // Invoke the function an extra time to help detect side-effects.
       
 12734         getDerivedStateFromProps(nextProps, prevState);
       
 12735       }
       
 12736     }
       
 12737 
       
 12738     var partialState = getDerivedStateFromProps(nextProps, prevState);
       
 12739 
       
 12740     {
       
 12741       warnOnUndefinedDerivedState(ctor, partialState);
       
 12742     } // Merge the partial state and the previous state.
       
 12743 
       
 12744 
       
 12745     var memoizedState = partialState === null || partialState === undefined ? prevState : _assign({}, prevState, partialState);
       
 12746     workInProgress.memoizedState = memoizedState; // Once the update queue is empty, persist the derived state onto the
       
 12747     // base state.
       
 12748 
       
 12749     if (workInProgress.expirationTime === NoWork) {
       
 12750       // Queue is always non-null for classes
       
 12751       var updateQueue = workInProgress.updateQueue;
       
 12752       updateQueue.baseState = memoizedState;
       
 12753     }
       
 12754   }
       
 12755   var classComponentUpdater = {
       
 12756     isMounted: isMounted,
       
 12757     enqueueSetState: function (inst, payload, callback) {
       
 12758       var fiber = get(inst);
       
 12759       var currentTime = requestCurrentTimeForUpdate();
       
 12760       var suspenseConfig = requestCurrentSuspenseConfig();
       
 12761       var expirationTime = computeExpirationForFiber(currentTime, fiber, suspenseConfig);
       
 12762       var update = createUpdate(expirationTime, suspenseConfig);
       
 12763       update.payload = payload;
       
 12764 
       
 12765       if (callback !== undefined && callback !== null) {
       
 12766         {
       
 12767           warnOnInvalidCallback(callback, 'setState');
       
 12768         }
       
 12769 
       
 12770         update.callback = callback;
       
 12771       }
       
 12772 
       
 12773       enqueueUpdate(fiber, update);
       
 12774       scheduleWork(fiber, expirationTime);
       
 12775     },
       
 12776     enqueueReplaceState: function (inst, payload, callback) {
       
 12777       var fiber = get(inst);
       
 12778       var currentTime = requestCurrentTimeForUpdate();
       
 12779       var suspenseConfig = requestCurrentSuspenseConfig();
       
 12780       var expirationTime = computeExpirationForFiber(currentTime, fiber, suspenseConfig);
       
 12781       var update = createUpdate(expirationTime, suspenseConfig);
       
 12782       update.tag = ReplaceState;
       
 12783       update.payload = payload;
       
 12784 
       
 12785       if (callback !== undefined && callback !== null) {
       
 12786         {
       
 12787           warnOnInvalidCallback(callback, 'replaceState');
       
 12788         }
       
 12789 
       
 12790         update.callback = callback;
       
 12791       }
       
 12792 
       
 12793       enqueueUpdate(fiber, update);
       
 12794       scheduleWork(fiber, expirationTime);
       
 12795     },
       
 12796     enqueueForceUpdate: function (inst, callback) {
       
 12797       var fiber = get(inst);
       
 12798       var currentTime = requestCurrentTimeForUpdate();
       
 12799       var suspenseConfig = requestCurrentSuspenseConfig();
       
 12800       var expirationTime = computeExpirationForFiber(currentTime, fiber, suspenseConfig);
       
 12801       var update = createUpdate(expirationTime, suspenseConfig);
       
 12802       update.tag = ForceUpdate;
       
 12803 
       
 12804       if (callback !== undefined && callback !== null) {
       
 12805         {
       
 12806           warnOnInvalidCallback(callback, 'forceUpdate');
       
 12807         }
       
 12808 
       
 12809         update.callback = callback;
       
 12810       }
       
 12811 
       
 12812       enqueueUpdate(fiber, update);
       
 12813       scheduleWork(fiber, expirationTime);
       
 12814     }
       
 12815   };
       
 12816 
       
 12817   function checkShouldComponentUpdate(workInProgress, ctor, oldProps, newProps, oldState, newState, nextContext) {
       
 12818     var instance = workInProgress.stateNode;
       
 12819 
       
 12820     if (typeof instance.shouldComponentUpdate === 'function') {
       
 12821       {
       
 12822         if ( workInProgress.mode & StrictMode) {
       
 12823           // Invoke the function an extra time to help detect side-effects.
       
 12824           instance.shouldComponentUpdate(newProps, newState, nextContext);
       
 12825         }
       
 12826       }
       
 12827 
       
 12828       startPhaseTimer(workInProgress, 'shouldComponentUpdate');
       
 12829       var shouldUpdate = instance.shouldComponentUpdate(newProps, newState, nextContext);
       
 12830       stopPhaseTimer();
       
 12831 
       
 12832       {
       
 12833         if (shouldUpdate === undefined) {
       
 12834           error('%s.shouldComponentUpdate(): Returned undefined instead of a ' + 'boolean value. Make sure to return true or false.', getComponentName(ctor) || 'Component');
       
 12835         }
       
 12836       }
       
 12837 
       
 12838       return shouldUpdate;
       
 12839     }
       
 12840 
       
 12841     if (ctor.prototype && ctor.prototype.isPureReactComponent) {
       
 12842       return !shallowEqual(oldProps, newProps) || !shallowEqual(oldState, newState);
       
 12843     }
       
 12844 
       
 12845     return true;
       
 12846   }
       
 12847 
       
 12848   function checkClassInstance(workInProgress, ctor, newProps) {
       
 12849     var instance = workInProgress.stateNode;
       
 12850 
       
 12851     {
       
 12852       var name = getComponentName(ctor) || 'Component';
       
 12853       var renderPresent = instance.render;
       
 12854 
       
 12855       if (!renderPresent) {
       
 12856         if (ctor.prototype && typeof ctor.prototype.render === 'function') {
       
 12857           error('%s(...): No `render` method found on the returned component ' + 'instance: did you accidentally return an object from the constructor?', name);
       
 12858         } else {
       
 12859           error('%s(...): No `render` method found on the returned component ' + 'instance: you may have forgotten to define `render`.', name);
       
 12860         }
       
 12861       }
       
 12862 
       
 12863       if (instance.getInitialState && !instance.getInitialState.isReactClassApproved && !instance.state) {
       
 12864         error('getInitialState was defined on %s, a plain JavaScript class. ' + 'This is only supported for classes created using React.createClass. ' + 'Did you mean to define a state property instead?', name);
       
 12865       }
       
 12866 
       
 12867       if (instance.getDefaultProps && !instance.getDefaultProps.isReactClassApproved) {
       
 12868         error('getDefaultProps was defined on %s, a plain JavaScript class. ' + 'This is only supported for classes created using React.createClass. ' + 'Use a static property to define defaultProps instead.', name);
       
 12869       }
       
 12870 
       
 12871       if (instance.propTypes) {
       
 12872         error('propTypes was defined as an instance property on %s. Use a static ' + 'property to define propTypes instead.', name);
       
 12873       }
       
 12874 
       
 12875       if (instance.contextType) {
       
 12876         error('contextType was defined as an instance property on %s. Use a static ' + 'property to define contextType instead.', name);
       
 12877       }
       
 12878 
       
 12879       {
       
 12880         if (instance.contextTypes) {
       
 12881           error('contextTypes was defined as an instance property on %s. Use a static ' + 'property to define contextTypes instead.', name);
       
 12882         }
       
 12883 
       
 12884         if (ctor.contextType && ctor.contextTypes && !didWarnAboutContextTypeAndContextTypes.has(ctor)) {
       
 12885           didWarnAboutContextTypeAndContextTypes.add(ctor);
       
 12886 
       
 12887           error('%s declares both contextTypes and contextType static properties. ' + 'The legacy contextTypes property will be ignored.', name);
       
 12888         }
       
 12889       }
       
 12890 
       
 12891       if (typeof instance.componentShouldUpdate === 'function') {
       
 12892         error('%s has a method called ' + 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' + 'The name is phrased as a question because the function is ' + 'expected to return a value.', name);
       
 12893       }
       
 12894 
       
 12895       if (ctor.prototype && ctor.prototype.isPureReactComponent && typeof instance.shouldComponentUpdate !== 'undefined') {
       
 12896         error('%s has a method called shouldComponentUpdate(). ' + 'shouldComponentUpdate should not be used when extending React.PureComponent. ' + 'Please extend React.Component if shouldComponentUpdate is used.', getComponentName(ctor) || 'A pure component');
       
 12897       }
       
 12898 
       
 12899       if (typeof instance.componentDidUnmount === 'function') {
       
 12900         error('%s has a method called ' + 'componentDidUnmount(). But there is no such lifecycle method. ' + 'Did you mean componentWillUnmount()?', name);
       
 12901       }
       
 12902 
       
 12903       if (typeof instance.componentDidReceiveProps === 'function') {
       
 12904         error('%s has a method called ' + 'componentDidReceiveProps(). But there is no such lifecycle method. ' + 'If you meant to update the state in response to changing props, ' + 'use componentWillReceiveProps(). If you meant to fetch data or ' + 'run side-effects or mutations after React has updated the UI, use componentDidUpdate().', name);
       
 12905       }
       
 12906 
       
 12907       if (typeof instance.componentWillRecieveProps === 'function') {
       
 12908         error('%s has a method called ' + 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', name);
       
 12909       }
       
 12910 
       
 12911       if (typeof instance.UNSAFE_componentWillRecieveProps === 'function') {
       
 12912         error('%s has a method called ' + 'UNSAFE_componentWillRecieveProps(). Did you mean UNSAFE_componentWillReceiveProps()?', name);
       
 12913       }
       
 12914 
       
 12915       var hasMutatedProps = instance.props !== newProps;
       
 12916 
       
 12917       if (instance.props !== undefined && hasMutatedProps) {
       
 12918         error('%s(...): When calling super() in `%s`, make sure to pass ' + "up the same props that your component's constructor was passed.", name, name);
       
 12919       }
       
 12920 
       
 12921       if (instance.defaultProps) {
       
 12922         error('Setting defaultProps as an instance property on %s is not supported and will be ignored.' + ' Instead, define defaultProps as a static property on %s.', name, name);
       
 12923       }
       
 12924 
       
 12925       if (typeof instance.getSnapshotBeforeUpdate === 'function' && typeof instance.componentDidUpdate !== 'function' && !didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate.has(ctor)) {
       
 12926         didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate.add(ctor);
       
 12927 
       
 12928         error('%s: getSnapshotBeforeUpdate() should be used with componentDidUpdate(). ' + 'This component defines getSnapshotBeforeUpdate() only.', getComponentName(ctor));
       
 12929       }
       
 12930 
       
 12931       if (typeof instance.getDerivedStateFromProps === 'function') {
       
 12932         error('%s: getDerivedStateFromProps() is defined as an instance method ' + 'and will be ignored. Instead, declare it as a static method.', name);
       
 12933       }
       
 12934 
       
 12935       if (typeof instance.getDerivedStateFromError === 'function') {
       
 12936         error('%s: getDerivedStateFromError() is defined as an instance method ' + 'and will be ignored. Instead, declare it as a static method.', name);
       
 12937       }
       
 12938 
       
 12939       if (typeof ctor.getSnapshotBeforeUpdate === 'function') {
       
 12940         error('%s: getSnapshotBeforeUpdate() is defined as a static method ' + 'and will be ignored. Instead, declare it as an instance method.', name);
       
 12941       }
       
 12942 
       
 12943       var _state = instance.state;
       
 12944 
       
 12945       if (_state && (typeof _state !== 'object' || isArray(_state))) {
       
 12946         error('%s.state: must be set to an object or null', name);
       
 12947       }
       
 12948 
       
 12949       if (typeof instance.getChildContext === 'function' && typeof ctor.childContextTypes !== 'object') {
       
 12950         error('%s.getChildContext(): childContextTypes must be defined in order to ' + 'use getChildContext().', name);
       
 12951       }
       
 12952     }
       
 12953   }
       
 12954 
       
 12955   function adoptClassInstance(workInProgress, instance) {
       
 12956     instance.updater = classComponentUpdater;
       
 12957     workInProgress.stateNode = instance; // The instance needs access to the fiber so that it can schedule updates
       
 12958 
       
 12959     set(instance, workInProgress);
       
 12960 
       
 12961     {
       
 12962       instance._reactInternalInstance = fakeInternalInstance;
       
 12963     }
       
 12964   }
       
 12965 
       
 12966   function constructClassInstance(workInProgress, ctor, props) {
       
 12967     var isLegacyContextConsumer = false;
       
 12968     var unmaskedContext = emptyContextObject;
       
 12969     var context = emptyContextObject;
       
 12970     var contextType = ctor.contextType;
       
 12971 
       
 12972     {
       
 12973       if ('contextType' in ctor) {
       
 12974         var isValid = // Allow null for conditional declaration
       
 12975         contextType === null || contextType !== undefined && contextType.$$typeof === REACT_CONTEXT_TYPE && contextType._context === undefined; // Not a <Context.Consumer>
       
 12976 
       
 12977         if (!isValid && !didWarnAboutInvalidateContextType.has(ctor)) {
       
 12978           didWarnAboutInvalidateContextType.add(ctor);
       
 12979           var addendum = '';
       
 12980 
       
 12981           if (contextType === undefined) {
       
 12982             addendum = ' However, it is set to undefined. ' + 'This can be caused by a typo or by mixing up named and default imports. ' + 'This can also happen due to a circular dependency, so ' + 'try moving the createContext() call to a separate file.';
       
 12983           } else if (typeof contextType !== 'object') {
       
 12984             addendum = ' However, it is set to a ' + typeof contextType + '.';
       
 12985           } else if (contextType.$$typeof === REACT_PROVIDER_TYPE) {
       
 12986             addendum = ' Did you accidentally pass the Context.Provider instead?';
       
 12987           } else if (contextType._context !== undefined) {
       
 12988             // <Context.Consumer>
       
 12989             addendum = ' Did you accidentally pass the Context.Consumer instead?';
       
 12990           } else {
       
 12991             addendum = ' However, it is set to an object with keys {' + Object.keys(contextType).join(', ') + '}.';
       
 12992           }
       
 12993 
       
 12994           error('%s defines an invalid contextType. ' + 'contextType should point to the Context object returned by React.createContext().%s', getComponentName(ctor) || 'Component', addendum);
       
 12995         }
       
 12996       }
       
 12997     }
       
 12998 
       
 12999     if (typeof contextType === 'object' && contextType !== null) {
       
 13000       context = readContext(contextType);
       
 13001     } else {
       
 13002       unmaskedContext = getUnmaskedContext(workInProgress, ctor, true);
       
 13003       var contextTypes = ctor.contextTypes;
       
 13004       isLegacyContextConsumer = contextTypes !== null && contextTypes !== undefined;
       
 13005       context = isLegacyContextConsumer ? getMaskedContext(workInProgress, unmaskedContext) : emptyContextObject;
       
 13006     } // Instantiate twice to help detect side-effects.
       
 13007 
       
 13008 
       
 13009     {
       
 13010       if ( workInProgress.mode & StrictMode) {
       
 13011         new ctor(props, context); // eslint-disable-line no-new
       
 13012       }
       
 13013     }
       
 13014 
       
 13015     var instance = new ctor(props, context);
       
 13016     var state = workInProgress.memoizedState = instance.state !== null && instance.state !== undefined ? instance.state : null;
       
 13017     adoptClassInstance(workInProgress, instance);
       
 13018 
       
 13019     {
       
 13020       if (typeof ctor.getDerivedStateFromProps === 'function' && state === null) {
       
 13021         var componentName = getComponentName(ctor) || 'Component';
       
 13022 
       
 13023         if (!didWarnAboutUninitializedState.has(componentName)) {
       
 13024           didWarnAboutUninitializedState.add(componentName);
       
 13025 
       
 13026           error('`%s` uses `getDerivedStateFromProps` but its initial state is ' + '%s. This is not recommended. Instead, define the initial state by ' + 'assigning an object to `this.state` in the constructor of `%s`. ' + 'This ensures that `getDerivedStateFromProps` arguments have a consistent shape.', componentName, instance.state === null ? 'null' : 'undefined', componentName);
       
 13027         }
       
 13028       } // If new component APIs are defined, "unsafe" lifecycles won't be called.
       
 13029       // Warn about these lifecycles if they are present.
       
 13030       // Don't warn about react-lifecycles-compat polyfilled methods though.
       
 13031 
       
 13032 
       
 13033       if (typeof ctor.getDerivedStateFromProps === 'function' || typeof instance.getSnapshotBeforeUpdate === 'function') {
       
 13034         var foundWillMountName = null;
       
 13035         var foundWillReceivePropsName = null;
       
 13036         var foundWillUpdateName = null;
       
 13037 
       
 13038         if (typeof instance.componentWillMount === 'function' && instance.componentWillMount.__suppressDeprecationWarning !== true) {
       
 13039           foundWillMountName = 'componentWillMount';
       
 13040         } else if (typeof instance.UNSAFE_componentWillMount === 'function') {
       
 13041           foundWillMountName = 'UNSAFE_componentWillMount';
       
 13042         }
       
 13043 
       
 13044         if (typeof instance.componentWillReceiveProps === 'function' && instance.componentWillReceiveProps.__suppressDeprecationWarning !== true) {
       
 13045           foundWillReceivePropsName = 'componentWillReceiveProps';
       
 13046         } else if (typeof instance.UNSAFE_componentWillReceiveProps === 'function') {
       
 13047           foundWillReceivePropsName = 'UNSAFE_componentWillReceiveProps';
       
 13048         }
       
 13049 
       
 13050         if (typeof instance.componentWillUpdate === 'function' && instance.componentWillUpdate.__suppressDeprecationWarning !== true) {
       
 13051           foundWillUpdateName = 'componentWillUpdate';
       
 13052         } else if (typeof instance.UNSAFE_componentWillUpdate === 'function') {
       
 13053           foundWillUpdateName = 'UNSAFE_componentWillUpdate';
       
 13054         }
       
 13055 
       
 13056         if (foundWillMountName !== null || foundWillReceivePropsName !== null || foundWillUpdateName !== null) {
       
 13057           var _componentName = getComponentName(ctor) || 'Component';
       
 13058 
       
 13059           var newApiName = typeof ctor.getDerivedStateFromProps === 'function' ? 'getDerivedStateFromProps()' : 'getSnapshotBeforeUpdate()';
       
 13060 
       
 13061           if (!didWarnAboutLegacyLifecyclesAndDerivedState.has(_componentName)) {
       
 13062             didWarnAboutLegacyLifecyclesAndDerivedState.add(_componentName);
       
 13063 
       
 13064             error('Unsafe legacy lifecycles will not be called for components using new component APIs.\n\n' + '%s uses %s but also contains the following legacy lifecycles:%s%s%s\n\n' + 'The above lifecycles should be removed. Learn more about this warning here:\n' + 'https://fb.me/react-unsafe-component-lifecycles', _componentName, newApiName, foundWillMountName !== null ? "\n  " + foundWillMountName : '', foundWillReceivePropsName !== null ? "\n  " + foundWillReceivePropsName : '', foundWillUpdateName !== null ? "\n  " + foundWillUpdateName : '');
       
 13065           }
       
 13066         }
       
 13067       }
       
 13068     } // Cache unmasked context so we can avoid recreating masked context unless necessary.
       
 13069     // ReactFiberContext usually updates this cache but can't for newly-created instances.
       
 13070 
       
 13071 
       
 13072     if (isLegacyContextConsumer) {
       
 13073       cacheContext(workInProgress, unmaskedContext, context);
       
 13074     }
       
 13075 
       
 13076     return instance;
       
 13077   }
       
 13078 
       
 13079   function callComponentWillMount(workInProgress, instance) {
       
 13080     startPhaseTimer(workInProgress, 'componentWillMount');
       
 13081     var oldState = instance.state;
       
 13082 
       
 13083     if (typeof instance.componentWillMount === 'function') {
       
 13084       instance.componentWillMount();
       
 13085     }
       
 13086 
       
 13087     if (typeof instance.UNSAFE_componentWillMount === 'function') {
       
 13088       instance.UNSAFE_componentWillMount();
       
 13089     }
       
 13090 
       
 13091     stopPhaseTimer();
       
 13092 
       
 13093     if (oldState !== instance.state) {
       
 13094       {
       
 13095         error('%s.componentWillMount(): Assigning directly to this.state is ' + "deprecated (except inside a component's " + 'constructor). Use setState instead.', getComponentName(workInProgress.type) || 'Component');
       
 13096       }
       
 13097 
       
 13098       classComponentUpdater.enqueueReplaceState(instance, instance.state, null);
       
 13099     }
       
 13100   }
       
 13101 
       
 13102   function callComponentWillReceiveProps(workInProgress, instance, newProps, nextContext) {
       
 13103     var oldState = instance.state;
       
 13104     startPhaseTimer(workInProgress, 'componentWillReceiveProps');
       
 13105 
       
 13106     if (typeof instance.componentWillReceiveProps === 'function') {
       
 13107       instance.componentWillReceiveProps(newProps, nextContext);
       
 13108     }
       
 13109 
       
 13110     if (typeof instance.UNSAFE_componentWillReceiveProps === 'function') {
       
 13111       instance.UNSAFE_componentWillReceiveProps(newProps, nextContext);
       
 13112     }
       
 13113 
       
 13114     stopPhaseTimer();
       
 13115 
       
 13116     if (instance.state !== oldState) {
       
 13117       {
       
 13118         var componentName = getComponentName(workInProgress.type) || 'Component';
       
 13119 
       
 13120         if (!didWarnAboutStateAssignmentForComponent.has(componentName)) {
       
 13121           didWarnAboutStateAssignmentForComponent.add(componentName);
       
 13122 
       
 13123           error('%s.componentWillReceiveProps(): Assigning directly to ' + "this.state is deprecated (except inside a component's " + 'constructor). Use setState instead.', componentName);
       
 13124         }
       
 13125       }
       
 13126 
       
 13127       classComponentUpdater.enqueueReplaceState(instance, instance.state, null);
       
 13128     }
       
 13129   } // Invokes the mount life-cycles on a previously never rendered instance.
       
 13130 
       
 13131 
       
 13132   function mountClassInstance(workInProgress, ctor, newProps, renderExpirationTime) {
       
 13133     {
       
 13134       checkClassInstance(workInProgress, ctor, newProps);
       
 13135     }
       
 13136 
       
 13137     var instance = workInProgress.stateNode;
       
 13138     instance.props = newProps;
       
 13139     instance.state = workInProgress.memoizedState;
       
 13140     instance.refs = emptyRefsObject;
       
 13141     initializeUpdateQueue(workInProgress);
       
 13142     var contextType = ctor.contextType;
       
 13143 
       
 13144     if (typeof contextType === 'object' && contextType !== null) {
       
 13145       instance.context = readContext(contextType);
       
 13146     } else {
       
 13147       var unmaskedContext = getUnmaskedContext(workInProgress, ctor, true);
       
 13148       instance.context = getMaskedContext(workInProgress, unmaskedContext);
       
 13149     }
       
 13150 
       
 13151     {
       
 13152       if (instance.state === newProps) {
       
 13153         var componentName = getComponentName(ctor) || 'Component';
       
 13154 
       
 13155         if (!didWarnAboutDirectlyAssigningPropsToState.has(componentName)) {
       
 13156           didWarnAboutDirectlyAssigningPropsToState.add(componentName);
       
 13157 
       
 13158           error('%s: It is not recommended to assign props directly to state ' + "because updates to props won't be reflected in state. " + 'In most cases, it is better to use props directly.', componentName);
       
 13159         }
       
 13160       }
       
 13161 
       
 13162       if (workInProgress.mode & StrictMode) {
       
 13163         ReactStrictModeWarnings.recordLegacyContextWarning(workInProgress, instance);
       
 13164       }
       
 13165 
       
 13166       {
       
 13167         ReactStrictModeWarnings.recordUnsafeLifecycleWarnings(workInProgress, instance);
       
 13168       }
       
 13169     }
       
 13170 
       
 13171     processUpdateQueue(workInProgress, newProps, instance, renderExpirationTime);
       
 13172     instance.state = workInProgress.memoizedState;
       
 13173     var getDerivedStateFromProps = ctor.getDerivedStateFromProps;
       
 13174 
       
 13175     if (typeof getDerivedStateFromProps === 'function') {
       
 13176       applyDerivedStateFromProps(workInProgress, ctor, getDerivedStateFromProps, newProps);
       
 13177       instance.state = workInProgress.memoizedState;
       
 13178     } // In order to support react-lifecycles-compat polyfilled components,
       
 13179     // Unsafe lifecycles should not be invoked for components using the new APIs.
       
 13180 
       
 13181 
       
 13182     if (typeof ctor.getDerivedStateFromProps !== 'function' && typeof instance.getSnapshotBeforeUpdate !== 'function' && (typeof instance.UNSAFE_componentWillMount === 'function' || typeof instance.componentWillMount === 'function')) {
       
 13183       callComponentWillMount(workInProgress, instance); // If we had additional state updates during this life-cycle, let's
       
 13184       // process them now.
       
 13185 
       
 13186       processUpdateQueue(workInProgress, newProps, instance, renderExpirationTime);
       
 13187       instance.state = workInProgress.memoizedState;
       
 13188     }
       
 13189 
       
 13190     if (typeof instance.componentDidMount === 'function') {
       
 13191       workInProgress.effectTag |= Update;
       
 13192     }
       
 13193   }
       
 13194 
       
 13195   function resumeMountClassInstance(workInProgress, ctor, newProps, renderExpirationTime) {
       
 13196     var instance = workInProgress.stateNode;
       
 13197     var oldProps = workInProgress.memoizedProps;
       
 13198     instance.props = oldProps;
       
 13199     var oldContext = instance.context;
       
 13200     var contextType = ctor.contextType;
       
 13201     var nextContext = emptyContextObject;
       
 13202 
       
 13203     if (typeof contextType === 'object' && contextType !== null) {
       
 13204       nextContext = readContext(contextType);
       
 13205     } else {
       
 13206       var nextLegacyUnmaskedContext = getUnmaskedContext(workInProgress, ctor, true);
       
 13207       nextContext = getMaskedContext(workInProgress, nextLegacyUnmaskedContext);
       
 13208     }
       
 13209 
       
 13210     var getDerivedStateFromProps = ctor.getDerivedStateFromProps;
       
 13211     var hasNewLifecycles = typeof getDerivedStateFromProps === 'function' || typeof instance.getSnapshotBeforeUpdate === 'function'; // Note: During these life-cycles, instance.props/instance.state are what
       
 13212     // ever the previously attempted to render - not the "current". However,
       
 13213     // during componentDidUpdate we pass the "current" props.
       
 13214     // In order to support react-lifecycles-compat polyfilled components,
       
 13215     // Unsafe lifecycles should not be invoked for components using the new APIs.
       
 13216 
       
 13217     if (!hasNewLifecycles && (typeof instance.UNSAFE_componentWillReceiveProps === 'function' || typeof instance.componentWillReceiveProps === 'function')) {
       
 13218       if (oldProps !== newProps || oldContext !== nextContext) {
       
 13219         callComponentWillReceiveProps(workInProgress, instance, newProps, nextContext);
       
 13220       }
       
 13221     }
       
 13222 
       
 13223     resetHasForceUpdateBeforeProcessing();
       
 13224     var oldState = workInProgress.memoizedState;
       
 13225     var newState = instance.state = oldState;
       
 13226     processUpdateQueue(workInProgress, newProps, instance, renderExpirationTime);
       
 13227     newState = workInProgress.memoizedState;
       
 13228 
       
 13229     if (oldProps === newProps && oldState === newState && !hasContextChanged() && !checkHasForceUpdateAfterProcessing()) {
       
 13230       // If an update was already in progress, we should schedule an Update
       
 13231       // effect even though we're bailing out, so that cWU/cDU are called.
       
 13232       if (typeof instance.componentDidMount === 'function') {
       
 13233         workInProgress.effectTag |= Update;
       
 13234       }
       
 13235 
       
 13236       return false;
       
 13237     }
       
 13238 
       
 13239     if (typeof getDerivedStateFromProps === 'function') {
       
 13240       applyDerivedStateFromProps(workInProgress, ctor, getDerivedStateFromProps, newProps);
       
 13241       newState = workInProgress.memoizedState;
       
 13242     }
       
 13243 
       
 13244     var shouldUpdate = checkHasForceUpdateAfterProcessing() || checkShouldComponentUpdate(workInProgress, ctor, oldProps, newProps, oldState, newState, nextContext);
       
 13245 
       
 13246     if (shouldUpdate) {
       
 13247       // In order to support react-lifecycles-compat polyfilled components,
       
 13248       // Unsafe lifecycles should not be invoked for components using the new APIs.
       
 13249       if (!hasNewLifecycles && (typeof instance.UNSAFE_componentWillMount === 'function' || typeof instance.componentWillMount === 'function')) {
       
 13250         startPhaseTimer(workInProgress, 'componentWillMount');
       
 13251 
       
 13252         if (typeof instance.componentWillMount === 'function') {
       
 13253           instance.componentWillMount();
       
 13254         }
       
 13255 
       
 13256         if (typeof instance.UNSAFE_componentWillMount === 'function') {
       
 13257           instance.UNSAFE_componentWillMount();
       
 13258         }
       
 13259 
       
 13260         stopPhaseTimer();
       
 13261       }
       
 13262 
       
 13263       if (typeof instance.componentDidMount === 'function') {
       
 13264         workInProgress.effectTag |= Update;
       
 13265       }
       
 13266     } else {
       
 13267       // If an update was already in progress, we should schedule an Update
       
 13268       // effect even though we're bailing out, so that cWU/cDU are called.
       
 13269       if (typeof instance.componentDidMount === 'function') {
       
 13270         workInProgress.effectTag |= Update;
       
 13271       } // If shouldComponentUpdate returned false, we should still update the
       
 13272       // memoized state to indicate that this work can be reused.
       
 13273 
       
 13274 
       
 13275       workInProgress.memoizedProps = newProps;
       
 13276       workInProgress.memoizedState = newState;
       
 13277     } // Update the existing instance's state, props, and context pointers even
       
 13278     // if shouldComponentUpdate returns false.
       
 13279 
       
 13280 
       
 13281     instance.props = newProps;
       
 13282     instance.state = newState;
       
 13283     instance.context = nextContext;
       
 13284     return shouldUpdate;
       
 13285   } // Invokes the update life-cycles and returns false if it shouldn't rerender.
       
 13286 
       
 13287 
       
 13288   function updateClassInstance(current, workInProgress, ctor, newProps, renderExpirationTime) {
       
 13289     var instance = workInProgress.stateNode;
       
 13290     cloneUpdateQueue(current, workInProgress);
       
 13291     var oldProps = workInProgress.memoizedProps;
       
 13292     instance.props = workInProgress.type === workInProgress.elementType ? oldProps : resolveDefaultProps(workInProgress.type, oldProps);
       
 13293     var oldContext = instance.context;
       
 13294     var contextType = ctor.contextType;
       
 13295     var nextContext = emptyContextObject;
       
 13296 
       
 13297     if (typeof contextType === 'object' && contextType !== null) {
       
 13298       nextContext = readContext(contextType);
       
 13299     } else {
       
 13300       var nextUnmaskedContext = getUnmaskedContext(workInProgress, ctor, true);
       
 13301       nextContext = getMaskedContext(workInProgress, nextUnmaskedContext);
       
 13302     }
       
 13303 
       
 13304     var getDerivedStateFromProps = ctor.getDerivedStateFromProps;
       
 13305     var hasNewLifecycles = typeof getDerivedStateFromProps === 'function' || typeof instance.getSnapshotBeforeUpdate === 'function'; // Note: During these life-cycles, instance.props/instance.state are what
       
 13306     // ever the previously attempted to render - not the "current". However,
       
 13307     // during componentDidUpdate we pass the "current" props.
       
 13308     // In order to support react-lifecycles-compat polyfilled components,
       
 13309     // Unsafe lifecycles should not be invoked for components using the new APIs.
       
 13310 
       
 13311     if (!hasNewLifecycles && (typeof instance.UNSAFE_componentWillReceiveProps === 'function' || typeof instance.componentWillReceiveProps === 'function')) {
       
 13312       if (oldProps !== newProps || oldContext !== nextContext) {
       
 13313         callComponentWillReceiveProps(workInProgress, instance, newProps, nextContext);
       
 13314       }
       
 13315     }
       
 13316 
       
 13317     resetHasForceUpdateBeforeProcessing();
       
 13318     var oldState = workInProgress.memoizedState;
       
 13319     var newState = instance.state = oldState;
       
 13320     processUpdateQueue(workInProgress, newProps, instance, renderExpirationTime);
       
 13321     newState = workInProgress.memoizedState;
       
 13322 
       
 13323     if (oldProps === newProps && oldState === newState && !hasContextChanged() && !checkHasForceUpdateAfterProcessing()) {
       
 13324       // If an update was already in progress, we should schedule an Update
       
 13325       // effect even though we're bailing out, so that cWU/cDU are called.
       
 13326       if (typeof instance.componentDidUpdate === 'function') {
       
 13327         if (oldProps !== current.memoizedProps || oldState !== current.memoizedState) {
       
 13328           workInProgress.effectTag |= Update;
       
 13329         }
       
 13330       }
       
 13331 
       
 13332       if (typeof instance.getSnapshotBeforeUpdate === 'function') {
       
 13333         if (oldProps !== current.memoizedProps || oldState !== current.memoizedState) {
       
 13334           workInProgress.effectTag |= Snapshot;
       
 13335         }
       
 13336       }
       
 13337 
       
 13338       return false;
       
 13339     }
       
 13340 
       
 13341     if (typeof getDerivedStateFromProps === 'function') {
       
 13342       applyDerivedStateFromProps(workInProgress, ctor, getDerivedStateFromProps, newProps);
       
 13343       newState = workInProgress.memoizedState;
       
 13344     }
       
 13345 
       
 13346     var shouldUpdate = checkHasForceUpdateAfterProcessing() || checkShouldComponentUpdate(workInProgress, ctor, oldProps, newProps, oldState, newState, nextContext);
       
 13347 
       
 13348     if (shouldUpdate) {
       
 13349       // In order to support react-lifecycles-compat polyfilled components,
       
 13350       // Unsafe lifecycles should not be invoked for components using the new APIs.
       
 13351       if (!hasNewLifecycles && (typeof instance.UNSAFE_componentWillUpdate === 'function' || typeof instance.componentWillUpdate === 'function')) {
       
 13352         startPhaseTimer(workInProgress, 'componentWillUpdate');
       
 13353 
       
 13354         if (typeof instance.componentWillUpdate === 'function') {
       
 13355           instance.componentWillUpdate(newProps, newState, nextContext);
       
 13356         }
       
 13357 
       
 13358         if (typeof instance.UNSAFE_componentWillUpdate === 'function') {
       
 13359           instance.UNSAFE_componentWillUpdate(newProps, newState, nextContext);
       
 13360         }
       
 13361 
       
 13362         stopPhaseTimer();
       
 13363       }
       
 13364 
       
 13365       if (typeof instance.componentDidUpdate === 'function') {
       
 13366         workInProgress.effectTag |= Update;
       
 13367       }
       
 13368 
       
 13369       if (typeof instance.getSnapshotBeforeUpdate === 'function') {
       
 13370         workInProgress.effectTag |= Snapshot;
       
 13371       }
       
 13372     } else {
       
 13373       // If an update was already in progress, we should schedule an Update
       
 13374       // effect even though we're bailing out, so that cWU/cDU are called.
       
 13375       if (typeof instance.componentDidUpdate === 'function') {
       
 13376         if (oldProps !== current.memoizedProps || oldState !== current.memoizedState) {
       
 13377           workInProgress.effectTag |= Update;
       
 13378         }
       
 13379       }
       
 13380 
       
 13381       if (typeof instance.getSnapshotBeforeUpdate === 'function') {
       
 13382         if (oldProps !== current.memoizedProps || oldState !== current.memoizedState) {
       
 13383           workInProgress.effectTag |= Snapshot;
       
 13384         }
       
 13385       } // If shouldComponentUpdate returned false, we should still update the
       
 13386       // memoized props/state to indicate that this work can be reused.
       
 13387 
       
 13388 
       
 13389       workInProgress.memoizedProps = newProps;
       
 13390       workInProgress.memoizedState = newState;
       
 13391     } // Update the existing instance's state, props, and context pointers even
       
 13392     // if shouldComponentUpdate returns false.
       
 13393 
       
 13394 
       
 13395     instance.props = newProps;
       
 13396     instance.state = newState;
       
 13397     instance.context = nextContext;
       
 13398     return shouldUpdate;
       
 13399   }
       
 13400 
       
 13401   var didWarnAboutMaps;
       
 13402   var didWarnAboutGenerators;
       
 13403   var didWarnAboutStringRefs;
       
 13404   var ownerHasKeyUseWarning;
       
 13405   var ownerHasFunctionTypeWarning;
       
 13406 
       
 13407   var warnForMissingKey = function (child) {};
       
 13408 
       
 13409   {
       
 13410     didWarnAboutMaps = false;
       
 13411     didWarnAboutGenerators = false;
       
 13412     didWarnAboutStringRefs = {};
       
 13413     /**
       
 13414      * Warn if there's no key explicitly set on dynamic arrays of children or
       
 13415      * object keys are not valid. This allows us to keep track of children between
       
 13416      * updates.
       
 13417      */
       
 13418 
       
 13419     ownerHasKeyUseWarning = {};
       
 13420     ownerHasFunctionTypeWarning = {};
       
 13421 
       
 13422     warnForMissingKey = function (child) {
       
 13423       if (child === null || typeof child !== 'object') {
       
 13424         return;
       
 13425       }
       
 13426 
       
 13427       if (!child._store || child._store.validated || child.key != null) {
       
 13428         return;
       
 13429       }
       
 13430 
       
 13431       if (!(typeof child._store === 'object')) {
       
 13432         {
       
 13433           throw Error( "React Component in warnForMissingKey should have a _store. This error is likely caused by a bug in React. Please file an issue." );
       
 13434         }
       
 13435       }
       
 13436 
       
 13437       child._store.validated = true;
       
 13438       var currentComponentErrorInfo = 'Each child in a list should have a unique ' + '"key" prop. See https://fb.me/react-warning-keys for ' + 'more information.' + getCurrentFiberStackInDev();
       
 13439 
       
 13440       if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
       
 13441         return;
       
 13442       }
       
 13443 
       
 13444       ownerHasKeyUseWarning[currentComponentErrorInfo] = true;
       
 13445 
       
 13446       error('Each child in a list should have a unique ' + '"key" prop. See https://fb.me/react-warning-keys for ' + 'more information.');
       
 13447     };
       
 13448   }
       
 13449 
       
 13450   var isArray$1 = Array.isArray;
       
 13451 
       
 13452   function coerceRef(returnFiber, current, element) {
       
 13453     var mixedRef = element.ref;
       
 13454 
       
 13455     if (mixedRef !== null && typeof mixedRef !== 'function' && typeof mixedRef !== 'object') {
       
 13456       {
       
 13457         // TODO: Clean this up once we turn on the string ref warning for
       
 13458         // everyone, because the strict mode case will no longer be relevant
       
 13459         if ((returnFiber.mode & StrictMode || warnAboutStringRefs) && // We warn in ReactElement.js if owner and self are equal for string refs
       
 13460         // because these cannot be automatically converted to an arrow function
       
 13461         // using a codemod. Therefore, we don't have to warn about string refs again.
       
 13462         !(element._owner && element._self && element._owner.stateNode !== element._self)) {
       
 13463           var componentName = getComponentName(returnFiber.type) || 'Component';
       
 13464 
       
 13465           if (!didWarnAboutStringRefs[componentName]) {
       
 13466             {
       
 13467               error('A string ref, "%s", has been found within a strict mode tree. ' + 'String refs are a source of potential bugs and should be avoided. ' + 'We recommend using useRef() or createRef() instead. ' + 'Learn more about using refs safely here: ' + 'https://fb.me/react-strict-mode-string-ref%s', mixedRef, getStackByFiberInDevAndProd(returnFiber));
       
 13468             }
       
 13469 
       
 13470             didWarnAboutStringRefs[componentName] = true;
       
 13471           }
       
 13472         }
       
 13473       }
       
 13474 
       
 13475       if (element._owner) {
       
 13476         var owner = element._owner;
       
 13477         var inst;
       
 13478 
       
 13479         if (owner) {
       
 13480           var ownerFiber = owner;
       
 13481 
       
 13482           if (!(ownerFiber.tag === ClassComponent)) {
       
 13483             {
       
 13484               throw Error( "Function components cannot have string refs. We recommend using useRef() instead. Learn more about using refs safely here: https://fb.me/react-strict-mode-string-ref" );
       
 13485             }
       
 13486           }
       
 13487 
       
 13488           inst = ownerFiber.stateNode;
       
 13489         }
       
 13490 
       
 13491         if (!inst) {
       
 13492           {
       
 13493             throw Error( "Missing owner for string ref " + mixedRef + ". This error is likely caused by a bug in React. Please file an issue." );
       
 13494           }
       
 13495         }
       
 13496 
       
 13497         var stringRef = '' + mixedRef; // Check if previous string ref matches new string ref
       
 13498 
       
 13499         if (current !== null && current.ref !== null && typeof current.ref === 'function' && current.ref._stringRef === stringRef) {
       
 13500           return current.ref;
       
 13501         }
       
 13502 
       
 13503         var ref = function (value) {
       
 13504           var refs = inst.refs;
       
 13505 
       
 13506           if (refs === emptyRefsObject) {
       
 13507             // This is a lazy pooled frozen object, so we need to initialize.
       
 13508             refs = inst.refs = {};
       
 13509           }
       
 13510 
       
 13511           if (value === null) {
       
 13512             delete refs[stringRef];
       
 13513           } else {
       
 13514             refs[stringRef] = value;
       
 13515           }
       
 13516         };
       
 13517 
       
 13518         ref._stringRef = stringRef;
       
 13519         return ref;
       
 13520       } else {
       
 13521         if (!(typeof mixedRef === 'string')) {
       
 13522           {
       
 13523             throw Error( "Expected ref to be a function, a string, an object returned by React.createRef(), or null." );
       
 13524           }
       
 13525         }
       
 13526 
       
 13527         if (!element._owner) {
       
 13528           {
       
 13529             throw Error( "Element ref was specified as a string (" + mixedRef + ") but no owner was set. This could happen for one of the following reasons:\n1. You may be adding a ref to a function component\n2. You may be adding a ref to a component that was not created inside a component's render method\n3. You have multiple copies of React loaded\nSee https://fb.me/react-refs-must-have-owner for more information." );
       
 13530           }
       
 13531         }
       
 13532       }
       
 13533     }
       
 13534 
       
 13535     return mixedRef;
       
 13536   }
       
 13537 
       
 13538   function throwOnInvalidObjectType(returnFiber, newChild) {
       
 13539     if (returnFiber.type !== 'textarea') {
       
 13540       var addendum = '';
       
 13541 
       
 13542       {
       
 13543         addendum = ' If you meant to render a collection of children, use an array ' + 'instead.' + getCurrentFiberStackInDev();
       
 13544       }
       
 13545 
 11306       {
 13546       {
 11307         {
 13547         {
 11308           throw ReactError(Error('Found unexpected detached subtree parent. This error is likely caused by a bug in React. Please file an issue.'));
 13548           throw Error( "Objects are not valid as a React child (found: " + (Object.prototype.toString.call(newChild) === '[object Object]' ? 'object with keys {' + Object.keys(newChild).join(', ') + '}' : newChild) + ")." + addendum );
 11309         }
 13549         }
 11310       }
 13550       }
 11311     })();
 13551     }
 11312   }
 13552   }
 11313 }
 13553 
 11314 
 13554   function warnOnFunctionType() {
 11315 var LegacyRoot = 0;
 13555     {
 11316 var BatchedRoot = 1;
 13556       var currentComponentErrorInfo = 'Functions are not valid as a React child. This may happen if ' + 'you return a Component instead of <Component /> from render. ' + 'Or maybe you meant to call this function rather than return it.' + getCurrentFiberStackInDev();
 11317 var ConcurrentRoot = 2;
 13557 
 11318 
 13558       if (ownerHasFunctionTypeWarning[currentComponentErrorInfo]) {
 11319 var ReactInternals$2 = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
 13559         return;
 11320 
 13560       }
 11321 var _ReactInternals$Sched$1 = ReactInternals$2.SchedulerTracing;
 13561 
 11322 var __interactionsRef = _ReactInternals$Sched$1.__interactionsRef;
 13562       ownerHasFunctionTypeWarning[currentComponentErrorInfo] = true;
 11323 var __subscriberRef = _ReactInternals$Sched$1.__subscriberRef;
 13563 
 11324 var unstable_clear = _ReactInternals$Sched$1.unstable_clear;
 13564       error('Functions are not valid as a React child. This may happen if ' + 'you return a Component instead of <Component /> from render. ' + 'Or maybe you meant to call this function rather than return it.');
 11325 var unstable_getCurrent = _ReactInternals$Sched$1.unstable_getCurrent;
 13565     }
 11326 var unstable_getThreadID = _ReactInternals$Sched$1.unstable_getThreadID;
 13566   } // This wrapper function exists because I expect to clone the code in each path
 11327 var unstable_subscribe = _ReactInternals$Sched$1.unstable_subscribe;
 13567   // to be able to optimize each path individually by branching early. This needs
 11328 var unstable_trace = _ReactInternals$Sched$1.unstable_trace;
 13568   // a compiler or we can do it manually. Helpers that don't need this branching
 11329 var unstable_unsubscribe = _ReactInternals$Sched$1.unstable_unsubscribe;
 13569   // live outside of this function.
 11330 var unstable_wrap = _ReactInternals$Sched$1.unstable_wrap;
 13570 
 11331 
 13571 
 11332 // Intentionally not named imports because Rollup would use dynamic dispatch for
 13572   function ChildReconciler(shouldTrackSideEffects) {
 11333 // CommonJS interop named imports.
 13573     function deleteChild(returnFiber, childToDelete) {
 11334 var Scheduler_runWithPriority = unstable_runWithPriority;
 13574       if (!shouldTrackSideEffects) {
 11335 var Scheduler_scheduleCallback = unstable_scheduleCallback;
 13575         // Noop.
 11336 var Scheduler_cancelCallback = unstable_cancelCallback;
 13576         return;
 11337 var Scheduler_shouldYield = unstable_shouldYield;
 13577       } // Deletions are added in reversed order so we add it to the front.
 11338 var Scheduler_requestPaint = unstable_requestPaint;
 13578       // At this point, the return fiber's effect list is empty except for
 11339 var Scheduler_now = unstable_now;
 13579       // deletions, so we can just append the deletion to the list. The remaining
 11340 var Scheduler_getCurrentPriorityLevel = unstable_getCurrentPriorityLevel;
 13580       // effects aren't added until the complete phase. Once we implement
 11341 var Scheduler_ImmediatePriority = unstable_ImmediatePriority;
 13581       // resuming, this may not be true.
 11342 var Scheduler_UserBlockingPriority = unstable_UserBlockingPriority;
 13582 
 11343 var Scheduler_NormalPriority = unstable_NormalPriority;
 13583 
 11344 var Scheduler_LowPriority = unstable_LowPriority;
 13584       var last = returnFiber.lastEffect;
 11345 var Scheduler_IdlePriority = unstable_IdlePriority;
 13585 
 11346 
 13586       if (last !== null) {
 11347 
 13587         last.nextEffect = childToDelete;
 11348 if (enableSchedulerTracing) {
 13588         returnFiber.lastEffect = childToDelete;
 11349   // Provide explicit error message when production+profiling bundle of e.g.
 13589       } else {
 11350   // react-dom is used with production (non-profiling) bundle of
 13590         returnFiber.firstEffect = returnFiber.lastEffect = childToDelete;
 11351   // scheduler/tracing
 13591       }
 11352   (function () {
 13592 
 11353     if (!(__interactionsRef != null && __interactionsRef.current != null)) {
 13593       childToDelete.nextEffect = null;
       
 13594       childToDelete.effectTag = Deletion;
       
 13595     }
       
 13596 
       
 13597     function deleteRemainingChildren(returnFiber, currentFirstChild) {
       
 13598       if (!shouldTrackSideEffects) {
       
 13599         // Noop.
       
 13600         return null;
       
 13601       } // TODO: For the shouldClone case, this could be micro-optimized a bit by
       
 13602       // assuming that after the first child we've already added everything.
       
 13603 
       
 13604 
       
 13605       var childToDelete = currentFirstChild;
       
 13606 
       
 13607       while (childToDelete !== null) {
       
 13608         deleteChild(returnFiber, childToDelete);
       
 13609         childToDelete = childToDelete.sibling;
       
 13610       }
       
 13611 
       
 13612       return null;
       
 13613     }
       
 13614 
       
 13615     function mapRemainingChildren(returnFiber, currentFirstChild) {
       
 13616       // Add the remaining children to a temporary map so that we can find them by
       
 13617       // keys quickly. Implicit (null) keys get added to this set with their index
       
 13618       // instead.
       
 13619       var existingChildren = new Map();
       
 13620       var existingChild = currentFirstChild;
       
 13621 
       
 13622       while (existingChild !== null) {
       
 13623         if (existingChild.key !== null) {
       
 13624           existingChildren.set(existingChild.key, existingChild);
       
 13625         } else {
       
 13626           existingChildren.set(existingChild.index, existingChild);
       
 13627         }
       
 13628 
       
 13629         existingChild = existingChild.sibling;
       
 13630       }
       
 13631 
       
 13632       return existingChildren;
       
 13633     }
       
 13634 
       
 13635     function useFiber(fiber, pendingProps) {
       
 13636       // We currently set sibling to null and index to 0 here because it is easy
       
 13637       // to forget to do before returning it. E.g. for the single child case.
       
 13638       var clone = createWorkInProgress(fiber, pendingProps);
       
 13639       clone.index = 0;
       
 13640       clone.sibling = null;
       
 13641       return clone;
       
 13642     }
       
 13643 
       
 13644     function placeChild(newFiber, lastPlacedIndex, newIndex) {
       
 13645       newFiber.index = newIndex;
       
 13646 
       
 13647       if (!shouldTrackSideEffects) {
       
 13648         // Noop.
       
 13649         return lastPlacedIndex;
       
 13650       }
       
 13651 
       
 13652       var current = newFiber.alternate;
       
 13653 
       
 13654       if (current !== null) {
       
 13655         var oldIndex = current.index;
       
 13656 
       
 13657         if (oldIndex < lastPlacedIndex) {
       
 13658           // This is a move.
       
 13659           newFiber.effectTag = Placement;
       
 13660           return lastPlacedIndex;
       
 13661         } else {
       
 13662           // This item can stay in place.
       
 13663           return oldIndex;
       
 13664         }
       
 13665       } else {
       
 13666         // This is an insertion.
       
 13667         newFiber.effectTag = Placement;
       
 13668         return lastPlacedIndex;
       
 13669       }
       
 13670     }
       
 13671 
       
 13672     function placeSingleChild(newFiber) {
       
 13673       // This is simpler for the single child case. We only need to do a
       
 13674       // placement for inserting new children.
       
 13675       if (shouldTrackSideEffects && newFiber.alternate === null) {
       
 13676         newFiber.effectTag = Placement;
       
 13677       }
       
 13678 
       
 13679       return newFiber;
       
 13680     }
       
 13681 
       
 13682     function updateTextNode(returnFiber, current, textContent, expirationTime) {
       
 13683       if (current === null || current.tag !== HostText) {
       
 13684         // Insert
       
 13685         var created = createFiberFromText(textContent, returnFiber.mode, expirationTime);
       
 13686         created.return = returnFiber;
       
 13687         return created;
       
 13688       } else {
       
 13689         // Update
       
 13690         var existing = useFiber(current, textContent);
       
 13691         existing.return = returnFiber;
       
 13692         return existing;
       
 13693       }
       
 13694     }
       
 13695 
       
 13696     function updateElement(returnFiber, current, element, expirationTime) {
       
 13697       if (current !== null) {
       
 13698         if (current.elementType === element.type || ( // Keep this check inline so it only runs on the false path:
       
 13699          isCompatibleFamilyForHotReloading(current, element) )) {
       
 13700           // Move based on index
       
 13701           var existing = useFiber(current, element.props);
       
 13702           existing.ref = coerceRef(returnFiber, current, element);
       
 13703           existing.return = returnFiber;
       
 13704 
       
 13705           {
       
 13706             existing._debugSource = element._source;
       
 13707             existing._debugOwner = element._owner;
       
 13708           }
       
 13709 
       
 13710           return existing;
       
 13711         }
       
 13712       } // Insert
       
 13713 
       
 13714 
       
 13715       var created = createFiberFromElement(element, returnFiber.mode, expirationTime);
       
 13716       created.ref = coerceRef(returnFiber, current, element);
       
 13717       created.return = returnFiber;
       
 13718       return created;
       
 13719     }
       
 13720 
       
 13721     function updatePortal(returnFiber, current, portal, expirationTime) {
       
 13722       if (current === null || current.tag !== HostPortal || current.stateNode.containerInfo !== portal.containerInfo || current.stateNode.implementation !== portal.implementation) {
       
 13723         // Insert
       
 13724         var created = createFiberFromPortal(portal, returnFiber.mode, expirationTime);
       
 13725         created.return = returnFiber;
       
 13726         return created;
       
 13727       } else {
       
 13728         // Update
       
 13729         var existing = useFiber(current, portal.children || []);
       
 13730         existing.return = returnFiber;
       
 13731         return existing;
       
 13732       }
       
 13733     }
       
 13734 
       
 13735     function updateFragment(returnFiber, current, fragment, expirationTime, key) {
       
 13736       if (current === null || current.tag !== Fragment) {
       
 13737         // Insert
       
 13738         var created = createFiberFromFragment(fragment, returnFiber.mode, expirationTime, key);
       
 13739         created.return = returnFiber;
       
 13740         return created;
       
 13741       } else {
       
 13742         // Update
       
 13743         var existing = useFiber(current, fragment);
       
 13744         existing.return = returnFiber;
       
 13745         return existing;
       
 13746       }
       
 13747     }
       
 13748 
       
 13749     function createChild(returnFiber, newChild, expirationTime) {
       
 13750       if (typeof newChild === 'string' || typeof newChild === 'number') {
       
 13751         // Text nodes don't have keys. If the previous node is implicitly keyed
       
 13752         // we can continue to replace it without aborting even if it is not a text
       
 13753         // node.
       
 13754         var created = createFiberFromText('' + newChild, returnFiber.mode, expirationTime);
       
 13755         created.return = returnFiber;
       
 13756         return created;
       
 13757       }
       
 13758 
       
 13759       if (typeof newChild === 'object' && newChild !== null) {
       
 13760         switch (newChild.$$typeof) {
       
 13761           case REACT_ELEMENT_TYPE:
       
 13762             {
       
 13763               var _created = createFiberFromElement(newChild, returnFiber.mode, expirationTime);
       
 13764 
       
 13765               _created.ref = coerceRef(returnFiber, null, newChild);
       
 13766               _created.return = returnFiber;
       
 13767               return _created;
       
 13768             }
       
 13769 
       
 13770           case REACT_PORTAL_TYPE:
       
 13771             {
       
 13772               var _created2 = createFiberFromPortal(newChild, returnFiber.mode, expirationTime);
       
 13773 
       
 13774               _created2.return = returnFiber;
       
 13775               return _created2;
       
 13776             }
       
 13777         }
       
 13778 
       
 13779         if (isArray$1(newChild) || getIteratorFn(newChild)) {
       
 13780           var _created3 = createFiberFromFragment(newChild, returnFiber.mode, expirationTime, null);
       
 13781 
       
 13782           _created3.return = returnFiber;
       
 13783           return _created3;
       
 13784         }
       
 13785 
       
 13786         throwOnInvalidObjectType(returnFiber, newChild);
       
 13787       }
       
 13788 
 11354       {
 13789       {
 11355         throw ReactError(Error('It is not supported to run the profiling version of a renderer (for example, `react-dom/profiling`) without also replacing the `scheduler/tracing` module with `scheduler/tracing-profiling`. Your bundler might have a setting for aliasing both modules. Learn more at http://fb.me/react-profiling'));
 13790         if (typeof newChild === 'function') {
 11356       }
 13791           warnOnFunctionType();
 11357     }
 13792         }
 11358   })();
 13793       }
 11359 }
 13794 
 11360 
 13795       return null;
 11361 var fakeCallbackNode = {};
 13796     }
 11362 
 13797 
 11363 // Except for NoPriority, these correspond to Scheduler priorities. We use
 13798     function updateSlot(returnFiber, oldFiber, newChild, expirationTime) {
 11364 // ascending numbers so we can compare them like numbers. They start at 90 to
 13799       // Update the fiber if the keys match, otherwise return null.
 11365 // avoid clashing with Scheduler's priorities.
 13800       var key = oldFiber !== null ? oldFiber.key : null;
 11366 var ImmediatePriority = 99;
 13801 
 11367 var UserBlockingPriority$2 = 98;
 13802       if (typeof newChild === 'string' || typeof newChild === 'number') {
 11368 var NormalPriority = 97;
 13803         // Text nodes don't have keys. If the previous node is implicitly keyed
 11369 var LowPriority = 96;
 13804         // we can continue to replace it without aborting even if it is not a text
 11370 var IdlePriority = 95;
 13805         // node.
 11371 // NoPriority is the absence of priority. Also React-only.
 13806         if (key !== null) {
 11372 var NoPriority = 90;
 13807           return null;
 11373 
 13808         }
 11374 var shouldYield = Scheduler_shouldYield;
 13809 
 11375 var requestPaint =
 13810         return updateTextNode(returnFiber, oldFiber, '' + newChild, expirationTime);
 11376 // Fall back gracefully if we're running an older version of Scheduler.
 13811       }
 11377 Scheduler_requestPaint !== undefined ? Scheduler_requestPaint : function () {};
 13812 
 11378 
 13813       if (typeof newChild === 'object' && newChild !== null) {
 11379 var syncQueue = null;
 13814         switch (newChild.$$typeof) {
 11380 var immediateQueueCallbackNode = null;
 13815           case REACT_ELEMENT_TYPE:
 11381 var isFlushingSyncQueue = false;
 13816             {
 11382 var initialTimeMs = Scheduler_now();
 13817               if (newChild.key === key) {
 11383 
 13818                 if (newChild.type === REACT_FRAGMENT_TYPE) {
 11384 // If the initial timestamp is reasonably small, use Scheduler's `now` directly.
 13819                   return updateFragment(returnFiber, oldFiber, newChild.props.children, expirationTime, key);
 11385 // This will be the case for modern browsers that support `performance.now`. In
 13820                 }
 11386 // older browsers, Scheduler falls back to `Date.now`, which returns a Unix
 13821 
 11387 // timestamp. In that case, subtract the module initialization time to simulate
 13822                 return updateElement(returnFiber, oldFiber, newChild, expirationTime);
 11388 // the behavior of performance.now and keep our times small enough to fit
 13823               } else {
 11389 // within 32 bits.
 13824                 return null;
 11390 // TODO: Consider lifting this into Scheduler.
 13825               }
 11391 var now = initialTimeMs < 10000 ? Scheduler_now : function () {
 13826             }
 11392   return Scheduler_now() - initialTimeMs;
 13827 
 11393 };
 13828           case REACT_PORTAL_TYPE:
 11394 
 13829             {
 11395 function getCurrentPriorityLevel() {
 13830               if (newChild.key === key) {
 11396   switch (Scheduler_getCurrentPriorityLevel()) {
 13831                 return updatePortal(returnFiber, oldFiber, newChild, expirationTime);
 11397     case Scheduler_ImmediatePriority:
 13832               } else {
 11398       return ImmediatePriority;
 13833                 return null;
 11399     case Scheduler_UserBlockingPriority:
 13834               }
 11400       return UserBlockingPriority$2;
 13835             }
 11401     case Scheduler_NormalPriority:
 13836         }
 11402       return NormalPriority;
 13837 
 11403     case Scheduler_LowPriority:
 13838         if (isArray$1(newChild) || getIteratorFn(newChild)) {
 11404       return LowPriority;
 13839           if (key !== null) {
 11405     case Scheduler_IdlePriority:
 13840             return null;
 11406       return IdlePriority;
 13841           }
 11407     default:
 13842 
 11408       (function () {
 13843           return updateFragment(returnFiber, oldFiber, newChild, expirationTime, null);
       
 13844         }
       
 13845 
       
 13846         throwOnInvalidObjectType(returnFiber, newChild);
       
 13847       }
       
 13848 
       
 13849       {
       
 13850         if (typeof newChild === 'function') {
       
 13851           warnOnFunctionType();
       
 13852         }
       
 13853       }
       
 13854 
       
 13855       return null;
       
 13856     }
       
 13857 
       
 13858     function updateFromMap(existingChildren, returnFiber, newIdx, newChild, expirationTime) {
       
 13859       if (typeof newChild === 'string' || typeof newChild === 'number') {
       
 13860         // Text nodes don't have keys, so we neither have to check the old nor
       
 13861         // new node for the key. If both are text nodes, they match.
       
 13862         var matchedFiber = existingChildren.get(newIdx) || null;
       
 13863         return updateTextNode(returnFiber, matchedFiber, '' + newChild, expirationTime);
       
 13864       }
       
 13865 
       
 13866       if (typeof newChild === 'object' && newChild !== null) {
       
 13867         switch (newChild.$$typeof) {
       
 13868           case REACT_ELEMENT_TYPE:
       
 13869             {
       
 13870               var _matchedFiber = existingChildren.get(newChild.key === null ? newIdx : newChild.key) || null;
       
 13871 
       
 13872               if (newChild.type === REACT_FRAGMENT_TYPE) {
       
 13873                 return updateFragment(returnFiber, _matchedFiber, newChild.props.children, expirationTime, newChild.key);
       
 13874               }
       
 13875 
       
 13876               return updateElement(returnFiber, _matchedFiber, newChild, expirationTime);
       
 13877             }
       
 13878 
       
 13879           case REACT_PORTAL_TYPE:
       
 13880             {
       
 13881               var _matchedFiber2 = existingChildren.get(newChild.key === null ? newIdx : newChild.key) || null;
       
 13882 
       
 13883               return updatePortal(returnFiber, _matchedFiber2, newChild, expirationTime);
       
 13884             }
       
 13885         }
       
 13886 
       
 13887         if (isArray$1(newChild) || getIteratorFn(newChild)) {
       
 13888           var _matchedFiber3 = existingChildren.get(newIdx) || null;
       
 13889 
       
 13890           return updateFragment(returnFiber, _matchedFiber3, newChild, expirationTime, null);
       
 13891         }
       
 13892 
       
 13893         throwOnInvalidObjectType(returnFiber, newChild);
       
 13894       }
       
 13895 
       
 13896       {
       
 13897         if (typeof newChild === 'function') {
       
 13898           warnOnFunctionType();
       
 13899         }
       
 13900       }
       
 13901 
       
 13902       return null;
       
 13903     }
       
 13904     /**
       
 13905      * Warns if there is a duplicate or missing key
       
 13906      */
       
 13907 
       
 13908 
       
 13909     function warnOnInvalidKey(child, knownKeys) {
       
 13910       {
       
 13911         if (typeof child !== 'object' || child === null) {
       
 13912           return knownKeys;
       
 13913         }
       
 13914 
       
 13915         switch (child.$$typeof) {
       
 13916           case REACT_ELEMENT_TYPE:
       
 13917           case REACT_PORTAL_TYPE:
       
 13918             warnForMissingKey(child);
       
 13919             var key = child.key;
       
 13920 
       
 13921             if (typeof key !== 'string') {
       
 13922               break;
       
 13923             }
       
 13924 
       
 13925             if (knownKeys === null) {
       
 13926               knownKeys = new Set();
       
 13927               knownKeys.add(key);
       
 13928               break;
       
 13929             }
       
 13930 
       
 13931             if (!knownKeys.has(key)) {
       
 13932               knownKeys.add(key);
       
 13933               break;
       
 13934             }
       
 13935 
       
 13936             error('Encountered two children with the same key, `%s`. ' + 'Keys should be unique so that components maintain their identity ' + 'across updates. Non-unique keys may cause children to be ' + 'duplicated and/or omitted — the behavior is unsupported and ' + 'could change in a future version.', key);
       
 13937 
       
 13938             break;
       
 13939         }
       
 13940       }
       
 13941 
       
 13942       return knownKeys;
       
 13943     }
       
 13944 
       
 13945     function reconcileChildrenArray(returnFiber, currentFirstChild, newChildren, expirationTime) {
       
 13946       // This algorithm can't optimize by searching from both ends since we
       
 13947       // don't have backpointers on fibers. I'm trying to see how far we can get
       
 13948       // with that model. If it ends up not being worth the tradeoffs, we can
       
 13949       // add it later.
       
 13950       // Even with a two ended optimization, we'd want to optimize for the case
       
 13951       // where there are few changes and brute force the comparison instead of
       
 13952       // going for the Map. It'd like to explore hitting that path first in
       
 13953       // forward-only mode and only go for the Map once we notice that we need
       
 13954       // lots of look ahead. This doesn't handle reversal as well as two ended
       
 13955       // search but that's unusual. Besides, for the two ended optimization to
       
 13956       // work on Iterables, we'd need to copy the whole set.
       
 13957       // In this first iteration, we'll just live with hitting the bad case
       
 13958       // (adding everything to a Map) in for every insert/move.
       
 13959       // If you change this code, also update reconcileChildrenIterator() which
       
 13960       // uses the same algorithm.
       
 13961       {
       
 13962         // First, validate keys.
       
 13963         var knownKeys = null;
       
 13964 
       
 13965         for (var i = 0; i < newChildren.length; i++) {
       
 13966           var child = newChildren[i];
       
 13967           knownKeys = warnOnInvalidKey(child, knownKeys);
       
 13968         }
       
 13969       }
       
 13970 
       
 13971       var resultingFirstChild = null;
       
 13972       var previousNewFiber = null;
       
 13973       var oldFiber = currentFirstChild;
       
 13974       var lastPlacedIndex = 0;
       
 13975       var newIdx = 0;
       
 13976       var nextOldFiber = null;
       
 13977 
       
 13978       for (; oldFiber !== null && newIdx < newChildren.length; newIdx++) {
       
 13979         if (oldFiber.index > newIdx) {
       
 13980           nextOldFiber = oldFiber;
       
 13981           oldFiber = null;
       
 13982         } else {
       
 13983           nextOldFiber = oldFiber.sibling;
       
 13984         }
       
 13985 
       
 13986         var newFiber = updateSlot(returnFiber, oldFiber, newChildren[newIdx], expirationTime);
       
 13987 
       
 13988         if (newFiber === null) {
       
 13989           // TODO: This breaks on empty slots like null children. That's
       
 13990           // unfortunate because it triggers the slow path all the time. We need
       
 13991           // a better way to communicate whether this was a miss or null,
       
 13992           // boolean, undefined, etc.
       
 13993           if (oldFiber === null) {
       
 13994             oldFiber = nextOldFiber;
       
 13995           }
       
 13996 
       
 13997           break;
       
 13998         }
       
 13999 
       
 14000         if (shouldTrackSideEffects) {
       
 14001           if (oldFiber && newFiber.alternate === null) {
       
 14002             // We matched the slot, but we didn't reuse the existing fiber, so we
       
 14003             // need to delete the existing child.
       
 14004             deleteChild(returnFiber, oldFiber);
       
 14005           }
       
 14006         }
       
 14007 
       
 14008         lastPlacedIndex = placeChild(newFiber, lastPlacedIndex, newIdx);
       
 14009 
       
 14010         if (previousNewFiber === null) {
       
 14011           // TODO: Move out of the loop. This only happens for the first run.
       
 14012           resultingFirstChild = newFiber;
       
 14013         } else {
       
 14014           // TODO: Defer siblings if we're not at the right index for this slot.
       
 14015           // I.e. if we had null values before, then we want to defer this
       
 14016           // for each null value. However, we also don't want to call updateSlot
       
 14017           // with the previous one.
       
 14018           previousNewFiber.sibling = newFiber;
       
 14019         }
       
 14020 
       
 14021         previousNewFiber = newFiber;
       
 14022         oldFiber = nextOldFiber;
       
 14023       }
       
 14024 
       
 14025       if (newIdx === newChildren.length) {
       
 14026         // We've reached the end of the new children. We can delete the rest.
       
 14027         deleteRemainingChildren(returnFiber, oldFiber);
       
 14028         return resultingFirstChild;
       
 14029       }
       
 14030 
       
 14031       if (oldFiber === null) {
       
 14032         // If we don't have any more existing children we can choose a fast path
       
 14033         // since the rest will all be insertions.
       
 14034         for (; newIdx < newChildren.length; newIdx++) {
       
 14035           var _newFiber = createChild(returnFiber, newChildren[newIdx], expirationTime);
       
 14036 
       
 14037           if (_newFiber === null) {
       
 14038             continue;
       
 14039           }
       
 14040 
       
 14041           lastPlacedIndex = placeChild(_newFiber, lastPlacedIndex, newIdx);
       
 14042 
       
 14043           if (previousNewFiber === null) {
       
 14044             // TODO: Move out of the loop. This only happens for the first run.
       
 14045             resultingFirstChild = _newFiber;
       
 14046           } else {
       
 14047             previousNewFiber.sibling = _newFiber;
       
 14048           }
       
 14049 
       
 14050           previousNewFiber = _newFiber;
       
 14051         }
       
 14052 
       
 14053         return resultingFirstChild;
       
 14054       } // Add all children to a key map for quick lookups.
       
 14055 
       
 14056 
       
 14057       var existingChildren = mapRemainingChildren(returnFiber, oldFiber); // Keep scanning and use the map to restore deleted items as moves.
       
 14058 
       
 14059       for (; newIdx < newChildren.length; newIdx++) {
       
 14060         var _newFiber2 = updateFromMap(existingChildren, returnFiber, newIdx, newChildren[newIdx], expirationTime);
       
 14061 
       
 14062         if (_newFiber2 !== null) {
       
 14063           if (shouldTrackSideEffects) {
       
 14064             if (_newFiber2.alternate !== null) {
       
 14065               // The new fiber is a work in progress, but if there exists a
       
 14066               // current, that means that we reused the fiber. We need to delete
       
 14067               // it from the child list so that we don't add it to the deletion
       
 14068               // list.
       
 14069               existingChildren.delete(_newFiber2.key === null ? newIdx : _newFiber2.key);
       
 14070             }
       
 14071           }
       
 14072 
       
 14073           lastPlacedIndex = placeChild(_newFiber2, lastPlacedIndex, newIdx);
       
 14074 
       
 14075           if (previousNewFiber === null) {
       
 14076             resultingFirstChild = _newFiber2;
       
 14077           } else {
       
 14078             previousNewFiber.sibling = _newFiber2;
       
 14079           }
       
 14080 
       
 14081           previousNewFiber = _newFiber2;
       
 14082         }
       
 14083       }
       
 14084 
       
 14085       if (shouldTrackSideEffects) {
       
 14086         // Any existing children that weren't consumed above were deleted. We need
       
 14087         // to add them to the deletion list.
       
 14088         existingChildren.forEach(function (child) {
       
 14089           return deleteChild(returnFiber, child);
       
 14090         });
       
 14091       }
       
 14092 
       
 14093       return resultingFirstChild;
       
 14094     }
       
 14095 
       
 14096     function reconcileChildrenIterator(returnFiber, currentFirstChild, newChildrenIterable, expirationTime) {
       
 14097       // This is the same implementation as reconcileChildrenArray(),
       
 14098       // but using the iterator instead.
       
 14099       var iteratorFn = getIteratorFn(newChildrenIterable);
       
 14100 
       
 14101       if (!(typeof iteratorFn === 'function')) {
 11409         {
 14102         {
 11410           {
 14103           throw Error( "An object is not an iterable. This error is likely caused by a bug in React. Please file an issue." );
 11411             throw ReactError(Error('Unknown priority level.'));
 14104         }
       
 14105       }
       
 14106 
       
 14107       {
       
 14108         // We don't support rendering Generators because it's a mutation.
       
 14109         // See https://github.com/facebook/react/issues/12995
       
 14110         if (typeof Symbol === 'function' && // $FlowFixMe Flow doesn't know about toStringTag
       
 14111         newChildrenIterable[Symbol.toStringTag] === 'Generator') {
       
 14112           if (!didWarnAboutGenerators) {
       
 14113             error('Using Generators as children is unsupported and will likely yield ' + 'unexpected results because enumerating a generator mutates it. ' + 'You may convert it to an array with `Array.from()` or the ' + '`[...spread]` operator before rendering. Keep in mind ' + 'you might need to polyfill these features for older browsers.');
 11412           }
 14114           }
 11413         }
 14115 
 11414       })();
 14116           didWarnAboutGenerators = true;
 11415   }
 14117         } // Warn about using Maps as children
 11416 }
 14118 
 11417 
 14119 
 11418 function reactPriorityToSchedulerPriority(reactPriorityLevel) {
 14120         if (newChildrenIterable.entries === iteratorFn) {
 11419   switch (reactPriorityLevel) {
 14121           if (!didWarnAboutMaps) {
 11420     case ImmediatePriority:
 14122             error('Using Maps as children is unsupported and will likely yield ' + 'unexpected results. Convert it to a sequence/iterable of keyed ' + 'ReactElements instead.');
 11421       return Scheduler_ImmediatePriority;
 14123           }
 11422     case UserBlockingPriority$2:
 14124 
 11423       return Scheduler_UserBlockingPriority;
 14125           didWarnAboutMaps = true;
 11424     case NormalPriority:
 14126         } // First, validate keys.
 11425       return Scheduler_NormalPriority;
 14127         // We'll get a different iterator later for the main pass.
 11426     case LowPriority:
 14128 
 11427       return Scheduler_LowPriority;
 14129 
 11428     case IdlePriority:
 14130         var _newChildren = iteratorFn.call(newChildrenIterable);
 11429       return Scheduler_IdlePriority;
 14131 
 11430     default:
 14132         if (_newChildren) {
 11431       (function () {
 14133           var knownKeys = null;
       
 14134 
       
 14135           var _step = _newChildren.next();
       
 14136 
       
 14137           for (; !_step.done; _step = _newChildren.next()) {
       
 14138             var child = _step.value;
       
 14139             knownKeys = warnOnInvalidKey(child, knownKeys);
       
 14140           }
       
 14141         }
       
 14142       }
       
 14143 
       
 14144       var newChildren = iteratorFn.call(newChildrenIterable);
       
 14145 
       
 14146       if (!(newChildren != null)) {
 11432         {
 14147         {
 11433           {
 14148           throw Error( "An iterable object provided no iterator." );
 11434             throw ReactError(Error('Unknown priority level.'));
 14149         }
       
 14150       }
       
 14151 
       
 14152       var resultingFirstChild = null;
       
 14153       var previousNewFiber = null;
       
 14154       var oldFiber = currentFirstChild;
       
 14155       var lastPlacedIndex = 0;
       
 14156       var newIdx = 0;
       
 14157       var nextOldFiber = null;
       
 14158       var step = newChildren.next();
       
 14159 
       
 14160       for (; oldFiber !== null && !step.done; newIdx++, step = newChildren.next()) {
       
 14161         if (oldFiber.index > newIdx) {
       
 14162           nextOldFiber = oldFiber;
       
 14163           oldFiber = null;
       
 14164         } else {
       
 14165           nextOldFiber = oldFiber.sibling;
       
 14166         }
       
 14167 
       
 14168         var newFiber = updateSlot(returnFiber, oldFiber, step.value, expirationTime);
       
 14169 
       
 14170         if (newFiber === null) {
       
 14171           // TODO: This breaks on empty slots like null children. That's
       
 14172           // unfortunate because it triggers the slow path all the time. We need
       
 14173           // a better way to communicate whether this was a miss or null,
       
 14174           // boolean, undefined, etc.
       
 14175           if (oldFiber === null) {
       
 14176             oldFiber = nextOldFiber;
 11435           }
 14177           }
 11436         }
 14178 
 11437       })();
 14179           break;
 11438   }
 14180         }
 11439 }
 14181 
 11440 
 14182         if (shouldTrackSideEffects) {
 11441 function runWithPriority$2(reactPriorityLevel, fn) {
 14183           if (oldFiber && newFiber.alternate === null) {
 11442   var priorityLevel = reactPriorityToSchedulerPriority(reactPriorityLevel);
 14184             // We matched the slot, but we didn't reuse the existing fiber, so we
 11443   return Scheduler_runWithPriority(priorityLevel, fn);
 14185             // need to delete the existing child.
 11444 }
 14186             deleteChild(returnFiber, oldFiber);
 11445 
 14187           }
 11446 function scheduleCallback(reactPriorityLevel, callback, options) {
 14188         }
 11447   var priorityLevel = reactPriorityToSchedulerPriority(reactPriorityLevel);
 14189 
 11448   return Scheduler_scheduleCallback(priorityLevel, callback, options);
 14190         lastPlacedIndex = placeChild(newFiber, lastPlacedIndex, newIdx);
 11449 }
 14191 
 11450 
 14192         if (previousNewFiber === null) {
 11451 function scheduleSyncCallback(callback) {
 14193           // TODO: Move out of the loop. This only happens for the first run.
 11452   // Push this callback into an internal queue. We'll flush these either in
 14194           resultingFirstChild = newFiber;
 11453   // the next tick, or earlier if something calls `flushSyncCallbackQueue`.
 14195         } else {
 11454   if (syncQueue === null) {
 14196           // TODO: Defer siblings if we're not at the right index for this slot.
 11455     syncQueue = [callback];
 14197           // I.e. if we had null values before, then we want to defer this
 11456     // Flush the queue in the next tick, at the earliest.
 14198           // for each null value. However, we also don't want to call updateSlot
 11457     immediateQueueCallbackNode = Scheduler_scheduleCallback(Scheduler_ImmediatePriority, flushSyncCallbackQueueImpl);
 14199           // with the previous one.
 11458   } else {
 14200           previousNewFiber.sibling = newFiber;
 11459     // Push onto existing queue. Don't need to schedule a callback because
 14201         }
 11460     // we already scheduled one when we created the queue.
 14202 
 11461     syncQueue.push(callback);
 14203         previousNewFiber = newFiber;
 11462   }
 14204         oldFiber = nextOldFiber;
 11463   return fakeCallbackNode;
 14205       }
 11464 }
 14206 
 11465 
 14207       if (step.done) {
 11466 function cancelCallback(callbackNode) {
 14208         // We've reached the end of the new children. We can delete the rest.
 11467   if (callbackNode !== fakeCallbackNode) {
 14209         deleteRemainingChildren(returnFiber, oldFiber);
 11468     Scheduler_cancelCallback(callbackNode);
 14210         return resultingFirstChild;
 11469   }
 14211       }
 11470 }
 14212 
 11471 
 14213       if (oldFiber === null) {
 11472 function flushSyncCallbackQueue() {
 14214         // If we don't have any more existing children we can choose a fast path
 11473   if (immediateQueueCallbackNode !== null) {
 14215         // since the rest will all be insertions.
 11474     Scheduler_cancelCallback(immediateQueueCallbackNode);
 14216         for (; !step.done; newIdx++, step = newChildren.next()) {
 11475   }
 14217           var _newFiber3 = createChild(returnFiber, step.value, expirationTime);
 11476   flushSyncCallbackQueueImpl();
 14218 
 11477 }
 14219           if (_newFiber3 === null) {
 11478 
 14220             continue;
 11479 function flushSyncCallbackQueueImpl() {
 14221           }
 11480   if (!isFlushingSyncQueue && syncQueue !== null) {
 14222 
 11481     // Prevent re-entrancy.
 14223           lastPlacedIndex = placeChild(_newFiber3, lastPlacedIndex, newIdx);
 11482     isFlushingSyncQueue = true;
 14224 
 11483     var i = 0;
 14225           if (previousNewFiber === null) {
 11484     try {
 14226             // TODO: Move out of the loop. This only happens for the first run.
 11485       var _isSync = true;
 14227             resultingFirstChild = _newFiber3;
 11486       var queue = syncQueue;
 14228           } else {
 11487       runWithPriority$2(ImmediatePriority, function () {
 14229             previousNewFiber.sibling = _newFiber3;
 11488         for (; i < queue.length; i++) {
 14230           }
 11489           var callback = queue[i];
 14231 
 11490           do {
 14232           previousNewFiber = _newFiber3;
 11491             callback = callback(_isSync);
 14233         }
 11492           } while (callback !== null);
 14234 
 11493         }
 14235         return resultingFirstChild;
 11494       });
 14236       } // Add all children to a key map for quick lookups.
 11495       syncQueue = null;
 14237 
 11496     } catch (error) {
 14238 
 11497       // If something throws, leave the remaining callbacks on the queue.
 14239       var existingChildren = mapRemainingChildren(returnFiber, oldFiber); // Keep scanning and use the map to restore deleted items as moves.
 11498       if (syncQueue !== null) {
 14240 
 11499         syncQueue = syncQueue.slice(i + 1);
 14241       for (; !step.done; newIdx++, step = newChildren.next()) {
 11500       }
 14242         var _newFiber4 = updateFromMap(existingChildren, returnFiber, newIdx, step.value, expirationTime);
 11501       // Resume flushing in the next tick
 14243 
 11502       Scheduler_scheduleCallback(Scheduler_ImmediatePriority, flushSyncCallbackQueue);
 14244         if (_newFiber4 !== null) {
 11503       throw error;
 14245           if (shouldTrackSideEffects) {
 11504     } finally {
 14246             if (_newFiber4.alternate !== null) {
 11505       isFlushingSyncQueue = false;
 14247               // The new fiber is a work in progress, but if there exists a
 11506     }
 14248               // current, that means that we reused the fiber. We need to delete
 11507   }
 14249               // it from the child list so that we don't add it to the deletion
 11508 }
 14250               // list.
 11509 
 14251               existingChildren.delete(_newFiber4.key === null ? newIdx : _newFiber4.key);
 11510 var NoMode = 0;
 14252             }
 11511 var StrictMode = 1;
 14253           }
 11512 // TODO: Remove BatchedMode and ConcurrentMode by reading from the root
 14254 
 11513 // tag instead
 14255           lastPlacedIndex = placeChild(_newFiber4, lastPlacedIndex, newIdx);
 11514 var BatchedMode = 2;
 14256 
 11515 var ConcurrentMode = 4;
 14257           if (previousNewFiber === null) {
 11516 var ProfileMode = 8;
 14258             resultingFirstChild = _newFiber4;
 11517 
 14259           } else {
 11518 // Max 31 bit integer. The max integer size in V8 for 32-bit systems.
 14260             previousNewFiber.sibling = _newFiber4;
 11519 // Math.pow(2, 30) - 1
 14261           }
 11520 // 0b111111111111111111111111111111
 14262 
 11521 var MAX_SIGNED_31_BIT_INT = 1073741823;
 14263           previousNewFiber = _newFiber4;
 11522 
 14264         }
 11523 var NoWork = 0;
 14265       }
 11524 var Never = 1;
 14266 
 11525 var Sync = MAX_SIGNED_31_BIT_INT;
 14267       if (shouldTrackSideEffects) {
 11526 var Batched = Sync - 1;
 14268         // Any existing children that weren't consumed above were deleted. We need
 11527 
 14269         // to add them to the deletion list.
 11528 var UNIT_SIZE = 10;
 14270         existingChildren.forEach(function (child) {
 11529 var MAGIC_NUMBER_OFFSET = Batched - 1;
 14271           return deleteChild(returnFiber, child);
 11530 
 14272         });
 11531 // 1 unit of expiration time represents 10ms.
 14273       }
 11532 function msToExpirationTime(ms) {
 14274 
 11533   // Always add an offset so that we don't clash with the magic number for NoWork.
 14275       return resultingFirstChild;
 11534   return MAGIC_NUMBER_OFFSET - (ms / UNIT_SIZE | 0);
 14276     }
 11535 }
 14277 
 11536 
 14278     function reconcileSingleTextNode(returnFiber, currentFirstChild, textContent, expirationTime) {
 11537 function expirationTimeToMs(expirationTime) {
 14279       // There's no need to check for keys on text nodes since we don't have a
 11538   return (MAGIC_NUMBER_OFFSET - expirationTime) * UNIT_SIZE;
 14280       // way to define them.
 11539 }
 14281       if (currentFirstChild !== null && currentFirstChild.tag === HostText) {
 11540 
 14282         // We already have an existing node so let's just update it and delete
 11541 function ceiling(num, precision) {
 14283         // the rest.
 11542   return ((num / precision | 0) + 1) * precision;
 14284         deleteRemainingChildren(returnFiber, currentFirstChild.sibling);
 11543 }
 14285         var existing = useFiber(currentFirstChild, textContent);
 11544 
 14286         existing.return = returnFiber;
 11545 function computeExpirationBucket(currentTime, expirationInMs, bucketSizeMs) {
 14287         return existing;
 11546   return MAGIC_NUMBER_OFFSET - ceiling(MAGIC_NUMBER_OFFSET - currentTime + expirationInMs / UNIT_SIZE, bucketSizeMs / UNIT_SIZE);
 14288       } // The existing first child is not a text node so we need to create one
 11547 }
 14289       // and delete the existing ones.
 11548 
 14290 
 11549 // TODO: This corresponds to Scheduler's NormalPriority, not LowPriority. Update
 14291 
 11550 // the names to reflect.
 14292       deleteRemainingChildren(returnFiber, currentFirstChild);
 11551 var LOW_PRIORITY_EXPIRATION = 5000;
 14293       var created = createFiberFromText(textContent, returnFiber.mode, expirationTime);
 11552 var LOW_PRIORITY_BATCH_SIZE = 250;
 14294       created.return = returnFiber;
 11553 
 14295       return created;
 11554 function computeAsyncExpiration(currentTime) {
 14296     }
 11555   return computeExpirationBucket(currentTime, LOW_PRIORITY_EXPIRATION, LOW_PRIORITY_BATCH_SIZE);
 14297 
 11556 }
 14298     function reconcileSingleElement(returnFiber, currentFirstChild, element, expirationTime) {
 11557 
 14299       var key = element.key;
 11558 function computeSuspenseExpiration(currentTime, timeoutMs) {
 14300       var child = currentFirstChild;
 11559   // TODO: Should we warn if timeoutMs is lower than the normal pri expiration time?
 14301 
 11560   return computeExpirationBucket(currentTime, timeoutMs, LOW_PRIORITY_BATCH_SIZE);
 14302       while (child !== null) {
 11561 }
 14303         // TODO: If key === null and child.key === null, then this only applies to
 11562 
 14304         // the first item in the list.
 11563 // We intentionally set a higher expiration time for interactive updates in
 14305         if (child.key === key) {
 11564 // dev than in production.
 14306           switch (child.tag) {
 11565 //
 14307             case Fragment:
 11566 // If the main thread is being blocked so long that you hit the expiration,
 14308               {
 11567 // it's a problem that could be solved with better scheduling.
 14309                 if (element.type === REACT_FRAGMENT_TYPE) {
 11568 //
 14310                   deleteRemainingChildren(returnFiber, child.sibling);
 11569 // People will be more likely to notice this and fix it with the long
 14311                   var existing = useFiber(child, element.props.children);
 11570 // expiration time in development.
 14312                   existing.return = returnFiber;
 11571 //
 14313 
 11572 // In production we opt for better UX at the risk of masking scheduling
 14314                   {
 11573 // problems, by expiring fast.
 14315                     existing._debugSource = element._source;
 11574 var HIGH_PRIORITY_EXPIRATION = 500;
 14316                     existing._debugOwner = element._owner;
 11575 var HIGH_PRIORITY_BATCH_SIZE = 100;
 14317                   }
 11576 
 14318 
 11577 function computeInteractiveExpiration(currentTime) {
 14319                   return existing;
 11578   return computeExpirationBucket(currentTime, HIGH_PRIORITY_EXPIRATION, HIGH_PRIORITY_BATCH_SIZE);
 14320                 }
 11579 }
 14321 
 11580 
 14322                 break;
 11581 function inferPriorityFromExpirationTime(currentTime, expirationTime) {
 14323               }
 11582   if (expirationTime === Sync) {
 14324 
 11583     return ImmediatePriority;
 14325             case Block:
 11584   }
 14326 
 11585   if (expirationTime === Never) {
 14327             // We intentionally fallthrough here if enableBlocksAPI is not on.
 11586     return IdlePriority;
 14328             // eslint-disable-next-lined no-fallthrough
 11587   }
 14329 
 11588   var msUntil = expirationTimeToMs(expirationTime) - expirationTimeToMs(currentTime);
 14330             default:
 11589   if (msUntil <= 0) {
 14331               {
 11590     return ImmediatePriority;
 14332                 if (child.elementType === element.type || ( // Keep this check inline so it only runs on the false path:
 11591   }
 14333                  isCompatibleFamilyForHotReloading(child, element) )) {
 11592   if (msUntil <= HIGH_PRIORITY_EXPIRATION + HIGH_PRIORITY_BATCH_SIZE) {
 14334                   deleteRemainingChildren(returnFiber, child.sibling);
 11593     return UserBlockingPriority$2;
 14335 
 11594   }
 14336                   var _existing3 = useFiber(child, element.props);
 11595   if (msUntil <= LOW_PRIORITY_EXPIRATION + LOW_PRIORITY_BATCH_SIZE) {
 14337 
 11596     return NormalPriority;
 14338                   _existing3.ref = coerceRef(returnFiber, child, element);
 11597   }
 14339                   _existing3.return = returnFiber;
 11598 
 14340 
 11599   // TODO: Handle LowPriority
 14341                   {
 11600 
 14342                     _existing3._debugSource = element._source;
 11601   // Assume anything lower has idle priority
 14343                     _existing3._debugOwner = element._owner;
 11602   return IdlePriority;
 14344                   }
 11603 }
 14345 
 11604 
 14346                   return _existing3;
 11605 /**
 14347                 }
 11606  * Forked from fbjs/warning:
 14348 
 11607  * https://github.com/facebook/fbjs/blob/e66ba20ad5be433eb54423f2b097d829324d9de6/packages/fbjs/src/__forks__/warning.js
 14349                 break;
 11608  *
 14350               }
 11609  * Only change is we use console.warn instead of console.error,
 14351           } // Didn't match.
 11610  * and do nothing when 'console' is not supported.
 14352 
 11611  * This really simplifies the code.
 14353 
 11612  * ---
 14354           deleteRemainingChildren(returnFiber, child);
 11613  * Similar to invariant but only logs a warning if the condition is not met.
 14355           break;
 11614  * This can be used to log issues in development environments in critical
 14356         } else {
 11615  * paths. Removing the logging code for production environments will keep the
 14357           deleteChild(returnFiber, child);
 11616  * same logic and follow the same code paths.
 14358         }
 11617  */
 14359 
 11618 
 14360         child = child.sibling;
 11619 var lowPriorityWarning = function () {};
 14361       }
 11620 
 14362 
 11621 {
 14363       if (element.type === REACT_FRAGMENT_TYPE) {
 11622   var printWarning$1 = function (format) {
 14364         var created = createFiberFromFragment(element.props.children, returnFiber.mode, expirationTime, element.key);
 11623     for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
 14365         created.return = returnFiber;
 11624       args[_key - 1] = arguments[_key];
 14366         return created;
 11625     }
 14367       } else {
 11626 
 14368         var _created4 = createFiberFromElement(element, returnFiber.mode, expirationTime);
 11627     var argIndex = 0;
 14369 
 11628     var message = 'Warning: ' + format.replace(/%s/g, function () {
 14370         _created4.ref = coerceRef(returnFiber, currentFirstChild, element);
 11629       return args[argIndex++];
 14371         _created4.return = returnFiber;
 11630     });
 14372         return _created4;
 11631     if (typeof console !== 'undefined') {
 14373       }
 11632       console.warn(message);
 14374     }
 11633     }
 14375 
 11634     try {
 14376     function reconcileSinglePortal(returnFiber, currentFirstChild, portal, expirationTime) {
 11635       // --- Welcome to debugging React ---
 14377       var key = portal.key;
 11636       // This error was thrown as a convenience so that you can use this stack
 14378       var child = currentFirstChild;
 11637       // to find the callsite that caused this warning to fire.
 14379 
 11638       throw new Error(message);
 14380       while (child !== null) {
 11639     } catch (x) {}
 14381         // TODO: If key === null and child.key === null, then this only applies to
 11640   };
 14382         // the first item in the list.
 11641 
 14383         if (child.key === key) {
 11642   lowPriorityWarning = function (condition, format) {
 14384           if (child.tag === HostPortal && child.stateNode.containerInfo === portal.containerInfo && child.stateNode.implementation === portal.implementation) {
 11643     if (format === undefined) {
 14385             deleteRemainingChildren(returnFiber, child.sibling);
 11644       throw new Error('`lowPriorityWarning(condition, format, ...args)` requires a warning ' + 'message argument');
 14386             var existing = useFiber(child, portal.children || []);
 11645     }
 14387             existing.return = returnFiber;
 11646     if (!condition) {
 14388             return existing;
 11647       for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
 14389           } else {
 11648         args[_key2 - 2] = arguments[_key2];
 14390             deleteRemainingChildren(returnFiber, child);
 11649       }
 14391             break;
 11650 
 14392           }
 11651       printWarning$1.apply(undefined, [format].concat(args));
 14393         } else {
 11652     }
 14394           deleteChild(returnFiber, child);
 11653   };
 14395         }
 11654 }
 14396 
 11655 
 14397         child = child.sibling;
 11656 var lowPriorityWarning$1 = lowPriorityWarning;
 14398       }
 11657 
 14399 
 11658 var ReactStrictModeWarnings = {
 14400       var created = createFiberFromPortal(portal, returnFiber.mode, expirationTime);
 11659   recordUnsafeLifecycleWarnings: function (fiber, instance) {},
 14401       created.return = returnFiber;
 11660   flushPendingUnsafeLifecycleWarnings: function () {},
 14402       return created;
 11661   recordLegacyContextWarning: function (fiber, instance) {},
 14403     } // This API will tag the children with the side-effect of the reconciliation
 11662   flushLegacyContextWarning: function () {},
 14404     // itself. They will be added to the side-effect list as we pass through the
 11663   discardPendingWarnings: function () {}
 14405     // children and the parent.
 11664 };
 14406 
 11665 
 14407 
 11666 {
 14408     function reconcileChildFibers(returnFiber, currentFirstChild, newChild, expirationTime) {
 11667   var findStrictRoot = function (fiber) {
 14409       // This function is not recursive.
 11668     var maybeStrictRoot = null;
 14410       // If the top level item is an array, we treat it as a set of children,
 11669 
 14411       // not as a fragment. Nested arrays on the other hand will be treated as
 11670     var node = fiber;
 14412       // fragment nodes. Recursion happens at the normal flow.
       
 14413       // Handle top level unkeyed fragments as if they were arrays.
       
 14414       // This leads to an ambiguity between <>{[...]}</> and <>...</>.
       
 14415       // We treat the ambiguous cases above the same.
       
 14416       var isUnkeyedTopLevelFragment = typeof newChild === 'object' && newChild !== null && newChild.type === REACT_FRAGMENT_TYPE && newChild.key === null;
       
 14417 
       
 14418       if (isUnkeyedTopLevelFragment) {
       
 14419         newChild = newChild.props.children;
       
 14420       } // Handle object types
       
 14421 
       
 14422 
       
 14423       var isObject = typeof newChild === 'object' && newChild !== null;
       
 14424 
       
 14425       if (isObject) {
       
 14426         switch (newChild.$$typeof) {
       
 14427           case REACT_ELEMENT_TYPE:
       
 14428             return placeSingleChild(reconcileSingleElement(returnFiber, currentFirstChild, newChild, expirationTime));
       
 14429 
       
 14430           case REACT_PORTAL_TYPE:
       
 14431             return placeSingleChild(reconcileSinglePortal(returnFiber, currentFirstChild, newChild, expirationTime));
       
 14432         }
       
 14433       }
       
 14434 
       
 14435       if (typeof newChild === 'string' || typeof newChild === 'number') {
       
 14436         return placeSingleChild(reconcileSingleTextNode(returnFiber, currentFirstChild, '' + newChild, expirationTime));
       
 14437       }
       
 14438 
       
 14439       if (isArray$1(newChild)) {
       
 14440         return reconcileChildrenArray(returnFiber, currentFirstChild, newChild, expirationTime);
       
 14441       }
       
 14442 
       
 14443       if (getIteratorFn(newChild)) {
       
 14444         return reconcileChildrenIterator(returnFiber, currentFirstChild, newChild, expirationTime);
       
 14445       }
       
 14446 
       
 14447       if (isObject) {
       
 14448         throwOnInvalidObjectType(returnFiber, newChild);
       
 14449       }
       
 14450 
       
 14451       {
       
 14452         if (typeof newChild === 'function') {
       
 14453           warnOnFunctionType();
       
 14454         }
       
 14455       }
       
 14456 
       
 14457       if (typeof newChild === 'undefined' && !isUnkeyedTopLevelFragment) {
       
 14458         // If the new child is undefined, and the return fiber is a composite
       
 14459         // component, throw an error. If Fiber return types are disabled,
       
 14460         // we already threw above.
       
 14461         switch (returnFiber.tag) {
       
 14462           case ClassComponent:
       
 14463             {
       
 14464               {
       
 14465                 var instance = returnFiber.stateNode;
       
 14466 
       
 14467                 if (instance.render._isMockFunction) {
       
 14468                   // We allow auto-mocks to proceed as if they're returning null.
       
 14469                   break;
       
 14470                 }
       
 14471               }
       
 14472             }
       
 14473           // Intentionally fall through to the next case, which handles both
       
 14474           // functions and classes
       
 14475           // eslint-disable-next-lined no-fallthrough
       
 14476 
       
 14477           case FunctionComponent:
       
 14478             {
       
 14479               var Component = returnFiber.type;
       
 14480 
       
 14481               {
       
 14482                 {
       
 14483                   throw Error( (Component.displayName || Component.name || 'Component') + "(...): Nothing was returned from render. This usually means a return statement is missing. Or, to render nothing, return null." );
       
 14484                 }
       
 14485               }
       
 14486             }
       
 14487         }
       
 14488       } // Remaining cases are all treated as empty.
       
 14489 
       
 14490 
       
 14491       return deleteRemainingChildren(returnFiber, currentFirstChild);
       
 14492     }
       
 14493 
       
 14494     return reconcileChildFibers;
       
 14495   }
       
 14496 
       
 14497   var reconcileChildFibers = ChildReconciler(true);
       
 14498   var mountChildFibers = ChildReconciler(false);
       
 14499   function cloneChildFibers(current, workInProgress) {
       
 14500     if (!(current === null || workInProgress.child === current.child)) {
       
 14501       {
       
 14502         throw Error( "Resuming work not yet implemented." );
       
 14503       }
       
 14504     }
       
 14505 
       
 14506     if (workInProgress.child === null) {
       
 14507       return;
       
 14508     }
       
 14509 
       
 14510     var currentChild = workInProgress.child;
       
 14511     var newChild = createWorkInProgress(currentChild, currentChild.pendingProps);
       
 14512     workInProgress.child = newChild;
       
 14513     newChild.return = workInProgress;
       
 14514 
       
 14515     while (currentChild.sibling !== null) {
       
 14516       currentChild = currentChild.sibling;
       
 14517       newChild = newChild.sibling = createWorkInProgress(currentChild, currentChild.pendingProps);
       
 14518       newChild.return = workInProgress;
       
 14519     }
       
 14520 
       
 14521     newChild.sibling = null;
       
 14522   } // Reset a workInProgress child set to prepare it for a second pass.
       
 14523 
       
 14524   function resetChildFibers(workInProgress, renderExpirationTime) {
       
 14525     var child = workInProgress.child;
       
 14526 
       
 14527     while (child !== null) {
       
 14528       resetWorkInProgress(child, renderExpirationTime);
       
 14529       child = child.sibling;
       
 14530     }
       
 14531   }
       
 14532 
       
 14533   var NO_CONTEXT = {};
       
 14534   var contextStackCursor$1 = createCursor(NO_CONTEXT);
       
 14535   var contextFiberStackCursor = createCursor(NO_CONTEXT);
       
 14536   var rootInstanceStackCursor = createCursor(NO_CONTEXT);
       
 14537 
       
 14538   function requiredContext(c) {
       
 14539     if (!(c !== NO_CONTEXT)) {
       
 14540       {
       
 14541         throw Error( "Expected host context to exist. This error is likely caused by a bug in React. Please file an issue." );
       
 14542       }
       
 14543     }
       
 14544 
       
 14545     return c;
       
 14546   }
       
 14547 
       
 14548   function getRootHostContainer() {
       
 14549     var rootInstance = requiredContext(rootInstanceStackCursor.current);
       
 14550     return rootInstance;
       
 14551   }
       
 14552 
       
 14553   function pushHostContainer(fiber, nextRootInstance) {
       
 14554     // Push current root instance onto the stack;
       
 14555     // This allows us to reset root when portals are popped.
       
 14556     push(rootInstanceStackCursor, nextRootInstance, fiber); // Track the context and the Fiber that provided it.
       
 14557     // This enables us to pop only Fibers that provide unique contexts.
       
 14558 
       
 14559     push(contextFiberStackCursor, fiber, fiber); // Finally, we need to push the host context to the stack.
       
 14560     // However, we can't just call getRootHostContext() and push it because
       
 14561     // we'd have a different number of entries on the stack depending on
       
 14562     // whether getRootHostContext() throws somewhere in renderer code or not.
       
 14563     // So we push an empty value first. This lets us safely unwind on errors.
       
 14564 
       
 14565     push(contextStackCursor$1, NO_CONTEXT, fiber);
       
 14566     var nextRootContext = getRootHostContext(nextRootInstance); // Now that we know this function doesn't throw, replace it.
       
 14567 
       
 14568     pop(contextStackCursor$1, fiber);
       
 14569     push(contextStackCursor$1, nextRootContext, fiber);
       
 14570   }
       
 14571 
       
 14572   function popHostContainer(fiber) {
       
 14573     pop(contextStackCursor$1, fiber);
       
 14574     pop(contextFiberStackCursor, fiber);
       
 14575     pop(rootInstanceStackCursor, fiber);
       
 14576   }
       
 14577 
       
 14578   function getHostContext() {
       
 14579     var context = requiredContext(contextStackCursor$1.current);
       
 14580     return context;
       
 14581   }
       
 14582 
       
 14583   function pushHostContext(fiber) {
       
 14584     var rootInstance = requiredContext(rootInstanceStackCursor.current);
       
 14585     var context = requiredContext(contextStackCursor$1.current);
       
 14586     var nextContext = getChildHostContext(context, fiber.type); // Don't push this Fiber's context unless it's unique.
       
 14587 
       
 14588     if (context === nextContext) {
       
 14589       return;
       
 14590     } // Track the context and the Fiber that provided it.
       
 14591     // This enables us to pop only Fibers that provide unique contexts.
       
 14592 
       
 14593 
       
 14594     push(contextFiberStackCursor, fiber, fiber);
       
 14595     push(contextStackCursor$1, nextContext, fiber);
       
 14596   }
       
 14597 
       
 14598   function popHostContext(fiber) {
       
 14599     // Do not pop unless this Fiber provided the current context.
       
 14600     // pushHostContext() only pushes Fibers that provide unique contexts.
       
 14601     if (contextFiberStackCursor.current !== fiber) {
       
 14602       return;
       
 14603     }
       
 14604 
       
 14605     pop(contextStackCursor$1, fiber);
       
 14606     pop(contextFiberStackCursor, fiber);
       
 14607   }
       
 14608 
       
 14609   var DefaultSuspenseContext = 0; // The Suspense Context is split into two parts. The lower bits is
       
 14610   // inherited deeply down the subtree. The upper bits only affect
       
 14611   // this immediate suspense boundary and gets reset each new
       
 14612   // boundary or suspense list.
       
 14613 
       
 14614   var SubtreeSuspenseContextMask = 1; // Subtree Flags:
       
 14615   // InvisibleParentSuspenseContext indicates that one of our parent Suspense
       
 14616   // boundaries is not currently showing visible main content.
       
 14617   // Either because it is already showing a fallback or is not mounted at all.
       
 14618   // We can use this to determine if it is desirable to trigger a fallback at
       
 14619   // the parent. If not, then we might need to trigger undesirable boundaries
       
 14620   // and/or suspend the commit to avoid hiding the parent content.
       
 14621 
       
 14622   var InvisibleParentSuspenseContext = 1; // Shallow Flags:
       
 14623   // ForceSuspenseFallback can be used by SuspenseList to force newly added
       
 14624   // items into their fallback state during one of the render passes.
       
 14625 
       
 14626   var ForceSuspenseFallback = 2;
       
 14627   var suspenseStackCursor = createCursor(DefaultSuspenseContext);
       
 14628   function hasSuspenseContext(parentContext, flag) {
       
 14629     return (parentContext & flag) !== 0;
       
 14630   }
       
 14631   function setDefaultShallowSuspenseContext(parentContext) {
       
 14632     return parentContext & SubtreeSuspenseContextMask;
       
 14633   }
       
 14634   function setShallowSuspenseContext(parentContext, shallowContext) {
       
 14635     return parentContext & SubtreeSuspenseContextMask | shallowContext;
       
 14636   }
       
 14637   function addSubtreeSuspenseContext(parentContext, subtreeContext) {
       
 14638     return parentContext | subtreeContext;
       
 14639   }
       
 14640   function pushSuspenseContext(fiber, newContext) {
       
 14641     push(suspenseStackCursor, newContext, fiber);
       
 14642   }
       
 14643   function popSuspenseContext(fiber) {
       
 14644     pop(suspenseStackCursor, fiber);
       
 14645   }
       
 14646 
       
 14647   function shouldCaptureSuspense(workInProgress, hasInvisibleParent) {
       
 14648     // If it was the primary children that just suspended, capture and render the
       
 14649     // fallback. Otherwise, don't capture and bubble to the next boundary.
       
 14650     var nextState = workInProgress.memoizedState;
       
 14651 
       
 14652     if (nextState !== null) {
       
 14653       if (nextState.dehydrated !== null) {
       
 14654         // A dehydrated boundary always captures.
       
 14655         return true;
       
 14656       }
       
 14657 
       
 14658       return false;
       
 14659     }
       
 14660 
       
 14661     var props = workInProgress.memoizedProps; // In order to capture, the Suspense component must have a fallback prop.
       
 14662 
       
 14663     if (props.fallback === undefined) {
       
 14664       return false;
       
 14665     } // Regular boundaries always capture.
       
 14666 
       
 14667 
       
 14668     if (props.unstable_avoidThisFallback !== true) {
       
 14669       return true;
       
 14670     } // If it's a boundary we should avoid, then we prefer to bubble up to the
       
 14671     // parent boundary if it is currently invisible.
       
 14672 
       
 14673 
       
 14674     if (hasInvisibleParent) {
       
 14675       return false;
       
 14676     } // If the parent is not able to handle it, we must handle it.
       
 14677 
       
 14678 
       
 14679     return true;
       
 14680   }
       
 14681   function findFirstSuspended(row) {
       
 14682     var node = row;
       
 14683 
 11671     while (node !== null) {
 14684     while (node !== null) {
 11672       if (node.mode & StrictMode) {
 14685       if (node.tag === SuspenseComponent) {
 11673         maybeStrictRoot = node;
 14686         var state = node.memoizedState;
 11674       }
 14687 
 11675       node = node.return;
 14688         if (state !== null) {
 11676     }
 14689           var dehydrated = state.dehydrated;
 11677 
 14690 
 11678     return maybeStrictRoot;
 14691           if (dehydrated === null || isSuspenseInstancePending(dehydrated) || isSuspenseInstanceFallback(dehydrated)) {
 11679   };
 14692             return node;
 11680 
       
 11681   var setToSortedString = function (set) {
       
 11682     var array = [];
       
 11683     set.forEach(function (value) {
       
 11684       array.push(value);
       
 11685     });
       
 11686     return array.sort().join(', ');
       
 11687   };
       
 11688 
       
 11689   var pendingComponentWillMountWarnings = [];
       
 11690   var pendingUNSAFE_ComponentWillMountWarnings = [];
       
 11691   var pendingComponentWillReceivePropsWarnings = [];
       
 11692   var pendingUNSAFE_ComponentWillReceivePropsWarnings = [];
       
 11693   var pendingComponentWillUpdateWarnings = [];
       
 11694   var pendingUNSAFE_ComponentWillUpdateWarnings = [];
       
 11695 
       
 11696   // Tracks components we have already warned about.
       
 11697   var didWarnAboutUnsafeLifecycles = new Set();
       
 11698 
       
 11699   ReactStrictModeWarnings.recordUnsafeLifecycleWarnings = function (fiber, instance) {
       
 11700     // Dedup strategy: Warn once per component.
       
 11701     if (didWarnAboutUnsafeLifecycles.has(fiber.type)) {
       
 11702       return;
       
 11703     }
       
 11704 
       
 11705     if (typeof instance.componentWillMount === 'function' &&
       
 11706     // Don't warn about react-lifecycles-compat polyfilled components.
       
 11707     instance.componentWillMount.__suppressDeprecationWarning !== true) {
       
 11708       pendingComponentWillMountWarnings.push(fiber);
       
 11709     }
       
 11710 
       
 11711     if (fiber.mode & StrictMode && typeof instance.UNSAFE_componentWillMount === 'function') {
       
 11712       pendingUNSAFE_ComponentWillMountWarnings.push(fiber);
       
 11713     }
       
 11714 
       
 11715     if (typeof instance.componentWillReceiveProps === 'function' && instance.componentWillReceiveProps.__suppressDeprecationWarning !== true) {
       
 11716       pendingComponentWillReceivePropsWarnings.push(fiber);
       
 11717     }
       
 11718 
       
 11719     if (fiber.mode & StrictMode && typeof instance.UNSAFE_componentWillReceiveProps === 'function') {
       
 11720       pendingUNSAFE_ComponentWillReceivePropsWarnings.push(fiber);
       
 11721     }
       
 11722 
       
 11723     if (typeof instance.componentWillUpdate === 'function' && instance.componentWillUpdate.__suppressDeprecationWarning !== true) {
       
 11724       pendingComponentWillUpdateWarnings.push(fiber);
       
 11725     }
       
 11726 
       
 11727     if (fiber.mode & StrictMode && typeof instance.UNSAFE_componentWillUpdate === 'function') {
       
 11728       pendingUNSAFE_ComponentWillUpdateWarnings.push(fiber);
       
 11729     }
       
 11730   };
       
 11731 
       
 11732   ReactStrictModeWarnings.flushPendingUnsafeLifecycleWarnings = function () {
       
 11733     // We do an initial pass to gather component names
       
 11734     var componentWillMountUniqueNames = new Set();
       
 11735     if (pendingComponentWillMountWarnings.length > 0) {
       
 11736       pendingComponentWillMountWarnings.forEach(function (fiber) {
       
 11737         componentWillMountUniqueNames.add(getComponentName(fiber.type) || 'Component');
       
 11738         didWarnAboutUnsafeLifecycles.add(fiber.type);
       
 11739       });
       
 11740       pendingComponentWillMountWarnings = [];
       
 11741     }
       
 11742 
       
 11743     var UNSAFE_componentWillMountUniqueNames = new Set();
       
 11744     if (pendingUNSAFE_ComponentWillMountWarnings.length > 0) {
       
 11745       pendingUNSAFE_ComponentWillMountWarnings.forEach(function (fiber) {
       
 11746         UNSAFE_componentWillMountUniqueNames.add(getComponentName(fiber.type) || 'Component');
       
 11747         didWarnAboutUnsafeLifecycles.add(fiber.type);
       
 11748       });
       
 11749       pendingUNSAFE_ComponentWillMountWarnings = [];
       
 11750     }
       
 11751 
       
 11752     var componentWillReceivePropsUniqueNames = new Set();
       
 11753     if (pendingComponentWillReceivePropsWarnings.length > 0) {
       
 11754       pendingComponentWillReceivePropsWarnings.forEach(function (fiber) {
       
 11755         componentWillReceivePropsUniqueNames.add(getComponentName(fiber.type) || 'Component');
       
 11756         didWarnAboutUnsafeLifecycles.add(fiber.type);
       
 11757       });
       
 11758 
       
 11759       pendingComponentWillReceivePropsWarnings = [];
       
 11760     }
       
 11761 
       
 11762     var UNSAFE_componentWillReceivePropsUniqueNames = new Set();
       
 11763     if (pendingUNSAFE_ComponentWillReceivePropsWarnings.length > 0) {
       
 11764       pendingUNSAFE_ComponentWillReceivePropsWarnings.forEach(function (fiber) {
       
 11765         UNSAFE_componentWillReceivePropsUniqueNames.add(getComponentName(fiber.type) || 'Component');
       
 11766         didWarnAboutUnsafeLifecycles.add(fiber.type);
       
 11767       });
       
 11768 
       
 11769       pendingUNSAFE_ComponentWillReceivePropsWarnings = [];
       
 11770     }
       
 11771 
       
 11772     var componentWillUpdateUniqueNames = new Set();
       
 11773     if (pendingComponentWillUpdateWarnings.length > 0) {
       
 11774       pendingComponentWillUpdateWarnings.forEach(function (fiber) {
       
 11775         componentWillUpdateUniqueNames.add(getComponentName(fiber.type) || 'Component');
       
 11776         didWarnAboutUnsafeLifecycles.add(fiber.type);
       
 11777       });
       
 11778 
       
 11779       pendingComponentWillUpdateWarnings = [];
       
 11780     }
       
 11781 
       
 11782     var UNSAFE_componentWillUpdateUniqueNames = new Set();
       
 11783     if (pendingUNSAFE_ComponentWillUpdateWarnings.length > 0) {
       
 11784       pendingUNSAFE_ComponentWillUpdateWarnings.forEach(function (fiber) {
       
 11785         UNSAFE_componentWillUpdateUniqueNames.add(getComponentName(fiber.type) || 'Component');
       
 11786         didWarnAboutUnsafeLifecycles.add(fiber.type);
       
 11787       });
       
 11788 
       
 11789       pendingUNSAFE_ComponentWillUpdateWarnings = [];
       
 11790     }
       
 11791 
       
 11792     // Finally, we flush all the warnings
       
 11793     // UNSAFE_ ones before the deprecated ones, since they'll be 'louder'
       
 11794     if (UNSAFE_componentWillMountUniqueNames.size > 0) {
       
 11795       var sortedNames = setToSortedString(UNSAFE_componentWillMountUniqueNames);
       
 11796       warningWithoutStack$1(false, 'Using UNSAFE_componentWillMount in strict mode is not recommended and may indicate bugs in your code. ' + 'See https://fb.me/react-async-component-lifecycle-hooks for details.\n\n' + '* Move code with side effects to componentDidMount, and set initial state in the constructor.\n' + '\nPlease update the following components: %s', sortedNames);
       
 11797     }
       
 11798 
       
 11799     if (UNSAFE_componentWillReceivePropsUniqueNames.size > 0) {
       
 11800       var _sortedNames = setToSortedString(UNSAFE_componentWillReceivePropsUniqueNames);
       
 11801       warningWithoutStack$1(false, 'Using UNSAFE_componentWillReceiveProps in strict mode is not recommended ' + 'and may indicate bugs in your code. ' + 'See https://fb.me/react-async-component-lifecycle-hooks for details.\n\n' + '* Move data fetching code or side effects to componentDidUpdate.\n' + "* If you're updating state whenever props change, " + 'refactor your code to use memoization techniques or move it to ' + 'static getDerivedStateFromProps. Learn more at: https://fb.me/react-derived-state\n' + '\nPlease update the following components: %s', _sortedNames);
       
 11802     }
       
 11803 
       
 11804     if (UNSAFE_componentWillUpdateUniqueNames.size > 0) {
       
 11805       var _sortedNames2 = setToSortedString(UNSAFE_componentWillUpdateUniqueNames);
       
 11806       warningWithoutStack$1(false, 'Using UNSAFE_componentWillUpdate in strict mode is not recommended ' + 'and may indicate bugs in your code. ' + 'See https://fb.me/react-async-component-lifecycle-hooks for details.\n\n' + '* Move data fetching code or side effects to componentDidUpdate.\n' + '\nPlease update the following components: %s', _sortedNames2);
       
 11807     }
       
 11808 
       
 11809     if (componentWillMountUniqueNames.size > 0) {
       
 11810       var _sortedNames3 = setToSortedString(componentWillMountUniqueNames);
       
 11811 
       
 11812       lowPriorityWarning$1(false, 'componentWillMount has been renamed, and is not recommended for use. ' + 'See https://fb.me/react-async-component-lifecycle-hooks for details.\n\n' + '* Move code with side effects to componentDidMount, and set initial state in the constructor.\n' + '* Rename componentWillMount to UNSAFE_componentWillMount to suppress ' + 'this warning in non-strict mode. In React 17.x, only the UNSAFE_ name will work. ' + 'To rename all deprecated lifecycles to their new names, you can run ' + '`npx react-codemod rename-unsafe-lifecycles` in your project source folder.\n' + '\nPlease update the following components: %s', _sortedNames3);
       
 11813     }
       
 11814 
       
 11815     if (componentWillReceivePropsUniqueNames.size > 0) {
       
 11816       var _sortedNames4 = setToSortedString(componentWillReceivePropsUniqueNames);
       
 11817 
       
 11818       lowPriorityWarning$1(false, 'componentWillReceiveProps has been renamed, and is not recommended for use. ' + 'See https://fb.me/react-async-component-lifecycle-hooks for details.\n\n' + '* Move data fetching code or side effects to componentDidUpdate.\n' + "* If you're updating state whenever props change, refactor your " + 'code to use memoization techniques or move it to ' + 'static getDerivedStateFromProps. Learn more at: https://fb.me/react-derived-state\n' + '* Rename componentWillReceiveProps to UNSAFE_componentWillReceiveProps to suppress ' + 'this warning in non-strict mode. In React 17.x, only the UNSAFE_ name will work. ' + 'To rename all deprecated lifecycles to their new names, you can run ' + '`npx react-codemod rename-unsafe-lifecycles` in your project source folder.\n' + '\nPlease update the following components: %s', _sortedNames4);
       
 11819     }
       
 11820 
       
 11821     if (componentWillUpdateUniqueNames.size > 0) {
       
 11822       var _sortedNames5 = setToSortedString(componentWillUpdateUniqueNames);
       
 11823 
       
 11824       lowPriorityWarning$1(false, 'componentWillUpdate has been renamed, and is not recommended for use. ' + 'See https://fb.me/react-async-component-lifecycle-hooks for details.\n\n' + '* Move data fetching code or side effects to componentDidUpdate.\n' + '* Rename componentWillUpdate to UNSAFE_componentWillUpdate to suppress ' + 'this warning in non-strict mode. In React 17.x, only the UNSAFE_ name will work. ' + 'To rename all deprecated lifecycles to their new names, you can run ' + '`npx react-codemod rename-unsafe-lifecycles` in your project source folder.\n' + '\nPlease update the following components: %s', _sortedNames5);
       
 11825     }
       
 11826   };
       
 11827 
       
 11828   var pendingLegacyContextWarning = new Map();
       
 11829 
       
 11830   // Tracks components we have already warned about.
       
 11831   var didWarnAboutLegacyContext = new Set();
       
 11832 
       
 11833   ReactStrictModeWarnings.recordLegacyContextWarning = function (fiber, instance) {
       
 11834     var strictRoot = findStrictRoot(fiber);
       
 11835     if (strictRoot === null) {
       
 11836       warningWithoutStack$1(false, 'Expected to find a StrictMode component in a strict mode tree. ' + 'This error is likely caused by a bug in React. Please file an issue.');
       
 11837       return;
       
 11838     }
       
 11839 
       
 11840     // Dedup strategy: Warn once per component.
       
 11841     if (didWarnAboutLegacyContext.has(fiber.type)) {
       
 11842       return;
       
 11843     }
       
 11844 
       
 11845     var warningsForRoot = pendingLegacyContextWarning.get(strictRoot);
       
 11846 
       
 11847     if (fiber.type.contextTypes != null || fiber.type.childContextTypes != null || instance !== null && typeof instance.getChildContext === 'function') {
       
 11848       if (warningsForRoot === undefined) {
       
 11849         warningsForRoot = [];
       
 11850         pendingLegacyContextWarning.set(strictRoot, warningsForRoot);
       
 11851       }
       
 11852       warningsForRoot.push(fiber);
       
 11853     }
       
 11854   };
       
 11855 
       
 11856   ReactStrictModeWarnings.flushLegacyContextWarning = function () {
       
 11857     pendingLegacyContextWarning.forEach(function (fiberArray, strictRoot) {
       
 11858       var uniqueNames = new Set();
       
 11859       fiberArray.forEach(function (fiber) {
       
 11860         uniqueNames.add(getComponentName(fiber.type) || 'Component');
       
 11861         didWarnAboutLegacyContext.add(fiber.type);
       
 11862       });
       
 11863 
       
 11864       var sortedNames = setToSortedString(uniqueNames);
       
 11865       var strictRootComponentStack = getStackByFiberInDevAndProd(strictRoot);
       
 11866 
       
 11867       warningWithoutStack$1(false, 'Legacy context API has been detected within a strict-mode tree: %s' + '\n\nThe old API will be supported in all 16.x releases, but applications ' + 'using it should migrate to the new version.' + '\n\nPlease update the following components: %s' + '\n\nLearn more about this warning here:' + '\nhttps://fb.me/react-legacy-context', strictRootComponentStack, sortedNames);
       
 11868     });
       
 11869   };
       
 11870 
       
 11871   ReactStrictModeWarnings.discardPendingWarnings = function () {
       
 11872     pendingComponentWillMountWarnings = [];
       
 11873     pendingUNSAFE_ComponentWillMountWarnings = [];
       
 11874     pendingComponentWillReceivePropsWarnings = [];
       
 11875     pendingUNSAFE_ComponentWillReceivePropsWarnings = [];
       
 11876     pendingComponentWillUpdateWarnings = [];
       
 11877     pendingUNSAFE_ComponentWillUpdateWarnings = [];
       
 11878     pendingLegacyContextWarning = new Map();
       
 11879   };
       
 11880 }
       
 11881 
       
 11882 // Resolves type to a family.
       
 11883 
       
 11884 
       
 11885 // Used by React Refresh runtime through DevTools Global Hook.
       
 11886 
       
 11887 
       
 11888 var resolveFamily = null;
       
 11889 // $FlowFixMe Flow gets confused by a WeakSet feature check below.
       
 11890 var failedBoundaries = null;
       
 11891 
       
 11892 var setRefreshHandler = function (handler) {
       
 11893   {
       
 11894     resolveFamily = handler;
       
 11895   }
       
 11896 };
       
 11897 
       
 11898 function resolveFunctionForHotReloading(type) {
       
 11899   {
       
 11900     if (resolveFamily === null) {
       
 11901       // Hot reloading is disabled.
       
 11902       return type;
       
 11903     }
       
 11904     var family = resolveFamily(type);
       
 11905     if (family === undefined) {
       
 11906       return type;
       
 11907     }
       
 11908     // Use the latest known implementation.
       
 11909     return family.current;
       
 11910   }
       
 11911 }
       
 11912 
       
 11913 function resolveClassForHotReloading(type) {
       
 11914   // No implementation differences.
       
 11915   return resolveFunctionForHotReloading(type);
       
 11916 }
       
 11917 
       
 11918 function resolveForwardRefForHotReloading(type) {
       
 11919   {
       
 11920     if (resolveFamily === null) {
       
 11921       // Hot reloading is disabled.
       
 11922       return type;
       
 11923     }
       
 11924     var family = resolveFamily(type);
       
 11925     if (family === undefined) {
       
 11926       // Check if we're dealing with a real forwardRef. Don't want to crash early.
       
 11927       if (type !== null && type !== undefined && typeof type.render === 'function') {
       
 11928         // ForwardRef is special because its resolved .type is an object,
       
 11929         // but it's possible that we only have its inner render function in the map.
       
 11930         // If that inner render function is different, we'll build a new forwardRef type.
       
 11931         var currentRender = resolveFunctionForHotReloading(type.render);
       
 11932         if (type.render !== currentRender) {
       
 11933           var syntheticType = {
       
 11934             $$typeof: REACT_FORWARD_REF_TYPE,
       
 11935             render: currentRender
       
 11936           };
       
 11937           if (type.displayName !== undefined) {
       
 11938             syntheticType.displayName = type.displayName;
       
 11939           }
 14693           }
 11940           return syntheticType;
 14694         }
 11941         }
 14695       } else if (node.tag === SuspenseListComponent && // revealOrder undefined can't be trusted because it don't
 11942       }
 14696       // keep track of whether it suspended or not.
 11943       return type;
 14697       node.memoizedProps.revealOrder !== undefined) {
 11944     }
 14698         var didSuspend = (node.effectTag & DidCapture) !== NoEffect;
 11945     // Use the latest known implementation.
 14699 
 11946     return family.current;
 14700         if (didSuspend) {
 11947   }
 14701           return node;
 11948 }
 14702         }
 11949 
       
 11950 function isCompatibleFamilyForHotReloading(fiber, element) {
       
 11951   {
       
 11952     if (resolveFamily === null) {
       
 11953       // Hot reloading is disabled.
       
 11954       return false;
       
 11955     }
       
 11956 
       
 11957     var prevType = fiber.elementType;
       
 11958     var nextType = element.type;
       
 11959 
       
 11960     // If we got here, we know types aren't === equal.
       
 11961     var needsCompareFamilies = false;
       
 11962 
       
 11963     var $$typeofNextType = typeof nextType === 'object' && nextType !== null ? nextType.$$typeof : null;
       
 11964 
       
 11965     switch (fiber.tag) {
       
 11966       case ClassComponent:
       
 11967         {
       
 11968           if (typeof nextType === 'function') {
       
 11969             needsCompareFamilies = true;
       
 11970           }
       
 11971           break;
       
 11972         }
       
 11973       case FunctionComponent:
       
 11974         {
       
 11975           if (typeof nextType === 'function') {
       
 11976             needsCompareFamilies = true;
       
 11977           } else if ($$typeofNextType === REACT_LAZY_TYPE) {
       
 11978             // We don't know the inner type yet.
       
 11979             // We're going to assume that the lazy inner type is stable,
       
 11980             // and so it is sufficient to avoid reconciling it away.
       
 11981             // We're not going to unwrap or actually use the new lazy type.
       
 11982             needsCompareFamilies = true;
       
 11983           }
       
 11984           break;
       
 11985         }
       
 11986       case ForwardRef:
       
 11987         {
       
 11988           if ($$typeofNextType === REACT_FORWARD_REF_TYPE) {
       
 11989             needsCompareFamilies = true;
       
 11990           } else if ($$typeofNextType === REACT_LAZY_TYPE) {
       
 11991             needsCompareFamilies = true;
       
 11992           }
       
 11993           break;
       
 11994         }
       
 11995       case MemoComponent:
       
 11996       case SimpleMemoComponent:
       
 11997         {
       
 11998           if ($$typeofNextType === REACT_MEMO_TYPE) {
       
 11999             // TODO: if it was but can no longer be simple,
       
 12000             // we shouldn't set this.
       
 12001             needsCompareFamilies = true;
       
 12002           } else if ($$typeofNextType === REACT_LAZY_TYPE) {
       
 12003             needsCompareFamilies = true;
       
 12004           }
       
 12005           break;
       
 12006         }
       
 12007       default:
       
 12008         return false;
       
 12009     }
       
 12010 
       
 12011     // Check if both types have a family and it's the same one.
       
 12012     if (needsCompareFamilies) {
       
 12013       // Note: memo() and forwardRef() we'll compare outer rather than inner type.
       
 12014       // This means both of them need to be registered to preserve state.
       
 12015       // If we unwrapped and compared the inner types for wrappers instead,
       
 12016       // then we would risk falsely saying two separate memo(Foo)
       
 12017       // calls are equivalent because they wrap the same Foo function.
       
 12018       var prevFamily = resolveFamily(prevType);
       
 12019       if (prevFamily !== undefined && prevFamily === resolveFamily(nextType)) {
       
 12020         return true;
       
 12021       }
       
 12022     }
       
 12023     return false;
       
 12024   }
       
 12025 }
       
 12026 
       
 12027 function markFailedErrorBoundaryForHotReloading(fiber) {
       
 12028   {
       
 12029     if (resolveFamily === null) {
       
 12030       // Hot reloading is disabled.
       
 12031       return;
       
 12032     }
       
 12033     if (typeof WeakSet !== 'function') {
       
 12034       return;
       
 12035     }
       
 12036     if (failedBoundaries === null) {
       
 12037       failedBoundaries = new WeakSet();
       
 12038     }
       
 12039     failedBoundaries.add(fiber);
       
 12040   }
       
 12041 }
       
 12042 
       
 12043 var scheduleRefresh = function (root, update) {
       
 12044   {
       
 12045     if (resolveFamily === null) {
       
 12046       // Hot reloading is disabled.
       
 12047       return;
       
 12048     }
       
 12049     var _staleFamilies = update.staleFamilies,
       
 12050         _updatedFamilies = update.updatedFamilies;
       
 12051 
       
 12052     flushPassiveEffects();
       
 12053     flushSync(function () {
       
 12054       scheduleFibersWithFamiliesRecursively(root.current, _updatedFamilies, _staleFamilies);
       
 12055     });
       
 12056   }
       
 12057 };
       
 12058 
       
 12059 var scheduleRoot = function (root, element) {
       
 12060   {
       
 12061     if (root.context !== emptyContextObject) {
       
 12062       // Super edge case: root has a legacy _renderSubtree context
       
 12063       // but we don't know the parentComponent so we can't pass it.
       
 12064       // Just ignore. We'll delete this with _renderSubtree code path later.
       
 12065       return;
       
 12066     }
       
 12067     flushPassiveEffects();
       
 12068     updateContainerAtExpirationTime(element, root, null, Sync, null);
       
 12069   }
       
 12070 };
       
 12071 
       
 12072 function scheduleFibersWithFamiliesRecursively(fiber, updatedFamilies, staleFamilies) {
       
 12073   {
       
 12074     var alternate = fiber.alternate,
       
 12075         child = fiber.child,
       
 12076         sibling = fiber.sibling,
       
 12077         tag = fiber.tag,
       
 12078         type = fiber.type;
       
 12079 
       
 12080 
       
 12081     var candidateType = null;
       
 12082     switch (tag) {
       
 12083       case FunctionComponent:
       
 12084       case SimpleMemoComponent:
       
 12085       case ClassComponent:
       
 12086         candidateType = type;
       
 12087         break;
       
 12088       case ForwardRef:
       
 12089         candidateType = type.render;
       
 12090         break;
       
 12091       default:
       
 12092         break;
       
 12093     }
       
 12094 
       
 12095     if (resolveFamily === null) {
       
 12096       throw new Error('Expected resolveFamily to be set during hot reload.');
       
 12097     }
       
 12098 
       
 12099     var needsRender = false;
       
 12100     var needsRemount = false;
       
 12101     if (candidateType !== null) {
       
 12102       var family = resolveFamily(candidateType);
       
 12103       if (family !== undefined) {
       
 12104         if (staleFamilies.has(family)) {
       
 12105           needsRemount = true;
       
 12106         } else if (updatedFamilies.has(family)) {
       
 12107           needsRender = true;
       
 12108         }
       
 12109       }
       
 12110     }
       
 12111     if (failedBoundaries !== null) {
       
 12112       if (failedBoundaries.has(fiber) || alternate !== null && failedBoundaries.has(alternate)) {
       
 12113         needsRemount = true;
       
 12114       }
       
 12115     }
       
 12116 
       
 12117     if (needsRemount) {
       
 12118       fiber._debugNeedsRemount = true;
       
 12119     }
       
 12120     if (needsRemount || needsRender) {
       
 12121       scheduleWork(fiber, Sync);
       
 12122     }
       
 12123     if (child !== null && !needsRemount) {
       
 12124       scheduleFibersWithFamiliesRecursively(child, updatedFamilies, staleFamilies);
       
 12125     }
       
 12126     if (sibling !== null) {
       
 12127       scheduleFibersWithFamiliesRecursively(sibling, updatedFamilies, staleFamilies);
       
 12128     }
       
 12129   }
       
 12130 }
       
 12131 
       
 12132 var findHostInstancesForRefresh = function (root, families) {
       
 12133   {
       
 12134     var hostInstances = new Set();
       
 12135     var types = new Set(families.map(function (family) {
       
 12136       return family.current;
       
 12137     }));
       
 12138     findHostInstancesForMatchingFibersRecursively(root.current, types, hostInstances);
       
 12139     return hostInstances;
       
 12140   }
       
 12141 };
       
 12142 
       
 12143 function findHostInstancesForMatchingFibersRecursively(fiber, types, hostInstances) {
       
 12144   {
       
 12145     var child = fiber.child,
       
 12146         sibling = fiber.sibling,
       
 12147         tag = fiber.tag,
       
 12148         type = fiber.type;
       
 12149 
       
 12150 
       
 12151     var candidateType = null;
       
 12152     switch (tag) {
       
 12153       case FunctionComponent:
       
 12154       case SimpleMemoComponent:
       
 12155       case ClassComponent:
       
 12156         candidateType = type;
       
 12157         break;
       
 12158       case ForwardRef:
       
 12159         candidateType = type.render;
       
 12160         break;
       
 12161       default:
       
 12162         break;
       
 12163     }
       
 12164 
       
 12165     var didMatch = false;
       
 12166     if (candidateType !== null) {
       
 12167       if (types.has(candidateType)) {
       
 12168         didMatch = true;
       
 12169       }
       
 12170     }
       
 12171 
       
 12172     if (didMatch) {
       
 12173       // We have a match. This only drills down to the closest host components.
       
 12174       // There's no need to search deeper because for the purpose of giving
       
 12175       // visual feedback, "flashing" outermost parent rectangles is sufficient.
       
 12176       findHostInstancesForFiberShallowly(fiber, hostInstances);
       
 12177     } else {
       
 12178       // If there's no match, maybe there will be one further down in the child tree.
       
 12179       if (child !== null) {
       
 12180         findHostInstancesForMatchingFibersRecursively(child, types, hostInstances);
       
 12181       }
       
 12182     }
       
 12183 
       
 12184     if (sibling !== null) {
       
 12185       findHostInstancesForMatchingFibersRecursively(sibling, types, hostInstances);
       
 12186     }
       
 12187   }
       
 12188 }
       
 12189 
       
 12190 function findHostInstancesForFiberShallowly(fiber, hostInstances) {
       
 12191   {
       
 12192     var foundHostInstances = findChildHostInstancesForFiberShallowly(fiber, hostInstances);
       
 12193     if (foundHostInstances) {
       
 12194       return;
       
 12195     }
       
 12196     // If we didn't find any host children, fallback to closest host parent.
       
 12197     var node = fiber;
       
 12198     while (true) {
       
 12199       switch (node.tag) {
       
 12200         case HostComponent:
       
 12201           hostInstances.add(node.stateNode);
       
 12202           return;
       
 12203         case HostPortal:
       
 12204           hostInstances.add(node.stateNode.containerInfo);
       
 12205           return;
       
 12206         case HostRoot:
       
 12207           hostInstances.add(node.stateNode.containerInfo);
       
 12208           return;
       
 12209       }
       
 12210       if (node.return === null) {
       
 12211         throw new Error('Expected to reach root first.');
       
 12212       }
       
 12213       node = node.return;
       
 12214     }
       
 12215   }
       
 12216 }
       
 12217 
       
 12218 function findChildHostInstancesForFiberShallowly(fiber, hostInstances) {
       
 12219   {
       
 12220     var node = fiber;
       
 12221     var foundHostInstances = false;
       
 12222     while (true) {
       
 12223       if (node.tag === HostComponent) {
       
 12224         // We got a match.
       
 12225         foundHostInstances = true;
       
 12226         hostInstances.add(node.stateNode);
       
 12227         // There may still be more, so keep searching.
       
 12228       } else if (node.child !== null) {
 14703       } else if (node.child !== null) {
 12229         node.child.return = node;
 14704         node.child.return = node;
 12230         node = node.child;
 14705         node = node.child;
 12231         continue;
 14706         continue;
 12232       }
 14707       }
 12233       if (node === fiber) {
 14708 
 12234         return foundHostInstances;
 14709       if (node === row) {
 12235       }
 14710         return null;
       
 14711       }
       
 14712 
 12236       while (node.sibling === null) {
 14713       while (node.sibling === null) {
 12237         if (node.return === null || node.return === fiber) {
 14714         if (node.return === null || node.return === row) {
 12238           return foundHostInstances;
 14715           return null;
 12239         }
 14716         }
       
 14717 
 12240         node = node.return;
 14718         node = node.return;
 12241       }
 14719       }
       
 14720 
 12242       node.sibling.return = node.return;
 14721       node.sibling.return = node.return;
 12243       node = node.sibling;
 14722       node = node.sibling;
 12244     }
 14723     }
 12245   }
 14724 
 12246   return false;
 14725     return null;
 12247 }
 14726   }
 12248 
 14727 
 12249 function resolveDefaultProps(Component, baseProps) {
 14728   function createDeprecatedResponderListener(responder, props) {
 12250   if (Component && Component.defaultProps) {
 14729     var eventResponderListener = {
 12251     // Resolve default props. Taken from ReactElement
 14730       responder: responder,
 12252     var props = _assign({}, baseProps);
 14731       props: props
 12253     var defaultProps = Component.defaultProps;
 14732     };
 12254     for (var propName in defaultProps) {
 14733 
 12255       if (props[propName] === undefined) {
 14734     {
 12256         props[propName] = defaultProps[propName];
 14735       Object.freeze(eventResponderListener);
 12257       }
 14736     }
 12258     }
 14737 
 12259     return props;
 14738     return eventResponderListener;
 12260   }
 14739   }
 12261   return baseProps;
 14740 
 12262 }
 14741   var HasEffect =
 12263 
 14742   /* */
 12264 function readLazyComponentType(lazyComponent) {
 14743   1; // Represents the phase in which the effect (not the clean-up) fires.
 12265   var status = lazyComponent._status;
 14744 
 12266   var result = lazyComponent._result;
 14745   var Layout =
 12267   switch (status) {
 14746   /*    */
 12268     case Resolved:
 14747   2;
       
 14748   var Passive$1 =
       
 14749   /*   */
       
 14750   4;
       
 14751 
       
 14752   var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher,
       
 14753       ReactCurrentBatchConfig$1 = ReactSharedInternals.ReactCurrentBatchConfig;
       
 14754   var didWarnAboutMismatchedHooksForComponent;
       
 14755 
       
 14756   {
       
 14757     didWarnAboutMismatchedHooksForComponent = new Set();
       
 14758   }
       
 14759 
       
 14760   // These are set right before calling the component.
       
 14761   var renderExpirationTime = NoWork; // The work-in-progress fiber. I've named it differently to distinguish it from
       
 14762   // the work-in-progress hook.
       
 14763 
       
 14764   var currentlyRenderingFiber$1 = null; // Hooks are stored as a linked list on the fiber's memoizedState field. The
       
 14765   // current hook list is the list that belongs to the current fiber. The
       
 14766   // work-in-progress hook list is a new list that will be added to the
       
 14767   // work-in-progress fiber.
       
 14768 
       
 14769   var currentHook = null;
       
 14770   var workInProgressHook = null; // Whether an update was scheduled at any point during the render phase. This
       
 14771   // does not get reset if we do another render pass; only when we're completely
       
 14772   // finished evaluating this component. This is an optimization so we know
       
 14773   // whether we need to clear render phase updates after a throw.
       
 14774 
       
 14775   var didScheduleRenderPhaseUpdate = false;
       
 14776   var RE_RENDER_LIMIT = 25; // In DEV, this is the name of the currently executing primitive hook
       
 14777 
       
 14778   var currentHookNameInDev = null; // In DEV, this list ensures that hooks are called in the same order between renders.
       
 14779   // The list stores the order of hooks used during the initial render (mount).
       
 14780   // Subsequent renders (updates) reference this list.
       
 14781 
       
 14782   var hookTypesDev = null;
       
 14783   var hookTypesUpdateIndexDev = -1; // In DEV, this tracks whether currently rendering component needs to ignore
       
 14784   // the dependencies for Hooks that need them (e.g. useEffect or useMemo).
       
 14785   // When true, such Hooks will always be "remounted". Only used during hot reload.
       
 14786 
       
 14787   var ignorePreviousDependencies = false;
       
 14788 
       
 14789   function mountHookTypesDev() {
       
 14790     {
       
 14791       var hookName = currentHookNameInDev;
       
 14792 
       
 14793       if (hookTypesDev === null) {
       
 14794         hookTypesDev = [hookName];
       
 14795       } else {
       
 14796         hookTypesDev.push(hookName);
       
 14797       }
       
 14798     }
       
 14799   }
       
 14800 
       
 14801   function updateHookTypesDev() {
       
 14802     {
       
 14803       var hookName = currentHookNameInDev;
       
 14804 
       
 14805       if (hookTypesDev !== null) {
       
 14806         hookTypesUpdateIndexDev++;
       
 14807 
       
 14808         if (hookTypesDev[hookTypesUpdateIndexDev] !== hookName) {
       
 14809           warnOnHookMismatchInDev(hookName);
       
 14810         }
       
 14811       }
       
 14812     }
       
 14813   }
       
 14814 
       
 14815   function checkDepsAreArrayDev(deps) {
       
 14816     {
       
 14817       if (deps !== undefined && deps !== null && !Array.isArray(deps)) {
       
 14818         // Verify deps, but only on mount to avoid extra checks.
       
 14819         // It's unlikely their type would change as usually you define them inline.
       
 14820         error('%s received a final argument that is not an array (instead, received `%s`). When ' + 'specified, the final argument must be an array.', currentHookNameInDev, typeof deps);
       
 14821       }
       
 14822     }
       
 14823   }
       
 14824 
       
 14825   function warnOnHookMismatchInDev(currentHookName) {
       
 14826     {
       
 14827       var componentName = getComponentName(currentlyRenderingFiber$1.type);
       
 14828 
       
 14829       if (!didWarnAboutMismatchedHooksForComponent.has(componentName)) {
       
 14830         didWarnAboutMismatchedHooksForComponent.add(componentName);
       
 14831 
       
 14832         if (hookTypesDev !== null) {
       
 14833           var table = '';
       
 14834           var secondColumnStart = 30;
       
 14835 
       
 14836           for (var i = 0; i <= hookTypesUpdateIndexDev; i++) {
       
 14837             var oldHookName = hookTypesDev[i];
       
 14838             var newHookName = i === hookTypesUpdateIndexDev ? currentHookName : oldHookName;
       
 14839             var row = i + 1 + ". " + oldHookName; // Extra space so second column lines up
       
 14840             // lol @ IE not supporting String#repeat
       
 14841 
       
 14842             while (row.length < secondColumnStart) {
       
 14843               row += ' ';
       
 14844             }
       
 14845 
       
 14846             row += newHookName + '\n';
       
 14847             table += row;
       
 14848           }
       
 14849 
       
 14850           error('React has detected a change in the order of Hooks called by %s. ' + 'This will lead to bugs and errors if not fixed. ' + 'For more information, read the Rules of Hooks: https://fb.me/rules-of-hooks\n\n' + '   Previous render            Next render\n' + '   ------------------------------------------------------\n' + '%s' + '   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n', componentName, table);
       
 14851         }
       
 14852       }
       
 14853     }
       
 14854   }
       
 14855 
       
 14856   function throwInvalidHookError() {
       
 14857     {
 12269       {
 14858       {
 12270         var Component = result;
 14859         throw Error( "Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://fb.me/react-invalid-hook-call for tips about how to debug and fix this problem." );
 12271         return Component;
 14860       }
 12272       }
 14861     }
 12273     case Rejected:
 14862   }
       
 14863 
       
 14864   function areHookInputsEqual(nextDeps, prevDeps) {
       
 14865     {
       
 14866       if (ignorePreviousDependencies) {
       
 14867         // Only true when this component is being hot reloaded.
       
 14868         return false;
       
 14869       }
       
 14870     }
       
 14871 
       
 14872     if (prevDeps === null) {
 12274       {
 14873       {
 12275         var error = result;
 14874         error('%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);
 12276         throw error;
 14875       }
 12277       }
 14876 
 12278     case Pending:
 14877       return false;
       
 14878     }
       
 14879 
       
 14880     {
       
 14881       // Don't bother comparing lengths in prod because these arrays should be
       
 14882       // passed inline.
       
 14883       if (nextDeps.length !== prevDeps.length) {
       
 14884         error('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, "[" + prevDeps.join(', ') + "]", "[" + nextDeps.join(', ') + "]");
       
 14885       }
       
 14886     }
       
 14887 
       
 14888     for (var i = 0; i < prevDeps.length && i < nextDeps.length; i++) {
       
 14889       if (objectIs(nextDeps[i], prevDeps[i])) {
       
 14890         continue;
       
 14891       }
       
 14892 
       
 14893       return false;
       
 14894     }
       
 14895 
       
 14896     return true;
       
 14897   }
       
 14898 
       
 14899   function renderWithHooks(current, workInProgress, Component, props, secondArg, nextRenderExpirationTime) {
       
 14900     renderExpirationTime = nextRenderExpirationTime;
       
 14901     currentlyRenderingFiber$1 = workInProgress;
       
 14902 
       
 14903     {
       
 14904       hookTypesDev = current !== null ? current._debugHookTypes : null;
       
 14905       hookTypesUpdateIndexDev = -1; // Used for hot reloading:
       
 14906 
       
 14907       ignorePreviousDependencies = current !== null && current.type !== workInProgress.type;
       
 14908     }
       
 14909 
       
 14910     workInProgress.memoizedState = null;
       
 14911     workInProgress.updateQueue = null;
       
 14912     workInProgress.expirationTime = NoWork; // The following should have already been reset
       
 14913     // currentHook = null;
       
 14914     // workInProgressHook = null;
       
 14915     // didScheduleRenderPhaseUpdate = false;
       
 14916     // TODO Warn if no hooks are used at all during mount, then some are used during update.
       
 14917     // Currently we will identify the update render as a mount because memoizedState === null.
       
 14918     // This is tricky because it's valid for certain types of components (e.g. React.lazy)
       
 14919     // Using memoizedState to differentiate between mount/update only works if at least one stateful hook is used.
       
 14920     // Non-stateful hooks (e.g. context) don't get added to memoizedState,
       
 14921     // so memoizedState would be null during updates and mounts.
       
 14922 
       
 14923     {
       
 14924       if (current !== null && current.memoizedState !== null) {
       
 14925         ReactCurrentDispatcher.current = HooksDispatcherOnUpdateInDEV;
       
 14926       } else if (hookTypesDev !== null) {
       
 14927         // This dispatcher handles an edge case where a component is updating,
       
 14928         // but no stateful hooks have been used.
       
 14929         // We want to match the production code behavior (which will use HooksDispatcherOnMount),
       
 14930         // but with the extra DEV validation to ensure hooks ordering hasn't changed.
       
 14931         // This dispatcher does that.
       
 14932         ReactCurrentDispatcher.current = HooksDispatcherOnMountWithHookTypesInDEV;
       
 14933       } else {
       
 14934         ReactCurrentDispatcher.current = HooksDispatcherOnMountInDEV;
       
 14935       }
       
 14936     }
       
 14937 
       
 14938     var children = Component(props, secondArg); // Check if there was a render phase update
       
 14939 
       
 14940     if (workInProgress.expirationTime === renderExpirationTime) {
       
 14941       // Keep rendering in a loop for as long as render phase updates continue to
       
 14942       // be scheduled. Use a counter to prevent infinite loops.
       
 14943       var numberOfReRenders = 0;
       
 14944 
       
 14945       do {
       
 14946         workInProgress.expirationTime = NoWork;
       
 14947 
       
 14948         if (!(numberOfReRenders < RE_RENDER_LIMIT)) {
       
 14949           {
       
 14950             throw Error( "Too many re-renders. React limits the number of renders to prevent an infinite loop." );
       
 14951           }
       
 14952         }
       
 14953 
       
 14954         numberOfReRenders += 1;
       
 14955 
       
 14956         {
       
 14957           // Even when hot reloading, allow dependencies to stabilize
       
 14958           // after first render to prevent infinite render phase updates.
       
 14959           ignorePreviousDependencies = false;
       
 14960         } // Start over from the beginning of the list
       
 14961 
       
 14962 
       
 14963         currentHook = null;
       
 14964         workInProgressHook = null;
       
 14965         workInProgress.updateQueue = null;
       
 14966 
       
 14967         {
       
 14968           // Also validate hook order for cascading updates.
       
 14969           hookTypesUpdateIndexDev = -1;
       
 14970         }
       
 14971 
       
 14972         ReactCurrentDispatcher.current =  HooksDispatcherOnRerenderInDEV ;
       
 14973         children = Component(props, secondArg);
       
 14974       } while (workInProgress.expirationTime === renderExpirationTime);
       
 14975     } // We can assume the previous dispatcher is always this one, since we set it
       
 14976     // at the beginning of the render phase and there's no re-entrancy.
       
 14977 
       
 14978 
       
 14979     ReactCurrentDispatcher.current = ContextOnlyDispatcher;
       
 14980 
       
 14981     {
       
 14982       workInProgress._debugHookTypes = hookTypesDev;
       
 14983     } // This check uses currentHook so that it works the same in DEV and prod bundles.
       
 14984     // hookTypesDev could catch more cases (e.g. context) but only in DEV bundles.
       
 14985 
       
 14986 
       
 14987     var didRenderTooFewHooks = currentHook !== null && currentHook.next !== null;
       
 14988     renderExpirationTime = NoWork;
       
 14989     currentlyRenderingFiber$1 = null;
       
 14990     currentHook = null;
       
 14991     workInProgressHook = null;
       
 14992 
       
 14993     {
       
 14994       currentHookNameInDev = null;
       
 14995       hookTypesDev = null;
       
 14996       hookTypesUpdateIndexDev = -1;
       
 14997     }
       
 14998 
       
 14999     didScheduleRenderPhaseUpdate = false;
       
 15000 
       
 15001     if (!!didRenderTooFewHooks) {
 12279       {
 15002       {
 12280         var thenable = result;
 15003         throw Error( "Rendered fewer hooks than expected. This may be caused by an accidental early return statement." );
 12281         throw thenable;
 15004       }
 12282       }
 15005     }
 12283     default:
 15006 
 12284       {
 15007     return children;
 12285         lazyComponent._status = Pending;
 15008   }
 12286         var ctor = lazyComponent._ctor;
 15009   function bailoutHooks(current, workInProgress, expirationTime) {
 12287         var _thenable = ctor();
 15010     workInProgress.updateQueue = current.updateQueue;
 12288         _thenable.then(function (moduleObject) {
 15011     workInProgress.effectTag &= ~(Passive | Update);
 12289           if (lazyComponent._status === Pending) {
 15012 
 12290             var defaultExport = moduleObject.default;
 15013     if (current.expirationTime <= expirationTime) {
 12291             {
 15014       current.expirationTime = NoWork;
 12292               if (defaultExport === undefined) {
 15015     }
 12293                 warning$1(false, 'lazy: Expected the result of a dynamic import() call. ' + 'Instead received: %s\n\nYour code should look like: \n  ' + "const MyComponent = lazy(() => import('./MyComponent'))", moduleObject);
 15016   }
 12294               }
 15017   function resetHooksAfterThrow() {
 12295             }
 15018     // We can assume the previous dispatcher is always this one, since we set it
 12296             lazyComponent._status = Resolved;
 15019     // at the beginning of the render phase and there's no re-entrancy.
 12297             lazyComponent._result = defaultExport;
 15020     ReactCurrentDispatcher.current = ContextOnlyDispatcher;
 12298           }
 15021 
 12299         }, function (error) {
 15022     if (didScheduleRenderPhaseUpdate) {
 12300           if (lazyComponent._status === Pending) {
 15023       // There were render phase updates. These are only valid for this render
 12301             lazyComponent._status = Rejected;
 15024       // phase, which we are now aborting. Remove the updates from the queues so
 12302             lazyComponent._result = error;
 15025       // they do not persist to the next render. Do not remove updates from hooks
 12303           }
 15026       // that weren't processed.
 12304         });
 15027       //
 12305         // Handle synchronous thenables.
 15028       // Only reset the updates from the queue if it has a clone. If it does
 12306         switch (lazyComponent._status) {
 15029       // not have a clone, that means it wasn't processed, and the updates were
 12307           case Resolved:
 15030       // scheduled before we entered the render phase.
 12308             return lazyComponent._result;
 15031       var hook = currentlyRenderingFiber$1.memoizedState;
 12309           case Rejected:
 15032 
 12310             throw lazyComponent._result;
 15033       while (hook !== null) {
 12311         }
 15034         var queue = hook.queue;
 12312         lazyComponent._result = _thenable;
 15035 
 12313         throw _thenable;
 15036         if (queue !== null) {
 12314       }
 15037           queue.pending = null;
 12315   }
 15038         }
 12316 }
 15039 
 12317 
 15040         hook = hook.next;
 12318 var valueCursor = createCursor(null);
 15041       }
 12319 
 15042     }
 12320 var rendererSigil = void 0;
 15043 
 12321 {
 15044     renderExpirationTime = NoWork;
 12322   // Use this to detect multiple renderers using the same context
 15045     currentlyRenderingFiber$1 = null;
 12323   rendererSigil = {};
 15046     currentHook = null;
 12324 }
 15047     workInProgressHook = null;
 12325 
 15048 
 12326 var currentlyRenderingFiber = null;
       
 12327 var lastContextDependency = null;
       
 12328 var lastContextWithAllBitsObserved = null;
       
 12329 
       
 12330 var isDisallowedContextReadInDEV = false;
       
 12331 
       
 12332 function resetContextDependencies() {
       
 12333   // This is called right before React yields execution, to ensure `readContext`
       
 12334   // cannot be called outside the render phase.
       
 12335   currentlyRenderingFiber = null;
       
 12336   lastContextDependency = null;
       
 12337   lastContextWithAllBitsObserved = null;
       
 12338   {
       
 12339     isDisallowedContextReadInDEV = false;
       
 12340   }
       
 12341 }
       
 12342 
       
 12343 function enterDisallowedContextReadInDEV() {
       
 12344   {
       
 12345     isDisallowedContextReadInDEV = true;
       
 12346   }
       
 12347 }
       
 12348 
       
 12349 function exitDisallowedContextReadInDEV() {
       
 12350   {
       
 12351     isDisallowedContextReadInDEV = false;
       
 12352   }
       
 12353 }
       
 12354 
       
 12355 function pushProvider(providerFiber, nextValue) {
       
 12356   var context = providerFiber.type._context;
       
 12357 
       
 12358   if (isPrimaryRenderer) {
       
 12359     push(valueCursor, context._currentValue, providerFiber);
       
 12360 
       
 12361     context._currentValue = nextValue;
       
 12362     {
 15049     {
 12363       !(context._currentRenderer === undefined || context._currentRenderer === null || context._currentRenderer === rendererSigil) ? warningWithoutStack$1(false, 'Detected multiple renderers concurrently rendering the ' + 'same context provider. This is currently unsupported.') : void 0;
 15050       hookTypesDev = null;
 12364       context._currentRenderer = rendererSigil;
 15051       hookTypesUpdateIndexDev = -1;
 12365     }
 15052       currentHookNameInDev = null;
 12366   } else {
 15053     }
 12367     push(valueCursor, context._currentValue2, providerFiber);
 15054 
 12368 
 15055     didScheduleRenderPhaseUpdate = false;
 12369     context._currentValue2 = nextValue;
 15056   }
 12370     {
 15057 
 12371       !(context._currentRenderer2 === undefined || context._currentRenderer2 === null || context._currentRenderer2 === rendererSigil) ? warningWithoutStack$1(false, 'Detected multiple renderers concurrently rendering the ' + 'same context provider. This is currently unsupported.') : void 0;
 15058   function mountWorkInProgressHook() {
 12372       context._currentRenderer2 = rendererSigil;
 15059     var hook = {
 12373     }
 15060       memoizedState: null,
 12374   }
 15061       baseState: null,
 12375 }
 15062       baseQueue: null,
 12376 
 15063       queue: null,
 12377 function popProvider(providerFiber) {
       
 12378   var currentValue = valueCursor.current;
       
 12379 
       
 12380   pop(valueCursor, providerFiber);
       
 12381 
       
 12382   var context = providerFiber.type._context;
       
 12383   if (isPrimaryRenderer) {
       
 12384     context._currentValue = currentValue;
       
 12385   } else {
       
 12386     context._currentValue2 = currentValue;
       
 12387   }
       
 12388 }
       
 12389 
       
 12390 function calculateChangedBits(context, newValue, oldValue) {
       
 12391   if (is(oldValue, newValue)) {
       
 12392     // No change
       
 12393     return 0;
       
 12394   } else {
       
 12395     var changedBits = typeof context._calculateChangedBits === 'function' ? context._calculateChangedBits(oldValue, newValue) : MAX_SIGNED_31_BIT_INT;
       
 12396 
       
 12397     {
       
 12398       !((changedBits & MAX_SIGNED_31_BIT_INT) === changedBits) ? warning$1(false, 'calculateChangedBits: Expected the return value to be a ' + '31-bit integer. Instead received: %s', changedBits) : void 0;
       
 12399     }
       
 12400     return changedBits | 0;
       
 12401   }
       
 12402 }
       
 12403 
       
 12404 function scheduleWorkOnParentPath(parent, renderExpirationTime) {
       
 12405   // Update the child expiration time of all the ancestors, including
       
 12406   // the alternates.
       
 12407   var node = parent;
       
 12408   while (node !== null) {
       
 12409     var alternate = node.alternate;
       
 12410     if (node.childExpirationTime < renderExpirationTime) {
       
 12411       node.childExpirationTime = renderExpirationTime;
       
 12412       if (alternate !== null && alternate.childExpirationTime < renderExpirationTime) {
       
 12413         alternate.childExpirationTime = renderExpirationTime;
       
 12414       }
       
 12415     } else if (alternate !== null && alternate.childExpirationTime < renderExpirationTime) {
       
 12416       alternate.childExpirationTime = renderExpirationTime;
       
 12417     } else {
       
 12418       // Neither alternate was updated, which means the rest of the
       
 12419       // ancestor path already has sufficient priority.
       
 12420       break;
       
 12421     }
       
 12422     node = node.return;
       
 12423   }
       
 12424 }
       
 12425 
       
 12426 function propagateContextChange(workInProgress, context, changedBits, renderExpirationTime) {
       
 12427   var fiber = workInProgress.child;
       
 12428   if (fiber !== null) {
       
 12429     // Set the return pointer of the child to the work-in-progress fiber.
       
 12430     fiber.return = workInProgress;
       
 12431   }
       
 12432   while (fiber !== null) {
       
 12433     var nextFiber = void 0;
       
 12434 
       
 12435     // Visit this fiber.
       
 12436     var list = fiber.dependencies;
       
 12437     if (list !== null) {
       
 12438       nextFiber = fiber.child;
       
 12439 
       
 12440       var dependency = list.firstContext;
       
 12441       while (dependency !== null) {
       
 12442         // Check if the context matches.
       
 12443         if (dependency.context === context && (dependency.observedBits & changedBits) !== 0) {
       
 12444           // Match! Schedule an update on this fiber.
       
 12445 
       
 12446           if (fiber.tag === ClassComponent) {
       
 12447             // Schedule a force update on the work-in-progress.
       
 12448             var update = createUpdate(renderExpirationTime, null);
       
 12449             update.tag = ForceUpdate;
       
 12450             // TODO: Because we don't have a work-in-progress, this will add the
       
 12451             // update to the current fiber, too, which means it will persist even if
       
 12452             // this render is thrown away. Since it's a race condition, not sure it's
       
 12453             // worth fixing.
       
 12454             enqueueUpdate(fiber, update);
       
 12455           }
       
 12456 
       
 12457           if (fiber.expirationTime < renderExpirationTime) {
       
 12458             fiber.expirationTime = renderExpirationTime;
       
 12459           }
       
 12460           var alternate = fiber.alternate;
       
 12461           if (alternate !== null && alternate.expirationTime < renderExpirationTime) {
       
 12462             alternate.expirationTime = renderExpirationTime;
       
 12463           }
       
 12464 
       
 12465           scheduleWorkOnParentPath(fiber.return, renderExpirationTime);
       
 12466 
       
 12467           // Mark the expiration time on the list, too.
       
 12468           if (list.expirationTime < renderExpirationTime) {
       
 12469             list.expirationTime = renderExpirationTime;
       
 12470           }
       
 12471 
       
 12472           // Since we already found a match, we can stop traversing the
       
 12473           // dependency list.
       
 12474           break;
       
 12475         }
       
 12476         dependency = dependency.next;
       
 12477       }
       
 12478     } else if (fiber.tag === ContextProvider) {
       
 12479       // Don't scan deeper if this is a matching provider
       
 12480       nextFiber = fiber.type === workInProgress.type ? null : fiber.child;
       
 12481     } else if (enableSuspenseServerRenderer && fiber.tag === DehydratedSuspenseComponent) {
       
 12482       // If a dehydrated suspense component is in this subtree, we don't know
       
 12483       // if it will have any context consumers in it. The best we can do is
       
 12484       // mark it as having updates on its children.
       
 12485       if (fiber.expirationTime < renderExpirationTime) {
       
 12486         fiber.expirationTime = renderExpirationTime;
       
 12487       }
       
 12488       var _alternate = fiber.alternate;
       
 12489       if (_alternate !== null && _alternate.expirationTime < renderExpirationTime) {
       
 12490         _alternate.expirationTime = renderExpirationTime;
       
 12491       }
       
 12492       // This is intentionally passing this fiber as the parent
       
 12493       // because we want to schedule this fiber as having work
       
 12494       // on its children. We'll use the childExpirationTime on
       
 12495       // this fiber to indicate that a context has changed.
       
 12496       scheduleWorkOnParentPath(fiber, renderExpirationTime);
       
 12497       nextFiber = fiber.sibling;
       
 12498     } else {
       
 12499       // Traverse down.
       
 12500       nextFiber = fiber.child;
       
 12501     }
       
 12502 
       
 12503     if (nextFiber !== null) {
       
 12504       // Set the return pointer of the child to the work-in-progress fiber.
       
 12505       nextFiber.return = fiber;
       
 12506     } else {
       
 12507       // No child. Traverse to next sibling.
       
 12508       nextFiber = fiber;
       
 12509       while (nextFiber !== null) {
       
 12510         if (nextFiber === workInProgress) {
       
 12511           // We're back to the root of this subtree. Exit.
       
 12512           nextFiber = null;
       
 12513           break;
       
 12514         }
       
 12515         var sibling = nextFiber.sibling;
       
 12516         if (sibling !== null) {
       
 12517           // Set the return pointer of the sibling to the work-in-progress fiber.
       
 12518           sibling.return = nextFiber.return;
       
 12519           nextFiber = sibling;
       
 12520           break;
       
 12521         }
       
 12522         // No more siblings. Traverse up.
       
 12523         nextFiber = nextFiber.return;
       
 12524       }
       
 12525     }
       
 12526     fiber = nextFiber;
       
 12527   }
       
 12528 }
       
 12529 
       
 12530 function prepareToReadContext(workInProgress, renderExpirationTime) {
       
 12531   currentlyRenderingFiber = workInProgress;
       
 12532   lastContextDependency = null;
       
 12533   lastContextWithAllBitsObserved = null;
       
 12534 
       
 12535   var dependencies = workInProgress.dependencies;
       
 12536   if (dependencies !== null) {
       
 12537     var firstContext = dependencies.firstContext;
       
 12538     if (firstContext !== null) {
       
 12539       if (dependencies.expirationTime >= renderExpirationTime) {
       
 12540         // Context list has a pending update. Mark that this fiber performed work.
       
 12541         markWorkInProgressReceivedUpdate();
       
 12542       }
       
 12543       // Reset the work-in-progress list
       
 12544       dependencies.firstContext = null;
       
 12545     }
       
 12546   }
       
 12547 }
       
 12548 
       
 12549 function readContext(context, observedBits) {
       
 12550   {
       
 12551     // This warning would fire if you read context inside a Hook like useMemo.
       
 12552     // Unlike the class check below, it's not enforced in production for perf.
       
 12553     !!isDisallowedContextReadInDEV ? warning$1(false, 'Context can only be read while React is rendering. ' + 'In classes, you can read it in the render method or getDerivedStateFromProps. ' + 'In function components, you can read it directly in the function body, but not ' + 'inside Hooks like useReducer() or useMemo().') : void 0;
       
 12554   }
       
 12555 
       
 12556   if (lastContextWithAllBitsObserved === context) {
       
 12557     // Nothing to do. We already observe everything in this context.
       
 12558   } else if (observedBits === false || observedBits === 0) {
       
 12559     // Do not observe any updates.
       
 12560   } else {
       
 12561     var resolvedObservedBits = void 0; // Avoid deopting on observable arguments or heterogeneous types.
       
 12562     if (typeof observedBits !== 'number' || observedBits === MAX_SIGNED_31_BIT_INT) {
       
 12563       // Observe all updates.
       
 12564       lastContextWithAllBitsObserved = context;
       
 12565       resolvedObservedBits = MAX_SIGNED_31_BIT_INT;
       
 12566     } else {
       
 12567       resolvedObservedBits = observedBits;
       
 12568     }
       
 12569 
       
 12570     var contextItem = {
       
 12571       context: context,
       
 12572       observedBits: resolvedObservedBits,
       
 12573       next: null
 15064       next: null
 12574     };
 15065     };
 12575 
 15066 
 12576     if (lastContextDependency === null) {
 15067     if (workInProgressHook === null) {
 12577       (function () {
 15068       // This is the first hook in the list
 12578         if (!(currentlyRenderingFiber !== null)) {
 15069       currentlyRenderingFiber$1.memoizedState = workInProgressHook = hook;
 12579           {
 15070     } else {
 12580             throw ReactError(Error('Context can only be read while React is rendering. In classes, you can read it in the render method or getDerivedStateFromProps. In function components, you can read it directly in the function body, but not inside Hooks like useReducer() or useMemo().'));
 15071       // Append to the end of the list
 12581           }
 15072       workInProgressHook = workInProgressHook.next = hook;
 12582         }
 15073     }
 12583       })();
 15074 
 12584 
 15075     return workInProgressHook;
 12585       // This is the first dependency for this component. Create a new list.
 15076   }
 12586       lastContextDependency = contextItem;
 15077 
 12587       currentlyRenderingFiber.dependencies = {
 15078   function updateWorkInProgressHook() {
 12588         expirationTime: NoWork,
 15079     // This function is used both for updates and for re-renders triggered by a
 12589         firstContext: contextItem,
 15080     // render phase update. It assumes there is either a current hook we can
 12590         responders: null
 15081     // clone, or a work-in-progress hook from a previous render pass that we can
       
 15082     // use as a base. When we reach the end of the base list, we must switch to
       
 15083     // the dispatcher used for mounts.
       
 15084     var nextCurrentHook;
       
 15085 
       
 15086     if (currentHook === null) {
       
 15087       var current = currentlyRenderingFiber$1.alternate;
       
 15088 
       
 15089       if (current !== null) {
       
 15090         nextCurrentHook = current.memoizedState;
       
 15091       } else {
       
 15092         nextCurrentHook = null;
       
 15093       }
       
 15094     } else {
       
 15095       nextCurrentHook = currentHook.next;
       
 15096     }
       
 15097 
       
 15098     var nextWorkInProgressHook;
       
 15099 
       
 15100     if (workInProgressHook === null) {
       
 15101       nextWorkInProgressHook = currentlyRenderingFiber$1.memoizedState;
       
 15102     } else {
       
 15103       nextWorkInProgressHook = workInProgressHook.next;
       
 15104     }
       
 15105 
       
 15106     if (nextWorkInProgressHook !== null) {
       
 15107       // There's already a work-in-progress. Reuse it.
       
 15108       workInProgressHook = nextWorkInProgressHook;
       
 15109       nextWorkInProgressHook = workInProgressHook.next;
       
 15110       currentHook = nextCurrentHook;
       
 15111     } else {
       
 15112       // Clone from the current hook.
       
 15113       if (!(nextCurrentHook !== null)) {
       
 15114         {
       
 15115           throw Error( "Rendered more hooks than during the previous render." );
       
 15116         }
       
 15117       }
       
 15118 
       
 15119       currentHook = nextCurrentHook;
       
 15120       var newHook = {
       
 15121         memoizedState: currentHook.memoizedState,
       
 15122         baseState: currentHook.baseState,
       
 15123         baseQueue: currentHook.baseQueue,
       
 15124         queue: currentHook.queue,
       
 15125         next: null
 12591       };
 15126       };
       
 15127 
       
 15128       if (workInProgressHook === null) {
       
 15129         // This is the first hook in the list.
       
 15130         currentlyRenderingFiber$1.memoizedState = workInProgressHook = newHook;
       
 15131       } else {
       
 15132         // Append to the end of the list.
       
 15133         workInProgressHook = workInProgressHook.next = newHook;
       
 15134       }
       
 15135     }
       
 15136 
       
 15137     return workInProgressHook;
       
 15138   }
       
 15139 
       
 15140   function createFunctionComponentUpdateQueue() {
       
 15141     return {
       
 15142       lastEffect: null
       
 15143     };
       
 15144   }
       
 15145 
       
 15146   function basicStateReducer(state, action) {
       
 15147     // $FlowFixMe: Flow doesn't like mixed types
       
 15148     return typeof action === 'function' ? action(state) : action;
       
 15149   }
       
 15150 
       
 15151   function mountReducer(reducer, initialArg, init) {
       
 15152     var hook = mountWorkInProgressHook();
       
 15153     var initialState;
       
 15154 
       
 15155     if (init !== undefined) {
       
 15156       initialState = init(initialArg);
 12592     } else {
 15157     } else {
 12593       // Append a new context item.
 15158       initialState = initialArg;
 12594       lastContextDependency = lastContextDependency.next = contextItem;
 15159     }
 12595     }
 15160 
 12596   }
 15161     hook.memoizedState = hook.baseState = initialState;
 12597   return isPrimaryRenderer ? context._currentValue : context._currentValue2;
 15162     var queue = hook.queue = {
 12598 }
 15163       pending: null,
 12599 
 15164       dispatch: null,
 12600 // UpdateQueue is a linked list of prioritized updates.
 15165       lastRenderedReducer: reducer,
 12601 //
 15166       lastRenderedState: initialState
 12602 // Like fibers, update queues come in pairs: a current queue, which represents
 15167     };
 12603 // the visible state of the screen, and a work-in-progress queue, which can be
 15168     var dispatch = queue.dispatch = dispatchAction.bind(null, currentlyRenderingFiber$1, queue);
 12604 // mutated and processed asynchronously before it is committed — a form of
 15169     return [hook.memoizedState, dispatch];
 12605 // double buffering. If a work-in-progress render is discarded before finishing,
 15170   }
 12606 // we create a new work-in-progress by cloning the current queue.
 15171 
 12607 //
 15172   function updateReducer(reducer, initialArg, init) {
 12608 // Both queues share a persistent, singly-linked list structure. To schedule an
 15173     var hook = updateWorkInProgressHook();
 12609 // update, we append it to the end of both queues. Each queue maintains a
 15174     var queue = hook.queue;
 12610 // pointer to first update in the persistent list that hasn't been processed.
 15175 
 12611 // The work-in-progress pointer always has a position equal to or greater than
 15176     if (!(queue !== null)) {
 12612 // the current queue, since we always work on that one. The current queue's
       
 12613 // pointer is only updated during the commit phase, when we swap in the
       
 12614 // work-in-progress.
       
 12615 //
       
 12616 // For example:
       
 12617 //
       
 12618 //   Current pointer:           A - B - C - D - E - F
       
 12619 //   Work-in-progress pointer:              D - E - F
       
 12620 //                                          ^
       
 12621 //                                          The work-in-progress queue has
       
 12622 //                                          processed more updates than current.
       
 12623 //
       
 12624 // The reason we append to both queues is because otherwise we might drop
       
 12625 // updates without ever processing them. For example, if we only add updates to
       
 12626 // the work-in-progress queue, some updates could be lost whenever a work-in
       
 12627 // -progress render restarts by cloning from current. Similarly, if we only add
       
 12628 // updates to the current queue, the updates will be lost whenever an already
       
 12629 // in-progress queue commits and swaps with the current queue. However, by
       
 12630 // adding to both queues, we guarantee that the update will be part of the next
       
 12631 // work-in-progress. (And because the work-in-progress queue becomes the
       
 12632 // current queue once it commits, there's no danger of applying the same
       
 12633 // update twice.)
       
 12634 //
       
 12635 // Prioritization
       
 12636 // --------------
       
 12637 //
       
 12638 // Updates are not sorted by priority, but by insertion; new updates are always
       
 12639 // appended to the end of the list.
       
 12640 //
       
 12641 // The priority is still important, though. When processing the update queue
       
 12642 // during the render phase, only the updates with sufficient priority are
       
 12643 // included in the result. If we skip an update because it has insufficient
       
 12644 // priority, it remains in the queue to be processed later, during a lower
       
 12645 // priority render. Crucially, all updates subsequent to a skipped update also
       
 12646 // remain in the queue *regardless of their priority*. That means high priority
       
 12647 // updates are sometimes processed twice, at two separate priorities. We also
       
 12648 // keep track of a base state, that represents the state before the first
       
 12649 // update in the queue is applied.
       
 12650 //
       
 12651 // For example:
       
 12652 //
       
 12653 //   Given a base state of '', and the following queue of updates
       
 12654 //
       
 12655 //     A1 - B2 - C1 - D2
       
 12656 //
       
 12657 //   where the number indicates the priority, and the update is applied to the
       
 12658 //   previous state by appending a letter, React will process these updates as
       
 12659 //   two separate renders, one per distinct priority level:
       
 12660 //
       
 12661 //   First render, at priority 1:
       
 12662 //     Base state: ''
       
 12663 //     Updates: [A1, C1]
       
 12664 //     Result state: 'AC'
       
 12665 //
       
 12666 //   Second render, at priority 2:
       
 12667 //     Base state: 'A'            <-  The base state does not include C1,
       
 12668 //                                    because B2 was skipped.
       
 12669 //     Updates: [B2, C1, D2]      <-  C1 was rebased on top of B2
       
 12670 //     Result state: 'ABCD'
       
 12671 //
       
 12672 // Because we process updates in insertion order, and rebase high priority
       
 12673 // updates when preceding updates are skipped, the final result is deterministic
       
 12674 // regardless of priority. Intermediate state may vary according to system
       
 12675 // resources, but the final state is always the same.
       
 12676 
       
 12677 var UpdateState = 0;
       
 12678 var ReplaceState = 1;
       
 12679 var ForceUpdate = 2;
       
 12680 var CaptureUpdate = 3;
       
 12681 
       
 12682 // Global state that is reset at the beginning of calling `processUpdateQueue`.
       
 12683 // It should only be read right after calling `processUpdateQueue`, via
       
 12684 // `checkHasForceUpdateAfterProcessing`.
       
 12685 var hasForceUpdate = false;
       
 12686 
       
 12687 var didWarnUpdateInsideUpdate = void 0;
       
 12688 var currentlyProcessingQueue = void 0;
       
 12689 
       
 12690 {
       
 12691   didWarnUpdateInsideUpdate = false;
       
 12692   currentlyProcessingQueue = null;
       
 12693   
       
 12694 }
       
 12695 
       
 12696 function createUpdateQueue(baseState) {
       
 12697   var queue = {
       
 12698     baseState: baseState,
       
 12699     firstUpdate: null,
       
 12700     lastUpdate: null,
       
 12701     firstCapturedUpdate: null,
       
 12702     lastCapturedUpdate: null,
       
 12703     firstEffect: null,
       
 12704     lastEffect: null,
       
 12705     firstCapturedEffect: null,
       
 12706     lastCapturedEffect: null
       
 12707   };
       
 12708   return queue;
       
 12709 }
       
 12710 
       
 12711 function cloneUpdateQueue(currentQueue) {
       
 12712   var queue = {
       
 12713     baseState: currentQueue.baseState,
       
 12714     firstUpdate: currentQueue.firstUpdate,
       
 12715     lastUpdate: currentQueue.lastUpdate,
       
 12716 
       
 12717     // TODO: With resuming, if we bail out and resuse the child tree, we should
       
 12718     // keep these effects.
       
 12719     firstCapturedUpdate: null,
       
 12720     lastCapturedUpdate: null,
       
 12721 
       
 12722     firstEffect: null,
       
 12723     lastEffect: null,
       
 12724 
       
 12725     firstCapturedEffect: null,
       
 12726     lastCapturedEffect: null
       
 12727   };
       
 12728   return queue;
       
 12729 }
       
 12730 
       
 12731 function createUpdate(expirationTime, suspenseConfig) {
       
 12732   var update = {
       
 12733     expirationTime: expirationTime,
       
 12734     suspenseConfig: suspenseConfig,
       
 12735 
       
 12736     tag: UpdateState,
       
 12737     payload: null,
       
 12738     callback: null,
       
 12739 
       
 12740     next: null,
       
 12741     nextEffect: null
       
 12742   };
       
 12743   {
       
 12744     update.priority = getCurrentPriorityLevel();
       
 12745   }
       
 12746   return update;
       
 12747 }
       
 12748 
       
 12749 function appendUpdateToQueue(queue, update) {
       
 12750   // Append the update to the end of the list.
       
 12751   if (queue.lastUpdate === null) {
       
 12752     // Queue is empty
       
 12753     queue.firstUpdate = queue.lastUpdate = update;
       
 12754   } else {
       
 12755     queue.lastUpdate.next = update;
       
 12756     queue.lastUpdate = update;
       
 12757   }
       
 12758 }
       
 12759 
       
 12760 function enqueueUpdate(fiber, update) {
       
 12761   // Update queues are created lazily.
       
 12762   var alternate = fiber.alternate;
       
 12763   var queue1 = void 0;
       
 12764   var queue2 = void 0;
       
 12765   if (alternate === null) {
       
 12766     // There's only one fiber.
       
 12767     queue1 = fiber.updateQueue;
       
 12768     queue2 = null;
       
 12769     if (queue1 === null) {
       
 12770       queue1 = fiber.updateQueue = createUpdateQueue(fiber.memoizedState);
       
 12771     }
       
 12772   } else {
       
 12773     // There are two owners.
       
 12774     queue1 = fiber.updateQueue;
       
 12775     queue2 = alternate.updateQueue;
       
 12776     if (queue1 === null) {
       
 12777       if (queue2 === null) {
       
 12778         // Neither fiber has an update queue. Create new ones.
       
 12779         queue1 = fiber.updateQueue = createUpdateQueue(fiber.memoizedState);
       
 12780         queue2 = alternate.updateQueue = createUpdateQueue(alternate.memoizedState);
       
 12781       } else {
       
 12782         // Only one fiber has an update queue. Clone to create a new one.
       
 12783         queue1 = fiber.updateQueue = cloneUpdateQueue(queue2);
       
 12784       }
       
 12785     } else {
       
 12786       if (queue2 === null) {
       
 12787         // Only one fiber has an update queue. Clone to create a new one.
       
 12788         queue2 = alternate.updateQueue = cloneUpdateQueue(queue1);
       
 12789       } else {
       
 12790         // Both owners have an update queue.
       
 12791       }
       
 12792     }
       
 12793   }
       
 12794   if (queue2 === null || queue1 === queue2) {
       
 12795     // There's only a single queue.
       
 12796     appendUpdateToQueue(queue1, update);
       
 12797   } else {
       
 12798     // There are two queues. We need to append the update to both queues,
       
 12799     // while accounting for the persistent structure of the list — we don't
       
 12800     // want the same update to be added multiple times.
       
 12801     if (queue1.lastUpdate === null || queue2.lastUpdate === null) {
       
 12802       // One of the queues is not empty. We must add the update to both queues.
       
 12803       appendUpdateToQueue(queue1, update);
       
 12804       appendUpdateToQueue(queue2, update);
       
 12805     } else {
       
 12806       // Both queues are non-empty. The last update is the same in both lists,
       
 12807       // because of structural sharing. So, only append to one of the lists.
       
 12808       appendUpdateToQueue(queue1, update);
       
 12809       // But we still need to update the `lastUpdate` pointer of queue2.
       
 12810       queue2.lastUpdate = update;
       
 12811     }
       
 12812   }
       
 12813 
       
 12814   {
       
 12815     if (fiber.tag === ClassComponent && (currentlyProcessingQueue === queue1 || queue2 !== null && currentlyProcessingQueue === queue2) && !didWarnUpdateInsideUpdate) {
       
 12816       warningWithoutStack$1(false, 'An update (setState, replaceState, or forceUpdate) was scheduled ' + 'from inside an update function. Update functions should be pure, ' + 'with zero side-effects. Consider using componentDidUpdate or a ' + 'callback.');
       
 12817       didWarnUpdateInsideUpdate = true;
       
 12818     }
       
 12819   }
       
 12820 }
       
 12821 
       
 12822 function enqueueCapturedUpdate(workInProgress, update) {
       
 12823   // Captured updates go into a separate list, and only on the work-in-
       
 12824   // progress queue.
       
 12825   var workInProgressQueue = workInProgress.updateQueue;
       
 12826   if (workInProgressQueue === null) {
       
 12827     workInProgressQueue = workInProgress.updateQueue = createUpdateQueue(workInProgress.memoizedState);
       
 12828   } else {
       
 12829     // TODO: I put this here rather than createWorkInProgress so that we don't
       
 12830     // clone the queue unnecessarily. There's probably a better way to
       
 12831     // structure this.
       
 12832     workInProgressQueue = ensureWorkInProgressQueueIsAClone(workInProgress, workInProgressQueue);
       
 12833   }
       
 12834 
       
 12835   // Append the update to the end of the list.
       
 12836   if (workInProgressQueue.lastCapturedUpdate === null) {
       
 12837     // This is the first render phase update
       
 12838     workInProgressQueue.firstCapturedUpdate = workInProgressQueue.lastCapturedUpdate = update;
       
 12839   } else {
       
 12840     workInProgressQueue.lastCapturedUpdate.next = update;
       
 12841     workInProgressQueue.lastCapturedUpdate = update;
       
 12842   }
       
 12843 }
       
 12844 
       
 12845 function ensureWorkInProgressQueueIsAClone(workInProgress, queue) {
       
 12846   var current = workInProgress.alternate;
       
 12847   if (current !== null) {
       
 12848     // If the work-in-progress queue is equal to the current queue,
       
 12849     // we need to clone it first.
       
 12850     if (queue === current.updateQueue) {
       
 12851       queue = workInProgress.updateQueue = cloneUpdateQueue(queue);
       
 12852     }
       
 12853   }
       
 12854   return queue;
       
 12855 }
       
 12856 
       
 12857 function getStateFromUpdate(workInProgress, queue, update, prevState, nextProps, instance) {
       
 12858   switch (update.tag) {
       
 12859     case ReplaceState:
       
 12860       {
 15177       {
 12861         var _payload = update.payload;
 15178         throw Error( "Should have a queue. This is likely a bug in React. Please file an issue." );
 12862         if (typeof _payload === 'function') {
 15179       }
 12863           // Updater function
 15180     }
 12864           {
 15181 
 12865             enterDisallowedContextReadInDEV();
 15182     queue.lastRenderedReducer = reducer;
 12866             if (debugRenderPhaseSideEffects || debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
 15183     var current = currentHook; // The last rebase update that is NOT part of the base state.
 12867               _payload.call(instance, prevState, nextProps);
 15184 
 12868             }
 15185     var baseQueue = current.baseQueue; // The last pending update that hasn't been processed yet.
 12869           }
 15186 
 12870           var nextState = _payload.call(instance, prevState, nextProps);
 15187     var pendingQueue = queue.pending;
 12871           {
 15188 
 12872             exitDisallowedContextReadInDEV();
 15189     if (pendingQueue !== null) {
 12873           }
 15190       // We have new updates that haven't been processed yet.
 12874           return nextState;
 15191       // We'll add them to the base queue.
 12875         }
 15192       if (baseQueue !== null) {
 12876         // State object
 15193         // Merge the pending queue and the base queue.
 12877         return _payload;
 15194         var baseFirst = baseQueue.next;
 12878       }
 15195         var pendingFirst = pendingQueue.next;
 12879     case CaptureUpdate:
 15196         baseQueue.next = pendingFirst;
 12880       {
 15197         pendingQueue.next = baseFirst;
 12881         workInProgress.effectTag = workInProgress.effectTag & ~ShouldCapture | DidCapture;
 15198       }
 12882       }
 15199 
 12883     // Intentional fallthrough
 15200       current.baseQueue = baseQueue = pendingQueue;
 12884     case UpdateState:
 15201       queue.pending = null;
 12885       {
 15202     }
 12886         var _payload2 = update.payload;
 15203 
 12887         var partialState = void 0;
 15204     if (baseQueue !== null) {
 12888         if (typeof _payload2 === 'function') {
 15205       // We have a queue to process.
 12889           // Updater function
 15206       var first = baseQueue.next;
 12890           {
 15207       var newState = current.baseState;
 12891             enterDisallowedContextReadInDEV();
 15208       var newBaseState = null;
 12892             if (debugRenderPhaseSideEffects || debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
 15209       var newBaseQueueFirst = null;
 12893               _payload2.call(instance, prevState, nextProps);
 15210       var newBaseQueueLast = null;
 12894             }
 15211       var update = first;
 12895           }
 15212 
 12896           partialState = _payload2.call(instance, prevState, nextProps);
 15213       do {
 12897           {
 15214         var updateExpirationTime = update.expirationTime;
 12898             exitDisallowedContextReadInDEV();
 15215 
       
 15216         if (updateExpirationTime < renderExpirationTime) {
       
 15217           // Priority is insufficient. Skip this update. If this is the first
       
 15218           // skipped update, the previous update/state is the new base
       
 15219           // update/state.
       
 15220           var clone = {
       
 15221             expirationTime: update.expirationTime,
       
 15222             suspenseConfig: update.suspenseConfig,
       
 15223             action: update.action,
       
 15224             eagerReducer: update.eagerReducer,
       
 15225             eagerState: update.eagerState,
       
 15226             next: null
       
 15227           };
       
 15228 
       
 15229           if (newBaseQueueLast === null) {
       
 15230             newBaseQueueFirst = newBaseQueueLast = clone;
       
 15231             newBaseState = newState;
       
 15232           } else {
       
 15233             newBaseQueueLast = newBaseQueueLast.next = clone;
       
 15234           } // Update the remaining priority in the queue.
       
 15235 
       
 15236 
       
 15237           if (updateExpirationTime > currentlyRenderingFiber$1.expirationTime) {
       
 15238             currentlyRenderingFiber$1.expirationTime = updateExpirationTime;
       
 15239             markUnprocessedUpdateTime(updateExpirationTime);
 12899           }
 15240           }
 12900         } else {
 15241         } else {
 12901           // Partial state object
 15242           // This update does have sufficient priority.
 12902           partialState = _payload2;
 15243           if (newBaseQueueLast !== null) {
 12903         }
 15244             var _clone = {
 12904         if (partialState === null || partialState === undefined) {
 15245               expirationTime: Sync,
 12905           // Null and undefined are treated as no-ops.
 15246               // This update is going to be committed so we never want uncommit it.
 12906           return prevState;
 15247               suspenseConfig: update.suspenseConfig,
 12907         }
 15248               action: update.action,
 12908         // Merge the partial state and the previous state.
 15249               eagerReducer: update.eagerReducer,
 12909         return _assign({}, prevState, partialState);
 15250               eagerState: update.eagerState,
 12910       }
 15251               next: null
 12911     case ForceUpdate:
 15252             };
       
 15253             newBaseQueueLast = newBaseQueueLast.next = _clone;
       
 15254           } // Mark the event time of this update as relevant to this render pass.
       
 15255           // TODO: This should ideally use the true event time of this update rather than
       
 15256           // its priority which is a derived and not reverseable value.
       
 15257           // TODO: We should skip this update if it was already committed but currently
       
 15258           // we have no way of detecting the difference between a committed and suspended
       
 15259           // update here.
       
 15260 
       
 15261 
       
 15262           markRenderEventTimeAndConfig(updateExpirationTime, update.suspenseConfig); // Process this update.
       
 15263 
       
 15264           if (update.eagerReducer === reducer) {
       
 15265             // If this update was processed eagerly, and its reducer matches the
       
 15266             // current reducer, we can use the eagerly computed state.
       
 15267             newState = update.eagerState;
       
 15268           } else {
       
 15269             var action = update.action;
       
 15270             newState = reducer(newState, action);
       
 15271           }
       
 15272         }
       
 15273 
       
 15274         update = update.next;
       
 15275       } while (update !== null && update !== first);
       
 15276 
       
 15277       if (newBaseQueueLast === null) {
       
 15278         newBaseState = newState;
       
 15279       } else {
       
 15280         newBaseQueueLast.next = newBaseQueueFirst;
       
 15281       } // Mark that the fiber performed work, but only if the new state is
       
 15282       // different from the current state.
       
 15283 
       
 15284 
       
 15285       if (!objectIs(newState, hook.memoizedState)) {
       
 15286         markWorkInProgressReceivedUpdate();
       
 15287       }
       
 15288 
       
 15289       hook.memoizedState = newState;
       
 15290       hook.baseState = newBaseState;
       
 15291       hook.baseQueue = newBaseQueueLast;
       
 15292       queue.lastRenderedState = newState;
       
 15293     }
       
 15294 
       
 15295     var dispatch = queue.dispatch;
       
 15296     return [hook.memoizedState, dispatch];
       
 15297   }
       
 15298 
       
 15299   function rerenderReducer(reducer, initialArg, init) {
       
 15300     var hook = updateWorkInProgressHook();
       
 15301     var queue = hook.queue;
       
 15302 
       
 15303     if (!(queue !== null)) {
 12912       {
 15304       {
 12913         hasForceUpdate = true;
 15305         throw Error( "Should have a queue. This is likely a bug in React. Please file an issue." );
 12914         return prevState;
 15306       }
 12915       }
 15307     }
 12916   }
 15308 
 12917   return prevState;
 15309     queue.lastRenderedReducer = reducer; // This is a re-render. Apply the new render phase updates to the previous
 12918 }
 15310     // work-in-progress hook.
 12919 
 15311 
 12920 function processUpdateQueue(workInProgress, queue, props, instance, renderExpirationTime) {
 15312     var dispatch = queue.dispatch;
 12921   hasForceUpdate = false;
 15313     var lastRenderPhaseUpdate = queue.pending;
 12922 
 15314     var newState = hook.memoizedState;
 12923   queue = ensureWorkInProgressQueueIsAClone(workInProgress, queue);
 15315 
 12924 
 15316     if (lastRenderPhaseUpdate !== null) {
 12925   {
 15317       // The queue doesn't persist past this render pass.
 12926     currentlyProcessingQueue = queue;
 15318       queue.pending = null;
 12927   }
 15319       var firstRenderPhaseUpdate = lastRenderPhaseUpdate.next;
 12928 
 15320       var update = firstRenderPhaseUpdate;
 12929   // These values may change as we process the queue.
 15321 
 12930   var newBaseState = queue.baseState;
 15322       do {
 12931   var newFirstUpdate = null;
 15323         // Process this render phase update. We don't have to check the
 12932   var newExpirationTime = NoWork;
 15324         // priority because it will always be the same as the current
 12933 
 15325         // render's.
 12934   // Iterate through the list of updates to compute the result.
 15326         var action = update.action;
 12935   var update = queue.firstUpdate;
 15327         newState = reducer(newState, action);
 12936   var resultState = newBaseState;
 15328         update = update.next;
 12937   while (update !== null) {
 15329       } while (update !== firstRenderPhaseUpdate); // Mark that the fiber performed work, but only if the new state is
 12938     var updateExpirationTime = update.expirationTime;
 15330       // different from the current state.
 12939     if (updateExpirationTime < renderExpirationTime) {
 15331 
 12940       // This update does not have sufficient priority. Skip it.
 15332 
 12941       if (newFirstUpdate === null) {
 15333       if (!objectIs(newState, hook.memoizedState)) {
 12942         // This is the first skipped update. It will be the first update in
 15334         markWorkInProgressReceivedUpdate();
 12943         // the new list.
 15335       }
 12944         newFirstUpdate = update;
 15336 
 12945         // Since this is the first update that was skipped, the current result
 15337       hook.memoizedState = newState; // Don't persist the state accumulated from the render phase updates to
 12946         // is the new base state.
 15338       // the base state unless the queue is empty.
 12947         newBaseState = resultState;
 15339       // TODO: Not sure if this is the desired semantics, but it's what we
 12948       }
 15340       // do for gDSFP. I can't remember why.
 12949       // Since this update will remain in the list, update the remaining
 15341 
 12950       // expiration time.
 15342       if (hook.baseQueue === null) {
 12951       if (newExpirationTime < updateExpirationTime) {
 15343         hook.baseState = newState;
 12952         newExpirationTime = updateExpirationTime;
 15344       }
 12953       }
 15345 
       
 15346       queue.lastRenderedState = newState;
       
 15347     }
       
 15348 
       
 15349     return [newState, dispatch];
       
 15350   }
       
 15351 
       
 15352   function mountState(initialState) {
       
 15353     var hook = mountWorkInProgressHook();
       
 15354 
       
 15355     if (typeof initialState === 'function') {
       
 15356       // $FlowFixMe: Flow doesn't like mixed types
       
 15357       initialState = initialState();
       
 15358     }
       
 15359 
       
 15360     hook.memoizedState = hook.baseState = initialState;
       
 15361     var queue = hook.queue = {
       
 15362       pending: null,
       
 15363       dispatch: null,
       
 15364       lastRenderedReducer: basicStateReducer,
       
 15365       lastRenderedState: initialState
       
 15366     };
       
 15367     var dispatch = queue.dispatch = dispatchAction.bind(null, currentlyRenderingFiber$1, queue);
       
 15368     return [hook.memoizedState, dispatch];
       
 15369   }
       
 15370 
       
 15371   function updateState(initialState) {
       
 15372     return updateReducer(basicStateReducer);
       
 15373   }
       
 15374 
       
 15375   function rerenderState(initialState) {
       
 15376     return rerenderReducer(basicStateReducer);
       
 15377   }
       
 15378 
       
 15379   function pushEffect(tag, create, destroy, deps) {
       
 15380     var effect = {
       
 15381       tag: tag,
       
 15382       create: create,
       
 15383       destroy: destroy,
       
 15384       deps: deps,
       
 15385       // Circular
       
 15386       next: null
       
 15387     };
       
 15388     var componentUpdateQueue = currentlyRenderingFiber$1.updateQueue;
       
 15389 
       
 15390     if (componentUpdateQueue === null) {
       
 15391       componentUpdateQueue = createFunctionComponentUpdateQueue();
       
 15392       currentlyRenderingFiber$1.updateQueue = componentUpdateQueue;
       
 15393       componentUpdateQueue.lastEffect = effect.next = effect;
 12954     } else {
 15394     } else {
 12955       // This update does have sufficient priority.
 15395       var lastEffect = componentUpdateQueue.lastEffect;
 12956 
 15396 
 12957       // Mark the event time of this update as relevant to this render pass.
 15397       if (lastEffect === null) {
 12958       // TODO: This should ideally use the true event time of this update rather than
 15398         componentUpdateQueue.lastEffect = effect.next = effect;
 12959       // its priority which is a derived and not reverseable value.
 15399       } else {
 12960       // TODO: We should skip this update if it was already committed but currently
 15400         var firstEffect = lastEffect.next;
 12961       // we have no way of detecting the difference between a committed and suspended
 15401         lastEffect.next = effect;
 12962       // update here.
 15402         effect.next = firstEffect;
 12963       markRenderEventTimeAndConfig(updateExpirationTime, update.suspenseConfig);
 15403         componentUpdateQueue.lastEffect = effect;
 12964 
 15404       }
 12965       // Process it and compute a new result.
 15405     }
 12966       resultState = getStateFromUpdate(workInProgress, queue, update, resultState, props, instance);
 15406 
 12967       var _callback = update.callback;
 15407     return effect;
 12968       if (_callback !== null) {
 15408   }
 12969         workInProgress.effectTag |= Callback;
 15409 
 12970         // Set this to null, in case it was mutated during an aborted render.
 15410   function mountRef(initialValue) {
 12971         update.nextEffect = null;
 15411     var hook = mountWorkInProgressHook();
 12972         if (queue.lastEffect === null) {
 15412     var ref = {
 12973           queue.firstEffect = queue.lastEffect = update;
 15413       current: initialValue
 12974         } else {
 15414     };
 12975           queue.lastEffect.nextEffect = update;
 15415 
 12976           queue.lastEffect = update;
 15416     {
 12977         }
 15417       Object.seal(ref);
 12978       }
 15418     }
 12979     }
 15419 
 12980     // Continue to the next update.
 15420     hook.memoizedState = ref;
 12981     update = update.next;
 15421     return ref;
 12982   }
 15422   }
 12983 
 15423 
 12984   // Separately, iterate though the list of captured updates.
 15424   function updateRef(initialValue) {
 12985   var newFirstCapturedUpdate = null;
 15425     var hook = updateWorkInProgressHook();
 12986   update = queue.firstCapturedUpdate;
 15426     return hook.memoizedState;
 12987   while (update !== null) {
 15427   }
 12988     var _updateExpirationTime = update.expirationTime;
 15428 
 12989     if (_updateExpirationTime < renderExpirationTime) {
 15429   function mountEffectImpl(fiberEffectTag, hookEffectTag, create, deps) {
 12990       // This update does not have sufficient priority. Skip it.
 15430     var hook = mountWorkInProgressHook();
 12991       if (newFirstCapturedUpdate === null) {
 15431     var nextDeps = deps === undefined ? null : deps;
 12992         // This is the first skipped captured update. It will be the first
 15432     currentlyRenderingFiber$1.effectTag |= fiberEffectTag;
 12993         // update in the new list.
 15433     hook.memoizedState = pushEffect(HasEffect | hookEffectTag, create, undefined, nextDeps);
 12994         newFirstCapturedUpdate = update;
 15434   }
 12995         // If this is the first update that was skipped, the current result is
 15435 
 12996         // the new base state.
 15436   function updateEffectImpl(fiberEffectTag, hookEffectTag, create, deps) {
 12997         if (newFirstUpdate === null) {
 15437     var hook = updateWorkInProgressHook();
 12998           newBaseState = resultState;
 15438     var nextDeps = deps === undefined ? null : deps;
 12999         }
 15439     var destroy = undefined;
 13000       }
 15440 
 13001       // Since this update will remain in the list, update the remaining
 15441     if (currentHook !== null) {
 13002       // expiration time.
 15442       var prevEffect = currentHook.memoizedState;
 13003       if (newExpirationTime < _updateExpirationTime) {
 15443       destroy = prevEffect.destroy;
 13004         newExpirationTime = _updateExpirationTime;
 15444 
 13005       }
 15445       if (nextDeps !== null) {
 13006     } else {
 15446         var prevDeps = prevEffect.deps;
 13007       // This update does have sufficient priority. Process it and compute
 15447 
 13008       // a new result.
 15448         if (areHookInputsEqual(nextDeps, prevDeps)) {
 13009       resultState = getStateFromUpdate(workInProgress, queue, update, resultState, props, instance);
 15449           pushEffect(hookEffectTag, create, destroy, nextDeps);
 13010       var _callback2 = update.callback;
 15450           return;
 13011       if (_callback2 !== null) {
 15451         }
 13012         workInProgress.effectTag |= Callback;
 15452       }
 13013         // Set this to null, in case it was mutated during an aborted render.
 15453     }
 13014         update.nextEffect = null;
 15454 
 13015         if (queue.lastCapturedEffect === null) {
 15455     currentlyRenderingFiber$1.effectTag |= fiberEffectTag;
 13016           queue.firstCapturedEffect = queue.lastCapturedEffect = update;
 15456     hook.memoizedState = pushEffect(HasEffect | hookEffectTag, create, destroy, nextDeps);
 13017         } else {
 15457   }
 13018           queue.lastCapturedEffect.nextEffect = update;
 15458 
 13019           queue.lastCapturedEffect = update;
 15459   function mountEffect(create, deps) {
 13020         }
 15460     {
 13021       }
 15461       // $FlowExpectedError - jest isn't a global, and isn't recognized outside of tests
 13022     }
 15462       if ('undefined' !== typeof jest) {
 13023     update = update.next;
 15463         warnIfNotCurrentlyActingEffectsInDEV(currentlyRenderingFiber$1);
 13024   }
 15464       }
 13025 
 15465     }
 13026   if (newFirstUpdate === null) {
 15466 
 13027     queue.lastUpdate = null;
 15467     return mountEffectImpl(Update | Passive, Passive$1, create, deps);
 13028   }
 15468   }
 13029   if (newFirstCapturedUpdate === null) {
 15469 
 13030     queue.lastCapturedUpdate = null;
 15470   function updateEffect(create, deps) {
 13031   } else {
 15471     {
 13032     workInProgress.effectTag |= Callback;
 15472       // $FlowExpectedError - jest isn't a global, and isn't recognized outside of tests
 13033   }
 15473       if ('undefined' !== typeof jest) {
 13034   if (newFirstUpdate === null && newFirstCapturedUpdate === null) {
 15474         warnIfNotCurrentlyActingEffectsInDEV(currentlyRenderingFiber$1);
 13035     // We processed every update, without skipping. That means the new base
 15475       }
 13036     // state is the same as the result state.
 15476     }
 13037     newBaseState = resultState;
 15477 
 13038   }
 15478     return updateEffectImpl(Update | Passive, Passive$1, create, deps);
 13039 
 15479   }
 13040   queue.baseState = newBaseState;
 15480 
 13041   queue.firstUpdate = newFirstUpdate;
 15481   function mountLayoutEffect(create, deps) {
 13042   queue.firstCapturedUpdate = newFirstCapturedUpdate;
 15482     return mountEffectImpl(Update, Layout, create, deps);
 13043 
 15483   }
 13044   // Set the remaining expiration time to be whatever is remaining in the queue.
 15484 
 13045   // This should be fine because the only two other things that contribute to
 15485   function updateLayoutEffect(create, deps) {
 13046   // expiration time are props and context. We're already in the middle of the
 15486     return updateEffectImpl(Update, Layout, create, deps);
 13047   // begin phase by the time we start processing the queue, so we've already
 15487   }
 13048   // dealt with the props. Context in components that specify
 15488 
 13049   // shouldComponentUpdate is tricky; but we'll have to account for
 15489   function imperativeHandleEffect(create, ref) {
 13050   // that regardless.
 15490     if (typeof ref === 'function') {
 13051   workInProgress.expirationTime = newExpirationTime;
 15491       var refCallback = ref;
 13052   workInProgress.memoizedState = resultState;
 15492 
 13053 
 15493       var _inst = create();
 13054   {
 15494 
 13055     currentlyProcessingQueue = null;
 15495       refCallback(_inst);
 13056   }
 15496       return function () {
 13057 }
 15497         refCallback(null);
 13058 
 15498       };
 13059 function callCallback(callback, context) {
 15499     } else if (ref !== null && ref !== undefined) {
 13060   (function () {
 15500       var refObject = ref;
 13061     if (!(typeof callback === 'function')) {
 15501 
 13062       {
 15502       {
 13063         throw ReactError(Error('Invalid argument passed as callback. Expected a function. Instead received: ' + callback));
 15503         if (!refObject.hasOwnProperty('current')) {
 13064       }
 15504           error('Expected useImperativeHandle() first argument to either be a ' + 'ref callback or React.createRef() object. Instead received: %s.', 'an object with keys {' + Object.keys(refObject).join(', ') + '}');
 13065     }
 15505         }
 13066   })();
 15506       }
 13067   callback.call(context);
 15507 
 13068 }
 15508       var _inst2 = create();
 13069 
 15509 
 13070 function resetHasForceUpdateBeforeProcessing() {
 15510       refObject.current = _inst2;
 13071   hasForceUpdate = false;
 15511       return function () {
 13072 }
 15512         refObject.current = null;
 13073 
 15513       };
 13074 function checkHasForceUpdateAfterProcessing() {
 15514     }
 13075   return hasForceUpdate;
 15515   }
 13076 }
 15516 
 13077 
 15517   function mountImperativeHandle(ref, create, deps) {
 13078 function commitUpdateQueue(finishedWork, finishedQueue, instance, renderExpirationTime) {
 15518     {
 13079   // If the finished render included captured updates, and there are still
 15519       if (typeof create !== 'function') {
 13080   // lower priority updates left over, we need to keep the captured updates
 15520         error('Expected useImperativeHandle() second argument to be a function ' + 'that creates a handle. Instead received: %s.', create !== null ? typeof create : 'null');
 13081   // in the queue so that they are rebased and not dropped once we process the
 15521       }
 13082   // queue again at the lower priority.
 15522     } // TODO: If deps are provided, should we skip comparing the ref itself?
 13083   if (finishedQueue.firstCapturedUpdate !== null) {
 15523 
 13084     // Join the captured update list to the end of the normal list.
 15524 
 13085     if (finishedQueue.lastUpdate !== null) {
 15525     var effectDeps = deps !== null && deps !== undefined ? deps.concat([ref]) : null;
 13086       finishedQueue.lastUpdate.next = finishedQueue.firstCapturedUpdate;
 15526     return mountEffectImpl(Update, Layout, imperativeHandleEffect.bind(null, create, ref), effectDeps);
 13087       finishedQueue.lastUpdate = finishedQueue.lastCapturedUpdate;
 15527   }
 13088     }
 15528 
 13089     // Clear the list of captured updates.
 15529   function updateImperativeHandle(ref, create, deps) {
 13090     finishedQueue.firstCapturedUpdate = finishedQueue.lastCapturedUpdate = null;
 15530     {
 13091   }
 15531       if (typeof create !== 'function') {
 13092 
 15532         error('Expected useImperativeHandle() second argument to be a function ' + 'that creates a handle. Instead received: %s.', create !== null ? typeof create : 'null');
 13093   // Commit the effects
 15533       }
 13094   commitUpdateEffects(finishedQueue.firstEffect, instance);
 15534     } // TODO: If deps are provided, should we skip comparing the ref itself?
 13095   finishedQueue.firstEffect = finishedQueue.lastEffect = null;
 15535 
 13096 
 15536 
 13097   commitUpdateEffects(finishedQueue.firstCapturedEffect, instance);
 15537     var effectDeps = deps !== null && deps !== undefined ? deps.concat([ref]) : null;
 13098   finishedQueue.firstCapturedEffect = finishedQueue.lastCapturedEffect = null;
 15538     return updateEffectImpl(Update, Layout, imperativeHandleEffect.bind(null, create, ref), effectDeps);
 13099 }
 15539   }
 13100 
 15540 
 13101 function commitUpdateEffects(effect, instance) {
 15541   function mountDebugValue(value, formatterFn) {// This hook is normally a no-op.
 13102   while (effect !== null) {
 15542     // The react-debug-hooks package injects its own implementation
 13103     var _callback3 = effect.callback;
 15543     // so that e.g. DevTools can display custom hook values.
 13104     if (_callback3 !== null) {
 15544   }
 13105       effect.callback = null;
 15545 
 13106       callCallback(_callback3, instance);
 15546   var updateDebugValue = mountDebugValue;
 13107     }
 15547 
 13108     effect = effect.nextEffect;
 15548   function mountCallback(callback, deps) {
 13109   }
 15549     var hook = mountWorkInProgressHook();
 13110 }
 15550     var nextDeps = deps === undefined ? null : deps;
 13111 
 15551     hook.memoizedState = [callback, nextDeps];
 13112 var ReactCurrentBatchConfig = ReactSharedInternals.ReactCurrentBatchConfig;
 15552     return callback;
 13113 
 15553   }
 13114 
 15554 
 13115 function requestCurrentSuspenseConfig() {
 15555   function updateCallback(callback, deps) {
 13116   return ReactCurrentBatchConfig.suspense;
 15556     var hook = updateWorkInProgressHook();
 13117 }
 15557     var nextDeps = deps === undefined ? null : deps;
 13118 
 15558     var prevState = hook.memoizedState;
 13119 var fakeInternalInstance = {};
 15559 
 13120 var isArray$1 = Array.isArray;
 15560     if (prevState !== null) {
 13121 
 15561       if (nextDeps !== null) {
 13122 // React.Component uses a shared frozen object by default.
 15562         var prevDeps = prevState[1];
 13123 // We'll use it to determine whether we need to initialize legacy refs.
 15563 
 13124 var emptyRefsObject = new React.Component().refs;
 15564         if (areHookInputsEqual(nextDeps, prevDeps)) {
 13125 
 15565           return prevState[0];
 13126 var didWarnAboutStateAssignmentForComponent = void 0;
 15566         }
 13127 var didWarnAboutUninitializedState = void 0;
 15567       }
 13128 var didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate = void 0;
 15568     }
 13129 var didWarnAboutLegacyLifecyclesAndDerivedState = void 0;
 15569 
 13130 var didWarnAboutUndefinedDerivedState = void 0;
 15570     hook.memoizedState = [callback, nextDeps];
 13131 var warnOnUndefinedDerivedState = void 0;
 15571     return callback;
 13132 var warnOnInvalidCallback$1 = void 0;
 15572   }
 13133 var didWarnAboutDirectlyAssigningPropsToState = void 0;
 15573 
 13134 var didWarnAboutContextTypeAndContextTypes = void 0;
 15574   function mountMemo(nextCreate, deps) {
 13135 var didWarnAboutInvalidateContextType = void 0;
 15575     var hook = mountWorkInProgressHook();
 13136 
 15576     var nextDeps = deps === undefined ? null : deps;
 13137 {
 15577     var nextValue = nextCreate();
 13138   didWarnAboutStateAssignmentForComponent = new Set();
 15578     hook.memoizedState = [nextValue, nextDeps];
 13139   didWarnAboutUninitializedState = new Set();
 15579     return nextValue;
 13140   didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate = new Set();
 15580   }
 13141   didWarnAboutLegacyLifecyclesAndDerivedState = new Set();
 15581 
 13142   didWarnAboutDirectlyAssigningPropsToState = new Set();
 15582   function updateMemo(nextCreate, deps) {
 13143   didWarnAboutUndefinedDerivedState = new Set();
 15583     var hook = updateWorkInProgressHook();
 13144   didWarnAboutContextTypeAndContextTypes = new Set();
 15584     var nextDeps = deps === undefined ? null : deps;
 13145   didWarnAboutInvalidateContextType = new Set();
 15585     var prevState = hook.memoizedState;
 13146 
 15586 
 13147   var didWarnOnInvalidCallback = new Set();
 15587     if (prevState !== null) {
 13148 
 15588       // Assume these are defined. If they're not, areHookInputsEqual will warn.
 13149   warnOnInvalidCallback$1 = function (callback, callerName) {
 15589       if (nextDeps !== null) {
 13150     if (callback === null || typeof callback === 'function') {
 15590         var prevDeps = prevState[1];
 13151       return;
 15591 
 13152     }
 15592         if (areHookInputsEqual(nextDeps, prevDeps)) {
 13153     var key = callerName + '_' + callback;
 15593           return prevState[0];
 13154     if (!didWarnOnInvalidCallback.has(key)) {
 15594         }
 13155       didWarnOnInvalidCallback.add(key);
 15595       }
 13156       warningWithoutStack$1(false, '%s(...): Expected the last optional `callback` argument to be a ' + 'function. Instead received: %s.', callerName, callback);
 15596     }
 13157     }
 15597 
 13158   };
 15598     var nextValue = nextCreate();
 13159 
 15599     hook.memoizedState = [nextValue, nextDeps];
 13160   warnOnUndefinedDerivedState = function (type, partialState) {
 15600     return nextValue;
 13161     if (partialState === undefined) {
 15601   }
 13162       var componentName = getComponentName(type) || 'Component';
 15602 
 13163       if (!didWarnAboutUndefinedDerivedState.has(componentName)) {
 15603   function mountDeferredValue(value, config) {
 13164         didWarnAboutUndefinedDerivedState.add(componentName);
 15604     var _mountState = mountState(value),
 13165         warningWithoutStack$1(false, '%s.getDerivedStateFromProps(): A valid state object (or null) must be returned. ' + 'You have returned undefined.', componentName);
 15605         prevValue = _mountState[0],
 13166       }
 15606         setValue = _mountState[1];
 13167     }
 15607 
 13168   };
 15608     mountEffect(function () {
 13169 
 15609       var previousConfig = ReactCurrentBatchConfig$1.suspense;
 13170   // This is so gross but it's at least non-critical and can be removed if
 15610       ReactCurrentBatchConfig$1.suspense = config === undefined ? null : config;
 13171   // it causes problems. This is meant to give a nicer error message for
 15611 
 13172   // ReactDOM15.unstable_renderSubtreeIntoContainer(reactDOM16Component,
 15612       try {
 13173   // ...)) which otherwise throws a "_processChildContext is not a function"
 15613         setValue(value);
 13174   // exception.
 15614       } finally {
 13175   Object.defineProperty(fakeInternalInstance, '_processChildContext', {
 15615         ReactCurrentBatchConfig$1.suspense = previousConfig;
 13176     enumerable: false,
 15616       }
 13177     value: function () {
 15617     }, [value, config]);
 13178       (function () {
 15618     return prevValue;
 13179         {
 15619   }
 13180           {
 15620 
 13181             throw ReactError(Error('_processChildContext is not available in React 16+. This likely means you have multiple copies of React and are attempting to nest a React 15 tree inside a React 16 tree using unstable_renderSubtreeIntoContainer, which isn\'t supported. Try to make sure you have only one copy of React (and ideally, switch to ReactDOM.createPortal).'));
 15621   function updateDeferredValue(value, config) {
 13182           }
 15622     var _updateState = updateState(),
 13183         }
 15623         prevValue = _updateState[0],
 13184       })();
 15624         setValue = _updateState[1];
 13185     }
 15625 
 13186   });
 15626     updateEffect(function () {
 13187   Object.freeze(fakeInternalInstance);
 15627       var previousConfig = ReactCurrentBatchConfig$1.suspense;
 13188 }
 15628       ReactCurrentBatchConfig$1.suspense = config === undefined ? null : config;
 13189 
 15629 
 13190 function applyDerivedStateFromProps(workInProgress, ctor, getDerivedStateFromProps, nextProps) {
 15630       try {
 13191   var prevState = workInProgress.memoizedState;
 15631         setValue(value);
 13192 
 15632       } finally {
 13193   {
 15633         ReactCurrentBatchConfig$1.suspense = previousConfig;
 13194     if (debugRenderPhaseSideEffects || debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
 15634       }
 13195       // Invoke the function an extra time to help detect side-effects.
 15635     }, [value, config]);
 13196       getDerivedStateFromProps(nextProps, prevState);
 15636     return prevValue;
 13197     }
 15637   }
 13198   }
 15638 
 13199 
 15639   function rerenderDeferredValue(value, config) {
 13200   var partialState = getDerivedStateFromProps(nextProps, prevState);
 15640     var _rerenderState = rerenderState(),
 13201 
 15641         prevValue = _rerenderState[0],
 13202   {
 15642         setValue = _rerenderState[1];
 13203     warnOnUndefinedDerivedState(ctor, partialState);
 15643 
 13204   }
 15644     updateEffect(function () {
 13205   // Merge the partial state and the previous state.
 15645       var previousConfig = ReactCurrentBatchConfig$1.suspense;
 13206   var memoizedState = partialState === null || partialState === undefined ? prevState : _assign({}, prevState, partialState);
 15646       ReactCurrentBatchConfig$1.suspense = config === undefined ? null : config;
 13207   workInProgress.memoizedState = memoizedState;
 15647 
 13208 
 15648       try {
 13209   // Once the update queue is empty, persist the derived state onto the
 15649         setValue(value);
 13210   // base state.
 15650       } finally {
 13211   var updateQueue = workInProgress.updateQueue;
 15651         ReactCurrentBatchConfig$1.suspense = previousConfig;
 13212   if (updateQueue !== null && workInProgress.expirationTime === NoWork) {
 15652       }
 13213     updateQueue.baseState = memoizedState;
 15653     }, [value, config]);
 13214   }
 15654     return prevValue;
 13215 }
 15655   }
 13216 
 15656 
 13217 var classComponentUpdater = {
 15657   function startTransition(setPending, config, callback) {
 13218   isMounted: isMounted,
 15658     var priorityLevel = getCurrentPriorityLevel();
 13219   enqueueSetState: function (inst, payload, callback) {
 15659     runWithPriority$1(priorityLevel < UserBlockingPriority$1 ? UserBlockingPriority$1 : priorityLevel, function () {
 13220     var fiber = get(inst);
 15660       setPending(true);
 13221     var currentTime = requestCurrentTime();
 15661     });
       
 15662     runWithPriority$1(priorityLevel > NormalPriority ? NormalPriority : priorityLevel, function () {
       
 15663       var previousConfig = ReactCurrentBatchConfig$1.suspense;
       
 15664       ReactCurrentBatchConfig$1.suspense = config === undefined ? null : config;
       
 15665 
       
 15666       try {
       
 15667         setPending(false);
       
 15668         callback();
       
 15669       } finally {
       
 15670         ReactCurrentBatchConfig$1.suspense = previousConfig;
       
 15671       }
       
 15672     });
       
 15673   }
       
 15674 
       
 15675   function mountTransition(config) {
       
 15676     var _mountState2 = mountState(false),
       
 15677         isPending = _mountState2[0],
       
 15678         setPending = _mountState2[1];
       
 15679 
       
 15680     var start = mountCallback(startTransition.bind(null, setPending, config), [setPending, config]);
       
 15681     return [start, isPending];
       
 15682   }
       
 15683 
       
 15684   function updateTransition(config) {
       
 15685     var _updateState2 = updateState(),
       
 15686         isPending = _updateState2[0],
       
 15687         setPending = _updateState2[1];
       
 15688 
       
 15689     var start = updateCallback(startTransition.bind(null, setPending, config), [setPending, config]);
       
 15690     return [start, isPending];
       
 15691   }
       
 15692 
       
 15693   function rerenderTransition(config) {
       
 15694     var _rerenderState2 = rerenderState(),
       
 15695         isPending = _rerenderState2[0],
       
 15696         setPending = _rerenderState2[1];
       
 15697 
       
 15698     var start = updateCallback(startTransition.bind(null, setPending, config), [setPending, config]);
       
 15699     return [start, isPending];
       
 15700   }
       
 15701 
       
 15702   function dispatchAction(fiber, queue, action) {
       
 15703     {
       
 15704       if (typeof arguments[3] === 'function') {
       
 15705         error("State updates from the useState() and useReducer() Hooks don't support the " + 'second callback argument. To execute a side effect after ' + 'rendering, declare it in the component body with useEffect().');
       
 15706       }
       
 15707     }
       
 15708 
       
 15709     var currentTime = requestCurrentTimeForUpdate();
 13222     var suspenseConfig = requestCurrentSuspenseConfig();
 15710     var suspenseConfig = requestCurrentSuspenseConfig();
 13223     var expirationTime = computeExpirationForFiber(currentTime, fiber, suspenseConfig);
 15711     var expirationTime = computeExpirationForFiber(currentTime, fiber, suspenseConfig);
 13224 
       
 13225     var update = createUpdate(expirationTime, suspenseConfig);
       
 13226     update.payload = payload;
       
 13227     if (callback !== undefined && callback !== null) {
       
 13228       {
       
 13229         warnOnInvalidCallback$1(callback, 'setState');
       
 13230       }
       
 13231       update.callback = callback;
       
 13232     }
       
 13233 
       
 13234     if (revertPassiveEffectsChange) {
       
 13235       flushPassiveEffects();
       
 13236     }
       
 13237     enqueueUpdate(fiber, update);
       
 13238     scheduleWork(fiber, expirationTime);
       
 13239   },
       
 13240   enqueueReplaceState: function (inst, payload, callback) {
       
 13241     var fiber = get(inst);
       
 13242     var currentTime = requestCurrentTime();
       
 13243     var suspenseConfig = requestCurrentSuspenseConfig();
       
 13244     var expirationTime = computeExpirationForFiber(currentTime, fiber, suspenseConfig);
       
 13245 
       
 13246     var update = createUpdate(expirationTime, suspenseConfig);
       
 13247     update.tag = ReplaceState;
       
 13248     update.payload = payload;
       
 13249 
       
 13250     if (callback !== undefined && callback !== null) {
       
 13251       {
       
 13252         warnOnInvalidCallback$1(callback, 'replaceState');
       
 13253       }
       
 13254       update.callback = callback;
       
 13255     }
       
 13256 
       
 13257     if (revertPassiveEffectsChange) {
       
 13258       flushPassiveEffects();
       
 13259     }
       
 13260     enqueueUpdate(fiber, update);
       
 13261     scheduleWork(fiber, expirationTime);
       
 13262   },
       
 13263   enqueueForceUpdate: function (inst, callback) {
       
 13264     var fiber = get(inst);
       
 13265     var currentTime = requestCurrentTime();
       
 13266     var suspenseConfig = requestCurrentSuspenseConfig();
       
 13267     var expirationTime = computeExpirationForFiber(currentTime, fiber, suspenseConfig);
       
 13268 
       
 13269     var update = createUpdate(expirationTime, suspenseConfig);
       
 13270     update.tag = ForceUpdate;
       
 13271 
       
 13272     if (callback !== undefined && callback !== null) {
       
 13273       {
       
 13274         warnOnInvalidCallback$1(callback, 'forceUpdate');
       
 13275       }
       
 13276       update.callback = callback;
       
 13277     }
       
 13278 
       
 13279     if (revertPassiveEffectsChange) {
       
 13280       flushPassiveEffects();
       
 13281     }
       
 13282     enqueueUpdate(fiber, update);
       
 13283     scheduleWork(fiber, expirationTime);
       
 13284   }
       
 13285 };
       
 13286 
       
 13287 function checkShouldComponentUpdate(workInProgress, ctor, oldProps, newProps, oldState, newState, nextContext) {
       
 13288   var instance = workInProgress.stateNode;
       
 13289   if (typeof instance.shouldComponentUpdate === 'function') {
       
 13290     startPhaseTimer(workInProgress, 'shouldComponentUpdate');
       
 13291     var shouldUpdate = instance.shouldComponentUpdate(newProps, newState, nextContext);
       
 13292     stopPhaseTimer();
       
 13293 
       
 13294     {
       
 13295       !(shouldUpdate !== undefined) ? warningWithoutStack$1(false, '%s.shouldComponentUpdate(): Returned undefined instead of a ' + 'boolean value. Make sure to return true or false.', getComponentName(ctor) || 'Component') : void 0;
       
 13296     }
       
 13297 
       
 13298     return shouldUpdate;
       
 13299   }
       
 13300 
       
 13301   if (ctor.prototype && ctor.prototype.isPureReactComponent) {
       
 13302     return !shallowEqual(oldProps, newProps) || !shallowEqual(oldState, newState);
       
 13303   }
       
 13304 
       
 13305   return true;
       
 13306 }
       
 13307 
       
 13308 function checkClassInstance(workInProgress, ctor, newProps) {
       
 13309   var instance = workInProgress.stateNode;
       
 13310   {
       
 13311     var name = getComponentName(ctor) || 'Component';
       
 13312     var renderPresent = instance.render;
       
 13313 
       
 13314     if (!renderPresent) {
       
 13315       if (ctor.prototype && typeof ctor.prototype.render === 'function') {
       
 13316         warningWithoutStack$1(false, '%s(...): No `render` method found on the returned component ' + 'instance: did you accidentally return an object from the constructor?', name);
       
 13317       } else {
       
 13318         warningWithoutStack$1(false, '%s(...): No `render` method found on the returned component ' + 'instance: you may have forgotten to define `render`.', name);
       
 13319       }
       
 13320     }
       
 13321 
       
 13322     var noGetInitialStateOnES6 = !instance.getInitialState || instance.getInitialState.isReactClassApproved || instance.state;
       
 13323     !noGetInitialStateOnES6 ? warningWithoutStack$1(false, 'getInitialState was defined on %s, a plain JavaScript class. ' + 'This is only supported for classes created using React.createClass. ' + 'Did you mean to define a state property instead?', name) : void 0;
       
 13324     var noGetDefaultPropsOnES6 = !instance.getDefaultProps || instance.getDefaultProps.isReactClassApproved;
       
 13325     !noGetDefaultPropsOnES6 ? warningWithoutStack$1(false, 'getDefaultProps was defined on %s, a plain JavaScript class. ' + 'This is only supported for classes created using React.createClass. ' + 'Use a static property to define defaultProps instead.', name) : void 0;
       
 13326     var noInstancePropTypes = !instance.propTypes;
       
 13327     !noInstancePropTypes ? warningWithoutStack$1(false, 'propTypes was defined as an instance property on %s. Use a static ' + 'property to define propTypes instead.', name) : void 0;
       
 13328     var noInstanceContextType = !instance.contextType;
       
 13329     !noInstanceContextType ? warningWithoutStack$1(false, 'contextType was defined as an instance property on %s. Use a static ' + 'property to define contextType instead.', name) : void 0;
       
 13330 
       
 13331     if (disableLegacyContext) {
       
 13332       if (ctor.childContextTypes) {
       
 13333         warningWithoutStack$1(false, '%s uses the legacy childContextTypes API which is no longer supported. ' + 'Use React.createContext() instead.', name);
       
 13334       }
       
 13335       if (ctor.contextTypes) {
       
 13336         warningWithoutStack$1(false, '%s uses the legacy contextTypes API which is no longer supported. ' + 'Use React.createContext() with static contextType instead.', name);
       
 13337       }
       
 13338     } else {
       
 13339       var noInstanceContextTypes = !instance.contextTypes;
       
 13340       !noInstanceContextTypes ? warningWithoutStack$1(false, 'contextTypes was defined as an instance property on %s. Use a static ' + 'property to define contextTypes instead.', name) : void 0;
       
 13341 
       
 13342       if (ctor.contextType && ctor.contextTypes && !didWarnAboutContextTypeAndContextTypes.has(ctor)) {
       
 13343         didWarnAboutContextTypeAndContextTypes.add(ctor);
       
 13344         warningWithoutStack$1(false, '%s declares both contextTypes and contextType static properties. ' + 'The legacy contextTypes property will be ignored.', name);
       
 13345       }
       
 13346     }
       
 13347 
       
 13348     var noComponentShouldUpdate = typeof instance.componentShouldUpdate !== 'function';
       
 13349     !noComponentShouldUpdate ? warningWithoutStack$1(false, '%s has a method called ' + 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' + 'The name is phrased as a question because the function is ' + 'expected to return a value.', name) : void 0;
       
 13350     if (ctor.prototype && ctor.prototype.isPureReactComponent && typeof instance.shouldComponentUpdate !== 'undefined') {
       
 13351       warningWithoutStack$1(false, '%s has a method called shouldComponentUpdate(). ' + 'shouldComponentUpdate should not be used when extending React.PureComponent. ' + 'Please extend React.Component if shouldComponentUpdate is used.', getComponentName(ctor) || 'A pure component');
       
 13352     }
       
 13353     var noComponentDidUnmount = typeof instance.componentDidUnmount !== 'function';
       
 13354     !noComponentDidUnmount ? warningWithoutStack$1(false, '%s has a method called ' + 'componentDidUnmount(). But there is no such lifecycle method. ' + 'Did you mean componentWillUnmount()?', name) : void 0;
       
 13355     var noComponentDidReceiveProps = typeof instance.componentDidReceiveProps !== 'function';
       
 13356     !noComponentDidReceiveProps ? warningWithoutStack$1(false, '%s has a method called ' + 'componentDidReceiveProps(). But there is no such lifecycle method. ' + 'If you meant to update the state in response to changing props, ' + 'use componentWillReceiveProps(). If you meant to fetch data or ' + 'run side-effects or mutations after React has updated the UI, use componentDidUpdate().', name) : void 0;
       
 13357     var noComponentWillRecieveProps = typeof instance.componentWillRecieveProps !== 'function';
       
 13358     !noComponentWillRecieveProps ? warningWithoutStack$1(false, '%s has a method called ' + 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', name) : void 0;
       
 13359     var noUnsafeComponentWillRecieveProps = typeof instance.UNSAFE_componentWillRecieveProps !== 'function';
       
 13360     !noUnsafeComponentWillRecieveProps ? warningWithoutStack$1(false, '%s has a method called ' + 'UNSAFE_componentWillRecieveProps(). Did you mean UNSAFE_componentWillReceiveProps()?', name) : void 0;
       
 13361     var hasMutatedProps = instance.props !== newProps;
       
 13362     !(instance.props === undefined || !hasMutatedProps) ? warningWithoutStack$1(false, '%s(...): When calling super() in `%s`, make sure to pass ' + "up the same props that your component's constructor was passed.", name, name) : void 0;
       
 13363     var noInstanceDefaultProps = !instance.defaultProps;
       
 13364     !noInstanceDefaultProps ? warningWithoutStack$1(false, 'Setting defaultProps as an instance property on %s is not supported and will be ignored.' + ' Instead, define defaultProps as a static property on %s.', name, name) : void 0;
       
 13365 
       
 13366     if (typeof instance.getSnapshotBeforeUpdate === 'function' && typeof instance.componentDidUpdate !== 'function' && !didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate.has(ctor)) {
       
 13367       didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate.add(ctor);
       
 13368       warningWithoutStack$1(false, '%s: getSnapshotBeforeUpdate() should be used with componentDidUpdate(). ' + 'This component defines getSnapshotBeforeUpdate() only.', getComponentName(ctor));
       
 13369     }
       
 13370 
       
 13371     var noInstanceGetDerivedStateFromProps = typeof instance.getDerivedStateFromProps !== 'function';
       
 13372     !noInstanceGetDerivedStateFromProps ? warningWithoutStack$1(false, '%s: getDerivedStateFromProps() is defined as an instance method ' + 'and will be ignored. Instead, declare it as a static method.', name) : void 0;
       
 13373     var noInstanceGetDerivedStateFromCatch = typeof instance.getDerivedStateFromError !== 'function';
       
 13374     !noInstanceGetDerivedStateFromCatch ? warningWithoutStack$1(false, '%s: getDerivedStateFromError() is defined as an instance method ' + 'and will be ignored. Instead, declare it as a static method.', name) : void 0;
       
 13375     var noStaticGetSnapshotBeforeUpdate = typeof ctor.getSnapshotBeforeUpdate !== 'function';
       
 13376     !noStaticGetSnapshotBeforeUpdate ? warningWithoutStack$1(false, '%s: getSnapshotBeforeUpdate() is defined as a static method ' + 'and will be ignored. Instead, declare it as an instance method.', name) : void 0;
       
 13377     var _state = instance.state;
       
 13378     if (_state && (typeof _state !== 'object' || isArray$1(_state))) {
       
 13379       warningWithoutStack$1(false, '%s.state: must be set to an object or null', name);
       
 13380     }
       
 13381     if (typeof instance.getChildContext === 'function') {
       
 13382       !(typeof ctor.childContextTypes === 'object') ? warningWithoutStack$1(false, '%s.getChildContext(): childContextTypes must be defined in order to ' + 'use getChildContext().', name) : void 0;
       
 13383     }
       
 13384   }
       
 13385 }
       
 13386 
       
 13387 function adoptClassInstance(workInProgress, instance) {
       
 13388   instance.updater = classComponentUpdater;
       
 13389   workInProgress.stateNode = instance;
       
 13390   // The instance needs access to the fiber so that it can schedule updates
       
 13391   set(instance, workInProgress);
       
 13392   {
       
 13393     instance._reactInternalInstance = fakeInternalInstance;
       
 13394   }
       
 13395 }
       
 13396 
       
 13397 function constructClassInstance(workInProgress, ctor, props, renderExpirationTime) {
       
 13398   var isLegacyContextConsumer = false;
       
 13399   var unmaskedContext = emptyContextObject;
       
 13400   var context = emptyContextObject;
       
 13401   var contextType = ctor.contextType;
       
 13402 
       
 13403   {
       
 13404     if ('contextType' in ctor) {
       
 13405       var isValid =
       
 13406       // Allow null for conditional declaration
       
 13407       contextType === null || contextType !== undefined && contextType.$$typeof === REACT_CONTEXT_TYPE && contextType._context === undefined; // Not a <Context.Consumer>
       
 13408 
       
 13409       if (!isValid && !didWarnAboutInvalidateContextType.has(ctor)) {
       
 13410         didWarnAboutInvalidateContextType.add(ctor);
       
 13411 
       
 13412         var addendum = '';
       
 13413         if (contextType === undefined) {
       
 13414           addendum = ' However, it is set to undefined. ' + 'This can be caused by a typo or by mixing up named and default imports. ' + 'This can also happen due to a circular dependency, so ' + 'try moving the createContext() call to a separate file.';
       
 13415         } else if (typeof contextType !== 'object') {
       
 13416           addendum = ' However, it is set to a ' + typeof contextType + '.';
       
 13417         } else if (contextType.$$typeof === REACT_PROVIDER_TYPE) {
       
 13418           addendum = ' Did you accidentally pass the Context.Provider instead?';
       
 13419         } else if (contextType._context !== undefined) {
       
 13420           // <Context.Consumer>
       
 13421           addendum = ' Did you accidentally pass the Context.Consumer instead?';
       
 13422         } else {
       
 13423           addendum = ' However, it is set to an object with keys {' + Object.keys(contextType).join(', ') + '}.';
       
 13424         }
       
 13425         warningWithoutStack$1(false, '%s defines an invalid contextType. ' + 'contextType should point to the Context object returned by React.createContext().%s', getComponentName(ctor) || 'Component', addendum);
       
 13426       }
       
 13427     }
       
 13428   }
       
 13429 
       
 13430   if (typeof contextType === 'object' && contextType !== null) {
       
 13431     context = readContext(contextType);
       
 13432   } else if (!disableLegacyContext) {
       
 13433     unmaskedContext = getUnmaskedContext(workInProgress, ctor, true);
       
 13434     var contextTypes = ctor.contextTypes;
       
 13435     isLegacyContextConsumer = contextTypes !== null && contextTypes !== undefined;
       
 13436     context = isLegacyContextConsumer ? getMaskedContext(workInProgress, unmaskedContext) : emptyContextObject;
       
 13437   }
       
 13438 
       
 13439   // Instantiate twice to help detect side-effects.
       
 13440   {
       
 13441     if (debugRenderPhaseSideEffects || debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
       
 13442       new ctor(props, context); // eslint-disable-line no-new
       
 13443     }
       
 13444   }
       
 13445 
       
 13446   var instance = new ctor(props, context);
       
 13447   var state = workInProgress.memoizedState = instance.state !== null && instance.state !== undefined ? instance.state : null;
       
 13448   adoptClassInstance(workInProgress, instance);
       
 13449 
       
 13450   {
       
 13451     if (typeof ctor.getDerivedStateFromProps === 'function' && state === null) {
       
 13452       var componentName = getComponentName(ctor) || 'Component';
       
 13453       if (!didWarnAboutUninitializedState.has(componentName)) {
       
 13454         didWarnAboutUninitializedState.add(componentName);
       
 13455         warningWithoutStack$1(false, '`%s` uses `getDerivedStateFromProps` but its initial state is ' + '%s. This is not recommended. Instead, define the initial state by ' + 'assigning an object to `this.state` in the constructor of `%s`. ' + 'This ensures that `getDerivedStateFromProps` arguments have a consistent shape.', componentName, instance.state === null ? 'null' : 'undefined', componentName);
       
 13456       }
       
 13457     }
       
 13458 
       
 13459     // If new component APIs are defined, "unsafe" lifecycles won't be called.
       
 13460     // Warn about these lifecycles if they are present.
       
 13461     // Don't warn about react-lifecycles-compat polyfilled methods though.
       
 13462     if (typeof ctor.getDerivedStateFromProps === 'function' || typeof instance.getSnapshotBeforeUpdate === 'function') {
       
 13463       var foundWillMountName = null;
       
 13464       var foundWillReceivePropsName = null;
       
 13465       var foundWillUpdateName = null;
       
 13466       if (typeof instance.componentWillMount === 'function' && instance.componentWillMount.__suppressDeprecationWarning !== true) {
       
 13467         foundWillMountName = 'componentWillMount';
       
 13468       } else if (typeof instance.UNSAFE_componentWillMount === 'function') {
       
 13469         foundWillMountName = 'UNSAFE_componentWillMount';
       
 13470       }
       
 13471       if (typeof instance.componentWillReceiveProps === 'function' && instance.componentWillReceiveProps.__suppressDeprecationWarning !== true) {
       
 13472         foundWillReceivePropsName = 'componentWillReceiveProps';
       
 13473       } else if (typeof instance.UNSAFE_componentWillReceiveProps === 'function') {
       
 13474         foundWillReceivePropsName = 'UNSAFE_componentWillReceiveProps';
       
 13475       }
       
 13476       if (typeof instance.componentWillUpdate === 'function' && instance.componentWillUpdate.__suppressDeprecationWarning !== true) {
       
 13477         foundWillUpdateName = 'componentWillUpdate';
       
 13478       } else if (typeof instance.UNSAFE_componentWillUpdate === 'function') {
       
 13479         foundWillUpdateName = 'UNSAFE_componentWillUpdate';
       
 13480       }
       
 13481       if (foundWillMountName !== null || foundWillReceivePropsName !== null || foundWillUpdateName !== null) {
       
 13482         var _componentName = getComponentName(ctor) || 'Component';
       
 13483         var newApiName = typeof ctor.getDerivedStateFromProps === 'function' ? 'getDerivedStateFromProps()' : 'getSnapshotBeforeUpdate()';
       
 13484         if (!didWarnAboutLegacyLifecyclesAndDerivedState.has(_componentName)) {
       
 13485           didWarnAboutLegacyLifecyclesAndDerivedState.add(_componentName);
       
 13486           warningWithoutStack$1(false, 'Unsafe legacy lifecycles will not be called for components using new component APIs.\n\n' + '%s uses %s but also contains the following legacy lifecycles:%s%s%s\n\n' + 'The above lifecycles should be removed. Learn more about this warning here:\n' + 'https://fb.me/react-async-component-lifecycle-hooks', _componentName, newApiName, foundWillMountName !== null ? '\n  ' + foundWillMountName : '', foundWillReceivePropsName !== null ? '\n  ' + foundWillReceivePropsName : '', foundWillUpdateName !== null ? '\n  ' + foundWillUpdateName : '');
       
 13487         }
       
 13488       }
       
 13489     }
       
 13490   }
       
 13491 
       
 13492   // Cache unmasked context so we can avoid recreating masked context unless necessary.
       
 13493   // ReactFiberContext usually updates this cache but can't for newly-created instances.
       
 13494   if (isLegacyContextConsumer) {
       
 13495     cacheContext(workInProgress, unmaskedContext, context);
       
 13496   }
       
 13497 
       
 13498   return instance;
       
 13499 }
       
 13500 
       
 13501 function callComponentWillMount(workInProgress, instance) {
       
 13502   startPhaseTimer(workInProgress, 'componentWillMount');
       
 13503   var oldState = instance.state;
       
 13504 
       
 13505   if (typeof instance.componentWillMount === 'function') {
       
 13506     instance.componentWillMount();
       
 13507   }
       
 13508   if (typeof instance.UNSAFE_componentWillMount === 'function') {
       
 13509     instance.UNSAFE_componentWillMount();
       
 13510   }
       
 13511 
       
 13512   stopPhaseTimer();
       
 13513 
       
 13514   if (oldState !== instance.state) {
       
 13515     {
       
 13516       warningWithoutStack$1(false, '%s.componentWillMount(): Assigning directly to this.state is ' + "deprecated (except inside a component's " + 'constructor). Use setState instead.', getComponentName(workInProgress.type) || 'Component');
       
 13517     }
       
 13518     classComponentUpdater.enqueueReplaceState(instance, instance.state, null);
       
 13519   }
       
 13520 }
       
 13521 
       
 13522 function callComponentWillReceiveProps(workInProgress, instance, newProps, nextContext) {
       
 13523   var oldState = instance.state;
       
 13524   startPhaseTimer(workInProgress, 'componentWillReceiveProps');
       
 13525   if (typeof instance.componentWillReceiveProps === 'function') {
       
 13526     instance.componentWillReceiveProps(newProps, nextContext);
       
 13527   }
       
 13528   if (typeof instance.UNSAFE_componentWillReceiveProps === 'function') {
       
 13529     instance.UNSAFE_componentWillReceiveProps(newProps, nextContext);
       
 13530   }
       
 13531   stopPhaseTimer();
       
 13532 
       
 13533   if (instance.state !== oldState) {
       
 13534     {
       
 13535       var componentName = getComponentName(workInProgress.type) || 'Component';
       
 13536       if (!didWarnAboutStateAssignmentForComponent.has(componentName)) {
       
 13537         didWarnAboutStateAssignmentForComponent.add(componentName);
       
 13538         warningWithoutStack$1(false, '%s.componentWillReceiveProps(): Assigning directly to ' + "this.state is deprecated (except inside a component's " + 'constructor). Use setState instead.', componentName);
       
 13539       }
       
 13540     }
       
 13541     classComponentUpdater.enqueueReplaceState(instance, instance.state, null);
       
 13542   }
       
 13543 }
       
 13544 
       
 13545 // Invokes the mount life-cycles on a previously never rendered instance.
       
 13546 function mountClassInstance(workInProgress, ctor, newProps, renderExpirationTime) {
       
 13547   {
       
 13548     checkClassInstance(workInProgress, ctor, newProps);
       
 13549   }
       
 13550 
       
 13551   var instance = workInProgress.stateNode;
       
 13552   instance.props = newProps;
       
 13553   instance.state = workInProgress.memoizedState;
       
 13554   instance.refs = emptyRefsObject;
       
 13555 
       
 13556   var contextType = ctor.contextType;
       
 13557   if (typeof contextType === 'object' && contextType !== null) {
       
 13558     instance.context = readContext(contextType);
       
 13559   } else if (disableLegacyContext) {
       
 13560     instance.context = emptyContextObject;
       
 13561   } else {
       
 13562     var unmaskedContext = getUnmaskedContext(workInProgress, ctor, true);
       
 13563     instance.context = getMaskedContext(workInProgress, unmaskedContext);
       
 13564   }
       
 13565 
       
 13566   {
       
 13567     if (instance.state === newProps) {
       
 13568       var componentName = getComponentName(ctor) || 'Component';
       
 13569       if (!didWarnAboutDirectlyAssigningPropsToState.has(componentName)) {
       
 13570         didWarnAboutDirectlyAssigningPropsToState.add(componentName);
       
 13571         warningWithoutStack$1(false, '%s: It is not recommended to assign props directly to state ' + "because updates to props won't be reflected in state. " + 'In most cases, it is better to use props directly.', componentName);
       
 13572       }
       
 13573     }
       
 13574 
       
 13575     if (workInProgress.mode & StrictMode) {
       
 13576       ReactStrictModeWarnings.recordLegacyContextWarning(workInProgress, instance);
       
 13577     }
       
 13578 
       
 13579     if (warnAboutDeprecatedLifecycles) {
       
 13580       ReactStrictModeWarnings.recordUnsafeLifecycleWarnings(workInProgress, instance);
       
 13581     }
       
 13582   }
       
 13583 
       
 13584   var updateQueue = workInProgress.updateQueue;
       
 13585   if (updateQueue !== null) {
       
 13586     processUpdateQueue(workInProgress, updateQueue, newProps, instance, renderExpirationTime);
       
 13587     instance.state = workInProgress.memoizedState;
       
 13588   }
       
 13589 
       
 13590   var getDerivedStateFromProps = ctor.getDerivedStateFromProps;
       
 13591   if (typeof getDerivedStateFromProps === 'function') {
       
 13592     applyDerivedStateFromProps(workInProgress, ctor, getDerivedStateFromProps, newProps);
       
 13593     instance.state = workInProgress.memoizedState;
       
 13594   }
       
 13595 
       
 13596   // In order to support react-lifecycles-compat polyfilled components,
       
 13597   // Unsafe lifecycles should not be invoked for components using the new APIs.
       
 13598   if (typeof ctor.getDerivedStateFromProps !== 'function' && typeof instance.getSnapshotBeforeUpdate !== 'function' && (typeof instance.UNSAFE_componentWillMount === 'function' || typeof instance.componentWillMount === 'function')) {
       
 13599     callComponentWillMount(workInProgress, instance);
       
 13600     // If we had additional state updates during this life-cycle, let's
       
 13601     // process them now.
       
 13602     updateQueue = workInProgress.updateQueue;
       
 13603     if (updateQueue !== null) {
       
 13604       processUpdateQueue(workInProgress, updateQueue, newProps, instance, renderExpirationTime);
       
 13605       instance.state = workInProgress.memoizedState;
       
 13606     }
       
 13607   }
       
 13608 
       
 13609   if (typeof instance.componentDidMount === 'function') {
       
 13610     workInProgress.effectTag |= Update;
       
 13611   }
       
 13612 }
       
 13613 
       
 13614 function resumeMountClassInstance(workInProgress, ctor, newProps, renderExpirationTime) {
       
 13615   var instance = workInProgress.stateNode;
       
 13616 
       
 13617   var oldProps = workInProgress.memoizedProps;
       
 13618   instance.props = oldProps;
       
 13619 
       
 13620   var oldContext = instance.context;
       
 13621   var contextType = ctor.contextType;
       
 13622   var nextContext = emptyContextObject;
       
 13623   if (typeof contextType === 'object' && contextType !== null) {
       
 13624     nextContext = readContext(contextType);
       
 13625   } else if (!disableLegacyContext) {
       
 13626     var nextLegacyUnmaskedContext = getUnmaskedContext(workInProgress, ctor, true);
       
 13627     nextContext = getMaskedContext(workInProgress, nextLegacyUnmaskedContext);
       
 13628   }
       
 13629 
       
 13630   var getDerivedStateFromProps = ctor.getDerivedStateFromProps;
       
 13631   var hasNewLifecycles = typeof getDerivedStateFromProps === 'function' || typeof instance.getSnapshotBeforeUpdate === 'function';
       
 13632 
       
 13633   // Note: During these life-cycles, instance.props/instance.state are what
       
 13634   // ever the previously attempted to render - not the "current". However,
       
 13635   // during componentDidUpdate we pass the "current" props.
       
 13636 
       
 13637   // In order to support react-lifecycles-compat polyfilled components,
       
 13638   // Unsafe lifecycles should not be invoked for components using the new APIs.
       
 13639   if (!hasNewLifecycles && (typeof instance.UNSAFE_componentWillReceiveProps === 'function' || typeof instance.componentWillReceiveProps === 'function')) {
       
 13640     if (oldProps !== newProps || oldContext !== nextContext) {
       
 13641       callComponentWillReceiveProps(workInProgress, instance, newProps, nextContext);
       
 13642     }
       
 13643   }
       
 13644 
       
 13645   resetHasForceUpdateBeforeProcessing();
       
 13646 
       
 13647   var oldState = workInProgress.memoizedState;
       
 13648   var newState = instance.state = oldState;
       
 13649   var updateQueue = workInProgress.updateQueue;
       
 13650   if (updateQueue !== null) {
       
 13651     processUpdateQueue(workInProgress, updateQueue, newProps, instance, renderExpirationTime);
       
 13652     newState = workInProgress.memoizedState;
       
 13653   }
       
 13654   if (oldProps === newProps && oldState === newState && !hasContextChanged() && !checkHasForceUpdateAfterProcessing()) {
       
 13655     // If an update was already in progress, we should schedule an Update
       
 13656     // effect even though we're bailing out, so that cWU/cDU are called.
       
 13657     if (typeof instance.componentDidMount === 'function') {
       
 13658       workInProgress.effectTag |= Update;
       
 13659     }
       
 13660     return false;
       
 13661   }
       
 13662 
       
 13663   if (typeof getDerivedStateFromProps === 'function') {
       
 13664     applyDerivedStateFromProps(workInProgress, ctor, getDerivedStateFromProps, newProps);
       
 13665     newState = workInProgress.memoizedState;
       
 13666   }
       
 13667 
       
 13668   var shouldUpdate = checkHasForceUpdateAfterProcessing() || checkShouldComponentUpdate(workInProgress, ctor, oldProps, newProps, oldState, newState, nextContext);
       
 13669 
       
 13670   if (shouldUpdate) {
       
 13671     // In order to support react-lifecycles-compat polyfilled components,
       
 13672     // Unsafe lifecycles should not be invoked for components using the new APIs.
       
 13673     if (!hasNewLifecycles && (typeof instance.UNSAFE_componentWillMount === 'function' || typeof instance.componentWillMount === 'function')) {
       
 13674       startPhaseTimer(workInProgress, 'componentWillMount');
       
 13675       if (typeof instance.componentWillMount === 'function') {
       
 13676         instance.componentWillMount();
       
 13677       }
       
 13678       if (typeof instance.UNSAFE_componentWillMount === 'function') {
       
 13679         instance.UNSAFE_componentWillMount();
       
 13680       }
       
 13681       stopPhaseTimer();
       
 13682     }
       
 13683     if (typeof instance.componentDidMount === 'function') {
       
 13684       workInProgress.effectTag |= Update;
       
 13685     }
       
 13686   } else {
       
 13687     // If an update was already in progress, we should schedule an Update
       
 13688     // effect even though we're bailing out, so that cWU/cDU are called.
       
 13689     if (typeof instance.componentDidMount === 'function') {
       
 13690       workInProgress.effectTag |= Update;
       
 13691     }
       
 13692 
       
 13693     // If shouldComponentUpdate returned false, we should still update the
       
 13694     // memoized state to indicate that this work can be reused.
       
 13695     workInProgress.memoizedProps = newProps;
       
 13696     workInProgress.memoizedState = newState;
       
 13697   }
       
 13698 
       
 13699   // Update the existing instance's state, props, and context pointers even
       
 13700   // if shouldComponentUpdate returns false.
       
 13701   instance.props = newProps;
       
 13702   instance.state = newState;
       
 13703   instance.context = nextContext;
       
 13704 
       
 13705   return shouldUpdate;
       
 13706 }
       
 13707 
       
 13708 // Invokes the update life-cycles and returns false if it shouldn't rerender.
       
 13709 function updateClassInstance(current, workInProgress, ctor, newProps, renderExpirationTime) {
       
 13710   var instance = workInProgress.stateNode;
       
 13711 
       
 13712   var oldProps = workInProgress.memoizedProps;
       
 13713   instance.props = workInProgress.type === workInProgress.elementType ? oldProps : resolveDefaultProps(workInProgress.type, oldProps);
       
 13714 
       
 13715   var oldContext = instance.context;
       
 13716   var contextType = ctor.contextType;
       
 13717   var nextContext = emptyContextObject;
       
 13718   if (typeof contextType === 'object' && contextType !== null) {
       
 13719     nextContext = readContext(contextType);
       
 13720   } else if (!disableLegacyContext) {
       
 13721     var nextUnmaskedContext = getUnmaskedContext(workInProgress, ctor, true);
       
 13722     nextContext = getMaskedContext(workInProgress, nextUnmaskedContext);
       
 13723   }
       
 13724 
       
 13725   var getDerivedStateFromProps = ctor.getDerivedStateFromProps;
       
 13726   var hasNewLifecycles = typeof getDerivedStateFromProps === 'function' || typeof instance.getSnapshotBeforeUpdate === 'function';
       
 13727 
       
 13728   // Note: During these life-cycles, instance.props/instance.state are what
       
 13729   // ever the previously attempted to render - not the "current". However,
       
 13730   // during componentDidUpdate we pass the "current" props.
       
 13731 
       
 13732   // In order to support react-lifecycles-compat polyfilled components,
       
 13733   // Unsafe lifecycles should not be invoked for components using the new APIs.
       
 13734   if (!hasNewLifecycles && (typeof instance.UNSAFE_componentWillReceiveProps === 'function' || typeof instance.componentWillReceiveProps === 'function')) {
       
 13735     if (oldProps !== newProps || oldContext !== nextContext) {
       
 13736       callComponentWillReceiveProps(workInProgress, instance, newProps, nextContext);
       
 13737     }
       
 13738   }
       
 13739 
       
 13740   resetHasForceUpdateBeforeProcessing();
       
 13741 
       
 13742   var oldState = workInProgress.memoizedState;
       
 13743   var newState = instance.state = oldState;
       
 13744   var updateQueue = workInProgress.updateQueue;
       
 13745   if (updateQueue !== null) {
       
 13746     processUpdateQueue(workInProgress, updateQueue, newProps, instance, renderExpirationTime);
       
 13747     newState = workInProgress.memoizedState;
       
 13748   }
       
 13749 
       
 13750   if (oldProps === newProps && oldState === newState && !hasContextChanged() && !checkHasForceUpdateAfterProcessing()) {
       
 13751     // If an update was already in progress, we should schedule an Update
       
 13752     // effect even though we're bailing out, so that cWU/cDU are called.
       
 13753     if (typeof instance.componentDidUpdate === 'function') {
       
 13754       if (oldProps !== current.memoizedProps || oldState !== current.memoizedState) {
       
 13755         workInProgress.effectTag |= Update;
       
 13756       }
       
 13757     }
       
 13758     if (typeof instance.getSnapshotBeforeUpdate === 'function') {
       
 13759       if (oldProps !== current.memoizedProps || oldState !== current.memoizedState) {
       
 13760         workInProgress.effectTag |= Snapshot;
       
 13761       }
       
 13762     }
       
 13763     return false;
       
 13764   }
       
 13765 
       
 13766   if (typeof getDerivedStateFromProps === 'function') {
       
 13767     applyDerivedStateFromProps(workInProgress, ctor, getDerivedStateFromProps, newProps);
       
 13768     newState = workInProgress.memoizedState;
       
 13769   }
       
 13770 
       
 13771   var shouldUpdate = checkHasForceUpdateAfterProcessing() || checkShouldComponentUpdate(workInProgress, ctor, oldProps, newProps, oldState, newState, nextContext);
       
 13772 
       
 13773   if (shouldUpdate) {
       
 13774     // In order to support react-lifecycles-compat polyfilled components,
       
 13775     // Unsafe lifecycles should not be invoked for components using the new APIs.
       
 13776     if (!hasNewLifecycles && (typeof instance.UNSAFE_componentWillUpdate === 'function' || typeof instance.componentWillUpdate === 'function')) {
       
 13777       startPhaseTimer(workInProgress, 'componentWillUpdate');
       
 13778       if (typeof instance.componentWillUpdate === 'function') {
       
 13779         instance.componentWillUpdate(newProps, newState, nextContext);
       
 13780       }
       
 13781       if (typeof instance.UNSAFE_componentWillUpdate === 'function') {
       
 13782         instance.UNSAFE_componentWillUpdate(newProps, newState, nextContext);
       
 13783       }
       
 13784       stopPhaseTimer();
       
 13785     }
       
 13786     if (typeof instance.componentDidUpdate === 'function') {
       
 13787       workInProgress.effectTag |= Update;
       
 13788     }
       
 13789     if (typeof instance.getSnapshotBeforeUpdate === 'function') {
       
 13790       workInProgress.effectTag |= Snapshot;
       
 13791     }
       
 13792   } else {
       
 13793     // If an update was already in progress, we should schedule an Update
       
 13794     // effect even though we're bailing out, so that cWU/cDU are called.
       
 13795     if (typeof instance.componentDidUpdate === 'function') {
       
 13796       if (oldProps !== current.memoizedProps || oldState !== current.memoizedState) {
       
 13797         workInProgress.effectTag |= Update;
       
 13798       }
       
 13799     }
       
 13800     if (typeof instance.getSnapshotBeforeUpdate === 'function') {
       
 13801       if (oldProps !== current.memoizedProps || oldState !== current.memoizedState) {
       
 13802         workInProgress.effectTag |= Snapshot;
       
 13803       }
       
 13804     }
       
 13805 
       
 13806     // If shouldComponentUpdate returned false, we should still update the
       
 13807     // memoized props/state to indicate that this work can be reused.
       
 13808     workInProgress.memoizedProps = newProps;
       
 13809     workInProgress.memoizedState = newState;
       
 13810   }
       
 13811 
       
 13812   // Update the existing instance's state, props, and context pointers even
       
 13813   // if shouldComponentUpdate returns false.
       
 13814   instance.props = newProps;
       
 13815   instance.state = newState;
       
 13816   instance.context = nextContext;
       
 13817 
       
 13818   return shouldUpdate;
       
 13819 }
       
 13820 
       
 13821 var didWarnAboutMaps = void 0;
       
 13822 var didWarnAboutGenerators = void 0;
       
 13823 var didWarnAboutStringRefInStrictMode = void 0;
       
 13824 var ownerHasKeyUseWarning = void 0;
       
 13825 var ownerHasFunctionTypeWarning = void 0;
       
 13826 var warnForMissingKey = function (child) {};
       
 13827 
       
 13828 {
       
 13829   didWarnAboutMaps = false;
       
 13830   didWarnAboutGenerators = false;
       
 13831   didWarnAboutStringRefInStrictMode = {};
       
 13832 
       
 13833   /**
       
 13834    * Warn if there's no key explicitly set on dynamic arrays of children or
       
 13835    * object keys are not valid. This allows us to keep track of children between
       
 13836    * updates.
       
 13837    */
       
 13838   ownerHasKeyUseWarning = {};
       
 13839   ownerHasFunctionTypeWarning = {};
       
 13840 
       
 13841   warnForMissingKey = function (child) {
       
 13842     if (child === null || typeof child !== 'object') {
       
 13843       return;
       
 13844     }
       
 13845     if (!child._store || child._store.validated || child.key != null) {
       
 13846       return;
       
 13847     }
       
 13848     (function () {
       
 13849       if (!(typeof child._store === 'object')) {
       
 13850         {
       
 13851           throw ReactError(Error('React Component in warnForMissingKey should have a _store. This error is likely caused by a bug in React. Please file an issue.'));
       
 13852         }
       
 13853       }
       
 13854     })();
       
 13855     child._store.validated = true;
       
 13856 
       
 13857     var currentComponentErrorInfo = 'Each child in a list should have a unique ' + '"key" prop. See https://fb.me/react-warning-keys for ' + 'more information.' + getCurrentFiberStackInDev();
       
 13858     if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
       
 13859       return;
       
 13860     }
       
 13861     ownerHasKeyUseWarning[currentComponentErrorInfo] = true;
       
 13862 
       
 13863     warning$1(false, 'Each child in a list should have a unique ' + '"key" prop. See https://fb.me/react-warning-keys for ' + 'more information.');
       
 13864   };
       
 13865 }
       
 13866 
       
 13867 var isArray = Array.isArray;
       
 13868 
       
 13869 function coerceRef(returnFiber, current$$1, element) {
       
 13870   var mixedRef = element.ref;
       
 13871   if (mixedRef !== null && typeof mixedRef !== 'function' && typeof mixedRef !== 'object') {
       
 13872     {
       
 13873       if (returnFiber.mode & StrictMode) {
       
 13874         var componentName = getComponentName(returnFiber.type) || 'Component';
       
 13875         if (!didWarnAboutStringRefInStrictMode[componentName]) {
       
 13876           warningWithoutStack$1(false, 'A string ref, "%s", has been found within a strict mode tree. ' + 'String refs are a source of potential bugs and should be avoided. ' + 'We recommend using createRef() instead.' + '\n%s' + '\n\nLearn more about using refs safely here:' + '\nhttps://fb.me/react-strict-mode-string-ref', mixedRef, getStackByFiberInDevAndProd(returnFiber));
       
 13877           didWarnAboutStringRefInStrictMode[componentName] = true;
       
 13878         }
       
 13879       }
       
 13880     }
       
 13881 
       
 13882     if (element._owner) {
       
 13883       var owner = element._owner;
       
 13884       var inst = void 0;
       
 13885       if (owner) {
       
 13886         var ownerFiber = owner;
       
 13887         (function () {
       
 13888           if (!(ownerFiber.tag === ClassComponent)) {
       
 13889             {
       
 13890               throw ReactError(Error('Function components cannot have refs. Did you mean to use React.forwardRef()?'));
       
 13891             }
       
 13892           }
       
 13893         })();
       
 13894         inst = ownerFiber.stateNode;
       
 13895       }
       
 13896       (function () {
       
 13897         if (!inst) {
       
 13898           {
       
 13899             throw ReactError(Error('Missing owner for string ref ' + mixedRef + '. This error is likely caused by a bug in React. Please file an issue.'));
       
 13900           }
       
 13901         }
       
 13902       })();
       
 13903       var stringRef = '' + mixedRef;
       
 13904       // Check if previous string ref matches new string ref
       
 13905       if (current$$1 !== null && current$$1.ref !== null && typeof current$$1.ref === 'function' && current$$1.ref._stringRef === stringRef) {
       
 13906         return current$$1.ref;
       
 13907       }
       
 13908       var ref = function (value) {
       
 13909         var refs = inst.refs;
       
 13910         if (refs === emptyRefsObject) {
       
 13911           // This is a lazy pooled frozen object, so we need to initialize.
       
 13912           refs = inst.refs = {};
       
 13913         }
       
 13914         if (value === null) {
       
 13915           delete refs[stringRef];
       
 13916         } else {
       
 13917           refs[stringRef] = value;
       
 13918         }
       
 13919       };
       
 13920       ref._stringRef = stringRef;
       
 13921       return ref;
       
 13922     } else {
       
 13923       (function () {
       
 13924         if (!(typeof mixedRef === 'string')) {
       
 13925           {
       
 13926             throw ReactError(Error('Expected ref to be a function, a string, an object returned by React.createRef(), or null.'));
       
 13927           }
       
 13928         }
       
 13929       })();
       
 13930       (function () {
       
 13931         if (!element._owner) {
       
 13932           {
       
 13933             throw ReactError(Error('Element ref was specified as a string (' + mixedRef + ') but no owner was set. This could happen for one of the following reasons:\n1. You may be adding a ref to a function component\n2. You may be adding a ref to a component that was not created inside a component\'s render method\n3. You have multiple copies of React loaded\nSee https://fb.me/react-refs-must-have-owner for more information.'));
       
 13934           }
       
 13935         }
       
 13936       })();
       
 13937     }
       
 13938   }
       
 13939   return mixedRef;
       
 13940 }
       
 13941 
       
 13942 function throwOnInvalidObjectType(returnFiber, newChild) {
       
 13943   if (returnFiber.type !== 'textarea') {
       
 13944     var addendum = '';
       
 13945     {
       
 13946       addendum = ' If you meant to render a collection of children, use an array ' + 'instead.' + getCurrentFiberStackInDev();
       
 13947     }
       
 13948     (function () {
       
 13949       {
       
 13950         {
       
 13951           throw ReactError(Error('Objects are not valid as a React child (found: ' + (Object.prototype.toString.call(newChild) === '[object Object]' ? 'object with keys {' + Object.keys(newChild).join(', ') + '}' : newChild) + ').' + addendum));
       
 13952         }
       
 13953       }
       
 13954     })();
       
 13955   }
       
 13956 }
       
 13957 
       
 13958 function warnOnFunctionType() {
       
 13959   var currentComponentErrorInfo = 'Functions are not valid as a React child. This may happen if ' + 'you return a Component instead of <Component /> from render. ' + 'Or maybe you meant to call this function rather than return it.' + getCurrentFiberStackInDev();
       
 13960 
       
 13961   if (ownerHasFunctionTypeWarning[currentComponentErrorInfo]) {
       
 13962     return;
       
 13963   }
       
 13964   ownerHasFunctionTypeWarning[currentComponentErrorInfo] = true;
       
 13965 
       
 13966   warning$1(false, 'Functions are not valid as a React child. This may happen if ' + 'you return a Component instead of <Component /> from render. ' + 'Or maybe you meant to call this function rather than return it.');
       
 13967 }
       
 13968 
       
 13969 // This wrapper function exists because I expect to clone the code in each path
       
 13970 // to be able to optimize each path individually by branching early. This needs
       
 13971 // a compiler or we can do it manually. Helpers that don't need this branching
       
 13972 // live outside of this function.
       
 13973 function ChildReconciler(shouldTrackSideEffects) {
       
 13974   function deleteChild(returnFiber, childToDelete) {
       
 13975     if (!shouldTrackSideEffects) {
       
 13976       // Noop.
       
 13977       return;
       
 13978     }
       
 13979     // Deletions are added in reversed order so we add it to the front.
       
 13980     // At this point, the return fiber's effect list is empty except for
       
 13981     // deletions, so we can just append the deletion to the list. The remaining
       
 13982     // effects aren't added until the complete phase. Once we implement
       
 13983     // resuming, this may not be true.
       
 13984     var last = returnFiber.lastEffect;
       
 13985     if (last !== null) {
       
 13986       last.nextEffect = childToDelete;
       
 13987       returnFiber.lastEffect = childToDelete;
       
 13988     } else {
       
 13989       returnFiber.firstEffect = returnFiber.lastEffect = childToDelete;
       
 13990     }
       
 13991     childToDelete.nextEffect = null;
       
 13992     childToDelete.effectTag = Deletion;
       
 13993   }
       
 13994 
       
 13995   function deleteRemainingChildren(returnFiber, currentFirstChild) {
       
 13996     if (!shouldTrackSideEffects) {
       
 13997       // Noop.
       
 13998       return null;
       
 13999     }
       
 14000 
       
 14001     // TODO: For the shouldClone case, this could be micro-optimized a bit by
       
 14002     // assuming that after the first child we've already added everything.
       
 14003     var childToDelete = currentFirstChild;
       
 14004     while (childToDelete !== null) {
       
 14005       deleteChild(returnFiber, childToDelete);
       
 14006       childToDelete = childToDelete.sibling;
       
 14007     }
       
 14008     return null;
       
 14009   }
       
 14010 
       
 14011   function mapRemainingChildren(returnFiber, currentFirstChild) {
       
 14012     // Add the remaining children to a temporary map so that we can find them by
       
 14013     // keys quickly. Implicit (null) keys get added to this set with their index
       
 14014     var existingChildren = new Map();
       
 14015 
       
 14016     var existingChild = currentFirstChild;
       
 14017     while (existingChild !== null) {
       
 14018       if (existingChild.key !== null) {
       
 14019         existingChildren.set(existingChild.key, existingChild);
       
 14020       } else {
       
 14021         existingChildren.set(existingChild.index, existingChild);
       
 14022       }
       
 14023       existingChild = existingChild.sibling;
       
 14024     }
       
 14025     return existingChildren;
       
 14026   }
       
 14027 
       
 14028   function useFiber(fiber, pendingProps, expirationTime) {
       
 14029     // We currently set sibling to null and index to 0 here because it is easy
       
 14030     // to forget to do before returning it. E.g. for the single child case.
       
 14031     var clone = createWorkInProgress(fiber, pendingProps, expirationTime);
       
 14032     clone.index = 0;
       
 14033     clone.sibling = null;
       
 14034     return clone;
       
 14035   }
       
 14036 
       
 14037   function placeChild(newFiber, lastPlacedIndex, newIndex) {
       
 14038     newFiber.index = newIndex;
       
 14039     if (!shouldTrackSideEffects) {
       
 14040       // Noop.
       
 14041       return lastPlacedIndex;
       
 14042     }
       
 14043     var current$$1 = newFiber.alternate;
       
 14044     if (current$$1 !== null) {
       
 14045       var oldIndex = current$$1.index;
       
 14046       if (oldIndex < lastPlacedIndex) {
       
 14047         // This is a move.
       
 14048         newFiber.effectTag = Placement;
       
 14049         return lastPlacedIndex;
       
 14050       } else {
       
 14051         // This item can stay in place.
       
 14052         return oldIndex;
       
 14053       }
       
 14054     } else {
       
 14055       // This is an insertion.
       
 14056       newFiber.effectTag = Placement;
       
 14057       return lastPlacedIndex;
       
 14058     }
       
 14059   }
       
 14060 
       
 14061   function placeSingleChild(newFiber) {
       
 14062     // This is simpler for the single child case. We only need to do a
       
 14063     // placement for inserting new children.
       
 14064     if (shouldTrackSideEffects && newFiber.alternate === null) {
       
 14065       newFiber.effectTag = Placement;
       
 14066     }
       
 14067     return newFiber;
       
 14068   }
       
 14069 
       
 14070   function updateTextNode(returnFiber, current$$1, textContent, expirationTime) {
       
 14071     if (current$$1 === null || current$$1.tag !== HostText) {
       
 14072       // Insert
       
 14073       var created = createFiberFromText(textContent, returnFiber.mode, expirationTime);
       
 14074       created.return = returnFiber;
       
 14075       return created;
       
 14076     } else {
       
 14077       // Update
       
 14078       var existing = useFiber(current$$1, textContent, expirationTime);
       
 14079       existing.return = returnFiber;
       
 14080       return existing;
       
 14081     }
       
 14082   }
       
 14083 
       
 14084   function updateElement(returnFiber, current$$1, element, expirationTime) {
       
 14085     if (current$$1 !== null && (current$$1.elementType === element.type || (
       
 14086     // Keep this check inline so it only runs on the false path:
       
 14087     isCompatibleFamilyForHotReloading(current$$1, element)))) {
       
 14088       // Move based on index
       
 14089       var existing = useFiber(current$$1, element.props, expirationTime);
       
 14090       existing.ref = coerceRef(returnFiber, current$$1, element);
       
 14091       existing.return = returnFiber;
       
 14092       {
       
 14093         existing._debugSource = element._source;
       
 14094         existing._debugOwner = element._owner;
       
 14095       }
       
 14096       return existing;
       
 14097     } else {
       
 14098       // Insert
       
 14099       var created = createFiberFromElement(element, returnFiber.mode, expirationTime);
       
 14100       created.ref = coerceRef(returnFiber, current$$1, element);
       
 14101       created.return = returnFiber;
       
 14102       return created;
       
 14103     }
       
 14104   }
       
 14105 
       
 14106   function updatePortal(returnFiber, current$$1, portal, expirationTime) {
       
 14107     if (current$$1 === null || current$$1.tag !== HostPortal || current$$1.stateNode.containerInfo !== portal.containerInfo || current$$1.stateNode.implementation !== portal.implementation) {
       
 14108       // Insert
       
 14109       var created = createFiberFromPortal(portal, returnFiber.mode, expirationTime);
       
 14110       created.return = returnFiber;
       
 14111       return created;
       
 14112     } else {
       
 14113       // Update
       
 14114       var existing = useFiber(current$$1, portal.children || [], expirationTime);
       
 14115       existing.return = returnFiber;
       
 14116       return existing;
       
 14117     }
       
 14118   }
       
 14119 
       
 14120   function updateFragment(returnFiber, current$$1, fragment, expirationTime, key) {
       
 14121     if (current$$1 === null || current$$1.tag !== Fragment) {
       
 14122       // Insert
       
 14123       var created = createFiberFromFragment(fragment, returnFiber.mode, expirationTime, key);
       
 14124       created.return = returnFiber;
       
 14125       return created;
       
 14126     } else {
       
 14127       // Update
       
 14128       var existing = useFiber(current$$1, fragment, expirationTime);
       
 14129       existing.return = returnFiber;
       
 14130       return existing;
       
 14131     }
       
 14132   }
       
 14133 
       
 14134   function createChild(returnFiber, newChild, expirationTime) {
       
 14135     if (typeof newChild === 'string' || typeof newChild === 'number') {
       
 14136       // Text nodes don't have keys. If the previous node is implicitly keyed
       
 14137       // we can continue to replace it without aborting even if it is not a text
       
 14138       // node.
       
 14139       var created = createFiberFromText('' + newChild, returnFiber.mode, expirationTime);
       
 14140       created.return = returnFiber;
       
 14141       return created;
       
 14142     }
       
 14143 
       
 14144     if (typeof newChild === 'object' && newChild !== null) {
       
 14145       switch (newChild.$$typeof) {
       
 14146         case REACT_ELEMENT_TYPE:
       
 14147           {
       
 14148             var _created = createFiberFromElement(newChild, returnFiber.mode, expirationTime);
       
 14149             _created.ref = coerceRef(returnFiber, null, newChild);
       
 14150             _created.return = returnFiber;
       
 14151             return _created;
       
 14152           }
       
 14153         case REACT_PORTAL_TYPE:
       
 14154           {
       
 14155             var _created2 = createFiberFromPortal(newChild, returnFiber.mode, expirationTime);
       
 14156             _created2.return = returnFiber;
       
 14157             return _created2;
       
 14158           }
       
 14159       }
       
 14160 
       
 14161       if (isArray(newChild) || getIteratorFn(newChild)) {
       
 14162         var _created3 = createFiberFromFragment(newChild, returnFiber.mode, expirationTime, null);
       
 14163         _created3.return = returnFiber;
       
 14164         return _created3;
       
 14165       }
       
 14166 
       
 14167       throwOnInvalidObjectType(returnFiber, newChild);
       
 14168     }
       
 14169 
       
 14170     {
       
 14171       if (typeof newChild === 'function') {
       
 14172         warnOnFunctionType();
       
 14173       }
       
 14174     }
       
 14175 
       
 14176     return null;
       
 14177   }
       
 14178 
       
 14179   function updateSlot(returnFiber, oldFiber, newChild, expirationTime) {
       
 14180     // Update the fiber if the keys match, otherwise return null.
       
 14181 
       
 14182     var key = oldFiber !== null ? oldFiber.key : null;
       
 14183 
       
 14184     if (typeof newChild === 'string' || typeof newChild === 'number') {
       
 14185       // Text nodes don't have keys. If the previous node is implicitly keyed
       
 14186       // we can continue to replace it without aborting even if it is not a text
       
 14187       // node.
       
 14188       if (key !== null) {
       
 14189         return null;
       
 14190       }
       
 14191       return updateTextNode(returnFiber, oldFiber, '' + newChild, expirationTime);
       
 14192     }
       
 14193 
       
 14194     if (typeof newChild === 'object' && newChild !== null) {
       
 14195       switch (newChild.$$typeof) {
       
 14196         case REACT_ELEMENT_TYPE:
       
 14197           {
       
 14198             if (newChild.key === key) {
       
 14199               if (newChild.type === REACT_FRAGMENT_TYPE) {
       
 14200                 return updateFragment(returnFiber, oldFiber, newChild.props.children, expirationTime, key);
       
 14201               }
       
 14202               return updateElement(returnFiber, oldFiber, newChild, expirationTime);
       
 14203             } else {
       
 14204               return null;
       
 14205             }
       
 14206           }
       
 14207         case REACT_PORTAL_TYPE:
       
 14208           {
       
 14209             if (newChild.key === key) {
       
 14210               return updatePortal(returnFiber, oldFiber, newChild, expirationTime);
       
 14211             } else {
       
 14212               return null;
       
 14213             }
       
 14214           }
       
 14215       }
       
 14216 
       
 14217       if (isArray(newChild) || getIteratorFn(newChild)) {
       
 14218         if (key !== null) {
       
 14219           return null;
       
 14220         }
       
 14221 
       
 14222         return updateFragment(returnFiber, oldFiber, newChild, expirationTime, null);
       
 14223       }
       
 14224 
       
 14225       throwOnInvalidObjectType(returnFiber, newChild);
       
 14226     }
       
 14227 
       
 14228     {
       
 14229       if (typeof newChild === 'function') {
       
 14230         warnOnFunctionType();
       
 14231       }
       
 14232     }
       
 14233 
       
 14234     return null;
       
 14235   }
       
 14236 
       
 14237   function updateFromMap(existingChildren, returnFiber, newIdx, newChild, expirationTime) {
       
 14238     if (typeof newChild === 'string' || typeof newChild === 'number') {
       
 14239       // Text nodes don't have keys, so we neither have to check the old nor
       
 14240       // new node for the key. If both are text nodes, they match.
       
 14241       var matchedFiber = existingChildren.get(newIdx) || null;
       
 14242       return updateTextNode(returnFiber, matchedFiber, '' + newChild, expirationTime);
       
 14243     }
       
 14244 
       
 14245     if (typeof newChild === 'object' && newChild !== null) {
       
 14246       switch (newChild.$$typeof) {
       
 14247         case REACT_ELEMENT_TYPE:
       
 14248           {
       
 14249             var _matchedFiber = existingChildren.get(newChild.key === null ? newIdx : newChild.key) || null;
       
 14250             if (newChild.type === REACT_FRAGMENT_TYPE) {
       
 14251               return updateFragment(returnFiber, _matchedFiber, newChild.props.children, expirationTime, newChild.key);
       
 14252             }
       
 14253             return updateElement(returnFiber, _matchedFiber, newChild, expirationTime);
       
 14254           }
       
 14255         case REACT_PORTAL_TYPE:
       
 14256           {
       
 14257             var _matchedFiber2 = existingChildren.get(newChild.key === null ? newIdx : newChild.key) || null;
       
 14258             return updatePortal(returnFiber, _matchedFiber2, newChild, expirationTime);
       
 14259           }
       
 14260       }
       
 14261 
       
 14262       if (isArray(newChild) || getIteratorFn(newChild)) {
       
 14263         var _matchedFiber3 = existingChildren.get(newIdx) || null;
       
 14264         return updateFragment(returnFiber, _matchedFiber3, newChild, expirationTime, null);
       
 14265       }
       
 14266 
       
 14267       throwOnInvalidObjectType(returnFiber, newChild);
       
 14268     }
       
 14269 
       
 14270     {
       
 14271       if (typeof newChild === 'function') {
       
 14272         warnOnFunctionType();
       
 14273       }
       
 14274     }
       
 14275 
       
 14276     return null;
       
 14277   }
       
 14278 
       
 14279   /**
       
 14280    * Warns if there is a duplicate or missing key
       
 14281    */
       
 14282   function warnOnInvalidKey(child, knownKeys) {
       
 14283     {
       
 14284       if (typeof child !== 'object' || child === null) {
       
 14285         return knownKeys;
       
 14286       }
       
 14287       switch (child.$$typeof) {
       
 14288         case REACT_ELEMENT_TYPE:
       
 14289         case REACT_PORTAL_TYPE:
       
 14290           warnForMissingKey(child);
       
 14291           var key = child.key;
       
 14292           if (typeof key !== 'string') {
       
 14293             break;
       
 14294           }
       
 14295           if (knownKeys === null) {
       
 14296             knownKeys = new Set();
       
 14297             knownKeys.add(key);
       
 14298             break;
       
 14299           }
       
 14300           if (!knownKeys.has(key)) {
       
 14301             knownKeys.add(key);
       
 14302             break;
       
 14303           }
       
 14304           warning$1(false, 'Encountered two children with the same key, `%s`. ' + 'Keys should be unique so that components maintain their identity ' + 'across updates. Non-unique keys may cause children to be ' + 'duplicated and/or omitted — the behavior is unsupported and ' + 'could change in a future version.', key);
       
 14305           break;
       
 14306         default:
       
 14307           break;
       
 14308       }
       
 14309     }
       
 14310     return knownKeys;
       
 14311   }
       
 14312 
       
 14313   function reconcileChildrenArray(returnFiber, currentFirstChild, newChildren, expirationTime) {
       
 14314     // This algorithm can't optimize by searching from both ends since we
       
 14315     // don't have backpointers on fibers. I'm trying to see how far we can get
       
 14316     // with that model. If it ends up not being worth the tradeoffs, we can
       
 14317     // add it later.
       
 14318 
       
 14319     // Even with a two ended optimization, we'd want to optimize for the case
       
 14320     // where there are few changes and brute force the comparison instead of
       
 14321     // going for the Map. It'd like to explore hitting that path first in
       
 14322     // forward-only mode and only go for the Map once we notice that we need
       
 14323     // lots of look ahead. This doesn't handle reversal as well as two ended
       
 14324     // search but that's unusual. Besides, for the two ended optimization to
       
 14325     // work on Iterables, we'd need to copy the whole set.
       
 14326 
       
 14327     // In this first iteration, we'll just live with hitting the bad case
       
 14328     // (adding everything to a Map) in for every insert/move.
       
 14329 
       
 14330     // If you change this code, also update reconcileChildrenIterator() which
       
 14331     // uses the same algorithm.
       
 14332 
       
 14333     {
       
 14334       // First, validate keys.
       
 14335       var knownKeys = null;
       
 14336       for (var i = 0; i < newChildren.length; i++) {
       
 14337         var child = newChildren[i];
       
 14338         knownKeys = warnOnInvalidKey(child, knownKeys);
       
 14339       }
       
 14340     }
       
 14341 
       
 14342     var resultingFirstChild = null;
       
 14343     var previousNewFiber = null;
       
 14344 
       
 14345     var oldFiber = currentFirstChild;
       
 14346     var lastPlacedIndex = 0;
       
 14347     var newIdx = 0;
       
 14348     var nextOldFiber = null;
       
 14349     for (; oldFiber !== null && newIdx < newChildren.length; newIdx++) {
       
 14350       if (oldFiber.index > newIdx) {
       
 14351         nextOldFiber = oldFiber;
       
 14352         oldFiber = null;
       
 14353       } else {
       
 14354         nextOldFiber = oldFiber.sibling;
       
 14355       }
       
 14356       var newFiber = updateSlot(returnFiber, oldFiber, newChildren[newIdx], expirationTime);
       
 14357       if (newFiber === null) {
       
 14358         // TODO: This breaks on empty slots like null children. That's
       
 14359         // unfortunate because it triggers the slow path all the time. We need
       
 14360         // a better way to communicate whether this was a miss or null,
       
 14361         // boolean, undefined, etc.
       
 14362         if (oldFiber === null) {
       
 14363           oldFiber = nextOldFiber;
       
 14364         }
       
 14365         break;
       
 14366       }
       
 14367       if (shouldTrackSideEffects) {
       
 14368         if (oldFiber && newFiber.alternate === null) {
       
 14369           // We matched the slot, but we didn't reuse the existing fiber, so we
       
 14370           // need to delete the existing child.
       
 14371           deleteChild(returnFiber, oldFiber);
       
 14372         }
       
 14373       }
       
 14374       lastPlacedIndex = placeChild(newFiber, lastPlacedIndex, newIdx);
       
 14375       if (previousNewFiber === null) {
       
 14376         // TODO: Move out of the loop. This only happens for the first run.
       
 14377         resultingFirstChild = newFiber;
       
 14378       } else {
       
 14379         // TODO: Defer siblings if we're not at the right index for this slot.
       
 14380         // I.e. if we had null values before, then we want to defer this
       
 14381         // for each null value. However, we also don't want to call updateSlot
       
 14382         // with the previous one.
       
 14383         previousNewFiber.sibling = newFiber;
       
 14384       }
       
 14385       previousNewFiber = newFiber;
       
 14386       oldFiber = nextOldFiber;
       
 14387     }
       
 14388 
       
 14389     if (newIdx === newChildren.length) {
       
 14390       // We've reached the end of the new children. We can delete the rest.
       
 14391       deleteRemainingChildren(returnFiber, oldFiber);
       
 14392       return resultingFirstChild;
       
 14393     }
       
 14394 
       
 14395     if (oldFiber === null) {
       
 14396       // If we don't have any more existing children we can choose a fast path
       
 14397       // since the rest will all be insertions.
       
 14398       for (; newIdx < newChildren.length; newIdx++) {
       
 14399         var _newFiber = createChild(returnFiber, newChildren[newIdx], expirationTime);
       
 14400         if (_newFiber === null) {
       
 14401           continue;
       
 14402         }
       
 14403         lastPlacedIndex = placeChild(_newFiber, lastPlacedIndex, newIdx);
       
 14404         if (previousNewFiber === null) {
       
 14405           // TODO: Move out of the loop. This only happens for the first run.
       
 14406           resultingFirstChild = _newFiber;
       
 14407         } else {
       
 14408           previousNewFiber.sibling = _newFiber;
       
 14409         }
       
 14410         previousNewFiber = _newFiber;
       
 14411       }
       
 14412       return resultingFirstChild;
       
 14413     }
       
 14414 
       
 14415     // Add all children to a key map for quick lookups.
       
 14416     var existingChildren = mapRemainingChildren(returnFiber, oldFiber);
       
 14417 
       
 14418     // Keep scanning and use the map to restore deleted items as moves.
       
 14419     for (; newIdx < newChildren.length; newIdx++) {
       
 14420       var _newFiber2 = updateFromMap(existingChildren, returnFiber, newIdx, newChildren[newIdx], expirationTime);
       
 14421       if (_newFiber2 !== null) {
       
 14422         if (shouldTrackSideEffects) {
       
 14423           if (_newFiber2.alternate !== null) {
       
 14424             // The new fiber is a work in progress, but if there exists a
       
 14425             // current, that means that we reused the fiber. We need to delete
       
 14426             // it from the child list so that we don't add it to the deletion
       
 14427             // list.
       
 14428             existingChildren.delete(_newFiber2.key === null ? newIdx : _newFiber2.key);
       
 14429           }
       
 14430         }
       
 14431         lastPlacedIndex = placeChild(_newFiber2, lastPlacedIndex, newIdx);
       
 14432         if (previousNewFiber === null) {
       
 14433           resultingFirstChild = _newFiber2;
       
 14434         } else {
       
 14435           previousNewFiber.sibling = _newFiber2;
       
 14436         }
       
 14437         previousNewFiber = _newFiber2;
       
 14438       }
       
 14439     }
       
 14440 
       
 14441     if (shouldTrackSideEffects) {
       
 14442       // Any existing children that weren't consumed above were deleted. We need
       
 14443       // to add them to the deletion list.
       
 14444       existingChildren.forEach(function (child) {
       
 14445         return deleteChild(returnFiber, child);
       
 14446       });
       
 14447     }
       
 14448 
       
 14449     return resultingFirstChild;
       
 14450   }
       
 14451 
       
 14452   function reconcileChildrenIterator(returnFiber, currentFirstChild, newChildrenIterable, expirationTime) {
       
 14453     // This is the same implementation as reconcileChildrenArray(),
       
 14454     // but using the iterator instead.
       
 14455 
       
 14456     var iteratorFn = getIteratorFn(newChildrenIterable);
       
 14457     (function () {
       
 14458       if (!(typeof iteratorFn === 'function')) {
       
 14459         {
       
 14460           throw ReactError(Error('An object is not an iterable. This error is likely caused by a bug in React. Please file an issue.'));
       
 14461         }
       
 14462       }
       
 14463     })();
       
 14464 
       
 14465     {
       
 14466       // We don't support rendering Generators because it's a mutation.
       
 14467       // See https://github.com/facebook/react/issues/12995
       
 14468       if (typeof Symbol === 'function' &&
       
 14469       // $FlowFixMe Flow doesn't know about toStringTag
       
 14470       newChildrenIterable[Symbol.toStringTag] === 'Generator') {
       
 14471         !didWarnAboutGenerators ? warning$1(false, 'Using Generators as children is unsupported and will likely yield ' + 'unexpected results because enumerating a generator mutates it. ' + 'You may convert it to an array with `Array.from()` or the ' + '`[...spread]` operator before rendering. Keep in mind ' + 'you might need to polyfill these features for older browsers.') : void 0;
       
 14472         didWarnAboutGenerators = true;
       
 14473       }
       
 14474 
       
 14475       // Warn about using Maps as children
       
 14476       if (newChildrenIterable.entries === iteratorFn) {
       
 14477         !didWarnAboutMaps ? warning$1(false, 'Using Maps as children is unsupported and will likely yield ' + 'unexpected results. Convert it to a sequence/iterable of keyed ' + 'ReactElements instead.') : void 0;
       
 14478         didWarnAboutMaps = true;
       
 14479       }
       
 14480 
       
 14481       // First, validate keys.
       
 14482       // We'll get a different iterator later for the main pass.
       
 14483       var _newChildren = iteratorFn.call(newChildrenIterable);
       
 14484       if (_newChildren) {
       
 14485         var knownKeys = null;
       
 14486         var _step = _newChildren.next();
       
 14487         for (; !_step.done; _step = _newChildren.next()) {
       
 14488           var child = _step.value;
       
 14489           knownKeys = warnOnInvalidKey(child, knownKeys);
       
 14490         }
       
 14491       }
       
 14492     }
       
 14493 
       
 14494     var newChildren = iteratorFn.call(newChildrenIterable);
       
 14495     (function () {
       
 14496       if (!(newChildren != null)) {
       
 14497         {
       
 14498           throw ReactError(Error('An iterable object provided no iterator.'));
       
 14499         }
       
 14500       }
       
 14501     })();
       
 14502 
       
 14503     var resultingFirstChild = null;
       
 14504     var previousNewFiber = null;
       
 14505 
       
 14506     var oldFiber = currentFirstChild;
       
 14507     var lastPlacedIndex = 0;
       
 14508     var newIdx = 0;
       
 14509     var nextOldFiber = null;
       
 14510 
       
 14511     var step = newChildren.next();
       
 14512     for (; oldFiber !== null && !step.done; newIdx++, step = newChildren.next()) {
       
 14513       if (oldFiber.index > newIdx) {
       
 14514         nextOldFiber = oldFiber;
       
 14515         oldFiber = null;
       
 14516       } else {
       
 14517         nextOldFiber = oldFiber.sibling;
       
 14518       }
       
 14519       var newFiber = updateSlot(returnFiber, oldFiber, step.value, expirationTime);
       
 14520       if (newFiber === null) {
       
 14521         // TODO: This breaks on empty slots like null children. That's
       
 14522         // unfortunate because it triggers the slow path all the time. We need
       
 14523         // a better way to communicate whether this was a miss or null,
       
 14524         // boolean, undefined, etc.
       
 14525         if (oldFiber === null) {
       
 14526           oldFiber = nextOldFiber;
       
 14527         }
       
 14528         break;
       
 14529       }
       
 14530       if (shouldTrackSideEffects) {
       
 14531         if (oldFiber && newFiber.alternate === null) {
       
 14532           // We matched the slot, but we didn't reuse the existing fiber, so we
       
 14533           // need to delete the existing child.
       
 14534           deleteChild(returnFiber, oldFiber);
       
 14535         }
       
 14536       }
       
 14537       lastPlacedIndex = placeChild(newFiber, lastPlacedIndex, newIdx);
       
 14538       if (previousNewFiber === null) {
       
 14539         // TODO: Move out of the loop. This only happens for the first run.
       
 14540         resultingFirstChild = newFiber;
       
 14541       } else {
       
 14542         // TODO: Defer siblings if we're not at the right index for this slot.
       
 14543         // I.e. if we had null values before, then we want to defer this
       
 14544         // for each null value. However, we also don't want to call updateSlot
       
 14545         // with the previous one.
       
 14546         previousNewFiber.sibling = newFiber;
       
 14547       }
       
 14548       previousNewFiber = newFiber;
       
 14549       oldFiber = nextOldFiber;
       
 14550     }
       
 14551 
       
 14552     if (step.done) {
       
 14553       // We've reached the end of the new children. We can delete the rest.
       
 14554       deleteRemainingChildren(returnFiber, oldFiber);
       
 14555       return resultingFirstChild;
       
 14556     }
       
 14557 
       
 14558     if (oldFiber === null) {
       
 14559       // If we don't have any more existing children we can choose a fast path
       
 14560       // since the rest will all be insertions.
       
 14561       for (; !step.done; newIdx++, step = newChildren.next()) {
       
 14562         var _newFiber3 = createChild(returnFiber, step.value, expirationTime);
       
 14563         if (_newFiber3 === null) {
       
 14564           continue;
       
 14565         }
       
 14566         lastPlacedIndex = placeChild(_newFiber3, lastPlacedIndex, newIdx);
       
 14567         if (previousNewFiber === null) {
       
 14568           // TODO: Move out of the loop. This only happens for the first run.
       
 14569           resultingFirstChild = _newFiber3;
       
 14570         } else {
       
 14571           previousNewFiber.sibling = _newFiber3;
       
 14572         }
       
 14573         previousNewFiber = _newFiber3;
       
 14574       }
       
 14575       return resultingFirstChild;
       
 14576     }
       
 14577 
       
 14578     // Add all children to a key map for quick lookups.
       
 14579     var existingChildren = mapRemainingChildren(returnFiber, oldFiber);
       
 14580 
       
 14581     // Keep scanning and use the map to restore deleted items as moves.
       
 14582     for (; !step.done; newIdx++, step = newChildren.next()) {
       
 14583       var _newFiber4 = updateFromMap(existingChildren, returnFiber, newIdx, step.value, expirationTime);
       
 14584       if (_newFiber4 !== null) {
       
 14585         if (shouldTrackSideEffects) {
       
 14586           if (_newFiber4.alternate !== null) {
       
 14587             // The new fiber is a work in progress, but if there exists a
       
 14588             // current, that means that we reused the fiber. We need to delete
       
 14589             // it from the child list so that we don't add it to the deletion
       
 14590             // list.
       
 14591             existingChildren.delete(_newFiber4.key === null ? newIdx : _newFiber4.key);
       
 14592           }
       
 14593         }
       
 14594         lastPlacedIndex = placeChild(_newFiber4, lastPlacedIndex, newIdx);
       
 14595         if (previousNewFiber === null) {
       
 14596           resultingFirstChild = _newFiber4;
       
 14597         } else {
       
 14598           previousNewFiber.sibling = _newFiber4;
       
 14599         }
       
 14600         previousNewFiber = _newFiber4;
       
 14601       }
       
 14602     }
       
 14603 
       
 14604     if (shouldTrackSideEffects) {
       
 14605       // Any existing children that weren't consumed above were deleted. We need
       
 14606       // to add them to the deletion list.
       
 14607       existingChildren.forEach(function (child) {
       
 14608         return deleteChild(returnFiber, child);
       
 14609       });
       
 14610     }
       
 14611 
       
 14612     return resultingFirstChild;
       
 14613   }
       
 14614 
       
 14615   function reconcileSingleTextNode(returnFiber, currentFirstChild, textContent, expirationTime) {
       
 14616     // There's no need to check for keys on text nodes since we don't have a
       
 14617     // way to define them.
       
 14618     if (currentFirstChild !== null && currentFirstChild.tag === HostText) {
       
 14619       // We already have an existing node so let's just update it and delete
       
 14620       // the rest.
       
 14621       deleteRemainingChildren(returnFiber, currentFirstChild.sibling);
       
 14622       var existing = useFiber(currentFirstChild, textContent, expirationTime);
       
 14623       existing.return = returnFiber;
       
 14624       return existing;
       
 14625     }
       
 14626     // The existing first child is not a text node so we need to create one
       
 14627     // and delete the existing ones.
       
 14628     deleteRemainingChildren(returnFiber, currentFirstChild);
       
 14629     var created = createFiberFromText(textContent, returnFiber.mode, expirationTime);
       
 14630     created.return = returnFiber;
       
 14631     return created;
       
 14632   }
       
 14633 
       
 14634   function reconcileSingleElement(returnFiber, currentFirstChild, element, expirationTime) {
       
 14635     var key = element.key;
       
 14636     var child = currentFirstChild;
       
 14637     while (child !== null) {
       
 14638       // TODO: If key === null and child.key === null, then this only applies to
       
 14639       // the first item in the list.
       
 14640       if (child.key === key) {
       
 14641         if (child.tag === Fragment ? element.type === REACT_FRAGMENT_TYPE : child.elementType === element.type || (
       
 14642         // Keep this check inline so it only runs on the false path:
       
 14643         isCompatibleFamilyForHotReloading(child, element))) {
       
 14644           deleteRemainingChildren(returnFiber, child.sibling);
       
 14645           var existing = useFiber(child, element.type === REACT_FRAGMENT_TYPE ? element.props.children : element.props, expirationTime);
       
 14646           existing.ref = coerceRef(returnFiber, child, element);
       
 14647           existing.return = returnFiber;
       
 14648           {
       
 14649             existing._debugSource = element._source;
       
 14650             existing._debugOwner = element._owner;
       
 14651           }
       
 14652           return existing;
       
 14653         } else {
       
 14654           deleteRemainingChildren(returnFiber, child);
       
 14655           break;
       
 14656         }
       
 14657       } else {
       
 14658         deleteChild(returnFiber, child);
       
 14659       }
       
 14660       child = child.sibling;
       
 14661     }
       
 14662 
       
 14663     if (element.type === REACT_FRAGMENT_TYPE) {
       
 14664       var created = createFiberFromFragment(element.props.children, returnFiber.mode, expirationTime, element.key);
       
 14665       created.return = returnFiber;
       
 14666       return created;
       
 14667     } else {
       
 14668       var _created4 = createFiberFromElement(element, returnFiber.mode, expirationTime);
       
 14669       _created4.ref = coerceRef(returnFiber, currentFirstChild, element);
       
 14670       _created4.return = returnFiber;
       
 14671       return _created4;
       
 14672     }
       
 14673   }
       
 14674 
       
 14675   function reconcileSinglePortal(returnFiber, currentFirstChild, portal, expirationTime) {
       
 14676     var key = portal.key;
       
 14677     var child = currentFirstChild;
       
 14678     while (child !== null) {
       
 14679       // TODO: If key === null and child.key === null, then this only applies to
       
 14680       // the first item in the list.
       
 14681       if (child.key === key) {
       
 14682         if (child.tag === HostPortal && child.stateNode.containerInfo === portal.containerInfo && child.stateNode.implementation === portal.implementation) {
       
 14683           deleteRemainingChildren(returnFiber, child.sibling);
       
 14684           var existing = useFiber(child, portal.children || [], expirationTime);
       
 14685           existing.return = returnFiber;
       
 14686           return existing;
       
 14687         } else {
       
 14688           deleteRemainingChildren(returnFiber, child);
       
 14689           break;
       
 14690         }
       
 14691       } else {
       
 14692         deleteChild(returnFiber, child);
       
 14693       }
       
 14694       child = child.sibling;
       
 14695     }
       
 14696 
       
 14697     var created = createFiberFromPortal(portal, returnFiber.mode, expirationTime);
       
 14698     created.return = returnFiber;
       
 14699     return created;
       
 14700   }
       
 14701 
       
 14702   // This API will tag the children with the side-effect of the reconciliation
       
 14703   // itself. They will be added to the side-effect list as we pass through the
       
 14704   // children and the parent.
       
 14705   function reconcileChildFibers(returnFiber, currentFirstChild, newChild, expirationTime) {
       
 14706     // This function is not recursive.
       
 14707     // If the top level item is an array, we treat it as a set of children,
       
 14708     // not as a fragment. Nested arrays on the other hand will be treated as
       
 14709     // fragment nodes. Recursion happens at the normal flow.
       
 14710 
       
 14711     // Handle top level unkeyed fragments as if they were arrays.
       
 14712     // This leads to an ambiguity between <>{[...]}</> and <>...</>.
       
 14713     // We treat the ambiguous cases above the same.
       
 14714     var isUnkeyedTopLevelFragment = typeof newChild === 'object' && newChild !== null && newChild.type === REACT_FRAGMENT_TYPE && newChild.key === null;
       
 14715     if (isUnkeyedTopLevelFragment) {
       
 14716       newChild = newChild.props.children;
       
 14717     }
       
 14718 
       
 14719     // Handle object types
       
 14720     var isObject = typeof newChild === 'object' && newChild !== null;
       
 14721 
       
 14722     if (isObject) {
       
 14723       switch (newChild.$$typeof) {
       
 14724         case REACT_ELEMENT_TYPE:
       
 14725           return placeSingleChild(reconcileSingleElement(returnFiber, currentFirstChild, newChild, expirationTime));
       
 14726         case REACT_PORTAL_TYPE:
       
 14727           return placeSingleChild(reconcileSinglePortal(returnFiber, currentFirstChild, newChild, expirationTime));
       
 14728       }
       
 14729     }
       
 14730 
       
 14731     if (typeof newChild === 'string' || typeof newChild === 'number') {
       
 14732       return placeSingleChild(reconcileSingleTextNode(returnFiber, currentFirstChild, '' + newChild, expirationTime));
       
 14733     }
       
 14734 
       
 14735     if (isArray(newChild)) {
       
 14736       return reconcileChildrenArray(returnFiber, currentFirstChild, newChild, expirationTime);
       
 14737     }
       
 14738 
       
 14739     if (getIteratorFn(newChild)) {
       
 14740       return reconcileChildrenIterator(returnFiber, currentFirstChild, newChild, expirationTime);
       
 14741     }
       
 14742 
       
 14743     if (isObject) {
       
 14744       throwOnInvalidObjectType(returnFiber, newChild);
       
 14745     }
       
 14746 
       
 14747     {
       
 14748       if (typeof newChild === 'function') {
       
 14749         warnOnFunctionType();
       
 14750       }
       
 14751     }
       
 14752     if (typeof newChild === 'undefined' && !isUnkeyedTopLevelFragment) {
       
 14753       // If the new child is undefined, and the return fiber is a composite
       
 14754       // component, throw an error. If Fiber return types are disabled,
       
 14755       // we already threw above.
       
 14756       switch (returnFiber.tag) {
       
 14757         case ClassComponent:
       
 14758           {
       
 14759             {
       
 14760               var instance = returnFiber.stateNode;
       
 14761               if (instance.render._isMockFunction) {
       
 14762                 // We allow auto-mocks to proceed as if they're returning null.
       
 14763                 break;
       
 14764               }
       
 14765             }
       
 14766           }
       
 14767         // Intentionally fall through to the next case, which handles both
       
 14768         // functions and classes
       
 14769         // eslint-disable-next-lined no-fallthrough
       
 14770         case FunctionComponent:
       
 14771           {
       
 14772             var Component = returnFiber.type;
       
 14773             (function () {
       
 14774               {
       
 14775                 {
       
 14776                   throw ReactError(Error((Component.displayName || Component.name || 'Component') + '(...): Nothing was returned from render. This usually means a return statement is missing. Or, to render nothing, return null.'));
       
 14777                 }
       
 14778               }
       
 14779             })();
       
 14780           }
       
 14781       }
       
 14782     }
       
 14783 
       
 14784     // Remaining cases are all treated as empty.
       
 14785     return deleteRemainingChildren(returnFiber, currentFirstChild);
       
 14786   }
       
 14787 
       
 14788   return reconcileChildFibers;
       
 14789 }
       
 14790 
       
 14791 var reconcileChildFibers = ChildReconciler(true);
       
 14792 var mountChildFibers = ChildReconciler(false);
       
 14793 
       
 14794 function cloneChildFibers(current$$1, workInProgress) {
       
 14795   (function () {
       
 14796     if (!(current$$1 === null || workInProgress.child === current$$1.child)) {
       
 14797       {
       
 14798         throw ReactError(Error('Resuming work not yet implemented.'));
       
 14799       }
       
 14800     }
       
 14801   })();
       
 14802 
       
 14803   if (workInProgress.child === null) {
       
 14804     return;
       
 14805   }
       
 14806 
       
 14807   var currentChild = workInProgress.child;
       
 14808   var newChild = createWorkInProgress(currentChild, currentChild.pendingProps, currentChild.expirationTime);
       
 14809   workInProgress.child = newChild;
       
 14810 
       
 14811   newChild.return = workInProgress;
       
 14812   while (currentChild.sibling !== null) {
       
 14813     currentChild = currentChild.sibling;
       
 14814     newChild = newChild.sibling = createWorkInProgress(currentChild, currentChild.pendingProps, currentChild.expirationTime);
       
 14815     newChild.return = workInProgress;
       
 14816   }
       
 14817   newChild.sibling = null;
       
 14818 }
       
 14819 
       
 14820 // Reset a workInProgress child set to prepare it for a second pass.
       
 14821 function resetChildFibers(workInProgress, renderExpirationTime) {
       
 14822   var child = workInProgress.child;
       
 14823   while (child !== null) {
       
 14824     resetWorkInProgress(child, renderExpirationTime);
       
 14825     child = child.sibling;
       
 14826   }
       
 14827 }
       
 14828 
       
 14829 var NO_CONTEXT = {};
       
 14830 
       
 14831 var contextStackCursor$1 = createCursor(NO_CONTEXT);
       
 14832 var contextFiberStackCursor = createCursor(NO_CONTEXT);
       
 14833 var rootInstanceStackCursor = createCursor(NO_CONTEXT);
       
 14834 
       
 14835 function requiredContext(c) {
       
 14836   (function () {
       
 14837     if (!(c !== NO_CONTEXT)) {
       
 14838       {
       
 14839         throw ReactError(Error('Expected host context to exist. This error is likely caused by a bug in React. Please file an issue.'));
       
 14840       }
       
 14841     }
       
 14842   })();
       
 14843   return c;
       
 14844 }
       
 14845 
       
 14846 function getRootHostContainer() {
       
 14847   var rootInstance = requiredContext(rootInstanceStackCursor.current);
       
 14848   return rootInstance;
       
 14849 }
       
 14850 
       
 14851 function pushHostContainer(fiber, nextRootInstance) {
       
 14852   // Push current root instance onto the stack;
       
 14853   // This allows us to reset root when portals are popped.
       
 14854   push(rootInstanceStackCursor, nextRootInstance, fiber);
       
 14855   // Track the context and the Fiber that provided it.
       
 14856   // This enables us to pop only Fibers that provide unique contexts.
       
 14857   push(contextFiberStackCursor, fiber, fiber);
       
 14858 
       
 14859   // Finally, we need to push the host context to the stack.
       
 14860   // However, we can't just call getRootHostContext() and push it because
       
 14861   // we'd have a different number of entries on the stack depending on
       
 14862   // whether getRootHostContext() throws somewhere in renderer code or not.
       
 14863   // So we push an empty value first. This lets us safely unwind on errors.
       
 14864   push(contextStackCursor$1, NO_CONTEXT, fiber);
       
 14865   var nextRootContext = getRootHostContext(nextRootInstance);
       
 14866   // Now that we know this function doesn't throw, replace it.
       
 14867   pop(contextStackCursor$1, fiber);
       
 14868   push(contextStackCursor$1, nextRootContext, fiber);
       
 14869 }
       
 14870 
       
 14871 function popHostContainer(fiber) {
       
 14872   pop(contextStackCursor$1, fiber);
       
 14873   pop(contextFiberStackCursor, fiber);
       
 14874   pop(rootInstanceStackCursor, fiber);
       
 14875 }
       
 14876 
       
 14877 function getHostContext() {
       
 14878   var context = requiredContext(contextStackCursor$1.current);
       
 14879   return context;
       
 14880 }
       
 14881 
       
 14882 function pushHostContext(fiber) {
       
 14883   var rootInstance = requiredContext(rootInstanceStackCursor.current);
       
 14884   var context = requiredContext(contextStackCursor$1.current);
       
 14885   var nextContext = getChildHostContext(context, fiber.type, rootInstance);
       
 14886 
       
 14887   // Don't push this Fiber's context unless it's unique.
       
 14888   if (context === nextContext) {
       
 14889     return;
       
 14890   }
       
 14891 
       
 14892   // Track the context and the Fiber that provided it.
       
 14893   // This enables us to pop only Fibers that provide unique contexts.
       
 14894   push(contextFiberStackCursor, fiber, fiber);
       
 14895   push(contextStackCursor$1, nextContext, fiber);
       
 14896 }
       
 14897 
       
 14898 function popHostContext(fiber) {
       
 14899   // Do not pop unless this Fiber provided the current context.
       
 14900   // pushHostContext() only pushes Fibers that provide unique contexts.
       
 14901   if (contextFiberStackCursor.current !== fiber) {
       
 14902     return;
       
 14903   }
       
 14904 
       
 14905   pop(contextStackCursor$1, fiber);
       
 14906   pop(contextFiberStackCursor, fiber);
       
 14907 }
       
 14908 
       
 14909 var DefaultSuspenseContext = 0;
       
 14910 
       
 14911 // The Suspense Context is split into two parts. The lower bits is
       
 14912 // inherited deeply down the subtree. The upper bits only affect
       
 14913 // this immediate suspense boundary and gets reset each new
       
 14914 // boundary or suspense list.
       
 14915 var SubtreeSuspenseContextMask = 1;
       
 14916 
       
 14917 // Subtree Flags:
       
 14918 
       
 14919 // InvisibleParentSuspenseContext indicates that one of our parent Suspense
       
 14920 // boundaries is not currently showing visible main content.
       
 14921 // Either because it is already showing a fallback or is not mounted at all.
       
 14922 // We can use this to determine if it is desirable to trigger a fallback at
       
 14923 // the parent. If not, then we might need to trigger undesirable boundaries
       
 14924 // and/or suspend the commit to avoid hiding the parent content.
       
 14925 var InvisibleParentSuspenseContext = 1;
       
 14926 
       
 14927 // Shallow Flags:
       
 14928 
       
 14929 // ForceSuspenseFallback can be used by SuspenseList to force newly added
       
 14930 // items into their fallback state during one of the render passes.
       
 14931 var ForceSuspenseFallback = 2;
       
 14932 
       
 14933 var suspenseStackCursor = createCursor(DefaultSuspenseContext);
       
 14934 
       
 14935 function hasSuspenseContext(parentContext, flag) {
       
 14936   return (parentContext & flag) !== 0;
       
 14937 }
       
 14938 
       
 14939 function setDefaultShallowSuspenseContext(parentContext) {
       
 14940   return parentContext & SubtreeSuspenseContextMask;
       
 14941 }
       
 14942 
       
 14943 function setShallowSuspenseContext(parentContext, shallowContext) {
       
 14944   return parentContext & SubtreeSuspenseContextMask | shallowContext;
       
 14945 }
       
 14946 
       
 14947 function addSubtreeSuspenseContext(parentContext, subtreeContext) {
       
 14948   return parentContext | subtreeContext;
       
 14949 }
       
 14950 
       
 14951 function pushSuspenseContext(fiber, newContext) {
       
 14952   push(suspenseStackCursor, newContext, fiber);
       
 14953 }
       
 14954 
       
 14955 function popSuspenseContext(fiber) {
       
 14956   pop(suspenseStackCursor, fiber);
       
 14957 }
       
 14958 
       
 14959 // TODO: This is now an empty object. Should we switch this to a boolean?
       
 14960 // Alternatively we can make this use an effect tag similar to SuspenseList.
       
 14961 
       
 14962 
       
 14963 function shouldCaptureSuspense(workInProgress, hasInvisibleParent) {
       
 14964   // If it was the primary children that just suspended, capture and render the
       
 14965   var nextState = workInProgress.memoizedState;
       
 14966   if (nextState !== null) {
       
 14967     return false;
       
 14968   }
       
 14969   var props = workInProgress.memoizedProps;
       
 14970   // In order to capture, the Suspense component must have a fallback prop.
       
 14971   if (props.fallback === undefined) {
       
 14972     return false;
       
 14973   }
       
 14974   // Regular boundaries always capture.
       
 14975   if (props.unstable_avoidThisFallback !== true) {
       
 14976     return true;
       
 14977   }
       
 14978   // If it's a boundary we should avoid, then we prefer to bubble up to the
       
 14979   // parent boundary if it is currently invisible.
       
 14980   if (hasInvisibleParent) {
       
 14981     return false;
       
 14982   }
       
 14983   // If the parent is not able to handle it, we must handle it.
       
 14984   return true;
       
 14985 }
       
 14986 
       
 14987 function findFirstSuspended(row) {
       
 14988   var node = row;
       
 14989   while (node !== null) {
       
 14990     if (node.tag === SuspenseComponent) {
       
 14991       var state = node.memoizedState;
       
 14992       if (state !== null) {
       
 14993         return node;
       
 14994       }
       
 14995     } else if (node.tag === SuspenseListComponent &&
       
 14996     // revealOrder undefined can't be trusted because it don't
       
 14997     // keep track of whether it suspended or not.
       
 14998     node.memoizedProps.revealOrder !== undefined) {
       
 14999       var didSuspend = (node.effectTag & DidCapture) !== NoEffect;
       
 15000       if (didSuspend) {
       
 15001         return node;
       
 15002       }
       
 15003     } else if (node.child !== null) {
       
 15004       node.child.return = node;
       
 15005       node = node.child;
       
 15006       continue;
       
 15007     }
       
 15008     if (node === row) {
       
 15009       return null;
       
 15010     }
       
 15011     while (node.sibling === null) {
       
 15012       if (node.return === null || node.return === row) {
       
 15013         return null;
       
 15014       }
       
 15015       node = node.return;
       
 15016     }
       
 15017     node.sibling.return = node.return;
       
 15018     node = node.sibling;
       
 15019   }
       
 15020   return null;
       
 15021 }
       
 15022 
       
 15023 var NoEffect$1 = /*             */0;
       
 15024 var UnmountSnapshot = /*      */2;
       
 15025 var UnmountMutation = /*      */4;
       
 15026 var MountMutation = /*        */8;
       
 15027 var UnmountLayout = /*        */16;
       
 15028 var MountLayout = /*          */32;
       
 15029 var MountPassive = /*         */64;
       
 15030 var UnmountPassive = /*       */128;
       
 15031 
       
 15032 var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher;
       
 15033 
       
 15034 
       
 15035 var didWarnAboutMismatchedHooksForComponent = void 0;
       
 15036 {
       
 15037   didWarnAboutMismatchedHooksForComponent = new Set();
       
 15038 }
       
 15039 
       
 15040 // These are set right before calling the component.
       
 15041 var renderExpirationTime$1 = NoWork;
       
 15042 // The work-in-progress fiber. I've named it differently to distinguish it from
       
 15043 // the work-in-progress hook.
       
 15044 var currentlyRenderingFiber$1 = null;
       
 15045 
       
 15046 // Hooks are stored as a linked list on the fiber's memoizedState field. The
       
 15047 // current hook list is the list that belongs to the current fiber. The
       
 15048 // work-in-progress hook list is a new list that will be added to the
       
 15049 // work-in-progress fiber.
       
 15050 var currentHook = null;
       
 15051 var nextCurrentHook = null;
       
 15052 var firstWorkInProgressHook = null;
       
 15053 var workInProgressHook = null;
       
 15054 var nextWorkInProgressHook = null;
       
 15055 
       
 15056 var remainingExpirationTime = NoWork;
       
 15057 var componentUpdateQueue = null;
       
 15058 var sideEffectTag = 0;
       
 15059 
       
 15060 // Updates scheduled during render will trigger an immediate re-render at the
       
 15061 // end of the current pass. We can't store these updates on the normal queue,
       
 15062 // because if the work is aborted, they should be discarded. Because this is
       
 15063 // a relatively rare case, we also don't want to add an additional field to
       
 15064 // either the hook or queue object types. So we store them in a lazily create
       
 15065 // map of queue -> render-phase updates, which are discarded once the component
       
 15066 // completes without re-rendering.
       
 15067 
       
 15068 // Whether an update was scheduled during the currently executing render pass.
       
 15069 var didScheduleRenderPhaseUpdate = false;
       
 15070 // Lazily created map of render-phase updates
       
 15071 var renderPhaseUpdates = null;
       
 15072 // Counter to prevent infinite loops.
       
 15073 var numberOfReRenders = 0;
       
 15074 var RE_RENDER_LIMIT = 25;
       
 15075 
       
 15076 // In DEV, this is the name of the currently executing primitive hook
       
 15077 var currentHookNameInDev = null;
       
 15078 
       
 15079 // In DEV, this list ensures that hooks are called in the same order between renders.
       
 15080 // The list stores the order of hooks used during the initial render (mount).
       
 15081 // Subsequent renders (updates) reference this list.
       
 15082 var hookTypesDev = null;
       
 15083 var hookTypesUpdateIndexDev = -1;
       
 15084 
       
 15085 // In DEV, this tracks whether currently rendering component needs to ignore
       
 15086 // the dependencies for Hooks that need them (e.g. useEffect or useMemo).
       
 15087 // When true, such Hooks will always be "remounted". Only used during hot reload.
       
 15088 var ignorePreviousDependencies = false;
       
 15089 
       
 15090 function mountHookTypesDev() {
       
 15091   {
       
 15092     var hookName = currentHookNameInDev;
       
 15093 
       
 15094     if (hookTypesDev === null) {
       
 15095       hookTypesDev = [hookName];
       
 15096     } else {
       
 15097       hookTypesDev.push(hookName);
       
 15098     }
       
 15099   }
       
 15100 }
       
 15101 
       
 15102 function updateHookTypesDev() {
       
 15103   {
       
 15104     var hookName = currentHookNameInDev;
       
 15105 
       
 15106     if (hookTypesDev !== null) {
       
 15107       hookTypesUpdateIndexDev++;
       
 15108       if (hookTypesDev[hookTypesUpdateIndexDev] !== hookName) {
       
 15109         warnOnHookMismatchInDev(hookName);
       
 15110       }
       
 15111     }
       
 15112   }
       
 15113 }
       
 15114 
       
 15115 function checkDepsAreArrayDev(deps) {
       
 15116   {
       
 15117     if (deps !== undefined && deps !== null && !Array.isArray(deps)) {
       
 15118       // Verify deps, but only on mount to avoid extra checks.
       
 15119       // It's unlikely their type would change as usually you define them inline.
       
 15120       warning$1(false, '%s received a final argument that is not an array (instead, received `%s`). When ' + 'specified, the final argument must be an array.', currentHookNameInDev, typeof deps);
       
 15121     }
       
 15122   }
       
 15123 }
       
 15124 
       
 15125 function warnOnHookMismatchInDev(currentHookName) {
       
 15126   {
       
 15127     var componentName = getComponentName(currentlyRenderingFiber$1.type);
       
 15128     if (!didWarnAboutMismatchedHooksForComponent.has(componentName)) {
       
 15129       didWarnAboutMismatchedHooksForComponent.add(componentName);
       
 15130 
       
 15131       if (hookTypesDev !== null) {
       
 15132         var table = '';
       
 15133 
       
 15134         var secondColumnStart = 30;
       
 15135 
       
 15136         for (var i = 0; i <= hookTypesUpdateIndexDev; i++) {
       
 15137           var oldHookName = hookTypesDev[i];
       
 15138           var newHookName = i === hookTypesUpdateIndexDev ? currentHookName : oldHookName;
       
 15139 
       
 15140           var row = i + 1 + '. ' + oldHookName;
       
 15141 
       
 15142           // Extra space so second column lines up
       
 15143           // lol @ IE not supporting String#repeat
       
 15144           while (row.length < secondColumnStart) {
       
 15145             row += ' ';
       
 15146           }
       
 15147 
       
 15148           row += newHookName + '\n';
       
 15149 
       
 15150           table += row;
       
 15151         }
       
 15152 
       
 15153         warning$1(false, 'React has detected a change in the order of Hooks called by %s. ' + 'This will lead to bugs and errors if not fixed. ' + 'For more information, read the Rules of Hooks: https://fb.me/rules-of-hooks\n\n' + '   Previous render            Next render\n' + '   ------------------------------------------------------\n' + '%s' + '   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n', componentName, table);
       
 15154       }
       
 15155     }
       
 15156   }
       
 15157 }
       
 15158 
       
 15159 function throwInvalidHookError() {
       
 15160   (function () {
       
 15161     {
       
 15162       {
       
 15163         throw ReactError(Error('Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://fb.me/react-invalid-hook-call for tips about how to debug and fix this problem.'));
       
 15164       }
       
 15165     }
       
 15166   })();
       
 15167 }
       
 15168 
       
 15169 function areHookInputsEqual(nextDeps, prevDeps) {
       
 15170   {
       
 15171     if (ignorePreviousDependencies) {
       
 15172       // Only true when this component is being hot reloaded.
       
 15173       return false;
       
 15174     }
       
 15175   }
       
 15176 
       
 15177   if (prevDeps === null) {
       
 15178     {
       
 15179       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);
       
 15180     }
       
 15181     return false;
       
 15182   }
       
 15183 
       
 15184   {
       
 15185     // Don't bother comparing lengths in prod because these arrays should be
       
 15186     // passed inline.
       
 15187     if (nextDeps.length !== prevDeps.length) {
       
 15188       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, '[' + prevDeps.join(', ') + ']', '[' + nextDeps.join(', ') + ']');
       
 15189     }
       
 15190   }
       
 15191   for (var i = 0; i < prevDeps.length && i < nextDeps.length; i++) {
       
 15192     if (is(nextDeps[i], prevDeps[i])) {
       
 15193       continue;
       
 15194     }
       
 15195     return false;
       
 15196   }
       
 15197   return true;
       
 15198 }
       
 15199 
       
 15200 function renderWithHooks(current, workInProgress, Component, props, refOrContext, nextRenderExpirationTime) {
       
 15201   renderExpirationTime$1 = nextRenderExpirationTime;
       
 15202   currentlyRenderingFiber$1 = workInProgress;
       
 15203   nextCurrentHook = current !== null ? current.memoizedState : null;
       
 15204 
       
 15205   {
       
 15206     hookTypesDev = current !== null ? current._debugHookTypes : null;
       
 15207     hookTypesUpdateIndexDev = -1;
       
 15208     // Used for hot reloading:
       
 15209     ignorePreviousDependencies = current !== null && current.type !== workInProgress.type;
       
 15210   }
       
 15211 
       
 15212   // The following should have already been reset
       
 15213   // currentHook = null;
       
 15214   // workInProgressHook = null;
       
 15215 
       
 15216   // remainingExpirationTime = NoWork;
       
 15217   // componentUpdateQueue = null;
       
 15218 
       
 15219   // didScheduleRenderPhaseUpdate = false;
       
 15220   // renderPhaseUpdates = null;
       
 15221   // numberOfReRenders = 0;
       
 15222   // sideEffectTag = 0;
       
 15223 
       
 15224   // TODO Warn if no hooks are used at all during mount, then some are used during update.
       
 15225   // Currently we will identify the update render as a mount because nextCurrentHook === null.
       
 15226   // This is tricky because it's valid for certain types of components (e.g. React.lazy)
       
 15227 
       
 15228   // Using nextCurrentHook to differentiate between mount/update only works if at least one stateful hook is used.
       
 15229   // Non-stateful hooks (e.g. context) don't get added to memoizedState,
       
 15230   // so nextCurrentHook would be null during updates and mounts.
       
 15231   {
       
 15232     if (nextCurrentHook !== null) {
       
 15233       ReactCurrentDispatcher$1.current = HooksDispatcherOnUpdateInDEV;
       
 15234     } else if (hookTypesDev !== null) {
       
 15235       // This dispatcher handles an edge case where a component is updating,
       
 15236       // but no stateful hooks have been used.
       
 15237       // We want to match the production code behavior (which will use HooksDispatcherOnMount),
       
 15238       // but with the extra DEV validation to ensure hooks ordering hasn't changed.
       
 15239       // This dispatcher does that.
       
 15240       ReactCurrentDispatcher$1.current = HooksDispatcherOnMountWithHookTypesInDEV;
       
 15241     } else {
       
 15242       ReactCurrentDispatcher$1.current = HooksDispatcherOnMountInDEV;
       
 15243     }
       
 15244   }
       
 15245 
       
 15246   var children = Component(props, refOrContext);
       
 15247 
       
 15248   if (didScheduleRenderPhaseUpdate) {
       
 15249     do {
       
 15250       didScheduleRenderPhaseUpdate = false;
       
 15251       numberOfReRenders += 1;
       
 15252 
       
 15253       // Start over from the beginning of the list
       
 15254       nextCurrentHook = current !== null ? current.memoizedState : null;
       
 15255       nextWorkInProgressHook = firstWorkInProgressHook;
       
 15256 
       
 15257       currentHook = null;
       
 15258       workInProgressHook = null;
       
 15259       componentUpdateQueue = null;
       
 15260 
       
 15261       {
       
 15262         // Also validate hook order for cascading updates.
       
 15263         hookTypesUpdateIndexDev = -1;
       
 15264       }
       
 15265 
       
 15266       ReactCurrentDispatcher$1.current = HooksDispatcherOnUpdateInDEV;
       
 15267 
       
 15268       children = Component(props, refOrContext);
       
 15269     } while (didScheduleRenderPhaseUpdate);
       
 15270 
       
 15271     renderPhaseUpdates = null;
       
 15272     numberOfReRenders = 0;
       
 15273   }
       
 15274 
       
 15275   // We can assume the previous dispatcher is always this one, since we set it
       
 15276   // at the beginning of the render phase and there's no re-entrancy.
       
 15277   ReactCurrentDispatcher$1.current = ContextOnlyDispatcher;
       
 15278 
       
 15279   var renderedWork = currentlyRenderingFiber$1;
       
 15280 
       
 15281   renderedWork.memoizedState = firstWorkInProgressHook;
       
 15282   renderedWork.expirationTime = remainingExpirationTime;
       
 15283   renderedWork.updateQueue = componentUpdateQueue;
       
 15284   renderedWork.effectTag |= sideEffectTag;
       
 15285 
       
 15286   {
       
 15287     renderedWork._debugHookTypes = hookTypesDev;
       
 15288   }
       
 15289 
       
 15290   // This check uses currentHook so that it works the same in DEV and prod bundles.
       
 15291   // hookTypesDev could catch more cases (e.g. context) but only in DEV bundles.
       
 15292   var didRenderTooFewHooks = currentHook !== null && currentHook.next !== null;
       
 15293 
       
 15294   renderExpirationTime$1 = NoWork;
       
 15295   currentlyRenderingFiber$1 = null;
       
 15296 
       
 15297   currentHook = null;
       
 15298   nextCurrentHook = null;
       
 15299   firstWorkInProgressHook = null;
       
 15300   workInProgressHook = null;
       
 15301   nextWorkInProgressHook = null;
       
 15302 
       
 15303   {
       
 15304     currentHookNameInDev = null;
       
 15305     hookTypesDev = null;
       
 15306     hookTypesUpdateIndexDev = -1;
       
 15307   }
       
 15308 
       
 15309   remainingExpirationTime = NoWork;
       
 15310   componentUpdateQueue = null;
       
 15311   sideEffectTag = 0;
       
 15312 
       
 15313   // These were reset above
       
 15314   // didScheduleRenderPhaseUpdate = false;
       
 15315   // renderPhaseUpdates = null;
       
 15316   // numberOfReRenders = 0;
       
 15317 
       
 15318   (function () {
       
 15319     if (!!didRenderTooFewHooks) {
       
 15320       {
       
 15321         throw ReactError(Error('Rendered fewer hooks than expected. This may be caused by an accidental early return statement.'));
       
 15322       }
       
 15323     }
       
 15324   })();
       
 15325 
       
 15326   return children;
       
 15327 }
       
 15328 
       
 15329 function bailoutHooks(current, workInProgress, expirationTime) {
       
 15330   workInProgress.updateQueue = current.updateQueue;
       
 15331   workInProgress.effectTag &= ~(Passive | Update);
       
 15332   if (current.expirationTime <= expirationTime) {
       
 15333     current.expirationTime = NoWork;
       
 15334   }
       
 15335 }
       
 15336 
       
 15337 function resetHooks() {
       
 15338   // We can assume the previous dispatcher is always this one, since we set it
       
 15339   // at the beginning of the render phase and there's no re-entrancy.
       
 15340   ReactCurrentDispatcher$1.current = ContextOnlyDispatcher;
       
 15341 
       
 15342   // This is used to reset the state of this module when a component throws.
       
 15343   // It's also called inside mountIndeterminateComponent if we determine the
       
 15344   // component is a module-style component.
       
 15345   renderExpirationTime$1 = NoWork;
       
 15346   currentlyRenderingFiber$1 = null;
       
 15347 
       
 15348   currentHook = null;
       
 15349   nextCurrentHook = null;
       
 15350   firstWorkInProgressHook = null;
       
 15351   workInProgressHook = null;
       
 15352   nextWorkInProgressHook = null;
       
 15353 
       
 15354   {
       
 15355     hookTypesDev = null;
       
 15356     hookTypesUpdateIndexDev = -1;
       
 15357 
       
 15358     currentHookNameInDev = null;
       
 15359   }
       
 15360 
       
 15361   remainingExpirationTime = NoWork;
       
 15362   componentUpdateQueue = null;
       
 15363   sideEffectTag = 0;
       
 15364 
       
 15365   didScheduleRenderPhaseUpdate = false;
       
 15366   renderPhaseUpdates = null;
       
 15367   numberOfReRenders = 0;
       
 15368 }
       
 15369 
       
 15370 function mountWorkInProgressHook() {
       
 15371   var hook = {
       
 15372     memoizedState: null,
       
 15373 
       
 15374     baseState: null,
       
 15375     queue: null,
       
 15376     baseUpdate: null,
       
 15377 
       
 15378     next: null
       
 15379   };
       
 15380 
       
 15381   if (workInProgressHook === null) {
       
 15382     // This is the first hook in the list
       
 15383     firstWorkInProgressHook = workInProgressHook = hook;
       
 15384   } else {
       
 15385     // Append to the end of the list
       
 15386     workInProgressHook = workInProgressHook.next = hook;
       
 15387   }
       
 15388   return workInProgressHook;
       
 15389 }
       
 15390 
       
 15391 function updateWorkInProgressHook() {
       
 15392   // This function is used both for updates and for re-renders triggered by a
       
 15393   // render phase update. It assumes there is either a current hook we can
       
 15394   // clone, or a work-in-progress hook from a previous render pass that we can
       
 15395   // use as a base. When we reach the end of the base list, we must switch to
       
 15396   // the dispatcher used for mounts.
       
 15397   if (nextWorkInProgressHook !== null) {
       
 15398     // There's already a work-in-progress. Reuse it.
       
 15399     workInProgressHook = nextWorkInProgressHook;
       
 15400     nextWorkInProgressHook = workInProgressHook.next;
       
 15401 
       
 15402     currentHook = nextCurrentHook;
       
 15403     nextCurrentHook = currentHook !== null ? currentHook.next : null;
       
 15404   } else {
       
 15405     // Clone from the current hook.
       
 15406     (function () {
       
 15407       if (!(nextCurrentHook !== null)) {
       
 15408         {
       
 15409           throw ReactError(Error('Rendered more hooks than during the previous render.'));
       
 15410         }
       
 15411       }
       
 15412     })();
       
 15413     currentHook = nextCurrentHook;
       
 15414 
       
 15415     var newHook = {
       
 15416       memoizedState: currentHook.memoizedState,
       
 15417 
       
 15418       baseState: currentHook.baseState,
       
 15419       queue: currentHook.queue,
       
 15420       baseUpdate: currentHook.baseUpdate,
       
 15421 
       
 15422       next: null
       
 15423     };
       
 15424 
       
 15425     if (workInProgressHook === null) {
       
 15426       // This is the first hook in the list.
       
 15427       workInProgressHook = firstWorkInProgressHook = newHook;
       
 15428     } else {
       
 15429       // Append to the end of the list.
       
 15430       workInProgressHook = workInProgressHook.next = newHook;
       
 15431     }
       
 15432     nextCurrentHook = currentHook.next;
       
 15433   }
       
 15434   return workInProgressHook;
       
 15435 }
       
 15436 
       
 15437 function createFunctionComponentUpdateQueue() {
       
 15438   return {
       
 15439     lastEffect: null
       
 15440   };
       
 15441 }
       
 15442 
       
 15443 function basicStateReducer(state, action) {
       
 15444   return typeof action === 'function' ? action(state) : action;
       
 15445 }
       
 15446 
       
 15447 function mountReducer(reducer, initialArg, init) {
       
 15448   var hook = mountWorkInProgressHook();
       
 15449   var initialState = void 0;
       
 15450   if (init !== undefined) {
       
 15451     initialState = init(initialArg);
       
 15452   } else {
       
 15453     initialState = initialArg;
       
 15454   }
       
 15455   hook.memoizedState = hook.baseState = initialState;
       
 15456   var queue = hook.queue = {
       
 15457     last: null,
       
 15458     dispatch: null,
       
 15459     lastRenderedReducer: reducer,
       
 15460     lastRenderedState: initialState
       
 15461   };
       
 15462   var dispatch = queue.dispatch = dispatchAction.bind(null,
       
 15463   // Flow doesn't know this is non-null, but we do.
       
 15464   currentlyRenderingFiber$1, queue);
       
 15465   return [hook.memoizedState, dispatch];
       
 15466 }
       
 15467 
       
 15468 function updateReducer(reducer, initialArg, init) {
       
 15469   var hook = updateWorkInProgressHook();
       
 15470   var queue = hook.queue;
       
 15471   (function () {
       
 15472     if (!(queue !== null)) {
       
 15473       {
       
 15474         throw ReactError(Error('Should have a queue. This is likely a bug in React. Please file an issue.'));
       
 15475       }
       
 15476     }
       
 15477   })();
       
 15478 
       
 15479   queue.lastRenderedReducer = reducer;
       
 15480 
       
 15481   if (numberOfReRenders > 0) {
       
 15482     // This is a re-render. Apply the new render phase updates to the previous
       
 15483     var _dispatch = queue.dispatch;
       
 15484     if (renderPhaseUpdates !== null) {
       
 15485       // Render phase updates are stored in a map of queue -> linked list
       
 15486       var firstRenderPhaseUpdate = renderPhaseUpdates.get(queue);
       
 15487       if (firstRenderPhaseUpdate !== undefined) {
       
 15488         renderPhaseUpdates.delete(queue);
       
 15489         var newState = hook.memoizedState;
       
 15490         var update = firstRenderPhaseUpdate;
       
 15491         do {
       
 15492           // Process this render phase update. We don't have to check the
       
 15493           // priority because it will always be the same as the current
       
 15494           // render's.
       
 15495           var _action = update.action;
       
 15496           newState = reducer(newState, _action);
       
 15497           update = update.next;
       
 15498         } while (update !== null);
       
 15499 
       
 15500         // Mark that the fiber performed work, but only if the new state is
       
 15501         // different from the current state.
       
 15502         if (!is(newState, hook.memoizedState)) {
       
 15503           markWorkInProgressReceivedUpdate();
       
 15504         }
       
 15505 
       
 15506         hook.memoizedState = newState;
       
 15507         // Don't persist the state accumulated from the render phase updates to
       
 15508         // the base state unless the queue is empty.
       
 15509         // TODO: Not sure if this is the desired semantics, but it's what we
       
 15510         // do for gDSFP. I can't remember why.
       
 15511         if (hook.baseUpdate === queue.last) {
       
 15512           hook.baseState = newState;
       
 15513         }
       
 15514 
       
 15515         queue.lastRenderedState = newState;
       
 15516 
       
 15517         return [newState, _dispatch];
       
 15518       }
       
 15519     }
       
 15520     return [hook.memoizedState, _dispatch];
       
 15521   }
       
 15522 
       
 15523   // The last update in the entire queue
       
 15524   var last = queue.last;
       
 15525   // The last update that is part of the base state.
       
 15526   var baseUpdate = hook.baseUpdate;
       
 15527   var baseState = hook.baseState;
       
 15528 
       
 15529   // Find the first unprocessed update.
       
 15530   var first = void 0;
       
 15531   if (baseUpdate !== null) {
       
 15532     if (last !== null) {
       
 15533       // For the first update, the queue is a circular linked list where
       
 15534       // `queue.last.next = queue.first`. Once the first update commits, and
       
 15535       // the `baseUpdate` is no longer empty, we can unravel the list.
       
 15536       last.next = null;
       
 15537     }
       
 15538     first = baseUpdate.next;
       
 15539   } else {
       
 15540     first = last !== null ? last.next : null;
       
 15541   }
       
 15542   if (first !== null) {
       
 15543     var _newState = baseState;
       
 15544     var newBaseState = null;
       
 15545     var newBaseUpdate = null;
       
 15546     var prevUpdate = baseUpdate;
       
 15547     var _update = first;
       
 15548     var didSkip = false;
       
 15549     do {
       
 15550       var updateExpirationTime = _update.expirationTime;
       
 15551       if (updateExpirationTime < renderExpirationTime$1) {
       
 15552         // Priority is insufficient. Skip this update. If this is the first
       
 15553         // skipped update, the previous update/state is the new base
       
 15554         // update/state.
       
 15555         if (!didSkip) {
       
 15556           didSkip = true;
       
 15557           newBaseUpdate = prevUpdate;
       
 15558           newBaseState = _newState;
       
 15559         }
       
 15560         // Update the remaining priority in the queue.
       
 15561         if (updateExpirationTime > remainingExpirationTime) {
       
 15562           remainingExpirationTime = updateExpirationTime;
       
 15563         }
       
 15564       } else {
       
 15565         // This update does have sufficient priority.
       
 15566 
       
 15567         // Mark the event time of this update as relevant to this render pass.
       
 15568         // TODO: This should ideally use the true event time of this update rather than
       
 15569         // its priority which is a derived and not reverseable value.
       
 15570         // TODO: We should skip this update if it was already committed but currently
       
 15571         // we have no way of detecting the difference between a committed and suspended
       
 15572         // update here.
       
 15573         markRenderEventTimeAndConfig(updateExpirationTime, _update.suspenseConfig);
       
 15574 
       
 15575         // Process this update.
       
 15576         if (_update.eagerReducer === reducer) {
       
 15577           // If this update was processed eagerly, and its reducer matches the
       
 15578           // current reducer, we can use the eagerly computed state.
       
 15579           _newState = _update.eagerState;
       
 15580         } else {
       
 15581           var _action2 = _update.action;
       
 15582           _newState = reducer(_newState, _action2);
       
 15583         }
       
 15584       }
       
 15585       prevUpdate = _update;
       
 15586       _update = _update.next;
       
 15587     } while (_update !== null && _update !== first);
       
 15588 
       
 15589     if (!didSkip) {
       
 15590       newBaseUpdate = prevUpdate;
       
 15591       newBaseState = _newState;
       
 15592     }
       
 15593 
       
 15594     // Mark that the fiber performed work, but only if the new state is
       
 15595     // different from the current state.
       
 15596     if (!is(_newState, hook.memoizedState)) {
       
 15597       markWorkInProgressReceivedUpdate();
       
 15598     }
       
 15599 
       
 15600     hook.memoizedState = _newState;
       
 15601     hook.baseUpdate = newBaseUpdate;
       
 15602     hook.baseState = newBaseState;
       
 15603 
       
 15604     queue.lastRenderedState = _newState;
       
 15605   }
       
 15606 
       
 15607   var dispatch = queue.dispatch;
       
 15608   return [hook.memoizedState, dispatch];
       
 15609 }
       
 15610 
       
 15611 function mountState(initialState) {
       
 15612   var hook = mountWorkInProgressHook();
       
 15613   if (typeof initialState === 'function') {
       
 15614     initialState = initialState();
       
 15615   }
       
 15616   hook.memoizedState = hook.baseState = initialState;
       
 15617   var queue = hook.queue = {
       
 15618     last: null,
       
 15619     dispatch: null,
       
 15620     lastRenderedReducer: basicStateReducer,
       
 15621     lastRenderedState: initialState
       
 15622   };
       
 15623   var dispatch = queue.dispatch = dispatchAction.bind(null,
       
 15624   // Flow doesn't know this is non-null, but we do.
       
 15625   currentlyRenderingFiber$1, queue);
       
 15626   return [hook.memoizedState, dispatch];
       
 15627 }
       
 15628 
       
 15629 function updateState(initialState) {
       
 15630   return updateReducer(basicStateReducer, initialState);
       
 15631 }
       
 15632 
       
 15633 function pushEffect(tag, create, destroy, deps) {
       
 15634   var effect = {
       
 15635     tag: tag,
       
 15636     create: create,
       
 15637     destroy: destroy,
       
 15638     deps: deps,
       
 15639     // Circular
       
 15640     next: null
       
 15641   };
       
 15642   if (componentUpdateQueue === null) {
       
 15643     componentUpdateQueue = createFunctionComponentUpdateQueue();
       
 15644     componentUpdateQueue.lastEffect = effect.next = effect;
       
 15645   } else {
       
 15646     var _lastEffect = componentUpdateQueue.lastEffect;
       
 15647     if (_lastEffect === null) {
       
 15648       componentUpdateQueue.lastEffect = effect.next = effect;
       
 15649     } else {
       
 15650       var firstEffect = _lastEffect.next;
       
 15651       _lastEffect.next = effect;
       
 15652       effect.next = firstEffect;
       
 15653       componentUpdateQueue.lastEffect = effect;
       
 15654     }
       
 15655   }
       
 15656   return effect;
       
 15657 }
       
 15658 
       
 15659 function mountRef(initialValue) {
       
 15660   var hook = mountWorkInProgressHook();
       
 15661   var ref = { current: initialValue };
       
 15662   {
       
 15663     Object.seal(ref);
       
 15664   }
       
 15665   hook.memoizedState = ref;
       
 15666   return ref;
       
 15667 }
       
 15668 
       
 15669 function updateRef(initialValue) {
       
 15670   var hook = updateWorkInProgressHook();
       
 15671   return hook.memoizedState;
       
 15672 }
       
 15673 
       
 15674 function mountEffectImpl(fiberEffectTag, hookEffectTag, create, deps) {
       
 15675   var hook = mountWorkInProgressHook();
       
 15676   var nextDeps = deps === undefined ? null : deps;
       
 15677   sideEffectTag |= fiberEffectTag;
       
 15678   hook.memoizedState = pushEffect(hookEffectTag, create, undefined, nextDeps);
       
 15679 }
       
 15680 
       
 15681 function updateEffectImpl(fiberEffectTag, hookEffectTag, create, deps) {
       
 15682   var hook = updateWorkInProgressHook();
       
 15683   var nextDeps = deps === undefined ? null : deps;
       
 15684   var destroy = undefined;
       
 15685 
       
 15686   if (currentHook !== null) {
       
 15687     var prevEffect = currentHook.memoizedState;
       
 15688     destroy = prevEffect.destroy;
       
 15689     if (nextDeps !== null) {
       
 15690       var prevDeps = prevEffect.deps;
       
 15691       if (areHookInputsEqual(nextDeps, prevDeps)) {
       
 15692         pushEffect(NoEffect$1, create, destroy, nextDeps);
       
 15693         return;
       
 15694       }
       
 15695     }
       
 15696   }
       
 15697 
       
 15698   sideEffectTag |= fiberEffectTag;
       
 15699   hook.memoizedState = pushEffect(hookEffectTag, create, destroy, nextDeps);
       
 15700 }
       
 15701 
       
 15702 function mountEffect(create, deps) {
       
 15703   {
       
 15704     // $FlowExpectedError - jest isn't a global, and isn't recognized outside of tests
       
 15705     if ('undefined' !== typeof jest) {
       
 15706       warnIfNotCurrentlyActingEffectsInDEV(currentlyRenderingFiber$1);
       
 15707     }
       
 15708   }
       
 15709   return mountEffectImpl(Update | Passive, UnmountPassive | MountPassive, create, deps);
       
 15710 }
       
 15711 
       
 15712 function updateEffect(create, deps) {
       
 15713   {
       
 15714     // $FlowExpectedError - jest isn't a global, and isn't recognized outside of tests
       
 15715     if ('undefined' !== typeof jest) {
       
 15716       warnIfNotCurrentlyActingEffectsInDEV(currentlyRenderingFiber$1);
       
 15717     }
       
 15718   }
       
 15719   return updateEffectImpl(Update | Passive, UnmountPassive | MountPassive, create, deps);
       
 15720 }
       
 15721 
       
 15722 function mountLayoutEffect(create, deps) {
       
 15723   return mountEffectImpl(Update, UnmountMutation | MountLayout, create, deps);
       
 15724 }
       
 15725 
       
 15726 function updateLayoutEffect(create, deps) {
       
 15727   return updateEffectImpl(Update, UnmountMutation | MountLayout, create, deps);
       
 15728 }
       
 15729 
       
 15730 function imperativeHandleEffect(create, ref) {
       
 15731   if (typeof ref === 'function') {
       
 15732     var refCallback = ref;
       
 15733     var _inst = create();
       
 15734     refCallback(_inst);
       
 15735     return function () {
       
 15736       refCallback(null);
       
 15737     };
       
 15738   } else if (ref !== null && ref !== undefined) {
       
 15739     var refObject = ref;
       
 15740     {
       
 15741       !refObject.hasOwnProperty('current') ? warning$1(false, 'Expected useImperativeHandle() first argument to either be a ' + 'ref callback or React.createRef() object. Instead received: %s.', 'an object with keys {' + Object.keys(refObject).join(', ') + '}') : void 0;
       
 15742     }
       
 15743     var _inst2 = create();
       
 15744     refObject.current = _inst2;
       
 15745     return function () {
       
 15746       refObject.current = null;
       
 15747     };
       
 15748   }
       
 15749 }
       
 15750 
       
 15751 function mountImperativeHandle(ref, create, deps) {
       
 15752   {
       
 15753     !(typeof create === 'function') ? warning$1(false, 'Expected useImperativeHandle() second argument to be a function ' + 'that creates a handle. Instead received: %s.', create !== null ? typeof create : 'null') : void 0;
       
 15754   }
       
 15755 
       
 15756   // TODO: If deps are provided, should we skip comparing the ref itself?
       
 15757   var effectDeps = deps !== null && deps !== undefined ? deps.concat([ref]) : null;
       
 15758 
       
 15759   return mountEffectImpl(Update, UnmountMutation | MountLayout, imperativeHandleEffect.bind(null, create, ref), effectDeps);
       
 15760 }
       
 15761 
       
 15762 function updateImperativeHandle(ref, create, deps) {
       
 15763   {
       
 15764     !(typeof create === 'function') ? warning$1(false, 'Expected useImperativeHandle() second argument to be a function ' + 'that creates a handle. Instead received: %s.', create !== null ? typeof create : 'null') : void 0;
       
 15765   }
       
 15766 
       
 15767   // TODO: If deps are provided, should we skip comparing the ref itself?
       
 15768   var effectDeps = deps !== null && deps !== undefined ? deps.concat([ref]) : null;
       
 15769 
       
 15770   return updateEffectImpl(Update, UnmountMutation | MountLayout, imperativeHandleEffect.bind(null, create, ref), effectDeps);
       
 15771 }
       
 15772 
       
 15773 function mountDebugValue(value, formatterFn) {
       
 15774   // This hook is normally a no-op.
       
 15775   // The react-debug-hooks package injects its own implementation
       
 15776   // so that e.g. DevTools can display custom hook values.
       
 15777 }
       
 15778 
       
 15779 var updateDebugValue = mountDebugValue;
       
 15780 
       
 15781 function mountCallback(callback, deps) {
       
 15782   var hook = mountWorkInProgressHook();
       
 15783   var nextDeps = deps === undefined ? null : deps;
       
 15784   hook.memoizedState = [callback, nextDeps];
       
 15785   return callback;
       
 15786 }
       
 15787 
       
 15788 function updateCallback(callback, deps) {
       
 15789   var hook = updateWorkInProgressHook();
       
 15790   var nextDeps = deps === undefined ? null : deps;
       
 15791   var prevState = hook.memoizedState;
       
 15792   if (prevState !== null) {
       
 15793     if (nextDeps !== null) {
       
 15794       var prevDeps = prevState[1];
       
 15795       if (areHookInputsEqual(nextDeps, prevDeps)) {
       
 15796         return prevState[0];
       
 15797       }
       
 15798     }
       
 15799   }
       
 15800   hook.memoizedState = [callback, nextDeps];
       
 15801   return callback;
       
 15802 }
       
 15803 
       
 15804 function mountMemo(nextCreate, deps) {
       
 15805   var hook = mountWorkInProgressHook();
       
 15806   var nextDeps = deps === undefined ? null : deps;
       
 15807   var nextValue = nextCreate();
       
 15808   hook.memoizedState = [nextValue, nextDeps];
       
 15809   return nextValue;
       
 15810 }
       
 15811 
       
 15812 function updateMemo(nextCreate, deps) {
       
 15813   var hook = updateWorkInProgressHook();
       
 15814   var nextDeps = deps === undefined ? null : deps;
       
 15815   var prevState = hook.memoizedState;
       
 15816   if (prevState !== null) {
       
 15817     // Assume these are defined. If they're not, areHookInputsEqual will warn.
       
 15818     if (nextDeps !== null) {
       
 15819       var prevDeps = prevState[1];
       
 15820       if (areHookInputsEqual(nextDeps, prevDeps)) {
       
 15821         return prevState[0];
       
 15822       }
       
 15823     }
       
 15824   }
       
 15825   var nextValue = nextCreate();
       
 15826   hook.memoizedState = [nextValue, nextDeps];
       
 15827   return nextValue;
       
 15828 }
       
 15829 
       
 15830 function dispatchAction(fiber, queue, action) {
       
 15831   (function () {
       
 15832     if (!(numberOfReRenders < RE_RENDER_LIMIT)) {
       
 15833       {
       
 15834         throw ReactError(Error('Too many re-renders. React limits the number of renders to prevent an infinite loop.'));
       
 15835       }
       
 15836     }
       
 15837   })();
       
 15838 
       
 15839   {
       
 15840     !(arguments.length <= 3) ? warning$1(false, "State updates from the useState() and useReducer() Hooks don't support the " + 'second callback argument. To execute a side effect after ' + 'rendering, declare it in the component body with useEffect().') : void 0;
       
 15841   }
       
 15842 
       
 15843   var alternate = fiber.alternate;
       
 15844   if (fiber === currentlyRenderingFiber$1 || alternate !== null && alternate === currentlyRenderingFiber$1) {
       
 15845     // This is a render phase update. Stash it in a lazily-created map of
       
 15846     // queue -> linked list of updates. After this render pass, we'll restart
       
 15847     // and apply the stashed updates on top of the work-in-progress hook.
       
 15848     didScheduleRenderPhaseUpdate = true;
       
 15849     var update = {
 15712     var update = {
 15850       expirationTime: renderExpirationTime$1,
 15713       expirationTime: expirationTime,
 15851       suspenseConfig: null,
 15714       suspenseConfig: suspenseConfig,
 15852       action: action,
 15715       action: action,
 15853       eagerReducer: null,
 15716       eagerReducer: null,
 15854       eagerState: null,
 15717       eagerState: null,
 15855       next: null
 15718       next: null
 15856     };
 15719     };
       
 15720 
 15857     {
 15721     {
 15858       update.priority = getCurrentPriorityLevel();
 15722       update.priority = getCurrentPriorityLevel();
 15859     }
 15723     } // Append the update to the end of the list.
 15860     if (renderPhaseUpdates === null) {
 15724 
 15861       renderPhaseUpdates = new Map();
 15725 
 15862     }
 15726     var pending = queue.pending;
 15863     var firstRenderPhaseUpdate = renderPhaseUpdates.get(queue);
 15727 
 15864     if (firstRenderPhaseUpdate === undefined) {
 15728     if (pending === null) {
 15865       renderPhaseUpdates.set(queue, update);
 15729       // This is the first update. Create a circular list.
       
 15730       update.next = update;
 15866     } else {
 15731     } else {
 15867       // Append the update to the end of the list.
 15732       update.next = pending.next;
 15868       var lastRenderPhaseUpdate = firstRenderPhaseUpdate;
 15733       pending.next = update;
 15869       while (lastRenderPhaseUpdate.next !== null) {
 15734     }
 15870         lastRenderPhaseUpdate = lastRenderPhaseUpdate.next;
 15735 
 15871       }
 15736     queue.pending = update;
 15872       lastRenderPhaseUpdate.next = update;
 15737     var alternate = fiber.alternate;
 15873     }
 15738 
 15874   } else {
 15739     if (fiber === currentlyRenderingFiber$1 || alternate !== null && alternate === currentlyRenderingFiber$1) {
 15875     if (revertPassiveEffectsChange) {
 15740       // This is a render phase update. Stash it in a lazily-created map of
 15876       flushPassiveEffects();
 15741       // queue -> linked list of updates. After this render pass, we'll restart
 15877     }
 15742       // and apply the stashed updates on top of the work-in-progress hook.
 15878 
 15743       didScheduleRenderPhaseUpdate = true;
 15879     var currentTime = requestCurrentTime();
 15744       update.expirationTime = renderExpirationTime;
 15880     var _suspenseConfig = requestCurrentSuspenseConfig();
 15745       currentlyRenderingFiber$1.expirationTime = renderExpirationTime;
 15881     var _expirationTime = computeExpirationForFiber(currentTime, fiber, _suspenseConfig);
 15746     } else {
 15882 
 15747       if (fiber.expirationTime === NoWork && (alternate === null || alternate.expirationTime === NoWork)) {
 15883     var _update2 = {
 15748         // The queue is currently empty, which means we can eagerly compute the
 15884       expirationTime: _expirationTime,
 15749         // next state before entering the render phase. If the new state is the
 15885       suspenseConfig: _suspenseConfig,
 15750         // same as the current state, we may be able to bail out entirely.
 15886       action: action,
 15751         var lastRenderedReducer = queue.lastRenderedReducer;
 15887       eagerReducer: null,
 15752 
 15888       eagerState: null,
 15753         if (lastRenderedReducer !== null) {
 15889       next: null
 15754           var prevDispatcher;
       
 15755 
       
 15756           {
       
 15757             prevDispatcher = ReactCurrentDispatcher.current;
       
 15758             ReactCurrentDispatcher.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
       
 15759           }
       
 15760 
       
 15761           try {
       
 15762             var currentState = queue.lastRenderedState;
       
 15763             var eagerState = lastRenderedReducer(currentState, action); // Stash the eagerly computed state, and the reducer used to compute
       
 15764             // it, on the update object. If the reducer hasn't changed by the
       
 15765             // time we enter the render phase, then the eager state can be used
       
 15766             // without calling the reducer again.
       
 15767 
       
 15768             update.eagerReducer = lastRenderedReducer;
       
 15769             update.eagerState = eagerState;
       
 15770 
       
 15771             if (objectIs(eagerState, currentState)) {
       
 15772               // Fast path. We can bail out without scheduling React to re-render.
       
 15773               // It's still possible that we'll need to rebase this update later,
       
 15774               // if the component re-renders for a different reason and by that
       
 15775               // time the reducer has changed.
       
 15776               return;
       
 15777             }
       
 15778           } catch (error) {// Suppress the error. It will throw again in the render phase.
       
 15779           } finally {
       
 15780             {
       
 15781               ReactCurrentDispatcher.current = prevDispatcher;
       
 15782             }
       
 15783           }
       
 15784         }
       
 15785       }
       
 15786 
       
 15787       {
       
 15788         // $FlowExpectedError - jest isn't a global, and isn't recognized outside of tests
       
 15789         if ('undefined' !== typeof jest) {
       
 15790           warnIfNotScopedWithMatchingAct(fiber);
       
 15791           warnIfNotCurrentlyActingUpdatesInDev(fiber);
       
 15792         }
       
 15793       }
       
 15794 
       
 15795       scheduleWork(fiber, expirationTime);
       
 15796     }
       
 15797   }
       
 15798 
       
 15799   var ContextOnlyDispatcher = {
       
 15800     readContext: readContext,
       
 15801     useCallback: throwInvalidHookError,
       
 15802     useContext: throwInvalidHookError,
       
 15803     useEffect: throwInvalidHookError,
       
 15804     useImperativeHandle: throwInvalidHookError,
       
 15805     useLayoutEffect: throwInvalidHookError,
       
 15806     useMemo: throwInvalidHookError,
       
 15807     useReducer: throwInvalidHookError,
       
 15808     useRef: throwInvalidHookError,
       
 15809     useState: throwInvalidHookError,
       
 15810     useDebugValue: throwInvalidHookError,
       
 15811     useResponder: throwInvalidHookError,
       
 15812     useDeferredValue: throwInvalidHookError,
       
 15813     useTransition: throwInvalidHookError
       
 15814   };
       
 15815   var HooksDispatcherOnMountInDEV = null;
       
 15816   var HooksDispatcherOnMountWithHookTypesInDEV = null;
       
 15817   var HooksDispatcherOnUpdateInDEV = null;
       
 15818   var HooksDispatcherOnRerenderInDEV = null;
       
 15819   var InvalidNestedHooksDispatcherOnMountInDEV = null;
       
 15820   var InvalidNestedHooksDispatcherOnUpdateInDEV = null;
       
 15821   var InvalidNestedHooksDispatcherOnRerenderInDEV = null;
       
 15822 
       
 15823   {
       
 15824     var warnInvalidContextAccess = function () {
       
 15825       error('Context can only be read while React is rendering. ' + 'In classes, you can read it in the render method or getDerivedStateFromProps. ' + 'In function components, you can read it directly in the function body, but not ' + 'inside Hooks like useReducer() or useMemo().');
 15890     };
 15826     };
 15891 
 15827 
       
 15828     var warnInvalidHookAccess = function () {
       
 15829       error('Do not call Hooks inside useEffect(...), useMemo(...), or other built-in Hooks. ' + 'You can only call Hooks at the top level of your React function. ' + 'For more information, see ' + 'https://fb.me/rules-of-hooks');
       
 15830     };
       
 15831 
       
 15832     HooksDispatcherOnMountInDEV = {
       
 15833       readContext: function (context, observedBits) {
       
 15834         return readContext(context, observedBits);
       
 15835       },
       
 15836       useCallback: function (callback, deps) {
       
 15837         currentHookNameInDev = 'useCallback';
       
 15838         mountHookTypesDev();
       
 15839         checkDepsAreArrayDev(deps);
       
 15840         return mountCallback(callback, deps);
       
 15841       },
       
 15842       useContext: function (context, observedBits) {
       
 15843         currentHookNameInDev = 'useContext';
       
 15844         mountHookTypesDev();
       
 15845         return readContext(context, observedBits);
       
 15846       },
       
 15847       useEffect: function (create, deps) {
       
 15848         currentHookNameInDev = 'useEffect';
       
 15849         mountHookTypesDev();
       
 15850         checkDepsAreArrayDev(deps);
       
 15851         return mountEffect(create, deps);
       
 15852       },
       
 15853       useImperativeHandle: function (ref, create, deps) {
       
 15854         currentHookNameInDev = 'useImperativeHandle';
       
 15855         mountHookTypesDev();
       
 15856         checkDepsAreArrayDev(deps);
       
 15857         return mountImperativeHandle(ref, create, deps);
       
 15858       },
       
 15859       useLayoutEffect: function (create, deps) {
       
 15860         currentHookNameInDev = 'useLayoutEffect';
       
 15861         mountHookTypesDev();
       
 15862         checkDepsAreArrayDev(deps);
       
 15863         return mountLayoutEffect(create, deps);
       
 15864       },
       
 15865       useMemo: function (create, deps) {
       
 15866         currentHookNameInDev = 'useMemo';
       
 15867         mountHookTypesDev();
       
 15868         checkDepsAreArrayDev(deps);
       
 15869         var prevDispatcher = ReactCurrentDispatcher.current;
       
 15870         ReactCurrentDispatcher.current = InvalidNestedHooksDispatcherOnMountInDEV;
       
 15871 
       
 15872         try {
       
 15873           return mountMemo(create, deps);
       
 15874         } finally {
       
 15875           ReactCurrentDispatcher.current = prevDispatcher;
       
 15876         }
       
 15877       },
       
 15878       useReducer: function (reducer, initialArg, init) {
       
 15879         currentHookNameInDev = 'useReducer';
       
 15880         mountHookTypesDev();
       
 15881         var prevDispatcher = ReactCurrentDispatcher.current;
       
 15882         ReactCurrentDispatcher.current = InvalidNestedHooksDispatcherOnMountInDEV;
       
 15883 
       
 15884         try {
       
 15885           return mountReducer(reducer, initialArg, init);
       
 15886         } finally {
       
 15887           ReactCurrentDispatcher.current = prevDispatcher;
       
 15888         }
       
 15889       },
       
 15890       useRef: function (initialValue) {
       
 15891         currentHookNameInDev = 'useRef';
       
 15892         mountHookTypesDev();
       
 15893         return mountRef(initialValue);
       
 15894       },
       
 15895       useState: function (initialState) {
       
 15896         currentHookNameInDev = 'useState';
       
 15897         mountHookTypesDev();
       
 15898         var prevDispatcher = ReactCurrentDispatcher.current;
       
 15899         ReactCurrentDispatcher.current = InvalidNestedHooksDispatcherOnMountInDEV;
       
 15900 
       
 15901         try {
       
 15902           return mountState(initialState);
       
 15903         } finally {
       
 15904           ReactCurrentDispatcher.current = prevDispatcher;
       
 15905         }
       
 15906       },
       
 15907       useDebugValue: function (value, formatterFn) {
       
 15908         currentHookNameInDev = 'useDebugValue';
       
 15909         mountHookTypesDev();
       
 15910         return mountDebugValue();
       
 15911       },
       
 15912       useResponder: function (responder, props) {
       
 15913         currentHookNameInDev = 'useResponder';
       
 15914         mountHookTypesDev();
       
 15915         return createDeprecatedResponderListener(responder, props);
       
 15916       },
       
 15917       useDeferredValue: function (value, config) {
       
 15918         currentHookNameInDev = 'useDeferredValue';
       
 15919         mountHookTypesDev();
       
 15920         return mountDeferredValue(value, config);
       
 15921       },
       
 15922       useTransition: function (config) {
       
 15923         currentHookNameInDev = 'useTransition';
       
 15924         mountHookTypesDev();
       
 15925         return mountTransition(config);
       
 15926       }
       
 15927     };
       
 15928     HooksDispatcherOnMountWithHookTypesInDEV = {
       
 15929       readContext: function (context, observedBits) {
       
 15930         return readContext(context, observedBits);
       
 15931       },
       
 15932       useCallback: function (callback, deps) {
       
 15933         currentHookNameInDev = 'useCallback';
       
 15934         updateHookTypesDev();
       
 15935         return mountCallback(callback, deps);
       
 15936       },
       
 15937       useContext: function (context, observedBits) {
       
 15938         currentHookNameInDev = 'useContext';
       
 15939         updateHookTypesDev();
       
 15940         return readContext(context, observedBits);
       
 15941       },
       
 15942       useEffect: function (create, deps) {
       
 15943         currentHookNameInDev = 'useEffect';
       
 15944         updateHookTypesDev();
       
 15945         return mountEffect(create, deps);
       
 15946       },
       
 15947       useImperativeHandle: function (ref, create, deps) {
       
 15948         currentHookNameInDev = 'useImperativeHandle';
       
 15949         updateHookTypesDev();
       
 15950         return mountImperativeHandle(ref, create, deps);
       
 15951       },
       
 15952       useLayoutEffect: function (create, deps) {
       
 15953         currentHookNameInDev = 'useLayoutEffect';
       
 15954         updateHookTypesDev();
       
 15955         return mountLayoutEffect(create, deps);
       
 15956       },
       
 15957       useMemo: function (create, deps) {
       
 15958         currentHookNameInDev = 'useMemo';
       
 15959         updateHookTypesDev();
       
 15960         var prevDispatcher = ReactCurrentDispatcher.current;
       
 15961         ReactCurrentDispatcher.current = InvalidNestedHooksDispatcherOnMountInDEV;
       
 15962 
       
 15963         try {
       
 15964           return mountMemo(create, deps);
       
 15965         } finally {
       
 15966           ReactCurrentDispatcher.current = prevDispatcher;
       
 15967         }
       
 15968       },
       
 15969       useReducer: function (reducer, initialArg, init) {
       
 15970         currentHookNameInDev = 'useReducer';
       
 15971         updateHookTypesDev();
       
 15972         var prevDispatcher = ReactCurrentDispatcher.current;
       
 15973         ReactCurrentDispatcher.current = InvalidNestedHooksDispatcherOnMountInDEV;
       
 15974 
       
 15975         try {
       
 15976           return mountReducer(reducer, initialArg, init);
       
 15977         } finally {
       
 15978           ReactCurrentDispatcher.current = prevDispatcher;
       
 15979         }
       
 15980       },
       
 15981       useRef: function (initialValue) {
       
 15982         currentHookNameInDev = 'useRef';
       
 15983         updateHookTypesDev();
       
 15984         return mountRef(initialValue);
       
 15985       },
       
 15986       useState: function (initialState) {
       
 15987         currentHookNameInDev = 'useState';
       
 15988         updateHookTypesDev();
       
 15989         var prevDispatcher = ReactCurrentDispatcher.current;
       
 15990         ReactCurrentDispatcher.current = InvalidNestedHooksDispatcherOnMountInDEV;
       
 15991 
       
 15992         try {
       
 15993           return mountState(initialState);
       
 15994         } finally {
       
 15995           ReactCurrentDispatcher.current = prevDispatcher;
       
 15996         }
       
 15997       },
       
 15998       useDebugValue: function (value, formatterFn) {
       
 15999         currentHookNameInDev = 'useDebugValue';
       
 16000         updateHookTypesDev();
       
 16001         return mountDebugValue();
       
 16002       },
       
 16003       useResponder: function (responder, props) {
       
 16004         currentHookNameInDev = 'useResponder';
       
 16005         updateHookTypesDev();
       
 16006         return createDeprecatedResponderListener(responder, props);
       
 16007       },
       
 16008       useDeferredValue: function (value, config) {
       
 16009         currentHookNameInDev = 'useDeferredValue';
       
 16010         updateHookTypesDev();
       
 16011         return mountDeferredValue(value, config);
       
 16012       },
       
 16013       useTransition: function (config) {
       
 16014         currentHookNameInDev = 'useTransition';
       
 16015         updateHookTypesDev();
       
 16016         return mountTransition(config);
       
 16017       }
       
 16018     };
       
 16019     HooksDispatcherOnUpdateInDEV = {
       
 16020       readContext: function (context, observedBits) {
       
 16021         return readContext(context, observedBits);
       
 16022       },
       
 16023       useCallback: function (callback, deps) {
       
 16024         currentHookNameInDev = 'useCallback';
       
 16025         updateHookTypesDev();
       
 16026         return updateCallback(callback, deps);
       
 16027       },
       
 16028       useContext: function (context, observedBits) {
       
 16029         currentHookNameInDev = 'useContext';
       
 16030         updateHookTypesDev();
       
 16031         return readContext(context, observedBits);
       
 16032       },
       
 16033       useEffect: function (create, deps) {
       
 16034         currentHookNameInDev = 'useEffect';
       
 16035         updateHookTypesDev();
       
 16036         return updateEffect(create, deps);
       
 16037       },
       
 16038       useImperativeHandle: function (ref, create, deps) {
       
 16039         currentHookNameInDev = 'useImperativeHandle';
       
 16040         updateHookTypesDev();
       
 16041         return updateImperativeHandle(ref, create, deps);
       
 16042       },
       
 16043       useLayoutEffect: function (create, deps) {
       
 16044         currentHookNameInDev = 'useLayoutEffect';
       
 16045         updateHookTypesDev();
       
 16046         return updateLayoutEffect(create, deps);
       
 16047       },
       
 16048       useMemo: function (create, deps) {
       
 16049         currentHookNameInDev = 'useMemo';
       
 16050         updateHookTypesDev();
       
 16051         var prevDispatcher = ReactCurrentDispatcher.current;
       
 16052         ReactCurrentDispatcher.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
       
 16053 
       
 16054         try {
       
 16055           return updateMemo(create, deps);
       
 16056         } finally {
       
 16057           ReactCurrentDispatcher.current = prevDispatcher;
       
 16058         }
       
 16059       },
       
 16060       useReducer: function (reducer, initialArg, init) {
       
 16061         currentHookNameInDev = 'useReducer';
       
 16062         updateHookTypesDev();
       
 16063         var prevDispatcher = ReactCurrentDispatcher.current;
       
 16064         ReactCurrentDispatcher.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
       
 16065 
       
 16066         try {
       
 16067           return updateReducer(reducer, initialArg, init);
       
 16068         } finally {
       
 16069           ReactCurrentDispatcher.current = prevDispatcher;
       
 16070         }
       
 16071       },
       
 16072       useRef: function (initialValue) {
       
 16073         currentHookNameInDev = 'useRef';
       
 16074         updateHookTypesDev();
       
 16075         return updateRef();
       
 16076       },
       
 16077       useState: function (initialState) {
       
 16078         currentHookNameInDev = 'useState';
       
 16079         updateHookTypesDev();
       
 16080         var prevDispatcher = ReactCurrentDispatcher.current;
       
 16081         ReactCurrentDispatcher.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
       
 16082 
       
 16083         try {
       
 16084           return updateState(initialState);
       
 16085         } finally {
       
 16086           ReactCurrentDispatcher.current = prevDispatcher;
       
 16087         }
       
 16088       },
       
 16089       useDebugValue: function (value, formatterFn) {
       
 16090         currentHookNameInDev = 'useDebugValue';
       
 16091         updateHookTypesDev();
       
 16092         return updateDebugValue();
       
 16093       },
       
 16094       useResponder: function (responder, props) {
       
 16095         currentHookNameInDev = 'useResponder';
       
 16096         updateHookTypesDev();
       
 16097         return createDeprecatedResponderListener(responder, props);
       
 16098       },
       
 16099       useDeferredValue: function (value, config) {
       
 16100         currentHookNameInDev = 'useDeferredValue';
       
 16101         updateHookTypesDev();
       
 16102         return updateDeferredValue(value, config);
       
 16103       },
       
 16104       useTransition: function (config) {
       
 16105         currentHookNameInDev = 'useTransition';
       
 16106         updateHookTypesDev();
       
 16107         return updateTransition(config);
       
 16108       }
       
 16109     };
       
 16110     HooksDispatcherOnRerenderInDEV = {
       
 16111       readContext: function (context, observedBits) {
       
 16112         return readContext(context, observedBits);
       
 16113       },
       
 16114       useCallback: function (callback, deps) {
       
 16115         currentHookNameInDev = 'useCallback';
       
 16116         updateHookTypesDev();
       
 16117         return updateCallback(callback, deps);
       
 16118       },
       
 16119       useContext: function (context, observedBits) {
       
 16120         currentHookNameInDev = 'useContext';
       
 16121         updateHookTypesDev();
       
 16122         return readContext(context, observedBits);
       
 16123       },
       
 16124       useEffect: function (create, deps) {
       
 16125         currentHookNameInDev = 'useEffect';
       
 16126         updateHookTypesDev();
       
 16127         return updateEffect(create, deps);
       
 16128       },
       
 16129       useImperativeHandle: function (ref, create, deps) {
       
 16130         currentHookNameInDev = 'useImperativeHandle';
       
 16131         updateHookTypesDev();
       
 16132         return updateImperativeHandle(ref, create, deps);
       
 16133       },
       
 16134       useLayoutEffect: function (create, deps) {
       
 16135         currentHookNameInDev = 'useLayoutEffect';
       
 16136         updateHookTypesDev();
       
 16137         return updateLayoutEffect(create, deps);
       
 16138       },
       
 16139       useMemo: function (create, deps) {
       
 16140         currentHookNameInDev = 'useMemo';
       
 16141         updateHookTypesDev();
       
 16142         var prevDispatcher = ReactCurrentDispatcher.current;
       
 16143         ReactCurrentDispatcher.current = InvalidNestedHooksDispatcherOnRerenderInDEV;
       
 16144 
       
 16145         try {
       
 16146           return updateMemo(create, deps);
       
 16147         } finally {
       
 16148           ReactCurrentDispatcher.current = prevDispatcher;
       
 16149         }
       
 16150       },
       
 16151       useReducer: function (reducer, initialArg, init) {
       
 16152         currentHookNameInDev = 'useReducer';
       
 16153         updateHookTypesDev();
       
 16154         var prevDispatcher = ReactCurrentDispatcher.current;
       
 16155         ReactCurrentDispatcher.current = InvalidNestedHooksDispatcherOnRerenderInDEV;
       
 16156 
       
 16157         try {
       
 16158           return rerenderReducer(reducer, initialArg, init);
       
 16159         } finally {
       
 16160           ReactCurrentDispatcher.current = prevDispatcher;
       
 16161         }
       
 16162       },
       
 16163       useRef: function (initialValue) {
       
 16164         currentHookNameInDev = 'useRef';
       
 16165         updateHookTypesDev();
       
 16166         return updateRef();
       
 16167       },
       
 16168       useState: function (initialState) {
       
 16169         currentHookNameInDev = 'useState';
       
 16170         updateHookTypesDev();
       
 16171         var prevDispatcher = ReactCurrentDispatcher.current;
       
 16172         ReactCurrentDispatcher.current = InvalidNestedHooksDispatcherOnRerenderInDEV;
       
 16173 
       
 16174         try {
       
 16175           return rerenderState(initialState);
       
 16176         } finally {
       
 16177           ReactCurrentDispatcher.current = prevDispatcher;
       
 16178         }
       
 16179       },
       
 16180       useDebugValue: function (value, formatterFn) {
       
 16181         currentHookNameInDev = 'useDebugValue';
       
 16182         updateHookTypesDev();
       
 16183         return updateDebugValue();
       
 16184       },
       
 16185       useResponder: function (responder, props) {
       
 16186         currentHookNameInDev = 'useResponder';
       
 16187         updateHookTypesDev();
       
 16188         return createDeprecatedResponderListener(responder, props);
       
 16189       },
       
 16190       useDeferredValue: function (value, config) {
       
 16191         currentHookNameInDev = 'useDeferredValue';
       
 16192         updateHookTypesDev();
       
 16193         return rerenderDeferredValue(value, config);
       
 16194       },
       
 16195       useTransition: function (config) {
       
 16196         currentHookNameInDev = 'useTransition';
       
 16197         updateHookTypesDev();
       
 16198         return rerenderTransition(config);
       
 16199       }
       
 16200     };
       
 16201     InvalidNestedHooksDispatcherOnMountInDEV = {
       
 16202       readContext: function (context, observedBits) {
       
 16203         warnInvalidContextAccess();
       
 16204         return readContext(context, observedBits);
       
 16205       },
       
 16206       useCallback: function (callback, deps) {
       
 16207         currentHookNameInDev = 'useCallback';
       
 16208         warnInvalidHookAccess();
       
 16209         mountHookTypesDev();
       
 16210         return mountCallback(callback, deps);
       
 16211       },
       
 16212       useContext: function (context, observedBits) {
       
 16213         currentHookNameInDev = 'useContext';
       
 16214         warnInvalidHookAccess();
       
 16215         mountHookTypesDev();
       
 16216         return readContext(context, observedBits);
       
 16217       },
       
 16218       useEffect: function (create, deps) {
       
 16219         currentHookNameInDev = 'useEffect';
       
 16220         warnInvalidHookAccess();
       
 16221         mountHookTypesDev();
       
 16222         return mountEffect(create, deps);
       
 16223       },
       
 16224       useImperativeHandle: function (ref, create, deps) {
       
 16225         currentHookNameInDev = 'useImperativeHandle';
       
 16226         warnInvalidHookAccess();
       
 16227         mountHookTypesDev();
       
 16228         return mountImperativeHandle(ref, create, deps);
       
 16229       },
       
 16230       useLayoutEffect: function (create, deps) {
       
 16231         currentHookNameInDev = 'useLayoutEffect';
       
 16232         warnInvalidHookAccess();
       
 16233         mountHookTypesDev();
       
 16234         return mountLayoutEffect(create, deps);
       
 16235       },
       
 16236       useMemo: function (create, deps) {
       
 16237         currentHookNameInDev = 'useMemo';
       
 16238         warnInvalidHookAccess();
       
 16239         mountHookTypesDev();
       
 16240         var prevDispatcher = ReactCurrentDispatcher.current;
       
 16241         ReactCurrentDispatcher.current = InvalidNestedHooksDispatcherOnMountInDEV;
       
 16242 
       
 16243         try {
       
 16244           return mountMemo(create, deps);
       
 16245         } finally {
       
 16246           ReactCurrentDispatcher.current = prevDispatcher;
       
 16247         }
       
 16248       },
       
 16249       useReducer: function (reducer, initialArg, init) {
       
 16250         currentHookNameInDev = 'useReducer';
       
 16251         warnInvalidHookAccess();
       
 16252         mountHookTypesDev();
       
 16253         var prevDispatcher = ReactCurrentDispatcher.current;
       
 16254         ReactCurrentDispatcher.current = InvalidNestedHooksDispatcherOnMountInDEV;
       
 16255 
       
 16256         try {
       
 16257           return mountReducer(reducer, initialArg, init);
       
 16258         } finally {
       
 16259           ReactCurrentDispatcher.current = prevDispatcher;
       
 16260         }
       
 16261       },
       
 16262       useRef: function (initialValue) {
       
 16263         currentHookNameInDev = 'useRef';
       
 16264         warnInvalidHookAccess();
       
 16265         mountHookTypesDev();
       
 16266         return mountRef(initialValue);
       
 16267       },
       
 16268       useState: function (initialState) {
       
 16269         currentHookNameInDev = 'useState';
       
 16270         warnInvalidHookAccess();
       
 16271         mountHookTypesDev();
       
 16272         var prevDispatcher = ReactCurrentDispatcher.current;
       
 16273         ReactCurrentDispatcher.current = InvalidNestedHooksDispatcherOnMountInDEV;
       
 16274 
       
 16275         try {
       
 16276           return mountState(initialState);
       
 16277         } finally {
       
 16278           ReactCurrentDispatcher.current = prevDispatcher;
       
 16279         }
       
 16280       },
       
 16281       useDebugValue: function (value, formatterFn) {
       
 16282         currentHookNameInDev = 'useDebugValue';
       
 16283         warnInvalidHookAccess();
       
 16284         mountHookTypesDev();
       
 16285         return mountDebugValue();
       
 16286       },
       
 16287       useResponder: function (responder, props) {
       
 16288         currentHookNameInDev = 'useResponder';
       
 16289         warnInvalidHookAccess();
       
 16290         mountHookTypesDev();
       
 16291         return createDeprecatedResponderListener(responder, props);
       
 16292       },
       
 16293       useDeferredValue: function (value, config) {
       
 16294         currentHookNameInDev = 'useDeferredValue';
       
 16295         warnInvalidHookAccess();
       
 16296         mountHookTypesDev();
       
 16297         return mountDeferredValue(value, config);
       
 16298       },
       
 16299       useTransition: function (config) {
       
 16300         currentHookNameInDev = 'useTransition';
       
 16301         warnInvalidHookAccess();
       
 16302         mountHookTypesDev();
       
 16303         return mountTransition(config);
       
 16304       }
       
 16305     };
       
 16306     InvalidNestedHooksDispatcherOnUpdateInDEV = {
       
 16307       readContext: function (context, observedBits) {
       
 16308         warnInvalidContextAccess();
       
 16309         return readContext(context, observedBits);
       
 16310       },
       
 16311       useCallback: function (callback, deps) {
       
 16312         currentHookNameInDev = 'useCallback';
       
 16313         warnInvalidHookAccess();
       
 16314         updateHookTypesDev();
       
 16315         return updateCallback(callback, deps);
       
 16316       },
       
 16317       useContext: function (context, observedBits) {
       
 16318         currentHookNameInDev = 'useContext';
       
 16319         warnInvalidHookAccess();
       
 16320         updateHookTypesDev();
       
 16321         return readContext(context, observedBits);
       
 16322       },
       
 16323       useEffect: function (create, deps) {
       
 16324         currentHookNameInDev = 'useEffect';
       
 16325         warnInvalidHookAccess();
       
 16326         updateHookTypesDev();
       
 16327         return updateEffect(create, deps);
       
 16328       },
       
 16329       useImperativeHandle: function (ref, create, deps) {
       
 16330         currentHookNameInDev = 'useImperativeHandle';
       
 16331         warnInvalidHookAccess();
       
 16332         updateHookTypesDev();
       
 16333         return updateImperativeHandle(ref, create, deps);
       
 16334       },
       
 16335       useLayoutEffect: function (create, deps) {
       
 16336         currentHookNameInDev = 'useLayoutEffect';
       
 16337         warnInvalidHookAccess();
       
 16338         updateHookTypesDev();
       
 16339         return updateLayoutEffect(create, deps);
       
 16340       },
       
 16341       useMemo: function (create, deps) {
       
 16342         currentHookNameInDev = 'useMemo';
       
 16343         warnInvalidHookAccess();
       
 16344         updateHookTypesDev();
       
 16345         var prevDispatcher = ReactCurrentDispatcher.current;
       
 16346         ReactCurrentDispatcher.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
       
 16347 
       
 16348         try {
       
 16349           return updateMemo(create, deps);
       
 16350         } finally {
       
 16351           ReactCurrentDispatcher.current = prevDispatcher;
       
 16352         }
       
 16353       },
       
 16354       useReducer: function (reducer, initialArg, init) {
       
 16355         currentHookNameInDev = 'useReducer';
       
 16356         warnInvalidHookAccess();
       
 16357         updateHookTypesDev();
       
 16358         var prevDispatcher = ReactCurrentDispatcher.current;
       
 16359         ReactCurrentDispatcher.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
       
 16360 
       
 16361         try {
       
 16362           return updateReducer(reducer, initialArg, init);
       
 16363         } finally {
       
 16364           ReactCurrentDispatcher.current = prevDispatcher;
       
 16365         }
       
 16366       },
       
 16367       useRef: function (initialValue) {
       
 16368         currentHookNameInDev = 'useRef';
       
 16369         warnInvalidHookAccess();
       
 16370         updateHookTypesDev();
       
 16371         return updateRef();
       
 16372       },
       
 16373       useState: function (initialState) {
       
 16374         currentHookNameInDev = 'useState';
       
 16375         warnInvalidHookAccess();
       
 16376         updateHookTypesDev();
       
 16377         var prevDispatcher = ReactCurrentDispatcher.current;
       
 16378         ReactCurrentDispatcher.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
       
 16379 
       
 16380         try {
       
 16381           return updateState(initialState);
       
 16382         } finally {
       
 16383           ReactCurrentDispatcher.current = prevDispatcher;
       
 16384         }
       
 16385       },
       
 16386       useDebugValue: function (value, formatterFn) {
       
 16387         currentHookNameInDev = 'useDebugValue';
       
 16388         warnInvalidHookAccess();
       
 16389         updateHookTypesDev();
       
 16390         return updateDebugValue();
       
 16391       },
       
 16392       useResponder: function (responder, props) {
       
 16393         currentHookNameInDev = 'useResponder';
       
 16394         warnInvalidHookAccess();
       
 16395         updateHookTypesDev();
       
 16396         return createDeprecatedResponderListener(responder, props);
       
 16397       },
       
 16398       useDeferredValue: function (value, config) {
       
 16399         currentHookNameInDev = 'useDeferredValue';
       
 16400         warnInvalidHookAccess();
       
 16401         updateHookTypesDev();
       
 16402         return updateDeferredValue(value, config);
       
 16403       },
       
 16404       useTransition: function (config) {
       
 16405         currentHookNameInDev = 'useTransition';
       
 16406         warnInvalidHookAccess();
       
 16407         updateHookTypesDev();
       
 16408         return updateTransition(config);
       
 16409       }
       
 16410     };
       
 16411     InvalidNestedHooksDispatcherOnRerenderInDEV = {
       
 16412       readContext: function (context, observedBits) {
       
 16413         warnInvalidContextAccess();
       
 16414         return readContext(context, observedBits);
       
 16415       },
       
 16416       useCallback: function (callback, deps) {
       
 16417         currentHookNameInDev = 'useCallback';
       
 16418         warnInvalidHookAccess();
       
 16419         updateHookTypesDev();
       
 16420         return updateCallback(callback, deps);
       
 16421       },
       
 16422       useContext: function (context, observedBits) {
       
 16423         currentHookNameInDev = 'useContext';
       
 16424         warnInvalidHookAccess();
       
 16425         updateHookTypesDev();
       
 16426         return readContext(context, observedBits);
       
 16427       },
       
 16428       useEffect: function (create, deps) {
       
 16429         currentHookNameInDev = 'useEffect';
       
 16430         warnInvalidHookAccess();
       
 16431         updateHookTypesDev();
       
 16432         return updateEffect(create, deps);
       
 16433       },
       
 16434       useImperativeHandle: function (ref, create, deps) {
       
 16435         currentHookNameInDev = 'useImperativeHandle';
       
 16436         warnInvalidHookAccess();
       
 16437         updateHookTypesDev();
       
 16438         return updateImperativeHandle(ref, create, deps);
       
 16439       },
       
 16440       useLayoutEffect: function (create, deps) {
       
 16441         currentHookNameInDev = 'useLayoutEffect';
       
 16442         warnInvalidHookAccess();
       
 16443         updateHookTypesDev();
       
 16444         return updateLayoutEffect(create, deps);
       
 16445       },
       
 16446       useMemo: function (create, deps) {
       
 16447         currentHookNameInDev = 'useMemo';
       
 16448         warnInvalidHookAccess();
       
 16449         updateHookTypesDev();
       
 16450         var prevDispatcher = ReactCurrentDispatcher.current;
       
 16451         ReactCurrentDispatcher.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
       
 16452 
       
 16453         try {
       
 16454           return updateMemo(create, deps);
       
 16455         } finally {
       
 16456           ReactCurrentDispatcher.current = prevDispatcher;
       
 16457         }
       
 16458       },
       
 16459       useReducer: function (reducer, initialArg, init) {
       
 16460         currentHookNameInDev = 'useReducer';
       
 16461         warnInvalidHookAccess();
       
 16462         updateHookTypesDev();
       
 16463         var prevDispatcher = ReactCurrentDispatcher.current;
       
 16464         ReactCurrentDispatcher.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
       
 16465 
       
 16466         try {
       
 16467           return rerenderReducer(reducer, initialArg, init);
       
 16468         } finally {
       
 16469           ReactCurrentDispatcher.current = prevDispatcher;
       
 16470         }
       
 16471       },
       
 16472       useRef: function (initialValue) {
       
 16473         currentHookNameInDev = 'useRef';
       
 16474         warnInvalidHookAccess();
       
 16475         updateHookTypesDev();
       
 16476         return updateRef();
       
 16477       },
       
 16478       useState: function (initialState) {
       
 16479         currentHookNameInDev = 'useState';
       
 16480         warnInvalidHookAccess();
       
 16481         updateHookTypesDev();
       
 16482         var prevDispatcher = ReactCurrentDispatcher.current;
       
 16483         ReactCurrentDispatcher.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
       
 16484 
       
 16485         try {
       
 16486           return rerenderState(initialState);
       
 16487         } finally {
       
 16488           ReactCurrentDispatcher.current = prevDispatcher;
       
 16489         }
       
 16490       },
       
 16491       useDebugValue: function (value, formatterFn) {
       
 16492         currentHookNameInDev = 'useDebugValue';
       
 16493         warnInvalidHookAccess();
       
 16494         updateHookTypesDev();
       
 16495         return updateDebugValue();
       
 16496       },
       
 16497       useResponder: function (responder, props) {
       
 16498         currentHookNameInDev = 'useResponder';
       
 16499         warnInvalidHookAccess();
       
 16500         updateHookTypesDev();
       
 16501         return createDeprecatedResponderListener(responder, props);
       
 16502       },
       
 16503       useDeferredValue: function (value, config) {
       
 16504         currentHookNameInDev = 'useDeferredValue';
       
 16505         warnInvalidHookAccess();
       
 16506         updateHookTypesDev();
       
 16507         return rerenderDeferredValue(value, config);
       
 16508       },
       
 16509       useTransition: function (config) {
       
 16510         currentHookNameInDev = 'useTransition';
       
 16511         warnInvalidHookAccess();
       
 16512         updateHookTypesDev();
       
 16513         return rerenderTransition(config);
       
 16514       }
       
 16515     };
       
 16516   }
       
 16517 
       
 16518   var now$1 = unstable_now;
       
 16519   var commitTime = 0;
       
 16520   var profilerStartTime = -1;
       
 16521 
       
 16522   function getCommitTime() {
       
 16523     return commitTime;
       
 16524   }
       
 16525 
       
 16526   function recordCommitTime() {
       
 16527 
       
 16528     commitTime = now$1();
       
 16529   }
       
 16530 
       
 16531   function startProfilerTimer(fiber) {
       
 16532 
       
 16533     profilerStartTime = now$1();
       
 16534 
       
 16535     if (fiber.actualStartTime < 0) {
       
 16536       fiber.actualStartTime = now$1();
       
 16537     }
       
 16538   }
       
 16539 
       
 16540   function stopProfilerTimerIfRunning(fiber) {
       
 16541 
       
 16542     profilerStartTime = -1;
       
 16543   }
       
 16544 
       
 16545   function stopProfilerTimerIfRunningAndRecordDelta(fiber, overrideBaseTime) {
       
 16546 
       
 16547     if (profilerStartTime >= 0) {
       
 16548       var elapsedTime = now$1() - profilerStartTime;
       
 16549       fiber.actualDuration += elapsedTime;
       
 16550 
       
 16551       if (overrideBaseTime) {
       
 16552         fiber.selfBaseDuration = elapsedTime;
       
 16553       }
       
 16554 
       
 16555       profilerStartTime = -1;
       
 16556     }
       
 16557   }
       
 16558 
       
 16559   // This may have been an insertion or a hydration.
       
 16560 
       
 16561   var hydrationParentFiber = null;
       
 16562   var nextHydratableInstance = null;
       
 16563   var isHydrating = false;
       
 16564 
       
 16565   function enterHydrationState(fiber) {
       
 16566 
       
 16567     var parentInstance = fiber.stateNode.containerInfo;
       
 16568     nextHydratableInstance = getFirstHydratableChild(parentInstance);
       
 16569     hydrationParentFiber = fiber;
       
 16570     isHydrating = true;
       
 16571     return true;
       
 16572   }
       
 16573 
       
 16574   function deleteHydratableInstance(returnFiber, instance) {
 15892     {
 16575     {
 15893       _update2.priority = getCurrentPriorityLevel();
 16576       switch (returnFiber.tag) {
 15894     }
 16577         case HostRoot:
 15895 
 16578           didNotHydrateContainerInstance(returnFiber.stateNode.containerInfo, instance);
 15896     // Append the update to the end of the list.
 16579           break;
 15897     var _last = queue.last;
 16580 
 15898     if (_last === null) {
 16581         case HostComponent:
 15899       // This is the first update. Create a circular list.
 16582           didNotHydrateInstance(returnFiber.type, returnFiber.memoizedProps, returnFiber.stateNode, instance);
 15900       _update2.next = _update2;
 16583           break;
       
 16584       }
       
 16585     }
       
 16586 
       
 16587     var childToDelete = createFiberFromHostInstanceForDeletion();
       
 16588     childToDelete.stateNode = instance;
       
 16589     childToDelete.return = returnFiber;
       
 16590     childToDelete.effectTag = Deletion; // This might seem like it belongs on progressedFirstDeletion. However,
       
 16591     // these children are not part of the reconciliation list of children.
       
 16592     // Even if we abort and rereconcile the children, that will try to hydrate
       
 16593     // again and the nodes are still in the host tree so these will be
       
 16594     // recreated.
       
 16595 
       
 16596     if (returnFiber.lastEffect !== null) {
       
 16597       returnFiber.lastEffect.nextEffect = childToDelete;
       
 16598       returnFiber.lastEffect = childToDelete;
 15901     } else {
 16599     } else {
 15902       var first = _last.next;
 16600       returnFiber.firstEffect = returnFiber.lastEffect = childToDelete;
 15903       if (first !== null) {
 16601     }
 15904         // Still circular.
 16602   }
 15905         _update2.next = first;
 16603 
 15906       }
 16604   function insertNonHydratedInstance(returnFiber, fiber) {
 15907       _last.next = _update2;
 16605     fiber.effectTag = fiber.effectTag & ~Hydrating | Placement;
 15908     }
 16606 
 15909     queue.last = _update2;
 16607     {
 15910 
 16608       switch (returnFiber.tag) {
 15911     if (fiber.expirationTime === NoWork && (alternate === null || alternate.expirationTime === NoWork)) {
 16609         case HostRoot:
 15912       // The queue is currently empty, which means we can eagerly compute the
 16610           {
 15913       // next state before entering the render phase. If the new state is the
 16611             var parentContainer = returnFiber.stateNode.containerInfo;
 15914       // same as the current state, we may be able to bail out entirely.
 16612 
 15915       var _lastRenderedReducer = queue.lastRenderedReducer;
 16613             switch (fiber.tag) {
 15916       if (_lastRenderedReducer !== null) {
 16614               case HostComponent:
 15917         var prevDispatcher = void 0;
 16615                 var type = fiber.type;
 15918         {
 16616                 var props = fiber.pendingProps;
 15919           prevDispatcher = ReactCurrentDispatcher$1.current;
 16617                 didNotFindHydratableContainerInstance(parentContainer, type);
 15920           ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
 16618                 break;
 15921         }
 16619 
 15922         try {
 16620               case HostText:
 15923           var currentState = queue.lastRenderedState;
 16621                 var text = fiber.pendingProps;
 15924           var _eagerState = _lastRenderedReducer(currentState, action);
 16622                 didNotFindHydratableContainerTextInstance(parentContainer, text);
 15925           // Stash the eagerly computed state, and the reducer used to compute
 16623                 break;
 15926           // it, on the update object. If the reducer hasn't changed by the
 16624             }
 15927           // time we enter the render phase, then the eager state can be used
 16625 
 15928           // without calling the reducer again.
 16626             break;
 15929           _update2.eagerReducer = _lastRenderedReducer;
       
 15930           _update2.eagerState = _eagerState;
       
 15931           if (is(_eagerState, currentState)) {
       
 15932             // Fast path. We can bail out without scheduling React to re-render.
       
 15933             // It's still possible that we'll need to rebase this update later,
       
 15934             // if the component re-renders for a different reason and by that
       
 15935             // time the reducer has changed.
       
 15936             return;
       
 15937           }
 16627           }
 15938         } catch (error) {
 16628 
 15939           // Suppress the error. It will throw again in the render phase.
 16629         case HostComponent:
 15940         } finally {
       
 15941           {
 16630           {
 15942             ReactCurrentDispatcher$1.current = prevDispatcher;
 16631             var parentType = returnFiber.type;
       
 16632             var parentProps = returnFiber.memoizedProps;
       
 16633             var parentInstance = returnFiber.stateNode;
       
 16634 
       
 16635             switch (fiber.tag) {
       
 16636               case HostComponent:
       
 16637                 var _type = fiber.type;
       
 16638                 var _props = fiber.pendingProps;
       
 16639                 didNotFindHydratableInstance(parentType, parentProps, parentInstance, _type);
       
 16640                 break;
       
 16641 
       
 16642               case HostText:
       
 16643                 var _text = fiber.pendingProps;
       
 16644                 didNotFindHydratableTextInstance(parentType, parentProps, parentInstance, _text);
       
 16645                 break;
       
 16646 
       
 16647               case SuspenseComponent:
       
 16648                 didNotFindHydratableSuspenseInstance(parentType, parentProps);
       
 16649                 break;
       
 16650             }
       
 16651 
       
 16652             break;
 15943           }
 16653           }
 15944         }
 16654 
 15945       }
 16655         default:
 15946     }
 16656           return;
 15947     {
 16657       }
 15948       // $FlowExpectedError - jest isn't a global, and isn't recognized outside of tests
 16658     }
 15949       if ('undefined' !== typeof jest) {
 16659   }
 15950         warnIfNotScopedWithMatchingAct(fiber);
 16660 
 15951         warnIfNotCurrentlyActingUpdatesInDev(fiber);
 16661   function tryHydrate(fiber, nextInstance) {
 15952       }
 16662     switch (fiber.tag) {
 15953     }
       
 15954     scheduleWork(fiber, _expirationTime);
       
 15955   }
       
 15956 }
       
 15957 
       
 15958 var ContextOnlyDispatcher = {
       
 15959   readContext: readContext,
       
 15960 
       
 15961   useCallback: throwInvalidHookError,
       
 15962   useContext: throwInvalidHookError,
       
 15963   useEffect: throwInvalidHookError,
       
 15964   useImperativeHandle: throwInvalidHookError,
       
 15965   useLayoutEffect: throwInvalidHookError,
       
 15966   useMemo: throwInvalidHookError,
       
 15967   useReducer: throwInvalidHookError,
       
 15968   useRef: throwInvalidHookError,
       
 15969   useState: throwInvalidHookError,
       
 15970   useDebugValue: throwInvalidHookError,
       
 15971   useResponder: throwInvalidHookError
       
 15972 };
       
 15973 
       
 15974 var HooksDispatcherOnMountInDEV = null;
       
 15975 var HooksDispatcherOnMountWithHookTypesInDEV = null;
       
 15976 var HooksDispatcherOnUpdateInDEV = null;
       
 15977 var InvalidNestedHooksDispatcherOnMountInDEV = null;
       
 15978 var InvalidNestedHooksDispatcherOnUpdateInDEV = null;
       
 15979 
       
 15980 {
       
 15981   var warnInvalidContextAccess = function () {
       
 15982     warning$1(false, 'Context can only be read while React is rendering. ' + 'In classes, you can read it in the render method or getDerivedStateFromProps. ' + 'In function components, you can read it directly in the function body, but not ' + 'inside Hooks like useReducer() or useMemo().');
       
 15983   };
       
 15984 
       
 15985   var warnInvalidHookAccess = function () {
       
 15986     warning$1(false, 'Do not call Hooks inside useEffect(...), useMemo(...), or other built-in Hooks. ' + 'You can only call Hooks at the top level of your React function. ' + 'For more information, see ' + 'https://fb.me/rules-of-hooks');
       
 15987   };
       
 15988 
       
 15989   HooksDispatcherOnMountInDEV = {
       
 15990     readContext: function (context, observedBits) {
       
 15991       return readContext(context, observedBits);
       
 15992     },
       
 15993     useCallback: function (callback, deps) {
       
 15994       currentHookNameInDev = 'useCallback';
       
 15995       mountHookTypesDev();
       
 15996       checkDepsAreArrayDev(deps);
       
 15997       return mountCallback(callback, deps);
       
 15998     },
       
 15999     useContext: function (context, observedBits) {
       
 16000       currentHookNameInDev = 'useContext';
       
 16001       mountHookTypesDev();
       
 16002       return readContext(context, observedBits);
       
 16003     },
       
 16004     useEffect: function (create, deps) {
       
 16005       currentHookNameInDev = 'useEffect';
       
 16006       mountHookTypesDev();
       
 16007       checkDepsAreArrayDev(deps);
       
 16008       return mountEffect(create, deps);
       
 16009     },
       
 16010     useImperativeHandle: function (ref, create, deps) {
       
 16011       currentHookNameInDev = 'useImperativeHandle';
       
 16012       mountHookTypesDev();
       
 16013       checkDepsAreArrayDev(deps);
       
 16014       return mountImperativeHandle(ref, create, deps);
       
 16015     },
       
 16016     useLayoutEffect: function (create, deps) {
       
 16017       currentHookNameInDev = 'useLayoutEffect';
       
 16018       mountHookTypesDev();
       
 16019       checkDepsAreArrayDev(deps);
       
 16020       return mountLayoutEffect(create, deps);
       
 16021     },
       
 16022     useMemo: function (create, deps) {
       
 16023       currentHookNameInDev = 'useMemo';
       
 16024       mountHookTypesDev();
       
 16025       checkDepsAreArrayDev(deps);
       
 16026       var prevDispatcher = ReactCurrentDispatcher$1.current;
       
 16027       ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
       
 16028       try {
       
 16029         return mountMemo(create, deps);
       
 16030       } finally {
       
 16031         ReactCurrentDispatcher$1.current = prevDispatcher;
       
 16032       }
       
 16033     },
       
 16034     useReducer: function (reducer, initialArg, init) {
       
 16035       currentHookNameInDev = 'useReducer';
       
 16036       mountHookTypesDev();
       
 16037       var prevDispatcher = ReactCurrentDispatcher$1.current;
       
 16038       ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
       
 16039       try {
       
 16040         return mountReducer(reducer, initialArg, init);
       
 16041       } finally {
       
 16042         ReactCurrentDispatcher$1.current = prevDispatcher;
       
 16043       }
       
 16044     },
       
 16045     useRef: function (initialValue) {
       
 16046       currentHookNameInDev = 'useRef';
       
 16047       mountHookTypesDev();
       
 16048       return mountRef(initialValue);
       
 16049     },
       
 16050     useState: function (initialState) {
       
 16051       currentHookNameInDev = 'useState';
       
 16052       mountHookTypesDev();
       
 16053       var prevDispatcher = ReactCurrentDispatcher$1.current;
       
 16054       ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
       
 16055       try {
       
 16056         return mountState(initialState);
       
 16057       } finally {
       
 16058         ReactCurrentDispatcher$1.current = prevDispatcher;
       
 16059       }
       
 16060     },
       
 16061     useDebugValue: function (value, formatterFn) {
       
 16062       currentHookNameInDev = 'useDebugValue';
       
 16063       mountHookTypesDev();
       
 16064       return mountDebugValue(value, formatterFn);
       
 16065     },
       
 16066     useResponder: function (responder, props) {
       
 16067       currentHookNameInDev = 'useResponder';
       
 16068       mountHookTypesDev();
       
 16069       return createResponderListener(responder, props);
       
 16070     }
       
 16071   };
       
 16072 
       
 16073   HooksDispatcherOnMountWithHookTypesInDEV = {
       
 16074     readContext: function (context, observedBits) {
       
 16075       return readContext(context, observedBits);
       
 16076     },
       
 16077     useCallback: function (callback, deps) {
       
 16078       currentHookNameInDev = 'useCallback';
       
 16079       updateHookTypesDev();
       
 16080       return mountCallback(callback, deps);
       
 16081     },
       
 16082     useContext: function (context, observedBits) {
       
 16083       currentHookNameInDev = 'useContext';
       
 16084       updateHookTypesDev();
       
 16085       return readContext(context, observedBits);
       
 16086     },
       
 16087     useEffect: function (create, deps) {
       
 16088       currentHookNameInDev = 'useEffect';
       
 16089       updateHookTypesDev();
       
 16090       return mountEffect(create, deps);
       
 16091     },
       
 16092     useImperativeHandle: function (ref, create, deps) {
       
 16093       currentHookNameInDev = 'useImperativeHandle';
       
 16094       updateHookTypesDev();
       
 16095       return mountImperativeHandle(ref, create, deps);
       
 16096     },
       
 16097     useLayoutEffect: function (create, deps) {
       
 16098       currentHookNameInDev = 'useLayoutEffect';
       
 16099       updateHookTypesDev();
       
 16100       return mountLayoutEffect(create, deps);
       
 16101     },
       
 16102     useMemo: function (create, deps) {
       
 16103       currentHookNameInDev = 'useMemo';
       
 16104       updateHookTypesDev();
       
 16105       var prevDispatcher = ReactCurrentDispatcher$1.current;
       
 16106       ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
       
 16107       try {
       
 16108         return mountMemo(create, deps);
       
 16109       } finally {
       
 16110         ReactCurrentDispatcher$1.current = prevDispatcher;
       
 16111       }
       
 16112     },
       
 16113     useReducer: function (reducer, initialArg, init) {
       
 16114       currentHookNameInDev = 'useReducer';
       
 16115       updateHookTypesDev();
       
 16116       var prevDispatcher = ReactCurrentDispatcher$1.current;
       
 16117       ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
       
 16118       try {
       
 16119         return mountReducer(reducer, initialArg, init);
       
 16120       } finally {
       
 16121         ReactCurrentDispatcher$1.current = prevDispatcher;
       
 16122       }
       
 16123     },
       
 16124     useRef: function (initialValue) {
       
 16125       currentHookNameInDev = 'useRef';
       
 16126       updateHookTypesDev();
       
 16127       return mountRef(initialValue);
       
 16128     },
       
 16129     useState: function (initialState) {
       
 16130       currentHookNameInDev = 'useState';
       
 16131       updateHookTypesDev();
       
 16132       var prevDispatcher = ReactCurrentDispatcher$1.current;
       
 16133       ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
       
 16134       try {
       
 16135         return mountState(initialState);
       
 16136       } finally {
       
 16137         ReactCurrentDispatcher$1.current = prevDispatcher;
       
 16138       }
       
 16139     },
       
 16140     useDebugValue: function (value, formatterFn) {
       
 16141       currentHookNameInDev = 'useDebugValue';
       
 16142       updateHookTypesDev();
       
 16143       return mountDebugValue(value, formatterFn);
       
 16144     },
       
 16145     useResponder: function (responder, props) {
       
 16146       currentHookNameInDev = 'useResponder';
       
 16147       updateHookTypesDev();
       
 16148       return createResponderListener(responder, props);
       
 16149     }
       
 16150   };
       
 16151 
       
 16152   HooksDispatcherOnUpdateInDEV = {
       
 16153     readContext: function (context, observedBits) {
       
 16154       return readContext(context, observedBits);
       
 16155     },
       
 16156     useCallback: function (callback, deps) {
       
 16157       currentHookNameInDev = 'useCallback';
       
 16158       updateHookTypesDev();
       
 16159       return updateCallback(callback, deps);
       
 16160     },
       
 16161     useContext: function (context, observedBits) {
       
 16162       currentHookNameInDev = 'useContext';
       
 16163       updateHookTypesDev();
       
 16164       return readContext(context, observedBits);
       
 16165     },
       
 16166     useEffect: function (create, deps) {
       
 16167       currentHookNameInDev = 'useEffect';
       
 16168       updateHookTypesDev();
       
 16169       return updateEffect(create, deps);
       
 16170     },
       
 16171     useImperativeHandle: function (ref, create, deps) {
       
 16172       currentHookNameInDev = 'useImperativeHandle';
       
 16173       updateHookTypesDev();
       
 16174       return updateImperativeHandle(ref, create, deps);
       
 16175     },
       
 16176     useLayoutEffect: function (create, deps) {
       
 16177       currentHookNameInDev = 'useLayoutEffect';
       
 16178       updateHookTypesDev();
       
 16179       return updateLayoutEffect(create, deps);
       
 16180     },
       
 16181     useMemo: function (create, deps) {
       
 16182       currentHookNameInDev = 'useMemo';
       
 16183       updateHookTypesDev();
       
 16184       var prevDispatcher = ReactCurrentDispatcher$1.current;
       
 16185       ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
       
 16186       try {
       
 16187         return updateMemo(create, deps);
       
 16188       } finally {
       
 16189         ReactCurrentDispatcher$1.current = prevDispatcher;
       
 16190       }
       
 16191     },
       
 16192     useReducer: function (reducer, initialArg, init) {
       
 16193       currentHookNameInDev = 'useReducer';
       
 16194       updateHookTypesDev();
       
 16195       var prevDispatcher = ReactCurrentDispatcher$1.current;
       
 16196       ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
       
 16197       try {
       
 16198         return updateReducer(reducer, initialArg, init);
       
 16199       } finally {
       
 16200         ReactCurrentDispatcher$1.current = prevDispatcher;
       
 16201       }
       
 16202     },
       
 16203     useRef: function (initialValue) {
       
 16204       currentHookNameInDev = 'useRef';
       
 16205       updateHookTypesDev();
       
 16206       return updateRef(initialValue);
       
 16207     },
       
 16208     useState: function (initialState) {
       
 16209       currentHookNameInDev = 'useState';
       
 16210       updateHookTypesDev();
       
 16211       var prevDispatcher = ReactCurrentDispatcher$1.current;
       
 16212       ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
       
 16213       try {
       
 16214         return updateState(initialState);
       
 16215       } finally {
       
 16216         ReactCurrentDispatcher$1.current = prevDispatcher;
       
 16217       }
       
 16218     },
       
 16219     useDebugValue: function (value, formatterFn) {
       
 16220       currentHookNameInDev = 'useDebugValue';
       
 16221       updateHookTypesDev();
       
 16222       return updateDebugValue(value, formatterFn);
       
 16223     },
       
 16224     useResponder: function (responder, props) {
       
 16225       currentHookNameInDev = 'useResponder';
       
 16226       updateHookTypesDev();
       
 16227       return createResponderListener(responder, props);
       
 16228     }
       
 16229   };
       
 16230 
       
 16231   InvalidNestedHooksDispatcherOnMountInDEV = {
       
 16232     readContext: function (context, observedBits) {
       
 16233       warnInvalidContextAccess();
       
 16234       return readContext(context, observedBits);
       
 16235     },
       
 16236     useCallback: function (callback, deps) {
       
 16237       currentHookNameInDev = 'useCallback';
       
 16238       warnInvalidHookAccess();
       
 16239       mountHookTypesDev();
       
 16240       return mountCallback(callback, deps);
       
 16241     },
       
 16242     useContext: function (context, observedBits) {
       
 16243       currentHookNameInDev = 'useContext';
       
 16244       warnInvalidHookAccess();
       
 16245       mountHookTypesDev();
       
 16246       return readContext(context, observedBits);
       
 16247     },
       
 16248     useEffect: function (create, deps) {
       
 16249       currentHookNameInDev = 'useEffect';
       
 16250       warnInvalidHookAccess();
       
 16251       mountHookTypesDev();
       
 16252       return mountEffect(create, deps);
       
 16253     },
       
 16254     useImperativeHandle: function (ref, create, deps) {
       
 16255       currentHookNameInDev = 'useImperativeHandle';
       
 16256       warnInvalidHookAccess();
       
 16257       mountHookTypesDev();
       
 16258       return mountImperativeHandle(ref, create, deps);
       
 16259     },
       
 16260     useLayoutEffect: function (create, deps) {
       
 16261       currentHookNameInDev = 'useLayoutEffect';
       
 16262       warnInvalidHookAccess();
       
 16263       mountHookTypesDev();
       
 16264       return mountLayoutEffect(create, deps);
       
 16265     },
       
 16266     useMemo: function (create, deps) {
       
 16267       currentHookNameInDev = 'useMemo';
       
 16268       warnInvalidHookAccess();
       
 16269       mountHookTypesDev();
       
 16270       var prevDispatcher = ReactCurrentDispatcher$1.current;
       
 16271       ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
       
 16272       try {
       
 16273         return mountMemo(create, deps);
       
 16274       } finally {
       
 16275         ReactCurrentDispatcher$1.current = prevDispatcher;
       
 16276       }
       
 16277     },
       
 16278     useReducer: function (reducer, initialArg, init) {
       
 16279       currentHookNameInDev = 'useReducer';
       
 16280       warnInvalidHookAccess();
       
 16281       mountHookTypesDev();
       
 16282       var prevDispatcher = ReactCurrentDispatcher$1.current;
       
 16283       ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
       
 16284       try {
       
 16285         return mountReducer(reducer, initialArg, init);
       
 16286       } finally {
       
 16287         ReactCurrentDispatcher$1.current = prevDispatcher;
       
 16288       }
       
 16289     },
       
 16290     useRef: function (initialValue) {
       
 16291       currentHookNameInDev = 'useRef';
       
 16292       warnInvalidHookAccess();
       
 16293       mountHookTypesDev();
       
 16294       return mountRef(initialValue);
       
 16295     },
       
 16296     useState: function (initialState) {
       
 16297       currentHookNameInDev = 'useState';
       
 16298       warnInvalidHookAccess();
       
 16299       mountHookTypesDev();
       
 16300       var prevDispatcher = ReactCurrentDispatcher$1.current;
       
 16301       ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
       
 16302       try {
       
 16303         return mountState(initialState);
       
 16304       } finally {
       
 16305         ReactCurrentDispatcher$1.current = prevDispatcher;
       
 16306       }
       
 16307     },
       
 16308     useDebugValue: function (value, formatterFn) {
       
 16309       currentHookNameInDev = 'useDebugValue';
       
 16310       warnInvalidHookAccess();
       
 16311       mountHookTypesDev();
       
 16312       return mountDebugValue(value, formatterFn);
       
 16313     },
       
 16314     useResponder: function (responder, props) {
       
 16315       currentHookNameInDev = 'useResponder';
       
 16316       warnInvalidHookAccess();
       
 16317       mountHookTypesDev();
       
 16318       return createResponderListener(responder, props);
       
 16319     }
       
 16320   };
       
 16321 
       
 16322   InvalidNestedHooksDispatcherOnUpdateInDEV = {
       
 16323     readContext: function (context, observedBits) {
       
 16324       warnInvalidContextAccess();
       
 16325       return readContext(context, observedBits);
       
 16326     },
       
 16327     useCallback: function (callback, deps) {
       
 16328       currentHookNameInDev = 'useCallback';
       
 16329       warnInvalidHookAccess();
       
 16330       updateHookTypesDev();
       
 16331       return updateCallback(callback, deps);
       
 16332     },
       
 16333     useContext: function (context, observedBits) {
       
 16334       currentHookNameInDev = 'useContext';
       
 16335       warnInvalidHookAccess();
       
 16336       updateHookTypesDev();
       
 16337       return readContext(context, observedBits);
       
 16338     },
       
 16339     useEffect: function (create, deps) {
       
 16340       currentHookNameInDev = 'useEffect';
       
 16341       warnInvalidHookAccess();
       
 16342       updateHookTypesDev();
       
 16343       return updateEffect(create, deps);
       
 16344     },
       
 16345     useImperativeHandle: function (ref, create, deps) {
       
 16346       currentHookNameInDev = 'useImperativeHandle';
       
 16347       warnInvalidHookAccess();
       
 16348       updateHookTypesDev();
       
 16349       return updateImperativeHandle(ref, create, deps);
       
 16350     },
       
 16351     useLayoutEffect: function (create, deps) {
       
 16352       currentHookNameInDev = 'useLayoutEffect';
       
 16353       warnInvalidHookAccess();
       
 16354       updateHookTypesDev();
       
 16355       return updateLayoutEffect(create, deps);
       
 16356     },
       
 16357     useMemo: function (create, deps) {
       
 16358       currentHookNameInDev = 'useMemo';
       
 16359       warnInvalidHookAccess();
       
 16360       updateHookTypesDev();
       
 16361       var prevDispatcher = ReactCurrentDispatcher$1.current;
       
 16362       ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
       
 16363       try {
       
 16364         return updateMemo(create, deps);
       
 16365       } finally {
       
 16366         ReactCurrentDispatcher$1.current = prevDispatcher;
       
 16367       }
       
 16368     },
       
 16369     useReducer: function (reducer, initialArg, init) {
       
 16370       currentHookNameInDev = 'useReducer';
       
 16371       warnInvalidHookAccess();
       
 16372       updateHookTypesDev();
       
 16373       var prevDispatcher = ReactCurrentDispatcher$1.current;
       
 16374       ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
       
 16375       try {
       
 16376         return updateReducer(reducer, initialArg, init);
       
 16377       } finally {
       
 16378         ReactCurrentDispatcher$1.current = prevDispatcher;
       
 16379       }
       
 16380     },
       
 16381     useRef: function (initialValue) {
       
 16382       currentHookNameInDev = 'useRef';
       
 16383       warnInvalidHookAccess();
       
 16384       updateHookTypesDev();
       
 16385       return updateRef(initialValue);
       
 16386     },
       
 16387     useState: function (initialState) {
       
 16388       currentHookNameInDev = 'useState';
       
 16389       warnInvalidHookAccess();
       
 16390       updateHookTypesDev();
       
 16391       var prevDispatcher = ReactCurrentDispatcher$1.current;
       
 16392       ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
       
 16393       try {
       
 16394         return updateState(initialState);
       
 16395       } finally {
       
 16396         ReactCurrentDispatcher$1.current = prevDispatcher;
       
 16397       }
       
 16398     },
       
 16399     useDebugValue: function (value, formatterFn) {
       
 16400       currentHookNameInDev = 'useDebugValue';
       
 16401       warnInvalidHookAccess();
       
 16402       updateHookTypesDev();
       
 16403       return updateDebugValue(value, formatterFn);
       
 16404     },
       
 16405     useResponder: function (responder, props) {
       
 16406       currentHookNameInDev = 'useResponder';
       
 16407       warnInvalidHookAccess();
       
 16408       updateHookTypesDev();
       
 16409       return createResponderListener(responder, props);
       
 16410     }
       
 16411   };
       
 16412 }
       
 16413 
       
 16414 // Intentionally not named imports because Rollup would use dynamic dispatch for
       
 16415 // CommonJS interop named imports.
       
 16416 var now$1 = unstable_now;
       
 16417 
       
 16418 
       
 16419 var commitTime = 0;
       
 16420 var profilerStartTime = -1;
       
 16421 
       
 16422 function getCommitTime() {
       
 16423   return commitTime;
       
 16424 }
       
 16425 
       
 16426 function recordCommitTime() {
       
 16427   if (!enableProfilerTimer) {
       
 16428     return;
       
 16429   }
       
 16430   commitTime = now$1();
       
 16431 }
       
 16432 
       
 16433 function startProfilerTimer(fiber) {
       
 16434   if (!enableProfilerTimer) {
       
 16435     return;
       
 16436   }
       
 16437 
       
 16438   profilerStartTime = now$1();
       
 16439 
       
 16440   if (fiber.actualStartTime < 0) {
       
 16441     fiber.actualStartTime = now$1();
       
 16442   }
       
 16443 }
       
 16444 
       
 16445 function stopProfilerTimerIfRunning(fiber) {
       
 16446   if (!enableProfilerTimer) {
       
 16447     return;
       
 16448   }
       
 16449   profilerStartTime = -1;
       
 16450 }
       
 16451 
       
 16452 function stopProfilerTimerIfRunningAndRecordDelta(fiber, overrideBaseTime) {
       
 16453   if (!enableProfilerTimer) {
       
 16454     return;
       
 16455   }
       
 16456 
       
 16457   if (profilerStartTime >= 0) {
       
 16458     var elapsedTime = now$1() - profilerStartTime;
       
 16459     fiber.actualDuration += elapsedTime;
       
 16460     if (overrideBaseTime) {
       
 16461       fiber.selfBaseDuration = elapsedTime;
       
 16462     }
       
 16463     profilerStartTime = -1;
       
 16464   }
       
 16465 }
       
 16466 
       
 16467 // The deepest Fiber on the stack involved in a hydration context.
       
 16468 // This may have been an insertion or a hydration.
       
 16469 var hydrationParentFiber = null;
       
 16470 var nextHydratableInstance = null;
       
 16471 var isHydrating = false;
       
 16472 
       
 16473 function enterHydrationState(fiber) {
       
 16474   if (!supportsHydration) {
       
 16475     return false;
       
 16476   }
       
 16477 
       
 16478   var parentInstance = fiber.stateNode.containerInfo;
       
 16479   nextHydratableInstance = getFirstHydratableChild(parentInstance);
       
 16480   hydrationParentFiber = fiber;
       
 16481   isHydrating = true;
       
 16482   return true;
       
 16483 }
       
 16484 
       
 16485 function reenterHydrationStateFromDehydratedSuspenseInstance(fiber) {
       
 16486   if (!supportsHydration) {
       
 16487     return false;
       
 16488   }
       
 16489 
       
 16490   var suspenseInstance = fiber.stateNode;
       
 16491   nextHydratableInstance = getNextHydratableSibling(suspenseInstance);
       
 16492   popToNextHostParent(fiber);
       
 16493   isHydrating = true;
       
 16494   return true;
       
 16495 }
       
 16496 
       
 16497 function deleteHydratableInstance(returnFiber, instance) {
       
 16498   {
       
 16499     switch (returnFiber.tag) {
       
 16500       case HostRoot:
       
 16501         didNotHydrateContainerInstance(returnFiber.stateNode.containerInfo, instance);
       
 16502         break;
       
 16503       case HostComponent:
       
 16504         didNotHydrateInstance(returnFiber.type, returnFiber.memoizedProps, returnFiber.stateNode, instance);
       
 16505         break;
       
 16506     }
       
 16507   }
       
 16508 
       
 16509   var childToDelete = createFiberFromHostInstanceForDeletion();
       
 16510   childToDelete.stateNode = instance;
       
 16511   childToDelete.return = returnFiber;
       
 16512   childToDelete.effectTag = Deletion;
       
 16513 
       
 16514   // This might seem like it belongs on progressedFirstDeletion. However,
       
 16515   // these children are not part of the reconciliation list of children.
       
 16516   // Even if we abort and rereconcile the children, that will try to hydrate
       
 16517   // again and the nodes are still in the host tree so these will be
       
 16518   // recreated.
       
 16519   if (returnFiber.lastEffect !== null) {
       
 16520     returnFiber.lastEffect.nextEffect = childToDelete;
       
 16521     returnFiber.lastEffect = childToDelete;
       
 16522   } else {
       
 16523     returnFiber.firstEffect = returnFiber.lastEffect = childToDelete;
       
 16524   }
       
 16525 }
       
 16526 
       
 16527 function insertNonHydratedInstance(returnFiber, fiber) {
       
 16528   fiber.effectTag |= Placement;
       
 16529   {
       
 16530     switch (returnFiber.tag) {
       
 16531       case HostRoot:
       
 16532         {
       
 16533           var parentContainer = returnFiber.stateNode.containerInfo;
       
 16534           switch (fiber.tag) {
       
 16535             case HostComponent:
       
 16536               var type = fiber.type;
       
 16537               var props = fiber.pendingProps;
       
 16538               didNotFindHydratableContainerInstance(parentContainer, type, props);
       
 16539               break;
       
 16540             case HostText:
       
 16541               var text = fiber.pendingProps;
       
 16542               didNotFindHydratableContainerTextInstance(parentContainer, text);
       
 16543               break;
       
 16544             case SuspenseComponent:
       
 16545               
       
 16546               break;
       
 16547           }
       
 16548           break;
       
 16549         }
       
 16550       case HostComponent:
 16663       case HostComponent:
 16551         {
 16664         {
 16552           var parentType = returnFiber.type;
 16665           var type = fiber.type;
 16553           var parentProps = returnFiber.memoizedProps;
 16666           var props = fiber.pendingProps;
 16554           var parentInstance = returnFiber.stateNode;
 16667           var instance = canHydrateInstance(nextInstance, type);
 16555           switch (fiber.tag) {
 16668 
 16556             case HostComponent:
 16669           if (instance !== null) {
 16557               var _type = fiber.type;
 16670             fiber.stateNode = instance;
 16558               var _props = fiber.pendingProps;
       
 16559               didNotFindHydratableInstance(parentType, parentProps, parentInstance, _type, _props);
       
 16560               break;
       
 16561             case HostText:
       
 16562               var _text = fiber.pendingProps;
       
 16563               didNotFindHydratableTextInstance(parentType, parentProps, parentInstance, _text);
       
 16564               break;
       
 16565             case SuspenseComponent:
       
 16566               didNotFindHydratableSuspenseInstance(parentType, parentProps, parentInstance);
       
 16567               break;
       
 16568           }
       
 16569           break;
       
 16570         }
       
 16571       default:
       
 16572         return;
       
 16573     }
       
 16574   }
       
 16575 }
       
 16576 
       
 16577 function tryHydrate(fiber, nextInstance) {
       
 16578   switch (fiber.tag) {
       
 16579     case HostComponent:
       
 16580       {
       
 16581         var type = fiber.type;
       
 16582         var props = fiber.pendingProps;
       
 16583         var instance = canHydrateInstance(nextInstance, type, props);
       
 16584         if (instance !== null) {
       
 16585           fiber.stateNode = instance;
       
 16586           return true;
       
 16587         }
       
 16588         return false;
       
 16589       }
       
 16590     case HostText:
       
 16591       {
       
 16592         var text = fiber.pendingProps;
       
 16593         var textInstance = canHydrateTextInstance(nextInstance, text);
       
 16594         if (textInstance !== null) {
       
 16595           fiber.stateNode = textInstance;
       
 16596           return true;
       
 16597         }
       
 16598         return false;
       
 16599       }
       
 16600     case SuspenseComponent:
       
 16601       {
       
 16602         if (enableSuspenseServerRenderer) {
       
 16603           var suspenseInstance = canHydrateSuspenseInstance(nextInstance);
       
 16604           if (suspenseInstance !== null) {
       
 16605             // Downgrade the tag to a dehydrated component until we've hydrated it.
       
 16606             fiber.tag = DehydratedSuspenseComponent;
       
 16607             fiber.stateNode = suspenseInstance;
       
 16608             return true;
 16671             return true;
 16609           }
 16672           }
 16610         }
 16673 
       
 16674           return false;
       
 16675         }
       
 16676 
       
 16677       case HostText:
       
 16678         {
       
 16679           var text = fiber.pendingProps;
       
 16680           var textInstance = canHydrateTextInstance(nextInstance, text);
       
 16681 
       
 16682           if (textInstance !== null) {
       
 16683             fiber.stateNode = textInstance;
       
 16684             return true;
       
 16685           }
       
 16686 
       
 16687           return false;
       
 16688         }
       
 16689 
       
 16690       case SuspenseComponent:
       
 16691         {
       
 16692 
       
 16693           return false;
       
 16694         }
       
 16695 
       
 16696       default:
 16611         return false;
 16697         return false;
 16612       }
 16698     }
 16613     default:
 16699   }
 16614       return false;
 16700 
 16615   }
 16701   function tryToClaimNextHydratableInstance(fiber) {
 16616 }
 16702     if (!isHydrating) {
 16617 
 16703       return;
 16618 function tryToClaimNextHydratableInstance(fiber) {
 16704     }
 16619   if (!isHydrating) {
 16705 
 16620     return;
 16706     var nextInstance = nextHydratableInstance;
 16621   }
 16707 
 16622   var nextInstance = nextHydratableInstance;
 16708     if (!nextInstance) {
 16623   if (!nextInstance) {
       
 16624     // Nothing to hydrate. Make it an insertion.
       
 16625     insertNonHydratedInstance(hydrationParentFiber, fiber);
       
 16626     isHydrating = false;
       
 16627     hydrationParentFiber = fiber;
       
 16628     return;
       
 16629   }
       
 16630   var firstAttemptedInstance = nextInstance;
       
 16631   if (!tryHydrate(fiber, nextInstance)) {
       
 16632     // If we can't hydrate this instance let's try the next one.
       
 16633     // We use this as a heuristic. It's based on intuition and not data so it
       
 16634     // might be flawed or unnecessary.
       
 16635     nextInstance = getNextHydratableSibling(firstAttemptedInstance);
       
 16636     if (!nextInstance || !tryHydrate(fiber, nextInstance)) {
       
 16637       // Nothing to hydrate. Make it an insertion.
 16709       // Nothing to hydrate. Make it an insertion.
 16638       insertNonHydratedInstance(hydrationParentFiber, fiber);
 16710       insertNonHydratedInstance(hydrationParentFiber, fiber);
 16639       isHydrating = false;
 16711       isHydrating = false;
 16640       hydrationParentFiber = fiber;
 16712       hydrationParentFiber = fiber;
 16641       return;
 16713       return;
 16642     }
 16714     }
 16643     // We matched the next one, we'll now assume that the first one was
 16715 
 16644     // superfluous and we'll delete it. Since we can't eagerly delete it
 16716     var firstAttemptedInstance = nextInstance;
 16645     // we'll have to schedule a deletion. To do that, this node needs a dummy
 16717 
 16646     // fiber associated with it.
 16718     if (!tryHydrate(fiber, nextInstance)) {
 16647     deleteHydratableInstance(hydrationParentFiber, firstAttemptedInstance);
 16719       // If we can't hydrate this instance let's try the next one.
 16648   }
 16720       // We use this as a heuristic. It's based on intuition and not data so it
 16649   hydrationParentFiber = fiber;
 16721       // might be flawed or unnecessary.
 16650   nextHydratableInstance = getFirstHydratableChild(nextInstance);
 16722       nextInstance = getNextHydratableSibling(firstAttemptedInstance);
 16651 }
 16723 
 16652 
 16724       if (!nextInstance || !tryHydrate(fiber, nextInstance)) {
 16653 function prepareToHydrateHostInstance(fiber, rootContainerInstance, hostContext) {
 16725         // Nothing to hydrate. Make it an insertion.
 16654   if (!supportsHydration) {
 16726         insertNonHydratedInstance(hydrationParentFiber, fiber);
 16655     (function () {
 16727         isHydrating = false;
 16656       {
 16728         hydrationParentFiber = fiber;
 16657         {
 16729         return;
 16658           throw ReactError(Error('Expected prepareToHydrateHostInstance() to never be called. This error is likely caused by a bug in React. Please file an issue.'));
 16730       } // We matched the next one, we'll now assume that the first one was
 16659         }
 16731       // superfluous and we'll delete it. Since we can't eagerly delete it
 16660       }
 16732       // we'll have to schedule a deletion. To do that, this node needs a dummy
 16661     })();
 16733       // fiber associated with it.
 16662   }
 16734 
 16663 
 16735 
 16664   var instance = fiber.stateNode;
 16736       deleteHydratableInstance(hydrationParentFiber, firstAttemptedInstance);
 16665   var updatePayload = hydrateInstance(instance, fiber.type, fiber.memoizedProps, rootContainerInstance, hostContext, fiber);
 16737     }
 16666   // TODO: Type this specific to this type of component.
 16738 
 16667   fiber.updateQueue = updatePayload;
 16739     hydrationParentFiber = fiber;
 16668   // If the update payload indicates that there is a change or if there
 16740     nextHydratableInstance = getFirstHydratableChild(nextInstance);
 16669   // is a new ref we mark this as an update.
 16741   }
 16670   if (updatePayload !== null) {
 16742 
 16671     return true;
 16743   function prepareToHydrateHostInstance(fiber, rootContainerInstance, hostContext) {
 16672   }
 16744 
 16673   return false;
 16745     var instance = fiber.stateNode;
 16674 }
 16746     var updatePayload = hydrateInstance(instance, fiber.type, fiber.memoizedProps, rootContainerInstance, hostContext, fiber); // TODO: Type this specific to this type of component.
 16675 
 16747 
 16676 function prepareToHydrateHostTextInstance(fiber) {
 16748     fiber.updateQueue = updatePayload; // If the update payload indicates that there is a change or if there
 16677   if (!supportsHydration) {
 16749     // is a new ref we mark this as an update.
 16678     (function () {
 16750 
 16679       {
 16751     if (updatePayload !== null) {
 16680         {
 16752       return true;
 16681           throw ReactError(Error('Expected prepareToHydrateHostTextInstance() to never be called. This error is likely caused by a bug in React. Please file an issue.'));
 16753     }
 16682         }
 16754 
 16683       }
 16755     return false;
 16684     })();
 16756   }
 16685   }
 16757 
 16686 
 16758   function prepareToHydrateHostTextInstance(fiber) {
 16687   var textInstance = fiber.stateNode;
 16759 
 16688   var textContent = fiber.memoizedProps;
 16760     var textInstance = fiber.stateNode;
 16689   var shouldUpdate = hydrateTextInstance(textInstance, textContent, fiber);
 16761     var textContent = fiber.memoizedProps;
 16690   {
 16762     var shouldUpdate = hydrateTextInstance(textInstance, textContent, fiber);
 16691     if (shouldUpdate) {
 16763 
 16692       // We assume that prepareToHydrateHostTextInstance is called in a context where the
 16764     {
 16693       // hydration parent is the parent host component of this host text.
 16765       if (shouldUpdate) {
 16694       var returnFiber = hydrationParentFiber;
 16766         // We assume that prepareToHydrateHostTextInstance is called in a context where the
 16695       if (returnFiber !== null) {
 16767         // hydration parent is the parent host component of this host text.
 16696         switch (returnFiber.tag) {
 16768         var returnFiber = hydrationParentFiber;
 16697           case HostRoot:
 16769 
 16698             {
 16770         if (returnFiber !== null) {
 16699               var parentContainer = returnFiber.stateNode.containerInfo;
 16771           switch (returnFiber.tag) {
 16700               didNotMatchHydratedContainerTextInstance(parentContainer, textInstance, textContent);
 16772             case HostRoot:
 16701               break;
 16773               {
 16702             }
 16774                 var parentContainer = returnFiber.stateNode.containerInfo;
 16703           case HostComponent:
 16775                 didNotMatchHydratedContainerTextInstance(parentContainer, textInstance, textContent);
 16704             {
 16776                 break;
 16705               var parentType = returnFiber.type;
 16777               }
 16706               var parentProps = returnFiber.memoizedProps;
 16778 
 16707               var parentInstance = returnFiber.stateNode;
 16779             case HostComponent:
 16708               didNotMatchHydratedTextInstance(parentType, parentProps, parentInstance, textInstance, textContent);
 16780               {
 16709               break;
 16781                 var parentType = returnFiber.type;
 16710             }
 16782                 var parentProps = returnFiber.memoizedProps;
 16711         }
 16783                 var parentInstance = returnFiber.stateNode;
 16712       }
 16784                 didNotMatchHydratedTextInstance(parentType, parentProps, parentInstance, textInstance, textContent);
 16713     }
 16785                 break;
 16714   }
 16786               }
 16715   return shouldUpdate;
 16787           }
 16716 }
 16788         }
 16717 
 16789       }
 16718 function skipPastDehydratedSuspenseInstance(fiber) {
 16790     }
 16719   if (!supportsHydration) {
 16791 
 16720     (function () {
 16792     return shouldUpdate;
 16721       {
 16793   }
 16722         {
 16794 
 16723           throw ReactError(Error('Expected skipPastDehydratedSuspenseInstance() to never be called. This error is likely caused by a bug in React. Please file an issue.'));
 16795   function skipPastDehydratedSuspenseInstance(fiber) {
 16724         }
 16796 
 16725       }
 16797     var suspenseState = fiber.memoizedState;
 16726     })();
 16798     var suspenseInstance = suspenseState !== null ? suspenseState.dehydrated : null;
 16727   }
 16799 
 16728   var suspenseInstance = fiber.stateNode;
       
 16729   (function () {
       
 16730     if (!suspenseInstance) {
 16800     if (!suspenseInstance) {
 16731       {
 16801       {
 16732         throw ReactError(Error('Expected to have a hydrated suspense instance. This error is likely caused by a bug in React. Please file an issue.'));
 16802         throw Error( "Expected to have a hydrated suspense instance. This error is likely caused by a bug in React. Please file an issue." );
 16733       }
 16803       }
 16734     }
 16804     }
 16735   })();
 16805 
 16736   nextHydratableInstance = getNextHydratableInstanceAfterSuspenseInstance(suspenseInstance);
 16806     return getNextHydratableInstanceAfterSuspenseInstance(suspenseInstance);
 16737 }
 16807   }
 16738 
 16808 
 16739 function popToNextHostParent(fiber) {
 16809   function popToNextHostParent(fiber) {
 16740   var parent = fiber.return;
 16810     var parent = fiber.return;
 16741   while (parent !== null && parent.tag !== HostComponent && parent.tag !== HostRoot && parent.tag !== DehydratedSuspenseComponent) {
 16811 
 16742     parent = parent.return;
 16812     while (parent !== null && parent.tag !== HostComponent && parent.tag !== HostRoot && parent.tag !== SuspenseComponent) {
 16743   }
 16813       parent = parent.return;
 16744   hydrationParentFiber = parent;
 16814     }
 16745 }
 16815 
 16746 
 16816     hydrationParentFiber = parent;
 16747 function popHydrationState(fiber) {
 16817   }
 16748   if (!supportsHydration) {
 16818 
 16749     return false;
 16819   function popHydrationState(fiber) {
 16750   }
 16820 
 16751   if (fiber !== hydrationParentFiber) {
 16821     if (fiber !== hydrationParentFiber) {
 16752     // We're deeper than the current hydration context, inside an inserted
 16822       // We're deeper than the current hydration context, inside an inserted
 16753     // tree.
 16823       // tree.
 16754     return false;
 16824       return false;
 16755   }
 16825     }
 16756   if (!isHydrating) {
 16826 
 16757     // If we're not currently hydrating but we're in a hydration context, then
 16827     if (!isHydrating) {
 16758     // we were an insertion and now need to pop up reenter hydration of our
 16828       // If we're not currently hydrating but we're in a hydration context, then
 16759     // siblings.
 16829       // we were an insertion and now need to pop up reenter hydration of our
       
 16830       // siblings.
       
 16831       popToNextHostParent(fiber);
       
 16832       isHydrating = true;
       
 16833       return false;
       
 16834     }
       
 16835 
       
 16836     var type = fiber.type; // If we have any remaining hydratable nodes, we need to delete them now.
       
 16837     // We only do this deeper than head and body since they tend to have random
       
 16838     // other nodes in them. We also ignore components with pure text content in
       
 16839     // side of them.
       
 16840     // TODO: Better heuristic.
       
 16841 
       
 16842     if (fiber.tag !== HostComponent || type !== 'head' && type !== 'body' && !shouldSetTextContent(type, fiber.memoizedProps)) {
       
 16843       var nextInstance = nextHydratableInstance;
       
 16844 
       
 16845       while (nextInstance) {
       
 16846         deleteHydratableInstance(fiber, nextInstance);
       
 16847         nextInstance = getNextHydratableSibling(nextInstance);
       
 16848       }
       
 16849     }
       
 16850 
 16760     popToNextHostParent(fiber);
 16851     popToNextHostParent(fiber);
 16761     isHydrating = true;
 16852 
 16762     return false;
 16853     if (fiber.tag === SuspenseComponent) {
 16763   }
 16854       nextHydratableInstance = skipPastDehydratedSuspenseInstance(fiber);
 16764 
 16855     } else {
 16765   var type = fiber.type;
 16856       nextHydratableInstance = hydrationParentFiber ? getNextHydratableSibling(fiber.stateNode) : null;
 16766 
 16857     }
 16767   // If we have any remaining hydratable nodes, we need to delete them now.
 16858 
 16768   // We only do this deeper than head and body since they tend to have random
 16859     return true;
 16769   // other nodes in them. We also ignore components with pure text content in
 16860   }
 16770   // side of them.
 16861 
 16771   // TODO: Better heuristic.
 16862   function resetHydrationState() {
 16772   if (fiber.tag !== HostComponent || type !== 'head' && type !== 'body' && !shouldSetTextContent(type, fiber.memoizedProps)) {
 16863 
 16773     var nextInstance = nextHydratableInstance;
 16864     hydrationParentFiber = null;
 16774     while (nextInstance) {
 16865     nextHydratableInstance = null;
 16775       deleteHydratableInstance(fiber, nextInstance);
 16866     isHydrating = false;
 16776       nextInstance = getNextHydratableSibling(nextInstance);
 16867   }
 16777     }
 16868 
 16778   }
 16869   var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner;
 16779 
 16870   var didReceiveUpdate = false;
 16780   popToNextHostParent(fiber);
 16871   var didWarnAboutBadClass;
 16781   nextHydratableInstance = hydrationParentFiber ? getNextHydratableSibling(fiber.stateNode) : null;
 16872   var didWarnAboutModulePatternComponent;
 16782   return true;
 16873   var didWarnAboutContextTypeOnFunctionComponent;
 16783 }
 16874   var didWarnAboutGetDerivedStateOnFunctionComponent;
 16784 
 16875   var didWarnAboutFunctionRefs;
 16785 function resetHydrationState() {
 16876   var didWarnAboutReassigningProps;
 16786   if (!supportsHydration) {
 16877   var didWarnAboutRevealOrder;
 16787     return;
 16878   var didWarnAboutTailOptions;
 16788   }
       
 16789 
       
 16790   hydrationParentFiber = null;
       
 16791   nextHydratableInstance = null;
       
 16792   isHydrating = false;
       
 16793 }
       
 16794 
       
 16795 var ReactCurrentOwner$3 = ReactSharedInternals.ReactCurrentOwner;
       
 16796 
       
 16797 var didReceiveUpdate = false;
       
 16798 
       
 16799 var didWarnAboutBadClass = void 0;
       
 16800 var didWarnAboutModulePatternComponent = void 0;
       
 16801 var didWarnAboutContextTypeOnFunctionComponent = void 0;
       
 16802 var didWarnAboutGetDerivedStateOnFunctionComponent = void 0;
       
 16803 var didWarnAboutFunctionRefs = void 0;
       
 16804 var didWarnAboutReassigningProps = void 0;
       
 16805 var didWarnAboutMaxDuration = void 0;
       
 16806 var didWarnAboutRevealOrder = void 0;
       
 16807 var didWarnAboutTailOptions = void 0;
       
 16808 var didWarnAboutDefaultPropsOnFunctionComponent = void 0;
       
 16809 
       
 16810 {
       
 16811   didWarnAboutBadClass = {};
       
 16812   didWarnAboutModulePatternComponent = {};
       
 16813   didWarnAboutContextTypeOnFunctionComponent = {};
       
 16814   didWarnAboutGetDerivedStateOnFunctionComponent = {};
       
 16815   didWarnAboutFunctionRefs = {};
       
 16816   didWarnAboutReassigningProps = false;
       
 16817   didWarnAboutMaxDuration = false;
       
 16818   didWarnAboutRevealOrder = {};
       
 16819   didWarnAboutTailOptions = {};
       
 16820   didWarnAboutDefaultPropsOnFunctionComponent = {};
       
 16821 }
       
 16822 
       
 16823 function reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime) {
       
 16824   if (current$$1 === null) {
       
 16825     // If this is a fresh new component that hasn't been rendered yet, we
       
 16826     // won't update its child set by applying minimal side-effects. Instead,
       
 16827     // we will add them all to the child before it gets rendered. That means
       
 16828     // we can optimize this reconciliation pass by not tracking side-effects.
       
 16829     workInProgress.child = mountChildFibers(workInProgress, null, nextChildren, renderExpirationTime);
       
 16830   } else {
       
 16831     // If the current child is the same as the work in progress, it means that
       
 16832     // we haven't yet started any work on these children. Therefore, we use
       
 16833     // the clone algorithm to create a copy of all the current children.
       
 16834 
       
 16835     // If we had any progressed work already, that is invalid at this point so
       
 16836     // let's throw it out.
       
 16837     workInProgress.child = reconcileChildFibers(workInProgress, current$$1.child, nextChildren, renderExpirationTime);
       
 16838   }
       
 16839 }
       
 16840 
       
 16841 function forceUnmountCurrentAndReconcile(current$$1, workInProgress, nextChildren, renderExpirationTime) {
       
 16842   // This function is fork of reconcileChildren. It's used in cases where we
       
 16843   // want to reconcile without matching against the existing set. This has the
       
 16844   // effect of all current children being unmounted; even if the type and key
       
 16845   // are the same, the old child is unmounted and a new child is created.
       
 16846   //
       
 16847   // To do this, we're going to go through the reconcile algorithm twice. In
       
 16848   // the first pass, we schedule a deletion for all the current children by
       
 16849   // passing null.
       
 16850   workInProgress.child = reconcileChildFibers(workInProgress, current$$1.child, null, renderExpirationTime);
       
 16851   // In the second pass, we mount the new children. The trick here is that we
       
 16852   // pass null in place of where we usually pass the current child set. This has
       
 16853   // the effect of remounting all children regardless of whether their their
       
 16854   // identity matches.
       
 16855   workInProgress.child = reconcileChildFibers(workInProgress, null, nextChildren, renderExpirationTime);
       
 16856 }
       
 16857 
       
 16858 function updateForwardRef(current$$1, workInProgress, Component, nextProps, renderExpirationTime) {
       
 16859   // TODO: current can be non-null here even if the component
       
 16860   // hasn't yet mounted. This happens after the first render suspends.
       
 16861   // We'll need to figure out if this is fine or can cause issues.
       
 16862 
 16879 
 16863   {
 16880   {
 16864     if (workInProgress.type !== workInProgress.elementType) {
 16881     didWarnAboutBadClass = {};
 16865       // Lazy component props can't be validated in createElement
 16882     didWarnAboutModulePatternComponent = {};
 16866       // because they're only guaranteed to be resolved here.
 16883     didWarnAboutContextTypeOnFunctionComponent = {};
 16867       var innerPropTypes = Component.propTypes;
 16884     didWarnAboutGetDerivedStateOnFunctionComponent = {};
 16868       if (innerPropTypes) {
 16885     didWarnAboutFunctionRefs = {};
 16869         checkPropTypes_1(innerPropTypes, nextProps, // Resolved props
 16886     didWarnAboutReassigningProps = false;
 16870         'prop', getComponentName(Component), getCurrentFiberStackInDev);
 16887     didWarnAboutRevealOrder = {};
 16871       }
 16888     didWarnAboutTailOptions = {};
 16872     }
 16889   }
 16873   }
 16890 
 16874 
 16891   function reconcileChildren(current, workInProgress, nextChildren, renderExpirationTime) {
 16875   var render = Component.render;
 16892     if (current === null) {
 16876   var ref = workInProgress.ref;
 16893       // If this is a fresh new component that hasn't been rendered yet, we
 16877 
 16894       // won't update its child set by applying minimal side-effects. Instead,
 16878   // The rest is a fork of updateFunctionComponent
 16895       // we will add them all to the child before it gets rendered. That means
 16879   var nextChildren = void 0;
 16896       // we can optimize this reconciliation pass by not tracking side-effects.
 16880   prepareToReadContext(workInProgress, renderExpirationTime);
 16897       workInProgress.child = mountChildFibers(workInProgress, null, nextChildren, renderExpirationTime);
 16881   {
 16898     } else {
 16882     ReactCurrentOwner$3.current = workInProgress;
 16899       // If the current child is the same as the work in progress, it means that
 16883     setCurrentPhase('render');
 16900       // we haven't yet started any work on these children. Therefore, we use
 16884     nextChildren = renderWithHooks(current$$1, workInProgress, render, nextProps, ref, renderExpirationTime);
 16901       // the clone algorithm to create a copy of all the current children.
 16885     if (debugRenderPhaseSideEffects || debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
 16902       // If we had any progressed work already, that is invalid at this point so
 16886       // Only double-render components with Hooks
 16903       // let's throw it out.
 16887       if (workInProgress.memoizedState !== null) {
 16904       workInProgress.child = reconcileChildFibers(workInProgress, current.child, nextChildren, renderExpirationTime);
 16888         nextChildren = renderWithHooks(current$$1, workInProgress, render, nextProps, ref, renderExpirationTime);
 16905     }
 16889       }
 16906   }
 16890     }
 16907 
 16891     setCurrentPhase(null);
 16908   function forceUnmountCurrentAndReconcile(current, workInProgress, nextChildren, renderExpirationTime) {
 16892   }
 16909     // This function is fork of reconcileChildren. It's used in cases where we
 16893 
 16910     // want to reconcile without matching against the existing set. This has the
 16894   if (current$$1 !== null && !didReceiveUpdate) {
 16911     // effect of all current children being unmounted; even if the type and key
 16895     bailoutHooks(current$$1, workInProgress, renderExpirationTime);
 16912     // are the same, the old child is unmounted and a new child is created.
 16896     return bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirationTime);
 16913     //
 16897   }
 16914     // To do this, we're going to go through the reconcile algorithm twice. In
 16898 
 16915     // the first pass, we schedule a deletion for all the current children by
 16899   // React DevTools reads this flag.
 16916     // passing null.
 16900   workInProgress.effectTag |= PerformedWork;
 16917     workInProgress.child = reconcileChildFibers(workInProgress, current.child, null, renderExpirationTime); // In the second pass, we mount the new children. The trick here is that we
 16901   reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
 16918     // pass null in place of where we usually pass the current child set. This has
 16902   return workInProgress.child;
 16919     // the effect of remounting all children regardless of whether their
 16903 }
 16920     // identities match.
 16904 
 16921 
 16905 function updateMemoComponent(current$$1, workInProgress, Component, nextProps, updateExpirationTime, renderExpirationTime) {
 16922     workInProgress.child = reconcileChildFibers(workInProgress, null, nextChildren, renderExpirationTime);
 16906   if (current$$1 === null) {
 16923   }
 16907     var type = Component.type;
 16924 
 16908     if (isSimpleFunctionComponent(type) && Component.compare === null &&
 16925   function updateForwardRef(current, workInProgress, Component, nextProps, renderExpirationTime) {
 16909     // SimpleMemoComponent codepath doesn't resolve outer props either.
 16926     // TODO: current can be non-null here even if the component
 16910     Component.defaultProps === undefined) {
 16927     // hasn't yet mounted. This happens after the first render suspends.
 16911       var resolvedType = type;
 16928     // We'll need to figure out if this is fine or can cause issues.
       
 16929     {
       
 16930       if (workInProgress.type !== workInProgress.elementType) {
       
 16931         // Lazy component props can't be validated in createElement
       
 16932         // because they're only guaranteed to be resolved here.
       
 16933         var innerPropTypes = Component.propTypes;
       
 16934 
       
 16935         if (innerPropTypes) {
       
 16936           checkPropTypes_1(innerPropTypes, nextProps, // Resolved props
       
 16937           'prop', getComponentName(Component), getCurrentFiberStackInDev);
       
 16938         }
       
 16939       }
       
 16940     }
       
 16941 
       
 16942     var render = Component.render;
       
 16943     var ref = workInProgress.ref; // The rest is a fork of updateFunctionComponent
       
 16944 
       
 16945     var nextChildren;
       
 16946     prepareToReadContext(workInProgress, renderExpirationTime);
       
 16947 
       
 16948     {
       
 16949       ReactCurrentOwner$1.current = workInProgress;
       
 16950       setIsRendering(true);
       
 16951       nextChildren = renderWithHooks(current, workInProgress, render, nextProps, ref, renderExpirationTime);
       
 16952 
       
 16953       if ( workInProgress.mode & StrictMode) {
       
 16954         // Only double-render components with Hooks
       
 16955         if (workInProgress.memoizedState !== null) {
       
 16956           nextChildren = renderWithHooks(current, workInProgress, render, nextProps, ref, renderExpirationTime);
       
 16957         }
       
 16958       }
       
 16959 
       
 16960       setIsRendering(false);
       
 16961     }
       
 16962 
       
 16963     if (current !== null && !didReceiveUpdate) {
       
 16964       bailoutHooks(current, workInProgress, renderExpirationTime);
       
 16965       return bailoutOnAlreadyFinishedWork(current, workInProgress, renderExpirationTime);
       
 16966     } // React DevTools reads this flag.
       
 16967 
       
 16968 
       
 16969     workInProgress.effectTag |= PerformedWork;
       
 16970     reconcileChildren(current, workInProgress, nextChildren, renderExpirationTime);
       
 16971     return workInProgress.child;
       
 16972   }
       
 16973 
       
 16974   function updateMemoComponent(current, workInProgress, Component, nextProps, updateExpirationTime, renderExpirationTime) {
       
 16975     if (current === null) {
       
 16976       var type = Component.type;
       
 16977 
       
 16978       if (isSimpleFunctionComponent(type) && Component.compare === null && // SimpleMemoComponent codepath doesn't resolve outer props either.
       
 16979       Component.defaultProps === undefined) {
       
 16980         var resolvedType = type;
       
 16981 
       
 16982         {
       
 16983           resolvedType = resolveFunctionForHotReloading(type);
       
 16984         } // If this is a plain function component without default props,
       
 16985         // and with only the default shallow comparison, we upgrade it
       
 16986         // to a SimpleMemoComponent to allow fast path updates.
       
 16987 
       
 16988 
       
 16989         workInProgress.tag = SimpleMemoComponent;
       
 16990         workInProgress.type = resolvedType;
       
 16991 
       
 16992         {
       
 16993           validateFunctionComponentInDev(workInProgress, type);
       
 16994         }
       
 16995 
       
 16996         return updateSimpleMemoComponent(current, workInProgress, resolvedType, nextProps, updateExpirationTime, renderExpirationTime);
       
 16997       }
       
 16998 
 16912       {
 16999       {
 16913         resolvedType = resolveFunctionForHotReloading(type);
 17000         var innerPropTypes = type.propTypes;
 16914       }
 17001 
 16915       // If this is a plain function component without default props,
 17002         if (innerPropTypes) {
 16916       // and with only the default shallow comparison, we upgrade it
 17003           // Inner memo component props aren't currently validated in createElement.
 16917       // to a SimpleMemoComponent to allow fast path updates.
 17004           // We could move it there, but we'd still need this for lazy code path.
 16918       workInProgress.tag = SimpleMemoComponent;
 17005           checkPropTypes_1(innerPropTypes, nextProps, // Resolved props
 16919       workInProgress.type = resolvedType;
 17006           'prop', getComponentName(type), getCurrentFiberStackInDev);
 16920       {
 17007         }
 16921         validateFunctionComponentInDev(workInProgress, type);
 17008       }
 16922       }
 17009 
 16923       return updateSimpleMemoComponent(current$$1, workInProgress, resolvedType, nextProps, updateExpirationTime, renderExpirationTime);
 17010       var child = createFiberFromTypeAndProps(Component.type, null, nextProps, null, workInProgress.mode, renderExpirationTime);
 16924     }
 17011       child.ref = workInProgress.ref;
       
 17012       child.return = workInProgress;
       
 17013       workInProgress.child = child;
       
 17014       return child;
       
 17015     }
       
 17016 
 16925     {
 17017     {
 16926       var innerPropTypes = type.propTypes;
 17018       var _type = Component.type;
 16927       if (innerPropTypes) {
 17019       var _innerPropTypes = _type.propTypes;
       
 17020 
       
 17021       if (_innerPropTypes) {
 16928         // Inner memo component props aren't currently validated in createElement.
 17022         // Inner memo component props aren't currently validated in createElement.
 16929         // We could move it there, but we'd still need this for lazy code path.
 17023         // We could move it there, but we'd still need this for lazy code path.
 16930         checkPropTypes_1(innerPropTypes, nextProps, // Resolved props
 17024         checkPropTypes_1(_innerPropTypes, nextProps, // Resolved props
 16931         'prop', getComponentName(type), getCurrentFiberStackInDev);
 17025         'prop', getComponentName(_type), getCurrentFiberStackInDev);
 16932       }
 17026       }
 16933     }
 17027     }
 16934     var child = createFiberFromTypeAndProps(Component.type, null, nextProps, null, workInProgress.mode, renderExpirationTime);
 17028 
 16935     child.ref = workInProgress.ref;
 17029     var currentChild = current.child; // This is always exactly one child
 16936     child.return = workInProgress;
 17030 
 16937     workInProgress.child = child;
 17031     if (updateExpirationTime < renderExpirationTime) {
 16938     return child;
 17032       // This will be the props with resolved defaultProps,
 16939   }
 17033       // unlike current.memoizedProps which will be the unresolved ones.
 16940   {
 17034       var prevProps = currentChild.memoizedProps; // Default to shallow comparison
 16941     var _type = Component.type;
 17035 
 16942     var _innerPropTypes = _type.propTypes;
 17036       var compare = Component.compare;
 16943     if (_innerPropTypes) {
 17037       compare = compare !== null ? compare : shallowEqual;
 16944       // Inner memo component props aren't currently validated in createElement.
 17038 
 16945       // We could move it there, but we'd still need this for lazy code path.
 17039       if (compare(prevProps, nextProps) && current.ref === workInProgress.ref) {
 16946       checkPropTypes_1(_innerPropTypes, nextProps, // Resolved props
 17040         return bailoutOnAlreadyFinishedWork(current, workInProgress, renderExpirationTime);
 16947       'prop', getComponentName(_type), getCurrentFiberStackInDev);
 17041       }
 16948     }
 17042     } // React DevTools reads this flag.
 16949   }
 17043 
 16950   var currentChild = current$$1.child; // This is always exactly one child
 17044 
 16951   if (updateExpirationTime < renderExpirationTime) {
 17045     workInProgress.effectTag |= PerformedWork;
 16952     // This will be the props with resolved defaultProps,
 17046     var newChild = createWorkInProgress(currentChild, nextProps);
 16953     // unlike current.memoizedProps which will be the unresolved ones.
 17047     newChild.ref = workInProgress.ref;
 16954     var prevProps = currentChild.memoizedProps;
 17048     newChild.return = workInProgress;
 16955     // Default to shallow comparison
 17049     workInProgress.child = newChild;
 16956     var compare = Component.compare;
 17050     return newChild;
 16957     compare = compare !== null ? compare : shallowEqual;
 17051   }
 16958     if (compare(prevProps, nextProps) && current$$1.ref === workInProgress.ref) {
 17052 
 16959       return bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirationTime);
 17053   function updateSimpleMemoComponent(current, workInProgress, Component, nextProps, updateExpirationTime, renderExpirationTime) {
 16960     }
 17054     // TODO: current can be non-null here even if the component
 16961   }
 17055     // hasn't yet mounted. This happens when the inner render suspends.
 16962   // React DevTools reads this flag.
 17056     // We'll need to figure out if this is fine or can cause issues.
 16963   workInProgress.effectTag |= PerformedWork;
       
 16964   var newChild = createWorkInProgress(currentChild, nextProps, renderExpirationTime);
       
 16965   newChild.ref = workInProgress.ref;
       
 16966   newChild.return = workInProgress;
       
 16967   workInProgress.child = newChild;
       
 16968   return newChild;
       
 16969 }
       
 16970 
       
 16971 function updateSimpleMemoComponent(current$$1, workInProgress, Component, nextProps, updateExpirationTime, renderExpirationTime) {
       
 16972   // TODO: current can be non-null here even if the component
       
 16973   // hasn't yet mounted. This happens when the inner render suspends.
       
 16974   // We'll need to figure out if this is fine or can cause issues.
       
 16975 
       
 16976   {
       
 16977     if (workInProgress.type !== workInProgress.elementType) {
       
 16978       // Lazy component props can't be validated in createElement
       
 16979       // because they're only guaranteed to be resolved here.
       
 16980       var outerMemoType = workInProgress.elementType;
       
 16981       if (outerMemoType.$$typeof === REACT_LAZY_TYPE) {
       
 16982         // We warn when you define propTypes on lazy()
       
 16983         // so let's just skip over it to find memo() outer wrapper.
       
 16984         // Inner props for memo are validated later.
       
 16985         outerMemoType = refineResolvedLazyComponent(outerMemoType);
       
 16986       }
       
 16987       var outerPropTypes = outerMemoType && outerMemoType.propTypes;
       
 16988       if (outerPropTypes) {
       
 16989         checkPropTypes_1(outerPropTypes, nextProps, // Resolved (SimpleMemoComponent has no defaultProps)
       
 16990         'prop', getComponentName(outerMemoType), getCurrentFiberStackInDev);
       
 16991       }
       
 16992       // Inner propTypes will be validated in the function component path.
       
 16993     }
       
 16994   }
       
 16995   if (current$$1 !== null) {
       
 16996     var prevProps = current$$1.memoizedProps;
       
 16997     if (shallowEqual(prevProps, nextProps) && current$$1.ref === workInProgress.ref && (
       
 16998     // Prevent bailout if the implementation changed due to hot reload:
       
 16999     workInProgress.type === current$$1.type)) {
       
 17000       didReceiveUpdate = false;
       
 17001       if (updateExpirationTime < renderExpirationTime) {
       
 17002         return bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirationTime);
       
 17003       }
       
 17004     }
       
 17005   }
       
 17006   return updateFunctionComponent(current$$1, workInProgress, Component, nextProps, renderExpirationTime);
       
 17007 }
       
 17008 
       
 17009 function updateFragment(current$$1, workInProgress, renderExpirationTime) {
       
 17010   var nextChildren = workInProgress.pendingProps;
       
 17011   reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
       
 17012   return workInProgress.child;
       
 17013 }
       
 17014 
       
 17015 function updateMode(current$$1, workInProgress, renderExpirationTime) {
       
 17016   var nextChildren = workInProgress.pendingProps.children;
       
 17017   reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
       
 17018   return workInProgress.child;
       
 17019 }
       
 17020 
       
 17021 function updateProfiler(current$$1, workInProgress, renderExpirationTime) {
       
 17022   if (enableProfilerTimer) {
       
 17023     workInProgress.effectTag |= Update;
       
 17024   }
       
 17025   var nextProps = workInProgress.pendingProps;
       
 17026   var nextChildren = nextProps.children;
       
 17027   reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
       
 17028   return workInProgress.child;
       
 17029 }
       
 17030 
       
 17031 function markRef(current$$1, workInProgress) {
       
 17032   var ref = workInProgress.ref;
       
 17033   if (current$$1 === null && ref !== null || current$$1 !== null && current$$1.ref !== ref) {
       
 17034     // Schedule a Ref effect
       
 17035     workInProgress.effectTag |= Ref;
       
 17036   }
       
 17037 }
       
 17038 
       
 17039 function updateFunctionComponent(current$$1, workInProgress, Component, nextProps, renderExpirationTime) {
       
 17040   {
       
 17041     if (workInProgress.type !== workInProgress.elementType) {
       
 17042       // Lazy component props can't be validated in createElement
       
 17043       // because they're only guaranteed to be resolved here.
       
 17044       var innerPropTypes = Component.propTypes;
       
 17045       if (innerPropTypes) {
       
 17046         checkPropTypes_1(innerPropTypes, nextProps, // Resolved props
       
 17047         'prop', getComponentName(Component), getCurrentFiberStackInDev);
       
 17048       }
       
 17049     }
       
 17050   }
       
 17051 
       
 17052   var context = void 0;
       
 17053   if (!disableLegacyContext) {
       
 17054     var unmaskedContext = getUnmaskedContext(workInProgress, Component, true);
       
 17055     context = getMaskedContext(workInProgress, unmaskedContext);
       
 17056   }
       
 17057 
       
 17058   var nextChildren = void 0;
       
 17059   prepareToReadContext(workInProgress, renderExpirationTime);
       
 17060   {
       
 17061     ReactCurrentOwner$3.current = workInProgress;
       
 17062     setCurrentPhase('render');
       
 17063     nextChildren = renderWithHooks(current$$1, workInProgress, Component, nextProps, context, renderExpirationTime);
       
 17064     if (debugRenderPhaseSideEffects || debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
       
 17065       // Only double-render components with Hooks
       
 17066       if (workInProgress.memoizedState !== null) {
       
 17067         nextChildren = renderWithHooks(current$$1, workInProgress, Component, nextProps, context, renderExpirationTime);
       
 17068       }
       
 17069     }
       
 17070     setCurrentPhase(null);
       
 17071   }
       
 17072 
       
 17073   if (current$$1 !== null && !didReceiveUpdate) {
       
 17074     bailoutHooks(current$$1, workInProgress, renderExpirationTime);
       
 17075     return bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirationTime);
       
 17076   }
       
 17077 
       
 17078   // React DevTools reads this flag.
       
 17079   workInProgress.effectTag |= PerformedWork;
       
 17080   reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
       
 17081   return workInProgress.child;
       
 17082 }
       
 17083 
       
 17084 function updateClassComponent(current$$1, workInProgress, Component, nextProps, renderExpirationTime) {
       
 17085   {
       
 17086     if (workInProgress.type !== workInProgress.elementType) {
       
 17087       // Lazy component props can't be validated in createElement
       
 17088       // because they're only guaranteed to be resolved here.
       
 17089       var innerPropTypes = Component.propTypes;
       
 17090       if (innerPropTypes) {
       
 17091         checkPropTypes_1(innerPropTypes, nextProps, // Resolved props
       
 17092         'prop', getComponentName(Component), getCurrentFiberStackInDev);
       
 17093       }
       
 17094     }
       
 17095   }
       
 17096 
       
 17097   // Push context providers early to prevent context stack mismatches.
       
 17098   // During mounting we don't know the child context yet as the instance doesn't exist.
       
 17099   // We will invalidate the child context in finishClassComponent() right after rendering.
       
 17100   var hasContext = void 0;
       
 17101   if (isContextProvider(Component)) {
       
 17102     hasContext = true;
       
 17103     pushContextProvider(workInProgress);
       
 17104   } else {
       
 17105     hasContext = false;
       
 17106   }
       
 17107   prepareToReadContext(workInProgress, renderExpirationTime);
       
 17108 
       
 17109   var instance = workInProgress.stateNode;
       
 17110   var shouldUpdate = void 0;
       
 17111   if (instance === null) {
       
 17112     if (current$$1 !== null) {
       
 17113       // An class component without an instance only mounts if it suspended
       
 17114       // inside a non- concurrent tree, in an inconsistent state. We want to
       
 17115       // tree it like a new mount, even though an empty version of it already
       
 17116       // committed. Disconnect the alternate pointers.
       
 17117       current$$1.alternate = null;
       
 17118       workInProgress.alternate = null;
       
 17119       // Since this is conceptually a new fiber, schedule a Placement effect
       
 17120       workInProgress.effectTag |= Placement;
       
 17121     }
       
 17122     // In the initial pass we might need to construct the instance.
       
 17123     constructClassInstance(workInProgress, Component, nextProps, renderExpirationTime);
       
 17124     mountClassInstance(workInProgress, Component, nextProps, renderExpirationTime);
       
 17125     shouldUpdate = true;
       
 17126   } else if (current$$1 === null) {
       
 17127     // In a resume, we'll already have an instance we can reuse.
       
 17128     shouldUpdate = resumeMountClassInstance(workInProgress, Component, nextProps, renderExpirationTime);
       
 17129   } else {
       
 17130     shouldUpdate = updateClassInstance(current$$1, workInProgress, Component, nextProps, renderExpirationTime);
       
 17131   }
       
 17132   var nextUnitOfWork = finishClassComponent(current$$1, workInProgress, Component, shouldUpdate, hasContext, renderExpirationTime);
       
 17133   {
       
 17134     var inst = workInProgress.stateNode;
       
 17135     if (inst.props !== nextProps) {
       
 17136       !didWarnAboutReassigningProps ? warning$1(false, 'It looks like %s is reassigning its own `this.props` while rendering. ' + 'This is not supported and can lead to confusing bugs.', getComponentName(workInProgress.type) || 'a component') : void 0;
       
 17137       didWarnAboutReassigningProps = true;
       
 17138     }
       
 17139   }
       
 17140   return nextUnitOfWork;
       
 17141 }
       
 17142 
       
 17143 function finishClassComponent(current$$1, workInProgress, Component, shouldUpdate, hasContext, renderExpirationTime) {
       
 17144   // Refs should update even if shouldComponentUpdate returns false
       
 17145   markRef(current$$1, workInProgress);
       
 17146 
       
 17147   var didCaptureError = (workInProgress.effectTag & DidCapture) !== NoEffect;
       
 17148 
       
 17149   if (!shouldUpdate && !didCaptureError) {
       
 17150     // Context providers should defer to sCU for rendering
       
 17151     if (hasContext) {
       
 17152       invalidateContextProvider(workInProgress, Component, false);
       
 17153     }
       
 17154 
       
 17155     return bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirationTime);
       
 17156   }
       
 17157 
       
 17158   var instance = workInProgress.stateNode;
       
 17159 
       
 17160   // Rerender
       
 17161   ReactCurrentOwner$3.current = workInProgress;
       
 17162   var nextChildren = void 0;
       
 17163   if (didCaptureError && typeof Component.getDerivedStateFromError !== 'function') {
       
 17164     // If we captured an error, but getDerivedStateFrom catch is not defined,
       
 17165     // unmount all the children. componentDidCatch will schedule an update to
       
 17166     // re-render a fallback. This is temporary until we migrate everyone to
       
 17167     // the new API.
       
 17168     // TODO: Warn in a future release.
       
 17169     nextChildren = null;
       
 17170 
       
 17171     if (enableProfilerTimer) {
       
 17172       stopProfilerTimerIfRunning(workInProgress);
       
 17173     }
       
 17174   } else {
       
 17175     {
 17057     {
 17176       setCurrentPhase('render');
 17058       if (workInProgress.type !== workInProgress.elementType) {
 17177       nextChildren = instance.render();
 17059         // Lazy component props can't be validated in createElement
 17178       if (debugRenderPhaseSideEffects || debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
 17060         // because they're only guaranteed to be resolved here.
 17179         instance.render();
 17061         var outerMemoType = workInProgress.elementType;
 17180       }
 17062 
 17181       setCurrentPhase(null);
 17063         if (outerMemoType.$$typeof === REACT_LAZY_TYPE) {
 17182     }
 17064           // We warn when you define propTypes on lazy()
 17183   }
 17065           // so let's just skip over it to find memo() outer wrapper.
 17184 
 17066           // Inner props for memo are validated later.
 17185   // React DevTools reads this flag.
 17067           outerMemoType = refineResolvedLazyComponent(outerMemoType);
 17186   workInProgress.effectTag |= PerformedWork;
 17068         }
 17187   if (current$$1 !== null && didCaptureError) {
 17069 
 17188     // If we're recovering from an error, reconcile without reusing any of
 17070         var outerPropTypes = outerMemoType && outerMemoType.propTypes;
 17189     // the existing children. Conceptually, the normal children and the children
 17071 
 17190     // that are shown on error are two different sets, so we shouldn't reuse
 17072         if (outerPropTypes) {
 17191     // normal children even if their identities match.
 17073           checkPropTypes_1(outerPropTypes, nextProps, // Resolved (SimpleMemoComponent has no defaultProps)
 17192     forceUnmountCurrentAndReconcile(current$$1, workInProgress, nextChildren, renderExpirationTime);
 17074           'prop', getComponentName(outerMemoType), getCurrentFiberStackInDev);
 17193   } else {
 17075         } // Inner propTypes will be validated in the function component path.
 17194     reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
 17076 
 17195   }
 17077       }
 17196 
 17078     }
 17197   // Memoize state using the values we just used to render.
 17079 
 17198   // TODO: Restructure so we never read values from the instance.
 17080     if (current !== null) {
 17199   workInProgress.memoizedState = instance.state;
 17081       var prevProps = current.memoizedProps;
 17200 
 17082 
 17201   // The context might have changed so we need to recalculate it.
 17083       if (shallowEqual(prevProps, nextProps) && current.ref === workInProgress.ref && ( // Prevent bailout if the implementation changed due to hot reload.
 17202   if (hasContext) {
 17084        workInProgress.type === current.type )) {
 17203     invalidateContextProvider(workInProgress, Component, true);
 17085         didReceiveUpdate = false;
 17204   }
 17086 
 17205 
 17087         if (updateExpirationTime < renderExpirationTime) {
 17206   return workInProgress.child;
 17088           // The pending update priority was cleared at the beginning of
 17207 }
 17089           // beginWork. We're about to bail out, but there might be additional
 17208 
 17090           // updates at a lower priority. Usually, the priority level of the
 17209 function pushHostRootContext(workInProgress) {
 17091           // remaining updates is accumlated during the evaluation of the
 17210   var root = workInProgress.stateNode;
 17092           // component (i.e. when processing the update queue). But since since
 17211   if (root.pendingContext) {
 17093           // we're bailing out early *without* evaluating the component, we need
 17212     pushTopLevelContextObject(workInProgress, root.pendingContext, root.pendingContext !== root.context);
 17094           // to account for it here, too. Reset to the value of the current fiber.
 17213   } else if (root.context) {
 17095           // NOTE: This only applies to SimpleMemoComponent, not MemoComponent,
 17214     // Should always be set
 17096           // because a MemoComponent fiber does not have hooks or an update queue;
 17215     pushTopLevelContextObject(workInProgress, root.context, false);
 17097           // rather, it wraps around an inner component, which may or may not
 17216   }
 17098           // contains hooks.
 17217   pushHostContainer(workInProgress, root.containerInfo);
 17099           // TODO: Move the reset at in beginWork out of the common path so that
 17218 }
 17100           // this is no longer necessary.
 17219 
 17101           workInProgress.expirationTime = current.expirationTime;
 17220 function updateHostRoot(current$$1, workInProgress, renderExpirationTime) {
 17102           return bailoutOnAlreadyFinishedWork(current, workInProgress, renderExpirationTime);
 17221   pushHostRootContext(workInProgress);
 17103         }
 17222   var updateQueue = workInProgress.updateQueue;
 17104       }
 17223   (function () {
 17105     }
 17224     if (!(updateQueue !== null)) {
 17106 
 17225       {
 17107     return updateFunctionComponent(current, workInProgress, Component, nextProps, renderExpirationTime);
 17226         throw ReactError(Error('If the root does not have an updateQueue, we should have already bailed out. This error is likely caused by a bug in React. Please file an issue.'));
 17108   }
 17227       }
 17109 
 17228     }
 17110   function updateFragment(current, workInProgress, renderExpirationTime) {
 17229   })();
 17111     var nextChildren = workInProgress.pendingProps;
 17230   var nextProps = workInProgress.pendingProps;
 17112     reconcileChildren(current, workInProgress, nextChildren, renderExpirationTime);
 17231   var prevState = workInProgress.memoizedState;
 17113     return workInProgress.child;
 17232   var prevChildren = prevState !== null ? prevState.element : null;
 17114   }
 17233   processUpdateQueue(workInProgress, updateQueue, nextProps, null, renderExpirationTime);
 17115 
 17234   var nextState = workInProgress.memoizedState;
 17116   function updateMode(current, workInProgress, renderExpirationTime) {
 17235   // Caution: React DevTools currently depends on this property
 17117     var nextChildren = workInProgress.pendingProps.children;
 17236   // being called "element".
 17118     reconcileChildren(current, workInProgress, nextChildren, renderExpirationTime);
 17237   var nextChildren = nextState.element;
 17119     return workInProgress.child;
 17238   if (nextChildren === prevChildren) {
 17120   }
 17239     // If the state is the same as before, that's a bailout because we had
 17121 
 17240     // no work that expires at this time.
 17122   function updateProfiler(current, workInProgress, renderExpirationTime) {
 17241     resetHydrationState();
       
 17242     return bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirationTime);
       
 17243   }
       
 17244   var root = workInProgress.stateNode;
       
 17245   if ((current$$1 === null || current$$1.child === null) && root.hydrate && enterHydrationState(workInProgress)) {
       
 17246     // If we don't have any current children this might be the first pass.
       
 17247     // We always try to hydrate. If this isn't a hydration pass there won't
       
 17248     // be any children to hydrate which is effectively the same thing as
       
 17249     // not hydrating.
       
 17250 
       
 17251     // This is a bit of a hack. We track the host root as a placement to
       
 17252     // know that we're currently in a mounting state. That way isMounted
       
 17253     // works as expected. We must reset this before committing.
       
 17254     // TODO: Delete this when we delete isMounted and findDOMNode.
       
 17255     workInProgress.effectTag |= Placement;
       
 17256 
       
 17257     // Ensure that children mount into this root without tracking
       
 17258     // side-effects. This ensures that we don't store Placement effects on
       
 17259     // nodes that will be hydrated.
       
 17260     workInProgress.child = mountChildFibers(workInProgress, null, nextChildren, renderExpirationTime);
       
 17261   } else {
       
 17262     // Otherwise reset hydration state in case we aborted and resumed another
       
 17263     // root.
       
 17264     reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
       
 17265     resetHydrationState();
       
 17266   }
       
 17267   return workInProgress.child;
       
 17268 }
       
 17269 
       
 17270 function updateHostComponent(current$$1, workInProgress, renderExpirationTime) {
       
 17271   pushHostContext(workInProgress);
       
 17272 
       
 17273   if (current$$1 === null) {
       
 17274     tryToClaimNextHydratableInstance(workInProgress);
       
 17275   }
       
 17276 
       
 17277   var type = workInProgress.type;
       
 17278   var nextProps = workInProgress.pendingProps;
       
 17279   var prevProps = current$$1 !== null ? current$$1.memoizedProps : null;
       
 17280 
       
 17281   var nextChildren = nextProps.children;
       
 17282   var isDirectTextChild = shouldSetTextContent(type, nextProps);
       
 17283 
       
 17284   if (isDirectTextChild) {
       
 17285     // We special case a direct text child of a host node. This is a common
       
 17286     // case. We won't handle it as a reified child. We will instead handle
       
 17287     // this in the host environment that also have access to this prop. That
       
 17288     // avoids allocating another HostText fiber and traversing it.
       
 17289     nextChildren = null;
       
 17290   } else if (prevProps !== null && shouldSetTextContent(type, prevProps)) {
       
 17291     // If we're switching from a direct text child to a normal child, or to
       
 17292     // empty, we need to schedule the text content to be reset.
       
 17293     workInProgress.effectTag |= ContentReset;
       
 17294   }
       
 17295 
       
 17296   markRef(current$$1, workInProgress);
       
 17297 
       
 17298   // Check the host config to see if the children are offscreen/hidden.
       
 17299   if (workInProgress.mode & ConcurrentMode && renderExpirationTime !== Never && shouldDeprioritizeSubtree(type, nextProps)) {
       
 17300     if (enableSchedulerTracing) {
       
 17301       markSpawnedWork(Never);
       
 17302     }
       
 17303     // Schedule this fiber to re-render at offscreen priority. Then bailout.
       
 17304     workInProgress.expirationTime = workInProgress.childExpirationTime = Never;
       
 17305     return null;
       
 17306   }
       
 17307 
       
 17308   reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
       
 17309   return workInProgress.child;
       
 17310 }
       
 17311 
       
 17312 function updateHostText(current$$1, workInProgress) {
       
 17313   if (current$$1 === null) {
       
 17314     tryToClaimNextHydratableInstance(workInProgress);
       
 17315   }
       
 17316   // Nothing to do here. This is terminal. We'll do the completion step
       
 17317   // immediately after.
       
 17318   return null;
       
 17319 }
       
 17320 
       
 17321 function mountLazyComponent(_current, workInProgress, elementType, updateExpirationTime, renderExpirationTime) {
       
 17322   if (_current !== null) {
       
 17323     // An lazy component only mounts if it suspended inside a non-
       
 17324     // concurrent tree, in an inconsistent state. We want to treat it like
       
 17325     // a new mount, even though an empty version of it already committed.
       
 17326     // Disconnect the alternate pointers.
       
 17327     _current.alternate = null;
       
 17328     workInProgress.alternate = null;
       
 17329     // Since this is conceptually a new fiber, schedule a Placement effect
       
 17330     workInProgress.effectTag |= Placement;
       
 17331   }
       
 17332 
       
 17333   var props = workInProgress.pendingProps;
       
 17334   // We can't start a User Timing measurement with correct label yet.
       
 17335   // Cancel and resume right after we know the tag.
       
 17336   cancelWorkTimer(workInProgress);
       
 17337   var Component = readLazyComponentType(elementType);
       
 17338   // Store the unwrapped component in the type.
       
 17339   workInProgress.type = Component;
       
 17340   var resolvedTag = workInProgress.tag = resolveLazyComponentTag(Component);
       
 17341   startWorkTimer(workInProgress);
       
 17342   var resolvedProps = resolveDefaultProps(Component, props);
       
 17343   var child = void 0;
       
 17344   switch (resolvedTag) {
       
 17345     case FunctionComponent:
       
 17346       {
       
 17347         {
       
 17348           validateFunctionComponentInDev(workInProgress, Component);
       
 17349           workInProgress.type = Component = resolveFunctionForHotReloading(Component);
       
 17350         }
       
 17351         child = updateFunctionComponent(null, workInProgress, Component, resolvedProps, renderExpirationTime);
       
 17352         break;
       
 17353       }
       
 17354     case ClassComponent:
       
 17355       {
       
 17356         {
       
 17357           workInProgress.type = Component = resolveClassForHotReloading(Component);
       
 17358         }
       
 17359         child = updateClassComponent(null, workInProgress, Component, resolvedProps, renderExpirationTime);
       
 17360         break;
       
 17361       }
       
 17362     case ForwardRef:
       
 17363       {
       
 17364         {
       
 17365           workInProgress.type = Component = resolveForwardRefForHotReloading(Component);
       
 17366         }
       
 17367         child = updateForwardRef(null, workInProgress, Component, resolvedProps, renderExpirationTime);
       
 17368         break;
       
 17369       }
       
 17370     case MemoComponent:
       
 17371       {
       
 17372         {
       
 17373           if (workInProgress.type !== workInProgress.elementType) {
       
 17374             var outerPropTypes = Component.propTypes;
       
 17375             if (outerPropTypes) {
       
 17376               checkPropTypes_1(outerPropTypes, resolvedProps, // Resolved for outer only
       
 17377               'prop', getComponentName(Component), getCurrentFiberStackInDev);
       
 17378             }
       
 17379           }
       
 17380         }
       
 17381         child = updateMemoComponent(null, workInProgress, Component, resolveDefaultProps(Component.type, resolvedProps), // The inner type can have defaults too
       
 17382         updateExpirationTime, renderExpirationTime);
       
 17383         break;
       
 17384       }
       
 17385     default:
       
 17386       {
       
 17387         var hint = '';
       
 17388         {
       
 17389           if (Component !== null && typeof Component === 'object' && Component.$$typeof === REACT_LAZY_TYPE) {
       
 17390             hint = ' Did you wrap a component in React.lazy() more than once?';
       
 17391           }
       
 17392         }
       
 17393         // This message intentionally doesn't mention ForwardRef or MemoComponent
       
 17394         // because the fact that it's a separate type of work is an
       
 17395         // implementation detail.
       
 17396         (function () {
       
 17397           {
       
 17398             {
       
 17399               throw ReactError(Error('Element type is invalid. Received a promise that resolves to: ' + Component + '. Lazy element type must resolve to a class or function.' + hint));
       
 17400             }
       
 17401           }
       
 17402         })();
       
 17403       }
       
 17404   }
       
 17405   return child;
       
 17406 }
       
 17407 
       
 17408 function mountIncompleteClassComponent(_current, workInProgress, Component, nextProps, renderExpirationTime) {
       
 17409   if (_current !== null) {
       
 17410     // An incomplete component only mounts if it suspended inside a non-
       
 17411     // concurrent tree, in an inconsistent state. We want to treat it like
       
 17412     // a new mount, even though an empty version of it already committed.
       
 17413     // Disconnect the alternate pointers.
       
 17414     _current.alternate = null;
       
 17415     workInProgress.alternate = null;
       
 17416     // Since this is conceptually a new fiber, schedule a Placement effect
       
 17417     workInProgress.effectTag |= Placement;
       
 17418   }
       
 17419 
       
 17420   // Promote the fiber to a class and try rendering again.
       
 17421   workInProgress.tag = ClassComponent;
       
 17422 
       
 17423   // The rest of this function is a fork of `updateClassComponent`
       
 17424 
       
 17425   // Push context providers early to prevent context stack mismatches.
       
 17426   // During mounting we don't know the child context yet as the instance doesn't exist.
       
 17427   // We will invalidate the child context in finishClassComponent() right after rendering.
       
 17428   var hasContext = void 0;
       
 17429   if (isContextProvider(Component)) {
       
 17430     hasContext = true;
       
 17431     pushContextProvider(workInProgress);
       
 17432   } else {
       
 17433     hasContext = false;
       
 17434   }
       
 17435   prepareToReadContext(workInProgress, renderExpirationTime);
       
 17436 
       
 17437   constructClassInstance(workInProgress, Component, nextProps, renderExpirationTime);
       
 17438   mountClassInstance(workInProgress, Component, nextProps, renderExpirationTime);
       
 17439 
       
 17440   return finishClassComponent(null, workInProgress, Component, true, hasContext, renderExpirationTime);
       
 17441 }
       
 17442 
       
 17443 function mountIndeterminateComponent(_current, workInProgress, Component, renderExpirationTime) {
       
 17444   if (_current !== null) {
       
 17445     // An indeterminate component only mounts if it suspended inside a non-
       
 17446     // concurrent tree, in an inconsistent state. We want to treat it like
       
 17447     // a new mount, even though an empty version of it already committed.
       
 17448     // Disconnect the alternate pointers.
       
 17449     _current.alternate = null;
       
 17450     workInProgress.alternate = null;
       
 17451     // Since this is conceptually a new fiber, schedule a Placement effect
       
 17452     workInProgress.effectTag |= Placement;
       
 17453   }
       
 17454 
       
 17455   var props = workInProgress.pendingProps;
       
 17456   var context = void 0;
       
 17457   if (!disableLegacyContext) {
       
 17458     var unmaskedContext = getUnmaskedContext(workInProgress, Component, false);
       
 17459     context = getMaskedContext(workInProgress, unmaskedContext);
       
 17460   }
       
 17461 
       
 17462   prepareToReadContext(workInProgress, renderExpirationTime);
       
 17463   var value = void 0;
       
 17464 
       
 17465   {
       
 17466     if (Component.prototype && typeof Component.prototype.render === 'function') {
       
 17467       var componentName = getComponentName(Component) || 'Unknown';
       
 17468 
       
 17469       if (!didWarnAboutBadClass[componentName]) {
       
 17470         warningWithoutStack$1(false, "The <%s /> component appears to have a render method, but doesn't extend React.Component. " + 'This is likely to cause errors. Change %s to extend React.Component instead.', componentName, componentName);
       
 17471         didWarnAboutBadClass[componentName] = true;
       
 17472       }
       
 17473     }
       
 17474 
       
 17475     if (workInProgress.mode & StrictMode) {
       
 17476       ReactStrictModeWarnings.recordLegacyContextWarning(workInProgress, null);
       
 17477     }
       
 17478 
       
 17479     ReactCurrentOwner$3.current = workInProgress;
       
 17480     value = renderWithHooks(null, workInProgress, Component, props, context, renderExpirationTime);
       
 17481   }
       
 17482   // React DevTools reads this flag.
       
 17483   workInProgress.effectTag |= PerformedWork;
       
 17484 
       
 17485   if (typeof value === 'object' && value !== null && typeof value.render === 'function' && value.$$typeof === undefined) {
       
 17486     {
 17123     {
 17487       var _componentName = getComponentName(Component) || 'Unknown';
 17124       workInProgress.effectTag |= Update;
 17488       if (!didWarnAboutModulePatternComponent[_componentName]) {
 17125     }
 17489         warningWithoutStack$1(false, 'The <%s /> component appears to be a function component that returns a class instance. ' + 'Change %s to a class that extends React.Component instead. ' + "If you can't use a class try assigning the prototype on the function as a workaround. " + "`%s.prototype = React.Component.prototype`. Don't use an arrow function since it " + 'cannot be called with `new` by React.', _componentName, _componentName, _componentName);
 17126 
 17490         didWarnAboutModulePatternComponent[_componentName] = true;
 17127     var nextProps = workInProgress.pendingProps;
 17491       }
 17128     var nextChildren = nextProps.children;
 17492     }
 17129     reconcileChildren(current, workInProgress, nextChildren, renderExpirationTime);
 17493 
 17130     return workInProgress.child;
 17494     // Proceed under the assumption that this is a class instance
 17131   }
 17495     workInProgress.tag = ClassComponent;
 17132 
 17496 
 17133   function markRef(current, workInProgress) {
 17497     // Throw out any hooks that were used.
 17134     var ref = workInProgress.ref;
 17498     resetHooks();
 17135 
 17499 
 17136     if (current === null && ref !== null || current !== null && current.ref !== ref) {
 17500     // Push context providers early to prevent context stack mismatches.
 17137       // Schedule a Ref effect
       
 17138       workInProgress.effectTag |= Ref;
       
 17139     }
       
 17140   }
       
 17141 
       
 17142   function updateFunctionComponent(current, workInProgress, Component, nextProps, renderExpirationTime) {
       
 17143     {
       
 17144       if (workInProgress.type !== workInProgress.elementType) {
       
 17145         // Lazy component props can't be validated in createElement
       
 17146         // because they're only guaranteed to be resolved here.
       
 17147         var innerPropTypes = Component.propTypes;
       
 17148 
       
 17149         if (innerPropTypes) {
       
 17150           checkPropTypes_1(innerPropTypes, nextProps, // Resolved props
       
 17151           'prop', getComponentName(Component), getCurrentFiberStackInDev);
       
 17152         }
       
 17153       }
       
 17154     }
       
 17155 
       
 17156     var context;
       
 17157 
       
 17158     {
       
 17159       var unmaskedContext = getUnmaskedContext(workInProgress, Component, true);
       
 17160       context = getMaskedContext(workInProgress, unmaskedContext);
       
 17161     }
       
 17162 
       
 17163     var nextChildren;
       
 17164     prepareToReadContext(workInProgress, renderExpirationTime);
       
 17165 
       
 17166     {
       
 17167       ReactCurrentOwner$1.current = workInProgress;
       
 17168       setIsRendering(true);
       
 17169       nextChildren = renderWithHooks(current, workInProgress, Component, nextProps, context, renderExpirationTime);
       
 17170 
       
 17171       if ( workInProgress.mode & StrictMode) {
       
 17172         // Only double-render components with Hooks
       
 17173         if (workInProgress.memoizedState !== null) {
       
 17174           nextChildren = renderWithHooks(current, workInProgress, Component, nextProps, context, renderExpirationTime);
       
 17175         }
       
 17176       }
       
 17177 
       
 17178       setIsRendering(false);
       
 17179     }
       
 17180 
       
 17181     if (current !== null && !didReceiveUpdate) {
       
 17182       bailoutHooks(current, workInProgress, renderExpirationTime);
       
 17183       return bailoutOnAlreadyFinishedWork(current, workInProgress, renderExpirationTime);
       
 17184     } // React DevTools reads this flag.
       
 17185 
       
 17186 
       
 17187     workInProgress.effectTag |= PerformedWork;
       
 17188     reconcileChildren(current, workInProgress, nextChildren, renderExpirationTime);
       
 17189     return workInProgress.child;
       
 17190   }
       
 17191 
       
 17192   function updateClassComponent(current, workInProgress, Component, nextProps, renderExpirationTime) {
       
 17193     {
       
 17194       if (workInProgress.type !== workInProgress.elementType) {
       
 17195         // Lazy component props can't be validated in createElement
       
 17196         // because they're only guaranteed to be resolved here.
       
 17197         var innerPropTypes = Component.propTypes;
       
 17198 
       
 17199         if (innerPropTypes) {
       
 17200           checkPropTypes_1(innerPropTypes, nextProps, // Resolved props
       
 17201           'prop', getComponentName(Component), getCurrentFiberStackInDev);
       
 17202         }
       
 17203       }
       
 17204     } // Push context providers early to prevent context stack mismatches.
 17501     // During mounting we don't know the child context yet as the instance doesn't exist.
 17205     // During mounting we don't know the child context yet as the instance doesn't exist.
 17502     // We will invalidate the child context in finishClassComponent() right after rendering.
 17206     // We will invalidate the child context in finishClassComponent() right after rendering.
 17503     var hasContext = false;
 17207 
       
 17208 
       
 17209     var hasContext;
       
 17210 
 17504     if (isContextProvider(Component)) {
 17211     if (isContextProvider(Component)) {
 17505       hasContext = true;
 17212       hasContext = true;
 17506       pushContextProvider(workInProgress);
 17213       pushContextProvider(workInProgress);
 17507     } else {
 17214     } else {
 17508       hasContext = false;
 17215       hasContext = false;
 17509     }
 17216     }
 17510 
 17217 
 17511     workInProgress.memoizedState = value.state !== null && value.state !== undefined ? value.state : null;
 17218     prepareToReadContext(workInProgress, renderExpirationTime);
 17512 
 17219     var instance = workInProgress.stateNode;
 17513     var getDerivedStateFromProps = Component.getDerivedStateFromProps;
 17220     var shouldUpdate;
 17514     if (typeof getDerivedStateFromProps === 'function') {
 17221 
 17515       applyDerivedStateFromProps(workInProgress, Component, getDerivedStateFromProps, props);
 17222     if (instance === null) {
 17516     }
 17223       if (current !== null) {
 17517 
 17224         // A class component without an instance only mounts if it suspended
 17518     adoptClassInstance(workInProgress, value);
 17225         // inside a non-concurrent tree, in an inconsistent state. We want to
 17519     mountClassInstance(workInProgress, Component, props, renderExpirationTime);
 17226         // treat it like a new mount, even though an empty version of it already
       
 17227         // committed. Disconnect the alternate pointers.
       
 17228         current.alternate = null;
       
 17229         workInProgress.alternate = null; // Since this is conceptually a new fiber, schedule a Placement effect
       
 17230 
       
 17231         workInProgress.effectTag |= Placement;
       
 17232       } // In the initial pass we might need to construct the instance.
       
 17233 
       
 17234 
       
 17235       constructClassInstance(workInProgress, Component, nextProps);
       
 17236       mountClassInstance(workInProgress, Component, nextProps, renderExpirationTime);
       
 17237       shouldUpdate = true;
       
 17238     } else if (current === null) {
       
 17239       // In a resume, we'll already have an instance we can reuse.
       
 17240       shouldUpdate = resumeMountClassInstance(workInProgress, Component, nextProps, renderExpirationTime);
       
 17241     } else {
       
 17242       shouldUpdate = updateClassInstance(current, workInProgress, Component, nextProps, renderExpirationTime);
       
 17243     }
       
 17244 
       
 17245     var nextUnitOfWork = finishClassComponent(current, workInProgress, Component, shouldUpdate, hasContext, renderExpirationTime);
       
 17246 
       
 17247     {
       
 17248       var inst = workInProgress.stateNode;
       
 17249 
       
 17250       if (inst.props !== nextProps) {
       
 17251         if (!didWarnAboutReassigningProps) {
       
 17252           error('It looks like %s is reassigning its own `this.props` while rendering. ' + 'This is not supported and can lead to confusing bugs.', getComponentName(workInProgress.type) || 'a component');
       
 17253         }
       
 17254 
       
 17255         didWarnAboutReassigningProps = true;
       
 17256       }
       
 17257     }
       
 17258 
       
 17259     return nextUnitOfWork;
       
 17260   }
       
 17261 
       
 17262   function finishClassComponent(current, workInProgress, Component, shouldUpdate, hasContext, renderExpirationTime) {
       
 17263     // Refs should update even if shouldComponentUpdate returns false
       
 17264     markRef(current, workInProgress);
       
 17265     var didCaptureError = (workInProgress.effectTag & DidCapture) !== NoEffect;
       
 17266 
       
 17267     if (!shouldUpdate && !didCaptureError) {
       
 17268       // Context providers should defer to sCU for rendering
       
 17269       if (hasContext) {
       
 17270         invalidateContextProvider(workInProgress, Component, false);
       
 17271       }
       
 17272 
       
 17273       return bailoutOnAlreadyFinishedWork(current, workInProgress, renderExpirationTime);
       
 17274     }
       
 17275 
       
 17276     var instance = workInProgress.stateNode; // Rerender
       
 17277 
       
 17278     ReactCurrentOwner$1.current = workInProgress;
       
 17279     var nextChildren;
       
 17280 
       
 17281     if (didCaptureError && typeof Component.getDerivedStateFromError !== 'function') {
       
 17282       // If we captured an error, but getDerivedStateFromError is not defined,
       
 17283       // unmount all the children. componentDidCatch will schedule an update to
       
 17284       // re-render a fallback. This is temporary until we migrate everyone to
       
 17285       // the new API.
       
 17286       // TODO: Warn in a future release.
       
 17287       nextChildren = null;
       
 17288 
       
 17289       {
       
 17290         stopProfilerTimerIfRunning();
       
 17291       }
       
 17292     } else {
       
 17293       {
       
 17294         setIsRendering(true);
       
 17295         nextChildren = instance.render();
       
 17296 
       
 17297         if ( workInProgress.mode & StrictMode) {
       
 17298           instance.render();
       
 17299         }
       
 17300 
       
 17301         setIsRendering(false);
       
 17302       }
       
 17303     } // React DevTools reads this flag.
       
 17304 
       
 17305 
       
 17306     workInProgress.effectTag |= PerformedWork;
       
 17307 
       
 17308     if (current !== null && didCaptureError) {
       
 17309       // If we're recovering from an error, reconcile without reusing any of
       
 17310       // the existing children. Conceptually, the normal children and the children
       
 17311       // that are shown on error are two different sets, so we shouldn't reuse
       
 17312       // normal children even if their identities match.
       
 17313       forceUnmountCurrentAndReconcile(current, workInProgress, nextChildren, renderExpirationTime);
       
 17314     } else {
       
 17315       reconcileChildren(current, workInProgress, nextChildren, renderExpirationTime);
       
 17316     } // Memoize state using the values we just used to render.
       
 17317     // TODO: Restructure so we never read values from the instance.
       
 17318 
       
 17319 
       
 17320     workInProgress.memoizedState = instance.state; // The context might have changed so we need to recalculate it.
       
 17321 
       
 17322     if (hasContext) {
       
 17323       invalidateContextProvider(workInProgress, Component, true);
       
 17324     }
       
 17325 
       
 17326     return workInProgress.child;
       
 17327   }
       
 17328 
       
 17329   function pushHostRootContext(workInProgress) {
       
 17330     var root = workInProgress.stateNode;
       
 17331 
       
 17332     if (root.pendingContext) {
       
 17333       pushTopLevelContextObject(workInProgress, root.pendingContext, root.pendingContext !== root.context);
       
 17334     } else if (root.context) {
       
 17335       // Should always be set
       
 17336       pushTopLevelContextObject(workInProgress, root.context, false);
       
 17337     }
       
 17338 
       
 17339     pushHostContainer(workInProgress, root.containerInfo);
       
 17340   }
       
 17341 
       
 17342   function updateHostRoot(current, workInProgress, renderExpirationTime) {
       
 17343     pushHostRootContext(workInProgress);
       
 17344     var updateQueue = workInProgress.updateQueue;
       
 17345 
       
 17346     if (!(current !== null && updateQueue !== null)) {
       
 17347       {
       
 17348         throw Error( "If the root does not have an updateQueue, we should have already bailed out. This error is likely caused by a bug in React. Please file an issue." );
       
 17349       }
       
 17350     }
       
 17351 
       
 17352     var nextProps = workInProgress.pendingProps;
       
 17353     var prevState = workInProgress.memoizedState;
       
 17354     var prevChildren = prevState !== null ? prevState.element : null;
       
 17355     cloneUpdateQueue(current, workInProgress);
       
 17356     processUpdateQueue(workInProgress, nextProps, null, renderExpirationTime);
       
 17357     var nextState = workInProgress.memoizedState; // Caution: React DevTools currently depends on this property
       
 17358     // being called "element".
       
 17359 
       
 17360     var nextChildren = nextState.element;
       
 17361 
       
 17362     if (nextChildren === prevChildren) {
       
 17363       // If the state is the same as before, that's a bailout because we had
       
 17364       // no work that expires at this time.
       
 17365       resetHydrationState();
       
 17366       return bailoutOnAlreadyFinishedWork(current, workInProgress, renderExpirationTime);
       
 17367     }
       
 17368 
       
 17369     var root = workInProgress.stateNode;
       
 17370 
       
 17371     if (root.hydrate && enterHydrationState(workInProgress)) {
       
 17372       // If we don't have any current children this might be the first pass.
       
 17373       // We always try to hydrate. If this isn't a hydration pass there won't
       
 17374       // be any children to hydrate which is effectively the same thing as
       
 17375       // not hydrating.
       
 17376       var child = mountChildFibers(workInProgress, null, nextChildren, renderExpirationTime);
       
 17377       workInProgress.child = child;
       
 17378       var node = child;
       
 17379 
       
 17380       while (node) {
       
 17381         // Mark each child as hydrating. This is a fast path to know whether this
       
 17382         // tree is part of a hydrating tree. This is used to determine if a child
       
 17383         // node has fully mounted yet, and for scheduling event replaying.
       
 17384         // Conceptually this is similar to Placement in that a new subtree is
       
 17385         // inserted into the React tree here. It just happens to not need DOM
       
 17386         // mutations because it already exists.
       
 17387         node.effectTag = node.effectTag & ~Placement | Hydrating;
       
 17388         node = node.sibling;
       
 17389       }
       
 17390     } else {
       
 17391       // Otherwise reset hydration state in case we aborted and resumed another
       
 17392       // root.
       
 17393       reconcileChildren(current, workInProgress, nextChildren, renderExpirationTime);
       
 17394       resetHydrationState();
       
 17395     }
       
 17396 
       
 17397     return workInProgress.child;
       
 17398   }
       
 17399 
       
 17400   function updateHostComponent(current, workInProgress, renderExpirationTime) {
       
 17401     pushHostContext(workInProgress);
       
 17402 
       
 17403     if (current === null) {
       
 17404       tryToClaimNextHydratableInstance(workInProgress);
       
 17405     }
       
 17406 
       
 17407     var type = workInProgress.type;
       
 17408     var nextProps = workInProgress.pendingProps;
       
 17409     var prevProps = current !== null ? current.memoizedProps : null;
       
 17410     var nextChildren = nextProps.children;
       
 17411     var isDirectTextChild = shouldSetTextContent(type, nextProps);
       
 17412 
       
 17413     if (isDirectTextChild) {
       
 17414       // We special case a direct text child of a host node. This is a common
       
 17415       // case. We won't handle it as a reified child. We will instead handle
       
 17416       // this in the host environment that also has access to this prop. That
       
 17417       // avoids allocating another HostText fiber and traversing it.
       
 17418       nextChildren = null;
       
 17419     } else if (prevProps !== null && shouldSetTextContent(type, prevProps)) {
       
 17420       // If we're switching from a direct text child to a normal child, or to
       
 17421       // empty, we need to schedule the text content to be reset.
       
 17422       workInProgress.effectTag |= ContentReset;
       
 17423     }
       
 17424 
       
 17425     markRef(current, workInProgress); // Check the host config to see if the children are offscreen/hidden.
       
 17426 
       
 17427     if (workInProgress.mode & ConcurrentMode && renderExpirationTime !== Never && shouldDeprioritizeSubtree(type, nextProps)) {
       
 17428       {
       
 17429         markSpawnedWork(Never);
       
 17430       } // Schedule this fiber to re-render at offscreen priority. Then bailout.
       
 17431 
       
 17432 
       
 17433       workInProgress.expirationTime = workInProgress.childExpirationTime = Never;
       
 17434       return null;
       
 17435     }
       
 17436 
       
 17437     reconcileChildren(current, workInProgress, nextChildren, renderExpirationTime);
       
 17438     return workInProgress.child;
       
 17439   }
       
 17440 
       
 17441   function updateHostText(current, workInProgress) {
       
 17442     if (current === null) {
       
 17443       tryToClaimNextHydratableInstance(workInProgress);
       
 17444     } // Nothing to do here. This is terminal. We'll do the completion step
       
 17445     // immediately after.
       
 17446 
       
 17447 
       
 17448     return null;
       
 17449   }
       
 17450 
       
 17451   function mountLazyComponent(_current, workInProgress, elementType, updateExpirationTime, renderExpirationTime) {
       
 17452     if (_current !== null) {
       
 17453       // A lazy component only mounts if it suspended inside a non-
       
 17454       // concurrent tree, in an inconsistent state. We want to treat it like
       
 17455       // a new mount, even though an empty version of it already committed.
       
 17456       // Disconnect the alternate pointers.
       
 17457       _current.alternate = null;
       
 17458       workInProgress.alternate = null; // Since this is conceptually a new fiber, schedule a Placement effect
       
 17459 
       
 17460       workInProgress.effectTag |= Placement;
       
 17461     }
       
 17462 
       
 17463     var props = workInProgress.pendingProps; // We can't start a User Timing measurement with correct label yet.
       
 17464     // Cancel and resume right after we know the tag.
       
 17465 
       
 17466     cancelWorkTimer(workInProgress);
       
 17467     var Component = readLazyComponentType(elementType); // Store the unwrapped component in the type.
       
 17468 
       
 17469     workInProgress.type = Component;
       
 17470     var resolvedTag = workInProgress.tag = resolveLazyComponentTag(Component);
       
 17471     startWorkTimer(workInProgress);
       
 17472     var resolvedProps = resolveDefaultProps(Component, props);
       
 17473     var child;
       
 17474 
       
 17475     switch (resolvedTag) {
       
 17476       case FunctionComponent:
       
 17477         {
       
 17478           {
       
 17479             validateFunctionComponentInDev(workInProgress, Component);
       
 17480             workInProgress.type = Component = resolveFunctionForHotReloading(Component);
       
 17481           }
       
 17482 
       
 17483           child = updateFunctionComponent(null, workInProgress, Component, resolvedProps, renderExpirationTime);
       
 17484           return child;
       
 17485         }
       
 17486 
       
 17487       case ClassComponent:
       
 17488         {
       
 17489           {
       
 17490             workInProgress.type = Component = resolveClassForHotReloading(Component);
       
 17491           }
       
 17492 
       
 17493           child = updateClassComponent(null, workInProgress, Component, resolvedProps, renderExpirationTime);
       
 17494           return child;
       
 17495         }
       
 17496 
       
 17497       case ForwardRef:
       
 17498         {
       
 17499           {
       
 17500             workInProgress.type = Component = resolveForwardRefForHotReloading(Component);
       
 17501           }
       
 17502 
       
 17503           child = updateForwardRef(null, workInProgress, Component, resolvedProps, renderExpirationTime);
       
 17504           return child;
       
 17505         }
       
 17506 
       
 17507       case MemoComponent:
       
 17508         {
       
 17509           {
       
 17510             if (workInProgress.type !== workInProgress.elementType) {
       
 17511               var outerPropTypes = Component.propTypes;
       
 17512 
       
 17513               if (outerPropTypes) {
       
 17514                 checkPropTypes_1(outerPropTypes, resolvedProps, // Resolved for outer only
       
 17515                 'prop', getComponentName(Component), getCurrentFiberStackInDev);
       
 17516               }
       
 17517             }
       
 17518           }
       
 17519 
       
 17520           child = updateMemoComponent(null, workInProgress, Component, resolveDefaultProps(Component.type, resolvedProps), // The inner type can have defaults too
       
 17521           updateExpirationTime, renderExpirationTime);
       
 17522           return child;
       
 17523         }
       
 17524     }
       
 17525 
       
 17526     var hint = '';
       
 17527 
       
 17528     {
       
 17529       if (Component !== null && typeof Component === 'object' && Component.$$typeof === REACT_LAZY_TYPE) {
       
 17530         hint = ' Did you wrap a component in React.lazy() more than once?';
       
 17531       }
       
 17532     } // This message intentionally doesn't mention ForwardRef or MemoComponent
       
 17533     // because the fact that it's a separate type of work is an
       
 17534     // implementation detail.
       
 17535 
       
 17536 
       
 17537     {
       
 17538       {
       
 17539         throw Error( "Element type is invalid. Received a promise that resolves to: " + Component + ". Lazy element type must resolve to a class or function." + hint );
       
 17540       }
       
 17541     }
       
 17542   }
       
 17543 
       
 17544   function mountIncompleteClassComponent(_current, workInProgress, Component, nextProps, renderExpirationTime) {
       
 17545     if (_current !== null) {
       
 17546       // An incomplete component only mounts if it suspended inside a non-
       
 17547       // concurrent tree, in an inconsistent state. We want to treat it like
       
 17548       // a new mount, even though an empty version of it already committed.
       
 17549       // Disconnect the alternate pointers.
       
 17550       _current.alternate = null;
       
 17551       workInProgress.alternate = null; // Since this is conceptually a new fiber, schedule a Placement effect
       
 17552 
       
 17553       workInProgress.effectTag |= Placement;
       
 17554     } // Promote the fiber to a class and try rendering again.
       
 17555 
       
 17556 
       
 17557     workInProgress.tag = ClassComponent; // The rest of this function is a fork of `updateClassComponent`
       
 17558     // Push context providers early to prevent context stack mismatches.
       
 17559     // During mounting we don't know the child context yet as the instance doesn't exist.
       
 17560     // We will invalidate the child context in finishClassComponent() right after rendering.
       
 17561 
       
 17562     var hasContext;
       
 17563 
       
 17564     if (isContextProvider(Component)) {
       
 17565       hasContext = true;
       
 17566       pushContextProvider(workInProgress);
       
 17567     } else {
       
 17568       hasContext = false;
       
 17569     }
       
 17570 
       
 17571     prepareToReadContext(workInProgress, renderExpirationTime);
       
 17572     constructClassInstance(workInProgress, Component, nextProps);
       
 17573     mountClassInstance(workInProgress, Component, nextProps, renderExpirationTime);
 17520     return finishClassComponent(null, workInProgress, Component, true, hasContext, renderExpirationTime);
 17574     return finishClassComponent(null, workInProgress, Component, true, hasContext, renderExpirationTime);
 17521   } else {
 17575   }
 17522     // Proceed under the assumption that this is a function component
 17576 
 17523     workInProgress.tag = FunctionComponent;
 17577   function mountIndeterminateComponent(_current, workInProgress, Component, renderExpirationTime) {
       
 17578     if (_current !== null) {
       
 17579       // An indeterminate component only mounts if it suspended inside a non-
       
 17580       // concurrent tree, in an inconsistent state. We want to treat it like
       
 17581       // a new mount, even though an empty version of it already committed.
       
 17582       // Disconnect the alternate pointers.
       
 17583       _current.alternate = null;
       
 17584       workInProgress.alternate = null; // Since this is conceptually a new fiber, schedule a Placement effect
       
 17585 
       
 17586       workInProgress.effectTag |= Placement;
       
 17587     }
       
 17588 
       
 17589     var props = workInProgress.pendingProps;
       
 17590     var context;
       
 17591 
 17524     {
 17592     {
 17525       if (disableLegacyContext && Component.contextTypes) {
 17593       var unmaskedContext = getUnmaskedContext(workInProgress, Component, false);
 17526         warningWithoutStack$1(false, '%s uses the legacy contextTypes API which is no longer supported. ' + 'Use React.createContext() with React.useContext() instead.', getComponentName(Component) || 'Unknown');
 17594       context = getMaskedContext(workInProgress, unmaskedContext);
 17527       }
 17595     }
 17528 
 17596 
 17529       if (debugRenderPhaseSideEffects || debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
 17597     prepareToReadContext(workInProgress, renderExpirationTime);
 17530         // Only double-render components with Hooks
 17598     var value;
 17531         if (workInProgress.memoizedState !== null) {
 17599 
 17532           value = renderWithHooks(null, workInProgress, Component, props, context, renderExpirationTime);
       
 17533         }
       
 17534       }
       
 17535     }
       
 17536     reconcileChildren(null, workInProgress, value, renderExpirationTime);
       
 17537     {
 17600     {
 17538       validateFunctionComponentInDev(workInProgress, Component);
 17601       if (Component.prototype && typeof Component.prototype.render === 'function') {
 17539     }
 17602         var componentName = getComponentName(Component) || 'Unknown';
 17540     return workInProgress.child;
 17603 
 17541   }
 17604         if (!didWarnAboutBadClass[componentName]) {
 17542 }
 17605           error("The <%s /> component appears to have a render method, but doesn't extend React.Component. " + 'This is likely to cause errors. Change %s to extend React.Component instead.', componentName, componentName);
 17543 
 17606 
 17544 function validateFunctionComponentInDev(workInProgress, Component) {
 17607           didWarnAboutBadClass[componentName] = true;
 17545   if (Component) {
 17608         }
 17546     !!Component.childContextTypes ? warningWithoutStack$1(false, '%s(...): childContextTypes cannot be defined on a function component.', Component.displayName || Component.name || 'Component') : void 0;
 17609       }
 17547   }
 17610 
 17548   if (workInProgress.ref !== null) {
 17611       if (workInProgress.mode & StrictMode) {
 17549     var info = '';
 17612         ReactStrictModeWarnings.recordLegacyContextWarning(workInProgress, null);
 17550     var ownerName = getCurrentFiberOwnerNameInDevOrNull();
 17613       }
 17551     if (ownerName) {
 17614 
 17552       info += '\n\nCheck the render method of `' + ownerName + '`.';
 17615       setIsRendering(true);
 17553     }
 17616       ReactCurrentOwner$1.current = workInProgress;
 17554 
 17617       value = renderWithHooks(null, workInProgress, Component, props, context, renderExpirationTime);
 17555     var warningKey = ownerName || workInProgress._debugID || '';
 17618       setIsRendering(false);
 17556     var debugSource = workInProgress._debugSource;
 17619     } // React DevTools reads this flag.
 17557     if (debugSource) {
 17620 
 17558       warningKey = debugSource.fileName + ':' + debugSource.lineNumber;
 17621 
 17559     }
 17622     workInProgress.effectTag |= PerformedWork;
 17560     if (!didWarnAboutFunctionRefs[warningKey]) {
 17623 
 17561       didWarnAboutFunctionRefs[warningKey] = true;
 17624     if (typeof value === 'object' && value !== null && typeof value.render === 'function' && value.$$typeof === undefined) {
 17562       warning$1(false, 'Function components cannot be given refs. ' + 'Attempts to access this ref will fail. ' + 'Did you mean to use React.forwardRef()?%s', info);
 17625       {
 17563     }
 17626         var _componentName = getComponentName(Component) || 'Unknown';
 17564   }
 17627 
 17565 
 17628         if (!didWarnAboutModulePatternComponent[_componentName]) {
 17566   if (warnAboutDefaultPropsOnFunctionComponents && Component.defaultProps !== undefined) {
 17629           error('The <%s /> component appears to be a function component that returns a class instance. ' + 'Change %s to a class that extends React.Component instead. ' + "If you can't use a class try assigning the prototype on the function as a workaround. " + "`%s.prototype = React.Component.prototype`. Don't use an arrow function since it " + 'cannot be called with `new` by React.', _componentName, _componentName, _componentName);
 17567     var componentName = getComponentName(Component) || 'Unknown';
 17630 
 17568 
 17631           didWarnAboutModulePatternComponent[_componentName] = true;
 17569     if (!didWarnAboutDefaultPropsOnFunctionComponent[componentName]) {
 17632         }
 17570       warningWithoutStack$1(false, '%s: Support for defaultProps will be removed from function components ' + 'in a future major release. Use JavaScript default parameters instead.', componentName);
 17633       } // Proceed under the assumption that this is a class instance
 17571       didWarnAboutDefaultPropsOnFunctionComponent[componentName] = true;
 17634 
 17572     }
 17635 
 17573   }
 17636       workInProgress.tag = ClassComponent; // Throw out any hooks that were used.
 17574 
 17637 
 17575   if (typeof Component.getDerivedStateFromProps === 'function') {
 17638       workInProgress.memoizedState = null;
 17576     var _componentName2 = getComponentName(Component) || 'Unknown';
 17639       workInProgress.updateQueue = null; // Push context providers early to prevent context stack mismatches.
 17577 
 17640       // During mounting we don't know the child context yet as the instance doesn't exist.
 17578     if (!didWarnAboutGetDerivedStateOnFunctionComponent[_componentName2]) {
 17641       // We will invalidate the child context in finishClassComponent() right after rendering.
 17579       warningWithoutStack$1(false, '%s: Function components do not support getDerivedStateFromProps.', _componentName2);
 17642 
 17580       didWarnAboutGetDerivedStateOnFunctionComponent[_componentName2] = true;
 17643       var hasContext = false;
 17581     }
 17644 
 17582   }
 17645       if (isContextProvider(Component)) {
 17583 
 17646         hasContext = true;
 17584   if (typeof Component.contextType === 'object' && Component.contextType !== null) {
 17647         pushContextProvider(workInProgress);
 17585     var _componentName3 = getComponentName(Component) || 'Unknown';
 17648       } else {
 17586 
 17649         hasContext = false;
 17587     if (!didWarnAboutContextTypeOnFunctionComponent[_componentName3]) {
 17650       }
 17588       warningWithoutStack$1(false, '%s: Function components do not support contextType.', _componentName3);
 17651 
 17589       didWarnAboutContextTypeOnFunctionComponent[_componentName3] = true;
 17652       workInProgress.memoizedState = value.state !== null && value.state !== undefined ? value.state : null;
 17590     }
 17653       initializeUpdateQueue(workInProgress);
 17591   }
 17654       var getDerivedStateFromProps = Component.getDerivedStateFromProps;
 17592 }
 17655 
 17593 
 17656       if (typeof getDerivedStateFromProps === 'function') {
 17594 // TODO: This is now an empty object. Should we just make it a boolean?
 17657         applyDerivedStateFromProps(workInProgress, Component, getDerivedStateFromProps, props);
 17595 var SUSPENDED_MARKER = {};
 17658       }
 17596 
 17659 
 17597 function shouldRemainOnFallback(suspenseContext, current$$1, workInProgress) {
 17660       adoptClassInstance(workInProgress, value);
 17598   // If the context is telling us that we should show a fallback, and we're not
 17661       mountClassInstance(workInProgress, Component, props, renderExpirationTime);
 17599   // already showing content, then we should show the fallback instead.
 17662       return finishClassComponent(null, workInProgress, Component, true, hasContext, renderExpirationTime);
 17600   return hasSuspenseContext(suspenseContext, ForceSuspenseFallback) && (current$$1 === null || current$$1.memoizedState !== null);
 17663     } else {
 17601 }
 17664       // Proceed under the assumption that this is a function component
 17602 
 17665       workInProgress.tag = FunctionComponent;
 17603 function updateSuspenseComponent(current$$1, workInProgress, renderExpirationTime) {
 17666 
 17604   var mode = workInProgress.mode;
 17667       {
 17605   var nextProps = workInProgress.pendingProps;
 17668 
 17606 
 17669         if ( workInProgress.mode & StrictMode) {
 17607   // This is used by DevTools to force a boundary to suspend.
 17670           // Only double-render components with Hooks
 17608   {
 17671           if (workInProgress.memoizedState !== null) {
 17609     if (shouldSuspend(workInProgress)) {
 17672             value = renderWithHooks(null, workInProgress, Component, props, context, renderExpirationTime);
 17610       workInProgress.effectTag |= DidCapture;
 17673           }
 17611     }
 17674         }
 17612   }
 17675       }
 17613 
 17676 
 17614   var suspenseContext = suspenseStackCursor.current;
 17677       reconcileChildren(null, workInProgress, value, renderExpirationTime);
 17615 
 17678 
 17616   var nextState = null;
 17679       {
 17617   var nextDidTimeout = false;
 17680         validateFunctionComponentInDev(workInProgress, Component);
 17618 
 17681       }
 17619   if ((workInProgress.effectTag & DidCapture) !== NoEffect || shouldRemainOnFallback(suspenseContext, current$$1, workInProgress)) {
 17682 
 17620     // Something in this boundary's subtree already suspended. Switch to
 17683       return workInProgress.child;
 17621     // rendering the fallback children.
 17684     }
 17622     nextState = SUSPENDED_MARKER;
 17685   }
 17623     nextDidTimeout = true;
 17686 
 17624     workInProgress.effectTag &= ~DidCapture;
 17687   function validateFunctionComponentInDev(workInProgress, Component) {
 17625   } else {
 17688     {
 17626     // Attempting the main content
 17689       if (Component) {
 17627     if (current$$1 === null || current$$1.memoizedState !== null) {
 17690         if (Component.childContextTypes) {
 17628       // This is a new mount or this boundary is already showing a fallback state.
 17691           error('%s(...): childContextTypes cannot be defined on a function component.', Component.displayName || Component.name || 'Component');
 17629       // Mark this subtree context as having at least one invisible parent that could
 17692         }
 17630       // handle the fallback state.
 17693       }
 17631       // Boundaries without fallbacks or should be avoided are not considered since
 17694 
 17632       // they cannot handle preferred fallback states.
 17695       if (workInProgress.ref !== null) {
 17633       if (nextProps.fallback !== undefined && nextProps.unstable_avoidThisFallback !== true) {
 17696         var info = '';
 17634         suspenseContext = addSubtreeSuspenseContext(suspenseContext, InvisibleParentSuspenseContext);
 17697         var ownerName = getCurrentFiberOwnerNameInDevOrNull();
 17635       }
 17698 
 17636     }
 17699         if (ownerName) {
 17637   }
 17700           info += '\n\nCheck the render method of `' + ownerName + '`.';
 17638 
 17701         }
 17639   suspenseContext = setDefaultShallowSuspenseContext(suspenseContext);
 17702 
 17640 
 17703         var warningKey = ownerName || workInProgress._debugID || '';
 17641   pushSuspenseContext(workInProgress, suspenseContext);
 17704         var debugSource = workInProgress._debugSource;
 17642 
 17705 
 17643   {
 17706         if (debugSource) {
 17644     if ('maxDuration' in nextProps) {
 17707           warningKey = debugSource.fileName + ':' + debugSource.lineNumber;
 17645       if (!didWarnAboutMaxDuration) {
 17708         }
 17646         didWarnAboutMaxDuration = true;
 17709 
 17647         warning$1(false, 'maxDuration has been removed from React. ' + 'Remove the maxDuration prop.');
 17710         if (!didWarnAboutFunctionRefs[warningKey]) {
 17648       }
 17711           didWarnAboutFunctionRefs[warningKey] = true;
 17649     }
 17712 
 17650   }
 17713           error('Function components cannot be given refs. ' + 'Attempts to access this ref will fail. ' + 'Did you mean to use React.forwardRef()?%s', info);
 17651 
 17714         }
 17652   // This next part is a bit confusing. If the children timeout, we switch to
 17715       }
 17653   // showing the fallback children in place of the "primary" children.
 17716 
 17654   // However, we don't want to delete the primary children because then their
 17717       if (typeof Component.getDerivedStateFromProps === 'function') {
 17655   // state will be lost (both the React state and the host state, e.g.
 17718         var _componentName2 = getComponentName(Component) || 'Unknown';
 17656   // uncontrolled form inputs). Instead we keep them mounted and hide them.
 17719 
 17657   // Both the fallback children AND the primary children are rendered at the
 17720         if (!didWarnAboutGetDerivedStateOnFunctionComponent[_componentName2]) {
 17658   // same time. Once the primary children are un-suspended, we can delete
 17721           error('%s: Function components do not support getDerivedStateFromProps.', _componentName2);
 17659   // the fallback children — don't need to preserve their state.
 17722 
 17660   //
 17723           didWarnAboutGetDerivedStateOnFunctionComponent[_componentName2] = true;
 17661   // The two sets of children are siblings in the host environment, but
 17724         }
 17662   // semantically, for purposes of reconciliation, they are two separate sets.
 17725       }
 17663   // So we store them using two fragment fibers.
 17726 
 17664   //
 17727       if (typeof Component.contextType === 'object' && Component.contextType !== null) {
 17665   // However, we want to avoid allocating extra fibers for every placeholder.
 17728         var _componentName3 = getComponentName(Component) || 'Unknown';
 17666   // They're only necessary when the children time out, because that's the
 17729 
 17667   // only time when both sets are mounted.
 17730         if (!didWarnAboutContextTypeOnFunctionComponent[_componentName3]) {
 17668   //
 17731           error('%s: Function components do not support contextType.', _componentName3);
 17669   // So, the extra fragment fibers are only used if the children time out.
 17732 
 17670   // Otherwise, we render the primary children directly. This requires some
 17733           didWarnAboutContextTypeOnFunctionComponent[_componentName3] = true;
 17671   // custom reconciliation logic to preserve the state of the primary
 17734         }
 17672   // children. It's essentially a very basic form of re-parenting.
 17735       }
 17673 
 17736     }
 17674   // `child` points to the child fiber. In the normal case, this is the first
 17737   }
 17675   // fiber of the primary children set. In the timed-out case, it's a
 17738 
 17676   // a fragment fiber containing the primary children.
 17739   var SUSPENDED_MARKER = {
 17677   var child = void 0;
 17740     dehydrated: null,
 17678   // `next` points to the next fiber React should render. In the normal case,
 17741     retryTime: NoWork
 17679   // it's the same as `child`: the first fiber of the primary children set.
 17742   };
 17680   // In the timed-out case, it's a fragment fiber containing the *fallback*
 17743 
 17681   // children -- we skip over the primary children entirely.
 17744   function shouldRemainOnFallback(suspenseContext, current, workInProgress) {
 17682   var next = void 0;
 17745     // If the context is telling us that we should show a fallback, and we're not
 17683   if (current$$1 === null) {
 17746     // already showing content, then we should show the fallback instead.
 17684     if (enableSuspenseServerRenderer) {
 17747     return hasSuspenseContext(suspenseContext, ForceSuspenseFallback) && (current === null || current.memoizedState !== null);
       
 17748   }
       
 17749 
       
 17750   function updateSuspenseComponent(current, workInProgress, renderExpirationTime) {
       
 17751     var mode = workInProgress.mode;
       
 17752     var nextProps = workInProgress.pendingProps; // This is used by DevTools to force a boundary to suspend.
       
 17753 
       
 17754     {
       
 17755       if (shouldSuspend(workInProgress)) {
       
 17756         workInProgress.effectTag |= DidCapture;
       
 17757       }
       
 17758     }
       
 17759 
       
 17760     var suspenseContext = suspenseStackCursor.current;
       
 17761     var nextDidTimeout = false;
       
 17762     var didSuspend = (workInProgress.effectTag & DidCapture) !== NoEffect;
       
 17763 
       
 17764     if (didSuspend || shouldRemainOnFallback(suspenseContext, current)) {
       
 17765       // Something in this boundary's subtree already suspended. Switch to
       
 17766       // rendering the fallback children.
       
 17767       nextDidTimeout = true;
       
 17768       workInProgress.effectTag &= ~DidCapture;
       
 17769     } else {
       
 17770       // Attempting the main content
       
 17771       if (current === null || current.memoizedState !== null) {
       
 17772         // This is a new mount or this boundary is already showing a fallback state.
       
 17773         // Mark this subtree context as having at least one invisible parent that could
       
 17774         // handle the fallback state.
       
 17775         // Boundaries without fallbacks or should be avoided are not considered since
       
 17776         // they cannot handle preferred fallback states.
       
 17777         if (nextProps.fallback !== undefined && nextProps.unstable_avoidThisFallback !== true) {
       
 17778           suspenseContext = addSubtreeSuspenseContext(suspenseContext, InvisibleParentSuspenseContext);
       
 17779         }
       
 17780       }
       
 17781     }
       
 17782 
       
 17783     suspenseContext = setDefaultShallowSuspenseContext(suspenseContext);
       
 17784     pushSuspenseContext(workInProgress, suspenseContext); // This next part is a bit confusing. If the children timeout, we switch to
       
 17785     // showing the fallback children in place of the "primary" children.
       
 17786     // However, we don't want to delete the primary children because then their
       
 17787     // state will be lost (both the React state and the host state, e.g.
       
 17788     // uncontrolled form inputs). Instead we keep them mounted and hide them.
       
 17789     // Both the fallback children AND the primary children are rendered at the
       
 17790     // same time. Once the primary children are un-suspended, we can delete
       
 17791     // the fallback children — don't need to preserve their state.
       
 17792     //
       
 17793     // The two sets of children are siblings in the host environment, but
       
 17794     // semantically, for purposes of reconciliation, they are two separate sets.
       
 17795     // So we store them using two fragment fibers.
       
 17796     //
       
 17797     // However, we want to avoid allocating extra fibers for every placeholder.
       
 17798     // They're only necessary when the children time out, because that's the
       
 17799     // only time when both sets are mounted.
       
 17800     //
       
 17801     // So, the extra fragment fibers are only used if the children time out.
       
 17802     // Otherwise, we render the primary children directly. This requires some
       
 17803     // custom reconciliation logic to preserve the state of the primary
       
 17804     // children. It's essentially a very basic form of re-parenting.
       
 17805 
       
 17806     if (current === null) {
 17685       // If we're currently hydrating, try to hydrate this boundary.
 17807       // If we're currently hydrating, try to hydrate this boundary.
 17686       // But only if this has a fallback.
 17808       // But only if this has a fallback.
 17687       if (nextProps.fallback !== undefined) {
 17809       if (nextProps.fallback !== undefined) {
 17688         tryToClaimNextHydratableInstance(workInProgress);
 17810         tryToClaimNextHydratableInstance(workInProgress); // This could've been a dehydrated suspense component.
 17689         // This could've changed the tag if this was a dehydrated suspense component.
 17811       } // This is the initial mount. This branch is pretty simple because there's
 17690         if (workInProgress.tag === DehydratedSuspenseComponent) {
 17812       // no previous state that needs to be preserved.
 17691           popSuspenseContext(workInProgress);
 17813 
 17692           return updateDehydratedSuspenseComponent(null, workInProgress, renderExpirationTime);
 17814 
 17693         }
 17815       if (nextDidTimeout) {
 17694       }
 17816         // Mount separate fragments for primary and fallback children.
 17695     }
 17817         var nextFallbackChildren = nextProps.fallback;
 17696 
 17818         var primaryChildFragment = createFiberFromFragment(null, mode, NoWork, null);
 17697     // This is the initial mount. This branch is pretty simple because there's
 17819         primaryChildFragment.return = workInProgress;
 17698     // no previous state that needs to be preserved.
 17820 
 17699     if (nextDidTimeout) {
 17821         if ((workInProgress.mode & BlockingMode) === NoMode) {
 17700       // Mount separate fragments for primary and fallback children.
 17822           // Outside of blocking mode, we commit the effects from the
 17701       var nextFallbackChildren = nextProps.fallback;
 17823           // partially completed, timed-out tree, too.
 17702       var primaryChildFragment = createFiberFromFragment(null, mode, NoWork, null);
 17824           var progressedState = workInProgress.memoizedState;
 17703       primaryChildFragment.return = workInProgress;
 17825           var progressedPrimaryChild = progressedState !== null ? workInProgress.child.child : workInProgress.child;
 17704 
 17826           primaryChildFragment.child = progressedPrimaryChild;
 17705       if ((workInProgress.mode & BatchedMode) === NoMode) {
 17827           var progressedChild = progressedPrimaryChild;
 17706         // Outside of batched mode, we commit the effects from the
 17828 
 17707         var progressedState = workInProgress.memoizedState;
 17829           while (progressedChild !== null) {
 17708         var progressedPrimaryChild = progressedState !== null ? workInProgress.child.child : workInProgress.child;
 17830             progressedChild.return = primaryChildFragment;
 17709         primaryChildFragment.child = progressedPrimaryChild;
 17831             progressedChild = progressedChild.sibling;
 17710         var progressedChild = progressedPrimaryChild;
 17832           }
 17711         while (progressedChild !== null) {
 17833         }
 17712           progressedChild.return = primaryChildFragment;
 17834 
 17713           progressedChild = progressedChild.sibling;
 17835         var fallbackChildFragment = createFiberFromFragment(nextFallbackChildren, mode, renderExpirationTime, null);
 17714         }
 17836         fallbackChildFragment.return = workInProgress;
 17715       }
 17837         primaryChildFragment.sibling = fallbackChildFragment; // Skip the primary children, and continue working on the
 17716 
 17838         // fallback children.
 17717       var fallbackChildFragment = createFiberFromFragment(nextFallbackChildren, mode, renderExpirationTime, null);
 17839 
 17718       fallbackChildFragment.return = workInProgress;
 17840         workInProgress.memoizedState = SUSPENDED_MARKER;
 17719       primaryChildFragment.sibling = fallbackChildFragment;
 17841         workInProgress.child = primaryChildFragment;
 17720       child = primaryChildFragment;
 17842         return fallbackChildFragment;
 17721       // Skip the primary children, and continue working on the
 17843       } else {
 17722       // fallback children.
 17844         // Mount the primary children without an intermediate fragment fiber.
 17723       next = fallbackChildFragment;
 17845         var nextPrimaryChildren = nextProps.children;
       
 17846         workInProgress.memoizedState = null;
       
 17847         return workInProgress.child = mountChildFibers(workInProgress, null, nextPrimaryChildren, renderExpirationTime);
       
 17848       }
 17724     } else {
 17849     } else {
 17725       // Mount the primary children without an intermediate fragment fiber.
 17850       // This is an update. This branch is more complicated because we need to
 17726       var nextPrimaryChildren = nextProps.children;
 17851       // ensure the state of the primary children is preserved.
 17727       child = next = mountChildFibers(workInProgress, null, nextPrimaryChildren, renderExpirationTime);
 17852       var prevState = current.memoizedState;
 17728     }
 17853 
 17729   } else {
 17854       if (prevState !== null) {
 17730     // This is an update. This branch is more complicated because we need to
 17855         // wrapped in a fragment fiber.
 17731     // ensure the state of the primary children is preserved.
 17856 
 17732     var prevState = current$$1.memoizedState;
 17857 
 17733     var prevDidTimeout = prevState !== null;
 17858         var currentPrimaryChildFragment = current.child;
 17734     if (prevDidTimeout) {
 17859         var currentFallbackChildFragment = currentPrimaryChildFragment.sibling;
 17735       // The current tree already timed out. That means each child set is
 17860 
 17736       var currentPrimaryChildFragment = current$$1.child;
 17861         if (nextDidTimeout) {
 17737       var currentFallbackChildFragment = currentPrimaryChildFragment.sibling;
 17862           // Still timed out. Reuse the current primary children by cloning
 17738       if (nextDidTimeout) {
 17863           // its fragment. We're going to skip over these entirely.
 17739         // Still timed out. Reuse the current primary children by cloning
 17864           var _nextFallbackChildren2 = nextProps.fallback;
 17740         // its fragment. We're going to skip over these entirely.
 17865 
 17741         var _nextFallbackChildren = nextProps.fallback;
 17866           var _primaryChildFragment2 = createWorkInProgress(currentPrimaryChildFragment, currentPrimaryChildFragment.pendingProps);
 17742         var _primaryChildFragment = createWorkInProgress(currentPrimaryChildFragment, currentPrimaryChildFragment.pendingProps, NoWork);
 17867 
 17743         _primaryChildFragment.return = workInProgress;
 17868           _primaryChildFragment2.return = workInProgress;
 17744 
 17869 
 17745         if ((workInProgress.mode & BatchedMode) === NoMode) {
 17870           if ((workInProgress.mode & BlockingMode) === NoMode) {
 17746           // Outside of batched mode, we commit the effects from the
 17871             // Outside of blocking mode, we commit the effects from the
 17747           var _progressedState = workInProgress.memoizedState;
 17872             // partially completed, timed-out tree, too.
 17748           var _progressedPrimaryChild = _progressedState !== null ? workInProgress.child.child : workInProgress.child;
 17873             var _progressedState = workInProgress.memoizedState;
 17749           if (_progressedPrimaryChild !== currentPrimaryChildFragment.child) {
 17874 
 17750             _primaryChildFragment.child = _progressedPrimaryChild;
 17875             var _progressedPrimaryChild = _progressedState !== null ? workInProgress.child.child : workInProgress.child;
 17751             var _progressedChild = _progressedPrimaryChild;
 17876 
 17752             while (_progressedChild !== null) {
 17877             if (_progressedPrimaryChild !== currentPrimaryChildFragment.child) {
 17753               _progressedChild.return = _primaryChildFragment;
 17878               _primaryChildFragment2.child = _progressedPrimaryChild;
 17754               _progressedChild = _progressedChild.sibling;
 17879               var _progressedChild2 = _progressedPrimaryChild;
       
 17880 
       
 17881               while (_progressedChild2 !== null) {
       
 17882                 _progressedChild2.return = _primaryChildFragment2;
       
 17883                 _progressedChild2 = _progressedChild2.sibling;
       
 17884               }
 17755             }
 17885             }
 17756           }
 17886           } // Because primaryChildFragment is a new fiber that we're inserting as the
 17757         }
 17887           // parent of a new tree, we need to set its treeBaseDuration.
 17758 
 17888 
 17759         // Because primaryChildFragment is a new fiber that we're inserting as the
 17889 
 17760         // parent of a new tree, we need to set its treeBaseDuration.
 17890           if ( workInProgress.mode & ProfileMode) {
 17761         if (enableProfilerTimer && workInProgress.mode & ProfileMode) {
 17891             // treeBaseDuration is the sum of all the child tree base durations.
 17762           // treeBaseDuration is the sum of all the child tree base durations.
 17892             var _treeBaseDuration = 0;
 17763           var treeBaseDuration = 0;
 17893             var _hiddenChild = _primaryChildFragment2.child;
 17764           var hiddenChild = _primaryChildFragment.child;
 17894 
 17765           while (hiddenChild !== null) {
 17895             while (_hiddenChild !== null) {
 17766             treeBaseDuration += hiddenChild.treeBaseDuration;
 17896               _treeBaseDuration += _hiddenChild.treeBaseDuration;
 17767             hiddenChild = hiddenChild.sibling;
 17897               _hiddenChild = _hiddenChild.sibling;
 17768           }
 17898             }
 17769           _primaryChildFragment.treeBaseDuration = treeBaseDuration;
 17899 
 17770         }
 17900             _primaryChildFragment2.treeBaseDuration = _treeBaseDuration;
 17771 
 17901           } // Clone the fallback child fragment, too. These we'll continue
 17772         // Clone the fallback child fragment, too. These we'll continue
 17902           // working on.
 17773         // working on.
 17903 
 17774         var _fallbackChildFragment = createWorkInProgress(currentFallbackChildFragment, _nextFallbackChildren, currentFallbackChildFragment.expirationTime);
 17904 
 17775         _fallbackChildFragment.return = workInProgress;
 17905           var _fallbackChildFragment2 = createWorkInProgress(currentFallbackChildFragment, _nextFallbackChildren2);
 17776         _primaryChildFragment.sibling = _fallbackChildFragment;
 17906 
 17777         child = _primaryChildFragment;
 17907           _fallbackChildFragment2.return = workInProgress;
 17778         _primaryChildFragment.childExpirationTime = NoWork;
 17908           _primaryChildFragment2.sibling = _fallbackChildFragment2;
 17779         // Skip the primary children, and continue working on the
 17909           _primaryChildFragment2.childExpirationTime = NoWork; // Skip the primary children, and continue working on the
 17780         // fallback children.
 17910           // fallback children.
 17781         next = _fallbackChildFragment;
 17911 
       
 17912           workInProgress.memoizedState = SUSPENDED_MARKER;
       
 17913           workInProgress.child = _primaryChildFragment2;
       
 17914           return _fallbackChildFragment2;
       
 17915         } else {
       
 17916           // No longer suspended. Switch back to showing the primary children,
       
 17917           // and remove the intermediate fragment fiber.
       
 17918           var _nextPrimaryChildren = nextProps.children;
       
 17919           var currentPrimaryChild = currentPrimaryChildFragment.child;
       
 17920           var primaryChild = reconcileChildFibers(workInProgress, currentPrimaryChild, _nextPrimaryChildren, renderExpirationTime); // If this render doesn't suspend, we need to delete the fallback
       
 17921           // children. Wait until the complete phase, after we've confirmed the
       
 17922           // fallback is no longer needed.
       
 17923           // TODO: Would it be better to store the fallback fragment on
       
 17924           // the stateNode?
       
 17925           // Continue rendering the children, like we normally do.
       
 17926 
       
 17927           workInProgress.memoizedState = null;
       
 17928           return workInProgress.child = primaryChild;
       
 17929         }
 17782       } else {
 17930       } else {
 17783         // No longer suspended. Switch back to showing the primary children,
 17931         // The current tree has not already timed out. That means the primary
 17784         // and remove the intermediate fragment fiber.
 17932         // children are not wrapped in a fragment fiber.
 17785         var _nextPrimaryChildren = nextProps.children;
 17933         var _currentPrimaryChild = current.child;
 17786         var currentPrimaryChild = currentPrimaryChildFragment.child;
 17934 
 17787         var primaryChild = reconcileChildFibers(workInProgress, currentPrimaryChild, _nextPrimaryChildren, renderExpirationTime);
 17935         if (nextDidTimeout) {
 17788 
 17936           // Timed out. Wrap the children in a fragment fiber to keep them
 17789         // If this render doesn't suspend, we need to delete the fallback
 17937           // separate from the fallback children.
 17790         // children. Wait until the complete phase, after we've confirmed the
 17938           var _nextFallbackChildren3 = nextProps.fallback;
 17791         // fallback is no longer needed.
 17939 
 17792         // TODO: Would it be better to store the fallback fragment on
 17940           var _primaryChildFragment3 = createFiberFromFragment( // It shouldn't matter what the pending props are because we aren't
 17793         // the stateNode?
 17941           // going to render this fragment.
 17794 
 17942           null, mode, NoWork, null);
 17795         // Continue rendering the children, like we normally do.
 17943 
 17796         child = next = primaryChild;
 17944           _primaryChildFragment3.return = workInProgress;
 17797       }
 17945           _primaryChildFragment3.child = _currentPrimaryChild;
 17798     } else {
 17946 
 17799       // The current tree has not already timed out. That means the primary
 17947           if (_currentPrimaryChild !== null) {
 17800       // children are not wrapped in a fragment fiber.
 17948             _currentPrimaryChild.return = _primaryChildFragment3;
 17801       var _currentPrimaryChild = current$$1.child;
 17949           } // Even though we're creating a new fiber, there are no new children,
 17802       if (nextDidTimeout) {
 17950           // because we're reusing an already mounted tree. So we don't need to
 17803         // Timed out. Wrap the children in a fragment fiber to keep them
 17951           // schedule a placement.
 17804         // separate from the fallback children.
 17952           // primaryChildFragment.effectTag |= Placement;
 17805         var _nextFallbackChildren2 = nextProps.fallback;
 17953 
 17806         var _primaryChildFragment2 = createFiberFromFragment(
 17954 
 17807         // It shouldn't matter what the pending props are because we aren't
 17955           if ((workInProgress.mode & BlockingMode) === NoMode) {
 17808         // going to render this fragment.
 17956             // Outside of blocking mode, we commit the effects from the
 17809         null, mode, NoWork, null);
 17957             // partially completed, timed-out tree, too.
 17810         _primaryChildFragment2.return = workInProgress;
 17958             var _progressedState2 = workInProgress.memoizedState;
 17811         _primaryChildFragment2.child = _currentPrimaryChild;
 17959 
 17812         if (_currentPrimaryChild !== null) {
 17960             var _progressedPrimaryChild2 = _progressedState2 !== null ? workInProgress.child.child : workInProgress.child;
 17813           _currentPrimaryChild.return = _primaryChildFragment2;
 17961 
 17814         }
 17962             _primaryChildFragment3.child = _progressedPrimaryChild2;
 17815 
 17963             var _progressedChild3 = _progressedPrimaryChild2;
 17816         // Even though we're creating a new fiber, there are no new children,
 17964 
 17817         // because we're reusing an already mounted tree. So we don't need to
 17965             while (_progressedChild3 !== null) {
 17818         // schedule a placement.
 17966               _progressedChild3.return = _primaryChildFragment3;
 17819         // primaryChildFragment.effectTag |= Placement;
 17967               _progressedChild3 = _progressedChild3.sibling;
 17820 
       
 17821         if ((workInProgress.mode & BatchedMode) === NoMode) {
       
 17822           // Outside of batched mode, we commit the effects from the
       
 17823           var _progressedState2 = workInProgress.memoizedState;
       
 17824           var _progressedPrimaryChild2 = _progressedState2 !== null ? workInProgress.child.child : workInProgress.child;
       
 17825           _primaryChildFragment2.child = _progressedPrimaryChild2;
       
 17826           var _progressedChild2 = _progressedPrimaryChild2;
       
 17827           while (_progressedChild2 !== null) {
       
 17828             _progressedChild2.return = _primaryChildFragment2;
       
 17829             _progressedChild2 = _progressedChild2.sibling;
       
 17830           }
       
 17831         }
       
 17832 
       
 17833         // Because primaryChildFragment is a new fiber that we're inserting as the
       
 17834         // parent of a new tree, we need to set its treeBaseDuration.
       
 17835         if (enableProfilerTimer && workInProgress.mode & ProfileMode) {
       
 17836           // treeBaseDuration is the sum of all the child tree base durations.
       
 17837           var _treeBaseDuration = 0;
       
 17838           var _hiddenChild = _primaryChildFragment2.child;
       
 17839           while (_hiddenChild !== null) {
       
 17840             _treeBaseDuration += _hiddenChild.treeBaseDuration;
       
 17841             _hiddenChild = _hiddenChild.sibling;
       
 17842           }
       
 17843           _primaryChildFragment2.treeBaseDuration = _treeBaseDuration;
       
 17844         }
       
 17845 
       
 17846         // Create a fragment from the fallback children, too.
       
 17847         var _fallbackChildFragment2 = createFiberFromFragment(_nextFallbackChildren2, mode, renderExpirationTime, null);
       
 17848         _fallbackChildFragment2.return = workInProgress;
       
 17849         _primaryChildFragment2.sibling = _fallbackChildFragment2;
       
 17850         _fallbackChildFragment2.effectTag |= Placement;
       
 17851         child = _primaryChildFragment2;
       
 17852         _primaryChildFragment2.childExpirationTime = NoWork;
       
 17853         // Skip the primary children, and continue working on the
       
 17854         // fallback children.
       
 17855         next = _fallbackChildFragment2;
       
 17856       } else {
       
 17857         // Still haven't timed out.  Continue rendering the children, like we
       
 17858         // normally do.
       
 17859         var _nextPrimaryChildren2 = nextProps.children;
       
 17860         next = child = reconcileChildFibers(workInProgress, _currentPrimaryChild, _nextPrimaryChildren2, renderExpirationTime);
       
 17861       }
       
 17862     }
       
 17863     workInProgress.stateNode = current$$1.stateNode;
       
 17864   }
       
 17865 
       
 17866   workInProgress.memoizedState = nextState;
       
 17867   workInProgress.child = child;
       
 17868   return next;
       
 17869 }
       
 17870 
       
 17871 function retrySuspenseComponentWithoutHydrating(current$$1, workInProgress, renderExpirationTime) {
       
 17872   // Detach from the current dehydrated boundary.
       
 17873   current$$1.alternate = null;
       
 17874   workInProgress.alternate = null;
       
 17875 
       
 17876   // Insert a deletion in the effect list.
       
 17877   var returnFiber = workInProgress.return;
       
 17878   (function () {
       
 17879     if (!(returnFiber !== null)) {
       
 17880       {
       
 17881         throw ReactError(Error('Suspense boundaries are never on the root. This is probably a bug in React.'));
       
 17882       }
       
 17883     }
       
 17884   })();
       
 17885   var last = returnFiber.lastEffect;
       
 17886   if (last !== null) {
       
 17887     last.nextEffect = current$$1;
       
 17888     returnFiber.lastEffect = current$$1;
       
 17889   } else {
       
 17890     returnFiber.firstEffect = returnFiber.lastEffect = current$$1;
       
 17891   }
       
 17892   current$$1.nextEffect = null;
       
 17893   current$$1.effectTag = Deletion;
       
 17894 
       
 17895   popSuspenseContext(workInProgress);
       
 17896 
       
 17897   // Upgrade this work in progress to a real Suspense component.
       
 17898   workInProgress.tag = SuspenseComponent;
       
 17899   workInProgress.stateNode = null;
       
 17900   workInProgress.memoizedState = null;
       
 17901   // This is now an insertion.
       
 17902   workInProgress.effectTag |= Placement;
       
 17903   // Retry as a real Suspense component.
       
 17904   return updateSuspenseComponent(null, workInProgress, renderExpirationTime);
       
 17905 }
       
 17906 
       
 17907 function updateDehydratedSuspenseComponent(current$$1, workInProgress, renderExpirationTime) {
       
 17908   pushSuspenseContext(workInProgress, setDefaultShallowSuspenseContext(suspenseStackCursor.current));
       
 17909   var suspenseInstance = workInProgress.stateNode;
       
 17910   if (current$$1 === null) {
       
 17911     // During the first pass, we'll bail out and not drill into the children.
       
 17912     // Instead, we'll leave the content in place and try to hydrate it later.
       
 17913     if (isSuspenseInstanceFallback(suspenseInstance)) {
       
 17914       // This is a client-only boundary. Since we won't get any content from the server
       
 17915       // for this, we need to schedule that at a higher priority based on when it would
       
 17916       // have timed out. In theory we could render it in this pass but it would have the
       
 17917       // wrong priority associated with it and will prevent hydration of parent path.
       
 17918       // Instead, we'll leave work left on it to render it in a separate commit.
       
 17919 
       
 17920       // TODO This time should be the time at which the server rendered response that is
       
 17921       // a parent to this boundary was displayed. However, since we currently don't have
       
 17922       // a protocol to transfer that time, we'll just estimate it by using the current
       
 17923       // time. This will mean that Suspense timeouts are slightly shifted to later than
       
 17924       // they should be.
       
 17925       var serverDisplayTime = requestCurrentTime();
       
 17926       // Schedule a normal pri update to render this content.
       
 17927       workInProgress.expirationTime = computeAsyncExpiration(serverDisplayTime);
       
 17928     } else {
       
 17929       // We'll continue hydrating the rest at offscreen priority since we'll already
       
 17930       // be showing the right content coming from the server, it is no rush.
       
 17931       workInProgress.expirationTime = Never;
       
 17932     }
       
 17933     return null;
       
 17934   }
       
 17935   if ((workInProgress.effectTag & DidCapture) !== NoEffect) {
       
 17936     // Something suspended. Leave the existing children in place.
       
 17937     // TODO: In non-concurrent mode, should we commit the nodes we have hydrated so far?
       
 17938     workInProgress.child = null;
       
 17939     return null;
       
 17940   }
       
 17941   if (isSuspenseInstanceFallback(suspenseInstance)) {
       
 17942     // This boundary is in a permanent fallback state. In this case, we'll never
       
 17943     // get an update and we'll never be able to hydrate the final content. Let's just try the
       
 17944     // client side render instead.
       
 17945     return retrySuspenseComponentWithoutHydrating(current$$1, workInProgress, renderExpirationTime);
       
 17946   }
       
 17947   // We use childExpirationTime to indicate that a child might depend on context, so if
       
 17948   // any context has changed, we need to treat is as if the input might have changed.
       
 17949   var hasContextChanged$$1 = current$$1.childExpirationTime >= renderExpirationTime;
       
 17950   if (didReceiveUpdate || hasContextChanged$$1) {
       
 17951     // This boundary has changed since the first render. This means that we are now unable to
       
 17952     // hydrate it. We might still be able to hydrate it using an earlier expiration time but
       
 17953     // during this render we can't. Instead, we're going to delete the whole subtree and
       
 17954     // instead inject a new real Suspense boundary to take its place, which may render content
       
 17955     // or fallback. The real Suspense boundary will suspend for a while so we have some time
       
 17956     // to ensure it can produce real content, but all state and pending events will be lost.
       
 17957     return retrySuspenseComponentWithoutHydrating(current$$1, workInProgress, renderExpirationTime);
       
 17958   } else if (isSuspenseInstancePending(suspenseInstance)) {
       
 17959     // This component is still pending more data from the server, so we can't hydrate its
       
 17960     // content. We treat it as if this component suspended itself. It might seem as if
       
 17961     // we could just try to render it client-side instead. However, this will perform a
       
 17962     // lot of unnecessary work and is unlikely to complete since it often will suspend
       
 17963     // on missing data anyway. Additionally, the server might be able to render more
       
 17964     // than we can on the client yet. In that case we'd end up with more fallback states
       
 17965     // on the client than if we just leave it alone. If the server times out or errors
       
 17966     // these should update this boundary to the permanent Fallback state instead.
       
 17967     // Mark it as having captured (i.e. suspended).
       
 17968     workInProgress.effectTag |= DidCapture;
       
 17969     // Leave the children in place. I.e. empty.
       
 17970     workInProgress.child = null;
       
 17971     // Register a callback to retry this boundary once the server has sent the result.
       
 17972     registerSuspenseInstanceRetry(suspenseInstance, retryTimedOutBoundary.bind(null, current$$1));
       
 17973     return null;
       
 17974   } else {
       
 17975     // This is the first attempt.
       
 17976     reenterHydrationStateFromDehydratedSuspenseInstance(workInProgress);
       
 17977     var nextProps = workInProgress.pendingProps;
       
 17978     var nextChildren = nextProps.children;
       
 17979     workInProgress.child = mountChildFibers(workInProgress, null, nextChildren, renderExpirationTime);
       
 17980     return workInProgress.child;
       
 17981   }
       
 17982 }
       
 17983 
       
 17984 function propagateSuspenseContextChange(workInProgress, firstChild, renderExpirationTime) {
       
 17985   // Mark any Suspense boundaries with fallbacks as having work to do.
       
 17986   // If they were previously forced into fallbacks, they may now be able
       
 17987   // to unblock.
       
 17988   var node = firstChild;
       
 17989   while (node !== null) {
       
 17990     if (node.tag === SuspenseComponent) {
       
 17991       var state = node.memoizedState;
       
 17992       if (state !== null) {
       
 17993         if (node.expirationTime < renderExpirationTime) {
       
 17994           node.expirationTime = renderExpirationTime;
       
 17995         }
       
 17996         var alternate = node.alternate;
       
 17997         if (alternate !== null && alternate.expirationTime < renderExpirationTime) {
       
 17998           alternate.expirationTime = renderExpirationTime;
       
 17999         }
       
 18000         scheduleWorkOnParentPath(node.return, renderExpirationTime);
       
 18001       }
       
 18002     } else if (node.child !== null) {
       
 18003       node.child.return = node;
       
 18004       node = node.child;
       
 18005       continue;
       
 18006     }
       
 18007     if (node === workInProgress) {
       
 18008       return;
       
 18009     }
       
 18010     while (node.sibling === null) {
       
 18011       if (node.return === null || node.return === workInProgress) {
       
 18012         return;
       
 18013       }
       
 18014       node = node.return;
       
 18015     }
       
 18016     node.sibling.return = node.return;
       
 18017     node = node.sibling;
       
 18018   }
       
 18019 }
       
 18020 
       
 18021 function findLastContentRow(firstChild) {
       
 18022   // This is going to find the last row among these children that is already
       
 18023   // showing content on the screen, as opposed to being in fallback state or
       
 18024   // new. If a row has multiple Suspense boundaries, any of them being in the
       
 18025   // fallback state, counts as the whole row being in a fallback state.
       
 18026   // Note that the "rows" will be workInProgress, but any nested children
       
 18027   // will still be current since we haven't rendered them yet. The mounted
       
 18028   // order may not be the same as the new order. We use the new order.
       
 18029   var row = firstChild;
       
 18030   var lastContentRow = null;
       
 18031   while (row !== null) {
       
 18032     var currentRow = row.alternate;
       
 18033     // New rows can't be content rows.
       
 18034     if (currentRow !== null && findFirstSuspended(currentRow) === null) {
       
 18035       lastContentRow = row;
       
 18036     }
       
 18037     row = row.sibling;
       
 18038   }
       
 18039   return lastContentRow;
       
 18040 }
       
 18041 
       
 18042 function validateRevealOrder(revealOrder) {
       
 18043   {
       
 18044     if (revealOrder !== undefined && revealOrder !== 'forwards' && revealOrder !== 'backwards' && revealOrder !== 'together' && !didWarnAboutRevealOrder[revealOrder]) {
       
 18045       didWarnAboutRevealOrder[revealOrder] = true;
       
 18046       if (typeof revealOrder === 'string') {
       
 18047         switch (revealOrder.toLowerCase()) {
       
 18048           case 'together':
       
 18049           case 'forwards':
       
 18050           case 'backwards':
       
 18051             {
       
 18052               warning$1(false, '"%s" is not a valid value for revealOrder on <SuspenseList />. ' + 'Use lowercase "%s" instead.', revealOrder, revealOrder.toLowerCase());
       
 18053               break;
       
 18054             }
 17968             }
 18055           case 'forward':
 17969           } // Because primaryChildFragment is a new fiber that we're inserting as the
 18056           case 'backward':
 17970           // parent of a new tree, we need to set its treeBaseDuration.
 18057             {
 17971 
 18058               warning$1(false, '"%s" is not a valid value for revealOrder on <SuspenseList />. ' + 'React uses the -s suffix in the spelling. Use "%ss" instead.', revealOrder, revealOrder.toLowerCase());
 17972 
 18059               break;
 17973           if ( workInProgress.mode & ProfileMode) {
       
 17974             // treeBaseDuration is the sum of all the child tree base durations.
       
 17975             var _treeBaseDuration2 = 0;
       
 17976             var _hiddenChild2 = _primaryChildFragment3.child;
       
 17977 
       
 17978             while (_hiddenChild2 !== null) {
       
 17979               _treeBaseDuration2 += _hiddenChild2.treeBaseDuration;
       
 17980               _hiddenChild2 = _hiddenChild2.sibling;
 18060             }
 17981             }
 18061           default:
 17982 
 18062             warning$1(false, '"%s" is not a supported revealOrder on <SuspenseList />. ' + 'Did you mean "together", "forwards" or "backwards"?', revealOrder);
 17983             _primaryChildFragment3.treeBaseDuration = _treeBaseDuration2;
 18063             break;
 17984           } // Create a fragment from the fallback children, too.
 18064         }
 17985 
 18065       } else {
 17986 
 18066         warning$1(false, '%s is not a supported value for revealOrder on <SuspenseList />. ' + 'Did you mean "together", "forwards" or "backwards"?', revealOrder);
 17987           var _fallbackChildFragment3 = createFiberFromFragment(_nextFallbackChildren3, mode, renderExpirationTime, null);
 18067       }
 17988 
 18068     }
 17989           _fallbackChildFragment3.return = workInProgress;
 18069   }
 17990           _primaryChildFragment3.sibling = _fallbackChildFragment3;
 18070 }
 17991           _fallbackChildFragment3.effectTag |= Placement;
 18071 
 17992           _primaryChildFragment3.childExpirationTime = NoWork; // Skip the primary children, and continue working on the
 18072 function validateTailOptions(tailMode, revealOrder) {
 17993           // fallback children.
 18073   {
 17994 
 18074     if (tailMode !== undefined && !didWarnAboutTailOptions[tailMode]) {
 17995           workInProgress.memoizedState = SUSPENDED_MARKER;
 18075       if (tailMode !== 'collapsed' && tailMode !== 'hidden') {
 17996           workInProgress.child = _primaryChildFragment3;
 18076         didWarnAboutTailOptions[tailMode] = true;
 17997           return _fallbackChildFragment3;
 18077         warning$1(false, '"%s" is not a supported value for tail on <SuspenseList />. ' + 'Did you mean "collapsed" or "hidden"?', tailMode);
       
 18078       } else if (revealOrder !== 'forwards' && revealOrder !== 'backwards') {
       
 18079         didWarnAboutTailOptions[tailMode] = true;
       
 18080         warning$1(false, '<SuspenseList tail="%s" /> is only valid if revealOrder is ' + '"forwards" or "backwards". ' + 'Did you mean to specify revealOrder="forwards"?', tailMode);
       
 18081       }
       
 18082     }
       
 18083   }
       
 18084 }
       
 18085 
       
 18086 function validateSuspenseListNestedChild(childSlot, index) {
       
 18087   {
       
 18088     var isArray = Array.isArray(childSlot);
       
 18089     var isIterable = !isArray && typeof getIteratorFn(childSlot) === 'function';
       
 18090     if (isArray || isIterable) {
       
 18091       var type = isArray ? 'array' : 'iterable';
       
 18092       warning$1(false, 'A nested %s was passed to row #%s in <SuspenseList />. Wrap it in ' + 'an additional SuspenseList to configure its revealOrder: ' + '<SuspenseList revealOrder=...> ... ' + '<SuspenseList revealOrder=...>{%s}</SuspenseList> ... ' + '</SuspenseList>', type, index, type);
       
 18093       return false;
       
 18094     }
       
 18095   }
       
 18096   return true;
       
 18097 }
       
 18098 
       
 18099 function validateSuspenseListChildren(children, revealOrder) {
       
 18100   {
       
 18101     if ((revealOrder === 'forwards' || revealOrder === 'backwards') && children !== undefined && children !== null && children !== false) {
       
 18102       if (Array.isArray(children)) {
       
 18103         for (var i = 0; i < children.length; i++) {
       
 18104           if (!validateSuspenseListNestedChild(children[i], i)) {
       
 18105             return;
       
 18106           }
       
 18107         }
       
 18108       } else {
       
 18109         var iteratorFn = getIteratorFn(children);
       
 18110         if (typeof iteratorFn === 'function') {
       
 18111           var childrenIterator = iteratorFn.call(children);
       
 18112           if (childrenIterator) {
       
 18113             var step = childrenIterator.next();
       
 18114             var _i = 0;
       
 18115             for (; !step.done; step = childrenIterator.next()) {
       
 18116               if (!validateSuspenseListNestedChild(step.value, _i)) {
       
 18117                 return;
       
 18118               }
       
 18119               _i++;
       
 18120             }
       
 18121           }
       
 18122         } else {
 17998         } else {
 18123           warning$1(false, 'A single row was passed to a <SuspenseList revealOrder="%s" />. ' + 'This is not useful since it needs multiple rows. ' + 'Did you mean to pass multiple children or an array?', revealOrder);
 17999           // Still haven't timed out. Continue rendering the children, like we
 18124         }
 18000           // normally do.
 18125       }
       
 18126     }
       
 18127   }
       
 18128 }
       
 18129 
       
 18130 function initSuspenseListRenderState(workInProgress, isBackwards, tail, lastContentRow, tailMode) {
       
 18131   var renderState = workInProgress.memoizedState;
       
 18132   if (renderState === null) {
       
 18133     workInProgress.memoizedState = {
       
 18134       isBackwards: isBackwards,
       
 18135       rendering: null,
       
 18136       last: lastContentRow,
       
 18137       tail: tail,
       
 18138       tailExpiration: 0,
       
 18139       tailMode: tailMode
       
 18140     };
       
 18141   } else {
       
 18142     // We can reuse the existing object from previous renders.
       
 18143     renderState.isBackwards = isBackwards;
       
 18144     renderState.rendering = null;
       
 18145     renderState.last = lastContentRow;
       
 18146     renderState.tail = tail;
       
 18147     renderState.tailExpiration = 0;
       
 18148     renderState.tailMode = tailMode;
       
 18149   }
       
 18150 }
       
 18151 
       
 18152 // This can end up rendering this component multiple passes.
       
 18153 // The first pass splits the children fibers into two sets. A head and tail.
       
 18154 // We first render the head. If anything is in fallback state, we do another
       
 18155 // pass through beginWork to rerender all children (including the tail) with
       
 18156 // the force suspend context. If the first render didn't have anything in
       
 18157 // in fallback state. Then we render each row in the tail one-by-one.
       
 18158 // That happens in the completeWork phase without going back to beginWork.
       
 18159 function updateSuspenseListComponent(current$$1, workInProgress, renderExpirationTime) {
       
 18160   var nextProps = workInProgress.pendingProps;
       
 18161   var revealOrder = nextProps.revealOrder;
       
 18162   var tailMode = nextProps.tail;
       
 18163   var newChildren = nextProps.children;
       
 18164 
       
 18165   validateRevealOrder(revealOrder);
       
 18166   validateTailOptions(tailMode, revealOrder);
       
 18167   validateSuspenseListChildren(newChildren, revealOrder);
       
 18168 
       
 18169   reconcileChildren(current$$1, workInProgress, newChildren, renderExpirationTime);
       
 18170 
       
 18171   var suspenseContext = suspenseStackCursor.current;
       
 18172 
       
 18173   var shouldForceFallback = hasSuspenseContext(suspenseContext, ForceSuspenseFallback);
       
 18174   if (shouldForceFallback) {
       
 18175     suspenseContext = setShallowSuspenseContext(suspenseContext, ForceSuspenseFallback);
       
 18176     workInProgress.effectTag |= DidCapture;
       
 18177   } else {
       
 18178     var didSuspendBefore = current$$1 !== null && (current$$1.effectTag & DidCapture) !== NoEffect;
       
 18179     if (didSuspendBefore) {
       
 18180       // If we previously forced a fallback, we need to schedule work
       
 18181       // on any nested boundaries to let them know to try to render
       
 18182       // again. This is the same as context updating.
       
 18183       propagateSuspenseContextChange(workInProgress, workInProgress.child, renderExpirationTime);
       
 18184     }
       
 18185     suspenseContext = setDefaultShallowSuspenseContext(suspenseContext);
       
 18186   }
       
 18187   pushSuspenseContext(workInProgress, suspenseContext);
       
 18188 
       
 18189   if ((workInProgress.mode & BatchedMode) === NoMode) {
       
 18190     // Outside of batched mode, SuspenseList doesn't work so we just
       
 18191     // use make it a noop by treating it as the default revealOrder.
       
 18192     workInProgress.memoizedState = null;
       
 18193   } else {
       
 18194     switch (revealOrder) {
       
 18195       case 'forwards':
       
 18196         {
       
 18197           var lastContentRow = findLastContentRow(workInProgress.child);
       
 18198           var tail = void 0;
       
 18199           if (lastContentRow === null) {
       
 18200             // The whole list is part of the tail.
       
 18201             // TODO: We could fast path by just rendering the tail now.
       
 18202             tail = workInProgress.child;
       
 18203             workInProgress.child = null;
       
 18204           } else {
       
 18205             // Disconnect the tail rows after the content row.
       
 18206             // We're going to render them separately later.
       
 18207             tail = lastContentRow.sibling;
       
 18208             lastContentRow.sibling = null;
       
 18209           }
       
 18210           initSuspenseListRenderState(workInProgress, false, // isBackwards
       
 18211           tail, lastContentRow, tailMode);
       
 18212           break;
       
 18213         }
       
 18214       case 'backwards':
       
 18215         {
       
 18216           // We're going to find the first row that has existing content.
       
 18217           // At the same time we're going to reverse the list of everything
       
 18218           // we pass in the meantime. That's going to be our tail in reverse
       
 18219           // order.
       
 18220           var _tail = null;
       
 18221           var row = workInProgress.child;
       
 18222           workInProgress.child = null;
       
 18223           while (row !== null) {
       
 18224             var currentRow = row.alternate;
       
 18225             // New rows can't be content rows.
       
 18226             if (currentRow !== null && findFirstSuspended(currentRow) === null) {
       
 18227               // This is the beginning of the main content.
       
 18228               workInProgress.child = row;
       
 18229               break;
       
 18230             }
       
 18231             var nextRow = row.sibling;
       
 18232             row.sibling = _tail;
       
 18233             _tail = row;
       
 18234             row = nextRow;
       
 18235           }
       
 18236           // TODO: If workInProgress.child is null, we can continue on the tail immediately.
       
 18237           initSuspenseListRenderState(workInProgress, true, // isBackwards
       
 18238           _tail, null, // last
       
 18239           tailMode);
       
 18240           break;
       
 18241         }
       
 18242       case 'together':
       
 18243         {
       
 18244           initSuspenseListRenderState(workInProgress, false, // isBackwards
       
 18245           null, // tail
       
 18246           null, // last
       
 18247           undefined);
       
 18248           break;
       
 18249         }
       
 18250       default:
       
 18251         {
       
 18252           // The default reveal order is the same as not having
       
 18253           // a boundary.
       
 18254           workInProgress.memoizedState = null;
 18001           workInProgress.memoizedState = null;
 18255         }
 18002           var _nextPrimaryChildren2 = nextProps.children;
 18256     }
 18003           return workInProgress.child = reconcileChildFibers(workInProgress, _currentPrimaryChild, _nextPrimaryChildren2, renderExpirationTime);
 18257   }
 18004         }
 18258   return workInProgress.child;
 18005       }
 18259 }
 18006     }
 18260 
 18007   }
 18261 function updatePortalComponent(current$$1, workInProgress, renderExpirationTime) {
 18008 
 18262   pushHostContainer(workInProgress, workInProgress.stateNode.containerInfo);
 18009   function scheduleWorkOnFiber(fiber, renderExpirationTime) {
 18263   var nextChildren = workInProgress.pendingProps;
 18010     if (fiber.expirationTime < renderExpirationTime) {
 18264   if (current$$1 === null) {
 18011       fiber.expirationTime = renderExpirationTime;
 18265     // Portals are special because we don't append the children during mount
 18012     }
 18266     // but at commit. Therefore we need to track insertions which the normal
 18013 
 18267     // flow doesn't do during mount. This doesn't happen at the root because
 18014     var alternate = fiber.alternate;
 18268     // the root always starts with a "current" with a null child.
 18015 
 18269     // TODO: Consider unifying this with how the root works.
 18016     if (alternate !== null && alternate.expirationTime < renderExpirationTime) {
 18270     workInProgress.child = reconcileChildFibers(workInProgress, null, nextChildren, renderExpirationTime);
 18017       alternate.expirationTime = renderExpirationTime;
 18271   } else {
 18018     }
 18272     reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
 18019 
 18273   }
 18020     scheduleWorkOnParentPath(fiber.return, renderExpirationTime);
 18274   return workInProgress.child;
 18021   }
 18275 }
 18022 
 18276 
 18023   function propagateSuspenseContextChange(workInProgress, firstChild, renderExpirationTime) {
 18277 function updateContextProvider(current$$1, workInProgress, renderExpirationTime) {
 18024     // Mark any Suspense boundaries with fallbacks as having work to do.
 18278   var providerType = workInProgress.type;
 18025     // If they were previously forced into fallbacks, they may now be able
 18279   var context = providerType._context;
 18026     // to unblock.
 18280 
 18027     var node = firstChild;
 18281   var newProps = workInProgress.pendingProps;
 18028 
 18282   var oldProps = workInProgress.memoizedProps;
       
 18283 
       
 18284   var newValue = newProps.value;
       
 18285 
       
 18286   {
       
 18287     var providerPropTypes = workInProgress.type.propTypes;
       
 18288 
       
 18289     if (providerPropTypes) {
       
 18290       checkPropTypes_1(providerPropTypes, newProps, 'prop', 'Context.Provider', getCurrentFiberStackInDev);
       
 18291     }
       
 18292   }
       
 18293 
       
 18294   pushProvider(workInProgress, newValue);
       
 18295 
       
 18296   if (oldProps !== null) {
       
 18297     var oldValue = oldProps.value;
       
 18298     var changedBits = calculateChangedBits(context, newValue, oldValue);
       
 18299     if (changedBits === 0) {
       
 18300       // No change. Bailout early if children are the same.
       
 18301       if (oldProps.children === newProps.children && !hasContextChanged()) {
       
 18302         return bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirationTime);
       
 18303       }
       
 18304     } else {
       
 18305       // The context value changed. Search for matching consumers and schedule
       
 18306       // them to update.
       
 18307       propagateContextChange(workInProgress, context, changedBits, renderExpirationTime);
       
 18308     }
       
 18309   }
       
 18310 
       
 18311   var newChildren = newProps.children;
       
 18312   reconcileChildren(current$$1, workInProgress, newChildren, renderExpirationTime);
       
 18313   return workInProgress.child;
       
 18314 }
       
 18315 
       
 18316 var hasWarnedAboutUsingContextAsConsumer = false;
       
 18317 
       
 18318 function updateContextConsumer(current$$1, workInProgress, renderExpirationTime) {
       
 18319   var context = workInProgress.type;
       
 18320   // The logic below for Context differs depending on PROD or DEV mode. In
       
 18321   // DEV mode, we create a separate object for Context.Consumer that acts
       
 18322   // like a proxy to Context. This proxy object adds unnecessary code in PROD
       
 18323   // so we use the old behaviour (Context.Consumer references Context) to
       
 18324   // reduce size and overhead. The separate object references context via
       
 18325   // a property called "_context", which also gives us the ability to check
       
 18326   // in DEV mode if this property exists or not and warn if it does not.
       
 18327   {
       
 18328     if (context._context === undefined) {
       
 18329       // This may be because it's a Context (rather than a Consumer).
       
 18330       // Or it may be because it's older React where they're the same thing.
       
 18331       // We only want to warn if we're sure it's a new React.
       
 18332       if (context !== context.Consumer) {
       
 18333         if (!hasWarnedAboutUsingContextAsConsumer) {
       
 18334           hasWarnedAboutUsingContextAsConsumer = true;
       
 18335           warning$1(false, 'Rendering <Context> directly is not supported and will be removed in ' + 'a future major release. Did you mean to render <Context.Consumer> instead?');
       
 18336         }
       
 18337       }
       
 18338     } else {
       
 18339       context = context._context;
       
 18340     }
       
 18341   }
       
 18342   var newProps = workInProgress.pendingProps;
       
 18343   var render = newProps.children;
       
 18344 
       
 18345   {
       
 18346     !(typeof render === 'function') ? warningWithoutStack$1(false, 'A context consumer was rendered with multiple children, or a child ' + "that isn't a function. A context consumer expects a single child " + 'that is a function. If you did pass a function, make sure there ' + 'is no trailing or leading whitespace around it.') : void 0;
       
 18347   }
       
 18348 
       
 18349   prepareToReadContext(workInProgress, renderExpirationTime);
       
 18350   var newValue = readContext(context, newProps.unstable_observedBits);
       
 18351   var newChildren = void 0;
       
 18352   {
       
 18353     ReactCurrentOwner$3.current = workInProgress;
       
 18354     setCurrentPhase('render');
       
 18355     newChildren = render(newValue);
       
 18356     setCurrentPhase(null);
       
 18357   }
       
 18358 
       
 18359   // React DevTools reads this flag.
       
 18360   workInProgress.effectTag |= PerformedWork;
       
 18361   reconcileChildren(current$$1, workInProgress, newChildren, renderExpirationTime);
       
 18362   return workInProgress.child;
       
 18363 }
       
 18364 
       
 18365 function updateFundamentalComponent$1(current$$1, workInProgress, renderExpirationTime) {
       
 18366   var fundamentalImpl = workInProgress.type.impl;
       
 18367   if (fundamentalImpl.reconcileChildren === false) {
       
 18368     return null;
       
 18369   }
       
 18370   var nextProps = workInProgress.pendingProps;
       
 18371   var nextChildren = nextProps.children;
       
 18372 
       
 18373   reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
       
 18374   return workInProgress.child;
       
 18375 }
       
 18376 
       
 18377 function markWorkInProgressReceivedUpdate() {
       
 18378   didReceiveUpdate = true;
       
 18379 }
       
 18380 
       
 18381 function bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirationTime) {
       
 18382   cancelWorkTimer(workInProgress);
       
 18383 
       
 18384   if (current$$1 !== null) {
       
 18385     // Reuse previous dependencies
       
 18386     workInProgress.dependencies = current$$1.dependencies;
       
 18387   }
       
 18388 
       
 18389   if (enableProfilerTimer) {
       
 18390     // Don't update "base" render times for bailouts.
       
 18391     stopProfilerTimerIfRunning(workInProgress);
       
 18392   }
       
 18393 
       
 18394   // Check if the children have any pending work.
       
 18395   var childExpirationTime = workInProgress.childExpirationTime;
       
 18396   if (childExpirationTime < renderExpirationTime) {
       
 18397     // The children don't have any work either. We can skip them.
       
 18398     // TODO: Once we add back resuming, we should check if the children are
       
 18399     // a work-in-progress set. If so, we need to transfer their effects.
       
 18400     return null;
       
 18401   } else {
       
 18402     // This fiber doesn't have work, but its subtree does. Clone the child
       
 18403     // fibers and continue.
       
 18404     cloneChildFibers(current$$1, workInProgress);
       
 18405     return workInProgress.child;
       
 18406   }
       
 18407 }
       
 18408 
       
 18409 function remountFiber(current$$1, oldWorkInProgress, newWorkInProgress) {
       
 18410   {
       
 18411     var returnFiber = oldWorkInProgress.return;
       
 18412     if (returnFiber === null) {
       
 18413       throw new Error('Cannot swap the root fiber.');
       
 18414     }
       
 18415 
       
 18416     // Disconnect from the old current.
       
 18417     // It will get deleted.
       
 18418     current$$1.alternate = null;
       
 18419     oldWorkInProgress.alternate = null;
       
 18420 
       
 18421     // Connect to the new tree.
       
 18422     newWorkInProgress.index = oldWorkInProgress.index;
       
 18423     newWorkInProgress.sibling = oldWorkInProgress.sibling;
       
 18424     newWorkInProgress.return = oldWorkInProgress.return;
       
 18425     newWorkInProgress.ref = oldWorkInProgress.ref;
       
 18426 
       
 18427     // Replace the child/sibling pointers above it.
       
 18428     if (oldWorkInProgress === returnFiber.child) {
       
 18429       returnFiber.child = newWorkInProgress;
       
 18430     } else {
       
 18431       var prevSibling = returnFiber.child;
       
 18432       if (prevSibling === null) {
       
 18433         throw new Error('Expected parent to have a child.');
       
 18434       }
       
 18435       while (prevSibling.sibling !== oldWorkInProgress) {
       
 18436         prevSibling = prevSibling.sibling;
       
 18437         if (prevSibling === null) {
       
 18438           throw new Error('Expected to find the previous sibling.');
       
 18439         }
       
 18440       }
       
 18441       prevSibling.sibling = newWorkInProgress;
       
 18442     }
       
 18443 
       
 18444     // Delete the old fiber and place the new one.
       
 18445     // Since the old fiber is disconnected, we have to schedule it manually.
       
 18446     var last = returnFiber.lastEffect;
       
 18447     if (last !== null) {
       
 18448       last.nextEffect = current$$1;
       
 18449       returnFiber.lastEffect = current$$1;
       
 18450     } else {
       
 18451       returnFiber.firstEffect = returnFiber.lastEffect = current$$1;
       
 18452     }
       
 18453     current$$1.nextEffect = null;
       
 18454     current$$1.effectTag = Deletion;
       
 18455 
       
 18456     newWorkInProgress.effectTag |= Placement;
       
 18457 
       
 18458     // Restart work from the new fiber.
       
 18459     return newWorkInProgress;
       
 18460   }
       
 18461 }
       
 18462 
       
 18463 function beginWork$1(current$$1, workInProgress, renderExpirationTime) {
       
 18464   var updateExpirationTime = workInProgress.expirationTime;
       
 18465 
       
 18466   {
       
 18467     if (workInProgress._debugNeedsRemount && current$$1 !== null) {
       
 18468       // This will restart the begin phase with a new fiber.
       
 18469       return remountFiber(current$$1, workInProgress, createFiberFromTypeAndProps(workInProgress.type, workInProgress.key, workInProgress.pendingProps, workInProgress._debugOwner || null, workInProgress.mode, workInProgress.expirationTime));
       
 18470     }
       
 18471   }
       
 18472 
       
 18473   if (current$$1 !== null) {
       
 18474     var oldProps = current$$1.memoizedProps;
       
 18475     var newProps = workInProgress.pendingProps;
       
 18476 
       
 18477     if (oldProps !== newProps || hasContextChanged() || (
       
 18478     // Force a re-render if the implementation changed due to hot reload:
       
 18479     workInProgress.type !== current$$1.type)) {
       
 18480       // If props or context changed, mark the fiber as having performed work.
       
 18481       // This may be unset if the props are determined to be equal later (memo).
       
 18482       didReceiveUpdate = true;
       
 18483     } else if (updateExpirationTime < renderExpirationTime) {
       
 18484       didReceiveUpdate = false;
       
 18485       // This fiber does not have any pending work. Bailout without entering
       
 18486       // the begin phase. There's still some bookkeeping we that needs to be done
       
 18487       // in this optimized path, mostly pushing stuff onto the stack.
       
 18488       switch (workInProgress.tag) {
       
 18489         case HostRoot:
       
 18490           pushHostRootContext(workInProgress);
       
 18491           resetHydrationState();
       
 18492           break;
       
 18493         case HostComponent:
       
 18494           pushHostContext(workInProgress);
       
 18495           if (workInProgress.mode & ConcurrentMode && renderExpirationTime !== Never && shouldDeprioritizeSubtree(workInProgress.type, newProps)) {
       
 18496             if (enableSchedulerTracing) {
       
 18497               markSpawnedWork(Never);
       
 18498             }
       
 18499             // Schedule this fiber to re-render at offscreen priority. Then bailout.
       
 18500             workInProgress.expirationTime = workInProgress.childExpirationTime = Never;
       
 18501             return null;
       
 18502           }
       
 18503           break;
       
 18504         case ClassComponent:
       
 18505           {
       
 18506             var Component = workInProgress.type;
       
 18507             if (isContextProvider(Component)) {
       
 18508               pushContextProvider(workInProgress);
       
 18509             }
       
 18510             break;
       
 18511           }
       
 18512         case HostPortal:
       
 18513           pushHostContainer(workInProgress, workInProgress.stateNode.containerInfo);
       
 18514           break;
       
 18515         case ContextProvider:
       
 18516           {
       
 18517             var newValue = workInProgress.memoizedProps.value;
       
 18518             pushProvider(workInProgress, newValue);
       
 18519             break;
       
 18520           }
       
 18521         case Profiler:
       
 18522           if (enableProfilerTimer) {
       
 18523             workInProgress.effectTag |= Update;
       
 18524           }
       
 18525           break;
       
 18526         case SuspenseComponent:
       
 18527           {
       
 18528             var state = workInProgress.memoizedState;
       
 18529             var didTimeout = state !== null;
       
 18530             if (didTimeout) {
       
 18531               // If this boundary is currently timed out, we need to decide
       
 18532               // whether to retry the primary children, or to skip over it and
       
 18533               // go straight to the fallback. Check the priority of the primary
       
 18534               var primaryChildFragment = workInProgress.child;
       
 18535               var primaryChildExpirationTime = primaryChildFragment.childExpirationTime;
       
 18536               if (primaryChildExpirationTime !== NoWork && primaryChildExpirationTime >= renderExpirationTime) {
       
 18537                 // The primary children have pending work. Use the normal path
       
 18538                 // to attempt to render the primary children again.
       
 18539                 return updateSuspenseComponent(current$$1, workInProgress, renderExpirationTime);
       
 18540               } else {
       
 18541                 pushSuspenseContext(workInProgress, setDefaultShallowSuspenseContext(suspenseStackCursor.current));
       
 18542                 // The primary children do not have pending work with sufficient
       
 18543                 // priority. Bailout.
       
 18544                 var child = bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirationTime);
       
 18545                 if (child !== null) {
       
 18546                   // The fallback children have pending work. Skip over the
       
 18547                   // primary children and work on the fallback.
       
 18548                   return child.sibling;
       
 18549                 } else {
       
 18550                   return null;
       
 18551                 }
       
 18552               }
       
 18553             } else {
       
 18554               pushSuspenseContext(workInProgress, setDefaultShallowSuspenseContext(suspenseStackCursor.current));
       
 18555             }
       
 18556             break;
       
 18557           }
       
 18558         case DehydratedSuspenseComponent:
       
 18559           {
       
 18560             if (enableSuspenseServerRenderer) {
       
 18561               pushSuspenseContext(workInProgress, setDefaultShallowSuspenseContext(suspenseStackCursor.current));
       
 18562               // We know that this component will suspend again because if it has
       
 18563               // been unsuspended it has committed as a regular Suspense component.
       
 18564               // If it needs to be retried, it should have work scheduled on it.
       
 18565               workInProgress.effectTag |= DidCapture;
       
 18566             }
       
 18567             break;
       
 18568           }
       
 18569         case SuspenseListComponent:
       
 18570           {
       
 18571             var didSuspendBefore = (current$$1.effectTag & DidCapture) !== NoEffect;
       
 18572 
       
 18573             var hasChildWork = workInProgress.childExpirationTime >= renderExpirationTime;
       
 18574 
       
 18575             if (didSuspendBefore) {
       
 18576               if (hasChildWork) {
       
 18577                 // If something was in fallback state last time, and we have all the
       
 18578                 // same children then we're still in progressive loading state.
       
 18579                 // Something might get unblocked by state updates or retries in the
       
 18580                 // tree which will affect the tail. So we need to use the normal
       
 18581                 // path to compute the correct tail.
       
 18582                 return updateSuspenseListComponent(current$$1, workInProgress, renderExpirationTime);
       
 18583               }
       
 18584               // If none of the children had any work, that means that none of
       
 18585               // them got retried so they'll still be blocked in the same way
       
 18586               // as before. We can fast bail out.
       
 18587               workInProgress.effectTag |= DidCapture;
       
 18588             }
       
 18589 
       
 18590             // If nothing suspended before and we're rendering the same children,
       
 18591             // then the tail doesn't matter. Anything new that suspends will work
       
 18592             // in the "together" mode, so we can continue from the state we had.
       
 18593             var renderState = workInProgress.memoizedState;
       
 18594             if (renderState !== null) {
       
 18595               // Reset to the "together" mode in case we've started a different
       
 18596               // update in the past but didn't complete it.
       
 18597               renderState.rendering = null;
       
 18598               renderState.tail = null;
       
 18599             }
       
 18600             pushSuspenseContext(workInProgress, suspenseStackCursor.current);
       
 18601 
       
 18602             if (hasChildWork) {
       
 18603               break;
       
 18604             } else {
       
 18605               // If none of the children had any work, that means that none of
       
 18606               // them got retried so they'll still be blocked in the same way
       
 18607               // as before. We can fast bail out.
       
 18608               return null;
       
 18609             }
       
 18610           }
       
 18611       }
       
 18612       return bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirationTime);
       
 18613     }
       
 18614   } else {
       
 18615     didReceiveUpdate = false;
       
 18616   }
       
 18617 
       
 18618   // Before entering the begin phase, clear the expiration time.
       
 18619   workInProgress.expirationTime = NoWork;
       
 18620 
       
 18621   switch (workInProgress.tag) {
       
 18622     case IndeterminateComponent:
       
 18623       {
       
 18624         return mountIndeterminateComponent(current$$1, workInProgress, workInProgress.type, renderExpirationTime);
       
 18625       }
       
 18626     case LazyComponent:
       
 18627       {
       
 18628         var elementType = workInProgress.elementType;
       
 18629         return mountLazyComponent(current$$1, workInProgress, elementType, updateExpirationTime, renderExpirationTime);
       
 18630       }
       
 18631     case FunctionComponent:
       
 18632       {
       
 18633         var _Component = workInProgress.type;
       
 18634         var unresolvedProps = workInProgress.pendingProps;
       
 18635         var resolvedProps = workInProgress.elementType === _Component ? unresolvedProps : resolveDefaultProps(_Component, unresolvedProps);
       
 18636         return updateFunctionComponent(current$$1, workInProgress, _Component, resolvedProps, renderExpirationTime);
       
 18637       }
       
 18638     case ClassComponent:
       
 18639       {
       
 18640         var _Component2 = workInProgress.type;
       
 18641         var _unresolvedProps = workInProgress.pendingProps;
       
 18642         var _resolvedProps = workInProgress.elementType === _Component2 ? _unresolvedProps : resolveDefaultProps(_Component2, _unresolvedProps);
       
 18643         return updateClassComponent(current$$1, workInProgress, _Component2, _resolvedProps, renderExpirationTime);
       
 18644       }
       
 18645     case HostRoot:
       
 18646       return updateHostRoot(current$$1, workInProgress, renderExpirationTime);
       
 18647     case HostComponent:
       
 18648       return updateHostComponent(current$$1, workInProgress, renderExpirationTime);
       
 18649     case HostText:
       
 18650       return updateHostText(current$$1, workInProgress);
       
 18651     case SuspenseComponent:
       
 18652       return updateSuspenseComponent(current$$1, workInProgress, renderExpirationTime);
       
 18653     case HostPortal:
       
 18654       return updatePortalComponent(current$$1, workInProgress, renderExpirationTime);
       
 18655     case ForwardRef:
       
 18656       {
       
 18657         var type = workInProgress.type;
       
 18658         var _unresolvedProps2 = workInProgress.pendingProps;
       
 18659         var _resolvedProps2 = workInProgress.elementType === type ? _unresolvedProps2 : resolveDefaultProps(type, _unresolvedProps2);
       
 18660         return updateForwardRef(current$$1, workInProgress, type, _resolvedProps2, renderExpirationTime);
       
 18661       }
       
 18662     case Fragment:
       
 18663       return updateFragment(current$$1, workInProgress, renderExpirationTime);
       
 18664     case Mode:
       
 18665       return updateMode(current$$1, workInProgress, renderExpirationTime);
       
 18666     case Profiler:
       
 18667       return updateProfiler(current$$1, workInProgress, renderExpirationTime);
       
 18668     case ContextProvider:
       
 18669       return updateContextProvider(current$$1, workInProgress, renderExpirationTime);
       
 18670     case ContextConsumer:
       
 18671       return updateContextConsumer(current$$1, workInProgress, renderExpirationTime);
       
 18672     case MemoComponent:
       
 18673       {
       
 18674         var _type2 = workInProgress.type;
       
 18675         var _unresolvedProps3 = workInProgress.pendingProps;
       
 18676         // Resolve outer props first, then resolve inner props.
       
 18677         var _resolvedProps3 = resolveDefaultProps(_type2, _unresolvedProps3);
       
 18678         {
       
 18679           if (workInProgress.type !== workInProgress.elementType) {
       
 18680             var outerPropTypes = _type2.propTypes;
       
 18681             if (outerPropTypes) {
       
 18682               checkPropTypes_1(outerPropTypes, _resolvedProps3, // Resolved for outer only
       
 18683               'prop', getComponentName(_type2), getCurrentFiberStackInDev);
       
 18684             }
       
 18685           }
       
 18686         }
       
 18687         _resolvedProps3 = resolveDefaultProps(_type2.type, _resolvedProps3);
       
 18688         return updateMemoComponent(current$$1, workInProgress, _type2, _resolvedProps3, updateExpirationTime, renderExpirationTime);
       
 18689       }
       
 18690     case SimpleMemoComponent:
       
 18691       {
       
 18692         return updateSimpleMemoComponent(current$$1, workInProgress, workInProgress.type, workInProgress.pendingProps, updateExpirationTime, renderExpirationTime);
       
 18693       }
       
 18694     case IncompleteClassComponent:
       
 18695       {
       
 18696         var _Component3 = workInProgress.type;
       
 18697         var _unresolvedProps4 = workInProgress.pendingProps;
       
 18698         var _resolvedProps4 = workInProgress.elementType === _Component3 ? _unresolvedProps4 : resolveDefaultProps(_Component3, _unresolvedProps4);
       
 18699         return mountIncompleteClassComponent(current$$1, workInProgress, _Component3, _resolvedProps4, renderExpirationTime);
       
 18700       }
       
 18701     case DehydratedSuspenseComponent:
       
 18702       {
       
 18703         if (enableSuspenseServerRenderer) {
       
 18704           return updateDehydratedSuspenseComponent(current$$1, workInProgress, renderExpirationTime);
       
 18705         }
       
 18706         break;
       
 18707       }
       
 18708     case SuspenseListComponent:
       
 18709       {
       
 18710         return updateSuspenseListComponent(current$$1, workInProgress, renderExpirationTime);
       
 18711       }
       
 18712     case FundamentalComponent:
       
 18713       {
       
 18714         if (enableFundamentalAPI) {
       
 18715           return updateFundamentalComponent$1(current$$1, workInProgress, renderExpirationTime);
       
 18716         }
       
 18717         break;
       
 18718       }
       
 18719   }
       
 18720   (function () {
       
 18721     {
       
 18722       {
       
 18723         throw ReactError(Error('Unknown unit of work tag. This error is likely caused by a bug in React. Please file an issue.'));
       
 18724       }
       
 18725     }
       
 18726   })();
       
 18727 }
       
 18728 
       
 18729 function createFundamentalStateInstance(currentFiber, props, impl, state) {
       
 18730   return {
       
 18731     currentFiber: currentFiber,
       
 18732     impl: impl,
       
 18733     instance: null,
       
 18734     prevProps: null,
       
 18735     props: props,
       
 18736     state: state
       
 18737   };
       
 18738 }
       
 18739 
       
 18740 var emptyObject = {};
       
 18741 var isArray$2 = Array.isArray;
       
 18742 
       
 18743 function markUpdate(workInProgress) {
       
 18744   // Tag the fiber with an update effect. This turns a Placement into
       
 18745   // a PlacementAndUpdate.
       
 18746   workInProgress.effectTag |= Update;
       
 18747 }
       
 18748 
       
 18749 function markRef$1(workInProgress) {
       
 18750   workInProgress.effectTag |= Ref;
       
 18751 }
       
 18752 
       
 18753 var appendAllChildren = void 0;
       
 18754 var updateHostContainer = void 0;
       
 18755 var updateHostComponent$1 = void 0;
       
 18756 var updateHostText$1 = void 0;
       
 18757 if (supportsMutation) {
       
 18758   // Mutation mode
       
 18759 
       
 18760   appendAllChildren = function (parent, workInProgress, needsVisibilityToggle, isHidden) {
       
 18761     // We only have the top Fiber that was created but we need recurse down its
       
 18762     // children to find all the terminal nodes.
       
 18763     var node = workInProgress.child;
       
 18764     while (node !== null) {
 18029     while (node !== null) {
 18765       if (node.tag === HostComponent || node.tag === HostText) {
 18030       if (node.tag === SuspenseComponent) {
 18766         appendInitialChild(parent, node.stateNode);
 18031         var state = node.memoizedState;
 18767       } else if (node.tag === FundamentalComponent) {
 18032 
 18768         appendInitialChild(parent, node.stateNode.instance);
 18033         if (state !== null) {
 18769       } else if (node.tag === HostPortal) {
 18034           scheduleWorkOnFiber(node, renderExpirationTime);
 18770         // If we have a portal child, then we don't want to traverse
 18035         }
 18771         // down its children. Instead, we'll get insertions from each child in
 18036       } else if (node.tag === SuspenseListComponent) {
 18772         // the portal directly.
 18037         // If the tail is hidden there might not be an Suspense boundaries
       
 18038         // to schedule work on. In this case we have to schedule it on the
       
 18039         // list itself.
       
 18040         // We don't have to traverse to the children of the list since
       
 18041         // the list will propagate the change when it rerenders.
       
 18042         scheduleWorkOnFiber(node, renderExpirationTime);
 18773       } else if (node.child !== null) {
 18043       } else if (node.child !== null) {
 18774         node.child.return = node;
 18044         node.child.return = node;
 18775         node = node.child;
 18045         node = node.child;
 18776         continue;
 18046         continue;
 18777       }
 18047       }
       
 18048 
 18778       if (node === workInProgress) {
 18049       if (node === workInProgress) {
 18779         return;
 18050         return;
 18780       }
 18051       }
       
 18052 
 18781       while (node.sibling === null) {
 18053       while (node.sibling === null) {
 18782         if (node.return === null || node.return === workInProgress) {
 18054         if (node.return === null || node.return === workInProgress) {
 18783           return;
 18055           return;
 18784         }
 18056         }
       
 18057 
 18785         node = node.return;
 18058         node = node.return;
 18786       }
 18059       }
       
 18060 
 18787       node.sibling.return = node.return;
 18061       node.sibling.return = node.return;
 18788       node = node.sibling;
 18062       node = node.sibling;
 18789     }
 18063     }
 18790   };
 18064   }
 18791 
 18065 
 18792   updateHostContainer = function (workInProgress) {
 18066   function findLastContentRow(firstChild) {
 18793     // Noop
 18067     // This is going to find the last row among these children that is already
 18794   };
 18068     // showing content on the screen, as opposed to being in fallback state or
 18795   updateHostComponent$1 = function (current, workInProgress, type, newProps, rootContainerInstance) {
 18069     // new. If a row has multiple Suspense boundaries, any of them being in the
 18796     // If we have an alternate, that means this is an update and we need to
 18070     // fallback state, counts as the whole row being in a fallback state.
 18797     // schedule a side-effect to do the updates.
 18071     // Note that the "rows" will be workInProgress, but any nested children
 18798     var oldProps = current.memoizedProps;
 18072     // will still be current since we haven't rendered them yet. The mounted
 18799     if (oldProps === newProps) {
 18073     // order may not be the same as the new order. We use the new order.
 18800       // In mutation mode, this is sufficient for a bailout because
 18074     var row = firstChild;
 18801       // we won't touch this node even if children changed.
 18075     var lastContentRow = null;
 18802       return;
 18076 
 18803     }
 18077     while (row !== null) {
 18804 
 18078       var currentRow = row.alternate; // New rows can't be content rows.
 18805     // If we get updated because one of our children updated, we don't
 18079 
 18806     // have newProps so we'll have to reuse them.
 18080       if (currentRow !== null && findFirstSuspended(currentRow) === null) {
 18807     // TODO: Split the update API as separate for the props vs. children.
 18081         lastContentRow = row;
 18808     // Even better would be if children weren't special cased at all tho.
 18082       }
 18809     var instance = workInProgress.stateNode;
 18083 
 18810     var currentHostContext = getHostContext();
 18084       row = row.sibling;
 18811     // TODO: Experiencing an error where oldProps is null. Suggests a host
 18085     }
 18812     // component is hitting the resume path. Figure out why. Possibly
 18086 
 18813     // related to `hidden`.
 18087     return lastContentRow;
 18814     var updatePayload = prepareUpdate(instance, type, oldProps, newProps, rootContainerInstance, currentHostContext);
 18088   }
 18815     // TODO: Type this specific to this type of component.
 18089 
 18816     workInProgress.updateQueue = updatePayload;
 18090   function validateRevealOrder(revealOrder) {
 18817     // If the update payload indicates that there is a change or if there
 18091     {
 18818     // is a new ref we mark this as an update. All the work is done in commitWork.
 18092       if (revealOrder !== undefined && revealOrder !== 'forwards' && revealOrder !== 'backwards' && revealOrder !== 'together' && !didWarnAboutRevealOrder[revealOrder]) {
 18819     if (updatePayload) {
 18093         didWarnAboutRevealOrder[revealOrder] = true;
 18820       markUpdate(workInProgress);
 18094 
 18821     }
 18095         if (typeof revealOrder === 'string') {
 18822   };
 18096           switch (revealOrder.toLowerCase()) {
 18823   updateHostText$1 = function (current, workInProgress, oldText, newText) {
 18097             case 'together':
 18824     // If the text differs, mark it as an update. All the work in done in commitWork.
 18098             case 'forwards':
 18825     if (oldText !== newText) {
 18099             case 'backwards':
 18826       markUpdate(workInProgress);
 18100               {
 18827     }
 18101                 error('"%s" is not a valid value for revealOrder on <SuspenseList />. ' + 'Use lowercase "%s" instead.', revealOrder, revealOrder.toLowerCase());
 18828   };
 18102 
 18829 } else if (supportsPersistence) {
 18103                 break;
 18830   // Persistent host tree mode
       
 18831 
       
 18832   appendAllChildren = function (parent, workInProgress, needsVisibilityToggle, isHidden) {
       
 18833     // We only have the top Fiber that was created but we need recurse down its
       
 18834     // children to find all the terminal nodes.
       
 18835     var node = workInProgress.child;
       
 18836     while (node !== null) {
       
 18837       // eslint-disable-next-line no-labels
       
 18838       branches: if (node.tag === HostComponent) {
       
 18839         var instance = node.stateNode;
       
 18840         if (needsVisibilityToggle && isHidden) {
       
 18841           // This child is inside a timed out tree. Hide it.
       
 18842           var props = node.memoizedProps;
       
 18843           var type = node.type;
       
 18844           instance = cloneHiddenInstance(instance, type, props, node);
       
 18845         }
       
 18846         appendInitialChild(parent, instance);
       
 18847       } else if (node.tag === HostText) {
       
 18848         var _instance = node.stateNode;
       
 18849         if (needsVisibilityToggle && isHidden) {
       
 18850           // This child is inside a timed out tree. Hide it.
       
 18851           var text = node.memoizedProps;
       
 18852           _instance = cloneHiddenTextInstance(_instance, text, node);
       
 18853         }
       
 18854         appendInitialChild(parent, _instance);
       
 18855       } else if (enableFundamentalAPI && node.tag === FundamentalComponent) {
       
 18856         var _instance2 = node.stateNode.instance;
       
 18857         if (needsVisibilityToggle && isHidden) {
       
 18858           // This child is inside a timed out tree. Hide it.
       
 18859           var _props = node.memoizedProps;
       
 18860           var _type = node.type;
       
 18861           _instance2 = cloneHiddenInstance(_instance2, _type, _props, node);
       
 18862         }
       
 18863         appendInitialChild(parent, _instance2);
       
 18864       } else if (node.tag === HostPortal) {
       
 18865         // If we have a portal child, then we don't want to traverse
       
 18866         // down its children. Instead, we'll get insertions from each child in
       
 18867         // the portal directly.
       
 18868       } else if (node.tag === SuspenseComponent) {
       
 18869         if ((node.effectTag & Update) !== NoEffect) {
       
 18870           // Need to toggle the visibility of the primary children.
       
 18871           var newIsHidden = node.memoizedState !== null;
       
 18872           if (newIsHidden) {
       
 18873             var primaryChildParent = node.child;
       
 18874             if (primaryChildParent !== null) {
       
 18875               if (primaryChildParent.child !== null) {
       
 18876                 primaryChildParent.child.return = primaryChildParent;
       
 18877                 appendAllChildren(parent, primaryChildParent, true, newIsHidden);
       
 18878               }
 18104               }
 18879               var fallbackChildParent = primaryChildParent.sibling;
 18105 
 18880               if (fallbackChildParent !== null) {
 18106             case 'forward':
 18881                 fallbackChildParent.return = node;
 18107             case 'backward':
 18882                 node = fallbackChildParent;
 18108               {
 18883                 continue;
 18109                 error('"%s" is not a valid value for revealOrder on <SuspenseList />. ' + 'React uses the -s suffix in the spelling. Use "%ss" instead.', revealOrder, revealOrder.toLowerCase());
       
 18110 
       
 18111                 break;
       
 18112               }
       
 18113 
       
 18114             default:
       
 18115               error('"%s" is not a supported revealOrder on <SuspenseList />. ' + 'Did you mean "together", "forwards" or "backwards"?', revealOrder);
       
 18116 
       
 18117               break;
       
 18118           }
       
 18119         } else {
       
 18120           error('%s is not a supported value for revealOrder on <SuspenseList />. ' + 'Did you mean "together", "forwards" or "backwards"?', revealOrder);
       
 18121         }
       
 18122       }
       
 18123     }
       
 18124   }
       
 18125 
       
 18126   function validateTailOptions(tailMode, revealOrder) {
       
 18127     {
       
 18128       if (tailMode !== undefined && !didWarnAboutTailOptions[tailMode]) {
       
 18129         if (tailMode !== 'collapsed' && tailMode !== 'hidden') {
       
 18130           didWarnAboutTailOptions[tailMode] = true;
       
 18131 
       
 18132           error('"%s" is not a supported value for tail on <SuspenseList />. ' + 'Did you mean "collapsed" or "hidden"?', tailMode);
       
 18133         } else if (revealOrder !== 'forwards' && revealOrder !== 'backwards') {
       
 18134           didWarnAboutTailOptions[tailMode] = true;
       
 18135 
       
 18136           error('<SuspenseList tail="%s" /> is only valid if revealOrder is ' + '"forwards" or "backwards". ' + 'Did you mean to specify revealOrder="forwards"?', tailMode);
       
 18137         }
       
 18138       }
       
 18139     }
       
 18140   }
       
 18141 
       
 18142   function validateSuspenseListNestedChild(childSlot, index) {
       
 18143     {
       
 18144       var isArray = Array.isArray(childSlot);
       
 18145       var isIterable = !isArray && typeof getIteratorFn(childSlot) === 'function';
       
 18146 
       
 18147       if (isArray || isIterable) {
       
 18148         var type = isArray ? 'array' : 'iterable';
       
 18149 
       
 18150         error('A nested %s was passed to row #%s in <SuspenseList />. Wrap it in ' + 'an additional SuspenseList to configure its revealOrder: ' + '<SuspenseList revealOrder=...> ... ' + '<SuspenseList revealOrder=...>{%s}</SuspenseList> ... ' + '</SuspenseList>', type, index, type);
       
 18151 
       
 18152         return false;
       
 18153       }
       
 18154     }
       
 18155 
       
 18156     return true;
       
 18157   }
       
 18158 
       
 18159   function validateSuspenseListChildren(children, revealOrder) {
       
 18160     {
       
 18161       if ((revealOrder === 'forwards' || revealOrder === 'backwards') && children !== undefined && children !== null && children !== false) {
       
 18162         if (Array.isArray(children)) {
       
 18163           for (var i = 0; i < children.length; i++) {
       
 18164             if (!validateSuspenseListNestedChild(children[i], i)) {
       
 18165               return;
       
 18166             }
       
 18167           }
       
 18168         } else {
       
 18169           var iteratorFn = getIteratorFn(children);
       
 18170 
       
 18171           if (typeof iteratorFn === 'function') {
       
 18172             var childrenIterator = iteratorFn.call(children);
       
 18173 
       
 18174             if (childrenIterator) {
       
 18175               var step = childrenIterator.next();
       
 18176               var _i = 0;
       
 18177 
       
 18178               for (; !step.done; step = childrenIterator.next()) {
       
 18179                 if (!validateSuspenseListNestedChild(step.value, _i)) {
       
 18180                   return;
       
 18181                 }
       
 18182 
       
 18183                 _i++;
       
 18184               }
       
 18185             }
       
 18186           } else {
       
 18187             error('A single row was passed to a <SuspenseList revealOrder="%s" />. ' + 'This is not useful since it needs multiple rows. ' + 'Did you mean to pass multiple children or an array?', revealOrder);
       
 18188           }
       
 18189         }
       
 18190       }
       
 18191     }
       
 18192   }
       
 18193 
       
 18194   function initSuspenseListRenderState(workInProgress, isBackwards, tail, lastContentRow, tailMode, lastEffectBeforeRendering) {
       
 18195     var renderState = workInProgress.memoizedState;
       
 18196 
       
 18197     if (renderState === null) {
       
 18198       workInProgress.memoizedState = {
       
 18199         isBackwards: isBackwards,
       
 18200         rendering: null,
       
 18201         renderingStartTime: 0,
       
 18202         last: lastContentRow,
       
 18203         tail: tail,
       
 18204         tailExpiration: 0,
       
 18205         tailMode: tailMode,
       
 18206         lastEffect: lastEffectBeforeRendering
       
 18207       };
       
 18208     } else {
       
 18209       // We can reuse the existing object from previous renders.
       
 18210       renderState.isBackwards = isBackwards;
       
 18211       renderState.rendering = null;
       
 18212       renderState.renderingStartTime = 0;
       
 18213       renderState.last = lastContentRow;
       
 18214       renderState.tail = tail;
       
 18215       renderState.tailExpiration = 0;
       
 18216       renderState.tailMode = tailMode;
       
 18217       renderState.lastEffect = lastEffectBeforeRendering;
       
 18218     }
       
 18219   } // This can end up rendering this component multiple passes.
       
 18220   // The first pass splits the children fibers into two sets. A head and tail.
       
 18221   // We first render the head. If anything is in fallback state, we do another
       
 18222   // pass through beginWork to rerender all children (including the tail) with
       
 18223   // the force suspend context. If the first render didn't have anything in
       
 18224   // in fallback state. Then we render each row in the tail one-by-one.
       
 18225   // That happens in the completeWork phase without going back to beginWork.
       
 18226 
       
 18227 
       
 18228   function updateSuspenseListComponent(current, workInProgress, renderExpirationTime) {
       
 18229     var nextProps = workInProgress.pendingProps;
       
 18230     var revealOrder = nextProps.revealOrder;
       
 18231     var tailMode = nextProps.tail;
       
 18232     var newChildren = nextProps.children;
       
 18233     validateRevealOrder(revealOrder);
       
 18234     validateTailOptions(tailMode, revealOrder);
       
 18235     validateSuspenseListChildren(newChildren, revealOrder);
       
 18236     reconcileChildren(current, workInProgress, newChildren, renderExpirationTime);
       
 18237     var suspenseContext = suspenseStackCursor.current;
       
 18238     var shouldForceFallback = hasSuspenseContext(suspenseContext, ForceSuspenseFallback);
       
 18239 
       
 18240     if (shouldForceFallback) {
       
 18241       suspenseContext = setShallowSuspenseContext(suspenseContext, ForceSuspenseFallback);
       
 18242       workInProgress.effectTag |= DidCapture;
       
 18243     } else {
       
 18244       var didSuspendBefore = current !== null && (current.effectTag & DidCapture) !== NoEffect;
       
 18245 
       
 18246       if (didSuspendBefore) {
       
 18247         // If we previously forced a fallback, we need to schedule work
       
 18248         // on any nested boundaries to let them know to try to render
       
 18249         // again. This is the same as context updating.
       
 18250         propagateSuspenseContextChange(workInProgress, workInProgress.child, renderExpirationTime);
       
 18251       }
       
 18252 
       
 18253       suspenseContext = setDefaultShallowSuspenseContext(suspenseContext);
       
 18254     }
       
 18255 
       
 18256     pushSuspenseContext(workInProgress, suspenseContext);
       
 18257 
       
 18258     if ((workInProgress.mode & BlockingMode) === NoMode) {
       
 18259       // Outside of blocking mode, SuspenseList doesn't work so we just
       
 18260       // use make it a noop by treating it as the default revealOrder.
       
 18261       workInProgress.memoizedState = null;
       
 18262     } else {
       
 18263       switch (revealOrder) {
       
 18264         case 'forwards':
       
 18265           {
       
 18266             var lastContentRow = findLastContentRow(workInProgress.child);
       
 18267             var tail;
       
 18268 
       
 18269             if (lastContentRow === null) {
       
 18270               // The whole list is part of the tail.
       
 18271               // TODO: We could fast path by just rendering the tail now.
       
 18272               tail = workInProgress.child;
       
 18273               workInProgress.child = null;
       
 18274             } else {
       
 18275               // Disconnect the tail rows after the content row.
       
 18276               // We're going to render them separately later.
       
 18277               tail = lastContentRow.sibling;
       
 18278               lastContentRow.sibling = null;
       
 18279             }
       
 18280 
       
 18281             initSuspenseListRenderState(workInProgress, false, // isBackwards
       
 18282             tail, lastContentRow, tailMode, workInProgress.lastEffect);
       
 18283             break;
       
 18284           }
       
 18285 
       
 18286         case 'backwards':
       
 18287           {
       
 18288             // We're going to find the first row that has existing content.
       
 18289             // At the same time we're going to reverse the list of everything
       
 18290             // we pass in the meantime. That's going to be our tail in reverse
       
 18291             // order.
       
 18292             var _tail = null;
       
 18293             var row = workInProgress.child;
       
 18294             workInProgress.child = null;
       
 18295 
       
 18296             while (row !== null) {
       
 18297               var currentRow = row.alternate; // New rows can't be content rows.
       
 18298 
       
 18299               if (currentRow !== null && findFirstSuspended(currentRow) === null) {
       
 18300                 // This is the beginning of the main content.
       
 18301                 workInProgress.child = row;
       
 18302                 break;
       
 18303               }
       
 18304 
       
 18305               var nextRow = row.sibling;
       
 18306               row.sibling = _tail;
       
 18307               _tail = row;
       
 18308               row = nextRow;
       
 18309             } // TODO: If workInProgress.child is null, we can continue on the tail immediately.
       
 18310 
       
 18311 
       
 18312             initSuspenseListRenderState(workInProgress, true, // isBackwards
       
 18313             _tail, null, // last
       
 18314             tailMode, workInProgress.lastEffect);
       
 18315             break;
       
 18316           }
       
 18317 
       
 18318         case 'together':
       
 18319           {
       
 18320             initSuspenseListRenderState(workInProgress, false, // isBackwards
       
 18321             null, // tail
       
 18322             null, // last
       
 18323             undefined, workInProgress.lastEffect);
       
 18324             break;
       
 18325           }
       
 18326 
       
 18327         default:
       
 18328           {
       
 18329             // The default reveal order is the same as not having
       
 18330             // a boundary.
       
 18331             workInProgress.memoizedState = null;
       
 18332           }
       
 18333       }
       
 18334     }
       
 18335 
       
 18336     return workInProgress.child;
       
 18337   }
       
 18338 
       
 18339   function updatePortalComponent(current, workInProgress, renderExpirationTime) {
       
 18340     pushHostContainer(workInProgress, workInProgress.stateNode.containerInfo);
       
 18341     var nextChildren = workInProgress.pendingProps;
       
 18342 
       
 18343     if (current === null) {
       
 18344       // Portals are special because we don't append the children during mount
       
 18345       // but at commit. Therefore we need to track insertions which the normal
       
 18346       // flow doesn't do during mount. This doesn't happen at the root because
       
 18347       // the root always starts with a "current" with a null child.
       
 18348       // TODO: Consider unifying this with how the root works.
       
 18349       workInProgress.child = reconcileChildFibers(workInProgress, null, nextChildren, renderExpirationTime);
       
 18350     } else {
       
 18351       reconcileChildren(current, workInProgress, nextChildren, renderExpirationTime);
       
 18352     }
       
 18353 
       
 18354     return workInProgress.child;
       
 18355   }
       
 18356 
       
 18357   function updateContextProvider(current, workInProgress, renderExpirationTime) {
       
 18358     var providerType = workInProgress.type;
       
 18359     var context = providerType._context;
       
 18360     var newProps = workInProgress.pendingProps;
       
 18361     var oldProps = workInProgress.memoizedProps;
       
 18362     var newValue = newProps.value;
       
 18363 
       
 18364     {
       
 18365       var providerPropTypes = workInProgress.type.propTypes;
       
 18366 
       
 18367       if (providerPropTypes) {
       
 18368         checkPropTypes_1(providerPropTypes, newProps, 'prop', 'Context.Provider', getCurrentFiberStackInDev);
       
 18369       }
       
 18370     }
       
 18371 
       
 18372     pushProvider(workInProgress, newValue);
       
 18373 
       
 18374     if (oldProps !== null) {
       
 18375       var oldValue = oldProps.value;
       
 18376       var changedBits = calculateChangedBits(context, newValue, oldValue);
       
 18377 
       
 18378       if (changedBits === 0) {
       
 18379         // No change. Bailout early if children are the same.
       
 18380         if (oldProps.children === newProps.children && !hasContextChanged()) {
       
 18381           return bailoutOnAlreadyFinishedWork(current, workInProgress, renderExpirationTime);
       
 18382         }
       
 18383       } else {
       
 18384         // The context value changed. Search for matching consumers and schedule
       
 18385         // them to update.
       
 18386         propagateContextChange(workInProgress, context, changedBits, renderExpirationTime);
       
 18387       }
       
 18388     }
       
 18389 
       
 18390     var newChildren = newProps.children;
       
 18391     reconcileChildren(current, workInProgress, newChildren, renderExpirationTime);
       
 18392     return workInProgress.child;
       
 18393   }
       
 18394 
       
 18395   var hasWarnedAboutUsingContextAsConsumer = false;
       
 18396 
       
 18397   function updateContextConsumer(current, workInProgress, renderExpirationTime) {
       
 18398     var context = workInProgress.type; // The logic below for Context differs depending on PROD or DEV mode. In
       
 18399     // DEV mode, we create a separate object for Context.Consumer that acts
       
 18400     // like a proxy to Context. This proxy object adds unnecessary code in PROD
       
 18401     // so we use the old behaviour (Context.Consumer references Context) to
       
 18402     // reduce size and overhead. The separate object references context via
       
 18403     // a property called "_context", which also gives us the ability to check
       
 18404     // in DEV mode if this property exists or not and warn if it does not.
       
 18405 
       
 18406     {
       
 18407       if (context._context === undefined) {
       
 18408         // This may be because it's a Context (rather than a Consumer).
       
 18409         // Or it may be because it's older React where they're the same thing.
       
 18410         // We only want to warn if we're sure it's a new React.
       
 18411         if (context !== context.Consumer) {
       
 18412           if (!hasWarnedAboutUsingContextAsConsumer) {
       
 18413             hasWarnedAboutUsingContextAsConsumer = true;
       
 18414 
       
 18415             error('Rendering <Context> directly is not supported and will be removed in ' + 'a future major release. Did you mean to render <Context.Consumer> instead?');
       
 18416           }
       
 18417         }
       
 18418       } else {
       
 18419         context = context._context;
       
 18420       }
       
 18421     }
       
 18422 
       
 18423     var newProps = workInProgress.pendingProps;
       
 18424     var render = newProps.children;
       
 18425 
       
 18426     {
       
 18427       if (typeof render !== 'function') {
       
 18428         error('A context consumer was rendered with multiple children, or a child ' + "that isn't a function. A context consumer expects a single child " + 'that is a function. If you did pass a function, make sure there ' + 'is no trailing or leading whitespace around it.');
       
 18429       }
       
 18430     }
       
 18431 
       
 18432     prepareToReadContext(workInProgress, renderExpirationTime);
       
 18433     var newValue = readContext(context, newProps.unstable_observedBits);
       
 18434     var newChildren;
       
 18435 
       
 18436     {
       
 18437       ReactCurrentOwner$1.current = workInProgress;
       
 18438       setIsRendering(true);
       
 18439       newChildren = render(newValue);
       
 18440       setIsRendering(false);
       
 18441     } // React DevTools reads this flag.
       
 18442 
       
 18443 
       
 18444     workInProgress.effectTag |= PerformedWork;
       
 18445     reconcileChildren(current, workInProgress, newChildren, renderExpirationTime);
       
 18446     return workInProgress.child;
       
 18447   }
       
 18448 
       
 18449   function markWorkInProgressReceivedUpdate() {
       
 18450     didReceiveUpdate = true;
       
 18451   }
       
 18452 
       
 18453   function bailoutOnAlreadyFinishedWork(current, workInProgress, renderExpirationTime) {
       
 18454     cancelWorkTimer(workInProgress);
       
 18455 
       
 18456     if (current !== null) {
       
 18457       // Reuse previous dependencies
       
 18458       workInProgress.dependencies = current.dependencies;
       
 18459     }
       
 18460 
       
 18461     {
       
 18462       // Don't update "base" render times for bailouts.
       
 18463       stopProfilerTimerIfRunning();
       
 18464     }
       
 18465 
       
 18466     var updateExpirationTime = workInProgress.expirationTime;
       
 18467 
       
 18468     if (updateExpirationTime !== NoWork) {
       
 18469       markUnprocessedUpdateTime(updateExpirationTime);
       
 18470     } // Check if the children have any pending work.
       
 18471 
       
 18472 
       
 18473     var childExpirationTime = workInProgress.childExpirationTime;
       
 18474 
       
 18475     if (childExpirationTime < renderExpirationTime) {
       
 18476       // The children don't have any work either. We can skip them.
       
 18477       // TODO: Once we add back resuming, we should check if the children are
       
 18478       // a work-in-progress set. If so, we need to transfer their effects.
       
 18479       return null;
       
 18480     } else {
       
 18481       // This fiber doesn't have work, but its subtree does. Clone the child
       
 18482       // fibers and continue.
       
 18483       cloneChildFibers(current, workInProgress);
       
 18484       return workInProgress.child;
       
 18485     }
       
 18486   }
       
 18487 
       
 18488   function remountFiber(current, oldWorkInProgress, newWorkInProgress) {
       
 18489     {
       
 18490       var returnFiber = oldWorkInProgress.return;
       
 18491 
       
 18492       if (returnFiber === null) {
       
 18493         throw new Error('Cannot swap the root fiber.');
       
 18494       } // Disconnect from the old current.
       
 18495       // It will get deleted.
       
 18496 
       
 18497 
       
 18498       current.alternate = null;
       
 18499       oldWorkInProgress.alternate = null; // Connect to the new tree.
       
 18500 
       
 18501       newWorkInProgress.index = oldWorkInProgress.index;
       
 18502       newWorkInProgress.sibling = oldWorkInProgress.sibling;
       
 18503       newWorkInProgress.return = oldWorkInProgress.return;
       
 18504       newWorkInProgress.ref = oldWorkInProgress.ref; // Replace the child/sibling pointers above it.
       
 18505 
       
 18506       if (oldWorkInProgress === returnFiber.child) {
       
 18507         returnFiber.child = newWorkInProgress;
       
 18508       } else {
       
 18509         var prevSibling = returnFiber.child;
       
 18510 
       
 18511         if (prevSibling === null) {
       
 18512           throw new Error('Expected parent to have a child.');
       
 18513         }
       
 18514 
       
 18515         while (prevSibling.sibling !== oldWorkInProgress) {
       
 18516           prevSibling = prevSibling.sibling;
       
 18517 
       
 18518           if (prevSibling === null) {
       
 18519             throw new Error('Expected to find the previous sibling.');
       
 18520           }
       
 18521         }
       
 18522 
       
 18523         prevSibling.sibling = newWorkInProgress;
       
 18524       } // Delete the old fiber and place the new one.
       
 18525       // Since the old fiber is disconnected, we have to schedule it manually.
       
 18526 
       
 18527 
       
 18528       var last = returnFiber.lastEffect;
       
 18529 
       
 18530       if (last !== null) {
       
 18531         last.nextEffect = current;
       
 18532         returnFiber.lastEffect = current;
       
 18533       } else {
       
 18534         returnFiber.firstEffect = returnFiber.lastEffect = current;
       
 18535       }
       
 18536 
       
 18537       current.nextEffect = null;
       
 18538       current.effectTag = Deletion;
       
 18539       newWorkInProgress.effectTag |= Placement; // Restart work from the new fiber.
       
 18540 
       
 18541       return newWorkInProgress;
       
 18542     }
       
 18543   }
       
 18544 
       
 18545   function beginWork(current, workInProgress, renderExpirationTime) {
       
 18546     var updateExpirationTime = workInProgress.expirationTime;
       
 18547 
       
 18548     {
       
 18549       if (workInProgress._debugNeedsRemount && current !== null) {
       
 18550         // This will restart the begin phase with a new fiber.
       
 18551         return remountFiber(current, workInProgress, createFiberFromTypeAndProps(workInProgress.type, workInProgress.key, workInProgress.pendingProps, workInProgress._debugOwner || null, workInProgress.mode, workInProgress.expirationTime));
       
 18552       }
       
 18553     }
       
 18554 
       
 18555     if (current !== null) {
       
 18556       var oldProps = current.memoizedProps;
       
 18557       var newProps = workInProgress.pendingProps;
       
 18558 
       
 18559       if (oldProps !== newProps || hasContextChanged() || ( // Force a re-render if the implementation changed due to hot reload:
       
 18560        workInProgress.type !== current.type )) {
       
 18561         // If props or context changed, mark the fiber as having performed work.
       
 18562         // This may be unset if the props are determined to be equal later (memo).
       
 18563         didReceiveUpdate = true;
       
 18564       } else if (updateExpirationTime < renderExpirationTime) {
       
 18565         didReceiveUpdate = false; // This fiber does not have any pending work. Bailout without entering
       
 18566         // the begin phase. There's still some bookkeeping we that needs to be done
       
 18567         // in this optimized path, mostly pushing stuff onto the stack.
       
 18568 
       
 18569         switch (workInProgress.tag) {
       
 18570           case HostRoot:
       
 18571             pushHostRootContext(workInProgress);
       
 18572             resetHydrationState();
       
 18573             break;
       
 18574 
       
 18575           case HostComponent:
       
 18576             pushHostContext(workInProgress);
       
 18577 
       
 18578             if (workInProgress.mode & ConcurrentMode && renderExpirationTime !== Never && shouldDeprioritizeSubtree(workInProgress.type, newProps)) {
       
 18579               {
       
 18580                 markSpawnedWork(Never);
       
 18581               } // Schedule this fiber to re-render at offscreen priority. Then bailout.
       
 18582 
       
 18583 
       
 18584               workInProgress.expirationTime = workInProgress.childExpirationTime = Never;
       
 18585               return null;
       
 18586             }
       
 18587 
       
 18588             break;
       
 18589 
       
 18590           case ClassComponent:
       
 18591             {
       
 18592               var Component = workInProgress.type;
       
 18593 
       
 18594               if (isContextProvider(Component)) {
       
 18595                 pushContextProvider(workInProgress);
       
 18596               }
       
 18597 
       
 18598               break;
       
 18599             }
       
 18600 
       
 18601           case HostPortal:
       
 18602             pushHostContainer(workInProgress, workInProgress.stateNode.containerInfo);
       
 18603             break;
       
 18604 
       
 18605           case ContextProvider:
       
 18606             {
       
 18607               var newValue = workInProgress.memoizedProps.value;
       
 18608               pushProvider(workInProgress, newValue);
       
 18609               break;
       
 18610             }
       
 18611 
       
 18612           case Profiler:
       
 18613             {
       
 18614               // Profiler should only call onRender when one of its descendants actually rendered.
       
 18615               var hasChildWork = workInProgress.childExpirationTime >= renderExpirationTime;
       
 18616 
       
 18617               if (hasChildWork) {
       
 18618                 workInProgress.effectTag |= Update;
       
 18619               }
       
 18620             }
       
 18621 
       
 18622             break;
       
 18623 
       
 18624           case SuspenseComponent:
       
 18625             {
       
 18626               var state = workInProgress.memoizedState;
       
 18627 
       
 18628               if (state !== null) {
       
 18629                 // whether to retry the primary children, or to skip over it and
       
 18630                 // go straight to the fallback. Check the priority of the primary
       
 18631                 // child fragment.
       
 18632 
       
 18633 
       
 18634                 var primaryChildFragment = workInProgress.child;
       
 18635                 var primaryChildExpirationTime = primaryChildFragment.childExpirationTime;
       
 18636 
       
 18637                 if (primaryChildExpirationTime !== NoWork && primaryChildExpirationTime >= renderExpirationTime) {
       
 18638                   // The primary children have pending work. Use the normal path
       
 18639                   // to attempt to render the primary children again.
       
 18640                   return updateSuspenseComponent(current, workInProgress, renderExpirationTime);
       
 18641                 } else {
       
 18642                   pushSuspenseContext(workInProgress, setDefaultShallowSuspenseContext(suspenseStackCursor.current)); // The primary children do not have pending work with sufficient
       
 18643                   // priority. Bailout.
       
 18644 
       
 18645                   var child = bailoutOnAlreadyFinishedWork(current, workInProgress, renderExpirationTime);
       
 18646 
       
 18647                   if (child !== null) {
       
 18648                     // The fallback children have pending work. Skip over the
       
 18649                     // primary children and work on the fallback.
       
 18650                     return child.sibling;
       
 18651                   } else {
       
 18652                     return null;
       
 18653                   }
       
 18654                 }
       
 18655               } else {
       
 18656                 pushSuspenseContext(workInProgress, setDefaultShallowSuspenseContext(suspenseStackCursor.current));
       
 18657               }
       
 18658 
       
 18659               break;
       
 18660             }
       
 18661 
       
 18662           case SuspenseListComponent:
       
 18663             {
       
 18664               var didSuspendBefore = (current.effectTag & DidCapture) !== NoEffect;
       
 18665 
       
 18666               var _hasChildWork = workInProgress.childExpirationTime >= renderExpirationTime;
       
 18667 
       
 18668               if (didSuspendBefore) {
       
 18669                 if (_hasChildWork) {
       
 18670                   // If something was in fallback state last time, and we have all the
       
 18671                   // same children then we're still in progressive loading state.
       
 18672                   // Something might get unblocked by state updates or retries in the
       
 18673                   // tree which will affect the tail. So we need to use the normal
       
 18674                   // path to compute the correct tail.
       
 18675                   return updateSuspenseListComponent(current, workInProgress, renderExpirationTime);
       
 18676                 } // If none of the children had any work, that means that none of
       
 18677                 // them got retried so they'll still be blocked in the same way
       
 18678                 // as before. We can fast bail out.
       
 18679 
       
 18680 
       
 18681                 workInProgress.effectTag |= DidCapture;
       
 18682               } // If nothing suspended before and we're rendering the same children,
       
 18683               // then the tail doesn't matter. Anything new that suspends will work
       
 18684               // in the "together" mode, so we can continue from the state we had.
       
 18685 
       
 18686 
       
 18687               var renderState = workInProgress.memoizedState;
       
 18688 
       
 18689               if (renderState !== null) {
       
 18690                 // Reset to the "together" mode in case we've started a different
       
 18691                 // update in the past but didn't complete it.
       
 18692                 renderState.rendering = null;
       
 18693                 renderState.tail = null;
       
 18694               }
       
 18695 
       
 18696               pushSuspenseContext(workInProgress, suspenseStackCursor.current);
       
 18697 
       
 18698               if (_hasChildWork) {
       
 18699                 break;
       
 18700               } else {
       
 18701                 // If none of the children had any work, that means that none of
       
 18702                 // them got retried so they'll still be blocked in the same way
       
 18703                 // as before. We can fast bail out.
       
 18704                 return null;
       
 18705               }
       
 18706             }
       
 18707         }
       
 18708 
       
 18709         return bailoutOnAlreadyFinishedWork(current, workInProgress, renderExpirationTime);
       
 18710       } else {
       
 18711         // An update was scheduled on this fiber, but there are no new props
       
 18712         // nor legacy context. Set this to false. If an update queue or context
       
 18713         // consumer produces a changed value, it will set this to true. Otherwise,
       
 18714         // the component will assume the children have not changed and bail out.
       
 18715         didReceiveUpdate = false;
       
 18716       }
       
 18717     } else {
       
 18718       didReceiveUpdate = false;
       
 18719     } // Before entering the begin phase, clear pending update priority.
       
 18720     // TODO: This assumes that we're about to evaluate the component and process
       
 18721     // the update queue. However, there's an exception: SimpleMemoComponent
       
 18722     // sometimes bails out later in the begin phase. This indicates that we should
       
 18723     // move this assignment out of the common path and into each branch.
       
 18724 
       
 18725 
       
 18726     workInProgress.expirationTime = NoWork;
       
 18727 
       
 18728     switch (workInProgress.tag) {
       
 18729       case IndeterminateComponent:
       
 18730         {
       
 18731           return mountIndeterminateComponent(current, workInProgress, workInProgress.type, renderExpirationTime);
       
 18732         }
       
 18733 
       
 18734       case LazyComponent:
       
 18735         {
       
 18736           var elementType = workInProgress.elementType;
       
 18737           return mountLazyComponent(current, workInProgress, elementType, updateExpirationTime, renderExpirationTime);
       
 18738         }
       
 18739 
       
 18740       case FunctionComponent:
       
 18741         {
       
 18742           var _Component = workInProgress.type;
       
 18743           var unresolvedProps = workInProgress.pendingProps;
       
 18744           var resolvedProps = workInProgress.elementType === _Component ? unresolvedProps : resolveDefaultProps(_Component, unresolvedProps);
       
 18745           return updateFunctionComponent(current, workInProgress, _Component, resolvedProps, renderExpirationTime);
       
 18746         }
       
 18747 
       
 18748       case ClassComponent:
       
 18749         {
       
 18750           var _Component2 = workInProgress.type;
       
 18751           var _unresolvedProps = workInProgress.pendingProps;
       
 18752 
       
 18753           var _resolvedProps = workInProgress.elementType === _Component2 ? _unresolvedProps : resolveDefaultProps(_Component2, _unresolvedProps);
       
 18754 
       
 18755           return updateClassComponent(current, workInProgress, _Component2, _resolvedProps, renderExpirationTime);
       
 18756         }
       
 18757 
       
 18758       case HostRoot:
       
 18759         return updateHostRoot(current, workInProgress, renderExpirationTime);
       
 18760 
       
 18761       case HostComponent:
       
 18762         return updateHostComponent(current, workInProgress, renderExpirationTime);
       
 18763 
       
 18764       case HostText:
       
 18765         return updateHostText(current, workInProgress);
       
 18766 
       
 18767       case SuspenseComponent:
       
 18768         return updateSuspenseComponent(current, workInProgress, renderExpirationTime);
       
 18769 
       
 18770       case HostPortal:
       
 18771         return updatePortalComponent(current, workInProgress, renderExpirationTime);
       
 18772 
       
 18773       case ForwardRef:
       
 18774         {
       
 18775           var type = workInProgress.type;
       
 18776           var _unresolvedProps2 = workInProgress.pendingProps;
       
 18777 
       
 18778           var _resolvedProps2 = workInProgress.elementType === type ? _unresolvedProps2 : resolveDefaultProps(type, _unresolvedProps2);
       
 18779 
       
 18780           return updateForwardRef(current, workInProgress, type, _resolvedProps2, renderExpirationTime);
       
 18781         }
       
 18782 
       
 18783       case Fragment:
       
 18784         return updateFragment(current, workInProgress, renderExpirationTime);
       
 18785 
       
 18786       case Mode:
       
 18787         return updateMode(current, workInProgress, renderExpirationTime);
       
 18788 
       
 18789       case Profiler:
       
 18790         return updateProfiler(current, workInProgress, renderExpirationTime);
       
 18791 
       
 18792       case ContextProvider:
       
 18793         return updateContextProvider(current, workInProgress, renderExpirationTime);
       
 18794 
       
 18795       case ContextConsumer:
       
 18796         return updateContextConsumer(current, workInProgress, renderExpirationTime);
       
 18797 
       
 18798       case MemoComponent:
       
 18799         {
       
 18800           var _type2 = workInProgress.type;
       
 18801           var _unresolvedProps3 = workInProgress.pendingProps; // Resolve outer props first, then resolve inner props.
       
 18802 
       
 18803           var _resolvedProps3 = resolveDefaultProps(_type2, _unresolvedProps3);
       
 18804 
       
 18805           {
       
 18806             if (workInProgress.type !== workInProgress.elementType) {
       
 18807               var outerPropTypes = _type2.propTypes;
       
 18808 
       
 18809               if (outerPropTypes) {
       
 18810                 checkPropTypes_1(outerPropTypes, _resolvedProps3, // Resolved for outer only
       
 18811                 'prop', getComponentName(_type2), getCurrentFiberStackInDev);
 18884               }
 18812               }
 18885             }
 18813             }
 18886           }
 18814           }
 18887         }
 18815 
 18888         if (node.child !== null) {
 18816           _resolvedProps3 = resolveDefaultProps(_type2.type, _resolvedProps3);
 18889           // Continue traversing like normal
 18817           return updateMemoComponent(current, workInProgress, _type2, _resolvedProps3, updateExpirationTime, renderExpirationTime);
       
 18818         }
       
 18819 
       
 18820       case SimpleMemoComponent:
       
 18821         {
       
 18822           return updateSimpleMemoComponent(current, workInProgress, workInProgress.type, workInProgress.pendingProps, updateExpirationTime, renderExpirationTime);
       
 18823         }
       
 18824 
       
 18825       case IncompleteClassComponent:
       
 18826         {
       
 18827           var _Component3 = workInProgress.type;
       
 18828           var _unresolvedProps4 = workInProgress.pendingProps;
       
 18829 
       
 18830           var _resolvedProps4 = workInProgress.elementType === _Component3 ? _unresolvedProps4 : resolveDefaultProps(_Component3, _unresolvedProps4);
       
 18831 
       
 18832           return mountIncompleteClassComponent(current, workInProgress, _Component3, _resolvedProps4, renderExpirationTime);
       
 18833         }
       
 18834 
       
 18835       case SuspenseListComponent:
       
 18836         {
       
 18837           return updateSuspenseListComponent(current, workInProgress, renderExpirationTime);
       
 18838         }
       
 18839     }
       
 18840 
       
 18841     {
       
 18842       {
       
 18843         throw Error( "Unknown unit of work tag (" + workInProgress.tag + "). This error is likely caused by a bug in React. Please file an issue." );
       
 18844       }
       
 18845     }
       
 18846   }
       
 18847 
       
 18848   function markUpdate(workInProgress) {
       
 18849     // Tag the fiber with an update effect. This turns a Placement into
       
 18850     // a PlacementAndUpdate.
       
 18851     workInProgress.effectTag |= Update;
       
 18852   }
       
 18853 
       
 18854   function markRef$1(workInProgress) {
       
 18855     workInProgress.effectTag |= Ref;
       
 18856   }
       
 18857 
       
 18858   var appendAllChildren;
       
 18859   var updateHostContainer;
       
 18860   var updateHostComponent$1;
       
 18861   var updateHostText$1;
       
 18862 
       
 18863   {
       
 18864     // Mutation mode
       
 18865     appendAllChildren = function (parent, workInProgress, needsVisibilityToggle, isHidden) {
       
 18866       // We only have the top Fiber that was created but we need recurse down its
       
 18867       // children to find all the terminal nodes.
       
 18868       var node = workInProgress.child;
       
 18869 
       
 18870       while (node !== null) {
       
 18871         if (node.tag === HostComponent || node.tag === HostText) {
       
 18872           appendInitialChild(parent, node.stateNode);
       
 18873         } else if (node.tag === HostPortal) ; else if (node.child !== null) {
 18890           node.child.return = node;
 18874           node.child.return = node;
 18891           node = node.child;
 18875           node = node.child;
 18892           continue;
 18876           continue;
 18893         }
 18877         }
 18894       } else if (node.child !== null) {
 18878 
 18895         node.child.return = node;
 18879         if (node === workInProgress) {
 18896         node = node.child;
 18880           return;
 18897         continue;
 18881         }
 18898       }
 18882 
 18899       // $FlowFixMe This is correct but Flow is confused by the labeled break.
 18883         while (node.sibling === null) {
 18900       node = node;
 18884           if (node.return === null || node.return === workInProgress) {
 18901       if (node === workInProgress) {
 18885             return;
       
 18886           }
       
 18887 
       
 18888           node = node.return;
       
 18889         }
       
 18890 
       
 18891         node.sibling.return = node.return;
       
 18892         node = node.sibling;
       
 18893       }
       
 18894     };
       
 18895 
       
 18896     updateHostContainer = function (workInProgress) {// Noop
       
 18897     };
       
 18898 
       
 18899     updateHostComponent$1 = function (current, workInProgress, type, newProps, rootContainerInstance) {
       
 18900       // If we have an alternate, that means this is an update and we need to
       
 18901       // schedule a side-effect to do the updates.
       
 18902       var oldProps = current.memoizedProps;
       
 18903 
       
 18904       if (oldProps === newProps) {
       
 18905         // In mutation mode, this is sufficient for a bailout because
       
 18906         // we won't touch this node even if children changed.
 18902         return;
 18907         return;
 18903       }
 18908       } // If we get updated because one of our children updated, we don't
 18904       while (node.sibling === null) {
 18909       // have newProps so we'll have to reuse them.
 18905         if (node.return === null || node.return === workInProgress) {
 18910       // TODO: Split the update API as separate for the props vs. children.
 18906           return;
 18911       // Even better would be if children weren't special cased at all tho.
 18907         }
 18912 
 18908         node = node.return;
 18913 
 18909       }
 18914       var instance = workInProgress.stateNode;
 18910       node.sibling.return = node.return;
 18915       var currentHostContext = getHostContext(); // TODO: Experiencing an error where oldProps is null. Suggests a host
 18911       node = node.sibling;
 18916       // component is hitting the resume path. Figure out why. Possibly
 18912     }
 18917       // related to `hidden`.
 18913   };
 18918 
 18914 
 18919       var updatePayload = prepareUpdate(instance, type, oldProps, newProps, rootContainerInstance, currentHostContext); // TODO: Type this specific to this type of component.
 18915   // An unfortunate fork of appendAllChildren because we have two different parent types.
 18920 
 18916   var appendAllChildrenToContainer = function (containerChildSet, workInProgress, needsVisibilityToggle, isHidden) {
 18921       workInProgress.updateQueue = updatePayload; // If the update payload indicates that there is a change or if there
 18917     // We only have the top Fiber that was created but we need recurse down its
 18922       // is a new ref we mark this as an update. All the work is done in commitWork.
 18918     // children to find all the terminal nodes.
 18923 
 18919     var node = workInProgress.child;
 18924       if (updatePayload) {
 18920     while (node !== null) {
 18925         markUpdate(workInProgress);
 18921       // eslint-disable-next-line no-labels
 18926       }
 18922       branches: if (node.tag === HostComponent) {
 18927     };
 18923         var instance = node.stateNode;
 18928 
 18924         if (needsVisibilityToggle && isHidden) {
 18929     updateHostText$1 = function (current, workInProgress, oldText, newText) {
 18925           // This child is inside a timed out tree. Hide it.
 18930       // If the text differs, mark it as an update. All the work in done in commitWork.
 18926           var props = node.memoizedProps;
 18931       if (oldText !== newText) {
 18927           var type = node.type;
 18932         markUpdate(workInProgress);
 18928           instance = cloneHiddenInstance(instance, type, props, node);
 18933       }
 18929         }
 18934     };
 18930         appendChildToContainerChildSet(containerChildSet, instance);
 18935   }
 18931       } else if (node.tag === HostText) {
 18936 
 18932         var _instance3 = node.stateNode;
 18937   function cutOffTailIfNeeded(renderState, hasRenderedATailFallback) {
 18933         if (needsVisibilityToggle && isHidden) {
 18938     switch (renderState.tailMode) {
 18934           // This child is inside a timed out tree. Hide it.
 18939       case 'hidden':
 18935           var text = node.memoizedProps;
 18940         {
 18936           _instance3 = cloneHiddenTextInstance(_instance3, text, node);
 18941           // Any insertions at the end of the tail list after this point
 18937         }
 18942           // should be invisible. If there are already mounted boundaries
 18938         appendChildToContainerChildSet(containerChildSet, _instance3);
 18943           // anything before them are not considered for collapsing.
 18939       } else if (enableFundamentalAPI && node.tag === FundamentalComponent) {
 18944           // Therefore we need to go through the whole tail to find if
 18940         var _instance4 = node.stateNode.instance;
 18945           // there are any.
 18941         if (needsVisibilityToggle && isHidden) {
 18946           var tailNode = renderState.tail;
 18942           // This child is inside a timed out tree. Hide it.
 18947           var lastTailNode = null;
 18943           var _props2 = node.memoizedProps;
 18948 
 18944           var _type2 = node.type;
 18949           while (tailNode !== null) {
 18945           _instance4 = cloneHiddenInstance(_instance4, _type2, _props2, node);
 18950             if (tailNode.alternate !== null) {
 18946         }
 18951               lastTailNode = tailNode;
 18947         appendChildToContainerChildSet(containerChildSet, _instance4);
 18952             }
 18948       } else if (node.tag === HostPortal) {
 18953 
 18949         // If we have a portal child, then we don't want to traverse
 18954             tailNode = tailNode.sibling;
 18950         // down its children. Instead, we'll get insertions from each child in
 18955           } // Next we're simply going to delete all insertions after the
 18951         // the portal directly.
 18956           // last rendered item.
 18952       } else if (node.tag === SuspenseComponent) {
 18957 
 18953         if ((node.effectTag & Update) !== NoEffect) {
 18958 
 18954           // Need to toggle the visibility of the primary children.
 18959           if (lastTailNode === null) {
 18955           var newIsHidden = node.memoizedState !== null;
 18960             // All remaining items in the tail are insertions.
 18956           if (newIsHidden) {
 18961             renderState.tail = null;
 18957             var primaryChildParent = node.child;
 18962           } else {
 18958             if (primaryChildParent !== null) {
 18963             // Detach the insertion after the last node that was already
 18959               if (primaryChildParent.child !== null) {
 18964             // inserted.
 18960                 primaryChildParent.child.return = primaryChildParent;
 18965             lastTailNode.sibling = null;
 18961                 appendAllChildrenToContainer(containerChildSet, primaryChildParent, true, newIsHidden);
 18966           }
       
 18967 
       
 18968           break;
       
 18969         }
       
 18970 
       
 18971       case 'collapsed':
       
 18972         {
       
 18973           // Any insertions at the end of the tail list after this point
       
 18974           // should be invisible. If there are already mounted boundaries
       
 18975           // anything before them are not considered for collapsing.
       
 18976           // Therefore we need to go through the whole tail to find if
       
 18977           // there are any.
       
 18978           var _tailNode = renderState.tail;
       
 18979           var _lastTailNode = null;
       
 18980 
       
 18981           while (_tailNode !== null) {
       
 18982             if (_tailNode.alternate !== null) {
       
 18983               _lastTailNode = _tailNode;
       
 18984             }
       
 18985 
       
 18986             _tailNode = _tailNode.sibling;
       
 18987           } // Next we're simply going to delete all insertions after the
       
 18988           // last rendered item.
       
 18989 
       
 18990 
       
 18991           if (_lastTailNode === null) {
       
 18992             // All remaining items in the tail are insertions.
       
 18993             if (!hasRenderedATailFallback && renderState.tail !== null) {
       
 18994               // We suspended during the head. We want to show at least one
       
 18995               // row at the tail. So we'll keep on and cut off the rest.
       
 18996               renderState.tail.sibling = null;
       
 18997             } else {
       
 18998               renderState.tail = null;
       
 18999             }
       
 19000           } else {
       
 19001             // Detach the insertion after the last node that was already
       
 19002             // inserted.
       
 19003             _lastTailNode.sibling = null;
       
 19004           }
       
 19005 
       
 19006           break;
       
 19007         }
       
 19008     }
       
 19009   }
       
 19010 
       
 19011   function completeWork(current, workInProgress, renderExpirationTime) {
       
 19012     var newProps = workInProgress.pendingProps;
       
 19013 
       
 19014     switch (workInProgress.tag) {
       
 19015       case IndeterminateComponent:
       
 19016       case LazyComponent:
       
 19017       case SimpleMemoComponent:
       
 19018       case FunctionComponent:
       
 19019       case ForwardRef:
       
 19020       case Fragment:
       
 19021       case Mode:
       
 19022       case Profiler:
       
 19023       case ContextConsumer:
       
 19024       case MemoComponent:
       
 19025         return null;
       
 19026 
       
 19027       case ClassComponent:
       
 19028         {
       
 19029           var Component = workInProgress.type;
       
 19030 
       
 19031           if (isContextProvider(Component)) {
       
 19032             popContext(workInProgress);
       
 19033           }
       
 19034 
       
 19035           return null;
       
 19036         }
       
 19037 
       
 19038       case HostRoot:
       
 19039         {
       
 19040           popHostContainer(workInProgress);
       
 19041           popTopLevelContextObject(workInProgress);
       
 19042           var fiberRoot = workInProgress.stateNode;
       
 19043 
       
 19044           if (fiberRoot.pendingContext) {
       
 19045             fiberRoot.context = fiberRoot.pendingContext;
       
 19046             fiberRoot.pendingContext = null;
       
 19047           }
       
 19048 
       
 19049           if (current === null || current.child === null) {
       
 19050             // If we hydrated, pop so that we can delete any remaining children
       
 19051             // that weren't hydrated.
       
 19052             var wasHydrated = popHydrationState(workInProgress);
       
 19053 
       
 19054             if (wasHydrated) {
       
 19055               // If we hydrated, then we'll need to schedule an update for
       
 19056               // the commit side-effects on the root.
       
 19057               markUpdate(workInProgress);
       
 19058             }
       
 19059           }
       
 19060 
       
 19061           updateHostContainer(workInProgress);
       
 19062           return null;
       
 19063         }
       
 19064 
       
 19065       case HostComponent:
       
 19066         {
       
 19067           popHostContext(workInProgress);
       
 19068           var rootContainerInstance = getRootHostContainer();
       
 19069           var type = workInProgress.type;
       
 19070 
       
 19071           if (current !== null && workInProgress.stateNode != null) {
       
 19072             updateHostComponent$1(current, workInProgress, type, newProps, rootContainerInstance);
       
 19073 
       
 19074             if (current.ref !== workInProgress.ref) {
       
 19075               markRef$1(workInProgress);
       
 19076             }
       
 19077           } else {
       
 19078             if (!newProps) {
       
 19079               if (!(workInProgress.stateNode !== null)) {
       
 19080                 {
       
 19081                   throw Error( "We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue." );
       
 19082                 }
       
 19083               } // This can happen when we abort work.
       
 19084 
       
 19085 
       
 19086               return null;
       
 19087             }
       
 19088 
       
 19089             var currentHostContext = getHostContext(); // TODO: Move createInstance to beginWork and keep it on a context
       
 19090             // "stack" as the parent. Then append children as we go in beginWork
       
 19091             // or completeWork depending on whether we want to add them top->down or
       
 19092             // bottom->up. Top->down is faster in IE11.
       
 19093 
       
 19094             var _wasHydrated = popHydrationState(workInProgress);
       
 19095 
       
 19096             if (_wasHydrated) {
       
 19097               // TODO: Move this and createInstance step into the beginPhase
       
 19098               // to consolidate.
       
 19099               if (prepareToHydrateHostInstance(workInProgress, rootContainerInstance, currentHostContext)) {
       
 19100                 // If changes to the hydrated node need to be applied at the
       
 19101                 // commit-phase we mark this as such.
       
 19102                 markUpdate(workInProgress);
 18962               }
 19103               }
 18963               var fallbackChildParent = primaryChildParent.sibling;
 19104             } else {
 18964               if (fallbackChildParent !== null) {
 19105               var instance = createInstance(type, newProps, rootContainerInstance, currentHostContext, workInProgress);
 18965                 fallbackChildParent.return = node;
 19106               appendAllChildren(instance, workInProgress, false, false); // This needs to be set before we mount Flare event listeners
 18966                 node = fallbackChildParent;
 19107 
 18967                 continue;
 19108               workInProgress.stateNode = instance;
       
 19109               // (eg DOM renderer supports auto-focus for certain elements).
       
 19110               // Make sure such renderers get scheduled for later work.
       
 19111 
       
 19112 
       
 19113               if (finalizeInitialChildren(instance, type, newProps, rootContainerInstance)) {
       
 19114                 markUpdate(workInProgress);
       
 19115               }
       
 19116             }
       
 19117 
       
 19118             if (workInProgress.ref !== null) {
       
 19119               // If there is a ref on a host node we need to schedule a callback
       
 19120               markRef$1(workInProgress);
       
 19121             }
       
 19122           }
       
 19123 
       
 19124           return null;
       
 19125         }
       
 19126 
       
 19127       case HostText:
       
 19128         {
       
 19129           var newText = newProps;
       
 19130 
       
 19131           if (current && workInProgress.stateNode != null) {
       
 19132             var oldText = current.memoizedProps; // If we have an alternate, that means this is an update and we need
       
 19133             // to schedule a side-effect to do the updates.
       
 19134 
       
 19135             updateHostText$1(current, workInProgress, oldText, newText);
       
 19136           } else {
       
 19137             if (typeof newText !== 'string') {
       
 19138               if (!(workInProgress.stateNode !== null)) {
       
 19139                 {
       
 19140                   throw Error( "We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue." );
       
 19141                 }
       
 19142               } // This can happen when we abort work.
       
 19143 
       
 19144             }
       
 19145 
       
 19146             var _rootContainerInstance = getRootHostContainer();
       
 19147 
       
 19148             var _currentHostContext = getHostContext();
       
 19149 
       
 19150             var _wasHydrated2 = popHydrationState(workInProgress);
       
 19151 
       
 19152             if (_wasHydrated2) {
       
 19153               if (prepareToHydrateHostTextInstance(workInProgress)) {
       
 19154                 markUpdate(workInProgress);
       
 19155               }
       
 19156             } else {
       
 19157               workInProgress.stateNode = createTextInstance(newText, _rootContainerInstance, _currentHostContext, workInProgress);
       
 19158             }
       
 19159           }
       
 19160 
       
 19161           return null;
       
 19162         }
       
 19163 
       
 19164       case SuspenseComponent:
       
 19165         {
       
 19166           popSuspenseContext(workInProgress);
       
 19167           var nextState = workInProgress.memoizedState;
       
 19168 
       
 19169           if ((workInProgress.effectTag & DidCapture) !== NoEffect) {
       
 19170             // Something suspended. Re-render with the fallback children.
       
 19171             workInProgress.expirationTime = renderExpirationTime; // Do not reset the effect list.
       
 19172 
       
 19173             return workInProgress;
       
 19174           }
       
 19175 
       
 19176           var nextDidTimeout = nextState !== null;
       
 19177           var prevDidTimeout = false;
       
 19178 
       
 19179           if (current === null) {
       
 19180             if (workInProgress.memoizedProps.fallback !== undefined) {
       
 19181               popHydrationState(workInProgress);
       
 19182             }
       
 19183           } else {
       
 19184             var prevState = current.memoizedState;
       
 19185             prevDidTimeout = prevState !== null;
       
 19186 
       
 19187             if (!nextDidTimeout && prevState !== null) {
       
 19188               // We just switched from the fallback to the normal children.
       
 19189               // Delete the fallback.
       
 19190               // TODO: Would it be better to store the fallback fragment on
       
 19191               // the stateNode during the begin phase?
       
 19192               var currentFallbackChild = current.child.sibling;
       
 19193 
       
 19194               if (currentFallbackChild !== null) {
       
 19195                 // Deletions go at the beginning of the return fiber's effect list
       
 19196                 var first = workInProgress.firstEffect;
       
 19197 
       
 19198                 if (first !== null) {
       
 19199                   workInProgress.firstEffect = currentFallbackChild;
       
 19200                   currentFallbackChild.nextEffect = first;
       
 19201                 } else {
       
 19202                   workInProgress.firstEffect = workInProgress.lastEffect = currentFallbackChild;
       
 19203                   currentFallbackChild.nextEffect = null;
       
 19204                 }
       
 19205 
       
 19206                 currentFallbackChild.effectTag = Deletion;
 18968               }
 19207               }
 18969             }
 19208             }
 18970           }
 19209           }
 18971         }
 19210 
 18972         if (node.child !== null) {
 19211           if (nextDidTimeout && !prevDidTimeout) {
 18973           // Continue traversing like normal
 19212             // If this subtreee is running in blocking mode we can suspend,
 18974           node.child.return = node;
 19213             // otherwise we won't suspend.
 18975           node = node.child;
 19214             // TODO: This will still suspend a synchronous tree if anything
 18976           continue;
 19215             // in the concurrent tree already suspended during this render.
 18977         }
 19216             // This is a known bug.
 18978       } else if (node.child !== null) {
 19217             if ((workInProgress.mode & BlockingMode) !== NoMode) {
 18979         node.child.return = node;
 19218               // TODO: Move this back to throwException because this is too late
 18980         node = node.child;
 19219               // if this is a large tree which is common for initial loads. We
 18981         continue;
 19220               // don't know if we should restart a render or not until we get
 18982       }
 19221               // this marker, and this is too late.
 18983       // $FlowFixMe This is correct but Flow is confused by the labeled break.
 19222               // If this render already had a ping or lower pri updates,
 18984       node = node;
 19223               // and this is the first time we know we're going to suspend we
 18985       if (node === workInProgress) {
 19224               // should be able to immediately restart from within throwException.
 18986         return;
 19225               var hasInvisibleChildContext = current === null && workInProgress.memoizedProps.unstable_avoidThisFallback !== true;
 18987       }
 19226 
 18988       while (node.sibling === null) {
 19227               if (hasInvisibleChildContext || hasSuspenseContext(suspenseStackCursor.current, InvisibleParentSuspenseContext)) {
 18989         if (node.return === null || node.return === workInProgress) {
 19228                 // If this was in an invisible tree or a new render, then showing
 18990           return;
 19229                 // this boundary is ok.
 18991         }
 19230                 renderDidSuspend();
 18992         node = node.return;
 19231               } else {
 18993       }
 19232                 // Otherwise, we're going to have to hide content so we should
 18994       node.sibling.return = node.return;
 19233                 // suspend for longer if possible.
 18995       node = node.sibling;
 19234                 renderDidSuspendDelayIfPossible();
 18996     }
 19235               }
 18997   };
       
 18998   updateHostContainer = function (workInProgress) {
       
 18999     var portalOrRoot = workInProgress.stateNode;
       
 19000     var childrenUnchanged = workInProgress.firstEffect === null;
       
 19001     if (childrenUnchanged) {
       
 19002       // No changes, just reuse the existing instance.
       
 19003     } else {
       
 19004       var container = portalOrRoot.containerInfo;
       
 19005       var newChildSet = createContainerChildSet(container);
       
 19006       // If children might have changed, we have to add them all to the set.
       
 19007       appendAllChildrenToContainer(newChildSet, workInProgress, false, false);
       
 19008       portalOrRoot.pendingChildren = newChildSet;
       
 19009       // Schedule an update on the container to swap out the container.
       
 19010       markUpdate(workInProgress);
       
 19011       finalizeContainerChildren(container, newChildSet);
       
 19012     }
       
 19013   };
       
 19014   updateHostComponent$1 = function (current, workInProgress, type, newProps, rootContainerInstance) {
       
 19015     var currentInstance = current.stateNode;
       
 19016     var oldProps = current.memoizedProps;
       
 19017     // If there are no effects associated with this node, then none of our children had any updates.
       
 19018     // This guarantees that we can reuse all of them.
       
 19019     var childrenUnchanged = workInProgress.firstEffect === null;
       
 19020     if (childrenUnchanged && oldProps === newProps) {
       
 19021       // No changes, just reuse the existing instance.
       
 19022       // Note that this might release a previous clone.
       
 19023       workInProgress.stateNode = currentInstance;
       
 19024       return;
       
 19025     }
       
 19026     var recyclableInstance = workInProgress.stateNode;
       
 19027     var currentHostContext = getHostContext();
       
 19028     var updatePayload = null;
       
 19029     if (oldProps !== newProps) {
       
 19030       updatePayload = prepareUpdate(recyclableInstance, type, oldProps, newProps, rootContainerInstance, currentHostContext);
       
 19031     }
       
 19032     if (childrenUnchanged && updatePayload === null) {
       
 19033       // No changes, just reuse the existing instance.
       
 19034       // Note that this might release a previous clone.
       
 19035       workInProgress.stateNode = currentInstance;
       
 19036       return;
       
 19037     }
       
 19038     var newInstance = cloneInstance(currentInstance, updatePayload, type, oldProps, newProps, workInProgress, childrenUnchanged, recyclableInstance);
       
 19039     if (finalizeInitialChildren(newInstance, type, newProps, rootContainerInstance, currentHostContext)) {
       
 19040       markUpdate(workInProgress);
       
 19041     }
       
 19042     workInProgress.stateNode = newInstance;
       
 19043     if (childrenUnchanged) {
       
 19044       // If there are no other effects in this tree, we need to flag this node as having one.
       
 19045       // Even though we're not going to use it for anything.
       
 19046       // Otherwise parents won't know that there are new children to propagate upwards.
       
 19047       markUpdate(workInProgress);
       
 19048     } else {
       
 19049       // If children might have changed, we have to add them all to the set.
       
 19050       appendAllChildren(newInstance, workInProgress, false, false);
       
 19051     }
       
 19052   };
       
 19053   updateHostText$1 = function (current, workInProgress, oldText, newText) {
       
 19054     if (oldText !== newText) {
       
 19055       // If the text content differs, we'll create a new text instance for it.
       
 19056       var rootContainerInstance = getRootHostContainer();
       
 19057       var currentHostContext = getHostContext();
       
 19058       workInProgress.stateNode = createTextInstance(newText, rootContainerInstance, currentHostContext, workInProgress);
       
 19059       // We'll have to mark it as having an effect, even though we won't use the effect for anything.
       
 19060       // This lets the parents know that at least one of their children has changed.
       
 19061       markUpdate(workInProgress);
       
 19062     }
       
 19063   };
       
 19064 } else {
       
 19065   // No host operations
       
 19066   updateHostContainer = function (workInProgress) {
       
 19067     // Noop
       
 19068   };
       
 19069   updateHostComponent$1 = function (current, workInProgress, type, newProps, rootContainerInstance) {
       
 19070     // Noop
       
 19071   };
       
 19072   updateHostText$1 = function (current, workInProgress, oldText, newText) {
       
 19073     // Noop
       
 19074   };
       
 19075 }
       
 19076 
       
 19077 function cutOffTailIfNeeded(renderState, hasRenderedATailFallback) {
       
 19078   switch (renderState.tailMode) {
       
 19079     case 'hidden':
       
 19080       {
       
 19081         // Any insertions at the end of the tail list after this point
       
 19082         // should be invisible. If there are already mounted boundaries
       
 19083         // anything before them are not considered for collapsing.
       
 19084         // Therefore we need to go through the whole tail to find if
       
 19085         // there are any.
       
 19086         var tailNode = renderState.tail;
       
 19087         var lastTailNode = null;
       
 19088         while (tailNode !== null) {
       
 19089           if (tailNode.alternate !== null) {
       
 19090             lastTailNode = tailNode;
       
 19091           }
       
 19092           tailNode = tailNode.sibling;
       
 19093         }
       
 19094         // Next we're simply going to delete all insertions after the
       
 19095         // last rendered item.
       
 19096         if (lastTailNode === null) {
       
 19097           // All remaining items in the tail are insertions.
       
 19098           renderState.tail = null;
       
 19099         } else {
       
 19100           // Detach the insertion after the last node that was already
       
 19101           // inserted.
       
 19102           lastTailNode.sibling = null;
       
 19103         }
       
 19104         break;
       
 19105       }
       
 19106     case 'collapsed':
       
 19107       {
       
 19108         // Any insertions at the end of the tail list after this point
       
 19109         // should be invisible. If there are already mounted boundaries
       
 19110         // anything before them are not considered for collapsing.
       
 19111         // Therefore we need to go through the whole tail to find if
       
 19112         // there are any.
       
 19113         var _tailNode = renderState.tail;
       
 19114         var _lastTailNode = null;
       
 19115         while (_tailNode !== null) {
       
 19116           if (_tailNode.alternate !== null) {
       
 19117             _lastTailNode = _tailNode;
       
 19118           }
       
 19119           _tailNode = _tailNode.sibling;
       
 19120         }
       
 19121         // Next we're simply going to delete all insertions after the
       
 19122         // last rendered item.
       
 19123         if (_lastTailNode === null) {
       
 19124           // All remaining items in the tail are insertions.
       
 19125           if (!hasRenderedATailFallback && renderState.tail !== null) {
       
 19126             // We suspended during the head. We want to show at least one
       
 19127             // row at the tail. So we'll keep on and cut off the rest.
       
 19128             renderState.tail.sibling = null;
       
 19129           } else {
       
 19130             renderState.tail = null;
       
 19131           }
       
 19132         } else {
       
 19133           // Detach the insertion after the last node that was already
       
 19134           // inserted.
       
 19135           _lastTailNode.sibling = null;
       
 19136         }
       
 19137         break;
       
 19138       }
       
 19139   }
       
 19140 }
       
 19141 
       
 19142 function completeWork(current, workInProgress, renderExpirationTime) {
       
 19143   var newProps = workInProgress.pendingProps;
       
 19144 
       
 19145   switch (workInProgress.tag) {
       
 19146     case IndeterminateComponent:
       
 19147       break;
       
 19148     case LazyComponent:
       
 19149       break;
       
 19150     case SimpleMemoComponent:
       
 19151     case FunctionComponent:
       
 19152       break;
       
 19153     case ClassComponent:
       
 19154       {
       
 19155         var Component = workInProgress.type;
       
 19156         if (isContextProvider(Component)) {
       
 19157           popContext(workInProgress);
       
 19158         }
       
 19159         break;
       
 19160       }
       
 19161     case HostRoot:
       
 19162       {
       
 19163         popHostContainer(workInProgress);
       
 19164         popTopLevelContextObject(workInProgress);
       
 19165         var fiberRoot = workInProgress.stateNode;
       
 19166         if (fiberRoot.pendingContext) {
       
 19167           fiberRoot.context = fiberRoot.pendingContext;
       
 19168           fiberRoot.pendingContext = null;
       
 19169         }
       
 19170         if (current === null || current.child === null) {
       
 19171           // If we hydrated, pop so that we can delete any remaining children
       
 19172           // that weren't hydrated.
       
 19173           popHydrationState(workInProgress);
       
 19174           // This resets the hacky state to fix isMounted before committing.
       
 19175           // TODO: Delete this when we delete isMounted and findDOMNode.
       
 19176           workInProgress.effectTag &= ~Placement;
       
 19177         }
       
 19178         updateHostContainer(workInProgress);
       
 19179         break;
       
 19180       }
       
 19181     case HostComponent:
       
 19182       {
       
 19183         popHostContext(workInProgress);
       
 19184         var rootContainerInstance = getRootHostContainer();
       
 19185         var type = workInProgress.type;
       
 19186         if (current !== null && workInProgress.stateNode != null) {
       
 19187           updateHostComponent$1(current, workInProgress, type, newProps, rootContainerInstance);
       
 19188 
       
 19189           if (enableFlareAPI) {
       
 19190             var prevListeners = current.memoizedProps.listeners;
       
 19191             var nextListeners = newProps.listeners;
       
 19192             var instance = workInProgress.stateNode;
       
 19193             if (prevListeners !== nextListeners) {
       
 19194               updateEventListeners(nextListeners, instance, rootContainerInstance, workInProgress);
       
 19195             }
 19236             }
 19196           }
 19237           }
 19197 
 19238 
 19198           if (current.ref !== workInProgress.ref) {
 19239           {
 19199             markRef$1(workInProgress);
 19240             // TODO: Only schedule updates if these values are non equal, i.e. it changed.
       
 19241             if (nextDidTimeout || prevDidTimeout) {
       
 19242               // If this boundary just timed out, schedule an effect to attach a
       
 19243               // retry listener to the promise. This flag is also used to hide the
       
 19244               // primary children. In mutation mode, we also need the flag to
       
 19245               // *unhide* children that were previously hidden, so check if this
       
 19246               // is currently timed out, too.
       
 19247               workInProgress.effectTag |= Update;
       
 19248             }
 19200           }
 19249           }
 19201         } else {
 19250 
 19202           if (!newProps) {
 19251           return null;
 19203             (function () {
 19252         }
 19204               if (!(workInProgress.stateNode !== null)) {
 19253 
 19205                 {
 19254       case HostPortal:
 19206                   throw ReactError(Error('We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue.'));
 19255         popHostContainer(workInProgress);
       
 19256         updateHostContainer(workInProgress);
       
 19257         return null;
       
 19258 
       
 19259       case ContextProvider:
       
 19260         // Pop provider fiber
       
 19261         popProvider(workInProgress);
       
 19262         return null;
       
 19263 
       
 19264       case IncompleteClassComponent:
       
 19265         {
       
 19266           // Same as class component case. I put it down here so that the tags are
       
 19267           // sequential to ensure this switch is compiled to a jump table.
       
 19268           var _Component = workInProgress.type;
       
 19269 
       
 19270           if (isContextProvider(_Component)) {
       
 19271             popContext(workInProgress);
       
 19272           }
       
 19273 
       
 19274           return null;
       
 19275         }
       
 19276 
       
 19277       case SuspenseListComponent:
       
 19278         {
       
 19279           popSuspenseContext(workInProgress);
       
 19280           var renderState = workInProgress.memoizedState;
       
 19281 
       
 19282           if (renderState === null) {
       
 19283             // We're running in the default, "independent" mode.
       
 19284             // We don't do anything in this mode.
       
 19285             return null;
       
 19286           }
       
 19287 
       
 19288           var didSuspendAlready = (workInProgress.effectTag & DidCapture) !== NoEffect;
       
 19289           var renderedTail = renderState.rendering;
       
 19290 
       
 19291           if (renderedTail === null) {
       
 19292             // We just rendered the head.
       
 19293             if (!didSuspendAlready) {
       
 19294               // This is the first pass. We need to figure out if anything is still
       
 19295               // suspended in the rendered set.
       
 19296               // If new content unsuspended, but there's still some content that
       
 19297               // didn't. Then we need to do a second pass that forces everything
       
 19298               // to keep showing their fallbacks.
       
 19299               // We might be suspended if something in this render pass suspended, or
       
 19300               // something in the previous committed pass suspended. Otherwise,
       
 19301               // there's no chance so we can skip the expensive call to
       
 19302               // findFirstSuspended.
       
 19303               var cannotBeSuspended = renderHasNotSuspendedYet() && (current === null || (current.effectTag & DidCapture) === NoEffect);
       
 19304 
       
 19305               if (!cannotBeSuspended) {
       
 19306                 var row = workInProgress.child;
       
 19307 
       
 19308                 while (row !== null) {
       
 19309                   var suspended = findFirstSuspended(row);
       
 19310 
       
 19311                   if (suspended !== null) {
       
 19312                     didSuspendAlready = true;
       
 19313                     workInProgress.effectTag |= DidCapture;
       
 19314                     cutOffTailIfNeeded(renderState, false); // If this is a newly suspended tree, it might not get committed as
       
 19315                     // part of the second pass. In that case nothing will subscribe to
       
 19316                     // its thennables. Instead, we'll transfer its thennables to the
       
 19317                     // SuspenseList so that it can retry if they resolve.
       
 19318                     // There might be multiple of these in the list but since we're
       
 19319                     // going to wait for all of them anyway, it doesn't really matter
       
 19320                     // which ones gets to ping. In theory we could get clever and keep
       
 19321                     // track of how many dependencies remain but it gets tricky because
       
 19322                     // in the meantime, we can add/remove/change items and dependencies.
       
 19323                     // We might bail out of the loop before finding any but that
       
 19324                     // doesn't matter since that means that the other boundaries that
       
 19325                     // we did find already has their listeners attached.
       
 19326 
       
 19327                     var newThennables = suspended.updateQueue;
       
 19328 
       
 19329                     if (newThennables !== null) {
       
 19330                       workInProgress.updateQueue = newThennables;
       
 19331                       workInProgress.effectTag |= Update;
       
 19332                     } // Rerender the whole list, but this time, we'll force fallbacks
       
 19333                     // to stay in place.
       
 19334                     // Reset the effect list before doing the second pass since that's now invalid.
       
 19335 
       
 19336 
       
 19337                     if (renderState.lastEffect === null) {
       
 19338                       workInProgress.firstEffect = null;
       
 19339                     }
       
 19340 
       
 19341                     workInProgress.lastEffect = renderState.lastEffect; // Reset the child fibers to their original state.
       
 19342 
       
 19343                     resetChildFibers(workInProgress, renderExpirationTime); // Set up the Suspense Context to force suspense and immediately
       
 19344                     // rerender the children.
       
 19345 
       
 19346                     pushSuspenseContext(workInProgress, setShallowSuspenseContext(suspenseStackCursor.current, ForceSuspenseFallback));
       
 19347                     return workInProgress.child;
       
 19348                   }
       
 19349 
       
 19350                   row = row.sibling;
 19207                 }
 19351                 }
 19208               }
 19352               }
 19209             })();
 19353             } else {
 19210             // This can happen when we abort work.
 19354               cutOffTailIfNeeded(renderState, false);
 19211             break;
 19355             } // Next we're going to render the tail.
 19212           }
 19356 
 19213 
       
 19214           var currentHostContext = getHostContext();
       
 19215           // TODO: Move createInstance to beginWork and keep it on a context
       
 19216           // "stack" as the parent. Then append children as we go in beginWork
       
 19217           // or completeWork depending on we want to add then top->down or
       
 19218           // bottom->up. Top->down is faster in IE11.
       
 19219           var wasHydrated = popHydrationState(workInProgress);
       
 19220           if (wasHydrated) {
       
 19221             // TODO: Move this and createInstance step into the beginPhase
       
 19222             // to consolidate.
       
 19223             if (prepareToHydrateHostInstance(workInProgress, rootContainerInstance, currentHostContext)) {
       
 19224               // If changes to the hydrated node needs to be applied at the
       
 19225               // commit-phase we mark this as such.
       
 19226               markUpdate(workInProgress);
       
 19227             }
       
 19228           } else {
 19357           } else {
 19229             var _instance5 = createInstance(type, newProps, rootContainerInstance, currentHostContext, workInProgress);
 19358             // Append the rendered row to the child list.
 19230 
 19359             if (!didSuspendAlready) {
 19231             appendAllChildren(_instance5, workInProgress, false, false);
 19360               var _suspended = findFirstSuspended(renderedTail);
 19232 
 19361 
 19233             if (enableFlareAPI) {
 19362               if (_suspended !== null) {
 19234               var listeners = newProps.listeners;
 19363                 workInProgress.effectTag |= DidCapture;
 19235               if (listeners != null) {
 19364                 didSuspendAlready = true; // Ensure we transfer the update queue to the parent so that it doesn't
 19236                 updateEventListeners(listeners, _instance5, rootContainerInstance, workInProgress);
 19365                 // get lost if this row ends up dropped during a second pass.
 19237               }
 19366 
 19238             }
       
 19239 
       
 19240             // Certain renderers require commit-time effects for initial mount.
       
 19241             // (eg DOM renderer supports auto-focus for certain elements).
       
 19242             // Make sure such renderers get scheduled for later work.
       
 19243             if (finalizeInitialChildren(_instance5, type, newProps, rootContainerInstance, currentHostContext)) {
       
 19244               markUpdate(workInProgress);
       
 19245             }
       
 19246             workInProgress.stateNode = _instance5;
       
 19247           }
       
 19248 
       
 19249           if (workInProgress.ref !== null) {
       
 19250             // If there is a ref on a host node we need to schedule a callback
       
 19251             markRef$1(workInProgress);
       
 19252           }
       
 19253         }
       
 19254         break;
       
 19255       }
       
 19256     case HostText:
       
 19257       {
       
 19258         var newText = newProps;
       
 19259         if (current && workInProgress.stateNode != null) {
       
 19260           var oldText = current.memoizedProps;
       
 19261           // If we have an alternate, that means this is an update and we need
       
 19262           // to schedule a side-effect to do the updates.
       
 19263           updateHostText$1(current, workInProgress, oldText, newText);
       
 19264         } else {
       
 19265           if (typeof newText !== 'string') {
       
 19266             (function () {
       
 19267               if (!(workInProgress.stateNode !== null)) {
       
 19268                 {
       
 19269                   throw ReactError(Error('We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue.'));
       
 19270                 }
       
 19271               }
       
 19272             })();
       
 19273             // This can happen when we abort work.
       
 19274           }
       
 19275           var _rootContainerInstance = getRootHostContainer();
       
 19276           var _currentHostContext = getHostContext();
       
 19277           var _wasHydrated = popHydrationState(workInProgress);
       
 19278           if (_wasHydrated) {
       
 19279             if (prepareToHydrateHostTextInstance(workInProgress)) {
       
 19280               markUpdate(workInProgress);
       
 19281             }
       
 19282           } else {
       
 19283             workInProgress.stateNode = createTextInstance(newText, _rootContainerInstance, _currentHostContext, workInProgress);
       
 19284           }
       
 19285         }
       
 19286         break;
       
 19287       }
       
 19288     case ForwardRef:
       
 19289       break;
       
 19290     case SuspenseComponent:
       
 19291       {
       
 19292         popSuspenseContext(workInProgress);
       
 19293         var nextState = workInProgress.memoizedState;
       
 19294         if ((workInProgress.effectTag & DidCapture) !== NoEffect) {
       
 19295           // Something suspended. Re-render with the fallback children.
       
 19296           workInProgress.expirationTime = renderExpirationTime;
       
 19297           // Do not reset the effect list.
       
 19298           return workInProgress;
       
 19299         }
       
 19300 
       
 19301         var nextDidTimeout = nextState !== null;
       
 19302         var prevDidTimeout = false;
       
 19303         if (current === null) {
       
 19304           // In cases where we didn't find a suitable hydration boundary we never
       
 19305           // downgraded this to a DehydratedSuspenseComponent, but we still need to
       
 19306           // pop the hydration state since we might be inside the insertion tree.
       
 19307           popHydrationState(workInProgress);
       
 19308         } else {
       
 19309           var prevState = current.memoizedState;
       
 19310           prevDidTimeout = prevState !== null;
       
 19311           if (!nextDidTimeout && prevState !== null) {
       
 19312             // We just switched from the fallback to the normal children.
       
 19313             // Delete the fallback.
       
 19314             // TODO: Would it be better to store the fallback fragment on
       
 19315             var currentFallbackChild = current.child.sibling;
       
 19316             if (currentFallbackChild !== null) {
       
 19317               // Deletions go at the beginning of the return fiber's effect list
       
 19318               var first = workInProgress.firstEffect;
       
 19319               if (first !== null) {
       
 19320                 workInProgress.firstEffect = currentFallbackChild;
       
 19321                 currentFallbackChild.nextEffect = first;
       
 19322               } else {
       
 19323                 workInProgress.firstEffect = workInProgress.lastEffect = currentFallbackChild;
       
 19324                 currentFallbackChild.nextEffect = null;
       
 19325               }
       
 19326               currentFallbackChild.effectTag = Deletion;
       
 19327             }
       
 19328           }
       
 19329         }
       
 19330 
       
 19331         if (nextDidTimeout && !prevDidTimeout) {
       
 19332           // If this subtreee is running in batched mode we can suspend,
       
 19333           // otherwise we won't suspend.
       
 19334           // TODO: This will still suspend a synchronous tree if anything
       
 19335           // in the concurrent tree already suspended during this render.
       
 19336           // This is a known bug.
       
 19337           if ((workInProgress.mode & BatchedMode) !== NoMode) {
       
 19338             // TODO: Move this back to throwException because this is too late
       
 19339             // if this is a large tree which is common for initial loads. We
       
 19340             // don't know if we should restart a render or not until we get
       
 19341             // this marker, and this is too late.
       
 19342             // If this render already had a ping or lower pri updates,
       
 19343             // and this is the first time we know we're going to suspend we
       
 19344             // should be able to immediately restart from within throwException.
       
 19345             var hasInvisibleChildContext = current === null && workInProgress.memoizedProps.unstable_avoidThisFallback !== true;
       
 19346             if (hasInvisibleChildContext || hasSuspenseContext(suspenseStackCursor.current, InvisibleParentSuspenseContext)) {
       
 19347               // If this was in an invisible tree or a new render, then showing
       
 19348               // this boundary is ok.
       
 19349               renderDidSuspend();
       
 19350             } else {
       
 19351               // Otherwise, we're going to have to hide content so we should
       
 19352               // suspend for longer if possible.
       
 19353               renderDidSuspendDelayIfPossible();
       
 19354             }
       
 19355           }
       
 19356         }
       
 19357 
       
 19358         if (supportsPersistence) {
       
 19359           // TODO: Only schedule updates if not prevDidTimeout.
       
 19360           if (nextDidTimeout) {
       
 19361             // If this boundary just timed out, schedule an effect to attach a
       
 19362             // retry listener to the proimse. This flag is also used to hide the
       
 19363             // primary children.
       
 19364             workInProgress.effectTag |= Update;
       
 19365           }
       
 19366         }
       
 19367         if (supportsMutation) {
       
 19368           // TODO: Only schedule updates if these values are non equal, i.e. it changed.
       
 19369           if (nextDidTimeout || prevDidTimeout) {
       
 19370             // If this boundary just timed out, schedule an effect to attach a
       
 19371             // retry listener to the proimse. This flag is also used to hide the
       
 19372             // primary children. In mutation mode, we also need the flag to
       
 19373             // *unhide* children that were previously hidden, so check if the
       
 19374             // is currently timed out, too.
       
 19375             workInProgress.effectTag |= Update;
       
 19376           }
       
 19377         }
       
 19378         if (enableSuspenseCallback && workInProgress.updateQueue !== null && workInProgress.memoizedProps.suspenseCallback != null) {
       
 19379           // Always notify the callback
       
 19380           workInProgress.effectTag |= Update;
       
 19381         }
       
 19382         break;
       
 19383       }
       
 19384     case Fragment:
       
 19385       break;
       
 19386     case Mode:
       
 19387       break;
       
 19388     case Profiler:
       
 19389       break;
       
 19390     case HostPortal:
       
 19391       popHostContainer(workInProgress);
       
 19392       updateHostContainer(workInProgress);
       
 19393       break;
       
 19394     case ContextProvider:
       
 19395       // Pop provider fiber
       
 19396       popProvider(workInProgress);
       
 19397       break;
       
 19398     case ContextConsumer:
       
 19399       break;
       
 19400     case MemoComponent:
       
 19401       break;
       
 19402     case IncompleteClassComponent:
       
 19403       {
       
 19404         // Same as class component case. I put it down here so that the tags are
       
 19405         // sequential to ensure this switch is compiled to a jump table.
       
 19406         var _Component = workInProgress.type;
       
 19407         if (isContextProvider(_Component)) {
       
 19408           popContext(workInProgress);
       
 19409         }
       
 19410         break;
       
 19411       }
       
 19412     case DehydratedSuspenseComponent:
       
 19413       {
       
 19414         if (enableSuspenseServerRenderer) {
       
 19415           popSuspenseContext(workInProgress);
       
 19416           if (current === null) {
       
 19417             var _wasHydrated2 = popHydrationState(workInProgress);
       
 19418             (function () {
       
 19419               if (!_wasHydrated2) {
       
 19420                 {
       
 19421                   throw ReactError(Error('A dehydrated suspense component was completed without a hydrated node. This is probably a bug in React.'));
       
 19422                 }
       
 19423               }
       
 19424             })();
       
 19425             if (enableSchedulerTracing) {
       
 19426               markSpawnedWork(Never);
       
 19427             }
       
 19428             skipPastDehydratedSuspenseInstance(workInProgress);
       
 19429           } else if ((workInProgress.effectTag & DidCapture) === NoEffect) {
       
 19430             // This boundary did not suspend so it's now hydrated.
       
 19431             // To handle any future suspense cases, we're going to now upgrade it
       
 19432             // to a Suspense component. We detach it from the existing current fiber.
       
 19433             current.alternate = null;
       
 19434             workInProgress.alternate = null;
       
 19435             workInProgress.tag = SuspenseComponent;
       
 19436             workInProgress.memoizedState = null;
       
 19437             workInProgress.stateNode = null;
       
 19438           }
       
 19439         }
       
 19440         break;
       
 19441       }
       
 19442     case SuspenseListComponent:
       
 19443       {
       
 19444         popSuspenseContext(workInProgress);
       
 19445 
       
 19446         var renderState = workInProgress.memoizedState;
       
 19447 
       
 19448         if (renderState === null) {
       
 19449           // We're running in the default, "independent" mode. We don't do anything
       
 19450           // in this mode.
       
 19451           break;
       
 19452         }
       
 19453 
       
 19454         var didSuspendAlready = (workInProgress.effectTag & DidCapture) !== NoEffect;
       
 19455 
       
 19456         var renderedTail = renderState.rendering;
       
 19457         if (renderedTail === null) {
       
 19458           // We just rendered the head.
       
 19459           if (!didSuspendAlready) {
       
 19460             // This is the first pass. We need to figure out if anything is still
       
 19461             // suspended in the rendered set.
       
 19462 
       
 19463             // If new content unsuspended, but there's still some content that
       
 19464             // didn't. Then we need to do a second pass that forces everything
       
 19465             // to keep showing their fallbacks.
       
 19466 
       
 19467             // We might be suspended if something in this render pass suspended, or
       
 19468             // something in the previous committed pass suspended. Otherwise,
       
 19469             // there's no chance so we can skip the expensive call to
       
 19470             // findFirstSuspended.
       
 19471             var cannotBeSuspended = renderHasNotSuspendedYet() && (current === null || (current.effectTag & DidCapture) === NoEffect);
       
 19472             if (!cannotBeSuspended) {
       
 19473               var row = workInProgress.child;
       
 19474               while (row !== null) {
       
 19475                 var suspended = findFirstSuspended(row);
       
 19476                 if (suspended !== null) {
       
 19477                   didSuspendAlready = true;
       
 19478                   workInProgress.effectTag |= DidCapture;
       
 19479                   cutOffTailIfNeeded(renderState, false);
       
 19480 
       
 19481                   // If this is a newly suspended tree, it might not get committed as
       
 19482                   // part of the second pass. In that case nothing will subscribe to
       
 19483                   // its thennables. Instead, we'll transfer its thennables to the
       
 19484                   // SuspenseList so that it can retry if they resolve.
       
 19485                   // There might be multiple of these in the list but since we're
       
 19486                   // going to wait for all of them anyway, it doesn't really matter
       
 19487                   // which ones gets to ping. In theory we could get clever and keep
       
 19488                   // track of how many dependencies remain but it gets tricky because
       
 19489                   // in the meantime, we can add/remove/change items and dependencies.
       
 19490                   // We might bail out of the loop before finding any but that
       
 19491                   // doesn't matter since that means that the other boundaries that
       
 19492                   // we did find already has their listeners attached.
       
 19493                   var newThennables = suspended.updateQueue;
       
 19494                   if (newThennables !== null) {
       
 19495                     workInProgress.updateQueue = newThennables;
       
 19496                     workInProgress.effectTag |= Update;
       
 19497                   }
       
 19498 
       
 19499                   // Rerender the whole list, but this time, we'll force fallbacks
       
 19500                   // to stay in place.
       
 19501                   // Reset the effect list before doing the second pass since that's now invalid.
       
 19502                   workInProgress.firstEffect = workInProgress.lastEffect = null;
       
 19503                   // Reset the child fibers to their original state.
       
 19504                   resetChildFibers(workInProgress, renderExpirationTime);
       
 19505 
       
 19506                   // Set up the Suspense Context to force suspense and immediately
       
 19507                   // rerender the children.
       
 19508                   pushSuspenseContext(workInProgress, setShallowSuspenseContext(suspenseStackCursor.current, ForceSuspenseFallback));
       
 19509                   return workInProgress.child;
       
 19510                 }
       
 19511                 row = row.sibling;
       
 19512               }
       
 19513             }
       
 19514           } else {
       
 19515             cutOffTailIfNeeded(renderState, false);
       
 19516           }
       
 19517           // Next we're going to render the tail.
       
 19518         } else {
       
 19519           // Append the rendered row to the child list.
       
 19520           if (!didSuspendAlready) {
       
 19521             var _suspended = findFirstSuspended(renderedTail);
       
 19522             if (_suspended !== null) {
       
 19523               workInProgress.effectTag |= DidCapture;
       
 19524               didSuspendAlready = true;
       
 19525               cutOffTailIfNeeded(renderState, true);
       
 19526               // This might have been modified.
       
 19527               if (renderState.tail === null && renderState.tailMode === 'hidden') {
       
 19528                 // We need to delete the row we just rendered.
       
 19529                 // Ensure we transfer the update queue to the parent.
       
 19530                 var _newThennables = _suspended.updateQueue;
 19367                 var _newThennables = _suspended.updateQueue;
       
 19368 
 19531                 if (_newThennables !== null) {
 19369                 if (_newThennables !== null) {
 19532                   workInProgress.updateQueue = _newThennables;
 19370                   workInProgress.updateQueue = _newThennables;
 19533                   workInProgress.effectTag |= Update;
 19371                   workInProgress.effectTag |= Update;
 19534                 }
 19372                 }
 19535                 // Reset the effect list to what it w as before we rendered this
 19373 
 19536                 // child. The nested children have already appended themselves.
 19374                 cutOffTailIfNeeded(renderState, true); // This might have been modified.
 19537                 var lastEffect = workInProgress.lastEffect = renderState.lastEffect;
 19375 
 19538                 // Remove any effects that were appended after this point.
 19376                 if (renderState.tail === null && renderState.tailMode === 'hidden' && !renderedTail.alternate) {
 19539                 if (lastEffect !== null) {
 19377                   // We need to delete the row we just rendered.
 19540                   lastEffect.nextEffect = null;
 19378                   // Reset the effect list to what it was before we rendered this
       
 19379                   // child. The nested children have already appended themselves.
       
 19380                   var lastEffect = workInProgress.lastEffect = renderState.lastEffect; // Remove any effects that were appended after this point.
       
 19381 
       
 19382                   if (lastEffect !== null) {
       
 19383                     lastEffect.nextEffect = null;
       
 19384                   } // We're done.
       
 19385 
       
 19386 
       
 19387                   return null;
 19541                 }
 19388                 }
 19542                 // We're done.
 19389               } else if ( // The time it took to render last row is greater than time until
 19543                 return null;
 19390               // the expiration.
 19544               }
 19391               now() * 2 - renderState.renderingStartTime > renderState.tailExpiration && renderExpirationTime > Never) {
 19545             } else if (now() > renderState.tailExpiration && renderExpirationTime > Never) {
 19392                 // We have now passed our CPU deadline and we'll just give up further
 19546               // We have now passed our CPU deadline and we'll just give up further
 19393                 // attempts to render the main content and only render fallbacks.
 19547               // attempts to render the main content and only render fallbacks.
 19394                 // The assumption is that this is usually faster.
 19548               // The assumption is that this is usually faster.
 19395                 workInProgress.effectTag |= DidCapture;
 19549               workInProgress.effectTag |= DidCapture;
 19396                 didSuspendAlready = true;
 19550               didSuspendAlready = true;
 19397                 cutOffTailIfNeeded(renderState, false); // Since nothing actually suspended, there will nothing to ping this
 19551 
 19398                 // to get it started back up to attempt the next item. If we can show
 19552               cutOffTailIfNeeded(renderState, false);
 19399                 // them, then they really have the same priority as this render.
 19553 
 19400                 // So we'll pick it back up the very next render pass once we've had
 19554               // Since nothing actually suspended, there will nothing to ping this
 19401                 // an opportunity to yield for paint.
 19555               // to get it started back up to attempt the next item. If we can show
 19402 
 19556               // them, then they really have the same priority as this render.
 19403                 var nextPriority = renderExpirationTime - 1;
 19557               // So we'll pick it back up the very next render pass once we've had
 19404                 workInProgress.expirationTime = workInProgress.childExpirationTime = nextPriority;
 19558               // an opportunity to yield for paint.
 19405 
 19559 
 19406                 {
 19560               var nextPriority = renderExpirationTime - 1;
 19407                   markSpawnedWork(nextPriority);
 19561               workInProgress.expirationTime = workInProgress.childExpirationTime = nextPriority;
 19408                 }
 19562               if (enableSchedulerTracing) {
       
 19563                 markSpawnedWork(nextPriority);
       
 19564               }
 19409               }
 19565             }
 19410             }
 19566           }
 19411 
 19567           if (renderState.isBackwards) {
 19412             if (renderState.isBackwards) {
 19568             // The effect list of the backwards tail will have been added
 19413               // The effect list of the backwards tail will have been added
 19569             // to the end. This breaks the guarantee that life-cycles fire in
 19414               // to the end. This breaks the guarantee that life-cycles fire in
 19570             // sibling order but that isn't a strong guarantee promised by React.
 19415               // sibling order but that isn't a strong guarantee promised by React.
 19571             // Especially since these might also just pop in during future commits.
 19416               // Especially since these might also just pop in during future commits.
 19572             // Append to the beginning of the list.
 19417               // Append to the beginning of the list.
 19573             renderedTail.sibling = workInProgress.child;
 19418               renderedTail.sibling = workInProgress.child;
 19574             workInProgress.child = renderedTail;
 19419               workInProgress.child = renderedTail;
 19575           } else {
       
 19576             var previousSibling = renderState.last;
       
 19577             if (previousSibling !== null) {
       
 19578               previousSibling.sibling = renderedTail;
       
 19579             } else {
 19420             } else {
 19580               workInProgress.child = renderedTail;
 19421               var previousSibling = renderState.last;
 19581             }
 19422 
 19582             renderState.last = renderedTail;
 19423               if (previousSibling !== null) {
 19583           }
 19424                 previousSibling.sibling = renderedTail;
 19584         }
 19425               } else {
 19585 
 19426                 workInProgress.child = renderedTail;
 19586         if (renderState.tail !== null) {
 19427               }
 19587           // We still have tail rows to render.
 19428 
 19588           if (renderState.tailExpiration === 0) {
 19429               renderState.last = renderedTail;
 19589             // Heuristic for how long we're willing to spend rendering rows
       
 19590             // until we just give up and show what we have so far.
       
 19591             var TAIL_EXPIRATION_TIMEOUT_MS = 500;
       
 19592             renderState.tailExpiration = now() + TAIL_EXPIRATION_TIMEOUT_MS;
       
 19593           }
       
 19594           // Pop a row.
       
 19595           var next = renderState.tail;
       
 19596           renderState.rendering = next;
       
 19597           renderState.tail = next.sibling;
       
 19598           renderState.lastEffect = workInProgress.lastEffect;
       
 19599           next.sibling = null;
       
 19600 
       
 19601           // Restore the context.
       
 19602           // TODO: We can probably just avoid popping it instead and only
       
 19603           // setting it the first time we go from not suspended to suspended.
       
 19604           var suspenseContext = suspenseStackCursor.current;
       
 19605           if (didSuspendAlready) {
       
 19606             suspenseContext = setShallowSuspenseContext(suspenseContext, ForceSuspenseFallback);
       
 19607           } else {
       
 19608             suspenseContext = setDefaultShallowSuspenseContext(suspenseContext);
       
 19609           }
       
 19610           pushSuspenseContext(workInProgress, suspenseContext);
       
 19611           // Do a pass over the next row.
       
 19612           return next;
       
 19613         }
       
 19614         break;
       
 19615       }
       
 19616     case FundamentalComponent:
       
 19617       {
       
 19618         if (enableFundamentalAPI) {
       
 19619           var fundamentalImpl = workInProgress.type.impl;
       
 19620           var fundamentalInstance = workInProgress.stateNode;
       
 19621 
       
 19622           if (fundamentalInstance === null) {
       
 19623             var getInitialState = fundamentalImpl.getInitialState;
       
 19624             var fundamentalState = void 0;
       
 19625             if (getInitialState !== undefined) {
       
 19626               fundamentalState = getInitialState(newProps);
       
 19627             }
       
 19628             fundamentalInstance = workInProgress.stateNode = createFundamentalStateInstance(workInProgress, newProps, fundamentalImpl, fundamentalState || {});
       
 19629             var _instance6 = getFundamentalComponentInstance(fundamentalInstance);
       
 19630             fundamentalInstance.instance = _instance6;
       
 19631             if (fundamentalImpl.reconcileChildren === false) {
       
 19632               return null;
       
 19633             }
       
 19634             appendAllChildren(_instance6, workInProgress, false, false);
       
 19635             mountFundamentalComponent(fundamentalInstance);
       
 19636           } else {
       
 19637             // We fire update in commit phase
       
 19638             var prevProps = fundamentalInstance.props;
       
 19639             fundamentalInstance.prevProps = prevProps;
       
 19640             fundamentalInstance.props = newProps;
       
 19641             fundamentalInstance.currentFiber = workInProgress;
       
 19642             if (supportsPersistence) {
       
 19643               var _instance7 = cloneFundamentalInstance(fundamentalInstance);
       
 19644               fundamentalInstance.instance = _instance7;
       
 19645               appendAllChildren(_instance7, workInProgress, false, false);
       
 19646             }
       
 19647             var shouldUpdate = shouldUpdateFundamentalComponent(fundamentalInstance);
       
 19648             if (shouldUpdate) {
       
 19649               markUpdate(workInProgress);
       
 19650             }
 19430             }
 19651           }
 19431           }
 19652         }
 19432 
 19653         break;
 19433           if (renderState.tail !== null) {
 19654       }
 19434             // We still have tail rows to render.
 19655     default:
 19435             if (renderState.tailExpiration === 0) {
 19656       (function () {
 19436               // Heuristic for how long we're willing to spend rendering rows
       
 19437               // until we just give up and show what we have so far.
       
 19438               var TAIL_EXPIRATION_TIMEOUT_MS = 500;
       
 19439               renderState.tailExpiration = now() + TAIL_EXPIRATION_TIMEOUT_MS; // TODO: This is meant to mimic the train model or JND but this
       
 19440               // is a per component value. It should really be since the start
       
 19441               // of the total render or last commit. Consider using something like
       
 19442               // globalMostRecentFallbackTime. That doesn't account for being
       
 19443               // suspended for part of the time or when it's a new render.
       
 19444               // It should probably use a global start time value instead.
       
 19445             } // Pop a row.
       
 19446 
       
 19447 
       
 19448             var next = renderState.tail;
       
 19449             renderState.rendering = next;
       
 19450             renderState.tail = next.sibling;
       
 19451             renderState.lastEffect = workInProgress.lastEffect;
       
 19452             renderState.renderingStartTime = now();
       
 19453             next.sibling = null; // Restore the context.
       
 19454             // TODO: We can probably just avoid popping it instead and only
       
 19455             // setting it the first time we go from not suspended to suspended.
       
 19456 
       
 19457             var suspenseContext = suspenseStackCursor.current;
       
 19458 
       
 19459             if (didSuspendAlready) {
       
 19460               suspenseContext = setShallowSuspenseContext(suspenseContext, ForceSuspenseFallback);
       
 19461             } else {
       
 19462               suspenseContext = setDefaultShallowSuspenseContext(suspenseContext);
       
 19463             }
       
 19464 
       
 19465             pushSuspenseContext(workInProgress, suspenseContext); // Do a pass over the next row.
       
 19466 
       
 19467             return next;
       
 19468           }
       
 19469 
       
 19470           return null;
       
 19471         }
       
 19472     }
       
 19473 
       
 19474     {
       
 19475       {
       
 19476         throw Error( "Unknown unit of work tag (" + workInProgress.tag + "). This error is likely caused by a bug in React. Please file an issue." );
       
 19477       }
       
 19478     }
       
 19479   }
       
 19480 
       
 19481   function unwindWork(workInProgress, renderExpirationTime) {
       
 19482     switch (workInProgress.tag) {
       
 19483       case ClassComponent:
 19657         {
 19484         {
 19658           {
 19485           var Component = workInProgress.type;
 19659             throw ReactError(Error('Unknown unit of work tag. This error is likely caused by a bug in React. Please file an issue.'));
 19486 
       
 19487           if (isContextProvider(Component)) {
       
 19488             popContext(workInProgress);
 19660           }
 19489           }
 19661         }
 19490 
 19662       })();
 19491           var effectTag = workInProgress.effectTag;
 19663   }
 19492 
 19664 
 19493           if (effectTag & ShouldCapture) {
 19665   return null;
 19494             workInProgress.effectTag = effectTag & ~ShouldCapture | DidCapture;
 19666 }
 19495             return workInProgress;
 19667 
 19496           }
 19668 function mountEventResponder$1(responder, responderProps, instance, rootContainerInstance, fiber, respondersMap) {
 19497 
 19669   var responderState = emptyObject;
 19498           return null;
 19670   var getInitialState = responder.getInitialState;
 19499         }
 19671   if (getInitialState !== null) {
 19500 
 19672     responderState = getInitialState(responderProps);
 19501       case HostRoot:
 19673   }
 19502         {
 19674   var responderInstance = createResponderInstance(responder, responderProps, responderState, instance, fiber);
 19503           popHostContainer(workInProgress);
 19675   mountResponderInstance(responder, responderInstance, responderProps, responderState, instance, rootContainerInstance);
 19504           popTopLevelContextObject(workInProgress);
 19676   respondersMap.set(responder, responderInstance);
 19505           var _effectTag = workInProgress.effectTag;
 19677 }
 19506 
 19678 
       
 19679 function updateEventListener(listener, fiber, visistedResponders, respondersMap, instance, rootContainerInstance) {
       
 19680   var responder = void 0;
       
 19681   var props = void 0;
       
 19682 
       
 19683   if (listener) {
       
 19684     responder = listener.responder;
       
 19685     props = listener.props;
       
 19686   }
       
 19687   (function () {
       
 19688     if (!(responder && responder.$$typeof === REACT_RESPONDER_TYPE)) {
       
 19689       {
       
 19690         throw ReactError(Error('An invalid value was used as an event listener. Expect one or many event listeners created via React.unstable_useResponer().'));
       
 19691       }
       
 19692     }
       
 19693   })();
       
 19694   var listenerProps = props;
       
 19695   if (visistedResponders.has(responder)) {
       
 19696     // show warning
       
 19697     {
       
 19698       warning$1(false, 'Duplicate event responder "%s" found in event listeners. ' + 'Event listeners passed to elements cannot use the same event responder more than once.', responder.displayName);
       
 19699     }
       
 19700     return;
       
 19701   }
       
 19702   visistedResponders.add(responder);
       
 19703   var responderInstance = respondersMap.get(responder);
       
 19704 
       
 19705   if (responderInstance === undefined) {
       
 19706     // Mount
       
 19707     mountEventResponder$1(responder, listenerProps, instance, rootContainerInstance, fiber, respondersMap);
       
 19708   } else {
       
 19709     // Update
       
 19710     responderInstance.props = listenerProps;
       
 19711     responderInstance.fiber = fiber;
       
 19712   }
       
 19713 }
       
 19714 
       
 19715 function updateEventListeners(listeners, instance, rootContainerInstance, fiber) {
       
 19716   var visistedResponders = new Set();
       
 19717   var dependencies = fiber.dependencies;
       
 19718   if (listeners != null) {
       
 19719     if (dependencies === null) {
       
 19720       dependencies = fiber.dependencies = {
       
 19721         expirationTime: NoWork,
       
 19722         firstContext: null,
       
 19723         responders: new Map()
       
 19724       };
       
 19725     }
       
 19726     var respondersMap = dependencies.responders;
       
 19727     if (respondersMap === null) {
       
 19728       respondersMap = new Map();
       
 19729     }
       
 19730     if (isArray$2(listeners)) {
       
 19731       for (var i = 0, length = listeners.length; i < length; i++) {
       
 19732         var listener = listeners[i];
       
 19733         updateEventListener(listener, fiber, visistedResponders, respondersMap, instance, rootContainerInstance);
       
 19734       }
       
 19735     } else {
       
 19736       updateEventListener(listeners, fiber, visistedResponders, respondersMap, instance, rootContainerInstance);
       
 19737     }
       
 19738   }
       
 19739   if (dependencies !== null) {
       
 19740     var _respondersMap = dependencies.responders;
       
 19741     if (_respondersMap !== null) {
       
 19742       // Unmount
       
 19743       var mountedResponders = Array.from(_respondersMap.keys());
       
 19744       for (var _i = 0, _length = mountedResponders.length; _i < _length; _i++) {
       
 19745         var mountedResponder = mountedResponders[_i];
       
 19746         if (!visistedResponders.has(mountedResponder)) {
       
 19747           var responderInstance = _respondersMap.get(mountedResponder);
       
 19748           unmountResponderInstance(responderInstance);
       
 19749           _respondersMap.delete(mountedResponder);
       
 19750         }
       
 19751       }
       
 19752     }
       
 19753   }
       
 19754 }
       
 19755 
       
 19756 function unwindWork(workInProgress, renderExpirationTime) {
       
 19757   switch (workInProgress.tag) {
       
 19758     case ClassComponent:
       
 19759       {
       
 19760         var Component = workInProgress.type;
       
 19761         if (isContextProvider(Component)) {
       
 19762           popContext(workInProgress);
       
 19763         }
       
 19764         var effectTag = workInProgress.effectTag;
       
 19765         if (effectTag & ShouldCapture) {
       
 19766           workInProgress.effectTag = effectTag & ~ShouldCapture | DidCapture;
       
 19767           return workInProgress;
       
 19768         }
       
 19769         return null;
       
 19770       }
       
 19771     case HostRoot:
       
 19772       {
       
 19773         popHostContainer(workInProgress);
       
 19774         popTopLevelContextObject(workInProgress);
       
 19775         var _effectTag = workInProgress.effectTag;
       
 19776         (function () {
       
 19777           if (!((_effectTag & DidCapture) === NoEffect)) {
 19507           if (!((_effectTag & DidCapture) === NoEffect)) {
 19778             {
 19508             {
 19779               throw ReactError(Error('The root failed to unmount after an error. This is likely a bug in React. Please file an issue.'));
 19509               throw Error( "The root failed to unmount after an error. This is likely a bug in React. Please file an issue." );
 19780             }
 19510             }
 19781           }
 19511           }
 19782         })();
 19512 
 19783         workInProgress.effectTag = _effectTag & ~ShouldCapture | DidCapture;
 19513           workInProgress.effectTag = _effectTag & ~ShouldCapture | DidCapture;
 19784         return workInProgress;
       
 19785       }
       
 19786     case HostComponent:
       
 19787       {
       
 19788         // TODO: popHydrationState
       
 19789         popHostContext(workInProgress);
       
 19790         return null;
       
 19791       }
       
 19792     case SuspenseComponent:
       
 19793       {
       
 19794         popSuspenseContext(workInProgress);
       
 19795         var _effectTag2 = workInProgress.effectTag;
       
 19796         if (_effectTag2 & ShouldCapture) {
       
 19797           workInProgress.effectTag = _effectTag2 & ~ShouldCapture | DidCapture;
       
 19798           // Captured a suspense effect. Re-render the boundary.
       
 19799           return workInProgress;
 19514           return workInProgress;
 19800         }
 19515         }
 19801         return null;
 19516 
 19802       }
 19517       case HostComponent:
 19803     case DehydratedSuspenseComponent:
 19518         {
 19804       {
       
 19805         if (enableSuspenseServerRenderer) {
       
 19806           // TODO: popHydrationState
 19519           // TODO: popHydrationState
       
 19520           popHostContext(workInProgress);
       
 19521           return null;
       
 19522         }
       
 19523 
       
 19524       case SuspenseComponent:
       
 19525         {
 19807           popSuspenseContext(workInProgress);
 19526           popSuspenseContext(workInProgress);
 19808           var _effectTag3 = workInProgress.effectTag;
 19527 
 19809           if (_effectTag3 & ShouldCapture) {
 19528           var _effectTag2 = workInProgress.effectTag;
 19810             workInProgress.effectTag = _effectTag3 & ~ShouldCapture | DidCapture;
 19529 
 19811             // Captured a suspense effect. Re-render the boundary.
 19530           if (_effectTag2 & ShouldCapture) {
       
 19531             workInProgress.effectTag = _effectTag2 & ~ShouldCapture | DidCapture; // Captured a suspense effect. Re-render the boundary.
       
 19532 
 19812             return workInProgress;
 19533             return workInProgress;
 19813           }
 19534           }
 19814         }
 19535 
       
 19536           return null;
       
 19537         }
       
 19538 
       
 19539       case SuspenseListComponent:
       
 19540         {
       
 19541           popSuspenseContext(workInProgress); // SuspenseList doesn't actually catch anything. It should've been
       
 19542           // caught by a nested boundary. If not, it should bubble through.
       
 19543 
       
 19544           return null;
       
 19545         }
       
 19546 
       
 19547       case HostPortal:
       
 19548         popHostContainer(workInProgress);
 19815         return null;
 19549         return null;
 19816       }
 19550 
 19817     case SuspenseListComponent:
 19551       case ContextProvider:
 19818       {
 19552         popProvider(workInProgress);
 19819         popSuspenseContext(workInProgress);
       
 19820         // SuspenseList doesn't actually catch anything. It should've been
       
 19821         // caught by a nested boundary. If not, it should bubble through.
       
 19822         return null;
 19553         return null;
 19823       }
 19554 
 19824     case HostPortal:
 19555       default:
 19825       popHostContainer(workInProgress);
 19556         return null;
 19826       return null;
 19557     }
 19827     case ContextProvider:
 19558   }
 19828       popProvider(workInProgress);
 19559 
 19829       return null;
 19560   function unwindInterruptedWork(interruptedWork) {
 19830     default:
 19561     switch (interruptedWork.tag) {
 19831       return null;
 19562       case ClassComponent:
 19832   }
 19563         {
 19833 }
 19564           var childContextTypes = interruptedWork.type.childContextTypes;
 19834 
 19565 
 19835 function unwindInterruptedWork(interruptedWork) {
 19566           if (childContextTypes !== null && childContextTypes !== undefined) {
 19836   switch (interruptedWork.tag) {
 19567             popContext(interruptedWork);
 19837     case ClassComponent:
 19568           }
 19838       {
 19569 
 19839         var childContextTypes = interruptedWork.type.childContextTypes;
 19570           break;
 19840         if (childContextTypes !== null && childContextTypes !== undefined) {
 19571         }
 19841           popContext(interruptedWork);
 19572 
 19842         }
 19573       case HostRoot:
       
 19574         {
       
 19575           popHostContainer(interruptedWork);
       
 19576           popTopLevelContextObject(interruptedWork);
       
 19577           break;
       
 19578         }
       
 19579 
       
 19580       case HostComponent:
       
 19581         {
       
 19582           popHostContext(interruptedWork);
       
 19583           break;
       
 19584         }
       
 19585 
       
 19586       case HostPortal:
       
 19587         popHostContainer(interruptedWork);
 19843         break;
 19588         break;
 19844       }
 19589 
 19845     case HostRoot:
 19590       case SuspenseComponent:
 19846       {
 19591         popSuspenseContext(interruptedWork);
 19847         popHostContainer(interruptedWork);
       
 19848         popTopLevelContextObject(interruptedWork);
       
 19849         break;
 19592         break;
 19850       }
 19593 
 19851     case HostComponent:
 19594       case SuspenseListComponent:
 19852       {
 19595         popSuspenseContext(interruptedWork);
 19853         popHostContext(interruptedWork);
       
 19854         break;
 19596         break;
 19855       }
 19597 
 19856     case HostPortal:
 19598       case ContextProvider:
 19857       popHostContainer(interruptedWork);
 19599         popProvider(interruptedWork);
 19858       break;
 19600         break;
 19859     case SuspenseComponent:
 19601     }
 19860       popSuspenseContext(interruptedWork);
 19602   }
 19861       break;
 19603 
 19862     case DehydratedSuspenseComponent:
 19604   function createCapturedValue(value, source) {
 19863       if (enableSuspenseServerRenderer) {
 19605     // If the value is an error, call this function immediately after it is thrown
 19864         // TODO: popHydrationState
 19606     // so the stack is accurate.
 19865         popSuspenseContext(interruptedWork);
 19607     return {
 19866       }
 19608       value: value,
 19867       break;
 19609       source: source,
 19868     case SuspenseListComponent:
 19610       stack: getStackByFiberInDevAndProd(source)
 19869       popSuspenseContext(interruptedWork);
 19611     };
 19870       break;
 19612   }
 19871     case ContextProvider:
 19613 
 19872       popProvider(interruptedWork);
 19614   function logCapturedError(capturedError) {
 19873       break;
 19615 
 19874     default:
 19616     var error = capturedError.error;
 19875       break;
 19617 
 19876   }
 19618     {
 19877 }
 19619       var componentName = capturedError.componentName,
 19878 
 19620           componentStack = capturedError.componentStack,
 19879 function createCapturedValue(value, source) {
 19621           errorBoundaryName = capturedError.errorBoundaryName,
 19880   // If the value is an error, call this function immediately after it is thrown
 19622           errorBoundaryFound = capturedError.errorBoundaryFound,
 19881   // so the stack is accurate.
 19623           willRetry = capturedError.willRetry; // Browsers support silencing uncaught errors by calling
 19882   return {
 19624       // `preventDefault()` in window `error` handler.
 19883     value: value,
 19625       // We record this information as an expando on the error.
 19884     source: source,
 19626 
 19885     stack: getStackByFiberInDevAndProd(source)
 19627       if (error != null && error._suppressLogging) {
 19886   };
 19628         if (errorBoundaryFound && willRetry) {
 19887 }
 19629           // The error is recoverable and was silenced.
 19888 
 19630           // Ignore it and don't print the stack addendum.
 19889 // This module is forked in different environments.
 19631           // This is handy for testing error boundaries without noise.
 19890 // By default, return `true` to log errors to the console.
 19632           return;
 19891 // Forks can return `false` if this isn't desirable.
 19633         } // The error is fatal. Since the silencing might have
 19892 function showErrorDialog(capturedError) {
 19634         // been accidental, we'll surface it anyway.
 19893   return true;
 19635         // However, the browser would have silenced the original error
 19894 }
 19636         // so we'll print it first, and then print the stack addendum.
 19895 
 19637 
 19896 function logCapturedError(capturedError) {
 19638 
 19897   var logError = showErrorDialog(capturedError);
 19639         console['error'](error); // Don't transform to our wrapper
 19898 
 19640         // For a more detailed description of this block, see:
 19899   // Allow injected showErrorDialog() to prevent default console.error logging.
 19641         // https://github.com/facebook/react/pull/13384
 19900   // This enables renderers like ReactNative to better manage redbox behavior.
 19642       }
 19901   if (logError === false) {
 19643 
 19902     return;
 19644       var componentNameMessage = componentName ? "The above error occurred in the <" + componentName + "> component:" : 'The above error occurred in one of your React components:';
 19903   }
 19645       var errorBoundaryMessage; // errorBoundaryFound check is sufficient; errorBoundaryName check is to satisfy Flow.
 19904 
 19646 
 19905   var error = capturedError.error;
 19647       if (errorBoundaryFound && errorBoundaryName) {
       
 19648         if (willRetry) {
       
 19649           errorBoundaryMessage = "React will try to recreate this component tree from scratch " + ("using the error boundary you provided, " + errorBoundaryName + ".");
       
 19650         } else {
       
 19651           errorBoundaryMessage = "This error was initially handled by the error boundary " + errorBoundaryName + ".\n" + "Recreating the tree from scratch failed so React will unmount the tree.";
       
 19652         }
       
 19653       } else {
       
 19654         errorBoundaryMessage = 'Consider adding an error boundary to your tree to customize error handling behavior.\n' + 'Visit https://fb.me/react-error-boundaries to learn more about error boundaries.';
       
 19655       }
       
 19656 
       
 19657       var combinedMessage = "" + componentNameMessage + componentStack + "\n\n" + ("" + errorBoundaryMessage); // In development, we provide our own message with just the component stack.
       
 19658       // We don't include the original error message and JS stack because the browser
       
 19659       // has already printed it. Even if the application swallows the error, it is still
       
 19660       // displayed by the browser thanks to the DEV-only fake event trick in ReactErrorUtils.
       
 19661 
       
 19662       console['error'](combinedMessage); // Don't transform to our wrapper
       
 19663     }
       
 19664   }
       
 19665 
       
 19666   var didWarnAboutUndefinedSnapshotBeforeUpdate = null;
       
 19667 
 19906   {
 19668   {
 19907     var componentName = capturedError.componentName,
 19669     didWarnAboutUndefinedSnapshotBeforeUpdate = new Set();
 19908         componentStack = capturedError.componentStack,
 19670   }
 19909         errorBoundaryName = capturedError.errorBoundaryName,
 19671 
 19910         errorBoundaryFound = capturedError.errorBoundaryFound,
 19672   var PossiblyWeakSet = typeof WeakSet === 'function' ? WeakSet : Set;
 19911         willRetry = capturedError.willRetry;
 19673   function logError(boundary, errorInfo) {
 19912 
 19674     var source = errorInfo.source;
 19913     // Browsers support silencing uncaught errors by calling
 19675     var stack = errorInfo.stack;
 19914     // `preventDefault()` in window `error` handler.
 19676 
 19915     // We record this information as an expando on the error.
 19677     if (stack === null && source !== null) {
 19916 
 19678       stack = getStackByFiberInDevAndProd(source);
 19917     if (error != null && error._suppressLogging) {
 19679     }
 19918       if (errorBoundaryFound && willRetry) {
 19680 
 19919         // The error is recoverable and was silenced.
 19681     var capturedError = {
 19920         // Ignore it and don't print the stack addendum.
 19682       componentName: source !== null ? getComponentName(source.type) : null,
 19921         // This is handy for testing error boundaries without noise.
 19683       componentStack: stack !== null ? stack : '',
 19922         return;
 19684       error: errorInfo.value,
 19923       }
 19685       errorBoundary: null,
 19924       // The error is fatal. Since the silencing might have
 19686       errorBoundaryName: null,
 19925       // been accidental, we'll surface it anyway.
 19687       errorBoundaryFound: false,
 19926       // However, the browser would have silenced the original error
 19688       willRetry: false
 19927       // so we'll print it first, and then print the stack addendum.
 19689     };
 19928       console.error(error);
 19690 
 19929       // For a more detailed description of this block, see:
 19691     if (boundary !== null && boundary.tag === ClassComponent) {
 19930       // https://github.com/facebook/react/pull/13384
 19692       capturedError.errorBoundary = boundary.stateNode;
 19931     }
 19693       capturedError.errorBoundaryName = getComponentName(boundary.type);
 19932 
 19694       capturedError.errorBoundaryFound = true;
 19933     var componentNameMessage = componentName ? 'The above error occurred in the <' + componentName + '> component:' : 'The above error occurred in one of your React components:';
 19695       capturedError.willRetry = true;
 19934 
 19696     }
 19935     var errorBoundaryMessage = void 0;
 19697 
 19936     // errorBoundaryFound check is sufficient; errorBoundaryName check is to satisfy Flow.
 19698     try {
 19937     if (errorBoundaryFound && errorBoundaryName) {
 19699       logCapturedError(capturedError);
 19938       if (willRetry) {
 19700     } catch (e) {
 19939         errorBoundaryMessage = 'React will try to recreate this component tree from scratch ' + ('using the error boundary you provided, ' + errorBoundaryName + '.');
 19701       // This method must not throw, or React internal state will get messed up.
       
 19702       // If console.error is overridden, or logCapturedError() shows a dialog that throws,
       
 19703       // we want to report this error outside of the normal stack as a last resort.
       
 19704       // https://github.com/facebook/react/issues/13188
       
 19705       setTimeout(function () {
       
 19706         throw e;
       
 19707       });
       
 19708     }
       
 19709   }
       
 19710 
       
 19711   var callComponentWillUnmountWithTimer = function (current, instance) {
       
 19712     startPhaseTimer(current, 'componentWillUnmount');
       
 19713     instance.props = current.memoizedProps;
       
 19714     instance.state = current.memoizedState;
       
 19715     instance.componentWillUnmount();
       
 19716     stopPhaseTimer();
       
 19717   }; // Capture errors so they don't interrupt unmounting.
       
 19718 
       
 19719 
       
 19720   function safelyCallComponentWillUnmount(current, instance) {
       
 19721     {
       
 19722       invokeGuardedCallback(null, callComponentWillUnmountWithTimer, null, current, instance);
       
 19723 
       
 19724       if (hasCaughtError()) {
       
 19725         var unmountError = clearCaughtError();
       
 19726         captureCommitPhaseError(current, unmountError);
       
 19727       }
       
 19728     }
       
 19729   }
       
 19730 
       
 19731   function safelyDetachRef(current) {
       
 19732     var ref = current.ref;
       
 19733 
       
 19734     if (ref !== null) {
       
 19735       if (typeof ref === 'function') {
       
 19736         {
       
 19737           invokeGuardedCallback(null, ref, null, null);
       
 19738 
       
 19739           if (hasCaughtError()) {
       
 19740             var refError = clearCaughtError();
       
 19741             captureCommitPhaseError(current, refError);
       
 19742           }
       
 19743         }
 19940       } else {
 19744       } else {
 19941         errorBoundaryMessage = 'This error was initially handled by the error boundary ' + errorBoundaryName + '.\n' + 'Recreating the tree from scratch failed so React will unmount the tree.';
 19745         ref.current = null;
 19942       }
 19746       }
 19943     } else {
 19747     }
 19944       errorBoundaryMessage = 'Consider adding an error boundary to your tree to customize error handling behavior.\n' + 'Visit https://fb.me/react-error-boundaries to learn more about error boundaries.';
 19748   }
 19945     }
 19749 
 19946     var combinedMessage = '' + componentNameMessage + componentStack + '\n\n' + ('' + errorBoundaryMessage);
 19750   function safelyCallDestroy(current, destroy) {
 19947 
 19751     {
 19948     // In development, we provide our own message with just the component stack.
 19752       invokeGuardedCallback(null, destroy, null);
 19949     // We don't include the original error message and JS stack because the browser
 19753 
 19950     // has already printed it. Even if the application swallows the error, it is still
 19754       if (hasCaughtError()) {
 19951     // displayed by the browser thanks to the DEV-only fake event trick in ReactErrorUtils.
 19755         var error = clearCaughtError();
 19952     console.error(combinedMessage);
 19756         captureCommitPhaseError(current, error);
 19953   }
 19757       }
 19954 }
 19758     }
 19955 
 19759   }
 19956 var didWarnAboutUndefinedSnapshotBeforeUpdate = null;
 19760 
 19957 {
 19761   function commitBeforeMutationLifeCycles(current, finishedWork) {
 19958   didWarnAboutUndefinedSnapshotBeforeUpdate = new Set();
       
 19959 }
       
 19960 
       
 19961 var PossiblyWeakSet$1 = typeof WeakSet === 'function' ? WeakSet : Set;
       
 19962 
       
 19963 function logError(boundary, errorInfo) {
       
 19964   var source = errorInfo.source;
       
 19965   var stack = errorInfo.stack;
       
 19966   if (stack === null && source !== null) {
       
 19967     stack = getStackByFiberInDevAndProd(source);
       
 19968   }
       
 19969 
       
 19970   var capturedError = {
       
 19971     componentName: source !== null ? getComponentName(source.type) : null,
       
 19972     componentStack: stack !== null ? stack : '',
       
 19973     error: errorInfo.value,
       
 19974     errorBoundary: null,
       
 19975     errorBoundaryName: null,
       
 19976     errorBoundaryFound: false,
       
 19977     willRetry: false
       
 19978   };
       
 19979 
       
 19980   if (boundary !== null && boundary.tag === ClassComponent) {
       
 19981     capturedError.errorBoundary = boundary.stateNode;
       
 19982     capturedError.errorBoundaryName = getComponentName(boundary.type);
       
 19983     capturedError.errorBoundaryFound = true;
       
 19984     capturedError.willRetry = true;
       
 19985   }
       
 19986 
       
 19987   try {
       
 19988     logCapturedError(capturedError);
       
 19989   } catch (e) {
       
 19990     // This method must not throw, or React internal state will get messed up.
       
 19991     // If console.error is overridden, or logCapturedError() shows a dialog that throws,
       
 19992     // we want to report this error outside of the normal stack as a last resort.
       
 19993     // https://github.com/facebook/react/issues/13188
       
 19994     setTimeout(function () {
       
 19995       throw e;
       
 19996     });
       
 19997   }
       
 19998 }
       
 19999 
       
 20000 var callComponentWillUnmountWithTimer = function (current$$1, instance) {
       
 20001   startPhaseTimer(current$$1, 'componentWillUnmount');
       
 20002   instance.props = current$$1.memoizedProps;
       
 20003   instance.state = current$$1.memoizedState;
       
 20004   instance.componentWillUnmount();
       
 20005   stopPhaseTimer();
       
 20006 };
       
 20007 
       
 20008 // Capture errors so they don't interrupt unmounting.
       
 20009 function safelyCallComponentWillUnmount(current$$1, instance) {
       
 20010   {
       
 20011     invokeGuardedCallback(null, callComponentWillUnmountWithTimer, null, current$$1, instance);
       
 20012     if (hasCaughtError()) {
       
 20013       var unmountError = clearCaughtError();
       
 20014       captureCommitPhaseError(current$$1, unmountError);
       
 20015     }
       
 20016   }
       
 20017 }
       
 20018 
       
 20019 function safelyDetachRef(current$$1) {
       
 20020   var ref = current$$1.ref;
       
 20021   if (ref !== null) {
       
 20022     if (typeof ref === 'function') {
       
 20023       {
       
 20024         invokeGuardedCallback(null, ref, null, null);
       
 20025         if (hasCaughtError()) {
       
 20026           var refError = clearCaughtError();
       
 20027           captureCommitPhaseError(current$$1, refError);
       
 20028         }
       
 20029       }
       
 20030     } else {
       
 20031       ref.current = null;
       
 20032     }
       
 20033   }
       
 20034 }
       
 20035 
       
 20036 function safelyCallDestroy(current$$1, destroy) {
       
 20037   {
       
 20038     invokeGuardedCallback(null, destroy, null);
       
 20039     if (hasCaughtError()) {
       
 20040       var error = clearCaughtError();
       
 20041       captureCommitPhaseError(current$$1, error);
       
 20042     }
       
 20043   }
       
 20044 }
       
 20045 
       
 20046 function commitBeforeMutationLifeCycles(current$$1, finishedWork) {
       
 20047   switch (finishedWork.tag) {
       
 20048     case FunctionComponent:
       
 20049     case ForwardRef:
       
 20050     case SimpleMemoComponent:
       
 20051       {
       
 20052         commitHookEffectList(UnmountSnapshot, NoEffect$1, finishedWork);
       
 20053         return;
       
 20054       }
       
 20055     case ClassComponent:
       
 20056       {
       
 20057         if (finishedWork.effectTag & Snapshot) {
       
 20058           if (current$$1 !== null) {
       
 20059             var prevProps = current$$1.memoizedProps;
       
 20060             var prevState = current$$1.memoizedState;
       
 20061             startPhaseTimer(finishedWork, 'getSnapshotBeforeUpdate');
       
 20062             var instance = finishedWork.stateNode;
       
 20063             // We could update instance props and state here,
       
 20064             // but instead we rely on them being set during last render.
       
 20065             // TODO: revisit this when we implement resuming.
       
 20066             {
       
 20067               if (finishedWork.type === finishedWork.elementType && !didWarnAboutReassigningProps) {
       
 20068                 !(instance.props === finishedWork.memoizedProps) ? warning$1(false, 'Expected %s props to match memoized props before ' + 'getSnapshotBeforeUpdate. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.props`. ' + 'Please file an issue.', getComponentName(finishedWork.type) || 'instance') : void 0;
       
 20069                 !(instance.state === finishedWork.memoizedState) ? warning$1(false, 'Expected %s state to match memoized state before ' + 'getSnapshotBeforeUpdate. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.props`. ' + 'Please file an issue.', getComponentName(finishedWork.type) || 'instance') : void 0;
       
 20070               }
       
 20071             }
       
 20072             var snapshot = instance.getSnapshotBeforeUpdate(finishedWork.elementType === finishedWork.type ? prevProps : resolveDefaultProps(finishedWork.type, prevProps), prevState);
       
 20073             {
       
 20074               var didWarnSet = didWarnAboutUndefinedSnapshotBeforeUpdate;
       
 20075               if (snapshot === undefined && !didWarnSet.has(finishedWork.type)) {
       
 20076                 didWarnSet.add(finishedWork.type);
       
 20077                 warningWithoutStack$1(false, '%s.getSnapshotBeforeUpdate(): A snapshot value (or null) ' + 'must be returned. You have returned undefined.', getComponentName(finishedWork.type));
       
 20078               }
       
 20079             }
       
 20080             instance.__reactInternalSnapshotBeforeUpdate = snapshot;
       
 20081             stopPhaseTimer();
       
 20082           }
       
 20083         }
       
 20084         return;
       
 20085       }
       
 20086     case HostRoot:
       
 20087     case HostComponent:
       
 20088     case HostText:
       
 20089     case HostPortal:
       
 20090     case IncompleteClassComponent:
       
 20091       // Nothing to do for these component types
       
 20092       return;
       
 20093     default:
       
 20094       {
       
 20095         (function () {
       
 20096           {
       
 20097             {
       
 20098               throw ReactError(Error('This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue.'));
       
 20099             }
       
 20100           }
       
 20101         })();
       
 20102       }
       
 20103   }
       
 20104 }
       
 20105 
       
 20106 function commitHookEffectList(unmountTag, mountTag, finishedWork) {
       
 20107   var updateQueue = finishedWork.updateQueue;
       
 20108   var lastEffect = updateQueue !== null ? updateQueue.lastEffect : null;
       
 20109   if (lastEffect !== null) {
       
 20110     var firstEffect = lastEffect.next;
       
 20111     var effect = firstEffect;
       
 20112     do {
       
 20113       if ((effect.tag & unmountTag) !== NoEffect$1) {
       
 20114         // Unmount
       
 20115         var destroy = effect.destroy;
       
 20116         effect.destroy = undefined;
       
 20117         if (destroy !== undefined) {
       
 20118           destroy();
       
 20119         }
       
 20120       }
       
 20121       if ((effect.tag & mountTag) !== NoEffect$1) {
       
 20122         // Mount
       
 20123         var create = effect.create;
       
 20124         effect.destroy = create();
       
 20125 
       
 20126         {
       
 20127           var _destroy = effect.destroy;
       
 20128           if (_destroy !== undefined && typeof _destroy !== 'function') {
       
 20129             var addendum = void 0;
       
 20130             if (_destroy === null) {
       
 20131               addendum = ' You returned null. If your effect does not require clean ' + 'up, return undefined (or nothing).';
       
 20132             } else if (typeof _destroy.then === 'function') {
       
 20133               addendum = '\n\nIt looks like you wrote useEffect(async () => ...) or returned a Promise. ' + 'Instead, write the async function inside your effect ' + 'and call it immediately:\n\n' + 'useEffect(() => {\n' + '  async function fetchData() {\n' + '    // You can await here\n' + '    const response = await MyAPI.getData(someId);\n' + '    // ...\n' + '  }\n' + '  fetchData();\n' + '}, [someId]); // Or [] if effect doesn\'t need props or state\n\n' + 'Learn more about data fetching with Hooks: https://fb.me/react-hooks-data-fetching';
       
 20134             } else {
       
 20135               addendum = ' You returned: ' + _destroy;
       
 20136             }
       
 20137             warningWithoutStack$1(false, 'An effect function must not return anything besides a function, ' + 'which is used for clean-up.%s%s', addendum, getStackByFiberInDevAndProd(finishedWork));
       
 20138           }
       
 20139         }
       
 20140       }
       
 20141       effect = effect.next;
       
 20142     } while (effect !== firstEffect);
       
 20143   }
       
 20144 }
       
 20145 
       
 20146 function commitPassiveHookEffects(finishedWork) {
       
 20147   if ((finishedWork.effectTag & Passive) !== NoEffect) {
       
 20148     switch (finishedWork.tag) {
 19762     switch (finishedWork.tag) {
 20149       case FunctionComponent:
 19763       case FunctionComponent:
 20150       case ForwardRef:
 19764       case ForwardRef:
 20151       case SimpleMemoComponent:
 19765       case SimpleMemoComponent:
       
 19766       case Block:
 20152         {
 19767         {
 20153           commitHookEffectList(UnmountPassive, NoEffect$1, finishedWork);
 19768           return;
 20154           commitHookEffectList(NoEffect$1, MountPassive, finishedWork);
 19769         }
 20155           break;
 19770 
 20156         }
 19771       case ClassComponent:
 20157       default:
 19772         {
 20158         break;
 19773           if (finishedWork.effectTag & Snapshot) {
 20159     }
 19774             if (current !== null) {
 20160   }
 19775               var prevProps = current.memoizedProps;
 20161 }
 19776               var prevState = current.memoizedState;
 20162 
 19777               startPhaseTimer(finishedWork, 'getSnapshotBeforeUpdate');
 20163 function commitLifeCycles(finishedRoot, current$$1, finishedWork, committedExpirationTime) {
 19778               var instance = finishedWork.stateNode; // We could update instance props and state here,
 20164   switch (finishedWork.tag) {
 19779               // but instead we rely on them being set during last render.
 20165     case FunctionComponent:
 19780               // TODO: revisit this when we implement resuming.
 20166     case ForwardRef:
 19781 
 20167     case SimpleMemoComponent:
 19782               {
       
 19783                 if (finishedWork.type === finishedWork.elementType && !didWarnAboutReassigningProps) {
       
 19784                   if (instance.props !== finishedWork.memoizedProps) {
       
 19785                     error('Expected %s props to match memoized props before ' + 'getSnapshotBeforeUpdate. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.props`. ' + 'Please file an issue.', getComponentName(finishedWork.type) || 'instance');
       
 19786                   }
       
 19787 
       
 19788                   if (instance.state !== finishedWork.memoizedState) {
       
 19789                     error('Expected %s state to match memoized state before ' + 'getSnapshotBeforeUpdate. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.props`. ' + 'Please file an issue.', getComponentName(finishedWork.type) || 'instance');
       
 19790                   }
       
 19791                 }
       
 19792               }
       
 19793 
       
 19794               var snapshot = instance.getSnapshotBeforeUpdate(finishedWork.elementType === finishedWork.type ? prevProps : resolveDefaultProps(finishedWork.type, prevProps), prevState);
       
 19795 
       
 19796               {
       
 19797                 var didWarnSet = didWarnAboutUndefinedSnapshotBeforeUpdate;
       
 19798 
       
 19799                 if (snapshot === undefined && !didWarnSet.has(finishedWork.type)) {
       
 19800                   didWarnSet.add(finishedWork.type);
       
 19801 
       
 19802                   error('%s.getSnapshotBeforeUpdate(): A snapshot value (or null) ' + 'must be returned. You have returned undefined.', getComponentName(finishedWork.type));
       
 19803                 }
       
 19804               }
       
 19805 
       
 19806               instance.__reactInternalSnapshotBeforeUpdate = snapshot;
       
 19807               stopPhaseTimer();
       
 19808             }
       
 19809           }
       
 19810 
       
 19811           return;
       
 19812         }
       
 19813 
       
 19814       case HostRoot:
       
 19815       case HostComponent:
       
 19816       case HostText:
       
 19817       case HostPortal:
       
 19818       case IncompleteClassComponent:
       
 19819         // Nothing to do for these component types
       
 19820         return;
       
 19821     }
       
 19822 
       
 19823     {
 20168       {
 19824       {
 20169         commitHookEffectList(UnmountLayout, MountLayout, finishedWork);
 19825         throw Error( "This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue." );
 20170         break;
 19826       }
 20171       }
 19827     }
 20172     case ClassComponent:
 19828   }
 20173       {
 19829 
 20174         var instance = finishedWork.stateNode;
 19830   function commitHookEffectListUnmount(tag, finishedWork) {
 20175         if (finishedWork.effectTag & Update) {
 19831     var updateQueue = finishedWork.updateQueue;
 20176           if (current$$1 === null) {
 19832     var lastEffect = updateQueue !== null ? updateQueue.lastEffect : null;
 20177             startPhaseTimer(finishedWork, 'componentDidMount');
 19833 
 20178             // We could update instance props and state here,
 19834     if (lastEffect !== null) {
       
 19835       var firstEffect = lastEffect.next;
       
 19836       var effect = firstEffect;
       
 19837 
       
 19838       do {
       
 19839         if ((effect.tag & tag) === tag) {
       
 19840           // Unmount
       
 19841           var destroy = effect.destroy;
       
 19842           effect.destroy = undefined;
       
 19843 
       
 19844           if (destroy !== undefined) {
       
 19845             destroy();
       
 19846           }
       
 19847         }
       
 19848 
       
 19849         effect = effect.next;
       
 19850       } while (effect !== firstEffect);
       
 19851     }
       
 19852   }
       
 19853 
       
 19854   function commitHookEffectListMount(tag, finishedWork) {
       
 19855     var updateQueue = finishedWork.updateQueue;
       
 19856     var lastEffect = updateQueue !== null ? updateQueue.lastEffect : null;
       
 19857 
       
 19858     if (lastEffect !== null) {
       
 19859       var firstEffect = lastEffect.next;
       
 19860       var effect = firstEffect;
       
 19861 
       
 19862       do {
       
 19863         if ((effect.tag & tag) === tag) {
       
 19864           // Mount
       
 19865           var create = effect.create;
       
 19866           effect.destroy = create();
       
 19867 
       
 19868           {
       
 19869             var destroy = effect.destroy;
       
 19870 
       
 19871             if (destroy !== undefined && typeof destroy !== 'function') {
       
 19872               var addendum = void 0;
       
 19873 
       
 19874               if (destroy === null) {
       
 19875                 addendum = ' You returned null. If your effect does not require clean ' + 'up, return undefined (or nothing).';
       
 19876               } else if (typeof destroy.then === 'function') {
       
 19877                 addendum = '\n\nIt looks like you wrote useEffect(async () => ...) or returned a Promise. ' + 'Instead, write the async function inside your effect ' + 'and call it immediately:\n\n' + 'useEffect(() => {\n' + '  async function fetchData() {\n' + '    // You can await here\n' + '    const response = await MyAPI.getData(someId);\n' + '    // ...\n' + '  }\n' + '  fetchData();\n' + "}, [someId]); // Or [] if effect doesn't need props or state\n\n" + 'Learn more about data fetching with Hooks: https://fb.me/react-hooks-data-fetching';
       
 19878               } else {
       
 19879                 addendum = ' You returned: ' + destroy;
       
 19880               }
       
 19881 
       
 19882               error('An effect function must not return anything besides a function, ' + 'which is used for clean-up.%s%s', addendum, getStackByFiberInDevAndProd(finishedWork));
       
 19883             }
       
 19884           }
       
 19885         }
       
 19886 
       
 19887         effect = effect.next;
       
 19888       } while (effect !== firstEffect);
       
 19889     }
       
 19890   }
       
 19891 
       
 19892   function commitPassiveHookEffects(finishedWork) {
       
 19893     if ((finishedWork.effectTag & Passive) !== NoEffect) {
       
 19894       switch (finishedWork.tag) {
       
 19895         case FunctionComponent:
       
 19896         case ForwardRef:
       
 19897         case SimpleMemoComponent:
       
 19898         case Block:
       
 19899           {
       
 19900             // TODO (#17945) We should call all passive destroy functions (for all fibers)
       
 19901             // before calling any create functions. The current approach only serializes
       
 19902             // these for a single fiber.
       
 19903             commitHookEffectListUnmount(Passive$1 | HasEffect, finishedWork);
       
 19904             commitHookEffectListMount(Passive$1 | HasEffect, finishedWork);
       
 19905             break;
       
 19906           }
       
 19907       }
       
 19908     }
       
 19909   }
       
 19910 
       
 19911   function commitLifeCycles(finishedRoot, current, finishedWork, committedExpirationTime) {
       
 19912     switch (finishedWork.tag) {
       
 19913       case FunctionComponent:
       
 19914       case ForwardRef:
       
 19915       case SimpleMemoComponent:
       
 19916       case Block:
       
 19917         {
       
 19918           // At this point layout effects have already been destroyed (during mutation phase).
       
 19919           // This is done to prevent sibling component effects from interfering with each other,
       
 19920           // e.g. a destroy function in one component should never override a ref set
       
 19921           // by a create function in another component during the same commit.
       
 19922           commitHookEffectListMount(Layout | HasEffect, finishedWork);
       
 19923 
       
 19924           return;
       
 19925         }
       
 19926 
       
 19927       case ClassComponent:
       
 19928         {
       
 19929           var instance = finishedWork.stateNode;
       
 19930 
       
 19931           if (finishedWork.effectTag & Update) {
       
 19932             if (current === null) {
       
 19933               startPhaseTimer(finishedWork, 'componentDidMount'); // We could update instance props and state here,
       
 19934               // but instead we rely on them being set during last render.
       
 19935               // TODO: revisit this when we implement resuming.
       
 19936 
       
 19937               {
       
 19938                 if (finishedWork.type === finishedWork.elementType && !didWarnAboutReassigningProps) {
       
 19939                   if (instance.props !== finishedWork.memoizedProps) {
       
 19940                     error('Expected %s props to match memoized props before ' + 'componentDidMount. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.props`. ' + 'Please file an issue.', getComponentName(finishedWork.type) || 'instance');
       
 19941                   }
       
 19942 
       
 19943                   if (instance.state !== finishedWork.memoizedState) {
       
 19944                     error('Expected %s state to match memoized state before ' + 'componentDidMount. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.props`. ' + 'Please file an issue.', getComponentName(finishedWork.type) || 'instance');
       
 19945                   }
       
 19946                 }
       
 19947               }
       
 19948 
       
 19949               instance.componentDidMount();
       
 19950               stopPhaseTimer();
       
 19951             } else {
       
 19952               var prevProps = finishedWork.elementType === finishedWork.type ? current.memoizedProps : resolveDefaultProps(finishedWork.type, current.memoizedProps);
       
 19953               var prevState = current.memoizedState;
       
 19954               startPhaseTimer(finishedWork, 'componentDidUpdate'); // We could update instance props and state here,
       
 19955               // but instead we rely on them being set during last render.
       
 19956               // TODO: revisit this when we implement resuming.
       
 19957 
       
 19958               {
       
 19959                 if (finishedWork.type === finishedWork.elementType && !didWarnAboutReassigningProps) {
       
 19960                   if (instance.props !== finishedWork.memoizedProps) {
       
 19961                     error('Expected %s props to match memoized props before ' + 'componentDidUpdate. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.props`. ' + 'Please file an issue.', getComponentName(finishedWork.type) || 'instance');
       
 19962                   }
       
 19963 
       
 19964                   if (instance.state !== finishedWork.memoizedState) {
       
 19965                     error('Expected %s state to match memoized state before ' + 'componentDidUpdate. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.props`. ' + 'Please file an issue.', getComponentName(finishedWork.type) || 'instance');
       
 19966                   }
       
 19967                 }
       
 19968               }
       
 19969 
       
 19970               instance.componentDidUpdate(prevProps, prevState, instance.__reactInternalSnapshotBeforeUpdate);
       
 19971               stopPhaseTimer();
       
 19972             }
       
 19973           }
       
 19974 
       
 19975           var updateQueue = finishedWork.updateQueue;
       
 19976 
       
 19977           if (updateQueue !== null) {
       
 19978             {
       
 19979               if (finishedWork.type === finishedWork.elementType && !didWarnAboutReassigningProps) {
       
 19980                 if (instance.props !== finishedWork.memoizedProps) {
       
 19981                   error('Expected %s props to match memoized props before ' + 'processing the update queue. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.props`. ' + 'Please file an issue.', getComponentName(finishedWork.type) || 'instance');
       
 19982                 }
       
 19983 
       
 19984                 if (instance.state !== finishedWork.memoizedState) {
       
 19985                   error('Expected %s state to match memoized state before ' + 'processing the update queue. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.props`. ' + 'Please file an issue.', getComponentName(finishedWork.type) || 'instance');
       
 19986                 }
       
 19987               }
       
 19988             } // We could update instance props and state here,
 20179             // but instead we rely on them being set during last render.
 19989             // but instead we rely on them being set during last render.
 20180             // TODO: revisit this when we implement resuming.
 19990             // TODO: revisit this when we implement resuming.
 20181             {
 19991 
 20182               if (finishedWork.type === finishedWork.elementType && !didWarnAboutReassigningProps) {
 19992 
 20183                 !(instance.props === finishedWork.memoizedProps) ? warning$1(false, 'Expected %s props to match memoized props before ' + 'componentDidMount. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.props`. ' + 'Please file an issue.', getComponentName(finishedWork.type) || 'instance') : void 0;
 19993             commitUpdateQueue(finishedWork, updateQueue, instance);
 20184                 !(instance.state === finishedWork.memoizedState) ? warning$1(false, 'Expected %s state to match memoized state before ' + 'componentDidMount. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.props`. ' + 'Please file an issue.', getComponentName(finishedWork.type) || 'instance') : void 0;
 19994           }
       
 19995 
       
 19996           return;
       
 19997         }
       
 19998 
       
 19999       case HostRoot:
       
 20000         {
       
 20001           var _updateQueue = finishedWork.updateQueue;
       
 20002 
       
 20003           if (_updateQueue !== null) {
       
 20004             var _instance = null;
       
 20005 
       
 20006             if (finishedWork.child !== null) {
       
 20007               switch (finishedWork.child.tag) {
       
 20008                 case HostComponent:
       
 20009                   _instance = getPublicInstance(finishedWork.child.stateNode);
       
 20010                   break;
       
 20011 
       
 20012                 case ClassComponent:
       
 20013                   _instance = finishedWork.child.stateNode;
       
 20014                   break;
 20185               }
 20015               }
 20186             }
 20016             }
 20187             instance.componentDidMount();
 20017 
 20188             stopPhaseTimer();
 20018             commitUpdateQueue(finishedWork, _updateQueue, _instance);
 20189           } else {
 20019           }
 20190             var prevProps = finishedWork.elementType === finishedWork.type ? current$$1.memoizedProps : resolveDefaultProps(finishedWork.type, current$$1.memoizedProps);
 20020 
 20191             var prevState = current$$1.memoizedState;
 20021           return;
 20192             startPhaseTimer(finishedWork, 'componentDidUpdate');
 20022         }
 20193             // We could update instance props and state here,
 20023 
 20194             // but instead we rely on them being set during last render.
 20024       case HostComponent:
 20195             // TODO: revisit this when we implement resuming.
 20025         {
 20196             {
 20026           var _instance2 = finishedWork.stateNode; // Renderers may schedule work to be done after host components are mounted
 20197               if (finishedWork.type === finishedWork.elementType && !didWarnAboutReassigningProps) {
 20027           // (eg DOM renderer may schedule auto-focus for inputs and form controls).
 20198                 !(instance.props === finishedWork.memoizedProps) ? warning$1(false, 'Expected %s props to match memoized props before ' + 'componentDidUpdate. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.props`. ' + 'Please file an issue.', getComponentName(finishedWork.type) || 'instance') : void 0;
 20028           // These effects should only be committed when components are first mounted,
 20199                 !(instance.state === finishedWork.memoizedState) ? warning$1(false, 'Expected %s state to match memoized state before ' + 'componentDidUpdate. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.props`. ' + 'Please file an issue.', getComponentName(finishedWork.type) || 'instance') : void 0;
 20029           // aka when there is no current/alternate.
       
 20030 
       
 20031           if (current === null && finishedWork.effectTag & Update) {
       
 20032             var type = finishedWork.type;
       
 20033             var props = finishedWork.memoizedProps;
       
 20034             commitMount(_instance2, type, props);
       
 20035           }
       
 20036 
       
 20037           return;
       
 20038         }
       
 20039 
       
 20040       case HostText:
       
 20041         {
       
 20042           // We have no life-cycles associated with text.
       
 20043           return;
       
 20044         }
       
 20045 
       
 20046       case HostPortal:
       
 20047         {
       
 20048           // We have no life-cycles associated with portals.
       
 20049           return;
       
 20050         }
       
 20051 
       
 20052       case Profiler:
       
 20053         {
       
 20054           {
       
 20055             var onRender = finishedWork.memoizedProps.onRender;
       
 20056 
       
 20057             if (typeof onRender === 'function') {
       
 20058               {
       
 20059                 onRender(finishedWork.memoizedProps.id, current === null ? 'mount' : 'update', finishedWork.actualDuration, finishedWork.treeBaseDuration, finishedWork.actualStartTime, getCommitTime(), finishedRoot.memoizedInteractions);
 20200               }
 20060               }
 20201             }
 20061             }
 20202             instance.componentDidUpdate(prevProps, prevState, instance.__reactInternalSnapshotBeforeUpdate);
       
 20203             stopPhaseTimer();
       
 20204           }
 20062           }
 20205         }
 20063 
 20206         var updateQueue = finishedWork.updateQueue;
 20064           return;
 20207         if (updateQueue !== null) {
 20065         }
 20208           {
 20066 
 20209             if (finishedWork.type === finishedWork.elementType && !didWarnAboutReassigningProps) {
 20067       case SuspenseComponent:
 20210               !(instance.props === finishedWork.memoizedProps) ? warning$1(false, 'Expected %s props to match memoized props before ' + 'processing the update queue. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.props`. ' + 'Please file an issue.', getComponentName(finishedWork.type) || 'instance') : void 0;
 20068         {
 20211               !(instance.state === finishedWork.memoizedState) ? warning$1(false, 'Expected %s state to match memoized state before ' + 'processing the update queue. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.props`. ' + 'Please file an issue.', getComponentName(finishedWork.type) || 'instance') : void 0;
 20069           commitSuspenseHydrationCallbacks(finishedRoot, finishedWork);
       
 20070           return;
       
 20071         }
       
 20072 
       
 20073       case SuspenseListComponent:
       
 20074       case IncompleteClassComponent:
       
 20075       case FundamentalComponent:
       
 20076       case ScopeComponent:
       
 20077         return;
       
 20078     }
       
 20079 
       
 20080     {
       
 20081       {
       
 20082         throw Error( "This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue." );
       
 20083       }
       
 20084     }
       
 20085   }
       
 20086 
       
 20087   function hideOrUnhideAllChildren(finishedWork, isHidden) {
       
 20088     {
       
 20089       // We only have the top Fiber that was inserted but we need to recurse down its
       
 20090       // children to find all the terminal nodes.
       
 20091       var node = finishedWork;
       
 20092 
       
 20093       while (true) {
       
 20094         if (node.tag === HostComponent) {
       
 20095           var instance = node.stateNode;
       
 20096 
       
 20097           if (isHidden) {
       
 20098             hideInstance(instance);
       
 20099           } else {
       
 20100             unhideInstance(node.stateNode, node.memoizedProps);
       
 20101           }
       
 20102         } else if (node.tag === HostText) {
       
 20103           var _instance3 = node.stateNode;
       
 20104 
       
 20105           if (isHidden) {
       
 20106             hideTextInstance(_instance3);
       
 20107           } else {
       
 20108             unhideTextInstance(_instance3, node.memoizedProps);
       
 20109           }
       
 20110         } else if (node.tag === SuspenseComponent && node.memoizedState !== null && node.memoizedState.dehydrated === null) {
       
 20111           // Found a nested Suspense component that timed out. Skip over the
       
 20112           // primary child fragment, which should remain hidden.
       
 20113           var fallbackChildFragment = node.child.sibling;
       
 20114           fallbackChildFragment.return = node;
       
 20115           node = fallbackChildFragment;
       
 20116           continue;
       
 20117         } else if (node.child !== null) {
       
 20118           node.child.return = node;
       
 20119           node = node.child;
       
 20120           continue;
       
 20121         }
       
 20122 
       
 20123         if (node === finishedWork) {
       
 20124           return;
       
 20125         }
       
 20126 
       
 20127         while (node.sibling === null) {
       
 20128           if (node.return === null || node.return === finishedWork) {
       
 20129             return;
       
 20130           }
       
 20131 
       
 20132           node = node.return;
       
 20133         }
       
 20134 
       
 20135         node.sibling.return = node.return;
       
 20136         node = node.sibling;
       
 20137       }
       
 20138     }
       
 20139   }
       
 20140 
       
 20141   function commitAttachRef(finishedWork) {
       
 20142     var ref = finishedWork.ref;
       
 20143 
       
 20144     if (ref !== null) {
       
 20145       var instance = finishedWork.stateNode;
       
 20146       var instanceToUse;
       
 20147 
       
 20148       switch (finishedWork.tag) {
       
 20149         case HostComponent:
       
 20150           instanceToUse = getPublicInstance(instance);
       
 20151           break;
       
 20152 
       
 20153         default:
       
 20154           instanceToUse = instance;
       
 20155       } // Moved outside to ensure DCE works with this flag
       
 20156 
       
 20157       if (typeof ref === 'function') {
       
 20158         ref(instanceToUse);
       
 20159       } else {
       
 20160         {
       
 20161           if (!ref.hasOwnProperty('current')) {
       
 20162             error('Unexpected ref object provided for %s. ' + 'Use either a ref-setter function or React.createRef().%s', getComponentName(finishedWork.type), getStackByFiberInDevAndProd(finishedWork));
       
 20163           }
       
 20164         }
       
 20165 
       
 20166         ref.current = instanceToUse;
       
 20167       }
       
 20168     }
       
 20169   }
       
 20170 
       
 20171   function commitDetachRef(current) {
       
 20172     var currentRef = current.ref;
       
 20173 
       
 20174     if (currentRef !== null) {
       
 20175       if (typeof currentRef === 'function') {
       
 20176         currentRef(null);
       
 20177       } else {
       
 20178         currentRef.current = null;
       
 20179       }
       
 20180     }
       
 20181   } // User-originating errors (lifecycles and refs) should not interrupt
       
 20182   // deletion, so don't let them throw. Host-originating errors should
       
 20183   // interrupt deletion, so it's okay
       
 20184 
       
 20185 
       
 20186   function commitUnmount(finishedRoot, current, renderPriorityLevel) {
       
 20187     onCommitUnmount(current);
       
 20188 
       
 20189     switch (current.tag) {
       
 20190       case FunctionComponent:
       
 20191       case ForwardRef:
       
 20192       case MemoComponent:
       
 20193       case SimpleMemoComponent:
       
 20194       case Block:
       
 20195         {
       
 20196           var updateQueue = current.updateQueue;
       
 20197 
       
 20198           if (updateQueue !== null) {
       
 20199             var lastEffect = updateQueue.lastEffect;
       
 20200 
       
 20201             if (lastEffect !== null) {
       
 20202               var firstEffect = lastEffect.next;
       
 20203 
       
 20204               {
       
 20205                 // When the owner fiber is deleted, the destroy function of a passive
       
 20206                 // effect hook is called during the synchronous commit phase. This is
       
 20207                 // a concession to implementation complexity. Calling it in the
       
 20208                 // passive effect phase (like they usually are, when dependencies
       
 20209                 // change during an update) would require either traversing the
       
 20210                 // children of the deleted fiber again, or including unmount effects
       
 20211                 // as part of the fiber effect list.
       
 20212                 //
       
 20213                 // Because this is during the sync commit phase, we need to change
       
 20214                 // the priority.
       
 20215                 //
       
 20216                 // TODO: Reconsider this implementation trade off.
       
 20217                 var priorityLevel = renderPriorityLevel > NormalPriority ? NormalPriority : renderPriorityLevel;
       
 20218                 runWithPriority$1(priorityLevel, function () {
       
 20219                   var effect = firstEffect;
       
 20220 
       
 20221                   do {
       
 20222                     var _destroy = effect.destroy;
       
 20223 
       
 20224                     if (_destroy !== undefined) {
       
 20225                       safelyCallDestroy(current, _destroy);
       
 20226                     }
       
 20227 
       
 20228                     effect = effect.next;
       
 20229                   } while (effect !== firstEffect);
       
 20230                 });
       
 20231               }
 20212             }
 20232             }
 20213           }
 20233           }
 20214           // We could update instance props and state here,
 20234 
 20215           // but instead we rely on them being set during last render.
 20235           return;
 20216           // TODO: revisit this when we implement resuming.
 20236         }
 20217           commitUpdateQueue(finishedWork, updateQueue, instance, committedExpirationTime);
 20237 
 20218         }
 20238       case ClassComponent:
 20219         return;
 20239         {
 20220       }
 20240           safelyDetachRef(current);
 20221     case HostRoot:
 20241           var instance = current.stateNode;
 20222       {
 20242 
 20223         var _updateQueue = finishedWork.updateQueue;
 20243           if (typeof instance.componentWillUnmount === 'function') {
 20224         if (_updateQueue !== null) {
 20244             safelyCallComponentWillUnmount(current, instance);
 20225           var _instance = null;
       
 20226           if (finishedWork.child !== null) {
       
 20227             switch (finishedWork.child.tag) {
       
 20228               case HostComponent:
       
 20229                 _instance = getPublicInstance(finishedWork.child.stateNode);
       
 20230                 break;
       
 20231               case ClassComponent:
       
 20232                 _instance = finishedWork.child.stateNode;
       
 20233                 break;
       
 20234             }
       
 20235           }
 20245           }
 20236           commitUpdateQueue(finishedWork, _updateQueue, _instance, committedExpirationTime);
 20246 
 20237         }
 20247           return;
 20238         return;
 20248         }
 20239       }
 20249 
 20240     case HostComponent:
 20250       case HostComponent:
 20241       {
 20251         {
 20242         var _instance2 = finishedWork.stateNode;
 20252 
 20243 
 20253           safelyDetachRef(current);
 20244         // Renderers may schedule work to be done after host components are mounted
 20254           return;
 20245         // (eg DOM renderer may schedule auto-focus for inputs and form controls).
 20255         }
 20246         // These effects should only be committed when components are first mounted,
 20256 
 20247         // aka when there is no current/alternate.
 20257       case HostPortal:
 20248         if (current$$1 === null && finishedWork.effectTag & Update) {
 20258         {
 20249           var type = finishedWork.type;
 20259           // TODO: this is recursive.
 20250           var props = finishedWork.memoizedProps;
 20260           // We are also not using this parent because
 20251           commitMount(_instance2, type, props, finishedWork);
 20261           // the portal will get pushed immediately.
 20252         }
 20262           {
 20253 
 20263             unmountHostComponents(finishedRoot, current, renderPriorityLevel);
 20254         return;
       
 20255       }
       
 20256     case HostText:
       
 20257       {
       
 20258         // We have no life-cycles associated with text.
       
 20259         return;
       
 20260       }
       
 20261     case HostPortal:
       
 20262       {
       
 20263         // We have no life-cycles associated with portals.
       
 20264         return;
       
 20265       }
       
 20266     case Profiler:
       
 20267       {
       
 20268         if (enableProfilerTimer) {
       
 20269           var onRender = finishedWork.memoizedProps.onRender;
       
 20270 
       
 20271           if (typeof onRender === 'function') {
       
 20272             if (enableSchedulerTracing) {
       
 20273               onRender(finishedWork.memoizedProps.id, current$$1 === null ? 'mount' : 'update', finishedWork.actualDuration, finishedWork.treeBaseDuration, finishedWork.actualStartTime, getCommitTime(), finishedRoot.memoizedInteractions);
       
 20274             } else {
       
 20275               onRender(finishedWork.memoizedProps.id, current$$1 === null ? 'mount' : 'update', finishedWork.actualDuration, finishedWork.treeBaseDuration, finishedWork.actualStartTime, getCommitTime());
       
 20276             }
       
 20277           }
 20264           }
 20278         }
 20265 
 20279         return;
 20266           return;
 20280       }
 20267         }
 20281     case SuspenseComponent:
 20268 
 20282     case SuspenseListComponent:
 20269       case FundamentalComponent:
 20283     case IncompleteClassComponent:
 20270         {
 20284     case FundamentalComponent:
 20271 
 20285       return;
 20272           return;
 20286     default:
 20273         }
 20287       {
 20274 
 20288         (function () {
 20275       case DehydratedFragment:
 20289           {
 20276         {
 20290             {
 20277 
 20291               throw ReactError(Error('This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue.'));
 20278           return;
 20292             }
 20279         }
 20293           }
 20280 
 20294         })();
 20281       case ScopeComponent:
 20295       }
 20282         {
 20296   }
 20283 
 20297 }
 20284           return;
 20298 
 20285         }
 20299 function hideOrUnhideAllChildren(finishedWork, isHidden) {
 20286     }
 20300   if (supportsMutation) {
 20287   }
 20301     // We only have the top Fiber that was inserted but we need to recurse down its
 20288 
 20302     var node = finishedWork;
 20289   function commitNestedUnmounts(finishedRoot, root, renderPriorityLevel) {
       
 20290     // While we're inside a removed host node we don't want to call
       
 20291     // removeChild on the inner nodes because they're removed by the top
       
 20292     // call anyway. We also want to call componentWillUnmount on all
       
 20293     // composites before this host node is removed from the tree. Therefore
       
 20294     // we do an inner loop while we're still inside the host node.
       
 20295     var node = root;
       
 20296 
 20303     while (true) {
 20297     while (true) {
 20304       if (node.tag === HostComponent) {
 20298       commitUnmount(finishedRoot, node, renderPriorityLevel); // Visit children because they may contain more composite or host nodes.
 20305         var instance = node.stateNode;
 20299       // Skip portals because commitUnmount() currently visits them recursively.
 20306         if (isHidden) {
 20300 
 20307           hideInstance(instance);
 20301       if (node.child !== null && ( // If we use mutation we drill down into portals using commitUnmount above.
 20308         } else {
 20302       // If we don't use mutation we drill down into portals here instead.
 20309           unhideInstance(node.stateNode, node.memoizedProps);
 20303        node.tag !== HostPortal)) {
 20310         }
       
 20311       } else if (node.tag === HostText) {
       
 20312         var _instance3 = node.stateNode;
       
 20313         if (isHidden) {
       
 20314           hideTextInstance(_instance3);
       
 20315         } else {
       
 20316           unhideTextInstance(_instance3, node.memoizedProps);
       
 20317         }
       
 20318       } else if (node.tag === SuspenseComponent && node.memoizedState !== null) {
       
 20319         // Found a nested Suspense component that timed out. Skip over the
       
 20320         var fallbackChildFragment = node.child.sibling;
       
 20321         fallbackChildFragment.return = node;
       
 20322         node = fallbackChildFragment;
       
 20323         continue;
       
 20324       } else if (node.child !== null) {
       
 20325         node.child.return = node;
 20304         node.child.return = node;
 20326         node = node.child;
 20305         node = node.child;
 20327         continue;
 20306         continue;
 20328       }
 20307       }
 20329       if (node === finishedWork) {
 20308 
       
 20309       if (node === root) {
 20330         return;
 20310         return;
 20331       }
 20311       }
       
 20312 
 20332       while (node.sibling === null) {
 20313       while (node.sibling === null) {
 20333         if (node.return === null || node.return === finishedWork) {
 20314         if (node.return === null || node.return === root) {
 20334           return;
 20315           return;
 20335         }
 20316         }
       
 20317 
 20336         node = node.return;
 20318         node = node.return;
 20337       }
 20319       }
       
 20320 
 20338       node.sibling.return = node.return;
 20321       node.sibling.return = node.return;
 20339       node = node.sibling;
 20322       node = node.sibling;
 20340     }
 20323     }
 20341   }
 20324   }
 20342 }
 20325 
 20343 
 20326   function detachFiber(current) {
 20344 function commitAttachRef(finishedWork) {
 20327     var alternate = current.alternate; // Cut off the return pointers to disconnect it from the tree. Ideally, we
 20345   var ref = finishedWork.ref;
 20328     // should clear the child pointer of the parent alternate to let this
 20346   if (ref !== null) {
 20329     // get GC:ed but we don't know which for sure which parent is the current
 20347     var instance = finishedWork.stateNode;
 20330     // one so we'll settle for GC:ing the subtree of this child. This child
 20348     var instanceToUse = void 0;
 20331     // itself will be GC:ed when the parent updates the next time.
 20349     switch (finishedWork.tag) {
 20332 
       
 20333     current.return = null;
       
 20334     current.child = null;
       
 20335     current.memoizedState = null;
       
 20336     current.updateQueue = null;
       
 20337     current.dependencies = null;
       
 20338     current.alternate = null;
       
 20339     current.firstEffect = null;
       
 20340     current.lastEffect = null;
       
 20341     current.pendingProps = null;
       
 20342     current.memoizedProps = null;
       
 20343     current.stateNode = null;
       
 20344 
       
 20345     if (alternate !== null) {
       
 20346       detachFiber(alternate);
       
 20347     }
       
 20348   }
       
 20349 
       
 20350   function getHostParentFiber(fiber) {
       
 20351     var parent = fiber.return;
       
 20352 
       
 20353     while (parent !== null) {
       
 20354       if (isHostParent(parent)) {
       
 20355         return parent;
       
 20356       }
       
 20357 
       
 20358       parent = parent.return;
       
 20359     }
       
 20360 
       
 20361     {
       
 20362       {
       
 20363         throw Error( "Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue." );
       
 20364       }
       
 20365     }
       
 20366   }
       
 20367 
       
 20368   function isHostParent(fiber) {
       
 20369     return fiber.tag === HostComponent || fiber.tag === HostRoot || fiber.tag === HostPortal;
       
 20370   }
       
 20371 
       
 20372   function getHostSibling(fiber) {
       
 20373     // We're going to search forward into the tree until we find a sibling host
       
 20374     // node. Unfortunately, if multiple insertions are done in a row we have to
       
 20375     // search past them. This leads to exponential search for the next sibling.
       
 20376     // TODO: Find a more efficient way to do this.
       
 20377     var node = fiber;
       
 20378 
       
 20379     siblings: while (true) {
       
 20380       // If we didn't find anything, let's try the next sibling.
       
 20381       while (node.sibling === null) {
       
 20382         if (node.return === null || isHostParent(node.return)) {
       
 20383           // If we pop out of the root or hit the parent the fiber we are the
       
 20384           // last sibling.
       
 20385           return null;
       
 20386         }
       
 20387 
       
 20388         node = node.return;
       
 20389       }
       
 20390 
       
 20391       node.sibling.return = node.return;
       
 20392       node = node.sibling;
       
 20393 
       
 20394       while (node.tag !== HostComponent && node.tag !== HostText && node.tag !== DehydratedFragment) {
       
 20395         // If it is not host node and, we might have a host node inside it.
       
 20396         // Try to search down until we find one.
       
 20397         if (node.effectTag & Placement) {
       
 20398           // If we don't have a child, try the siblings instead.
       
 20399           continue siblings;
       
 20400         } // If we don't have a child, try the siblings instead.
       
 20401         // We also skip portals because they are not part of this host tree.
       
 20402 
       
 20403 
       
 20404         if (node.child === null || node.tag === HostPortal) {
       
 20405           continue siblings;
       
 20406         } else {
       
 20407           node.child.return = node;
       
 20408           node = node.child;
       
 20409         }
       
 20410       } // Check if this host node is stable or about to be placed.
       
 20411 
       
 20412 
       
 20413       if (!(node.effectTag & Placement)) {
       
 20414         // Found it!
       
 20415         return node.stateNode;
       
 20416       }
       
 20417     }
       
 20418   }
       
 20419 
       
 20420   function commitPlacement(finishedWork) {
       
 20421 
       
 20422 
       
 20423     var parentFiber = getHostParentFiber(finishedWork); // Note: these two variables *must* always be updated together.
       
 20424 
       
 20425     var parent;
       
 20426     var isContainer;
       
 20427     var parentStateNode = parentFiber.stateNode;
       
 20428 
       
 20429     switch (parentFiber.tag) {
 20350       case HostComponent:
 20430       case HostComponent:
 20351         instanceToUse = getPublicInstance(instance);
 20431         parent = parentStateNode;
       
 20432         isContainer = false;
 20352         break;
 20433         break;
       
 20434 
       
 20435       case HostRoot:
       
 20436         parent = parentStateNode.containerInfo;
       
 20437         isContainer = true;
       
 20438         break;
       
 20439 
       
 20440       case HostPortal:
       
 20441         parent = parentStateNode.containerInfo;
       
 20442         isContainer = true;
       
 20443         break;
       
 20444 
       
 20445       case FundamentalComponent:
       
 20446 
       
 20447       // eslint-disable-next-line-no-fallthrough
       
 20448 
 20353       default:
 20449       default:
 20354         instanceToUse = instance;
 20450         {
 20355     }
 20451           {
 20356     if (typeof ref === 'function') {
 20452             throw Error( "Invalid host parent fiber. This error is likely caused by a bug in React. Please file an issue." );
 20357       ref(instanceToUse);
 20453           }
       
 20454         }
       
 20455 
       
 20456     }
       
 20457 
       
 20458     if (parentFiber.effectTag & ContentReset) {
       
 20459       // Reset the text content of the parent before doing any insertions
       
 20460       resetTextContent(parent); // Clear ContentReset from the effect tag
       
 20461 
       
 20462       parentFiber.effectTag &= ~ContentReset;
       
 20463     }
       
 20464 
       
 20465     var before = getHostSibling(finishedWork); // We only have the top Fiber that was inserted but we need to recurse down its
       
 20466     // children to find all the terminal nodes.
       
 20467 
       
 20468     if (isContainer) {
       
 20469       insertOrAppendPlacementNodeIntoContainer(finishedWork, before, parent);
 20358     } else {
 20470     } else {
 20359       {
 20471       insertOrAppendPlacementNode(finishedWork, before, parent);
 20360         if (!ref.hasOwnProperty('current')) {
 20472     }
 20361           warningWithoutStack$1(false, 'Unexpected ref object provided for %s. ' + 'Use either a ref-setter function or React.createRef().%s', getComponentName(finishedWork.type), getStackByFiberInDevAndProd(finishedWork));
 20473   }
 20362         }
 20474 
 20363       }
 20475   function insertOrAppendPlacementNodeIntoContainer(node, before, parent) {
 20364 
 20476     var tag = node.tag;
 20365       ref.current = instanceToUse;
 20477     var isHost = tag === HostComponent || tag === HostText;
 20366     }
 20478 
 20367   }
 20479     if (isHost || enableFundamentalAPI ) {
 20368 }
 20480       var stateNode = isHost ? node.stateNode : node.stateNode.instance;
 20369 
 20481 
 20370 function commitDetachRef(current$$1) {
 20482       if (before) {
 20371   var currentRef = current$$1.ref;
 20483         insertInContainerBefore(parent, stateNode, before);
 20372   if (currentRef !== null) {
 20484       } else {
 20373     if (typeof currentRef === 'function') {
 20485         appendChildToContainer(parent, stateNode);
 20374       currentRef(null);
 20486       }
 20375     } else {
 20487     } else if (tag === HostPortal) ; else {
 20376       currentRef.current = null;
 20488       var child = node.child;
 20377     }
 20489 
 20378   }
 20490       if (child !== null) {
 20379 }
 20491         insertOrAppendPlacementNodeIntoContainer(child, before, parent);
 20380 
 20492         var sibling = child.sibling;
 20381 // User-originating errors (lifecycles and refs) should not interrupt
 20493 
 20382 // deletion, so don't let them throw. Host-originating errors should
 20494         while (sibling !== null) {
 20383 // interrupt deletion, so it's okay
 20495           insertOrAppendPlacementNodeIntoContainer(sibling, before, parent);
 20384 function commitUnmount(current$$1, renderPriorityLevel) {
 20496           sibling = sibling.sibling;
 20385   onCommitUnmount(current$$1);
 20497         }
 20386 
 20498       }
 20387   switch (current$$1.tag) {
 20499     }
 20388     case FunctionComponent:
 20500   }
 20389     case ForwardRef:
 20501 
 20390     case MemoComponent:
 20502   function insertOrAppendPlacementNode(node, before, parent) {
 20391     case SimpleMemoComponent:
 20503     var tag = node.tag;
 20392       {
 20504     var isHost = tag === HostComponent || tag === HostText;
 20393         var updateQueue = current$$1.updateQueue;
 20505 
 20394         if (updateQueue !== null) {
 20506     if (isHost || enableFundamentalAPI ) {
 20395           var lastEffect = updateQueue.lastEffect;
 20507       var stateNode = isHost ? node.stateNode : node.stateNode.instance;
 20396           if (lastEffect !== null) {
 20508 
 20397             var firstEffect = lastEffect.next;
 20509       if (before) {
 20398 
 20510         insertBefore(parent, stateNode, before);
 20399             // When the owner fiber is deleted, the destroy function of a passive
 20511       } else {
 20400             // effect hook is called during the synchronous commit phase. This is
 20512         appendChild(parent, stateNode);
 20401             // a concession to implementation complexity. Calling it in the
 20513       }
 20402             // passive effect phase (like they usually are, when dependencies
 20514     } else if (tag === HostPortal) ; else {
 20403             // change during an update) would require either traversing the
 20515       var child = node.child;
 20404             // children of the deleted fiber again, or including unmount effects
 20516 
 20405             // as part of the fiber effect list.
 20517       if (child !== null) {
 20406             //
 20518         insertOrAppendPlacementNode(child, before, parent);
 20407             // Because this is during the sync commit phase, we need to change
 20519         var sibling = child.sibling;
 20408             // the priority.
 20520 
 20409             //
 20521         while (sibling !== null) {
 20410             // TODO: Reconsider this implementation trade off.
 20522           insertOrAppendPlacementNode(sibling, before, parent);
 20411             var priorityLevel = renderPriorityLevel > NormalPriority ? NormalPriority : renderPriorityLevel;
 20523           sibling = sibling.sibling;
 20412             runWithPriority$2(priorityLevel, function () {
 20524         }
 20413               var effect = firstEffect;
 20525       }
 20414               do {
 20526     }
 20415                 var destroy = effect.destroy;
 20527   }
 20416                 if (destroy !== undefined) {
 20528 
 20417                   safelyCallDestroy(current$$1, destroy);
 20529   function unmountHostComponents(finishedRoot, current, renderPriorityLevel) {
 20418                 }
 20530     // We only have the top Fiber that was deleted but we need to recurse down its
 20419                 effect = effect.next;
 20531     // children to find all the terminal nodes.
 20420               } while (effect !== firstEffect);
 20532     var node = current; // Each iteration, currentParent is populated with node's host parent if not
 20421             });
 20533     // currentParentIsValid.
 20422           }
 20534 
 20423         }
 20535     var currentParentIsValid = false; // Note: these two variables *must* always be updated together.
 20424         break;
 20536 
 20425       }
 20537     var currentParent;
 20426     case ClassComponent:
 20538     var currentParentIsContainer;
 20427       {
 20539 
 20428         safelyDetachRef(current$$1);
 20540     while (true) {
 20429         var instance = current$$1.stateNode;
 20541       if (!currentParentIsValid) {
 20430         if (typeof instance.componentWillUnmount === 'function') {
 20542         var parent = node.return;
 20431           safelyCallComponentWillUnmount(current$$1, instance);
 20543 
 20432         }
 20544         findParent: while (true) {
 20433         return;
 20545           if (!(parent !== null)) {
 20434       }
 20546             {
 20435     case HostComponent:
 20547               throw Error( "Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue." );
 20436       {
       
 20437         if (enableFlareAPI) {
       
 20438           var dependencies = current$$1.dependencies;
       
 20439 
       
 20440           if (dependencies !== null) {
       
 20441             var respondersMap = dependencies.responders;
       
 20442             if (respondersMap !== null) {
       
 20443               var responderInstances = Array.from(respondersMap.values());
       
 20444               for (var i = 0, length = responderInstances.length; i < length; i++) {
       
 20445                 var responderInstance = responderInstances[i];
       
 20446                 unmountResponderInstance(responderInstance);
       
 20447               }
       
 20448               dependencies.responders = null;
       
 20449             }
 20548             }
 20450           }
 20549           }
 20451         }
 20550 
 20452         safelyDetachRef(current$$1);
 20551           var parentStateNode = parent.stateNode;
       
 20552 
       
 20553           switch (parent.tag) {
       
 20554             case HostComponent:
       
 20555               currentParent = parentStateNode;
       
 20556               currentParentIsContainer = false;
       
 20557               break findParent;
       
 20558 
       
 20559             case HostRoot:
       
 20560               currentParent = parentStateNode.containerInfo;
       
 20561               currentParentIsContainer = true;
       
 20562               break findParent;
       
 20563 
       
 20564             case HostPortal:
       
 20565               currentParent = parentStateNode.containerInfo;
       
 20566               currentParentIsContainer = true;
       
 20567               break findParent;
       
 20568 
       
 20569           }
       
 20570 
       
 20571           parent = parent.return;
       
 20572         }
       
 20573 
       
 20574         currentParentIsValid = true;
       
 20575       }
       
 20576 
       
 20577       if (node.tag === HostComponent || node.tag === HostText) {
       
 20578         commitNestedUnmounts(finishedRoot, node, renderPriorityLevel); // After all the children have unmounted, it is now safe to remove the
       
 20579         // node from the tree.
       
 20580 
       
 20581         if (currentParentIsContainer) {
       
 20582           removeChildFromContainer(currentParent, node.stateNode);
       
 20583         } else {
       
 20584           removeChild(currentParent, node.stateNode);
       
 20585         } // Don't visit children because we already visited them.
       
 20586 
       
 20587       } else if (node.tag === HostPortal) {
       
 20588         if (node.child !== null) {
       
 20589           // When we go into a portal, it becomes the parent to remove from.
       
 20590           // We will reassign it back when we pop the portal on the way up.
       
 20591           currentParent = node.stateNode.containerInfo;
       
 20592           currentParentIsContainer = true; // Visit children because portals might contain host components.
       
 20593 
       
 20594           node.child.return = node;
       
 20595           node = node.child;
       
 20596           continue;
       
 20597         }
       
 20598       } else {
       
 20599         commitUnmount(finishedRoot, node, renderPriorityLevel); // Visit children because we may find more host components below.
       
 20600 
       
 20601         if (node.child !== null) {
       
 20602           node.child.return = node;
       
 20603           node = node.child;
       
 20604           continue;
       
 20605         }
       
 20606       }
       
 20607 
       
 20608       if (node === current) {
 20453         return;
 20609         return;
 20454       }
 20610       }
 20455     case HostPortal:
 20611 
 20456       {
 20612       while (node.sibling === null) {
 20457         // TODO: this is recursive.
 20613         if (node.return === null || node.return === current) {
 20458         // We are also not using this parent because
 20614           return;
 20459         // the portal will get pushed immediately.
 20615         }
 20460         if (supportsMutation) {
 20616 
 20461           unmountHostComponents(current$$1, renderPriorityLevel);
 20617         node = node.return;
 20462         } else if (supportsPersistence) {
 20618 
 20463           emptyPortalContainer(current$$1);
 20619         if (node.tag === HostPortal) {
 20464         }
 20620           // When we go out of the portal, we need to restore the parent.
 20465         return;
 20621           // Since we don't keep a stack of them, we will search for it.
 20466       }
 20622           currentParentIsValid = false;
 20467     case FundamentalComponent:
 20623         }
 20468       {
 20624       }
 20469         if (enableFundamentalAPI) {
 20625 
 20470           var fundamentalInstance = current$$1.stateNode;
 20626       node.sibling.return = node.return;
 20471           if (fundamentalInstance !== null) {
 20627       node = node.sibling;
 20472             unmountFundamentalComponent(fundamentalInstance);
 20628     }
 20473             current$$1.stateNode = null;
 20629   }
 20474           }
 20630 
 20475         }
 20631   function commitDeletion(finishedRoot, current, renderPriorityLevel) {
 20476       }
       
 20477   }
       
 20478 }
       
 20479 
       
 20480 function commitNestedUnmounts(root, renderPriorityLevel) {
       
 20481   // While we're inside a removed host node we don't want to call
       
 20482   // removeChild on the inner nodes because they're removed by the top
       
 20483   // call anyway. We also want to call componentWillUnmount on all
       
 20484   // composites before this host node is removed from the tree. Therefore
       
 20485   var node = root;
       
 20486   while (true) {
       
 20487     commitUnmount(node, renderPriorityLevel);
       
 20488     // Visit children because they may contain more composite or host nodes.
       
 20489     // Skip portals because commitUnmount() currently visits them recursively.
       
 20490     if (node.child !== null && (
       
 20491     // If we use mutation we drill down into portals using commitUnmount above.
       
 20492     // If we don't use mutation we drill down into portals here instead.
       
 20493     !supportsMutation || node.tag !== HostPortal)) {
       
 20494       node.child.return = node;
       
 20495       node = node.child;
       
 20496       continue;
       
 20497     }
       
 20498     if (node === root) {
       
 20499       return;
       
 20500     }
       
 20501     while (node.sibling === null) {
       
 20502       if (node.return === null || node.return === root) {
       
 20503         return;
       
 20504       }
       
 20505       node = node.return;
       
 20506     }
       
 20507     node.sibling.return = node.return;
       
 20508     node = node.sibling;
       
 20509   }
       
 20510 }
       
 20511 
       
 20512 function detachFiber(current$$1) {
       
 20513   // Cut off the return pointers to disconnect it from the tree. Ideally, we
       
 20514   // should clear the child pointer of the parent alternate to let this
       
 20515   // get GC:ed but we don't know which for sure which parent is the current
       
 20516   // one so we'll settle for GC:ing the subtree of this child. This child
       
 20517   // itself will be GC:ed when the parent updates the next time.
       
 20518   current$$1.return = null;
       
 20519   current$$1.child = null;
       
 20520   current$$1.memoizedState = null;
       
 20521   current$$1.updateQueue = null;
       
 20522   current$$1.dependencies = null;
       
 20523   var alternate = current$$1.alternate;
       
 20524   if (alternate !== null) {
       
 20525     alternate.return = null;
       
 20526     alternate.child = null;
       
 20527     alternate.memoizedState = null;
       
 20528     alternate.updateQueue = null;
       
 20529     alternate.dependencies = null;
       
 20530   }
       
 20531 }
       
 20532 
       
 20533 function emptyPortalContainer(current$$1) {
       
 20534   if (!supportsPersistence) {
       
 20535     return;
       
 20536   }
       
 20537 
       
 20538   var portal = current$$1.stateNode;
       
 20539   var containerInfo = portal.containerInfo;
       
 20540 
       
 20541   var emptyChildSet = createContainerChildSet(containerInfo);
       
 20542   replaceContainerChildren(containerInfo, emptyChildSet);
       
 20543 }
       
 20544 
       
 20545 function commitContainer(finishedWork) {
       
 20546   if (!supportsPersistence) {
       
 20547     return;
       
 20548   }
       
 20549 
       
 20550   switch (finishedWork.tag) {
       
 20551     case ClassComponent:
       
 20552     case HostComponent:
       
 20553     case HostText:
       
 20554     case FundamentalComponent:
       
 20555       {
       
 20556         return;
       
 20557       }
       
 20558     case HostRoot:
       
 20559     case HostPortal:
       
 20560       {
       
 20561         var portalOrRoot = finishedWork.stateNode;
       
 20562         var containerInfo = portalOrRoot.containerInfo,
       
 20563             _pendingChildren = portalOrRoot.pendingChildren;
       
 20564 
       
 20565         replaceContainerChildren(containerInfo, _pendingChildren);
       
 20566         return;
       
 20567       }
       
 20568     default:
       
 20569       {
       
 20570         (function () {
       
 20571           {
       
 20572             {
       
 20573               throw ReactError(Error('This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue.'));
       
 20574             }
       
 20575           }
       
 20576         })();
       
 20577       }
       
 20578   }
       
 20579 }
       
 20580 
       
 20581 function getHostParentFiber(fiber) {
       
 20582   var parent = fiber.return;
       
 20583   while (parent !== null) {
       
 20584     if (isHostParent(parent)) {
       
 20585       return parent;
       
 20586     }
       
 20587     parent = parent.return;
       
 20588   }
       
 20589   (function () {
       
 20590     {
 20632     {
 20591       {
 20633       // Recursively delete all host nodes from the parent.
 20592         throw ReactError(Error('Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue.'));
 20634       // Detach refs and call componentWillUnmount() on the whole subtree.
 20593       }
 20635       unmountHostComponents(finishedRoot, current, renderPriorityLevel);
 20594     }
 20636     }
 20595   })();
 20637 
 20596 }
 20638     detachFiber(current);
 20597 
 20639   }
 20598 function isHostParent(fiber) {
 20640 
 20599   return fiber.tag === HostComponent || fiber.tag === HostRoot || fiber.tag === HostPortal;
 20641   function commitWork(current, finishedWork) {
 20600 }
 20642 
 20601 
       
 20602 function getHostSibling(fiber) {
       
 20603   // We're going to search forward into the tree until we find a sibling host
       
 20604   // node. Unfortunately, if multiple insertions are done in a row we have to
       
 20605   // search past them. This leads to exponential search for the next sibling.
       
 20606   var node = fiber;
       
 20607   siblings: while (true) {
       
 20608     // If we didn't find anything, let's try the next sibling.
       
 20609     while (node.sibling === null) {
       
 20610       if (node.return === null || isHostParent(node.return)) {
       
 20611         // If we pop out of the root or hit the parent the fiber we are the
       
 20612         // last sibling.
       
 20613         return null;
       
 20614       }
       
 20615       node = node.return;
       
 20616     }
       
 20617     node.sibling.return = node.return;
       
 20618     node = node.sibling;
       
 20619     while (node.tag !== HostComponent && node.tag !== HostText && node.tag !== DehydratedSuspenseComponent) {
       
 20620       // If it is not host node and, we might have a host node inside it.
       
 20621       // Try to search down until we find one.
       
 20622       if (node.effectTag & Placement) {
       
 20623         // If we don't have a child, try the siblings instead.
       
 20624         continue siblings;
       
 20625       }
       
 20626       // If we don't have a child, try the siblings instead.
       
 20627       // We also skip portals because they are not part of this host tree.
       
 20628       if (node.child === null || node.tag === HostPortal) {
       
 20629         continue siblings;
       
 20630       } else {
       
 20631         node.child.return = node;
       
 20632         node = node.child;
       
 20633       }
       
 20634     }
       
 20635     // Check if this host node is stable or about to be placed.
       
 20636     if (!(node.effectTag & Placement)) {
       
 20637       // Found it!
       
 20638       return node.stateNode;
       
 20639     }
       
 20640   }
       
 20641 }
       
 20642 
       
 20643 function commitPlacement(finishedWork) {
       
 20644   if (!supportsMutation) {
       
 20645     return;
       
 20646   }
       
 20647 
       
 20648   // Recursively insert all host nodes into the parent.
       
 20649   var parentFiber = getHostParentFiber(finishedWork);
       
 20650 
       
 20651   // Note: these two variables *must* always be updated together.
       
 20652   var parent = void 0;
       
 20653   var isContainer = void 0;
       
 20654   var parentStateNode = parentFiber.stateNode;
       
 20655   switch (parentFiber.tag) {
       
 20656     case HostComponent:
       
 20657       parent = parentStateNode;
       
 20658       isContainer = false;
       
 20659       break;
       
 20660     case HostRoot:
       
 20661       parent = parentStateNode.containerInfo;
       
 20662       isContainer = true;
       
 20663       break;
       
 20664     case HostPortal:
       
 20665       parent = parentStateNode.containerInfo;
       
 20666       isContainer = true;
       
 20667       break;
       
 20668     case FundamentalComponent:
       
 20669       if (enableFundamentalAPI) {
       
 20670         parent = parentStateNode.instance;
       
 20671         isContainer = false;
       
 20672       }
       
 20673     // eslint-disable-next-line-no-fallthrough
       
 20674     default:
       
 20675       (function () {
       
 20676         {
       
 20677           {
       
 20678             throw ReactError(Error('Invalid host parent fiber. This error is likely caused by a bug in React. Please file an issue.'));
       
 20679           }
       
 20680         }
       
 20681       })();
       
 20682   }
       
 20683   if (parentFiber.effectTag & ContentReset) {
       
 20684     // Reset the text content of the parent before doing any insertions
       
 20685     resetTextContent(parent);
       
 20686     // Clear ContentReset from the effect tag
       
 20687     parentFiber.effectTag &= ~ContentReset;
       
 20688   }
       
 20689 
       
 20690   var before = getHostSibling(finishedWork);
       
 20691   // We only have the top Fiber that was inserted but we need to recurse down its
       
 20692   // children to find all the terminal nodes.
       
 20693   var node = finishedWork;
       
 20694   while (true) {
       
 20695     var isHost = node.tag === HostComponent || node.tag === HostText;
       
 20696     if (isHost || node.tag === FundamentalComponent) {
       
 20697       var stateNode = isHost ? node.stateNode : node.stateNode.instance;
       
 20698       if (before) {
       
 20699         if (isContainer) {
       
 20700           insertInContainerBefore(parent, stateNode, before);
       
 20701         } else {
       
 20702           insertBefore(parent, stateNode, before);
       
 20703         }
       
 20704       } else {
       
 20705         if (isContainer) {
       
 20706           appendChildToContainer(parent, stateNode);
       
 20707         } else {
       
 20708           appendChild(parent, stateNode);
       
 20709         }
       
 20710       }
       
 20711     } else if (node.tag === HostPortal) {
       
 20712       // If the insertion itself is a portal, then we don't want to traverse
       
 20713       // down its children. Instead, we'll get insertions from each child in
       
 20714       // the portal directly.
       
 20715     } else if (node.child !== null) {
       
 20716       node.child.return = node;
       
 20717       node = node.child;
       
 20718       continue;
       
 20719     }
       
 20720     if (node === finishedWork) {
       
 20721       return;
       
 20722     }
       
 20723     while (node.sibling === null) {
       
 20724       if (node.return === null || node.return === finishedWork) {
       
 20725         return;
       
 20726       }
       
 20727       node = node.return;
       
 20728     }
       
 20729     node.sibling.return = node.return;
       
 20730     node = node.sibling;
       
 20731   }
       
 20732 }
       
 20733 
       
 20734 function unmountHostComponents(current$$1, renderPriorityLevel) {
       
 20735   // We only have the top Fiber that was deleted but we need to recurse down its
       
 20736   var node = current$$1;
       
 20737 
       
 20738   // Each iteration, currentParent is populated with node's host parent if not
       
 20739   // currentParentIsValid.
       
 20740   var currentParentIsValid = false;
       
 20741 
       
 20742   // Note: these two variables *must* always be updated together.
       
 20743   var currentParent = void 0;
       
 20744   var currentParentIsContainer = void 0;
       
 20745 
       
 20746   while (true) {
       
 20747     if (!currentParentIsValid) {
       
 20748       var parent = node.return;
       
 20749       findParent: while (true) {
       
 20750         (function () {
       
 20751           if (!(parent !== null)) {
       
 20752             {
       
 20753               throw ReactError(Error('Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue.'));
       
 20754             }
       
 20755           }
       
 20756         })();
       
 20757         var parentStateNode = parent.stateNode;
       
 20758         switch (parent.tag) {
       
 20759           case HostComponent:
       
 20760             currentParent = parentStateNode;
       
 20761             currentParentIsContainer = false;
       
 20762             break findParent;
       
 20763           case HostRoot:
       
 20764             currentParent = parentStateNode.containerInfo;
       
 20765             currentParentIsContainer = true;
       
 20766             break findParent;
       
 20767           case HostPortal:
       
 20768             currentParent = parentStateNode.containerInfo;
       
 20769             currentParentIsContainer = true;
       
 20770             break findParent;
       
 20771           case FundamentalComponent:
       
 20772             if (enableFundamentalAPI) {
       
 20773               currentParent = parentStateNode.instance;
       
 20774               currentParentIsContainer = false;
       
 20775             }
       
 20776         }
       
 20777         parent = parent.return;
       
 20778       }
       
 20779       currentParentIsValid = true;
       
 20780     }
       
 20781 
       
 20782     if (node.tag === HostComponent || node.tag === HostText) {
       
 20783       commitNestedUnmounts(node, renderPriorityLevel);
       
 20784       // After all the children have unmounted, it is now safe to remove the
       
 20785       // node from the tree.
       
 20786       if (currentParentIsContainer) {
       
 20787         removeChildFromContainer(currentParent, node.stateNode);
       
 20788       } else {
       
 20789         removeChild(currentParent, node.stateNode);
       
 20790       }
       
 20791       // Don't visit children because we already visited them.
       
 20792     } else if (node.tag === FundamentalComponent) {
       
 20793       var fundamentalNode = node.stateNode.instance;
       
 20794       commitNestedUnmounts(node, renderPriorityLevel);
       
 20795       // After all the children have unmounted, it is now safe to remove the
       
 20796       // node from the tree.
       
 20797       if (currentParentIsContainer) {
       
 20798         removeChildFromContainer(currentParent, fundamentalNode);
       
 20799       } else {
       
 20800         removeChild(currentParent, fundamentalNode);
       
 20801       }
       
 20802     } else if (enableSuspenseServerRenderer && node.tag === DehydratedSuspenseComponent) {
       
 20803       // Delete the dehydrated suspense boundary and all of its content.
       
 20804       if (currentParentIsContainer) {
       
 20805         clearSuspenseBoundaryFromContainer(currentParent, node.stateNode);
       
 20806       } else {
       
 20807         clearSuspenseBoundary(currentParent, node.stateNode);
       
 20808       }
       
 20809     } else if (node.tag === HostPortal) {
       
 20810       if (node.child !== null) {
       
 20811         // When we go into a portal, it becomes the parent to remove from.
       
 20812         // We will reassign it back when we pop the portal on the way up.
       
 20813         currentParent = node.stateNode.containerInfo;
       
 20814         currentParentIsContainer = true;
       
 20815         // Visit children because portals might contain host components.
       
 20816         node.child.return = node;
       
 20817         node = node.child;
       
 20818         continue;
       
 20819       }
       
 20820     } else {
       
 20821       commitUnmount(node, renderPriorityLevel);
       
 20822       // Visit children because we may find more host components below.
       
 20823       if (node.child !== null) {
       
 20824         node.child.return = node;
       
 20825         node = node.child;
       
 20826         continue;
       
 20827       }
       
 20828     }
       
 20829     if (node === current$$1) {
       
 20830       return;
       
 20831     }
       
 20832     while (node.sibling === null) {
       
 20833       if (node.return === null || node.return === current$$1) {
       
 20834         return;
       
 20835       }
       
 20836       node = node.return;
       
 20837       if (node.tag === HostPortal) {
       
 20838         // When we go out of the portal, we need to restore the parent.
       
 20839         // Since we don't keep a stack of them, we will search for it.
       
 20840         currentParentIsValid = false;
       
 20841       }
       
 20842     }
       
 20843     node.sibling.return = node.return;
       
 20844     node = node.sibling;
       
 20845   }
       
 20846 }
       
 20847 
       
 20848 function commitDeletion(current$$1, renderPriorityLevel) {
       
 20849   if (supportsMutation) {
       
 20850     // Recursively delete all host nodes from the parent.
       
 20851     // Detach refs and call componentWillUnmount() on the whole subtree.
       
 20852     unmountHostComponents(current$$1, renderPriorityLevel);
       
 20853   } else {
       
 20854     // Detach refs and call componentWillUnmount() on the whole subtree.
       
 20855     commitNestedUnmounts(current$$1, renderPriorityLevel);
       
 20856   }
       
 20857   detachFiber(current$$1);
       
 20858 }
       
 20859 
       
 20860 function commitWork(current$$1, finishedWork) {
       
 20861   if (!supportsMutation) {
       
 20862     switch (finishedWork.tag) {
 20643     switch (finishedWork.tag) {
 20863       case FunctionComponent:
 20644       case FunctionComponent:
 20864       case ForwardRef:
 20645       case ForwardRef:
 20865       case MemoComponent:
 20646       case MemoComponent:
 20866       case SimpleMemoComponent:
 20647       case SimpleMemoComponent:
       
 20648       case Block:
 20867         {
 20649         {
 20868           // Note: We currently never use MountMutation, but useLayout uses
 20650           // Layout effects are destroyed during the mutation phase so that all
 20869           // UnmountMutation.
 20651           // destroy functions for all fibers are called before any create functions.
 20870           commitHookEffectList(UnmountMutation, MountMutation, finishedWork);
 20652           // This prevents sibling component effects from interfering with each other,
       
 20653           // e.g. a destroy function in one component should never override a ref set
       
 20654           // by a create function in another component during the same commit.
       
 20655           commitHookEffectListUnmount(Layout | HasEffect, finishedWork);
 20871           return;
 20656           return;
 20872         }
 20657         }
       
 20658 
       
 20659       case ClassComponent:
       
 20660         {
       
 20661           return;
       
 20662         }
       
 20663 
       
 20664       case HostComponent:
       
 20665         {
       
 20666           var instance = finishedWork.stateNode;
       
 20667 
       
 20668           if (instance != null) {
       
 20669             // Commit the work prepared earlier.
       
 20670             var newProps = finishedWork.memoizedProps; // For hydration we reuse the update path but we treat the oldProps
       
 20671             // as the newProps. The updatePayload will contain the real change in
       
 20672             // this case.
       
 20673 
       
 20674             var oldProps = current !== null ? current.memoizedProps : newProps;
       
 20675             var type = finishedWork.type; // TODO: Type the updateQueue to be specific to host components.
       
 20676 
       
 20677             var updatePayload = finishedWork.updateQueue;
       
 20678             finishedWork.updateQueue = null;
       
 20679 
       
 20680             if (updatePayload !== null) {
       
 20681               commitUpdate(instance, updatePayload, type, oldProps, newProps);
       
 20682             }
       
 20683           }
       
 20684 
       
 20685           return;
       
 20686         }
       
 20687 
       
 20688       case HostText:
       
 20689         {
       
 20690           if (!(finishedWork.stateNode !== null)) {
       
 20691             {
       
 20692               throw Error( "This should have a text node initialized. This error is likely caused by a bug in React. Please file an issue." );
       
 20693             }
       
 20694           }
       
 20695 
       
 20696           var textInstance = finishedWork.stateNode;
       
 20697           var newText = finishedWork.memoizedProps; // For hydration we reuse the update path but we treat the oldProps
       
 20698           // as the newProps. The updatePayload will contain the real change in
       
 20699           // this case.
       
 20700 
       
 20701           var oldText = current !== null ? current.memoizedProps : newText;
       
 20702           commitTextUpdate(textInstance, oldText, newText);
       
 20703           return;
       
 20704         }
       
 20705 
       
 20706       case HostRoot:
       
 20707         {
       
 20708           {
       
 20709             var _root = finishedWork.stateNode;
       
 20710 
       
 20711             if (_root.hydrate) {
       
 20712               // We've just hydrated. No need to hydrate again.
       
 20713               _root.hydrate = false;
       
 20714               commitHydratedContainer(_root.containerInfo);
       
 20715             }
       
 20716           }
       
 20717 
       
 20718           return;
       
 20719         }
       
 20720 
 20873       case Profiler:
 20721       case Profiler:
 20874         {
 20722         {
 20875           return;
 20723           return;
 20876         }
 20724         }
       
 20725 
 20877       case SuspenseComponent:
 20726       case SuspenseComponent:
 20878         {
 20727         {
 20879           commitSuspenseComponent(finishedWork);
 20728           commitSuspenseComponent(finishedWork);
 20880           attachSuspenseRetryListeners(finishedWork);
 20729           attachSuspenseRetryListeners(finishedWork);
 20881           return;
 20730           return;
 20882         }
 20731         }
       
 20732 
 20883       case SuspenseListComponent:
 20733       case SuspenseListComponent:
 20884         {
 20734         {
 20885           attachSuspenseRetryListeners(finishedWork);
 20735           attachSuspenseRetryListeners(finishedWork);
 20886           return;
 20736           return;
 20887         }
 20737         }
 20888     }
 20738 
 20889 
 20739       case IncompleteClassComponent:
 20890     commitContainer(finishedWork);
 20740         {
 20891     return;
 20741           return;
 20892   }
 20742         }
 20893 
 20743     }
 20894   switch (finishedWork.tag) {
 20744 
 20895     case FunctionComponent:
 20745     {
 20896     case ForwardRef:
       
 20897     case MemoComponent:
       
 20898     case SimpleMemoComponent:
       
 20899       {
 20746       {
 20900         // Note: We currently never use MountMutation, but useLayout uses
 20747         throw Error( "This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue." );
 20901         // UnmountMutation.
 20748       }
 20902         commitHookEffectList(UnmountMutation, MountMutation, finishedWork);
 20749     }
 20903         return;
 20750   }
 20904       }
 20751 
 20905     case ClassComponent:
 20752   function commitSuspenseComponent(finishedWork) {
 20906       {
 20753     var newState = finishedWork.memoizedState;
 20907         return;
 20754     var newDidTimeout;
 20908       }
 20755     var primaryChildParent = finishedWork;
 20909     case HostComponent:
 20756 
 20910       {
 20757     if (newState === null) {
 20911         var instance = finishedWork.stateNode;
 20758       newDidTimeout = false;
 20912         if (instance != null) {
 20759     } else {
 20913           // Commit the work prepared earlier.
 20760       newDidTimeout = true;
 20914           var newProps = finishedWork.memoizedProps;
 20761       primaryChildParent = finishedWork.child;
 20915           // For hydration we reuse the update path but we treat the oldProps
 20762       markCommitTimeOfFallback();
 20916           // as the newProps. The updatePayload will contain the real change in
 20763     }
 20917           // this case.
 20764 
 20918           var oldProps = current$$1 !== null ? current$$1.memoizedProps : newProps;
 20765     if ( primaryChildParent !== null) {
 20919           var type = finishedWork.type;
 20766       hideOrUnhideAllChildren(primaryChildParent, newDidTimeout);
 20920           // TODO: Type the updateQueue to be specific to host components.
 20767     }
 20921           var updatePayload = finishedWork.updateQueue;
 20768   }
 20922           finishedWork.updateQueue = null;
 20769 
 20923           if (updatePayload !== null) {
 20770   function commitSuspenseHydrationCallbacks(finishedRoot, finishedWork) {
 20924             commitUpdate(instance, updatePayload, type, oldProps, newProps, finishedWork);
 20771 
       
 20772     var newState = finishedWork.memoizedState;
       
 20773 
       
 20774     if (newState === null) {
       
 20775       var current = finishedWork.alternate;
       
 20776 
       
 20777       if (current !== null) {
       
 20778         var prevState = current.memoizedState;
       
 20779 
       
 20780         if (prevState !== null) {
       
 20781           var suspenseInstance = prevState.dehydrated;
       
 20782 
       
 20783           if (suspenseInstance !== null) {
       
 20784             commitHydratedSuspenseInstance(suspenseInstance);
 20925           }
 20785           }
 20926         }
 20786         }
 20927         return;
 20787       }
 20928       }
 20788     }
 20929     case HostText:
 20789   }
 20930       {
 20790 
 20931         (function () {
 20791   function attachSuspenseRetryListeners(finishedWork) {
 20932           if (!(finishedWork.stateNode !== null)) {
 20792     // If this boundary just timed out, then it will have a set of thenables.
 20933             {
 20793     // For each thenable, attach a listener so that when it resolves, React
 20934               throw ReactError(Error('This should have a text node initialized. This error is likely caused by a bug in React. Please file an issue.'));
 20794     // attempts to re-render the boundary in the primary (pre-timeout) state.
       
 20795     var thenables = finishedWork.updateQueue;
       
 20796 
       
 20797     if (thenables !== null) {
       
 20798       finishedWork.updateQueue = null;
       
 20799       var retryCache = finishedWork.stateNode;
       
 20800 
       
 20801       if (retryCache === null) {
       
 20802         retryCache = finishedWork.stateNode = new PossiblyWeakSet();
       
 20803       }
       
 20804 
       
 20805       thenables.forEach(function (thenable) {
       
 20806         // Memoize using the boundary fiber to prevent redundant listeners.
       
 20807         var retry = resolveRetryThenable.bind(null, finishedWork, thenable);
       
 20808 
       
 20809         if (!retryCache.has(thenable)) {
       
 20810           {
       
 20811             if (thenable.__reactDoNotTraceInteractions !== true) {
       
 20812               retry = unstable_wrap(retry);
 20935             }
 20813             }
 20936           }
 20814           }
 20937         })();
 20815 
 20938         var textInstance = finishedWork.stateNode;
 20816           retryCache.add(thenable);
 20939         var newText = finishedWork.memoizedProps;
 20817           thenable.then(retry, retry);
 20940         // For hydration we reuse the update path but we treat the oldProps
 20818         }
 20941         // as the newProps. The updatePayload will contain the real change in
 20819       });
 20942         // this case.
 20820     }
 20943         var oldText = current$$1 !== null ? current$$1.memoizedProps : newText;
 20821   }
 20944         commitTextUpdate(textInstance, oldText, newText);
 20822 
 20945         return;
 20823   function commitResetTextContent(current) {
 20946       }
 20824 
 20947     case HostRoot:
 20825     resetTextContent(current.stateNode);
 20948       {
 20826   }
 20949         return;
 20827 
 20950       }
 20828   var PossiblyWeakMap$1 = typeof WeakMap === 'function' ? WeakMap : Map;
 20951     case Profiler:
 20829 
 20952       {
 20830   function createRootErrorUpdate(fiber, errorInfo, expirationTime) {
 20953         return;
 20831     var update = createUpdate(expirationTime, null); // Unmount the root by rendering null.
 20954       }
 20832 
 20955     case SuspenseComponent:
 20833     update.tag = CaptureUpdate; // Caution: React DevTools currently depends on this property
 20956       {
 20834     // being called "element".
 20957         commitSuspenseComponent(finishedWork);
 20835 
 20958         attachSuspenseRetryListeners(finishedWork);
 20836     update.payload = {
 20959         return;
 20837       element: null
 20960       }
 20838     };
 20961     case SuspenseListComponent:
 20839     var error = errorInfo.value;
 20962       {
 20840 
 20963         attachSuspenseRetryListeners(finishedWork);
 20841     update.callback = function () {
 20964         return;
 20842       onUncaughtError(error);
 20965       }
 20843       logError(fiber, errorInfo);
 20966     case IncompleteClassComponent:
 20844     };
 20967       {
 20845 
 20968         return;
 20846     return update;
 20969       }
 20847   }
 20970     case FundamentalComponent:
 20848 
 20971       {
 20849   function createClassErrorUpdate(fiber, errorInfo, expirationTime) {
 20972         if (enableFundamentalAPI) {
 20850     var update = createUpdate(expirationTime, null);
 20973           var fundamentalInstance = finishedWork.stateNode;
 20851     update.tag = CaptureUpdate;
 20974           updateFundamentalComponent(fundamentalInstance);
 20852     var getDerivedStateFromError = fiber.type.getDerivedStateFromError;
 20975         }
 20853 
 20976         return;
 20854     if (typeof getDerivedStateFromError === 'function') {
 20977       }
 20855       var error$1 = errorInfo.value;
 20978     default:
 20856 
 20979       {
 20857       update.payload = function () {
 20980         (function () {
 20858         logError(fiber, errorInfo);
       
 20859         return getDerivedStateFromError(error$1);
       
 20860       };
       
 20861     }
       
 20862 
       
 20863     var inst = fiber.stateNode;
       
 20864 
       
 20865     if (inst !== null && typeof inst.componentDidCatch === 'function') {
       
 20866       update.callback = function callback() {
       
 20867         {
       
 20868           markFailedErrorBoundaryForHotReloading(fiber);
       
 20869         }
       
 20870 
       
 20871         if (typeof getDerivedStateFromError !== 'function') {
       
 20872           // To preserve the preexisting retry behavior of error boundaries,
       
 20873           // we keep track of which ones already failed during this batch.
       
 20874           // This gets reset before we yield back to the browser.
       
 20875           // TODO: Warn in strict mode if getDerivedStateFromError is
       
 20876           // not defined.
       
 20877           markLegacyErrorBoundaryAsFailed(this); // Only log here if componentDidCatch is the only error boundary method defined
       
 20878 
       
 20879           logError(fiber, errorInfo);
       
 20880         }
       
 20881 
       
 20882         var error$1 = errorInfo.value;
       
 20883         var stack = errorInfo.stack;
       
 20884         this.componentDidCatch(error$1, {
       
 20885           componentStack: stack !== null ? stack : ''
       
 20886         });
       
 20887 
       
 20888         {
       
 20889           if (typeof getDerivedStateFromError !== 'function') {
       
 20890             // If componentDidCatch is the only error boundary method defined,
       
 20891             // then it needs to call setState to recover from errors.
       
 20892             // If no state update is scheduled then the boundary will swallow the error.
       
 20893             if (fiber.expirationTime !== Sync) {
       
 20894               error('%s: Error boundaries should implement getDerivedStateFromError(). ' + 'In that method, return a state update to display an error message or fallback UI.', getComponentName(fiber.type) || 'Unknown');
       
 20895             }
       
 20896           }
       
 20897         }
       
 20898       };
       
 20899     } else {
       
 20900       update.callback = function () {
       
 20901         markFailedErrorBoundaryForHotReloading(fiber);
       
 20902       };
       
 20903     }
       
 20904 
       
 20905     return update;
       
 20906   }
       
 20907 
       
 20908   function attachPingListener(root, renderExpirationTime, thenable) {
       
 20909     // Attach a listener to the promise to "ping" the root and retry. But
       
 20910     // only if one does not already exist for the current render expiration
       
 20911     // time (which acts like a "thread ID" here).
       
 20912     var pingCache = root.pingCache;
       
 20913     var threadIDs;
       
 20914 
       
 20915     if (pingCache === null) {
       
 20916       pingCache = root.pingCache = new PossiblyWeakMap$1();
       
 20917       threadIDs = new Set();
       
 20918       pingCache.set(thenable, threadIDs);
       
 20919     } else {
       
 20920       threadIDs = pingCache.get(thenable);
       
 20921 
       
 20922       if (threadIDs === undefined) {
       
 20923         threadIDs = new Set();
       
 20924         pingCache.set(thenable, threadIDs);
       
 20925       }
       
 20926     }
       
 20927 
       
 20928     if (!threadIDs.has(renderExpirationTime)) {
       
 20929       // Memoize using the thread ID to prevent redundant listeners.
       
 20930       threadIDs.add(renderExpirationTime);
       
 20931       var ping = pingSuspendedRoot.bind(null, root, thenable, renderExpirationTime);
       
 20932       thenable.then(ping, ping);
       
 20933     }
       
 20934   }
       
 20935 
       
 20936   function throwException(root, returnFiber, sourceFiber, value, renderExpirationTime) {
       
 20937     // The source fiber did not complete.
       
 20938     sourceFiber.effectTag |= Incomplete; // Its effect list is no longer valid.
       
 20939 
       
 20940     sourceFiber.firstEffect = sourceFiber.lastEffect = null;
       
 20941 
       
 20942     if (value !== null && typeof value === 'object' && typeof value.then === 'function') {
       
 20943       // This is a thenable.
       
 20944       var thenable = value;
       
 20945 
       
 20946       if ((sourceFiber.mode & BlockingMode) === NoMode) {
       
 20947         // Reset the memoizedState to what it was before we attempted
       
 20948         // to render it.
       
 20949         var currentSource = sourceFiber.alternate;
       
 20950 
       
 20951         if (currentSource) {
       
 20952           sourceFiber.updateQueue = currentSource.updateQueue;
       
 20953           sourceFiber.memoizedState = currentSource.memoizedState;
       
 20954           sourceFiber.expirationTime = currentSource.expirationTime;
       
 20955         } else {
       
 20956           sourceFiber.updateQueue = null;
       
 20957           sourceFiber.memoizedState = null;
       
 20958         }
       
 20959       }
       
 20960 
       
 20961       var hasInvisibleParentBoundary = hasSuspenseContext(suspenseStackCursor.current, InvisibleParentSuspenseContext); // Schedule the nearest Suspense to re-render the timed out view.
       
 20962 
       
 20963       var _workInProgress = returnFiber;
       
 20964 
       
 20965       do {
       
 20966         if (_workInProgress.tag === SuspenseComponent && shouldCaptureSuspense(_workInProgress, hasInvisibleParentBoundary)) {
       
 20967           // Found the nearest boundary.
       
 20968           // Stash the promise on the boundary fiber. If the boundary times out, we'll
       
 20969           // attach another listener to flip the boundary back to its normal state.
       
 20970           var thenables = _workInProgress.updateQueue;
       
 20971 
       
 20972           if (thenables === null) {
       
 20973             var updateQueue = new Set();
       
 20974             updateQueue.add(thenable);
       
 20975             _workInProgress.updateQueue = updateQueue;
       
 20976           } else {
       
 20977             thenables.add(thenable);
       
 20978           } // If the boundary is outside of blocking mode, we should *not*
       
 20979           // suspend the commit. Pretend as if the suspended component rendered
       
 20980           // null and keep rendering. In the commit phase, we'll schedule a
       
 20981           // subsequent synchronous update to re-render the Suspense.
       
 20982           //
       
 20983           // Note: It doesn't matter whether the component that suspended was
       
 20984           // inside a blocking mode tree. If the Suspense is outside of it, we
       
 20985           // should *not* suspend the commit.
       
 20986 
       
 20987 
       
 20988           if ((_workInProgress.mode & BlockingMode) === NoMode) {
       
 20989             _workInProgress.effectTag |= DidCapture; // We're going to commit this fiber even though it didn't complete.
       
 20990             // But we shouldn't call any lifecycle methods or callbacks. Remove
       
 20991             // all lifecycle effect tags.
       
 20992 
       
 20993             sourceFiber.effectTag &= ~(LifecycleEffectMask | Incomplete);
       
 20994 
       
 20995             if (sourceFiber.tag === ClassComponent) {
       
 20996               var currentSourceFiber = sourceFiber.alternate;
       
 20997 
       
 20998               if (currentSourceFiber === null) {
       
 20999                 // This is a new mount. Change the tag so it's not mistaken for a
       
 21000                 // completed class component. For example, we should not call
       
 21001                 // componentWillUnmount if it is deleted.
       
 21002                 sourceFiber.tag = IncompleteClassComponent;
       
 21003               } else {
       
 21004                 // When we try rendering again, we should not reuse the current fiber,
       
 21005                 // since it's known to be in an inconsistent state. Use a force update to
       
 21006                 // prevent a bail out.
       
 21007                 var update = createUpdate(Sync, null);
       
 21008                 update.tag = ForceUpdate;
       
 21009                 enqueueUpdate(sourceFiber, update);
       
 21010               }
       
 21011             } // The source fiber did not complete. Mark it with Sync priority to
       
 21012             // indicate that it still has pending work.
       
 21013 
       
 21014 
       
 21015             sourceFiber.expirationTime = Sync; // Exit without suspending.
       
 21016 
       
 21017             return;
       
 21018           } // Confirmed that the boundary is in a concurrent mode tree. Continue
       
 21019           // with the normal suspend path.
       
 21020           //
       
 21021           // After this we'll use a set of heuristics to determine whether this
       
 21022           // render pass will run to completion or restart or "suspend" the commit.
       
 21023           // The actual logic for this is spread out in different places.
       
 21024           //
       
 21025           // This first principle is that if we're going to suspend when we complete
       
 21026           // a root, then we should also restart if we get an update or ping that
       
 21027           // might unsuspend it, and vice versa. The only reason to suspend is
       
 21028           // because you think you might want to restart before committing. However,
       
 21029           // it doesn't make sense to restart only while in the period we're suspended.
       
 21030           //
       
 21031           // Restarting too aggressively is also not good because it starves out any
       
 21032           // intermediate loading state. So we use heuristics to determine when.
       
 21033           // Suspense Heuristics
       
 21034           //
       
 21035           // If nothing threw a Promise or all the same fallbacks are already showing,
       
 21036           // then don't suspend/restart.
       
 21037           //
       
 21038           // If this is an initial render of a new tree of Suspense boundaries and
       
 21039           // those trigger a fallback, then don't suspend/restart. We want to ensure
       
 21040           // that we can show the initial loading state as quickly as possible.
       
 21041           //
       
 21042           // If we hit a "Delayed" case, such as when we'd switch from content back into
       
 21043           // a fallback, then we should always suspend/restart. SuspenseConfig applies to
       
 21044           // this case. If none is defined, JND is used instead.
       
 21045           //
       
 21046           // If we're already showing a fallback and it gets "retried", allowing us to show
       
 21047           // another level, but there's still an inner boundary that would show a fallback,
       
 21048           // then we suspend/restart for 500ms since the last time we showed a fallback
       
 21049           // anywhere in the tree. This effectively throttles progressive loading into a
       
 21050           // consistent train of commits. This also gives us an opportunity to restart to
       
 21051           // get to the completed state slightly earlier.
       
 21052           //
       
 21053           // If there's ambiguity due to batching it's resolved in preference of:
       
 21054           // 1) "delayed", 2) "initial render", 3) "retry".
       
 21055           //
       
 21056           // We want to ensure that a "busy" state doesn't get force committed. We want to
       
 21057           // ensure that new initial loading states can commit as soon as possible.
       
 21058 
       
 21059 
       
 21060           attachPingListener(root, renderExpirationTime, thenable);
       
 21061           _workInProgress.effectTag |= ShouldCapture;
       
 21062           _workInProgress.expirationTime = renderExpirationTime;
       
 21063           return;
       
 21064         } // This boundary already captured during this render. Continue to the next
       
 21065         // boundary.
       
 21066 
       
 21067 
       
 21068         _workInProgress = _workInProgress.return;
       
 21069       } while (_workInProgress !== null); // No boundary was found. Fallthrough to error mode.
       
 21070       // TODO: Use invariant so the message is stripped in prod?
       
 21071 
       
 21072 
       
 21073       value = new Error((getComponentName(sourceFiber.type) || 'A React component') + ' suspended while rendering, but no fallback UI was specified.\n' + '\n' + 'Add a <Suspense fallback=...> component higher in the tree to ' + 'provide a loading indicator or placeholder to display.' + getStackByFiberInDevAndProd(sourceFiber));
       
 21074     } // We didn't find a boundary that could handle this type of exception. Start
       
 21075     // over and traverse parent path again, this time treating the exception
       
 21076     // as an error.
       
 21077 
       
 21078 
       
 21079     renderDidError();
       
 21080     value = createCapturedValue(value, sourceFiber);
       
 21081     var workInProgress = returnFiber;
       
 21082 
       
 21083     do {
       
 21084       switch (workInProgress.tag) {
       
 21085         case HostRoot:
       
 21086           {
       
 21087             var _errorInfo = value;
       
 21088             workInProgress.effectTag |= ShouldCapture;
       
 21089             workInProgress.expirationTime = renderExpirationTime;
       
 21090 
       
 21091             var _update = createRootErrorUpdate(workInProgress, _errorInfo, renderExpirationTime);
       
 21092 
       
 21093             enqueueCapturedUpdate(workInProgress, _update);
       
 21094             return;
       
 21095           }
       
 21096 
       
 21097         case ClassComponent:
       
 21098           // Capture and retry
       
 21099           var errorInfo = value;
       
 21100           var ctor = workInProgress.type;
       
 21101           var instance = workInProgress.stateNode;
       
 21102 
       
 21103           if ((workInProgress.effectTag & DidCapture) === NoEffect && (typeof ctor.getDerivedStateFromError === 'function' || instance !== null && typeof instance.componentDidCatch === 'function' && !isAlreadyFailedLegacyErrorBoundary(instance))) {
       
 21104             workInProgress.effectTag |= ShouldCapture;
       
 21105             workInProgress.expirationTime = renderExpirationTime; // Schedule the error boundary to re-render using updated state
       
 21106 
       
 21107             var _update2 = createClassErrorUpdate(workInProgress, errorInfo, renderExpirationTime);
       
 21108 
       
 21109             enqueueCapturedUpdate(workInProgress, _update2);
       
 21110             return;
       
 21111           }
       
 21112 
       
 21113           break;
       
 21114       }
       
 21115 
       
 21116       workInProgress = workInProgress.return;
       
 21117     } while (workInProgress !== null);
       
 21118   }
       
 21119 
       
 21120   var ceil = Math.ceil;
       
 21121   var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher,
       
 21122       ReactCurrentOwner$2 = ReactSharedInternals.ReactCurrentOwner,
       
 21123       IsSomeRendererActing = ReactSharedInternals.IsSomeRendererActing;
       
 21124   var NoContext =
       
 21125   /*                    */
       
 21126   0;
       
 21127   var BatchedContext =
       
 21128   /*               */
       
 21129   1;
       
 21130   var EventContext =
       
 21131   /*                 */
       
 21132   2;
       
 21133   var DiscreteEventContext =
       
 21134   /*         */
       
 21135   4;
       
 21136   var LegacyUnbatchedContext =
       
 21137   /*       */
       
 21138   8;
       
 21139   var RenderContext =
       
 21140   /*                */
       
 21141   16;
       
 21142   var CommitContext =
       
 21143   /*                */
       
 21144   32;
       
 21145   var RootIncomplete = 0;
       
 21146   var RootFatalErrored = 1;
       
 21147   var RootErrored = 2;
       
 21148   var RootSuspended = 3;
       
 21149   var RootSuspendedWithDelay = 4;
       
 21150   var RootCompleted = 5;
       
 21151   // Describes where we are in the React execution stack
       
 21152   var executionContext = NoContext; // The root we're working on
       
 21153 
       
 21154   var workInProgressRoot = null; // The fiber we're working on
       
 21155 
       
 21156   var workInProgress = null; // The expiration time we're rendering
       
 21157 
       
 21158   var renderExpirationTime$1 = NoWork; // Whether to root completed, errored, suspended, etc.
       
 21159 
       
 21160   var workInProgressRootExitStatus = RootIncomplete; // A fatal error, if one is thrown
       
 21161 
       
 21162   var workInProgressRootFatalError = null; // Most recent event time among processed updates during this render.
       
 21163   // This is conceptually a time stamp but expressed in terms of an ExpirationTime
       
 21164   // because we deal mostly with expiration times in the hot path, so this avoids
       
 21165   // the conversion happening in the hot path.
       
 21166 
       
 21167   var workInProgressRootLatestProcessedExpirationTime = Sync;
       
 21168   var workInProgressRootLatestSuspenseTimeout = Sync;
       
 21169   var workInProgressRootCanSuspendUsingConfig = null; // The work left over by components that were visited during this render. Only
       
 21170   // includes unprocessed updates, not work in bailed out children.
       
 21171 
       
 21172   var workInProgressRootNextUnprocessedUpdateTime = NoWork; // If we're pinged while rendering we don't always restart immediately.
       
 21173   // This flag determines if it might be worthwhile to restart if an opportunity
       
 21174   // happens latere.
       
 21175 
       
 21176   var workInProgressRootHasPendingPing = false; // The most recent time we committed a fallback. This lets us ensure a train
       
 21177   // model where we don't commit new loading states in too quick succession.
       
 21178 
       
 21179   var globalMostRecentFallbackTime = 0;
       
 21180   var FALLBACK_THROTTLE_MS = 500;
       
 21181   var nextEffect = null;
       
 21182   var hasUncaughtError = false;
       
 21183   var firstUncaughtError = null;
       
 21184   var legacyErrorBoundariesThatAlreadyFailed = null;
       
 21185   var rootDoesHavePassiveEffects = false;
       
 21186   var rootWithPendingPassiveEffects = null;
       
 21187   var pendingPassiveEffectsRenderPriority = NoPriority;
       
 21188   var pendingPassiveEffectsExpirationTime = NoWork;
       
 21189   var rootsWithPendingDiscreteUpdates = null; // Use these to prevent an infinite loop of nested updates
       
 21190 
       
 21191   var NESTED_UPDATE_LIMIT = 50;
       
 21192   var nestedUpdateCount = 0;
       
 21193   var rootWithNestedUpdates = null;
       
 21194   var NESTED_PASSIVE_UPDATE_LIMIT = 50;
       
 21195   var nestedPassiveUpdateCount = 0;
       
 21196   var interruptedBy = null; // Marks the need to reschedule pending interactions at these expiration times
       
 21197   // during the commit phase. This enables them to be traced across components
       
 21198   // that spawn new work during render. E.g. hidden boundaries, suspended SSR
       
 21199   // hydration or SuspenseList.
       
 21200 
       
 21201   var spawnedWorkDuringRender = null; // Expiration times are computed by adding to the current time (the start
       
 21202   // time). However, if two updates are scheduled within the same event, we
       
 21203   // should treat their start times as simultaneous, even if the actual clock
       
 21204   // time has advanced between the first and second call.
       
 21205   // In other words, because expiration times determine how updates are batched,
       
 21206   // we want all updates of like priority that occur within the same event to
       
 21207   // receive the same expiration time. Otherwise we get tearing.
       
 21208 
       
 21209   var currentEventTime = NoWork;
       
 21210   function requestCurrentTimeForUpdate() {
       
 21211     if ((executionContext & (RenderContext | CommitContext)) !== NoContext) {
       
 21212       // We're inside React, so it's fine to read the actual time.
       
 21213       return msToExpirationTime(now());
       
 21214     } // We're not inside React, so we may be in the middle of a browser event.
       
 21215 
       
 21216 
       
 21217     if (currentEventTime !== NoWork) {
       
 21218       // Use the same start time for all updates until we enter React again.
       
 21219       return currentEventTime;
       
 21220     } // This is the first update since React yielded. Compute a new start time.
       
 21221 
       
 21222 
       
 21223     currentEventTime = msToExpirationTime(now());
       
 21224     return currentEventTime;
       
 21225   }
       
 21226   function getCurrentTime() {
       
 21227     return msToExpirationTime(now());
       
 21228   }
       
 21229   function computeExpirationForFiber(currentTime, fiber, suspenseConfig) {
       
 21230     var mode = fiber.mode;
       
 21231 
       
 21232     if ((mode & BlockingMode) === NoMode) {
       
 21233       return Sync;
       
 21234     }
       
 21235 
       
 21236     var priorityLevel = getCurrentPriorityLevel();
       
 21237 
       
 21238     if ((mode & ConcurrentMode) === NoMode) {
       
 21239       return priorityLevel === ImmediatePriority ? Sync : Batched;
       
 21240     }
       
 21241 
       
 21242     if ((executionContext & RenderContext) !== NoContext) {
       
 21243       // Use whatever time we're already rendering
       
 21244       // TODO: Should there be a way to opt out, like with `runWithPriority`?
       
 21245       return renderExpirationTime$1;
       
 21246     }
       
 21247 
       
 21248     var expirationTime;
       
 21249 
       
 21250     if (suspenseConfig !== null) {
       
 21251       // Compute an expiration time based on the Suspense timeout.
       
 21252       expirationTime = computeSuspenseExpiration(currentTime, suspenseConfig.timeoutMs | 0 || LOW_PRIORITY_EXPIRATION);
       
 21253     } else {
       
 21254       // Compute an expiration time based on the Scheduler priority.
       
 21255       switch (priorityLevel) {
       
 21256         case ImmediatePriority:
       
 21257           expirationTime = Sync;
       
 21258           break;
       
 21259 
       
 21260         case UserBlockingPriority$1:
       
 21261           // TODO: Rename this to computeUserBlockingExpiration
       
 21262           expirationTime = computeInteractiveExpiration(currentTime);
       
 21263           break;
       
 21264 
       
 21265         case NormalPriority:
       
 21266         case LowPriority:
       
 21267           // TODO: Handle LowPriority
       
 21268           // TODO: Rename this to... something better.
       
 21269           expirationTime = computeAsyncExpiration(currentTime);
       
 21270           break;
       
 21271 
       
 21272         case IdlePriority:
       
 21273           expirationTime = Idle;
       
 21274           break;
       
 21275 
       
 21276         default:
 20981           {
 21277           {
 20982             {
 21278             {
 20983               throw ReactError(Error('This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue.'));
 21279               throw Error( "Expected a valid priority level" );
 20984             }
 21280             }
 20985           }
 21281           }
 20986         })();
 21282 
 20987       }
 21283       }
 20988   }
 21284     } // If we're in the middle of rendering a tree, do not update at the same
 20989 }
 21285     // expiration time that is already rendering.
 20990 
 21286     // TODO: We shouldn't have to do this if the update is on a different root.
 20991 function commitSuspenseComponent(finishedWork) {
 21287     // Refactor computeExpirationForFiber + scheduleUpdate so we have access to
 20992   var newState = finishedWork.memoizedState;
 21288     // the root when we check for this condition.
 20993 
 21289 
 20994   var newDidTimeout = void 0;
 21290 
 20995   var primaryChildParent = finishedWork;
 21291     if (workInProgressRoot !== null && expirationTime === renderExpirationTime$1) {
 20996   if (newState === null) {
 21292       // This is a trick to move this update into a separate batch
 20997     newDidTimeout = false;
 21293       expirationTime -= 1;
 20998   } else {
 21294     }
 20999     newDidTimeout = true;
 21295 
 21000     primaryChildParent = finishedWork.child;
 21296     return expirationTime;
 21001     markCommitTimeOfFallback();
 21297   }
 21002   }
 21298   function scheduleUpdateOnFiber(fiber, expirationTime) {
 21003 
 21299     checkForNestedUpdates();
 21004   if (supportsMutation && primaryChildParent !== null) {
 21300     warnAboutRenderPhaseUpdatesInDEV(fiber);
 21005     hideOrUnhideAllChildren(primaryChildParent, newDidTimeout);
 21301     var root = markUpdateTimeFromFiberToRoot(fiber, expirationTime);
 21006   }
 21302 
 21007 
 21303     if (root === null) {
 21008   if (enableSuspenseCallback && newState !== null) {
 21304       warnAboutUpdateOnUnmountedFiberInDEV(fiber);
 21009     var suspenseCallback = finishedWork.memoizedProps.suspenseCallback;
 21305       return;
 21010     if (typeof suspenseCallback === 'function') {
 21306     }
 21011       var thenables = finishedWork.updateQueue;
 21307 
 21012       if (thenables !== null) {
 21308     checkForInterruption(fiber, expirationTime);
 21013         suspenseCallback(new Set(thenables));
 21309     recordScheduleUpdate(); // TODO: computeExpirationForFiber also reads the priority. Pass the
       
 21310     // priority as an argument to that function and this one.
       
 21311 
       
 21312     var priorityLevel = getCurrentPriorityLevel();
       
 21313 
       
 21314     if (expirationTime === Sync) {
       
 21315       if ( // Check if we're inside unbatchedUpdates
       
 21316       (executionContext & LegacyUnbatchedContext) !== NoContext && // Check if we're not already rendering
       
 21317       (executionContext & (RenderContext | CommitContext)) === NoContext) {
       
 21318         // Register pending interactions on the root to avoid losing traced interaction data.
       
 21319         schedulePendingInteractions(root, expirationTime); // This is a legacy edge case. The initial mount of a ReactDOM.render-ed
       
 21320         // root inside of batchedUpdates should be synchronous, but layout updates
       
 21321         // should be deferred until the end of the batch.
       
 21322 
       
 21323         performSyncWorkOnRoot(root);
       
 21324       } else {
       
 21325         ensureRootIsScheduled(root);
       
 21326         schedulePendingInteractions(root, expirationTime);
       
 21327 
       
 21328         if (executionContext === NoContext) {
       
 21329           // Flush the synchronous work now, unless we're already working or inside
       
 21330           // a batch. This is intentionally inside scheduleUpdateOnFiber instead of
       
 21331           // scheduleCallbackForFiber to preserve the ability to schedule a callback
       
 21332           // without immediately flushing it. We only do this for user-initiated
       
 21333           // updates, to preserve historical behavior of legacy mode.
       
 21334           flushSyncCallbackQueue();
       
 21335         }
 21014       }
 21336       }
 21015     } else {
 21337     } else {
 21016       if (suspenseCallback !== undefined) {
 21338       ensureRootIsScheduled(root);
 21017         warning$1(false, 'Unexpected type for suspenseCallback.');
 21339       schedulePendingInteractions(root, expirationTime);
 21018       }
 21340     }
 21019     }
 21341 
 21020   }
 21342     if ((executionContext & DiscreteEventContext) !== NoContext && ( // Only updates at user-blocking priority or greater are considered
 21021 }
 21343     // discrete, even inside a discrete event.
 21022 
 21344     priorityLevel === UserBlockingPriority$1 || priorityLevel === ImmediatePriority)) {
 21023 function attachSuspenseRetryListeners(finishedWork) {
 21345       // This is the result of a discrete event. Track the lowest priority
 21024   // If this boundary just timed out, then it will have a set of thenables.
 21346       // discrete update per root so we can flush them early, if needed.
 21025   // For each thenable, attach a listener so that when it resolves, React
 21347       if (rootsWithPendingDiscreteUpdates === null) {
 21026   var thenables = finishedWork.updateQueue;
 21348         rootsWithPendingDiscreteUpdates = new Map([[root, expirationTime]]);
 21027   if (thenables !== null) {
 21349       } else {
 21028     finishedWork.updateQueue = null;
 21350         var lastDiscreteTime = rootsWithPendingDiscreteUpdates.get(root);
 21029     var retryCache = finishedWork.stateNode;
 21351 
 21030     if (retryCache === null) {
 21352         if (lastDiscreteTime === undefined || lastDiscreteTime > expirationTime) {
 21031       retryCache = finishedWork.stateNode = new PossiblyWeakSet$1();
 21353           rootsWithPendingDiscreteUpdates.set(root, expirationTime);
 21032     }
 21354         }
 21033     thenables.forEach(function (thenable) {
 21355       }
 21034       // Memoize using the boundary fiber to prevent redundant listeners.
 21356     }
 21035       var retry = resolveRetryThenable.bind(null, finishedWork, thenable);
 21357   }
 21036       if (!retryCache.has(thenable)) {
 21358   var scheduleWork = scheduleUpdateOnFiber; // This is split into a separate function so we can mark a fiber with pending
 21037         if (enableSchedulerTracing) {
 21359   // work without treating it as a typical update that originates from an event;
 21038           retry = unstable_wrap(retry);
 21360   // e.g. retrying a Suspense boundary isn't an update, but it does schedule work
 21039         }
 21361   // on a fiber.
 21040         retryCache.add(thenable);
 21362 
 21041         thenable.then(retry, retry);
 21363   function markUpdateTimeFromFiberToRoot(fiber, expirationTime) {
 21042       }
 21364     // Update the source fiber's expiration time
 21043     });
 21365     if (fiber.expirationTime < expirationTime) {
 21044   }
 21366       fiber.expirationTime = expirationTime;
 21045 }
 21367     }
 21046 
 21368 
 21047 function commitResetTextContent(current$$1) {
 21369     var alternate = fiber.alternate;
 21048   if (!supportsMutation) {
 21370 
 21049     return;
 21371     if (alternate !== null && alternate.expirationTime < expirationTime) {
 21050   }
 21372       alternate.expirationTime = expirationTime;
 21051   resetTextContent(current$$1.stateNode);
 21373     } // Walk the parent path to the root and update the child expiration time.
 21052 }
 21374 
 21053 
 21375 
 21054 var PossiblyWeakSet = typeof WeakSet === 'function' ? WeakSet : Set;
 21376     var node = fiber.return;
 21055 var PossiblyWeakMap$1 = typeof WeakMap === 'function' ? WeakMap : Map;
 21377     var root = null;
 21056 
 21378 
 21057 function createRootErrorUpdate(fiber, errorInfo, expirationTime) {
 21379     if (node === null && fiber.tag === HostRoot) {
 21058   var update = createUpdate(expirationTime, null);
 21380       root = fiber.stateNode;
 21059   // Unmount the root by rendering null.
 21381     } else {
 21060   update.tag = CaptureUpdate;
 21382       while (node !== null) {
 21061   // Caution: React DevTools currently depends on this property
 21383         alternate = node.alternate;
 21062   // being called "element".
 21384 
 21063   update.payload = { element: null };
 21385         if (node.childExpirationTime < expirationTime) {
 21064   var error = errorInfo.value;
 21386           node.childExpirationTime = expirationTime;
 21065   update.callback = function () {
 21387 
 21066     onUncaughtError(error);
 21388           if (alternate !== null && alternate.childExpirationTime < expirationTime) {
 21067     logError(fiber, errorInfo);
 21389             alternate.childExpirationTime = expirationTime;
 21068   };
 21390           }
 21069   return update;
 21391         } else if (alternate !== null && alternate.childExpirationTime < expirationTime) {
 21070 }
 21392           alternate.childExpirationTime = expirationTime;
 21071 
 21393         }
 21072 function createClassErrorUpdate(fiber, errorInfo, expirationTime) {
 21394 
 21073   var update = createUpdate(expirationTime, null);
 21395         if (node.return === null && node.tag === HostRoot) {
 21074   update.tag = CaptureUpdate;
 21396           root = node.stateNode;
 21075   var getDerivedStateFromError = fiber.type.getDerivedStateFromError;
 21397           break;
 21076   if (typeof getDerivedStateFromError === 'function') {
 21398         }
 21077     var error = errorInfo.value;
 21399 
 21078     update.payload = function () {
 21400         node = node.return;
 21079       logError(fiber, errorInfo);
 21401       }
 21080       return getDerivedStateFromError(error);
 21402     }
 21081     };
 21403 
 21082   }
 21404     if (root !== null) {
 21083 
 21405       if (workInProgressRoot === root) {
 21084   var inst = fiber.stateNode;
 21406         // Received an update to a tree that's in the middle of rendering. Mark
 21085   if (inst !== null && typeof inst.componentDidCatch === 'function') {
 21407         // that's unprocessed work on this root.
 21086     update.callback = function callback() {
 21408         markUnprocessedUpdateTime(expirationTime);
       
 21409 
       
 21410         if (workInProgressRootExitStatus === RootSuspendedWithDelay) {
       
 21411           // The root already suspended with a delay, which means this render
       
 21412           // definitely won't finish. Since we have a new update, let's mark it as
       
 21413           // suspended now, right before marking the incoming update. This has the
       
 21414           // effect of interrupting the current render and switching to the update.
       
 21415           // TODO: This happens to work when receiving an update during the render
       
 21416           // phase, because of the trick inside computeExpirationForFiber to
       
 21417           // subtract 1 from `renderExpirationTime` to move it into a
       
 21418           // separate bucket. But we should probably model it with an exception,
       
 21419           // using the same mechanism we use to force hydration of a subtree.
       
 21420           // TODO: This does not account for low pri updates that were already
       
 21421           // scheduled before the root started rendering. Need to track the next
       
 21422           // pending expiration time (perhaps by backtracking the return path) and
       
 21423           // then trigger a restart in the `renderDidSuspendDelayIfPossible` path.
       
 21424           markRootSuspendedAtTime(root, renderExpirationTime$1);
       
 21425         }
       
 21426       } // Mark that the root has a pending update.
       
 21427 
       
 21428 
       
 21429       markRootUpdatedAtTime(root, expirationTime);
       
 21430     }
       
 21431 
       
 21432     return root;
       
 21433   }
       
 21434 
       
 21435   function getNextRootExpirationTimeToWorkOn(root) {
       
 21436     // Determines the next expiration time that the root should render, taking
       
 21437     // into account levels that may be suspended, or levels that may have
       
 21438     // received a ping.
       
 21439     var lastExpiredTime = root.lastExpiredTime;
       
 21440 
       
 21441     if (lastExpiredTime !== NoWork) {
       
 21442       return lastExpiredTime;
       
 21443     } // "Pending" refers to any update that hasn't committed yet, including if it
       
 21444     // suspended. The "suspended" range is therefore a subset.
       
 21445 
       
 21446 
       
 21447     var firstPendingTime = root.firstPendingTime;
       
 21448 
       
 21449     if (!isRootSuspendedAtTime(root, firstPendingTime)) {
       
 21450       // The highest priority pending time is not suspended. Let's work on that.
       
 21451       return firstPendingTime;
       
 21452     } // If the first pending time is suspended, check if there's a lower priority
       
 21453     // pending level that we know about. Or check if we received a ping. Work
       
 21454     // on whichever is higher priority.
       
 21455 
       
 21456 
       
 21457     var lastPingedTime = root.lastPingedTime;
       
 21458     var nextKnownPendingLevel = root.nextKnownPendingLevel;
       
 21459     var nextLevel = lastPingedTime > nextKnownPendingLevel ? lastPingedTime : nextKnownPendingLevel;
       
 21460 
       
 21461     if ( nextLevel <= Idle && firstPendingTime !== nextLevel) {
       
 21462       // Don't work on Idle/Never priority unless everything else is committed.
       
 21463       return NoWork;
       
 21464     }
       
 21465 
       
 21466     return nextLevel;
       
 21467   } // Use this function to schedule a task for a root. There's only one task per
       
 21468   // root; if a task was already scheduled, we'll check to make sure the
       
 21469   // expiration time of the existing task is the same as the expiration time of
       
 21470   // the next level that the root has work on. This function is called on every
       
 21471   // update, and right before exiting a task.
       
 21472 
       
 21473 
       
 21474   function ensureRootIsScheduled(root) {
       
 21475     var lastExpiredTime = root.lastExpiredTime;
       
 21476 
       
 21477     if (lastExpiredTime !== NoWork) {
       
 21478       // Special case: Expired work should flush synchronously.
       
 21479       root.callbackExpirationTime = Sync;
       
 21480       root.callbackPriority = ImmediatePriority;
       
 21481       root.callbackNode = scheduleSyncCallback(performSyncWorkOnRoot.bind(null, root));
       
 21482       return;
       
 21483     }
       
 21484 
       
 21485     var expirationTime = getNextRootExpirationTimeToWorkOn(root);
       
 21486     var existingCallbackNode = root.callbackNode;
       
 21487 
       
 21488     if (expirationTime === NoWork) {
       
 21489       // There's nothing to work on.
       
 21490       if (existingCallbackNode !== null) {
       
 21491         root.callbackNode = null;
       
 21492         root.callbackExpirationTime = NoWork;
       
 21493         root.callbackPriority = NoPriority;
       
 21494       }
       
 21495 
       
 21496       return;
       
 21497     } // TODO: If this is an update, we already read the current time. Pass the
       
 21498     // time as an argument.
       
 21499 
       
 21500 
       
 21501     var currentTime = requestCurrentTimeForUpdate();
       
 21502     var priorityLevel = inferPriorityFromExpirationTime(currentTime, expirationTime); // If there's an existing render task, confirm it has the correct priority and
       
 21503     // expiration time. Otherwise, we'll cancel it and schedule a new one.
       
 21504 
       
 21505     if (existingCallbackNode !== null) {
       
 21506       var existingCallbackPriority = root.callbackPriority;
       
 21507       var existingCallbackExpirationTime = root.callbackExpirationTime;
       
 21508 
       
 21509       if ( // Callback must have the exact same expiration time.
       
 21510       existingCallbackExpirationTime === expirationTime && // Callback must have greater or equal priority.
       
 21511       existingCallbackPriority >= priorityLevel) {
       
 21512         // Existing callback is sufficient.
       
 21513         return;
       
 21514       } // Need to schedule a new task.
       
 21515       // TODO: Instead of scheduling a new task, we should be able to change the
       
 21516       // priority of the existing one.
       
 21517 
       
 21518 
       
 21519       cancelCallback(existingCallbackNode);
       
 21520     }
       
 21521 
       
 21522     root.callbackExpirationTime = expirationTime;
       
 21523     root.callbackPriority = priorityLevel;
       
 21524     var callbackNode;
       
 21525 
       
 21526     if (expirationTime === Sync) {
       
 21527       // Sync React callbacks are scheduled on a special internal queue
       
 21528       callbackNode = scheduleSyncCallback(performSyncWorkOnRoot.bind(null, root));
       
 21529     } else {
       
 21530       callbackNode = scheduleCallback(priorityLevel, performConcurrentWorkOnRoot.bind(null, root), // Compute a task timeout based on the expiration time. This also affects
       
 21531       // ordering because tasks are processed in timeout order.
 21087       {
 21532       {
 21088         markFailedErrorBoundaryForHotReloading(fiber);
 21533         timeout: expirationTimeToMs(expirationTime) - now()
 21089       }
       
 21090       if (typeof getDerivedStateFromError !== 'function') {
       
 21091         // To preserve the preexisting retry behavior of error boundaries,
       
 21092         // we keep track of which ones already failed during this batch.
       
 21093         // This gets reset before we yield back to the browser.
       
 21094         // TODO: Warn in strict mode if getDerivedStateFromError is
       
 21095         // not defined.
       
 21096         markLegacyErrorBoundaryAsFailed(this);
       
 21097 
       
 21098         // Only log here if componentDidCatch is the only error boundary method defined
       
 21099         logError(fiber, errorInfo);
       
 21100       }
       
 21101       var error = errorInfo.value;
       
 21102       var stack = errorInfo.stack;
       
 21103       this.componentDidCatch(error, {
       
 21104         componentStack: stack !== null ? stack : ''
       
 21105       });
 21534       });
 21106       {
 21535     }
 21107         if (typeof getDerivedStateFromError !== 'function') {
 21536 
 21108           // If componentDidCatch is the only error boundary method defined,
 21537     root.callbackNode = callbackNode;
 21109           // then it needs to call setState to recover from errors.
 21538   } // This is the entry point for every concurrent task, i.e. anything that
 21110           // If no state update is scheduled then the boundary will swallow the error.
 21539   // goes through Scheduler.
 21111           !(fiber.expirationTime === Sync) ? warningWithoutStack$1(false, '%s: Error boundaries should implement getDerivedStateFromError(). ' + 'In that method, return a state update to display an error message or fallback UI.', getComponentName(fiber.type) || 'Unknown') : void 0;
 21540 
 21112         }
 21541 
 21113       }
 21542   function performConcurrentWorkOnRoot(root, didTimeout) {
 21114     };
 21543     // Since we know we're in a React event, we can clear the current
 21115   } else {
 21544     // event time. The next update will compute a new event time.
 21116     update.callback = function () {
 21545     currentEventTime = NoWork;
 21117       markFailedErrorBoundaryForHotReloading(fiber);
 21546 
 21118     };
 21547     if (didTimeout) {
 21119   }
 21548       // The render task took too long to complete. Mark the current time as
 21120   return update;
 21549       // expired to synchronously render all expired work in a single batch.
 21121 }
 21550       var currentTime = requestCurrentTimeForUpdate();
 21122 
 21551       markRootExpiredAtTime(root, currentTime); // This will schedule a synchronous callback.
 21123 function attachPingListener(root, renderExpirationTime, thenable) {
 21552 
 21124   // Attach a listener to the promise to "ping" the root and retry. But
 21553       ensureRootIsScheduled(root);
 21125   // only if one does not already exist for the current render expiration
 21554       return null;
 21126   // time (which acts like a "thread ID" here).
 21555     } // Determine the next expiration time to work on, using the fields stored
 21127   var pingCache = root.pingCache;
 21556     // on the root.
 21128   var threadIDs = void 0;
 21557 
 21129   if (pingCache === null) {
 21558 
 21130     pingCache = root.pingCache = new PossiblyWeakMap$1();
 21559     var expirationTime = getNextRootExpirationTimeToWorkOn(root);
 21131     threadIDs = new Set();
 21560 
 21132     pingCache.set(thenable, threadIDs);
 21561     if (expirationTime !== NoWork) {
 21133   } else {
 21562       var originalCallbackNode = root.callbackNode;
 21134     threadIDs = pingCache.get(thenable);
 21563 
 21135     if (threadIDs === undefined) {
 21564       if (!((executionContext & (RenderContext | CommitContext)) === NoContext)) {
 21136       threadIDs = new Set();
 21565         {
 21137       pingCache.set(thenable, threadIDs);
 21566           throw Error( "Should not already be working." );
 21138     }
 21567         }
 21139   }
 21568       }
 21140   if (!threadIDs.has(renderExpirationTime)) {
 21569 
 21141     // Memoize using the thread ID to prevent redundant listeners.
 21570       flushPassiveEffects(); // If the root or expiration time have changed, throw out the existing stack
 21142     threadIDs.add(renderExpirationTime);
 21571       // and prepare a fresh one. Otherwise we'll continue where we left off.
 21143     var ping = pingSuspendedRoot.bind(null, root, thenable, renderExpirationTime);
 21572 
 21144     if (enableSchedulerTracing) {
 21573       if (root !== workInProgressRoot || expirationTime !== renderExpirationTime$1) {
 21145       ping = unstable_wrap(ping);
 21574         prepareFreshStack(root, expirationTime);
 21146     }
 21575         startWorkOnPendingInteractions(root, expirationTime);
 21147     thenable.then(ping, ping);
 21576       } // If we have a work-in-progress fiber, it means there's still work to do
 21148   }
 21577       // in this root.
 21149 }
 21578 
 21150 
 21579 
 21151 function throwException(root, returnFiber, sourceFiber, value, renderExpirationTime) {
 21580       if (workInProgress !== null) {
 21152   // The source fiber did not complete.
 21581         var prevExecutionContext = executionContext;
 21153   sourceFiber.effectTag |= Incomplete;
 21582         executionContext |= RenderContext;
 21154   // Its effect list is no longer valid.
 21583         var prevDispatcher = pushDispatcher();
 21155   sourceFiber.firstEffect = sourceFiber.lastEffect = null;
 21584         var prevInteractions = pushInteractions(root);
 21156 
 21585         startWorkLoopTimer(workInProgress);
 21157   if (value !== null && typeof value === 'object' && typeof value.then === 'function') {
 21586 
 21158     // This is a thenable.
 21587         do {
 21159     var thenable = value;
 21588           try {
 21160 
 21589             workLoopConcurrent();
 21161     checkForWrongSuspensePriorityInDEV(sourceFiber);
 21590             break;
 21162 
 21591           } catch (thrownValue) {
 21163     var hasInvisibleParentBoundary = hasSuspenseContext(suspenseStackCursor.current, InvisibleParentSuspenseContext);
 21592             handleError(root, thrownValue);
 21164 
 21593           }
 21165     // Schedule the nearest Suspense to re-render the timed out view.
 21594         } while (true);
 21166     var _workInProgress = returnFiber;
 21595 
 21167     do {
 21596         resetContextDependencies();
 21168       if (_workInProgress.tag === SuspenseComponent && shouldCaptureSuspense(_workInProgress, hasInvisibleParentBoundary)) {
 21597         executionContext = prevExecutionContext;
 21169         // Found the nearest boundary.
 21598         popDispatcher(prevDispatcher);
 21170 
 21599 
 21171         // Stash the promise on the boundary fiber. If the boundary times out, we'll
 21600         {
 21172         var thenables = _workInProgress.updateQueue;
 21601           popInteractions(prevInteractions);
 21173         if (thenables === null) {
 21602         }
 21174           var updateQueue = new Set();
 21603 
 21175           updateQueue.add(thenable);
 21604         if (workInProgressRootExitStatus === RootFatalErrored) {
 21176           _workInProgress.updateQueue = updateQueue;
 21605           var fatalError = workInProgressRootFatalError;
       
 21606           stopInterruptedWorkLoopTimer();
       
 21607           prepareFreshStack(root, expirationTime);
       
 21608           markRootSuspendedAtTime(root, expirationTime);
       
 21609           ensureRootIsScheduled(root);
       
 21610           throw fatalError;
       
 21611         }
       
 21612 
       
 21613         if (workInProgress !== null) {
       
 21614           // There's still work left over. Exit without committing.
       
 21615           stopInterruptedWorkLoopTimer();
 21177         } else {
 21616         } else {
 21178           thenables.add(thenable);
 21617           // We now have a consistent tree. The next step is either to commit it,
 21179         }
 21618           // or, if something suspended, wait to commit it after a timeout.
 21180 
 21619           stopFinishedWorkLoopTimer();
 21181         // If the boundary is outside of batched mode, we should *not*
 21620           var finishedWork = root.finishedWork = root.current.alternate;
 21182         // suspend the commit. Pretend as if the suspended component rendered
 21621           root.finishedExpirationTime = expirationTime;
 21183         // null and keep rendering. In the commit phase, we'll schedule a
 21622           finishConcurrentRender(root, finishedWork, workInProgressRootExitStatus, expirationTime);
 21184         // subsequent synchronous update to re-render the Suspense.
 21623         }
 21185         //
 21624 
 21186         // Note: It doesn't matter whether the component that suspended was
 21625         ensureRootIsScheduled(root);
 21187         // inside a batched mode tree. If the Suspense is outside of it, we
 21626 
 21188         // should *not* suspend the commit.
 21627         if (root.callbackNode === originalCallbackNode) {
 21189         if ((_workInProgress.mode & BatchedMode) === NoMode) {
 21628           // The task node scheduled for this root is the same one that's
 21190           _workInProgress.effectTag |= DidCapture;
 21629           // currently executed. Need to return a continuation.
 21191 
 21630           return performConcurrentWorkOnRoot.bind(null, root);
 21192           // We're going to commit this fiber even though it didn't complete.
 21631         }
 21193           // But we shouldn't call any lifecycle methods or callbacks. Remove
 21632       }
 21194           // all lifecycle effect tags.
 21633     }
 21195           sourceFiber.effectTag &= ~(LifecycleEffectMask | Incomplete);
 21634 
 21196 
 21635     return null;
 21197           if (sourceFiber.tag === ClassComponent) {
 21636   }
 21198             var currentSourceFiber = sourceFiber.alternate;
 21637 
 21199             if (currentSourceFiber === null) {
 21638   function finishConcurrentRender(root, finishedWork, exitStatus, expirationTime) {
 21200               // This is a new mount. Change the tag so it's not mistaken for a
 21639     // Set this to null to indicate there's no in-progress render.
 21201               // completed class component. For example, we should not call
 21640     workInProgressRoot = null;
 21202               // componentWillUnmount if it is deleted.
 21641 
 21203               sourceFiber.tag = IncompleteClassComponent;
 21642     switch (exitStatus) {
 21204             } else {
 21643       case RootIncomplete:
 21205               // When we try rendering again, we should not reuse the current fiber,
 21644       case RootFatalErrored:
 21206               // since it's known to be in an inconsistent state. Use a force update to
 21645         {
 21207               // prevent a bail out.
 21646           {
 21208               var update = createUpdate(Sync, null);
 21647             {
 21209               update.tag = ForceUpdate;
 21648               throw Error( "Root did not complete. This is a bug in React." );
 21210               enqueueUpdate(sourceFiber, update);
       
 21211             }
 21649             }
 21212           }
 21650           }
 21213 
 21651         }
 21214           // The source fiber did not complete. Mark it with Sync priority to
 21652       // Flow knows about invariant, so it complains if I add a break
 21215           // indicate that it still has pending work.
 21653       // statement, but eslint doesn't know about invariant, so it complains
 21216           sourceFiber.expirationTime = Sync;
 21654       // if I do. eslint-disable-next-line no-fallthrough
 21217 
 21655 
 21218           // Exit without suspending.
 21656       case RootErrored:
 21219           return;
 21657         {
 21220         }
 21658           // If this was an async render, the error may have happened due to
 21221 
 21659           // a mutation in a concurrent event. Try rendering one more time,
 21222         // Confirmed that the boundary is in a concurrent mode tree. Continue
 21660           // synchronously, to see if the error goes away. If there are
 21223         // with the normal suspend path.
 21661           // lower priority updates, let's include those, too, in case they
 21224         //
 21662           // fix the inconsistency. Render at Idle to include all updates.
 21225         // After this we'll use a set of heuristics to determine whether this
 21663           // If it was Idle or Never or some not-yet-invented time, render
 21226         // render pass will run to completion or restart or "suspend" the commit.
 21664           // at that time.
 21227         // The actual logic for this is spread out in different places.
 21665           markRootExpiredAtTime(root, expirationTime > Idle ? Idle : expirationTime); // We assume that this second render pass will be synchronous
 21228         //
 21666           // and therefore not hit this path again.
 21229         // This first principle is that if we're going to suspend when we complete
 21667 
 21230         // a root, then we should also restart if we get an update or ping that
 21668           break;
 21231         // might unsuspend it, and vice versa. The only reason to suspend is
 21669         }
 21232         // because you think you might want to restart before committing. However,
 21670 
 21233         // it doesn't make sense to restart only while in the period we're suspended.
 21671       case RootSuspended:
 21234         //
 21672         {
 21235         // Restarting too aggressively is also not good because it starves out any
 21673           markRootSuspendedAtTime(root, expirationTime);
 21236         // intermediate loading state. So we use heuristics to determine when.
 21674           var lastSuspendedTime = root.lastSuspendedTime;
 21237 
 21675 
 21238         // Suspense Heuristics
 21676           if (expirationTime === lastSuspendedTime) {
 21239         //
 21677             root.nextKnownPendingLevel = getRemainingExpirationTime(finishedWork);
 21240         // If nothing threw a Promise or all the same fallbacks are already showing,
 21678           } // We have an acceptable loading state. We need to figure out if we
 21241         // then don't suspend/restart.
 21679           // should immediately commit it or wait a bit.
 21242         //
 21680           // If we have processed new updates during this render, we may now
 21243         // If this is an initial render of a new tree of Suspense boundaries and
 21681           // have a new loading state ready. We want to ensure that we commit
 21244         // those trigger a fallback, then don't suspend/restart. We want to ensure
 21682           // that as soon as possible.
 21245         // that we can show the initial loading state as quickly as possible.
 21683 
 21246         //
 21684 
 21247         // If we hit a "Delayed" case, such as when we'd switch from content back into
 21685           var hasNotProcessedNewUpdates = workInProgressRootLatestProcessedExpirationTime === Sync;
 21248         // a fallback, then we should always suspend/restart. SuspenseConfig applies to
 21686 
 21249         // this case. If none is defined, JND is used instead.
 21687           if (hasNotProcessedNewUpdates && // do not delay if we're inside an act() scope
 21250         //
 21688           !( IsThisRendererActing.current)) {
 21251         // If we're already showing a fallback and it gets "retried", allowing us to show
 21689             // If we have not processed any new updates during this pass, then
 21252         // another level, but there's still an inner boundary that would show a fallback,
 21690             // this is either a retry of an existing fallback state or a
 21253         // then we suspend/restart for 500ms since the last time we showed a fallback
 21691             // hidden tree. Hidden trees shouldn't be batched with other work
 21254         // anywhere in the tree. This effectively throttles progressive loading into a
 21692             // and after that's fixed it can only be a retry. We're going to
 21255         // consistent train of commits. This also gives us an opportunity to restart to
 21693             // throttle committing retries so that we don't show too many
 21256         // get to the completed state slightly earlier.
 21694             // loading states too quickly.
 21257         //
 21695             var msUntilTimeout = globalMostRecentFallbackTime + FALLBACK_THROTTLE_MS - now(); // Don't bother with a very short suspense time.
 21258         // If there's ambiguity due to batching it's resolved in preference of:
 21696 
 21259         // 1) "delayed", 2) "initial render", 3) "retry".
 21697             if (msUntilTimeout > 10) {
 21260         //
 21698               if (workInProgressRootHasPendingPing) {
 21261         // We want to ensure that a "busy" state doesn't get force committed. We want to
 21699                 var lastPingedTime = root.lastPingedTime;
 21262         // ensure that new initial loading states can commit as soon as possible.
 21700 
 21263 
 21701                 if (lastPingedTime === NoWork || lastPingedTime >= expirationTime) {
 21264         attachPingListener(root, renderExpirationTime, thenable);
 21702                   // This render was pinged but we didn't get to restart
 21265 
 21703                   // earlier so try restarting now instead.
 21266         _workInProgress.effectTag |= ShouldCapture;
 21704                   root.lastPingedTime = expirationTime;
 21267         _workInProgress.expirationTime = renderExpirationTime;
 21705                   prepareFreshStack(root, expirationTime);
 21268 
 21706                   break;
 21269         return;
 21707                 }
 21270       } else if (enableSuspenseServerRenderer && _workInProgress.tag === DehydratedSuspenseComponent) {
 21708               }
 21271         attachPingListener(root, renderExpirationTime, thenable);
 21709 
 21272 
 21710               var nextTime = getNextRootExpirationTimeToWorkOn(root);
 21273         // Since we already have a current fiber, we can eagerly add a retry listener.
 21711 
 21274         var retryCache = _workInProgress.memoizedState;
 21712               if (nextTime !== NoWork && nextTime !== expirationTime) {
 21275         if (retryCache === null) {
 21713                 // There's additional work on this root.
 21276           retryCache = _workInProgress.memoizedState = new PossiblyWeakSet();
 21714                 break;
 21277           var current$$1 = _workInProgress.alternate;
 21715               }
 21278           (function () {
 21716 
 21279             if (!current$$1) {
 21717               if (lastSuspendedTime !== NoWork && lastSuspendedTime !== expirationTime) {
 21280               {
 21718                 // We should prefer to render the fallback of at the last
 21281                 throw ReactError(Error('A dehydrated suspense boundary must commit before trying to render. This is probably a bug in React.'));
 21719                 // suspended level. Ping the last suspended level to try
       
 21720                 // rendering it again.
       
 21721                 root.lastPingedTime = lastSuspendedTime;
       
 21722                 break;
       
 21723               } // The render is suspended, it hasn't timed out, and there's no
       
 21724               // lower priority work to do. Instead of committing the fallback
       
 21725               // immediately, wait for more data to arrive.
       
 21726 
       
 21727 
       
 21728               root.timeoutHandle = scheduleTimeout(commitRoot.bind(null, root), msUntilTimeout);
       
 21729               break;
       
 21730             }
       
 21731           } // The work expired. Commit immediately.
       
 21732 
       
 21733 
       
 21734           commitRoot(root);
       
 21735           break;
       
 21736         }
       
 21737 
       
 21738       case RootSuspendedWithDelay:
       
 21739         {
       
 21740           markRootSuspendedAtTime(root, expirationTime);
       
 21741           var _lastSuspendedTime = root.lastSuspendedTime;
       
 21742 
       
 21743           if (expirationTime === _lastSuspendedTime) {
       
 21744             root.nextKnownPendingLevel = getRemainingExpirationTime(finishedWork);
       
 21745           }
       
 21746 
       
 21747           if ( // do not delay if we're inside an act() scope
       
 21748           !( IsThisRendererActing.current)) {
       
 21749             // We're suspended in a state that should be avoided. We'll try to
       
 21750             // avoid committing it for as long as the timeouts let us.
       
 21751             if (workInProgressRootHasPendingPing) {
       
 21752               var _lastPingedTime = root.lastPingedTime;
       
 21753 
       
 21754               if (_lastPingedTime === NoWork || _lastPingedTime >= expirationTime) {
       
 21755                 // This render was pinged but we didn't get to restart earlier
       
 21756                 // so try restarting now instead.
       
 21757                 root.lastPingedTime = expirationTime;
       
 21758                 prepareFreshStack(root, expirationTime);
       
 21759                 break;
 21282               }
 21760               }
 21283             }
 21761             }
 21284           })();
 21762 
 21285           current$$1.memoizedState = retryCache;
 21763             var _nextTime = getNextRootExpirationTimeToWorkOn(root);
 21286         }
 21764 
 21287         // Memoize using the boundary fiber to prevent redundant listeners.
 21765             if (_nextTime !== NoWork && _nextTime !== expirationTime) {
 21288         if (!retryCache.has(thenable)) {
 21766               // There's additional work on this root.
 21289           retryCache.add(thenable);
 21767               break;
 21290           var retry = resolveRetryThenable.bind(null, _workInProgress, thenable);
 21768             }
 21291           if (enableSchedulerTracing) {
 21769 
 21292             retry = unstable_wrap(retry);
 21770             if (_lastSuspendedTime !== NoWork && _lastSuspendedTime !== expirationTime) {
       
 21771               // We should prefer to render the fallback of at the last
       
 21772               // suspended level. Ping the last suspended level to try
       
 21773               // rendering it again.
       
 21774               root.lastPingedTime = _lastSuspendedTime;
       
 21775               break;
       
 21776             }
       
 21777 
       
 21778             var _msUntilTimeout;
       
 21779 
       
 21780             if (workInProgressRootLatestSuspenseTimeout !== Sync) {
       
 21781               // We have processed a suspense config whose expiration time we
       
 21782               // can use as the timeout.
       
 21783               _msUntilTimeout = expirationTimeToMs(workInProgressRootLatestSuspenseTimeout) - now();
       
 21784             } else if (workInProgressRootLatestProcessedExpirationTime === Sync) {
       
 21785               // This should never normally happen because only new updates
       
 21786               // cause delayed states, so we should have processed something.
       
 21787               // However, this could also happen in an offscreen tree.
       
 21788               _msUntilTimeout = 0;
       
 21789             } else {
       
 21790               // If we don't have a suspense config, we're going to use a
       
 21791               // heuristic to determine how long we can suspend.
       
 21792               var eventTimeMs = inferTimeFromExpirationTime(workInProgressRootLatestProcessedExpirationTime);
       
 21793               var currentTimeMs = now();
       
 21794               var timeUntilExpirationMs = expirationTimeToMs(expirationTime) - currentTimeMs;
       
 21795               var timeElapsed = currentTimeMs - eventTimeMs;
       
 21796 
       
 21797               if (timeElapsed < 0) {
       
 21798                 // We get this wrong some time since we estimate the time.
       
 21799                 timeElapsed = 0;
       
 21800               }
       
 21801 
       
 21802               _msUntilTimeout = jnd(timeElapsed) - timeElapsed; // Clamp the timeout to the expiration time. TODO: Once the
       
 21803               // event time is exact instead of inferred from expiration time
       
 21804               // we don't need this.
       
 21805 
       
 21806               if (timeUntilExpirationMs < _msUntilTimeout) {
       
 21807                 _msUntilTimeout = timeUntilExpirationMs;
       
 21808               }
       
 21809             } // Don't bother with a very short suspense time.
       
 21810 
       
 21811 
       
 21812             if (_msUntilTimeout > 10) {
       
 21813               // The render is suspended, it hasn't timed out, and there's no
       
 21814               // lower priority work to do. Instead of committing the fallback
       
 21815               // immediately, wait for more data to arrive.
       
 21816               root.timeoutHandle = scheduleTimeout(commitRoot.bind(null, root), _msUntilTimeout);
       
 21817               break;
       
 21818             }
       
 21819           } // The work expired. Commit immediately.
       
 21820 
       
 21821 
       
 21822           commitRoot(root);
       
 21823           break;
       
 21824         }
       
 21825 
       
 21826       case RootCompleted:
       
 21827         {
       
 21828           // The work completed. Ready to commit.
       
 21829           if ( // do not delay if we're inside an act() scope
       
 21830           !( IsThisRendererActing.current) && workInProgressRootLatestProcessedExpirationTime !== Sync && workInProgressRootCanSuspendUsingConfig !== null) {
       
 21831             // If we have exceeded the minimum loading delay, which probably
       
 21832             // means we have shown a spinner already, we might have to suspend
       
 21833             // a bit longer to ensure that the spinner is shown for
       
 21834             // enough time.
       
 21835             var _msUntilTimeout2 = computeMsUntilSuspenseLoadingDelay(workInProgressRootLatestProcessedExpirationTime, expirationTime, workInProgressRootCanSuspendUsingConfig);
       
 21836 
       
 21837             if (_msUntilTimeout2 > 10) {
       
 21838               markRootSuspendedAtTime(root, expirationTime);
       
 21839               root.timeoutHandle = scheduleTimeout(commitRoot.bind(null, root), _msUntilTimeout2);
       
 21840               break;
       
 21841             }
 21293           }
 21842           }
 21294           thenable.then(retry, retry);
 21843 
 21295         }
 21844           commitRoot(root);
 21296         _workInProgress.effectTag |= ShouldCapture;
 21845           break;
 21297         _workInProgress.expirationTime = renderExpirationTime;
 21846         }
 21298         return;
 21847 
 21299       }
 21848       default:
 21300       // This boundary already captured during this render. Continue to the next
       
 21301       // boundary.
       
 21302       _workInProgress = _workInProgress.return;
       
 21303     } while (_workInProgress !== null);
       
 21304     // No boundary was found. Fallthrough to error mode.
       
 21305     // TODO: Use invariant so the message is stripped in prod?
       
 21306     value = new Error((getComponentName(sourceFiber.type) || 'A React component') + ' suspended while rendering, but no fallback UI was specified.\n' + '\n' + 'Add a <Suspense fallback=...> component higher in the tree to ' + 'provide a loading indicator or placeholder to display.' + getStackByFiberInDevAndProd(sourceFiber));
       
 21307   }
       
 21308 
       
 21309   // We didn't find a boundary that could handle this type of exception. Start
       
 21310   // over and traverse parent path again, this time treating the exception
       
 21311   // as an error.
       
 21312   renderDidError();
       
 21313   value = createCapturedValue(value, sourceFiber);
       
 21314   var workInProgress = returnFiber;
       
 21315   do {
       
 21316     switch (workInProgress.tag) {
       
 21317       case HostRoot:
       
 21318         {
 21849         {
 21319           var _errorInfo = value;
       
 21320           workInProgress.effectTag |= ShouldCapture;
       
 21321           workInProgress.expirationTime = renderExpirationTime;
       
 21322           var _update = createRootErrorUpdate(workInProgress, _errorInfo, renderExpirationTime);
       
 21323           enqueueCapturedUpdate(workInProgress, _update);
       
 21324           return;
       
 21325         }
       
 21326       case ClassComponent:
       
 21327         // Capture and retry
       
 21328         var errorInfo = value;
       
 21329         var ctor = workInProgress.type;
       
 21330         var instance = workInProgress.stateNode;
       
 21331         if ((workInProgress.effectTag & DidCapture) === NoEffect && (typeof ctor.getDerivedStateFromError === 'function' || instance !== null && typeof instance.componentDidCatch === 'function' && !isAlreadyFailedLegacyErrorBoundary(instance))) {
       
 21332           workInProgress.effectTag |= ShouldCapture;
       
 21333           workInProgress.expirationTime = renderExpirationTime;
       
 21334           // Schedule the error boundary to re-render using updated state
       
 21335           var _update2 = createClassErrorUpdate(workInProgress, errorInfo, renderExpirationTime);
       
 21336           enqueueCapturedUpdate(workInProgress, _update2);
       
 21337           return;
       
 21338         }
       
 21339         break;
       
 21340       default:
       
 21341         break;
       
 21342     }
       
 21343     workInProgress = workInProgress.return;
       
 21344   } while (workInProgress !== null);
       
 21345 }
       
 21346 
       
 21347 // The scheduler is imported here *only* to detect whether it's been mocked
       
 21348 // DEV stuff
       
 21349 var ceil = Math.ceil;
       
 21350 
       
 21351 var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
       
 21352 var ReactCurrentOwner$2 = ReactSharedInternals.ReactCurrentOwner;
       
 21353 var IsSomeRendererActing = ReactSharedInternals.IsSomeRendererActing;
       
 21354 
       
 21355 
       
 21356 var NoContext = /*                    */0;
       
 21357 var BatchedContext = /*               */1;
       
 21358 var EventContext = /*                 */2;
       
 21359 var DiscreteEventContext = /*         */4;
       
 21360 var LegacyUnbatchedContext = /*       */8;
       
 21361 var RenderContext = /*                */16;
       
 21362 var CommitContext = /*                */32;
       
 21363 
       
 21364 var RootIncomplete = 0;
       
 21365 var RootErrored = 1;
       
 21366 var RootSuspended = 2;
       
 21367 var RootSuspendedWithDelay = 3;
       
 21368 var RootCompleted = 4;
       
 21369 
       
 21370 // Describes where we are in the React execution stack
       
 21371 var executionContext = NoContext;
       
 21372 // The root we're working on
       
 21373 var workInProgressRoot = null;
       
 21374 // The fiber we're working on
       
 21375 var workInProgress = null;
       
 21376 // The expiration time we're rendering
       
 21377 var renderExpirationTime = NoWork;
       
 21378 // Whether to root completed, errored, suspended, etc.
       
 21379 var workInProgressRootExitStatus = RootIncomplete;
       
 21380 // Most recent event time among processed updates during this render.
       
 21381 // This is conceptually a time stamp but expressed in terms of an ExpirationTime
       
 21382 // because we deal mostly with expiration times in the hot path, so this avoids
       
 21383 // the conversion happening in the hot path.
       
 21384 var workInProgressRootLatestProcessedExpirationTime = Sync;
       
 21385 var workInProgressRootLatestSuspenseTimeout = Sync;
       
 21386 var workInProgressRootCanSuspendUsingConfig = null;
       
 21387 // If we're pinged while rendering we don't always restart immediately.
       
 21388 // This flag determines if it might be worthwhile to restart if an opportunity
       
 21389 // happens latere.
       
 21390 var workInProgressRootHasPendingPing = false;
       
 21391 // The most recent time we committed a fallback. This lets us ensure a train
       
 21392 // model where we don't commit new loading states in too quick succession.
       
 21393 var globalMostRecentFallbackTime = 0;
       
 21394 var FALLBACK_THROTTLE_MS = 500;
       
 21395 
       
 21396 var nextEffect = null;
       
 21397 var hasUncaughtError = false;
       
 21398 var firstUncaughtError = null;
       
 21399 var legacyErrorBoundariesThatAlreadyFailed = null;
       
 21400 
       
 21401 var rootDoesHavePassiveEffects = false;
       
 21402 var rootWithPendingPassiveEffects = null;
       
 21403 var pendingPassiveEffectsRenderPriority = NoPriority;
       
 21404 var pendingPassiveEffectsExpirationTime = NoWork;
       
 21405 
       
 21406 var rootsWithPendingDiscreteUpdates = null;
       
 21407 
       
 21408 // Use these to prevent an infinite loop of nested updates
       
 21409 var NESTED_UPDATE_LIMIT = 50;
       
 21410 var nestedUpdateCount = 0;
       
 21411 var rootWithNestedUpdates = null;
       
 21412 
       
 21413 var NESTED_PASSIVE_UPDATE_LIMIT = 50;
       
 21414 var nestedPassiveUpdateCount = 0;
       
 21415 
       
 21416 var interruptedBy = null;
       
 21417 
       
 21418 // Marks the need to reschedule pending interactions at these expiration times
       
 21419 // during the commit phase. This enables them to be traced across components
       
 21420 // that spawn new work during render. E.g. hidden boundaries, suspended SSR
       
 21421 // hydration or SuspenseList.
       
 21422 var spawnedWorkDuringRender = null;
       
 21423 
       
 21424 // Expiration times are computed by adding to the current time (the start
       
 21425 // time). However, if two updates are scheduled within the same event, we
       
 21426 // should treat their start times as simultaneous, even if the actual clock
       
 21427 // time has advanced between the first and second call.
       
 21428 
       
 21429 // In other words, because expiration times determine how updates are batched,
       
 21430 // we want all updates of like priority that occur within the same event to
       
 21431 // receive the same expiration time. Otherwise we get tearing.
       
 21432 var currentEventTime = NoWork;
       
 21433 
       
 21434 function requestCurrentTime() {
       
 21435   if ((executionContext & (RenderContext | CommitContext)) !== NoContext) {
       
 21436     // We're inside React, so it's fine to read the actual time.
       
 21437     return msToExpirationTime(now());
       
 21438   }
       
 21439   // We're not inside React, so we may be in the middle of a browser event.
       
 21440   if (currentEventTime !== NoWork) {
       
 21441     // Use the same start time for all updates until we enter React again.
       
 21442     return currentEventTime;
       
 21443   }
       
 21444   // This is the first update since React yielded. Compute a new start time.
       
 21445   currentEventTime = msToExpirationTime(now());
       
 21446   return currentEventTime;
       
 21447 }
       
 21448 
       
 21449 function computeExpirationForFiber(currentTime, fiber, suspenseConfig) {
       
 21450   var mode = fiber.mode;
       
 21451   if ((mode & BatchedMode) === NoMode) {
       
 21452     return Sync;
       
 21453   }
       
 21454 
       
 21455   var priorityLevel = getCurrentPriorityLevel();
       
 21456   if ((mode & ConcurrentMode) === NoMode) {
       
 21457     return priorityLevel === ImmediatePriority ? Sync : Batched;
       
 21458   }
       
 21459 
       
 21460   if ((executionContext & RenderContext) !== NoContext) {
       
 21461     // Use whatever time we're already rendering
       
 21462     return renderExpirationTime;
       
 21463   }
       
 21464 
       
 21465   var expirationTime = void 0;
       
 21466   if (suspenseConfig !== null) {
       
 21467     // Compute an expiration time based on the Suspense timeout.
       
 21468     expirationTime = computeSuspenseExpiration(currentTime, suspenseConfig.timeoutMs | 0 || LOW_PRIORITY_EXPIRATION);
       
 21469   } else {
       
 21470     // Compute an expiration time based on the Scheduler priority.
       
 21471     switch (priorityLevel) {
       
 21472       case ImmediatePriority:
       
 21473         expirationTime = Sync;
       
 21474         break;
       
 21475       case UserBlockingPriority$2:
       
 21476         // TODO: Rename this to computeUserBlockingExpiration
       
 21477         expirationTime = computeInteractiveExpiration(currentTime);
       
 21478         break;
       
 21479       case NormalPriority:
       
 21480       case LowPriority:
       
 21481         // TODO: Handle LowPriority
       
 21482         // TODO: Rename this to... something better.
       
 21483         expirationTime = computeAsyncExpiration(currentTime);
       
 21484         break;
       
 21485       case IdlePriority:
       
 21486         expirationTime = Never;
       
 21487         break;
       
 21488       default:
       
 21489         (function () {
       
 21490           {
 21850           {
 21491             {
 21851             {
 21492               throw ReactError(Error('Expected a valid priority level'));
 21852               throw Error( "Unknown root exit status." );
 21493             }
 21853             }
 21494           }
 21854           }
 21495         })();
 21855         }
 21496     }
 21856     }
 21497   }
 21857   } // This is the entry point for synchronous tasks that don't go
 21498 
 21858   // through Scheduler
 21499   // If we're in the middle of rendering a tree, do not update at the same
 21859 
 21500   // expiration time that is already rendering.
 21860 
 21501   // TODO: We shouldn't have to do this if the update is on a different root.
 21861   function performSyncWorkOnRoot(root) {
 21502   // Refactor computeExpirationForFiber + scheduleUpdate so we have access to
 21862     // Check if there's expired work on this root. Otherwise, render at Sync.
 21503   // the root when we check for this condition.
 21863     var lastExpiredTime = root.lastExpiredTime;
 21504   if (workInProgressRoot !== null && expirationTime === renderExpirationTime) {
 21864     var expirationTime = lastExpiredTime !== NoWork ? lastExpiredTime : Sync;
 21505     // This is a trick to move this update into a separate batch
 21865 
 21506     expirationTime -= 1;
 21866     if (!((executionContext & (RenderContext | CommitContext)) === NoContext)) {
 21507   }
 21867       {
 21508 
 21868         throw Error( "Should not already be working." );
 21509   return expirationTime;
 21869       }
 21510 }
 21870     }
 21511 
 21871 
 21512 var lastUniqueAsyncExpiration = NoWork;
 21872     flushPassiveEffects(); // If the root or expiration time have changed, throw out the existing stack
 21513 function computeUniqueAsyncExpiration() {
 21873     // and prepare a fresh one. Otherwise we'll continue where we left off.
 21514   var currentTime = requestCurrentTime();
 21874 
 21515   var result = computeAsyncExpiration(currentTime);
 21875     if (root !== workInProgressRoot || expirationTime !== renderExpirationTime$1) {
 21516   if (result <= lastUniqueAsyncExpiration) {
 21876       prepareFreshStack(root, expirationTime);
 21517     // Since we assume the current time monotonically increases, we only hit
 21877       startWorkOnPendingInteractions(root, expirationTime);
 21518     // this branch when computeUniqueAsyncExpiration is fired multiple times
 21878     } // If we have a work-in-progress fiber, it means there's still work to do
 21519     // within a 200ms window (or whatever the async bucket size is).
 21879     // in this root.
 21520     result -= 1;
 21880 
 21521   }
 21881 
 21522   lastUniqueAsyncExpiration = result;
 21882     if (workInProgress !== null) {
 21523   return result;
 21883       var prevExecutionContext = executionContext;
 21524 }
 21884       executionContext |= RenderContext;
 21525 
 21885       var prevDispatcher = pushDispatcher();
 21526 function scheduleUpdateOnFiber(fiber, expirationTime) {
 21886       var prevInteractions = pushInteractions(root);
 21527   checkForNestedUpdates();
 21887       startWorkLoopTimer(workInProgress);
 21528   warnAboutInvalidUpdatesOnClassComponentsInDEV(fiber);
 21888 
 21529 
 21889       do {
 21530   var root = markUpdateTimeFromFiberToRoot(fiber, expirationTime);
 21890         try {
 21531   if (root === null) {
 21891           workLoopSync();
 21532     warnAboutUpdateOnUnmountedFiberInDEV(fiber);
 21892           break;
 21533     return;
 21893         } catch (thrownValue) {
 21534   }
 21894           handleError(root, thrownValue);
 21535 
 21895         }
 21536   root.pingTime = NoWork;
 21896       } while (true);
 21537 
 21897 
 21538   checkForInterruption(fiber, expirationTime);
 21898       resetContextDependencies();
 21539   recordScheduleUpdate();
 21899       executionContext = prevExecutionContext;
 21540 
 21900       popDispatcher(prevDispatcher);
 21541   // TODO: computeExpirationForFiber also reads the priority. Pass the
 21901 
 21542   // priority as an argument to that function and this one.
 21902       {
 21543   var priorityLevel = getCurrentPriorityLevel();
 21903         popInteractions(prevInteractions);
 21544 
 21904       }
 21545   if (expirationTime === Sync) {
 21905 
 21546     if (
 21906       if (workInProgressRootExitStatus === RootFatalErrored) {
 21547     // Check if we're inside unbatchedUpdates
 21907         var fatalError = workInProgressRootFatalError;
 21548     (executionContext & LegacyUnbatchedContext) !== NoContext &&
 21908         stopInterruptedWorkLoopTimer();
 21549     // Check if we're not already rendering
 21909         prepareFreshStack(root, expirationTime);
 21550     (executionContext & (RenderContext | CommitContext)) === NoContext) {
 21910         markRootSuspendedAtTime(root, expirationTime);
 21551       // Register pending interactions on the root to avoid losing traced interaction data.
 21911         ensureRootIsScheduled(root);
 21552       schedulePendingInteractions(root, expirationTime);
 21912         throw fatalError;
 21553 
 21913       }
 21554       // This is a legacy edge case. The initial mount of a ReactDOM.render-ed
 21914 
 21555       // root inside of batchedUpdates should be synchronous, but layout updates
 21915       if (workInProgress !== null) {
 21556       // should be deferred until the end of the batch.
 21916         // This is a sync render, so we should have finished the whole tree.
 21557       var callback = renderRoot(root, Sync, true);
 21917         {
 21558       while (callback !== null) {
 21918           {
 21559         callback = callback(true);
 21919             throw Error( "Cannot commit an incomplete root. This error is likely caused by a bug in React. Please file an issue." );
 21560       }
 21920           }
 21561     } else {
 21921         }
 21562       scheduleCallbackForRoot(root, ImmediatePriority, Sync);
 21922       } else {
       
 21923         // We now have a consistent tree. Because this is a sync render, we
       
 21924         // will commit it even if something suspended.
       
 21925         stopFinishedWorkLoopTimer();
       
 21926         root.finishedWork = root.current.alternate;
       
 21927         root.finishedExpirationTime = expirationTime;
       
 21928         finishSyncRender(root);
       
 21929       } // Before exiting, make sure there's a callback scheduled for the next
       
 21930       // pending level.
       
 21931 
       
 21932 
       
 21933       ensureRootIsScheduled(root);
       
 21934     }
       
 21935 
       
 21936     return null;
       
 21937   }
       
 21938 
       
 21939   function finishSyncRender(root) {
       
 21940     // Set this to null to indicate there's no in-progress render.
       
 21941     workInProgressRoot = null;
       
 21942     commitRoot(root);
       
 21943   }
       
 21944   function flushDiscreteUpdates() {
       
 21945     // TODO: Should be able to flush inside batchedUpdates, but not inside `act`.
       
 21946     // However, `act` uses `batchedUpdates`, so there's no way to distinguish
       
 21947     // those two cases. Need to fix this before exposing flushDiscreteUpdates
       
 21948     // as a public API.
       
 21949     if ((executionContext & (BatchedContext | RenderContext | CommitContext)) !== NoContext) {
       
 21950       {
       
 21951         if ((executionContext & RenderContext) !== NoContext) {
       
 21952           error('unstable_flushDiscreteUpdates: Cannot flush updates when React is ' + 'already rendering.');
       
 21953         }
       
 21954       } // We're already rendering, so we can't synchronously flush pending work.
       
 21955       // This is probably a nested event dispatch triggered by a lifecycle/effect,
       
 21956       // like `el.focus()`. Exit.
       
 21957 
       
 21958 
       
 21959       return;
       
 21960     }
       
 21961 
       
 21962     flushPendingDiscreteUpdates(); // If the discrete updates scheduled passive effects, flush them now so that
       
 21963     // they fire before the next serial event.
       
 21964 
       
 21965     flushPassiveEffects();
       
 21966   }
       
 21967   function syncUpdates(fn, a, b, c) {
       
 21968     return runWithPriority$1(ImmediatePriority, fn.bind(null, a, b, c));
       
 21969   }
       
 21970 
       
 21971   function flushPendingDiscreteUpdates() {
       
 21972     if (rootsWithPendingDiscreteUpdates !== null) {
       
 21973       // For each root with pending discrete updates, schedule a callback to
       
 21974       // immediately flush them.
       
 21975       var roots = rootsWithPendingDiscreteUpdates;
       
 21976       rootsWithPendingDiscreteUpdates = null;
       
 21977       roots.forEach(function (expirationTime, root) {
       
 21978         markRootExpiredAtTime(root, expirationTime);
       
 21979         ensureRootIsScheduled(root);
       
 21980       }); // Now flush the immediate queue.
       
 21981 
       
 21982       flushSyncCallbackQueue();
       
 21983     }
       
 21984   }
       
 21985 
       
 21986   function batchedUpdates$1(fn, a) {
       
 21987     var prevExecutionContext = executionContext;
       
 21988     executionContext |= BatchedContext;
       
 21989 
       
 21990     try {
       
 21991       return fn(a);
       
 21992     } finally {
       
 21993       executionContext = prevExecutionContext;
       
 21994 
 21563       if (executionContext === NoContext) {
 21995       if (executionContext === NoContext) {
 21564         // Flush the synchronous work now, wnless we're already working or inside
 21996         // Flush the immediate callbacks that were scheduled during this batch
 21565         // a batch. This is intentionally inside scheduleUpdateOnFiber instead of
       
 21566         // scheduleCallbackForFiber to preserve the ability to schedule a callback
       
 21567         // without immediately flushing it. We only do this for user-initiated
       
 21568         // updates, to preserve historical behavior of sync mode.
       
 21569         flushSyncCallbackQueue();
 21997         flushSyncCallbackQueue();
 21570       }
 21998       }
 21571     }
 21999     }
 21572   } else {
 22000   }
 21573     scheduleCallbackForRoot(root, priorityLevel, expirationTime);
 22001   function batchedEventUpdates$1(fn, a) {
 21574   }
 22002     var prevExecutionContext = executionContext;
 21575 
 22003     executionContext |= EventContext;
 21576   if ((executionContext & DiscreteEventContext) !== NoContext && (
 22004 
 21577   // Only updates at user-blocking priority or greater are considered
 22005     try {
 21578   // discrete, even inside a discrete event.
 22006       return fn(a);
 21579   priorityLevel === UserBlockingPriority$2 || priorityLevel === ImmediatePriority)) {
 22007     } finally {
 21580     // This is the result of a discrete event. Track the lowest priority
 22008       executionContext = prevExecutionContext;
 21581     // discrete update per root so we can flush them early, if needed.
 22009 
 21582     if (rootsWithPendingDiscreteUpdates === null) {
 22010       if (executionContext === NoContext) {
 21583       rootsWithPendingDiscreteUpdates = new Map([[root, expirationTime]]);
 22011         // Flush the immediate callbacks that were scheduled during this batch
 21584     } else {
 22012         flushSyncCallbackQueue();
 21585       var lastDiscreteTime = rootsWithPendingDiscreteUpdates.get(root);
 22013       }
 21586       if (lastDiscreteTime === undefined || lastDiscreteTime > expirationTime) {
 22014     }
 21587         rootsWithPendingDiscreteUpdates.set(root, expirationTime);
 22015   }
 21588       }
 22016   function discreteUpdates$1(fn, a, b, c, d) {
 21589     }
 22017     var prevExecutionContext = executionContext;
 21590   }
 22018     executionContext |= DiscreteEventContext;
 21591 }
 22019 
 21592 var scheduleWork = scheduleUpdateOnFiber;
 22020     try {
 21593 
 22021       // Should this
 21594 // This is split into a separate function so we can mark a fiber with pending
 22022       return runWithPriority$1(UserBlockingPriority$1, fn.bind(null, a, b, c, d));
 21595 // work without treating it as a typical update that originates from an event;
 22023     } finally {
 21596 // e.g. retrying a Suspense boundary isn't an update, but it does schedule work
 22024       executionContext = prevExecutionContext;
 21597 // on a fiber.
 22025 
 21598 function markUpdateTimeFromFiberToRoot(fiber, expirationTime) {
 22026       if (executionContext === NoContext) {
 21599   // Update the source fiber's expiration time
 22027         // Flush the immediate callbacks that were scheduled during this batch
 21600   if (fiber.expirationTime < expirationTime) {
 22028         flushSyncCallbackQueue();
 21601     fiber.expirationTime = expirationTime;
 22029       }
 21602   }
 22030     }
 21603   var alternate = fiber.alternate;
 22031   }
 21604   if (alternate !== null && alternate.expirationTime < expirationTime) {
 22032   function unbatchedUpdates(fn, a) {
 21605     alternate.expirationTime = expirationTime;
 22033     var prevExecutionContext = executionContext;
 21606   }
 22034     executionContext &= ~BatchedContext;
 21607   // Walk the parent path to the root and update the child expiration time.
 22035     executionContext |= LegacyUnbatchedContext;
 21608   var node = fiber.return;
 22036 
 21609   var root = null;
 22037     try {
 21610   if (node === null && fiber.tag === HostRoot) {
 22038       return fn(a);
 21611     root = fiber.stateNode;
 22039     } finally {
 21612   } else {
 22040       executionContext = prevExecutionContext;
 21613     while (node !== null) {
 22041 
 21614       alternate = node.alternate;
 22042       if (executionContext === NoContext) {
 21615       if (node.childExpirationTime < expirationTime) {
 22043         // Flush the immediate callbacks that were scheduled during this batch
 21616         node.childExpirationTime = expirationTime;
 22044         flushSyncCallbackQueue();
 21617         if (alternate !== null && alternate.childExpirationTime < expirationTime) {
 22045       }
 21618           alternate.childExpirationTime = expirationTime;
 22046     }
 21619         }
 22047   }
 21620       } else if (alternate !== null && alternate.childExpirationTime < expirationTime) {
 22048   function flushSync(fn, a) {
 21621         alternate.childExpirationTime = expirationTime;
 22049     if ((executionContext & (RenderContext | CommitContext)) !== NoContext) {
 21622       }
       
 21623       if (node.return === null && node.tag === HostRoot) {
       
 21624         root = node.stateNode;
       
 21625         break;
       
 21626       }
       
 21627       node = node.return;
       
 21628     }
       
 21629   }
       
 21630 
       
 21631   if (root !== null) {
       
 21632     // Update the first and last pending expiration times in this root
       
 21633     var firstPendingTime = root.firstPendingTime;
       
 21634     if (expirationTime > firstPendingTime) {
       
 21635       root.firstPendingTime = expirationTime;
       
 21636     }
       
 21637     var lastPendingTime = root.lastPendingTime;
       
 21638     if (lastPendingTime === NoWork || expirationTime < lastPendingTime) {
       
 21639       root.lastPendingTime = expirationTime;
       
 21640     }
       
 21641   }
       
 21642 
       
 21643   return root;
       
 21644 }
       
 21645 
       
 21646 // Use this function, along with runRootCallback, to ensure that only a single
       
 21647 // callback per root is scheduled. It's still possible to call renderRoot
       
 21648 // directly, but scheduling via this function helps avoid excessive callbacks.
       
 21649 // It works by storing the callback node and expiration time on the root. When a
       
 21650 // new callback comes in, it compares the expiration time to determine if it
       
 21651 // should cancel the previous one. It also relies on commitRoot scheduling a
       
 21652 // callback to render the next level, because that means we don't need a
       
 21653 // separate callback per expiration time.
       
 21654 function scheduleCallbackForRoot(root, priorityLevel, expirationTime) {
       
 21655   var existingCallbackExpirationTime = root.callbackExpirationTime;
       
 21656   if (existingCallbackExpirationTime < expirationTime) {
       
 21657     // New callback has higher priority than the existing one.
       
 21658     var existingCallbackNode = root.callbackNode;
       
 21659     if (existingCallbackNode !== null) {
       
 21660       cancelCallback(existingCallbackNode);
       
 21661     }
       
 21662     root.callbackExpirationTime = expirationTime;
       
 21663 
       
 21664     if (expirationTime === Sync) {
       
 21665       // Sync React callbacks are scheduled on a special internal queue
       
 21666       root.callbackNode = scheduleSyncCallback(runRootCallback.bind(null, root, renderRoot.bind(null, root, expirationTime)));
       
 21667     } else {
       
 21668       var options = null;
       
 21669       if (!disableSchedulerTimeoutBasedOnReactExpirationTime && expirationTime !== Never) {
       
 21670         var timeout = expirationTimeToMs(expirationTime) - now();
       
 21671         options = { timeout: timeout };
       
 21672       }
       
 21673 
       
 21674       root.callbackNode = scheduleCallback(priorityLevel, runRootCallback.bind(null, root, renderRoot.bind(null, root, expirationTime)), options);
       
 21675       if (enableUserTimingAPI && expirationTime !== Sync && (executionContext & (RenderContext | CommitContext)) === NoContext) {
       
 21676         // Scheduled an async callback, and we're not already working. Add an
       
 21677         // entry to the flamegraph that shows we're waiting for a callback
       
 21678         // to fire.
       
 21679         startRequestCallbackTimer();
       
 21680       }
       
 21681     }
       
 21682   }
       
 21683 
       
 21684   // Associate the current interactions with this new root+priority.
       
 21685   schedulePendingInteractions(root, expirationTime);
       
 21686 }
       
 21687 
       
 21688 function runRootCallback(root, callback, isSync) {
       
 21689   var prevCallbackNode = root.callbackNode;
       
 21690   var continuation = null;
       
 21691   try {
       
 21692     continuation = callback(isSync);
       
 21693     if (continuation !== null) {
       
 21694       return runRootCallback.bind(null, root, continuation);
       
 21695     } else {
       
 21696       return null;
       
 21697     }
       
 21698   } finally {
       
 21699     // If the callback exits without returning a continuation, remove the
       
 21700     // corresponding callback node from the root. Unless the callback node
       
 21701     // has changed, which implies that it was already cancelled by a high
       
 21702     // priority update.
       
 21703     if (continuation === null && prevCallbackNode === root.callbackNode) {
       
 21704       root.callbackNode = null;
       
 21705       root.callbackExpirationTime = NoWork;
       
 21706     }
       
 21707   }
       
 21708 }
       
 21709 
       
 21710 function flushRoot(root, expirationTime) {
       
 21711   if ((executionContext & (RenderContext | CommitContext)) !== NoContext) {
       
 21712     (function () {
       
 21713       {
 22050       {
 21714         {
 22051         {
 21715           throw ReactError(Error('work.commit(): Cannot commit while already rendering. This likely means you attempted to commit from inside a lifecycle method.'));
 22052           throw Error( "flushSync was called from inside a lifecycle method. It cannot be called when React is already rendering." );
 21716         }
 22053         }
 21717       }
 22054       }
 21718     })();
 22055     }
 21719   }
 22056 
 21720   scheduleSyncCallback(renderRoot.bind(null, root, expirationTime));
 22057     var prevExecutionContext = executionContext;
 21721   flushSyncCallbackQueue();
 22058     executionContext |= BatchedContext;
 21722 }
 22059 
 21723 
 22060     try {
 21724 function flushDiscreteUpdates() {
 22061       return runWithPriority$1(ImmediatePriority, fn.bind(null, a));
 21725   // TODO: Should be able to flush inside batchedUpdates, but not inside `act`.
 22062     } finally {
 21726   // However, `act` uses `batchedUpdates`, so there's no way to distinguish
 22063       executionContext = prevExecutionContext; // Flush the immediate callbacks that were scheduled during this batch.
 21727   // those two cases. Need to fix this before exposing flushDiscreteUpdates
 22064       // Note that this will happen even if batchedUpdates is higher up
 21728   // as a public API.
 22065       // the stack.
 21729   if ((executionContext & (BatchedContext | RenderContext | CommitContext)) !== NoContext) {
 22066 
 21730     if (true && (executionContext & RenderContext) !== NoContext) {
       
 21731       warning$1(false, 'unstable_flushDiscreteUpdates: Cannot flush updates when React is ' + 'already rendering.');
       
 21732     }
       
 21733     // We're already rendering, so we can't synchronously flush pending work.
       
 21734     // This is probably a nested event dispatch triggered by a lifecycle/effect,
       
 21735     // like `el.focus()`. Exit.
       
 21736     return;
       
 21737   }
       
 21738   flushPendingDiscreteUpdates();
       
 21739   if (!revertPassiveEffectsChange) {
       
 21740     // If the discrete updates scheduled passive effects, flush them now so that
       
 21741     // they fire before the next serial event.
       
 21742     flushPassiveEffects();
       
 21743   }
       
 21744 }
       
 21745 
       
 21746 function resolveLocksOnRoot(root, expirationTime) {
       
 21747   var firstBatch = root.firstBatch;
       
 21748   if (firstBatch !== null && firstBatch._defer && firstBatch._expirationTime >= expirationTime) {
       
 21749     scheduleCallback(NormalPriority, function () {
       
 21750       firstBatch._onComplete();
       
 21751       return null;
       
 21752     });
       
 21753     return true;
       
 21754   } else {
       
 21755     return false;
       
 21756   }
       
 21757 }
       
 21758 
       
 21759 
       
 21760 
       
 21761 
       
 21762 
       
 21763 function flushPendingDiscreteUpdates() {
       
 21764   if (rootsWithPendingDiscreteUpdates !== null) {
       
 21765     // For each root with pending discrete updates, schedule a callback to
       
 21766     // immediately flush them.
       
 21767     var roots = rootsWithPendingDiscreteUpdates;
       
 21768     rootsWithPendingDiscreteUpdates = null;
       
 21769     roots.forEach(function (expirationTime, root) {
       
 21770       scheduleSyncCallback(renderRoot.bind(null, root, expirationTime));
       
 21771     });
       
 21772     // Now flush the immediate queue.
       
 21773     flushSyncCallbackQueue();
       
 21774   }
       
 21775 }
       
 21776 
       
 21777 function batchedUpdates$1(fn, a) {
       
 21778   var prevExecutionContext = executionContext;
       
 21779   executionContext |= BatchedContext;
       
 21780   try {
       
 21781     return fn(a);
       
 21782   } finally {
       
 21783     executionContext = prevExecutionContext;
       
 21784     if (executionContext === NoContext) {
       
 21785       // Flush the immediate callbacks that were scheduled during this batch
       
 21786       flushSyncCallbackQueue();
 22067       flushSyncCallbackQueue();
 21787     }
 22068     }
 21788   }
 22069   }
 21789 }
 22070 
 21790 
 22071   function prepareFreshStack(root, expirationTime) {
 21791 function batchedEventUpdates$1(fn, a) {
 22072     root.finishedWork = null;
 21792   var prevExecutionContext = executionContext;
 22073     root.finishedExpirationTime = NoWork;
 21793   executionContext |= EventContext;
 22074     var timeoutHandle = root.timeoutHandle;
 21794   try {
 22075 
 21795     return fn(a);
 22076     if (timeoutHandle !== noTimeout) {
 21796   } finally {
 22077       // The root previous suspended and scheduled a timeout to commit a fallback
 21797     executionContext = prevExecutionContext;
 22078       // state. Now that we have additional work, cancel the timeout.
 21798     if (executionContext === NoContext) {
 22079       root.timeoutHandle = noTimeout; // $FlowFixMe Complains noTimeout is not a TimeoutID, despite the check above
 21799       // Flush the immediate callbacks that were scheduled during this batch
 22080 
 21800       flushSyncCallbackQueue();
 22081       cancelTimeout(timeoutHandle);
 21801     }
 22082     }
 21802   }
 22083 
 21803 }
 22084     if (workInProgress !== null) {
 21804 
 22085       var interruptedWork = workInProgress.return;
 21805 function discreteUpdates$1(fn, a, b, c) {
 22086 
 21806   var prevExecutionContext = executionContext;
 22087       while (interruptedWork !== null) {
 21807   executionContext |= DiscreteEventContext;
 22088         unwindInterruptedWork(interruptedWork);
 21808   try {
 22089         interruptedWork = interruptedWork.return;
 21809     // Should this
 22090       }
 21810     return runWithPriority$2(UserBlockingPriority$2, fn.bind(null, a, b, c));
 22091     }
 21811   } finally {
 22092 
 21812     executionContext = prevExecutionContext;
 22093     workInProgressRoot = root;
 21813     if (executionContext === NoContext) {
 22094     workInProgress = createWorkInProgress(root.current, null);
 21814       // Flush the immediate callbacks that were scheduled during this batch
 22095     renderExpirationTime$1 = expirationTime;
 21815       flushSyncCallbackQueue();
 22096     workInProgressRootExitStatus = RootIncomplete;
 21816     }
 22097     workInProgressRootFatalError = null;
 21817   }
 22098     workInProgressRootLatestProcessedExpirationTime = Sync;
 21818 }
 22099     workInProgressRootLatestSuspenseTimeout = Sync;
 21819 
 22100     workInProgressRootCanSuspendUsingConfig = null;
 21820 function unbatchedUpdates(fn, a) {
 22101     workInProgressRootNextUnprocessedUpdateTime = NoWork;
 21821   var prevExecutionContext = executionContext;
 22102     workInProgressRootHasPendingPing = false;
 21822   executionContext &= ~BatchedContext;
 22103 
 21823   executionContext |= LegacyUnbatchedContext;
 22104     {
 21824   try {
 22105       spawnedWorkDuringRender = null;
 21825     return fn(a);
 22106     }
 21826   } finally {
 22107 
 21827     executionContext = prevExecutionContext;
 22108     {
 21828     if (executionContext === NoContext) {
 22109       ReactStrictModeWarnings.discardPendingWarnings();
 21829       // Flush the immediate callbacks that were scheduled during this batch
 22110     }
 21830       flushSyncCallbackQueue();
 22111   }
 21831     }
 22112 
 21832   }
 22113   function handleError(root, thrownValue) {
 21833 }
 22114     do {
 21834 
 22115       try {
 21835 function flushSync(fn, a) {
 22116         // Reset module-level state that was set during the render phase.
 21836   if ((executionContext & (RenderContext | CommitContext)) !== NoContext) {
 22117         resetContextDependencies();
 21837     (function () {
 22118         resetHooksAfterThrow();
 21838       {
 22119         resetCurrentFiber();
 21839         {
 22120 
 21840           throw ReactError(Error('flushSync was called from inside a lifecycle method. It cannot be called when React is already rendering.'));
 22121         if (workInProgress === null || workInProgress.return === null) {
 21841         }
 22122           // Expected to be working on a non-root fiber. This is a fatal error
 21842       }
 22123           // because there's no ancestor that can handle it; the root is
 21843     })();
 22124           // supposed to capture all errors that weren't caught by an error
 21844   }
 22125           // boundary.
 21845   var prevExecutionContext = executionContext;
 22126           workInProgressRootExitStatus = RootFatalErrored;
 21846   executionContext |= BatchedContext;
 22127           workInProgressRootFatalError = thrownValue; // Set `workInProgress` to null. This represents advancing to the next
 21847   try {
 22128           // sibling, or the parent if there are no siblings. But since the root
 21848     return runWithPriority$2(ImmediatePriority, fn.bind(null, a));
 22129           // has no siblings nor a parent, we set it to null. Usually this is
 21849   } finally {
 22130           // handled by `completeUnitOfWork` or `unwindWork`, but since we're
 21850     executionContext = prevExecutionContext;
 22131           // interntionally not calling those, we need set it here.
 21851     // Flush the immediate callbacks that were scheduled during this batch.
 22132           // TODO: Consider calling `unwindWork` to pop the contexts.
 21852     // Note that this will happen even if batchedUpdates is higher up
 22133 
 21853     // the stack.
 22134           workInProgress = null;
 21854     flushSyncCallbackQueue();
 22135           return null;
 21855   }
 22136         }
 21856 }
 22137 
 21857 
 22138         if (enableProfilerTimer && workInProgress.mode & ProfileMode) {
 21858 function flushControlled(fn) {
 22139           // Record the time spent rendering before an error was thrown. This
 21859   var prevExecutionContext = executionContext;
 22140           // avoids inaccurate Profiler durations in the case of a
 21860   executionContext |= BatchedContext;
 22141           // suspended render.
 21861   try {
 22142           stopProfilerTimerIfRunningAndRecordDelta(workInProgress, true);
 21862     runWithPriority$2(ImmediatePriority, fn);
 22143         }
 21863   } finally {
 22144 
 21864     executionContext = prevExecutionContext;
 22145         throwException(root, workInProgress.return, workInProgress, thrownValue, renderExpirationTime$1);
 21865     if (executionContext === NoContext) {
 22146         workInProgress = completeUnitOfWork(workInProgress);
 21866       // Flush the immediate callbacks that were scheduled during this batch
 22147       } catch (yetAnotherThrownValue) {
 21867       flushSyncCallbackQueue();
 22148         // Something in the return path also threw.
 21868     }
 22149         thrownValue = yetAnotherThrownValue;
 21869   }
 22150         continue;
 21870 }
 22151       } // Return to the normal work loop.
 21871 
 22152 
 21872 function prepareFreshStack(root, expirationTime) {
 22153 
 21873   root.finishedWork = null;
 22154       return;
 21874   root.finishedExpirationTime = NoWork;
 22155     } while (true);
 21875 
 22156   }
 21876   var timeoutHandle = root.timeoutHandle;
 22157 
 21877   if (timeoutHandle !== noTimeout) {
 22158   function pushDispatcher(root) {
 21878     // The root previous suspended and scheduled a timeout to commit a fallback
 22159     var prevDispatcher = ReactCurrentDispatcher$1.current;
 21879     // state. Now that we have additional work, cancel the timeout.
 22160     ReactCurrentDispatcher$1.current = ContextOnlyDispatcher;
 21880     root.timeoutHandle = noTimeout;
 22161 
 21881     // $FlowFixMe Complains noTimeout is not a TimeoutID, despite the check above
       
 21882     cancelTimeout(timeoutHandle);
       
 21883   }
       
 21884 
       
 21885   if (workInProgress !== null) {
       
 21886     var interruptedWork = workInProgress.return;
       
 21887     while (interruptedWork !== null) {
       
 21888       unwindInterruptedWork(interruptedWork);
       
 21889       interruptedWork = interruptedWork.return;
       
 21890     }
       
 21891   }
       
 21892   workInProgressRoot = root;
       
 21893   workInProgress = createWorkInProgress(root.current, null, expirationTime);
       
 21894   renderExpirationTime = expirationTime;
       
 21895   workInProgressRootExitStatus = RootIncomplete;
       
 21896   workInProgressRootLatestProcessedExpirationTime = Sync;
       
 21897   workInProgressRootLatestSuspenseTimeout = Sync;
       
 21898   workInProgressRootCanSuspendUsingConfig = null;
       
 21899   workInProgressRootHasPendingPing = false;
       
 21900 
       
 21901   if (enableSchedulerTracing) {
       
 21902     spawnedWorkDuringRender = null;
       
 21903   }
       
 21904 
       
 21905   {
       
 21906     ReactStrictModeWarnings.discardPendingWarnings();
       
 21907     componentsThatTriggeredHighPriSuspend = null;
       
 21908   }
       
 21909 }
       
 21910 
       
 21911 function renderRoot(root, expirationTime, isSync) {
       
 21912   (function () {
       
 21913     if (!((executionContext & (RenderContext | CommitContext)) === NoContext)) {
       
 21914       {
       
 21915         throw ReactError(Error('Should not already be working.'));
       
 21916       }
       
 21917     }
       
 21918   })();
       
 21919 
       
 21920   if (enableUserTimingAPI && expirationTime !== Sync) {
       
 21921     var didExpire = isSync;
       
 21922     stopRequestCallbackTimer(didExpire);
       
 21923   }
       
 21924 
       
 21925   if (root.firstPendingTime < expirationTime) {
       
 21926     // If there's no work left at this expiration time, exit immediately. This
       
 21927     // happens when multiple callbacks are scheduled for a single root, but an
       
 21928     // earlier callback flushes the work of a later one.
       
 21929     return null;
       
 21930   }
       
 21931 
       
 21932   if (isSync && root.finishedExpirationTime === expirationTime) {
       
 21933     // There's already a pending commit at this expiration time.
       
 21934     // TODO: This is poorly factored. This case only exists for the
       
 21935     // batch.commit() API.
       
 21936     return commitRoot.bind(null, root);
       
 21937   }
       
 21938 
       
 21939   flushPassiveEffects();
       
 21940 
       
 21941   // If the root or expiration time have changed, throw out the existing stack
       
 21942   // and prepare a fresh one. Otherwise we'll continue where we left off.
       
 21943   if (root !== workInProgressRoot || expirationTime !== renderExpirationTime) {
       
 21944     prepareFreshStack(root, expirationTime);
       
 21945     startWorkOnPendingInteractions(root, expirationTime);
       
 21946   } else if (workInProgressRootExitStatus === RootSuspendedWithDelay) {
       
 21947     // We could've received an update at a lower priority while we yielded.
       
 21948     // We're suspended in a delayed state. Once we complete this render we're
       
 21949     // just going to try to recover at the last pending time anyway so we might
       
 21950     // as well start doing that eagerly.
       
 21951     // Ideally we should be able to do this even for retries but we don't yet
       
 21952     // know if we're going to process an update which wants to commit earlier,
       
 21953     // and this path happens very early so it would happen too often. Instead,
       
 21954     // for that case, we'll wait until we complete.
       
 21955     if (workInProgressRootHasPendingPing) {
       
 21956       // We have a ping at this expiration. Let's restart to see if we get unblocked.
       
 21957       prepareFreshStack(root, expirationTime);
       
 21958     } else {
       
 21959       var lastPendingTime = root.lastPendingTime;
       
 21960       if (lastPendingTime < expirationTime) {
       
 21961         // There's lower priority work. It might be unsuspended. Try rendering
       
 21962         // at that level immediately, while preserving the position in the queue.
       
 21963         return renderRoot.bind(null, root, lastPendingTime);
       
 21964       }
       
 21965     }
       
 21966   }
       
 21967 
       
 21968   // If we have a work-in-progress fiber, it means there's still work to do
       
 21969   // in this root.
       
 21970   if (workInProgress !== null) {
       
 21971     var prevExecutionContext = executionContext;
       
 21972     executionContext |= RenderContext;
       
 21973     var prevDispatcher = ReactCurrentDispatcher.current;
       
 21974     if (prevDispatcher === null) {
 22162     if (prevDispatcher === null) {
 21975       // The React isomorphic package does not include a default dispatcher.
 22163       // The React isomorphic package does not include a default dispatcher.
 21976       // Instead the first renderer will lazily attach one, in order to give
 22164       // Instead the first renderer will lazily attach one, in order to give
 21977       // nicer error messages.
 22165       // nicer error messages.
 21978       prevDispatcher = ContextOnlyDispatcher;
 22166       return ContextOnlyDispatcher;
 21979     }
 22167     } else {
 21980     ReactCurrentDispatcher.current = ContextOnlyDispatcher;
 22168       return prevDispatcher;
 21981     var prevInteractions = null;
 22169     }
 21982     if (enableSchedulerTracing) {
 22170   }
 21983       prevInteractions = __interactionsRef.current;
 22171 
       
 22172   function popDispatcher(prevDispatcher) {
       
 22173     ReactCurrentDispatcher$1.current = prevDispatcher;
       
 22174   }
       
 22175 
       
 22176   function pushInteractions(root) {
       
 22177     {
       
 22178       var prevInteractions = __interactionsRef.current;
 21984       __interactionsRef.current = root.memoizedInteractions;
 22179       __interactionsRef.current = root.memoizedInteractions;
 21985     }
 22180       return prevInteractions;
 21986 
 22181     }
 21987     startWorkLoopTimer(workInProgress);
 22182   }
 21988 
 22183 
 21989     // TODO: Fork renderRoot into renderRootSync and renderRootAsync
 22184   function popInteractions(prevInteractions) {
 21990     if (isSync) {
 22185     {
 21991       if (expirationTime !== Sync) {
       
 21992         // An async update expired. There may be other expired updates on
       
 21993         // this root. We should render all the expired work in a
       
 21994         // single batch.
       
 21995         var currentTime = requestCurrentTime();
       
 21996         if (currentTime < expirationTime) {
       
 21997           // Restart at the current time.
       
 21998           executionContext = prevExecutionContext;
       
 21999           resetContextDependencies();
       
 22000           ReactCurrentDispatcher.current = prevDispatcher;
       
 22001           if (enableSchedulerTracing) {
       
 22002             __interactionsRef.current = prevInteractions;
       
 22003           }
       
 22004           return renderRoot.bind(null, root, currentTime);
       
 22005         }
       
 22006       }
       
 22007     } else {
       
 22008       // Since we know we're in a React event, we can clear the current
       
 22009       // event time. The next update will compute a new event time.
       
 22010       currentEventTime = NoWork;
       
 22011     }
       
 22012 
       
 22013     do {
       
 22014       try {
       
 22015         if (isSync) {
       
 22016           workLoopSync();
       
 22017         } else {
       
 22018           workLoop();
       
 22019         }
       
 22020         break;
       
 22021       } catch (thrownValue) {
       
 22022         // Reset module-level state that was set during the render phase.
       
 22023         resetContextDependencies();
       
 22024         resetHooks();
       
 22025 
       
 22026         var sourceFiber = workInProgress;
       
 22027         if (sourceFiber === null || sourceFiber.return === null) {
       
 22028           // Expected to be working on a non-root fiber. This is a fatal error
       
 22029           // because there's no ancestor that can handle it; the root is
       
 22030           // supposed to capture all errors that weren't caught by an error
       
 22031           // boundary.
       
 22032           prepareFreshStack(root, expirationTime);
       
 22033           executionContext = prevExecutionContext;
       
 22034           throw thrownValue;
       
 22035         }
       
 22036 
       
 22037         if (enableProfilerTimer && sourceFiber.mode & ProfileMode) {
       
 22038           // Record the time spent rendering before an error was thrown. This
       
 22039           // avoids inaccurate Profiler durations in the case of a
       
 22040           // suspended render.
       
 22041           stopProfilerTimerIfRunningAndRecordDelta(sourceFiber, true);
       
 22042         }
       
 22043 
       
 22044         var returnFiber = sourceFiber.return;
       
 22045         throwException(root, returnFiber, sourceFiber, thrownValue, renderExpirationTime);
       
 22046         workInProgress = completeUnitOfWork(sourceFiber);
       
 22047       }
       
 22048     } while (true);
       
 22049 
       
 22050     executionContext = prevExecutionContext;
       
 22051     resetContextDependencies();
       
 22052     ReactCurrentDispatcher.current = prevDispatcher;
       
 22053     if (enableSchedulerTracing) {
       
 22054       __interactionsRef.current = prevInteractions;
 22186       __interactionsRef.current = prevInteractions;
 22055     }
 22187     }
 22056 
 22188   }
 22057     if (workInProgress !== null) {
 22189 
 22058       // There's still work left over. Return a continuation.
 22190   function markCommitTimeOfFallback() {
 22059       stopInterruptedWorkLoopTimer();
 22191     globalMostRecentFallbackTime = now();
 22060       if (expirationTime !== Sync) {
 22192   }
 22061         startRequestCallbackTimer();
 22193   function markRenderEventTimeAndConfig(expirationTime, suspenseConfig) {
 22062       }
 22194     if (expirationTime < workInProgressRootLatestProcessedExpirationTime && expirationTime > Idle) {
 22063       return renderRoot.bind(null, root, expirationTime);
 22195       workInProgressRootLatestProcessedExpirationTime = expirationTime;
 22064     }
 22196     }
 22065   }
 22197 
 22066 
 22198     if (suspenseConfig !== null) {
 22067   // We now have a consistent tree. The next step is either to commit it, or, if
 22199       if (expirationTime < workInProgressRootLatestSuspenseTimeout && expirationTime > Idle) {
 22068   // something suspended, wait to commit it after a timeout.
 22200         workInProgressRootLatestSuspenseTimeout = expirationTime; // Most of the time we only have one config and getting wrong is not bad.
 22069   stopFinishedWorkLoopTimer();
 22201 
 22070 
 22202         workInProgressRootCanSuspendUsingConfig = suspenseConfig;
 22071   root.finishedWork = root.current.alternate;
 22203       }
 22072   root.finishedExpirationTime = expirationTime;
 22204     }
 22073 
 22205   }
 22074   var isLocked = resolveLocksOnRoot(root, expirationTime);
 22206   function markUnprocessedUpdateTime(expirationTime) {
 22075   if (isLocked) {
 22207     if (expirationTime > workInProgressRootNextUnprocessedUpdateTime) {
 22076     // This root has a lock that prevents it from committing. Exit. If we begin
 22208       workInProgressRootNextUnprocessedUpdateTime = expirationTime;
 22077     // work on the root again, without any intervening updates, it will finish
 22209     }
 22078     // without doing additional work.
 22210   }
 22079     return null;
 22211   function renderDidSuspend() {
 22080   }
 22212     if (workInProgressRootExitStatus === RootIncomplete) {
 22081 
 22213       workInProgressRootExitStatus = RootSuspended;
 22082   // Set this to null to indicate there's no in-progress render.
 22214     }
 22083   workInProgressRoot = null;
 22215   }
 22084 
 22216   function renderDidSuspendDelayIfPossible() {
 22085   switch (workInProgressRootExitStatus) {
 22217     if (workInProgressRootExitStatus === RootIncomplete || workInProgressRootExitStatus === RootSuspended) {
 22086     case RootIncomplete:
 22218       workInProgressRootExitStatus = RootSuspendedWithDelay;
 22087       {
 22219     } // Check if there's a lower priority update somewhere else in the tree.
 22088         (function () {
 22220 
 22089           {
 22221 
 22090             {
 22222     if (workInProgressRootNextUnprocessedUpdateTime !== NoWork && workInProgressRoot !== null) {
 22091               throw ReactError(Error('Should have a work-in-progress.'));
 22223       // Mark the current render as suspended, and then mark that there's a
 22092             }
 22224       // pending update.
 22093           }
 22225       // TODO: This should immediately interrupt the current render, instead
 22094         })();
 22226       // of waiting until the next time we yield.
 22095       }
 22227       markRootSuspendedAtTime(workInProgressRoot, renderExpirationTime$1);
 22096     // Flow knows about invariant, so it complains if I add a break statement,
 22228       markRootUpdatedAtTime(workInProgressRoot, workInProgressRootNextUnprocessedUpdateTime);
 22097     // but eslint doesn't know about invariant, so it complains if I do.
 22229     }
 22098     // eslint-disable-next-line no-fallthrough
 22230   }
 22099     case RootErrored:
 22231   function renderDidError() {
 22100       {
 22232     if (workInProgressRootExitStatus !== RootCompleted) {
 22101         // An error was thrown. First check if there is lower priority work
 22233       workInProgressRootExitStatus = RootErrored;
 22102         // scheduled on this root.
 22234     }
 22103         var _lastPendingTime = root.lastPendingTime;
 22235   } // Called during render to determine if anything has suspended.
 22104         if (_lastPendingTime < expirationTime) {
 22236   // Returns false if we're not sure.
 22105           // There's lower priority work. Before raising the error, try rendering
 22237 
 22106           // at the lower priority to see if it fixes it. Use a continuation to
 22238   function renderHasNotSuspendedYet() {
 22107           // maintain the existing priority and position in the queue.
 22239     // If something errored or completed, we can't really be sure,
 22108           return renderRoot.bind(null, root, _lastPendingTime);
 22240     // so those are false.
 22109         }
 22241     return workInProgressRootExitStatus === RootIncomplete;
 22110         if (!isSync) {
 22242   }
 22111           // If we're rendering asynchronously, it's possible the error was
 22243 
 22112           // caused by tearing due to a mutation during an event. Try rendering
 22244   function inferTimeFromExpirationTime(expirationTime) {
 22113           // one more time without yiedling to events.
 22245     // We don't know exactly when the update was scheduled, but we can infer an
 22114           prepareFreshStack(root, expirationTime);
 22246     // approximate start time from the expiration time.
 22115           scheduleSyncCallback(renderRoot.bind(null, root, expirationTime));
 22247     var earliestExpirationTimeMs = expirationTimeToMs(expirationTime);
 22116           return null;
 22248     return earliestExpirationTimeMs - LOW_PRIORITY_EXPIRATION;
 22117         }
 22249   }
 22118         // If we're already rendering synchronously, commit the root in its
 22250 
 22119         // errored state.
 22251   function inferTimeFromExpirationTimeWithSuspenseConfig(expirationTime, suspenseConfig) {
 22120         return commitRoot.bind(null, root);
 22252     // We don't know exactly when the update was scheduled, but we can infer an
 22121       }
 22253     // approximate start time from the expiration time by subtracting the timeout
 22122     case RootSuspended:
 22254     // that was added to the event time.
 22123       {
 22255     var earliestExpirationTimeMs = expirationTimeToMs(expirationTime);
 22124         flushSuspensePriorityWarningInDEV();
 22256     return earliestExpirationTimeMs - (suspenseConfig.timeoutMs | 0 || LOW_PRIORITY_EXPIRATION);
 22125 
 22257   } // The work loop is an extremely hot path. Tell Closure not to inline it.
 22126         // We have an acceptable loading state. We need to figure out if we should
 22258 
 22127         // immediately commit it or wait a bit.
 22259   /** @noinline */
 22128 
 22260 
 22129         // If we have processed new updates during this render, we may now have a
 22261 
 22130         // new loading state ready. We want to ensure that we commit that as soon as
 22262   function workLoopSync() {
 22131         // possible.
 22263     // Already timed out, so perform work without checking if we need to yield.
 22132         var hasNotProcessedNewUpdates = workInProgressRootLatestProcessedExpirationTime === Sync;
 22264     while (workInProgress !== null) {
 22133         if (hasNotProcessedNewUpdates && !isSync &&
 22265       workInProgress = performUnitOfWork(workInProgress);
 22134         // do not delay if we're inside an act() scope
 22266     }
 22135         !(true && flushSuspenseFallbacksInTests && IsThisRendererActing.current)) {
 22267   }
 22136           // If we have not processed any new updates during this pass, then this is
 22268   /** @noinline */
 22137           // either a retry of an existing fallback state or a hidden tree.
 22269 
 22138           // Hidden trees shouldn't be batched with other work and after that's
 22270 
 22139           // fixed it can only be a retry.
 22271   function workLoopConcurrent() {
 22140           // We're going to throttle committing retries so that we don't show too
 22272     // Perform work until Scheduler asks us to yield
 22141           // many loading states too quickly.
 22273     while (workInProgress !== null && !shouldYield()) {
 22142           var msUntilTimeout = globalMostRecentFallbackTime + FALLBACK_THROTTLE_MS - now();
 22274       workInProgress = performUnitOfWork(workInProgress);
 22143           // Don't bother with a very short suspense time.
 22275     }
 22144           if (msUntilTimeout > 10) {
 22276   }
 22145             if (workInProgressRootHasPendingPing) {
 22277 
 22146               // This render was pinged but we didn't get to restart earlier so try
 22278   function performUnitOfWork(unitOfWork) {
 22147               // restarting now instead.
       
 22148               prepareFreshStack(root, expirationTime);
       
 22149               return renderRoot.bind(null, root, expirationTime);
       
 22150             }
       
 22151             var _lastPendingTime2 = root.lastPendingTime;
       
 22152             if (_lastPendingTime2 < expirationTime) {
       
 22153               // There's lower priority work. It might be unsuspended. Try rendering
       
 22154               // at that level.
       
 22155               return renderRoot.bind(null, root, _lastPendingTime2);
       
 22156             }
       
 22157             // The render is suspended, it hasn't timed out, and there's no lower
       
 22158             // priority work to do. Instead of committing the fallback
       
 22159             // immediately, wait for more data to arrive.
       
 22160             root.timeoutHandle = scheduleTimeout(commitRoot.bind(null, root), msUntilTimeout);
       
 22161             return null;
       
 22162           }
       
 22163         }
       
 22164         // The work expired. Commit immediately.
       
 22165         return commitRoot.bind(null, root);
       
 22166       }
       
 22167     case RootSuspendedWithDelay:
       
 22168       {
       
 22169         flushSuspensePriorityWarningInDEV();
       
 22170 
       
 22171         if (!isSync &&
       
 22172         // do not delay if we're inside an act() scope
       
 22173         !(true && flushSuspenseFallbacksInTests && IsThisRendererActing.current)) {
       
 22174           // We're suspended in a state that should be avoided. We'll try to avoid committing
       
 22175           // it for as long as the timeouts let us.
       
 22176           if (workInProgressRootHasPendingPing) {
       
 22177             // This render was pinged but we didn't get to restart earlier so try
       
 22178             // restarting now instead.
       
 22179             prepareFreshStack(root, expirationTime);
       
 22180             return renderRoot.bind(null, root, expirationTime);
       
 22181           }
       
 22182           var _lastPendingTime3 = root.lastPendingTime;
       
 22183           if (_lastPendingTime3 < expirationTime) {
       
 22184             // There's lower priority work. It might be unsuspended. Try rendering
       
 22185             // at that level immediately.
       
 22186             return renderRoot.bind(null, root, _lastPendingTime3);
       
 22187           }
       
 22188 
       
 22189           var _msUntilTimeout = void 0;
       
 22190           if (workInProgressRootLatestSuspenseTimeout !== Sync) {
       
 22191             // We have processed a suspense config whose expiration time we can use as
       
 22192             // the timeout.
       
 22193             _msUntilTimeout = expirationTimeToMs(workInProgressRootLatestSuspenseTimeout) - now();
       
 22194           } else if (workInProgressRootLatestProcessedExpirationTime === Sync) {
       
 22195             // This should never normally happen because only new updates cause
       
 22196             // delayed states, so we should have processed something. However,
       
 22197             // this could also happen in an offscreen tree.
       
 22198             _msUntilTimeout = 0;
       
 22199           } else {
       
 22200             // If we don't have a suspense config, we're going to use a heuristic to
       
 22201             var eventTimeMs = inferTimeFromExpirationTime(workInProgressRootLatestProcessedExpirationTime);
       
 22202             var currentTimeMs = now();
       
 22203             var timeUntilExpirationMs = expirationTimeToMs(expirationTime) - currentTimeMs;
       
 22204             var timeElapsed = currentTimeMs - eventTimeMs;
       
 22205             if (timeElapsed < 0) {
       
 22206               // We get this wrong some time since we estimate the time.
       
 22207               timeElapsed = 0;
       
 22208             }
       
 22209 
       
 22210             _msUntilTimeout = jnd(timeElapsed) - timeElapsed;
       
 22211 
       
 22212             // Clamp the timeout to the expiration time.
       
 22213             // TODO: Once the event time is exact instead of inferred from expiration time
       
 22214             // we don't need this.
       
 22215             if (timeUntilExpirationMs < _msUntilTimeout) {
       
 22216               _msUntilTimeout = timeUntilExpirationMs;
       
 22217             }
       
 22218           }
       
 22219 
       
 22220           // Don't bother with a very short suspense time.
       
 22221           if (_msUntilTimeout > 10) {
       
 22222             // The render is suspended, it hasn't timed out, and there's no lower
       
 22223             // priority work to do. Instead of committing the fallback
       
 22224             // immediately, wait for more data to arrive.
       
 22225             root.timeoutHandle = scheduleTimeout(commitRoot.bind(null, root), _msUntilTimeout);
       
 22226             return null;
       
 22227           }
       
 22228         }
       
 22229         // The work expired. Commit immediately.
       
 22230         return commitRoot.bind(null, root);
       
 22231       }
       
 22232     case RootCompleted:
       
 22233       {
       
 22234         // The work completed. Ready to commit.
       
 22235         if (!isSync &&
       
 22236         // do not delay if we're inside an act() scope
       
 22237         !(true && flushSuspenseFallbacksInTests && IsThisRendererActing.current) && workInProgressRootLatestProcessedExpirationTime !== Sync && workInProgressRootCanSuspendUsingConfig !== null) {
       
 22238           // If we have exceeded the minimum loading delay, which probably
       
 22239           // means we have shown a spinner already, we might have to suspend
       
 22240           // a bit longer to ensure that the spinner is shown for enough time.
       
 22241           var _msUntilTimeout2 = computeMsUntilSuspenseLoadingDelay(workInProgressRootLatestProcessedExpirationTime, expirationTime, workInProgressRootCanSuspendUsingConfig);
       
 22242           if (_msUntilTimeout2 > 10) {
       
 22243             root.timeoutHandle = scheduleTimeout(commitRoot.bind(null, root), _msUntilTimeout2);
       
 22244             return null;
       
 22245           }
       
 22246         }
       
 22247         return commitRoot.bind(null, root);
       
 22248       }
       
 22249     default:
       
 22250       {
       
 22251         (function () {
       
 22252           {
       
 22253             {
       
 22254               throw ReactError(Error('Unknown root exit status.'));
       
 22255             }
       
 22256           }
       
 22257         })();
       
 22258       }
       
 22259   }
       
 22260 }
       
 22261 
       
 22262 function markCommitTimeOfFallback() {
       
 22263   globalMostRecentFallbackTime = now();
       
 22264 }
       
 22265 
       
 22266 function markRenderEventTimeAndConfig(expirationTime, suspenseConfig) {
       
 22267   if (expirationTime < workInProgressRootLatestProcessedExpirationTime && expirationTime > Never) {
       
 22268     workInProgressRootLatestProcessedExpirationTime = expirationTime;
       
 22269   }
       
 22270   if (suspenseConfig !== null) {
       
 22271     if (expirationTime < workInProgressRootLatestSuspenseTimeout && expirationTime > Never) {
       
 22272       workInProgressRootLatestSuspenseTimeout = expirationTime;
       
 22273       // Most of the time we only have one config and getting wrong is not bad.
       
 22274       workInProgressRootCanSuspendUsingConfig = suspenseConfig;
       
 22275     }
       
 22276   }
       
 22277 }
       
 22278 
       
 22279 function renderDidSuspend() {
       
 22280   if (workInProgressRootExitStatus === RootIncomplete) {
       
 22281     workInProgressRootExitStatus = RootSuspended;
       
 22282   }
       
 22283 }
       
 22284 
       
 22285 function renderDidSuspendDelayIfPossible() {
       
 22286   if (workInProgressRootExitStatus === RootIncomplete || workInProgressRootExitStatus === RootSuspended) {
       
 22287     workInProgressRootExitStatus = RootSuspendedWithDelay;
       
 22288   }
       
 22289 }
       
 22290 
       
 22291 function renderDidError() {
       
 22292   if (workInProgressRootExitStatus !== RootCompleted) {
       
 22293     workInProgressRootExitStatus = RootErrored;
       
 22294   }
       
 22295 }
       
 22296 
       
 22297 // Called during render to determine if anything has suspended.
       
 22298 // Returns false if we're not sure.
       
 22299 function renderHasNotSuspendedYet() {
       
 22300   // If something errored or completed, we can't really be sure,
       
 22301   // so those are false.
       
 22302   return workInProgressRootExitStatus === RootIncomplete;
       
 22303 }
       
 22304 
       
 22305 function inferTimeFromExpirationTime(expirationTime) {
       
 22306   // We don't know exactly when the update was scheduled, but we can infer an
       
 22307   // approximate start time from the expiration time.
       
 22308   var earliestExpirationTimeMs = expirationTimeToMs(expirationTime);
       
 22309   return earliestExpirationTimeMs - LOW_PRIORITY_EXPIRATION;
       
 22310 }
       
 22311 
       
 22312 function inferTimeFromExpirationTimeWithSuspenseConfig(expirationTime, suspenseConfig) {
       
 22313   // We don't know exactly when the update was scheduled, but we can infer an
       
 22314   // approximate start time from the expiration time by subtracting the timeout
       
 22315   // that was added to the event time.
       
 22316   var earliestExpirationTimeMs = expirationTimeToMs(expirationTime);
       
 22317   return earliestExpirationTimeMs - (suspenseConfig.timeoutMs | 0 || LOW_PRIORITY_EXPIRATION);
       
 22318 }
       
 22319 
       
 22320 function workLoopSync() {
       
 22321   // Already timed out, so perform work without checking if we need to yield.
       
 22322   while (workInProgress !== null) {
       
 22323     workInProgress = performUnitOfWork(workInProgress);
       
 22324   }
       
 22325 }
       
 22326 
       
 22327 function workLoop() {
       
 22328   // Perform work until Scheduler asks us to yield
       
 22329   while (workInProgress !== null && !shouldYield()) {
       
 22330     workInProgress = performUnitOfWork(workInProgress);
       
 22331   }
       
 22332 }
       
 22333 
       
 22334 function performUnitOfWork(unitOfWork) {
       
 22335   // The current, flushed, state of this fiber is the alternate. Ideally
       
 22336   // nothing should rely on this, but relying on it here means that we don't
       
 22337   // need an additional field on the work in progress.
       
 22338   var current$$1 = unitOfWork.alternate;
       
 22339 
       
 22340   startWorkTimer(unitOfWork);
       
 22341   setCurrentFiber(unitOfWork);
       
 22342 
       
 22343   var next = void 0;
       
 22344   if (enableProfilerTimer && (unitOfWork.mode & ProfileMode) !== NoMode) {
       
 22345     startProfilerTimer(unitOfWork);
       
 22346     next = beginWork$$1(current$$1, unitOfWork, renderExpirationTime);
       
 22347     stopProfilerTimerIfRunningAndRecordDelta(unitOfWork, true);
       
 22348   } else {
       
 22349     next = beginWork$$1(current$$1, unitOfWork, renderExpirationTime);
       
 22350   }
       
 22351 
       
 22352   resetCurrentFiber();
       
 22353   unitOfWork.memoizedProps = unitOfWork.pendingProps;
       
 22354   if (next === null) {
       
 22355     // If this doesn't spawn new work, complete the current work.
       
 22356     next = completeUnitOfWork(unitOfWork);
       
 22357   }
       
 22358 
       
 22359   ReactCurrentOwner$2.current = null;
       
 22360   return next;
       
 22361 }
       
 22362 
       
 22363 function completeUnitOfWork(unitOfWork) {
       
 22364   // Attempt to complete the current unit of work, then move to the next
       
 22365   // sibling. If there are no more siblings, return to the parent fiber.
       
 22366   workInProgress = unitOfWork;
       
 22367   do {
       
 22368     // The current, flushed, state of this fiber is the alternate. Ideally
 22279     // The current, flushed, state of this fiber is the alternate. Ideally
 22369     // nothing should rely on this, but relying on it here means that we don't
 22280     // nothing should rely on this, but relying on it here means that we don't
 22370     // need an additional field on the work in progress.
 22281     // need an additional field on the work in progress.
 22371     var current$$1 = workInProgress.alternate;
 22282     var current = unitOfWork.alternate;
 22372     var returnFiber = workInProgress.return;
 22283     startWorkTimer(unitOfWork);
 22373 
 22284     setCurrentFiber(unitOfWork);
 22374     // Check if the work completed or if something threw.
 22285     var next;
 22375     if ((workInProgress.effectTag & Incomplete) === NoEffect) {
 22286 
 22376       setCurrentFiber(workInProgress);
 22287     if ( (unitOfWork.mode & ProfileMode) !== NoMode) {
 22377       var next = void 0;
 22288       startProfilerTimer(unitOfWork);
 22378       if (!enableProfilerTimer || (workInProgress.mode & ProfileMode) === NoMode) {
 22289       next = beginWork$1(current, unitOfWork, renderExpirationTime$1);
 22379         next = completeWork(current$$1, workInProgress, renderExpirationTime);
 22290       stopProfilerTimerIfRunningAndRecordDelta(unitOfWork, true);
       
 22291     } else {
       
 22292       next = beginWork$1(current, unitOfWork, renderExpirationTime$1);
       
 22293     }
       
 22294 
       
 22295     resetCurrentFiber();
       
 22296     unitOfWork.memoizedProps = unitOfWork.pendingProps;
       
 22297 
       
 22298     if (next === null) {
       
 22299       // If this doesn't spawn new work, complete the current work.
       
 22300       next = completeUnitOfWork(unitOfWork);
       
 22301     }
       
 22302 
       
 22303     ReactCurrentOwner$2.current = null;
       
 22304     return next;
       
 22305   }
       
 22306 
       
 22307   function completeUnitOfWork(unitOfWork) {
       
 22308     // Attempt to complete the current unit of work, then move to the next
       
 22309     // sibling. If there are no more siblings, return to the parent fiber.
       
 22310     workInProgress = unitOfWork;
       
 22311 
       
 22312     do {
       
 22313       // The current, flushed, state of this fiber is the alternate. Ideally
       
 22314       // nothing should rely on this, but relying on it here means that we don't
       
 22315       // need an additional field on the work in progress.
       
 22316       var current = workInProgress.alternate;
       
 22317       var returnFiber = workInProgress.return; // Check if the work completed or if something threw.
       
 22318 
       
 22319       if ((workInProgress.effectTag & Incomplete) === NoEffect) {
       
 22320         setCurrentFiber(workInProgress);
       
 22321         var next = void 0;
       
 22322 
       
 22323         if ( (workInProgress.mode & ProfileMode) === NoMode) {
       
 22324           next = completeWork(current, workInProgress, renderExpirationTime$1);
       
 22325         } else {
       
 22326           startProfilerTimer(workInProgress);
       
 22327           next = completeWork(current, workInProgress, renderExpirationTime$1); // Update render duration assuming we didn't error.
       
 22328 
       
 22329           stopProfilerTimerIfRunningAndRecordDelta(workInProgress, false);
       
 22330         }
       
 22331 
       
 22332         stopWorkTimer(workInProgress);
       
 22333         resetCurrentFiber();
       
 22334         resetChildExpirationTime(workInProgress);
       
 22335 
       
 22336         if (next !== null) {
       
 22337           // Completing this fiber spawned new work. Work on that next.
       
 22338           return next;
       
 22339         }
       
 22340 
       
 22341         if (returnFiber !== null && // Do not append effects to parents if a sibling failed to complete
       
 22342         (returnFiber.effectTag & Incomplete) === NoEffect) {
       
 22343           // Append all the effects of the subtree and this fiber onto the effect
       
 22344           // list of the parent. The completion order of the children affects the
       
 22345           // side-effect order.
       
 22346           if (returnFiber.firstEffect === null) {
       
 22347             returnFiber.firstEffect = workInProgress.firstEffect;
       
 22348           }
       
 22349 
       
 22350           if (workInProgress.lastEffect !== null) {
       
 22351             if (returnFiber.lastEffect !== null) {
       
 22352               returnFiber.lastEffect.nextEffect = workInProgress.firstEffect;
       
 22353             }
       
 22354 
       
 22355             returnFiber.lastEffect = workInProgress.lastEffect;
       
 22356           } // If this fiber had side-effects, we append it AFTER the children's
       
 22357           // side-effects. We can perform certain side-effects earlier if needed,
       
 22358           // by doing multiple passes over the effect list. We don't want to
       
 22359           // schedule our own side-effect on our own list because if end up
       
 22360           // reusing children we'll schedule this effect onto itself since we're
       
 22361           // at the end.
       
 22362 
       
 22363 
       
 22364           var effectTag = workInProgress.effectTag; // Skip both NoWork and PerformedWork tags when creating the effect
       
 22365           // list. PerformedWork effect is read by React DevTools but shouldn't be
       
 22366           // committed.
       
 22367 
       
 22368           if (effectTag > PerformedWork) {
       
 22369             if (returnFiber.lastEffect !== null) {
       
 22370               returnFiber.lastEffect.nextEffect = workInProgress;
       
 22371             } else {
       
 22372               returnFiber.firstEffect = workInProgress;
       
 22373             }
       
 22374 
       
 22375             returnFiber.lastEffect = workInProgress;
       
 22376           }
       
 22377         }
 22380       } else {
 22378       } else {
 22381         startProfilerTimer(workInProgress);
 22379         // This fiber did not complete because something threw. Pop values off
 22382         next = completeWork(current$$1, workInProgress, renderExpirationTime);
 22380         // the stack without entering the complete phase. If this is a boundary,
 22383         // Update render duration assuming we didn't error.
 22381         // capture values if possible.
 22384         stopProfilerTimerIfRunningAndRecordDelta(workInProgress, false);
 22382         var _next = unwindWork(workInProgress); // Because this fiber did not complete, don't reset its expiration time.
 22385       }
 22383 
 22386       stopWorkTimer(workInProgress);
 22384 
 22387       resetCurrentFiber();
 22385         if ( (workInProgress.mode & ProfileMode) !== NoMode) {
 22388       resetChildExpirationTime(workInProgress);
 22386           // Record the render duration for the fiber that errored.
 22389 
 22387           stopProfilerTimerIfRunningAndRecordDelta(workInProgress, false); // Include the time spent working on failed children before continuing.
 22390       if (next !== null) {
 22388 
 22391         // Completing this fiber spawned new work. Work on that next.
 22389           var actualDuration = workInProgress.actualDuration;
 22392         return next;
 22390           var child = workInProgress.child;
 22393       }
 22391 
 22394 
 22392           while (child !== null) {
 22395       if (returnFiber !== null &&
 22393             actualDuration += child.actualDuration;
 22396       // Do not append effects to parents if a sibling failed to complete
 22394             child = child.sibling;
 22397       (returnFiber.effectTag & Incomplete) === NoEffect) {
       
 22398         // Append all the effects of the subtree and this fiber onto the effect
       
 22399         // list of the parent. The completion order of the children affects the
       
 22400         // side-effect order.
       
 22401         if (returnFiber.firstEffect === null) {
       
 22402           returnFiber.firstEffect = workInProgress.firstEffect;
       
 22403         }
       
 22404         if (workInProgress.lastEffect !== null) {
       
 22405           if (returnFiber.lastEffect !== null) {
       
 22406             returnFiber.lastEffect.nextEffect = workInProgress.firstEffect;
       
 22407           }
 22395           }
 22408           returnFiber.lastEffect = workInProgress.lastEffect;
 22396 
 22409         }
 22397           workInProgress.actualDuration = actualDuration;
 22410 
 22398         }
 22411         // If this fiber had side-effects, we append it AFTER the children's
 22399 
 22412         // side-effects. We can perform certain side-effects earlier if needed,
 22400         if (_next !== null) {
 22413         // by doing multiple passes over the effect list. We don't want to
 22401           // If completing this work spawned new work, do that next. We'll come
 22414         // schedule our own side-effect on our own list because if end up
 22402           // back here again.
 22415         // reusing children we'll schedule this effect onto itself since we're
 22403           // Since we're restarting, remove anything that is not a host effect
 22416         // at the end.
 22404           // from the effect tag.
 22417         var effectTag = workInProgress.effectTag;
 22405           // TODO: The name stopFailedWorkTimer is misleading because Suspense
 22418 
 22406           // also captures and restarts.
 22419         // Skip both NoWork and PerformedWork tags when creating the effect
 22407           stopFailedWorkTimer(workInProgress);
 22420         // list. PerformedWork effect is read by React DevTools but shouldn't be
 22408           _next.effectTag &= HostEffectMask;
 22421         // committed.
 22409           return _next;
 22422         if (effectTag > PerformedWork) {
 22410         }
 22423           if (returnFiber.lastEffect !== null) {
 22411 
 22424             returnFiber.lastEffect.nextEffect = workInProgress;
 22412         stopWorkTimer(workInProgress);
 22425           } else {
 22413 
 22426             returnFiber.firstEffect = workInProgress;
 22414         if (returnFiber !== null) {
 22427           }
 22415           // Mark the parent fiber as incomplete and clear its effect list.
 22428           returnFiber.lastEffect = workInProgress;
 22416           returnFiber.firstEffect = returnFiber.lastEffect = null;
 22429         }
 22417           returnFiber.effectTag |= Incomplete;
 22430       }
 22418         }
       
 22419       }
       
 22420 
       
 22421       var siblingFiber = workInProgress.sibling;
       
 22422 
       
 22423       if (siblingFiber !== null) {
       
 22424         // If there is more work to do in this returnFiber, do that next.
       
 22425         return siblingFiber;
       
 22426       } // Otherwise, return to the parent
       
 22427 
       
 22428 
       
 22429       workInProgress = returnFiber;
       
 22430     } while (workInProgress !== null); // We've reached the root.
       
 22431 
       
 22432 
       
 22433     if (workInProgressRootExitStatus === RootIncomplete) {
       
 22434       workInProgressRootExitStatus = RootCompleted;
       
 22435     }
       
 22436 
       
 22437     return null;
       
 22438   }
       
 22439 
       
 22440   function getRemainingExpirationTime(fiber) {
       
 22441     var updateExpirationTime = fiber.expirationTime;
       
 22442     var childExpirationTime = fiber.childExpirationTime;
       
 22443     return updateExpirationTime > childExpirationTime ? updateExpirationTime : childExpirationTime;
       
 22444   }
       
 22445 
       
 22446   function resetChildExpirationTime(completedWork) {
       
 22447     if (renderExpirationTime$1 !== Never && completedWork.childExpirationTime === Never) {
       
 22448       // The children of this component are hidden. Don't bubble their
       
 22449       // expiration times.
       
 22450       return;
       
 22451     }
       
 22452 
       
 22453     var newChildExpirationTime = NoWork; // Bubble up the earliest expiration time.
       
 22454 
       
 22455     if ( (completedWork.mode & ProfileMode) !== NoMode) {
       
 22456       // In profiling mode, resetChildExpirationTime is also used to reset
       
 22457       // profiler durations.
       
 22458       var actualDuration = completedWork.actualDuration;
       
 22459       var treeBaseDuration = completedWork.selfBaseDuration; // When a fiber is cloned, its actualDuration is reset to 0. This value will
       
 22460       // only be updated if work is done on the fiber (i.e. it doesn't bailout).
       
 22461       // When work is done, it should bubble to the parent's actualDuration. If
       
 22462       // the fiber has not been cloned though, (meaning no work was done), then
       
 22463       // this value will reflect the amount of time spent working on a previous
       
 22464       // render. In that case it should not bubble. We determine whether it was
       
 22465       // cloned by comparing the child pointer.
       
 22466 
       
 22467       var shouldBubbleActualDurations = completedWork.alternate === null || completedWork.child !== completedWork.alternate.child;
       
 22468       var child = completedWork.child;
       
 22469 
       
 22470       while (child !== null) {
       
 22471         var childUpdateExpirationTime = child.expirationTime;
       
 22472         var childChildExpirationTime = child.childExpirationTime;
       
 22473 
       
 22474         if (childUpdateExpirationTime > newChildExpirationTime) {
       
 22475           newChildExpirationTime = childUpdateExpirationTime;
       
 22476         }
       
 22477 
       
 22478         if (childChildExpirationTime > newChildExpirationTime) {
       
 22479           newChildExpirationTime = childChildExpirationTime;
       
 22480         }
       
 22481 
       
 22482         if (shouldBubbleActualDurations) {
       
 22483           actualDuration += child.actualDuration;
       
 22484         }
       
 22485 
       
 22486         treeBaseDuration += child.treeBaseDuration;
       
 22487         child = child.sibling;
       
 22488       }
       
 22489 
       
 22490       completedWork.actualDuration = actualDuration;
       
 22491       completedWork.treeBaseDuration = treeBaseDuration;
 22431     } else {
 22492     } else {
 22432       // This fiber did not complete because something threw. Pop values off
 22493       var _child = completedWork.child;
 22433       // the stack without entering the complete phase. If this is a boundary,
 22494 
 22434       // capture values if possible.
 22495       while (_child !== null) {
 22435       var _next = unwindWork(workInProgress, renderExpirationTime);
 22496         var _childUpdateExpirationTime = _child.expirationTime;
 22436 
 22497         var _childChildExpirationTime = _child.childExpirationTime;
 22437       // Because this fiber did not complete, don't reset its expiration time.
 22498 
 22438 
 22499         if (_childUpdateExpirationTime > newChildExpirationTime) {
 22439       if (enableProfilerTimer && (workInProgress.mode & ProfileMode) !== NoMode) {
 22500           newChildExpirationTime = _childUpdateExpirationTime;
 22440         // Record the render duration for the fiber that errored.
 22501         }
 22441         stopProfilerTimerIfRunningAndRecordDelta(workInProgress, false);
 22502 
 22442 
 22503         if (_childChildExpirationTime > newChildExpirationTime) {
 22443         // Include the time spent working on failed children before continuing.
 22504           newChildExpirationTime = _childChildExpirationTime;
 22444         var actualDuration = workInProgress.actualDuration;
 22505         }
 22445         var child = workInProgress.child;
 22506 
 22446         while (child !== null) {
 22507         _child = _child.sibling;
 22447           actualDuration += child.actualDuration;
 22508       }
 22448           child = child.sibling;
 22509     }
 22449         }
 22510 
 22450         workInProgress.actualDuration = actualDuration;
 22511     completedWork.childExpirationTime = newChildExpirationTime;
 22451       }
 22512   }
 22452 
 22513 
 22453       if (_next !== null) {
 22514   function commitRoot(root) {
 22454         // If completing this work spawned new work, do that next. We'll come
 22515     var renderPriorityLevel = getCurrentPriorityLevel();
 22455         // back here again.
 22516     runWithPriority$1(ImmediatePriority, commitRootImpl.bind(null, root, renderPriorityLevel));
 22456         // Since we're restarting, remove anything that is not a host effect
 22517     return null;
 22457         // from the effect tag.
 22518   }
 22458         // TODO: The name stopFailedWorkTimer is misleading because Suspense
 22519 
 22459         // also captures and restarts.
 22520   function commitRootImpl(root, renderPriorityLevel) {
 22460         stopFailedWorkTimer(workInProgress);
 22521     do {
 22461         _next.effectTag &= HostEffectMask;
 22522       // `flushPassiveEffects` will call `flushSyncUpdateQueue` at the end, which
 22462         return _next;
 22523       // means `flushPassiveEffects` will sometimes result in additional
 22463       }
 22524       // passive effects. So we need to keep flushing in a loop until there are
 22464       stopWorkTimer(workInProgress);
 22525       // no more pending effects.
 22465 
 22526       // TODO: Might be better if `flushPassiveEffects` did not automatically
 22466       if (returnFiber !== null) {
 22527       // flush synchronous work at the end, to avoid factoring hazards like this.
 22467         // Mark the parent fiber as incomplete and clear its effect list.
       
 22468         returnFiber.firstEffect = returnFiber.lastEffect = null;
       
 22469         returnFiber.effectTag |= Incomplete;
       
 22470       }
       
 22471     }
       
 22472 
       
 22473     var siblingFiber = workInProgress.sibling;
       
 22474     if (siblingFiber !== null) {
       
 22475       // If there is more work to do in this returnFiber, do that next.
       
 22476       return siblingFiber;
       
 22477     }
       
 22478     // Otherwise, return to the parent
       
 22479     workInProgress = returnFiber;
       
 22480   } while (workInProgress !== null);
       
 22481 
       
 22482   // We've reached the root.
       
 22483   if (workInProgressRootExitStatus === RootIncomplete) {
       
 22484     workInProgressRootExitStatus = RootCompleted;
       
 22485   }
       
 22486   return null;
       
 22487 }
       
 22488 
       
 22489 function resetChildExpirationTime(completedWork) {
       
 22490   if (renderExpirationTime !== Never && completedWork.childExpirationTime === Never) {
       
 22491     // The children of this component are hidden. Don't bubble their
       
 22492     // expiration times.
       
 22493     return;
       
 22494   }
       
 22495 
       
 22496   var newChildExpirationTime = NoWork;
       
 22497 
       
 22498   // Bubble up the earliest expiration time.
       
 22499   if (enableProfilerTimer && (completedWork.mode & ProfileMode) !== NoMode) {
       
 22500     // In profiling mode, resetChildExpirationTime is also used to reset
       
 22501     // profiler durations.
       
 22502     var actualDuration = completedWork.actualDuration;
       
 22503     var treeBaseDuration = completedWork.selfBaseDuration;
       
 22504 
       
 22505     // When a fiber is cloned, its actualDuration is reset to 0. This value will
       
 22506     // only be updated if work is done on the fiber (i.e. it doesn't bailout).
       
 22507     // When work is done, it should bubble to the parent's actualDuration. If
       
 22508     // the fiber has not been cloned though, (meaning no work was done), then
       
 22509     // this value will reflect the amount of time spent working on a previous
       
 22510     // render. In that case it should not bubble. We determine whether it was
       
 22511     // cloned by comparing the child pointer.
       
 22512     var shouldBubbleActualDurations = completedWork.alternate === null || completedWork.child !== completedWork.alternate.child;
       
 22513 
       
 22514     var child = completedWork.child;
       
 22515     while (child !== null) {
       
 22516       var childUpdateExpirationTime = child.expirationTime;
       
 22517       var childChildExpirationTime = child.childExpirationTime;
       
 22518       if (childUpdateExpirationTime > newChildExpirationTime) {
       
 22519         newChildExpirationTime = childUpdateExpirationTime;
       
 22520       }
       
 22521       if (childChildExpirationTime > newChildExpirationTime) {
       
 22522         newChildExpirationTime = childChildExpirationTime;
       
 22523       }
       
 22524       if (shouldBubbleActualDurations) {
       
 22525         actualDuration += child.actualDuration;
       
 22526       }
       
 22527       treeBaseDuration += child.treeBaseDuration;
       
 22528       child = child.sibling;
       
 22529     }
       
 22530     completedWork.actualDuration = actualDuration;
       
 22531     completedWork.treeBaseDuration = treeBaseDuration;
       
 22532   } else {
       
 22533     var _child = completedWork.child;
       
 22534     while (_child !== null) {
       
 22535       var _childUpdateExpirationTime = _child.expirationTime;
       
 22536       var _childChildExpirationTime = _child.childExpirationTime;
       
 22537       if (_childUpdateExpirationTime > newChildExpirationTime) {
       
 22538         newChildExpirationTime = _childUpdateExpirationTime;
       
 22539       }
       
 22540       if (_childChildExpirationTime > newChildExpirationTime) {
       
 22541         newChildExpirationTime = _childChildExpirationTime;
       
 22542       }
       
 22543       _child = _child.sibling;
       
 22544     }
       
 22545   }
       
 22546 
       
 22547   completedWork.childExpirationTime = newChildExpirationTime;
       
 22548 }
       
 22549 
       
 22550 function commitRoot(root) {
       
 22551   var renderPriorityLevel = getCurrentPriorityLevel();
       
 22552   runWithPriority$2(ImmediatePriority, commitRootImpl.bind(null, root, renderPriorityLevel));
       
 22553   // If there are passive effects, schedule a callback to flush them. This goes
       
 22554   // outside commitRootImpl so that it inherits the priority of the render.
       
 22555   if (rootWithPendingPassiveEffects !== null) {
       
 22556     scheduleCallback(NormalPriority, function () {
       
 22557       flushPassiveEffects();
 22528       flushPassiveEffects();
 22558       return null;
 22529     } while (rootWithPendingPassiveEffects !== null);
 22559     });
 22530 
 22560   }
 22531     flushRenderPhaseStrictModeWarningsInDEV();
 22561   return null;
 22532 
 22562 }
       
 22563 
       
 22564 function commitRootImpl(root, renderPriorityLevel) {
       
 22565   flushPassiveEffects();
       
 22566   flushRenderPhaseStrictModeWarningsInDEV();
       
 22567 
       
 22568   (function () {
       
 22569     if (!((executionContext & (RenderContext | CommitContext)) === NoContext)) {
 22533     if (!((executionContext & (RenderContext | CommitContext)) === NoContext)) {
 22570       {
 22534       {
 22571         throw ReactError(Error('Should not already be working.'));
 22535         throw Error( "Should not already be working." );
 22572       }
 22536       }
 22573     }
 22537     }
 22574   })();
 22538 
 22575 
 22539     var finishedWork = root.finishedWork;
 22576   var finishedWork = root.finishedWork;
 22540     var expirationTime = root.finishedExpirationTime;
 22577   var expirationTime = root.finishedExpirationTime;
 22541 
 22578   if (finishedWork === null) {
 22542     if (finishedWork === null) {
 22579     return null;
 22543       return null;
 22580   }
 22544     }
 22581   root.finishedWork = null;
 22545 
 22582   root.finishedExpirationTime = NoWork;
 22546     root.finishedWork = null;
 22583 
 22547     root.finishedExpirationTime = NoWork;
 22584   (function () {
 22548 
 22585     if (!(finishedWork !== root.current)) {
 22549     if (!(finishedWork !== root.current)) {
 22586       {
 22550       {
 22587         throw ReactError(Error('Cannot commit the same tree as before. This error is likely caused by a bug in React. Please file an issue.'));
 22551         throw Error( "Cannot commit the same tree as before. This error is likely caused by a bug in React. Please file an issue." );
 22588       }
 22552       }
 22589     }
 22553     } // commitRoot never returns a continuation; it always finishes synchronously.
 22590   })();
 22554     // So we can clear these now to allow a new callback to be scheduled.
 22591 
 22555 
 22592   // commitRoot never returns a continuation; it always finishes synchronously.
 22556 
 22593   // So we can clear these now to allow a new callback to be scheduled.
 22557     root.callbackNode = null;
 22594   root.callbackNode = null;
 22558     root.callbackExpirationTime = NoWork;
 22595   root.callbackExpirationTime = NoWork;
 22559     root.callbackPriority = NoPriority;
 22596 
 22560     root.nextKnownPendingLevel = NoWork;
 22597   startCommitTimer();
 22561     startCommitTimer(); // Update the first and last pending times on this root. The new first
 22598 
 22562     // pending time is whatever is left on the root fiber.
 22599   // Update the first and last pending times on this root. The new first
 22563 
 22600   // pending time is whatever is left on the root fiber.
 22564     var remainingExpirationTimeBeforeCommit = getRemainingExpirationTime(finishedWork);
 22601   var updateExpirationTimeBeforeCommit = finishedWork.expirationTime;
 22565     markRootFinishedAtTime(root, expirationTime, remainingExpirationTimeBeforeCommit);
 22602   var childExpirationTimeBeforeCommit = finishedWork.childExpirationTime;
 22566 
 22603   var firstPendingTimeBeforeCommit = childExpirationTimeBeforeCommit > updateExpirationTimeBeforeCommit ? childExpirationTimeBeforeCommit : updateExpirationTimeBeforeCommit;
 22567     if (root === workInProgressRoot) {
 22604   root.firstPendingTime = firstPendingTimeBeforeCommit;
 22568       // We can reset these now that they are finished.
 22605   if (firstPendingTimeBeforeCommit < root.lastPendingTime) {
 22569       workInProgressRoot = null;
 22606     // This usually means we've finished all the work, but it can also happen
 22570       workInProgress = null;
 22607     // when something gets downprioritized during render, like a hidden tree.
 22571       renderExpirationTime$1 = NoWork;
 22608     root.lastPendingTime = firstPendingTimeBeforeCommit;
 22572     } // This indicates that the last root we worked on is not the same one that
 22609   }
 22573     // we're committing now. This most commonly happens when a suspended root
 22610 
 22574     // times out.
 22611   if (root === workInProgressRoot) {
 22575     // Get the list of effects.
 22612     // We can reset these now that they are finished.
 22576 
 22613     workInProgressRoot = null;
 22577 
 22614     workInProgress = null;
 22578     var firstEffect;
 22615     renderExpirationTime = NoWork;
 22579 
 22616   } else {}
 22580     if (finishedWork.effectTag > PerformedWork) {
 22617   // This indicates that the last root we worked on is not the same one that
 22581       // A fiber's effect list consists only of its children, not itself. So if
 22618   // we're committing now. This most commonly happens when a suspended root
 22582       // the root has an effect, we need to add it to the end of the list. The
 22619   // times out.
 22583       // resulting list is the set that would belong to the root's parent, if it
 22620 
 22584       // had one; that is, all the effects in the tree including the root.
 22621 
 22585       if (finishedWork.lastEffect !== null) {
 22622   // Get the list of effects.
 22586         finishedWork.lastEffect.nextEffect = finishedWork;
 22623   var firstEffect = void 0;
 22587         firstEffect = finishedWork.firstEffect;
 22624   if (finishedWork.effectTag > PerformedWork) {
 22588       } else {
 22625     // A fiber's effect list consists only of its children, not itself. So if
 22589         firstEffect = finishedWork;
 22626     // the root has an effect, we need to add it to the end of the list. The
 22590       }
 22627     // resulting list is the set that would belong to the root's parent, if it
 22591     } else {
 22628     // had one; that is, all the effects in the tree including the root.
 22592       // There is no effect on the root.
 22629     if (finishedWork.lastEffect !== null) {
       
 22630       finishedWork.lastEffect.nextEffect = finishedWork;
       
 22631       firstEffect = finishedWork.firstEffect;
 22593       firstEffect = finishedWork.firstEffect;
       
 22594     }
       
 22595 
       
 22596     if (firstEffect !== null) {
       
 22597       var prevExecutionContext = executionContext;
       
 22598       executionContext |= CommitContext;
       
 22599       var prevInteractions = pushInteractions(root); // Reset this to null before calling lifecycles
       
 22600 
       
 22601       ReactCurrentOwner$2.current = null; // The commit phase is broken into several sub-phases. We do a separate pass
       
 22602       // of the effect list for each phase: all mutation effects come before all
       
 22603       // layout effects, and so on.
       
 22604       // The first phase a "before mutation" phase. We use this phase to read the
       
 22605       // state of the host tree right before we mutate it. This is where
       
 22606       // getSnapshotBeforeUpdate is called.
       
 22607 
       
 22608       startCommitSnapshotEffectsTimer();
       
 22609       prepareForCommit(root.containerInfo);
       
 22610       nextEffect = firstEffect;
       
 22611 
       
 22612       do {
       
 22613         {
       
 22614           invokeGuardedCallback(null, commitBeforeMutationEffects, null);
       
 22615 
       
 22616           if (hasCaughtError()) {
       
 22617             if (!(nextEffect !== null)) {
       
 22618               {
       
 22619                 throw Error( "Should be working on an effect." );
       
 22620               }
       
 22621             }
       
 22622 
       
 22623             var error = clearCaughtError();
       
 22624             captureCommitPhaseError(nextEffect, error);
       
 22625             nextEffect = nextEffect.nextEffect;
       
 22626           }
       
 22627         }
       
 22628       } while (nextEffect !== null);
       
 22629 
       
 22630       stopCommitSnapshotEffectsTimer();
       
 22631 
       
 22632       {
       
 22633         // Mark the current commit time to be shared by all Profilers in this
       
 22634         // batch. This enables them to be grouped later.
       
 22635         recordCommitTime();
       
 22636       } // The next phase is the mutation phase, where we mutate the host tree.
       
 22637 
       
 22638 
       
 22639       startCommitHostEffectsTimer();
       
 22640       nextEffect = firstEffect;
       
 22641 
       
 22642       do {
       
 22643         {
       
 22644           invokeGuardedCallback(null, commitMutationEffects, null, root, renderPriorityLevel);
       
 22645 
       
 22646           if (hasCaughtError()) {
       
 22647             if (!(nextEffect !== null)) {
       
 22648               {
       
 22649                 throw Error( "Should be working on an effect." );
       
 22650               }
       
 22651             }
       
 22652 
       
 22653             var _error = clearCaughtError();
       
 22654 
       
 22655             captureCommitPhaseError(nextEffect, _error);
       
 22656             nextEffect = nextEffect.nextEffect;
       
 22657           }
       
 22658         }
       
 22659       } while (nextEffect !== null);
       
 22660 
       
 22661       stopCommitHostEffectsTimer();
       
 22662       resetAfterCommit(root.containerInfo); // The work-in-progress tree is now the current tree. This must come after
       
 22663       // the mutation phase, so that the previous tree is still current during
       
 22664       // componentWillUnmount, but before the layout phase, so that the finished
       
 22665       // work is current during componentDidMount/Update.
       
 22666 
       
 22667       root.current = finishedWork; // The next phase is the layout phase, where we call effects that read
       
 22668       // the host tree after it's been mutated. The idiomatic use case for this is
       
 22669       // layout, but class component lifecycles also fire here for legacy reasons.
       
 22670 
       
 22671       startCommitLifeCyclesTimer();
       
 22672       nextEffect = firstEffect;
       
 22673 
       
 22674       do {
       
 22675         {
       
 22676           invokeGuardedCallback(null, commitLayoutEffects, null, root, expirationTime);
       
 22677 
       
 22678           if (hasCaughtError()) {
       
 22679             if (!(nextEffect !== null)) {
       
 22680               {
       
 22681                 throw Error( "Should be working on an effect." );
       
 22682               }
       
 22683             }
       
 22684 
       
 22685             var _error2 = clearCaughtError();
       
 22686 
       
 22687             captureCommitPhaseError(nextEffect, _error2);
       
 22688             nextEffect = nextEffect.nextEffect;
       
 22689           }
       
 22690         }
       
 22691       } while (nextEffect !== null);
       
 22692 
       
 22693       stopCommitLifeCyclesTimer();
       
 22694       nextEffect = null; // Tell Scheduler to yield at the end of the frame, so the browser has an
       
 22695       // opportunity to paint.
       
 22696 
       
 22697       requestPaint();
       
 22698 
       
 22699       {
       
 22700         popInteractions(prevInteractions);
       
 22701       }
       
 22702 
       
 22703       executionContext = prevExecutionContext;
 22632     } else {
 22704     } else {
 22633       firstEffect = finishedWork;
 22705       // No effects.
 22634     }
 22706       root.current = finishedWork; // Measure these anyway so the flamegraph explicitly shows that there were
 22635   } else {
 22707       // no effects.
 22636     // There is no effect on the root.
 22708       // TODO: Maybe there's a better way to report this.
 22637     firstEffect = finishedWork.firstEffect;
 22709 
 22638   }
 22710       startCommitSnapshotEffectsTimer();
 22639 
 22711       stopCommitSnapshotEffectsTimer();
 22640   if (firstEffect !== null) {
 22712 
       
 22713       {
       
 22714         recordCommitTime();
       
 22715       }
       
 22716 
       
 22717       startCommitHostEffectsTimer();
       
 22718       stopCommitHostEffectsTimer();
       
 22719       startCommitLifeCyclesTimer();
       
 22720       stopCommitLifeCyclesTimer();
       
 22721     }
       
 22722 
       
 22723     stopCommitTimer();
       
 22724     var rootDidHavePassiveEffects = rootDoesHavePassiveEffects;
       
 22725 
       
 22726     if (rootDoesHavePassiveEffects) {
       
 22727       // This commit has passive effects. Stash a reference to them. But don't
       
 22728       // schedule a callback until after flushing layout work.
       
 22729       rootDoesHavePassiveEffects = false;
       
 22730       rootWithPendingPassiveEffects = root;
       
 22731       pendingPassiveEffectsExpirationTime = expirationTime;
       
 22732       pendingPassiveEffectsRenderPriority = renderPriorityLevel;
       
 22733     } else {
       
 22734       // We are done with the effect chain at this point so let's clear the
       
 22735       // nextEffect pointers to assist with GC. If we have passive effects, we'll
       
 22736       // clear this in flushPassiveEffects.
       
 22737       nextEffect = firstEffect;
       
 22738 
       
 22739       while (nextEffect !== null) {
       
 22740         var nextNextEffect = nextEffect.nextEffect;
       
 22741         nextEffect.nextEffect = null;
       
 22742         nextEffect = nextNextEffect;
       
 22743       }
       
 22744     } // Check if there's remaining work on this root
       
 22745 
       
 22746 
       
 22747     var remainingExpirationTime = root.firstPendingTime;
       
 22748 
       
 22749     if (remainingExpirationTime !== NoWork) {
       
 22750       {
       
 22751         if (spawnedWorkDuringRender !== null) {
       
 22752           var expirationTimes = spawnedWorkDuringRender;
       
 22753           spawnedWorkDuringRender = null;
       
 22754 
       
 22755           for (var i = 0; i < expirationTimes.length; i++) {
       
 22756             scheduleInteractions(root, expirationTimes[i], root.memoizedInteractions);
       
 22757           }
       
 22758         }
       
 22759 
       
 22760         schedulePendingInteractions(root, remainingExpirationTime);
       
 22761       }
       
 22762     } else {
       
 22763       // If there's no remaining work, we can clear the set of already failed
       
 22764       // error boundaries.
       
 22765       legacyErrorBoundariesThatAlreadyFailed = null;
       
 22766     }
       
 22767 
       
 22768     {
       
 22769       if (!rootDidHavePassiveEffects) {
       
 22770         // If there are no passive effects, then we can complete the pending interactions.
       
 22771         // Otherwise, we'll wait until after the passive effects are flushed.
       
 22772         // Wait to do this until after remaining work has been scheduled,
       
 22773         // so that we don't prematurely signal complete for interactions when there's e.g. hidden work.
       
 22774         finishPendingInteractions(root, expirationTime);
       
 22775       }
       
 22776     }
       
 22777 
       
 22778     if (remainingExpirationTime === Sync) {
       
 22779       // Count the number of times the root synchronously re-renders without
       
 22780       // finishing. If there are too many, it indicates an infinite update loop.
       
 22781       if (root === rootWithNestedUpdates) {
       
 22782         nestedUpdateCount++;
       
 22783       } else {
       
 22784         nestedUpdateCount = 0;
       
 22785         rootWithNestedUpdates = root;
       
 22786       }
       
 22787     } else {
       
 22788       nestedUpdateCount = 0;
       
 22789     }
       
 22790 
       
 22791     onCommitRoot(finishedWork.stateNode, expirationTime); // Always call this before exiting `commitRoot`, to ensure that any
       
 22792     // additional work on this root is scheduled.
       
 22793 
       
 22794     ensureRootIsScheduled(root);
       
 22795 
       
 22796     if (hasUncaughtError) {
       
 22797       hasUncaughtError = false;
       
 22798       var _error3 = firstUncaughtError;
       
 22799       firstUncaughtError = null;
       
 22800       throw _error3;
       
 22801     }
       
 22802 
       
 22803     if ((executionContext & LegacyUnbatchedContext) !== NoContext) {
       
 22804       // This is a legacy edge case. We just committed the initial mount of
       
 22805       // a ReactDOM.render-ed root inside of batchedUpdates. The commit fired
       
 22806       // synchronously, but layout updates should be deferred until the end
       
 22807       // of the batch.
       
 22808       return null;
       
 22809     } // If layout work was scheduled, flush it now.
       
 22810 
       
 22811 
       
 22812     flushSyncCallbackQueue();
       
 22813     return null;
       
 22814   }
       
 22815 
       
 22816   function commitBeforeMutationEffects() {
       
 22817     while (nextEffect !== null) {
       
 22818       var effectTag = nextEffect.effectTag;
       
 22819 
       
 22820       if ((effectTag & Snapshot) !== NoEffect) {
       
 22821         setCurrentFiber(nextEffect);
       
 22822         recordEffect();
       
 22823         var current = nextEffect.alternate;
       
 22824         commitBeforeMutationLifeCycles(current, nextEffect);
       
 22825         resetCurrentFiber();
       
 22826       }
       
 22827 
       
 22828       if ((effectTag & Passive) !== NoEffect) {
       
 22829         // If there are passive effects, schedule a callback to flush at
       
 22830         // the earliest opportunity.
       
 22831         if (!rootDoesHavePassiveEffects) {
       
 22832           rootDoesHavePassiveEffects = true;
       
 22833           scheduleCallback(NormalPriority, function () {
       
 22834             flushPassiveEffects();
       
 22835             return null;
       
 22836           });
       
 22837         }
       
 22838       }
       
 22839 
       
 22840       nextEffect = nextEffect.nextEffect;
       
 22841     }
       
 22842   }
       
 22843 
       
 22844   function commitMutationEffects(root, renderPriorityLevel) {
       
 22845     // TODO: Should probably move the bulk of this function to commitWork.
       
 22846     while (nextEffect !== null) {
       
 22847       setCurrentFiber(nextEffect);
       
 22848       var effectTag = nextEffect.effectTag;
       
 22849 
       
 22850       if (effectTag & ContentReset) {
       
 22851         commitResetTextContent(nextEffect);
       
 22852       }
       
 22853 
       
 22854       if (effectTag & Ref) {
       
 22855         var current = nextEffect.alternate;
       
 22856 
       
 22857         if (current !== null) {
       
 22858           commitDetachRef(current);
       
 22859         }
       
 22860       } // The following switch statement is only concerned about placement,
       
 22861       // updates, and deletions. To avoid needing to add a case for every possible
       
 22862       // bitmap value, we remove the secondary effects from the effect tag and
       
 22863       // switch on that value.
       
 22864 
       
 22865 
       
 22866       var primaryEffectTag = effectTag & (Placement | Update | Deletion | Hydrating);
       
 22867 
       
 22868       switch (primaryEffectTag) {
       
 22869         case Placement:
       
 22870           {
       
 22871             commitPlacement(nextEffect); // Clear the "placement" from effect tag so that we know that this is
       
 22872             // inserted, before any life-cycles like componentDidMount gets called.
       
 22873             // TODO: findDOMNode doesn't rely on this any more but isMounted does
       
 22874             // and isMounted is deprecated anyway so we should be able to kill this.
       
 22875 
       
 22876             nextEffect.effectTag &= ~Placement;
       
 22877             break;
       
 22878           }
       
 22879 
       
 22880         case PlacementAndUpdate:
       
 22881           {
       
 22882             // Placement
       
 22883             commitPlacement(nextEffect); // Clear the "placement" from effect tag so that we know that this is
       
 22884             // inserted, before any life-cycles like componentDidMount gets called.
       
 22885 
       
 22886             nextEffect.effectTag &= ~Placement; // Update
       
 22887 
       
 22888             var _current = nextEffect.alternate;
       
 22889             commitWork(_current, nextEffect);
       
 22890             break;
       
 22891           }
       
 22892 
       
 22893         case Hydrating:
       
 22894           {
       
 22895             nextEffect.effectTag &= ~Hydrating;
       
 22896             break;
       
 22897           }
       
 22898 
       
 22899         case HydratingAndUpdate:
       
 22900           {
       
 22901             nextEffect.effectTag &= ~Hydrating; // Update
       
 22902 
       
 22903             var _current2 = nextEffect.alternate;
       
 22904             commitWork(_current2, nextEffect);
       
 22905             break;
       
 22906           }
       
 22907 
       
 22908         case Update:
       
 22909           {
       
 22910             var _current3 = nextEffect.alternate;
       
 22911             commitWork(_current3, nextEffect);
       
 22912             break;
       
 22913           }
       
 22914 
       
 22915         case Deletion:
       
 22916           {
       
 22917             commitDeletion(root, nextEffect, renderPriorityLevel);
       
 22918             break;
       
 22919           }
       
 22920       } // TODO: Only record a mutation effect if primaryEffectTag is non-zero.
       
 22921 
       
 22922 
       
 22923       recordEffect();
       
 22924       resetCurrentFiber();
       
 22925       nextEffect = nextEffect.nextEffect;
       
 22926     }
       
 22927   }
       
 22928 
       
 22929   function commitLayoutEffects(root, committedExpirationTime) {
       
 22930     // TODO: Should probably move the bulk of this function to commitWork.
       
 22931     while (nextEffect !== null) {
       
 22932       setCurrentFiber(nextEffect);
       
 22933       var effectTag = nextEffect.effectTag;
       
 22934 
       
 22935       if (effectTag & (Update | Callback)) {
       
 22936         recordEffect();
       
 22937         var current = nextEffect.alternate;
       
 22938         commitLifeCycles(root, current, nextEffect);
       
 22939       }
       
 22940 
       
 22941       if (effectTag & Ref) {
       
 22942         recordEffect();
       
 22943         commitAttachRef(nextEffect);
       
 22944       }
       
 22945 
       
 22946       resetCurrentFiber();
       
 22947       nextEffect = nextEffect.nextEffect;
       
 22948     }
       
 22949   }
       
 22950 
       
 22951   function flushPassiveEffects() {
       
 22952     if (pendingPassiveEffectsRenderPriority !== NoPriority) {
       
 22953       var priorityLevel = pendingPassiveEffectsRenderPriority > NormalPriority ? NormalPriority : pendingPassiveEffectsRenderPriority;
       
 22954       pendingPassiveEffectsRenderPriority = NoPriority;
       
 22955       return runWithPriority$1(priorityLevel, flushPassiveEffectsImpl);
       
 22956     }
       
 22957   }
       
 22958 
       
 22959   function flushPassiveEffectsImpl() {
       
 22960     if (rootWithPendingPassiveEffects === null) {
       
 22961       return false;
       
 22962     }
       
 22963 
       
 22964     var root = rootWithPendingPassiveEffects;
       
 22965     var expirationTime = pendingPassiveEffectsExpirationTime;
       
 22966     rootWithPendingPassiveEffects = null;
       
 22967     pendingPassiveEffectsExpirationTime = NoWork;
       
 22968 
       
 22969     if (!((executionContext & (RenderContext | CommitContext)) === NoContext)) {
       
 22970       {
       
 22971         throw Error( "Cannot flush passive effects while already rendering." );
       
 22972       }
       
 22973     }
       
 22974 
 22641     var prevExecutionContext = executionContext;
 22975     var prevExecutionContext = executionContext;
 22642     executionContext |= CommitContext;
 22976     executionContext |= CommitContext;
 22643     var prevInteractions = null;
 22977     var prevInteractions = pushInteractions(root);
 22644     if (enableSchedulerTracing) {
 22978 
 22645       prevInteractions = __interactionsRef.current;
 22979     {
 22646       __interactionsRef.current = root.memoizedInteractions;
 22980       // Note: This currently assumes there are no passive effects on the root fiber
 22647     }
 22981       // because the root is not part of its own effect list.
 22648 
 22982       // This could change in the future.
 22649     // Reset this to null before calling lifecycles
 22983       var _effect2 = root.current.firstEffect;
 22650     ReactCurrentOwner$2.current = null;
 22984 
 22651 
 22985       while (_effect2 !== null) {
 22652     // The commit phase is broken into several sub-phases. We do a separate pass
 22986         {
 22653     // of the effect list for each phase: all mutation effects come before all
 22987           setCurrentFiber(_effect2);
 22654     // layout effects, and so on.
 22988           invokeGuardedCallback(null, commitPassiveHookEffects, null, _effect2);
 22655 
 22989 
 22656     // The first phase a "before mutation" phase. We use this phase to read the
 22990           if (hasCaughtError()) {
 22657     // state of the host tree right before we mutate it. This is where
 22991             if (!(_effect2 !== null)) {
 22658     // getSnapshotBeforeUpdate is called.
       
 22659     startCommitSnapshotEffectsTimer();
       
 22660     prepareForCommit(root.containerInfo);
       
 22661     nextEffect = firstEffect;
       
 22662     do {
       
 22663       {
       
 22664         invokeGuardedCallback(null, commitBeforeMutationEffects, null);
       
 22665         if (hasCaughtError()) {
       
 22666           (function () {
       
 22667             if (!(nextEffect !== null)) {
       
 22668               {
 22992               {
 22669                 throw ReactError(Error('Should be working on an effect.'));
 22993                 throw Error( "Should be working on an effect." );
 22670               }
 22994               }
 22671             }
 22995             }
 22672           })();
 22996 
 22673           var error = clearCaughtError();
 22997             var _error5 = clearCaughtError();
 22674           captureCommitPhaseError(nextEffect, error);
 22998 
 22675           nextEffect = nextEffect.nextEffect;
 22999             captureCommitPhaseError(_effect2, _error5);
 22676         }
 23000           }
 22677       }
 23001 
 22678     } while (nextEffect !== null);
 23002           resetCurrentFiber();
 22679     stopCommitSnapshotEffectsTimer();
 23003         }
 22680 
 23004 
 22681     if (enableProfilerTimer) {
 23005         var nextNextEffect = _effect2.nextEffect; // Remove nextEffect pointer to assist GC
 22682       // Mark the current commit time to be shared by all Profilers in this
 23006 
 22683       // batch. This enables them to be grouped later.
 23007         _effect2.nextEffect = null;
 22684       recordCommitTime();
 23008         _effect2 = nextNextEffect;
 22685     }
 23009       }
 22686 
 23010     }
 22687     // The next phase is the mutation phase, where we mutate the host tree.
 23011 
 22688     startCommitHostEffectsTimer();
 23012     {
 22689     nextEffect = firstEffect;
 23013       popInteractions(prevInteractions);
 22690     do {
 23014       finishPendingInteractions(root, expirationTime);
       
 23015     }
       
 23016 
       
 23017     executionContext = prevExecutionContext;
       
 23018     flushSyncCallbackQueue(); // If additional passive effects were scheduled, increment a counter. If this
       
 23019     // exceeds the limit, we'll fire a warning.
       
 23020 
       
 23021     nestedPassiveUpdateCount = rootWithPendingPassiveEffects === null ? 0 : nestedPassiveUpdateCount + 1;
       
 23022     return true;
       
 23023   }
       
 23024 
       
 23025   function isAlreadyFailedLegacyErrorBoundary(instance) {
       
 23026     return legacyErrorBoundariesThatAlreadyFailed !== null && legacyErrorBoundariesThatAlreadyFailed.has(instance);
       
 23027   }
       
 23028   function markLegacyErrorBoundaryAsFailed(instance) {
       
 23029     if (legacyErrorBoundariesThatAlreadyFailed === null) {
       
 23030       legacyErrorBoundariesThatAlreadyFailed = new Set([instance]);
       
 23031     } else {
       
 23032       legacyErrorBoundariesThatAlreadyFailed.add(instance);
       
 23033     }
       
 23034   }
       
 23035 
       
 23036   function prepareToThrowUncaughtError(error) {
       
 23037     if (!hasUncaughtError) {
       
 23038       hasUncaughtError = true;
       
 23039       firstUncaughtError = error;
       
 23040     }
       
 23041   }
       
 23042 
       
 23043   var onUncaughtError = prepareToThrowUncaughtError;
       
 23044 
       
 23045   function captureCommitPhaseErrorOnRoot(rootFiber, sourceFiber, error) {
       
 23046     var errorInfo = createCapturedValue(error, sourceFiber);
       
 23047     var update = createRootErrorUpdate(rootFiber, errorInfo, Sync);
       
 23048     enqueueUpdate(rootFiber, update);
       
 23049     var root = markUpdateTimeFromFiberToRoot(rootFiber, Sync);
       
 23050 
       
 23051     if (root !== null) {
       
 23052       ensureRootIsScheduled(root);
       
 23053       schedulePendingInteractions(root, Sync);
       
 23054     }
       
 23055   }
       
 23056 
       
 23057   function captureCommitPhaseError(sourceFiber, error) {
       
 23058     if (sourceFiber.tag === HostRoot) {
       
 23059       // Error was thrown at the root. There is no parent, so the root
       
 23060       // itself should capture it.
       
 23061       captureCommitPhaseErrorOnRoot(sourceFiber, sourceFiber, error);
       
 23062       return;
       
 23063     }
       
 23064 
       
 23065     var fiber = sourceFiber.return;
       
 23066 
       
 23067     while (fiber !== null) {
       
 23068       if (fiber.tag === HostRoot) {
       
 23069         captureCommitPhaseErrorOnRoot(fiber, sourceFiber, error);
       
 23070         return;
       
 23071       } else if (fiber.tag === ClassComponent) {
       
 23072         var ctor = fiber.type;
       
 23073         var instance = fiber.stateNode;
       
 23074 
       
 23075         if (typeof ctor.getDerivedStateFromError === 'function' || typeof instance.componentDidCatch === 'function' && !isAlreadyFailedLegacyErrorBoundary(instance)) {
       
 23076           var errorInfo = createCapturedValue(error, sourceFiber);
       
 23077           var update = createClassErrorUpdate(fiber, errorInfo, // TODO: This is always sync
       
 23078           Sync);
       
 23079           enqueueUpdate(fiber, update);
       
 23080           var root = markUpdateTimeFromFiberToRoot(fiber, Sync);
       
 23081 
       
 23082           if (root !== null) {
       
 23083             ensureRootIsScheduled(root);
       
 23084             schedulePendingInteractions(root, Sync);
       
 23085           }
       
 23086 
       
 23087           return;
       
 23088         }
       
 23089       }
       
 23090 
       
 23091       fiber = fiber.return;
       
 23092     }
       
 23093   }
       
 23094   function pingSuspendedRoot(root, thenable, suspendedTime) {
       
 23095     var pingCache = root.pingCache;
       
 23096 
       
 23097     if (pingCache !== null) {
       
 23098       // The thenable resolved, so we no longer need to memoize, because it will
       
 23099       // never be thrown again.
       
 23100       pingCache.delete(thenable);
       
 23101     }
       
 23102 
       
 23103     if (workInProgressRoot === root && renderExpirationTime$1 === suspendedTime) {
       
 23104       // Received a ping at the same priority level at which we're currently
       
 23105       // rendering. We might want to restart this render. This should mirror
       
 23106       // the logic of whether or not a root suspends once it completes.
       
 23107       // TODO: If we're rendering sync either due to Sync, Batched or expired,
       
 23108       // we should probably never restart.
       
 23109       // If we're suspended with delay, we'll always suspend so we can always
       
 23110       // restart. If we're suspended without any updates, it might be a retry.
       
 23111       // If it's early in the retry we can restart. We can't know for sure
       
 23112       // whether we'll eventually process an update during this render pass,
       
 23113       // but it's somewhat unlikely that we get to a ping before that, since
       
 23114       // getting to the root most update is usually very fast.
       
 23115       if (workInProgressRootExitStatus === RootSuspendedWithDelay || workInProgressRootExitStatus === RootSuspended && workInProgressRootLatestProcessedExpirationTime === Sync && now() - globalMostRecentFallbackTime < FALLBACK_THROTTLE_MS) {
       
 23116         // Restart from the root. Don't need to schedule a ping because
       
 23117         // we're already working on this tree.
       
 23118         prepareFreshStack(root, renderExpirationTime$1);
       
 23119       } else {
       
 23120         // Even though we can't restart right now, we might get an
       
 23121         // opportunity later. So we mark this render as having a ping.
       
 23122         workInProgressRootHasPendingPing = true;
       
 23123       }
       
 23124 
       
 23125       return;
       
 23126     }
       
 23127 
       
 23128     if (!isRootSuspendedAtTime(root, suspendedTime)) {
       
 23129       // The root is no longer suspended at this time.
       
 23130       return;
       
 23131     }
       
 23132 
       
 23133     var lastPingedTime = root.lastPingedTime;
       
 23134 
       
 23135     if (lastPingedTime !== NoWork && lastPingedTime < suspendedTime) {
       
 23136       // There's already a lower priority ping scheduled.
       
 23137       return;
       
 23138     } // Mark the time at which this ping was scheduled.
       
 23139 
       
 23140 
       
 23141     root.lastPingedTime = suspendedTime;
       
 23142 
       
 23143     ensureRootIsScheduled(root);
       
 23144     schedulePendingInteractions(root, suspendedTime);
       
 23145   }
       
 23146 
       
 23147   function retryTimedOutBoundary(boundaryFiber, retryTime) {
       
 23148     // The boundary fiber (a Suspense component or SuspenseList component)
       
 23149     // previously was rendered in its fallback state. One of the promises that
       
 23150     // suspended it has resolved, which means at least part of the tree was
       
 23151     // likely unblocked. Try rendering again, at a new expiration time.
       
 23152     if (retryTime === NoWork) {
       
 23153       var suspenseConfig = null; // Retries don't carry over the already committed update.
       
 23154 
       
 23155       var currentTime = requestCurrentTimeForUpdate();
       
 23156       retryTime = computeExpirationForFiber(currentTime, boundaryFiber, suspenseConfig);
       
 23157     } // TODO: Special case idle priority?
       
 23158 
       
 23159 
       
 23160     var root = markUpdateTimeFromFiberToRoot(boundaryFiber, retryTime);
       
 23161 
       
 23162     if (root !== null) {
       
 23163       ensureRootIsScheduled(root);
       
 23164       schedulePendingInteractions(root, retryTime);
       
 23165     }
       
 23166   }
       
 23167   function resolveRetryThenable(boundaryFiber, thenable) {
       
 23168     var retryTime = NoWork; // Default
       
 23169 
       
 23170     var retryCache;
       
 23171 
       
 23172     {
       
 23173       retryCache = boundaryFiber.stateNode;
       
 23174     }
       
 23175 
       
 23176     if (retryCache !== null) {
       
 23177       // The thenable resolved, so we no longer need to memoize, because it will
       
 23178       // never be thrown again.
       
 23179       retryCache.delete(thenable);
       
 23180     }
       
 23181 
       
 23182     retryTimedOutBoundary(boundaryFiber, retryTime);
       
 23183   } // Computes the next Just Noticeable Difference (JND) boundary.
       
 23184   // The theory is that a person can't tell the difference between small differences in time.
       
 23185   // Therefore, if we wait a bit longer than necessary that won't translate to a noticeable
       
 23186   // difference in the experience. However, waiting for longer might mean that we can avoid
       
 23187   // showing an intermediate loading state. The longer we have already waited, the harder it
       
 23188   // is to tell small differences in time. Therefore, the longer we've already waited,
       
 23189   // the longer we can wait additionally. At some point we have to give up though.
       
 23190   // We pick a train model where the next boundary commits at a consistent schedule.
       
 23191   // These particular numbers are vague estimates. We expect to adjust them based on research.
       
 23192 
       
 23193   function jnd(timeElapsed) {
       
 23194     return timeElapsed < 120 ? 120 : timeElapsed < 480 ? 480 : timeElapsed < 1080 ? 1080 : timeElapsed < 1920 ? 1920 : timeElapsed < 3000 ? 3000 : timeElapsed < 4320 ? 4320 : ceil(timeElapsed / 1960) * 1960;
       
 23195   }
       
 23196 
       
 23197   function computeMsUntilSuspenseLoadingDelay(mostRecentEventTime, committedExpirationTime, suspenseConfig) {
       
 23198     var busyMinDurationMs = suspenseConfig.busyMinDurationMs | 0;
       
 23199 
       
 23200     if (busyMinDurationMs <= 0) {
       
 23201       return 0;
       
 23202     }
       
 23203 
       
 23204     var busyDelayMs = suspenseConfig.busyDelayMs | 0; // Compute the time until this render pass would expire.
       
 23205 
       
 23206     var currentTimeMs = now();
       
 23207     var eventTimeMs = inferTimeFromExpirationTimeWithSuspenseConfig(mostRecentEventTime, suspenseConfig);
       
 23208     var timeElapsed = currentTimeMs - eventTimeMs;
       
 23209 
       
 23210     if (timeElapsed <= busyDelayMs) {
       
 23211       // If we haven't yet waited longer than the initial delay, we don't
       
 23212       // have to wait any additional time.
       
 23213       return 0;
       
 23214     }
       
 23215 
       
 23216     var msUntilTimeout = busyDelayMs + busyMinDurationMs - timeElapsed; // This is the value that is passed to `setTimeout`.
       
 23217 
       
 23218     return msUntilTimeout;
       
 23219   }
       
 23220 
       
 23221   function checkForNestedUpdates() {
       
 23222     if (nestedUpdateCount > NESTED_UPDATE_LIMIT) {
       
 23223       nestedUpdateCount = 0;
       
 23224       rootWithNestedUpdates = null;
       
 23225 
 22691       {
 23226       {
 22692         invokeGuardedCallback(null, commitMutationEffects, null, renderPriorityLevel);
 23227         {
       
 23228           throw Error( "Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops." );
       
 23229         }
       
 23230       }
       
 23231     }
       
 23232 
       
 23233     {
       
 23234       if (nestedPassiveUpdateCount > NESTED_PASSIVE_UPDATE_LIMIT) {
       
 23235         nestedPassiveUpdateCount = 0;
       
 23236 
       
 23237         error('Maximum update depth exceeded. This can happen when a component ' + "calls setState inside useEffect, but useEffect either doesn't " + 'have a dependency array, or one of the dependencies changes on ' + 'every render.');
       
 23238       }
       
 23239     }
       
 23240   }
       
 23241 
       
 23242   function flushRenderPhaseStrictModeWarningsInDEV() {
       
 23243     {
       
 23244       ReactStrictModeWarnings.flushLegacyContextWarning();
       
 23245 
       
 23246       {
       
 23247         ReactStrictModeWarnings.flushPendingUnsafeLifecycleWarnings();
       
 23248       }
       
 23249     }
       
 23250   }
       
 23251 
       
 23252   function stopFinishedWorkLoopTimer() {
       
 23253     var didCompleteRoot = true;
       
 23254     stopWorkLoopTimer(interruptedBy, didCompleteRoot);
       
 23255     interruptedBy = null;
       
 23256   }
       
 23257 
       
 23258   function stopInterruptedWorkLoopTimer() {
       
 23259     // TODO: Track which fiber caused the interruption.
       
 23260     var didCompleteRoot = false;
       
 23261     stopWorkLoopTimer(interruptedBy, didCompleteRoot);
       
 23262     interruptedBy = null;
       
 23263   }
       
 23264 
       
 23265   function checkForInterruption(fiberThatReceivedUpdate, updateExpirationTime) {
       
 23266     if ( workInProgressRoot !== null && updateExpirationTime > renderExpirationTime$1) {
       
 23267       interruptedBy = fiberThatReceivedUpdate;
       
 23268     }
       
 23269   }
       
 23270 
       
 23271   var didWarnStateUpdateForUnmountedComponent = null;
       
 23272 
       
 23273   function warnAboutUpdateOnUnmountedFiberInDEV(fiber) {
       
 23274     {
       
 23275       var tag = fiber.tag;
       
 23276 
       
 23277       if (tag !== HostRoot && tag !== ClassComponent && tag !== FunctionComponent && tag !== ForwardRef && tag !== MemoComponent && tag !== SimpleMemoComponent && tag !== Block) {
       
 23278         // Only warn for user-defined components, not internal ones like Suspense.
       
 23279         return;
       
 23280       }
       
 23281       // the problematic code almost always lies inside that component.
       
 23282 
       
 23283 
       
 23284       var componentName = getComponentName(fiber.type) || 'ReactComponent';
       
 23285 
       
 23286       if (didWarnStateUpdateForUnmountedComponent !== null) {
       
 23287         if (didWarnStateUpdateForUnmountedComponent.has(componentName)) {
       
 23288           return;
       
 23289         }
       
 23290 
       
 23291         didWarnStateUpdateForUnmountedComponent.add(componentName);
       
 23292       } else {
       
 23293         didWarnStateUpdateForUnmountedComponent = new Set([componentName]);
       
 23294       }
       
 23295 
       
 23296       error("Can't perform a React state update on an unmounted component. This " + 'is a no-op, but it indicates a memory leak in your application. To ' + 'fix, cancel all subscriptions and asynchronous tasks in %s.%s', tag === ClassComponent ? 'the componentWillUnmount method' : 'a useEffect cleanup function', getStackByFiberInDevAndProd(fiber));
       
 23297     }
       
 23298   }
       
 23299 
       
 23300   var beginWork$1;
       
 23301 
       
 23302   {
       
 23303     var dummyFiber = null;
       
 23304 
       
 23305     beginWork$1 = function (current, unitOfWork, expirationTime) {
       
 23306       // If a component throws an error, we replay it again in a synchronously
       
 23307       // dispatched event, so that the debugger will treat it as an uncaught
       
 23308       // error See ReactErrorUtils for more information.
       
 23309       // Before entering the begin phase, copy the work-in-progress onto a dummy
       
 23310       // fiber. If beginWork throws, we'll use this to reset the state.
       
 23311       var originalWorkInProgressCopy = assignFiberPropertiesInDEV(dummyFiber, unitOfWork);
       
 23312 
       
 23313       try {
       
 23314         return beginWork(current, unitOfWork, expirationTime);
       
 23315       } catch (originalError) {
       
 23316         if (originalError !== null && typeof originalError === 'object' && typeof originalError.then === 'function') {
       
 23317           // Don't replay promises. Treat everything else like an error.
       
 23318           throw originalError;
       
 23319         } // Keep this code in sync with handleError; any changes here must have
       
 23320         // corresponding changes there.
       
 23321 
       
 23322 
       
 23323         resetContextDependencies();
       
 23324         resetHooksAfterThrow(); // Don't reset current debug fiber, since we're about to work on the
       
 23325         // same fiber again.
       
 23326         // Unwind the failed stack frame
       
 23327 
       
 23328         unwindInterruptedWork(unitOfWork); // Restore the original properties of the fiber.
       
 23329 
       
 23330         assignFiberPropertiesInDEV(unitOfWork, originalWorkInProgressCopy);
       
 23331 
       
 23332         if ( unitOfWork.mode & ProfileMode) {
       
 23333           // Reset the profiler timer.
       
 23334           startProfilerTimer(unitOfWork);
       
 23335         } // Run beginWork again.
       
 23336 
       
 23337 
       
 23338         invokeGuardedCallback(null, beginWork, null, current, unitOfWork, expirationTime);
       
 23339 
 22693         if (hasCaughtError()) {
 23340         if (hasCaughtError()) {
 22694           (function () {
 23341           var replayError = clearCaughtError(); // `invokeGuardedCallback` sometimes sets an expando `_suppressLogging`.
 22695             if (!(nextEffect !== null)) {
 23342           // Rethrow this error instead of the original one.
 22696               {
 23343 
 22697                 throw ReactError(Error('Should be working on an effect.'));
 23344           throw replayError;
       
 23345         } else {
       
 23346           // This branch is reachable if the render phase is impure.
       
 23347           throw originalError;
       
 23348         }
       
 23349       }
       
 23350     };
       
 23351   }
       
 23352 
       
 23353   var didWarnAboutUpdateInRender = false;
       
 23354   var didWarnAboutUpdateInRenderForAnotherComponent;
       
 23355 
       
 23356   {
       
 23357     didWarnAboutUpdateInRenderForAnotherComponent = new Set();
       
 23358   }
       
 23359 
       
 23360   function warnAboutRenderPhaseUpdatesInDEV(fiber) {
       
 23361     {
       
 23362       if (isRendering && (executionContext & RenderContext) !== NoContext) {
       
 23363         switch (fiber.tag) {
       
 23364           case FunctionComponent:
       
 23365           case ForwardRef:
       
 23366           case SimpleMemoComponent:
       
 23367             {
       
 23368               var renderingComponentName = workInProgress && getComponentName(workInProgress.type) || 'Unknown'; // Dedupe by the rendering component because it's the one that needs to be fixed.
       
 23369 
       
 23370               var dedupeKey = renderingComponentName;
       
 23371 
       
 23372               if (!didWarnAboutUpdateInRenderForAnotherComponent.has(dedupeKey)) {
       
 23373                 didWarnAboutUpdateInRenderForAnotherComponent.add(dedupeKey);
       
 23374                 var setStateComponentName = getComponentName(fiber.type) || 'Unknown';
       
 23375 
       
 23376                 error('Cannot update a component (`%s`) while rendering a ' + 'different component (`%s`). To locate the bad setState() call inside `%s`, ' + 'follow the stack trace as described in https://fb.me/setstate-in-render', setStateComponentName, renderingComponentName, renderingComponentName);
       
 23377               }
       
 23378 
       
 23379               break;
       
 23380             }
       
 23381 
       
 23382           case ClassComponent:
       
 23383             {
       
 23384               if (!didWarnAboutUpdateInRender) {
       
 23385                 error('Cannot update during an existing state transition (such as ' + 'within `render`). Render methods should be a pure ' + 'function of props and state.');
       
 23386 
       
 23387                 didWarnAboutUpdateInRender = true;
       
 23388               }
       
 23389 
       
 23390               break;
       
 23391             }
       
 23392         }
       
 23393       }
       
 23394     }
       
 23395   } // a 'shared' variable that changes when act() opens/closes in tests.
       
 23396 
       
 23397 
       
 23398   var IsThisRendererActing = {
       
 23399     current: false
       
 23400   };
       
 23401   function warnIfNotScopedWithMatchingAct(fiber) {
       
 23402     {
       
 23403       if ( IsSomeRendererActing.current === true && IsThisRendererActing.current !== true) {
       
 23404         error("It looks like you're using the wrong act() around your test interactions.\n" + 'Be sure to use the matching version of act() corresponding to your renderer:\n\n' + '// for react-dom:\n' + "import {act} from 'react-dom/test-utils';\n" + '// ...\n' + 'act(() => ...);\n\n' + '// for react-test-renderer:\n' + "import TestRenderer from 'react-test-renderer';\n" + 'const {act} = TestRenderer;\n' + '// ...\n' + 'act(() => ...);' + '%s', getStackByFiberInDevAndProd(fiber));
       
 23405       }
       
 23406     }
       
 23407   }
       
 23408   function warnIfNotCurrentlyActingEffectsInDEV(fiber) {
       
 23409     {
       
 23410       if ( (fiber.mode & StrictMode) !== NoMode && IsSomeRendererActing.current === false && IsThisRendererActing.current === false) {
       
 23411         error('An update to %s ran an effect, but was not wrapped in act(...).\n\n' + 'When testing, code that causes React state updates should be ' + 'wrapped into act(...):\n\n' + 'act(() => {\n' + '  /* fire events that update state */\n' + '});\n' + '/* assert on the output */\n\n' + "This ensures that you're testing the behavior the user would see " + 'in the browser.' + ' Learn more at https://fb.me/react-wrap-tests-with-act' + '%s', getComponentName(fiber.type), getStackByFiberInDevAndProd(fiber));
       
 23412       }
       
 23413     }
       
 23414   }
       
 23415 
       
 23416   function warnIfNotCurrentlyActingUpdatesInDEV(fiber) {
       
 23417     {
       
 23418       if ( executionContext === NoContext && IsSomeRendererActing.current === false && IsThisRendererActing.current === false) {
       
 23419         error('An update to %s inside a test was not wrapped in act(...).\n\n' + 'When testing, code that causes React state updates should be ' + 'wrapped into act(...):\n\n' + 'act(() => {\n' + '  /* fire events that update state */\n' + '});\n' + '/* assert on the output */\n\n' + "This ensures that you're testing the behavior the user would see " + 'in the browser.' + ' Learn more at https://fb.me/react-wrap-tests-with-act' + '%s', getComponentName(fiber.type), getStackByFiberInDevAndProd(fiber));
       
 23420       }
       
 23421     }
       
 23422   }
       
 23423 
       
 23424   var warnIfNotCurrentlyActingUpdatesInDev = warnIfNotCurrentlyActingUpdatesInDEV; // In tests, we want to enforce a mocked scheduler.
       
 23425 
       
 23426   var didWarnAboutUnmockedScheduler = false; // TODO Before we release concurrent mode, revisit this and decide whether a mocked
       
 23427   // scheduler is the actual recommendation. The alternative could be a testing build,
       
 23428   // a new lib, or whatever; we dunno just yet. This message is for early adopters
       
 23429   // to get their tests right.
       
 23430 
       
 23431   function warnIfUnmockedScheduler(fiber) {
       
 23432     {
       
 23433       if (didWarnAboutUnmockedScheduler === false && unstable_flushAllWithoutAsserting === undefined) {
       
 23434         if (fiber.mode & BlockingMode || fiber.mode & ConcurrentMode) {
       
 23435           didWarnAboutUnmockedScheduler = true;
       
 23436 
       
 23437           error('In Concurrent or Sync modes, the "scheduler" module needs to be mocked ' + 'to guarantee consistent behaviour across tests and browsers. ' + 'For example, with jest: \n' + "jest.mock('scheduler', () => require('scheduler/unstable_mock'));\n\n" + 'For more info, visit https://fb.me/react-mock-scheduler');
       
 23438         }
       
 23439       }
       
 23440     }
       
 23441   }
       
 23442 
       
 23443   function computeThreadID(root, expirationTime) {
       
 23444     // Interaction threads are unique per root and expiration time.
       
 23445     return expirationTime * 1000 + root.interactionThreadID;
       
 23446   }
       
 23447 
       
 23448   function markSpawnedWork(expirationTime) {
       
 23449 
       
 23450     if (spawnedWorkDuringRender === null) {
       
 23451       spawnedWorkDuringRender = [expirationTime];
       
 23452     } else {
       
 23453       spawnedWorkDuringRender.push(expirationTime);
       
 23454     }
       
 23455   }
       
 23456 
       
 23457   function scheduleInteractions(root, expirationTime, interactions) {
       
 23458 
       
 23459     if (interactions.size > 0) {
       
 23460       var pendingInteractionMap = root.pendingInteractionMap;
       
 23461       var pendingInteractions = pendingInteractionMap.get(expirationTime);
       
 23462 
       
 23463       if (pendingInteractions != null) {
       
 23464         interactions.forEach(function (interaction) {
       
 23465           if (!pendingInteractions.has(interaction)) {
       
 23466             // Update the pending async work count for previously unscheduled interaction.
       
 23467             interaction.__count++;
       
 23468           }
       
 23469 
       
 23470           pendingInteractions.add(interaction);
       
 23471         });
       
 23472       } else {
       
 23473         pendingInteractionMap.set(expirationTime, new Set(interactions)); // Update the pending async work count for the current interactions.
       
 23474 
       
 23475         interactions.forEach(function (interaction) {
       
 23476           interaction.__count++;
       
 23477         });
       
 23478       }
       
 23479 
       
 23480       var subscriber = __subscriberRef.current;
       
 23481 
       
 23482       if (subscriber !== null) {
       
 23483         var threadID = computeThreadID(root, expirationTime);
       
 23484         subscriber.onWorkScheduled(interactions, threadID);
       
 23485       }
       
 23486     }
       
 23487   }
       
 23488 
       
 23489   function schedulePendingInteractions(root, expirationTime) {
       
 23490 
       
 23491     scheduleInteractions(root, expirationTime, __interactionsRef.current);
       
 23492   }
       
 23493 
       
 23494   function startWorkOnPendingInteractions(root, expirationTime) {
       
 23495     // we can accurately attribute time spent working on it, And so that cascading
       
 23496     // work triggered during the render phase will be associated with it.
       
 23497 
       
 23498 
       
 23499     var interactions = new Set();
       
 23500     root.pendingInteractionMap.forEach(function (scheduledInteractions, scheduledExpirationTime) {
       
 23501       if (scheduledExpirationTime >= expirationTime) {
       
 23502         scheduledInteractions.forEach(function (interaction) {
       
 23503           return interactions.add(interaction);
       
 23504         });
       
 23505       }
       
 23506     }); // Store the current set of interactions on the FiberRoot for a few reasons:
       
 23507     // We can re-use it in hot functions like performConcurrentWorkOnRoot()
       
 23508     // without having to recalculate it. We will also use it in commitWork() to
       
 23509     // pass to any Profiler onRender() hooks. This also provides DevTools with a
       
 23510     // way to access it when the onCommitRoot() hook is called.
       
 23511 
       
 23512     root.memoizedInteractions = interactions;
       
 23513 
       
 23514     if (interactions.size > 0) {
       
 23515       var subscriber = __subscriberRef.current;
       
 23516 
       
 23517       if (subscriber !== null) {
       
 23518         var threadID = computeThreadID(root, expirationTime);
       
 23519 
       
 23520         try {
       
 23521           subscriber.onWorkStarted(interactions, threadID);
       
 23522         } catch (error) {
       
 23523           // If the subscriber throws, rethrow it in a separate task
       
 23524           scheduleCallback(ImmediatePriority, function () {
       
 23525             throw error;
       
 23526           });
       
 23527         }
       
 23528       }
       
 23529     }
       
 23530   }
       
 23531 
       
 23532   function finishPendingInteractions(root, committedExpirationTime) {
       
 23533 
       
 23534     var earliestRemainingTimeAfterCommit = root.firstPendingTime;
       
 23535     var subscriber;
       
 23536 
       
 23537     try {
       
 23538       subscriber = __subscriberRef.current;
       
 23539 
       
 23540       if (subscriber !== null && root.memoizedInteractions.size > 0) {
       
 23541         var threadID = computeThreadID(root, committedExpirationTime);
       
 23542         subscriber.onWorkStopped(root.memoizedInteractions, threadID);
       
 23543       }
       
 23544     } catch (error) {
       
 23545       // If the subscriber throws, rethrow it in a separate task
       
 23546       scheduleCallback(ImmediatePriority, function () {
       
 23547         throw error;
       
 23548       });
       
 23549     } finally {
       
 23550       // Clear completed interactions from the pending Map.
       
 23551       // Unless the render was suspended or cascading work was scheduled,
       
 23552       // In which case– leave pending interactions until the subsequent render.
       
 23553       var pendingInteractionMap = root.pendingInteractionMap;
       
 23554       pendingInteractionMap.forEach(function (scheduledInteractions, scheduledExpirationTime) {
       
 23555         // Only decrement the pending interaction count if we're done.
       
 23556         // If there's still work at the current priority,
       
 23557         // That indicates that we are waiting for suspense data.
       
 23558         if (scheduledExpirationTime > earliestRemainingTimeAfterCommit) {
       
 23559           pendingInteractionMap.delete(scheduledExpirationTime);
       
 23560           scheduledInteractions.forEach(function (interaction) {
       
 23561             interaction.__count--;
       
 23562 
       
 23563             if (subscriber !== null && interaction.__count === 0) {
       
 23564               try {
       
 23565                 subscriber.onInteractionScheduledWorkCompleted(interaction);
       
 23566               } catch (error) {
       
 23567                 // If the subscriber throws, rethrow it in a separate task
       
 23568                 scheduleCallback(ImmediatePriority, function () {
       
 23569                   throw error;
       
 23570                 });
 22698               }
 23571               }
 22699             }
 23572             }
 22700           })();
 23573           });
 22701           var _error = clearCaughtError();
 23574         }
 22702           captureCommitPhaseError(nextEffect, _error);
 23575       });
 22703           nextEffect = nextEffect.nextEffect;
 23576     }
 22704         }
 23577   }
 22705       }
 23578 
 22706     } while (nextEffect !== null);
 23579   var onScheduleFiberRoot = null;
 22707     stopCommitHostEffectsTimer();
 23580   var onCommitFiberRoot = null;
 22708     resetAfterCommit(root.containerInfo);
 23581   var onCommitFiberUnmount = null;
 22709 
 23582   var hasLoggedError = false;
 22710     // The work-in-progress tree is now the current tree. This must come after
 23583   var isDevToolsPresent = typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined';
 22711     // the mutation phase, so that the previous tree is still current during
 23584   function injectInternals(internals) {
 22712     // componentWillUnmount, but before the layout phase, so that the finished
 23585     if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined') {
 22713     // work is current during componentDidMount/Update.
 23586       // No DevTools
 22714     root.current = finishedWork;
 23587       return false;
 22715 
 23588     }
 22716     // The next phase is the layout phase, where we call effects that read
 23589 
 22717     // the host tree after it's been mutated. The idiomatic use case for this is
 23590     var hook = __REACT_DEVTOOLS_GLOBAL_HOOK__;
 22718     // layout, but class component lifecycles also fire here for legacy reasons.
 23591 
 22719     startCommitLifeCyclesTimer();
 23592     if (hook.isDisabled) {
 22720     nextEffect = firstEffect;
 23593       // This isn't a real property on the hook, but it can be set to opt out
 22721     do {
 23594       // of DevTools integration and associated warnings and logs.
       
 23595       // https://github.com/facebook/react/issues/3877
       
 23596       return true;
       
 23597     }
       
 23598 
       
 23599     if (!hook.supportsFiber) {
 22722       {
 23600       {
 22723         invokeGuardedCallback(null, commitLayoutEffects, null, root, expirationTime);
 23601         error('The installed version of React DevTools is too old and will not work ' + 'with the current version of React. Please update React DevTools. ' + 'https://fb.me/react-devtools');
 22724         if (hasCaughtError()) {
 23602       } // DevTools exists, even though it doesn't support Fiber.
 22725           (function () {
 23603 
 22726             if (!(nextEffect !== null)) {
 23604 
 22727               {
 23605       return true;
 22728                 throw ReactError(Error('Should be working on an effect.'));
 23606     }
       
 23607 
       
 23608     try {
       
 23609       var rendererID = hook.inject(internals); // We have successfully injected, so now it is safe to set up hooks.
       
 23610 
       
 23611       if (true) {
       
 23612         // Only used by Fast Refresh
       
 23613         if (typeof hook.onScheduleFiberRoot === 'function') {
       
 23614           onScheduleFiberRoot = function (root, children) {
       
 23615             try {
       
 23616               hook.onScheduleFiberRoot(rendererID, root, children);
       
 23617             } catch (err) {
       
 23618               if (true && !hasLoggedError) {
       
 23619                 hasLoggedError = true;
       
 23620 
       
 23621                 error('React instrumentation encountered an error: %s', err);
 22729               }
 23622               }
 22730             }
 23623             }
 22731           })();
 23624           };
 22732           var _error2 = clearCaughtError();
 23625         }
 22733           captureCommitPhaseError(nextEffect, _error2);
 23626       }
 22734           nextEffect = nextEffect.nextEffect;
 23627 
 22735         }
 23628       onCommitFiberRoot = function (root, expirationTime) {
 22736       }
 23629         try {
 22737     } while (nextEffect !== null);
 23630           var didError = (root.current.effectTag & DidCapture) === DidCapture;
 22738     stopCommitLifeCyclesTimer();
 23631 
 22739 
 23632           if (enableProfilerTimer) {
 22740     nextEffect = null;
 23633             var currentTime = getCurrentTime();
 22741 
 23634             var priorityLevel = inferPriorityFromExpirationTime(currentTime, expirationTime);
 22742     // Tell Scheduler to yield at the end of the frame, so the browser has an
 23635             hook.onCommitFiberRoot(rendererID, root, priorityLevel, didError);
 22743     // opportunity to paint.
 23636           } else {
 22744     requestPaint();
 23637             hook.onCommitFiberRoot(rendererID, root, undefined, didError);
 22745 
 23638           }
 22746     if (enableSchedulerTracing) {
 23639         } catch (err) {
 22747       __interactionsRef.current = prevInteractions;
 23640           if (true) {
 22748     }
 23641             if (!hasLoggedError) {
 22749     executionContext = prevExecutionContext;
 23642               hasLoggedError = true;
 22750   } else {
 23643 
 22751     // No effects.
 23644               error('React instrumentation encountered an error: %s', err);
 22752     root.current = finishedWork;
       
 22753     // Measure these anyway so the flamegraph explicitly shows that there were
       
 22754     // no effects.
       
 22755     // TODO: Maybe there's a better way to report this.
       
 22756     startCommitSnapshotEffectsTimer();
       
 22757     stopCommitSnapshotEffectsTimer();
       
 22758     if (enableProfilerTimer) {
       
 22759       recordCommitTime();
       
 22760     }
       
 22761     startCommitHostEffectsTimer();
       
 22762     stopCommitHostEffectsTimer();
       
 22763     startCommitLifeCyclesTimer();
       
 22764     stopCommitLifeCyclesTimer();
       
 22765   }
       
 22766 
       
 22767   stopCommitTimer();
       
 22768 
       
 22769   var rootDidHavePassiveEffects = rootDoesHavePassiveEffects;
       
 22770 
       
 22771   if (rootDoesHavePassiveEffects) {
       
 22772     // This commit has passive effects. Stash a reference to them. But don't
       
 22773     // schedule a callback until after flushing layout work.
       
 22774     rootDoesHavePassiveEffects = false;
       
 22775     rootWithPendingPassiveEffects = root;
       
 22776     pendingPassiveEffectsExpirationTime = expirationTime;
       
 22777     pendingPassiveEffectsRenderPriority = renderPriorityLevel;
       
 22778   } else {
       
 22779     // We are done with the effect chain at this point so let's clear the
       
 22780     // nextEffect pointers to assist with GC. If we have passive effects, we'll
       
 22781     // clear this in flushPassiveEffects.
       
 22782     nextEffect = firstEffect;
       
 22783     while (nextEffect !== null) {
       
 22784       var nextNextEffect = nextEffect.nextEffect;
       
 22785       nextEffect.nextEffect = null;
       
 22786       nextEffect = nextNextEffect;
       
 22787     }
       
 22788   }
       
 22789 
       
 22790   // Check if there's remaining work on this root
       
 22791   var remainingExpirationTime = root.firstPendingTime;
       
 22792   if (remainingExpirationTime !== NoWork) {
       
 22793     var currentTime = requestCurrentTime();
       
 22794     var priorityLevel = inferPriorityFromExpirationTime(currentTime, remainingExpirationTime);
       
 22795 
       
 22796     if (enableSchedulerTracing) {
       
 22797       if (spawnedWorkDuringRender !== null) {
       
 22798         var expirationTimes = spawnedWorkDuringRender;
       
 22799         spawnedWorkDuringRender = null;
       
 22800         for (var i = 0; i < expirationTimes.length; i++) {
       
 22801           scheduleInteractions(root, expirationTimes[i], root.memoizedInteractions);
       
 22802         }
       
 22803       }
       
 22804     }
       
 22805 
       
 22806     scheduleCallbackForRoot(root, priorityLevel, remainingExpirationTime);
       
 22807   } else {
       
 22808     // If there's no remaining work, we can clear the set of already failed
       
 22809     // error boundaries.
       
 22810     legacyErrorBoundariesThatAlreadyFailed = null;
       
 22811   }
       
 22812 
       
 22813   if (enableSchedulerTracing) {
       
 22814     if (!rootDidHavePassiveEffects) {
       
 22815       // If there are no passive effects, then we can complete the pending interactions.
       
 22816       // Otherwise, we'll wait until after the passive effects are flushed.
       
 22817       // Wait to do this until after remaining work has been scheduled,
       
 22818       // so that we don't prematurely signal complete for interactions when there's e.g. hidden work.
       
 22819       finishPendingInteractions(root, expirationTime);
       
 22820     }
       
 22821   }
       
 22822 
       
 22823   onCommitRoot(finishedWork.stateNode, expirationTime);
       
 22824 
       
 22825   if (remainingExpirationTime === Sync) {
       
 22826     // Count the number of times the root synchronously re-renders without
       
 22827     // finishing. If there are too many, it indicates an infinite update loop.
       
 22828     if (root === rootWithNestedUpdates) {
       
 22829       nestedUpdateCount++;
       
 22830     } else {
       
 22831       nestedUpdateCount = 0;
       
 22832       rootWithNestedUpdates = root;
       
 22833     }
       
 22834   } else {
       
 22835     nestedUpdateCount = 0;
       
 22836   }
       
 22837 
       
 22838   if (hasUncaughtError) {
       
 22839     hasUncaughtError = false;
       
 22840     var _error3 = firstUncaughtError;
       
 22841     firstUncaughtError = null;
       
 22842     throw _error3;
       
 22843   }
       
 22844 
       
 22845   if ((executionContext & LegacyUnbatchedContext) !== NoContext) {
       
 22846     // This is a legacy edge case. We just committed the initial mount of
       
 22847     // a ReactDOM.render-ed root inside of batchedUpdates. The commit fired
       
 22848     // synchronously, but layout updates should be deferred until the end
       
 22849     // of the batch.
       
 22850     return null;
       
 22851   }
       
 22852 
       
 22853   // If layout work was scheduled, flush it now.
       
 22854   flushSyncCallbackQueue();
       
 22855   return null;
       
 22856 }
       
 22857 
       
 22858 function commitBeforeMutationEffects() {
       
 22859   while (nextEffect !== null) {
       
 22860     if ((nextEffect.effectTag & Snapshot) !== NoEffect) {
       
 22861       setCurrentFiber(nextEffect);
       
 22862       recordEffect();
       
 22863 
       
 22864       var current$$1 = nextEffect.alternate;
       
 22865       commitBeforeMutationLifeCycles(current$$1, nextEffect);
       
 22866 
       
 22867       resetCurrentFiber();
       
 22868     }
       
 22869     nextEffect = nextEffect.nextEffect;
       
 22870   }
       
 22871 }
       
 22872 
       
 22873 function commitMutationEffects(renderPriorityLevel) {
       
 22874   // TODO: Should probably move the bulk of this function to commitWork.
       
 22875   while (nextEffect !== null) {
       
 22876     setCurrentFiber(nextEffect);
       
 22877 
       
 22878     var effectTag = nextEffect.effectTag;
       
 22879 
       
 22880     if (effectTag & ContentReset) {
       
 22881       commitResetTextContent(nextEffect);
       
 22882     }
       
 22883 
       
 22884     if (effectTag & Ref) {
       
 22885       var current$$1 = nextEffect.alternate;
       
 22886       if (current$$1 !== null) {
       
 22887         commitDetachRef(current$$1);
       
 22888       }
       
 22889     }
       
 22890 
       
 22891     // The following switch statement is only concerned about placement,
       
 22892     // updates, and deletions. To avoid needing to add a case for every possible
       
 22893     // bitmap value, we remove the secondary effects from the effect tag and
       
 22894     // switch on that value.
       
 22895     var primaryEffectTag = effectTag & (Placement | Update | Deletion);
       
 22896     switch (primaryEffectTag) {
       
 22897       case Placement:
       
 22898         {
       
 22899           commitPlacement(nextEffect);
       
 22900           // Clear the "placement" from effect tag so that we know that this is
       
 22901           // inserted, before any life-cycles like componentDidMount gets called.
       
 22902           // TODO: findDOMNode doesn't rely on this any more but isMounted does
       
 22903           // and isMounted is deprecated anyway so we should be able to kill this.
       
 22904           nextEffect.effectTag &= ~Placement;
       
 22905           break;
       
 22906         }
       
 22907       case PlacementAndUpdate:
       
 22908         {
       
 22909           // Placement
       
 22910           commitPlacement(nextEffect);
       
 22911           // Clear the "placement" from effect tag so that we know that this is
       
 22912           // inserted, before any life-cycles like componentDidMount gets called.
       
 22913           nextEffect.effectTag &= ~Placement;
       
 22914 
       
 22915           // Update
       
 22916           var _current = nextEffect.alternate;
       
 22917           commitWork(_current, nextEffect);
       
 22918           break;
       
 22919         }
       
 22920       case Update:
       
 22921         {
       
 22922           var _current2 = nextEffect.alternate;
       
 22923           commitWork(_current2, nextEffect);
       
 22924           break;
       
 22925         }
       
 22926       case Deletion:
       
 22927         {
       
 22928           commitDeletion(nextEffect, renderPriorityLevel);
       
 22929           break;
       
 22930         }
       
 22931     }
       
 22932 
       
 22933     // TODO: Only record a mutation effect if primaryEffectTag is non-zero.
       
 22934     recordEffect();
       
 22935 
       
 22936     resetCurrentFiber();
       
 22937     nextEffect = nextEffect.nextEffect;
       
 22938   }
       
 22939 }
       
 22940 
       
 22941 function commitLayoutEffects(root, committedExpirationTime) {
       
 22942   // TODO: Should probably move the bulk of this function to commitWork.
       
 22943   while (nextEffect !== null) {
       
 22944     setCurrentFiber(nextEffect);
       
 22945 
       
 22946     var effectTag = nextEffect.effectTag;
       
 22947 
       
 22948     if (effectTag & (Update | Callback)) {
       
 22949       recordEffect();
       
 22950       var current$$1 = nextEffect.alternate;
       
 22951       commitLifeCycles(root, current$$1, nextEffect, committedExpirationTime);
       
 22952     }
       
 22953 
       
 22954     if (effectTag & Ref) {
       
 22955       recordEffect();
       
 22956       commitAttachRef(nextEffect);
       
 22957     }
       
 22958 
       
 22959     if (effectTag & Passive) {
       
 22960       rootDoesHavePassiveEffects = true;
       
 22961     }
       
 22962 
       
 22963     resetCurrentFiber();
       
 22964     nextEffect = nextEffect.nextEffect;
       
 22965   }
       
 22966 }
       
 22967 
       
 22968 function flushPassiveEffects() {
       
 22969   if (rootWithPendingPassiveEffects === null) {
       
 22970     return false;
       
 22971   }
       
 22972   var root = rootWithPendingPassiveEffects;
       
 22973   var expirationTime = pendingPassiveEffectsExpirationTime;
       
 22974   var renderPriorityLevel = pendingPassiveEffectsRenderPriority;
       
 22975   rootWithPendingPassiveEffects = null;
       
 22976   pendingPassiveEffectsExpirationTime = NoWork;
       
 22977   pendingPassiveEffectsRenderPriority = NoPriority;
       
 22978   var priorityLevel = renderPriorityLevel > NormalPriority ? NormalPriority : renderPriorityLevel;
       
 22979   return runWithPriority$2(priorityLevel, flushPassiveEffectsImpl.bind(null, root, expirationTime));
       
 22980 }
       
 22981 
       
 22982 function flushPassiveEffectsImpl(root, expirationTime) {
       
 22983   var prevInteractions = null;
       
 22984   if (enableSchedulerTracing) {
       
 22985     prevInteractions = __interactionsRef.current;
       
 22986     __interactionsRef.current = root.memoizedInteractions;
       
 22987   }
       
 22988 
       
 22989   (function () {
       
 22990     if (!((executionContext & (RenderContext | CommitContext)) === NoContext)) {
       
 22991       {
       
 22992         throw ReactError(Error('Cannot flush passive effects while already rendering.'));
       
 22993       }
       
 22994     }
       
 22995   })();
       
 22996   var prevExecutionContext = executionContext;
       
 22997   executionContext |= CommitContext;
       
 22998 
       
 22999   // Note: This currently assumes there are no passive effects on the root
       
 23000   // fiber, because the root is not part of its own effect list. This could
       
 23001   // change in the future.
       
 23002   var effect = root.current.firstEffect;
       
 23003   while (effect !== null) {
       
 23004     {
       
 23005       setCurrentFiber(effect);
       
 23006       invokeGuardedCallback(null, commitPassiveHookEffects, null, effect);
       
 23007       if (hasCaughtError()) {
       
 23008         (function () {
       
 23009           if (!(effect !== null)) {
       
 23010             {
       
 23011               throw ReactError(Error('Should be working on an effect.'));
       
 23012             }
 23645             }
 23013           }
 23646           }
 23014         })();
 23647         }
 23015         var error = clearCaughtError();
 23648       };
 23016         captureCommitPhaseError(effect, error);
 23649 
 23017       }
 23650       onCommitFiberUnmount = function (fiber) {
 23018       resetCurrentFiber();
 23651         try {
 23019     }
 23652           hook.onCommitFiberUnmount(rendererID, fiber);
 23020     var nextNextEffect = effect.nextEffect;
 23653         } catch (err) {
 23021     // Remove nextEffect pointer to assist GC
 23654           if (true) {
 23022     effect.nextEffect = null;
 23655             if (!hasLoggedError) {
 23023     effect = nextNextEffect;
 23656               hasLoggedError = true;
 23024   }
 23657 
 23025 
 23658               error('React instrumentation encountered an error: %s', err);
 23026   if (enableSchedulerTracing) {
       
 23027     __interactionsRef.current = prevInteractions;
       
 23028     finishPendingInteractions(root, expirationTime);
       
 23029   }
       
 23030 
       
 23031   executionContext = prevExecutionContext;
       
 23032   flushSyncCallbackQueue();
       
 23033 
       
 23034   // If additional passive effects were scheduled, increment a counter. If this
       
 23035   // exceeds the limit, we'll fire a warning.
       
 23036   nestedPassiveUpdateCount = rootWithPendingPassiveEffects === null ? 0 : nestedPassiveUpdateCount + 1;
       
 23037 
       
 23038   return true;
       
 23039 }
       
 23040 
       
 23041 function isAlreadyFailedLegacyErrorBoundary(instance) {
       
 23042   return legacyErrorBoundariesThatAlreadyFailed !== null && legacyErrorBoundariesThatAlreadyFailed.has(instance);
       
 23043 }
       
 23044 
       
 23045 function markLegacyErrorBoundaryAsFailed(instance) {
       
 23046   if (legacyErrorBoundariesThatAlreadyFailed === null) {
       
 23047     legacyErrorBoundariesThatAlreadyFailed = new Set([instance]);
       
 23048   } else {
       
 23049     legacyErrorBoundariesThatAlreadyFailed.add(instance);
       
 23050   }
       
 23051 }
       
 23052 
       
 23053 function prepareToThrowUncaughtError(error) {
       
 23054   if (!hasUncaughtError) {
       
 23055     hasUncaughtError = true;
       
 23056     firstUncaughtError = error;
       
 23057   }
       
 23058 }
       
 23059 var onUncaughtError = prepareToThrowUncaughtError;
       
 23060 
       
 23061 function captureCommitPhaseErrorOnRoot(rootFiber, sourceFiber, error) {
       
 23062   var errorInfo = createCapturedValue(error, sourceFiber);
       
 23063   var update = createRootErrorUpdate(rootFiber, errorInfo, Sync);
       
 23064   enqueueUpdate(rootFiber, update);
       
 23065   var root = markUpdateTimeFromFiberToRoot(rootFiber, Sync);
       
 23066   if (root !== null) {
       
 23067     scheduleCallbackForRoot(root, ImmediatePriority, Sync);
       
 23068   }
       
 23069 }
       
 23070 
       
 23071 function captureCommitPhaseError(sourceFiber, error) {
       
 23072   if (sourceFiber.tag === HostRoot) {
       
 23073     // Error was thrown at the root. There is no parent, so the root
       
 23074     // itself should capture it.
       
 23075     captureCommitPhaseErrorOnRoot(sourceFiber, sourceFiber, error);
       
 23076     return;
       
 23077   }
       
 23078 
       
 23079   var fiber = sourceFiber.return;
       
 23080   while (fiber !== null) {
       
 23081     if (fiber.tag === HostRoot) {
       
 23082       captureCommitPhaseErrorOnRoot(fiber, sourceFiber, error);
       
 23083       return;
       
 23084     } else if (fiber.tag === ClassComponent) {
       
 23085       var ctor = fiber.type;
       
 23086       var instance = fiber.stateNode;
       
 23087       if (typeof ctor.getDerivedStateFromError === 'function' || typeof instance.componentDidCatch === 'function' && !isAlreadyFailedLegacyErrorBoundary(instance)) {
       
 23088         var errorInfo = createCapturedValue(error, sourceFiber);
       
 23089         var update = createClassErrorUpdate(fiber, errorInfo,
       
 23090         // TODO: This is always sync
       
 23091         Sync);
       
 23092         enqueueUpdate(fiber, update);
       
 23093         var root = markUpdateTimeFromFiberToRoot(fiber, Sync);
       
 23094         if (root !== null) {
       
 23095           scheduleCallbackForRoot(root, ImmediatePriority, Sync);
       
 23096         }
       
 23097         return;
       
 23098       }
       
 23099     }
       
 23100     fiber = fiber.return;
       
 23101   }
       
 23102 }
       
 23103 
       
 23104 function pingSuspendedRoot(root, thenable, suspendedTime) {
       
 23105   var pingCache = root.pingCache;
       
 23106   if (pingCache !== null) {
       
 23107     // The thenable resolved, so we no longer need to memoize, because it will
       
 23108     // never be thrown again.
       
 23109     pingCache.delete(thenable);
       
 23110   }
       
 23111 
       
 23112   if (workInProgressRoot === root && renderExpirationTime === suspendedTime) {
       
 23113     // Received a ping at the same priority level at which we're currently
       
 23114     // rendering. We might want to restart this render. This should mirror
       
 23115     // the logic of whether or not a root suspends once it completes.
       
 23116 
       
 23117     // TODO: If we're rendering sync either due to Sync, Batched or expired,
       
 23118     // we should probably never restart.
       
 23119 
       
 23120     // If we're suspended with delay, we'll always suspend so we can always
       
 23121     // restart. If we're suspended without any updates, it might be a retry.
       
 23122     // If it's early in the retry we can restart. We can't know for sure
       
 23123     // whether we'll eventually process an update during this render pass,
       
 23124     // but it's somewhat unlikely that we get to a ping before that, since
       
 23125     // getting to the root most update is usually very fast.
       
 23126     if (workInProgressRootExitStatus === RootSuspendedWithDelay || workInProgressRootExitStatus === RootSuspended && workInProgressRootLatestProcessedExpirationTime === Sync && now() - globalMostRecentFallbackTime < FALLBACK_THROTTLE_MS) {
       
 23127       // Restart from the root. Don't need to schedule a ping because
       
 23128       // we're already working on this tree.
       
 23129       prepareFreshStack(root, renderExpirationTime);
       
 23130     } else {
       
 23131       // Even though we can't restart right now, we might get an
       
 23132       // opportunity later. So we mark this render as having a ping.
       
 23133       workInProgressRootHasPendingPing = true;
       
 23134     }
       
 23135     return;
       
 23136   }
       
 23137 
       
 23138   var lastPendingTime = root.lastPendingTime;
       
 23139   if (lastPendingTime < suspendedTime) {
       
 23140     // The root is no longer suspended at this time.
       
 23141     return;
       
 23142   }
       
 23143 
       
 23144   var pingTime = root.pingTime;
       
 23145   if (pingTime !== NoWork && pingTime < suspendedTime) {
       
 23146     // There's already a lower priority ping scheduled.
       
 23147     return;
       
 23148   }
       
 23149 
       
 23150   // Mark the time at which this ping was scheduled.
       
 23151   root.pingTime = suspendedTime;
       
 23152 
       
 23153   if (root.finishedExpirationTime === suspendedTime) {
       
 23154     // If there's a pending fallback waiting to commit, throw it away.
       
 23155     root.finishedExpirationTime = NoWork;
       
 23156     root.finishedWork = null;
       
 23157   }
       
 23158 
       
 23159   var currentTime = requestCurrentTime();
       
 23160   var priorityLevel = inferPriorityFromExpirationTime(currentTime, suspendedTime);
       
 23161   scheduleCallbackForRoot(root, priorityLevel, suspendedTime);
       
 23162 }
       
 23163 
       
 23164 function retryTimedOutBoundary(boundaryFiber) {
       
 23165   // The boundary fiber (a Suspense component or SuspenseList component)
       
 23166   // previously was rendered in its fallback state. One of the promises that
       
 23167   // suspended it has resolved, which means at least part of the tree was
       
 23168   // likely unblocked. Try rendering again, at a new expiration time.
       
 23169   var currentTime = requestCurrentTime();
       
 23170   var suspenseConfig = null; // Retries don't carry over the already committed update.
       
 23171   var retryTime = computeExpirationForFiber(currentTime, boundaryFiber, suspenseConfig);
       
 23172   // TODO: Special case idle priority?
       
 23173   var priorityLevel = inferPriorityFromExpirationTime(currentTime, retryTime);
       
 23174   var root = markUpdateTimeFromFiberToRoot(boundaryFiber, retryTime);
       
 23175   if (root !== null) {
       
 23176     scheduleCallbackForRoot(root, priorityLevel, retryTime);
       
 23177   }
       
 23178 }
       
 23179 
       
 23180 function resolveRetryThenable(boundaryFiber, thenable) {
       
 23181   var retryCache = void 0;
       
 23182   if (enableSuspenseServerRenderer) {
       
 23183     switch (boundaryFiber.tag) {
       
 23184       case SuspenseComponent:
       
 23185         retryCache = boundaryFiber.stateNode;
       
 23186         break;
       
 23187       case DehydratedSuspenseComponent:
       
 23188         retryCache = boundaryFiber.memoizedState;
       
 23189         break;
       
 23190       default:
       
 23191         (function () {
       
 23192           {
       
 23193             {
       
 23194               throw ReactError(Error('Pinged unknown suspense boundary type. This is probably a bug in React.'));
       
 23195             }
 23659             }
 23196           }
 23660           }
 23197         })();
 23661         }
 23198     }
 23662       };
 23199   } else {
 23663     } catch (err) {
 23200     retryCache = boundaryFiber.stateNode;
 23664       // Catch all errors because it is unsafe to throw during initialization.
 23201   }
       
 23202 
       
 23203   if (retryCache !== null) {
       
 23204     // The thenable resolved, so we no longer need to memoize, because it will
       
 23205     // never be thrown again.
       
 23206     retryCache.delete(thenable);
       
 23207   }
       
 23208 
       
 23209   retryTimedOutBoundary(boundaryFiber);
       
 23210 }
       
 23211 
       
 23212 // Computes the next Just Noticeable Difference (JND) boundary.
       
 23213 // The theory is that a person can't tell the difference between small differences in time.
       
 23214 // Therefore, if we wait a bit longer than necessary that won't translate to a noticeable
       
 23215 // difference in the experience. However, waiting for longer might mean that we can avoid
       
 23216 // showing an intermediate loading state. The longer we have already waited, the harder it
       
 23217 // is to tell small differences in time. Therefore, the longer we've already waited,
       
 23218 // the longer we can wait additionally. At some point we have to give up though.
       
 23219 // We pick a train model where the next boundary commits at a consistent schedule.
       
 23220 // These particular numbers are vague estimates. We expect to adjust them based on research.
       
 23221 function jnd(timeElapsed) {
       
 23222   return timeElapsed < 120 ? 120 : timeElapsed < 480 ? 480 : timeElapsed < 1080 ? 1080 : timeElapsed < 1920 ? 1920 : timeElapsed < 3000 ? 3000 : timeElapsed < 4320 ? 4320 : ceil(timeElapsed / 1960) * 1960;
       
 23223 }
       
 23224 
       
 23225 function computeMsUntilSuspenseLoadingDelay(mostRecentEventTime, committedExpirationTime, suspenseConfig) {
       
 23226   var busyMinDurationMs = suspenseConfig.busyMinDurationMs | 0;
       
 23227   if (busyMinDurationMs <= 0) {
       
 23228     return 0;
       
 23229   }
       
 23230   var busyDelayMs = suspenseConfig.busyDelayMs | 0;
       
 23231 
       
 23232   // Compute the time until this render pass would expire.
       
 23233   var currentTimeMs = now();
       
 23234   var eventTimeMs = inferTimeFromExpirationTimeWithSuspenseConfig(mostRecentEventTime, suspenseConfig);
       
 23235   var timeElapsed = currentTimeMs - eventTimeMs;
       
 23236   if (timeElapsed <= busyDelayMs) {
       
 23237     // If we haven't yet waited longer than the initial delay, we don't
       
 23238     // have to wait any additional time.
       
 23239     return 0;
       
 23240   }
       
 23241   var msUntilTimeout = busyDelayMs + busyMinDurationMs - timeElapsed;
       
 23242   // This is the value that is passed to `setTimeout`.
       
 23243   return msUntilTimeout;
       
 23244 }
       
 23245 
       
 23246 function checkForNestedUpdates() {
       
 23247   if (nestedUpdateCount > NESTED_UPDATE_LIMIT) {
       
 23248     nestedUpdateCount = 0;
       
 23249     rootWithNestedUpdates = null;
       
 23250     (function () {
       
 23251       {
 23665       {
       
 23666         error('React instrumentation encountered an error: %s.', err);
       
 23667       }
       
 23668     } // DevTools exists
       
 23669 
       
 23670 
       
 23671     return true;
       
 23672   }
       
 23673   function onScheduleRoot(root, children) {
       
 23674     if (typeof onScheduleFiberRoot === 'function') {
       
 23675       onScheduleFiberRoot(root, children);
       
 23676     }
       
 23677   }
       
 23678   function onCommitRoot(root, expirationTime) {
       
 23679     if (typeof onCommitFiberRoot === 'function') {
       
 23680       onCommitFiberRoot(root, expirationTime);
       
 23681     }
       
 23682   }
       
 23683   function onCommitUnmount(fiber) {
       
 23684     if (typeof onCommitFiberUnmount === 'function') {
       
 23685       onCommitFiberUnmount(fiber);
       
 23686     }
       
 23687   }
       
 23688 
       
 23689   var hasBadMapPolyfill;
       
 23690 
       
 23691   {
       
 23692     hasBadMapPolyfill = false;
       
 23693 
       
 23694     try {
       
 23695       var nonExtensibleObject = Object.preventExtensions({});
       
 23696       var testMap = new Map([[nonExtensibleObject, null]]);
       
 23697       var testSet = new Set([nonExtensibleObject]); // This is necessary for Rollup to not consider these unused.
       
 23698       // https://github.com/rollup/rollup/issues/1771
       
 23699       // TODO: we can remove these if Rollup fixes the bug.
       
 23700 
       
 23701       testMap.set(0, 0);
       
 23702       testSet.add(0);
       
 23703     } catch (e) {
       
 23704       // TODO: Consider warning about bad polyfills
       
 23705       hasBadMapPolyfill = true;
       
 23706     }
       
 23707   }
       
 23708 
       
 23709   var debugCounter = 1;
       
 23710 
       
 23711   function FiberNode(tag, pendingProps, key, mode) {
       
 23712     // Instance
       
 23713     this.tag = tag;
       
 23714     this.key = key;
       
 23715     this.elementType = null;
       
 23716     this.type = null;
       
 23717     this.stateNode = null; // Fiber
       
 23718 
       
 23719     this.return = null;
       
 23720     this.child = null;
       
 23721     this.sibling = null;
       
 23722     this.index = 0;
       
 23723     this.ref = null;
       
 23724     this.pendingProps = pendingProps;
       
 23725     this.memoizedProps = null;
       
 23726     this.updateQueue = null;
       
 23727     this.memoizedState = null;
       
 23728     this.dependencies = null;
       
 23729     this.mode = mode; // Effects
       
 23730 
       
 23731     this.effectTag = NoEffect;
       
 23732     this.nextEffect = null;
       
 23733     this.firstEffect = null;
       
 23734     this.lastEffect = null;
       
 23735     this.expirationTime = NoWork;
       
 23736     this.childExpirationTime = NoWork;
       
 23737     this.alternate = null;
       
 23738 
       
 23739     {
       
 23740       // Note: The following is done to avoid a v8 performance cliff.
       
 23741       //
       
 23742       // Initializing the fields below to smis and later updating them with
       
 23743       // double values will cause Fibers to end up having separate shapes.
       
 23744       // This behavior/bug has something to do with Object.preventExtension().
       
 23745       // Fortunately this only impacts DEV builds.
       
 23746       // Unfortunately it makes React unusably slow for some applications.
       
 23747       // To work around this, initialize the fields below with doubles.
       
 23748       //
       
 23749       // Learn more about this here:
       
 23750       // https://github.com/facebook/react/issues/14365
       
 23751       // https://bugs.chromium.org/p/v8/issues/detail?id=8538
       
 23752       this.actualDuration = Number.NaN;
       
 23753       this.actualStartTime = Number.NaN;
       
 23754       this.selfBaseDuration = Number.NaN;
       
 23755       this.treeBaseDuration = Number.NaN; // It's okay to replace the initial doubles with smis after initialization.
       
 23756       // This won't trigger the performance cliff mentioned above,
       
 23757       // and it simplifies other profiler code (including DevTools).
       
 23758 
       
 23759       this.actualDuration = 0;
       
 23760       this.actualStartTime = -1;
       
 23761       this.selfBaseDuration = 0;
       
 23762       this.treeBaseDuration = 0;
       
 23763     } // This is normally DEV-only except www when it adds listeners.
       
 23764     // TODO: remove the User Timing integration in favor of Root Events.
       
 23765 
       
 23766 
       
 23767     {
       
 23768       this._debugID = debugCounter++;
       
 23769       this._debugIsCurrentlyTiming = false;
       
 23770     }
       
 23771 
       
 23772     {
       
 23773       this._debugSource = null;
       
 23774       this._debugOwner = null;
       
 23775       this._debugNeedsRemount = false;
       
 23776       this._debugHookTypes = null;
       
 23777 
       
 23778       if (!hasBadMapPolyfill && typeof Object.preventExtensions === 'function') {
       
 23779         Object.preventExtensions(this);
       
 23780       }
       
 23781     }
       
 23782   } // This is a constructor function, rather than a POJO constructor, still
       
 23783   // please ensure we do the following:
       
 23784   // 1) Nobody should add any instance methods on this. Instance methods can be
       
 23785   //    more difficult to predict when they get optimized and they are almost
       
 23786   //    never inlined properly in static compilers.
       
 23787   // 2) Nobody should rely on `instanceof Fiber` for type testing. We should
       
 23788   //    always know when it is a fiber.
       
 23789   // 3) We might want to experiment with using numeric keys since they are easier
       
 23790   //    to optimize in a non-JIT environment.
       
 23791   // 4) We can easily go from a constructor to a createFiber object literal if that
       
 23792   //    is faster.
       
 23793   // 5) It should be easy to port this to a C struct and keep a C implementation
       
 23794   //    compatible.
       
 23795 
       
 23796 
       
 23797   var createFiber = function (tag, pendingProps, key, mode) {
       
 23798     // $FlowFixMe: the shapes are exact here but Flow doesn't like constructors
       
 23799     return new FiberNode(tag, pendingProps, key, mode);
       
 23800   };
       
 23801 
       
 23802   function shouldConstruct(Component) {
       
 23803     var prototype = Component.prototype;
       
 23804     return !!(prototype && prototype.isReactComponent);
       
 23805   }
       
 23806 
       
 23807   function isSimpleFunctionComponent(type) {
       
 23808     return typeof type === 'function' && !shouldConstruct(type) && type.defaultProps === undefined;
       
 23809   }
       
 23810   function resolveLazyComponentTag(Component) {
       
 23811     if (typeof Component === 'function') {
       
 23812       return shouldConstruct(Component) ? ClassComponent : FunctionComponent;
       
 23813     } else if (Component !== undefined && Component !== null) {
       
 23814       var $$typeof = Component.$$typeof;
       
 23815 
       
 23816       if ($$typeof === REACT_FORWARD_REF_TYPE) {
       
 23817         return ForwardRef;
       
 23818       }
       
 23819 
       
 23820       if ($$typeof === REACT_MEMO_TYPE) {
       
 23821         return MemoComponent;
       
 23822       }
       
 23823     }
       
 23824 
       
 23825     return IndeterminateComponent;
       
 23826   } // This is used to create an alternate fiber to do work on.
       
 23827 
       
 23828   function createWorkInProgress(current, pendingProps) {
       
 23829     var workInProgress = current.alternate;
       
 23830 
       
 23831     if (workInProgress === null) {
       
 23832       // We use a double buffering pooling technique because we know that we'll
       
 23833       // only ever need at most two versions of a tree. We pool the "other" unused
       
 23834       // node that we're free to reuse. This is lazily created to avoid allocating
       
 23835       // extra objects for things that are never updated. It also allow us to
       
 23836       // reclaim the extra memory if needed.
       
 23837       workInProgress = createFiber(current.tag, pendingProps, current.key, current.mode);
       
 23838       workInProgress.elementType = current.elementType;
       
 23839       workInProgress.type = current.type;
       
 23840       workInProgress.stateNode = current.stateNode;
       
 23841 
       
 23842       {
       
 23843         // DEV-only fields
 23252         {
 23844         {
 23253           throw ReactError(Error('Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops.'));
 23845           workInProgress._debugID = current._debugID;
 23254         }
 23846         }
 23255       }
 23847 
 23256     })();
 23848         workInProgress._debugSource = current._debugSource;
 23257   }
 23849         workInProgress._debugOwner = current._debugOwner;
 23258 
 23850         workInProgress._debugHookTypes = current._debugHookTypes;
 23259   {
 23851       }
 23260     if (nestedPassiveUpdateCount > NESTED_PASSIVE_UPDATE_LIMIT) {
 23852 
 23261       nestedPassiveUpdateCount = 0;
 23853       workInProgress.alternate = current;
 23262       warning$1(false, 'Maximum update depth exceeded. This can happen when a component ' + "calls setState inside useEffect, but useEffect either doesn't " + 'have a dependency array, or one of the dependencies changes on ' + 'every render.');
 23854       current.alternate = workInProgress;
 23263     }
       
 23264   }
       
 23265 }
       
 23266 
       
 23267 function flushRenderPhaseStrictModeWarningsInDEV() {
       
 23268   {
       
 23269     ReactStrictModeWarnings.flushLegacyContextWarning();
       
 23270 
       
 23271     if (warnAboutDeprecatedLifecycles) {
       
 23272       ReactStrictModeWarnings.flushPendingUnsafeLifecycleWarnings();
       
 23273     }
       
 23274   }
       
 23275 }
       
 23276 
       
 23277 function stopFinishedWorkLoopTimer() {
       
 23278   var didCompleteRoot = true;
       
 23279   stopWorkLoopTimer(interruptedBy, didCompleteRoot);
       
 23280   interruptedBy = null;
       
 23281 }
       
 23282 
       
 23283 function stopInterruptedWorkLoopTimer() {
       
 23284   // TODO: Track which fiber caused the interruption.
       
 23285   var didCompleteRoot = false;
       
 23286   stopWorkLoopTimer(interruptedBy, didCompleteRoot);
       
 23287   interruptedBy = null;
       
 23288 }
       
 23289 
       
 23290 function checkForInterruption(fiberThatReceivedUpdate, updateExpirationTime) {
       
 23291   if (enableUserTimingAPI && workInProgressRoot !== null && updateExpirationTime > renderExpirationTime) {
       
 23292     interruptedBy = fiberThatReceivedUpdate;
       
 23293   }
       
 23294 }
       
 23295 
       
 23296 var didWarnStateUpdateForUnmountedComponent = null;
       
 23297 function warnAboutUpdateOnUnmountedFiberInDEV(fiber) {
       
 23298   {
       
 23299     var tag = fiber.tag;
       
 23300     if (tag !== HostRoot && tag !== ClassComponent && tag !== FunctionComponent && tag !== ForwardRef && tag !== MemoComponent && tag !== SimpleMemoComponent) {
       
 23301       // Only warn for user-defined components, not internal ones like Suspense.
       
 23302       return;
       
 23303     }
       
 23304     // We show the whole stack but dedupe on the top component's name because
       
 23305     // the problematic code almost always lies inside that component.
       
 23306     var componentName = getComponentName(fiber.type) || 'ReactComponent';
       
 23307     if (didWarnStateUpdateForUnmountedComponent !== null) {
       
 23308       if (didWarnStateUpdateForUnmountedComponent.has(componentName)) {
       
 23309         return;
       
 23310       }
       
 23311       didWarnStateUpdateForUnmountedComponent.add(componentName);
       
 23312     } else {
 23855     } else {
 23313       didWarnStateUpdateForUnmountedComponent = new Set([componentName]);
 23856       workInProgress.pendingProps = pendingProps; // We already have an alternate.
 23314     }
 23857       // Reset the effect tag.
 23315     warningWithoutStack$1(false, "Can't perform a React state update on an unmounted component. This " + 'is a no-op, but it indicates a memory leak in your application. To ' + 'fix, cancel all subscriptions and asynchronous tasks in %s.%s', tag === ClassComponent ? 'the componentWillUnmount method' : 'a useEffect cleanup function', getStackByFiberInDevAndProd(fiber));
 23858 
 23316   }
 23859       workInProgress.effectTag = NoEffect; // The effect list is no longer valid.
 23317 }
 23860 
 23318 
 23861       workInProgress.nextEffect = null;
 23319 var beginWork$$1 = void 0;
 23862       workInProgress.firstEffect = null;
 23320 if (true && replayFailedUnitOfWorkWithInvokeGuardedCallback) {
 23863       workInProgress.lastEffect = null;
 23321   var dummyFiber = null;
 23864 
 23322   beginWork$$1 = function (current$$1, unitOfWork, expirationTime) {
 23865       {
 23323     // If a component throws an error, we replay it again in a synchronously
 23866         // We intentionally reset, rather than copy, actualDuration & actualStartTime.
 23324     // dispatched event, so that the debugger will treat it as an uncaught
 23867         // This prevents time from endlessly accumulating in new commits.
 23325     // error See ReactErrorUtils for more information.
 23868         // This has the downside of resetting values for different priority renders,
 23326 
 23869         // But works for yielding (the common case) and should support resuming.
 23327     // Before entering the begin phase, copy the work-in-progress onto a dummy
 23870         workInProgress.actualDuration = 0;
 23328     // fiber. If beginWork throws, we'll use this to reset the state.
 23871         workInProgress.actualStartTime = -1;
 23329     var originalWorkInProgressCopy = assignFiberPropertiesInDEV(dummyFiber, unitOfWork);
 23872       }
 23330     try {
 23873     }
 23331       return beginWork$1(current$$1, unitOfWork, expirationTime);
 23874 
 23332     } catch (originalError) {
       
 23333       if (originalError !== null && typeof originalError === 'object' && typeof originalError.then === 'function') {
       
 23334         // Don't replay promises. Treat everything else like an error.
       
 23335         throw originalError;
       
 23336       }
       
 23337 
       
 23338       // Keep this code in sync with renderRoot; any changes here must have
       
 23339       // corresponding changes there.
       
 23340       resetContextDependencies();
       
 23341       resetHooks();
       
 23342 
       
 23343       // Unwind the failed stack frame
       
 23344       unwindInterruptedWork(unitOfWork);
       
 23345 
       
 23346       // Restore the original properties of the fiber.
       
 23347       assignFiberPropertiesInDEV(unitOfWork, originalWorkInProgressCopy);
       
 23348 
       
 23349       if (enableProfilerTimer && unitOfWork.mode & ProfileMode) {
       
 23350         // Reset the profiler timer.
       
 23351         startProfilerTimer(unitOfWork);
       
 23352       }
       
 23353 
       
 23354       // Run beginWork again.
       
 23355       invokeGuardedCallback(null, beginWork$1, null, current$$1, unitOfWork, expirationTime);
       
 23356 
       
 23357       if (hasCaughtError()) {
       
 23358         var replayError = clearCaughtError();
       
 23359         // `invokeGuardedCallback` sometimes sets an expando `_suppressLogging`.
       
 23360         // Rethrow this error instead of the original one.
       
 23361         throw replayError;
       
 23362       } else {
       
 23363         // This branch is reachable if the render phase is impure.
       
 23364         throw originalError;
       
 23365       }
       
 23366     }
       
 23367   };
       
 23368 } else {
       
 23369   beginWork$$1 = beginWork$1;
       
 23370 }
       
 23371 
       
 23372 var didWarnAboutUpdateInRender = false;
       
 23373 var didWarnAboutUpdateInGetChildContext = false;
       
 23374 function warnAboutInvalidUpdatesOnClassComponentsInDEV(fiber) {
       
 23375   {
       
 23376     if (fiber.tag === ClassComponent) {
       
 23377       switch (phase) {
       
 23378         case 'getChildContext':
       
 23379           if (didWarnAboutUpdateInGetChildContext) {
       
 23380             return;
       
 23381           }
       
 23382           warningWithoutStack$1(false, 'setState(...): Cannot call setState() inside getChildContext()');
       
 23383           didWarnAboutUpdateInGetChildContext = true;
       
 23384           break;
       
 23385         case 'render':
       
 23386           if (didWarnAboutUpdateInRender) {
       
 23387             return;
       
 23388           }
       
 23389           warningWithoutStack$1(false, 'Cannot update during an existing state transition (such as ' + 'within `render`). Render methods should be a pure function of ' + 'props and state.');
       
 23390           didWarnAboutUpdateInRender = true;
       
 23391           break;
       
 23392       }
       
 23393     }
       
 23394   }
       
 23395 }
       
 23396 
       
 23397 // a 'shared' variable that changes when act() opens/closes in tests.
       
 23398 var IsThisRendererActing = { current: false };
       
 23399 
       
 23400 function warnIfNotScopedWithMatchingAct(fiber) {
       
 23401   {
       
 23402     if (warnsIfNotActing === true && IsSomeRendererActing.current === true && IsThisRendererActing.current !== true) {
       
 23403       warningWithoutStack$1(false, "It looks like you're using the wrong act() around your test interactions.\n" + 'Be sure to use the matching version of act() corresponding to your renderer:\n\n' + '// for react-dom:\n' + "import {act} from 'react-dom/test-utils';\n" + '//...\n' + 'act(() => ...);\n\n' + '// for react-test-renderer:\n' + "import TestRenderer from 'react-test-renderer';\n" + 'const {act} = TestRenderer;\n' + '//...\n' + 'act(() => ...);' + '%s', getStackByFiberInDevAndProd(fiber));
       
 23404     }
       
 23405   }
       
 23406 }
       
 23407 
       
 23408 function warnIfNotCurrentlyActingEffectsInDEV(fiber) {
       
 23409   {
       
 23410     if (warnsIfNotActing === true && (fiber.mode & StrictMode) !== NoMode && IsSomeRendererActing.current === false && IsThisRendererActing.current === false) {
       
 23411       warningWithoutStack$1(false, 'An update to %s ran an effect, but was not wrapped in act(...).\n\n' + 'When testing, code that causes React state updates should be ' + 'wrapped into act(...):\n\n' + 'act(() => {\n' + '  /* fire events that update state */\n' + '});\n' + '/* assert on the output */\n\n' + "This ensures that you're testing the behavior the user would see " + 'in the browser.' + ' Learn more at https://fb.me/react-wrap-tests-with-act' + '%s', getComponentName(fiber.type), getStackByFiberInDevAndProd(fiber));
       
 23412     }
       
 23413   }
       
 23414 }
       
 23415 
       
 23416 function warnIfNotCurrentlyActingUpdatesInDEV(fiber) {
       
 23417   {
       
 23418     if (warnsIfNotActing === true && executionContext === NoContext && IsSomeRendererActing.current === false && IsThisRendererActing.current === false) {
       
 23419       warningWithoutStack$1(false, 'An update to %s inside a test was not wrapped in act(...).\n\n' + 'When testing, code that causes React state updates should be ' + 'wrapped into act(...):\n\n' + 'act(() => {\n' + '  /* fire events that update state */\n' + '});\n' + '/* assert on the output */\n\n' + "This ensures that you're testing the behavior the user would see " + 'in the browser.' + ' Learn more at https://fb.me/react-wrap-tests-with-act' + '%s', getComponentName(fiber.type), getStackByFiberInDevAndProd(fiber));
       
 23420     }
       
 23421   }
       
 23422 }
       
 23423 
       
 23424 var warnIfNotCurrentlyActingUpdatesInDev = warnIfNotCurrentlyActingUpdatesInDEV;
       
 23425 
       
 23426 // In tests, we want to enforce a mocked scheduler.
       
 23427 var didWarnAboutUnmockedScheduler = false;
       
 23428 // TODO Before we release concurrent mode, revisit this and decide whether a mocked
       
 23429 // scheduler is the actual recommendation. The alternative could be a testing build,
       
 23430 // a new lib, or whatever; we dunno just yet. This message is for early adopters
       
 23431 // to get their tests right.
       
 23432 
       
 23433 function warnIfUnmockedScheduler(fiber) {
       
 23434   {
       
 23435     if (didWarnAboutUnmockedScheduler === false && unstable_flushAllWithoutAsserting === undefined) {
       
 23436       if (fiber.mode & BatchedMode || fiber.mode & ConcurrentMode) {
       
 23437         didWarnAboutUnmockedScheduler = true;
       
 23438         warningWithoutStack$1(false, 'In Concurrent or Sync modes, the "scheduler" module needs to be mocked ' + 'to guarantee consistent behaviour across tests and browsers. ' + 'For example, with jest: \n' + "jest.mock('scheduler', () => require('scheduler/unstable_mock'));\n\n" + 'For more info, visit https://fb.me/react-mock-scheduler');
       
 23439       } else if (warnAboutUnmockedScheduler === true) {
       
 23440         didWarnAboutUnmockedScheduler = true;
       
 23441         warningWithoutStack$1(false, 'Starting from React v17, the "scheduler" module will need to be mocked ' + 'to guarantee consistent behaviour across tests and browsers. ' + 'For example, with jest: \n' + "jest.mock('scheduler', () => require('scheduler/unstable_mock'));\n\n" + 'For more info, visit https://fb.me/react-mock-scheduler');
       
 23442       }
       
 23443     }
       
 23444   }
       
 23445 }
       
 23446 
       
 23447 var componentsThatTriggeredHighPriSuspend = null;
       
 23448 function checkForWrongSuspensePriorityInDEV(sourceFiber) {
       
 23449   {
       
 23450     var currentPriorityLevel = getCurrentPriorityLevel();
       
 23451     if ((sourceFiber.mode & ConcurrentMode) !== NoEffect && (currentPriorityLevel === UserBlockingPriority$2 || currentPriorityLevel === ImmediatePriority)) {
       
 23452       var workInProgressNode = sourceFiber;
       
 23453       while (workInProgressNode !== null) {
       
 23454         // Add the component that triggered the suspense
       
 23455         var current$$1 = workInProgressNode.alternate;
       
 23456         if (current$$1 !== null) {
       
 23457           // TODO: warn component that triggers the high priority
       
 23458           // suspend is the HostRoot
       
 23459           switch (workInProgressNode.tag) {
       
 23460             case ClassComponent:
       
 23461               // Loop through the component's update queue and see whether the component
       
 23462               // has triggered any high priority updates
       
 23463               var updateQueue = current$$1.updateQueue;
       
 23464               if (updateQueue !== null) {
       
 23465                 var update = updateQueue.firstUpdate;
       
 23466                 while (update !== null) {
       
 23467                   var priorityLevel = update.priority;
       
 23468                   if (priorityLevel === UserBlockingPriority$2 || priorityLevel === ImmediatePriority) {
       
 23469                     if (componentsThatTriggeredHighPriSuspend === null) {
       
 23470                       componentsThatTriggeredHighPriSuspend = new Set([getComponentName(workInProgressNode.type)]);
       
 23471                     } else {
       
 23472                       componentsThatTriggeredHighPriSuspend.add(getComponentName(workInProgressNode.type));
       
 23473                     }
       
 23474                     break;
       
 23475                   }
       
 23476                   update = update.next;
       
 23477                 }
       
 23478               }
       
 23479               break;
       
 23480             case FunctionComponent:
       
 23481             case ForwardRef:
       
 23482             case SimpleMemoComponent:
       
 23483               if (workInProgressNode.memoizedState !== null && workInProgressNode.memoizedState.baseUpdate !== null) {
       
 23484                 var _update = workInProgressNode.memoizedState.baseUpdate;
       
 23485                 // Loop through the functional component's memoized state to see whether
       
 23486                 // the component has triggered any high pri updates
       
 23487                 while (_update !== null) {
       
 23488                   var priority = _update.priority;
       
 23489                   if (priority === UserBlockingPriority$2 || priority === ImmediatePriority) {
       
 23490                     if (componentsThatTriggeredHighPriSuspend === null) {
       
 23491                       componentsThatTriggeredHighPriSuspend = new Set([getComponentName(workInProgressNode.type)]);
       
 23492                     } else {
       
 23493                       componentsThatTriggeredHighPriSuspend.add(getComponentName(workInProgressNode.type));
       
 23494                     }
       
 23495                     break;
       
 23496                   }
       
 23497                   if (_update.next === workInProgressNode.memoizedState.baseUpdate) {
       
 23498                     break;
       
 23499                   }
       
 23500                   _update = _update.next;
       
 23501                 }
       
 23502               }
       
 23503               break;
       
 23504             default:
       
 23505               break;
       
 23506           }
       
 23507         }
       
 23508         workInProgressNode = workInProgressNode.return;
       
 23509       }
       
 23510     }
       
 23511   }
       
 23512 }
       
 23513 
       
 23514 function flushSuspensePriorityWarningInDEV() {
       
 23515   {
       
 23516     if (componentsThatTriggeredHighPriSuspend !== null) {
       
 23517       var componentNames = [];
       
 23518       componentsThatTriggeredHighPriSuspend.forEach(function (name) {
       
 23519         return componentNames.push(name);
       
 23520       });
       
 23521       componentsThatTriggeredHighPriSuspend = null;
       
 23522 
       
 23523       if (componentNames.length > 0) {
       
 23524         warningWithoutStack$1(false, '%s triggered a user-blocking update that suspended.' + '\n\n' + 'The fix is to split the update into multiple parts: a user-blocking ' + 'update to provide immediate feedback, and another update that ' + 'triggers the bulk of the changes.' + '\n\n' + 'Refer to the documentation for useSuspenseTransition to learn how ' + 'to implement this pattern.',
       
 23525         // TODO: Add link to React docs with more information, once it exists
       
 23526         componentNames.sort().join(', '));
       
 23527       }
       
 23528     }
       
 23529   }
       
 23530 }
       
 23531 
       
 23532 function computeThreadID(root, expirationTime) {
       
 23533   // Interaction threads are unique per root and expiration time.
       
 23534   return expirationTime * 1000 + root.interactionThreadID;
       
 23535 }
       
 23536 
       
 23537 function markSpawnedWork(expirationTime) {
       
 23538   if (!enableSchedulerTracing) {
       
 23539     return;
       
 23540   }
       
 23541   if (spawnedWorkDuringRender === null) {
       
 23542     spawnedWorkDuringRender = [expirationTime];
       
 23543   } else {
       
 23544     spawnedWorkDuringRender.push(expirationTime);
       
 23545   }
       
 23546 }
       
 23547 
       
 23548 function scheduleInteractions(root, expirationTime, interactions) {
       
 23549   if (!enableSchedulerTracing) {
       
 23550     return;
       
 23551   }
       
 23552 
       
 23553   if (interactions.size > 0) {
       
 23554     var pendingInteractionMap = root.pendingInteractionMap;
       
 23555     var pendingInteractions = pendingInteractionMap.get(expirationTime);
       
 23556     if (pendingInteractions != null) {
       
 23557       interactions.forEach(function (interaction) {
       
 23558         if (!pendingInteractions.has(interaction)) {
       
 23559           // Update the pending async work count for previously unscheduled interaction.
       
 23560           interaction.__count++;
       
 23561         }
       
 23562 
       
 23563         pendingInteractions.add(interaction);
       
 23564       });
       
 23565     } else {
       
 23566       pendingInteractionMap.set(expirationTime, new Set(interactions));
       
 23567 
       
 23568       // Update the pending async work count for the current interactions.
       
 23569       interactions.forEach(function (interaction) {
       
 23570         interaction.__count++;
       
 23571       });
       
 23572     }
       
 23573 
       
 23574     var subscriber = __subscriberRef.current;
       
 23575     if (subscriber !== null) {
       
 23576       var threadID = computeThreadID(root, expirationTime);
       
 23577       subscriber.onWorkScheduled(interactions, threadID);
       
 23578     }
       
 23579   }
       
 23580 }
       
 23581 
       
 23582 function schedulePendingInteractions(root, expirationTime) {
       
 23583   // This is called when work is scheduled on a root.
       
 23584   // It associates the current interactions with the newly-scheduled expiration.
       
 23585   // They will be restored when that expiration is later committed.
       
 23586   if (!enableSchedulerTracing) {
       
 23587     return;
       
 23588   }
       
 23589 
       
 23590   scheduleInteractions(root, expirationTime, __interactionsRef.current);
       
 23591 }
       
 23592 
       
 23593 function startWorkOnPendingInteractions(root, expirationTime) {
       
 23594   // This is called when new work is started on a root.
       
 23595   if (!enableSchedulerTracing) {
       
 23596     return;
       
 23597   }
       
 23598 
       
 23599   // Determine which interactions this batch of work currently includes, So that
       
 23600   // we can accurately attribute time spent working on it, And so that cascading
       
 23601   // work triggered during the render phase will be associated with it.
       
 23602   var interactions = new Set();
       
 23603   root.pendingInteractionMap.forEach(function (scheduledInteractions, scheduledExpirationTime) {
       
 23604     if (scheduledExpirationTime >= expirationTime) {
       
 23605       scheduledInteractions.forEach(function (interaction) {
       
 23606         return interactions.add(interaction);
       
 23607       });
       
 23608     }
       
 23609   });
       
 23610 
       
 23611   // Store the current set of interactions on the FiberRoot for a few reasons:
       
 23612   // We can re-use it in hot functions like renderRoot() without having to
       
 23613   // recalculate it. We will also use it in commitWork() to pass to any Profiler
       
 23614   // onRender() hooks. This also provides DevTools with a way to access it when
       
 23615   // the onCommitRoot() hook is called.
       
 23616   root.memoizedInteractions = interactions;
       
 23617 
       
 23618   if (interactions.size > 0) {
       
 23619     var subscriber = __subscriberRef.current;
       
 23620     if (subscriber !== null) {
       
 23621       var threadID = computeThreadID(root, expirationTime);
       
 23622       try {
       
 23623         subscriber.onWorkStarted(interactions, threadID);
       
 23624       } catch (error) {
       
 23625         // If the subscriber throws, rethrow it in a separate task
       
 23626         scheduleCallback(ImmediatePriority, function () {
       
 23627           throw error;
       
 23628         });
       
 23629       }
       
 23630     }
       
 23631   }
       
 23632 }
       
 23633 
       
 23634 function finishPendingInteractions(root, committedExpirationTime) {
       
 23635   if (!enableSchedulerTracing) {
       
 23636     return;
       
 23637   }
       
 23638 
       
 23639   var earliestRemainingTimeAfterCommit = root.firstPendingTime;
       
 23640 
       
 23641   var subscriber = void 0;
       
 23642 
       
 23643   try {
       
 23644     subscriber = __subscriberRef.current;
       
 23645     if (subscriber !== null && root.memoizedInteractions.size > 0) {
       
 23646       var threadID = computeThreadID(root, committedExpirationTime);
       
 23647       subscriber.onWorkStopped(root.memoizedInteractions, threadID);
       
 23648     }
       
 23649   } catch (error) {
       
 23650     // If the subscriber throws, rethrow it in a separate task
       
 23651     scheduleCallback(ImmediatePriority, function () {
       
 23652       throw error;
       
 23653     });
       
 23654   } finally {
       
 23655     // Clear completed interactions from the pending Map.
       
 23656     // Unless the render was suspended or cascading work was scheduled,
       
 23657     // In which case– leave pending interactions until the subsequent render.
       
 23658     var pendingInteractionMap = root.pendingInteractionMap;
       
 23659     pendingInteractionMap.forEach(function (scheduledInteractions, scheduledExpirationTime) {
       
 23660       // Only decrement the pending interaction count if we're done.
       
 23661       // If there's still work at the current priority,
       
 23662       // That indicates that we are waiting for suspense data.
       
 23663       if (scheduledExpirationTime > earliestRemainingTimeAfterCommit) {
       
 23664         pendingInteractionMap.delete(scheduledExpirationTime);
       
 23665 
       
 23666         scheduledInteractions.forEach(function (interaction) {
       
 23667           interaction.__count--;
       
 23668 
       
 23669           if (subscriber !== null && interaction.__count === 0) {
       
 23670             try {
       
 23671               subscriber.onInteractionScheduledWorkCompleted(interaction);
       
 23672             } catch (error) {
       
 23673               // If the subscriber throws, rethrow it in a separate task
       
 23674               scheduleCallback(ImmediatePriority, function () {
       
 23675                 throw error;
       
 23676               });
       
 23677             }
       
 23678           }
       
 23679         });
       
 23680       }
       
 23681     });
       
 23682   }
       
 23683 }
       
 23684 
       
 23685 var onCommitFiberRoot = null;
       
 23686 var onCommitFiberUnmount = null;
       
 23687 var hasLoggedError = false;
       
 23688 
       
 23689 var isDevToolsPresent = typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined';
       
 23690 
       
 23691 function injectInternals(internals) {
       
 23692   if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined') {
       
 23693     // No DevTools
       
 23694     return false;
       
 23695   }
       
 23696   var hook = __REACT_DEVTOOLS_GLOBAL_HOOK__;
       
 23697   if (hook.isDisabled) {
       
 23698     // This isn't a real property on the hook, but it can be set to opt out
       
 23699     // of DevTools integration and associated warnings and logs.
       
 23700     // https://github.com/facebook/react/issues/3877
       
 23701     return true;
       
 23702   }
       
 23703   if (!hook.supportsFiber) {
       
 23704     {
       
 23705       warningWithoutStack$1(false, 'The installed version of React DevTools is too old and will not work ' + 'with the current version of React. Please update React DevTools. ' + 'https://fb.me/react-devtools');
       
 23706     }
       
 23707     // DevTools exists, even though it doesn't support Fiber.
       
 23708     return true;
       
 23709   }
       
 23710   try {
       
 23711     var rendererID = hook.inject(internals);
       
 23712     // We have successfully injected, so now it is safe to set up hooks.
       
 23713     onCommitFiberRoot = function (root, expirationTime) {
       
 23714       try {
       
 23715         var didError = (root.current.effectTag & DidCapture) === DidCapture;
       
 23716         if (enableProfilerTimer) {
       
 23717           var currentTime = requestCurrentTime();
       
 23718           var priorityLevel = inferPriorityFromExpirationTime(currentTime, expirationTime);
       
 23719           hook.onCommitFiberRoot(rendererID, root, priorityLevel, didError);
       
 23720         } else {
       
 23721           hook.onCommitFiberRoot(rendererID, root, undefined, didError);
       
 23722         }
       
 23723       } catch (err) {
       
 23724         if (true && !hasLoggedError) {
       
 23725           hasLoggedError = true;
       
 23726           warningWithoutStack$1(false, 'React DevTools encountered an error: %s', err);
       
 23727         }
       
 23728       }
       
 23729     };
       
 23730     onCommitFiberUnmount = function (fiber) {
       
 23731       try {
       
 23732         hook.onCommitFiberUnmount(rendererID, fiber);
       
 23733       } catch (err) {
       
 23734         if (true && !hasLoggedError) {
       
 23735           hasLoggedError = true;
       
 23736           warningWithoutStack$1(false, 'React DevTools encountered an error: %s', err);
       
 23737         }
       
 23738       }
       
 23739     };
       
 23740   } catch (err) {
       
 23741     // Catch all errors because it is unsafe to throw during initialization.
       
 23742     {
       
 23743       warningWithoutStack$1(false, 'React DevTools encountered an error: %s.', err);
       
 23744     }
       
 23745   }
       
 23746   // DevTools exists
       
 23747   return true;
       
 23748 }
       
 23749 
       
 23750 function onCommitRoot(root, expirationTime) {
       
 23751   if (typeof onCommitFiberRoot === 'function') {
       
 23752     onCommitFiberRoot(root, expirationTime);
       
 23753   }
       
 23754 }
       
 23755 
       
 23756 function onCommitUnmount(fiber) {
       
 23757   if (typeof onCommitFiberUnmount === 'function') {
       
 23758     onCommitFiberUnmount(fiber);
       
 23759   }
       
 23760 }
       
 23761 
       
 23762 var hasBadMapPolyfill = void 0;
       
 23763 
       
 23764 {
       
 23765   hasBadMapPolyfill = false;
       
 23766   try {
       
 23767     var nonExtensibleObject = Object.preventExtensions({});
       
 23768     var testMap = new Map([[nonExtensibleObject, null]]);
       
 23769     var testSet = new Set([nonExtensibleObject]);
       
 23770     // This is necessary for Rollup to not consider these unused.
       
 23771     // https://github.com/rollup/rollup/issues/1771
       
 23772     // TODO: we can remove these if Rollup fixes the bug.
       
 23773     testMap.set(0, 0);
       
 23774     testSet.add(0);
       
 23775   } catch (e) {
       
 23776     // TODO: Consider warning about bad polyfills
       
 23777     hasBadMapPolyfill = true;
       
 23778   }
       
 23779 }
       
 23780 
       
 23781 // A Fiber is work on a Component that needs to be done or was done. There can
       
 23782 // be more than one per component.
       
 23783 
       
 23784 
       
 23785 var debugCounter = void 0;
       
 23786 
       
 23787 {
       
 23788   debugCounter = 1;
       
 23789 }
       
 23790 
       
 23791 function FiberNode(tag, pendingProps, key, mode) {
       
 23792   // Instance
       
 23793   this.tag = tag;
       
 23794   this.key = key;
       
 23795   this.elementType = null;
       
 23796   this.type = null;
       
 23797   this.stateNode = null;
       
 23798 
       
 23799   // Fiber
       
 23800   this.return = null;
       
 23801   this.child = null;
       
 23802   this.sibling = null;
       
 23803   this.index = 0;
       
 23804 
       
 23805   this.ref = null;
       
 23806 
       
 23807   this.pendingProps = pendingProps;
       
 23808   this.memoizedProps = null;
       
 23809   this.updateQueue = null;
       
 23810   this.memoizedState = null;
       
 23811   this.dependencies = null;
       
 23812 
       
 23813   this.mode = mode;
       
 23814 
       
 23815   // Effects
       
 23816   this.effectTag = NoEffect;
       
 23817   this.nextEffect = null;
       
 23818 
       
 23819   this.firstEffect = null;
       
 23820   this.lastEffect = null;
       
 23821 
       
 23822   this.expirationTime = NoWork;
       
 23823   this.childExpirationTime = NoWork;
       
 23824 
       
 23825   this.alternate = null;
       
 23826 
       
 23827   if (enableProfilerTimer) {
       
 23828     // Note: The following is done to avoid a v8 performance cliff.
       
 23829     //
       
 23830     // Initializing the fields below to smis and later updating them with
       
 23831     // double values will cause Fibers to end up having separate shapes.
       
 23832     // This behavior/bug has something to do with Object.preventExtension().
       
 23833     // Fortunately this only impacts DEV builds.
       
 23834     // Unfortunately it makes React unusably slow for some applications.
       
 23835     // To work around this, initialize the fields below with doubles.
       
 23836     //
       
 23837     // Learn more about this here:
       
 23838     // https://github.com/facebook/react/issues/14365
       
 23839     // https://bugs.chromium.org/p/v8/issues/detail?id=8538
       
 23840     this.actualDuration = Number.NaN;
       
 23841     this.actualStartTime = Number.NaN;
       
 23842     this.selfBaseDuration = Number.NaN;
       
 23843     this.treeBaseDuration = Number.NaN;
       
 23844 
       
 23845     // It's okay to replace the initial doubles with smis after initialization.
       
 23846     // This won't trigger the performance cliff mentioned above,
       
 23847     // and it simplifies other profiler code (including DevTools).
       
 23848     this.actualDuration = 0;
       
 23849     this.actualStartTime = -1;
       
 23850     this.selfBaseDuration = 0;
       
 23851     this.treeBaseDuration = 0;
       
 23852   }
       
 23853 
       
 23854   {
       
 23855     this._debugID = debugCounter++;
       
 23856     this._debugSource = null;
       
 23857     this._debugOwner = null;
       
 23858     this._debugIsCurrentlyTiming = false;
       
 23859     this._debugNeedsRemount = false;
       
 23860     this._debugHookTypes = null;
       
 23861     if (!hasBadMapPolyfill && typeof Object.preventExtensions === 'function') {
       
 23862       Object.preventExtensions(this);
       
 23863     }
       
 23864   }
       
 23865 }
       
 23866 
       
 23867 // This is a constructor function, rather than a POJO constructor, still
       
 23868 // please ensure we do the following:
       
 23869 // 1) Nobody should add any instance methods on this. Instance methods can be
       
 23870 //    more difficult to predict when they get optimized and they are almost
       
 23871 //    never inlined properly in static compilers.
       
 23872 // 2) Nobody should rely on `instanceof Fiber` for type testing. We should
       
 23873 //    always know when it is a fiber.
       
 23874 // 3) We might want to experiment with using numeric keys since they are easier
       
 23875 //    to optimize in a non-JIT environment.
       
 23876 // 4) We can easily go from a constructor to a createFiber object literal if that
       
 23877 //    is faster.
       
 23878 // 5) It should be easy to port this to a C struct and keep a C implementation
       
 23879 //    compatible.
       
 23880 var createFiber = function (tag, pendingProps, key, mode) {
       
 23881   // $FlowFixMe: the shapes are exact here but Flow doesn't like constructors
       
 23882   return new FiberNode(tag, pendingProps, key, mode);
       
 23883 };
       
 23884 
       
 23885 function shouldConstruct(Component) {
       
 23886   var prototype = Component.prototype;
       
 23887   return !!(prototype && prototype.isReactComponent);
       
 23888 }
       
 23889 
       
 23890 function isSimpleFunctionComponent(type) {
       
 23891   return typeof type === 'function' && !shouldConstruct(type) && type.defaultProps === undefined;
       
 23892 }
       
 23893 
       
 23894 function resolveLazyComponentTag(Component) {
       
 23895   if (typeof Component === 'function') {
       
 23896     return shouldConstruct(Component) ? ClassComponent : FunctionComponent;
       
 23897   } else if (Component !== undefined && Component !== null) {
       
 23898     var $$typeof = Component.$$typeof;
       
 23899     if ($$typeof === REACT_FORWARD_REF_TYPE) {
       
 23900       return ForwardRef;
       
 23901     }
       
 23902     if ($$typeof === REACT_MEMO_TYPE) {
       
 23903       return MemoComponent;
       
 23904     }
       
 23905   }
       
 23906   return IndeterminateComponent;
       
 23907 }
       
 23908 
       
 23909 // This is used to create an alternate fiber to do work on.
       
 23910 function createWorkInProgress(current, pendingProps, expirationTime) {
       
 23911   var workInProgress = current.alternate;
       
 23912   if (workInProgress === null) {
       
 23913     // We use a double buffering pooling technique because we know that we'll
       
 23914     // only ever need at most two versions of a tree. We pool the "other" unused
       
 23915     // node that we're free to reuse. This is lazily created to avoid allocating
       
 23916     // extra objects for things that are never updated. It also allow us to
       
 23917     // reclaim the extra memory if needed.
       
 23918     workInProgress = createFiber(current.tag, pendingProps, current.key, current.mode);
       
 23919     workInProgress.elementType = current.elementType;
       
 23920     workInProgress.type = current.type;
       
 23921     workInProgress.stateNode = current.stateNode;
       
 23922 
       
 23923     {
       
 23924       // DEV-only fields
       
 23925       workInProgress._debugID = current._debugID;
       
 23926       workInProgress._debugSource = current._debugSource;
       
 23927       workInProgress._debugOwner = current._debugOwner;
       
 23928       workInProgress._debugHookTypes = current._debugHookTypes;
       
 23929     }
       
 23930 
       
 23931     workInProgress.alternate = current;
       
 23932     current.alternate = workInProgress;
       
 23933   } else {
       
 23934     workInProgress.pendingProps = pendingProps;
       
 23935 
       
 23936     // We already have an alternate.
       
 23937     // Reset the effect tag.
       
 23938     workInProgress.effectTag = NoEffect;
       
 23939 
       
 23940     // The effect list is no longer valid.
       
 23941     workInProgress.nextEffect = null;
       
 23942     workInProgress.firstEffect = null;
       
 23943     workInProgress.lastEffect = null;
       
 23944 
       
 23945     if (enableProfilerTimer) {
       
 23946       // We intentionally reset, rather than copy, actualDuration & actualStartTime.
       
 23947       // This prevents time from endlessly accumulating in new commits.
       
 23948       // This has the downside of resetting values for different priority renders,
       
 23949       // But works for yielding (the common case) and should support resuming.
       
 23950       workInProgress.actualDuration = 0;
       
 23951       workInProgress.actualStartTime = -1;
       
 23952     }
       
 23953   }
       
 23954 
       
 23955   workInProgress.childExpirationTime = current.childExpirationTime;
       
 23956   workInProgress.expirationTime = current.expirationTime;
       
 23957 
       
 23958   workInProgress.child = current.child;
       
 23959   workInProgress.memoizedProps = current.memoizedProps;
       
 23960   workInProgress.memoizedState = current.memoizedState;
       
 23961   workInProgress.updateQueue = current.updateQueue;
       
 23962 
       
 23963   // Clone the dependencies object. This is mutated during the render phase, so
       
 23964   // it cannot be shared with the current fiber.
       
 23965   var currentDependencies = current.dependencies;
       
 23966   workInProgress.dependencies = currentDependencies === null ? null : {
       
 23967     expirationTime: currentDependencies.expirationTime,
       
 23968     firstContext: currentDependencies.firstContext,
       
 23969     responders: currentDependencies.responders
       
 23970   };
       
 23971 
       
 23972   // These will be overridden during the parent's reconciliation
       
 23973   workInProgress.sibling = current.sibling;
       
 23974   workInProgress.index = current.index;
       
 23975   workInProgress.ref = current.ref;
       
 23976 
       
 23977   if (enableProfilerTimer) {
       
 23978     workInProgress.selfBaseDuration = current.selfBaseDuration;
       
 23979     workInProgress.treeBaseDuration = current.treeBaseDuration;
       
 23980   }
       
 23981 
       
 23982   {
       
 23983     workInProgress._debugNeedsRemount = current._debugNeedsRemount;
       
 23984     switch (workInProgress.tag) {
       
 23985       case IndeterminateComponent:
       
 23986       case FunctionComponent:
       
 23987       case SimpleMemoComponent:
       
 23988         workInProgress.type = resolveFunctionForHotReloading(current.type);
       
 23989         break;
       
 23990       case ClassComponent:
       
 23991         workInProgress.type = resolveClassForHotReloading(current.type);
       
 23992         break;
       
 23993       case ForwardRef:
       
 23994         workInProgress.type = resolveForwardRefForHotReloading(current.type);
       
 23995         break;
       
 23996       default:
       
 23997         break;
       
 23998     }
       
 23999   }
       
 24000 
       
 24001   return workInProgress;
       
 24002 }
       
 24003 
       
 24004 // Used to reuse a Fiber for a second pass.
       
 24005 function resetWorkInProgress(workInProgress, renderExpirationTime) {
       
 24006   // This resets the Fiber to what createFiber or createWorkInProgress would
       
 24007   // have set the values to before during the first pass. Ideally this wouldn't
       
 24008   // be necessary but unfortunately many code paths reads from the workInProgress
       
 24009   // when they should be reading from current and writing to workInProgress.
       
 24010 
       
 24011   // We assume pendingProps, index, key, ref, return are still untouched to
       
 24012   // avoid doing another reconciliation.
       
 24013 
       
 24014   // Reset the effect tag but keep any Placement tags, since that's something
       
 24015   // that child fiber is setting, not the reconciliation.
       
 24016   workInProgress.effectTag &= Placement;
       
 24017 
       
 24018   // The effect list is no longer valid.
       
 24019   workInProgress.nextEffect = null;
       
 24020   workInProgress.firstEffect = null;
       
 24021   workInProgress.lastEffect = null;
       
 24022 
       
 24023   var current = workInProgress.alternate;
       
 24024   if (current === null) {
       
 24025     // Reset to createFiber's initial values.
       
 24026     workInProgress.childExpirationTime = NoWork;
       
 24027     workInProgress.expirationTime = renderExpirationTime;
       
 24028 
       
 24029     workInProgress.child = null;
       
 24030     workInProgress.memoizedProps = null;
       
 24031     workInProgress.memoizedState = null;
       
 24032     workInProgress.updateQueue = null;
       
 24033 
       
 24034     workInProgress.dependencies = null;
       
 24035 
       
 24036     if (enableProfilerTimer) {
       
 24037       // Note: We don't reset the actualTime counts. It's useful to accumulate
       
 24038       // actual time across multiple render passes.
       
 24039       workInProgress.selfBaseDuration = 0;
       
 24040       workInProgress.treeBaseDuration = 0;
       
 24041     }
       
 24042   } else {
       
 24043     // Reset to the cloned values that createWorkInProgress would've.
       
 24044     workInProgress.childExpirationTime = current.childExpirationTime;
 23875     workInProgress.childExpirationTime = current.childExpirationTime;
 24045     workInProgress.expirationTime = current.expirationTime;
 23876     workInProgress.expirationTime = current.expirationTime;
 24046 
       
 24047     workInProgress.child = current.child;
 23877     workInProgress.child = current.child;
 24048     workInProgress.memoizedProps = current.memoizedProps;
 23878     workInProgress.memoizedProps = current.memoizedProps;
 24049     workInProgress.memoizedState = current.memoizedState;
 23879     workInProgress.memoizedState = current.memoizedState;
 24050     workInProgress.updateQueue = current.updateQueue;
 23880     workInProgress.updateQueue = current.updateQueue; // Clone the dependencies object. This is mutated during the render phase, so
 24051 
       
 24052     // Clone the dependencies object. This is mutated during the render phase, so
       
 24053     // it cannot be shared with the current fiber.
 23881     // it cannot be shared with the current fiber.
       
 23882 
 24054     var currentDependencies = current.dependencies;
 23883     var currentDependencies = current.dependencies;
 24055     workInProgress.dependencies = currentDependencies === null ? null : {
 23884     workInProgress.dependencies = currentDependencies === null ? null : {
 24056       expirationTime: currentDependencies.expirationTime,
 23885       expirationTime: currentDependencies.expirationTime,
 24057       firstContext: currentDependencies.firstContext,
 23886       firstContext: currentDependencies.firstContext,
 24058       responders: currentDependencies.responders
 23887       responders: currentDependencies.responders
 24059     };
 23888     }; // These will be overridden during the parent's reconciliation
 24060 
 23889 
 24061     if (enableProfilerTimer) {
 23890     workInProgress.sibling = current.sibling;
 24062       // Note: We don't reset the actualTime counts. It's useful to accumulate
 23891     workInProgress.index = current.index;
 24063       // actual time across multiple render passes.
 23892     workInProgress.ref = current.ref;
       
 23893 
       
 23894     {
 24064       workInProgress.selfBaseDuration = current.selfBaseDuration;
 23895       workInProgress.selfBaseDuration = current.selfBaseDuration;
 24065       workInProgress.treeBaseDuration = current.treeBaseDuration;
 23896       workInProgress.treeBaseDuration = current.treeBaseDuration;
 24066     }
 23897     }
 24067   }
 23898 
 24068 
 23899     {
 24069   return workInProgress;
 23900       workInProgress._debugNeedsRemount = current._debugNeedsRemount;
 24070 }
 23901 
 24071 
 23902       switch (workInProgress.tag) {
 24072 function createHostRootFiber(tag) {
 23903         case IndeterminateComponent:
 24073   var mode = void 0;
 23904         case FunctionComponent:
 24074   if (tag === ConcurrentRoot) {
 23905         case SimpleMemoComponent:
 24075     mode = ConcurrentMode | BatchedMode | StrictMode;
 23906           workInProgress.type = resolveFunctionForHotReloading(current.type);
 24076   } else if (tag === BatchedRoot) {
 23907           break;
 24077     mode = BatchedMode | StrictMode;
 23908 
 24078   } else {
 23909         case ClassComponent:
 24079     mode = NoMode;
 23910           workInProgress.type = resolveClassForHotReloading(current.type);
 24080   }
 23911           break;
 24081 
 23912 
 24082   if (enableProfilerTimer && isDevToolsPresent) {
 23913         case ForwardRef:
 24083     // Always collect profile timings when DevTools are present.
 23914           workInProgress.type = resolveForwardRefForHotReloading(current.type);
 24084     // This enables DevTools to start capturing timing at any point–
 23915           break;
 24085     // Without some nodes in the tree having empty base times.
 23916       }
 24086     mode |= ProfileMode;
 23917     }
 24087   }
 23918 
 24088 
 23919     return workInProgress;
 24089   return createFiber(HostRoot, null, null, mode);
 23920   } // Used to reuse a Fiber for a second pass.
 24090 }
 23921 
 24091 
 23922   function resetWorkInProgress(workInProgress, renderExpirationTime) {
 24092 function createFiberFromTypeAndProps(type, // React$ElementType
 23923     // This resets the Fiber to what createFiber or createWorkInProgress would
 24093 key, pendingProps, owner, mode, expirationTime) {
 23924     // have set the values to before during the first pass. Ideally this wouldn't
 24094   var fiber = void 0;
 23925     // be necessary but unfortunately many code paths reads from the workInProgress
 24095 
 23926     // when they should be reading from current and writing to workInProgress.
 24096   var fiberTag = IndeterminateComponent;
 23927     // We assume pendingProps, index, key, ref, return are still untouched to
 24097   // The resolved type is set if we know what the final type will be. I.e. it's not lazy.
 23928     // avoid doing another reconciliation.
 24098   var resolvedType = type;
 23929     // Reset the effect tag but keep any Placement tags, since that's something
 24099   if (typeof type === 'function') {
 23930     // that child fiber is setting, not the reconciliation.
 24100     if (shouldConstruct(type)) {
 23931     workInProgress.effectTag &= Placement; // The effect list is no longer valid.
 24101       fiberTag = ClassComponent;
 23932 
       
 23933     workInProgress.nextEffect = null;
       
 23934     workInProgress.firstEffect = null;
       
 23935     workInProgress.lastEffect = null;
       
 23936     var current = workInProgress.alternate;
       
 23937 
       
 23938     if (current === null) {
       
 23939       // Reset to createFiber's initial values.
       
 23940       workInProgress.childExpirationTime = NoWork;
       
 23941       workInProgress.expirationTime = renderExpirationTime;
       
 23942       workInProgress.child = null;
       
 23943       workInProgress.memoizedProps = null;
       
 23944       workInProgress.memoizedState = null;
       
 23945       workInProgress.updateQueue = null;
       
 23946       workInProgress.dependencies = null;
       
 23947 
 24102       {
 23948       {
 24103         resolvedType = resolveClassForHotReloading(resolvedType);
 23949         // Note: We don't reset the actualTime counts. It's useful to accumulate
       
 23950         // actual time across multiple render passes.
       
 23951         workInProgress.selfBaseDuration = 0;
       
 23952         workInProgress.treeBaseDuration = 0;
 24104       }
 23953       }
 24105     } else {
 23954     } else {
       
 23955       // Reset to the cloned values that createWorkInProgress would've.
       
 23956       workInProgress.childExpirationTime = current.childExpirationTime;
       
 23957       workInProgress.expirationTime = current.expirationTime;
       
 23958       workInProgress.child = current.child;
       
 23959       workInProgress.memoizedProps = current.memoizedProps;
       
 23960       workInProgress.memoizedState = current.memoizedState;
       
 23961       workInProgress.updateQueue = current.updateQueue; // Clone the dependencies object. This is mutated during the render phase, so
       
 23962       // it cannot be shared with the current fiber.
       
 23963 
       
 23964       var currentDependencies = current.dependencies;
       
 23965       workInProgress.dependencies = currentDependencies === null ? null : {
       
 23966         expirationTime: currentDependencies.expirationTime,
       
 23967         firstContext: currentDependencies.firstContext,
       
 23968         responders: currentDependencies.responders
       
 23969       };
       
 23970 
 24106       {
 23971       {
 24107         resolvedType = resolveFunctionForHotReloading(resolvedType);
 23972         // Note: We don't reset the actualTime counts. It's useful to accumulate
 24108       }
 23973         // actual time across multiple render passes.
 24109     }
 23974         workInProgress.selfBaseDuration = current.selfBaseDuration;
 24110   } else if (typeof type === 'string') {
 23975         workInProgress.treeBaseDuration = current.treeBaseDuration;
 24111     fiberTag = HostComponent;
 23976       }
 24112   } else {
 23977     }
 24113     getTag: switch (type) {
 23978 
 24114       case REACT_FRAGMENT_TYPE:
 23979     return workInProgress;
 24115         return createFiberFromFragment(pendingProps.children, mode, expirationTime, key);
 23980   }
 24116       case REACT_CONCURRENT_MODE_TYPE:
 23981   function createHostRootFiber(tag) {
 24117         fiberTag = Mode;
 23982     var mode;
 24118         mode |= ConcurrentMode | BatchedMode | StrictMode;
 23983 
 24119         break;
 23984     if (tag === ConcurrentRoot) {
 24120       case REACT_STRICT_MODE_TYPE:
 23985       mode = ConcurrentMode | BlockingMode | StrictMode;
 24121         fiberTag = Mode;
 23986     } else if (tag === BlockingRoot) {
 24122         mode |= StrictMode;
 23987       mode = BlockingMode | StrictMode;
 24123         break;
 23988     } else {
 24124       case REACT_PROFILER_TYPE:
 23989       mode = NoMode;
 24125         return createFiberFromProfiler(pendingProps, mode, expirationTime, key);
 23990     }
 24126       case REACT_SUSPENSE_TYPE:
 23991 
 24127         return createFiberFromSuspense(pendingProps, mode, expirationTime, key);
 23992     if ( isDevToolsPresent) {
 24128       case REACT_SUSPENSE_LIST_TYPE:
 23993       // Always collect profile timings when DevTools are present.
 24129         return createFiberFromSuspenseList(pendingProps, mode, expirationTime, key);
 23994       // This enables DevTools to start capturing timing at any point–
 24130       default:
 23995       // Without some nodes in the tree having empty base times.
       
 23996       mode |= ProfileMode;
       
 23997     }
       
 23998 
       
 23999     return createFiber(HostRoot, null, null, mode);
       
 24000   }
       
 24001   function createFiberFromTypeAndProps(type, // React$ElementType
       
 24002   key, pendingProps, owner, mode, expirationTime) {
       
 24003     var fiber;
       
 24004     var fiberTag = IndeterminateComponent; // The resolved type is set if we know what the final type will be. I.e. it's not lazy.
       
 24005 
       
 24006     var resolvedType = type;
       
 24007 
       
 24008     if (typeof type === 'function') {
       
 24009       if (shouldConstruct(type)) {
       
 24010         fiberTag = ClassComponent;
       
 24011 
 24131         {
 24012         {
 24132           if (typeof type === 'object' && type !== null) {
 24013           resolvedType = resolveClassForHotReloading(resolvedType);
 24133             switch (type.$$typeof) {
 24014         }
 24134               case REACT_PROVIDER_TYPE:
 24015       } else {
 24135                 fiberTag = ContextProvider;
 24016         {
 24136                 break getTag;
 24017           resolvedType = resolveFunctionForHotReloading(resolvedType);
 24137               case REACT_CONTEXT_TYPE:
 24018         }
 24138                 // This is a consumer
 24019       }
 24139                 fiberTag = ContextConsumer;
 24020     } else if (typeof type === 'string') {
 24140                 break getTag;
 24021       fiberTag = HostComponent;
 24141               case REACT_FORWARD_REF_TYPE:
 24022     } else {
 24142                 fiberTag = ForwardRef;
 24023       getTag: switch (type) {
 24143                 {
 24024         case REACT_FRAGMENT_TYPE:
 24144                   resolvedType = resolveForwardRefForHotReloading(resolvedType);
 24025           return createFiberFromFragment(pendingProps.children, mode, expirationTime, key);
 24145                 }
 24026 
 24146                 break getTag;
 24027         case REACT_CONCURRENT_MODE_TYPE:
 24147               case REACT_MEMO_TYPE:
 24028           fiberTag = Mode;
 24148                 fiberTag = MemoComponent;
 24029           mode |= ConcurrentMode | BlockingMode | StrictMode;
 24149                 break getTag;
 24030           break;
 24150               case REACT_LAZY_TYPE:
 24031 
 24151                 fiberTag = LazyComponent;
 24032         case REACT_STRICT_MODE_TYPE:
 24152                 resolvedType = null;
 24033           fiberTag = Mode;
 24153                 break getTag;
 24034           mode |= StrictMode;
 24154               case REACT_FUNDAMENTAL_TYPE:
 24035           break;
 24155                 if (enableFundamentalAPI) {
 24036 
 24156                   return createFiberFromFundamental(type, pendingProps, mode, expirationTime, key);
 24037         case REACT_PROFILER_TYPE:
 24157                 }
 24038           return createFiberFromProfiler(pendingProps, mode, expirationTime, key);
 24158                 break;
 24039 
       
 24040         case REACT_SUSPENSE_TYPE:
       
 24041           return createFiberFromSuspense(pendingProps, mode, expirationTime, key);
       
 24042 
       
 24043         case REACT_SUSPENSE_LIST_TYPE:
       
 24044           return createFiberFromSuspenseList(pendingProps, mode, expirationTime, key);
       
 24045 
       
 24046         default:
       
 24047           {
       
 24048             if (typeof type === 'object' && type !== null) {
       
 24049               switch (type.$$typeof) {
       
 24050                 case REACT_PROVIDER_TYPE:
       
 24051                   fiberTag = ContextProvider;
       
 24052                   break getTag;
       
 24053 
       
 24054                 case REACT_CONTEXT_TYPE:
       
 24055                   // This is a consumer
       
 24056                   fiberTag = ContextConsumer;
       
 24057                   break getTag;
       
 24058 
       
 24059                 case REACT_FORWARD_REF_TYPE:
       
 24060                   fiberTag = ForwardRef;
       
 24061 
       
 24062                   {
       
 24063                     resolvedType = resolveForwardRefForHotReloading(resolvedType);
       
 24064                   }
       
 24065 
       
 24066                   break getTag;
       
 24067 
       
 24068                 case REACT_MEMO_TYPE:
       
 24069                   fiberTag = MemoComponent;
       
 24070                   break getTag;
       
 24071 
       
 24072                 case REACT_LAZY_TYPE:
       
 24073                   fiberTag = LazyComponent;
       
 24074                   resolvedType = null;
       
 24075                   break getTag;
       
 24076 
       
 24077                 case REACT_BLOCK_TYPE:
       
 24078                   fiberTag = Block;
       
 24079                   break getTag;
       
 24080 
       
 24081               }
       
 24082             }
       
 24083 
       
 24084             var info = '';
       
 24085 
       
 24086             {
       
 24087               if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
       
 24088                 info += ' You likely forgot to export your component from the file ' + "it's defined in, or you might have mixed up default and " + 'named imports.';
       
 24089               }
       
 24090 
       
 24091               var ownerName = owner ? getComponentName(owner.type) : null;
       
 24092 
       
 24093               if (ownerName) {
       
 24094                 info += '\n\nCheck the render method of `' + ownerName + '`.';
       
 24095               }
       
 24096             }
       
 24097 
       
 24098             {
       
 24099               {
       
 24100                 throw Error( "Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: " + (type == null ? type : typeof type) + "." + info );
       
 24101               }
 24159             }
 24102             }
 24160           }
 24103           }
 24161           var info = '';
 24104       }
       
 24105     }
       
 24106 
       
 24107     fiber = createFiber(fiberTag, pendingProps, key, mode);
       
 24108     fiber.elementType = type;
       
 24109     fiber.type = resolvedType;
       
 24110     fiber.expirationTime = expirationTime;
       
 24111     return fiber;
       
 24112   }
       
 24113   function createFiberFromElement(element, mode, expirationTime) {
       
 24114     var owner = null;
       
 24115 
       
 24116     {
       
 24117       owner = element._owner;
       
 24118     }
       
 24119 
       
 24120     var type = element.type;
       
 24121     var key = element.key;
       
 24122     var pendingProps = element.props;
       
 24123     var fiber = createFiberFromTypeAndProps(type, key, pendingProps, owner, mode, expirationTime);
       
 24124 
       
 24125     {
       
 24126       fiber._debugSource = element._source;
       
 24127       fiber._debugOwner = element._owner;
       
 24128     }
       
 24129 
       
 24130     return fiber;
       
 24131   }
       
 24132   function createFiberFromFragment(elements, mode, expirationTime, key) {
       
 24133     var fiber = createFiber(Fragment, elements, key, mode);
       
 24134     fiber.expirationTime = expirationTime;
       
 24135     return fiber;
       
 24136   }
       
 24137 
       
 24138   function createFiberFromProfiler(pendingProps, mode, expirationTime, key) {
       
 24139     {
       
 24140       if (typeof pendingProps.id !== 'string' || typeof pendingProps.onRender !== 'function') {
       
 24141         error('Profiler must specify an "id" string and "onRender" function as props');
       
 24142       }
       
 24143     }
       
 24144 
       
 24145     var fiber = createFiber(Profiler, pendingProps, key, mode | ProfileMode); // TODO: The Profiler fiber shouldn't have a type. It has a tag.
       
 24146 
       
 24147     fiber.elementType = REACT_PROFILER_TYPE;
       
 24148     fiber.type = REACT_PROFILER_TYPE;
       
 24149     fiber.expirationTime = expirationTime;
       
 24150     return fiber;
       
 24151   }
       
 24152 
       
 24153   function createFiberFromSuspense(pendingProps, mode, expirationTime, key) {
       
 24154     var fiber = createFiber(SuspenseComponent, pendingProps, key, mode); // TODO: The SuspenseComponent fiber shouldn't have a type. It has a tag.
       
 24155     // This needs to be fixed in getComponentName so that it relies on the tag
       
 24156     // instead.
       
 24157 
       
 24158     fiber.type = REACT_SUSPENSE_TYPE;
       
 24159     fiber.elementType = REACT_SUSPENSE_TYPE;
       
 24160     fiber.expirationTime = expirationTime;
       
 24161     return fiber;
       
 24162   }
       
 24163   function createFiberFromSuspenseList(pendingProps, mode, expirationTime, key) {
       
 24164     var fiber = createFiber(SuspenseListComponent, pendingProps, key, mode);
       
 24165 
       
 24166     {
       
 24167       // TODO: The SuspenseListComponent fiber shouldn't have a type. It has a tag.
       
 24168       // This needs to be fixed in getComponentName so that it relies on the tag
       
 24169       // instead.
       
 24170       fiber.type = REACT_SUSPENSE_LIST_TYPE;
       
 24171     }
       
 24172 
       
 24173     fiber.elementType = REACT_SUSPENSE_LIST_TYPE;
       
 24174     fiber.expirationTime = expirationTime;
       
 24175     return fiber;
       
 24176   }
       
 24177   function createFiberFromText(content, mode, expirationTime) {
       
 24178     var fiber = createFiber(HostText, content, null, mode);
       
 24179     fiber.expirationTime = expirationTime;
       
 24180     return fiber;
       
 24181   }
       
 24182   function createFiberFromHostInstanceForDeletion() {
       
 24183     var fiber = createFiber(HostComponent, null, null, NoMode); // TODO: These should not need a type.
       
 24184 
       
 24185     fiber.elementType = 'DELETED';
       
 24186     fiber.type = 'DELETED';
       
 24187     return fiber;
       
 24188   }
       
 24189   function createFiberFromPortal(portal, mode, expirationTime) {
       
 24190     var pendingProps = portal.children !== null ? portal.children : [];
       
 24191     var fiber = createFiber(HostPortal, pendingProps, portal.key, mode);
       
 24192     fiber.expirationTime = expirationTime;
       
 24193     fiber.stateNode = {
       
 24194       containerInfo: portal.containerInfo,
       
 24195       pendingChildren: null,
       
 24196       // Used by persistent updates
       
 24197       implementation: portal.implementation
       
 24198     };
       
 24199     return fiber;
       
 24200   } // Used for stashing WIP properties to replay failed work in DEV.
       
 24201 
       
 24202   function assignFiberPropertiesInDEV(target, source) {
       
 24203     if (target === null) {
       
 24204       // This Fiber's initial properties will always be overwritten.
       
 24205       // We only use a Fiber to ensure the same hidden class so DEV isn't slow.
       
 24206       target = createFiber(IndeterminateComponent, null, null, NoMode);
       
 24207     } // This is intentionally written as a list of all properties.
       
 24208     // We tried to use Object.assign() instead but this is called in
       
 24209     // the hottest path, and Object.assign() was too slow:
       
 24210     // https://github.com/facebook/react/issues/12502
       
 24211     // This code is DEV-only so size is not a concern.
       
 24212 
       
 24213 
       
 24214     target.tag = source.tag;
       
 24215     target.key = source.key;
       
 24216     target.elementType = source.elementType;
       
 24217     target.type = source.type;
       
 24218     target.stateNode = source.stateNode;
       
 24219     target.return = source.return;
       
 24220     target.child = source.child;
       
 24221     target.sibling = source.sibling;
       
 24222     target.index = source.index;
       
 24223     target.ref = source.ref;
       
 24224     target.pendingProps = source.pendingProps;
       
 24225     target.memoizedProps = source.memoizedProps;
       
 24226     target.updateQueue = source.updateQueue;
       
 24227     target.memoizedState = source.memoizedState;
       
 24228     target.dependencies = source.dependencies;
       
 24229     target.mode = source.mode;
       
 24230     target.effectTag = source.effectTag;
       
 24231     target.nextEffect = source.nextEffect;
       
 24232     target.firstEffect = source.firstEffect;
       
 24233     target.lastEffect = source.lastEffect;
       
 24234     target.expirationTime = source.expirationTime;
       
 24235     target.childExpirationTime = source.childExpirationTime;
       
 24236     target.alternate = source.alternate;
       
 24237 
       
 24238     {
       
 24239       target.actualDuration = source.actualDuration;
       
 24240       target.actualStartTime = source.actualStartTime;
       
 24241       target.selfBaseDuration = source.selfBaseDuration;
       
 24242       target.treeBaseDuration = source.treeBaseDuration;
       
 24243     }
       
 24244 
       
 24245     {
       
 24246       target._debugID = source._debugID;
       
 24247     }
       
 24248 
       
 24249     target._debugSource = source._debugSource;
       
 24250     target._debugOwner = source._debugOwner;
       
 24251     target._debugIsCurrentlyTiming = source._debugIsCurrentlyTiming;
       
 24252     target._debugNeedsRemount = source._debugNeedsRemount;
       
 24253     target._debugHookTypes = source._debugHookTypes;
       
 24254     return target;
       
 24255   }
       
 24256 
       
 24257   function FiberRootNode(containerInfo, tag, hydrate) {
       
 24258     this.tag = tag;
       
 24259     this.current = null;
       
 24260     this.containerInfo = containerInfo;
       
 24261     this.pendingChildren = null;
       
 24262     this.pingCache = null;
       
 24263     this.finishedExpirationTime = NoWork;
       
 24264     this.finishedWork = null;
       
 24265     this.timeoutHandle = noTimeout;
       
 24266     this.context = null;
       
 24267     this.pendingContext = null;
       
 24268     this.hydrate = hydrate;
       
 24269     this.callbackNode = null;
       
 24270     this.callbackPriority = NoPriority;
       
 24271     this.firstPendingTime = NoWork;
       
 24272     this.firstSuspendedTime = NoWork;
       
 24273     this.lastSuspendedTime = NoWork;
       
 24274     this.nextKnownPendingLevel = NoWork;
       
 24275     this.lastPingedTime = NoWork;
       
 24276     this.lastExpiredTime = NoWork;
       
 24277 
       
 24278     {
       
 24279       this.interactionThreadID = unstable_getThreadID();
       
 24280       this.memoizedInteractions = new Set();
       
 24281       this.pendingInteractionMap = new Map();
       
 24282     }
       
 24283   }
       
 24284 
       
 24285   function createFiberRoot(containerInfo, tag, hydrate, hydrationCallbacks) {
       
 24286     var root = new FiberRootNode(containerInfo, tag, hydrate);
       
 24287     // stateNode is any.
       
 24288 
       
 24289 
       
 24290     var uninitializedFiber = createHostRootFiber(tag);
       
 24291     root.current = uninitializedFiber;
       
 24292     uninitializedFiber.stateNode = root;
       
 24293     initializeUpdateQueue(uninitializedFiber);
       
 24294     return root;
       
 24295   }
       
 24296   function isRootSuspendedAtTime(root, expirationTime) {
       
 24297     var firstSuspendedTime = root.firstSuspendedTime;
       
 24298     var lastSuspendedTime = root.lastSuspendedTime;
       
 24299     return firstSuspendedTime !== NoWork && firstSuspendedTime >= expirationTime && lastSuspendedTime <= expirationTime;
       
 24300   }
       
 24301   function markRootSuspendedAtTime(root, expirationTime) {
       
 24302     var firstSuspendedTime = root.firstSuspendedTime;
       
 24303     var lastSuspendedTime = root.lastSuspendedTime;
       
 24304 
       
 24305     if (firstSuspendedTime < expirationTime) {
       
 24306       root.firstSuspendedTime = expirationTime;
       
 24307     }
       
 24308 
       
 24309     if (lastSuspendedTime > expirationTime || firstSuspendedTime === NoWork) {
       
 24310       root.lastSuspendedTime = expirationTime;
       
 24311     }
       
 24312 
       
 24313     if (expirationTime <= root.lastPingedTime) {
       
 24314       root.lastPingedTime = NoWork;
       
 24315     }
       
 24316 
       
 24317     if (expirationTime <= root.lastExpiredTime) {
       
 24318       root.lastExpiredTime = NoWork;
       
 24319     }
       
 24320   }
       
 24321   function markRootUpdatedAtTime(root, expirationTime) {
       
 24322     // Update the range of pending times
       
 24323     var firstPendingTime = root.firstPendingTime;
       
 24324 
       
 24325     if (expirationTime > firstPendingTime) {
       
 24326       root.firstPendingTime = expirationTime;
       
 24327     } // Update the range of suspended times. Treat everything lower priority or
       
 24328     // equal to this update as unsuspended.
       
 24329 
       
 24330 
       
 24331     var firstSuspendedTime = root.firstSuspendedTime;
       
 24332 
       
 24333     if (firstSuspendedTime !== NoWork) {
       
 24334       if (expirationTime >= firstSuspendedTime) {
       
 24335         // The entire suspended range is now unsuspended.
       
 24336         root.firstSuspendedTime = root.lastSuspendedTime = root.nextKnownPendingLevel = NoWork;
       
 24337       } else if (expirationTime >= root.lastSuspendedTime) {
       
 24338         root.lastSuspendedTime = expirationTime + 1;
       
 24339       } // This is a pending level. Check if it's higher priority than the next
       
 24340       // known pending level.
       
 24341 
       
 24342 
       
 24343       if (expirationTime > root.nextKnownPendingLevel) {
       
 24344         root.nextKnownPendingLevel = expirationTime;
       
 24345       }
       
 24346     }
       
 24347   }
       
 24348   function markRootFinishedAtTime(root, finishedExpirationTime, remainingExpirationTime) {
       
 24349     // Update the range of pending times
       
 24350     root.firstPendingTime = remainingExpirationTime; // Update the range of suspended times. Treat everything higher priority or
       
 24351     // equal to this update as unsuspended.
       
 24352 
       
 24353     if (finishedExpirationTime <= root.lastSuspendedTime) {
       
 24354       // The entire suspended range is now unsuspended.
       
 24355       root.firstSuspendedTime = root.lastSuspendedTime = root.nextKnownPendingLevel = NoWork;
       
 24356     } else if (finishedExpirationTime <= root.firstSuspendedTime) {
       
 24357       // Part of the suspended range is now unsuspended. Narrow the range to
       
 24358       // include everything between the unsuspended time (non-inclusive) and the
       
 24359       // last suspended time.
       
 24360       root.firstSuspendedTime = finishedExpirationTime - 1;
       
 24361     }
       
 24362 
       
 24363     if (finishedExpirationTime <= root.lastPingedTime) {
       
 24364       // Clear the pinged time
       
 24365       root.lastPingedTime = NoWork;
       
 24366     }
       
 24367 
       
 24368     if (finishedExpirationTime <= root.lastExpiredTime) {
       
 24369       // Clear the expired time
       
 24370       root.lastExpiredTime = NoWork;
       
 24371     }
       
 24372   }
       
 24373   function markRootExpiredAtTime(root, expirationTime) {
       
 24374     var lastExpiredTime = root.lastExpiredTime;
       
 24375 
       
 24376     if (lastExpiredTime === NoWork || lastExpiredTime > expirationTime) {
       
 24377       root.lastExpiredTime = expirationTime;
       
 24378     }
       
 24379   }
       
 24380 
       
 24381   var didWarnAboutNestedUpdates;
       
 24382   var didWarnAboutFindNodeInStrictMode;
       
 24383 
       
 24384   {
       
 24385     didWarnAboutNestedUpdates = false;
       
 24386     didWarnAboutFindNodeInStrictMode = {};
       
 24387   }
       
 24388 
       
 24389   function getContextForSubtree(parentComponent) {
       
 24390     if (!parentComponent) {
       
 24391       return emptyContextObject;
       
 24392     }
       
 24393 
       
 24394     var fiber = get(parentComponent);
       
 24395     var parentContext = findCurrentUnmaskedContext(fiber);
       
 24396 
       
 24397     if (fiber.tag === ClassComponent) {
       
 24398       var Component = fiber.type;
       
 24399 
       
 24400       if (isContextProvider(Component)) {
       
 24401         return processChildContext(fiber, Component, parentContext);
       
 24402       }
       
 24403     }
       
 24404 
       
 24405     return parentContext;
       
 24406   }
       
 24407 
       
 24408   function findHostInstanceWithWarning(component, methodName) {
       
 24409     {
       
 24410       var fiber = get(component);
       
 24411 
       
 24412       if (fiber === undefined) {
       
 24413         if (typeof component.render === 'function') {
 24162           {
 24414           {
 24163             if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
 24415             {
 24164               info += ' You likely forgot to export your component from the file ' + "it's defined in, or you might have mixed up default and " + 'named imports.';
 24416               throw Error( "Unable to find node on an unmounted component." );
 24165             }
       
 24166             var ownerName = owner ? getComponentName(owner.type) : null;
       
 24167             if (ownerName) {
       
 24168               info += '\n\nCheck the render method of `' + ownerName + '`.';
       
 24169             }
 24417             }
 24170           }
 24418           }
 24171           (function () {
 24419         } else {
 24172             {
       
 24173               {
       
 24174                 throw ReactError(Error('Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: ' + (type == null ? type : typeof type) + '.' + info));
       
 24175               }
       
 24176             }
       
 24177           })();
       
 24178         }
       
 24179     }
       
 24180   }
       
 24181 
       
 24182   fiber = createFiber(fiberTag, pendingProps, key, mode);
       
 24183   fiber.elementType = type;
       
 24184   fiber.type = resolvedType;
       
 24185   fiber.expirationTime = expirationTime;
       
 24186 
       
 24187   return fiber;
       
 24188 }
       
 24189 
       
 24190 function createFiberFromElement(element, mode, expirationTime) {
       
 24191   var owner = null;
       
 24192   {
       
 24193     owner = element._owner;
       
 24194   }
       
 24195   var type = element.type;
       
 24196   var key = element.key;
       
 24197   var pendingProps = element.props;
       
 24198   var fiber = createFiberFromTypeAndProps(type, key, pendingProps, owner, mode, expirationTime);
       
 24199   {
       
 24200     fiber._debugSource = element._source;
       
 24201     fiber._debugOwner = element._owner;
       
 24202   }
       
 24203   return fiber;
       
 24204 }
       
 24205 
       
 24206 function createFiberFromFragment(elements, mode, expirationTime, key) {
       
 24207   var fiber = createFiber(Fragment, elements, key, mode);
       
 24208   fiber.expirationTime = expirationTime;
       
 24209   return fiber;
       
 24210 }
       
 24211 
       
 24212 function createFiberFromFundamental(fundamentalComponent, pendingProps, mode, expirationTime, key) {
       
 24213   var fiber = createFiber(FundamentalComponent, pendingProps, key, mode);
       
 24214   fiber.elementType = fundamentalComponent;
       
 24215   fiber.type = fundamentalComponent;
       
 24216   fiber.expirationTime = expirationTime;
       
 24217   return fiber;
       
 24218 }
       
 24219 
       
 24220 function createFiberFromProfiler(pendingProps, mode, expirationTime, key) {
       
 24221   {
       
 24222     if (typeof pendingProps.id !== 'string' || typeof pendingProps.onRender !== 'function') {
       
 24223       warningWithoutStack$1(false, 'Profiler must specify an "id" string and "onRender" function as props');
       
 24224     }
       
 24225   }
       
 24226 
       
 24227   var fiber = createFiber(Profiler, pendingProps, key, mode | ProfileMode);
       
 24228   // TODO: The Profiler fiber shouldn't have a type. It has a tag.
       
 24229   fiber.elementType = REACT_PROFILER_TYPE;
       
 24230   fiber.type = REACT_PROFILER_TYPE;
       
 24231   fiber.expirationTime = expirationTime;
       
 24232 
       
 24233   return fiber;
       
 24234 }
       
 24235 
       
 24236 function createFiberFromSuspense(pendingProps, mode, expirationTime, key) {
       
 24237   var fiber = createFiber(SuspenseComponent, pendingProps, key, mode);
       
 24238 
       
 24239   // TODO: The SuspenseComponent fiber shouldn't have a type. It has a tag.
       
 24240   // This needs to be fixed in getComponentName so that it relies on the tag
       
 24241   // instead.
       
 24242   fiber.type = REACT_SUSPENSE_TYPE;
       
 24243   fiber.elementType = REACT_SUSPENSE_TYPE;
       
 24244 
       
 24245   fiber.expirationTime = expirationTime;
       
 24246   return fiber;
       
 24247 }
       
 24248 
       
 24249 function createFiberFromSuspenseList(pendingProps, mode, expirationTime, key) {
       
 24250   var fiber = createFiber(SuspenseListComponent, pendingProps, key, mode);
       
 24251   {
       
 24252     // TODO: The SuspenseListComponent fiber shouldn't have a type. It has a tag.
       
 24253     // This needs to be fixed in getComponentName so that it relies on the tag
       
 24254     // instead.
       
 24255     fiber.type = REACT_SUSPENSE_LIST_TYPE;
       
 24256   }
       
 24257   fiber.elementType = REACT_SUSPENSE_LIST_TYPE;
       
 24258   fiber.expirationTime = expirationTime;
       
 24259   return fiber;
       
 24260 }
       
 24261 
       
 24262 function createFiberFromText(content, mode, expirationTime) {
       
 24263   var fiber = createFiber(HostText, content, null, mode);
       
 24264   fiber.expirationTime = expirationTime;
       
 24265   return fiber;
       
 24266 }
       
 24267 
       
 24268 function createFiberFromHostInstanceForDeletion() {
       
 24269   var fiber = createFiber(HostComponent, null, null, NoMode);
       
 24270   // TODO: These should not need a type.
       
 24271   fiber.elementType = 'DELETED';
       
 24272   fiber.type = 'DELETED';
       
 24273   return fiber;
       
 24274 }
       
 24275 
       
 24276 function createFiberFromPortal(portal, mode, expirationTime) {
       
 24277   var pendingProps = portal.children !== null ? portal.children : [];
       
 24278   var fiber = createFiber(HostPortal, pendingProps, portal.key, mode);
       
 24279   fiber.expirationTime = expirationTime;
       
 24280   fiber.stateNode = {
       
 24281     containerInfo: portal.containerInfo,
       
 24282     pendingChildren: null, // Used by persistent updates
       
 24283     implementation: portal.implementation
       
 24284   };
       
 24285   return fiber;
       
 24286 }
       
 24287 
       
 24288 // Used for stashing WIP properties to replay failed work in DEV.
       
 24289 function assignFiberPropertiesInDEV(target, source) {
       
 24290   if (target === null) {
       
 24291     // This Fiber's initial properties will always be overwritten.
       
 24292     // We only use a Fiber to ensure the same hidden class so DEV isn't slow.
       
 24293     target = createFiber(IndeterminateComponent, null, null, NoMode);
       
 24294   }
       
 24295 
       
 24296   // This is intentionally written as a list of all properties.
       
 24297   // We tried to use Object.assign() instead but this is called in
       
 24298   // the hottest path, and Object.assign() was too slow:
       
 24299   // https://github.com/facebook/react/issues/12502
       
 24300   // This code is DEV-only so size is not a concern.
       
 24301 
       
 24302   target.tag = source.tag;
       
 24303   target.key = source.key;
       
 24304   target.elementType = source.elementType;
       
 24305   target.type = source.type;
       
 24306   target.stateNode = source.stateNode;
       
 24307   target.return = source.return;
       
 24308   target.child = source.child;
       
 24309   target.sibling = source.sibling;
       
 24310   target.index = source.index;
       
 24311   target.ref = source.ref;
       
 24312   target.pendingProps = source.pendingProps;
       
 24313   target.memoizedProps = source.memoizedProps;
       
 24314   target.updateQueue = source.updateQueue;
       
 24315   target.memoizedState = source.memoizedState;
       
 24316   target.dependencies = source.dependencies;
       
 24317   target.mode = source.mode;
       
 24318   target.effectTag = source.effectTag;
       
 24319   target.nextEffect = source.nextEffect;
       
 24320   target.firstEffect = source.firstEffect;
       
 24321   target.lastEffect = source.lastEffect;
       
 24322   target.expirationTime = source.expirationTime;
       
 24323   target.childExpirationTime = source.childExpirationTime;
       
 24324   target.alternate = source.alternate;
       
 24325   if (enableProfilerTimer) {
       
 24326     target.actualDuration = source.actualDuration;
       
 24327     target.actualStartTime = source.actualStartTime;
       
 24328     target.selfBaseDuration = source.selfBaseDuration;
       
 24329     target.treeBaseDuration = source.treeBaseDuration;
       
 24330   }
       
 24331   target._debugID = source._debugID;
       
 24332   target._debugSource = source._debugSource;
       
 24333   target._debugOwner = source._debugOwner;
       
 24334   target._debugIsCurrentlyTiming = source._debugIsCurrentlyTiming;
       
 24335   target._debugNeedsRemount = source._debugNeedsRemount;
       
 24336   target._debugHookTypes = source._debugHookTypes;
       
 24337   return target;
       
 24338 }
       
 24339 
       
 24340 // TODO: This should be lifted into the renderer.
       
 24341 
       
 24342 
       
 24343 // The following attributes are only used by interaction tracing builds.
       
 24344 // They enable interactions to be associated with their async work,
       
 24345 // And expose interaction metadata to the React DevTools Profiler plugin.
       
 24346 // Note that these attributes are only defined when the enableSchedulerTracing flag is enabled.
       
 24347 
       
 24348 
       
 24349 // Exported FiberRoot type includes all properties,
       
 24350 // To avoid requiring potentially error-prone :any casts throughout the project.
       
 24351 // Profiling properties are only safe to access in profiling builds (when enableSchedulerTracing is true).
       
 24352 // The types are defined separately within this file to ensure they stay in sync.
       
 24353 // (We don't have to use an inline :any cast when enableSchedulerTracing is disabled.)
       
 24354 
       
 24355 
       
 24356 function FiberRootNode(containerInfo, tag, hydrate) {
       
 24357   this.tag = tag;
       
 24358   this.current = null;
       
 24359   this.containerInfo = containerInfo;
       
 24360   this.pendingChildren = null;
       
 24361   this.pingCache = null;
       
 24362   this.finishedExpirationTime = NoWork;
       
 24363   this.finishedWork = null;
       
 24364   this.timeoutHandle = noTimeout;
       
 24365   this.context = null;
       
 24366   this.pendingContext = null;
       
 24367   this.hydrate = hydrate;
       
 24368   this.firstBatch = null;
       
 24369   this.callbackNode = null;
       
 24370   this.callbackExpirationTime = NoWork;
       
 24371   this.firstPendingTime = NoWork;
       
 24372   this.lastPendingTime = NoWork;
       
 24373   this.pingTime = NoWork;
       
 24374 
       
 24375   if (enableSchedulerTracing) {
       
 24376     this.interactionThreadID = unstable_getThreadID();
       
 24377     this.memoizedInteractions = new Set();
       
 24378     this.pendingInteractionMap = new Map();
       
 24379   }
       
 24380 }
       
 24381 
       
 24382 function createFiberRoot(containerInfo, tag, hydrate) {
       
 24383   var root = new FiberRootNode(containerInfo, tag, hydrate);
       
 24384 
       
 24385   // Cyclic construction. This cheats the type system right now because
       
 24386   // stateNode is any.
       
 24387   var uninitializedFiber = createHostRootFiber(tag);
       
 24388   root.current = uninitializedFiber;
       
 24389   uninitializedFiber.stateNode = root;
       
 24390 
       
 24391   return root;
       
 24392 }
       
 24393 
       
 24394 // This lets us hook into Fiber to debug what it's doing.
       
 24395 // See https://github.com/facebook/react/pull/8033.
       
 24396 // This is not part of the public API, not even for React DevTools.
       
 24397 // You may only inject a debugTool if you work on React Fiber itself.
       
 24398 var ReactFiberInstrumentation = {
       
 24399   debugTool: null
       
 24400 };
       
 24401 
       
 24402 var ReactFiberInstrumentation_1 = ReactFiberInstrumentation;
       
 24403 
       
 24404 // 0 is PROD, 1 is DEV.
       
 24405 // Might add PROFILE later.
       
 24406 
       
 24407 
       
 24408 var didWarnAboutNestedUpdates = void 0;
       
 24409 var didWarnAboutFindNodeInStrictMode = void 0;
       
 24410 
       
 24411 {
       
 24412   didWarnAboutNestedUpdates = false;
       
 24413   didWarnAboutFindNodeInStrictMode = {};
       
 24414 }
       
 24415 
       
 24416 function getContextForSubtree(parentComponent) {
       
 24417   if (!parentComponent) {
       
 24418     return emptyContextObject;
       
 24419   }
       
 24420 
       
 24421   var fiber = get(parentComponent);
       
 24422   var parentContext = findCurrentUnmaskedContext(fiber);
       
 24423 
       
 24424   if (fiber.tag === ClassComponent) {
       
 24425     var Component = fiber.type;
       
 24426     if (isContextProvider(Component)) {
       
 24427       return processChildContext(fiber, Component, parentContext);
       
 24428     }
       
 24429   }
       
 24430 
       
 24431   return parentContext;
       
 24432 }
       
 24433 
       
 24434 function scheduleRootUpdate(current$$1, element, expirationTime, suspenseConfig, callback) {
       
 24435   {
       
 24436     if (phase === 'render' && current !== null && !didWarnAboutNestedUpdates) {
       
 24437       didWarnAboutNestedUpdates = true;
       
 24438       warningWithoutStack$1(false, 'Render methods should be a pure function of props and state; ' + 'triggering nested component updates from render is not allowed. ' + 'If necessary, trigger nested updates in componentDidUpdate.\n\n' + 'Check the render method of %s.', getComponentName(current.type) || 'Unknown');
       
 24439     }
       
 24440   }
       
 24441 
       
 24442   var update = createUpdate(expirationTime, suspenseConfig);
       
 24443   // Caution: React DevTools currently depends on this property
       
 24444   // being called "element".
       
 24445   update.payload = { element: element };
       
 24446 
       
 24447   callback = callback === undefined ? null : callback;
       
 24448   if (callback !== null) {
       
 24449     !(typeof callback === 'function') ? warningWithoutStack$1(false, 'render(...): Expected the last optional `callback` argument to be a ' + 'function. Instead received: %s.', callback) : void 0;
       
 24450     update.callback = callback;
       
 24451   }
       
 24452 
       
 24453   if (revertPassiveEffectsChange) {
       
 24454     flushPassiveEffects();
       
 24455   }
       
 24456   enqueueUpdate(current$$1, update);
       
 24457   scheduleWork(current$$1, expirationTime);
       
 24458 
       
 24459   return expirationTime;
       
 24460 }
       
 24461 
       
 24462 function updateContainerAtExpirationTime(element, container, parentComponent, expirationTime, suspenseConfig, callback) {
       
 24463   // TODO: If this is a nested container, this won't be the root.
       
 24464   var current$$1 = container.current;
       
 24465 
       
 24466   {
       
 24467     if (ReactFiberInstrumentation_1.debugTool) {
       
 24468       if (current$$1.alternate === null) {
       
 24469         ReactFiberInstrumentation_1.debugTool.onMountContainer(container);
       
 24470       } else if (element === null) {
       
 24471         ReactFiberInstrumentation_1.debugTool.onUnmountContainer(container);
       
 24472       } else {
       
 24473         ReactFiberInstrumentation_1.debugTool.onUpdateContainer(container);
       
 24474       }
       
 24475     }
       
 24476   }
       
 24477 
       
 24478   var context = getContextForSubtree(parentComponent);
       
 24479   if (container.context === null) {
       
 24480     container.context = context;
       
 24481   } else {
       
 24482     container.pendingContext = context;
       
 24483   }
       
 24484 
       
 24485   return scheduleRootUpdate(current$$1, element, expirationTime, suspenseConfig, callback);
       
 24486 }
       
 24487 
       
 24488 function findHostInstance(component) {
       
 24489   var fiber = get(component);
       
 24490   if (fiber === undefined) {
       
 24491     if (typeof component.render === 'function') {
       
 24492       (function () {
       
 24493         {
       
 24494           {
       
 24495             throw ReactError(Error('Unable to find node on an unmounted component.'));
       
 24496           }
       
 24497         }
       
 24498       })();
       
 24499     } else {
       
 24500       (function () {
       
 24501         {
       
 24502           {
       
 24503             throw ReactError(Error('Argument appears to not be a ReactComponent. Keys: ' + Object.keys(component)));
       
 24504           }
       
 24505         }
       
 24506       })();
       
 24507     }
       
 24508   }
       
 24509   var hostFiber = findCurrentHostFiber(fiber);
       
 24510   if (hostFiber === null) {
       
 24511     return null;
       
 24512   }
       
 24513   return hostFiber.stateNode;
       
 24514 }
       
 24515 
       
 24516 function findHostInstanceWithWarning(component, methodName) {
       
 24517   {
       
 24518     var fiber = get(component);
       
 24519     if (fiber === undefined) {
       
 24520       if (typeof component.render === 'function') {
       
 24521         (function () {
       
 24522           {
 24420           {
 24523             {
 24421             {
 24524               throw ReactError(Error('Unable to find node on an unmounted component.'));
 24422               throw Error( "Argument appears to not be a ReactComponent. Keys: " + Object.keys(component) );
 24525             }
 24423             }
 24526           }
 24424           }
 24527         })();
 24425         }
 24528       } else {
 24426       }
 24529         (function () {
 24427 
 24530           {
 24428       var hostFiber = findCurrentHostFiber(fiber);
 24531             {
 24429 
 24532               throw ReactError(Error('Argument appears to not be a ReactComponent. Keys: ' + Object.keys(component)));
 24430       if (hostFiber === null) {
 24533             }
 24431         return null;
       
 24432       }
       
 24433 
       
 24434       if (hostFiber.mode & StrictMode) {
       
 24435         var componentName = getComponentName(fiber.type) || 'Component';
       
 24436 
       
 24437         if (!didWarnAboutFindNodeInStrictMode[componentName]) {
       
 24438           didWarnAboutFindNodeInStrictMode[componentName] = true;
       
 24439 
       
 24440           if (fiber.mode & StrictMode) {
       
 24441             error('%s is deprecated in StrictMode. ' + '%s was passed an instance of %s which is inside StrictMode. ' + 'Instead, add a ref directly to the element you want to reference. ' + 'Learn more about using refs safely here: ' + 'https://fb.me/react-strict-mode-find-node%s', methodName, methodName, componentName, getStackByFiberInDevAndProd(hostFiber));
       
 24442           } else {
       
 24443             error('%s is deprecated in StrictMode. ' + '%s was passed an instance of %s which renders StrictMode children. ' + 'Instead, add a ref directly to the element you want to reference. ' + 'Learn more about using refs safely here: ' + 'https://fb.me/react-strict-mode-find-node%s', methodName, methodName, componentName, getStackByFiberInDevAndProd(hostFiber));
 24534           }
 24444           }
 24535         })();
 24445         }
 24536       }
 24446       }
 24537     }
 24447 
 24538     var hostFiber = findCurrentHostFiber(fiber);
 24448       return hostFiber.stateNode;
       
 24449     }
       
 24450   }
       
 24451 
       
 24452   function createContainer(containerInfo, tag, hydrate, hydrationCallbacks) {
       
 24453     return createFiberRoot(containerInfo, tag, hydrate);
       
 24454   }
       
 24455   function updateContainer(element, container, parentComponent, callback) {
       
 24456     {
       
 24457       onScheduleRoot(container, element);
       
 24458     }
       
 24459 
       
 24460     var current$1 = container.current;
       
 24461     var currentTime = requestCurrentTimeForUpdate();
       
 24462 
       
 24463     {
       
 24464       // $FlowExpectedError - jest isn't a global, and isn't recognized outside of tests
       
 24465       if ('undefined' !== typeof jest) {
       
 24466         warnIfUnmockedScheduler(current$1);
       
 24467         warnIfNotScopedWithMatchingAct(current$1);
       
 24468       }
       
 24469     }
       
 24470 
       
 24471     var suspenseConfig = requestCurrentSuspenseConfig();
       
 24472     var expirationTime = computeExpirationForFiber(currentTime, current$1, suspenseConfig);
       
 24473     var context = getContextForSubtree(parentComponent);
       
 24474 
       
 24475     if (container.context === null) {
       
 24476       container.context = context;
       
 24477     } else {
       
 24478       container.pendingContext = context;
       
 24479     }
       
 24480 
       
 24481     {
       
 24482       if (isRendering && current !== null && !didWarnAboutNestedUpdates) {
       
 24483         didWarnAboutNestedUpdates = true;
       
 24484 
       
 24485         error('Render methods should be a pure function of props and state; ' + 'triggering nested component updates from render is not allowed. ' + 'If necessary, trigger nested updates in componentDidUpdate.\n\n' + 'Check the render method of %s.', getComponentName(current.type) || 'Unknown');
       
 24486       }
       
 24487     }
       
 24488 
       
 24489     var update = createUpdate(expirationTime, suspenseConfig); // Caution: React DevTools currently depends on this property
       
 24490     // being called "element".
       
 24491 
       
 24492     update.payload = {
       
 24493       element: element
       
 24494     };
       
 24495     callback = callback === undefined ? null : callback;
       
 24496 
       
 24497     if (callback !== null) {
       
 24498       {
       
 24499         if (typeof callback !== 'function') {
       
 24500           error('render(...): Expected the last optional `callback` argument to be a ' + 'function. Instead received: %s.', callback);
       
 24501         }
       
 24502       }
       
 24503 
       
 24504       update.callback = callback;
       
 24505     }
       
 24506 
       
 24507     enqueueUpdate(current$1, update);
       
 24508     scheduleWork(current$1, expirationTime);
       
 24509     return expirationTime;
       
 24510   }
       
 24511   function getPublicRootInstance(container) {
       
 24512     var containerFiber = container.current;
       
 24513 
       
 24514     if (!containerFiber.child) {
       
 24515       return null;
       
 24516     }
       
 24517 
       
 24518     switch (containerFiber.child.tag) {
       
 24519       case HostComponent:
       
 24520         return getPublicInstance(containerFiber.child.stateNode);
       
 24521 
       
 24522       default:
       
 24523         return containerFiber.child.stateNode;
       
 24524     }
       
 24525   }
       
 24526 
       
 24527   function markRetryTimeImpl(fiber, retryTime) {
       
 24528     var suspenseState = fiber.memoizedState;
       
 24529 
       
 24530     if (suspenseState !== null && suspenseState.dehydrated !== null) {
       
 24531       if (suspenseState.retryTime < retryTime) {
       
 24532         suspenseState.retryTime = retryTime;
       
 24533       }
       
 24534     }
       
 24535   } // Increases the priority of thennables when they resolve within this boundary.
       
 24536 
       
 24537 
       
 24538   function markRetryTimeIfNotHydrated(fiber, retryTime) {
       
 24539     markRetryTimeImpl(fiber, retryTime);
       
 24540     var alternate = fiber.alternate;
       
 24541 
       
 24542     if (alternate) {
       
 24543       markRetryTimeImpl(alternate, retryTime);
       
 24544     }
       
 24545   }
       
 24546 
       
 24547   function attemptUserBlockingHydration$1(fiber) {
       
 24548     if (fiber.tag !== SuspenseComponent) {
       
 24549       // We ignore HostRoots here because we can't increase
       
 24550       // their priority and they should not suspend on I/O,
       
 24551       // since you have to wrap anything that might suspend in
       
 24552       // Suspense.
       
 24553       return;
       
 24554     }
       
 24555 
       
 24556     var expTime = computeInteractiveExpiration(requestCurrentTimeForUpdate());
       
 24557     scheduleWork(fiber, expTime);
       
 24558     markRetryTimeIfNotHydrated(fiber, expTime);
       
 24559   }
       
 24560   function attemptContinuousHydration$1(fiber) {
       
 24561     if (fiber.tag !== SuspenseComponent) {
       
 24562       // We ignore HostRoots here because we can't increase
       
 24563       // their priority and they should not suspend on I/O,
       
 24564       // since you have to wrap anything that might suspend in
       
 24565       // Suspense.
       
 24566       return;
       
 24567     }
       
 24568 
       
 24569     scheduleWork(fiber, ContinuousHydration);
       
 24570     markRetryTimeIfNotHydrated(fiber, ContinuousHydration);
       
 24571   }
       
 24572   function attemptHydrationAtCurrentPriority$1(fiber) {
       
 24573     if (fiber.tag !== SuspenseComponent) {
       
 24574       // We ignore HostRoots here because we can't increase
       
 24575       // their priority other than synchronously flush it.
       
 24576       return;
       
 24577     }
       
 24578 
       
 24579     var currentTime = requestCurrentTimeForUpdate();
       
 24580     var expTime = computeExpirationForFiber(currentTime, fiber, null);
       
 24581     scheduleWork(fiber, expTime);
       
 24582     markRetryTimeIfNotHydrated(fiber, expTime);
       
 24583   }
       
 24584   function findHostInstanceWithNoPortals(fiber) {
       
 24585     var hostFiber = findCurrentHostFiberWithNoPortals(fiber);
       
 24586 
 24539     if (hostFiber === null) {
 24587     if (hostFiber === null) {
 24540       return null;
 24588       return null;
 24541     }
 24589     }
 24542     if (hostFiber.mode & StrictMode) {
 24590 
 24543       var componentName = getComponentName(fiber.type) || 'Component';
 24591     if (hostFiber.tag === FundamentalComponent) {
 24544       if (!didWarnAboutFindNodeInStrictMode[componentName]) {
 24592       return hostFiber.stateNode.instance;
 24545         didWarnAboutFindNodeInStrictMode[componentName] = true;
 24593     }
 24546         if (fiber.mode & StrictMode) {
 24594 
 24547           warningWithoutStack$1(false, '%s is deprecated in StrictMode. ' + '%s was passed an instance of %s which is inside StrictMode. ' + 'Instead, add a ref directly to the element you want to reference.' + '\n%s' + '\n\nLearn more about using refs safely here:' + '\nhttps://fb.me/react-strict-mode-find-node', methodName, methodName, componentName, getStackByFiberInDevAndProd(hostFiber));
       
 24548         } else {
       
 24549           warningWithoutStack$1(false, '%s is deprecated in StrictMode. ' + '%s was passed an instance of %s which renders StrictMode children. ' + 'Instead, add a ref directly to the element you want to reference.' + '\n%s' + '\n\nLearn more about using refs safely here:' + '\nhttps://fb.me/react-strict-mode-find-node', methodName, methodName, componentName, getStackByFiberInDevAndProd(hostFiber));
       
 24550         }
       
 24551       }
       
 24552     }
       
 24553     return hostFiber.stateNode;
 24595     return hostFiber.stateNode;
 24554   }
 24596   }
 24555   return findHostInstance(component);
 24597 
 24556 }
 24598   var shouldSuspendImpl = function (fiber) {
 24557 
 24599     return false;
 24558 function createContainer(containerInfo, tag, hydrate) {
 24600   };
 24559   return createFiberRoot(containerInfo, tag, hydrate);
 24601 
 24560 }
 24602   function shouldSuspend(fiber) {
 24561 
 24603     return shouldSuspendImpl(fiber);
 24562 function updateContainer(element, container, parentComponent, callback) {
 24604   }
 24563   var current$$1 = container.current;
 24605   var overrideHookState = null;
 24564   var currentTime = requestCurrentTime();
 24606   var overrideProps = null;
       
 24607   var scheduleUpdate = null;
       
 24608   var setSuspenseHandler = null;
       
 24609 
 24565   {
 24610   {
 24566     // $FlowExpectedError - jest isn't a global, and isn't recognized outside of tests
 24611     var copyWithSetImpl = function (obj, path, idx, value) {
 24567     if ('undefined' !== typeof jest) {
 24612       if (idx >= path.length) {
 24568       warnIfUnmockedScheduler(current$$1);
 24613         return value;
 24569       warnIfNotScopedWithMatchingAct(current$$1);
 24614       }
 24570     }
 24615 
 24571   }
 24616       var key = path[idx];
 24572   var suspenseConfig = requestCurrentSuspenseConfig();
 24617       var updated = Array.isArray(obj) ? obj.slice() : _assign({}, obj); // $FlowFixMe number or string is fine here
 24573   var expirationTime = computeExpirationForFiber(currentTime, current$$1, suspenseConfig);
 24618 
 24574   return updateContainerAtExpirationTime(element, container, parentComponent, expirationTime, suspenseConfig, callback);
 24619       updated[key] = copyWithSetImpl(obj[key], path, idx + 1, value);
 24575 }
 24620       return updated;
 24576 
 24621     };
 24577 function getPublicRootInstance(container) {
 24622 
 24578   var containerFiber = container.current;
 24623     var copyWithSet = function (obj, path, value) {
 24579   if (!containerFiber.child) {
 24624       return copyWithSetImpl(obj, path, 0, value);
 24580     return null;
 24625     }; // Support DevTools editable values for useState and useReducer.
 24581   }
 24626 
 24582   switch (containerFiber.child.tag) {
 24627 
 24583     case HostComponent:
 24628     overrideHookState = function (fiber, id, path, value) {
 24584       return getPublicInstance(containerFiber.child.stateNode);
 24629       // For now, the "id" of stateful hooks is just the stateful hook index.
 24585     default:
 24630       // This may change in the future with e.g. nested hooks.
 24586       return containerFiber.child.stateNode;
 24631       var currentHook = fiber.memoizedState;
 24587   }
 24632 
 24588 }
 24633       while (currentHook !== null && id > 0) {
 24589 
 24634         currentHook = currentHook.next;
 24590 function findHostInstanceWithNoPortals(fiber) {
 24635         id--;
 24591   var hostFiber = findCurrentHostFiberWithNoPortals(fiber);
 24636       }
 24592   if (hostFiber === null) {
 24637 
 24593     return null;
 24638       if (currentHook !== null) {
 24594   }
 24639         var newState = copyWithSet(currentHook.memoizedState, path, value);
 24595   if (hostFiber.tag === FundamentalComponent) {
 24640         currentHook.memoizedState = newState;
 24596     return hostFiber.stateNode.instance;
 24641         currentHook.baseState = newState; // We aren't actually adding an update to the queue,
 24597   }
 24642         // because there is no update we can add for useReducer hooks that won't trigger an error.
 24598   return hostFiber.stateNode;
 24643         // (There's no appropriate action type for DevTools overrides.)
 24599 }
 24644         // As a result though, React will see the scheduled update as a noop and bailout.
 24600 
 24645         // Shallow cloning props works as a workaround for now to bypass the bailout check.
 24601 var shouldSuspendImpl = function (fiber) {
 24646 
 24602   return false;
 24647         fiber.memoizedProps = _assign({}, fiber.memoizedProps);
 24603 };
 24648         scheduleWork(fiber, Sync);
 24604 
 24649       }
 24605 function shouldSuspend(fiber) {
 24650     }; // Support DevTools props for function components, forwardRef, memo, host components, etc.
 24606   return shouldSuspendImpl(fiber);
 24651 
 24607 }
 24652 
 24608 
 24653     overrideProps = function (fiber, path, value) {
 24609 var overrideHookState = null;
 24654       fiber.pendingProps = copyWithSet(fiber.memoizedProps, path, value);
 24610 var overrideProps = null;
 24655 
 24611 var scheduleUpdate = null;
 24656       if (fiber.alternate) {
 24612 var setSuspenseHandler = null;
 24657         fiber.alternate.pendingProps = fiber.pendingProps;
 24613 
 24658       }
 24614 {
 24659 
 24615   var copyWithSetImpl = function (obj, path, idx, value) {
 24660       scheduleWork(fiber, Sync);
 24616     if (idx >= path.length) {
 24661     };
 24617       return value;
 24662 
 24618     }
 24663     scheduleUpdate = function (fiber) {
 24619     var key = path[idx];
 24664       scheduleWork(fiber, Sync);
 24620     var updated = Array.isArray(obj) ? obj.slice() : _assign({}, obj);
 24665     };
 24621     // $FlowFixMe number or string is fine here
 24666 
 24622     updated[key] = copyWithSetImpl(obj[key], path, idx + 1, value);
 24667     setSuspenseHandler = function (newShouldSuspendImpl) {
 24623     return updated;
 24668       shouldSuspendImpl = newShouldSuspendImpl;
       
 24669     };
       
 24670   }
       
 24671 
       
 24672   function injectIntoDevTools(devToolsConfig) {
       
 24673     var findFiberByHostInstance = devToolsConfig.findFiberByHostInstance;
       
 24674     var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
       
 24675     return injectInternals(_assign({}, devToolsConfig, {
       
 24676       overrideHookState: overrideHookState,
       
 24677       overrideProps: overrideProps,
       
 24678       setSuspenseHandler: setSuspenseHandler,
       
 24679       scheduleUpdate: scheduleUpdate,
       
 24680       currentDispatcherRef: ReactCurrentDispatcher,
       
 24681       findHostInstanceByFiber: function (fiber) {
       
 24682         var hostFiber = findCurrentHostFiber(fiber);
       
 24683 
       
 24684         if (hostFiber === null) {
       
 24685           return null;
       
 24686         }
       
 24687 
       
 24688         return hostFiber.stateNode;
       
 24689       },
       
 24690       findFiberByHostInstance: function (instance) {
       
 24691         if (!findFiberByHostInstance) {
       
 24692           // Might not be implemented by the renderer.
       
 24693           return null;
       
 24694         }
       
 24695 
       
 24696         return findFiberByHostInstance(instance);
       
 24697       },
       
 24698       // React Refresh
       
 24699       findHostInstancesForRefresh:  findHostInstancesForRefresh ,
       
 24700       scheduleRefresh:  scheduleRefresh ,
       
 24701       scheduleRoot:  scheduleRoot ,
       
 24702       setRefreshHandler:  setRefreshHandler ,
       
 24703       // Enables DevTools to append owner stacks to error messages in DEV mode.
       
 24704       getCurrentFiber:  function () {
       
 24705         return current;
       
 24706       } 
       
 24707     }));
       
 24708   }
       
 24709   var IsSomeRendererActing$1 = ReactSharedInternals.IsSomeRendererActing;
       
 24710 
       
 24711   function ReactDOMRoot(container, options) {
       
 24712     this._internalRoot = createRootImpl(container, ConcurrentRoot, options);
       
 24713   }
       
 24714 
       
 24715   function ReactDOMBlockingRoot(container, tag, options) {
       
 24716     this._internalRoot = createRootImpl(container, tag, options);
       
 24717   }
       
 24718 
       
 24719   ReactDOMRoot.prototype.render = ReactDOMBlockingRoot.prototype.render = function (children) {
       
 24720     var root = this._internalRoot;
       
 24721 
       
 24722     {
       
 24723       if (typeof arguments[1] === 'function') {
       
 24724         error('render(...): does not support the second callback argument. ' + 'To execute a side effect after rendering, declare it in a component body with useEffect().');
       
 24725       }
       
 24726 
       
 24727       var container = root.containerInfo;
       
 24728 
       
 24729       if (container.nodeType !== COMMENT_NODE) {
       
 24730         var hostInstance = findHostInstanceWithNoPortals(root.current);
       
 24731 
       
 24732         if (hostInstance) {
       
 24733           if (hostInstance.parentNode !== container) {
       
 24734             error('render(...): It looks like the React-rendered content of the ' + 'root container was removed without using React. This is not ' + 'supported and will cause errors. Instead, call ' + "root.unmount() to empty a root's container.");
       
 24735           }
       
 24736         }
       
 24737       }
       
 24738     }
       
 24739 
       
 24740     updateContainer(children, root, null, null);
 24624   };
 24741   };
 24625 
 24742 
 24626   var copyWithSet = function (obj, path, value) {
 24743   ReactDOMRoot.prototype.unmount = ReactDOMBlockingRoot.prototype.unmount = function () {
 24627     return copyWithSetImpl(obj, path, 0, value);
 24744     {
       
 24745       if (typeof arguments[0] === 'function') {
       
 24746         error('unmount(...): does not support a callback argument. ' + 'To execute a side effect after rendering, declare it in a component body with useEffect().');
       
 24747       }
       
 24748     }
       
 24749 
       
 24750     var root = this._internalRoot;
       
 24751     var container = root.containerInfo;
       
 24752     updateContainer(null, root, null, function () {
       
 24753       unmarkContainerAsRoot(container);
       
 24754     });
 24628   };
 24755   };
 24629 
 24756 
 24630   // Support DevTools editable values for useState and useReducer.
 24757   function createRootImpl(container, tag, options) {
 24631   overrideHookState = function (fiber, id, path, value) {
 24758     // Tag is either LegacyRoot or Concurrent Root
 24632     // For now, the "id" of stateful hooks is just the stateful hook index.
 24759     var hydrate = options != null && options.hydrate === true;
 24633     // This may change in the future with e.g. nested hooks.
 24760     var hydrationCallbacks = options != null && options.hydrationOptions || null;
 24634     var currentHook = fiber.memoizedState;
 24761     var root = createContainer(container, tag, hydrate);
 24635     while (currentHook !== null && id > 0) {
 24762     markContainerAsRoot(root.current, container);
 24636       currentHook = currentHook.next;
 24763 
 24637       id--;
 24764     if (hydrate && tag !== LegacyRoot) {
 24638     }
 24765       var doc = container.nodeType === DOCUMENT_NODE ? container : container.ownerDocument;
 24639     if (currentHook !== null) {
 24766       eagerlyTrapReplayableEvents(container, doc);
 24640       if (revertPassiveEffectsChange) {
 24767     }
 24641         flushPassiveEffects();
 24768 
 24642       }
 24769     return root;
 24643 
 24770   }
 24644       var newState = copyWithSet(currentHook.memoizedState, path, value);
 24771   function createLegacyRoot(container, options) {
 24645       currentHook.memoizedState = newState;
 24772     return new ReactDOMBlockingRoot(container, LegacyRoot, options);
 24646       currentHook.baseState = newState;
 24773   }
 24647 
 24774   function isValidContainer(node) {
 24648       // We aren't actually adding an update to the queue,
 24775     return !!(node && (node.nodeType === ELEMENT_NODE || node.nodeType === DOCUMENT_NODE || node.nodeType === DOCUMENT_FRAGMENT_NODE || node.nodeType === COMMENT_NODE && node.nodeValue === ' react-mount-point-unstable '));
 24649       // because there is no update we can add for useReducer hooks that won't trigger an error.
 24776   }
 24650       // (There's no appropriate action type for DevTools overrides.)
 24777 
 24651       // As a result though, React will see the scheduled update as a noop and bailout.
 24778   var ReactCurrentOwner$3 = ReactSharedInternals.ReactCurrentOwner;
 24652       // Shallow cloning props works as a workaround for now to bypass the bailout check.
 24779   var topLevelUpdateWarnings;
 24653       fiber.memoizedProps = _assign({}, fiber.memoizedProps);
 24780   var warnedAboutHydrateAPI = false;
 24654 
 24781 
 24655       scheduleWork(fiber, Sync);
 24782   {
 24656     }
 24783     topLevelUpdateWarnings = function (container) {
 24657   };
 24784       if (container._reactRootContainer && container.nodeType !== COMMENT_NODE) {
 24658 
 24785         var hostInstance = findHostInstanceWithNoPortals(container._reactRootContainer._internalRoot.current);
 24659   // Support DevTools props for function components, forwardRef, memo, host components, etc.
 24786 
 24660   overrideProps = function (fiber, path, value) {
 24787         if (hostInstance) {
 24661     if (revertPassiveEffectsChange) {
 24788           if (hostInstance.parentNode !== container) {
 24662       flushPassiveEffects();
 24789             error('render(...): It looks like the React-rendered content of this ' + 'container was removed without using React. This is not ' + 'supported and will cause errors. Instead, call ' + 'ReactDOM.unmountComponentAtNode to empty a container.');
 24663     }
 24790           }
 24664     fiber.pendingProps = copyWithSet(fiber.memoizedProps, path, value);
 24791         }
 24665     if (fiber.alternate) {
 24792       }
 24666       fiber.alternate.pendingProps = fiber.pendingProps;
 24793 
 24667     }
 24794       var isRootRenderedBySomeReact = !!container._reactRootContainer;
 24668     scheduleWork(fiber, Sync);
 24795       var rootEl = getReactRootElementInContainer(container);
 24669   };
 24796       var hasNonRootReactChild = !!(rootEl && getInstanceFromNode$1(rootEl));
 24670 
 24797 
 24671   scheduleUpdate = function (fiber) {
 24798       if (hasNonRootReactChild && !isRootRenderedBySomeReact) {
 24672     if (revertPassiveEffectsChange) {
 24799         error('render(...): Replacing React-rendered children with a new root ' + 'component. If you intended to update the children of this node, ' + 'you should instead have the existing children update their state ' + 'and render the new components instead of calling ReactDOM.render.');
 24673       flushPassiveEffects();
 24800       }
 24674     }
 24801 
 24675     scheduleWork(fiber, Sync);
 24802       if (container.nodeType === ELEMENT_NODE && container.tagName && container.tagName.toUpperCase() === 'BODY') {
 24676   };
 24803         error('render(): Rendering components directly into document.body is ' + 'discouraged, since its children are often manipulated by third-party ' + 'scripts and browser extensions. This may lead to subtle ' + 'reconciliation issues. Try rendering into a container element created ' + 'for your app.');
 24677 
 24804       }
 24678   setSuspenseHandler = function (newShouldSuspendImpl) {
 24805     };
 24679     shouldSuspendImpl = newShouldSuspendImpl;
 24806   }
 24680   };
 24807 
 24681 }
 24808   function getReactRootElementInContainer(container) {
 24682 
 24809     if (!container) {
 24683 function injectIntoDevTools(devToolsConfig) {
 24810       return null;
 24684   var findFiberByHostInstance = devToolsConfig.findFiberByHostInstance;
 24811     }
 24685   var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
 24812 
 24686 
 24813     if (container.nodeType === DOCUMENT_NODE) {
 24687 
 24814       return container.documentElement;
 24688   return injectInternals(_assign({}, devToolsConfig, {
 24815     } else {
 24689     overrideHookState: overrideHookState,
 24816       return container.firstChild;
 24690     overrideProps: overrideProps,
 24817     }
 24691     setSuspenseHandler: setSuspenseHandler,
 24818   }
 24692     scheduleUpdate: scheduleUpdate,
 24819 
 24693     currentDispatcherRef: ReactCurrentDispatcher,
 24820   function shouldHydrateDueToLegacyHeuristic(container) {
 24694     findHostInstanceByFiber: function (fiber) {
 24821     var rootElement = getReactRootElementInContainer(container);
 24695       var hostFiber = findCurrentHostFiber(fiber);
 24822     return !!(rootElement && rootElement.nodeType === ELEMENT_NODE && rootElement.hasAttribute(ROOT_ATTRIBUTE_NAME));
 24696       if (hostFiber === null) {
 24823   }
 24697         return null;
 24824 
 24698       }
 24825   function legacyCreateRootFromDOMContainer(container, forceHydrate) {
 24699       return hostFiber.stateNode;
 24826     var shouldHydrate = forceHydrate || shouldHydrateDueToLegacyHeuristic(container); // First clear any existing content.
 24700     },
 24827 
 24701     findFiberByHostInstance: function (instance) {
 24828     if (!shouldHydrate) {
 24702       if (!findFiberByHostInstance) {
 24829       var warned = false;
 24703         // Might not be implemented by the renderer.
 24830       var rootSibling;
 24704         return null;
 24831 
 24705       }
 24832       while (rootSibling = container.lastChild) {
 24706       return findFiberByHostInstance(instance);
       
 24707     },
       
 24708 
       
 24709     // React Refresh
       
 24710     findHostInstancesForRefresh: findHostInstancesForRefresh,
       
 24711     scheduleRefresh: scheduleRefresh,
       
 24712     scheduleRoot: scheduleRoot,
       
 24713     setRefreshHandler: setRefreshHandler,
       
 24714     // Enables DevTools to append owner stacks to error messages in DEV mode.
       
 24715     getCurrentFiber: function () {
       
 24716       return current;
       
 24717     }
       
 24718   }));
       
 24719 }
       
 24720 
       
 24721 // This file intentionally does *not* have the Flow annotation.
       
 24722 // Don't add it. See `./inline-typed.js` for an explanation.
       
 24723 
       
 24724 function createPortal$1(children, containerInfo,
       
 24725 // TODO: figure out the API for cross-renderer implementation.
       
 24726 implementation) {
       
 24727   var key = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
       
 24728 
       
 24729   return {
       
 24730     // This tag allow us to uniquely identify this as a React Portal
       
 24731     $$typeof: REACT_PORTAL_TYPE,
       
 24732     key: key == null ? null : '' + key,
       
 24733     children: children,
       
 24734     containerInfo: containerInfo,
       
 24735     implementation: implementation
       
 24736   };
       
 24737 }
       
 24738 
       
 24739 // TODO: this is special because it gets imported during build.
       
 24740 
       
 24741 var ReactVersion = '16.9.0';
       
 24742 
       
 24743 // TODO: This type is shared between the reconciler and ReactDOM, but will
       
 24744 // eventually be lifted out to the renderer.
       
 24745 
       
 24746 var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
       
 24747 
       
 24748 var topLevelUpdateWarnings = void 0;
       
 24749 var warnOnInvalidCallback = void 0;
       
 24750 var didWarnAboutUnstableCreatePortal = false;
       
 24751 
       
 24752 {
       
 24753   if (typeof Map !== 'function' ||
       
 24754   // $FlowIssue Flow incorrectly thinks Map has no prototype
       
 24755   Map.prototype == null || typeof Map.prototype.forEach !== 'function' || typeof Set !== 'function' ||
       
 24756   // $FlowIssue Flow incorrectly thinks Set has no prototype
       
 24757   Set.prototype == null || typeof Set.prototype.clear !== 'function' || typeof Set.prototype.forEach !== 'function') {
       
 24758     warningWithoutStack$1(false, 'React depends on Map and Set built-in types. Make sure that you load a ' + 'polyfill in older browsers. https://fb.me/react-polyfills');
       
 24759   }
       
 24760 
       
 24761   topLevelUpdateWarnings = function (container) {
       
 24762     if (container._reactRootContainer && container.nodeType !== COMMENT_NODE) {
       
 24763       var hostInstance = findHostInstanceWithNoPortals(container._reactRootContainer._internalRoot.current);
       
 24764       if (hostInstance) {
       
 24765         !(hostInstance.parentNode === container) ? warningWithoutStack$1(false, 'render(...): It looks like the React-rendered content of this ' + 'container was removed without using React. This is not ' + 'supported and will cause errors. Instead, call ' + 'ReactDOM.unmountComponentAtNode to empty a container.') : void 0;
       
 24766       }
       
 24767     }
       
 24768 
       
 24769     var isRootRenderedBySomeReact = !!container._reactRootContainer;
       
 24770     var rootEl = getReactRootElementInContainer(container);
       
 24771     var hasNonRootReactChild = !!(rootEl && getInstanceFromNode$1(rootEl));
       
 24772 
       
 24773     !(!hasNonRootReactChild || isRootRenderedBySomeReact) ? warningWithoutStack$1(false, 'render(...): Replacing React-rendered children with a new root ' + 'component. If you intended to update the children of this node, ' + 'you should instead have the existing children update their state ' + 'and render the new components instead of calling ReactDOM.render.') : void 0;
       
 24774 
       
 24775     !(container.nodeType !== ELEMENT_NODE || !container.tagName || container.tagName.toUpperCase() !== 'BODY') ? warningWithoutStack$1(false, 'render(): Rendering components directly into document.body is ' + 'discouraged, since its children are often manipulated by third-party ' + 'scripts and browser extensions. This may lead to subtle ' + 'reconciliation issues. Try rendering into a container element created ' + 'for your app.') : void 0;
       
 24776   };
       
 24777 
       
 24778   warnOnInvalidCallback = function (callback, callerName) {
       
 24779     !(callback === null || typeof callback === 'function') ? warningWithoutStack$1(false, '%s(...): Expected the last optional `callback` argument to be a ' + 'function. Instead received: %s.', callerName, callback) : void 0;
       
 24780   };
       
 24781 }
       
 24782 
       
 24783 setRestoreImplementation(restoreControlledState$1);
       
 24784 
       
 24785 function ReactBatch(root) {
       
 24786   var expirationTime = computeUniqueAsyncExpiration();
       
 24787   this._expirationTime = expirationTime;
       
 24788   this._root = root;
       
 24789   this._next = null;
       
 24790   this._callbacks = null;
       
 24791   this._didComplete = false;
       
 24792   this._hasChildren = false;
       
 24793   this._children = null;
       
 24794   this._defer = true;
       
 24795 }
       
 24796 ReactBatch.prototype.render = function (children) {
       
 24797   var _this = this;
       
 24798 
       
 24799   (function () {
       
 24800     if (!_this._defer) {
       
 24801       {
       
 24802         throw ReactError(Error('batch.render: Cannot render a batch that already committed.'));
       
 24803       }
       
 24804     }
       
 24805   })();
       
 24806   this._hasChildren = true;
       
 24807   this._children = children;
       
 24808   var internalRoot = this._root._internalRoot;
       
 24809   var expirationTime = this._expirationTime;
       
 24810   var work = new ReactWork();
       
 24811   updateContainerAtExpirationTime(children, internalRoot, null, expirationTime, null, work._onCommit);
       
 24812   return work;
       
 24813 };
       
 24814 ReactBatch.prototype.then = function (onComplete) {
       
 24815   if (this._didComplete) {
       
 24816     onComplete();
       
 24817     return;
       
 24818   }
       
 24819   var callbacks = this._callbacks;
       
 24820   if (callbacks === null) {
       
 24821     callbacks = this._callbacks = [];
       
 24822   }
       
 24823   callbacks.push(onComplete);
       
 24824 };
       
 24825 ReactBatch.prototype.commit = function () {
       
 24826   var _this2 = this;
       
 24827 
       
 24828   var internalRoot = this._root._internalRoot;
       
 24829   var firstBatch = internalRoot.firstBatch;
       
 24830   (function () {
       
 24831     if (!(_this2._defer && firstBatch !== null)) {
       
 24832       {
       
 24833         throw ReactError(Error('batch.commit: Cannot commit a batch multiple times.'));
       
 24834       }
       
 24835     }
       
 24836   })();
       
 24837 
       
 24838   if (!this._hasChildren) {
       
 24839     // This batch is empty. Return.
       
 24840     this._next = null;
       
 24841     this._defer = false;
       
 24842     return;
       
 24843   }
       
 24844 
       
 24845   var expirationTime = this._expirationTime;
       
 24846 
       
 24847   // Ensure this is the first batch in the list.
       
 24848   if (firstBatch !== this) {
       
 24849     // This batch is not the earliest batch. We need to move it to the front.
       
 24850     // Update its expiration time to be the expiration time of the earliest
       
 24851     // batch, so that we can flush it without flushing the other batches.
       
 24852     if (this._hasChildren) {
       
 24853       expirationTime = this._expirationTime = firstBatch._expirationTime;
       
 24854       // Rendering this batch again ensures its children will be the final state
       
 24855       // when we flush (updates are processed in insertion order: last
       
 24856       // update wins).
       
 24857       // TODO: This forces a restart. Should we print a warning?
       
 24858       this.render(this._children);
       
 24859     }
       
 24860 
       
 24861     // Remove the batch from the list.
       
 24862     var previous = null;
       
 24863     var batch = firstBatch;
       
 24864     while (batch !== this) {
       
 24865       previous = batch;
       
 24866       batch = batch._next;
       
 24867     }
       
 24868     (function () {
       
 24869       if (!(previous !== null)) {
       
 24870         {
 24833         {
 24871           throw ReactError(Error('batch.commit: Cannot commit a batch multiple times.'));
 24834           if (!warned && rootSibling.nodeType === ELEMENT_NODE && rootSibling.hasAttribute(ROOT_ATTRIBUTE_NAME)) {
 24872         }
 24835             warned = true;
 24873       }
 24836 
 24874     })();
 24837             error('render(): Target node has markup rendered by React, but there ' + 'are unrelated nodes as well. This is most commonly caused by ' + 'white-space inserted around server-rendered markup.');
 24875     previous._next = batch._next;
 24838           }
 24876 
 24839         }
 24877     // Add it to the front.
 24840 
 24878     this._next = firstBatch;
 24841         container.removeChild(rootSibling);
 24879     firstBatch = internalRoot.firstBatch = this;
 24842       }
 24880   }
 24843     }
 24881 
 24844 
 24882   // Synchronously flush all the work up to this batch's expiration time.
 24845     {
 24883   this._defer = false;
 24846       if (shouldHydrate && !forceHydrate && !warnedAboutHydrateAPI) {
 24884   flushRoot(internalRoot, expirationTime);
 24847         warnedAboutHydrateAPI = true;
 24885 
 24848 
 24886   // Pop the batch from the list.
 24849         warn('render(): Calling ReactDOM.render() to hydrate server-rendered markup ' + 'will stop working in React v17. Replace the ReactDOM.render() call ' + 'with ReactDOM.hydrate() if you want React to attach to the server HTML.');
 24887   var next = this._next;
 24850       }
 24888   this._next = null;
 24851     }
 24889   firstBatch = internalRoot.firstBatch = next;
 24852 
 24890 
 24853     return createLegacyRoot(container, shouldHydrate ? {
 24891   // Append the next earliest batch's children to the update queue.
 24854       hydrate: true
 24892   if (firstBatch !== null && firstBatch._hasChildren) {
 24855     } : undefined);
 24893     firstBatch.render(firstBatch._children);
 24856   }
 24894   }
 24857 
 24895 };
 24858   function warnOnInvalidCallback$1(callback, callerName) {
 24896 ReactBatch.prototype._onComplete = function () {
 24859     {
 24897   if (this._didComplete) {
 24860       if (callback !== null && typeof callback !== 'function') {
 24898     return;
 24861         error('%s(...): Expected the last optional `callback` argument to be a ' + 'function. Instead received: %s.', callerName, callback);
 24899   }
 24862       }
 24900   this._didComplete = true;
 24863     }
 24901   var callbacks = this._callbacks;
 24864   }
 24902   if (callbacks === null) {
 24865 
 24903     return;
 24866   function legacyRenderSubtreeIntoContainer(parentComponent, children, container, forceHydrate, callback) {
 24904   }
 24867     {
 24905   // TODO: Error handling.
 24868       topLevelUpdateWarnings(container);
 24906   for (var i = 0; i < callbacks.length; i++) {
 24869       warnOnInvalidCallback$1(callback === undefined ? null : callback, 'render');
 24907     var _callback = callbacks[i];
 24870     } // TODO: Without `any` type, Flow says "Property cannot be accessed on any
 24908     _callback();
 24871     // member of intersection type." Whyyyyyy.
 24909   }
 24872 
 24910 };
 24873 
 24911 
 24874     var root = container._reactRootContainer;
 24912 function ReactWork() {
 24875     var fiberRoot;
 24913   this._callbacks = null;
 24876 
 24914   this._didCommit = false;
 24877     if (!root) {
 24915   // TODO: Avoid need to bind by replacing callbacks in the update queue with
 24878       // Initial mount
 24916   // list of Work objects.
 24879       root = container._reactRootContainer = legacyCreateRootFromDOMContainer(container, forceHydrate);
 24917   this._onCommit = this._onCommit.bind(this);
 24880       fiberRoot = root._internalRoot;
 24918 }
 24881 
 24919 ReactWork.prototype.then = function (onCommit) {
 24882       if (typeof callback === 'function') {
 24920   if (this._didCommit) {
 24883         var originalCallback = callback;
 24921     onCommit();
 24884 
 24922     return;
 24885         callback = function () {
 24923   }
 24886           var instance = getPublicRootInstance(fiberRoot);
 24924   var callbacks = this._callbacks;
 24887           originalCallback.call(instance);
 24925   if (callbacks === null) {
 24888         };
 24926     callbacks = this._callbacks = [];
 24889       } // Initial mount should not be batched.
 24927   }
 24890 
 24928   callbacks.push(onCommit);
 24891 
 24929 };
 24892       unbatchedUpdates(function () {
 24930 ReactWork.prototype._onCommit = function () {
 24893         updateContainer(children, fiberRoot, parentComponent, callback);
 24931   if (this._didCommit) {
 24894       });
 24932     return;
 24895     } else {
 24933   }
 24896       fiberRoot = root._internalRoot;
 24934   this._didCommit = true;
 24897 
 24935   var callbacks = this._callbacks;
 24898       if (typeof callback === 'function') {
 24936   if (callbacks === null) {
 24899         var _originalCallback = callback;
 24937     return;
 24900 
 24938   }
 24901         callback = function () {
 24939   // TODO: Error handling.
 24902           var instance = getPublicRootInstance(fiberRoot);
 24940   for (var i = 0; i < callbacks.length; i++) {
 24903 
 24941     var _callback2 = callbacks[i];
 24904           _originalCallback.call(instance);
 24942     (function () {
 24905         };
 24943       if (!(typeof _callback2 === 'function')) {
 24906       } // Update
 24944         {
 24907 
 24945           throw ReactError(Error('Invalid argument passed as callback. Expected a function. Instead received: ' + _callback2));
 24908 
 24946         }
       
 24947       }
       
 24948     })();
       
 24949     _callback2();
       
 24950   }
       
 24951 };
       
 24952 
       
 24953 function ReactSyncRoot(container, tag, hydrate) {
       
 24954   // Tag is either LegacyRoot or Concurrent Root
       
 24955   var root = createContainer(container, tag, hydrate);
       
 24956   this._internalRoot = root;
       
 24957 }
       
 24958 
       
 24959 function ReactRoot(container, hydrate) {
       
 24960   var root = createContainer(container, ConcurrentRoot, hydrate);
       
 24961   this._internalRoot = root;
       
 24962 }
       
 24963 
       
 24964 ReactRoot.prototype.render = ReactSyncRoot.prototype.render = function (children, callback) {
       
 24965   var root = this._internalRoot;
       
 24966   var work = new ReactWork();
       
 24967   callback = callback === undefined ? null : callback;
       
 24968   {
       
 24969     warnOnInvalidCallback(callback, 'render');
       
 24970   }
       
 24971   if (callback !== null) {
       
 24972     work.then(callback);
       
 24973   }
       
 24974   updateContainer(children, root, null, work._onCommit);
       
 24975   return work;
       
 24976 };
       
 24977 
       
 24978 ReactRoot.prototype.unmount = ReactSyncRoot.prototype.unmount = function (callback) {
       
 24979   var root = this._internalRoot;
       
 24980   var work = new ReactWork();
       
 24981   callback = callback === undefined ? null : callback;
       
 24982   {
       
 24983     warnOnInvalidCallback(callback, 'render');
       
 24984   }
       
 24985   if (callback !== null) {
       
 24986     work.then(callback);
       
 24987   }
       
 24988   updateContainer(null, root, null, work._onCommit);
       
 24989   return work;
       
 24990 };
       
 24991 
       
 24992 // Sync roots cannot create batches. Only concurrent ones.
       
 24993 ReactRoot.prototype.createBatch = function () {
       
 24994   var batch = new ReactBatch(this);
       
 24995   var expirationTime = batch._expirationTime;
       
 24996 
       
 24997   var internalRoot = this._internalRoot;
       
 24998   var firstBatch = internalRoot.firstBatch;
       
 24999   if (firstBatch === null) {
       
 25000     internalRoot.firstBatch = batch;
       
 25001     batch._next = null;
       
 25002   } else {
       
 25003     // Insert sorted by expiration time then insertion order
       
 25004     var insertAfter = null;
       
 25005     var insertBefore = firstBatch;
       
 25006     while (insertBefore !== null && insertBefore._expirationTime >= expirationTime) {
       
 25007       insertAfter = insertBefore;
       
 25008       insertBefore = insertBefore._next;
       
 25009     }
       
 25010     batch._next = insertBefore;
       
 25011     if (insertAfter !== null) {
       
 25012       insertAfter._next = batch;
       
 25013     }
       
 25014   }
       
 25015 
       
 25016   return batch;
       
 25017 };
       
 25018 
       
 25019 /**
       
 25020  * True if the supplied DOM node is a valid node element.
       
 25021  *
       
 25022  * @param {?DOMElement} node The candidate DOM node.
       
 25023  * @return {boolean} True if the DOM is a valid DOM node.
       
 25024  * @internal
       
 25025  */
       
 25026 function isValidContainer(node) {
       
 25027   return !!(node && (node.nodeType === ELEMENT_NODE || node.nodeType === DOCUMENT_NODE || node.nodeType === DOCUMENT_FRAGMENT_NODE || node.nodeType === COMMENT_NODE && node.nodeValue === ' react-mount-point-unstable '));
       
 25028 }
       
 25029 
       
 25030 function getReactRootElementInContainer(container) {
       
 25031   if (!container) {
       
 25032     return null;
       
 25033   }
       
 25034 
       
 25035   if (container.nodeType === DOCUMENT_NODE) {
       
 25036     return container.documentElement;
       
 25037   } else {
       
 25038     return container.firstChild;
       
 25039   }
       
 25040 }
       
 25041 
       
 25042 function shouldHydrateDueToLegacyHeuristic(container) {
       
 25043   var rootElement = getReactRootElementInContainer(container);
       
 25044   return !!(rootElement && rootElement.nodeType === ELEMENT_NODE && rootElement.hasAttribute(ROOT_ATTRIBUTE_NAME));
       
 25045 }
       
 25046 
       
 25047 setBatchingImplementation(batchedUpdates$1, discreteUpdates$1, flushDiscreteUpdates, batchedEventUpdates$1);
       
 25048 
       
 25049 var warnedAboutHydrateAPI = false;
       
 25050 
       
 25051 function legacyCreateRootFromDOMContainer(container, forceHydrate) {
       
 25052   var shouldHydrate = forceHydrate || shouldHydrateDueToLegacyHeuristic(container);
       
 25053   // First clear any existing content.
       
 25054   if (!shouldHydrate) {
       
 25055     var warned = false;
       
 25056     var rootSibling = void 0;
       
 25057     while (rootSibling = container.lastChild) {
       
 25058       {
       
 25059         if (!warned && rootSibling.nodeType === ELEMENT_NODE && rootSibling.hasAttribute(ROOT_ATTRIBUTE_NAME)) {
       
 25060           warned = true;
       
 25061           warningWithoutStack$1(false, 'render(): Target node has markup rendered by React, but there ' + 'are unrelated nodes as well. This is most commonly caused by ' + 'white-space inserted around server-rendered markup.');
       
 25062         }
       
 25063       }
       
 25064       container.removeChild(rootSibling);
       
 25065     }
       
 25066   }
       
 25067   {
       
 25068     if (shouldHydrate && !forceHydrate && !warnedAboutHydrateAPI) {
       
 25069       warnedAboutHydrateAPI = true;
       
 25070       lowPriorityWarning$1(false, 'render(): Calling ReactDOM.render() to hydrate server-rendered markup ' + 'will stop working in React v17. Replace the ReactDOM.render() call ' + 'with ReactDOM.hydrate() if you want React to attach to the server HTML.');
       
 25071     }
       
 25072   }
       
 25073 
       
 25074   // Legacy roots are not batched.
       
 25075   return new ReactSyncRoot(container, LegacyRoot, shouldHydrate);
       
 25076 }
       
 25077 
       
 25078 function legacyRenderSubtreeIntoContainer(parentComponent, children, container, forceHydrate, callback) {
       
 25079   {
       
 25080     topLevelUpdateWarnings(container);
       
 25081     warnOnInvalidCallback(callback === undefined ? null : callback, 'render');
       
 25082   }
       
 25083 
       
 25084   // TODO: Without `any` type, Flow says "Property cannot be accessed on any
       
 25085   // member of intersection type." Whyyyyyy.
       
 25086   var root = container._reactRootContainer;
       
 25087   var fiberRoot = void 0;
       
 25088   if (!root) {
       
 25089     // Initial mount
       
 25090     root = container._reactRootContainer = legacyCreateRootFromDOMContainer(container, forceHydrate);
       
 25091     fiberRoot = root._internalRoot;
       
 25092     if (typeof callback === 'function') {
       
 25093       var originalCallback = callback;
       
 25094       callback = function () {
       
 25095         var instance = getPublicRootInstance(fiberRoot);
       
 25096         originalCallback.call(instance);
       
 25097       };
       
 25098     }
       
 25099     // Initial mount should not be batched.
       
 25100     unbatchedUpdates(function () {
       
 25101       updateContainer(children, fiberRoot, parentComponent, callback);
 24909       updateContainer(children, fiberRoot, parentComponent, callback);
 25102     });
 24910     }
 25103   } else {
 24911 
 25104     fiberRoot = root._internalRoot;
 24912     return getPublicRootInstance(fiberRoot);
 25105     if (typeof callback === 'function') {
 24913   }
 25106       var _originalCallback = callback;
 24914 
 25107       callback = function () {
 24915   function findDOMNode(componentOrElement) {
 25108         var instance = getPublicRootInstance(fiberRoot);
 24916     {
 25109         _originalCallback.call(instance);
 24917       var owner = ReactCurrentOwner$3.current;
 25110       };
 24918 
 25111     }
 24919       if (owner !== null && owner.stateNode !== null) {
 25112     // Update
 24920         var warnedAboutRefsInRender = owner.stateNode._warnedAboutRefsInRender;
 25113     updateContainer(children, fiberRoot, parentComponent, callback);
 24921 
 25114   }
 24922         if (!warnedAboutRefsInRender) {
 25115   return getPublicRootInstance(fiberRoot);
 24923           error('%s is accessing findDOMNode inside its render(). ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', getComponentName(owner.type) || 'A component');
 25116 }
 24924         }
 25117 
 24925 
 25118 function createPortal$$1(children, container) {
 24926         owner.stateNode._warnedAboutRefsInRender = true;
 25119   var key = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
 24927       }
 25120 
 24928     }
 25121   (function () {
 24929 
       
 24930     if (componentOrElement == null) {
       
 24931       return null;
       
 24932     }
       
 24933 
       
 24934     if (componentOrElement.nodeType === ELEMENT_NODE) {
       
 24935       return componentOrElement;
       
 24936     }
       
 24937 
       
 24938     {
       
 24939       return findHostInstanceWithWarning(componentOrElement, 'findDOMNode');
       
 24940     }
       
 24941   }
       
 24942   function hydrate(element, container, callback) {
 25122     if (!isValidContainer(container)) {
 24943     if (!isValidContainer(container)) {
 25123       {
 24944       {
 25124         throw ReactError(Error('Target container is not a DOM element.'));
 24945         throw Error( "Target container is not a DOM element." );
 25125       }
 24946       }
 25126     }
 24947     }
 25127   })();
 24948 
 25128   // TODO: pass ReactDOM portal implementation as third argument
       
 25129   return createPortal$1(children, container, null, key);
       
 25130 }
       
 25131 
       
 25132 var ReactDOM = {
       
 25133   createPortal: createPortal$$1,
       
 25134 
       
 25135   findDOMNode: function (componentOrElement) {
       
 25136     {
 24949     {
 25137       var owner = ReactCurrentOwner.current;
 24950       var isModernRoot = isContainerMarkedAsRoot(container) && container._reactRootContainer === undefined;
 25138       if (owner !== null && owner.stateNode !== null) {
 24951 
 25139         var warnedAboutRefsInRender = owner.stateNode._warnedAboutRefsInRender;
 24952       if (isModernRoot) {
 25140         !warnedAboutRefsInRender ? warningWithoutStack$1(false, '%s is accessing findDOMNode inside its render(). ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', getComponentName(owner.type) || 'A component') : void 0;
 24953         error('You are calling ReactDOM.hydrate() on a container that was previously ' + 'passed to ReactDOM.createRoot(). This is not supported. ' + 'Did you mean to call createRoot(container, {hydrate: true}).render(element)?');
 25141         owner.stateNode._warnedAboutRefsInRender = true;
 24954       }
 25142       }
 24955     } // TODO: throw or warn if we couldn't hydrate?
 25143     }
 24956 
 25144     if (componentOrElement == null) {
 24957 
 25145       return null;
 24958     return legacyRenderSubtreeIntoContainer(null, element, container, true, callback);
 25146     }
 24959   }
 25147     if (componentOrElement.nodeType === ELEMENT_NODE) {
 24960   function render(element, container, callback) {
 25148       return componentOrElement;
 24961     if (!isValidContainer(container)) {
 25149     }
 24962       {
       
 24963         throw Error( "Target container is not a DOM element." );
       
 24964       }
       
 24965     }
       
 24966 
 25150     {
 24967     {
 25151       return findHostInstanceWithWarning(componentOrElement, 'findDOMNode');
 24968       var isModernRoot = isContainerMarkedAsRoot(container) && container._reactRootContainer === undefined;
 25152     }
 24969 
 25153     return findHostInstance(componentOrElement);
 24970       if (isModernRoot) {
 25154   },
 24971         error('You are calling ReactDOM.render() on a container that was previously ' + 'passed to ReactDOM.createRoot(). This is not supported. ' + 'Did you mean to call root.render(element)?');
 25155   hydrate: function (element, container, callback) {
 24972       }
 25156     (function () {
 24973     }
 25157       if (!isValidContainer(container)) {
 24974 
 25158         {
 24975     return legacyRenderSubtreeIntoContainer(null, element, container, false, callback);
 25159           throw ReactError(Error('Target container is not a DOM element.'));
 24976   }
 25160         }
 24977   function unstable_renderSubtreeIntoContainer(parentComponent, element, containerNode, callback) {
 25161       }
 24978     if (!isValidContainer(containerNode)) {
 25162     })();
 24979       {
       
 24980         throw Error( "Target container is not a DOM element." );
       
 24981       }
       
 24982     }
       
 24983 
       
 24984     if (!(parentComponent != null && has$1(parentComponent))) {
       
 24985       {
       
 24986         throw Error( "parentComponent must be a valid React Component" );
       
 24987       }
       
 24988     }
       
 24989 
       
 24990     return legacyRenderSubtreeIntoContainer(parentComponent, element, containerNode, false, callback);
       
 24991   }
       
 24992   function unmountComponentAtNode(container) {
       
 24993     if (!isValidContainer(container)) {
       
 24994       {
       
 24995         throw Error( "unmountComponentAtNode(...): Target container is not a DOM element." );
       
 24996       }
       
 24997     }
       
 24998 
 25163     {
 24999     {
 25164       !!container._reactHasBeenPassedToCreateRootDEV ? warningWithoutStack$1(false, 'You are calling ReactDOM.hydrate() on a container that was previously ' + 'passed to ReactDOM.%s(). This is not supported. ' + 'Did you mean to call createRoot(container, {hydrate: true}).render(element)?', enableStableConcurrentModeAPIs ? 'createRoot' : 'unstable_createRoot') : void 0;
 25000       var isModernRoot = isContainerMarkedAsRoot(container) && container._reactRootContainer === undefined;
 25165     }
 25001 
 25166     // TODO: throw or warn if we couldn't hydrate?
 25002       if (isModernRoot) {
 25167     return legacyRenderSubtreeIntoContainer(null, element, container, true, callback);
 25003         error('You are calling ReactDOM.unmountComponentAtNode() on a container that was previously ' + 'passed to ReactDOM.createRoot(). This is not supported. Did you mean to call root.unmount()?');
 25168   },
 25004       }
 25169   render: function (element, container, callback) {
       
 25170     (function () {
       
 25171       if (!isValidContainer(container)) {
       
 25172         {
       
 25173           throw ReactError(Error('Target container is not a DOM element.'));
       
 25174         }
       
 25175       }
       
 25176     })();
       
 25177     {
       
 25178       !!container._reactHasBeenPassedToCreateRootDEV ? warningWithoutStack$1(false, 'You are calling ReactDOM.render() on a container that was previously ' + 'passed to ReactDOM.%s(). This is not supported. ' + 'Did you mean to call root.render(element)?', enableStableConcurrentModeAPIs ? 'createRoot' : 'unstable_createRoot') : void 0;
       
 25179     }
       
 25180     return legacyRenderSubtreeIntoContainer(null, element, container, false, callback);
       
 25181   },
       
 25182   unstable_renderSubtreeIntoContainer: function (parentComponent, element, containerNode, callback) {
       
 25183     (function () {
       
 25184       if (!isValidContainer(containerNode)) {
       
 25185         {
       
 25186           throw ReactError(Error('Target container is not a DOM element.'));
       
 25187         }
       
 25188       }
       
 25189     })();
       
 25190     (function () {
       
 25191       if (!(parentComponent != null && has(parentComponent))) {
       
 25192         {
       
 25193           throw ReactError(Error('parentComponent must be a valid React Component'));
       
 25194         }
       
 25195       }
       
 25196     })();
       
 25197     return legacyRenderSubtreeIntoContainer(parentComponent, element, containerNode, false, callback);
       
 25198   },
       
 25199   unmountComponentAtNode: function (container) {
       
 25200     (function () {
       
 25201       if (!isValidContainer(container)) {
       
 25202         {
       
 25203           throw ReactError(Error('unmountComponentAtNode(...): Target container is not a DOM element.'));
       
 25204         }
       
 25205       }
       
 25206     })();
       
 25207 
       
 25208     {
       
 25209       !!container._reactHasBeenPassedToCreateRootDEV ? warningWithoutStack$1(false, 'You are calling ReactDOM.unmountComponentAtNode() on a container that was previously ' + 'passed to ReactDOM.%s(). This is not supported. Did you mean to call root.unmount()?', enableStableConcurrentModeAPIs ? 'createRoot' : 'unstable_createRoot') : void 0;
       
 25210     }
 25005     }
 25211 
 25006 
 25212     if (container._reactRootContainer) {
 25007     if (container._reactRootContainer) {
 25213       {
 25008       {
 25214         var rootEl = getReactRootElementInContainer(container);
 25009         var rootEl = getReactRootElementInContainer(container);
 25215         var renderedByDifferentReact = rootEl && !getInstanceFromNode$1(rootEl);
 25010         var renderedByDifferentReact = rootEl && !getInstanceFromNode$1(rootEl);
 25216         !!renderedByDifferentReact ? warningWithoutStack$1(false, "unmountComponentAtNode(): The node you're attempting to unmount " + 'was rendered by another copy of React.') : void 0;
 25011 
 25217       }
 25012         if (renderedByDifferentReact) {
 25218 
 25013           error("unmountComponentAtNode(): The node you're attempting to unmount " + 'was rendered by another copy of React.');
 25219       // Unmount should not be batched.
 25014         }
       
 25015       } // Unmount should not be batched.
       
 25016 
       
 25017 
 25220       unbatchedUpdates(function () {
 25018       unbatchedUpdates(function () {
 25221         legacyRenderSubtreeIntoContainer(null, null, container, false, function () {
 25019         legacyRenderSubtreeIntoContainer(null, null, container, false, function () {
       
 25020           // $FlowFixMe This should probably use `delete container._reactRootContainer`
 25222           container._reactRootContainer = null;
 25021           container._reactRootContainer = null;
       
 25022           unmarkContainerAsRoot(container);
 25223         });
 25023         });
 25224       });
 25024       }); // If you call unmountComponentAtNode twice in quick succession, you'll
 25225       // If you call unmountComponentAtNode twice in quick succession, you'll
       
 25226       // get `true` twice. That's probably fine?
 25025       // get `true` twice. That's probably fine?
       
 25026 
 25227       return true;
 25027       return true;
 25228     } else {
 25028     } else {
 25229       {
 25029       {
 25230         var _rootEl = getReactRootElementInContainer(container);
 25030         var _rootEl = getReactRootElementInContainer(container);
 25231         var hasNonRootReactChild = !!(_rootEl && getInstanceFromNode$1(_rootEl));
 25031 
 25232 
 25032         var hasNonRootReactChild = !!(_rootEl && getInstanceFromNode$1(_rootEl)); // Check if the container itself is a React root node.
 25233         // Check if the container itself is a React root node.
 25033 
 25234         var isContainerReactRoot = container.nodeType === ELEMENT_NODE && isValidContainer(container.parentNode) && !!container.parentNode._reactRootContainer;
 25034         var isContainerReactRoot = container.nodeType === ELEMENT_NODE && isValidContainer(container.parentNode) && !!container.parentNode._reactRootContainer;
 25235 
 25035 
 25236         !!hasNonRootReactChild ? warningWithoutStack$1(false, "unmountComponentAtNode(): The node you're attempting to unmount " + 'was rendered by React and is not a top-level container. %s', isContainerReactRoot ? 'You may have accidentally passed in a React root node instead ' + 'of its container.' : 'Instead, have the parent component update its state and ' + 'rerender in order to remove this component.') : void 0;
 25036         if (hasNonRootReactChild) {
       
 25037           error("unmountComponentAtNode(): The node you're attempting to unmount " + 'was rendered by React and is not a top-level container. %s', isContainerReactRoot ? 'You may have accidentally passed in a React root node instead ' + 'of its container.' : 'Instead, have the parent component update its state and ' + 'rerender in order to remove this component.');
       
 25038         }
 25237       }
 25039       }
 25238 
 25040 
 25239       return false;
 25041       return false;
 25240     }
 25042     }
 25241   },
 25043   }
 25242 
 25044 
 25243 
 25045   function createPortal(children, containerInfo, // TODO: figure out the API for cross-renderer implementation.
 25244   // Temporary alias since we already shipped React 16 RC with it.
 25046   implementation) {
 25245   // TODO: remove in React 17.
 25047     var key = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
 25246   unstable_createPortal: function () {
 25048     return {
 25247     if (!didWarnAboutUnstableCreatePortal) {
 25049       // This tag allow us to uniquely identify this as a React Portal
 25248       didWarnAboutUnstableCreatePortal = true;
 25050       $$typeof: REACT_PORTAL_TYPE,
 25249       lowPriorityWarning$1(false, 'The ReactDOM.unstable_createPortal() alias has been deprecated, ' + 'and will be removed in React 17+. Update your code to use ' + 'ReactDOM.createPortal() instead. It has the exact same API, ' + 'but without the "unstable_" prefix.');
 25051       key: key == null ? null : '' + key,
 25250     }
 25052       children: children,
 25251     return createPortal$$1.apply(undefined, arguments);
 25053       containerInfo: containerInfo,
 25252   },
 25054       implementation: implementation
 25253 
 25055     };
 25254 
 25056   }
 25255   unstable_batchedUpdates: batchedUpdates$1,
 25057 
 25256 
 25058   var ReactVersion = '16.13.1';
 25257   // TODO remove this legacy method, unstable_discreteUpdates replaces it
 25059 
 25258   unstable_interactiveUpdates: function (fn, a, b, c) {
 25060   setAttemptUserBlockingHydration(attemptUserBlockingHydration$1);
 25259     flushDiscreteUpdates();
 25061   setAttemptContinuousHydration(attemptContinuousHydration$1);
 25260     return discreteUpdates$1(fn, a, b, c);
 25062   setAttemptHydrationAtCurrentPriority(attemptHydrationAtCurrentPriority$1);
 25261   },
 25063   var didWarnAboutUnstableCreatePortal = false;
 25262 
 25064 
 25263   unstable_discreteUpdates: discreteUpdates$1,
 25065   {
 25264   unstable_flushDiscreteUpdates: flushDiscreteUpdates,
 25066     if (typeof Map !== 'function' || // $FlowIssue Flow incorrectly thinks Map has no prototype
 25265 
 25067     Map.prototype == null || typeof Map.prototype.forEach !== 'function' || typeof Set !== 'function' || // $FlowIssue Flow incorrectly thinks Set has no prototype
 25266   flushSync: flushSync,
 25068     Set.prototype == null || typeof Set.prototype.clear !== 'function' || typeof Set.prototype.forEach !== 'function') {
 25267 
 25069       error('React depends on Map and Set built-in types. Make sure that you load a ' + 'polyfill in older browsers. https://fb.me/react-polyfills');
 25268   unstable_createRoot: createRoot,
 25070     }
 25269   unstable_createSyncRoot: createSyncRoot,
 25071   }
 25270   unstable_flushControlled: flushControlled,
 25072 
 25271 
 25073   setRestoreImplementation(restoreControlledState$3);
 25272   __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: {
 25074   setBatchingImplementation(batchedUpdates$1, discreteUpdates$1, flushDiscreteUpdates, batchedEventUpdates$1);
       
 25075 
       
 25076   function createPortal$1(children, container) {
       
 25077     var key = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
       
 25078 
       
 25079     if (!isValidContainer(container)) {
       
 25080       {
       
 25081         throw Error( "Target container is not a DOM element." );
       
 25082       }
       
 25083     } // TODO: pass ReactDOM portal implementation as third argument
       
 25084     // $FlowFixMe The Flow type is opaque but there's no way to actually create it.
       
 25085 
       
 25086 
       
 25087     return createPortal(children, container, null, key);
       
 25088   }
       
 25089 
       
 25090   function renderSubtreeIntoContainer(parentComponent, element, containerNode, callback) {
       
 25091 
       
 25092     return unstable_renderSubtreeIntoContainer(parentComponent, element, containerNode, callback);
       
 25093   }
       
 25094 
       
 25095   function unstable_createPortal(children, container) {
       
 25096     var key = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
       
 25097 
       
 25098     {
       
 25099       if (!didWarnAboutUnstableCreatePortal) {
       
 25100         didWarnAboutUnstableCreatePortal = true;
       
 25101 
       
 25102         warn('The ReactDOM.unstable_createPortal() alias has been deprecated, ' + 'and will be removed in React 17+. Update your code to use ' + 'ReactDOM.createPortal() instead. It has the exact same API, ' + 'but without the "unstable_" prefix.');
       
 25103       }
       
 25104     }
       
 25105 
       
 25106     return createPortal$1(children, container, key);
       
 25107   }
       
 25108 
       
 25109   var Internals = {
 25273     // Keep in sync with ReactDOMUnstableNativeDependencies.js
 25110     // Keep in sync with ReactDOMUnstableNativeDependencies.js
 25274     // ReactTestUtils.js, and ReactTestUtilsAct.js. This is an array for better minification.
 25111     // ReactTestUtils.js, and ReactTestUtilsAct.js. This is an array for better minification.
 25275     Events: [getInstanceFromNode$1, getNodeFromInstance$1, getFiberCurrentPropsFromNode$1, injection.injectEventPluginsByName, eventNameDispatchConfigs, accumulateTwoPhaseDispatches, accumulateDirectDispatches, enqueueStateRestore, restoreStateIfNeeded, dispatchEvent, runEventsInBatch, flushPassiveEffects, IsThisRendererActing]
 25112     Events: [getInstanceFromNode$1, getNodeFromInstance$1, getFiberCurrentPropsFromNode$1, injectEventPluginsByName, eventNameDispatchConfigs, accumulateTwoPhaseDispatches, accumulateDirectDispatches, enqueueStateRestore, restoreStateIfNeeded, dispatchEvent, runEventsInBatch, flushPassiveEffects, IsThisRendererActing]
 25276   }
 25113   };
 25277 };
 25114   var foundDevTools = injectIntoDevTools({
 25278 
 25115     findFiberByHostInstance: getClosestInstanceFromNode,
 25279 function createRoot(container, options) {
 25116     bundleType:  1 ,
 25280   var functionName = enableStableConcurrentModeAPIs ? 'createRoot' : 'unstable_createRoot';
 25117     version: ReactVersion,
 25281   (function () {
 25118     rendererPackageName: 'react-dom'
 25282     if (!isValidContainer(container)) {
 25119   });
 25283       {
 25120 
 25284         throw ReactError(Error(functionName + '(...): Target container is not a DOM element.'));
       
 25285       }
       
 25286     }
       
 25287   })();
       
 25288   warnIfReactDOMContainerInDEV(container);
       
 25289   var hydrate = options != null && options.hydrate === true;
       
 25290   return new ReactRoot(container, hydrate);
       
 25291 }
       
 25292 
       
 25293 function createSyncRoot(container, options) {
       
 25294   var functionName = enableStableConcurrentModeAPIs ? 'createRoot' : 'unstable_createRoot';
       
 25295   (function () {
       
 25296     if (!isValidContainer(container)) {
       
 25297       {
       
 25298         throw ReactError(Error(functionName + '(...): Target container is not a DOM element.'));
       
 25299       }
       
 25300     }
       
 25301   })();
       
 25302   warnIfReactDOMContainerInDEV(container);
       
 25303   var hydrate = options != null && options.hydrate === true;
       
 25304   return new ReactSyncRoot(container, BatchedRoot, hydrate);
       
 25305 }
       
 25306 
       
 25307 function warnIfReactDOMContainerInDEV(container) {
       
 25308   {
 25121   {
 25309     !!container._reactRootContainer ? warningWithoutStack$1(false, 'You are calling ReactDOM.%s() on a container that was previously ' + 'passed to ReactDOM.render(). This is not supported.', enableStableConcurrentModeAPIs ? 'createRoot' : 'unstable_createRoot') : void 0;
 25122     if (!foundDevTools && canUseDOM && window.top === window.self) {
 25310     container._reactHasBeenPassedToCreateRootDEV = true;
 25123       // If we're in Chrome or Firefox, provide a download link if not installed.
 25311   }
 25124       if (navigator.userAgent.indexOf('Chrome') > -1 && navigator.userAgent.indexOf('Edge') === -1 || navigator.userAgent.indexOf('Firefox') > -1) {
 25312 }
 25125         var protocol = window.location.protocol; // Don't warn in exotic cases like chrome-extension://.
 25313 
 25126 
 25314 if (enableStableConcurrentModeAPIs) {
 25127         if (/^(https?|file):$/.test(protocol)) {
 25315   ReactDOM.createRoot = createRoot;
 25128           // eslint-disable-next-line react-internal/no-production-logging
 25316   ReactDOM.createSyncRoot = createSyncRoot;
 25129           console.info('%cDownload the React DevTools ' + 'for a better development experience: ' + 'https://fb.me/react-devtools' + (protocol === 'file:' ? '\nYou might need to use a local HTTP server (instead of file://): ' + 'https://fb.me/react-devtools-faq' : ''), 'font-weight:bold');
 25317 }
 25130         }
 25318 
 25131       }
 25319 var foundDevTools = injectIntoDevTools({
 25132     }
 25320   findFiberByHostInstance: getClosestInstanceFromNode,
 25133   }
 25321   bundleType: 1,
 25134 
 25322   version: ReactVersion,
 25135   exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = Internals;
 25323   rendererPackageName: 'react-dom'
 25136   exports.createPortal = createPortal$1;
 25324 });
 25137   exports.findDOMNode = findDOMNode;
 25325 
 25138   exports.flushSync = flushSync;
 25326 {
 25139   exports.hydrate = hydrate;
 25327   if (!foundDevTools && canUseDOM && window.top === window.self) {
 25140   exports.render = render;
 25328     // If we're in Chrome or Firefox, provide a download link if not installed.
 25141   exports.unmountComponentAtNode = unmountComponentAtNode;
 25329     if (navigator.userAgent.indexOf('Chrome') > -1 && navigator.userAgent.indexOf('Edge') === -1 || navigator.userAgent.indexOf('Firefox') > -1) {
 25142   exports.unstable_batchedUpdates = batchedUpdates$1;
 25330       var protocol = window.location.protocol;
 25143   exports.unstable_createPortal = unstable_createPortal;
 25331       // Don't warn in exotic cases like chrome-extension://.
 25144   exports.unstable_renderSubtreeIntoContainer = renderSubtreeIntoContainer;
 25332       if (/^(https?|file):$/.test(protocol)) {
 25145   exports.version = ReactVersion;
 25333         console.info('%cDownload the React DevTools ' + 'for a better development experience: ' + 'https://fb.me/react-devtools' + (protocol === 'file:' ? '\nYou might need to use a local HTTP server (instead of file://): ' + 'https://fb.me/react-devtools-faq' : ''), 'font-weight:bold');
       
 25334       }
       
 25335     }
       
 25336   }
       
 25337 }
       
 25338 
       
 25339 
       
 25340 
       
 25341 var ReactDOM$2 = Object.freeze({
       
 25342 	default: ReactDOM
       
 25343 });
       
 25344 
       
 25345 var ReactDOM$3 = ( ReactDOM$2 && ReactDOM ) || ReactDOM$2;
       
 25346 
       
 25347 // TODO: decide on the top-level export form.
       
 25348 // This is hacky but makes it work with both Rollup and Jest.
       
 25349 var reactDom = ReactDOM$3.default || ReactDOM$3;
       
 25350 
       
 25351 return reactDom;
       
 25352 
 25146 
 25353 })));
 25147 })));