wp/wp-includes/js/dist/vendor/react-dom.js
changeset 9 177826044cd9
child 16 a86126ab1dd4
equal deleted inserted replaced
8:c7c34916027a 9:177826044cd9
       
     1 /** @license React v16.8.4
       
     2  * react-dom.development.js
       
     3  *
       
     4  * Copyright (c) Facebook, Inc. and its affiliates.
       
     5  *
       
     6  * This source code is licensed under the MIT license found in the
       
     7  * LICENSE file in the root directory of this source tree.
       
     8  */
       
     9 
       
    10 'use strict';
       
    11 
       
    12 (function (global, factory) {
       
    13 	typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('react')) :
       
    14 	typeof define === 'function' && define.amd ? define(['react'], factory) :
       
    15 	(global.ReactDOM = factory(global.React));
       
    16 }(this, (function (React) { 'use strict';
       
    17 
       
    18 /**
       
    19  * Use invariant() to assert state which your program assumes to be true.
       
    20  *
       
    21  * Provide sprintf-style format (only %s is supported) and arguments
       
    22  * to provide information about what broke and what you were
       
    23  * expecting.
       
    24  *
       
    25  * The invariant message will be stripped in production, but the invariant
       
    26  * will remain to ensure logic does not differ in production.
       
    27  */
       
    28 
       
    29 var validateFormat = function () {};
       
    30 
       
    31 {
       
    32   validateFormat = function (format) {
       
    33     if (format === undefined) {
       
    34       throw new Error('invariant requires an error message argument');
       
    35     }
       
    36   };
       
    37 }
       
    38 
       
    39 function invariant(condition, format, a, b, c, d, e, f) {
       
    40   validateFormat(format);
       
    41 
       
    42   if (!condition) {
       
    43     var error = void 0;
       
    44     if (format === undefined) {
       
    45       error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
       
    46     } else {
       
    47       var args = [a, b, c, d, e, f];
       
    48       var argIndex = 0;
       
    49       error = new Error(format.replace(/%s/g, function () {
       
    50         return args[argIndex++];
       
    51       }));
       
    52       error.name = 'Invariant Violation';
       
    53     }
       
    54 
       
    55     error.framesToPop = 1; // we don't care about invariant's own frame
       
    56     throw error;
       
    57   }
       
    58 }
       
    59 
       
    60 // Relying on the `invariant()` implementation lets us
       
    61 // preserve the format and params in the www builds.
       
    62 
       
    63 !React ? invariant(false, 'ReactDOM was loaded before React. Make sure you load the React package before loading ReactDOM.') : void 0;
       
    64 
       
    65 var invokeGuardedCallbackImpl = function (name, func, context, a, b, c, d, e, f) {
       
    66   var funcArgs = Array.prototype.slice.call(arguments, 3);
       
    67   try {
       
    68     func.apply(context, funcArgs);
       
    69   } catch (error) {
       
    70     this.onError(error);
       
    71   }
       
    72 };
       
    73 
       
    74 {
       
    75   // In DEV mode, we swap out invokeGuardedCallback for a special version
       
    76   // that plays more nicely with the browser's DevTools. The idea is to preserve
       
    77   // "Pause on exceptions" behavior. Because React wraps all user-provided
       
    78   // functions in invokeGuardedCallback, and the production version of
       
    79   // invokeGuardedCallback uses a try-catch, all user exceptions are treated
       
    80   // like caught exceptions, and the DevTools won't pause unless the developer
       
    81   // takes the extra step of enabling pause on caught exceptions. This is
       
    82   // unintuitive, though, because even though React has caught the error, from
       
    83   // the developer's perspective, the error is uncaught.
       
    84   //
       
    85   // To preserve the expected "Pause on exceptions" behavior, we don't use a
       
    86   // try-catch in DEV. Instead, we synchronously dispatch a fake event to a fake
       
    87   // DOM node, and call the user-provided callback from inside an event handler
       
    88   // for that fake event. If the callback throws, the error is "captured" using
       
    89   // a global event handler. But because the error happens in a different
       
    90   // event loop context, it does not interrupt the normal program flow.
       
    91   // Effectively, this gives us try-catch behavior without actually using
       
    92   // try-catch. Neat!
       
    93 
       
    94   // Check that the browser supports the APIs we need to implement our special
       
    95   // DEV version of invokeGuardedCallback
       
    96   if (typeof window !== 'undefined' && typeof window.dispatchEvent === 'function' && typeof document !== 'undefined' && typeof document.createEvent === 'function') {
       
    97     var fakeNode = document.createElement('react');
       
    98 
       
    99     var invokeGuardedCallbackDev = function (name, func, context, a, b, c, d, e, f) {
       
   100       // If document doesn't exist we know for sure we will crash in this method
       
   101       // when we call document.createEvent(). However this can cause confusing
       
   102       // errors: https://github.com/facebookincubator/create-react-app/issues/3482
       
   103       // So we preemptively throw with a better message instead.
       
   104       !(typeof document !== 'undefined') ? invariant(false, '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.') : void 0;
       
   105       var evt = document.createEvent('Event');
       
   106 
       
   107       // Keeps track of whether the user-provided callback threw an error. We
       
   108       // set this to true at the beginning, then set it to false right after
       
   109       // calling the function. If the function errors, `didError` will never be
       
   110       // set to false. This strategy works even if the browser is flaky and
       
   111       // fails to call our global error handler, because it doesn't rely on
       
   112       // the error event at all.
       
   113       var didError = true;
       
   114 
       
   115       // Keeps track of the value of window.event so that we can reset it
       
   116       // during the callback to let user code access window.event in the
       
   117       // browsers that support it.
       
   118       var windowEvent = window.event;
       
   119 
       
   120       // Keeps track of the descriptor of window.event to restore it after event
       
   121       // dispatching: https://github.com/facebook/react/issues/13688
       
   122       var windowEventDescriptor = Object.getOwnPropertyDescriptor(window, 'event');
       
   123 
       
   124       // Create an event handler for our fake event. We will synchronously
       
   125       // dispatch our fake event using `dispatchEvent`. Inside the handler, we
       
   126       // call the user-provided callback.
       
   127       var funcArgs = Array.prototype.slice.call(arguments, 3);
       
   128       function callCallback() {
       
   129         // We immediately remove the callback from event listeners so that
       
   130         // nested `invokeGuardedCallback` calls do not clash. Otherwise, a
       
   131         // nested call would trigger the fake event handlers of any call higher
       
   132         // in the stack.
       
   133         fakeNode.removeEventListener(evtType, callCallback, false);
       
   134 
       
   135         // We check for window.hasOwnProperty('event') to prevent the
       
   136         // window.event assignment in both IE <= 10 as they throw an error
       
   137         // "Member not found" in strict mode, and in Firefox which does not
       
   138         // support window.event.
       
   139         if (typeof window.event !== 'undefined' && window.hasOwnProperty('event')) {
       
   140           window.event = windowEvent;
       
   141         }
       
   142 
       
   143         func.apply(context, funcArgs);
       
   144         didError = false;
       
   145       }
       
   146 
       
   147       // Create a global error event handler. We use this to capture the value
       
   148       // that was thrown. It's possible that this error handler will fire more
       
   149       // than once; for example, if non-React code also calls `dispatchEvent`
       
   150       // and a handler for that event throws. We should be resilient to most of
       
   151       // those cases. Even if our error event handler fires more than once, the
       
   152       // last error event is always used. If the callback actually does error,
       
   153       // we know that the last error event is the correct one, because it's not
       
   154       // possible for anything else to have happened in between our callback
       
   155       // erroring and the code that follows the `dispatchEvent` call below. If
       
   156       // the callback doesn't error, but the error event was fired, we know to
       
   157       // ignore it because `didError` will be false, as described above.
       
   158       var error = void 0;
       
   159       // Use this to track whether the error event is ever called.
       
   160       var didSetError = false;
       
   161       var isCrossOriginError = false;
       
   162 
       
   163       function handleWindowError(event) {
       
   164         error = event.error;
       
   165         didSetError = true;
       
   166         if (error === null && event.colno === 0 && event.lineno === 0) {
       
   167           isCrossOriginError = true;
       
   168         }
       
   169         if (event.defaultPrevented) {
       
   170           // Some other error handler has prevented default.
       
   171           // Browsers silence the error report if this happens.
       
   172           // We'll remember this to later decide whether to log it or not.
       
   173           if (error != null && typeof error === 'object') {
       
   174             try {
       
   175               error._suppressLogging = true;
       
   176             } catch (inner) {
       
   177               // Ignore.
       
   178             }
       
   179           }
       
   180         }
       
   181       }
       
   182 
       
   183       // Create a fake event type.
       
   184       var evtType = 'react-' + (name ? name : 'invokeguardedcallback');
       
   185 
       
   186       // Attach our event handlers
       
   187       window.addEventListener('error', handleWindowError);
       
   188       fakeNode.addEventListener(evtType, callCallback, false);
       
   189 
       
   190       // Synchronously dispatch our fake event. If the user-provided function
       
   191       // errors, it will trigger our global error handler.
       
   192       evt.initEvent(evtType, false, false);
       
   193       fakeNode.dispatchEvent(evt);
       
   194 
       
   195       if (windowEventDescriptor) {
       
   196         Object.defineProperty(window, 'event', windowEventDescriptor);
       
   197       }
       
   198 
       
   199       if (didError) {
       
   200         if (!didSetError) {
       
   201           // The callback errored, but the error event never fired.
       
   202           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         } else if (isCrossOriginError) {
       
   204           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         }
       
   206         this.onError(error);
       
   207       }
       
   208 
       
   209       // Remove our event listeners
       
   210       window.removeEventListener('error', handleWindowError);
       
   211     };
       
   212 
       
   213     invokeGuardedCallbackImpl = invokeGuardedCallbackDev;
       
   214   }
       
   215 }
       
   216 
       
   217 var invokeGuardedCallbackImpl$1 = invokeGuardedCallbackImpl;
       
   218 
       
   219 // Used by Fiber to simulate a try-catch.
       
   220 var hasError = false;
       
   221 var caughtError = null;
       
   222 
       
   223 // Used by event system to capture/rethrow the first error.
       
   224 var hasRethrowError = false;
       
   225 var rethrowError = null;
       
   226 
       
   227 var reporter = {
       
   228   onError: function (error) {
       
   229     hasError = true;
       
   230     caughtError = error;
       
   231   }
       
   232 };
       
   233 
       
   234 /**
       
   235  * Call a function while guarding against errors that happens within it.
       
   236  * Returns an error if it throws, otherwise null.
       
   237  *
       
   238  * In production, this is implemented using a try-catch. The reason we don't
       
   239  * use a try-catch directly is so that we can swap out a different
       
   240  * implementation in DEV mode.
       
   241  *
       
   242  * @param {String} name of the guard to use for logging or debugging
       
   243  * @param {Function} func The function to invoke
       
   244  * @param {*} context The context to use when calling the function
       
   245  * @param {...*} args Arguments for function
       
   246  */
       
   247 function invokeGuardedCallback(name, func, context, a, b, c, d, e, f) {
       
   248   hasError = false;
       
   249   caughtError = null;
       
   250   invokeGuardedCallbackImpl$1.apply(reporter, arguments);
       
   251 }
       
   252 
       
   253 /**
       
   254  * Same as invokeGuardedCallback, but instead of returning an error, it stores
       
   255  * it in a global so it can be rethrown by `rethrowCaughtError` later.
       
   256  * TODO: See if caughtError and rethrowError can be unified.
       
   257  *
       
   258  * @param {String} name of the guard to use for logging or debugging
       
   259  * @param {Function} func The function to invoke
       
   260  * @param {*} context The context to use when calling the function
       
   261  * @param {...*} args Arguments for function
       
   262  */
       
   263 function invokeGuardedCallbackAndCatchFirstError(name, func, context, a, b, c, d, e, f) {
       
   264   invokeGuardedCallback.apply(this, arguments);
       
   265   if (hasError) {
       
   266     var error = clearCaughtError();
       
   267     if (!hasRethrowError) {
       
   268       hasRethrowError = true;
       
   269       rethrowError = error;
       
   270     }
       
   271   }
       
   272 }
       
   273 
       
   274 /**
       
   275  * During execution of guarded functions we will capture the first error which
       
   276  * we will rethrow to be handled by the top level error handler.
       
   277  */
       
   278 function rethrowCaughtError() {
       
   279   if (hasRethrowError) {
       
   280     var error = rethrowError;
       
   281     hasRethrowError = false;
       
   282     rethrowError = null;
       
   283     throw error;
       
   284   }
       
   285 }
       
   286 
       
   287 function hasCaughtError() {
       
   288   return hasError;
       
   289 }
       
   290 
       
   291 function clearCaughtError() {
       
   292   if (hasError) {
       
   293     var error = caughtError;
       
   294     hasError = false;
       
   295     caughtError = null;
       
   296     return error;
       
   297   } else {
       
   298     invariant(false, 'clearCaughtError was called but no error was captured. This error is likely caused by a bug in React. Please file an issue.');
       
   299   }
       
   300 }
       
   301 
       
   302 /**
       
   303  * Injectable ordering of event plugins.
       
   304  */
       
   305 var eventPluginOrder = null;
       
   306 
       
   307 /**
       
   308  * Injectable mapping from names to event plugin modules.
       
   309  */
       
   310 var namesToPlugins = {};
       
   311 
       
   312 /**
       
   313  * Recomputes the plugin list using the injected plugins and plugin ordering.
       
   314  *
       
   315  * @private
       
   316  */
       
   317 function recomputePluginOrdering() {
       
   318   if (!eventPluginOrder) {
       
   319     // Wait until an `eventPluginOrder` is injected.
       
   320     return;
       
   321   }
       
   322   for (var pluginName in namesToPlugins) {
       
   323     var pluginModule = namesToPlugins[pluginName];
       
   324     var pluginIndex = eventPluginOrder.indexOf(pluginName);
       
   325     !(pluginIndex > -1) ? invariant(false, 'EventPluginRegistry: Cannot inject event plugins that do not exist in the plugin ordering, `%s`.', pluginName) : void 0;
       
   326     if (plugins[pluginIndex]) {
       
   327       continue;
       
   328     }
       
   329     !pluginModule.extractEvents ? invariant(false, 'EventPluginRegistry: Event plugins must implement an `extractEvents` method, but `%s` does not.', pluginName) : void 0;
       
   330     plugins[pluginIndex] = pluginModule;
       
   331     var publishedEvents = pluginModule.eventTypes;
       
   332     for (var eventName in publishedEvents) {
       
   333       !publishEventForPlugin(publishedEvents[eventName], pluginModule, eventName) ? invariant(false, 'EventPluginRegistry: Failed to publish event `%s` for plugin `%s`.', eventName, pluginName) : void 0;
       
   334     }
       
   335   }
       
   336 }
       
   337 
       
   338 /**
       
   339  * Publishes an event so that it can be dispatched by the supplied plugin.
       
   340  *
       
   341  * @param {object} dispatchConfig Dispatch configuration for the event.
       
   342  * @param {object} PluginModule Plugin publishing the event.
       
   343  * @return {boolean} True if the event was successfully published.
       
   344  * @private
       
   345  */
       
   346 function publishEventForPlugin(dispatchConfig, pluginModule, eventName) {
       
   347   !!eventNameDispatchConfigs.hasOwnProperty(eventName) ? invariant(false, 'EventPluginHub: More than one plugin attempted to publish the same event name, `%s`.', eventName) : void 0;
       
   348   eventNameDispatchConfigs[eventName] = dispatchConfig;
       
   349 
       
   350   var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames;
       
   351   if (phasedRegistrationNames) {
       
   352     for (var phaseName in phasedRegistrationNames) {
       
   353       if (phasedRegistrationNames.hasOwnProperty(phaseName)) {
       
   354         var phasedRegistrationName = phasedRegistrationNames[phaseName];
       
   355         publishRegistrationName(phasedRegistrationName, pluginModule, eventName);
       
   356       }
       
   357     }
       
   358     return true;
       
   359   } else if (dispatchConfig.registrationName) {
       
   360     publishRegistrationName(dispatchConfig.registrationName, pluginModule, eventName);
       
   361     return true;
       
   362   }
       
   363   return false;
       
   364 }
       
   365 
       
   366 /**
       
   367  * Publishes a registration name that is used to identify dispatched events.
       
   368  *
       
   369  * @param {string} registrationName Registration name to add.
       
   370  * @param {object} PluginModule Plugin publishing the event.
       
   371  * @private
       
   372  */
       
   373 function publishRegistrationName(registrationName, pluginModule, eventName) {
       
   374   !!registrationNameModules[registrationName] ? invariant(false, 'EventPluginHub: More than one plugin attempted to publish the same registration name, `%s`.', registrationName) : void 0;
       
   375   registrationNameModules[registrationName] = pluginModule;
       
   376   registrationNameDependencies[registrationName] = pluginModule.eventTypes[eventName].dependencies;
       
   377 
       
   378   {
       
   379     var lowerCasedName = registrationName.toLowerCase();
       
   380     possibleRegistrationNames[lowerCasedName] = registrationName;
       
   381 
       
   382     if (registrationName === 'onDoubleClick') {
       
   383       possibleRegistrationNames.ondblclick = registrationName;
       
   384     }
       
   385   }
       
   386 }
       
   387 
       
   388 /**
       
   389  * Registers plugins so that they can extract and dispatch events.
       
   390  *
       
   391  * @see {EventPluginHub}
       
   392  */
       
   393 
       
   394 /**
       
   395  * Ordered list of injected plugins.
       
   396  */
       
   397 var plugins = [];
       
   398 
       
   399 /**
       
   400  * Mapping from event name to dispatch config
       
   401  */
       
   402 var eventNameDispatchConfigs = {};
       
   403 
       
   404 /**
       
   405  * Mapping from registration name to plugin module
       
   406  */
       
   407 var registrationNameModules = {};
       
   408 
       
   409 /**
       
   410  * Mapping from registration name to event name
       
   411  */
       
   412 var registrationNameDependencies = {};
       
   413 
       
   414 /**
       
   415  * Mapping from lowercase registration names to the properly cased version,
       
   416  * used to warn in the case of missing event handlers. Available
       
   417  * only in true.
       
   418  * @type {Object}
       
   419  */
       
   420 var possibleRegistrationNames = {};
       
   421 // Trust the developer to only use possibleRegistrationNames in true
       
   422 
       
   423 /**
       
   424  * Injects an ordering of plugins (by plugin name). This allows the ordering
       
   425  * to be decoupled from injection of the actual plugins so that ordering is
       
   426  * always deterministic regardless of packaging, on-the-fly injection, etc.
       
   427  *
       
   428  * @param {array} InjectedEventPluginOrder
       
   429  * @internal
       
   430  * @see {EventPluginHub.injection.injectEventPluginOrder}
       
   431  */
       
   432 function injectEventPluginOrder(injectedEventPluginOrder) {
       
   433   !!eventPluginOrder ? invariant(false, 'EventPluginRegistry: Cannot inject event plugin ordering more than once. You are likely trying to load more than one copy of React.') : void 0;
       
   434   // Clone the ordering so it cannot be dynamically mutated.
       
   435   eventPluginOrder = Array.prototype.slice.call(injectedEventPluginOrder);
       
   436   recomputePluginOrdering();
       
   437 }
       
   438 
       
   439 /**
       
   440  * Injects plugins to be used by `EventPluginHub`. The plugin names must be
       
   441  * in the ordering injected by `injectEventPluginOrder`.
       
   442  *
       
   443  * Plugins can be injected as part of page initialization or on-the-fly.
       
   444  *
       
   445  * @param {object} injectedNamesToPlugins Map from names to plugin modules.
       
   446  * @internal
       
   447  * @see {EventPluginHub.injection.injectEventPluginsByName}
       
   448  */
       
   449 function injectEventPluginsByName(injectedNamesToPlugins) {
       
   450   var isOrderingDirty = false;
       
   451   for (var pluginName in injectedNamesToPlugins) {
       
   452     if (!injectedNamesToPlugins.hasOwnProperty(pluginName)) {
       
   453       continue;
       
   454     }
       
   455     var pluginModule = injectedNamesToPlugins[pluginName];
       
   456     if (!namesToPlugins.hasOwnProperty(pluginName) || namesToPlugins[pluginName] !== pluginModule) {
       
   457       !!namesToPlugins[pluginName] ? invariant(false, 'EventPluginRegistry: Cannot inject two different event plugins using the same name, `%s`.', pluginName) : void 0;
       
   458       namesToPlugins[pluginName] = pluginModule;
       
   459       isOrderingDirty = true;
       
   460     }
       
   461   }
       
   462   if (isOrderingDirty) {
       
   463     recomputePluginOrdering();
       
   464   }
       
   465 }
       
   466 
       
   467 /**
       
   468  * Similar to invariant but only logs a warning if the condition is not met.
       
   469  * This can be used to log issues in development environments in critical
       
   470  * paths. Removing the logging code for production environments will keep the
       
   471  * same logic and follow the same code paths.
       
   472  */
       
   473 
       
   474 var warningWithoutStack = function () {};
       
   475 
       
   476 {
       
   477   warningWithoutStack = function (condition, format) {
       
   478     for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
       
   479       args[_key - 2] = arguments[_key];
       
   480     }
       
   481 
       
   482     if (format === undefined) {
       
   483       throw new Error('`warningWithoutStack(condition, format, ...args)` requires a warning ' + 'message argument');
       
   484     }
       
   485     if (args.length > 8) {
       
   486       // Check before the condition to catch violations early.
       
   487       throw new Error('warningWithoutStack() currently supports at most 8 arguments.');
       
   488     }
       
   489     if (condition) {
       
   490       return;
       
   491     }
       
   492     if (typeof console !== 'undefined') {
       
   493       var argsWithFormat = args.map(function (item) {
       
   494         return '' + item;
       
   495       });
       
   496       argsWithFormat.unshift('Warning: ' + format);
       
   497 
       
   498       // We intentionally don't use spread (or .apply) directly because it
       
   499       // breaks IE9: https://github.com/facebook/react/issues/13610
       
   500       Function.prototype.apply.call(console.error, console, argsWithFormat);
       
   501     }
       
   502     try {
       
   503       // --- Welcome to debugging React ---
       
   504       // This error was thrown as a convenience so that you can use this stack
       
   505       // to find the callsite that caused this warning to fire.
       
   506       var argIndex = 0;
       
   507       var message = 'Warning: ' + format.replace(/%s/g, function () {
       
   508         return args[argIndex++];
       
   509       });
       
   510       throw new Error(message);
       
   511     } catch (x) {}
       
   512   };
       
   513 }
       
   514 
       
   515 var warningWithoutStack$1 = warningWithoutStack;
       
   516 
       
   517 var getFiberCurrentPropsFromNode = null;
       
   518 var getInstanceFromNode = null;
       
   519 var getNodeFromInstance = null;
       
   520 
       
   521 function setComponentTree(getFiberCurrentPropsFromNodeImpl, getInstanceFromNodeImpl, getNodeFromInstanceImpl) {
       
   522   getFiberCurrentPropsFromNode = getFiberCurrentPropsFromNodeImpl;
       
   523   getInstanceFromNode = getInstanceFromNodeImpl;
       
   524   getNodeFromInstance = getNodeFromInstanceImpl;
       
   525   {
       
   526     !(getNodeFromInstance && getInstanceFromNode) ? warningWithoutStack$1(false, 'EventPluginUtils.setComponentTree(...): Injected ' + 'module is missing getNodeFromInstance or getInstanceFromNode.') : void 0;
       
   527   }
       
   528 }
       
   529 
       
   530 var validateEventDispatches = void 0;
       
   531 {
       
   532   validateEventDispatches = function (event) {
       
   533     var dispatchListeners = event._dispatchListeners;
       
   534     var dispatchInstances = event._dispatchInstances;
       
   535 
       
   536     var listenersIsArr = Array.isArray(dispatchListeners);
       
   537     var listenersLen = listenersIsArr ? dispatchListeners.length : dispatchListeners ? 1 : 0;
       
   538 
       
   539     var instancesIsArr = Array.isArray(dispatchInstances);
       
   540     var instancesLen = instancesIsArr ? dispatchInstances.length : dispatchInstances ? 1 : 0;
       
   541 
       
   542     !(instancesIsArr === listenersIsArr && instancesLen === listenersLen) ? warningWithoutStack$1(false, 'EventPluginUtils: Invalid `event`.') : void 0;
       
   543   };
       
   544 }
       
   545 
       
   546 /**
       
   547  * Dispatch the event to the listener.
       
   548  * @param {SyntheticEvent} event SyntheticEvent to handle
       
   549  * @param {function} listener Application-level callback
       
   550  * @param {*} inst Internal component instance
       
   551  */
       
   552 function executeDispatch(event, listener, inst) {
       
   553   var type = event.type || 'unknown-event';
       
   554   event.currentTarget = getNodeFromInstance(inst);
       
   555   invokeGuardedCallbackAndCatchFirstError(type, listener, undefined, event);
       
   556   event.currentTarget = null;
       
   557 }
       
   558 
       
   559 /**
       
   560  * Standard/simple iteration through an event's collected dispatches.
       
   561  */
       
   562 function executeDispatchesInOrder(event) {
       
   563   var dispatchListeners = event._dispatchListeners;
       
   564   var dispatchInstances = event._dispatchInstances;
       
   565   {
       
   566     validateEventDispatches(event);
       
   567   }
       
   568   if (Array.isArray(dispatchListeners)) {
       
   569     for (var i = 0; i < dispatchListeners.length; i++) {
       
   570       if (event.isPropagationStopped()) {
       
   571         break;
       
   572       }
       
   573       // Listeners and Instances are two parallel arrays that are always in sync.
       
   574       executeDispatch(event, dispatchListeners[i], dispatchInstances[i]);
       
   575     }
       
   576   } else if (dispatchListeners) {
       
   577     executeDispatch(event, dispatchListeners, dispatchInstances);
       
   578   }
       
   579   event._dispatchListeners = null;
       
   580   event._dispatchInstances = null;
       
   581 }
       
   582 
       
   583 /**
       
   584  * @see executeDispatchesInOrderStopAtTrueImpl
       
   585  */
       
   586 
       
   587 
       
   588 /**
       
   589  * Execution of a "direct" dispatch - there must be at most one dispatch
       
   590  * accumulated on the event or it is considered an error. It doesn't really make
       
   591  * sense for an event with multiple dispatches (bubbled) to keep track of the
       
   592  * return values at each dispatch execution, but it does tend to make sense when
       
   593  * dealing with "direct" dispatches.
       
   594  *
       
   595  * @return {*} The return value of executing the single dispatch.
       
   596  */
       
   597 
       
   598 
       
   599 /**
       
   600  * @param {SyntheticEvent} event
       
   601  * @return {boolean} True iff number of dispatches accumulated is greater than 0.
       
   602  */
       
   603 
       
   604 /**
       
   605  * Accumulates items that must not be null or undefined into the first one. This
       
   606  * is used to conserve memory by avoiding array allocations, and thus sacrifices
       
   607  * API cleanness. Since `current` can be null before being passed in and not
       
   608  * null after this function, make sure to assign it back to `current`:
       
   609  *
       
   610  * `a = accumulateInto(a, b);`
       
   611  *
       
   612  * This API should be sparingly used. Try `accumulate` for something cleaner.
       
   613  *
       
   614  * @return {*|array<*>} An accumulation of items.
       
   615  */
       
   616 
       
   617 function accumulateInto(current, next) {
       
   618   !(next != null) ? invariant(false, 'accumulateInto(...): Accumulated items must not be null or undefined.') : void 0;
       
   619 
       
   620   if (current == null) {
       
   621     return next;
       
   622   }
       
   623 
       
   624   // Both are not empty. Warning: Never call x.concat(y) when you are not
       
   625   // certain that x is an Array (x could be a string with concat method).
       
   626   if (Array.isArray(current)) {
       
   627     if (Array.isArray(next)) {
       
   628       current.push.apply(current, next);
       
   629       return current;
       
   630     }
       
   631     current.push(next);
       
   632     return current;
       
   633   }
       
   634 
       
   635   if (Array.isArray(next)) {
       
   636     // A bit too dangerous to mutate `next`.
       
   637     return [current].concat(next);
       
   638   }
       
   639 
       
   640   return [current, next];
       
   641 }
       
   642 
       
   643 /**
       
   644  * @param {array} arr an "accumulation" of items which is either an Array or
       
   645  * a single item. Useful when paired with the `accumulate` module. This is a
       
   646  * simple utility that allows us to reason about a collection of items, but
       
   647  * handling the case when there is exactly one item (and we do not need to
       
   648  * allocate an array).
       
   649  * @param {function} cb Callback invoked with each element or a collection.
       
   650  * @param {?} [scope] Scope used as `this` in a callback.
       
   651  */
       
   652 function forEachAccumulated(arr, cb, scope) {
       
   653   if (Array.isArray(arr)) {
       
   654     arr.forEach(cb, scope);
       
   655   } else if (arr) {
       
   656     cb.call(scope, arr);
       
   657   }
       
   658 }
       
   659 
       
   660 /**
       
   661  * Internal queue of events that have accumulated their dispatches and are
       
   662  * waiting to have their dispatches executed.
       
   663  */
       
   664 var eventQueue = null;
       
   665 
       
   666 /**
       
   667  * Dispatches an event and releases it back into the pool, unless persistent.
       
   668  *
       
   669  * @param {?object} event Synthetic event to be dispatched.
       
   670  * @private
       
   671  */
       
   672 var executeDispatchesAndRelease = function (event) {
       
   673   if (event) {
       
   674     executeDispatchesInOrder(event);
       
   675 
       
   676     if (!event.isPersistent()) {
       
   677       event.constructor.release(event);
       
   678     }
       
   679   }
       
   680 };
       
   681 var executeDispatchesAndReleaseTopLevel = function (e) {
       
   682   return executeDispatchesAndRelease(e);
       
   683 };
       
   684 
       
   685 function isInteractive(tag) {
       
   686   return tag === 'button' || tag === 'input' || tag === 'select' || tag === 'textarea';
       
   687 }
       
   688 
       
   689 function shouldPreventMouseEvent(name, type, props) {
       
   690   switch (name) {
       
   691     case 'onClick':
       
   692     case 'onClickCapture':
       
   693     case 'onDoubleClick':
       
   694     case 'onDoubleClickCapture':
       
   695     case 'onMouseDown':
       
   696     case 'onMouseDownCapture':
       
   697     case 'onMouseMove':
       
   698     case 'onMouseMoveCapture':
       
   699     case 'onMouseUp':
       
   700     case 'onMouseUpCapture':
       
   701       return !!(props.disabled && isInteractive(type));
       
   702     default:
       
   703       return false;
       
   704   }
       
   705 }
       
   706 
       
   707 /**
       
   708  * This is a unified interface for event plugins to be installed and configured.
       
   709  *
       
   710  * Event plugins can implement the following properties:
       
   711  *
       
   712  *   `extractEvents` {function(string, DOMEventTarget, string, object): *}
       
   713  *     Required. When a top-level event is fired, this method is expected to
       
   714  *     extract synthetic events that will in turn be queued and dispatched.
       
   715  *
       
   716  *   `eventTypes` {object}
       
   717  *     Optional, plugins that fire events must publish a mapping of registration
       
   718  *     names that are used to register listeners. Values of this mapping must
       
   719  *     be objects that contain `registrationName` or `phasedRegistrationNames`.
       
   720  *
       
   721  *   `executeDispatch` {function(object, function, string)}
       
   722  *     Optional, allows plugins to override how an event gets dispatched. By
       
   723  *     default, the listener is simply invoked.
       
   724  *
       
   725  * Each plugin that is injected into `EventsPluginHub` is immediately operable.
       
   726  *
       
   727  * @public
       
   728  */
       
   729 
       
   730 /**
       
   731  * Methods for injecting dependencies.
       
   732  */
       
   733 var injection = {
       
   734   /**
       
   735    * @param {array} InjectedEventPluginOrder
       
   736    * @public
       
   737    */
       
   738   injectEventPluginOrder: injectEventPluginOrder,
       
   739 
       
   740   /**
       
   741    * @param {object} injectedNamesToPlugins Map from names to plugin modules.
       
   742    */
       
   743   injectEventPluginsByName: injectEventPluginsByName
       
   744 };
       
   745 
       
   746 /**
       
   747  * @param {object} inst The instance, which is the source of events.
       
   748  * @param {string} registrationName Name of listener (e.g. `onClick`).
       
   749  * @return {?function} The stored callback.
       
   750  */
       
   751 function getListener(inst, registrationName) {
       
   752   var listener = void 0;
       
   753 
       
   754   // TODO: shouldPreventMouseEvent is DOM-specific and definitely should not
       
   755   // live here; needs to be moved to a better place soon
       
   756   var stateNode = inst.stateNode;
       
   757   if (!stateNode) {
       
   758     // Work in progress (ex: onload events in incremental mode).
       
   759     return null;
       
   760   }
       
   761   var props = getFiberCurrentPropsFromNode(stateNode);
       
   762   if (!props) {
       
   763     // Work in progress.
       
   764     return null;
       
   765   }
       
   766   listener = props[registrationName];
       
   767   if (shouldPreventMouseEvent(registrationName, inst.type, props)) {
       
   768     return null;
       
   769   }
       
   770   !(!listener || typeof listener === 'function') ? invariant(false, 'Expected `%s` listener to be a function, instead got a value of `%s` type.', registrationName, typeof listener) : void 0;
       
   771   return listener;
       
   772 }
       
   773 
       
   774 /**
       
   775  * Allows registered plugins an opportunity to extract events from top-level
       
   776  * native browser events.
       
   777  *
       
   778  * @return {*} An accumulation of synthetic events.
       
   779  * @internal
       
   780  */
       
   781 function extractEvents(topLevelType, targetInst, nativeEvent, nativeEventTarget) {
       
   782   var events = null;
       
   783   for (var i = 0; i < plugins.length; i++) {
       
   784     // Not every plugin in the ordering may be loaded at runtime.
       
   785     var possiblePlugin = plugins[i];
       
   786     if (possiblePlugin) {
       
   787       var extractedEvents = possiblePlugin.extractEvents(topLevelType, targetInst, nativeEvent, nativeEventTarget);
       
   788       if (extractedEvents) {
       
   789         events = accumulateInto(events, extractedEvents);
       
   790       }
       
   791     }
       
   792   }
       
   793   return events;
       
   794 }
       
   795 
       
   796 function runEventsInBatch(events) {
       
   797   if (events !== null) {
       
   798     eventQueue = accumulateInto(eventQueue, events);
       
   799   }
       
   800 
       
   801   // Set `eventQueue` to null before processing it so that we can tell if more
       
   802   // events get enqueued while processing.
       
   803   var processingEventQueue = eventQueue;
       
   804   eventQueue = null;
       
   805 
       
   806   if (!processingEventQueue) {
       
   807     return;
       
   808   }
       
   809 
       
   810   forEachAccumulated(processingEventQueue, executeDispatchesAndReleaseTopLevel);
       
   811   !!eventQueue ? invariant(false, 'processEventQueue(): Additional events were enqueued while processing an event queue. Support for this has not yet been implemented.') : void 0;
       
   812   // This would be a good time to rethrow if any of the event handlers threw.
       
   813   rethrowCaughtError();
       
   814 }
       
   815 
       
   816 function runExtractedEventsInBatch(topLevelType, targetInst, nativeEvent, nativeEventTarget) {
       
   817   var events = extractEvents(topLevelType, targetInst, nativeEvent, nativeEventTarget);
       
   818   runEventsInBatch(events);
       
   819 }
       
   820 
       
   821 var FunctionComponent = 0;
       
   822 var ClassComponent = 1;
       
   823 var IndeterminateComponent = 2; // Before we know whether it is function or class
       
   824 var HostRoot = 3; // Root of a host tree. Could be nested inside another node.
       
   825 var HostPortal = 4; // A subtree. Could be an entry point to a different renderer.
       
   826 var HostComponent = 5;
       
   827 var HostText = 6;
       
   828 var Fragment = 7;
       
   829 var Mode = 8;
       
   830 var ContextConsumer = 9;
       
   831 var ContextProvider = 10;
       
   832 var ForwardRef = 11;
       
   833 var Profiler = 12;
       
   834 var SuspenseComponent = 13;
       
   835 var MemoComponent = 14;
       
   836 var SimpleMemoComponent = 15;
       
   837 var LazyComponent = 16;
       
   838 var IncompleteClassComponent = 17;
       
   839 var DehydratedSuspenseComponent = 18;
       
   840 
       
   841 var randomKey = Math.random().toString(36).slice(2);
       
   842 var internalInstanceKey = '__reactInternalInstance$' + randomKey;
       
   843 var internalEventHandlersKey = '__reactEventHandlers$' + randomKey;
       
   844 
       
   845 function precacheFiberNode(hostInst, node) {
       
   846   node[internalInstanceKey] = hostInst;
       
   847 }
       
   848 
       
   849 /**
       
   850  * Given a DOM node, return the closest ReactDOMComponent or
       
   851  * ReactDOMTextComponent instance ancestor.
       
   852  */
       
   853 function getClosestInstanceFromNode(node) {
       
   854   if (node[internalInstanceKey]) {
       
   855     return node[internalInstanceKey];
       
   856   }
       
   857 
       
   858   while (!node[internalInstanceKey]) {
       
   859     if (node.parentNode) {
       
   860       node = node.parentNode;
       
   861     } else {
       
   862       // Top of the tree. This node must not be part of a React tree (or is
       
   863       // unmounted, potentially).
       
   864       return null;
       
   865     }
       
   866   }
       
   867 
       
   868   var inst = node[internalInstanceKey];
       
   869   if (inst.tag === HostComponent || inst.tag === HostText) {
       
   870     // In Fiber, this will always be the deepest root.
       
   871     return inst;
       
   872   }
       
   873 
       
   874   return null;
       
   875 }
       
   876 
       
   877 /**
       
   878  * Given a DOM node, return the ReactDOMComponent or ReactDOMTextComponent
       
   879  * instance, or null if the node was not rendered by this React.
       
   880  */
       
   881 function getInstanceFromNode$1(node) {
       
   882   var inst = node[internalInstanceKey];
       
   883   if (inst) {
       
   884     if (inst.tag === HostComponent || inst.tag === HostText) {
       
   885       return inst;
       
   886     } else {
       
   887       return null;
       
   888     }
       
   889   }
       
   890   return null;
       
   891 }
       
   892 
       
   893 /**
       
   894  * Given a ReactDOMComponent or ReactDOMTextComponent, return the corresponding
       
   895  * DOM node.
       
   896  */
       
   897 function getNodeFromInstance$1(inst) {
       
   898   if (inst.tag === HostComponent || inst.tag === HostText) {
       
   899     // In Fiber this, is just the state node right now. We assume it will be
       
   900     // a host component or host text.
       
   901     return inst.stateNode;
       
   902   }
       
   903 
       
   904   // Without this first invariant, passing a non-DOM-component triggers the next
       
   905   // invariant for a missing parent, which is super confusing.
       
   906   invariant(false, 'getNodeFromInstance: Invalid argument.');
       
   907 }
       
   908 
       
   909 function getFiberCurrentPropsFromNode$1(node) {
       
   910   return node[internalEventHandlersKey] || null;
       
   911 }
       
   912 
       
   913 function updateFiberProps(node, props) {
       
   914   node[internalEventHandlersKey] = props;
       
   915 }
       
   916 
       
   917 function getParent(inst) {
       
   918   do {
       
   919     inst = inst.return;
       
   920     // TODO: If this is a HostRoot we might want to bail out.
       
   921     // That is depending on if we want nested subtrees (layers) to bubble
       
   922     // events to their parent. We could also go through parentNode on the
       
   923     // host node but that wouldn't work for React Native and doesn't let us
       
   924     // do the portal feature.
       
   925   } while (inst && inst.tag !== HostComponent);
       
   926   if (inst) {
       
   927     return inst;
       
   928   }
       
   929   return null;
       
   930 }
       
   931 
       
   932 /**
       
   933  * Return the lowest common ancestor of A and B, or null if they are in
       
   934  * different trees.
       
   935  */
       
   936 function getLowestCommonAncestor(instA, instB) {
       
   937   var depthA = 0;
       
   938   for (var tempA = instA; tempA; tempA = getParent(tempA)) {
       
   939     depthA++;
       
   940   }
       
   941   var depthB = 0;
       
   942   for (var tempB = instB; tempB; tempB = getParent(tempB)) {
       
   943     depthB++;
       
   944   }
       
   945 
       
   946   // If A is deeper, crawl up.
       
   947   while (depthA - depthB > 0) {
       
   948     instA = getParent(instA);
       
   949     depthA--;
       
   950   }
       
   951 
       
   952   // If B is deeper, crawl up.
       
   953   while (depthB - depthA > 0) {
       
   954     instB = getParent(instB);
       
   955     depthB--;
       
   956   }
       
   957 
       
   958   // Walk in lockstep until we find a match.
       
   959   var depth = depthA;
       
   960   while (depth--) {
       
   961     if (instA === instB || instA === instB.alternate) {
       
   962       return instA;
       
   963     }
       
   964     instA = getParent(instA);
       
   965     instB = getParent(instB);
       
   966   }
       
   967   return null;
       
   968 }
       
   969 
       
   970 /**
       
   971  * Return if A is an ancestor of B.
       
   972  */
       
   973 
       
   974 
       
   975 /**
       
   976  * Return the parent instance of the passed-in instance.
       
   977  */
       
   978 
       
   979 
       
   980 /**
       
   981  * Simulates the traversal of a two-phase, capture/bubble event dispatch.
       
   982  */
       
   983 function traverseTwoPhase(inst, fn, arg) {
       
   984   var path = [];
       
   985   while (inst) {
       
   986     path.push(inst);
       
   987     inst = getParent(inst);
       
   988   }
       
   989   var i = void 0;
       
   990   for (i = path.length; i-- > 0;) {
       
   991     fn(path[i], 'captured', arg);
       
   992   }
       
   993   for (i = 0; i < path.length; i++) {
       
   994     fn(path[i], 'bubbled', arg);
       
   995   }
       
   996 }
       
   997 
       
   998 /**
       
   999  * Traverses the ID hierarchy and invokes the supplied `cb` on any IDs that
       
  1000  * should would receive a `mouseEnter` or `mouseLeave` event.
       
  1001  *
       
  1002  * Does not invoke the callback on the nearest common ancestor because nothing
       
  1003  * "entered" or "left" that element.
       
  1004  */
       
  1005 function traverseEnterLeave(from, to, fn, argFrom, argTo) {
       
  1006   var common = from && to ? getLowestCommonAncestor(from, to) : null;
       
  1007   var pathFrom = [];
       
  1008   while (true) {
       
  1009     if (!from) {
       
  1010       break;
       
  1011     }
       
  1012     if (from === common) {
       
  1013       break;
       
  1014     }
       
  1015     var alternate = from.alternate;
       
  1016     if (alternate !== null && alternate === common) {
       
  1017       break;
       
  1018     }
       
  1019     pathFrom.push(from);
       
  1020     from = getParent(from);
       
  1021   }
       
  1022   var pathTo = [];
       
  1023   while (true) {
       
  1024     if (!to) {
       
  1025       break;
       
  1026     }
       
  1027     if (to === common) {
       
  1028       break;
       
  1029     }
       
  1030     var _alternate = to.alternate;
       
  1031     if (_alternate !== null && _alternate === common) {
       
  1032       break;
       
  1033     }
       
  1034     pathTo.push(to);
       
  1035     to = getParent(to);
       
  1036   }
       
  1037   for (var i = 0; i < pathFrom.length; i++) {
       
  1038     fn(pathFrom[i], 'bubbled', argFrom);
       
  1039   }
       
  1040   for (var _i = pathTo.length; _i-- > 0;) {
       
  1041     fn(pathTo[_i], 'captured', argTo);
       
  1042   }
       
  1043 }
       
  1044 
       
  1045 /**
       
  1046  * Some event types have a notion of different registration names for different
       
  1047  * "phases" of propagation. This finds listeners by a given phase.
       
  1048  */
       
  1049 function listenerAtPhase(inst, event, propagationPhase) {
       
  1050   var registrationName = event.dispatchConfig.phasedRegistrationNames[propagationPhase];
       
  1051   return getListener(inst, registrationName);
       
  1052 }
       
  1053 
       
  1054 /**
       
  1055  * A small set of propagation patterns, each of which will accept a small amount
       
  1056  * of information, and generate a set of "dispatch ready event objects" - which
       
  1057  * are sets of events that have already been annotated with a set of dispatched
       
  1058  * listener functions/ids. The API is designed this way to discourage these
       
  1059  * propagation strategies from actually executing the dispatches, since we
       
  1060  * always want to collect the entire set of dispatches before executing even a
       
  1061  * single one.
       
  1062  */
       
  1063 
       
  1064 /**
       
  1065  * Tags a `SyntheticEvent` with dispatched listeners. Creating this function
       
  1066  * here, allows us to not have to bind or create functions for each event.
       
  1067  * Mutating the event's members allows us to not have to create a wrapping
       
  1068  * "dispatch" object that pairs the event with the listener.
       
  1069  */
       
  1070 function accumulateDirectionalDispatches(inst, phase, event) {
       
  1071   {
       
  1072     !inst ? warningWithoutStack$1(false, 'Dispatching inst must not be null') : void 0;
       
  1073   }
       
  1074   var listener = listenerAtPhase(inst, event, phase);
       
  1075   if (listener) {
       
  1076     event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);
       
  1077     event._dispatchInstances = accumulateInto(event._dispatchInstances, inst);
       
  1078   }
       
  1079 }
       
  1080 
       
  1081 /**
       
  1082  * Collect dispatches (must be entirely collected before dispatching - see unit
       
  1083  * tests). Lazily allocate the array to conserve memory.  We must loop through
       
  1084  * each event and perform the traversal for each one. We cannot perform a
       
  1085  * single traversal for the entire collection of events because each event may
       
  1086  * have a different target.
       
  1087  */
       
  1088 function accumulateTwoPhaseDispatchesSingle(event) {
       
  1089   if (event && event.dispatchConfig.phasedRegistrationNames) {
       
  1090     traverseTwoPhase(event._targetInst, accumulateDirectionalDispatches, event);
       
  1091   }
       
  1092 }
       
  1093 
       
  1094 /**
       
  1095  * Accumulates without regard to direction, does not look for phased
       
  1096  * registration names. Same as `accumulateDirectDispatchesSingle` but without
       
  1097  * requiring that the `dispatchMarker` be the same as the dispatched ID.
       
  1098  */
       
  1099 function accumulateDispatches(inst, ignoredDirection, event) {
       
  1100   if (inst && event && event.dispatchConfig.registrationName) {
       
  1101     var registrationName = event.dispatchConfig.registrationName;
       
  1102     var listener = getListener(inst, registrationName);
       
  1103     if (listener) {
       
  1104       event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);
       
  1105       event._dispatchInstances = accumulateInto(event._dispatchInstances, inst);
       
  1106     }
       
  1107   }
       
  1108 }
       
  1109 
       
  1110 /**
       
  1111  * Accumulates dispatches on an `SyntheticEvent`, but only for the
       
  1112  * `dispatchMarker`.
       
  1113  * @param {SyntheticEvent} event
       
  1114  */
       
  1115 function accumulateDirectDispatchesSingle(event) {
       
  1116   if (event && event.dispatchConfig.registrationName) {
       
  1117     accumulateDispatches(event._targetInst, null, event);
       
  1118   }
       
  1119 }
       
  1120 
       
  1121 function accumulateTwoPhaseDispatches(events) {
       
  1122   forEachAccumulated(events, accumulateTwoPhaseDispatchesSingle);
       
  1123 }
       
  1124 
       
  1125 
       
  1126 
       
  1127 function accumulateEnterLeaveDispatches(leave, enter, from, to) {
       
  1128   traverseEnterLeave(from, to, accumulateDispatches, leave, enter);
       
  1129 }
       
  1130 
       
  1131 function accumulateDirectDispatches(events) {
       
  1132   forEachAccumulated(events, accumulateDirectDispatchesSingle);
       
  1133 }
       
  1134 
       
  1135 var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
       
  1136 
       
  1137 // Do not uses the below two methods directly!
       
  1138 // Instead use constants exported from DOMTopLevelEventTypes in ReactDOM.
       
  1139 // (It is the only module that is allowed to access these methods.)
       
  1140 
       
  1141 function unsafeCastStringToDOMTopLevelType(topLevelType) {
       
  1142   return topLevelType;
       
  1143 }
       
  1144 
       
  1145 function unsafeCastDOMTopLevelTypeToString(topLevelType) {
       
  1146   return topLevelType;
       
  1147 }
       
  1148 
       
  1149 /**
       
  1150  * Generate a mapping of standard vendor prefixes using the defined style property and event name.
       
  1151  *
       
  1152  * @param {string} styleProp
       
  1153  * @param {string} eventName
       
  1154  * @returns {object}
       
  1155  */
       
  1156 function makePrefixMap(styleProp, eventName) {
       
  1157   var prefixes = {};
       
  1158 
       
  1159   prefixes[styleProp.toLowerCase()] = eventName.toLowerCase();
       
  1160   prefixes['Webkit' + styleProp] = 'webkit' + eventName;
       
  1161   prefixes['Moz' + styleProp] = 'moz' + eventName;
       
  1162 
       
  1163   return prefixes;
       
  1164 }
       
  1165 
       
  1166 /**
       
  1167  * A list of event names to a configurable list of vendor prefixes.
       
  1168  */
       
  1169 var vendorPrefixes = {
       
  1170   animationend: makePrefixMap('Animation', 'AnimationEnd'),
       
  1171   animationiteration: makePrefixMap('Animation', 'AnimationIteration'),
       
  1172   animationstart: makePrefixMap('Animation', 'AnimationStart'),
       
  1173   transitionend: makePrefixMap('Transition', 'TransitionEnd')
       
  1174 };
       
  1175 
       
  1176 /**
       
  1177  * Event names that have already been detected and prefixed (if applicable).
       
  1178  */
       
  1179 var prefixedEventNames = {};
       
  1180 
       
  1181 /**
       
  1182  * Element to check for prefixes on.
       
  1183  */
       
  1184 var style = {};
       
  1185 
       
  1186 /**
       
  1187  * Bootstrap if a DOM exists.
       
  1188  */
       
  1189 if (canUseDOM) {
       
  1190   style = document.createElement('div').style;
       
  1191 
       
  1192   // On some platforms, in particular some releases of Android 4.x,
       
  1193   // the un-prefixed "animation" and "transition" properties are defined on the
       
  1194   // style object but the events that fire will still be prefixed, so we need
       
  1195   // to check if the un-prefixed events are usable, and if not remove them from the map.
       
  1196   if (!('AnimationEvent' in window)) {
       
  1197     delete vendorPrefixes.animationend.animation;
       
  1198     delete vendorPrefixes.animationiteration.animation;
       
  1199     delete vendorPrefixes.animationstart.animation;
       
  1200   }
       
  1201 
       
  1202   // Same as above
       
  1203   if (!('TransitionEvent' in window)) {
       
  1204     delete vendorPrefixes.transitionend.transition;
       
  1205   }
       
  1206 }
       
  1207 
       
  1208 /**
       
  1209  * Attempts to determine the correct vendor prefixed event name.
       
  1210  *
       
  1211  * @param {string} eventName
       
  1212  * @returns {string}
       
  1213  */
       
  1214 function getVendorPrefixedEventName(eventName) {
       
  1215   if (prefixedEventNames[eventName]) {
       
  1216     return prefixedEventNames[eventName];
       
  1217   } else if (!vendorPrefixes[eventName]) {
       
  1218     return eventName;
       
  1219   }
       
  1220 
       
  1221   var prefixMap = vendorPrefixes[eventName];
       
  1222 
       
  1223   for (var styleProp in prefixMap) {
       
  1224     if (prefixMap.hasOwnProperty(styleProp) && styleProp in style) {
       
  1225       return prefixedEventNames[eventName] = prefixMap[styleProp];
       
  1226     }
       
  1227   }
       
  1228 
       
  1229   return eventName;
       
  1230 }
       
  1231 
       
  1232 /**
       
  1233  * To identify top level events in ReactDOM, we use constants defined by this
       
  1234  * module. This is the only module that uses the unsafe* methods to express
       
  1235  * that the constants actually correspond to the browser event names. This lets
       
  1236  * us save some bundle size by avoiding a top level type -> event name map.
       
  1237  * The rest of ReactDOM code should import top level types from this file.
       
  1238  */
       
  1239 var TOP_ABORT = unsafeCastStringToDOMTopLevelType('abort');
       
  1240 var TOP_ANIMATION_END = unsafeCastStringToDOMTopLevelType(getVendorPrefixedEventName('animationend'));
       
  1241 var TOP_ANIMATION_ITERATION = unsafeCastStringToDOMTopLevelType(getVendorPrefixedEventName('animationiteration'));
       
  1242 var TOP_ANIMATION_START = unsafeCastStringToDOMTopLevelType(getVendorPrefixedEventName('animationstart'));
       
  1243 var TOP_BLUR = unsafeCastStringToDOMTopLevelType('blur');
       
  1244 var TOP_CAN_PLAY = unsafeCastStringToDOMTopLevelType('canplay');
       
  1245 var TOP_CAN_PLAY_THROUGH = unsafeCastStringToDOMTopLevelType('canplaythrough');
       
  1246 var TOP_CANCEL = unsafeCastStringToDOMTopLevelType('cancel');
       
  1247 var TOP_CHANGE = unsafeCastStringToDOMTopLevelType('change');
       
  1248 var TOP_CLICK = unsafeCastStringToDOMTopLevelType('click');
       
  1249 var TOP_CLOSE = unsafeCastStringToDOMTopLevelType('close');
       
  1250 var TOP_COMPOSITION_END = unsafeCastStringToDOMTopLevelType('compositionend');
       
  1251 var TOP_COMPOSITION_START = unsafeCastStringToDOMTopLevelType('compositionstart');
       
  1252 var TOP_COMPOSITION_UPDATE = unsafeCastStringToDOMTopLevelType('compositionupdate');
       
  1253 var TOP_CONTEXT_MENU = unsafeCastStringToDOMTopLevelType('contextmenu');
       
  1254 var TOP_COPY = unsafeCastStringToDOMTopLevelType('copy');
       
  1255 var TOP_CUT = unsafeCastStringToDOMTopLevelType('cut');
       
  1256 var TOP_DOUBLE_CLICK = unsafeCastStringToDOMTopLevelType('dblclick');
       
  1257 var TOP_AUX_CLICK = unsafeCastStringToDOMTopLevelType('auxclick');
       
  1258 var TOP_DRAG = unsafeCastStringToDOMTopLevelType('drag');
       
  1259 var TOP_DRAG_END = unsafeCastStringToDOMTopLevelType('dragend');
       
  1260 var TOP_DRAG_ENTER = unsafeCastStringToDOMTopLevelType('dragenter');
       
  1261 var TOP_DRAG_EXIT = unsafeCastStringToDOMTopLevelType('dragexit');
       
  1262 var TOP_DRAG_LEAVE = unsafeCastStringToDOMTopLevelType('dragleave');
       
  1263 var TOP_DRAG_OVER = unsafeCastStringToDOMTopLevelType('dragover');
       
  1264 var TOP_DRAG_START = unsafeCastStringToDOMTopLevelType('dragstart');
       
  1265 var TOP_DROP = unsafeCastStringToDOMTopLevelType('drop');
       
  1266 var TOP_DURATION_CHANGE = unsafeCastStringToDOMTopLevelType('durationchange');
       
  1267 var TOP_EMPTIED = unsafeCastStringToDOMTopLevelType('emptied');
       
  1268 var TOP_ENCRYPTED = unsafeCastStringToDOMTopLevelType('encrypted');
       
  1269 var TOP_ENDED = unsafeCastStringToDOMTopLevelType('ended');
       
  1270 var TOP_ERROR = unsafeCastStringToDOMTopLevelType('error');
       
  1271 var TOP_FOCUS = unsafeCastStringToDOMTopLevelType('focus');
       
  1272 var TOP_GOT_POINTER_CAPTURE = unsafeCastStringToDOMTopLevelType('gotpointercapture');
       
  1273 var TOP_INPUT = unsafeCastStringToDOMTopLevelType('input');
       
  1274 var TOP_INVALID = unsafeCastStringToDOMTopLevelType('invalid');
       
  1275 var TOP_KEY_DOWN = unsafeCastStringToDOMTopLevelType('keydown');
       
  1276 var TOP_KEY_PRESS = unsafeCastStringToDOMTopLevelType('keypress');
       
  1277 var TOP_KEY_UP = unsafeCastStringToDOMTopLevelType('keyup');
       
  1278 var TOP_LOAD = unsafeCastStringToDOMTopLevelType('load');
       
  1279 var TOP_LOAD_START = unsafeCastStringToDOMTopLevelType('loadstart');
       
  1280 var TOP_LOADED_DATA = unsafeCastStringToDOMTopLevelType('loadeddata');
       
  1281 var TOP_LOADED_METADATA = unsafeCastStringToDOMTopLevelType('loadedmetadata');
       
  1282 var TOP_LOST_POINTER_CAPTURE = unsafeCastStringToDOMTopLevelType('lostpointercapture');
       
  1283 var TOP_MOUSE_DOWN = unsafeCastStringToDOMTopLevelType('mousedown');
       
  1284 var TOP_MOUSE_MOVE = unsafeCastStringToDOMTopLevelType('mousemove');
       
  1285 var TOP_MOUSE_OUT = unsafeCastStringToDOMTopLevelType('mouseout');
       
  1286 var TOP_MOUSE_OVER = unsafeCastStringToDOMTopLevelType('mouseover');
       
  1287 var TOP_MOUSE_UP = unsafeCastStringToDOMTopLevelType('mouseup');
       
  1288 var TOP_PASTE = unsafeCastStringToDOMTopLevelType('paste');
       
  1289 var TOP_PAUSE = unsafeCastStringToDOMTopLevelType('pause');
       
  1290 var TOP_PLAY = unsafeCastStringToDOMTopLevelType('play');
       
  1291 var TOP_PLAYING = unsafeCastStringToDOMTopLevelType('playing');
       
  1292 var TOP_POINTER_CANCEL = unsafeCastStringToDOMTopLevelType('pointercancel');
       
  1293 var TOP_POINTER_DOWN = unsafeCastStringToDOMTopLevelType('pointerdown');
       
  1294 
       
  1295 
       
  1296 var TOP_POINTER_MOVE = unsafeCastStringToDOMTopLevelType('pointermove');
       
  1297 var TOP_POINTER_OUT = unsafeCastStringToDOMTopLevelType('pointerout');
       
  1298 var TOP_POINTER_OVER = unsafeCastStringToDOMTopLevelType('pointerover');
       
  1299 var TOP_POINTER_UP = unsafeCastStringToDOMTopLevelType('pointerup');
       
  1300 var TOP_PROGRESS = unsafeCastStringToDOMTopLevelType('progress');
       
  1301 var TOP_RATE_CHANGE = unsafeCastStringToDOMTopLevelType('ratechange');
       
  1302 var TOP_RESET = unsafeCastStringToDOMTopLevelType('reset');
       
  1303 var TOP_SCROLL = unsafeCastStringToDOMTopLevelType('scroll');
       
  1304 var TOP_SEEKED = unsafeCastStringToDOMTopLevelType('seeked');
       
  1305 var TOP_SEEKING = unsafeCastStringToDOMTopLevelType('seeking');
       
  1306 var TOP_SELECTION_CHANGE = unsafeCastStringToDOMTopLevelType('selectionchange');
       
  1307 var TOP_STALLED = unsafeCastStringToDOMTopLevelType('stalled');
       
  1308 var TOP_SUBMIT = unsafeCastStringToDOMTopLevelType('submit');
       
  1309 var TOP_SUSPEND = unsafeCastStringToDOMTopLevelType('suspend');
       
  1310 var TOP_TEXT_INPUT = unsafeCastStringToDOMTopLevelType('textInput');
       
  1311 var TOP_TIME_UPDATE = unsafeCastStringToDOMTopLevelType('timeupdate');
       
  1312 var TOP_TOGGLE = unsafeCastStringToDOMTopLevelType('toggle');
       
  1313 var TOP_TOUCH_CANCEL = unsafeCastStringToDOMTopLevelType('touchcancel');
       
  1314 var TOP_TOUCH_END = unsafeCastStringToDOMTopLevelType('touchend');
       
  1315 var TOP_TOUCH_MOVE = unsafeCastStringToDOMTopLevelType('touchmove');
       
  1316 var TOP_TOUCH_START = unsafeCastStringToDOMTopLevelType('touchstart');
       
  1317 var TOP_TRANSITION_END = unsafeCastStringToDOMTopLevelType(getVendorPrefixedEventName('transitionend'));
       
  1318 var TOP_VOLUME_CHANGE = unsafeCastStringToDOMTopLevelType('volumechange');
       
  1319 var TOP_WAITING = unsafeCastStringToDOMTopLevelType('waiting');
       
  1320 var TOP_WHEEL = unsafeCastStringToDOMTopLevelType('wheel');
       
  1321 
       
  1322 // List of events that need to be individually attached to media elements.
       
  1323 // Note that events in this list will *not* be listened to at the top level
       
  1324 // unless they're explicitly whitelisted in `ReactBrowserEventEmitter.listenTo`.
       
  1325 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];
       
  1326 
       
  1327 function getRawEventName(topLevelType) {
       
  1328   return unsafeCastDOMTopLevelTypeToString(topLevelType);
       
  1329 }
       
  1330 
       
  1331 /**
       
  1332  * These variables store information about text content of a target node,
       
  1333  * allowing comparison of content before and after a given event.
       
  1334  *
       
  1335  * Identify the node where selection currently begins, then observe
       
  1336  * both its text content and its current position in the DOM. Since the
       
  1337  * browser may natively replace the target node during composition, we can
       
  1338  * use its position to find its replacement.
       
  1339  *
       
  1340  *
       
  1341  */
       
  1342 
       
  1343 var root = null;
       
  1344 var startText = null;
       
  1345 var fallbackText = null;
       
  1346 
       
  1347 function initialize(nativeEventTarget) {
       
  1348   root = nativeEventTarget;
       
  1349   startText = getText();
       
  1350   return true;
       
  1351 }
       
  1352 
       
  1353 function reset() {
       
  1354   root = null;
       
  1355   startText = null;
       
  1356   fallbackText = null;
       
  1357 }
       
  1358 
       
  1359 function getData() {
       
  1360   if (fallbackText) {
       
  1361     return fallbackText;
       
  1362   }
       
  1363 
       
  1364   var start = void 0;
       
  1365   var startValue = startText;
       
  1366   var startLength = startValue.length;
       
  1367   var end = void 0;
       
  1368   var endValue = getText();
       
  1369   var endLength = endValue.length;
       
  1370 
       
  1371   for (start = 0; start < startLength; start++) {
       
  1372     if (startValue[start] !== endValue[start]) {
       
  1373       break;
       
  1374     }
       
  1375   }
       
  1376 
       
  1377   var minEnd = startLength - start;
       
  1378   for (end = 1; end <= minEnd; end++) {
       
  1379     if (startValue[startLength - end] !== endValue[endLength - end]) {
       
  1380       break;
       
  1381     }
       
  1382   }
       
  1383 
       
  1384   var sliceTail = end > 1 ? 1 - end : undefined;
       
  1385   fallbackText = endValue.slice(start, sliceTail);
       
  1386   return fallbackText;
       
  1387 }
       
  1388 
       
  1389 function getText() {
       
  1390   if ('value' in root) {
       
  1391     return root.value;
       
  1392   }
       
  1393   return root.textContent;
       
  1394 }
       
  1395 
       
  1396 var ReactInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
       
  1397 
       
  1398 var _assign = ReactInternals.assign;
       
  1399 
       
  1400 /* eslint valid-typeof: 0 */
       
  1401 
       
  1402 var EVENT_POOL_SIZE = 10;
       
  1403 
       
  1404 /**
       
  1405  * @interface Event
       
  1406  * @see http://www.w3.org/TR/DOM-Level-3-Events/
       
  1407  */
       
  1408 var EventInterface = {
       
  1409   type: null,
       
  1410   target: null,
       
  1411   // currentTarget is set when dispatching; no use in copying it here
       
  1412   currentTarget: function () {
       
  1413     return null;
       
  1414   },
       
  1415   eventPhase: null,
       
  1416   bubbles: null,
       
  1417   cancelable: null,
       
  1418   timeStamp: function (event) {
       
  1419     return event.timeStamp || Date.now();
       
  1420   },
       
  1421   defaultPrevented: null,
       
  1422   isTrusted: null
       
  1423 };
       
  1424 
       
  1425 function functionThatReturnsTrue() {
       
  1426   return true;
       
  1427 }
       
  1428 
       
  1429 function functionThatReturnsFalse() {
       
  1430   return false;
       
  1431 }
       
  1432 
       
  1433 /**
       
  1434  * Synthetic events are dispatched by event plugins, typically in response to a
       
  1435  * top-level event delegation handler.
       
  1436  *
       
  1437  * These systems should generally use pooling to reduce the frequency of garbage
       
  1438  * collection. The system should check `isPersistent` to determine whether the
       
  1439  * event should be released into the pool after being dispatched. Users that
       
  1440  * need a persisted event should invoke `persist`.
       
  1441  *
       
  1442  * Synthetic events (and subclasses) implement the DOM Level 3 Events API by
       
  1443  * normalizing browser quirks. Subclasses do not necessarily have to implement a
       
  1444  * DOM interface; custom application-specific events can also subclass this.
       
  1445  *
       
  1446  * @param {object} dispatchConfig Configuration used to dispatch this event.
       
  1447  * @param {*} targetInst Marker identifying the event target.
       
  1448  * @param {object} nativeEvent Native browser event.
       
  1449  * @param {DOMEventTarget} nativeEventTarget Target node.
       
  1450  */
       
  1451 function SyntheticEvent(dispatchConfig, targetInst, nativeEvent, nativeEventTarget) {
       
  1452   {
       
  1453     // these have a getter/setter for warnings
       
  1454     delete this.nativeEvent;
       
  1455     delete this.preventDefault;
       
  1456     delete this.stopPropagation;
       
  1457     delete this.isDefaultPrevented;
       
  1458     delete this.isPropagationStopped;
       
  1459   }
       
  1460 
       
  1461   this.dispatchConfig = dispatchConfig;
       
  1462   this._targetInst = targetInst;
       
  1463   this.nativeEvent = nativeEvent;
       
  1464 
       
  1465   var Interface = this.constructor.Interface;
       
  1466   for (var propName in Interface) {
       
  1467     if (!Interface.hasOwnProperty(propName)) {
       
  1468       continue;
       
  1469     }
       
  1470     {
       
  1471       delete this[propName]; // this has a getter/setter for warnings
       
  1472     }
       
  1473     var normalize = Interface[propName];
       
  1474     if (normalize) {
       
  1475       this[propName] = normalize(nativeEvent);
       
  1476     } else {
       
  1477       if (propName === 'target') {
       
  1478         this.target = nativeEventTarget;
       
  1479       } else {
       
  1480         this[propName] = nativeEvent[propName];
       
  1481       }
       
  1482     }
       
  1483   }
       
  1484 
       
  1485   var defaultPrevented = nativeEvent.defaultPrevented != null ? nativeEvent.defaultPrevented : nativeEvent.returnValue === false;
       
  1486   if (defaultPrevented) {
       
  1487     this.isDefaultPrevented = functionThatReturnsTrue;
       
  1488   } else {
       
  1489     this.isDefaultPrevented = functionThatReturnsFalse;
       
  1490   }
       
  1491   this.isPropagationStopped = functionThatReturnsFalse;
       
  1492   return this;
       
  1493 }
       
  1494 
       
  1495 _assign(SyntheticEvent.prototype, {
       
  1496   preventDefault: function () {
       
  1497     this.defaultPrevented = true;
       
  1498     var event = this.nativeEvent;
       
  1499     if (!event) {
       
  1500       return;
       
  1501     }
       
  1502 
       
  1503     if (event.preventDefault) {
       
  1504       event.preventDefault();
       
  1505     } else if (typeof event.returnValue !== 'unknown') {
       
  1506       event.returnValue = false;
       
  1507     }
       
  1508     this.isDefaultPrevented = functionThatReturnsTrue;
       
  1509   },
       
  1510 
       
  1511   stopPropagation: function () {
       
  1512     var event = this.nativeEvent;
       
  1513     if (!event) {
       
  1514       return;
       
  1515     }
       
  1516 
       
  1517     if (event.stopPropagation) {
       
  1518       event.stopPropagation();
       
  1519     } else if (typeof event.cancelBubble !== 'unknown') {
       
  1520       // The ChangeEventPlugin registers a "propertychange" event for
       
  1521       // IE. This event does not support bubbling or cancelling, and
       
  1522       // any references to cancelBubble throw "Member not found".  A
       
  1523       // typeof check of "unknown" circumvents this issue (and is also
       
  1524       // IE specific).
       
  1525       event.cancelBubble = true;
       
  1526     }
       
  1527 
       
  1528     this.isPropagationStopped = functionThatReturnsTrue;
       
  1529   },
       
  1530 
       
  1531   /**
       
  1532    * We release all dispatched `SyntheticEvent`s after each event loop, adding
       
  1533    * them back into the pool. This allows a way to hold onto a reference that
       
  1534    * won't be added back into the pool.
       
  1535    */
       
  1536   persist: function () {
       
  1537     this.isPersistent = functionThatReturnsTrue;
       
  1538   },
       
  1539 
       
  1540   /**
       
  1541    * Checks if this event should be released back into the pool.
       
  1542    *
       
  1543    * @return {boolean} True if this should not be released, false otherwise.
       
  1544    */
       
  1545   isPersistent: functionThatReturnsFalse,
       
  1546 
       
  1547   /**
       
  1548    * `PooledClass` looks for `destructor` on each instance it releases.
       
  1549    */
       
  1550   destructor: function () {
       
  1551     var Interface = this.constructor.Interface;
       
  1552     for (var propName in Interface) {
       
  1553       {
       
  1554         Object.defineProperty(this, propName, getPooledWarningPropertyDefinition(propName, Interface[propName]));
       
  1555       }
       
  1556     }
       
  1557     this.dispatchConfig = null;
       
  1558     this._targetInst = null;
       
  1559     this.nativeEvent = null;
       
  1560     this.isDefaultPrevented = functionThatReturnsFalse;
       
  1561     this.isPropagationStopped = functionThatReturnsFalse;
       
  1562     this._dispatchListeners = null;
       
  1563     this._dispatchInstances = null;
       
  1564     {
       
  1565       Object.defineProperty(this, 'nativeEvent', getPooledWarningPropertyDefinition('nativeEvent', null));
       
  1566       Object.defineProperty(this, 'isDefaultPrevented', getPooledWarningPropertyDefinition('isDefaultPrevented', functionThatReturnsFalse));
       
  1567       Object.defineProperty(this, 'isPropagationStopped', getPooledWarningPropertyDefinition('isPropagationStopped', functionThatReturnsFalse));
       
  1568       Object.defineProperty(this, 'preventDefault', getPooledWarningPropertyDefinition('preventDefault', function () {}));
       
  1569       Object.defineProperty(this, 'stopPropagation', getPooledWarningPropertyDefinition('stopPropagation', function () {}));
       
  1570     }
       
  1571   }
       
  1572 });
       
  1573 
       
  1574 SyntheticEvent.Interface = EventInterface;
       
  1575 
       
  1576 /**
       
  1577  * Helper to reduce boilerplate when creating subclasses.
       
  1578  */
       
  1579 SyntheticEvent.extend = function (Interface) {
       
  1580   var Super = this;
       
  1581 
       
  1582   var E = function () {};
       
  1583   E.prototype = Super.prototype;
       
  1584   var prototype = new E();
       
  1585 
       
  1586   function Class() {
       
  1587     return Super.apply(this, arguments);
       
  1588   }
       
  1589   _assign(prototype, Class.prototype);
       
  1590   Class.prototype = prototype;
       
  1591   Class.prototype.constructor = Class;
       
  1592 
       
  1593   Class.Interface = _assign({}, Super.Interface, Interface);
       
  1594   Class.extend = Super.extend;
       
  1595   addEventPoolingTo(Class);
       
  1596 
       
  1597   return Class;
       
  1598 };
       
  1599 
       
  1600 addEventPoolingTo(SyntheticEvent);
       
  1601 
       
  1602 /**
       
  1603  * Helper to nullify syntheticEvent instance properties when destructing
       
  1604  *
       
  1605  * @param {String} propName
       
  1606  * @param {?object} getVal
       
  1607  * @return {object} defineProperty object
       
  1608  */
       
  1609 function getPooledWarningPropertyDefinition(propName, getVal) {
       
  1610   var isFunction = typeof getVal === 'function';
       
  1611   return {
       
  1612     configurable: true,
       
  1613     set: set,
       
  1614     get: get
       
  1615   };
       
  1616 
       
  1617   function set(val) {
       
  1618     var action = isFunction ? 'setting the method' : 'setting the property';
       
  1619     warn(action, 'This is effectively a no-op');
       
  1620     return val;
       
  1621   }
       
  1622 
       
  1623   function get() {
       
  1624     var action = isFunction ? 'accessing the method' : 'accessing the property';
       
  1625     var result = isFunction ? 'This is a no-op function' : 'This is set to null';
       
  1626     warn(action, result);
       
  1627     return getVal;
       
  1628   }
       
  1629 
       
  1630   function warn(action, result) {
       
  1631     var warningCondition = false;
       
  1632     !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;
       
  1633   }
       
  1634 }
       
  1635 
       
  1636 function getPooledEvent(dispatchConfig, targetInst, nativeEvent, nativeInst) {
       
  1637   var EventConstructor = this;
       
  1638   if (EventConstructor.eventPool.length) {
       
  1639     var instance = EventConstructor.eventPool.pop();
       
  1640     EventConstructor.call(instance, dispatchConfig, targetInst, nativeEvent, nativeInst);
       
  1641     return instance;
       
  1642   }
       
  1643   return new EventConstructor(dispatchConfig, targetInst, nativeEvent, nativeInst);
       
  1644 }
       
  1645 
       
  1646 function releasePooledEvent(event) {
       
  1647   var EventConstructor = this;
       
  1648   !(event instanceof EventConstructor) ? invariant(false, 'Trying to release an event instance into a pool of a different type.') : void 0;
       
  1649   event.destructor();
       
  1650   if (EventConstructor.eventPool.length < EVENT_POOL_SIZE) {
       
  1651     EventConstructor.eventPool.push(event);
       
  1652   }
       
  1653 }
       
  1654 
       
  1655 function addEventPoolingTo(EventConstructor) {
       
  1656   EventConstructor.eventPool = [];
       
  1657   EventConstructor.getPooled = getPooledEvent;
       
  1658   EventConstructor.release = releasePooledEvent;
       
  1659 }
       
  1660 
       
  1661 /**
       
  1662  * @interface Event
       
  1663  * @see http://www.w3.org/TR/DOM-Level-3-Events/#events-compositionevents
       
  1664  */
       
  1665 var SyntheticCompositionEvent = SyntheticEvent.extend({
       
  1666   data: null
       
  1667 });
       
  1668 
       
  1669 /**
       
  1670  * @interface Event
       
  1671  * @see http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105
       
  1672  *      /#events-inputevents
       
  1673  */
       
  1674 var SyntheticInputEvent = SyntheticEvent.extend({
       
  1675   data: null
       
  1676 });
       
  1677 
       
  1678 var END_KEYCODES = [9, 13, 27, 32]; // Tab, Return, Esc, Space
       
  1679 var START_KEYCODE = 229;
       
  1680 
       
  1681 var canUseCompositionEvent = canUseDOM && 'CompositionEvent' in window;
       
  1682 
       
  1683 var documentMode = null;
       
  1684 if (canUseDOM && 'documentMode' in document) {
       
  1685   documentMode = document.documentMode;
       
  1686 }
       
  1687 
       
  1688 // Webkit offers a very useful `textInput` event that can be used to
       
  1689 // directly represent `beforeInput`. The IE `textinput` event is not as
       
  1690 // useful, so we don't use it.
       
  1691 var canUseTextInputEvent = canUseDOM && 'TextEvent' in window && !documentMode;
       
  1692 
       
  1693 // In IE9+, we have access to composition events, but the data supplied
       
  1694 // by the native compositionend event may be incorrect. Japanese ideographic
       
  1695 // spaces, for instance (\u3000) are not recorded correctly.
       
  1696 var useFallbackCompositionData = canUseDOM && (!canUseCompositionEvent || documentMode && documentMode > 8 && documentMode <= 11);
       
  1697 
       
  1698 var SPACEBAR_CODE = 32;
       
  1699 var SPACEBAR_CHAR = String.fromCharCode(SPACEBAR_CODE);
       
  1700 
       
  1701 // Events and their corresponding property names.
       
  1702 var eventTypes = {
       
  1703   beforeInput: {
       
  1704     phasedRegistrationNames: {
       
  1705       bubbled: 'onBeforeInput',
       
  1706       captured: 'onBeforeInputCapture'
       
  1707     },
       
  1708     dependencies: [TOP_COMPOSITION_END, TOP_KEY_PRESS, TOP_TEXT_INPUT, TOP_PASTE]
       
  1709   },
       
  1710   compositionEnd: {
       
  1711     phasedRegistrationNames: {
       
  1712       bubbled: 'onCompositionEnd',
       
  1713       captured: 'onCompositionEndCapture'
       
  1714     },
       
  1715     dependencies: [TOP_BLUR, TOP_COMPOSITION_END, TOP_KEY_DOWN, TOP_KEY_PRESS, TOP_KEY_UP, TOP_MOUSE_DOWN]
       
  1716   },
       
  1717   compositionStart: {
       
  1718     phasedRegistrationNames: {
       
  1719       bubbled: 'onCompositionStart',
       
  1720       captured: 'onCompositionStartCapture'
       
  1721     },
       
  1722     dependencies: [TOP_BLUR, TOP_COMPOSITION_START, TOP_KEY_DOWN, TOP_KEY_PRESS, TOP_KEY_UP, TOP_MOUSE_DOWN]
       
  1723   },
       
  1724   compositionUpdate: {
       
  1725     phasedRegistrationNames: {
       
  1726       bubbled: 'onCompositionUpdate',
       
  1727       captured: 'onCompositionUpdateCapture'
       
  1728     },
       
  1729     dependencies: [TOP_BLUR, TOP_COMPOSITION_UPDATE, TOP_KEY_DOWN, TOP_KEY_PRESS, TOP_KEY_UP, TOP_MOUSE_DOWN]
       
  1730   }
       
  1731 };
       
  1732 
       
  1733 // Track whether we've ever handled a keypress on the space key.
       
  1734 var hasSpaceKeypress = false;
       
  1735 
       
  1736 /**
       
  1737  * Return whether a native keypress event is assumed to be a command.
       
  1738  * This is required because Firefox fires `keypress` events for key commands
       
  1739  * (cut, copy, select-all, etc.) even though no character is inserted.
       
  1740  */
       
  1741 function isKeypressCommand(nativeEvent) {
       
  1742   return (nativeEvent.ctrlKey || nativeEvent.altKey || nativeEvent.metaKey) &&
       
  1743   // ctrlKey && altKey is equivalent to AltGr, and is not a command.
       
  1744   !(nativeEvent.ctrlKey && nativeEvent.altKey);
       
  1745 }
       
  1746 
       
  1747 /**
       
  1748  * Translate native top level events into event types.
       
  1749  *
       
  1750  * @param {string} topLevelType
       
  1751  * @return {object}
       
  1752  */
       
  1753 function getCompositionEventType(topLevelType) {
       
  1754   switch (topLevelType) {
       
  1755     case TOP_COMPOSITION_START:
       
  1756       return eventTypes.compositionStart;
       
  1757     case TOP_COMPOSITION_END:
       
  1758       return eventTypes.compositionEnd;
       
  1759     case TOP_COMPOSITION_UPDATE:
       
  1760       return eventTypes.compositionUpdate;
       
  1761   }
       
  1762 }
       
  1763 
       
  1764 /**
       
  1765  * Does our fallback best-guess model think this event signifies that
       
  1766  * composition has begun?
       
  1767  *
       
  1768  * @param {string} topLevelType
       
  1769  * @param {object} nativeEvent
       
  1770  * @return {boolean}
       
  1771  */
       
  1772 function isFallbackCompositionStart(topLevelType, nativeEvent) {
       
  1773   return topLevelType === TOP_KEY_DOWN && nativeEvent.keyCode === START_KEYCODE;
       
  1774 }
       
  1775 
       
  1776 /**
       
  1777  * Does our fallback mode think that this event is the end of composition?
       
  1778  *
       
  1779  * @param {string} topLevelType
       
  1780  * @param {object} nativeEvent
       
  1781  * @return {boolean}
       
  1782  */
       
  1783 function isFallbackCompositionEnd(topLevelType, nativeEvent) {
       
  1784   switch (topLevelType) {
       
  1785     case TOP_KEY_UP:
       
  1786       // Command keys insert or clear IME input.
       
  1787       return END_KEYCODES.indexOf(nativeEvent.keyCode) !== -1;
       
  1788     case TOP_KEY_DOWN:
       
  1789       // Expect IME keyCode on each keydown. If we get any other
       
  1790       // code we must have exited earlier.
       
  1791       return nativeEvent.keyCode !== START_KEYCODE;
       
  1792     case TOP_KEY_PRESS:
       
  1793     case TOP_MOUSE_DOWN:
       
  1794     case TOP_BLUR:
       
  1795       // Events are not possible without cancelling IME.
       
  1796       return true;
       
  1797     default:
       
  1798       return false;
       
  1799   }
       
  1800 }
       
  1801 
       
  1802 /**
       
  1803  * Google Input Tools provides composition data via a CustomEvent,
       
  1804  * with the `data` property populated in the `detail` object. If this
       
  1805  * is available on the event object, use it. If not, this is a plain
       
  1806  * composition event and we have nothing special to extract.
       
  1807  *
       
  1808  * @param {object} nativeEvent
       
  1809  * @return {?string}
       
  1810  */
       
  1811 function getDataFromCustomEvent(nativeEvent) {
       
  1812   var detail = nativeEvent.detail;
       
  1813   if (typeof detail === 'object' && 'data' in detail) {
       
  1814     return detail.data;
       
  1815   }
       
  1816   return null;
       
  1817 }
       
  1818 
       
  1819 /**
       
  1820  * Check if a composition event was triggered by Korean IME.
       
  1821  * Our fallback mode does not work well with IE's Korean IME,
       
  1822  * so just use native composition events when Korean IME is used.
       
  1823  * Although CompositionEvent.locale property is deprecated,
       
  1824  * it is available in IE, where our fallback mode is enabled.
       
  1825  *
       
  1826  * @param {object} nativeEvent
       
  1827  * @return {boolean}
       
  1828  */
       
  1829 function isUsingKoreanIME(nativeEvent) {
       
  1830   return nativeEvent.locale === 'ko';
       
  1831 }
       
  1832 
       
  1833 // Track the current IME composition status, if any.
       
  1834 var isComposing = false;
       
  1835 
       
  1836 /**
       
  1837  * @return {?object} A SyntheticCompositionEvent.
       
  1838  */
       
  1839 function extractCompositionEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget) {
       
  1840   var eventType = void 0;
       
  1841   var fallbackData = void 0;
       
  1842 
       
  1843   if (canUseCompositionEvent) {
       
  1844     eventType = getCompositionEventType(topLevelType);
       
  1845   } else if (!isComposing) {
       
  1846     if (isFallbackCompositionStart(topLevelType, nativeEvent)) {
       
  1847       eventType = eventTypes.compositionStart;
       
  1848     }
       
  1849   } else if (isFallbackCompositionEnd(topLevelType, nativeEvent)) {
       
  1850     eventType = eventTypes.compositionEnd;
       
  1851   }
       
  1852 
       
  1853   if (!eventType) {
       
  1854     return null;
       
  1855   }
       
  1856 
       
  1857   if (useFallbackCompositionData && !isUsingKoreanIME(nativeEvent)) {
       
  1858     // The current composition is stored statically and must not be
       
  1859     // overwritten while composition continues.
       
  1860     if (!isComposing && eventType === eventTypes.compositionStart) {
       
  1861       isComposing = initialize(nativeEventTarget);
       
  1862     } else if (eventType === eventTypes.compositionEnd) {
       
  1863       if (isComposing) {
       
  1864         fallbackData = getData();
       
  1865       }
       
  1866     }
       
  1867   }
       
  1868 
       
  1869   var event = SyntheticCompositionEvent.getPooled(eventType, targetInst, nativeEvent, nativeEventTarget);
       
  1870 
       
  1871   if (fallbackData) {
       
  1872     // Inject data generated from fallback path into the synthetic event.
       
  1873     // This matches the property of native CompositionEventInterface.
       
  1874     event.data = fallbackData;
       
  1875   } else {
       
  1876     var customData = getDataFromCustomEvent(nativeEvent);
       
  1877     if (customData !== null) {
       
  1878       event.data = customData;
       
  1879     }
       
  1880   }
       
  1881 
       
  1882   accumulateTwoPhaseDispatches(event);
       
  1883   return event;
       
  1884 }
       
  1885 
       
  1886 /**
       
  1887  * @param {TopLevelType} topLevelType Number from `TopLevelType`.
       
  1888  * @param {object} nativeEvent Native browser event.
       
  1889  * @return {?string} The string corresponding to this `beforeInput` event.
       
  1890  */
       
  1891 function getNativeBeforeInputChars(topLevelType, nativeEvent) {
       
  1892   switch (topLevelType) {
       
  1893     case TOP_COMPOSITION_END:
       
  1894       return getDataFromCustomEvent(nativeEvent);
       
  1895     case TOP_KEY_PRESS:
       
  1896       /**
       
  1897        * If native `textInput` events are available, our goal is to make
       
  1898        * use of them. However, there is a special case: the spacebar key.
       
  1899        * In Webkit, preventing default on a spacebar `textInput` event
       
  1900        * cancels character insertion, but it *also* causes the browser
       
  1901        * to fall back to its default spacebar behavior of scrolling the
       
  1902        * page.
       
  1903        *
       
  1904        * Tracking at:
       
  1905        * https://code.google.com/p/chromium/issues/detail?id=355103
       
  1906        *
       
  1907        * To avoid this issue, use the keypress event as if no `textInput`
       
  1908        * event is available.
       
  1909        */
       
  1910       var which = nativeEvent.which;
       
  1911       if (which !== SPACEBAR_CODE) {
       
  1912         return null;
       
  1913       }
       
  1914 
       
  1915       hasSpaceKeypress = true;
       
  1916       return SPACEBAR_CHAR;
       
  1917 
       
  1918     case TOP_TEXT_INPUT:
       
  1919       // Record the characters to be added to the DOM.
       
  1920       var chars = nativeEvent.data;
       
  1921 
       
  1922       // If it's a spacebar character, assume that we have already handled
       
  1923       // it at the keypress level and bail immediately. Android Chrome
       
  1924       // doesn't give us keycodes, so we need to ignore it.
       
  1925       if (chars === SPACEBAR_CHAR && hasSpaceKeypress) {
       
  1926         return null;
       
  1927       }
       
  1928 
       
  1929       return chars;
       
  1930 
       
  1931     default:
       
  1932       // For other native event types, do nothing.
       
  1933       return null;
       
  1934   }
       
  1935 }
       
  1936 
       
  1937 /**
       
  1938  * For browsers that do not provide the `textInput` event, extract the
       
  1939  * appropriate string to use for SyntheticInputEvent.
       
  1940  *
       
  1941  * @param {number} topLevelType Number from `TopLevelEventTypes`.
       
  1942  * @param {object} nativeEvent Native browser event.
       
  1943  * @return {?string} The fallback string for this `beforeInput` event.
       
  1944  */
       
  1945 function getFallbackBeforeInputChars(topLevelType, nativeEvent) {
       
  1946   // If we are currently composing (IME) and using a fallback to do so,
       
  1947   // try to extract the composed characters from the fallback object.
       
  1948   // If composition event is available, we extract a string only at
       
  1949   // compositionevent, otherwise extract it at fallback events.
       
  1950   if (isComposing) {
       
  1951     if (topLevelType === TOP_COMPOSITION_END || !canUseCompositionEvent && isFallbackCompositionEnd(topLevelType, nativeEvent)) {
       
  1952       var chars = getData();
       
  1953       reset();
       
  1954       isComposing = false;
       
  1955       return chars;
       
  1956     }
       
  1957     return null;
       
  1958   }
       
  1959 
       
  1960   switch (topLevelType) {
       
  1961     case TOP_PASTE:
       
  1962       // If a paste event occurs after a keypress, throw out the input
       
  1963       // chars. Paste events should not lead to BeforeInput events.
       
  1964       return null;
       
  1965     case TOP_KEY_PRESS:
       
  1966       /**
       
  1967        * As of v27, Firefox may fire keypress events even when no character
       
  1968        * will be inserted. A few possibilities:
       
  1969        *
       
  1970        * - `which` is `0`. Arrow keys, Esc key, etc.
       
  1971        *
       
  1972        * - `which` is the pressed key code, but no char is available.
       
  1973        *   Ex: 'AltGr + d` in Polish. There is no modified character for
       
  1974        *   this key combination and no character is inserted into the
       
  1975        *   document, but FF fires the keypress for char code `100` anyway.
       
  1976        *   No `input` event will occur.
       
  1977        *
       
  1978        * - `which` is the pressed key code, but a command combination is
       
  1979        *   being used. Ex: `Cmd+C`. No character is inserted, and no
       
  1980        *   `input` event will occur.
       
  1981        */
       
  1982       if (!isKeypressCommand(nativeEvent)) {
       
  1983         // IE fires the `keypress` event when a user types an emoji via
       
  1984         // Touch keyboard of Windows.  In such a case, the `char` property
       
  1985         // holds an emoji character like `\uD83D\uDE0A`.  Because its length
       
  1986         // is 2, the property `which` does not represent an emoji correctly.
       
  1987         // In such a case, we directly return the `char` property instead of
       
  1988         // using `which`.
       
  1989         if (nativeEvent.char && nativeEvent.char.length > 1) {
       
  1990           return nativeEvent.char;
       
  1991         } else if (nativeEvent.which) {
       
  1992           return String.fromCharCode(nativeEvent.which);
       
  1993         }
       
  1994       }
       
  1995       return null;
       
  1996     case TOP_COMPOSITION_END:
       
  1997       return useFallbackCompositionData && !isUsingKoreanIME(nativeEvent) ? null : nativeEvent.data;
       
  1998     default:
       
  1999       return null;
       
  2000   }
       
  2001 }
       
  2002 
       
  2003 /**
       
  2004  * Extract a SyntheticInputEvent for `beforeInput`, based on either native
       
  2005  * `textInput` or fallback behavior.
       
  2006  *
       
  2007  * @return {?object} A SyntheticInputEvent.
       
  2008  */
       
  2009 function extractBeforeInputEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget) {
       
  2010   var chars = void 0;
       
  2011 
       
  2012   if (canUseTextInputEvent) {
       
  2013     chars = getNativeBeforeInputChars(topLevelType, nativeEvent);
       
  2014   } else {
       
  2015     chars = getFallbackBeforeInputChars(topLevelType, nativeEvent);
       
  2016   }
       
  2017 
       
  2018   // If no characters are being inserted, no BeforeInput event should
       
  2019   // be fired.
       
  2020   if (!chars) {
       
  2021     return null;
       
  2022   }
       
  2023 
       
  2024   var event = SyntheticInputEvent.getPooled(eventTypes.beforeInput, targetInst, nativeEvent, nativeEventTarget);
       
  2025 
       
  2026   event.data = chars;
       
  2027   accumulateTwoPhaseDispatches(event);
       
  2028   return event;
       
  2029 }
       
  2030 
       
  2031 /**
       
  2032  * Create an `onBeforeInput` event to match
       
  2033  * http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105/#events-inputevents.
       
  2034  *
       
  2035  * This event plugin is based on the native `textInput` event
       
  2036  * available in Chrome, Safari, Opera, and IE. This event fires after
       
  2037  * `onKeyPress` and `onCompositionEnd`, but before `onInput`.
       
  2038  *
       
  2039  * `beforeInput` is spec'd but not implemented in any browsers, and
       
  2040  * the `input` event does not provide any useful information about what has
       
  2041  * actually been added, contrary to the spec. Thus, `textInput` is the best
       
  2042  * available event to identify the characters that have actually been inserted
       
  2043  * into the target node.
       
  2044  *
       
  2045  * This plugin is also responsible for emitting `composition` events, thus
       
  2046  * allowing us to share composition fallback code for both `beforeInput` and
       
  2047  * `composition` event types.
       
  2048  */
       
  2049 var BeforeInputEventPlugin = {
       
  2050   eventTypes: eventTypes,
       
  2051 
       
  2052   extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
       
  2053     var composition = extractCompositionEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget);
       
  2054 
       
  2055     var beforeInput = extractBeforeInputEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget);
       
  2056 
       
  2057     if (composition === null) {
       
  2058       return beforeInput;
       
  2059     }
       
  2060 
       
  2061     if (beforeInput === null) {
       
  2062       return composition;
       
  2063     }
       
  2064 
       
  2065     return [composition, beforeInput];
       
  2066   }
       
  2067 };
       
  2068 
       
  2069 // Use to restore controlled state after a change event has fired.
       
  2070 
       
  2071 var restoreImpl = null;
       
  2072 var restoreTarget = null;
       
  2073 var restoreQueue = null;
       
  2074 
       
  2075 function restoreStateOfTarget(target) {
       
  2076   // We perform this translation at the end of the event loop so that we
       
  2077   // always receive the correct fiber here
       
  2078   var internalInstance = getInstanceFromNode(target);
       
  2079   if (!internalInstance) {
       
  2080     // Unmounted
       
  2081     return;
       
  2082   }
       
  2083   !(typeof restoreImpl === 'function') ? invariant(false, '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.') : void 0;
       
  2084   var props = getFiberCurrentPropsFromNode(internalInstance.stateNode);
       
  2085   restoreImpl(internalInstance.stateNode, internalInstance.type, props);
       
  2086 }
       
  2087 
       
  2088 function setRestoreImplementation(impl) {
       
  2089   restoreImpl = impl;
       
  2090 }
       
  2091 
       
  2092 function enqueueStateRestore(target) {
       
  2093   if (restoreTarget) {
       
  2094     if (restoreQueue) {
       
  2095       restoreQueue.push(target);
       
  2096     } else {
       
  2097       restoreQueue = [target];
       
  2098     }
       
  2099   } else {
       
  2100     restoreTarget = target;
       
  2101   }
       
  2102 }
       
  2103 
       
  2104 function needsStateRestore() {
       
  2105   return restoreTarget !== null || restoreQueue !== null;
       
  2106 }
       
  2107 
       
  2108 function restoreStateIfNeeded() {
       
  2109   if (!restoreTarget) {
       
  2110     return;
       
  2111   }
       
  2112   var target = restoreTarget;
       
  2113   var queuedTargets = restoreQueue;
       
  2114   restoreTarget = null;
       
  2115   restoreQueue = null;
       
  2116 
       
  2117   restoreStateOfTarget(target);
       
  2118   if (queuedTargets) {
       
  2119     for (var i = 0; i < queuedTargets.length; i++) {
       
  2120       restoreStateOfTarget(queuedTargets[i]);
       
  2121     }
       
  2122   }
       
  2123 }
       
  2124 
       
  2125 // Used as a way to call batchedUpdates when we don't have a reference to
       
  2126 // the renderer. Such as when we're dispatching events or if third party
       
  2127 // libraries need to call batchedUpdates. Eventually, this API will go away when
       
  2128 // everything is batched by default. We'll then have a similar API to opt-out of
       
  2129 // scheduled work and instead do synchronous work.
       
  2130 
       
  2131 // Defaults
       
  2132 var _batchedUpdatesImpl = function (fn, bookkeeping) {
       
  2133   return fn(bookkeeping);
       
  2134 };
       
  2135 var _interactiveUpdatesImpl = function (fn, a, b) {
       
  2136   return fn(a, b);
       
  2137 };
       
  2138 var _flushInteractiveUpdatesImpl = function () {};
       
  2139 
       
  2140 var isBatching = false;
       
  2141 function batchedUpdates(fn, bookkeeping) {
       
  2142   if (isBatching) {
       
  2143     // If we are currently inside another batch, we need to wait until it
       
  2144     // fully completes before restoring state.
       
  2145     return fn(bookkeeping);
       
  2146   }
       
  2147   isBatching = true;
       
  2148   try {
       
  2149     return _batchedUpdatesImpl(fn, bookkeeping);
       
  2150   } finally {
       
  2151     // Here we wait until all updates have propagated, which is important
       
  2152     // when using controlled components within layers:
       
  2153     // https://github.com/facebook/react/issues/1698
       
  2154     // Then we restore state of any controlled component.
       
  2155     isBatching = false;
       
  2156     var controlledComponentsHavePendingUpdates = needsStateRestore();
       
  2157     if (controlledComponentsHavePendingUpdates) {
       
  2158       // If a controlled event was fired, we may need to restore the state of
       
  2159       // the DOM node back to the controlled value. This is necessary when React
       
  2160       // bails out of the update without touching the DOM.
       
  2161       _flushInteractiveUpdatesImpl();
       
  2162       restoreStateIfNeeded();
       
  2163     }
       
  2164   }
       
  2165 }
       
  2166 
       
  2167 function interactiveUpdates(fn, a, b) {
       
  2168   return _interactiveUpdatesImpl(fn, a, b);
       
  2169 }
       
  2170 
       
  2171 
       
  2172 
       
  2173 function setBatchingImplementation(batchedUpdatesImpl, interactiveUpdatesImpl, flushInteractiveUpdatesImpl) {
       
  2174   _batchedUpdatesImpl = batchedUpdatesImpl;
       
  2175   _interactiveUpdatesImpl = interactiveUpdatesImpl;
       
  2176   _flushInteractiveUpdatesImpl = flushInteractiveUpdatesImpl;
       
  2177 }
       
  2178 
       
  2179 /**
       
  2180  * @see http://www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary
       
  2181  */
       
  2182 var supportedInputTypes = {
       
  2183   color: true,
       
  2184   date: true,
       
  2185   datetime: true,
       
  2186   'datetime-local': true,
       
  2187   email: true,
       
  2188   month: true,
       
  2189   number: true,
       
  2190   password: true,
       
  2191   range: true,
       
  2192   search: true,
       
  2193   tel: true,
       
  2194   text: true,
       
  2195   time: true,
       
  2196   url: true,
       
  2197   week: true
       
  2198 };
       
  2199 
       
  2200 function isTextInputElement(elem) {
       
  2201   var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase();
       
  2202 
       
  2203   if (nodeName === 'input') {
       
  2204     return !!supportedInputTypes[elem.type];
       
  2205   }
       
  2206 
       
  2207   if (nodeName === 'textarea') {
       
  2208     return true;
       
  2209   }
       
  2210 
       
  2211   return false;
       
  2212 }
       
  2213 
       
  2214 /**
       
  2215  * HTML nodeType values that represent the type of the node
       
  2216  */
       
  2217 
       
  2218 var ELEMENT_NODE = 1;
       
  2219 var TEXT_NODE = 3;
       
  2220 var COMMENT_NODE = 8;
       
  2221 var DOCUMENT_NODE = 9;
       
  2222 var DOCUMENT_FRAGMENT_NODE = 11;
       
  2223 
       
  2224 /**
       
  2225  * Gets the target node from a native browser event by accounting for
       
  2226  * inconsistencies in browser DOM APIs.
       
  2227  *
       
  2228  * @param {object} nativeEvent Native browser event.
       
  2229  * @return {DOMEventTarget} Target node.
       
  2230  */
       
  2231 function getEventTarget(nativeEvent) {
       
  2232   // Fallback to nativeEvent.srcElement for IE9
       
  2233   // https://github.com/facebook/react/issues/12506
       
  2234   var target = nativeEvent.target || nativeEvent.srcElement || window;
       
  2235 
       
  2236   // Normalize SVG <use> element events #4963
       
  2237   if (target.correspondingUseElement) {
       
  2238     target = target.correspondingUseElement;
       
  2239   }
       
  2240 
       
  2241   // Safari may fire events on text nodes (Node.TEXT_NODE is 3).
       
  2242   // @see http://www.quirksmode.org/js/events_properties.html
       
  2243   return target.nodeType === TEXT_NODE ? target.parentNode : target;
       
  2244 }
       
  2245 
       
  2246 /**
       
  2247  * Checks if an event is supported in the current execution environment.
       
  2248  *
       
  2249  * NOTE: This will not work correctly for non-generic events such as `change`,
       
  2250  * `reset`, `load`, `error`, and `select`.
       
  2251  *
       
  2252  * Borrows from Modernizr.
       
  2253  *
       
  2254  * @param {string} eventNameSuffix Event name, e.g. "click".
       
  2255  * @return {boolean} True if the event is supported.
       
  2256  * @internal
       
  2257  * @license Modernizr 3.0.0pre (Custom Build) | MIT
       
  2258  */
       
  2259 function isEventSupported(eventNameSuffix) {
       
  2260   if (!canUseDOM) {
       
  2261     return false;
       
  2262   }
       
  2263 
       
  2264   var eventName = 'on' + eventNameSuffix;
       
  2265   var isSupported = eventName in document;
       
  2266 
       
  2267   if (!isSupported) {
       
  2268     var element = document.createElement('div');
       
  2269     element.setAttribute(eventName, 'return;');
       
  2270     isSupported = typeof element[eventName] === 'function';
       
  2271   }
       
  2272 
       
  2273   return isSupported;
       
  2274 }
       
  2275 
       
  2276 function isCheckable(elem) {
       
  2277   var type = elem.type;
       
  2278   var nodeName = elem.nodeName;
       
  2279   return nodeName && nodeName.toLowerCase() === 'input' && (type === 'checkbox' || type === 'radio');
       
  2280 }
       
  2281 
       
  2282 function getTracker(node) {
       
  2283   return node._valueTracker;
       
  2284 }
       
  2285 
       
  2286 function detachTracker(node) {
       
  2287   node._valueTracker = null;
       
  2288 }
       
  2289 
       
  2290 function getValueFromNode(node) {
       
  2291   var value = '';
       
  2292   if (!node) {
       
  2293     return value;
       
  2294   }
       
  2295 
       
  2296   if (isCheckable(node)) {
       
  2297     value = node.checked ? 'true' : 'false';
       
  2298   } else {
       
  2299     value = node.value;
       
  2300   }
       
  2301 
       
  2302   return value;
       
  2303 }
       
  2304 
       
  2305 function trackValueOnNode(node) {
       
  2306   var valueField = isCheckable(node) ? 'checked' : 'value';
       
  2307   var descriptor = Object.getOwnPropertyDescriptor(node.constructor.prototype, valueField);
       
  2308 
       
  2309   var currentValue = '' + node[valueField];
       
  2310 
       
  2311   // if someone has already defined a value or Safari, then bail
       
  2312   // and don't track value will cause over reporting of changes,
       
  2313   // but it's better then a hard failure
       
  2314   // (needed for certain tests that spyOn input values and Safari)
       
  2315   if (node.hasOwnProperty(valueField) || typeof descriptor === 'undefined' || typeof descriptor.get !== 'function' || typeof descriptor.set !== 'function') {
       
  2316     return;
       
  2317   }
       
  2318   var get = descriptor.get,
       
  2319       set = descriptor.set;
       
  2320 
       
  2321   Object.defineProperty(node, valueField, {
       
  2322     configurable: true,
       
  2323     get: function () {
       
  2324       return get.call(this);
       
  2325     },
       
  2326     set: function (value) {
       
  2327       currentValue = '' + value;
       
  2328       set.call(this, value);
       
  2329     }
       
  2330   });
       
  2331   // We could've passed this the first time
       
  2332   // but it triggers a bug in IE11 and Edge 14/15.
       
  2333   // Calling defineProperty() again should be equivalent.
       
  2334   // https://github.com/facebook/react/issues/11768
       
  2335   Object.defineProperty(node, valueField, {
       
  2336     enumerable: descriptor.enumerable
       
  2337   });
       
  2338 
       
  2339   var tracker = {
       
  2340     getValue: function () {
       
  2341       return currentValue;
       
  2342     },
       
  2343     setValue: function (value) {
       
  2344       currentValue = '' + value;
       
  2345     },
       
  2346     stopTracking: function () {
       
  2347       detachTracker(node);
       
  2348       delete node[valueField];
       
  2349     }
       
  2350   };
       
  2351   return tracker;
       
  2352 }
       
  2353 
       
  2354 function track(node) {
       
  2355   if (getTracker(node)) {
       
  2356     return;
       
  2357   }
       
  2358 
       
  2359   // TODO: Once it's just Fiber we can move this to node._wrapperState
       
  2360   node._valueTracker = trackValueOnNode(node);
       
  2361 }
       
  2362 
       
  2363 function updateValueIfChanged(node) {
       
  2364   if (!node) {
       
  2365     return false;
       
  2366   }
       
  2367 
       
  2368   var tracker = getTracker(node);
       
  2369   // if there is no tracker at this point it's unlikely
       
  2370   // that trying again will succeed
       
  2371   if (!tracker) {
       
  2372     return true;
       
  2373   }
       
  2374 
       
  2375   var lastValue = tracker.getValue();
       
  2376   var nextValue = getValueFromNode(node);
       
  2377   if (nextValue !== lastValue) {
       
  2378     tracker.setValue(nextValue);
       
  2379     return true;
       
  2380   }
       
  2381   return false;
       
  2382 }
       
  2383 
       
  2384 var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
       
  2385 
       
  2386 // Prevent newer renderers from RTE when used with older react package versions.
       
  2387 // Current owner and dispatcher used to share the same ref,
       
  2388 // but PR #14548 split them out to better support the react-debug-tools package.
       
  2389 if (!ReactSharedInternals.hasOwnProperty('ReactCurrentDispatcher')) {
       
  2390   ReactSharedInternals.ReactCurrentDispatcher = {
       
  2391     current: null
       
  2392   };
       
  2393 }
       
  2394 
       
  2395 var BEFORE_SLASH_RE = /^(.*)[\\\/]/;
       
  2396 
       
  2397 var describeComponentFrame = function (name, source, ownerName) {
       
  2398   var sourceInfo = '';
       
  2399   if (source) {
       
  2400     var path = source.fileName;
       
  2401     var fileName = path.replace(BEFORE_SLASH_RE, '');
       
  2402     {
       
  2403       // In DEV, include code for a common special case:
       
  2404       // prefer "folder/index.js" instead of just "index.js".
       
  2405       if (/^index\./.test(fileName)) {
       
  2406         var match = path.match(BEFORE_SLASH_RE);
       
  2407         if (match) {
       
  2408           var pathBeforeSlash = match[1];
       
  2409           if (pathBeforeSlash) {
       
  2410             var folderName = pathBeforeSlash.replace(BEFORE_SLASH_RE, '');
       
  2411             fileName = folderName + '/' + fileName;
       
  2412           }
       
  2413         }
       
  2414       }
       
  2415     }
       
  2416     sourceInfo = ' (at ' + fileName + ':' + source.lineNumber + ')';
       
  2417   } else if (ownerName) {
       
  2418     sourceInfo = ' (created by ' + ownerName + ')';
       
  2419   }
       
  2420   return '\n    in ' + (name || 'Unknown') + sourceInfo;
       
  2421 };
       
  2422 
       
  2423 // The Symbol used to tag the ReactElement-like types. If there is no native Symbol
       
  2424 // nor polyfill, then a plain number is used for performance.
       
  2425 var hasSymbol = typeof Symbol === 'function' && Symbol.for;
       
  2426 
       
  2427 var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
       
  2428 var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
       
  2429 var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
       
  2430 var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
       
  2431 var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
       
  2432 var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
       
  2433 var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace;
       
  2434 
       
  2435 var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
       
  2436 var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
       
  2437 var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
       
  2438 var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
       
  2439 var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
       
  2440 
       
  2441 var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
       
  2442 var FAUX_ITERATOR_SYMBOL = '@@iterator';
       
  2443 
       
  2444 function getIteratorFn(maybeIterable) {
       
  2445   if (maybeIterable === null || typeof maybeIterable !== 'object') {
       
  2446     return null;
       
  2447   }
       
  2448   var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
       
  2449   if (typeof maybeIterator === 'function') {
       
  2450     return maybeIterator;
       
  2451   }
       
  2452   return null;
       
  2453 }
       
  2454 
       
  2455 var Pending = 0;
       
  2456 var Resolved = 1;
       
  2457 var Rejected = 2;
       
  2458 
       
  2459 function refineResolvedLazyComponent(lazyComponent) {
       
  2460   return lazyComponent._status === Resolved ? lazyComponent._result : null;
       
  2461 }
       
  2462 
       
  2463 function getWrappedName(outerType, innerType, wrapperName) {
       
  2464   var functionName = innerType.displayName || innerType.name || '';
       
  2465   return outerType.displayName || (functionName !== '' ? wrapperName + '(' + functionName + ')' : wrapperName);
       
  2466 }
       
  2467 
       
  2468 function getComponentName(type) {
       
  2469   if (type == null) {
       
  2470     // Host root, text node or just invalid type.
       
  2471     return null;
       
  2472   }
       
  2473   {
       
  2474     if (typeof type.tag === 'number') {
       
  2475       warningWithoutStack$1(false, 'Received an unexpected object in getComponentName(). ' + 'This is likely a bug in React. Please file an issue.');
       
  2476     }
       
  2477   }
       
  2478   if (typeof type === 'function') {
       
  2479     return type.displayName || type.name || null;
       
  2480   }
       
  2481   if (typeof type === 'string') {
       
  2482     return type;
       
  2483   }
       
  2484   switch (type) {
       
  2485     case REACT_CONCURRENT_MODE_TYPE:
       
  2486       return 'ConcurrentMode';
       
  2487     case REACT_FRAGMENT_TYPE:
       
  2488       return 'Fragment';
       
  2489     case REACT_PORTAL_TYPE:
       
  2490       return 'Portal';
       
  2491     case REACT_PROFILER_TYPE:
       
  2492       return 'Profiler';
       
  2493     case REACT_STRICT_MODE_TYPE:
       
  2494       return 'StrictMode';
       
  2495     case REACT_SUSPENSE_TYPE:
       
  2496       return 'Suspense';
       
  2497   }
       
  2498   if (typeof type === 'object') {
       
  2499     switch (type.$$typeof) {
       
  2500       case REACT_CONTEXT_TYPE:
       
  2501         return 'Context.Consumer';
       
  2502       case REACT_PROVIDER_TYPE:
       
  2503         return 'Context.Provider';
       
  2504       case REACT_FORWARD_REF_TYPE:
       
  2505         return getWrappedName(type, type.render, 'ForwardRef');
       
  2506       case REACT_MEMO_TYPE:
       
  2507         return getComponentName(type.type);
       
  2508       case REACT_LAZY_TYPE:
       
  2509         {
       
  2510           var thenable = type;
       
  2511           var resolvedThenable = refineResolvedLazyComponent(thenable);
       
  2512           if (resolvedThenable) {
       
  2513             return getComponentName(resolvedThenable);
       
  2514           }
       
  2515         }
       
  2516     }
       
  2517   }
       
  2518   return null;
       
  2519 }
       
  2520 
       
  2521 var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
       
  2522 
       
  2523 function describeFiber(fiber) {
       
  2524   switch (fiber.tag) {
       
  2525     case HostRoot:
       
  2526     case HostPortal:
       
  2527     case HostText:
       
  2528     case Fragment:
       
  2529     case ContextProvider:
       
  2530     case ContextConsumer:
       
  2531       return '';
       
  2532     default:
       
  2533       var owner = fiber._debugOwner;
       
  2534       var source = fiber._debugSource;
       
  2535       var name = getComponentName(fiber.type);
       
  2536       var ownerName = null;
       
  2537       if (owner) {
       
  2538         ownerName = getComponentName(owner.type);
       
  2539       }
       
  2540       return describeComponentFrame(name, source, ownerName);
       
  2541   }
       
  2542 }
       
  2543 
       
  2544 function getStackByFiberInDevAndProd(workInProgress) {
       
  2545   var info = '';
       
  2546   var node = workInProgress;
       
  2547   do {
       
  2548     info += describeFiber(node);
       
  2549     node = node.return;
       
  2550   } while (node);
       
  2551   return info;
       
  2552 }
       
  2553 
       
  2554 var current = null;
       
  2555 var phase = null;
       
  2556 
       
  2557 function getCurrentFiberOwnerNameInDevOrNull() {
       
  2558   {
       
  2559     if (current === null) {
       
  2560       return null;
       
  2561     }
       
  2562     var owner = current._debugOwner;
       
  2563     if (owner !== null && typeof owner !== 'undefined') {
       
  2564       return getComponentName(owner.type);
       
  2565     }
       
  2566   }
       
  2567   return null;
       
  2568 }
       
  2569 
       
  2570 function getCurrentFiberStackInDev() {
       
  2571   {
       
  2572     if (current === null) {
       
  2573       return '';
       
  2574     }
       
  2575     // Safe because if current fiber exists, we are reconciling,
       
  2576     // and it is guaranteed to be the work-in-progress version.
       
  2577     return getStackByFiberInDevAndProd(current);
       
  2578   }
       
  2579   return '';
       
  2580 }
       
  2581 
       
  2582 function resetCurrentFiber() {
       
  2583   {
       
  2584     ReactDebugCurrentFrame.getCurrentStack = null;
       
  2585     current = null;
       
  2586     phase = null;
       
  2587   }
       
  2588 }
       
  2589 
       
  2590 function setCurrentFiber(fiber) {
       
  2591   {
       
  2592     ReactDebugCurrentFrame.getCurrentStack = getCurrentFiberStackInDev;
       
  2593     current = fiber;
       
  2594     phase = null;
       
  2595   }
       
  2596 }
       
  2597 
       
  2598 function setCurrentPhase(lifeCyclePhase) {
       
  2599   {
       
  2600     phase = lifeCyclePhase;
       
  2601   }
       
  2602 }
       
  2603 
       
  2604 /**
       
  2605  * Similar to invariant but only logs a warning if the condition is not met.
       
  2606  * This can be used to log issues in development environments in critical
       
  2607  * paths. Removing the logging code for production environments will keep the
       
  2608  * same logic and follow the same code paths.
       
  2609  */
       
  2610 
       
  2611 var warning = warningWithoutStack$1;
       
  2612 
       
  2613 {
       
  2614   warning = function (condition, format) {
       
  2615     if (condition) {
       
  2616       return;
       
  2617     }
       
  2618     var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
       
  2619     var stack = ReactDebugCurrentFrame.getStackAddendum();
       
  2620     // eslint-disable-next-line react-internal/warning-and-invariant-args
       
  2621 
       
  2622     for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
       
  2623       args[_key - 2] = arguments[_key];
       
  2624     }
       
  2625 
       
  2626     warningWithoutStack$1.apply(undefined, [false, format + '%s'].concat(args, [stack]));
       
  2627   };
       
  2628 }
       
  2629 
       
  2630 var warning$1 = warning;
       
  2631 
       
  2632 // A reserved attribute.
       
  2633 // It is handled by React separately and shouldn't be written to the DOM.
       
  2634 var RESERVED = 0;
       
  2635 
       
  2636 // A simple string attribute.
       
  2637 // Attributes that aren't in the whitelist are presumed to have this type.
       
  2638 var STRING = 1;
       
  2639 
       
  2640 // A string attribute that accepts booleans in React. In HTML, these are called
       
  2641 // "enumerated" attributes with "true" and "false" as possible values.
       
  2642 // When true, it should be set to a "true" string.
       
  2643 // When false, it should be set to a "false" string.
       
  2644 var BOOLEANISH_STRING = 2;
       
  2645 
       
  2646 // A real boolean attribute.
       
  2647 // When true, it should be present (set either to an empty string or its name).
       
  2648 // When false, it should be omitted.
       
  2649 var BOOLEAN = 3;
       
  2650 
       
  2651 // An attribute that can be used as a flag as well as with a value.
       
  2652 // When true, it should be present (set either to an empty string or its name).
       
  2653 // When false, it should be omitted.
       
  2654 // For any other value, should be present with that value.
       
  2655 var OVERLOADED_BOOLEAN = 4;
       
  2656 
       
  2657 // An attribute that must be numeric or parse as a numeric.
       
  2658 // When falsy, it should be removed.
       
  2659 var NUMERIC = 5;
       
  2660 
       
  2661 // An attribute that must be positive numeric or parse as a positive numeric.
       
  2662 // When falsy, it should be removed.
       
  2663 var POSITIVE_NUMERIC = 6;
       
  2664 
       
  2665 /* eslint-disable max-len */
       
  2666 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';
       
  2667 /* eslint-enable max-len */
       
  2668 var ATTRIBUTE_NAME_CHAR = ATTRIBUTE_NAME_START_CHAR + '\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040';
       
  2669 
       
  2670 
       
  2671 var ROOT_ATTRIBUTE_NAME = 'data-reactroot';
       
  2672 var VALID_ATTRIBUTE_NAME_REGEX = new RegExp('^[' + ATTRIBUTE_NAME_START_CHAR + '][' + ATTRIBUTE_NAME_CHAR + ']*$');
       
  2673 
       
  2674 var hasOwnProperty = Object.prototype.hasOwnProperty;
       
  2675 var illegalAttributeNameCache = {};
       
  2676 var validatedAttributeNameCache = {};
       
  2677 
       
  2678 function isAttributeNameSafe(attributeName) {
       
  2679   if (hasOwnProperty.call(validatedAttributeNameCache, attributeName)) {
       
  2680     return true;
       
  2681   }
       
  2682   if (hasOwnProperty.call(illegalAttributeNameCache, attributeName)) {
       
  2683     return false;
       
  2684   }
       
  2685   if (VALID_ATTRIBUTE_NAME_REGEX.test(attributeName)) {
       
  2686     validatedAttributeNameCache[attributeName] = true;
       
  2687     return true;
       
  2688   }
       
  2689   illegalAttributeNameCache[attributeName] = true;
       
  2690   {
       
  2691     warning$1(false, 'Invalid attribute name: `%s`', attributeName);
       
  2692   }
       
  2693   return false;
       
  2694 }
       
  2695 
       
  2696 function shouldIgnoreAttribute(name, propertyInfo, isCustomComponentTag) {
       
  2697   if (propertyInfo !== null) {
       
  2698     return propertyInfo.type === RESERVED;
       
  2699   }
       
  2700   if (isCustomComponentTag) {
       
  2701     return false;
       
  2702   }
       
  2703   if (name.length > 2 && (name[0] === 'o' || name[0] === 'O') && (name[1] === 'n' || name[1] === 'N')) {
       
  2704     return true;
       
  2705   }
       
  2706   return false;
       
  2707 }
       
  2708 
       
  2709 function shouldRemoveAttributeWithWarning(name, value, propertyInfo, isCustomComponentTag) {
       
  2710   if (propertyInfo !== null && propertyInfo.type === RESERVED) {
       
  2711     return false;
       
  2712   }
       
  2713   switch (typeof value) {
       
  2714     case 'function':
       
  2715     // $FlowIssue symbol is perfectly valid here
       
  2716     case 'symbol':
       
  2717       // eslint-disable-line
       
  2718       return true;
       
  2719     case 'boolean':
       
  2720       {
       
  2721         if (isCustomComponentTag) {
       
  2722           return false;
       
  2723         }
       
  2724         if (propertyInfo !== null) {
       
  2725           return !propertyInfo.acceptsBooleans;
       
  2726         } else {
       
  2727           var prefix = name.toLowerCase().slice(0, 5);
       
  2728           return prefix !== 'data-' && prefix !== 'aria-';
       
  2729         }
       
  2730       }
       
  2731     default:
       
  2732       return false;
       
  2733   }
       
  2734 }
       
  2735 
       
  2736 function shouldRemoveAttribute(name, value, propertyInfo, isCustomComponentTag) {
       
  2737   if (value === null || typeof value === 'undefined') {
       
  2738     return true;
       
  2739   }
       
  2740   if (shouldRemoveAttributeWithWarning(name, value, propertyInfo, isCustomComponentTag)) {
       
  2741     return true;
       
  2742   }
       
  2743   if (isCustomComponentTag) {
       
  2744     return false;
       
  2745   }
       
  2746   if (propertyInfo !== null) {
       
  2747     switch (propertyInfo.type) {
       
  2748       case BOOLEAN:
       
  2749         return !value;
       
  2750       case OVERLOADED_BOOLEAN:
       
  2751         return value === false;
       
  2752       case NUMERIC:
       
  2753         return isNaN(value);
       
  2754       case POSITIVE_NUMERIC:
       
  2755         return isNaN(value) || value < 1;
       
  2756     }
       
  2757   }
       
  2758   return false;
       
  2759 }
       
  2760 
       
  2761 function getPropertyInfo(name) {
       
  2762   return properties.hasOwnProperty(name) ? properties[name] : null;
       
  2763 }
       
  2764 
       
  2765 function PropertyInfoRecord(name, type, mustUseProperty, attributeName, attributeNamespace) {
       
  2766   this.acceptsBooleans = type === BOOLEANISH_STRING || type === BOOLEAN || type === OVERLOADED_BOOLEAN;
       
  2767   this.attributeName = attributeName;
       
  2768   this.attributeNamespace = attributeNamespace;
       
  2769   this.mustUseProperty = mustUseProperty;
       
  2770   this.propertyName = name;
       
  2771   this.type = type;
       
  2772 }
       
  2773 
       
  2774 // When adding attributes to this list, be sure to also add them to
       
  2775 // the `possibleStandardNames` module to ensure casing and incorrect
       
  2776 // name warnings.
       
  2777 var properties = {};
       
  2778 
       
  2779 // These props are reserved by React. They shouldn't be written to the DOM.
       
  2780 ['children', 'dangerouslySetInnerHTML',
       
  2781 // TODO: This prevents the assignment of defaultValue to regular
       
  2782 // elements (not just inputs). Now that ReactDOMInput assigns to the
       
  2783 // defaultValue property -- do we need this?
       
  2784 'defaultValue', 'defaultChecked', 'innerHTML', 'suppressContentEditableWarning', 'suppressHydrationWarning', 'style'].forEach(function (name) {
       
  2785   properties[name] = new PropertyInfoRecord(name, RESERVED, false, // mustUseProperty
       
  2786   name, // attributeName
       
  2787   null);
       
  2788 } // attributeNamespace
       
  2789 );
       
  2790 
       
  2791 // A few React string attributes have a different name.
       
  2792 // This is a mapping from React prop names to the attribute names.
       
  2793 [['acceptCharset', 'accept-charset'], ['className', 'class'], ['htmlFor', 'for'], ['httpEquiv', 'http-equiv']].forEach(function (_ref) {
       
  2794   var name = _ref[0],
       
  2795       attributeName = _ref[1];
       
  2796 
       
  2797   properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
       
  2798   attributeName, // attributeName
       
  2799   null);
       
  2800 } // attributeNamespace
       
  2801 );
       
  2802 
       
  2803 // These are "enumerated" HTML attributes that accept "true" and "false".
       
  2804 // In React, we let users pass `true` and `false` even though technically
       
  2805 // these aren't boolean attributes (they are coerced to strings).
       
  2806 ['contentEditable', 'draggable', 'spellCheck', 'value'].forEach(function (name) {
       
  2807   properties[name] = new PropertyInfoRecord(name, BOOLEANISH_STRING, false, // mustUseProperty
       
  2808   name.toLowerCase(), // attributeName
       
  2809   null);
       
  2810 } // attributeNamespace
       
  2811 );
       
  2812 
       
  2813 // These are "enumerated" SVG attributes that accept "true" and "false".
       
  2814 // In React, we let users pass `true` and `false` even though technically
       
  2815 // these aren't boolean attributes (they are coerced to strings).
       
  2816 // Since these are SVG attributes, their attribute names are case-sensitive.
       
  2817 ['autoReverse', 'externalResourcesRequired', 'focusable', 'preserveAlpha'].forEach(function (name) {
       
  2818   properties[name] = new PropertyInfoRecord(name, BOOLEANISH_STRING, false, // mustUseProperty
       
  2819   name, // attributeName
       
  2820   null);
       
  2821 } // attributeNamespace
       
  2822 );
       
  2823 
       
  2824 // These are HTML boolean attributes.
       
  2825 ['allowFullScreen', 'async',
       
  2826 // Note: there is a special case that prevents it from being written to the DOM
       
  2827 // on the client side because the browsers are inconsistent. Instead we call focus().
       
  2828 'autoFocus', 'autoPlay', 'controls', 'default', 'defer', 'disabled', 'formNoValidate', 'hidden', 'loop', 'noModule', 'noValidate', 'open', 'playsInline', 'readOnly', 'required', 'reversed', 'scoped', 'seamless',
       
  2829 // Microdata
       
  2830 'itemScope'].forEach(function (name) {
       
  2831   properties[name] = new PropertyInfoRecord(name, BOOLEAN, false, // mustUseProperty
       
  2832   name.toLowerCase(), // attributeName
       
  2833   null);
       
  2834 } // attributeNamespace
       
  2835 );
       
  2836 
       
  2837 // These are the few React props that we set as DOM properties
       
  2838 // rather than attributes. These are all booleans.
       
  2839 ['checked',
       
  2840 // Note: `option.selected` is not updated if `select.multiple` is
       
  2841 // disabled with `removeAttribute`. We have special logic for handling this.
       
  2842 'multiple', 'muted', 'selected'].forEach(function (name) {
       
  2843   properties[name] = new PropertyInfoRecord(name, BOOLEAN, true, // mustUseProperty
       
  2844   name, // attributeName
       
  2845   null);
       
  2846 } // attributeNamespace
       
  2847 );
       
  2848 
       
  2849 // These are HTML attributes that are "overloaded booleans": they behave like
       
  2850 // booleans, but can also accept a string value.
       
  2851 ['capture', 'download'].forEach(function (name) {
       
  2852   properties[name] = new PropertyInfoRecord(name, OVERLOADED_BOOLEAN, false, // mustUseProperty
       
  2853   name, // attributeName
       
  2854   null);
       
  2855 } // attributeNamespace
       
  2856 );
       
  2857 
       
  2858 // These are HTML attributes that must be positive numbers.
       
  2859 ['cols', 'rows', 'size', 'span'].forEach(function (name) {
       
  2860   properties[name] = new PropertyInfoRecord(name, POSITIVE_NUMERIC, false, // mustUseProperty
       
  2861   name, // attributeName
       
  2862   null);
       
  2863 } // attributeNamespace
       
  2864 );
       
  2865 
       
  2866 // These are HTML attributes that must be numbers.
       
  2867 ['rowSpan', 'start'].forEach(function (name) {
       
  2868   properties[name] = new PropertyInfoRecord(name, NUMERIC, false, // mustUseProperty
       
  2869   name.toLowerCase(), // attributeName
       
  2870   null);
       
  2871 } // attributeNamespace
       
  2872 );
       
  2873 
       
  2874 var CAMELIZE = /[\-\:]([a-z])/g;
       
  2875 var capitalize = function (token) {
       
  2876   return token[1].toUpperCase();
       
  2877 };
       
  2878 
       
  2879 // This is a list of all SVG attributes that need special casing, namespacing,
       
  2880 // or boolean value assignment. Regular attributes that just accept strings
       
  2881 // and have the same names are omitted, just like in the HTML whitelist.
       
  2882 // Some of these attributes can be hard to find. This list was created by
       
  2883 // scrapping the MDN documentation.
       
  2884 ['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) {
       
  2885   var name = attributeName.replace(CAMELIZE, capitalize);
       
  2886   properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
       
  2887   attributeName, null);
       
  2888 } // attributeNamespace
       
  2889 );
       
  2890 
       
  2891 // String SVG attributes with the xlink namespace.
       
  2892 ['xlink:actuate', 'xlink:arcrole', 'xlink:href', 'xlink:role', 'xlink:show', 'xlink:title', 'xlink:type'].forEach(function (attributeName) {
       
  2893   var name = attributeName.replace(CAMELIZE, capitalize);
       
  2894   properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
       
  2895   attributeName, 'http://www.w3.org/1999/xlink');
       
  2896 });
       
  2897 
       
  2898 // String SVG attributes with the xml namespace.
       
  2899 ['xml:base', 'xml:lang', 'xml:space'].forEach(function (attributeName) {
       
  2900   var name = attributeName.replace(CAMELIZE, capitalize);
       
  2901   properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
       
  2902   attributeName, 'http://www.w3.org/XML/1998/namespace');
       
  2903 });
       
  2904 
       
  2905 // These attribute exists both in HTML and SVG.
       
  2906 // The attribute name is case-sensitive in SVG so we can't just use
       
  2907 // the React name like we do for attributes that exist only in HTML.
       
  2908 ['tabIndex', 'crossOrigin'].forEach(function (attributeName) {
       
  2909   properties[attributeName] = new PropertyInfoRecord(attributeName, STRING, false, // mustUseProperty
       
  2910   attributeName.toLowerCase(), // attributeName
       
  2911   null);
       
  2912 } // attributeNamespace
       
  2913 );
       
  2914 
       
  2915 /**
       
  2916  * Get the value for a property on a node. Only used in DEV for SSR validation.
       
  2917  * The "expected" argument is used as a hint of what the expected value is.
       
  2918  * Some properties have multiple equivalent values.
       
  2919  */
       
  2920 function getValueForProperty(node, name, expected, propertyInfo) {
       
  2921   {
       
  2922     if (propertyInfo.mustUseProperty) {
       
  2923       var propertyName = propertyInfo.propertyName;
       
  2924 
       
  2925       return node[propertyName];
       
  2926     } else {
       
  2927       var attributeName = propertyInfo.attributeName;
       
  2928 
       
  2929       var stringValue = null;
       
  2930 
       
  2931       if (propertyInfo.type === OVERLOADED_BOOLEAN) {
       
  2932         if (node.hasAttribute(attributeName)) {
       
  2933           var value = node.getAttribute(attributeName);
       
  2934           if (value === '') {
       
  2935             return true;
       
  2936           }
       
  2937           if (shouldRemoveAttribute(name, expected, propertyInfo, false)) {
       
  2938             return value;
       
  2939           }
       
  2940           if (value === '' + expected) {
       
  2941             return expected;
       
  2942           }
       
  2943           return value;
       
  2944         }
       
  2945       } else if (node.hasAttribute(attributeName)) {
       
  2946         if (shouldRemoveAttribute(name, expected, propertyInfo, false)) {
       
  2947           // We had an attribute but shouldn't have had one, so read it
       
  2948           // for the error message.
       
  2949           return node.getAttribute(attributeName);
       
  2950         }
       
  2951         if (propertyInfo.type === BOOLEAN) {
       
  2952           // If this was a boolean, it doesn't matter what the value is
       
  2953           // the fact that we have it is the same as the expected.
       
  2954           return expected;
       
  2955         }
       
  2956         // Even if this property uses a namespace we use getAttribute
       
  2957         // because we assume its namespaced name is the same as our config.
       
  2958         // To use getAttributeNS we need the local name which we don't have
       
  2959         // in our config atm.
       
  2960         stringValue = node.getAttribute(attributeName);
       
  2961       }
       
  2962 
       
  2963       if (shouldRemoveAttribute(name, expected, propertyInfo, false)) {
       
  2964         return stringValue === null ? expected : stringValue;
       
  2965       } else if (stringValue === '' + expected) {
       
  2966         return expected;
       
  2967       } else {
       
  2968         return stringValue;
       
  2969       }
       
  2970     }
       
  2971   }
       
  2972 }
       
  2973 
       
  2974 /**
       
  2975  * Get the value for a attribute on a node. Only used in DEV for SSR validation.
       
  2976  * The third argument is used as a hint of what the expected value is. Some
       
  2977  * attributes have multiple equivalent values.
       
  2978  */
       
  2979 function getValueForAttribute(node, name, expected) {
       
  2980   {
       
  2981     if (!isAttributeNameSafe(name)) {
       
  2982       return;
       
  2983     }
       
  2984     if (!node.hasAttribute(name)) {
       
  2985       return expected === undefined ? undefined : null;
       
  2986     }
       
  2987     var value = node.getAttribute(name);
       
  2988     if (value === '' + expected) {
       
  2989       return expected;
       
  2990     }
       
  2991     return value;
       
  2992   }
       
  2993 }
       
  2994 
       
  2995 /**
       
  2996  * Sets the value for a property on a node.
       
  2997  *
       
  2998  * @param {DOMElement} node
       
  2999  * @param {string} name
       
  3000  * @param {*} value
       
  3001  */
       
  3002 function setValueForProperty(node, name, value, isCustomComponentTag) {
       
  3003   var propertyInfo = getPropertyInfo(name);
       
  3004   if (shouldIgnoreAttribute(name, propertyInfo, isCustomComponentTag)) {
       
  3005     return;
       
  3006   }
       
  3007   if (shouldRemoveAttribute(name, value, propertyInfo, isCustomComponentTag)) {
       
  3008     value = null;
       
  3009   }
       
  3010   // If the prop isn't in the special list, treat it as a simple attribute.
       
  3011   if (isCustomComponentTag || propertyInfo === null) {
       
  3012     if (isAttributeNameSafe(name)) {
       
  3013       var _attributeName = name;
       
  3014       if (value === null) {
       
  3015         node.removeAttribute(_attributeName);
       
  3016       } else {
       
  3017         node.setAttribute(_attributeName, '' + value);
       
  3018       }
       
  3019     }
       
  3020     return;
       
  3021   }
       
  3022   var mustUseProperty = propertyInfo.mustUseProperty;
       
  3023 
       
  3024   if (mustUseProperty) {
       
  3025     var propertyName = propertyInfo.propertyName;
       
  3026 
       
  3027     if (value === null) {
       
  3028       var type = propertyInfo.type;
       
  3029 
       
  3030       node[propertyName] = type === BOOLEAN ? false : '';
       
  3031     } else {
       
  3032       // Contrary to `setAttribute`, object properties are properly
       
  3033       // `toString`ed by IE8/9.
       
  3034       node[propertyName] = value;
       
  3035     }
       
  3036     return;
       
  3037   }
       
  3038   // The rest are treated as attributes with special cases.
       
  3039   var attributeName = propertyInfo.attributeName,
       
  3040       attributeNamespace = propertyInfo.attributeNamespace;
       
  3041 
       
  3042   if (value === null) {
       
  3043     node.removeAttribute(attributeName);
       
  3044   } else {
       
  3045     var _type = propertyInfo.type;
       
  3046 
       
  3047     var attributeValue = void 0;
       
  3048     if (_type === BOOLEAN || _type === OVERLOADED_BOOLEAN && value === true) {
       
  3049       attributeValue = '';
       
  3050     } else {
       
  3051       // `setAttribute` with objects becomes only `[object]` in IE8/9,
       
  3052       // ('' + value) makes it output the correct toString()-value.
       
  3053       attributeValue = '' + value;
       
  3054     }
       
  3055     if (attributeNamespace) {
       
  3056       node.setAttributeNS(attributeNamespace, attributeName, attributeValue);
       
  3057     } else {
       
  3058       node.setAttribute(attributeName, attributeValue);
       
  3059     }
       
  3060   }
       
  3061 }
       
  3062 
       
  3063 // Flow does not allow string concatenation of most non-string types. To work
       
  3064 // around this limitation, we use an opaque type that can only be obtained by
       
  3065 // passing the value through getToStringValue first.
       
  3066 function toString(value) {
       
  3067   return '' + value;
       
  3068 }
       
  3069 
       
  3070 function getToStringValue(value) {
       
  3071   switch (typeof value) {
       
  3072     case 'boolean':
       
  3073     case 'number':
       
  3074     case 'object':
       
  3075     case 'string':
       
  3076     case 'undefined':
       
  3077       return value;
       
  3078     default:
       
  3079       // function, symbol are assigned as empty strings
       
  3080       return '';
       
  3081   }
       
  3082 }
       
  3083 
       
  3084 /**
       
  3085  * Copyright (c) 2013-present, Facebook, Inc.
       
  3086  *
       
  3087  * This source code is licensed under the MIT license found in the
       
  3088  * LICENSE file in the root directory of this source tree.
       
  3089  */
       
  3090 
       
  3091 
       
  3092 
       
  3093 var ReactPropTypesSecret$1 = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
       
  3094 
       
  3095 var ReactPropTypesSecret_1 = ReactPropTypesSecret$1;
       
  3096 
       
  3097 /**
       
  3098  * Copyright (c) 2013-present, Facebook, Inc.
       
  3099  *
       
  3100  * This source code is licensed under the MIT license found in the
       
  3101  * LICENSE file in the root directory of this source tree.
       
  3102  */
       
  3103 
       
  3104 
       
  3105 
       
  3106 var printWarning = function() {};
       
  3107 
       
  3108 {
       
  3109   var ReactPropTypesSecret = ReactPropTypesSecret_1;
       
  3110   var loggedTypeFailures = {};
       
  3111 
       
  3112   printWarning = function(text) {
       
  3113     var message = 'Warning: ' + text;
       
  3114     if (typeof console !== 'undefined') {
       
  3115       console.error(message);
       
  3116     }
       
  3117     try {
       
  3118       // --- Welcome to debugging React ---
       
  3119       // This error was thrown as a convenience so that you can use this stack
       
  3120       // to find the callsite that caused this warning to fire.
       
  3121       throw new Error(message);
       
  3122     } catch (x) {}
       
  3123   };
       
  3124 }
       
  3125 
       
  3126 /**
       
  3127  * Assert that the values match with the type specs.
       
  3128  * Error messages are memorized and will only be shown once.
       
  3129  *
       
  3130  * @param {object} typeSpecs Map of name to a ReactPropType
       
  3131  * @param {object} values Runtime values that need to be type-checked
       
  3132  * @param {string} location e.g. "prop", "context", "child context"
       
  3133  * @param {string} componentName Name of the component for error messages.
       
  3134  * @param {?Function} getStack Returns the component stack.
       
  3135  * @private
       
  3136  */
       
  3137 function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
       
  3138   {
       
  3139     for (var typeSpecName in typeSpecs) {
       
  3140       if (typeSpecs.hasOwnProperty(typeSpecName)) {
       
  3141         var error;
       
  3142         // Prop type validation may throw. In case they do, we don't want to
       
  3143         // fail the render phase where it didn't fail before. So we log it.
       
  3144         // After these have been cleaned up, we'll let them throw.
       
  3145         try {
       
  3146           // This is intentionally an invariant that gets caught. It's the same
       
  3147           // behavior as without this statement except with a better message.
       
  3148           if (typeof typeSpecs[typeSpecName] !== 'function') {
       
  3149             var err = Error(
       
  3150               (componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' +
       
  3151               'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.'
       
  3152             );
       
  3153             err.name = 'Invariant Violation';
       
  3154             throw err;
       
  3155           }
       
  3156           error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);
       
  3157         } catch (ex) {
       
  3158           error = ex;
       
  3159         }
       
  3160         if (error && !(error instanceof Error)) {
       
  3161           printWarning(
       
  3162             (componentName || 'React class') + ': type specification of ' +
       
  3163             location + ' `' + typeSpecName + '` is invalid; the type checker ' +
       
  3164             'function must return `null` or an `Error` but returned a ' + typeof error + '. ' +
       
  3165             'You may have forgotten to pass an argument to the type checker ' +
       
  3166             'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' +
       
  3167             'shape all require an argument).'
       
  3168           );
       
  3169 
       
  3170         }
       
  3171         if (error instanceof Error && !(error.message in loggedTypeFailures)) {
       
  3172           // Only monitor this failure once because there tends to be a lot of the
       
  3173           // same error.
       
  3174           loggedTypeFailures[error.message] = true;
       
  3175 
       
  3176           var stack = getStack ? getStack() : '';
       
  3177 
       
  3178           printWarning(
       
  3179             'Failed ' + location + ' type: ' + error.message + (stack != null ? stack : '')
       
  3180           );
       
  3181         }
       
  3182       }
       
  3183     }
       
  3184   }
       
  3185 }
       
  3186 
       
  3187 var checkPropTypes_1 = checkPropTypes;
       
  3188 
       
  3189 var ReactDebugCurrentFrame$1 = null;
       
  3190 
       
  3191 var ReactControlledValuePropTypes = {
       
  3192   checkPropTypes: null
       
  3193 };
       
  3194 
       
  3195 {
       
  3196   ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
       
  3197 
       
  3198   var hasReadOnlyValue = {
       
  3199     button: true,
       
  3200     checkbox: true,
       
  3201     image: true,
       
  3202     hidden: true,
       
  3203     radio: true,
       
  3204     reset: true,
       
  3205     submit: true
       
  3206   };
       
  3207 
       
  3208   var propTypes = {
       
  3209     value: function (props, propName, componentName) {
       
  3210       if (hasReadOnlyValue[props.type] || props.onChange || props.readOnly || props.disabled || props[propName] == null) {
       
  3211         return null;
       
  3212       }
       
  3213       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`.');
       
  3214     },
       
  3215     checked: function (props, propName, componentName) {
       
  3216       if (props.onChange || props.readOnly || props.disabled || props[propName] == null) {
       
  3217         return null;
       
  3218       }
       
  3219       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`.');
       
  3220     }
       
  3221   };
       
  3222 
       
  3223   /**
       
  3224    * Provide a linked `value` attribute for controlled forms. You should not use
       
  3225    * this outside of the ReactDOM controlled form components.
       
  3226    */
       
  3227   ReactControlledValuePropTypes.checkPropTypes = function (tagName, props) {
       
  3228     checkPropTypes_1(propTypes, props, 'prop', tagName, ReactDebugCurrentFrame$1.getStackAddendum);
       
  3229   };
       
  3230 }
       
  3231 
       
  3232 var enableUserTimingAPI = true;
       
  3233 
       
  3234 // Helps identify side effects in begin-phase lifecycle hooks and setState reducers:
       
  3235 var debugRenderPhaseSideEffects = false;
       
  3236 
       
  3237 // In some cases, StrictMode should also double-render lifecycles.
       
  3238 // This can be confusing for tests though,
       
  3239 // And it can be bad for performance in production.
       
  3240 // This feature flag can be used to control the behavior:
       
  3241 var debugRenderPhaseSideEffectsForStrictMode = true;
       
  3242 
       
  3243 // To preserve the "Pause on caught exceptions" behavior of the debugger, we
       
  3244 // replay the begin phase of a failed component inside invokeGuardedCallback.
       
  3245 var replayFailedUnitOfWorkWithInvokeGuardedCallback = true;
       
  3246 
       
  3247 // Warn about deprecated, async-unsafe lifecycles; relates to RFC #6:
       
  3248 var warnAboutDeprecatedLifecycles = false;
       
  3249 
       
  3250 // Gather advanced timing metrics for Profiler subtrees.
       
  3251 var enableProfilerTimer = true;
       
  3252 
       
  3253 // Trace which interactions trigger each commit.
       
  3254 var enableSchedulerTracing = true;
       
  3255 
       
  3256 // Only used in www builds.
       
  3257 var enableSuspenseServerRenderer = false; // TODO: true? Here it might just be false.
       
  3258 
       
  3259 // Only used in www builds.
       
  3260 
       
  3261 
       
  3262 // Only used in www builds.
       
  3263 
       
  3264 
       
  3265 // React Fire: prevent the value and checked attributes from syncing
       
  3266 // with their related DOM properties
       
  3267 var disableInputAttributeSyncing = false;
       
  3268 
       
  3269 // These APIs will no longer be "unstable" in the upcoming 16.7 release,
       
  3270 // Control this behavior with a flag to support 16.6 minor releases in the meanwhile.
       
  3271 var enableStableConcurrentModeAPIs = false;
       
  3272 
       
  3273 var warnAboutShorthandPropertyCollision = false;
       
  3274 
       
  3275 // TODO: direct imports like some-package/src/* are bad. Fix me.
       
  3276 var didWarnValueDefaultValue = false;
       
  3277 var didWarnCheckedDefaultChecked = false;
       
  3278 var didWarnControlledToUncontrolled = false;
       
  3279 var didWarnUncontrolledToControlled = false;
       
  3280 
       
  3281 function isControlled(props) {
       
  3282   var usesChecked = props.type === 'checkbox' || props.type === 'radio';
       
  3283   return usesChecked ? props.checked != null : props.value != null;
       
  3284 }
       
  3285 
       
  3286 /**
       
  3287  * Implements an <input> host component that allows setting these optional
       
  3288  * props: `checked`, `value`, `defaultChecked`, and `defaultValue`.
       
  3289  *
       
  3290  * If `checked` or `value` are not supplied (or null/undefined), user actions
       
  3291  * that affect the checked state or value will trigger updates to the element.
       
  3292  *
       
  3293  * If they are supplied (and not null/undefined), the rendered element will not
       
  3294  * trigger updates to the element. Instead, the props must change in order for
       
  3295  * the rendered element to be updated.
       
  3296  *
       
  3297  * The rendered element will be initialized as unchecked (or `defaultChecked`)
       
  3298  * with an empty value (or `defaultValue`).
       
  3299  *
       
  3300  * See http://www.w3.org/TR/2012/WD-html5-20121025/the-input-element.html
       
  3301  */
       
  3302 
       
  3303 function getHostProps(element, props) {
       
  3304   var node = element;
       
  3305   var checked = props.checked;
       
  3306 
       
  3307   var hostProps = _assign({}, props, {
       
  3308     defaultChecked: undefined,
       
  3309     defaultValue: undefined,
       
  3310     value: undefined,
       
  3311     checked: checked != null ? checked : node._wrapperState.initialChecked
       
  3312   });
       
  3313 
       
  3314   return hostProps;
       
  3315 }
       
  3316 
       
  3317 function initWrapperState(element, props) {
       
  3318   {
       
  3319     ReactControlledValuePropTypes.checkPropTypes('input', props);
       
  3320 
       
  3321     if (props.checked !== undefined && props.defaultChecked !== undefined && !didWarnCheckedDefaultChecked) {
       
  3322       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);
       
  3323       didWarnCheckedDefaultChecked = true;
       
  3324     }
       
  3325     if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValueDefaultValue) {
       
  3326       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);
       
  3327       didWarnValueDefaultValue = true;
       
  3328     }
       
  3329   }
       
  3330 
       
  3331   var node = element;
       
  3332   var defaultValue = props.defaultValue == null ? '' : props.defaultValue;
       
  3333 
       
  3334   node._wrapperState = {
       
  3335     initialChecked: props.checked != null ? props.checked : props.defaultChecked,
       
  3336     initialValue: getToStringValue(props.value != null ? props.value : defaultValue),
       
  3337     controlled: isControlled(props)
       
  3338   };
       
  3339 }
       
  3340 
       
  3341 function updateChecked(element, props) {
       
  3342   var node = element;
       
  3343   var checked = props.checked;
       
  3344   if (checked != null) {
       
  3345     setValueForProperty(node, 'checked', checked, false);
       
  3346   }
       
  3347 }
       
  3348 
       
  3349 function updateWrapper(element, props) {
       
  3350   var node = element;
       
  3351   {
       
  3352     var _controlled = isControlled(props);
       
  3353 
       
  3354     if (!node._wrapperState.controlled && _controlled && !didWarnUncontrolledToControlled) {
       
  3355       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);
       
  3356       didWarnUncontrolledToControlled = true;
       
  3357     }
       
  3358     if (node._wrapperState.controlled && !_controlled && !didWarnControlledToUncontrolled) {
       
  3359       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);
       
  3360       didWarnControlledToUncontrolled = true;
       
  3361     }
       
  3362   }
       
  3363 
       
  3364   updateChecked(element, props);
       
  3365 
       
  3366   var value = getToStringValue(props.value);
       
  3367   var type = props.type;
       
  3368 
       
  3369   if (value != null) {
       
  3370     if (type === 'number') {
       
  3371       if (value === 0 && node.value === '' ||
       
  3372       // We explicitly want to coerce to number here if possible.
       
  3373       // eslint-disable-next-line
       
  3374       node.value != value) {
       
  3375         node.value = toString(value);
       
  3376       }
       
  3377     } else if (node.value !== toString(value)) {
       
  3378       node.value = toString(value);
       
  3379     }
       
  3380   } else if (type === 'submit' || type === 'reset') {
       
  3381     // Submit/reset inputs need the attribute removed completely to avoid
       
  3382     // blank-text buttons.
       
  3383     node.removeAttribute('value');
       
  3384     return;
       
  3385   }
       
  3386 
       
  3387   if (disableInputAttributeSyncing) {
       
  3388     // When not syncing the value attribute, React only assigns a new value
       
  3389     // whenever the defaultValue React prop has changed. When not present,
       
  3390     // React does nothing
       
  3391     if (props.hasOwnProperty('defaultValue')) {
       
  3392       setDefaultValue(node, props.type, getToStringValue(props.defaultValue));
       
  3393     }
       
  3394   } else {
       
  3395     // When syncing the value attribute, the value comes from a cascade of
       
  3396     // properties:
       
  3397     //  1. The value React property
       
  3398     //  2. The defaultValue React property
       
  3399     //  3. Otherwise there should be no change
       
  3400     if (props.hasOwnProperty('value')) {
       
  3401       setDefaultValue(node, props.type, value);
       
  3402     } else if (props.hasOwnProperty('defaultValue')) {
       
  3403       setDefaultValue(node, props.type, getToStringValue(props.defaultValue));
       
  3404     }
       
  3405   }
       
  3406 
       
  3407   if (disableInputAttributeSyncing) {
       
  3408     // When not syncing the checked attribute, the attribute is directly
       
  3409     // controllable from the defaultValue React property. It needs to be
       
  3410     // updated as new props come in.
       
  3411     if (props.defaultChecked == null) {
       
  3412       node.removeAttribute('checked');
       
  3413     } else {
       
  3414       node.defaultChecked = !!props.defaultChecked;
       
  3415     }
       
  3416   } else {
       
  3417     // When syncing the checked attribute, it only changes when it needs
       
  3418     // to be removed, such as transitioning from a checkbox into a text input
       
  3419     if (props.checked == null && props.defaultChecked != null) {
       
  3420       node.defaultChecked = !!props.defaultChecked;
       
  3421     }
       
  3422   }
       
  3423 }
       
  3424 
       
  3425 function postMountWrapper(element, props, isHydrating) {
       
  3426   var node = element;
       
  3427 
       
  3428   // Do not assign value if it is already set. This prevents user text input
       
  3429   // from being lost during SSR hydration.
       
  3430   if (props.hasOwnProperty('value') || props.hasOwnProperty('defaultValue')) {
       
  3431     var type = props.type;
       
  3432     var isButton = type === 'submit' || type === 'reset';
       
  3433 
       
  3434     // Avoid setting value attribute on submit/reset inputs as it overrides the
       
  3435     // default value provided by the browser. See: #12872
       
  3436     if (isButton && (props.value === undefined || props.value === null)) {
       
  3437       return;
       
  3438     }
       
  3439 
       
  3440     var _initialValue = toString(node._wrapperState.initialValue);
       
  3441 
       
  3442     // Do not assign value if it is already set. This prevents user text input
       
  3443     // from being lost during SSR hydration.
       
  3444     if (!isHydrating) {
       
  3445       if (disableInputAttributeSyncing) {
       
  3446         var value = getToStringValue(props.value);
       
  3447 
       
  3448         // When not syncing the value attribute, the value property points
       
  3449         // directly to the React prop. Only assign it if it exists.
       
  3450         if (value != null) {
       
  3451           // Always assign on buttons so that it is possible to assign an
       
  3452           // empty string to clear button text.
       
  3453           //
       
  3454           // Otherwise, do not re-assign the value property if is empty. This
       
  3455           // potentially avoids a DOM write and prevents Firefox (~60.0.1) from
       
  3456           // prematurely marking required inputs as invalid. Equality is compared
       
  3457           // to the current value in case the browser provided value is not an
       
  3458           // empty string.
       
  3459           if (isButton || value !== node.value) {
       
  3460             node.value = toString(value);
       
  3461           }
       
  3462         }
       
  3463       } else {
       
  3464         // When syncing the value attribute, the value property should use
       
  3465         // the wrapperState._initialValue property. This uses:
       
  3466         //
       
  3467         //   1. The value React property when present
       
  3468         //   2. The defaultValue React property when present
       
  3469         //   3. An empty string
       
  3470         if (_initialValue !== node.value) {
       
  3471           node.value = _initialValue;
       
  3472         }
       
  3473       }
       
  3474     }
       
  3475 
       
  3476     if (disableInputAttributeSyncing) {
       
  3477       // When not syncing the value attribute, assign the value attribute
       
  3478       // directly from the defaultValue React property (when present)
       
  3479       var defaultValue = getToStringValue(props.defaultValue);
       
  3480       if (defaultValue != null) {
       
  3481         node.defaultValue = toString(defaultValue);
       
  3482       }
       
  3483     } else {
       
  3484       // Otherwise, the value attribute is synchronized to the property,
       
  3485       // so we assign defaultValue to the same thing as the value property
       
  3486       // assignment step above.
       
  3487       node.defaultValue = _initialValue;
       
  3488     }
       
  3489   }
       
  3490 
       
  3491   // Normally, we'd just do `node.checked = node.checked` upon initial mount, less this bug
       
  3492   // this is needed to work around a chrome bug where setting defaultChecked
       
  3493   // will sometimes influence the value of checked (even after detachment).
       
  3494   // Reference: https://bugs.chromium.org/p/chromium/issues/detail?id=608416
       
  3495   // We need to temporarily unset name to avoid disrupting radio button groups.
       
  3496   var name = node.name;
       
  3497   if (name !== '') {
       
  3498     node.name = '';
       
  3499   }
       
  3500 
       
  3501   if (disableInputAttributeSyncing) {
       
  3502     // When not syncing the checked attribute, the checked property
       
  3503     // never gets assigned. It must be manually set. We don't want
       
  3504     // to do this when hydrating so that existing user input isn't
       
  3505     // modified
       
  3506     if (!isHydrating) {
       
  3507       updateChecked(element, props);
       
  3508     }
       
  3509 
       
  3510     // Only assign the checked attribute if it is defined. This saves
       
  3511     // a DOM write when controlling the checked attribute isn't needed
       
  3512     // (text inputs, submit/reset)
       
  3513     if (props.hasOwnProperty('defaultChecked')) {
       
  3514       node.defaultChecked = !node.defaultChecked;
       
  3515       node.defaultChecked = !!props.defaultChecked;
       
  3516     }
       
  3517   } else {
       
  3518     // When syncing the checked attribute, both the checked property and
       
  3519     // attribute are assigned at the same time using defaultChecked. This uses:
       
  3520     //
       
  3521     //   1. The checked React property when present
       
  3522     //   2. The defaultChecked React property when present
       
  3523     //   3. Otherwise, false
       
  3524     node.defaultChecked = !node.defaultChecked;
       
  3525     node.defaultChecked = !!node._wrapperState.initialChecked;
       
  3526   }
       
  3527 
       
  3528   if (name !== '') {
       
  3529     node.name = name;
       
  3530   }
       
  3531 }
       
  3532 
       
  3533 function restoreControlledState(element, props) {
       
  3534   var node = element;
       
  3535   updateWrapper(node, props);
       
  3536   updateNamedCousins(node, props);
       
  3537 }
       
  3538 
       
  3539 function updateNamedCousins(rootNode, props) {
       
  3540   var name = props.name;
       
  3541   if (props.type === 'radio' && name != null) {
       
  3542     var queryRoot = rootNode;
       
  3543 
       
  3544     while (queryRoot.parentNode) {
       
  3545       queryRoot = queryRoot.parentNode;
       
  3546     }
       
  3547 
       
  3548     // If `rootNode.form` was non-null, then we could try `form.elements`,
       
  3549     // but that sometimes behaves strangely in IE8. We could also try using
       
  3550     // `form.getElementsByName`, but that will only return direct children
       
  3551     // and won't include inputs that use the HTML5 `form=` attribute. Since
       
  3552     // the input might not even be in a form. It might not even be in the
       
  3553     // document. Let's just use the local `querySelectorAll` to ensure we don't
       
  3554     // miss anything.
       
  3555     var group = queryRoot.querySelectorAll('input[name=' + JSON.stringify('' + name) + '][type="radio"]');
       
  3556 
       
  3557     for (var i = 0; i < group.length; i++) {
       
  3558       var otherNode = group[i];
       
  3559       if (otherNode === rootNode || otherNode.form !== rootNode.form) {
       
  3560         continue;
       
  3561       }
       
  3562       // This will throw if radio buttons rendered by different copies of React
       
  3563       // and the same name are rendered into the same form (same as #1939).
       
  3564       // That's probably okay; we don't support it just as we don't support
       
  3565       // mixing React radio buttons with non-React ones.
       
  3566       var otherProps = getFiberCurrentPropsFromNode$1(otherNode);
       
  3567       !otherProps ? invariant(false, 'ReactDOMInput: Mixing React and non-React radio inputs with the same `name` is not supported.') : void 0;
       
  3568 
       
  3569       // We need update the tracked value on the named cousin since the value
       
  3570       // was changed but the input saw no event or value set
       
  3571       updateValueIfChanged(otherNode);
       
  3572 
       
  3573       // If this is a controlled radio button group, forcing the input that
       
  3574       // was previously checked to update will cause it to be come re-checked
       
  3575       // as appropriate.
       
  3576       updateWrapper(otherNode, otherProps);
       
  3577     }
       
  3578   }
       
  3579 }
       
  3580 
       
  3581 // In Chrome, assigning defaultValue to certain input types triggers input validation.
       
  3582 // For number inputs, the display value loses trailing decimal points. For email inputs,
       
  3583 // Chrome raises "The specified value <x> is not a valid email address".
       
  3584 //
       
  3585 // Here we check to see if the defaultValue has actually changed, avoiding these problems
       
  3586 // when the user is inputting text
       
  3587 //
       
  3588 // https://github.com/facebook/react/issues/7253
       
  3589 function setDefaultValue(node, type, value) {
       
  3590   if (
       
  3591   // Focused number inputs synchronize on blur. See ChangeEventPlugin.js
       
  3592   type !== 'number' || node.ownerDocument.activeElement !== node) {
       
  3593     if (value == null) {
       
  3594       node.defaultValue = toString(node._wrapperState.initialValue);
       
  3595     } else if (node.defaultValue !== toString(value)) {
       
  3596       node.defaultValue = toString(value);
       
  3597     }
       
  3598   }
       
  3599 }
       
  3600 
       
  3601 var eventTypes$1 = {
       
  3602   change: {
       
  3603     phasedRegistrationNames: {
       
  3604       bubbled: 'onChange',
       
  3605       captured: 'onChangeCapture'
       
  3606     },
       
  3607     dependencies: [TOP_BLUR, TOP_CHANGE, TOP_CLICK, TOP_FOCUS, TOP_INPUT, TOP_KEY_DOWN, TOP_KEY_UP, TOP_SELECTION_CHANGE]
       
  3608   }
       
  3609 };
       
  3610 
       
  3611 function createAndAccumulateChangeEvent(inst, nativeEvent, target) {
       
  3612   var event = SyntheticEvent.getPooled(eventTypes$1.change, inst, nativeEvent, target);
       
  3613   event.type = 'change';
       
  3614   // Flag this event loop as needing state restore.
       
  3615   enqueueStateRestore(target);
       
  3616   accumulateTwoPhaseDispatches(event);
       
  3617   return event;
       
  3618 }
       
  3619 /**
       
  3620  * For IE shims
       
  3621  */
       
  3622 var activeElement = null;
       
  3623 var activeElementInst = null;
       
  3624 
       
  3625 /**
       
  3626  * SECTION: handle `change` event
       
  3627  */
       
  3628 function shouldUseChangeEvent(elem) {
       
  3629   var nodeName = elem.nodeName && elem.nodeName.toLowerCase();
       
  3630   return nodeName === 'select' || nodeName === 'input' && elem.type === 'file';
       
  3631 }
       
  3632 
       
  3633 function manualDispatchChangeEvent(nativeEvent) {
       
  3634   var event = createAndAccumulateChangeEvent(activeElementInst, nativeEvent, getEventTarget(nativeEvent));
       
  3635 
       
  3636   // If change and propertychange bubbled, we'd just bind to it like all the
       
  3637   // other events and have it go through ReactBrowserEventEmitter. Since it
       
  3638   // doesn't, we manually listen for the events and so we have to enqueue and
       
  3639   // process the abstract event manually.
       
  3640   //
       
  3641   // Batching is necessary here in order to ensure that all event handlers run
       
  3642   // before the next rerender (including event handlers attached to ancestor
       
  3643   // elements instead of directly on the input). Without this, controlled
       
  3644   // components don't work properly in conjunction with event bubbling because
       
  3645   // the component is rerendered and the value reverted before all the event
       
  3646   // handlers can run. See https://github.com/facebook/react/issues/708.
       
  3647   batchedUpdates(runEventInBatch, event);
       
  3648 }
       
  3649 
       
  3650 function runEventInBatch(event) {
       
  3651   runEventsInBatch(event);
       
  3652 }
       
  3653 
       
  3654 function getInstIfValueChanged(targetInst) {
       
  3655   var targetNode = getNodeFromInstance$1(targetInst);
       
  3656   if (updateValueIfChanged(targetNode)) {
       
  3657     return targetInst;
       
  3658   }
       
  3659 }
       
  3660 
       
  3661 function getTargetInstForChangeEvent(topLevelType, targetInst) {
       
  3662   if (topLevelType === TOP_CHANGE) {
       
  3663     return targetInst;
       
  3664   }
       
  3665 }
       
  3666 
       
  3667 /**
       
  3668  * SECTION: handle `input` event
       
  3669  */
       
  3670 var isInputEventSupported = false;
       
  3671 if (canUseDOM) {
       
  3672   // IE9 claims to support the input event but fails to trigger it when
       
  3673   // deleting text, so we ignore its input events.
       
  3674   isInputEventSupported = isEventSupported('input') && (!document.documentMode || document.documentMode > 9);
       
  3675 }
       
  3676 
       
  3677 /**
       
  3678  * (For IE <=9) Starts tracking propertychange events on the passed-in element
       
  3679  * and override the value property so that we can distinguish user events from
       
  3680  * value changes in JS.
       
  3681  */
       
  3682 function startWatchingForValueChange(target, targetInst) {
       
  3683   activeElement = target;
       
  3684   activeElementInst = targetInst;
       
  3685   activeElement.attachEvent('onpropertychange', handlePropertyChange);
       
  3686 }
       
  3687 
       
  3688 /**
       
  3689  * (For IE <=9) Removes the event listeners from the currently-tracked element,
       
  3690  * if any exists.
       
  3691  */
       
  3692 function stopWatchingForValueChange() {
       
  3693   if (!activeElement) {
       
  3694     return;
       
  3695   }
       
  3696   activeElement.detachEvent('onpropertychange', handlePropertyChange);
       
  3697   activeElement = null;
       
  3698   activeElementInst = null;
       
  3699 }
       
  3700 
       
  3701 /**
       
  3702  * (For IE <=9) Handles a propertychange event, sending a `change` event if
       
  3703  * the value of the active element has changed.
       
  3704  */
       
  3705 function handlePropertyChange(nativeEvent) {
       
  3706   if (nativeEvent.propertyName !== 'value') {
       
  3707     return;
       
  3708   }
       
  3709   if (getInstIfValueChanged(activeElementInst)) {
       
  3710     manualDispatchChangeEvent(nativeEvent);
       
  3711   }
       
  3712 }
       
  3713 
       
  3714 function handleEventsForInputEventPolyfill(topLevelType, target, targetInst) {
       
  3715   if (topLevelType === TOP_FOCUS) {
       
  3716     // In IE9, propertychange fires for most input events but is buggy and
       
  3717     // doesn't fire when text is deleted, but conveniently, selectionchange
       
  3718     // appears to fire in all of the remaining cases so we catch those and
       
  3719     // forward the event if the value has changed
       
  3720     // In either case, we don't want to call the event handler if the value
       
  3721     // is changed from JS so we redefine a setter for `.value` that updates
       
  3722     // our activeElementValue variable, allowing us to ignore those changes
       
  3723     //
       
  3724     // stopWatching() should be a noop here but we call it just in case we
       
  3725     // missed a blur event somehow.
       
  3726     stopWatchingForValueChange();
       
  3727     startWatchingForValueChange(target, targetInst);
       
  3728   } else if (topLevelType === TOP_BLUR) {
       
  3729     stopWatchingForValueChange();
       
  3730   }
       
  3731 }
       
  3732 
       
  3733 // For IE8 and IE9.
       
  3734 function getTargetInstForInputEventPolyfill(topLevelType, targetInst) {
       
  3735   if (topLevelType === TOP_SELECTION_CHANGE || topLevelType === TOP_KEY_UP || topLevelType === TOP_KEY_DOWN) {
       
  3736     // On the selectionchange event, the target is just document which isn't
       
  3737     // helpful for us so just check activeElement instead.
       
  3738     //
       
  3739     // 99% of the time, keydown and keyup aren't necessary. IE8 fails to fire
       
  3740     // propertychange on the first input event after setting `value` from a
       
  3741     // script and fires only keydown, keypress, keyup. Catching keyup usually
       
  3742     // gets it and catching keydown lets us fire an event for the first
       
  3743     // keystroke if user does a key repeat (it'll be a little delayed: right
       
  3744     // before the second keystroke). Other input methods (e.g., paste) seem to
       
  3745     // fire selectionchange normally.
       
  3746     return getInstIfValueChanged(activeElementInst);
       
  3747   }
       
  3748 }
       
  3749 
       
  3750 /**
       
  3751  * SECTION: handle `click` event
       
  3752  */
       
  3753 function shouldUseClickEvent(elem) {
       
  3754   // Use the `click` event to detect changes to checkbox and radio inputs.
       
  3755   // This approach works across all browsers, whereas `change` does not fire
       
  3756   // until `blur` in IE8.
       
  3757   var nodeName = elem.nodeName;
       
  3758   return nodeName && nodeName.toLowerCase() === 'input' && (elem.type === 'checkbox' || elem.type === 'radio');
       
  3759 }
       
  3760 
       
  3761 function getTargetInstForClickEvent(topLevelType, targetInst) {
       
  3762   if (topLevelType === TOP_CLICK) {
       
  3763     return getInstIfValueChanged(targetInst);
       
  3764   }
       
  3765 }
       
  3766 
       
  3767 function getTargetInstForInputOrChangeEvent(topLevelType, targetInst) {
       
  3768   if (topLevelType === TOP_INPUT || topLevelType === TOP_CHANGE) {
       
  3769     return getInstIfValueChanged(targetInst);
       
  3770   }
       
  3771 }
       
  3772 
       
  3773 function handleControlledInputBlur(node) {
       
  3774   var state = node._wrapperState;
       
  3775 
       
  3776   if (!state || !state.controlled || node.type !== 'number') {
       
  3777     return;
       
  3778   }
       
  3779 
       
  3780   if (!disableInputAttributeSyncing) {
       
  3781     // If controlled, assign the value attribute to the current value on blur
       
  3782     setDefaultValue(node, 'number', node.value);
       
  3783   }
       
  3784 }
       
  3785 
       
  3786 /**
       
  3787  * This plugin creates an `onChange` event that normalizes change events
       
  3788  * across form elements. This event fires at a time when it's possible to
       
  3789  * change the element's value without seeing a flicker.
       
  3790  *
       
  3791  * Supported elements are:
       
  3792  * - input (see `isTextInputElement`)
       
  3793  * - textarea
       
  3794  * - select
       
  3795  */
       
  3796 var ChangeEventPlugin = {
       
  3797   eventTypes: eventTypes$1,
       
  3798 
       
  3799   _isInputEventSupported: isInputEventSupported,
       
  3800 
       
  3801   extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
       
  3802     var targetNode = targetInst ? getNodeFromInstance$1(targetInst) : window;
       
  3803 
       
  3804     var getTargetInstFunc = void 0,
       
  3805         handleEventFunc = void 0;
       
  3806     if (shouldUseChangeEvent(targetNode)) {
       
  3807       getTargetInstFunc = getTargetInstForChangeEvent;
       
  3808     } else if (isTextInputElement(targetNode)) {
       
  3809       if (isInputEventSupported) {
       
  3810         getTargetInstFunc = getTargetInstForInputOrChangeEvent;
       
  3811       } else {
       
  3812         getTargetInstFunc = getTargetInstForInputEventPolyfill;
       
  3813         handleEventFunc = handleEventsForInputEventPolyfill;
       
  3814       }
       
  3815     } else if (shouldUseClickEvent(targetNode)) {
       
  3816       getTargetInstFunc = getTargetInstForClickEvent;
       
  3817     }
       
  3818 
       
  3819     if (getTargetInstFunc) {
       
  3820       var inst = getTargetInstFunc(topLevelType, targetInst);
       
  3821       if (inst) {
       
  3822         var event = createAndAccumulateChangeEvent(inst, nativeEvent, nativeEventTarget);
       
  3823         return event;
       
  3824       }
       
  3825     }
       
  3826 
       
  3827     if (handleEventFunc) {
       
  3828       handleEventFunc(topLevelType, targetNode, targetInst);
       
  3829     }
       
  3830 
       
  3831     // When blurring, set the value attribute for number inputs
       
  3832     if (topLevelType === TOP_BLUR) {
       
  3833       handleControlledInputBlur(targetNode);
       
  3834     }
       
  3835   }
       
  3836 };
       
  3837 
       
  3838 /**
       
  3839  * Module that is injectable into `EventPluginHub`, that specifies a
       
  3840  * deterministic ordering of `EventPlugin`s. A convenient way to reason about
       
  3841  * plugins, without having to package every one of them. This is better than
       
  3842  * having plugins be ordered in the same order that they are injected because
       
  3843  * that ordering would be influenced by the packaging order.
       
  3844  * `ResponderEventPlugin` must occur before `SimpleEventPlugin` so that
       
  3845  * preventing default on events is convenient in `SimpleEventPlugin` handlers.
       
  3846  */
       
  3847 var DOMEventPluginOrder = ['ResponderEventPlugin', 'SimpleEventPlugin', 'EnterLeaveEventPlugin', 'ChangeEventPlugin', 'SelectEventPlugin', 'BeforeInputEventPlugin'];
       
  3848 
       
  3849 var SyntheticUIEvent = SyntheticEvent.extend({
       
  3850   view: null,
       
  3851   detail: null
       
  3852 });
       
  3853 
       
  3854 var modifierKeyToProp = {
       
  3855   Alt: 'altKey',
       
  3856   Control: 'ctrlKey',
       
  3857   Meta: 'metaKey',
       
  3858   Shift: 'shiftKey'
       
  3859 };
       
  3860 
       
  3861 // Older browsers (Safari <= 10, iOS Safari <= 10.2) do not support
       
  3862 // getModifierState. If getModifierState is not supported, we map it to a set of
       
  3863 // modifier keys exposed by the event. In this case, Lock-keys are not supported.
       
  3864 /**
       
  3865  * Translation from modifier key to the associated property in the event.
       
  3866  * @see http://www.w3.org/TR/DOM-Level-3-Events/#keys-Modifiers
       
  3867  */
       
  3868 
       
  3869 function modifierStateGetter(keyArg) {
       
  3870   var syntheticEvent = this;
       
  3871   var nativeEvent = syntheticEvent.nativeEvent;
       
  3872   if (nativeEvent.getModifierState) {
       
  3873     return nativeEvent.getModifierState(keyArg);
       
  3874   }
       
  3875   var keyProp = modifierKeyToProp[keyArg];
       
  3876   return keyProp ? !!nativeEvent[keyProp] : false;
       
  3877 }
       
  3878 
       
  3879 function getEventModifierState(nativeEvent) {
       
  3880   return modifierStateGetter;
       
  3881 }
       
  3882 
       
  3883 var previousScreenX = 0;
       
  3884 var previousScreenY = 0;
       
  3885 // Use flags to signal movementX/Y has already been set
       
  3886 var isMovementXSet = false;
       
  3887 var isMovementYSet = false;
       
  3888 
       
  3889 /**
       
  3890  * @interface MouseEvent
       
  3891  * @see http://www.w3.org/TR/DOM-Level-3-Events/
       
  3892  */
       
  3893 var SyntheticMouseEvent = SyntheticUIEvent.extend({
       
  3894   screenX: null,
       
  3895   screenY: null,
       
  3896   clientX: null,
       
  3897   clientY: null,
       
  3898   pageX: null,
       
  3899   pageY: null,
       
  3900   ctrlKey: null,
       
  3901   shiftKey: null,
       
  3902   altKey: null,
       
  3903   metaKey: null,
       
  3904   getModifierState: getEventModifierState,
       
  3905   button: null,
       
  3906   buttons: null,
       
  3907   relatedTarget: function (event) {
       
  3908     return event.relatedTarget || (event.fromElement === event.srcElement ? event.toElement : event.fromElement);
       
  3909   },
       
  3910   movementX: function (event) {
       
  3911     if ('movementX' in event) {
       
  3912       return event.movementX;
       
  3913     }
       
  3914 
       
  3915     var screenX = previousScreenX;
       
  3916     previousScreenX = event.screenX;
       
  3917 
       
  3918     if (!isMovementXSet) {
       
  3919       isMovementXSet = true;
       
  3920       return 0;
       
  3921     }
       
  3922 
       
  3923     return event.type === 'mousemove' ? event.screenX - screenX : 0;
       
  3924   },
       
  3925   movementY: function (event) {
       
  3926     if ('movementY' in event) {
       
  3927       return event.movementY;
       
  3928     }
       
  3929 
       
  3930     var screenY = previousScreenY;
       
  3931     previousScreenY = event.screenY;
       
  3932 
       
  3933     if (!isMovementYSet) {
       
  3934       isMovementYSet = true;
       
  3935       return 0;
       
  3936     }
       
  3937 
       
  3938     return event.type === 'mousemove' ? event.screenY - screenY : 0;
       
  3939   }
       
  3940 });
       
  3941 
       
  3942 /**
       
  3943  * @interface PointerEvent
       
  3944  * @see http://www.w3.org/TR/pointerevents/
       
  3945  */
       
  3946 var SyntheticPointerEvent = SyntheticMouseEvent.extend({
       
  3947   pointerId: null,
       
  3948   width: null,
       
  3949   height: null,
       
  3950   pressure: null,
       
  3951   tangentialPressure: null,
       
  3952   tiltX: null,
       
  3953   tiltY: null,
       
  3954   twist: null,
       
  3955   pointerType: null,
       
  3956   isPrimary: null
       
  3957 });
       
  3958 
       
  3959 var eventTypes$2 = {
       
  3960   mouseEnter: {
       
  3961     registrationName: 'onMouseEnter',
       
  3962     dependencies: [TOP_MOUSE_OUT, TOP_MOUSE_OVER]
       
  3963   },
       
  3964   mouseLeave: {
       
  3965     registrationName: 'onMouseLeave',
       
  3966     dependencies: [TOP_MOUSE_OUT, TOP_MOUSE_OVER]
       
  3967   },
       
  3968   pointerEnter: {
       
  3969     registrationName: 'onPointerEnter',
       
  3970     dependencies: [TOP_POINTER_OUT, TOP_POINTER_OVER]
       
  3971   },
       
  3972   pointerLeave: {
       
  3973     registrationName: 'onPointerLeave',
       
  3974     dependencies: [TOP_POINTER_OUT, TOP_POINTER_OVER]
       
  3975   }
       
  3976 };
       
  3977 
       
  3978 var EnterLeaveEventPlugin = {
       
  3979   eventTypes: eventTypes$2,
       
  3980 
       
  3981   /**
       
  3982    * For almost every interaction we care about, there will be both a top-level
       
  3983    * `mouseover` and `mouseout` event that occurs. Only use `mouseout` so that
       
  3984    * we do not extract duplicate events. However, moving the mouse into the
       
  3985    * browser from outside will not fire a `mouseout` event. In this case, we use
       
  3986    * the `mouseover` top-level event.
       
  3987    */
       
  3988   extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
       
  3989     var isOverEvent = topLevelType === TOP_MOUSE_OVER || topLevelType === TOP_POINTER_OVER;
       
  3990     var isOutEvent = topLevelType === TOP_MOUSE_OUT || topLevelType === TOP_POINTER_OUT;
       
  3991 
       
  3992     if (isOverEvent && (nativeEvent.relatedTarget || nativeEvent.fromElement)) {
       
  3993       return null;
       
  3994     }
       
  3995 
       
  3996     if (!isOutEvent && !isOverEvent) {
       
  3997       // Must not be a mouse or pointer in or out - ignoring.
       
  3998       return null;
       
  3999     }
       
  4000 
       
  4001     var win = void 0;
       
  4002     if (nativeEventTarget.window === nativeEventTarget) {
       
  4003       // `nativeEventTarget` is probably a window object.
       
  4004       win = nativeEventTarget;
       
  4005     } else {
       
  4006       // TODO: Figure out why `ownerDocument` is sometimes undefined in IE8.
       
  4007       var doc = nativeEventTarget.ownerDocument;
       
  4008       if (doc) {
       
  4009         win = doc.defaultView || doc.parentWindow;
       
  4010       } else {
       
  4011         win = window;
       
  4012       }
       
  4013     }
       
  4014 
       
  4015     var from = void 0;
       
  4016     var to = void 0;
       
  4017     if (isOutEvent) {
       
  4018       from = targetInst;
       
  4019       var related = nativeEvent.relatedTarget || nativeEvent.toElement;
       
  4020       to = related ? getClosestInstanceFromNode(related) : null;
       
  4021     } else {
       
  4022       // Moving to a node from outside the window.
       
  4023       from = null;
       
  4024       to = targetInst;
       
  4025     }
       
  4026 
       
  4027     if (from === to) {
       
  4028       // Nothing pertains to our managed components.
       
  4029       return null;
       
  4030     }
       
  4031 
       
  4032     var eventInterface = void 0,
       
  4033         leaveEventType = void 0,
       
  4034         enterEventType = void 0,
       
  4035         eventTypePrefix = void 0;
       
  4036 
       
  4037     if (topLevelType === TOP_MOUSE_OUT || topLevelType === TOP_MOUSE_OVER) {
       
  4038       eventInterface = SyntheticMouseEvent;
       
  4039       leaveEventType = eventTypes$2.mouseLeave;
       
  4040       enterEventType = eventTypes$2.mouseEnter;
       
  4041       eventTypePrefix = 'mouse';
       
  4042     } else if (topLevelType === TOP_POINTER_OUT || topLevelType === TOP_POINTER_OVER) {
       
  4043       eventInterface = SyntheticPointerEvent;
       
  4044       leaveEventType = eventTypes$2.pointerLeave;
       
  4045       enterEventType = eventTypes$2.pointerEnter;
       
  4046       eventTypePrefix = 'pointer';
       
  4047     }
       
  4048 
       
  4049     var fromNode = from == null ? win : getNodeFromInstance$1(from);
       
  4050     var toNode = to == null ? win : getNodeFromInstance$1(to);
       
  4051 
       
  4052     var leave = eventInterface.getPooled(leaveEventType, from, nativeEvent, nativeEventTarget);
       
  4053     leave.type = eventTypePrefix + 'leave';
       
  4054     leave.target = fromNode;
       
  4055     leave.relatedTarget = toNode;
       
  4056 
       
  4057     var enter = eventInterface.getPooled(enterEventType, to, nativeEvent, nativeEventTarget);
       
  4058     enter.type = eventTypePrefix + 'enter';
       
  4059     enter.target = toNode;
       
  4060     enter.relatedTarget = fromNode;
       
  4061 
       
  4062     accumulateEnterLeaveDispatches(leave, enter, from, to);
       
  4063 
       
  4064     return [leave, enter];
       
  4065   }
       
  4066 };
       
  4067 
       
  4068 /**
       
  4069  * inlined Object.is polyfill to avoid requiring consumers ship their own
       
  4070  * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
       
  4071  */
       
  4072 function is(x, y) {
       
  4073   return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y // eslint-disable-line no-self-compare
       
  4074   ;
       
  4075 }
       
  4076 
       
  4077 var hasOwnProperty$1 = Object.prototype.hasOwnProperty;
       
  4078 
       
  4079 /**
       
  4080  * Performs equality by iterating through keys on an object and returning false
       
  4081  * when any key has values which are not strictly equal between the arguments.
       
  4082  * Returns true when the values of all keys are strictly equal.
       
  4083  */
       
  4084 function shallowEqual(objA, objB) {
       
  4085   if (is(objA, objB)) {
       
  4086     return true;
       
  4087   }
       
  4088 
       
  4089   if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) {
       
  4090     return false;
       
  4091   }
       
  4092 
       
  4093   var keysA = Object.keys(objA);
       
  4094   var keysB = Object.keys(objB);
       
  4095 
       
  4096   if (keysA.length !== keysB.length) {
       
  4097     return false;
       
  4098   }
       
  4099 
       
  4100   // Test for A's keys different from B.
       
  4101   for (var i = 0; i < keysA.length; i++) {
       
  4102     if (!hasOwnProperty$1.call(objB, keysA[i]) || !is(objA[keysA[i]], objB[keysA[i]])) {
       
  4103       return false;
       
  4104     }
       
  4105   }
       
  4106 
       
  4107   return true;
       
  4108 }
       
  4109 
       
  4110 /**
       
  4111  * `ReactInstanceMap` maintains a mapping from a public facing stateful
       
  4112  * instance (key) and the internal representation (value). This allows public
       
  4113  * methods to accept the user facing instance as an argument and map them back
       
  4114  * to internal methods.
       
  4115  *
       
  4116  * Note that this module is currently shared and assumed to be stateless.
       
  4117  * If this becomes an actual Map, that will break.
       
  4118  */
       
  4119 
       
  4120 /**
       
  4121  * This API should be called `delete` but we'd have to make sure to always
       
  4122  * transform these to strings for IE support. When this transform is fully
       
  4123  * supported we can rename it.
       
  4124  */
       
  4125 
       
  4126 
       
  4127 function get(key) {
       
  4128   return key._reactInternalFiber;
       
  4129 }
       
  4130 
       
  4131 function has(key) {
       
  4132   return key._reactInternalFiber !== undefined;
       
  4133 }
       
  4134 
       
  4135 function set(key, value) {
       
  4136   key._reactInternalFiber = value;
       
  4137 }
       
  4138 
       
  4139 // Don't change these two values. They're used by React Dev Tools.
       
  4140 var NoEffect = /*              */0;
       
  4141 var PerformedWork = /*         */1;
       
  4142 
       
  4143 // You can change the rest (and add more).
       
  4144 var Placement = /*             */2;
       
  4145 var Update = /*                */4;
       
  4146 var PlacementAndUpdate = /*    */6;
       
  4147 var Deletion = /*              */8;
       
  4148 var ContentReset = /*          */16;
       
  4149 var Callback = /*              */32;
       
  4150 var DidCapture = /*            */64;
       
  4151 var Ref = /*                   */128;
       
  4152 var Snapshot = /*              */256;
       
  4153 var Passive = /*               */512;
       
  4154 
       
  4155 // Passive & Update & Callback & Ref & Snapshot
       
  4156 var LifecycleEffectMask = /*   */932;
       
  4157 
       
  4158 // Union of all host effects
       
  4159 var HostEffectMask = /*        */1023;
       
  4160 
       
  4161 var Incomplete = /*            */1024;
       
  4162 var ShouldCapture = /*         */2048;
       
  4163 
       
  4164 var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner;
       
  4165 
       
  4166 var MOUNTING = 1;
       
  4167 var MOUNTED = 2;
       
  4168 var UNMOUNTED = 3;
       
  4169 
       
  4170 function isFiberMountedImpl(fiber) {
       
  4171   var node = fiber;
       
  4172   if (!fiber.alternate) {
       
  4173     // If there is no alternate, this might be a new tree that isn't inserted
       
  4174     // yet. If it is, then it will have a pending insertion effect on it.
       
  4175     if ((node.effectTag & Placement) !== NoEffect) {
       
  4176       return MOUNTING;
       
  4177     }
       
  4178     while (node.return) {
       
  4179       node = node.return;
       
  4180       if ((node.effectTag & Placement) !== NoEffect) {
       
  4181         return MOUNTING;
       
  4182       }
       
  4183     }
       
  4184   } else {
       
  4185     while (node.return) {
       
  4186       node = node.return;
       
  4187     }
       
  4188   }
       
  4189   if (node.tag === HostRoot) {
       
  4190     // TODO: Check if this was a nested HostRoot when used with
       
  4191     // renderContainerIntoSubtree.
       
  4192     return MOUNTED;
       
  4193   }
       
  4194   // If we didn't hit the root, that means that we're in an disconnected tree
       
  4195   // that has been unmounted.
       
  4196   return UNMOUNTED;
       
  4197 }
       
  4198 
       
  4199 function isFiberMounted(fiber) {
       
  4200   return isFiberMountedImpl(fiber) === MOUNTED;
       
  4201 }
       
  4202 
       
  4203 function isMounted(component) {
       
  4204   {
       
  4205     var owner = ReactCurrentOwner$1.current;
       
  4206     if (owner !== null && owner.tag === ClassComponent) {
       
  4207       var ownerFiber = owner;
       
  4208       var instance = ownerFiber.stateNode;
       
  4209       !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;
       
  4210       instance._warnedAboutRefsInRender = true;
       
  4211     }
       
  4212   }
       
  4213 
       
  4214   var fiber = get(component);
       
  4215   if (!fiber) {
       
  4216     return false;
       
  4217   }
       
  4218   return isFiberMountedImpl(fiber) === MOUNTED;
       
  4219 }
       
  4220 
       
  4221 function assertIsMounted(fiber) {
       
  4222   !(isFiberMountedImpl(fiber) === MOUNTED) ? invariant(false, 'Unable to find node on an unmounted component.') : void 0;
       
  4223 }
       
  4224 
       
  4225 function findCurrentFiberUsingSlowPath(fiber) {
       
  4226   var alternate = fiber.alternate;
       
  4227   if (!alternate) {
       
  4228     // If there is no alternate, then we only need to check if it is mounted.
       
  4229     var state = isFiberMountedImpl(fiber);
       
  4230     !(state !== UNMOUNTED) ? invariant(false, 'Unable to find node on an unmounted component.') : void 0;
       
  4231     if (state === MOUNTING) {
       
  4232       return null;
       
  4233     }
       
  4234     return fiber;
       
  4235   }
       
  4236   // If we have two possible branches, we'll walk backwards up to the root
       
  4237   // to see what path the root points to. On the way we may hit one of the
       
  4238   // special cases and we'll deal with them.
       
  4239   var a = fiber;
       
  4240   var b = alternate;
       
  4241   while (true) {
       
  4242     var parentA = a.return;
       
  4243     var parentB = parentA ? parentA.alternate : null;
       
  4244     if (!parentA || !parentB) {
       
  4245       // We're at the root.
       
  4246       break;
       
  4247     }
       
  4248 
       
  4249     // If both copies of the parent fiber point to the same child, we can
       
  4250     // assume that the child is current. This happens when we bailout on low
       
  4251     // priority: the bailed out fiber's child reuses the current child.
       
  4252     if (parentA.child === parentB.child) {
       
  4253       var child = parentA.child;
       
  4254       while (child) {
       
  4255         if (child === a) {
       
  4256           // We've determined that A is the current branch.
       
  4257           assertIsMounted(parentA);
       
  4258           return fiber;
       
  4259         }
       
  4260         if (child === b) {
       
  4261           // We've determined that B is the current branch.
       
  4262           assertIsMounted(parentA);
       
  4263           return alternate;
       
  4264         }
       
  4265         child = child.sibling;
       
  4266       }
       
  4267       // We should never have an alternate for any mounting node. So the only
       
  4268       // way this could possibly happen is if this was unmounted, if at all.
       
  4269       invariant(false, 'Unable to find node on an unmounted component.');
       
  4270     }
       
  4271 
       
  4272     if (a.return !== b.return) {
       
  4273       // The return pointer of A and the return pointer of B point to different
       
  4274       // fibers. We assume that return pointers never criss-cross, so A must
       
  4275       // belong to the child set of A.return, and B must belong to the child
       
  4276       // set of B.return.
       
  4277       a = parentA;
       
  4278       b = parentB;
       
  4279     } else {
       
  4280       // The return pointers point to the same fiber. We'll have to use the
       
  4281       // default, slow path: scan the child sets of each parent alternate to see
       
  4282       // which child belongs to which set.
       
  4283       //
       
  4284       // Search parent A's child set
       
  4285       var didFindChild = false;
       
  4286       var _child = parentA.child;
       
  4287       while (_child) {
       
  4288         if (_child === a) {
       
  4289           didFindChild = true;
       
  4290           a = parentA;
       
  4291           b = parentB;
       
  4292           break;
       
  4293         }
       
  4294         if (_child === b) {
       
  4295           didFindChild = true;
       
  4296           b = parentA;
       
  4297           a = parentB;
       
  4298           break;
       
  4299         }
       
  4300         _child = _child.sibling;
       
  4301       }
       
  4302       if (!didFindChild) {
       
  4303         // Search parent B's child set
       
  4304         _child = parentB.child;
       
  4305         while (_child) {
       
  4306           if (_child === a) {
       
  4307             didFindChild = true;
       
  4308             a = parentB;
       
  4309             b = parentA;
       
  4310             break;
       
  4311           }
       
  4312           if (_child === b) {
       
  4313             didFindChild = true;
       
  4314             b = parentB;
       
  4315             a = parentA;
       
  4316             break;
       
  4317           }
       
  4318           _child = _child.sibling;
       
  4319         }
       
  4320         !didFindChild ? invariant(false, 'Child was not found in either parent set. This indicates a bug in React related to the return pointer. Please file an issue.') : void 0;
       
  4321       }
       
  4322     }
       
  4323 
       
  4324     !(a.alternate === b) ? invariant(false, 'Return fibers should always be each others\' alternates. This error is likely caused by a bug in React. Please file an issue.') : void 0;
       
  4325   }
       
  4326   // If the root is not a host container, we're in a disconnected tree. I.e.
       
  4327   // unmounted.
       
  4328   !(a.tag === HostRoot) ? invariant(false, 'Unable to find node on an unmounted component.') : void 0;
       
  4329   if (a.stateNode.current === a) {
       
  4330     // We've determined that A is the current branch.
       
  4331     return fiber;
       
  4332   }
       
  4333   // Otherwise B has to be current branch.
       
  4334   return alternate;
       
  4335 }
       
  4336 
       
  4337 function findCurrentHostFiber(parent) {
       
  4338   var currentParent = findCurrentFiberUsingSlowPath(parent);
       
  4339   if (!currentParent) {
       
  4340     return null;
       
  4341   }
       
  4342 
       
  4343   // Next we'll drill down this component to find the first HostComponent/Text.
       
  4344   var node = currentParent;
       
  4345   while (true) {
       
  4346     if (node.tag === HostComponent || node.tag === HostText) {
       
  4347       return node;
       
  4348     } else if (node.child) {
       
  4349       node.child.return = node;
       
  4350       node = node.child;
       
  4351       continue;
       
  4352     }
       
  4353     if (node === currentParent) {
       
  4354       return null;
       
  4355     }
       
  4356     while (!node.sibling) {
       
  4357       if (!node.return || node.return === currentParent) {
       
  4358         return null;
       
  4359       }
       
  4360       node = node.return;
       
  4361     }
       
  4362     node.sibling.return = node.return;
       
  4363     node = node.sibling;
       
  4364   }
       
  4365   // Flow needs the return null here, but ESLint complains about it.
       
  4366   // eslint-disable-next-line no-unreachable
       
  4367   return null;
       
  4368 }
       
  4369 
       
  4370 function findCurrentHostFiberWithNoPortals(parent) {
       
  4371   var currentParent = findCurrentFiberUsingSlowPath(parent);
       
  4372   if (!currentParent) {
       
  4373     return null;
       
  4374   }
       
  4375 
       
  4376   // Next we'll drill down this component to find the first HostComponent/Text.
       
  4377   var node = currentParent;
       
  4378   while (true) {
       
  4379     if (node.tag === HostComponent || node.tag === HostText) {
       
  4380       return node;
       
  4381     } else if (node.child && node.tag !== HostPortal) {
       
  4382       node.child.return = node;
       
  4383       node = node.child;
       
  4384       continue;
       
  4385     }
       
  4386     if (node === currentParent) {
       
  4387       return null;
       
  4388     }
       
  4389     while (!node.sibling) {
       
  4390       if (!node.return || node.return === currentParent) {
       
  4391         return null;
       
  4392       }
       
  4393       node = node.return;
       
  4394     }
       
  4395     node.sibling.return = node.return;
       
  4396     node = node.sibling;
       
  4397   }
       
  4398   // Flow needs the return null here, but ESLint complains about it.
       
  4399   // eslint-disable-next-line no-unreachable
       
  4400   return null;
       
  4401 }
       
  4402 
       
  4403 function addEventBubbleListener(element, eventType, listener) {
       
  4404   element.addEventListener(eventType, listener, false);
       
  4405 }
       
  4406 
       
  4407 function addEventCaptureListener(element, eventType, listener) {
       
  4408   element.addEventListener(eventType, listener, true);
       
  4409 }
       
  4410 
       
  4411 /**
       
  4412  * @interface Event
       
  4413  * @see http://www.w3.org/TR/css3-animations/#AnimationEvent-interface
       
  4414  * @see https://developer.mozilla.org/en-US/docs/Web/API/AnimationEvent
       
  4415  */
       
  4416 var SyntheticAnimationEvent = SyntheticEvent.extend({
       
  4417   animationName: null,
       
  4418   elapsedTime: null,
       
  4419   pseudoElement: null
       
  4420 });
       
  4421 
       
  4422 /**
       
  4423  * @interface Event
       
  4424  * @see http://www.w3.org/TR/clipboard-apis/
       
  4425  */
       
  4426 var SyntheticClipboardEvent = SyntheticEvent.extend({
       
  4427   clipboardData: function (event) {
       
  4428     return 'clipboardData' in event ? event.clipboardData : window.clipboardData;
       
  4429   }
       
  4430 });
       
  4431 
       
  4432 /**
       
  4433  * @interface FocusEvent
       
  4434  * @see http://www.w3.org/TR/DOM-Level-3-Events/
       
  4435  */
       
  4436 var SyntheticFocusEvent = SyntheticUIEvent.extend({
       
  4437   relatedTarget: null
       
  4438 });
       
  4439 
       
  4440 /**
       
  4441  * `charCode` represents the actual "character code" and is safe to use with
       
  4442  * `String.fromCharCode`. As such, only keys that correspond to printable
       
  4443  * characters produce a valid `charCode`, the only exception to this is Enter.
       
  4444  * The Tab-key is considered non-printable and does not have a `charCode`,
       
  4445  * presumably because it does not produce a tab-character in browsers.
       
  4446  *
       
  4447  * @param {object} nativeEvent Native browser event.
       
  4448  * @return {number} Normalized `charCode` property.
       
  4449  */
       
  4450 function getEventCharCode(nativeEvent) {
       
  4451   var charCode = void 0;
       
  4452   var keyCode = nativeEvent.keyCode;
       
  4453 
       
  4454   if ('charCode' in nativeEvent) {
       
  4455     charCode = nativeEvent.charCode;
       
  4456 
       
  4457     // FF does not set `charCode` for the Enter-key, check against `keyCode`.
       
  4458     if (charCode === 0 && keyCode === 13) {
       
  4459       charCode = 13;
       
  4460     }
       
  4461   } else {
       
  4462     // IE8 does not implement `charCode`, but `keyCode` has the correct value.
       
  4463     charCode = keyCode;
       
  4464   }
       
  4465 
       
  4466   // IE and Edge (on Windows) and Chrome / Safari (on Windows and Linux)
       
  4467   // report Enter as charCode 10 when ctrl is pressed.
       
  4468   if (charCode === 10) {
       
  4469     charCode = 13;
       
  4470   }
       
  4471 
       
  4472   // Some non-printable keys are reported in `charCode`/`keyCode`, discard them.
       
  4473   // Must not discard the (non-)printable Enter-key.
       
  4474   if (charCode >= 32 || charCode === 13) {
       
  4475     return charCode;
       
  4476   }
       
  4477 
       
  4478   return 0;
       
  4479 }
       
  4480 
       
  4481 /**
       
  4482  * Normalization of deprecated HTML5 `key` values
       
  4483  * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names
       
  4484  */
       
  4485 var normalizeKey = {
       
  4486   Esc: 'Escape',
       
  4487   Spacebar: ' ',
       
  4488   Left: 'ArrowLeft',
       
  4489   Up: 'ArrowUp',
       
  4490   Right: 'ArrowRight',
       
  4491   Down: 'ArrowDown',
       
  4492   Del: 'Delete',
       
  4493   Win: 'OS',
       
  4494   Menu: 'ContextMenu',
       
  4495   Apps: 'ContextMenu',
       
  4496   Scroll: 'ScrollLock',
       
  4497   MozPrintableKey: 'Unidentified'
       
  4498 };
       
  4499 
       
  4500 /**
       
  4501  * Translation from legacy `keyCode` to HTML5 `key`
       
  4502  * Only special keys supported, all others depend on keyboard layout or browser
       
  4503  * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names
       
  4504  */
       
  4505 var translateToKey = {
       
  4506   '8': 'Backspace',
       
  4507   '9': 'Tab',
       
  4508   '12': 'Clear',
       
  4509   '13': 'Enter',
       
  4510   '16': 'Shift',
       
  4511   '17': 'Control',
       
  4512   '18': 'Alt',
       
  4513   '19': 'Pause',
       
  4514   '20': 'CapsLock',
       
  4515   '27': 'Escape',
       
  4516   '32': ' ',
       
  4517   '33': 'PageUp',
       
  4518   '34': 'PageDown',
       
  4519   '35': 'End',
       
  4520   '36': 'Home',
       
  4521   '37': 'ArrowLeft',
       
  4522   '38': 'ArrowUp',
       
  4523   '39': 'ArrowRight',
       
  4524   '40': 'ArrowDown',
       
  4525   '45': 'Insert',
       
  4526   '46': 'Delete',
       
  4527   '112': 'F1',
       
  4528   '113': 'F2',
       
  4529   '114': 'F3',
       
  4530   '115': 'F4',
       
  4531   '116': 'F5',
       
  4532   '117': 'F6',
       
  4533   '118': 'F7',
       
  4534   '119': 'F8',
       
  4535   '120': 'F9',
       
  4536   '121': 'F10',
       
  4537   '122': 'F11',
       
  4538   '123': 'F12',
       
  4539   '144': 'NumLock',
       
  4540   '145': 'ScrollLock',
       
  4541   '224': 'Meta'
       
  4542 };
       
  4543 
       
  4544 /**
       
  4545  * @param {object} nativeEvent Native browser event.
       
  4546  * @return {string} Normalized `key` property.
       
  4547  */
       
  4548 function getEventKey(nativeEvent) {
       
  4549   if (nativeEvent.key) {
       
  4550     // Normalize inconsistent values reported by browsers due to
       
  4551     // implementations of a working draft specification.
       
  4552 
       
  4553     // FireFox implements `key` but returns `MozPrintableKey` for all
       
  4554     // printable characters (normalized to `Unidentified`), ignore it.
       
  4555     var key = normalizeKey[nativeEvent.key] || nativeEvent.key;
       
  4556     if (key !== 'Unidentified') {
       
  4557       return key;
       
  4558     }
       
  4559   }
       
  4560 
       
  4561   // Browser does not implement `key`, polyfill as much of it as we can.
       
  4562   if (nativeEvent.type === 'keypress') {
       
  4563     var charCode = getEventCharCode(nativeEvent);
       
  4564 
       
  4565     // The enter-key is technically both printable and non-printable and can
       
  4566     // thus be captured by `keypress`, no other non-printable key should.
       
  4567     return charCode === 13 ? 'Enter' : String.fromCharCode(charCode);
       
  4568   }
       
  4569   if (nativeEvent.type === 'keydown' || nativeEvent.type === 'keyup') {
       
  4570     // While user keyboard layout determines the actual meaning of each
       
  4571     // `keyCode` value, almost all function keys have a universal value.
       
  4572     return translateToKey[nativeEvent.keyCode] || 'Unidentified';
       
  4573   }
       
  4574   return '';
       
  4575 }
       
  4576 
       
  4577 /**
       
  4578  * @interface KeyboardEvent
       
  4579  * @see http://www.w3.org/TR/DOM-Level-3-Events/
       
  4580  */
       
  4581 var SyntheticKeyboardEvent = SyntheticUIEvent.extend({
       
  4582   key: getEventKey,
       
  4583   location: null,
       
  4584   ctrlKey: null,
       
  4585   shiftKey: null,
       
  4586   altKey: null,
       
  4587   metaKey: null,
       
  4588   repeat: null,
       
  4589   locale: null,
       
  4590   getModifierState: getEventModifierState,
       
  4591   // Legacy Interface
       
  4592   charCode: function (event) {
       
  4593     // `charCode` is the result of a KeyPress event and represents the value of
       
  4594     // the actual printable character.
       
  4595 
       
  4596     // KeyPress is deprecated, but its replacement is not yet final and not
       
  4597     // implemented in any major browser. Only KeyPress has charCode.
       
  4598     if (event.type === 'keypress') {
       
  4599       return getEventCharCode(event);
       
  4600     }
       
  4601     return 0;
       
  4602   },
       
  4603   keyCode: function (event) {
       
  4604     // `keyCode` is the result of a KeyDown/Up event and represents the value of
       
  4605     // physical keyboard key.
       
  4606 
       
  4607     // The actual meaning of the value depends on the users' keyboard layout
       
  4608     // which cannot be detected. Assuming that it is a US keyboard layout
       
  4609     // provides a surprisingly accurate mapping for US and European users.
       
  4610     // Due to this, it is left to the user to implement at this time.
       
  4611     if (event.type === 'keydown' || event.type === 'keyup') {
       
  4612       return event.keyCode;
       
  4613     }
       
  4614     return 0;
       
  4615   },
       
  4616   which: function (event) {
       
  4617     // `which` is an alias for either `keyCode` or `charCode` depending on the
       
  4618     // type of the event.
       
  4619     if (event.type === 'keypress') {
       
  4620       return getEventCharCode(event);
       
  4621     }
       
  4622     if (event.type === 'keydown' || event.type === 'keyup') {
       
  4623       return event.keyCode;
       
  4624     }
       
  4625     return 0;
       
  4626   }
       
  4627 });
       
  4628 
       
  4629 /**
       
  4630  * @interface DragEvent
       
  4631  * @see http://www.w3.org/TR/DOM-Level-3-Events/
       
  4632  */
       
  4633 var SyntheticDragEvent = SyntheticMouseEvent.extend({
       
  4634   dataTransfer: null
       
  4635 });
       
  4636 
       
  4637 /**
       
  4638  * @interface TouchEvent
       
  4639  * @see http://www.w3.org/TR/touch-events/
       
  4640  */
       
  4641 var SyntheticTouchEvent = SyntheticUIEvent.extend({
       
  4642   touches: null,
       
  4643   targetTouches: null,
       
  4644   changedTouches: null,
       
  4645   altKey: null,
       
  4646   metaKey: null,
       
  4647   ctrlKey: null,
       
  4648   shiftKey: null,
       
  4649   getModifierState: getEventModifierState
       
  4650 });
       
  4651 
       
  4652 /**
       
  4653  * @interface Event
       
  4654  * @see http://www.w3.org/TR/2009/WD-css3-transitions-20090320/#transition-events-
       
  4655  * @see https://developer.mozilla.org/en-US/docs/Web/API/TransitionEvent
       
  4656  */
       
  4657 var SyntheticTransitionEvent = SyntheticEvent.extend({
       
  4658   propertyName: null,
       
  4659   elapsedTime: null,
       
  4660   pseudoElement: null
       
  4661 });
       
  4662 
       
  4663 /**
       
  4664  * @interface WheelEvent
       
  4665  * @see http://www.w3.org/TR/DOM-Level-3-Events/
       
  4666  */
       
  4667 var SyntheticWheelEvent = SyntheticMouseEvent.extend({
       
  4668   deltaX: function (event) {
       
  4669     return 'deltaX' in event ? event.deltaX : // Fallback to `wheelDeltaX` for Webkit and normalize (right is positive).
       
  4670     'wheelDeltaX' in event ? -event.wheelDeltaX : 0;
       
  4671   },
       
  4672   deltaY: function (event) {
       
  4673     return 'deltaY' in event ? event.deltaY : // Fallback to `wheelDeltaY` for Webkit and normalize (down is positive).
       
  4674     'wheelDeltaY' in event ? -event.wheelDeltaY : // Fallback to `wheelDelta` for IE<9 and normalize (down is positive).
       
  4675     'wheelDelta' in event ? -event.wheelDelta : 0;
       
  4676   },
       
  4677 
       
  4678   deltaZ: null,
       
  4679 
       
  4680   // Browsers without "deltaMode" is reporting in raw wheel delta where one
       
  4681   // notch on the scroll is always +/- 120, roughly equivalent to pixels.
       
  4682   // A good approximation of DOM_DELTA_LINE (1) is 5% of viewport size or
       
  4683   // ~40 pixels, for DOM_DELTA_SCREEN (2) it is 87.5% of viewport size.
       
  4684   deltaMode: null
       
  4685 });
       
  4686 
       
  4687 /**
       
  4688  * Turns
       
  4689  * ['abort', ...]
       
  4690  * into
       
  4691  * eventTypes = {
       
  4692  *   'abort': {
       
  4693  *     phasedRegistrationNames: {
       
  4694  *       bubbled: 'onAbort',
       
  4695  *       captured: 'onAbortCapture',
       
  4696  *     },
       
  4697  *     dependencies: [TOP_ABORT],
       
  4698  *   },
       
  4699  *   ...
       
  4700  * };
       
  4701  * topLevelEventsToDispatchConfig = new Map([
       
  4702  *   [TOP_ABORT, { sameConfig }],
       
  4703  * ]);
       
  4704  */
       
  4705 
       
  4706 var interactiveEventTypeNames = [[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']];
       
  4707 var nonInteractiveEventTypeNames = [[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_DRAG, 'drag'], [TOP_DRAG_ENTER, 'dragEnter'], [TOP_DRAG_EXIT, 'dragExit'], [TOP_DRAG_LEAVE, 'dragLeave'], [TOP_DRAG_OVER, 'dragOver'], [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_MOUSE_MOVE, 'mouseMove'], [TOP_MOUSE_OUT, 'mouseOut'], [TOP_MOUSE_OVER, 'mouseOver'], [TOP_PLAYING, 'playing'], [TOP_POINTER_MOVE, 'pointerMove'], [TOP_POINTER_OUT, 'pointerOut'], [TOP_POINTER_OVER, 'pointerOver'], [TOP_PROGRESS, 'progress'], [TOP_SCROLL, 'scroll'], [TOP_SEEKING, 'seeking'], [TOP_STALLED, 'stalled'], [TOP_SUSPEND, 'suspend'], [TOP_TIME_UPDATE, 'timeUpdate'], [TOP_TOGGLE, 'toggle'], [TOP_TOUCH_MOVE, 'touchMove'], [TOP_TRANSITION_END, 'transitionEnd'], [TOP_WAITING, 'waiting'], [TOP_WHEEL, 'wheel']];
       
  4708 
       
  4709 var eventTypes$4 = {};
       
  4710 var topLevelEventsToDispatchConfig = {};
       
  4711 
       
  4712 function addEventTypeNameToConfig(_ref, isInteractive) {
       
  4713   var topEvent = _ref[0],
       
  4714       event = _ref[1];
       
  4715 
       
  4716   var capitalizedEvent = event[0].toUpperCase() + event.slice(1);
       
  4717   var onEvent = 'on' + capitalizedEvent;
       
  4718 
       
  4719   var type = {
       
  4720     phasedRegistrationNames: {
       
  4721       bubbled: onEvent,
       
  4722       captured: onEvent + 'Capture'
       
  4723     },
       
  4724     dependencies: [topEvent],
       
  4725     isInteractive: isInteractive
       
  4726   };
       
  4727   eventTypes$4[event] = type;
       
  4728   topLevelEventsToDispatchConfig[topEvent] = type;
       
  4729 }
       
  4730 
       
  4731 interactiveEventTypeNames.forEach(function (eventTuple) {
       
  4732   addEventTypeNameToConfig(eventTuple, true);
       
  4733 });
       
  4734 nonInteractiveEventTypeNames.forEach(function (eventTuple) {
       
  4735   addEventTypeNameToConfig(eventTuple, false);
       
  4736 });
       
  4737 
       
  4738 // Only used in DEV for exhaustiveness validation.
       
  4739 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];
       
  4740 
       
  4741 var SimpleEventPlugin = {
       
  4742   eventTypes: eventTypes$4,
       
  4743 
       
  4744   isInteractiveTopLevelEventType: function (topLevelType) {
       
  4745     var config = topLevelEventsToDispatchConfig[topLevelType];
       
  4746     return config !== undefined && config.isInteractive === true;
       
  4747   },
       
  4748 
       
  4749 
       
  4750   extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
       
  4751     var dispatchConfig = topLevelEventsToDispatchConfig[topLevelType];
       
  4752     if (!dispatchConfig) {
       
  4753       return null;
       
  4754     }
       
  4755     var EventConstructor = void 0;
       
  4756     switch (topLevelType) {
       
  4757       case TOP_KEY_PRESS:
       
  4758         // Firefox creates a keypress event for function keys too. This removes
       
  4759         // the unwanted keypress events. Enter is however both printable and
       
  4760         // non-printable. One would expect Tab to be as well (but it isn't).
       
  4761         if (getEventCharCode(nativeEvent) === 0) {
       
  4762           return null;
       
  4763         }
       
  4764       /* falls through */
       
  4765       case TOP_KEY_DOWN:
       
  4766       case TOP_KEY_UP:
       
  4767         EventConstructor = SyntheticKeyboardEvent;
       
  4768         break;
       
  4769       case TOP_BLUR:
       
  4770       case TOP_FOCUS:
       
  4771         EventConstructor = SyntheticFocusEvent;
       
  4772         break;
       
  4773       case TOP_CLICK:
       
  4774         // Firefox creates a click event on right mouse clicks. This removes the
       
  4775         // unwanted click events.
       
  4776         if (nativeEvent.button === 2) {
       
  4777           return null;
       
  4778         }
       
  4779       /* falls through */
       
  4780       case TOP_AUX_CLICK:
       
  4781       case TOP_DOUBLE_CLICK:
       
  4782       case TOP_MOUSE_DOWN:
       
  4783       case TOP_MOUSE_MOVE:
       
  4784       case TOP_MOUSE_UP:
       
  4785       // TODO: Disabled elements should not respond to mouse events
       
  4786       /* falls through */
       
  4787       case TOP_MOUSE_OUT:
       
  4788       case TOP_MOUSE_OVER:
       
  4789       case TOP_CONTEXT_MENU:
       
  4790         EventConstructor = SyntheticMouseEvent;
       
  4791         break;
       
  4792       case TOP_DRAG:
       
  4793       case TOP_DRAG_END:
       
  4794       case TOP_DRAG_ENTER:
       
  4795       case TOP_DRAG_EXIT:
       
  4796       case TOP_DRAG_LEAVE:
       
  4797       case TOP_DRAG_OVER:
       
  4798       case TOP_DRAG_START:
       
  4799       case TOP_DROP:
       
  4800         EventConstructor = SyntheticDragEvent;
       
  4801         break;
       
  4802       case TOP_TOUCH_CANCEL:
       
  4803       case TOP_TOUCH_END:
       
  4804       case TOP_TOUCH_MOVE:
       
  4805       case TOP_TOUCH_START:
       
  4806         EventConstructor = SyntheticTouchEvent;
       
  4807         break;
       
  4808       case TOP_ANIMATION_END:
       
  4809       case TOP_ANIMATION_ITERATION:
       
  4810       case TOP_ANIMATION_START:
       
  4811         EventConstructor = SyntheticAnimationEvent;
       
  4812         break;
       
  4813       case TOP_TRANSITION_END:
       
  4814         EventConstructor = SyntheticTransitionEvent;
       
  4815         break;
       
  4816       case TOP_SCROLL:
       
  4817         EventConstructor = SyntheticUIEvent;
       
  4818         break;
       
  4819       case TOP_WHEEL:
       
  4820         EventConstructor = SyntheticWheelEvent;
       
  4821         break;
       
  4822       case TOP_COPY:
       
  4823       case TOP_CUT:
       
  4824       case TOP_PASTE:
       
  4825         EventConstructor = SyntheticClipboardEvent;
       
  4826         break;
       
  4827       case TOP_GOT_POINTER_CAPTURE:
       
  4828       case TOP_LOST_POINTER_CAPTURE:
       
  4829       case TOP_POINTER_CANCEL:
       
  4830       case TOP_POINTER_DOWN:
       
  4831       case TOP_POINTER_MOVE:
       
  4832       case TOP_POINTER_OUT:
       
  4833       case TOP_POINTER_OVER:
       
  4834       case TOP_POINTER_UP:
       
  4835         EventConstructor = SyntheticPointerEvent;
       
  4836         break;
       
  4837       default:
       
  4838         {
       
  4839           if (knownHTMLTopLevelTypes.indexOf(topLevelType) === -1) {
       
  4840             warningWithoutStack$1(false, 'SimpleEventPlugin: Unhandled event type, `%s`. This warning ' + 'is likely caused by a bug in React. Please file an issue.', topLevelType);
       
  4841           }
       
  4842         }
       
  4843         // HTML Events
       
  4844         // @see http://www.w3.org/TR/html5/index.html#events-0
       
  4845         EventConstructor = SyntheticEvent;
       
  4846         break;
       
  4847     }
       
  4848     var event = EventConstructor.getPooled(dispatchConfig, targetInst, nativeEvent, nativeEventTarget);
       
  4849     accumulateTwoPhaseDispatches(event);
       
  4850     return event;
       
  4851   }
       
  4852 };
       
  4853 
       
  4854 var isInteractiveTopLevelEventType = SimpleEventPlugin.isInteractiveTopLevelEventType;
       
  4855 
       
  4856 
       
  4857 var CALLBACK_BOOKKEEPING_POOL_SIZE = 10;
       
  4858 var callbackBookkeepingPool = [];
       
  4859 
       
  4860 /**
       
  4861  * Find the deepest React component completely containing the root of the
       
  4862  * passed-in instance (for use when entire React trees are nested within each
       
  4863  * other). If React trees are not nested, returns null.
       
  4864  */
       
  4865 function findRootContainerNode(inst) {
       
  4866   // TODO: It may be a good idea to cache this to prevent unnecessary DOM
       
  4867   // traversal, but caching is difficult to do correctly without using a
       
  4868   // mutation observer to listen for all DOM changes.
       
  4869   while (inst.return) {
       
  4870     inst = inst.return;
       
  4871   }
       
  4872   if (inst.tag !== HostRoot) {
       
  4873     // This can happen if we're in a detached tree.
       
  4874     return null;
       
  4875   }
       
  4876   return inst.stateNode.containerInfo;
       
  4877 }
       
  4878 
       
  4879 // Used to store ancestor hierarchy in top level callback
       
  4880 function getTopLevelCallbackBookKeeping(topLevelType, nativeEvent, targetInst) {
       
  4881   if (callbackBookkeepingPool.length) {
       
  4882     var instance = callbackBookkeepingPool.pop();
       
  4883     instance.topLevelType = topLevelType;
       
  4884     instance.nativeEvent = nativeEvent;
       
  4885     instance.targetInst = targetInst;
       
  4886     return instance;
       
  4887   }
       
  4888   return {
       
  4889     topLevelType: topLevelType,
       
  4890     nativeEvent: nativeEvent,
       
  4891     targetInst: targetInst,
       
  4892     ancestors: []
       
  4893   };
       
  4894 }
       
  4895 
       
  4896 function releaseTopLevelCallbackBookKeeping(instance) {
       
  4897   instance.topLevelType = null;
       
  4898   instance.nativeEvent = null;
       
  4899   instance.targetInst = null;
       
  4900   instance.ancestors.length = 0;
       
  4901   if (callbackBookkeepingPool.length < CALLBACK_BOOKKEEPING_POOL_SIZE) {
       
  4902     callbackBookkeepingPool.push(instance);
       
  4903   }
       
  4904 }
       
  4905 
       
  4906 function handleTopLevel(bookKeeping) {
       
  4907   var targetInst = bookKeeping.targetInst;
       
  4908 
       
  4909   // Loop through the hierarchy, in case there's any nested components.
       
  4910   // It's important that we build the array of ancestors before calling any
       
  4911   // event handlers, because event handlers can modify the DOM, leading to
       
  4912   // inconsistencies with ReactMount's node cache. See #1105.
       
  4913   var ancestor = targetInst;
       
  4914   do {
       
  4915     if (!ancestor) {
       
  4916       bookKeeping.ancestors.push(ancestor);
       
  4917       break;
       
  4918     }
       
  4919     var root = findRootContainerNode(ancestor);
       
  4920     if (!root) {
       
  4921       break;
       
  4922     }
       
  4923     bookKeeping.ancestors.push(ancestor);
       
  4924     ancestor = getClosestInstanceFromNode(root);
       
  4925   } while (ancestor);
       
  4926 
       
  4927   for (var i = 0; i < bookKeeping.ancestors.length; i++) {
       
  4928     targetInst = bookKeeping.ancestors[i];
       
  4929     runExtractedEventsInBatch(bookKeeping.topLevelType, targetInst, bookKeeping.nativeEvent, getEventTarget(bookKeeping.nativeEvent));
       
  4930   }
       
  4931 }
       
  4932 
       
  4933 // TODO: can we stop exporting these?
       
  4934 var _enabled = true;
       
  4935 
       
  4936 function setEnabled(enabled) {
       
  4937   _enabled = !!enabled;
       
  4938 }
       
  4939 
       
  4940 function isEnabled() {
       
  4941   return _enabled;
       
  4942 }
       
  4943 
       
  4944 /**
       
  4945  * Traps top-level events by using event bubbling.
       
  4946  *
       
  4947  * @param {number} topLevelType Number from `TopLevelEventTypes`.
       
  4948  * @param {object} element Element on which to attach listener.
       
  4949  * @return {?object} An object with a remove function which will forcefully
       
  4950  *                  remove the listener.
       
  4951  * @internal
       
  4952  */
       
  4953 function trapBubbledEvent(topLevelType, element) {
       
  4954   if (!element) {
       
  4955     return null;
       
  4956   }
       
  4957   var dispatch = isInteractiveTopLevelEventType(topLevelType) ? dispatchInteractiveEvent : dispatchEvent;
       
  4958 
       
  4959   addEventBubbleListener(element, getRawEventName(topLevelType),
       
  4960   // Check if interactive and wrap in interactiveUpdates
       
  4961   dispatch.bind(null, topLevelType));
       
  4962 }
       
  4963 
       
  4964 /**
       
  4965  * Traps a top-level event by using event capturing.
       
  4966  *
       
  4967  * @param {number} topLevelType Number from `TopLevelEventTypes`.
       
  4968  * @param {object} element Element on which to attach listener.
       
  4969  * @return {?object} An object with a remove function which will forcefully
       
  4970  *                  remove the listener.
       
  4971  * @internal
       
  4972  */
       
  4973 function trapCapturedEvent(topLevelType, element) {
       
  4974   if (!element) {
       
  4975     return null;
       
  4976   }
       
  4977   var dispatch = isInteractiveTopLevelEventType(topLevelType) ? dispatchInteractiveEvent : dispatchEvent;
       
  4978 
       
  4979   addEventCaptureListener(element, getRawEventName(topLevelType),
       
  4980   // Check if interactive and wrap in interactiveUpdates
       
  4981   dispatch.bind(null, topLevelType));
       
  4982 }
       
  4983 
       
  4984 function dispatchInteractiveEvent(topLevelType, nativeEvent) {
       
  4985   interactiveUpdates(dispatchEvent, topLevelType, nativeEvent);
       
  4986 }
       
  4987 
       
  4988 function dispatchEvent(topLevelType, nativeEvent) {
       
  4989   if (!_enabled) {
       
  4990     return;
       
  4991   }
       
  4992 
       
  4993   var nativeEventTarget = getEventTarget(nativeEvent);
       
  4994   var targetInst = getClosestInstanceFromNode(nativeEventTarget);
       
  4995   if (targetInst !== null && typeof targetInst.tag === 'number' && !isFiberMounted(targetInst)) {
       
  4996     // If we get an event (ex: img onload) before committing that
       
  4997     // component's mount, ignore it for now (that is, treat it as if it was an
       
  4998     // event on a non-React tree). We might also consider queueing events and
       
  4999     // dispatching them after the mount.
       
  5000     targetInst = null;
       
  5001   }
       
  5002 
       
  5003   var bookKeeping = getTopLevelCallbackBookKeeping(topLevelType, nativeEvent, targetInst);
       
  5004 
       
  5005   try {
       
  5006     // Event queue being processed in the same cycle allows
       
  5007     // `preventDefault`.
       
  5008     batchedUpdates(handleTopLevel, bookKeeping);
       
  5009   } finally {
       
  5010     releaseTopLevelCallbackBookKeeping(bookKeeping);
       
  5011   }
       
  5012 }
       
  5013 
       
  5014 /**
       
  5015  * Summary of `ReactBrowserEventEmitter` event handling:
       
  5016  *
       
  5017  *  - Top-level delegation is used to trap most native browser events. This
       
  5018  *    may only occur in the main thread and is the responsibility of
       
  5019  *    ReactDOMEventListener, which is injected and can therefore support
       
  5020  *    pluggable event sources. This is the only work that occurs in the main
       
  5021  *    thread.
       
  5022  *
       
  5023  *  - We normalize and de-duplicate events to account for browser quirks. This
       
  5024  *    may be done in the worker thread.
       
  5025  *
       
  5026  *  - Forward these native events (with the associated top-level type used to
       
  5027  *    trap it) to `EventPluginHub`, which in turn will ask plugins if they want
       
  5028  *    to extract any synthetic events.
       
  5029  *
       
  5030  *  - The `EventPluginHub` will then process each event by annotating them with
       
  5031  *    "dispatches", a sequence of listeners and IDs that care about that event.
       
  5032  *
       
  5033  *  - The `EventPluginHub` then dispatches the events.
       
  5034  *
       
  5035  * Overview of React and the event system:
       
  5036  *
       
  5037  * +------------+    .
       
  5038  * |    DOM     |    .
       
  5039  * +------------+    .
       
  5040  *       |           .
       
  5041  *       v           .
       
  5042  * +------------+    .
       
  5043  * | ReactEvent |    .
       
  5044  * |  Listener  |    .
       
  5045  * +------------+    .                         +-----------+
       
  5046  *       |           .               +--------+|SimpleEvent|
       
  5047  *       |           .               |         |Plugin     |
       
  5048  * +-----|------+    .               v         +-----------+
       
  5049  * |     |      |    .    +--------------+                    +------------+
       
  5050  * |     +-----------.--->|EventPluginHub|                    |    Event   |
       
  5051  * |            |    .    |              |     +-----------+  | Propagators|
       
  5052  * | ReactEvent |    .    |              |     |TapEvent   |  |------------|
       
  5053  * |  Emitter   |    .    |              |<---+|Plugin     |  |other plugin|
       
  5054  * |            |    .    |              |     +-----------+  |  utilities |
       
  5055  * |     +-----------.--->|              |                    +------------+
       
  5056  * |     |      |    .    +--------------+
       
  5057  * +-----|------+    .                ^        +-----------+
       
  5058  *       |           .                |        |Enter/Leave|
       
  5059  *       +           .                +-------+|Plugin     |
       
  5060  * +-------------+   .                         +-----------+
       
  5061  * | application |   .
       
  5062  * |-------------|   .
       
  5063  * |             |   .
       
  5064  * |             |   .
       
  5065  * +-------------+   .
       
  5066  *                   .
       
  5067  *    React Core     .  General Purpose Event Plugin System
       
  5068  */
       
  5069 
       
  5070 var alreadyListeningTo = {};
       
  5071 var reactTopListenersCounter = 0;
       
  5072 
       
  5073 /**
       
  5074  * To ensure no conflicts with other potential React instances on the page
       
  5075  */
       
  5076 var topListenersIDKey = '_reactListenersID' + ('' + Math.random()).slice(2);
       
  5077 
       
  5078 function getListeningForDocument(mountAt) {
       
  5079   // In IE8, `mountAt` is a host object and doesn't have `hasOwnProperty`
       
  5080   // directly.
       
  5081   if (!Object.prototype.hasOwnProperty.call(mountAt, topListenersIDKey)) {
       
  5082     mountAt[topListenersIDKey] = reactTopListenersCounter++;
       
  5083     alreadyListeningTo[mountAt[topListenersIDKey]] = {};
       
  5084   }
       
  5085   return alreadyListeningTo[mountAt[topListenersIDKey]];
       
  5086 }
       
  5087 
       
  5088 /**
       
  5089  * We listen for bubbled touch events on the document object.
       
  5090  *
       
  5091  * Firefox v8.01 (and possibly others) exhibited strange behavior when
       
  5092  * mounting `onmousemove` events at some node that was not the document
       
  5093  * element. The symptoms were that if your mouse is not moving over something
       
  5094  * contained within that mount point (for example on the background) the
       
  5095  * top-level listeners for `onmousemove` won't be called. However, if you
       
  5096  * register the `mousemove` on the document object, then it will of course
       
  5097  * catch all `mousemove`s. This along with iOS quirks, justifies restricting
       
  5098  * top-level listeners to the document object only, at least for these
       
  5099  * movement types of events and possibly all events.
       
  5100  *
       
  5101  * @see http://www.quirksmode.org/blog/archives/2010/09/click_event_del.html
       
  5102  *
       
  5103  * Also, `keyup`/`keypress`/`keydown` do not bubble to the window on IE, but
       
  5104  * they bubble to document.
       
  5105  *
       
  5106  * @param {string} registrationName Name of listener (e.g. `onClick`).
       
  5107  * @param {object} mountAt Container where to mount the listener
       
  5108  */
       
  5109 function listenTo(registrationName, mountAt) {
       
  5110   var isListening = getListeningForDocument(mountAt);
       
  5111   var dependencies = registrationNameDependencies[registrationName];
       
  5112 
       
  5113   for (var i = 0; i < dependencies.length; i++) {
       
  5114     var dependency = dependencies[i];
       
  5115     if (!(isListening.hasOwnProperty(dependency) && isListening[dependency])) {
       
  5116       switch (dependency) {
       
  5117         case TOP_SCROLL:
       
  5118           trapCapturedEvent(TOP_SCROLL, mountAt);
       
  5119           break;
       
  5120         case TOP_FOCUS:
       
  5121         case TOP_BLUR:
       
  5122           trapCapturedEvent(TOP_FOCUS, mountAt);
       
  5123           trapCapturedEvent(TOP_BLUR, mountAt);
       
  5124           // We set the flag for a single dependency later in this function,
       
  5125           // but this ensures we mark both as attached rather than just one.
       
  5126           isListening[TOP_BLUR] = true;
       
  5127           isListening[TOP_FOCUS] = true;
       
  5128           break;
       
  5129         case TOP_CANCEL:
       
  5130         case TOP_CLOSE:
       
  5131           if (isEventSupported(getRawEventName(dependency))) {
       
  5132             trapCapturedEvent(dependency, mountAt);
       
  5133           }
       
  5134           break;
       
  5135         case TOP_INVALID:
       
  5136         case TOP_SUBMIT:
       
  5137         case TOP_RESET:
       
  5138           // We listen to them on the target DOM elements.
       
  5139           // Some of them bubble so we don't want them to fire twice.
       
  5140           break;
       
  5141         default:
       
  5142           // By default, listen on the top level to all non-media events.
       
  5143           // Media events don't bubble so adding the listener wouldn't do anything.
       
  5144           var isMediaEvent = mediaEventTypes.indexOf(dependency) !== -1;
       
  5145           if (!isMediaEvent) {
       
  5146             trapBubbledEvent(dependency, mountAt);
       
  5147           }
       
  5148           break;
       
  5149       }
       
  5150       isListening[dependency] = true;
       
  5151     }
       
  5152   }
       
  5153 }
       
  5154 
       
  5155 function isListeningToAllDependencies(registrationName, mountAt) {
       
  5156   var isListening = getListeningForDocument(mountAt);
       
  5157   var dependencies = registrationNameDependencies[registrationName];
       
  5158   for (var i = 0; i < dependencies.length; i++) {
       
  5159     var dependency = dependencies[i];
       
  5160     if (!(isListening.hasOwnProperty(dependency) && isListening[dependency])) {
       
  5161       return false;
       
  5162     }
       
  5163   }
       
  5164   return true;
       
  5165 }
       
  5166 
       
  5167 function getActiveElement(doc) {
       
  5168   doc = doc || (typeof document !== 'undefined' ? document : undefined);
       
  5169   if (typeof doc === 'undefined') {
       
  5170     return null;
       
  5171   }
       
  5172   try {
       
  5173     return doc.activeElement || doc.body;
       
  5174   } catch (e) {
       
  5175     return doc.body;
       
  5176   }
       
  5177 }
       
  5178 
       
  5179 /**
       
  5180  * Given any node return the first leaf node without children.
       
  5181  *
       
  5182  * @param {DOMElement|DOMTextNode} node
       
  5183  * @return {DOMElement|DOMTextNode}
       
  5184  */
       
  5185 function getLeafNode(node) {
       
  5186   while (node && node.firstChild) {
       
  5187     node = node.firstChild;
       
  5188   }
       
  5189   return node;
       
  5190 }
       
  5191 
       
  5192 /**
       
  5193  * Get the next sibling within a container. This will walk up the
       
  5194  * DOM if a node's siblings have been exhausted.
       
  5195  *
       
  5196  * @param {DOMElement|DOMTextNode} node
       
  5197  * @return {?DOMElement|DOMTextNode}
       
  5198  */
       
  5199 function getSiblingNode(node) {
       
  5200   while (node) {
       
  5201     if (node.nextSibling) {
       
  5202       return node.nextSibling;
       
  5203     }
       
  5204     node = node.parentNode;
       
  5205   }
       
  5206 }
       
  5207 
       
  5208 /**
       
  5209  * Get object describing the nodes which contain characters at offset.
       
  5210  *
       
  5211  * @param {DOMElement|DOMTextNode} root
       
  5212  * @param {number} offset
       
  5213  * @return {?object}
       
  5214  */
       
  5215 function getNodeForCharacterOffset(root, offset) {
       
  5216   var node = getLeafNode(root);
       
  5217   var nodeStart = 0;
       
  5218   var nodeEnd = 0;
       
  5219 
       
  5220   while (node) {
       
  5221     if (node.nodeType === TEXT_NODE) {
       
  5222       nodeEnd = nodeStart + node.textContent.length;
       
  5223 
       
  5224       if (nodeStart <= offset && nodeEnd >= offset) {
       
  5225         return {
       
  5226           node: node,
       
  5227           offset: offset - nodeStart
       
  5228         };
       
  5229       }
       
  5230 
       
  5231       nodeStart = nodeEnd;
       
  5232     }
       
  5233 
       
  5234     node = getLeafNode(getSiblingNode(node));
       
  5235   }
       
  5236 }
       
  5237 
       
  5238 /**
       
  5239  * @param {DOMElement} outerNode
       
  5240  * @return {?object}
       
  5241  */
       
  5242 function getOffsets(outerNode) {
       
  5243   var ownerDocument = outerNode.ownerDocument;
       
  5244 
       
  5245   var win = ownerDocument && ownerDocument.defaultView || window;
       
  5246   var selection = win.getSelection && win.getSelection();
       
  5247 
       
  5248   if (!selection || selection.rangeCount === 0) {
       
  5249     return null;
       
  5250   }
       
  5251 
       
  5252   var anchorNode = selection.anchorNode,
       
  5253       anchorOffset = selection.anchorOffset,
       
  5254       focusNode = selection.focusNode,
       
  5255       focusOffset = selection.focusOffset;
       
  5256 
       
  5257   // In Firefox, anchorNode and focusNode can be "anonymous divs", e.g. the
       
  5258   // up/down buttons on an <input type="number">. Anonymous divs do not seem to
       
  5259   // expose properties, triggering a "Permission denied error" if any of its
       
  5260   // properties are accessed. The only seemingly possible way to avoid erroring
       
  5261   // is to access a property that typically works for non-anonymous divs and
       
  5262   // catch any error that may otherwise arise. See
       
  5263   // https://bugzilla.mozilla.org/show_bug.cgi?id=208427
       
  5264 
       
  5265   try {
       
  5266     /* eslint-disable no-unused-expressions */
       
  5267     anchorNode.nodeType;
       
  5268     focusNode.nodeType;
       
  5269     /* eslint-enable no-unused-expressions */
       
  5270   } catch (e) {
       
  5271     return null;
       
  5272   }
       
  5273 
       
  5274   return getModernOffsetsFromPoints(outerNode, anchorNode, anchorOffset, focusNode, focusOffset);
       
  5275 }
       
  5276 
       
  5277 /**
       
  5278  * Returns {start, end} where `start` is the character/codepoint index of
       
  5279  * (anchorNode, anchorOffset) within the textContent of `outerNode`, and
       
  5280  * `end` is the index of (focusNode, focusOffset).
       
  5281  *
       
  5282  * Returns null if you pass in garbage input but we should probably just crash.
       
  5283  *
       
  5284  * Exported only for testing.
       
  5285  */
       
  5286 function getModernOffsetsFromPoints(outerNode, anchorNode, anchorOffset, focusNode, focusOffset) {
       
  5287   var length = 0;
       
  5288   var start = -1;
       
  5289   var end = -1;
       
  5290   var indexWithinAnchor = 0;
       
  5291   var indexWithinFocus = 0;
       
  5292   var node = outerNode;
       
  5293   var parentNode = null;
       
  5294 
       
  5295   outer: while (true) {
       
  5296     var next = null;
       
  5297 
       
  5298     while (true) {
       
  5299       if (node === anchorNode && (anchorOffset === 0 || node.nodeType === TEXT_NODE)) {
       
  5300         start = length + anchorOffset;
       
  5301       }
       
  5302       if (node === focusNode && (focusOffset === 0 || node.nodeType === TEXT_NODE)) {
       
  5303         end = length + focusOffset;
       
  5304       }
       
  5305 
       
  5306       if (node.nodeType === TEXT_NODE) {
       
  5307         length += node.nodeValue.length;
       
  5308       }
       
  5309 
       
  5310       if ((next = node.firstChild) === null) {
       
  5311         break;
       
  5312       }
       
  5313       // Moving from `node` to its first child `next`.
       
  5314       parentNode = node;
       
  5315       node = next;
       
  5316     }
       
  5317 
       
  5318     while (true) {
       
  5319       if (node === outerNode) {
       
  5320         // If `outerNode` has children, this is always the second time visiting
       
  5321         // it. If it has no children, this is still the first loop, and the only
       
  5322         // valid selection is anchorNode and focusNode both equal to this node
       
  5323         // and both offsets 0, in which case we will have handled above.
       
  5324         break outer;
       
  5325       }
       
  5326       if (parentNode === anchorNode && ++indexWithinAnchor === anchorOffset) {
       
  5327         start = length;
       
  5328       }
       
  5329       if (parentNode === focusNode && ++indexWithinFocus === focusOffset) {
       
  5330         end = length;
       
  5331       }
       
  5332       if ((next = node.nextSibling) !== null) {
       
  5333         break;
       
  5334       }
       
  5335       node = parentNode;
       
  5336       parentNode = node.parentNode;
       
  5337     }
       
  5338 
       
  5339     // Moving from `node` to its next sibling `next`.
       
  5340     node = next;
       
  5341   }
       
  5342 
       
  5343   if (start === -1 || end === -1) {
       
  5344     // This should never happen. (Would happen if the anchor/focus nodes aren't
       
  5345     // actually inside the passed-in node.)
       
  5346     return null;
       
  5347   }
       
  5348 
       
  5349   return {
       
  5350     start: start,
       
  5351     end: end
       
  5352   };
       
  5353 }
       
  5354 
       
  5355 /**
       
  5356  * In modern non-IE browsers, we can support both forward and backward
       
  5357  * selections.
       
  5358  *
       
  5359  * Note: IE10+ supports the Selection object, but it does not support
       
  5360  * the `extend` method, which means that even in modern IE, it's not possible
       
  5361  * to programmatically create a backward selection. Thus, for all IE
       
  5362  * versions, we use the old IE API to create our selections.
       
  5363  *
       
  5364  * @param {DOMElement|DOMTextNode} node
       
  5365  * @param {object} offsets
       
  5366  */
       
  5367 function setOffsets(node, offsets) {
       
  5368   var doc = node.ownerDocument || document;
       
  5369   var win = doc && doc.defaultView || window;
       
  5370 
       
  5371   // Edge fails with "Object expected" in some scenarios.
       
  5372   // (For instance: TinyMCE editor used in a list component that supports pasting to add more,
       
  5373   // fails when pasting 100+ items)
       
  5374   if (!win.getSelection) {
       
  5375     return;
       
  5376   }
       
  5377 
       
  5378   var selection = win.getSelection();
       
  5379   var length = node.textContent.length;
       
  5380   var start = Math.min(offsets.start, length);
       
  5381   var end = offsets.end === undefined ? start : Math.min(offsets.end, length);
       
  5382 
       
  5383   // IE 11 uses modern selection, but doesn't support the extend method.
       
  5384   // Flip backward selections, so we can set with a single range.
       
  5385   if (!selection.extend && start > end) {
       
  5386     var temp = end;
       
  5387     end = start;
       
  5388     start = temp;
       
  5389   }
       
  5390 
       
  5391   var startMarker = getNodeForCharacterOffset(node, start);
       
  5392   var endMarker = getNodeForCharacterOffset(node, end);
       
  5393 
       
  5394   if (startMarker && endMarker) {
       
  5395     if (selection.rangeCount === 1 && selection.anchorNode === startMarker.node && selection.anchorOffset === startMarker.offset && selection.focusNode === endMarker.node && selection.focusOffset === endMarker.offset) {
       
  5396       return;
       
  5397     }
       
  5398     var range = doc.createRange();
       
  5399     range.setStart(startMarker.node, startMarker.offset);
       
  5400     selection.removeAllRanges();
       
  5401 
       
  5402     if (start > end) {
       
  5403       selection.addRange(range);
       
  5404       selection.extend(endMarker.node, endMarker.offset);
       
  5405     } else {
       
  5406       range.setEnd(endMarker.node, endMarker.offset);
       
  5407       selection.addRange(range);
       
  5408     }
       
  5409   }
       
  5410 }
       
  5411 
       
  5412 function isTextNode(node) {
       
  5413   return node && node.nodeType === TEXT_NODE;
       
  5414 }
       
  5415 
       
  5416 function containsNode(outerNode, innerNode) {
       
  5417   if (!outerNode || !innerNode) {
       
  5418     return false;
       
  5419   } else if (outerNode === innerNode) {
       
  5420     return true;
       
  5421   } else if (isTextNode(outerNode)) {
       
  5422     return false;
       
  5423   } else if (isTextNode(innerNode)) {
       
  5424     return containsNode(outerNode, innerNode.parentNode);
       
  5425   } else if ('contains' in outerNode) {
       
  5426     return outerNode.contains(innerNode);
       
  5427   } else if (outerNode.compareDocumentPosition) {
       
  5428     return !!(outerNode.compareDocumentPosition(innerNode) & 16);
       
  5429   } else {
       
  5430     return false;
       
  5431   }
       
  5432 }
       
  5433 
       
  5434 function isInDocument(node) {
       
  5435   return node && node.ownerDocument && containsNode(node.ownerDocument.documentElement, node);
       
  5436 }
       
  5437 
       
  5438 function getActiveElementDeep() {
       
  5439   var win = window;
       
  5440   var element = getActiveElement();
       
  5441   while (element instanceof win.HTMLIFrameElement) {
       
  5442     // Accessing the contentDocument of a HTMLIframeElement can cause the browser
       
  5443     // to throw, e.g. if it has a cross-origin src attribute
       
  5444     try {
       
  5445       win = element.contentDocument.defaultView;
       
  5446     } catch (e) {
       
  5447       return element;
       
  5448     }
       
  5449     element = getActiveElement(win.document);
       
  5450   }
       
  5451   return element;
       
  5452 }
       
  5453 
       
  5454 /**
       
  5455  * @ReactInputSelection: React input selection module. Based on Selection.js,
       
  5456  * but modified to be suitable for react and has a couple of bug fixes (doesn't
       
  5457  * assume buttons have range selections allowed).
       
  5458  * Input selection module for React.
       
  5459  */
       
  5460 
       
  5461 /**
       
  5462  * @hasSelectionCapabilities: we get the element types that support selection
       
  5463  * from https://html.spec.whatwg.org/#do-not-apply, looking at `selectionStart`
       
  5464  * and `selectionEnd` rows.
       
  5465  */
       
  5466 function hasSelectionCapabilities(elem) {
       
  5467   var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase();
       
  5468   return nodeName && (nodeName === 'input' && (elem.type === 'text' || elem.type === 'search' || elem.type === 'tel' || elem.type === 'url' || elem.type === 'password') || nodeName === 'textarea' || elem.contentEditable === 'true');
       
  5469 }
       
  5470 
       
  5471 function getSelectionInformation() {
       
  5472   var focusedElem = getActiveElementDeep();
       
  5473   return {
       
  5474     focusedElem: focusedElem,
       
  5475     selectionRange: hasSelectionCapabilities(focusedElem) ? getSelection$1(focusedElem) : null
       
  5476   };
       
  5477 }
       
  5478 
       
  5479 /**
       
  5480  * @restoreSelection: If any selection information was potentially lost,
       
  5481  * restore it. This is useful when performing operations that could remove dom
       
  5482  * nodes and place them back in, resulting in focus being lost.
       
  5483  */
       
  5484 function restoreSelection(priorSelectionInformation) {
       
  5485   var curFocusedElem = getActiveElementDeep();
       
  5486   var priorFocusedElem = priorSelectionInformation.focusedElem;
       
  5487   var priorSelectionRange = priorSelectionInformation.selectionRange;
       
  5488   if (curFocusedElem !== priorFocusedElem && isInDocument(priorFocusedElem)) {
       
  5489     if (priorSelectionRange !== null && hasSelectionCapabilities(priorFocusedElem)) {
       
  5490       setSelection(priorFocusedElem, priorSelectionRange);
       
  5491     }
       
  5492 
       
  5493     // Focusing a node can change the scroll position, which is undesirable
       
  5494     var ancestors = [];
       
  5495     var ancestor = priorFocusedElem;
       
  5496     while (ancestor = ancestor.parentNode) {
       
  5497       if (ancestor.nodeType === ELEMENT_NODE) {
       
  5498         ancestors.push({
       
  5499           element: ancestor,
       
  5500           left: ancestor.scrollLeft,
       
  5501           top: ancestor.scrollTop
       
  5502         });
       
  5503       }
       
  5504     }
       
  5505 
       
  5506     if (typeof priorFocusedElem.focus === 'function') {
       
  5507       priorFocusedElem.focus();
       
  5508     }
       
  5509 
       
  5510     for (var i = 0; i < ancestors.length; i++) {
       
  5511       var info = ancestors[i];
       
  5512       info.element.scrollLeft = info.left;
       
  5513       info.element.scrollTop = info.top;
       
  5514     }
       
  5515   }
       
  5516 }
       
  5517 
       
  5518 /**
       
  5519  * @getSelection: Gets the selection bounds of a focused textarea, input or
       
  5520  * contentEditable node.
       
  5521  * -@input: Look up selection bounds of this input
       
  5522  * -@return {start: selectionStart, end: selectionEnd}
       
  5523  */
       
  5524 function getSelection$1(input) {
       
  5525   var selection = void 0;
       
  5526 
       
  5527   if ('selectionStart' in input) {
       
  5528     // Modern browser with input or textarea.
       
  5529     selection = {
       
  5530       start: input.selectionStart,
       
  5531       end: input.selectionEnd
       
  5532     };
       
  5533   } else {
       
  5534     // Content editable or old IE textarea.
       
  5535     selection = getOffsets(input);
       
  5536   }
       
  5537 
       
  5538   return selection || { start: 0, end: 0 };
       
  5539 }
       
  5540 
       
  5541 /**
       
  5542  * @setSelection: Sets the selection bounds of a textarea or input and focuses
       
  5543  * the input.
       
  5544  * -@input     Set selection bounds of this input or textarea
       
  5545  * -@offsets   Object of same form that is returned from get*
       
  5546  */
       
  5547 function setSelection(input, offsets) {
       
  5548   var start = offsets.start,
       
  5549       end = offsets.end;
       
  5550 
       
  5551   if (end === undefined) {
       
  5552     end = start;
       
  5553   }
       
  5554 
       
  5555   if ('selectionStart' in input) {
       
  5556     input.selectionStart = start;
       
  5557     input.selectionEnd = Math.min(end, input.value.length);
       
  5558   } else {
       
  5559     setOffsets(input, offsets);
       
  5560   }
       
  5561 }
       
  5562 
       
  5563 var skipSelectionChangeEvent = canUseDOM && 'documentMode' in document && document.documentMode <= 11;
       
  5564 
       
  5565 var eventTypes$3 = {
       
  5566   select: {
       
  5567     phasedRegistrationNames: {
       
  5568       bubbled: 'onSelect',
       
  5569       captured: 'onSelectCapture'
       
  5570     },
       
  5571     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]
       
  5572   }
       
  5573 };
       
  5574 
       
  5575 var activeElement$1 = null;
       
  5576 var activeElementInst$1 = null;
       
  5577 var lastSelection = null;
       
  5578 var mouseDown = false;
       
  5579 
       
  5580 /**
       
  5581  * Get an object which is a unique representation of the current selection.
       
  5582  *
       
  5583  * The return value will not be consistent across nodes or browsers, but
       
  5584  * two identical selections on the same node will return identical objects.
       
  5585  *
       
  5586  * @param {DOMElement} node
       
  5587  * @return {object}
       
  5588  */
       
  5589 function getSelection(node) {
       
  5590   if ('selectionStart' in node && hasSelectionCapabilities(node)) {
       
  5591     return {
       
  5592       start: node.selectionStart,
       
  5593       end: node.selectionEnd
       
  5594     };
       
  5595   } else {
       
  5596     var win = node.ownerDocument && node.ownerDocument.defaultView || window;
       
  5597     var selection = win.getSelection();
       
  5598     return {
       
  5599       anchorNode: selection.anchorNode,
       
  5600       anchorOffset: selection.anchorOffset,
       
  5601       focusNode: selection.focusNode,
       
  5602       focusOffset: selection.focusOffset
       
  5603     };
       
  5604   }
       
  5605 }
       
  5606 
       
  5607 /**
       
  5608  * Get document associated with the event target.
       
  5609  *
       
  5610  * @param {object} nativeEventTarget
       
  5611  * @return {Document}
       
  5612  */
       
  5613 function getEventTargetDocument(eventTarget) {
       
  5614   return eventTarget.window === eventTarget ? eventTarget.document : eventTarget.nodeType === DOCUMENT_NODE ? eventTarget : eventTarget.ownerDocument;
       
  5615 }
       
  5616 
       
  5617 /**
       
  5618  * Poll selection to see whether it's changed.
       
  5619  *
       
  5620  * @param {object} nativeEvent
       
  5621  * @param {object} nativeEventTarget
       
  5622  * @return {?SyntheticEvent}
       
  5623  */
       
  5624 function constructSelectEvent(nativeEvent, nativeEventTarget) {
       
  5625   // Ensure we have the right element, and that the user is not dragging a
       
  5626   // selection (this matches native `select` event behavior). In HTML5, select
       
  5627   // fires only on input and textarea thus if there's no focused element we
       
  5628   // won't dispatch.
       
  5629   var doc = getEventTargetDocument(nativeEventTarget);
       
  5630 
       
  5631   if (mouseDown || activeElement$1 == null || activeElement$1 !== getActiveElement(doc)) {
       
  5632     return null;
       
  5633   }
       
  5634 
       
  5635   // Only fire when selection has actually changed.
       
  5636   var currentSelection = getSelection(activeElement$1);
       
  5637   if (!lastSelection || !shallowEqual(lastSelection, currentSelection)) {
       
  5638     lastSelection = currentSelection;
       
  5639 
       
  5640     var syntheticEvent = SyntheticEvent.getPooled(eventTypes$3.select, activeElementInst$1, nativeEvent, nativeEventTarget);
       
  5641 
       
  5642     syntheticEvent.type = 'select';
       
  5643     syntheticEvent.target = activeElement$1;
       
  5644 
       
  5645     accumulateTwoPhaseDispatches(syntheticEvent);
       
  5646 
       
  5647     return syntheticEvent;
       
  5648   }
       
  5649 
       
  5650   return null;
       
  5651 }
       
  5652 
       
  5653 /**
       
  5654  * This plugin creates an `onSelect` event that normalizes select events
       
  5655  * across form elements.
       
  5656  *
       
  5657  * Supported elements are:
       
  5658  * - input (see `isTextInputElement`)
       
  5659  * - textarea
       
  5660  * - contentEditable
       
  5661  *
       
  5662  * This differs from native browser implementations in the following ways:
       
  5663  * - Fires on contentEditable fields as well as inputs.
       
  5664  * - Fires for collapsed selection.
       
  5665  * - Fires after user input.
       
  5666  */
       
  5667 var SelectEventPlugin = {
       
  5668   eventTypes: eventTypes$3,
       
  5669 
       
  5670   extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
       
  5671     var doc = getEventTargetDocument(nativeEventTarget);
       
  5672     // Track whether all listeners exists for this plugin. If none exist, we do
       
  5673     // not extract events. See #3639.
       
  5674     if (!doc || !isListeningToAllDependencies('onSelect', doc)) {
       
  5675       return null;
       
  5676     }
       
  5677 
       
  5678     var targetNode = targetInst ? getNodeFromInstance$1(targetInst) : window;
       
  5679 
       
  5680     switch (topLevelType) {
       
  5681       // Track the input node that has focus.
       
  5682       case TOP_FOCUS:
       
  5683         if (isTextInputElement(targetNode) || targetNode.contentEditable === 'true') {
       
  5684           activeElement$1 = targetNode;
       
  5685           activeElementInst$1 = targetInst;
       
  5686           lastSelection = null;
       
  5687         }
       
  5688         break;
       
  5689       case TOP_BLUR:
       
  5690         activeElement$1 = null;
       
  5691         activeElementInst$1 = null;
       
  5692         lastSelection = null;
       
  5693         break;
       
  5694       // Don't fire the event while the user is dragging. This matches the
       
  5695       // semantics of the native select event.
       
  5696       case TOP_MOUSE_DOWN:
       
  5697         mouseDown = true;
       
  5698         break;
       
  5699       case TOP_CONTEXT_MENU:
       
  5700       case TOP_MOUSE_UP:
       
  5701       case TOP_DRAG_END:
       
  5702         mouseDown = false;
       
  5703         return constructSelectEvent(nativeEvent, nativeEventTarget);
       
  5704       // Chrome and IE fire non-standard event when selection is changed (and
       
  5705       // sometimes when it hasn't). IE's event fires out of order with respect
       
  5706       // to key and input events on deletion, so we discard it.
       
  5707       //
       
  5708       // Firefox doesn't support selectionchange, so check selection status
       
  5709       // after each key entry. The selection changes after keydown and before
       
  5710       // keyup, but we check on keydown as well in the case of holding down a
       
  5711       // key, when multiple keydown events are fired but only one keyup is.
       
  5712       // This is also our approach for IE handling, for the reason above.
       
  5713       case TOP_SELECTION_CHANGE:
       
  5714         if (skipSelectionChangeEvent) {
       
  5715           break;
       
  5716         }
       
  5717       // falls through
       
  5718       case TOP_KEY_DOWN:
       
  5719       case TOP_KEY_UP:
       
  5720         return constructSelectEvent(nativeEvent, nativeEventTarget);
       
  5721     }
       
  5722 
       
  5723     return null;
       
  5724   }
       
  5725 };
       
  5726 
       
  5727 /**
       
  5728  * Inject modules for resolving DOM hierarchy and plugin ordering.
       
  5729  */
       
  5730 injection.injectEventPluginOrder(DOMEventPluginOrder);
       
  5731 setComponentTree(getFiberCurrentPropsFromNode$1, getInstanceFromNode$1, getNodeFromInstance$1);
       
  5732 
       
  5733 /**
       
  5734  * Some important event plugins included by default (without having to require
       
  5735  * them).
       
  5736  */
       
  5737 injection.injectEventPluginsByName({
       
  5738   SimpleEventPlugin: SimpleEventPlugin,
       
  5739   EnterLeaveEventPlugin: EnterLeaveEventPlugin,
       
  5740   ChangeEventPlugin: ChangeEventPlugin,
       
  5741   SelectEventPlugin: SelectEventPlugin,
       
  5742   BeforeInputEventPlugin: BeforeInputEventPlugin
       
  5743 });
       
  5744 
       
  5745 var didWarnSelectedSetOnOption = false;
       
  5746 var didWarnInvalidChild = false;
       
  5747 
       
  5748 function flattenChildren(children) {
       
  5749   var content = '';
       
  5750 
       
  5751   // Flatten children. We'll warn if they are invalid
       
  5752   // during validateProps() which runs for hydration too.
       
  5753   // Note that this would throw on non-element objects.
       
  5754   // Elements are stringified (which is normally irrelevant
       
  5755   // but matters for <fbt>).
       
  5756   React.Children.forEach(children, function (child) {
       
  5757     if (child == null) {
       
  5758       return;
       
  5759     }
       
  5760     content += child;
       
  5761     // Note: we don't warn about invalid children here.
       
  5762     // Instead, this is done separately below so that
       
  5763     // it happens during the hydration codepath too.
       
  5764   });
       
  5765 
       
  5766   return content;
       
  5767 }
       
  5768 
       
  5769 /**
       
  5770  * Implements an <option> host component that warns when `selected` is set.
       
  5771  */
       
  5772 
       
  5773 function validateProps(element, props) {
       
  5774   {
       
  5775     // This mirrors the codepath above, but runs for hydration too.
       
  5776     // Warn about invalid children here so that client and hydration are consistent.
       
  5777     // TODO: this seems like it could cause a DEV-only throw for hydration
       
  5778     // if children contains a non-element object. We should try to avoid that.
       
  5779     if (typeof props.children === 'object' && props.children !== null) {
       
  5780       React.Children.forEach(props.children, function (child) {
       
  5781         if (child == null) {
       
  5782           return;
       
  5783         }
       
  5784         if (typeof child === 'string' || typeof child === 'number') {
       
  5785           return;
       
  5786         }
       
  5787         if (typeof child.type !== 'string') {
       
  5788           return;
       
  5789         }
       
  5790         if (!didWarnInvalidChild) {
       
  5791           didWarnInvalidChild = true;
       
  5792           warning$1(false, 'Only strings and numbers are supported as <option> children.');
       
  5793         }
       
  5794       });
       
  5795     }
       
  5796 
       
  5797     // TODO: Remove support for `selected` in <option>.
       
  5798     if (props.selected != null && !didWarnSelectedSetOnOption) {
       
  5799       warning$1(false, 'Use the `defaultValue` or `value` props on <select> instead of ' + 'setting `selected` on <option>.');
       
  5800       didWarnSelectedSetOnOption = true;
       
  5801     }
       
  5802   }
       
  5803 }
       
  5804 
       
  5805 function postMountWrapper$1(element, props) {
       
  5806   // value="" should make a value attribute (#6219)
       
  5807   if (props.value != null) {
       
  5808     element.setAttribute('value', toString(getToStringValue(props.value)));
       
  5809   }
       
  5810 }
       
  5811 
       
  5812 function getHostProps$1(element, props) {
       
  5813   var hostProps = _assign({ children: undefined }, props);
       
  5814   var content = flattenChildren(props.children);
       
  5815 
       
  5816   if (content) {
       
  5817     hostProps.children = content;
       
  5818   }
       
  5819 
       
  5820   return hostProps;
       
  5821 }
       
  5822 
       
  5823 // TODO: direct imports like some-package/src/* are bad. Fix me.
       
  5824 var didWarnValueDefaultValue$1 = void 0;
       
  5825 
       
  5826 {
       
  5827   didWarnValueDefaultValue$1 = false;
       
  5828 }
       
  5829 
       
  5830 function getDeclarationErrorAddendum() {
       
  5831   var ownerName = getCurrentFiberOwnerNameInDevOrNull();
       
  5832   if (ownerName) {
       
  5833     return '\n\nCheck the render method of `' + ownerName + '`.';
       
  5834   }
       
  5835   return '';
       
  5836 }
       
  5837 
       
  5838 var valuePropNames = ['value', 'defaultValue'];
       
  5839 
       
  5840 /**
       
  5841  * Validation function for `value` and `defaultValue`.
       
  5842  */
       
  5843 function checkSelectPropTypes(props) {
       
  5844   ReactControlledValuePropTypes.checkPropTypes('select', props);
       
  5845 
       
  5846   for (var i = 0; i < valuePropNames.length; i++) {
       
  5847     var propName = valuePropNames[i];
       
  5848     if (props[propName] == null) {
       
  5849       continue;
       
  5850     }
       
  5851     var isArray = Array.isArray(props[propName]);
       
  5852     if (props.multiple && !isArray) {
       
  5853       warning$1(false, 'The `%s` prop supplied to <select> must be an array if ' + '`multiple` is true.%s', propName, getDeclarationErrorAddendum());
       
  5854     } else if (!props.multiple && isArray) {
       
  5855       warning$1(false, 'The `%s` prop supplied to <select> must be a scalar ' + 'value if `multiple` is false.%s', propName, getDeclarationErrorAddendum());
       
  5856     }
       
  5857   }
       
  5858 }
       
  5859 
       
  5860 function updateOptions(node, multiple, propValue, setDefaultSelected) {
       
  5861   var options = node.options;
       
  5862 
       
  5863   if (multiple) {
       
  5864     var selectedValues = propValue;
       
  5865     var selectedValue = {};
       
  5866     for (var i = 0; i < selectedValues.length; i++) {
       
  5867       // Prefix to avoid chaos with special keys.
       
  5868       selectedValue['$' + selectedValues[i]] = true;
       
  5869     }
       
  5870     for (var _i = 0; _i < options.length; _i++) {
       
  5871       var selected = selectedValue.hasOwnProperty('$' + options[_i].value);
       
  5872       if (options[_i].selected !== selected) {
       
  5873         options[_i].selected = selected;
       
  5874       }
       
  5875       if (selected && setDefaultSelected) {
       
  5876         options[_i].defaultSelected = true;
       
  5877       }
       
  5878     }
       
  5879   } else {
       
  5880     // Do not set `select.value` as exact behavior isn't consistent across all
       
  5881     // browsers for all cases.
       
  5882     var _selectedValue = toString(getToStringValue(propValue));
       
  5883     var defaultSelected = null;
       
  5884     for (var _i2 = 0; _i2 < options.length; _i2++) {
       
  5885       if (options[_i2].value === _selectedValue) {
       
  5886         options[_i2].selected = true;
       
  5887         if (setDefaultSelected) {
       
  5888           options[_i2].defaultSelected = true;
       
  5889         }
       
  5890         return;
       
  5891       }
       
  5892       if (defaultSelected === null && !options[_i2].disabled) {
       
  5893         defaultSelected = options[_i2];
       
  5894       }
       
  5895     }
       
  5896     if (defaultSelected !== null) {
       
  5897       defaultSelected.selected = true;
       
  5898     }
       
  5899   }
       
  5900 }
       
  5901 
       
  5902 /**
       
  5903  * Implements a <select> host component that allows optionally setting the
       
  5904  * props `value` and `defaultValue`. If `multiple` is false, the prop must be a
       
  5905  * stringable. If `multiple` is true, the prop must be an array of stringables.
       
  5906  *
       
  5907  * If `value` is not supplied (or null/undefined), user actions that change the
       
  5908  * selected option will trigger updates to the rendered options.
       
  5909  *
       
  5910  * If it is supplied (and not null/undefined), the rendered options will not
       
  5911  * update in response to user actions. Instead, the `value` prop must change in
       
  5912  * order for the rendered options to update.
       
  5913  *
       
  5914  * If `defaultValue` is provided, any options with the supplied values will be
       
  5915  * selected.
       
  5916  */
       
  5917 
       
  5918 function getHostProps$2(element, props) {
       
  5919   return _assign({}, props, {
       
  5920     value: undefined
       
  5921   });
       
  5922 }
       
  5923 
       
  5924 function initWrapperState$1(element, props) {
       
  5925   var node = element;
       
  5926   {
       
  5927     checkSelectPropTypes(props);
       
  5928   }
       
  5929 
       
  5930   node._wrapperState = {
       
  5931     wasMultiple: !!props.multiple
       
  5932   };
       
  5933 
       
  5934   {
       
  5935     if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValueDefaultValue$1) {
       
  5936       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');
       
  5937       didWarnValueDefaultValue$1 = true;
       
  5938     }
       
  5939   }
       
  5940 }
       
  5941 
       
  5942 function postMountWrapper$2(element, props) {
       
  5943   var node = element;
       
  5944   node.multiple = !!props.multiple;
       
  5945   var value = props.value;
       
  5946   if (value != null) {
       
  5947     updateOptions(node, !!props.multiple, value, false);
       
  5948   } else if (props.defaultValue != null) {
       
  5949     updateOptions(node, !!props.multiple, props.defaultValue, true);
       
  5950   }
       
  5951 }
       
  5952 
       
  5953 function postUpdateWrapper(element, props) {
       
  5954   var node = element;
       
  5955   var wasMultiple = node._wrapperState.wasMultiple;
       
  5956   node._wrapperState.wasMultiple = !!props.multiple;
       
  5957 
       
  5958   var value = props.value;
       
  5959   if (value != null) {
       
  5960     updateOptions(node, !!props.multiple, value, false);
       
  5961   } else if (wasMultiple !== !!props.multiple) {
       
  5962     // For simplicity, reapply `defaultValue` if `multiple` is toggled.
       
  5963     if (props.defaultValue != null) {
       
  5964       updateOptions(node, !!props.multiple, props.defaultValue, true);
       
  5965     } else {
       
  5966       // Revert the select back to its default unselected state.
       
  5967       updateOptions(node, !!props.multiple, props.multiple ? [] : '', false);
       
  5968     }
       
  5969   }
       
  5970 }
       
  5971 
       
  5972 function restoreControlledState$2(element, props) {
       
  5973   var node = element;
       
  5974   var value = props.value;
       
  5975 
       
  5976   if (value != null) {
       
  5977     updateOptions(node, !!props.multiple, value, false);
       
  5978   }
       
  5979 }
       
  5980 
       
  5981 var didWarnValDefaultVal = false;
       
  5982 
       
  5983 /**
       
  5984  * Implements a <textarea> host component that allows setting `value`, and
       
  5985  * `defaultValue`. This differs from the traditional DOM API because value is
       
  5986  * usually set as PCDATA children.
       
  5987  *
       
  5988  * If `value` is not supplied (or null/undefined), user actions that affect the
       
  5989  * value will trigger updates to the element.
       
  5990  *
       
  5991  * If `value` is supplied (and not null/undefined), the rendered element will
       
  5992  * not trigger updates to the element. Instead, the `value` prop must change in
       
  5993  * order for the rendered element to be updated.
       
  5994  *
       
  5995  * The rendered element will be initialized with an empty value, the prop
       
  5996  * `defaultValue` if specified, or the children content (deprecated).
       
  5997  */
       
  5998 
       
  5999 function getHostProps$3(element, props) {
       
  6000   var node = element;
       
  6001   !(props.dangerouslySetInnerHTML == null) ? invariant(false, '`dangerouslySetInnerHTML` does not make sense on <textarea>.') : void 0;
       
  6002 
       
  6003   // Always set children to the same thing. In IE9, the selection range will
       
  6004   // get reset if `textContent` is mutated.  We could add a check in setTextContent
       
  6005   // to only set the value if/when the value differs from the node value (which would
       
  6006   // completely solve this IE9 bug), but Sebastian+Sophie seemed to like this
       
  6007   // solution. The value can be a boolean or object so that's why it's forced
       
  6008   // to be a string.
       
  6009   var hostProps = _assign({}, props, {
       
  6010     value: undefined,
       
  6011     defaultValue: undefined,
       
  6012     children: toString(node._wrapperState.initialValue)
       
  6013   });
       
  6014 
       
  6015   return hostProps;
       
  6016 }
       
  6017 
       
  6018 function initWrapperState$2(element, props) {
       
  6019   var node = element;
       
  6020   {
       
  6021     ReactControlledValuePropTypes.checkPropTypes('textarea', props);
       
  6022     if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValDefaultVal) {
       
  6023       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');
       
  6024       didWarnValDefaultVal = true;
       
  6025     }
       
  6026   }
       
  6027 
       
  6028   var initialValue = props.value;
       
  6029 
       
  6030   // Only bother fetching default value if we're going to use it
       
  6031   if (initialValue == null) {
       
  6032     var defaultValue = props.defaultValue;
       
  6033     // TODO (yungsters): Remove support for children content in <textarea>.
       
  6034     var children = props.children;
       
  6035     if (children != null) {
       
  6036       {
       
  6037         warning$1(false, 'Use the `defaultValue` or `value` props instead of setting ' + 'children on <textarea>.');
       
  6038       }
       
  6039       !(defaultValue == null) ? invariant(false, 'If you supply `defaultValue` on a <textarea>, do not pass children.') : void 0;
       
  6040       if (Array.isArray(children)) {
       
  6041         !(children.length <= 1) ? invariant(false, '<textarea> can only have at most one child.') : void 0;
       
  6042         children = children[0];
       
  6043       }
       
  6044 
       
  6045       defaultValue = children;
       
  6046     }
       
  6047     if (defaultValue == null) {
       
  6048       defaultValue = '';
       
  6049     }
       
  6050     initialValue = defaultValue;
       
  6051   }
       
  6052 
       
  6053   node._wrapperState = {
       
  6054     initialValue: getToStringValue(initialValue)
       
  6055   };
       
  6056 }
       
  6057 
       
  6058 function updateWrapper$1(element, props) {
       
  6059   var node = element;
       
  6060   var value = getToStringValue(props.value);
       
  6061   var defaultValue = getToStringValue(props.defaultValue);
       
  6062   if (value != null) {
       
  6063     // Cast `value` to a string to ensure the value is set correctly. While
       
  6064     // browsers typically do this as necessary, jsdom doesn't.
       
  6065     var newValue = toString(value);
       
  6066     // To avoid side effects (such as losing text selection), only set value if changed
       
  6067     if (newValue !== node.value) {
       
  6068       node.value = newValue;
       
  6069     }
       
  6070     if (props.defaultValue == null && node.defaultValue !== newValue) {
       
  6071       node.defaultValue = newValue;
       
  6072     }
       
  6073   }
       
  6074   if (defaultValue != null) {
       
  6075     node.defaultValue = toString(defaultValue);
       
  6076   }
       
  6077 }
       
  6078 
       
  6079 function postMountWrapper$3(element, props) {
       
  6080   var node = element;
       
  6081   // This is in postMount because we need access to the DOM node, which is not
       
  6082   // available until after the component has mounted.
       
  6083   var textContent = node.textContent;
       
  6084 
       
  6085   // Only set node.value if textContent is equal to the expected
       
  6086   // initial value. In IE10/IE11 there is a bug where the placeholder attribute
       
  6087   // will populate textContent as well.
       
  6088   // https://developer.microsoft.com/microsoft-edge/platform/issues/101525/
       
  6089   if (textContent === node._wrapperState.initialValue) {
       
  6090     node.value = textContent;
       
  6091   }
       
  6092 }
       
  6093 
       
  6094 function restoreControlledState$3(element, props) {
       
  6095   // DOM component is still mounted; update
       
  6096   updateWrapper$1(element, props);
       
  6097 }
       
  6098 
       
  6099 var HTML_NAMESPACE$1 = 'http://www.w3.org/1999/xhtml';
       
  6100 var MATH_NAMESPACE = 'http://www.w3.org/1998/Math/MathML';
       
  6101 var SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
       
  6102 
       
  6103 var Namespaces = {
       
  6104   html: HTML_NAMESPACE$1,
       
  6105   mathml: MATH_NAMESPACE,
       
  6106   svg: SVG_NAMESPACE
       
  6107 };
       
  6108 
       
  6109 // Assumes there is no parent namespace.
       
  6110 function getIntrinsicNamespace(type) {
       
  6111   switch (type) {
       
  6112     case 'svg':
       
  6113       return SVG_NAMESPACE;
       
  6114     case 'math':
       
  6115       return MATH_NAMESPACE;
       
  6116     default:
       
  6117       return HTML_NAMESPACE$1;
       
  6118   }
       
  6119 }
       
  6120 
       
  6121 function getChildNamespace(parentNamespace, type) {
       
  6122   if (parentNamespace == null || parentNamespace === HTML_NAMESPACE$1) {
       
  6123     // No (or default) parent namespace: potential entry point.
       
  6124     return getIntrinsicNamespace(type);
       
  6125   }
       
  6126   if (parentNamespace === SVG_NAMESPACE && type === 'foreignObject') {
       
  6127     // We're leaving SVG.
       
  6128     return HTML_NAMESPACE$1;
       
  6129   }
       
  6130   // By default, pass namespace below.
       
  6131   return parentNamespace;
       
  6132 }
       
  6133 
       
  6134 /* globals MSApp */
       
  6135 
       
  6136 /**
       
  6137  * Create a function which has 'unsafe' privileges (required by windows8 apps)
       
  6138  */
       
  6139 var createMicrosoftUnsafeLocalFunction = function (func) {
       
  6140   if (typeof MSApp !== 'undefined' && MSApp.execUnsafeLocalFunction) {
       
  6141     return function (arg0, arg1, arg2, arg3) {
       
  6142       MSApp.execUnsafeLocalFunction(function () {
       
  6143         return func(arg0, arg1, arg2, arg3);
       
  6144       });
       
  6145     };
       
  6146   } else {
       
  6147     return func;
       
  6148   }
       
  6149 };
       
  6150 
       
  6151 // SVG temp container for IE lacking innerHTML
       
  6152 var reusableSVGContainer = void 0;
       
  6153 
       
  6154 /**
       
  6155  * Set the innerHTML property of a node
       
  6156  *
       
  6157  * @param {DOMElement} node
       
  6158  * @param {string} html
       
  6159  * @internal
       
  6160  */
       
  6161 var setInnerHTML = createMicrosoftUnsafeLocalFunction(function (node, html) {
       
  6162   // IE does not have innerHTML for SVG nodes, so instead we inject the
       
  6163   // new markup in a temp node and then move the child nodes across into
       
  6164   // the target node
       
  6165 
       
  6166   if (node.namespaceURI === Namespaces.svg && !('innerHTML' in node)) {
       
  6167     reusableSVGContainer = reusableSVGContainer || document.createElement('div');
       
  6168     reusableSVGContainer.innerHTML = '<svg>' + html + '</svg>';
       
  6169     var svgNode = reusableSVGContainer.firstChild;
       
  6170     while (node.firstChild) {
       
  6171       node.removeChild(node.firstChild);
       
  6172     }
       
  6173     while (svgNode.firstChild) {
       
  6174       node.appendChild(svgNode.firstChild);
       
  6175     }
       
  6176   } else {
       
  6177     node.innerHTML = html;
       
  6178   }
       
  6179 });
       
  6180 
       
  6181 /**
       
  6182  * Set the textContent property of a node. For text updates, it's faster
       
  6183  * to set the `nodeValue` of the Text node directly instead of using
       
  6184  * `.textContent` which will remove the existing node and create a new one.
       
  6185  *
       
  6186  * @param {DOMElement} node
       
  6187  * @param {string} text
       
  6188  * @internal
       
  6189  */
       
  6190 var setTextContent = function (node, text) {
       
  6191   if (text) {
       
  6192     var firstChild = node.firstChild;
       
  6193 
       
  6194     if (firstChild && firstChild === node.lastChild && firstChild.nodeType === TEXT_NODE) {
       
  6195       firstChild.nodeValue = text;
       
  6196       return;
       
  6197     }
       
  6198   }
       
  6199   node.textContent = text;
       
  6200 };
       
  6201 
       
  6202 // List derived from Gecko source code:
       
  6203 // https://github.com/mozilla/gecko-dev/blob/4e638efc71/layout/style/test/property_database.js
       
  6204 var shorthandToLonghand = {
       
  6205   animation: ['animationDelay', 'animationDirection', 'animationDuration', 'animationFillMode', 'animationIterationCount', 'animationName', 'animationPlayState', 'animationTimingFunction'],
       
  6206   background: ['backgroundAttachment', 'backgroundClip', 'backgroundColor', 'backgroundImage', 'backgroundOrigin', 'backgroundPositionX', 'backgroundPositionY', 'backgroundRepeat', 'backgroundSize'],
       
  6207   backgroundPosition: ['backgroundPositionX', 'backgroundPositionY'],
       
  6208   border: ['borderBottomColor', 'borderBottomStyle', 'borderBottomWidth', 'borderImageOutset', 'borderImageRepeat', 'borderImageSlice', 'borderImageSource', 'borderImageWidth', 'borderLeftColor', 'borderLeftStyle', 'borderLeftWidth', 'borderRightColor', 'borderRightStyle', 'borderRightWidth', 'borderTopColor', 'borderTopStyle', 'borderTopWidth'],
       
  6209   borderBlockEnd: ['borderBlockEndColor', 'borderBlockEndStyle', 'borderBlockEndWidth'],
       
  6210   borderBlockStart: ['borderBlockStartColor', 'borderBlockStartStyle', 'borderBlockStartWidth'],
       
  6211   borderBottom: ['borderBottomColor', 'borderBottomStyle', 'borderBottomWidth'],
       
  6212   borderColor: ['borderBottomColor', 'borderLeftColor', 'borderRightColor', 'borderTopColor'],
       
  6213   borderImage: ['borderImageOutset', 'borderImageRepeat', 'borderImageSlice', 'borderImageSource', 'borderImageWidth'],
       
  6214   borderInlineEnd: ['borderInlineEndColor', 'borderInlineEndStyle', 'borderInlineEndWidth'],
       
  6215   borderInlineStart: ['borderInlineStartColor', 'borderInlineStartStyle', 'borderInlineStartWidth'],
       
  6216   borderLeft: ['borderLeftColor', 'borderLeftStyle', 'borderLeftWidth'],
       
  6217   borderRadius: ['borderBottomLeftRadius', 'borderBottomRightRadius', 'borderTopLeftRadius', 'borderTopRightRadius'],
       
  6218   borderRight: ['borderRightColor', 'borderRightStyle', 'borderRightWidth'],
       
  6219   borderStyle: ['borderBottomStyle', 'borderLeftStyle', 'borderRightStyle', 'borderTopStyle'],
       
  6220   borderTop: ['borderTopColor', 'borderTopStyle', 'borderTopWidth'],
       
  6221   borderWidth: ['borderBottomWidth', 'borderLeftWidth', 'borderRightWidth', 'borderTopWidth'],
       
  6222   columnRule: ['columnRuleColor', 'columnRuleStyle', 'columnRuleWidth'],
       
  6223   columns: ['columnCount', 'columnWidth'],
       
  6224   flex: ['flexBasis', 'flexGrow', 'flexShrink'],
       
  6225   flexFlow: ['flexDirection', 'flexWrap'],
       
  6226   font: ['fontFamily', 'fontFeatureSettings', 'fontKerning', 'fontLanguageOverride', 'fontSize', 'fontSizeAdjust', 'fontStretch', 'fontStyle', 'fontVariant', 'fontVariantAlternates', 'fontVariantCaps', 'fontVariantEastAsian', 'fontVariantLigatures', 'fontVariantNumeric', 'fontVariantPosition', 'fontWeight', 'lineHeight'],
       
  6227   fontVariant: ['fontVariantAlternates', 'fontVariantCaps', 'fontVariantEastAsian', 'fontVariantLigatures', 'fontVariantNumeric', 'fontVariantPosition'],
       
  6228   gap: ['columnGap', 'rowGap'],
       
  6229   grid: ['gridAutoColumns', 'gridAutoFlow', 'gridAutoRows', 'gridTemplateAreas', 'gridTemplateColumns', 'gridTemplateRows'],
       
  6230   gridArea: ['gridColumnEnd', 'gridColumnStart', 'gridRowEnd', 'gridRowStart'],
       
  6231   gridColumn: ['gridColumnEnd', 'gridColumnStart'],
       
  6232   gridColumnGap: ['columnGap'],
       
  6233   gridGap: ['columnGap', 'rowGap'],
       
  6234   gridRow: ['gridRowEnd', 'gridRowStart'],
       
  6235   gridRowGap: ['rowGap'],
       
  6236   gridTemplate: ['gridTemplateAreas', 'gridTemplateColumns', 'gridTemplateRows'],
       
  6237   listStyle: ['listStyleImage', 'listStylePosition', 'listStyleType'],
       
  6238   margin: ['marginBottom', 'marginLeft', 'marginRight', 'marginTop'],
       
  6239   marker: ['markerEnd', 'markerMid', 'markerStart'],
       
  6240   mask: ['maskClip', 'maskComposite', 'maskImage', 'maskMode', 'maskOrigin', 'maskPositionX', 'maskPositionY', 'maskRepeat', 'maskSize'],
       
  6241   maskPosition: ['maskPositionX', 'maskPositionY'],
       
  6242   outline: ['outlineColor', 'outlineStyle', 'outlineWidth'],
       
  6243   overflow: ['overflowX', 'overflowY'],
       
  6244   padding: ['paddingBottom', 'paddingLeft', 'paddingRight', 'paddingTop'],
       
  6245   placeContent: ['alignContent', 'justifyContent'],
       
  6246   placeItems: ['alignItems', 'justifyItems'],
       
  6247   placeSelf: ['alignSelf', 'justifySelf'],
       
  6248   textDecoration: ['textDecorationColor', 'textDecorationLine', 'textDecorationStyle'],
       
  6249   textEmphasis: ['textEmphasisColor', 'textEmphasisStyle'],
       
  6250   transition: ['transitionDelay', 'transitionDuration', 'transitionProperty', 'transitionTimingFunction'],
       
  6251   wordWrap: ['overflowWrap']
       
  6252 };
       
  6253 
       
  6254 /**
       
  6255  * CSS properties which accept numbers but are not in units of "px".
       
  6256  */
       
  6257 var isUnitlessNumber = {
       
  6258   animationIterationCount: true,
       
  6259   borderImageOutset: true,
       
  6260   borderImageSlice: true,
       
  6261   borderImageWidth: true,
       
  6262   boxFlex: true,
       
  6263   boxFlexGroup: true,
       
  6264   boxOrdinalGroup: true,
       
  6265   columnCount: true,
       
  6266   columns: true,
       
  6267   flex: true,
       
  6268   flexGrow: true,
       
  6269   flexPositive: true,
       
  6270   flexShrink: true,
       
  6271   flexNegative: true,
       
  6272   flexOrder: true,
       
  6273   gridArea: true,
       
  6274   gridRow: true,
       
  6275   gridRowEnd: true,
       
  6276   gridRowSpan: true,
       
  6277   gridRowStart: true,
       
  6278   gridColumn: true,
       
  6279   gridColumnEnd: true,
       
  6280   gridColumnSpan: true,
       
  6281   gridColumnStart: true,
       
  6282   fontWeight: true,
       
  6283   lineClamp: true,
       
  6284   lineHeight: true,
       
  6285   opacity: true,
       
  6286   order: true,
       
  6287   orphans: true,
       
  6288   tabSize: true,
       
  6289   widows: true,
       
  6290   zIndex: true,
       
  6291   zoom: true,
       
  6292 
       
  6293   // SVG-related properties
       
  6294   fillOpacity: true,
       
  6295   floodOpacity: true,
       
  6296   stopOpacity: true,
       
  6297   strokeDasharray: true,
       
  6298   strokeDashoffset: true,
       
  6299   strokeMiterlimit: true,
       
  6300   strokeOpacity: true,
       
  6301   strokeWidth: true
       
  6302 };
       
  6303 
       
  6304 /**
       
  6305  * @param {string} prefix vendor-specific prefix, eg: Webkit
       
  6306  * @param {string} key style name, eg: transitionDuration
       
  6307  * @return {string} style name prefixed with `prefix`, properly camelCased, eg:
       
  6308  * WebkitTransitionDuration
       
  6309  */
       
  6310 function prefixKey(prefix, key) {
       
  6311   return prefix + key.charAt(0).toUpperCase() + key.substring(1);
       
  6312 }
       
  6313 
       
  6314 /**
       
  6315  * Support style names that may come passed in prefixed by adding permutations
       
  6316  * of vendor prefixes.
       
  6317  */
       
  6318 var prefixes = ['Webkit', 'ms', 'Moz', 'O'];
       
  6319 
       
  6320 // Using Object.keys here, or else the vanilla for-in loop makes IE8 go into an
       
  6321 // infinite loop, because it iterates over the newly added props too.
       
  6322 Object.keys(isUnitlessNumber).forEach(function (prop) {
       
  6323   prefixes.forEach(function (prefix) {
       
  6324     isUnitlessNumber[prefixKey(prefix, prop)] = isUnitlessNumber[prop];
       
  6325   });
       
  6326 });
       
  6327 
       
  6328 /**
       
  6329  * Convert a value into the proper css writable value. The style name `name`
       
  6330  * should be logical (no hyphens), as specified
       
  6331  * in `CSSProperty.isUnitlessNumber`.
       
  6332  *
       
  6333  * @param {string} name CSS property name such as `topMargin`.
       
  6334  * @param {*} value CSS property value such as `10px`.
       
  6335  * @return {string} Normalized style value with dimensions applied.
       
  6336  */
       
  6337 function dangerousStyleValue(name, value, isCustomProperty) {
       
  6338   // Note that we've removed escapeTextForBrowser() calls here since the
       
  6339   // whole string will be escaped when the attribute is injected into
       
  6340   // the markup. If you provide unsafe user data here they can inject
       
  6341   // arbitrary CSS which may be problematic (I couldn't repro this):
       
  6342   // https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet
       
  6343   // http://www.thespanner.co.uk/2007/11/26/ultimate-xss-css-injection/
       
  6344   // This is not an XSS hole but instead a potential CSS injection issue
       
  6345   // which has lead to a greater discussion about how we're going to
       
  6346   // trust URLs moving forward. See #2115901
       
  6347 
       
  6348   var isEmpty = value == null || typeof value === 'boolean' || value === '';
       
  6349   if (isEmpty) {
       
  6350     return '';
       
  6351   }
       
  6352 
       
  6353   if (!isCustomProperty && typeof value === 'number' && value !== 0 && !(isUnitlessNumber.hasOwnProperty(name) && isUnitlessNumber[name])) {
       
  6354     return value + 'px'; // Presumes implicit 'px' suffix for unitless numbers
       
  6355   }
       
  6356 
       
  6357   return ('' + value).trim();
       
  6358 }
       
  6359 
       
  6360 var uppercasePattern = /([A-Z])/g;
       
  6361 var msPattern = /^ms-/;
       
  6362 
       
  6363 /**
       
  6364  * Hyphenates a camelcased CSS property name, for example:
       
  6365  *
       
  6366  *   > hyphenateStyleName('backgroundColor')
       
  6367  *   < "background-color"
       
  6368  *   > hyphenateStyleName('MozTransition')
       
  6369  *   < "-moz-transition"
       
  6370  *   > hyphenateStyleName('msTransition')
       
  6371  *   < "-ms-transition"
       
  6372  *
       
  6373  * As Modernizr suggests (http://modernizr.com/docs/#prefixed), an `ms` prefix
       
  6374  * is converted to `-ms-`.
       
  6375  */
       
  6376 function hyphenateStyleName(name) {
       
  6377   return name.replace(uppercasePattern, '-$1').toLowerCase().replace(msPattern, '-ms-');
       
  6378 }
       
  6379 
       
  6380 var warnValidStyle = function () {};
       
  6381 
       
  6382 {
       
  6383   // 'msTransform' is correct, but the other prefixes should be capitalized
       
  6384   var badVendoredStyleNamePattern = /^(?:webkit|moz|o)[A-Z]/;
       
  6385   var msPattern$1 = /^-ms-/;
       
  6386   var hyphenPattern = /-(.)/g;
       
  6387 
       
  6388   // style values shouldn't contain a semicolon
       
  6389   var badStyleValueWithSemicolonPattern = /;\s*$/;
       
  6390 
       
  6391   var warnedStyleNames = {};
       
  6392   var warnedStyleValues = {};
       
  6393   var warnedForNaNValue = false;
       
  6394   var warnedForInfinityValue = false;
       
  6395 
       
  6396   var camelize = function (string) {
       
  6397     return string.replace(hyphenPattern, function (_, character) {
       
  6398       return character.toUpperCase();
       
  6399     });
       
  6400   };
       
  6401 
       
  6402   var warnHyphenatedStyleName = function (name) {
       
  6403     if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
       
  6404       return;
       
  6405     }
       
  6406 
       
  6407     warnedStyleNames[name] = true;
       
  6408     warning$1(false, 'Unsupported style property %s. Did you mean %s?', name,
       
  6409     // As Andi Smith suggests
       
  6410     // (http://www.andismith.com/blog/2012/02/modernizr-prefixed/), an `-ms` prefix
       
  6411     // is converted to lowercase `ms`.
       
  6412     camelize(name.replace(msPattern$1, 'ms-')));
       
  6413   };
       
  6414 
       
  6415   var warnBadVendoredStyleName = function (name) {
       
  6416     if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
       
  6417       return;
       
  6418     }
       
  6419 
       
  6420     warnedStyleNames[name] = true;
       
  6421     warning$1(false, 'Unsupported vendor-prefixed style property %s. Did you mean %s?', name, name.charAt(0).toUpperCase() + name.slice(1));
       
  6422   };
       
  6423 
       
  6424   var warnStyleValueWithSemicolon = function (name, value) {
       
  6425     if (warnedStyleValues.hasOwnProperty(value) && warnedStyleValues[value]) {
       
  6426       return;
       
  6427     }
       
  6428 
       
  6429     warnedStyleValues[value] = true;
       
  6430     warning$1(false, "Style property values shouldn't contain a semicolon. " + 'Try "%s: %s" instead.', name, value.replace(badStyleValueWithSemicolonPattern, ''));
       
  6431   };
       
  6432 
       
  6433   var warnStyleValueIsNaN = function (name, value) {
       
  6434     if (warnedForNaNValue) {
       
  6435       return;
       
  6436     }
       
  6437 
       
  6438     warnedForNaNValue = true;
       
  6439     warning$1(false, '`NaN` is an invalid value for the `%s` css style property.', name);
       
  6440   };
       
  6441 
       
  6442   var warnStyleValueIsInfinity = function (name, value) {
       
  6443     if (warnedForInfinityValue) {
       
  6444       return;
       
  6445     }
       
  6446 
       
  6447     warnedForInfinityValue = true;
       
  6448     warning$1(false, '`Infinity` is an invalid value for the `%s` css style property.', name);
       
  6449   };
       
  6450 
       
  6451   warnValidStyle = function (name, value) {
       
  6452     if (name.indexOf('-') > -1) {
       
  6453       warnHyphenatedStyleName(name);
       
  6454     } else if (badVendoredStyleNamePattern.test(name)) {
       
  6455       warnBadVendoredStyleName(name);
       
  6456     } else if (badStyleValueWithSemicolonPattern.test(value)) {
       
  6457       warnStyleValueWithSemicolon(name, value);
       
  6458     }
       
  6459 
       
  6460     if (typeof value === 'number') {
       
  6461       if (isNaN(value)) {
       
  6462         warnStyleValueIsNaN(name, value);
       
  6463       } else if (!isFinite(value)) {
       
  6464         warnStyleValueIsInfinity(name, value);
       
  6465       }
       
  6466     }
       
  6467   };
       
  6468 }
       
  6469 
       
  6470 var warnValidStyle$1 = warnValidStyle;
       
  6471 
       
  6472 /**
       
  6473  * Operations for dealing with CSS properties.
       
  6474  */
       
  6475 
       
  6476 /**
       
  6477  * This creates a string that is expected to be equivalent to the style
       
  6478  * attribute generated by server-side rendering. It by-passes warnings and
       
  6479  * security checks so it's not safe to use this value for anything other than
       
  6480  * comparison. It is only used in DEV for SSR validation.
       
  6481  */
       
  6482 function createDangerousStringForStyles(styles) {
       
  6483   {
       
  6484     var serialized = '';
       
  6485     var delimiter = '';
       
  6486     for (var styleName in styles) {
       
  6487       if (!styles.hasOwnProperty(styleName)) {
       
  6488         continue;
       
  6489       }
       
  6490       var styleValue = styles[styleName];
       
  6491       if (styleValue != null) {
       
  6492         var isCustomProperty = styleName.indexOf('--') === 0;
       
  6493         serialized += delimiter + hyphenateStyleName(styleName) + ':';
       
  6494         serialized += dangerousStyleValue(styleName, styleValue, isCustomProperty);
       
  6495 
       
  6496         delimiter = ';';
       
  6497       }
       
  6498     }
       
  6499     return serialized || null;
       
  6500   }
       
  6501 }
       
  6502 
       
  6503 /**
       
  6504  * Sets the value for multiple styles on a node.  If a value is specified as
       
  6505  * '' (empty string), the corresponding style property will be unset.
       
  6506  *
       
  6507  * @param {DOMElement} node
       
  6508  * @param {object} styles
       
  6509  */
       
  6510 function setValueForStyles(node, styles) {
       
  6511   var style = node.style;
       
  6512   for (var styleName in styles) {
       
  6513     if (!styles.hasOwnProperty(styleName)) {
       
  6514       continue;
       
  6515     }
       
  6516     var isCustomProperty = styleName.indexOf('--') === 0;
       
  6517     {
       
  6518       if (!isCustomProperty) {
       
  6519         warnValidStyle$1(styleName, styles[styleName]);
       
  6520       }
       
  6521     }
       
  6522     var styleValue = dangerousStyleValue(styleName, styles[styleName], isCustomProperty);
       
  6523     if (styleName === 'float') {
       
  6524       styleName = 'cssFloat';
       
  6525     }
       
  6526     if (isCustomProperty) {
       
  6527       style.setProperty(styleName, styleValue);
       
  6528     } else {
       
  6529       style[styleName] = styleValue;
       
  6530     }
       
  6531   }
       
  6532 }
       
  6533 
       
  6534 function isValueEmpty(value) {
       
  6535   return value == null || typeof value === 'boolean' || value === '';
       
  6536 }
       
  6537 
       
  6538 /**
       
  6539  * Given {color: 'red', overflow: 'hidden'} returns {
       
  6540  *   color: 'color',
       
  6541  *   overflowX: 'overflow',
       
  6542  *   overflowY: 'overflow',
       
  6543  * }. This can be read as "the overflowY property was set by the overflow
       
  6544  * shorthand". That is, the values are the property that each was derived from.
       
  6545  */
       
  6546 function expandShorthandMap(styles) {
       
  6547   var expanded = {};
       
  6548   for (var key in styles) {
       
  6549     var longhands = shorthandToLonghand[key] || [key];
       
  6550     for (var i = 0; i < longhands.length; i++) {
       
  6551       expanded[longhands[i]] = key;
       
  6552     }
       
  6553   }
       
  6554   return expanded;
       
  6555 }
       
  6556 
       
  6557 /**
       
  6558  * When mixing shorthand and longhand property names, we warn during updates if
       
  6559  * we expect an incorrect result to occur. In particular, we warn for:
       
  6560  *
       
  6561  * Updating a shorthand property (longhand gets overwritten):
       
  6562  *   {font: 'foo', fontVariant: 'bar'} -> {font: 'baz', fontVariant: 'bar'}
       
  6563  *   becomes .style.font = 'baz'
       
  6564  * Removing a shorthand property (longhand gets lost too):
       
  6565  *   {font: 'foo', fontVariant: 'bar'} -> {fontVariant: 'bar'}
       
  6566  *   becomes .style.font = ''
       
  6567  * Removing a longhand property (should revert to shorthand; doesn't):
       
  6568  *   {font: 'foo', fontVariant: 'bar'} -> {font: 'foo'}
       
  6569  *   becomes .style.fontVariant = ''
       
  6570  */
       
  6571 function validateShorthandPropertyCollisionInDev(styleUpdates, nextStyles) {
       
  6572   if (!warnAboutShorthandPropertyCollision) {
       
  6573     return;
       
  6574   }
       
  6575 
       
  6576   if (!nextStyles) {
       
  6577     return;
       
  6578   }
       
  6579 
       
  6580   var expandedUpdates = expandShorthandMap(styleUpdates);
       
  6581   var expandedStyles = expandShorthandMap(nextStyles);
       
  6582   var warnedAbout = {};
       
  6583   for (var key in expandedUpdates) {
       
  6584     var originalKey = expandedUpdates[key];
       
  6585     var correctOriginalKey = expandedStyles[key];
       
  6586     if (correctOriginalKey && originalKey !== correctOriginalKey) {
       
  6587       var warningKey = originalKey + ',' + correctOriginalKey;
       
  6588       if (warnedAbout[warningKey]) {
       
  6589         continue;
       
  6590       }
       
  6591       warnedAbout[warningKey] = true;
       
  6592       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);
       
  6593     }
       
  6594   }
       
  6595 }
       
  6596 
       
  6597 // For HTML, certain tags should omit their close tag. We keep a whitelist for
       
  6598 // those special-case tags.
       
  6599 
       
  6600 var omittedCloseTags = {
       
  6601   area: true,
       
  6602   base: true,
       
  6603   br: true,
       
  6604   col: true,
       
  6605   embed: true,
       
  6606   hr: true,
       
  6607   img: true,
       
  6608   input: true,
       
  6609   keygen: true,
       
  6610   link: true,
       
  6611   meta: true,
       
  6612   param: true,
       
  6613   source: true,
       
  6614   track: true,
       
  6615   wbr: true
       
  6616   // NOTE: menuitem's close tag should be omitted, but that causes problems.
       
  6617 };
       
  6618 
       
  6619 // For HTML, certain tags cannot have children. This has the same purpose as
       
  6620 // `omittedCloseTags` except that `menuitem` should still have its closing tag.
       
  6621 
       
  6622 var voidElementTags = _assign({
       
  6623   menuitem: true
       
  6624 }, omittedCloseTags);
       
  6625 
       
  6626 // TODO: We can remove this if we add invariantWithStack()
       
  6627 // or add stack by default to invariants where possible.
       
  6628 var HTML$1 = '__html';
       
  6629 
       
  6630 var ReactDebugCurrentFrame$2 = null;
       
  6631 {
       
  6632   ReactDebugCurrentFrame$2 = ReactSharedInternals.ReactDebugCurrentFrame;
       
  6633 }
       
  6634 
       
  6635 function assertValidProps(tag, props) {
       
  6636   if (!props) {
       
  6637     return;
       
  6638   }
       
  6639   // Note the use of `==` which checks for null or undefined.
       
  6640   if (voidElementTags[tag]) {
       
  6641     !(props.children == null && props.dangerouslySetInnerHTML == null) ? invariant(false, '%s is a void element tag and must neither have `children` nor use `dangerouslySetInnerHTML`.%s', tag, ReactDebugCurrentFrame$2.getStackAddendum()) : void 0;
       
  6642   }
       
  6643   if (props.dangerouslySetInnerHTML != null) {
       
  6644     !(props.children == null) ? invariant(false, 'Can only set one of `children` or `props.dangerouslySetInnerHTML`.') : void 0;
       
  6645     !(typeof props.dangerouslySetInnerHTML === 'object' && HTML$1 in props.dangerouslySetInnerHTML) ? invariant(false, '`props.dangerouslySetInnerHTML` must be in the form `{__html: ...}`. Please visit https://fb.me/react-invariant-dangerously-set-inner-html for more information.') : void 0;
       
  6646   }
       
  6647   {
       
  6648     !(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;
       
  6649   }
       
  6650   !(props.style == null || typeof props.style === 'object') ? invariant(false, 'The `style` prop expects a mapping from style properties to values, not a string. For example, style={{marginRight: spacing + \'em\'}} when using JSX.%s', ReactDebugCurrentFrame$2.getStackAddendum()) : void 0;
       
  6651 }
       
  6652 
       
  6653 function isCustomComponent(tagName, props) {
       
  6654   if (tagName.indexOf('-') === -1) {
       
  6655     return typeof props.is === 'string';
       
  6656   }
       
  6657   switch (tagName) {
       
  6658     // These are reserved SVG and MathML elements.
       
  6659     // We don't mind this whitelist too much because we expect it to never grow.
       
  6660     // The alternative is to track the namespace in a few places which is convoluted.
       
  6661     // https://w3c.github.io/webcomponents/spec/custom/#custom-elements-core-concepts
       
  6662     case 'annotation-xml':
       
  6663     case 'color-profile':
       
  6664     case 'font-face':
       
  6665     case 'font-face-src':
       
  6666     case 'font-face-uri':
       
  6667     case 'font-face-format':
       
  6668     case 'font-face-name':
       
  6669     case 'missing-glyph':
       
  6670       return false;
       
  6671     default:
       
  6672       return true;
       
  6673   }
       
  6674 }
       
  6675 
       
  6676 // When adding attributes to the HTML or SVG whitelist, be sure to
       
  6677 // also add them to this module to ensure casing and incorrect name
       
  6678 // warnings.
       
  6679 var possibleStandardNames = {
       
  6680   // HTML
       
  6681   accept: 'accept',
       
  6682   acceptcharset: 'acceptCharset',
       
  6683   'accept-charset': 'acceptCharset',
       
  6684   accesskey: 'accessKey',
       
  6685   action: 'action',
       
  6686   allowfullscreen: 'allowFullScreen',
       
  6687   alt: 'alt',
       
  6688   as: 'as',
       
  6689   async: 'async',
       
  6690   autocapitalize: 'autoCapitalize',
       
  6691   autocomplete: 'autoComplete',
       
  6692   autocorrect: 'autoCorrect',
       
  6693   autofocus: 'autoFocus',
       
  6694   autoplay: 'autoPlay',
       
  6695   autosave: 'autoSave',
       
  6696   capture: 'capture',
       
  6697   cellpadding: 'cellPadding',
       
  6698   cellspacing: 'cellSpacing',
       
  6699   challenge: 'challenge',
       
  6700   charset: 'charSet',
       
  6701   checked: 'checked',
       
  6702   children: 'children',
       
  6703   cite: 'cite',
       
  6704   class: 'className',
       
  6705   classid: 'classID',
       
  6706   classname: 'className',
       
  6707   cols: 'cols',
       
  6708   colspan: 'colSpan',
       
  6709   content: 'content',
       
  6710   contenteditable: 'contentEditable',
       
  6711   contextmenu: 'contextMenu',
       
  6712   controls: 'controls',
       
  6713   controlslist: 'controlsList',
       
  6714   coords: 'coords',
       
  6715   crossorigin: 'crossOrigin',
       
  6716   dangerouslysetinnerhtml: 'dangerouslySetInnerHTML',
       
  6717   data: 'data',
       
  6718   datetime: 'dateTime',
       
  6719   default: 'default',
       
  6720   defaultchecked: 'defaultChecked',
       
  6721   defaultvalue: 'defaultValue',
       
  6722   defer: 'defer',
       
  6723   dir: 'dir',
       
  6724   disabled: 'disabled',
       
  6725   download: 'download',
       
  6726   draggable: 'draggable',
       
  6727   enctype: 'encType',
       
  6728   for: 'htmlFor',
       
  6729   form: 'form',
       
  6730   formmethod: 'formMethod',
       
  6731   formaction: 'formAction',
       
  6732   formenctype: 'formEncType',
       
  6733   formnovalidate: 'formNoValidate',
       
  6734   formtarget: 'formTarget',
       
  6735   frameborder: 'frameBorder',
       
  6736   headers: 'headers',
       
  6737   height: 'height',
       
  6738   hidden: 'hidden',
       
  6739   high: 'high',
       
  6740   href: 'href',
       
  6741   hreflang: 'hrefLang',
       
  6742   htmlfor: 'htmlFor',
       
  6743   httpequiv: 'httpEquiv',
       
  6744   'http-equiv': 'httpEquiv',
       
  6745   icon: 'icon',
       
  6746   id: 'id',
       
  6747   innerhtml: 'innerHTML',
       
  6748   inputmode: 'inputMode',
       
  6749   integrity: 'integrity',
       
  6750   is: 'is',
       
  6751   itemid: 'itemID',
       
  6752   itemprop: 'itemProp',
       
  6753   itemref: 'itemRef',
       
  6754   itemscope: 'itemScope',
       
  6755   itemtype: 'itemType',
       
  6756   keyparams: 'keyParams',
       
  6757   keytype: 'keyType',
       
  6758   kind: 'kind',
       
  6759   label: 'label',
       
  6760   lang: 'lang',
       
  6761   list: 'list',
       
  6762   loop: 'loop',
       
  6763   low: 'low',
       
  6764   manifest: 'manifest',
       
  6765   marginwidth: 'marginWidth',
       
  6766   marginheight: 'marginHeight',
       
  6767   max: 'max',
       
  6768   maxlength: 'maxLength',
       
  6769   media: 'media',
       
  6770   mediagroup: 'mediaGroup',
       
  6771   method: 'method',
       
  6772   min: 'min',
       
  6773   minlength: 'minLength',
       
  6774   multiple: 'multiple',
       
  6775   muted: 'muted',
       
  6776   name: 'name',
       
  6777   nomodule: 'noModule',
       
  6778   nonce: 'nonce',
       
  6779   novalidate: 'noValidate',
       
  6780   open: 'open',
       
  6781   optimum: 'optimum',
       
  6782   pattern: 'pattern',
       
  6783   placeholder: 'placeholder',
       
  6784   playsinline: 'playsInline',
       
  6785   poster: 'poster',
       
  6786   preload: 'preload',
       
  6787   profile: 'profile',
       
  6788   radiogroup: 'radioGroup',
       
  6789   readonly: 'readOnly',
       
  6790   referrerpolicy: 'referrerPolicy',
       
  6791   rel: 'rel',
       
  6792   required: 'required',
       
  6793   reversed: 'reversed',
       
  6794   role: 'role',
       
  6795   rows: 'rows',
       
  6796   rowspan: 'rowSpan',
       
  6797   sandbox: 'sandbox',
       
  6798   scope: 'scope',
       
  6799   scoped: 'scoped',
       
  6800   scrolling: 'scrolling',
       
  6801   seamless: 'seamless',
       
  6802   selected: 'selected',
       
  6803   shape: 'shape',
       
  6804   size: 'size',
       
  6805   sizes: 'sizes',
       
  6806   span: 'span',
       
  6807   spellcheck: 'spellCheck',
       
  6808   src: 'src',
       
  6809   srcdoc: 'srcDoc',
       
  6810   srclang: 'srcLang',
       
  6811   srcset: 'srcSet',
       
  6812   start: 'start',
       
  6813   step: 'step',
       
  6814   style: 'style',
       
  6815   summary: 'summary',
       
  6816   tabindex: 'tabIndex',
       
  6817   target: 'target',
       
  6818   title: 'title',
       
  6819   type: 'type',
       
  6820   usemap: 'useMap',
       
  6821   value: 'value',
       
  6822   width: 'width',
       
  6823   wmode: 'wmode',
       
  6824   wrap: 'wrap',
       
  6825 
       
  6826   // SVG
       
  6827   about: 'about',
       
  6828   accentheight: 'accentHeight',
       
  6829   'accent-height': 'accentHeight',
       
  6830   accumulate: 'accumulate',
       
  6831   additive: 'additive',
       
  6832   alignmentbaseline: 'alignmentBaseline',
       
  6833   'alignment-baseline': 'alignmentBaseline',
       
  6834   allowreorder: 'allowReorder',
       
  6835   alphabetic: 'alphabetic',
       
  6836   amplitude: 'amplitude',
       
  6837   arabicform: 'arabicForm',
       
  6838   'arabic-form': 'arabicForm',
       
  6839   ascent: 'ascent',
       
  6840   attributename: 'attributeName',
       
  6841   attributetype: 'attributeType',
       
  6842   autoreverse: 'autoReverse',
       
  6843   azimuth: 'azimuth',
       
  6844   basefrequency: 'baseFrequency',
       
  6845   baselineshift: 'baselineShift',
       
  6846   'baseline-shift': 'baselineShift',
       
  6847   baseprofile: 'baseProfile',
       
  6848   bbox: 'bbox',
       
  6849   begin: 'begin',
       
  6850   bias: 'bias',
       
  6851   by: 'by',
       
  6852   calcmode: 'calcMode',
       
  6853   capheight: 'capHeight',
       
  6854   'cap-height': 'capHeight',
       
  6855   clip: 'clip',
       
  6856   clippath: 'clipPath',
       
  6857   'clip-path': 'clipPath',
       
  6858   clippathunits: 'clipPathUnits',
       
  6859   cliprule: 'clipRule',
       
  6860   'clip-rule': 'clipRule',
       
  6861   color: 'color',
       
  6862   colorinterpolation: 'colorInterpolation',
       
  6863   'color-interpolation': 'colorInterpolation',
       
  6864   colorinterpolationfilters: 'colorInterpolationFilters',
       
  6865   'color-interpolation-filters': 'colorInterpolationFilters',
       
  6866   colorprofile: 'colorProfile',
       
  6867   'color-profile': 'colorProfile',
       
  6868   colorrendering: 'colorRendering',
       
  6869   'color-rendering': 'colorRendering',
       
  6870   contentscripttype: 'contentScriptType',
       
  6871   contentstyletype: 'contentStyleType',
       
  6872   cursor: 'cursor',
       
  6873   cx: 'cx',
       
  6874   cy: 'cy',
       
  6875   d: 'd',
       
  6876   datatype: 'datatype',
       
  6877   decelerate: 'decelerate',
       
  6878   descent: 'descent',
       
  6879   diffuseconstant: 'diffuseConstant',
       
  6880   direction: 'direction',
       
  6881   display: 'display',
       
  6882   divisor: 'divisor',
       
  6883   dominantbaseline: 'dominantBaseline',
       
  6884   'dominant-baseline': 'dominantBaseline',
       
  6885   dur: 'dur',
       
  6886   dx: 'dx',
       
  6887   dy: 'dy',
       
  6888   edgemode: 'edgeMode',
       
  6889   elevation: 'elevation',
       
  6890   enablebackground: 'enableBackground',
       
  6891   'enable-background': 'enableBackground',
       
  6892   end: 'end',
       
  6893   exponent: 'exponent',
       
  6894   externalresourcesrequired: 'externalResourcesRequired',
       
  6895   fill: 'fill',
       
  6896   fillopacity: 'fillOpacity',
       
  6897   'fill-opacity': 'fillOpacity',
       
  6898   fillrule: 'fillRule',
       
  6899   'fill-rule': 'fillRule',
       
  6900   filter: 'filter',
       
  6901   filterres: 'filterRes',
       
  6902   filterunits: 'filterUnits',
       
  6903   floodopacity: 'floodOpacity',
       
  6904   'flood-opacity': 'floodOpacity',
       
  6905   floodcolor: 'floodColor',
       
  6906   'flood-color': 'floodColor',
       
  6907   focusable: 'focusable',
       
  6908   fontfamily: 'fontFamily',
       
  6909   'font-family': 'fontFamily',
       
  6910   fontsize: 'fontSize',
       
  6911   'font-size': 'fontSize',
       
  6912   fontsizeadjust: 'fontSizeAdjust',
       
  6913   'font-size-adjust': 'fontSizeAdjust',
       
  6914   fontstretch: 'fontStretch',
       
  6915   'font-stretch': 'fontStretch',
       
  6916   fontstyle: 'fontStyle',
       
  6917   'font-style': 'fontStyle',
       
  6918   fontvariant: 'fontVariant',
       
  6919   'font-variant': 'fontVariant',
       
  6920   fontweight: 'fontWeight',
       
  6921   'font-weight': 'fontWeight',
       
  6922   format: 'format',
       
  6923   from: 'from',
       
  6924   fx: 'fx',
       
  6925   fy: 'fy',
       
  6926   g1: 'g1',
       
  6927   g2: 'g2',
       
  6928   glyphname: 'glyphName',
       
  6929   'glyph-name': 'glyphName',
       
  6930   glyphorientationhorizontal: 'glyphOrientationHorizontal',
       
  6931   'glyph-orientation-horizontal': 'glyphOrientationHorizontal',
       
  6932   glyphorientationvertical: 'glyphOrientationVertical',
       
  6933   'glyph-orientation-vertical': 'glyphOrientationVertical',
       
  6934   glyphref: 'glyphRef',
       
  6935   gradienttransform: 'gradientTransform',
       
  6936   gradientunits: 'gradientUnits',
       
  6937   hanging: 'hanging',
       
  6938   horizadvx: 'horizAdvX',
       
  6939   'horiz-adv-x': 'horizAdvX',
       
  6940   horizoriginx: 'horizOriginX',
       
  6941   'horiz-origin-x': 'horizOriginX',
       
  6942   ideographic: 'ideographic',
       
  6943   imagerendering: 'imageRendering',
       
  6944   'image-rendering': 'imageRendering',
       
  6945   in2: 'in2',
       
  6946   in: 'in',
       
  6947   inlist: 'inlist',
       
  6948   intercept: 'intercept',
       
  6949   k1: 'k1',
       
  6950   k2: 'k2',
       
  6951   k3: 'k3',
       
  6952   k4: 'k4',
       
  6953   k: 'k',
       
  6954   kernelmatrix: 'kernelMatrix',
       
  6955   kernelunitlength: 'kernelUnitLength',
       
  6956   kerning: 'kerning',
       
  6957   keypoints: 'keyPoints',
       
  6958   keysplines: 'keySplines',
       
  6959   keytimes: 'keyTimes',
       
  6960   lengthadjust: 'lengthAdjust',
       
  6961   letterspacing: 'letterSpacing',
       
  6962   'letter-spacing': 'letterSpacing',
       
  6963   lightingcolor: 'lightingColor',
       
  6964   'lighting-color': 'lightingColor',
       
  6965   limitingconeangle: 'limitingConeAngle',
       
  6966   local: 'local',
       
  6967   markerend: 'markerEnd',
       
  6968   'marker-end': 'markerEnd',
       
  6969   markerheight: 'markerHeight',
       
  6970   markermid: 'markerMid',
       
  6971   'marker-mid': 'markerMid',
       
  6972   markerstart: 'markerStart',
       
  6973   'marker-start': 'markerStart',
       
  6974   markerunits: 'markerUnits',
       
  6975   markerwidth: 'markerWidth',
       
  6976   mask: 'mask',
       
  6977   maskcontentunits: 'maskContentUnits',
       
  6978   maskunits: 'maskUnits',
       
  6979   mathematical: 'mathematical',
       
  6980   mode: 'mode',
       
  6981   numoctaves: 'numOctaves',
       
  6982   offset: 'offset',
       
  6983   opacity: 'opacity',
       
  6984   operator: 'operator',
       
  6985   order: 'order',
       
  6986   orient: 'orient',
       
  6987   orientation: 'orientation',
       
  6988   origin: 'origin',
       
  6989   overflow: 'overflow',
       
  6990   overlineposition: 'overlinePosition',
       
  6991   'overline-position': 'overlinePosition',
       
  6992   overlinethickness: 'overlineThickness',
       
  6993   'overline-thickness': 'overlineThickness',
       
  6994   paintorder: 'paintOrder',
       
  6995   'paint-order': 'paintOrder',
       
  6996   panose1: 'panose1',
       
  6997   'panose-1': 'panose1',
       
  6998   pathlength: 'pathLength',
       
  6999   patterncontentunits: 'patternContentUnits',
       
  7000   patterntransform: 'patternTransform',
       
  7001   patternunits: 'patternUnits',
       
  7002   pointerevents: 'pointerEvents',
       
  7003   'pointer-events': 'pointerEvents',
       
  7004   points: 'points',
       
  7005   pointsatx: 'pointsAtX',
       
  7006   pointsaty: 'pointsAtY',
       
  7007   pointsatz: 'pointsAtZ',
       
  7008   prefix: 'prefix',
       
  7009   preservealpha: 'preserveAlpha',
       
  7010   preserveaspectratio: 'preserveAspectRatio',
       
  7011   primitiveunits: 'primitiveUnits',
       
  7012   property: 'property',
       
  7013   r: 'r',
       
  7014   radius: 'radius',
       
  7015   refx: 'refX',
       
  7016   refy: 'refY',
       
  7017   renderingintent: 'renderingIntent',
       
  7018   'rendering-intent': 'renderingIntent',
       
  7019   repeatcount: 'repeatCount',
       
  7020   repeatdur: 'repeatDur',
       
  7021   requiredextensions: 'requiredExtensions',
       
  7022   requiredfeatures: 'requiredFeatures',
       
  7023   resource: 'resource',
       
  7024   restart: 'restart',
       
  7025   result: 'result',
       
  7026   results: 'results',
       
  7027   rotate: 'rotate',
       
  7028   rx: 'rx',
       
  7029   ry: 'ry',
       
  7030   scale: 'scale',
       
  7031   security: 'security',
       
  7032   seed: 'seed',
       
  7033   shaperendering: 'shapeRendering',
       
  7034   'shape-rendering': 'shapeRendering',
       
  7035   slope: 'slope',
       
  7036   spacing: 'spacing',
       
  7037   specularconstant: 'specularConstant',
       
  7038   specularexponent: 'specularExponent',
       
  7039   speed: 'speed',
       
  7040   spreadmethod: 'spreadMethod',
       
  7041   startoffset: 'startOffset',
       
  7042   stddeviation: 'stdDeviation',
       
  7043   stemh: 'stemh',
       
  7044   stemv: 'stemv',
       
  7045   stitchtiles: 'stitchTiles',
       
  7046   stopcolor: 'stopColor',
       
  7047   'stop-color': 'stopColor',
       
  7048   stopopacity: 'stopOpacity',
       
  7049   'stop-opacity': 'stopOpacity',
       
  7050   strikethroughposition: 'strikethroughPosition',
       
  7051   'strikethrough-position': 'strikethroughPosition',
       
  7052   strikethroughthickness: 'strikethroughThickness',
       
  7053   'strikethrough-thickness': 'strikethroughThickness',
       
  7054   string: 'string',
       
  7055   stroke: 'stroke',
       
  7056   strokedasharray: 'strokeDasharray',
       
  7057   'stroke-dasharray': 'strokeDasharray',
       
  7058   strokedashoffset: 'strokeDashoffset',
       
  7059   'stroke-dashoffset': 'strokeDashoffset',
       
  7060   strokelinecap: 'strokeLinecap',
       
  7061   'stroke-linecap': 'strokeLinecap',
       
  7062   strokelinejoin: 'strokeLinejoin',
       
  7063   'stroke-linejoin': 'strokeLinejoin',
       
  7064   strokemiterlimit: 'strokeMiterlimit',
       
  7065   'stroke-miterlimit': 'strokeMiterlimit',
       
  7066   strokewidth: 'strokeWidth',
       
  7067   'stroke-width': 'strokeWidth',
       
  7068   strokeopacity: 'strokeOpacity',
       
  7069   'stroke-opacity': 'strokeOpacity',
       
  7070   suppresscontenteditablewarning: 'suppressContentEditableWarning',
       
  7071   suppresshydrationwarning: 'suppressHydrationWarning',
       
  7072   surfacescale: 'surfaceScale',
       
  7073   systemlanguage: 'systemLanguage',
       
  7074   tablevalues: 'tableValues',
       
  7075   targetx: 'targetX',
       
  7076   targety: 'targetY',
       
  7077   textanchor: 'textAnchor',
       
  7078   'text-anchor': 'textAnchor',
       
  7079   textdecoration: 'textDecoration',
       
  7080   'text-decoration': 'textDecoration',
       
  7081   textlength: 'textLength',
       
  7082   textrendering: 'textRendering',
       
  7083   'text-rendering': 'textRendering',
       
  7084   to: 'to',
       
  7085   transform: 'transform',
       
  7086   typeof: 'typeof',
       
  7087   u1: 'u1',
       
  7088   u2: 'u2',
       
  7089   underlineposition: 'underlinePosition',
       
  7090   'underline-position': 'underlinePosition',
       
  7091   underlinethickness: 'underlineThickness',
       
  7092   'underline-thickness': 'underlineThickness',
       
  7093   unicode: 'unicode',
       
  7094   unicodebidi: 'unicodeBidi',
       
  7095   'unicode-bidi': 'unicodeBidi',
       
  7096   unicoderange: 'unicodeRange',
       
  7097   'unicode-range': 'unicodeRange',
       
  7098   unitsperem: 'unitsPerEm',
       
  7099   'units-per-em': 'unitsPerEm',
       
  7100   unselectable: 'unselectable',
       
  7101   valphabetic: 'vAlphabetic',
       
  7102   'v-alphabetic': 'vAlphabetic',
       
  7103   values: 'values',
       
  7104   vectoreffect: 'vectorEffect',
       
  7105   'vector-effect': 'vectorEffect',
       
  7106   version: 'version',
       
  7107   vertadvy: 'vertAdvY',
       
  7108   'vert-adv-y': 'vertAdvY',
       
  7109   vertoriginx: 'vertOriginX',
       
  7110   'vert-origin-x': 'vertOriginX',
       
  7111   vertoriginy: 'vertOriginY',
       
  7112   'vert-origin-y': 'vertOriginY',
       
  7113   vhanging: 'vHanging',
       
  7114   'v-hanging': 'vHanging',
       
  7115   videographic: 'vIdeographic',
       
  7116   'v-ideographic': 'vIdeographic',
       
  7117   viewbox: 'viewBox',
       
  7118   viewtarget: 'viewTarget',
       
  7119   visibility: 'visibility',
       
  7120   vmathematical: 'vMathematical',
       
  7121   'v-mathematical': 'vMathematical',
       
  7122   vocab: 'vocab',
       
  7123   widths: 'widths',
       
  7124   wordspacing: 'wordSpacing',
       
  7125   'word-spacing': 'wordSpacing',
       
  7126   writingmode: 'writingMode',
       
  7127   'writing-mode': 'writingMode',
       
  7128   x1: 'x1',
       
  7129   x2: 'x2',
       
  7130   x: 'x',
       
  7131   xchannelselector: 'xChannelSelector',
       
  7132   xheight: 'xHeight',
       
  7133   'x-height': 'xHeight',
       
  7134   xlinkactuate: 'xlinkActuate',
       
  7135   'xlink:actuate': 'xlinkActuate',
       
  7136   xlinkarcrole: 'xlinkArcrole',
       
  7137   'xlink:arcrole': 'xlinkArcrole',
       
  7138   xlinkhref: 'xlinkHref',
       
  7139   'xlink:href': 'xlinkHref',
       
  7140   xlinkrole: 'xlinkRole',
       
  7141   'xlink:role': 'xlinkRole',
       
  7142   xlinkshow: 'xlinkShow',
       
  7143   'xlink:show': 'xlinkShow',
       
  7144   xlinktitle: 'xlinkTitle',
       
  7145   'xlink:title': 'xlinkTitle',
       
  7146   xlinktype: 'xlinkType',
       
  7147   'xlink:type': 'xlinkType',
       
  7148   xmlbase: 'xmlBase',
       
  7149   'xml:base': 'xmlBase',
       
  7150   xmllang: 'xmlLang',
       
  7151   'xml:lang': 'xmlLang',
       
  7152   xmlns: 'xmlns',
       
  7153   'xml:space': 'xmlSpace',
       
  7154   xmlnsxlink: 'xmlnsXlink',
       
  7155   'xmlns:xlink': 'xmlnsXlink',
       
  7156   xmlspace: 'xmlSpace',
       
  7157   y1: 'y1',
       
  7158   y2: 'y2',
       
  7159   y: 'y',
       
  7160   ychannelselector: 'yChannelSelector',
       
  7161   z: 'z',
       
  7162   zoomandpan: 'zoomAndPan'
       
  7163 };
       
  7164 
       
  7165 var ariaProperties = {
       
  7166   'aria-current': 0, // state
       
  7167   'aria-details': 0,
       
  7168   'aria-disabled': 0, // state
       
  7169   'aria-hidden': 0, // state
       
  7170   'aria-invalid': 0, // state
       
  7171   'aria-keyshortcuts': 0,
       
  7172   'aria-label': 0,
       
  7173   'aria-roledescription': 0,
       
  7174   // Widget Attributes
       
  7175   'aria-autocomplete': 0,
       
  7176   'aria-checked': 0,
       
  7177   'aria-expanded': 0,
       
  7178   'aria-haspopup': 0,
       
  7179   'aria-level': 0,
       
  7180   'aria-modal': 0,
       
  7181   'aria-multiline': 0,
       
  7182   'aria-multiselectable': 0,
       
  7183   'aria-orientation': 0,
       
  7184   'aria-placeholder': 0,
       
  7185   'aria-pressed': 0,
       
  7186   'aria-readonly': 0,
       
  7187   'aria-required': 0,
       
  7188   'aria-selected': 0,
       
  7189   'aria-sort': 0,
       
  7190   'aria-valuemax': 0,
       
  7191   'aria-valuemin': 0,
       
  7192   'aria-valuenow': 0,
       
  7193   'aria-valuetext': 0,
       
  7194   // Live Region Attributes
       
  7195   'aria-atomic': 0,
       
  7196   'aria-busy': 0,
       
  7197   'aria-live': 0,
       
  7198   'aria-relevant': 0,
       
  7199   // Drag-and-Drop Attributes
       
  7200   'aria-dropeffect': 0,
       
  7201   'aria-grabbed': 0,
       
  7202   // Relationship Attributes
       
  7203   'aria-activedescendant': 0,
       
  7204   'aria-colcount': 0,
       
  7205   'aria-colindex': 0,
       
  7206   'aria-colspan': 0,
       
  7207   'aria-controls': 0,
       
  7208   'aria-describedby': 0,
       
  7209   'aria-errormessage': 0,
       
  7210   'aria-flowto': 0,
       
  7211   'aria-labelledby': 0,
       
  7212   'aria-owns': 0,
       
  7213   'aria-posinset': 0,
       
  7214   'aria-rowcount': 0,
       
  7215   'aria-rowindex': 0,
       
  7216   'aria-rowspan': 0,
       
  7217   'aria-setsize': 0
       
  7218 };
       
  7219 
       
  7220 var warnedProperties = {};
       
  7221 var rARIA = new RegExp('^(aria)-[' + ATTRIBUTE_NAME_CHAR + ']*$');
       
  7222 var rARIACamel = new RegExp('^(aria)[A-Z][' + ATTRIBUTE_NAME_CHAR + ']*$');
       
  7223 
       
  7224 var hasOwnProperty$2 = Object.prototype.hasOwnProperty;
       
  7225 
       
  7226 function validateProperty(tagName, name) {
       
  7227   if (hasOwnProperty$2.call(warnedProperties, name) && warnedProperties[name]) {
       
  7228     return true;
       
  7229   }
       
  7230 
       
  7231   if (rARIACamel.test(name)) {
       
  7232     var ariaName = 'aria-' + name.slice(4).toLowerCase();
       
  7233     var correctName = ariaProperties.hasOwnProperty(ariaName) ? ariaName : null;
       
  7234 
       
  7235     // If this is an aria-* attribute, but is not listed in the known DOM
       
  7236     // DOM properties, then it is an invalid aria-* attribute.
       
  7237     if (correctName == null) {
       
  7238       warning$1(false, 'Invalid ARIA attribute `%s`. ARIA attributes follow the pattern aria-* and must be lowercase.', name);
       
  7239       warnedProperties[name] = true;
       
  7240       return true;
       
  7241     }
       
  7242     // aria-* attributes should be lowercase; suggest the lowercase version.
       
  7243     if (name !== correctName) {
       
  7244       warning$1(false, 'Invalid ARIA attribute `%s`. Did you mean `%s`?', name, correctName);
       
  7245       warnedProperties[name] = true;
       
  7246       return true;
       
  7247     }
       
  7248   }
       
  7249 
       
  7250   if (rARIA.test(name)) {
       
  7251     var lowerCasedName = name.toLowerCase();
       
  7252     var standardName = ariaProperties.hasOwnProperty(lowerCasedName) ? lowerCasedName : null;
       
  7253 
       
  7254     // If this is an aria-* attribute, but is not listed in the known DOM
       
  7255     // DOM properties, then it is an invalid aria-* attribute.
       
  7256     if (standardName == null) {
       
  7257       warnedProperties[name] = true;
       
  7258       return false;
       
  7259     }
       
  7260     // aria-* attributes should be lowercase; suggest the lowercase version.
       
  7261     if (name !== standardName) {
       
  7262       warning$1(false, 'Unknown ARIA attribute `%s`. Did you mean `%s`?', name, standardName);
       
  7263       warnedProperties[name] = true;
       
  7264       return true;
       
  7265     }
       
  7266   }
       
  7267 
       
  7268   return true;
       
  7269 }
       
  7270 
       
  7271 function warnInvalidARIAProps(type, props) {
       
  7272   var invalidProps = [];
       
  7273 
       
  7274   for (var key in props) {
       
  7275     var isValid = validateProperty(type, key);
       
  7276     if (!isValid) {
       
  7277       invalidProps.push(key);
       
  7278     }
       
  7279   }
       
  7280 
       
  7281   var unknownPropString = invalidProps.map(function (prop) {
       
  7282     return '`' + prop + '`';
       
  7283   }).join(', ');
       
  7284 
       
  7285   if (invalidProps.length === 1) {
       
  7286     warning$1(false, 'Invalid aria prop %s on <%s> tag. ' + 'For details, see https://fb.me/invalid-aria-prop', unknownPropString, type);
       
  7287   } else if (invalidProps.length > 1) {
       
  7288     warning$1(false, 'Invalid aria props %s on <%s> tag. ' + 'For details, see https://fb.me/invalid-aria-prop', unknownPropString, type);
       
  7289   }
       
  7290 }
       
  7291 
       
  7292 function validateProperties(type, props) {
       
  7293   if (isCustomComponent(type, props)) {
       
  7294     return;
       
  7295   }
       
  7296   warnInvalidARIAProps(type, props);
       
  7297 }
       
  7298 
       
  7299 var didWarnValueNull = false;
       
  7300 
       
  7301 function validateProperties$1(type, props) {
       
  7302   if (type !== 'input' && type !== 'textarea' && type !== 'select') {
       
  7303     return;
       
  7304   }
       
  7305 
       
  7306   if (props != null && props.value === null && !didWarnValueNull) {
       
  7307     didWarnValueNull = true;
       
  7308     if (type === 'select' && props.multiple) {
       
  7309       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);
       
  7310     } else {
       
  7311       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);
       
  7312     }
       
  7313   }
       
  7314 }
       
  7315 
       
  7316 var validateProperty$1 = function () {};
       
  7317 
       
  7318 {
       
  7319   var warnedProperties$1 = {};
       
  7320   var _hasOwnProperty = Object.prototype.hasOwnProperty;
       
  7321   var EVENT_NAME_REGEX = /^on./;
       
  7322   var INVALID_EVENT_NAME_REGEX = /^on[^A-Z]/;
       
  7323   var rARIA$1 = new RegExp('^(aria)-[' + ATTRIBUTE_NAME_CHAR + ']*$');
       
  7324   var rARIACamel$1 = new RegExp('^(aria)[A-Z][' + ATTRIBUTE_NAME_CHAR + ']*$');
       
  7325 
       
  7326   validateProperty$1 = function (tagName, name, value, canUseEventSystem) {
       
  7327     if (_hasOwnProperty.call(warnedProperties$1, name) && warnedProperties$1[name]) {
       
  7328       return true;
       
  7329     }
       
  7330 
       
  7331     var lowerCasedName = name.toLowerCase();
       
  7332     if (lowerCasedName === 'onfocusin' || lowerCasedName === 'onfocusout') {
       
  7333       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.');
       
  7334       warnedProperties$1[name] = true;
       
  7335       return true;
       
  7336     }
       
  7337 
       
  7338     // We can't rely on the event system being injected on the server.
       
  7339     if (canUseEventSystem) {
       
  7340       if (registrationNameModules.hasOwnProperty(name)) {
       
  7341         return true;
       
  7342       }
       
  7343       var registrationName = possibleRegistrationNames.hasOwnProperty(lowerCasedName) ? possibleRegistrationNames[lowerCasedName] : null;
       
  7344       if (registrationName != null) {
       
  7345         warning$1(false, 'Invalid event handler property `%s`. Did you mean `%s`?', name, registrationName);
       
  7346         warnedProperties$1[name] = true;
       
  7347         return true;
       
  7348       }
       
  7349       if (EVENT_NAME_REGEX.test(name)) {
       
  7350         warning$1(false, 'Unknown event handler property `%s`. It will be ignored.', name);
       
  7351         warnedProperties$1[name] = true;
       
  7352         return true;
       
  7353       }
       
  7354     } else if (EVENT_NAME_REGEX.test(name)) {
       
  7355       // If no event plugins have been injected, we are in a server environment.
       
  7356       // So we can't tell if the event name is correct for sure, but we can filter
       
  7357       // out known bad ones like `onclick`. We can't suggest a specific replacement though.
       
  7358       if (INVALID_EVENT_NAME_REGEX.test(name)) {
       
  7359         warning$1(false, 'Invalid event handler property `%s`. ' + 'React events use the camelCase naming convention, for example `onClick`.', name);
       
  7360       }
       
  7361       warnedProperties$1[name] = true;
       
  7362       return true;
       
  7363     }
       
  7364 
       
  7365     // Let the ARIA attribute hook validate ARIA attributes
       
  7366     if (rARIA$1.test(name) || rARIACamel$1.test(name)) {
       
  7367       return true;
       
  7368     }
       
  7369 
       
  7370     if (lowerCasedName === 'innerhtml') {
       
  7371       warning$1(false, 'Directly setting property `innerHTML` is not permitted. ' + 'For more information, lookup documentation on `dangerouslySetInnerHTML`.');
       
  7372       warnedProperties$1[name] = true;
       
  7373       return true;
       
  7374     }
       
  7375 
       
  7376     if (lowerCasedName === 'aria') {
       
  7377       warning$1(false, 'The `aria` attribute is reserved for future use in React. ' + 'Pass individual `aria-` attributes instead.');
       
  7378       warnedProperties$1[name] = true;
       
  7379       return true;
       
  7380     }
       
  7381 
       
  7382     if (lowerCasedName === 'is' && value !== null && value !== undefined && typeof value !== 'string') {
       
  7383       warning$1(false, 'Received a `%s` for a string attribute `is`. If this is expected, cast ' + 'the value to a string.', typeof value);
       
  7384       warnedProperties$1[name] = true;
       
  7385       return true;
       
  7386     }
       
  7387 
       
  7388     if (typeof value === 'number' && isNaN(value)) {
       
  7389       warning$1(false, 'Received NaN for the `%s` attribute. If this is expected, cast ' + 'the value to a string.', name);
       
  7390       warnedProperties$1[name] = true;
       
  7391       return true;
       
  7392     }
       
  7393 
       
  7394     var propertyInfo = getPropertyInfo(name);
       
  7395     var isReserved = propertyInfo !== null && propertyInfo.type === RESERVED;
       
  7396 
       
  7397     // Known attributes should match the casing specified in the property config.
       
  7398     if (possibleStandardNames.hasOwnProperty(lowerCasedName)) {
       
  7399       var standardName = possibleStandardNames[lowerCasedName];
       
  7400       if (standardName !== name) {
       
  7401         warning$1(false, 'Invalid DOM property `%s`. Did you mean `%s`?', name, standardName);
       
  7402         warnedProperties$1[name] = true;
       
  7403         return true;
       
  7404       }
       
  7405     } else if (!isReserved && name !== lowerCasedName) {
       
  7406       // Unknown attributes should have lowercase casing since that's how they
       
  7407       // will be cased anyway with server rendering.
       
  7408       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);
       
  7409       warnedProperties$1[name] = true;
       
  7410       return true;
       
  7411     }
       
  7412 
       
  7413     if (typeof value === 'boolean' && shouldRemoveAttributeWithWarning(name, value, propertyInfo, false)) {
       
  7414       if (value) {
       
  7415         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);
       
  7416       } else {
       
  7417         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);
       
  7418       }
       
  7419       warnedProperties$1[name] = true;
       
  7420       return true;
       
  7421     }
       
  7422 
       
  7423     // Now that we've validated casing, do not validate
       
  7424     // data types for reserved props
       
  7425     if (isReserved) {
       
  7426       return true;
       
  7427     }
       
  7428 
       
  7429     // Warn when a known attribute is a bad type
       
  7430     if (shouldRemoveAttributeWithWarning(name, value, propertyInfo, false)) {
       
  7431       warnedProperties$1[name] = true;
       
  7432       return false;
       
  7433     }
       
  7434 
       
  7435     // Warn when passing the strings 'false' or 'true' into a boolean prop
       
  7436     if ((value === 'false' || value === 'true') && propertyInfo !== null && propertyInfo.type === BOOLEAN) {
       
  7437       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);
       
  7438       warnedProperties$1[name] = true;
       
  7439       return true;
       
  7440     }
       
  7441 
       
  7442     return true;
       
  7443   };
       
  7444 }
       
  7445 
       
  7446 var warnUnknownProperties = function (type, props, canUseEventSystem) {
       
  7447   var unknownProps = [];
       
  7448   for (var key in props) {
       
  7449     var isValid = validateProperty$1(type, key, props[key], canUseEventSystem);
       
  7450     if (!isValid) {
       
  7451       unknownProps.push(key);
       
  7452     }
       
  7453   }
       
  7454 
       
  7455   var unknownPropString = unknownProps.map(function (prop) {
       
  7456     return '`' + prop + '`';
       
  7457   }).join(', ');
       
  7458   if (unknownProps.length === 1) {
       
  7459     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);
       
  7460   } else if (unknownProps.length > 1) {
       
  7461     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);
       
  7462   }
       
  7463 };
       
  7464 
       
  7465 function validateProperties$2(type, props, canUseEventSystem) {
       
  7466   if (isCustomComponent(type, props)) {
       
  7467     return;
       
  7468   }
       
  7469   warnUnknownProperties(type, props, canUseEventSystem);
       
  7470 }
       
  7471 
       
  7472 // TODO: direct imports like some-package/src/* are bad. Fix me.
       
  7473 var didWarnInvalidHydration = false;
       
  7474 var didWarnShadyDOM = false;
       
  7475 
       
  7476 var DANGEROUSLY_SET_INNER_HTML = 'dangerouslySetInnerHTML';
       
  7477 var SUPPRESS_CONTENT_EDITABLE_WARNING = 'suppressContentEditableWarning';
       
  7478 var SUPPRESS_HYDRATION_WARNING$1 = 'suppressHydrationWarning';
       
  7479 var AUTOFOCUS = 'autoFocus';
       
  7480 var CHILDREN = 'children';
       
  7481 var STYLE$1 = 'style';
       
  7482 var HTML = '__html';
       
  7483 
       
  7484 var HTML_NAMESPACE = Namespaces.html;
       
  7485 
       
  7486 
       
  7487 var warnedUnknownTags = void 0;
       
  7488 var suppressHydrationWarning = void 0;
       
  7489 
       
  7490 var validatePropertiesInDevelopment = void 0;
       
  7491 var warnForTextDifference = void 0;
       
  7492 var warnForPropDifference = void 0;
       
  7493 var warnForExtraAttributes = void 0;
       
  7494 var warnForInvalidEventListener = void 0;
       
  7495 var canDiffStyleForHydrationWarning = void 0;
       
  7496 
       
  7497 var normalizeMarkupForTextOrAttribute = void 0;
       
  7498 var normalizeHTML = void 0;
       
  7499 
       
  7500 {
       
  7501   warnedUnknownTags = {
       
  7502     // Chrome is the only major browser not shipping <time>. But as of July
       
  7503     // 2017 it intends to ship it due to widespread usage. We intentionally
       
  7504     // *don't* warn for <time> even if it's unrecognized by Chrome because
       
  7505     // it soon will be, and many apps have been using it anyway.
       
  7506     time: true,
       
  7507     // There are working polyfills for <dialog>. Let people use it.
       
  7508     dialog: true,
       
  7509     // Electron ships a custom <webview> tag to display external web content in
       
  7510     // an isolated frame and process.
       
  7511     // This tag is not present in non Electron environments such as JSDom which
       
  7512     // is often used for testing purposes.
       
  7513     // @see https://electronjs.org/docs/api/webview-tag
       
  7514     webview: true
       
  7515   };
       
  7516 
       
  7517   validatePropertiesInDevelopment = function (type, props) {
       
  7518     validateProperties(type, props);
       
  7519     validateProperties$1(type, props);
       
  7520     validateProperties$2(type, props, /* canUseEventSystem */true);
       
  7521   };
       
  7522 
       
  7523   // IE 11 parses & normalizes the style attribute as opposed to other
       
  7524   // browsers. It adds spaces and sorts the properties in some
       
  7525   // non-alphabetical order. Handling that would require sorting CSS
       
  7526   // properties in the client & server versions or applying
       
  7527   // `expectedStyle` to a temporary DOM node to read its `style` attribute
       
  7528   // normalized. Since it only affects IE, we're skipping style warnings
       
  7529   // in that browser completely in favor of doing all that work.
       
  7530   // See https://github.com/facebook/react/issues/11807
       
  7531   canDiffStyleForHydrationWarning = canUseDOM && !document.documentMode;
       
  7532 
       
  7533   // HTML parsing normalizes CR and CRLF to LF.
       
  7534   // It also can turn \u0000 into \uFFFD inside attributes.
       
  7535   // https://www.w3.org/TR/html5/single-page.html#preprocessing-the-input-stream
       
  7536   // If we have a mismatch, it might be caused by that.
       
  7537   // We will still patch up in this case but not fire the warning.
       
  7538   var NORMALIZE_NEWLINES_REGEX = /\r\n?/g;
       
  7539   var NORMALIZE_NULL_AND_REPLACEMENT_REGEX = /\u0000|\uFFFD/g;
       
  7540 
       
  7541   normalizeMarkupForTextOrAttribute = function (markup) {
       
  7542     var markupString = typeof markup === 'string' ? markup : '' + markup;
       
  7543     return markupString.replace(NORMALIZE_NEWLINES_REGEX, '\n').replace(NORMALIZE_NULL_AND_REPLACEMENT_REGEX, '');
       
  7544   };
       
  7545 
       
  7546   warnForTextDifference = function (serverText, clientText) {
       
  7547     if (didWarnInvalidHydration) {
       
  7548       return;
       
  7549     }
       
  7550     var normalizedClientText = normalizeMarkupForTextOrAttribute(clientText);
       
  7551     var normalizedServerText = normalizeMarkupForTextOrAttribute(serverText);
       
  7552     if (normalizedServerText === normalizedClientText) {
       
  7553       return;
       
  7554     }
       
  7555     didWarnInvalidHydration = true;
       
  7556     warningWithoutStack$1(false, 'Text content did not match. Server: "%s" Client: "%s"', normalizedServerText, normalizedClientText);
       
  7557   };
       
  7558 
       
  7559   warnForPropDifference = function (propName, serverValue, clientValue) {
       
  7560     if (didWarnInvalidHydration) {
       
  7561       return;
       
  7562     }
       
  7563     var normalizedClientValue = normalizeMarkupForTextOrAttribute(clientValue);
       
  7564     var normalizedServerValue = normalizeMarkupForTextOrAttribute(serverValue);
       
  7565     if (normalizedServerValue === normalizedClientValue) {
       
  7566       return;
       
  7567     }
       
  7568     didWarnInvalidHydration = true;
       
  7569     warningWithoutStack$1(false, 'Prop `%s` did not match. Server: %s Client: %s', propName, JSON.stringify(normalizedServerValue), JSON.stringify(normalizedClientValue));
       
  7570   };
       
  7571 
       
  7572   warnForExtraAttributes = function (attributeNames) {
       
  7573     if (didWarnInvalidHydration) {
       
  7574       return;
       
  7575     }
       
  7576     didWarnInvalidHydration = true;
       
  7577     var names = [];
       
  7578     attributeNames.forEach(function (name) {
       
  7579       names.push(name);
       
  7580     });
       
  7581     warningWithoutStack$1(false, 'Extra attributes from the server: %s', names);
       
  7582   };
       
  7583 
       
  7584   warnForInvalidEventListener = function (registrationName, listener) {
       
  7585     if (listener === false) {
       
  7586       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);
       
  7587     } else {
       
  7588       warning$1(false, 'Expected `%s` listener to be a function, instead got a value of `%s` type.', registrationName, typeof listener);
       
  7589     }
       
  7590   };
       
  7591 
       
  7592   // Parse the HTML and read it back to normalize the HTML string so that it
       
  7593   // can be used for comparison.
       
  7594   normalizeHTML = function (parent, html) {
       
  7595     // We could have created a separate document here to avoid
       
  7596     // re-initializing custom elements if they exist. But this breaks
       
  7597     // how <noscript> is being handled. So we use the same document.
       
  7598     // See the discussion in https://github.com/facebook/react/pull/11157.
       
  7599     var testElement = parent.namespaceURI === HTML_NAMESPACE ? parent.ownerDocument.createElement(parent.tagName) : parent.ownerDocument.createElementNS(parent.namespaceURI, parent.tagName);
       
  7600     testElement.innerHTML = html;
       
  7601     return testElement.innerHTML;
       
  7602   };
       
  7603 }
       
  7604 
       
  7605 function ensureListeningTo(rootContainerElement, registrationName) {
       
  7606   var isDocumentOrFragment = rootContainerElement.nodeType === DOCUMENT_NODE || rootContainerElement.nodeType === DOCUMENT_FRAGMENT_NODE;
       
  7607   var doc = isDocumentOrFragment ? rootContainerElement : rootContainerElement.ownerDocument;
       
  7608   listenTo(registrationName, doc);
       
  7609 }
       
  7610 
       
  7611 function getOwnerDocumentFromRootContainer(rootContainerElement) {
       
  7612   return rootContainerElement.nodeType === DOCUMENT_NODE ? rootContainerElement : rootContainerElement.ownerDocument;
       
  7613 }
       
  7614 
       
  7615 function noop() {}
       
  7616 
       
  7617 function trapClickOnNonInteractiveElement(node) {
       
  7618   // Mobile Safari does not fire properly bubble click events on
       
  7619   // non-interactive elements, which means delegated click listeners do not
       
  7620   // fire. The workaround for this bug involves attaching an empty click
       
  7621   // listener on the target node.
       
  7622   // http://www.quirksmode.org/blog/archives/2010/09/click_event_del.html
       
  7623   // Just set it using the onclick property so that we don't have to manage any
       
  7624   // bookkeeping for it. Not sure if we need to clear it when the listener is
       
  7625   // removed.
       
  7626   // TODO: Only do this for the relevant Safaris maybe?
       
  7627   node.onclick = noop;
       
  7628 }
       
  7629 
       
  7630 function setInitialDOMProperties(tag, domElement, rootContainerElement, nextProps, isCustomComponentTag) {
       
  7631   for (var propKey in nextProps) {
       
  7632     if (!nextProps.hasOwnProperty(propKey)) {
       
  7633       continue;
       
  7634     }
       
  7635     var nextProp = nextProps[propKey];
       
  7636     if (propKey === STYLE$1) {
       
  7637       {
       
  7638         if (nextProp) {
       
  7639           // Freeze the next style object so that we can assume it won't be
       
  7640           // mutated. We have already warned for this in the past.
       
  7641           Object.freeze(nextProp);
       
  7642         }
       
  7643       }
       
  7644       // Relies on `updateStylesByID` not mutating `styleUpdates`.
       
  7645       setValueForStyles(domElement, nextProp);
       
  7646     } else if (propKey === DANGEROUSLY_SET_INNER_HTML) {
       
  7647       var nextHtml = nextProp ? nextProp[HTML] : undefined;
       
  7648       if (nextHtml != null) {
       
  7649         setInnerHTML(domElement, nextHtml);
       
  7650       }
       
  7651     } else if (propKey === CHILDREN) {
       
  7652       if (typeof nextProp === 'string') {
       
  7653         // Avoid setting initial textContent when the text is empty. In IE11 setting
       
  7654         // textContent on a <textarea> will cause the placeholder to not
       
  7655         // show within the <textarea> until it has been focused and blurred again.
       
  7656         // https://github.com/facebook/react/issues/6731#issuecomment-254874553
       
  7657         var canSetTextContent = tag !== 'textarea' || nextProp !== '';
       
  7658         if (canSetTextContent) {
       
  7659           setTextContent(domElement, nextProp);
       
  7660         }
       
  7661       } else if (typeof nextProp === 'number') {
       
  7662         setTextContent(domElement, '' + nextProp);
       
  7663       }
       
  7664     } else if (propKey === SUPPRESS_CONTENT_EDITABLE_WARNING || propKey === SUPPRESS_HYDRATION_WARNING$1) {
       
  7665       // Noop
       
  7666     } else if (propKey === AUTOFOCUS) {
       
  7667       // We polyfill it separately on the client during commit.
       
  7668       // We could have excluded it in the property list instead of
       
  7669       // adding a special case here, but then it wouldn't be emitted
       
  7670       // on server rendering (but we *do* want to emit it in SSR).
       
  7671     } else if (registrationNameModules.hasOwnProperty(propKey)) {
       
  7672       if (nextProp != null) {
       
  7673         if (true && typeof nextProp !== 'function') {
       
  7674           warnForInvalidEventListener(propKey, nextProp);
       
  7675         }
       
  7676         ensureListeningTo(rootContainerElement, propKey);
       
  7677       }
       
  7678     } else if (nextProp != null) {
       
  7679       setValueForProperty(domElement, propKey, nextProp, isCustomComponentTag);
       
  7680     }
       
  7681   }
       
  7682 }
       
  7683 
       
  7684 function updateDOMProperties(domElement, updatePayload, wasCustomComponentTag, isCustomComponentTag) {
       
  7685   // TODO: Handle wasCustomComponentTag
       
  7686   for (var i = 0; i < updatePayload.length; i += 2) {
       
  7687     var propKey = updatePayload[i];
       
  7688     var propValue = updatePayload[i + 1];
       
  7689     if (propKey === STYLE$1) {
       
  7690       setValueForStyles(domElement, propValue);
       
  7691     } else if (propKey === DANGEROUSLY_SET_INNER_HTML) {
       
  7692       setInnerHTML(domElement, propValue);
       
  7693     } else if (propKey === CHILDREN) {
       
  7694       setTextContent(domElement, propValue);
       
  7695     } else {
       
  7696       setValueForProperty(domElement, propKey, propValue, isCustomComponentTag);
       
  7697     }
       
  7698   }
       
  7699 }
       
  7700 
       
  7701 function createElement(type, props, rootContainerElement, parentNamespace) {
       
  7702   var isCustomComponentTag = void 0;
       
  7703 
       
  7704   // We create tags in the namespace of their parent container, except HTML
       
  7705   // tags get no namespace.
       
  7706   var ownerDocument = getOwnerDocumentFromRootContainer(rootContainerElement);
       
  7707   var domElement = void 0;
       
  7708   var namespaceURI = parentNamespace;
       
  7709   if (namespaceURI === HTML_NAMESPACE) {
       
  7710     namespaceURI = getIntrinsicNamespace(type);
       
  7711   }
       
  7712   if (namespaceURI === HTML_NAMESPACE) {
       
  7713     {
       
  7714       isCustomComponentTag = isCustomComponent(type, props);
       
  7715       // Should this check be gated by parent namespace? Not sure we want to
       
  7716       // allow <SVG> or <mATH>.
       
  7717       !(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;
       
  7718     }
       
  7719 
       
  7720     if (type === 'script') {
       
  7721       // Create the script via .innerHTML so its "parser-inserted" flag is
       
  7722       // set to true and it does not execute
       
  7723       var div = ownerDocument.createElement('div');
       
  7724       div.innerHTML = '<script><' + '/script>'; // eslint-disable-line
       
  7725       // This is guaranteed to yield a script element.
       
  7726       var firstChild = div.firstChild;
       
  7727       domElement = div.removeChild(firstChild);
       
  7728     } else if (typeof props.is === 'string') {
       
  7729       // $FlowIssue `createElement` should be updated for Web Components
       
  7730       domElement = ownerDocument.createElement(type, { is: props.is });
       
  7731     } else {
       
  7732       // Separate else branch instead of using `props.is || undefined` above because of a Firefox bug.
       
  7733       // See discussion in https://github.com/facebook/react/pull/6896
       
  7734       // and discussion in https://bugzilla.mozilla.org/show_bug.cgi?id=1276240
       
  7735       domElement = ownerDocument.createElement(type);
       
  7736       // Normally attributes are assigned in `setInitialDOMProperties`, however the `multiple`
       
  7737       // attribute on `select`s needs to be added before `option`s are inserted. This prevents
       
  7738       // a bug where the `select` does not scroll to the correct option because singular
       
  7739       // `select` elements automatically pick the first item.
       
  7740       // See https://github.com/facebook/react/issues/13222
       
  7741       if (type === 'select' && props.multiple) {
       
  7742         var node = domElement;
       
  7743         node.multiple = true;
       
  7744       }
       
  7745     }
       
  7746   } else {
       
  7747     domElement = ownerDocument.createElementNS(namespaceURI, type);
       
  7748   }
       
  7749 
       
  7750   {
       
  7751     if (namespaceURI === HTML_NAMESPACE) {
       
  7752       if (!isCustomComponentTag && Object.prototype.toString.call(domElement) === '[object HTMLUnknownElement]' && !Object.prototype.hasOwnProperty.call(warnedUnknownTags, type)) {
       
  7753         warnedUnknownTags[type] = true;
       
  7754         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);
       
  7755       }
       
  7756     }
       
  7757   }
       
  7758 
       
  7759   return domElement;
       
  7760 }
       
  7761 
       
  7762 function createTextNode(text, rootContainerElement) {
       
  7763   return getOwnerDocumentFromRootContainer(rootContainerElement).createTextNode(text);
       
  7764 }
       
  7765 
       
  7766 function setInitialProperties(domElement, tag, rawProps, rootContainerElement) {
       
  7767   var isCustomComponentTag = isCustomComponent(tag, rawProps);
       
  7768   {
       
  7769     validatePropertiesInDevelopment(tag, rawProps);
       
  7770     if (isCustomComponentTag && !didWarnShadyDOM && domElement.shadyRoot) {
       
  7771       warning$1(false, '%s is using shady DOM. Using shady DOM with React can ' + 'cause things to break subtly.', getCurrentFiberOwnerNameInDevOrNull() || 'A component');
       
  7772       didWarnShadyDOM = true;
       
  7773     }
       
  7774   }
       
  7775 
       
  7776   // TODO: Make sure that we check isMounted before firing any of these events.
       
  7777   var props = void 0;
       
  7778   switch (tag) {
       
  7779     case 'iframe':
       
  7780     case 'object':
       
  7781       trapBubbledEvent(TOP_LOAD, domElement);
       
  7782       props = rawProps;
       
  7783       break;
       
  7784     case 'video':
       
  7785     case 'audio':
       
  7786       // Create listener for each media event
       
  7787       for (var i = 0; i < mediaEventTypes.length; i++) {
       
  7788         trapBubbledEvent(mediaEventTypes[i], domElement);
       
  7789       }
       
  7790       props = rawProps;
       
  7791       break;
       
  7792     case 'source':
       
  7793       trapBubbledEvent(TOP_ERROR, domElement);
       
  7794       props = rawProps;
       
  7795       break;
       
  7796     case 'img':
       
  7797     case 'image':
       
  7798     case 'link':
       
  7799       trapBubbledEvent(TOP_ERROR, domElement);
       
  7800       trapBubbledEvent(TOP_LOAD, domElement);
       
  7801       props = rawProps;
       
  7802       break;
       
  7803     case 'form':
       
  7804       trapBubbledEvent(TOP_RESET, domElement);
       
  7805       trapBubbledEvent(TOP_SUBMIT, domElement);
       
  7806       props = rawProps;
       
  7807       break;
       
  7808     case 'details':
       
  7809       trapBubbledEvent(TOP_TOGGLE, domElement);
       
  7810       props = rawProps;
       
  7811       break;
       
  7812     case 'input':
       
  7813       initWrapperState(domElement, rawProps);
       
  7814       props = getHostProps(domElement, rawProps);
       
  7815       trapBubbledEvent(TOP_INVALID, domElement);
       
  7816       // For controlled components we always need to ensure we're listening
       
  7817       // to onChange. Even if there is no listener.
       
  7818       ensureListeningTo(rootContainerElement, 'onChange');
       
  7819       break;
       
  7820     case 'option':
       
  7821       validateProps(domElement, rawProps);
       
  7822       props = getHostProps$1(domElement, rawProps);
       
  7823       break;
       
  7824     case 'select':
       
  7825       initWrapperState$1(domElement, rawProps);
       
  7826       props = getHostProps$2(domElement, rawProps);
       
  7827       trapBubbledEvent(TOP_INVALID, domElement);
       
  7828       // For controlled components we always need to ensure we're listening
       
  7829       // to onChange. Even if there is no listener.
       
  7830       ensureListeningTo(rootContainerElement, 'onChange');
       
  7831       break;
       
  7832     case 'textarea':
       
  7833       initWrapperState$2(domElement, rawProps);
       
  7834       props = getHostProps$3(domElement, rawProps);
       
  7835       trapBubbledEvent(TOP_INVALID, domElement);
       
  7836       // For controlled components we always need to ensure we're listening
       
  7837       // to onChange. Even if there is no listener.
       
  7838       ensureListeningTo(rootContainerElement, 'onChange');
       
  7839       break;
       
  7840     default:
       
  7841       props = rawProps;
       
  7842   }
       
  7843 
       
  7844   assertValidProps(tag, props);
       
  7845 
       
  7846   setInitialDOMProperties(tag, domElement, rootContainerElement, props, isCustomComponentTag);
       
  7847 
       
  7848   switch (tag) {
       
  7849     case 'input':
       
  7850       // TODO: Make sure we check if this is still unmounted or do any clean
       
  7851       // up necessary since we never stop tracking anymore.
       
  7852       track(domElement);
       
  7853       postMountWrapper(domElement, rawProps, false);
       
  7854       break;
       
  7855     case 'textarea':
       
  7856       // TODO: Make sure we check if this is still unmounted or do any clean
       
  7857       // up necessary since we never stop tracking anymore.
       
  7858       track(domElement);
       
  7859       postMountWrapper$3(domElement, rawProps);
       
  7860       break;
       
  7861     case 'option':
       
  7862       postMountWrapper$1(domElement, rawProps);
       
  7863       break;
       
  7864     case 'select':
       
  7865       postMountWrapper$2(domElement, rawProps);
       
  7866       break;
       
  7867     default:
       
  7868       if (typeof props.onClick === 'function') {
       
  7869         // TODO: This cast may not be sound for SVG, MathML or custom elements.
       
  7870         trapClickOnNonInteractiveElement(domElement);
       
  7871       }
       
  7872       break;
       
  7873   }
       
  7874 }
       
  7875 
       
  7876 // Calculate the diff between the two objects.
       
  7877 function diffProperties(domElement, tag, lastRawProps, nextRawProps, rootContainerElement) {
       
  7878   {
       
  7879     validatePropertiesInDevelopment(tag, nextRawProps);
       
  7880   }
       
  7881 
       
  7882   var updatePayload = null;
       
  7883 
       
  7884   var lastProps = void 0;
       
  7885   var nextProps = void 0;
       
  7886   switch (tag) {
       
  7887     case 'input':
       
  7888       lastProps = getHostProps(domElement, lastRawProps);
       
  7889       nextProps = getHostProps(domElement, nextRawProps);
       
  7890       updatePayload = [];
       
  7891       break;
       
  7892     case 'option':
       
  7893       lastProps = getHostProps$1(domElement, lastRawProps);
       
  7894       nextProps = getHostProps$1(domElement, nextRawProps);
       
  7895       updatePayload = [];
       
  7896       break;
       
  7897     case 'select':
       
  7898       lastProps = getHostProps$2(domElement, lastRawProps);
       
  7899       nextProps = getHostProps$2(domElement, nextRawProps);
       
  7900       updatePayload = [];
       
  7901       break;
       
  7902     case 'textarea':
       
  7903       lastProps = getHostProps$3(domElement, lastRawProps);
       
  7904       nextProps = getHostProps$3(domElement, nextRawProps);
       
  7905       updatePayload = [];
       
  7906       break;
       
  7907     default:
       
  7908       lastProps = lastRawProps;
       
  7909       nextProps = nextRawProps;
       
  7910       if (typeof lastProps.onClick !== 'function' && typeof nextProps.onClick === 'function') {
       
  7911         // TODO: This cast may not be sound for SVG, MathML or custom elements.
       
  7912         trapClickOnNonInteractiveElement(domElement);
       
  7913       }
       
  7914       break;
       
  7915   }
       
  7916 
       
  7917   assertValidProps(tag, nextProps);
       
  7918 
       
  7919   var propKey = void 0;
       
  7920   var styleName = void 0;
       
  7921   var styleUpdates = null;
       
  7922   for (propKey in lastProps) {
       
  7923     if (nextProps.hasOwnProperty(propKey) || !lastProps.hasOwnProperty(propKey) || lastProps[propKey] == null) {
       
  7924       continue;
       
  7925     }
       
  7926     if (propKey === STYLE$1) {
       
  7927       var lastStyle = lastProps[propKey];
       
  7928       for (styleName in lastStyle) {
       
  7929         if (lastStyle.hasOwnProperty(styleName)) {
       
  7930           if (!styleUpdates) {
       
  7931             styleUpdates = {};
       
  7932           }
       
  7933           styleUpdates[styleName] = '';
       
  7934         }
       
  7935       }
       
  7936     } else if (propKey === DANGEROUSLY_SET_INNER_HTML || propKey === CHILDREN) {
       
  7937       // Noop. This is handled by the clear text mechanism.
       
  7938     } else if (propKey === SUPPRESS_CONTENT_EDITABLE_WARNING || propKey === SUPPRESS_HYDRATION_WARNING$1) {
       
  7939       // Noop
       
  7940     } else if (propKey === AUTOFOCUS) {
       
  7941       // Noop. It doesn't work on updates anyway.
       
  7942     } else if (registrationNameModules.hasOwnProperty(propKey)) {
       
  7943       // This is a special case. If any listener updates we need to ensure
       
  7944       // that the "current" fiber pointer gets updated so we need a commit
       
  7945       // to update this element.
       
  7946       if (!updatePayload) {
       
  7947         updatePayload = [];
       
  7948       }
       
  7949     } else {
       
  7950       // For all other deleted properties we add it to the queue. We use
       
  7951       // the whitelist in the commit phase instead.
       
  7952       (updatePayload = updatePayload || []).push(propKey, null);
       
  7953     }
       
  7954   }
       
  7955   for (propKey in nextProps) {
       
  7956     var nextProp = nextProps[propKey];
       
  7957     var lastProp = lastProps != null ? lastProps[propKey] : undefined;
       
  7958     if (!nextProps.hasOwnProperty(propKey) || nextProp === lastProp || nextProp == null && lastProp == null) {
       
  7959       continue;
       
  7960     }
       
  7961     if (propKey === STYLE$1) {
       
  7962       {
       
  7963         if (nextProp) {
       
  7964           // Freeze the next style object so that we can assume it won't be
       
  7965           // mutated. We have already warned for this in the past.
       
  7966           Object.freeze(nextProp);
       
  7967         }
       
  7968       }
       
  7969       if (lastProp) {
       
  7970         // Unset styles on `lastProp` but not on `nextProp`.
       
  7971         for (styleName in lastProp) {
       
  7972           if (lastProp.hasOwnProperty(styleName) && (!nextProp || !nextProp.hasOwnProperty(styleName))) {
       
  7973             if (!styleUpdates) {
       
  7974               styleUpdates = {};
       
  7975             }
       
  7976             styleUpdates[styleName] = '';
       
  7977           }
       
  7978         }
       
  7979         // Update styles that changed since `lastProp`.
       
  7980         for (styleName in nextProp) {
       
  7981           if (nextProp.hasOwnProperty(styleName) && lastProp[styleName] !== nextProp[styleName]) {
       
  7982             if (!styleUpdates) {
       
  7983               styleUpdates = {};
       
  7984             }
       
  7985             styleUpdates[styleName] = nextProp[styleName];
       
  7986           }
       
  7987         }
       
  7988       } else {
       
  7989         // Relies on `updateStylesByID` not mutating `styleUpdates`.
       
  7990         if (!styleUpdates) {
       
  7991           if (!updatePayload) {
       
  7992             updatePayload = [];
       
  7993           }
       
  7994           updatePayload.push(propKey, styleUpdates);
       
  7995         }
       
  7996         styleUpdates = nextProp;
       
  7997       }
       
  7998     } else if (propKey === DANGEROUSLY_SET_INNER_HTML) {
       
  7999       var nextHtml = nextProp ? nextProp[HTML] : undefined;
       
  8000       var lastHtml = lastProp ? lastProp[HTML] : undefined;
       
  8001       if (nextHtml != null) {
       
  8002         if (lastHtml !== nextHtml) {
       
  8003           (updatePayload = updatePayload || []).push(propKey, '' + nextHtml);
       
  8004         }
       
  8005       } else {
       
  8006         // TODO: It might be too late to clear this if we have children
       
  8007         // inserted already.
       
  8008       }
       
  8009     } else if (propKey === CHILDREN) {
       
  8010       if (lastProp !== nextProp && (typeof nextProp === 'string' || typeof nextProp === 'number')) {
       
  8011         (updatePayload = updatePayload || []).push(propKey, '' + nextProp);
       
  8012       }
       
  8013     } else if (propKey === SUPPRESS_CONTENT_EDITABLE_WARNING || propKey === SUPPRESS_HYDRATION_WARNING$1) {
       
  8014       // Noop
       
  8015     } else if (registrationNameModules.hasOwnProperty(propKey)) {
       
  8016       if (nextProp != null) {
       
  8017         // We eagerly listen to this even though we haven't committed yet.
       
  8018         if (true && typeof nextProp !== 'function') {
       
  8019           warnForInvalidEventListener(propKey, nextProp);
       
  8020         }
       
  8021         ensureListeningTo(rootContainerElement, propKey);
       
  8022       }
       
  8023       if (!updatePayload && lastProp !== nextProp) {
       
  8024         // This is a special case. If any listener updates we need to ensure
       
  8025         // that the "current" props pointer gets updated so we need a commit
       
  8026         // to update this element.
       
  8027         updatePayload = [];
       
  8028       }
       
  8029     } else {
       
  8030       // For any other property we always add it to the queue and then we
       
  8031       // filter it out using the whitelist during the commit.
       
  8032       (updatePayload = updatePayload || []).push(propKey, nextProp);
       
  8033     }
       
  8034   }
       
  8035   if (styleUpdates) {
       
  8036     {
       
  8037       validateShorthandPropertyCollisionInDev(styleUpdates, nextProps[STYLE$1]);
       
  8038     }
       
  8039     (updatePayload = updatePayload || []).push(STYLE$1, styleUpdates);
       
  8040   }
       
  8041   return updatePayload;
       
  8042 }
       
  8043 
       
  8044 // Apply the diff.
       
  8045 function updateProperties(domElement, updatePayload, tag, lastRawProps, nextRawProps) {
       
  8046   // Update checked *before* name.
       
  8047   // In the middle of an update, it is possible to have multiple checked.
       
  8048   // When a checked radio tries to change name, browser makes another radio's checked false.
       
  8049   if (tag === 'input' && nextRawProps.type === 'radio' && nextRawProps.name != null) {
       
  8050     updateChecked(domElement, nextRawProps);
       
  8051   }
       
  8052 
       
  8053   var wasCustomComponentTag = isCustomComponent(tag, lastRawProps);
       
  8054   var isCustomComponentTag = isCustomComponent(tag, nextRawProps);
       
  8055   // Apply the diff.
       
  8056   updateDOMProperties(domElement, updatePayload, wasCustomComponentTag, isCustomComponentTag);
       
  8057 
       
  8058   // TODO: Ensure that an update gets scheduled if any of the special props
       
  8059   // changed.
       
  8060   switch (tag) {
       
  8061     case 'input':
       
  8062       // Update the wrapper around inputs *after* updating props. This has to
       
  8063       // happen after `updateDOMProperties`. Otherwise HTML5 input validations
       
  8064       // raise warnings and prevent the new value from being assigned.
       
  8065       updateWrapper(domElement, nextRawProps);
       
  8066       break;
       
  8067     case 'textarea':
       
  8068       updateWrapper$1(domElement, nextRawProps);
       
  8069       break;
       
  8070     case 'select':
       
  8071       // <select> value update needs to occur after <option> children
       
  8072       // reconciliation
       
  8073       postUpdateWrapper(domElement, nextRawProps);
       
  8074       break;
       
  8075   }
       
  8076 }
       
  8077 
       
  8078 function getPossibleStandardName(propName) {
       
  8079   {
       
  8080     var lowerCasedName = propName.toLowerCase();
       
  8081     if (!possibleStandardNames.hasOwnProperty(lowerCasedName)) {
       
  8082       return null;
       
  8083     }
       
  8084     return possibleStandardNames[lowerCasedName] || null;
       
  8085   }
       
  8086   return null;
       
  8087 }
       
  8088 
       
  8089 function diffHydratedProperties(domElement, tag, rawProps, parentNamespace, rootContainerElement) {
       
  8090   var isCustomComponentTag = void 0;
       
  8091   var extraAttributeNames = void 0;
       
  8092 
       
  8093   {
       
  8094     suppressHydrationWarning = rawProps[SUPPRESS_HYDRATION_WARNING$1] === true;
       
  8095     isCustomComponentTag = isCustomComponent(tag, rawProps);
       
  8096     validatePropertiesInDevelopment(tag, rawProps);
       
  8097     if (isCustomComponentTag && !didWarnShadyDOM && domElement.shadyRoot) {
       
  8098       warning$1(false, '%s is using shady DOM. Using shady DOM with React can ' + 'cause things to break subtly.', getCurrentFiberOwnerNameInDevOrNull() || 'A component');
       
  8099       didWarnShadyDOM = true;
       
  8100     }
       
  8101   }
       
  8102 
       
  8103   // TODO: Make sure that we check isMounted before firing any of these events.
       
  8104   switch (tag) {
       
  8105     case 'iframe':
       
  8106     case 'object':
       
  8107       trapBubbledEvent(TOP_LOAD, domElement);
       
  8108       break;
       
  8109     case 'video':
       
  8110     case 'audio':
       
  8111       // Create listener for each media event
       
  8112       for (var i = 0; i < mediaEventTypes.length; i++) {
       
  8113         trapBubbledEvent(mediaEventTypes[i], domElement);
       
  8114       }
       
  8115       break;
       
  8116     case 'source':
       
  8117       trapBubbledEvent(TOP_ERROR, domElement);
       
  8118       break;
       
  8119     case 'img':
       
  8120     case 'image':
       
  8121     case 'link':
       
  8122       trapBubbledEvent(TOP_ERROR, domElement);
       
  8123       trapBubbledEvent(TOP_LOAD, domElement);
       
  8124       break;
       
  8125     case 'form':
       
  8126       trapBubbledEvent(TOP_RESET, domElement);
       
  8127       trapBubbledEvent(TOP_SUBMIT, domElement);
       
  8128       break;
       
  8129     case 'details':
       
  8130       trapBubbledEvent(TOP_TOGGLE, domElement);
       
  8131       break;
       
  8132     case 'input':
       
  8133       initWrapperState(domElement, rawProps);
       
  8134       trapBubbledEvent(TOP_INVALID, domElement);
       
  8135       // For controlled components we always need to ensure we're listening
       
  8136       // to onChange. Even if there is no listener.
       
  8137       ensureListeningTo(rootContainerElement, 'onChange');
       
  8138       break;
       
  8139     case 'option':
       
  8140       validateProps(domElement, rawProps);
       
  8141       break;
       
  8142     case 'select':
       
  8143       initWrapperState$1(domElement, rawProps);
       
  8144       trapBubbledEvent(TOP_INVALID, domElement);
       
  8145       // For controlled components we always need to ensure we're listening
       
  8146       // to onChange. Even if there is no listener.
       
  8147       ensureListeningTo(rootContainerElement, 'onChange');
       
  8148       break;
       
  8149     case 'textarea':
       
  8150       initWrapperState$2(domElement, rawProps);
       
  8151       trapBubbledEvent(TOP_INVALID, domElement);
       
  8152       // For controlled components we always need to ensure we're listening
       
  8153       // to onChange. Even if there is no listener.
       
  8154       ensureListeningTo(rootContainerElement, 'onChange');
       
  8155       break;
       
  8156   }
       
  8157 
       
  8158   assertValidProps(tag, rawProps);
       
  8159 
       
  8160   {
       
  8161     extraAttributeNames = new Set();
       
  8162     var attributes = domElement.attributes;
       
  8163     for (var _i = 0; _i < attributes.length; _i++) {
       
  8164       var name = attributes[_i].name.toLowerCase();
       
  8165       switch (name) {
       
  8166         // Built-in SSR attribute is whitelisted
       
  8167         case 'data-reactroot':
       
  8168           break;
       
  8169         // Controlled attributes are not validated
       
  8170         // TODO: Only ignore them on controlled tags.
       
  8171         case 'value':
       
  8172           break;
       
  8173         case 'checked':
       
  8174           break;
       
  8175         case 'selected':
       
  8176           break;
       
  8177         default:
       
  8178           // Intentionally use the original name.
       
  8179           // See discussion in https://github.com/facebook/react/pull/10676.
       
  8180           extraAttributeNames.add(attributes[_i].name);
       
  8181       }
       
  8182     }
       
  8183   }
       
  8184 
       
  8185   var updatePayload = null;
       
  8186   for (var propKey in rawProps) {
       
  8187     if (!rawProps.hasOwnProperty(propKey)) {
       
  8188       continue;
       
  8189     }
       
  8190     var nextProp = rawProps[propKey];
       
  8191     if (propKey === CHILDREN) {
       
  8192       // For text content children we compare against textContent. This
       
  8193       // might match additional HTML that is hidden when we read it using
       
  8194       // textContent. E.g. "foo" will match "f<span>oo</span>" but that still
       
  8195       // satisfies our requirement. Our requirement is not to produce perfect
       
  8196       // HTML and attributes. Ideally we should preserve structure but it's
       
  8197       // ok not to if the visible content is still enough to indicate what
       
  8198       // even listeners these nodes might be wired up to.
       
  8199       // TODO: Warn if there is more than a single textNode as a child.
       
  8200       // TODO: Should we use domElement.firstChild.nodeValue to compare?
       
  8201       if (typeof nextProp === 'string') {
       
  8202         if (domElement.textContent !== nextProp) {
       
  8203           if (true && !suppressHydrationWarning) {
       
  8204             warnForTextDifference(domElement.textContent, nextProp);
       
  8205           }
       
  8206           updatePayload = [CHILDREN, nextProp];
       
  8207         }
       
  8208       } else if (typeof nextProp === 'number') {
       
  8209         if (domElement.textContent !== '' + nextProp) {
       
  8210           if (true && !suppressHydrationWarning) {
       
  8211             warnForTextDifference(domElement.textContent, nextProp);
       
  8212           }
       
  8213           updatePayload = [CHILDREN, '' + nextProp];
       
  8214         }
       
  8215       }
       
  8216     } else if (registrationNameModules.hasOwnProperty(propKey)) {
       
  8217       if (nextProp != null) {
       
  8218         if (true && typeof nextProp !== 'function') {
       
  8219           warnForInvalidEventListener(propKey, nextProp);
       
  8220         }
       
  8221         ensureListeningTo(rootContainerElement, propKey);
       
  8222       }
       
  8223     } else if (true &&
       
  8224     // Convince Flow we've calculated it (it's DEV-only in this method.)
       
  8225     typeof isCustomComponentTag === 'boolean') {
       
  8226       // Validate that the properties correspond to their expected values.
       
  8227       var serverValue = void 0;
       
  8228       var propertyInfo = getPropertyInfo(propKey);
       
  8229       if (suppressHydrationWarning) {
       
  8230         // Don't bother comparing. We're ignoring all these warnings.
       
  8231       } else if (propKey === SUPPRESS_CONTENT_EDITABLE_WARNING || propKey === SUPPRESS_HYDRATION_WARNING$1 ||
       
  8232       // Controlled attributes are not validated
       
  8233       // TODO: Only ignore them on controlled tags.
       
  8234       propKey === 'value' || propKey === 'checked' || propKey === 'selected') {
       
  8235         // Noop
       
  8236       } else if (propKey === DANGEROUSLY_SET_INNER_HTML) {
       
  8237         var serverHTML = domElement.innerHTML;
       
  8238         var nextHtml = nextProp ? nextProp[HTML] : undefined;
       
  8239         var expectedHTML = normalizeHTML(domElement, nextHtml != null ? nextHtml : '');
       
  8240         if (expectedHTML !== serverHTML) {
       
  8241           warnForPropDifference(propKey, serverHTML, expectedHTML);
       
  8242         }
       
  8243       } else if (propKey === STYLE$1) {
       
  8244         // $FlowFixMe - Should be inferred as not undefined.
       
  8245         extraAttributeNames.delete(propKey);
       
  8246 
       
  8247         if (canDiffStyleForHydrationWarning) {
       
  8248           var expectedStyle = createDangerousStringForStyles(nextProp);
       
  8249           serverValue = domElement.getAttribute('style');
       
  8250           if (expectedStyle !== serverValue) {
       
  8251             warnForPropDifference(propKey, serverValue, expectedStyle);
       
  8252           }
       
  8253         }
       
  8254       } else if (isCustomComponentTag) {
       
  8255         // $FlowFixMe - Should be inferred as not undefined.
       
  8256         extraAttributeNames.delete(propKey.toLowerCase());
       
  8257         serverValue = getValueForAttribute(domElement, propKey, nextProp);
       
  8258 
       
  8259         if (nextProp !== serverValue) {
       
  8260           warnForPropDifference(propKey, serverValue, nextProp);
       
  8261         }
       
  8262       } else if (!shouldIgnoreAttribute(propKey, propertyInfo, isCustomComponentTag) && !shouldRemoveAttribute(propKey, nextProp, propertyInfo, isCustomComponentTag)) {
       
  8263         var isMismatchDueToBadCasing = false;
       
  8264         if (propertyInfo !== null) {
       
  8265           // $FlowFixMe - Should be inferred as not undefined.
       
  8266           extraAttributeNames.delete(propertyInfo.attributeName);
       
  8267           serverValue = getValueForProperty(domElement, propKey, nextProp, propertyInfo);
       
  8268         } else {
       
  8269           var ownNamespace = parentNamespace;
       
  8270           if (ownNamespace === HTML_NAMESPACE) {
       
  8271             ownNamespace = getIntrinsicNamespace(tag);
       
  8272           }
       
  8273           if (ownNamespace === HTML_NAMESPACE) {
       
  8274             // $FlowFixMe - Should be inferred as not undefined.
       
  8275             extraAttributeNames.delete(propKey.toLowerCase());
       
  8276           } else {
       
  8277             var standardName = getPossibleStandardName(propKey);
       
  8278             if (standardName !== null && standardName !== propKey) {
       
  8279               // If an SVG prop is supplied with bad casing, it will
       
  8280               // be successfully parsed from HTML, but will produce a mismatch
       
  8281               // (and would be incorrectly rendered on the client).
       
  8282               // However, we already warn about bad casing elsewhere.
       
  8283               // So we'll skip the misleading extra mismatch warning in this case.
       
  8284               isMismatchDueToBadCasing = true;
       
  8285               // $FlowFixMe - Should be inferred as not undefined.
       
  8286               extraAttributeNames.delete(standardName);
       
  8287             }
       
  8288             // $FlowFixMe - Should be inferred as not undefined.
       
  8289             extraAttributeNames.delete(propKey);
       
  8290           }
       
  8291           serverValue = getValueForAttribute(domElement, propKey, nextProp);
       
  8292         }
       
  8293 
       
  8294         if (nextProp !== serverValue && !isMismatchDueToBadCasing) {
       
  8295           warnForPropDifference(propKey, serverValue, nextProp);
       
  8296         }
       
  8297       }
       
  8298     }
       
  8299   }
       
  8300 
       
  8301   {
       
  8302     // $FlowFixMe - Should be inferred as not undefined.
       
  8303     if (extraAttributeNames.size > 0 && !suppressHydrationWarning) {
       
  8304       // $FlowFixMe - Should be inferred as not undefined.
       
  8305       warnForExtraAttributes(extraAttributeNames);
       
  8306     }
       
  8307   }
       
  8308 
       
  8309   switch (tag) {
       
  8310     case 'input':
       
  8311       // TODO: Make sure we check if this is still unmounted or do any clean
       
  8312       // up necessary since we never stop tracking anymore.
       
  8313       track(domElement);
       
  8314       postMountWrapper(domElement, rawProps, true);
       
  8315       break;
       
  8316     case 'textarea':
       
  8317       // TODO: Make sure we check if this is still unmounted or do any clean
       
  8318       // up necessary since we never stop tracking anymore.
       
  8319       track(domElement);
       
  8320       postMountWrapper$3(domElement, rawProps);
       
  8321       break;
       
  8322     case 'select':
       
  8323     case 'option':
       
  8324       // For input and textarea we current always set the value property at
       
  8325       // post mount to force it to diverge from attributes. However, for
       
  8326       // option and select we don't quite do the same thing and select
       
  8327       // is not resilient to the DOM state changing so we don't do that here.
       
  8328       // TODO: Consider not doing this for input and textarea.
       
  8329       break;
       
  8330     default:
       
  8331       if (typeof rawProps.onClick === 'function') {
       
  8332         // TODO: This cast may not be sound for SVG, MathML or custom elements.
       
  8333         trapClickOnNonInteractiveElement(domElement);
       
  8334       }
       
  8335       break;
       
  8336   }
       
  8337 
       
  8338   return updatePayload;
       
  8339 }
       
  8340 
       
  8341 function diffHydratedText(textNode, text) {
       
  8342   var isDifferent = textNode.nodeValue !== text;
       
  8343   return isDifferent;
       
  8344 }
       
  8345 
       
  8346 function warnForUnmatchedText(textNode, text) {
       
  8347   {
       
  8348     warnForTextDifference(textNode.nodeValue, text);
       
  8349   }
       
  8350 }
       
  8351 
       
  8352 function warnForDeletedHydratableElement(parentNode, child) {
       
  8353   {
       
  8354     if (didWarnInvalidHydration) {
       
  8355       return;
       
  8356     }
       
  8357     didWarnInvalidHydration = true;
       
  8358     warningWithoutStack$1(false, 'Did not expect server HTML to contain a <%s> in <%s>.', child.nodeName.toLowerCase(), parentNode.nodeName.toLowerCase());
       
  8359   }
       
  8360 }
       
  8361 
       
  8362 function warnForDeletedHydratableText(parentNode, child) {
       
  8363   {
       
  8364     if (didWarnInvalidHydration) {
       
  8365       return;
       
  8366     }
       
  8367     didWarnInvalidHydration = true;
       
  8368     warningWithoutStack$1(false, 'Did not expect server HTML to contain the text node "%s" in <%s>.', child.nodeValue, parentNode.nodeName.toLowerCase());
       
  8369   }
       
  8370 }
       
  8371 
       
  8372 function warnForInsertedHydratedElement(parentNode, tag, props) {
       
  8373   {
       
  8374     if (didWarnInvalidHydration) {
       
  8375       return;
       
  8376     }
       
  8377     didWarnInvalidHydration = true;
       
  8378     warningWithoutStack$1(false, 'Expected server HTML to contain a matching <%s> in <%s>.', tag, parentNode.nodeName.toLowerCase());
       
  8379   }
       
  8380 }
       
  8381 
       
  8382 function warnForInsertedHydratedText(parentNode, text) {
       
  8383   {
       
  8384     if (text === '') {
       
  8385       // We expect to insert empty text nodes since they're not represented in
       
  8386       // the HTML.
       
  8387       // TODO: Remove this special case if we can just avoid inserting empty
       
  8388       // text nodes.
       
  8389       return;
       
  8390     }
       
  8391     if (didWarnInvalidHydration) {
       
  8392       return;
       
  8393     }
       
  8394     didWarnInvalidHydration = true;
       
  8395     warningWithoutStack$1(false, 'Expected server HTML to contain a matching text node for "%s" in <%s>.', text, parentNode.nodeName.toLowerCase());
       
  8396   }
       
  8397 }
       
  8398 
       
  8399 function restoreControlledState$1(domElement, tag, props) {
       
  8400   switch (tag) {
       
  8401     case 'input':
       
  8402       restoreControlledState(domElement, props);
       
  8403       return;
       
  8404     case 'textarea':
       
  8405       restoreControlledState$3(domElement, props);
       
  8406       return;
       
  8407     case 'select':
       
  8408       restoreControlledState$2(domElement, props);
       
  8409       return;
       
  8410   }
       
  8411 }
       
  8412 
       
  8413 // TODO: direct imports like some-package/src/* are bad. Fix me.
       
  8414 var validateDOMNesting = function () {};
       
  8415 var updatedAncestorInfo = function () {};
       
  8416 
       
  8417 {
       
  8418   // This validation code was written based on the HTML5 parsing spec:
       
  8419   // https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-scope
       
  8420   //
       
  8421   // Note: this does not catch all invalid nesting, nor does it try to (as it's
       
  8422   // not clear what practical benefit doing so provides); instead, we warn only
       
  8423   // for cases where the parser will give a parse tree differing from what React
       
  8424   // intended. For example, <b><div></div></b> is invalid but we don't warn
       
  8425   // because it still parses correctly; we do warn for other cases like nested
       
  8426   // <p> tags where the beginning of the second element implicitly closes the
       
  8427   // first, causing a confusing mess.
       
  8428 
       
  8429   // https://html.spec.whatwg.org/multipage/syntax.html#special
       
  8430   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'];
       
  8431 
       
  8432   // https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-scope
       
  8433   var inScopeTags = ['applet', 'caption', 'html', 'table', 'td', 'th', 'marquee', 'object', 'template',
       
  8434 
       
  8435   // https://html.spec.whatwg.org/multipage/syntax.html#html-integration-point
       
  8436   // TODO: Distinguish by namespace here -- for <title>, including it here
       
  8437   // errs on the side of fewer warnings
       
  8438   'foreignObject', 'desc', 'title'];
       
  8439 
       
  8440   // https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-button-scope
       
  8441   var buttonScopeTags = inScopeTags.concat(['button']);
       
  8442 
       
  8443   // https://html.spec.whatwg.org/multipage/syntax.html#generate-implied-end-tags
       
  8444   var impliedEndTags = ['dd', 'dt', 'li', 'option', 'optgroup', 'p', 'rp', 'rt'];
       
  8445 
       
  8446   var emptyAncestorInfo = {
       
  8447     current: null,
       
  8448 
       
  8449     formTag: null,
       
  8450     aTagInScope: null,
       
  8451     buttonTagInScope: null,
       
  8452     nobrTagInScope: null,
       
  8453     pTagInButtonScope: null,
       
  8454 
       
  8455     listItemTagAutoclosing: null,
       
  8456     dlItemTagAutoclosing: null
       
  8457   };
       
  8458 
       
  8459   updatedAncestorInfo = function (oldInfo, tag) {
       
  8460     var ancestorInfo = _assign({}, oldInfo || emptyAncestorInfo);
       
  8461     var info = { tag: tag };
       
  8462 
       
  8463     if (inScopeTags.indexOf(tag) !== -1) {
       
  8464       ancestorInfo.aTagInScope = null;
       
  8465       ancestorInfo.buttonTagInScope = null;
       
  8466       ancestorInfo.nobrTagInScope = null;
       
  8467     }
       
  8468     if (buttonScopeTags.indexOf(tag) !== -1) {
       
  8469       ancestorInfo.pTagInButtonScope = null;
       
  8470     }
       
  8471 
       
  8472     // See rules for 'li', 'dd', 'dt' start tags in
       
  8473     // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inbody
       
  8474     if (specialTags.indexOf(tag) !== -1 && tag !== 'address' && tag !== 'div' && tag !== 'p') {
       
  8475       ancestorInfo.listItemTagAutoclosing = null;
       
  8476       ancestorInfo.dlItemTagAutoclosing = null;
       
  8477     }
       
  8478 
       
  8479     ancestorInfo.current = info;
       
  8480 
       
  8481     if (tag === 'form') {
       
  8482       ancestorInfo.formTag = info;
       
  8483     }
       
  8484     if (tag === 'a') {
       
  8485       ancestorInfo.aTagInScope = info;
       
  8486     }
       
  8487     if (tag === 'button') {
       
  8488       ancestorInfo.buttonTagInScope = info;
       
  8489     }
       
  8490     if (tag === 'nobr') {
       
  8491       ancestorInfo.nobrTagInScope = info;
       
  8492     }
       
  8493     if (tag === 'p') {
       
  8494       ancestorInfo.pTagInButtonScope = info;
       
  8495     }
       
  8496     if (tag === 'li') {
       
  8497       ancestorInfo.listItemTagAutoclosing = info;
       
  8498     }
       
  8499     if (tag === 'dd' || tag === 'dt') {
       
  8500       ancestorInfo.dlItemTagAutoclosing = info;
       
  8501     }
       
  8502 
       
  8503     return ancestorInfo;
       
  8504   };
       
  8505 
       
  8506   /**
       
  8507    * Returns whether
       
  8508    */
       
  8509   var isTagValidWithParent = function (tag, parentTag) {
       
  8510     // First, let's check if we're in an unusual parsing mode...
       
  8511     switch (parentTag) {
       
  8512       // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inselect
       
  8513       case 'select':
       
  8514         return tag === 'option' || tag === 'optgroup' || tag === '#text';
       
  8515       case 'optgroup':
       
  8516         return tag === 'option' || tag === '#text';
       
  8517       // Strictly speaking, seeing an <option> doesn't mean we're in a <select>
       
  8518       // but
       
  8519       case 'option':
       
  8520         return tag === '#text';
       
  8521       // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intd
       
  8522       // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-incaption
       
  8523       // No special behavior since these rules fall back to "in body" mode for
       
  8524       // all except special table nodes which cause bad parsing behavior anyway.
       
  8525 
       
  8526       // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intr
       
  8527       case 'tr':
       
  8528         return tag === 'th' || tag === 'td' || tag === 'style' || tag === 'script' || tag === 'template';
       
  8529       // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intbody
       
  8530       case 'tbody':
       
  8531       case 'thead':
       
  8532       case 'tfoot':
       
  8533         return tag === 'tr' || tag === 'style' || tag === 'script' || tag === 'template';
       
  8534       // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-incolgroup
       
  8535       case 'colgroup':
       
  8536         return tag === 'col' || tag === 'template';
       
  8537       // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intable
       
  8538       case 'table':
       
  8539         return tag === 'caption' || tag === 'colgroup' || tag === 'tbody' || tag === 'tfoot' || tag === 'thead' || tag === 'style' || tag === 'script' || tag === 'template';
       
  8540       // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inhead
       
  8541       case 'head':
       
  8542         return tag === 'base' || tag === 'basefont' || tag === 'bgsound' || tag === 'link' || tag === 'meta' || tag === 'title' || tag === 'noscript' || tag === 'noframes' || tag === 'style' || tag === 'script' || tag === 'template';
       
  8543       // https://html.spec.whatwg.org/multipage/semantics.html#the-html-element
       
  8544       case 'html':
       
  8545         return tag === 'head' || tag === 'body';
       
  8546       case '#document':
       
  8547         return tag === 'html';
       
  8548     }
       
  8549 
       
  8550     // Probably in the "in body" parsing mode, so we outlaw only tag combos
       
  8551     // where the parsing rules cause implicit opens or closes to be added.
       
  8552     // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inbody
       
  8553     switch (tag) {
       
  8554       case 'h1':
       
  8555       case 'h2':
       
  8556       case 'h3':
       
  8557       case 'h4':
       
  8558       case 'h5':
       
  8559       case 'h6':
       
  8560         return parentTag !== 'h1' && parentTag !== 'h2' && parentTag !== 'h3' && parentTag !== 'h4' && parentTag !== 'h5' && parentTag !== 'h6';
       
  8561 
       
  8562       case 'rp':
       
  8563       case 'rt':
       
  8564         return impliedEndTags.indexOf(parentTag) === -1;
       
  8565 
       
  8566       case 'body':
       
  8567       case 'caption':
       
  8568       case 'col':
       
  8569       case 'colgroup':
       
  8570       case 'frame':
       
  8571       case 'head':
       
  8572       case 'html':
       
  8573       case 'tbody':
       
  8574       case 'td':
       
  8575       case 'tfoot':
       
  8576       case 'th':
       
  8577       case 'thead':
       
  8578       case 'tr':
       
  8579         // These tags are only valid with a few parents that have special child
       
  8580         // parsing rules -- if we're down here, then none of those matched and
       
  8581         // so we allow it only if we don't know what the parent is, as all other
       
  8582         // cases are invalid.
       
  8583         return parentTag == null;
       
  8584     }
       
  8585 
       
  8586     return true;
       
  8587   };
       
  8588 
       
  8589   /**
       
  8590    * Returns whether
       
  8591    */
       
  8592   var findInvalidAncestorForTag = function (tag, ancestorInfo) {
       
  8593     switch (tag) {
       
  8594       case 'address':
       
  8595       case 'article':
       
  8596       case 'aside':
       
  8597       case 'blockquote':
       
  8598       case 'center':
       
  8599       case 'details':
       
  8600       case 'dialog':
       
  8601       case 'dir':
       
  8602       case 'div':
       
  8603       case 'dl':
       
  8604       case 'fieldset':
       
  8605       case 'figcaption':
       
  8606       case 'figure':
       
  8607       case 'footer':
       
  8608       case 'header':
       
  8609       case 'hgroup':
       
  8610       case 'main':
       
  8611       case 'menu':
       
  8612       case 'nav':
       
  8613       case 'ol':
       
  8614       case 'p':
       
  8615       case 'section':
       
  8616       case 'summary':
       
  8617       case 'ul':
       
  8618       case 'pre':
       
  8619       case 'listing':
       
  8620       case 'table':
       
  8621       case 'hr':
       
  8622       case 'xmp':
       
  8623       case 'h1':
       
  8624       case 'h2':
       
  8625       case 'h3':
       
  8626       case 'h4':
       
  8627       case 'h5':
       
  8628       case 'h6':
       
  8629         return ancestorInfo.pTagInButtonScope;
       
  8630 
       
  8631       case 'form':
       
  8632         return ancestorInfo.formTag || ancestorInfo.pTagInButtonScope;
       
  8633 
       
  8634       case 'li':
       
  8635         return ancestorInfo.listItemTagAutoclosing;
       
  8636 
       
  8637       case 'dd':
       
  8638       case 'dt':
       
  8639         return ancestorInfo.dlItemTagAutoclosing;
       
  8640 
       
  8641       case 'button':
       
  8642         return ancestorInfo.buttonTagInScope;
       
  8643 
       
  8644       case 'a':
       
  8645         // Spec says something about storing a list of markers, but it sounds
       
  8646         // equivalent to this check.
       
  8647         return ancestorInfo.aTagInScope;
       
  8648 
       
  8649       case 'nobr':
       
  8650         return ancestorInfo.nobrTagInScope;
       
  8651     }
       
  8652 
       
  8653     return null;
       
  8654   };
       
  8655 
       
  8656   var didWarn = {};
       
  8657 
       
  8658   validateDOMNesting = function (childTag, childText, ancestorInfo) {
       
  8659     ancestorInfo = ancestorInfo || emptyAncestorInfo;
       
  8660     var parentInfo = ancestorInfo.current;
       
  8661     var parentTag = parentInfo && parentInfo.tag;
       
  8662 
       
  8663     if (childText != null) {
       
  8664       !(childTag == null) ? warningWithoutStack$1(false, 'validateDOMNesting: when childText is passed, childTag should be null') : void 0;
       
  8665       childTag = '#text';
       
  8666     }
       
  8667 
       
  8668     var invalidParent = isTagValidWithParent(childTag, parentTag) ? null : parentInfo;
       
  8669     var invalidAncestor = invalidParent ? null : findInvalidAncestorForTag(childTag, ancestorInfo);
       
  8670     var invalidParentOrAncestor = invalidParent || invalidAncestor;
       
  8671     if (!invalidParentOrAncestor) {
       
  8672       return;
       
  8673     }
       
  8674 
       
  8675     var ancestorTag = invalidParentOrAncestor.tag;
       
  8676     var addendum = getCurrentFiberStackInDev();
       
  8677 
       
  8678     var warnKey = !!invalidParent + '|' + childTag + '|' + ancestorTag + '|' + addendum;
       
  8679     if (didWarn[warnKey]) {
       
  8680       return;
       
  8681     }
       
  8682     didWarn[warnKey] = true;
       
  8683 
       
  8684     var tagDisplayName = childTag;
       
  8685     var whitespaceInfo = '';
       
  8686     if (childTag === '#text') {
       
  8687       if (/\S/.test(childText)) {
       
  8688         tagDisplayName = 'Text nodes';
       
  8689       } else {
       
  8690         tagDisplayName = 'Whitespace text nodes';
       
  8691         whitespaceInfo = " Make sure you don't have any extra whitespace between tags on " + 'each line of your source code.';
       
  8692       }
       
  8693     } else {
       
  8694       tagDisplayName = '<' + childTag + '>';
       
  8695     }
       
  8696 
       
  8697     if (invalidParent) {
       
  8698       var info = '';
       
  8699       if (ancestorTag === 'table' && childTag === 'tr') {
       
  8700         info += ' Add a <tbody> to your code to match the DOM tree generated by ' + 'the browser.';
       
  8701       }
       
  8702       warningWithoutStack$1(false, 'validateDOMNesting(...): %s cannot appear as a child of <%s>.%s%s%s', tagDisplayName, ancestorTag, whitespaceInfo, info, addendum);
       
  8703     } else {
       
  8704       warningWithoutStack$1(false, 'validateDOMNesting(...): %s cannot appear as a descendant of ' + '<%s>.%s', tagDisplayName, ancestorTag, addendum);
       
  8705     }
       
  8706   };
       
  8707 }
       
  8708 
       
  8709 var ReactInternals$1 = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
       
  8710 
       
  8711 var _ReactInternals$Sched = ReactInternals$1.Scheduler;
       
  8712 var unstable_cancelCallback = _ReactInternals$Sched.unstable_cancelCallback;
       
  8713 var unstable_now = _ReactInternals$Sched.unstable_now;
       
  8714 var unstable_scheduleCallback = _ReactInternals$Sched.unstable_scheduleCallback;
       
  8715 var unstable_shouldYield = _ReactInternals$Sched.unstable_shouldYield;
       
  8716 var unstable_getFirstCallbackNode = _ReactInternals$Sched.unstable_getFirstCallbackNode;
       
  8717 var unstable_runWithPriority = _ReactInternals$Sched.unstable_runWithPriority;
       
  8718 var unstable_next = _ReactInternals$Sched.unstable_next;
       
  8719 var unstable_continueExecution = _ReactInternals$Sched.unstable_continueExecution;
       
  8720 var unstable_pauseExecution = _ReactInternals$Sched.unstable_pauseExecution;
       
  8721 var unstable_getCurrentPriorityLevel = _ReactInternals$Sched.unstable_getCurrentPriorityLevel;
       
  8722 var unstable_ImmediatePriority = _ReactInternals$Sched.unstable_ImmediatePriority;
       
  8723 var unstable_UserBlockingPriority = _ReactInternals$Sched.unstable_UserBlockingPriority;
       
  8724 var unstable_NormalPriority = _ReactInternals$Sched.unstable_NormalPriority;
       
  8725 var unstable_LowPriority = _ReactInternals$Sched.unstable_LowPriority;
       
  8726 var unstable_IdlePriority = _ReactInternals$Sched.unstable_IdlePriority;
       
  8727 
       
  8728 // Renderers that don't support persistence
       
  8729 // can re-export everything from this module.
       
  8730 
       
  8731 function shim() {
       
  8732   invariant(false, 'The current renderer does not support persistence. This error is likely caused by a bug in React. Please file an issue.');
       
  8733 }
       
  8734 
       
  8735 // Persistence (when unsupported)
       
  8736 var supportsPersistence = false;
       
  8737 var cloneInstance = shim;
       
  8738 var createContainerChildSet = shim;
       
  8739 var appendChildToContainerChildSet = shim;
       
  8740 var finalizeContainerChildren = shim;
       
  8741 var replaceContainerChildren = shim;
       
  8742 var cloneHiddenInstance = shim;
       
  8743 var cloneUnhiddenInstance = shim;
       
  8744 var createHiddenTextInstance = shim;
       
  8745 
       
  8746 var SUPPRESS_HYDRATION_WARNING = void 0;
       
  8747 {
       
  8748   SUPPRESS_HYDRATION_WARNING = 'suppressHydrationWarning';
       
  8749 }
       
  8750 
       
  8751 var SUSPENSE_START_DATA = '$';
       
  8752 var SUSPENSE_END_DATA = '/$';
       
  8753 
       
  8754 var STYLE = 'style';
       
  8755 
       
  8756 var eventsEnabled = null;
       
  8757 var selectionInformation = null;
       
  8758 
       
  8759 function shouldAutoFocusHostComponent(type, props) {
       
  8760   switch (type) {
       
  8761     case 'button':
       
  8762     case 'input':
       
  8763     case 'select':
       
  8764     case 'textarea':
       
  8765       return !!props.autoFocus;
       
  8766   }
       
  8767   return false;
       
  8768 }
       
  8769 
       
  8770 function getRootHostContext(rootContainerInstance) {
       
  8771   var type = void 0;
       
  8772   var namespace = void 0;
       
  8773   var nodeType = rootContainerInstance.nodeType;
       
  8774   switch (nodeType) {
       
  8775     case DOCUMENT_NODE:
       
  8776     case DOCUMENT_FRAGMENT_NODE:
       
  8777       {
       
  8778         type = nodeType === DOCUMENT_NODE ? '#document' : '#fragment';
       
  8779         var root = rootContainerInstance.documentElement;
       
  8780         namespace = root ? root.namespaceURI : getChildNamespace(null, '');
       
  8781         break;
       
  8782       }
       
  8783     default:
       
  8784       {
       
  8785         var container = nodeType === COMMENT_NODE ? rootContainerInstance.parentNode : rootContainerInstance;
       
  8786         var ownNamespace = container.namespaceURI || null;
       
  8787         type = container.tagName;
       
  8788         namespace = getChildNamespace(ownNamespace, type);
       
  8789         break;
       
  8790       }
       
  8791   }
       
  8792   {
       
  8793     var validatedTag = type.toLowerCase();
       
  8794     var _ancestorInfo = updatedAncestorInfo(null, validatedTag);
       
  8795     return { namespace: namespace, ancestorInfo: _ancestorInfo };
       
  8796   }
       
  8797   return namespace;
       
  8798 }
       
  8799 
       
  8800 function getChildHostContext(parentHostContext, type, rootContainerInstance) {
       
  8801   {
       
  8802     var parentHostContextDev = parentHostContext;
       
  8803     var _namespace = getChildNamespace(parentHostContextDev.namespace, type);
       
  8804     var _ancestorInfo2 = updatedAncestorInfo(parentHostContextDev.ancestorInfo, type);
       
  8805     return { namespace: _namespace, ancestorInfo: _ancestorInfo2 };
       
  8806   }
       
  8807   var parentNamespace = parentHostContext;
       
  8808   return getChildNamespace(parentNamespace, type);
       
  8809 }
       
  8810 
       
  8811 function getPublicInstance(instance) {
       
  8812   return instance;
       
  8813 }
       
  8814 
       
  8815 function prepareForCommit(containerInfo) {
       
  8816   eventsEnabled = isEnabled();
       
  8817   selectionInformation = getSelectionInformation();
       
  8818   setEnabled(false);
       
  8819 }
       
  8820 
       
  8821 function resetAfterCommit(containerInfo) {
       
  8822   restoreSelection(selectionInformation);
       
  8823   selectionInformation = null;
       
  8824   setEnabled(eventsEnabled);
       
  8825   eventsEnabled = null;
       
  8826 }
       
  8827 
       
  8828 function createInstance(type, props, rootContainerInstance, hostContext, internalInstanceHandle) {
       
  8829   var parentNamespace = void 0;
       
  8830   {
       
  8831     // TODO: take namespace into account when validating.
       
  8832     var hostContextDev = hostContext;
       
  8833     validateDOMNesting(type, null, hostContextDev.ancestorInfo);
       
  8834     if (typeof props.children === 'string' || typeof props.children === 'number') {
       
  8835       var string = '' + props.children;
       
  8836       var ownAncestorInfo = updatedAncestorInfo(hostContextDev.ancestorInfo, type);
       
  8837       validateDOMNesting(null, string, ownAncestorInfo);
       
  8838     }
       
  8839     parentNamespace = hostContextDev.namespace;
       
  8840   }
       
  8841   var domElement = createElement(type, props, rootContainerInstance, parentNamespace);
       
  8842   precacheFiberNode(internalInstanceHandle, domElement);
       
  8843   updateFiberProps(domElement, props);
       
  8844   return domElement;
       
  8845 }
       
  8846 
       
  8847 function appendInitialChild(parentInstance, child) {
       
  8848   parentInstance.appendChild(child);
       
  8849 }
       
  8850 
       
  8851 function finalizeInitialChildren(domElement, type, props, rootContainerInstance, hostContext) {
       
  8852   setInitialProperties(domElement, type, props, rootContainerInstance);
       
  8853   return shouldAutoFocusHostComponent(type, props);
       
  8854 }
       
  8855 
       
  8856 function prepareUpdate(domElement, type, oldProps, newProps, rootContainerInstance, hostContext) {
       
  8857   {
       
  8858     var hostContextDev = hostContext;
       
  8859     if (typeof newProps.children !== typeof oldProps.children && (typeof newProps.children === 'string' || typeof newProps.children === 'number')) {
       
  8860       var string = '' + newProps.children;
       
  8861       var ownAncestorInfo = updatedAncestorInfo(hostContextDev.ancestorInfo, type);
       
  8862       validateDOMNesting(null, string, ownAncestorInfo);
       
  8863     }
       
  8864   }
       
  8865   return diffProperties(domElement, type, oldProps, newProps, rootContainerInstance);
       
  8866 }
       
  8867 
       
  8868 function shouldSetTextContent(type, props) {
       
  8869   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;
       
  8870 }
       
  8871 
       
  8872 function shouldDeprioritizeSubtree(type, props) {
       
  8873   return !!props.hidden;
       
  8874 }
       
  8875 
       
  8876 function createTextInstance(text, rootContainerInstance, hostContext, internalInstanceHandle) {
       
  8877   {
       
  8878     var hostContextDev = hostContext;
       
  8879     validateDOMNesting(null, text, hostContextDev.ancestorInfo);
       
  8880   }
       
  8881   var textNode = createTextNode(text, rootContainerInstance);
       
  8882   precacheFiberNode(internalInstanceHandle, textNode);
       
  8883   return textNode;
       
  8884 }
       
  8885 
       
  8886 var isPrimaryRenderer = true;
       
  8887 // This initialization code may run even on server environments
       
  8888 // if a component just imports ReactDOM (e.g. for findDOMNode).
       
  8889 // Some environments might not have setTimeout or clearTimeout.
       
  8890 var scheduleTimeout = typeof setTimeout === 'function' ? setTimeout : undefined;
       
  8891 var cancelTimeout = typeof clearTimeout === 'function' ? clearTimeout : undefined;
       
  8892 var noTimeout = -1;
       
  8893 var schedulePassiveEffects = unstable_scheduleCallback;
       
  8894 var cancelPassiveEffects = unstable_cancelCallback;
       
  8895 
       
  8896 // -------------------
       
  8897 //     Mutation
       
  8898 // -------------------
       
  8899 
       
  8900 var supportsMutation = true;
       
  8901 
       
  8902 function commitMount(domElement, type, newProps, internalInstanceHandle) {
       
  8903   // Despite the naming that might imply otherwise, this method only
       
  8904   // fires if there is an `Update` effect scheduled during mounting.
       
  8905   // This happens if `finalizeInitialChildren` returns `true` (which it
       
  8906   // does to implement the `autoFocus` attribute on the client). But
       
  8907   // there are also other cases when this might happen (such as patching
       
  8908   // up text content during hydration mismatch). So we'll check this again.
       
  8909   if (shouldAutoFocusHostComponent(type, newProps)) {
       
  8910     domElement.focus();
       
  8911   }
       
  8912 }
       
  8913 
       
  8914 function commitUpdate(domElement, updatePayload, type, oldProps, newProps, internalInstanceHandle) {
       
  8915   // Update the props handle so that we know which props are the ones with
       
  8916   // with current event handlers.
       
  8917   updateFiberProps(domElement, newProps);
       
  8918   // Apply the diff to the DOM node.
       
  8919   updateProperties(domElement, updatePayload, type, oldProps, newProps);
       
  8920 }
       
  8921 
       
  8922 function resetTextContent(domElement) {
       
  8923   setTextContent(domElement, '');
       
  8924 }
       
  8925 
       
  8926 function commitTextUpdate(textInstance, oldText, newText) {
       
  8927   textInstance.nodeValue = newText;
       
  8928 }
       
  8929 
       
  8930 function appendChild(parentInstance, child) {
       
  8931   parentInstance.appendChild(child);
       
  8932 }
       
  8933 
       
  8934 function appendChildToContainer(container, child) {
       
  8935   var parentNode = void 0;
       
  8936   if (container.nodeType === COMMENT_NODE) {
       
  8937     parentNode = container.parentNode;
       
  8938     parentNode.insertBefore(child, container);
       
  8939   } else {
       
  8940     parentNode = container;
       
  8941     parentNode.appendChild(child);
       
  8942   }
       
  8943   // This container might be used for a portal.
       
  8944   // If something inside a portal is clicked, that click should bubble
       
  8945   // through the React tree. However, on Mobile Safari the click would
       
  8946   // never bubble through the *DOM* tree unless an ancestor with onclick
       
  8947   // event exists. So we wouldn't see it and dispatch it.
       
  8948   // This is why we ensure that non React root containers have inline onclick
       
  8949   // defined.
       
  8950   // https://github.com/facebook/react/issues/11918
       
  8951   var reactRootContainer = container._reactRootContainer;
       
  8952   if ((reactRootContainer === null || reactRootContainer === undefined) && parentNode.onclick === null) {
       
  8953     // TODO: This cast may not be sound for SVG, MathML or custom elements.
       
  8954     trapClickOnNonInteractiveElement(parentNode);
       
  8955   }
       
  8956 }
       
  8957 
       
  8958 function insertBefore(parentInstance, child, beforeChild) {
       
  8959   parentInstance.insertBefore(child, beforeChild);
       
  8960 }
       
  8961 
       
  8962 function insertInContainerBefore(container, child, beforeChild) {
       
  8963   if (container.nodeType === COMMENT_NODE) {
       
  8964     container.parentNode.insertBefore(child, beforeChild);
       
  8965   } else {
       
  8966     container.insertBefore(child, beforeChild);
       
  8967   }
       
  8968 }
       
  8969 
       
  8970 function removeChild(parentInstance, child) {
       
  8971   parentInstance.removeChild(child);
       
  8972 }
       
  8973 
       
  8974 function removeChildFromContainer(container, child) {
       
  8975   if (container.nodeType === COMMENT_NODE) {
       
  8976     container.parentNode.removeChild(child);
       
  8977   } else {
       
  8978     container.removeChild(child);
       
  8979   }
       
  8980 }
       
  8981 
       
  8982 function clearSuspenseBoundary(parentInstance, suspenseInstance) {
       
  8983   var node = suspenseInstance;
       
  8984   // Delete all nodes within this suspense boundary.
       
  8985   // There might be nested nodes so we need to keep track of how
       
  8986   // deep we are and only break out when we're back on top.
       
  8987   var depth = 0;
       
  8988   do {
       
  8989     var nextNode = node.nextSibling;
       
  8990     parentInstance.removeChild(node);
       
  8991     if (nextNode && nextNode.nodeType === COMMENT_NODE) {
       
  8992       var data = nextNode.data;
       
  8993       if (data === SUSPENSE_END_DATA) {
       
  8994         if (depth === 0) {
       
  8995           parentInstance.removeChild(nextNode);
       
  8996           return;
       
  8997         } else {
       
  8998           depth--;
       
  8999         }
       
  9000       } else if (data === SUSPENSE_START_DATA) {
       
  9001         depth++;
       
  9002       }
       
  9003     }
       
  9004     node = nextNode;
       
  9005   } while (node);
       
  9006   // TODO: Warn, we didn't find the end comment boundary.
       
  9007 }
       
  9008 
       
  9009 function clearSuspenseBoundaryFromContainer(container, suspenseInstance) {
       
  9010   if (container.nodeType === COMMENT_NODE) {
       
  9011     clearSuspenseBoundary(container.parentNode, suspenseInstance);
       
  9012   } else if (container.nodeType === ELEMENT_NODE) {
       
  9013     clearSuspenseBoundary(container, suspenseInstance);
       
  9014   } else {
       
  9015     // Document nodes should never contain suspense boundaries.
       
  9016   }
       
  9017 }
       
  9018 
       
  9019 function hideInstance(instance) {
       
  9020   // TODO: Does this work for all element types? What about MathML? Should we
       
  9021   // pass host context to this method?
       
  9022   instance = instance;
       
  9023   instance.style.display = 'none';
       
  9024 }
       
  9025 
       
  9026 function hideTextInstance(textInstance) {
       
  9027   textInstance.nodeValue = '';
       
  9028 }
       
  9029 
       
  9030 function unhideInstance(instance, props) {
       
  9031   instance = instance;
       
  9032   var styleProp = props[STYLE];
       
  9033   var display = styleProp !== undefined && styleProp !== null && styleProp.hasOwnProperty('display') ? styleProp.display : null;
       
  9034   instance.style.display = dangerousStyleValue('display', display);
       
  9035 }
       
  9036 
       
  9037 function unhideTextInstance(textInstance, text) {
       
  9038   textInstance.nodeValue = text;
       
  9039 }
       
  9040 
       
  9041 // -------------------
       
  9042 //     Hydration
       
  9043 // -------------------
       
  9044 
       
  9045 var supportsHydration = true;
       
  9046 
       
  9047 function canHydrateInstance(instance, type, props) {
       
  9048   if (instance.nodeType !== ELEMENT_NODE || type.toLowerCase() !== instance.nodeName.toLowerCase()) {
       
  9049     return null;
       
  9050   }
       
  9051   // This has now been refined to an element node.
       
  9052   return instance;
       
  9053 }
       
  9054 
       
  9055 function canHydrateTextInstance(instance, text) {
       
  9056   if (text === '' || instance.nodeType !== TEXT_NODE) {
       
  9057     // Empty strings are not parsed by HTML so there won't be a correct match here.
       
  9058     return null;
       
  9059   }
       
  9060   // This has now been refined to a text node.
       
  9061   return instance;
       
  9062 }
       
  9063 
       
  9064 function canHydrateSuspenseInstance(instance) {
       
  9065   if (instance.nodeType !== COMMENT_NODE) {
       
  9066     // Empty strings are not parsed by HTML so there won't be a correct match here.
       
  9067     return null;
       
  9068   }
       
  9069   // This has now been refined to a suspense node.
       
  9070   return instance;
       
  9071 }
       
  9072 
       
  9073 function getNextHydratableSibling(instance) {
       
  9074   var node = instance.nextSibling;
       
  9075   // Skip non-hydratable nodes.
       
  9076   while (node && node.nodeType !== ELEMENT_NODE && node.nodeType !== TEXT_NODE && (!enableSuspenseServerRenderer || node.nodeType !== COMMENT_NODE || node.data !== SUSPENSE_START_DATA)) {
       
  9077     node = node.nextSibling;
       
  9078   }
       
  9079   return node;
       
  9080 }
       
  9081 
       
  9082 function getFirstHydratableChild(parentInstance) {
       
  9083   var next = parentInstance.firstChild;
       
  9084   // Skip non-hydratable nodes.
       
  9085   while (next && next.nodeType !== ELEMENT_NODE && next.nodeType !== TEXT_NODE && (!enableSuspenseServerRenderer || next.nodeType !== COMMENT_NODE || next.data !== SUSPENSE_START_DATA)) {
       
  9086     next = next.nextSibling;
       
  9087   }
       
  9088   return next;
       
  9089 }
       
  9090 
       
  9091 function hydrateInstance(instance, type, props, rootContainerInstance, hostContext, internalInstanceHandle) {
       
  9092   precacheFiberNode(internalInstanceHandle, instance);
       
  9093   // TODO: Possibly defer this until the commit phase where all the events
       
  9094   // get attached.
       
  9095   updateFiberProps(instance, props);
       
  9096   var parentNamespace = void 0;
       
  9097   {
       
  9098     var hostContextDev = hostContext;
       
  9099     parentNamespace = hostContextDev.namespace;
       
  9100   }
       
  9101   return diffHydratedProperties(instance, type, props, parentNamespace, rootContainerInstance);
       
  9102 }
       
  9103 
       
  9104 function hydrateTextInstance(textInstance, text, internalInstanceHandle) {
       
  9105   precacheFiberNode(internalInstanceHandle, textInstance);
       
  9106   return diffHydratedText(textInstance, text);
       
  9107 }
       
  9108 
       
  9109 function getNextHydratableInstanceAfterSuspenseInstance(suspenseInstance) {
       
  9110   var node = suspenseInstance.nextSibling;
       
  9111   // Skip past all nodes within this suspense boundary.
       
  9112   // There might be nested nodes so we need to keep track of how
       
  9113   // deep we are and only break out when we're back on top.
       
  9114   var depth = 0;
       
  9115   while (node) {
       
  9116     if (node.nodeType === COMMENT_NODE) {
       
  9117       var data = node.data;
       
  9118       if (data === SUSPENSE_END_DATA) {
       
  9119         if (depth === 0) {
       
  9120           return getNextHydratableSibling(node);
       
  9121         } else {
       
  9122           depth--;
       
  9123         }
       
  9124       } else if (data === SUSPENSE_START_DATA) {
       
  9125         depth++;
       
  9126       }
       
  9127     }
       
  9128     node = node.nextSibling;
       
  9129   }
       
  9130   // TODO: Warn, we didn't find the end comment boundary.
       
  9131   return null;
       
  9132 }
       
  9133 
       
  9134 function didNotMatchHydratedContainerTextInstance(parentContainer, textInstance, text) {
       
  9135   {
       
  9136     warnForUnmatchedText(textInstance, text);
       
  9137   }
       
  9138 }
       
  9139 
       
  9140 function didNotMatchHydratedTextInstance(parentType, parentProps, parentInstance, textInstance, text) {
       
  9141   if (true && parentProps[SUPPRESS_HYDRATION_WARNING] !== true) {
       
  9142     warnForUnmatchedText(textInstance, text);
       
  9143   }
       
  9144 }
       
  9145 
       
  9146 function didNotHydrateContainerInstance(parentContainer, instance) {
       
  9147   {
       
  9148     if (instance.nodeType === ELEMENT_NODE) {
       
  9149       warnForDeletedHydratableElement(parentContainer, instance);
       
  9150     } else if (instance.nodeType === COMMENT_NODE) {
       
  9151       // TODO: warnForDeletedHydratableSuspenseBoundary
       
  9152     } else {
       
  9153       warnForDeletedHydratableText(parentContainer, instance);
       
  9154     }
       
  9155   }
       
  9156 }
       
  9157 
       
  9158 function didNotHydrateInstance(parentType, parentProps, parentInstance, instance) {
       
  9159   if (true && parentProps[SUPPRESS_HYDRATION_WARNING] !== true) {
       
  9160     if (instance.nodeType === ELEMENT_NODE) {
       
  9161       warnForDeletedHydratableElement(parentInstance, instance);
       
  9162     } else if (instance.nodeType === COMMENT_NODE) {
       
  9163       // TODO: warnForDeletedHydratableSuspenseBoundary
       
  9164     } else {
       
  9165       warnForDeletedHydratableText(parentInstance, instance);
       
  9166     }
       
  9167   }
       
  9168 }
       
  9169 
       
  9170 function didNotFindHydratableContainerInstance(parentContainer, type, props) {
       
  9171   {
       
  9172     warnForInsertedHydratedElement(parentContainer, type, props);
       
  9173   }
       
  9174 }
       
  9175 
       
  9176 function didNotFindHydratableContainerTextInstance(parentContainer, text) {
       
  9177   {
       
  9178     warnForInsertedHydratedText(parentContainer, text);
       
  9179   }
       
  9180 }
       
  9181 
       
  9182 
       
  9183 
       
  9184 function didNotFindHydratableInstance(parentType, parentProps, parentInstance, type, props) {
       
  9185   if (true && parentProps[SUPPRESS_HYDRATION_WARNING] !== true) {
       
  9186     warnForInsertedHydratedElement(parentInstance, type, props);
       
  9187   }
       
  9188 }
       
  9189 
       
  9190 function didNotFindHydratableTextInstance(parentType, parentProps, parentInstance, text) {
       
  9191   if (true && parentProps[SUPPRESS_HYDRATION_WARNING] !== true) {
       
  9192     warnForInsertedHydratedText(parentInstance, text);
       
  9193   }
       
  9194 }
       
  9195 
       
  9196 function didNotFindHydratableSuspenseInstance(parentType, parentProps, parentInstance) {
       
  9197   if (true && parentProps[SUPPRESS_HYDRATION_WARNING] !== true) {
       
  9198     // TODO: warnForInsertedHydratedSuspense(parentInstance);
       
  9199   }
       
  9200 }
       
  9201 
       
  9202 // Prefix measurements so that it's possible to filter them.
       
  9203 // Longer prefixes are hard to read in DevTools.
       
  9204 var reactEmoji = '\u269B';
       
  9205 var warningEmoji = '\u26D4';
       
  9206 var supportsUserTiming = typeof performance !== 'undefined' && typeof performance.mark === 'function' && typeof performance.clearMarks === 'function' && typeof performance.measure === 'function' && typeof performance.clearMeasures === 'function';
       
  9207 
       
  9208 // Keep track of current fiber so that we know the path to unwind on pause.
       
  9209 // TODO: this looks the same as nextUnitOfWork in scheduler. Can we unify them?
       
  9210 var currentFiber = null;
       
  9211 // If we're in the middle of user code, which fiber and method is it?
       
  9212 // Reusing `currentFiber` would be confusing for this because user code fiber
       
  9213 // can change during commit phase too, but we don't need to unwind it (since
       
  9214 // lifecycles in the commit phase don't resemble a tree).
       
  9215 var currentPhase = null;
       
  9216 var currentPhaseFiber = null;
       
  9217 // Did lifecycle hook schedule an update? This is often a performance problem,
       
  9218 // so we will keep track of it, and include it in the report.
       
  9219 // Track commits caused by cascading updates.
       
  9220 var isCommitting = false;
       
  9221 var hasScheduledUpdateInCurrentCommit = false;
       
  9222 var hasScheduledUpdateInCurrentPhase = false;
       
  9223 var commitCountInCurrentWorkLoop = 0;
       
  9224 var effectCountInCurrentCommit = 0;
       
  9225 var isWaitingForCallback = false;
       
  9226 // During commits, we only show a measurement once per method name
       
  9227 // to avoid stretch the commit phase with measurement overhead.
       
  9228 var labelsInCurrentCommit = new Set();
       
  9229 
       
  9230 var formatMarkName = function (markName) {
       
  9231   return reactEmoji + ' ' + markName;
       
  9232 };
       
  9233 
       
  9234 var formatLabel = function (label, warning) {
       
  9235   var prefix = warning ? warningEmoji + ' ' : reactEmoji + ' ';
       
  9236   var suffix = warning ? ' Warning: ' + warning : '';
       
  9237   return '' + prefix + label + suffix;
       
  9238 };
       
  9239 
       
  9240 var beginMark = function (markName) {
       
  9241   performance.mark(formatMarkName(markName));
       
  9242 };
       
  9243 
       
  9244 var clearMark = function (markName) {
       
  9245   performance.clearMarks(formatMarkName(markName));
       
  9246 };
       
  9247 
       
  9248 var endMark = function (label, markName, warning) {
       
  9249   var formattedMarkName = formatMarkName(markName);
       
  9250   var formattedLabel = formatLabel(label, warning);
       
  9251   try {
       
  9252     performance.measure(formattedLabel, formattedMarkName);
       
  9253   } catch (err) {}
       
  9254   // If previous mark was missing for some reason, this will throw.
       
  9255   // This could only happen if React crashed in an unexpected place earlier.
       
  9256   // Don't pile on with more errors.
       
  9257 
       
  9258   // Clear marks immediately to avoid growing buffer.
       
  9259   performance.clearMarks(formattedMarkName);
       
  9260   performance.clearMeasures(formattedLabel);
       
  9261 };
       
  9262 
       
  9263 var getFiberMarkName = function (label, debugID) {
       
  9264   return label + ' (#' + debugID + ')';
       
  9265 };
       
  9266 
       
  9267 var getFiberLabel = function (componentName, isMounted, phase) {
       
  9268   if (phase === null) {
       
  9269     // These are composite component total time measurements.
       
  9270     return componentName + ' [' + (isMounted ? 'update' : 'mount') + ']';
       
  9271   } else {
       
  9272     // Composite component methods.
       
  9273     return componentName + '.' + phase;
       
  9274   }
       
  9275 };
       
  9276 
       
  9277 var beginFiberMark = function (fiber, phase) {
       
  9278   var componentName = getComponentName(fiber.type) || 'Unknown';
       
  9279   var debugID = fiber._debugID;
       
  9280   var isMounted = fiber.alternate !== null;
       
  9281   var label = getFiberLabel(componentName, isMounted, phase);
       
  9282 
       
  9283   if (isCommitting && labelsInCurrentCommit.has(label)) {
       
  9284     // During the commit phase, we don't show duplicate labels because
       
  9285     // there is a fixed overhead for every measurement, and we don't
       
  9286     // want to stretch the commit phase beyond necessary.
       
  9287     return false;
       
  9288   }
       
  9289   labelsInCurrentCommit.add(label);
       
  9290 
       
  9291   var markName = getFiberMarkName(label, debugID);
       
  9292   beginMark(markName);
       
  9293   return true;
       
  9294 };
       
  9295 
       
  9296 var clearFiberMark = function (fiber, phase) {
       
  9297   var componentName = getComponentName(fiber.type) || 'Unknown';
       
  9298   var debugID = fiber._debugID;
       
  9299   var isMounted = fiber.alternate !== null;
       
  9300   var label = getFiberLabel(componentName, isMounted, phase);
       
  9301   var markName = getFiberMarkName(label, debugID);
       
  9302   clearMark(markName);
       
  9303 };
       
  9304 
       
  9305 var endFiberMark = function (fiber, phase, warning) {
       
  9306   var componentName = getComponentName(fiber.type) || 'Unknown';
       
  9307   var debugID = fiber._debugID;
       
  9308   var isMounted = fiber.alternate !== null;
       
  9309   var label = getFiberLabel(componentName, isMounted, phase);
       
  9310   var markName = getFiberMarkName(label, debugID);
       
  9311   endMark(label, markName, warning);
       
  9312 };
       
  9313 
       
  9314 var shouldIgnoreFiber = function (fiber) {
       
  9315   // Host components should be skipped in the timeline.
       
  9316   // We could check typeof fiber.type, but does this work with RN?
       
  9317   switch (fiber.tag) {
       
  9318     case HostRoot:
       
  9319     case HostComponent:
       
  9320     case HostText:
       
  9321     case HostPortal:
       
  9322     case Fragment:
       
  9323     case ContextProvider:
       
  9324     case ContextConsumer:
       
  9325     case Mode:
       
  9326       return true;
       
  9327     default:
       
  9328       return false;
       
  9329   }
       
  9330 };
       
  9331 
       
  9332 var clearPendingPhaseMeasurement = function () {
       
  9333   if (currentPhase !== null && currentPhaseFiber !== null) {
       
  9334     clearFiberMark(currentPhaseFiber, currentPhase);
       
  9335   }
       
  9336   currentPhaseFiber = null;
       
  9337   currentPhase = null;
       
  9338   hasScheduledUpdateInCurrentPhase = false;
       
  9339 };
       
  9340 
       
  9341 var pauseTimers = function () {
       
  9342   // Stops all currently active measurements so that they can be resumed
       
  9343   // if we continue in a later deferred loop from the same unit of work.
       
  9344   var fiber = currentFiber;
       
  9345   while (fiber) {
       
  9346     if (fiber._debugIsCurrentlyTiming) {
       
  9347       endFiberMark(fiber, null, null);
       
  9348     }
       
  9349     fiber = fiber.return;
       
  9350   }
       
  9351 };
       
  9352 
       
  9353 var resumeTimersRecursively = function (fiber) {
       
  9354   if (fiber.return !== null) {
       
  9355     resumeTimersRecursively(fiber.return);
       
  9356   }
       
  9357   if (fiber._debugIsCurrentlyTiming) {
       
  9358     beginFiberMark(fiber, null);
       
  9359   }
       
  9360 };
       
  9361 
       
  9362 var resumeTimers = function () {
       
  9363   // Resumes all measurements that were active during the last deferred loop.
       
  9364   if (currentFiber !== null) {
       
  9365     resumeTimersRecursively(currentFiber);
       
  9366   }
       
  9367 };
       
  9368 
       
  9369 function recordEffect() {
       
  9370   if (enableUserTimingAPI) {
       
  9371     effectCountInCurrentCommit++;
       
  9372   }
       
  9373 }
       
  9374 
       
  9375 function recordScheduleUpdate() {
       
  9376   if (enableUserTimingAPI) {
       
  9377     if (isCommitting) {
       
  9378       hasScheduledUpdateInCurrentCommit = true;
       
  9379     }
       
  9380     if (currentPhase !== null && currentPhase !== 'componentWillMount' && currentPhase !== 'componentWillReceiveProps') {
       
  9381       hasScheduledUpdateInCurrentPhase = true;
       
  9382     }
       
  9383   }
       
  9384 }
       
  9385 
       
  9386 function startRequestCallbackTimer() {
       
  9387   if (enableUserTimingAPI) {
       
  9388     if (supportsUserTiming && !isWaitingForCallback) {
       
  9389       isWaitingForCallback = true;
       
  9390       beginMark('(Waiting for async callback...)');
       
  9391     }
       
  9392   }
       
  9393 }
       
  9394 
       
  9395 function stopRequestCallbackTimer(didExpire, expirationTime) {
       
  9396   if (enableUserTimingAPI) {
       
  9397     if (supportsUserTiming) {
       
  9398       isWaitingForCallback = false;
       
  9399       var warning = didExpire ? 'React was blocked by main thread' : null;
       
  9400       endMark('(Waiting for async callback... will force flush in ' + expirationTime + ' ms)', '(Waiting for async callback...)', warning);
       
  9401     }
       
  9402   }
       
  9403 }
       
  9404 
       
  9405 function startWorkTimer(fiber) {
       
  9406   if (enableUserTimingAPI) {
       
  9407     if (!supportsUserTiming || shouldIgnoreFiber(fiber)) {
       
  9408       return;
       
  9409     }
       
  9410     // If we pause, this is the fiber to unwind from.
       
  9411     currentFiber = fiber;
       
  9412     if (!beginFiberMark(fiber, null)) {
       
  9413       return;
       
  9414     }
       
  9415     fiber._debugIsCurrentlyTiming = true;
       
  9416   }
       
  9417 }
       
  9418 
       
  9419 function cancelWorkTimer(fiber) {
       
  9420   if (enableUserTimingAPI) {
       
  9421     if (!supportsUserTiming || shouldIgnoreFiber(fiber)) {
       
  9422       return;
       
  9423     }
       
  9424     // Remember we shouldn't complete measurement for this fiber.
       
  9425     // Otherwise flamechart will be deep even for small updates.
       
  9426     fiber._debugIsCurrentlyTiming = false;
       
  9427     clearFiberMark(fiber, null);
       
  9428   }
       
  9429 }
       
  9430 
       
  9431 function stopWorkTimer(fiber) {
       
  9432   if (enableUserTimingAPI) {
       
  9433     if (!supportsUserTiming || shouldIgnoreFiber(fiber)) {
       
  9434       return;
       
  9435     }
       
  9436     // If we pause, its parent is the fiber to unwind from.
       
  9437     currentFiber = fiber.return;
       
  9438     if (!fiber._debugIsCurrentlyTiming) {
       
  9439       return;
       
  9440     }
       
  9441     fiber._debugIsCurrentlyTiming = false;
       
  9442     endFiberMark(fiber, null, null);
       
  9443   }
       
  9444 }
       
  9445 
       
  9446 function stopFailedWorkTimer(fiber) {
       
  9447   if (enableUserTimingAPI) {
       
  9448     if (!supportsUserTiming || shouldIgnoreFiber(fiber)) {
       
  9449       return;
       
  9450     }
       
  9451     // If we pause, its parent is the fiber to unwind from.
       
  9452     currentFiber = fiber.return;
       
  9453     if (!fiber._debugIsCurrentlyTiming) {
       
  9454       return;
       
  9455     }
       
  9456     fiber._debugIsCurrentlyTiming = false;
       
  9457     var warning = fiber.tag === SuspenseComponent || fiber.tag === DehydratedSuspenseComponent ? 'Rendering was suspended' : 'An error was thrown inside this error boundary';
       
  9458     endFiberMark(fiber, null, warning);
       
  9459   }
       
  9460 }
       
  9461 
       
  9462 function startPhaseTimer(fiber, phase) {
       
  9463   if (enableUserTimingAPI) {
       
  9464     if (!supportsUserTiming) {
       
  9465       return;
       
  9466     }
       
  9467     clearPendingPhaseMeasurement();
       
  9468     if (!beginFiberMark(fiber, phase)) {
       
  9469       return;
       
  9470     }
       
  9471     currentPhaseFiber = fiber;
       
  9472     currentPhase = phase;
       
  9473   }
       
  9474 }
       
  9475 
       
  9476 function stopPhaseTimer() {
       
  9477   if (enableUserTimingAPI) {
       
  9478     if (!supportsUserTiming) {
       
  9479       return;
       
  9480     }
       
  9481     if (currentPhase !== null && currentPhaseFiber !== null) {
       
  9482       var warning = hasScheduledUpdateInCurrentPhase ? 'Scheduled a cascading update' : null;
       
  9483       endFiberMark(currentPhaseFiber, currentPhase, warning);
       
  9484     }
       
  9485     currentPhase = null;
       
  9486     currentPhaseFiber = null;
       
  9487   }
       
  9488 }
       
  9489 
       
  9490 function startWorkLoopTimer(nextUnitOfWork) {
       
  9491   if (enableUserTimingAPI) {
       
  9492     currentFiber = nextUnitOfWork;
       
  9493     if (!supportsUserTiming) {
       
  9494       return;
       
  9495     }
       
  9496     commitCountInCurrentWorkLoop = 0;
       
  9497     // This is top level call.
       
  9498     // Any other measurements are performed within.
       
  9499     beginMark('(React Tree Reconciliation)');
       
  9500     // Resume any measurements that were in progress during the last loop.
       
  9501     resumeTimers();
       
  9502   }
       
  9503 }
       
  9504 
       
  9505 function stopWorkLoopTimer(interruptedBy, didCompleteRoot) {
       
  9506   if (enableUserTimingAPI) {
       
  9507     if (!supportsUserTiming) {
       
  9508       return;
       
  9509     }
       
  9510     var warning = null;
       
  9511     if (interruptedBy !== null) {
       
  9512       if (interruptedBy.tag === HostRoot) {
       
  9513         warning = 'A top-level update interrupted the previous render';
       
  9514       } else {
       
  9515         var componentName = getComponentName(interruptedBy.type) || 'Unknown';
       
  9516         warning = 'An update to ' + componentName + ' interrupted the previous render';
       
  9517       }
       
  9518     } else if (commitCountInCurrentWorkLoop > 1) {
       
  9519       warning = 'There were cascading updates';
       
  9520     }
       
  9521     commitCountInCurrentWorkLoop = 0;
       
  9522     var label = didCompleteRoot ? '(React Tree Reconciliation: Completed Root)' : '(React Tree Reconciliation: Yielded)';
       
  9523     // Pause any measurements until the next loop.
       
  9524     pauseTimers();
       
  9525     endMark(label, '(React Tree Reconciliation)', warning);
       
  9526   }
       
  9527 }
       
  9528 
       
  9529 function startCommitTimer() {
       
  9530   if (enableUserTimingAPI) {
       
  9531     if (!supportsUserTiming) {
       
  9532       return;
       
  9533     }
       
  9534     isCommitting = true;
       
  9535     hasScheduledUpdateInCurrentCommit = false;
       
  9536     labelsInCurrentCommit.clear();
       
  9537     beginMark('(Committing Changes)');
       
  9538   }
       
  9539 }
       
  9540 
       
  9541 function stopCommitTimer() {
       
  9542   if (enableUserTimingAPI) {
       
  9543     if (!supportsUserTiming) {
       
  9544       return;
       
  9545     }
       
  9546 
       
  9547     var warning = null;
       
  9548     if (hasScheduledUpdateInCurrentCommit) {
       
  9549       warning = 'Lifecycle hook scheduled a cascading update';
       
  9550     } else if (commitCountInCurrentWorkLoop > 0) {
       
  9551       warning = 'Caused by a cascading update in earlier commit';
       
  9552     }
       
  9553     hasScheduledUpdateInCurrentCommit = false;
       
  9554     commitCountInCurrentWorkLoop++;
       
  9555     isCommitting = false;
       
  9556     labelsInCurrentCommit.clear();
       
  9557 
       
  9558     endMark('(Committing Changes)', '(Committing Changes)', warning);
       
  9559   }
       
  9560 }
       
  9561 
       
  9562 function startCommitSnapshotEffectsTimer() {
       
  9563   if (enableUserTimingAPI) {
       
  9564     if (!supportsUserTiming) {
       
  9565       return;
       
  9566     }
       
  9567     effectCountInCurrentCommit = 0;
       
  9568     beginMark('(Committing Snapshot Effects)');
       
  9569   }
       
  9570 }
       
  9571 
       
  9572 function stopCommitSnapshotEffectsTimer() {
       
  9573   if (enableUserTimingAPI) {
       
  9574     if (!supportsUserTiming) {
       
  9575       return;
       
  9576     }
       
  9577     var count = effectCountInCurrentCommit;
       
  9578     effectCountInCurrentCommit = 0;
       
  9579     endMark('(Committing Snapshot Effects: ' + count + ' Total)', '(Committing Snapshot Effects)', null);
       
  9580   }
       
  9581 }
       
  9582 
       
  9583 function startCommitHostEffectsTimer() {
       
  9584   if (enableUserTimingAPI) {
       
  9585     if (!supportsUserTiming) {
       
  9586       return;
       
  9587     }
       
  9588     effectCountInCurrentCommit = 0;
       
  9589     beginMark('(Committing Host Effects)');
       
  9590   }
       
  9591 }
       
  9592 
       
  9593 function stopCommitHostEffectsTimer() {
       
  9594   if (enableUserTimingAPI) {
       
  9595     if (!supportsUserTiming) {
       
  9596       return;
       
  9597     }
       
  9598     var count = effectCountInCurrentCommit;
       
  9599     effectCountInCurrentCommit = 0;
       
  9600     endMark('(Committing Host Effects: ' + count + ' Total)', '(Committing Host Effects)', null);
       
  9601   }
       
  9602 }
       
  9603 
       
  9604 function startCommitLifeCyclesTimer() {
       
  9605   if (enableUserTimingAPI) {
       
  9606     if (!supportsUserTiming) {
       
  9607       return;
       
  9608     }
       
  9609     effectCountInCurrentCommit = 0;
       
  9610     beginMark('(Calling Lifecycle Methods)');
       
  9611   }
       
  9612 }
       
  9613 
       
  9614 function stopCommitLifeCyclesTimer() {
       
  9615   if (enableUserTimingAPI) {
       
  9616     if (!supportsUserTiming) {
       
  9617       return;
       
  9618     }
       
  9619     var count = effectCountInCurrentCommit;
       
  9620     effectCountInCurrentCommit = 0;
       
  9621     endMark('(Calling Lifecycle Methods: ' + count + ' Total)', '(Calling Lifecycle Methods)', null);
       
  9622   }
       
  9623 }
       
  9624 
       
  9625 var valueStack = [];
       
  9626 
       
  9627 var fiberStack = void 0;
       
  9628 
       
  9629 {
       
  9630   fiberStack = [];
       
  9631 }
       
  9632 
       
  9633 var index = -1;
       
  9634 
       
  9635 function createCursor(defaultValue) {
       
  9636   return {
       
  9637     current: defaultValue
       
  9638   };
       
  9639 }
       
  9640 
       
  9641 function pop(cursor, fiber) {
       
  9642   if (index < 0) {
       
  9643     {
       
  9644       warningWithoutStack$1(false, 'Unexpected pop.');
       
  9645     }
       
  9646     return;
       
  9647   }
       
  9648 
       
  9649   {
       
  9650     if (fiber !== fiberStack[index]) {
       
  9651       warningWithoutStack$1(false, 'Unexpected Fiber popped.');
       
  9652     }
       
  9653   }
       
  9654 
       
  9655   cursor.current = valueStack[index];
       
  9656 
       
  9657   valueStack[index] = null;
       
  9658 
       
  9659   {
       
  9660     fiberStack[index] = null;
       
  9661   }
       
  9662 
       
  9663   index--;
       
  9664 }
       
  9665 
       
  9666 function push(cursor, value, fiber) {
       
  9667   index++;
       
  9668 
       
  9669   valueStack[index] = cursor.current;
       
  9670 
       
  9671   {
       
  9672     fiberStack[index] = fiber;
       
  9673   }
       
  9674 
       
  9675   cursor.current = value;
       
  9676 }
       
  9677 
       
  9678 function checkThatStackIsEmpty() {
       
  9679   {
       
  9680     if (index !== -1) {
       
  9681       warningWithoutStack$1(false, 'Expected an empty stack. Something was not reset properly.');
       
  9682     }
       
  9683   }
       
  9684 }
       
  9685 
       
  9686 function resetStackAfterFatalErrorInDev() {
       
  9687   {
       
  9688     index = -1;
       
  9689     valueStack.length = 0;
       
  9690     fiberStack.length = 0;
       
  9691   }
       
  9692 }
       
  9693 
       
  9694 var warnedAboutMissingGetChildContext = void 0;
       
  9695 
       
  9696 {
       
  9697   warnedAboutMissingGetChildContext = {};
       
  9698 }
       
  9699 
       
  9700 var emptyContextObject = {};
       
  9701 {
       
  9702   Object.freeze(emptyContextObject);
       
  9703 }
       
  9704 
       
  9705 // A cursor to the current merged context object on the stack.
       
  9706 var contextStackCursor = createCursor(emptyContextObject);
       
  9707 // A cursor to a boolean indicating whether the context has changed.
       
  9708 var didPerformWorkStackCursor = createCursor(false);
       
  9709 // Keep track of the previous context object that was on the stack.
       
  9710 // We use this to get access to the parent context after we have already
       
  9711 // pushed the next context provider, and now need to merge their contexts.
       
  9712 var previousContext = emptyContextObject;
       
  9713 
       
  9714 function getUnmaskedContext(workInProgress, Component, didPushOwnContextIfProvider) {
       
  9715   if (didPushOwnContextIfProvider && isContextProvider(Component)) {
       
  9716     // If the fiber is a context provider itself, when we read its context
       
  9717     // we may have already pushed its own child context on the stack. A context
       
  9718     // provider should not "see" its own child context. Therefore we read the
       
  9719     // previous (parent) context instead for a context provider.
       
  9720     return previousContext;
       
  9721   }
       
  9722   return contextStackCursor.current;
       
  9723 }
       
  9724 
       
  9725 function cacheContext(workInProgress, unmaskedContext, maskedContext) {
       
  9726   var instance = workInProgress.stateNode;
       
  9727   instance.__reactInternalMemoizedUnmaskedChildContext = unmaskedContext;
       
  9728   instance.__reactInternalMemoizedMaskedChildContext = maskedContext;
       
  9729 }
       
  9730 
       
  9731 function getMaskedContext(workInProgress, unmaskedContext) {
       
  9732   var type = workInProgress.type;
       
  9733   var contextTypes = type.contextTypes;
       
  9734   if (!contextTypes) {
       
  9735     return emptyContextObject;
       
  9736   }
       
  9737 
       
  9738   // Avoid recreating masked context unless unmasked context has changed.
       
  9739   // Failing to do this will result in unnecessary calls to componentWillReceiveProps.
       
  9740   // This may trigger infinite loops if componentWillReceiveProps calls setState.
       
  9741   var instance = workInProgress.stateNode;
       
  9742   if (instance && instance.__reactInternalMemoizedUnmaskedChildContext === unmaskedContext) {
       
  9743     return instance.__reactInternalMemoizedMaskedChildContext;
       
  9744   }
       
  9745 
       
  9746   var context = {};
       
  9747   for (var key in contextTypes) {
       
  9748     context[key] = unmaskedContext[key];
       
  9749   }
       
  9750 
       
  9751   {
       
  9752     var name = getComponentName(type) || 'Unknown';
       
  9753     checkPropTypes_1(contextTypes, context, 'context', name, getCurrentFiberStackInDev);
       
  9754   }
       
  9755 
       
  9756   // Cache unmasked context so we can avoid recreating masked context unless necessary.
       
  9757   // Context is created before the class component is instantiated so check for instance.
       
  9758   if (instance) {
       
  9759     cacheContext(workInProgress, unmaskedContext, context);
       
  9760   }
       
  9761 
       
  9762   return context;
       
  9763 }
       
  9764 
       
  9765 function hasContextChanged() {
       
  9766   return didPerformWorkStackCursor.current;
       
  9767 }
       
  9768 
       
  9769 function isContextProvider(type) {
       
  9770   var childContextTypes = type.childContextTypes;
       
  9771   return childContextTypes !== null && childContextTypes !== undefined;
       
  9772 }
       
  9773 
       
  9774 function popContext(fiber) {
       
  9775   pop(didPerformWorkStackCursor, fiber);
       
  9776   pop(contextStackCursor, fiber);
       
  9777 }
       
  9778 
       
  9779 function popTopLevelContextObject(fiber) {
       
  9780   pop(didPerformWorkStackCursor, fiber);
       
  9781   pop(contextStackCursor, fiber);
       
  9782 }
       
  9783 
       
  9784 function pushTopLevelContextObject(fiber, context, didChange) {
       
  9785   !(contextStackCursor.current === emptyContextObject) ? invariant(false, 'Unexpected context found on stack. This error is likely caused by a bug in React. Please file an issue.') : void 0;
       
  9786 
       
  9787   push(contextStackCursor, context, fiber);
       
  9788   push(didPerformWorkStackCursor, didChange, fiber);
       
  9789 }
       
  9790 
       
  9791 function processChildContext(fiber, type, parentContext) {
       
  9792   var instance = fiber.stateNode;
       
  9793   var childContextTypes = type.childContextTypes;
       
  9794 
       
  9795   // TODO (bvaughn) Replace this behavior with an invariant() in the future.
       
  9796   // It has only been added in Fiber to match the (unintentional) behavior in Stack.
       
  9797   if (typeof instance.getChildContext !== 'function') {
       
  9798     {
       
  9799       var componentName = getComponentName(type) || 'Unknown';
       
  9800 
       
  9801       if (!warnedAboutMissingGetChildContext[componentName]) {
       
  9802         warnedAboutMissingGetChildContext[componentName] = true;
       
  9803         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);
       
  9804       }
       
  9805     }
       
  9806     return parentContext;
       
  9807   }
       
  9808 
       
  9809   var childContext = void 0;
       
  9810   {
       
  9811     setCurrentPhase('getChildContext');
       
  9812   }
       
  9813   startPhaseTimer(fiber, 'getChildContext');
       
  9814   childContext = instance.getChildContext();
       
  9815   stopPhaseTimer();
       
  9816   {
       
  9817     setCurrentPhase(null);
       
  9818   }
       
  9819   for (var contextKey in childContext) {
       
  9820     !(contextKey in childContextTypes) ? invariant(false, '%s.getChildContext(): key "%s" is not defined in childContextTypes.', getComponentName(type) || 'Unknown', contextKey) : void 0;
       
  9821   }
       
  9822   {
       
  9823     var name = getComponentName(type) || 'Unknown';
       
  9824     checkPropTypes_1(childContextTypes, childContext, 'child context', name,
       
  9825     // In practice, there is one case in which we won't get a stack. It's when
       
  9826     // somebody calls unstable_renderSubtreeIntoContainer() and we process
       
  9827     // context from the parent component instance. The stack will be missing
       
  9828     // because it's outside of the reconciliation, and so the pointer has not
       
  9829     // been set. This is rare and doesn't matter. We'll also remove that API.
       
  9830     getCurrentFiberStackInDev);
       
  9831   }
       
  9832 
       
  9833   return _assign({}, parentContext, childContext);
       
  9834 }
       
  9835 
       
  9836 function pushContextProvider(workInProgress) {
       
  9837   var instance = workInProgress.stateNode;
       
  9838   // We push the context as early as possible to ensure stack integrity.
       
  9839   // If the instance does not exist yet, we will push null at first,
       
  9840   // and replace it on the stack later when invalidating the context.
       
  9841   var memoizedMergedChildContext = instance && instance.__reactInternalMemoizedMergedChildContext || emptyContextObject;
       
  9842 
       
  9843   // Remember the parent context so we can merge with it later.
       
  9844   // Inherit the parent's did-perform-work value to avoid inadvertently blocking updates.
       
  9845   previousContext = contextStackCursor.current;
       
  9846   push(contextStackCursor, memoizedMergedChildContext, workInProgress);
       
  9847   push(didPerformWorkStackCursor, didPerformWorkStackCursor.current, workInProgress);
       
  9848 
       
  9849   return true;
       
  9850 }
       
  9851 
       
  9852 function invalidateContextProvider(workInProgress, type, didChange) {
       
  9853   var instance = workInProgress.stateNode;
       
  9854   !instance ? invariant(false, 'Expected to have an instance by this point. This error is likely caused by a bug in React. Please file an issue.') : void 0;
       
  9855 
       
  9856   if (didChange) {
       
  9857     // Merge parent and own context.
       
  9858     // Skip this if we're not updating due to sCU.
       
  9859     // This avoids unnecessarily recomputing memoized values.
       
  9860     var mergedContext = processChildContext(workInProgress, type, previousContext);
       
  9861     instance.__reactInternalMemoizedMergedChildContext = mergedContext;
       
  9862 
       
  9863     // Replace the old (or empty) context with the new one.
       
  9864     // It is important to unwind the context in the reverse order.
       
  9865     pop(didPerformWorkStackCursor, workInProgress);
       
  9866     pop(contextStackCursor, workInProgress);
       
  9867     // Now push the new context and mark that it has changed.
       
  9868     push(contextStackCursor, mergedContext, workInProgress);
       
  9869     push(didPerformWorkStackCursor, didChange, workInProgress);
       
  9870   } else {
       
  9871     pop(didPerformWorkStackCursor, workInProgress);
       
  9872     push(didPerformWorkStackCursor, didChange, workInProgress);
       
  9873   }
       
  9874 }
       
  9875 
       
  9876 function findCurrentUnmaskedContext(fiber) {
       
  9877   // Currently this is only used with renderSubtreeIntoContainer; not sure if it
       
  9878   // makes sense elsewhere
       
  9879   !(isFiberMounted(fiber) && fiber.tag === ClassComponent) ? invariant(false, 'Expected subtree parent to be a mounted class component. This error is likely caused by a bug in React. Please file an issue.') : void 0;
       
  9880 
       
  9881   var node = fiber;
       
  9882   do {
       
  9883     switch (node.tag) {
       
  9884       case HostRoot:
       
  9885         return node.stateNode.context;
       
  9886       case ClassComponent:
       
  9887         {
       
  9888           var Component = node.type;
       
  9889           if (isContextProvider(Component)) {
       
  9890             return node.stateNode.__reactInternalMemoizedMergedChildContext;
       
  9891           }
       
  9892           break;
       
  9893         }
       
  9894     }
       
  9895     node = node.return;
       
  9896   } while (node !== null);
       
  9897   invariant(false, 'Found unexpected detached subtree parent. This error is likely caused by a bug in React. Please file an issue.');
       
  9898 }
       
  9899 
       
  9900 var onCommitFiberRoot = null;
       
  9901 var onCommitFiberUnmount = null;
       
  9902 var hasLoggedError = false;
       
  9903 
       
  9904 function catchErrors(fn) {
       
  9905   return function (arg) {
       
  9906     try {
       
  9907       return fn(arg);
       
  9908     } catch (err) {
       
  9909       if (true && !hasLoggedError) {
       
  9910         hasLoggedError = true;
       
  9911         warningWithoutStack$1(false, 'React DevTools encountered an error: %s', err);
       
  9912       }
       
  9913     }
       
  9914   };
       
  9915 }
       
  9916 
       
  9917 var isDevToolsPresent = typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined';
       
  9918 
       
  9919 function injectInternals(internals) {
       
  9920   if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined') {
       
  9921     // No DevTools
       
  9922     return false;
       
  9923   }
       
  9924   var hook = __REACT_DEVTOOLS_GLOBAL_HOOK__;
       
  9925   if (hook.isDisabled) {
       
  9926     // This isn't a real property on the hook, but it can be set to opt out
       
  9927     // of DevTools integration and associated warnings and logs.
       
  9928     // https://github.com/facebook/react/issues/3877
       
  9929     return true;
       
  9930   }
       
  9931   if (!hook.supportsFiber) {
       
  9932     {
       
  9933       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');
       
  9934     }
       
  9935     // DevTools exists, even though it doesn't support Fiber.
       
  9936     return true;
       
  9937   }
       
  9938   try {
       
  9939     var rendererID = hook.inject(internals);
       
  9940     // We have successfully injected, so now it is safe to set up hooks.
       
  9941     onCommitFiberRoot = catchErrors(function (root) {
       
  9942       return hook.onCommitFiberRoot(rendererID, root);
       
  9943     });
       
  9944     onCommitFiberUnmount = catchErrors(function (fiber) {
       
  9945       return hook.onCommitFiberUnmount(rendererID, fiber);
       
  9946     });
       
  9947   } catch (err) {
       
  9948     // Catch all errors because it is unsafe to throw during initialization.
       
  9949     {
       
  9950       warningWithoutStack$1(false, 'React DevTools encountered an error: %s.', err);
       
  9951     }
       
  9952   }
       
  9953   // DevTools exists
       
  9954   return true;
       
  9955 }
       
  9956 
       
  9957 function onCommitRoot(root) {
       
  9958   if (typeof onCommitFiberRoot === 'function') {
       
  9959     onCommitFiberRoot(root);
       
  9960   }
       
  9961 }
       
  9962 
       
  9963 function onCommitUnmount(fiber) {
       
  9964   if (typeof onCommitFiberUnmount === 'function') {
       
  9965     onCommitFiberUnmount(fiber);
       
  9966   }
       
  9967 }
       
  9968 
       
  9969 // Max 31 bit integer. The max integer size in V8 for 32-bit systems.
       
  9970 // Math.pow(2, 30) - 1
       
  9971 // 0b111111111111111111111111111111
       
  9972 var maxSigned31BitInt = 1073741823;
       
  9973 
       
  9974 var NoWork = 0;
       
  9975 var Never = 1;
       
  9976 var Sync = maxSigned31BitInt;
       
  9977 
       
  9978 var UNIT_SIZE = 10;
       
  9979 var MAGIC_NUMBER_OFFSET = maxSigned31BitInt - 1;
       
  9980 
       
  9981 // 1 unit of expiration time represents 10ms.
       
  9982 function msToExpirationTime(ms) {
       
  9983   // Always add an offset so that we don't clash with the magic number for NoWork.
       
  9984   return MAGIC_NUMBER_OFFSET - (ms / UNIT_SIZE | 0);
       
  9985 }
       
  9986 
       
  9987 function expirationTimeToMs(expirationTime) {
       
  9988   return (MAGIC_NUMBER_OFFSET - expirationTime) * UNIT_SIZE;
       
  9989 }
       
  9990 
       
  9991 function ceiling(num, precision) {
       
  9992   return ((num / precision | 0) + 1) * precision;
       
  9993 }
       
  9994 
       
  9995 function computeExpirationBucket(currentTime, expirationInMs, bucketSizeMs) {
       
  9996   return MAGIC_NUMBER_OFFSET - ceiling(MAGIC_NUMBER_OFFSET - currentTime + expirationInMs / UNIT_SIZE, bucketSizeMs / UNIT_SIZE);
       
  9997 }
       
  9998 
       
  9999 var LOW_PRIORITY_EXPIRATION = 5000;
       
 10000 var LOW_PRIORITY_BATCH_SIZE = 250;
       
 10001 
       
 10002 function computeAsyncExpiration(currentTime) {
       
 10003   return computeExpirationBucket(currentTime, LOW_PRIORITY_EXPIRATION, LOW_PRIORITY_BATCH_SIZE);
       
 10004 }
       
 10005 
       
 10006 // We intentionally set a higher expiration time for interactive updates in
       
 10007 // dev than in production.
       
 10008 //
       
 10009 // If the main thread is being blocked so long that you hit the expiration,
       
 10010 // it's a problem that could be solved with better scheduling.
       
 10011 //
       
 10012 // People will be more likely to notice this and fix it with the long
       
 10013 // expiration time in development.
       
 10014 //
       
 10015 // In production we opt for better UX at the risk of masking scheduling
       
 10016 // problems, by expiring fast.
       
 10017 var HIGH_PRIORITY_EXPIRATION = 500;
       
 10018 var HIGH_PRIORITY_BATCH_SIZE = 100;
       
 10019 
       
 10020 function computeInteractiveExpiration(currentTime) {
       
 10021   return computeExpirationBucket(currentTime, HIGH_PRIORITY_EXPIRATION, HIGH_PRIORITY_BATCH_SIZE);
       
 10022 }
       
 10023 
       
 10024 var NoContext = 0;
       
 10025 var ConcurrentMode = 1;
       
 10026 var StrictMode = 2;
       
 10027 var ProfileMode = 4;
       
 10028 
       
 10029 var hasBadMapPolyfill = void 0;
       
 10030 
       
 10031 {
       
 10032   hasBadMapPolyfill = false;
       
 10033   try {
       
 10034     var nonExtensibleObject = Object.preventExtensions({});
       
 10035     var testMap = new Map([[nonExtensibleObject, null]]);
       
 10036     var testSet = new Set([nonExtensibleObject]);
       
 10037     // This is necessary for Rollup to not consider these unused.
       
 10038     // https://github.com/rollup/rollup/issues/1771
       
 10039     // TODO: we can remove these if Rollup fixes the bug.
       
 10040     testMap.set(0, 0);
       
 10041     testSet.add(0);
       
 10042   } catch (e) {
       
 10043     // TODO: Consider warning about bad polyfills
       
 10044     hasBadMapPolyfill = true;
       
 10045   }
       
 10046 }
       
 10047 
       
 10048 // A Fiber is work on a Component that needs to be done or was done. There can
       
 10049 // be more than one per component.
       
 10050 
       
 10051 
       
 10052 var debugCounter = void 0;
       
 10053 
       
 10054 {
       
 10055   debugCounter = 1;
       
 10056 }
       
 10057 
       
 10058 function FiberNode(tag, pendingProps, key, mode) {
       
 10059   // Instance
       
 10060   this.tag = tag;
       
 10061   this.key = key;
       
 10062   this.elementType = null;
       
 10063   this.type = null;
       
 10064   this.stateNode = null;
       
 10065 
       
 10066   // Fiber
       
 10067   this.return = null;
       
 10068   this.child = null;
       
 10069   this.sibling = null;
       
 10070   this.index = 0;
       
 10071 
       
 10072   this.ref = null;
       
 10073 
       
 10074   this.pendingProps = pendingProps;
       
 10075   this.memoizedProps = null;
       
 10076   this.updateQueue = null;
       
 10077   this.memoizedState = null;
       
 10078   this.contextDependencies = null;
       
 10079 
       
 10080   this.mode = mode;
       
 10081 
       
 10082   // Effects
       
 10083   this.effectTag = NoEffect;
       
 10084   this.nextEffect = null;
       
 10085 
       
 10086   this.firstEffect = null;
       
 10087   this.lastEffect = null;
       
 10088 
       
 10089   this.expirationTime = NoWork;
       
 10090   this.childExpirationTime = NoWork;
       
 10091 
       
 10092   this.alternate = null;
       
 10093 
       
 10094   if (enableProfilerTimer) {
       
 10095     // Note: The following is done to avoid a v8 performance cliff.
       
 10096     //
       
 10097     // Initializing the fields below to smis and later updating them with
       
 10098     // double values will cause Fibers to end up having separate shapes.
       
 10099     // This behavior/bug has something to do with Object.preventExtension().
       
 10100     // Fortunately this only impacts DEV builds.
       
 10101     // Unfortunately it makes React unusably slow for some applications.
       
 10102     // To work around this, initialize the fields below with doubles.
       
 10103     //
       
 10104     // Learn more about this here:
       
 10105     // https://github.com/facebook/react/issues/14365
       
 10106     // https://bugs.chromium.org/p/v8/issues/detail?id=8538
       
 10107     this.actualDuration = Number.NaN;
       
 10108     this.actualStartTime = Number.NaN;
       
 10109     this.selfBaseDuration = Number.NaN;
       
 10110     this.treeBaseDuration = Number.NaN;
       
 10111 
       
 10112     // It's okay to replace the initial doubles with smis after initialization.
       
 10113     // This won't trigger the performance cliff mentioned above,
       
 10114     // and it simplifies other profiler code (including DevTools).
       
 10115     this.actualDuration = 0;
       
 10116     this.actualStartTime = -1;
       
 10117     this.selfBaseDuration = 0;
       
 10118     this.treeBaseDuration = 0;
       
 10119   }
       
 10120 
       
 10121   {
       
 10122     this._debugID = debugCounter++;
       
 10123     this._debugSource = null;
       
 10124     this._debugOwner = null;
       
 10125     this._debugIsCurrentlyTiming = false;
       
 10126     this._debugHookTypes = null;
       
 10127     if (!hasBadMapPolyfill && typeof Object.preventExtensions === 'function') {
       
 10128       Object.preventExtensions(this);
       
 10129     }
       
 10130   }
       
 10131 }
       
 10132 
       
 10133 // This is a constructor function, rather than a POJO constructor, still
       
 10134 // please ensure we do the following:
       
 10135 // 1) Nobody should add any instance methods on this. Instance methods can be
       
 10136 //    more difficult to predict when they get optimized and they are almost
       
 10137 //    never inlined properly in static compilers.
       
 10138 // 2) Nobody should rely on `instanceof Fiber` for type testing. We should
       
 10139 //    always know when it is a fiber.
       
 10140 // 3) We might want to experiment with using numeric keys since they are easier
       
 10141 //    to optimize in a non-JIT environment.
       
 10142 // 4) We can easily go from a constructor to a createFiber object literal if that
       
 10143 //    is faster.
       
 10144 // 5) It should be easy to port this to a C struct and keep a C implementation
       
 10145 //    compatible.
       
 10146 var createFiber = function (tag, pendingProps, key, mode) {
       
 10147   // $FlowFixMe: the shapes are exact here but Flow doesn't like constructors
       
 10148   return new FiberNode(tag, pendingProps, key, mode);
       
 10149 };
       
 10150 
       
 10151 function shouldConstruct(Component) {
       
 10152   var prototype = Component.prototype;
       
 10153   return !!(prototype && prototype.isReactComponent);
       
 10154 }
       
 10155 
       
 10156 function isSimpleFunctionComponent(type) {
       
 10157   return typeof type === 'function' && !shouldConstruct(type) && type.defaultProps === undefined;
       
 10158 }
       
 10159 
       
 10160 function resolveLazyComponentTag(Component) {
       
 10161   if (typeof Component === 'function') {
       
 10162     return shouldConstruct(Component) ? ClassComponent : FunctionComponent;
       
 10163   } else if (Component !== undefined && Component !== null) {
       
 10164     var $$typeof = Component.$$typeof;
       
 10165     if ($$typeof === REACT_FORWARD_REF_TYPE) {
       
 10166       return ForwardRef;
       
 10167     }
       
 10168     if ($$typeof === REACT_MEMO_TYPE) {
       
 10169       return MemoComponent;
       
 10170     }
       
 10171   }
       
 10172   return IndeterminateComponent;
       
 10173 }
       
 10174 
       
 10175 // This is used to create an alternate fiber to do work on.
       
 10176 function createWorkInProgress(current, pendingProps, expirationTime) {
       
 10177   var workInProgress = current.alternate;
       
 10178   if (workInProgress === null) {
       
 10179     // We use a double buffering pooling technique because we know that we'll
       
 10180     // only ever need at most two versions of a tree. We pool the "other" unused
       
 10181     // node that we're free to reuse. This is lazily created to avoid allocating
       
 10182     // extra objects for things that are never updated. It also allow us to
       
 10183     // reclaim the extra memory if needed.
       
 10184     workInProgress = createFiber(current.tag, pendingProps, current.key, current.mode);
       
 10185     workInProgress.elementType = current.elementType;
       
 10186     workInProgress.type = current.type;
       
 10187     workInProgress.stateNode = current.stateNode;
       
 10188 
       
 10189     {
       
 10190       // DEV-only fields
       
 10191       workInProgress._debugID = current._debugID;
       
 10192       workInProgress._debugSource = current._debugSource;
       
 10193       workInProgress._debugOwner = current._debugOwner;
       
 10194       workInProgress._debugHookTypes = current._debugHookTypes;
       
 10195     }
       
 10196 
       
 10197     workInProgress.alternate = current;
       
 10198     current.alternate = workInProgress;
       
 10199   } else {
       
 10200     workInProgress.pendingProps = pendingProps;
       
 10201 
       
 10202     // We already have an alternate.
       
 10203     // Reset the effect tag.
       
 10204     workInProgress.effectTag = NoEffect;
       
 10205 
       
 10206     // The effect list is no longer valid.
       
 10207     workInProgress.nextEffect = null;
       
 10208     workInProgress.firstEffect = null;
       
 10209     workInProgress.lastEffect = null;
       
 10210 
       
 10211     if (enableProfilerTimer) {
       
 10212       // We intentionally reset, rather than copy, actualDuration & actualStartTime.
       
 10213       // This prevents time from endlessly accumulating in new commits.
       
 10214       // This has the downside of resetting values for different priority renders,
       
 10215       // But works for yielding (the common case) and should support resuming.
       
 10216       workInProgress.actualDuration = 0;
       
 10217       workInProgress.actualStartTime = -1;
       
 10218     }
       
 10219   }
       
 10220 
       
 10221   workInProgress.childExpirationTime = current.childExpirationTime;
       
 10222   workInProgress.expirationTime = current.expirationTime;
       
 10223 
       
 10224   workInProgress.child = current.child;
       
 10225   workInProgress.memoizedProps = current.memoizedProps;
       
 10226   workInProgress.memoizedState = current.memoizedState;
       
 10227   workInProgress.updateQueue = current.updateQueue;
       
 10228   workInProgress.contextDependencies = current.contextDependencies;
       
 10229 
       
 10230   // These will be overridden during the parent's reconciliation
       
 10231   workInProgress.sibling = current.sibling;
       
 10232   workInProgress.index = current.index;
       
 10233   workInProgress.ref = current.ref;
       
 10234 
       
 10235   if (enableProfilerTimer) {
       
 10236     workInProgress.selfBaseDuration = current.selfBaseDuration;
       
 10237     workInProgress.treeBaseDuration = current.treeBaseDuration;
       
 10238   }
       
 10239 
       
 10240   return workInProgress;
       
 10241 }
       
 10242 
       
 10243 function createHostRootFiber(isConcurrent) {
       
 10244   var mode = isConcurrent ? ConcurrentMode | StrictMode : NoContext;
       
 10245 
       
 10246   if (enableProfilerTimer && isDevToolsPresent) {
       
 10247     // Always collect profile timings when DevTools are present.
       
 10248     // This enables DevTools to start capturing timing at any point–
       
 10249     // Without some nodes in the tree having empty base times.
       
 10250     mode |= ProfileMode;
       
 10251   }
       
 10252 
       
 10253   return createFiber(HostRoot, null, null, mode);
       
 10254 }
       
 10255 
       
 10256 function createFiberFromTypeAndProps(type, // React$ElementType
       
 10257 key, pendingProps, owner, mode, expirationTime) {
       
 10258   var fiber = void 0;
       
 10259 
       
 10260   var fiberTag = IndeterminateComponent;
       
 10261   // The resolved type is set if we know what the final type will be. I.e. it's not lazy.
       
 10262   var resolvedType = type;
       
 10263   if (typeof type === 'function') {
       
 10264     if (shouldConstruct(type)) {
       
 10265       fiberTag = ClassComponent;
       
 10266     }
       
 10267   } else if (typeof type === 'string') {
       
 10268     fiberTag = HostComponent;
       
 10269   } else {
       
 10270     getTag: switch (type) {
       
 10271       case REACT_FRAGMENT_TYPE:
       
 10272         return createFiberFromFragment(pendingProps.children, mode, expirationTime, key);
       
 10273       case REACT_CONCURRENT_MODE_TYPE:
       
 10274         return createFiberFromMode(pendingProps, mode | ConcurrentMode | StrictMode, expirationTime, key);
       
 10275       case REACT_STRICT_MODE_TYPE:
       
 10276         return createFiberFromMode(pendingProps, mode | StrictMode, expirationTime, key);
       
 10277       case REACT_PROFILER_TYPE:
       
 10278         return createFiberFromProfiler(pendingProps, mode, expirationTime, key);
       
 10279       case REACT_SUSPENSE_TYPE:
       
 10280         return createFiberFromSuspense(pendingProps, mode, expirationTime, key);
       
 10281       default:
       
 10282         {
       
 10283           if (typeof type === 'object' && type !== null) {
       
 10284             switch (type.$$typeof) {
       
 10285               case REACT_PROVIDER_TYPE:
       
 10286                 fiberTag = ContextProvider;
       
 10287                 break getTag;
       
 10288               case REACT_CONTEXT_TYPE:
       
 10289                 // This is a consumer
       
 10290                 fiberTag = ContextConsumer;
       
 10291                 break getTag;
       
 10292               case REACT_FORWARD_REF_TYPE:
       
 10293                 fiberTag = ForwardRef;
       
 10294                 break getTag;
       
 10295               case REACT_MEMO_TYPE:
       
 10296                 fiberTag = MemoComponent;
       
 10297                 break getTag;
       
 10298               case REACT_LAZY_TYPE:
       
 10299                 fiberTag = LazyComponent;
       
 10300                 resolvedType = null;
       
 10301                 break getTag;
       
 10302             }
       
 10303           }
       
 10304           var info = '';
       
 10305           {
       
 10306             if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
       
 10307               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.';
       
 10308             }
       
 10309             var ownerName = owner ? getComponentName(owner.type) : null;
       
 10310             if (ownerName) {
       
 10311               info += '\n\nCheck the render method of `' + ownerName + '`.';
       
 10312             }
       
 10313           }
       
 10314           invariant(false, 'Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s', type == null ? type : typeof type, info);
       
 10315         }
       
 10316     }
       
 10317   }
       
 10318 
       
 10319   fiber = createFiber(fiberTag, pendingProps, key, mode);
       
 10320   fiber.elementType = type;
       
 10321   fiber.type = resolvedType;
       
 10322   fiber.expirationTime = expirationTime;
       
 10323 
       
 10324   return fiber;
       
 10325 }
       
 10326 
       
 10327 function createFiberFromElement(element, mode, expirationTime) {
       
 10328   var owner = null;
       
 10329   {
       
 10330     owner = element._owner;
       
 10331   }
       
 10332   var type = element.type;
       
 10333   var key = element.key;
       
 10334   var pendingProps = element.props;
       
 10335   var fiber = createFiberFromTypeAndProps(type, key, pendingProps, owner, mode, expirationTime);
       
 10336   {
       
 10337     fiber._debugSource = element._source;
       
 10338     fiber._debugOwner = element._owner;
       
 10339   }
       
 10340   return fiber;
       
 10341 }
       
 10342 
       
 10343 function createFiberFromFragment(elements, mode, expirationTime, key) {
       
 10344   var fiber = createFiber(Fragment, elements, key, mode);
       
 10345   fiber.expirationTime = expirationTime;
       
 10346   return fiber;
       
 10347 }
       
 10348 
       
 10349 function createFiberFromProfiler(pendingProps, mode, expirationTime, key) {
       
 10350   {
       
 10351     if (typeof pendingProps.id !== 'string' || typeof pendingProps.onRender !== 'function') {
       
 10352       warningWithoutStack$1(false, 'Profiler must specify an "id" string and "onRender" function as props');
       
 10353     }
       
 10354   }
       
 10355 
       
 10356   var fiber = createFiber(Profiler, pendingProps, key, mode | ProfileMode);
       
 10357   // TODO: The Profiler fiber shouldn't have a type. It has a tag.
       
 10358   fiber.elementType = REACT_PROFILER_TYPE;
       
 10359   fiber.type = REACT_PROFILER_TYPE;
       
 10360   fiber.expirationTime = expirationTime;
       
 10361 
       
 10362   return fiber;
       
 10363 }
       
 10364 
       
 10365 function createFiberFromMode(pendingProps, mode, expirationTime, key) {
       
 10366   var fiber = createFiber(Mode, pendingProps, key, mode);
       
 10367 
       
 10368   // TODO: The Mode fiber shouldn't have a type. It has a tag.
       
 10369   var type = (mode & ConcurrentMode) === NoContext ? REACT_STRICT_MODE_TYPE : REACT_CONCURRENT_MODE_TYPE;
       
 10370   fiber.elementType = type;
       
 10371   fiber.type = type;
       
 10372 
       
 10373   fiber.expirationTime = expirationTime;
       
 10374   return fiber;
       
 10375 }
       
 10376 
       
 10377 function createFiberFromSuspense(pendingProps, mode, expirationTime, key) {
       
 10378   var fiber = createFiber(SuspenseComponent, pendingProps, key, mode);
       
 10379 
       
 10380   // TODO: The SuspenseComponent fiber shouldn't have a type. It has a tag.
       
 10381   var type = REACT_SUSPENSE_TYPE;
       
 10382   fiber.elementType = type;
       
 10383   fiber.type = type;
       
 10384 
       
 10385   fiber.expirationTime = expirationTime;
       
 10386   return fiber;
       
 10387 }
       
 10388 
       
 10389 function createFiberFromText(content, mode, expirationTime) {
       
 10390   var fiber = createFiber(HostText, content, null, mode);
       
 10391   fiber.expirationTime = expirationTime;
       
 10392   return fiber;
       
 10393 }
       
 10394 
       
 10395 function createFiberFromHostInstanceForDeletion() {
       
 10396   var fiber = createFiber(HostComponent, null, null, NoContext);
       
 10397   // TODO: These should not need a type.
       
 10398   fiber.elementType = 'DELETED';
       
 10399   fiber.type = 'DELETED';
       
 10400   return fiber;
       
 10401 }
       
 10402 
       
 10403 function createFiberFromPortal(portal, mode, expirationTime) {
       
 10404   var pendingProps = portal.children !== null ? portal.children : [];
       
 10405   var fiber = createFiber(HostPortal, pendingProps, portal.key, mode);
       
 10406   fiber.expirationTime = expirationTime;
       
 10407   fiber.stateNode = {
       
 10408     containerInfo: portal.containerInfo,
       
 10409     pendingChildren: null, // Used by persistent updates
       
 10410     implementation: portal.implementation
       
 10411   };
       
 10412   return fiber;
       
 10413 }
       
 10414 
       
 10415 // Used for stashing WIP properties to replay failed work in DEV.
       
 10416 function assignFiberPropertiesInDEV(target, source) {
       
 10417   if (target === null) {
       
 10418     // This Fiber's initial properties will always be overwritten.
       
 10419     // We only use a Fiber to ensure the same hidden class so DEV isn't slow.
       
 10420     target = createFiber(IndeterminateComponent, null, null, NoContext);
       
 10421   }
       
 10422 
       
 10423   // This is intentionally written as a list of all properties.
       
 10424   // We tried to use Object.assign() instead but this is called in
       
 10425   // the hottest path, and Object.assign() was too slow:
       
 10426   // https://github.com/facebook/react/issues/12502
       
 10427   // This code is DEV-only so size is not a concern.
       
 10428 
       
 10429   target.tag = source.tag;
       
 10430   target.key = source.key;
       
 10431   target.elementType = source.elementType;
       
 10432   target.type = source.type;
       
 10433   target.stateNode = source.stateNode;
       
 10434   target.return = source.return;
       
 10435   target.child = source.child;
       
 10436   target.sibling = source.sibling;
       
 10437   target.index = source.index;
       
 10438   target.ref = source.ref;
       
 10439   target.pendingProps = source.pendingProps;
       
 10440   target.memoizedProps = source.memoizedProps;
       
 10441   target.updateQueue = source.updateQueue;
       
 10442   target.memoizedState = source.memoizedState;
       
 10443   target.contextDependencies = source.contextDependencies;
       
 10444   target.mode = source.mode;
       
 10445   target.effectTag = source.effectTag;
       
 10446   target.nextEffect = source.nextEffect;
       
 10447   target.firstEffect = source.firstEffect;
       
 10448   target.lastEffect = source.lastEffect;
       
 10449   target.expirationTime = source.expirationTime;
       
 10450   target.childExpirationTime = source.childExpirationTime;
       
 10451   target.alternate = source.alternate;
       
 10452   if (enableProfilerTimer) {
       
 10453     target.actualDuration = source.actualDuration;
       
 10454     target.actualStartTime = source.actualStartTime;
       
 10455     target.selfBaseDuration = source.selfBaseDuration;
       
 10456     target.treeBaseDuration = source.treeBaseDuration;
       
 10457   }
       
 10458   target._debugID = source._debugID;
       
 10459   target._debugSource = source._debugSource;
       
 10460   target._debugOwner = source._debugOwner;
       
 10461   target._debugIsCurrentlyTiming = source._debugIsCurrentlyTiming;
       
 10462   target._debugHookTypes = source._debugHookTypes;
       
 10463   return target;
       
 10464 }
       
 10465 
       
 10466 var ReactInternals$2 = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
       
 10467 
       
 10468 var _ReactInternals$Sched$1 = ReactInternals$2.SchedulerTracing;
       
 10469 var __interactionsRef = _ReactInternals$Sched$1.__interactionsRef;
       
 10470 var __subscriberRef = _ReactInternals$Sched$1.__subscriberRef;
       
 10471 var unstable_clear = _ReactInternals$Sched$1.unstable_clear;
       
 10472 var unstable_getCurrent = _ReactInternals$Sched$1.unstable_getCurrent;
       
 10473 var unstable_getThreadID = _ReactInternals$Sched$1.unstable_getThreadID;
       
 10474 var unstable_subscribe = _ReactInternals$Sched$1.unstable_subscribe;
       
 10475 var unstable_trace = _ReactInternals$Sched$1.unstable_trace;
       
 10476 var unstable_unsubscribe = _ReactInternals$Sched$1.unstable_unsubscribe;
       
 10477 var unstable_wrap = _ReactInternals$Sched$1.unstable_wrap;
       
 10478 
       
 10479 // TODO: This should be lifted into the renderer.
       
 10480 
       
 10481 
       
 10482 // The following attributes are only used by interaction tracing builds.
       
 10483 // They enable interactions to be associated with their async work,
       
 10484 // And expose interaction metadata to the React DevTools Profiler plugin.
       
 10485 // Note that these attributes are only defined when the enableSchedulerTracing flag is enabled.
       
 10486 
       
 10487 
       
 10488 // Exported FiberRoot type includes all properties,
       
 10489 // To avoid requiring potentially error-prone :any casts throughout the project.
       
 10490 // Profiling properties are only safe to access in profiling builds (when enableSchedulerTracing is true).
       
 10491 // The types are defined separately within this file to ensure they stay in sync.
       
 10492 // (We don't have to use an inline :any cast when enableSchedulerTracing is disabled.)
       
 10493 
       
 10494 
       
 10495 function createFiberRoot(containerInfo, isConcurrent, hydrate) {
       
 10496   // Cyclic construction. This cheats the type system right now because
       
 10497   // stateNode is any.
       
 10498   var uninitializedFiber = createHostRootFiber(isConcurrent);
       
 10499 
       
 10500   var root = void 0;
       
 10501   if (enableSchedulerTracing) {
       
 10502     root = {
       
 10503       current: uninitializedFiber,
       
 10504       containerInfo: containerInfo,
       
 10505       pendingChildren: null,
       
 10506 
       
 10507       earliestPendingTime: NoWork,
       
 10508       latestPendingTime: NoWork,
       
 10509       earliestSuspendedTime: NoWork,
       
 10510       latestSuspendedTime: NoWork,
       
 10511       latestPingedTime: NoWork,
       
 10512 
       
 10513       pingCache: null,
       
 10514 
       
 10515       didError: false,
       
 10516 
       
 10517       pendingCommitExpirationTime: NoWork,
       
 10518       finishedWork: null,
       
 10519       timeoutHandle: noTimeout,
       
 10520       context: null,
       
 10521       pendingContext: null,
       
 10522       hydrate: hydrate,
       
 10523       nextExpirationTimeToWorkOn: NoWork,
       
 10524       expirationTime: NoWork,
       
 10525       firstBatch: null,
       
 10526       nextScheduledRoot: null,
       
 10527 
       
 10528       interactionThreadID: unstable_getThreadID(),
       
 10529       memoizedInteractions: new Set(),
       
 10530       pendingInteractionMap: new Map()
       
 10531     };
       
 10532   } else {
       
 10533     root = {
       
 10534       current: uninitializedFiber,
       
 10535       containerInfo: containerInfo,
       
 10536       pendingChildren: null,
       
 10537 
       
 10538       pingCache: null,
       
 10539 
       
 10540       earliestPendingTime: NoWork,
       
 10541       latestPendingTime: NoWork,
       
 10542       earliestSuspendedTime: NoWork,
       
 10543       latestSuspendedTime: NoWork,
       
 10544       latestPingedTime: NoWork,
       
 10545 
       
 10546       didError: false,
       
 10547 
       
 10548       pendingCommitExpirationTime: NoWork,
       
 10549       finishedWork: null,
       
 10550       timeoutHandle: noTimeout,
       
 10551       context: null,
       
 10552       pendingContext: null,
       
 10553       hydrate: hydrate,
       
 10554       nextExpirationTimeToWorkOn: NoWork,
       
 10555       expirationTime: NoWork,
       
 10556       firstBatch: null,
       
 10557       nextScheduledRoot: null
       
 10558     };
       
 10559   }
       
 10560 
       
 10561   uninitializedFiber.stateNode = root;
       
 10562 
       
 10563   // The reason for the way the Flow types are structured in this file,
       
 10564   // Is to avoid needing :any casts everywhere interaction tracing fields are used.
       
 10565   // Unfortunately that requires an :any cast for non-interaction tracing capable builds.
       
 10566   // $FlowFixMe Remove this :any cast and replace it with something better.
       
 10567   return root;
       
 10568 }
       
 10569 
       
 10570 /**
       
 10571  * Forked from fbjs/warning:
       
 10572  * https://github.com/facebook/fbjs/blob/e66ba20ad5be433eb54423f2b097d829324d9de6/packages/fbjs/src/__forks__/warning.js
       
 10573  *
       
 10574  * Only change is we use console.warn instead of console.error,
       
 10575  * and do nothing when 'console' is not supported.
       
 10576  * This really simplifies the code.
       
 10577  * ---
       
 10578  * Similar to invariant but only logs a warning if the condition is not met.
       
 10579  * This can be used to log issues in development environments in critical
       
 10580  * paths. Removing the logging code for production environments will keep the
       
 10581  * same logic and follow the same code paths.
       
 10582  */
       
 10583 
       
 10584 var lowPriorityWarning = function () {};
       
 10585 
       
 10586 {
       
 10587   var printWarning$1 = function (format) {
       
 10588     for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
       
 10589       args[_key - 1] = arguments[_key];
       
 10590     }
       
 10591 
       
 10592     var argIndex = 0;
       
 10593     var message = 'Warning: ' + format.replace(/%s/g, function () {
       
 10594       return args[argIndex++];
       
 10595     });
       
 10596     if (typeof console !== 'undefined') {
       
 10597       console.warn(message);
       
 10598     }
       
 10599     try {
       
 10600       // --- Welcome to debugging React ---
       
 10601       // This error was thrown as a convenience so that you can use this stack
       
 10602       // to find the callsite that caused this warning to fire.
       
 10603       throw new Error(message);
       
 10604     } catch (x) {}
       
 10605   };
       
 10606 
       
 10607   lowPriorityWarning = function (condition, format) {
       
 10608     if (format === undefined) {
       
 10609       throw new Error('`lowPriorityWarning(condition, format, ...args)` requires a warning ' + 'message argument');
       
 10610     }
       
 10611     if (!condition) {
       
 10612       for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
       
 10613         args[_key2 - 2] = arguments[_key2];
       
 10614       }
       
 10615 
       
 10616       printWarning$1.apply(undefined, [format].concat(args));
       
 10617     }
       
 10618   };
       
 10619 }
       
 10620 
       
 10621 var lowPriorityWarning$1 = lowPriorityWarning;
       
 10622 
       
 10623 var ReactStrictModeWarnings = {
       
 10624   discardPendingWarnings: function () {},
       
 10625   flushPendingDeprecationWarnings: function () {},
       
 10626   flushPendingUnsafeLifecycleWarnings: function () {},
       
 10627   recordDeprecationWarnings: function (fiber, instance) {},
       
 10628   recordUnsafeLifecycleWarnings: function (fiber, instance) {},
       
 10629   recordLegacyContextWarning: function (fiber, instance) {},
       
 10630   flushLegacyContextWarning: function () {}
       
 10631 };
       
 10632 
       
 10633 {
       
 10634   var LIFECYCLE_SUGGESTIONS = {
       
 10635     UNSAFE_componentWillMount: 'componentDidMount',
       
 10636     UNSAFE_componentWillReceiveProps: 'static getDerivedStateFromProps',
       
 10637     UNSAFE_componentWillUpdate: 'componentDidUpdate'
       
 10638   };
       
 10639 
       
 10640   var pendingComponentWillMountWarnings = [];
       
 10641   var pendingComponentWillReceivePropsWarnings = [];
       
 10642   var pendingComponentWillUpdateWarnings = [];
       
 10643   var pendingUnsafeLifecycleWarnings = new Map();
       
 10644   var pendingLegacyContextWarning = new Map();
       
 10645 
       
 10646   // Tracks components we have already warned about.
       
 10647   var didWarnAboutDeprecatedLifecycles = new Set();
       
 10648   var didWarnAboutUnsafeLifecycles = new Set();
       
 10649   var didWarnAboutLegacyContext = new Set();
       
 10650 
       
 10651   var setToSortedString = function (set) {
       
 10652     var array = [];
       
 10653     set.forEach(function (value) {
       
 10654       array.push(value);
       
 10655     });
       
 10656     return array.sort().join(', ');
       
 10657   };
       
 10658 
       
 10659   ReactStrictModeWarnings.discardPendingWarnings = function () {
       
 10660     pendingComponentWillMountWarnings = [];
       
 10661     pendingComponentWillReceivePropsWarnings = [];
       
 10662     pendingComponentWillUpdateWarnings = [];
       
 10663     pendingUnsafeLifecycleWarnings = new Map();
       
 10664     pendingLegacyContextWarning = new Map();
       
 10665   };
       
 10666 
       
 10667   ReactStrictModeWarnings.flushPendingUnsafeLifecycleWarnings = function () {
       
 10668     pendingUnsafeLifecycleWarnings.forEach(function (lifecycleWarningsMap, strictRoot) {
       
 10669       var lifecyclesWarningMessages = [];
       
 10670 
       
 10671       Object.keys(lifecycleWarningsMap).forEach(function (lifecycle) {
       
 10672         var lifecycleWarnings = lifecycleWarningsMap[lifecycle];
       
 10673         if (lifecycleWarnings.length > 0) {
       
 10674           var componentNames = new Set();
       
 10675           lifecycleWarnings.forEach(function (fiber) {
       
 10676             componentNames.add(getComponentName(fiber.type) || 'Component');
       
 10677             didWarnAboutUnsafeLifecycles.add(fiber.type);
       
 10678           });
       
 10679 
       
 10680           var formatted = lifecycle.replace('UNSAFE_', '');
       
 10681           var suggestion = LIFECYCLE_SUGGESTIONS[lifecycle];
       
 10682           var sortedComponentNames = setToSortedString(componentNames);
       
 10683 
       
 10684           lifecyclesWarningMessages.push(formatted + ': Please update the following components to use ' + (suggestion + ' instead: ' + sortedComponentNames));
       
 10685         }
       
 10686       });
       
 10687 
       
 10688       if (lifecyclesWarningMessages.length > 0) {
       
 10689         var strictRootComponentStack = getStackByFiberInDevAndProd(strictRoot);
       
 10690 
       
 10691         warningWithoutStack$1(false, 'Unsafe lifecycle methods were found within a strict-mode tree:%s' + '\n\n%s' + '\n\nLearn more about this warning here:' + '\nhttps://fb.me/react-strict-mode-warnings', strictRootComponentStack, lifecyclesWarningMessages.join('\n\n'));
       
 10692       }
       
 10693     });
       
 10694 
       
 10695     pendingUnsafeLifecycleWarnings = new Map();
       
 10696   };
       
 10697 
       
 10698   var findStrictRoot = function (fiber) {
       
 10699     var maybeStrictRoot = null;
       
 10700 
       
 10701     var node = fiber;
       
 10702     while (node !== null) {
       
 10703       if (node.mode & StrictMode) {
       
 10704         maybeStrictRoot = node;
       
 10705       }
       
 10706       node = node.return;
       
 10707     }
       
 10708 
       
 10709     return maybeStrictRoot;
       
 10710   };
       
 10711 
       
 10712   ReactStrictModeWarnings.flushPendingDeprecationWarnings = function () {
       
 10713     if (pendingComponentWillMountWarnings.length > 0) {
       
 10714       var uniqueNames = new Set();
       
 10715       pendingComponentWillMountWarnings.forEach(function (fiber) {
       
 10716         uniqueNames.add(getComponentName(fiber.type) || 'Component');
       
 10717         didWarnAboutDeprecatedLifecycles.add(fiber.type);
       
 10718       });
       
 10719 
       
 10720       var sortedNames = setToSortedString(uniqueNames);
       
 10721 
       
 10722       lowPriorityWarning$1(false, 'componentWillMount is deprecated and will be removed in the next major version. ' + 'Use componentDidMount instead. As a temporary workaround, ' + 'you can rename to UNSAFE_componentWillMount.' + '\n\nPlease update the following components: %s' + '\n\nLearn more about this warning here:' + '\nhttps://fb.me/react-async-component-lifecycle-hooks', sortedNames);
       
 10723 
       
 10724       pendingComponentWillMountWarnings = [];
       
 10725     }
       
 10726 
       
 10727     if (pendingComponentWillReceivePropsWarnings.length > 0) {
       
 10728       var _uniqueNames = new Set();
       
 10729       pendingComponentWillReceivePropsWarnings.forEach(function (fiber) {
       
 10730         _uniqueNames.add(getComponentName(fiber.type) || 'Component');
       
 10731         didWarnAboutDeprecatedLifecycles.add(fiber.type);
       
 10732       });
       
 10733 
       
 10734       var _sortedNames = setToSortedString(_uniqueNames);
       
 10735 
       
 10736       lowPriorityWarning$1(false, 'componentWillReceiveProps is deprecated and will be removed in the next major version. ' + 'Use static getDerivedStateFromProps instead.' + '\n\nPlease update the following components: %s' + '\n\nLearn more about this warning here:' + '\nhttps://fb.me/react-async-component-lifecycle-hooks', _sortedNames);
       
 10737 
       
 10738       pendingComponentWillReceivePropsWarnings = [];
       
 10739     }
       
 10740 
       
 10741     if (pendingComponentWillUpdateWarnings.length > 0) {
       
 10742       var _uniqueNames2 = new Set();
       
 10743       pendingComponentWillUpdateWarnings.forEach(function (fiber) {
       
 10744         _uniqueNames2.add(getComponentName(fiber.type) || 'Component');
       
 10745         didWarnAboutDeprecatedLifecycles.add(fiber.type);
       
 10746       });
       
 10747 
       
 10748       var _sortedNames2 = setToSortedString(_uniqueNames2);
       
 10749 
       
 10750       lowPriorityWarning$1(false, 'componentWillUpdate is deprecated and will be removed in the next major version. ' + 'Use componentDidUpdate instead. As a temporary workaround, ' + 'you can rename to UNSAFE_componentWillUpdate.' + '\n\nPlease update the following components: %s' + '\n\nLearn more about this warning here:' + '\nhttps://fb.me/react-async-component-lifecycle-hooks', _sortedNames2);
       
 10751 
       
 10752       pendingComponentWillUpdateWarnings = [];
       
 10753     }
       
 10754   };
       
 10755 
       
 10756   ReactStrictModeWarnings.recordDeprecationWarnings = function (fiber, instance) {
       
 10757     // Dedup strategy: Warn once per component.
       
 10758     if (didWarnAboutDeprecatedLifecycles.has(fiber.type)) {
       
 10759       return;
       
 10760     }
       
 10761 
       
 10762     // Don't warn about react-lifecycles-compat polyfilled components.
       
 10763     if (typeof instance.componentWillMount === 'function' && instance.componentWillMount.__suppressDeprecationWarning !== true) {
       
 10764       pendingComponentWillMountWarnings.push(fiber);
       
 10765     }
       
 10766     if (typeof instance.componentWillReceiveProps === 'function' && instance.componentWillReceiveProps.__suppressDeprecationWarning !== true) {
       
 10767       pendingComponentWillReceivePropsWarnings.push(fiber);
       
 10768     }
       
 10769     if (typeof instance.componentWillUpdate === 'function' && instance.componentWillUpdate.__suppressDeprecationWarning !== true) {
       
 10770       pendingComponentWillUpdateWarnings.push(fiber);
       
 10771     }
       
 10772   };
       
 10773 
       
 10774   ReactStrictModeWarnings.recordUnsafeLifecycleWarnings = function (fiber, instance) {
       
 10775     var strictRoot = findStrictRoot(fiber);
       
 10776     if (strictRoot === null) {
       
 10777       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.');
       
 10778       return;
       
 10779     }
       
 10780 
       
 10781     // Dedup strategy: Warn once per component.
       
 10782     // This is difficult to track any other way since component names
       
 10783     // are often vague and are likely to collide between 3rd party libraries.
       
 10784     // An expand property is probably okay to use here since it's DEV-only,
       
 10785     // and will only be set in the event of serious warnings.
       
 10786     if (didWarnAboutUnsafeLifecycles.has(fiber.type)) {
       
 10787       return;
       
 10788     }
       
 10789 
       
 10790     var warningsForRoot = void 0;
       
 10791     if (!pendingUnsafeLifecycleWarnings.has(strictRoot)) {
       
 10792       warningsForRoot = {
       
 10793         UNSAFE_componentWillMount: [],
       
 10794         UNSAFE_componentWillReceiveProps: [],
       
 10795         UNSAFE_componentWillUpdate: []
       
 10796       };
       
 10797 
       
 10798       pendingUnsafeLifecycleWarnings.set(strictRoot, warningsForRoot);
       
 10799     } else {
       
 10800       warningsForRoot = pendingUnsafeLifecycleWarnings.get(strictRoot);
       
 10801     }
       
 10802 
       
 10803     var unsafeLifecycles = [];
       
 10804     if (typeof instance.componentWillMount === 'function' && instance.componentWillMount.__suppressDeprecationWarning !== true || typeof instance.UNSAFE_componentWillMount === 'function') {
       
 10805       unsafeLifecycles.push('UNSAFE_componentWillMount');
       
 10806     }
       
 10807     if (typeof instance.componentWillReceiveProps === 'function' && instance.componentWillReceiveProps.__suppressDeprecationWarning !== true || typeof instance.UNSAFE_componentWillReceiveProps === 'function') {
       
 10808       unsafeLifecycles.push('UNSAFE_componentWillReceiveProps');
       
 10809     }
       
 10810     if (typeof instance.componentWillUpdate === 'function' && instance.componentWillUpdate.__suppressDeprecationWarning !== true || typeof instance.UNSAFE_componentWillUpdate === 'function') {
       
 10811       unsafeLifecycles.push('UNSAFE_componentWillUpdate');
       
 10812     }
       
 10813 
       
 10814     if (unsafeLifecycles.length > 0) {
       
 10815       unsafeLifecycles.forEach(function (lifecycle) {
       
 10816         warningsForRoot[lifecycle].push(fiber);
       
 10817       });
       
 10818     }
       
 10819   };
       
 10820 
       
 10821   ReactStrictModeWarnings.recordLegacyContextWarning = function (fiber, instance) {
       
 10822     var strictRoot = findStrictRoot(fiber);
       
 10823     if (strictRoot === null) {
       
 10824       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.');
       
 10825       return;
       
 10826     }
       
 10827 
       
 10828     // Dedup strategy: Warn once per component.
       
 10829     if (didWarnAboutLegacyContext.has(fiber.type)) {
       
 10830       return;
       
 10831     }
       
 10832 
       
 10833     var warningsForRoot = pendingLegacyContextWarning.get(strictRoot);
       
 10834 
       
 10835     if (fiber.type.contextTypes != null || fiber.type.childContextTypes != null || instance !== null && typeof instance.getChildContext === 'function') {
       
 10836       if (warningsForRoot === undefined) {
       
 10837         warningsForRoot = [];
       
 10838         pendingLegacyContextWarning.set(strictRoot, warningsForRoot);
       
 10839       }
       
 10840       warningsForRoot.push(fiber);
       
 10841     }
       
 10842   };
       
 10843 
       
 10844   ReactStrictModeWarnings.flushLegacyContextWarning = function () {
       
 10845     pendingLegacyContextWarning.forEach(function (fiberArray, strictRoot) {
       
 10846       var uniqueNames = new Set();
       
 10847       fiberArray.forEach(function (fiber) {
       
 10848         uniqueNames.add(getComponentName(fiber.type) || 'Component');
       
 10849         didWarnAboutLegacyContext.add(fiber.type);
       
 10850       });
       
 10851 
       
 10852       var sortedNames = setToSortedString(uniqueNames);
       
 10853       var strictRootComponentStack = getStackByFiberInDevAndProd(strictRoot);
       
 10854 
       
 10855       warningWithoutStack$1(false, 'Legacy context API has been detected within a strict-mode tree: %s' + '\n\nPlease update the following components: %s' + '\n\nLearn more about this warning here:' + '\nhttps://fb.me/react-strict-mode-warnings', strictRootComponentStack, sortedNames);
       
 10856     });
       
 10857   };
       
 10858 }
       
 10859 
       
 10860 // This lets us hook into Fiber to debug what it's doing.
       
 10861 // See https://github.com/facebook/react/pull/8033.
       
 10862 // This is not part of the public API, not even for React DevTools.
       
 10863 // You may only inject a debugTool if you work on React Fiber itself.
       
 10864 var ReactFiberInstrumentation = {
       
 10865   debugTool: null
       
 10866 };
       
 10867 
       
 10868 var ReactFiberInstrumentation_1 = ReactFiberInstrumentation;
       
 10869 
       
 10870 // TODO: Offscreen updates should never suspend. However, a promise that
       
 10871 // suspended inside an offscreen subtree should be able to ping at the priority
       
 10872 // of the outer render.
       
 10873 
       
 10874 function markPendingPriorityLevel(root, expirationTime) {
       
 10875   // If there's a gap between completing a failed root and retrying it,
       
 10876   // additional updates may be scheduled. Clear `didError`, in case the update
       
 10877   // is sufficient to fix the error.
       
 10878   root.didError = false;
       
 10879 
       
 10880   // Update the latest and earliest pending times
       
 10881   var earliestPendingTime = root.earliestPendingTime;
       
 10882   if (earliestPendingTime === NoWork) {
       
 10883     // No other pending updates.
       
 10884     root.earliestPendingTime = root.latestPendingTime = expirationTime;
       
 10885   } else {
       
 10886     if (earliestPendingTime < expirationTime) {
       
 10887       // This is the earliest pending update.
       
 10888       root.earliestPendingTime = expirationTime;
       
 10889     } else {
       
 10890       var latestPendingTime = root.latestPendingTime;
       
 10891       if (latestPendingTime > expirationTime) {
       
 10892         // This is the latest pending update
       
 10893         root.latestPendingTime = expirationTime;
       
 10894       }
       
 10895     }
       
 10896   }
       
 10897   findNextExpirationTimeToWorkOn(expirationTime, root);
       
 10898 }
       
 10899 
       
 10900 function markCommittedPriorityLevels(root, earliestRemainingTime) {
       
 10901   root.didError = false;
       
 10902 
       
 10903   if (earliestRemainingTime === NoWork) {
       
 10904     // Fast path. There's no remaining work. Clear everything.
       
 10905     root.earliestPendingTime = NoWork;
       
 10906     root.latestPendingTime = NoWork;
       
 10907     root.earliestSuspendedTime = NoWork;
       
 10908     root.latestSuspendedTime = NoWork;
       
 10909     root.latestPingedTime = NoWork;
       
 10910     findNextExpirationTimeToWorkOn(NoWork, root);
       
 10911     return;
       
 10912   }
       
 10913 
       
 10914   if (earliestRemainingTime < root.latestPingedTime) {
       
 10915     root.latestPingedTime = NoWork;
       
 10916   }
       
 10917 
       
 10918   // Let's see if the previous latest known pending level was just flushed.
       
 10919   var latestPendingTime = root.latestPendingTime;
       
 10920   if (latestPendingTime !== NoWork) {
       
 10921     if (latestPendingTime > earliestRemainingTime) {
       
 10922       // We've flushed all the known pending levels.
       
 10923       root.earliestPendingTime = root.latestPendingTime = NoWork;
       
 10924     } else {
       
 10925       var earliestPendingTime = root.earliestPendingTime;
       
 10926       if (earliestPendingTime > earliestRemainingTime) {
       
 10927         // We've flushed the earliest known pending level. Set this to the
       
 10928         // latest pending time.
       
 10929         root.earliestPendingTime = root.latestPendingTime;
       
 10930       }
       
 10931     }
       
 10932   }
       
 10933 
       
 10934   // Now let's handle the earliest remaining level in the whole tree. We need to
       
 10935   // decide whether to treat it as a pending level or as suspended. Check
       
 10936   // it falls within the range of known suspended levels.
       
 10937 
       
 10938   var earliestSuspendedTime = root.earliestSuspendedTime;
       
 10939   if (earliestSuspendedTime === NoWork) {
       
 10940     // There's no suspended work. Treat the earliest remaining level as a
       
 10941     // pending level.
       
 10942     markPendingPriorityLevel(root, earliestRemainingTime);
       
 10943     findNextExpirationTimeToWorkOn(NoWork, root);
       
 10944     return;
       
 10945   }
       
 10946 
       
 10947   var latestSuspendedTime = root.latestSuspendedTime;
       
 10948   if (earliestRemainingTime < latestSuspendedTime) {
       
 10949     // The earliest remaining level is later than all the suspended work. That
       
 10950     // means we've flushed all the suspended work.
       
 10951     root.earliestSuspendedTime = NoWork;
       
 10952     root.latestSuspendedTime = NoWork;
       
 10953     root.latestPingedTime = NoWork;
       
 10954 
       
 10955     // There's no suspended work. Treat the earliest remaining level as a
       
 10956     // pending level.
       
 10957     markPendingPriorityLevel(root, earliestRemainingTime);
       
 10958     findNextExpirationTimeToWorkOn(NoWork, root);
       
 10959     return;
       
 10960   }
       
 10961 
       
 10962   if (earliestRemainingTime > earliestSuspendedTime) {
       
 10963     // The earliest remaining time is earlier than all the suspended work.
       
 10964     // Treat it as a pending update.
       
 10965     markPendingPriorityLevel(root, earliestRemainingTime);
       
 10966     findNextExpirationTimeToWorkOn(NoWork, root);
       
 10967     return;
       
 10968   }
       
 10969 
       
 10970   // The earliest remaining time falls within the range of known suspended
       
 10971   // levels. We should treat this as suspended work.
       
 10972   findNextExpirationTimeToWorkOn(NoWork, root);
       
 10973 }
       
 10974 
       
 10975 function hasLowerPriorityWork(root, erroredExpirationTime) {
       
 10976   var latestPendingTime = root.latestPendingTime;
       
 10977   var latestSuspendedTime = root.latestSuspendedTime;
       
 10978   var latestPingedTime = root.latestPingedTime;
       
 10979   return latestPendingTime !== NoWork && latestPendingTime < erroredExpirationTime || latestSuspendedTime !== NoWork && latestSuspendedTime < erroredExpirationTime || latestPingedTime !== NoWork && latestPingedTime < erroredExpirationTime;
       
 10980 }
       
 10981 
       
 10982 function isPriorityLevelSuspended(root, expirationTime) {
       
 10983   var earliestSuspendedTime = root.earliestSuspendedTime;
       
 10984   var latestSuspendedTime = root.latestSuspendedTime;
       
 10985   return earliestSuspendedTime !== NoWork && expirationTime <= earliestSuspendedTime && expirationTime >= latestSuspendedTime;
       
 10986 }
       
 10987 
       
 10988 function markSuspendedPriorityLevel(root, suspendedTime) {
       
 10989   root.didError = false;
       
 10990   clearPing(root, suspendedTime);
       
 10991 
       
 10992   // First, check the known pending levels and update them if needed.
       
 10993   var earliestPendingTime = root.earliestPendingTime;
       
 10994   var latestPendingTime = root.latestPendingTime;
       
 10995   if (earliestPendingTime === suspendedTime) {
       
 10996     if (latestPendingTime === suspendedTime) {
       
 10997       // Both known pending levels were suspended. Clear them.
       
 10998       root.earliestPendingTime = root.latestPendingTime = NoWork;
       
 10999     } else {
       
 11000       // The earliest pending level was suspended. Clear by setting it to the
       
 11001       // latest pending level.
       
 11002       root.earliestPendingTime = latestPendingTime;
       
 11003     }
       
 11004   } else if (latestPendingTime === suspendedTime) {
       
 11005     // The latest pending level was suspended. Clear by setting it to the
       
 11006     // latest pending level.
       
 11007     root.latestPendingTime = earliestPendingTime;
       
 11008   }
       
 11009 
       
 11010   // Finally, update the known suspended levels.
       
 11011   var earliestSuspendedTime = root.earliestSuspendedTime;
       
 11012   var latestSuspendedTime = root.latestSuspendedTime;
       
 11013   if (earliestSuspendedTime === NoWork) {
       
 11014     // No other suspended levels.
       
 11015     root.earliestSuspendedTime = root.latestSuspendedTime = suspendedTime;
       
 11016   } else {
       
 11017     if (earliestSuspendedTime < suspendedTime) {
       
 11018       // This is the earliest suspended level.
       
 11019       root.earliestSuspendedTime = suspendedTime;
       
 11020     } else if (latestSuspendedTime > suspendedTime) {
       
 11021       // This is the latest suspended level
       
 11022       root.latestSuspendedTime = suspendedTime;
       
 11023     }
       
 11024   }
       
 11025 
       
 11026   findNextExpirationTimeToWorkOn(suspendedTime, root);
       
 11027 }
       
 11028 
       
 11029 function markPingedPriorityLevel(root, pingedTime) {
       
 11030   root.didError = false;
       
 11031 
       
 11032   // TODO: When we add back resuming, we need to ensure the progressed work
       
 11033   // is thrown out and not reused during the restarted render. One way to
       
 11034   // invalidate the progressed work is to restart at expirationTime + 1.
       
 11035   var latestPingedTime = root.latestPingedTime;
       
 11036   if (latestPingedTime === NoWork || latestPingedTime > pingedTime) {
       
 11037     root.latestPingedTime = pingedTime;
       
 11038   }
       
 11039   findNextExpirationTimeToWorkOn(pingedTime, root);
       
 11040 }
       
 11041 
       
 11042 function clearPing(root, completedTime) {
       
 11043   var latestPingedTime = root.latestPingedTime;
       
 11044   if (latestPingedTime >= completedTime) {
       
 11045     root.latestPingedTime = NoWork;
       
 11046   }
       
 11047 }
       
 11048 
       
 11049 function findEarliestOutstandingPriorityLevel(root, renderExpirationTime) {
       
 11050   var earliestExpirationTime = renderExpirationTime;
       
 11051 
       
 11052   var earliestPendingTime = root.earliestPendingTime;
       
 11053   var earliestSuspendedTime = root.earliestSuspendedTime;
       
 11054   if (earliestPendingTime > earliestExpirationTime) {
       
 11055     earliestExpirationTime = earliestPendingTime;
       
 11056   }
       
 11057   if (earliestSuspendedTime > earliestExpirationTime) {
       
 11058     earliestExpirationTime = earliestSuspendedTime;
       
 11059   }
       
 11060   return earliestExpirationTime;
       
 11061 }
       
 11062 
       
 11063 function didExpireAtExpirationTime(root, currentTime) {
       
 11064   var expirationTime = root.expirationTime;
       
 11065   if (expirationTime !== NoWork && currentTime <= expirationTime) {
       
 11066     // The root has expired. Flush all work up to the current time.
       
 11067     root.nextExpirationTimeToWorkOn = currentTime;
       
 11068   }
       
 11069 }
       
 11070 
       
 11071 function findNextExpirationTimeToWorkOn(completedExpirationTime, root) {
       
 11072   var earliestSuspendedTime = root.earliestSuspendedTime;
       
 11073   var latestSuspendedTime = root.latestSuspendedTime;
       
 11074   var earliestPendingTime = root.earliestPendingTime;
       
 11075   var latestPingedTime = root.latestPingedTime;
       
 11076 
       
 11077   // Work on the earliest pending time. Failing that, work on the latest
       
 11078   // pinged time.
       
 11079   var nextExpirationTimeToWorkOn = earliestPendingTime !== NoWork ? earliestPendingTime : latestPingedTime;
       
 11080 
       
 11081   // If there is no pending or pinged work, check if there's suspended work
       
 11082   // that's lower priority than what we just completed.
       
 11083   if (nextExpirationTimeToWorkOn === NoWork && (completedExpirationTime === NoWork || latestSuspendedTime < completedExpirationTime)) {
       
 11084     // The lowest priority suspended work is the work most likely to be
       
 11085     // committed next. Let's start rendering it again, so that if it times out,
       
 11086     // it's ready to commit.
       
 11087     nextExpirationTimeToWorkOn = latestSuspendedTime;
       
 11088   }
       
 11089 
       
 11090   var expirationTime = nextExpirationTimeToWorkOn;
       
 11091   if (expirationTime !== NoWork && earliestSuspendedTime > expirationTime) {
       
 11092     // Expire using the earliest known expiration time.
       
 11093     expirationTime = earliestSuspendedTime;
       
 11094   }
       
 11095 
       
 11096   root.nextExpirationTimeToWorkOn = nextExpirationTimeToWorkOn;
       
 11097   root.expirationTime = expirationTime;
       
 11098 }
       
 11099 
       
 11100 function resolveDefaultProps(Component, baseProps) {
       
 11101   if (Component && Component.defaultProps) {
       
 11102     // Resolve default props. Taken from ReactElement
       
 11103     var props = _assign({}, baseProps);
       
 11104     var defaultProps = Component.defaultProps;
       
 11105     for (var propName in defaultProps) {
       
 11106       if (props[propName] === undefined) {
       
 11107         props[propName] = defaultProps[propName];
       
 11108       }
       
 11109     }
       
 11110     return props;
       
 11111   }
       
 11112   return baseProps;
       
 11113 }
       
 11114 
       
 11115 function readLazyComponentType(lazyComponent) {
       
 11116   var status = lazyComponent._status;
       
 11117   var result = lazyComponent._result;
       
 11118   switch (status) {
       
 11119     case Resolved:
       
 11120       {
       
 11121         var Component = result;
       
 11122         return Component;
       
 11123       }
       
 11124     case Rejected:
       
 11125       {
       
 11126         var error = result;
       
 11127         throw error;
       
 11128       }
       
 11129     case Pending:
       
 11130       {
       
 11131         var thenable = result;
       
 11132         throw thenable;
       
 11133       }
       
 11134     default:
       
 11135       {
       
 11136         lazyComponent._status = Pending;
       
 11137         var ctor = lazyComponent._ctor;
       
 11138         var _thenable = ctor();
       
 11139         _thenable.then(function (moduleObject) {
       
 11140           if (lazyComponent._status === Pending) {
       
 11141             var defaultExport = moduleObject.default;
       
 11142             {
       
 11143               if (defaultExport === undefined) {
       
 11144                 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);
       
 11145               }
       
 11146             }
       
 11147             lazyComponent._status = Resolved;
       
 11148             lazyComponent._result = defaultExport;
       
 11149           }
       
 11150         }, function (error) {
       
 11151           if (lazyComponent._status === Pending) {
       
 11152             lazyComponent._status = Rejected;
       
 11153             lazyComponent._result = error;
       
 11154           }
       
 11155         });
       
 11156         // Handle synchronous thenables.
       
 11157         switch (lazyComponent._status) {
       
 11158           case Resolved:
       
 11159             return lazyComponent._result;
       
 11160           case Rejected:
       
 11161             throw lazyComponent._result;
       
 11162         }
       
 11163         lazyComponent._result = _thenable;
       
 11164         throw _thenable;
       
 11165       }
       
 11166   }
       
 11167 }
       
 11168 
       
 11169 var fakeInternalInstance = {};
       
 11170 var isArray$1 = Array.isArray;
       
 11171 
       
 11172 // React.Component uses a shared frozen object by default.
       
 11173 // We'll use it to determine whether we need to initialize legacy refs.
       
 11174 var emptyRefsObject = new React.Component().refs;
       
 11175 
       
 11176 var didWarnAboutStateAssignmentForComponent = void 0;
       
 11177 var didWarnAboutUninitializedState = void 0;
       
 11178 var didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate = void 0;
       
 11179 var didWarnAboutLegacyLifecyclesAndDerivedState = void 0;
       
 11180 var didWarnAboutUndefinedDerivedState = void 0;
       
 11181 var warnOnUndefinedDerivedState = void 0;
       
 11182 var warnOnInvalidCallback$1 = void 0;
       
 11183 var didWarnAboutDirectlyAssigningPropsToState = void 0;
       
 11184 var didWarnAboutContextTypeAndContextTypes = void 0;
       
 11185 var didWarnAboutInvalidateContextType = void 0;
       
 11186 
       
 11187 {
       
 11188   didWarnAboutStateAssignmentForComponent = new Set();
       
 11189   didWarnAboutUninitializedState = new Set();
       
 11190   didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate = new Set();
       
 11191   didWarnAboutLegacyLifecyclesAndDerivedState = new Set();
       
 11192   didWarnAboutDirectlyAssigningPropsToState = new Set();
       
 11193   didWarnAboutUndefinedDerivedState = new Set();
       
 11194   didWarnAboutContextTypeAndContextTypes = new Set();
       
 11195   didWarnAboutInvalidateContextType = new Set();
       
 11196 
       
 11197   var didWarnOnInvalidCallback = new Set();
       
 11198 
       
 11199   warnOnInvalidCallback$1 = function (callback, callerName) {
       
 11200     if (callback === null || typeof callback === 'function') {
       
 11201       return;
       
 11202     }
       
 11203     var key = callerName + '_' + callback;
       
 11204     if (!didWarnOnInvalidCallback.has(key)) {
       
 11205       didWarnOnInvalidCallback.add(key);
       
 11206       warningWithoutStack$1(false, '%s(...): Expected the last optional `callback` argument to be a ' + 'function. Instead received: %s.', callerName, callback);
       
 11207     }
       
 11208   };
       
 11209 
       
 11210   warnOnUndefinedDerivedState = function (type, partialState) {
       
 11211     if (partialState === undefined) {
       
 11212       var componentName = getComponentName(type) || 'Component';
       
 11213       if (!didWarnAboutUndefinedDerivedState.has(componentName)) {
       
 11214         didWarnAboutUndefinedDerivedState.add(componentName);
       
 11215         warningWithoutStack$1(false, '%s.getDerivedStateFromProps(): A valid state object (or null) must be returned. ' + 'You have returned undefined.', componentName);
       
 11216       }
       
 11217     }
       
 11218   };
       
 11219 
       
 11220   // This is so gross but it's at least non-critical and can be removed if
       
 11221   // it causes problems. This is meant to give a nicer error message for
       
 11222   // ReactDOM15.unstable_renderSubtreeIntoContainer(reactDOM16Component,
       
 11223   // ...)) which otherwise throws a "_processChildContext is not a function"
       
 11224   // exception.
       
 11225   Object.defineProperty(fakeInternalInstance, '_processChildContext', {
       
 11226     enumerable: false,
       
 11227     value: function () {
       
 11228       invariant(false, '_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).');
       
 11229     }
       
 11230   });
       
 11231   Object.freeze(fakeInternalInstance);
       
 11232 }
       
 11233 
       
 11234 function applyDerivedStateFromProps(workInProgress, ctor, getDerivedStateFromProps, nextProps) {
       
 11235   var prevState = workInProgress.memoizedState;
       
 11236 
       
 11237   {
       
 11238     if (debugRenderPhaseSideEffects || debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
       
 11239       // Invoke the function an extra time to help detect side-effects.
       
 11240       getDerivedStateFromProps(nextProps, prevState);
       
 11241     }
       
 11242   }
       
 11243 
       
 11244   var partialState = getDerivedStateFromProps(nextProps, prevState);
       
 11245 
       
 11246   {
       
 11247     warnOnUndefinedDerivedState(ctor, partialState);
       
 11248   }
       
 11249   // Merge the partial state and the previous state.
       
 11250   var memoizedState = partialState === null || partialState === undefined ? prevState : _assign({}, prevState, partialState);
       
 11251   workInProgress.memoizedState = memoizedState;
       
 11252 
       
 11253   // Once the update queue is empty, persist the derived state onto the
       
 11254   // base state.
       
 11255   var updateQueue = workInProgress.updateQueue;
       
 11256   if (updateQueue !== null && workInProgress.expirationTime === NoWork) {
       
 11257     updateQueue.baseState = memoizedState;
       
 11258   }
       
 11259 }
       
 11260 
       
 11261 var classComponentUpdater = {
       
 11262   isMounted: isMounted,
       
 11263   enqueueSetState: function (inst, payload, callback) {
       
 11264     var fiber = get(inst);
       
 11265     var currentTime = requestCurrentTime();
       
 11266     var expirationTime = computeExpirationForFiber(currentTime, fiber);
       
 11267 
       
 11268     var update = createUpdate(expirationTime);
       
 11269     update.payload = payload;
       
 11270     if (callback !== undefined && callback !== null) {
       
 11271       {
       
 11272         warnOnInvalidCallback$1(callback, 'setState');
       
 11273       }
       
 11274       update.callback = callback;
       
 11275     }
       
 11276 
       
 11277     flushPassiveEffects();
       
 11278     enqueueUpdate(fiber, update);
       
 11279     scheduleWork(fiber, expirationTime);
       
 11280   },
       
 11281   enqueueReplaceState: function (inst, payload, callback) {
       
 11282     var fiber = get(inst);
       
 11283     var currentTime = requestCurrentTime();
       
 11284     var expirationTime = computeExpirationForFiber(currentTime, fiber);
       
 11285 
       
 11286     var update = createUpdate(expirationTime);
       
 11287     update.tag = ReplaceState;
       
 11288     update.payload = payload;
       
 11289 
       
 11290     if (callback !== undefined && callback !== null) {
       
 11291       {
       
 11292         warnOnInvalidCallback$1(callback, 'replaceState');
       
 11293       }
       
 11294       update.callback = callback;
       
 11295     }
       
 11296 
       
 11297     flushPassiveEffects();
       
 11298     enqueueUpdate(fiber, update);
       
 11299     scheduleWork(fiber, expirationTime);
       
 11300   },
       
 11301   enqueueForceUpdate: function (inst, callback) {
       
 11302     var fiber = get(inst);
       
 11303     var currentTime = requestCurrentTime();
       
 11304     var expirationTime = computeExpirationForFiber(currentTime, fiber);
       
 11305 
       
 11306     var update = createUpdate(expirationTime);
       
 11307     update.tag = ForceUpdate;
       
 11308 
       
 11309     if (callback !== undefined && callback !== null) {
       
 11310       {
       
 11311         warnOnInvalidCallback$1(callback, 'forceUpdate');
       
 11312       }
       
 11313       update.callback = callback;
       
 11314     }
       
 11315 
       
 11316     flushPassiveEffects();
       
 11317     enqueueUpdate(fiber, update);
       
 11318     scheduleWork(fiber, expirationTime);
       
 11319   }
       
 11320 };
       
 11321 
       
 11322 function checkShouldComponentUpdate(workInProgress, ctor, oldProps, newProps, oldState, newState, nextContext) {
       
 11323   var instance = workInProgress.stateNode;
       
 11324   if (typeof instance.shouldComponentUpdate === 'function') {
       
 11325     startPhaseTimer(workInProgress, 'shouldComponentUpdate');
       
 11326     var shouldUpdate = instance.shouldComponentUpdate(newProps, newState, nextContext);
       
 11327     stopPhaseTimer();
       
 11328 
       
 11329     {
       
 11330       !(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;
       
 11331     }
       
 11332 
       
 11333     return shouldUpdate;
       
 11334   }
       
 11335 
       
 11336   if (ctor.prototype && ctor.prototype.isPureReactComponent) {
       
 11337     return !shallowEqual(oldProps, newProps) || !shallowEqual(oldState, newState);
       
 11338   }
       
 11339 
       
 11340   return true;
       
 11341 }
       
 11342 
       
 11343 function checkClassInstance(workInProgress, ctor, newProps) {
       
 11344   var instance = workInProgress.stateNode;
       
 11345   {
       
 11346     var name = getComponentName(ctor) || 'Component';
       
 11347     var renderPresent = instance.render;
       
 11348 
       
 11349     if (!renderPresent) {
       
 11350       if (ctor.prototype && typeof ctor.prototype.render === 'function') {
       
 11351         warningWithoutStack$1(false, '%s(...): No `render` method found on the returned component ' + 'instance: did you accidentally return an object from the constructor?', name);
       
 11352       } else {
       
 11353         warningWithoutStack$1(false, '%s(...): No `render` method found on the returned component ' + 'instance: you may have forgotten to define `render`.', name);
       
 11354       }
       
 11355     }
       
 11356 
       
 11357     var noGetInitialStateOnES6 = !instance.getInitialState || instance.getInitialState.isReactClassApproved || instance.state;
       
 11358     !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;
       
 11359     var noGetDefaultPropsOnES6 = !instance.getDefaultProps || instance.getDefaultProps.isReactClassApproved;
       
 11360     !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;
       
 11361     var noInstancePropTypes = !instance.propTypes;
       
 11362     !noInstancePropTypes ? warningWithoutStack$1(false, 'propTypes was defined as an instance property on %s. Use a static ' + 'property to define propTypes instead.', name) : void 0;
       
 11363     var noInstanceContextType = !instance.contextType;
       
 11364     !noInstanceContextType ? warningWithoutStack$1(false, 'contextType was defined as an instance property on %s. Use a static ' + 'property to define contextType instead.', name) : void 0;
       
 11365     var noInstanceContextTypes = !instance.contextTypes;
       
 11366     !noInstanceContextTypes ? warningWithoutStack$1(false, 'contextTypes was defined as an instance property on %s. Use a static ' + 'property to define contextTypes instead.', name) : void 0;
       
 11367 
       
 11368     if (ctor.contextType && ctor.contextTypes && !didWarnAboutContextTypeAndContextTypes.has(ctor)) {
       
 11369       didWarnAboutContextTypeAndContextTypes.add(ctor);
       
 11370       warningWithoutStack$1(false, '%s declares both contextTypes and contextType static properties. ' + 'The legacy contextTypes property will be ignored.', name);
       
 11371     }
       
 11372 
       
 11373     var noComponentShouldUpdate = typeof instance.componentShouldUpdate !== 'function';
       
 11374     !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;
       
 11375     if (ctor.prototype && ctor.prototype.isPureReactComponent && typeof instance.shouldComponentUpdate !== 'undefined') {
       
 11376       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');
       
 11377     }
       
 11378     var noComponentDidUnmount = typeof instance.componentDidUnmount !== 'function';
       
 11379     !noComponentDidUnmount ? warningWithoutStack$1(false, '%s has a method called ' + 'componentDidUnmount(). But there is no such lifecycle method. ' + 'Did you mean componentWillUnmount()?', name) : void 0;
       
 11380     var noComponentDidReceiveProps = typeof instance.componentDidReceiveProps !== 'function';
       
 11381     !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;
       
 11382     var noComponentWillRecieveProps = typeof instance.componentWillRecieveProps !== 'function';
       
 11383     !noComponentWillRecieveProps ? warningWithoutStack$1(false, '%s has a method called ' + 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', name) : void 0;
       
 11384     var noUnsafeComponentWillRecieveProps = typeof instance.UNSAFE_componentWillRecieveProps !== 'function';
       
 11385     !noUnsafeComponentWillRecieveProps ? warningWithoutStack$1(false, '%s has a method called ' + 'UNSAFE_componentWillRecieveProps(). Did you mean UNSAFE_componentWillReceiveProps()?', name) : void 0;
       
 11386     var hasMutatedProps = instance.props !== newProps;
       
 11387     !(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;
       
 11388     var noInstanceDefaultProps = !instance.defaultProps;
       
 11389     !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;
       
 11390 
       
 11391     if (typeof instance.getSnapshotBeforeUpdate === 'function' && typeof instance.componentDidUpdate !== 'function' && !didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate.has(ctor)) {
       
 11392       didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate.add(ctor);
       
 11393       warningWithoutStack$1(false, '%s: getSnapshotBeforeUpdate() should be used with componentDidUpdate(). ' + 'This component defines getSnapshotBeforeUpdate() only.', getComponentName(ctor));
       
 11394     }
       
 11395 
       
 11396     var noInstanceGetDerivedStateFromProps = typeof instance.getDerivedStateFromProps !== 'function';
       
 11397     !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;
       
 11398     var noInstanceGetDerivedStateFromCatch = typeof instance.getDerivedStateFromError !== 'function';
       
 11399     !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;
       
 11400     var noStaticGetSnapshotBeforeUpdate = typeof ctor.getSnapshotBeforeUpdate !== 'function';
       
 11401     !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;
       
 11402     var _state = instance.state;
       
 11403     if (_state && (typeof _state !== 'object' || isArray$1(_state))) {
       
 11404       warningWithoutStack$1(false, '%s.state: must be set to an object or null', name);
       
 11405     }
       
 11406     if (typeof instance.getChildContext === 'function') {
       
 11407       !(typeof ctor.childContextTypes === 'object') ? warningWithoutStack$1(false, '%s.getChildContext(): childContextTypes must be defined in order to ' + 'use getChildContext().', name) : void 0;
       
 11408     }
       
 11409   }
       
 11410 }
       
 11411 
       
 11412 function adoptClassInstance(workInProgress, instance) {
       
 11413   instance.updater = classComponentUpdater;
       
 11414   workInProgress.stateNode = instance;
       
 11415   // The instance needs access to the fiber so that it can schedule updates
       
 11416   set(instance, workInProgress);
       
 11417   {
       
 11418     instance._reactInternalInstance = fakeInternalInstance;
       
 11419   }
       
 11420 }
       
 11421 
       
 11422 function constructClassInstance(workInProgress, ctor, props, renderExpirationTime) {
       
 11423   var isLegacyContextConsumer = false;
       
 11424   var unmaskedContext = emptyContextObject;
       
 11425   var context = null;
       
 11426   var contextType = ctor.contextType;
       
 11427   if (typeof contextType === 'object' && contextType !== null) {
       
 11428     {
       
 11429       if (contextType.$$typeof !== REACT_CONTEXT_TYPE && !didWarnAboutInvalidateContextType.has(ctor)) {
       
 11430         didWarnAboutInvalidateContextType.add(ctor);
       
 11431         warningWithoutStack$1(false, '%s defines an invalid contextType. ' + 'contextType should point to the Context object returned by React.createContext(). ' + 'Did you accidentally pass the Context.Provider instead?', getComponentName(ctor) || 'Component');
       
 11432       }
       
 11433     }
       
 11434 
       
 11435     context = readContext(contextType);
       
 11436   } else {
       
 11437     unmaskedContext = getUnmaskedContext(workInProgress, ctor, true);
       
 11438     var contextTypes = ctor.contextTypes;
       
 11439     isLegacyContextConsumer = contextTypes !== null && contextTypes !== undefined;
       
 11440     context = isLegacyContextConsumer ? getMaskedContext(workInProgress, unmaskedContext) : emptyContextObject;
       
 11441   }
       
 11442 
       
 11443   // Instantiate twice to help detect side-effects.
       
 11444   {
       
 11445     if (debugRenderPhaseSideEffects || debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
       
 11446       new ctor(props, context); // eslint-disable-line no-new
       
 11447     }
       
 11448   }
       
 11449 
       
 11450   var instance = new ctor(props, context);
       
 11451   var state = workInProgress.memoizedState = instance.state !== null && instance.state !== undefined ? instance.state : null;
       
 11452   adoptClassInstance(workInProgress, instance);
       
 11453 
       
 11454   {
       
 11455     if (typeof ctor.getDerivedStateFromProps === 'function' && state === null) {
       
 11456       var componentName = getComponentName(ctor) || 'Component';
       
 11457       if (!didWarnAboutUninitializedState.has(componentName)) {
       
 11458         didWarnAboutUninitializedState.add(componentName);
       
 11459         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);
       
 11460       }
       
 11461     }
       
 11462 
       
 11463     // If new component APIs are defined, "unsafe" lifecycles won't be called.
       
 11464     // Warn about these lifecycles if they are present.
       
 11465     // Don't warn about react-lifecycles-compat polyfilled methods though.
       
 11466     if (typeof ctor.getDerivedStateFromProps === 'function' || typeof instance.getSnapshotBeforeUpdate === 'function') {
       
 11467       var foundWillMountName = null;
       
 11468       var foundWillReceivePropsName = null;
       
 11469       var foundWillUpdateName = null;
       
 11470       if (typeof instance.componentWillMount === 'function' && instance.componentWillMount.__suppressDeprecationWarning !== true) {
       
 11471         foundWillMountName = 'componentWillMount';
       
 11472       } else if (typeof instance.UNSAFE_componentWillMount === 'function') {
       
 11473         foundWillMountName = 'UNSAFE_componentWillMount';
       
 11474       }
       
 11475       if (typeof instance.componentWillReceiveProps === 'function' && instance.componentWillReceiveProps.__suppressDeprecationWarning !== true) {
       
 11476         foundWillReceivePropsName = 'componentWillReceiveProps';
       
 11477       } else if (typeof instance.UNSAFE_componentWillReceiveProps === 'function') {
       
 11478         foundWillReceivePropsName = 'UNSAFE_componentWillReceiveProps';
       
 11479       }
       
 11480       if (typeof instance.componentWillUpdate === 'function' && instance.componentWillUpdate.__suppressDeprecationWarning !== true) {
       
 11481         foundWillUpdateName = 'componentWillUpdate';
       
 11482       } else if (typeof instance.UNSAFE_componentWillUpdate === 'function') {
       
 11483         foundWillUpdateName = 'UNSAFE_componentWillUpdate';
       
 11484       }
       
 11485       if (foundWillMountName !== null || foundWillReceivePropsName !== null || foundWillUpdateName !== null) {
       
 11486         var _componentName = getComponentName(ctor) || 'Component';
       
 11487         var newApiName = typeof ctor.getDerivedStateFromProps === 'function' ? 'getDerivedStateFromProps()' : 'getSnapshotBeforeUpdate()';
       
 11488         if (!didWarnAboutLegacyLifecyclesAndDerivedState.has(_componentName)) {
       
 11489           didWarnAboutLegacyLifecyclesAndDerivedState.add(_componentName);
       
 11490           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 : '');
       
 11491         }
       
 11492       }
       
 11493     }
       
 11494   }
       
 11495 
       
 11496   // Cache unmasked context so we can avoid recreating masked context unless necessary.
       
 11497   // ReactFiberContext usually updates this cache but can't for newly-created instances.
       
 11498   if (isLegacyContextConsumer) {
       
 11499     cacheContext(workInProgress, unmaskedContext, context);
       
 11500   }
       
 11501 
       
 11502   return instance;
       
 11503 }
       
 11504 
       
 11505 function callComponentWillMount(workInProgress, instance) {
       
 11506   startPhaseTimer(workInProgress, 'componentWillMount');
       
 11507   var oldState = instance.state;
       
 11508 
       
 11509   if (typeof instance.componentWillMount === 'function') {
       
 11510     instance.componentWillMount();
       
 11511   }
       
 11512   if (typeof instance.UNSAFE_componentWillMount === 'function') {
       
 11513     instance.UNSAFE_componentWillMount();
       
 11514   }
       
 11515 
       
 11516   stopPhaseTimer();
       
 11517 
       
 11518   if (oldState !== instance.state) {
       
 11519     {
       
 11520       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');
       
 11521     }
       
 11522     classComponentUpdater.enqueueReplaceState(instance, instance.state, null);
       
 11523   }
       
 11524 }
       
 11525 
       
 11526 function callComponentWillReceiveProps(workInProgress, instance, newProps, nextContext) {
       
 11527   var oldState = instance.state;
       
 11528   startPhaseTimer(workInProgress, 'componentWillReceiveProps');
       
 11529   if (typeof instance.componentWillReceiveProps === 'function') {
       
 11530     instance.componentWillReceiveProps(newProps, nextContext);
       
 11531   }
       
 11532   if (typeof instance.UNSAFE_componentWillReceiveProps === 'function') {
       
 11533     instance.UNSAFE_componentWillReceiveProps(newProps, nextContext);
       
 11534   }
       
 11535   stopPhaseTimer();
       
 11536 
       
 11537   if (instance.state !== oldState) {
       
 11538     {
       
 11539       var componentName = getComponentName(workInProgress.type) || 'Component';
       
 11540       if (!didWarnAboutStateAssignmentForComponent.has(componentName)) {
       
 11541         didWarnAboutStateAssignmentForComponent.add(componentName);
       
 11542         warningWithoutStack$1(false, '%s.componentWillReceiveProps(): Assigning directly to ' + "this.state is deprecated (except inside a component's " + 'constructor). Use setState instead.', componentName);
       
 11543       }
       
 11544     }
       
 11545     classComponentUpdater.enqueueReplaceState(instance, instance.state, null);
       
 11546   }
       
 11547 }
       
 11548 
       
 11549 // Invokes the mount life-cycles on a previously never rendered instance.
       
 11550 function mountClassInstance(workInProgress, ctor, newProps, renderExpirationTime) {
       
 11551   {
       
 11552     checkClassInstance(workInProgress, ctor, newProps);
       
 11553   }
       
 11554 
       
 11555   var instance = workInProgress.stateNode;
       
 11556   instance.props = newProps;
       
 11557   instance.state = workInProgress.memoizedState;
       
 11558   instance.refs = emptyRefsObject;
       
 11559 
       
 11560   var contextType = ctor.contextType;
       
 11561   if (typeof contextType === 'object' && contextType !== null) {
       
 11562     instance.context = readContext(contextType);
       
 11563   } else {
       
 11564     var unmaskedContext = getUnmaskedContext(workInProgress, ctor, true);
       
 11565     instance.context = getMaskedContext(workInProgress, unmaskedContext);
       
 11566   }
       
 11567 
       
 11568   {
       
 11569     if (instance.state === newProps) {
       
 11570       var componentName = getComponentName(ctor) || 'Component';
       
 11571       if (!didWarnAboutDirectlyAssigningPropsToState.has(componentName)) {
       
 11572         didWarnAboutDirectlyAssigningPropsToState.add(componentName);
       
 11573         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);
       
 11574       }
       
 11575     }
       
 11576 
       
 11577     if (workInProgress.mode & StrictMode) {
       
 11578       ReactStrictModeWarnings.recordUnsafeLifecycleWarnings(workInProgress, instance);
       
 11579 
       
 11580       ReactStrictModeWarnings.recordLegacyContextWarning(workInProgress, instance);
       
 11581     }
       
 11582 
       
 11583     if (warnAboutDeprecatedLifecycles) {
       
 11584       ReactStrictModeWarnings.recordDeprecationWarnings(workInProgress, instance);
       
 11585     }
       
 11586   }
       
 11587 
       
 11588   var updateQueue = workInProgress.updateQueue;
       
 11589   if (updateQueue !== null) {
       
 11590     processUpdateQueue(workInProgress, updateQueue, newProps, instance, renderExpirationTime);
       
 11591     instance.state = workInProgress.memoizedState;
       
 11592   }
       
 11593 
       
 11594   var getDerivedStateFromProps = ctor.getDerivedStateFromProps;
       
 11595   if (typeof getDerivedStateFromProps === 'function') {
       
 11596     applyDerivedStateFromProps(workInProgress, ctor, getDerivedStateFromProps, newProps);
       
 11597     instance.state = workInProgress.memoizedState;
       
 11598   }
       
 11599 
       
 11600   // In order to support react-lifecycles-compat polyfilled components,
       
 11601   // Unsafe lifecycles should not be invoked for components using the new APIs.
       
 11602   if (typeof ctor.getDerivedStateFromProps !== 'function' && typeof instance.getSnapshotBeforeUpdate !== 'function' && (typeof instance.UNSAFE_componentWillMount === 'function' || typeof instance.componentWillMount === 'function')) {
       
 11603     callComponentWillMount(workInProgress, instance);
       
 11604     // If we had additional state updates during this life-cycle, let's
       
 11605     // process them now.
       
 11606     updateQueue = workInProgress.updateQueue;
       
 11607     if (updateQueue !== null) {
       
 11608       processUpdateQueue(workInProgress, updateQueue, newProps, instance, renderExpirationTime);
       
 11609       instance.state = workInProgress.memoizedState;
       
 11610     }
       
 11611   }
       
 11612 
       
 11613   if (typeof instance.componentDidMount === 'function') {
       
 11614     workInProgress.effectTag |= Update;
       
 11615   }
       
 11616 }
       
 11617 
       
 11618 function resumeMountClassInstance(workInProgress, ctor, newProps, renderExpirationTime) {
       
 11619   var instance = workInProgress.stateNode;
       
 11620 
       
 11621   var oldProps = workInProgress.memoizedProps;
       
 11622   instance.props = oldProps;
       
 11623 
       
 11624   var oldContext = instance.context;
       
 11625   var contextType = ctor.contextType;
       
 11626   var nextContext = void 0;
       
 11627   if (typeof contextType === 'object' && contextType !== null) {
       
 11628     nextContext = readContext(contextType);
       
 11629   } else {
       
 11630     var nextLegacyUnmaskedContext = getUnmaskedContext(workInProgress, ctor, true);
       
 11631     nextContext = getMaskedContext(workInProgress, nextLegacyUnmaskedContext);
       
 11632   }
       
 11633 
       
 11634   var getDerivedStateFromProps = ctor.getDerivedStateFromProps;
       
 11635   var hasNewLifecycles = typeof getDerivedStateFromProps === 'function' || typeof instance.getSnapshotBeforeUpdate === 'function';
       
 11636 
       
 11637   // Note: During these life-cycles, instance.props/instance.state are what
       
 11638   // ever the previously attempted to render - not the "current". However,
       
 11639   // during componentDidUpdate we pass the "current" props.
       
 11640 
       
 11641   // In order to support react-lifecycles-compat polyfilled components,
       
 11642   // Unsafe lifecycles should not be invoked for components using the new APIs.
       
 11643   if (!hasNewLifecycles && (typeof instance.UNSAFE_componentWillReceiveProps === 'function' || typeof instance.componentWillReceiveProps === 'function')) {
       
 11644     if (oldProps !== newProps || oldContext !== nextContext) {
       
 11645       callComponentWillReceiveProps(workInProgress, instance, newProps, nextContext);
       
 11646     }
       
 11647   }
       
 11648 
       
 11649   resetHasForceUpdateBeforeProcessing();
       
 11650 
       
 11651   var oldState = workInProgress.memoizedState;
       
 11652   var newState = instance.state = oldState;
       
 11653   var updateQueue = workInProgress.updateQueue;
       
 11654   if (updateQueue !== null) {
       
 11655     processUpdateQueue(workInProgress, updateQueue, newProps, instance, renderExpirationTime);
       
 11656     newState = workInProgress.memoizedState;
       
 11657   }
       
 11658   if (oldProps === newProps && oldState === newState && !hasContextChanged() && !checkHasForceUpdateAfterProcessing()) {
       
 11659     // If an update was already in progress, we should schedule an Update
       
 11660     // effect even though we're bailing out, so that cWU/cDU are called.
       
 11661     if (typeof instance.componentDidMount === 'function') {
       
 11662       workInProgress.effectTag |= Update;
       
 11663     }
       
 11664     return false;
       
 11665   }
       
 11666 
       
 11667   if (typeof getDerivedStateFromProps === 'function') {
       
 11668     applyDerivedStateFromProps(workInProgress, ctor, getDerivedStateFromProps, newProps);
       
 11669     newState = workInProgress.memoizedState;
       
 11670   }
       
 11671 
       
 11672   var shouldUpdate = checkHasForceUpdateAfterProcessing() || checkShouldComponentUpdate(workInProgress, ctor, oldProps, newProps, oldState, newState, nextContext);
       
 11673 
       
 11674   if (shouldUpdate) {
       
 11675     // In order to support react-lifecycles-compat polyfilled components,
       
 11676     // Unsafe lifecycles should not be invoked for components using the new APIs.
       
 11677     if (!hasNewLifecycles && (typeof instance.UNSAFE_componentWillMount === 'function' || typeof instance.componentWillMount === 'function')) {
       
 11678       startPhaseTimer(workInProgress, 'componentWillMount');
       
 11679       if (typeof instance.componentWillMount === 'function') {
       
 11680         instance.componentWillMount();
       
 11681       }
       
 11682       if (typeof instance.UNSAFE_componentWillMount === 'function') {
       
 11683         instance.UNSAFE_componentWillMount();
       
 11684       }
       
 11685       stopPhaseTimer();
       
 11686     }
       
 11687     if (typeof instance.componentDidMount === 'function') {
       
 11688       workInProgress.effectTag |= Update;
       
 11689     }
       
 11690   } else {
       
 11691     // If an update was already in progress, we should schedule an Update
       
 11692     // effect even though we're bailing out, so that cWU/cDU are called.
       
 11693     if (typeof instance.componentDidMount === 'function') {
       
 11694       workInProgress.effectTag |= Update;
       
 11695     }
       
 11696 
       
 11697     // If shouldComponentUpdate returned false, we should still update the
       
 11698     // memoized state to indicate that this work can be reused.
       
 11699     workInProgress.memoizedProps = newProps;
       
 11700     workInProgress.memoizedState = newState;
       
 11701   }
       
 11702 
       
 11703   // Update the existing instance's state, props, and context pointers even
       
 11704   // if shouldComponentUpdate returns false.
       
 11705   instance.props = newProps;
       
 11706   instance.state = newState;
       
 11707   instance.context = nextContext;
       
 11708 
       
 11709   return shouldUpdate;
       
 11710 }
       
 11711 
       
 11712 // Invokes the update life-cycles and returns false if it shouldn't rerender.
       
 11713 function updateClassInstance(current, workInProgress, ctor, newProps, renderExpirationTime) {
       
 11714   var instance = workInProgress.stateNode;
       
 11715 
       
 11716   var oldProps = workInProgress.memoizedProps;
       
 11717   instance.props = workInProgress.type === workInProgress.elementType ? oldProps : resolveDefaultProps(workInProgress.type, oldProps);
       
 11718 
       
 11719   var oldContext = instance.context;
       
 11720   var contextType = ctor.contextType;
       
 11721   var nextContext = void 0;
       
 11722   if (typeof contextType === 'object' && contextType !== null) {
       
 11723     nextContext = readContext(contextType);
       
 11724   } else {
       
 11725     var nextUnmaskedContext = getUnmaskedContext(workInProgress, ctor, true);
       
 11726     nextContext = getMaskedContext(workInProgress, nextUnmaskedContext);
       
 11727   }
       
 11728 
       
 11729   var getDerivedStateFromProps = ctor.getDerivedStateFromProps;
       
 11730   var hasNewLifecycles = typeof getDerivedStateFromProps === 'function' || typeof instance.getSnapshotBeforeUpdate === 'function';
       
 11731 
       
 11732   // Note: During these life-cycles, instance.props/instance.state are what
       
 11733   // ever the previously attempted to render - not the "current". However,
       
 11734   // during componentDidUpdate we pass the "current" props.
       
 11735 
       
 11736   // In order to support react-lifecycles-compat polyfilled components,
       
 11737   // Unsafe lifecycles should not be invoked for components using the new APIs.
       
 11738   if (!hasNewLifecycles && (typeof instance.UNSAFE_componentWillReceiveProps === 'function' || typeof instance.componentWillReceiveProps === 'function')) {
       
 11739     if (oldProps !== newProps || oldContext !== nextContext) {
       
 11740       callComponentWillReceiveProps(workInProgress, instance, newProps, nextContext);
       
 11741     }
       
 11742   }
       
 11743 
       
 11744   resetHasForceUpdateBeforeProcessing();
       
 11745 
       
 11746   var oldState = workInProgress.memoizedState;
       
 11747   var newState = instance.state = oldState;
       
 11748   var updateQueue = workInProgress.updateQueue;
       
 11749   if (updateQueue !== null) {
       
 11750     processUpdateQueue(workInProgress, updateQueue, newProps, instance, renderExpirationTime);
       
 11751     newState = workInProgress.memoizedState;
       
 11752   }
       
 11753 
       
 11754   if (oldProps === newProps && oldState === newState && !hasContextChanged() && !checkHasForceUpdateAfterProcessing()) {
       
 11755     // If an update was already in progress, we should schedule an Update
       
 11756     // effect even though we're bailing out, so that cWU/cDU are called.
       
 11757     if (typeof instance.componentDidUpdate === 'function') {
       
 11758       if (oldProps !== current.memoizedProps || oldState !== current.memoizedState) {
       
 11759         workInProgress.effectTag |= Update;
       
 11760       }
       
 11761     }
       
 11762     if (typeof instance.getSnapshotBeforeUpdate === 'function') {
       
 11763       if (oldProps !== current.memoizedProps || oldState !== current.memoizedState) {
       
 11764         workInProgress.effectTag |= Snapshot;
       
 11765       }
       
 11766     }
       
 11767     return false;
       
 11768   }
       
 11769 
       
 11770   if (typeof getDerivedStateFromProps === 'function') {
       
 11771     applyDerivedStateFromProps(workInProgress, ctor, getDerivedStateFromProps, newProps);
       
 11772     newState = workInProgress.memoizedState;
       
 11773   }
       
 11774 
       
 11775   var shouldUpdate = checkHasForceUpdateAfterProcessing() || checkShouldComponentUpdate(workInProgress, ctor, oldProps, newProps, oldState, newState, nextContext);
       
 11776 
       
 11777   if (shouldUpdate) {
       
 11778     // In order to support react-lifecycles-compat polyfilled components,
       
 11779     // Unsafe lifecycles should not be invoked for components using the new APIs.
       
 11780     if (!hasNewLifecycles && (typeof instance.UNSAFE_componentWillUpdate === 'function' || typeof instance.componentWillUpdate === 'function')) {
       
 11781       startPhaseTimer(workInProgress, 'componentWillUpdate');
       
 11782       if (typeof instance.componentWillUpdate === 'function') {
       
 11783         instance.componentWillUpdate(newProps, newState, nextContext);
       
 11784       }
       
 11785       if (typeof instance.UNSAFE_componentWillUpdate === 'function') {
       
 11786         instance.UNSAFE_componentWillUpdate(newProps, newState, nextContext);
       
 11787       }
       
 11788       stopPhaseTimer();
       
 11789     }
       
 11790     if (typeof instance.componentDidUpdate === 'function') {
       
 11791       workInProgress.effectTag |= Update;
       
 11792     }
       
 11793     if (typeof instance.getSnapshotBeforeUpdate === 'function') {
       
 11794       workInProgress.effectTag |= Snapshot;
       
 11795     }
       
 11796   } else {
       
 11797     // If an update was already in progress, we should schedule an Update
       
 11798     // effect even though we're bailing out, so that cWU/cDU are called.
       
 11799     if (typeof instance.componentDidUpdate === 'function') {
       
 11800       if (oldProps !== current.memoizedProps || oldState !== current.memoizedState) {
       
 11801         workInProgress.effectTag |= Update;
       
 11802       }
       
 11803     }
       
 11804     if (typeof instance.getSnapshotBeforeUpdate === 'function') {
       
 11805       if (oldProps !== current.memoizedProps || oldState !== current.memoizedState) {
       
 11806         workInProgress.effectTag |= Snapshot;
       
 11807       }
       
 11808     }
       
 11809 
       
 11810     // If shouldComponentUpdate returned false, we should still update the
       
 11811     // memoized props/state to indicate that this work can be reused.
       
 11812     workInProgress.memoizedProps = newProps;
       
 11813     workInProgress.memoizedState = newState;
       
 11814   }
       
 11815 
       
 11816   // Update the existing instance's state, props, and context pointers even
       
 11817   // if shouldComponentUpdate returns false.
       
 11818   instance.props = newProps;
       
 11819   instance.state = newState;
       
 11820   instance.context = nextContext;
       
 11821 
       
 11822   return shouldUpdate;
       
 11823 }
       
 11824 
       
 11825 var didWarnAboutMaps = void 0;
       
 11826 var didWarnAboutGenerators = void 0;
       
 11827 var didWarnAboutStringRefInStrictMode = void 0;
       
 11828 var ownerHasKeyUseWarning = void 0;
       
 11829 var ownerHasFunctionTypeWarning = void 0;
       
 11830 var warnForMissingKey = function (child) {};
       
 11831 
       
 11832 {
       
 11833   didWarnAboutMaps = false;
       
 11834   didWarnAboutGenerators = false;
       
 11835   didWarnAboutStringRefInStrictMode = {};
       
 11836 
       
 11837   /**
       
 11838    * Warn if there's no key explicitly set on dynamic arrays of children or
       
 11839    * object keys are not valid. This allows us to keep track of children between
       
 11840    * updates.
       
 11841    */
       
 11842   ownerHasKeyUseWarning = {};
       
 11843   ownerHasFunctionTypeWarning = {};
       
 11844 
       
 11845   warnForMissingKey = function (child) {
       
 11846     if (child === null || typeof child !== 'object') {
       
 11847       return;
       
 11848     }
       
 11849     if (!child._store || child._store.validated || child.key != null) {
       
 11850       return;
       
 11851     }
       
 11852     !(typeof child._store === 'object') ? invariant(false, 'React Component in warnForMissingKey should have a _store. This error is likely caused by a bug in React. Please file an issue.') : void 0;
       
 11853     child._store.validated = true;
       
 11854 
       
 11855     var currentComponentErrorInfo = 'Each child in a list should have a unique ' + '"key" prop. See https://fb.me/react-warning-keys for ' + 'more information.' + getCurrentFiberStackInDev();
       
 11856     if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
       
 11857       return;
       
 11858     }
       
 11859     ownerHasKeyUseWarning[currentComponentErrorInfo] = true;
       
 11860 
       
 11861     warning$1(false, 'Each child in a list should have a unique ' + '"key" prop. See https://fb.me/react-warning-keys for ' + 'more information.');
       
 11862   };
       
 11863 }
       
 11864 
       
 11865 var isArray = Array.isArray;
       
 11866 
       
 11867 function coerceRef(returnFiber, current$$1, element) {
       
 11868   var mixedRef = element.ref;
       
 11869   if (mixedRef !== null && typeof mixedRef !== 'function' && typeof mixedRef !== 'object') {
       
 11870     {
       
 11871       if (returnFiber.mode & StrictMode) {
       
 11872         var componentName = getComponentName(returnFiber.type) || 'Component';
       
 11873         if (!didWarnAboutStringRefInStrictMode[componentName]) {
       
 11874           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));
       
 11875           didWarnAboutStringRefInStrictMode[componentName] = true;
       
 11876         }
       
 11877       }
       
 11878     }
       
 11879 
       
 11880     if (element._owner) {
       
 11881       var owner = element._owner;
       
 11882       var inst = void 0;
       
 11883       if (owner) {
       
 11884         var ownerFiber = owner;
       
 11885         !(ownerFiber.tag === ClassComponent) ? invariant(false, 'Function components cannot have refs. Did you mean to use React.forwardRef()?') : void 0;
       
 11886         inst = ownerFiber.stateNode;
       
 11887       }
       
 11888       !inst ? invariant(false, 'Missing owner for string ref %s. This error is likely caused by a bug in React. Please file an issue.', mixedRef) : void 0;
       
 11889       var stringRef = '' + mixedRef;
       
 11890       // Check if previous string ref matches new string ref
       
 11891       if (current$$1 !== null && current$$1.ref !== null && typeof current$$1.ref === 'function' && current$$1.ref._stringRef === stringRef) {
       
 11892         return current$$1.ref;
       
 11893       }
       
 11894       var ref = function (value) {
       
 11895         var refs = inst.refs;
       
 11896         if (refs === emptyRefsObject) {
       
 11897           // This is a lazy pooled frozen object, so we need to initialize.
       
 11898           refs = inst.refs = {};
       
 11899         }
       
 11900         if (value === null) {
       
 11901           delete refs[stringRef];
       
 11902         } else {
       
 11903           refs[stringRef] = value;
       
 11904         }
       
 11905       };
       
 11906       ref._stringRef = stringRef;
       
 11907       return ref;
       
 11908     } else {
       
 11909       !(typeof mixedRef === 'string') ? invariant(false, 'Expected ref to be a function, a string, an object returned by React.createRef(), or null.') : void 0;
       
 11910       !element._owner ? invariant(false, 'Element ref was specified as a string (%s) 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.', mixedRef) : void 0;
       
 11911     }
       
 11912   }
       
 11913   return mixedRef;
       
 11914 }
       
 11915 
       
 11916 function throwOnInvalidObjectType(returnFiber, newChild) {
       
 11917   if (returnFiber.type !== 'textarea') {
       
 11918     var addendum = '';
       
 11919     {
       
 11920       addendum = ' If you meant to render a collection of children, use an array ' + 'instead.' + getCurrentFiberStackInDev();
       
 11921     }
       
 11922     invariant(false, 'Objects are not valid as a React child (found: %s).%s', Object.prototype.toString.call(newChild) === '[object Object]' ? 'object with keys {' + Object.keys(newChild).join(', ') + '}' : newChild, addendum);
       
 11923   }
       
 11924 }
       
 11925 
       
 11926 function warnOnFunctionType() {
       
 11927   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();
       
 11928 
       
 11929   if (ownerHasFunctionTypeWarning[currentComponentErrorInfo]) {
       
 11930     return;
       
 11931   }
       
 11932   ownerHasFunctionTypeWarning[currentComponentErrorInfo] = true;
       
 11933 
       
 11934   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.');
       
 11935 }
       
 11936 
       
 11937 // This wrapper function exists because I expect to clone the code in each path
       
 11938 // to be able to optimize each path individually by branching early. This needs
       
 11939 // a compiler or we can do it manually. Helpers that don't need this branching
       
 11940 // live outside of this function.
       
 11941 function ChildReconciler(shouldTrackSideEffects) {
       
 11942   function deleteChild(returnFiber, childToDelete) {
       
 11943     if (!shouldTrackSideEffects) {
       
 11944       // Noop.
       
 11945       return;
       
 11946     }
       
 11947     // Deletions are added in reversed order so we add it to the front.
       
 11948     // At this point, the return fiber's effect list is empty except for
       
 11949     // deletions, so we can just append the deletion to the list. The remaining
       
 11950     // effects aren't added until the complete phase. Once we implement
       
 11951     // resuming, this may not be true.
       
 11952     var last = returnFiber.lastEffect;
       
 11953     if (last !== null) {
       
 11954       last.nextEffect = childToDelete;
       
 11955       returnFiber.lastEffect = childToDelete;
       
 11956     } else {
       
 11957       returnFiber.firstEffect = returnFiber.lastEffect = childToDelete;
       
 11958     }
       
 11959     childToDelete.nextEffect = null;
       
 11960     childToDelete.effectTag = Deletion;
       
 11961   }
       
 11962 
       
 11963   function deleteRemainingChildren(returnFiber, currentFirstChild) {
       
 11964     if (!shouldTrackSideEffects) {
       
 11965       // Noop.
       
 11966       return null;
       
 11967     }
       
 11968 
       
 11969     // TODO: For the shouldClone case, this could be micro-optimized a bit by
       
 11970     // assuming that after the first child we've already added everything.
       
 11971     var childToDelete = currentFirstChild;
       
 11972     while (childToDelete !== null) {
       
 11973       deleteChild(returnFiber, childToDelete);
       
 11974       childToDelete = childToDelete.sibling;
       
 11975     }
       
 11976     return null;
       
 11977   }
       
 11978 
       
 11979   function mapRemainingChildren(returnFiber, currentFirstChild) {
       
 11980     // Add the remaining children to a temporary map so that we can find them by
       
 11981     // keys quickly. Implicit (null) keys get added to this set with their index
       
 11982     var existingChildren = new Map();
       
 11983 
       
 11984     var existingChild = currentFirstChild;
       
 11985     while (existingChild !== null) {
       
 11986       if (existingChild.key !== null) {
       
 11987         existingChildren.set(existingChild.key, existingChild);
       
 11988       } else {
       
 11989         existingChildren.set(existingChild.index, existingChild);
       
 11990       }
       
 11991       existingChild = existingChild.sibling;
       
 11992     }
       
 11993     return existingChildren;
       
 11994   }
       
 11995 
       
 11996   function useFiber(fiber, pendingProps, expirationTime) {
       
 11997     // We currently set sibling to null and index to 0 here because it is easy
       
 11998     // to forget to do before returning it. E.g. for the single child case.
       
 11999     var clone = createWorkInProgress(fiber, pendingProps, expirationTime);
       
 12000     clone.index = 0;
       
 12001     clone.sibling = null;
       
 12002     return clone;
       
 12003   }
       
 12004 
       
 12005   function placeChild(newFiber, lastPlacedIndex, newIndex) {
       
 12006     newFiber.index = newIndex;
       
 12007     if (!shouldTrackSideEffects) {
       
 12008       // Noop.
       
 12009       return lastPlacedIndex;
       
 12010     }
       
 12011     var current$$1 = newFiber.alternate;
       
 12012     if (current$$1 !== null) {
       
 12013       var oldIndex = current$$1.index;
       
 12014       if (oldIndex < lastPlacedIndex) {
       
 12015         // This is a move.
       
 12016         newFiber.effectTag = Placement;
       
 12017         return lastPlacedIndex;
       
 12018       } else {
       
 12019         // This item can stay in place.
       
 12020         return oldIndex;
       
 12021       }
       
 12022     } else {
       
 12023       // This is an insertion.
       
 12024       newFiber.effectTag = Placement;
       
 12025       return lastPlacedIndex;
       
 12026     }
       
 12027   }
       
 12028 
       
 12029   function placeSingleChild(newFiber) {
       
 12030     // This is simpler for the single child case. We only need to do a
       
 12031     // placement for inserting new children.
       
 12032     if (shouldTrackSideEffects && newFiber.alternate === null) {
       
 12033       newFiber.effectTag = Placement;
       
 12034     }
       
 12035     return newFiber;
       
 12036   }
       
 12037 
       
 12038   function updateTextNode(returnFiber, current$$1, textContent, expirationTime) {
       
 12039     if (current$$1 === null || current$$1.tag !== HostText) {
       
 12040       // Insert
       
 12041       var created = createFiberFromText(textContent, returnFiber.mode, expirationTime);
       
 12042       created.return = returnFiber;
       
 12043       return created;
       
 12044     } else {
       
 12045       // Update
       
 12046       var existing = useFiber(current$$1, textContent, expirationTime);
       
 12047       existing.return = returnFiber;
       
 12048       return existing;
       
 12049     }
       
 12050   }
       
 12051 
       
 12052   function updateElement(returnFiber, current$$1, element, expirationTime) {
       
 12053     if (current$$1 !== null && current$$1.elementType === element.type) {
       
 12054       // Move based on index
       
 12055       var existing = useFiber(current$$1, element.props, expirationTime);
       
 12056       existing.ref = coerceRef(returnFiber, current$$1, element);
       
 12057       existing.return = returnFiber;
       
 12058       {
       
 12059         existing._debugSource = element._source;
       
 12060         existing._debugOwner = element._owner;
       
 12061       }
       
 12062       return existing;
       
 12063     } else {
       
 12064       // Insert
       
 12065       var created = createFiberFromElement(element, returnFiber.mode, expirationTime);
       
 12066       created.ref = coerceRef(returnFiber, current$$1, element);
       
 12067       created.return = returnFiber;
       
 12068       return created;
       
 12069     }
       
 12070   }
       
 12071 
       
 12072   function updatePortal(returnFiber, current$$1, portal, expirationTime) {
       
 12073     if (current$$1 === null || current$$1.tag !== HostPortal || current$$1.stateNode.containerInfo !== portal.containerInfo || current$$1.stateNode.implementation !== portal.implementation) {
       
 12074       // Insert
       
 12075       var created = createFiberFromPortal(portal, returnFiber.mode, expirationTime);
       
 12076       created.return = returnFiber;
       
 12077       return created;
       
 12078     } else {
       
 12079       // Update
       
 12080       var existing = useFiber(current$$1, portal.children || [], expirationTime);
       
 12081       existing.return = returnFiber;
       
 12082       return existing;
       
 12083     }
       
 12084   }
       
 12085 
       
 12086   function updateFragment(returnFiber, current$$1, fragment, expirationTime, key) {
       
 12087     if (current$$1 === null || current$$1.tag !== Fragment) {
       
 12088       // Insert
       
 12089       var created = createFiberFromFragment(fragment, returnFiber.mode, expirationTime, key);
       
 12090       created.return = returnFiber;
       
 12091       return created;
       
 12092     } else {
       
 12093       // Update
       
 12094       var existing = useFiber(current$$1, fragment, expirationTime);
       
 12095       existing.return = returnFiber;
       
 12096       return existing;
       
 12097     }
       
 12098   }
       
 12099 
       
 12100   function createChild(returnFiber, newChild, expirationTime) {
       
 12101     if (typeof newChild === 'string' || typeof newChild === 'number') {
       
 12102       // Text nodes don't have keys. If the previous node is implicitly keyed
       
 12103       // we can continue to replace it without aborting even if it is not a text
       
 12104       // node.
       
 12105       var created = createFiberFromText('' + newChild, returnFiber.mode, expirationTime);
       
 12106       created.return = returnFiber;
       
 12107       return created;
       
 12108     }
       
 12109 
       
 12110     if (typeof newChild === 'object' && newChild !== null) {
       
 12111       switch (newChild.$$typeof) {
       
 12112         case REACT_ELEMENT_TYPE:
       
 12113           {
       
 12114             var _created = createFiberFromElement(newChild, returnFiber.mode, expirationTime);
       
 12115             _created.ref = coerceRef(returnFiber, null, newChild);
       
 12116             _created.return = returnFiber;
       
 12117             return _created;
       
 12118           }
       
 12119         case REACT_PORTAL_TYPE:
       
 12120           {
       
 12121             var _created2 = createFiberFromPortal(newChild, returnFiber.mode, expirationTime);
       
 12122             _created2.return = returnFiber;
       
 12123             return _created2;
       
 12124           }
       
 12125       }
       
 12126 
       
 12127       if (isArray(newChild) || getIteratorFn(newChild)) {
       
 12128         var _created3 = createFiberFromFragment(newChild, returnFiber.mode, expirationTime, null);
       
 12129         _created3.return = returnFiber;
       
 12130         return _created3;
       
 12131       }
       
 12132 
       
 12133       throwOnInvalidObjectType(returnFiber, newChild);
       
 12134     }
       
 12135 
       
 12136     {
       
 12137       if (typeof newChild === 'function') {
       
 12138         warnOnFunctionType();
       
 12139       }
       
 12140     }
       
 12141 
       
 12142     return null;
       
 12143   }
       
 12144 
       
 12145   function updateSlot(returnFiber, oldFiber, newChild, expirationTime) {
       
 12146     // Update the fiber if the keys match, otherwise return null.
       
 12147 
       
 12148     var key = oldFiber !== null ? oldFiber.key : null;
       
 12149 
       
 12150     if (typeof newChild === 'string' || typeof newChild === 'number') {
       
 12151       // Text nodes don't have keys. If the previous node is implicitly keyed
       
 12152       // we can continue to replace it without aborting even if it is not a text
       
 12153       // node.
       
 12154       if (key !== null) {
       
 12155         return null;
       
 12156       }
       
 12157       return updateTextNode(returnFiber, oldFiber, '' + newChild, expirationTime);
       
 12158     }
       
 12159 
       
 12160     if (typeof newChild === 'object' && newChild !== null) {
       
 12161       switch (newChild.$$typeof) {
       
 12162         case REACT_ELEMENT_TYPE:
       
 12163           {
       
 12164             if (newChild.key === key) {
       
 12165               if (newChild.type === REACT_FRAGMENT_TYPE) {
       
 12166                 return updateFragment(returnFiber, oldFiber, newChild.props.children, expirationTime, key);
       
 12167               }
       
 12168               return updateElement(returnFiber, oldFiber, newChild, expirationTime);
       
 12169             } else {
       
 12170               return null;
       
 12171             }
       
 12172           }
       
 12173         case REACT_PORTAL_TYPE:
       
 12174           {
       
 12175             if (newChild.key === key) {
       
 12176               return updatePortal(returnFiber, oldFiber, newChild, expirationTime);
       
 12177             } else {
       
 12178               return null;
       
 12179             }
       
 12180           }
       
 12181       }
       
 12182 
       
 12183       if (isArray(newChild) || getIteratorFn(newChild)) {
       
 12184         if (key !== null) {
       
 12185           return null;
       
 12186         }
       
 12187 
       
 12188         return updateFragment(returnFiber, oldFiber, newChild, expirationTime, null);
       
 12189       }
       
 12190 
       
 12191       throwOnInvalidObjectType(returnFiber, newChild);
       
 12192     }
       
 12193 
       
 12194     {
       
 12195       if (typeof newChild === 'function') {
       
 12196         warnOnFunctionType();
       
 12197       }
       
 12198     }
       
 12199 
       
 12200     return null;
       
 12201   }
       
 12202 
       
 12203   function updateFromMap(existingChildren, returnFiber, newIdx, newChild, expirationTime) {
       
 12204     if (typeof newChild === 'string' || typeof newChild === 'number') {
       
 12205       // Text nodes don't have keys, so we neither have to check the old nor
       
 12206       // new node for the key. If both are text nodes, they match.
       
 12207       var matchedFiber = existingChildren.get(newIdx) || null;
       
 12208       return updateTextNode(returnFiber, matchedFiber, '' + newChild, expirationTime);
       
 12209     }
       
 12210 
       
 12211     if (typeof newChild === 'object' && newChild !== null) {
       
 12212       switch (newChild.$$typeof) {
       
 12213         case REACT_ELEMENT_TYPE:
       
 12214           {
       
 12215             var _matchedFiber = existingChildren.get(newChild.key === null ? newIdx : newChild.key) || null;
       
 12216             if (newChild.type === REACT_FRAGMENT_TYPE) {
       
 12217               return updateFragment(returnFiber, _matchedFiber, newChild.props.children, expirationTime, newChild.key);
       
 12218             }
       
 12219             return updateElement(returnFiber, _matchedFiber, newChild, expirationTime);
       
 12220           }
       
 12221         case REACT_PORTAL_TYPE:
       
 12222           {
       
 12223             var _matchedFiber2 = existingChildren.get(newChild.key === null ? newIdx : newChild.key) || null;
       
 12224             return updatePortal(returnFiber, _matchedFiber2, newChild, expirationTime);
       
 12225           }
       
 12226       }
       
 12227 
       
 12228       if (isArray(newChild) || getIteratorFn(newChild)) {
       
 12229         var _matchedFiber3 = existingChildren.get(newIdx) || null;
       
 12230         return updateFragment(returnFiber, _matchedFiber3, newChild, expirationTime, null);
       
 12231       }
       
 12232 
       
 12233       throwOnInvalidObjectType(returnFiber, newChild);
       
 12234     }
       
 12235 
       
 12236     {
       
 12237       if (typeof newChild === 'function') {
       
 12238         warnOnFunctionType();
       
 12239       }
       
 12240     }
       
 12241 
       
 12242     return null;
       
 12243   }
       
 12244 
       
 12245   /**
       
 12246    * Warns if there is a duplicate or missing key
       
 12247    */
       
 12248   function warnOnInvalidKey(child, knownKeys) {
       
 12249     {
       
 12250       if (typeof child !== 'object' || child === null) {
       
 12251         return knownKeys;
       
 12252       }
       
 12253       switch (child.$$typeof) {
       
 12254         case REACT_ELEMENT_TYPE:
       
 12255         case REACT_PORTAL_TYPE:
       
 12256           warnForMissingKey(child);
       
 12257           var key = child.key;
       
 12258           if (typeof key !== 'string') {
       
 12259             break;
       
 12260           }
       
 12261           if (knownKeys === null) {
       
 12262             knownKeys = new Set();
       
 12263             knownKeys.add(key);
       
 12264             break;
       
 12265           }
       
 12266           if (!knownKeys.has(key)) {
       
 12267             knownKeys.add(key);
       
 12268             break;
       
 12269           }
       
 12270           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);
       
 12271           break;
       
 12272         default:
       
 12273           break;
       
 12274       }
       
 12275     }
       
 12276     return knownKeys;
       
 12277   }
       
 12278 
       
 12279   function reconcileChildrenArray(returnFiber, currentFirstChild, newChildren, expirationTime) {
       
 12280     // This algorithm can't optimize by searching from both ends since we
       
 12281     // don't have backpointers on fibers. I'm trying to see how far we can get
       
 12282     // with that model. If it ends up not being worth the tradeoffs, we can
       
 12283     // add it later.
       
 12284 
       
 12285     // Even with a two ended optimization, we'd want to optimize for the case
       
 12286     // where there are few changes and brute force the comparison instead of
       
 12287     // going for the Map. It'd like to explore hitting that path first in
       
 12288     // forward-only mode and only go for the Map once we notice that we need
       
 12289     // lots of look ahead. This doesn't handle reversal as well as two ended
       
 12290     // search but that's unusual. Besides, for the two ended optimization to
       
 12291     // work on Iterables, we'd need to copy the whole set.
       
 12292 
       
 12293     // In this first iteration, we'll just live with hitting the bad case
       
 12294     // (adding everything to a Map) in for every insert/move.
       
 12295 
       
 12296     // If you change this code, also update reconcileChildrenIterator() which
       
 12297     // uses the same algorithm.
       
 12298 
       
 12299     {
       
 12300       // First, validate keys.
       
 12301       var knownKeys = null;
       
 12302       for (var i = 0; i < newChildren.length; i++) {
       
 12303         var child = newChildren[i];
       
 12304         knownKeys = warnOnInvalidKey(child, knownKeys);
       
 12305       }
       
 12306     }
       
 12307 
       
 12308     var resultingFirstChild = null;
       
 12309     var previousNewFiber = null;
       
 12310 
       
 12311     var oldFiber = currentFirstChild;
       
 12312     var lastPlacedIndex = 0;
       
 12313     var newIdx = 0;
       
 12314     var nextOldFiber = null;
       
 12315     for (; oldFiber !== null && newIdx < newChildren.length; newIdx++) {
       
 12316       if (oldFiber.index > newIdx) {
       
 12317         nextOldFiber = oldFiber;
       
 12318         oldFiber = null;
       
 12319       } else {
       
 12320         nextOldFiber = oldFiber.sibling;
       
 12321       }
       
 12322       var newFiber = updateSlot(returnFiber, oldFiber, newChildren[newIdx], expirationTime);
       
 12323       if (newFiber === null) {
       
 12324         // TODO: This breaks on empty slots like null children. That's
       
 12325         // unfortunate because it triggers the slow path all the time. We need
       
 12326         // a better way to communicate whether this was a miss or null,
       
 12327         // boolean, undefined, etc.
       
 12328         if (oldFiber === null) {
       
 12329           oldFiber = nextOldFiber;
       
 12330         }
       
 12331         break;
       
 12332       }
       
 12333       if (shouldTrackSideEffects) {
       
 12334         if (oldFiber && newFiber.alternate === null) {
       
 12335           // We matched the slot, but we didn't reuse the existing fiber, so we
       
 12336           // need to delete the existing child.
       
 12337           deleteChild(returnFiber, oldFiber);
       
 12338         }
       
 12339       }
       
 12340       lastPlacedIndex = placeChild(newFiber, lastPlacedIndex, newIdx);
       
 12341       if (previousNewFiber === null) {
       
 12342         // TODO: Move out of the loop. This only happens for the first run.
       
 12343         resultingFirstChild = newFiber;
       
 12344       } else {
       
 12345         // TODO: Defer siblings if we're not at the right index for this slot.
       
 12346         // I.e. if we had null values before, then we want to defer this
       
 12347         // for each null value. However, we also don't want to call updateSlot
       
 12348         // with the previous one.
       
 12349         previousNewFiber.sibling = newFiber;
       
 12350       }
       
 12351       previousNewFiber = newFiber;
       
 12352       oldFiber = nextOldFiber;
       
 12353     }
       
 12354 
       
 12355     if (newIdx === newChildren.length) {
       
 12356       // We've reached the end of the new children. We can delete the rest.
       
 12357       deleteRemainingChildren(returnFiber, oldFiber);
       
 12358       return resultingFirstChild;
       
 12359     }
       
 12360 
       
 12361     if (oldFiber === null) {
       
 12362       // If we don't have any more existing children we can choose a fast path
       
 12363       // since the rest will all be insertions.
       
 12364       for (; newIdx < newChildren.length; newIdx++) {
       
 12365         var _newFiber = createChild(returnFiber, newChildren[newIdx], expirationTime);
       
 12366         if (!_newFiber) {
       
 12367           continue;
       
 12368         }
       
 12369         lastPlacedIndex = placeChild(_newFiber, lastPlacedIndex, newIdx);
       
 12370         if (previousNewFiber === null) {
       
 12371           // TODO: Move out of the loop. This only happens for the first run.
       
 12372           resultingFirstChild = _newFiber;
       
 12373         } else {
       
 12374           previousNewFiber.sibling = _newFiber;
       
 12375         }
       
 12376         previousNewFiber = _newFiber;
       
 12377       }
       
 12378       return resultingFirstChild;
       
 12379     }
       
 12380 
       
 12381     // Add all children to a key map for quick lookups.
       
 12382     var existingChildren = mapRemainingChildren(returnFiber, oldFiber);
       
 12383 
       
 12384     // Keep scanning and use the map to restore deleted items as moves.
       
 12385     for (; newIdx < newChildren.length; newIdx++) {
       
 12386       var _newFiber2 = updateFromMap(existingChildren, returnFiber, newIdx, newChildren[newIdx], expirationTime);
       
 12387       if (_newFiber2) {
       
 12388         if (shouldTrackSideEffects) {
       
 12389           if (_newFiber2.alternate !== null) {
       
 12390             // The new fiber is a work in progress, but if there exists a
       
 12391             // current, that means that we reused the fiber. We need to delete
       
 12392             // it from the child list so that we don't add it to the deletion
       
 12393             // list.
       
 12394             existingChildren.delete(_newFiber2.key === null ? newIdx : _newFiber2.key);
       
 12395           }
       
 12396         }
       
 12397         lastPlacedIndex = placeChild(_newFiber2, lastPlacedIndex, newIdx);
       
 12398         if (previousNewFiber === null) {
       
 12399           resultingFirstChild = _newFiber2;
       
 12400         } else {
       
 12401           previousNewFiber.sibling = _newFiber2;
       
 12402         }
       
 12403         previousNewFiber = _newFiber2;
       
 12404       }
       
 12405     }
       
 12406 
       
 12407     if (shouldTrackSideEffects) {
       
 12408       // Any existing children that weren't consumed above were deleted. We need
       
 12409       // to add them to the deletion list.
       
 12410       existingChildren.forEach(function (child) {
       
 12411         return deleteChild(returnFiber, child);
       
 12412       });
       
 12413     }
       
 12414 
       
 12415     return resultingFirstChild;
       
 12416   }
       
 12417 
       
 12418   function reconcileChildrenIterator(returnFiber, currentFirstChild, newChildrenIterable, expirationTime) {
       
 12419     // This is the same implementation as reconcileChildrenArray(),
       
 12420     // but using the iterator instead.
       
 12421 
       
 12422     var iteratorFn = getIteratorFn(newChildrenIterable);
       
 12423     !(typeof iteratorFn === 'function') ? invariant(false, 'An object is not an iterable. This error is likely caused by a bug in React. Please file an issue.') : void 0;
       
 12424 
       
 12425     {
       
 12426       // We don't support rendering Generators because it's a mutation.
       
 12427       // See https://github.com/facebook/react/issues/12995
       
 12428       if (typeof Symbol === 'function' &&
       
 12429       // $FlowFixMe Flow doesn't know about toStringTag
       
 12430       newChildrenIterable[Symbol.toStringTag] === 'Generator') {
       
 12431         !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;
       
 12432         didWarnAboutGenerators = true;
       
 12433       }
       
 12434 
       
 12435       // Warn about using Maps as children
       
 12436       if (newChildrenIterable.entries === iteratorFn) {
       
 12437         !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;
       
 12438         didWarnAboutMaps = true;
       
 12439       }
       
 12440 
       
 12441       // First, validate keys.
       
 12442       // We'll get a different iterator later for the main pass.
       
 12443       var _newChildren = iteratorFn.call(newChildrenIterable);
       
 12444       if (_newChildren) {
       
 12445         var knownKeys = null;
       
 12446         var _step = _newChildren.next();
       
 12447         for (; !_step.done; _step = _newChildren.next()) {
       
 12448           var child = _step.value;
       
 12449           knownKeys = warnOnInvalidKey(child, knownKeys);
       
 12450         }
       
 12451       }
       
 12452     }
       
 12453 
       
 12454     var newChildren = iteratorFn.call(newChildrenIterable);
       
 12455     !(newChildren != null) ? invariant(false, 'An iterable object provided no iterator.') : void 0;
       
 12456 
       
 12457     var resultingFirstChild = null;
       
 12458     var previousNewFiber = null;
       
 12459 
       
 12460     var oldFiber = currentFirstChild;
       
 12461     var lastPlacedIndex = 0;
       
 12462     var newIdx = 0;
       
 12463     var nextOldFiber = null;
       
 12464 
       
 12465     var step = newChildren.next();
       
 12466     for (; oldFiber !== null && !step.done; newIdx++, step = newChildren.next()) {
       
 12467       if (oldFiber.index > newIdx) {
       
 12468         nextOldFiber = oldFiber;
       
 12469         oldFiber = null;
       
 12470       } else {
       
 12471         nextOldFiber = oldFiber.sibling;
       
 12472       }
       
 12473       var newFiber = updateSlot(returnFiber, oldFiber, step.value, expirationTime);
       
 12474       if (newFiber === null) {
       
 12475         // TODO: This breaks on empty slots like null children. That's
       
 12476         // unfortunate because it triggers the slow path all the time. We need
       
 12477         // a better way to communicate whether this was a miss or null,
       
 12478         // boolean, undefined, etc.
       
 12479         if (!oldFiber) {
       
 12480           oldFiber = nextOldFiber;
       
 12481         }
       
 12482         break;
       
 12483       }
       
 12484       if (shouldTrackSideEffects) {
       
 12485         if (oldFiber && newFiber.alternate === null) {
       
 12486           // We matched the slot, but we didn't reuse the existing fiber, so we
       
 12487           // need to delete the existing child.
       
 12488           deleteChild(returnFiber, oldFiber);
       
 12489         }
       
 12490       }
       
 12491       lastPlacedIndex = placeChild(newFiber, lastPlacedIndex, newIdx);
       
 12492       if (previousNewFiber === null) {
       
 12493         // TODO: Move out of the loop. This only happens for the first run.
       
 12494         resultingFirstChild = newFiber;
       
 12495       } else {
       
 12496         // TODO: Defer siblings if we're not at the right index for this slot.
       
 12497         // I.e. if we had null values before, then we want to defer this
       
 12498         // for each null value. However, we also don't want to call updateSlot
       
 12499         // with the previous one.
       
 12500         previousNewFiber.sibling = newFiber;
       
 12501       }
       
 12502       previousNewFiber = newFiber;
       
 12503       oldFiber = nextOldFiber;
       
 12504     }
       
 12505 
       
 12506     if (step.done) {
       
 12507       // We've reached the end of the new children. We can delete the rest.
       
 12508       deleteRemainingChildren(returnFiber, oldFiber);
       
 12509       return resultingFirstChild;
       
 12510     }
       
 12511 
       
 12512     if (oldFiber === null) {
       
 12513       // If we don't have any more existing children we can choose a fast path
       
 12514       // since the rest will all be insertions.
       
 12515       for (; !step.done; newIdx++, step = newChildren.next()) {
       
 12516         var _newFiber3 = createChild(returnFiber, step.value, expirationTime);
       
 12517         if (_newFiber3 === null) {
       
 12518           continue;
       
 12519         }
       
 12520         lastPlacedIndex = placeChild(_newFiber3, lastPlacedIndex, newIdx);
       
 12521         if (previousNewFiber === null) {
       
 12522           // TODO: Move out of the loop. This only happens for the first run.
       
 12523           resultingFirstChild = _newFiber3;
       
 12524         } else {
       
 12525           previousNewFiber.sibling = _newFiber3;
       
 12526         }
       
 12527         previousNewFiber = _newFiber3;
       
 12528       }
       
 12529       return resultingFirstChild;
       
 12530     }
       
 12531 
       
 12532     // Add all children to a key map for quick lookups.
       
 12533     var existingChildren = mapRemainingChildren(returnFiber, oldFiber);
       
 12534 
       
 12535     // Keep scanning and use the map to restore deleted items as moves.
       
 12536     for (; !step.done; newIdx++, step = newChildren.next()) {
       
 12537       var _newFiber4 = updateFromMap(existingChildren, returnFiber, newIdx, step.value, expirationTime);
       
 12538       if (_newFiber4 !== null) {
       
 12539         if (shouldTrackSideEffects) {
       
 12540           if (_newFiber4.alternate !== null) {
       
 12541             // The new fiber is a work in progress, but if there exists a
       
 12542             // current, that means that we reused the fiber. We need to delete
       
 12543             // it from the child list so that we don't add it to the deletion
       
 12544             // list.
       
 12545             existingChildren.delete(_newFiber4.key === null ? newIdx : _newFiber4.key);
       
 12546           }
       
 12547         }
       
 12548         lastPlacedIndex = placeChild(_newFiber4, lastPlacedIndex, newIdx);
       
 12549         if (previousNewFiber === null) {
       
 12550           resultingFirstChild = _newFiber4;
       
 12551         } else {
       
 12552           previousNewFiber.sibling = _newFiber4;
       
 12553         }
       
 12554         previousNewFiber = _newFiber4;
       
 12555       }
       
 12556     }
       
 12557 
       
 12558     if (shouldTrackSideEffects) {
       
 12559       // Any existing children that weren't consumed above were deleted. We need
       
 12560       // to add them to the deletion list.
       
 12561       existingChildren.forEach(function (child) {
       
 12562         return deleteChild(returnFiber, child);
       
 12563       });
       
 12564     }
       
 12565 
       
 12566     return resultingFirstChild;
       
 12567   }
       
 12568 
       
 12569   function reconcileSingleTextNode(returnFiber, currentFirstChild, textContent, expirationTime) {
       
 12570     // There's no need to check for keys on text nodes since we don't have a
       
 12571     // way to define them.
       
 12572     if (currentFirstChild !== null && currentFirstChild.tag === HostText) {
       
 12573       // We already have an existing node so let's just update it and delete
       
 12574       // the rest.
       
 12575       deleteRemainingChildren(returnFiber, currentFirstChild.sibling);
       
 12576       var existing = useFiber(currentFirstChild, textContent, expirationTime);
       
 12577       existing.return = returnFiber;
       
 12578       return existing;
       
 12579     }
       
 12580     // The existing first child is not a text node so we need to create one
       
 12581     // and delete the existing ones.
       
 12582     deleteRemainingChildren(returnFiber, currentFirstChild);
       
 12583     var created = createFiberFromText(textContent, returnFiber.mode, expirationTime);
       
 12584     created.return = returnFiber;
       
 12585     return created;
       
 12586   }
       
 12587 
       
 12588   function reconcileSingleElement(returnFiber, currentFirstChild, element, expirationTime) {
       
 12589     var key = element.key;
       
 12590     var child = currentFirstChild;
       
 12591     while (child !== null) {
       
 12592       // TODO: If key === null and child.key === null, then this only applies to
       
 12593       // the first item in the list.
       
 12594       if (child.key === key) {
       
 12595         if (child.tag === Fragment ? element.type === REACT_FRAGMENT_TYPE : child.elementType === element.type) {
       
 12596           deleteRemainingChildren(returnFiber, child.sibling);
       
 12597           var existing = useFiber(child, element.type === REACT_FRAGMENT_TYPE ? element.props.children : element.props, expirationTime);
       
 12598           existing.ref = coerceRef(returnFiber, child, element);
       
 12599           existing.return = returnFiber;
       
 12600           {
       
 12601             existing._debugSource = element._source;
       
 12602             existing._debugOwner = element._owner;
       
 12603           }
       
 12604           return existing;
       
 12605         } else {
       
 12606           deleteRemainingChildren(returnFiber, child);
       
 12607           break;
       
 12608         }
       
 12609       } else {
       
 12610         deleteChild(returnFiber, child);
       
 12611       }
       
 12612       child = child.sibling;
       
 12613     }
       
 12614 
       
 12615     if (element.type === REACT_FRAGMENT_TYPE) {
       
 12616       var created = createFiberFromFragment(element.props.children, returnFiber.mode, expirationTime, element.key);
       
 12617       created.return = returnFiber;
       
 12618       return created;
       
 12619     } else {
       
 12620       var _created4 = createFiberFromElement(element, returnFiber.mode, expirationTime);
       
 12621       _created4.ref = coerceRef(returnFiber, currentFirstChild, element);
       
 12622       _created4.return = returnFiber;
       
 12623       return _created4;
       
 12624     }
       
 12625   }
       
 12626 
       
 12627   function reconcileSinglePortal(returnFiber, currentFirstChild, portal, expirationTime) {
       
 12628     var key = portal.key;
       
 12629     var child = currentFirstChild;
       
 12630     while (child !== null) {
       
 12631       // TODO: If key === null and child.key === null, then this only applies to
       
 12632       // the first item in the list.
       
 12633       if (child.key === key) {
       
 12634         if (child.tag === HostPortal && child.stateNode.containerInfo === portal.containerInfo && child.stateNode.implementation === portal.implementation) {
       
 12635           deleteRemainingChildren(returnFiber, child.sibling);
       
 12636           var existing = useFiber(child, portal.children || [], expirationTime);
       
 12637           existing.return = returnFiber;
       
 12638           return existing;
       
 12639         } else {
       
 12640           deleteRemainingChildren(returnFiber, child);
       
 12641           break;
       
 12642         }
       
 12643       } else {
       
 12644         deleteChild(returnFiber, child);
       
 12645       }
       
 12646       child = child.sibling;
       
 12647     }
       
 12648 
       
 12649     var created = createFiberFromPortal(portal, returnFiber.mode, expirationTime);
       
 12650     created.return = returnFiber;
       
 12651     return created;
       
 12652   }
       
 12653 
       
 12654   // This API will tag the children with the side-effect of the reconciliation
       
 12655   // itself. They will be added to the side-effect list as we pass through the
       
 12656   // children and the parent.
       
 12657   function reconcileChildFibers(returnFiber, currentFirstChild, newChild, expirationTime) {
       
 12658     // This function is not recursive.
       
 12659     // If the top level item is an array, we treat it as a set of children,
       
 12660     // not as a fragment. Nested arrays on the other hand will be treated as
       
 12661     // fragment nodes. Recursion happens at the normal flow.
       
 12662 
       
 12663     // Handle top level unkeyed fragments as if they were arrays.
       
 12664     // This leads to an ambiguity between <>{[...]}</> and <>...</>.
       
 12665     // We treat the ambiguous cases above the same.
       
 12666     var isUnkeyedTopLevelFragment = typeof newChild === 'object' && newChild !== null && newChild.type === REACT_FRAGMENT_TYPE && newChild.key === null;
       
 12667     if (isUnkeyedTopLevelFragment) {
       
 12668       newChild = newChild.props.children;
       
 12669     }
       
 12670 
       
 12671     // Handle object types
       
 12672     var isObject = typeof newChild === 'object' && newChild !== null;
       
 12673 
       
 12674     if (isObject) {
       
 12675       switch (newChild.$$typeof) {
       
 12676         case REACT_ELEMENT_TYPE:
       
 12677           return placeSingleChild(reconcileSingleElement(returnFiber, currentFirstChild, newChild, expirationTime));
       
 12678         case REACT_PORTAL_TYPE:
       
 12679           return placeSingleChild(reconcileSinglePortal(returnFiber, currentFirstChild, newChild, expirationTime));
       
 12680       }
       
 12681     }
       
 12682 
       
 12683     if (typeof newChild === 'string' || typeof newChild === 'number') {
       
 12684       return placeSingleChild(reconcileSingleTextNode(returnFiber, currentFirstChild, '' + newChild, expirationTime));
       
 12685     }
       
 12686 
       
 12687     if (isArray(newChild)) {
       
 12688       return reconcileChildrenArray(returnFiber, currentFirstChild, newChild, expirationTime);
       
 12689     }
       
 12690 
       
 12691     if (getIteratorFn(newChild)) {
       
 12692       return reconcileChildrenIterator(returnFiber, currentFirstChild, newChild, expirationTime);
       
 12693     }
       
 12694 
       
 12695     if (isObject) {
       
 12696       throwOnInvalidObjectType(returnFiber, newChild);
       
 12697     }
       
 12698 
       
 12699     {
       
 12700       if (typeof newChild === 'function') {
       
 12701         warnOnFunctionType();
       
 12702       }
       
 12703     }
       
 12704     if (typeof newChild === 'undefined' && !isUnkeyedTopLevelFragment) {
       
 12705       // If the new child is undefined, and the return fiber is a composite
       
 12706       // component, throw an error. If Fiber return types are disabled,
       
 12707       // we already threw above.
       
 12708       switch (returnFiber.tag) {
       
 12709         case ClassComponent:
       
 12710           {
       
 12711             {
       
 12712               var instance = returnFiber.stateNode;
       
 12713               if (instance.render._isMockFunction) {
       
 12714                 // We allow auto-mocks to proceed as if they're returning null.
       
 12715                 break;
       
 12716               }
       
 12717             }
       
 12718           }
       
 12719         // Intentionally fall through to the next case, which handles both
       
 12720         // functions and classes
       
 12721         // eslint-disable-next-lined no-fallthrough
       
 12722         case FunctionComponent:
       
 12723           {
       
 12724             var Component = returnFiber.type;
       
 12725             invariant(false, '%s(...): Nothing was returned from render. This usually means a return statement is missing. Or, to render nothing, return null.', Component.displayName || Component.name || 'Component');
       
 12726           }
       
 12727       }
       
 12728     }
       
 12729 
       
 12730     // Remaining cases are all treated as empty.
       
 12731     return deleteRemainingChildren(returnFiber, currentFirstChild);
       
 12732   }
       
 12733 
       
 12734   return reconcileChildFibers;
       
 12735 }
       
 12736 
       
 12737 var reconcileChildFibers = ChildReconciler(true);
       
 12738 var mountChildFibers = ChildReconciler(false);
       
 12739 
       
 12740 function cloneChildFibers(current$$1, workInProgress) {
       
 12741   !(current$$1 === null || workInProgress.child === current$$1.child) ? invariant(false, 'Resuming work not yet implemented.') : void 0;
       
 12742 
       
 12743   if (workInProgress.child === null) {
       
 12744     return;
       
 12745   }
       
 12746 
       
 12747   var currentChild = workInProgress.child;
       
 12748   var newChild = createWorkInProgress(currentChild, currentChild.pendingProps, currentChild.expirationTime);
       
 12749   workInProgress.child = newChild;
       
 12750 
       
 12751   newChild.return = workInProgress;
       
 12752   while (currentChild.sibling !== null) {
       
 12753     currentChild = currentChild.sibling;
       
 12754     newChild = newChild.sibling = createWorkInProgress(currentChild, currentChild.pendingProps, currentChild.expirationTime);
       
 12755     newChild.return = workInProgress;
       
 12756   }
       
 12757   newChild.sibling = null;
       
 12758 }
       
 12759 
       
 12760 var NO_CONTEXT = {};
       
 12761 
       
 12762 var contextStackCursor$1 = createCursor(NO_CONTEXT);
       
 12763 var contextFiberStackCursor = createCursor(NO_CONTEXT);
       
 12764 var rootInstanceStackCursor = createCursor(NO_CONTEXT);
       
 12765 
       
 12766 function requiredContext(c) {
       
 12767   !(c !== NO_CONTEXT) ? invariant(false, 'Expected host context to exist. This error is likely caused by a bug in React. Please file an issue.') : void 0;
       
 12768   return c;
       
 12769 }
       
 12770 
       
 12771 function getRootHostContainer() {
       
 12772   var rootInstance = requiredContext(rootInstanceStackCursor.current);
       
 12773   return rootInstance;
       
 12774 }
       
 12775 
       
 12776 function pushHostContainer(fiber, nextRootInstance) {
       
 12777   // Push current root instance onto the stack;
       
 12778   // This allows us to reset root when portals are popped.
       
 12779   push(rootInstanceStackCursor, nextRootInstance, fiber);
       
 12780   // Track the context and the Fiber that provided it.
       
 12781   // This enables us to pop only Fibers that provide unique contexts.
       
 12782   push(contextFiberStackCursor, fiber, fiber);
       
 12783 
       
 12784   // Finally, we need to push the host context to the stack.
       
 12785   // However, we can't just call getRootHostContext() and push it because
       
 12786   // we'd have a different number of entries on the stack depending on
       
 12787   // whether getRootHostContext() throws somewhere in renderer code or not.
       
 12788   // So we push an empty value first. This lets us safely unwind on errors.
       
 12789   push(contextStackCursor$1, NO_CONTEXT, fiber);
       
 12790   var nextRootContext = getRootHostContext(nextRootInstance);
       
 12791   // Now that we know this function doesn't throw, replace it.
       
 12792   pop(contextStackCursor$1, fiber);
       
 12793   push(contextStackCursor$1, nextRootContext, fiber);
       
 12794 }
       
 12795 
       
 12796 function popHostContainer(fiber) {
       
 12797   pop(contextStackCursor$1, fiber);
       
 12798   pop(contextFiberStackCursor, fiber);
       
 12799   pop(rootInstanceStackCursor, fiber);
       
 12800 }
       
 12801 
       
 12802 function getHostContext() {
       
 12803   var context = requiredContext(contextStackCursor$1.current);
       
 12804   return context;
       
 12805 }
       
 12806 
       
 12807 function pushHostContext(fiber) {
       
 12808   var rootInstance = requiredContext(rootInstanceStackCursor.current);
       
 12809   var context = requiredContext(contextStackCursor$1.current);
       
 12810   var nextContext = getChildHostContext(context, fiber.type, rootInstance);
       
 12811 
       
 12812   // Don't push this Fiber's context unless it's unique.
       
 12813   if (context === nextContext) {
       
 12814     return;
       
 12815   }
       
 12816 
       
 12817   // Track the context and the Fiber that provided it.
       
 12818   // This enables us to pop only Fibers that provide unique contexts.
       
 12819   push(contextFiberStackCursor, fiber, fiber);
       
 12820   push(contextStackCursor$1, nextContext, fiber);
       
 12821 }
       
 12822 
       
 12823 function popHostContext(fiber) {
       
 12824   // Do not pop unless this Fiber provided the current context.
       
 12825   // pushHostContext() only pushes Fibers that provide unique contexts.
       
 12826   if (contextFiberStackCursor.current !== fiber) {
       
 12827     return;
       
 12828   }
       
 12829 
       
 12830   pop(contextStackCursor$1, fiber);
       
 12831   pop(contextFiberStackCursor, fiber);
       
 12832 }
       
 12833 
       
 12834 var NoEffect$1 = /*             */0;
       
 12835 var UnmountSnapshot = /*      */2;
       
 12836 var UnmountMutation = /*      */4;
       
 12837 var MountMutation = /*        */8;
       
 12838 var UnmountLayout = /*        */16;
       
 12839 var MountLayout = /*          */32;
       
 12840 var MountPassive = /*         */64;
       
 12841 var UnmountPassive = /*       */128;
       
 12842 
       
 12843 var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher;
       
 12844 
       
 12845 
       
 12846 var didWarnAboutMismatchedHooksForComponent = void 0;
       
 12847 {
       
 12848   didWarnAboutMismatchedHooksForComponent = new Set();
       
 12849 }
       
 12850 
       
 12851 // These are set right before calling the component.
       
 12852 var renderExpirationTime = NoWork;
       
 12853 // The work-in-progress fiber. I've named it differently to distinguish it from
       
 12854 // the work-in-progress hook.
       
 12855 var currentlyRenderingFiber$1 = null;
       
 12856 
       
 12857 // Hooks are stored as a linked list on the fiber's memoizedState field. The
       
 12858 // current hook list is the list that belongs to the current fiber. The
       
 12859 // work-in-progress hook list is a new list that will be added to the
       
 12860 // work-in-progress fiber.
       
 12861 var currentHook = null;
       
 12862 var nextCurrentHook = null;
       
 12863 var firstWorkInProgressHook = null;
       
 12864 var workInProgressHook = null;
       
 12865 var nextWorkInProgressHook = null;
       
 12866 
       
 12867 var remainingExpirationTime = NoWork;
       
 12868 var componentUpdateQueue = null;
       
 12869 var sideEffectTag = 0;
       
 12870 
       
 12871 // Updates scheduled during render will trigger an immediate re-render at the
       
 12872 // end of the current pass. We can't store these updates on the normal queue,
       
 12873 // because if the work is aborted, they should be discarded. Because this is
       
 12874 // a relatively rare case, we also don't want to add an additional field to
       
 12875 // either the hook or queue object types. So we store them in a lazily create
       
 12876 // map of queue -> render-phase updates, which are discarded once the component
       
 12877 // completes without re-rendering.
       
 12878 
       
 12879 // Whether an update was scheduled during the currently executing render pass.
       
 12880 var didScheduleRenderPhaseUpdate = false;
       
 12881 // Lazily created map of render-phase updates
       
 12882 var renderPhaseUpdates = null;
       
 12883 // Counter to prevent infinite loops.
       
 12884 var numberOfReRenders = 0;
       
 12885 var RE_RENDER_LIMIT = 25;
       
 12886 
       
 12887 // In DEV, this is the name of the currently executing primitive hook
       
 12888 var currentHookNameInDev = null;
       
 12889 
       
 12890 // In DEV, this list ensures that hooks are called in the same order between renders.
       
 12891 // The list stores the order of hooks used during the initial render (mount).
       
 12892 // Subsequent renders (updates) reference this list.
       
 12893 var hookTypesDev = null;
       
 12894 var hookTypesUpdateIndexDev = -1;
       
 12895 
       
 12896 function mountHookTypesDev() {
       
 12897   {
       
 12898     var hookName = currentHookNameInDev;
       
 12899 
       
 12900     if (hookTypesDev === null) {
       
 12901       hookTypesDev = [hookName];
       
 12902     } else {
       
 12903       hookTypesDev.push(hookName);
       
 12904     }
       
 12905   }
       
 12906 }
       
 12907 
       
 12908 function updateHookTypesDev() {
       
 12909   {
       
 12910     var hookName = currentHookNameInDev;
       
 12911 
       
 12912     if (hookTypesDev !== null) {
       
 12913       hookTypesUpdateIndexDev++;
       
 12914       if (hookTypesDev[hookTypesUpdateIndexDev] !== hookName) {
       
 12915         warnOnHookMismatchInDev(hookName);
       
 12916       }
       
 12917     }
       
 12918   }
       
 12919 }
       
 12920 
       
 12921 function warnOnHookMismatchInDev(currentHookName) {
       
 12922   {
       
 12923     var componentName = getComponentName(currentlyRenderingFiber$1.type);
       
 12924     if (!didWarnAboutMismatchedHooksForComponent.has(componentName)) {
       
 12925       didWarnAboutMismatchedHooksForComponent.add(componentName);
       
 12926 
       
 12927       if (hookTypesDev !== null) {
       
 12928         var table = '';
       
 12929 
       
 12930         var secondColumnStart = 30;
       
 12931 
       
 12932         for (var i = 0; i <= hookTypesUpdateIndexDev; i++) {
       
 12933           var oldHookName = hookTypesDev[i];
       
 12934           var newHookName = i === hookTypesUpdateIndexDev ? currentHookName : oldHookName;
       
 12935 
       
 12936           var row = i + 1 + '. ' + oldHookName;
       
 12937 
       
 12938           // Extra space so second column lines up
       
 12939           // lol @ IE not supporting String#repeat
       
 12940           while (row.length < secondColumnStart) {
       
 12941             row += ' ';
       
 12942           }
       
 12943 
       
 12944           row += newHookName + '\n';
       
 12945 
       
 12946           table += row;
       
 12947         }
       
 12948 
       
 12949         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);
       
 12950       }
       
 12951     }
       
 12952   }
       
 12953 }
       
 12954 
       
 12955 function throwInvalidHookError() {
       
 12956   invariant(false, 'Hooks can only be called inside the body of a function component. (https://fb.me/react-invalid-hook-call)');
       
 12957 }
       
 12958 
       
 12959 function areHookInputsEqual(nextDeps, prevDeps) {
       
 12960   if (prevDeps === null) {
       
 12961     {
       
 12962       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);
       
 12963     }
       
 12964     return false;
       
 12965   }
       
 12966 
       
 12967   {
       
 12968     // Don't bother comparing lengths in prod because these arrays should be
       
 12969     // passed inline.
       
 12970     if (nextDeps.length !== prevDeps.length) {
       
 12971       warning$1(false, 'The final argument passed to %s changed size between renders. The ' + 'order and size of this array must remain constant.\n\n' + 'Previous: %s\n' + 'Incoming: %s', currentHookNameInDev, '[' + nextDeps.join(', ') + ']', '[' + prevDeps.join(', ') + ']');
       
 12972     }
       
 12973   }
       
 12974   for (var i = 0; i < prevDeps.length && i < nextDeps.length; i++) {
       
 12975     if (is(nextDeps[i], prevDeps[i])) {
       
 12976       continue;
       
 12977     }
       
 12978     return false;
       
 12979   }
       
 12980   return true;
       
 12981 }
       
 12982 
       
 12983 function renderWithHooks(current, workInProgress, Component, props, refOrContext, nextRenderExpirationTime) {
       
 12984   renderExpirationTime = nextRenderExpirationTime;
       
 12985   currentlyRenderingFiber$1 = workInProgress;
       
 12986   nextCurrentHook = current !== null ? current.memoizedState : null;
       
 12987 
       
 12988   {
       
 12989     hookTypesDev = current !== null ? current._debugHookTypes : null;
       
 12990     hookTypesUpdateIndexDev = -1;
       
 12991   }
       
 12992 
       
 12993   // The following should have already been reset
       
 12994   // currentHook = null;
       
 12995   // workInProgressHook = null;
       
 12996 
       
 12997   // remainingExpirationTime = NoWork;
       
 12998   // componentUpdateQueue = null;
       
 12999 
       
 13000   // didScheduleRenderPhaseUpdate = false;
       
 13001   // renderPhaseUpdates = null;
       
 13002   // numberOfReRenders = 0;
       
 13003   // sideEffectTag = 0;
       
 13004 
       
 13005   // TODO Warn if no hooks are used at all during mount, then some are used during update.
       
 13006   // Currently we will identify the update render as a mount because nextCurrentHook === null.
       
 13007   // This is tricky because it's valid for certain types of components (e.g. React.lazy)
       
 13008 
       
 13009   // Using nextCurrentHook to differentiate between mount/update only works if at least one stateful hook is used.
       
 13010   // Non-stateful hooks (e.g. context) don't get added to memoizedState,
       
 13011   // so nextCurrentHook would be null during updates and mounts.
       
 13012   {
       
 13013     if (nextCurrentHook !== null) {
       
 13014       ReactCurrentDispatcher$1.current = HooksDispatcherOnUpdateInDEV;
       
 13015     } else if (hookTypesDev !== null) {
       
 13016       // This dispatcher handles an edge case where a component is updating,
       
 13017       // but no stateful hooks have been used.
       
 13018       // We want to match the production code behavior (which will use HooksDispatcherOnMount),
       
 13019       // but with the extra DEV validation to ensure hooks ordering hasn't changed.
       
 13020       // This dispatcher does that.
       
 13021       ReactCurrentDispatcher$1.current = HooksDispatcherOnMountWithHookTypesInDEV;
       
 13022     } else {
       
 13023       ReactCurrentDispatcher$1.current = HooksDispatcherOnMountInDEV;
       
 13024     }
       
 13025   }
       
 13026 
       
 13027   var children = Component(props, refOrContext);
       
 13028 
       
 13029   if (didScheduleRenderPhaseUpdate) {
       
 13030     do {
       
 13031       didScheduleRenderPhaseUpdate = false;
       
 13032       numberOfReRenders += 1;
       
 13033 
       
 13034       // Start over from the beginning of the list
       
 13035       nextCurrentHook = current !== null ? current.memoizedState : null;
       
 13036       nextWorkInProgressHook = firstWorkInProgressHook;
       
 13037 
       
 13038       currentHook = null;
       
 13039       workInProgressHook = null;
       
 13040       componentUpdateQueue = null;
       
 13041 
       
 13042       {
       
 13043         // Also validate hook order for cascading updates.
       
 13044         hookTypesUpdateIndexDev = -1;
       
 13045       }
       
 13046 
       
 13047       ReactCurrentDispatcher$1.current = HooksDispatcherOnUpdateInDEV;
       
 13048 
       
 13049       children = Component(props, refOrContext);
       
 13050     } while (didScheduleRenderPhaseUpdate);
       
 13051 
       
 13052     renderPhaseUpdates = null;
       
 13053     numberOfReRenders = 0;
       
 13054   }
       
 13055 
       
 13056   // We can assume the previous dispatcher is always this one, since we set it
       
 13057   // at the beginning of the render phase and there's no re-entrancy.
       
 13058   ReactCurrentDispatcher$1.current = ContextOnlyDispatcher;
       
 13059 
       
 13060   var renderedWork = currentlyRenderingFiber$1;
       
 13061 
       
 13062   renderedWork.memoizedState = firstWorkInProgressHook;
       
 13063   renderedWork.expirationTime = remainingExpirationTime;
       
 13064   renderedWork.updateQueue = componentUpdateQueue;
       
 13065   renderedWork.effectTag |= sideEffectTag;
       
 13066 
       
 13067   {
       
 13068     renderedWork._debugHookTypes = hookTypesDev;
       
 13069   }
       
 13070 
       
 13071   // This check uses currentHook so that it works the same in DEV and prod bundles.
       
 13072   // hookTypesDev could catch more cases (e.g. context) but only in DEV bundles.
       
 13073   var didRenderTooFewHooks = currentHook !== null && currentHook.next !== null;
       
 13074 
       
 13075   renderExpirationTime = NoWork;
       
 13076   currentlyRenderingFiber$1 = null;
       
 13077 
       
 13078   currentHook = null;
       
 13079   nextCurrentHook = null;
       
 13080   firstWorkInProgressHook = null;
       
 13081   workInProgressHook = null;
       
 13082   nextWorkInProgressHook = null;
       
 13083 
       
 13084   {
       
 13085     currentHookNameInDev = null;
       
 13086     hookTypesDev = null;
       
 13087     hookTypesUpdateIndexDev = -1;
       
 13088   }
       
 13089 
       
 13090   remainingExpirationTime = NoWork;
       
 13091   componentUpdateQueue = null;
       
 13092   sideEffectTag = 0;
       
 13093 
       
 13094   // These were reset above
       
 13095   // didScheduleRenderPhaseUpdate = false;
       
 13096   // renderPhaseUpdates = null;
       
 13097   // numberOfReRenders = 0;
       
 13098 
       
 13099   !!didRenderTooFewHooks ? invariant(false, 'Rendered fewer hooks than expected. This may be caused by an accidental early return statement.') : void 0;
       
 13100 
       
 13101   return children;
       
 13102 }
       
 13103 
       
 13104 function bailoutHooks(current, workInProgress, expirationTime) {
       
 13105   workInProgress.updateQueue = current.updateQueue;
       
 13106   workInProgress.effectTag &= ~(Passive | Update);
       
 13107   if (current.expirationTime <= expirationTime) {
       
 13108     current.expirationTime = NoWork;
       
 13109   }
       
 13110 }
       
 13111 
       
 13112 function resetHooks() {
       
 13113   // We can assume the previous dispatcher is always this one, since we set it
       
 13114   // at the beginning of the render phase and there's no re-entrancy.
       
 13115   ReactCurrentDispatcher$1.current = ContextOnlyDispatcher;
       
 13116 
       
 13117   // This is used to reset the state of this module when a component throws.
       
 13118   // It's also called inside mountIndeterminateComponent if we determine the
       
 13119   // component is a module-style component.
       
 13120   renderExpirationTime = NoWork;
       
 13121   currentlyRenderingFiber$1 = null;
       
 13122 
       
 13123   currentHook = null;
       
 13124   nextCurrentHook = null;
       
 13125   firstWorkInProgressHook = null;
       
 13126   workInProgressHook = null;
       
 13127   nextWorkInProgressHook = null;
       
 13128 
       
 13129   {
       
 13130     hookTypesDev = null;
       
 13131     hookTypesUpdateIndexDev = -1;
       
 13132 
       
 13133     currentHookNameInDev = null;
       
 13134   }
       
 13135 
       
 13136   remainingExpirationTime = NoWork;
       
 13137   componentUpdateQueue = null;
       
 13138   sideEffectTag = 0;
       
 13139 
       
 13140   didScheduleRenderPhaseUpdate = false;
       
 13141   renderPhaseUpdates = null;
       
 13142   numberOfReRenders = 0;
       
 13143 }
       
 13144 
       
 13145 function mountWorkInProgressHook() {
       
 13146   var hook = {
       
 13147     memoizedState: null,
       
 13148 
       
 13149     baseState: null,
       
 13150     queue: null,
       
 13151     baseUpdate: null,
       
 13152 
       
 13153     next: null
       
 13154   };
       
 13155 
       
 13156   if (workInProgressHook === null) {
       
 13157     // This is the first hook in the list
       
 13158     firstWorkInProgressHook = workInProgressHook = hook;
       
 13159   } else {
       
 13160     // Append to the end of the list
       
 13161     workInProgressHook = workInProgressHook.next = hook;
       
 13162   }
       
 13163   return workInProgressHook;
       
 13164 }
       
 13165 
       
 13166 function updateWorkInProgressHook() {
       
 13167   // This function is used both for updates and for re-renders triggered by a
       
 13168   // render phase update. It assumes there is either a current hook we can
       
 13169   // clone, or a work-in-progress hook from a previous render pass that we can
       
 13170   // use as a base. When we reach the end of the base list, we must switch to
       
 13171   // the dispatcher used for mounts.
       
 13172   if (nextWorkInProgressHook !== null) {
       
 13173     // There's already a work-in-progress. Reuse it.
       
 13174     workInProgressHook = nextWorkInProgressHook;
       
 13175     nextWorkInProgressHook = workInProgressHook.next;
       
 13176 
       
 13177     currentHook = nextCurrentHook;
       
 13178     nextCurrentHook = currentHook !== null ? currentHook.next : null;
       
 13179   } else {
       
 13180     // Clone from the current hook.
       
 13181     !(nextCurrentHook !== null) ? invariant(false, 'Rendered more hooks than during the previous render.') : void 0;
       
 13182     currentHook = nextCurrentHook;
       
 13183 
       
 13184     var newHook = {
       
 13185       memoizedState: currentHook.memoizedState,
       
 13186 
       
 13187       baseState: currentHook.baseState,
       
 13188       queue: currentHook.queue,
       
 13189       baseUpdate: currentHook.baseUpdate,
       
 13190 
       
 13191       next: null
       
 13192     };
       
 13193 
       
 13194     if (workInProgressHook === null) {
       
 13195       // This is the first hook in the list.
       
 13196       workInProgressHook = firstWorkInProgressHook = newHook;
       
 13197     } else {
       
 13198       // Append to the end of the list.
       
 13199       workInProgressHook = workInProgressHook.next = newHook;
       
 13200     }
       
 13201     nextCurrentHook = currentHook.next;
       
 13202   }
       
 13203   return workInProgressHook;
       
 13204 }
       
 13205 
       
 13206 function createFunctionComponentUpdateQueue() {
       
 13207   return {
       
 13208     lastEffect: null
       
 13209   };
       
 13210 }
       
 13211 
       
 13212 function basicStateReducer(state, action) {
       
 13213   return typeof action === 'function' ? action(state) : action;
       
 13214 }
       
 13215 
       
 13216 function mountReducer(reducer, initialArg, init) {
       
 13217   var hook = mountWorkInProgressHook();
       
 13218   var initialState = void 0;
       
 13219   if (init !== undefined) {
       
 13220     initialState = init(initialArg);
       
 13221   } else {
       
 13222     initialState = initialArg;
       
 13223   }
       
 13224   hook.memoizedState = hook.baseState = initialState;
       
 13225   var queue = hook.queue = {
       
 13226     last: null,
       
 13227     dispatch: null,
       
 13228     eagerReducer: reducer,
       
 13229     eagerState: initialState
       
 13230   };
       
 13231   var dispatch = queue.dispatch = dispatchAction.bind(null,
       
 13232   // Flow doesn't know this is non-null, but we do.
       
 13233   currentlyRenderingFiber$1, queue);
       
 13234   return [hook.memoizedState, dispatch];
       
 13235 }
       
 13236 
       
 13237 function updateReducer(reducer, initialArg, init) {
       
 13238   var hook = updateWorkInProgressHook();
       
 13239   var queue = hook.queue;
       
 13240   !(queue !== null) ? invariant(false, 'Should have a queue. This is likely a bug in React. Please file an issue.') : void 0;
       
 13241 
       
 13242   if (numberOfReRenders > 0) {
       
 13243     // This is a re-render. Apply the new render phase updates to the previous
       
 13244     var _dispatch = queue.dispatch;
       
 13245     if (renderPhaseUpdates !== null) {
       
 13246       // Render phase updates are stored in a map of queue -> linked list
       
 13247       var firstRenderPhaseUpdate = renderPhaseUpdates.get(queue);
       
 13248       if (firstRenderPhaseUpdate !== undefined) {
       
 13249         renderPhaseUpdates.delete(queue);
       
 13250         var newState = hook.memoizedState;
       
 13251         var update = firstRenderPhaseUpdate;
       
 13252         do {
       
 13253           // Process this render phase update. We don't have to check the
       
 13254           // priority because it will always be the same as the current
       
 13255           // render's.
       
 13256           var _action = update.action;
       
 13257           newState = reducer(newState, _action);
       
 13258           update = update.next;
       
 13259         } while (update !== null);
       
 13260 
       
 13261         // Mark that the fiber performed work, but only if the new state is
       
 13262         // different from the current state.
       
 13263         if (!is(newState, hook.memoizedState)) {
       
 13264           markWorkInProgressReceivedUpdate();
       
 13265         }
       
 13266 
       
 13267         hook.memoizedState = newState;
       
 13268         // Don't persist the state accumlated from the render phase updates to
       
 13269         // the base state unless the queue is empty.
       
 13270         // TODO: Not sure if this is the desired semantics, but it's what we
       
 13271         // do for gDSFP. I can't remember why.
       
 13272         if (hook.baseUpdate === queue.last) {
       
 13273           hook.baseState = newState;
       
 13274         }
       
 13275 
       
 13276         queue.eagerReducer = reducer;
       
 13277         queue.eagerState = newState;
       
 13278 
       
 13279         return [newState, _dispatch];
       
 13280       }
       
 13281     }
       
 13282     return [hook.memoizedState, _dispatch];
       
 13283   }
       
 13284 
       
 13285   // The last update in the entire queue
       
 13286   var last = queue.last;
       
 13287   // The last update that is part of the base state.
       
 13288   var baseUpdate = hook.baseUpdate;
       
 13289   var baseState = hook.baseState;
       
 13290 
       
 13291   // Find the first unprocessed update.
       
 13292   var first = void 0;
       
 13293   if (baseUpdate !== null) {
       
 13294     if (last !== null) {
       
 13295       // For the first update, the queue is a circular linked list where
       
 13296       // `queue.last.next = queue.first`. Once the first update commits, and
       
 13297       // the `baseUpdate` is no longer empty, we can unravel the list.
       
 13298       last.next = null;
       
 13299     }
       
 13300     first = baseUpdate.next;
       
 13301   } else {
       
 13302     first = last !== null ? last.next : null;
       
 13303   }
       
 13304   if (first !== null) {
       
 13305     var _newState = baseState;
       
 13306     var newBaseState = null;
       
 13307     var newBaseUpdate = null;
       
 13308     var prevUpdate = baseUpdate;
       
 13309     var _update = first;
       
 13310     var didSkip = false;
       
 13311     do {
       
 13312       var updateExpirationTime = _update.expirationTime;
       
 13313       if (updateExpirationTime < renderExpirationTime) {
       
 13314         // Priority is insufficient. Skip this update. If this is the first
       
 13315         // skipped update, the previous update/state is the new base
       
 13316         // update/state.
       
 13317         if (!didSkip) {
       
 13318           didSkip = true;
       
 13319           newBaseUpdate = prevUpdate;
       
 13320           newBaseState = _newState;
       
 13321         }
       
 13322         // Update the remaining priority in the queue.
       
 13323         if (updateExpirationTime > remainingExpirationTime) {
       
 13324           remainingExpirationTime = updateExpirationTime;
       
 13325         }
       
 13326       } else {
       
 13327         // Process this update.
       
 13328         if (_update.eagerReducer === reducer) {
       
 13329           // If this update was processed eagerly, and its reducer matches the
       
 13330           // current reducer, we can use the eagerly computed state.
       
 13331           _newState = _update.eagerState;
       
 13332         } else {
       
 13333           var _action2 = _update.action;
       
 13334           _newState = reducer(_newState, _action2);
       
 13335         }
       
 13336       }
       
 13337       prevUpdate = _update;
       
 13338       _update = _update.next;
       
 13339     } while (_update !== null && _update !== first);
       
 13340 
       
 13341     if (!didSkip) {
       
 13342       newBaseUpdate = prevUpdate;
       
 13343       newBaseState = _newState;
       
 13344     }
       
 13345 
       
 13346     // Mark that the fiber performed work, but only if the new state is
       
 13347     // different from the current state.
       
 13348     if (!is(_newState, hook.memoizedState)) {
       
 13349       markWorkInProgressReceivedUpdate();
       
 13350     }
       
 13351 
       
 13352     hook.memoizedState = _newState;
       
 13353     hook.baseUpdate = newBaseUpdate;
       
 13354     hook.baseState = newBaseState;
       
 13355 
       
 13356     queue.eagerReducer = reducer;
       
 13357     queue.eagerState = _newState;
       
 13358   }
       
 13359 
       
 13360   var dispatch = queue.dispatch;
       
 13361   return [hook.memoizedState, dispatch];
       
 13362 }
       
 13363 
       
 13364 function mountState(initialState) {
       
 13365   var hook = mountWorkInProgressHook();
       
 13366   if (typeof initialState === 'function') {
       
 13367     initialState = initialState();
       
 13368   }
       
 13369   hook.memoizedState = hook.baseState = initialState;
       
 13370   var queue = hook.queue = {
       
 13371     last: null,
       
 13372     dispatch: null,
       
 13373     eagerReducer: basicStateReducer,
       
 13374     eagerState: initialState
       
 13375   };
       
 13376   var dispatch = queue.dispatch = dispatchAction.bind(null,
       
 13377   // Flow doesn't know this is non-null, but we do.
       
 13378   currentlyRenderingFiber$1, queue);
       
 13379   return [hook.memoizedState, dispatch];
       
 13380 }
       
 13381 
       
 13382 function updateState(initialState) {
       
 13383   return updateReducer(basicStateReducer, initialState);
       
 13384 }
       
 13385 
       
 13386 function pushEffect(tag, create, destroy, deps) {
       
 13387   var effect = {
       
 13388     tag: tag,
       
 13389     create: create,
       
 13390     destroy: destroy,
       
 13391     deps: deps,
       
 13392     // Circular
       
 13393     next: null
       
 13394   };
       
 13395   if (componentUpdateQueue === null) {
       
 13396     componentUpdateQueue = createFunctionComponentUpdateQueue();
       
 13397     componentUpdateQueue.lastEffect = effect.next = effect;
       
 13398   } else {
       
 13399     var _lastEffect = componentUpdateQueue.lastEffect;
       
 13400     if (_lastEffect === null) {
       
 13401       componentUpdateQueue.lastEffect = effect.next = effect;
       
 13402     } else {
       
 13403       var firstEffect = _lastEffect.next;
       
 13404       _lastEffect.next = effect;
       
 13405       effect.next = firstEffect;
       
 13406       componentUpdateQueue.lastEffect = effect;
       
 13407     }
       
 13408   }
       
 13409   return effect;
       
 13410 }
       
 13411 
       
 13412 function mountRef(initialValue) {
       
 13413   var hook = mountWorkInProgressHook();
       
 13414   var ref = { current: initialValue };
       
 13415   {
       
 13416     Object.seal(ref);
       
 13417   }
       
 13418   hook.memoizedState = ref;
       
 13419   return ref;
       
 13420 }
       
 13421 
       
 13422 function updateRef(initialValue) {
       
 13423   var hook = updateWorkInProgressHook();
       
 13424   return hook.memoizedState;
       
 13425 }
       
 13426 
       
 13427 function mountEffectImpl(fiberEffectTag, hookEffectTag, create, deps) {
       
 13428   var hook = mountWorkInProgressHook();
       
 13429   var nextDeps = deps === undefined ? null : deps;
       
 13430   sideEffectTag |= fiberEffectTag;
       
 13431   hook.memoizedState = pushEffect(hookEffectTag, create, undefined, nextDeps);
       
 13432 }
       
 13433 
       
 13434 function updateEffectImpl(fiberEffectTag, hookEffectTag, create, deps) {
       
 13435   var hook = updateWorkInProgressHook();
       
 13436   var nextDeps = deps === undefined ? null : deps;
       
 13437   var destroy = undefined;
       
 13438 
       
 13439   if (currentHook !== null) {
       
 13440     var prevEffect = currentHook.memoizedState;
       
 13441     destroy = prevEffect.destroy;
       
 13442     if (nextDeps !== null) {
       
 13443       var prevDeps = prevEffect.deps;
       
 13444       if (areHookInputsEqual(nextDeps, prevDeps)) {
       
 13445         pushEffect(NoEffect$1, create, destroy, nextDeps);
       
 13446         return;
       
 13447       }
       
 13448     }
       
 13449   }
       
 13450 
       
 13451   sideEffectTag |= fiberEffectTag;
       
 13452   hook.memoizedState = pushEffect(hookEffectTag, create, destroy, nextDeps);
       
 13453 }
       
 13454 
       
 13455 function mountEffect(create, deps) {
       
 13456   return mountEffectImpl(Update | Passive, UnmountPassive | MountPassive, create, deps);
       
 13457 }
       
 13458 
       
 13459 function updateEffect(create, deps) {
       
 13460   return updateEffectImpl(Update | Passive, UnmountPassive | MountPassive, create, deps);
       
 13461 }
       
 13462 
       
 13463 function mountLayoutEffect(create, deps) {
       
 13464   return mountEffectImpl(Update, UnmountMutation | MountLayout, create, deps);
       
 13465 }
       
 13466 
       
 13467 function updateLayoutEffect(create, deps) {
       
 13468   return updateEffectImpl(Update, UnmountMutation | MountLayout, create, deps);
       
 13469 }
       
 13470 
       
 13471 function imperativeHandleEffect(create, ref) {
       
 13472   if (typeof ref === 'function') {
       
 13473     var refCallback = ref;
       
 13474     var _inst = create();
       
 13475     refCallback(_inst);
       
 13476     return function () {
       
 13477       refCallback(null);
       
 13478     };
       
 13479   } else if (ref !== null && ref !== undefined) {
       
 13480     var refObject = ref;
       
 13481     {
       
 13482       !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;
       
 13483     }
       
 13484     var _inst2 = create();
       
 13485     refObject.current = _inst2;
       
 13486     return function () {
       
 13487       refObject.current = null;
       
 13488     };
       
 13489   }
       
 13490 }
       
 13491 
       
 13492 function mountImperativeHandle(ref, create, deps) {
       
 13493   {
       
 13494     !(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;
       
 13495   }
       
 13496 
       
 13497   // TODO: If deps are provided, should we skip comparing the ref itself?
       
 13498   var effectDeps = deps !== null && deps !== undefined ? deps.concat([ref]) : null;
       
 13499 
       
 13500   return mountEffectImpl(Update, UnmountMutation | MountLayout, imperativeHandleEffect.bind(null, create, ref), effectDeps);
       
 13501 }
       
 13502 
       
 13503 function updateImperativeHandle(ref, create, deps) {
       
 13504   {
       
 13505     !(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;
       
 13506   }
       
 13507 
       
 13508   // TODO: If deps are provided, should we skip comparing the ref itself?
       
 13509   var effectDeps = deps !== null && deps !== undefined ? deps.concat([ref]) : null;
       
 13510 
       
 13511   return updateEffectImpl(Update, UnmountMutation | MountLayout, imperativeHandleEffect.bind(null, create, ref), effectDeps);
       
 13512 }
       
 13513 
       
 13514 function mountDebugValue(value, formatterFn) {
       
 13515   // This hook is normally a no-op.
       
 13516   // The react-debug-hooks package injects its own implementation
       
 13517   // so that e.g. DevTools can display custom hook values.
       
 13518 }
       
 13519 
       
 13520 var updateDebugValue = mountDebugValue;
       
 13521 
       
 13522 function mountCallback(callback, deps) {
       
 13523   var hook = mountWorkInProgressHook();
       
 13524   var nextDeps = deps === undefined ? null : deps;
       
 13525   hook.memoizedState = [callback, nextDeps];
       
 13526   return callback;
       
 13527 }
       
 13528 
       
 13529 function updateCallback(callback, deps) {
       
 13530   var hook = updateWorkInProgressHook();
       
 13531   var nextDeps = deps === undefined ? null : deps;
       
 13532   var prevState = hook.memoizedState;
       
 13533   if (prevState !== null) {
       
 13534     if (nextDeps !== null) {
       
 13535       var prevDeps = prevState[1];
       
 13536       if (areHookInputsEqual(nextDeps, prevDeps)) {
       
 13537         return prevState[0];
       
 13538       }
       
 13539     }
       
 13540   }
       
 13541   hook.memoizedState = [callback, nextDeps];
       
 13542   return callback;
       
 13543 }
       
 13544 
       
 13545 function mountMemo(nextCreate, deps) {
       
 13546   var hook = mountWorkInProgressHook();
       
 13547   var nextDeps = deps === undefined ? null : deps;
       
 13548   var nextValue = nextCreate();
       
 13549   hook.memoizedState = [nextValue, nextDeps];
       
 13550   return nextValue;
       
 13551 }
       
 13552 
       
 13553 function updateMemo(nextCreate, deps) {
       
 13554   var hook = updateWorkInProgressHook();
       
 13555   var nextDeps = deps === undefined ? null : deps;
       
 13556   var prevState = hook.memoizedState;
       
 13557   if (prevState !== null) {
       
 13558     // Assume these are defined. If they're not, areHookInputsEqual will warn.
       
 13559     if (nextDeps !== null) {
       
 13560       var prevDeps = prevState[1];
       
 13561       if (areHookInputsEqual(nextDeps, prevDeps)) {
       
 13562         return prevState[0];
       
 13563       }
       
 13564     }
       
 13565   }
       
 13566   var nextValue = nextCreate();
       
 13567   hook.memoizedState = [nextValue, nextDeps];
       
 13568   return nextValue;
       
 13569 }
       
 13570 
       
 13571 // in a test-like environment, we want to warn if dispatchAction()
       
 13572 // is called outside of a batchedUpdates/TestUtils.act(...) call.
       
 13573 var shouldWarnForUnbatchedSetState = false;
       
 13574 
       
 13575 {
       
 13576   // jest isn't a 'global', it's just exposed to tests via a wrapped function
       
 13577   // further, this isn't a test file, so flow doesn't recognize the symbol. So...
       
 13578   // $FlowExpectedError - because requirements don't give a damn about your type sigs.
       
 13579   if ('undefined' !== typeof jest) {
       
 13580     shouldWarnForUnbatchedSetState = true;
       
 13581   }
       
 13582 }
       
 13583 
       
 13584 function dispatchAction(fiber, queue, action) {
       
 13585   !(numberOfReRenders < RE_RENDER_LIMIT) ? invariant(false, 'Too many re-renders. React limits the number of renders to prevent an infinite loop.') : void 0;
       
 13586 
       
 13587   {
       
 13588     !(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;
       
 13589   }
       
 13590 
       
 13591   var alternate = fiber.alternate;
       
 13592   if (fiber === currentlyRenderingFiber$1 || alternate !== null && alternate === currentlyRenderingFiber$1) {
       
 13593     // This is a render phase update. Stash it in a lazily-created map of
       
 13594     // queue -> linked list of updates. After this render pass, we'll restart
       
 13595     // and apply the stashed updates on top of the work-in-progress hook.
       
 13596     didScheduleRenderPhaseUpdate = true;
       
 13597     var update = {
       
 13598       expirationTime: renderExpirationTime,
       
 13599       action: action,
       
 13600       eagerReducer: null,
       
 13601       eagerState: null,
       
 13602       next: null
       
 13603     };
       
 13604     if (renderPhaseUpdates === null) {
       
 13605       renderPhaseUpdates = new Map();
       
 13606     }
       
 13607     var firstRenderPhaseUpdate = renderPhaseUpdates.get(queue);
       
 13608     if (firstRenderPhaseUpdate === undefined) {
       
 13609       renderPhaseUpdates.set(queue, update);
       
 13610     } else {
       
 13611       // Append the update to the end of the list.
       
 13612       var lastRenderPhaseUpdate = firstRenderPhaseUpdate;
       
 13613       while (lastRenderPhaseUpdate.next !== null) {
       
 13614         lastRenderPhaseUpdate = lastRenderPhaseUpdate.next;
       
 13615       }
       
 13616       lastRenderPhaseUpdate.next = update;
       
 13617     }
       
 13618   } else {
       
 13619     flushPassiveEffects();
       
 13620 
       
 13621     var currentTime = requestCurrentTime();
       
 13622     var _expirationTime = computeExpirationForFiber(currentTime, fiber);
       
 13623 
       
 13624     var _update2 = {
       
 13625       expirationTime: _expirationTime,
       
 13626       action: action,
       
 13627       eagerReducer: null,
       
 13628       eagerState: null,
       
 13629       next: null
       
 13630     };
       
 13631 
       
 13632     // Append the update to the end of the list.
       
 13633     var _last = queue.last;
       
 13634     if (_last === null) {
       
 13635       // This is the first update. Create a circular list.
       
 13636       _update2.next = _update2;
       
 13637     } else {
       
 13638       var first = _last.next;
       
 13639       if (first !== null) {
       
 13640         // Still circular.
       
 13641         _update2.next = first;
       
 13642       }
       
 13643       _last.next = _update2;
       
 13644     }
       
 13645     queue.last = _update2;
       
 13646 
       
 13647     if (fiber.expirationTime === NoWork && (alternate === null || alternate.expirationTime === NoWork)) {
       
 13648       // The queue is currently empty, which means we can eagerly compute the
       
 13649       // next state before entering the render phase. If the new state is the
       
 13650       // same as the current state, we may be able to bail out entirely.
       
 13651       var _eagerReducer = queue.eagerReducer;
       
 13652       if (_eagerReducer !== null) {
       
 13653         var prevDispatcher = void 0;
       
 13654         {
       
 13655           prevDispatcher = ReactCurrentDispatcher$1.current;
       
 13656           ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
       
 13657         }
       
 13658         try {
       
 13659           var currentState = queue.eagerState;
       
 13660           var _eagerState = _eagerReducer(currentState, action);
       
 13661           // Stash the eagerly computed state, and the reducer used to compute
       
 13662           // it, on the update object. If the reducer hasn't changed by the
       
 13663           // time we enter the render phase, then the eager state can be used
       
 13664           // without calling the reducer again.
       
 13665           _update2.eagerReducer = _eagerReducer;
       
 13666           _update2.eagerState = _eagerState;
       
 13667           if (is(_eagerState, currentState)) {
       
 13668             // Fast path. We can bail out without scheduling React to re-render.
       
 13669             // It's still possible that we'll need to rebase this update later,
       
 13670             // if the component re-renders for a different reason and by that
       
 13671             // time the reducer has changed.
       
 13672             return;
       
 13673           }
       
 13674         } catch (error) {
       
 13675           // Suppress the error. It will throw again in the render phase.
       
 13676         } finally {
       
 13677           {
       
 13678             ReactCurrentDispatcher$1.current = prevDispatcher;
       
 13679           }
       
 13680         }
       
 13681       }
       
 13682     }
       
 13683     {
       
 13684       if (shouldWarnForUnbatchedSetState === true) {
       
 13685         warnIfNotCurrentlyBatchingInDev(fiber);
       
 13686       }
       
 13687     }
       
 13688     scheduleWork(fiber, _expirationTime);
       
 13689   }
       
 13690 }
       
 13691 
       
 13692 var ContextOnlyDispatcher = {
       
 13693   readContext: readContext,
       
 13694 
       
 13695   useCallback: throwInvalidHookError,
       
 13696   useContext: throwInvalidHookError,
       
 13697   useEffect: throwInvalidHookError,
       
 13698   useImperativeHandle: throwInvalidHookError,
       
 13699   useLayoutEffect: throwInvalidHookError,
       
 13700   useMemo: throwInvalidHookError,
       
 13701   useReducer: throwInvalidHookError,
       
 13702   useRef: throwInvalidHookError,
       
 13703   useState: throwInvalidHookError,
       
 13704   useDebugValue: throwInvalidHookError
       
 13705 };
       
 13706 
       
 13707 var HooksDispatcherOnMountInDEV = null;
       
 13708 var HooksDispatcherOnMountWithHookTypesInDEV = null;
       
 13709 var HooksDispatcherOnUpdateInDEV = null;
       
 13710 var InvalidNestedHooksDispatcherOnMountInDEV = null;
       
 13711 var InvalidNestedHooksDispatcherOnUpdateInDEV = null;
       
 13712 
       
 13713 {
       
 13714   var warnInvalidContextAccess = function () {
       
 13715     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().');
       
 13716   };
       
 13717 
       
 13718   var warnInvalidHookAccess = function () {
       
 13719     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');
       
 13720   };
       
 13721 
       
 13722   HooksDispatcherOnMountInDEV = {
       
 13723     readContext: function (context, observedBits) {
       
 13724       return readContext(context, observedBits);
       
 13725     },
       
 13726     useCallback: function (callback, deps) {
       
 13727       currentHookNameInDev = 'useCallback';
       
 13728       mountHookTypesDev();
       
 13729       return mountCallback(callback, deps);
       
 13730     },
       
 13731     useContext: function (context, observedBits) {
       
 13732       currentHookNameInDev = 'useContext';
       
 13733       mountHookTypesDev();
       
 13734       return readContext(context, observedBits);
       
 13735     },
       
 13736     useEffect: function (create, deps) {
       
 13737       currentHookNameInDev = 'useEffect';
       
 13738       mountHookTypesDev();
       
 13739       return mountEffect(create, deps);
       
 13740     },
       
 13741     useImperativeHandle: function (ref, create, deps) {
       
 13742       currentHookNameInDev = 'useImperativeHandle';
       
 13743       mountHookTypesDev();
       
 13744       return mountImperativeHandle(ref, create, deps);
       
 13745     },
       
 13746     useLayoutEffect: function (create, deps) {
       
 13747       currentHookNameInDev = 'useLayoutEffect';
       
 13748       mountHookTypesDev();
       
 13749       return mountLayoutEffect(create, deps);
       
 13750     },
       
 13751     useMemo: function (create, deps) {
       
 13752       currentHookNameInDev = 'useMemo';
       
 13753       mountHookTypesDev();
       
 13754       var prevDispatcher = ReactCurrentDispatcher$1.current;
       
 13755       ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
       
 13756       try {
       
 13757         return mountMemo(create, deps);
       
 13758       } finally {
       
 13759         ReactCurrentDispatcher$1.current = prevDispatcher;
       
 13760       }
       
 13761     },
       
 13762     useReducer: function (reducer, initialArg, init) {
       
 13763       currentHookNameInDev = 'useReducer';
       
 13764       mountHookTypesDev();
       
 13765       var prevDispatcher = ReactCurrentDispatcher$1.current;
       
 13766       ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
       
 13767       try {
       
 13768         return mountReducer(reducer, initialArg, init);
       
 13769       } finally {
       
 13770         ReactCurrentDispatcher$1.current = prevDispatcher;
       
 13771       }
       
 13772     },
       
 13773     useRef: function (initialValue) {
       
 13774       currentHookNameInDev = 'useRef';
       
 13775       mountHookTypesDev();
       
 13776       return mountRef(initialValue);
       
 13777     },
       
 13778     useState: function (initialState) {
       
 13779       currentHookNameInDev = 'useState';
       
 13780       mountHookTypesDev();
       
 13781       var prevDispatcher = ReactCurrentDispatcher$1.current;
       
 13782       ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
       
 13783       try {
       
 13784         return mountState(initialState);
       
 13785       } finally {
       
 13786         ReactCurrentDispatcher$1.current = prevDispatcher;
       
 13787       }
       
 13788     },
       
 13789     useDebugValue: function (value, formatterFn) {
       
 13790       currentHookNameInDev = 'useDebugValue';
       
 13791       mountHookTypesDev();
       
 13792       return mountDebugValue(value, formatterFn);
       
 13793     }
       
 13794   };
       
 13795 
       
 13796   HooksDispatcherOnMountWithHookTypesInDEV = {
       
 13797     readContext: function (context, observedBits) {
       
 13798       return readContext(context, observedBits);
       
 13799     },
       
 13800     useCallback: function (callback, deps) {
       
 13801       currentHookNameInDev = 'useCallback';
       
 13802       updateHookTypesDev();
       
 13803       return mountCallback(callback, deps);
       
 13804     },
       
 13805     useContext: function (context, observedBits) {
       
 13806       currentHookNameInDev = 'useContext';
       
 13807       updateHookTypesDev();
       
 13808       return readContext(context, observedBits);
       
 13809     },
       
 13810     useEffect: function (create, deps) {
       
 13811       currentHookNameInDev = 'useEffect';
       
 13812       updateHookTypesDev();
       
 13813       return mountEffect(create, deps);
       
 13814     },
       
 13815     useImperativeHandle: function (ref, create, deps) {
       
 13816       currentHookNameInDev = 'useImperativeHandle';
       
 13817       updateHookTypesDev();
       
 13818       return mountImperativeHandle(ref, create, deps);
       
 13819     },
       
 13820     useLayoutEffect: function (create, deps) {
       
 13821       currentHookNameInDev = 'useLayoutEffect';
       
 13822       updateHookTypesDev();
       
 13823       return mountLayoutEffect(create, deps);
       
 13824     },
       
 13825     useMemo: function (create, deps) {
       
 13826       currentHookNameInDev = 'useMemo';
       
 13827       updateHookTypesDev();
       
 13828       var prevDispatcher = ReactCurrentDispatcher$1.current;
       
 13829       ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
       
 13830       try {
       
 13831         return mountMemo(create, deps);
       
 13832       } finally {
       
 13833         ReactCurrentDispatcher$1.current = prevDispatcher;
       
 13834       }
       
 13835     },
       
 13836     useReducer: function (reducer, initialArg, init) {
       
 13837       currentHookNameInDev = 'useReducer';
       
 13838       updateHookTypesDev();
       
 13839       var prevDispatcher = ReactCurrentDispatcher$1.current;
       
 13840       ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
       
 13841       try {
       
 13842         return mountReducer(reducer, initialArg, init);
       
 13843       } finally {
       
 13844         ReactCurrentDispatcher$1.current = prevDispatcher;
       
 13845       }
       
 13846     },
       
 13847     useRef: function (initialValue) {
       
 13848       currentHookNameInDev = 'useRef';
       
 13849       updateHookTypesDev();
       
 13850       return mountRef(initialValue);
       
 13851     },
       
 13852     useState: function (initialState) {
       
 13853       currentHookNameInDev = 'useState';
       
 13854       updateHookTypesDev();
       
 13855       var prevDispatcher = ReactCurrentDispatcher$1.current;
       
 13856       ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
       
 13857       try {
       
 13858         return mountState(initialState);
       
 13859       } finally {
       
 13860         ReactCurrentDispatcher$1.current = prevDispatcher;
       
 13861       }
       
 13862     },
       
 13863     useDebugValue: function (value, formatterFn) {
       
 13864       currentHookNameInDev = 'useDebugValue';
       
 13865       updateHookTypesDev();
       
 13866       return mountDebugValue(value, formatterFn);
       
 13867     }
       
 13868   };
       
 13869 
       
 13870   HooksDispatcherOnUpdateInDEV = {
       
 13871     readContext: function (context, observedBits) {
       
 13872       return readContext(context, observedBits);
       
 13873     },
       
 13874     useCallback: function (callback, deps) {
       
 13875       currentHookNameInDev = 'useCallback';
       
 13876       updateHookTypesDev();
       
 13877       return updateCallback(callback, deps);
       
 13878     },
       
 13879     useContext: function (context, observedBits) {
       
 13880       currentHookNameInDev = 'useContext';
       
 13881       updateHookTypesDev();
       
 13882       return readContext(context, observedBits);
       
 13883     },
       
 13884     useEffect: function (create, deps) {
       
 13885       currentHookNameInDev = 'useEffect';
       
 13886       updateHookTypesDev();
       
 13887       return updateEffect(create, deps);
       
 13888     },
       
 13889     useImperativeHandle: function (ref, create, deps) {
       
 13890       currentHookNameInDev = 'useImperativeHandle';
       
 13891       updateHookTypesDev();
       
 13892       return updateImperativeHandle(ref, create, deps);
       
 13893     },
       
 13894     useLayoutEffect: function (create, deps) {
       
 13895       currentHookNameInDev = 'useLayoutEffect';
       
 13896       updateHookTypesDev();
       
 13897       return updateLayoutEffect(create, deps);
       
 13898     },
       
 13899     useMemo: function (create, deps) {
       
 13900       currentHookNameInDev = 'useMemo';
       
 13901       updateHookTypesDev();
       
 13902       var prevDispatcher = ReactCurrentDispatcher$1.current;
       
 13903       ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
       
 13904       try {
       
 13905         return updateMemo(create, deps);
       
 13906       } finally {
       
 13907         ReactCurrentDispatcher$1.current = prevDispatcher;
       
 13908       }
       
 13909     },
       
 13910     useReducer: function (reducer, initialArg, init) {
       
 13911       currentHookNameInDev = 'useReducer';
       
 13912       updateHookTypesDev();
       
 13913       var prevDispatcher = ReactCurrentDispatcher$1.current;
       
 13914       ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
       
 13915       try {
       
 13916         return updateReducer(reducer, initialArg, init);
       
 13917       } finally {
       
 13918         ReactCurrentDispatcher$1.current = prevDispatcher;
       
 13919       }
       
 13920     },
       
 13921     useRef: function (initialValue) {
       
 13922       currentHookNameInDev = 'useRef';
       
 13923       updateHookTypesDev();
       
 13924       return updateRef(initialValue);
       
 13925     },
       
 13926     useState: function (initialState) {
       
 13927       currentHookNameInDev = 'useState';
       
 13928       updateHookTypesDev();
       
 13929       var prevDispatcher = ReactCurrentDispatcher$1.current;
       
 13930       ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
       
 13931       try {
       
 13932         return updateState(initialState);
       
 13933       } finally {
       
 13934         ReactCurrentDispatcher$1.current = prevDispatcher;
       
 13935       }
       
 13936     },
       
 13937     useDebugValue: function (value, formatterFn) {
       
 13938       currentHookNameInDev = 'useDebugValue';
       
 13939       updateHookTypesDev();
       
 13940       return updateDebugValue(value, formatterFn);
       
 13941     }
       
 13942   };
       
 13943 
       
 13944   InvalidNestedHooksDispatcherOnMountInDEV = {
       
 13945     readContext: function (context, observedBits) {
       
 13946       warnInvalidContextAccess();
       
 13947       return readContext(context, observedBits);
       
 13948     },
       
 13949     useCallback: function (callback, deps) {
       
 13950       currentHookNameInDev = 'useCallback';
       
 13951       warnInvalidHookAccess();
       
 13952       mountHookTypesDev();
       
 13953       return mountCallback(callback, deps);
       
 13954     },
       
 13955     useContext: function (context, observedBits) {
       
 13956       currentHookNameInDev = 'useContext';
       
 13957       warnInvalidHookAccess();
       
 13958       mountHookTypesDev();
       
 13959       return readContext(context, observedBits);
       
 13960     },
       
 13961     useEffect: function (create, deps) {
       
 13962       currentHookNameInDev = 'useEffect';
       
 13963       warnInvalidHookAccess();
       
 13964       mountHookTypesDev();
       
 13965       return mountEffect(create, deps);
       
 13966     },
       
 13967     useImperativeHandle: function (ref, create, deps) {
       
 13968       currentHookNameInDev = 'useImperativeHandle';
       
 13969       warnInvalidHookAccess();
       
 13970       mountHookTypesDev();
       
 13971       return mountImperativeHandle(ref, create, deps);
       
 13972     },
       
 13973     useLayoutEffect: function (create, deps) {
       
 13974       currentHookNameInDev = 'useLayoutEffect';
       
 13975       warnInvalidHookAccess();
       
 13976       mountHookTypesDev();
       
 13977       return mountLayoutEffect(create, deps);
       
 13978     },
       
 13979     useMemo: function (create, deps) {
       
 13980       currentHookNameInDev = 'useMemo';
       
 13981       warnInvalidHookAccess();
       
 13982       mountHookTypesDev();
       
 13983       var prevDispatcher = ReactCurrentDispatcher$1.current;
       
 13984       ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
       
 13985       try {
       
 13986         return mountMemo(create, deps);
       
 13987       } finally {
       
 13988         ReactCurrentDispatcher$1.current = prevDispatcher;
       
 13989       }
       
 13990     },
       
 13991     useReducer: function (reducer, initialArg, init) {
       
 13992       currentHookNameInDev = 'useReducer';
       
 13993       warnInvalidHookAccess();
       
 13994       mountHookTypesDev();
       
 13995       var prevDispatcher = ReactCurrentDispatcher$1.current;
       
 13996       ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
       
 13997       try {
       
 13998         return mountReducer(reducer, initialArg, init);
       
 13999       } finally {
       
 14000         ReactCurrentDispatcher$1.current = prevDispatcher;
       
 14001       }
       
 14002     },
       
 14003     useRef: function (initialValue) {
       
 14004       currentHookNameInDev = 'useRef';
       
 14005       warnInvalidHookAccess();
       
 14006       mountHookTypesDev();
       
 14007       return mountRef(initialValue);
       
 14008     },
       
 14009     useState: function (initialState) {
       
 14010       currentHookNameInDev = 'useState';
       
 14011       warnInvalidHookAccess();
       
 14012       mountHookTypesDev();
       
 14013       var prevDispatcher = ReactCurrentDispatcher$1.current;
       
 14014       ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
       
 14015       try {
       
 14016         return mountState(initialState);
       
 14017       } finally {
       
 14018         ReactCurrentDispatcher$1.current = prevDispatcher;
       
 14019       }
       
 14020     },
       
 14021     useDebugValue: function (value, formatterFn) {
       
 14022       currentHookNameInDev = 'useDebugValue';
       
 14023       warnInvalidHookAccess();
       
 14024       mountHookTypesDev();
       
 14025       return mountDebugValue(value, formatterFn);
       
 14026     }
       
 14027   };
       
 14028 
       
 14029   InvalidNestedHooksDispatcherOnUpdateInDEV = {
       
 14030     readContext: function (context, observedBits) {
       
 14031       warnInvalidContextAccess();
       
 14032       return readContext(context, observedBits);
       
 14033     },
       
 14034     useCallback: function (callback, deps) {
       
 14035       currentHookNameInDev = 'useCallback';
       
 14036       warnInvalidHookAccess();
       
 14037       updateHookTypesDev();
       
 14038       return updateCallback(callback, deps);
       
 14039     },
       
 14040     useContext: function (context, observedBits) {
       
 14041       currentHookNameInDev = 'useContext';
       
 14042       warnInvalidHookAccess();
       
 14043       updateHookTypesDev();
       
 14044       return readContext(context, observedBits);
       
 14045     },
       
 14046     useEffect: function (create, deps) {
       
 14047       currentHookNameInDev = 'useEffect';
       
 14048       warnInvalidHookAccess();
       
 14049       updateHookTypesDev();
       
 14050       return updateEffect(create, deps);
       
 14051     },
       
 14052     useImperativeHandle: function (ref, create, deps) {
       
 14053       currentHookNameInDev = 'useImperativeHandle';
       
 14054       warnInvalidHookAccess();
       
 14055       updateHookTypesDev();
       
 14056       return updateImperativeHandle(ref, create, deps);
       
 14057     },
       
 14058     useLayoutEffect: function (create, deps) {
       
 14059       currentHookNameInDev = 'useLayoutEffect';
       
 14060       warnInvalidHookAccess();
       
 14061       updateHookTypesDev();
       
 14062       return updateLayoutEffect(create, deps);
       
 14063     },
       
 14064     useMemo: function (create, deps) {
       
 14065       currentHookNameInDev = 'useMemo';
       
 14066       warnInvalidHookAccess();
       
 14067       updateHookTypesDev();
       
 14068       var prevDispatcher = ReactCurrentDispatcher$1.current;
       
 14069       ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
       
 14070       try {
       
 14071         return updateMemo(create, deps);
       
 14072       } finally {
       
 14073         ReactCurrentDispatcher$1.current = prevDispatcher;
       
 14074       }
       
 14075     },
       
 14076     useReducer: function (reducer, initialArg, init) {
       
 14077       currentHookNameInDev = 'useReducer';
       
 14078       warnInvalidHookAccess();
       
 14079       updateHookTypesDev();
       
 14080       var prevDispatcher = ReactCurrentDispatcher$1.current;
       
 14081       ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
       
 14082       try {
       
 14083         return updateReducer(reducer, initialArg, init);
       
 14084       } finally {
       
 14085         ReactCurrentDispatcher$1.current = prevDispatcher;
       
 14086       }
       
 14087     },
       
 14088     useRef: function (initialValue) {
       
 14089       currentHookNameInDev = 'useRef';
       
 14090       warnInvalidHookAccess();
       
 14091       updateHookTypesDev();
       
 14092       return updateRef(initialValue);
       
 14093     },
       
 14094     useState: function (initialState) {
       
 14095       currentHookNameInDev = 'useState';
       
 14096       warnInvalidHookAccess();
       
 14097       updateHookTypesDev();
       
 14098       var prevDispatcher = ReactCurrentDispatcher$1.current;
       
 14099       ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
       
 14100       try {
       
 14101         return updateState(initialState);
       
 14102       } finally {
       
 14103         ReactCurrentDispatcher$1.current = prevDispatcher;
       
 14104       }
       
 14105     },
       
 14106     useDebugValue: function (value, formatterFn) {
       
 14107       currentHookNameInDev = 'useDebugValue';
       
 14108       warnInvalidHookAccess();
       
 14109       updateHookTypesDev();
       
 14110       return updateDebugValue(value, formatterFn);
       
 14111     }
       
 14112   };
       
 14113 }
       
 14114 
       
 14115 var commitTime = 0;
       
 14116 var profilerStartTime = -1;
       
 14117 
       
 14118 function getCommitTime() {
       
 14119   return commitTime;
       
 14120 }
       
 14121 
       
 14122 function recordCommitTime() {
       
 14123   if (!enableProfilerTimer) {
       
 14124     return;
       
 14125   }
       
 14126   commitTime = unstable_now();
       
 14127 }
       
 14128 
       
 14129 function startProfilerTimer(fiber) {
       
 14130   if (!enableProfilerTimer) {
       
 14131     return;
       
 14132   }
       
 14133 
       
 14134   profilerStartTime = unstable_now();
       
 14135 
       
 14136   if (fiber.actualStartTime < 0) {
       
 14137     fiber.actualStartTime = unstable_now();
       
 14138   }
       
 14139 }
       
 14140 
       
 14141 function stopProfilerTimerIfRunning(fiber) {
       
 14142   if (!enableProfilerTimer) {
       
 14143     return;
       
 14144   }
       
 14145   profilerStartTime = -1;
       
 14146 }
       
 14147 
       
 14148 function stopProfilerTimerIfRunningAndRecordDelta(fiber, overrideBaseTime) {
       
 14149   if (!enableProfilerTimer) {
       
 14150     return;
       
 14151   }
       
 14152 
       
 14153   if (profilerStartTime >= 0) {
       
 14154     var elapsedTime = unstable_now() - profilerStartTime;
       
 14155     fiber.actualDuration += elapsedTime;
       
 14156     if (overrideBaseTime) {
       
 14157       fiber.selfBaseDuration = elapsedTime;
       
 14158     }
       
 14159     profilerStartTime = -1;
       
 14160   }
       
 14161 }
       
 14162 
       
 14163 // The deepest Fiber on the stack involved in a hydration context.
       
 14164 // This may have been an insertion or a hydration.
       
 14165 var hydrationParentFiber = null;
       
 14166 var nextHydratableInstance = null;
       
 14167 var isHydrating = false;
       
 14168 
       
 14169 function enterHydrationState(fiber) {
       
 14170   if (!supportsHydration) {
       
 14171     return false;
       
 14172   }
       
 14173 
       
 14174   var parentInstance = fiber.stateNode.containerInfo;
       
 14175   nextHydratableInstance = getFirstHydratableChild(parentInstance);
       
 14176   hydrationParentFiber = fiber;
       
 14177   isHydrating = true;
       
 14178   return true;
       
 14179 }
       
 14180 
       
 14181 function reenterHydrationStateFromDehydratedSuspenseInstance(fiber) {
       
 14182   if (!supportsHydration) {
       
 14183     return false;
       
 14184   }
       
 14185 
       
 14186   var suspenseInstance = fiber.stateNode;
       
 14187   nextHydratableInstance = getNextHydratableSibling(suspenseInstance);
       
 14188   popToNextHostParent(fiber);
       
 14189   isHydrating = true;
       
 14190   return true;
       
 14191 }
       
 14192 
       
 14193 function deleteHydratableInstance(returnFiber, instance) {
       
 14194   {
       
 14195     switch (returnFiber.tag) {
       
 14196       case HostRoot:
       
 14197         didNotHydrateContainerInstance(returnFiber.stateNode.containerInfo, instance);
       
 14198         break;
       
 14199       case HostComponent:
       
 14200         didNotHydrateInstance(returnFiber.type, returnFiber.memoizedProps, returnFiber.stateNode, instance);
       
 14201         break;
       
 14202     }
       
 14203   }
       
 14204 
       
 14205   var childToDelete = createFiberFromHostInstanceForDeletion();
       
 14206   childToDelete.stateNode = instance;
       
 14207   childToDelete.return = returnFiber;
       
 14208   childToDelete.effectTag = Deletion;
       
 14209 
       
 14210   // This might seem like it belongs on progressedFirstDeletion. However,
       
 14211   // these children are not part of the reconciliation list of children.
       
 14212   // Even if we abort and rereconcile the children, that will try to hydrate
       
 14213   // again and the nodes are still in the host tree so these will be
       
 14214   // recreated.
       
 14215   if (returnFiber.lastEffect !== null) {
       
 14216     returnFiber.lastEffect.nextEffect = childToDelete;
       
 14217     returnFiber.lastEffect = childToDelete;
       
 14218   } else {
       
 14219     returnFiber.firstEffect = returnFiber.lastEffect = childToDelete;
       
 14220   }
       
 14221 }
       
 14222 
       
 14223 function insertNonHydratedInstance(returnFiber, fiber) {
       
 14224   fiber.effectTag |= Placement;
       
 14225   {
       
 14226     switch (returnFiber.tag) {
       
 14227       case HostRoot:
       
 14228         {
       
 14229           var parentContainer = returnFiber.stateNode.containerInfo;
       
 14230           switch (fiber.tag) {
       
 14231             case HostComponent:
       
 14232               var type = fiber.type;
       
 14233               var props = fiber.pendingProps;
       
 14234               didNotFindHydratableContainerInstance(parentContainer, type, props);
       
 14235               break;
       
 14236             case HostText:
       
 14237               var text = fiber.pendingProps;
       
 14238               didNotFindHydratableContainerTextInstance(parentContainer, text);
       
 14239               break;
       
 14240             case SuspenseComponent:
       
 14241               
       
 14242               break;
       
 14243           }
       
 14244           break;
       
 14245         }
       
 14246       case HostComponent:
       
 14247         {
       
 14248           var parentType = returnFiber.type;
       
 14249           var parentProps = returnFiber.memoizedProps;
       
 14250           var parentInstance = returnFiber.stateNode;
       
 14251           switch (fiber.tag) {
       
 14252             case HostComponent:
       
 14253               var _type = fiber.type;
       
 14254               var _props = fiber.pendingProps;
       
 14255               didNotFindHydratableInstance(parentType, parentProps, parentInstance, _type, _props);
       
 14256               break;
       
 14257             case HostText:
       
 14258               var _text = fiber.pendingProps;
       
 14259               didNotFindHydratableTextInstance(parentType, parentProps, parentInstance, _text);
       
 14260               break;
       
 14261             case SuspenseComponent:
       
 14262               didNotFindHydratableSuspenseInstance(parentType, parentProps, parentInstance);
       
 14263               break;
       
 14264           }
       
 14265           break;
       
 14266         }
       
 14267       default:
       
 14268         return;
       
 14269     }
       
 14270   }
       
 14271 }
       
 14272 
       
 14273 function tryHydrate(fiber, nextInstance) {
       
 14274   switch (fiber.tag) {
       
 14275     case HostComponent:
       
 14276       {
       
 14277         var type = fiber.type;
       
 14278         var props = fiber.pendingProps;
       
 14279         var instance = canHydrateInstance(nextInstance, type, props);
       
 14280         if (instance !== null) {
       
 14281           fiber.stateNode = instance;
       
 14282           return true;
       
 14283         }
       
 14284         return false;
       
 14285       }
       
 14286     case HostText:
       
 14287       {
       
 14288         var text = fiber.pendingProps;
       
 14289         var textInstance = canHydrateTextInstance(nextInstance, text);
       
 14290         if (textInstance !== null) {
       
 14291           fiber.stateNode = textInstance;
       
 14292           return true;
       
 14293         }
       
 14294         return false;
       
 14295       }
       
 14296     case SuspenseComponent:
       
 14297       {
       
 14298         if (enableSuspenseServerRenderer) {
       
 14299           var suspenseInstance = canHydrateSuspenseInstance(nextInstance);
       
 14300           if (suspenseInstance !== null) {
       
 14301             // Downgrade the tag to a dehydrated component until we've hydrated it.
       
 14302             fiber.tag = DehydratedSuspenseComponent;
       
 14303             fiber.stateNode = suspenseInstance;
       
 14304             return true;
       
 14305           }
       
 14306         }
       
 14307         return false;
       
 14308       }
       
 14309     default:
       
 14310       return false;
       
 14311   }
       
 14312 }
       
 14313 
       
 14314 function tryToClaimNextHydratableInstance(fiber) {
       
 14315   if (!isHydrating) {
       
 14316     return;
       
 14317   }
       
 14318   var nextInstance = nextHydratableInstance;
       
 14319   if (!nextInstance) {
       
 14320     // Nothing to hydrate. Make it an insertion.
       
 14321     insertNonHydratedInstance(hydrationParentFiber, fiber);
       
 14322     isHydrating = false;
       
 14323     hydrationParentFiber = fiber;
       
 14324     return;
       
 14325   }
       
 14326   var firstAttemptedInstance = nextInstance;
       
 14327   if (!tryHydrate(fiber, nextInstance)) {
       
 14328     // If we can't hydrate this instance let's try the next one.
       
 14329     // We use this as a heuristic. It's based on intuition and not data so it
       
 14330     // might be flawed or unnecessary.
       
 14331     nextInstance = getNextHydratableSibling(firstAttemptedInstance);
       
 14332     if (!nextInstance || !tryHydrate(fiber, nextInstance)) {
       
 14333       // Nothing to hydrate. Make it an insertion.
       
 14334       insertNonHydratedInstance(hydrationParentFiber, fiber);
       
 14335       isHydrating = false;
       
 14336       hydrationParentFiber = fiber;
       
 14337       return;
       
 14338     }
       
 14339     // We matched the next one, we'll now assume that the first one was
       
 14340     // superfluous and we'll delete it. Since we can't eagerly delete it
       
 14341     // we'll have to schedule a deletion. To do that, this node needs a dummy
       
 14342     // fiber associated with it.
       
 14343     deleteHydratableInstance(hydrationParentFiber, firstAttemptedInstance);
       
 14344   }
       
 14345   hydrationParentFiber = fiber;
       
 14346   nextHydratableInstance = getFirstHydratableChild(nextInstance);
       
 14347 }
       
 14348 
       
 14349 function prepareToHydrateHostInstance(fiber, rootContainerInstance, hostContext) {
       
 14350   if (!supportsHydration) {
       
 14351     invariant(false, 'Expected prepareToHydrateHostInstance() to never be called. This error is likely caused by a bug in React. Please file an issue.');
       
 14352   }
       
 14353 
       
 14354   var instance = fiber.stateNode;
       
 14355   var updatePayload = hydrateInstance(instance, fiber.type, fiber.memoizedProps, rootContainerInstance, hostContext, fiber);
       
 14356   // TODO: Type this specific to this type of component.
       
 14357   fiber.updateQueue = updatePayload;
       
 14358   // If the update payload indicates that there is a change or if there
       
 14359   // is a new ref we mark this as an update.
       
 14360   if (updatePayload !== null) {
       
 14361     return true;
       
 14362   }
       
 14363   return false;
       
 14364 }
       
 14365 
       
 14366 function prepareToHydrateHostTextInstance(fiber) {
       
 14367   if (!supportsHydration) {
       
 14368     invariant(false, 'Expected prepareToHydrateHostTextInstance() to never be called. This error is likely caused by a bug in React. Please file an issue.');
       
 14369   }
       
 14370 
       
 14371   var textInstance = fiber.stateNode;
       
 14372   var textContent = fiber.memoizedProps;
       
 14373   var shouldUpdate = hydrateTextInstance(textInstance, textContent, fiber);
       
 14374   {
       
 14375     if (shouldUpdate) {
       
 14376       // We assume that prepareToHydrateHostTextInstance is called in a context where the
       
 14377       // hydration parent is the parent host component of this host text.
       
 14378       var returnFiber = hydrationParentFiber;
       
 14379       if (returnFiber !== null) {
       
 14380         switch (returnFiber.tag) {
       
 14381           case HostRoot:
       
 14382             {
       
 14383               var parentContainer = returnFiber.stateNode.containerInfo;
       
 14384               didNotMatchHydratedContainerTextInstance(parentContainer, textInstance, textContent);
       
 14385               break;
       
 14386             }
       
 14387           case HostComponent:
       
 14388             {
       
 14389               var parentType = returnFiber.type;
       
 14390               var parentProps = returnFiber.memoizedProps;
       
 14391               var parentInstance = returnFiber.stateNode;
       
 14392               didNotMatchHydratedTextInstance(parentType, parentProps, parentInstance, textInstance, textContent);
       
 14393               break;
       
 14394             }
       
 14395         }
       
 14396       }
       
 14397     }
       
 14398   }
       
 14399   return shouldUpdate;
       
 14400 }
       
 14401 
       
 14402 function skipPastDehydratedSuspenseInstance(fiber) {
       
 14403   if (!supportsHydration) {
       
 14404     invariant(false, 'Expected skipPastDehydratedSuspenseInstance() to never be called. This error is likely caused by a bug in React. Please file an issue.');
       
 14405   }
       
 14406   var suspenseInstance = fiber.stateNode;
       
 14407   !suspenseInstance ? invariant(false, 'Expected to have a hydrated suspense instance. This error is likely caused by a bug in React. Please file an issue.') : void 0;
       
 14408   nextHydratableInstance = getNextHydratableInstanceAfterSuspenseInstance(suspenseInstance);
       
 14409 }
       
 14410 
       
 14411 function popToNextHostParent(fiber) {
       
 14412   var parent = fiber.return;
       
 14413   while (parent !== null && parent.tag !== HostComponent && parent.tag !== HostRoot && parent.tag !== DehydratedSuspenseComponent) {
       
 14414     parent = parent.return;
       
 14415   }
       
 14416   hydrationParentFiber = parent;
       
 14417 }
       
 14418 
       
 14419 function popHydrationState(fiber) {
       
 14420   if (!supportsHydration) {
       
 14421     return false;
       
 14422   }
       
 14423   if (fiber !== hydrationParentFiber) {
       
 14424     // We're deeper than the current hydration context, inside an inserted
       
 14425     // tree.
       
 14426     return false;
       
 14427   }
       
 14428   if (!isHydrating) {
       
 14429     // If we're not currently hydrating but we're in a hydration context, then
       
 14430     // we were an insertion and now need to pop up reenter hydration of our
       
 14431     // siblings.
       
 14432     popToNextHostParent(fiber);
       
 14433     isHydrating = true;
       
 14434     return false;
       
 14435   }
       
 14436 
       
 14437   var type = fiber.type;
       
 14438 
       
 14439   // If we have any remaining hydratable nodes, we need to delete them now.
       
 14440   // We only do this deeper than head and body since they tend to have random
       
 14441   // other nodes in them. We also ignore components with pure text content in
       
 14442   // side of them.
       
 14443   // TODO: Better heuristic.
       
 14444   if (fiber.tag !== HostComponent || type !== 'head' && type !== 'body' && !shouldSetTextContent(type, fiber.memoizedProps)) {
       
 14445     var nextInstance = nextHydratableInstance;
       
 14446     while (nextInstance) {
       
 14447       deleteHydratableInstance(fiber, nextInstance);
       
 14448       nextInstance = getNextHydratableSibling(nextInstance);
       
 14449     }
       
 14450   }
       
 14451 
       
 14452   popToNextHostParent(fiber);
       
 14453   nextHydratableInstance = hydrationParentFiber ? getNextHydratableSibling(fiber.stateNode) : null;
       
 14454   return true;
       
 14455 }
       
 14456 
       
 14457 function resetHydrationState() {
       
 14458   if (!supportsHydration) {
       
 14459     return;
       
 14460   }
       
 14461 
       
 14462   hydrationParentFiber = null;
       
 14463   nextHydratableInstance = null;
       
 14464   isHydrating = false;
       
 14465 }
       
 14466 
       
 14467 var ReactCurrentOwner$3 = ReactSharedInternals.ReactCurrentOwner;
       
 14468 
       
 14469 var didReceiveUpdate = false;
       
 14470 
       
 14471 var didWarnAboutBadClass = void 0;
       
 14472 var didWarnAboutContextTypeOnFunctionComponent = void 0;
       
 14473 var didWarnAboutGetDerivedStateOnFunctionComponent = void 0;
       
 14474 var didWarnAboutFunctionRefs = void 0;
       
 14475 var didWarnAboutReassigningProps = void 0;
       
 14476 
       
 14477 {
       
 14478   didWarnAboutBadClass = {};
       
 14479   didWarnAboutContextTypeOnFunctionComponent = {};
       
 14480   didWarnAboutGetDerivedStateOnFunctionComponent = {};
       
 14481   didWarnAboutFunctionRefs = {};
       
 14482   didWarnAboutReassigningProps = false;
       
 14483 }
       
 14484 
       
 14485 function reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime) {
       
 14486   if (current$$1 === null) {
       
 14487     // If this is a fresh new component that hasn't been rendered yet, we
       
 14488     // won't update its child set by applying minimal side-effects. Instead,
       
 14489     // we will add them all to the child before it gets rendered. That means
       
 14490     // we can optimize this reconciliation pass by not tracking side-effects.
       
 14491     workInProgress.child = mountChildFibers(workInProgress, null, nextChildren, renderExpirationTime);
       
 14492   } else {
       
 14493     // If the current child is the same as the work in progress, it means that
       
 14494     // we haven't yet started any work on these children. Therefore, we use
       
 14495     // the clone algorithm to create a copy of all the current children.
       
 14496 
       
 14497     // If we had any progressed work already, that is invalid at this point so
       
 14498     // let's throw it out.
       
 14499     workInProgress.child = reconcileChildFibers(workInProgress, current$$1.child, nextChildren, renderExpirationTime);
       
 14500   }
       
 14501 }
       
 14502 
       
 14503 function forceUnmountCurrentAndReconcile(current$$1, workInProgress, nextChildren, renderExpirationTime) {
       
 14504   // This function is fork of reconcileChildren. It's used in cases where we
       
 14505   // want to reconcile without matching against the existing set. This has the
       
 14506   // effect of all current children being unmounted; even if the type and key
       
 14507   // are the same, the old child is unmounted and a new child is created.
       
 14508   //
       
 14509   // To do this, we're going to go through the reconcile algorithm twice. In
       
 14510   // the first pass, we schedule a deletion for all the current children by
       
 14511   // passing null.
       
 14512   workInProgress.child = reconcileChildFibers(workInProgress, current$$1.child, null, renderExpirationTime);
       
 14513   // In the second pass, we mount the new children. The trick here is that we
       
 14514   // pass null in place of where we usually pass the current child set. This has
       
 14515   // the effect of remounting all children regardless of whether their their
       
 14516   // identity matches.
       
 14517   workInProgress.child = reconcileChildFibers(workInProgress, null, nextChildren, renderExpirationTime);
       
 14518 }
       
 14519 
       
 14520 function updateForwardRef(current$$1, workInProgress, Component, nextProps, renderExpirationTime) {
       
 14521   // TODO: current can be non-null here even if the component
       
 14522   // hasn't yet mounted. This happens after the first render suspends.
       
 14523   // We'll need to figure out if this is fine or can cause issues.
       
 14524 
       
 14525   {
       
 14526     if (workInProgress.type !== workInProgress.elementType) {
       
 14527       // Lazy component props can't be validated in createElement
       
 14528       // because they're only guaranteed to be resolved here.
       
 14529       var innerPropTypes = Component.propTypes;
       
 14530       if (innerPropTypes) {
       
 14531         checkPropTypes_1(innerPropTypes, nextProps, // Resolved props
       
 14532         'prop', getComponentName(Component), getCurrentFiberStackInDev);
       
 14533       }
       
 14534     }
       
 14535   }
       
 14536 
       
 14537   var render = Component.render;
       
 14538   var ref = workInProgress.ref;
       
 14539 
       
 14540   // The rest is a fork of updateFunctionComponent
       
 14541   var nextChildren = void 0;
       
 14542   prepareToReadContext(workInProgress, renderExpirationTime);
       
 14543   {
       
 14544     ReactCurrentOwner$3.current = workInProgress;
       
 14545     setCurrentPhase('render');
       
 14546     nextChildren = renderWithHooks(current$$1, workInProgress, render, nextProps, ref, renderExpirationTime);
       
 14547     if (debugRenderPhaseSideEffects || debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
       
 14548       // Only double-render components with Hooks
       
 14549       if (workInProgress.memoizedState !== null) {
       
 14550         nextChildren = renderWithHooks(current$$1, workInProgress, render, nextProps, ref, renderExpirationTime);
       
 14551       }
       
 14552     }
       
 14553     setCurrentPhase(null);
       
 14554   }
       
 14555 
       
 14556   if (current$$1 !== null && !didReceiveUpdate) {
       
 14557     bailoutHooks(current$$1, workInProgress, renderExpirationTime);
       
 14558     return bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirationTime);
       
 14559   }
       
 14560 
       
 14561   // React DevTools reads this flag.
       
 14562   workInProgress.effectTag |= PerformedWork;
       
 14563   reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
       
 14564   return workInProgress.child;
       
 14565 }
       
 14566 
       
 14567 function updateMemoComponent(current$$1, workInProgress, Component, nextProps, updateExpirationTime, renderExpirationTime) {
       
 14568   if (current$$1 === null) {
       
 14569     var type = Component.type;
       
 14570     if (isSimpleFunctionComponent(type) && Component.compare === null &&
       
 14571     // SimpleMemoComponent codepath doesn't resolve outer props either.
       
 14572     Component.defaultProps === undefined) {
       
 14573       // If this is a plain function component without default props,
       
 14574       // and with only the default shallow comparison, we upgrade it
       
 14575       // to a SimpleMemoComponent to allow fast path updates.
       
 14576       workInProgress.tag = SimpleMemoComponent;
       
 14577       workInProgress.type = type;
       
 14578       {
       
 14579         validateFunctionComponentInDev(workInProgress, type);
       
 14580       }
       
 14581       return updateSimpleMemoComponent(current$$1, workInProgress, type, nextProps, updateExpirationTime, renderExpirationTime);
       
 14582     }
       
 14583     {
       
 14584       var innerPropTypes = type.propTypes;
       
 14585       if (innerPropTypes) {
       
 14586         // Inner memo component props aren't currently validated in createElement.
       
 14587         // We could move it there, but we'd still need this for lazy code path.
       
 14588         checkPropTypes_1(innerPropTypes, nextProps, // Resolved props
       
 14589         'prop', getComponentName(type), getCurrentFiberStackInDev);
       
 14590       }
       
 14591     }
       
 14592     var child = createFiberFromTypeAndProps(Component.type, null, nextProps, null, workInProgress.mode, renderExpirationTime);
       
 14593     child.ref = workInProgress.ref;
       
 14594     child.return = workInProgress;
       
 14595     workInProgress.child = child;
       
 14596     return child;
       
 14597   }
       
 14598   {
       
 14599     var _type = Component.type;
       
 14600     var _innerPropTypes = _type.propTypes;
       
 14601     if (_innerPropTypes) {
       
 14602       // Inner memo component props aren't currently validated in createElement.
       
 14603       // We could move it there, but we'd still need this for lazy code path.
       
 14604       checkPropTypes_1(_innerPropTypes, nextProps, // Resolved props
       
 14605       'prop', getComponentName(_type), getCurrentFiberStackInDev);
       
 14606     }
       
 14607   }
       
 14608   var currentChild = current$$1.child; // This is always exactly one child
       
 14609   if (updateExpirationTime < renderExpirationTime) {
       
 14610     // This will be the props with resolved defaultProps,
       
 14611     // unlike current.memoizedProps which will be the unresolved ones.
       
 14612     var prevProps = currentChild.memoizedProps;
       
 14613     // Default to shallow comparison
       
 14614     var compare = Component.compare;
       
 14615     compare = compare !== null ? compare : shallowEqual;
       
 14616     if (compare(prevProps, nextProps) && current$$1.ref === workInProgress.ref) {
       
 14617       return bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirationTime);
       
 14618     }
       
 14619   }
       
 14620   // React DevTools reads this flag.
       
 14621   workInProgress.effectTag |= PerformedWork;
       
 14622   var newChild = createWorkInProgress(currentChild, nextProps, renderExpirationTime);
       
 14623   newChild.ref = workInProgress.ref;
       
 14624   newChild.return = workInProgress;
       
 14625   workInProgress.child = newChild;
       
 14626   return newChild;
       
 14627 }
       
 14628 
       
 14629 function updateSimpleMemoComponent(current$$1, workInProgress, Component, nextProps, updateExpirationTime, renderExpirationTime) {
       
 14630   // TODO: current can be non-null here even if the component
       
 14631   // hasn't yet mounted. This happens when the inner render suspends.
       
 14632   // We'll need to figure out if this is fine or can cause issues.
       
 14633 
       
 14634   {
       
 14635     if (workInProgress.type !== workInProgress.elementType) {
       
 14636       // Lazy component props can't be validated in createElement
       
 14637       // because they're only guaranteed to be resolved here.
       
 14638       var outerMemoType = workInProgress.elementType;
       
 14639       if (outerMemoType.$$typeof === REACT_LAZY_TYPE) {
       
 14640         // We warn when you define propTypes on lazy()
       
 14641         // so let's just skip over it to find memo() outer wrapper.
       
 14642         // Inner props for memo are validated later.
       
 14643         outerMemoType = refineResolvedLazyComponent(outerMemoType);
       
 14644       }
       
 14645       var outerPropTypes = outerMemoType && outerMemoType.propTypes;
       
 14646       if (outerPropTypes) {
       
 14647         checkPropTypes_1(outerPropTypes, nextProps, // Resolved (SimpleMemoComponent has no defaultProps)
       
 14648         'prop', getComponentName(outerMemoType), getCurrentFiberStackInDev);
       
 14649       }
       
 14650       // Inner propTypes will be validated in the function component path.
       
 14651     }
       
 14652   }
       
 14653   if (current$$1 !== null) {
       
 14654     var prevProps = current$$1.memoizedProps;
       
 14655     if (shallowEqual(prevProps, nextProps) && current$$1.ref === workInProgress.ref) {
       
 14656       didReceiveUpdate = false;
       
 14657       if (updateExpirationTime < renderExpirationTime) {
       
 14658         return bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirationTime);
       
 14659       }
       
 14660     }
       
 14661   }
       
 14662   return updateFunctionComponent(current$$1, workInProgress, Component, nextProps, renderExpirationTime);
       
 14663 }
       
 14664 
       
 14665 function updateFragment(current$$1, workInProgress, renderExpirationTime) {
       
 14666   var nextChildren = workInProgress.pendingProps;
       
 14667   reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
       
 14668   return workInProgress.child;
       
 14669 }
       
 14670 
       
 14671 function updateMode(current$$1, workInProgress, renderExpirationTime) {
       
 14672   var nextChildren = workInProgress.pendingProps.children;
       
 14673   reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
       
 14674   return workInProgress.child;
       
 14675 }
       
 14676 
       
 14677 function updateProfiler(current$$1, workInProgress, renderExpirationTime) {
       
 14678   if (enableProfilerTimer) {
       
 14679     workInProgress.effectTag |= Update;
       
 14680   }
       
 14681   var nextProps = workInProgress.pendingProps;
       
 14682   var nextChildren = nextProps.children;
       
 14683   reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
       
 14684   return workInProgress.child;
       
 14685 }
       
 14686 
       
 14687 function markRef(current$$1, workInProgress) {
       
 14688   var ref = workInProgress.ref;
       
 14689   if (current$$1 === null && ref !== null || current$$1 !== null && current$$1.ref !== ref) {
       
 14690     // Schedule a Ref effect
       
 14691     workInProgress.effectTag |= Ref;
       
 14692   }
       
 14693 }
       
 14694 
       
 14695 function updateFunctionComponent(current$$1, workInProgress, Component, nextProps, renderExpirationTime) {
       
 14696   {
       
 14697     if (workInProgress.type !== workInProgress.elementType) {
       
 14698       // Lazy component props can't be validated in createElement
       
 14699       // because they're only guaranteed to be resolved here.
       
 14700       var innerPropTypes = Component.propTypes;
       
 14701       if (innerPropTypes) {
       
 14702         checkPropTypes_1(innerPropTypes, nextProps, // Resolved props
       
 14703         'prop', getComponentName(Component), getCurrentFiberStackInDev);
       
 14704       }
       
 14705     }
       
 14706   }
       
 14707 
       
 14708   var unmaskedContext = getUnmaskedContext(workInProgress, Component, true);
       
 14709   var context = getMaskedContext(workInProgress, unmaskedContext);
       
 14710 
       
 14711   var nextChildren = void 0;
       
 14712   prepareToReadContext(workInProgress, renderExpirationTime);
       
 14713   {
       
 14714     ReactCurrentOwner$3.current = workInProgress;
       
 14715     setCurrentPhase('render');
       
 14716     nextChildren = renderWithHooks(current$$1, workInProgress, Component, nextProps, context, renderExpirationTime);
       
 14717     if (debugRenderPhaseSideEffects || debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
       
 14718       // Only double-render components with Hooks
       
 14719       if (workInProgress.memoizedState !== null) {
       
 14720         nextChildren = renderWithHooks(current$$1, workInProgress, Component, nextProps, context, renderExpirationTime);
       
 14721       }
       
 14722     }
       
 14723     setCurrentPhase(null);
       
 14724   }
       
 14725 
       
 14726   if (current$$1 !== null && !didReceiveUpdate) {
       
 14727     bailoutHooks(current$$1, workInProgress, renderExpirationTime);
       
 14728     return bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirationTime);
       
 14729   }
       
 14730 
       
 14731   // React DevTools reads this flag.
       
 14732   workInProgress.effectTag |= PerformedWork;
       
 14733   reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
       
 14734   return workInProgress.child;
       
 14735 }
       
 14736 
       
 14737 function updateClassComponent(current$$1, workInProgress, Component, nextProps, renderExpirationTime) {
       
 14738   {
       
 14739     if (workInProgress.type !== workInProgress.elementType) {
       
 14740       // Lazy component props can't be validated in createElement
       
 14741       // because they're only guaranteed to be resolved here.
       
 14742       var innerPropTypes = Component.propTypes;
       
 14743       if (innerPropTypes) {
       
 14744         checkPropTypes_1(innerPropTypes, nextProps, // Resolved props
       
 14745         'prop', getComponentName(Component), getCurrentFiberStackInDev);
       
 14746       }
       
 14747     }
       
 14748   }
       
 14749 
       
 14750   // Push context providers early to prevent context stack mismatches.
       
 14751   // During mounting we don't know the child context yet as the instance doesn't exist.
       
 14752   // We will invalidate the child context in finishClassComponent() right after rendering.
       
 14753   var hasContext = void 0;
       
 14754   if (isContextProvider(Component)) {
       
 14755     hasContext = true;
       
 14756     pushContextProvider(workInProgress);
       
 14757   } else {
       
 14758     hasContext = false;
       
 14759   }
       
 14760   prepareToReadContext(workInProgress, renderExpirationTime);
       
 14761 
       
 14762   var instance = workInProgress.stateNode;
       
 14763   var shouldUpdate = void 0;
       
 14764   if (instance === null) {
       
 14765     if (current$$1 !== null) {
       
 14766       // An class component without an instance only mounts if it suspended
       
 14767       // inside a non- concurrent tree, in an inconsistent state. We want to
       
 14768       // tree it like a new mount, even though an empty version of it already
       
 14769       // committed. Disconnect the alternate pointers.
       
 14770       current$$1.alternate = null;
       
 14771       workInProgress.alternate = null;
       
 14772       // Since this is conceptually a new fiber, schedule a Placement effect
       
 14773       workInProgress.effectTag |= Placement;
       
 14774     }
       
 14775     // In the initial pass we might need to construct the instance.
       
 14776     constructClassInstance(workInProgress, Component, nextProps, renderExpirationTime);
       
 14777     mountClassInstance(workInProgress, Component, nextProps, renderExpirationTime);
       
 14778     shouldUpdate = true;
       
 14779   } else if (current$$1 === null) {
       
 14780     // In a resume, we'll already have an instance we can reuse.
       
 14781     shouldUpdate = resumeMountClassInstance(workInProgress, Component, nextProps, renderExpirationTime);
       
 14782   } else {
       
 14783     shouldUpdate = updateClassInstance(current$$1, workInProgress, Component, nextProps, renderExpirationTime);
       
 14784   }
       
 14785   var nextUnitOfWork = finishClassComponent(current$$1, workInProgress, Component, shouldUpdate, hasContext, renderExpirationTime);
       
 14786   {
       
 14787     var inst = workInProgress.stateNode;
       
 14788     if (inst.props !== nextProps) {
       
 14789       !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;
       
 14790       didWarnAboutReassigningProps = true;
       
 14791     }
       
 14792   }
       
 14793   return nextUnitOfWork;
       
 14794 }
       
 14795 
       
 14796 function finishClassComponent(current$$1, workInProgress, Component, shouldUpdate, hasContext, renderExpirationTime) {
       
 14797   // Refs should update even if shouldComponentUpdate returns false
       
 14798   markRef(current$$1, workInProgress);
       
 14799 
       
 14800   var didCaptureError = (workInProgress.effectTag & DidCapture) !== NoEffect;
       
 14801 
       
 14802   if (!shouldUpdate && !didCaptureError) {
       
 14803     // Context providers should defer to sCU for rendering
       
 14804     if (hasContext) {
       
 14805       invalidateContextProvider(workInProgress, Component, false);
       
 14806     }
       
 14807 
       
 14808     return bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirationTime);
       
 14809   }
       
 14810 
       
 14811   var instance = workInProgress.stateNode;
       
 14812 
       
 14813   // Rerender
       
 14814   ReactCurrentOwner$3.current = workInProgress;
       
 14815   var nextChildren = void 0;
       
 14816   if (didCaptureError && typeof Component.getDerivedStateFromError !== 'function') {
       
 14817     // If we captured an error, but getDerivedStateFrom catch is not defined,
       
 14818     // unmount all the children. componentDidCatch will schedule an update to
       
 14819     // re-render a fallback. This is temporary until we migrate everyone to
       
 14820     // the new API.
       
 14821     // TODO: Warn in a future release.
       
 14822     nextChildren = null;
       
 14823 
       
 14824     if (enableProfilerTimer) {
       
 14825       stopProfilerTimerIfRunning(workInProgress);
       
 14826     }
       
 14827   } else {
       
 14828     {
       
 14829       setCurrentPhase('render');
       
 14830       nextChildren = instance.render();
       
 14831       if (debugRenderPhaseSideEffects || debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
       
 14832         instance.render();
       
 14833       }
       
 14834       setCurrentPhase(null);
       
 14835     }
       
 14836   }
       
 14837 
       
 14838   // React DevTools reads this flag.
       
 14839   workInProgress.effectTag |= PerformedWork;
       
 14840   if (current$$1 !== null && didCaptureError) {
       
 14841     // If we're recovering from an error, reconcile without reusing any of
       
 14842     // the existing children. Conceptually, the normal children and the children
       
 14843     // that are shown on error are two different sets, so we shouldn't reuse
       
 14844     // normal children even if their identities match.
       
 14845     forceUnmountCurrentAndReconcile(current$$1, workInProgress, nextChildren, renderExpirationTime);
       
 14846   } else {
       
 14847     reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
       
 14848   }
       
 14849 
       
 14850   // Memoize state using the values we just used to render.
       
 14851   // TODO: Restructure so we never read values from the instance.
       
 14852   workInProgress.memoizedState = instance.state;
       
 14853 
       
 14854   // The context might have changed so we need to recalculate it.
       
 14855   if (hasContext) {
       
 14856     invalidateContextProvider(workInProgress, Component, true);
       
 14857   }
       
 14858 
       
 14859   return workInProgress.child;
       
 14860 }
       
 14861 
       
 14862 function pushHostRootContext(workInProgress) {
       
 14863   var root = workInProgress.stateNode;
       
 14864   if (root.pendingContext) {
       
 14865     pushTopLevelContextObject(workInProgress, root.pendingContext, root.pendingContext !== root.context);
       
 14866   } else if (root.context) {
       
 14867     // Should always be set
       
 14868     pushTopLevelContextObject(workInProgress, root.context, false);
       
 14869   }
       
 14870   pushHostContainer(workInProgress, root.containerInfo);
       
 14871 }
       
 14872 
       
 14873 function updateHostRoot(current$$1, workInProgress, renderExpirationTime) {
       
 14874   pushHostRootContext(workInProgress);
       
 14875   var updateQueue = workInProgress.updateQueue;
       
 14876   !(updateQueue !== null) ? invariant(false, '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.') : void 0;
       
 14877   var nextProps = workInProgress.pendingProps;
       
 14878   var prevState = workInProgress.memoizedState;
       
 14879   var prevChildren = prevState !== null ? prevState.element : null;
       
 14880   processUpdateQueue(workInProgress, updateQueue, nextProps, null, renderExpirationTime);
       
 14881   var nextState = workInProgress.memoizedState;
       
 14882   // Caution: React DevTools currently depends on this property
       
 14883   // being called "element".
       
 14884   var nextChildren = nextState.element;
       
 14885   if (nextChildren === prevChildren) {
       
 14886     // If the state is the same as before, that's a bailout because we had
       
 14887     // no work that expires at this time.
       
 14888     resetHydrationState();
       
 14889     return bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirationTime);
       
 14890   }
       
 14891   var root = workInProgress.stateNode;
       
 14892   if ((current$$1 === null || current$$1.child === null) && root.hydrate && enterHydrationState(workInProgress)) {
       
 14893     // If we don't have any current children this might be the first pass.
       
 14894     // We always try to hydrate. If this isn't a hydration pass there won't
       
 14895     // be any children to hydrate which is effectively the same thing as
       
 14896     // not hydrating.
       
 14897 
       
 14898     // This is a bit of a hack. We track the host root as a placement to
       
 14899     // know that we're currently in a mounting state. That way isMounted
       
 14900     // works as expected. We must reset this before committing.
       
 14901     // TODO: Delete this when we delete isMounted and findDOMNode.
       
 14902     workInProgress.effectTag |= Placement;
       
 14903 
       
 14904     // Ensure that children mount into this root without tracking
       
 14905     // side-effects. This ensures that we don't store Placement effects on
       
 14906     // nodes that will be hydrated.
       
 14907     workInProgress.child = mountChildFibers(workInProgress, null, nextChildren, renderExpirationTime);
       
 14908   } else {
       
 14909     // Otherwise reset hydration state in case we aborted and resumed another
       
 14910     // root.
       
 14911     reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
       
 14912     resetHydrationState();
       
 14913   }
       
 14914   return workInProgress.child;
       
 14915 }
       
 14916 
       
 14917 function updateHostComponent(current$$1, workInProgress, renderExpirationTime) {
       
 14918   pushHostContext(workInProgress);
       
 14919 
       
 14920   if (current$$1 === null) {
       
 14921     tryToClaimNextHydratableInstance(workInProgress);
       
 14922   }
       
 14923 
       
 14924   var type = workInProgress.type;
       
 14925   var nextProps = workInProgress.pendingProps;
       
 14926   var prevProps = current$$1 !== null ? current$$1.memoizedProps : null;
       
 14927 
       
 14928   var nextChildren = nextProps.children;
       
 14929   var isDirectTextChild = shouldSetTextContent(type, nextProps);
       
 14930 
       
 14931   if (isDirectTextChild) {
       
 14932     // We special case a direct text child of a host node. This is a common
       
 14933     // case. We won't handle it as a reified child. We will instead handle
       
 14934     // this in the host environment that also have access to this prop. That
       
 14935     // avoids allocating another HostText fiber and traversing it.
       
 14936     nextChildren = null;
       
 14937   } else if (prevProps !== null && shouldSetTextContent(type, prevProps)) {
       
 14938     // If we're switching from a direct text child to a normal child, or to
       
 14939     // empty, we need to schedule the text content to be reset.
       
 14940     workInProgress.effectTag |= ContentReset;
       
 14941   }
       
 14942 
       
 14943   markRef(current$$1, workInProgress);
       
 14944 
       
 14945   // Check the host config to see if the children are offscreen/hidden.
       
 14946   if (renderExpirationTime !== Never && workInProgress.mode & ConcurrentMode && shouldDeprioritizeSubtree(type, nextProps)) {
       
 14947     // Schedule this fiber to re-render at offscreen priority. Then bailout.
       
 14948     workInProgress.expirationTime = workInProgress.childExpirationTime = Never;
       
 14949     return null;
       
 14950   }
       
 14951 
       
 14952   reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
       
 14953   return workInProgress.child;
       
 14954 }
       
 14955 
       
 14956 function updateHostText(current$$1, workInProgress) {
       
 14957   if (current$$1 === null) {
       
 14958     tryToClaimNextHydratableInstance(workInProgress);
       
 14959   }
       
 14960   // Nothing to do here. This is terminal. We'll do the completion step
       
 14961   // immediately after.
       
 14962   return null;
       
 14963 }
       
 14964 
       
 14965 function mountLazyComponent(_current, workInProgress, elementType, updateExpirationTime, renderExpirationTime) {
       
 14966   if (_current !== null) {
       
 14967     // An lazy component only mounts if it suspended inside a non-
       
 14968     // concurrent tree, in an inconsistent state. We want to treat it like
       
 14969     // a new mount, even though an empty version of it already committed.
       
 14970     // Disconnect the alternate pointers.
       
 14971     _current.alternate = null;
       
 14972     workInProgress.alternate = null;
       
 14973     // Since this is conceptually a new fiber, schedule a Placement effect
       
 14974     workInProgress.effectTag |= Placement;
       
 14975   }
       
 14976 
       
 14977   var props = workInProgress.pendingProps;
       
 14978   // We can't start a User Timing measurement with correct label yet.
       
 14979   // Cancel and resume right after we know the tag.
       
 14980   cancelWorkTimer(workInProgress);
       
 14981   var Component = readLazyComponentType(elementType);
       
 14982   // Store the unwrapped component in the type.
       
 14983   workInProgress.type = Component;
       
 14984   var resolvedTag = workInProgress.tag = resolveLazyComponentTag(Component);
       
 14985   startWorkTimer(workInProgress);
       
 14986   var resolvedProps = resolveDefaultProps(Component, props);
       
 14987   var child = void 0;
       
 14988   switch (resolvedTag) {
       
 14989     case FunctionComponent:
       
 14990       {
       
 14991         {
       
 14992           validateFunctionComponentInDev(workInProgress, Component);
       
 14993         }
       
 14994         child = updateFunctionComponent(null, workInProgress, Component, resolvedProps, renderExpirationTime);
       
 14995         break;
       
 14996       }
       
 14997     case ClassComponent:
       
 14998       {
       
 14999         child = updateClassComponent(null, workInProgress, Component, resolvedProps, renderExpirationTime);
       
 15000         break;
       
 15001       }
       
 15002     case ForwardRef:
       
 15003       {
       
 15004         child = updateForwardRef(null, workInProgress, Component, resolvedProps, renderExpirationTime);
       
 15005         break;
       
 15006       }
       
 15007     case MemoComponent:
       
 15008       {
       
 15009         {
       
 15010           if (workInProgress.type !== workInProgress.elementType) {
       
 15011             var outerPropTypes = Component.propTypes;
       
 15012             if (outerPropTypes) {
       
 15013               checkPropTypes_1(outerPropTypes, resolvedProps, // Resolved for outer only
       
 15014               'prop', getComponentName(Component), getCurrentFiberStackInDev);
       
 15015             }
       
 15016           }
       
 15017         }
       
 15018         child = updateMemoComponent(null, workInProgress, Component, resolveDefaultProps(Component.type, resolvedProps), // The inner type can have defaults too
       
 15019         updateExpirationTime, renderExpirationTime);
       
 15020         break;
       
 15021       }
       
 15022     default:
       
 15023       {
       
 15024         var hint = '';
       
 15025         {
       
 15026           if (Component !== null && typeof Component === 'object' && Component.$$typeof === REACT_LAZY_TYPE) {
       
 15027             hint = ' Did you wrap a component in React.lazy() more than once?';
       
 15028           }
       
 15029         }
       
 15030         // This message intentionally doesn't mention ForwardRef or MemoComponent
       
 15031         // because the fact that it's a separate type of work is an
       
 15032         // implementation detail.
       
 15033         invariant(false, 'Element type is invalid. Received a promise that resolves to: %s. Lazy element type must resolve to a class or function.%s', Component, hint);
       
 15034       }
       
 15035   }
       
 15036   return child;
       
 15037 }
       
 15038 
       
 15039 function mountIncompleteClassComponent(_current, workInProgress, Component, nextProps, renderExpirationTime) {
       
 15040   if (_current !== null) {
       
 15041     // An incomplete component only mounts if it suspended inside a non-
       
 15042     // concurrent tree, in an inconsistent state. We want to treat it like
       
 15043     // a new mount, even though an empty version of it already committed.
       
 15044     // Disconnect the alternate pointers.
       
 15045     _current.alternate = null;
       
 15046     workInProgress.alternate = null;
       
 15047     // Since this is conceptually a new fiber, schedule a Placement effect
       
 15048     workInProgress.effectTag |= Placement;
       
 15049   }
       
 15050 
       
 15051   // Promote the fiber to a class and try rendering again.
       
 15052   workInProgress.tag = ClassComponent;
       
 15053 
       
 15054   // The rest of this function is a fork of `updateClassComponent`
       
 15055 
       
 15056   // Push context providers early to prevent context stack mismatches.
       
 15057   // During mounting we don't know the child context yet as the instance doesn't exist.
       
 15058   // We will invalidate the child context in finishClassComponent() right after rendering.
       
 15059   var hasContext = void 0;
       
 15060   if (isContextProvider(Component)) {
       
 15061     hasContext = true;
       
 15062     pushContextProvider(workInProgress);
       
 15063   } else {
       
 15064     hasContext = false;
       
 15065   }
       
 15066   prepareToReadContext(workInProgress, renderExpirationTime);
       
 15067 
       
 15068   constructClassInstance(workInProgress, Component, nextProps, renderExpirationTime);
       
 15069   mountClassInstance(workInProgress, Component, nextProps, renderExpirationTime);
       
 15070 
       
 15071   return finishClassComponent(null, workInProgress, Component, true, hasContext, renderExpirationTime);
       
 15072 }
       
 15073 
       
 15074 function mountIndeterminateComponent(_current, workInProgress, Component, renderExpirationTime) {
       
 15075   if (_current !== null) {
       
 15076     // An indeterminate component only mounts if it suspended inside a non-
       
 15077     // concurrent tree, in an inconsistent state. We want to treat it like
       
 15078     // a new mount, even though an empty version of it already committed.
       
 15079     // Disconnect the alternate pointers.
       
 15080     _current.alternate = null;
       
 15081     workInProgress.alternate = null;
       
 15082     // Since this is conceptually a new fiber, schedule a Placement effect
       
 15083     workInProgress.effectTag |= Placement;
       
 15084   }
       
 15085 
       
 15086   var props = workInProgress.pendingProps;
       
 15087   var unmaskedContext = getUnmaskedContext(workInProgress, Component, false);
       
 15088   var context = getMaskedContext(workInProgress, unmaskedContext);
       
 15089 
       
 15090   prepareToReadContext(workInProgress, renderExpirationTime);
       
 15091 
       
 15092   var value = void 0;
       
 15093 
       
 15094   {
       
 15095     if (Component.prototype && typeof Component.prototype.render === 'function') {
       
 15096       var componentName = getComponentName(Component) || 'Unknown';
       
 15097 
       
 15098       if (!didWarnAboutBadClass[componentName]) {
       
 15099         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);
       
 15100         didWarnAboutBadClass[componentName] = true;
       
 15101       }
       
 15102     }
       
 15103 
       
 15104     if (workInProgress.mode & StrictMode) {
       
 15105       ReactStrictModeWarnings.recordLegacyContextWarning(workInProgress, null);
       
 15106     }
       
 15107 
       
 15108     ReactCurrentOwner$3.current = workInProgress;
       
 15109     value = renderWithHooks(null, workInProgress, Component, props, context, renderExpirationTime);
       
 15110   }
       
 15111   // React DevTools reads this flag.
       
 15112   workInProgress.effectTag |= PerformedWork;
       
 15113 
       
 15114   if (typeof value === 'object' && value !== null && typeof value.render === 'function' && value.$$typeof === undefined) {
       
 15115     // Proceed under the assumption that this is a class instance
       
 15116     workInProgress.tag = ClassComponent;
       
 15117 
       
 15118     // Throw out any hooks that were used.
       
 15119     resetHooks();
       
 15120 
       
 15121     // Push context providers early to prevent context stack mismatches.
       
 15122     // During mounting we don't know the child context yet as the instance doesn't exist.
       
 15123     // We will invalidate the child context in finishClassComponent() right after rendering.
       
 15124     var hasContext = false;
       
 15125     if (isContextProvider(Component)) {
       
 15126       hasContext = true;
       
 15127       pushContextProvider(workInProgress);
       
 15128     } else {
       
 15129       hasContext = false;
       
 15130     }
       
 15131 
       
 15132     workInProgress.memoizedState = value.state !== null && value.state !== undefined ? value.state : null;
       
 15133 
       
 15134     var getDerivedStateFromProps = Component.getDerivedStateFromProps;
       
 15135     if (typeof getDerivedStateFromProps === 'function') {
       
 15136       applyDerivedStateFromProps(workInProgress, Component, getDerivedStateFromProps, props);
       
 15137     }
       
 15138 
       
 15139     adoptClassInstance(workInProgress, value);
       
 15140     mountClassInstance(workInProgress, Component, props, renderExpirationTime);
       
 15141     return finishClassComponent(null, workInProgress, Component, true, hasContext, renderExpirationTime);
       
 15142   } else {
       
 15143     // Proceed under the assumption that this is a function component
       
 15144     workInProgress.tag = FunctionComponent;
       
 15145     {
       
 15146       if (debugRenderPhaseSideEffects || debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
       
 15147         // Only double-render components with Hooks
       
 15148         if (workInProgress.memoizedState !== null) {
       
 15149           value = renderWithHooks(null, workInProgress, Component, props, context, renderExpirationTime);
       
 15150         }
       
 15151       }
       
 15152     }
       
 15153     reconcileChildren(null, workInProgress, value, renderExpirationTime);
       
 15154     {
       
 15155       validateFunctionComponentInDev(workInProgress, Component);
       
 15156     }
       
 15157     return workInProgress.child;
       
 15158   }
       
 15159 }
       
 15160 
       
 15161 function validateFunctionComponentInDev(workInProgress, Component) {
       
 15162   if (Component) {
       
 15163     !!Component.childContextTypes ? warningWithoutStack$1(false, '%s(...): childContextTypes cannot be defined on a function component.', Component.displayName || Component.name || 'Component') : void 0;
       
 15164   }
       
 15165   if (workInProgress.ref !== null) {
       
 15166     var info = '';
       
 15167     var ownerName = getCurrentFiberOwnerNameInDevOrNull();
       
 15168     if (ownerName) {
       
 15169       info += '\n\nCheck the render method of `' + ownerName + '`.';
       
 15170     }
       
 15171 
       
 15172     var warningKey = ownerName || workInProgress._debugID || '';
       
 15173     var debugSource = workInProgress._debugSource;
       
 15174     if (debugSource) {
       
 15175       warningKey = debugSource.fileName + ':' + debugSource.lineNumber;
       
 15176     }
       
 15177     if (!didWarnAboutFunctionRefs[warningKey]) {
       
 15178       didWarnAboutFunctionRefs[warningKey] = true;
       
 15179       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);
       
 15180     }
       
 15181   }
       
 15182 
       
 15183   if (typeof Component.getDerivedStateFromProps === 'function') {
       
 15184     var componentName = getComponentName(Component) || 'Unknown';
       
 15185 
       
 15186     if (!didWarnAboutGetDerivedStateOnFunctionComponent[componentName]) {
       
 15187       warningWithoutStack$1(false, '%s: Function components do not support getDerivedStateFromProps.', componentName);
       
 15188       didWarnAboutGetDerivedStateOnFunctionComponent[componentName] = true;
       
 15189     }
       
 15190   }
       
 15191 
       
 15192   if (typeof Component.contextType === 'object' && Component.contextType !== null) {
       
 15193     var _componentName = getComponentName(Component) || 'Unknown';
       
 15194 
       
 15195     if (!didWarnAboutContextTypeOnFunctionComponent[_componentName]) {
       
 15196       warningWithoutStack$1(false, '%s: Function components do not support contextType.', _componentName);
       
 15197       didWarnAboutContextTypeOnFunctionComponent[_componentName] = true;
       
 15198     }
       
 15199   }
       
 15200 }
       
 15201 
       
 15202 function updateSuspenseComponent(current$$1, workInProgress, renderExpirationTime) {
       
 15203   var mode = workInProgress.mode;
       
 15204   var nextProps = workInProgress.pendingProps;
       
 15205 
       
 15206   // We should attempt to render the primary children unless this boundary
       
 15207   // already suspended during this render (`alreadyCaptured` is true).
       
 15208   var nextState = workInProgress.memoizedState;
       
 15209 
       
 15210   var nextDidTimeout = void 0;
       
 15211   if ((workInProgress.effectTag & DidCapture) === NoEffect) {
       
 15212     // This is the first attempt.
       
 15213     nextState = null;
       
 15214     nextDidTimeout = false;
       
 15215   } else {
       
 15216     // Something in this boundary's subtree already suspended. Switch to
       
 15217     // rendering the fallback children.
       
 15218     nextState = {
       
 15219       timedOutAt: nextState !== null ? nextState.timedOutAt : NoWork
       
 15220     };
       
 15221     nextDidTimeout = true;
       
 15222     workInProgress.effectTag &= ~DidCapture;
       
 15223   }
       
 15224 
       
 15225   // This next part is a bit confusing. If the children timeout, we switch to
       
 15226   // showing the fallback children in place of the "primary" children.
       
 15227   // However, we don't want to delete the primary children because then their
       
 15228   // state will be lost (both the React state and the host state, e.g.
       
 15229   // uncontrolled form inputs). Instead we keep them mounted and hide them.
       
 15230   // Both the fallback children AND the primary children are rendered at the
       
 15231   // same time. Once the primary children are un-suspended, we can delete
       
 15232   // the fallback children — don't need to preserve their state.
       
 15233   //
       
 15234   // The two sets of children are siblings in the host environment, but
       
 15235   // semantically, for purposes of reconciliation, they are two separate sets.
       
 15236   // So we store them using two fragment fibers.
       
 15237   //
       
 15238   // However, we want to avoid allocating extra fibers for every placeholder.
       
 15239   // They're only necessary when the children time out, because that's the
       
 15240   // only time when both sets are mounted.
       
 15241   //
       
 15242   // So, the extra fragment fibers are only used if the children time out.
       
 15243   // Otherwise, we render the primary children directly. This requires some
       
 15244   // custom reconciliation logic to preserve the state of the primary
       
 15245   // children. It's essentially a very basic form of re-parenting.
       
 15246 
       
 15247   // `child` points to the child fiber. In the normal case, this is the first
       
 15248   // fiber of the primary children set. In the timed-out case, it's a
       
 15249   // a fragment fiber containing the primary children.
       
 15250   var child = void 0;
       
 15251   // `next` points to the next fiber React should render. In the normal case,
       
 15252   // it's the same as `child`: the first fiber of the primary children set.
       
 15253   // In the timed-out case, it's a fragment fiber containing the *fallback*
       
 15254   // children -- we skip over the primary children entirely.
       
 15255   var next = void 0;
       
 15256   if (current$$1 === null) {
       
 15257     if (enableSuspenseServerRenderer) {
       
 15258       // If we're currently hydrating, try to hydrate this boundary.
       
 15259       // But only if this has a fallback.
       
 15260       if (nextProps.fallback !== undefined) {
       
 15261         tryToClaimNextHydratableInstance(workInProgress);
       
 15262         // This could've changed the tag if this was a dehydrated suspense component.
       
 15263         if (workInProgress.tag === DehydratedSuspenseComponent) {
       
 15264           return updateDehydratedSuspenseComponent(null, workInProgress, renderExpirationTime);
       
 15265         }
       
 15266       }
       
 15267     }
       
 15268 
       
 15269     // This is the initial mount. This branch is pretty simple because there's
       
 15270     // no previous state that needs to be preserved.
       
 15271     if (nextDidTimeout) {
       
 15272       // Mount separate fragments for primary and fallback children.
       
 15273       var nextFallbackChildren = nextProps.fallback;
       
 15274       var primaryChildFragment = createFiberFromFragment(null, mode, NoWork, null);
       
 15275 
       
 15276       if ((workInProgress.mode & ConcurrentMode) === NoContext) {
       
 15277         // Outside of concurrent mode, we commit the effects from the
       
 15278         var progressedState = workInProgress.memoizedState;
       
 15279         var progressedPrimaryChild = progressedState !== null ? workInProgress.child.child : workInProgress.child;
       
 15280         primaryChildFragment.child = progressedPrimaryChild;
       
 15281       }
       
 15282 
       
 15283       var fallbackChildFragment = createFiberFromFragment(nextFallbackChildren, mode, renderExpirationTime, null);
       
 15284       primaryChildFragment.sibling = fallbackChildFragment;
       
 15285       child = primaryChildFragment;
       
 15286       // Skip the primary children, and continue working on the
       
 15287       // fallback children.
       
 15288       next = fallbackChildFragment;
       
 15289       child.return = next.return = workInProgress;
       
 15290     } else {
       
 15291       // Mount the primary children without an intermediate fragment fiber.
       
 15292       var nextPrimaryChildren = nextProps.children;
       
 15293       child = next = mountChildFibers(workInProgress, null, nextPrimaryChildren, renderExpirationTime);
       
 15294     }
       
 15295   } else {
       
 15296     // This is an update. This branch is more complicated because we need to
       
 15297     // ensure the state of the primary children is preserved.
       
 15298     var prevState = current$$1.memoizedState;
       
 15299     var prevDidTimeout = prevState !== null;
       
 15300     if (prevDidTimeout) {
       
 15301       // The current tree already timed out. That means each child set is
       
 15302       var currentPrimaryChildFragment = current$$1.child;
       
 15303       var currentFallbackChildFragment = currentPrimaryChildFragment.sibling;
       
 15304       if (nextDidTimeout) {
       
 15305         // Still timed out. Reuse the current primary children by cloning
       
 15306         // its fragment. We're going to skip over these entirely.
       
 15307         var _nextFallbackChildren = nextProps.fallback;
       
 15308         var _primaryChildFragment = createWorkInProgress(currentPrimaryChildFragment, currentPrimaryChildFragment.pendingProps, NoWork);
       
 15309 
       
 15310         if ((workInProgress.mode & ConcurrentMode) === NoContext) {
       
 15311           // Outside of concurrent mode, we commit the effects from the
       
 15312           var _progressedState = workInProgress.memoizedState;
       
 15313           var _progressedPrimaryChild = _progressedState !== null ? workInProgress.child.child : workInProgress.child;
       
 15314           if (_progressedPrimaryChild !== currentPrimaryChildFragment.child) {
       
 15315             _primaryChildFragment.child = _progressedPrimaryChild;
       
 15316           }
       
 15317         }
       
 15318 
       
 15319         // Because primaryChildFragment is a new fiber that we're inserting as the
       
 15320         // parent of a new tree, we need to set its treeBaseDuration.
       
 15321         if (enableProfilerTimer && workInProgress.mode & ProfileMode) {
       
 15322           // treeBaseDuration is the sum of all the child tree base durations.
       
 15323           var treeBaseDuration = 0;
       
 15324           var hiddenChild = _primaryChildFragment.child;
       
 15325           while (hiddenChild !== null) {
       
 15326             treeBaseDuration += hiddenChild.treeBaseDuration;
       
 15327             hiddenChild = hiddenChild.sibling;
       
 15328           }
       
 15329           _primaryChildFragment.treeBaseDuration = treeBaseDuration;
       
 15330         }
       
 15331 
       
 15332         // Clone the fallback child fragment, too. These we'll continue
       
 15333         // working on.
       
 15334         var _fallbackChildFragment = _primaryChildFragment.sibling = createWorkInProgress(currentFallbackChildFragment, _nextFallbackChildren, currentFallbackChildFragment.expirationTime);
       
 15335         child = _primaryChildFragment;
       
 15336         _primaryChildFragment.childExpirationTime = NoWork;
       
 15337         // Skip the primary children, and continue working on the
       
 15338         // fallback children.
       
 15339         next = _fallbackChildFragment;
       
 15340         child.return = next.return = workInProgress;
       
 15341       } else {
       
 15342         // No longer suspended. Switch back to showing the primary children,
       
 15343         // and remove the intermediate fragment fiber.
       
 15344         var _nextPrimaryChildren = nextProps.children;
       
 15345         var currentPrimaryChild = currentPrimaryChildFragment.child;
       
 15346         var primaryChild = reconcileChildFibers(workInProgress, currentPrimaryChild, _nextPrimaryChildren, renderExpirationTime);
       
 15347 
       
 15348         // If this render doesn't suspend, we need to delete the fallback
       
 15349         // children. Wait until the complete phase, after we've confirmed the
       
 15350         // fallback is no longer needed.
       
 15351         // TODO: Would it be better to store the fallback fragment on
       
 15352         // the stateNode?
       
 15353 
       
 15354         // Continue rendering the children, like we normally do.
       
 15355         child = next = primaryChild;
       
 15356       }
       
 15357     } else {
       
 15358       // The current tree has not already timed out. That means the primary
       
 15359       // children are not wrapped in a fragment fiber.
       
 15360       var _currentPrimaryChild = current$$1.child;
       
 15361       if (nextDidTimeout) {
       
 15362         // Timed out. Wrap the children in a fragment fiber to keep them
       
 15363         // separate from the fallback children.
       
 15364         var _nextFallbackChildren2 = nextProps.fallback;
       
 15365         var _primaryChildFragment2 = createFiberFromFragment(
       
 15366         // It shouldn't matter what the pending props are because we aren't
       
 15367         // going to render this fragment.
       
 15368         null, mode, NoWork, null);
       
 15369         _primaryChildFragment2.child = _currentPrimaryChild;
       
 15370 
       
 15371         // Even though we're creating a new fiber, there are no new children,
       
 15372         // because we're reusing an already mounted tree. So we don't need to
       
 15373         // schedule a placement.
       
 15374         // primaryChildFragment.effectTag |= Placement;
       
 15375 
       
 15376         if ((workInProgress.mode & ConcurrentMode) === NoContext) {
       
 15377           // Outside of concurrent mode, we commit the effects from the
       
 15378           var _progressedState2 = workInProgress.memoizedState;
       
 15379           var _progressedPrimaryChild2 = _progressedState2 !== null ? workInProgress.child.child : workInProgress.child;
       
 15380           _primaryChildFragment2.child = _progressedPrimaryChild2;
       
 15381         }
       
 15382 
       
 15383         // Because primaryChildFragment is a new fiber that we're inserting as the
       
 15384         // parent of a new tree, we need to set its treeBaseDuration.
       
 15385         if (enableProfilerTimer && workInProgress.mode & ProfileMode) {
       
 15386           // treeBaseDuration is the sum of all the child tree base durations.
       
 15387           var _treeBaseDuration = 0;
       
 15388           var _hiddenChild = _primaryChildFragment2.child;
       
 15389           while (_hiddenChild !== null) {
       
 15390             _treeBaseDuration += _hiddenChild.treeBaseDuration;
       
 15391             _hiddenChild = _hiddenChild.sibling;
       
 15392           }
       
 15393           _primaryChildFragment2.treeBaseDuration = _treeBaseDuration;
       
 15394         }
       
 15395 
       
 15396         // Create a fragment from the fallback children, too.
       
 15397         var _fallbackChildFragment2 = _primaryChildFragment2.sibling = createFiberFromFragment(_nextFallbackChildren2, mode, renderExpirationTime, null);
       
 15398         _fallbackChildFragment2.effectTag |= Placement;
       
 15399         child = _primaryChildFragment2;
       
 15400         _primaryChildFragment2.childExpirationTime = NoWork;
       
 15401         // Skip the primary children, and continue working on the
       
 15402         // fallback children.
       
 15403         next = _fallbackChildFragment2;
       
 15404         child.return = next.return = workInProgress;
       
 15405       } else {
       
 15406         // Still haven't timed out.  Continue rendering the children, like we
       
 15407         // normally do.
       
 15408         var _nextPrimaryChildren2 = nextProps.children;
       
 15409         next = child = reconcileChildFibers(workInProgress, _currentPrimaryChild, _nextPrimaryChildren2, renderExpirationTime);
       
 15410       }
       
 15411     }
       
 15412     workInProgress.stateNode = current$$1.stateNode;
       
 15413   }
       
 15414 
       
 15415   workInProgress.memoizedState = nextState;
       
 15416   workInProgress.child = child;
       
 15417   return next;
       
 15418 }
       
 15419 
       
 15420 function updateDehydratedSuspenseComponent(current$$1, workInProgress, renderExpirationTime) {
       
 15421   if (current$$1 === null) {
       
 15422     // During the first pass, we'll bail out and not drill into the children.
       
 15423     // Instead, we'll leave the content in place and try to hydrate it later.
       
 15424     workInProgress.expirationTime = Never;
       
 15425     return null;
       
 15426   }
       
 15427   // We use childExpirationTime to indicate that a child might depend on context, so if
       
 15428   // any context has changed, we need to treat is as if the input might have changed.
       
 15429   var hasContextChanged$$1 = current$$1.childExpirationTime >= renderExpirationTime;
       
 15430   if (didReceiveUpdate || hasContextChanged$$1) {
       
 15431     // This boundary has changed since the first render. This means that we are now unable to
       
 15432     // hydrate it. We might still be able to hydrate it using an earlier expiration time but
       
 15433     // during this render we can't. Instead, we're going to delete the whole subtree and
       
 15434     // instead inject a new real Suspense boundary to take its place, which may render content
       
 15435     // or fallback. The real Suspense boundary will suspend for a while so we have some time
       
 15436     // to ensure it can produce real content, but all state and pending events will be lost.
       
 15437 
       
 15438     // Detach from the current dehydrated boundary.
       
 15439     current$$1.alternate = null;
       
 15440     workInProgress.alternate = null;
       
 15441 
       
 15442     // Insert a deletion in the effect list.
       
 15443     var returnFiber = workInProgress.return;
       
 15444     !(returnFiber !== null) ? invariant(false, 'Suspense boundaries are never on the root. This is probably a bug in React.') : void 0;
       
 15445     var last = returnFiber.lastEffect;
       
 15446     if (last !== null) {
       
 15447       last.nextEffect = current$$1;
       
 15448       returnFiber.lastEffect = current$$1;
       
 15449     } else {
       
 15450       returnFiber.firstEffect = returnFiber.lastEffect = current$$1;
       
 15451     }
       
 15452     current$$1.nextEffect = null;
       
 15453     current$$1.effectTag = Deletion;
       
 15454 
       
 15455     // Upgrade this work in progress to a real Suspense component.
       
 15456     workInProgress.tag = SuspenseComponent;
       
 15457     workInProgress.stateNode = null;
       
 15458     workInProgress.memoizedState = null;
       
 15459     // This is now an insertion.
       
 15460     workInProgress.effectTag |= Placement;
       
 15461     // Retry as a real Suspense component.
       
 15462     return updateSuspenseComponent(null, workInProgress, renderExpirationTime);
       
 15463   }
       
 15464   if ((workInProgress.effectTag & DidCapture) === NoEffect) {
       
 15465     // This is the first attempt.
       
 15466     reenterHydrationStateFromDehydratedSuspenseInstance(workInProgress);
       
 15467     var nextProps = workInProgress.pendingProps;
       
 15468     var nextChildren = nextProps.children;
       
 15469     workInProgress.child = mountChildFibers(workInProgress, null, nextChildren, renderExpirationTime);
       
 15470     return workInProgress.child;
       
 15471   } else {
       
 15472     // Something suspended. Leave the existing children in place.
       
 15473     // TODO: In non-concurrent mode, should we commit the nodes we have hydrated so far?
       
 15474     workInProgress.child = null;
       
 15475     return null;
       
 15476   }
       
 15477 }
       
 15478 
       
 15479 function updatePortalComponent(current$$1, workInProgress, renderExpirationTime) {
       
 15480   pushHostContainer(workInProgress, workInProgress.stateNode.containerInfo);
       
 15481   var nextChildren = workInProgress.pendingProps;
       
 15482   if (current$$1 === null) {
       
 15483     // Portals are special because we don't append the children during mount
       
 15484     // but at commit. Therefore we need to track insertions which the normal
       
 15485     // flow doesn't do during mount. This doesn't happen at the root because
       
 15486     // the root always starts with a "current" with a null child.
       
 15487     // TODO: Consider unifying this with how the root works.
       
 15488     workInProgress.child = reconcileChildFibers(workInProgress, null, nextChildren, renderExpirationTime);
       
 15489   } else {
       
 15490     reconcileChildren(current$$1, workInProgress, nextChildren, renderExpirationTime);
       
 15491   }
       
 15492   return workInProgress.child;
       
 15493 }
       
 15494 
       
 15495 function updateContextProvider(current$$1, workInProgress, renderExpirationTime) {
       
 15496   var providerType = workInProgress.type;
       
 15497   var context = providerType._context;
       
 15498 
       
 15499   var newProps = workInProgress.pendingProps;
       
 15500   var oldProps = workInProgress.memoizedProps;
       
 15501 
       
 15502   var newValue = newProps.value;
       
 15503 
       
 15504   {
       
 15505     var providerPropTypes = workInProgress.type.propTypes;
       
 15506 
       
 15507     if (providerPropTypes) {
       
 15508       checkPropTypes_1(providerPropTypes, newProps, 'prop', 'Context.Provider', getCurrentFiberStackInDev);
       
 15509     }
       
 15510   }
       
 15511 
       
 15512   pushProvider(workInProgress, newValue);
       
 15513 
       
 15514   if (oldProps !== null) {
       
 15515     var oldValue = oldProps.value;
       
 15516     var changedBits = calculateChangedBits(context, newValue, oldValue);
       
 15517     if (changedBits === 0) {
       
 15518       // No change. Bailout early if children are the same.
       
 15519       if (oldProps.children === newProps.children && !hasContextChanged()) {
       
 15520         return bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirationTime);
       
 15521       }
       
 15522     } else {
       
 15523       // The context value changed. Search for matching consumers and schedule
       
 15524       // them to update.
       
 15525       propagateContextChange(workInProgress, context, changedBits, renderExpirationTime);
       
 15526     }
       
 15527   }
       
 15528 
       
 15529   var newChildren = newProps.children;
       
 15530   reconcileChildren(current$$1, workInProgress, newChildren, renderExpirationTime);
       
 15531   return workInProgress.child;
       
 15532 }
       
 15533 
       
 15534 var hasWarnedAboutUsingContextAsConsumer = false;
       
 15535 
       
 15536 function updateContextConsumer(current$$1, workInProgress, renderExpirationTime) {
       
 15537   var context = workInProgress.type;
       
 15538   // The logic below for Context differs depending on PROD or DEV mode. In
       
 15539   // DEV mode, we create a separate object for Context.Consumer that acts
       
 15540   // like a proxy to Context. This proxy object adds unnecessary code in PROD
       
 15541   // so we use the old behaviour (Context.Consumer references Context) to
       
 15542   // reduce size and overhead. The separate object references context via
       
 15543   // a property called "_context", which also gives us the ability to check
       
 15544   // in DEV mode if this property exists or not and warn if it does not.
       
 15545   {
       
 15546     if (context._context === undefined) {
       
 15547       // This may be because it's a Context (rather than a Consumer).
       
 15548       // Or it may be because it's older React where they're the same thing.
       
 15549       // We only want to warn if we're sure it's a new React.
       
 15550       if (context !== context.Consumer) {
       
 15551         if (!hasWarnedAboutUsingContextAsConsumer) {
       
 15552           hasWarnedAboutUsingContextAsConsumer = true;
       
 15553           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?');
       
 15554         }
       
 15555       }
       
 15556     } else {
       
 15557       context = context._context;
       
 15558     }
       
 15559   }
       
 15560   var newProps = workInProgress.pendingProps;
       
 15561   var render = newProps.children;
       
 15562 
       
 15563   {
       
 15564     !(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;
       
 15565   }
       
 15566 
       
 15567   prepareToReadContext(workInProgress, renderExpirationTime);
       
 15568   var newValue = readContext(context, newProps.unstable_observedBits);
       
 15569   var newChildren = void 0;
       
 15570   {
       
 15571     ReactCurrentOwner$3.current = workInProgress;
       
 15572     setCurrentPhase('render');
       
 15573     newChildren = render(newValue);
       
 15574     setCurrentPhase(null);
       
 15575   }
       
 15576 
       
 15577   // React DevTools reads this flag.
       
 15578   workInProgress.effectTag |= PerformedWork;
       
 15579   reconcileChildren(current$$1, workInProgress, newChildren, renderExpirationTime);
       
 15580   return workInProgress.child;
       
 15581 }
       
 15582 
       
 15583 function markWorkInProgressReceivedUpdate() {
       
 15584   didReceiveUpdate = true;
       
 15585 }
       
 15586 
       
 15587 function bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirationTime) {
       
 15588   cancelWorkTimer(workInProgress);
       
 15589 
       
 15590   if (current$$1 !== null) {
       
 15591     // Reuse previous context list
       
 15592     workInProgress.contextDependencies = current$$1.contextDependencies;
       
 15593   }
       
 15594 
       
 15595   if (enableProfilerTimer) {
       
 15596     // Don't update "base" render times for bailouts.
       
 15597     stopProfilerTimerIfRunning(workInProgress);
       
 15598   }
       
 15599 
       
 15600   // Check if the children have any pending work.
       
 15601   var childExpirationTime = workInProgress.childExpirationTime;
       
 15602   if (childExpirationTime < renderExpirationTime) {
       
 15603     // The children don't have any work either. We can skip them.
       
 15604     // TODO: Once we add back resuming, we should check if the children are
       
 15605     // a work-in-progress set. If so, we need to transfer their effects.
       
 15606     return null;
       
 15607   } else {
       
 15608     // This fiber doesn't have work, but its subtree does. Clone the child
       
 15609     // fibers and continue.
       
 15610     cloneChildFibers(current$$1, workInProgress);
       
 15611     return workInProgress.child;
       
 15612   }
       
 15613 }
       
 15614 
       
 15615 function beginWork(current$$1, workInProgress, renderExpirationTime) {
       
 15616   var updateExpirationTime = workInProgress.expirationTime;
       
 15617 
       
 15618   if (current$$1 !== null) {
       
 15619     var oldProps = current$$1.memoizedProps;
       
 15620     var newProps = workInProgress.pendingProps;
       
 15621 
       
 15622     if (oldProps !== newProps || hasContextChanged()) {
       
 15623       // If props or context changed, mark the fiber as having performed work.
       
 15624       // This may be unset if the props are determined to be equal later (memo).
       
 15625       didReceiveUpdate = true;
       
 15626     } else if (updateExpirationTime < renderExpirationTime) {
       
 15627       didReceiveUpdate = false;
       
 15628       // This fiber does not have any pending work. Bailout without entering
       
 15629       // the begin phase. There's still some bookkeeping we that needs to be done
       
 15630       // in this optimized path, mostly pushing stuff onto the stack.
       
 15631       switch (workInProgress.tag) {
       
 15632         case HostRoot:
       
 15633           pushHostRootContext(workInProgress);
       
 15634           resetHydrationState();
       
 15635           break;
       
 15636         case HostComponent:
       
 15637           pushHostContext(workInProgress);
       
 15638           break;
       
 15639         case ClassComponent:
       
 15640           {
       
 15641             var Component = workInProgress.type;
       
 15642             if (isContextProvider(Component)) {
       
 15643               pushContextProvider(workInProgress);
       
 15644             }
       
 15645             break;
       
 15646           }
       
 15647         case HostPortal:
       
 15648           pushHostContainer(workInProgress, workInProgress.stateNode.containerInfo);
       
 15649           break;
       
 15650         case ContextProvider:
       
 15651           {
       
 15652             var newValue = workInProgress.memoizedProps.value;
       
 15653             pushProvider(workInProgress, newValue);
       
 15654             break;
       
 15655           }
       
 15656         case Profiler:
       
 15657           if (enableProfilerTimer) {
       
 15658             workInProgress.effectTag |= Update;
       
 15659           }
       
 15660           break;
       
 15661         case SuspenseComponent:
       
 15662           {
       
 15663             var state = workInProgress.memoizedState;
       
 15664             var didTimeout = state !== null;
       
 15665             if (didTimeout) {
       
 15666               // If this boundary is currently timed out, we need to decide
       
 15667               // whether to retry the primary children, or to skip over it and
       
 15668               // go straight to the fallback. Check the priority of the primary
       
 15669               var primaryChildFragment = workInProgress.child;
       
 15670               var primaryChildExpirationTime = primaryChildFragment.childExpirationTime;
       
 15671               if (primaryChildExpirationTime !== NoWork && primaryChildExpirationTime >= renderExpirationTime) {
       
 15672                 // The primary children have pending work. Use the normal path
       
 15673                 // to attempt to render the primary children again.
       
 15674                 return updateSuspenseComponent(current$$1, workInProgress, renderExpirationTime);
       
 15675               } else {
       
 15676                 // The primary children do not have pending work with sufficient
       
 15677                 // priority. Bailout.
       
 15678                 var child = bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirationTime);
       
 15679                 if (child !== null) {
       
 15680                   // The fallback children have pending work. Skip over the
       
 15681                   // primary children and work on the fallback.
       
 15682                   return child.sibling;
       
 15683                 } else {
       
 15684                   return null;
       
 15685                 }
       
 15686               }
       
 15687             }
       
 15688             break;
       
 15689           }
       
 15690         case DehydratedSuspenseComponent:
       
 15691           {
       
 15692             if (enableSuspenseServerRenderer) {
       
 15693               // We know that this component will suspend again because if it has
       
 15694               // been unsuspended it has committed as a regular Suspense component.
       
 15695               // If it needs to be retried, it should have work scheduled on it.
       
 15696               workInProgress.effectTag |= DidCapture;
       
 15697               break;
       
 15698             }
       
 15699           }
       
 15700       }
       
 15701       return bailoutOnAlreadyFinishedWork(current$$1, workInProgress, renderExpirationTime);
       
 15702     }
       
 15703   } else {
       
 15704     didReceiveUpdate = false;
       
 15705   }
       
 15706 
       
 15707   // Before entering the begin phase, clear the expiration time.
       
 15708   workInProgress.expirationTime = NoWork;
       
 15709 
       
 15710   switch (workInProgress.tag) {
       
 15711     case IndeterminateComponent:
       
 15712       {
       
 15713         var elementType = workInProgress.elementType;
       
 15714         return mountIndeterminateComponent(current$$1, workInProgress, elementType, renderExpirationTime);
       
 15715       }
       
 15716     case LazyComponent:
       
 15717       {
       
 15718         var _elementType = workInProgress.elementType;
       
 15719         return mountLazyComponent(current$$1, workInProgress, _elementType, updateExpirationTime, renderExpirationTime);
       
 15720       }
       
 15721     case FunctionComponent:
       
 15722       {
       
 15723         var _Component = workInProgress.type;
       
 15724         var unresolvedProps = workInProgress.pendingProps;
       
 15725         var resolvedProps = workInProgress.elementType === _Component ? unresolvedProps : resolveDefaultProps(_Component, unresolvedProps);
       
 15726         return updateFunctionComponent(current$$1, workInProgress, _Component, resolvedProps, renderExpirationTime);
       
 15727       }
       
 15728     case ClassComponent:
       
 15729       {
       
 15730         var _Component2 = workInProgress.type;
       
 15731         var _unresolvedProps = workInProgress.pendingProps;
       
 15732         var _resolvedProps = workInProgress.elementType === _Component2 ? _unresolvedProps : resolveDefaultProps(_Component2, _unresolvedProps);
       
 15733         return updateClassComponent(current$$1, workInProgress, _Component2, _resolvedProps, renderExpirationTime);
       
 15734       }
       
 15735     case HostRoot:
       
 15736       return updateHostRoot(current$$1, workInProgress, renderExpirationTime);
       
 15737     case HostComponent:
       
 15738       return updateHostComponent(current$$1, workInProgress, renderExpirationTime);
       
 15739     case HostText:
       
 15740       return updateHostText(current$$1, workInProgress);
       
 15741     case SuspenseComponent:
       
 15742       return updateSuspenseComponent(current$$1, workInProgress, renderExpirationTime);
       
 15743     case HostPortal:
       
 15744       return updatePortalComponent(current$$1, workInProgress, renderExpirationTime);
       
 15745     case ForwardRef:
       
 15746       {
       
 15747         var type = workInProgress.type;
       
 15748         var _unresolvedProps2 = workInProgress.pendingProps;
       
 15749         var _resolvedProps2 = workInProgress.elementType === type ? _unresolvedProps2 : resolveDefaultProps(type, _unresolvedProps2);
       
 15750         return updateForwardRef(current$$1, workInProgress, type, _resolvedProps2, renderExpirationTime);
       
 15751       }
       
 15752     case Fragment:
       
 15753       return updateFragment(current$$1, workInProgress, renderExpirationTime);
       
 15754     case Mode:
       
 15755       return updateMode(current$$1, workInProgress, renderExpirationTime);
       
 15756     case Profiler:
       
 15757       return updateProfiler(current$$1, workInProgress, renderExpirationTime);
       
 15758     case ContextProvider:
       
 15759       return updateContextProvider(current$$1, workInProgress, renderExpirationTime);
       
 15760     case ContextConsumer:
       
 15761       return updateContextConsumer(current$$1, workInProgress, renderExpirationTime);
       
 15762     case MemoComponent:
       
 15763       {
       
 15764         var _type2 = workInProgress.type;
       
 15765         var _unresolvedProps3 = workInProgress.pendingProps;
       
 15766         // Resolve outer props first, then resolve inner props.
       
 15767         var _resolvedProps3 = resolveDefaultProps(_type2, _unresolvedProps3);
       
 15768         {
       
 15769           if (workInProgress.type !== workInProgress.elementType) {
       
 15770             var outerPropTypes = _type2.propTypes;
       
 15771             if (outerPropTypes) {
       
 15772               checkPropTypes_1(outerPropTypes, _resolvedProps3, // Resolved for outer only
       
 15773               'prop', getComponentName(_type2), getCurrentFiberStackInDev);
       
 15774             }
       
 15775           }
       
 15776         }
       
 15777         _resolvedProps3 = resolveDefaultProps(_type2.type, _resolvedProps3);
       
 15778         return updateMemoComponent(current$$1, workInProgress, _type2, _resolvedProps3, updateExpirationTime, renderExpirationTime);
       
 15779       }
       
 15780     case SimpleMemoComponent:
       
 15781       {
       
 15782         return updateSimpleMemoComponent(current$$1, workInProgress, workInProgress.type, workInProgress.pendingProps, updateExpirationTime, renderExpirationTime);
       
 15783       }
       
 15784     case IncompleteClassComponent:
       
 15785       {
       
 15786         var _Component3 = workInProgress.type;
       
 15787         var _unresolvedProps4 = workInProgress.pendingProps;
       
 15788         var _resolvedProps4 = workInProgress.elementType === _Component3 ? _unresolvedProps4 : resolveDefaultProps(_Component3, _unresolvedProps4);
       
 15789         return mountIncompleteClassComponent(current$$1, workInProgress, _Component3, _resolvedProps4, renderExpirationTime);
       
 15790       }
       
 15791     case DehydratedSuspenseComponent:
       
 15792       {
       
 15793         if (enableSuspenseServerRenderer) {
       
 15794           return updateDehydratedSuspenseComponent(current$$1, workInProgress, renderExpirationTime);
       
 15795         }
       
 15796         break;
       
 15797       }
       
 15798   }
       
 15799   invariant(false, 'Unknown unit of work tag. This error is likely caused by a bug in React. Please file an issue.');
       
 15800 }
       
 15801 
       
 15802 var valueCursor = createCursor(null);
       
 15803 
       
 15804 var rendererSigil = void 0;
       
 15805 {
       
 15806   // Use this to detect multiple renderers using the same context
       
 15807   rendererSigil = {};
       
 15808 }
       
 15809 
       
 15810 var currentlyRenderingFiber = null;
       
 15811 var lastContextDependency = null;
       
 15812 var lastContextWithAllBitsObserved = null;
       
 15813 
       
 15814 var isDisallowedContextReadInDEV = false;
       
 15815 
       
 15816 function resetContextDependences() {
       
 15817   // This is called right before React yields execution, to ensure `readContext`
       
 15818   // cannot be called outside the render phase.
       
 15819   currentlyRenderingFiber = null;
       
 15820   lastContextDependency = null;
       
 15821   lastContextWithAllBitsObserved = null;
       
 15822   {
       
 15823     isDisallowedContextReadInDEV = false;
       
 15824   }
       
 15825 }
       
 15826 
       
 15827 function enterDisallowedContextReadInDEV() {
       
 15828   {
       
 15829     isDisallowedContextReadInDEV = true;
       
 15830   }
       
 15831 }
       
 15832 
       
 15833 function exitDisallowedContextReadInDEV() {
       
 15834   {
       
 15835     isDisallowedContextReadInDEV = false;
       
 15836   }
       
 15837 }
       
 15838 
       
 15839 function pushProvider(providerFiber, nextValue) {
       
 15840   var context = providerFiber.type._context;
       
 15841 
       
 15842   if (isPrimaryRenderer) {
       
 15843     push(valueCursor, context._currentValue, providerFiber);
       
 15844 
       
 15845     context._currentValue = nextValue;
       
 15846     {
       
 15847       !(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;
       
 15848       context._currentRenderer = rendererSigil;
       
 15849     }
       
 15850   } else {
       
 15851     push(valueCursor, context._currentValue2, providerFiber);
       
 15852 
       
 15853     context._currentValue2 = nextValue;
       
 15854     {
       
 15855       !(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;
       
 15856       context._currentRenderer2 = rendererSigil;
       
 15857     }
       
 15858   }
       
 15859 }
       
 15860 
       
 15861 function popProvider(providerFiber) {
       
 15862   var currentValue = valueCursor.current;
       
 15863 
       
 15864   pop(valueCursor, providerFiber);
       
 15865 
       
 15866   var context = providerFiber.type._context;
       
 15867   if (isPrimaryRenderer) {
       
 15868     context._currentValue = currentValue;
       
 15869   } else {
       
 15870     context._currentValue2 = currentValue;
       
 15871   }
       
 15872 }
       
 15873 
       
 15874 function calculateChangedBits(context, newValue, oldValue) {
       
 15875   if (is(oldValue, newValue)) {
       
 15876     // No change
       
 15877     return 0;
       
 15878   } else {
       
 15879     var changedBits = typeof context._calculateChangedBits === 'function' ? context._calculateChangedBits(oldValue, newValue) : maxSigned31BitInt;
       
 15880 
       
 15881     {
       
 15882       !((changedBits & maxSigned31BitInt) === changedBits) ? warning$1(false, 'calculateChangedBits: Expected the return value to be a ' + '31-bit integer. Instead received: %s', changedBits) : void 0;
       
 15883     }
       
 15884     return changedBits | 0;
       
 15885   }
       
 15886 }
       
 15887 
       
 15888 function scheduleWorkOnParentPath(parent, renderExpirationTime) {
       
 15889   // Update the child expiration time of all the ancestors, including
       
 15890   // the alternates.
       
 15891   var node = parent;
       
 15892   while (node !== null) {
       
 15893     var alternate = node.alternate;
       
 15894     if (node.childExpirationTime < renderExpirationTime) {
       
 15895       node.childExpirationTime = renderExpirationTime;
       
 15896       if (alternate !== null && alternate.childExpirationTime < renderExpirationTime) {
       
 15897         alternate.childExpirationTime = renderExpirationTime;
       
 15898       }
       
 15899     } else if (alternate !== null && alternate.childExpirationTime < renderExpirationTime) {
       
 15900       alternate.childExpirationTime = renderExpirationTime;
       
 15901     } else {
       
 15902       // Neither alternate was updated, which means the rest of the
       
 15903       // ancestor path already has sufficient priority.
       
 15904       break;
       
 15905     }
       
 15906     node = node.return;
       
 15907   }
       
 15908 }
       
 15909 
       
 15910 function propagateContextChange(workInProgress, context, changedBits, renderExpirationTime) {
       
 15911   var fiber = workInProgress.child;
       
 15912   if (fiber !== null) {
       
 15913     // Set the return pointer of the child to the work-in-progress fiber.
       
 15914     fiber.return = workInProgress;
       
 15915   }
       
 15916   while (fiber !== null) {
       
 15917     var nextFiber = void 0;
       
 15918 
       
 15919     // Visit this fiber.
       
 15920     var list = fiber.contextDependencies;
       
 15921     if (list !== null) {
       
 15922       nextFiber = fiber.child;
       
 15923 
       
 15924       var dependency = list.first;
       
 15925       while (dependency !== null) {
       
 15926         // Check if the context matches.
       
 15927         if (dependency.context === context && (dependency.observedBits & changedBits) !== 0) {
       
 15928           // Match! Schedule an update on this fiber.
       
 15929 
       
 15930           if (fiber.tag === ClassComponent) {
       
 15931             // Schedule a force update on the work-in-progress.
       
 15932             var update = createUpdate(renderExpirationTime);
       
 15933             update.tag = ForceUpdate;
       
 15934             // TODO: Because we don't have a work-in-progress, this will add the
       
 15935             // update to the current fiber, too, which means it will persist even if
       
 15936             // this render is thrown away. Since it's a race condition, not sure it's
       
 15937             // worth fixing.
       
 15938             enqueueUpdate(fiber, update);
       
 15939           }
       
 15940 
       
 15941           if (fiber.expirationTime < renderExpirationTime) {
       
 15942             fiber.expirationTime = renderExpirationTime;
       
 15943           }
       
 15944           var alternate = fiber.alternate;
       
 15945           if (alternate !== null && alternate.expirationTime < renderExpirationTime) {
       
 15946             alternate.expirationTime = renderExpirationTime;
       
 15947           }
       
 15948 
       
 15949           scheduleWorkOnParentPath(fiber.return, renderExpirationTime);
       
 15950 
       
 15951           // Mark the expiration time on the list, too.
       
 15952           if (list.expirationTime < renderExpirationTime) {
       
 15953             list.expirationTime = renderExpirationTime;
       
 15954           }
       
 15955 
       
 15956           // Since we already found a match, we can stop traversing the
       
 15957           // dependency list.
       
 15958           break;
       
 15959         }
       
 15960         dependency = dependency.next;
       
 15961       }
       
 15962     } else if (fiber.tag === ContextProvider) {
       
 15963       // Don't scan deeper if this is a matching provider
       
 15964       nextFiber = fiber.type === workInProgress.type ? null : fiber.child;
       
 15965     } else if (enableSuspenseServerRenderer && fiber.tag === DehydratedSuspenseComponent) {
       
 15966       // If a dehydrated suspense component is in this subtree, we don't know
       
 15967       // if it will have any context consumers in it. The best we can do is
       
 15968       // mark it as having updates on its children.
       
 15969       if (fiber.expirationTime < renderExpirationTime) {
       
 15970         fiber.expirationTime = renderExpirationTime;
       
 15971       }
       
 15972       var _alternate = fiber.alternate;
       
 15973       if (_alternate !== null && _alternate.expirationTime < renderExpirationTime) {
       
 15974         _alternate.expirationTime = renderExpirationTime;
       
 15975       }
       
 15976       // This is intentionally passing this fiber as the parent
       
 15977       // because we want to schedule this fiber as having work
       
 15978       // on its children. We'll use the childExpirationTime on
       
 15979       // this fiber to indicate that a context has changed.
       
 15980       scheduleWorkOnParentPath(fiber, renderExpirationTime);
       
 15981       nextFiber = fiber.sibling;
       
 15982     } else {
       
 15983       // Traverse down.
       
 15984       nextFiber = fiber.child;
       
 15985     }
       
 15986 
       
 15987     if (nextFiber !== null) {
       
 15988       // Set the return pointer of the child to the work-in-progress fiber.
       
 15989       nextFiber.return = fiber;
       
 15990     } else {
       
 15991       // No child. Traverse to next sibling.
       
 15992       nextFiber = fiber;
       
 15993       while (nextFiber !== null) {
       
 15994         if (nextFiber === workInProgress) {
       
 15995           // We're back to the root of this subtree. Exit.
       
 15996           nextFiber = null;
       
 15997           break;
       
 15998         }
       
 15999         var sibling = nextFiber.sibling;
       
 16000         if (sibling !== null) {
       
 16001           // Set the return pointer of the sibling to the work-in-progress fiber.
       
 16002           sibling.return = nextFiber.return;
       
 16003           nextFiber = sibling;
       
 16004           break;
       
 16005         }
       
 16006         // No more siblings. Traverse up.
       
 16007         nextFiber = nextFiber.return;
       
 16008       }
       
 16009     }
       
 16010     fiber = nextFiber;
       
 16011   }
       
 16012 }
       
 16013 
       
 16014 function prepareToReadContext(workInProgress, renderExpirationTime) {
       
 16015   currentlyRenderingFiber = workInProgress;
       
 16016   lastContextDependency = null;
       
 16017   lastContextWithAllBitsObserved = null;
       
 16018 
       
 16019   var currentDependencies = workInProgress.contextDependencies;
       
 16020   if (currentDependencies !== null && currentDependencies.expirationTime >= renderExpirationTime) {
       
 16021     // Context list has a pending update. Mark that this fiber performed work.
       
 16022     markWorkInProgressReceivedUpdate();
       
 16023   }
       
 16024 
       
 16025   // Reset the work-in-progress list
       
 16026   workInProgress.contextDependencies = null;
       
 16027 }
       
 16028 
       
 16029 function readContext(context, observedBits) {
       
 16030   {
       
 16031     // This warning would fire if you read context inside a Hook like useMemo.
       
 16032     // Unlike the class check below, it's not enforced in production for perf.
       
 16033     !!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;
       
 16034   }
       
 16035 
       
 16036   if (lastContextWithAllBitsObserved === context) {
       
 16037     // Nothing to do. We already observe everything in this context.
       
 16038   } else if (observedBits === false || observedBits === 0) {
       
 16039     // Do not observe any updates.
       
 16040   } else {
       
 16041     var resolvedObservedBits = void 0; // Avoid deopting on observable arguments or heterogeneous types.
       
 16042     if (typeof observedBits !== 'number' || observedBits === maxSigned31BitInt) {
       
 16043       // Observe all updates.
       
 16044       lastContextWithAllBitsObserved = context;
       
 16045       resolvedObservedBits = maxSigned31BitInt;
       
 16046     } else {
       
 16047       resolvedObservedBits = observedBits;
       
 16048     }
       
 16049 
       
 16050     var contextItem = {
       
 16051       context: context,
       
 16052       observedBits: resolvedObservedBits,
       
 16053       next: null
       
 16054     };
       
 16055 
       
 16056     if (lastContextDependency === null) {
       
 16057       !(currentlyRenderingFiber !== null) ? invariant(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;
       
 16058 
       
 16059       // This is the first dependency for this component. Create a new list.
       
 16060       lastContextDependency = contextItem;
       
 16061       currentlyRenderingFiber.contextDependencies = {
       
 16062         first: contextItem,
       
 16063         expirationTime: NoWork
       
 16064       };
       
 16065     } else {
       
 16066       // Append a new context item.
       
 16067       lastContextDependency = lastContextDependency.next = contextItem;
       
 16068     }
       
 16069   }
       
 16070   return isPrimaryRenderer ? context._currentValue : context._currentValue2;
       
 16071 }
       
 16072 
       
 16073 // UpdateQueue is a linked list of prioritized updates.
       
 16074 //
       
 16075 // Like fibers, update queues come in pairs: a current queue, which represents
       
 16076 // the visible state of the screen, and a work-in-progress queue, which can be
       
 16077 // mutated and processed asynchronously before it is committed — a form of
       
 16078 // double buffering. If a work-in-progress render is discarded before finishing,
       
 16079 // we create a new work-in-progress by cloning the current queue.
       
 16080 //
       
 16081 // Both queues share a persistent, singly-linked list structure. To schedule an
       
 16082 // update, we append it to the end of both queues. Each queue maintains a
       
 16083 // pointer to first update in the persistent list that hasn't been processed.
       
 16084 // The work-in-progress pointer always has a position equal to or greater than
       
 16085 // the current queue, since we always work on that one. The current queue's
       
 16086 // pointer is only updated during the commit phase, when we swap in the
       
 16087 // work-in-progress.
       
 16088 //
       
 16089 // For example:
       
 16090 //
       
 16091 //   Current pointer:           A - B - C - D - E - F
       
 16092 //   Work-in-progress pointer:              D - E - F
       
 16093 //                                          ^
       
 16094 //                                          The work-in-progress queue has
       
 16095 //                                          processed more updates than current.
       
 16096 //
       
 16097 // The reason we append to both queues is because otherwise we might drop
       
 16098 // updates without ever processing them. For example, if we only add updates to
       
 16099 // the work-in-progress queue, some updates could be lost whenever a work-in
       
 16100 // -progress render restarts by cloning from current. Similarly, if we only add
       
 16101 // updates to the current queue, the updates will be lost whenever an already
       
 16102 // in-progress queue commits and swaps with the current queue. However, by
       
 16103 // adding to both queues, we guarantee that the update will be part of the next
       
 16104 // work-in-progress. (And because the work-in-progress queue becomes the
       
 16105 // current queue once it commits, there's no danger of applying the same
       
 16106 // update twice.)
       
 16107 //
       
 16108 // Prioritization
       
 16109 // --------------
       
 16110 //
       
 16111 // Updates are not sorted by priority, but by insertion; new updates are always
       
 16112 // appended to the end of the list.
       
 16113 //
       
 16114 // The priority is still important, though. When processing the update queue
       
 16115 // during the render phase, only the updates with sufficient priority are
       
 16116 // included in the result. If we skip an update because it has insufficient
       
 16117 // priority, it remains in the queue to be processed later, during a lower
       
 16118 // priority render. Crucially, all updates subsequent to a skipped update also
       
 16119 // remain in the queue *regardless of their priority*. That means high priority
       
 16120 // updates are sometimes processed twice, at two separate priorities. We also
       
 16121 // keep track of a base state, that represents the state before the first
       
 16122 // update in the queue is applied.
       
 16123 //
       
 16124 // For example:
       
 16125 //
       
 16126 //   Given a base state of '', and the following queue of updates
       
 16127 //
       
 16128 //     A1 - B2 - C1 - D2
       
 16129 //
       
 16130 //   where the number indicates the priority, and the update is applied to the
       
 16131 //   previous state by appending a letter, React will process these updates as
       
 16132 //   two separate renders, one per distinct priority level:
       
 16133 //
       
 16134 //   First render, at priority 1:
       
 16135 //     Base state: ''
       
 16136 //     Updates: [A1, C1]
       
 16137 //     Result state: 'AC'
       
 16138 //
       
 16139 //   Second render, at priority 2:
       
 16140 //     Base state: 'A'            <-  The base state does not include C1,
       
 16141 //                                    because B2 was skipped.
       
 16142 //     Updates: [B2, C1, D2]      <-  C1 was rebased on top of B2
       
 16143 //     Result state: 'ABCD'
       
 16144 //
       
 16145 // Because we process updates in insertion order, and rebase high priority
       
 16146 // updates when preceding updates are skipped, the final result is deterministic
       
 16147 // regardless of priority. Intermediate state may vary according to system
       
 16148 // resources, but the final state is always the same.
       
 16149 
       
 16150 var UpdateState = 0;
       
 16151 var ReplaceState = 1;
       
 16152 var ForceUpdate = 2;
       
 16153 var CaptureUpdate = 3;
       
 16154 
       
 16155 // Global state that is reset at the beginning of calling `processUpdateQueue`.
       
 16156 // It should only be read right after calling `processUpdateQueue`, via
       
 16157 // `checkHasForceUpdateAfterProcessing`.
       
 16158 var hasForceUpdate = false;
       
 16159 
       
 16160 var didWarnUpdateInsideUpdate = void 0;
       
 16161 var currentlyProcessingQueue = void 0;
       
 16162 var resetCurrentlyProcessingQueue = void 0;
       
 16163 {
       
 16164   didWarnUpdateInsideUpdate = false;
       
 16165   currentlyProcessingQueue = null;
       
 16166   resetCurrentlyProcessingQueue = function () {
       
 16167     currentlyProcessingQueue = null;
       
 16168   };
       
 16169 }
       
 16170 
       
 16171 function createUpdateQueue(baseState) {
       
 16172   var queue = {
       
 16173     baseState: baseState,
       
 16174     firstUpdate: null,
       
 16175     lastUpdate: null,
       
 16176     firstCapturedUpdate: null,
       
 16177     lastCapturedUpdate: null,
       
 16178     firstEffect: null,
       
 16179     lastEffect: null,
       
 16180     firstCapturedEffect: null,
       
 16181     lastCapturedEffect: null
       
 16182   };
       
 16183   return queue;
       
 16184 }
       
 16185 
       
 16186 function cloneUpdateQueue(currentQueue) {
       
 16187   var queue = {
       
 16188     baseState: currentQueue.baseState,
       
 16189     firstUpdate: currentQueue.firstUpdate,
       
 16190     lastUpdate: currentQueue.lastUpdate,
       
 16191 
       
 16192     // TODO: With resuming, if we bail out and resuse the child tree, we should
       
 16193     // keep these effects.
       
 16194     firstCapturedUpdate: null,
       
 16195     lastCapturedUpdate: null,
       
 16196 
       
 16197     firstEffect: null,
       
 16198     lastEffect: null,
       
 16199 
       
 16200     firstCapturedEffect: null,
       
 16201     lastCapturedEffect: null
       
 16202   };
       
 16203   return queue;
       
 16204 }
       
 16205 
       
 16206 function createUpdate(expirationTime) {
       
 16207   return {
       
 16208     expirationTime: expirationTime,
       
 16209 
       
 16210     tag: UpdateState,
       
 16211     payload: null,
       
 16212     callback: null,
       
 16213 
       
 16214     next: null,
       
 16215     nextEffect: null
       
 16216   };
       
 16217 }
       
 16218 
       
 16219 function appendUpdateToQueue(queue, update) {
       
 16220   // Append the update to the end of the list.
       
 16221   if (queue.lastUpdate === null) {
       
 16222     // Queue is empty
       
 16223     queue.firstUpdate = queue.lastUpdate = update;
       
 16224   } else {
       
 16225     queue.lastUpdate.next = update;
       
 16226     queue.lastUpdate = update;
       
 16227   }
       
 16228 }
       
 16229 
       
 16230 function enqueueUpdate(fiber, update) {
       
 16231   // Update queues are created lazily.
       
 16232   var alternate = fiber.alternate;
       
 16233   var queue1 = void 0;
       
 16234   var queue2 = void 0;
       
 16235   if (alternate === null) {
       
 16236     // There's only one fiber.
       
 16237     queue1 = fiber.updateQueue;
       
 16238     queue2 = null;
       
 16239     if (queue1 === null) {
       
 16240       queue1 = fiber.updateQueue = createUpdateQueue(fiber.memoizedState);
       
 16241     }
       
 16242   } else {
       
 16243     // There are two owners.
       
 16244     queue1 = fiber.updateQueue;
       
 16245     queue2 = alternate.updateQueue;
       
 16246     if (queue1 === null) {
       
 16247       if (queue2 === null) {
       
 16248         // Neither fiber has an update queue. Create new ones.
       
 16249         queue1 = fiber.updateQueue = createUpdateQueue(fiber.memoizedState);
       
 16250         queue2 = alternate.updateQueue = createUpdateQueue(alternate.memoizedState);
       
 16251       } else {
       
 16252         // Only one fiber has an update queue. Clone to create a new one.
       
 16253         queue1 = fiber.updateQueue = cloneUpdateQueue(queue2);
       
 16254       }
       
 16255     } else {
       
 16256       if (queue2 === null) {
       
 16257         // Only one fiber has an update queue. Clone to create a new one.
       
 16258         queue2 = alternate.updateQueue = cloneUpdateQueue(queue1);
       
 16259       } else {
       
 16260         // Both owners have an update queue.
       
 16261       }
       
 16262     }
       
 16263   }
       
 16264   if (queue2 === null || queue1 === queue2) {
       
 16265     // There's only a single queue.
       
 16266     appendUpdateToQueue(queue1, update);
       
 16267   } else {
       
 16268     // There are two queues. We need to append the update to both queues,
       
 16269     // while accounting for the persistent structure of the list — we don't
       
 16270     // want the same update to be added multiple times.
       
 16271     if (queue1.lastUpdate === null || queue2.lastUpdate === null) {
       
 16272       // One of the queues is not empty. We must add the update to both queues.
       
 16273       appendUpdateToQueue(queue1, update);
       
 16274       appendUpdateToQueue(queue2, update);
       
 16275     } else {
       
 16276       // Both queues are non-empty. The last update is the same in both lists,
       
 16277       // because of structural sharing. So, only append to one of the lists.
       
 16278       appendUpdateToQueue(queue1, update);
       
 16279       // But we still need to update the `lastUpdate` pointer of queue2.
       
 16280       queue2.lastUpdate = update;
       
 16281     }
       
 16282   }
       
 16283 
       
 16284   {
       
 16285     if (fiber.tag === ClassComponent && (currentlyProcessingQueue === queue1 || queue2 !== null && currentlyProcessingQueue === queue2) && !didWarnUpdateInsideUpdate) {
       
 16286       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.');
       
 16287       didWarnUpdateInsideUpdate = true;
       
 16288     }
       
 16289   }
       
 16290 }
       
 16291 
       
 16292 function enqueueCapturedUpdate(workInProgress, update) {
       
 16293   // Captured updates go into a separate list, and only on the work-in-
       
 16294   // progress queue.
       
 16295   var workInProgressQueue = workInProgress.updateQueue;
       
 16296   if (workInProgressQueue === null) {
       
 16297     workInProgressQueue = workInProgress.updateQueue = createUpdateQueue(workInProgress.memoizedState);
       
 16298   } else {
       
 16299     // TODO: I put this here rather than createWorkInProgress so that we don't
       
 16300     // clone the queue unnecessarily. There's probably a better way to
       
 16301     // structure this.
       
 16302     workInProgressQueue = ensureWorkInProgressQueueIsAClone(workInProgress, workInProgressQueue);
       
 16303   }
       
 16304 
       
 16305   // Append the update to the end of the list.
       
 16306   if (workInProgressQueue.lastCapturedUpdate === null) {
       
 16307     // This is the first render phase update
       
 16308     workInProgressQueue.firstCapturedUpdate = workInProgressQueue.lastCapturedUpdate = update;
       
 16309   } else {
       
 16310     workInProgressQueue.lastCapturedUpdate.next = update;
       
 16311     workInProgressQueue.lastCapturedUpdate = update;
       
 16312   }
       
 16313 }
       
 16314 
       
 16315 function ensureWorkInProgressQueueIsAClone(workInProgress, queue) {
       
 16316   var current = workInProgress.alternate;
       
 16317   if (current !== null) {
       
 16318     // If the work-in-progress queue is equal to the current queue,
       
 16319     // we need to clone it first.
       
 16320     if (queue === current.updateQueue) {
       
 16321       queue = workInProgress.updateQueue = cloneUpdateQueue(queue);
       
 16322     }
       
 16323   }
       
 16324   return queue;
       
 16325 }
       
 16326 
       
 16327 function getStateFromUpdate(workInProgress, queue, update, prevState, nextProps, instance) {
       
 16328   switch (update.tag) {
       
 16329     case ReplaceState:
       
 16330       {
       
 16331         var _payload = update.payload;
       
 16332         if (typeof _payload === 'function') {
       
 16333           // Updater function
       
 16334           {
       
 16335             enterDisallowedContextReadInDEV();
       
 16336             if (debugRenderPhaseSideEffects || debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
       
 16337               _payload.call(instance, prevState, nextProps);
       
 16338             }
       
 16339           }
       
 16340           var nextState = _payload.call(instance, prevState, nextProps);
       
 16341           {
       
 16342             exitDisallowedContextReadInDEV();
       
 16343           }
       
 16344           return nextState;
       
 16345         }
       
 16346         // State object
       
 16347         return _payload;
       
 16348       }
       
 16349     case CaptureUpdate:
       
 16350       {
       
 16351         workInProgress.effectTag = workInProgress.effectTag & ~ShouldCapture | DidCapture;
       
 16352       }
       
 16353     // Intentional fallthrough
       
 16354     case UpdateState:
       
 16355       {
       
 16356         var _payload2 = update.payload;
       
 16357         var partialState = void 0;
       
 16358         if (typeof _payload2 === 'function') {
       
 16359           // Updater function
       
 16360           {
       
 16361             enterDisallowedContextReadInDEV();
       
 16362             if (debugRenderPhaseSideEffects || debugRenderPhaseSideEffectsForStrictMode && workInProgress.mode & StrictMode) {
       
 16363               _payload2.call(instance, prevState, nextProps);
       
 16364             }
       
 16365           }
       
 16366           partialState = _payload2.call(instance, prevState, nextProps);
       
 16367           {
       
 16368             exitDisallowedContextReadInDEV();
       
 16369           }
       
 16370         } else {
       
 16371           // Partial state object
       
 16372           partialState = _payload2;
       
 16373         }
       
 16374         if (partialState === null || partialState === undefined) {
       
 16375           // Null and undefined are treated as no-ops.
       
 16376           return prevState;
       
 16377         }
       
 16378         // Merge the partial state and the previous state.
       
 16379         return _assign({}, prevState, partialState);
       
 16380       }
       
 16381     case ForceUpdate:
       
 16382       {
       
 16383         hasForceUpdate = true;
       
 16384         return prevState;
       
 16385       }
       
 16386   }
       
 16387   return prevState;
       
 16388 }
       
 16389 
       
 16390 function processUpdateQueue(workInProgress, queue, props, instance, renderExpirationTime) {
       
 16391   hasForceUpdate = false;
       
 16392 
       
 16393   queue = ensureWorkInProgressQueueIsAClone(workInProgress, queue);
       
 16394 
       
 16395   {
       
 16396     currentlyProcessingQueue = queue;
       
 16397   }
       
 16398 
       
 16399   // These values may change as we process the queue.
       
 16400   var newBaseState = queue.baseState;
       
 16401   var newFirstUpdate = null;
       
 16402   var newExpirationTime = NoWork;
       
 16403 
       
 16404   // Iterate through the list of updates to compute the result.
       
 16405   var update = queue.firstUpdate;
       
 16406   var resultState = newBaseState;
       
 16407   while (update !== null) {
       
 16408     var updateExpirationTime = update.expirationTime;
       
 16409     if (updateExpirationTime < renderExpirationTime) {
       
 16410       // This update does not have sufficient priority. Skip it.
       
 16411       if (newFirstUpdate === null) {
       
 16412         // This is the first skipped update. It will be the first update in
       
 16413         // the new list.
       
 16414         newFirstUpdate = update;
       
 16415         // Since this is the first update that was skipped, the current result
       
 16416         // is the new base state.
       
 16417         newBaseState = resultState;
       
 16418       }
       
 16419       // Since this update will remain in the list, update the remaining
       
 16420       // expiration time.
       
 16421       if (newExpirationTime < updateExpirationTime) {
       
 16422         newExpirationTime = updateExpirationTime;
       
 16423       }
       
 16424     } else {
       
 16425       // This update does have sufficient priority. Process it and compute
       
 16426       // a new result.
       
 16427       resultState = getStateFromUpdate(workInProgress, queue, update, resultState, props, instance);
       
 16428       var _callback = update.callback;
       
 16429       if (_callback !== null) {
       
 16430         workInProgress.effectTag |= Callback;
       
 16431         // Set this to null, in case it was mutated during an aborted render.
       
 16432         update.nextEffect = null;
       
 16433         if (queue.lastEffect === null) {
       
 16434           queue.firstEffect = queue.lastEffect = update;
       
 16435         } else {
       
 16436           queue.lastEffect.nextEffect = update;
       
 16437           queue.lastEffect = update;
       
 16438         }
       
 16439       }
       
 16440     }
       
 16441     // Continue to the next update.
       
 16442     update = update.next;
       
 16443   }
       
 16444 
       
 16445   // Separately, iterate though the list of captured updates.
       
 16446   var newFirstCapturedUpdate = null;
       
 16447   update = queue.firstCapturedUpdate;
       
 16448   while (update !== null) {
       
 16449     var _updateExpirationTime = update.expirationTime;
       
 16450     if (_updateExpirationTime < renderExpirationTime) {
       
 16451       // This update does not have sufficient priority. Skip it.
       
 16452       if (newFirstCapturedUpdate === null) {
       
 16453         // This is the first skipped captured update. It will be the first
       
 16454         // update in the new list.
       
 16455         newFirstCapturedUpdate = update;
       
 16456         // If this is the first update that was skipped, the current result is
       
 16457         // the new base state.
       
 16458         if (newFirstUpdate === null) {
       
 16459           newBaseState = resultState;
       
 16460         }
       
 16461       }
       
 16462       // Since this update will remain in the list, update the remaining
       
 16463       // expiration time.
       
 16464       if (newExpirationTime < _updateExpirationTime) {
       
 16465         newExpirationTime = _updateExpirationTime;
       
 16466       }
       
 16467     } else {
       
 16468       // This update does have sufficient priority. Process it and compute
       
 16469       // a new result.
       
 16470       resultState = getStateFromUpdate(workInProgress, queue, update, resultState, props, instance);
       
 16471       var _callback2 = update.callback;
       
 16472       if (_callback2 !== null) {
       
 16473         workInProgress.effectTag |= Callback;
       
 16474         // Set this to null, in case it was mutated during an aborted render.
       
 16475         update.nextEffect = null;
       
 16476         if (queue.lastCapturedEffect === null) {
       
 16477           queue.firstCapturedEffect = queue.lastCapturedEffect = update;
       
 16478         } else {
       
 16479           queue.lastCapturedEffect.nextEffect = update;
       
 16480           queue.lastCapturedEffect = update;
       
 16481         }
       
 16482       }
       
 16483     }
       
 16484     update = update.next;
       
 16485   }
       
 16486 
       
 16487   if (newFirstUpdate === null) {
       
 16488     queue.lastUpdate = null;
       
 16489   }
       
 16490   if (newFirstCapturedUpdate === null) {
       
 16491     queue.lastCapturedUpdate = null;
       
 16492   } else {
       
 16493     workInProgress.effectTag |= Callback;
       
 16494   }
       
 16495   if (newFirstUpdate === null && newFirstCapturedUpdate === null) {
       
 16496     // We processed every update, without skipping. That means the new base
       
 16497     // state is the same as the result state.
       
 16498     newBaseState = resultState;
       
 16499   }
       
 16500 
       
 16501   queue.baseState = newBaseState;
       
 16502   queue.firstUpdate = newFirstUpdate;
       
 16503   queue.firstCapturedUpdate = newFirstCapturedUpdate;
       
 16504 
       
 16505   // Set the remaining expiration time to be whatever is remaining in the queue.
       
 16506   // This should be fine because the only two other things that contribute to
       
 16507   // expiration time are props and context. We're already in the middle of the
       
 16508   // begin phase by the time we start processing the queue, so we've already
       
 16509   // dealt with the props. Context in components that specify
       
 16510   // shouldComponentUpdate is tricky; but we'll have to account for
       
 16511   // that regardless.
       
 16512   workInProgress.expirationTime = newExpirationTime;
       
 16513   workInProgress.memoizedState = resultState;
       
 16514 
       
 16515   {
       
 16516     currentlyProcessingQueue = null;
       
 16517   }
       
 16518 }
       
 16519 
       
 16520 function callCallback(callback, context) {
       
 16521   !(typeof callback === 'function') ? invariant(false, 'Invalid argument passed as callback. Expected a function. Instead received: %s', callback) : void 0;
       
 16522   callback.call(context);
       
 16523 }
       
 16524 
       
 16525 function resetHasForceUpdateBeforeProcessing() {
       
 16526   hasForceUpdate = false;
       
 16527 }
       
 16528 
       
 16529 function checkHasForceUpdateAfterProcessing() {
       
 16530   return hasForceUpdate;
       
 16531 }
       
 16532 
       
 16533 function commitUpdateQueue(finishedWork, finishedQueue, instance, renderExpirationTime) {
       
 16534   // If the finished render included captured updates, and there are still
       
 16535   // lower priority updates left over, we need to keep the captured updates
       
 16536   // in the queue so that they are rebased and not dropped once we process the
       
 16537   // queue again at the lower priority.
       
 16538   if (finishedQueue.firstCapturedUpdate !== null) {
       
 16539     // Join the captured update list to the end of the normal list.
       
 16540     if (finishedQueue.lastUpdate !== null) {
       
 16541       finishedQueue.lastUpdate.next = finishedQueue.firstCapturedUpdate;
       
 16542       finishedQueue.lastUpdate = finishedQueue.lastCapturedUpdate;
       
 16543     }
       
 16544     // Clear the list of captured updates.
       
 16545     finishedQueue.firstCapturedUpdate = finishedQueue.lastCapturedUpdate = null;
       
 16546   }
       
 16547 
       
 16548   // Commit the effects
       
 16549   commitUpdateEffects(finishedQueue.firstEffect, instance);
       
 16550   finishedQueue.firstEffect = finishedQueue.lastEffect = null;
       
 16551 
       
 16552   commitUpdateEffects(finishedQueue.firstCapturedEffect, instance);
       
 16553   finishedQueue.firstCapturedEffect = finishedQueue.lastCapturedEffect = null;
       
 16554 }
       
 16555 
       
 16556 function commitUpdateEffects(effect, instance) {
       
 16557   while (effect !== null) {
       
 16558     var _callback3 = effect.callback;
       
 16559     if (_callback3 !== null) {
       
 16560       effect.callback = null;
       
 16561       callCallback(_callback3, instance);
       
 16562     }
       
 16563     effect = effect.nextEffect;
       
 16564   }
       
 16565 }
       
 16566 
       
 16567 function createCapturedValue(value, source) {
       
 16568   // If the value is an error, call this function immediately after it is thrown
       
 16569   // so the stack is accurate.
       
 16570   return {
       
 16571     value: value,
       
 16572     source: source,
       
 16573     stack: getStackByFiberInDevAndProd(source)
       
 16574   };
       
 16575 }
       
 16576 
       
 16577 function markUpdate(workInProgress) {
       
 16578   // Tag the fiber with an update effect. This turns a Placement into
       
 16579   // a PlacementAndUpdate.
       
 16580   workInProgress.effectTag |= Update;
       
 16581 }
       
 16582 
       
 16583 function markRef$1(workInProgress) {
       
 16584   workInProgress.effectTag |= Ref;
       
 16585 }
       
 16586 
       
 16587 var appendAllChildren = void 0;
       
 16588 var updateHostContainer = void 0;
       
 16589 var updateHostComponent$1 = void 0;
       
 16590 var updateHostText$1 = void 0;
       
 16591 if (supportsMutation) {
       
 16592   // Mutation mode
       
 16593 
       
 16594   appendAllChildren = function (parent, workInProgress, needsVisibilityToggle, isHidden) {
       
 16595     // We only have the top Fiber that was created but we need recurse down its
       
 16596     // children to find all the terminal nodes.
       
 16597     var node = workInProgress.child;
       
 16598     while (node !== null) {
       
 16599       if (node.tag === HostComponent || node.tag === HostText) {
       
 16600         appendInitialChild(parent, node.stateNode);
       
 16601       } else if (node.tag === HostPortal) {
       
 16602         // If we have a portal child, then we don't want to traverse
       
 16603         // down its children. Instead, we'll get insertions from each child in
       
 16604         // the portal directly.
       
 16605       } else if (node.child !== null) {
       
 16606         node.child.return = node;
       
 16607         node = node.child;
       
 16608         continue;
       
 16609       }
       
 16610       if (node === workInProgress) {
       
 16611         return;
       
 16612       }
       
 16613       while (node.sibling === null) {
       
 16614         if (node.return === null || node.return === workInProgress) {
       
 16615           return;
       
 16616         }
       
 16617         node = node.return;
       
 16618       }
       
 16619       node.sibling.return = node.return;
       
 16620       node = node.sibling;
       
 16621     }
       
 16622   };
       
 16623 
       
 16624   updateHostContainer = function (workInProgress) {
       
 16625     // Noop
       
 16626   };
       
 16627   updateHostComponent$1 = function (current, workInProgress, type, newProps, rootContainerInstance) {
       
 16628     // If we have an alternate, that means this is an update and we need to
       
 16629     // schedule a side-effect to do the updates.
       
 16630     var oldProps = current.memoizedProps;
       
 16631     if (oldProps === newProps) {
       
 16632       // In mutation mode, this is sufficient for a bailout because
       
 16633       // we won't touch this node even if children changed.
       
 16634       return;
       
 16635     }
       
 16636 
       
 16637     // If we get updated because one of our children updated, we don't
       
 16638     // have newProps so we'll have to reuse them.
       
 16639     // TODO: Split the update API as separate for the props vs. children.
       
 16640     // Even better would be if children weren't special cased at all tho.
       
 16641     var instance = workInProgress.stateNode;
       
 16642     var currentHostContext = getHostContext();
       
 16643     // TODO: Experiencing an error where oldProps is null. Suggests a host
       
 16644     // component is hitting the resume path. Figure out why. Possibly
       
 16645     // related to `hidden`.
       
 16646     var updatePayload = prepareUpdate(instance, type, oldProps, newProps, rootContainerInstance, currentHostContext);
       
 16647     // TODO: Type this specific to this type of component.
       
 16648     workInProgress.updateQueue = updatePayload;
       
 16649     // If the update payload indicates that there is a change or if there
       
 16650     // is a new ref we mark this as an update. All the work is done in commitWork.
       
 16651     if (updatePayload) {
       
 16652       markUpdate(workInProgress);
       
 16653     }
       
 16654   };
       
 16655   updateHostText$1 = function (current, workInProgress, oldText, newText) {
       
 16656     // If the text differs, mark it as an update. All the work in done in commitWork.
       
 16657     if (oldText !== newText) {
       
 16658       markUpdate(workInProgress);
       
 16659     }
       
 16660   };
       
 16661 } else if (supportsPersistence) {
       
 16662   // Persistent host tree mode
       
 16663 
       
 16664   appendAllChildren = function (parent, workInProgress, needsVisibilityToggle, isHidden) {
       
 16665     // We only have the top Fiber that was created but we need recurse down its
       
 16666     // children to find all the terminal nodes.
       
 16667     var node = workInProgress.child;
       
 16668     while (node !== null) {
       
 16669       // eslint-disable-next-line no-labels
       
 16670       branches: if (node.tag === HostComponent) {
       
 16671         var instance = node.stateNode;
       
 16672         if (needsVisibilityToggle) {
       
 16673           var props = node.memoizedProps;
       
 16674           var type = node.type;
       
 16675           if (isHidden) {
       
 16676             // This child is inside a timed out tree. Hide it.
       
 16677             instance = cloneHiddenInstance(instance, type, props, node);
       
 16678           } else {
       
 16679             // This child was previously inside a timed out tree. If it was not
       
 16680             // updated during this render, it may need to be unhidden. Clone
       
 16681             // again to be sure.
       
 16682             instance = cloneUnhiddenInstance(instance, type, props, node);
       
 16683           }
       
 16684           node.stateNode = instance;
       
 16685         }
       
 16686         appendInitialChild(parent, instance);
       
 16687       } else if (node.tag === HostText) {
       
 16688         var _instance = node.stateNode;
       
 16689         if (needsVisibilityToggle) {
       
 16690           var text = node.memoizedProps;
       
 16691           var rootContainerInstance = getRootHostContainer();
       
 16692           var currentHostContext = getHostContext();
       
 16693           if (isHidden) {
       
 16694             _instance = createHiddenTextInstance(text, rootContainerInstance, currentHostContext, workInProgress);
       
 16695           } else {
       
 16696             _instance = createTextInstance(text, rootContainerInstance, currentHostContext, workInProgress);
       
 16697           }
       
 16698           node.stateNode = _instance;
       
 16699         }
       
 16700         appendInitialChild(parent, _instance);
       
 16701       } else if (node.tag === HostPortal) {
       
 16702         // If we have a portal child, then we don't want to traverse
       
 16703         // down its children. Instead, we'll get insertions from each child in
       
 16704         // the portal directly.
       
 16705       } else if (node.tag === SuspenseComponent) {
       
 16706         var current = node.alternate;
       
 16707         if (current !== null) {
       
 16708           var oldState = current.memoizedState;
       
 16709           var newState = node.memoizedState;
       
 16710           var oldIsHidden = oldState !== null;
       
 16711           var newIsHidden = newState !== null;
       
 16712           if (oldIsHidden !== newIsHidden) {
       
 16713             // The placeholder either just timed out or switched back to the normal
       
 16714             // children after having previously timed out. Toggle the visibility of
       
 16715             // the direct host children.
       
 16716             var primaryChildParent = newIsHidden ? node.child : node;
       
 16717             if (primaryChildParent !== null) {
       
 16718               appendAllChildren(parent, primaryChildParent, true, newIsHidden);
       
 16719             }
       
 16720             // eslint-disable-next-line no-labels
       
 16721             break branches;
       
 16722           }
       
 16723         }
       
 16724         if (node.child !== null) {
       
 16725           // Continue traversing like normal
       
 16726           node.child.return = node;
       
 16727           node = node.child;
       
 16728           continue;
       
 16729         }
       
 16730       } else if (node.child !== null) {
       
 16731         node.child.return = node;
       
 16732         node = node.child;
       
 16733         continue;
       
 16734       }
       
 16735       // $FlowFixMe This is correct but Flow is confused by the labeled break.
       
 16736       node = node;
       
 16737       if (node === workInProgress) {
       
 16738         return;
       
 16739       }
       
 16740       while (node.sibling === null) {
       
 16741         if (node.return === null || node.return === workInProgress) {
       
 16742           return;
       
 16743         }
       
 16744         node = node.return;
       
 16745       }
       
 16746       node.sibling.return = node.return;
       
 16747       node = node.sibling;
       
 16748     }
       
 16749   };
       
 16750 
       
 16751   // An unfortunate fork of appendAllChildren because we have two different parent types.
       
 16752   var appendAllChildrenToContainer = function (containerChildSet, workInProgress, needsVisibilityToggle, isHidden) {
       
 16753     // We only have the top Fiber that was created but we need recurse down its
       
 16754     // children to find all the terminal nodes.
       
 16755     var node = workInProgress.child;
       
 16756     while (node !== null) {
       
 16757       // eslint-disable-next-line no-labels
       
 16758       branches: if (node.tag === HostComponent) {
       
 16759         var instance = node.stateNode;
       
 16760         if (needsVisibilityToggle) {
       
 16761           var props = node.memoizedProps;
       
 16762           var type = node.type;
       
 16763           if (isHidden) {
       
 16764             // This child is inside a timed out tree. Hide it.
       
 16765             instance = cloneHiddenInstance(instance, type, props, node);
       
 16766           } else {
       
 16767             // This child was previously inside a timed out tree. If it was not
       
 16768             // updated during this render, it may need to be unhidden. Clone
       
 16769             // again to be sure.
       
 16770             instance = cloneUnhiddenInstance(instance, type, props, node);
       
 16771           }
       
 16772           node.stateNode = instance;
       
 16773         }
       
 16774         appendChildToContainerChildSet(containerChildSet, instance);
       
 16775       } else if (node.tag === HostText) {
       
 16776         var _instance2 = node.stateNode;
       
 16777         if (needsVisibilityToggle) {
       
 16778           var text = node.memoizedProps;
       
 16779           var rootContainerInstance = getRootHostContainer();
       
 16780           var currentHostContext = getHostContext();
       
 16781           if (isHidden) {
       
 16782             _instance2 = createHiddenTextInstance(text, rootContainerInstance, currentHostContext, workInProgress);
       
 16783           } else {
       
 16784             _instance2 = createTextInstance(text, rootContainerInstance, currentHostContext, workInProgress);
       
 16785           }
       
 16786           node.stateNode = _instance2;
       
 16787         }
       
 16788         appendChildToContainerChildSet(containerChildSet, _instance2);
       
 16789       } else if (node.tag === HostPortal) {
       
 16790         // If we have a portal child, then we don't want to traverse
       
 16791         // down its children. Instead, we'll get insertions from each child in
       
 16792         // the portal directly.
       
 16793       } else if (node.tag === SuspenseComponent) {
       
 16794         var current = node.alternate;
       
 16795         if (current !== null) {
       
 16796           var oldState = current.memoizedState;
       
 16797           var newState = node.memoizedState;
       
 16798           var oldIsHidden = oldState !== null;
       
 16799           var newIsHidden = newState !== null;
       
 16800           if (oldIsHidden !== newIsHidden) {
       
 16801             // The placeholder either just timed out or switched back to the normal
       
 16802             // children after having previously timed out. Toggle the visibility of
       
 16803             // the direct host children.
       
 16804             var primaryChildParent = newIsHidden ? node.child : node;
       
 16805             if (primaryChildParent !== null) {
       
 16806               appendAllChildrenToContainer(containerChildSet, primaryChildParent, true, newIsHidden);
       
 16807             }
       
 16808             // eslint-disable-next-line no-labels
       
 16809             break branches;
       
 16810           }
       
 16811         }
       
 16812         if (node.child !== null) {
       
 16813           // Continue traversing like normal
       
 16814           node.child.return = node;
       
 16815           node = node.child;
       
 16816           continue;
       
 16817         }
       
 16818       } else if (node.child !== null) {
       
 16819         node.child.return = node;
       
 16820         node = node.child;
       
 16821         continue;
       
 16822       }
       
 16823       // $FlowFixMe This is correct but Flow is confused by the labeled break.
       
 16824       node = node;
       
 16825       if (node === workInProgress) {
       
 16826         return;
       
 16827       }
       
 16828       while (node.sibling === null) {
       
 16829         if (node.return === null || node.return === workInProgress) {
       
 16830           return;
       
 16831         }
       
 16832         node = node.return;
       
 16833       }
       
 16834       node.sibling.return = node.return;
       
 16835       node = node.sibling;
       
 16836     }
       
 16837   };
       
 16838   updateHostContainer = function (workInProgress) {
       
 16839     var portalOrRoot = workInProgress.stateNode;
       
 16840     var childrenUnchanged = workInProgress.firstEffect === null;
       
 16841     if (childrenUnchanged) {
       
 16842       // No changes, just reuse the existing instance.
       
 16843     } else {
       
 16844       var container = portalOrRoot.containerInfo;
       
 16845       var newChildSet = createContainerChildSet(container);
       
 16846       // If children might have changed, we have to add them all to the set.
       
 16847       appendAllChildrenToContainer(newChildSet, workInProgress, false, false);
       
 16848       portalOrRoot.pendingChildren = newChildSet;
       
 16849       // Schedule an update on the container to swap out the container.
       
 16850       markUpdate(workInProgress);
       
 16851       finalizeContainerChildren(container, newChildSet);
       
 16852     }
       
 16853   };
       
 16854   updateHostComponent$1 = function (current, workInProgress, type, newProps, rootContainerInstance) {
       
 16855     var currentInstance = current.stateNode;
       
 16856     var oldProps = current.memoizedProps;
       
 16857     // If there are no effects associated with this node, then none of our children had any updates.
       
 16858     // This guarantees that we can reuse all of them.
       
 16859     var childrenUnchanged = workInProgress.firstEffect === null;
       
 16860     if (childrenUnchanged && oldProps === newProps) {
       
 16861       // No changes, just reuse the existing instance.
       
 16862       // Note that this might release a previous clone.
       
 16863       workInProgress.stateNode = currentInstance;
       
 16864       return;
       
 16865     }
       
 16866     var recyclableInstance = workInProgress.stateNode;
       
 16867     var currentHostContext = getHostContext();
       
 16868     var updatePayload = null;
       
 16869     if (oldProps !== newProps) {
       
 16870       updatePayload = prepareUpdate(recyclableInstance, type, oldProps, newProps, rootContainerInstance, currentHostContext);
       
 16871     }
       
 16872     if (childrenUnchanged && updatePayload === null) {
       
 16873       // No changes, just reuse the existing instance.
       
 16874       // Note that this might release a previous clone.
       
 16875       workInProgress.stateNode = currentInstance;
       
 16876       return;
       
 16877     }
       
 16878     var newInstance = cloneInstance(currentInstance, updatePayload, type, oldProps, newProps, workInProgress, childrenUnchanged, recyclableInstance);
       
 16879     if (finalizeInitialChildren(newInstance, type, newProps, rootContainerInstance, currentHostContext)) {
       
 16880       markUpdate(workInProgress);
       
 16881     }
       
 16882     workInProgress.stateNode = newInstance;
       
 16883     if (childrenUnchanged) {
       
 16884       // If there are no other effects in this tree, we need to flag this node as having one.
       
 16885       // Even though we're not going to use it for anything.
       
 16886       // Otherwise parents won't know that there are new children to propagate upwards.
       
 16887       markUpdate(workInProgress);
       
 16888     } else {
       
 16889       // If children might have changed, we have to add them all to the set.
       
 16890       appendAllChildren(newInstance, workInProgress, false, false);
       
 16891     }
       
 16892   };
       
 16893   updateHostText$1 = function (current, workInProgress, oldText, newText) {
       
 16894     if (oldText !== newText) {
       
 16895       // If the text content differs, we'll create a new text instance for it.
       
 16896       var rootContainerInstance = getRootHostContainer();
       
 16897       var currentHostContext = getHostContext();
       
 16898       workInProgress.stateNode = createTextInstance(newText, rootContainerInstance, currentHostContext, workInProgress);
       
 16899       // We'll have to mark it as having an effect, even though we won't use the effect for anything.
       
 16900       // This lets the parents know that at least one of their children has changed.
       
 16901       markUpdate(workInProgress);
       
 16902     }
       
 16903   };
       
 16904 } else {
       
 16905   // No host operations
       
 16906   updateHostContainer = function (workInProgress) {
       
 16907     // Noop
       
 16908   };
       
 16909   updateHostComponent$1 = function (current, workInProgress, type, newProps, rootContainerInstance) {
       
 16910     // Noop
       
 16911   };
       
 16912   updateHostText$1 = function (current, workInProgress, oldText, newText) {
       
 16913     // Noop
       
 16914   };
       
 16915 }
       
 16916 
       
 16917 function completeWork(current, workInProgress, renderExpirationTime) {
       
 16918   var newProps = workInProgress.pendingProps;
       
 16919 
       
 16920   switch (workInProgress.tag) {
       
 16921     case IndeterminateComponent:
       
 16922       break;
       
 16923     case LazyComponent:
       
 16924       break;
       
 16925     case SimpleMemoComponent:
       
 16926     case FunctionComponent:
       
 16927       break;
       
 16928     case ClassComponent:
       
 16929       {
       
 16930         var Component = workInProgress.type;
       
 16931         if (isContextProvider(Component)) {
       
 16932           popContext(workInProgress);
       
 16933         }
       
 16934         break;
       
 16935       }
       
 16936     case HostRoot:
       
 16937       {
       
 16938         popHostContainer(workInProgress);
       
 16939         popTopLevelContextObject(workInProgress);
       
 16940         var fiberRoot = workInProgress.stateNode;
       
 16941         if (fiberRoot.pendingContext) {
       
 16942           fiberRoot.context = fiberRoot.pendingContext;
       
 16943           fiberRoot.pendingContext = null;
       
 16944         }
       
 16945         if (current === null || current.child === null) {
       
 16946           // If we hydrated, pop so that we can delete any remaining children
       
 16947           // that weren't hydrated.
       
 16948           popHydrationState(workInProgress);
       
 16949           // This resets the hacky state to fix isMounted before committing.
       
 16950           // TODO: Delete this when we delete isMounted and findDOMNode.
       
 16951           workInProgress.effectTag &= ~Placement;
       
 16952         }
       
 16953         updateHostContainer(workInProgress);
       
 16954         break;
       
 16955       }
       
 16956     case HostComponent:
       
 16957       {
       
 16958         popHostContext(workInProgress);
       
 16959         var rootContainerInstance = getRootHostContainer();
       
 16960         var type = workInProgress.type;
       
 16961         if (current !== null && workInProgress.stateNode != null) {
       
 16962           updateHostComponent$1(current, workInProgress, type, newProps, rootContainerInstance);
       
 16963 
       
 16964           if (current.ref !== workInProgress.ref) {
       
 16965             markRef$1(workInProgress);
       
 16966           }
       
 16967         } else {
       
 16968           if (!newProps) {
       
 16969             !(workInProgress.stateNode !== null) ? invariant(false, 'We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue.') : void 0;
       
 16970             // This can happen when we abort work.
       
 16971             break;
       
 16972           }
       
 16973 
       
 16974           var currentHostContext = getHostContext();
       
 16975           // TODO: Move createInstance to beginWork and keep it on a context
       
 16976           // "stack" as the parent. Then append children as we go in beginWork
       
 16977           // or completeWork depending on we want to add then top->down or
       
 16978           // bottom->up. Top->down is faster in IE11.
       
 16979           var wasHydrated = popHydrationState(workInProgress);
       
 16980           if (wasHydrated) {
       
 16981             // TODO: Move this and createInstance step into the beginPhase
       
 16982             // to consolidate.
       
 16983             if (prepareToHydrateHostInstance(workInProgress, rootContainerInstance, currentHostContext)) {
       
 16984               // If changes to the hydrated node needs to be applied at the
       
 16985               // commit-phase we mark this as such.
       
 16986               markUpdate(workInProgress);
       
 16987             }
       
 16988           } else {
       
 16989             var instance = createInstance(type, newProps, rootContainerInstance, currentHostContext, workInProgress);
       
 16990 
       
 16991             appendAllChildren(instance, workInProgress, false, false);
       
 16992 
       
 16993             // Certain renderers require commit-time effects for initial mount.
       
 16994             // (eg DOM renderer supports auto-focus for certain elements).
       
 16995             // Make sure such renderers get scheduled for later work.
       
 16996             if (finalizeInitialChildren(instance, type, newProps, rootContainerInstance, currentHostContext)) {
       
 16997               markUpdate(workInProgress);
       
 16998             }
       
 16999             workInProgress.stateNode = instance;
       
 17000           }
       
 17001 
       
 17002           if (workInProgress.ref !== null) {
       
 17003             // If there is a ref on a host node we need to schedule a callback
       
 17004             markRef$1(workInProgress);
       
 17005           }
       
 17006         }
       
 17007         break;
       
 17008       }
       
 17009     case HostText:
       
 17010       {
       
 17011         var newText = newProps;
       
 17012         if (current && workInProgress.stateNode != null) {
       
 17013           var oldText = current.memoizedProps;
       
 17014           // If we have an alternate, that means this is an update and we need
       
 17015           // to schedule a side-effect to do the updates.
       
 17016           updateHostText$1(current, workInProgress, oldText, newText);
       
 17017         } else {
       
 17018           if (typeof newText !== 'string') {
       
 17019             !(workInProgress.stateNode !== null) ? invariant(false, 'We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue.') : void 0;
       
 17020             // This can happen when we abort work.
       
 17021           }
       
 17022           var _rootContainerInstance = getRootHostContainer();
       
 17023           var _currentHostContext = getHostContext();
       
 17024           var _wasHydrated = popHydrationState(workInProgress);
       
 17025           if (_wasHydrated) {
       
 17026             if (prepareToHydrateHostTextInstance(workInProgress)) {
       
 17027               markUpdate(workInProgress);
       
 17028             }
       
 17029           } else {
       
 17030             workInProgress.stateNode = createTextInstance(newText, _rootContainerInstance, _currentHostContext, workInProgress);
       
 17031           }
       
 17032         }
       
 17033         break;
       
 17034       }
       
 17035     case ForwardRef:
       
 17036       break;
       
 17037     case SuspenseComponent:
       
 17038       {
       
 17039         var nextState = workInProgress.memoizedState;
       
 17040         if ((workInProgress.effectTag & DidCapture) !== NoEffect) {
       
 17041           // Something suspended. Re-render with the fallback children.
       
 17042           workInProgress.expirationTime = renderExpirationTime;
       
 17043           // Do not reset the effect list.
       
 17044           return workInProgress;
       
 17045         }
       
 17046 
       
 17047         var nextDidTimeout = nextState !== null;
       
 17048         var prevDidTimeout = current !== null && current.memoizedState !== null;
       
 17049 
       
 17050         if (current !== null && !nextDidTimeout && prevDidTimeout) {
       
 17051           // We just switched from the fallback to the normal children. Delete
       
 17052           // the fallback.
       
 17053           // TODO: Would it be better to store the fallback fragment on
       
 17054           var currentFallbackChild = current.child.sibling;
       
 17055           if (currentFallbackChild !== null) {
       
 17056             // Deletions go at the beginning of the return fiber's effect list
       
 17057             var first = workInProgress.firstEffect;
       
 17058             if (first !== null) {
       
 17059               workInProgress.firstEffect = currentFallbackChild;
       
 17060               currentFallbackChild.nextEffect = first;
       
 17061             } else {
       
 17062               workInProgress.firstEffect = workInProgress.lastEffect = currentFallbackChild;
       
 17063               currentFallbackChild.nextEffect = null;
       
 17064             }
       
 17065             currentFallbackChild.effectTag = Deletion;
       
 17066           }
       
 17067         }
       
 17068 
       
 17069         if (nextDidTimeout || prevDidTimeout) {
       
 17070           // If the children are hidden, or if they were previous hidden, schedule
       
 17071           // an effect to toggle their visibility. This is also used to attach a
       
 17072           // retry listener to the promise.
       
 17073           workInProgress.effectTag |= Update;
       
 17074         }
       
 17075         break;
       
 17076       }
       
 17077     case Fragment:
       
 17078       break;
       
 17079     case Mode:
       
 17080       break;
       
 17081     case Profiler:
       
 17082       break;
       
 17083     case HostPortal:
       
 17084       popHostContainer(workInProgress);
       
 17085       updateHostContainer(workInProgress);
       
 17086       break;
       
 17087     case ContextProvider:
       
 17088       // Pop provider fiber
       
 17089       popProvider(workInProgress);
       
 17090       break;
       
 17091     case ContextConsumer:
       
 17092       break;
       
 17093     case MemoComponent:
       
 17094       break;
       
 17095     case IncompleteClassComponent:
       
 17096       {
       
 17097         // Same as class component case. I put it down here so that the tags are
       
 17098         // sequential to ensure this switch is compiled to a jump table.
       
 17099         var _Component = workInProgress.type;
       
 17100         if (isContextProvider(_Component)) {
       
 17101           popContext(workInProgress);
       
 17102         }
       
 17103         break;
       
 17104       }
       
 17105     case DehydratedSuspenseComponent:
       
 17106       {
       
 17107         if (enableSuspenseServerRenderer) {
       
 17108           if (current === null) {
       
 17109             var _wasHydrated2 = popHydrationState(workInProgress);
       
 17110             !_wasHydrated2 ? invariant(false, 'A dehydrated suspense component was completed without a hydrated node. This is probably a bug in React.') : void 0;
       
 17111             skipPastDehydratedSuspenseInstance(workInProgress);
       
 17112           } else if ((workInProgress.effectTag & DidCapture) === NoEffect) {
       
 17113             // This boundary did not suspend so it's now hydrated.
       
 17114             // To handle any future suspense cases, we're going to now upgrade it
       
 17115             // to a Suspense component. We detach it from the existing current fiber.
       
 17116             current.alternate = null;
       
 17117             workInProgress.alternate = null;
       
 17118             workInProgress.tag = SuspenseComponent;
       
 17119             workInProgress.memoizedState = null;
       
 17120             workInProgress.stateNode = null;
       
 17121           }
       
 17122         }
       
 17123         break;
       
 17124       }
       
 17125     default:
       
 17126       invariant(false, 'Unknown unit of work tag. This error is likely caused by a bug in React. Please file an issue.');
       
 17127   }
       
 17128 
       
 17129   return null;
       
 17130 }
       
 17131 
       
 17132 function shouldCaptureSuspense(workInProgress) {
       
 17133   // In order to capture, the Suspense component must have a fallback prop.
       
 17134   if (workInProgress.memoizedProps.fallback === undefined) {
       
 17135     return false;
       
 17136   }
       
 17137   // If it was the primary children that just suspended, capture and render the
       
 17138   // fallback. Otherwise, don't capture and bubble to the next boundary.
       
 17139   var nextState = workInProgress.memoizedState;
       
 17140   return nextState === null;
       
 17141 }
       
 17142 
       
 17143 // This module is forked in different environments.
       
 17144 // By default, return `true` to log errors to the console.
       
 17145 // Forks can return `false` if this isn't desirable.
       
 17146 function showErrorDialog(capturedError) {
       
 17147   return true;
       
 17148 }
       
 17149 
       
 17150 function logCapturedError(capturedError) {
       
 17151   var logError = showErrorDialog(capturedError);
       
 17152 
       
 17153   // Allow injected showErrorDialog() to prevent default console.error logging.
       
 17154   // This enables renderers like ReactNative to better manage redbox behavior.
       
 17155   if (logError === false) {
       
 17156     return;
       
 17157   }
       
 17158 
       
 17159   var error = capturedError.error;
       
 17160   {
       
 17161     var componentName = capturedError.componentName,
       
 17162         componentStack = capturedError.componentStack,
       
 17163         errorBoundaryName = capturedError.errorBoundaryName,
       
 17164         errorBoundaryFound = capturedError.errorBoundaryFound,
       
 17165         willRetry = capturedError.willRetry;
       
 17166 
       
 17167     // Browsers support silencing uncaught errors by calling
       
 17168     // `preventDefault()` in window `error` handler.
       
 17169     // We record this information as an expando on the error.
       
 17170 
       
 17171     if (error != null && error._suppressLogging) {
       
 17172       if (errorBoundaryFound && willRetry) {
       
 17173         // The error is recoverable and was silenced.
       
 17174         // Ignore it and don't print the stack addendum.
       
 17175         // This is handy for testing error boundaries without noise.
       
 17176         return;
       
 17177       }
       
 17178       // The error is fatal. Since the silencing might have
       
 17179       // been accidental, we'll surface it anyway.
       
 17180       // However, the browser would have silenced the original error
       
 17181       // so we'll print it first, and then print the stack addendum.
       
 17182       console.error(error);
       
 17183       // For a more detailed description of this block, see:
       
 17184       // https://github.com/facebook/react/pull/13384
       
 17185     }
       
 17186 
       
 17187     var componentNameMessage = componentName ? 'The above error occurred in the <' + componentName + '> component:' : 'The above error occurred in one of your React components:';
       
 17188 
       
 17189     var errorBoundaryMessage = void 0;
       
 17190     // errorBoundaryFound check is sufficient; errorBoundaryName check is to satisfy Flow.
       
 17191     if (errorBoundaryFound && errorBoundaryName) {
       
 17192       if (willRetry) {
       
 17193         errorBoundaryMessage = 'React will try to recreate this component tree from scratch ' + ('using the error boundary you provided, ' + errorBoundaryName + '.');
       
 17194       } else {
       
 17195         errorBoundaryMessage = 'This error was initially handled by the error boundary ' + errorBoundaryName + '.\n' + 'Recreating the tree from scratch failed so React will unmount the tree.';
       
 17196       }
       
 17197     } else {
       
 17198       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.';
       
 17199     }
       
 17200     var combinedMessage = '' + componentNameMessage + componentStack + '\n\n' + ('' + errorBoundaryMessage);
       
 17201 
       
 17202     // In development, we provide our own message with just the component stack.
       
 17203     // We don't include the original error message and JS stack because the browser
       
 17204     // has already printed it. Even if the application swallows the error, it is still
       
 17205     // displayed by the browser thanks to the DEV-only fake event trick in ReactErrorUtils.
       
 17206     console.error(combinedMessage);
       
 17207   }
       
 17208 }
       
 17209 
       
 17210 var didWarnAboutUndefinedSnapshotBeforeUpdate = null;
       
 17211 {
       
 17212   didWarnAboutUndefinedSnapshotBeforeUpdate = new Set();
       
 17213 }
       
 17214 
       
 17215 var PossiblyWeakSet$1 = typeof WeakSet === 'function' ? WeakSet : Set;
       
 17216 
       
 17217 function logError(boundary, errorInfo) {
       
 17218   var source = errorInfo.source;
       
 17219   var stack = errorInfo.stack;
       
 17220   if (stack === null && source !== null) {
       
 17221     stack = getStackByFiberInDevAndProd(source);
       
 17222   }
       
 17223 
       
 17224   var capturedError = {
       
 17225     componentName: source !== null ? getComponentName(source.type) : null,
       
 17226     componentStack: stack !== null ? stack : '',
       
 17227     error: errorInfo.value,
       
 17228     errorBoundary: null,
       
 17229     errorBoundaryName: null,
       
 17230     errorBoundaryFound: false,
       
 17231     willRetry: false
       
 17232   };
       
 17233 
       
 17234   if (boundary !== null && boundary.tag === ClassComponent) {
       
 17235     capturedError.errorBoundary = boundary.stateNode;
       
 17236     capturedError.errorBoundaryName = getComponentName(boundary.type);
       
 17237     capturedError.errorBoundaryFound = true;
       
 17238     capturedError.willRetry = true;
       
 17239   }
       
 17240 
       
 17241   try {
       
 17242     logCapturedError(capturedError);
       
 17243   } catch (e) {
       
 17244     // This method must not throw, or React internal state will get messed up.
       
 17245     // If console.error is overridden, or logCapturedError() shows a dialog that throws,
       
 17246     // we want to report this error outside of the normal stack as a last resort.
       
 17247     // https://github.com/facebook/react/issues/13188
       
 17248     setTimeout(function () {
       
 17249       throw e;
       
 17250     });
       
 17251   }
       
 17252 }
       
 17253 
       
 17254 var callComponentWillUnmountWithTimer = function (current$$1, instance) {
       
 17255   startPhaseTimer(current$$1, 'componentWillUnmount');
       
 17256   instance.props = current$$1.memoizedProps;
       
 17257   instance.state = current$$1.memoizedState;
       
 17258   instance.componentWillUnmount();
       
 17259   stopPhaseTimer();
       
 17260 };
       
 17261 
       
 17262 // Capture errors so they don't interrupt unmounting.
       
 17263 function safelyCallComponentWillUnmount(current$$1, instance) {
       
 17264   {
       
 17265     invokeGuardedCallback(null, callComponentWillUnmountWithTimer, null, current$$1, instance);
       
 17266     if (hasCaughtError()) {
       
 17267       var unmountError = clearCaughtError();
       
 17268       captureCommitPhaseError(current$$1, unmountError);
       
 17269     }
       
 17270   }
       
 17271 }
       
 17272 
       
 17273 function safelyDetachRef(current$$1) {
       
 17274   var ref = current$$1.ref;
       
 17275   if (ref !== null) {
       
 17276     if (typeof ref === 'function') {
       
 17277       {
       
 17278         invokeGuardedCallback(null, ref, null, null);
       
 17279         if (hasCaughtError()) {
       
 17280           var refError = clearCaughtError();
       
 17281           captureCommitPhaseError(current$$1, refError);
       
 17282         }
       
 17283       }
       
 17284     } else {
       
 17285       ref.current = null;
       
 17286     }
       
 17287   }
       
 17288 }
       
 17289 
       
 17290 function safelyCallDestroy(current$$1, destroy) {
       
 17291   {
       
 17292     invokeGuardedCallback(null, destroy, null);
       
 17293     if (hasCaughtError()) {
       
 17294       var error = clearCaughtError();
       
 17295       captureCommitPhaseError(current$$1, error);
       
 17296     }
       
 17297   }
       
 17298 }
       
 17299 
       
 17300 function commitBeforeMutationLifeCycles(current$$1, finishedWork) {
       
 17301   switch (finishedWork.tag) {
       
 17302     case FunctionComponent:
       
 17303     case ForwardRef:
       
 17304     case SimpleMemoComponent:
       
 17305       {
       
 17306         commitHookEffectList(UnmountSnapshot, NoEffect$1, finishedWork);
       
 17307         return;
       
 17308       }
       
 17309     case ClassComponent:
       
 17310       {
       
 17311         if (finishedWork.effectTag & Snapshot) {
       
 17312           if (current$$1 !== null) {
       
 17313             var prevProps = current$$1.memoizedProps;
       
 17314             var prevState = current$$1.memoizedState;
       
 17315             startPhaseTimer(finishedWork, 'getSnapshotBeforeUpdate');
       
 17316             var instance = finishedWork.stateNode;
       
 17317             // We could update instance props and state here,
       
 17318             // but instead we rely on them being set during last render.
       
 17319             // TODO: revisit this when we implement resuming.
       
 17320             {
       
 17321               if (finishedWork.type === finishedWork.elementType && !didWarnAboutReassigningProps) {
       
 17322                 !(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;
       
 17323                 !(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;
       
 17324               }
       
 17325             }
       
 17326             var snapshot = instance.getSnapshotBeforeUpdate(finishedWork.elementType === finishedWork.type ? prevProps : resolveDefaultProps(finishedWork.type, prevProps), prevState);
       
 17327             {
       
 17328               var didWarnSet = didWarnAboutUndefinedSnapshotBeforeUpdate;
       
 17329               if (snapshot === undefined && !didWarnSet.has(finishedWork.type)) {
       
 17330                 didWarnSet.add(finishedWork.type);
       
 17331                 warningWithoutStack$1(false, '%s.getSnapshotBeforeUpdate(): A snapshot value (or null) ' + 'must be returned. You have returned undefined.', getComponentName(finishedWork.type));
       
 17332               }
       
 17333             }
       
 17334             instance.__reactInternalSnapshotBeforeUpdate = snapshot;
       
 17335             stopPhaseTimer();
       
 17336           }
       
 17337         }
       
 17338         return;
       
 17339       }
       
 17340     case HostRoot:
       
 17341     case HostComponent:
       
 17342     case HostText:
       
 17343     case HostPortal:
       
 17344     case IncompleteClassComponent:
       
 17345       // Nothing to do for these component types
       
 17346       return;
       
 17347     default:
       
 17348       {
       
 17349         invariant(false, 'This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue.');
       
 17350       }
       
 17351   }
       
 17352 }
       
 17353 
       
 17354 function commitHookEffectList(unmountTag, mountTag, finishedWork) {
       
 17355   var updateQueue = finishedWork.updateQueue;
       
 17356   var lastEffect = updateQueue !== null ? updateQueue.lastEffect : null;
       
 17357   if (lastEffect !== null) {
       
 17358     var firstEffect = lastEffect.next;
       
 17359     var effect = firstEffect;
       
 17360     do {
       
 17361       if ((effect.tag & unmountTag) !== NoEffect$1) {
       
 17362         // Unmount
       
 17363         var destroy = effect.destroy;
       
 17364         effect.destroy = undefined;
       
 17365         if (destroy !== undefined) {
       
 17366           destroy();
       
 17367         }
       
 17368       }
       
 17369       if ((effect.tag & mountTag) !== NoEffect$1) {
       
 17370         // Mount
       
 17371         var create = effect.create;
       
 17372         effect.destroy = create();
       
 17373 
       
 17374         {
       
 17375           var _destroy = effect.destroy;
       
 17376           if (_destroy !== undefined && typeof _destroy !== 'function') {
       
 17377             var addendum = void 0;
       
 17378             if (_destroy === null) {
       
 17379               addendum = ' You returned null. If your effect does not require clean ' + 'up, return undefined (or nothing).';
       
 17380             } else if (typeof _destroy.then === 'function') {
       
 17381               addendum = '\n\nIt looks like you wrote useEffect(async () => ...) or returned a Promise. ' + 'Instead, you may write an async function separately ' + 'and then call it from inside the effect:\n\n' + 'async function fetchComment(commentId) {\n' + '  // You can await here\n' + '}\n\n' + 'useEffect(() => {\n' + '  fetchComment(commentId);\n' + '}, [commentId]);\n\n' + 'In the future, React will provide a more idiomatic solution for data fetching ' + "that doesn't involve writing effects manually.";
       
 17382             } else {
       
 17383               addendum = ' You returned: ' + _destroy;
       
 17384             }
       
 17385             warningWithoutStack$1(false, 'An Effect function must not return anything besides a function, ' + 'which is used for clean-up.%s%s', addendum, getStackByFiberInDevAndProd(finishedWork));
       
 17386           }
       
 17387         }
       
 17388       }
       
 17389       effect = effect.next;
       
 17390     } while (effect !== firstEffect);
       
 17391   }
       
 17392 }
       
 17393 
       
 17394 function commitPassiveHookEffects(finishedWork) {
       
 17395   commitHookEffectList(UnmountPassive, NoEffect$1, finishedWork);
       
 17396   commitHookEffectList(NoEffect$1, MountPassive, finishedWork);
       
 17397 }
       
 17398 
       
 17399 function commitLifeCycles(finishedRoot, current$$1, finishedWork, committedExpirationTime) {
       
 17400   switch (finishedWork.tag) {
       
 17401     case FunctionComponent:
       
 17402     case ForwardRef:
       
 17403     case SimpleMemoComponent:
       
 17404       {
       
 17405         commitHookEffectList(UnmountLayout, MountLayout, finishedWork);
       
 17406         break;
       
 17407       }
       
 17408     case ClassComponent:
       
 17409       {
       
 17410         var instance = finishedWork.stateNode;
       
 17411         if (finishedWork.effectTag & Update) {
       
 17412           if (current$$1 === null) {
       
 17413             startPhaseTimer(finishedWork, 'componentDidMount');
       
 17414             // We could update instance props and state here,
       
 17415             // but instead we rely on them being set during last render.
       
 17416             // TODO: revisit this when we implement resuming.
       
 17417             {
       
 17418               if (finishedWork.type === finishedWork.elementType && !didWarnAboutReassigningProps) {
       
 17419                 !(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;
       
 17420                 !(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;
       
 17421               }
       
 17422             }
       
 17423             instance.componentDidMount();
       
 17424             stopPhaseTimer();
       
 17425           } else {
       
 17426             var prevProps = finishedWork.elementType === finishedWork.type ? current$$1.memoizedProps : resolveDefaultProps(finishedWork.type, current$$1.memoizedProps);
       
 17427             var prevState = current$$1.memoizedState;
       
 17428             startPhaseTimer(finishedWork, 'componentDidUpdate');
       
 17429             // We could update instance props and state here,
       
 17430             // but instead we rely on them being set during last render.
       
 17431             // TODO: revisit this when we implement resuming.
       
 17432             {
       
 17433               if (finishedWork.type === finishedWork.elementType && !didWarnAboutReassigningProps) {
       
 17434                 !(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;
       
 17435                 !(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;
       
 17436               }
       
 17437             }
       
 17438             instance.componentDidUpdate(prevProps, prevState, instance.__reactInternalSnapshotBeforeUpdate);
       
 17439             stopPhaseTimer();
       
 17440           }
       
 17441         }
       
 17442         var updateQueue = finishedWork.updateQueue;
       
 17443         if (updateQueue !== null) {
       
 17444           {
       
 17445             if (finishedWork.type === finishedWork.elementType && !didWarnAboutReassigningProps) {
       
 17446               !(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;
       
 17447               !(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;
       
 17448             }
       
 17449           }
       
 17450           // We could update instance props and state here,
       
 17451           // but instead we rely on them being set during last render.
       
 17452           // TODO: revisit this when we implement resuming.
       
 17453           commitUpdateQueue(finishedWork, updateQueue, instance, committedExpirationTime);
       
 17454         }
       
 17455         return;
       
 17456       }
       
 17457     case HostRoot:
       
 17458       {
       
 17459         var _updateQueue = finishedWork.updateQueue;
       
 17460         if (_updateQueue !== null) {
       
 17461           var _instance = null;
       
 17462           if (finishedWork.child !== null) {
       
 17463             switch (finishedWork.child.tag) {
       
 17464               case HostComponent:
       
 17465                 _instance = getPublicInstance(finishedWork.child.stateNode);
       
 17466                 break;
       
 17467               case ClassComponent:
       
 17468                 _instance = finishedWork.child.stateNode;
       
 17469                 break;
       
 17470             }
       
 17471           }
       
 17472           commitUpdateQueue(finishedWork, _updateQueue, _instance, committedExpirationTime);
       
 17473         }
       
 17474         return;
       
 17475       }
       
 17476     case HostComponent:
       
 17477       {
       
 17478         var _instance2 = finishedWork.stateNode;
       
 17479 
       
 17480         // Renderers may schedule work to be done after host components are mounted
       
 17481         // (eg DOM renderer may schedule auto-focus for inputs and form controls).
       
 17482         // These effects should only be committed when components are first mounted,
       
 17483         // aka when there is no current/alternate.
       
 17484         if (current$$1 === null && finishedWork.effectTag & Update) {
       
 17485           var type = finishedWork.type;
       
 17486           var props = finishedWork.memoizedProps;
       
 17487           commitMount(_instance2, type, props, finishedWork);
       
 17488         }
       
 17489 
       
 17490         return;
       
 17491       }
       
 17492     case HostText:
       
 17493       {
       
 17494         // We have no life-cycles associated with text.
       
 17495         return;
       
 17496       }
       
 17497     case HostPortal:
       
 17498       {
       
 17499         // We have no life-cycles associated with portals.
       
 17500         return;
       
 17501       }
       
 17502     case Profiler:
       
 17503       {
       
 17504         if (enableProfilerTimer) {
       
 17505           var onRender = finishedWork.memoizedProps.onRender;
       
 17506 
       
 17507           if (enableSchedulerTracing) {
       
 17508             onRender(finishedWork.memoizedProps.id, current$$1 === null ? 'mount' : 'update', finishedWork.actualDuration, finishedWork.treeBaseDuration, finishedWork.actualStartTime, getCommitTime(), finishedRoot.memoizedInteractions);
       
 17509           } else {
       
 17510             onRender(finishedWork.memoizedProps.id, current$$1 === null ? 'mount' : 'update', finishedWork.actualDuration, finishedWork.treeBaseDuration, finishedWork.actualStartTime, getCommitTime());
       
 17511           }
       
 17512         }
       
 17513         return;
       
 17514       }
       
 17515     case SuspenseComponent:
       
 17516       break;
       
 17517     case IncompleteClassComponent:
       
 17518       break;
       
 17519     default:
       
 17520       {
       
 17521         invariant(false, 'This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue.');
       
 17522       }
       
 17523   }
       
 17524 }
       
 17525 
       
 17526 function hideOrUnhideAllChildren(finishedWork, isHidden) {
       
 17527   if (supportsMutation) {
       
 17528     // We only have the top Fiber that was inserted but we need to recurse down its
       
 17529     var node = finishedWork;
       
 17530     while (true) {
       
 17531       if (node.tag === HostComponent) {
       
 17532         var instance = node.stateNode;
       
 17533         if (isHidden) {
       
 17534           hideInstance(instance);
       
 17535         } else {
       
 17536           unhideInstance(node.stateNode, node.memoizedProps);
       
 17537         }
       
 17538       } else if (node.tag === HostText) {
       
 17539         var _instance3 = node.stateNode;
       
 17540         if (isHidden) {
       
 17541           hideTextInstance(_instance3);
       
 17542         } else {
       
 17543           unhideTextInstance(_instance3, node.memoizedProps);
       
 17544         }
       
 17545       } else if (node.tag === SuspenseComponent && node.memoizedState !== null) {
       
 17546         // Found a nested Suspense component that timed out. Skip over the
       
 17547         var fallbackChildFragment = node.child.sibling;
       
 17548         fallbackChildFragment.return = node;
       
 17549         node = fallbackChildFragment;
       
 17550         continue;
       
 17551       } else if (node.child !== null) {
       
 17552         node.child.return = node;
       
 17553         node = node.child;
       
 17554         continue;
       
 17555       }
       
 17556       if (node === finishedWork) {
       
 17557         return;
       
 17558       }
       
 17559       while (node.sibling === null) {
       
 17560         if (node.return === null || node.return === finishedWork) {
       
 17561           return;
       
 17562         }
       
 17563         node = node.return;
       
 17564       }
       
 17565       node.sibling.return = node.return;
       
 17566       node = node.sibling;
       
 17567     }
       
 17568   }
       
 17569 }
       
 17570 
       
 17571 function commitAttachRef(finishedWork) {
       
 17572   var ref = finishedWork.ref;
       
 17573   if (ref !== null) {
       
 17574     var instance = finishedWork.stateNode;
       
 17575     var instanceToUse = void 0;
       
 17576     switch (finishedWork.tag) {
       
 17577       case HostComponent:
       
 17578         instanceToUse = getPublicInstance(instance);
       
 17579         break;
       
 17580       default:
       
 17581         instanceToUse = instance;
       
 17582     }
       
 17583     if (typeof ref === 'function') {
       
 17584       ref(instanceToUse);
       
 17585     } else {
       
 17586       {
       
 17587         if (!ref.hasOwnProperty('current')) {
       
 17588           warningWithoutStack$1(false, 'Unexpected ref object provided for %s. ' + 'Use either a ref-setter function or React.createRef().%s', getComponentName(finishedWork.type), getStackByFiberInDevAndProd(finishedWork));
       
 17589         }
       
 17590       }
       
 17591 
       
 17592       ref.current = instanceToUse;
       
 17593     }
       
 17594   }
       
 17595 }
       
 17596 
       
 17597 function commitDetachRef(current$$1) {
       
 17598   var currentRef = current$$1.ref;
       
 17599   if (currentRef !== null) {
       
 17600     if (typeof currentRef === 'function') {
       
 17601       currentRef(null);
       
 17602     } else {
       
 17603       currentRef.current = null;
       
 17604     }
       
 17605   }
       
 17606 }
       
 17607 
       
 17608 // User-originating errors (lifecycles and refs) should not interrupt
       
 17609 // deletion, so don't let them throw. Host-originating errors should
       
 17610 // interrupt deletion, so it's okay
       
 17611 function commitUnmount(current$$1) {
       
 17612   onCommitUnmount(current$$1);
       
 17613 
       
 17614   switch (current$$1.tag) {
       
 17615     case FunctionComponent:
       
 17616     case ForwardRef:
       
 17617     case MemoComponent:
       
 17618     case SimpleMemoComponent:
       
 17619       {
       
 17620         var updateQueue = current$$1.updateQueue;
       
 17621         if (updateQueue !== null) {
       
 17622           var lastEffect = updateQueue.lastEffect;
       
 17623           if (lastEffect !== null) {
       
 17624             var firstEffect = lastEffect.next;
       
 17625             var effect = firstEffect;
       
 17626             do {
       
 17627               var destroy = effect.destroy;
       
 17628               if (destroy !== undefined) {
       
 17629                 safelyCallDestroy(current$$1, destroy);
       
 17630               }
       
 17631               effect = effect.next;
       
 17632             } while (effect !== firstEffect);
       
 17633           }
       
 17634         }
       
 17635         break;
       
 17636       }
       
 17637     case ClassComponent:
       
 17638       {
       
 17639         safelyDetachRef(current$$1);
       
 17640         var instance = current$$1.stateNode;
       
 17641         if (typeof instance.componentWillUnmount === 'function') {
       
 17642           safelyCallComponentWillUnmount(current$$1, instance);
       
 17643         }
       
 17644         return;
       
 17645       }
       
 17646     case HostComponent:
       
 17647       {
       
 17648         safelyDetachRef(current$$1);
       
 17649         return;
       
 17650       }
       
 17651     case HostPortal:
       
 17652       {
       
 17653         // TODO: this is recursive.
       
 17654         // We are also not using this parent because
       
 17655         // the portal will get pushed immediately.
       
 17656         if (supportsMutation) {
       
 17657           unmountHostComponents(current$$1);
       
 17658         } else if (supportsPersistence) {
       
 17659           emptyPortalContainer(current$$1);
       
 17660         }
       
 17661         return;
       
 17662       }
       
 17663   }
       
 17664 }
       
 17665 
       
 17666 function commitNestedUnmounts(root) {
       
 17667   // While we're inside a removed host node we don't want to call
       
 17668   // removeChild on the inner nodes because they're removed by the top
       
 17669   // call anyway. We also want to call componentWillUnmount on all
       
 17670   // composites before this host node is removed from the tree. Therefore
       
 17671   var node = root;
       
 17672   while (true) {
       
 17673     commitUnmount(node);
       
 17674     // Visit children because they may contain more composite or host nodes.
       
 17675     // Skip portals because commitUnmount() currently visits them recursively.
       
 17676     if (node.child !== null && (
       
 17677     // If we use mutation we drill down into portals using commitUnmount above.
       
 17678     // If we don't use mutation we drill down into portals here instead.
       
 17679     !supportsMutation || node.tag !== HostPortal)) {
       
 17680       node.child.return = node;
       
 17681       node = node.child;
       
 17682       continue;
       
 17683     }
       
 17684     if (node === root) {
       
 17685       return;
       
 17686     }
       
 17687     while (node.sibling === null) {
       
 17688       if (node.return === null || node.return === root) {
       
 17689         return;
       
 17690       }
       
 17691       node = node.return;
       
 17692     }
       
 17693     node.sibling.return = node.return;
       
 17694     node = node.sibling;
       
 17695   }
       
 17696 }
       
 17697 
       
 17698 function detachFiber(current$$1) {
       
 17699   // Cut off the return pointers to disconnect it from the tree. Ideally, we
       
 17700   // should clear the child pointer of the parent alternate to let this
       
 17701   // get GC:ed but we don't know which for sure which parent is the current
       
 17702   // one so we'll settle for GC:ing the subtree of this child. This child
       
 17703   // itself will be GC:ed when the parent updates the next time.
       
 17704   current$$1.return = null;
       
 17705   current$$1.child = null;
       
 17706   current$$1.memoizedState = null;
       
 17707   current$$1.updateQueue = null;
       
 17708   var alternate = current$$1.alternate;
       
 17709   if (alternate !== null) {
       
 17710     alternate.return = null;
       
 17711     alternate.child = null;
       
 17712     alternate.memoizedState = null;
       
 17713     alternate.updateQueue = null;
       
 17714   }
       
 17715 }
       
 17716 
       
 17717 function emptyPortalContainer(current$$1) {
       
 17718   if (!supportsPersistence) {
       
 17719     return;
       
 17720   }
       
 17721 
       
 17722   var portal = current$$1.stateNode;
       
 17723   var containerInfo = portal.containerInfo;
       
 17724 
       
 17725   var emptyChildSet = createContainerChildSet(containerInfo);
       
 17726   replaceContainerChildren(containerInfo, emptyChildSet);
       
 17727 }
       
 17728 
       
 17729 function commitContainer(finishedWork) {
       
 17730   if (!supportsPersistence) {
       
 17731     return;
       
 17732   }
       
 17733 
       
 17734   switch (finishedWork.tag) {
       
 17735     case ClassComponent:
       
 17736       {
       
 17737         return;
       
 17738       }
       
 17739     case HostComponent:
       
 17740       {
       
 17741         return;
       
 17742       }
       
 17743     case HostText:
       
 17744       {
       
 17745         return;
       
 17746       }
       
 17747     case HostRoot:
       
 17748     case HostPortal:
       
 17749       {
       
 17750         var portalOrRoot = finishedWork.stateNode;
       
 17751         var containerInfo = portalOrRoot.containerInfo,
       
 17752             _pendingChildren = portalOrRoot.pendingChildren;
       
 17753 
       
 17754         replaceContainerChildren(containerInfo, _pendingChildren);
       
 17755         return;
       
 17756       }
       
 17757     default:
       
 17758       {
       
 17759         invariant(false, 'This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue.');
       
 17760       }
       
 17761   }
       
 17762 }
       
 17763 
       
 17764 function getHostParentFiber(fiber) {
       
 17765   var parent = fiber.return;
       
 17766   while (parent !== null) {
       
 17767     if (isHostParent(parent)) {
       
 17768       return parent;
       
 17769     }
       
 17770     parent = parent.return;
       
 17771   }
       
 17772   invariant(false, 'Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue.');
       
 17773 }
       
 17774 
       
 17775 function isHostParent(fiber) {
       
 17776   return fiber.tag === HostComponent || fiber.tag === HostRoot || fiber.tag === HostPortal;
       
 17777 }
       
 17778 
       
 17779 function getHostSibling(fiber) {
       
 17780   // We're going to search forward into the tree until we find a sibling host
       
 17781   // node. Unfortunately, if multiple insertions are done in a row we have to
       
 17782   // search past them. This leads to exponential search for the next sibling.
       
 17783   var node = fiber;
       
 17784   siblings: while (true) {
       
 17785     // If we didn't find anything, let's try the next sibling.
       
 17786     while (node.sibling === null) {
       
 17787       if (node.return === null || isHostParent(node.return)) {
       
 17788         // If we pop out of the root or hit the parent the fiber we are the
       
 17789         // last sibling.
       
 17790         return null;
       
 17791       }
       
 17792       node = node.return;
       
 17793     }
       
 17794     node.sibling.return = node.return;
       
 17795     node = node.sibling;
       
 17796     while (node.tag !== HostComponent && node.tag !== HostText && node.tag !== DehydratedSuspenseComponent) {
       
 17797       // If it is not host node and, we might have a host node inside it.
       
 17798       // Try to search down until we find one.
       
 17799       if (node.effectTag & Placement) {
       
 17800         // If we don't have a child, try the siblings instead.
       
 17801         continue siblings;
       
 17802       }
       
 17803       // If we don't have a child, try the siblings instead.
       
 17804       // We also skip portals because they are not part of this host tree.
       
 17805       if (node.child === null || node.tag === HostPortal) {
       
 17806         continue siblings;
       
 17807       } else {
       
 17808         node.child.return = node;
       
 17809         node = node.child;
       
 17810       }
       
 17811     }
       
 17812     // Check if this host node is stable or about to be placed.
       
 17813     if (!(node.effectTag & Placement)) {
       
 17814       // Found it!
       
 17815       return node.stateNode;
       
 17816     }
       
 17817   }
       
 17818 }
       
 17819 
       
 17820 function commitPlacement(finishedWork) {
       
 17821   if (!supportsMutation) {
       
 17822     return;
       
 17823   }
       
 17824 
       
 17825   // Recursively insert all host nodes into the parent.
       
 17826   var parentFiber = getHostParentFiber(finishedWork);
       
 17827 
       
 17828   // Note: these two variables *must* always be updated together.
       
 17829   var parent = void 0;
       
 17830   var isContainer = void 0;
       
 17831 
       
 17832   switch (parentFiber.tag) {
       
 17833     case HostComponent:
       
 17834       parent = parentFiber.stateNode;
       
 17835       isContainer = false;
       
 17836       break;
       
 17837     case HostRoot:
       
 17838       parent = parentFiber.stateNode.containerInfo;
       
 17839       isContainer = true;
       
 17840       break;
       
 17841     case HostPortal:
       
 17842       parent = parentFiber.stateNode.containerInfo;
       
 17843       isContainer = true;
       
 17844       break;
       
 17845     default:
       
 17846       invariant(false, 'Invalid host parent fiber. This error is likely caused by a bug in React. Please file an issue.');
       
 17847   }
       
 17848   if (parentFiber.effectTag & ContentReset) {
       
 17849     // Reset the text content of the parent before doing any insertions
       
 17850     resetTextContent(parent);
       
 17851     // Clear ContentReset from the effect tag
       
 17852     parentFiber.effectTag &= ~ContentReset;
       
 17853   }
       
 17854 
       
 17855   var before = getHostSibling(finishedWork);
       
 17856   // We only have the top Fiber that was inserted but we need to recurse down its
       
 17857   // children to find all the terminal nodes.
       
 17858   var node = finishedWork;
       
 17859   while (true) {
       
 17860     if (node.tag === HostComponent || node.tag === HostText) {
       
 17861       if (before) {
       
 17862         if (isContainer) {
       
 17863           insertInContainerBefore(parent, node.stateNode, before);
       
 17864         } else {
       
 17865           insertBefore(parent, node.stateNode, before);
       
 17866         }
       
 17867       } else {
       
 17868         if (isContainer) {
       
 17869           appendChildToContainer(parent, node.stateNode);
       
 17870         } else {
       
 17871           appendChild(parent, node.stateNode);
       
 17872         }
       
 17873       }
       
 17874     } else if (node.tag === HostPortal) {
       
 17875       // If the insertion itself is a portal, then we don't want to traverse
       
 17876       // down its children. Instead, we'll get insertions from each child in
       
 17877       // the portal directly.
       
 17878     } else if (node.child !== null) {
       
 17879       node.child.return = node;
       
 17880       node = node.child;
       
 17881       continue;
       
 17882     }
       
 17883     if (node === finishedWork) {
       
 17884       return;
       
 17885     }
       
 17886     while (node.sibling === null) {
       
 17887       if (node.return === null || node.return === finishedWork) {
       
 17888         return;
       
 17889       }
       
 17890       node = node.return;
       
 17891     }
       
 17892     node.sibling.return = node.return;
       
 17893     node = node.sibling;
       
 17894   }
       
 17895 }
       
 17896 
       
 17897 function unmountHostComponents(current$$1) {
       
 17898   // We only have the top Fiber that was deleted but we need to recurse down its
       
 17899   var node = current$$1;
       
 17900 
       
 17901   // Each iteration, currentParent is populated with node's host parent if not
       
 17902   // currentParentIsValid.
       
 17903   var currentParentIsValid = false;
       
 17904 
       
 17905   // Note: these two variables *must* always be updated together.
       
 17906   var currentParent = void 0;
       
 17907   var currentParentIsContainer = void 0;
       
 17908 
       
 17909   while (true) {
       
 17910     if (!currentParentIsValid) {
       
 17911       var parent = node.return;
       
 17912       findParent: while (true) {
       
 17913         !(parent !== null) ? invariant(false, 'Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue.') : void 0;
       
 17914         switch (parent.tag) {
       
 17915           case HostComponent:
       
 17916             currentParent = parent.stateNode;
       
 17917             currentParentIsContainer = false;
       
 17918             break findParent;
       
 17919           case HostRoot:
       
 17920             currentParent = parent.stateNode.containerInfo;
       
 17921             currentParentIsContainer = true;
       
 17922             break findParent;
       
 17923           case HostPortal:
       
 17924             currentParent = parent.stateNode.containerInfo;
       
 17925             currentParentIsContainer = true;
       
 17926             break findParent;
       
 17927         }
       
 17928         parent = parent.return;
       
 17929       }
       
 17930       currentParentIsValid = true;
       
 17931     }
       
 17932 
       
 17933     if (node.tag === HostComponent || node.tag === HostText) {
       
 17934       commitNestedUnmounts(node);
       
 17935       // After all the children have unmounted, it is now safe to remove the
       
 17936       // node from the tree.
       
 17937       if (currentParentIsContainer) {
       
 17938         removeChildFromContainer(currentParent, node.stateNode);
       
 17939       } else {
       
 17940         removeChild(currentParent, node.stateNode);
       
 17941       }
       
 17942       // Don't visit children because we already visited them.
       
 17943     } else if (enableSuspenseServerRenderer && node.tag === DehydratedSuspenseComponent) {
       
 17944       // Delete the dehydrated suspense boundary and all of its content.
       
 17945       if (currentParentIsContainer) {
       
 17946         clearSuspenseBoundaryFromContainer(currentParent, node.stateNode);
       
 17947       } else {
       
 17948         clearSuspenseBoundary(currentParent, node.stateNode);
       
 17949       }
       
 17950     } else if (node.tag === HostPortal) {
       
 17951       if (node.child !== null) {
       
 17952         // When we go into a portal, it becomes the parent to remove from.
       
 17953         // We will reassign it back when we pop the portal on the way up.
       
 17954         currentParent = node.stateNode.containerInfo;
       
 17955         currentParentIsContainer = true;
       
 17956         // Visit children because portals might contain host components.
       
 17957         node.child.return = node;
       
 17958         node = node.child;
       
 17959         continue;
       
 17960       }
       
 17961     } else {
       
 17962       commitUnmount(node);
       
 17963       // Visit children because we may find more host components below.
       
 17964       if (node.child !== null) {
       
 17965         node.child.return = node;
       
 17966         node = node.child;
       
 17967         continue;
       
 17968       }
       
 17969     }
       
 17970     if (node === current$$1) {
       
 17971       return;
       
 17972     }
       
 17973     while (node.sibling === null) {
       
 17974       if (node.return === null || node.return === current$$1) {
       
 17975         return;
       
 17976       }
       
 17977       node = node.return;
       
 17978       if (node.tag === HostPortal) {
       
 17979         // When we go out of the portal, we need to restore the parent.
       
 17980         // Since we don't keep a stack of them, we will search for it.
       
 17981         currentParentIsValid = false;
       
 17982       }
       
 17983     }
       
 17984     node.sibling.return = node.return;
       
 17985     node = node.sibling;
       
 17986   }
       
 17987 }
       
 17988 
       
 17989 function commitDeletion(current$$1) {
       
 17990   if (supportsMutation) {
       
 17991     // Recursively delete all host nodes from the parent.
       
 17992     // Detach refs and call componentWillUnmount() on the whole subtree.
       
 17993     unmountHostComponents(current$$1);
       
 17994   } else {
       
 17995     // Detach refs and call componentWillUnmount() on the whole subtree.
       
 17996     commitNestedUnmounts(current$$1);
       
 17997   }
       
 17998   detachFiber(current$$1);
       
 17999 }
       
 18000 
       
 18001 function commitWork(current$$1, finishedWork) {
       
 18002   if (!supportsMutation) {
       
 18003     switch (finishedWork.tag) {
       
 18004       case FunctionComponent:
       
 18005       case ForwardRef:
       
 18006       case MemoComponent:
       
 18007       case SimpleMemoComponent:
       
 18008         {
       
 18009           // Note: We currently never use MountMutation, but useLayout uses
       
 18010           // UnmountMutation.
       
 18011           commitHookEffectList(UnmountMutation, MountMutation, finishedWork);
       
 18012           return;
       
 18013         }
       
 18014     }
       
 18015 
       
 18016     commitContainer(finishedWork);
       
 18017     return;
       
 18018   }
       
 18019 
       
 18020   switch (finishedWork.tag) {
       
 18021     case FunctionComponent:
       
 18022     case ForwardRef:
       
 18023     case MemoComponent:
       
 18024     case SimpleMemoComponent:
       
 18025       {
       
 18026         // Note: We currently never use MountMutation, but useLayout uses
       
 18027         // UnmountMutation.
       
 18028         commitHookEffectList(UnmountMutation, MountMutation, finishedWork);
       
 18029         return;
       
 18030       }
       
 18031     case ClassComponent:
       
 18032       {
       
 18033         return;
       
 18034       }
       
 18035     case HostComponent:
       
 18036       {
       
 18037         var instance = finishedWork.stateNode;
       
 18038         if (instance != null) {
       
 18039           // Commit the work prepared earlier.
       
 18040           var newProps = finishedWork.memoizedProps;
       
 18041           // For hydration we reuse the update path but we treat the oldProps
       
 18042           // as the newProps. The updatePayload will contain the real change in
       
 18043           // this case.
       
 18044           var oldProps = current$$1 !== null ? current$$1.memoizedProps : newProps;
       
 18045           var type = finishedWork.type;
       
 18046           // TODO: Type the updateQueue to be specific to host components.
       
 18047           var updatePayload = finishedWork.updateQueue;
       
 18048           finishedWork.updateQueue = null;
       
 18049           if (updatePayload !== null) {
       
 18050             commitUpdate(instance, updatePayload, type, oldProps, newProps, finishedWork);
       
 18051           }
       
 18052         }
       
 18053         return;
       
 18054       }
       
 18055     case HostText:
       
 18056       {
       
 18057         !(finishedWork.stateNode !== null) ? invariant(false, 'This should have a text node initialized. This error is likely caused by a bug in React. Please file an issue.') : void 0;
       
 18058         var textInstance = finishedWork.stateNode;
       
 18059         var newText = finishedWork.memoizedProps;
       
 18060         // For hydration we reuse the update path but we treat the oldProps
       
 18061         // as the newProps. The updatePayload will contain the real change in
       
 18062         // this case.
       
 18063         var oldText = current$$1 !== null ? current$$1.memoizedProps : newText;
       
 18064         commitTextUpdate(textInstance, oldText, newText);
       
 18065         return;
       
 18066       }
       
 18067     case HostRoot:
       
 18068       {
       
 18069         return;
       
 18070       }
       
 18071     case Profiler:
       
 18072       {
       
 18073         return;
       
 18074       }
       
 18075     case SuspenseComponent:
       
 18076       {
       
 18077         var newState = finishedWork.memoizedState;
       
 18078 
       
 18079         var newDidTimeout = void 0;
       
 18080         var primaryChildParent = finishedWork;
       
 18081         if (newState === null) {
       
 18082           newDidTimeout = false;
       
 18083         } else {
       
 18084           newDidTimeout = true;
       
 18085           primaryChildParent = finishedWork.child;
       
 18086           if (newState.timedOutAt === NoWork) {
       
 18087             // If the children had not already timed out, record the time.
       
 18088             // This is used to compute the elapsed time during subsequent
       
 18089             // attempts to render the children.
       
 18090             newState.timedOutAt = requestCurrentTime();
       
 18091           }
       
 18092         }
       
 18093 
       
 18094         if (primaryChildParent !== null) {
       
 18095           hideOrUnhideAllChildren(primaryChildParent, newDidTimeout);
       
 18096         }
       
 18097 
       
 18098         // If this boundary just timed out, then it will have a set of thenables.
       
 18099         // For each thenable, attach a listener so that when it resolves, React
       
 18100         // attempts to re-render the boundary in the primary (pre-timeout) state.
       
 18101         var thenables = finishedWork.updateQueue;
       
 18102         if (thenables !== null) {
       
 18103           finishedWork.updateQueue = null;
       
 18104           var retryCache = finishedWork.stateNode;
       
 18105           if (retryCache === null) {
       
 18106             retryCache = finishedWork.stateNode = new PossiblyWeakSet$1();
       
 18107           }
       
 18108           thenables.forEach(function (thenable) {
       
 18109             // Memoize using the boundary fiber to prevent redundant listeners.
       
 18110             var retry = retryTimedOutBoundary.bind(null, finishedWork, thenable);
       
 18111             if (enableSchedulerTracing) {
       
 18112               retry = unstable_wrap(retry);
       
 18113             }
       
 18114             if (!retryCache.has(thenable)) {
       
 18115               retryCache.add(thenable);
       
 18116               thenable.then(retry, retry);
       
 18117             }
       
 18118           });
       
 18119         }
       
 18120 
       
 18121         return;
       
 18122       }
       
 18123     case IncompleteClassComponent:
       
 18124       {
       
 18125         return;
       
 18126       }
       
 18127     default:
       
 18128       {
       
 18129         invariant(false, 'This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue.');
       
 18130       }
       
 18131   }
       
 18132 }
       
 18133 
       
 18134 function commitResetTextContent(current$$1) {
       
 18135   if (!supportsMutation) {
       
 18136     return;
       
 18137   }
       
 18138   resetTextContent(current$$1.stateNode);
       
 18139 }
       
 18140 
       
 18141 var PossiblyWeakSet = typeof WeakSet === 'function' ? WeakSet : Set;
       
 18142 var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map;
       
 18143 
       
 18144 function createRootErrorUpdate(fiber, errorInfo, expirationTime) {
       
 18145   var update = createUpdate(expirationTime);
       
 18146   // Unmount the root by rendering null.
       
 18147   update.tag = CaptureUpdate;
       
 18148   // Caution: React DevTools currently depends on this property
       
 18149   // being called "element".
       
 18150   update.payload = { element: null };
       
 18151   var error = errorInfo.value;
       
 18152   update.callback = function () {
       
 18153     onUncaughtError(error);
       
 18154     logError(fiber, errorInfo);
       
 18155   };
       
 18156   return update;
       
 18157 }
       
 18158 
       
 18159 function createClassErrorUpdate(fiber, errorInfo, expirationTime) {
       
 18160   var update = createUpdate(expirationTime);
       
 18161   update.tag = CaptureUpdate;
       
 18162   var getDerivedStateFromError = fiber.type.getDerivedStateFromError;
       
 18163   if (typeof getDerivedStateFromError === 'function') {
       
 18164     var error = errorInfo.value;
       
 18165     update.payload = function () {
       
 18166       return getDerivedStateFromError(error);
       
 18167     };
       
 18168   }
       
 18169 
       
 18170   var inst = fiber.stateNode;
       
 18171   if (inst !== null && typeof inst.componentDidCatch === 'function') {
       
 18172     update.callback = function callback() {
       
 18173       if (typeof getDerivedStateFromError !== 'function') {
       
 18174         // To preserve the preexisting retry behavior of error boundaries,
       
 18175         // we keep track of which ones already failed during this batch.
       
 18176         // This gets reset before we yield back to the browser.
       
 18177         // TODO: Warn in strict mode if getDerivedStateFromError is
       
 18178         // not defined.
       
 18179         markLegacyErrorBoundaryAsFailed(this);
       
 18180       }
       
 18181       var error = errorInfo.value;
       
 18182       var stack = errorInfo.stack;
       
 18183       logError(fiber, errorInfo);
       
 18184       this.componentDidCatch(error, {
       
 18185         componentStack: stack !== null ? stack : ''
       
 18186       });
       
 18187       {
       
 18188         if (typeof getDerivedStateFromError !== 'function') {
       
 18189           // If componentDidCatch is the only error boundary method defined,
       
 18190           // then it needs to call setState to recover from errors.
       
 18191           // If no state update is scheduled then the boundary will swallow the error.
       
 18192           !(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;
       
 18193         }
       
 18194       }
       
 18195     };
       
 18196   }
       
 18197   return update;
       
 18198 }
       
 18199 
       
 18200 function attachPingListener(root, renderExpirationTime, thenable) {
       
 18201   // Attach a listener to the promise to "ping" the root and retry. But
       
 18202   // only if one does not already exist for the current render expiration
       
 18203   // time (which acts like a "thread ID" here).
       
 18204   var pingCache = root.pingCache;
       
 18205   var threadIDs = void 0;
       
 18206   if (pingCache === null) {
       
 18207     pingCache = root.pingCache = new PossiblyWeakMap();
       
 18208     threadIDs = new Set();
       
 18209     pingCache.set(thenable, threadIDs);
       
 18210   } else {
       
 18211     threadIDs = pingCache.get(thenable);
       
 18212     if (threadIDs === undefined) {
       
 18213       threadIDs = new Set();
       
 18214       pingCache.set(thenable, threadIDs);
       
 18215     }
       
 18216   }
       
 18217   if (!threadIDs.has(renderExpirationTime)) {
       
 18218     // Memoize using the thread ID to prevent redundant listeners.
       
 18219     threadIDs.add(renderExpirationTime);
       
 18220     var ping = pingSuspendedRoot.bind(null, root, thenable, renderExpirationTime);
       
 18221     if (enableSchedulerTracing) {
       
 18222       ping = unstable_wrap(ping);
       
 18223     }
       
 18224     thenable.then(ping, ping);
       
 18225   }
       
 18226 }
       
 18227 
       
 18228 function throwException(root, returnFiber, sourceFiber, value, renderExpirationTime) {
       
 18229   // The source fiber did not complete.
       
 18230   sourceFiber.effectTag |= Incomplete;
       
 18231   // Its effect list is no longer valid.
       
 18232   sourceFiber.firstEffect = sourceFiber.lastEffect = null;
       
 18233 
       
 18234   if (value !== null && typeof value === 'object' && typeof value.then === 'function') {
       
 18235     // This is a thenable.
       
 18236     var thenable = value;
       
 18237 
       
 18238     // Find the earliest timeout threshold of all the placeholders in the
       
 18239     // ancestor path. We could avoid this traversal by storing the thresholds on
       
 18240     // the stack, but we choose not to because we only hit this path if we're
       
 18241     // IO-bound (i.e. if something suspends). Whereas the stack is used even in
       
 18242     // the non-IO- bound case.
       
 18243     var _workInProgress = returnFiber;
       
 18244     var earliestTimeoutMs = -1;
       
 18245     var startTimeMs = -1;
       
 18246     do {
       
 18247       if (_workInProgress.tag === SuspenseComponent) {
       
 18248         var current$$1 = _workInProgress.alternate;
       
 18249         if (current$$1 !== null) {
       
 18250           var currentState = current$$1.memoizedState;
       
 18251           if (currentState !== null) {
       
 18252             // Reached a boundary that already timed out. Do not search
       
 18253             // any further.
       
 18254             var timedOutAt = currentState.timedOutAt;
       
 18255             startTimeMs = expirationTimeToMs(timedOutAt);
       
 18256             // Do not search any further.
       
 18257             break;
       
 18258           }
       
 18259         }
       
 18260         var timeoutPropMs = _workInProgress.pendingProps.maxDuration;
       
 18261         if (typeof timeoutPropMs === 'number') {
       
 18262           if (timeoutPropMs <= 0) {
       
 18263             earliestTimeoutMs = 0;
       
 18264           } else if (earliestTimeoutMs === -1 || timeoutPropMs < earliestTimeoutMs) {
       
 18265             earliestTimeoutMs = timeoutPropMs;
       
 18266           }
       
 18267         }
       
 18268       }
       
 18269       // If there is a DehydratedSuspenseComponent we don't have to do anything because
       
 18270       // if something suspends inside it, we will simply leave that as dehydrated. It
       
 18271       // will never timeout.
       
 18272       _workInProgress = _workInProgress.return;
       
 18273     } while (_workInProgress !== null);
       
 18274 
       
 18275     // Schedule the nearest Suspense to re-render the timed out view.
       
 18276     _workInProgress = returnFiber;
       
 18277     do {
       
 18278       if (_workInProgress.tag === SuspenseComponent && shouldCaptureSuspense(_workInProgress)) {
       
 18279         // Found the nearest boundary.
       
 18280 
       
 18281         // Stash the promise on the boundary fiber. If the boundary times out, we'll
       
 18282         var thenables = _workInProgress.updateQueue;
       
 18283         if (thenables === null) {
       
 18284           var updateQueue = new Set();
       
 18285           updateQueue.add(thenable);
       
 18286           _workInProgress.updateQueue = updateQueue;
       
 18287         } else {
       
 18288           thenables.add(thenable);
       
 18289         }
       
 18290 
       
 18291         // If the boundary is outside of concurrent mode, we should *not*
       
 18292         // suspend the commit. Pretend as if the suspended component rendered
       
 18293         // null and keep rendering. In the commit phase, we'll schedule a
       
 18294         // subsequent synchronous update to re-render the Suspense.
       
 18295         //
       
 18296         // Note: It doesn't matter whether the component that suspended was
       
 18297         // inside a concurrent mode tree. If the Suspense is outside of it, we
       
 18298         // should *not* suspend the commit.
       
 18299         if ((_workInProgress.mode & ConcurrentMode) === NoEffect) {
       
 18300           _workInProgress.effectTag |= DidCapture;
       
 18301 
       
 18302           // We're going to commit this fiber even though it didn't complete.
       
 18303           // But we shouldn't call any lifecycle methods or callbacks. Remove
       
 18304           // all lifecycle effect tags.
       
 18305           sourceFiber.effectTag &= ~(LifecycleEffectMask | Incomplete);
       
 18306 
       
 18307           if (sourceFiber.tag === ClassComponent) {
       
 18308             var currentSourceFiber = sourceFiber.alternate;
       
 18309             if (currentSourceFiber === null) {
       
 18310               // This is a new mount. Change the tag so it's not mistaken for a
       
 18311               // completed class component. For example, we should not call
       
 18312               // componentWillUnmount if it is deleted.
       
 18313               sourceFiber.tag = IncompleteClassComponent;
       
 18314             } else {
       
 18315               // When we try rendering again, we should not reuse the current fiber,
       
 18316               // since it's known to be in an inconsistent state. Use a force updte to
       
 18317               // prevent a bail out.
       
 18318               var update = createUpdate(Sync);
       
 18319               update.tag = ForceUpdate;
       
 18320               enqueueUpdate(sourceFiber, update);
       
 18321             }
       
 18322           }
       
 18323 
       
 18324           // The source fiber did not complete. Mark it with Sync priority to
       
 18325           // indicate that it still has pending work.
       
 18326           sourceFiber.expirationTime = Sync;
       
 18327 
       
 18328           // Exit without suspending.
       
 18329           return;
       
 18330         }
       
 18331 
       
 18332         // Confirmed that the boundary is in a concurrent mode tree. Continue
       
 18333         // with the normal suspend path.
       
 18334 
       
 18335         attachPingListener(root, renderExpirationTime, thenable);
       
 18336 
       
 18337         var absoluteTimeoutMs = void 0;
       
 18338         if (earliestTimeoutMs === -1) {
       
 18339           // If no explicit threshold is given, default to an arbitrarily large
       
 18340           // value. The actual size doesn't matter because the threshold for the
       
 18341           // whole tree will be clamped to the expiration time.
       
 18342           absoluteTimeoutMs = maxSigned31BitInt;
       
 18343         } else {
       
 18344           if (startTimeMs === -1) {
       
 18345             // This suspend happened outside of any already timed-out
       
 18346             // placeholders. We don't know exactly when the update was
       
 18347             // scheduled, but we can infer an approximate start time from the
       
 18348             // expiration time. First, find the earliest uncommitted expiration
       
 18349             // time in the tree, including work that is suspended. Then subtract
       
 18350             // the offset used to compute an async update's expiration time.
       
 18351             // This will cause high priority (interactive) work to expire
       
 18352             // earlier than necessary, but we can account for this by adjusting
       
 18353             // for the Just Noticeable Difference.
       
 18354             var earliestExpirationTime = findEarliestOutstandingPriorityLevel(root, renderExpirationTime);
       
 18355             var earliestExpirationTimeMs = expirationTimeToMs(earliestExpirationTime);
       
 18356             startTimeMs = earliestExpirationTimeMs - LOW_PRIORITY_EXPIRATION;
       
 18357           }
       
 18358           absoluteTimeoutMs = startTimeMs + earliestTimeoutMs;
       
 18359         }
       
 18360 
       
 18361         // Mark the earliest timeout in the suspended fiber's ancestor path.
       
 18362         // After completing the root, we'll take the largest of all the
       
 18363         // suspended fiber's timeouts and use it to compute a timeout for the
       
 18364         // whole tree.
       
 18365         renderDidSuspend(root, absoluteTimeoutMs, renderExpirationTime);
       
 18366 
       
 18367         _workInProgress.effectTag |= ShouldCapture;
       
 18368         _workInProgress.expirationTime = renderExpirationTime;
       
 18369         return;
       
 18370       } else if (enableSuspenseServerRenderer && _workInProgress.tag === DehydratedSuspenseComponent) {
       
 18371         attachPingListener(root, renderExpirationTime, thenable);
       
 18372 
       
 18373         // Since we already have a current fiber, we can eagerly add a retry listener.
       
 18374         var retryCache = _workInProgress.memoizedState;
       
 18375         if (retryCache === null) {
       
 18376           retryCache = _workInProgress.memoizedState = new PossiblyWeakSet();
       
 18377           var _current = _workInProgress.alternate;
       
 18378           !_current ? invariant(false, 'A dehydrated suspense boundary must commit before trying to render. This is probably a bug in React.') : void 0;
       
 18379           _current.memoizedState = retryCache;
       
 18380         }
       
 18381         // Memoize using the boundary fiber to prevent redundant listeners.
       
 18382         if (!retryCache.has(thenable)) {
       
 18383           retryCache.add(thenable);
       
 18384           var retry = retryTimedOutBoundary.bind(null, _workInProgress, thenable);
       
 18385           if (enableSchedulerTracing) {
       
 18386             retry = unstable_wrap(retry);
       
 18387           }
       
 18388           thenable.then(retry, retry);
       
 18389         }
       
 18390         _workInProgress.effectTag |= ShouldCapture;
       
 18391         _workInProgress.expirationTime = renderExpirationTime;
       
 18392         return;
       
 18393       }
       
 18394       // This boundary already captured during this render. Continue to the next
       
 18395       // boundary.
       
 18396       _workInProgress = _workInProgress.return;
       
 18397     } while (_workInProgress !== null);
       
 18398     // No boundary was found. Fallthrough to error mode.
       
 18399     // TODO: Use invariant so the message is stripped in prod?
       
 18400     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));
       
 18401   }
       
 18402 
       
 18403   // We didn't find a boundary that could handle this type of exception. Start
       
 18404   // over and traverse parent path again, this time treating the exception
       
 18405   // as an error.
       
 18406   renderDidError();
       
 18407   value = createCapturedValue(value, sourceFiber);
       
 18408   var workInProgress = returnFiber;
       
 18409   do {
       
 18410     switch (workInProgress.tag) {
       
 18411       case HostRoot:
       
 18412         {
       
 18413           var _errorInfo = value;
       
 18414           workInProgress.effectTag |= ShouldCapture;
       
 18415           workInProgress.expirationTime = renderExpirationTime;
       
 18416           var _update = createRootErrorUpdate(workInProgress, _errorInfo, renderExpirationTime);
       
 18417           enqueueCapturedUpdate(workInProgress, _update);
       
 18418           return;
       
 18419         }
       
 18420       case ClassComponent:
       
 18421         // Capture and retry
       
 18422         var errorInfo = value;
       
 18423         var ctor = workInProgress.type;
       
 18424         var instance = workInProgress.stateNode;
       
 18425         if ((workInProgress.effectTag & DidCapture) === NoEffect && (typeof ctor.getDerivedStateFromError === 'function' || instance !== null && typeof instance.componentDidCatch === 'function' && !isAlreadyFailedLegacyErrorBoundary(instance))) {
       
 18426           workInProgress.effectTag |= ShouldCapture;
       
 18427           workInProgress.expirationTime = renderExpirationTime;
       
 18428           // Schedule the error boundary to re-render using updated state
       
 18429           var _update2 = createClassErrorUpdate(workInProgress, errorInfo, renderExpirationTime);
       
 18430           enqueueCapturedUpdate(workInProgress, _update2);
       
 18431           return;
       
 18432         }
       
 18433         break;
       
 18434       default:
       
 18435         break;
       
 18436     }
       
 18437     workInProgress = workInProgress.return;
       
 18438   } while (workInProgress !== null);
       
 18439 }
       
 18440 
       
 18441 function unwindWork(workInProgress, renderExpirationTime) {
       
 18442   switch (workInProgress.tag) {
       
 18443     case ClassComponent:
       
 18444       {
       
 18445         var Component = workInProgress.type;
       
 18446         if (isContextProvider(Component)) {
       
 18447           popContext(workInProgress);
       
 18448         }
       
 18449         var effectTag = workInProgress.effectTag;
       
 18450         if (effectTag & ShouldCapture) {
       
 18451           workInProgress.effectTag = effectTag & ~ShouldCapture | DidCapture;
       
 18452           return workInProgress;
       
 18453         }
       
 18454         return null;
       
 18455       }
       
 18456     case HostRoot:
       
 18457       {
       
 18458         popHostContainer(workInProgress);
       
 18459         popTopLevelContextObject(workInProgress);
       
 18460         var _effectTag = workInProgress.effectTag;
       
 18461         !((_effectTag & DidCapture) === NoEffect) ? invariant(false, 'The root failed to unmount after an error. This is likely a bug in React. Please file an issue.') : void 0;
       
 18462         workInProgress.effectTag = _effectTag & ~ShouldCapture | DidCapture;
       
 18463         return workInProgress;
       
 18464       }
       
 18465     case HostComponent:
       
 18466       {
       
 18467         // TODO: popHydrationState
       
 18468         popHostContext(workInProgress);
       
 18469         return null;
       
 18470       }
       
 18471     case SuspenseComponent:
       
 18472       {
       
 18473         var _effectTag2 = workInProgress.effectTag;
       
 18474         if (_effectTag2 & ShouldCapture) {
       
 18475           workInProgress.effectTag = _effectTag2 & ~ShouldCapture | DidCapture;
       
 18476           // Captured a suspense effect. Re-render the boundary.
       
 18477           return workInProgress;
       
 18478         }
       
 18479         return null;
       
 18480       }
       
 18481     case DehydratedSuspenseComponent:
       
 18482       {
       
 18483         if (enableSuspenseServerRenderer) {
       
 18484           // TODO: popHydrationState
       
 18485           var _effectTag3 = workInProgress.effectTag;
       
 18486           if (_effectTag3 & ShouldCapture) {
       
 18487             workInProgress.effectTag = _effectTag3 & ~ShouldCapture | DidCapture;
       
 18488             // Captured a suspense effect. Re-render the boundary.
       
 18489             return workInProgress;
       
 18490           }
       
 18491         }
       
 18492         return null;
       
 18493       }
       
 18494     case HostPortal:
       
 18495       popHostContainer(workInProgress);
       
 18496       return null;
       
 18497     case ContextProvider:
       
 18498       popProvider(workInProgress);
       
 18499       return null;
       
 18500     default:
       
 18501       return null;
       
 18502   }
       
 18503 }
       
 18504 
       
 18505 function unwindInterruptedWork(interruptedWork) {
       
 18506   switch (interruptedWork.tag) {
       
 18507     case ClassComponent:
       
 18508       {
       
 18509         var childContextTypes = interruptedWork.type.childContextTypes;
       
 18510         if (childContextTypes !== null && childContextTypes !== undefined) {
       
 18511           popContext(interruptedWork);
       
 18512         }
       
 18513         break;
       
 18514       }
       
 18515     case HostRoot:
       
 18516       {
       
 18517         popHostContainer(interruptedWork);
       
 18518         popTopLevelContextObject(interruptedWork);
       
 18519         break;
       
 18520       }
       
 18521     case HostComponent:
       
 18522       {
       
 18523         popHostContext(interruptedWork);
       
 18524         break;
       
 18525       }
       
 18526     case HostPortal:
       
 18527       popHostContainer(interruptedWork);
       
 18528       break;
       
 18529     case ContextProvider:
       
 18530       popProvider(interruptedWork);
       
 18531       break;
       
 18532     default:
       
 18533       break;
       
 18534   }
       
 18535 }
       
 18536 
       
 18537 var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
       
 18538 var ReactCurrentOwner$2 = ReactSharedInternals.ReactCurrentOwner;
       
 18539 
       
 18540 
       
 18541 var didWarnAboutStateTransition = void 0;
       
 18542 var didWarnSetStateChildContext = void 0;
       
 18543 var warnAboutUpdateOnUnmounted = void 0;
       
 18544 var warnAboutInvalidUpdates = void 0;
       
 18545 
       
 18546 if (enableSchedulerTracing) {
       
 18547   // Provide explicit error message when production+profiling bundle of e.g. react-dom
       
 18548   // is used with production (non-profiling) bundle of scheduler/tracing
       
 18549   !(__interactionsRef != null && __interactionsRef.current != null) ? invariant(false, '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') : void 0;
       
 18550 }
       
 18551 
       
 18552 {
       
 18553   didWarnAboutStateTransition = false;
       
 18554   didWarnSetStateChildContext = false;
       
 18555   var didWarnStateUpdateForUnmountedComponent = {};
       
 18556 
       
 18557   warnAboutUpdateOnUnmounted = function (fiber, isClass) {
       
 18558     // We show the whole stack but dedupe on the top component's name because
       
 18559     // the problematic code almost always lies inside that component.
       
 18560     var componentName = getComponentName(fiber.type) || 'ReactComponent';
       
 18561     if (didWarnStateUpdateForUnmountedComponent[componentName]) {
       
 18562       return;
       
 18563     }
       
 18564     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', isClass ? 'the componentWillUnmount method' : 'a useEffect cleanup function', getStackByFiberInDevAndProd(fiber));
       
 18565     didWarnStateUpdateForUnmountedComponent[componentName] = true;
       
 18566   };
       
 18567 
       
 18568   warnAboutInvalidUpdates = function (instance) {
       
 18569     switch (phase) {
       
 18570       case 'getChildContext':
       
 18571         if (didWarnSetStateChildContext) {
       
 18572           return;
       
 18573         }
       
 18574         warningWithoutStack$1(false, 'setState(...): Cannot call setState() inside getChildContext()');
       
 18575         didWarnSetStateChildContext = true;
       
 18576         break;
       
 18577       case 'render':
       
 18578         if (didWarnAboutStateTransition) {
       
 18579           return;
       
 18580         }
       
 18581         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.');
       
 18582         didWarnAboutStateTransition = true;
       
 18583         break;
       
 18584     }
       
 18585   };
       
 18586 }
       
 18587 
       
 18588 // Used to ensure computeUniqueAsyncExpiration is monotonically decreasing.
       
 18589 var lastUniqueAsyncExpiration = Sync - 1;
       
 18590 
       
 18591 var isWorking = false;
       
 18592 
       
 18593 // The next work in progress fiber that we're currently working on.
       
 18594 var nextUnitOfWork = null;
       
 18595 var nextRoot = null;
       
 18596 // The time at which we're currently rendering work.
       
 18597 var nextRenderExpirationTime = NoWork;
       
 18598 var nextLatestAbsoluteTimeoutMs = -1;
       
 18599 var nextRenderDidError = false;
       
 18600 
       
 18601 // The next fiber with an effect that we're currently committing.
       
 18602 var nextEffect = null;
       
 18603 
       
 18604 var isCommitting$1 = false;
       
 18605 var rootWithPendingPassiveEffects = null;
       
 18606 var passiveEffectCallbackHandle = null;
       
 18607 var passiveEffectCallback = null;
       
 18608 
       
 18609 var legacyErrorBoundariesThatAlreadyFailed = null;
       
 18610 
       
 18611 // Used for performance tracking.
       
 18612 var interruptedBy = null;
       
 18613 
       
 18614 var stashedWorkInProgressProperties = void 0;
       
 18615 var replayUnitOfWork = void 0;
       
 18616 var mayReplayFailedUnitOfWork = void 0;
       
 18617 var isReplayingFailedUnitOfWork = void 0;
       
 18618 var originalReplayError = void 0;
       
 18619 var rethrowOriginalError = void 0;
       
 18620 if (true && replayFailedUnitOfWorkWithInvokeGuardedCallback) {
       
 18621   stashedWorkInProgressProperties = null;
       
 18622   mayReplayFailedUnitOfWork = true;
       
 18623   isReplayingFailedUnitOfWork = false;
       
 18624   originalReplayError = null;
       
 18625   replayUnitOfWork = function (failedUnitOfWork, thrownValue, isYieldy) {
       
 18626     if (thrownValue !== null && typeof thrownValue === 'object' && typeof thrownValue.then === 'function') {
       
 18627       // Don't replay promises. Treat everything else like an error.
       
 18628       // TODO: Need to figure out a different strategy if/when we add
       
 18629       // support for catching other types.
       
 18630       return;
       
 18631     }
       
 18632 
       
 18633     // Restore the original state of the work-in-progress
       
 18634     if (stashedWorkInProgressProperties === null) {
       
 18635       // This should never happen. Don't throw because this code is DEV-only.
       
 18636       warningWithoutStack$1(false, 'Could not replay rendering after an error. This is likely a bug in React. ' + 'Please file an issue.');
       
 18637       return;
       
 18638     }
       
 18639     assignFiberPropertiesInDEV(failedUnitOfWork, stashedWorkInProgressProperties);
       
 18640 
       
 18641     switch (failedUnitOfWork.tag) {
       
 18642       case HostRoot:
       
 18643         popHostContainer(failedUnitOfWork);
       
 18644         popTopLevelContextObject(failedUnitOfWork);
       
 18645         break;
       
 18646       case HostComponent:
       
 18647         popHostContext(failedUnitOfWork);
       
 18648         break;
       
 18649       case ClassComponent:
       
 18650         {
       
 18651           var Component = failedUnitOfWork.type;
       
 18652           if (isContextProvider(Component)) {
       
 18653             popContext(failedUnitOfWork);
       
 18654           }
       
 18655           break;
       
 18656         }
       
 18657       case HostPortal:
       
 18658         popHostContainer(failedUnitOfWork);
       
 18659         break;
       
 18660       case ContextProvider:
       
 18661         popProvider(failedUnitOfWork);
       
 18662         break;
       
 18663     }
       
 18664     // Replay the begin phase.
       
 18665     isReplayingFailedUnitOfWork = true;
       
 18666     originalReplayError = thrownValue;
       
 18667     invokeGuardedCallback(null, workLoop, null, isYieldy);
       
 18668     isReplayingFailedUnitOfWork = false;
       
 18669     originalReplayError = null;
       
 18670     if (hasCaughtError()) {
       
 18671       var replayError = clearCaughtError();
       
 18672       if (replayError != null && thrownValue != null) {
       
 18673         try {
       
 18674           // Reading the expando property is intentionally
       
 18675           // inside `try` because it might be a getter or Proxy.
       
 18676           if (replayError._suppressLogging) {
       
 18677             // Also suppress logging for the original error.
       
 18678             thrownValue._suppressLogging = true;
       
 18679           }
       
 18680         } catch (inner) {
       
 18681           // Ignore.
       
 18682         }
       
 18683       }
       
 18684     } else {
       
 18685       // If the begin phase did not fail the second time, set this pointer
       
 18686       // back to the original value.
       
 18687       nextUnitOfWork = failedUnitOfWork;
       
 18688     }
       
 18689   };
       
 18690   rethrowOriginalError = function () {
       
 18691     throw originalReplayError;
       
 18692   };
       
 18693 }
       
 18694 
       
 18695 function resetStack() {
       
 18696   if (nextUnitOfWork !== null) {
       
 18697     var interruptedWork = nextUnitOfWork.return;
       
 18698     while (interruptedWork !== null) {
       
 18699       unwindInterruptedWork(interruptedWork);
       
 18700       interruptedWork = interruptedWork.return;
       
 18701     }
       
 18702   }
       
 18703 
       
 18704   {
       
 18705     ReactStrictModeWarnings.discardPendingWarnings();
       
 18706     checkThatStackIsEmpty();
       
 18707   }
       
 18708 
       
 18709   nextRoot = null;
       
 18710   nextRenderExpirationTime = NoWork;
       
 18711   nextLatestAbsoluteTimeoutMs = -1;
       
 18712   nextRenderDidError = false;
       
 18713   nextUnitOfWork = null;
       
 18714 }
       
 18715 
       
 18716 function commitAllHostEffects() {
       
 18717   while (nextEffect !== null) {
       
 18718     {
       
 18719       setCurrentFiber(nextEffect);
       
 18720     }
       
 18721     recordEffect();
       
 18722 
       
 18723     var effectTag = nextEffect.effectTag;
       
 18724 
       
 18725     if (effectTag & ContentReset) {
       
 18726       commitResetTextContent(nextEffect);
       
 18727     }
       
 18728 
       
 18729     if (effectTag & Ref) {
       
 18730       var current$$1 = nextEffect.alternate;
       
 18731       if (current$$1 !== null) {
       
 18732         commitDetachRef(current$$1);
       
 18733       }
       
 18734     }
       
 18735 
       
 18736     // The following switch statement is only concerned about placement,
       
 18737     // updates, and deletions. To avoid needing to add a case for every
       
 18738     // possible bitmap value, we remove the secondary effects from the
       
 18739     // effect tag and switch on that value.
       
 18740     var primaryEffectTag = effectTag & (Placement | Update | Deletion);
       
 18741     switch (primaryEffectTag) {
       
 18742       case Placement:
       
 18743         {
       
 18744           commitPlacement(nextEffect);
       
 18745           // Clear the "placement" from effect tag so that we know that this is inserted, before
       
 18746           // any life-cycles like componentDidMount gets called.
       
 18747           // TODO: findDOMNode doesn't rely on this any more but isMounted
       
 18748           // does and isMounted is deprecated anyway so we should be able
       
 18749           // to kill this.
       
 18750           nextEffect.effectTag &= ~Placement;
       
 18751           break;
       
 18752         }
       
 18753       case PlacementAndUpdate:
       
 18754         {
       
 18755           // Placement
       
 18756           commitPlacement(nextEffect);
       
 18757           // Clear the "placement" from effect tag so that we know that this is inserted, before
       
 18758           // any life-cycles like componentDidMount gets called.
       
 18759           nextEffect.effectTag &= ~Placement;
       
 18760 
       
 18761           // Update
       
 18762           var _current = nextEffect.alternate;
       
 18763           commitWork(_current, nextEffect);
       
 18764           break;
       
 18765         }
       
 18766       case Update:
       
 18767         {
       
 18768           var _current2 = nextEffect.alternate;
       
 18769           commitWork(_current2, nextEffect);
       
 18770           break;
       
 18771         }
       
 18772       case Deletion:
       
 18773         {
       
 18774           commitDeletion(nextEffect);
       
 18775           break;
       
 18776         }
       
 18777     }
       
 18778     nextEffect = nextEffect.nextEffect;
       
 18779   }
       
 18780 
       
 18781   {
       
 18782     resetCurrentFiber();
       
 18783   }
       
 18784 }
       
 18785 
       
 18786 function commitBeforeMutationLifecycles() {
       
 18787   while (nextEffect !== null) {
       
 18788     {
       
 18789       setCurrentFiber(nextEffect);
       
 18790     }
       
 18791 
       
 18792     var effectTag = nextEffect.effectTag;
       
 18793     if (effectTag & Snapshot) {
       
 18794       recordEffect();
       
 18795       var current$$1 = nextEffect.alternate;
       
 18796       commitBeforeMutationLifeCycles(current$$1, nextEffect);
       
 18797     }
       
 18798 
       
 18799     nextEffect = nextEffect.nextEffect;
       
 18800   }
       
 18801 
       
 18802   {
       
 18803     resetCurrentFiber();
       
 18804   }
       
 18805 }
       
 18806 
       
 18807 function commitAllLifeCycles(finishedRoot, committedExpirationTime) {
       
 18808   {
       
 18809     ReactStrictModeWarnings.flushPendingUnsafeLifecycleWarnings();
       
 18810     ReactStrictModeWarnings.flushLegacyContextWarning();
       
 18811 
       
 18812     if (warnAboutDeprecatedLifecycles) {
       
 18813       ReactStrictModeWarnings.flushPendingDeprecationWarnings();
       
 18814     }
       
 18815   }
       
 18816   while (nextEffect !== null) {
       
 18817     {
       
 18818       setCurrentFiber(nextEffect);
       
 18819     }
       
 18820     var effectTag = nextEffect.effectTag;
       
 18821 
       
 18822     if (effectTag & (Update | Callback)) {
       
 18823       recordEffect();
       
 18824       var current$$1 = nextEffect.alternate;
       
 18825       commitLifeCycles(finishedRoot, current$$1, nextEffect, committedExpirationTime);
       
 18826     }
       
 18827 
       
 18828     if (effectTag & Ref) {
       
 18829       recordEffect();
       
 18830       commitAttachRef(nextEffect);
       
 18831     }
       
 18832 
       
 18833     if (effectTag & Passive) {
       
 18834       rootWithPendingPassiveEffects = finishedRoot;
       
 18835     }
       
 18836 
       
 18837     nextEffect = nextEffect.nextEffect;
       
 18838   }
       
 18839   {
       
 18840     resetCurrentFiber();
       
 18841   }
       
 18842 }
       
 18843 
       
 18844 function commitPassiveEffects(root, firstEffect) {
       
 18845   rootWithPendingPassiveEffects = null;
       
 18846   passiveEffectCallbackHandle = null;
       
 18847   passiveEffectCallback = null;
       
 18848 
       
 18849   // Set this to true to prevent re-entrancy
       
 18850   var previousIsRendering = isRendering;
       
 18851   isRendering = true;
       
 18852 
       
 18853   var effect = firstEffect;
       
 18854   do {
       
 18855     {
       
 18856       setCurrentFiber(effect);
       
 18857     }
       
 18858 
       
 18859     if (effect.effectTag & Passive) {
       
 18860       var didError = false;
       
 18861       var error = void 0;
       
 18862       {
       
 18863         invokeGuardedCallback(null, commitPassiveHookEffects, null, effect);
       
 18864         if (hasCaughtError()) {
       
 18865           didError = true;
       
 18866           error = clearCaughtError();
       
 18867         }
       
 18868       }
       
 18869       if (didError) {
       
 18870         captureCommitPhaseError(effect, error);
       
 18871       }
       
 18872     }
       
 18873     effect = effect.nextEffect;
       
 18874   } while (effect !== null);
       
 18875   {
       
 18876     resetCurrentFiber();
       
 18877   }
       
 18878 
       
 18879   isRendering = previousIsRendering;
       
 18880 
       
 18881   // Check if work was scheduled by one of the effects
       
 18882   var rootExpirationTime = root.expirationTime;
       
 18883   if (rootExpirationTime !== NoWork) {
       
 18884     requestWork(root, rootExpirationTime);
       
 18885   }
       
 18886   // Flush any sync work that was scheduled by effects
       
 18887   if (!isBatchingUpdates && !isRendering) {
       
 18888     performSyncWork();
       
 18889   }
       
 18890 }
       
 18891 
       
 18892 function isAlreadyFailedLegacyErrorBoundary(instance) {
       
 18893   return legacyErrorBoundariesThatAlreadyFailed !== null && legacyErrorBoundariesThatAlreadyFailed.has(instance);
       
 18894 }
       
 18895 
       
 18896 function markLegacyErrorBoundaryAsFailed(instance) {
       
 18897   if (legacyErrorBoundariesThatAlreadyFailed === null) {
       
 18898     legacyErrorBoundariesThatAlreadyFailed = new Set([instance]);
       
 18899   } else {
       
 18900     legacyErrorBoundariesThatAlreadyFailed.add(instance);
       
 18901   }
       
 18902 }
       
 18903 
       
 18904 function flushPassiveEffects() {
       
 18905   if (passiveEffectCallbackHandle !== null) {
       
 18906     cancelPassiveEffects(passiveEffectCallbackHandle);
       
 18907   }
       
 18908   if (passiveEffectCallback !== null) {
       
 18909     // We call the scheduled callback instead of commitPassiveEffects directly
       
 18910     // to ensure tracing works correctly.
       
 18911     passiveEffectCallback();
       
 18912   }
       
 18913 }
       
 18914 
       
 18915 function commitRoot(root, finishedWork) {
       
 18916   isWorking = true;
       
 18917   isCommitting$1 = true;
       
 18918   startCommitTimer();
       
 18919 
       
 18920   !(root.current !== finishedWork) ? invariant(false, 'Cannot commit the same tree as before. This is probably a bug related to the return field. This error is likely caused by a bug in React. Please file an issue.') : void 0;
       
 18921   var committedExpirationTime = root.pendingCommitExpirationTime;
       
 18922   !(committedExpirationTime !== NoWork) ? invariant(false, 'Cannot commit an incomplete root. This error is likely caused by a bug in React. Please file an issue.') : void 0;
       
 18923   root.pendingCommitExpirationTime = NoWork;
       
 18924 
       
 18925   // Update the pending priority levels to account for the work that we are
       
 18926   // about to commit. This needs to happen before calling the lifecycles, since
       
 18927   // they may schedule additional updates.
       
 18928   var updateExpirationTimeBeforeCommit = finishedWork.expirationTime;
       
 18929   var childExpirationTimeBeforeCommit = finishedWork.childExpirationTime;
       
 18930   var earliestRemainingTimeBeforeCommit = childExpirationTimeBeforeCommit > updateExpirationTimeBeforeCommit ? childExpirationTimeBeforeCommit : updateExpirationTimeBeforeCommit;
       
 18931   markCommittedPriorityLevels(root, earliestRemainingTimeBeforeCommit);
       
 18932 
       
 18933   var prevInteractions = null;
       
 18934   if (enableSchedulerTracing) {
       
 18935     // Restore any pending interactions at this point,
       
 18936     // So that cascading work triggered during the render phase will be accounted for.
       
 18937     prevInteractions = __interactionsRef.current;
       
 18938     __interactionsRef.current = root.memoizedInteractions;
       
 18939   }
       
 18940 
       
 18941   // Reset this to null before calling lifecycles
       
 18942   ReactCurrentOwner$2.current = null;
       
 18943 
       
 18944   var firstEffect = void 0;
       
 18945   if (finishedWork.effectTag > PerformedWork) {
       
 18946     // A fiber's effect list consists only of its children, not itself. So if
       
 18947     // the root has an effect, we need to add it to the end of the list. The
       
 18948     // resulting list is the set that would belong to the root's parent, if
       
 18949     // it had one; that is, all the effects in the tree including the root.
       
 18950     if (finishedWork.lastEffect !== null) {
       
 18951       finishedWork.lastEffect.nextEffect = finishedWork;
       
 18952       firstEffect = finishedWork.firstEffect;
       
 18953     } else {
       
 18954       firstEffect = finishedWork;
       
 18955     }
       
 18956   } else {
       
 18957     // There is no effect on the root.
       
 18958     firstEffect = finishedWork.firstEffect;
       
 18959   }
       
 18960 
       
 18961   prepareForCommit(root.containerInfo);
       
 18962 
       
 18963   // Invoke instances of getSnapshotBeforeUpdate before mutation.
       
 18964   nextEffect = firstEffect;
       
 18965   startCommitSnapshotEffectsTimer();
       
 18966   while (nextEffect !== null) {
       
 18967     var didError = false;
       
 18968     var error = void 0;
       
 18969     {
       
 18970       invokeGuardedCallback(null, commitBeforeMutationLifecycles, null);
       
 18971       if (hasCaughtError()) {
       
 18972         didError = true;
       
 18973         error = clearCaughtError();
       
 18974       }
       
 18975     }
       
 18976     if (didError) {
       
 18977       !(nextEffect !== null) ? invariant(false, 'Should have next effect. This error is likely caused by a bug in React. Please file an issue.') : void 0;
       
 18978       captureCommitPhaseError(nextEffect, error);
       
 18979       // Clean-up
       
 18980       if (nextEffect !== null) {
       
 18981         nextEffect = nextEffect.nextEffect;
       
 18982       }
       
 18983     }
       
 18984   }
       
 18985   stopCommitSnapshotEffectsTimer();
       
 18986 
       
 18987   if (enableProfilerTimer) {
       
 18988     // Mark the current commit time to be shared by all Profilers in this batch.
       
 18989     // This enables them to be grouped later.
       
 18990     recordCommitTime();
       
 18991   }
       
 18992 
       
 18993   // Commit all the side-effects within a tree. We'll do this in two passes.
       
 18994   // The first pass performs all the host insertions, updates, deletions and
       
 18995   // ref unmounts.
       
 18996   nextEffect = firstEffect;
       
 18997   startCommitHostEffectsTimer();
       
 18998   while (nextEffect !== null) {
       
 18999     var _didError = false;
       
 19000     var _error = void 0;
       
 19001     {
       
 19002       invokeGuardedCallback(null, commitAllHostEffects, null);
       
 19003       if (hasCaughtError()) {
       
 19004         _didError = true;
       
 19005         _error = clearCaughtError();
       
 19006       }
       
 19007     }
       
 19008     if (_didError) {
       
 19009       !(nextEffect !== null) ? invariant(false, 'Should have next effect. This error is likely caused by a bug in React. Please file an issue.') : void 0;
       
 19010       captureCommitPhaseError(nextEffect, _error);
       
 19011       // Clean-up
       
 19012       if (nextEffect !== null) {
       
 19013         nextEffect = nextEffect.nextEffect;
       
 19014       }
       
 19015     }
       
 19016   }
       
 19017   stopCommitHostEffectsTimer();
       
 19018 
       
 19019   resetAfterCommit(root.containerInfo);
       
 19020 
       
 19021   // The work-in-progress tree is now the current tree. This must come after
       
 19022   // the first pass of the commit phase, so that the previous tree is still
       
 19023   // current during componentWillUnmount, but before the second pass, so that
       
 19024   // the finished work is current during componentDidMount/Update.
       
 19025   root.current = finishedWork;
       
 19026 
       
 19027   // In the second pass we'll perform all life-cycles and ref callbacks.
       
 19028   // Life-cycles happen as a separate pass so that all placements, updates,
       
 19029   // and deletions in the entire tree have already been invoked.
       
 19030   // This pass also triggers any renderer-specific initial effects.
       
 19031   nextEffect = firstEffect;
       
 19032   startCommitLifeCyclesTimer();
       
 19033   while (nextEffect !== null) {
       
 19034     var _didError2 = false;
       
 19035     var _error2 = void 0;
       
 19036     {
       
 19037       invokeGuardedCallback(null, commitAllLifeCycles, null, root, committedExpirationTime);
       
 19038       if (hasCaughtError()) {
       
 19039         _didError2 = true;
       
 19040         _error2 = clearCaughtError();
       
 19041       }
       
 19042     }
       
 19043     if (_didError2) {
       
 19044       !(nextEffect !== null) ? invariant(false, 'Should have next effect. This error is likely caused by a bug in React. Please file an issue.') : void 0;
       
 19045       captureCommitPhaseError(nextEffect, _error2);
       
 19046       if (nextEffect !== null) {
       
 19047         nextEffect = nextEffect.nextEffect;
       
 19048       }
       
 19049     }
       
 19050   }
       
 19051 
       
 19052   if (firstEffect !== null && rootWithPendingPassiveEffects !== null) {
       
 19053     // This commit included a passive effect. These do not need to fire until
       
 19054     // after the next paint. Schedule an callback to fire them in an async
       
 19055     // event. To ensure serial execution, the callback will be flushed early if
       
 19056     // we enter rootWithPendingPassiveEffects commit phase before then.
       
 19057     var callback = commitPassiveEffects.bind(null, root, firstEffect);
       
 19058     if (enableSchedulerTracing) {
       
 19059       // TODO: Avoid this extra callback by mutating the tracing ref directly,
       
 19060       // like we do at the beginning of commitRoot. I've opted not to do that
       
 19061       // here because that code is still in flux.
       
 19062       callback = unstable_wrap(callback);
       
 19063     }
       
 19064     passiveEffectCallbackHandle = unstable_runWithPriority(unstable_NormalPriority, function () {
       
 19065       return schedulePassiveEffects(callback);
       
 19066     });
       
 19067     passiveEffectCallback = callback;
       
 19068   }
       
 19069 
       
 19070   isCommitting$1 = false;
       
 19071   isWorking = false;
       
 19072   stopCommitLifeCyclesTimer();
       
 19073   stopCommitTimer();
       
 19074   onCommitRoot(finishedWork.stateNode);
       
 19075   if (true && ReactFiberInstrumentation_1.debugTool) {
       
 19076     ReactFiberInstrumentation_1.debugTool.onCommitWork(finishedWork);
       
 19077   }
       
 19078 
       
 19079   var updateExpirationTimeAfterCommit = finishedWork.expirationTime;
       
 19080   var childExpirationTimeAfterCommit = finishedWork.childExpirationTime;
       
 19081   var earliestRemainingTimeAfterCommit = childExpirationTimeAfterCommit > updateExpirationTimeAfterCommit ? childExpirationTimeAfterCommit : updateExpirationTimeAfterCommit;
       
 19082   if (earliestRemainingTimeAfterCommit === NoWork) {
       
 19083     // If there's no remaining work, we can clear the set of already failed
       
 19084     // error boundaries.
       
 19085     legacyErrorBoundariesThatAlreadyFailed = null;
       
 19086   }
       
 19087   onCommit(root, earliestRemainingTimeAfterCommit);
       
 19088 
       
 19089   if (enableSchedulerTracing) {
       
 19090     __interactionsRef.current = prevInteractions;
       
 19091 
       
 19092     var subscriber = void 0;
       
 19093 
       
 19094     try {
       
 19095       subscriber = __subscriberRef.current;
       
 19096       if (subscriber !== null && root.memoizedInteractions.size > 0) {
       
 19097         var threadID = computeThreadID(committedExpirationTime, root.interactionThreadID);
       
 19098         subscriber.onWorkStopped(root.memoizedInteractions, threadID);
       
 19099       }
       
 19100     } catch (error) {
       
 19101       // It's not safe for commitRoot() to throw.
       
 19102       // Store the error for now and we'll re-throw in finishRendering().
       
 19103       if (!hasUnhandledError) {
       
 19104         hasUnhandledError = true;
       
 19105         unhandledError = error;
       
 19106       }
       
 19107     } finally {
       
 19108       // Clear completed interactions from the pending Map.
       
 19109       // Unless the render was suspended or cascading work was scheduled,
       
 19110       // In which case– leave pending interactions until the subsequent render.
       
 19111       var pendingInteractionMap = root.pendingInteractionMap;
       
 19112       pendingInteractionMap.forEach(function (scheduledInteractions, scheduledExpirationTime) {
       
 19113         // Only decrement the pending interaction count if we're done.
       
 19114         // If there's still work at the current priority,
       
 19115         // That indicates that we are waiting for suspense data.
       
 19116         if (scheduledExpirationTime > earliestRemainingTimeAfterCommit) {
       
 19117           pendingInteractionMap.delete(scheduledExpirationTime);
       
 19118 
       
 19119           scheduledInteractions.forEach(function (interaction) {
       
 19120             interaction.__count--;
       
 19121 
       
 19122             if (subscriber !== null && interaction.__count === 0) {
       
 19123               try {
       
 19124                 subscriber.onInteractionScheduledWorkCompleted(interaction);
       
 19125               } catch (error) {
       
 19126                 // It's not safe for commitRoot() to throw.
       
 19127                 // Store the error for now and we'll re-throw in finishRendering().
       
 19128                 if (!hasUnhandledError) {
       
 19129                   hasUnhandledError = true;
       
 19130                   unhandledError = error;
       
 19131                 }
       
 19132               }
       
 19133             }
       
 19134           });
       
 19135         }
       
 19136       });
       
 19137     }
       
 19138   }
       
 19139 }
       
 19140 
       
 19141 function resetChildExpirationTime(workInProgress, renderTime) {
       
 19142   if (renderTime !== Never && workInProgress.childExpirationTime === Never) {
       
 19143     // The children of this component are hidden. Don't bubble their
       
 19144     // expiration times.
       
 19145     return;
       
 19146   }
       
 19147 
       
 19148   var newChildExpirationTime = NoWork;
       
 19149 
       
 19150   // Bubble up the earliest expiration time.
       
 19151   if (enableProfilerTimer && workInProgress.mode & ProfileMode) {
       
 19152     // We're in profiling mode.
       
 19153     // Let's use this same traversal to update the render durations.
       
 19154     var actualDuration = workInProgress.actualDuration;
       
 19155     var treeBaseDuration = workInProgress.selfBaseDuration;
       
 19156 
       
 19157     // When a fiber is cloned, its actualDuration is reset to 0.
       
 19158     // This value will only be updated if work is done on the fiber (i.e. it doesn't bailout).
       
 19159     // When work is done, it should bubble to the parent's actualDuration.
       
 19160     // If the fiber has not been cloned though, (meaning no work was done),
       
 19161     // Then this value will reflect the amount of time spent working on a previous render.
       
 19162     // In that case it should not bubble.
       
 19163     // We determine whether it was cloned by comparing the child pointer.
       
 19164     var shouldBubbleActualDurations = workInProgress.alternate === null || workInProgress.child !== workInProgress.alternate.child;
       
 19165 
       
 19166     var child = workInProgress.child;
       
 19167     while (child !== null) {
       
 19168       var childUpdateExpirationTime = child.expirationTime;
       
 19169       var childChildExpirationTime = child.childExpirationTime;
       
 19170       if (childUpdateExpirationTime > newChildExpirationTime) {
       
 19171         newChildExpirationTime = childUpdateExpirationTime;
       
 19172       }
       
 19173       if (childChildExpirationTime > newChildExpirationTime) {
       
 19174         newChildExpirationTime = childChildExpirationTime;
       
 19175       }
       
 19176       if (shouldBubbleActualDurations) {
       
 19177         actualDuration += child.actualDuration;
       
 19178       }
       
 19179       treeBaseDuration += child.treeBaseDuration;
       
 19180       child = child.sibling;
       
 19181     }
       
 19182     workInProgress.actualDuration = actualDuration;
       
 19183     workInProgress.treeBaseDuration = treeBaseDuration;
       
 19184   } else {
       
 19185     var _child = workInProgress.child;
       
 19186     while (_child !== null) {
       
 19187       var _childUpdateExpirationTime = _child.expirationTime;
       
 19188       var _childChildExpirationTime = _child.childExpirationTime;
       
 19189       if (_childUpdateExpirationTime > newChildExpirationTime) {
       
 19190         newChildExpirationTime = _childUpdateExpirationTime;
       
 19191       }
       
 19192       if (_childChildExpirationTime > newChildExpirationTime) {
       
 19193         newChildExpirationTime = _childChildExpirationTime;
       
 19194       }
       
 19195       _child = _child.sibling;
       
 19196     }
       
 19197   }
       
 19198 
       
 19199   workInProgress.childExpirationTime = newChildExpirationTime;
       
 19200 }
       
 19201 
       
 19202 function completeUnitOfWork(workInProgress) {
       
 19203   // Attempt to complete the current unit of work, then move to the
       
 19204   // next sibling. If there are no more siblings, return to the
       
 19205   // parent fiber.
       
 19206   while (true) {
       
 19207     // The current, flushed, state of this fiber is the alternate.
       
 19208     // Ideally nothing should rely on this, but relying on it here
       
 19209     // means that we don't need an additional field on the work in
       
 19210     // progress.
       
 19211     var current$$1 = workInProgress.alternate;
       
 19212     {
       
 19213       setCurrentFiber(workInProgress);
       
 19214     }
       
 19215 
       
 19216     var returnFiber = workInProgress.return;
       
 19217     var siblingFiber = workInProgress.sibling;
       
 19218 
       
 19219     if ((workInProgress.effectTag & Incomplete) === NoEffect) {
       
 19220       if (true && replayFailedUnitOfWorkWithInvokeGuardedCallback) {
       
 19221         // Don't replay if it fails during completion phase.
       
 19222         mayReplayFailedUnitOfWork = false;
       
 19223       }
       
 19224       // This fiber completed.
       
 19225       // Remember we're completing this unit so we can find a boundary if it fails.
       
 19226       nextUnitOfWork = workInProgress;
       
 19227       if (enableProfilerTimer) {
       
 19228         if (workInProgress.mode & ProfileMode) {
       
 19229           startProfilerTimer(workInProgress);
       
 19230         }
       
 19231         nextUnitOfWork = completeWork(current$$1, workInProgress, nextRenderExpirationTime);
       
 19232         if (workInProgress.mode & ProfileMode) {
       
 19233           // Update render duration assuming we didn't error.
       
 19234           stopProfilerTimerIfRunningAndRecordDelta(workInProgress, false);
       
 19235         }
       
 19236       } else {
       
 19237         nextUnitOfWork = completeWork(current$$1, workInProgress, nextRenderExpirationTime);
       
 19238       }
       
 19239       if (true && replayFailedUnitOfWorkWithInvokeGuardedCallback) {
       
 19240         // We're out of completion phase so replaying is fine now.
       
 19241         mayReplayFailedUnitOfWork = true;
       
 19242       }
       
 19243       stopWorkTimer(workInProgress);
       
 19244       resetChildExpirationTime(workInProgress, nextRenderExpirationTime);
       
 19245       {
       
 19246         resetCurrentFiber();
       
 19247       }
       
 19248 
       
 19249       if (nextUnitOfWork !== null) {
       
 19250         // Completing this fiber spawned new work. Work on that next.
       
 19251         return nextUnitOfWork;
       
 19252       }
       
 19253 
       
 19254       if (returnFiber !== null &&
       
 19255       // Do not append effects to parents if a sibling failed to complete
       
 19256       (returnFiber.effectTag & Incomplete) === NoEffect) {
       
 19257         // Append all the effects of the subtree and this fiber onto the effect
       
 19258         // list of the parent. The completion order of the children affects the
       
 19259         // side-effect order.
       
 19260         if (returnFiber.firstEffect === null) {
       
 19261           returnFiber.firstEffect = workInProgress.firstEffect;
       
 19262         }
       
 19263         if (workInProgress.lastEffect !== null) {
       
 19264           if (returnFiber.lastEffect !== null) {
       
 19265             returnFiber.lastEffect.nextEffect = workInProgress.firstEffect;
       
 19266           }
       
 19267           returnFiber.lastEffect = workInProgress.lastEffect;
       
 19268         }
       
 19269 
       
 19270         // If this fiber had side-effects, we append it AFTER the children's
       
 19271         // side-effects. We can perform certain side-effects earlier if
       
 19272         // needed, by doing multiple passes over the effect list. We don't want
       
 19273         // to schedule our own side-effect on our own list because if end up
       
 19274         // reusing children we'll schedule this effect onto itself since we're
       
 19275         // at the end.
       
 19276         var effectTag = workInProgress.effectTag;
       
 19277         // Skip both NoWork and PerformedWork tags when creating the effect list.
       
 19278         // PerformedWork effect is read by React DevTools but shouldn't be committed.
       
 19279         if (effectTag > PerformedWork) {
       
 19280           if (returnFiber.lastEffect !== null) {
       
 19281             returnFiber.lastEffect.nextEffect = workInProgress;
       
 19282           } else {
       
 19283             returnFiber.firstEffect = workInProgress;
       
 19284           }
       
 19285           returnFiber.lastEffect = workInProgress;
       
 19286         }
       
 19287       }
       
 19288 
       
 19289       if (true && ReactFiberInstrumentation_1.debugTool) {
       
 19290         ReactFiberInstrumentation_1.debugTool.onCompleteWork(workInProgress);
       
 19291       }
       
 19292 
       
 19293       if (siblingFiber !== null) {
       
 19294         // If there is more work to do in this returnFiber, do that next.
       
 19295         return siblingFiber;
       
 19296       } else if (returnFiber !== null) {
       
 19297         // If there's no more work in this returnFiber. Complete the returnFiber.
       
 19298         workInProgress = returnFiber;
       
 19299         continue;
       
 19300       } else {
       
 19301         // We've reached the root.
       
 19302         return null;
       
 19303       }
       
 19304     } else {
       
 19305       if (enableProfilerTimer && workInProgress.mode & ProfileMode) {
       
 19306         // Record the render duration for the fiber that errored.
       
 19307         stopProfilerTimerIfRunningAndRecordDelta(workInProgress, false);
       
 19308 
       
 19309         // Include the time spent working on failed children before continuing.
       
 19310         var actualDuration = workInProgress.actualDuration;
       
 19311         var child = workInProgress.child;
       
 19312         while (child !== null) {
       
 19313           actualDuration += child.actualDuration;
       
 19314           child = child.sibling;
       
 19315         }
       
 19316         workInProgress.actualDuration = actualDuration;
       
 19317       }
       
 19318 
       
 19319       // This fiber did not complete because something threw. Pop values off
       
 19320       // the stack without entering the complete phase. If this is a boundary,
       
 19321       // capture values if possible.
       
 19322       var next = unwindWork(workInProgress, nextRenderExpirationTime);
       
 19323       // Because this fiber did not complete, don't reset its expiration time.
       
 19324       if (workInProgress.effectTag & DidCapture) {
       
 19325         // Restarting an error boundary
       
 19326         stopFailedWorkTimer(workInProgress);
       
 19327       } else {
       
 19328         stopWorkTimer(workInProgress);
       
 19329       }
       
 19330 
       
 19331       {
       
 19332         resetCurrentFiber();
       
 19333       }
       
 19334 
       
 19335       if (next !== null) {
       
 19336         stopWorkTimer(workInProgress);
       
 19337         if (true && ReactFiberInstrumentation_1.debugTool) {
       
 19338           ReactFiberInstrumentation_1.debugTool.onCompleteWork(workInProgress);
       
 19339         }
       
 19340 
       
 19341         // If completing this work spawned new work, do that next. We'll come
       
 19342         // back here again.
       
 19343         // Since we're restarting, remove anything that is not a host effect
       
 19344         // from the effect tag.
       
 19345         next.effectTag &= HostEffectMask;
       
 19346         return next;
       
 19347       }
       
 19348 
       
 19349       if (returnFiber !== null) {
       
 19350         // Mark the parent fiber as incomplete and clear its effect list.
       
 19351         returnFiber.firstEffect = returnFiber.lastEffect = null;
       
 19352         returnFiber.effectTag |= Incomplete;
       
 19353       }
       
 19354 
       
 19355       if (true && ReactFiberInstrumentation_1.debugTool) {
       
 19356         ReactFiberInstrumentation_1.debugTool.onCompleteWork(workInProgress);
       
 19357       }
       
 19358 
       
 19359       if (siblingFiber !== null) {
       
 19360         // If there is more work to do in this returnFiber, do that next.
       
 19361         return siblingFiber;
       
 19362       } else if (returnFiber !== null) {
       
 19363         // If there's no more work in this returnFiber. Complete the returnFiber.
       
 19364         workInProgress = returnFiber;
       
 19365         continue;
       
 19366       } else {
       
 19367         return null;
       
 19368       }
       
 19369     }
       
 19370   }
       
 19371 
       
 19372   // Without this explicit null return Flow complains of invalid return type
       
 19373   // TODO Remove the above while(true) loop
       
 19374   // eslint-disable-next-line no-unreachable
       
 19375   return null;
       
 19376 }
       
 19377 
       
 19378 function performUnitOfWork(workInProgress) {
       
 19379   // The current, flushed, state of this fiber is the alternate.
       
 19380   // Ideally nothing should rely on this, but relying on it here
       
 19381   // means that we don't need an additional field on the work in
       
 19382   // progress.
       
 19383   var current$$1 = workInProgress.alternate;
       
 19384 
       
 19385   // See if beginning this work spawns more work.
       
 19386   startWorkTimer(workInProgress);
       
 19387   {
       
 19388     setCurrentFiber(workInProgress);
       
 19389   }
       
 19390 
       
 19391   if (true && replayFailedUnitOfWorkWithInvokeGuardedCallback) {
       
 19392     stashedWorkInProgressProperties = assignFiberPropertiesInDEV(stashedWorkInProgressProperties, workInProgress);
       
 19393   }
       
 19394 
       
 19395   var next = void 0;
       
 19396   if (enableProfilerTimer) {
       
 19397     if (workInProgress.mode & ProfileMode) {
       
 19398       startProfilerTimer(workInProgress);
       
 19399     }
       
 19400 
       
 19401     next = beginWork(current$$1, workInProgress, nextRenderExpirationTime);
       
 19402     workInProgress.memoizedProps = workInProgress.pendingProps;
       
 19403 
       
 19404     if (workInProgress.mode & ProfileMode) {
       
 19405       // Record the render duration assuming we didn't bailout (or error).
       
 19406       stopProfilerTimerIfRunningAndRecordDelta(workInProgress, true);
       
 19407     }
       
 19408   } else {
       
 19409     next = beginWork(current$$1, workInProgress, nextRenderExpirationTime);
       
 19410     workInProgress.memoizedProps = workInProgress.pendingProps;
       
 19411   }
       
 19412 
       
 19413   {
       
 19414     resetCurrentFiber();
       
 19415     if (isReplayingFailedUnitOfWork) {
       
 19416       // Currently replaying a failed unit of work. This should be unreachable,
       
 19417       // because the render phase is meant to be idempotent, and it should
       
 19418       // have thrown again. Since it didn't, rethrow the original error, so
       
 19419       // React's internal stack is not misaligned.
       
 19420       rethrowOriginalError();
       
 19421     }
       
 19422   }
       
 19423   if (true && ReactFiberInstrumentation_1.debugTool) {
       
 19424     ReactFiberInstrumentation_1.debugTool.onBeginWork(workInProgress);
       
 19425   }
       
 19426 
       
 19427   if (next === null) {
       
 19428     // If this doesn't spawn new work, complete the current work.
       
 19429     next = completeUnitOfWork(workInProgress);
       
 19430   }
       
 19431 
       
 19432   ReactCurrentOwner$2.current = null;
       
 19433 
       
 19434   return next;
       
 19435 }
       
 19436 
       
 19437 function workLoop(isYieldy) {
       
 19438   if (!isYieldy) {
       
 19439     // Flush work without yielding
       
 19440     while (nextUnitOfWork !== null) {
       
 19441       nextUnitOfWork = performUnitOfWork(nextUnitOfWork);
       
 19442     }
       
 19443   } else {
       
 19444     // Flush asynchronous work until there's a higher priority event
       
 19445     while (nextUnitOfWork !== null && !shouldYieldToRenderer()) {
       
 19446       nextUnitOfWork = performUnitOfWork(nextUnitOfWork);
       
 19447     }
       
 19448   }
       
 19449 }
       
 19450 
       
 19451 function renderRoot(root, isYieldy) {
       
 19452   !!isWorking ? invariant(false, 'renderRoot was called recursively. This error is likely caused by a bug in React. Please file an issue.') : void 0;
       
 19453 
       
 19454   flushPassiveEffects();
       
 19455 
       
 19456   isWorking = true;
       
 19457   var previousDispatcher = ReactCurrentDispatcher.current;
       
 19458   ReactCurrentDispatcher.current = ContextOnlyDispatcher;
       
 19459 
       
 19460   var expirationTime = root.nextExpirationTimeToWorkOn;
       
 19461 
       
 19462   // Check if we're starting from a fresh stack, or if we're resuming from
       
 19463   // previously yielded work.
       
 19464   if (expirationTime !== nextRenderExpirationTime || root !== nextRoot || nextUnitOfWork === null) {
       
 19465     // Reset the stack and start working from the root.
       
 19466     resetStack();
       
 19467     nextRoot = root;
       
 19468     nextRenderExpirationTime = expirationTime;
       
 19469     nextUnitOfWork = createWorkInProgress(nextRoot.current, null, nextRenderExpirationTime);
       
 19470     root.pendingCommitExpirationTime = NoWork;
       
 19471 
       
 19472     if (enableSchedulerTracing) {
       
 19473       // Determine which interactions this batch of work currently includes,
       
 19474       // So that we can accurately attribute time spent working on it,
       
 19475       var interactions = new Set();
       
 19476       root.pendingInteractionMap.forEach(function (scheduledInteractions, scheduledExpirationTime) {
       
 19477         if (scheduledExpirationTime >= expirationTime) {
       
 19478           scheduledInteractions.forEach(function (interaction) {
       
 19479             return interactions.add(interaction);
       
 19480           });
       
 19481         }
       
 19482       });
       
 19483 
       
 19484       // Store the current set of interactions on the FiberRoot for a few reasons:
       
 19485       // We can re-use it in hot functions like renderRoot() without having to recalculate it.
       
 19486       // We will also use it in commitWork() to pass to any Profiler onRender() hooks.
       
 19487       // This also provides DevTools with a way to access it when the onCommitRoot() hook is called.
       
 19488       root.memoizedInteractions = interactions;
       
 19489 
       
 19490       if (interactions.size > 0) {
       
 19491         var subscriber = __subscriberRef.current;
       
 19492         if (subscriber !== null) {
       
 19493           var threadID = computeThreadID(expirationTime, root.interactionThreadID);
       
 19494           try {
       
 19495             subscriber.onWorkStarted(interactions, threadID);
       
 19496           } catch (error) {
       
 19497             // Work thrown by an interaction tracing subscriber should be rethrown,
       
 19498             // But only once it's safe (to avoid leaving the scheduler in an invalid state).
       
 19499             // Store the error for now and we'll re-throw in finishRendering().
       
 19500             if (!hasUnhandledError) {
       
 19501               hasUnhandledError = true;
       
 19502               unhandledError = error;
       
 19503             }
       
 19504           }
       
 19505         }
       
 19506       }
       
 19507     }
       
 19508   }
       
 19509 
       
 19510   var prevInteractions = null;
       
 19511   if (enableSchedulerTracing) {
       
 19512     // We're about to start new traced work.
       
 19513     // Restore pending interactions so cascading work triggered during the render phase will be accounted for.
       
 19514     prevInteractions = __interactionsRef.current;
       
 19515     __interactionsRef.current = root.memoizedInteractions;
       
 19516   }
       
 19517 
       
 19518   var didFatal = false;
       
 19519 
       
 19520   startWorkLoopTimer(nextUnitOfWork);
       
 19521 
       
 19522   do {
       
 19523     try {
       
 19524       workLoop(isYieldy);
       
 19525     } catch (thrownValue) {
       
 19526       resetContextDependences();
       
 19527       resetHooks();
       
 19528 
       
 19529       // Reset in case completion throws.
       
 19530       // This is only used in DEV and when replaying is on.
       
 19531       var mayReplay = void 0;
       
 19532       if (true && replayFailedUnitOfWorkWithInvokeGuardedCallback) {
       
 19533         mayReplay = mayReplayFailedUnitOfWork;
       
 19534         mayReplayFailedUnitOfWork = true;
       
 19535       }
       
 19536 
       
 19537       if (nextUnitOfWork === null) {
       
 19538         // This is a fatal error.
       
 19539         didFatal = true;
       
 19540         onUncaughtError(thrownValue);
       
 19541       } else {
       
 19542         if (enableProfilerTimer && nextUnitOfWork.mode & ProfileMode) {
       
 19543           // Record the time spent rendering before an error was thrown.
       
 19544           // This avoids inaccurate Profiler durations in the case of a suspended render.
       
 19545           stopProfilerTimerIfRunningAndRecordDelta(nextUnitOfWork, true);
       
 19546         }
       
 19547 
       
 19548         {
       
 19549           // Reset global debug state
       
 19550           // We assume this is defined in DEV
       
 19551           resetCurrentlyProcessingQueue();
       
 19552         }
       
 19553 
       
 19554         if (true && replayFailedUnitOfWorkWithInvokeGuardedCallback) {
       
 19555           if (mayReplay) {
       
 19556             var failedUnitOfWork = nextUnitOfWork;
       
 19557             replayUnitOfWork(failedUnitOfWork, thrownValue, isYieldy);
       
 19558           }
       
 19559         }
       
 19560 
       
 19561         // TODO: we already know this isn't true in some cases.
       
 19562         // At least this shows a nicer error message until we figure out the cause.
       
 19563         // https://github.com/facebook/react/issues/12449#issuecomment-386727431
       
 19564         !(nextUnitOfWork !== null) ? invariant(false, 'Failed to replay rendering after an error. This is likely caused by a bug in React. Please file an issue with a reproducing case to help us find it.') : void 0;
       
 19565 
       
 19566         var sourceFiber = nextUnitOfWork;
       
 19567         var returnFiber = sourceFiber.return;
       
 19568         if (returnFiber === null) {
       
 19569           // This is the root. The root could capture its own errors. However,
       
 19570           // we don't know if it errors before or after we pushed the host
       
 19571           // context. This information is needed to avoid a stack mismatch.
       
 19572           // Because we're not sure, treat this as a fatal error. We could track
       
 19573           // which phase it fails in, but doesn't seem worth it. At least
       
 19574           // for now.
       
 19575           didFatal = true;
       
 19576           onUncaughtError(thrownValue);
       
 19577         } else {
       
 19578           throwException(root, returnFiber, sourceFiber, thrownValue, nextRenderExpirationTime);
       
 19579           nextUnitOfWork = completeUnitOfWork(sourceFiber);
       
 19580           continue;
       
 19581         }
       
 19582       }
       
 19583     }
       
 19584     break;
       
 19585   } while (true);
       
 19586 
       
 19587   if (enableSchedulerTracing) {
       
 19588     // Traced work is done for now; restore the previous interactions.
       
 19589     __interactionsRef.current = prevInteractions;
       
 19590   }
       
 19591 
       
 19592   // We're done performing work. Time to clean up.
       
 19593   isWorking = false;
       
 19594   ReactCurrentDispatcher.current = previousDispatcher;
       
 19595   resetContextDependences();
       
 19596   resetHooks();
       
 19597 
       
 19598   // Yield back to main thread.
       
 19599   if (didFatal) {
       
 19600     var _didCompleteRoot = false;
       
 19601     stopWorkLoopTimer(interruptedBy, _didCompleteRoot);
       
 19602     interruptedBy = null;
       
 19603     // There was a fatal error.
       
 19604     {
       
 19605       resetStackAfterFatalErrorInDev();
       
 19606     }
       
 19607     // `nextRoot` points to the in-progress root. A non-null value indicates
       
 19608     // that we're in the middle of an async render. Set it to null to indicate
       
 19609     // there's no more work to be done in the current batch.
       
 19610     nextRoot = null;
       
 19611     onFatal(root);
       
 19612     return;
       
 19613   }
       
 19614 
       
 19615   if (nextUnitOfWork !== null) {
       
 19616     // There's still remaining async work in this tree, but we ran out of time
       
 19617     // in the current frame. Yield back to the renderer. Unless we're
       
 19618     // interrupted by a higher priority update, we'll continue later from where
       
 19619     // we left off.
       
 19620     var _didCompleteRoot2 = false;
       
 19621     stopWorkLoopTimer(interruptedBy, _didCompleteRoot2);
       
 19622     interruptedBy = null;
       
 19623     onYield(root);
       
 19624     return;
       
 19625   }
       
 19626 
       
 19627   // We completed the whole tree.
       
 19628   var didCompleteRoot = true;
       
 19629   stopWorkLoopTimer(interruptedBy, didCompleteRoot);
       
 19630   var rootWorkInProgress = root.current.alternate;
       
 19631   !(rootWorkInProgress !== null) ? invariant(false, 'Finished root should have a work-in-progress. This error is likely caused by a bug in React. Please file an issue.') : void 0;
       
 19632 
       
 19633   // `nextRoot` points to the in-progress root. A non-null value indicates
       
 19634   // that we're in the middle of an async render. Set it to null to indicate
       
 19635   // there's no more work to be done in the current batch.
       
 19636   nextRoot = null;
       
 19637   interruptedBy = null;
       
 19638 
       
 19639   if (nextRenderDidError) {
       
 19640     // There was an error
       
 19641     if (hasLowerPriorityWork(root, expirationTime)) {
       
 19642       // There's lower priority work. If so, it may have the effect of fixing
       
 19643       // the exception that was just thrown. Exit without committing. This is
       
 19644       // similar to a suspend, but without a timeout because we're not waiting
       
 19645       // for a promise to resolve. React will restart at the lower
       
 19646       // priority level.
       
 19647       markSuspendedPriorityLevel(root, expirationTime);
       
 19648       var suspendedExpirationTime = expirationTime;
       
 19649       var rootExpirationTime = root.expirationTime;
       
 19650       onSuspend(root, rootWorkInProgress, suspendedExpirationTime, rootExpirationTime, -1 // Indicates no timeout
       
 19651       );
       
 19652       return;
       
 19653     } else if (
       
 19654     // There's no lower priority work, but we're rendering asynchronously.
       
 19655     // Synchronously attempt to render the same level one more time. This is
       
 19656     // similar to a suspend, but without a timeout because we're not waiting
       
 19657     // for a promise to resolve.
       
 19658     !root.didError && isYieldy) {
       
 19659       root.didError = true;
       
 19660       var _suspendedExpirationTime = root.nextExpirationTimeToWorkOn = expirationTime;
       
 19661       var _rootExpirationTime = root.expirationTime = Sync;
       
 19662       onSuspend(root, rootWorkInProgress, _suspendedExpirationTime, _rootExpirationTime, -1 // Indicates no timeout
       
 19663       );
       
 19664       return;
       
 19665     }
       
 19666   }
       
 19667 
       
 19668   if (isYieldy && nextLatestAbsoluteTimeoutMs !== -1) {
       
 19669     // The tree was suspended.
       
 19670     var _suspendedExpirationTime2 = expirationTime;
       
 19671     markSuspendedPriorityLevel(root, _suspendedExpirationTime2);
       
 19672 
       
 19673     // Find the earliest uncommitted expiration time in the tree, including
       
 19674     // work that is suspended. The timeout threshold cannot be longer than
       
 19675     // the overall expiration.
       
 19676     var earliestExpirationTime = findEarliestOutstandingPriorityLevel(root, expirationTime);
       
 19677     var earliestExpirationTimeMs = expirationTimeToMs(earliestExpirationTime);
       
 19678     if (earliestExpirationTimeMs < nextLatestAbsoluteTimeoutMs) {
       
 19679       nextLatestAbsoluteTimeoutMs = earliestExpirationTimeMs;
       
 19680     }
       
 19681 
       
 19682     // Subtract the current time from the absolute timeout to get the number
       
 19683     // of milliseconds until the timeout. In other words, convert an absolute
       
 19684     // timestamp to a relative time. This is the value that is passed
       
 19685     // to `setTimeout`.
       
 19686     var currentTimeMs = expirationTimeToMs(requestCurrentTime());
       
 19687     var msUntilTimeout = nextLatestAbsoluteTimeoutMs - currentTimeMs;
       
 19688     msUntilTimeout = msUntilTimeout < 0 ? 0 : msUntilTimeout;
       
 19689 
       
 19690     // TODO: Account for the Just Noticeable Difference
       
 19691 
       
 19692     var _rootExpirationTime2 = root.expirationTime;
       
 19693     onSuspend(root, rootWorkInProgress, _suspendedExpirationTime2, _rootExpirationTime2, msUntilTimeout);
       
 19694     return;
       
 19695   }
       
 19696 
       
 19697   // Ready to commit.
       
 19698   onComplete(root, rootWorkInProgress, expirationTime);
       
 19699 }
       
 19700 
       
 19701 function captureCommitPhaseError(sourceFiber, value) {
       
 19702   var expirationTime = Sync;
       
 19703   var fiber = sourceFiber.return;
       
 19704   while (fiber !== null) {
       
 19705     switch (fiber.tag) {
       
 19706       case ClassComponent:
       
 19707         var ctor = fiber.type;
       
 19708         var instance = fiber.stateNode;
       
 19709         if (typeof ctor.getDerivedStateFromError === 'function' || typeof instance.componentDidCatch === 'function' && !isAlreadyFailedLegacyErrorBoundary(instance)) {
       
 19710           var errorInfo = createCapturedValue(value, sourceFiber);
       
 19711           var update = createClassErrorUpdate(fiber, errorInfo, expirationTime);
       
 19712           enqueueUpdate(fiber, update);
       
 19713           scheduleWork(fiber, expirationTime);
       
 19714           return;
       
 19715         }
       
 19716         break;
       
 19717       case HostRoot:
       
 19718         {
       
 19719           var _errorInfo = createCapturedValue(value, sourceFiber);
       
 19720           var _update = createRootErrorUpdate(fiber, _errorInfo, expirationTime);
       
 19721           enqueueUpdate(fiber, _update);
       
 19722           scheduleWork(fiber, expirationTime);
       
 19723           return;
       
 19724         }
       
 19725     }
       
 19726     fiber = fiber.return;
       
 19727   }
       
 19728 
       
 19729   if (sourceFiber.tag === HostRoot) {
       
 19730     // Error was thrown at the root. There is no parent, so the root
       
 19731     // itself should capture it.
       
 19732     var rootFiber = sourceFiber;
       
 19733     var _errorInfo2 = createCapturedValue(value, rootFiber);
       
 19734     var _update2 = createRootErrorUpdate(rootFiber, _errorInfo2, expirationTime);
       
 19735     enqueueUpdate(rootFiber, _update2);
       
 19736     scheduleWork(rootFiber, expirationTime);
       
 19737   }
       
 19738 }
       
 19739 
       
 19740 function computeThreadID(expirationTime, interactionThreadID) {
       
 19741   // Interaction threads are unique per root and expiration time.
       
 19742   return expirationTime * 1000 + interactionThreadID;
       
 19743 }
       
 19744 
       
 19745 // Creates a unique async expiration time.
       
 19746 function computeUniqueAsyncExpiration() {
       
 19747   var currentTime = requestCurrentTime();
       
 19748   var result = computeAsyncExpiration(currentTime);
       
 19749   if (result >= lastUniqueAsyncExpiration) {
       
 19750     // Since we assume the current time monotonically increases, we only hit
       
 19751     // this branch when computeUniqueAsyncExpiration is fired multiple times
       
 19752     // within a 200ms window (or whatever the async bucket size is).
       
 19753     result = lastUniqueAsyncExpiration - 1;
       
 19754   }
       
 19755   lastUniqueAsyncExpiration = result;
       
 19756   return lastUniqueAsyncExpiration;
       
 19757 }
       
 19758 
       
 19759 function computeExpirationForFiber(currentTime, fiber) {
       
 19760   var priorityLevel = unstable_getCurrentPriorityLevel();
       
 19761 
       
 19762   var expirationTime = void 0;
       
 19763   if ((fiber.mode & ConcurrentMode) === NoContext) {
       
 19764     // Outside of concurrent mode, updates are always synchronous.
       
 19765     expirationTime = Sync;
       
 19766   } else if (isWorking && !isCommitting$1) {
       
 19767     // During render phase, updates expire during as the current render.
       
 19768     expirationTime = nextRenderExpirationTime;
       
 19769   } else {
       
 19770     switch (priorityLevel) {
       
 19771       case unstable_ImmediatePriority:
       
 19772         expirationTime = Sync;
       
 19773         break;
       
 19774       case unstable_UserBlockingPriority:
       
 19775         expirationTime = computeInteractiveExpiration(currentTime);
       
 19776         break;
       
 19777       case unstable_NormalPriority:
       
 19778         // This is a normal, concurrent update
       
 19779         expirationTime = computeAsyncExpiration(currentTime);
       
 19780         break;
       
 19781       case unstable_LowPriority:
       
 19782       case unstable_IdlePriority:
       
 19783         expirationTime = Never;
       
 19784         break;
       
 19785       default:
       
 19786         invariant(false, 'Unknown priority level. This error is likely caused by a bug in React. Please file an issue.');
       
 19787     }
       
 19788 
       
 19789     // If we're in the middle of rendering a tree, do not update at the same
       
 19790     // expiration time that is already rendering.
       
 19791     if (nextRoot !== null && expirationTime === nextRenderExpirationTime) {
       
 19792       expirationTime -= 1;
       
 19793     }
       
 19794   }
       
 19795 
       
 19796   // Keep track of the lowest pending interactive expiration time. This
       
 19797   // allows us to synchronously flush all interactive updates
       
 19798   // when needed.
       
 19799   // TODO: Move this to renderer?
       
 19800   if (priorityLevel === unstable_UserBlockingPriority && (lowestPriorityPendingInteractiveExpirationTime === NoWork || expirationTime < lowestPriorityPendingInteractiveExpirationTime)) {
       
 19801     lowestPriorityPendingInteractiveExpirationTime = expirationTime;
       
 19802   }
       
 19803 
       
 19804   return expirationTime;
       
 19805 }
       
 19806 
       
 19807 function renderDidSuspend(root, absoluteTimeoutMs, suspendedTime) {
       
 19808   // Schedule the timeout.
       
 19809   if (absoluteTimeoutMs >= 0 && nextLatestAbsoluteTimeoutMs < absoluteTimeoutMs) {
       
 19810     nextLatestAbsoluteTimeoutMs = absoluteTimeoutMs;
       
 19811   }
       
 19812 }
       
 19813 
       
 19814 function renderDidError() {
       
 19815   nextRenderDidError = true;
       
 19816 }
       
 19817 
       
 19818 function pingSuspendedRoot(root, thenable, pingTime) {
       
 19819   // A promise that previously suspended React from committing has resolved.
       
 19820   // If React is still suspended, try again at the previous level (pingTime).
       
 19821 
       
 19822   var pingCache = root.pingCache;
       
 19823   if (pingCache !== null) {
       
 19824     // The thenable resolved, so we no longer need to memoize, because it will
       
 19825     // never be thrown again.
       
 19826     pingCache.delete(thenable);
       
 19827   }
       
 19828 
       
 19829   if (nextRoot !== null && nextRenderExpirationTime === pingTime) {
       
 19830     // Received a ping at the same priority level at which we're currently
       
 19831     // rendering. Restart from the root.
       
 19832     nextRoot = null;
       
 19833   } else {
       
 19834     // Confirm that the root is still suspended at this level. Otherwise exit.
       
 19835     if (isPriorityLevelSuspended(root, pingTime)) {
       
 19836       // Ping at the original level
       
 19837       markPingedPriorityLevel(root, pingTime);
       
 19838       var rootExpirationTime = root.expirationTime;
       
 19839       if (rootExpirationTime !== NoWork) {
       
 19840         requestWork(root, rootExpirationTime);
       
 19841       }
       
 19842     }
       
 19843   }
       
 19844 }
       
 19845 
       
 19846 function retryTimedOutBoundary(boundaryFiber, thenable) {
       
 19847   // The boundary fiber (a Suspense component) previously timed out and was
       
 19848   // rendered in its fallback state. One of the promises that suspended it has
       
 19849   // resolved, which means at least part of the tree was likely unblocked. Try
       
 19850   var retryCache = void 0;
       
 19851   if (enableSuspenseServerRenderer) {
       
 19852     switch (boundaryFiber.tag) {
       
 19853       case SuspenseComponent:
       
 19854         retryCache = boundaryFiber.stateNode;
       
 19855         break;
       
 19856       case DehydratedSuspenseComponent:
       
 19857         retryCache = boundaryFiber.memoizedState;
       
 19858         break;
       
 19859       default:
       
 19860         invariant(false, 'Pinged unknown suspense boundary type. This is probably a bug in React.');
       
 19861     }
       
 19862   } else {
       
 19863     retryCache = boundaryFiber.stateNode;
       
 19864   }
       
 19865   if (retryCache !== null) {
       
 19866     // The thenable resolved, so we no longer need to memoize, because it will
       
 19867     // never be thrown again.
       
 19868     retryCache.delete(thenable);
       
 19869   }
       
 19870 
       
 19871   var currentTime = requestCurrentTime();
       
 19872   var retryTime = computeExpirationForFiber(currentTime, boundaryFiber);
       
 19873   var root = scheduleWorkToRoot(boundaryFiber, retryTime);
       
 19874   if (root !== null) {
       
 19875     markPendingPriorityLevel(root, retryTime);
       
 19876     var rootExpirationTime = root.expirationTime;
       
 19877     if (rootExpirationTime !== NoWork) {
       
 19878       requestWork(root, rootExpirationTime);
       
 19879     }
       
 19880   }
       
 19881 }
       
 19882 
       
 19883 function scheduleWorkToRoot(fiber, expirationTime) {
       
 19884   recordScheduleUpdate();
       
 19885 
       
 19886   {
       
 19887     if (fiber.tag === ClassComponent) {
       
 19888       var instance = fiber.stateNode;
       
 19889       warnAboutInvalidUpdates(instance);
       
 19890     }
       
 19891   }
       
 19892 
       
 19893   // Update the source fiber's expiration time
       
 19894   if (fiber.expirationTime < expirationTime) {
       
 19895     fiber.expirationTime = expirationTime;
       
 19896   }
       
 19897   var alternate = fiber.alternate;
       
 19898   if (alternate !== null && alternate.expirationTime < expirationTime) {
       
 19899     alternate.expirationTime = expirationTime;
       
 19900   }
       
 19901   // Walk the parent path to the root and update the child expiration time.
       
 19902   var node = fiber.return;
       
 19903   var root = null;
       
 19904   if (node === null && fiber.tag === HostRoot) {
       
 19905     root = fiber.stateNode;
       
 19906   } else {
       
 19907     while (node !== null) {
       
 19908       alternate = node.alternate;
       
 19909       if (node.childExpirationTime < expirationTime) {
       
 19910         node.childExpirationTime = expirationTime;
       
 19911         if (alternate !== null && alternate.childExpirationTime < expirationTime) {
       
 19912           alternate.childExpirationTime = expirationTime;
       
 19913         }
       
 19914       } else if (alternate !== null && alternate.childExpirationTime < expirationTime) {
       
 19915         alternate.childExpirationTime = expirationTime;
       
 19916       }
       
 19917       if (node.return === null && node.tag === HostRoot) {
       
 19918         root = node.stateNode;
       
 19919         break;
       
 19920       }
       
 19921       node = node.return;
       
 19922     }
       
 19923   }
       
 19924 
       
 19925   if (enableSchedulerTracing) {
       
 19926     if (root !== null) {
       
 19927       var interactions = __interactionsRef.current;
       
 19928       if (interactions.size > 0) {
       
 19929         var pendingInteractionMap = root.pendingInteractionMap;
       
 19930         var pendingInteractions = pendingInteractionMap.get(expirationTime);
       
 19931         if (pendingInteractions != null) {
       
 19932           interactions.forEach(function (interaction) {
       
 19933             if (!pendingInteractions.has(interaction)) {
       
 19934               // Update the pending async work count for previously unscheduled interaction.
       
 19935               interaction.__count++;
       
 19936             }
       
 19937 
       
 19938             pendingInteractions.add(interaction);
       
 19939           });
       
 19940         } else {
       
 19941           pendingInteractionMap.set(expirationTime, new Set(interactions));
       
 19942 
       
 19943           // Update the pending async work count for the current interactions.
       
 19944           interactions.forEach(function (interaction) {
       
 19945             interaction.__count++;
       
 19946           });
       
 19947         }
       
 19948 
       
 19949         var subscriber = __subscriberRef.current;
       
 19950         if (subscriber !== null) {
       
 19951           var threadID = computeThreadID(expirationTime, root.interactionThreadID);
       
 19952           subscriber.onWorkScheduled(interactions, threadID);
       
 19953         }
       
 19954       }
       
 19955     }
       
 19956   }
       
 19957   return root;
       
 19958 }
       
 19959 
       
 19960 function warnIfNotCurrentlyBatchingInDev(fiber) {
       
 19961   {
       
 19962     if (isRendering === false && isBatchingUpdates === false) {
       
 19963       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));
       
 19964     }
       
 19965   }
       
 19966 }
       
 19967 
       
 19968 function scheduleWork(fiber, expirationTime) {
       
 19969   var root = scheduleWorkToRoot(fiber, expirationTime);
       
 19970   if (root === null) {
       
 19971     {
       
 19972       switch (fiber.tag) {
       
 19973         case ClassComponent:
       
 19974           warnAboutUpdateOnUnmounted(fiber, true);
       
 19975           break;
       
 19976         case FunctionComponent:
       
 19977         case ForwardRef:
       
 19978         case MemoComponent:
       
 19979         case SimpleMemoComponent:
       
 19980           warnAboutUpdateOnUnmounted(fiber, false);
       
 19981           break;
       
 19982       }
       
 19983     }
       
 19984     return;
       
 19985   }
       
 19986 
       
 19987   if (!isWorking && nextRenderExpirationTime !== NoWork && expirationTime > nextRenderExpirationTime) {
       
 19988     // This is an interruption. (Used for performance tracking.)
       
 19989     interruptedBy = fiber;
       
 19990     resetStack();
       
 19991   }
       
 19992   markPendingPriorityLevel(root, expirationTime);
       
 19993   if (
       
 19994   // If we're in the render phase, we don't need to schedule this root
       
 19995   // for an update, because we'll do it before we exit...
       
 19996   !isWorking || isCommitting$1 ||
       
 19997   // ...unless this is a different root than the one we're rendering.
       
 19998   nextRoot !== root) {
       
 19999     var rootExpirationTime = root.expirationTime;
       
 20000     requestWork(root, rootExpirationTime);
       
 20001   }
       
 20002   if (nestedUpdateCount > NESTED_UPDATE_LIMIT) {
       
 20003     // Reset this back to zero so subsequent updates don't throw.
       
 20004     nestedUpdateCount = 0;
       
 20005     invariant(false, '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.');
       
 20006   }
       
 20007 }
       
 20008 
       
 20009 function syncUpdates(fn, a, b, c, d) {
       
 20010   return unstable_runWithPriority(unstable_ImmediatePriority, function () {
       
 20011     return fn(a, b, c, d);
       
 20012   });
       
 20013 }
       
 20014 
       
 20015 // TODO: Everything below this is written as if it has been lifted to the
       
 20016 // renderers. I'll do this in a follow-up.
       
 20017 
       
 20018 // Linked-list of roots
       
 20019 var firstScheduledRoot = null;
       
 20020 var lastScheduledRoot = null;
       
 20021 
       
 20022 var callbackExpirationTime = NoWork;
       
 20023 var callbackID = void 0;
       
 20024 var isRendering = false;
       
 20025 var nextFlushedRoot = null;
       
 20026 var nextFlushedExpirationTime = NoWork;
       
 20027 var lowestPriorityPendingInteractiveExpirationTime = NoWork;
       
 20028 var hasUnhandledError = false;
       
 20029 var unhandledError = null;
       
 20030 
       
 20031 var isBatchingUpdates = false;
       
 20032 var isUnbatchingUpdates = false;
       
 20033 
       
 20034 var completedBatches = null;
       
 20035 
       
 20036 var originalStartTimeMs = unstable_now();
       
 20037 var currentRendererTime = msToExpirationTime(originalStartTimeMs);
       
 20038 var currentSchedulerTime = currentRendererTime;
       
 20039 
       
 20040 // Use these to prevent an infinite loop of nested updates
       
 20041 var NESTED_UPDATE_LIMIT = 50;
       
 20042 var nestedUpdateCount = 0;
       
 20043 var lastCommittedRootDuringThisBatch = null;
       
 20044 
       
 20045 function recomputeCurrentRendererTime() {
       
 20046   var currentTimeMs = unstable_now() - originalStartTimeMs;
       
 20047   currentRendererTime = msToExpirationTime(currentTimeMs);
       
 20048 }
       
 20049 
       
 20050 function scheduleCallbackWithExpirationTime(root, expirationTime) {
       
 20051   if (callbackExpirationTime !== NoWork) {
       
 20052     // A callback is already scheduled. Check its expiration time (timeout).
       
 20053     if (expirationTime < callbackExpirationTime) {
       
 20054       // Existing callback has sufficient timeout. Exit.
       
 20055       return;
       
 20056     } else {
       
 20057       if (callbackID !== null) {
       
 20058         // Existing callback has insufficient timeout. Cancel and schedule a
       
 20059         // new one.
       
 20060         unstable_cancelCallback(callbackID);
       
 20061       }
       
 20062     }
       
 20063     // The request callback timer is already running. Don't start a new one.
       
 20064   } else {
       
 20065     startRequestCallbackTimer();
       
 20066   }
       
 20067 
       
 20068   callbackExpirationTime = expirationTime;
       
 20069   var currentMs = unstable_now() - originalStartTimeMs;
       
 20070   var expirationTimeMs = expirationTimeToMs(expirationTime);
       
 20071   var timeout = expirationTimeMs - currentMs;
       
 20072   callbackID = unstable_scheduleCallback(performAsyncWork, { timeout: timeout });
       
 20073 }
       
 20074 
       
 20075 // For every call to renderRoot, one of onFatal, onComplete, onSuspend, and
       
 20076 // onYield is called upon exiting. We use these in lieu of returning a tuple.
       
 20077 // I've also chosen not to inline them into renderRoot because these will
       
 20078 // eventually be lifted into the renderer.
       
 20079 function onFatal(root) {
       
 20080   root.finishedWork = null;
       
 20081 }
       
 20082 
       
 20083 function onComplete(root, finishedWork, expirationTime) {
       
 20084   root.pendingCommitExpirationTime = expirationTime;
       
 20085   root.finishedWork = finishedWork;
       
 20086 }
       
 20087 
       
 20088 function onSuspend(root, finishedWork, suspendedExpirationTime, rootExpirationTime, msUntilTimeout) {
       
 20089   root.expirationTime = rootExpirationTime;
       
 20090   if (msUntilTimeout === 0 && !shouldYieldToRenderer()) {
       
 20091     // Don't wait an additional tick. Commit the tree immediately.
       
 20092     root.pendingCommitExpirationTime = suspendedExpirationTime;
       
 20093     root.finishedWork = finishedWork;
       
 20094   } else if (msUntilTimeout > 0) {
       
 20095     // Wait `msUntilTimeout` milliseconds before committing.
       
 20096     root.timeoutHandle = scheduleTimeout(onTimeout.bind(null, root, finishedWork, suspendedExpirationTime), msUntilTimeout);
       
 20097   }
       
 20098 }
       
 20099 
       
 20100 function onYield(root) {
       
 20101   root.finishedWork = null;
       
 20102 }
       
 20103 
       
 20104 function onTimeout(root, finishedWork, suspendedExpirationTime) {
       
 20105   // The root timed out. Commit it.
       
 20106   root.pendingCommitExpirationTime = suspendedExpirationTime;
       
 20107   root.finishedWork = finishedWork;
       
 20108   // Read the current time before entering the commit phase. We can be
       
 20109   // certain this won't cause tearing related to batching of event updates
       
 20110   // because we're at the top of a timer event.
       
 20111   recomputeCurrentRendererTime();
       
 20112   currentSchedulerTime = currentRendererTime;
       
 20113   flushRoot(root, suspendedExpirationTime);
       
 20114 }
       
 20115 
       
 20116 function onCommit(root, expirationTime) {
       
 20117   root.expirationTime = expirationTime;
       
 20118   root.finishedWork = null;
       
 20119 }
       
 20120 
       
 20121 function requestCurrentTime() {
       
 20122   // requestCurrentTime is called by the scheduler to compute an expiration
       
 20123   // time.
       
 20124   //
       
 20125   // Expiration times are computed by adding to the current time (the start
       
 20126   // time). However, if two updates are scheduled within the same event, we
       
 20127   // should treat their start times as simultaneous, even if the actual clock
       
 20128   // time has advanced between the first and second call.
       
 20129 
       
 20130   // In other words, because expiration times determine how updates are batched,
       
 20131   // we want all updates of like priority that occur within the same event to
       
 20132   // receive the same expiration time. Otherwise we get tearing.
       
 20133   //
       
 20134   // We keep track of two separate times: the current "renderer" time and the
       
 20135   // current "scheduler" time. The renderer time can be updated whenever; it
       
 20136   // only exists to minimize the calls performance.now.
       
 20137   //
       
 20138   // But the scheduler time can only be updated if there's no pending work, or
       
 20139   // if we know for certain that we're not in the middle of an event.
       
 20140 
       
 20141   if (isRendering) {
       
 20142     // We're already rendering. Return the most recently read time.
       
 20143     return currentSchedulerTime;
       
 20144   }
       
 20145   // Check if there's pending work.
       
 20146   findHighestPriorityRoot();
       
 20147   if (nextFlushedExpirationTime === NoWork || nextFlushedExpirationTime === Never) {
       
 20148     // If there's no pending work, or if the pending work is offscreen, we can
       
 20149     // read the current time without risk of tearing.
       
 20150     recomputeCurrentRendererTime();
       
 20151     currentSchedulerTime = currentRendererTime;
       
 20152     return currentSchedulerTime;
       
 20153   }
       
 20154   // There's already pending work. We might be in the middle of a browser
       
 20155   // event. If we were to read the current time, it could cause multiple updates
       
 20156   // within the same event to receive different expiration times, leading to
       
 20157   // tearing. Return the last read time. During the next idle callback, the
       
 20158   // time will be updated.
       
 20159   return currentSchedulerTime;
       
 20160 }
       
 20161 
       
 20162 // requestWork is called by the scheduler whenever a root receives an update.
       
 20163 // It's up to the renderer to call renderRoot at some point in the future.
       
 20164 function requestWork(root, expirationTime) {
       
 20165   addRootToSchedule(root, expirationTime);
       
 20166   if (isRendering) {
       
 20167     // Prevent reentrancy. Remaining work will be scheduled at the end of
       
 20168     // the currently rendering batch.
       
 20169     return;
       
 20170   }
       
 20171 
       
 20172   if (isBatchingUpdates) {
       
 20173     // Flush work at the end of the batch.
       
 20174     if (isUnbatchingUpdates) {
       
 20175       // ...unless we're inside unbatchedUpdates, in which case we should
       
 20176       // flush it now.
       
 20177       nextFlushedRoot = root;
       
 20178       nextFlushedExpirationTime = Sync;
       
 20179       performWorkOnRoot(root, Sync, false);
       
 20180     }
       
 20181     return;
       
 20182   }
       
 20183 
       
 20184   // TODO: Get rid of Sync and use current time?
       
 20185   if (expirationTime === Sync) {
       
 20186     performSyncWork();
       
 20187   } else {
       
 20188     scheduleCallbackWithExpirationTime(root, expirationTime);
       
 20189   }
       
 20190 }
       
 20191 
       
 20192 function addRootToSchedule(root, expirationTime) {
       
 20193   // Add the root to the schedule.
       
 20194   // Check if this root is already part of the schedule.
       
 20195   if (root.nextScheduledRoot === null) {
       
 20196     // This root is not already scheduled. Add it.
       
 20197     root.expirationTime = expirationTime;
       
 20198     if (lastScheduledRoot === null) {
       
 20199       firstScheduledRoot = lastScheduledRoot = root;
       
 20200       root.nextScheduledRoot = root;
       
 20201     } else {
       
 20202       lastScheduledRoot.nextScheduledRoot = root;
       
 20203       lastScheduledRoot = root;
       
 20204       lastScheduledRoot.nextScheduledRoot = firstScheduledRoot;
       
 20205     }
       
 20206   } else {
       
 20207     // This root is already scheduled, but its priority may have increased.
       
 20208     var remainingExpirationTime = root.expirationTime;
       
 20209     if (expirationTime > remainingExpirationTime) {
       
 20210       // Update the priority.
       
 20211       root.expirationTime = expirationTime;
       
 20212     }
       
 20213   }
       
 20214 }
       
 20215 
       
 20216 function findHighestPriorityRoot() {
       
 20217   var highestPriorityWork = NoWork;
       
 20218   var highestPriorityRoot = null;
       
 20219   if (lastScheduledRoot !== null) {
       
 20220     var previousScheduledRoot = lastScheduledRoot;
       
 20221     var root = firstScheduledRoot;
       
 20222     while (root !== null) {
       
 20223       var remainingExpirationTime = root.expirationTime;
       
 20224       if (remainingExpirationTime === NoWork) {
       
 20225         // This root no longer has work. Remove it from the scheduler.
       
 20226 
       
 20227         // TODO: This check is redudant, but Flow is confused by the branch
       
 20228         // below where we set lastScheduledRoot to null, even though we break
       
 20229         // from the loop right after.
       
 20230         !(previousScheduledRoot !== null && lastScheduledRoot !== null) ? invariant(false, 'Should have a previous and last root. This error is likely caused by a bug in React. Please file an issue.') : void 0;
       
 20231         if (root === root.nextScheduledRoot) {
       
 20232           // This is the only root in the list.
       
 20233           root.nextScheduledRoot = null;
       
 20234           firstScheduledRoot = lastScheduledRoot = null;
       
 20235           break;
       
 20236         } else if (root === firstScheduledRoot) {
       
 20237           // This is the first root in the list.
       
 20238           var next = root.nextScheduledRoot;
       
 20239           firstScheduledRoot = next;
       
 20240           lastScheduledRoot.nextScheduledRoot = next;
       
 20241           root.nextScheduledRoot = null;
       
 20242         } else if (root === lastScheduledRoot) {
       
 20243           // This is the last root in the list.
       
 20244           lastScheduledRoot = previousScheduledRoot;
       
 20245           lastScheduledRoot.nextScheduledRoot = firstScheduledRoot;
       
 20246           root.nextScheduledRoot = null;
       
 20247           break;
       
 20248         } else {
       
 20249           previousScheduledRoot.nextScheduledRoot = root.nextScheduledRoot;
       
 20250           root.nextScheduledRoot = null;
       
 20251         }
       
 20252         root = previousScheduledRoot.nextScheduledRoot;
       
 20253       } else {
       
 20254         if (remainingExpirationTime > highestPriorityWork) {
       
 20255           // Update the priority, if it's higher
       
 20256           highestPriorityWork = remainingExpirationTime;
       
 20257           highestPriorityRoot = root;
       
 20258         }
       
 20259         if (root === lastScheduledRoot) {
       
 20260           break;
       
 20261         }
       
 20262         if (highestPriorityWork === Sync) {
       
 20263           // Sync is highest priority by definition so
       
 20264           // we can stop searching.
       
 20265           break;
       
 20266         }
       
 20267         previousScheduledRoot = root;
       
 20268         root = root.nextScheduledRoot;
       
 20269       }
       
 20270     }
       
 20271   }
       
 20272 
       
 20273   nextFlushedRoot = highestPriorityRoot;
       
 20274   nextFlushedExpirationTime = highestPriorityWork;
       
 20275 }
       
 20276 
       
 20277 // TODO: This wrapper exists because many of the older tests (the ones that use
       
 20278 // flushDeferredPri) rely on the number of times `shouldYield` is called. We
       
 20279 // should get rid of it.
       
 20280 var didYield = false;
       
 20281 function shouldYieldToRenderer() {
       
 20282   if (didYield) {
       
 20283     return true;
       
 20284   }
       
 20285   if (unstable_shouldYield()) {
       
 20286     didYield = true;
       
 20287     return true;
       
 20288   }
       
 20289   return false;
       
 20290 }
       
 20291 
       
 20292 function performAsyncWork() {
       
 20293   try {
       
 20294     if (!shouldYieldToRenderer()) {
       
 20295       // The callback timed out. That means at least one update has expired.
       
 20296       // Iterate through the root schedule. If they contain expired work, set
       
 20297       // the next render expiration time to the current time. This has the effect
       
 20298       // of flushing all expired work in a single batch, instead of flushing each
       
 20299       // level one at a time.
       
 20300       if (firstScheduledRoot !== null) {
       
 20301         recomputeCurrentRendererTime();
       
 20302         var root = firstScheduledRoot;
       
 20303         do {
       
 20304           didExpireAtExpirationTime(root, currentRendererTime);
       
 20305           // The root schedule is circular, so this is never null.
       
 20306           root = root.nextScheduledRoot;
       
 20307         } while (root !== firstScheduledRoot);
       
 20308       }
       
 20309     }
       
 20310     performWork(NoWork, true);
       
 20311   } finally {
       
 20312     didYield = false;
       
 20313   }
       
 20314 }
       
 20315 
       
 20316 function performSyncWork() {
       
 20317   performWork(Sync, false);
       
 20318 }
       
 20319 
       
 20320 function performWork(minExpirationTime, isYieldy) {
       
 20321   // Keep working on roots until there's no more work, or until there's a higher
       
 20322   // priority event.
       
 20323   findHighestPriorityRoot();
       
 20324 
       
 20325   if (isYieldy) {
       
 20326     recomputeCurrentRendererTime();
       
 20327     currentSchedulerTime = currentRendererTime;
       
 20328 
       
 20329     if (enableUserTimingAPI) {
       
 20330       var didExpire = nextFlushedExpirationTime > currentRendererTime;
       
 20331       var timeout = expirationTimeToMs(nextFlushedExpirationTime);
       
 20332       stopRequestCallbackTimer(didExpire, timeout);
       
 20333     }
       
 20334 
       
 20335     while (nextFlushedRoot !== null && nextFlushedExpirationTime !== NoWork && minExpirationTime <= nextFlushedExpirationTime && !(didYield && currentRendererTime > nextFlushedExpirationTime)) {
       
 20336       performWorkOnRoot(nextFlushedRoot, nextFlushedExpirationTime, currentRendererTime > nextFlushedExpirationTime);
       
 20337       findHighestPriorityRoot();
       
 20338       recomputeCurrentRendererTime();
       
 20339       currentSchedulerTime = currentRendererTime;
       
 20340     }
       
 20341   } else {
       
 20342     while (nextFlushedRoot !== null && nextFlushedExpirationTime !== NoWork && minExpirationTime <= nextFlushedExpirationTime) {
       
 20343       performWorkOnRoot(nextFlushedRoot, nextFlushedExpirationTime, false);
       
 20344       findHighestPriorityRoot();
       
 20345     }
       
 20346   }
       
 20347 
       
 20348   // We're done flushing work. Either we ran out of time in this callback,
       
 20349   // or there's no more work left with sufficient priority.
       
 20350 
       
 20351   // If we're inside a callback, set this to false since we just completed it.
       
 20352   if (isYieldy) {
       
 20353     callbackExpirationTime = NoWork;
       
 20354     callbackID = null;
       
 20355   }
       
 20356   // If there's work left over, schedule a new callback.
       
 20357   if (nextFlushedExpirationTime !== NoWork) {
       
 20358     scheduleCallbackWithExpirationTime(nextFlushedRoot, nextFlushedExpirationTime);
       
 20359   }
       
 20360 
       
 20361   // Clean-up.
       
 20362   finishRendering();
       
 20363 }
       
 20364 
       
 20365 function flushRoot(root, expirationTime) {
       
 20366   !!isRendering ? invariant(false, 'work.commit(): Cannot commit while already rendering. This likely means you attempted to commit from inside a lifecycle method.') : void 0;
       
 20367   // Perform work on root as if the given expiration time is the current time.
       
 20368   // This has the effect of synchronously flushing all work up to and
       
 20369   // including the given time.
       
 20370   nextFlushedRoot = root;
       
 20371   nextFlushedExpirationTime = expirationTime;
       
 20372   performWorkOnRoot(root, expirationTime, false);
       
 20373   // Flush any sync work that was scheduled by lifecycles
       
 20374   performSyncWork();
       
 20375 }
       
 20376 
       
 20377 function finishRendering() {
       
 20378   nestedUpdateCount = 0;
       
 20379   lastCommittedRootDuringThisBatch = null;
       
 20380 
       
 20381   if (completedBatches !== null) {
       
 20382     var batches = completedBatches;
       
 20383     completedBatches = null;
       
 20384     for (var i = 0; i < batches.length; i++) {
       
 20385       var batch = batches[i];
       
 20386       try {
       
 20387         batch._onComplete();
       
 20388       } catch (error) {
       
 20389         if (!hasUnhandledError) {
       
 20390           hasUnhandledError = true;
       
 20391           unhandledError = error;
       
 20392         }
       
 20393       }
       
 20394     }
       
 20395   }
       
 20396 
       
 20397   if (hasUnhandledError) {
       
 20398     var error = unhandledError;
       
 20399     unhandledError = null;
       
 20400     hasUnhandledError = false;
       
 20401     throw error;
       
 20402   }
       
 20403 }
       
 20404 
       
 20405 function performWorkOnRoot(root, expirationTime, isYieldy) {
       
 20406   !!isRendering ? invariant(false, 'performWorkOnRoot was called recursively. This error is likely caused by a bug in React. Please file an issue.') : void 0;
       
 20407 
       
 20408   isRendering = true;
       
 20409 
       
 20410   // Check if this is async work or sync/expired work.
       
 20411   if (!isYieldy) {
       
 20412     // Flush work without yielding.
       
 20413     // TODO: Non-yieldy work does not necessarily imply expired work. A renderer
       
 20414     // may want to perform some work without yielding, but also without
       
 20415     // requiring the root to complete (by triggering placeholders).
       
 20416 
       
 20417     var finishedWork = root.finishedWork;
       
 20418     if (finishedWork !== null) {
       
 20419       // This root is already complete. We can commit it.
       
 20420       completeRoot(root, finishedWork, expirationTime);
       
 20421     } else {
       
 20422       root.finishedWork = null;
       
 20423       // If this root previously suspended, clear its existing timeout, since
       
 20424       // we're about to try rendering again.
       
 20425       var timeoutHandle = root.timeoutHandle;
       
 20426       if (timeoutHandle !== noTimeout) {
       
 20427         root.timeoutHandle = noTimeout;
       
 20428         // $FlowFixMe Complains noTimeout is not a TimeoutID, despite the check above
       
 20429         cancelTimeout(timeoutHandle);
       
 20430       }
       
 20431       renderRoot(root, isYieldy);
       
 20432       finishedWork = root.finishedWork;
       
 20433       if (finishedWork !== null) {
       
 20434         // We've completed the root. Commit it.
       
 20435         completeRoot(root, finishedWork, expirationTime);
       
 20436       }
       
 20437     }
       
 20438   } else {
       
 20439     // Flush async work.
       
 20440     var _finishedWork = root.finishedWork;
       
 20441     if (_finishedWork !== null) {
       
 20442       // This root is already complete. We can commit it.
       
 20443       completeRoot(root, _finishedWork, expirationTime);
       
 20444     } else {
       
 20445       root.finishedWork = null;
       
 20446       // If this root previously suspended, clear its existing timeout, since
       
 20447       // we're about to try rendering again.
       
 20448       var _timeoutHandle = root.timeoutHandle;
       
 20449       if (_timeoutHandle !== noTimeout) {
       
 20450         root.timeoutHandle = noTimeout;
       
 20451         // $FlowFixMe Complains noTimeout is not a TimeoutID, despite the check above
       
 20452         cancelTimeout(_timeoutHandle);
       
 20453       }
       
 20454       renderRoot(root, isYieldy);
       
 20455       _finishedWork = root.finishedWork;
       
 20456       if (_finishedWork !== null) {
       
 20457         // We've completed the root. Check the if we should yield one more time
       
 20458         // before committing.
       
 20459         if (!shouldYieldToRenderer()) {
       
 20460           // Still time left. Commit the root.
       
 20461           completeRoot(root, _finishedWork, expirationTime);
       
 20462         } else {
       
 20463           // There's no time left. Mark this root as complete. We'll come
       
 20464           // back and commit it later.
       
 20465           root.finishedWork = _finishedWork;
       
 20466         }
       
 20467       }
       
 20468     }
       
 20469   }
       
 20470 
       
 20471   isRendering = false;
       
 20472 }
       
 20473 
       
 20474 function completeRoot(root, finishedWork, expirationTime) {
       
 20475   // Check if there's a batch that matches this expiration time.
       
 20476   var firstBatch = root.firstBatch;
       
 20477   if (firstBatch !== null && firstBatch._expirationTime >= expirationTime) {
       
 20478     if (completedBatches === null) {
       
 20479       completedBatches = [firstBatch];
       
 20480     } else {
       
 20481       completedBatches.push(firstBatch);
       
 20482     }
       
 20483     if (firstBatch._defer) {
       
 20484       // This root is blocked from committing by a batch. Unschedule it until
       
 20485       // we receive another update.
       
 20486       root.finishedWork = finishedWork;
       
 20487       root.expirationTime = NoWork;
       
 20488       return;
       
 20489     }
       
 20490   }
       
 20491 
       
 20492   // Commit the root.
       
 20493   root.finishedWork = null;
       
 20494 
       
 20495   // Check if this is a nested update (a sync update scheduled during the
       
 20496   // commit phase).
       
 20497   if (root === lastCommittedRootDuringThisBatch) {
       
 20498     // If the next root is the same as the previous root, this is a nested
       
 20499     // update. To prevent an infinite loop, increment the nested update count.
       
 20500     nestedUpdateCount++;
       
 20501   } else {
       
 20502     // Reset whenever we switch roots.
       
 20503     lastCommittedRootDuringThisBatch = root;
       
 20504     nestedUpdateCount = 0;
       
 20505   }
       
 20506   unstable_runWithPriority(unstable_ImmediatePriority, function () {
       
 20507     commitRoot(root, finishedWork);
       
 20508   });
       
 20509 }
       
 20510 
       
 20511 function onUncaughtError(error) {
       
 20512   !(nextFlushedRoot !== null) ? invariant(false, 'Should be working on a root. This error is likely caused by a bug in React. Please file an issue.') : void 0;
       
 20513   // Unschedule this root so we don't work on it again until there's
       
 20514   // another update.
       
 20515   nextFlushedRoot.expirationTime = NoWork;
       
 20516   if (!hasUnhandledError) {
       
 20517     hasUnhandledError = true;
       
 20518     unhandledError = error;
       
 20519   }
       
 20520 }
       
 20521 
       
 20522 // TODO: Batching should be implemented at the renderer level, not inside
       
 20523 // the reconciler.
       
 20524 function batchedUpdates$1(fn, a) {
       
 20525   var previousIsBatchingUpdates = isBatchingUpdates;
       
 20526   isBatchingUpdates = true;
       
 20527   try {
       
 20528     return fn(a);
       
 20529   } finally {
       
 20530     isBatchingUpdates = previousIsBatchingUpdates;
       
 20531     if (!isBatchingUpdates && !isRendering) {
       
 20532       performSyncWork();
       
 20533     }
       
 20534   }
       
 20535 }
       
 20536 
       
 20537 // TODO: Batching should be implemented at the renderer level, not inside
       
 20538 // the reconciler.
       
 20539 function unbatchedUpdates(fn, a) {
       
 20540   if (isBatchingUpdates && !isUnbatchingUpdates) {
       
 20541     isUnbatchingUpdates = true;
       
 20542     try {
       
 20543       return fn(a);
       
 20544     } finally {
       
 20545       isUnbatchingUpdates = false;
       
 20546     }
       
 20547   }
       
 20548   return fn(a);
       
 20549 }
       
 20550 
       
 20551 // TODO: Batching should be implemented at the renderer level, not within
       
 20552 // the reconciler.
       
 20553 function flushSync(fn, a) {
       
 20554   !!isRendering ? invariant(false, 'flushSync was called from inside a lifecycle method. It cannot be called when React is already rendering.') : void 0;
       
 20555   var previousIsBatchingUpdates = isBatchingUpdates;
       
 20556   isBatchingUpdates = true;
       
 20557   try {
       
 20558     return syncUpdates(fn, a);
       
 20559   } finally {
       
 20560     isBatchingUpdates = previousIsBatchingUpdates;
       
 20561     performSyncWork();
       
 20562   }
       
 20563 }
       
 20564 
       
 20565 function interactiveUpdates$1(fn, a, b) {
       
 20566   // If there are any pending interactive updates, synchronously flush them.
       
 20567   // This needs to happen before we read any handlers, because the effect of
       
 20568   // the previous event may influence which handlers are called during
       
 20569   // this event.
       
 20570   if (!isBatchingUpdates && !isRendering && lowestPriorityPendingInteractiveExpirationTime !== NoWork) {
       
 20571     // Synchronously flush pending interactive updates.
       
 20572     performWork(lowestPriorityPendingInteractiveExpirationTime, false);
       
 20573     lowestPriorityPendingInteractiveExpirationTime = NoWork;
       
 20574   }
       
 20575   var previousIsBatchingUpdates = isBatchingUpdates;
       
 20576   isBatchingUpdates = true;
       
 20577   try {
       
 20578     return unstable_runWithPriority(unstable_UserBlockingPriority, function () {
       
 20579       return fn(a, b);
       
 20580     });
       
 20581   } finally {
       
 20582     isBatchingUpdates = previousIsBatchingUpdates;
       
 20583     if (!isBatchingUpdates && !isRendering) {
       
 20584       performSyncWork();
       
 20585     }
       
 20586   }
       
 20587 }
       
 20588 
       
 20589 function flushInteractiveUpdates$1() {
       
 20590   if (!isRendering && lowestPriorityPendingInteractiveExpirationTime !== NoWork) {
       
 20591     // Synchronously flush pending interactive updates.
       
 20592     performWork(lowestPriorityPendingInteractiveExpirationTime, false);
       
 20593     lowestPriorityPendingInteractiveExpirationTime = NoWork;
       
 20594   }
       
 20595 }
       
 20596 
       
 20597 function flushControlled(fn) {
       
 20598   var previousIsBatchingUpdates = isBatchingUpdates;
       
 20599   isBatchingUpdates = true;
       
 20600   try {
       
 20601     syncUpdates(fn);
       
 20602   } finally {
       
 20603     isBatchingUpdates = previousIsBatchingUpdates;
       
 20604     if (!isBatchingUpdates && !isRendering) {
       
 20605       performSyncWork();
       
 20606     }
       
 20607   }
       
 20608 }
       
 20609 
       
 20610 // 0 is PROD, 1 is DEV.
       
 20611 // Might add PROFILE later.
       
 20612 
       
 20613 
       
 20614 var didWarnAboutNestedUpdates = void 0;
       
 20615 var didWarnAboutFindNodeInStrictMode = void 0;
       
 20616 
       
 20617 {
       
 20618   didWarnAboutNestedUpdates = false;
       
 20619   didWarnAboutFindNodeInStrictMode = {};
       
 20620 }
       
 20621 
       
 20622 function getContextForSubtree(parentComponent) {
       
 20623   if (!parentComponent) {
       
 20624     return emptyContextObject;
       
 20625   }
       
 20626 
       
 20627   var fiber = get(parentComponent);
       
 20628   var parentContext = findCurrentUnmaskedContext(fiber);
       
 20629 
       
 20630   if (fiber.tag === ClassComponent) {
       
 20631     var Component = fiber.type;
       
 20632     if (isContextProvider(Component)) {
       
 20633       return processChildContext(fiber, Component, parentContext);
       
 20634     }
       
 20635   }
       
 20636 
       
 20637   return parentContext;
       
 20638 }
       
 20639 
       
 20640 function scheduleRootUpdate(current$$1, element, expirationTime, callback) {
       
 20641   {
       
 20642     if (phase === 'render' && current !== null && !didWarnAboutNestedUpdates) {
       
 20643       didWarnAboutNestedUpdates = true;
       
 20644       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');
       
 20645     }
       
 20646   }
       
 20647 
       
 20648   var update = createUpdate(expirationTime);
       
 20649   // Caution: React DevTools currently depends on this property
       
 20650   // being called "element".
       
 20651   update.payload = { element: element };
       
 20652 
       
 20653   callback = callback === undefined ? null : callback;
       
 20654   if (callback !== null) {
       
 20655     !(typeof callback === 'function') ? warningWithoutStack$1(false, 'render(...): Expected the last optional `callback` argument to be a ' + 'function. Instead received: %s.', callback) : void 0;
       
 20656     update.callback = callback;
       
 20657   }
       
 20658 
       
 20659   flushPassiveEffects();
       
 20660   enqueueUpdate(current$$1, update);
       
 20661   scheduleWork(current$$1, expirationTime);
       
 20662 
       
 20663   return expirationTime;
       
 20664 }
       
 20665 
       
 20666 function updateContainerAtExpirationTime(element, container, parentComponent, expirationTime, callback) {
       
 20667   // TODO: If this is a nested container, this won't be the root.
       
 20668   var current$$1 = container.current;
       
 20669 
       
 20670   {
       
 20671     if (ReactFiberInstrumentation_1.debugTool) {
       
 20672       if (current$$1.alternate === null) {
       
 20673         ReactFiberInstrumentation_1.debugTool.onMountContainer(container);
       
 20674       } else if (element === null) {
       
 20675         ReactFiberInstrumentation_1.debugTool.onUnmountContainer(container);
       
 20676       } else {
       
 20677         ReactFiberInstrumentation_1.debugTool.onUpdateContainer(container);
       
 20678       }
       
 20679     }
       
 20680   }
       
 20681 
       
 20682   var context = getContextForSubtree(parentComponent);
       
 20683   if (container.context === null) {
       
 20684     container.context = context;
       
 20685   } else {
       
 20686     container.pendingContext = context;
       
 20687   }
       
 20688 
       
 20689   return scheduleRootUpdate(current$$1, element, expirationTime, callback);
       
 20690 }
       
 20691 
       
 20692 function findHostInstance(component) {
       
 20693   var fiber = get(component);
       
 20694   if (fiber === undefined) {
       
 20695     if (typeof component.render === 'function') {
       
 20696       invariant(false, 'Unable to find node on an unmounted component.');
       
 20697     } else {
       
 20698       invariant(false, 'Argument appears to not be a ReactComponent. Keys: %s', Object.keys(component));
       
 20699     }
       
 20700   }
       
 20701   var hostFiber = findCurrentHostFiber(fiber);
       
 20702   if (hostFiber === null) {
       
 20703     return null;
       
 20704   }
       
 20705   return hostFiber.stateNode;
       
 20706 }
       
 20707 
       
 20708 function findHostInstanceWithWarning(component, methodName) {
       
 20709   {
       
 20710     var fiber = get(component);
       
 20711     if (fiber === undefined) {
       
 20712       if (typeof component.render === 'function') {
       
 20713         invariant(false, 'Unable to find node on an unmounted component.');
       
 20714       } else {
       
 20715         invariant(false, 'Argument appears to not be a ReactComponent. Keys: %s', Object.keys(component));
       
 20716       }
       
 20717     }
       
 20718     var hostFiber = findCurrentHostFiber(fiber);
       
 20719     if (hostFiber === null) {
       
 20720       return null;
       
 20721     }
       
 20722     if (hostFiber.mode & StrictMode) {
       
 20723       var componentName = getComponentName(fiber.type) || 'Component';
       
 20724       if (!didWarnAboutFindNodeInStrictMode[componentName]) {
       
 20725         didWarnAboutFindNodeInStrictMode[componentName] = true;
       
 20726         if (fiber.mode & StrictMode) {
       
 20727           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));
       
 20728         } else {
       
 20729           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));
       
 20730         }
       
 20731       }
       
 20732     }
       
 20733     return hostFiber.stateNode;
       
 20734   }
       
 20735   return findHostInstance(component);
       
 20736 }
       
 20737 
       
 20738 function createContainer(containerInfo, isConcurrent, hydrate) {
       
 20739   return createFiberRoot(containerInfo, isConcurrent, hydrate);
       
 20740 }
       
 20741 
       
 20742 function updateContainer(element, container, parentComponent, callback) {
       
 20743   var current$$1 = container.current;
       
 20744   var currentTime = requestCurrentTime();
       
 20745   var expirationTime = computeExpirationForFiber(currentTime, current$$1);
       
 20746   return updateContainerAtExpirationTime(element, container, parentComponent, expirationTime, callback);
       
 20747 }
       
 20748 
       
 20749 function getPublicRootInstance(container) {
       
 20750   var containerFiber = container.current;
       
 20751   if (!containerFiber.child) {
       
 20752     return null;
       
 20753   }
       
 20754   switch (containerFiber.child.tag) {
       
 20755     case HostComponent:
       
 20756       return getPublicInstance(containerFiber.child.stateNode);
       
 20757     default:
       
 20758       return containerFiber.child.stateNode;
       
 20759   }
       
 20760 }
       
 20761 
       
 20762 function findHostInstanceWithNoPortals(fiber) {
       
 20763   var hostFiber = findCurrentHostFiberWithNoPortals(fiber);
       
 20764   if (hostFiber === null) {
       
 20765     return null;
       
 20766   }
       
 20767   return hostFiber.stateNode;
       
 20768 }
       
 20769 
       
 20770 var overrideProps = null;
       
 20771 
       
 20772 {
       
 20773   var copyWithSetImpl = function (obj, path, idx, value) {
       
 20774     if (idx >= path.length) {
       
 20775       return value;
       
 20776     }
       
 20777     var key = path[idx];
       
 20778     var updated = Array.isArray(obj) ? obj.slice() : _assign({}, obj);
       
 20779     // $FlowFixMe number or string is fine here
       
 20780     updated[key] = copyWithSetImpl(obj[key], path, idx + 1, value);
       
 20781     return updated;
       
 20782   };
       
 20783 
       
 20784   var copyWithSet = function (obj, path, value) {
       
 20785     return copyWithSetImpl(obj, path, 0, value);
       
 20786   };
       
 20787 
       
 20788   // Support DevTools props for function components, forwardRef, memo, host components, etc.
       
 20789   overrideProps = function (fiber, path, value) {
       
 20790     flushPassiveEffects();
       
 20791     fiber.pendingProps = copyWithSet(fiber.memoizedProps, path, value);
       
 20792     if (fiber.alternate) {
       
 20793       fiber.alternate.pendingProps = fiber.pendingProps;
       
 20794     }
       
 20795     scheduleWork(fiber, Sync);
       
 20796   };
       
 20797 }
       
 20798 
       
 20799 function injectIntoDevTools(devToolsConfig) {
       
 20800   var findFiberByHostInstance = devToolsConfig.findFiberByHostInstance;
       
 20801   var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
       
 20802 
       
 20803 
       
 20804   return injectInternals(_assign({}, devToolsConfig, {
       
 20805     overrideProps: overrideProps,
       
 20806     currentDispatcherRef: ReactCurrentDispatcher,
       
 20807     findHostInstanceByFiber: function (fiber) {
       
 20808       var hostFiber = findCurrentHostFiber(fiber);
       
 20809       if (hostFiber === null) {
       
 20810         return null;
       
 20811       }
       
 20812       return hostFiber.stateNode;
       
 20813     },
       
 20814     findFiberByHostInstance: function (instance) {
       
 20815       if (!findFiberByHostInstance) {
       
 20816         // Might not be implemented by the renderer.
       
 20817         return null;
       
 20818       }
       
 20819       return findFiberByHostInstance(instance);
       
 20820     }
       
 20821   }));
       
 20822 }
       
 20823 
       
 20824 // This file intentionally does *not* have the Flow annotation.
       
 20825 // Don't add it. See `./inline-typed.js` for an explanation.
       
 20826 
       
 20827 function createPortal$1(children, containerInfo,
       
 20828 // TODO: figure out the API for cross-renderer implementation.
       
 20829 implementation) {
       
 20830   var key = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
       
 20831 
       
 20832   return {
       
 20833     // This tag allow us to uniquely identify this as a React Portal
       
 20834     $$typeof: REACT_PORTAL_TYPE,
       
 20835     key: key == null ? null : '' + key,
       
 20836     children: children,
       
 20837     containerInfo: containerInfo,
       
 20838     implementation: implementation
       
 20839   };
       
 20840 }
       
 20841 
       
 20842 // TODO: this is special because it gets imported during build.
       
 20843 
       
 20844 var ReactVersion = '16.8.4';
       
 20845 
       
 20846 // TODO: This type is shared between the reconciler and ReactDOM, but will
       
 20847 // eventually be lifted out to the renderer.
       
 20848 
       
 20849 var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
       
 20850 
       
 20851 var topLevelUpdateWarnings = void 0;
       
 20852 var warnOnInvalidCallback = void 0;
       
 20853 var didWarnAboutUnstableCreatePortal = false;
       
 20854 
       
 20855 {
       
 20856   if (typeof Map !== 'function' ||
       
 20857   // $FlowIssue Flow incorrectly thinks Map has no prototype
       
 20858   Map.prototype == null || typeof Map.prototype.forEach !== 'function' || typeof Set !== 'function' ||
       
 20859   // $FlowIssue Flow incorrectly thinks Set has no prototype
       
 20860   Set.prototype == null || typeof Set.prototype.clear !== 'function' || typeof Set.prototype.forEach !== 'function') {
       
 20861     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');
       
 20862   }
       
 20863 
       
 20864   topLevelUpdateWarnings = function (container) {
       
 20865     if (container._reactRootContainer && container.nodeType !== COMMENT_NODE) {
       
 20866       var hostInstance = findHostInstanceWithNoPortals(container._reactRootContainer._internalRoot.current);
       
 20867       if (hostInstance) {
       
 20868         !(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;
       
 20869       }
       
 20870     }
       
 20871 
       
 20872     var isRootRenderedBySomeReact = !!container._reactRootContainer;
       
 20873     var rootEl = getReactRootElementInContainer(container);
       
 20874     var hasNonRootReactChild = !!(rootEl && getInstanceFromNode$1(rootEl));
       
 20875 
       
 20876     !(!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;
       
 20877 
       
 20878     !(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;
       
 20879   };
       
 20880 
       
 20881   warnOnInvalidCallback = function (callback, callerName) {
       
 20882     !(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;
       
 20883   };
       
 20884 }
       
 20885 
       
 20886 setRestoreImplementation(restoreControlledState$1);
       
 20887 
       
 20888 function ReactBatch(root) {
       
 20889   var expirationTime = computeUniqueAsyncExpiration();
       
 20890   this._expirationTime = expirationTime;
       
 20891   this._root = root;
       
 20892   this._next = null;
       
 20893   this._callbacks = null;
       
 20894   this._didComplete = false;
       
 20895   this._hasChildren = false;
       
 20896   this._children = null;
       
 20897   this._defer = true;
       
 20898 }
       
 20899 ReactBatch.prototype.render = function (children) {
       
 20900   !this._defer ? invariant(false, 'batch.render: Cannot render a batch that already committed.') : void 0;
       
 20901   this._hasChildren = true;
       
 20902   this._children = children;
       
 20903   var internalRoot = this._root._internalRoot;
       
 20904   var expirationTime = this._expirationTime;
       
 20905   var work = new ReactWork();
       
 20906   updateContainerAtExpirationTime(children, internalRoot, null, expirationTime, work._onCommit);
       
 20907   return work;
       
 20908 };
       
 20909 ReactBatch.prototype.then = function (onComplete) {
       
 20910   if (this._didComplete) {
       
 20911     onComplete();
       
 20912     return;
       
 20913   }
       
 20914   var callbacks = this._callbacks;
       
 20915   if (callbacks === null) {
       
 20916     callbacks = this._callbacks = [];
       
 20917   }
       
 20918   callbacks.push(onComplete);
       
 20919 };
       
 20920 ReactBatch.prototype.commit = function () {
       
 20921   var internalRoot = this._root._internalRoot;
       
 20922   var firstBatch = internalRoot.firstBatch;
       
 20923   !(this._defer && firstBatch !== null) ? invariant(false, 'batch.commit: Cannot commit a batch multiple times.') : void 0;
       
 20924 
       
 20925   if (!this._hasChildren) {
       
 20926     // This batch is empty. Return.
       
 20927     this._next = null;
       
 20928     this._defer = false;
       
 20929     return;
       
 20930   }
       
 20931 
       
 20932   var expirationTime = this._expirationTime;
       
 20933 
       
 20934   // Ensure this is the first batch in the list.
       
 20935   if (firstBatch !== this) {
       
 20936     // This batch is not the earliest batch. We need to move it to the front.
       
 20937     // Update its expiration time to be the expiration time of the earliest
       
 20938     // batch, so that we can flush it without flushing the other batches.
       
 20939     if (this._hasChildren) {
       
 20940       expirationTime = this._expirationTime = firstBatch._expirationTime;
       
 20941       // Rendering this batch again ensures its children will be the final state
       
 20942       // when we flush (updates are processed in insertion order: last
       
 20943       // update wins).
       
 20944       // TODO: This forces a restart. Should we print a warning?
       
 20945       this.render(this._children);
       
 20946     }
       
 20947 
       
 20948     // Remove the batch from the list.
       
 20949     var previous = null;
       
 20950     var batch = firstBatch;
       
 20951     while (batch !== this) {
       
 20952       previous = batch;
       
 20953       batch = batch._next;
       
 20954     }
       
 20955     !(previous !== null) ? invariant(false, 'batch.commit: Cannot commit a batch multiple times.') : void 0;
       
 20956     previous._next = batch._next;
       
 20957 
       
 20958     // Add it to the front.
       
 20959     this._next = firstBatch;
       
 20960     firstBatch = internalRoot.firstBatch = this;
       
 20961   }
       
 20962 
       
 20963   // Synchronously flush all the work up to this batch's expiration time.
       
 20964   this._defer = false;
       
 20965   flushRoot(internalRoot, expirationTime);
       
 20966 
       
 20967   // Pop the batch from the list.
       
 20968   var next = this._next;
       
 20969   this._next = null;
       
 20970   firstBatch = internalRoot.firstBatch = next;
       
 20971 
       
 20972   // Append the next earliest batch's children to the update queue.
       
 20973   if (firstBatch !== null && firstBatch._hasChildren) {
       
 20974     firstBatch.render(firstBatch._children);
       
 20975   }
       
 20976 };
       
 20977 ReactBatch.prototype._onComplete = function () {
       
 20978   if (this._didComplete) {
       
 20979     return;
       
 20980   }
       
 20981   this._didComplete = true;
       
 20982   var callbacks = this._callbacks;
       
 20983   if (callbacks === null) {
       
 20984     return;
       
 20985   }
       
 20986   // TODO: Error handling.
       
 20987   for (var i = 0; i < callbacks.length; i++) {
       
 20988     var _callback = callbacks[i];
       
 20989     _callback();
       
 20990   }
       
 20991 };
       
 20992 
       
 20993 function ReactWork() {
       
 20994   this._callbacks = null;
       
 20995   this._didCommit = false;
       
 20996   // TODO: Avoid need to bind by replacing callbacks in the update queue with
       
 20997   // list of Work objects.
       
 20998   this._onCommit = this._onCommit.bind(this);
       
 20999 }
       
 21000 ReactWork.prototype.then = function (onCommit) {
       
 21001   if (this._didCommit) {
       
 21002     onCommit();
       
 21003     return;
       
 21004   }
       
 21005   var callbacks = this._callbacks;
       
 21006   if (callbacks === null) {
       
 21007     callbacks = this._callbacks = [];
       
 21008   }
       
 21009   callbacks.push(onCommit);
       
 21010 };
       
 21011 ReactWork.prototype._onCommit = function () {
       
 21012   if (this._didCommit) {
       
 21013     return;
       
 21014   }
       
 21015   this._didCommit = true;
       
 21016   var callbacks = this._callbacks;
       
 21017   if (callbacks === null) {
       
 21018     return;
       
 21019   }
       
 21020   // TODO: Error handling.
       
 21021   for (var i = 0; i < callbacks.length; i++) {
       
 21022     var _callback2 = callbacks[i];
       
 21023     !(typeof _callback2 === 'function') ? invariant(false, 'Invalid argument passed as callback. Expected a function. Instead received: %s', _callback2) : void 0;
       
 21024     _callback2();
       
 21025   }
       
 21026 };
       
 21027 
       
 21028 function ReactRoot(container, isConcurrent, hydrate) {
       
 21029   var root = createContainer(container, isConcurrent, hydrate);
       
 21030   this._internalRoot = root;
       
 21031 }
       
 21032 ReactRoot.prototype.render = function (children, callback) {
       
 21033   var root = this._internalRoot;
       
 21034   var work = new ReactWork();
       
 21035   callback = callback === undefined ? null : callback;
       
 21036   {
       
 21037     warnOnInvalidCallback(callback, 'render');
       
 21038   }
       
 21039   if (callback !== null) {
       
 21040     work.then(callback);
       
 21041   }
       
 21042   updateContainer(children, root, null, work._onCommit);
       
 21043   return work;
       
 21044 };
       
 21045 ReactRoot.prototype.unmount = function (callback) {
       
 21046   var root = this._internalRoot;
       
 21047   var work = new ReactWork();
       
 21048   callback = callback === undefined ? null : callback;
       
 21049   {
       
 21050     warnOnInvalidCallback(callback, 'render');
       
 21051   }
       
 21052   if (callback !== null) {
       
 21053     work.then(callback);
       
 21054   }
       
 21055   updateContainer(null, root, null, work._onCommit);
       
 21056   return work;
       
 21057 };
       
 21058 ReactRoot.prototype.legacy_renderSubtreeIntoContainer = function (parentComponent, children, callback) {
       
 21059   var root = this._internalRoot;
       
 21060   var work = new ReactWork();
       
 21061   callback = callback === undefined ? null : callback;
       
 21062   {
       
 21063     warnOnInvalidCallback(callback, 'render');
       
 21064   }
       
 21065   if (callback !== null) {
       
 21066     work.then(callback);
       
 21067   }
       
 21068   updateContainer(children, root, parentComponent, work._onCommit);
       
 21069   return work;
       
 21070 };
       
 21071 ReactRoot.prototype.createBatch = function () {
       
 21072   var batch = new ReactBatch(this);
       
 21073   var expirationTime = batch._expirationTime;
       
 21074 
       
 21075   var internalRoot = this._internalRoot;
       
 21076   var firstBatch = internalRoot.firstBatch;
       
 21077   if (firstBatch === null) {
       
 21078     internalRoot.firstBatch = batch;
       
 21079     batch._next = null;
       
 21080   } else {
       
 21081     // Insert sorted by expiration time then insertion order
       
 21082     var insertAfter = null;
       
 21083     var insertBefore = firstBatch;
       
 21084     while (insertBefore !== null && insertBefore._expirationTime >= expirationTime) {
       
 21085       insertAfter = insertBefore;
       
 21086       insertBefore = insertBefore._next;
       
 21087     }
       
 21088     batch._next = insertBefore;
       
 21089     if (insertAfter !== null) {
       
 21090       insertAfter._next = batch;
       
 21091     }
       
 21092   }
       
 21093 
       
 21094   return batch;
       
 21095 };
       
 21096 
       
 21097 /**
       
 21098  * True if the supplied DOM node is a valid node element.
       
 21099  *
       
 21100  * @param {?DOMElement} node The candidate DOM node.
       
 21101  * @return {boolean} True if the DOM is a valid DOM node.
       
 21102  * @internal
       
 21103  */
       
 21104 function isValidContainer(node) {
       
 21105   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 '));
       
 21106 }
       
 21107 
       
 21108 function getReactRootElementInContainer(container) {
       
 21109   if (!container) {
       
 21110     return null;
       
 21111   }
       
 21112 
       
 21113   if (container.nodeType === DOCUMENT_NODE) {
       
 21114     return container.documentElement;
       
 21115   } else {
       
 21116     return container.firstChild;
       
 21117   }
       
 21118 }
       
 21119 
       
 21120 function shouldHydrateDueToLegacyHeuristic(container) {
       
 21121   var rootElement = getReactRootElementInContainer(container);
       
 21122   return !!(rootElement && rootElement.nodeType === ELEMENT_NODE && rootElement.hasAttribute(ROOT_ATTRIBUTE_NAME));
       
 21123 }
       
 21124 
       
 21125 setBatchingImplementation(batchedUpdates$1, interactiveUpdates$1, flushInteractiveUpdates$1);
       
 21126 
       
 21127 var warnedAboutHydrateAPI = false;
       
 21128 
       
 21129 function legacyCreateRootFromDOMContainer(container, forceHydrate) {
       
 21130   var shouldHydrate = forceHydrate || shouldHydrateDueToLegacyHeuristic(container);
       
 21131   // First clear any existing content.
       
 21132   if (!shouldHydrate) {
       
 21133     var warned = false;
       
 21134     var rootSibling = void 0;
       
 21135     while (rootSibling = container.lastChild) {
       
 21136       {
       
 21137         if (!warned && rootSibling.nodeType === ELEMENT_NODE && rootSibling.hasAttribute(ROOT_ATTRIBUTE_NAME)) {
       
 21138           warned = true;
       
 21139           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.');
       
 21140         }
       
 21141       }
       
 21142       container.removeChild(rootSibling);
       
 21143     }
       
 21144   }
       
 21145   {
       
 21146     if (shouldHydrate && !forceHydrate && !warnedAboutHydrateAPI) {
       
 21147       warnedAboutHydrateAPI = true;
       
 21148       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.');
       
 21149     }
       
 21150   }
       
 21151   // Legacy roots are not async by default.
       
 21152   var isConcurrent = false;
       
 21153   return new ReactRoot(container, isConcurrent, shouldHydrate);
       
 21154 }
       
 21155 
       
 21156 function legacyRenderSubtreeIntoContainer(parentComponent, children, container, forceHydrate, callback) {
       
 21157   {
       
 21158     topLevelUpdateWarnings(container);
       
 21159   }
       
 21160 
       
 21161   // TODO: Without `any` type, Flow says "Property cannot be accessed on any
       
 21162   // member of intersection type." Whyyyyyy.
       
 21163   var root = container._reactRootContainer;
       
 21164   if (!root) {
       
 21165     // Initial mount
       
 21166     root = container._reactRootContainer = legacyCreateRootFromDOMContainer(container, forceHydrate);
       
 21167     if (typeof callback === 'function') {
       
 21168       var originalCallback = callback;
       
 21169       callback = function () {
       
 21170         var instance = getPublicRootInstance(root._internalRoot);
       
 21171         originalCallback.call(instance);
       
 21172       };
       
 21173     }
       
 21174     // Initial mount should not be batched.
       
 21175     unbatchedUpdates(function () {
       
 21176       if (parentComponent != null) {
       
 21177         root.legacy_renderSubtreeIntoContainer(parentComponent, children, callback);
       
 21178       } else {
       
 21179         root.render(children, callback);
       
 21180       }
       
 21181     });
       
 21182   } else {
       
 21183     if (typeof callback === 'function') {
       
 21184       var _originalCallback = callback;
       
 21185       callback = function () {
       
 21186         var instance = getPublicRootInstance(root._internalRoot);
       
 21187         _originalCallback.call(instance);
       
 21188       };
       
 21189     }
       
 21190     // Update
       
 21191     if (parentComponent != null) {
       
 21192       root.legacy_renderSubtreeIntoContainer(parentComponent, children, callback);
       
 21193     } else {
       
 21194       root.render(children, callback);
       
 21195     }
       
 21196   }
       
 21197   return getPublicRootInstance(root._internalRoot);
       
 21198 }
       
 21199 
       
 21200 function createPortal$$1(children, container) {
       
 21201   var key = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
       
 21202 
       
 21203   !isValidContainer(container) ? invariant(false, 'Target container is not a DOM element.') : void 0;
       
 21204   // TODO: pass ReactDOM portal implementation as third argument
       
 21205   return createPortal$1(children, container, null, key);
       
 21206 }
       
 21207 
       
 21208 var ReactDOM = {
       
 21209   createPortal: createPortal$$1,
       
 21210 
       
 21211   findDOMNode: function (componentOrElement) {
       
 21212     {
       
 21213       var owner = ReactCurrentOwner.current;
       
 21214       if (owner !== null && owner.stateNode !== null) {
       
 21215         var warnedAboutRefsInRender = owner.stateNode._warnedAboutRefsInRender;
       
 21216         !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;
       
 21217         owner.stateNode._warnedAboutRefsInRender = true;
       
 21218       }
       
 21219     }
       
 21220     if (componentOrElement == null) {
       
 21221       return null;
       
 21222     }
       
 21223     if (componentOrElement.nodeType === ELEMENT_NODE) {
       
 21224       return componentOrElement;
       
 21225     }
       
 21226     {
       
 21227       return findHostInstanceWithWarning(componentOrElement, 'findDOMNode');
       
 21228     }
       
 21229     return findHostInstance(componentOrElement);
       
 21230   },
       
 21231   hydrate: function (element, container, callback) {
       
 21232     !isValidContainer(container) ? invariant(false, 'Target container is not a DOM element.') : void 0;
       
 21233     {
       
 21234       !!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;
       
 21235     }
       
 21236     // TODO: throw or warn if we couldn't hydrate?
       
 21237     return legacyRenderSubtreeIntoContainer(null, element, container, true, callback);
       
 21238   },
       
 21239   render: function (element, container, callback) {
       
 21240     !isValidContainer(container) ? invariant(false, 'Target container is not a DOM element.') : void 0;
       
 21241     {
       
 21242       !!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;
       
 21243     }
       
 21244     return legacyRenderSubtreeIntoContainer(null, element, container, false, callback);
       
 21245   },
       
 21246   unstable_renderSubtreeIntoContainer: function (parentComponent, element, containerNode, callback) {
       
 21247     !isValidContainer(containerNode) ? invariant(false, 'Target container is not a DOM element.') : void 0;
       
 21248     !(parentComponent != null && has(parentComponent)) ? invariant(false, 'parentComponent must be a valid React Component') : void 0;
       
 21249     return legacyRenderSubtreeIntoContainer(parentComponent, element, containerNode, false, callback);
       
 21250   },
       
 21251   unmountComponentAtNode: function (container) {
       
 21252     !isValidContainer(container) ? invariant(false, 'unmountComponentAtNode(...): Target container is not a DOM element.') : void 0;
       
 21253 
       
 21254     {
       
 21255       !!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;
       
 21256     }
       
 21257 
       
 21258     if (container._reactRootContainer) {
       
 21259       {
       
 21260         var rootEl = getReactRootElementInContainer(container);
       
 21261         var renderedByDifferentReact = rootEl && !getInstanceFromNode$1(rootEl);
       
 21262         !!renderedByDifferentReact ? warningWithoutStack$1(false, "unmountComponentAtNode(): The node you're attempting to unmount " + 'was rendered by another copy of React.') : void 0;
       
 21263       }
       
 21264 
       
 21265       // Unmount should not be batched.
       
 21266       unbatchedUpdates(function () {
       
 21267         legacyRenderSubtreeIntoContainer(null, null, container, false, function () {
       
 21268           container._reactRootContainer = null;
       
 21269         });
       
 21270       });
       
 21271       // If you call unmountComponentAtNode twice in quick succession, you'll
       
 21272       // get `true` twice. That's probably fine?
       
 21273       return true;
       
 21274     } else {
       
 21275       {
       
 21276         var _rootEl = getReactRootElementInContainer(container);
       
 21277         var hasNonRootReactChild = !!(_rootEl && getInstanceFromNode$1(_rootEl));
       
 21278 
       
 21279         // Check if the container itself is a React root node.
       
 21280         var isContainerReactRoot = container.nodeType === ELEMENT_NODE && isValidContainer(container.parentNode) && !!container.parentNode._reactRootContainer;
       
 21281 
       
 21282         !!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;
       
 21283       }
       
 21284 
       
 21285       return false;
       
 21286     }
       
 21287   },
       
 21288 
       
 21289 
       
 21290   // Temporary alias since we already shipped React 16 RC with it.
       
 21291   // TODO: remove in React 17.
       
 21292   unstable_createPortal: function () {
       
 21293     if (!didWarnAboutUnstableCreatePortal) {
       
 21294       didWarnAboutUnstableCreatePortal = true;
       
 21295       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.');
       
 21296     }
       
 21297     return createPortal$$1.apply(undefined, arguments);
       
 21298   },
       
 21299 
       
 21300 
       
 21301   unstable_batchedUpdates: batchedUpdates$1,
       
 21302 
       
 21303   unstable_interactiveUpdates: interactiveUpdates$1,
       
 21304 
       
 21305   flushSync: flushSync,
       
 21306 
       
 21307   unstable_createRoot: createRoot,
       
 21308   unstable_flushControlled: flushControlled,
       
 21309 
       
 21310   __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: {
       
 21311     // Keep in sync with ReactDOMUnstableNativeDependencies.js
       
 21312     // and ReactTestUtils.js. This is an array for better minification.
       
 21313     Events: [getInstanceFromNode$1, getNodeFromInstance$1, getFiberCurrentPropsFromNode$1, injection.injectEventPluginsByName, eventNameDispatchConfigs, accumulateTwoPhaseDispatches, accumulateDirectDispatches, enqueueStateRestore, restoreStateIfNeeded, dispatchEvent, runEventsInBatch]
       
 21314   }
       
 21315 };
       
 21316 
       
 21317 function createRoot(container, options) {
       
 21318   var functionName = enableStableConcurrentModeAPIs ? 'createRoot' : 'unstable_createRoot';
       
 21319   !isValidContainer(container) ? invariant(false, '%s(...): Target container is not a DOM element.', functionName) : void 0;
       
 21320   {
       
 21321     !!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;
       
 21322     container._reactHasBeenPassedToCreateRootDEV = true;
       
 21323   }
       
 21324   var hydrate = options != null && options.hydrate === true;
       
 21325   return new ReactRoot(container, true, hydrate);
       
 21326 }
       
 21327 
       
 21328 if (enableStableConcurrentModeAPIs) {
       
 21329   ReactDOM.createRoot = createRoot;
       
 21330   ReactDOM.unstable_createRoot = undefined;
       
 21331 }
       
 21332 
       
 21333 var foundDevTools = injectIntoDevTools({
       
 21334   findFiberByHostInstance: getClosestInstanceFromNode,
       
 21335   bundleType: 1,
       
 21336   version: ReactVersion,
       
 21337   rendererPackageName: 'react-dom'
       
 21338 });
       
 21339 
       
 21340 {
       
 21341   if (!foundDevTools && canUseDOM && window.top === window.self) {
       
 21342     // If we're in Chrome or Firefox, provide a download link if not installed.
       
 21343     if (navigator.userAgent.indexOf('Chrome') > -1 && navigator.userAgent.indexOf('Edge') === -1 || navigator.userAgent.indexOf('Firefox') > -1) {
       
 21344       var protocol = window.location.protocol;
       
 21345       // Don't warn in exotic cases like chrome-extension://.
       
 21346       if (/^(https?|file):$/.test(protocol)) {
       
 21347         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');
       
 21348       }
       
 21349     }
       
 21350   }
       
 21351 }
       
 21352 
       
 21353 
       
 21354 
       
 21355 var ReactDOM$2 = Object.freeze({
       
 21356 	default: ReactDOM
       
 21357 });
       
 21358 
       
 21359 var ReactDOM$3 = ( ReactDOM$2 && ReactDOM ) || ReactDOM$2;
       
 21360 
       
 21361 // TODO: decide on the top-level export form.
       
 21362 // This is hacky but makes it work with both Rollup and Jest.
       
 21363 var reactDom = ReactDOM$3.default || ReactDOM$3;
       
 21364 
       
 21365 return reactDom;
       
 21366 
       
 21367 })));