[
  {
    "path": ".gitignore",
    "content": "/node_modules\n/lib\n/coverage\n/yarn.lock\n/yarn-error.log\n"
  },
  {
    "path": ".travis.yml",
    "content": "language: node_js\nnode_js:\n  - stable\nscript:\n  - npm test -- --coverage\n  - bash <(curl -s https://codecov.io/bash)\n\n"
  },
  {
    "path": "LICENSE",
    "content": "The MIT License\n\nCopyright (c) 2018-present Wei Zhu <yesmeck@gmail.com>\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n"
  },
  {
    "path": "README.md",
    "content": "# react-with-hooks\n\n[![Build Status](https://img.shields.io/travis/yesmeck/react-with-hooks.svg?style=flat-square)](https://travis-ci.org/yesmeck/react-with-hooks)\n![codecov](https://img.shields.io/codecov/c/github/yesmeck/react-with-hooks.svg?style=flat-square)\n\nPolyfill and ponyfill for the [React Hooks API](https://reactjs.org/docs/hooks-intro.html).\n\nWorks on React Native!\n\n⚠️The code on master branch is still WIP.\n\n## Install\n\n```bash\n$ npm i react-with-hooks --save\n```\n\n## Usage\n\nYou can use `react-with-hooks` as a polyfill; in this case, when you later transition to native React Hooks you will only need to remove the `import 'react-with-hooks/polyfill'` statement:\n\n```javascript\nimport 'react-with-hooks/polyfill'; // import the polyfill in the entry of your application\nimport React, { useState, useEffect } from 'react';\n\nconst Counter = () => {\n  const [ count, setCount ] = useState(0);\n  useEffect(() => {\n    document.title = \"count is \" + count;\n  })\n  return (\n    <div>\n      {count}\n      <button onClick={() => setCount(count + 1)}>+</button>\n      <button onClick={() => setCount(count - 1)}>-</button>\n    </div>\n  );\n};\n```\n\nAlternatively, you can use this library as a ponyfill with the `withHooks` helper. In this case, you will have to refactor your code later when you transition to use native React Hooks.\n\n```javascript\nimport React from 'react';\nimport withHooks, { useState, useEffect } from 'react-with-hooks';\n\nconst Counter = withHooks(() => {\n  const [ count, setCount ] = useState(0);\n  useEffect(() => {\n    document.title = \"count is \" + count;\n  })\n  return (\n    <div>\n      {count}\n      <button onClick={() => setCount(count + 1)}>+</button>\n      <button onClick={() => setCount(count - 1)}>-</button>\n    </div>\n  );\n});\n```\n\n[Live Demo](https://codesandbox.io/s/olx6zp44n6)\n\n## API Reference\n\n- Basic Hooks\n  - [useState](https://reactjs.org/docs/hooks-reference.html#usestate)\n  - [useEffect](https://reactjs.org/docs/hooks-reference.html#useeffect)\n  - [useContext](https://reactjs.org/docs/hooks-reference.html#usecontext)\n- Additional Hooks\n  - [useReducer](https://reactjs.org/docs/hooks-reference.html#usereducer)\n  - [useCallback](https://reactjs.org/docs/hooks-reference.html#usecallback)\n  - [useMemo](https://reactjs.org/docs/hooks-reference.html#usememo)\n  - [useRef](https://reactjs.org/docs/hooks-reference.html#useref)\n  - [useImperativeHandle](https://reactjs.org/docs/hooks-reference.html#useimperativehandle)\n  - [useLayoutEffect](https://reactjs.org/docs/hooks-reference.html#uselayouteffect)\n\n\n## License\n\n[MIT](./LICENSE)\n"
  },
  {
    "path": "babel.config.js",
    "content": "module.exports = {\n  presets: ['@babel/preset-env', '@babel/preset-react'],\n  plugins: [\n    '@babel/plugin-proposal-class-properties'\n  ]\n};\n"
  },
  {
    "path": "index.d.ts",
    "content": "import * as React from 'react';\n\ntype WithHooks = <T>(component: React.SFC<T>) => React.SFC<T>;\n\ndeclare function useContext<T>(context: React.Context<T>): T;\ndeclare function useState<S>(initialState: S | (() => S)): [S, React.Dispatch<React.SetStateAction<S>>];\ndeclare function useReducer<S, A>(\n  reducer: React.Reducer<S, A>,\n  initialState: S,\n  initialAction?: A | null,\n): [S, React.Dispatch<A>];\ndeclare function useRef<T>(initialValue: T): React.MutableRefObject<T>;\ndeclare function useRef<T>(initialValue: T | null): React.RefObject<T>;\ndeclare function useMutationEffect(effect: React.EffectCallback, inputs?: React.InputIdentityList): void;\ndeclare function useLayoutEffect(effect: React.EffectCallback, inputs?: React.InputIdentityList): void;\ndeclare function useEffect(effect: React.EffectCallback, inputs?: React.InputIdentityList): void;\ndeclare function useImperativeHandle<T, R extends T>(\n  ref: React.Ref<T> | undefined,\n  init: () => R,\n  inputs?: React.InputIdentityList,\n): void;\ndeclare function useCallback<T extends (...args: any[]) => any>(callback: T, inputs: React.InputIdentityList): T;\ndeclare function useMemo<T>(factory: () => T, inputs: React.InputIdentityList): T;\n\ndeclare var withHooks: WithHooks;\n\nexport {\n  useContext,\n  useState,\n  useReducer,\n  useRef,\n  useMutationEffect,\n  useLayoutEffect,\n  useEffect,\n  useImperativeHandle,\n  useCallback,\n  useMemo,\n}\nexport default withHooks;\n"
  },
  {
    "path": "package.json",
    "content": "{\n  \"name\": \"react-with-hooks\",\n  \"version\": \"1.1.6\",\n  \"description\": \"react hooks polyfill\",\n  \"main\": \"lib/index.js\",\n  \"files\": [\n    \"lib\",\n    \"index.d.ts\",\n    \"polyfill.js\"\n  ],\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"https://github.com/yesmeck/react-with-hooks\"\n  },\n  \"bugs\": {\n    \"url\": \"https://github.com/yesmeck/react-with-hooks/issues\"\n  },\n  \"keywords\": [\n    \"react\",\n    \"hooks\"\n  ],\n  \"author\": \"yesmeck <yesmeck@gmail.com>\",\n  \"license\": \"MIT\",\n  \"scripts\": {\n    \"test\": \"NODE_ENV=development jest\",\n    \"build\": \"babel src -d lib\",\n    \"prepack\": \"npm run build\",\n    \"postinstall\": \"./scripts/alertFlag.sh\"\n  },\n  \"jest\": {\n    \"setupFilesAfterEnv\": [\n      \"<rootDir>scripts/jest/setupTests.js\"\n    ],\n    \"collectCoverageFrom\": [\n      \"src/**/*.js\"\n    ]\n  },\n  \"typings\": \"index.d.ts\",\n  \"devDependencies\": {\n    \"@babel/cli\": \"^7.1.2\",\n    \"@babel/core\": \"^7.1.2\",\n    \"@babel/plugin-proposal-class-properties\": \"^7.1.0\",\n    \"@babel/preset-env\": \"^7.1.0\",\n    \"@babel/preset-react\": \"^7.0.0\",\n    \"babel-jest\": \"^24.0.0\",\n    \"chalk\": \"^2.4.2\",\n    \"jest\": \"^24.0.0\",\n    \"jest-diff\": \"^24.0.0\",\n    \"jest-dom\": \"^3.1.1\",\n    \"react\": \"^16.8.1\",\n    \"react-dom\": \"^16.8.1\",\n    \"react-reconciler\": \"^0.19.1\",\n    \"react-testing-library\": \"^5.8.0\",\n    \"regenerator-runtime\": \"^0.12.1\"\n  },\n  \"dependencies\": {\n    \"invariant\": \"^2.2.4\",\n    \"react-is\": \"^16.8.1\"\n  }\n}\n"
  },
  {
    "path": "polyfill.js",
    "content": "module.exports = require('./lib/polyfill');\n"
  },
  {
    "path": "scripts/alertFlag.sh",
    "content": "#!/bin/sh\n\n perl -i -pe's/var debugRenderPhaseSideEffectsForStrictMode = true;/var debugRenderPhaseSideEffectsForStrictMode = false;/'  node_modules/react-reconciler/cjs/react-reconciler.development.js\n"
  },
  {
    "path": "scripts/jest/matchers/toWarnDev.js",
    "content": "'use strict';\n\nconst jestDiff = require('jest-diff');\nconst util = require('util');\nconst shouldIgnoreConsoleError = require('../shouldIgnoreConsoleError');\n\nfunction normalizeCodeLocInfo(str) {\n  return str && str.replace(/at .+?:\\d+/g, 'at **');\n}\n\nconst createMatcherFor = consoleMethod =>\n  function matcher(callback, expectedMessages, options = {}) {\n    if (__DEV__) {\n      // Warn about incorrect usage of matcher.\n      if (typeof expectedMessages === 'string') {\n        expectedMessages = [expectedMessages];\n      } else if (!Array.isArray(expectedMessages)) {\n        throw Error(\n          `toWarnDev() requires a parameter of type string or an array of strings ` +\n            `but was given ${typeof expectedMessages}.`\n        );\n      }\n      if (\n        options != null &&\n        (typeof options !== 'object' || Array.isArray(options))\n      ) {\n        throw new Error(\n          'toWarnDev() second argument, when present, should be an object. ' +\n            'Did you forget to wrap the messages into an array?'\n        );\n      }\n      if (arguments.length > 3) {\n        // `matcher` comes from Jest, so it's more than 2 in practice\n        throw new Error(\n          'toWarnDev() received more than two arguments. ' +\n            'Did you forget to wrap the messages into an array?'\n        );\n      }\n\n      const withoutStack = options.withoutStack;\n      const warningsWithoutComponentStack = [];\n      const warningsWithComponentStack = [];\n      const unexpectedWarnings = [];\n\n      let lastWarningWithMismatchingFormat = null;\n      let lastWarningWithExtraComponentStack = null;\n\n      // Catch errors thrown by the callback,\n      // But only rethrow them if all test expectations have been satisfied.\n      // Otherwise an Error in the callback can mask a failed expectation,\n      // and result in a test that passes when it shouldn't.\n      let caughtError;\n\n      const isLikelyAComponentStack = message =>\n        typeof message === 'string' && message.includes('\\n    in ');\n\n      const consoleSpy = (format, ...args) => {\n        // Ignore uncaught errors reported by jsdom\n        // and React addendums because they're too noisy.\n        if (\n          consoleMethod === 'error' &&\n          shouldIgnoreConsoleError(format, args)\n        ) {\n          return;\n        }\n\n        const message = util.format(format, ...args);\n        const normalizedMessage = normalizeCodeLocInfo(message);\n\n        // Remember if the number of %s interpolations\n        // doesn't match the number of arguments.\n        // We'll fail the test if it happens.\n        let argIndex = 0;\n        format.replace(/%s/g, () => argIndex++);\n        if (argIndex !== args.length) {\n          lastWarningWithMismatchingFormat = {\n            format,\n            args,\n            expectedArgCount: argIndex,\n          };\n        }\n\n        // Protect against accidentally passing a component stack\n        // to warning() which already injects the component stack.\n        if (\n          args.length >= 2 &&\n          isLikelyAComponentStack(args[args.length - 1]) &&\n          isLikelyAComponentStack(args[args.length - 2])\n        ) {\n          lastWarningWithExtraComponentStack = {\n            format,\n          };\n        }\n\n        for (let index = 0; index < expectedMessages.length; index++) {\n          const expectedMessage = expectedMessages[index];\n          if (\n            normalizedMessage === expectedMessage ||\n            normalizedMessage.includes(expectedMessage)\n          ) {\n            if (isLikelyAComponentStack(normalizedMessage)) {\n              warningsWithComponentStack.push(normalizedMessage);\n            } else {\n              warningsWithoutComponentStack.push(normalizedMessage);\n            }\n            expectedMessages.splice(index, 1);\n            return;\n          }\n        }\n\n        let errorMessage;\n        if (expectedMessages.length === 0) {\n          errorMessage =\n            'Unexpected warning recorded: ' +\n            this.utils.printReceived(normalizedMessage);\n        } else if (expectedMessages.length === 1) {\n          errorMessage =\n            'Unexpected warning recorded: ' +\n            jestDiff(expectedMessages[0], normalizedMessage);\n        } else {\n          errorMessage =\n            'Unexpected warning recorded: ' +\n            jestDiff(expectedMessages, [normalizedMessage]);\n        }\n\n        // Record the call stack for unexpected warnings.\n        // We don't throw an Error here though,\n        // Because it might be suppressed by ReactFiberScheduler.\n        unexpectedWarnings.push(new Error(errorMessage));\n      };\n\n      // TODO Decide whether we need to support nested toWarn* expectations.\n      // If we don't need it, add a check here to see if this is already our spy,\n      // And throw an error.\n      const originalMethod = console[consoleMethod];\n\n      // Avoid using Jest's built-in spy since it can't be removed.\n      console[consoleMethod] = consoleSpy;\n\n      try {\n        callback();\n      } catch (error) {\n        caughtError = error;\n      } finally {\n        // Restore the unspied method so that unexpected errors fail tests.\n        console[consoleMethod] = originalMethod;\n\n        // Any unexpected Errors thrown by the callback should fail the test.\n        // This should take precedence since unexpected errors could block warnings.\n        if (caughtError) {\n          throw caughtError;\n        }\n\n        // Any unexpected warnings should be treated as a failure.\n        if (unexpectedWarnings.length > 0) {\n          return {\n            message: () => unexpectedWarnings[0].stack,\n            pass: false,\n          };\n        }\n\n        // Any remaining messages indicate a failed expectations.\n        if (expectedMessages.length > 0) {\n          return {\n            message: () =>\n              `Expected warning was not recorded:\\n  ${this.utils.printReceived(\n                expectedMessages[0]\n              )}`,\n            pass: false,\n          };\n        }\n\n        if (typeof withoutStack === 'number') {\n          // We're expecting a particular number of warnings without stacks.\n          if (withoutStack !== warningsWithoutComponentStack.length) {\n            return {\n              message: () =>\n                `Expected ${withoutStack} warnings without a component stack but received ${\n                  warningsWithoutComponentStack.length\n                }:\\n` +\n                warningsWithoutComponentStack.map(warning =>\n                  this.utils.printReceived(warning)\n                ),\n              pass: false,\n            };\n          }\n        } else if (withoutStack === true) {\n          // We're expecting that all warnings won't have the stack.\n          // If some warnings have it, it's an error.\n          if (warningsWithComponentStack.length > 0) {\n            return {\n              message: () =>\n                `Received warning unexpectedly includes a component stack:\\n  ${this.utils.printReceived(\n                  warningsWithComponentStack[0]\n                )}\\nIf this warning intentionally includes the component stack, remove ` +\n                `{withoutStack: true} from the toWarnDev() call. If you have a mix of ` +\n                `warnings with and without stack in one toWarnDev() call, pass ` +\n                `{withoutStack: N} where N is the number of warnings without stacks.`,\n              pass: false,\n            };\n          }\n        } else if (withoutStack === false || withoutStack === undefined) {\n          // We're expecting that all warnings *do* have the stack (default).\n          // If some warnings don't have it, it's an error.\n          if (warningsWithoutComponentStack.length > 0) {\n            return {\n              message: () =>\n                `Received warning unexpectedly does not include a component stack:\\n  ${this.utils.printReceived(\n                  warningsWithoutComponentStack[0]\n                )}\\nIf this warning intentionally omits the component stack, add ` +\n                `{withoutStack: true} to the toWarnDev() call.`,\n              pass: false,\n            };\n          }\n        } else {\n          throw Error(\n            `The second argument for toWarnDev(), when specified, must be an object. It may have a ` +\n              `property called \"withoutStack\" whose value may be undefined, boolean, or a number. ` +\n              `Instead received ${typeof withoutStack}.`\n          );\n        }\n\n        if (lastWarningWithMismatchingFormat !== null) {\n          return {\n            message: () =>\n              `Received ${\n                lastWarningWithMismatchingFormat.args.length\n              } arguments for a message with ${\n                lastWarningWithMismatchingFormat.expectedArgCount\n              } placeholders:\\n  ${this.utils.printReceived(\n                lastWarningWithMismatchingFormat.format\n              )}`,\n            pass: false,\n          };\n        }\n\n        if (lastWarningWithExtraComponentStack !== null) {\n          return {\n            message: () =>\n              `Received more than one component stack for a warning:\\n  ${this.utils.printReceived(\n                lastWarningWithExtraComponentStack.format\n              )}\\nDid you accidentally pass a stack to warning() as the last argument? ` +\n              `Don't forget warning() already injects the component stack automatically.`,\n            pass: false,\n          };\n        }\n\n        return {pass: true};\n      }\n    } else {\n      // Any uncaught errors or warnings should fail tests in production mode.\n      callback();\n\n      return {pass: true};\n    }\n  };\n\nmodule.exports = {\n  toLowPriorityWarnDev: createMatcherFor('warn'),\n  toWarnDev: createMatcherFor('error'),\n};\n"
  },
  {
    "path": "scripts/jest/setupTests.js",
    "content": "'use strict';\n\nconst chalk = require('chalk');\nconst util = require('util');\nconst shouldIgnoreConsoleError = require('./shouldIgnoreConsoleError');\nconst env = jasmine.getEnv();\n\nconst NODE_ENV = process.env.NODE_ENV;\nif (NODE_ENV !== 'development' && NODE_ENV !== 'production') {\n  throw new Error('NODE_ENV must either be set to development or production.');\n}\nglobal.__DEV__ = NODE_ENV === 'development';\n\nconst expect = global.expect;\n\nexpect.extend({\n  ...require('./matchers/toWarnDev'),\n});\n\n['error', 'warn'].forEach(methodName => {\n  const unexpectedConsoleCallStacks = [];\n  const newMethod = function(format, ...args) {\n    // Ignore uncaught errors reported by jsdom\n    // and React addendums because they're too noisy.\n    if (methodName === 'error' && shouldIgnoreConsoleError(format, args)) {\n      return;\n    }\n\n    // Capture the call stack now so we can warn about it later.\n    // The call stack has helpful information for the test author.\n    // Don't throw yet though b'c it might be accidentally caught and suppressed.\n    const stack = new Error().stack;\n    unexpectedConsoleCallStacks.push([stack.substr(stack.indexOf('\\n') + 1), util.format(format, ...args)]);\n  };\n\n  console[methodName] = newMethod;\n\n  env.beforeEach(() => {\n    unexpectedConsoleCallStacks.length = 0;\n  });\n\n  env.afterEach(() => {\n    if (console[methodName] !== newMethod && !isSpy(console[methodName])) {\n      throw new Error(`Test did not tear down console.${methodName} mock properly.`);\n    }\n\n    if (unexpectedConsoleCallStacks.length > 0) {\n      const messages = unexpectedConsoleCallStacks.map(\n        ([stack, message]) =>\n          `${chalk.red(message)}\\n` +\n          `${stack\n            .split('\\n')\n            .map(line => chalk.gray(line))\n            .join('\\n')}`,\n      );\n\n      const message =\n        `Expected test not to call ${chalk.bold(`console.${methodName}()`)}.\\n\\n` +\n        'If the warning is expected, test for it explicitly by:\\n' +\n        `1. Using the ${chalk.bold('.toWarnDev()')} / ${chalk.bold('.toLowPriorityWarnDev()')} matchers, or...\\n` +\n        `2. Mock it out using ${chalk.bold('spyOnDev')}(console, '${methodName}') or ${chalk.bold(\n          'spyOnProd',\n        )}(console, '${methodName}'), and test that the warning occurs.`;\n\n      throw new Error(`${message}\\n\\n${messages.join('\\n\\n')}`);\n    }\n  });\n});\n"
  },
  {
    "path": "scripts/jest/shouldIgnoreConsoleError.js",
    "content": "'use strict';\n\nmodule.exports = function shouldIgnoreConsoleError(format, args) {\n  if (__DEV__) {\n    if (typeof format === 'string') {\n      if (format.indexOf('Error: Uncaught [') === 0) {\n        // This looks like an uncaught error from invokeGuardedCallback() wrapper\n        // in development that is reported by jsdom. Ignore because it's noisy.\n        return true;\n      }\n      if (format.indexOf('The above error occurred') === 0) {\n        // This looks like an error addendum from ReactFiberErrorLogger.\n        // Ignore it too.\n        return true;\n      }\n    }\n  } else {\n    if (\n      format != null &&\n      typeof format.message === 'string' &&\n      typeof format.stack === 'string' &&\n      args.length === 0\n    ) {\n      // In production, ReactFiberErrorLogger logs error objects directly.\n      // They are noisy too so we'll try to ignore them.\n      return true;\n    }\n  }\n  // Looks legit\n  return false;\n};\n"
  },
  {
    "path": "src/ReactCurrentDispatcher.js",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\n/**\n * Keeps track of the current dispatcher.\n */\nconst ReactCurrentDispatcher = {\n  /**\n   * @internal\n   * @type {ReactComponent}\n   */\n  current: null,\n};\n\nexport default ReactCurrentDispatcher;\n"
  },
  {
    "path": "src/ReactHookEffectTags.js",
    "content": "export const NoEffect = /*             */ 0b00000000;\nexport const UnmountSnapshot = /*      */ 0b00000010;\nexport const UnmountMutation = /*      */ 0b00000100;\nexport const MountMutation = /*        */ 0b00001000;\nexport const UnmountLayout = /*        */ 0b00010000;\nexport const MountLayout = /*          */ 0b00100000;\nexport const MountPassive = /*         */ 0b01000000;\nexport const UnmountPassive = /*       */ 0b10000000;\n"
  },
  {
    "path": "src/ReactHooks.js",
    "content": "/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport invariant from 'invariant';\n\nimport ReactCurrentDispatcher from './ReactCurrentDispatcher';\n\nfunction resolveDispatcher() {\n  const dispatcher = ReactCurrentDispatcher.current;\n  invariant(\n    dispatcher !== null,\n    'Hooks can only be called inside the body of a function component. ' +\n      '(https://fb.me/react-invalid-hook-call)',\n  );\n  return dispatcher;\n}\n\nexport function useContext(\n  context,\n) {\n  const dispatcher = resolveDispatcher();\n  return dispatcher.useContext(context);\n}\n\nexport function useState(initialState) {\n  const dispatcher = resolveDispatcher();\n  return dispatcher.useState(initialState);\n}\n\nexport function useReducer(\n  reducer,\n  initialArg,\n  init,\n) {\n  const dispatcher = resolveDispatcher();\n  return dispatcher.useReducer(reducer, initialArg, init);\n}\n\nexport function useRef(initialValue) {\n  const dispatcher = resolveDispatcher();\n  return dispatcher.useRef(initialValue);\n}\n\nexport function useEffect(\n  create,\n  inputs,\n) {\n  const dispatcher = resolveDispatcher();\n  return dispatcher.useEffect(create, inputs);\n}\n\nexport function useLayoutEffect(\n  create,\n  inputs,\n) {\n  const dispatcher = resolveDispatcher();\n  return dispatcher.useLayoutEffect(create, inputs);\n}\n\nexport function useCallback(\n  callback,\n  inputs,\n) {\n  const dispatcher = resolveDispatcher();\n  return dispatcher.useCallback(callback, inputs);\n}\n\nexport function useMemo(\n  create,\n  inputs,\n) {\n  const dispatcher = resolveDispatcher();\n  return dispatcher.useMemo(create, inputs);\n}\n\nexport function useImperativeHandle(\n  ref,\n  create,\n  inputs,\n) {\n  const dispatcher = resolveDispatcher();\n  return dispatcher.useImperativeHandle(ref, create, inputs);\n}\n"
  },
  {
    "path": "src/ReactSideEffectTags.js",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\n// Don't change these two values. They're used by React Dev Tools.\nexport const NoEffect = /*              */ 0b000000000000;\nexport const PerformedWork = /*         */ 0b000000000001;\n\n// You can change the rest (and add more).\nexport const Placement = /*             */ 0b000000000010;\nexport const Update = /*                */ 0b000000000100;\nexport const PlacementAndUpdate = /*    */ 0b000000000110;\nexport const Deletion = /*              */ 0b000000001000;\nexport const ContentReset = /*          */ 0b000000010000;\nexport const Callback = /*              */ 0b000000100000;\nexport const DidCapture = /*            */ 0b000001000000;\nexport const Ref = /*                   */ 0b000010000000;\nexport const Snapshot = /*              */ 0b000100000000;\nexport const Passive = /*               */ 0b001000000000;\n\n// Passive & Update & Callback & Ref & Snapshot\nexport const LifecycleEffectMask = /*   */ 0b001110100100;\n\n// Union of all host effects\nexport const HostEffectMask = /*        */ 0b001111111111;\n\nexport const Incomplete = /*            */ 0b010000000000;\nexport const ShouldCapture = /*         */ 0b100000000000;\n"
  },
  {
    "path": "src/__mocks__/scheduleCallback.js",
    "content": "let pendingWorks = [];\n\nconst scheduleCallback = callback => {\n  pendingWorks.push(callback);\n  return () => {\n    pendingWorks = pendingWorks.filter(cb => cb === callback);\n  };\n};\n\nscheduleCallback.flush = () => {\n  let work = pendingWorks.shift();\n  while (work !== undefined) {\n    work();\n    work = pendingWorks.shift();\n  }\n};\n\nexport default scheduleCallback;\n"
  },
  {
    "path": "src/index.js",
    "content": "import React from 'react';\nimport withHooks from './withHooks';\nimport * as hooks from './ReactHooks';\n\nconst useNative = !!React.useState;\n\nexport const useState = useNative ? React.useState : hooks.useState;\nexport const useEffect = useNative ? React.useEffect : hooks.useEffect;\nexport const useContext = useNative ? React.useContext : hooks.useContext;\nexport const useReducer = useNative ? React.useReducer : hooks.useReducer;\nexport const useCallback = useNative ? React.useCallback : hooks.useCallback;\nexport const useMemo = useNative ? React.useMemo : hooks.useMemo;\nexport const useRef = useNative ? React.useRef : hooks.useRef;\nexport const useImperativeHandle = useNative ? React.useImperativeHandle : hooks.useImperativeHandle;\nexport const useMutationEffect = useNative ? React.useMutationEffect : hooks.useMutationEffect;\nexport const useLayoutEffect = useNative ? React.useLayoutEffect : hooks.useLayoutEffect;\nexport default useNative ? (fn) => fn : withHooks;\n"
  },
  {
    "path": "src/objectIs.js",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\n/**\n * inlined Object.is polyfill to avoid requiring consumers ship their own\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is\n */\nfunction is(x, y) {\n  return (\n    (x === y && (x !== 0 || 1 / x === 1 / y)) || (x !== x && y !== y) // eslint-disable-line no-self-compare\n  );\n}\n\nexport default is;\n"
  },
  {
    "path": "src/polyfill.js",
    "content": "import React from 'react';\nimport * as ReactIs from 'react-is';\nimport withHooks from './withHooks';\nimport * as hooks from './ReactHooks';\n\nconst useNative = __DEV__ ? false : !!React.useState;\n\nconst nativeCreateElement = React.createElement;\n\nfunction shouldConstruct(Component) {\n  const prototype = Component.prototype;\n  return !!(prototype && prototype.isReactComponent);\n}\n\nfunction isSimpleFunctionComponent(type) {\n  return typeof type === 'function' && !shouldConstruct(type) && type.defaultProps === undefined;\n}\n\nfunction hasHooks(fn) {\n  return /\\buse[A-Z0-9]/.test(fn.toString());\n}\n\nconst createElementWithHooks = (() => {\n  const componentMap = new Map();\n  return (component, props, ...children) => {\n    if (componentMap.has(component)) {\n      return nativeCreateElement(componentMap.get(component), props, ...children);\n    }\n    const element = nativeCreateElement(component, props, ...children);\n    let wrappedComponent = component;\n    let render;\n    if (ReactIs.isForwardRef(element)) {\n      render = component.render;\n      wrappedComponent.render = withHooks(render);\n      componentMap.set(component, wrappedComponent);\n    }\n    if (ReactIs.isMemo(component)) {\n      render = component.type;\n      wrappedComponent.type = withHooks(render);\n      componentMap.set(component, wrappedComponent);\n    }\n    if (isSimpleFunctionComponent(component) && component.__react_with_hooks !== true) {\n      render = component;\n      wrappedComponent = withHooks(render);\n      componentMap.set(component, wrappedComponent);\n    }\n    if (!render || !hasHooks(render)) {\n      return element;\n    }\n    return nativeCreateElement(wrappedComponent, props, ...children);\n  };\n})();\n\nReact.createElement = useNative ? React.createElement : createElementWithHooks;\n\nif (!useNative) {\n  Object.keys(hooks).forEach(hook => {\n    React[hook] = hooks[hook];\n  });\n}\n"
  },
  {
    "path": "src/scheduleCallback.js",
    "content": "export default function scheduleCallback(callback) {\n  const timer = requestAnimationFrame(callback);\n  return () => {\n    cancelAnimationFrame(timer);\n  };\n}\n"
  },
  {
    "path": "src/withHooks.js",
    "content": "import React, { createElement } from 'react';\nimport invariant from 'invariant';\nimport ReactCurrentDispatcher from './ReactCurrentDispatcher';\nimport { Update as UpdateEffect, Passive as PassiveEffect } from './ReactSideEffectTags';\nimport {\n  NoEffect as NoHookEffect,\n  UnmountMutation,\n  MountLayout,\n  UnmountPassive,\n  MountPassive,\n  MountMutation,\n  UnmountLayout,\n} from './ReactHookEffectTags';\nimport is from './objectIs';\nimport scheduleCallback from './scheduleCallback';\n\nconst RE_RENDER_LIMIT = 25;\n\nlet firstCurrentHook = null;\nlet firstWorkInProgressHook = null;\nlet currentHook = null;\nlet nextCurrentHook = null;\nlet workInProgressHook = null;\nlet nextWorkInProgressHook = null;\nlet didScheduleRenderPhaseUpdate = false;\nlet currentInstance = null;\nlet renderPhaseUpdates = null;\nlet numberOfReRenders = 0;\nlet componentUpdateQueue = null;\nlet sideEffectTag = 0;\nlet componentContext = null;\nlet isRenderPhase = false;\nlet didReceiveUpdate = false;\nlet passiveHookEffects = [];\n\nfunction markWorkInProgressReceivedUpdate() {\n  didReceiveUpdate = true;\n}\n\nfunction basicStateReducer(state, action) {\n  return typeof action === 'function' ? action(state) : action;\n}\n\nfunction prepareToUseHooks(current) {\n  currentInstance = current;\n  firstCurrentHook = nextCurrentHook = current !== null ? current.memoizedState : null;\n}\n\nfunction resetHooks() {\n  currentInstance = null;\n  firstCurrentHook = null;\n  currentHook = null;\n  firstWorkInProgressHook = null;\n  workInProgressHook = null;\n  componentUpdateQueue = null;\n  componentContext = null;\n\n  didScheduleRenderPhaseUpdate = false;\n  renderPhaseUpdates = null;\n  numberOfReRenders = 0;\n  isRenderPhase = false;\n}\n\nfunction mountWorkInProgressHook() {\n  const hook = {\n    memoizedState: null,\n\n    baseState: null,\n    queue: null,\n    baseUpdate: null,\n\n    next: null,\n  };\n\n  if (workInProgressHook === null) {\n    // This is the first hook in the list\n    firstWorkInProgressHook = workInProgressHook = hook;\n  } else {\n    // Append to the end of the list\n    workInProgressHook = workInProgressHook.next = hook;\n  }\n  return workInProgressHook;\n}\n\nfunction updateWorkInProgressHook() {\n  // This function is used both for updates and for re-renders triggered by a\n  // render phase update. It assumes there is either a current hook we can\n  // clone, or a work-in-progress hook from a previous render pass that we can\n  // use as a base. When we reach the end of the base list, we must switch to\n  // the dispatcher used for mounts.\n  if (nextWorkInProgressHook !== null) {\n    // There's already a work-in-progress. Reuse it.\n    workInProgressHook = nextWorkInProgressHook;\n    nextWorkInProgressHook = workInProgressHook.next;\n\n    currentHook = nextCurrentHook;\n    nextCurrentHook = currentHook !== null ? currentHook.next : null;\n  } else {\n    // Clone from the current hook.\n    invariant(nextCurrentHook !== null, 'Rendered more hooks than during the previous render.');\n    currentHook = nextCurrentHook;\n\n    const newHook = {\n      memoizedState: currentHook.memoizedState,\n\n      baseState: currentHook.baseState,\n      queue: currentHook.queue,\n      baseUpdate: currentHook.baseUpdate,\n\n      next: null,\n    };\n\n    if (workInProgressHook === null) {\n      // This is the first hook in the list.\n      workInProgressHook = firstWorkInProgressHook = newHook;\n    } else {\n      // Append to the end of the list.\n      workInProgressHook = workInProgressHook.next = newHook;\n    }\n    nextCurrentHook = currentHook.next;\n  }\n  return workInProgressHook;\n}\n\nfunction createFunctionComponentUpdateQueue() {\n  return {\n    lastEffect: null,\n  };\n}\n\nfunction areHookInputsEqual(nextDeps, prevDeps) {\n  if (prevDeps === null) {\n    return false;\n  }\n\n  for (let i = 0; i < prevDeps.length && i < nextDeps.length; i++) {\n    if (is(nextDeps[i], prevDeps[i])) {\n      continue;\n    }\n    return false;\n  }\n  return true;\n}\n\nfunction mountState(initialState) {\n  const hook = mountWorkInProgressHook();\n  if (typeof initialState === 'function') {\n    initialState = initialState();\n  }\n  hook.memoizedState = hook.baseState = initialState;\n  const queue = (hook.queue = {\n    last: null,\n    dispatch: null,\n    eagerReducer: basicStateReducer,\n    eagerState: initialState,\n  });\n  const dispatch = (queue.dispatch = dispatchAction.bind(null, currentInstance, queue));\n  return [hook.memoizedState, dispatch];\n}\n\nfunction updateState(initialState) {\n  return updateReducer(basicStateReducer, initialState);\n}\n\nfunction pushEffect(tag, create, destroy, deps) {\n  const effect = {\n    tag,\n    create,\n    destroy,\n    deps,\n    // Circular\n    next: null,\n  };\n  if (componentUpdateQueue === null) {\n    componentUpdateQueue = createFunctionComponentUpdateQueue();\n    componentUpdateQueue.lastEffect = effect.next = effect;\n  } else {\n    const lastEffect = componentUpdateQueue.lastEffect;\n    if (lastEffect === null) {\n      componentUpdateQueue.lastEffect = effect.next = effect;\n    } else {\n      const firstEffect = lastEffect.next;\n      lastEffect.next = effect;\n      effect.next = firstEffect;\n      componentUpdateQueue.lastEffect = effect;\n    }\n  }\n  return effect;\n}\n\nfunction pushContext(context) {\n  const _context = {\n    Consumer: context.Consumer,\n    next: null,\n  };\n  if (componentContext === null) {\n    componentContext = _context;\n  } else {\n    componentContext.next = _context;\n  }\n  return _context;\n}\n\nfunction mountRef(initialValue) {\n  const hook = mountWorkInProgressHook();\n  const ref = { current: initialValue };\n  hook.memoizedState = ref;\n  return ref;\n}\n\nfunction updateRef() {\n  const hook = updateWorkInProgressHook();\n  return hook.memoizedState;\n}\n\nfunction mountEffectImpl(fiberEffectTag, hookEffectTag, create, deps) {\n  const hook = mountWorkInProgressHook();\n  const nextDeps = deps === undefined ? null : deps;\n  sideEffectTag |= fiberEffectTag;\n  hook.memoizedState = pushEffect(hookEffectTag, create, undefined, nextDeps);\n}\n\nfunction updateEffectImpl(fiberEffectTag, hookEffectTag, create, deps) {\n  const hook = updateWorkInProgressHook();\n  const nextDeps = deps === undefined ? null : deps;\n  let destroy = undefined;\n\n  if (currentHook !== null) {\n    const prevEffect = currentHook.memoizedState;\n    destroy = prevEffect.destroy;\n    if (nextDeps !== null) {\n      const prevDeps = prevEffect.deps;\n      if (areHookInputsEqual(nextDeps, prevDeps)) {\n        pushEffect(NoHookEffect, create, destroy, nextDeps);\n        return;\n      }\n    }\n  }\n\n  sideEffectTag |= fiberEffectTag;\n  hook.memoizedState = pushEffect(hookEffectTag, create, destroy, nextDeps);\n}\n\nfunction mountEffect(create, deps) {\n  return mountEffectImpl(UpdateEffect | PassiveEffect, UnmountPassive | MountPassive, create, deps);\n}\n\nfunction updateEffect(create, deps) {\n  return updateEffectImpl(UpdateEffect | PassiveEffect, UnmountPassive | MountPassive, create, deps);\n}\n\nfunction mountLayoutEffect(create, deps) {\n  return mountEffectImpl(UpdateEffect, UnmountMutation | MountLayout, create, deps);\n}\n\nfunction updateLayoutEffect(create, deps) {\n  return updateEffectImpl(UpdateEffect, UnmountMutation | MountLayout, create, deps);\n}\n\nfunction imperativeHandleEffect(create, ref) {\n  if (typeof ref === 'function') {\n    const refCallback = ref;\n    const inst = create();\n    refCallback(inst);\n    return () => {\n      refCallback(null);\n    };\n  } else if (ref !== null && ref !== undefined) {\n    const refObject = ref;\n    const inst = create();\n    refObject.current = inst;\n    return () => {\n      refObject.current = null;\n    };\n  }\n}\n\nfunction mountImperativeHandle(ref, create, deps) {\n  // TODO: If deps are provided, should we skip comparing the ref itself?\n  const effectDeps = deps !== null && deps !== undefined ? deps.concat([ref]) : [ref];\n\n  return mountEffectImpl(\n    UpdateEffect,\n    UnmountMutation | MountLayout,\n    imperativeHandleEffect.bind(null, create, ref),\n    effectDeps,\n  );\n}\n\nfunction updateImperativeHandle(ref, create, deps) {\n  // TODO: If deps are provided, should we skip comparing the ref itself?\n  const effectDeps = deps !== null && deps !== undefined ? deps.concat([ref]) : [ref];\n\n  return updateEffectImpl(\n    UpdateEffect,\n    UnmountMutation | MountLayout,\n    imperativeHandleEffect.bind(null, create, ref),\n    effectDeps,\n  );\n}\n\nfunction mountContext(Context) {\n  pushContext(Context);\n  return Context._currentValue;\n}\n\nfunction mountReducer(reducer, initialArg, init) {\n  const hook = mountWorkInProgressHook();\n  let initialState;\n  if (init !== undefined) {\n    initialState = init(initialArg);\n  } else {\n    initialState = initialArg;\n  }\n  hook.memoizedState = hook.baseState = initialState;\n  const queue = (hook.queue = {\n    last: null,\n    dispatch: null,\n    eagerReducer: reducer,\n    eagerState: initialState,\n  });\n  const dispatch = (queue.dispatch = dispatchAction.bind(\n    null,\n    // Flow doesn't know this is non-null, but we do.\n    currentInstance,\n    queue,\n  ));\n  return [hook.memoizedState, dispatch];\n}\n\nfunction updateReducer(reducer, initialArg, init) {\n  const hook = updateWorkInProgressHook();\n  const queue = hook.queue;\n  invariant(queue !== null, 'Should have a queue. This is likely a bug in React. Please file an issue.');\n\n  if (numberOfReRenders > 0) {\n    // This is a re-render. Apply the new render phase updates to the previous\n    // work-in-progress hook.\n    const dispatch = queue.dispatch;\n    if (renderPhaseUpdates !== null) {\n      // Render phase updates are stored in a map of queue -> linked list\n      const firstRenderPhaseUpdate = renderPhaseUpdates.get(queue);\n      if (firstRenderPhaseUpdate !== undefined) {\n        renderPhaseUpdates.delete(queue);\n        let newState = hook.memoizedState;\n        let update = firstRenderPhaseUpdate;\n        do {\n          // Process this render phase update. We don't have to check the\n          // priority because it will always be the same as the current\n          // render's.\n          const action = update.action;\n          newState = reducer(newState, action);\n          update = update.next;\n        } while (update !== null);\n\n        // Mark that the fiber performed work, but only if the new state is\n        // different from the current state.\n        if (!is(newState, hook.memoizedState)) {\n          markWorkInProgressReceivedUpdate();\n        }\n\n        hook.memoizedState = newState;\n\n        // Don't persist the state accumlated from the render phase updates to\n        // the base state unless the queue is empty.\n        // TODO: Not sure if this is the desired semantics, but it's what we\n        // do for gDSFP. I can't remember why.\n        if (hook.baseUpdate === queue.last) {\n          hook.baseState = newState;\n        }\n\n        return [newState, dispatch];\n      }\n    }\n    return [hook.memoizedState, dispatch];\n  }\n\n  // The last update in the entire queue\n  const last = queue.last;\n  // The last update that is part of the base state.\n  const baseUpdate = hook.baseUpdate;\n  const baseState = hook.baseState;\n\n  // Find the first unprocessed update.\n  let first;\n  if (baseUpdate !== null) {\n    if (last !== null) {\n      // For the first update, the queue is a circular linked list where\n      // `queue.last.next = queue.first`. Once the first update commits, and\n      // the `baseUpdate` is no longer empty, we can unravel the list.\n      last.next = null;\n    }\n    first = baseUpdate.next;\n  } else {\n    first = last !== null ? last.next : null;\n  }\n  if (first !== null) {\n    let newState = baseState;\n    let newBaseState = null;\n    let newBaseUpdate = null;\n    let prevUpdate = baseUpdate;\n    let update = first;\n    let didSkip = false;\n\n    do {\n      // Process this update.\n      if (update.eagerReducer === reducer) {\n        // If this update was processed eagerly, and its reducer matches the\n        // current reducer, we can use the eagerly computed state.\n        newState = update.eagerState;\n      } else {\n        const action = update.action;\n        newState = reducer(newState, action);\n      }\n      prevUpdate = update;\n      update = update.next;\n    } while (update !== null && update !== first);\n\n    if (!didSkip) {\n      newBaseUpdate = prevUpdate;\n      newBaseState = newState;\n    }\n\n    // Mark that the fiber performed work, but only if the new state is\n    // different from the current state.\n    if (!is(newState, hook.memoizedState)) {\n      markWorkInProgressReceivedUpdate();\n    }\n\n    hook.memoizedState = newState;\n    hook.baseUpdate = newBaseUpdate;\n    hook.baseState = newBaseState;\n\n    queue.eagerReducer = reducer;\n    queue.eagerState = newState;\n  }\n\n  const dispatch = queue.dispatch;\n  return [hook.memoizedState, dispatch];\n}\n\nfunction mountCallback(callback, deps) {\n  const hook = mountWorkInProgressHook();\n  const nextDeps = deps === undefined ? null : deps;\n  hook.memoizedState = [callback, nextDeps];\n  return callback;\n}\n\nfunction updateCallback(callback, deps) {\n  const hook = updateWorkInProgressHook();\n  const nextDeps = deps === undefined ? null : deps;\n  const prevState = hook.memoizedState;\n  if (prevState !== null) {\n    if (nextDeps !== null) {\n      const prevDeps = prevState[1];\n      if (areHookInputsEqual(nextDeps, prevDeps)) {\n        return prevState[0];\n      }\n    }\n  }\n  hook.memoizedState = [callback, nextDeps];\n  return callback;\n}\n\nfunction mountMemo(nextCreate, deps) {\n  const hook = mountWorkInProgressHook();\n  const nextDeps = deps === undefined ? null : deps;\n  const nextValue = nextCreate();\n  hook.memoizedState = [nextValue, nextDeps];\n  return nextValue;\n}\n\nfunction updateMemo(nextCreate, deps) {\n  const hook = updateWorkInProgressHook();\n  const nextDeps = deps === undefined ? null : deps;\n  const prevState = hook.memoizedState;\n  if (prevState !== null) {\n    // Assume these are defined. If they're not, areHookInputsEqual will warn.\n    if (nextDeps !== null) {\n      const prevDeps = prevState[1];\n      if (areHookInputsEqual(nextDeps, prevDeps)) {\n        return prevState[0];\n      }\n    }\n  }\n  const nextValue = nextCreate();\n  hook.memoizedState = [nextValue, nextDeps];\n  return nextValue;\n}\n\nfunction flushPassiveEffects() {\n  passiveHookEffects.forEach(effect => {\n    effect.cancel();\n    effect.callback();\n  });\n  passiveHookEffects = [];\n}\n\nfunction dispatchAction(instance, queue, action) {\n  invariant(\n    numberOfReRenders < RE_RENDER_LIMIT,\n    'Too many re-renders. React limits the number of renders to prevent ' + 'an infinite loop.',\n  );\n  if (isRenderPhase) {\n    // This is a render phase update. Stash it in a lazily-created map of\n    // queue -> linked list of updates. After this render pass, we'll restart\n    // and apply the stashed updates on top of the work-in-progress hook.\n    didScheduleRenderPhaseUpdate = true;\n    const update = {\n      action,\n      next: null,\n    };\n    if (renderPhaseUpdates === null) {\n      renderPhaseUpdates = new Map();\n    }\n    const firstRenderPhaseUpdate = renderPhaseUpdates.get(queue);\n    if (firstRenderPhaseUpdate === undefined) {\n      renderPhaseUpdates.set(queue, update);\n    } else {\n      // Append the update to the end of the list.\n      let lastRenderPhaseUpdate = firstRenderPhaseUpdate;\n      while (lastRenderPhaseUpdate.next !== null) {\n        lastRenderPhaseUpdate = lastRenderPhaseUpdate.next;\n      }\n      lastRenderPhaseUpdate.next = update;\n    }\n  } else {\n    flushPassiveEffects();\n\n    const update = {\n      action,\n      next: null,\n    };\n    // Append the update to the end of the list.\n    const last = queue.last;\n    if (last === null) {\n      // This is the first update. Create a circular list.\n      update.next = update;\n    } else {\n      const first = last.next;\n      if (first !== null) {\n        // Still circular.\n        update.next = first;\n      }\n      last.next = update;\n    }\n    queue.last = update;\n\n    // The queue is currently empty, which means we can eagerly compute the\n    // next state before entering the render phase. If the new state is the\n    // same as the current state, we may be able to bail out entirely.\n    // const eagerReducer = queue.eagerReducer;\n    // if (eagerReducer !== null) {\n    //   let prevDispatcher;\n    //   try {\n    //     const currentState = queue.eagerState;\n    //     const eagerState = eagerReducer(currentState, action);\n    //     // Stash the eagerly computed state, and the reducer used to compute\n    //     // it, on the update object. If the reducer hasn't changed by the\n    //     // time we enter the render phase, then the eager state can be used\n    //     // without calling the reducer again.\n    //     update.eagerReducer = eagerReducer;\n    //     update.eagerState = eagerState;\n    //     if (is(eagerState, currentState)) {\n    //       // Fast path. We can bail out without scheduling React to re-render.\n    //       // It's still possible that we'll need to rebase this update later,\n    //       // if the component re-renders for a different reason and by that\n    //       // time the reducer has changed.\n    //       return;\n    //     }\n    //   } catch (error) {\n    //     // Suppress the error. It will throw again in the render phase.\n    //   }\n    // }\n\n    instance.setState({});\n  }\n}\n\nconst HooksDispatcherOnMount = {\n  useCallback: mountCallback,\n  useContext: mountContext,\n  useEffect: mountEffect,\n  useImperativeHandle: mountImperativeHandle,\n  useLayoutEffect: mountLayoutEffect,\n  useMemo: mountMemo,\n  useReducer: mountReducer,\n  useRef: mountRef,\n  useState: mountState,\n};\n\nconst HooksDispatcherOnUpdate = {\n  useCallback: updateCallback,\n  useContext: mountContext,\n  useEffect: updateEffect,\n  useImperativeHandle: updateImperativeHandle,\n  useLayoutEffect: updateLayoutEffect,\n  useMemo: updateMemo,\n  useReducer: updateReducer,\n  useRef: updateRef,\n  useState: updateState,\n};\n\nexport default function withHooks(render) {\n  class WithHooks extends React.Component {\n    memoizedState = null;\n    passiveHookEffect = null;\n\n    componentDidMount() {\n      // useLayoutEffect\n      this.commitHookEffectList(UnmountMutation, MountMutation);\n      this.commitHookEffectList(UnmountLayout, MountLayout);\n\n      // useEffect\n      this.createPassiveHookEffect();\n      this.mounted = true;\n    }\n\n    componentDidUpdate() {\n      // useLayoutEffect\n      this.commitHookEffectList(UnmountMutation, MountMutation);\n      this.commitHookEffectList(UnmountLayout, MountLayout);\n\n      // useEffect\n      this.createPassiveHookEffect();\n    }\n\n    componentWillUnmount() {\n      this.callDestroy();\n    }\n\n    createPassiveHookEffect() {\n      const callback = this.commitPassiveHookEffects.bind(this);\n      const cancel = scheduleCallback(callback);\n      this.passiveHookEffect = {\n        callback,\n        cancel,\n      };\n      passiveHookEffects.push(this.passiveHookEffect);\n    }\n\n    commitPassiveHookEffects() {\n      if (this.passiveHookEffect === null) {\n        return;\n      }\n      passiveHookEffects = passiveHookEffects.filter(effect => effect !== this.passiveHookEffect);\n      this.passiveHookEffect = null;\n      this.commitHookEffectList(UnmountPassive, NoHookEffect);\n      this.commitHookEffectList(NoHookEffect, MountPassive);\n    }\n\n    commitHookEffectList(unmountTag, mountTag) {\n      let lastEffect = this.updateQueue !== null ? this.updateQueue.lastEffect : null;\n      if (lastEffect !== null) {\n        const firstEffect = lastEffect.next;\n        let effect = firstEffect;\n        do {\n          if ((effect.tag & unmountTag) !== NoHookEffect) {\n            // Unmount\n            const destroy = effect.destroy;\n            effect.destroy = undefined;\n            if (destroy !== undefined) {\n              destroy();\n            }\n          }\n          effect = effect.next;\n        } while (effect !== firstEffect);\n\n        effect = firstEffect;\n        do {\n          if ((effect.tag & mountTag) !== NoHookEffect) {\n            // Mount\n            const create = effect.create;\n            const destroy = create();\n            effect.destroy = typeof destroy === 'function' ? destroy : undefined;\n          }\n          effect = effect.next;\n        } while (effect !== firstEffect);\n      }\n    }\n\n    callDestroy() {\n      const updateQueue = this.updateQueue;\n\n      if (updateQueue !== null) {\n        var lastEffect = updateQueue.lastEffect;\n\n        if (lastEffect !== null) {\n          var firstEffect = lastEffect.next;\n          var effect = firstEffect;\n\n          do {\n            var destroy = effect.destroy;\n\n            if (destroy !== undefined) {\n              destroy();\n            }\n\n            effect = effect.next;\n          } while (effect !== firstEffect);\n        }\n      }\n    }\n\n    applyContext(render, context, children) {\n      if (!children) {\n        children = render();\n      }\n      context = context || componentContext;\n      if (context !== null) {\n        return createElement(context.Consumer, {}, () => {\n          if (this.mounted) {\n            children = render();\n          }\n          return context.next === null ? children : this.applyContext(render, context.next, children);\n        });\n      }\n      return children;\n    }\n\n    render() {\n      resetHooks();\n      prepareToUseHooks(this);\n\n      ReactCurrentDispatcher.current = nextCurrentHook === null ? HooksDispatcherOnMount : HooksDispatcherOnUpdate;\n\n      const { _forwardedRef, ...rest } = this.props;\n\n      isRenderPhase = true;\n\n      let children = this.applyContext(() => render(rest, _forwardedRef));\n\n      if (didScheduleRenderPhaseUpdate) {\n        do {\n          didScheduleRenderPhaseUpdate = false;\n          numberOfReRenders += 1;\n\n          // Start over from the beginning of the list\n          firstCurrentHook = nextCurrentHook = this.memoizedState;\n          nextWorkInProgressHook = firstWorkInProgressHook;\n\n          currentHook = null;\n          workInProgressHook = null;\n          componentUpdateQueue = null;\n\n          ReactCurrentDispatcher.current = HooksDispatcherOnUpdate;\n\n          children = render(this.props, _forwardedRef);\n        } while (didScheduleRenderPhaseUpdate);\n\n        renderPhaseUpdates = null;\n        numberOfReRenders = 0;\n      }\n\n      this.memoizedState = firstWorkInProgressHook;\n      this.updateQueue = componentUpdateQueue;\n      this.effectTag |= sideEffectTag;\n\n      const didRenderTooFewHooks = currentHook !== null && currentHook.next !== null;\n\n      currentInstance = null;\n\n      firstCurrentHook = null;\n      currentHook = null;\n      nextCurrentHook = null;\n      firstWorkInProgressHook = null;\n      workInProgressHook = null;\n      nextWorkInProgressHook = null;\n\n      componentUpdateQueue = null;\n      sideEffectTag = 0;\n      isRenderPhase = false;\n\n      // These were reset above\n      // didScheduleRenderPhaseUpdate = false;\n      // renderPhaseUpdates = null;\n      // numberOfReRenders = 0;\n\n      invariant(\n        !didRenderTooFewHooks,\n        'Rendered fewer hooks than expected. This may be caused by an accidental ' + 'early return statement.',\n      );\n\n      return children;\n    }\n  }\n  WithHooks.displayName = render.displayName || render.name;\n  const wrap = (props, ref) => <WithHooks {...props} _forwardedRef={ref} />;\n  wrap.__react_with_hooks = true;\n  wrap.displayName = `WithHooks(${WithHooks.displayName})`;\n  return wrap;\n}\n"
  },
  {
    "path": "tests/ReactHooksWithNoopRenderer.test.js",
    "content": "\njest.mock('../src/scheduleCallback');\n\nlet React;\nlet ReactNoop;\nlet scheduleCallback;\nlet useState;\nlet useReducer;\nlet useEffect;\nlet useLayoutEffect;\nlet useCallback;\nlet useMemo;\nlet useRef;\nlet useContext;\nlet useImperativeHandle;\nlet forwardRef;\nlet createContext;\nlet memo;\nlet act;\n\ndescribe('hooks', () => {\n  function span(prop) {\n    return { type: 'span', hidden: false, children: [], prop };\n  }\n\n  function Text(props) {\n    ReactNoop.yield(props.text);\n    return <span prop={props.text} />;\n  }\n\n  beforeEach(() => {\n    jest.resetModules();\n\n    require('../src/polyfill');\n    React = require('react');\n    ReactNoop = require('../vendors/react-noop-renderer');\n    scheduleCallback = require('../src/scheduleCallback').default;\n    const nativeFlushPassiveEffects = ReactNoop.flushPassiveEffects;\n    ReactNoop.flushPassiveEffects = () => {\n      scheduleCallback.flush();\n      return nativeFlushPassiveEffects();\n    };\n    useState = React.useState;\n    useReducer = React.useReducer;\n    useEffect = React.useEffect;\n    useLayoutEffect = React.useLayoutEffect;\n    useCallback = React.useCallback;\n    useMemo = React.useMemo;\n    useRef = React.useRef;\n    useContext = React.useContext;\n    useImperativeHandle = React.useImperativeHandle;\n    forwardRef = React.forwardRef;\n    createContext = React.createContext;\n    memo = React.memo;\n    act = ReactNoop.act;\n  });\n\n  describe('useState', () => {\n    it('simple mount and update', () => {\n      function Counter(props, ref) {\n        const [count, updateCount] = useState(0);\n        useImperativeHandle(ref, () => ({ updateCount }));\n        return <Text text={'Count: ' + count} />;\n      }\n      Counter = forwardRef(Counter);\n      const counter = React.createRef(null);\n      ReactNoop.render(<Counter ref={counter} />);\n      ReactNoop.flush();\n      expect(ReactNoop.getChildren()).toEqual([span('Count: 0')]);\n\n      act(() => counter.current.updateCount(1));\n      ReactNoop.flush();\n      expect(ReactNoop.getChildren()).toEqual([span('Count: 1')]);\n\n      act(() => counter.current.updateCount(count => count + 10));\n      ReactNoop.flush();\n      expect(ReactNoop.getChildren()).toEqual([span('Count: 11')]);\n    });\n\n    it('lazy state initializer', () => {\n      function Counter(props, ref) {\n        const [count, updateCount] = useState(() => {\n          ReactNoop.yield('getInitialState');\n          return props.initialState;\n        });\n        useImperativeHandle(ref, () => ({ updateCount }));\n        return <Text text={'Count: ' + count} />;\n      }\n      Counter = forwardRef(Counter);\n      const counter = React.createRef(null);\n      ReactNoop.render(<Counter initialState={42} ref={counter} />);\n      expect(ReactNoop.flush()).toEqual(['getInitialState', 'Count: 42']);\n      expect(ReactNoop.getChildren()).toEqual([span('Count: 42')]);\n\n      act(() => counter.current.updateCount(7));\n      expect(ReactNoop.flush()).toEqual(['Count: 7']);\n      expect(ReactNoop.getChildren()).toEqual([span('Count: 7')]);\n    });\n\n    it('multiple states', () => {\n      function Counter(props, ref) {\n        const [count, updateCount] = useState(0);\n        const [label, updateLabel] = useState('Count');\n        useImperativeHandle(ref, () => ({ updateCount, updateLabel }));\n        return <Text text={label + ': ' + count} />;\n      }\n      Counter = forwardRef(Counter);\n      const counter = React.createRef(null);\n      ReactNoop.render(<Counter ref={counter} />);\n      ReactNoop.flush();\n      expect(ReactNoop.getChildren()).toEqual([span('Count: 0')]);\n\n      act(() => counter.current.updateCount(7));\n      expect(ReactNoop.flush()).toEqual(['Count: 7']);\n\n      act(() => counter.current.updateLabel('Total'));\n      expect(ReactNoop.flush()).toEqual(['Total: 7']);\n    });\n\n    it('returns the same updater function every time', () => {\n      let updaters = [];\n      function Counter() {\n        const [count, updateCount] = useState(0);\n        updaters.push(updateCount);\n        return <Text text={'Count: ' + count} />;\n      }\n      ReactNoop.render(<Counter />);\n      ReactNoop.flush();\n      expect(ReactNoop.getChildren()).toEqual([span('Count: 0')]);\n\n      act(() => updaters[0](1));\n      ReactNoop.flush();\n      expect(ReactNoop.getChildren()).toEqual([span('Count: 1')]);\n\n      act(() => updaters[0](count => count + 10));\n      ReactNoop.flush();\n      expect(ReactNoop.getChildren()).toEqual([span('Count: 11')]);\n\n      expect(updaters).toEqual([updaters[0], updaters[0], updaters[0]]);\n    });\n\n    it('warns on set after unmount', () => {\n      let _updateCount;\n      function Counter(props, ref) {\n        const [, updateCount] = useState(0);\n        _updateCount = updateCount;\n        return null;\n      }\n\n      ReactNoop.render(<Counter />);\n      ReactNoop.flush();\n      ReactNoop.render(null);\n      ReactNoop.flush();\n      expect(() => act(() => _updateCount(1))).toWarnDev(\n        \"Warning: Can't perform a React state update on an unmounted \" +\n          'component. This is a no-op, but it indicates a memory leak in your ' +\n          'application. To fix, cancel all subscriptions and asynchronous ' +\n          'tasks in the componentWillUnmount method.\\n' +\n          '    in Counter (created by WithHooks(Counter))\\n' +\n          '    in WithHooks(Counter)',\n      );\n    });\n\n    it('works with memo', () => {\n      let _updateCount;\n      function Counter(props) {\n        const [count, updateCount] = useState(0);\n        _updateCount = updateCount;\n        return <Text text={'Count: ' + count} />;\n      }\n      Counter = memo(Counter);\n\n      ReactNoop.render(<Counter />);\n      expect(ReactNoop.flush()).toEqual(['Count: 0']);\n      expect(ReactNoop.getChildren()).toEqual([span('Count: 0')]);\n\n      ReactNoop.render(<Counter />);\n      expect(ReactNoop.flush()).toEqual([]);\n      expect(ReactNoop.getChildren()).toEqual([span('Count: 0')]);\n\n      act(() => _updateCount(1));\n      expect(ReactNoop.flush()).toEqual(['Count: 1']);\n      expect(ReactNoop.getChildren()).toEqual([span('Count: 1')]);\n    });\n  });\n\n  describe('updates during the render phase', () => {\n    it('restarts the render function and applies the new updates on top', () => {\n      function ScrollView({ row: newRow }) {\n        let [isScrollingDown, setIsScrollingDown] = useState(false);\n        let [row, setRow] = useState(null);\n\n        if (row !== newRow) {\n          // Row changed since last render. Update isScrollingDown.\n          setIsScrollingDown(row !== null && newRow > row);\n          setRow(newRow);\n        }\n\n        return <Text text={`Scrolling down: ${isScrollingDown}`} />;\n      }\n\n      ReactNoop.render(<ScrollView row={1} />);\n      ReactNoop.flush();\n      expect(ReactNoop.getChildren()).toEqual([span('Scrolling down: false')]);\n\n      ReactNoop.render(<ScrollView row={5} />);\n      ReactNoop.flush();\n      expect(ReactNoop.getChildren()).toEqual([span('Scrolling down: true')]);\n\n      ReactNoop.render(<ScrollView row={5} />);\n      ReactNoop.flush();\n      expect(ReactNoop.getChildren()).toEqual([span('Scrolling down: true')]);\n\n      ReactNoop.render(<ScrollView row={10} />);\n      ReactNoop.flush();\n      expect(ReactNoop.getChildren()).toEqual([span('Scrolling down: true')]);\n\n      ReactNoop.render(<ScrollView row={2} />);\n      ReactNoop.flush();\n      expect(ReactNoop.getChildren()).toEqual([span('Scrolling down: false')]);\n\n      ReactNoop.render(<ScrollView row={2} />);\n      ReactNoop.flush();\n      expect(ReactNoop.getChildren()).toEqual([span('Scrolling down: false')]);\n    });\n\n    it('keeps restarting until there are no more new updates', () => {\n      function Counter({ row: newRow }) {\n        let [count, setCount] = useState(0);\n        if (count < 3) {\n          setCount(count + 1);\n        }\n        ReactNoop.yield('Render: ' + count);\n        return <Text text={count} />;\n      }\n\n      ReactNoop.render(<Counter />);\n      expect(ReactNoop.flush()).toEqual(['Render: 0', 'Render: 1', 'Render: 2', 'Render: 3', 3]);\n      expect(ReactNoop.getChildren()).toEqual([span(3)]);\n    });\n\n    it('updates multiple times within same render function', () => {\n      function Counter({ row: newRow }) {\n        let [count, setCount] = useState(0);\n        if (count < 12) {\n          setCount(c => c + 1);\n          setCount(c => c + 1);\n          setCount(c => c + 1);\n        }\n        ReactNoop.yield('Render: ' + count);\n        return <Text text={count} />;\n      }\n\n      ReactNoop.render(<Counter />);\n      expect(ReactNoop.flush()).toEqual([\n        // Should increase by three each time\n        'Render: 0',\n        'Render: 3',\n        'Render: 6',\n        'Render: 9',\n        'Render: 12',\n        12,\n      ]);\n      expect(ReactNoop.getChildren()).toEqual([span(12)]);\n    });\n\n    it('throws after too many iterations', () => {\n      function Counter({ row: newRow }) {\n        let [count, setCount] = useState(0);\n        setCount(count + 1);\n        ReactNoop.yield('Render: ' + count);\n        return <Text text={count} />;\n      }\n      ReactNoop.render(<Counter />);\n      expect(() => ReactNoop.flush()).toThrow(\n        'Too many re-renders. React limits the number of renders to prevent ' + 'an infinite loop.',\n      );\n    });\n\n    it('works with useReducer', () => {\n      function reducer(state, action) {\n        return action === 'increment' ? state + 1 : state;\n      }\n      function Counter({ row: newRow }) {\n        let [count, dispatch] = useReducer(reducer, 0);\n        if (count < 3) {\n          dispatch('increment');\n        }\n        ReactNoop.yield('Render: ' + count);\n        return <Text text={count} />;\n      }\n\n      ReactNoop.render(<Counter />);\n      expect(ReactNoop.flush()).toEqual(['Render: 0', 'Render: 1', 'Render: 2', 'Render: 3', 3]);\n      expect(ReactNoop.getChildren()).toEqual([span(3)]);\n    });\n\n    it('uses reducer passed at time of render, not time of dispatch', () => {\n      // This test is a bit contrived but it demonstrates a subtle edge case.\n\n      // Reducer A increments by 1. Reducer B increments by 10.\n      function reducerA(state, action) {\n        switch (action) {\n          case 'increment':\n            return state + 1;\n          case 'reset':\n            return 0;\n        }\n      }\n      function reducerB(state, action) {\n        switch (action) {\n          case 'increment':\n            return state + 10;\n          case 'reset':\n            return 0;\n        }\n      }\n\n      function Counter({ row: newRow }, ref) {\n        let [reducer, setReducer] = useState(() => reducerA);\n        let [count, dispatch] = useReducer(reducer, 0);\n        useImperativeHandle(ref, () => ({ dispatch }));\n        if (count < 20) {\n          dispatch('increment');\n          // Swap reducers each time we increment\n          if (reducer === reducerA) {\n            setReducer(() => reducerB);\n          } else {\n            setReducer(() => reducerA);\n          }\n        }\n        ReactNoop.yield('Render: ' + count);\n        return <Text text={count} />;\n      }\n      Counter = forwardRef(Counter);\n      const counter = React.createRef(null);\n      ReactNoop.render(<Counter ref={counter} />);\n      expect(ReactNoop.flush()).toEqual([\n        // The count should increase by alternating amounts of 10 and 1\n        // until we reach 21.\n        'Render: 0',\n        'Render: 10',\n        'Render: 11',\n        'Render: 21',\n        21,\n      ]);\n      expect(ReactNoop.getChildren()).toEqual([span(21)]);\n\n      // Test that it works on update, too. This time the log is a bit different\n      // because we started with reducerB instead of reducerA.\n      counter.current.dispatch('reset');\n      ReactNoop.render(<Counter ref={counter} />);\n      expect(ReactNoop.flush()).toEqual(['Render: 0', 'Render: 1', 'Render: 11', 'Render: 12', 'Render: 22', 22]);\n      expect(ReactNoop.getChildren()).toEqual([span(22)]);\n    });\n  });\n\n  describe('useReducer', () => {\n    it('simple mount and update', () => {\n      const INCREMENT = 'INCREMENT';\n      const DECREMENT = 'DECREMENT';\n\n      function reducer(state, action) {\n        switch (action) {\n          case 'INCREMENT':\n            return state + 1;\n          case 'DECREMENT':\n            return state - 1;\n          default:\n            return state;\n        }\n      }\n\n      function Counter(props, ref) {\n        const [count, dispatch] = useReducer(reducer, 0);\n        useImperativeHandle(ref, () => ({dispatch}));\n        return <Text text={'Count: ' + count} />;\n      }\n      Counter = forwardRef(Counter);\n      const counter = React.createRef(null);\n      ReactNoop.render(<Counter ref={counter} />);\n      ReactNoop.flush();\n      expect(ReactNoop.getChildren()).toEqual([span('Count: 0')]);\n\n      act(() => counter.current.dispatch(INCREMENT));\n      ReactNoop.flush();\n      expect(ReactNoop.getChildren()).toEqual([span('Count: 1')]);\n\n      act(() => {\n        counter.current.dispatch(DECREMENT);\n        counter.current.dispatch(DECREMENT);\n        counter.current.dispatch(DECREMENT);\n      });\n\n      ReactNoop.flush();\n      expect(ReactNoop.getChildren()).toEqual([span('Count: -2')]);\n    });\n\n    it('lazy init', () => {\n      const INCREMENT = 'INCREMENT';\n      const DECREMENT = 'DECREMENT';\n\n      function reducer(state, action) {\n        switch (action) {\n          case 'INCREMENT':\n            return state + 1;\n          case 'DECREMENT':\n            return state - 1;\n          default:\n            return state;\n        }\n      }\n\n      function Counter(props, ref) {\n        const [count, dispatch] = useReducer(reducer, props, p => {\n          ReactNoop.yield('Init');\n          return p.initialCount;\n        });\n        useImperativeHandle(ref, () => ({dispatch}));\n        return <Text text={'Count: ' + count} />;\n      }\n      Counter = forwardRef(Counter);\n      const counter = React.createRef(null);\n      ReactNoop.render(<Counter initialCount={10} ref={counter} />);\n      expect(ReactNoop.flush()).toEqual(['Init', 'Count: 10']);\n      expect(ReactNoop.getChildren()).toEqual([span('Count: 10')]);\n\n      act(() => counter.current.dispatch(INCREMENT));\n      expect(ReactNoop.flush()).toEqual(['Count: 11']);\n      expect(ReactNoop.getChildren()).toEqual([span('Count: 11')]);\n\n      act(() => {\n        counter.current.dispatch(DECREMENT);\n        counter.current.dispatch(DECREMENT);\n        counter.current.dispatch(DECREMENT);\n      });\n\n      expect(ReactNoop.flush()).toEqual(['Count: 8']);\n      expect(ReactNoop.getChildren()).toEqual([span('Count: 8')]);\n    });\n\n    // Regression test for https://github.com/facebook/react/issues/14360\n    it.skip('handles dispatches with mixed priorities', () => {\n      const INCREMENT = 'INCREMENT';\n\n      function reducer(state, action) {\n        return action === INCREMENT ? state + 1 : state;\n      }\n\n      function Counter(props, ref) {\n        const [count, dispatch] = useReducer(reducer, 0);\n        useImperativeHandle(ref, () => ({dispatch}));\n        return <Text text={'Count: ' + count} />;\n      }\n\n      Counter = forwardRef(Counter);\n      const counter = React.createRef(null);\n      ReactNoop.render(<Counter ref={counter} />);\n\n      ReactNoop.flush();\n      expect(ReactNoop.getChildren()).toEqual([span('Count: 0')]);\n\n      act(() => {\n        counter.current.dispatch(INCREMENT);\n        counter.current.dispatch(INCREMENT);\n        counter.current.dispatch(INCREMENT);\n      });\n\n      ReactNoop.flushSync(() => {\n        counter.current.dispatch(INCREMENT);\n      });\n      expect(ReactNoop.getChildren()).toEqual([span('Count: 1')]);\n\n      ReactNoop.flush();\n      expect(ReactNoop.getChildren()).toEqual([span('Count: 4')]);\n    });\n  });\n\n  describe('useEffect', () => {\n    it('simple mount and update', () => {\n      function Counter(props) {\n        useEffect(() => {\n          ReactNoop.yield(`Did commit [${props.count}]`);\n        });\n        return <Text text={'Count: ' + props.count} />;\n      }\n      ReactNoop.render(<Counter count={0} />);\n      expect(ReactNoop.flush()).toEqual(['Count: 0']);\n      expect(ReactNoop.getChildren()).toEqual([span('Count: 0')]);\n      ReactNoop.flushPassiveEffects();\n      expect(ReactNoop.clearYields()).toEqual(['Did commit [0]']);\n\n      ReactNoop.render(<Counter count={1} />);\n      expect(ReactNoop.flush()).toEqual(['Count: 1']);\n      expect(ReactNoop.getChildren()).toEqual([span('Count: 1')]);\n      // Effects are deferred until after the commit\n      ReactNoop.flushPassiveEffects();\n      expect(ReactNoop.clearYields()).toEqual(['Did commit [1]']);\n    });\n\n    // tested in react-dom\n    it.skip('flushes passive effects even with sibling deletions', () => {\n      function LayoutEffect(props) {\n        useLayoutEffect(() => {\n          ReactNoop.yield(`Layout effect`);\n        });\n        return <Text text=\"Layout\" />;\n      }\n      function PassiveEffect(props) {\n        useEffect(() => {\n          ReactNoop.yield(`Passive effect`);\n        }, []);\n        return <Text text=\"Passive\" />;\n      }\n      let passive = <PassiveEffect key=\"p\" />;\n      ReactNoop.render([<LayoutEffect key=\"l\" />, passive]);\n      expect(ReactNoop.flush()).toEqual(['Layout', 'Passive', 'Layout effect']);\n      expect(ReactNoop.getChildren()).toEqual([span('Layout'), span('Passive')]);\n\n      // Destroying the first child shouldn't prevent the passive effect from\n      // being executed\n      ReactNoop.render([passive]);\n      expect(ReactNoop.flush()).toEqual(['Passive effect']);\n      expect(ReactNoop.getChildren()).toEqual([span('Passive')]);\n\n      // (No effects are left to flush.)\n      ReactNoop.flushPassiveEffects();\n      expect(ReactNoop.clearYields()).toEqual(null);\n    });\n\n    it.skip('flushes passive effects even if siblings schedule an update', () => {\n      function PassiveEffect(props) {\n        useEffect(() => {\n          ReactNoop.yield('Passive effect');\n        });\n        return <Text text=\"Passive\" />;\n      }\n      function LayoutEffect(props) {\n        let [count, setCount] = useState(0);\n        useLayoutEffect(() => {\n          // Scheduling work shouldn't interfere with the queued passive effect\n          if (count === 0) {\n            setCount(1);\n          }\n          ReactNoop.yield('Layout effect ' + count);\n        });\n        return <Text text=\"Layout\" />;\n      }\n\n      ReactNoop.render([<PassiveEffect key=\"p\" />, <LayoutEffect key=\"l\" />]);\n\n      act(() => {\n        expect(ReactNoop.flush()).toEqual([\n          'Passive',\n          'Layout',\n          'Layout effect 0',\n          'Passive effect',\n          'Layout',\n          'Layout effect 1',\n        ]);\n      });\n\n      expect(ReactNoop.getChildren()).toEqual([span('Passive'), span('Layout')]);\n    });\n\n    it.skip('flushes passive effects even if siblings schedule a new root', () => {\n      function PassiveEffect(props) {\n        useEffect(() => {\n          ReactNoop.yield('Passive effect');\n        }, []);\n        return <Text text=\"Passive\" />;\n      }\n      function LayoutEffect(props) {\n        useLayoutEffect(() => {\n          ReactNoop.yield('Layout effect');\n          // Scheduling work shouldn't interfere with the queued passive effect\n          ReactNoop.renderToRootWithID(<Text text=\"New Root\" />, 'root2');\n        });\n        return <Text text=\"Layout\" />;\n      }\n      ReactNoop.render([<PassiveEffect key=\"p\" />, <LayoutEffect key=\"l\" />]);\n      expect(ReactNoop.flush()).toEqual(['Passive', 'Layout', 'Layout effect', 'Passive effect', 'New Root']);\n      expect(ReactNoop.getChildren()).toEqual([span('Passive'), span('Layout')]);\n    });\n\n    it(\n      'flushes effects serially by flushing old effects before flushing ' + \"new ones, if they haven't already fired\",\n      () => {\n        function getCommittedText() {\n          const children = ReactNoop.getChildren();\n          if (children === null) {\n            return null;\n          }\n          return children[0].prop;\n        }\n\n        function Counter(props) {\n          useEffect(() => {\n            ReactNoop.yield(`Committed state when effect was fired: ${getCommittedText()}`);\n          });\n          return <Text text={props.count} />;\n        }\n        ReactNoop.render(<Counter count={0} />);\n        expect(ReactNoop.flush()).toEqual([0]);\n        expect(ReactNoop.getChildren()).toEqual([span(0)]);\n\n        // Before the effects have a chance to flush, schedule another update\n        ReactNoop.render(<Counter count={1} />);\n        expect(ReactNoop.flush()).toEqual([\n          // The previous effect flushes before the reconciliation\n          'Committed state when effect was fired: 0',\n          1,\n        ]);\n        expect(ReactNoop.getChildren()).toEqual([span(1)]);\n\n        ReactNoop.flushPassiveEffects();\n        expect(ReactNoop.clearYields()).toEqual(['Committed state when effect was fired: 1']);\n      },\n    );\n\n    it('updates have async priority', () => {\n      function Counter(props) {\n        const [count, updateCount] = useState('(empty)');\n        useEffect(() => {\n          ReactNoop.yield(`Schedule update [${props.count}]`);\n          updateCount(props.count);\n        }, [props.count]);\n        return <Text text={'Count: ' + count} />;\n      }\n      ReactNoop.render(<Counter count={0} />);\n      expect(ReactNoop.flush()).toEqual(['Count: (empty)']);\n      expect(ReactNoop.getChildren()).toEqual([span('Count: (empty)')]);\n      ReactNoop.flushPassiveEffects();\n      expect(ReactNoop.clearYields()).toEqual(['Schedule update [0]']);\n      expect(ReactNoop.flush()).toEqual(['Count: 0']);\n\n      ReactNoop.render(<Counter count={1} />);\n      expect(ReactNoop.flush()).toEqual(['Count: 0']);\n      expect(ReactNoop.getChildren()).toEqual([span('Count: 0')]);\n      ReactNoop.flushPassiveEffects();\n      expect(ReactNoop.clearYields()).toEqual(['Schedule update [1]']);\n      expect(ReactNoop.flush()).toEqual(['Count: 1']);\n    });\n\n    it.skip('updates have async priority even if effects are flushed early', () => {\n      function Counter(props) {\n        const [count, updateCount] = useState('(empty)');\n        useEffect(() => {\n          ReactNoop.yield(`Schedule update [${props.count}]`);\n          updateCount(props.count);\n        }, [props.count]);\n        return <Text text={'Count: ' + count} />;\n      }\n      ReactNoop.render(<Counter count={0} />);\n      expect(ReactNoop.flush()).toEqual(['Count: (empty)']);\n      expect(ReactNoop.getChildren()).toEqual([span('Count: (empty)')]);\n\n      // Rendering again should flush the previous commit's effects\n      ReactNoop.render(<Counter count={1} />);\n      ReactNoop.flushThrough(['Schedule update [0]', 'Count: 0']);\n      expect(ReactNoop.getChildren()).toEqual([span('Count: (empty)')]);\n\n      ReactNoop.batchedUpdates(() => {\n        expect(ReactNoop.flush()).toEqual([]);\n      });\n\n      expect(ReactNoop.getChildren()).toEqual([span('Count: 0')]);\n\n      ReactNoop.flushPassiveEffects();\n      expect(ReactNoop.flush()).toEqual(['Schedule update [1]', 'Count: 1']);\n      expect(ReactNoop.getChildren()).toEqual([span('Count: 1')]);\n    });\n\n    it.skip('flushes serial effects before enqueueing work', () => {\n      let _updateCount;\n      function Counter(props) {\n        const [count, updateCount] = useState(0);\n        _updateCount = updateCount;\n        useEffect(() => {\n          ReactNoop.yield(`Will set count to 1`);\n          updateCount(1);\n        }, []);\n        return <Text text={'Count: ' + count} />;\n      }\n\n      ReactNoop.render(<Counter count={0} />);\n      expect(ReactNoop.flush()).toEqual(['Count: 0']);\n      expect(ReactNoop.getChildren()).toEqual([span('Count: 0')]);\n\n      // Enqueuing this update forces the passive effect to be flushed --\n      // updateCount(1) happens first, so 2 wins.\n      act(() => _updateCount(2));\n      expect(ReactNoop.flush()).toEqual(['Will set count to 1', 'Count: 2']);\n      expect(ReactNoop.getChildren()).toEqual([span('Count: 2')]);\n    });\n\n    it.skip('flushes serial effects before enqueueing work (with tracing)', () => {\n      const onInteractionScheduledWorkCompleted = jest.fn();\n      const onWorkCanceled = jest.fn();\n      SchedulerTracing.unstable_subscribe({\n        onInteractionScheduledWorkCompleted,\n        onInteractionTraced: jest.fn(),\n        onWorkCanceled,\n        onWorkScheduled: jest.fn(),\n        onWorkStarted: jest.fn(),\n        onWorkStopped: jest.fn(),\n      });\n\n      let _updateCount;\n      function Counter(props) {\n        const [count, updateCount] = useState(0);\n        _updateCount = updateCount;\n        useEffect(() => {\n          expect(SchedulerTracing.unstable_getCurrent()).toMatchInteractions([tracingEvent]);\n          ReactNoop.yield(`Will set count to 1`);\n          updateCount(1);\n        }, []);\n        return <Text text={'Count: ' + count} />;\n      }\n\n      const tracingEvent = { id: 0, name: 'hello', timestamp: 0 };\n      SchedulerTracing.unstable_trace(tracingEvent.name, tracingEvent.timestamp, () => {\n        ReactNoop.render(<Counter count={0} />);\n      });\n      expect(ReactNoop.flush()).toEqual(['Count: 0']);\n      expect(ReactNoop.getChildren()).toEqual([span('Count: 0')]);\n\n      expect(onInteractionScheduledWorkCompleted).toHaveBeenCalledTimes(0);\n\n      // Enqueuing this update forces the passive effect to be flushed --\n      // updateCount(1) happens first, so 2 wins.\n      act(() => _updateCount(2));\n      expect(ReactNoop.flush()).toEqual(['Will set count to 1', 'Count: 2']);\n      expect(ReactNoop.getChildren()).toEqual([span('Count: 2')]);\n\n      expect(onInteractionScheduledWorkCompleted).toHaveBeenCalledTimes(1);\n      expect(onWorkCanceled).toHaveBeenCalledTimes(0);\n    });\n\n    it.skip('in sync mode, useEffect is deferred and updates finish synchronously ' + '(in a single batch)', () => {\n      function Counter(props) {\n        const [count, updateCount] = useState('(empty)');\n        useEffect(() => {\n          // Update multiple times. These should all be batched together in\n          // a single render.\n          updateCount(props.count);\n          updateCount(props.count);\n          updateCount(props.count);\n          updateCount(props.count);\n          updateCount(props.count);\n          updateCount(props.count);\n        }, [props.count]);\n        return <Text text={'Count: ' + count} />;\n      }\n      ReactNoop.renderLegacySyncRoot(<Counter count={0} />);\n      // Even in sync mode, effects are deferred until after paint\n      expect(ReactNoop.flush()).toEqual(['Count: (empty)']);\n      expect(ReactNoop.getChildren()).toEqual([span('Count: (empty)')]);\n      // Now fire the effects\n      ReactNoop.flushPassiveEffects();\n      // There were multiple updates, but there should only be a\n      // single render\n      expect(ReactNoop.clearYields()).toEqual(['Count: 0']);\n      expect(ReactNoop.getChildren()).toEqual([span('Count: 0')]);\n    });\n\n    it.skip('flushSync is not allowed', () => {\n      function Counter(props) {\n        const [count, updateCount] = useState('(empty)');\n        useEffect(() => {\n          ReactNoop.yield(`Schedule update [${props.count}]`);\n          ReactNoop.flushSync(() => {\n            updateCount(props.count);\n          });\n        }, [props.count]);\n        return <Text text={'Count: ' + count} />;\n      }\n      ReactNoop.render(<Counter count={0} />);\n      expect(ReactNoop.flush()).toEqual(['Count: (empty)']);\n      expect(ReactNoop.getChildren()).toEqual([span('Count: (empty)')]);\n\n      expect(() => {\n        ReactNoop.flushPassiveEffects();\n      }).toThrow('flushSync was called from inside a lifecycle method');\n    });\n\n    it('unmounts previous effect', () => {\n      function Counter(props) {\n        useEffect(() => {\n          ReactNoop.yield(`Did create [${props.count}]`);\n          return () => {\n            ReactNoop.yield(`Did destroy [${props.count}]`);\n          };\n        });\n        return <Text text={'Count: ' + props.count} />;\n      }\n      ReactNoop.render(<Counter count={0} />);\n      expect(ReactNoop.flush()).toEqual(['Count: 0']);\n      expect(ReactNoop.getChildren()).toEqual([span('Count: 0')]);\n      ReactNoop.flushPassiveEffects();\n      expect(ReactNoop.clearYields()).toEqual(['Did create [0]']);\n\n      ReactNoop.render(<Counter count={1} />);\n      expect(ReactNoop.flush()).toEqual(['Count: 1']);\n      expect(ReactNoop.getChildren()).toEqual([span('Count: 1')]);\n      ReactNoop.flushPassiveEffects();\n      expect(ReactNoop.clearYields()).toEqual(['Did destroy [0]', 'Did create [1]']);\n    });\n\n    it('unmounts on deletion', () => {\n      function Counter(props) {\n        useEffect(() => {\n          ReactNoop.yield(`Did create [${props.count}]`);\n          return () => {\n            ReactNoop.yield(`Did destroy [${props.count}]`);\n          };\n        });\n        return <Text text={'Count: ' + props.count} />;\n      }\n      ReactNoop.render(<Counter count={0} />);\n      expect(ReactNoop.flush()).toEqual(['Count: 0']);\n      expect(ReactNoop.getChildren()).toEqual([span('Count: 0')]);\n      ReactNoop.flushPassiveEffects();\n      expect(ReactNoop.clearYields()).toEqual(['Did create [0]']);\n\n      ReactNoop.render(null);\n      expect(ReactNoop.flush()).toEqual(['Did destroy [0]']);\n      expect(ReactNoop.getChildren()).toEqual([]);\n    });\n\n    it('unmounts on deletion after skipped effect', () => {\n      function Counter(props) {\n        useEffect(() => {\n          ReactNoop.yield(`Did create [${props.count}]`);\n          return () => {\n            ReactNoop.yield(`Did destroy [${props.count}]`);\n          };\n        }, []);\n        return <Text text={'Count: ' + props.count} />;\n      }\n      ReactNoop.render(<Counter count={0} />);\n      expect(ReactNoop.flush()).toEqual(['Count: 0']);\n      expect(ReactNoop.getChildren()).toEqual([span('Count: 0')]);\n      ReactNoop.flushPassiveEffects();\n      expect(ReactNoop.clearYields()).toEqual(['Did create [0]']);\n\n      ReactNoop.render(<Counter count={1} />);\n      expect(ReactNoop.flush()).toEqual(['Count: 1']);\n      expect(ReactNoop.getChildren()).toEqual([span('Count: 1')]);\n      ReactNoop.flushPassiveEffects();\n      expect(ReactNoop.clearYields()).toEqual(null);\n\n      ReactNoop.render(null);\n      expect(ReactNoop.flush()).toEqual(['Did destroy [0]']);\n      expect(ReactNoop.getChildren()).toEqual([]);\n    });\n\n    it('always fires effects if no dependencies are provided', () => {\n      function effect() {\n        ReactNoop.yield(`Did create`);\n        return () => {\n          ReactNoop.yield(`Did destroy`);\n        };\n      }\n      function Counter(props) {\n        useEffect(effect);\n        return <Text text={'Count: ' + props.count} />;\n      }\n      ReactNoop.render(<Counter count={0} />);\n      expect(ReactNoop.flush()).toEqual(['Count: 0']);\n      expect(ReactNoop.getChildren()).toEqual([span('Count: 0')]);\n      ReactNoop.flushPassiveEffects();\n      expect(ReactNoop.clearYields()).toEqual(['Did create']);\n\n      ReactNoop.render(<Counter count={1} />);\n      expect(ReactNoop.flush()).toEqual(['Count: 1']);\n      expect(ReactNoop.getChildren()).toEqual([span('Count: 1')]);\n      ReactNoop.flushPassiveEffects();\n      expect(ReactNoop.clearYields()).toEqual(['Did destroy', 'Did create']);\n\n      ReactNoop.render(null);\n      expect(ReactNoop.flush()).toEqual(['Did destroy']);\n      expect(ReactNoop.getChildren()).toEqual([]);\n    });\n\n    it('skips effect if inputs have not changed', () => {\n      function Counter(props) {\n        const text = `${props.label}: ${props.count}`;\n        useEffect(() => {\n          ReactNoop.yield(`Did create [${text}]`);\n          return () => {\n            ReactNoop.yield(`Did destroy [${text}]`);\n          };\n        }, [props.label, props.count]);\n        return <Text text={text} />;\n      }\n      ReactNoop.render(<Counter label=\"Count\" count={0} />);\n      expect(ReactNoop.flush()).toEqual(['Count: 0']);\n      ReactNoop.flushPassiveEffects();\n      expect(ReactNoop.clearYields()).toEqual(['Did create [Count: 0]']);\n      expect(ReactNoop.getChildren()).toEqual([span('Count: 0')]);\n\n      ReactNoop.render(<Counter label=\"Count\" count={1} />);\n      // Count changed\n      expect(ReactNoop.flush()).toEqual(['Count: 1']);\n      expect(ReactNoop.getChildren()).toEqual([span('Count: 1')]);\n      ReactNoop.flushPassiveEffects();\n      expect(ReactNoop.clearYields()).toEqual(['Did destroy [Count: 0]', 'Did create [Count: 1]']);\n\n      ReactNoop.render(<Counter label=\"Count\" count={1} />);\n      // Nothing changed, so no effect should have fired\n      expect(ReactNoop.flush()).toEqual(['Count: 1']);\n      ReactNoop.flushPassiveEffects();\n      expect(ReactNoop.clearYields()).toEqual(null);\n      expect(ReactNoop.getChildren()).toEqual([span('Count: 1')]);\n\n      ReactNoop.render(<Counter label=\"Total\" count={1} />);\n      // Label changed\n      expect(ReactNoop.flush()).toEqual(['Total: 1']);\n      expect(ReactNoop.getChildren()).toEqual([span('Total: 1')]);\n      ReactNoop.flushPassiveEffects();\n      expect(ReactNoop.clearYields()).toEqual(['Did destroy [Count: 1]', 'Did create [Total: 1]']);\n    });\n\n    it('multiple effects', () => {\n      function Counter(props) {\n        useEffect(() => {\n          ReactNoop.yield(`Did commit 1 [${props.count}]`);\n        });\n        useEffect(() => {\n          ReactNoop.yield(`Did commit 2 [${props.count}]`);\n        });\n        return <Text text={'Count: ' + props.count} />;\n      }\n      ReactNoop.render(<Counter count={0} />);\n      expect(ReactNoop.flush()).toEqual(['Count: 0']);\n      expect(ReactNoop.getChildren()).toEqual([span('Count: 0')]);\n      ReactNoop.flushPassiveEffects();\n      expect(ReactNoop.clearYields()).toEqual(['Did commit 1 [0]', 'Did commit 2 [0]']);\n\n      ReactNoop.render(<Counter count={1} />);\n      expect(ReactNoop.flush()).toEqual(['Count: 1']);\n      expect(ReactNoop.getChildren()).toEqual([span('Count: 1')]);\n      ReactNoop.flushPassiveEffects();\n      expect(ReactNoop.clearYields()).toEqual(['Did commit 1 [1]', 'Did commit 2 [1]']);\n    });\n\n    it('unmounts all previous effects before creating any new ones', () => {\n      function Counter(props) {\n        useEffect(() => {\n          ReactNoop.yield(`Mount A [${props.count}]`);\n          return () => {\n            ReactNoop.yield(`Unmount A [${props.count}]`);\n          };\n        });\n        useEffect(() => {\n          ReactNoop.yield(`Mount B [${props.count}]`);\n          return () => {\n            ReactNoop.yield(`Unmount B [${props.count}]`);\n          };\n        });\n        return <Text text={'Count: ' + props.count} />;\n      }\n      ReactNoop.render(<Counter count={0} />);\n      expect(ReactNoop.flush()).toEqual(['Count: 0']);\n      expect(ReactNoop.getChildren()).toEqual([span('Count: 0')]);\n      ReactNoop.flushPassiveEffects();\n      expect(ReactNoop.clearYields()).toEqual(['Mount A [0]', 'Mount B [0]']);\n\n      ReactNoop.render(<Counter count={1} />);\n      expect(ReactNoop.flush()).toEqual(['Count: 1']);\n      expect(ReactNoop.getChildren()).toEqual([span('Count: 1')]);\n      ReactNoop.flushPassiveEffects();\n      expect(ReactNoop.clearYields()).toEqual(['Unmount A [0]', 'Unmount B [0]', 'Mount A [1]', 'Mount B [1]']);\n    });\n\n    it.skip('handles errors on mount', () => {\n      function Counter(props) {\n        useEffect(() => {\n          ReactNoop.yield(`Mount A [${props.count}]`);\n          return () => {\n            ReactNoop.yield(`Unmount A [${props.count}]`);\n          };\n        });\n        useEffect(() => {\n          ReactNoop.yield('Oops!');\n          throw new Error('Oops!');\n          // eslint-disable-next-line no-unreachable\n          ReactNoop.yield(`Mount B [${props.count}]`);\n          return () => {\n            ReactNoop.yield(`Unmount B [${props.count}]`);\n          };\n        });\n        return <Text text={'Count: ' + props.count} />;\n      }\n      ReactNoop.render(<Counter count={0} />);\n      expect(ReactNoop.flush()).toEqual(['Count: 0']);\n      expect(ReactNoop.getChildren()).toEqual([span('Count: 0')]);\n      expect(() => ReactNoop.flushPassiveEffects()).toThrow('Oops');\n      expect(ReactNoop.clearYields()).toEqual([\n        'Mount A [0]',\n        'Oops!',\n        // Clean up effect A. There's no effect B to clean-up, because it\n        // never mounted.\n        'Unmount A [0]',\n      ]);\n      expect(ReactNoop.getChildren()).toEqual([]);\n    });\n\n    it.skip('handles errors on update', () => {\n      function Counter(props) {\n        useEffect(() => {\n          ReactNoop.yield(`Mount A [${props.count}]`);\n          return () => {\n            ReactNoop.yield(`Unmount A [${props.count}]`);\n          };\n        });\n        useEffect(() => {\n          if (props.count === 1) {\n            ReactNoop.yield('Oops!');\n            throw new Error('Oops!');\n          }\n          ReactNoop.yield(`Mount B [${props.count}]`);\n          return () => {\n            ReactNoop.yield(`Unmount B [${props.count}]`);\n          };\n        });\n        return <Text text={'Count: ' + props.count} />;\n      }\n      ReactNoop.render(<Counter count={0} />);\n      expect(ReactNoop.flush()).toEqual(['Count: 0']);\n      expect(ReactNoop.getChildren()).toEqual([span('Count: 0')]);\n      ReactNoop.flushPassiveEffects();\n      expect(ReactNoop.clearYields()).toEqual(['Mount A [0]', 'Mount B [0]']);\n\n      // This update will trigger an errror\n      ReactNoop.render(<Counter count={1} />);\n      expect(ReactNoop.flush()).toEqual(['Count: 1']);\n      expect(ReactNoop.getChildren()).toEqual([span('Count: 1')]);\n      expect(() => ReactNoop.flushPassiveEffects()).toThrow('Oops');\n      expect(ReactNoop.clearYields()).toEqual([\n        'Unmount A [0]',\n        'Unmount B [0]',\n        'Mount A [1]',\n        'Oops!',\n        // Clean up effect A. There's no effect B to clean-up, because it\n        // never mounted.\n        'Unmount A [1]',\n      ]);\n      expect(ReactNoop.getChildren()).toEqual([]);\n    });\n\n    it.skip('handles errors on unmount', () => {\n      function Counter(props) {\n        useEffect(() => {\n          ReactNoop.yield(`Mount A [${props.count}]`);\n          return () => {\n            ReactNoop.yield('Oops!');\n            throw new Error('Oops!');\n            // eslint-disable-next-line no-unreachable\n            ReactNoop.yield(`Unmount A [${props.count}]`);\n          };\n        });\n        useEffect(() => {\n          ReactNoop.yield(`Mount B [${props.count}]`);\n          return () => {\n            ReactNoop.yield(`Unmount B [${props.count}]`);\n          };\n        });\n        return <Text text={'Count: ' + props.count} />;\n      }\n      ReactNoop.render(<Counter count={0} />);\n      expect(ReactNoop.flush()).toEqual(['Count: 0']);\n      expect(ReactNoop.getChildren()).toEqual([span('Count: 0')]);\n      ReactNoop.flushPassiveEffects();\n      expect(ReactNoop.clearYields()).toEqual(['Mount A [0]', 'Mount B [0]']);\n\n      // This update will trigger an errror\n      ReactNoop.render(<Counter count={1} />);\n      expect(ReactNoop.flush()).toEqual(['Count: 1']);\n      expect(ReactNoop.getChildren()).toEqual([span('Count: 1')]);\n      expect(() => ReactNoop.flushPassiveEffects()).toThrow('Oops');\n      expect(ReactNoop.clearYields()).toEqual([\n        'Oops!',\n        // B unmounts even though an error was thrown in the previous effect\n        'Unmount B [0]',\n      ]);\n      expect(ReactNoop.getChildren()).toEqual([]);\n    });\n\n    it('works with memo', () => {\n      function Counter({ count }) {\n        useLayoutEffect(() => {\n          ReactNoop.yield('Mount: ' + count);\n          return () => ReactNoop.yield('Unmount: ' + count);\n        });\n        return <Text text={'Count: ' + count} />;\n      }\n      Counter = memo(Counter);\n\n      ReactNoop.render(<Counter count={0} />);\n      expect(ReactNoop.flush()).toEqual(['Count: 0', 'Mount: 0']);\n      expect(ReactNoop.getChildren()).toEqual([span('Count: 0')]);\n\n      ReactNoop.render(<Counter count={1} />);\n      expect(ReactNoop.flush()).toEqual(['Count: 1', 'Unmount: 0', 'Mount: 1']);\n      expect(ReactNoop.getChildren()).toEqual([span('Count: 1')]);\n\n      ReactNoop.render(null);\n      expect(ReactNoop.flush()).toEqual(['Unmount: 1']);\n      expect(ReactNoop.getChildren()).toEqual([]);\n    });\n  });\n\n  describe('useLayoutEffect', () => {\n    it('fires layout effects after the host has been mutated', () => {\n      function getCommittedText() {\n        const children = ReactNoop.getChildren();\n        if (children === null) {\n          return null;\n        }\n        return children[0].prop;\n      }\n\n      function Counter(props) {\n        useLayoutEffect(() => {\n          ReactNoop.yield(`Current: ${getCommittedText()}`);\n        });\n        return <Text text={props.count} />;\n      }\n\n      ReactNoop.render(<Counter count={0} />);\n      expect(ReactNoop.flush()).toEqual([0, 'Current: 0']);\n      expect(ReactNoop.getChildren()).toEqual([span(0)]);\n\n      ReactNoop.render(<Counter count={1} />);\n      expect(ReactNoop.flush()).toEqual([1, 'Current: 1']);\n      expect(ReactNoop.getChildren()).toEqual([span(1)]);\n    });\n\n    it.skip('force flushes passive effects before firing new layout effects', () => {\n      let committedText = '(empty)';\n\n      function Counter(props) {\n        useLayoutEffect(() => {\n          // Normally this would go in a mutation effect, but this test\n          // intentionally omits a mutation effect.\n          committedText = props.count + '';\n\n          ReactNoop.yield(`Mount layout [current: ${committedText}]`);\n          return () => {\n            ReactNoop.yield(`Unmount layout [current: ${committedText}]`);\n          };\n        });\n        useEffect(() => {\n          ReactNoop.yield(`Mount normal [current: ${committedText}]`);\n          return () => {\n            ReactNoop.yield(`Unmount normal [current: ${committedText}]`);\n          };\n        });\n        return null;\n      }\n\n      ReactNoop.render(<Counter count={0} />);\n      expect(ReactNoop.flush()).toEqual(['Mount layout [current: 0]']);\n      expect(committedText).toEqual('0');\n\n      ReactNoop.render(<Counter count={1} />);\n      expect(ReactNoop.flush()).toEqual([\n        'Mount normal [current: 0]',\n        'Unmount layout [current: 0]',\n        'Mount layout [current: 1]',\n      ]);\n      expect(committedText).toEqual('1');\n\n      ReactNoop.flushPassiveEffects();\n      expect(ReactNoop.clearYields()).toEqual(['Unmount normal [current: 1]', 'Mount normal [current: 1]']);\n    });\n  });\n\n  describe('useCallback', () => {\n    it('memoizes callback by comparing inputs', () => {\n      class IncrementButton extends React.PureComponent {\n        increment = () => {\n          this.props.increment();\n        };\n        render() {\n          return <Text text=\"Increment\" />;\n        }\n      }\n\n      function Counter({ incrementBy }) {\n        const [count, updateCount] = useState(0);\n        const increment = useCallback(() => updateCount(c => c + incrementBy), [incrementBy]);\n        return (\n          <React.Fragment>\n            <IncrementButton increment={increment} ref={button} />\n            <Text text={'Count: ' + count} />\n          </React.Fragment>\n        );\n      }\n\n      const button = React.createRef(null);\n      ReactNoop.render(<Counter incrementBy={1} />);\n      expect(ReactNoop.flush()).toEqual(['Increment', 'Count: 0']);\n      expect(ReactNoop.getChildren()).toEqual([span('Increment'), span('Count: 0')]);\n\n      act(button.current.increment);\n      expect(ReactNoop.flush()).toEqual([\n        // Button should not re-render, because its props haven't changed\n        // 'Increment',\n        'Count: 1',\n      ]);\n      expect(ReactNoop.getChildren()).toEqual([span('Increment'), span('Count: 1')]);\n\n      // Increase the increment amount\n      ReactNoop.render(<Counter incrementBy={10} />);\n      expect(ReactNoop.flush()).toEqual([\n        // Inputs did change this time\n        'Increment',\n        'Count: 1',\n      ]);\n      expect(ReactNoop.getChildren()).toEqual([span('Increment'), span('Count: 1')]);\n\n      // Callback should have updated\n      act(button.current.increment);\n      expect(ReactNoop.flush()).toEqual(['Count: 11']);\n      expect(ReactNoop.getChildren()).toEqual([span('Increment'), span('Count: 11')]);\n    });\n  });\n\n  describe('useMemo', () => {\n    it('memoizes value by comparing to previous inputs', () => {\n      function CapitalizedText(props) {\n        const text = props.text;\n        const capitalizedText = useMemo(() => {\n          ReactNoop.yield(`Capitalize '${text}'`);\n          return text.toUpperCase();\n        }, [text]);\n        return <Text text={capitalizedText} />;\n      }\n\n      ReactNoop.render(<CapitalizedText text=\"hello\" />);\n      expect(ReactNoop.flush()).toEqual([\"Capitalize 'hello'\", 'HELLO']);\n      expect(ReactNoop.getChildren()).toEqual([span('HELLO')]);\n\n      ReactNoop.render(<CapitalizedText text=\"hi\" />);\n      expect(ReactNoop.flush()).toEqual([\"Capitalize 'hi'\", 'HI']);\n      expect(ReactNoop.getChildren()).toEqual([span('HI')]);\n\n      ReactNoop.render(<CapitalizedText text=\"hi\" />);\n      expect(ReactNoop.flush()).toEqual(['HI']);\n      expect(ReactNoop.getChildren()).toEqual([span('HI')]);\n\n      ReactNoop.render(<CapitalizedText text=\"goodbye\" />);\n      expect(ReactNoop.flush()).toEqual([\"Capitalize 'goodbye'\", 'GOODBYE']);\n      expect(ReactNoop.getChildren()).toEqual([span('GOODBYE')]);\n    });\n\n    it('always re-computes if no inputs are provided', () => {\n      function LazyCompute(props) {\n        const computed = useMemo(props.compute);\n        return <Text text={computed} />;\n      }\n\n      function computeA() {\n        ReactNoop.yield('compute A');\n        return 'A';\n      }\n\n      function computeB() {\n        ReactNoop.yield('compute B');\n        return 'B';\n      }\n\n      ReactNoop.render(<LazyCompute compute={computeA} />);\n      expect(ReactNoop.flush()).toEqual(['compute A', 'A']);\n\n      ReactNoop.render(<LazyCompute compute={computeA} />);\n      expect(ReactNoop.flush()).toEqual(['compute A', 'A']);\n\n      ReactNoop.render(<LazyCompute compute={computeA} />);\n      expect(ReactNoop.flush()).toEqual(['compute A', 'A']);\n\n      ReactNoop.render(<LazyCompute compute={computeB} />);\n      expect(ReactNoop.flush()).toEqual(['compute B', 'B']);\n    });\n\n    it('should not invoke memoized function during re-renders unless inputs change', () => {\n      function LazyCompute(props) {\n        const computed = useMemo(() => props.compute(props.input), [props.input]);\n        const [count, setCount] = useState(0);\n        if (count < 3) {\n          setCount(count + 1);\n        }\n        return <Text text={computed} />;\n      }\n\n      function compute(val) {\n        ReactNoop.yield('compute ' + val);\n        return val;\n      }\n\n      ReactNoop.render(<LazyCompute compute={compute} input=\"A\" />);\n      expect(ReactNoop.flush()).toEqual(['compute A', 'A']);\n\n      ReactNoop.render(<LazyCompute compute={compute} input=\"A\" />);\n      expect(ReactNoop.flush()).toEqual(['A']);\n\n      ReactNoop.render(<LazyCompute compute={compute} input=\"B\" />);\n      expect(ReactNoop.flush()).toEqual(['compute B', 'B']);\n    });\n  });\n\n  describe('useRef', () => {\n    it('creates a ref object initialized with the provided value', () => {\n      jest.useFakeTimers();\n\n      function useDebouncedCallback(callback, ms, inputs) {\n        const timeoutID = useRef(-1);\n        useEffect(() => {\n          return function unmount() {\n            clearTimeout(timeoutID.current);\n          };\n        }, []);\n        const debouncedCallback = useCallback(\n          (...args) => {\n            clearTimeout(timeoutID.current);\n            timeoutID.current = setTimeout(callback, ms, ...args);\n          },\n          [callback, ms],\n        );\n        return useCallback(debouncedCallback, inputs);\n      }\n\n      let ping;\n      function App() {\n        ping = useDebouncedCallback(\n          value => {\n            ReactNoop.yield('ping: ' + value);\n          },\n          100,\n          [],\n        );\n        return null;\n      }\n\n      ReactNoop.render(<App />);\n      expect(ReactNoop.flush()).toEqual([]);\n\n      ping(1);\n      ping(2);\n      ping(3);\n\n      expect(ReactNoop.flush()).toEqual([]);\n\n      jest.advanceTimersByTime(100);\n\n      expect(ReactNoop.flush()).toEqual(['ping: 3']);\n\n      ping(4);\n      jest.advanceTimersByTime(20);\n      ping(5);\n      ping(6);\n      jest.advanceTimersByTime(80);\n\n      expect(ReactNoop.flush()).toEqual([]);\n\n      jest.advanceTimersByTime(20);\n      expect(ReactNoop.flush()).toEqual(['ping: 6']);\n    });\n\n    it('should return the same ref during re-renders', () => {\n      function Counter() {\n        const ref = useRef('val');\n        const [count, setCount] = useState(0);\n        const [firstRef] = useState(ref);\n\n        if (firstRef !== ref) {\n          throw new Error('should never change');\n        }\n\n        if (count < 3) {\n          setCount(count + 1);\n        }\n\n        return <Text text={ref.current} />;\n      }\n\n      ReactNoop.render(<Counter />);\n      expect(ReactNoop.flush()).toEqual(['val']);\n\n      ReactNoop.render(<Counter />);\n      expect(ReactNoop.flush()).toEqual(['val']);\n    });\n  });\n\n  describe('useImperativeHandle', () => {\n    it('does not update when deps are the same', () => {\n      const INCREMENT = 'INCREMENT';\n\n      function reducer(state, action) {\n        return action === INCREMENT ? state + 1 : state;\n      }\n\n      function Counter(props, ref) {\n        const [count, dispatch] = useReducer(reducer, 0);\n        useImperativeHandle(ref, () => ({ count, dispatch }), []);\n        return <Text text={'Count: ' + count} />;\n      }\n\n      Counter = forwardRef(Counter);\n      const counter = React.createRef(null);\n      ReactNoop.render(<Counter ref={counter} />);\n      ReactNoop.flush();\n      expect(ReactNoop.getChildren()).toEqual([span('Count: 0')]);\n      expect(counter.current.count).toBe(0);\n\n      act(() => {\n        counter.current.dispatch(INCREMENT);\n      });\n      ReactNoop.flush();\n      expect(ReactNoop.getChildren()).toEqual([span('Count: 1')]);\n      // Intentionally not updated because of [] deps:\n      expect(counter.current.count).toBe(0);\n    });\n\n    // Regression test for https://github.com/facebook/react/issues/14782\n    it.skip('automatically updates when deps are not specified', () => {\n      const INCREMENT = 'INCREMENT';\n\n      function reducer(state, action) {\n        return action === INCREMENT ? state + 1 : state;\n      }\n\n      function Counter(props, ref) {\n        const [count, dispatch] = useReducer(reducer, 0);\n        useImperativeHandle(ref, () => ({ count, dispatch }));\n        return <Text text={'Count: ' + count} />;\n      }\n\n      Counter = forwardRef(Counter);\n      const counter = React.createRef(null);\n      ReactNoop.render(<Counter ref={counter} />);\n      ReactNoop.flush();\n      expect(ReactNoop.getChildren()).toEqual([span('Count: 0')]);\n      expect(counter.current.count).toBe(0);\n\n      act(() => {\n        counter.current.dispatch(INCREMENT);\n      });\n      ReactNoop.flush();\n      expect(ReactNoop.getChildren()).toEqual([span('Count: 1')]);\n      expect(counter.current.count).toBe(1);\n    });\n\n    it('updates when deps are different', () => {\n      const INCREMENT = 'INCREMENT';\n\n      function reducer(state, action) {\n        return action === INCREMENT ? state + 1 : state;\n      }\n\n      let totalRefUpdates = 0;\n      function Counter(props, ref) {\n        const [count, dispatch] = useReducer(reducer, 0);\n        useImperativeHandle(\n          ref,\n          () => {\n            totalRefUpdates++;\n            return { count, dispatch };\n          },\n          [count],\n        );\n        return <Text text={'Count: ' + count} />;\n      }\n\n      Counter = forwardRef(Counter);\n      const counter = React.createRef(null);\n      ReactNoop.render(<Counter ref={counter} />);\n      ReactNoop.flush();\n      expect(ReactNoop.getChildren()).toEqual([span('Count: 0')]);\n      expect(counter.current.count).toBe(0);\n      expect(totalRefUpdates).toBe(1);\n\n      act(() => {\n        counter.current.dispatch(INCREMENT);\n      });\n      ReactNoop.flush();\n      expect(ReactNoop.getChildren()).toEqual([span('Count: 1')]);\n      expect(counter.current.count).toBe(1);\n      expect(totalRefUpdates).toBe(2);\n\n      // Update that doesn't change the ref dependencies\n      ReactNoop.render(<Counter ref={counter} />);\n      ReactNoop.flush();\n      expect(ReactNoop.getChildren()).toEqual([span('Count: 1')]);\n      expect(counter.current.count).toBe(1);\n      expect(totalRefUpdates).toBe(2); // Should not increase since last time\n    });\n  });\n\n  describe('progressive enhancement (not supported)', () => {\n    it('mount additional state', () => {\n      let updateA;\n      let updateB;\n      // let updateC;\n\n      function App(props) {\n        const [A, _updateA] = useState(0);\n        const [B, _updateB] = useState(0);\n        updateA = _updateA;\n        updateB = _updateB;\n\n        let C;\n        if (props.loadC) {\n          useState(0);\n        } else {\n          C = '[not loaded]';\n        }\n\n        return <Text text={`A: ${A}, B: ${B}, C: ${C}`} />;\n      }\n\n      ReactNoop.render(<App loadC={false} />);\n      expect(ReactNoop.flush()).toEqual(['A: 0, B: 0, C: [not loaded]']);\n      expect(ReactNoop.getChildren()).toEqual([span('A: 0, B: 0, C: [not loaded]')]);\n\n      act(() => {\n        updateA(2);\n        updateB(3);\n      });\n\n      expect(ReactNoop.flush()).toEqual(['A: 2, B: 3, C: [not loaded]']);\n      expect(ReactNoop.getChildren()).toEqual([span('A: 2, B: 3, C: [not loaded]')]);\n\n      ReactNoop.render(<App loadC={true} />);\n      expect(() => {\n        expect(ReactNoop.flush()).toEqual(['A: 2, B: 3, C: 0']);\n      }).toThrow('Rendered more hooks than during the previous render');\n\n      // Uncomment if/when we support this again\n      // expect(ReactNoop.getChildren()).toEqual([span('A: 2, B: 3, C: 0')]);\n\n      // updateC(4);\n      // expect(ReactNoop.flush()).toEqual(['A: 2, B: 3, C: 4']);\n      // expect(ReactNoop.getChildren()).toEqual([span('A: 2, B: 3, C: 4')]);\n    });\n\n    it('unmount state', () => {\n      let updateA;\n      let updateB;\n      let updateC;\n\n      function App(props) {\n        const [A, _updateA] = useState(0);\n        const [B, _updateB] = useState(0);\n        updateA = _updateA;\n        updateB = _updateB;\n\n        let C;\n        if (props.loadC) {\n          const [_C, _updateC] = useState(0);\n          C = _C;\n          updateC = _updateC;\n        } else {\n          C = '[not loaded]';\n        }\n\n        return <Text text={`A: ${A}, B: ${B}, C: ${C}`} />;\n      }\n\n      ReactNoop.render(<App loadC={true} />);\n      expect(ReactNoop.flush()).toEqual(['A: 0, B: 0, C: 0']);\n      expect(ReactNoop.getChildren()).toEqual([span('A: 0, B: 0, C: 0')]);\n      act(() => {\n        updateA(2);\n        updateB(3);\n        updateC(4);\n      });\n      expect(ReactNoop.flush()).toEqual(['A: 2, B: 3, C: 4']);\n      expect(ReactNoop.getChildren()).toEqual([span('A: 2, B: 3, C: 4')]);\n      // Skip\n      // ReactNoop.render(<App loadC={false} />);\n      // expect(() => ReactNoop.flush()).toThrow(\n      //   'Rendered fewer hooks than expected. This may be caused by an ' + 'accidental early return statement.',\n      // );\n    });\n\n    it.skip('unmount effects', () => {\n      function App(props) {\n        useEffect(() => {\n          ReactNoop.yield('Mount A');\n          return () => {\n            ReactNoop.yield('Unmount A');\n          };\n        }, []);\n\n        if (props.showMore) {\n          useEffect(() => {\n            ReactNoop.yield('Mount B');\n            return () => {\n              ReactNoop.yield('Unmount B');\n            };\n          }, []);\n        }\n\n        return null;\n      }\n\n      ReactNoop.render(<App showMore={false} />);\n      expect(ReactNoop.flush()).toEqual([]);\n      ReactNoop.flushPassiveEffects();\n      expect(ReactNoop.clearYields()).toEqual(['Mount A']);\n\n      ReactNoop.render(<App showMore={true} />);\n      expect(() => {\n        expect(ReactNoop.flush()).toEqual([]);\n      }).toThrow('Rendered more hooks than during the previous render');\n\n      // Uncomment if/when we support this again\n      // ReactNoop.flushPassiveEffects();\n      // expect(ReactNoop.clearYields()).toEqual(['Mount B']);\n\n      // ReactNoop.render(<App showMore={false} />);\n      // expect(() => ReactNoop.flush()).toThrow(\n      //   'Rendered fewer hooks than expected. This may be caused by an ' +\n      //     'accidental early return statement.',\n      // );\n    });\n  });\n\n  describe('useContext', () => {\n    it('simple use', () => {\n      const CounterContext = createContext();\n      const Counter = () => {\n        const count = useContext(CounterContext);\n        return <Text text={count} />;\n      };\n      class Blank extends React.PureComponent {\n        render() {\n          return this.props.children;\n        }\n      }\n      const App = props => {\n        return (\n          <CounterContext.Provider value={props.count}>\n            <Blank>\n              <Counter />\n            </Blank>\n          </CounterContext.Provider>\n        );\n      };\n      ReactNoop.render(<App count={0} />);\n      expect(ReactNoop.flush()).toEqual([0]);\n      ReactNoop.render(<App count={1} />);\n      expect(ReactNoop.flush()).toEqual([1]);\n    });\n\n    it('works with shouldComponentUpdate', () => {\n      const CounterContext = createContext(0);\n      const Counter = () => {\n        const count = useContext(CounterContext);\n        return <Text text={count} />\n      };\n      class Blank extends React.PureComponent {\n        render() {\n          return <Counter />;\n        }\n      }\n      let updateCount;\n      const App = () => {\n        const [count, _updateCount] = useState(0);\n        updateCount = _updateCount;\n        return (\n          <CounterContext.Provider value={count}>\n            <Blank />\n          </CounterContext.Provider>\n        );\n      };\n      ReactNoop.render(<App />);\n      expect(ReactNoop.flush()).toEqual([0]);\n      updateCount(1);\n      expect(ReactNoop.flush()).toEqual([1]);\n    });\n\n    it('multiple contexts', () => {\n      const CounterContext1 = createContext();\n      const CounterContext2 = createContext();\n      const Counter = () => {\n        const count1 = useContext(CounterContext1);\n        const count2 = useContext(CounterContext2);\n        return (\n          <Text text={`${count1}${count2}`} />\n        );\n      };\n      class Blank extends React.PureComponent {\n        render() {\n          return <Counter />;\n        }\n      }\n      const App = props => {\n        return (\n          <CounterContext1.Provider value={props.count1}>\n            <CounterContext2.Provider value={props.count2}>\n              <Blank />\n            </CounterContext2.Provider>\n          </CounterContext1.Provider>\n        );\n      };\n      ReactNoop.render(<App count1={0} count2={0} />);\n      expect(ReactNoop.flush()).toEqual(['00']);\n      ReactNoop.render(<App count1={1} count2={0} />);\n      expect(ReactNoop.flush()).toEqual(['10']);\n      ReactNoop.render(<App count1={1} count2={1} />);\n      expect(ReactNoop.flush()).toEqual(['11']);\n    });\n  });\n});\n"
  },
  {
    "path": "tests/ReactHooksWithReactDOM.test.js",
    "content": "import '../src/polyfill';\nimport React, { forwardRef, useState, useImperativeHandle, useLayoutEffect, useEffect } from 'react';\nimport { render, cleanup } from 'react-testing-library';\nimport 'jest-dom/extend-expect';\n\nclass Logger {\n  yieldedValues = null;\n\n  yield(value) {\n    if (this.yieldedValues === null) {\n      this.yieldedValues = [value];\n    } else {\n      this.yieldedValues.push(value);\n    }\n  }\n\n  flush() {\n    const values = this.yieldedValues || [];\n    this.yieldedValues = null;\n    return values;\n  }\n\n  clearYields() {\n    const values = this.yieldedValues;\n    this.yieldedValues = null;\n    return values;\n  }\n}\n\nlet logger;\n\ndescribe('hooks', () => {\n  function Text(props) {\n    logger.yield(props.text);\n    return <span data-testid=\"text\">{props.text}</span>;\n  }\n\n  beforeEach(() => {\n    logger = new Logger();\n    jest.spyOn(window, 'requestAnimationFrame').mockImplementation(cb => setTimeout(cb));\n  });\n\n  afterEach(() => {\n    cleanup();\n    window.requestAnimationFrame.mockRestore();\n    jest.clearAllTimers();\n  });\n\n  describe('useEffect', () => {\n    it('flushes passive effects even with sibling deletions', () => {\n      jest.useFakeTimers();\n      function LayoutEffect(props) {\n        useLayoutEffect(() => {\n          logger.yield(`Layout effect`);\n        });\n        return <Text text=\"Layout\" />;\n      }\n      function PassiveEffect(props) {\n        useEffect(() => {\n          logger.yield(`Passive effect`);\n        }, []);\n        return <Text text=\"Passive\" />;\n      }\n      let passive = <PassiveEffect key=\"p\" />;\n      const { container, rerender } = render([<LayoutEffect key=\"l\" />, passive]);\n      expect(logger.flush()).toEqual(['Layout', 'Passive', 'Layout effect']);\n      expect(container).toHaveTextContent('LayoutPassive');\n\n      // Destroying the first child shouldn't prevent the passive effect from\n      // being executed\n      rerender([passive]);\n      jest.runAllTimers();\n      expect(logger.flush()).toEqual(['Passive effect']);\n      expect(container).toHaveTextContent('Passive');\n\n      // (No effects are left to flush.)\n      jest.runAllTimers();\n      expect(logger.clearYields()).toEqual(null);\n    });\n\n    it('flushes passive effects even if siblings schedule an update', () => {\n      jest.useFakeTimers();\n      function PassiveEffect(props) {\n        useEffect(() => {\n          debugger\n          logger.yield('Passive effect');\n        });\n        return <Text text=\"Passive\" />;\n      }\n      function LayoutEffect(props) {\n        let [count, setCount] = useState(0);\n        useLayoutEffect(() => {\n          // Scheduling work shouldn't interfere with the queued passive effect\n          if (count === 0) {\n            setCount(1);\n          }\n          logger.yield('Layout effect ' + count);\n        });\n        return <Text text=\"Layout\" />;\n      }\n\n      render([<PassiveEffect key=\"p\" />, <LayoutEffect key=\"l\" />]);\n\n      jest.runAllTimers();\n\n      expect(logger.flush()).toEqual([\n        'Passive',\n        'Layout',\n        'Layout effect 0',\n        'Passive effect',\n        'Layout',\n        'Layout effect 1',\n      ]);\n\n      expect(container).toHaveTextContent('PassiveLayout');\n    });\n\n  });\n});\n"
  },
  {
    "path": "vendors/react-noop-renderer/LICENSE",
    "content": "MIT License\n\nCopyright (c) Facebook, Inc. and its affiliates.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n"
  },
  {
    "path": "vendors/react-noop-renderer/README.md",
    "content": "# `react-noop-renderer`\n\nThis package is the renderer we use for debugging [Fiber](https://github.com/facebook/react/issues/6170).\nIt is not intended to be used directly.\n"
  },
  {
    "path": "vendors/react-noop-renderer/cjs/react-noop-renderer-persistent.development.js",
    "content": "/** @license React v16.6.1\n * react-noop-renderer-persistent.development.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\nconst regeneratorRuntime = require(\"regenerator-runtime\");\n\nif (process.env.NODE_ENV !== \"production\") {\n  (function() {\n'use strict';\n\nvar ReactFiberPersistentReconciler = require('react-reconciler/persistent');\nvar _assign = require('object-assign');\nvar expect = require('expect');\n\n// The Symbol used to tag the ReactElement-like types. If there is no native Symbol\n// nor polyfill, then a plain number is used for performance.\nvar hasSymbol = typeof Symbol === 'function' && Symbol.for;\n\nvar REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;\nvar REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;\nvar REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;\n\nfunction createPortal(children, containerInfo,\n// TODO: figure out the API for cross-renderer implementation.\nimplementation) {\n  var key = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;\n\n  return {\n    // This tag allow us to uniquely identify this as a React Portal\n    $$typeof: REACT_PORTAL_TYPE,\n    key: key == null ? null : '' + key,\n    children: children,\n    containerInfo: containerInfo,\n    implementation: implementation\n  };\n}\n\n/**\n * Similar to invariant but only logs a warning if the condition is not met.\n * This can be used to log issues in development environments in critical\n * paths. Removing the logging code for production environments will keep the\n * same logic and follow the same code paths.\n */\n\nvar warningWithoutStack = function () {};\n\n{\n  warningWithoutStack = function (condition, format) {\n    for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {\n      args[_key - 2] = arguments[_key];\n    }\n\n    if (format === undefined) {\n      throw new Error('`warningWithoutStack(condition, format, ...args)` requires a warning ' + 'message argument');\n    }\n    if (args.length > 8) {\n      // Check before the condition to catch violations early.\n      throw new Error('warningWithoutStack() currently supports at most 8 arguments.');\n    }\n    if (condition) {\n      return;\n    }\n    if (typeof console !== 'undefined') {\n      var argsWithFormat = args.map(function (item) {\n        return '' + item;\n      });\n      argsWithFormat.unshift('Warning: ' + format);\n\n      // We intentionally don't use spread (or .apply) directly because it\n      // breaks IE9: https://github.com/facebook/react/issues/13610\n      Function.prototype.apply.call(console.error, console, argsWithFormat);\n    }\n    try {\n      // --- Welcome to debugging React ---\n      // This error was thrown as a convenience so that you can use this stack\n      // to find the callsite that caused this warning to fire.\n      var argIndex = 0;\n      var message = 'Warning: ' + format.replace(/%s/g, function () {\n        return args[argIndex++];\n      });\n      throw new Error(message);\n    } catch (x) {}\n  };\n}\n\nvar warningWithoutStack$1 = warningWithoutStack;\n\n// for .act's return value\n\n\nvar NO_CONTEXT = {};\nvar UPDATE_SIGNAL = {};\n{\n  Object.freeze(NO_CONTEXT);\n  Object.freeze(UPDATE_SIGNAL);\n}\n\nfunction createReactNoop(reconciler, useMutation) {\n  var _marked = /*#__PURE__*/regeneratorRuntime.mark(flushUnitsOfWork);\n\n  var scheduledCallback = null;\n  var scheduledCallbackTimeout = -1;\n  var scheduledPassiveCallback = null;\n  var instanceCounter = 0;\n  var hostDiffCounter = 0;\n  var hostUpdateCounter = 0;\n  var hostCloneCounter = 0;\n\n  function appendChildToContainerOrInstance(parentInstance, child) {\n    var index = parentInstance.children.indexOf(child);\n    if (index !== -1) {\n      parentInstance.children.splice(index, 1);\n    }\n    parentInstance.children.push(child);\n  }\n\n  function appendChildToContainer(parentInstance, child) {\n    if (typeof parentInstance.rootID !== 'string') {\n      // Some calls to this aren't typesafe.\n      // This helps surface mistakes in tests.\n      throw new Error('appendChildToContainer() first argument is not a container.');\n    }\n    appendChildToContainerOrInstance(parentInstance, child);\n  }\n\n  function appendChild(parentInstance, child) {\n    if (typeof parentInstance.rootID === 'string') {\n      // Some calls to this aren't typesafe.\n      // This helps surface mistakes in tests.\n      throw new Error('appendChild() first argument is not an instance.');\n    }\n    appendChildToContainerOrInstance(parentInstance, child);\n  }\n\n  function insertInContainerOrInstanceBefore(parentInstance, child, beforeChild) {\n    var index = parentInstance.children.indexOf(child);\n    if (index !== -1) {\n      parentInstance.children.splice(index, 1);\n    }\n    var beforeIndex = parentInstance.children.indexOf(beforeChild);\n    if (beforeIndex === -1) {\n      throw new Error('This child does not exist.');\n    }\n    parentInstance.children.splice(beforeIndex, 0, child);\n  }\n\n  function insertInContainerBefore(parentInstance, child, beforeChild) {\n    if (typeof parentInstance.rootID !== 'string') {\n      // Some calls to this aren't typesafe.\n      // This helps surface mistakes in tests.\n      throw new Error('insertInContainerBefore() first argument is not a container.');\n    }\n    insertInContainerOrInstanceBefore(parentInstance, child, beforeChild);\n  }\n\n  function insertBefore(parentInstance, child, beforeChild) {\n    if (typeof parentInstance.rootID === 'string') {\n      // Some calls to this aren't typesafe.\n      // This helps surface mistakes in tests.\n      throw new Error('insertBefore() first argument is not an instance.');\n    }\n    insertInContainerOrInstanceBefore(parentInstance, child, beforeChild);\n  }\n\n  function removeChildFromContainerOrInstance(parentInstance, child) {\n    var index = parentInstance.children.indexOf(child);\n    if (index === -1) {\n      throw new Error('This child does not exist.');\n    }\n    parentInstance.children.splice(index, 1);\n  }\n\n  function removeChildFromContainer(parentInstance, child) {\n    if (typeof parentInstance.rootID !== 'string') {\n      // Some calls to this aren't typesafe.\n      // This helps surface mistakes in tests.\n      throw new Error('removeChildFromContainer() first argument is not a container.');\n    }\n    removeChildFromContainerOrInstance(parentInstance, child);\n  }\n\n  function removeChild(parentInstance, child) {\n    if (typeof parentInstance.rootID === 'string') {\n      // Some calls to this aren't typesafe.\n      // This helps surface mistakes in tests.\n      throw new Error('removeChild() first argument is not an instance.');\n    }\n    removeChildFromContainerOrInstance(parentInstance, child);\n  }\n\n  function cloneInstance(instance, updatePayload, type, oldProps, newProps, internalInstanceHandle, keepChildren, recyclableInstance) {\n    var clone = {\n      id: instance.id,\n      type: type,\n      children: keepChildren ? instance.children : [],\n      text: shouldSetTextContent(type, newProps) ? newProps.children + '' : null,\n      prop: newProps.prop,\n      hidden: newProps.hidden === true\n    };\n    Object.defineProperty(clone, 'id', {\n      value: clone.id,\n      enumerable: false\n    });\n    Object.defineProperty(clone, 'text', {\n      value: clone.text,\n      enumerable: false\n    });\n    hostCloneCounter++;\n    return clone;\n  }\n\n  function shouldSetTextContent(type, props) {\n    if (type === 'errorInBeginPhase') {\n      throw new Error('Error in host config.');\n    }\n    return typeof props.children === 'string' || typeof props.children === 'number';\n  }\n\n  var elapsedTimeInMs = 0;\n\n  var sharedHostConfig = {\n    getRootHostContext: function () {\n      return NO_CONTEXT;\n    },\n    getChildHostContext: function () {\n      return NO_CONTEXT;\n    },\n    getPublicInstance: function (instance) {\n      return instance;\n    },\n    createInstance: function (type, props) {\n      if (type === 'errorInCompletePhase') {\n        throw new Error('Error in host config.');\n      }\n      var inst = {\n        id: instanceCounter++,\n        type: type,\n        children: [],\n        text: shouldSetTextContent(type, props) ? props.children + '' : null,\n        prop: props.prop,\n        hidden: props.hidden === true\n      };\n      // Hide from unit tests\n      Object.defineProperty(inst, 'id', { value: inst.id, enumerable: false });\n      Object.defineProperty(inst, 'text', {\n        value: inst.text,\n        enumerable: false\n      });\n      return inst;\n    },\n    appendInitialChild: function (parentInstance, child) {\n      parentInstance.children.push(child);\n    },\n    finalizeInitialChildren: function (domElement, type, props) {\n      return false;\n    },\n    prepareUpdate: function (instance, type, oldProps, newProps) {\n      if (type === 'errorInCompletePhase') {\n        throw new Error('Error in host config.');\n      }\n      if (oldProps === null) {\n        throw new Error('Should have old props');\n      }\n      if (newProps === null) {\n        throw new Error('Should have new props');\n      }\n      hostDiffCounter++;\n      return UPDATE_SIGNAL;\n    },\n\n\n    shouldSetTextContent: shouldSetTextContent,\n\n    shouldDeprioritizeSubtree: function (type, props) {\n      return !!props.hidden;\n    },\n    createTextInstance: function (text, rootContainerInstance, hostContext, internalInstanceHandle) {\n      var inst = { text: text, id: instanceCounter++, hidden: false };\n      // Hide from unit tests\n      Object.defineProperty(inst, 'id', { value: inst.id, enumerable: false });\n      return inst;\n    },\n    scheduleDeferredCallback: function (callback, options) {\n      if (scheduledCallback) {\n        throw new Error('Scheduling a callback twice is excessive. Instead, keep track of ' + 'whether the callback has already been scheduled.');\n      }\n      scheduledCallback = callback;\n      if (typeof options === 'object' && options !== null && typeof options.timeout === 'number') {\n        var newTimeout = options.timeout;\n        if (scheduledCallbackTimeout === -1 || scheduledCallbackTimeout > newTimeout) {\n          scheduledCallbackTimeout = elapsedTimeInMs + newTimeout;\n        }\n      }\n      return 0;\n    },\n    cancelDeferredCallback: function () {\n      if (scheduledCallback === null) {\n        throw new Error('No callback is scheduled.');\n      }\n      scheduledCallback = null;\n      scheduledCallbackTimeout = -1;\n    },\n\n\n    shouldYield: shouldYield,\n\n    scheduleTimeout: setTimeout,\n    cancelTimeout: clearTimeout,\n    noTimeout: -1,\n    schedulePassiveEffects: function (callback) {\n      if (scheduledCallback) {\n        throw new Error('Scheduling a callback twice is excessive. Instead, keep track of ' + 'whether the callback has already been scheduled.');\n      }\n      scheduledPassiveCallback = callback;\n    },\n    cancelPassiveEffects: function () {\n      if (scheduledPassiveCallback === null) {\n        throw new Error('No passive effects callback is scheduled.');\n      }\n      scheduledPassiveCallback = null;\n    },\n    prepareForCommit: function () {},\n    resetAfterCommit: function () {},\n    now: function () {\n      return elapsedTimeInMs;\n    },\n\n\n    isPrimaryRenderer: true,\n    supportsHydration: false\n  };\n\n  var hostConfig = useMutation ? _assign({}, sharedHostConfig, {\n\n    supportsMutation: true,\n    supportsPersistence: false,\n\n    commitMount: function (instance, type, newProps) {\n      // Noop\n    },\n    commitUpdate: function (instance, updatePayload, type, oldProps, newProps) {\n      if (oldProps === null) {\n        throw new Error('Should have old props');\n      }\n      hostUpdateCounter++;\n      instance.prop = newProps.prop;\n      instance.hidden = newProps.hidden === true;\n      if (shouldSetTextContent(type, newProps)) {\n        instance.text = newProps.children + '';\n      }\n    },\n    commitTextUpdate: function (textInstance, oldText, newText) {\n      hostUpdateCounter++;\n      textInstance.text = newText;\n    },\n\n\n    appendChild: appendChild,\n    appendChildToContainer: appendChildToContainer,\n    insertBefore: insertBefore,\n    insertInContainerBefore: insertInContainerBefore,\n    removeChild: removeChild,\n    removeChildFromContainer: removeChildFromContainer,\n\n    hideInstance: function (instance) {\n      instance.hidden = true;\n    },\n    hideTextInstance: function (textInstance) {\n      textInstance.hidden = true;\n    },\n    unhideInstance: function (instance, props) {\n      if (!props.hidden) {\n        instance.hidden = false;\n      }\n    },\n    unhideTextInstance: function (textInstance, text) {\n      textInstance.hidden = false;\n    },\n    resetTextContent: function (instance) {\n      instance.text = null;\n    }\n  }) : _assign({}, sharedHostConfig, {\n    supportsMutation: false,\n    supportsPersistence: true,\n\n    cloneInstance: cloneInstance,\n\n    createContainerChildSet: function (container) {\n      return [];\n    },\n    appendChildToContainerChildSet: function (childSet, child) {\n      childSet.push(child);\n    },\n    finalizeContainerChildren: function (container, newChildren) {},\n    replaceContainerChildren: function (container, newChildren) {\n      container.children = newChildren;\n    },\n    cloneHiddenInstance: function (instance, type, props, internalInstanceHandle) {\n      var clone = cloneInstance(instance, null, type, props, props, internalInstanceHandle, true, null);\n      clone.hidden = true;\n      return clone;\n    },\n    cloneUnhiddenInstance: function (instance, type, props, internalInstanceHandle) {\n      var clone = cloneInstance(instance, null, type, props, props, internalInstanceHandle, true, null);\n      clone.hidden = props.hidden;\n      return clone;\n    },\n    createHiddenTextInstance: function (text, rootContainerInstance, hostContext, internalInstanceHandle) {\n      var inst = { text: text, id: instanceCounter++, hidden: true };\n      // Hide from unit tests\n      Object.defineProperty(inst, 'id', {\n        value: inst.id,\n        enumerable: false\n      });\n      return inst;\n    }\n  });\n\n  var NoopRenderer = reconciler(hostConfig);\n\n  var rootContainers = new Map();\n  var roots = new Map();\n  var DEFAULT_ROOT_ID = '<default>';\n\n  var yieldedValues = null;\n\n  var didYield = void 0;\n  var unitsRemaining = void 0;\n\n  function shouldYield() {\n    if (scheduledCallbackTimeout === -1 || elapsedTimeInMs > scheduledCallbackTimeout) {\n      return false;\n    } else {\n      if (didYield || yieldedValues !== null) {\n        return true;\n      }\n      if (unitsRemaining-- > 0) {\n        return false;\n      }\n      didYield = true;\n      return true;\n    }\n  }\n\n  function flushUnitsOfWork(n) {\n    var cb, values;\n    return regeneratorRuntime.wrap(function flushUnitsOfWork$(_context) {\n      while (1) {\n        switch (_context.prev = _context.next) {\n          case 0:\n            unitsRemaining = n + 1;\n            didYield = false;\n            _context.prev = 2;\n\n          case 3:\n            if (!(!didYield && scheduledCallback !== null)) {\n              _context.next = 14;\n              break;\n            }\n\n            cb = scheduledCallback;\n\n            scheduledCallback = null;\n            cb();\n\n            if (!(yieldedValues !== null)) {\n              _context.next = 12;\n              break;\n            }\n\n            values = yieldedValues;\n\n            yieldedValues = null;\n            _context.next = 12;\n            return values;\n\n          case 12:\n            _context.next = 3;\n            break;\n\n          case 14:\n            _context.prev = 14;\n\n            unitsRemaining = -1;\n            didYield = false;\n            return _context.finish(14);\n\n          case 18:\n          case 'end':\n            return _context.stop();\n        }\n      }\n    }, _marked, this, [[2,, 14, 18]]);\n  }\n\n  function childToJSX(child, text) {\n    if (text !== null) {\n      return text;\n    }\n    if (child === null) {\n      return null;\n    }\n    if (typeof child === 'string') {\n      return child;\n    }\n    if (Array.isArray(child)) {\n      if (child.length === 0) {\n        return null;\n      }\n      if (child.length === 1) {\n        return childToJSX(child[0], null);\n      }\n      // $FlowFixMe\n      var _children = child.map(function (c) {\n        return childToJSX(c, null);\n      });\n      if (_children.every(function (c) {\n        return typeof c === 'string' || typeof c === 'number';\n      })) {\n        return _children.join('');\n      }\n      return _children;\n    }\n    if (Array.isArray(child.children)) {\n      // This is an instance.\n      var instance = child;\n      var _children2 = childToJSX(instance.children, instance.text);\n      var props = { prop: instance.prop };\n      if (instance.hidden) {\n        props.hidden = true;\n      }\n      if (_children2 !== null) {\n        props.children = _children2;\n      }\n      return {\n        $$typeof: REACT_ELEMENT_TYPE,\n        type: instance.type,\n        key: null,\n        ref: null,\n        props: props,\n        _owner: null,\n        _store: {}\n      };\n    }\n    // This is a text instance\n    var textInstance = child;\n    if (textInstance.hidden) {\n      return '';\n    }\n    return textInstance.text;\n  }\n\n  var ReactNoop = {\n    getChildren: function () {\n      var rootID = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_ROOT_ID;\n\n      var container = rootContainers.get(rootID);\n      if (container) {\n        return container.children;\n      } else {\n        return null;\n      }\n    },\n    getOrCreateRootContainer: function () {\n      var rootID = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_ROOT_ID;\n      var isConcurrent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n\n      var root = roots.get(rootID);\n      if (!root) {\n        var container = { rootID: rootID, children: [] };\n        rootContainers.set(rootID, container);\n        root = NoopRenderer.createContainer(container, isConcurrent, false);\n        roots.set(rootID, root);\n      }\n      return root.current.stateNode.containerInfo;\n    },\n    getChildrenAsJSX: function () {\n      var rootID = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_ROOT_ID;\n\n      var children = childToJSX(ReactNoop.getChildren(rootID), null);\n      if (children === null) {\n        return null;\n      }\n      if (Array.isArray(children)) {\n        return {\n          $$typeof: REACT_ELEMENT_TYPE,\n          type: REACT_FRAGMENT_TYPE,\n          key: null,\n          ref: null,\n          props: { children: children },\n          _owner: null,\n          _store: {}\n        };\n      }\n      return children;\n    },\n    createPortal: function (children, container) {\n      var key = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;\n\n      return createPortal(children, container, null, key);\n    },\n\n\n    // Shortcut for testing a single root\n    render: function (element, callback) {\n      ReactNoop.renderToRootWithID(element, DEFAULT_ROOT_ID, callback);\n    },\n    renderLegacySyncRoot: function (element, callback) {\n      var rootID = DEFAULT_ROOT_ID;\n      var isConcurrent = false;\n      var container = ReactNoop.getOrCreateRootContainer(rootID, isConcurrent);\n      var root = roots.get(container.rootID);\n      NoopRenderer.updateContainer(element, root, null, callback);\n    },\n    renderToRootWithID: function (element, rootID, callback) {\n      var isConcurrent = true;\n      var container = ReactNoop.getOrCreateRootContainer(rootID, isConcurrent);\n      var root = roots.get(container.rootID);\n      NoopRenderer.updateContainer(element, root, null, callback);\n    },\n    unmountRootWithID: function (rootID) {\n      var root = roots.get(rootID);\n      if (root) {\n        NoopRenderer.updateContainer(null, root, null, function () {\n          roots.delete(rootID);\n          rootContainers.delete(rootID);\n        });\n      }\n    },\n    findInstance: function (componentOrElement) {\n      if (componentOrElement == null) {\n        return null;\n      }\n      // Unsound duck typing.\n      var component = componentOrElement;\n      if (typeof component.id === 'number') {\n        return component;\n      }\n      {\n        return NoopRenderer.findHostInstanceWithWarning(component, 'findInstance');\n      }\n      return NoopRenderer.findHostInstance(component);\n    },\n    flushDeferredPri: function () {\n      var timeout = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : Infinity;\n\n      // The legacy version of this function decremented the timeout before\n      // returning the new time.\n      // TODO: Convert tests to use flushUnitsOfWork or flushAndYield instead.\n      var n = timeout / 5 - 1;\n\n      var values = [];\n      // eslint-disable-next-line no-for-of-loops/no-for-of-loops\n      var _iteratorNormalCompletion = true;\n      var _didIteratorError = false;\n      var _iteratorError = undefined;\n\n      try {\n        for (var _iterator = flushUnitsOfWork(n)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n          var value = _step.value;\n\n          values.push.apply(values, value);\n        }\n      } catch (err) {\n        _didIteratorError = true;\n        _iteratorError = err;\n      } finally {\n        try {\n          if (!_iteratorNormalCompletion && _iterator.return) {\n            _iterator.return();\n          }\n        } finally {\n          if (_didIteratorError) {\n            throw _iteratorError;\n          }\n        }\n      }\n\n      return values;\n    },\n    flush: function () {\n      return ReactNoop.flushUnitsOfWork(Infinity);\n    },\n    flushAndYield: function () {\n      var unitsOfWork = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : Infinity;\n\n      return flushUnitsOfWork(unitsOfWork);\n    },\n    flushUnitsOfWork: function (n) {\n      var values = yieldedValues || [];\n      yieldedValues = null;\n      // eslint-disable-next-line no-for-of-loops/no-for-of-loops\n      var _iteratorNormalCompletion2 = true;\n      var _didIteratorError2 = false;\n      var _iteratorError2 = undefined;\n\n      try {\n        for (var _iterator2 = flushUnitsOfWork(n)[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {\n          var value = _step2.value;\n\n          values.push.apply(values, value);\n        }\n      } catch (err) {\n        _didIteratorError2 = true;\n        _iteratorError2 = err;\n      } finally {\n        try {\n          if (!_iteratorNormalCompletion2 && _iterator2.return) {\n            _iterator2.return();\n          }\n        } finally {\n          if (_didIteratorError2) {\n            throw _iteratorError2;\n          }\n        }\n      }\n\n      return values;\n    },\n    flushThrough: function (expected) {\n      var actual = [];\n      if (expected.length !== 0) {\n        // eslint-disable-next-line no-for-of-loops/no-for-of-loops\n        var _iteratorNormalCompletion3 = true;\n        var _didIteratorError3 = false;\n        var _iteratorError3 = undefined;\n\n        try {\n          for (var _iterator3 = flushUnitsOfWork(Infinity)[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {\n            var value = _step3.value;\n\n            actual.push.apply(actual, value);\n            if (actual.length >= expected.length) {\n              break;\n            }\n          }\n        } catch (err) {\n          _didIteratorError3 = true;\n          _iteratorError3 = err;\n        } finally {\n          try {\n            if (!_iteratorNormalCompletion3 && _iterator3.return) {\n              _iterator3.return();\n            }\n          } finally {\n            if (_didIteratorError3) {\n              throw _iteratorError3;\n            }\n          }\n        }\n      }\n      expect(actual).toEqual(expected);\n    },\n    flushNextYield: function () {\n      var actual = null;\n      // eslint-disable-next-line no-for-of-loops/no-for-of-loops\n      var _iteratorNormalCompletion4 = true;\n      var _didIteratorError4 = false;\n      var _iteratorError4 = undefined;\n\n      try {\n        for (var _iterator4 = flushUnitsOfWork(Infinity)[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) {\n          var value = _step4.value;\n\n          actual = value;\n          break;\n        }\n      } catch (err) {\n        _didIteratorError4 = true;\n        _iteratorError4 = err;\n      } finally {\n        try {\n          if (!_iteratorNormalCompletion4 && _iterator4.return) {\n            _iterator4.return();\n          }\n        } finally {\n          if (_didIteratorError4) {\n            throw _iteratorError4;\n          }\n        }\n      }\n\n      return actual !== null ? actual : [];\n    },\n    flushWithHostCounters: function (fn) {\n      hostDiffCounter = 0;\n      hostUpdateCounter = 0;\n      hostCloneCounter = 0;\n      try {\n        ReactNoop.flush();\n        return useMutation ? {\n          hostDiffCounter: hostDiffCounter,\n          hostUpdateCounter: hostUpdateCounter\n        } : {\n          hostDiffCounter: hostDiffCounter,\n          hostCloneCounter: hostCloneCounter\n        };\n      } finally {\n        hostDiffCounter = 0;\n        hostUpdateCounter = 0;\n        hostCloneCounter = 0;\n      }\n    },\n    expire: function (ms) {\n      ReactNoop.advanceTime(ms);\n      return ReactNoop.flushExpired();\n    },\n    advanceTime: function (ms) {\n      elapsedTimeInMs += ms;\n    },\n    flushExpired: function () {\n      return ReactNoop.flushUnitsOfWork(0);\n    },\n    yield: function (value) {\n      if (yieldedValues === null) {\n        yieldedValues = [value];\n      } else {\n        yieldedValues.push(value);\n      }\n    },\n    clearYields: function () {\n      var values = yieldedValues;\n      yieldedValues = null;\n      return values;\n    },\n    hasScheduledCallback: function () {\n      return !!scheduledCallback;\n    },\n\n\n    batchedUpdates: NoopRenderer.batchedUpdates,\n\n    deferredUpdates: NoopRenderer.deferredUpdates,\n\n    unbatchedUpdates: NoopRenderer.unbatchedUpdates,\n\n    interactiveUpdates: NoopRenderer.interactiveUpdates,\n\n    // maybe this should exist only in the test file\n    act: function (callback) {\n      // note: keep these warning messages in sync with\n      // ReactTestRenderer.js and ReactTestUtils.js\n      var result = NoopRenderer.batchedUpdates(callback);\n      {\n        if (result !== undefined) {\n          var addendum = void 0;\n          if (result !== null && typeof result.then === 'function') {\n            addendum = \"\\n\\nIt looks like you wrote ReactNoop.act(async () => ...) or returned a Promise from it's callback. \" + 'Putting asynchronous logic inside ReactNoop.act(...) is not supported.\\n';\n          } else {\n            addendum = ' You returned: ' + result;\n          }\n          warningWithoutStack$1(false, 'The callback passed to ReactNoop.act(...) function must not return anything.%s', addendum);\n        }\n      }\n      ReactNoop.flushPassiveEffects();\n      // we want the user to not expect a return,\n      // but we want to warn if they use it like they can await on it.\n      return {\n        then: function () {\n          {\n            warningWithoutStack$1(false, 'Do not await the result of calling ReactNoop.act(...), it is not a Promise.');\n          }\n        }\n      };\n    },\n    flushSync: function (fn) {\n      yieldedValues = [];\n      NoopRenderer.flushSync(fn);\n      return yieldedValues;\n    },\n    flushPassiveEffects: function () {\n      // Trick to flush passive effects without exposing an internal API:\n      // Create a throwaway root and schedule a dummy update on it.\n      var rootID = 'bloopandthenmoreletterstoavoidaconflict';\n      var container = { rootID: rootID, children: [] };\n      rootContainers.set(rootID, container);\n      var root = NoopRenderer.createContainer(container, true, false);\n      NoopRenderer.updateContainer(null, root, null, null);\n    },\n\n\n    // Logs the current state of the tree.\n    dumpTree: function () {\n      var _console;\n\n      var rootID = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_ROOT_ID;\n\n      var root = roots.get(rootID);\n      var rootContainer = rootContainers.get(rootID);\n      if (!root || !rootContainer) {\n        console.log('Nothing rendered yet.');\n        return;\n      }\n\n      var bufferedLog = [];\n      function log() {\n        for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {\n          args[_key] = arguments[_key];\n        }\n\n        bufferedLog.push.apply(bufferedLog, args.concat(['\\n']));\n      }\n\n      function logHostInstances(children, depth) {\n        for (var i = 0; i < children.length; i++) {\n          var child = children[i];\n          var indent = '  '.repeat(depth);\n          if (typeof child.text === 'string') {\n            log(indent + '- ' + child.text);\n          } else {\n            // $FlowFixMe - The child should've been refined now.\n            log(indent + '- ' + child.type + '#' + child.id);\n            // $FlowFixMe - The child should've been refined now.\n            logHostInstances(child.children, depth + 1);\n          }\n        }\n      }\n      function logContainer(container, depth) {\n        log('  '.repeat(depth) + '- [root#' + container.rootID + ']');\n        logHostInstances(container.children, depth + 1);\n      }\n\n      function logUpdateQueue(updateQueue, depth) {\n        log('  '.repeat(depth + 1) + 'QUEUED UPDATES');\n        var firstUpdate = updateQueue.firstUpdate;\n        if (!firstUpdate) {\n          return;\n        }\n\n        log('  '.repeat(depth + 1) + '~', '[' + firstUpdate.expirationTime + ']');\n        while (firstUpdate.next) {\n          log('  '.repeat(depth + 1) + '~', '[' + firstUpdate.expirationTime + ']');\n        }\n      }\n\n      function logFiber(fiber, depth) {\n        log('  '.repeat(depth) + '- ' + (\n        // need to explicitly coerce Symbol to a string\n        fiber.type ? fiber.type.name || fiber.type.toString() : '[root]'), '[' + fiber.childExpirationTime + (fiber.pendingProps ? '*' : '') + ']');\n        if (fiber.updateQueue) {\n          logUpdateQueue(fiber.updateQueue, depth);\n        }\n        // const childInProgress = fiber.progressedChild;\n        // if (childInProgress && childInProgress !== fiber.child) {\n        //   log(\n        //     '  '.repeat(depth + 1) + 'IN PROGRESS: ' + fiber.pendingWorkPriority,\n        //   );\n        //   logFiber(childInProgress, depth + 1);\n        //   if (fiber.child) {\n        //     log('  '.repeat(depth + 1) + 'CURRENT');\n        //   }\n        // } else if (fiber.child && fiber.updateQueue) {\n        //   log('  '.repeat(depth + 1) + 'CHILDREN');\n        // }\n        if (fiber.child) {\n          logFiber(fiber.child, depth + 1);\n        }\n        if (fiber.sibling) {\n          logFiber(fiber.sibling, depth);\n        }\n      }\n\n      log('HOST INSTANCES:');\n      logContainer(rootContainer, 0);\n      log('FIBERS:');\n      logFiber(root.current, 0);\n\n      (_console = console).log.apply(_console, bufferedLog);\n    },\n    flushWithoutCommitting: function (expectedFlush) {\n      var rootID = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_ROOT_ID;\n\n      var root = roots.get(rootID);\n      var expiration = NoopRenderer.computeUniqueAsyncExpiration();\n      var batch = {\n        _defer: true,\n        _expirationTime: expiration,\n        _onComplete: function () {\n          root.firstBatch = null;\n        },\n        _next: null\n      };\n      root.firstBatch = batch;\n      var actual = ReactNoop.flush();\n      expect(actual).toEqual(expectedFlush);\n      return function (expectedCommit) {\n        batch._defer = false;\n        NoopRenderer.flushRoot(root, expiration);\n        expect(yieldedValues).toEqual(expectedCommit);\n      };\n    },\n    getRoot: function () {\n      var rootID = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_ROOT_ID;\n\n      return roots.get(rootID);\n    }\n  };\n\n  return ReactNoop;\n}\n\n/**\n * This is a renderer of React that doesn't have a render target output.\n * It is useful to demonstrate the internals of the reconciler in isolation\n * and for testing semantics of reconciliation separate from the host\n * environment.\n */\n\nvar ReactNoopPersistent = createReactNoop(ReactFiberPersistentReconciler, // reconciler\nfalse // useMutation\n);\n\n\n\nvar ReactNoopPersistent$2 = Object.freeze({\n\tdefault: ReactNoopPersistent\n});\n\nvar ReactNoopPersistent$3 = ( ReactNoopPersistent$2 && ReactNoopPersistent ) || ReactNoopPersistent$2;\n\n// TODO: decide on the top-level export form.\n// This is hacky but makes it work with both Rollup and Jest.\nvar persistent = ReactNoopPersistent$3.default || ReactNoopPersistent$3;\n\nmodule.exports = persistent;\n  })();\n}\n"
  },
  {
    "path": "vendors/react-noop-renderer/cjs/react-noop-renderer-server.development.js",
    "content": "/** @license React v16.6.1\n * react-noop-renderer-server.development.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\n\n\nif (process.env.NODE_ENV !== \"production\") {\n  (function() {\n'use strict';\n\nvar ReactFizzStreamer = require('react-stream');\n\n/**\n * This is a renderer of React that doesn't have a render target output.\n * It is useful to demonstrate the internals of the reconciler in isolation\n * and for testing semantics of reconciliation separate from the host\n * environment.\n */\n\nvar ReactNoopServer = ReactFizzStreamer({\n  scheduleWork: function (callback) {\n    callback();\n  },\n  beginWriting: function (destination) {},\n  writeChunk: function (destination, buffer) {\n    destination.push(JSON.parse(Buffer.from(buffer).toString('utf8')));\n  },\n  completeWriting: function (destination) {},\n  close: function (destination) {},\n  flushBuffered: function (destination) {},\n  convertStringToBuffer: function (content) {\n    return Buffer.from(content, 'utf8');\n  },\n  formatChunk: function (type, props) {\n    return Buffer.from(JSON.stringify({ type: type, props: props }), 'utf8');\n  }\n});\n\nfunction render(children) {\n  var destination = [];\n  var request = ReactNoopServer.createRequest(children, destination);\n  ReactNoopServer.startWork(request);\n  return destination;\n}\n\nvar ReactNoopServer$1 = {\n  render: render\n};\n\nvar ReactNoopServer$2 = Object.freeze({\n\tdefault: ReactNoopServer$1\n});\n\nvar ReactNoopServer$3 = ( ReactNoopServer$2 && ReactNoopServer$1 ) || ReactNoopServer$2;\n\n// TODO: decide on the top-level export form.\n// This is hacky but makes it work with both Rollup and Jest.\nvar server = ReactNoopServer$3.default || ReactNoopServer$3;\n\nmodule.exports = server;\n  })();\n}\n"
  },
  {
    "path": "vendors/react-noop-renderer/cjs/react-noop-renderer.development.js",
    "content": "/** @license React v16.6.1\n * react-noop-renderer.development.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\nconst regeneratorRuntime = require(\"regenerator-runtime\");\n\nif (process.env.NODE_ENV !== \"production\") {\n  (function() {\n'use strict';\n\nvar ReactFiberReconciler = require('react-reconciler');\nvar _assign = require('object-assign');\nvar expect = require('expect');\n\n// The Symbol used to tag the ReactElement-like types. If there is no native Symbol\n// nor polyfill, then a plain number is used for performance.\nvar hasSymbol = typeof Symbol === 'function' && Symbol.for;\n\nvar REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;\nvar REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;\nvar REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;\n\nfunction createPortal(children, containerInfo,\n// TODO: figure out the API for cross-renderer implementation.\nimplementation) {\n  var key = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;\n\n  return {\n    // This tag allow us to uniquely identify this as a React Portal\n    $$typeof: REACT_PORTAL_TYPE,\n    key: key == null ? null : '' + key,\n    children: children,\n    containerInfo: containerInfo,\n    implementation: implementation\n  };\n}\n\n/**\n * Similar to invariant but only logs a warning if the condition is not met.\n * This can be used to log issues in development environments in critical\n * paths. Removing the logging code for production environments will keep the\n * same logic and follow the same code paths.\n */\n\nvar warningWithoutStack = function () {};\n\n{\n  warningWithoutStack = function (condition, format) {\n    for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {\n      args[_key - 2] = arguments[_key];\n    }\n\n    if (format === undefined) {\n      throw new Error('`warningWithoutStack(condition, format, ...args)` requires a warning ' + 'message argument');\n    }\n    if (args.length > 8) {\n      // Check before the condition to catch violations early.\n      throw new Error('warningWithoutStack() currently supports at most 8 arguments.');\n    }\n    if (condition) {\n      return;\n    }\n    if (typeof console !== 'undefined') {\n      var argsWithFormat = args.map(function (item) {\n        return '' + item;\n      });\n      argsWithFormat.unshift('Warning: ' + format);\n\n      // We intentionally don't use spread (or .apply) directly because it\n      // breaks IE9: https://github.com/facebook/react/issues/13610\n      Function.prototype.apply.call(console.error, console, argsWithFormat);\n    }\n    try {\n      // --- Welcome to debugging React ---\n      // This error was thrown as a convenience so that you can use this stack\n      // to find the callsite that caused this warning to fire.\n      var argIndex = 0;\n      var message = 'Warning: ' + format.replace(/%s/g, function () {\n        return args[argIndex++];\n      });\n      throw new Error(message);\n    } catch (x) {}\n  };\n}\n\nvar warningWithoutStack$1 = warningWithoutStack;\n\n// for .act's return value\n\n\nvar NO_CONTEXT = {};\nvar UPDATE_SIGNAL = {};\n{\n  Object.freeze(NO_CONTEXT);\n  Object.freeze(UPDATE_SIGNAL);\n}\n\nfunction createReactNoop(reconciler, useMutation) {\n  var _marked = /*#__PURE__*/regeneratorRuntime.mark(flushUnitsOfWork);\n\n  var scheduledCallback = null;\n  var scheduledCallbackTimeout = -1;\n  var scheduledPassiveCallback = null;\n  var instanceCounter = 0;\n  var hostDiffCounter = 0;\n  var hostUpdateCounter = 0;\n  var hostCloneCounter = 0;\n\n  function appendChildToContainerOrInstance(parentInstance, child) {\n    var index = parentInstance.children.indexOf(child);\n    if (index !== -1) {\n      parentInstance.children.splice(index, 1);\n    }\n    parentInstance.children.push(child);\n  }\n\n  function appendChildToContainer(parentInstance, child) {\n    if (typeof parentInstance.rootID !== 'string') {\n      // Some calls to this aren't typesafe.\n      // This helps surface mistakes in tests.\n      throw new Error('appendChildToContainer() first argument is not a container.');\n    }\n    appendChildToContainerOrInstance(parentInstance, child);\n  }\n\n  function appendChild(parentInstance, child) {\n    if (typeof parentInstance.rootID === 'string') {\n      // Some calls to this aren't typesafe.\n      // This helps surface mistakes in tests.\n      throw new Error('appendChild() first argument is not an instance.');\n    }\n    appendChildToContainerOrInstance(parentInstance, child);\n  }\n\n  function insertInContainerOrInstanceBefore(parentInstance, child, beforeChild) {\n    var index = parentInstance.children.indexOf(child);\n    if (index !== -1) {\n      parentInstance.children.splice(index, 1);\n    }\n    var beforeIndex = parentInstance.children.indexOf(beforeChild);\n    if (beforeIndex === -1) {\n      throw new Error('This child does not exist.');\n    }\n    parentInstance.children.splice(beforeIndex, 0, child);\n  }\n\n  function insertInContainerBefore(parentInstance, child, beforeChild) {\n    if (typeof parentInstance.rootID !== 'string') {\n      // Some calls to this aren't typesafe.\n      // This helps surface mistakes in tests.\n      throw new Error('insertInContainerBefore() first argument is not a container.');\n    }\n    insertInContainerOrInstanceBefore(parentInstance, child, beforeChild);\n  }\n\n  function insertBefore(parentInstance, child, beforeChild) {\n    if (typeof parentInstance.rootID === 'string') {\n      // Some calls to this aren't typesafe.\n      // This helps surface mistakes in tests.\n      throw new Error('insertBefore() first argument is not an instance.');\n    }\n    insertInContainerOrInstanceBefore(parentInstance, child, beforeChild);\n  }\n\n  function removeChildFromContainerOrInstance(parentInstance, child) {\n    var index = parentInstance.children.indexOf(child);\n    if (index === -1) {\n      throw new Error('This child does not exist.');\n    }\n    parentInstance.children.splice(index, 1);\n  }\n\n  function removeChildFromContainer(parentInstance, child) {\n    if (typeof parentInstance.rootID !== 'string') {\n      // Some calls to this aren't typesafe.\n      // This helps surface mistakes in tests.\n      throw new Error('removeChildFromContainer() first argument is not a container.');\n    }\n    removeChildFromContainerOrInstance(parentInstance, child);\n  }\n\n  function removeChild(parentInstance, child) {\n    if (typeof parentInstance.rootID === 'string') {\n      // Some calls to this aren't typesafe.\n      // This helps surface mistakes in tests.\n      throw new Error('removeChild() first argument is not an instance.');\n    }\n    removeChildFromContainerOrInstance(parentInstance, child);\n  }\n\n  function cloneInstance(instance, updatePayload, type, oldProps, newProps, internalInstanceHandle, keepChildren, recyclableInstance) {\n    var clone = {\n      id: instance.id,\n      type: type,\n      children: keepChildren ? instance.children : [],\n      text: shouldSetTextContent(type, newProps) ? newProps.children + '' : null,\n      prop: newProps.prop,\n      hidden: newProps.hidden === true\n    };\n    Object.defineProperty(clone, 'id', {\n      value: clone.id,\n      enumerable: false\n    });\n    Object.defineProperty(clone, 'text', {\n      value: clone.text,\n      enumerable: false\n    });\n    hostCloneCounter++;\n    return clone;\n  }\n\n  function shouldSetTextContent(type, props) {\n    if (type === 'errorInBeginPhase') {\n      throw new Error('Error in host config.');\n    }\n    return typeof props.children === 'string' || typeof props.children === 'number';\n  }\n\n  var elapsedTimeInMs = 0;\n\n  var sharedHostConfig = {\n    getRootHostContext: function () {\n      return NO_CONTEXT;\n    },\n    getChildHostContext: function () {\n      return NO_CONTEXT;\n    },\n    getPublicInstance: function (instance) {\n      return instance;\n    },\n    createInstance: function (type, props) {\n      if (type === 'errorInCompletePhase') {\n        throw new Error('Error in host config.');\n      }\n      var inst = {\n        id: instanceCounter++,\n        type: type,\n        children: [],\n        text: shouldSetTextContent(type, props) ? props.children + '' : null,\n        prop: props.prop,\n        hidden: props.hidden === true\n      };\n      // Hide from unit tests\n      Object.defineProperty(inst, 'id', { value: inst.id, enumerable: false });\n      Object.defineProperty(inst, 'text', {\n        value: inst.text,\n        enumerable: false\n      });\n      return inst;\n    },\n    appendInitialChild: function (parentInstance, child) {\n      parentInstance.children.push(child);\n    },\n    finalizeInitialChildren: function (domElement, type, props) {\n      return false;\n    },\n    prepareUpdate: function (instance, type, oldProps, newProps) {\n      if (type === 'errorInCompletePhase') {\n        throw new Error('Error in host config.');\n      }\n      if (oldProps === null) {\n        throw new Error('Should have old props');\n      }\n      if (newProps === null) {\n        throw new Error('Should have new props');\n      }\n      hostDiffCounter++;\n      return UPDATE_SIGNAL;\n    },\n\n\n    shouldSetTextContent: shouldSetTextContent,\n\n    shouldDeprioritizeSubtree: function (type, props) {\n      return !!props.hidden;\n    },\n    createTextInstance: function (text, rootContainerInstance, hostContext, internalInstanceHandle) {\n      var inst = { text: text, id: instanceCounter++, hidden: false };\n      // Hide from unit tests\n      Object.defineProperty(inst, 'id', { value: inst.id, enumerable: false });\n      return inst;\n    },\n    scheduleDeferredCallback: function (callback, options) {\n      if (scheduledCallback) {\n        throw new Error('Scheduling a callback twice is excessive. Instead, keep track of ' + 'whether the callback has already been scheduled.');\n      }\n      scheduledCallback = callback;\n      if (typeof options === 'object' && options !== null && typeof options.timeout === 'number') {\n        var newTimeout = options.timeout;\n        if (scheduledCallbackTimeout === -1 || scheduledCallbackTimeout > newTimeout) {\n          scheduledCallbackTimeout = elapsedTimeInMs + newTimeout;\n        }\n      }\n      return 0;\n    },\n    cancelDeferredCallback: function () {\n      if (scheduledCallback === null) {\n        throw new Error('No callback is scheduled.');\n      }\n      scheduledCallback = null;\n      scheduledCallbackTimeout = -1;\n    },\n\n\n    shouldYield: shouldYield,\n\n    scheduleTimeout: setTimeout,\n    cancelTimeout: clearTimeout,\n    noTimeout: -1,\n    schedulePassiveEffects: function (callback) {\n      if (scheduledCallback) {\n        throw new Error('Scheduling a callback twice is excessive. Instead, keep track of ' + 'whether the callback has already been scheduled.');\n      }\n      scheduledPassiveCallback = callback;\n    },\n    cancelPassiveEffects: function () {\n      if (scheduledPassiveCallback === null) {\n        throw new Error('No passive effects callback is scheduled.');\n      }\n      scheduledPassiveCallback = null;\n    },\n    prepareForCommit: function () {},\n    resetAfterCommit: function () {},\n    now: function () {\n      return elapsedTimeInMs;\n    },\n\n\n    isPrimaryRenderer: true,\n    supportsHydration: false\n  };\n\n  var hostConfig = useMutation ? _assign({}, sharedHostConfig, {\n\n    supportsMutation: true,\n    supportsPersistence: false,\n\n    commitMount: function (instance, type, newProps) {\n      // Noop\n    },\n    commitUpdate: function (instance, updatePayload, type, oldProps, newProps) {\n      if (oldProps === null) {\n        throw new Error('Should have old props');\n      }\n      hostUpdateCounter++;\n      instance.prop = newProps.prop;\n      instance.hidden = newProps.hidden === true;\n      if (shouldSetTextContent(type, newProps)) {\n        instance.text = newProps.children + '';\n      }\n    },\n    commitTextUpdate: function (textInstance, oldText, newText) {\n      hostUpdateCounter++;\n      textInstance.text = newText;\n    },\n\n\n    appendChild: appendChild,\n    appendChildToContainer: appendChildToContainer,\n    insertBefore: insertBefore,\n    insertInContainerBefore: insertInContainerBefore,\n    removeChild: removeChild,\n    removeChildFromContainer: removeChildFromContainer,\n\n    hideInstance: function (instance) {\n      instance.hidden = true;\n    },\n    hideTextInstance: function (textInstance) {\n      textInstance.hidden = true;\n    },\n    unhideInstance: function (instance, props) {\n      if (!props.hidden) {\n        instance.hidden = false;\n      }\n    },\n    unhideTextInstance: function (textInstance, text) {\n      textInstance.hidden = false;\n    },\n    resetTextContent: function (instance) {\n      instance.text = null;\n    }\n  }) : _assign({}, sharedHostConfig, {\n    supportsMutation: false,\n    supportsPersistence: true,\n\n    cloneInstance: cloneInstance,\n\n    createContainerChildSet: function (container) {\n      return [];\n    },\n    appendChildToContainerChildSet: function (childSet, child) {\n      childSet.push(child);\n    },\n    finalizeContainerChildren: function (container, newChildren) {},\n    replaceContainerChildren: function (container, newChildren) {\n      container.children = newChildren;\n    },\n    cloneHiddenInstance: function (instance, type, props, internalInstanceHandle) {\n      var clone = cloneInstance(instance, null, type, props, props, internalInstanceHandle, true, null);\n      clone.hidden = true;\n      return clone;\n    },\n    cloneUnhiddenInstance: function (instance, type, props, internalInstanceHandle) {\n      var clone = cloneInstance(instance, null, type, props, props, internalInstanceHandle, true, null);\n      clone.hidden = props.hidden;\n      return clone;\n    },\n    createHiddenTextInstance: function (text, rootContainerInstance, hostContext, internalInstanceHandle) {\n      var inst = { text: text, id: instanceCounter++, hidden: true };\n      // Hide from unit tests\n      Object.defineProperty(inst, 'id', {\n        value: inst.id,\n        enumerable: false\n      });\n      return inst;\n    }\n  });\n\n  var NoopRenderer = reconciler(hostConfig);\n\n  var rootContainers = new Map();\n  var roots = new Map();\n  var DEFAULT_ROOT_ID = '<default>';\n\n  var yieldedValues = null;\n\n  var didYield = void 0;\n  var unitsRemaining = void 0;\n\n  function shouldYield() {\n    if (scheduledCallbackTimeout === -1 || elapsedTimeInMs > scheduledCallbackTimeout) {\n      return false;\n    } else {\n      if (didYield || yieldedValues !== null) {\n        return true;\n      }\n      if (unitsRemaining-- > 0) {\n        return false;\n      }\n      didYield = true;\n      return true;\n    }\n  }\n\n  function flushUnitsOfWork(n) {\n    var cb, values;\n    return regeneratorRuntime.wrap(function flushUnitsOfWork$(_context) {\n      while (1) {\n        switch (_context.prev = _context.next) {\n          case 0:\n            unitsRemaining = n + 1;\n            didYield = false;\n            _context.prev = 2;\n\n          case 3:\n            if (!(!didYield && scheduledCallback !== null)) {\n              _context.next = 14;\n              break;\n            }\n\n            cb = scheduledCallback;\n\n            scheduledCallback = null;\n            cb();\n\n            if (!(yieldedValues !== null)) {\n              _context.next = 12;\n              break;\n            }\n\n            values = yieldedValues;\n\n            yieldedValues = null;\n            _context.next = 12;\n            return values;\n\n          case 12:\n            _context.next = 3;\n            break;\n\n          case 14:\n            _context.prev = 14;\n\n            unitsRemaining = -1;\n            didYield = false;\n            return _context.finish(14);\n\n          case 18:\n          case 'end':\n            return _context.stop();\n        }\n      }\n    }, _marked, this, [[2,, 14, 18]]);\n  }\n\n  function childToJSX(child, text) {\n    if (text !== null) {\n      return text;\n    }\n    if (child === null) {\n      return null;\n    }\n    if (typeof child === 'string') {\n      return child;\n    }\n    if (Array.isArray(child)) {\n      if (child.length === 0) {\n        return null;\n      }\n      if (child.length === 1) {\n        return childToJSX(child[0], null);\n      }\n      // $FlowFixMe\n      var _children = child.map(function (c) {\n        return childToJSX(c, null);\n      });\n      if (_children.every(function (c) {\n        return typeof c === 'string' || typeof c === 'number';\n      })) {\n        return _children.join('');\n      }\n      return _children;\n    }\n    if (Array.isArray(child.children)) {\n      // This is an instance.\n      var instance = child;\n      var _children2 = childToJSX(instance.children, instance.text);\n      var props = { prop: instance.prop };\n      if (instance.hidden) {\n        props.hidden = true;\n      }\n      if (_children2 !== null) {\n        props.children = _children2;\n      }\n      return {\n        $$typeof: REACT_ELEMENT_TYPE,\n        type: instance.type,\n        key: null,\n        ref: null,\n        props: props,\n        _owner: null,\n        _store: {}\n      };\n    }\n    // This is a text instance\n    var textInstance = child;\n    if (textInstance.hidden) {\n      return '';\n    }\n    return textInstance.text;\n  }\n\n  var ReactNoop = {\n    getChildren: function () {\n      var rootID = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_ROOT_ID;\n\n      var container = rootContainers.get(rootID);\n      if (container) {\n        return container.children;\n      } else {\n        return null;\n      }\n    },\n    getOrCreateRootContainer: function () {\n      var rootID = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_ROOT_ID;\n      var isConcurrent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n\n      var root = roots.get(rootID);\n      if (!root) {\n        var container = { rootID: rootID, children: [] };\n        rootContainers.set(rootID, container);\n        root = NoopRenderer.createContainer(container, isConcurrent, false);\n        roots.set(rootID, root);\n      }\n      return root.current.stateNode.containerInfo;\n    },\n    getChildrenAsJSX: function () {\n      var rootID = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_ROOT_ID;\n\n      var children = childToJSX(ReactNoop.getChildren(rootID), null);\n      if (children === null) {\n        return null;\n      }\n      if (Array.isArray(children)) {\n        return {\n          $$typeof: REACT_ELEMENT_TYPE,\n          type: REACT_FRAGMENT_TYPE,\n          key: null,\n          ref: null,\n          props: { children: children },\n          _owner: null,\n          _store: {}\n        };\n      }\n      return children;\n    },\n    createPortal: function (children, container) {\n      var key = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;\n\n      return createPortal(children, container, null, key);\n    },\n\n\n    // Shortcut for testing a single root\n    render: function (element, callback) {\n      ReactNoop.renderToRootWithID(element, DEFAULT_ROOT_ID, callback);\n    },\n    renderLegacySyncRoot: function (element, callback) {\n      var rootID = DEFAULT_ROOT_ID;\n      var isConcurrent = false;\n      var container = ReactNoop.getOrCreateRootContainer(rootID, isConcurrent);\n      var root = roots.get(container.rootID);\n      NoopRenderer.updateContainer(element, root, null, callback);\n    },\n    renderToRootWithID: function (element, rootID, callback) {\n      var isConcurrent = true;\n      var container = ReactNoop.getOrCreateRootContainer(rootID, isConcurrent);\n      var root = roots.get(container.rootID);\n      NoopRenderer.updateContainer(element, root, null, callback);\n    },\n    unmountRootWithID: function (rootID) {\n      var root = roots.get(rootID);\n      if (root) {\n        NoopRenderer.updateContainer(null, root, null, function () {\n          roots.delete(rootID);\n          rootContainers.delete(rootID);\n        });\n      }\n    },\n    findInstance: function (componentOrElement) {\n      if (componentOrElement == null) {\n        return null;\n      }\n      // Unsound duck typing.\n      var component = componentOrElement;\n      if (typeof component.id === 'number') {\n        return component;\n      }\n      {\n        return NoopRenderer.findHostInstanceWithWarning(component, 'findInstance');\n      }\n      return NoopRenderer.findHostInstance(component);\n    },\n    flushDeferredPri: function () {\n      var timeout = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : Infinity;\n\n      // The legacy version of this function decremented the timeout before\n      // returning the new time.\n      // TODO: Convert tests to use flushUnitsOfWork or flushAndYield instead.\n      var n = timeout / 5 - 1;\n\n      var values = [];\n      // eslint-disable-next-line no-for-of-loops/no-for-of-loops\n      var _iteratorNormalCompletion = true;\n      var _didIteratorError = false;\n      var _iteratorError = undefined;\n\n      try {\n        for (var _iterator = flushUnitsOfWork(n)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n          var value = _step.value;\n\n          values.push.apply(values, value);\n        }\n      } catch (err) {\n        _didIteratorError = true;\n        _iteratorError = err;\n      } finally {\n        try {\n          if (!_iteratorNormalCompletion && _iterator.return) {\n            _iterator.return();\n          }\n        } finally {\n          if (_didIteratorError) {\n            throw _iteratorError;\n          }\n        }\n      }\n\n      return values;\n    },\n    flush: function () {\n      return ReactNoop.flushUnitsOfWork(Infinity);\n    },\n    flushAndYield: function () {\n      var unitsOfWork = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : Infinity;\n\n      return flushUnitsOfWork(unitsOfWork);\n    },\n    flushUnitsOfWork: function (n) {\n      var values = yieldedValues || [];\n      yieldedValues = null;\n      // eslint-disable-next-line no-for-of-loops/no-for-of-loops\n      var _iteratorNormalCompletion2 = true;\n      var _didIteratorError2 = false;\n      var _iteratorError2 = undefined;\n\n      try {\n        for (var _iterator2 = flushUnitsOfWork(n)[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {\n          var value = _step2.value;\n\n          values.push.apply(values, value);\n        }\n      } catch (err) {\n        _didIteratorError2 = true;\n        _iteratorError2 = err;\n      } finally {\n        try {\n          if (!_iteratorNormalCompletion2 && _iterator2.return) {\n            _iterator2.return();\n          }\n        } finally {\n          if (_didIteratorError2) {\n            throw _iteratorError2;\n          }\n        }\n      }\n\n      return values;\n    },\n    flushThrough: function (expected) {\n      var actual = [];\n      if (expected.length !== 0) {\n        // eslint-disable-next-line no-for-of-loops/no-for-of-loops\n        var _iteratorNormalCompletion3 = true;\n        var _didIteratorError3 = false;\n        var _iteratorError3 = undefined;\n\n        try {\n          for (var _iterator3 = flushUnitsOfWork(Infinity)[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {\n            var value = _step3.value;\n\n            actual.push.apply(actual, value);\n            if (actual.length >= expected.length) {\n              break;\n            }\n          }\n        } catch (err) {\n          _didIteratorError3 = true;\n          _iteratorError3 = err;\n        } finally {\n          try {\n            if (!_iteratorNormalCompletion3 && _iterator3.return) {\n              _iterator3.return();\n            }\n          } finally {\n            if (_didIteratorError3) {\n              throw _iteratorError3;\n            }\n          }\n        }\n      }\n      expect(actual).toEqual(expected);\n    },\n    flushNextYield: function () {\n      var actual = null;\n      // eslint-disable-next-line no-for-of-loops/no-for-of-loops\n      var _iteratorNormalCompletion4 = true;\n      var _didIteratorError4 = false;\n      var _iteratorError4 = undefined;\n\n      try {\n        for (var _iterator4 = flushUnitsOfWork(Infinity)[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) {\n          var value = _step4.value;\n\n          actual = value;\n          break;\n        }\n      } catch (err) {\n        _didIteratorError4 = true;\n        _iteratorError4 = err;\n      } finally {\n        try {\n          if (!_iteratorNormalCompletion4 && _iterator4.return) {\n            _iterator4.return();\n          }\n        } finally {\n          if (_didIteratorError4) {\n            throw _iteratorError4;\n          }\n        }\n      }\n\n      return actual !== null ? actual : [];\n    },\n    flushWithHostCounters: function (fn) {\n      hostDiffCounter = 0;\n      hostUpdateCounter = 0;\n      hostCloneCounter = 0;\n      try {\n        ReactNoop.flush();\n        return useMutation ? {\n          hostDiffCounter: hostDiffCounter,\n          hostUpdateCounter: hostUpdateCounter\n        } : {\n          hostDiffCounter: hostDiffCounter,\n          hostCloneCounter: hostCloneCounter\n        };\n      } finally {\n        hostDiffCounter = 0;\n        hostUpdateCounter = 0;\n        hostCloneCounter = 0;\n      }\n    },\n    expire: function (ms) {\n      ReactNoop.advanceTime(ms);\n      return ReactNoop.flushExpired();\n    },\n    advanceTime: function (ms) {\n      elapsedTimeInMs += ms;\n    },\n    flushExpired: function () {\n      return ReactNoop.flushUnitsOfWork(0);\n    },\n    yield: function (value) {\n      if (yieldedValues === null) {\n        yieldedValues = [value];\n      } else {\n        yieldedValues.push(value);\n      }\n    },\n    clearYields: function () {\n      var values = yieldedValues;\n      yieldedValues = null;\n      return values;\n    },\n    hasScheduledCallback: function () {\n      return !!scheduledCallback;\n    },\n\n\n    batchedUpdates: NoopRenderer.batchedUpdates,\n\n    deferredUpdates: NoopRenderer.deferredUpdates,\n\n    unbatchedUpdates: NoopRenderer.unbatchedUpdates,\n\n    interactiveUpdates: NoopRenderer.interactiveUpdates,\n\n    // maybe this should exist only in the test file\n    act: function (callback) {\n      // note: keep these warning messages in sync with\n      // ReactTestRenderer.js and ReactTestUtils.js\n      var result = NoopRenderer.batchedUpdates(callback);\n      {\n        if (result !== undefined) {\n          var addendum = void 0;\n          if (result !== null && typeof result.then === 'function') {\n            addendum = \"\\n\\nIt looks like you wrote ReactNoop.act(async () => ...) or returned a Promise from it's callback. \" + 'Putting asynchronous logic inside ReactNoop.act(...) is not supported.\\n';\n          } else {\n            addendum = ' You returned: ' + result;\n          }\n          warningWithoutStack$1(false, 'The callback passed to ReactNoop.act(...) function must not return anything.%s', addendum);\n        }\n      }\n      ReactNoop.flushPassiveEffects();\n      // we want the user to not expect a return,\n      // but we want to warn if they use it like they can await on it.\n      return {\n        then: function () {\n          {\n            warningWithoutStack$1(false, 'Do not await the result of calling ReactNoop.act(...), it is not a Promise.');\n          }\n        }\n      };\n    },\n    flushSync: function (fn) {\n      yieldedValues = [];\n      NoopRenderer.flushSync(fn);\n      return yieldedValues;\n    },\n    flushPassiveEffects: function () {\n      // Trick to flush passive effects without exposing an internal API:\n      // Create a throwaway root and schedule a dummy update on it.\n      var rootID = 'bloopandthenmoreletterstoavoidaconflict';\n      var container = { rootID: rootID, children: [] };\n      rootContainers.set(rootID, container);\n      var root = NoopRenderer.createContainer(container, true, false);\n      NoopRenderer.updateContainer(null, root, null, null);\n    },\n\n\n    // Logs the current state of the tree.\n    dumpTree: function () {\n      var _console;\n\n      var rootID = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_ROOT_ID;\n\n      var root = roots.get(rootID);\n      var rootContainer = rootContainers.get(rootID);\n      if (!root || !rootContainer) {\n        console.log('Nothing rendered yet.');\n        return;\n      }\n\n      var bufferedLog = [];\n      function log() {\n        for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {\n          args[_key] = arguments[_key];\n        }\n\n        bufferedLog.push.apply(bufferedLog, args.concat(['\\n']));\n      }\n\n      function logHostInstances(children, depth) {\n        for (var i = 0; i < children.length; i++) {\n          var child = children[i];\n          var indent = '  '.repeat(depth);\n          if (typeof child.text === 'string') {\n            log(indent + '- ' + child.text);\n          } else {\n            // $FlowFixMe - The child should've been refined now.\n            log(indent + '- ' + child.type + '#' + child.id);\n            // $FlowFixMe - The child should've been refined now.\n            logHostInstances(child.children, depth + 1);\n          }\n        }\n      }\n      function logContainer(container, depth) {\n        log('  '.repeat(depth) + '- [root#' + container.rootID + ']');\n        logHostInstances(container.children, depth + 1);\n      }\n\n      function logUpdateQueue(updateQueue, depth) {\n        log('  '.repeat(depth + 1) + 'QUEUED UPDATES');\n        var firstUpdate = updateQueue.firstUpdate;\n        if (!firstUpdate) {\n          return;\n        }\n\n        log('  '.repeat(depth + 1) + '~', '[' + firstUpdate.expirationTime + ']');\n        while (firstUpdate.next) {\n          log('  '.repeat(depth + 1) + '~', '[' + firstUpdate.expirationTime + ']');\n        }\n      }\n\n      function logFiber(fiber, depth) {\n        log('  '.repeat(depth) + '- ' + (\n        // need to explicitly coerce Symbol to a string\n        fiber.type ? fiber.type.name || fiber.type.toString() : '[root]'), '[' + fiber.childExpirationTime + (fiber.pendingProps ? '*' : '') + ']');\n        if (fiber.updateQueue) {\n          logUpdateQueue(fiber.updateQueue, depth);\n        }\n        // const childInProgress = fiber.progressedChild;\n        // if (childInProgress && childInProgress !== fiber.child) {\n        //   log(\n        //     '  '.repeat(depth + 1) + 'IN PROGRESS: ' + fiber.pendingWorkPriority,\n        //   );\n        //   logFiber(childInProgress, depth + 1);\n        //   if (fiber.child) {\n        //     log('  '.repeat(depth + 1) + 'CURRENT');\n        //   }\n        // } else if (fiber.child && fiber.updateQueue) {\n        //   log('  '.repeat(depth + 1) + 'CHILDREN');\n        // }\n        if (fiber.child) {\n          logFiber(fiber.child, depth + 1);\n        }\n        if (fiber.sibling) {\n          logFiber(fiber.sibling, depth);\n        }\n      }\n\n      log('HOST INSTANCES:');\n      logContainer(rootContainer, 0);\n      log('FIBERS:');\n      logFiber(root.current, 0);\n\n      (_console = console).log.apply(_console, bufferedLog);\n    },\n    flushWithoutCommitting: function (expectedFlush) {\n      var rootID = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_ROOT_ID;\n\n      var root = roots.get(rootID);\n      var expiration = NoopRenderer.computeUniqueAsyncExpiration();\n      var batch = {\n        _defer: true,\n        _expirationTime: expiration,\n        _onComplete: function () {\n          root.firstBatch = null;\n        },\n        _next: null\n      };\n      root.firstBatch = batch;\n      var actual = ReactNoop.flush();\n      expect(actual).toEqual(expectedFlush);\n      return function (expectedCommit) {\n        batch._defer = false;\n        NoopRenderer.flushRoot(root, expiration);\n        expect(yieldedValues).toEqual(expectedCommit);\n      };\n    },\n    getRoot: function () {\n      var rootID = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_ROOT_ID;\n\n      return roots.get(rootID);\n    }\n  };\n\n  return ReactNoop;\n}\n\n/**\n * This is a renderer of React that doesn't have a render target output.\n * It is useful to demonstrate the internals of the reconciler in isolation\n * and for testing semantics of reconciliation separate from the host\n * environment.\n */\n\nvar ReactNoop = createReactNoop(ReactFiberReconciler, // reconciler\ntrue // useMutation\n);\n\n\n\nvar ReactNoop$2 = Object.freeze({\n\tdefault: ReactNoop\n});\n\nvar ReactNoop$3 = ( ReactNoop$2 && ReactNoop ) || ReactNoop$2;\n\n// TODO: decide on the top-level export form.\n// This is hacky but makes it work with both Rollup and Jest.\nvar reactNoopRenderer = ReactNoop$3.default || ReactNoop$3;\n\nmodule.exports = reactNoopRenderer;\n  })();\n}\n"
  },
  {
    "path": "vendors/react-noop-renderer/index.js",
    "content": "'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n  module.exports = require('./cjs/react-noop-renderer.production.min.js');\n} else {\n  module.exports = require('./cjs/react-noop-renderer.development.js');\n}\n"
  },
  {
    "path": "vendors/react-noop-renderer/package.json",
    "content": "{\n  \"name\": \"react-noop-renderer\",\n  \"version\": \"16.0.0\",\n  \"private\": true,\n  \"description\": \"React package for testing the Fiber reconciler.\",\n  \"main\": \"index.js\",\n  \"repository\": {\n    \"type\" : \"git\",\n    \"url\" : \"https://github.com/facebook/react.git\",\n    \"directory\": \"packages/react-noop-renderer\"\n  },\n  \"license\": \"MIT\",\n  \"dependencies\": {\n    \"object-assign\": \"^4.1.1\",\n    \"prop-types\": \"^15.6.2\",\n    \"regenerator-runtime\": \"^0.11.0\",\n    \"react-reconciler\": \"*\",\n    \"react-stream\": \"*\"\n  },\n  \"peerDependencies\": {\n    \"react\": \"^16.0.0\"\n  },\n  \"files\": [\n    \"LICENSE\",\n    \"README.md\",\n    \"build-info.json\",\n    \"index.js\",\n    \"persistent.js\",\n    \"server.js\",\n    \"cjs/\"\n  ]\n}\n"
  },
  {
    "path": "vendors/react-noop-renderer/persistent.js",
    "content": "'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n  module.exports = require('./cjs/react-noop-renderer-persistent.production.min.js');\n} else {\n  module.exports = require('./cjs/react-noop-renderer-persistent.development.js');\n}\n"
  },
  {
    "path": "vendors/react-noop-renderer/server.js",
    "content": "'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n  module.exports = require('./cjs/react-noop-renderer-server.production.min.js');\n} else {\n  module.exports = require('./cjs/react-noop-renderer-server.development.js');\n}\n"
  }
]