[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

/wp-includes/js/dist/vendor/ -> react-dom.js (source)

   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