[
  {
    "path": ".changeset/README.md",
    "content": "# Changesets\n\nHello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works\nwith multi-package repos, or single-package repos to help you version and publish your code. You can\nfind the full documentation for it [in our repository](https://github.com/changesets/changesets)\n\nWe have a quick list of common questions to get you started engaging with this project in\n[our documentation](https://github.com/changesets/changesets/blob/master/docs/common-questions.md)\n"
  },
  {
    "path": ".changeset/config.json",
    "content": "{\n    \"changelog\": [\"@changesets/changelog-github\", { \"repo\": \"mobxjs/mobx\" }],\n    \"commit\": false,\n    \"access\": \"public\",\n    \"baseBranch\": \"main\",\n    \"___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH\": {\n        \"onlyUpdatePeerDependentsWhenOutOfRange\": true\n    }\n}\n"
  },
  {
    "path": ".editorconfig",
    "content": "root = true\n\n[*]\nend_of_line = lf\ncharset = utf-8\nindent_style = space\ntab_width = 4\n\n[{package.json}]\nindent_style = space\nindent_size = 2\n"
  },
  {
    "path": ".eslintrc.js",
    "content": "module.exports = {\n    parser: \"@typescript-eslint/parser\",\n    plugins: [\"@typescript-eslint\"],\n    extends: \"eslint:recommended\",\n    ignorePatterns: [\"**/__tests__/**/*\"],\n    env: {\n        browser: true,\n        es6: true,\n        node: true\n    },\n    parserOptions: {\n        ecmaVersion: 6,\n        sourceType: \"module\"\n    },\n    rules: {\n        \"no-fallthrough\": \"off\",\n        \"no-constant-condition\": \"off\",\n        curly: \"error\",\n        \"getter-return\": \"off\",\n        \"no-console\": \"off\",\n        \"no-var\": \"error\",\n        \"no-undef\": \"off\",\n        \"no-extra-semi\": \"off\", // doesn't get along well with prettier\n        \"no-unused-vars\": \"off\", // got typescript for that,\n        \"no-redeclare\": \"off\", // No idea what it does, but it dies\n        \"require-yield\": \"off\" // Doesn't work with TS\n    },\n    globals: {\n        process: \"readable\",\n        global: \"readable\",\n        console: \"readable\",\n        setTimeout: \"readable\",\n        clearTimeout: \"readable\",\n        module: \"writable\"\n    }\n}\n"
  },
  {
    "path": ".github/FUNDING.yml",
    "content": "open_collective: mobx\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/bug.md",
    "content": "---\nname: 🐛 Reporting a Bug\nabout: Open a new issue if something isn't working as expected.\nlabels: 🐛 bug\n---\n\n<!--\n  Thanks for filing an issue on MobX!\n\n  Please make sure that you include the following information to ensure that your issue is actionable.\n\n  If you don't follow the template, your issue may end up being closed without anyone looking at it carefully, because it is not actionable for us without the information in this template.\n-->\n\n**Intended outcome:**\n\n<!--\nWhat you were trying to accomplish when the bug occurred, and as much code as possible related to the source of the problem.\n-->\n\n**Actual outcome:**\n\n<!--\nA description of what happened, including a screenshot or copy-paste of any related error messages, logs, or other output that might be related. Places to look for information include your browser console, server console, and network logs. Please avoid non-specific phrases like “didn’t work” or “broke”.\n-->\n\n**How to reproduce the issue:**\n\n<!--\nPlease create a reproduction and link to it here. You can use the following starters:\n- React: https://codesandbox.io/s/minimal-mobx-react-project-ppgml\n- React Native: https://snack.expo.dev/vEF39Ohnb\n\nIf the issue is more complicated or not reproducible with React, feel free to create your CodeSandbox or your own GitHub repo with the code.\n\nInstructions for how the issue can be reproduced by a maintainer or contributor. Be as specific as possible, and only mention what is necessary to reproduce the bug. If possible, try to isolate the exact circumstances in which the bug occurs and avoid speculation over what the cause might be. Help us so we can help you quickly.\n-->\n\n**Versions**\n\n<!--\nIf you are unable to use CodeSandbox for whatever reasons, please list here all relevant dependencies\n\nIf you encounter the issue after upgrading from MobX 4/5 to MobX 6, make sure you've applied the migration guide: https://mobx.js.org/migrating-from-4-or-5.html\n-->\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/config.yml",
    "content": "blank_issues_enabled: false\ncontact_links:\n  - name: ✨ Feature Request / idea\n    url: https://github.com/mobxjs/mobx/discussions/new\n    about: Missing something in MobX? Let us know.\n  - name: 💬 Question / Discussion\n    about: Feel free to ask anything\n    url: https://github.com/mobxjs/mobx/discussions/new\n  - name: 📖 View documentation\n    url: https://mobx.js.org\n    about: Official Mobx documentation    \n  - name: ❓ StackOverflow\n    url: https://stackoverflow.com/questions/tagged/mobx\n    about: Ask question or find answers on Stack overflow"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/documentation.md",
    "content": "---\nname: ✏ Documentation improvement\nabout: Please open the PR instead!\nlabels: 📖 documentation\n---\n\nDocumentation lives in the `/docs` folder. Please, send in PR directly with a change instead of describing what you want to change.\n\nAsk here only if your change is bigger and there is a chance for rejecting it.\n"
  },
  {
    "path": ".github/PULL_REQUEST_TEMPLATE.md",
    "content": "<!--\n    Thanks for taking the effort to create a PR! 🙌\n\n    👋 Are you making a change to documentation only? Delete the rest of the template and go ahead.\n\n    👋 If you are creating an extensive PR, you might want to open an issue with your idea first in case there is a chance for rejecting it.\n\n    👋 If you intend to work on PR over several days, please, create [draft pull requests](https://github.blog/2019-02-14-introducing-draft-pull-requests/) instead.\n\n    👇 Please look at the following checklist to ensure that your PR can be accepted quickly:\n-->\n\n### Code change checklist\n\n-   [ ] Added/updated unit tests\n-   [ ] Updated `/docs`. For new functionality, at least `API.md` should be updated\n-   [ ] Verified that there is no significant performance drop (`yarn mobx test:performance`)\n\n<!--\n    Feel free to ask help with any of these boxes!\n-->\n"
  },
  {
    "path": ".github/dependabot.yml",
    "content": "version: 2\nupdates:\n  - package-ecosystem: \"github-actions\"\n    directory: \"/\"\n    schedule:\n      interval: \"weekly\"\n"
  },
  {
    "path": ".github/lock.yml",
    "content": "# Configuration for Lock Threads - https://github.com/dessant/lock-threads\n\n# Number of days of inactivity before a closed issue or pull request is locked\ndaysUntilLock: 60\n\n# Skip issues and pull requests created before a given timestamp. Timestamp must\n# follow ISO 8601 (`YYYY-MM-DD`). Set to `false` to disable\nskipCreatedBefore: 2019-01-01\n\n# Issues and pull requests with these labels will be ignored. Set to `[]` to disable\nexemptLabels: []\n\n# Label to add before locking, such as `outdated`. Set to `false` to disable\nlockLabel: false\n\n# Comment to post before locking. Set to `false` to disable\nlockComment: >\n  This thread has been automatically locked since there has not been\n  any recent activity after it was closed. Please open a new issue for\n  related bugs or questions.\n\n# Assign `resolved` as the reason for locking. Set to `false` to disable\nsetLockReason: true\n\n# Limit to only `issues` or `pulls`\nonly: issues\n"
  },
  {
    "path": ".github/stale.yml",
    "content": "# Number of days of inactivity before an issue becomes stale\ndaysUntilStale: 14\n# Number of days of inactivity before a stale issue is closed\ndaysUntilClose: 4\n# Issues with these labels will never be considered stale\nexemptLabels:\n    - 📌 pinned\n    - 💬 discuss\n    - 🍗 enhancement\n    - 📖 documentation\n    - 🔨 breaking-change\n    - 🚧 experimental\n    - 🙏 help wanted\n    - 👓 needs investigation\n    - ✋ on hold\n\n# Label to use when marking an issue as stale\nstaleLabel: 🚶 stale\n# Comment to post when marking an issue as stale. Set to `false` to disable\nmarkComment: >\n    This issue has been automatically marked as stale because it has not had\n    recent activity. It will be closed if no further activity occurs. Thank you\n    for your contributions.\n# Comment to post when closing a stale issue. Set to `false` to disable\ncloseComment: false\n# Limit to only `issues` or `pulls`\nonly: issues\n# Comment to post when removing the stale label.\nunmarkComment: >\n    This issue has been automatically unmarked as stale. Please disregard previous warnings.\n"
  },
  {
    "path": ".github/workflows/build_and_test.yml",
    "content": "name: Build and test\n\non:\n  push:\n    branches: [main]\n  pull_request:\n    branches: [main]\n  workflow_dispatch: {}\n\njobs:\n  build:\n    name: Build and test\n    runs-on: ubuntu-latest\n    steps:\n      - name: Checkout Repo\n        uses: actions/checkout@master\n\n      - name: Setup Node.js 22.x\n        uses: actions/setup-node@master\n        with:\n          node-version: 22.x\n\n      - name: Install Dependencies\n        run: yarn --frozen-lockfile --ignore-scripts\n\n      - name: Lint\n        run: yarn lint\n\n      - name: Build check\n        run: yarn lerna run build:check\n\n      - name: Build packages\n        run: yarn lerna run build:test\n\n      - name: Test\n        run: yarn test -i\n\n      - name: Test size\n        run: yarn lerna run test:size\n\n      - name: Test flow\n        run: yarn mobx test:flow\n\n      - name: Test performance\n        run: yarn mobx test:performance\n"
  },
  {
    "path": ".github/workflows/coveralls.yml",
    "content": "name: Coveralls\n\non: [\"push\"]\n\njobs:\n  mobx:\n    name: Packages coverage\n    runs-on: ubuntu-latest\n    steps:\n      - name: Checkout Repo\n        uses: actions/checkout@master\n        with:\n          # This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits\n          fetch-depth: 0\n\n      - name: Setup Node.js 22.x\n        uses: actions/setup-node@master\n        with:\n          node-version: 22.x\n\n      - name: Install Dependencies\n        run: yarn --frozen-lockfile --ignore-scripts\n\n      - name: Build packages\n        run: yarn lerna run build:test\n\n      # - name: Run Coverage\n      #   run: yarn coverage\n\n      # - name: Upload to coveralls\n      #   uses: coverallsapp/github-action@v2.3.6\n      #   with:\n      #     github-token: ${{ secrets.GITHUB_TOKEN }}\n"
  },
  {
    "path": ".github/workflows/release.yml",
    "content": "name: Release\n\non:\n  push:\n    branches:\n      - main\n\njobs:\n  release:\n    name: Release\n    runs-on: ubuntu-latest\n    steps:\n      - name: Checkout Repo\n        uses: actions/checkout@main\n        with:\n          # This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits\n          fetch-depth: 0\n\n      - name: Setup Node.js 22.x\n        uses: actions/setup-node@master\n        with:\n          node-version: 22.x\n\n      - name: Install Dependencies\n        run: yarn\n\n      - name: Build packages\n        run: yarn lerna run build\n\n      - name: Create Release Pull Request or Publish to npm\n        id: changesets\n        uses: changesets/action@v1\n        with:\n          # This expects you to have a script called release which does a build for your packages and calls changeset publish\n          publish: yarn release\n          commit: Version release\n          title: Next release\n        env:\n          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n          NPM_TOKEN: ${{ secrets.NPM_TOKEN }}\n"
  },
  {
    "path": ".gitignore",
    "content": ".tscache\n.settings\nnode_modules\nnpm-debug.log\ncoverage\ntest/babel-tests.js\ntest/typescript/typescript-tests.js\ndist/\n**/.idea/*\n!/.idea/icon.png\n!/.idea/vcs.xml\n.wp-build*/\n*.iml\n*.ipr\n*.iws\nyarn-error.log\nbuild/\n.DS_Store\n"
  },
  {
    "path": ".idea/vcs.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project version=\"4\">\n  <component name=\"IssueNavigationConfiguration\">\n    <option name=\"links\">\n      <list>\n        <IssueNavigationLink>\n          <option name=\"issueRegexp\" value=\"#(\\d+)\" />\n          <option name=\"linkRegexp\" value=\"https://github.com/mobxjs/mobx/issues/$1\" />\n        </IssueNavigationLink>\n      </list>\n    </option>\n  </component>\n  <component name=\"VcsDirectoryMappings\">\n    <mapping directory=\"\" vcs=\"Git\" />\n  </component>\n</project>"
  },
  {
    "path": ".prettierignore",
    "content": "/**/package.json\nwebsite/**/*\ndist/\ndocs/assets/\n*.yml\ncoverage"
  },
  {
    "path": ".prettierrc",
    "content": "{\n    \"printWidth\": 100,\n    \"semi\": false,\n    \"tabWidth\": 4,\n    \"singleQuote\": false,\n    \"trailingComma\": \"none\",\n    \"arrowParens\": \"avoid\",\n    \"useTabs\": false\n}\n"
  },
  {
    "path": ".vscode/launch.json",
    "content": "{\n    // Use IntelliSense to learn about possible attributes.\n    // Hover to view descriptions of existing attributes.\n    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387\n    \"version\": \"0.2.0\",\n    \"configurations\": [\n\n        {\n            \"type\": \"node\",\n            \"request\": \"launch\",\n            \"name\": \"debug unit test\",\n            \"program\": \"${workspaceRoot}/node_modules/jest/bin/jest.js\",\n            \"args\": [\"-i\", \"${file}\"],\n            // \"preLaunchTask\": \"tsc: build - tsconfig.json\"\n        },\n        {\n            \"type\": \"node\",\n            \"request\": \"launch\",\n            \"name\": \"debug perf test\",\n            \"program\": \"${file}\",\n            // \"preLaunchTask\": \"tsc: build - tsconfig.json\"\n        }\n    ]\n}"
  },
  {
    "path": ".vscode/settings.json",
    "content": "{\n    \"[typescript]\": {\n        \"editor.defaultFormatter\": \"esbenp.prettier-vscode\",\n        \"editor.formatOnSave\": true,\n        \"editor.formatOnPaste\": false\n    },\n    \"[javascript]\": {\n        \"editor.defaultFormatter\": \"esbenp.prettier-vscode\",\n        \"editor.formatOnSave\": true,\n        \"editor.formatOnPaste\": false\n    },\n    \"typescript.tsdk\": \"node_modules/typescript/lib\",\n    // \"javascript.validate.enable\": false // enable for flow\n    \"eslint.validate\": [\"javascript\", \"javascriptreact\", \"typescript\", \"typescriptreact\"],\n    \"fb.doctor.disabled-tests\": [\"CorporateNetworkDoctor\"],\n    \"cSpell.enabled\": true\n}\n"
  },
  {
    "path": ".watchmanconfig",
    "content": "{\n  \"ignore_dirs\": [\"node_modules\", \"_site\", \"dist\", \"coverage\"]\n}\n"
  },
  {
    "path": "CODE_OF_CONDUCT.md",
    "content": "Contributor Code of Conduct\n\nAs contributors and maintainers of the MobX project, we pledge to respect everyone who contributes by posting issues, updating documentation, submitting pull requests, providing feedback in comments, and any other activities.\n\nCommunication through GitHub, Gitter, email or any other channel must be constructive and never resort to personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.\n\nWe promise to extend courtesy and respect to everyone involved in this project regardless of gender, gender identity, sexual orientation, disability, age, race, ethnicity, religion, or level of experience. We expect anyone contributing to the project to do the same.\n\nIf any member of the community violates this code of conduct, the maintainers of the MobX project may take action, removing issues, comments, and PRs or blocking accounts as deemed appropriate.\n\nIf you are subject to or witness unacceptable behavior, or have any other concerns, please open an issue or send a direct message to [Michel](https://twitter.com/mweststrate) on Twitter.\n"
  },
  {
    "path": "CONTRIBUTING.md",
    "content": "# MobX Contributor Guide\n\nWelcome to a community of developers just like you, striving to create the best experience around MobX. We welcome anyone who wants to contribute or provide constructive feedback, no matter the age or level of experience.\n\nHere are some ways to contribute to the project, from easiest to most difficult:\n\n-   [Reporting bugs](#reporting-bugs)\n-   [Improving the documentation](#improving-the-documentation)\n-   [Responding to issues](#responding-to-issues)\n-   [Small bug fixes](#small-bug-fixes)\n\n## Issues\n\n### Reporting bugs\n\nIf you encounter a bug, please file an issue on GitHub via the repository of the sub-project you think contains the bug. If an issue you have is already reported, please add additional information or add a 👍 reaction to indicate your agreement.\n\nInclude in the issue a link to your reproduction. A couple good options are a small Github repo or a [CodeSandbox](https://codesandbox.io/s/minimal-mobx-react-project-ppgml).\n\nIf you have a more complicated issue where it is helpful to run it locally, you can download CodeSandbox template and work on it and then commit into your GitHub repo.\n\n### Improving the documentation\n\nImproving the documentation, examples, and other open source content can be the easiest way to contribute to the library. If you see a piece of content that can be better, open a PR with an improvement, no matter how small! If you would like to suggest a big change or major rewrite, we’d love to hear your ideas but please open an issue for discussion before writing the PR.\n\n### Responding to issues\n\nIn addition to reporting issues, a great way to contribute to MobX is to respond to other peoples' issues and try to identify the problem or help them work around it. If you’re interested in taking a more active role in this process, please go ahead and respond to issues.\n\n### Small bug fixes\n\nFor a small bug fix change (less than 20 lines of code changed), feel free to open a pull request. We’ll try to merge it as fast as possible and ideally publish a new release on the same day. The only requirement is, make sure you also add a test that verifies the bug you are trying to fix.\n\n#### Getting things running\n\n```\ngit clone git@github.com:mobxjs/mobx.git\ncd mobx\nyarn install\nyarn lerna run build\nyarn test\n```\n\n"
  },
  {
    "path": "LICENSE",
    "content": "The MIT License (MIT)\n\nCopyright (c) 2015 Michel Weststrate\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": "README.md",
    "content": "<img src=\"https://mobx.js.org/assets/mobx.png\" alt=\"logo\" height=\"120\" align=\"right\" />\n\n# MobX\n\n_Simple, scalable state management._\n\n[![npm version](https://badge.fury.io/js/mobx.svg)](https://badge.fury.io/js/mobx)\n[![OpenCollective](https://opencollective.com/mobx/backers/badge.svg)](docs/backers-sponsors.md#backers)\n[![OpenCollective](https://opencollective.com/mobx/sponsors/badge.svg)](docs/backers-sponsors.md#sponsors)\n[![Discuss on Github](https://img.shields.io/badge/discuss%20on-GitHub-orange)](https://github.com/mobxjs/mobx/discussions)\n[![Coverage Status](https://coveralls.io/repos/github/mobxjs/mobx/badge.svg?branch=main)](https://coveralls.io/github/mobxjs/mobx?branch=main)\n[![View changelog](https://img.shields.io/badge/changelogs.xyz-Explore%20Changelog-brightgreen)](https://changelogs.xyz/mobx)\n\n---\n\n## Documentation\n\nDocumentation can be found at **[mobx.js.org](https://mobx.js.org/)**.\n\n---\n\n## Sponsors\n\nMobX is made possible by the generosity of the sponsors below, and many other [individual backers](https://github.com/mobxjs/mobx/blob/main/docs/backers-sponsors.md#backers). Sponsoring directly impacts the longevity of this project.\n\n**🥇🥇 Platinum sponsors (\\$5000+ total contribution): 🥇🥇**\n\n<br/>\n<a href=\"https://www.guilded.gg/\"><img src=\"https://mobx.js.org/assets/guilded.jpg\" align=\"center\" width=\"100\" title=\"Guilded\" alt=\"Guilded\" /></a>\n<a href=\"https://www.canva.com/\"><img src=\"https://mobx.js.org/assets/canva.svg\" align=\"center\" width=\"100\" title=\"Canva\" alt=\"Canva\" /></a>\n<a href=\"https://www.getparallax.com/\"><img src=\"https://mobx.js.org/assets/parallax.png\" align=\"center\" width=\"100\" title=\"Parallax\" alt=\"Parallax\" /></a>\n\n**🥇 Gold sponsors (\\$2500+ total contribution):**\n\n<br/>\n<a href=\"https://www.one-beyond.com\"><img src=\"https://mobx.js.org/assets/dcsl.png\" align=\"center\" width=\"100\" title=\"One Beyond\" alt=\"One Beyond\"/></a>\n<a href=\"https://frontendmasters.com/\"><img src=\"https://mobx.js.org/assets/frontendmasters.jpg\" align=\"center\" width=\"100\" title=\"Frontend Masters\" alt=\"Frontend Masters\"></a>\n<a href=\"http://auctionfrontier.com/\"><img src=\"https://mobx.js.org/assets/auctionfrontier.jpeg\" align=\"center\" width=\"100\" title=\"Auction Frontier\" alt=\"Auction Frontier\"></a>\n<a href=\"https://www.codefirst.co.uk/\"><img src=\"https://mobx.js.org/assets/codefirst.png\" align=\"center\" width=\"100\" title=\"CodeFirst\" alt=\"CodeFirst\"/></a>\n<a href=\"https://modulz.app/\"><img src=\"https://mobx.js.org/assets/modulz.png\" align=\"center\" width=\"100\" title=\"Modulz\" alt=\"Modulz\"/></a>\n<a href=\"https://coinbase.com/\"><img src=\"https://mobx.js.org/assets/coinbase.jpeg\" align=\"center\" width=\"100\" title=\"Coinbase\" alt=\"Coinbase\" /></a>\n<a href=\"https://curology.com/blog/tech\"><img src=\"https://mobx.js.org/assets/curology.png\" align=\"center\" width=\"100\" title=\"Curology\" alt=\"Curology\"/></a>\n<a href=\"https://mendix.com/\"><img src=\"https://mobx.js.org/assets/mendix-logo.png\" align=\"center\" width=\"100\" title=\"Mendix\" alt=\"Mendix\" /></a>\n<a href=\"https://opensource.facebook.com/\"><img src=\"https://mobx.js.org/assets/fbos.jpeg\" align=\"center\" width=\"100\" title=\"Facebook Open Source\" alt=\"Facebook Open Source\" /></a>\n<a href=\"https://casinosites.ltd.uk/?utm_source=sponsorship&utm_medium=mobx&utm_campaign=readme\"><img src=\"https://mobx.js.org/assets/casino2.png\" align=\"center\" width=\"100\" title=\"Casino Sites\" alt=\"Casino Sites\"/></a>\n<a href=\"https://www.bugsnag.com/platforms/react-error-reporting?utm_source=MobX&utm_medium=Website&utm_content=open-source&utm_campaign=2019-community&utm_term=20190913\"><img src=\"https://mobx.js.org/assets/bugsnag.jpg\" align=\"center\" width=\"100\" title=\"Bugsnag\" alt=\"Bugsnag\"/></a>\n\n**🥈 Silver sponsors (\\$500+ total contributions):**<br/>\n\n<a href=\"https://mantro.net/jobs/warlock\"><img src=\"https://mobx.js.org/assets/mantro.png\" align=\"center\" width=\"100\" title=\"mantro GmbH\" alt=\"mantro GmbH\"></a>\n<a href=\"https://xh.io/\"><img src=\"https://mobx.js.org/assets/xh.png\" align=\"center\" width=\"100\" title=\"Extremely Heavy Industries\" alt=\"Extremely Heavy Industries\" /></a>\n<a href=\"https://www.algolia.com/\"><img src=\"https://mobx.js.org/assets/algolia.jpg\" align=\"center\" width=\"100\" title=\"Algolia\" alt=\"Algolia\" /></a>\n<a href=\"https://space307.com/?utm_source=sponsorship&utm_medium=mobx&utm_campaign=readme\"><img src=\"https://mobx.js.org/assets/space307.png\" align=\"center\" width=\"100\" title=\"Space307\" alt=\"Space307\"/></a>\n<a href=\"https://blokt.com/\"><img src=\"https://mobx.js.org/assets/blokt.jpg\" align=\"center\" width=\"100\" title=\"Blokt\" alt=\"Blokt\"/></a>\n<a href=\"https://upper.co/?utm_source=github_mobxjs_sponsorship&utm_medium=paid_acquisition&utm_campaign=sponsorship\"><img src=\"https://mobx.js.org/assets/upper.png\" align=\"center\" width=\"100\" title=\"UPPER\" alt=\"UPPER\"/></a>\n<a href=\"https://careers.dazn.com/\"><img src=\"https://mobx.js.org/assets/dazn.png\" align=\"center\" width=\"100\" title=\"DAZN\" alt=\"DAZN\"></a>\n<a href=\"https://talentplot.com/\"><img src=\"https://mobx.js.org/assets/talentplot.png\" align=\"center\" width=\"100\" title=\"talentplot\" alt=\"talentplot\"></a>\n<a href=\"https://www.easeus.com/?utm_source=github_mobxjs_sponsorship&utm_medium=readme&utm_campaign=sponsorship\"><img src=\"https://mobx.js.org/assets/easeus.png\" align=\"center\" width=\"100\" title=\"EaseUS\" alt=\"EaseUS\"/></a>\n<a href=\"https://route4me.com/\"><img src=\"https://mobx.js.org/assets/route4me.png\" align=\"center\" width=\"100\" title=\"Route Planner and Route Optimizer\" alt=\"Route Planner and Route Optimizer\"/></a>\n<a href=\"https://handsontable.com/docs/react-data-grid/?utm_source=Mobx_homepage&utm_medium=sponsorship&utm_campaign=library_sponsorship\"><img src=\"https://mobx.js.org/assets/handsontable.png\" align=\"center\" width=\"100\" title=\"Handsontable\" alt=\"Handsontable\"/></a>\n\n## Introduction\n\n_Anything that can be derived from the application state, should be. Automatically._\n\nMobX is a signal based, battle-tested library that makes state management simple and scalable by transparently applying functional reactive programming.\nThe philosophy behind MobX is simple:\n\n<div class=\"benefits\">\n    <div>\n        <div class=\"pic\">😙</div>\n        <div>\n            <h4>Straightforward</h4>\n            <p>Write minimalistic, boilerplate-free code that captures your intent.\n            Trying to update a record field? Simply use a normal JavaScript assignment —\n            the reactivity system will detect all your changes and propagate them out to where they are being used.\n            No special tools are required when updating data in an asynchronous process.\n            </p>\n        </div>\n    </div>\n    <div>\n        <div class=\"pic\">🚅</div>\n        <div>\n            <h4>Effortless optimal rendering</h4>\n            <p>\n                All changes to and uses of your data are tracked at runtime, building a dependency tree that captures all relations between state and output.\n                This guarantees that computations that depend on your state, like React components, run only when strictly needed.\n                There is no need to manually optimize components with error-prone and sub-optimal techniques like memoization and selectors.\n            </p>\n        </div>\n    </div>\n    <div>\n        <div class=\"pic\">🤹🏻‍♂️</div>\n        <div>\n            <h4>Architectural freedom</h4>\n            <p>\n                MobX is unopinionated and allows you to manage your application state outside of any UI framework.\n                This makes your code decoupled, portable, and above all, easily testable.\n            </p>\n        </div>\n    </div>\n</div>\n\n---\n\n## A quick example\n\nSo what does code that uses MobX look like?\n\n```javascript\nimport React from \"react\"\nimport ReactDOM from \"react-dom\"\nimport { makeAutoObservable } from \"mobx\"\nimport { observer } from \"mobx-react-lite\"\n\n// Model the application state.\nfunction createTimer() {\n    return makeAutoObservable({\n        secondsPassed: 0,\n        increase() {\n            this.secondsPassed += 1\n        },\n        reset() {\n            this.secondsPassed = 0\n        }\n    })\n}\n\nconst myTimer = createTimer()\n\n// Build a \"user interface\" that uses the observable state.\nconst TimerView = observer(({ timer }) => (\n    <button onClick={() => timer.reset()}>Seconds passed: {timer.secondsPassed}</button>\n))\n\nReactDOM.render(<TimerView timer={myTimer} />, document.body)\n\n// Update the 'Seconds passed: X' text every second.\nsetInterval(() => {\n    myTimer.increase()\n}, 1000)\n```\n\nThe `observer` wrapper around the `TimerView` React component will automatically detect that rendering\ndepends on the `timer.secondsPassed` observable, even though this relationship is not explicitly defined. The reactivity system will take care of re-rendering the component when _precisely that_ field is updated in the future.\n\nEvery event (`onClick` / `setInterval`) invokes an _action_ (`myTimer.increase` / `myTimer.reset`) that updates _observable state_ (`myTimer.secondsPassed`).\nChanges in the observable state are propagated precisely to all _computations_ and _side effects_ (`TimerView`) that depend on the changes being made.\n\n<img alt=\"MobX unidirectional flow\" src=\"https://mobx.js.org/assets/flow2.png\" align=\"center\" />\n\nThis conceptual picture can be applied to the above example, or any other application using MobX.\n\n## Getting started\n\nTo learn about the core concepts of MobX using a larger example, check out **[The gist of MobX](https://mobx.js.org/the-gist-of-mobx.html)** page, or take the **[10 minute interactive introduction to MobX and React](https://mobx.js.org/getting-started)**.\nThe philosophy and benefits of the mental model provided by MobX are also described in great detail in the blog posts [UI as an afterthought](https://michel.codes/blogs/ui-as-an-afterthought) and [How to decouple state and UI (a.k.a. you don’t need componentWillMount)](https://hackernoon.com/how-to-decouple-state-and-ui-a-k-a-you-dont-need-componentwillmount-cc90b787aa37).\n\n## Further resources\n\n-   The [MobX cheat sheet](https://gum.co/fSocU) (£5) is both useful and sponsors the project\n-   [10 minute interactive introduction to MobX and React](https://mobx.js.org/getting-started)\n-   [Egghead.io course, based on MobX 3](https://egghead.io/courses/manage-complex-state-in-react-apps-with-mobx)\n-   The [MobX awesome list](https://github.com/mobxjs/awesome-mobx#awesome-mobx) – a long list of MobX resources and example projects\n\n### The MobX book\n\n<a href=\"https://www.packtpub.com/product/mobx-quick-start-guide/9781789344837\"><img src=\"https://mobx.js.org/assets/book.jpg\" height=\"120px\" /></a>\n\nThe **[MobX Quick Start Guide](https://www.packtpub.com/product/mobx-quick-start-guide/9781789344837)** ($24.99) by [Pavan Podila](https://twitter.com/pavanpodila) and [Michel Weststrate](https://twitter.com/mweststrate) is available as an [ebook](https://www.packtpub.com/product/mobx-quick-start-guide/9781789344837), [paperback](https://www.amazon.com/MobX-Quick-Start-Guide-Supercharge/dp/1789344832), and on the [O'Reilly platform](https://www.oreilly.com/library/view/mobx-quick-start/9781789344837/) (see [preview](https://books.google.com/books?id=ALFmDwAAQBAJ&printsec=frontcover#v=onepage&q&f=false)).\n\n### Videos\n\n-   [Introduction to MobX & React in 2020](https://www.youtube.com/watch?v=pnhIJA64ByY) by Leigh Halliday, _17 min_.\n-   [ReactNext 2016: Real World MobX](https://www.youtube.com/watch?v=Aws40KOx90U) by Michel Weststrate, _40 min_, [slides](https://docs.google.com/presentation/d/1DrI6Hc2xIPTLBkfNH8YczOcPXQTOaCIcDESdyVfG_bE/edit?usp=sharing).\n-   [CityJS 2020: MobX, from mutable to immutable, to observable data](https://youtu.be/sP7dtZm_Wx0?t=27050) by Michel Weststrate, _30 min_.\n-   [OpenSourceNorth: Practical React with MobX (ES5)](https://www.youtube.com/watch?v=XGwuM_u7UeQ) by Matt Ruby, _42 min_.\n-   [HolyJS 2019: MobX and the unique symbiosis of predictability and speed](https://www.youtube.com/watch?v=NBYbBbjZeX4&list=PL8sJahqnzh8JJD7xahG5zXkjfM5GOgcPA&index=21&t=0s) by Michel Weststrate, _59 min_.\n-   [React Amsterdam 2016: State Management Is Easy](https://www.youtube.com/watch?v=ApmSsu3qnf0&feature=youtu.be) by Michel Weststrate, _20 min_, [slides](https://speakerdeck.com/mweststrate/state-management-is-easy-introduction-to-mobx).\n-   {🚀} [React Live 2019: Reinventing MobX](https://www.youtube.com/watch?v=P_WqKZxpX8g) by Max Gallo, _27 min_.\n\n## Credits\n\nMobX is inspired by reactive programming principles, which are for example used in spreadsheets. It is inspired by model–view–viewmodel frameworks like [MeteorJS's Tracker](https://docs.meteor.com/api/tracker.html), [Knockout](https://knockoutjs.com/) and [Vue.js](https://vuejs.org/), but MobX brings _transparent functional reactive programming_ (TFRP, a concept which is further explained in the [MobX book](https://www.packtpub.com/product/mobx-quick-start-guide/9781789344837)) to the next level and provides a standalone implementation. It implements TFRP in a glitch-free, synchronous, predictable and efficient manner.\n\nA ton of credit goes to [Mendix](https://github.com/mendix), for providing the flexibility and support to maintain MobX and the chance to prove the philosophy of MobX in a real, complex, performance critical applications.\n"
  },
  {
    "path": "SECURITY.md",
    "content": "# Security Policy\n\nAll our packages are provided as-is without guarantees or SLAs.\nSecurity issues will be handled with appropriate urgency but without warranties.\n\n## Supported Versions\n\nSecurity issues must be reported against latest version of each package (as found on NPM) and will not be back-ported. \n\n## Reporting a Vulnerability\n\nSecurity issues can be reported at info@michel.codes. Since this software is provided as-is no follow up, remediation or time lines are guaranteed.\n"
  },
  {
    "path": "docs/LINKS.md",
    "content": "<script async type=\"text/javascript\" src=\"//cdn.carbonads.com/carbon.js?serve=CEBD4KQ7&placement=mobxjsorg\" id=\"_carbonads_js\"></script>\n\n# Resources\n\n-   [Ten minute interactive introduction to MobX and React](https://mobx.js.org/getting-started)\n-   How MobX works: [In depth explanation of MobX](https://medium.com/@mweststrate/becoming-fully-reactive-an-in-depth-explanation-of-mobservable-55995262a254#.wnlo6bw8y)\n-   Clone the boilerplate repository containing the above example from: https://github.com/mweststrate/react-mobservable-boilerplate.\n-   Or fork this [JSFiddle](https://jsfiddle.net/mweststrate/wgbe4guu/).\n\n## Related projects\n\n-   [mobx-connect](https://github.com/nightwolfz/mobx-connect) MobX @connect decorator for react components. Similar to redux's @connect.\n-   [rfx-stack](https://github.com/foxhound87/rfx-stack) RFX Stack - Universal App featuring: React + Feathers + MobX\n-   [mobx-reactor](https://github.com/amsb/mobx-reactor) Connect MobX data stores to functional stateless React components with async actions and unidirectional data flow.\n-   [mobx-model](https://github.com/ikido/mobx-model) Simplify mobx data stores that mimic backend models\n-   [rx-mobx](https://github.com/chicoxyzzy/rx-mobx) Convert MobX observables to RxJS and vice versa\n\n## More examples\n\nA nice list is WIP, but see this [github issue](https://github.com/mobxjs/mobx/issues/104) for a list of example projects, including routing, authorization, server side rendering etc.\n\n-   [TodoMVC using MobX and React](https://github.com/mweststrate/mobx-todomvc)\n-   The [ports of the _Notes_ and _Kanban_ examples](https://github.com/survivejs/mobservable-demo) from the book \"SurviveJS - Webpack and React\" to mobservable.\n-   A simple webshop using [React + mobx](https://jsfiddle.net/mweststrate/46vL0phw) or [JQuery + mobx](http://jsfiddle.net/mweststrate/vxn7qgdw).\n-   [Simple timer](https://jsfiddle.net/mweststrate/wgbe4guu/) application in JSFiddle.\n-   [Simple ES5 MobX examples](https://github.com/mattruby/mobx-examples) Bite sized MobX examples all setup to run in jsFiddle.\n\n## Philosophy\n\n-   [Making React reactive: the pursuit of high performing, easily maintainable React apps](https://www.mendix.com/tech-blog/making-react-reactive-pursuit-high-performing-easily-maintainable-react-apps/)\n-   [SurviveJS interview on Mobservable, React and Flux](http://survivejs.com/blog/mobservable-interview/)\n-   [Pure rendering in the light of time and state](https://medium.com/@mweststrate/pure-rendering-in-the-light-of-time-and-state-4b537d8d40b1)\n-   [Official homepage](http://mobxjs.github.io/mobx/)\n"
  },
  {
    "path": "docs/README.md",
    "content": "---\ntitle: About MobX\nsidebar_label: About MobX\nhide_title: true\n---\n\n<img src=\"https://mobx.js.org/assets/mobx.png\" alt=\"logo\" height=\"120\" align=\"right\" />\n\n# MobX\n\n_Simple, scalable state management._\n\n[![Discuss on Github](https://img.shields.io/badge/discuss%20on-GitHub-orange)](https://github.com/mobxjs/mobx/discussions)\n[![npm version](https://badge.fury.io/js/mobx.svg)](https://badge.fury.io/js/mobx)\n[![OpenCollective](https://opencollective.com/mobx/backers/badge.svg)](backers-sponsors.md#backers)\n[![OpenCollective](https://opencollective.com/mobx/sponsors/badge.svg)](backers-sponsors.md#sponsors)\n[![View changelog](https://img.shields.io/badge/changelogs.xyz-Explore%20Changelog-brightgreen)](https://changelogs.xyz/mobx)\n\n---\n\nMobX is made possible by the generosity of the sponsors below, and many other [individual backers](backers-sponsors.md#backers). Sponsoring directly impacts the longevity of this project.\n\n**🥇🥇 Platinum sponsors (\\$5000+ total contribution): 🥇🥇**\n\n<br/>\n<a href=\"https://www.guilded.gg/\"><img src=\"https://mobx.js.org/assets/guilded.jpg\" align=\"center\" width=\"100\" title=\"Guilded\" alt=\"Guilded\" /></a>\n<a href=\"https://www.canva.com/\"><img src=\"https://mobx.js.org/assets/canva.svg\" align=\"center\" width=\"100\" title=\"Canva\" alt=\"Canva\" /></a>\n<a href=\"https://www.getparallax.com/\"><img src=\"https://mobx.js.org/assets/parallax.png\" align=\"center\" width=\"100\" title=\"Parallax\" alt=\"Parallax\" /></a>\n\n**🥇 Gold sponsors (\\$2500+ total contribution):**\n\n<br/>\n<a href=\"https://www.one-beyond.com\"><img src=\"https://mobx.js.org/assets/dcsl.png\" align=\"center\" width=\"100\" title=\"One Beyond\" alt=\"One Beyond\"/></a>\n<a href=\"https://frontendmasters.com/\"><img src=\"https://mobx.js.org/assets/frontendmasters.jpg\" align=\"center\" width=\"100\" title=\"Frontend Masters\" alt=\"Frontend Masters\"></a>\n<a href=\"http://auctionfrontier.com/\"><img src=\"https://mobx.js.org/assets/auctionfrontier.jpeg\" align=\"center\" width=\"100\" title=\"Auction Frontier\" alt=\"Auction Frontier\"></a>\n<a href=\"https://www.codefirst.co.uk/\"><img src=\"https://mobx.js.org/assets/codefirst.png\" align=\"center\" width=\"100\" title=\"CodeFirst\" alt=\"CodeFirst\"/></a>\n<a href=\"https://modulz.app/\"><img src=\"https://mobx.js.org/assets/modulz.png\" align=\"center\" width=\"100\" title=\"Modulz\" alt=\"Modulz\"/></a>\n<a href=\"https://coinbase.com/\"><img src=\"https://mobx.js.org/assets/coinbase.jpeg\" align=\"center\" width=\"100\" title=\"Coinbase\" alt=\"Coinbase\" /></a>\n<a href=\"https://curology.com/blog/tech\"><img src=\"https://mobx.js.org/assets/curology.png\" align=\"center\" width=\"100\" title=\"Curology\" alt=\"Curology\"/></a>\n<a href=\"https://mendix.com/\"><img src=\"https://mobx.js.org/assets/mendix-logo.png\" align=\"center\" width=\"100\" title=\"Mendix\" alt=\"Mendix\" /></a>\n<a href=\"https://opensource.facebook.com/\"><img src=\"https://mobx.js.org/assets/fbos.jpeg\" align=\"center\" width=\"100\" title=\"Facebook Open Source\" alt=\"Facebook Open Source\" /></a>\n<a href=\"https://casinosites.ltd.uk/?utm_source=sponsorship&utm_medium=mobx&utm_campaign=readme\"><img src=\"https://mobx.js.org/assets/casino2.png\" align=\"center\" width=\"100\" title=\"Casino Sites\" alt=\"Casino Sites\"/></a>\n<a href=\"https://www.bugsnag.com/platforms/react-error-reporting?utm_source=MobX&utm_medium=Website&utm_content=open-source&utm_campaign=2019-community&utm_term=20190913\"><img src=\"https://mobx.js.org/assets/bugsnag.jpg\" align=\"center\" width=\"100\" title=\"Bugsnag\" alt=\"Bugsnag\"/></a>\n\n**🥈 Silver sponsors (\\$500+ total contributions):**<br/>\n\n<a href=\"https://mantro.net/jobs/warlock\"><img src=\"https://mobx.js.org/assets/mantro.png\" align=\"center\" width=\"100\" title=\"mantro GmbH\" alt=\"mantro GmbH\"></a>\n<a href=\"https://www.xh.com/\"><img src=\"https://mobx.js.org/assets/xh.png\" align=\"center\" width=\"100\" title=\"Extremely Heavy\" alt=\"Extremely Heavy\" /></a>\n<a href=\"https://www.algolia.com/\"><img src=\"https://mobx.js.org/assets/algolia.jpg\" align=\"center\" width=\"100\" title=\"Algolia\" alt=\"Algolia\" /></a>\n<a href=\"https://space307.com/?utm_source=sponsorship&utm_medium=mobx&utm_campaign=readme\"><img src=\"https://mobx.js.org/assets/space307.png\" align=\"center\" width=\"100\" title=\"Space307\" alt=\"Space307\"/></a>\n<a href=\"https://blokt.com/\"><img src=\"https://mobx.js.org/assets/blokt.jpg\" align=\"center\" width=\"100\" title=\"Blokt\" alt=\"Blokt\"/></a>\n<a href=\"https://upper.co/?utm_source=github_mobxjs_sponsorship&utm_medium=paid_acquisition&utm_campaign=sponsorship\"><img src=\"https://mobx.js.org/assets/upper.png\" align=\"center\" width=\"100\" title=\"UPPER\" alt=\"UPPER\"/></a>\n<a href=\"https://careers.dazn.com/\"><img src=\"https://mobx.js.org/assets/dazn.png\" align=\"center\" width=\"100\" title=\"DAZN\" alt=\"DAZN\"></a>\n<a href=\"https://talentplot.com/\"><img src=\"https://mobx.js.org/assets/talentplot.png\" align=\"center\" width=\"100\" title=\"talentplot\" alt=\"talentplot\"></a>\n<a href=\"https://www.easeus.com/?utm_source=github_mobxjs_sponsorship&utm_medium=readme&utm_campaign=sponsorship\"><img src=\"https://mobx.js.org/assets/easeus.png\" align=\"center\" width=\"100\" title=\"EaseUS\" alt=\"EaseUS\"/></a>\n<a href=\"https://route4me.com/\"><img src=\"https://mobx.js.org/assets/route4me.png\" align=\"center\" width=\"100\" title=\"Route Planner and Route Optimizer\" alt=\"Route Planner and Route Optimizer\"/></a>\n<a href=\"https://handsontable.com/docs/react-data-grid/?utm_source=Mobx_homepage&utm_medium=sponsorship&utm_campaign=library_sponsorship\"><img src=\"https://mobx.js.org/assets/handsontable.png\" align=\"center\" width=\"100\" title=\"Handsontable\" alt=\"Handsontable\"/></a>\n\n---\n\n## Introduction\n\n_Anything that can be derived from the application state, should be. Automatically._\n\nMobX is a signal based, battle-tested library that makes state management simple and scalable by transparently applying functional reactive programming.\nThe philosophy behind MobX is simple:\n\n<div class=\"benefits\">\n    <div>\n        <div class=\"pic\">😙</div>\n        <div>\n            <h4>Straightforward</h4>\n            <p>Write minimalistic, boilerplate-free code that captures your intent.\n            Trying to update a record field? Simply use a normal JavaScript assignment —\n            the reactivity system will detect all your changes and propagate them out to where they are being used.\n            No special tools are required when updating data in an asynchronous process.\n            </p>\n        </div>\n    </div>\n    <div>\n        <div class=\"pic\">🚅</div>\n        <div>\n            <h4>Effortless optimal rendering</h4>\n            <p>\n                All changes to and uses of your data are tracked at runtime, building a dependency tree that captures all relations between state and output.\n                This guarantees that computations that depend on your state, like React components, run only when strictly needed.\n                There is no need to manually optimize components with error-prone and sub-optimal techniques like memoization and selectors.\n            </p>\n        </div>\n    </div>\n    <div>\n        <div class=\"pic\">🤹🏻‍♂️</div>\n        <div>\n            <h4>Architectural freedom</h4>\n            <p>\n                MobX is unopinionated and allows you to manage your application state outside of any UI framework.\n                This makes your code decoupled, portable, and above all, easily testable.\n            </p>\n        </div>\n    </div>\n</div>\n\n---\n\n## A quick example\n\nSo what does code that uses MobX look like?\n\n```javascript\nimport React from \"react\"\nimport ReactDOM from \"react-dom\"\nimport { makeAutoObservable } from \"mobx\"\nimport { observer } from \"mobx-react-lite\"\n\n// Model the application state.\nfunction createTimer() {\n    return makeAutoObservable({\n        secondsPassed: 0,\n        increase() {\n            this.secondsPassed += 1\n        },\n        reset() {\n            this.secondsPassed = 0\n        }\n    })\n}\n\nconst myTimer = createTimer()\n\n// Build a \"user interface\" that uses the observable state.\nconst TimerView = observer(({ timer }) => (\n    <button onClick={() => timer.reset()}>Seconds passed: {timer.secondsPassed}</button>\n))\n\nReactDOM.render(<TimerView timer={myTimer} />, document.body)\n\n// Update the 'Seconds passed: X' text every second.\nsetInterval(() => {\n    myTimer.increase()\n}, 1000)\n```\n\nThe `observer` wrapper around the `TimerView` React component will automatically detect that rendering\ndepends on the `timer.secondsPassed` observable, even though this relationship is not explicitly defined. The reactivity system will take care of re-rendering the component when _precisely that_ field is updated in the future.\n\nEvery event (`onClick` / `setInterval`) invokes an _action_ (`myTimer.increase` / `myTimer.reset`) that updates _observable state_ (`myTimer.secondsPassed`).\nChanges in the observable state are propagated precisely to all _computations_ and _side effects_ (`TimerView`) that depend on the changes being made.\n\n<img alt=\"MobX unidirectional flow\" src=\"https://mobx.js.org/assets/flow2.png\" align=\"center\" />\n\nThis conceptual picture can be applied to the above example, or any other application using MobX.\n\n## Getting started\n\nTo learn about the core concepts of MobX using a larger example, check out **[The gist of MobX](the-gist-of-mobx.md)** page, or take the **[10 minute interactive introduction to MobX and React](https://mobx.js.org/getting-started)**.\n\nThe philosophy and benefits of the mental model provided by MobX are also described in great detail in the blog posts [UI as an afterthought](https://michel.codes/blogs/ui-as-an-afterthought) and [How to decouple state and UI (a.k.a. you don’t need componentWillMount)](https://hackernoon.com/how-to-decouple-state-and-ui-a-k-a-you-dont-need-componentwillmount-cc90b787aa37).\n\n## Further resources\n\n-   The [MobX cheat sheet](https://gum.co/fSocU) (£5) is both useful and sponsors the project\n-   [10 minute interactive introduction to MobX and React](https://mobx.js.org/getting-started)\n-   [Egghead.io course, based on MobX 3](https://egghead.io/courses/manage-complex-state-in-react-apps-with-mobx)\n-   The [MobX awesome list](https://github.com/mobxjs/awesome-mobx#awesome-mobx) – a long list of MobX resources and example projects\n\n### The MobX book\n\n<a href=\"https://www.packtpub.com/product/mobx-quick-start-guide/9781789344837\"><img src=\"https://mobx.js.org/assets/book.jpg\" height=\"120px\" /></a>\n\nThe **[MobX Quick Start Guide](https://www.packtpub.com/product/mobx-quick-start-guide/9781789344837)** ($24.99) by [Pavan Podila](https://twitter.com/pavanpodila) and [Michel Weststrate](https://twitter.com/mweststrate) is available as an [ebook](https://www.packtpub.com/product/mobx-quick-start-guide/9781789344837), [paperback](https://www.amazon.com/MobX-Quick-Start-Guide-Supercharge/dp/1789344832), and on the [O'Reilly platform](https://www.oreilly.com/library/view/mobx-quick-start/9781789344837/) (see [preview](https://books.google.com/books?id=ALFmDwAAQBAJ&printsec=frontcover#v=onepage&q&f=false)).\n\n### Videos\n\n-   [Introduction to MobX & React in 2020](https://www.youtube.com/watch?v=pnhIJA64ByY) by Leigh Halliday, _17 min_.\n-   [ReactNext 2016: Real World MobX](https://www.youtube.com/watch?v=Aws40KOx90U) by Michel Weststrate, _40 min_, [slides](https://docs.google.com/presentation/d/1DrI6Hc2xIPTLBkfNH8YczOcPXQTOaCIcDESdyVfG_bE/edit?usp=sharing).\n-   [CityJS 2020: MobX, from mutable to immutable, to observable data](https://youtu.be/sP7dtZm_Wx0?t=27050) by Michel Weststrate, _30 min_.\n-   [OpenSourceNorth: Practical React with MobX (ES5)](https://www.youtube.com/watch?v=XGwuM_u7UeQ) by Matt Ruby, _42 min_.\n-   [HolyJS 2019: MobX and the unique symbiosis of predictability and speed](https://www.youtube.com/watch?v=NBYbBbjZeX4&list=PL8sJahqnzh8JJD7xahG5zXkjfM5GOgcPA&index=21&t=0s) by Michel Weststrate, _59 min_.\n-   [React Amsterdam 2016: State Management Is Easy](https://www.youtube.com/watch?v=ApmSsu3qnf0&feature=youtu.be) by Michel Weststrate, _20 min_, [slides](https://speakerdeck.com/mweststrate/state-management-is-easy-introduction-to-mobx).\n-   {🚀} [React Live 2019: Reinventing MobX](https://www.youtube.com/watch?v=P_WqKZxpX8g) by Max Gallo, _27 min_.\n\n## Credits\n\nMobX is inspired by reactive programming principles, which are for example used in spreadsheets. It is inspired by model–view–viewmodel frameworks like [MeteorJS's Tracker](https://docs.meteor.com/api/tracker.html), [Knockout](https://knockoutjs.com/) and [Vue.js](https://vuejs.org/), but MobX brings _transparent functional reactive programming_ (TFRP, a concept which is further explained in the [MobX book](https://www.packtpub.com/product/mobx-quick-start-guide/9781789344837)) to the next level and provides a standalone implementation. It implements TFRP in a glitch-free, synchronous, predictable and efficient manner.\n\nA ton of credit goes to [Mendix](https://github.com/mendix) for providing the flexibility and support to maintain MobX and the chance to prove the philosophy of MobX in a real, complex, performance critical applications.\n"
  },
  {
    "path": "docs/about-this-documentation.md",
    "content": "---\ntitle: About this documentation\nsidebar_label: About this documentation\nhide_title: true\n---\n\n<script async type=\"text/javascript\" src=\"//cdn.carbonads.com/carbon.js?serve=CEBD4KQ7&placement=mobxjsorg\" id=\"_carbonads_js\"></script>\n\n# About this documentation\n\nIt follows the principle that the most commonly used concepts are\nintroduced before specialized information. This applies to the headings in the table\nof concepts as well as the pages under those headings.\n\nWe've marked the sections and concepts that are more advanced with the {🚀} marker. You likely won't have to understand them until you will have a special use case, and can use MobX very effectively without knowing about them. Feel free to skip them and move on to the next section!\n\nThe documentation has been rewritten for MobX 6. For older versions of MobX, it can be found [here](https://github.com/mobxjs/mobx/tree/mobx4and5/docs).\nAll the principles are the same, and the API is largely the same. The main difference is that before MobX 6, [decorators](https://github.com/mobxjs/mobx/blob/mobx4and5/docs/best/decorators.md) were the recommended syntax to write MobX enhanced classes.\n\nA summary of the documentation can be downloaded as cheat sheet:\n\n<div class=\"cheat\"><a href=\"https://gum.co/fSocU\"><button title=\"Download the MobX 6 cheat sheet and sponsor the project\">Download the MobX 6 cheat sheet</button></a></div>\n\n## Guided tour\n\nTo get an overall idea of how to use MobX with React, read through the current _Introduction_ heading, in particular [The gist of MobX](the-gist-of-mobx.md) section.\nIt will introduce you to the most important principles, APIs and how they relate.\nYou should be ready to use MobX once you read this!\n\nHere are a few suggestions about the next things to check out:\n\n-   Try the [10 minute interactive introduction to MobX and React](https://mobx.js.org/getting-started)\n\n-   [React integration](react-integration.md)\n\n-   [`makeObservable` / `makeAutoObservable`](observable-state.md)\n\n-   Learn about [actions](actions.md), which includes a discussion on asynchronous actions\n\n-   The basics of [computeds](computeds.md)\n\n-   Read about [`autorun`](reactions.md#autorun), if only because it's used in the examples\n\n-   To get an idea on how to organize your application's data stores, check out [Defining data stores](defining-data-stores.md)\n\n-   If the behavior of MobX confuses you, it's useful to check out [Understanding reactivity](understanding-reactivity.md)\n\n-   Get a [quick overview of the API](api.md), also linked in the top navigation bar\n\nThis should give you a good understanding of the day-to-day uses of MobX. There is plenty more available for you to read at your own leisure.\n"
  },
  {
    "path": "docs/actions.md",
    "content": "---\ntitle: Updating state using actions\nsidebar_label: Actions\nhide_title: true\n---\n\n<script async type=\"text/javascript\" src=\"//cdn.carbonads.com/carbon.js?serve=CEBD4KQ7&placement=mobxjsorg\" id=\"_carbonads_js\"></script>\n\n# Updating state using actions\n\nUsage:\n\n-   `action` _(annotation)_\n-   `action(fn)`\n-   `action(name, fn)`\n-   `@action` _(method / field decorator)_\n\nAll applications have actions. An action is any piece of code that modifies the state. In principle, actions always happen in response to an event. For example, a button was clicked, some input changed, a websocket message arrived, etc.\n\nMobX requires that you declare your actions, although [`makeAutoObservable`](observable-state.md#makeautoobservable) can automate much of this job. Actions help you structure your code better and offer the following performance benefits:\n\n1. They are run inside [transactions](api.md#transaction). No reactions will be run until the outer-most action has finished, guaranteeing that intermediate or incomplete values produced during an action are not visible to the rest of the application until the action has completed.\n\n2. By default, it is not allowed to change the state outside of actions. This helps to clearly identify in your code base where the state updates happen.\n\nThe `action` annotation should only be used on functions that intend to _modify_ the state. Functions that derive information (performing lookups or filtering data) should _not_ be marked as actions, to allow MobX to track their invocations. `action` annotated members will be non-enumerable.\n\n## Examples\n\n<!--DOCUSAURUS_CODE_TABS-->\n<!--makeObservable-->\n\n```javascript\nimport { makeObservable, observable, action } from \"mobx\"\n\nclass Doubler {\n    value = 0\n\n    constructor() {\n        makeObservable(this, {\n            value: observable,\n            increment: action\n        })\n    }\n\n    increment() {\n        // Intermediate states will not become visible to observers.\n        this.value++\n        this.value++\n    }\n}\n```\n\n<!--@action-->\n\n```javascript\nimport { observable, action } from \"mobx\"\n\nclass Doubler {\n    @observable accessor value = 0\n\n    @action\n    increment() {\n        // Intermediate states will not become visible to observers.\n        this.value++\n        this.value++\n    }\n}\n```\n\n<!--makeAutoObservable-->\n\n```javascript\nimport { makeAutoObservable } from \"mobx\"\n\nclass Doubler {\n    value = 0\n\n    constructor() {\n        makeAutoObservable(this)\n    }\n\n    increment() {\n        this.value++\n        this.value++\n    }\n}\n```\n\n<!--action.bound-->\n\n```javascript\nimport { makeObservable, observable, action } from \"mobx\"\n\nclass Doubler {\n    value = 0\n\n    constructor() {\n        makeObservable(this, {\n            value: observable,\n            increment: action.bound\n        })\n    }\n\n    increment() {\n        this.value++\n        this.value++\n    }\n}\n\nconst doubler = new Doubler()\n\n// Calling increment this way is safe as it is already bound.\nsetInterval(doubler.increment, 1000)\n```\n\n<!--action(fn)-->\n\n```javascript\nimport { observable, action } from \"mobx\"\n\nconst state = observable({ value: 0 })\n\nconst increment = action(state => {\n    state.value++\n    state.value++\n})\n\nincrement(state)\n```\n\n<!--runInAction(fn)-->\n\n```javascript\nimport { observable, runInAction } from \"mobx\"\n\nconst state = observable({ value: 0 })\n\nrunInAction(() => {\n    state.value++\n    state.value++\n})\n```\n\n<!--END_DOCUSAURUS_CODE_TABS-->\n\n## Wrapping functions using `action`\n\nTo leverage the transactional nature of MobX as much as possible, actions should be passed as far outward as possible. It is good to mark a class method as an action if it modifies the state. It is even better to mark event handlers as actions, as it is the outer-most transaction that counts. A single unmarked event handler that calls two actions subsequently would still generate two transactions.\n\nTo help create action based event handlers, `action` is not only an annotation, but also a higher order function. It can be called with a function as an argument, and in that case it will return an `action` wrapped function with the same signature.\n\nFor example in React, an `onClick` handler can be wrapped as below.\n\n```javascript\nconst ResetButton = ({ formState }) => (\n    <button\n        onClick={action(e => {\n            formState.resetPendingUploads()\n            formState.resetValues()\n            e.preventDefault()\n        })}\n    >\n        Reset form\n    </button>\n)\n```\n\nFor debugging purposes, we recommend to either name the wrapped function, or pass a name as the first argument to `action`.\n\n<details id=\"actions-are-untracked\"><summary>**Note:** actions are untracked<a href=\"#actions-are-untracked\" class=\"tip-anchor\"></a></summary>\n\nAnother feature of actions is that they are [untracked](api.md#untracked). When an action is called from inside a side effect or a computed value (very rare!), observables read by the action won't be counted towards the dependencies of the derivation.\n\n`makeAutoObservable`, `extendObservable` and `observable` use a special flavour of `action` called [`autoAction`](observable-state.md#autoAction),\nthat will determine at runtime if the function is a derivation or action.\n\n</details>\n\n## `action.bound`\n\nUsage:\n\n-   `action.bound` _(annotation)_\n\nThe `action.bound` annotation can be used to automatically bind a method to the correct instance, so that `this` is always correctly bound inside the function.\n\n<details id=\"auto-bind\"><summary>**Tip:** use `makeAutoObservable(o, {}, { autoBind: true })` to bind all actions and flows automatically<a href=\"#avoid-bound\" class=\"tip-anchor\"></a></summary>\n\n```javascript\nimport { makeAutoObservable } from \"mobx\"\n\nclass Doubler {\n    value = 0\n\n    constructor() {\n        makeAutoObservable(this, {}, { autoBind: true })\n    }\n\n    increment() {\n        this.value++\n        this.value++\n    }\n\n    *flow() {\n        const response = yield fetch(\"http://example.com/value\")\n        this.value = yield response.json()\n    }\n}\n```\n\n</details>\n\n## `runInAction`\n\nUsage:\n\n-   `runInAction(fn)`\n\nUse this utility to create a temporary action that is immediately invoked. Can be useful in asynchronous processes.\nCheck out the [above code block](#examples) for an example.\n\n## Actions and inheritance\n\nOnly actions defined **on prototype** can be **overridden** by subclass:\n\n```javascript\nclass Parent {\n    // on instance\n    arrowAction = () => {}\n\n    // on prototype\n    action() {}\n    boundAction() {}\n\n    constructor() {\n        makeObservable(this, {\n            arrowAction: action,\n            action: action,\n            boundAction: action.bound,\n        })\n    }\n}\nclass Child extends Parent {\n    // THROWS: TypeError: Cannot redefine property: arrowAction\n    arrowAction = () => {}\n\n    // OK\n    action() {}\n    boundAction() {}\n\n    constructor() {\n        super()\n        makeObservable(this, {\n            arrowAction: override,\n            action: override,\n            boundAction: override,\n        })\n    }\n}\n```\n\nTo **bind** a single _action_ to `this`, `action.bound` can be used instead of _arrow functions_.<br>\nSee [**subclassing**](subclassing.md) for more information.\n\n## Asynchronous actions\n\nIn essence, asynchronous processes don't need any special treatment in MobX, as all reactions will update automatically regardless of the moment in time they are caused.\nAnd since observable objects are mutable, it is generally safe to keep references to them for the duration of an action.\nHowever, every step (tick) that updates observables in an asynchronous process should be marked as `action`.\nThis can be achieved in multiple ways by leveraging the above APIs, as shown below.\n\nFor example, when handling promises, the handlers that update state should be actions or should be wrapped using `action`, as shown below.\n\n<!--DOCUSAURUS_CODE_TABS-->\n<!--Wrap handlers in `action`-->\n\nPromise resolution handlers are handled in-line, but run after the original action finished, so they need to be wrapped by `action`:\n\n```javascript\nimport { action, makeAutoObservable } from \"mobx\"\n\nclass Store {\n    githubProjects = []\n    state = \"pending\" // \"pending\", \"done\" or \"error\"\n\n    constructor() {\n        makeAutoObservable(this)\n    }\n\n    fetchProjects() {\n        this.githubProjects = []\n        this.state = \"pending\"\n        fetchGithubProjectsSomehow().then(\n            action(\"fetchSuccess\", projects => {\n                const filteredProjects = somePreprocessing(projects)\n                this.githubProjects = filteredProjects\n                this.state = \"done\"\n            }),\n            action(\"fetchError\", error => {\n                this.state = \"error\"\n            })\n        )\n    }\n}\n```\n\n<!--Handle updates in separate actions-->\n\nIf the promise handlers are class fields, they will automatically be wrapped in `action` by `makeAutoObservable`:\n\n```javascript\nimport { makeAutoObservable } from \"mobx\"\n\nclass Store {\n    githubProjects = []\n    state = \"pending\" // \"pending\", \"done\" or \"error\"\n\n    constructor() {\n        makeAutoObservable(this)\n    }\n\n    fetchProjects() {\n        this.githubProjects = []\n        this.state = \"pending\"\n        fetchGithubProjectsSomehow().then(this.projectsFetchSuccess, this.projectsFetchFailure)\n    }\n\n    projectsFetchSuccess = projects => {\n        const filteredProjects = somePreprocessing(projects)\n        this.githubProjects = filteredProjects\n        this.state = \"done\"\n    }\n\n    projectsFetchFailure = error => {\n        this.state = \"error\"\n    }\n}\n```\n\n<!--async/await + runInAction-->\n\nAny steps after `await` aren't in the same tick, so they require action wrapping.\nHere, we can leverage `runInAction`:\n\n```javascript\nimport { runInAction, makeAutoObservable } from \"mobx\"\n\nclass Store {\n    githubProjects = []\n    state = \"pending\" // \"pending\", \"done\" or \"error\"\n\n    constructor() {\n        makeAutoObservable(this)\n    }\n\n    async fetchProjects() {\n        this.githubProjects = []\n        this.state = \"pending\"\n        try {\n            const projects = await fetchGithubProjectsSomehow()\n            const filteredProjects = somePreprocessing(projects)\n            runInAction(() => {\n                this.githubProjects = filteredProjects\n                this.state = \"done\"\n            })\n        } catch (e) {\n            runInAction(() => {\n                this.state = \"error\"\n            })\n        }\n    }\n}\n```\n\n<!--`flow` + generator function -->\n\n```javascript\nimport { flow, makeAutoObservable, flowResult } from \"mobx\"\n\nclass Store {\n    githubProjects = []\n    state = \"pending\"\n\n    constructor() {\n        makeAutoObservable(this, {\n            fetchProjects: flow\n        })\n    }\n\n    // Note the star, this a generator function!\n    *fetchProjects() {\n        this.githubProjects = []\n        this.state = \"pending\"\n        try {\n            // Yield instead of await.\n            const projects = yield fetchGithubProjectsSomehow()\n            const filteredProjects = somePreprocessing(projects)\n            this.state = \"done\"\n            this.githubProjects = filteredProjects\n            return projects\n        } catch (error) {\n            this.state = \"error\"\n        }\n    }\n}\n\nconst store = new Store()\nconst projects = await flowResult(store.fetchProjects())\n```\n\n<!--END_DOCUSAURUS_CODE_TABS-->\n\n## Using flow instead of async / await {🚀}\n\nUsage:\n\n-   `flow` _(annotation)_\n-   `flow(function* (args) { })`\n-   `@flow` _(method decorator)_\n\nThe `flow` wrapper is an optional alternative to `async` / `await` that makes it easier to\nwork with MobX actions.\n`flow` takes a [generator function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Generator) as its only input.\nInside the generator, you can chain promises by yielding them (instead of `await somePromise` you write `yield somePromise`).\nThe flow mechanism will then make sure the generator either continues or throws when a yielded promise resolves.\n\nSo `flow` is an alternative to `async` / `await` that doesn't need any further `action` wrapping. It can be applied as follows:\n\n1. Wrap `flow` around your asynchronous function.\n2. Instead of `async` use `function *`.\n3. Instead of `await` use `yield`.\n\nThe [`flow` + generator function](#asynchronous-actions) example above shows what this looks like in practice.\n\nNote that the `flowResult` function is only needed when using TypeScript.\nSince decorating a method with `flow`, it will wrap the returned generator in a promise.\nHowever, TypeScript isn't aware of that transformation, so `flowResult` will make sure that TypeScript is aware of that type change.\n\n`makeAutoObservable` and friends will automatically infer generators to be `flow`s. `flow` annotated members will be non-enumerable.\n\n<details id=\"flow-wrap\"><summary>{🚀} **Note:** using flow on object fields<a href=\"#flow-wrap\" class=\"tip-anchor\"></a></summary>\n`flow`, like `action`, can be used to wrap functions directly. The above example could also have been written as follows:\n\n```typescript\nimport { flow, makeObservable, observable } from \"mobx\"\n\nclass Store {\n    githubProjects = []\n    state = \"pending\"\n\n    constructor() {\n        makeObservable(this, {\n            githubProjects: observable,\n            state: observable,\n        })\n    }\n\n    fetchProjects = flow(function* (this: Store) {\n        this.githubProjects = []\n        this.state = \"pending\"\n        try {\n            // yield instead of await.\n            const projects = yield fetchGithubProjectsSomehow()\n            const filteredProjects = somePreprocessing(projects)\n            this.state = \"done\"\n            this.githubProjects = filteredProjects\n        } catch (error) {\n            this.state = \"error\"\n        }\n    })\n}\n\nconst store = new Store()\nconst projects = await store.fetchProjects()\n```\n\nThe upside is that we don't need `flowResult` anymore, the downside is that `this` needs to be typed to make sure its type is inferred correctly.\n\n</details>\n\n## `flow.bound`\n\nUsage:\n\n-   `flow.bound` _(annotation)_\n\nThe `flow.bound` annotation can be used to automatically bind a method to the correct instance, so that `this` is always correctly bound inside the function.\nSimilarly to actions, flows can be bound by default using [`autoBind` option](#auto-bind).\n\n## Cancelling flows {🚀}\n\nAnother neat benefit of flows is that they are cancellable.\nThe return value of `flow` is a promise that resolves with the value that is returned from the generator function in the end.\nThe returned promise has an additional `cancel()` method that will interrupt the running generator and cancel it.\nAny `try` / `finally` clauses will still be run.\n\n## Disabling mandatory actions {🚀}\n\nBy default, MobX 6 and later require that you use actions to make changes to the state.\nHowever, you can configure MobX to disable this behavior. Check out the [`enforceActions`](configuration.md#enforceactions) section.\nFor example, this can be quite useful in unit test setup, where the warnings don't always have much value.\n"
  },
  {
    "path": "docs/analyzing-reactivity.md",
    "content": "---\ntitle: Analyzing reactivity\nsidebar_label: Analyzing reactivity {🚀}\nhide_title: true\n---\n\n<script async type=\"text/javascript\" src=\"//cdn.carbonads.com/carbon.js?serve=CEBD4KQ7&placement=mobxjsorg\" id=\"_carbonads_js\"></script>\n\n# Analyzing reactivity {🚀}\n\n# Using `trace` for debugging\n\nTrace is a small utility that helps you find out why your computed values, reactions or components are re-evaluating.\n\nIt can be used by simply importing `import { trace } from \"mobx\"`, and then putting it inside a reaction or computed value.\nIt will print why it is re-evaluating the current derivation.\n\nOptionally it is possible to automatically enter the debugger by passing `true` as the last argument.\nThis way the exact mutation that causes the reaction to re-run will still be in stack, usually ~8 stack frames up. See the image below.\n\nIn debugger mode, the debug information will also reveal the full derivation tree that is affecting the current computation / reaction.\n\n![trace](assets/trace-tips2.png)\n\n![trace](assets/trace.gif)\n\n## Live examples\n\nSimple [CodeSandbox `trace` example](https://codesandbox.io/s/trace-dnhbz?file=/src/index.js:309-338).\n\n[Here's a deployed example](https://csb-nr58ylyn4m-hontnuliaa.now.sh/) for exploring the stack.\nMake sure to play with the chrome debugger's blackbox feature!\n\n## Usage examples\n\nThere are different ways of calling `trace()`, some examples:\n\n```javascript\nimport { observer } from \"mobx-react\"\nimport { trace } from \"mobx\"\n\nconst MyComponent = observer(() => {\n    trace(true) // Enter the debugger whenever an observable value causes this component to re-run.\n    return <div>{this.props.user.name}</name>\n})\n```\n\nEnable trace by using the `reaction` argument of a reaction / autorun:\n\n```javascript\nmobx.autorun(\"logger\", reaction => {\n    reaction.trace()\n    console.log(user.fullname)\n})\n```\n\nPass in the property name of a computed property:\n\n```javascript\ntrace(user, \"fullname\")\n```\n\n# Introspection APIs\n\nThe following APIs might come in handy if you want to inspect the internal state of MobX while debugging, or want to build cool tools on top of MobX.\nAlso relevant are the various [`isObservable*` APIs](api.md#isobservable).\n\n### `getDebugName`\n\nUsage:\n\n-   `getDebugName(thing, property?)`\n\nReturns a (generated) friendly debug name of an observable object, property, reaction etc. Used for example by the [MobX developer tools](https://github.com/mobxjs/mobx-devtools).\n\n### `getDependencyTree`\n\nUsage:\n\n-   `getDependencyTree(thing, property?)`.\n\nReturns a tree structure with all observables the given reaction / computation currently depends upon.\n\n### `getObserverTree`\n\nUsage:\n\n-   `getObserverTree(thing, property?)`.\n\nReturns a tree structure with all reactions / computations that are observing the given observable.\n\n### `getAtom`\n\nUsage:\n\n-   `getAtom(thing, property?)`.\n\nReturns the backing _Atom_ of a given observable object, property, reaction etc.\n\n# Spy\n\nUsage:\n\n-   `spy(listener)`\n\nRegisters a global spy listener that listens to all events that happen in MobX.\nIt is similar to attaching an `observe` listener to _all_ observables at once, but also notifies about running (trans/re)actions and computations.\nUsed for example by the [MobX developer tools](https://github.com/mobxjs/mobx-devtools).\n\nExample usage of spying all actions:\n\n```javascript\nspy(event => {\n    if (event.type === \"action\") {\n        console.log(`${event.name} with args: ${event.arguments}`)\n    }\n})\n```\n\nSpy listeners always receive one object, which usually has at least a `type` field. The following events are emitted by default by spy:\n\n| Type                            | observableKind | Other fields                                                   | Nested |\n| ------------------------------- | -------------- | -------------------------------------------------------------- | ------ |\n| action                          |                | name, object (scope), arguments[]                              | yes    |\n| scheduled-reaction              |                | name                                                           | no     |\n| reaction                        |                | name                                                           | yes    |\n| error                           |                | name, message, error                                           | no     |\n| add,update,remove,delete,splice |                | Check out [Intercept & observe {🚀}](intercept-and-observe.md) | yes    |\n| report-end                      |                | spyReportEnd=true, time? (total execution time in ms)          | no     |\n\nThe `report-end` events are part of an earlier fired event that had `spyReportStart: true`.\nThis event indicates the end of an event and this way groups of events with sub-events are created.\nThis event might report the total execution time as well.\n\nThe spy events for observable values are identical to the events passed to `observe`.\nIn production builds, the `spy` API is a no-op as it will be minimized away.\n\nCheck out the [Intercept & observe {🚀}](intercept-and-observe.md#event-overview) section for an extensive overview.\n"
  },
  {
    "path": "docs/api.md",
    "content": "---\ntitle: MobX API Reference\nsidebar_label: API\nhide_title: true\n---\n\n<script async type=\"text/javascript\" src=\"//cdn.carbonads.com/carbon.js?serve=CEBD4KQ7&placement=mobxjsorg\" id=\"_carbonads_js\"></script>\n\n# MobX API Reference\n\nFunctions marked with {🚀} are considered advanced, and should typically not be needed.\nConsider downloading our handy cheat sheet that explains all important APIs on a single page:\n\n<div class=\"cheat\"><a href=\"https://gum.co/fSocU\"><button title=\"Download the MobX 6 cheat sheet and sponsor the project\">Get the MobX 6 cheat sheet (£5)</button></a></div>\n\n## Core APIs\n\n_These are the most important MobX APIs._\n\n> Understanding [`observable`](#observable), [`computed`](#computed), [`reaction`](#reaction) and [`action`](#action) is enough to master and use MobX in your applications!\n\n## Creating observables\n\n_Making things observable._\n\n### `makeObservable`\n\nUsage: `makeObservable(target, annotations?, options?)`\n<small>(<b>[further information](observable-state.md#makeobservable)</b>)</small>\n\nProperties, entire objects, arrays, Maps and Sets can all be made observable.\n\n### `makeAutoObservable`\n\nUsage: `makeAutoObservable(target, overrides?, options?)`\n<small>(<b>[further information](observable-state.md#makeautoobservable)</b>)</small>\n\nAutomatically make properties, objects, arrays, Maps and Sets observable.\n\n### `extendObservable`\n\n{🚀} Usage: `extendObservable(target, properties, overrides?, options?)`\n\nCan be used to introduce new properties on the `target` object and make them observable immediately. Basically a shorthand for `Object.assign(target, properties); makeAutoObservable(target, overrides, options);`. However, existing properties on `target` won't be touched.\n\nOld-fashioned constructor functions can nicely leverage `extendObservable`:\n\n```javascript\nfunction Person(firstName, lastName) {\n    extendObservable(this, { firstName, lastName })\n}\n\nconst person = new Person(\"Michel\", \"Weststrate\")\n```\n\nIt is possible to use `extendObservable` to add observable fields to an existing object after instantiation, but be careful that adding an observable property this way is in itself not a fact that can be observed.\n\n### `observable`\n\nUsage: `observable(source, overrides?, options?)`, `observable` _(annotation)_ or `@observable accessor` _(field decorator)_.\n<small>(<b>[further information](observable-state.md#observable)</b>)</small>\n\nClones an object and makes it observable. Source can be a plain object, array, Map or Set. By default, `observable` is applied recursively. If one of the encountered values is an object or array, that value will be passed through `observable` as well.\n\n### `observable.object`\n\n{🚀} Usage: `observable.object(source, overrides?, options?)`\n<small>(<b>[further information](observable-state.md#observable)</b>)</small>\n\nAlias for `observable(source, overrides?, options?)`. Creates a clone of the provided object and makes all of its properties observable.\n\n### `observable.array`\n\n{🚀} Usage: `observable.array(initialValues?, options?)`\n\nCreates a new observable array based on the provided `initialValues`.\nTo convert observable arrays back to plain arrays, use the `.slice()` method, or check out [toJS](#tojs) to convert them recursively.\nBesides all the language built-in array functions, the following goodies are available on observable arrays as well:\n\n-   `clear()` removes all current entries from the array.\n-   `replace(newItems)` replaces all existing entries in the array with new ones.\n-   `remove(value)` removes a single item by value from the array and returns `true` if the item was found and removed.\n\nIf the values in the array should not be turned into observables automatically, use the `{ deep: false }` option to make the array shallowly observable.\n\n### `observable.map`\n\n{🚀} Usage: `observable.map(initialMap?, options?)`\n\nCreates a new observable [ES6 Map](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map) based on the provided `initialMap`.\nThey are very useful if you don't want to react just to the change of a specific entry, but also to their addition and removal.\nCreating observable Maps is the recommended approach for creating dynamically keyed collections if you don't have [enabled Proxies](configuration.md#proxy-support).\n\nBesides all the language built-in Map functions, the following goodies are available on observable Maps as well:\n\n-   `toJSON()` returns a shallow plain object representation of this Map (use [toJS](#tojs) for a deep copy).\n-   `merge(values)` copies all entries from the provided `values` (plain object, array of entries or a string-keyed ES6 Map) into this Map.\n-   `replace(values)` replaces the entire contents of this Map with the provided `values`.\n\nIf the values in the Map should not be turned into observables automatically, use the `{ deep: false }` option to make the Map shallowly observable.\n\n### `observable.set`\n\n{🚀} Usage: `observable.set(initialSet?, options?)`\n\nCreates a new observable [ES6 Set](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set) based on the provided `initialSet`. Use it whenever you want to create a dynamic set where the addition and removal of values needs to be observed, but where values can appear only once in the entire collection.\n\nIf the values in the Set should not be turned into observables automatically, use the `{ deep: false }` option to make the Set shallowly observable.\n\nUnlike Map keys, Set values are [not tracked individually](https://github.com/mobxjs/mobx/issues/2336#issuecomment-616128089).\n\n### `observable.ref`\n\nUsage: `observable.ref` _(annotation)_\n<small>(<b>[further information](observable-state.md#available-annotations)</b>)</small>\n\nLike the `observable` annotation, but only reassignments will be tracked. The assigned values themselves won't be made observable automatically. For example, use this if you intend to store immutable data in an observable field.\n\n### `observable.shallow`\n\nUsage: `observable.shallow` _(annotation)_\n<small>(<b>[further information](observable-state.md#available-annotations)</b>)</small>\n\nLike the `observable.ref` annotation, but for collections. Any collection assigned will be made observable, but the contents of the collection itself won't become observable.\n\n### `observable.struct`\n\n{🚀} Usage: `observable.struct` _(annotation)_\n<small>(<b>[further information](observable-state.md#available-annotations)</b>)</small>\n\nLike the `observable` annotation, except that any assigned value that is structurally equal to the current value will be ignored.\n\n### `observable.deep`\n\n{🚀} Usage: `observable.deep` _(annotation)_\n<small>(<b>[further information](observable-state.md#available-annotations)</b>)</small>\n\nAlias for the [`observable`](#observable) annotation.\n\n### `observable.box`\n\n{🚀} Usage: `observable.box(value, options?)`\n\nAll primitive values in JavaScript are immutable and hence per definition not observable.\nUsually that is fine, as MobX can just make the _property_ that contains the value observable.\nIn rare cases, it can be convenient to have an observable _primitive_ that is not owned by an object.\nFor such cases, it is possible to create an observable _box_ that manages such a _primitive_.\n\n`observable.box(value)` accepts any value and stores it inside a box. The current value can be accessed through `.get()` and updated using `.set(newValue)`.\n\n```javascript\nimport { observable, autorun } from \"mobx\"\n\nconst cityName = observable.box(\"Vienna\")\n\nautorun(() => {\n    console.log(cityName.get())\n})\n// Prints: 'Vienna'\n\ncityName.set(\"Amsterdam\")\n// Prints: 'Amsterdam'\n```\n\nIf the values in the box should not be turned into observables automatically, use the `{ deep: false }` option to make the box shallowly observable.\n\n---\n\n## Actions\n\n_An action is any piece of code that modifies the state._\n\n### `action`\n\nUsage: `action(fn)`, `action` _(annotation)_ or `@action` _(method / field decorator)_\n<small>(<b>[further information](actions.md)</b>)</small>\n\nUse on functions that intend to modify the state.\n\n### `runInAction`\n\n{🚀} Usage: `runInAction(fn)`\n<small>(<b>[further information](actions.md#runinaction)</b>)</small>\n\nCreate a one-time action that is immediately invoked.\n\n### `flow`\n\nUsage: `flow(fn)`, `flow` _(annotation)_ or `@flow` _(generator method decorator)_\n<small>(<b>[further information](actions.md#using-flow-instead-of-async--await-)</b>)</small>\n\nMobX friendly replacement for `async` / `await` that supports cancellation.\n\n### `flowResult`\n\nUsage: `flowResult(flowFunctionResult)`\n<small>(<b>[further information](actions.md#using-flow-instead-of-async--await-)</b>)</small>\n\nFor TypeScript users only. Utility that casts the output of the generator to a promise.\nThis is just a type-wise correction for the promise wrapping done by `flow`. At runtime it directly returns the inputted value.\n\n---\n\n## Computeds\n\n_Computed values can be used to derive information from other observables._\n\n### `computed`\n\nUsage: `computed(fn, options?)`, `computed(options?)` _(annotation)_ or `@computed` _(getter decorator)_\n<small>(<b>[further information](computeds.md)</b>)</small>\n\nCreates an observable value that is derived from other observables, but won't be recomputed unless one of the underlying observables changes.\n\n---\n\n## React integration\n\n_From the `mobx-react` / `mobx-react-lite` packages._\n\n### `observer`\n\nUsage: `observer(component)`\n<small>(<b>[further information](react-integration.md)</b>)</small>\n\nA higher order component you can use to make a functional or class based React component re-render when observables change.\n\n### `Observer`\n\nUsage: `<Observer>{() => rendering}</Observer>`\n<small>(<b>[further information](react-integration.md#callback-components-might-require-observer)</b>)</small>\n\nRenders the given render function, and automatically re-renders it once one of the observables used in the render function changes.\n\n### `useLocalObservable`\n\nUsage: `useLocalObservable(() => source, annotations?)`\n<small>(<b>[further information](react-integration.md#using-local-observable-state-in-observer-components)</b>)</small>\n\nCreates a new observable object using `makeObservable`, and keeps it around in the component for the entire life-cycle of the component.\n\n---\n\n## Reactions\n\n_The goal of reactions is to model side effects that happen automatically._\n\n### `autorun`\n\nUsage: `autorun(() => effect, options?)`\n<small>(<b>[further information](reactions.md#autorun)</b>)</small>\n\nReruns a function every time anything it observes changes.\n\n### `reaction`\n\nUsage: `reaction(() => data, data => effect, options?)`\n<small>(<b>[further information](reactions.md#reaction)</b>)</small>\n\nReruns a side effect when any selected data changes.\n\n### `when`\n\nUsage: `when(() => condition, () => effect, options?)` or `await when(() => condition, options?)`\n<small>(<b>[further information](reactions.md#when)</b>)</small>\n\nExecutes a side effect once when a observable condition becomes true.\n\n---\n\n## Utilities\n\n_Utilities that might make working with observable objects or computed values more convenient. Less trivial utilities can also be found in the [mobx-utils](https://github.com/mobxjs/mobx-utils) package._\n\n### `onReactionError`\n\n{🚀} Usage: `onReactionError(handler: (error: any, derivation) => void)`\n\nAttaches a global error listener, which is invoked for every error that is thrown from a _reaction_. This can be used for monitoring or test purposes.\n\n### `intercept`\n\n{🚀} Usage: `intercept(propertyName|array|object|Set|Map, listener)`\n<small>(<b>[further information](intercept-and-observe.md#intercept)</b>)</small>\n\nIntercepts changes before they are applied to an observable API. Returns a disposer function that stops the interception.\n\n### `observe`\n\n{🚀} Usage: `observe(propertyName|array|object|Set|Map, listener)`\n<small>(<b>[further information](intercept-and-observe.md#observe)</b>)</small>\n\nLow-level API that can be used to observe a single observable value. Returns a disposer function that stops the interception.\n\n### `onBecomeObserved`\n\n{🚀} Usage: `onBecomeObserved(observable, property?, listener: () => void)`\n<small>(<b>[further information](lazy-observables.md)</b>)</small>\n\nHook for when something becomes observed.\n\n### `onBecomeUnobserved`\n\n{🚀} Usage: `onBecomeUnobserved(observable, property?, listener: () => void)`\n<small>(<b>[further information](lazy-observables.md)</b>)</small>\n\nHook for when something stops being observed.\n\n### `toJS`\n\nUsage: `toJS(value)`\n<small>(<b>[further information](observable-state.md#converting-observables-back-to-vanilla-javascript-collections)</b>)</small>\n\nRecursively converts an observable object to a JavaScript _object_. Supports observable arrays, objects, Maps and primitives.\n\nIt does NOT recurse into non-observables, these are left as they are, even if they contain observables.\nComputed and other non-enumerable properties are completely ignored and won't be returned.\n\nFor more complex (de)serialization scenarios, it is recommended to give classes a (computed) `toJSON` method, or use a serialization library like [serializr](https://github.com/mobxjs/serializr).\n\n```javascript\nconst obj = mobx.observable({\n    x: 1\n})\n\nconst clone = mobx.toJS(obj)\n\nconsole.log(mobx.isObservableObject(obj)) // true\nconsole.log(mobx.isObservableObject(clone)) // false\n```\n\n---\n\n## Configuration\n\n_Fine-tuning your MobX instance._\n\n### `configure`\n\nUsage: sets global behavior settings on the active MobX instance.\n<small>(<b>[further information](configuration.md)</b>)</small>\nUse it to change how MobX behaves as a whole.\n\n---\n\n## Collection utilities {🚀}\n\n_They enable manipulating observable arrays, objects and Maps with the same generic API. This can be useful in [environments without `Proxy` support](configuration.md#limitations-without-proxy-support), but is otherwise typically not needed._\n\n### `values`\n\n{🚀} Usage: `values(array|object|Set|Map)`\n<small>(<b>[further information](collection-utilities.md)</b>)</small>\n\nReturns all values in the collection as an array.\n\n### `keys`\n\n{🚀} Usage: `keys(array|object|Set|Map)`\n<small>(<b>[further information](collection-utilities.md)</b>)</small>\n\nReturns all keys / indices in the collection as an array.\n\n### `entries`\n\n{🚀} Usage: `entries(array|object|Set|Map)`\n<small>(<b>[further information](collection-utilities.md)</b>)</small>\n\nReturns a `[key, value]` pair of every entry in the collection as an array.\n\n### `set`\n\n{🚀} Usage: `set(array|object|Map, key, value)`\n<small>(<b>[further information](collection-utilities.md)</b>)</small>\n\nUpdates the collection.\n\n### `remove`\n\n{🚀} Usage: `remove(array|object|Map, key)`\n<small>(<b>[further information](collection-utilities.md)</b>)</small>\n\nRemoves item from the collection.\n\n### `has`\n\n{🚀} Usage: `has(array|object|Map, key)`\n<small>(<b>[further information](collection-utilities.md)</b>)</small>\n\nChecks for membership in the collection.\n\n### `get`\n\n{🚀} Usage: `get(array|object|Map, key)`\n<small>(<b>[further information](collection-utilities.md)</b>)</small>\n\nGets value from the collection with key.\n\n---\n\n## Introspection utilities {🚀}\n\n_Utilities that might come in handy if you want to inspect the internal state of MobX, or want to build cool tools on top of MobX._\n\n### `isObservable`\n\n{🚀} Usage: `isObservable(array|object|Set|Map)`\n\nIs the object / collection made observable by MobX?\n\n### `isObservableProp`\n\n{🚀} Usage: `isObservableProp(object, propertyName)`\n\nIs the property observable?\n\n### `isObservableArray`\n\n{🚀} Usage: `isObservableArray(array)`\n\nIs the value an observable array?\n\n### `isObservableObject`\n\n{🚀} Usage: `isObservableObject(object)`\n\nIs the value an observable object?\n\n### `isObservableSet`\n\n{🚀} Usage: `isObservableSet(set)`\n\nIs the value an observable Set?\n\n### `isObservableMap`\n\n{🚀} Usage: `isObservableMap(map)`\n\nIs the value an observable Map?\n\n### `isBoxedObservable`\n\n{🚀} Usage: `isBoxedObservable(value)`\n\nIs the value an observable box, created using `observable.box`?\n\n### `isAction`\n\n{🚀} Usage: `isAction(func)`\n\nIs the function marked as an `action`?\n\n### `isComputed`\n\n{🚀} Usage: `isComputed(boxedComputed)`\n\nIs this a boxed computed value, created using `computed(() => expr)`?\n\n### `isComputedProp`\n\n{🚀} Usage: `isComputedProp(object, propertyName)`\n\nIs this a computed property?\n\n### `trace`\n\n{🚀} Usage: `trace()`, `trace(true)` _(enter debugger)_ or `trace(object, propertyName, enterDebugger?)`\n<small>(<b>[further information](analyzing-reactivity.md)</b>)</small>\n\nShould be used inside an observer, reaction or computed value. Logs when the value is invalidated, or sets the debugger breakpoint if called with _true_.\n\n### `spy`\n\n{🚀} Usage: `spy(eventListener)`\n<small>(<b>[further information](analyzing-reactivity.md#spy)</b>)</small>\n\nRegisters a global spy listener that listens to all events that happen in MobX.\n\n### `getDebugName`\n\n{🚀} Usage: `getDebugName(reaction|array|Set|Map)` or `getDebugName(object|Map, propertyName)`\n<small>(<b>[further information](analyzing-reactivity.md#getdebugname)</b>)</small>\n\nReturns the (generated) friendly debug name for an observable or reaction.\n\n### `getDependencyTree`\n\n{🚀} Usage: `getDependencyTree(object, computedPropertyName)`\n<small>(<b>[further information](analyzing-reactivity.md#getdependencytree)</b>)</small>\n\nReturns a tree structure with all observables the given reaction / computation currently depends upon.\n\n### `getObserverTree`\n\n{🚀} Usage: `getObserverTree(array|Set|Map)` or `getObserverTree(object|Map, propertyName)`\n<small>(<b>[further information](analyzing-reactivity.md#getobservertree)</b>)</small>\n\nReturns a tree structure with all reactions / computations that are observing the given observable.\n\n---\n\n## Extending MobX {🚀}\n\n_In the rare case you want to extend MobX itself._\n\n### `createAtom`\n\n{🚀} Usage: `createAtom(name, onBecomeObserved?, onBecomeUnobserved?)`\n<small>(<b>[further information](custom-observables.md)</b>)</small>\n\nCreates your own observable data structure and hooks it up to MobX. Used internally by all observable data types. Atom exposes two _report_ methods to notify MobX with when:\n\n-   `reportObserved()`: the atom has become observed, and should be considered part of the dependency tree of the current derivation.\n-   `reportChanged()`: the atom has changed, and all derivations depending on it should be invalidated.\n\n### `getAtom`\n\n{🚀} Usage: `getAtom(thing, property?)`\n<small>(<b>[further information](analyzing-reactivity.md#getatom)</b>)</small>\n\nReturns the backing atom.\n\n### `transaction`\n\n{🚀} Usage: `transaction(worker: () => any)`\n\n_Transaction is a low-level API. It is recommended to use [`action`](#action) or [`runInAction`](#runinaction) instead._\n\nUsed to batch a bunch of updates without running any reactions until the end of the transaction. Like [`untracked`](#untracked), it is automatically applied by `action`, so usually it makes more sense to use actions than to use `transaction` directly.\n\nIt takes a single, parameterless `worker` function as an argument, and returns any value that was returned by it.\nNote that `transaction` runs completely synchronously and can be nested. Only after completing the outermost `transaction`, the pending reactions will be run.\n\n```javascript\nimport { observable, transaction, autorun } from \"mobx\"\n\nconst numbers = observable([])\n\nautorun(() => console.log(numbers.length, \"numbers!\"))\n// Prints: '0 numbers!'\n\ntransaction(() => {\n    transaction(() => {\n        numbers.push(1)\n        numbers.push(2)\n    })\n    numbers.push(3)\n})\n// Prints: '3 numbers!'\n```\n\n### `untracked`\n\n{🚀} Usage: `untracked(worker: () => any)`\n\n_Untracked is a low-level API. It is recommended to use [`reaction`](#reaction), [`action`](#action) or [`runInAction`](#runinaction) instead._\n\nRuns a piece of code without establishing observers. Like `transaction`, `untracked` is automatically applied by `action`, so usually it makes more sense to use actions than to use `untracked` directly.\n\n```javascript\nconst person = observable({\n    firstName: \"Michel\",\n    lastName: \"Weststrate\"\n})\n\nautorun(() => {\n    console.log(\n        person.lastName,\n        \",\",\n        // This untracked block will return the person's\n        // firstName without establishing a dependency.\n        untracked(() => person.firstName)\n    )\n})\n// Prints: 'Weststrate, Michel'\n\nperson.firstName = \"G.K.\"\n// Doesn't print!\n\nperson.lastName = \"Chesterton\"\n// Prints: 'Chesterton, G.K.'\n```\n"
  },
  {
    "path": "docs/assets/action-state-view.excalidraw",
    "content": "{\n  \"type\": \"excalidraw\",\n  \"version\": 2,\n  \"source\": \"https://excalidraw.com\",\n  \"elements\": [\n    {\n      \"id\": \"pIZO1JmQiFI2poIar1JJR\",\n      \"type\": \"rectangle\",\n      \"x\": 1265.39453125,\n      \"y\": 506.8125,\n      \"width\": 169.73437500000006,\n      \"height\": 42.90625,\n      \"angle\": 0,\n      \"strokeColor\": \"#000000\",\n      \"backgroundColor\": \"#fab005\",\n      \"fillStyle\": \"hachure\",\n      \"strokeWidth\": 1,\n      \"strokeStyle\": \"solid\",\n      \"roughness\": 1,\n      \"opacity\": 100,\n      \"groupIds\": [],\n      \"seed\": 217429890,\n      \"version\": 373,\n      \"versionNonce\": 1117308162,\n      \"isDeleted\": false\n    },\n    {\n      \"id\": \"pD5v3-2w2hmmHs3ijydzw\",\n      \"type\": \"text\",\n      \"x\": 1288.564453125,\n      \"y\": 513.876953125,\n      \"width\": 126,\n      \"height\": 25,\n      \"angle\": 0,\n      \"strokeColor\": \"#000000\",\n      \"backgroundColor\": \"transparent\",\n      \"fillStyle\": \"hachure\",\n      \"strokeWidth\": 1,\n      \"strokeStyle\": \"solid\",\n      \"roughness\": 1,\n      \"opacity\": 100,\n      \"groupIds\": [],\n      \"seed\": 258359006,\n      \"version\": 335,\n      \"versionNonce\": 1677952030,\n      \"isDeleted\": false,\n      \"text\": \"reduceEnergy\",\n      \"fontSize\": 20,\n      \"fontFamily\": 1,\n      \"textAlign\": \"center\",\n      \"verticalAlign\": \"middle\",\n      \"baseline\": 18\n    },\n    {\n      \"id\": \"u7JpBImi1GLSlmI3XfhSo\",\n      \"type\": \"rectangle\",\n      \"x\": 1016.30859375,\n      \"y\": 490.58984375,\n      \"width\": 96.56250000000003,\n      \"height\": 51.124999999999986,\n      \"angle\": 0,\n      \"strokeColor\": \"#000000\",\n      \"backgroundColor\": \"#228be6\",\n      \"fillStyle\": \"hachure\",\n      \"strokeWidth\": 1,\n      \"strokeStyle\": \"solid\",\n      \"roughness\": 1,\n      \"opacity\": 100,\n      \"groupIds\": [],\n      \"seed\": 1302734018,\n      \"version\": 259,\n      \"versionNonce\": 1929172162,\n      \"isDeleted\": false\n    },\n    {\n      \"id\": \"BWk9D8NLVXhfJLVv98F7C\",\n      \"type\": \"text\",\n      \"x\": 1026.07421875,\n      \"y\": 500.50390625,\n      \"width\": 76,\n      \"height\": 25,\n      \"angle\": 0,\n      \"strokeColor\": \"#000000\",\n      \"backgroundColor\": \"transparent\",\n      \"fillStyle\": \"hachure\",\n      \"strokeWidth\": 1,\n      \"strokeStyle\": \"solid\",\n      \"roughness\": 1,\n      \"opacity\": 100,\n      \"groupIds\": [],\n      \"seed\": 1412671326,\n      \"version\": 121,\n      \"versionNonce\": 1736003678,\n      \"isDeleted\": false,\n      \"text\": \"isHungry\",\n      \"fontSize\": 20,\n      \"fontFamily\": 1,\n      \"textAlign\": \"center\",\n      \"verticalAlign\": \"top\",\n      \"baseline\": 18\n    },\n    {\n      \"id\": \"4-ymabCsXtPMIqHbdW8oE\",\n      \"type\": \"rectangle\",\n      \"x\": 531.86328125,\n      \"y\": 477.41015625,\n      \"width\": 320.26171875000006,\n      \"height\": 119.37500000000001,\n      \"angle\": 0,\n      \"strokeColor\": \"#000000\",\n      \"backgroundColor\": \"#fa5252\",\n      \"fillStyle\": \"hachure\",\n      \"strokeWidth\": 1,\n      \"strokeStyle\": \"solid\",\n      \"roughness\": 1,\n      \"opacity\": 100,\n      \"groupIds\": [],\n      \"seed\": 500763422,\n      \"version\": 549,\n      \"versionNonce\": 1668755806,\n      \"isDeleted\": false\n    },\n    {\n      \"id\": \"LKVSistQFQl5dwvDIha03\",\n      \"type\": \"text\",\n      \"x\": 548.16796875,\n      \"y\": 485.490234375,\n      \"width\": 74,\n      \"height\": 25,\n      \"angle\": 0,\n      \"strokeColor\": \"#000000\",\n      \"backgroundColor\": \"transparent\",\n      \"fillStyle\": \"hachure\",\n      \"strokeWidth\": 1,\n      \"strokeStyle\": \"solid\",\n      \"roughness\": 1,\n      \"opacity\": 100,\n      \"groupIds\": [],\n      \"seed\": 275201474,\n      \"version\": 248,\n      \"versionNonce\": 399874946,\n      \"isDeleted\": false,\n      \"text\": \"autorun\",\n      \"fontSize\": 20,\n      \"fontFamily\": 1,\n      \"textAlign\": \"center\",\n      \"verticalAlign\": \"middle\",\n      \"baseline\": 18\n    },\n    {\n      \"id\": \"AmfUhwRl3kmfUpDL-cz69\",\n      \"type\": \"arrow\",\n      \"x\": 893.578125,\n      \"y\": 542.67578125,\n      \"width\": 103.203125,\n      \"height\": 26.18359375,\n      \"angle\": 0,\n      \"strokeColor\": \"#000000\",\n      \"backgroundColor\": \"#fa5252\",\n      \"fillStyle\": \"hachure\",\n      \"strokeWidth\": 1,\n      \"strokeStyle\": \"solid\",\n      \"roughness\": 1,\n      \"opacity\": 100,\n      \"groupIds\": [],\n      \"seed\": 14401054,\n      \"version\": 98,\n      \"versionNonce\": 1922705986,\n      \"isDeleted\": false,\n      \"points\": [\n        [\n          0,\n          0\n        ],\n        [\n          103.203125,\n          -26.18359375\n        ]\n      ],\n      \"lastCommittedPoint\": null\n    },\n    {\n      \"id\": \"5Ri4oSpXCOayASosdJczV\",\n      \"type\": \"rectangle\",\n      \"x\": 643.65625,\n      \"y\": 500.65234375,\n      \"width\": 181.6875,\n      \"height\": 77.12109375,\n      \"angle\": 0,\n      \"strokeColor\": \"#000000\",\n      \"backgroundColor\": \"#fff\",\n      \"fillStyle\": \"solid\",\n      \"strokeWidth\": 1,\n      \"strokeStyle\": \"solid\",\n      \"roughness\": 1,\n      \"opacity\": 100,\n      \"groupIds\": [],\n      \"seed\": 958282526,\n      \"version\": 72,\n      \"versionNonce\": 1344405954,\n      \"isDeleted\": false\n    },\n    {\n      \"id\": \"4VRPEmGVy-I7ISGPIC3lG\",\n      \"type\": \"text\",\n      \"x\": 697,\n      \"y\": 526.712890625,\n      \"width\": 75,\n      \"height\": 25,\n      \"angle\": 0,\n      \"strokeColor\": \"#000000\",\n      \"backgroundColor\": \"#fff\",\n      \"fillStyle\": \"solid\",\n      \"strokeWidth\": 1,\n      \"strokeStyle\": \"solid\",\n      \"roughness\": 1,\n      \"opacity\": 100,\n      \"groupIds\": [],\n      \"seed\": 132157534,\n      \"version\": 17,\n      \"versionNonce\": 1011446622,\n      \"isDeleted\": false,\n      \"text\": \"function\",\n      \"fontSize\": 20,\n      \"fontFamily\": 1,\n      \"textAlign\": \"center\",\n      \"verticalAlign\": \"middle\",\n      \"baseline\": 18\n    },\n    {\n      \"id\": \"FQzAKSjfUWyDZAjvXVOY5\",\n      \"type\": \"text\",\n      \"x\": 537.37890625,\n      \"y\": 429.46484375,\n      \"width\": 217,\n      \"height\": 25,\n      \"angle\": 0,\n      \"strokeColor\": \"#000000\",\n      \"backgroundColor\": \"#fff\",\n      \"fillStyle\": \"solid\",\n      \"strokeWidth\": 1,\n      \"strokeStyle\": \"solid\",\n      \"roughness\": 1,\n      \"opacity\": 100,\n      \"groupIds\": [],\n      \"seed\": 1833437214,\n      \"version\": 104,\n      \"versionNonce\": 499153282,\n      \"isDeleted\": false,\n      \"text\": \"1. autorun runs initially\",\n      \"fontSize\": 20,\n      \"fontFamily\": 1,\n      \"textAlign\": \"left\",\n      \"verticalAlign\": \"top\",\n      \"baseline\": 18\n    },\n    {\n      \"id\": \"DaIFjPSHk2uPQUxrBhM14\",\n      \"type\": \"text\",\n      \"x\": 897.24609375,\n      \"y\": 434.5,\n      \"width\": 197,\n      \"height\": 25,\n      \"angle\": 0,\n      \"strokeColor\": \"#000000\",\n      \"backgroundColor\": \"#fff\",\n      \"fillStyle\": \"solid\",\n      \"strokeWidth\": 1,\n      \"strokeStyle\": \"solid\",\n      \"roughness\": 1,\n      \"opacity\": 100,\n      \"groupIds\": [],\n      \"seed\": 1406985630,\n      \"version\": 127,\n      \"versionNonce\": 2009028510,\n      \"isDeleted\": false,\n      \"text\": \"2. read & subscribe\",\n      \"fontSize\": 20,\n      \"fontFamily\": 1,\n      \"textAlign\": \"left\",\n      \"verticalAlign\": \"top\",\n      \"baseline\": 18\n    },\n    {\n      \"id\": \"gdEVREQf-CI_WiOGb0k0p\",\n      \"type\": \"arrow\",\n      \"x\": 1248.12109375,\n      \"y\": 535.2734375,\n      \"width\": 117.19921875,\n      \"height\": 10.93359375,\n      \"angle\": 0,\n      \"strokeColor\": \"#000000\",\n      \"backgroundColor\": \"#fff\",\n      \"fillStyle\": \"solid\",\n      \"strokeWidth\": 1,\n      \"strokeStyle\": \"solid\",\n      \"roughness\": 1,\n      \"opacity\": 100,\n      \"groupIds\": [],\n      \"seed\": 419114910,\n      \"version\": 39,\n      \"versionNonce\": 1265546206,\n      \"isDeleted\": false,\n      \"points\": [\n        [\n          0,\n          0\n        ],\n        [\n          -117.19921875,\n          -10.93359375\n        ]\n      ],\n      \"lastCommittedPoint\": null\n    },\n    {\n      \"id\": \"2L7qtsz980qi281apFm68\",\n      \"type\": \"text\",\n      \"x\": 1170.65625,\n      \"y\": 565.06640625,\n      \"width\": 161,\n      \"height\": 25,\n      \"angle\": 0,\n      \"strokeColor\": \"#000000\",\n      \"backgroundColor\": \"#fff\",\n      \"fillStyle\": \"solid\",\n      \"strokeWidth\": 1,\n      \"strokeStyle\": \"solid\",\n      \"roughness\": 1,\n      \"opacity\": 100,\n      \"groupIds\": [],\n      \"seed\": 942371998,\n      \"version\": 36,\n      \"versionNonce\": 1861058818,\n      \"isDeleted\": false,\n      \"text\": \"3. update state\",\n      \"fontSize\": 20,\n      \"fontFamily\": 1,\n      \"textAlign\": \"left\",\n      \"verticalAlign\": \"top\",\n      \"baseline\": 18\n    },\n    {\n      \"id\": \"W81Z7ZPQ_NNZj_IpAcRgP\",\n      \"type\": \"arrow\",\n      \"x\": 1055.921875,\n      \"y\": 563.03125,\n      \"width\": 283.78515625,\n      \"height\": 130.73046875,\n      \"angle\": 0,\n      \"strokeColor\": \"#000000\",\n      \"backgroundColor\": \"#fff\",\n      \"fillStyle\": \"solid\",\n      \"strokeWidth\": 1,\n      \"strokeStyle\": \"solid\",\n      \"roughness\": 1,\n      \"opacity\": 100,\n      \"groupIds\": [],\n      \"seed\": 93774430,\n      \"version\": 90,\n      \"versionNonce\": 1080000386,\n      \"isDeleted\": false,\n      \"points\": [\n        [\n          0,\n          0\n        ],\n        [\n          -169.859375,\n          130.73046875\n        ],\n        [\n          -283.78515625,\n          56.4453125\n        ]\n      ],\n      \"lastCommittedPoint\": [\n        -283.78515625,\n        56.4453125\n      ]\n    },\n    {\n      \"id\": \"7PSGJMcV7z4iygXHJNS_o\",\n      \"type\": \"text\",\n      \"x\": 966.2265625,\n      \"y\": 676.7265625,\n      \"width\": 276,\n      \"height\": 25,\n      \"angle\": 0,\n      \"strokeColor\": \"#000000\",\n      \"backgroundColor\": \"#fff\",\n      \"fillStyle\": \"solid\",\n      \"strokeWidth\": 1,\n      \"strokeStyle\": \"solid\",\n      \"roughness\": 1,\n      \"opacity\": 100,\n      \"groupIds\": [],\n      \"seed\": 775974494,\n      \"version\": 50,\n      \"versionNonce\": 1448293598,\n      \"isDeleted\": false,\n      \"text\": \"4. notify and re-run autorun\",\n      \"fontSize\": 20,\n      \"fontFamily\": 1,\n      \"textAlign\": \"left\",\n      \"verticalAlign\": \"top\",\n      \"baseline\": 18\n    }\n  ],\n  \"appState\": {\n    \"viewBackgroundColor\": \"#ffffff\",\n    \"gridSize\": null\n  }\n}"
  },
  {
    "path": "docs/assets/flow.excalidraw..excalidraw..excalidraw",
    "content": "{\n  \"type\": \"excalidraw\",\n  \"version\": 2,\n  \"source\": \"https://excalidraw.com\",\n  \"elements\": [\n    {\n      \"id\": \"umJvYNbrYyosAii0TCe8X\",\n      \"type\": \"ellipse\",\n      \"x\": 600.93359375,\n      \"y\": 295.0234375,\n      \"width\": 166,\n      \"height\": 98.13671875,\n      \"angle\": 0,\n      \"strokeColor\": \"#000000\",\n      \"backgroundColor\": \"#fd7e14\",\n      \"fillStyle\": \"hachure\",\n      \"strokeWidth\": 1,\n      \"strokeStyle\": \"solid\",\n      \"roughness\": 1,\n      \"opacity\": 100,\n      \"groupIds\": [],\n      \"strokeSharpness\": \"sharp\",\n      \"seed\": 798279679,\n      \"version\": 61,\n      \"versionNonce\": 534261841,\n      \"isDeleted\": false,\n      \"boundElementIds\": [\n        \"SQTF1dyrT_6IGmfEPfDFk\",\n        \"Qs4t0BM0S_4Pke8rNKbmD\",\n        \"c9iGYLrlWNl56Bq2qFVR3\"\n      ]\n    },\n    {\n      \"id\": \"tMxgXvq5-KCTnP_iTfUt8\",\n      \"type\": \"text\",\n      \"x\": 648.93359375,\n      \"y\": 331.826171875,\n      \"width\": 70,\n      \"height\": 25,\n      \"angle\": 0,\n      \"strokeColor\": \"#000000\",\n      \"backgroundColor\": \"transparent\",\n      \"fillStyle\": \"hachure\",\n      \"strokeWidth\": 1,\n      \"strokeStyle\": \"solid\",\n      \"roughness\": 1,\n      \"opacity\": 100,\n      \"groupIds\": [],\n      \"strokeSharpness\": \"sharp\",\n      \"seed\": 1329095185,\n      \"version\": 11,\n      \"versionNonce\": 637794161,\n      \"isDeleted\": false,\n      \"boundElementIds\": null,\n      \"text\": \"Actions\",\n      \"fontSize\": 20,\n      \"fontFamily\": 1,\n      \"textAlign\": \"center\",\n      \"verticalAlign\": \"middle\",\n      \"baseline\": 18\n    },\n    {\n      \"id\": \"fESH7TjYaPiRAXCLgu6gj\",\n      \"type\": \"ellipse\",\n      \"x\": 889.2734375,\n      \"y\": 293.07421875,\n      \"width\": 153.390625,\n      \"height\": 97.08984375,\n      \"angle\": 0,\n      \"strokeColor\": \"#000000\",\n      \"backgroundColor\": \"#228be6\",\n      \"fillStyle\": \"cross-hatch\",\n      \"strokeWidth\": 1,\n      \"strokeStyle\": \"solid\",\n      \"roughness\": 1,\n      \"opacity\": 100,\n      \"groupIds\": [],\n      \"strokeSharpness\": \"sharp\",\n      \"seed\": 754120735,\n      \"version\": 162,\n      \"versionNonce\": 277796639,\n      \"isDeleted\": false,\n      \"boundElementIds\": [\n        \"SQTF1dyrT_6IGmfEPfDFk\",\n        \"Gfe2kVUk-oe4nZFYZ4TS2\"\n      ]\n    },\n    {\n      \"id\": \"YNybqj5LHUYEaaw-npqM0\",\n      \"type\": \"text\",\n      \"x\": 913.22265625,\n      \"y\": 316.373046875,\n      \"width\": 105,\n      \"height\": 50,\n      \"angle\": 0,\n      \"strokeColor\": \"#000000\",\n      \"backgroundColor\": \"transparent\",\n      \"fillStyle\": \"hachure\",\n      \"strokeWidth\": 1,\n      \"strokeStyle\": \"solid\",\n      \"roughness\": 1,\n      \"opacity\": 100,\n      \"groupIds\": [],\n      \"strokeSharpness\": \"sharp\",\n      \"seed\": 1139926705,\n      \"version\": 92,\n      \"versionNonce\": 806532223,\n      \"isDeleted\": false,\n      \"boundElementIds\": null,\n      \"text\": \"Observable\\nState\",\n      \"fontSize\": 20,\n      \"fontFamily\": 1,\n      \"textAlign\": \"center\",\n      \"verticalAlign\": \"middle\",\n      \"baseline\": 43\n    },\n    {\n      \"id\": \"Rp_m5EtBqLK880zk0HPes\",\n      \"type\": \"ellipse\",\n      \"x\": 1168.73046875,\n      \"y\": 287.671875,\n      \"width\": 152.62109375,\n      \"height\": 101.0078125,\n      \"angle\": 0,\n      \"strokeColor\": \"#000000\",\n      \"backgroundColor\": \"#82c91e\",\n      \"fillStyle\": \"hachure\",\n      \"strokeWidth\": 1,\n      \"strokeStyle\": \"solid\",\n      \"roughness\": 1,\n      \"opacity\": 100,\n      \"groupIds\": [],\n      \"strokeSharpness\": \"sharp\",\n      \"seed\": 979115551,\n      \"version\": 137,\n      \"versionNonce\": 842295903,\n      \"isDeleted\": false,\n      \"boundElementIds\": [\n        \"Gfe2kVUk-oe4nZFYZ4TS2\",\n        \"muBFJlzUT62Z5u6vtgoPo\"\n      ]\n    },\n    {\n      \"id\": \"bUQmcBczRpetKGA2QAQOC\",\n      \"type\": \"text\",\n      \"x\": 1198.294921875,\n      \"y\": 313.17578125,\n      \"width\": 93,\n      \"height\": 50,\n      \"angle\": 0,\n      \"strokeColor\": \"#000000\",\n      \"backgroundColor\": \"transparent\",\n      \"fillStyle\": \"hachure\",\n      \"strokeWidth\": 1,\n      \"strokeStyle\": \"solid\",\n      \"roughness\": 1,\n      \"opacity\": 100,\n      \"groupIds\": [],\n      \"strokeSharpness\": \"sharp\",\n      \"seed\": 21397215,\n      \"version\": 89,\n      \"versionNonce\": 275028479,\n      \"isDeleted\": false,\n      \"boundElementIds\": null,\n      \"text\": \"Computed\\nValues\",\n      \"fontSize\": 20,\n      \"fontFamily\": 1,\n      \"textAlign\": \"center\",\n      \"verticalAlign\": \"middle\",\n      \"baseline\": 43\n    },\n    {\n      \"id\": \"2iAmN0ThUq3khqXmobwXR\",\n      \"type\": \"ellipse\",\n      \"x\": 1440.24609375,\n      \"y\": 280.24609375,\n      \"width\": 180,\n      \"height\": 97.82421875,\n      \"angle\": 0,\n      \"strokeColor\": \"#000000\",\n      \"backgroundColor\": \"#fa5252\",\n      \"fillStyle\": \"hachure\",\n      \"strokeWidth\": 1,\n      \"strokeStyle\": \"solid\",\n      \"roughness\": 1,\n      \"opacity\": 100,\n      \"groupIds\": [],\n      \"strokeSharpness\": \"sharp\",\n      \"seed\": 155797873,\n      \"version\": 93,\n      \"versionNonce\": 1218509617,\n      \"isDeleted\": false,\n      \"boundElementIds\": [\n        \"muBFJlzUT62Z5u6vtgoPo\",\n        \"YsOB3_rayI5zJZmc-0vka\",\n        \"MwGF75DmHeJQFvsbtXTC3\",\n        \"c9iGYLrlWNl56Bq2qFVR3\"\n      ]\n    },\n    {\n      \"id\": \"-ksRGDFon1_cAw4yzn-NY\",\n      \"type\": \"text\",\n      \"x\": 1468.4375,\n      \"y\": 303.76953125,\n      \"width\": 122,\n      \"height\": 50,\n      \"angle\": 0,\n      \"strokeColor\": \"#000000\",\n      \"backgroundColor\": \"transparent\",\n      \"fillStyle\": \"hachure\",\n      \"strokeWidth\": 1,\n      \"strokeStyle\": \"solid\",\n      \"roughness\": 1,\n      \"opacity\": 100,\n      \"groupIds\": [],\n      \"strokeSharpness\": \"sharp\",\n      \"seed\": 919383807,\n      \"version\": 107,\n      \"versionNonce\": 1840129151,\n      \"isDeleted\": false,\n      \"boundElementIds\": null,\n      \"text\": \"Side-effects\\n(like render)\",\n      \"fontSize\": 20,\n      \"fontFamily\": 1,\n      \"textAlign\": \"center\",\n      \"verticalAlign\": \"middle\",\n      \"baseline\": 43\n    },\n    {\n      \"id\": \"SQTF1dyrT_6IGmfEPfDFk\",\n      \"type\": \"arrow\",\n      \"x\": 778.8445740250362,\n      \"y\": 346.239580272118,\n      \"width\": 99.00070983588682,\n      \"height\": 1.6378151789648427,\n      \"angle\": 0,\n      \"strokeColor\": \"#000000\",\n      \"backgroundColor\": \"transparent\",\n      \"fillStyle\": \"hachure\",\n      \"strokeWidth\": 1,\n      \"strokeStyle\": \"solid\",\n      \"roughness\": 1,\n      \"opacity\": 100,\n      \"groupIds\": [],\n      \"strokeSharpness\": \"round\",\n      \"seed\": 1143683505,\n      \"version\": 44,\n      \"versionNonce\": 965939217,\n      \"isDeleted\": false,\n      \"boundElementIds\": null,\n      \"points\": [\n        [\n          0,\n          0\n        ],\n        [\n          99.00070983588682,\n          -1.6378151789648427\n        ]\n      ],\n      \"lastCommittedPoint\": null,\n      \"startBinding\": {\n        \"elementId\": \"umJvYNbrYyosAii0TCe8X\",\n        \"focus\": 0.07806863034707597,\n        \"gap\": 11.969792579631289\n      },\n      \"endBinding\": {\n        \"elementId\": \"fESH7TjYaPiRAXCLgu6gj\",\n        \"focus\": -0.031398466371432183,\n        \"gap\": 11.536940281179355\n      }\n    },\n    {\n      \"id\": \"Gfe2kVUk-oe4nZFYZ4TS2\",\n      \"type\": \"arrow\",\n      \"x\": 1053.9983652852434,\n      \"y\": 343.1772085606117,\n      \"width\": 106.42230116522956,\n      \"height\": 0.10172927196111914,\n      \"angle\": 0,\n      \"strokeColor\": \"#000000\",\n      \"backgroundColor\": \"transparent\",\n      \"fillStyle\": \"hachure\",\n      \"strokeWidth\": 1,\n      \"strokeStyle\": \"solid\",\n      \"roughness\": 1,\n      \"opacity\": 100,\n      \"groupIds\": [],\n      \"strokeSharpness\": \"round\",\n      \"seed\": 1805338897,\n      \"version\": 44,\n      \"versionNonce\": 468837745,\n      \"isDeleted\": false,\n      \"boundElementIds\": null,\n      \"points\": [\n        [\n          0,\n          0\n        ],\n        [\n          106.42230116522956,\n          -0.10172927196111914\n        ]\n      ],\n      \"lastCommittedPoint\": null,\n      \"startBinding\": {\n        \"elementId\": \"fESH7TjYaPiRAXCLgu6gj\",\n        \"focus\": 0.034035946947105086,\n        \"gap\": 11.364088475962532\n      },\n      \"endBinding\": {\n        \"elementId\": \"Rp_m5EtBqLK880zk0HPes\",\n        \"focus\": -0.09541448620171078,\n        \"gap\": 8.602060160628056\n      }\n    },\n    {\n      \"id\": \"muBFJlzUT62Z5u6vtgoPo\",\n      \"type\": \"arrow\",\n      \"x\": 1341.157078677608,\n      \"y\": 339.7422181379586,\n      \"width\": 88.60855868842668,\n      \"height\": 2.6091895262144362,\n      \"angle\": 0,\n      \"strokeColor\": \"#000000\",\n      \"backgroundColor\": \"transparent\",\n      \"fillStyle\": \"hachure\",\n      \"strokeWidth\": 1,\n      \"strokeStyle\": \"solid\",\n      \"roughness\": 1,\n      \"opacity\": 100,\n      \"groupIds\": [],\n      \"strokeSharpness\": \"round\",\n      \"seed\": 1832057969,\n      \"version\": 128,\n      \"versionNonce\": 1342081055,\n      \"isDeleted\": false,\n      \"boundElementIds\": null,\n      \"points\": [\n        [\n          0,\n          0\n        ],\n        [\n          88.60855868842668,\n          -2.6091895262144362\n        ]\n      ],\n      \"lastCommittedPoint\": null,\n      \"startBinding\": {\n        \"elementId\": \"Rp_m5EtBqLK880zk0HPes\",\n        \"gap\": 19.82936306898931,\n        \"focus\": 0.08945444862904846\n      },\n      \"endBinding\": {\n        \"elementId\": \"2iAmN0ThUq3khqXmobwXR\",\n        \"gap\": 11.37138636336131,\n        \"focus\": -0.1024021768851719\n      }\n    },\n    {\n      \"id\": \"Qs4t0BM0S_4Pke8rNKbmD\",\n      \"type\": \"arrow\",\n      \"x\": 492.0234375,\n      \"y\": 350.046875,\n      \"width\": 95.43387310642322,\n      \"height\": 0.9643864370914343,\n      \"angle\": 0,\n      \"strokeColor\": \"#000000\",\n      \"backgroundColor\": \"transparent\",\n      \"fillStyle\": \"hachure\",\n      \"strokeWidth\": 1,\n      \"strokeStyle\": \"solid\",\n      \"roughness\": 1,\n      \"opacity\": 100,\n      \"groupIds\": [],\n      \"strokeSharpness\": \"round\",\n      \"seed\": 234060401,\n      \"version\": 68,\n      \"versionNonce\": 297558161,\n      \"isDeleted\": false,\n      \"boundElementIds\": null,\n      \"points\": [\n        [\n          0,\n          0\n        ],\n        [\n          95.43387310642322,\n          -0.9643864370914343\n        ]\n      ],\n      \"lastCommittedPoint\": null,\n      \"startBinding\": null,\n      \"endBinding\": {\n        \"elementId\": \"umJvYNbrYyosAii0TCe8X\",\n        \"focus\": -0.08182839036919108,\n        \"gap\": 13.781886293370846\n      }\n    },\n    {\n      \"id\": \"c9iGYLrlWNl56Bq2qFVR3\",\n      \"type\": \"arrow\",\n      \"x\": 1521.4329053171455,\n      \"y\": 397.76984274454924,\n      \"width\": 847.5934093483568,\n      \"height\": 71.62078225545076,\n      \"angle\": 0,\n      \"strokeColor\": \"#000000\",\n      \"backgroundColor\": \"transparent\",\n      \"fillStyle\": \"hachure\",\n      \"strokeWidth\": 1,\n      \"strokeStyle\": \"solid\",\n      \"roughness\": 1,\n      \"opacity\": 100,\n      \"groupIds\": [],\n      \"strokeSharpness\": \"round\",\n      \"seed\": 1408772703,\n      \"version\": 339,\n      \"versionNonce\": 455396689,\n      \"isDeleted\": false,\n      \"boundElementIds\": null,\n      \"points\": [\n        [\n          0,\n          0\n        ],\n        [\n          -85.06181156714547,\n          61.46453225545076\n        ],\n        [\n          -770.2180615671455,\n          71.62078225545076\n        ],\n        [\n          -847.5934093483568,\n          15.194066486107488\n        ]\n      ],\n      \"lastCommittedPoint\": [\n        -834.17578125,\n        10.3515625\n      ],\n      \"startBinding\": {\n        \"elementId\": \"2iAmN0ThUq3khqXmobwXR\",\n        \"gap\": 19.92113118460233,\n        \"focus\": -0.7649085384743577\n      },\n      \"endBinding\": {\n        \"elementId\": \"umJvYNbrYyosAii0TCe8X\",\n        \"focus\": 0.9783632894951878,\n        \"gap\": 20.136000442647486\n      }\n    },\n    {\n      \"id\": \"eGPmufgc-vKMKmqf5K70-\",\n      \"type\": \"text\",\n      \"x\": 499.75,\n      \"y\": 299.75,\n      \"width\": 59,\n      \"height\": 24,\n      \"angle\": 0,\n      \"strokeColor\": \"#000000\",\n      \"backgroundColor\": \"transparent\",\n      \"fillStyle\": \"hachure\",\n      \"strokeWidth\": 1,\n      \"strokeStyle\": \"solid\",\n      \"roughness\": 1,\n      \"opacity\": 100,\n      \"groupIds\": [],\n      \"strokeSharpness\": \"sharp\",\n      \"seed\": 1637190321,\n      \"version\": 57,\n      \"versionNonce\": 722379505,\n      \"isDeleted\": false,\n      \"boundElementIds\": null,\n      \"text\": \"event\",\n      \"fontSize\": 20,\n      \"fontFamily\": 3,\n      \"textAlign\": \"left\",\n      \"verticalAlign\": \"top\",\n      \"baseline\": 19\n    },\n    {\n      \"id\": \"vynyr8w8fVE7OJXHAE365\",\n      \"type\": \"text\",\n      \"x\": 780,\n      \"y\": 300,\n      \"width\": 70,\n      \"height\": 24,\n      \"angle\": 0,\n      \"strokeColor\": \"#000000\",\n      \"backgroundColor\": \"transparent\",\n      \"fillStyle\": \"hachure\",\n      \"strokeWidth\": 1,\n      \"strokeStyle\": \"solid\",\n      \"roughness\": 1,\n      \"opacity\": 100,\n      \"groupIds\": [],\n      \"strokeSharpness\": \"sharp\",\n      \"seed\": 1893934897,\n      \"version\": 361,\n      \"versionNonce\": 1504841009,\n      \"isDeleted\": false,\n      \"boundElementIds\": null,\n      \"text\": \"update\",\n      \"fontSize\": 20,\n      \"fontFamily\": 3,\n      \"textAlign\": \"left\",\n      \"verticalAlign\": \"top\",\n      \"baseline\": 19\n    },\n    {\n      \"id\": \"4svZvrPyD8SmDlCrAqiub\",\n      \"type\": \"text\",\n      \"x\": 1060,\n      \"y\": 300,\n      \"width\": 70,\n      \"height\": 24,\n      \"angle\": 0,\n      \"strokeColor\": \"#000000\",\n      \"backgroundColor\": \"transparent\",\n      \"fillStyle\": \"hachure\",\n      \"strokeWidth\": 1,\n      \"strokeStyle\": \"solid\",\n      \"roughness\": 1,\n      \"opacity\": 100,\n      \"groupIds\": [],\n      \"strokeSharpness\": \"sharp\",\n      \"seed\": 1281306641,\n      \"version\": 14,\n      \"versionNonce\": 881014001,\n      \"isDeleted\": false,\n      \"boundElementIds\": null,\n      \"text\": \"notify\",\n      \"fontSize\": 20,\n      \"fontFamily\": 3,\n      \"textAlign\": \"left\",\n      \"verticalAlign\": \"top\",\n      \"baseline\": 19\n    },\n    {\n      \"id\": \"9SF49CHx9H587dg3XyxK3\",\n      \"type\": \"text\",\n      \"x\": 1340,\n      \"y\": 300,\n      \"width\": 82,\n      \"height\": 24,\n      \"angle\": 0,\n      \"strokeColor\": \"#000000\",\n      \"backgroundColor\": \"transparent\",\n      \"fillStyle\": \"hachure\",\n      \"strokeWidth\": 1,\n      \"strokeStyle\": \"solid\",\n      \"roughness\": 1,\n      \"opacity\": 100,\n      \"groupIds\": [],\n      \"strokeSharpness\": \"sharp\",\n      \"seed\": 1159088735,\n      \"version\": 18,\n      \"versionNonce\": 1065184433,\n      \"isDeleted\": false,\n      \"boundElementIds\": null,\n      \"text\": \"trigger\",\n      \"fontSize\": 20,\n      \"fontFamily\": 3,\n      \"textAlign\": \"left\",\n      \"verticalAlign\": \"top\",\n      \"baseline\": 19\n    },\n    {\n      \"id\": \"Qw_akk4TX_QbVkg5X1aKS\",\n      \"type\": \"text\",\n      \"x\": 1078.23046875,\n      \"y\": 484.29296875,\n      \"width\": 59,\n      \"height\": 24,\n      \"angle\": 0,\n      \"strokeColor\": \"#000000\",\n      \"backgroundColor\": \"transparent\",\n      \"fillStyle\": \"hachure\",\n      \"strokeWidth\": 1,\n      \"strokeStyle\": \"solid\",\n      \"roughness\": 1,\n      \"opacity\": 100,\n      \"groupIds\": [],\n      \"strokeSharpness\": \"sharp\",\n      \"seed\": 1289093279,\n      \"version\": 95,\n      \"versionNonce\": 313892977,\n      \"isDeleted\": false,\n      \"boundElementIds\": null,\n      \"text\": \"event\",\n      \"fontSize\": 20,\n      \"fontFamily\": 3,\n      \"textAlign\": \"left\",\n      \"verticalAlign\": \"top\",\n      \"baseline\": 19\n    }\n  ],\n  \"appState\": {\n    \"viewBackgroundColor\": \"#ffffff\",\n    \"gridSize\": null\n  }\n}"
  },
  {
    "path": "docs/assets/getting-started-assets/javascripts/JSXTransformer.js",
    "content": "/**\n * JSXTransformer v0.13.3\n */\n;(function(f) {\n    if (typeof exports === \"object\" && typeof module !== \"undefined\") {\n        module.exports = f()\n    } else if (typeof define === \"function\" && define.amd) {\n        define([], f)\n    } else {\n        var g\n        if (typeof window !== \"undefined\") {\n            g = window\n        } else if (typeof global !== \"undefined\") {\n            g = global\n        } else if (typeof self !== \"undefined\") {\n            g = self\n        } else {\n            g = this\n        }\n        g.JSXTransformer = f()\n    }\n})(function() {\n    var define, module, exports\n    return (function e(t, n, r) {\n        function s(o, u) {\n            if (!n[o]) {\n                if (!t[o]) {\n                    var a = typeof require == \"function\" && require\n                    if (!u && a) return a(o, !0)\n                    if (i) return i(o, !0)\n                    var f = new Error(\"Cannot find module '\" + o + \"'\")\n                    throw ((f.code = \"MODULE_NOT_FOUND\"), f)\n                }\n                var l = (n[o] = { exports: {} })\n                t[o][0].call(\n                    l.exports,\n                    function(e) {\n                        var n = t[o][1][e]\n                        return s(n ? n : e)\n                    },\n                    l,\n                    l.exports,\n                    e,\n                    t,\n                    n,\n                    r\n                )\n            }\n            return n[o].exports\n        }\n        var i = typeof require == \"function\" && require\n        for (var o = 0; o < r.length; o++) s(r[o])\n        return s\n    })(\n        {\n            1: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     */\n                    /* jshint browser: true */\n                    /* jslint evil: true */\n                    /*eslint-disable no-eval */\n                    /*eslint-disable block-scoped-var */\n\n                    \"use strict\"\n\n                    var ReactTools = _dereq_(\"../main\")\n                    var inlineSourceMap = _dereq_(\"./inline-source-map\")\n\n                    var headEl\n                    var dummyAnchor\n                    var inlineScriptCount = 0\n\n                    // The source-map library relies on Object.defineProperty, but IE8 doesn't\n                    // support it fully even with es5-sham. Indeed, es5-sham's defineProperty\n                    // throws when Object.prototype.__defineGetter__ is missing, so we skip building\n                    // the source map in that case.\n                    var supportsAccessors = Object.prototype.hasOwnProperty(\"__defineGetter__\")\n\n                    /**\n                     * Run provided code through jstransform.\n                     *\n                     * @param {string} source Original source code\n                     * @param {object?} options Options to pass to jstransform\n                     * @return {object} object as returned from jstransform\n                     */\n                    function transformReact(source, options) {\n                        options = options || {}\n\n                        // Force the sourcemaps option manually. We don't want to use it if it will\n                        // break (see above note about supportsAccessors). We'll only override the\n                        // value here if sourceMap was specified and is truthy. This guarantees that\n                        // we won't override any user intent (since this method is exposed publicly).\n                        if (options.sourceMap) {\n                            options.sourceMap = supportsAccessors\n                        }\n\n                        // Otherwise just pass all options straight through to react-tools.\n                        return ReactTools.transformWithDetails(source, options)\n                    }\n\n                    /**\n                     * Eval provided source after transforming it.\n                     *\n                     * @param {string} source Original source code\n                     * @param {object?} options Options to pass to jstransform\n                     */\n                    function exec(source, options) {\n                        return eval(transformReact(source, options).code)\n                    }\n\n                    /**\n                     * This method returns a nicely formatted line of code pointing to the exact\n                     * location of the error `e`. The line is limited in size so big lines of code\n                     * are also shown in a readable way.\n                     *\n                     * Example:\n                     * ... x', overflow:'scroll'}} id={} onScroll={this.scroll} class=\" ...\n                     * ^\n                     *\n                     * @param {string} code The full string of code\n                     * @param {Error} e The error being thrown\n                     * @return {string} formatted message\n                     * @internal\n                     */\n                    function createSourceCodeErrorMessage(code, e) {\n                        var sourceLines = code.split(\"\\n\")\n                        // e.lineNumber is non-standard so we can't depend on its availability. If\n                        // we're in a browser where it isn't supported, don't even bother trying to\n                        // format anything. We may also hit a case where the line number is reported\n                        // incorrectly and is outside the bounds of the actual code. Handle that too.\n                        if (!e.lineNumber || e.lineNumber > sourceLines.length) {\n                            return \"\"\n                        }\n                        var erroneousLine = sourceLines[e.lineNumber - 1]\n\n                        // Removes any leading indenting spaces and gets the number of\n                        // chars indenting the `erroneousLine`\n                        var indentation = 0\n                        erroneousLine = erroneousLine.replace(/^\\s+/, function(leadingSpaces) {\n                            indentation = leadingSpaces.length\n                            return \"\"\n                        })\n\n                        // Defines the number of characters that are going to show\n                        // before and after the erroneous code\n                        var LIMIT = 30\n                        var errorColumn = e.column - indentation\n\n                        if (errorColumn > LIMIT) {\n                            erroneousLine = \"... \" + erroneousLine.slice(errorColumn - LIMIT)\n                            errorColumn = 4 + LIMIT\n                        }\n                        if (erroneousLine.length - errorColumn > LIMIT) {\n                            erroneousLine = erroneousLine.slice(0, errorColumn + LIMIT) + \" ...\"\n                        }\n                        var message = \"\\n\\n\" + erroneousLine + \"\\n\"\n                        message += new Array(errorColumn - 1).join(\" \") + \"^\"\n                        return message\n                    }\n\n                    /**\n                     * Actually transform the code.\n                     *\n                     * @param {string} code\n                     * @param {string?} url\n                     * @param {object?} options\n                     * @return {string} The transformed code.\n                     * @internal\n                     */\n                    function transformCode(code, url, options) {\n                        try {\n                            var transformed = transformReact(code, options)\n                        } catch (e) {\n                            e.message += \"\\n    at \"\n                            if (url) {\n                                if (\"fileName\" in e) {\n                                    // We set `fileName` if it's supported by this error object and\n                                    // a `url` was provided.\n                                    // The error will correctly point to `url` in Firefox.\n                                    e.fileName = url\n                                }\n                                e.message += url + \":\" + e.lineNumber + \":\" + e.columnNumber\n                            } else {\n                                e.message += location.href\n                            }\n                            e.message += createSourceCodeErrorMessage(code, e)\n                            throw e\n                        }\n\n                        if (!transformed.sourceMap) {\n                            return transformed.code\n                        }\n\n                        var source\n                        if (url == null) {\n                            source = \"Inline JSX script\"\n                            inlineScriptCount++\n                            if (inlineScriptCount > 1) {\n                                source += \" (\" + inlineScriptCount + \")\"\n                            }\n                        } else if (dummyAnchor) {\n                            // Firefox has problems when the sourcemap source is a proper URL with a\n                            // protocol and hostname, so use the pathname. We could use just the\n                            // filename, but hopefully using the full path will prevent potential\n                            // issues where the same filename exists in multiple directories.\n                            dummyAnchor.href = url\n                            source = dummyAnchor.pathname.substr(1)\n                        }\n\n                        return (\n                            transformed.code +\n                            \"\\n\" +\n                            inlineSourceMap(transformed.sourceMap, code, source)\n                        )\n                    }\n\n                    /**\n                     * Appends a script element at the end of the <head> with the content of code,\n                     * after transforming it.\n                     *\n                     * @param {string} code The original source code\n                     * @param {string?} url Where the code came from. null if inline\n                     * @param {object?} options Options to pass to jstransform\n                     * @internal\n                     */\n                    function run(code, url, options) {\n                        var scriptEl = document.createElement(\"script\")\n                        scriptEl.text = transformCode(code, url, options)\n                        headEl.appendChild(scriptEl)\n                    }\n\n                    /**\n                     * Load script from the provided url and pass the content to the callback.\n                     *\n                     * @param {string} url The location of the script src\n                     * @param {function} callback Function to call with the content of url\n                     * @internal\n                     */\n                    function load(url, successCallback, errorCallback) {\n                        var xhr\n                        xhr = window.ActiveXObject\n                            ? new window.ActiveXObject(\"Microsoft.XMLHTTP\")\n                            : new XMLHttpRequest()\n\n                        // async, however scripts will be executed in the order they are in the\n                        // DOM to mirror normal script loading.\n                        xhr.open(\"GET\", url, true)\n                        if (\"overrideMimeType\" in xhr) {\n                            xhr.overrideMimeType(\"text/plain\")\n                        }\n                        xhr.onreadystatechange = function() {\n                            if (xhr.readyState === 4) {\n                                if (xhr.status === 0 || xhr.status === 200) {\n                                    successCallback(xhr.responseText)\n                                } else {\n                                    errorCallback()\n                                    throw new Error(\"Could not load \" + url)\n                                }\n                            }\n                        }\n                        return xhr.send(null)\n                    }\n\n                    /**\n                     * Loop over provided script tags and get the content, via innerHTML if an\n                     * inline script, or by using XHR. Transforms are applied if needed. The scripts\n                     * are executed in the order they are found on the page.\n                     *\n                     * @param {array} scripts The <script> elements to load and run.\n                     * @internal\n                     */\n                    function loadScripts(scripts) {\n                        var result = []\n                        var count = scripts.length\n\n                        function check() {\n                            var script, i\n\n                            for (i = 0; i < count; i++) {\n                                script = result[i]\n\n                                if (script.loaded && !script.executed) {\n                                    script.executed = true\n                                    run(script.content, script.url, script.options)\n                                } else if (!script.loaded && !script.error && !script.async) {\n                                    break\n                                }\n                            }\n                        }\n\n                        scripts.forEach(function(script, i) {\n                            var options = {\n                                sourceMap: true\n                            }\n                            if (/;harmony=true(;|$)/.test(script.type)) {\n                                options.harmony = true\n                            }\n                            if (/;stripTypes=true(;|$)/.test(script.type)) {\n                                options.stripTypes = true\n                            }\n\n                            // script.async is always true for non-javascript script tags\n                            var async = script.hasAttribute(\"async\")\n\n                            if (script.src) {\n                                result[i] = {\n                                    async: async,\n                                    error: false,\n                                    executed: false,\n                                    content: null,\n                                    loaded: false,\n                                    url: script.src,\n                                    options: options\n                                }\n\n                                load(\n                                    script.src,\n                                    function(content) {\n                                        result[i].loaded = true\n                                        result[i].content = content\n                                        check()\n                                    },\n                                    function() {\n                                        result[i].error = true\n                                        check()\n                                    }\n                                )\n                            } else {\n                                result[i] = {\n                                    async: async,\n                                    error: false,\n                                    executed: false,\n                                    content: script.innerHTML,\n                                    loaded: true,\n                                    url: null,\n                                    options: options\n                                }\n                            }\n                        })\n\n                        check()\n                    }\n\n                    /**\n                     * Find and run all script tags with type=\"text/jsx\".\n                     *\n                     * @internal\n                     */\n                    function runScripts() {\n                        var scripts = document.getElementsByTagName(\"script\")\n\n                        // Array.prototype.slice cannot be used on NodeList on IE8\n                        var jsxScripts = []\n                        for (var i = 0; i < scripts.length; i++) {\n                            if (/^text\\/jsx(;|$)/.test(scripts.item(i).type)) {\n                                jsxScripts.push(scripts.item(i))\n                            }\n                        }\n\n                        if (jsxScripts.length < 1) {\n                            return\n                        }\n\n                        console.warn(\n                            \"You are using the in-browser JSX transformer. Be sure to precompile \" +\n                                \"your JSX for production - \" +\n                                \"http://facebook.github.io/react/docs/tooling-integration.html#jsx\"\n                        )\n\n                        loadScripts(jsxScripts)\n                    }\n\n                    // Listen for load event if we're in a browser and then kick off finding and\n                    // running of scripts.\n                    if (typeof window !== \"undefined\" && window !== null) {\n                        headEl = document.getElementsByTagName(\"head\")[0]\n                        dummyAnchor = document.createElement(\"a\")\n\n                        if (window.addEventListener) {\n                            window.addEventListener(\"DOMContentLoaded\", runScripts, false)\n                        } else {\n                            window.attachEvent(\"onload\", runScripts)\n                        }\n                    }\n\n                    module.exports = {\n                        transform: transformReact,\n                        exec: exec\n                    }\n                },\n                { \"../main\": 2, \"./inline-source-map\": 41 }\n            ],\n            2: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     */\n\n                    \"use strict\"\n                    /*eslint-disable no-undef*/\n                    var visitors = _dereq_(\"./vendor/fbtransform/visitors\")\n                    var transform = _dereq_(\"jstransform\").transform\n                    var typesSyntax = _dereq_(\"jstransform/visitors/type-syntax\")\n                    var inlineSourceMap = _dereq_(\"./vendor/inline-source-map\")\n\n                    module.exports = {\n                        transform: function(input, options) {\n                            options = processOptions(options)\n                            var output = innerTransform(input, options)\n                            var result = output.code\n                            if (options.sourceMap) {\n                                var map = inlineSourceMap(output.sourceMap, input, options.filename)\n                                result += \"\\n\" + map\n                            }\n                            return result\n                        },\n                        transformWithDetails: function(input, options) {\n                            options = processOptions(options)\n                            var output = innerTransform(input, options)\n                            var result = {}\n                            result.code = output.code\n                            if (options.sourceMap) {\n                                result.sourceMap = output.sourceMap.toJSON()\n                            }\n                            if (options.filename) {\n                                result.sourceMap.sources = [options.filename]\n                            }\n                            return result\n                        }\n                    }\n\n                    /**\n                     * Only copy the values that we need. We'll do some preprocessing to account for\n                     * converting command line flags to options that jstransform can actually use.\n                     */\n                    function processOptions(opts) {\n                        opts = opts || {}\n                        var options = {}\n\n                        options.harmony = opts.harmony\n                        options.stripTypes = opts.stripTypes\n                        options.sourceMap = opts.sourceMap\n                        options.filename = opts.sourceFilename\n\n                        if (opts.es6module) {\n                            options.sourceType = \"module\"\n                        }\n                        if (opts.nonStrictEs6module) {\n                            options.sourceType = \"nonStrictModule\"\n                        }\n\n                        // Instead of doing any fancy validation, only look for 'es3'. If we have\n                        // that, then use it. Otherwise use 'es5'.\n                        options.es3 = opts.target === \"es3\"\n                        options.es5 = !options.es3\n\n                        return options\n                    }\n\n                    function innerTransform(input, options) {\n                        var visitorSets = [\"react\"]\n                        if (options.harmony) {\n                            visitorSets.push(\"harmony\")\n                        }\n\n                        if (options.es3) {\n                            visitorSets.push(\"es3\")\n                        }\n\n                        if (options.stripTypes) {\n                            // Stripping types needs to happen before the other transforms\n                            // unfortunately, due to bad interactions. For example,\n                            // es6-rest-param-visitors conflict with stripping rest param type\n                            // annotation\n                            input = transform(typesSyntax.visitorList, input, options).code\n                        }\n\n                        var visitorList = visitors.getVisitorsBySet(visitorSets)\n                        return transform(visitorList, input, options)\n                    }\n                },\n                {\n                    \"./vendor/fbtransform/visitors\": 40,\n                    \"./vendor/inline-source-map\": 41,\n                    jstransform: 22,\n                    \"jstransform/visitors/type-syntax\": 36\n                }\n            ],\n            3: [\n                function(_dereq_, module, exports) {\n                    /*!\n                     * The buffer module from node.js, for the browser.\n                     *\n                     * @author   Feross Aboukhadijeh <feross@feross.org> <http://feross.org>\n                     * @license  MIT\n                     */\n\n                    var base64 = _dereq_(\"base64-js\")\n                    var ieee754 = _dereq_(\"ieee754\")\n                    var isArray = _dereq_(\"is-array\")\n\n                    exports.Buffer = Buffer\n                    exports.SlowBuffer = SlowBuffer\n                    exports.INSPECT_MAX_BYTES = 50\n                    Buffer.poolSize = 8192 // not used by this implementation\n\n                    var kMaxLength = 0x3fffffff\n                    var rootParent = {}\n\n                    /**\n                     * If `Buffer.TYPED_ARRAY_SUPPORT`:\n                     *   === true    Use Uint8Array implementation (fastest)\n                     *   === false   Use Object implementation (most compatible, even IE6)\n                     *\n                     * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,\n                     * Opera 11.6+, iOS 4.2+.\n                     *\n                     * Note:\n                     *\n                     * - Implementation must support adding new properties to `Uint8Array` instances.\n                     *   Firefox 4-29 lacked support, fixed in Firefox 30+.\n                     *   See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.\n                     *\n                     *  - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.\n                     *\n                     *  - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of\n                     *    incorrect length in some situations.\n                     *\n                     * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they will\n                     * get the Object implementation, which is slower but will work correctly.\n                     */\n                    Buffer.TYPED_ARRAY_SUPPORT = (function() {\n                        try {\n                            var buf = new ArrayBuffer(0)\n                            var arr = new Uint8Array(buf)\n                            arr.foo = function() {\n                                return 42\n                            }\n                            return (\n                                arr.foo() === 42 && // typed array instances can be augmented\n                                typeof arr.subarray === \"function\" && // chrome 9-10 lack `subarray`\n                                new Uint8Array(1).subarray(1, 1).byteLength === 0\n                            ) // ie10 has broken `subarray`\n                        } catch (e) {\n                            return false\n                        }\n                    })()\n\n                    /**\n                     * Class: Buffer\n                     * =============\n                     *\n                     * The Buffer constructor returns instances of `Uint8Array` that are augmented\n                     * with function properties for all the node `Buffer` API functions. We use\n                     * `Uint8Array` so that square bracket notation works as expected -- it returns\n                     * a single octet.\n                     *\n                     * By augmenting the instances, we can avoid modifying the `Uint8Array`\n                     * prototype.\n                     */\n                    function Buffer(subject, encoding) {\n                        var self = this\n                        if (!(self instanceof Buffer)) return new Buffer(subject, encoding)\n\n                        var type = typeof subject\n                        var length\n\n                        if (type === \"number\") {\n                            length = +subject\n                        } else if (type === \"string\") {\n                            length = Buffer.byteLength(subject, encoding)\n                        } else if (type === \"object\" && subject !== null) {\n                            // assume object is array-like\n                            if (subject.type === \"Buffer\" && isArray(subject.data))\n                                subject = subject.data\n                            length = +subject.length\n                        } else {\n                            throw new TypeError(\"must start with number, buffer, array or string\")\n                        }\n\n                        if (length > kMaxLength) {\n                            throw new RangeError(\n                                \"Attempt to allocate Buffer larger than maximum size: 0x\" +\n                                    kMaxLength.toString(16) +\n                                    \" bytes\"\n                            )\n                        }\n\n                        if (length < 0) length = 0\n                        else length >>>= 0 // coerce to uint32\n\n                        if (Buffer.TYPED_ARRAY_SUPPORT) {\n                            // Preferred: Return an augmented `Uint8Array` instance for best performance\n                            self = Buffer._augment(new Uint8Array(length)) // eslint-disable-line consistent-this\n                        } else {\n                            // Fallback: Return THIS instance of Buffer (created by `new`)\n                            self.length = length\n                            self._isBuffer = true\n                        }\n\n                        var i\n                        if (Buffer.TYPED_ARRAY_SUPPORT && typeof subject.byteLength === \"number\") {\n                            // Speed optimization -- use set if we're copying from a typed array\n                            self._set(subject)\n                        } else if (isArrayish(subject)) {\n                            // Treat array-ish objects as a byte array\n                            if (Buffer.isBuffer(subject)) {\n                                for (i = 0; i < length; i++) {\n                                    self[i] = subject.readUInt8(i)\n                                }\n                            } else {\n                                for (i = 0; i < length; i++) {\n                                    self[i] = ((subject[i] % 256) + 256) % 256\n                                }\n                            }\n                        } else if (type === \"string\") {\n                            self.write(subject, 0, encoding)\n                        } else if (type === \"number\" && !Buffer.TYPED_ARRAY_SUPPORT) {\n                            for (i = 0; i < length; i++) {\n                                self[i] = 0\n                            }\n                        }\n\n                        if (length > 0 && length <= Buffer.poolSize) self.parent = rootParent\n\n                        return self\n                    }\n\n                    function SlowBuffer(subject, encoding) {\n                        if (!(this instanceof SlowBuffer)) return new SlowBuffer(subject, encoding)\n\n                        var buf = new Buffer(subject, encoding)\n                        delete buf.parent\n                        return buf\n                    }\n\n                    Buffer.isBuffer = function isBuffer(b) {\n                        return !!(b != null && b._isBuffer)\n                    }\n\n                    Buffer.compare = function compare(a, b) {\n                        if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {\n                            throw new TypeError(\"Arguments must be Buffers\")\n                        }\n\n                        if (a === b) return 0\n\n                        var x = a.length\n                        var y = b.length\n                        for (var i = 0, len = Math.min(x, y); i < len && a[i] === b[i]; i++) {}\n                        if (i !== len) {\n                            x = a[i]\n                            y = b[i]\n                        }\n                        if (x < y) return -1\n                        if (y < x) return 1\n                        return 0\n                    }\n\n                    Buffer.isEncoding = function isEncoding(encoding) {\n                        switch (String(encoding).toLowerCase()) {\n                            case \"hex\":\n                            case \"utf8\":\n                            case \"utf-8\":\n                            case \"ascii\":\n                            case \"binary\":\n                            case \"base64\":\n                            case \"raw\":\n                            case \"ucs2\":\n                            case \"ucs-2\":\n                            case \"utf16le\":\n                            case \"utf-16le\":\n                                return true\n                            default:\n                                return false\n                        }\n                    }\n\n                    Buffer.concat = function concat(list, totalLength) {\n                        if (!isArray(list))\n                            throw new TypeError(\"list argument must be an Array of Buffers.\")\n\n                        if (list.length === 0) {\n                            return new Buffer(0)\n                        } else if (list.length === 1) {\n                            return list[0]\n                        }\n\n                        var i\n                        if (totalLength === undefined) {\n                            totalLength = 0\n                            for (i = 0; i < list.length; i++) {\n                                totalLength += list[i].length\n                            }\n                        }\n\n                        var buf = new Buffer(totalLength)\n                        var pos = 0\n                        for (i = 0; i < list.length; i++) {\n                            var item = list[i]\n                            item.copy(buf, pos)\n                            pos += item.length\n                        }\n                        return buf\n                    }\n\n                    Buffer.byteLength = function byteLength(str, encoding) {\n                        var ret\n                        str = str + \"\"\n                        switch (encoding || \"utf8\") {\n                            case \"ascii\":\n                            case \"binary\":\n                            case \"raw\":\n                                ret = str.length\n                                break\n                            case \"ucs2\":\n                            case \"ucs-2\":\n                            case \"utf16le\":\n                            case \"utf-16le\":\n                                ret = str.length * 2\n                                break\n                            case \"hex\":\n                                ret = str.length >>> 1\n                                break\n                            case \"utf8\":\n                            case \"utf-8\":\n                                ret = utf8ToBytes(str).length\n                                break\n                            case \"base64\":\n                                ret = base64ToBytes(str).length\n                                break\n                            default:\n                                ret = str.length\n                        }\n                        return ret\n                    }\n\n                    // pre-set for values that may exist in the future\n                    Buffer.prototype.length = undefined\n                    Buffer.prototype.parent = undefined\n\n                    // toString(encoding, start=0, end=buffer.length)\n                    Buffer.prototype.toString = function toString(encoding, start, end) {\n                        var loweredCase = false\n\n                        start = start >>> 0\n                        end = end === undefined || end === Infinity ? this.length : end >>> 0\n\n                        if (!encoding) encoding = \"utf8\"\n                        if (start < 0) start = 0\n                        if (end > this.length) end = this.length\n                        if (end <= start) return \"\"\n\n                        while (true) {\n                            switch (encoding) {\n                                case \"hex\":\n                                    return hexSlice(this, start, end)\n\n                                case \"utf8\":\n                                case \"utf-8\":\n                                    return utf8Slice(this, start, end)\n\n                                case \"ascii\":\n                                    return asciiSlice(this, start, end)\n\n                                case \"binary\":\n                                    return binarySlice(this, start, end)\n\n                                case \"base64\":\n                                    return base64Slice(this, start, end)\n\n                                case \"ucs2\":\n                                case \"ucs-2\":\n                                case \"utf16le\":\n                                case \"utf-16le\":\n                                    return utf16leSlice(this, start, end)\n\n                                default:\n                                    if (loweredCase)\n                                        throw new TypeError(\"Unknown encoding: \" + encoding)\n                                    encoding = (encoding + \"\").toLowerCase()\n                                    loweredCase = true\n                            }\n                        }\n                    }\n\n                    Buffer.prototype.equals = function equals(b) {\n                        if (!Buffer.isBuffer(b)) throw new TypeError(\"Argument must be a Buffer\")\n                        if (this === b) return true\n                        return Buffer.compare(this, b) === 0\n                    }\n\n                    Buffer.prototype.inspect = function inspect() {\n                        var str = \"\"\n                        var max = exports.INSPECT_MAX_BYTES\n                        if (this.length > 0) {\n                            str = this.toString(\"hex\", 0, max)\n                                .match(/.{2}/g)\n                                .join(\" \")\n                            if (this.length > max) str += \" ... \"\n                        }\n                        return \"<Buffer \" + str + \">\"\n                    }\n\n                    Buffer.prototype.compare = function compare(b) {\n                        if (!Buffer.isBuffer(b)) throw new TypeError(\"Argument must be a Buffer\")\n                        if (this === b) return 0\n                        return Buffer.compare(this, b)\n                    }\n\n                    Buffer.prototype.indexOf = function indexOf(val, byteOffset) {\n                        if (byteOffset > 0x7fffffff) byteOffset = 0x7fffffff\n                        else if (byteOffset < -0x80000000) byteOffset = -0x80000000\n                        byteOffset >>= 0\n\n                        if (this.length === 0) return -1\n                        if (byteOffset >= this.length) return -1\n\n                        // Negative offsets start from the end of the buffer\n                        if (byteOffset < 0) byteOffset = Math.max(this.length + byteOffset, 0)\n\n                        if (typeof val === \"string\") {\n                            if (val.length === 0) return -1 // special case: looking for empty string always fails\n                            return String.prototype.indexOf.call(this, val, byteOffset)\n                        }\n                        if (Buffer.isBuffer(val)) {\n                            return arrayIndexOf(this, val, byteOffset)\n                        }\n                        if (typeof val === \"number\") {\n                            if (\n                                Buffer.TYPED_ARRAY_SUPPORT &&\n                                Uint8Array.prototype.indexOf === \"function\"\n                            ) {\n                                return Uint8Array.prototype.indexOf.call(this, val, byteOffset)\n                            }\n                            return arrayIndexOf(this, [val], byteOffset)\n                        }\n\n                        function arrayIndexOf(arr, val, byteOffset) {\n                            var foundIndex = -1\n                            for (var i = 0; byteOffset + i < arr.length; i++) {\n                                if (\n                                    arr[byteOffset + i] ===\n                                    val[foundIndex === -1 ? 0 : i - foundIndex]\n                                ) {\n                                    if (foundIndex === -1) foundIndex = i\n                                    if (i - foundIndex + 1 === val.length)\n                                        return byteOffset + foundIndex\n                                } else {\n                                    foundIndex = -1\n                                }\n                            }\n                            return -1\n                        }\n\n                        throw new TypeError(\"val must be string, number or Buffer\")\n                    }\n\n                    // `get` will be removed in Node 0.13+\n                    Buffer.prototype.get = function get(offset) {\n                        console.log(\".get() is deprecated. Access using array indexes instead.\")\n                        return this.readUInt8(offset)\n                    }\n\n                    // `set` will be removed in Node 0.13+\n                    Buffer.prototype.set = function set(v, offset) {\n                        console.log(\".set() is deprecated. Access using array indexes instead.\")\n                        return this.writeUInt8(v, offset)\n                    }\n\n                    function hexWrite(buf, string, offset, length) {\n                        offset = Number(offset) || 0\n                        var remaining = buf.length - offset\n                        if (!length) {\n                            length = remaining\n                        } else {\n                            length = Number(length)\n                            if (length > remaining) {\n                                length = remaining\n                            }\n                        }\n\n                        // must be an even number of digits\n                        var strLen = string.length\n                        if (strLen % 2 !== 0) throw new Error(\"Invalid hex string\")\n\n                        if (length > strLen / 2) {\n                            length = strLen / 2\n                        }\n                        for (var i = 0; i < length; i++) {\n                            var parsed = parseInt(string.substr(i * 2, 2), 16)\n                            if (isNaN(parsed)) throw new Error(\"Invalid hex string\")\n                            buf[offset + i] = parsed\n                        }\n                        return i\n                    }\n\n                    function utf8Write(buf, string, offset, length) {\n                        var charsWritten = blitBuffer(\n                            utf8ToBytes(string, buf.length - offset),\n                            buf,\n                            offset,\n                            length\n                        )\n                        return charsWritten\n                    }\n\n                    function asciiWrite(buf, string, offset, length) {\n                        var charsWritten = blitBuffer(asciiToBytes(string), buf, offset, length)\n                        return charsWritten\n                    }\n\n                    function binaryWrite(buf, string, offset, length) {\n                        return asciiWrite(buf, string, offset, length)\n                    }\n\n                    function base64Write(buf, string, offset, length) {\n                        var charsWritten = blitBuffer(base64ToBytes(string), buf, offset, length)\n                        return charsWritten\n                    }\n\n                    function utf16leWrite(buf, string, offset, length) {\n                        var charsWritten = blitBuffer(\n                            utf16leToBytes(string, buf.length - offset),\n                            buf,\n                            offset,\n                            length\n                        )\n                        return charsWritten\n                    }\n\n                    Buffer.prototype.write = function write(string, offset, length, encoding) {\n                        // Support both (string, offset, length, encoding)\n                        // and the legacy (string, encoding, offset, length)\n                        if (isFinite(offset)) {\n                            if (!isFinite(length)) {\n                                encoding = length\n                                length = undefined\n                            }\n                        } else {\n                            // legacy\n                            var swap = encoding\n                            encoding = offset\n                            offset = length\n                            length = swap\n                        }\n\n                        offset = Number(offset) || 0\n\n                        if (length < 0 || offset < 0 || offset > this.length) {\n                            throw new RangeError(\"attempt to write outside buffer bounds\")\n                        }\n\n                        var remaining = this.length - offset\n                        if (!length) {\n                            length = remaining\n                        } else {\n                            length = Number(length)\n                            if (length > remaining) {\n                                length = remaining\n                            }\n                        }\n                        encoding = String(encoding || \"utf8\").toLowerCase()\n\n                        var ret\n                        switch (encoding) {\n                            case \"hex\":\n                                ret = hexWrite(this, string, offset, length)\n                                break\n                            case \"utf8\":\n                            case \"utf-8\":\n                                ret = utf8Write(this, string, offset, length)\n                                break\n                            case \"ascii\":\n                                ret = asciiWrite(this, string, offset, length)\n                                break\n                            case \"binary\":\n                                ret = binaryWrite(this, string, offset, length)\n                                break\n                            case \"base64\":\n                                ret = base64Write(this, string, offset, length)\n                                break\n                            case \"ucs2\":\n                            case \"ucs-2\":\n                            case \"utf16le\":\n                            case \"utf-16le\":\n                                ret = utf16leWrite(this, string, offset, length)\n                                break\n                            default:\n                                throw new TypeError(\"Unknown encoding: \" + encoding)\n                        }\n                        return ret\n                    }\n\n                    Buffer.prototype.toJSON = function toJSON() {\n                        return {\n                            type: \"Buffer\",\n                            data: Array.prototype.slice.call(this._arr || this, 0)\n                        }\n                    }\n\n                    function base64Slice(buf, start, end) {\n                        if (start === 0 && end === buf.length) {\n                            return base64.fromByteArray(buf)\n                        } else {\n                            return base64.fromByteArray(buf.slice(start, end))\n                        }\n                    }\n\n                    function utf8Slice(buf, start, end) {\n                        var res = \"\"\n                        var tmp = \"\"\n                        end = Math.min(buf.length, end)\n\n                        for (var i = start; i < end; i++) {\n                            if (buf[i] <= 0x7f) {\n                                res += decodeUtf8Char(tmp) + String.fromCharCode(buf[i])\n                                tmp = \"\"\n                            } else {\n                                tmp += \"%\" + buf[i].toString(16)\n                            }\n                        }\n\n                        return res + decodeUtf8Char(tmp)\n                    }\n\n                    function asciiSlice(buf, start, end) {\n                        var ret = \"\"\n                        end = Math.min(buf.length, end)\n\n                        for (var i = start; i < end; i++) {\n                            ret += String.fromCharCode(buf[i] & 0x7f)\n                        }\n                        return ret\n                    }\n\n                    function binarySlice(buf, start, end) {\n                        var ret = \"\"\n                        end = Math.min(buf.length, end)\n\n                        for (var i = start; i < end; i++) {\n                            ret += String.fromCharCode(buf[i])\n                        }\n                        return ret\n                    }\n\n                    function hexSlice(buf, start, end) {\n                        var len = buf.length\n\n                        if (!start || start < 0) start = 0\n                        if (!end || end < 0 || end > len) end = len\n\n                        var out = \"\"\n                        for (var i = start; i < end; i++) {\n                            out += toHex(buf[i])\n                        }\n                        return out\n                    }\n\n                    function utf16leSlice(buf, start, end) {\n                        var bytes = buf.slice(start, end)\n                        var res = \"\"\n                        for (var i = 0; i < bytes.length; i += 2) {\n                            res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)\n                        }\n                        return res\n                    }\n\n                    Buffer.prototype.slice = function slice(start, end) {\n                        var len = this.length\n                        start = ~~start\n                        end = end === undefined ? len : ~~end\n\n                        if (start < 0) {\n                            start += len\n                            if (start < 0) start = 0\n                        } else if (start > len) {\n                            start = len\n                        }\n\n                        if (end < 0) {\n                            end += len\n                            if (end < 0) end = 0\n                        } else if (end > len) {\n                            end = len\n                        }\n\n                        if (end < start) end = start\n\n                        var newBuf\n                        if (Buffer.TYPED_ARRAY_SUPPORT) {\n                            newBuf = Buffer._augment(this.subarray(start, end))\n                        } else {\n                            var sliceLen = end - start\n                            newBuf = new Buffer(sliceLen, undefined)\n                            for (var i = 0; i < sliceLen; i++) {\n                                newBuf[i] = this[i + start]\n                            }\n                        }\n\n                        if (newBuf.length) newBuf.parent = this.parent || this\n\n                        return newBuf\n                    }\n\n                    /*\n                     * Need to make sure that buffer isn't trying to write out of bounds.\n                     */\n                    function checkOffset(offset, ext, length) {\n                        if (offset % 1 !== 0 || offset < 0)\n                            throw new RangeError(\"offset is not uint\")\n                        if (offset + ext > length)\n                            throw new RangeError(\"Trying to access beyond buffer length\")\n                    }\n\n                    Buffer.prototype.readUIntLE = function readUIntLE(\n                        offset,\n                        byteLength,\n                        noAssert\n                    ) {\n                        offset = offset >>> 0\n                        byteLength = byteLength >>> 0\n                        if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n                        var val = this[offset]\n                        var mul = 1\n                        var i = 0\n                        while (++i < byteLength && (mul *= 0x100)) {\n                            val += this[offset + i] * mul\n                        }\n\n                        return val\n                    }\n\n                    Buffer.prototype.readUIntBE = function readUIntBE(\n                        offset,\n                        byteLength,\n                        noAssert\n                    ) {\n                        offset = offset >>> 0\n                        byteLength = byteLength >>> 0\n                        if (!noAssert) {\n                            checkOffset(offset, byteLength, this.length)\n                        }\n\n                        var val = this[offset + --byteLength]\n                        var mul = 1\n                        while (byteLength > 0 && (mul *= 0x100)) {\n                            val += this[offset + --byteLength] * mul\n                        }\n\n                        return val\n                    }\n\n                    Buffer.prototype.readUInt8 = function readUInt8(offset, noAssert) {\n                        if (!noAssert) checkOffset(offset, 1, this.length)\n                        return this[offset]\n                    }\n\n                    Buffer.prototype.readUInt16LE = function readUInt16LE(offset, noAssert) {\n                        if (!noAssert) checkOffset(offset, 2, this.length)\n                        return this[offset] | (this[offset + 1] << 8)\n                    }\n\n                    Buffer.prototype.readUInt16BE = function readUInt16BE(offset, noAssert) {\n                        if (!noAssert) checkOffset(offset, 2, this.length)\n                        return (this[offset] << 8) | this[offset + 1]\n                    }\n\n                    Buffer.prototype.readUInt32LE = function readUInt32LE(offset, noAssert) {\n                        if (!noAssert) checkOffset(offset, 4, this.length)\n\n                        return (\n                            (this[offset] | (this[offset + 1] << 8) | (this[offset + 2] << 16)) +\n                            this[offset + 3] * 0x1000000\n                        )\n                    }\n\n                    Buffer.prototype.readUInt32BE = function readUInt32BE(offset, noAssert) {\n                        if (!noAssert) checkOffset(offset, 4, this.length)\n\n                        return (\n                            this[offset] * 0x1000000 +\n                            ((this[offset + 1] << 16) | (this[offset + 2] << 8) | this[offset + 3])\n                        )\n                    }\n\n                    Buffer.prototype.readIntLE = function readIntLE(offset, byteLength, noAssert) {\n                        offset = offset >>> 0\n                        byteLength = byteLength >>> 0\n                        if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n                        var val = this[offset]\n                        var mul = 1\n                        var i = 0\n                        while (++i < byteLength && (mul *= 0x100)) {\n                            val += this[offset + i] * mul\n                        }\n                        mul *= 0x80\n\n                        if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n                        return val\n                    }\n\n                    Buffer.prototype.readIntBE = function readIntBE(offset, byteLength, noAssert) {\n                        offset = offset >>> 0\n                        byteLength = byteLength >>> 0\n                        if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n                        var i = byteLength\n                        var mul = 1\n                        var val = this[offset + --i]\n                        while (i > 0 && (mul *= 0x100)) {\n                            val += this[offset + --i] * mul\n                        }\n                        mul *= 0x80\n\n                        if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n                        return val\n                    }\n\n                    Buffer.prototype.readInt8 = function readInt8(offset, noAssert) {\n                        if (!noAssert) checkOffset(offset, 1, this.length)\n                        if (!(this[offset] & 0x80)) return this[offset]\n                        return (0xff - this[offset] + 1) * -1\n                    }\n\n                    Buffer.prototype.readInt16LE = function readInt16LE(offset, noAssert) {\n                        if (!noAssert) checkOffset(offset, 2, this.length)\n                        var val = this[offset] | (this[offset + 1] << 8)\n                        return val & 0x8000 ? val | 0xffff0000 : val\n                    }\n\n                    Buffer.prototype.readInt16BE = function readInt16BE(offset, noAssert) {\n                        if (!noAssert) checkOffset(offset, 2, this.length)\n                        var val = this[offset + 1] | (this[offset] << 8)\n                        return val & 0x8000 ? val | 0xffff0000 : val\n                    }\n\n                    Buffer.prototype.readInt32LE = function readInt32LE(offset, noAssert) {\n                        if (!noAssert) checkOffset(offset, 4, this.length)\n\n                        return (\n                            this[offset] |\n                            (this[offset + 1] << 8) |\n                            (this[offset + 2] << 16) |\n                            (this[offset + 3] << 24)\n                        )\n                    }\n\n                    Buffer.prototype.readInt32BE = function readInt32BE(offset, noAssert) {\n                        if (!noAssert) checkOffset(offset, 4, this.length)\n\n                        return (\n                            (this[offset] << 24) |\n                            (this[offset + 1] << 16) |\n                            (this[offset + 2] << 8) |\n                            this[offset + 3]\n                        )\n                    }\n\n                    Buffer.prototype.readFloatLE = function readFloatLE(offset, noAssert) {\n                        if (!noAssert) checkOffset(offset, 4, this.length)\n                        return ieee754.read(this, offset, true, 23, 4)\n                    }\n\n                    Buffer.prototype.readFloatBE = function readFloatBE(offset, noAssert) {\n                        if (!noAssert) checkOffset(offset, 4, this.length)\n                        return ieee754.read(this, offset, false, 23, 4)\n                    }\n\n                    Buffer.prototype.readDoubleLE = function readDoubleLE(offset, noAssert) {\n                        if (!noAssert) checkOffset(offset, 8, this.length)\n                        return ieee754.read(this, offset, true, 52, 8)\n                    }\n\n                    Buffer.prototype.readDoubleBE = function readDoubleBE(offset, noAssert) {\n                        if (!noAssert) checkOffset(offset, 8, this.length)\n                        return ieee754.read(this, offset, false, 52, 8)\n                    }\n\n                    function checkInt(buf, value, offset, ext, max, min) {\n                        if (!Buffer.isBuffer(buf))\n                            throw new TypeError(\"buffer must be a Buffer instance\")\n                        if (value > max || value < min)\n                            throw new RangeError(\"value is out of bounds\")\n                        if (offset + ext > buf.length) throw new RangeError(\"index out of range\")\n                    }\n\n                    Buffer.prototype.writeUIntLE = function writeUIntLE(\n                        value,\n                        offset,\n                        byteLength,\n                        noAssert\n                    ) {\n                        value = +value\n                        offset = offset >>> 0\n                        byteLength = byteLength >>> 0\n                        if (!noAssert)\n                            checkInt(\n                                this,\n                                value,\n                                offset,\n                                byteLength,\n                                Math.pow(2, 8 * byteLength),\n                                0\n                            )\n\n                        var mul = 1\n                        var i = 0\n                        this[offset] = value & 0xff\n                        while (++i < byteLength && (mul *= 0x100)) {\n                            this[offset + i] = ((value / mul) >>> 0) & 0xff\n                        }\n\n                        return offset + byteLength\n                    }\n\n                    Buffer.prototype.writeUIntBE = function writeUIntBE(\n                        value,\n                        offset,\n                        byteLength,\n                        noAssert\n                    ) {\n                        value = +value\n                        offset = offset >>> 0\n                        byteLength = byteLength >>> 0\n                        if (!noAssert)\n                            checkInt(\n                                this,\n                                value,\n                                offset,\n                                byteLength,\n                                Math.pow(2, 8 * byteLength),\n                                0\n                            )\n\n                        var i = byteLength - 1\n                        var mul = 1\n                        this[offset + i] = value & 0xff\n                        while (--i >= 0 && (mul *= 0x100)) {\n                            this[offset + i] = ((value / mul) >>> 0) & 0xff\n                        }\n\n                        return offset + byteLength\n                    }\n\n                    Buffer.prototype.writeUInt8 = function writeUInt8(value, offset, noAssert) {\n                        value = +value\n                        offset = offset >>> 0\n                        if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)\n                        if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)\n                        this[offset] = value\n                        return offset + 1\n                    }\n\n                    function objectWriteUInt16(buf, value, offset, littleEndian) {\n                        if (value < 0) value = 0xffff + value + 1\n                        for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; i++) {\n                            buf[offset + i] =\n                                (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>\n                                ((littleEndian ? i : 1 - i) * 8)\n                        }\n                    }\n\n                    Buffer.prototype.writeUInt16LE = function writeUInt16LE(\n                        value,\n                        offset,\n                        noAssert\n                    ) {\n                        value = +value\n                        offset = offset >>> 0\n                        if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n                        if (Buffer.TYPED_ARRAY_SUPPORT) {\n                            this[offset] = value\n                            this[offset + 1] = value >>> 8\n                        } else {\n                            objectWriteUInt16(this, value, offset, true)\n                        }\n                        return offset + 2\n                    }\n\n                    Buffer.prototype.writeUInt16BE = function writeUInt16BE(\n                        value,\n                        offset,\n                        noAssert\n                    ) {\n                        value = +value\n                        offset = offset >>> 0\n                        if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n                        if (Buffer.TYPED_ARRAY_SUPPORT) {\n                            this[offset] = value >>> 8\n                            this[offset + 1] = value\n                        } else {\n                            objectWriteUInt16(this, value, offset, false)\n                        }\n                        return offset + 2\n                    }\n\n                    function objectWriteUInt32(buf, value, offset, littleEndian) {\n                        if (value < 0) value = 0xffffffff + value + 1\n                        for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; i++) {\n                            buf[offset + i] = (value >>> ((littleEndian ? i : 3 - i) * 8)) & 0xff\n                        }\n                    }\n\n                    Buffer.prototype.writeUInt32LE = function writeUInt32LE(\n                        value,\n                        offset,\n                        noAssert\n                    ) {\n                        value = +value\n                        offset = offset >>> 0\n                        if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n                        if (Buffer.TYPED_ARRAY_SUPPORT) {\n                            this[offset + 3] = value >>> 24\n                            this[offset + 2] = value >>> 16\n                            this[offset + 1] = value >>> 8\n                            this[offset] = value\n                        } else {\n                            objectWriteUInt32(this, value, offset, true)\n                        }\n                        return offset + 4\n                    }\n\n                    Buffer.prototype.writeUInt32BE = function writeUInt32BE(\n                        value,\n                        offset,\n                        noAssert\n                    ) {\n                        value = +value\n                        offset = offset >>> 0\n                        if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n                        if (Buffer.TYPED_ARRAY_SUPPORT) {\n                            this[offset] = value >>> 24\n                            this[offset + 1] = value >>> 16\n                            this[offset + 2] = value >>> 8\n                            this[offset + 3] = value\n                        } else {\n                            objectWriteUInt32(this, value, offset, false)\n                        }\n                        return offset + 4\n                    }\n\n                    Buffer.prototype.writeIntLE = function writeIntLE(\n                        value,\n                        offset,\n                        byteLength,\n                        noAssert\n                    ) {\n                        value = +value\n                        offset = offset >>> 0\n                        if (!noAssert) {\n                            checkInt(\n                                this,\n                                value,\n                                offset,\n                                byteLength,\n                                Math.pow(2, 8 * byteLength - 1) - 1,\n                                -Math.pow(2, 8 * byteLength - 1)\n                            )\n                        }\n\n                        var i = 0\n                        var mul = 1\n                        var sub = value < 0 ? 1 : 0\n                        this[offset] = value & 0xff\n                        while (++i < byteLength && (mul *= 0x100)) {\n                            this[offset + i] = (((value / mul) >> 0) - sub) & 0xff\n                        }\n\n                        return offset + byteLength\n                    }\n\n                    Buffer.prototype.writeIntBE = function writeIntBE(\n                        value,\n                        offset,\n                        byteLength,\n                        noAssert\n                    ) {\n                        value = +value\n                        offset = offset >>> 0\n                        if (!noAssert) {\n                            checkInt(\n                                this,\n                                value,\n                                offset,\n                                byteLength,\n                                Math.pow(2, 8 * byteLength - 1) - 1,\n                                -Math.pow(2, 8 * byteLength - 1)\n                            )\n                        }\n\n                        var i = byteLength - 1\n                        var mul = 1\n                        var sub = value < 0 ? 1 : 0\n                        this[offset + i] = value & 0xff\n                        while (--i >= 0 && (mul *= 0x100)) {\n                            this[offset + i] = (((value / mul) >> 0) - sub) & 0xff\n                        }\n\n                        return offset + byteLength\n                    }\n\n                    Buffer.prototype.writeInt8 = function writeInt8(value, offset, noAssert) {\n                        value = +value\n                        offset = offset >>> 0\n                        if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)\n                        if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)\n                        if (value < 0) value = 0xff + value + 1\n                        this[offset] = value\n                        return offset + 1\n                    }\n\n                    Buffer.prototype.writeInt16LE = function writeInt16LE(value, offset, noAssert) {\n                        value = +value\n                        offset = offset >>> 0\n                        if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n                        if (Buffer.TYPED_ARRAY_SUPPORT) {\n                            this[offset] = value\n                            this[offset + 1] = value >>> 8\n                        } else {\n                            objectWriteUInt16(this, value, offset, true)\n                        }\n                        return offset + 2\n                    }\n\n                    Buffer.prototype.writeInt16BE = function writeInt16BE(value, offset, noAssert) {\n                        value = +value\n                        offset = offset >>> 0\n                        if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n                        if (Buffer.TYPED_ARRAY_SUPPORT) {\n                            this[offset] = value >>> 8\n                            this[offset + 1] = value\n                        } else {\n                            objectWriteUInt16(this, value, offset, false)\n                        }\n                        return offset + 2\n                    }\n\n                    Buffer.prototype.writeInt32LE = function writeInt32LE(value, offset, noAssert) {\n                        value = +value\n                        offset = offset >>> 0\n                        if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n                        if (Buffer.TYPED_ARRAY_SUPPORT) {\n                            this[offset] = value\n                            this[offset + 1] = value >>> 8\n                            this[offset + 2] = value >>> 16\n                            this[offset + 3] = value >>> 24\n                        } else {\n                            objectWriteUInt32(this, value, offset, true)\n                        }\n                        return offset + 4\n                    }\n\n                    Buffer.prototype.writeInt32BE = function writeInt32BE(value, offset, noAssert) {\n                        value = +value\n                        offset = offset >>> 0\n                        if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n                        if (value < 0) value = 0xffffffff + value + 1\n                        if (Buffer.TYPED_ARRAY_SUPPORT) {\n                            this[offset] = value >>> 24\n                            this[offset + 1] = value >>> 16\n                            this[offset + 2] = value >>> 8\n                            this[offset + 3] = value\n                        } else {\n                            objectWriteUInt32(this, value, offset, false)\n                        }\n                        return offset + 4\n                    }\n\n                    function checkIEEE754(buf, value, offset, ext, max, min) {\n                        if (value > max || value < min)\n                            throw new RangeError(\"value is out of bounds\")\n                        if (offset + ext > buf.length) throw new RangeError(\"index out of range\")\n                        if (offset < 0) throw new RangeError(\"index out of range\")\n                    }\n\n                    function writeFloat(buf, value, offset, littleEndian, noAssert) {\n                        if (!noAssert) {\n                            checkIEEE754(\n                                buf,\n                                value,\n                                offset,\n                                4,\n                                3.4028234663852886e38,\n                                -3.4028234663852886e38\n                            )\n                        }\n                        ieee754.write(buf, value, offset, littleEndian, 23, 4)\n                        return offset + 4\n                    }\n\n                    Buffer.prototype.writeFloatLE = function writeFloatLE(value, offset, noAssert) {\n                        return writeFloat(this, value, offset, true, noAssert)\n                    }\n\n                    Buffer.prototype.writeFloatBE = function writeFloatBE(value, offset, noAssert) {\n                        return writeFloat(this, value, offset, false, noAssert)\n                    }\n\n                    function writeDouble(buf, value, offset, littleEndian, noAssert) {\n                        if (!noAssert) {\n                            checkIEEE754(\n                                buf,\n                                value,\n                                offset,\n                                8,\n                                1.7976931348623157e308,\n                                -1.7976931348623157e308\n                            )\n                        }\n                        ieee754.write(buf, value, offset, littleEndian, 52, 8)\n                        return offset + 8\n                    }\n\n                    Buffer.prototype.writeDoubleLE = function writeDoubleLE(\n                        value,\n                        offset,\n                        noAssert\n                    ) {\n                        return writeDouble(this, value, offset, true, noAssert)\n                    }\n\n                    Buffer.prototype.writeDoubleBE = function writeDoubleBE(\n                        value,\n                        offset,\n                        noAssert\n                    ) {\n                        return writeDouble(this, value, offset, false, noAssert)\n                    }\n\n                    // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)\n                    Buffer.prototype.copy = function copy(target, target_start, start, end) {\n                        if (!start) start = 0\n                        if (!end && end !== 0) end = this.length\n                        if (target_start >= target.length) target_start = target.length\n                        if (!target_start) target_start = 0\n                        if (end > 0 && end < start) end = start\n\n                        // Copy 0 bytes; we're done\n                        if (end === start) return 0\n                        if (target.length === 0 || this.length === 0) return 0\n\n                        // Fatal error conditions\n                        if (target_start < 0) {\n                            throw new RangeError(\"targetStart out of bounds\")\n                        }\n                        if (start < 0 || start >= this.length)\n                            throw new RangeError(\"sourceStart out of bounds\")\n                        if (end < 0) throw new RangeError(\"sourceEnd out of bounds\")\n\n                        // Are we oob?\n                        if (end > this.length) end = this.length\n                        if (target.length - target_start < end - start) {\n                            end = target.length - target_start + start\n                        }\n\n                        var len = end - start\n\n                        if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {\n                            for (var i = 0; i < len; i++) {\n                                target[i + target_start] = this[i + start]\n                            }\n                        } else {\n                            target._set(this.subarray(start, start + len), target_start)\n                        }\n\n                        return len\n                    }\n\n                    // fill(value, start=0, end=buffer.length)\n                    Buffer.prototype.fill = function fill(value, start, end) {\n                        if (!value) value = 0\n                        if (!start) start = 0\n                        if (!end) end = this.length\n\n                        if (end < start) throw new RangeError(\"end < start\")\n\n                        // Fill 0 bytes; we're done\n                        if (end === start) return\n                        if (this.length === 0) return\n\n                        if (start < 0 || start >= this.length)\n                            throw new RangeError(\"start out of bounds\")\n                        if (end < 0 || end > this.length) throw new RangeError(\"end out of bounds\")\n\n                        var i\n                        if (typeof value === \"number\") {\n                            for (i = start; i < end; i++) {\n                                this[i] = value\n                            }\n                        } else {\n                            var bytes = utf8ToBytes(value.toString())\n                            var len = bytes.length\n                            for (i = start; i < end; i++) {\n                                this[i] = bytes[i % len]\n                            }\n                        }\n\n                        return this\n                    }\n\n                    /**\n                     * Creates a new `ArrayBuffer` with the *copied* memory of the buffer instance.\n                     * Added in Node 0.12. Only available in browsers that support ArrayBuffer.\n                     */\n                    Buffer.prototype.toArrayBuffer = function toArrayBuffer() {\n                        if (typeof Uint8Array !== \"undefined\") {\n                            if (Buffer.TYPED_ARRAY_SUPPORT) {\n                                return new Buffer(this).buffer\n                            } else {\n                                var buf = new Uint8Array(this.length)\n                                for (var i = 0, len = buf.length; i < len; i += 1) {\n                                    buf[i] = this[i]\n                                }\n                                return buf.buffer\n                            }\n                        } else {\n                            throw new TypeError(\n                                \"Buffer.toArrayBuffer not supported in this browser\"\n                            )\n                        }\n                    }\n\n                    // HELPER FUNCTIONS\n                    // ================\n\n                    var BP = Buffer.prototype\n\n                    /**\n                     * Augment a Uint8Array *instance* (not the Uint8Array class!) with Buffer methods\n                     */\n                    Buffer._augment = function _augment(arr) {\n                        arr.constructor = Buffer\n                        arr._isBuffer = true\n\n                        // save reference to original Uint8Array set method before overwriting\n                        arr._set = arr.set\n\n                        // deprecated, will be removed in node 0.13+\n                        arr.get = BP.get\n                        arr.set = BP.set\n\n                        arr.write = BP.write\n                        arr.toString = BP.toString\n                        arr.toLocaleString = BP.toString\n                        arr.toJSON = BP.toJSON\n                        arr.equals = BP.equals\n                        arr.compare = BP.compare\n                        arr.indexOf = BP.indexOf\n                        arr.copy = BP.copy\n                        arr.slice = BP.slice\n                        arr.readUIntLE = BP.readUIntLE\n                        arr.readUIntBE = BP.readUIntBE\n                        arr.readUInt8 = BP.readUInt8\n                        arr.readUInt16LE = BP.readUInt16LE\n                        arr.readUInt16BE = BP.readUInt16BE\n                        arr.readUInt32LE = BP.readUInt32LE\n                        arr.readUInt32BE = BP.readUInt32BE\n                        arr.readIntLE = BP.readIntLE\n                        arr.readIntBE = BP.readIntBE\n                        arr.readInt8 = BP.readInt8\n                        arr.readInt16LE = BP.readInt16LE\n                        arr.readInt16BE = BP.readInt16BE\n                        arr.readInt32LE = BP.readInt32LE\n                        arr.readInt32BE = BP.readInt32BE\n                        arr.readFloatLE = BP.readFloatLE\n                        arr.readFloatBE = BP.readFloatBE\n                        arr.readDoubleLE = BP.readDoubleLE\n                        arr.readDoubleBE = BP.readDoubleBE\n                        arr.writeUInt8 = BP.writeUInt8\n                        arr.writeUIntLE = BP.writeUIntLE\n                        arr.writeUIntBE = BP.writeUIntBE\n                        arr.writeUInt16LE = BP.writeUInt16LE\n                        arr.writeUInt16BE = BP.writeUInt16BE\n                        arr.writeUInt32LE = BP.writeUInt32LE\n                        arr.writeUInt32BE = BP.writeUInt32BE\n                        arr.writeIntLE = BP.writeIntLE\n                        arr.writeIntBE = BP.writeIntBE\n                        arr.writeInt8 = BP.writeInt8\n                        arr.writeInt16LE = BP.writeInt16LE\n                        arr.writeInt16BE = BP.writeInt16BE\n                        arr.writeInt32LE = BP.writeInt32LE\n                        arr.writeInt32BE = BP.writeInt32BE\n                        arr.writeFloatLE = BP.writeFloatLE\n                        arr.writeFloatBE = BP.writeFloatBE\n                        arr.writeDoubleLE = BP.writeDoubleLE\n                        arr.writeDoubleBE = BP.writeDoubleBE\n                        arr.fill = BP.fill\n                        arr.inspect = BP.inspect\n                        arr.toArrayBuffer = BP.toArrayBuffer\n\n                        return arr\n                    }\n\n                    var INVALID_BASE64_RE = /[^+\\/0-9A-z\\-]/g\n\n                    function base64clean(str) {\n                        // Node strips out invalid characters like \\n and \\t from the string, base64-js does not\n                        str = stringtrim(str).replace(INVALID_BASE64_RE, \"\")\n                        // Node converts strings with length < 2 to ''\n                        if (str.length < 2) return \"\"\n                        // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not\n                        while (str.length % 4 !== 0) {\n                            str = str + \"=\"\n                        }\n                        return str\n                    }\n\n                    function stringtrim(str) {\n                        if (str.trim) return str.trim()\n                        return str.replace(/^\\s+|\\s+$/g, \"\")\n                    }\n\n                    function isArrayish(subject) {\n                        return (\n                            isArray(subject) ||\n                            Buffer.isBuffer(subject) ||\n                            (subject &&\n                                typeof subject === \"object\" &&\n                                typeof subject.length === \"number\")\n                        )\n                    }\n\n                    function toHex(n) {\n                        if (n < 16) return \"0\" + n.toString(16)\n                        return n.toString(16)\n                    }\n\n                    function utf8ToBytes(string, units) {\n                        units = units || Infinity\n                        var codePoint\n                        var length = string.length\n                        var leadSurrogate = null\n                        var bytes = []\n                        var i = 0\n\n                        for (; i < length; i++) {\n                            codePoint = string.charCodeAt(i)\n\n                            // is surrogate component\n                            if (codePoint > 0xd7ff && codePoint < 0xe000) {\n                                // last char was a lead\n                                if (leadSurrogate) {\n                                    // 2 leads in a row\n                                    if (codePoint < 0xdc00) {\n                                        if ((units -= 3) > -1) bytes.push(0xef, 0xbf, 0xbd)\n                                        leadSurrogate = codePoint\n                                        continue\n                                    } else {\n                                        // valid surrogate pair\n                                        codePoint =\n                                            ((leadSurrogate - 0xd800) << 10) |\n                                            (codePoint - 0xdc00) |\n                                            0x10000\n                                        leadSurrogate = null\n                                    }\n                                } else {\n                                    // no lead yet\n\n                                    if (codePoint > 0xdbff) {\n                                        // unexpected trail\n                                        if ((units -= 3) > -1) bytes.push(0xef, 0xbf, 0xbd)\n                                        continue\n                                    } else if (i + 1 === length) {\n                                        // unpaired lead\n                                        if ((units -= 3) > -1) bytes.push(0xef, 0xbf, 0xbd)\n                                        continue\n                                    } else {\n                                        // valid lead\n                                        leadSurrogate = codePoint\n                                        continue\n                                    }\n                                }\n                            } else if (leadSurrogate) {\n                                // valid bmp char, but last char was a lead\n                                if ((units -= 3) > -1) bytes.push(0xef, 0xbf, 0xbd)\n                                leadSurrogate = null\n                            }\n\n                            // encode utf8\n                            if (codePoint < 0x80) {\n                                if ((units -= 1) < 0) break\n                                bytes.push(codePoint)\n                            } else if (codePoint < 0x800) {\n                                if ((units -= 2) < 0) break\n                                bytes.push((codePoint >> 0x6) | 0xc0, (codePoint & 0x3f) | 0x80)\n                            } else if (codePoint < 0x10000) {\n                                if ((units -= 3) < 0) break\n                                bytes.push(\n                                    (codePoint >> 0xc) | 0xe0,\n                                    ((codePoint >> 0x6) & 0x3f) | 0x80,\n                                    (codePoint & 0x3f) | 0x80\n                                )\n                            } else if (codePoint < 0x200000) {\n                                if ((units -= 4) < 0) break\n                                bytes.push(\n                                    (codePoint >> 0x12) | 0xf0,\n                                    ((codePoint >> 0xc) & 0x3f) | 0x80,\n                                    ((codePoint >> 0x6) & 0x3f) | 0x80,\n                                    (codePoint & 0x3f) | 0x80\n                                )\n                            } else {\n                                throw new Error(\"Invalid code point\")\n                            }\n                        }\n\n                        return bytes\n                    }\n\n                    function asciiToBytes(str) {\n                        var byteArray = []\n                        for (var i = 0; i < str.length; i++) {\n                            // Node's code seems to be doing this and not & 0x7F..\n                            byteArray.push(str.charCodeAt(i) & 0xff)\n                        }\n                        return byteArray\n                    }\n\n                    function utf16leToBytes(str, units) {\n                        var c, hi, lo\n                        var byteArray = []\n                        for (var i = 0; i < str.length; i++) {\n                            if ((units -= 2) < 0) break\n\n                            c = str.charCodeAt(i)\n                            hi = c >> 8\n                            lo = c % 256\n                            byteArray.push(lo)\n                            byteArray.push(hi)\n                        }\n\n                        return byteArray\n                    }\n\n                    function base64ToBytes(str) {\n                        return base64.toByteArray(base64clean(str))\n                    }\n\n                    function blitBuffer(src, dst, offset, length) {\n                        for (var i = 0; i < length; i++) {\n                            if (i + offset >= dst.length || i >= src.length) break\n                            dst[i + offset] = src[i]\n                        }\n                        return i\n                    }\n\n                    function decodeUtf8Char(str) {\n                        try {\n                            return decodeURIComponent(str)\n                        } catch (err) {\n                            return String.fromCharCode(0xfffd) // UTF 8 invalid char\n                        }\n                    }\n                },\n                { \"base64-js\": 4, ieee754: 5, \"is-array\": 6 }\n            ],\n            4: [\n                function(_dereq_, module, exports) {\n                    var lookup = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\"\n\n                    ;(function(exports) {\n                        \"use strict\"\n\n                        var Arr = typeof Uint8Array !== \"undefined\" ? Uint8Array : Array\n\n                        var PLUS = \"+\".charCodeAt(0)\n                        var SLASH = \"/\".charCodeAt(0)\n                        var NUMBER = \"0\".charCodeAt(0)\n                        var LOWER = \"a\".charCodeAt(0)\n                        var UPPER = \"A\".charCodeAt(0)\n                        var PLUS_URL_SAFE = \"-\".charCodeAt(0)\n                        var SLASH_URL_SAFE = \"_\".charCodeAt(0)\n\n                        function decode(elt) {\n                            var code = elt.charCodeAt(0)\n                            if (code === PLUS || code === PLUS_URL_SAFE) return 62 // '+'\n                            if (code === SLASH || code === SLASH_URL_SAFE) return 63 // '/'\n                            if (code < NUMBER) return -1 //no match\n                            if (code < NUMBER + 10) return code - NUMBER + 26 + 26\n                            if (code < UPPER + 26) return code - UPPER\n                            if (code < LOWER + 26) return code - LOWER + 26\n                        }\n\n                        function b64ToByteArray(b64) {\n                            var i, j, l, tmp, placeHolders, arr\n\n                            if (b64.length % 4 > 0) {\n                                throw new Error(\"Invalid string. Length must be a multiple of 4\")\n                            }\n\n                            // the number of equal signs (place holders)\n                            // if there are two placeholders, than the two characters before it\n                            // represent one byte\n                            // if there is only one, then the three characters before it represent 2 bytes\n                            // this is just a cheap hack to not do indexOf twice\n                            var len = b64.length\n                            placeHolders =\n                                \"=\" === b64.charAt(len - 2)\n                                    ? 2\n                                    : \"=\" === b64.charAt(len - 1)\n                                    ? 1\n                                    : 0\n\n                            // base64 is 4/3 + up to two characters of the original data\n                            arr = new Arr((b64.length * 3) / 4 - placeHolders)\n\n                            // if there are placeholders, only get up to the last complete 4 chars\n                            l = placeHolders > 0 ? b64.length - 4 : b64.length\n\n                            var L = 0\n\n                            function push(v) {\n                                arr[L++] = v\n                            }\n\n                            for (i = 0, j = 0; i < l; i += 4, j += 3) {\n                                tmp =\n                                    (decode(b64.charAt(i)) << 18) |\n                                    (decode(b64.charAt(i + 1)) << 12) |\n                                    (decode(b64.charAt(i + 2)) << 6) |\n                                    decode(b64.charAt(i + 3))\n                                push((tmp & 0xff0000) >> 16)\n                                push((tmp & 0xff00) >> 8)\n                                push(tmp & 0xff)\n                            }\n\n                            if (placeHolders === 2) {\n                                tmp =\n                                    (decode(b64.charAt(i)) << 2) | (decode(b64.charAt(i + 1)) >> 4)\n                                push(tmp & 0xff)\n                            } else if (placeHolders === 1) {\n                                tmp =\n                                    (decode(b64.charAt(i)) << 10) |\n                                    (decode(b64.charAt(i + 1)) << 4) |\n                                    (decode(b64.charAt(i + 2)) >> 2)\n                                push((tmp >> 8) & 0xff)\n                                push(tmp & 0xff)\n                            }\n\n                            return arr\n                        }\n\n                        function uint8ToBase64(uint8) {\n                            var i,\n                                extraBytes = uint8.length % 3, // if we have 1 byte left, pad 2 bytes\n                                output = \"\",\n                                temp,\n                                length\n\n                            function encode(num) {\n                                return lookup.charAt(num)\n                            }\n\n                            function tripletToBase64(num) {\n                                return (\n                                    encode((num >> 18) & 0x3f) +\n                                    encode((num >> 12) & 0x3f) +\n                                    encode((num >> 6) & 0x3f) +\n                                    encode(num & 0x3f)\n                                )\n                            }\n\n                            // go through the array every three bytes, we'll deal with trailing stuff later\n                            for (i = 0, length = uint8.length - extraBytes; i < length; i += 3) {\n                                temp = (uint8[i] << 16) + (uint8[i + 1] << 8) + uint8[i + 2]\n                                output += tripletToBase64(temp)\n                            }\n\n                            // pad the end with zeros, but make sure to not forget the extra bytes\n                            switch (extraBytes) {\n                                case 1:\n                                    temp = uint8[uint8.length - 1]\n                                    output += encode(temp >> 2)\n                                    output += encode((temp << 4) & 0x3f)\n                                    output += \"==\"\n                                    break\n                                case 2:\n                                    temp = (uint8[uint8.length - 2] << 8) + uint8[uint8.length - 1]\n                                    output += encode(temp >> 10)\n                                    output += encode((temp >> 4) & 0x3f)\n                                    output += encode((temp << 2) & 0x3f)\n                                    output += \"=\"\n                                    break\n                            }\n\n                            return output\n                        }\n\n                        exports.toByteArray = b64ToByteArray\n                        exports.fromByteArray = uint8ToBase64\n                    })(typeof exports === \"undefined\" ? (this.base64js = {}) : exports)\n                },\n                {}\n            ],\n            5: [\n                function(_dereq_, module, exports) {\n                    exports.read = function(buffer, offset, isLE, mLen, nBytes) {\n                        var e,\n                            m,\n                            eLen = nBytes * 8 - mLen - 1,\n                            eMax = (1 << eLen) - 1,\n                            eBias = eMax >> 1,\n                            nBits = -7,\n                            i = isLE ? nBytes - 1 : 0,\n                            d = isLE ? -1 : 1,\n                            s = buffer[offset + i]\n\n                        i += d\n\n                        e = s & ((1 << -nBits) - 1)\n                        s >>= -nBits\n                        nBits += eLen\n                        for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8);\n\n                        m = e & ((1 << -nBits) - 1)\n                        e >>= -nBits\n                        nBits += mLen\n                        for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8);\n\n                        if (e === 0) {\n                            e = 1 - eBias\n                        } else if (e === eMax) {\n                            return m ? NaN : (s ? -1 : 1) * Infinity\n                        } else {\n                            m = m + Math.pow(2, mLen)\n                            e = e - eBias\n                        }\n                        return (s ? -1 : 1) * m * Math.pow(2, e - mLen)\n                    }\n\n                    exports.write = function(buffer, value, offset, isLE, mLen, nBytes) {\n                        var e,\n                            m,\n                            c,\n                            eLen = nBytes * 8 - mLen - 1,\n                            eMax = (1 << eLen) - 1,\n                            eBias = eMax >> 1,\n                            rt = mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0,\n                            i = isLE ? 0 : nBytes - 1,\n                            d = isLE ? 1 : -1,\n                            s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0\n\n                        value = Math.abs(value)\n\n                        if (isNaN(value) || value === Infinity) {\n                            m = isNaN(value) ? 1 : 0\n                            e = eMax\n                        } else {\n                            e = Math.floor(Math.log(value) / Math.LN2)\n                            if (value * (c = Math.pow(2, -e)) < 1) {\n                                e--\n                                c *= 2\n                            }\n                            if (e + eBias >= 1) {\n                                value += rt / c\n                            } else {\n                                value += rt * Math.pow(2, 1 - eBias)\n                            }\n                            if (value * c >= 2) {\n                                e++\n                                c /= 2\n                            }\n\n                            if (e + eBias >= eMax) {\n                                m = 0\n                                e = eMax\n                            } else if (e + eBias >= 1) {\n                                m = (value * c - 1) * Math.pow(2, mLen)\n                                e = e + eBias\n                            } else {\n                                m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)\n                                e = 0\n                            }\n                        }\n\n                        for (\n                            ;\n                            mLen >= 8;\n                            buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8\n                        );\n\n                        e = (e << mLen) | m\n                        eLen += mLen\n                        for (\n                            ;\n                            eLen > 0;\n                            buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8\n                        );\n\n                        buffer[offset + i - d] |= s * 128\n                    }\n                },\n                {}\n            ],\n            6: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * isArray\n                     */\n\n                    var isArray = Array.isArray\n\n                    /**\n                     * toString\n                     */\n\n                    var str = Object.prototype.toString\n\n                    /**\n                     * Whether or not the given `val`\n                     * is an array.\n                     *\n                     * example:\n                     *\n                     *        isArray([]);\n                     *        // > true\n                     *        isArray(arguments);\n                     *        // > false\n                     *        isArray('');\n                     *        // > false\n                     *\n                     * @param {mixed} val\n                     * @return {bool}\n                     */\n\n                    module.exports =\n                        isArray ||\n                        function(val) {\n                            return !!val && \"[object Array]\" == str.call(val)\n                        }\n                },\n                {}\n            ],\n            7: [\n                function(_dereq_, module, exports) {\n                    ;(function(process) {\n                        // Copyright Joyent, Inc. and other Node contributors.\n                        //\n                        // Permission is hereby granted, free of charge, to any person obtaining a\n                        // copy of this software and associated documentation files (the\n                        // \"Software\"), to deal in the Software without restriction, including\n                        // without limitation the rights to use, copy, modify, merge, publish,\n                        // distribute, sublicense, and/or sell copies of the Software, and to permit\n                        // persons to whom the Software is furnished to do so, subject to the\n                        // following conditions:\n                        //\n                        // The above copyright notice and this permission notice shall be included\n                        // in all copies or substantial portions of the Software.\n                        //\n                        // THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n                        // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n                        // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n                        // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n                        // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n                        // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n                        // USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n                        // resolves . and .. elements in a path array with directory names there\n                        // must be no slashes, empty elements, or device names (c:\\) in the array\n                        // (so also no leading and trailing slashes - it does not distinguish\n                        // relative and absolute paths)\n                        function normalizeArray(parts, allowAboveRoot) {\n                            // if the path tries to go above the root, `up` ends up > 0\n                            var up = 0\n                            for (var i = parts.length - 1; i >= 0; i--) {\n                                var last = parts[i]\n                                if (last === \".\") {\n                                    parts.splice(i, 1)\n                                } else if (last === \"..\") {\n                                    parts.splice(i, 1)\n                                    up++\n                                } else if (up) {\n                                    parts.splice(i, 1)\n                                    up--\n                                }\n                            }\n\n                            // if the path is allowed to go above the root, restore leading ..s\n                            if (allowAboveRoot) {\n                                for (; up--; up) {\n                                    parts.unshift(\"..\")\n                                }\n                            }\n\n                            return parts\n                        }\n\n                        // Split a filename into [root, dir, basename, ext], unix version\n                        // 'root' is just a slash, or nothing.\n                        var splitPathRe = /^(\\/?|)([\\s\\S]*?)((?:\\.{1,2}|[^\\/]+?|)(\\.[^.\\/]*|))(?:[\\/]*)$/\n                        var splitPath = function(filename) {\n                            return splitPathRe.exec(filename).slice(1)\n                        }\n\n                        // path.resolve([from ...], to)\n                        // posix version\n                        exports.resolve = function() {\n                            var resolvedPath = \"\",\n                                resolvedAbsolute = false\n\n                            for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {\n                                var path = i >= 0 ? arguments[i] : process.cwd()\n\n                                // Skip empty and invalid entries\n                                if (typeof path !== \"string\") {\n                                    throw new TypeError(\"Arguments to path.resolve must be strings\")\n                                } else if (!path) {\n                                    continue\n                                }\n\n                                resolvedPath = path + \"/\" + resolvedPath\n                                resolvedAbsolute = path.charAt(0) === \"/\"\n                            }\n\n                            // At this point the path should be resolved to a full absolute path, but\n                            // handle relative paths to be safe (might happen when process.cwd() fails)\n\n                            // Normalize the path\n                            resolvedPath = normalizeArray(\n                                filter(resolvedPath.split(\"/\"), function(p) {\n                                    return !!p\n                                }),\n                                !resolvedAbsolute\n                            ).join(\"/\")\n\n                            return (resolvedAbsolute ? \"/\" : \"\") + resolvedPath || \".\"\n                        }\n\n                        // path.normalize(path)\n                        // posix version\n                        exports.normalize = function(path) {\n                            var isAbsolute = exports.isAbsolute(path),\n                                trailingSlash = substr(path, -1) === \"/\"\n\n                            // Normalize the path\n                            path = normalizeArray(\n                                filter(path.split(\"/\"), function(p) {\n                                    return !!p\n                                }),\n                                !isAbsolute\n                            ).join(\"/\")\n\n                            if (!path && !isAbsolute) {\n                                path = \".\"\n                            }\n                            if (path && trailingSlash) {\n                                path += \"/\"\n                            }\n\n                            return (isAbsolute ? \"/\" : \"\") + path\n                        }\n\n                        // posix version\n                        exports.isAbsolute = function(path) {\n                            return path.charAt(0) === \"/\"\n                        }\n\n                        // posix version\n                        exports.join = function() {\n                            var paths = Array.prototype.slice.call(arguments, 0)\n                            return exports.normalize(\n                                filter(paths, function(p, index) {\n                                    if (typeof p !== \"string\") {\n                                        throw new TypeError(\n                                            \"Arguments to path.join must be strings\"\n                                        )\n                                    }\n                                    return p\n                                }).join(\"/\")\n                            )\n                        }\n\n                        // path.relative(from, to)\n                        // posix version\n                        exports.relative = function(from, to) {\n                            from = exports.resolve(from).substr(1)\n                            to = exports.resolve(to).substr(1)\n\n                            function trim(arr) {\n                                var start = 0\n                                for (; start < arr.length; start++) {\n                                    if (arr[start] !== \"\") break\n                                }\n\n                                var end = arr.length - 1\n                                for (; end >= 0; end--) {\n                                    if (arr[end] !== \"\") break\n                                }\n\n                                if (start > end) return []\n                                return arr.slice(start, end - start + 1)\n                            }\n\n                            var fromParts = trim(from.split(\"/\"))\n                            var toParts = trim(to.split(\"/\"))\n\n                            var length = Math.min(fromParts.length, toParts.length)\n                            var samePartsLength = length\n                            for (var i = 0; i < length; i++) {\n                                if (fromParts[i] !== toParts[i]) {\n                                    samePartsLength = i\n                                    break\n                                }\n                            }\n\n                            var outputParts = []\n                            for (var i = samePartsLength; i < fromParts.length; i++) {\n                                outputParts.push(\"..\")\n                            }\n\n                            outputParts = outputParts.concat(toParts.slice(samePartsLength))\n\n                            return outputParts.join(\"/\")\n                        }\n\n                        exports.sep = \"/\"\n                        exports.delimiter = \":\"\n\n                        exports.dirname = function(path) {\n                            var result = splitPath(path),\n                                root = result[0],\n                                dir = result[1]\n\n                            if (!root && !dir) {\n                                // No dirname whatsoever\n                                return \".\"\n                            }\n\n                            if (dir) {\n                                // It has a dirname, strip trailing slash\n                                dir = dir.substr(0, dir.length - 1)\n                            }\n\n                            return root + dir\n                        }\n\n                        exports.basename = function(path, ext) {\n                            var f = splitPath(path)[2]\n                            // TODO: make this comparison case-insensitive on windows?\n                            if (ext && f.substr(-1 * ext.length) === ext) {\n                                f = f.substr(0, f.length - ext.length)\n                            }\n                            return f\n                        }\n\n                        exports.extname = function(path) {\n                            return splitPath(path)[3]\n                        }\n\n                        function filter(xs, f) {\n                            if (xs.filter) return xs.filter(f)\n                            var res = []\n                            for (var i = 0; i < xs.length; i++) {\n                                if (f(xs[i], i, xs)) res.push(xs[i])\n                            }\n                            return res\n                        }\n\n                        // String.prototype.substr - negative index don't work in IE8\n                        var substr =\n                            \"ab\".substr(-1) === \"b\"\n                                ? function(str, start, len) {\n                                      return str.substr(start, len)\n                                  }\n                                : function(str, start, len) {\n                                      if (start < 0) start = str.length + start\n                                      return str.substr(start, len)\n                                  }\n                    }.call(this, _dereq_(\"_process\")))\n                },\n                { _process: 8 }\n            ],\n            8: [\n                function(_dereq_, module, exports) {\n                    // shim for using process in browser\n\n                    var process = (module.exports = {})\n                    var queue = []\n                    var draining = false\n\n                    function drainQueue() {\n                        if (draining) {\n                            return\n                        }\n                        draining = true\n                        var currentQueue\n                        var len = queue.length\n                        while (len) {\n                            currentQueue = queue\n                            queue = []\n                            var i = -1\n                            while (++i < len) {\n                                currentQueue[i]()\n                            }\n                            len = queue.length\n                        }\n                        draining = false\n                    }\n                    process.nextTick = function(fun) {\n                        queue.push(fun)\n                        if (!draining) {\n                            setTimeout(drainQueue, 0)\n                        }\n                    }\n\n                    process.title = \"browser\"\n                    process.browser = true\n                    process.env = {}\n                    process.argv = []\n                    process.version = \"\" // empty string to avoid regexp issues\n                    process.versions = {}\n\n                    function noop() {}\n\n                    process.on = noop\n                    process.addListener = noop\n                    process.once = noop\n                    process.off = noop\n                    process.removeListener = noop\n                    process.removeAllListeners = noop\n                    process.emit = noop\n\n                    process.binding = function(name) {\n                        throw new Error(\"process.binding is not supported\")\n                    }\n\n                    // TODO(shtylman)\n                    process.cwd = function() {\n                        return \"/\"\n                    }\n                    process.chdir = function(dir) {\n                        throw new Error(\"process.chdir is not supported\")\n                    }\n                    process.umask = function() {\n                        return 0\n                    }\n                },\n                {}\n            ],\n            9: [\n                function(_dereq_, module, exports) {\n                    /*\n  Copyright (C) 2013 Ariya Hidayat <ariya.hidayat@gmail.com>\n  Copyright (C) 2013 Thaddee Tyl <thaddee.tyl@gmail.com>\n  Copyright (C) 2012 Ariya Hidayat <ariya.hidayat@gmail.com>\n  Copyright (C) 2012 Mathias Bynens <mathias@qiwi.be>\n  Copyright (C) 2012 Joost-Wim Boekesteijn <joost-wim@boekesteijn.nl>\n  Copyright (C) 2012 Kris Kowal <kris.kowal@cixar.com>\n  Copyright (C) 2012 Yusuke Suzuki <utatane.tea@gmail.com>\n  Copyright (C) 2012 Arpad Borsos <arpad.borsos@googlemail.com>\n  Copyright (C) 2011 Ariya Hidayat <ariya.hidayat@gmail.com>\n\n  Redistribution and use in source and binary forms, with or without\n  modification, are permitted provided that the following conditions are met:\n\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n\n  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n  ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY\n  DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\n  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n*/\n\n                    ;(function(root, factory) {\n                        \"use strict\"\n\n                        // Universal Module Definition (UMD) to support AMD, CommonJS/Node.js,\n                        // Rhino, and plain browser loading.\n\n                        /* istanbul ignore next */\n                        if (typeof define === \"function\" && define.amd) {\n                            define([\"exports\"], factory)\n                        } else if (typeof exports !== \"undefined\") {\n                            factory(exports)\n                        } else {\n                            factory((root.esprima = {}))\n                        }\n                    })(this, function(exports) {\n                        \"use strict\"\n\n                        var Token,\n                            TokenName,\n                            FnExprTokens,\n                            Syntax,\n                            PropertyKind,\n                            Messages,\n                            Regex,\n                            SyntaxTreeDelegate,\n                            XHTMLEntities,\n                            ClassPropertyType,\n                            source,\n                            strict,\n                            index,\n                            lineNumber,\n                            lineStart,\n                            length,\n                            delegate,\n                            lookahead,\n                            state,\n                            extra\n\n                        Token = {\n                            BooleanLiteral: 1,\n                            EOF: 2,\n                            Identifier: 3,\n                            Keyword: 4,\n                            NullLiteral: 5,\n                            NumericLiteral: 6,\n                            Punctuator: 7,\n                            StringLiteral: 8,\n                            RegularExpression: 9,\n                            Template: 10,\n                            JSXIdentifier: 11,\n                            JSXText: 12\n                        }\n\n                        TokenName = {}\n                        TokenName[Token.BooleanLiteral] = \"Boolean\"\n                        TokenName[Token.EOF] = \"<end>\"\n                        TokenName[Token.Identifier] = \"Identifier\"\n                        TokenName[Token.Keyword] = \"Keyword\"\n                        TokenName[Token.NullLiteral] = \"Null\"\n                        TokenName[Token.NumericLiteral] = \"Numeric\"\n                        TokenName[Token.Punctuator] = \"Punctuator\"\n                        TokenName[Token.StringLiteral] = \"String\"\n                        TokenName[Token.JSXIdentifier] = \"JSXIdentifier\"\n                        TokenName[Token.JSXText] = \"JSXText\"\n                        TokenName[Token.RegularExpression] = \"RegularExpression\"\n\n                        // A function following one of those tokens is an expression.\n                        FnExprTokens = [\n                            \"(\",\n                            \"{\",\n                            \"[\",\n                            \"in\",\n                            \"typeof\",\n                            \"instanceof\",\n                            \"new\",\n                            \"return\",\n                            \"case\",\n                            \"delete\",\n                            \"throw\",\n                            \"void\",\n                            // assignment operators\n                            \"=\",\n                            \"+=\",\n                            \"-=\",\n                            \"*=\",\n                            \"/=\",\n                            \"%=\",\n                            \"<<=\",\n                            \">>=\",\n                            \">>>=\",\n                            \"&=\",\n                            \"|=\",\n                            \"^=\",\n                            \",\",\n                            // binary/unary operators\n                            \"+\",\n                            \"-\",\n                            \"*\",\n                            \"/\",\n                            \"%\",\n                            \"++\",\n                            \"--\",\n                            \"<<\",\n                            \">>\",\n                            \">>>\",\n                            \"&\",\n                            \"|\",\n                            \"^\",\n                            \"!\",\n                            \"~\",\n                            \"&&\",\n                            \"||\",\n                            \"?\",\n                            \":\",\n                            \"===\",\n                            \"==\",\n                            \">=\",\n                            \"<=\",\n                            \"<\",\n                            \">\",\n                            \"!=\",\n                            \"!==\"\n                        ]\n\n                        Syntax = {\n                            AnyTypeAnnotation: \"AnyTypeAnnotation\",\n                            ArrayExpression: \"ArrayExpression\",\n                            ArrayPattern: \"ArrayPattern\",\n                            ArrayTypeAnnotation: \"ArrayTypeAnnotation\",\n                            ArrowFunctionExpression: \"ArrowFunctionExpression\",\n                            AssignmentExpression: \"AssignmentExpression\",\n                            BinaryExpression: \"BinaryExpression\",\n                            BlockStatement: \"BlockStatement\",\n                            BooleanTypeAnnotation: \"BooleanTypeAnnotation\",\n                            BreakStatement: \"BreakStatement\",\n                            CallExpression: \"CallExpression\",\n                            CatchClause: \"CatchClause\",\n                            ClassBody: \"ClassBody\",\n                            ClassDeclaration: \"ClassDeclaration\",\n                            ClassExpression: \"ClassExpression\",\n                            ClassImplements: \"ClassImplements\",\n                            ClassProperty: \"ClassProperty\",\n                            ComprehensionBlock: \"ComprehensionBlock\",\n                            ComprehensionExpression: \"ComprehensionExpression\",\n                            ConditionalExpression: \"ConditionalExpression\",\n                            ContinueStatement: \"ContinueStatement\",\n                            DebuggerStatement: \"DebuggerStatement\",\n                            DeclareClass: \"DeclareClass\",\n                            DeclareFunction: \"DeclareFunction\",\n                            DeclareModule: \"DeclareModule\",\n                            DeclareVariable: \"DeclareVariable\",\n                            DoWhileStatement: \"DoWhileStatement\",\n                            EmptyStatement: \"EmptyStatement\",\n                            ExportDeclaration: \"ExportDeclaration\",\n                            ExportBatchSpecifier: \"ExportBatchSpecifier\",\n                            ExportSpecifier: \"ExportSpecifier\",\n                            ExpressionStatement: \"ExpressionStatement\",\n                            ForInStatement: \"ForInStatement\",\n                            ForOfStatement: \"ForOfStatement\",\n                            ForStatement: \"ForStatement\",\n                            FunctionDeclaration: \"FunctionDeclaration\",\n                            FunctionExpression: \"FunctionExpression\",\n                            FunctionTypeAnnotation: \"FunctionTypeAnnotation\",\n                            FunctionTypeParam: \"FunctionTypeParam\",\n                            GenericTypeAnnotation: \"GenericTypeAnnotation\",\n                            Identifier: \"Identifier\",\n                            IfStatement: \"IfStatement\",\n                            ImportDeclaration: \"ImportDeclaration\",\n                            ImportDefaultSpecifier: \"ImportDefaultSpecifier\",\n                            ImportNamespaceSpecifier: \"ImportNamespaceSpecifier\",\n                            ImportSpecifier: \"ImportSpecifier\",\n                            InterfaceDeclaration: \"InterfaceDeclaration\",\n                            InterfaceExtends: \"InterfaceExtends\",\n                            IntersectionTypeAnnotation: \"IntersectionTypeAnnotation\",\n                            LabeledStatement: \"LabeledStatement\",\n                            Literal: \"Literal\",\n                            LogicalExpression: \"LogicalExpression\",\n                            MemberExpression: \"MemberExpression\",\n                            MethodDefinition: \"MethodDefinition\",\n                            ModuleSpecifier: \"ModuleSpecifier\",\n                            NewExpression: \"NewExpression\",\n                            NullableTypeAnnotation: \"NullableTypeAnnotation\",\n                            NumberTypeAnnotation: \"NumberTypeAnnotation\",\n                            ObjectExpression: \"ObjectExpression\",\n                            ObjectPattern: \"ObjectPattern\",\n                            ObjectTypeAnnotation: \"ObjectTypeAnnotation\",\n                            ObjectTypeCallProperty: \"ObjectTypeCallProperty\",\n                            ObjectTypeIndexer: \"ObjectTypeIndexer\",\n                            ObjectTypeProperty: \"ObjectTypeProperty\",\n                            Program: \"Program\",\n                            Property: \"Property\",\n                            QualifiedTypeIdentifier: \"QualifiedTypeIdentifier\",\n                            ReturnStatement: \"ReturnStatement\",\n                            SequenceExpression: \"SequenceExpression\",\n                            SpreadElement: \"SpreadElement\",\n                            SpreadProperty: \"SpreadProperty\",\n                            StringLiteralTypeAnnotation: \"StringLiteralTypeAnnotation\",\n                            StringTypeAnnotation: \"StringTypeAnnotation\",\n                            SwitchCase: \"SwitchCase\",\n                            SwitchStatement: \"SwitchStatement\",\n                            TaggedTemplateExpression: \"TaggedTemplateExpression\",\n                            TemplateElement: \"TemplateElement\",\n                            TemplateLiteral: \"TemplateLiteral\",\n                            ThisExpression: \"ThisExpression\",\n                            ThrowStatement: \"ThrowStatement\",\n                            TupleTypeAnnotation: \"TupleTypeAnnotation\",\n                            TryStatement: \"TryStatement\",\n                            TypeAlias: \"TypeAlias\",\n                            TypeAnnotation: \"TypeAnnotation\",\n                            TypeCastExpression: \"TypeCastExpression\",\n                            TypeofTypeAnnotation: \"TypeofTypeAnnotation\",\n                            TypeParameterDeclaration: \"TypeParameterDeclaration\",\n                            TypeParameterInstantiation: \"TypeParameterInstantiation\",\n                            UnaryExpression: \"UnaryExpression\",\n                            UnionTypeAnnotation: \"UnionTypeAnnotation\",\n                            UpdateExpression: \"UpdateExpression\",\n                            VariableDeclaration: \"VariableDeclaration\",\n                            VariableDeclarator: \"VariableDeclarator\",\n                            VoidTypeAnnotation: \"VoidTypeAnnotation\",\n                            WhileStatement: \"WhileStatement\",\n                            WithStatement: \"WithStatement\",\n                            JSXIdentifier: \"JSXIdentifier\",\n                            JSXNamespacedName: \"JSXNamespacedName\",\n                            JSXMemberExpression: \"JSXMemberExpression\",\n                            JSXEmptyExpression: \"JSXEmptyExpression\",\n                            JSXExpressionContainer: \"JSXExpressionContainer\",\n                            JSXElement: \"JSXElement\",\n                            JSXClosingElement: \"JSXClosingElement\",\n                            JSXOpeningElement: \"JSXOpeningElement\",\n                            JSXAttribute: \"JSXAttribute\",\n                            JSXSpreadAttribute: \"JSXSpreadAttribute\",\n                            JSXText: \"JSXText\",\n                            YieldExpression: \"YieldExpression\",\n                            AwaitExpression: \"AwaitExpression\"\n                        }\n\n                        PropertyKind = {\n                            Data: 1,\n                            Get: 2,\n                            Set: 4\n                        }\n\n                        ClassPropertyType = {\n                            static: \"static\",\n                            prototype: \"prototype\"\n                        }\n\n                        // Error messages should be identical to V8.\n                        Messages = {\n                            UnexpectedToken: \"Unexpected token %0\",\n                            UnexpectedNumber: \"Unexpected number\",\n                            UnexpectedString: \"Unexpected string\",\n                            UnexpectedIdentifier: \"Unexpected identifier\",\n                            UnexpectedReserved: \"Unexpected reserved word\",\n                            UnexpectedTemplate: \"Unexpected quasi %0\",\n                            UnexpectedEOS: \"Unexpected end of input\",\n                            NewlineAfterThrow: \"Illegal newline after throw\",\n                            InvalidRegExp: \"Invalid regular expression\",\n                            UnterminatedRegExp: \"Invalid regular expression: missing /\",\n                            InvalidLHSInAssignment: \"Invalid left-hand side in assignment\",\n                            InvalidLHSInFormalsList: \"Invalid left-hand side in formals list\",\n                            InvalidLHSInForIn: \"Invalid left-hand side in for-in\",\n                            MultipleDefaultsInSwitch:\n                                \"More than one default clause in switch statement\",\n                            NoCatchOrFinally: \"Missing catch or finally after try\",\n                            UnknownLabel: \"Undefined label '%0'\",\n                            Redeclaration: \"%0 '%1' has already been declared\",\n                            IllegalContinue: \"Illegal continue statement\",\n                            IllegalBreak: \"Illegal break statement\",\n                            IllegalDuplicateClassProperty:\n                                \"Illegal duplicate property in class definition\",\n                            IllegalClassConstructorProperty:\n                                \"Illegal constructor property in class definition\",\n                            IllegalReturn: \"Illegal return statement\",\n                            IllegalSpread: \"Illegal spread element\",\n                            StrictModeWith: \"Strict mode code may not include a with statement\",\n                            StrictCatchVariable:\n                                \"Catch variable may not be eval or arguments in strict mode\",\n                            StrictVarName:\n                                \"Variable name may not be eval or arguments in strict mode\",\n                            StrictParamName:\n                                \"Parameter name eval or arguments is not allowed in strict mode\",\n                            StrictParamDupe:\n                                \"Strict mode function may not have duplicate parameter names\",\n                            ParameterAfterRestParameter:\n                                \"Rest parameter must be final parameter of an argument list\",\n                            DefaultRestParameter: \"Rest parameter can not have a default value\",\n                            ElementAfterSpreadElement:\n                                \"Spread must be the final element of an element list\",\n                            PropertyAfterSpreadProperty:\n                                \"A rest property must be the final property of an object literal\",\n                            ObjectPatternAsRestParameter: \"Invalid rest parameter\",\n                            ObjectPatternAsSpread: \"Invalid spread argument\",\n                            StrictFunctionName:\n                                \"Function name may not be eval or arguments in strict mode\",\n                            StrictOctalLiteral: \"Octal literals are not allowed in strict mode.\",\n                            StrictDelete: \"Delete of an unqualified identifier in strict mode.\",\n                            StrictDuplicateProperty:\n                                \"Duplicate data property in object literal not allowed in strict mode\",\n                            AccessorDataProperty:\n                                \"Object literal may not have data and accessor property with the same name\",\n                            AccessorGetSet:\n                                \"Object literal may not have multiple get/set accessors with the same name\",\n                            StrictLHSAssignment:\n                                \"Assignment to eval or arguments is not allowed in strict mode\",\n                            StrictLHSPostfix:\n                                \"Postfix increment/decrement may not have eval or arguments operand in strict mode\",\n                            StrictLHSPrefix:\n                                \"Prefix increment/decrement may not have eval or arguments operand in strict mode\",\n                            StrictReservedWord: \"Use of future reserved word in strict mode\",\n                            MissingFromClause: \"Missing from clause\",\n                            NoAsAfterImportNamespace: \"Missing as after import *\",\n                            InvalidModuleSpecifier: \"Invalid module specifier\",\n                            IllegalImportDeclaration: \"Illegal import declaration\",\n                            IllegalExportDeclaration: \"Illegal export declaration\",\n                            NoUninitializedConst: \"Const must be initialized\",\n                            ComprehensionRequiresBlock:\n                                \"Comprehension must have at least one block\",\n                            ComprehensionError: \"Comprehension Error\",\n                            EachNotAllowed: \"Each is not supported\",\n                            InvalidJSXAttributeValue:\n                                \"JSX value should be either an expression or a quoted JSX text\",\n                            ExpectedJSXClosingTag: \"Expected corresponding JSX closing tag for %0\",\n                            AdjacentJSXElements:\n                                \"Adjacent JSX elements must be wrapped in an enclosing tag\",\n                            ConfusedAboutFunctionType:\n                                \"Unexpected token =>. It looks like \" +\n                                \"you are trying to write a function type, but you ended up \" +\n                                \"writing a grouped type followed by an =>, which is a syntax \" +\n                                \"error. Remember, function type parameters are named so function \" +\n                                \"types look like (name1: type1, name2: type2) => returnType. You \" +\n                                \"probably wrote (type1) => returnType\"\n                        }\n\n                        // See also tools/generate-unicode-regex.py.\n                        Regex = {\n                            NonAsciiIdentifierStart: new RegExp(\n                                \"[\\xaa\\xb5\\xba\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\u02c1\\u02c6-\\u02d1\\u02e0-\\u02e4\\u02ec\\u02ee\\u0370-\\u0374\\u0376\\u0377\\u037a-\\u037d\\u0386\\u0388-\\u038a\\u038c\\u038e-\\u03a1\\u03a3-\\u03f5\\u03f7-\\u0481\\u048a-\\u0527\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05d0-\\u05ea\\u05f0-\\u05f2\\u0620-\\u064a\\u066e\\u066f\\u0671-\\u06d3\\u06d5\\u06e5\\u06e6\\u06ee\\u06ef\\u06fa-\\u06fc\\u06ff\\u0710\\u0712-\\u072f\\u074d-\\u07a5\\u07b1\\u07ca-\\u07ea\\u07f4\\u07f5\\u07fa\\u0800-\\u0815\\u081a\\u0824\\u0828\\u0840-\\u0858\\u08a0\\u08a2-\\u08ac\\u0904-\\u0939\\u093d\\u0950\\u0958-\\u0961\\u0971-\\u0977\\u0979-\\u097f\\u0985-\\u098c\\u098f\\u0990\\u0993-\\u09a8\\u09aa-\\u09b0\\u09b2\\u09b6-\\u09b9\\u09bd\\u09ce\\u09dc\\u09dd\\u09df-\\u09e1\\u09f0\\u09f1\\u0a05-\\u0a0a\\u0a0f\\u0a10\\u0a13-\\u0a28\\u0a2a-\\u0a30\\u0a32\\u0a33\\u0a35\\u0a36\\u0a38\\u0a39\\u0a59-\\u0a5c\\u0a5e\\u0a72-\\u0a74\\u0a85-\\u0a8d\\u0a8f-\\u0a91\\u0a93-\\u0aa8\\u0aaa-\\u0ab0\\u0ab2\\u0ab3\\u0ab5-\\u0ab9\\u0abd\\u0ad0\\u0ae0\\u0ae1\\u0b05-\\u0b0c\\u0b0f\\u0b10\\u0b13-\\u0b28\\u0b2a-\\u0b30\\u0b32\\u0b33\\u0b35-\\u0b39\\u0b3d\\u0b5c\\u0b5d\\u0b5f-\\u0b61\\u0b71\\u0b83\\u0b85-\\u0b8a\\u0b8e-\\u0b90\\u0b92-\\u0b95\\u0b99\\u0b9a\\u0b9c\\u0b9e\\u0b9f\\u0ba3\\u0ba4\\u0ba8-\\u0baa\\u0bae-\\u0bb9\\u0bd0\\u0c05-\\u0c0c\\u0c0e-\\u0c10\\u0c12-\\u0c28\\u0c2a-\\u0c33\\u0c35-\\u0c39\\u0c3d\\u0c58\\u0c59\\u0c60\\u0c61\\u0c85-\\u0c8c\\u0c8e-\\u0c90\\u0c92-\\u0ca8\\u0caa-\\u0cb3\\u0cb5-\\u0cb9\\u0cbd\\u0cde\\u0ce0\\u0ce1\\u0cf1\\u0cf2\\u0d05-\\u0d0c\\u0d0e-\\u0d10\\u0d12-\\u0d3a\\u0d3d\\u0d4e\\u0d60\\u0d61\\u0d7a-\\u0d7f\\u0d85-\\u0d96\\u0d9a-\\u0db1\\u0db3-\\u0dbb\\u0dbd\\u0dc0-\\u0dc6\\u0e01-\\u0e30\\u0e32\\u0e33\\u0e40-\\u0e46\\u0e81\\u0e82\\u0e84\\u0e87\\u0e88\\u0e8a\\u0e8d\\u0e94-\\u0e97\\u0e99-\\u0e9f\\u0ea1-\\u0ea3\\u0ea5\\u0ea7\\u0eaa\\u0eab\\u0ead-\\u0eb0\\u0eb2\\u0eb3\\u0ebd\\u0ec0-\\u0ec4\\u0ec6\\u0edc-\\u0edf\\u0f00\\u0f40-\\u0f47\\u0f49-\\u0f6c\\u0f88-\\u0f8c\\u1000-\\u102a\\u103f\\u1050-\\u1055\\u105a-\\u105d\\u1061\\u1065\\u1066\\u106e-\\u1070\\u1075-\\u1081\\u108e\\u10a0-\\u10c5\\u10c7\\u10cd\\u10d0-\\u10fa\\u10fc-\\u1248\\u124a-\\u124d\\u1250-\\u1256\\u1258\\u125a-\\u125d\\u1260-\\u1288\\u128a-\\u128d\\u1290-\\u12b0\\u12b2-\\u12b5\\u12b8-\\u12be\\u12c0\\u12c2-\\u12c5\\u12c8-\\u12d6\\u12d8-\\u1310\\u1312-\\u1315\\u1318-\\u135a\\u1380-\\u138f\\u13a0-\\u13f4\\u1401-\\u166c\\u166f-\\u167f\\u1681-\\u169a\\u16a0-\\u16ea\\u16ee-\\u16f0\\u1700-\\u170c\\u170e-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176c\\u176e-\\u1770\\u1780-\\u17b3\\u17d7\\u17dc\\u1820-\\u1877\\u1880-\\u18a8\\u18aa\\u18b0-\\u18f5\\u1900-\\u191c\\u1950-\\u196d\\u1970-\\u1974\\u1980-\\u19ab\\u19c1-\\u19c7\\u1a00-\\u1a16\\u1a20-\\u1a54\\u1aa7\\u1b05-\\u1b33\\u1b45-\\u1b4b\\u1b83-\\u1ba0\\u1bae\\u1baf\\u1bba-\\u1be5\\u1c00-\\u1c23\\u1c4d-\\u1c4f\\u1c5a-\\u1c7d\\u1ce9-\\u1cec\\u1cee-\\u1cf1\\u1cf5\\u1cf6\\u1d00-\\u1dbf\\u1e00-\\u1f15\\u1f18-\\u1f1d\\u1f20-\\u1f45\\u1f48-\\u1f4d\\u1f50-\\u1f57\\u1f59\\u1f5b\\u1f5d\\u1f5f-\\u1f7d\\u1f80-\\u1fb4\\u1fb6-\\u1fbc\\u1fbe\\u1fc2-\\u1fc4\\u1fc6-\\u1fcc\\u1fd0-\\u1fd3\\u1fd6-\\u1fdb\\u1fe0-\\u1fec\\u1ff2-\\u1ff4\\u1ff6-\\u1ffc\\u2071\\u207f\\u2090-\\u209c\\u2102\\u2107\\u210a-\\u2113\\u2115\\u2119-\\u211d\\u2124\\u2126\\u2128\\u212a-\\u212d\\u212f-\\u2139\\u213c-\\u213f\\u2145-\\u2149\\u214e\\u2160-\\u2188\\u2c00-\\u2c2e\\u2c30-\\u2c5e\\u2c60-\\u2ce4\\u2ceb-\\u2cee\\u2cf2\\u2cf3\\u2d00-\\u2d25\\u2d27\\u2d2d\\u2d30-\\u2d67\\u2d6f\\u2d80-\\u2d96\\u2da0-\\u2da6\\u2da8-\\u2dae\\u2db0-\\u2db6\\u2db8-\\u2dbe\\u2dc0-\\u2dc6\\u2dc8-\\u2dce\\u2dd0-\\u2dd6\\u2dd8-\\u2dde\\u2e2f\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303c\\u3041-\\u3096\\u309d-\\u309f\\u30a1-\\u30fa\\u30fc-\\u30ff\\u3105-\\u312d\\u3131-\\u318e\\u31a0-\\u31ba\\u31f0-\\u31ff\\u3400-\\u4db5\\u4e00-\\u9fcc\\ua000-\\ua48c\\ua4d0-\\ua4fd\\ua500-\\ua60c\\ua610-\\ua61f\\ua62a\\ua62b\\ua640-\\ua66e\\ua67f-\\ua697\\ua6a0-\\ua6ef\\ua717-\\ua71f\\ua722-\\ua788\\ua78b-\\ua78e\\ua790-\\ua793\\ua7a0-\\ua7aa\\ua7f8-\\ua801\\ua803-\\ua805\\ua807-\\ua80a\\ua80c-\\ua822\\ua840-\\ua873\\ua882-\\ua8b3\\ua8f2-\\ua8f7\\ua8fb\\ua90a-\\ua925\\ua930-\\ua946\\ua960-\\ua97c\\ua984-\\ua9b2\\ua9cf\\uaa00-\\uaa28\\uaa40-\\uaa42\\uaa44-\\uaa4b\\uaa60-\\uaa76\\uaa7a\\uaa80-\\uaaaf\\uaab1\\uaab5\\uaab6\\uaab9-\\uaabd\\uaac0\\uaac2\\uaadb-\\uaadd\\uaae0-\\uaaea\\uaaf2-\\uaaf4\\uab01-\\uab06\\uab09-\\uab0e\\uab11-\\uab16\\uab20-\\uab26\\uab28-\\uab2e\\uabc0-\\uabe2\\uac00-\\ud7a3\\ud7b0-\\ud7c6\\ud7cb-\\ud7fb\\uf900-\\ufa6d\\ufa70-\\ufad9\\ufb00-\\ufb06\\ufb13-\\ufb17\\ufb1d\\ufb1f-\\ufb28\\ufb2a-\\ufb36\\ufb38-\\ufb3c\\ufb3e\\ufb40\\ufb41\\ufb43\\ufb44\\ufb46-\\ufbb1\\ufbd3-\\ufd3d\\ufd50-\\ufd8f\\ufd92-\\ufdc7\\ufdf0-\\ufdfb\\ufe70-\\ufe74\\ufe76-\\ufefc\\uff21-\\uff3a\\uff41-\\uff5a\\uff66-\\uffbe\\uffc2-\\uffc7\\uffca-\\uffcf\\uffd2-\\uffd7\\uffda-\\uffdc]\"\n                            ),\n                            NonAsciiIdentifierPart: new RegExp(\n                                \"[\\xaa\\xb5\\xba\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\u02c1\\u02c6-\\u02d1\\u02e0-\\u02e4\\u02ec\\u02ee\\u0300-\\u0374\\u0376\\u0377\\u037a-\\u037d\\u0386\\u0388-\\u038a\\u038c\\u038e-\\u03a1\\u03a3-\\u03f5\\u03f7-\\u0481\\u0483-\\u0487\\u048a-\\u0527\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u0591-\\u05bd\\u05bf\\u05c1\\u05c2\\u05c4\\u05c5\\u05c7\\u05d0-\\u05ea\\u05f0-\\u05f2\\u0610-\\u061a\\u0620-\\u0669\\u066e-\\u06d3\\u06d5-\\u06dc\\u06df-\\u06e8\\u06ea-\\u06fc\\u06ff\\u0710-\\u074a\\u074d-\\u07b1\\u07c0-\\u07f5\\u07fa\\u0800-\\u082d\\u0840-\\u085b\\u08a0\\u08a2-\\u08ac\\u08e4-\\u08fe\\u0900-\\u0963\\u0966-\\u096f\\u0971-\\u0977\\u0979-\\u097f\\u0981-\\u0983\\u0985-\\u098c\\u098f\\u0990\\u0993-\\u09a8\\u09aa-\\u09b0\\u09b2\\u09b6-\\u09b9\\u09bc-\\u09c4\\u09c7\\u09c8\\u09cb-\\u09ce\\u09d7\\u09dc\\u09dd\\u09df-\\u09e3\\u09e6-\\u09f1\\u0a01-\\u0a03\\u0a05-\\u0a0a\\u0a0f\\u0a10\\u0a13-\\u0a28\\u0a2a-\\u0a30\\u0a32\\u0a33\\u0a35\\u0a36\\u0a38\\u0a39\\u0a3c\\u0a3e-\\u0a42\\u0a47\\u0a48\\u0a4b-\\u0a4d\\u0a51\\u0a59-\\u0a5c\\u0a5e\\u0a66-\\u0a75\\u0a81-\\u0a83\\u0a85-\\u0a8d\\u0a8f-\\u0a91\\u0a93-\\u0aa8\\u0aaa-\\u0ab0\\u0ab2\\u0ab3\\u0ab5-\\u0ab9\\u0abc-\\u0ac5\\u0ac7-\\u0ac9\\u0acb-\\u0acd\\u0ad0\\u0ae0-\\u0ae3\\u0ae6-\\u0aef\\u0b01-\\u0b03\\u0b05-\\u0b0c\\u0b0f\\u0b10\\u0b13-\\u0b28\\u0b2a-\\u0b30\\u0b32\\u0b33\\u0b35-\\u0b39\\u0b3c-\\u0b44\\u0b47\\u0b48\\u0b4b-\\u0b4d\\u0b56\\u0b57\\u0b5c\\u0b5d\\u0b5f-\\u0b63\\u0b66-\\u0b6f\\u0b71\\u0b82\\u0b83\\u0b85-\\u0b8a\\u0b8e-\\u0b90\\u0b92-\\u0b95\\u0b99\\u0b9a\\u0b9c\\u0b9e\\u0b9f\\u0ba3\\u0ba4\\u0ba8-\\u0baa\\u0bae-\\u0bb9\\u0bbe-\\u0bc2\\u0bc6-\\u0bc8\\u0bca-\\u0bcd\\u0bd0\\u0bd7\\u0be6-\\u0bef\\u0c01-\\u0c03\\u0c05-\\u0c0c\\u0c0e-\\u0c10\\u0c12-\\u0c28\\u0c2a-\\u0c33\\u0c35-\\u0c39\\u0c3d-\\u0c44\\u0c46-\\u0c48\\u0c4a-\\u0c4d\\u0c55\\u0c56\\u0c58\\u0c59\\u0c60-\\u0c63\\u0c66-\\u0c6f\\u0c82\\u0c83\\u0c85-\\u0c8c\\u0c8e-\\u0c90\\u0c92-\\u0ca8\\u0caa-\\u0cb3\\u0cb5-\\u0cb9\\u0cbc-\\u0cc4\\u0cc6-\\u0cc8\\u0cca-\\u0ccd\\u0cd5\\u0cd6\\u0cde\\u0ce0-\\u0ce3\\u0ce6-\\u0cef\\u0cf1\\u0cf2\\u0d02\\u0d03\\u0d05-\\u0d0c\\u0d0e-\\u0d10\\u0d12-\\u0d3a\\u0d3d-\\u0d44\\u0d46-\\u0d48\\u0d4a-\\u0d4e\\u0d57\\u0d60-\\u0d63\\u0d66-\\u0d6f\\u0d7a-\\u0d7f\\u0d82\\u0d83\\u0d85-\\u0d96\\u0d9a-\\u0db1\\u0db3-\\u0dbb\\u0dbd\\u0dc0-\\u0dc6\\u0dca\\u0dcf-\\u0dd4\\u0dd6\\u0dd8-\\u0ddf\\u0df2\\u0df3\\u0e01-\\u0e3a\\u0e40-\\u0e4e\\u0e50-\\u0e59\\u0e81\\u0e82\\u0e84\\u0e87\\u0e88\\u0e8a\\u0e8d\\u0e94-\\u0e97\\u0e99-\\u0e9f\\u0ea1-\\u0ea3\\u0ea5\\u0ea7\\u0eaa\\u0eab\\u0ead-\\u0eb9\\u0ebb-\\u0ebd\\u0ec0-\\u0ec4\\u0ec6\\u0ec8-\\u0ecd\\u0ed0-\\u0ed9\\u0edc-\\u0edf\\u0f00\\u0f18\\u0f19\\u0f20-\\u0f29\\u0f35\\u0f37\\u0f39\\u0f3e-\\u0f47\\u0f49-\\u0f6c\\u0f71-\\u0f84\\u0f86-\\u0f97\\u0f99-\\u0fbc\\u0fc6\\u1000-\\u1049\\u1050-\\u109d\\u10a0-\\u10c5\\u10c7\\u10cd\\u10d0-\\u10fa\\u10fc-\\u1248\\u124a-\\u124d\\u1250-\\u1256\\u1258\\u125a-\\u125d\\u1260-\\u1288\\u128a-\\u128d\\u1290-\\u12b0\\u12b2-\\u12b5\\u12b8-\\u12be\\u12c0\\u12c2-\\u12c5\\u12c8-\\u12d6\\u12d8-\\u1310\\u1312-\\u1315\\u1318-\\u135a\\u135d-\\u135f\\u1380-\\u138f\\u13a0-\\u13f4\\u1401-\\u166c\\u166f-\\u167f\\u1681-\\u169a\\u16a0-\\u16ea\\u16ee-\\u16f0\\u1700-\\u170c\\u170e-\\u1714\\u1720-\\u1734\\u1740-\\u1753\\u1760-\\u176c\\u176e-\\u1770\\u1772\\u1773\\u1780-\\u17d3\\u17d7\\u17dc\\u17dd\\u17e0-\\u17e9\\u180b-\\u180d\\u1810-\\u1819\\u1820-\\u1877\\u1880-\\u18aa\\u18b0-\\u18f5\\u1900-\\u191c\\u1920-\\u192b\\u1930-\\u193b\\u1946-\\u196d\\u1970-\\u1974\\u1980-\\u19ab\\u19b0-\\u19c9\\u19d0-\\u19d9\\u1a00-\\u1a1b\\u1a20-\\u1a5e\\u1a60-\\u1a7c\\u1a7f-\\u1a89\\u1a90-\\u1a99\\u1aa7\\u1b00-\\u1b4b\\u1b50-\\u1b59\\u1b6b-\\u1b73\\u1b80-\\u1bf3\\u1c00-\\u1c37\\u1c40-\\u1c49\\u1c4d-\\u1c7d\\u1cd0-\\u1cd2\\u1cd4-\\u1cf6\\u1d00-\\u1de6\\u1dfc-\\u1f15\\u1f18-\\u1f1d\\u1f20-\\u1f45\\u1f48-\\u1f4d\\u1f50-\\u1f57\\u1f59\\u1f5b\\u1f5d\\u1f5f-\\u1f7d\\u1f80-\\u1fb4\\u1fb6-\\u1fbc\\u1fbe\\u1fc2-\\u1fc4\\u1fc6-\\u1fcc\\u1fd0-\\u1fd3\\u1fd6-\\u1fdb\\u1fe0-\\u1fec\\u1ff2-\\u1ff4\\u1ff6-\\u1ffc\\u200c\\u200d\\u203f\\u2040\\u2054\\u2071\\u207f\\u2090-\\u209c\\u20d0-\\u20dc\\u20e1\\u20e5-\\u20f0\\u2102\\u2107\\u210a-\\u2113\\u2115\\u2119-\\u211d\\u2124\\u2126\\u2128\\u212a-\\u212d\\u212f-\\u2139\\u213c-\\u213f\\u2145-\\u2149\\u214e\\u2160-\\u2188\\u2c00-\\u2c2e\\u2c30-\\u2c5e\\u2c60-\\u2ce4\\u2ceb-\\u2cf3\\u2d00-\\u2d25\\u2d27\\u2d2d\\u2d30-\\u2d67\\u2d6f\\u2d7f-\\u2d96\\u2da0-\\u2da6\\u2da8-\\u2dae\\u2db0-\\u2db6\\u2db8-\\u2dbe\\u2dc0-\\u2dc6\\u2dc8-\\u2dce\\u2dd0-\\u2dd6\\u2dd8-\\u2dde\\u2de0-\\u2dff\\u2e2f\\u3005-\\u3007\\u3021-\\u302f\\u3031-\\u3035\\u3038-\\u303c\\u3041-\\u3096\\u3099\\u309a\\u309d-\\u309f\\u30a1-\\u30fa\\u30fc-\\u30ff\\u3105-\\u312d\\u3131-\\u318e\\u31a0-\\u31ba\\u31f0-\\u31ff\\u3400-\\u4db5\\u4e00-\\u9fcc\\ua000-\\ua48c\\ua4d0-\\ua4fd\\ua500-\\ua60c\\ua610-\\ua62b\\ua640-\\ua66f\\ua674-\\ua67d\\ua67f-\\ua697\\ua69f-\\ua6f1\\ua717-\\ua71f\\ua722-\\ua788\\ua78b-\\ua78e\\ua790-\\ua793\\ua7a0-\\ua7aa\\ua7f8-\\ua827\\ua840-\\ua873\\ua880-\\ua8c4\\ua8d0-\\ua8d9\\ua8e0-\\ua8f7\\ua8fb\\ua900-\\ua92d\\ua930-\\ua953\\ua960-\\ua97c\\ua980-\\ua9c0\\ua9cf-\\ua9d9\\uaa00-\\uaa36\\uaa40-\\uaa4d\\uaa50-\\uaa59\\uaa60-\\uaa76\\uaa7a\\uaa7b\\uaa80-\\uaac2\\uaadb-\\uaadd\\uaae0-\\uaaef\\uaaf2-\\uaaf6\\uab01-\\uab06\\uab09-\\uab0e\\uab11-\\uab16\\uab20-\\uab26\\uab28-\\uab2e\\uabc0-\\uabea\\uabec\\uabed\\uabf0-\\uabf9\\uac00-\\ud7a3\\ud7b0-\\ud7c6\\ud7cb-\\ud7fb\\uf900-\\ufa6d\\ufa70-\\ufad9\\ufb00-\\ufb06\\ufb13-\\ufb17\\ufb1d-\\ufb28\\ufb2a-\\ufb36\\ufb38-\\ufb3c\\ufb3e\\ufb40\\ufb41\\ufb43\\ufb44\\ufb46-\\ufbb1\\ufbd3-\\ufd3d\\ufd50-\\ufd8f\\ufd92-\\ufdc7\\ufdf0-\\ufdfb\\ufe00-\\ufe0f\\ufe20-\\ufe26\\ufe33\\ufe34\\ufe4d-\\ufe4f\\ufe70-\\ufe74\\ufe76-\\ufefc\\uff10-\\uff19\\uff21-\\uff3a\\uff3f\\uff41-\\uff5a\\uff66-\\uffbe\\uffc2-\\uffc7\\uffca-\\uffcf\\uffd2-\\uffd7\\uffda-\\uffdc]\"\n                            ),\n                            LeadingZeros: new RegExp(\"^0+(?!$)\")\n                        }\n\n                        // Ensure the condition is true, otherwise throw an error.\n                        // This is only to have a better contract semantic, i.e. another safety net\n                        // to catch a logic error. The condition shall be fulfilled in normal case.\n                        // Do NOT use this to enforce a certain condition on any user input.\n\n                        function assert(condition, message) {\n                            /* istanbul ignore if */\n                            if (!condition) {\n                                throw new Error(\"ASSERT: \" + message)\n                            }\n                        }\n\n                        function StringMap() {\n                            this.$data = {}\n                        }\n\n                        StringMap.prototype.get = function(key) {\n                            key = \"$\" + key\n                            return this.$data[key]\n                        }\n\n                        StringMap.prototype.set = function(key, value) {\n                            key = \"$\" + key\n                            this.$data[key] = value\n                            return this\n                        }\n\n                        StringMap.prototype.has = function(key) {\n                            key = \"$\" + key\n                            return Object.prototype.hasOwnProperty.call(this.$data, key)\n                        }\n\n                        StringMap.prototype[\"delete\"] = function(key) {\n                            key = \"$\" + key\n                            return delete this.$data[key]\n                        }\n\n                        function isDecimalDigit(ch) {\n                            return ch >= 48 && ch <= 57 // 0..9\n                        }\n\n                        function isHexDigit(ch) {\n                            return \"0123456789abcdefABCDEF\".indexOf(ch) >= 0\n                        }\n\n                        function isOctalDigit(ch) {\n                            return \"01234567\".indexOf(ch) >= 0\n                        }\n\n                        // 7.2 White Space\n\n                        function isWhiteSpace(ch) {\n                            return (\n                                ch === 32 || // space\n                                ch === 9 || // tab\n                                ch === 0xb ||\n                                ch === 0xc ||\n                                ch === 0xa0 ||\n                                (ch >= 0x1680 &&\n                                    \"\\u1680\\u180E\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200A\\u202F\\u205F\\u3000\\uFEFF\".indexOf(\n                                        String.fromCharCode(ch)\n                                    ) > 0)\n                            )\n                        }\n\n                        // 7.3 Line Terminators\n\n                        function isLineTerminator(ch) {\n                            return ch === 10 || ch === 13 || ch === 0x2028 || ch === 0x2029\n                        }\n\n                        // 7.6 Identifier Names and Identifiers\n\n                        function isIdentifierStart(ch) {\n                            return (\n                                ch === 36 ||\n                                ch === 95 || // $ (dollar) and _ (underscore)\n                                (ch >= 65 && ch <= 90) || // A..Z\n                                (ch >= 97 && ch <= 122) || // a..z\n                                ch === 92 || // \\ (backslash)\n                                (ch >= 0x80 &&\n                                    Regex.NonAsciiIdentifierStart.test(String.fromCharCode(ch)))\n                            )\n                        }\n\n                        function isIdentifierPart(ch) {\n                            return (\n                                ch === 36 ||\n                                ch === 95 || // $ (dollar) and _ (underscore)\n                                (ch >= 65 && ch <= 90) || // A..Z\n                                (ch >= 97 && ch <= 122) || // a..z\n                                (ch >= 48 && ch <= 57) || // 0..9\n                                ch === 92 || // \\ (backslash)\n                                (ch >= 0x80 &&\n                                    Regex.NonAsciiIdentifierPart.test(String.fromCharCode(ch)))\n                            )\n                        }\n\n                        // 7.6.1.2 Future Reserved Words\n\n                        function isFutureReservedWord(id) {\n                            switch (id) {\n                                case \"class\":\n                                case \"enum\":\n                                case \"export\":\n                                case \"extends\":\n                                case \"import\":\n                                case \"super\":\n                                    return true\n                                default:\n                                    return false\n                            }\n                        }\n\n                        function isStrictModeReservedWord(id) {\n                            switch (id) {\n                                case \"implements\":\n                                case \"interface\":\n                                case \"package\":\n                                case \"private\":\n                                case \"protected\":\n                                case \"public\":\n                                case \"static\":\n                                case \"yield\":\n                                case \"let\":\n                                    return true\n                                default:\n                                    return false\n                            }\n                        }\n\n                        function isRestrictedWord(id) {\n                            return id === \"eval\" || id === \"arguments\"\n                        }\n\n                        // 7.6.1.1 Keywords\n\n                        function isKeyword(id) {\n                            if (strict && isStrictModeReservedWord(id)) {\n                                return true\n                            }\n\n                            // 'const' is specialized as Keyword in V8.\n                            // 'yield' is only treated as a keyword in strict mode.\n                            // 'let' is for compatiblity with SpiderMonkey and ES.next.\n                            // Some others are from future reserved words.\n\n                            switch (id.length) {\n                                case 2:\n                                    return id === \"if\" || id === \"in\" || id === \"do\"\n                                case 3:\n                                    return (\n                                        id === \"var\" ||\n                                        id === \"for\" ||\n                                        id === \"new\" ||\n                                        id === \"try\" ||\n                                        id === \"let\"\n                                    )\n                                case 4:\n                                    return (\n                                        id === \"this\" ||\n                                        id === \"else\" ||\n                                        id === \"case\" ||\n                                        id === \"void\" ||\n                                        id === \"with\" ||\n                                        id === \"enum\"\n                                    )\n                                case 5:\n                                    return (\n                                        id === \"while\" ||\n                                        id === \"break\" ||\n                                        id === \"catch\" ||\n                                        id === \"throw\" ||\n                                        id === \"const\" ||\n                                        id === \"class\" ||\n                                        id === \"super\"\n                                    )\n                                case 6:\n                                    return (\n                                        id === \"return\" ||\n                                        id === \"typeof\" ||\n                                        id === \"delete\" ||\n                                        id === \"switch\" ||\n                                        id === \"export\" ||\n                                        id === \"import\"\n                                    )\n                                case 7:\n                                    return id === \"default\" || id === \"finally\" || id === \"extends\"\n                                case 8:\n                                    return (\n                                        id === \"function\" || id === \"continue\" || id === \"debugger\"\n                                    )\n                                case 10:\n                                    return id === \"instanceof\"\n                                default:\n                                    return false\n                            }\n                        }\n\n                        // 7.4 Comments\n\n                        function addComment(type, value, start, end, loc) {\n                            var comment\n                            assert(typeof start === \"number\", \"Comment must have valid position\")\n\n                            // Because the way the actual token is scanned, often the comments\n                            // (if any) are skipped twice during the lexical analysis.\n                            // Thus, we need to skip adding a comment if the comment array already\n                            // handled it.\n                            if (state.lastCommentStart >= start) {\n                                return\n                            }\n                            state.lastCommentStart = start\n\n                            comment = {\n                                type: type,\n                                value: value\n                            }\n                            if (extra.range) {\n                                comment.range = [start, end]\n                            }\n                            if (extra.loc) {\n                                comment.loc = loc\n                            }\n                            extra.comments.push(comment)\n                            if (extra.attachComment) {\n                                extra.leadingComments.push(comment)\n                                extra.trailingComments.push(comment)\n                            }\n                        }\n\n                        function skipSingleLineComment() {\n                            var start, loc, ch, comment\n\n                            start = index - 2\n                            loc = {\n                                start: {\n                                    line: lineNumber,\n                                    column: index - lineStart - 2\n                                }\n                            }\n\n                            while (index < length) {\n                                ch = source.charCodeAt(index)\n                                ++index\n                                if (isLineTerminator(ch)) {\n                                    if (extra.comments) {\n                                        comment = source.slice(start + 2, index - 1)\n                                        loc.end = {\n                                            line: lineNumber,\n                                            column: index - lineStart - 1\n                                        }\n                                        addComment(\"Line\", comment, start, index - 1, loc)\n                                    }\n                                    if (ch === 13 && source.charCodeAt(index) === 10) {\n                                        ++index\n                                    }\n                                    ++lineNumber\n                                    lineStart = index\n                                    return\n                                }\n                            }\n\n                            if (extra.comments) {\n                                comment = source.slice(start + 2, index)\n                                loc.end = {\n                                    line: lineNumber,\n                                    column: index - lineStart\n                                }\n                                addComment(\"Line\", comment, start, index, loc)\n                            }\n                        }\n\n                        function skipMultiLineComment() {\n                            var start, loc, ch, comment\n\n                            if (extra.comments) {\n                                start = index - 2\n                                loc = {\n                                    start: {\n                                        line: lineNumber,\n                                        column: index - lineStart - 2\n                                    }\n                                }\n                            }\n\n                            while (index < length) {\n                                ch = source.charCodeAt(index)\n                                if (isLineTerminator(ch)) {\n                                    if (ch === 13 && source.charCodeAt(index + 1) === 10) {\n                                        ++index\n                                    }\n                                    ++lineNumber\n                                    ++index\n                                    lineStart = index\n                                    if (index >= length) {\n                                        throwError({}, Messages.UnexpectedToken, \"ILLEGAL\")\n                                    }\n                                } else if (ch === 42) {\n                                    // Block comment ends with '*/' (char #42, char #47).\n                                    if (source.charCodeAt(index + 1) === 47) {\n                                        ++index\n                                        ++index\n                                        if (extra.comments) {\n                                            comment = source.slice(start + 2, index - 2)\n                                            loc.end = {\n                                                line: lineNumber,\n                                                column: index - lineStart\n                                            }\n                                            addComment(\"Block\", comment, start, index, loc)\n                                        }\n                                        return\n                                    }\n                                    ++index\n                                } else {\n                                    ++index\n                                }\n                            }\n\n                            throwError({}, Messages.UnexpectedToken, \"ILLEGAL\")\n                        }\n\n                        function skipComment() {\n                            var ch\n\n                            while (index < length) {\n                                ch = source.charCodeAt(index)\n\n                                if (isWhiteSpace(ch)) {\n                                    ++index\n                                } else if (isLineTerminator(ch)) {\n                                    ++index\n                                    if (ch === 13 && source.charCodeAt(index) === 10) {\n                                        ++index\n                                    }\n                                    ++lineNumber\n                                    lineStart = index\n                                } else if (ch === 47) {\n                                    // 47 is '/'\n                                    ch = source.charCodeAt(index + 1)\n                                    if (ch === 47) {\n                                        ++index\n                                        ++index\n                                        skipSingleLineComment()\n                                    } else if (ch === 42) {\n                                        // 42 is '*'\n                                        ++index\n                                        ++index\n                                        skipMultiLineComment()\n                                    } else {\n                                        break\n                                    }\n                                } else {\n                                    break\n                                }\n                            }\n                        }\n\n                        function scanHexEscape(prefix) {\n                            var i,\n                                len,\n                                ch,\n                                code = 0\n\n                            len = prefix === \"u\" ? 4 : 2\n                            for (i = 0; i < len; ++i) {\n                                if (index < length && isHexDigit(source[index])) {\n                                    ch = source[index++]\n                                    code = code * 16 + \"0123456789abcdef\".indexOf(ch.toLowerCase())\n                                } else {\n                                    return \"\"\n                                }\n                            }\n                            return String.fromCharCode(code)\n                        }\n\n                        function scanUnicodeCodePointEscape() {\n                            var ch, code, cu1, cu2\n\n                            ch = source[index]\n                            code = 0\n\n                            // At least, one hex digit is required.\n                            if (ch === \"}\") {\n                                throwError({}, Messages.UnexpectedToken, \"ILLEGAL\")\n                            }\n\n                            while (index < length) {\n                                ch = source[index++]\n                                if (!isHexDigit(ch)) {\n                                    break\n                                }\n                                code = code * 16 + \"0123456789abcdef\".indexOf(ch.toLowerCase())\n                            }\n\n                            if (code > 0x10ffff || ch !== \"}\") {\n                                throwError({}, Messages.UnexpectedToken, \"ILLEGAL\")\n                            }\n\n                            // UTF-16 Encoding\n                            if (code <= 0xffff) {\n                                return String.fromCharCode(code)\n                            }\n                            cu1 = ((code - 0x10000) >> 10) + 0xd800\n                            cu2 = ((code - 0x10000) & 1023) + 0xdc00\n                            return String.fromCharCode(cu1, cu2)\n                        }\n\n                        function getEscapedIdentifier() {\n                            var ch, id\n\n                            ch = source.charCodeAt(index++)\n                            id = String.fromCharCode(ch)\n\n                            // '\\u' (char #92, char #117) denotes an escaped character.\n                            if (ch === 92) {\n                                if (source.charCodeAt(index) !== 117) {\n                                    throwError({}, Messages.UnexpectedToken, \"ILLEGAL\")\n                                }\n                                ++index\n                                ch = scanHexEscape(\"u\")\n                                if (!ch || ch === \"\\\\\" || !isIdentifierStart(ch.charCodeAt(0))) {\n                                    throwError({}, Messages.UnexpectedToken, \"ILLEGAL\")\n                                }\n                                id = ch\n                            }\n\n                            while (index < length) {\n                                ch = source.charCodeAt(index)\n                                if (!isIdentifierPart(ch)) {\n                                    break\n                                }\n                                ++index\n                                id += String.fromCharCode(ch)\n\n                                // '\\u' (char #92, char #117) denotes an escaped character.\n                                if (ch === 92) {\n                                    id = id.substr(0, id.length - 1)\n                                    if (source.charCodeAt(index) !== 117) {\n                                        throwError({}, Messages.UnexpectedToken, \"ILLEGAL\")\n                                    }\n                                    ++index\n                                    ch = scanHexEscape(\"u\")\n                                    if (!ch || ch === \"\\\\\" || !isIdentifierPart(ch.charCodeAt(0))) {\n                                        throwError({}, Messages.UnexpectedToken, \"ILLEGAL\")\n                                    }\n                                    id += ch\n                                }\n                            }\n\n                            return id\n                        }\n\n                        function getIdentifier() {\n                            var start, ch\n\n                            start = index++\n                            while (index < length) {\n                                ch = source.charCodeAt(index)\n                                if (ch === 92) {\n                                    // Blackslash (char #92) marks Unicode escape sequence.\n                                    index = start\n                                    return getEscapedIdentifier()\n                                }\n                                if (isIdentifierPart(ch)) {\n                                    ++index\n                                } else {\n                                    break\n                                }\n                            }\n\n                            return source.slice(start, index)\n                        }\n\n                        function scanIdentifier() {\n                            var start, id, type\n\n                            start = index\n\n                            // Backslash (char #92) starts an escaped character.\n                            id =\n                                source.charCodeAt(index) === 92\n                                    ? getEscapedIdentifier()\n                                    : getIdentifier()\n\n                            // There is no keyword or literal with only one character.\n                            // Thus, it must be an identifier.\n                            if (id.length === 1) {\n                                type = Token.Identifier\n                            } else if (isKeyword(id)) {\n                                type = Token.Keyword\n                            } else if (id === \"null\") {\n                                type = Token.NullLiteral\n                            } else if (id === \"true\" || id === \"false\") {\n                                type = Token.BooleanLiteral\n                            } else {\n                                type = Token.Identifier\n                            }\n\n                            return {\n                                type: type,\n                                value: id,\n                                lineNumber: lineNumber,\n                                lineStart: lineStart,\n                                range: [start, index]\n                            }\n                        }\n\n                        // 7.7 Punctuators\n\n                        function scanPunctuator() {\n                            var start = index,\n                                code = source.charCodeAt(index),\n                                code2,\n                                ch1 = source[index],\n                                ch2,\n                                ch3,\n                                ch4\n\n                            if (state.inJSXTag || state.inJSXChild) {\n                                // Don't need to check for '{' and '}' as it's already handled\n                                // correctly by default.\n                                switch (code) {\n                                    case 60: // <\n                                    case 62: // >\n                                        ++index\n                                        return {\n                                            type: Token.Punctuator,\n                                            value: String.fromCharCode(code),\n                                            lineNumber: lineNumber,\n                                            lineStart: lineStart,\n                                            range: [start, index]\n                                        }\n                                }\n                            }\n\n                            switch (code) {\n                                // Check for most common single-character punctuators.\n                                case 40: // ( open bracket\n                                case 41: // ) close bracket\n                                case 59: // ; semicolon\n                                case 44: // , comma\n                                case 123: // { open curly brace\n                                case 125: // } close curly brace\n                                case 91: // [\n                                case 93: // ]\n                                case 58: // :\n                                case 63: // ?\n                                case 126: // ~\n                                    ++index\n                                    if (extra.tokenize) {\n                                        if (code === 40) {\n                                            extra.openParenToken = extra.tokens.length\n                                        } else if (code === 123) {\n                                            extra.openCurlyToken = extra.tokens.length\n                                        }\n                                    }\n                                    return {\n                                        type: Token.Punctuator,\n                                        value: String.fromCharCode(code),\n                                        lineNumber: lineNumber,\n                                        lineStart: lineStart,\n                                        range: [start, index]\n                                    }\n\n                                default:\n                                    code2 = source.charCodeAt(index + 1)\n\n                                    // '=' (char #61) marks an assignment or comparison operator.\n                                    if (code2 === 61) {\n                                        switch (code) {\n                                            case 37: // %\n                                            case 38: // &\n                                            case 42: // *:\n                                            case 43: // +\n                                            case 45: // -\n                                            case 47: // /\n                                            case 60: // <\n                                            case 62: // >\n                                            case 94: // ^\n                                            case 124: // |\n                                                index += 2\n                                                return {\n                                                    type: Token.Punctuator,\n                                                    value:\n                                                        String.fromCharCode(code) +\n                                                        String.fromCharCode(code2),\n                                                    lineNumber: lineNumber,\n                                                    lineStart: lineStart,\n                                                    range: [start, index]\n                                                }\n\n                                            case 33: // !\n                                            case 61: // =\n                                                index += 2\n\n                                                // !== and ===\n                                                if (source.charCodeAt(index) === 61) {\n                                                    ++index\n                                                }\n                                                return {\n                                                    type: Token.Punctuator,\n                                                    value: source.slice(start, index),\n                                                    lineNumber: lineNumber,\n                                                    lineStart: lineStart,\n                                                    range: [start, index]\n                                                }\n                                            default:\n                                                break\n                                        }\n                                    }\n                                    break\n                            }\n\n                            // Peek more characters.\n\n                            ch2 = source[index + 1]\n                            ch3 = source[index + 2]\n                            ch4 = source[index + 3]\n\n                            // 4-character punctuator: >>>=\n\n                            if (ch1 === \">\" && ch2 === \">\" && ch3 === \">\") {\n                                if (ch4 === \"=\") {\n                                    index += 4\n                                    return {\n                                        type: Token.Punctuator,\n                                        value: \">>>=\",\n                                        lineNumber: lineNumber,\n                                        lineStart: lineStart,\n                                        range: [start, index]\n                                    }\n                                }\n                            }\n\n                            // 3-character punctuators: === !== >>> <<= >>=\n\n                            if (ch1 === \">\" && ch2 === \">\" && ch3 === \">\" && !state.inType) {\n                                index += 3\n                                return {\n                                    type: Token.Punctuator,\n                                    value: \">>>\",\n                                    lineNumber: lineNumber,\n                                    lineStart: lineStart,\n                                    range: [start, index]\n                                }\n                            }\n\n                            if (ch1 === \"<\" && ch2 === \"<\" && ch3 === \"=\") {\n                                index += 3\n                                return {\n                                    type: Token.Punctuator,\n                                    value: \"<<=\",\n                                    lineNumber: lineNumber,\n                                    lineStart: lineStart,\n                                    range: [start, index]\n                                }\n                            }\n\n                            if (ch1 === \">\" && ch2 === \">\" && ch3 === \"=\") {\n                                index += 3\n                                return {\n                                    type: Token.Punctuator,\n                                    value: \">>=\",\n                                    lineNumber: lineNumber,\n                                    lineStart: lineStart,\n                                    range: [start, index]\n                                }\n                            }\n\n                            if (ch1 === \".\" && ch2 === \".\" && ch3 === \".\") {\n                                index += 3\n                                return {\n                                    type: Token.Punctuator,\n                                    value: \"...\",\n                                    lineNumber: lineNumber,\n                                    lineStart: lineStart,\n                                    range: [start, index]\n                                }\n                            }\n\n                            // Other 2-character punctuators: ++ -- << >> && ||\n\n                            // Don't match these tokens if we're in a type, since they never can\n                            // occur and can mess up types like Map<string, Array<string>>\n                            if (ch1 === ch2 && \"+-<>&|\".indexOf(ch1) >= 0 && !state.inType) {\n                                index += 2\n                                return {\n                                    type: Token.Punctuator,\n                                    value: ch1 + ch2,\n                                    lineNumber: lineNumber,\n                                    lineStart: lineStart,\n                                    range: [start, index]\n                                }\n                            }\n\n                            if (ch1 === \"=\" && ch2 === \">\") {\n                                index += 2\n                                return {\n                                    type: Token.Punctuator,\n                                    value: \"=>\",\n                                    lineNumber: lineNumber,\n                                    lineStart: lineStart,\n                                    range: [start, index]\n                                }\n                            }\n\n                            if (\"<>=!+-*%&|^/\".indexOf(ch1) >= 0) {\n                                ++index\n                                return {\n                                    type: Token.Punctuator,\n                                    value: ch1,\n                                    lineNumber: lineNumber,\n                                    lineStart: lineStart,\n                                    range: [start, index]\n                                }\n                            }\n\n                            if (ch1 === \".\") {\n                                ++index\n                                return {\n                                    type: Token.Punctuator,\n                                    value: ch1,\n                                    lineNumber: lineNumber,\n                                    lineStart: lineStart,\n                                    range: [start, index]\n                                }\n                            }\n\n                            throwError({}, Messages.UnexpectedToken, \"ILLEGAL\")\n                        }\n\n                        // 7.8.3 Numeric Literals\n\n                        function scanHexLiteral(start) {\n                            var number = \"\"\n\n                            while (index < length) {\n                                if (!isHexDigit(source[index])) {\n                                    break\n                                }\n                                number += source[index++]\n                            }\n\n                            if (number.length === 0) {\n                                throwError({}, Messages.UnexpectedToken, \"ILLEGAL\")\n                            }\n\n                            if (isIdentifierStart(source.charCodeAt(index))) {\n                                throwError({}, Messages.UnexpectedToken, \"ILLEGAL\")\n                            }\n\n                            return {\n                                type: Token.NumericLiteral,\n                                value: parseInt(\"0x\" + number, 16),\n                                lineNumber: lineNumber,\n                                lineStart: lineStart,\n                                range: [start, index]\n                            }\n                        }\n\n                        function scanBinaryLiteral(start) {\n                            var ch, number\n\n                            number = \"\"\n\n                            while (index < length) {\n                                ch = source[index]\n                                if (ch !== \"0\" && ch !== \"1\") {\n                                    break\n                                }\n                                number += source[index++]\n                            }\n\n                            if (number.length === 0) {\n                                // only 0b or 0B\n                                throwError({}, Messages.UnexpectedToken, \"ILLEGAL\")\n                            }\n\n                            if (index < length) {\n                                ch = source.charCodeAt(index)\n                                /* istanbul ignore else */\n                                if (isIdentifierStart(ch) || isDecimalDigit(ch)) {\n                                    throwError({}, Messages.UnexpectedToken, \"ILLEGAL\")\n                                }\n                            }\n\n                            return {\n                                type: Token.NumericLiteral,\n                                value: parseInt(number, 2),\n                                lineNumber: lineNumber,\n                                lineStart: lineStart,\n                                range: [start, index]\n                            }\n                        }\n\n                        function scanOctalLiteral(prefix, start) {\n                            var number, octal\n\n                            if (isOctalDigit(prefix)) {\n                                octal = true\n                                number = \"0\" + source[index++]\n                            } else {\n                                octal = false\n                                ++index\n                                number = \"\"\n                            }\n\n                            while (index < length) {\n                                if (!isOctalDigit(source[index])) {\n                                    break\n                                }\n                                number += source[index++]\n                            }\n\n                            if (!octal && number.length === 0) {\n                                // only 0o or 0O\n                                throwError({}, Messages.UnexpectedToken, \"ILLEGAL\")\n                            }\n\n                            if (\n                                isIdentifierStart(source.charCodeAt(index)) ||\n                                isDecimalDigit(source.charCodeAt(index))\n                            ) {\n                                throwError({}, Messages.UnexpectedToken, \"ILLEGAL\")\n                            }\n\n                            return {\n                                type: Token.NumericLiteral,\n                                value: parseInt(number, 8),\n                                octal: octal,\n                                lineNumber: lineNumber,\n                                lineStart: lineStart,\n                                range: [start, index]\n                            }\n                        }\n\n                        function scanNumericLiteral() {\n                            var number, start, ch\n\n                            ch = source[index]\n                            assert(\n                                isDecimalDigit(ch.charCodeAt(0)) || ch === \".\",\n                                \"Numeric literal must start with a decimal digit or a decimal point\"\n                            )\n\n                            start = index\n                            number = \"\"\n                            if (ch !== \".\") {\n                                number = source[index++]\n                                ch = source[index]\n\n                                // Hex number starts with '0x'.\n                                // Octal number starts with '0'.\n                                // Octal number in ES6 starts with '0o'.\n                                // Binary number in ES6 starts with '0b'.\n                                if (number === \"0\") {\n                                    if (ch === \"x\" || ch === \"X\") {\n                                        ++index\n                                        return scanHexLiteral(start)\n                                    }\n                                    if (ch === \"b\" || ch === \"B\") {\n                                        ++index\n                                        return scanBinaryLiteral(start)\n                                    }\n                                    if (ch === \"o\" || ch === \"O\" || isOctalDigit(ch)) {\n                                        return scanOctalLiteral(ch, start)\n                                    }\n                                    // decimal number starts with '0' such as '09' is illegal.\n                                    if (ch && isDecimalDigit(ch.charCodeAt(0))) {\n                                        throwError({}, Messages.UnexpectedToken, \"ILLEGAL\")\n                                    }\n                                }\n\n                                while (isDecimalDigit(source.charCodeAt(index))) {\n                                    number += source[index++]\n                                }\n                                ch = source[index]\n                            }\n\n                            if (ch === \".\") {\n                                number += source[index++]\n                                while (isDecimalDigit(source.charCodeAt(index))) {\n                                    number += source[index++]\n                                }\n                                ch = source[index]\n                            }\n\n                            if (ch === \"e\" || ch === \"E\") {\n                                number += source[index++]\n\n                                ch = source[index]\n                                if (ch === \"+\" || ch === \"-\") {\n                                    number += source[index++]\n                                }\n                                if (isDecimalDigit(source.charCodeAt(index))) {\n                                    while (isDecimalDigit(source.charCodeAt(index))) {\n                                        number += source[index++]\n                                    }\n                                } else {\n                                    throwError({}, Messages.UnexpectedToken, \"ILLEGAL\")\n                                }\n                            }\n\n                            if (isIdentifierStart(source.charCodeAt(index))) {\n                                throwError({}, Messages.UnexpectedToken, \"ILLEGAL\")\n                            }\n\n                            return {\n                                type: Token.NumericLiteral,\n                                value: parseFloat(number),\n                                lineNumber: lineNumber,\n                                lineStart: lineStart,\n                                range: [start, index]\n                            }\n                        }\n\n                        // 7.8.4 String Literals\n\n                        function scanStringLiteral() {\n                            var str = \"\",\n                                quote,\n                                start,\n                                ch,\n                                code,\n                                unescaped,\n                                restore,\n                                octal = false\n\n                            quote = source[index]\n                            assert(\n                                quote === \"'\" || quote === '\"',\n                                \"String literal must starts with a quote\"\n                            )\n\n                            start = index\n                            ++index\n\n                            while (index < length) {\n                                ch = source[index++]\n\n                                if (ch === quote) {\n                                    quote = \"\"\n                                    break\n                                } else if (ch === \"\\\\\") {\n                                    ch = source[index++]\n                                    if (!ch || !isLineTerminator(ch.charCodeAt(0))) {\n                                        switch (ch) {\n                                            case \"n\":\n                                                str += \"\\n\"\n                                                break\n                                            case \"r\":\n                                                str += \"\\r\"\n                                                break\n                                            case \"t\":\n                                                str += \"\\t\"\n                                                break\n                                            case \"u\":\n                                            case \"x\":\n                                                if (source[index] === \"{\") {\n                                                    ++index\n                                                    str += scanUnicodeCodePointEscape()\n                                                } else {\n                                                    restore = index\n                                                    unescaped = scanHexEscape(ch)\n                                                    if (unescaped) {\n                                                        str += unescaped\n                                                    } else {\n                                                        index = restore\n                                                        str += ch\n                                                    }\n                                                }\n                                                break\n                                            case \"b\":\n                                                str += \"\\b\"\n                                                break\n                                            case \"f\":\n                                                str += \"\\f\"\n                                                break\n                                            case \"v\":\n                                                str += \"\\x0B\"\n                                                break\n\n                                            default:\n                                                if (isOctalDigit(ch)) {\n                                                    code = \"01234567\".indexOf(ch)\n\n                                                    // \\0 is not octal escape sequence\n                                                    if (code !== 0) {\n                                                        octal = true\n                                                    }\n\n                                                    /* istanbul ignore else */\n                                                    if (\n                                                        index < length &&\n                                                        isOctalDigit(source[index])\n                                                    ) {\n                                                        octal = true\n                                                        code =\n                                                            code * 8 +\n                                                            \"01234567\".indexOf(source[index++])\n\n                                                        // 3 digits are only allowed when string starts\n                                                        // with 0, 1, 2, 3\n                                                        if (\n                                                            \"0123\".indexOf(ch) >= 0 &&\n                                                            index < length &&\n                                                            isOctalDigit(source[index])\n                                                        ) {\n                                                            code =\n                                                                code * 8 +\n                                                                \"01234567\".indexOf(source[index++])\n                                                        }\n                                                    }\n                                                    str += String.fromCharCode(code)\n                                                } else {\n                                                    str += ch\n                                                }\n                                                break\n                                        }\n                                    } else {\n                                        ++lineNumber\n                                        if (ch === \"\\r\" && source[index] === \"\\n\") {\n                                            ++index\n                                        }\n                                        lineStart = index\n                                    }\n                                } else if (isLineTerminator(ch.charCodeAt(0))) {\n                                    break\n                                } else {\n                                    str += ch\n                                }\n                            }\n\n                            if (quote !== \"\") {\n                                throwError({}, Messages.UnexpectedToken, \"ILLEGAL\")\n                            }\n\n                            return {\n                                type: Token.StringLiteral,\n                                value: str,\n                                octal: octal,\n                                lineNumber: lineNumber,\n                                lineStart: lineStart,\n                                range: [start, index]\n                            }\n                        }\n\n                        function scanTemplate() {\n                            var cooked = \"\",\n                                ch,\n                                start,\n                                terminated,\n                                tail,\n                                restore,\n                                unescaped,\n                                code,\n                                octal\n\n                            terminated = false\n                            tail = false\n                            start = index\n\n                            ++index\n\n                            while (index < length) {\n                                ch = source[index++]\n                                if (ch === \"`\") {\n                                    tail = true\n                                    terminated = true\n                                    break\n                                } else if (ch === \"$\") {\n                                    if (source[index] === \"{\") {\n                                        ++index\n                                        terminated = true\n                                        break\n                                    }\n                                    cooked += ch\n                                } else if (ch === \"\\\\\") {\n                                    ch = source[index++]\n                                    if (!isLineTerminator(ch.charCodeAt(0))) {\n                                        switch (ch) {\n                                            case \"n\":\n                                                cooked += \"\\n\"\n                                                break\n                                            case \"r\":\n                                                cooked += \"\\r\"\n                                                break\n                                            case \"t\":\n                                                cooked += \"\\t\"\n                                                break\n                                            case \"u\":\n                                            case \"x\":\n                                                if (source[index] === \"{\") {\n                                                    ++index\n                                                    cooked += scanUnicodeCodePointEscape()\n                                                } else {\n                                                    restore = index\n                                                    unescaped = scanHexEscape(ch)\n                                                    if (unescaped) {\n                                                        cooked += unescaped\n                                                    } else {\n                                                        index = restore\n                                                        cooked += ch\n                                                    }\n                                                }\n                                                break\n                                            case \"b\":\n                                                cooked += \"\\b\"\n                                                break\n                                            case \"f\":\n                                                cooked += \"\\f\"\n                                                break\n                                            case \"v\":\n                                                cooked += \"\\v\"\n                                                break\n\n                                            default:\n                                                if (isOctalDigit(ch)) {\n                                                    code = \"01234567\".indexOf(ch)\n\n                                                    // \\0 is not octal escape sequence\n                                                    if (code !== 0) {\n                                                        octal = true\n                                                    }\n\n                                                    /* istanbul ignore else */\n                                                    if (\n                                                        index < length &&\n                                                        isOctalDigit(source[index])\n                                                    ) {\n                                                        octal = true\n                                                        code =\n                                                            code * 8 +\n                                                            \"01234567\".indexOf(source[index++])\n\n                                                        // 3 digits are only allowed when string starts\n                                                        // with 0, 1, 2, 3\n                                                        if (\n                                                            \"0123\".indexOf(ch) >= 0 &&\n                                                            index < length &&\n                                                            isOctalDigit(source[index])\n                                                        ) {\n                                                            code =\n                                                                code * 8 +\n                                                                \"01234567\".indexOf(source[index++])\n                                                        }\n                                                    }\n                                                    cooked += String.fromCharCode(code)\n                                                } else {\n                                                    cooked += ch\n                                                }\n                                                break\n                                        }\n                                    } else {\n                                        ++lineNumber\n                                        if (ch === \"\\r\" && source[index] === \"\\n\") {\n                                            ++index\n                                        }\n                                        lineStart = index\n                                    }\n                                } else if (isLineTerminator(ch.charCodeAt(0))) {\n                                    ++lineNumber\n                                    if (ch === \"\\r\" && source[index] === \"\\n\") {\n                                        ++index\n                                    }\n                                    lineStart = index\n                                    cooked += \"\\n\"\n                                } else {\n                                    cooked += ch\n                                }\n                            }\n\n                            if (!terminated) {\n                                throwError({}, Messages.UnexpectedToken, \"ILLEGAL\")\n                            }\n\n                            return {\n                                type: Token.Template,\n                                value: {\n                                    cooked: cooked,\n                                    raw: source.slice(start + 1, index - (tail ? 1 : 2))\n                                },\n                                tail: tail,\n                                octal: octal,\n                                lineNumber: lineNumber,\n                                lineStart: lineStart,\n                                range: [start, index]\n                            }\n                        }\n\n                        function scanTemplateElement(option) {\n                            var startsWith, template\n\n                            lookahead = null\n                            skipComment()\n\n                            startsWith = option.head ? \"`\" : \"}\"\n\n                            if (source[index] !== startsWith) {\n                                throwError({}, Messages.UnexpectedToken, \"ILLEGAL\")\n                            }\n\n                            template = scanTemplate()\n\n                            peek()\n\n                            return template\n                        }\n\n                        function testRegExp(pattern, flags) {\n                            var tmp = pattern,\n                                value\n\n                            if (flags.indexOf(\"u\") >= 0) {\n                                // Replace each astral symbol and every Unicode code point\n                                // escape sequence with a single ASCII symbol to avoid throwing on\n                                // regular expressions that are only valid in combination with the\n                                // `/u` flag.\n                                // Note: replacing with the ASCII symbol `x` might cause false\n                                // negatives in unlikely scenarios. For example, `[\\u{61}-b]` is a\n                                // perfectly valid pattern that is equivalent to `[a-b]`, but it\n                                // would be replaced by `[x-b]` which throws an error.\n                                tmp = tmp\n                                    .replace(/\\\\u\\{([0-9a-fA-F]+)\\}/g, function($0, $1) {\n                                        if (parseInt($1, 16) <= 0x10ffff) {\n                                            return \"x\"\n                                        }\n                                        throwError({}, Messages.InvalidRegExp)\n                                    })\n                                    .replace(/[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]/g, \"x\")\n                            }\n\n                            // First, detect invalid regular expressions.\n                            try {\n                                value = new RegExp(tmp)\n                            } catch (e) {\n                                throwError({}, Messages.InvalidRegExp)\n                            }\n\n                            // Return a regular expression object for this pattern-flag pair, or\n                            // `null` in case the current environment doesn't support the flags it\n                            // uses.\n                            try {\n                                return new RegExp(pattern, flags)\n                            } catch (exception) {\n                                return null\n                            }\n                        }\n\n                        function scanRegExpBody() {\n                            var ch, str, classMarker, terminated, body\n\n                            ch = source[index]\n                            assert(ch === \"/\", \"Regular expression literal must start with a slash\")\n                            str = source[index++]\n\n                            classMarker = false\n                            terminated = false\n                            while (index < length) {\n                                ch = source[index++]\n                                str += ch\n                                if (ch === \"\\\\\") {\n                                    ch = source[index++]\n                                    // ECMA-262 7.8.5\n                                    if (isLineTerminator(ch.charCodeAt(0))) {\n                                        throwError({}, Messages.UnterminatedRegExp)\n                                    }\n                                    str += ch\n                                } else if (isLineTerminator(ch.charCodeAt(0))) {\n                                    throwError({}, Messages.UnterminatedRegExp)\n                                } else if (classMarker) {\n                                    if (ch === \"]\") {\n                                        classMarker = false\n                                    }\n                                } else {\n                                    if (ch === \"/\") {\n                                        terminated = true\n                                        break\n                                    } else if (ch === \"[\") {\n                                        classMarker = true\n                                    }\n                                }\n                            }\n\n                            if (!terminated) {\n                                throwError({}, Messages.UnterminatedRegExp)\n                            }\n\n                            // Exclude leading and trailing slash.\n                            body = str.substr(1, str.length - 2)\n                            return {\n                                value: body,\n                                literal: str\n                            }\n                        }\n\n                        function scanRegExpFlags() {\n                            var ch, str, flags, restore\n\n                            str = \"\"\n                            flags = \"\"\n                            while (index < length) {\n                                ch = source[index]\n                                if (!isIdentifierPart(ch.charCodeAt(0))) {\n                                    break\n                                }\n\n                                ++index\n                                if (ch === \"\\\\\" && index < length) {\n                                    ch = source[index]\n                                    if (ch === \"u\") {\n                                        ++index\n                                        restore = index\n                                        ch = scanHexEscape(\"u\")\n                                        if (ch) {\n                                            flags += ch\n                                            for (str += \"\\\\u\"; restore < index; ++restore) {\n                                                str += source[restore]\n                                            }\n                                        } else {\n                                            index = restore\n                                            flags += \"u\"\n                                            str += \"\\\\u\"\n                                        }\n                                        throwErrorTolerant({}, Messages.UnexpectedToken, \"ILLEGAL\")\n                                    } else {\n                                        str += \"\\\\\"\n                                        throwErrorTolerant({}, Messages.UnexpectedToken, \"ILLEGAL\")\n                                    }\n                                } else {\n                                    flags += ch\n                                    str += ch\n                                }\n                            }\n\n                            return {\n                                value: flags,\n                                literal: str\n                            }\n                        }\n\n                        function scanRegExp() {\n                            var start, body, flags, value\n\n                            lookahead = null\n                            skipComment()\n                            start = index\n\n                            body = scanRegExpBody()\n                            flags = scanRegExpFlags()\n                            value = testRegExp(body.value, flags.value)\n\n                            if (extra.tokenize) {\n                                return {\n                                    type: Token.RegularExpression,\n                                    value: value,\n                                    regex: {\n                                        pattern: body.value,\n                                        flags: flags.value\n                                    },\n                                    lineNumber: lineNumber,\n                                    lineStart: lineStart,\n                                    range: [start, index]\n                                }\n                            }\n\n                            return {\n                                literal: body.literal + flags.literal,\n                                value: value,\n                                regex: {\n                                    pattern: body.value,\n                                    flags: flags.value\n                                },\n                                range: [start, index]\n                            }\n                        }\n\n                        function isIdentifierName(token) {\n                            return (\n                                token.type === Token.Identifier ||\n                                token.type === Token.Keyword ||\n                                token.type === Token.BooleanLiteral ||\n                                token.type === Token.NullLiteral\n                            )\n                        }\n\n                        function advanceSlash() {\n                            var prevToken, checkToken\n                            // Using the following algorithm:\n                            // https://github.com/mozilla/sweet.js/wiki/design\n                            prevToken = extra.tokens[extra.tokens.length - 1]\n                            if (!prevToken) {\n                                // Nothing before that: it cannot be a division.\n                                return scanRegExp()\n                            }\n                            if (prevToken.type === \"Punctuator\") {\n                                if (prevToken.value === \")\") {\n                                    checkToken = extra.tokens[extra.openParenToken - 1]\n                                    if (\n                                        checkToken &&\n                                        checkToken.type === \"Keyword\" &&\n                                        (checkToken.value === \"if\" ||\n                                            checkToken.value === \"while\" ||\n                                            checkToken.value === \"for\" ||\n                                            checkToken.value === \"with\")\n                                    ) {\n                                        return scanRegExp()\n                                    }\n                                    return scanPunctuator()\n                                }\n                                if (prevToken.value === \"}\") {\n                                    // Dividing a function by anything makes little sense,\n                                    // but we have to check for that.\n                                    if (\n                                        extra.tokens[extra.openCurlyToken - 3] &&\n                                        extra.tokens[extra.openCurlyToken - 3].type === \"Keyword\"\n                                    ) {\n                                        // Anonymous function.\n                                        checkToken = extra.tokens[extra.openCurlyToken - 4]\n                                        if (!checkToken) {\n                                            return scanPunctuator()\n                                        }\n                                    } else if (\n                                        extra.tokens[extra.openCurlyToken - 4] &&\n                                        extra.tokens[extra.openCurlyToken - 4].type === \"Keyword\"\n                                    ) {\n                                        // Named function.\n                                        checkToken = extra.tokens[extra.openCurlyToken - 5]\n                                        if (!checkToken) {\n                                            return scanRegExp()\n                                        }\n                                    } else {\n                                        return scanPunctuator()\n                                    }\n                                    // checkToken determines whether the function is\n                                    // a declaration or an expression.\n                                    if (FnExprTokens.indexOf(checkToken.value) >= 0) {\n                                        // It is an expression.\n                                        return scanPunctuator()\n                                    }\n                                    // It is a declaration.\n                                    return scanRegExp()\n                                }\n                                return scanRegExp()\n                            }\n                            if (prevToken.type === \"Keyword\" && prevToken.value !== \"this\") {\n                                return scanRegExp()\n                            }\n                            return scanPunctuator()\n                        }\n\n                        function advance() {\n                            var ch\n\n                            if (!state.inJSXChild) {\n                                skipComment()\n                            }\n\n                            if (index >= length) {\n                                return {\n                                    type: Token.EOF,\n                                    lineNumber: lineNumber,\n                                    lineStart: lineStart,\n                                    range: [index, index]\n                                }\n                            }\n\n                            if (state.inJSXChild) {\n                                return advanceJSXChild()\n                            }\n\n                            ch = source.charCodeAt(index)\n\n                            // Very common: ( and ) and ;\n                            if (ch === 40 || ch === 41 || ch === 58) {\n                                return scanPunctuator()\n                            }\n\n                            // String literal starts with single quote (#39) or double quote (#34).\n                            if (ch === 39 || ch === 34) {\n                                if (state.inJSXTag) {\n                                    return scanJSXStringLiteral()\n                                }\n                                return scanStringLiteral()\n                            }\n\n                            if (state.inJSXTag && isJSXIdentifierStart(ch)) {\n                                return scanJSXIdentifier()\n                            }\n\n                            if (ch === 96) {\n                                return scanTemplate()\n                            }\n                            if (isIdentifierStart(ch)) {\n                                return scanIdentifier()\n                            }\n\n                            // Dot (.) char #46 can also start a floating-point number, hence the need\n                            // to check the next character.\n                            if (ch === 46) {\n                                if (isDecimalDigit(source.charCodeAt(index + 1))) {\n                                    return scanNumericLiteral()\n                                }\n                                return scanPunctuator()\n                            }\n\n                            if (isDecimalDigit(ch)) {\n                                return scanNumericLiteral()\n                            }\n\n                            // Slash (/) char #47 can also start a regex.\n                            if (extra.tokenize && ch === 47) {\n                                return advanceSlash()\n                            }\n\n                            return scanPunctuator()\n                        }\n\n                        function lex() {\n                            var token\n\n                            token = lookahead\n                            index = token.range[1]\n                            lineNumber = token.lineNumber\n                            lineStart = token.lineStart\n\n                            lookahead = advance()\n\n                            index = token.range[1]\n                            lineNumber = token.lineNumber\n                            lineStart = token.lineStart\n\n                            return token\n                        }\n\n                        function peek() {\n                            var pos, line, start\n\n                            pos = index\n                            line = lineNumber\n                            start = lineStart\n                            lookahead = advance()\n                            index = pos\n                            lineNumber = line\n                            lineStart = start\n                        }\n\n                        function lookahead2() {\n                            var adv, pos, line, start, result\n\n                            // If we are collecting the tokens, don't grab the next one yet.\n                            /* istanbul ignore next */\n                            adv = typeof extra.advance === \"function\" ? extra.advance : advance\n\n                            pos = index\n                            line = lineNumber\n                            start = lineStart\n\n                            // Scan for the next immediate token.\n                            /* istanbul ignore if */\n                            if (lookahead === null) {\n                                lookahead = adv()\n                            }\n                            index = lookahead.range[1]\n                            lineNumber = lookahead.lineNumber\n                            lineStart = lookahead.lineStart\n\n                            // Grab the token right after.\n                            result = adv()\n                            index = pos\n                            lineNumber = line\n                            lineStart = start\n\n                            return result\n                        }\n\n                        function rewind(token) {\n                            index = token.range[0]\n                            lineNumber = token.lineNumber\n                            lineStart = token.lineStart\n                            lookahead = token\n                        }\n\n                        function markerCreate() {\n                            if (!extra.loc && !extra.range) {\n                                return undefined\n                            }\n                            skipComment()\n                            return { offset: index, line: lineNumber, col: index - lineStart }\n                        }\n\n                        function markerCreatePreserveWhitespace() {\n                            if (!extra.loc && !extra.range) {\n                                return undefined\n                            }\n                            return { offset: index, line: lineNumber, col: index - lineStart }\n                        }\n\n                        function processComment(node) {\n                            var lastChild,\n                                trailingComments,\n                                bottomRight = extra.bottomRightStack,\n                                last = bottomRight[bottomRight.length - 1]\n\n                            if (node.type === Syntax.Program) {\n                                /* istanbul ignore else */\n                                if (node.body.length > 0) {\n                                    return\n                                }\n                            }\n\n                            if (extra.trailingComments.length > 0) {\n                                if (extra.trailingComments[0].range[0] >= node.range[1]) {\n                                    trailingComments = extra.trailingComments\n                                    extra.trailingComments = []\n                                } else {\n                                    extra.trailingComments.length = 0\n                                }\n                            } else {\n                                if (\n                                    last &&\n                                    last.trailingComments &&\n                                    last.trailingComments[0].range[0] >= node.range[1]\n                                ) {\n                                    trailingComments = last.trailingComments\n                                    delete last.trailingComments\n                                }\n                            }\n\n                            // Eating the stack.\n                            if (last) {\n                                while (last && last.range[0] >= node.range[0]) {\n                                    lastChild = last\n                                    last = bottomRight.pop()\n                                }\n                            }\n\n                            if (lastChild) {\n                                if (\n                                    lastChild.leadingComments &&\n                                    lastChild.leadingComments[lastChild.leadingComments.length - 1]\n                                        .range[1] <= node.range[0]\n                                ) {\n                                    node.leadingComments = lastChild.leadingComments\n                                    delete lastChild.leadingComments\n                                }\n                            } else if (\n                                extra.leadingComments.length > 0 &&\n                                extra.leadingComments[extra.leadingComments.length - 1].range[1] <=\n                                    node.range[0]\n                            ) {\n                                node.leadingComments = extra.leadingComments\n                                extra.leadingComments = []\n                            }\n\n                            if (trailingComments) {\n                                node.trailingComments = trailingComments\n                            }\n\n                            bottomRight.push(node)\n                        }\n\n                        function markerApply(marker, node) {\n                            if (extra.range) {\n                                node.range = [marker.offset, index]\n                            }\n                            if (extra.loc) {\n                                node.loc = {\n                                    start: {\n                                        line: marker.line,\n                                        column: marker.col\n                                    },\n                                    end: {\n                                        line: lineNumber,\n                                        column: index - lineStart\n                                    }\n                                }\n                                node = delegate.postProcess(node)\n                            }\n                            if (extra.attachComment) {\n                                processComment(node)\n                            }\n                            return node\n                        }\n\n                        SyntaxTreeDelegate = {\n                            name: \"SyntaxTree\",\n\n                            postProcess: function(node) {\n                                return node\n                            },\n\n                            createArrayExpression: function(elements) {\n                                return {\n                                    type: Syntax.ArrayExpression,\n                                    elements: elements\n                                }\n                            },\n\n                            createAssignmentExpression: function(operator, left, right) {\n                                return {\n                                    type: Syntax.AssignmentExpression,\n                                    operator: operator,\n                                    left: left,\n                                    right: right\n                                }\n                            },\n\n                            createBinaryExpression: function(operator, left, right) {\n                                var type =\n                                    operator === \"||\" || operator === \"&&\"\n                                        ? Syntax.LogicalExpression\n                                        : Syntax.BinaryExpression\n                                return {\n                                    type: type,\n                                    operator: operator,\n                                    left: left,\n                                    right: right\n                                }\n                            },\n\n                            createBlockStatement: function(body) {\n                                return {\n                                    type: Syntax.BlockStatement,\n                                    body: body\n                                }\n                            },\n\n                            createBreakStatement: function(label) {\n                                return {\n                                    type: Syntax.BreakStatement,\n                                    label: label\n                                }\n                            },\n\n                            createCallExpression: function(callee, args) {\n                                return {\n                                    type: Syntax.CallExpression,\n                                    callee: callee,\n                                    arguments: args\n                                }\n                            },\n\n                            createCatchClause: function(param, body) {\n                                return {\n                                    type: Syntax.CatchClause,\n                                    param: param,\n                                    body: body\n                                }\n                            },\n\n                            createConditionalExpression: function(test, consequent, alternate) {\n                                return {\n                                    type: Syntax.ConditionalExpression,\n                                    test: test,\n                                    consequent: consequent,\n                                    alternate: alternate\n                                }\n                            },\n\n                            createContinueStatement: function(label) {\n                                return {\n                                    type: Syntax.ContinueStatement,\n                                    label: label\n                                }\n                            },\n\n                            createDebuggerStatement: function() {\n                                return {\n                                    type: Syntax.DebuggerStatement\n                                }\n                            },\n\n                            createDoWhileStatement: function(body, test) {\n                                return {\n                                    type: Syntax.DoWhileStatement,\n                                    body: body,\n                                    test: test\n                                }\n                            },\n\n                            createEmptyStatement: function() {\n                                return {\n                                    type: Syntax.EmptyStatement\n                                }\n                            },\n\n                            createExpressionStatement: function(expression) {\n                                return {\n                                    type: Syntax.ExpressionStatement,\n                                    expression: expression\n                                }\n                            },\n\n                            createForStatement: function(init, test, update, body) {\n                                return {\n                                    type: Syntax.ForStatement,\n                                    init: init,\n                                    test: test,\n                                    update: update,\n                                    body: body\n                                }\n                            },\n\n                            createForInStatement: function(left, right, body) {\n                                return {\n                                    type: Syntax.ForInStatement,\n                                    left: left,\n                                    right: right,\n                                    body: body,\n                                    each: false\n                                }\n                            },\n\n                            createForOfStatement: function(left, right, body) {\n                                return {\n                                    type: Syntax.ForOfStatement,\n                                    left: left,\n                                    right: right,\n                                    body: body\n                                }\n                            },\n\n                            createFunctionDeclaration: function(\n                                id,\n                                params,\n                                defaults,\n                                body,\n                                rest,\n                                generator,\n                                expression,\n                                isAsync,\n                                returnType,\n                                typeParameters\n                            ) {\n                                var funDecl = {\n                                    type: Syntax.FunctionDeclaration,\n                                    id: id,\n                                    params: params,\n                                    defaults: defaults,\n                                    body: body,\n                                    rest: rest,\n                                    generator: generator,\n                                    expression: expression,\n                                    returnType: returnType,\n                                    typeParameters: typeParameters\n                                }\n\n                                if (isAsync) {\n                                    funDecl.async = true\n                                }\n\n                                return funDecl\n                            },\n\n                            createFunctionExpression: function(\n                                id,\n                                params,\n                                defaults,\n                                body,\n                                rest,\n                                generator,\n                                expression,\n                                isAsync,\n                                returnType,\n                                typeParameters\n                            ) {\n                                var funExpr = {\n                                    type: Syntax.FunctionExpression,\n                                    id: id,\n                                    params: params,\n                                    defaults: defaults,\n                                    body: body,\n                                    rest: rest,\n                                    generator: generator,\n                                    expression: expression,\n                                    returnType: returnType,\n                                    typeParameters: typeParameters\n                                }\n\n                                if (isAsync) {\n                                    funExpr.async = true\n                                }\n\n                                return funExpr\n                            },\n\n                            createIdentifier: function(name) {\n                                return {\n                                    type: Syntax.Identifier,\n                                    name: name,\n                                    // Only here to initialize the shape of the object to ensure\n                                    // that the 'typeAnnotation' key is ordered before others that\n                                    // are added later (like 'loc' and 'range'). This just helps\n                                    // keep the shape of Identifier nodes consistent with everything\n                                    // else.\n                                    typeAnnotation: undefined,\n                                    optional: undefined\n                                }\n                            },\n\n                            createTypeAnnotation: function(typeAnnotation) {\n                                return {\n                                    type: Syntax.TypeAnnotation,\n                                    typeAnnotation: typeAnnotation\n                                }\n                            },\n\n                            createTypeCast: function(expression, typeAnnotation) {\n                                return {\n                                    type: Syntax.TypeCastExpression,\n                                    expression: expression,\n                                    typeAnnotation: typeAnnotation\n                                }\n                            },\n\n                            createFunctionTypeAnnotation: function(\n                                params,\n                                returnType,\n                                rest,\n                                typeParameters\n                            ) {\n                                return {\n                                    type: Syntax.FunctionTypeAnnotation,\n                                    params: params,\n                                    returnType: returnType,\n                                    rest: rest,\n                                    typeParameters: typeParameters\n                                }\n                            },\n\n                            createFunctionTypeParam: function(name, typeAnnotation, optional) {\n                                return {\n                                    type: Syntax.FunctionTypeParam,\n                                    name: name,\n                                    typeAnnotation: typeAnnotation,\n                                    optional: optional\n                                }\n                            },\n\n                            createNullableTypeAnnotation: function(typeAnnotation) {\n                                return {\n                                    type: Syntax.NullableTypeAnnotation,\n                                    typeAnnotation: typeAnnotation\n                                }\n                            },\n\n                            createArrayTypeAnnotation: function(elementType) {\n                                return {\n                                    type: Syntax.ArrayTypeAnnotation,\n                                    elementType: elementType\n                                }\n                            },\n\n                            createGenericTypeAnnotation: function(id, typeParameters) {\n                                return {\n                                    type: Syntax.GenericTypeAnnotation,\n                                    id: id,\n                                    typeParameters: typeParameters\n                                }\n                            },\n\n                            createQualifiedTypeIdentifier: function(qualification, id) {\n                                return {\n                                    type: Syntax.QualifiedTypeIdentifier,\n                                    qualification: qualification,\n                                    id: id\n                                }\n                            },\n\n                            createTypeParameterDeclaration: function(params) {\n                                return {\n                                    type: Syntax.TypeParameterDeclaration,\n                                    params: params\n                                }\n                            },\n\n                            createTypeParameterInstantiation: function(params) {\n                                return {\n                                    type: Syntax.TypeParameterInstantiation,\n                                    params: params\n                                }\n                            },\n\n                            createAnyTypeAnnotation: function() {\n                                return {\n                                    type: Syntax.AnyTypeAnnotation\n                                }\n                            },\n\n                            createBooleanTypeAnnotation: function() {\n                                return {\n                                    type: Syntax.BooleanTypeAnnotation\n                                }\n                            },\n\n                            createNumberTypeAnnotation: function() {\n                                return {\n                                    type: Syntax.NumberTypeAnnotation\n                                }\n                            },\n\n                            createStringTypeAnnotation: function() {\n                                return {\n                                    type: Syntax.StringTypeAnnotation\n                                }\n                            },\n\n                            createStringLiteralTypeAnnotation: function(token) {\n                                return {\n                                    type: Syntax.StringLiteralTypeAnnotation,\n                                    value: token.value,\n                                    raw: source.slice(token.range[0], token.range[1])\n                                }\n                            },\n\n                            createVoidTypeAnnotation: function() {\n                                return {\n                                    type: Syntax.VoidTypeAnnotation\n                                }\n                            },\n\n                            createTypeofTypeAnnotation: function(argument) {\n                                return {\n                                    type: Syntax.TypeofTypeAnnotation,\n                                    argument: argument\n                                }\n                            },\n\n                            createTupleTypeAnnotation: function(types) {\n                                return {\n                                    type: Syntax.TupleTypeAnnotation,\n                                    types: types\n                                }\n                            },\n\n                            createObjectTypeAnnotation: function(\n                                properties,\n                                indexers,\n                                callProperties\n                            ) {\n                                return {\n                                    type: Syntax.ObjectTypeAnnotation,\n                                    properties: properties,\n                                    indexers: indexers,\n                                    callProperties: callProperties\n                                }\n                            },\n\n                            createObjectTypeIndexer: function(id, key, value, isStatic) {\n                                return {\n                                    type: Syntax.ObjectTypeIndexer,\n                                    id: id,\n                                    key: key,\n                                    value: value,\n                                    static: isStatic\n                                }\n                            },\n\n                            createObjectTypeCallProperty: function(value, isStatic) {\n                                return {\n                                    type: Syntax.ObjectTypeCallProperty,\n                                    value: value,\n                                    static: isStatic\n                                }\n                            },\n\n                            createObjectTypeProperty: function(key, value, optional, isStatic) {\n                                return {\n                                    type: Syntax.ObjectTypeProperty,\n                                    key: key,\n                                    value: value,\n                                    optional: optional,\n                                    static: isStatic\n                                }\n                            },\n\n                            createUnionTypeAnnotation: function(types) {\n                                return {\n                                    type: Syntax.UnionTypeAnnotation,\n                                    types: types\n                                }\n                            },\n\n                            createIntersectionTypeAnnotation: function(types) {\n                                return {\n                                    type: Syntax.IntersectionTypeAnnotation,\n                                    types: types\n                                }\n                            },\n\n                            createTypeAlias: function(id, typeParameters, right) {\n                                return {\n                                    type: Syntax.TypeAlias,\n                                    id: id,\n                                    typeParameters: typeParameters,\n                                    right: right\n                                }\n                            },\n\n                            createInterface: function(id, typeParameters, body, extended) {\n                                return {\n                                    type: Syntax.InterfaceDeclaration,\n                                    id: id,\n                                    typeParameters: typeParameters,\n                                    body: body,\n                                    extends: extended\n                                }\n                            },\n\n                            createInterfaceExtends: function(id, typeParameters) {\n                                return {\n                                    type: Syntax.InterfaceExtends,\n                                    id: id,\n                                    typeParameters: typeParameters\n                                }\n                            },\n\n                            createDeclareFunction: function(id) {\n                                return {\n                                    type: Syntax.DeclareFunction,\n                                    id: id\n                                }\n                            },\n\n                            createDeclareVariable: function(id) {\n                                return {\n                                    type: Syntax.DeclareVariable,\n                                    id: id\n                                }\n                            },\n\n                            createDeclareModule: function(id, body) {\n                                return {\n                                    type: Syntax.DeclareModule,\n                                    id: id,\n                                    body: body\n                                }\n                            },\n\n                            createJSXAttribute: function(name, value) {\n                                return {\n                                    type: Syntax.JSXAttribute,\n                                    name: name,\n                                    value: value || null\n                                }\n                            },\n\n                            createJSXSpreadAttribute: function(argument) {\n                                return {\n                                    type: Syntax.JSXSpreadAttribute,\n                                    argument: argument\n                                }\n                            },\n\n                            createJSXIdentifier: function(name) {\n                                return {\n                                    type: Syntax.JSXIdentifier,\n                                    name: name\n                                }\n                            },\n\n                            createJSXNamespacedName: function(namespace, name) {\n                                return {\n                                    type: Syntax.JSXNamespacedName,\n                                    namespace: namespace,\n                                    name: name\n                                }\n                            },\n\n                            createJSXMemberExpression: function(object, property) {\n                                return {\n                                    type: Syntax.JSXMemberExpression,\n                                    object: object,\n                                    property: property\n                                }\n                            },\n\n                            createJSXElement: function(openingElement, closingElement, children) {\n                                return {\n                                    type: Syntax.JSXElement,\n                                    openingElement: openingElement,\n                                    closingElement: closingElement,\n                                    children: children\n                                }\n                            },\n\n                            createJSXEmptyExpression: function() {\n                                return {\n                                    type: Syntax.JSXEmptyExpression\n                                }\n                            },\n\n                            createJSXExpressionContainer: function(expression) {\n                                return {\n                                    type: Syntax.JSXExpressionContainer,\n                                    expression: expression\n                                }\n                            },\n\n                            createJSXOpeningElement: function(name, attributes, selfClosing) {\n                                return {\n                                    type: Syntax.JSXOpeningElement,\n                                    name: name,\n                                    selfClosing: selfClosing,\n                                    attributes: attributes\n                                }\n                            },\n\n                            createJSXClosingElement: function(name) {\n                                return {\n                                    type: Syntax.JSXClosingElement,\n                                    name: name\n                                }\n                            },\n\n                            createIfStatement: function(test, consequent, alternate) {\n                                return {\n                                    type: Syntax.IfStatement,\n                                    test: test,\n                                    consequent: consequent,\n                                    alternate: alternate\n                                }\n                            },\n\n                            createLabeledStatement: function(label, body) {\n                                return {\n                                    type: Syntax.LabeledStatement,\n                                    label: label,\n                                    body: body\n                                }\n                            },\n\n                            createLiteral: function(token) {\n                                var object = {\n                                    type: Syntax.Literal,\n                                    value: token.value,\n                                    raw: source.slice(token.range[0], token.range[1])\n                                }\n                                if (token.regex) {\n                                    object.regex = token.regex\n                                }\n                                return object\n                            },\n\n                            createMemberExpression: function(accessor, object, property) {\n                                return {\n                                    type: Syntax.MemberExpression,\n                                    computed: accessor === \"[\",\n                                    object: object,\n                                    property: property\n                                }\n                            },\n\n                            createNewExpression: function(callee, args) {\n                                return {\n                                    type: Syntax.NewExpression,\n                                    callee: callee,\n                                    arguments: args\n                                }\n                            },\n\n                            createObjectExpression: function(properties) {\n                                return {\n                                    type: Syntax.ObjectExpression,\n                                    properties: properties\n                                }\n                            },\n\n                            createPostfixExpression: function(operator, argument) {\n                                return {\n                                    type: Syntax.UpdateExpression,\n                                    operator: operator,\n                                    argument: argument,\n                                    prefix: false\n                                }\n                            },\n\n                            createProgram: function(body) {\n                                return {\n                                    type: Syntax.Program,\n                                    body: body\n                                }\n                            },\n\n                            createProperty: function(\n                                kind,\n                                key,\n                                value,\n                                method,\n                                shorthand,\n                                computed\n                            ) {\n                                return {\n                                    type: Syntax.Property,\n                                    key: key,\n                                    value: value,\n                                    kind: kind,\n                                    method: method,\n                                    shorthand: shorthand,\n                                    computed: computed\n                                }\n                            },\n\n                            createReturnStatement: function(argument) {\n                                return {\n                                    type: Syntax.ReturnStatement,\n                                    argument: argument\n                                }\n                            },\n\n                            createSequenceExpression: function(expressions) {\n                                return {\n                                    type: Syntax.SequenceExpression,\n                                    expressions: expressions\n                                }\n                            },\n\n                            createSwitchCase: function(test, consequent) {\n                                return {\n                                    type: Syntax.SwitchCase,\n                                    test: test,\n                                    consequent: consequent\n                                }\n                            },\n\n                            createSwitchStatement: function(discriminant, cases) {\n                                return {\n                                    type: Syntax.SwitchStatement,\n                                    discriminant: discriminant,\n                                    cases: cases\n                                }\n                            },\n\n                            createThisExpression: function() {\n                                return {\n                                    type: Syntax.ThisExpression\n                                }\n                            },\n\n                            createThrowStatement: function(argument) {\n                                return {\n                                    type: Syntax.ThrowStatement,\n                                    argument: argument\n                                }\n                            },\n\n                            createTryStatement: function(\n                                block,\n                                guardedHandlers,\n                                handlers,\n                                finalizer\n                            ) {\n                                return {\n                                    type: Syntax.TryStatement,\n                                    block: block,\n                                    guardedHandlers: guardedHandlers,\n                                    handlers: handlers,\n                                    finalizer: finalizer\n                                }\n                            },\n\n                            createUnaryExpression: function(operator, argument) {\n                                if (operator === \"++\" || operator === \"--\") {\n                                    return {\n                                        type: Syntax.UpdateExpression,\n                                        operator: operator,\n                                        argument: argument,\n                                        prefix: true\n                                    }\n                                }\n                                return {\n                                    type: Syntax.UnaryExpression,\n                                    operator: operator,\n                                    argument: argument,\n                                    prefix: true\n                                }\n                            },\n\n                            createVariableDeclaration: function(declarations, kind) {\n                                return {\n                                    type: Syntax.VariableDeclaration,\n                                    declarations: declarations,\n                                    kind: kind\n                                }\n                            },\n\n                            createVariableDeclarator: function(id, init) {\n                                return {\n                                    type: Syntax.VariableDeclarator,\n                                    id: id,\n                                    init: init\n                                }\n                            },\n\n                            createWhileStatement: function(test, body) {\n                                return {\n                                    type: Syntax.WhileStatement,\n                                    test: test,\n                                    body: body\n                                }\n                            },\n\n                            createWithStatement: function(object, body) {\n                                return {\n                                    type: Syntax.WithStatement,\n                                    object: object,\n                                    body: body\n                                }\n                            },\n\n                            createTemplateElement: function(value, tail) {\n                                return {\n                                    type: Syntax.TemplateElement,\n                                    value: value,\n                                    tail: tail\n                                }\n                            },\n\n                            createTemplateLiteral: function(quasis, expressions) {\n                                return {\n                                    type: Syntax.TemplateLiteral,\n                                    quasis: quasis,\n                                    expressions: expressions\n                                }\n                            },\n\n                            createSpreadElement: function(argument) {\n                                return {\n                                    type: Syntax.SpreadElement,\n                                    argument: argument\n                                }\n                            },\n\n                            createSpreadProperty: function(argument) {\n                                return {\n                                    type: Syntax.SpreadProperty,\n                                    argument: argument\n                                }\n                            },\n\n                            createTaggedTemplateExpression: function(tag, quasi) {\n                                return {\n                                    type: Syntax.TaggedTemplateExpression,\n                                    tag: tag,\n                                    quasi: quasi\n                                }\n                            },\n\n                            createArrowFunctionExpression: function(\n                                params,\n                                defaults,\n                                body,\n                                rest,\n                                expression,\n                                isAsync\n                            ) {\n                                var arrowExpr = {\n                                    type: Syntax.ArrowFunctionExpression,\n                                    id: null,\n                                    params: params,\n                                    defaults: defaults,\n                                    body: body,\n                                    rest: rest,\n                                    generator: false,\n                                    expression: expression\n                                }\n\n                                if (isAsync) {\n                                    arrowExpr.async = true\n                                }\n\n                                return arrowExpr\n                            },\n\n                            createMethodDefinition: function(\n                                propertyType,\n                                kind,\n                                key,\n                                value,\n                                computed\n                            ) {\n                                return {\n                                    type: Syntax.MethodDefinition,\n                                    key: key,\n                                    value: value,\n                                    kind: kind,\n                                    static: propertyType === ClassPropertyType[\"static\"],\n                                    computed: computed\n                                }\n                            },\n\n                            createClassProperty: function(key, typeAnnotation, computed, isStatic) {\n                                return {\n                                    type: Syntax.ClassProperty,\n                                    key: key,\n                                    typeAnnotation: typeAnnotation,\n                                    computed: computed,\n                                    static: isStatic\n                                }\n                            },\n\n                            createClassBody: function(body) {\n                                return {\n                                    type: Syntax.ClassBody,\n                                    body: body\n                                }\n                            },\n\n                            createClassImplements: function(id, typeParameters) {\n                                return {\n                                    type: Syntax.ClassImplements,\n                                    id: id,\n                                    typeParameters: typeParameters\n                                }\n                            },\n\n                            createClassExpression: function(\n                                id,\n                                superClass,\n                                body,\n                                typeParameters,\n                                superTypeParameters,\n                                implemented\n                            ) {\n                                return {\n                                    type: Syntax.ClassExpression,\n                                    id: id,\n                                    superClass: superClass,\n                                    body: body,\n                                    typeParameters: typeParameters,\n                                    superTypeParameters: superTypeParameters,\n                                    implements: implemented\n                                }\n                            },\n\n                            createClassDeclaration: function(\n                                id,\n                                superClass,\n                                body,\n                                typeParameters,\n                                superTypeParameters,\n                                implemented\n                            ) {\n                                return {\n                                    type: Syntax.ClassDeclaration,\n                                    id: id,\n                                    superClass: superClass,\n                                    body: body,\n                                    typeParameters: typeParameters,\n                                    superTypeParameters: superTypeParameters,\n                                    implements: implemented\n                                }\n                            },\n\n                            createModuleSpecifier: function(token) {\n                                return {\n                                    type: Syntax.ModuleSpecifier,\n                                    value: token.value,\n                                    raw: source.slice(token.range[0], token.range[1])\n                                }\n                            },\n\n                            createExportSpecifier: function(id, name) {\n                                return {\n                                    type: Syntax.ExportSpecifier,\n                                    id: id,\n                                    name: name\n                                }\n                            },\n\n                            createExportBatchSpecifier: function() {\n                                return {\n                                    type: Syntax.ExportBatchSpecifier\n                                }\n                            },\n\n                            createImportDefaultSpecifier: function(id) {\n                                return {\n                                    type: Syntax.ImportDefaultSpecifier,\n                                    id: id\n                                }\n                            },\n\n                            createImportNamespaceSpecifier: function(id) {\n                                return {\n                                    type: Syntax.ImportNamespaceSpecifier,\n                                    id: id\n                                }\n                            },\n\n                            createExportDeclaration: function(\n                                isDefault,\n                                declaration,\n                                specifiers,\n                                src\n                            ) {\n                                return {\n                                    type: Syntax.ExportDeclaration,\n                                    default: !!isDefault,\n                                    declaration: declaration,\n                                    specifiers: specifiers,\n                                    source: src\n                                }\n                            },\n\n                            createImportSpecifier: function(id, name) {\n                                return {\n                                    type: Syntax.ImportSpecifier,\n                                    id: id,\n                                    name: name\n                                }\n                            },\n\n                            createImportDeclaration: function(specifiers, src, isType) {\n                                return {\n                                    type: Syntax.ImportDeclaration,\n                                    specifiers: specifiers,\n                                    source: src,\n                                    isType: isType\n                                }\n                            },\n\n                            createYieldExpression: function(argument, dlg) {\n                                return {\n                                    type: Syntax.YieldExpression,\n                                    argument: argument,\n                                    delegate: dlg\n                                }\n                            },\n\n                            createAwaitExpression: function(argument) {\n                                return {\n                                    type: Syntax.AwaitExpression,\n                                    argument: argument\n                                }\n                            },\n\n                            createComprehensionExpression: function(filter, blocks, body) {\n                                return {\n                                    type: Syntax.ComprehensionExpression,\n                                    filter: filter,\n                                    blocks: blocks,\n                                    body: body\n                                }\n                            }\n                        }\n\n                        // Return true if there is a line terminator before the next token.\n\n                        function peekLineTerminator() {\n                            var pos, line, start, found\n\n                            pos = index\n                            line = lineNumber\n                            start = lineStart\n                            skipComment()\n                            found = lineNumber !== line\n                            index = pos\n                            lineNumber = line\n                            lineStart = start\n\n                            return found\n                        }\n\n                        // Throw an exception\n\n                        function throwError(token, messageFormat) {\n                            var error,\n                                args = Array.prototype.slice.call(arguments, 2),\n                                msg = messageFormat.replace(/%(\\d)/g, function(whole, idx) {\n                                    assert(idx < args.length, \"Message reference must be in range\")\n                                    return args[idx]\n                                })\n\n                            if (typeof token.lineNumber === \"number\") {\n                                error = new Error(\"Line \" + token.lineNumber + \": \" + msg)\n                                error.index = token.range[0]\n                                error.lineNumber = token.lineNumber\n                                error.column = token.range[0] - lineStart + 1\n                            } else {\n                                error = new Error(\"Line \" + lineNumber + \": \" + msg)\n                                error.index = index\n                                error.lineNumber = lineNumber\n                                error.column = index - lineStart + 1\n                            }\n\n                            error.description = msg\n                            throw error\n                        }\n\n                        function throwErrorTolerant() {\n                            try {\n                                throwError.apply(null, arguments)\n                            } catch (e) {\n                                if (extra.errors) {\n                                    extra.errors.push(e)\n                                } else {\n                                    throw e\n                                }\n                            }\n                        }\n\n                        // Throw an exception because of the token.\n\n                        function throwUnexpected(token) {\n                            if (token.type === Token.EOF) {\n                                throwError(token, Messages.UnexpectedEOS)\n                            }\n\n                            if (token.type === Token.NumericLiteral) {\n                                throwError(token, Messages.UnexpectedNumber)\n                            }\n\n                            if (\n                                token.type === Token.StringLiteral ||\n                                token.type === Token.JSXText\n                            ) {\n                                throwError(token, Messages.UnexpectedString)\n                            }\n\n                            if (token.type === Token.Identifier) {\n                                throwError(token, Messages.UnexpectedIdentifier)\n                            }\n\n                            if (token.type === Token.Keyword) {\n                                if (isFutureReservedWord(token.value)) {\n                                    throwError(token, Messages.UnexpectedReserved)\n                                } else if (strict && isStrictModeReservedWord(token.value)) {\n                                    throwErrorTolerant(token, Messages.StrictReservedWord)\n                                    return\n                                }\n                                throwError(token, Messages.UnexpectedToken, token.value)\n                            }\n\n                            if (token.type === Token.Template) {\n                                throwError(token, Messages.UnexpectedTemplate, token.value.raw)\n                            }\n\n                            // BooleanLiteral, NullLiteral, or Punctuator.\n                            throwError(token, Messages.UnexpectedToken, token.value)\n                        }\n\n                        // Expect the next token to match the specified punctuator.\n                        // If not, an exception will be thrown.\n\n                        function expect(value) {\n                            var token = lex()\n                            if (token.type !== Token.Punctuator || token.value !== value) {\n                                throwUnexpected(token)\n                            }\n                        }\n\n                        // Expect the next token to match the specified keyword.\n                        // If not, an exception will be thrown.\n\n                        function expectKeyword(keyword, contextual) {\n                            var token = lex()\n                            if (\n                                token.type !== (contextual ? Token.Identifier : Token.Keyword) ||\n                                token.value !== keyword\n                            ) {\n                                throwUnexpected(token)\n                            }\n                        }\n\n                        // Expect the next token to match the specified contextual keyword.\n                        // If not, an exception will be thrown.\n\n                        function expectContextualKeyword(keyword) {\n                            return expectKeyword(keyword, true)\n                        }\n\n                        // Return true if the next token matches the specified punctuator.\n\n                        function match(value) {\n                            return lookahead.type === Token.Punctuator && lookahead.value === value\n                        }\n\n                        // Return true if the next token matches the specified keyword\n\n                        function matchKeyword(keyword, contextual) {\n                            var expectedType = contextual ? Token.Identifier : Token.Keyword\n                            return lookahead.type === expectedType && lookahead.value === keyword\n                        }\n\n                        // Return true if the next token matches the specified contextual keyword\n\n                        function matchContextualKeyword(keyword) {\n                            return matchKeyword(keyword, true)\n                        }\n\n                        // Return true if the next token is an assignment operator\n\n                        function matchAssign() {\n                            var op\n\n                            if (lookahead.type !== Token.Punctuator) {\n                                return false\n                            }\n                            op = lookahead.value\n                            return (\n                                op === \"=\" ||\n                                op === \"*=\" ||\n                                op === \"/=\" ||\n                                op === \"%=\" ||\n                                op === \"+=\" ||\n                                op === \"-=\" ||\n                                op === \"<<=\" ||\n                                op === \">>=\" ||\n                                op === \">>>=\" ||\n                                op === \"&=\" ||\n                                op === \"^=\" ||\n                                op === \"|=\"\n                            )\n                        }\n\n                        // Note that 'yield' is treated as a keyword in strict mode, but a\n                        // contextual keyword (identifier) in non-strict mode, so we need to\n                        // use matchKeyword('yield', false) and matchKeyword('yield', true)\n                        // (i.e. matchContextualKeyword) appropriately.\n                        function matchYield() {\n                            return state.yieldAllowed && matchKeyword(\"yield\", !strict)\n                        }\n\n                        function matchAsync() {\n                            var backtrackToken = lookahead,\n                                matches = false\n\n                            if (matchContextualKeyword(\"async\")) {\n                                lex() // Make sure peekLineTerminator() starts after 'async'.\n                                matches = !peekLineTerminator()\n                                rewind(backtrackToken) // Revert the lex().\n                            }\n\n                            return matches\n                        }\n\n                        function matchAwait() {\n                            return state.awaitAllowed && matchContextualKeyword(\"await\")\n                        }\n\n                        function consumeSemicolon() {\n                            var line,\n                                oldIndex = index,\n                                oldLineNumber = lineNumber,\n                                oldLineStart = lineStart,\n                                oldLookahead = lookahead\n\n                            // Catch the very common case first: immediately a semicolon (char #59).\n                            if (source.charCodeAt(index) === 59) {\n                                lex()\n                                return\n                            }\n\n                            line = lineNumber\n                            skipComment()\n                            if (lineNumber !== line) {\n                                index = oldIndex\n                                lineNumber = oldLineNumber\n                                lineStart = oldLineStart\n                                lookahead = oldLookahead\n                                return\n                            }\n\n                            if (match(\";\")) {\n                                lex()\n                                return\n                            }\n\n                            if (lookahead.type !== Token.EOF && !match(\"}\")) {\n                                throwUnexpected(lookahead)\n                            }\n                        }\n\n                        // Return true if provided expression is LeftHandSideExpression\n\n                        function isLeftHandSide(expr) {\n                            return (\n                                expr.type === Syntax.Identifier ||\n                                expr.type === Syntax.MemberExpression\n                            )\n                        }\n\n                        function isAssignableLeftHandSide(expr) {\n                            return (\n                                isLeftHandSide(expr) ||\n                                expr.type === Syntax.ObjectPattern ||\n                                expr.type === Syntax.ArrayPattern\n                            )\n                        }\n\n                        // 11.1.4 Array Initialiser\n\n                        function parseArrayInitialiser() {\n                            var elements = [],\n                                blocks = [],\n                                filter = null,\n                                tmp,\n                                possiblecomprehension = true,\n                                marker = markerCreate()\n\n                            expect(\"[\")\n                            while (!match(\"]\")) {\n                                if (lookahead.value === \"for\" && lookahead.type === Token.Keyword) {\n                                    if (!possiblecomprehension) {\n                                        throwError({}, Messages.ComprehensionError)\n                                    }\n                                    matchKeyword(\"for\")\n                                    tmp = parseForStatement({ ignoreBody: true })\n                                    tmp.of = tmp.type === Syntax.ForOfStatement\n                                    tmp.type = Syntax.ComprehensionBlock\n                                    if (tmp.left.kind) {\n                                        // can't be let or const\n                                        throwError({}, Messages.ComprehensionError)\n                                    }\n                                    blocks.push(tmp)\n                                } else if (\n                                    lookahead.value === \"if\" &&\n                                    lookahead.type === Token.Keyword\n                                ) {\n                                    if (!possiblecomprehension) {\n                                        throwError({}, Messages.ComprehensionError)\n                                    }\n                                    expectKeyword(\"if\")\n                                    expect(\"(\")\n                                    filter = parseExpression()\n                                    expect(\")\")\n                                } else if (\n                                    lookahead.value === \",\" &&\n                                    lookahead.type === Token.Punctuator\n                                ) {\n                                    possiblecomprehension = false // no longer allowed.\n                                    lex()\n                                    elements.push(null)\n                                } else {\n                                    tmp = parseSpreadOrAssignmentExpression()\n                                    elements.push(tmp)\n                                    if (tmp && tmp.type === Syntax.SpreadElement) {\n                                        if (!match(\"]\")) {\n                                            throwError({}, Messages.ElementAfterSpreadElement)\n                                        }\n                                    } else if (\n                                        !(match(\"]\") || matchKeyword(\"for\") || matchKeyword(\"if\"))\n                                    ) {\n                                        expect(\",\") // this lexes.\n                                        possiblecomprehension = false\n                                    }\n                                }\n                            }\n\n                            expect(\"]\")\n\n                            if (filter && !blocks.length) {\n                                throwError({}, Messages.ComprehensionRequiresBlock)\n                            }\n\n                            if (blocks.length) {\n                                if (elements.length !== 1) {\n                                    throwError({}, Messages.ComprehensionError)\n                                }\n                                return markerApply(\n                                    marker,\n                                    delegate.createComprehensionExpression(\n                                        filter,\n                                        blocks,\n                                        elements[0]\n                                    )\n                                )\n                            }\n                            return markerApply(marker, delegate.createArrayExpression(elements))\n                        }\n\n                        // 11.1.5 Object Initialiser\n\n                        function parsePropertyFunction(options) {\n                            var previousStrict,\n                                previousYieldAllowed,\n                                previousAwaitAllowed,\n                                params,\n                                defaults,\n                                body,\n                                marker = markerCreate()\n\n                            previousStrict = strict\n                            previousYieldAllowed = state.yieldAllowed\n                            state.yieldAllowed = options.generator\n                            previousAwaitAllowed = state.awaitAllowed\n                            state.awaitAllowed = options.async\n                            params = options.params || []\n                            defaults = options.defaults || []\n\n                            body = parseConciseBody()\n                            if (options.name && strict && isRestrictedWord(params[0].name)) {\n                                throwErrorTolerant(options.name, Messages.StrictParamName)\n                            }\n                            strict = previousStrict\n                            state.yieldAllowed = previousYieldAllowed\n                            state.awaitAllowed = previousAwaitAllowed\n\n                            return markerApply(\n                                marker,\n                                delegate.createFunctionExpression(\n                                    null,\n                                    params,\n                                    defaults,\n                                    body,\n                                    options.rest || null,\n                                    options.generator,\n                                    body.type !== Syntax.BlockStatement,\n                                    options.async,\n                                    options.returnType,\n                                    options.typeParameters\n                                )\n                            )\n                        }\n\n                        function parsePropertyMethodFunction(options) {\n                            var previousStrict, tmp, method\n\n                            previousStrict = strict\n                            strict = true\n\n                            tmp = parseParams()\n\n                            if (tmp.stricted) {\n                                throwErrorTolerant(tmp.stricted, tmp.message)\n                            }\n\n                            method = parsePropertyFunction({\n                                params: tmp.params,\n                                defaults: tmp.defaults,\n                                rest: tmp.rest,\n                                generator: options.generator,\n                                async: options.async,\n                                returnType: tmp.returnType,\n                                typeParameters: options.typeParameters\n                            })\n\n                            strict = previousStrict\n\n                            return method\n                        }\n\n                        function parseObjectPropertyKey() {\n                            var marker = markerCreate(),\n                                token = lex(),\n                                propertyKey,\n                                result\n\n                            // Note: This function is called only from parseObjectProperty(), where\n                            // EOF and Punctuator tokens are already filtered out.\n\n                            if (\n                                token.type === Token.StringLiteral ||\n                                token.type === Token.NumericLiteral\n                            ) {\n                                if (strict && token.octal) {\n                                    throwErrorTolerant(token, Messages.StrictOctalLiteral)\n                                }\n                                return markerApply(marker, delegate.createLiteral(token))\n                            }\n\n                            if (token.type === Token.Punctuator && token.value === \"[\") {\n                                // For computed properties we should skip the [ and ], and\n                                // capture in marker only the assignment expression itself.\n                                marker = markerCreate()\n                                propertyKey = parseAssignmentExpression()\n                                result = markerApply(marker, propertyKey)\n                                expect(\"]\")\n                                return result\n                            }\n\n                            return markerApply(marker, delegate.createIdentifier(token.value))\n                        }\n\n                        function parseObjectProperty() {\n                            var token,\n                                key,\n                                id,\n                                param,\n                                computed,\n                                marker = markerCreate(),\n                                returnType,\n                                typeParameters\n\n                            token = lookahead\n                            computed = token.value === \"[\" && token.type === Token.Punctuator\n\n                            if (token.type === Token.Identifier || computed || matchAsync()) {\n                                id = parseObjectPropertyKey()\n\n                                if (match(\":\")) {\n                                    lex()\n\n                                    return markerApply(\n                                        marker,\n                                        delegate.createProperty(\n                                            \"init\",\n                                            id,\n                                            parseAssignmentExpression(),\n                                            false,\n                                            false,\n                                            computed\n                                        )\n                                    )\n                                }\n\n                                if (match(\"(\") || match(\"<\")) {\n                                    if (match(\"<\")) {\n                                        typeParameters = parseTypeParameterDeclaration()\n                                    }\n                                    return markerApply(\n                                        marker,\n                                        delegate.createProperty(\n                                            \"init\",\n                                            id,\n                                            parsePropertyMethodFunction({\n                                                generator: false,\n                                                async: false,\n                                                typeParameters: typeParameters\n                                            }),\n                                            true,\n                                            false,\n                                            computed\n                                        )\n                                    )\n                                }\n\n                                // Property Assignment: Getter and Setter.\n\n                                if (token.value === \"get\") {\n                                    computed = lookahead.value === \"[\"\n                                    key = parseObjectPropertyKey()\n\n                                    expect(\"(\")\n                                    expect(\")\")\n                                    if (match(\":\")) {\n                                        returnType = parseTypeAnnotation()\n                                    }\n\n                                    return markerApply(\n                                        marker,\n                                        delegate.createProperty(\n                                            \"get\",\n                                            key,\n                                            parsePropertyFunction({\n                                                generator: false,\n                                                async: false,\n                                                returnType: returnType\n                                            }),\n                                            false,\n                                            false,\n                                            computed\n                                        )\n                                    )\n                                }\n\n                                if (token.value === \"set\") {\n                                    computed = lookahead.value === \"[\"\n                                    key = parseObjectPropertyKey()\n\n                                    expect(\"(\")\n                                    token = lookahead\n                                    param = [parseTypeAnnotatableIdentifier()]\n                                    expect(\")\")\n                                    if (match(\":\")) {\n                                        returnType = parseTypeAnnotation()\n                                    }\n\n                                    return markerApply(\n                                        marker,\n                                        delegate.createProperty(\n                                            \"set\",\n                                            key,\n                                            parsePropertyFunction({\n                                                params: param,\n                                                generator: false,\n                                                async: false,\n                                                name: token,\n                                                returnType: returnType\n                                            }),\n                                            false,\n                                            false,\n                                            computed\n                                        )\n                                    )\n                                }\n\n                                if (token.value === \"async\") {\n                                    computed = lookahead.value === \"[\"\n                                    key = parseObjectPropertyKey()\n\n                                    if (match(\"<\")) {\n                                        typeParameters = parseTypeParameterDeclaration()\n                                    }\n\n                                    return markerApply(\n                                        marker,\n                                        delegate.createProperty(\n                                            \"init\",\n                                            key,\n                                            parsePropertyMethodFunction({\n                                                generator: false,\n                                                async: true,\n                                                typeParameters: typeParameters\n                                            }),\n                                            true,\n                                            false,\n                                            computed\n                                        )\n                                    )\n                                }\n\n                                if (computed) {\n                                    // Computed properties can only be used with full notation.\n                                    throwUnexpected(lookahead)\n                                }\n\n                                return markerApply(\n                                    marker,\n                                    delegate.createProperty(\"init\", id, id, false, true, false)\n                                )\n                            }\n\n                            if (token.type === Token.EOF || token.type === Token.Punctuator) {\n                                if (!match(\"*\")) {\n                                    throwUnexpected(token)\n                                }\n                                lex()\n\n                                computed =\n                                    lookahead.type === Token.Punctuator && lookahead.value === \"[\"\n\n                                id = parseObjectPropertyKey()\n\n                                if (match(\"<\")) {\n                                    typeParameters = parseTypeParameterDeclaration()\n                                }\n\n                                if (!match(\"(\")) {\n                                    throwUnexpected(lex())\n                                }\n\n                                return markerApply(\n                                    marker,\n                                    delegate.createProperty(\n                                        \"init\",\n                                        id,\n                                        parsePropertyMethodFunction({\n                                            generator: true,\n                                            typeParameters: typeParameters\n                                        }),\n                                        true,\n                                        false,\n                                        computed\n                                    )\n                                )\n                            }\n                            key = parseObjectPropertyKey()\n                            if (match(\":\")) {\n                                lex()\n                                return markerApply(\n                                    marker,\n                                    delegate.createProperty(\n                                        \"init\",\n                                        key,\n                                        parseAssignmentExpression(),\n                                        false,\n                                        false,\n                                        false\n                                    )\n                                )\n                            }\n                            if (match(\"(\") || match(\"<\")) {\n                                if (match(\"<\")) {\n                                    typeParameters = parseTypeParameterDeclaration()\n                                }\n                                return markerApply(\n                                    marker,\n                                    delegate.createProperty(\n                                        \"init\",\n                                        key,\n                                        parsePropertyMethodFunction({\n                                            generator: false,\n                                            typeParameters: typeParameters\n                                        }),\n                                        true,\n                                        false,\n                                        false\n                                    )\n                                )\n                            }\n                            throwUnexpected(lex())\n                        }\n\n                        function parseObjectSpreadProperty() {\n                            var marker = markerCreate()\n                            expect(\"...\")\n                            return markerApply(\n                                marker,\n                                delegate.createSpreadProperty(parseAssignmentExpression())\n                            )\n                        }\n\n                        function getFieldName(key) {\n                            var toString = String\n                            if (key.type === Syntax.Identifier) {\n                                return key.name\n                            }\n                            return toString(key.value)\n                        }\n\n                        function parseObjectInitialiser() {\n                            var properties = [],\n                                property,\n                                name,\n                                kind,\n                                storedKind,\n                                map = new StringMap(),\n                                marker = markerCreate(),\n                                toString = String\n\n                            expect(\"{\")\n\n                            while (!match(\"}\")) {\n                                if (match(\"...\")) {\n                                    property = parseObjectSpreadProperty()\n                                } else {\n                                    property = parseObjectProperty()\n\n                                    if (property.key.type === Syntax.Identifier) {\n                                        name = property.key.name\n                                    } else {\n                                        name = toString(property.key.value)\n                                    }\n                                    kind =\n                                        property.kind === \"init\"\n                                            ? PropertyKind.Data\n                                            : property.kind === \"get\"\n                                            ? PropertyKind.Get\n                                            : PropertyKind.Set\n\n                                    if (map.has(name)) {\n                                        storedKind = map.get(name)\n                                        if (storedKind === PropertyKind.Data) {\n                                            if (strict && kind === PropertyKind.Data) {\n                                                throwErrorTolerant(\n                                                    {},\n                                                    Messages.StrictDuplicateProperty\n                                                )\n                                            } else if (kind !== PropertyKind.Data) {\n                                                throwErrorTolerant(\n                                                    {},\n                                                    Messages.AccessorDataProperty\n                                                )\n                                            }\n                                        } else {\n                                            if (kind === PropertyKind.Data) {\n                                                throwErrorTolerant(\n                                                    {},\n                                                    Messages.AccessorDataProperty\n                                                )\n                                            } else if (storedKind & kind) {\n                                                throwErrorTolerant({}, Messages.AccessorGetSet)\n                                            }\n                                        }\n                                        map.set(name, storedKind | kind)\n                                    } else {\n                                        map.set(name, kind)\n                                    }\n                                }\n\n                                properties.push(property)\n\n                                if (!match(\"}\")) {\n                                    expect(\",\")\n                                }\n                            }\n\n                            expect(\"}\")\n\n                            return markerApply(marker, delegate.createObjectExpression(properties))\n                        }\n\n                        function parseTemplateElement(option) {\n                            var marker = markerCreate(),\n                                token = scanTemplateElement(option)\n                            if (strict && token.octal) {\n                                throwError(token, Messages.StrictOctalLiteral)\n                            }\n                            return markerApply(\n                                marker,\n                                delegate.createTemplateElement(\n                                    { raw: token.value.raw, cooked: token.value.cooked },\n                                    token.tail\n                                )\n                            )\n                        }\n\n                        function parseTemplateLiteral() {\n                            var quasi,\n                                quasis,\n                                expressions,\n                                marker = markerCreate()\n\n                            quasi = parseTemplateElement({ head: true })\n                            quasis = [quasi]\n                            expressions = []\n\n                            while (!quasi.tail) {\n                                expressions.push(parseExpression())\n                                quasi = parseTemplateElement({ head: false })\n                                quasis.push(quasi)\n                            }\n\n                            return markerApply(\n                                marker,\n                                delegate.createTemplateLiteral(quasis, expressions)\n                            )\n                        }\n\n                        // 11.1.6 The Grouping Operator\n\n                        function parseGroupExpression() {\n                            var expr, marker, typeAnnotation\n\n                            expect(\"(\")\n\n                            ++state.parenthesizedCount\n\n                            marker = markerCreate()\n\n                            expr = parseExpression()\n\n                            if (match(\":\")) {\n                                typeAnnotation = parseTypeAnnotation()\n                                expr = markerApply(\n                                    marker,\n                                    delegate.createTypeCast(expr, typeAnnotation)\n                                )\n                            }\n\n                            expect(\")\")\n\n                            return expr\n                        }\n\n                        function matchAsyncFuncExprOrDecl() {\n                            var token\n\n                            if (matchAsync()) {\n                                token = lookahead2()\n                                if (token.type === Token.Keyword && token.value === \"function\") {\n                                    return true\n                                }\n                            }\n\n                            return false\n                        }\n\n                        // 11.1 Primary Expressions\n\n                        function parsePrimaryExpression() {\n                            var marker, type, token, expr\n\n                            type = lookahead.type\n\n                            if (type === Token.Identifier) {\n                                marker = markerCreate()\n                                return markerApply(marker, delegate.createIdentifier(lex().value))\n                            }\n\n                            if (type === Token.StringLiteral || type === Token.NumericLiteral) {\n                                if (strict && lookahead.octal) {\n                                    throwErrorTolerant(lookahead, Messages.StrictOctalLiteral)\n                                }\n                                marker = markerCreate()\n                                return markerApply(marker, delegate.createLiteral(lex()))\n                            }\n\n                            if (type === Token.Keyword) {\n                                if (matchKeyword(\"this\")) {\n                                    marker = markerCreate()\n                                    lex()\n                                    return markerApply(marker, delegate.createThisExpression())\n                                }\n\n                                if (matchKeyword(\"function\")) {\n                                    return parseFunctionExpression()\n                                }\n\n                                if (matchKeyword(\"class\")) {\n                                    return parseClassExpression()\n                                }\n\n                                if (matchKeyword(\"super\")) {\n                                    marker = markerCreate()\n                                    lex()\n                                    return markerApply(marker, delegate.createIdentifier(\"super\"))\n                                }\n                            }\n\n                            if (type === Token.BooleanLiteral) {\n                                marker = markerCreate()\n                                token = lex()\n                                token.value = token.value === \"true\"\n                                return markerApply(marker, delegate.createLiteral(token))\n                            }\n\n                            if (type === Token.NullLiteral) {\n                                marker = markerCreate()\n                                token = lex()\n                                token.value = null\n                                return markerApply(marker, delegate.createLiteral(token))\n                            }\n\n                            if (match(\"[\")) {\n                                return parseArrayInitialiser()\n                            }\n\n                            if (match(\"{\")) {\n                                return parseObjectInitialiser()\n                            }\n\n                            if (match(\"(\")) {\n                                return parseGroupExpression()\n                            }\n\n                            if (match(\"/\") || match(\"/=\")) {\n                                marker = markerCreate()\n                                expr = delegate.createLiteral(scanRegExp())\n                                peek()\n                                return markerApply(marker, expr)\n                            }\n\n                            if (type === Token.Template) {\n                                return parseTemplateLiteral()\n                            }\n\n                            if (match(\"<\")) {\n                                return parseJSXElement()\n                            }\n\n                            throwUnexpected(lex())\n                        }\n\n                        // 11.2 Left-Hand-Side Expressions\n\n                        function parseArguments() {\n                            var args = [],\n                                arg\n\n                            expect(\"(\")\n\n                            if (!match(\")\")) {\n                                while (index < length) {\n                                    arg = parseSpreadOrAssignmentExpression()\n                                    args.push(arg)\n\n                                    if (match(\")\")) {\n                                        break\n                                    } else if (arg.type === Syntax.SpreadElement) {\n                                        throwError({}, Messages.ElementAfterSpreadElement)\n                                    }\n\n                                    expect(\",\")\n                                }\n                            }\n\n                            expect(\")\")\n\n                            return args\n                        }\n\n                        function parseSpreadOrAssignmentExpression() {\n                            if (match(\"...\")) {\n                                var marker = markerCreate()\n                                lex()\n                                return markerApply(\n                                    marker,\n                                    delegate.createSpreadElement(parseAssignmentExpression())\n                                )\n                            }\n                            return parseAssignmentExpression()\n                        }\n\n                        function parseNonComputedProperty() {\n                            var marker = markerCreate(),\n                                token = lex()\n\n                            if (!isIdentifierName(token)) {\n                                throwUnexpected(token)\n                            }\n\n                            return markerApply(marker, delegate.createIdentifier(token.value))\n                        }\n\n                        function parseNonComputedMember() {\n                            expect(\".\")\n\n                            return parseNonComputedProperty()\n                        }\n\n                        function parseComputedMember() {\n                            var expr\n\n                            expect(\"[\")\n\n                            expr = parseExpression()\n\n                            expect(\"]\")\n\n                            return expr\n                        }\n\n                        function parseNewExpression() {\n                            var callee,\n                                args,\n                                marker = markerCreate()\n\n                            expectKeyword(\"new\")\n                            callee = parseLeftHandSideExpression()\n                            args = match(\"(\") ? parseArguments() : []\n\n                            return markerApply(marker, delegate.createNewExpression(callee, args))\n                        }\n\n                        function parseLeftHandSideExpressionAllowCall() {\n                            var expr,\n                                args,\n                                marker = markerCreate()\n\n                            expr = matchKeyword(\"new\")\n                                ? parseNewExpression()\n                                : parsePrimaryExpression()\n\n                            while (\n                                match(\".\") ||\n                                match(\"[\") ||\n                                match(\"(\") ||\n                                lookahead.type === Token.Template\n                            ) {\n                                if (match(\"(\")) {\n                                    args = parseArguments()\n                                    expr = markerApply(\n                                        marker,\n                                        delegate.createCallExpression(expr, args)\n                                    )\n                                } else if (match(\"[\")) {\n                                    expr = markerApply(\n                                        marker,\n                                        delegate.createMemberExpression(\n                                            \"[\",\n                                            expr,\n                                            parseComputedMember()\n                                        )\n                                    )\n                                } else if (match(\".\")) {\n                                    expr = markerApply(\n                                        marker,\n                                        delegate.createMemberExpression(\n                                            \".\",\n                                            expr,\n                                            parseNonComputedMember()\n                                        )\n                                    )\n                                } else {\n                                    expr = markerApply(\n                                        marker,\n                                        delegate.createTaggedTemplateExpression(\n                                            expr,\n                                            parseTemplateLiteral()\n                                        )\n                                    )\n                                }\n                            }\n\n                            return expr\n                        }\n\n                        function parseLeftHandSideExpression() {\n                            var expr,\n                                marker = markerCreate()\n\n                            expr = matchKeyword(\"new\")\n                                ? parseNewExpression()\n                                : parsePrimaryExpression()\n\n                            while (match(\".\") || match(\"[\") || lookahead.type === Token.Template) {\n                                if (match(\"[\")) {\n                                    expr = markerApply(\n                                        marker,\n                                        delegate.createMemberExpression(\n                                            \"[\",\n                                            expr,\n                                            parseComputedMember()\n                                        )\n                                    )\n                                } else if (match(\".\")) {\n                                    expr = markerApply(\n                                        marker,\n                                        delegate.createMemberExpression(\n                                            \".\",\n                                            expr,\n                                            parseNonComputedMember()\n                                        )\n                                    )\n                                } else {\n                                    expr = markerApply(\n                                        marker,\n                                        delegate.createTaggedTemplateExpression(\n                                            expr,\n                                            parseTemplateLiteral()\n                                        )\n                                    )\n                                }\n                            }\n\n                            return expr\n                        }\n\n                        // 11.3 Postfix Expressions\n\n                        function parsePostfixExpression() {\n                            var marker = markerCreate(),\n                                expr = parseLeftHandSideExpressionAllowCall(),\n                                token\n\n                            if (lookahead.type !== Token.Punctuator) {\n                                return expr\n                            }\n\n                            if ((match(\"++\") || match(\"--\")) && !peekLineTerminator()) {\n                                // 11.3.1, 11.3.2\n                                if (\n                                    strict &&\n                                    expr.type === Syntax.Identifier &&\n                                    isRestrictedWord(expr.name)\n                                ) {\n                                    throwErrorTolerant({}, Messages.StrictLHSPostfix)\n                                }\n\n                                if (!isLeftHandSide(expr)) {\n                                    throwError({}, Messages.InvalidLHSInAssignment)\n                                }\n\n                                token = lex()\n                                expr = markerApply(\n                                    marker,\n                                    delegate.createPostfixExpression(token.value, expr)\n                                )\n                            }\n\n                            return expr\n                        }\n\n                        // 11.4 Unary Operators\n\n                        function parseUnaryExpression() {\n                            var marker, token, expr\n\n                            if (\n                                lookahead.type !== Token.Punctuator &&\n                                lookahead.type !== Token.Keyword\n                            ) {\n                                return parsePostfixExpression()\n                            }\n\n                            if (match(\"++\") || match(\"--\")) {\n                                marker = markerCreate()\n                                token = lex()\n                                expr = parseUnaryExpression()\n                                // 11.4.4, 11.4.5\n                                if (\n                                    strict &&\n                                    expr.type === Syntax.Identifier &&\n                                    isRestrictedWord(expr.name)\n                                ) {\n                                    throwErrorTolerant({}, Messages.StrictLHSPrefix)\n                                }\n\n                                if (!isLeftHandSide(expr)) {\n                                    throwError({}, Messages.InvalidLHSInAssignment)\n                                }\n\n                                return markerApply(\n                                    marker,\n                                    delegate.createUnaryExpression(token.value, expr)\n                                )\n                            }\n\n                            if (match(\"+\") || match(\"-\") || match(\"~\") || match(\"!\")) {\n                                marker = markerCreate()\n                                token = lex()\n                                expr = parseUnaryExpression()\n                                return markerApply(\n                                    marker,\n                                    delegate.createUnaryExpression(token.value, expr)\n                                )\n                            }\n\n                            if (\n                                matchKeyword(\"delete\") ||\n                                matchKeyword(\"void\") ||\n                                matchKeyword(\"typeof\")\n                            ) {\n                                marker = markerCreate()\n                                token = lex()\n                                expr = parseUnaryExpression()\n                                expr = markerApply(\n                                    marker,\n                                    delegate.createUnaryExpression(token.value, expr)\n                                )\n                                if (\n                                    strict &&\n                                    expr.operator === \"delete\" &&\n                                    expr.argument.type === Syntax.Identifier\n                                ) {\n                                    throwErrorTolerant({}, Messages.StrictDelete)\n                                }\n                                return expr\n                            }\n\n                            return parsePostfixExpression()\n                        }\n\n                        function binaryPrecedence(token, allowIn) {\n                            var prec = 0\n\n                            if (token.type !== Token.Punctuator && token.type !== Token.Keyword) {\n                                return 0\n                            }\n\n                            switch (token.value) {\n                                case \"||\":\n                                    prec = 1\n                                    break\n\n                                case \"&&\":\n                                    prec = 2\n                                    break\n\n                                case \"|\":\n                                    prec = 3\n                                    break\n\n                                case \"^\":\n                                    prec = 4\n                                    break\n\n                                case \"&\":\n                                    prec = 5\n                                    break\n\n                                case \"==\":\n                                case \"!=\":\n                                case \"===\":\n                                case \"!==\":\n                                    prec = 6\n                                    break\n\n                                case \"<\":\n                                case \">\":\n                                case \"<=\":\n                                case \">=\":\n                                case \"instanceof\":\n                                    prec = 7\n                                    break\n\n                                case \"in\":\n                                    prec = allowIn ? 7 : 0\n                                    break\n\n                                case \"<<\":\n                                case \">>\":\n                                case \">>>\":\n                                    prec = 8\n                                    break\n\n                                case \"+\":\n                                case \"-\":\n                                    prec = 9\n                                    break\n\n                                case \"*\":\n                                case \"/\":\n                                case \"%\":\n                                    prec = 11\n                                    break\n\n                                default:\n                                    break\n                            }\n\n                            return prec\n                        }\n\n                        // 11.5 Multiplicative Operators\n                        // 11.6 Additive Operators\n                        // 11.7 Bitwise Shift Operators\n                        // 11.8 Relational Operators\n                        // 11.9 Equality Operators\n                        // 11.10 Binary Bitwise Operators\n                        // 11.11 Binary Logical Operators\n\n                        function parseBinaryExpression() {\n                            var expr,\n                                token,\n                                prec,\n                                previousAllowIn,\n                                stack,\n                                right,\n                                operator,\n                                left,\n                                i,\n                                marker,\n                                markers\n\n                            previousAllowIn = state.allowIn\n                            state.allowIn = true\n\n                            marker = markerCreate()\n                            left = parseUnaryExpression()\n\n                            token = lookahead\n                            prec = binaryPrecedence(token, previousAllowIn)\n                            if (prec === 0) {\n                                return left\n                            }\n                            token.prec = prec\n                            lex()\n\n                            markers = [marker, markerCreate()]\n                            right = parseUnaryExpression()\n\n                            stack = [left, token, right]\n\n                            while ((prec = binaryPrecedence(lookahead, previousAllowIn)) > 0) {\n                                // Reduce: make a binary expression from the three topmost entries.\n                                while (stack.length > 2 && prec <= stack[stack.length - 2].prec) {\n                                    right = stack.pop()\n                                    operator = stack.pop().value\n                                    left = stack.pop()\n                                    expr = delegate.createBinaryExpression(operator, left, right)\n                                    markers.pop()\n                                    marker = markers.pop()\n                                    markerApply(marker, expr)\n                                    stack.push(expr)\n                                    markers.push(marker)\n                                }\n\n                                // Shift.\n                                token = lex()\n                                token.prec = prec\n                                stack.push(token)\n                                markers.push(markerCreate())\n                                expr = parseUnaryExpression()\n                                stack.push(expr)\n                            }\n\n                            state.allowIn = previousAllowIn\n\n                            // Final reduce to clean-up the stack.\n                            i = stack.length - 1\n                            expr = stack[i]\n                            markers.pop()\n                            while (i > 1) {\n                                expr = delegate.createBinaryExpression(\n                                    stack[i - 1].value,\n                                    stack[i - 2],\n                                    expr\n                                )\n                                i -= 2\n                                marker = markers.pop()\n                                markerApply(marker, expr)\n                            }\n\n                            return expr\n                        }\n\n                        // 11.12 Conditional Operator\n\n                        function parseConditionalExpression() {\n                            var expr,\n                                previousAllowIn,\n                                consequent,\n                                alternate,\n                                marker = markerCreate()\n                            expr = parseBinaryExpression()\n\n                            if (match(\"?\")) {\n                                lex()\n                                previousAllowIn = state.allowIn\n                                state.allowIn = true\n                                consequent = parseAssignmentExpression()\n                                state.allowIn = previousAllowIn\n                                expect(\":\")\n                                alternate = parseAssignmentExpression()\n\n                                expr = markerApply(\n                                    marker,\n                                    delegate.createConditionalExpression(\n                                        expr,\n                                        consequent,\n                                        alternate\n                                    )\n                                )\n                            }\n\n                            return expr\n                        }\n\n                        // 11.13 Assignment Operators\n\n                        // 12.14.5 AssignmentPattern\n\n                        function reinterpretAsAssignmentBindingPattern(expr) {\n                            var i, len, property, element\n\n                            if (expr.type === Syntax.ObjectExpression) {\n                                expr.type = Syntax.ObjectPattern\n                                for (i = 0, len = expr.properties.length; i < len; i += 1) {\n                                    property = expr.properties[i]\n                                    if (property.type === Syntax.SpreadProperty) {\n                                        if (i < len - 1) {\n                                            throwError({}, Messages.PropertyAfterSpreadProperty)\n                                        }\n                                        reinterpretAsAssignmentBindingPattern(property.argument)\n                                    } else {\n                                        if (property.kind !== \"init\") {\n                                            throwError({}, Messages.InvalidLHSInAssignment)\n                                        }\n                                        reinterpretAsAssignmentBindingPattern(property.value)\n                                    }\n                                }\n                            } else if (expr.type === Syntax.ArrayExpression) {\n                                expr.type = Syntax.ArrayPattern\n                                for (i = 0, len = expr.elements.length; i < len; i += 1) {\n                                    element = expr.elements[i]\n                                    /* istanbul ignore else */\n                                    if (element) {\n                                        reinterpretAsAssignmentBindingPattern(element)\n                                    }\n                                }\n                            } else if (expr.type === Syntax.Identifier) {\n                                if (isRestrictedWord(expr.name)) {\n                                    throwError({}, Messages.InvalidLHSInAssignment)\n                                }\n                            } else if (expr.type === Syntax.SpreadElement) {\n                                reinterpretAsAssignmentBindingPattern(expr.argument)\n                                if (expr.argument.type === Syntax.ObjectPattern) {\n                                    throwError({}, Messages.ObjectPatternAsSpread)\n                                }\n                            } else {\n                                /* istanbul ignore else */\n                                if (\n                                    expr.type !== Syntax.MemberExpression &&\n                                    expr.type !== Syntax.CallExpression &&\n                                    expr.type !== Syntax.NewExpression\n                                ) {\n                                    throwError({}, Messages.InvalidLHSInAssignment)\n                                }\n                            }\n                        }\n\n                        // 13.2.3 BindingPattern\n\n                        function reinterpretAsDestructuredParameter(options, expr) {\n                            var i, len, property, element\n\n                            if (expr.type === Syntax.ObjectExpression) {\n                                expr.type = Syntax.ObjectPattern\n                                for (i = 0, len = expr.properties.length; i < len; i += 1) {\n                                    property = expr.properties[i]\n                                    if (property.type === Syntax.SpreadProperty) {\n                                        if (i < len - 1) {\n                                            throwError({}, Messages.PropertyAfterSpreadProperty)\n                                        }\n                                        reinterpretAsDestructuredParameter(\n                                            options,\n                                            property.argument\n                                        )\n                                    } else {\n                                        if (property.kind !== \"init\") {\n                                            throwError({}, Messages.InvalidLHSInFormalsList)\n                                        }\n                                        reinterpretAsDestructuredParameter(options, property.value)\n                                    }\n                                }\n                            } else if (expr.type === Syntax.ArrayExpression) {\n                                expr.type = Syntax.ArrayPattern\n                                for (i = 0, len = expr.elements.length; i < len; i += 1) {\n                                    element = expr.elements[i]\n                                    if (element) {\n                                        reinterpretAsDestructuredParameter(options, element)\n                                    }\n                                }\n                            } else if (expr.type === Syntax.Identifier) {\n                                validateParam(options, expr, expr.name)\n                            } else if (expr.type === Syntax.SpreadElement) {\n                                // BindingRestElement only allows BindingIdentifier\n                                if (expr.argument.type !== Syntax.Identifier) {\n                                    throwError({}, Messages.InvalidLHSInFormalsList)\n                                }\n                                validateParam(options, expr.argument, expr.argument.name)\n                            } else {\n                                throwError({}, Messages.InvalidLHSInFormalsList)\n                            }\n                        }\n\n                        function reinterpretAsCoverFormalsList(expressions) {\n                            var i, len, param, params, defaults, defaultCount, options, rest\n\n                            params = []\n                            defaults = []\n                            defaultCount = 0\n                            rest = null\n                            options = {\n                                paramSet: new StringMap()\n                            }\n\n                            for (i = 0, len = expressions.length; i < len; i += 1) {\n                                param = expressions[i]\n                                if (param.type === Syntax.Identifier) {\n                                    params.push(param)\n                                    defaults.push(null)\n                                    validateParam(options, param, param.name)\n                                } else if (\n                                    param.type === Syntax.ObjectExpression ||\n                                    param.type === Syntax.ArrayExpression\n                                ) {\n                                    reinterpretAsDestructuredParameter(options, param)\n                                    params.push(param)\n                                    defaults.push(null)\n                                } else if (param.type === Syntax.SpreadElement) {\n                                    assert(\n                                        i === len - 1,\n                                        \"It is guaranteed that SpreadElement is last element by parseExpression\"\n                                    )\n                                    if (param.argument.type !== Syntax.Identifier) {\n                                        throwError({}, Messages.InvalidLHSInFormalsList)\n                                    }\n                                    reinterpretAsDestructuredParameter(options, param.argument)\n                                    rest = param.argument\n                                } else if (param.type === Syntax.AssignmentExpression) {\n                                    params.push(param.left)\n                                    defaults.push(param.right)\n                                    ++defaultCount\n                                    validateParam(options, param.left, param.left.name)\n                                } else {\n                                    return null\n                                }\n                            }\n\n                            if (options.message === Messages.StrictParamDupe) {\n                                throwError(\n                                    strict ? options.stricted : options.firstRestricted,\n                                    options.message\n                                )\n                            }\n\n                            if (defaultCount === 0) {\n                                defaults = []\n                            }\n\n                            return {\n                                params: params,\n                                defaults: defaults,\n                                rest: rest,\n                                stricted: options.stricted,\n                                firstRestricted: options.firstRestricted,\n                                message: options.message\n                            }\n                        }\n\n                        function parseArrowFunctionExpression(options, marker) {\n                            var previousStrict, previousYieldAllowed, previousAwaitAllowed, body\n\n                            expect(\"=>\")\n\n                            previousStrict = strict\n                            previousYieldAllowed = state.yieldAllowed\n                            state.yieldAllowed = false\n                            previousAwaitAllowed = state.awaitAllowed\n                            state.awaitAllowed = !!options.async\n                            body = parseConciseBody()\n\n                            if (strict && options.firstRestricted) {\n                                throwError(options.firstRestricted, options.message)\n                            }\n                            if (strict && options.stricted) {\n                                throwErrorTolerant(options.stricted, options.message)\n                            }\n\n                            strict = previousStrict\n                            state.yieldAllowed = previousYieldAllowed\n                            state.awaitAllowed = previousAwaitAllowed\n\n                            return markerApply(\n                                marker,\n                                delegate.createArrowFunctionExpression(\n                                    options.params,\n                                    options.defaults,\n                                    body,\n                                    options.rest,\n                                    body.type !== Syntax.BlockStatement,\n                                    !!options.async\n                                )\n                            )\n                        }\n\n                        function parseAssignmentExpression() {\n                            var marker,\n                                expr,\n                                token,\n                                params,\n                                oldParenthesizedCount,\n                                startsWithParen = false,\n                                backtrackToken = lookahead,\n                                possiblyAsync = false\n\n                            if (matchYield()) {\n                                return parseYieldExpression()\n                            }\n\n                            if (matchAwait()) {\n                                return parseAwaitExpression()\n                            }\n\n                            oldParenthesizedCount = state.parenthesizedCount\n\n                            marker = markerCreate()\n\n                            if (matchAsyncFuncExprOrDecl()) {\n                                return parseFunctionExpression()\n                            }\n\n                            if (matchAsync()) {\n                                // We can't be completely sure that this 'async' token is\n                                // actually a contextual keyword modifying a function\n                                // expression, so we might have to un-lex() it later by\n                                // calling rewind(backtrackToken).\n                                possiblyAsync = true\n                                lex()\n                            }\n\n                            if (match(\"(\")) {\n                                token = lookahead2()\n                                if (\n                                    (token.type === Token.Punctuator && token.value === \")\") ||\n                                    token.value === \"...\"\n                                ) {\n                                    params = parseParams()\n                                    if (!match(\"=>\")) {\n                                        throwUnexpected(lex())\n                                    }\n                                    params.async = possiblyAsync\n                                    return parseArrowFunctionExpression(params, marker)\n                                }\n                                startsWithParen = true\n                            }\n\n                            token = lookahead\n\n                            // If the 'async' keyword is not followed by a '(' character or an\n                            // identifier, then it can't be an arrow function modifier, and we\n                            // should interpret it as a normal identifier.\n                            if (possiblyAsync && !match(\"(\") && token.type !== Token.Identifier) {\n                                possiblyAsync = false\n                                rewind(backtrackToken)\n                            }\n\n                            expr = parseConditionalExpression()\n\n                            if (\n                                match(\"=>\") &&\n                                (state.parenthesizedCount === oldParenthesizedCount ||\n                                    state.parenthesizedCount === oldParenthesizedCount + 1)\n                            ) {\n                                if (expr.type === Syntax.Identifier) {\n                                    params = reinterpretAsCoverFormalsList([expr])\n                                } else if (\n                                    expr.type === Syntax.AssignmentExpression ||\n                                    expr.type === Syntax.ArrayExpression ||\n                                    expr.type === Syntax.ObjectExpression\n                                ) {\n                                    if (!startsWithParen) {\n                                        throwUnexpected(lex())\n                                    }\n                                    params = reinterpretAsCoverFormalsList([expr])\n                                } else if (expr.type === Syntax.SequenceExpression) {\n                                    params = reinterpretAsCoverFormalsList(expr.expressions)\n                                }\n                                if (params) {\n                                    params.async = possiblyAsync\n                                    return parseArrowFunctionExpression(params, marker)\n                                }\n                            }\n\n                            // If we haven't returned by now, then the 'async' keyword was not\n                            // a function modifier, and we should rewind and interpret it as a\n                            // normal identifier.\n                            if (possiblyAsync) {\n                                possiblyAsync = false\n                                rewind(backtrackToken)\n                                expr = parseConditionalExpression()\n                            }\n\n                            if (matchAssign()) {\n                                // 11.13.1\n                                if (\n                                    strict &&\n                                    expr.type === Syntax.Identifier &&\n                                    isRestrictedWord(expr.name)\n                                ) {\n                                    throwErrorTolerant(token, Messages.StrictLHSAssignment)\n                                }\n\n                                // ES.next draf 11.13 Runtime Semantics step 1\n                                if (\n                                    match(\"=\") &&\n                                    (expr.type === Syntax.ObjectExpression ||\n                                        expr.type === Syntax.ArrayExpression)\n                                ) {\n                                    reinterpretAsAssignmentBindingPattern(expr)\n                                } else if (!isLeftHandSide(expr)) {\n                                    throwError({}, Messages.InvalidLHSInAssignment)\n                                }\n\n                                expr = markerApply(\n                                    marker,\n                                    delegate.createAssignmentExpression(\n                                        lex().value,\n                                        expr,\n                                        parseAssignmentExpression()\n                                    )\n                                )\n                            }\n\n                            return expr\n                        }\n\n                        // 11.14 Comma Operator\n\n                        function parseExpression() {\n                            var marker, expr, expressions, sequence, spreadFound\n\n                            marker = markerCreate()\n                            expr = parseAssignmentExpression()\n                            expressions = [expr]\n\n                            if (match(\",\")) {\n                                while (index < length) {\n                                    if (!match(\",\")) {\n                                        break\n                                    }\n\n                                    lex()\n                                    expr = parseSpreadOrAssignmentExpression()\n                                    expressions.push(expr)\n\n                                    if (expr.type === Syntax.SpreadElement) {\n                                        spreadFound = true\n                                        if (!match(\")\")) {\n                                            throwError({}, Messages.ElementAfterSpreadElement)\n                                        }\n                                        break\n                                    }\n                                }\n\n                                sequence = markerApply(\n                                    marker,\n                                    delegate.createSequenceExpression(expressions)\n                                )\n                            }\n\n                            if (spreadFound && lookahead2().value !== \"=>\") {\n                                throwError({}, Messages.IllegalSpread)\n                            }\n\n                            return sequence || expr\n                        }\n\n                        // 12.1 Block\n\n                        function parseStatementList() {\n                            var list = [],\n                                statement\n\n                            while (index < length) {\n                                if (match(\"}\")) {\n                                    break\n                                }\n                                statement = parseSourceElement()\n                                if (typeof statement === \"undefined\") {\n                                    break\n                                }\n                                list.push(statement)\n                            }\n\n                            return list\n                        }\n\n                        function parseBlock() {\n                            var block,\n                                marker = markerCreate()\n\n                            expect(\"{\")\n\n                            block = parseStatementList()\n\n                            expect(\"}\")\n\n                            return markerApply(marker, delegate.createBlockStatement(block))\n                        }\n\n                        // 12.2 Variable Statement\n\n                        function parseTypeParameterDeclaration() {\n                            var marker = markerCreate(),\n                                paramTypes = []\n\n                            expect(\"<\")\n                            while (!match(\">\")) {\n                                paramTypes.push(parseTypeAnnotatableIdentifier())\n                                if (!match(\">\")) {\n                                    expect(\",\")\n                                }\n                            }\n                            expect(\">\")\n\n                            return markerApply(\n                                marker,\n                                delegate.createTypeParameterDeclaration(paramTypes)\n                            )\n                        }\n\n                        function parseTypeParameterInstantiation() {\n                            var marker = markerCreate(),\n                                oldInType = state.inType,\n                                paramTypes = []\n\n                            state.inType = true\n\n                            expect(\"<\")\n                            while (!match(\">\")) {\n                                paramTypes.push(parseType())\n                                if (!match(\">\")) {\n                                    expect(\",\")\n                                }\n                            }\n                            expect(\">\")\n\n                            state.inType = oldInType\n\n                            return markerApply(\n                                marker,\n                                delegate.createTypeParameterInstantiation(paramTypes)\n                            )\n                        }\n\n                        function parseObjectTypeIndexer(marker, isStatic) {\n                            var id, key, value\n\n                            expect(\"[\")\n                            id = parseObjectPropertyKey()\n                            expect(\":\")\n                            key = parseType()\n                            expect(\"]\")\n                            expect(\":\")\n                            value = parseType()\n\n                            return markerApply(\n                                marker,\n                                delegate.createObjectTypeIndexer(id, key, value, isStatic)\n                            )\n                        }\n\n                        function parseObjectTypeMethodish(marker) {\n                            var params = [],\n                                rest = null,\n                                returnType,\n                                typeParameters = null\n                            if (match(\"<\")) {\n                                typeParameters = parseTypeParameterDeclaration()\n                            }\n\n                            expect(\"(\")\n                            while (lookahead.type === Token.Identifier) {\n                                params.push(parseFunctionTypeParam())\n                                if (!match(\")\")) {\n                                    expect(\",\")\n                                }\n                            }\n\n                            if (match(\"...\")) {\n                                lex()\n                                rest = parseFunctionTypeParam()\n                            }\n                            expect(\")\")\n                            expect(\":\")\n                            returnType = parseType()\n\n                            return markerApply(\n                                marker,\n                                delegate.createFunctionTypeAnnotation(\n                                    params,\n                                    returnType,\n                                    rest,\n                                    typeParameters\n                                )\n                            )\n                        }\n\n                        function parseObjectTypeMethod(marker, isStatic, key) {\n                            var optional = false,\n                                value\n                            value = parseObjectTypeMethodish(marker)\n\n                            return markerApply(\n                                marker,\n                                delegate.createObjectTypeProperty(key, value, optional, isStatic)\n                            )\n                        }\n\n                        function parseObjectTypeCallProperty(marker, isStatic) {\n                            var valueMarker = markerCreate()\n                            return markerApply(\n                                marker,\n                                delegate.createObjectTypeCallProperty(\n                                    parseObjectTypeMethodish(valueMarker),\n                                    isStatic\n                                )\n                            )\n                        }\n\n                        function parseObjectType(allowStatic) {\n                            var callProperties = [],\n                                indexers = [],\n                                marker,\n                                optional = false,\n                                properties = [],\n                                propertyKey,\n                                propertyTypeAnnotation,\n                                token,\n                                isStatic,\n                                matchStatic\n\n                            expect(\"{\")\n\n                            while (!match(\"}\")) {\n                                marker = markerCreate()\n                                matchStatic = strict\n                                    ? matchKeyword(\"static\")\n                                    : matchContextualKeyword(\"static\")\n\n                                if (allowStatic && matchStatic) {\n                                    token = lex()\n                                    isStatic = true\n                                }\n\n                                if (match(\"[\")) {\n                                    indexers.push(parseObjectTypeIndexer(marker, isStatic))\n                                } else if (match(\"(\") || match(\"<\")) {\n                                    callProperties.push(\n                                        parseObjectTypeCallProperty(marker, allowStatic)\n                                    )\n                                } else {\n                                    if (isStatic && match(\":\")) {\n                                        propertyKey = markerApply(\n                                            marker,\n                                            delegate.createIdentifier(token)\n                                        )\n                                        throwErrorTolerant(token, Messages.StrictReservedWord)\n                                    } else {\n                                        propertyKey = parseObjectPropertyKey()\n                                    }\n                                    if (match(\"<\") || match(\"(\")) {\n                                        // This is a method property\n                                        properties.push(\n                                            parseObjectTypeMethod(marker, isStatic, propertyKey)\n                                        )\n                                    } else {\n                                        if (match(\"?\")) {\n                                            lex()\n                                            optional = true\n                                        }\n                                        expect(\":\")\n                                        propertyTypeAnnotation = parseType()\n                                        properties.push(\n                                            markerApply(\n                                                marker,\n                                                delegate.createObjectTypeProperty(\n                                                    propertyKey,\n                                                    propertyTypeAnnotation,\n                                                    optional,\n                                                    isStatic\n                                                )\n                                            )\n                                        )\n                                    }\n                                }\n\n                                if (match(\";\")) {\n                                    lex()\n                                } else if (!match(\"}\")) {\n                                    throwUnexpected(lookahead)\n                                }\n                            }\n\n                            expect(\"}\")\n\n                            return delegate.createObjectTypeAnnotation(\n                                properties,\n                                indexers,\n                                callProperties\n                            )\n                        }\n\n                        function parseGenericType() {\n                            var marker = markerCreate(),\n                                typeParameters = null,\n                                typeIdentifier\n\n                            typeIdentifier = parseVariableIdentifier()\n\n                            while (match(\".\")) {\n                                expect(\".\")\n                                typeIdentifier = markerApply(\n                                    marker,\n                                    delegate.createQualifiedTypeIdentifier(\n                                        typeIdentifier,\n                                        parseVariableIdentifier()\n                                    )\n                                )\n                            }\n\n                            if (match(\"<\")) {\n                                typeParameters = parseTypeParameterInstantiation()\n                            }\n\n                            return markerApply(\n                                marker,\n                                delegate.createGenericTypeAnnotation(typeIdentifier, typeParameters)\n                            )\n                        }\n\n                        function parseVoidType() {\n                            var marker = markerCreate()\n                            expectKeyword(\"void\")\n                            return markerApply(marker, delegate.createVoidTypeAnnotation())\n                        }\n\n                        function parseTypeofType() {\n                            var argument,\n                                marker = markerCreate()\n                            expectKeyword(\"typeof\")\n                            argument = parsePrimaryType()\n                            return markerApply(\n                                marker,\n                                delegate.createTypeofTypeAnnotation(argument)\n                            )\n                        }\n\n                        function parseTupleType() {\n                            var marker = markerCreate(),\n                                types = []\n                            expect(\"[\")\n                            // We allow trailing commas\n                            while (index < length && !match(\"]\")) {\n                                types.push(parseType())\n                                if (match(\"]\")) {\n                                    break\n                                }\n                                expect(\",\")\n                            }\n                            expect(\"]\")\n                            return markerApply(marker, delegate.createTupleTypeAnnotation(types))\n                        }\n\n                        function parseFunctionTypeParam() {\n                            var marker = markerCreate(),\n                                name,\n                                optional = false,\n                                typeAnnotation\n                            name = parseVariableIdentifier()\n                            if (match(\"?\")) {\n                                lex()\n                                optional = true\n                            }\n                            expect(\":\")\n                            typeAnnotation = parseType()\n                            return markerApply(\n                                marker,\n                                delegate.createFunctionTypeParam(name, typeAnnotation, optional)\n                            )\n                        }\n\n                        function parseFunctionTypeParams() {\n                            var ret = { params: [], rest: null }\n                            while (lookahead.type === Token.Identifier) {\n                                ret.params.push(parseFunctionTypeParam())\n                                if (!match(\")\")) {\n                                    expect(\",\")\n                                }\n                            }\n\n                            if (match(\"...\")) {\n                                lex()\n                                ret.rest = parseFunctionTypeParam()\n                            }\n                            return ret\n                        }\n\n                        // The parsing of types roughly parallels the parsing of expressions, and\n                        // primary types are kind of like primary expressions...they're the\n                        // primitives with which other types are constructed.\n                        function parsePrimaryType() {\n                            var params = null,\n                                returnType = null,\n                                marker = markerCreate(),\n                                rest = null,\n                                tmp,\n                                typeParameters,\n                                token,\n                                type,\n                                isGroupedType = false\n\n                            switch (lookahead.type) {\n                                case Token.Identifier:\n                                    switch (lookahead.value) {\n                                        case \"any\":\n                                            lex()\n                                            return markerApply(\n                                                marker,\n                                                delegate.createAnyTypeAnnotation()\n                                            )\n                                        case \"bool\": // fallthrough\n                                        case \"boolean\":\n                                            lex()\n                                            return markerApply(\n                                                marker,\n                                                delegate.createBooleanTypeAnnotation()\n                                            )\n                                        case \"number\":\n                                            lex()\n                                            return markerApply(\n                                                marker,\n                                                delegate.createNumberTypeAnnotation()\n                                            )\n                                        case \"string\":\n                                            lex()\n                                            return markerApply(\n                                                marker,\n                                                delegate.createStringTypeAnnotation()\n                                            )\n                                    }\n                                    return markerApply(marker, parseGenericType())\n                                case Token.Punctuator:\n                                    switch (lookahead.value) {\n                                        case \"{\":\n                                            return markerApply(marker, parseObjectType())\n                                        case \"[\":\n                                            return parseTupleType()\n                                        case \"<\":\n                                            typeParameters = parseTypeParameterDeclaration()\n                                            expect(\"(\")\n                                            tmp = parseFunctionTypeParams()\n                                            params = tmp.params\n                                            rest = tmp.rest\n                                            expect(\")\")\n\n                                            expect(\"=>\")\n\n                                            returnType = parseType()\n\n                                            return markerApply(\n                                                marker,\n                                                delegate.createFunctionTypeAnnotation(\n                                                    params,\n                                                    returnType,\n                                                    rest,\n                                                    typeParameters\n                                                )\n                                            )\n                                        case \"(\":\n                                            lex()\n                                            // Check to see if this is actually a grouped type\n                                            if (!match(\")\") && !match(\"...\")) {\n                                                if (lookahead.type === Token.Identifier) {\n                                                    token = lookahead2()\n                                                    isGroupedType =\n                                                        token.value !== \"?\" && token.value !== \":\"\n                                                } else {\n                                                    isGroupedType = true\n                                                }\n                                            }\n\n                                            if (isGroupedType) {\n                                                type = parseType()\n                                                expect(\")\")\n\n                                                // If we see a => next then someone was probably confused about\n                                                // function types, so we can provide a better error message\n                                                if (match(\"=>\")) {\n                                                    throwError(\n                                                        {},\n                                                        Messages.ConfusedAboutFunctionType\n                                                    )\n                                                }\n\n                                                return type\n                                            }\n\n                                            tmp = parseFunctionTypeParams()\n                                            params = tmp.params\n                                            rest = tmp.rest\n\n                                            expect(\")\")\n\n                                            expect(\"=>\")\n\n                                            returnType = parseType()\n\n                                            return markerApply(\n                                                marker,\n                                                delegate.createFunctionTypeAnnotation(\n                                                    params,\n                                                    returnType,\n                                                    rest,\n                                                    null /* typeParameters */\n                                                )\n                                            )\n                                    }\n                                    break\n                                case Token.Keyword:\n                                    switch (lookahead.value) {\n                                        case \"void\":\n                                            return markerApply(marker, parseVoidType())\n                                        case \"typeof\":\n                                            return markerApply(marker, parseTypeofType())\n                                    }\n                                    break\n                                case Token.StringLiteral:\n                                    token = lex()\n                                    if (token.octal) {\n                                        throwError(token, Messages.StrictOctalLiteral)\n                                    }\n                                    return markerApply(\n                                        marker,\n                                        delegate.createStringLiteralTypeAnnotation(token)\n                                    )\n                            }\n\n                            throwUnexpected(lookahead)\n                        }\n\n                        function parsePostfixType() {\n                            var marker = markerCreate(),\n                                t = parsePrimaryType()\n                            if (match(\"[\")) {\n                                expect(\"[\")\n                                expect(\"]\")\n                                return markerApply(marker, delegate.createArrayTypeAnnotation(t))\n                            }\n                            return t\n                        }\n\n                        function parsePrefixType() {\n                            var marker = markerCreate()\n                            if (match(\"?\")) {\n                                lex()\n                                return markerApply(\n                                    marker,\n                                    delegate.createNullableTypeAnnotation(parsePrefixType())\n                                )\n                            }\n                            return parsePostfixType()\n                        }\n\n                        function parseIntersectionType() {\n                            var marker = markerCreate(),\n                                type,\n                                types\n                            type = parsePrefixType()\n                            types = [type]\n                            while (match(\"&\")) {\n                                lex()\n                                types.push(parsePrefixType())\n                            }\n\n                            return types.length === 1\n                                ? type\n                                : markerApply(\n                                      marker,\n                                      delegate.createIntersectionTypeAnnotation(types)\n                                  )\n                        }\n\n                        function parseUnionType() {\n                            var marker = markerCreate(),\n                                type,\n                                types\n                            type = parseIntersectionType()\n                            types = [type]\n                            while (match(\"|\")) {\n                                lex()\n                                types.push(parseIntersectionType())\n                            }\n                            return types.length === 1\n                                ? type\n                                : markerApply(marker, delegate.createUnionTypeAnnotation(types))\n                        }\n\n                        function parseType() {\n                            var oldInType = state.inType,\n                                type\n                            state.inType = true\n\n                            type = parseUnionType()\n\n                            state.inType = oldInType\n                            return type\n                        }\n\n                        function parseTypeAnnotation() {\n                            var marker = markerCreate(),\n                                type\n\n                            expect(\":\")\n                            type = parseType()\n\n                            return markerApply(marker, delegate.createTypeAnnotation(type))\n                        }\n\n                        function parseVariableIdentifier() {\n                            var marker = markerCreate(),\n                                token = lex()\n\n                            if (token.type !== Token.Identifier) {\n                                throwUnexpected(token)\n                            }\n\n                            return markerApply(marker, delegate.createIdentifier(token.value))\n                        }\n\n                        function parseTypeAnnotatableIdentifier(\n                            requireTypeAnnotation,\n                            canBeOptionalParam\n                        ) {\n                            var marker = markerCreate(),\n                                ident = parseVariableIdentifier(),\n                                isOptionalParam = false\n\n                            if (canBeOptionalParam && match(\"?\")) {\n                                expect(\"?\")\n                                isOptionalParam = true\n                            }\n\n                            if (requireTypeAnnotation || match(\":\")) {\n                                ident.typeAnnotation = parseTypeAnnotation()\n                                ident = markerApply(marker, ident)\n                            }\n\n                            if (isOptionalParam) {\n                                ident.optional = true\n                                ident = markerApply(marker, ident)\n                            }\n\n                            return ident\n                        }\n\n                        function parseVariableDeclaration(kind) {\n                            var id,\n                                marker = markerCreate(),\n                                init = null,\n                                typeAnnotationMarker = markerCreate()\n                            if (match(\"{\")) {\n                                id = parseObjectInitialiser()\n                                reinterpretAsAssignmentBindingPattern(id)\n                                if (match(\":\")) {\n                                    id.typeAnnotation = parseTypeAnnotation()\n                                    markerApply(typeAnnotationMarker, id)\n                                }\n                            } else if (match(\"[\")) {\n                                id = parseArrayInitialiser()\n                                reinterpretAsAssignmentBindingPattern(id)\n                                if (match(\":\")) {\n                                    id.typeAnnotation = parseTypeAnnotation()\n                                    markerApply(typeAnnotationMarker, id)\n                                }\n                            } else {\n                                /* istanbul ignore next */\n                                id = state.allowKeyword\n                                    ? parseNonComputedProperty()\n                                    : parseTypeAnnotatableIdentifier()\n                                // 12.2.1\n                                if (strict && isRestrictedWord(id.name)) {\n                                    throwErrorTolerant({}, Messages.StrictVarName)\n                                }\n                            }\n\n                            if (kind === \"const\") {\n                                if (!match(\"=\")) {\n                                    throwError({}, Messages.NoUninitializedConst)\n                                }\n                                expect(\"=\")\n                                init = parseAssignmentExpression()\n                            } else if (match(\"=\")) {\n                                lex()\n                                init = parseAssignmentExpression()\n                            }\n\n                            return markerApply(marker, delegate.createVariableDeclarator(id, init))\n                        }\n\n                        function parseVariableDeclarationList(kind) {\n                            var list = []\n\n                            do {\n                                list.push(parseVariableDeclaration(kind))\n                                if (!match(\",\")) {\n                                    break\n                                }\n                                lex()\n                            } while (index < length)\n\n                            return list\n                        }\n\n                        function parseVariableStatement() {\n                            var declarations,\n                                marker = markerCreate()\n\n                            expectKeyword(\"var\")\n\n                            declarations = parseVariableDeclarationList()\n\n                            consumeSemicolon()\n\n                            return markerApply(\n                                marker,\n                                delegate.createVariableDeclaration(declarations, \"var\")\n                            )\n                        }\n\n                        // kind may be `const` or `let`\n                        // Both are experimental and not in the specification yet.\n                        // see http://wiki.ecmascript.org/doku.php?id=harmony:const\n                        // and http://wiki.ecmascript.org/doku.php?id=harmony:let\n                        function parseConstLetDeclaration(kind) {\n                            var declarations,\n                                marker = markerCreate()\n\n                            expectKeyword(kind)\n\n                            declarations = parseVariableDeclarationList(kind)\n\n                            consumeSemicolon()\n\n                            return markerApply(\n                                marker,\n                                delegate.createVariableDeclaration(declarations, kind)\n                            )\n                        }\n\n                        // people.mozilla.org/~jorendorff/es6-draft.html\n\n                        function parseModuleSpecifier() {\n                            var marker = markerCreate(),\n                                specifier\n\n                            if (lookahead.type !== Token.StringLiteral) {\n                                throwError({}, Messages.InvalidModuleSpecifier)\n                            }\n                            specifier = delegate.createModuleSpecifier(lookahead)\n                            lex()\n                            return markerApply(marker, specifier)\n                        }\n\n                        function parseExportBatchSpecifier() {\n                            var marker = markerCreate()\n                            expect(\"*\")\n                            return markerApply(marker, delegate.createExportBatchSpecifier())\n                        }\n\n                        function parseExportSpecifier() {\n                            var id,\n                                name = null,\n                                marker = markerCreate(),\n                                from\n                            if (matchKeyword(\"default\")) {\n                                lex()\n                                id = markerApply(marker, delegate.createIdentifier(\"default\"))\n                                // export {default} from \"something\";\n                            } else {\n                                id = parseVariableIdentifier()\n                            }\n                            if (matchContextualKeyword(\"as\")) {\n                                lex()\n                                name = parseNonComputedProperty()\n                            }\n\n                            return markerApply(marker, delegate.createExportSpecifier(id, name))\n                        }\n\n                        function parseExportDeclaration() {\n                            var declaration = null,\n                                possibleIdentifierToken,\n                                sourceElement,\n                                isExportFromIdentifier,\n                                src = null,\n                                specifiers = [],\n                                marker = markerCreate()\n\n                            expectKeyword(\"export\")\n\n                            if (matchKeyword(\"default\")) {\n                                // covers:\n                                // export default ...\n                                lex()\n                                if (matchKeyword(\"function\") || matchKeyword(\"class\")) {\n                                    possibleIdentifierToken = lookahead2()\n                                    if (isIdentifierName(possibleIdentifierToken)) {\n                                        // covers:\n                                        // export default function foo () {}\n                                        // export default class foo {}\n                                        sourceElement = parseSourceElement()\n                                        return markerApply(\n                                            marker,\n                                            delegate.createExportDeclaration(\n                                                true,\n                                                sourceElement,\n                                                [sourceElement.id],\n                                                null\n                                            )\n                                        )\n                                    }\n                                    // covers:\n                                    // export default function () {}\n                                    // export default class {}\n                                    switch (lookahead.value) {\n                                        case \"class\":\n                                            return markerApply(\n                                                marker,\n                                                delegate.createExportDeclaration(\n                                                    true,\n                                                    parseClassExpression(),\n                                                    [],\n                                                    null\n                                                )\n                                            )\n                                        case \"function\":\n                                            return markerApply(\n                                                marker,\n                                                delegate.createExportDeclaration(\n                                                    true,\n                                                    parseFunctionExpression(),\n                                                    [],\n                                                    null\n                                                )\n                                            )\n                                    }\n                                }\n\n                                if (matchContextualKeyword(\"from\")) {\n                                    throwError({}, Messages.UnexpectedToken, lookahead.value)\n                                }\n\n                                // covers:\n                                // export default {};\n                                // export default [];\n                                if (match(\"{\")) {\n                                    declaration = parseObjectInitialiser()\n                                } else if (match(\"[\")) {\n                                    declaration = parseArrayInitialiser()\n                                } else {\n                                    declaration = parseAssignmentExpression()\n                                }\n                                consumeSemicolon()\n                                return markerApply(\n                                    marker,\n                                    delegate.createExportDeclaration(true, declaration, [], null)\n                                )\n                            }\n\n                            // non-default export\n                            if (\n                                lookahead.type === Token.Keyword ||\n                                matchContextualKeyword(\"type\")\n                            ) {\n                                // covers:\n                                // export var f = 1;\n                                switch (lookahead.value) {\n                                    case \"type\":\n                                    case \"let\":\n                                    case \"const\":\n                                    case \"var\":\n                                    case \"class\":\n                                    case \"function\":\n                                        return markerApply(\n                                            marker,\n                                            delegate.createExportDeclaration(\n                                                false,\n                                                parseSourceElement(),\n                                                specifiers,\n                                                null\n                                            )\n                                        )\n                                }\n                            }\n\n                            if (match(\"*\")) {\n                                // covers:\n                                // export * from \"foo\";\n                                specifiers.push(parseExportBatchSpecifier())\n\n                                if (!matchContextualKeyword(\"from\")) {\n                                    throwError(\n                                        {},\n                                        lookahead.value\n                                            ? Messages.UnexpectedToken\n                                            : Messages.MissingFromClause,\n                                        lookahead.value\n                                    )\n                                }\n                                lex()\n                                src = parseModuleSpecifier()\n                                consumeSemicolon()\n\n                                return markerApply(\n                                    marker,\n                                    delegate.createExportDeclaration(false, null, specifiers, src)\n                                )\n                            }\n\n                            expect(\"{\")\n                            if (!match(\"}\")) {\n                                do {\n                                    isExportFromIdentifier =\n                                        isExportFromIdentifier || matchKeyword(\"default\")\n                                    specifiers.push(parseExportSpecifier())\n                                } while (match(\",\") && lex())\n                            }\n                            expect(\"}\")\n\n                            if (matchContextualKeyword(\"from\")) {\n                                // covering:\n                                // export {default} from \"foo\";\n                                // export {foo} from \"foo\";\n                                lex()\n                                src = parseModuleSpecifier()\n                                consumeSemicolon()\n                            } else if (isExportFromIdentifier) {\n                                // covering:\n                                // export {default}; // missing fromClause\n                                throwError(\n                                    {},\n                                    lookahead.value\n                                        ? Messages.UnexpectedToken\n                                        : Messages.MissingFromClause,\n                                    lookahead.value\n                                )\n                            } else {\n                                // cover\n                                // export {foo};\n                                consumeSemicolon()\n                            }\n                            return markerApply(\n                                marker,\n                                delegate.createExportDeclaration(\n                                    false,\n                                    declaration,\n                                    specifiers,\n                                    src\n                                )\n                            )\n                        }\n\n                        function parseImportSpecifier() {\n                            // import {<foo as bar>} ...;\n                            var id,\n                                name = null,\n                                marker = markerCreate()\n\n                            id = parseNonComputedProperty()\n                            if (matchContextualKeyword(\"as\")) {\n                                lex()\n                                name = parseVariableIdentifier()\n                            }\n\n                            return markerApply(marker, delegate.createImportSpecifier(id, name))\n                        }\n\n                        function parseNamedImports() {\n                            var specifiers = []\n                            // {foo, bar as bas}\n                            expect(\"{\")\n                            if (!match(\"}\")) {\n                                do {\n                                    specifiers.push(parseImportSpecifier())\n                                } while (match(\",\") && lex())\n                            }\n                            expect(\"}\")\n                            return specifiers\n                        }\n\n                        function parseImportDefaultSpecifier() {\n                            // import <foo> ...;\n                            var id,\n                                marker = markerCreate()\n\n                            id = parseNonComputedProperty()\n\n                            return markerApply(marker, delegate.createImportDefaultSpecifier(id))\n                        }\n\n                        function parseImportNamespaceSpecifier() {\n                            // import <* as foo> ...;\n                            var id,\n                                marker = markerCreate()\n\n                            expect(\"*\")\n                            if (!matchContextualKeyword(\"as\")) {\n                                throwError({}, Messages.NoAsAfterImportNamespace)\n                            }\n                            lex()\n                            id = parseNonComputedProperty()\n\n                            return markerApply(marker, delegate.createImportNamespaceSpecifier(id))\n                        }\n\n                        function parseImportDeclaration() {\n                            var specifiers,\n                                src,\n                                marker = markerCreate(),\n                                isType = false,\n                                token2\n\n                            expectKeyword(\"import\")\n\n                            if (matchContextualKeyword(\"type\")) {\n                                token2 = lookahead2()\n                                if (\n                                    (token2.type === Token.Identifier && token2.value !== \"from\") ||\n                                    (token2.type === Token.Punctuator &&\n                                        (token2.value === \"{\" || token2.value === \"*\"))\n                                ) {\n                                    isType = true\n                                    lex()\n                                }\n                            }\n\n                            specifiers = []\n\n                            if (lookahead.type === Token.StringLiteral) {\n                                // covers:\n                                // import \"foo\";\n                                src = parseModuleSpecifier()\n                                consumeSemicolon()\n                                return markerApply(\n                                    marker,\n                                    delegate.createImportDeclaration(specifiers, src, isType)\n                                )\n                            }\n\n                            if (!matchKeyword(\"default\") && isIdentifierName(lookahead)) {\n                                // covers:\n                                // import foo\n                                // import foo, ...\n                                specifiers.push(parseImportDefaultSpecifier())\n                                if (match(\",\")) {\n                                    lex()\n                                }\n                            }\n                            if (match(\"*\")) {\n                                // covers:\n                                // import foo, * as foo\n                                // import * as foo\n                                specifiers.push(parseImportNamespaceSpecifier())\n                            } else if (match(\"{\")) {\n                                // covers:\n                                // import foo, {bar}\n                                // import {bar}\n                                specifiers = specifiers.concat(parseNamedImports())\n                            }\n\n                            if (!matchContextualKeyword(\"from\")) {\n                                throwError(\n                                    {},\n                                    lookahead.value\n                                        ? Messages.UnexpectedToken\n                                        : Messages.MissingFromClause,\n                                    lookahead.value\n                                )\n                            }\n                            lex()\n                            src = parseModuleSpecifier()\n                            consumeSemicolon()\n\n                            return markerApply(\n                                marker,\n                                delegate.createImportDeclaration(specifiers, src, isType)\n                            )\n                        }\n\n                        // 12.3 Empty Statement\n\n                        function parseEmptyStatement() {\n                            var marker = markerCreate()\n                            expect(\";\")\n                            return markerApply(marker, delegate.createEmptyStatement())\n                        }\n\n                        // 12.4 Expression Statement\n\n                        function parseExpressionStatement() {\n                            var marker = markerCreate(),\n                                expr = parseExpression()\n                            consumeSemicolon()\n                            return markerApply(marker, delegate.createExpressionStatement(expr))\n                        }\n\n                        // 12.5 If statement\n\n                        function parseIfStatement() {\n                            var test,\n                                consequent,\n                                alternate,\n                                marker = markerCreate()\n\n                            expectKeyword(\"if\")\n\n                            expect(\"(\")\n\n                            test = parseExpression()\n\n                            expect(\")\")\n\n                            consequent = parseStatement()\n\n                            if (matchKeyword(\"else\")) {\n                                lex()\n                                alternate = parseStatement()\n                            } else {\n                                alternate = null\n                            }\n\n                            return markerApply(\n                                marker,\n                                delegate.createIfStatement(test, consequent, alternate)\n                            )\n                        }\n\n                        // 12.6 Iteration Statements\n\n                        function parseDoWhileStatement() {\n                            var body,\n                                test,\n                                oldInIteration,\n                                marker = markerCreate()\n\n                            expectKeyword(\"do\")\n\n                            oldInIteration = state.inIteration\n                            state.inIteration = true\n\n                            body = parseStatement()\n\n                            state.inIteration = oldInIteration\n\n                            expectKeyword(\"while\")\n\n                            expect(\"(\")\n\n                            test = parseExpression()\n\n                            expect(\")\")\n\n                            if (match(\";\")) {\n                                lex()\n                            }\n\n                            return markerApply(marker, delegate.createDoWhileStatement(body, test))\n                        }\n\n                        function parseWhileStatement() {\n                            var test,\n                                body,\n                                oldInIteration,\n                                marker = markerCreate()\n\n                            expectKeyword(\"while\")\n\n                            expect(\"(\")\n\n                            test = parseExpression()\n\n                            expect(\")\")\n\n                            oldInIteration = state.inIteration\n                            state.inIteration = true\n\n                            body = parseStatement()\n\n                            state.inIteration = oldInIteration\n\n                            return markerApply(marker, delegate.createWhileStatement(test, body))\n                        }\n\n                        function parseForVariableDeclaration() {\n                            var marker = markerCreate(),\n                                token = lex(),\n                                declarations = parseVariableDeclarationList()\n\n                            return markerApply(\n                                marker,\n                                delegate.createVariableDeclaration(declarations, token.value)\n                            )\n                        }\n\n                        function parseForStatement(opts) {\n                            var init,\n                                test,\n                                update,\n                                left,\n                                right,\n                                body,\n                                operator,\n                                oldInIteration,\n                                marker = markerCreate()\n                            init = test = update = null\n                            expectKeyword(\"for\")\n\n                            // http://wiki.ecmascript.org/doku.php?id=proposals:iterators_and_generators&s=each\n                            if (matchContextualKeyword(\"each\")) {\n                                throwError({}, Messages.EachNotAllowed)\n                            }\n\n                            expect(\"(\")\n\n                            if (match(\";\")) {\n                                lex()\n                            } else {\n                                if (\n                                    matchKeyword(\"var\") ||\n                                    matchKeyword(\"let\") ||\n                                    matchKeyword(\"const\")\n                                ) {\n                                    state.allowIn = false\n                                    init = parseForVariableDeclaration()\n                                    state.allowIn = true\n\n                                    if (init.declarations.length === 1) {\n                                        if (matchKeyword(\"in\") || matchContextualKeyword(\"of\")) {\n                                            operator = lookahead\n                                            if (\n                                                !(\n                                                    (operator.value === \"in\" ||\n                                                        init.kind !== \"var\") &&\n                                                    init.declarations[0].init\n                                                )\n                                            ) {\n                                                lex()\n                                                left = init\n                                                right = parseExpression()\n                                                init = null\n                                            }\n                                        }\n                                    }\n                                } else {\n                                    state.allowIn = false\n                                    init = parseExpression()\n                                    state.allowIn = true\n\n                                    if (matchContextualKeyword(\"of\")) {\n                                        operator = lex()\n                                        left = init\n                                        right = parseExpression()\n                                        init = null\n                                    } else if (matchKeyword(\"in\")) {\n                                        // LeftHandSideExpression\n                                        if (!isAssignableLeftHandSide(init)) {\n                                            throwError({}, Messages.InvalidLHSInForIn)\n                                        }\n                                        operator = lex()\n                                        left = init\n                                        right = parseExpression()\n                                        init = null\n                                    }\n                                }\n\n                                if (typeof left === \"undefined\") {\n                                    expect(\";\")\n                                }\n                            }\n\n                            if (typeof left === \"undefined\") {\n                                if (!match(\";\")) {\n                                    test = parseExpression()\n                                }\n                                expect(\";\")\n\n                                if (!match(\")\")) {\n                                    update = parseExpression()\n                                }\n                            }\n\n                            expect(\")\")\n\n                            oldInIteration = state.inIteration\n                            state.inIteration = true\n\n                            if (!(opts !== undefined && opts.ignoreBody)) {\n                                body = parseStatement()\n                            }\n\n                            state.inIteration = oldInIteration\n\n                            if (typeof left === \"undefined\") {\n                                return markerApply(\n                                    marker,\n                                    delegate.createForStatement(init, test, update, body)\n                                )\n                            }\n\n                            if (operator.value === \"in\") {\n                                return markerApply(\n                                    marker,\n                                    delegate.createForInStatement(left, right, body)\n                                )\n                            }\n                            return markerApply(\n                                marker,\n                                delegate.createForOfStatement(left, right, body)\n                            )\n                        }\n\n                        // 12.7 The continue statement\n\n                        function parseContinueStatement() {\n                            var label = null,\n                                marker = markerCreate()\n\n                            expectKeyword(\"continue\")\n\n                            // Optimize the most common form: 'continue;'.\n                            if (source.charCodeAt(index) === 59) {\n                                lex()\n\n                                if (!state.inIteration) {\n                                    throwError({}, Messages.IllegalContinue)\n                                }\n\n                                return markerApply(marker, delegate.createContinueStatement(null))\n                            }\n\n                            if (peekLineTerminator()) {\n                                if (!state.inIteration) {\n                                    throwError({}, Messages.IllegalContinue)\n                                }\n\n                                return markerApply(marker, delegate.createContinueStatement(null))\n                            }\n\n                            if (lookahead.type === Token.Identifier) {\n                                label = parseVariableIdentifier()\n\n                                if (!state.labelSet.has(label.name)) {\n                                    throwError({}, Messages.UnknownLabel, label.name)\n                                }\n                            }\n\n                            consumeSemicolon()\n\n                            if (label === null && !state.inIteration) {\n                                throwError({}, Messages.IllegalContinue)\n                            }\n\n                            return markerApply(marker, delegate.createContinueStatement(label))\n                        }\n\n                        // 12.8 The break statement\n\n                        function parseBreakStatement() {\n                            var label = null,\n                                marker = markerCreate()\n\n                            expectKeyword(\"break\")\n\n                            // Catch the very common case first: immediately a semicolon (char #59).\n                            if (source.charCodeAt(index) === 59) {\n                                lex()\n\n                                if (!(state.inIteration || state.inSwitch)) {\n                                    throwError({}, Messages.IllegalBreak)\n                                }\n\n                                return markerApply(marker, delegate.createBreakStatement(null))\n                            }\n\n                            if (peekLineTerminator()) {\n                                if (!(state.inIteration || state.inSwitch)) {\n                                    throwError({}, Messages.IllegalBreak)\n                                }\n\n                                return markerApply(marker, delegate.createBreakStatement(null))\n                            }\n\n                            if (lookahead.type === Token.Identifier) {\n                                label = parseVariableIdentifier()\n\n                                if (!state.labelSet.has(label.name)) {\n                                    throwError({}, Messages.UnknownLabel, label.name)\n                                }\n                            }\n\n                            consumeSemicolon()\n\n                            if (label === null && !(state.inIteration || state.inSwitch)) {\n                                throwError({}, Messages.IllegalBreak)\n                            }\n\n                            return markerApply(marker, delegate.createBreakStatement(label))\n                        }\n\n                        // 12.9 The return statement\n\n                        function parseReturnStatement() {\n                            var argument = null,\n                                marker = markerCreate()\n\n                            expectKeyword(\"return\")\n\n                            if (!state.inFunctionBody) {\n                                throwErrorTolerant({}, Messages.IllegalReturn)\n                            }\n\n                            // 'return' followed by a space and an identifier is very common.\n                            if (source.charCodeAt(index) === 32) {\n                                if (isIdentifierStart(source.charCodeAt(index + 1))) {\n                                    argument = parseExpression()\n                                    consumeSemicolon()\n                                    return markerApply(\n                                        marker,\n                                        delegate.createReturnStatement(argument)\n                                    )\n                                }\n                            }\n\n                            if (peekLineTerminator()) {\n                                return markerApply(marker, delegate.createReturnStatement(null))\n                            }\n\n                            if (!match(\";\")) {\n                                if (!match(\"}\") && lookahead.type !== Token.EOF) {\n                                    argument = parseExpression()\n                                }\n                            }\n\n                            consumeSemicolon()\n\n                            return markerApply(marker, delegate.createReturnStatement(argument))\n                        }\n\n                        // 12.10 The with statement\n\n                        function parseWithStatement() {\n                            var object,\n                                body,\n                                marker = markerCreate()\n\n                            if (strict) {\n                                throwErrorTolerant({}, Messages.StrictModeWith)\n                            }\n\n                            expectKeyword(\"with\")\n\n                            expect(\"(\")\n\n                            object = parseExpression()\n\n                            expect(\")\")\n\n                            body = parseStatement()\n\n                            return markerApply(marker, delegate.createWithStatement(object, body))\n                        }\n\n                        // 12.10 The swith statement\n\n                        function parseSwitchCase() {\n                            var test,\n                                consequent = [],\n                                sourceElement,\n                                marker = markerCreate()\n\n                            if (matchKeyword(\"default\")) {\n                                lex()\n                                test = null\n                            } else {\n                                expectKeyword(\"case\")\n                                test = parseExpression()\n                            }\n                            expect(\":\")\n\n                            while (index < length) {\n                                if (match(\"}\") || matchKeyword(\"default\") || matchKeyword(\"case\")) {\n                                    break\n                                }\n                                sourceElement = parseSourceElement()\n                                if (typeof sourceElement === \"undefined\") {\n                                    break\n                                }\n                                consequent.push(sourceElement)\n                            }\n\n                            return markerApply(marker, delegate.createSwitchCase(test, consequent))\n                        }\n\n                        function parseSwitchStatement() {\n                            var discriminant,\n                                cases,\n                                clause,\n                                oldInSwitch,\n                                defaultFound,\n                                marker = markerCreate()\n\n                            expectKeyword(\"switch\")\n\n                            expect(\"(\")\n\n                            discriminant = parseExpression()\n\n                            expect(\")\")\n\n                            expect(\"{\")\n\n                            cases = []\n\n                            if (match(\"}\")) {\n                                lex()\n                                return markerApply(\n                                    marker,\n                                    delegate.createSwitchStatement(discriminant, cases)\n                                )\n                            }\n\n                            oldInSwitch = state.inSwitch\n                            state.inSwitch = true\n                            defaultFound = false\n\n                            while (index < length) {\n                                if (match(\"}\")) {\n                                    break\n                                }\n                                clause = parseSwitchCase()\n                                if (clause.test === null) {\n                                    if (defaultFound) {\n                                        throwError({}, Messages.MultipleDefaultsInSwitch)\n                                    }\n                                    defaultFound = true\n                                }\n                                cases.push(clause)\n                            }\n\n                            state.inSwitch = oldInSwitch\n\n                            expect(\"}\")\n\n                            return markerApply(\n                                marker,\n                                delegate.createSwitchStatement(discriminant, cases)\n                            )\n                        }\n\n                        // 12.13 The throw statement\n\n                        function parseThrowStatement() {\n                            var argument,\n                                marker = markerCreate()\n\n                            expectKeyword(\"throw\")\n\n                            if (peekLineTerminator()) {\n                                throwError({}, Messages.NewlineAfterThrow)\n                            }\n\n                            argument = parseExpression()\n\n                            consumeSemicolon()\n\n                            return markerApply(marker, delegate.createThrowStatement(argument))\n                        }\n\n                        // 12.14 The try statement\n\n                        function parseCatchClause() {\n                            var param,\n                                body,\n                                marker = markerCreate()\n\n                            expectKeyword(\"catch\")\n\n                            expect(\"(\")\n                            if (match(\")\")) {\n                                throwUnexpected(lookahead)\n                            }\n\n                            param = parseExpression()\n                            // 12.14.1\n                            if (\n                                strict &&\n                                param.type === Syntax.Identifier &&\n                                isRestrictedWord(param.name)\n                            ) {\n                                throwErrorTolerant({}, Messages.StrictCatchVariable)\n                            }\n\n                            expect(\")\")\n                            body = parseBlock()\n                            return markerApply(marker, delegate.createCatchClause(param, body))\n                        }\n\n                        function parseTryStatement() {\n                            var block,\n                                handlers = [],\n                                finalizer = null,\n                                marker = markerCreate()\n\n                            expectKeyword(\"try\")\n\n                            block = parseBlock()\n\n                            if (matchKeyword(\"catch\")) {\n                                handlers.push(parseCatchClause())\n                            }\n\n                            if (matchKeyword(\"finally\")) {\n                                lex()\n                                finalizer = parseBlock()\n                            }\n\n                            if (handlers.length === 0 && !finalizer) {\n                                throwError({}, Messages.NoCatchOrFinally)\n                            }\n\n                            return markerApply(\n                                marker,\n                                delegate.createTryStatement(block, [], handlers, finalizer)\n                            )\n                        }\n\n                        // 12.15 The debugger statement\n\n                        function parseDebuggerStatement() {\n                            var marker = markerCreate()\n                            expectKeyword(\"debugger\")\n\n                            consumeSemicolon()\n\n                            return markerApply(marker, delegate.createDebuggerStatement())\n                        }\n\n                        // 12 Statements\n\n                        function parseStatement() {\n                            var type = lookahead.type,\n                                marker,\n                                expr,\n                                labeledBody\n\n                            if (type === Token.EOF) {\n                                throwUnexpected(lookahead)\n                            }\n\n                            if (type === Token.Punctuator) {\n                                switch (lookahead.value) {\n                                    case \";\":\n                                        return parseEmptyStatement()\n                                    case \"{\":\n                                        return parseBlock()\n                                    case \"(\":\n                                        return parseExpressionStatement()\n                                    default:\n                                        break\n                                }\n                            }\n\n                            if (type === Token.Keyword) {\n                                switch (lookahead.value) {\n                                    case \"break\":\n                                        return parseBreakStatement()\n                                    case \"continue\":\n                                        return parseContinueStatement()\n                                    case \"debugger\":\n                                        return parseDebuggerStatement()\n                                    case \"do\":\n                                        return parseDoWhileStatement()\n                                    case \"for\":\n                                        return parseForStatement()\n                                    case \"function\":\n                                        return parseFunctionDeclaration()\n                                    case \"class\":\n                                        return parseClassDeclaration()\n                                    case \"if\":\n                                        return parseIfStatement()\n                                    case \"return\":\n                                        return parseReturnStatement()\n                                    case \"switch\":\n                                        return parseSwitchStatement()\n                                    case \"throw\":\n                                        return parseThrowStatement()\n                                    case \"try\":\n                                        return parseTryStatement()\n                                    case \"var\":\n                                        return parseVariableStatement()\n                                    case \"while\":\n                                        return parseWhileStatement()\n                                    case \"with\":\n                                        return parseWithStatement()\n                                    default:\n                                        break\n                                }\n                            }\n\n                            if (matchAsyncFuncExprOrDecl()) {\n                                return parseFunctionDeclaration()\n                            }\n\n                            marker = markerCreate()\n                            expr = parseExpression()\n\n                            // 12.12 Labelled Statements\n                            if (expr.type === Syntax.Identifier && match(\":\")) {\n                                lex()\n\n                                if (state.labelSet.has(expr.name)) {\n                                    throwError({}, Messages.Redeclaration, \"Label\", expr.name)\n                                }\n\n                                state.labelSet.set(expr.name, true)\n                                labeledBody = parseStatement()\n                                state.labelSet[\"delete\"](expr.name)\n                                return markerApply(\n                                    marker,\n                                    delegate.createLabeledStatement(expr, labeledBody)\n                                )\n                            }\n\n                            consumeSemicolon()\n\n                            return markerApply(marker, delegate.createExpressionStatement(expr))\n                        }\n\n                        // 13 Function Definition\n\n                        function parseConciseBody() {\n                            if (match(\"{\")) {\n                                return parseFunctionSourceElements()\n                            }\n                            return parseAssignmentExpression()\n                        }\n\n                        function parseFunctionSourceElements() {\n                            var sourceElement,\n                                sourceElements = [],\n                                token,\n                                directive,\n                                firstRestricted,\n                                oldLabelSet,\n                                oldInIteration,\n                                oldInSwitch,\n                                oldInFunctionBody,\n                                oldParenthesizedCount,\n                                marker = markerCreate()\n\n                            expect(\"{\")\n\n                            while (index < length) {\n                                if (lookahead.type !== Token.StringLiteral) {\n                                    break\n                                }\n                                token = lookahead\n\n                                sourceElement = parseSourceElement()\n                                sourceElements.push(sourceElement)\n                                if (sourceElement.expression.type !== Syntax.Literal) {\n                                    // this is not directive\n                                    break\n                                }\n                                directive = source.slice(token.range[0] + 1, token.range[1] - 1)\n                                if (directive === \"use strict\") {\n                                    strict = true\n                                    if (firstRestricted) {\n                                        throwErrorTolerant(\n                                            firstRestricted,\n                                            Messages.StrictOctalLiteral\n                                        )\n                                    }\n                                } else {\n                                    if (!firstRestricted && token.octal) {\n                                        firstRestricted = token\n                                    }\n                                }\n                            }\n\n                            oldLabelSet = state.labelSet\n                            oldInIteration = state.inIteration\n                            oldInSwitch = state.inSwitch\n                            oldInFunctionBody = state.inFunctionBody\n                            oldParenthesizedCount = state.parenthesizedCount\n\n                            state.labelSet = new StringMap()\n                            state.inIteration = false\n                            state.inSwitch = false\n                            state.inFunctionBody = true\n                            state.parenthesizedCount = 0\n\n                            while (index < length) {\n                                if (match(\"}\")) {\n                                    break\n                                }\n                                sourceElement = parseSourceElement()\n                                if (typeof sourceElement === \"undefined\") {\n                                    break\n                                }\n                                sourceElements.push(sourceElement)\n                            }\n\n                            expect(\"}\")\n\n                            state.labelSet = oldLabelSet\n                            state.inIteration = oldInIteration\n                            state.inSwitch = oldInSwitch\n                            state.inFunctionBody = oldInFunctionBody\n                            state.parenthesizedCount = oldParenthesizedCount\n\n                            return markerApply(\n                                marker,\n                                delegate.createBlockStatement(sourceElements)\n                            )\n                        }\n\n                        function validateParam(options, param, name) {\n                            if (strict) {\n                                if (isRestrictedWord(name)) {\n                                    options.stricted = param\n                                    options.message = Messages.StrictParamName\n                                }\n                                if (options.paramSet.has(name)) {\n                                    options.stricted = param\n                                    options.message = Messages.StrictParamDupe\n                                }\n                            } else if (!options.firstRestricted) {\n                                if (isRestrictedWord(name)) {\n                                    options.firstRestricted = param\n                                    options.message = Messages.StrictParamName\n                                } else if (isStrictModeReservedWord(name)) {\n                                    options.firstRestricted = param\n                                    options.message = Messages.StrictReservedWord\n                                } else if (options.paramSet.has(name)) {\n                                    options.firstRestricted = param\n                                    options.message = Messages.StrictParamDupe\n                                }\n                            }\n                            options.paramSet.set(name, true)\n                        }\n\n                        function parseParam(options) {\n                            var marker, token, rest, param, def\n\n                            token = lookahead\n                            if (token.value === \"...\") {\n                                token = lex()\n                                rest = true\n                            }\n\n                            if (match(\"[\")) {\n                                marker = markerCreate()\n                                param = parseArrayInitialiser()\n                                reinterpretAsDestructuredParameter(options, param)\n                                if (match(\":\")) {\n                                    param.typeAnnotation = parseTypeAnnotation()\n                                    markerApply(marker, param)\n                                }\n                            } else if (match(\"{\")) {\n                                marker = markerCreate()\n                                if (rest) {\n                                    throwError({}, Messages.ObjectPatternAsRestParameter)\n                                }\n                                param = parseObjectInitialiser()\n                                reinterpretAsDestructuredParameter(options, param)\n                                if (match(\":\")) {\n                                    param.typeAnnotation = parseTypeAnnotation()\n                                    markerApply(marker, param)\n                                }\n                            } else {\n                                param = rest\n                                    ? parseTypeAnnotatableIdentifier(\n                                          false /* requireTypeAnnotation */,\n                                          false /* canBeOptionalParam */\n                                      )\n                                    : parseTypeAnnotatableIdentifier(\n                                          false /* requireTypeAnnotation */,\n                                          true /* canBeOptionalParam */\n                                      )\n\n                                validateParam(options, token, token.value)\n                            }\n\n                            if (match(\"=\")) {\n                                if (rest) {\n                                    throwErrorTolerant(lookahead, Messages.DefaultRestParameter)\n                                }\n                                lex()\n                                def = parseAssignmentExpression()\n                                ++options.defaultCount\n                            }\n\n                            if (rest) {\n                                if (!match(\")\")) {\n                                    throwError({}, Messages.ParameterAfterRestParameter)\n                                }\n                                options.rest = param\n                                return false\n                            }\n\n                            options.params.push(param)\n                            options.defaults.push(def)\n                            return !match(\")\")\n                        }\n\n                        function parseParams(firstRestricted) {\n                            var options,\n                                marker = markerCreate()\n\n                            options = {\n                                params: [],\n                                defaultCount: 0,\n                                defaults: [],\n                                rest: null,\n                                firstRestricted: firstRestricted\n                            }\n\n                            expect(\"(\")\n\n                            if (!match(\")\")) {\n                                options.paramSet = new StringMap()\n                                while (index < length) {\n                                    if (!parseParam(options)) {\n                                        break\n                                    }\n                                    expect(\",\")\n                                }\n                            }\n\n                            expect(\")\")\n\n                            if (options.defaultCount === 0) {\n                                options.defaults = []\n                            }\n\n                            if (match(\":\")) {\n                                options.returnType = parseTypeAnnotation()\n                            }\n\n                            return markerApply(marker, options)\n                        }\n\n                        function parseFunctionDeclaration() {\n                            var id,\n                                body,\n                                token,\n                                tmp,\n                                firstRestricted,\n                                message,\n                                generator,\n                                isAsync,\n                                previousStrict,\n                                previousYieldAllowed,\n                                previousAwaitAllowed,\n                                marker = markerCreate(),\n                                typeParameters\n\n                            isAsync = false\n                            if (matchAsync()) {\n                                lex()\n                                isAsync = true\n                            }\n\n                            expectKeyword(\"function\")\n\n                            generator = false\n                            if (match(\"*\")) {\n                                lex()\n                                generator = true\n                            }\n\n                            token = lookahead\n\n                            id = parseVariableIdentifier()\n\n                            if (match(\"<\")) {\n                                typeParameters = parseTypeParameterDeclaration()\n                            }\n\n                            if (strict) {\n                                if (isRestrictedWord(token.value)) {\n                                    throwErrorTolerant(token, Messages.StrictFunctionName)\n                                }\n                            } else {\n                                if (isRestrictedWord(token.value)) {\n                                    firstRestricted = token\n                                    message = Messages.StrictFunctionName\n                                } else if (isStrictModeReservedWord(token.value)) {\n                                    firstRestricted = token\n                                    message = Messages.StrictReservedWord\n                                }\n                            }\n\n                            tmp = parseParams(firstRestricted)\n                            firstRestricted = tmp.firstRestricted\n                            if (tmp.message) {\n                                message = tmp.message\n                            }\n\n                            previousStrict = strict\n                            previousYieldAllowed = state.yieldAllowed\n                            state.yieldAllowed = generator\n                            previousAwaitAllowed = state.awaitAllowed\n                            state.awaitAllowed = isAsync\n\n                            body = parseFunctionSourceElements()\n\n                            if (strict && firstRestricted) {\n                                throwError(firstRestricted, message)\n                            }\n                            if (strict && tmp.stricted) {\n                                throwErrorTolerant(tmp.stricted, message)\n                            }\n                            strict = previousStrict\n                            state.yieldAllowed = previousYieldAllowed\n                            state.awaitAllowed = previousAwaitAllowed\n\n                            return markerApply(\n                                marker,\n                                delegate.createFunctionDeclaration(\n                                    id,\n                                    tmp.params,\n                                    tmp.defaults,\n                                    body,\n                                    tmp.rest,\n                                    generator,\n                                    false,\n                                    isAsync,\n                                    tmp.returnType,\n                                    typeParameters\n                                )\n                            )\n                        }\n\n                        function parseFunctionExpression() {\n                            var token,\n                                id = null,\n                                firstRestricted,\n                                message,\n                                tmp,\n                                body,\n                                generator,\n                                isAsync,\n                                previousStrict,\n                                previousYieldAllowed,\n                                previousAwaitAllowed,\n                                marker = markerCreate(),\n                                typeParameters\n\n                            isAsync = false\n                            if (matchAsync()) {\n                                lex()\n                                isAsync = true\n                            }\n\n                            expectKeyword(\"function\")\n\n                            generator = false\n\n                            if (match(\"*\")) {\n                                lex()\n                                generator = true\n                            }\n\n                            if (!match(\"(\")) {\n                                if (!match(\"<\")) {\n                                    token = lookahead\n                                    id = parseVariableIdentifier()\n\n                                    if (strict) {\n                                        if (isRestrictedWord(token.value)) {\n                                            throwErrorTolerant(token, Messages.StrictFunctionName)\n                                        }\n                                    } else {\n                                        if (isRestrictedWord(token.value)) {\n                                            firstRestricted = token\n                                            message = Messages.StrictFunctionName\n                                        } else if (isStrictModeReservedWord(token.value)) {\n                                            firstRestricted = token\n                                            message = Messages.StrictReservedWord\n                                        }\n                                    }\n                                }\n\n                                if (match(\"<\")) {\n                                    typeParameters = parseTypeParameterDeclaration()\n                                }\n                            }\n\n                            tmp = parseParams(firstRestricted)\n                            firstRestricted = tmp.firstRestricted\n                            if (tmp.message) {\n                                message = tmp.message\n                            }\n\n                            previousStrict = strict\n                            previousYieldAllowed = state.yieldAllowed\n                            state.yieldAllowed = generator\n                            previousAwaitAllowed = state.awaitAllowed\n                            state.awaitAllowed = isAsync\n\n                            body = parseFunctionSourceElements()\n\n                            if (strict && firstRestricted) {\n                                throwError(firstRestricted, message)\n                            }\n                            if (strict && tmp.stricted) {\n                                throwErrorTolerant(tmp.stricted, message)\n                            }\n                            strict = previousStrict\n                            state.yieldAllowed = previousYieldAllowed\n                            state.awaitAllowed = previousAwaitAllowed\n\n                            return markerApply(\n                                marker,\n                                delegate.createFunctionExpression(\n                                    id,\n                                    tmp.params,\n                                    tmp.defaults,\n                                    body,\n                                    tmp.rest,\n                                    generator,\n                                    false,\n                                    isAsync,\n                                    tmp.returnType,\n                                    typeParameters\n                                )\n                            )\n                        }\n\n                        function parseYieldExpression() {\n                            var delegateFlag,\n                                expr,\n                                marker = markerCreate()\n\n                            expectKeyword(\"yield\", !strict)\n\n                            delegateFlag = false\n                            if (match(\"*\")) {\n                                lex()\n                                delegateFlag = true\n                            }\n\n                            expr = parseAssignmentExpression()\n\n                            return markerApply(\n                                marker,\n                                delegate.createYieldExpression(expr, delegateFlag)\n                            )\n                        }\n\n                        function parseAwaitExpression() {\n                            var expr,\n                                marker = markerCreate()\n                            expectContextualKeyword(\"await\")\n                            expr = parseAssignmentExpression()\n                            return markerApply(marker, delegate.createAwaitExpression(expr))\n                        }\n\n                        // 14 Functions and classes\n\n                        // 14.1 Functions is defined above (13 in ES5)\n                        // 14.2 Arrow Functions Definitions is defined in (7.3 assignments)\n\n                        // 14.3 Method Definitions\n                        // 14.3.7\n                        function specialMethod(methodDefinition) {\n                            return (\n                                methodDefinition.kind === \"get\" ||\n                                methodDefinition.kind === \"set\" ||\n                                methodDefinition.value.generator\n                            )\n                        }\n\n                        function parseMethodDefinition(key, isStatic, generator, computed) {\n                            var token,\n                                param,\n                                propType,\n                                isAsync,\n                                typeParameters,\n                                tokenValue,\n                                returnType\n\n                            propType = isStatic\n                                ? ClassPropertyType[\"static\"]\n                                : ClassPropertyType.prototype\n\n                            if (generator) {\n                                return delegate.createMethodDefinition(\n                                    propType,\n                                    \"\",\n                                    key,\n                                    parsePropertyMethodFunction({ generator: true }),\n                                    computed\n                                )\n                            }\n\n                            tokenValue = key.type === \"Identifier\" && key.name\n\n                            if (tokenValue === \"get\" && !match(\"(\")) {\n                                key = parseObjectPropertyKey()\n\n                                expect(\"(\")\n                                expect(\")\")\n                                if (match(\":\")) {\n                                    returnType = parseTypeAnnotation()\n                                }\n                                return delegate.createMethodDefinition(\n                                    propType,\n                                    \"get\",\n                                    key,\n                                    parsePropertyFunction({\n                                        generator: false,\n                                        returnType: returnType\n                                    }),\n                                    computed\n                                )\n                            }\n                            if (tokenValue === \"set\" && !match(\"(\")) {\n                                key = parseObjectPropertyKey()\n\n                                expect(\"(\")\n                                token = lookahead\n                                param = [parseTypeAnnotatableIdentifier()]\n                                expect(\")\")\n                                if (match(\":\")) {\n                                    returnType = parseTypeAnnotation()\n                                }\n                                return delegate.createMethodDefinition(\n                                    propType,\n                                    \"set\",\n                                    key,\n                                    parsePropertyFunction({\n                                        params: param,\n                                        generator: false,\n                                        name: token,\n                                        returnType: returnType\n                                    }),\n                                    computed\n                                )\n                            }\n\n                            if (match(\"<\")) {\n                                typeParameters = parseTypeParameterDeclaration()\n                            }\n\n                            isAsync = tokenValue === \"async\" && !match(\"(\")\n                            if (isAsync) {\n                                key = parseObjectPropertyKey()\n                            }\n\n                            return delegate.createMethodDefinition(\n                                propType,\n                                \"\",\n                                key,\n                                parsePropertyMethodFunction({\n                                    generator: false,\n                                    async: isAsync,\n                                    typeParameters: typeParameters\n                                }),\n                                computed\n                            )\n                        }\n\n                        function parseClassProperty(key, computed, isStatic) {\n                            var typeAnnotation\n\n                            typeAnnotation = parseTypeAnnotation()\n                            expect(\";\")\n\n                            return delegate.createClassProperty(\n                                key,\n                                typeAnnotation,\n                                computed,\n                                isStatic\n                            )\n                        }\n\n                        function parseClassElement() {\n                            var computed = false,\n                                generator = false,\n                                key,\n                                marker = markerCreate(),\n                                isStatic = false,\n                                possiblyOpenBracketToken\n                            if (match(\";\")) {\n                                lex()\n                                return undefined\n                            }\n\n                            if (lookahead.value === \"static\") {\n                                lex()\n                                isStatic = true\n                            }\n\n                            if (match(\"*\")) {\n                                lex()\n                                generator = true\n                            }\n\n                            possiblyOpenBracketToken = lookahead\n                            if (matchContextualKeyword(\"get\") || matchContextualKeyword(\"set\")) {\n                                possiblyOpenBracketToken = lookahead2()\n                            }\n\n                            if (\n                                possiblyOpenBracketToken.type === Token.Punctuator &&\n                                possiblyOpenBracketToken.value === \"[\"\n                            ) {\n                                computed = true\n                            }\n\n                            key = parseObjectPropertyKey()\n\n                            if (!generator && lookahead.value === \":\") {\n                                return markerApply(\n                                    marker,\n                                    parseClassProperty(key, computed, isStatic)\n                                )\n                            }\n\n                            return markerApply(\n                                marker,\n                                parseMethodDefinition(key, isStatic, generator, computed)\n                            )\n                        }\n\n                        function parseClassBody() {\n                            var classElement,\n                                classElements = [],\n                                existingProps = {},\n                                marker = markerCreate(),\n                                propName,\n                                propType\n\n                            existingProps[ClassPropertyType[\"static\"]] = new StringMap()\n                            existingProps[ClassPropertyType.prototype] = new StringMap()\n\n                            expect(\"{\")\n\n                            while (index < length) {\n                                if (match(\"}\")) {\n                                    break\n                                }\n                                classElement = parseClassElement(existingProps)\n\n                                if (typeof classElement !== \"undefined\") {\n                                    classElements.push(classElement)\n\n                                    propName =\n                                        !classElement.computed && getFieldName(classElement.key)\n                                    if (propName !== false) {\n                                        propType = classElement[\"static\"]\n                                            ? ClassPropertyType[\"static\"]\n                                            : ClassPropertyType.prototype\n\n                                        if (classElement.type === Syntax.MethodDefinition) {\n                                            if (\n                                                propName === \"constructor\" &&\n                                                !classElement[\"static\"]\n                                            ) {\n                                                if (specialMethod(classElement)) {\n                                                    throwError(\n                                                        classElement,\n                                                        Messages.IllegalClassConstructorProperty\n                                                    )\n                                                }\n                                                if (\n                                                    existingProps[ClassPropertyType.prototype].has(\n                                                        \"constructor\"\n                                                    )\n                                                ) {\n                                                    throwError(\n                                                        classElement.key,\n                                                        Messages.IllegalDuplicateClassProperty\n                                                    )\n                                                }\n                                            }\n                                            existingProps[propType].set(propName, true)\n                                        }\n                                    }\n                                }\n                            }\n\n                            expect(\"}\")\n\n                            return markerApply(marker, delegate.createClassBody(classElements))\n                        }\n\n                        function parseClassImplements() {\n                            var id,\n                                implemented = [],\n                                marker,\n                                typeParameters\n                            if (strict) {\n                                expectKeyword(\"implements\")\n                            } else {\n                                expectContextualKeyword(\"implements\")\n                            }\n                            while (index < length) {\n                                marker = markerCreate()\n                                id = parseVariableIdentifier()\n                                if (match(\"<\")) {\n                                    typeParameters = parseTypeParameterInstantiation()\n                                } else {\n                                    typeParameters = null\n                                }\n                                implemented.push(\n                                    markerApply(\n                                        marker,\n                                        delegate.createClassImplements(id, typeParameters)\n                                    )\n                                )\n                                if (!match(\",\")) {\n                                    break\n                                }\n                                expect(\",\")\n                            }\n                            return implemented\n                        }\n\n                        function parseClassExpression() {\n                            var id,\n                                implemented,\n                                previousYieldAllowed,\n                                superClass = null,\n                                superTypeParameters,\n                                marker = markerCreate(),\n                                typeParameters,\n                                matchImplements\n\n                            expectKeyword(\"class\")\n\n                            matchImplements = strict\n                                ? matchKeyword(\"implements\")\n                                : matchContextualKeyword(\"implements\")\n\n                            if (!matchKeyword(\"extends\") && !matchImplements && !match(\"{\")) {\n                                id = parseVariableIdentifier()\n                            }\n\n                            if (match(\"<\")) {\n                                typeParameters = parseTypeParameterDeclaration()\n                            }\n\n                            if (matchKeyword(\"extends\")) {\n                                expectKeyword(\"extends\")\n                                previousYieldAllowed = state.yieldAllowed\n                                state.yieldAllowed = false\n                                superClass = parseLeftHandSideExpressionAllowCall()\n                                if (match(\"<\")) {\n                                    superTypeParameters = parseTypeParameterInstantiation()\n                                }\n                                state.yieldAllowed = previousYieldAllowed\n                            }\n\n                            if (\n                                strict\n                                    ? matchKeyword(\"implements\")\n                                    : matchContextualKeyword(\"implements\")\n                            ) {\n                                implemented = parseClassImplements()\n                            }\n\n                            return markerApply(\n                                marker,\n                                delegate.createClassExpression(\n                                    id,\n                                    superClass,\n                                    parseClassBody(),\n                                    typeParameters,\n                                    superTypeParameters,\n                                    implemented\n                                )\n                            )\n                        }\n\n                        function parseClassDeclaration() {\n                            var id,\n                                implemented,\n                                previousYieldAllowed,\n                                superClass = null,\n                                superTypeParameters,\n                                marker = markerCreate(),\n                                typeParameters\n\n                            expectKeyword(\"class\")\n\n                            id = parseVariableIdentifier()\n\n                            if (match(\"<\")) {\n                                typeParameters = parseTypeParameterDeclaration()\n                            }\n\n                            if (matchKeyword(\"extends\")) {\n                                expectKeyword(\"extends\")\n                                previousYieldAllowed = state.yieldAllowed\n                                state.yieldAllowed = false\n                                superClass = parseLeftHandSideExpressionAllowCall()\n                                if (match(\"<\")) {\n                                    superTypeParameters = parseTypeParameterInstantiation()\n                                }\n                                state.yieldAllowed = previousYieldAllowed\n                            }\n\n                            if (\n                                strict\n                                    ? matchKeyword(\"implements\")\n                                    : matchContextualKeyword(\"implements\")\n                            ) {\n                                implemented = parseClassImplements()\n                            }\n\n                            return markerApply(\n                                marker,\n                                delegate.createClassDeclaration(\n                                    id,\n                                    superClass,\n                                    parseClassBody(),\n                                    typeParameters,\n                                    superTypeParameters,\n                                    implemented\n                                )\n                            )\n                        }\n\n                        // 15 Program\n\n                        function parseSourceElement() {\n                            var token\n                            if (lookahead.type === Token.Keyword) {\n                                switch (lookahead.value) {\n                                    case \"const\":\n                                    case \"let\":\n                                        return parseConstLetDeclaration(lookahead.value)\n                                    case \"function\":\n                                        return parseFunctionDeclaration()\n                                    case \"export\":\n                                        throwErrorTolerant({}, Messages.IllegalExportDeclaration)\n                                        return parseExportDeclaration()\n                                    case \"import\":\n                                        throwErrorTolerant({}, Messages.IllegalImportDeclaration)\n                                        return parseImportDeclaration()\n                                    case \"interface\":\n                                        if (lookahead2().type === Token.Identifier) {\n                                            return parseInterface()\n                                        }\n                                        return parseStatement()\n                                    default:\n                                        return parseStatement()\n                                }\n                            }\n\n                            if (\n                                matchContextualKeyword(\"type\") &&\n                                lookahead2().type === Token.Identifier\n                            ) {\n                                return parseTypeAlias()\n                            }\n\n                            if (\n                                matchContextualKeyword(\"interface\") &&\n                                lookahead2().type === Token.Identifier\n                            ) {\n                                return parseInterface()\n                            }\n\n                            if (matchContextualKeyword(\"declare\")) {\n                                token = lookahead2()\n                                if (token.type === Token.Keyword) {\n                                    switch (token.value) {\n                                        case \"class\":\n                                            return parseDeclareClass()\n                                        case \"function\":\n                                            return parseDeclareFunction()\n                                        case \"var\":\n                                            return parseDeclareVariable()\n                                    }\n                                } else if (\n                                    token.type === Token.Identifier &&\n                                    token.value === \"module\"\n                                ) {\n                                    return parseDeclareModule()\n                                }\n                            }\n\n                            if (lookahead.type !== Token.EOF) {\n                                return parseStatement()\n                            }\n                        }\n\n                        function parseProgramElement() {\n                            var isModule =\n                                extra.sourceType === \"module\" ||\n                                extra.sourceType === \"nonStrictModule\"\n\n                            if (isModule && lookahead.type === Token.Keyword) {\n                                switch (lookahead.value) {\n                                    case \"export\":\n                                        return parseExportDeclaration()\n                                    case \"import\":\n                                        return parseImportDeclaration()\n                                }\n                            }\n\n                            return parseSourceElement()\n                        }\n\n                        function parseProgramElements() {\n                            var sourceElement,\n                                sourceElements = [],\n                                token,\n                                directive,\n                                firstRestricted\n\n                            while (index < length) {\n                                token = lookahead\n                                if (token.type !== Token.StringLiteral) {\n                                    break\n                                }\n\n                                sourceElement = parseProgramElement()\n                                sourceElements.push(sourceElement)\n                                if (sourceElement.expression.type !== Syntax.Literal) {\n                                    // this is not directive\n                                    break\n                                }\n                                directive = source.slice(token.range[0] + 1, token.range[1] - 1)\n                                if (directive === \"use strict\") {\n                                    strict = true\n                                    if (firstRestricted) {\n                                        throwErrorTolerant(\n                                            firstRestricted,\n                                            Messages.StrictOctalLiteral\n                                        )\n                                    }\n                                } else {\n                                    if (!firstRestricted && token.octal) {\n                                        firstRestricted = token\n                                    }\n                                }\n                            }\n\n                            while (index < length) {\n                                sourceElement = parseProgramElement()\n                                if (typeof sourceElement === \"undefined\") {\n                                    break\n                                }\n                                sourceElements.push(sourceElement)\n                            }\n                            return sourceElements\n                        }\n\n                        function parseProgram() {\n                            var body,\n                                marker = markerCreate()\n                            strict = extra.sourceType === \"module\"\n                            peek()\n                            body = parseProgramElements()\n                            return markerApply(marker, delegate.createProgram(body))\n                        }\n\n                        // 16 JSX\n\n                        XHTMLEntities = {\n                            quot: \"\\u0022\",\n                            amp: \"&\",\n                            apos: \"\\u0027\",\n                            lt: \"<\",\n                            gt: \">\",\n                            nbsp: \"\\u00A0\",\n                            iexcl: \"\\u00A1\",\n                            cent: \"\\u00A2\",\n                            pound: \"\\u00A3\",\n                            curren: \"\\u00A4\",\n                            yen: \"\\u00A5\",\n                            brvbar: \"\\u00A6\",\n                            sect: \"\\u00A7\",\n                            uml: \"\\u00A8\",\n                            copy: \"\\u00A9\",\n                            ordf: \"\\u00AA\",\n                            laquo: \"\\u00AB\",\n                            not: \"\\u00AC\",\n                            shy: \"\\u00AD\",\n                            reg: \"\\u00AE\",\n                            macr: \"\\u00AF\",\n                            deg: \"\\u00B0\",\n                            plusmn: \"\\u00B1\",\n                            sup2: \"\\u00B2\",\n                            sup3: \"\\u00B3\",\n                            acute: \"\\u00B4\",\n                            micro: \"\\u00B5\",\n                            para: \"\\u00B6\",\n                            middot: \"\\u00B7\",\n                            cedil: \"\\u00B8\",\n                            sup1: \"\\u00B9\",\n                            ordm: \"\\u00BA\",\n                            raquo: \"\\u00BB\",\n                            frac14: \"\\u00BC\",\n                            frac12: \"\\u00BD\",\n                            frac34: \"\\u00BE\",\n                            iquest: \"\\u00BF\",\n                            Agrave: \"\\u00C0\",\n                            Aacute: \"\\u00C1\",\n                            Acirc: \"\\u00C2\",\n                            Atilde: \"\\u00C3\",\n                            Auml: \"\\u00C4\",\n                            Aring: \"\\u00C5\",\n                            AElig: \"\\u00C6\",\n                            Ccedil: \"\\u00C7\",\n                            Egrave: \"\\u00C8\",\n                            Eacute: \"\\u00C9\",\n                            Ecirc: \"\\u00CA\",\n                            Euml: \"\\u00CB\",\n                            Igrave: \"\\u00CC\",\n                            Iacute: \"\\u00CD\",\n                            Icirc: \"\\u00CE\",\n                            Iuml: \"\\u00CF\",\n                            ETH: \"\\u00D0\",\n                            Ntilde: \"\\u00D1\",\n                            Ograve: \"\\u00D2\",\n                            Oacute: \"\\u00D3\",\n                            Ocirc: \"\\u00D4\",\n                            Otilde: \"\\u00D5\",\n                            Ouml: \"\\u00D6\",\n                            times: \"\\u00D7\",\n                            Oslash: \"\\u00D8\",\n                            Ugrave: \"\\u00D9\",\n                            Uacute: \"\\u00DA\",\n                            Ucirc: \"\\u00DB\",\n                            Uuml: \"\\u00DC\",\n                            Yacute: \"\\u00DD\",\n                            THORN: \"\\u00DE\",\n                            szlig: \"\\u00DF\",\n                            agrave: \"\\u00E0\",\n                            aacute: \"\\u00E1\",\n                            acirc: \"\\u00E2\",\n                            atilde: \"\\u00E3\",\n                            auml: \"\\u00E4\",\n                            aring: \"\\u00E5\",\n                            aelig: \"\\u00E6\",\n                            ccedil: \"\\u00E7\",\n                            egrave: \"\\u00E8\",\n                            eacute: \"\\u00E9\",\n                            ecirc: \"\\u00EA\",\n                            euml: \"\\u00EB\",\n                            igrave: \"\\u00EC\",\n                            iacute: \"\\u00ED\",\n                            icirc: \"\\u00EE\",\n                            iuml: \"\\u00EF\",\n                            eth: \"\\u00F0\",\n                            ntilde: \"\\u00F1\",\n                            ograve: \"\\u00F2\",\n                            oacute: \"\\u00F3\",\n                            ocirc: \"\\u00F4\",\n                            otilde: \"\\u00F5\",\n                            ouml: \"\\u00F6\",\n                            divide: \"\\u00F7\",\n                            oslash: \"\\u00F8\",\n                            ugrave: \"\\u00F9\",\n                            uacute: \"\\u00FA\",\n                            ucirc: \"\\u00FB\",\n                            uuml: \"\\u00FC\",\n                            yacute: \"\\u00FD\",\n                            thorn: \"\\u00FE\",\n                            yuml: \"\\u00FF\",\n                            OElig: \"\\u0152\",\n                            oelig: \"\\u0153\",\n                            Scaron: \"\\u0160\",\n                            scaron: \"\\u0161\",\n                            Yuml: \"\\u0178\",\n                            fnof: \"\\u0192\",\n                            circ: \"\\u02C6\",\n                            tilde: \"\\u02DC\",\n                            Alpha: \"\\u0391\",\n                            Beta: \"\\u0392\",\n                            Gamma: \"\\u0393\",\n                            Delta: \"\\u0394\",\n                            Epsilon: \"\\u0395\",\n                            Zeta: \"\\u0396\",\n                            Eta: \"\\u0397\",\n                            Theta: \"\\u0398\",\n                            Iota: \"\\u0399\",\n                            Kappa: \"\\u039A\",\n                            Lambda: \"\\u039B\",\n                            Mu: \"\\u039C\",\n                            Nu: \"\\u039D\",\n                            Xi: \"\\u039E\",\n                            Omicron: \"\\u039F\",\n                            Pi: \"\\u03A0\",\n                            Rho: \"\\u03A1\",\n                            Sigma: \"\\u03A3\",\n                            Tau: \"\\u03A4\",\n                            Upsilon: \"\\u03A5\",\n                            Phi: \"\\u03A6\",\n                            Chi: \"\\u03A7\",\n                            Psi: \"\\u03A8\",\n                            Omega: \"\\u03A9\",\n                            alpha: \"\\u03B1\",\n                            beta: \"\\u03B2\",\n                            gamma: \"\\u03B3\",\n                            delta: \"\\u03B4\",\n                            epsilon: \"\\u03B5\",\n                            zeta: \"\\u03B6\",\n                            eta: \"\\u03B7\",\n                            theta: \"\\u03B8\",\n                            iota: \"\\u03B9\",\n                            kappa: \"\\u03BA\",\n                            lambda: \"\\u03BB\",\n                            mu: \"\\u03BC\",\n                            nu: \"\\u03BD\",\n                            xi: \"\\u03BE\",\n                            omicron: \"\\u03BF\",\n                            pi: \"\\u03C0\",\n                            rho: \"\\u03C1\",\n                            sigmaf: \"\\u03C2\",\n                            sigma: \"\\u03C3\",\n                            tau: \"\\u03C4\",\n                            upsilon: \"\\u03C5\",\n                            phi: \"\\u03C6\",\n                            chi: \"\\u03C7\",\n                            psi: \"\\u03C8\",\n                            omega: \"\\u03C9\",\n                            thetasym: \"\\u03D1\",\n                            upsih: \"\\u03D2\",\n                            piv: \"\\u03D6\",\n                            ensp: \"\\u2002\",\n                            emsp: \"\\u2003\",\n                            thinsp: \"\\u2009\",\n                            zwnj: \"\\u200C\",\n                            zwj: \"\\u200D\",\n                            lrm: \"\\u200E\",\n                            rlm: \"\\u200F\",\n                            ndash: \"\\u2013\",\n                            mdash: \"\\u2014\",\n                            lsquo: \"\\u2018\",\n                            rsquo: \"\\u2019\",\n                            sbquo: \"\\u201A\",\n                            ldquo: \"\\u201C\",\n                            rdquo: \"\\u201D\",\n                            bdquo: \"\\u201E\",\n                            dagger: \"\\u2020\",\n                            Dagger: \"\\u2021\",\n                            bull: \"\\u2022\",\n                            hellip: \"\\u2026\",\n                            permil: \"\\u2030\",\n                            prime: \"\\u2032\",\n                            Prime: \"\\u2033\",\n                            lsaquo: \"\\u2039\",\n                            rsaquo: \"\\u203A\",\n                            oline: \"\\u203E\",\n                            frasl: \"\\u2044\",\n                            euro: \"\\u20AC\",\n                            image: \"\\u2111\",\n                            weierp: \"\\u2118\",\n                            real: \"\\u211C\",\n                            trade: \"\\u2122\",\n                            alefsym: \"\\u2135\",\n                            larr: \"\\u2190\",\n                            uarr: \"\\u2191\",\n                            rarr: \"\\u2192\",\n                            darr: \"\\u2193\",\n                            harr: \"\\u2194\",\n                            crarr: \"\\u21B5\",\n                            lArr: \"\\u21D0\",\n                            uArr: \"\\u21D1\",\n                            rArr: \"\\u21D2\",\n                            dArr: \"\\u21D3\",\n                            hArr: \"\\u21D4\",\n                            forall: \"\\u2200\",\n                            part: \"\\u2202\",\n                            exist: \"\\u2203\",\n                            empty: \"\\u2205\",\n                            nabla: \"\\u2207\",\n                            isin: \"\\u2208\",\n                            notin: \"\\u2209\",\n                            ni: \"\\u220B\",\n                            prod: \"\\u220F\",\n                            sum: \"\\u2211\",\n                            minus: \"\\u2212\",\n                            lowast: \"\\u2217\",\n                            radic: \"\\u221A\",\n                            prop: \"\\u221D\",\n                            infin: \"\\u221E\",\n                            ang: \"\\u2220\",\n                            and: \"\\u2227\",\n                            or: \"\\u2228\",\n                            cap: \"\\u2229\",\n                            cup: \"\\u222A\",\n                            int: \"\\u222B\",\n                            there4: \"\\u2234\",\n                            sim: \"\\u223C\",\n                            cong: \"\\u2245\",\n                            asymp: \"\\u2248\",\n                            ne: \"\\u2260\",\n                            equiv: \"\\u2261\",\n                            le: \"\\u2264\",\n                            ge: \"\\u2265\",\n                            sub: \"\\u2282\",\n                            sup: \"\\u2283\",\n                            nsub: \"\\u2284\",\n                            sube: \"\\u2286\",\n                            supe: \"\\u2287\",\n                            oplus: \"\\u2295\",\n                            otimes: \"\\u2297\",\n                            perp: \"\\u22A5\",\n                            sdot: \"\\u22C5\",\n                            lceil: \"\\u2308\",\n                            rceil: \"\\u2309\",\n                            lfloor: \"\\u230A\",\n                            rfloor: \"\\u230B\",\n                            lang: \"\\u2329\",\n                            rang: \"\\u232A\",\n                            loz: \"\\u25CA\",\n                            spades: \"\\u2660\",\n                            clubs: \"\\u2663\",\n                            hearts: \"\\u2665\",\n                            diams: \"\\u2666\"\n                        }\n\n                        function getQualifiedJSXName(object) {\n                            if (object.type === Syntax.JSXIdentifier) {\n                                return object.name\n                            }\n                            if (object.type === Syntax.JSXNamespacedName) {\n                                return object.namespace.name + \":\" + object.name.name\n                            }\n                            /* istanbul ignore else */\n                            if (object.type === Syntax.JSXMemberExpression) {\n                                return (\n                                    getQualifiedJSXName(object.object) +\n                                    \".\" +\n                                    getQualifiedJSXName(object.property)\n                                )\n                            }\n                            /* istanbul ignore next */\n                            throwUnexpected(object)\n                        }\n\n                        function isJSXIdentifierStart(ch) {\n                            // exclude backslash (\\)\n                            return ch !== 92 && isIdentifierStart(ch)\n                        }\n\n                        function isJSXIdentifierPart(ch) {\n                            // exclude backslash (\\) and add hyphen (-)\n                            return ch !== 92 && (ch === 45 || isIdentifierPart(ch))\n                        }\n\n                        function scanJSXIdentifier() {\n                            var ch,\n                                start,\n                                value = \"\"\n\n                            start = index\n                            while (index < length) {\n                                ch = source.charCodeAt(index)\n                                if (!isJSXIdentifierPart(ch)) {\n                                    break\n                                }\n                                value += source[index++]\n                            }\n\n                            return {\n                                type: Token.JSXIdentifier,\n                                value: value,\n                                lineNumber: lineNumber,\n                                lineStart: lineStart,\n                                range: [start, index]\n                            }\n                        }\n\n                        function scanJSXEntity() {\n                            var ch,\n                                str = \"\",\n                                start = index,\n                                count = 0,\n                                code\n                            ch = source[index]\n                            assert(ch === \"&\", \"Entity must start with an ampersand\")\n                            index++\n                            while (index < length && count++ < 10) {\n                                ch = source[index++]\n                                if (ch === \";\") {\n                                    break\n                                }\n                                str += ch\n                            }\n\n                            // Well-formed entity (ending was found).\n                            if (ch === \";\") {\n                                // Numeric entity.\n                                if (str[0] === \"#\") {\n                                    if (str[1] === \"x\") {\n                                        code = +(\"0\" + str.substr(1))\n                                    } else {\n                                        // Removing leading zeros in order to avoid treating as octal in old browsers.\n                                        code = +str.substr(1).replace(Regex.LeadingZeros, \"\")\n                                    }\n\n                                    if (!isNaN(code)) {\n                                        return String.fromCharCode(code)\n                                    }\n                                    /* istanbul ignore else */\n                                } else if (XHTMLEntities[str]) {\n                                    return XHTMLEntities[str]\n                                }\n                            }\n\n                            // Treat non-entity sequences as regular text.\n                            index = start + 1\n                            return \"&\"\n                        }\n\n                        function scanJSXText(stopChars) {\n                            var ch,\n                                str = \"\",\n                                start\n                            start = index\n                            while (index < length) {\n                                ch = source[index]\n                                if (stopChars.indexOf(ch) !== -1) {\n                                    break\n                                }\n                                if (ch === \"&\") {\n                                    str += scanJSXEntity()\n                                } else {\n                                    index++\n                                    if (ch === \"\\r\" && source[index] === \"\\n\") {\n                                        str += ch\n                                        ch = source[index]\n                                        index++\n                                    }\n                                    if (isLineTerminator(ch.charCodeAt(0))) {\n                                        ++lineNumber\n                                        lineStart = index\n                                    }\n                                    str += ch\n                                }\n                            }\n                            return {\n                                type: Token.JSXText,\n                                value: str,\n                                lineNumber: lineNumber,\n                                lineStart: lineStart,\n                                range: [start, index]\n                            }\n                        }\n\n                        function scanJSXStringLiteral() {\n                            var innerToken, quote, start\n\n                            quote = source[index]\n                            assert(\n                                quote === \"'\" || quote === '\"',\n                                \"String literal must starts with a quote\"\n                            )\n\n                            start = index\n                            ++index\n\n                            innerToken = scanJSXText([quote])\n\n                            if (quote !== source[index]) {\n                                throwError({}, Messages.UnexpectedToken, \"ILLEGAL\")\n                            }\n\n                            ++index\n\n                            innerToken.range = [start, index]\n\n                            return innerToken\n                        }\n\n                        /**\n                         * Between JSX opening and closing tags (e.g. <foo>HERE</foo>), anything that\n                         * is not another JSX tag and is not an expression wrapped by {} is text.\n                         */\n                        function advanceJSXChild() {\n                            var ch = source.charCodeAt(index)\n\n                            // '<' 60, '>' 62, '{' 123, '}' 125\n                            if (ch !== 60 && ch !== 62 && ch !== 123 && ch !== 125) {\n                                return scanJSXText([\"<\", \">\", \"{\", \"}\"])\n                            }\n\n                            return scanPunctuator()\n                        }\n\n                        function parseJSXIdentifier() {\n                            var token,\n                                marker = markerCreate()\n\n                            if (lookahead.type !== Token.JSXIdentifier) {\n                                throwUnexpected(lookahead)\n                            }\n\n                            token = lex()\n                            return markerApply(marker, delegate.createJSXIdentifier(token.value))\n                        }\n\n                        function parseJSXNamespacedName() {\n                            var namespace,\n                                name,\n                                marker = markerCreate()\n\n                            namespace = parseJSXIdentifier()\n                            expect(\":\")\n                            name = parseJSXIdentifier()\n\n                            return markerApply(\n                                marker,\n                                delegate.createJSXNamespacedName(namespace, name)\n                            )\n                        }\n\n                        function parseJSXMemberExpression() {\n                            var marker = markerCreate(),\n                                expr = parseJSXIdentifier()\n\n                            while (match(\".\")) {\n                                lex()\n                                expr = markerApply(\n                                    marker,\n                                    delegate.createJSXMemberExpression(expr, parseJSXIdentifier())\n                                )\n                            }\n\n                            return expr\n                        }\n\n                        function parseJSXElementName() {\n                            if (lookahead2().value === \":\") {\n                                return parseJSXNamespacedName()\n                            }\n                            if (lookahead2().value === \".\") {\n                                return parseJSXMemberExpression()\n                            }\n\n                            return parseJSXIdentifier()\n                        }\n\n                        function parseJSXAttributeName() {\n                            if (lookahead2().value === \":\") {\n                                return parseJSXNamespacedName()\n                            }\n\n                            return parseJSXIdentifier()\n                        }\n\n                        function parseJSXAttributeValue() {\n                            var value, marker\n                            if (match(\"{\")) {\n                                value = parseJSXExpressionContainer()\n                                if (value.expression.type === Syntax.JSXEmptyExpression) {\n                                    throwError(\n                                        value,\n                                        \"JSX attributes must only be assigned a non-empty \" +\n                                            \"expression\"\n                                    )\n                                }\n                            } else if (match(\"<\")) {\n                                value = parseJSXElement()\n                            } else if (lookahead.type === Token.JSXText) {\n                                marker = markerCreate()\n                                value = markerApply(marker, delegate.createLiteral(lex()))\n                            } else {\n                                throwError({}, Messages.InvalidJSXAttributeValue)\n                            }\n                            return value\n                        }\n\n                        function parseJSXEmptyExpression() {\n                            var marker = markerCreatePreserveWhitespace()\n                            while (source.charAt(index) !== \"}\") {\n                                index++\n                            }\n                            return markerApply(marker, delegate.createJSXEmptyExpression())\n                        }\n\n                        function parseJSXExpressionContainer() {\n                            var expression,\n                                origInJSXChild,\n                                origInJSXTag,\n                                marker = markerCreate()\n\n                            origInJSXChild = state.inJSXChild\n                            origInJSXTag = state.inJSXTag\n                            state.inJSXChild = false\n                            state.inJSXTag = false\n\n                            expect(\"{\")\n\n                            if (match(\"}\")) {\n                                expression = parseJSXEmptyExpression()\n                            } else {\n                                expression = parseExpression()\n                            }\n\n                            state.inJSXChild = origInJSXChild\n                            state.inJSXTag = origInJSXTag\n\n                            expect(\"}\")\n\n                            return markerApply(\n                                marker,\n                                delegate.createJSXExpressionContainer(expression)\n                            )\n                        }\n\n                        function parseJSXSpreadAttribute() {\n                            var expression,\n                                origInJSXChild,\n                                origInJSXTag,\n                                marker = markerCreate()\n\n                            origInJSXChild = state.inJSXChild\n                            origInJSXTag = state.inJSXTag\n                            state.inJSXChild = false\n                            state.inJSXTag = false\n\n                            expect(\"{\")\n                            expect(\"...\")\n\n                            expression = parseAssignmentExpression()\n\n                            state.inJSXChild = origInJSXChild\n                            state.inJSXTag = origInJSXTag\n\n                            expect(\"}\")\n\n                            return markerApply(\n                                marker,\n                                delegate.createJSXSpreadAttribute(expression)\n                            )\n                        }\n\n                        function parseJSXAttribute() {\n                            var name, marker\n\n                            if (match(\"{\")) {\n                                return parseJSXSpreadAttribute()\n                            }\n\n                            marker = markerCreate()\n\n                            name = parseJSXAttributeName()\n\n                            // HTML empty attribute\n                            if (match(\"=\")) {\n                                lex()\n                                return markerApply(\n                                    marker,\n                                    delegate.createJSXAttribute(name, parseJSXAttributeValue())\n                                )\n                            }\n\n                            return markerApply(marker, delegate.createJSXAttribute(name))\n                        }\n\n                        function parseJSXChild() {\n                            var token, marker\n                            if (match(\"{\")) {\n                                token = parseJSXExpressionContainer()\n                            } else if (lookahead.type === Token.JSXText) {\n                                marker = markerCreatePreserveWhitespace()\n                                token = markerApply(marker, delegate.createLiteral(lex()))\n                            } else if (match(\"<\")) {\n                                token = parseJSXElement()\n                            } else {\n                                throwUnexpected(lookahead)\n                            }\n                            return token\n                        }\n\n                        function parseJSXClosingElement() {\n                            var name,\n                                origInJSXChild,\n                                origInJSXTag,\n                                marker = markerCreate()\n                            origInJSXChild = state.inJSXChild\n                            origInJSXTag = state.inJSXTag\n                            state.inJSXChild = false\n                            state.inJSXTag = true\n                            expect(\"<\")\n                            expect(\"/\")\n                            name = parseJSXElementName()\n                            // Because advance() (called by lex() called by expect()) expects there\n                            // to be a valid token after >, it needs to know whether to look for a\n                            // standard JS token or an JSX text node\n                            state.inJSXChild = origInJSXChild\n                            state.inJSXTag = origInJSXTag\n                            expect(\">\")\n                            return markerApply(marker, delegate.createJSXClosingElement(name))\n                        }\n\n                        function parseJSXOpeningElement() {\n                            var name,\n                                attributes = [],\n                                selfClosing = false,\n                                origInJSXChild,\n                                origInJSXTag,\n                                marker = markerCreate()\n\n                            origInJSXChild = state.inJSXChild\n                            origInJSXTag = state.inJSXTag\n                            state.inJSXChild = false\n                            state.inJSXTag = true\n\n                            expect(\"<\")\n\n                            name = parseJSXElementName()\n\n                            while (\n                                index < length &&\n                                lookahead.value !== \"/\" &&\n                                lookahead.value !== \">\"\n                            ) {\n                                attributes.push(parseJSXAttribute())\n                            }\n\n                            state.inJSXTag = origInJSXTag\n\n                            if (lookahead.value === \"/\") {\n                                expect(\"/\")\n                                // Because advance() (called by lex() called by expect()) expects\n                                // there to be a valid token after >, it needs to know whether to\n                                // look for a standard JS token or an JSX text node\n                                state.inJSXChild = origInJSXChild\n                                expect(\">\")\n                                selfClosing = true\n                            } else {\n                                state.inJSXChild = true\n                                expect(\">\")\n                            }\n                            return markerApply(\n                                marker,\n                                delegate.createJSXOpeningElement(name, attributes, selfClosing)\n                            )\n                        }\n\n                        function parseJSXElement() {\n                            var openingElement,\n                                closingElement = null,\n                                children = [],\n                                origInJSXChild,\n                                origInJSXTag,\n                                marker = markerCreate()\n\n                            origInJSXChild = state.inJSXChild\n                            origInJSXTag = state.inJSXTag\n                            openingElement = parseJSXOpeningElement()\n\n                            if (!openingElement.selfClosing) {\n                                while (index < length) {\n                                    state.inJSXChild = false // Call lookahead2() with inJSXChild = false because </ should not be considered in the child\n                                    if (lookahead.value === \"<\" && lookahead2().value === \"/\") {\n                                        break\n                                    }\n                                    state.inJSXChild = true\n                                    children.push(parseJSXChild())\n                                }\n                                state.inJSXChild = origInJSXChild\n                                state.inJSXTag = origInJSXTag\n                                closingElement = parseJSXClosingElement()\n                                if (\n                                    getQualifiedJSXName(closingElement.name) !==\n                                    getQualifiedJSXName(openingElement.name)\n                                ) {\n                                    throwError(\n                                        {},\n                                        Messages.ExpectedJSXClosingTag,\n                                        getQualifiedJSXName(openingElement.name)\n                                    )\n                                }\n                            }\n\n                            // When (erroneously) writing two adjacent tags like\n                            //\n                            //     var x = <div>one</div><div>two</div>;\n                            //\n                            // the default error message is a bit incomprehensible. Since it's\n                            // rarely (never?) useful to write a less-than sign after an JSX\n                            // element, we disallow it here in the parser in order to provide a\n                            // better error message. (In the rare case that the less-than operator\n                            // was intended, the left tag can be wrapped in parentheses.)\n                            if (!origInJSXChild && match(\"<\")) {\n                                throwError(lookahead, Messages.AdjacentJSXElements)\n                            }\n\n                            return markerApply(\n                                marker,\n                                delegate.createJSXElement(openingElement, closingElement, children)\n                            )\n                        }\n\n                        function parseTypeAlias() {\n                            var id,\n                                marker = markerCreate(),\n                                typeParameters = null,\n                                right\n                            expectContextualKeyword(\"type\")\n                            id = parseVariableIdentifier()\n                            if (match(\"<\")) {\n                                typeParameters = parseTypeParameterDeclaration()\n                            }\n                            expect(\"=\")\n                            right = parseType()\n                            consumeSemicolon()\n                            return markerApply(\n                                marker,\n                                delegate.createTypeAlias(id, typeParameters, right)\n                            )\n                        }\n\n                        function parseInterfaceExtends() {\n                            var marker = markerCreate(),\n                                id,\n                                typeParameters = null\n\n                            id = parseVariableIdentifier()\n                            if (match(\"<\")) {\n                                typeParameters = parseTypeParameterInstantiation()\n                            }\n\n                            return markerApply(\n                                marker,\n                                delegate.createInterfaceExtends(id, typeParameters)\n                            )\n                        }\n\n                        function parseInterfaceish(marker, allowStatic) {\n                            var body,\n                                bodyMarker,\n                                extended = [],\n                                id,\n                                typeParameters = null\n\n                            id = parseVariableIdentifier()\n                            if (match(\"<\")) {\n                                typeParameters = parseTypeParameterDeclaration()\n                            }\n\n                            if (matchKeyword(\"extends\")) {\n                                expectKeyword(\"extends\")\n\n                                while (index < length) {\n                                    extended.push(parseInterfaceExtends())\n                                    if (!match(\",\")) {\n                                        break\n                                    }\n                                    expect(\",\")\n                                }\n                            }\n\n                            bodyMarker = markerCreate()\n                            body = markerApply(bodyMarker, parseObjectType(allowStatic))\n\n                            return markerApply(\n                                marker,\n                                delegate.createInterface(id, typeParameters, body, extended)\n                            )\n                        }\n\n                        function parseInterface() {\n                            var marker = markerCreate()\n\n                            if (strict) {\n                                expectKeyword(\"interface\")\n                            } else {\n                                expectContextualKeyword(\"interface\")\n                            }\n\n                            return parseInterfaceish(marker, /* allowStatic */ false)\n                        }\n\n                        function parseDeclareClass() {\n                            var marker = markerCreate(),\n                                ret\n                            expectContextualKeyword(\"declare\")\n                            expectKeyword(\"class\")\n\n                            ret = parseInterfaceish(marker, /* allowStatic */ true)\n                            ret.type = Syntax.DeclareClass\n                            return ret\n                        }\n\n                        function parseDeclareFunction() {\n                            var id,\n                                idMarker,\n                                marker = markerCreate(),\n                                params,\n                                returnType,\n                                rest,\n                                tmp,\n                                typeParameters = null,\n                                value,\n                                valueMarker\n\n                            expectContextualKeyword(\"declare\")\n                            expectKeyword(\"function\")\n                            idMarker = markerCreate()\n                            id = parseVariableIdentifier()\n\n                            valueMarker = markerCreate()\n                            if (match(\"<\")) {\n                                typeParameters = parseTypeParameterDeclaration()\n                            }\n                            expect(\"(\")\n                            tmp = parseFunctionTypeParams()\n                            params = tmp.params\n                            rest = tmp.rest\n                            expect(\")\")\n\n                            expect(\":\")\n                            returnType = parseType()\n\n                            value = markerApply(\n                                valueMarker,\n                                delegate.createFunctionTypeAnnotation(\n                                    params,\n                                    returnType,\n                                    rest,\n                                    typeParameters\n                                )\n                            )\n\n                            id.typeAnnotation = markerApply(\n                                valueMarker,\n                                delegate.createTypeAnnotation(value)\n                            )\n                            markerApply(idMarker, id)\n\n                            consumeSemicolon()\n\n                            return markerApply(marker, delegate.createDeclareFunction(id))\n                        }\n\n                        function parseDeclareVariable() {\n                            var id,\n                                marker = markerCreate()\n                            expectContextualKeyword(\"declare\")\n                            expectKeyword(\"var\")\n                            id = parseTypeAnnotatableIdentifier()\n\n                            consumeSemicolon()\n\n                            return markerApply(marker, delegate.createDeclareVariable(id))\n                        }\n\n                        function parseDeclareModule() {\n                            var body = [],\n                                bodyMarker,\n                                id,\n                                idMarker,\n                                marker = markerCreate(),\n                                token\n                            expectContextualKeyword(\"declare\")\n                            expectContextualKeyword(\"module\")\n\n                            if (lookahead.type === Token.StringLiteral) {\n                                if (strict && lookahead.octal) {\n                                    throwErrorTolerant(lookahead, Messages.StrictOctalLiteral)\n                                }\n                                idMarker = markerCreate()\n                                id = markerApply(idMarker, delegate.createLiteral(lex()))\n                            } else {\n                                id = parseVariableIdentifier()\n                            }\n\n                            bodyMarker = markerCreate()\n                            expect(\"{\")\n                            while (index < length && !match(\"}\")) {\n                                token = lookahead2()\n                                switch (token.value) {\n                                    case \"class\":\n                                        body.push(parseDeclareClass())\n                                        break\n                                    case \"function\":\n                                        body.push(parseDeclareFunction())\n                                        break\n                                    case \"var\":\n                                        body.push(parseDeclareVariable())\n                                        break\n                                    default:\n                                        throwUnexpected(lookahead)\n                                }\n                            }\n                            expect(\"}\")\n\n                            return markerApply(\n                                marker,\n                                delegate.createDeclareModule(\n                                    id,\n                                    markerApply(bodyMarker, delegate.createBlockStatement(body))\n                                )\n                            )\n                        }\n\n                        function collectToken() {\n                            var loc, token, range, value, entry\n\n                            /* istanbul ignore else */\n                            if (!state.inJSXChild) {\n                                skipComment()\n                            }\n\n                            loc = {\n                                start: {\n                                    line: lineNumber,\n                                    column: index - lineStart\n                                }\n                            }\n\n                            token = extra.advance()\n                            loc.end = {\n                                line: lineNumber,\n                                column: index - lineStart\n                            }\n\n                            if (token.type !== Token.EOF) {\n                                range = [token.range[0], token.range[1]]\n                                value = source.slice(token.range[0], token.range[1])\n                                entry = {\n                                    type: TokenName[token.type],\n                                    value: value,\n                                    range: range,\n                                    loc: loc\n                                }\n                                if (token.regex) {\n                                    entry.regex = {\n                                        pattern: token.regex.pattern,\n                                        flags: token.regex.flags\n                                    }\n                                }\n                                extra.tokens.push(entry)\n                            }\n\n                            return token\n                        }\n\n                        function collectRegex() {\n                            var pos, loc, regex, token\n\n                            skipComment()\n\n                            pos = index\n                            loc = {\n                                start: {\n                                    line: lineNumber,\n                                    column: index - lineStart\n                                }\n                            }\n\n                            regex = extra.scanRegExp()\n                            loc.end = {\n                                line: lineNumber,\n                                column: index - lineStart\n                            }\n\n                            if (!extra.tokenize) {\n                                /* istanbul ignore next */\n                                // Pop the previous token, which is likely '/' or '/='\n                                if (extra.tokens.length > 0) {\n                                    token = extra.tokens[extra.tokens.length - 1]\n                                    if (token.range[0] === pos && token.type === \"Punctuator\") {\n                                        if (token.value === \"/\" || token.value === \"/=\") {\n                                            extra.tokens.pop()\n                                        }\n                                    }\n                                }\n\n                                extra.tokens.push({\n                                    type: \"RegularExpression\",\n                                    value: regex.literal,\n                                    regex: regex.regex,\n                                    range: [pos, index],\n                                    loc: loc\n                                })\n                            }\n\n                            return regex\n                        }\n\n                        function filterTokenLocation() {\n                            var i,\n                                entry,\n                                token,\n                                tokens = []\n\n                            for (i = 0; i < extra.tokens.length; ++i) {\n                                entry = extra.tokens[i]\n                                token = {\n                                    type: entry.type,\n                                    value: entry.value\n                                }\n                                if (entry.regex) {\n                                    token.regex = {\n                                        pattern: entry.regex.pattern,\n                                        flags: entry.regex.flags\n                                    }\n                                }\n                                if (extra.range) {\n                                    token.range = entry.range\n                                }\n                                if (extra.loc) {\n                                    token.loc = entry.loc\n                                }\n                                tokens.push(token)\n                            }\n\n                            extra.tokens = tokens\n                        }\n\n                        function patch() {\n                            if (typeof extra.tokens !== \"undefined\") {\n                                extra.advance = advance\n                                extra.scanRegExp = scanRegExp\n\n                                advance = collectToken\n                                scanRegExp = collectRegex\n                            }\n                        }\n\n                        function unpatch() {\n                            if (typeof extra.scanRegExp === \"function\") {\n                                advance = extra.advance\n                                scanRegExp = extra.scanRegExp\n                            }\n                        }\n\n                        // This is used to modify the delegate.\n\n                        function extend(object, properties) {\n                            var entry,\n                                result = {}\n\n                            for (entry in object) {\n                                /* istanbul ignore else */\n                                if (object.hasOwnProperty(entry)) {\n                                    result[entry] = object[entry]\n                                }\n                            }\n\n                            for (entry in properties) {\n                                /* istanbul ignore else */\n                                if (properties.hasOwnProperty(entry)) {\n                                    result[entry] = properties[entry]\n                                }\n                            }\n\n                            return result\n                        }\n\n                        function tokenize(code, options) {\n                            var toString, token, tokens\n\n                            toString = String\n                            if (typeof code !== \"string\" && !(code instanceof String)) {\n                                code = toString(code)\n                            }\n\n                            delegate = SyntaxTreeDelegate\n                            source = code\n                            index = 0\n                            lineNumber = source.length > 0 ? 1 : 0\n                            lineStart = 0\n                            length = source.length\n                            lookahead = null\n                            state = {\n                                allowKeyword: true,\n                                allowIn: true,\n                                labelSet: new StringMap(),\n                                inFunctionBody: false,\n                                inIteration: false,\n                                inSwitch: false,\n                                lastCommentStart: -1\n                            }\n\n                            extra = {}\n\n                            // Options matching.\n                            options = options || {}\n\n                            // Of course we collect tokens here.\n                            options.tokens = true\n                            extra.tokens = []\n                            extra.tokenize = true\n                            // The following two fields are necessary to compute the Regex tokens.\n                            extra.openParenToken = -1\n                            extra.openCurlyToken = -1\n\n                            extra.range = typeof options.range === \"boolean\" && options.range\n                            extra.loc = typeof options.loc === \"boolean\" && options.loc\n\n                            if (typeof options.comment === \"boolean\" && options.comment) {\n                                extra.comments = []\n                            }\n                            if (typeof options.tolerant === \"boolean\" && options.tolerant) {\n                                extra.errors = []\n                            }\n\n                            patch()\n\n                            try {\n                                peek()\n                                if (lookahead.type === Token.EOF) {\n                                    return extra.tokens\n                                }\n\n                                token = lex()\n                                while (lookahead.type !== Token.EOF) {\n                                    try {\n                                        token = lex()\n                                    } catch (lexError) {\n                                        token = lookahead\n                                        if (extra.errors) {\n                                            extra.errors.push(lexError)\n                                            // We have to break on the first error\n                                            // to avoid infinite loops.\n                                            break\n                                        } else {\n                                            throw lexError\n                                        }\n                                    }\n                                }\n\n                                filterTokenLocation()\n                                tokens = extra.tokens\n                                if (typeof extra.comments !== \"undefined\") {\n                                    tokens.comments = extra.comments\n                                }\n                                if (typeof extra.errors !== \"undefined\") {\n                                    tokens.errors = extra.errors\n                                }\n                            } catch (e) {\n                                throw e\n                            } finally {\n                                unpatch()\n                                extra = {}\n                            }\n                            return tokens\n                        }\n\n                        function parse(code, options) {\n                            var program, toString\n\n                            toString = String\n                            if (typeof code !== \"string\" && !(code instanceof String)) {\n                                code = toString(code)\n                            }\n\n                            delegate = SyntaxTreeDelegate\n                            source = code\n                            index = 0\n                            lineNumber = source.length > 0 ? 1 : 0\n                            lineStart = 0\n                            length = source.length\n                            lookahead = null\n                            state = {\n                                allowKeyword: false,\n                                allowIn: true,\n                                labelSet: new StringMap(),\n                                parenthesizedCount: 0,\n                                inFunctionBody: false,\n                                inIteration: false,\n                                inSwitch: false,\n                                inJSXChild: false,\n                                inJSXTag: false,\n                                inType: false,\n                                lastCommentStart: -1,\n                                yieldAllowed: false,\n                                awaitAllowed: false\n                            }\n\n                            extra = {}\n                            if (typeof options !== \"undefined\") {\n                                extra.range = typeof options.range === \"boolean\" && options.range\n                                extra.loc = typeof options.loc === \"boolean\" && options.loc\n                                extra.attachComment =\n                                    typeof options.attachComment === \"boolean\" &&\n                                    options.attachComment\n\n                                if (\n                                    extra.loc &&\n                                    options.source !== null &&\n                                    options.source !== undefined\n                                ) {\n                                    delegate = extend(delegate, {\n                                        postProcess: function(node) {\n                                            node.loc.source = toString(options.source)\n                                            return node\n                                        }\n                                    })\n                                }\n\n                                extra.sourceType = options.sourceType\n                                if (typeof options.tokens === \"boolean\" && options.tokens) {\n                                    extra.tokens = []\n                                }\n                                if (typeof options.comment === \"boolean\" && options.comment) {\n                                    extra.comments = []\n                                }\n                                if (typeof options.tolerant === \"boolean\" && options.tolerant) {\n                                    extra.errors = []\n                                }\n                                if (extra.attachComment) {\n                                    extra.range = true\n                                    extra.comments = []\n                                    extra.bottomRightStack = []\n                                    extra.trailingComments = []\n                                    extra.leadingComments = []\n                                }\n                            }\n\n                            patch()\n                            try {\n                                program = parseProgram()\n                                if (typeof extra.comments !== \"undefined\") {\n                                    program.comments = extra.comments\n                                }\n                                if (typeof extra.tokens !== \"undefined\") {\n                                    filterTokenLocation()\n                                    program.tokens = extra.tokens\n                                }\n                                if (typeof extra.errors !== \"undefined\") {\n                                    program.errors = extra.errors\n                                }\n                            } catch (e) {\n                                throw e\n                            } finally {\n                                unpatch()\n                                extra = {}\n                            }\n\n                            return program\n                        }\n\n                        // Sync with *.json manifests.\n                        exports.version = \"13001.1001.0-dev-harmony-fb\"\n\n                        exports.tokenize = tokenize\n\n                        exports.parse = parse\n\n                        // Deep copy.\n                        /* istanbul ignore next */\n                        exports.Syntax = (function() {\n                            var name,\n                                types = {}\n\n                            if (typeof Object.create === \"function\") {\n                                types = Object.create(null)\n                            }\n\n                            for (name in Syntax) {\n                                if (Syntax.hasOwnProperty(name)) {\n                                    types[name] = Syntax[name]\n                                }\n                            }\n\n                            if (typeof Object.freeze === \"function\") {\n                                Object.freeze(types)\n                            }\n\n                            return types\n                        })()\n                    })\n                    /* vim: set sw=4 ts=4 et tw=80 : */\n                },\n                {}\n            ],\n            10: [\n                function(_dereq_, module, exports) {\n                    var Base62 = (function(my) {\n                        my.chars = [\n                            \"0\",\n                            \"1\",\n                            \"2\",\n                            \"3\",\n                            \"4\",\n                            \"5\",\n                            \"6\",\n                            \"7\",\n                            \"8\",\n                            \"9\",\n                            \"a\",\n                            \"b\",\n                            \"c\",\n                            \"d\",\n                            \"e\",\n                            \"f\",\n                            \"g\",\n                            \"h\",\n                            \"i\",\n                            \"j\",\n                            \"k\",\n                            \"l\",\n                            \"m\",\n                            \"n\",\n                            \"o\",\n                            \"p\",\n                            \"q\",\n                            \"r\",\n                            \"s\",\n                            \"t\",\n                            \"u\",\n                            \"v\",\n                            \"w\",\n                            \"x\",\n                            \"y\",\n                            \"z\",\n                            \"A\",\n                            \"B\",\n                            \"C\",\n                            \"D\",\n                            \"E\",\n                            \"F\",\n                            \"G\",\n                            \"H\",\n                            \"I\",\n                            \"J\",\n                            \"K\",\n                            \"L\",\n                            \"M\",\n                            \"N\",\n                            \"O\",\n                            \"P\",\n                            \"Q\",\n                            \"R\",\n                            \"S\",\n                            \"T\",\n                            \"U\",\n                            \"V\",\n                            \"W\",\n                            \"X\",\n                            \"Y\",\n                            \"Z\"\n                        ]\n\n                        my.encode = function(i) {\n                            if (i === 0) {\n                                return \"0\"\n                            }\n                            var s = \"\"\n                            while (i > 0) {\n                                s = this.chars[i % 62] + s\n                                i = Math.floor(i / 62)\n                            }\n                            return s\n                        }\n                        my.decode = function(a, b, c, d) {\n                            for (\n                                b = c = (a === (/\\W|_|^$/.test((a += \"\")) || a)) - 1;\n                                (d = a.charCodeAt(c++));\n\n                            )\n                                b = b * 62 + d - [, 48, 29, 87][d >> 5]\n                            return b\n                        }\n\n                        return my\n                    })({})\n\n                    module.exports = Base62\n                },\n                {}\n            ],\n            11: [\n                function(_dereq_, module, exports) {\n                    /*\n                     * Copyright 2009-2011 Mozilla Foundation and contributors\n                     * Licensed under the New BSD license. See LICENSE.txt or:\n                     * http://opensource.org/licenses/BSD-3-Clause\n                     */\n                    exports.SourceMapGenerator = _dereq_(\n                        \"./source-map/source-map-generator\"\n                    ).SourceMapGenerator\n                    exports.SourceMapConsumer = _dereq_(\n                        \"./source-map/source-map-consumer\"\n                    ).SourceMapConsumer\n                    exports.SourceNode = _dereq_(\"./source-map/source-node\").SourceNode\n                },\n                {\n                    \"./source-map/source-map-consumer\": 16,\n                    \"./source-map/source-map-generator\": 17,\n                    \"./source-map/source-node\": 18\n                }\n            ],\n            12: [\n                function(_dereq_, module, exports) {\n                    /* -*- Mode: js; js-indent-level: 2; -*- */\n                    /*\n                     * Copyright 2011 Mozilla Foundation and contributors\n                     * Licensed under the New BSD license. See LICENSE or:\n                     * http://opensource.org/licenses/BSD-3-Clause\n                     */\n                    if (typeof define !== \"function\") {\n                        var define = _dereq_(\"amdefine\")(module, _dereq_)\n                    }\n                    define(function(_dereq_, exports, module) {\n                        var util = _dereq_(\"./util\")\n\n                        /**\n                         * A data structure which is a combination of an array and a set. Adding a new\n                         * member is O(1), testing for membership is O(1), and finding the index of an\n                         * element is O(1). Removing elements from the set is not supported. Only\n                         * strings are supported for membership.\n                         */\n                        function ArraySet() {\n                            this._array = []\n                            this._set = {}\n                        }\n\n                        /**\n                         * Static method for creating ArraySet instances from an existing array.\n                         */\n                        ArraySet.fromArray = function ArraySet_fromArray(aArray, aAllowDuplicates) {\n                            var set = new ArraySet()\n                            for (var i = 0, len = aArray.length; i < len; i++) {\n                                set.add(aArray[i], aAllowDuplicates)\n                            }\n                            return set\n                        }\n\n                        /**\n                         * Add the given string to this set.\n                         *\n                         * @param String aStr\n                         */\n                        ArraySet.prototype.add = function ArraySet_add(aStr, aAllowDuplicates) {\n                            var isDuplicate = this.has(aStr)\n                            var idx = this._array.length\n                            if (!isDuplicate || aAllowDuplicates) {\n                                this._array.push(aStr)\n                            }\n                            if (!isDuplicate) {\n                                this._set[util.toSetString(aStr)] = idx\n                            }\n                        }\n\n                        /**\n                         * Is the given string a member of this set?\n                         *\n                         * @param String aStr\n                         */\n                        ArraySet.prototype.has = function ArraySet_has(aStr) {\n                            return Object.prototype.hasOwnProperty.call(\n                                this._set,\n                                util.toSetString(aStr)\n                            )\n                        }\n\n                        /**\n                         * What is the index of the given string in the array?\n                         *\n                         * @param String aStr\n                         */\n                        ArraySet.prototype.indexOf = function ArraySet_indexOf(aStr) {\n                            if (this.has(aStr)) {\n                                return this._set[util.toSetString(aStr)]\n                            }\n                            throw new Error('\"' + aStr + '\" is not in the set.')\n                        }\n\n                        /**\n                         * What is the element at the given index?\n                         *\n                         * @param Number aIdx\n                         */\n                        ArraySet.prototype.at = function ArraySet_at(aIdx) {\n                            if (aIdx >= 0 && aIdx < this._array.length) {\n                                return this._array[aIdx]\n                            }\n                            throw new Error(\"No element indexed by \" + aIdx)\n                        }\n\n                        /**\n                         * Returns the array representation of this set (which has the proper indices\n                         * indicated by indexOf). Note that this is a copy of the internal array used\n                         * for storing the members so that no one can mess with internal state.\n                         */\n                        ArraySet.prototype.toArray = function ArraySet_toArray() {\n                            return this._array.slice()\n                        }\n\n                        exports.ArraySet = ArraySet\n                    })\n                },\n                { \"./util\": 19, amdefine: 20 }\n            ],\n            13: [\n                function(_dereq_, module, exports) {\n                    /* -*- Mode: js; js-indent-level: 2; -*- */\n                    /*\n                     * Copyright 2011 Mozilla Foundation and contributors\n                     * Licensed under the New BSD license. See LICENSE or:\n                     * http://opensource.org/licenses/BSD-3-Clause\n                     *\n                     * Based on the Base 64 VLQ implementation in Closure Compiler:\n                     * https://code.google.com/p/closure-compiler/source/browse/trunk/src/com/google/debugging/sourcemap/Base64VLQ.java\n                     *\n                     * Copyright 2011 The Closure Compiler Authors. All rights reserved.\n                     * Redistribution and use in source and binary forms, with or without\n                     * modification, are permitted provided that the following conditions are\n                     * met:\n                     *\n                     *  * Redistributions of source code must retain the above copyright\n                     *    notice, this list of conditions and the following disclaimer.\n                     *  * Redistributions in binary form must reproduce the above\n                     *    copyright notice, this list of conditions and the following\n                     *    disclaimer in the documentation and/or other materials provided\n                     *    with the distribution.\n                     *  * Neither the name of Google Inc. nor the names of its\n                     *    contributors may be used to endorse or promote products derived\n                     *    from this software without specific prior written permission.\n                     *\n                     * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n                     * \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n                     * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n                     * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n                     * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n                     * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n                     * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n                     * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n                     * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n                     * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n                     * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n                     */\n                    if (typeof define !== \"function\") {\n                        var define = _dereq_(\"amdefine\")(module, _dereq_)\n                    }\n                    define(function(_dereq_, exports, module) {\n                        var base64 = _dereq_(\"./base64\")\n\n                        // A single base 64 digit can contain 6 bits of data. For the base 64 variable\n                        // length quantities we use in the source map spec, the first bit is the sign,\n                        // the next four bits are the actual value, and the 6th bit is the\n                        // continuation bit. The continuation bit tells us whether there are more\n                        // digits in this value following this digit.\n                        //\n                        //   Continuation\n                        //   |    Sign\n                        //   |    |\n                        //   V    V\n                        //   101011\n\n                        var VLQ_BASE_SHIFT = 5\n\n                        // binary: 100000\n                        var VLQ_BASE = 1 << VLQ_BASE_SHIFT\n\n                        // binary: 011111\n                        var VLQ_BASE_MASK = VLQ_BASE - 1\n\n                        // binary: 100000\n                        var VLQ_CONTINUATION_BIT = VLQ_BASE\n\n                        /**\n                         * Converts from a two-complement value to a value where the sign bit is\n                         * is placed in the least significant bit.  For example, as decimals:\n                         *   1 becomes 2 (10 binary), -1 becomes 3 (11 binary)\n                         *   2 becomes 4 (100 binary), -2 becomes 5 (101 binary)\n                         */\n                        function toVLQSigned(aValue) {\n                            return aValue < 0 ? (-aValue << 1) + 1 : (aValue << 1) + 0\n                        }\n\n                        /**\n                         * Converts to a two-complement value from a value where the sign bit is\n                         * is placed in the least significant bit.  For example, as decimals:\n                         *   2 (10 binary) becomes 1, 3 (11 binary) becomes -1\n                         *   4 (100 binary) becomes 2, 5 (101 binary) becomes -2\n                         */\n                        function fromVLQSigned(aValue) {\n                            var isNegative = (aValue & 1) === 1\n                            var shifted = aValue >> 1\n                            return isNegative ? -shifted : shifted\n                        }\n\n                        /**\n                         * Returns the base 64 VLQ encoded value.\n                         */\n                        exports.encode = function base64VLQ_encode(aValue) {\n                            var encoded = \"\"\n                            var digit\n\n                            var vlq = toVLQSigned(aValue)\n\n                            do {\n                                digit = vlq & VLQ_BASE_MASK\n                                vlq >>>= VLQ_BASE_SHIFT\n                                if (vlq > 0) {\n                                    // There are still more digits in this value, so we must make sure the\n                                    // continuation bit is marked.\n                                    digit |= VLQ_CONTINUATION_BIT\n                                }\n                                encoded += base64.encode(digit)\n                            } while (vlq > 0)\n\n                            return encoded\n                        }\n\n                        /**\n                         * Decodes the next base 64 VLQ value from the given string and returns the\n                         * value and the rest of the string.\n                         */\n                        exports.decode = function base64VLQ_decode(aStr) {\n                            var i = 0\n                            var strLen = aStr.length\n                            var result = 0\n                            var shift = 0\n                            var continuation, digit\n\n                            do {\n                                if (i >= strLen) {\n                                    throw new Error(\"Expected more digits in base 64 VLQ value.\")\n                                }\n                                digit = base64.decode(aStr.charAt(i++))\n                                continuation = !!(digit & VLQ_CONTINUATION_BIT)\n                                digit &= VLQ_BASE_MASK\n                                result = result + (digit << shift)\n                                shift += VLQ_BASE_SHIFT\n                            } while (continuation)\n\n                            return {\n                                value: fromVLQSigned(result),\n                                rest: aStr.slice(i)\n                            }\n                        }\n                    })\n                },\n                { \"./base64\": 14, amdefine: 20 }\n            ],\n            14: [\n                function(_dereq_, module, exports) {\n                    /* -*- Mode: js; js-indent-level: 2; -*- */\n                    /*\n                     * Copyright 2011 Mozilla Foundation and contributors\n                     * Licensed under the New BSD license. See LICENSE or:\n                     * http://opensource.org/licenses/BSD-3-Clause\n                     */\n                    if (typeof define !== \"function\") {\n                        var define = _dereq_(\"amdefine\")(module, _dereq_)\n                    }\n                    define(function(_dereq_, exports, module) {\n                        var charToIntMap = {}\n                        var intToCharMap = {}\n\n                        \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\"\n                            .split(\"\")\n                            .forEach(function(ch, index) {\n                                charToIntMap[ch] = index\n                                intToCharMap[index] = ch\n                            })\n\n                        /**\n                         * Encode an integer in the range of 0 to 63 to a single base 64 digit.\n                         */\n                        exports.encode = function base64_encode(aNumber) {\n                            if (aNumber in intToCharMap) {\n                                return intToCharMap[aNumber]\n                            }\n                            throw new TypeError(\"Must be between 0 and 63: \" + aNumber)\n                        }\n\n                        /**\n                         * Decode a single base 64 digit to an integer.\n                         */\n                        exports.decode = function base64_decode(aChar) {\n                            if (aChar in charToIntMap) {\n                                return charToIntMap[aChar]\n                            }\n                            throw new TypeError(\"Not a valid base 64 digit: \" + aChar)\n                        }\n                    })\n                },\n                { amdefine: 20 }\n            ],\n            15: [\n                function(_dereq_, module, exports) {\n                    /* -*- Mode: js; js-indent-level: 2; -*- */\n                    /*\n                     * Copyright 2011 Mozilla Foundation and contributors\n                     * Licensed under the New BSD license. See LICENSE or:\n                     * http://opensource.org/licenses/BSD-3-Clause\n                     */\n                    if (typeof define !== \"function\") {\n                        var define = _dereq_(\"amdefine\")(module, _dereq_)\n                    }\n                    define(function(_dereq_, exports, module) {\n                        /**\n                         * Recursive implementation of binary search.\n                         *\n                         * @param aLow Indices here and lower do not contain the needle.\n                         * @param aHigh Indices here and higher do not contain the needle.\n                         * @param aNeedle The element being searched for.\n                         * @param aHaystack The non-empty array being searched.\n                         * @param aCompare Function which takes two elements and returns -1, 0, or 1.\n                         */\n                        function recursiveSearch(aLow, aHigh, aNeedle, aHaystack, aCompare) {\n                            // This function terminates when one of the following is true:\n                            //\n                            //   1. We find the exact element we are looking for.\n                            //\n                            //   2. We did not find the exact element, but we can return the next\n                            //      closest element that is less than that element.\n                            //\n                            //   3. We did not find the exact element, and there is no next-closest\n                            //      element which is less than the one we are searching for, so we\n                            //      return null.\n                            var mid = Math.floor((aHigh - aLow) / 2) + aLow\n                            var cmp = aCompare(aNeedle, aHaystack[mid], true)\n                            if (cmp === 0) {\n                                // Found the element we are looking for.\n                                return aHaystack[mid]\n                            } else if (cmp > 0) {\n                                // aHaystack[mid] is greater than our needle.\n                                if (aHigh - mid > 1) {\n                                    // The element is in the upper half.\n                                    return recursiveSearch(mid, aHigh, aNeedle, aHaystack, aCompare)\n                                }\n                                // We did not find an exact match, return the next closest one\n                                // (termination case 2).\n                                return aHaystack[mid]\n                            } else {\n                                // aHaystack[mid] is less than our needle.\n                                if (mid - aLow > 1) {\n                                    // The element is in the lower half.\n                                    return recursiveSearch(aLow, mid, aNeedle, aHaystack, aCompare)\n                                }\n                                // The exact needle element was not found in this haystack. Determine if\n                                // we are in termination case (2) or (3) and return the appropriate thing.\n                                return aLow < 0 ? null : aHaystack[aLow]\n                            }\n                        }\n\n                        /**\n                         * This is an implementation of binary search which will always try and return\n                         * the next lowest value checked if there is no exact hit. This is because\n                         * mappings between original and generated line/col pairs are single points,\n                         * and there is an implicit region between each of them, so a miss just means\n                         * that you aren't on the very start of a region.\n                         *\n                         * @param aNeedle The element you are looking for.\n                         * @param aHaystack The array that is being searched.\n                         * @param aCompare A function which takes the needle and an element in the\n                         *     array and returns -1, 0, or 1 depending on whether the needle is less\n                         *     than, equal to, or greater than the element, respectively.\n                         */\n                        exports.search = function search(aNeedle, aHaystack, aCompare) {\n                            return aHaystack.length > 0\n                                ? recursiveSearch(\n                                      -1,\n                                      aHaystack.length,\n                                      aNeedle,\n                                      aHaystack,\n                                      aCompare\n                                  )\n                                : null\n                        }\n                    })\n                },\n                { amdefine: 20 }\n            ],\n            16: [\n                function(_dereq_, module, exports) {\n                    /* -*- Mode: js; js-indent-level: 2; -*- */\n                    /*\n                     * Copyright 2011 Mozilla Foundation and contributors\n                     * Licensed under the New BSD license. See LICENSE or:\n                     * http://opensource.org/licenses/BSD-3-Clause\n                     */\n                    if (typeof define !== \"function\") {\n                        var define = _dereq_(\"amdefine\")(module, _dereq_)\n                    }\n                    define(function(_dereq_, exports, module) {\n                        var util = _dereq_(\"./util\")\n                        var binarySearch = _dereq_(\"./binary-search\")\n                        var ArraySet = _dereq_(\"./array-set\").ArraySet\n                        var base64VLQ = _dereq_(\"./base64-vlq\")\n\n                        /**\n                         * A SourceMapConsumer instance represents a parsed source map which we can\n                         * query for information about the original file positions by giving it a file\n                         * position in the generated source.\n                         *\n                         * The only parameter is the raw source map (either as a JSON string, or\n                         * already parsed to an object). According to the spec, source maps have the\n                         * following attributes:\n                         *\n                         *   - version: Which version of the source map spec this map is following.\n                         *   - sources: An array of URLs to the original source files.\n                         *   - names: An array of identifiers which can be referenced by individual mappings.\n                         *   - sourceRoot: Optional. The URL root from which all sources are relative.\n                         *   - sourcesContent: Optional. An array of contents of the original source files.\n                         *   - mappings: A string of base64 VLQs which contain the actual mappings.\n                         *   - file: The generated file this source map is associated with.\n                         *\n                         * Here is an example source map, taken from the source map spec[0]:\n                         *\n                         *     {\n                         *       version : 3,\n                         *       file: \"out.js\",\n                         *       sourceRoot : \"\",\n                         *       sources: [\"foo.js\", \"bar.js\"],\n                         *       names: [\"src\", \"maps\", \"are\", \"fun\"],\n                         *       mappings: \"AA,AB;;ABCDE;\"\n                         *     }\n                         *\n                         * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit?pli=1#\n                         */\n                        function SourceMapConsumer(aSourceMap) {\n                            var sourceMap = aSourceMap\n                            if (typeof aSourceMap === \"string\") {\n                                sourceMap = JSON.parse(aSourceMap.replace(/^\\)\\]\\}'/, \"\"))\n                            }\n\n                            var version = util.getArg(sourceMap, \"version\")\n                            var sources = util.getArg(sourceMap, \"sources\")\n                            // Sass 3.3 leaves out the 'names' array, so we deviate from the spec (which\n                            // requires the array) to play nice here.\n                            var names = util.getArg(sourceMap, \"names\", [])\n                            var sourceRoot = util.getArg(sourceMap, \"sourceRoot\", null)\n                            var sourcesContent = util.getArg(sourceMap, \"sourcesContent\", null)\n                            var mappings = util.getArg(sourceMap, \"mappings\")\n                            var file = util.getArg(sourceMap, \"file\", null)\n\n                            // Once again, Sass deviates from the spec and supplies the version as a\n                            // string rather than a number, so we use loose equality checking here.\n                            if (version != this._version) {\n                                throw new Error(\"Unsupported version: \" + version)\n                            }\n\n                            // Pass `true` below to allow duplicate names and sources. While source maps\n                            // are intended to be compressed and deduplicated, the TypeScript compiler\n                            // sometimes generates source maps with duplicates in them. See Github issue\n                            // #72 and bugzil.la/889492.\n                            this._names = ArraySet.fromArray(names, true)\n                            this._sources = ArraySet.fromArray(sources, true)\n\n                            this.sourceRoot = sourceRoot\n                            this.sourcesContent = sourcesContent\n                            this._mappings = mappings\n                            this.file = file\n                        }\n\n                        /**\n                         * Create a SourceMapConsumer from a SourceMapGenerator.\n                         *\n                         * @param SourceMapGenerator aSourceMap\n                         *        The source map that will be consumed.\n                         * @returns SourceMapConsumer\n                         */\n                        SourceMapConsumer.fromSourceMap = function SourceMapConsumer_fromSourceMap(\n                            aSourceMap\n                        ) {\n                            var smc = Object.create(SourceMapConsumer.prototype)\n\n                            smc._names = ArraySet.fromArray(aSourceMap._names.toArray(), true)\n                            smc._sources = ArraySet.fromArray(aSourceMap._sources.toArray(), true)\n                            smc.sourceRoot = aSourceMap._sourceRoot\n                            smc.sourcesContent = aSourceMap._generateSourcesContent(\n                                smc._sources.toArray(),\n                                smc.sourceRoot\n                            )\n                            smc.file = aSourceMap._file\n\n                            smc.__generatedMappings = aSourceMap._mappings\n                                .slice()\n                                .sort(util.compareByGeneratedPositions)\n                            smc.__originalMappings = aSourceMap._mappings\n                                .slice()\n                                .sort(util.compareByOriginalPositions)\n\n                            return smc\n                        }\n\n                        /**\n                         * The version of the source mapping spec that we are consuming.\n                         */\n                        SourceMapConsumer.prototype._version = 3\n\n                        /**\n                         * The list of original sources.\n                         */\n                        Object.defineProperty(SourceMapConsumer.prototype, \"sources\", {\n                            get: function() {\n                                return this._sources.toArray().map(function(s) {\n                                    return this.sourceRoot ? util.join(this.sourceRoot, s) : s\n                                }, this)\n                            }\n                        })\n\n                        // `__generatedMappings` and `__originalMappings` are arrays that hold the\n                        // parsed mapping coordinates from the source map's \"mappings\" attribute. They\n                        // are lazily instantiated, accessed via the `_generatedMappings` and\n                        // `_originalMappings` getters respectively, and we only parse the mappings\n                        // and create these arrays once queried for a source location. We jump through\n                        // these hoops because there can be many thousands of mappings, and parsing\n                        // them is expensive, so we only want to do it if we must.\n                        //\n                        // Each object in the arrays is of the form:\n                        //\n                        //     {\n                        //       generatedLine: The line number in the generated code,\n                        //       generatedColumn: The column number in the generated code,\n                        //       source: The path to the original source file that generated this\n                        //               chunk of code,\n                        //       originalLine: The line number in the original source that\n                        //                     corresponds to this chunk of generated code,\n                        //       originalColumn: The column number in the original source that\n                        //                       corresponds to this chunk of generated code,\n                        //       name: The name of the original symbol which generated this chunk of\n                        //             code.\n                        //     }\n                        //\n                        // All properties except for `generatedLine` and `generatedColumn` can be\n                        // `null`.\n                        //\n                        // `_generatedMappings` is ordered by the generated positions.\n                        //\n                        // `_originalMappings` is ordered by the original positions.\n\n                        SourceMapConsumer.prototype.__generatedMappings = null\n                        Object.defineProperty(SourceMapConsumer.prototype, \"_generatedMappings\", {\n                            get: function() {\n                                if (!this.__generatedMappings) {\n                                    this.__generatedMappings = []\n                                    this.__originalMappings = []\n                                    this._parseMappings(this._mappings, this.sourceRoot)\n                                }\n\n                                return this.__generatedMappings\n                            }\n                        })\n\n                        SourceMapConsumer.prototype.__originalMappings = null\n                        Object.defineProperty(SourceMapConsumer.prototype, \"_originalMappings\", {\n                            get: function() {\n                                if (!this.__originalMappings) {\n                                    this.__generatedMappings = []\n                                    this.__originalMappings = []\n                                    this._parseMappings(this._mappings, this.sourceRoot)\n                                }\n\n                                return this.__originalMappings\n                            }\n                        })\n\n                        /**\n                         * Parse the mappings in a string in to a data structure which we can easily\n                         * query (the ordered arrays in the `this.__generatedMappings` and\n                         * `this.__originalMappings` properties).\n                         */\n                        SourceMapConsumer.prototype._parseMappings = function SourceMapConsumer_parseMappings(\n                            aStr,\n                            aSourceRoot\n                        ) {\n                            var generatedLine = 1\n                            var previousGeneratedColumn = 0\n                            var previousOriginalLine = 0\n                            var previousOriginalColumn = 0\n                            var previousSource = 0\n                            var previousName = 0\n                            var mappingSeparator = /^[,;]/\n                            var str = aStr\n                            var mapping\n                            var temp\n\n                            while (str.length > 0) {\n                                if (str.charAt(0) === \";\") {\n                                    generatedLine++\n                                    str = str.slice(1)\n                                    previousGeneratedColumn = 0\n                                } else if (str.charAt(0) === \",\") {\n                                    str = str.slice(1)\n                                } else {\n                                    mapping = {}\n                                    mapping.generatedLine = generatedLine\n\n                                    // Generated column.\n                                    temp = base64VLQ.decode(str)\n                                    mapping.generatedColumn = previousGeneratedColumn + temp.value\n                                    previousGeneratedColumn = mapping.generatedColumn\n                                    str = temp.rest\n\n                                    if (str.length > 0 && !mappingSeparator.test(str.charAt(0))) {\n                                        // Original source.\n                                        temp = base64VLQ.decode(str)\n                                        mapping.source = this._sources.at(\n                                            previousSource + temp.value\n                                        )\n                                        previousSource += temp.value\n                                        str = temp.rest\n                                        if (\n                                            str.length === 0 ||\n                                            mappingSeparator.test(str.charAt(0))\n                                        ) {\n                                            throw new Error(\n                                                \"Found a source, but no line and column\"\n                                            )\n                                        }\n\n                                        // Original line.\n                                        temp = base64VLQ.decode(str)\n                                        mapping.originalLine = previousOriginalLine + temp.value\n                                        previousOriginalLine = mapping.originalLine\n                                        // Lines are stored 0-based\n                                        mapping.originalLine += 1\n                                        str = temp.rest\n                                        if (\n                                            str.length === 0 ||\n                                            mappingSeparator.test(str.charAt(0))\n                                        ) {\n                                            throw new Error(\n                                                \"Found a source and line, but no column\"\n                                            )\n                                        }\n\n                                        // Original column.\n                                        temp = base64VLQ.decode(str)\n                                        mapping.originalColumn = previousOriginalColumn + temp.value\n                                        previousOriginalColumn = mapping.originalColumn\n                                        str = temp.rest\n\n                                        if (\n                                            str.length > 0 &&\n                                            !mappingSeparator.test(str.charAt(0))\n                                        ) {\n                                            // Original name.\n                                            temp = base64VLQ.decode(str)\n                                            mapping.name = this._names.at(previousName + temp.value)\n                                            previousName += temp.value\n                                            str = temp.rest\n                                        }\n                                    }\n\n                                    this.__generatedMappings.push(mapping)\n                                    if (typeof mapping.originalLine === \"number\") {\n                                        this.__originalMappings.push(mapping)\n                                    }\n                                }\n                            }\n\n                            this.__originalMappings.sort(util.compareByOriginalPositions)\n                        }\n\n                        /**\n                         * Find the mapping that best matches the hypothetical \"needle\" mapping that\n                         * we are searching for in the given \"haystack\" of mappings.\n                         */\n                        SourceMapConsumer.prototype._findMapping = function SourceMapConsumer_findMapping(\n                            aNeedle,\n                            aMappings,\n                            aLineName,\n                            aColumnName,\n                            aComparator\n                        ) {\n                            // To return the position we are searching for, we must first find the\n                            // mapping for the given position and then return the opposite position it\n                            // points to. Because the mappings are sorted, we can use binary search to\n                            // find the best mapping.\n\n                            if (aNeedle[aLineName] <= 0) {\n                                throw new TypeError(\n                                    \"Line must be greater than or equal to 1, got \" +\n                                        aNeedle[aLineName]\n                                )\n                            }\n                            if (aNeedle[aColumnName] < 0) {\n                                throw new TypeError(\n                                    \"Column must be greater than or equal to 0, got \" +\n                                        aNeedle[aColumnName]\n                                )\n                            }\n\n                            return binarySearch.search(aNeedle, aMappings, aComparator)\n                        }\n\n                        /**\n                         * Returns the original source, line, and column information for the generated\n                         * source's line and column positions provided. The only argument is an object\n                         * with the following properties:\n                         *\n                         *   - line: The line number in the generated source.\n                         *   - column: The column number in the generated source.\n                         *\n                         * and an object is returned with the following properties:\n                         *\n                         *   - source: The original source file, or null.\n                         *   - line: The line number in the original source, or null.\n                         *   - column: The column number in the original source, or null.\n                         *   - name: The original identifier, or null.\n                         */\n                        SourceMapConsumer.prototype.originalPositionFor = function SourceMapConsumer_originalPositionFor(\n                            aArgs\n                        ) {\n                            var needle = {\n                                generatedLine: util.getArg(aArgs, \"line\"),\n                                generatedColumn: util.getArg(aArgs, \"column\")\n                            }\n\n                            var mapping = this._findMapping(\n                                needle,\n                                this._generatedMappings,\n                                \"generatedLine\",\n                                \"generatedColumn\",\n                                util.compareByGeneratedPositions\n                            )\n\n                            if (mapping) {\n                                var source = util.getArg(mapping, \"source\", null)\n                                if (source && this.sourceRoot) {\n                                    source = util.join(this.sourceRoot, source)\n                                }\n                                return {\n                                    source: source,\n                                    line: util.getArg(mapping, \"originalLine\", null),\n                                    column: util.getArg(mapping, \"originalColumn\", null),\n                                    name: util.getArg(mapping, \"name\", null)\n                                }\n                            }\n\n                            return {\n                                source: null,\n                                line: null,\n                                column: null,\n                                name: null\n                            }\n                        }\n\n                        /**\n                         * Returns the original source content. The only argument is the url of the\n                         * original source file. Returns null if no original source content is\n                         * availible.\n                         */\n                        SourceMapConsumer.prototype.sourceContentFor = function SourceMapConsumer_sourceContentFor(\n                            aSource\n                        ) {\n                            if (!this.sourcesContent) {\n                                return null\n                            }\n\n                            if (this.sourceRoot) {\n                                aSource = util.relative(this.sourceRoot, aSource)\n                            }\n\n                            if (this._sources.has(aSource)) {\n                                return this.sourcesContent[this._sources.indexOf(aSource)]\n                            }\n\n                            var url\n                            if (this.sourceRoot && (url = util.urlParse(this.sourceRoot))) {\n                                // XXX: file:// URIs and absolute paths lead to unexpected behavior for\n                                // many users. We can help them out when they expect file:// URIs to\n                                // behave like it would if they were running a local HTTP server. See\n                                // https://bugzilla.mozilla.org/show_bug.cgi?id=885597.\n                                var fileUriAbsPath = aSource.replace(/^file:\\/\\//, \"\")\n                                if (url.scheme == \"file\" && this._sources.has(fileUriAbsPath)) {\n                                    return this.sourcesContent[\n                                        this._sources.indexOf(fileUriAbsPath)\n                                    ]\n                                }\n\n                                if (\n                                    (!url.path || url.path == \"/\") &&\n                                    this._sources.has(\"/\" + aSource)\n                                ) {\n                                    return this.sourcesContent[this._sources.indexOf(\"/\" + aSource)]\n                                }\n                            }\n\n                            throw new Error('\"' + aSource + '\" is not in the SourceMap.')\n                        }\n\n                        /**\n                         * Returns the generated line and column information for the original source,\n                         * line, and column positions provided. The only argument is an object with\n                         * the following properties:\n                         *\n                         *   - source: The filename of the original source.\n                         *   - line: The line number in the original source.\n                         *   - column: The column number in the original source.\n                         *\n                         * and an object is returned with the following properties:\n                         *\n                         *   - line: The line number in the generated source, or null.\n                         *   - column: The column number in the generated source, or null.\n                         */\n                        SourceMapConsumer.prototype.generatedPositionFor = function SourceMapConsumer_generatedPositionFor(\n                            aArgs\n                        ) {\n                            var needle = {\n                                source: util.getArg(aArgs, \"source\"),\n                                originalLine: util.getArg(aArgs, \"line\"),\n                                originalColumn: util.getArg(aArgs, \"column\")\n                            }\n\n                            if (this.sourceRoot) {\n                                needle.source = util.relative(this.sourceRoot, needle.source)\n                            }\n\n                            var mapping = this._findMapping(\n                                needle,\n                                this._originalMappings,\n                                \"originalLine\",\n                                \"originalColumn\",\n                                util.compareByOriginalPositions\n                            )\n\n                            if (mapping) {\n                                return {\n                                    line: util.getArg(mapping, \"generatedLine\", null),\n                                    column: util.getArg(mapping, \"generatedColumn\", null)\n                                }\n                            }\n\n                            return {\n                                line: null,\n                                column: null\n                            }\n                        }\n\n                        SourceMapConsumer.GENERATED_ORDER = 1\n                        SourceMapConsumer.ORIGINAL_ORDER = 2\n\n                        /**\n                         * Iterate over each mapping between an original source/line/column and a\n                         * generated line/column in this source map.\n                         *\n                         * @param Function aCallback\n                         *        The function that is called with each mapping.\n                         * @param Object aContext\n                         *        Optional. If specified, this object will be the value of `this` every\n                         *        time that `aCallback` is called.\n                         * @param aOrder\n                         *        Either `SourceMapConsumer.GENERATED_ORDER` or\n                         *        `SourceMapConsumer.ORIGINAL_ORDER`. Specifies whether you want to\n                         *        iterate over the mappings sorted by the generated file's line/column\n                         *        order or the original's source/line/column order, respectively. Defaults to\n                         *        `SourceMapConsumer.GENERATED_ORDER`.\n                         */\n                        SourceMapConsumer.prototype.eachMapping = function SourceMapConsumer_eachMapping(\n                            aCallback,\n                            aContext,\n                            aOrder\n                        ) {\n                            var context = aContext || null\n                            var order = aOrder || SourceMapConsumer.GENERATED_ORDER\n\n                            var mappings\n                            switch (order) {\n                                case SourceMapConsumer.GENERATED_ORDER:\n                                    mappings = this._generatedMappings\n                                    break\n                                case SourceMapConsumer.ORIGINAL_ORDER:\n                                    mappings = this._originalMappings\n                                    break\n                                default:\n                                    throw new Error(\"Unknown order of iteration.\")\n                            }\n\n                            var sourceRoot = this.sourceRoot\n                            mappings\n                                .map(function(mapping) {\n                                    var source = mapping.source\n                                    if (source && sourceRoot) {\n                                        source = util.join(sourceRoot, source)\n                                    }\n                                    return {\n                                        source: source,\n                                        generatedLine: mapping.generatedLine,\n                                        generatedColumn: mapping.generatedColumn,\n                                        originalLine: mapping.originalLine,\n                                        originalColumn: mapping.originalColumn,\n                                        name: mapping.name\n                                    }\n                                })\n                                .forEach(aCallback, context)\n                        }\n\n                        exports.SourceMapConsumer = SourceMapConsumer\n                    })\n                },\n                {\n                    \"./array-set\": 12,\n                    \"./base64-vlq\": 13,\n                    \"./binary-search\": 15,\n                    \"./util\": 19,\n                    amdefine: 20\n                }\n            ],\n            17: [\n                function(_dereq_, module, exports) {\n                    /* -*- Mode: js; js-indent-level: 2; -*- */\n                    /*\n                     * Copyright 2011 Mozilla Foundation and contributors\n                     * Licensed under the New BSD license. See LICENSE or:\n                     * http://opensource.org/licenses/BSD-3-Clause\n                     */\n                    if (typeof define !== \"function\") {\n                        var define = _dereq_(\"amdefine\")(module, _dereq_)\n                    }\n                    define(function(_dereq_, exports, module) {\n                        var base64VLQ = _dereq_(\"./base64-vlq\")\n                        var util = _dereq_(\"./util\")\n                        var ArraySet = _dereq_(\"./array-set\").ArraySet\n\n                        /**\n                         * An instance of the SourceMapGenerator represents a source map which is\n                         * being built incrementally. To create a new one, you must pass an object\n                         * with the following properties:\n                         *\n                         *   - file: The filename of the generated source.\n                         *   - sourceRoot: An optional root for all URLs in this source map.\n                         */\n                        function SourceMapGenerator(aArgs) {\n                            this._file = util.getArg(aArgs, \"file\")\n                            this._sourceRoot = util.getArg(aArgs, \"sourceRoot\", null)\n                            this._sources = new ArraySet()\n                            this._names = new ArraySet()\n                            this._mappings = []\n                            this._sourcesContents = null\n                        }\n\n                        SourceMapGenerator.prototype._version = 3\n\n                        /**\n                         * Creates a new SourceMapGenerator based on a SourceMapConsumer\n                         *\n                         * @param aSourceMapConsumer The SourceMap.\n                         */\n                        SourceMapGenerator.fromSourceMap = function SourceMapGenerator_fromSourceMap(\n                            aSourceMapConsumer\n                        ) {\n                            var sourceRoot = aSourceMapConsumer.sourceRoot\n                            var generator = new SourceMapGenerator({\n                                file: aSourceMapConsumer.file,\n                                sourceRoot: sourceRoot\n                            })\n                            aSourceMapConsumer.eachMapping(function(mapping) {\n                                var newMapping = {\n                                    generated: {\n                                        line: mapping.generatedLine,\n                                        column: mapping.generatedColumn\n                                    }\n                                }\n\n                                if (mapping.source) {\n                                    newMapping.source = mapping.source\n                                    if (sourceRoot) {\n                                        newMapping.source = util.relative(\n                                            sourceRoot,\n                                            newMapping.source\n                                        )\n                                    }\n\n                                    newMapping.original = {\n                                        line: mapping.originalLine,\n                                        column: mapping.originalColumn\n                                    }\n\n                                    if (mapping.name) {\n                                        newMapping.name = mapping.name\n                                    }\n                                }\n\n                                generator.addMapping(newMapping)\n                            })\n                            aSourceMapConsumer.sources.forEach(function(sourceFile) {\n                                var content = aSourceMapConsumer.sourceContentFor(sourceFile)\n                                if (content) {\n                                    generator.setSourceContent(sourceFile, content)\n                                }\n                            })\n                            return generator\n                        }\n\n                        /**\n                         * Add a single mapping from original source line and column to the generated\n                         * source's line and column for this source map being created. The mapping\n                         * object should have the following properties:\n                         *\n                         *   - generated: An object with the generated line and column positions.\n                         *   - original: An object with the original line and column positions.\n                         *   - source: The original source file (relative to the sourceRoot).\n                         *   - name: An optional original token name for this mapping.\n                         */\n                        SourceMapGenerator.prototype.addMapping = function SourceMapGenerator_addMapping(\n                            aArgs\n                        ) {\n                            var generated = util.getArg(aArgs, \"generated\")\n                            var original = util.getArg(aArgs, \"original\", null)\n                            var source = util.getArg(aArgs, \"source\", null)\n                            var name = util.getArg(aArgs, \"name\", null)\n\n                            this._validateMapping(generated, original, source, name)\n\n                            if (source && !this._sources.has(source)) {\n                                this._sources.add(source)\n                            }\n\n                            if (name && !this._names.has(name)) {\n                                this._names.add(name)\n                            }\n\n                            this._mappings.push({\n                                generatedLine: generated.line,\n                                generatedColumn: generated.column,\n                                originalLine: original != null && original.line,\n                                originalColumn: original != null && original.column,\n                                source: source,\n                                name: name\n                            })\n                        }\n\n                        /**\n                         * Set the source content for a source file.\n                         */\n                        SourceMapGenerator.prototype.setSourceContent = function SourceMapGenerator_setSourceContent(\n                            aSourceFile,\n                            aSourceContent\n                        ) {\n                            var source = aSourceFile\n                            if (this._sourceRoot) {\n                                source = util.relative(this._sourceRoot, source)\n                            }\n\n                            if (aSourceContent !== null) {\n                                // Add the source content to the _sourcesContents map.\n                                // Create a new _sourcesContents map if the property is null.\n                                if (!this._sourcesContents) {\n                                    this._sourcesContents = {}\n                                }\n                                this._sourcesContents[util.toSetString(source)] = aSourceContent\n                            } else {\n                                // Remove the source file from the _sourcesContents map.\n                                // If the _sourcesContents map is empty, set the property to null.\n                                delete this._sourcesContents[util.toSetString(source)]\n                                if (Object.keys(this._sourcesContents).length === 0) {\n                                    this._sourcesContents = null\n                                }\n                            }\n                        }\n\n                        /**\n                         * Applies the mappings of a sub-source-map for a specific source file to the\n                         * source map being generated. Each mapping to the supplied source file is\n                         * rewritten using the supplied source map. Note: The resolution for the\n                         * resulting mappings is the minimum of this map and the supplied map.\n                         *\n                         * @param aSourceMapConsumer The source map to be applied.\n                         * @param aSourceFile Optional. The filename of the source file.\n                         *        If omitted, SourceMapConsumer's file property will be used.\n                         */\n                        SourceMapGenerator.prototype.applySourceMap = function SourceMapGenerator_applySourceMap(\n                            aSourceMapConsumer,\n                            aSourceFile\n                        ) {\n                            // If aSourceFile is omitted, we will use the file property of the SourceMap\n                            if (!aSourceFile) {\n                                aSourceFile = aSourceMapConsumer.file\n                            }\n                            var sourceRoot = this._sourceRoot\n                            // Make \"aSourceFile\" relative if an absolute Url is passed.\n                            if (sourceRoot) {\n                                aSourceFile = util.relative(sourceRoot, aSourceFile)\n                            }\n                            // Applying the SourceMap can add and remove items from the sources and\n                            // the names array.\n                            var newSources = new ArraySet()\n                            var newNames = new ArraySet()\n\n                            // Find mappings for the \"aSourceFile\"\n                            this._mappings.forEach(function(mapping) {\n                                if (mapping.source === aSourceFile && mapping.originalLine) {\n                                    // Check if it can be mapped by the source map, then update the mapping.\n                                    var original = aSourceMapConsumer.originalPositionFor({\n                                        line: mapping.originalLine,\n                                        column: mapping.originalColumn\n                                    })\n                                    if (original.source !== null) {\n                                        // Copy mapping\n                                        if (sourceRoot) {\n                                            mapping.source = util.relative(\n                                                sourceRoot,\n                                                original.source\n                                            )\n                                        } else {\n                                            mapping.source = original.source\n                                        }\n                                        mapping.originalLine = original.line\n                                        mapping.originalColumn = original.column\n                                        if (original.name !== null && mapping.name !== null) {\n                                            // Only use the identifier name if it's an identifier\n                                            // in both SourceMaps\n                                            mapping.name = original.name\n                                        }\n                                    }\n                                }\n\n                                var source = mapping.source\n                                if (source && !newSources.has(source)) {\n                                    newSources.add(source)\n                                }\n\n                                var name = mapping.name\n                                if (name && !newNames.has(name)) {\n                                    newNames.add(name)\n                                }\n                            }, this)\n                            this._sources = newSources\n                            this._names = newNames\n\n                            // Copy sourcesContents of applied map.\n                            aSourceMapConsumer.sources.forEach(function(sourceFile) {\n                                var content = aSourceMapConsumer.sourceContentFor(sourceFile)\n                                if (content) {\n                                    if (sourceRoot) {\n                                        sourceFile = util.relative(sourceRoot, sourceFile)\n                                    }\n                                    this.setSourceContent(sourceFile, content)\n                                }\n                            }, this)\n                        }\n\n                        /**\n                         * A mapping can have one of the three levels of data:\n                         *\n                         *   1. Just the generated position.\n                         *   2. The Generated position, original position, and original source.\n                         *   3. Generated and original position, original source, as well as a name\n                         *      token.\n                         *\n                         * To maintain consistency, we validate that any new mapping being added falls\n                         * in to one of these categories.\n                         */\n                        SourceMapGenerator.prototype._validateMapping = function SourceMapGenerator_validateMapping(\n                            aGenerated,\n                            aOriginal,\n                            aSource,\n                            aName\n                        ) {\n                            if (\n                                aGenerated &&\n                                \"line\" in aGenerated &&\n                                \"column\" in aGenerated &&\n                                aGenerated.line > 0 &&\n                                aGenerated.column >= 0 &&\n                                !aOriginal &&\n                                !aSource &&\n                                !aName\n                            ) {\n                                // Case 1.\n                                return\n                            } else if (\n                                aGenerated &&\n                                \"line\" in aGenerated &&\n                                \"column\" in aGenerated &&\n                                aOriginal &&\n                                \"line\" in aOriginal &&\n                                \"column\" in aOriginal &&\n                                aGenerated.line > 0 &&\n                                aGenerated.column >= 0 &&\n                                aOriginal.line > 0 &&\n                                aOriginal.column >= 0 &&\n                                aSource\n                            ) {\n                                // Cases 2 and 3.\n                                return\n                            } else {\n                                throw new Error(\n                                    \"Invalid mapping: \" +\n                                        JSON.stringify({\n                                            generated: aGenerated,\n                                            source: aSource,\n                                            orginal: aOriginal,\n                                            name: aName\n                                        })\n                                )\n                            }\n                        }\n\n                        /**\n                         * Serialize the accumulated mappings in to the stream of base 64 VLQs\n                         * specified by the source map format.\n                         */\n                        SourceMapGenerator.prototype._serializeMappings = function SourceMapGenerator_serializeMappings() {\n                            var previousGeneratedColumn = 0\n                            var previousGeneratedLine = 1\n                            var previousOriginalColumn = 0\n                            var previousOriginalLine = 0\n                            var previousName = 0\n                            var previousSource = 0\n                            var result = \"\"\n                            var mapping\n\n                            // The mappings must be guaranteed to be in sorted order before we start\n                            // serializing them or else the generated line numbers (which are defined\n                            // via the ';' separators) will be all messed up. Note: it might be more\n                            // performant to maintain the sorting as we insert them, rather than as we\n                            // serialize them, but the big O is the same either way.\n                            this._mappings.sort(util.compareByGeneratedPositions)\n\n                            for (var i = 0, len = this._mappings.length; i < len; i++) {\n                                mapping = this._mappings[i]\n\n                                if (mapping.generatedLine !== previousGeneratedLine) {\n                                    previousGeneratedColumn = 0\n                                    while (mapping.generatedLine !== previousGeneratedLine) {\n                                        result += \";\"\n                                        previousGeneratedLine++\n                                    }\n                                } else {\n                                    if (i > 0) {\n                                        if (\n                                            !util.compareByGeneratedPositions(\n                                                mapping,\n                                                this._mappings[i - 1]\n                                            )\n                                        ) {\n                                            continue\n                                        }\n                                        result += \",\"\n                                    }\n                                }\n\n                                result += base64VLQ.encode(\n                                    mapping.generatedColumn - previousGeneratedColumn\n                                )\n                                previousGeneratedColumn = mapping.generatedColumn\n\n                                if (mapping.source) {\n                                    result += base64VLQ.encode(\n                                        this._sources.indexOf(mapping.source) - previousSource\n                                    )\n                                    previousSource = this._sources.indexOf(mapping.source)\n\n                                    // lines are stored 0-based in SourceMap spec version 3\n                                    result += base64VLQ.encode(\n                                        mapping.originalLine - 1 - previousOriginalLine\n                                    )\n                                    previousOriginalLine = mapping.originalLine - 1\n\n                                    result += base64VLQ.encode(\n                                        mapping.originalColumn - previousOriginalColumn\n                                    )\n                                    previousOriginalColumn = mapping.originalColumn\n\n                                    if (mapping.name) {\n                                        result += base64VLQ.encode(\n                                            this._names.indexOf(mapping.name) - previousName\n                                        )\n                                        previousName = this._names.indexOf(mapping.name)\n                                    }\n                                }\n                            }\n\n                            return result\n                        }\n\n                        SourceMapGenerator.prototype._generateSourcesContent = function SourceMapGenerator_generateSourcesContent(\n                            aSources,\n                            aSourceRoot\n                        ) {\n                            return aSources.map(function(source) {\n                                if (!this._sourcesContents) {\n                                    return null\n                                }\n                                if (aSourceRoot) {\n                                    source = util.relative(aSourceRoot, source)\n                                }\n                                var key = util.toSetString(source)\n                                return Object.prototype.hasOwnProperty.call(\n                                    this._sourcesContents,\n                                    key\n                                )\n                                    ? this._sourcesContents[key]\n                                    : null\n                            }, this)\n                        }\n\n                        /**\n                         * Externalize the source map.\n                         */\n                        SourceMapGenerator.prototype.toJSON = function SourceMapGenerator_toJSON() {\n                            var map = {\n                                version: this._version,\n                                file: this._file,\n                                sources: this._sources.toArray(),\n                                names: this._names.toArray(),\n                                mappings: this._serializeMappings()\n                            }\n                            if (this._sourceRoot) {\n                                map.sourceRoot = this._sourceRoot\n                            }\n                            if (this._sourcesContents) {\n                                map.sourcesContent = this._generateSourcesContent(\n                                    map.sources,\n                                    map.sourceRoot\n                                )\n                            }\n\n                            return map\n                        }\n\n                        /**\n                         * Render the source map being generated to a string.\n                         */\n                        SourceMapGenerator.prototype.toString = function SourceMapGenerator_toString() {\n                            return JSON.stringify(this)\n                        }\n\n                        exports.SourceMapGenerator = SourceMapGenerator\n                    })\n                },\n                { \"./array-set\": 12, \"./base64-vlq\": 13, \"./util\": 19, amdefine: 20 }\n            ],\n            18: [\n                function(_dereq_, module, exports) {\n                    /* -*- Mode: js; js-indent-level: 2; -*- */\n                    /*\n                     * Copyright 2011 Mozilla Foundation and contributors\n                     * Licensed under the New BSD license. See LICENSE or:\n                     * http://opensource.org/licenses/BSD-3-Clause\n                     */\n                    if (typeof define !== \"function\") {\n                        var define = _dereq_(\"amdefine\")(module, _dereq_)\n                    }\n                    define(function(_dereq_, exports, module) {\n                        var SourceMapGenerator = _dereq_(\"./source-map-generator\")\n                            .SourceMapGenerator\n                        var util = _dereq_(\"./util\")\n\n                        /**\n                         * SourceNodes provide a way to abstract over interpolating/concatenating\n                         * snippets of generated JavaScript source code while maintaining the line and\n                         * column information associated with the original source code.\n                         *\n                         * @param aLine The original line number.\n                         * @param aColumn The original column number.\n                         * @param aSource The original source's filename.\n                         * @param aChunks Optional. An array of strings which are snippets of\n                         *        generated JS, or other SourceNodes.\n                         * @param aName The original identifier.\n                         */\n                        function SourceNode(aLine, aColumn, aSource, aChunks, aName) {\n                            this.children = []\n                            this.sourceContents = {}\n                            this.line = aLine === undefined ? null : aLine\n                            this.column = aColumn === undefined ? null : aColumn\n                            this.source = aSource === undefined ? null : aSource\n                            this.name = aName === undefined ? null : aName\n                            if (aChunks != null) this.add(aChunks)\n                        }\n\n                        /**\n                         * Creates a SourceNode from generated code and a SourceMapConsumer.\n                         *\n                         * @param aGeneratedCode The generated code\n                         * @param aSourceMapConsumer The SourceMap for the generated code\n                         */\n                        SourceNode.fromStringWithSourceMap = function SourceNode_fromStringWithSourceMap(\n                            aGeneratedCode,\n                            aSourceMapConsumer\n                        ) {\n                            // The SourceNode we want to fill with the generated code\n                            // and the SourceMap\n                            var node = new SourceNode()\n\n                            // The generated code\n                            // Processed fragments are removed from this array.\n                            var remainingLines = aGeneratedCode.split(\"\\n\")\n\n                            // We need to remember the position of \"remainingLines\"\n                            var lastGeneratedLine = 1,\n                                lastGeneratedColumn = 0\n\n                            // The generate SourceNodes we need a code range.\n                            // To extract it current and last mapping is used.\n                            // Here we store the last mapping.\n                            var lastMapping = null\n\n                            aSourceMapConsumer.eachMapping(function(mapping) {\n                                if (lastMapping === null) {\n                                    // We add the generated code until the first mapping\n                                    // to the SourceNode without any mapping.\n                                    // Each line is added as separate string.\n                                    while (lastGeneratedLine < mapping.generatedLine) {\n                                        node.add(remainingLines.shift() + \"\\n\")\n                                        lastGeneratedLine++\n                                    }\n                                    if (lastGeneratedColumn < mapping.generatedColumn) {\n                                        var nextLine = remainingLines[0]\n                                        node.add(nextLine.substr(0, mapping.generatedColumn))\n                                        remainingLines[0] = nextLine.substr(mapping.generatedColumn)\n                                        lastGeneratedColumn = mapping.generatedColumn\n                                    }\n                                } else {\n                                    // We add the code from \"lastMapping\" to \"mapping\":\n                                    // First check if there is a new line in between.\n                                    if (lastGeneratedLine < mapping.generatedLine) {\n                                        var code = \"\"\n                                        // Associate full lines with \"lastMapping\"\n                                        do {\n                                            code += remainingLines.shift() + \"\\n\"\n                                            lastGeneratedLine++\n                                            lastGeneratedColumn = 0\n                                        } while (lastGeneratedLine < mapping.generatedLine)\n                                        // When we reached the correct line, we add code until we\n                                        // reach the correct column too.\n                                        if (lastGeneratedColumn < mapping.generatedColumn) {\n                                            var nextLine = remainingLines[0]\n                                            code += nextLine.substr(0, mapping.generatedColumn)\n                                            remainingLines[0] = nextLine.substr(\n                                                mapping.generatedColumn\n                                            )\n                                            lastGeneratedColumn = mapping.generatedColumn\n                                        }\n                                        // Create the SourceNode.\n                                        addMappingWithCode(lastMapping, code)\n                                    } else {\n                                        // There is no new line in between.\n                                        // Associate the code between \"lastGeneratedColumn\" and\n                                        // \"mapping.generatedColumn\" with \"lastMapping\"\n                                        var nextLine = remainingLines[0]\n                                        var code = nextLine.substr(\n                                            0,\n                                            mapping.generatedColumn - lastGeneratedColumn\n                                        )\n                                        remainingLines[0] = nextLine.substr(\n                                            mapping.generatedColumn - lastGeneratedColumn\n                                        )\n                                        lastGeneratedColumn = mapping.generatedColumn\n                                        addMappingWithCode(lastMapping, code)\n                                    }\n                                }\n                                lastMapping = mapping\n                            }, this)\n                            // We have processed all mappings.\n                            // Associate the remaining code in the current line with \"lastMapping\"\n                            // and add the remaining lines without any mapping\n                            addMappingWithCode(lastMapping, remainingLines.join(\"\\n\"))\n\n                            // Copy sourcesContent into SourceNode\n                            aSourceMapConsumer.sources.forEach(function(sourceFile) {\n                                var content = aSourceMapConsumer.sourceContentFor(sourceFile)\n                                if (content) {\n                                    node.setSourceContent(sourceFile, content)\n                                }\n                            })\n\n                            return node\n\n                            function addMappingWithCode(mapping, code) {\n                                if (mapping === null || mapping.source === undefined) {\n                                    node.add(code)\n                                } else {\n                                    node.add(\n                                        new SourceNode(\n                                            mapping.originalLine,\n                                            mapping.originalColumn,\n                                            mapping.source,\n                                            code,\n                                            mapping.name\n                                        )\n                                    )\n                                }\n                            }\n                        }\n\n                        /**\n                         * Add a chunk of generated JS to this source node.\n                         *\n                         * @param aChunk A string snippet of generated JS code, another instance of\n                         *        SourceNode, or an array where each member is one of those things.\n                         */\n                        SourceNode.prototype.add = function SourceNode_add(aChunk) {\n                            if (Array.isArray(aChunk)) {\n                                aChunk.forEach(function(chunk) {\n                                    this.add(chunk)\n                                }, this)\n                            } else if (aChunk instanceof SourceNode || typeof aChunk === \"string\") {\n                                if (aChunk) {\n                                    this.children.push(aChunk)\n                                }\n                            } else {\n                                throw new TypeError(\n                                    \"Expected a SourceNode, string, or an array of SourceNodes and strings. Got \" +\n                                        aChunk\n                                )\n                            }\n                            return this\n                        }\n\n                        /**\n                         * Add a chunk of generated JS to the beginning of this source node.\n                         *\n                         * @param aChunk A string snippet of generated JS code, another instance of\n                         *        SourceNode, or an array where each member is one of those things.\n                         */\n                        SourceNode.prototype.prepend = function SourceNode_prepend(aChunk) {\n                            if (Array.isArray(aChunk)) {\n                                for (var i = aChunk.length - 1; i >= 0; i--) {\n                                    this.prepend(aChunk[i])\n                                }\n                            } else if (aChunk instanceof SourceNode || typeof aChunk === \"string\") {\n                                this.children.unshift(aChunk)\n                            } else {\n                                throw new TypeError(\n                                    \"Expected a SourceNode, string, or an array of SourceNodes and strings. Got \" +\n                                        aChunk\n                                )\n                            }\n                            return this\n                        }\n\n                        /**\n                         * Walk over the tree of JS snippets in this node and its children. The\n                         * walking function is called once for each snippet of JS and is passed that\n                         * snippet and the its original associated source's line/column location.\n                         *\n                         * @param aFn The traversal function.\n                         */\n                        SourceNode.prototype.walk = function SourceNode_walk(aFn) {\n                            var chunk\n                            for (var i = 0, len = this.children.length; i < len; i++) {\n                                chunk = this.children[i]\n                                if (chunk instanceof SourceNode) {\n                                    chunk.walk(aFn)\n                                } else {\n                                    if (chunk !== \"\") {\n                                        aFn(chunk, {\n                                            source: this.source,\n                                            line: this.line,\n                                            column: this.column,\n                                            name: this.name\n                                        })\n                                    }\n                                }\n                            }\n                        }\n\n                        /**\n                         * Like `String.prototype.join` except for SourceNodes. Inserts `aStr` between\n                         * each of `this.children`.\n                         *\n                         * @param aSep The separator.\n                         */\n                        SourceNode.prototype.join = function SourceNode_join(aSep) {\n                            var newChildren\n                            var i\n                            var len = this.children.length\n                            if (len > 0) {\n                                newChildren = []\n                                for (i = 0; i < len - 1; i++) {\n                                    newChildren.push(this.children[i])\n                                    newChildren.push(aSep)\n                                }\n                                newChildren.push(this.children[i])\n                                this.children = newChildren\n                            }\n                            return this\n                        }\n\n                        /**\n                         * Call String.prototype.replace on the very right-most source snippet. Useful\n                         * for trimming whitespace from the end of a source node, etc.\n                         *\n                         * @param aPattern The pattern to replace.\n                         * @param aReplacement The thing to replace the pattern with.\n                         */\n                        SourceNode.prototype.replaceRight = function SourceNode_replaceRight(\n                            aPattern,\n                            aReplacement\n                        ) {\n                            var lastChild = this.children[this.children.length - 1]\n                            if (lastChild instanceof SourceNode) {\n                                lastChild.replaceRight(aPattern, aReplacement)\n                            } else if (typeof lastChild === \"string\") {\n                                this.children[this.children.length - 1] = lastChild.replace(\n                                    aPattern,\n                                    aReplacement\n                                )\n                            } else {\n                                this.children.push(\"\".replace(aPattern, aReplacement))\n                            }\n                            return this\n                        }\n\n                        /**\n                         * Set the source content for a source file. This will be added to the SourceMapGenerator\n                         * in the sourcesContent field.\n                         *\n                         * @param aSourceFile The filename of the source file\n                         * @param aSourceContent The content of the source file\n                         */\n                        SourceNode.prototype.setSourceContent = function SourceNode_setSourceContent(\n                            aSourceFile,\n                            aSourceContent\n                        ) {\n                            this.sourceContents[util.toSetString(aSourceFile)] = aSourceContent\n                        }\n\n                        /**\n                         * Walk over the tree of SourceNodes. The walking function is called for each\n                         * source file content and is passed the filename and source content.\n                         *\n                         * @param aFn The traversal function.\n                         */\n                        SourceNode.prototype.walkSourceContents = function SourceNode_walkSourceContents(\n                            aFn\n                        ) {\n                            for (var i = 0, len = this.children.length; i < len; i++) {\n                                if (this.children[i] instanceof SourceNode) {\n                                    this.children[i].walkSourceContents(aFn)\n                                }\n                            }\n\n                            var sources = Object.keys(this.sourceContents)\n                            for (var i = 0, len = sources.length; i < len; i++) {\n                                aFn(util.fromSetString(sources[i]), this.sourceContents[sources[i]])\n                            }\n                        }\n\n                        /**\n                         * Return the string representation of this source node. Walks over the tree\n                         * and concatenates all the various snippets together to one string.\n                         */\n                        SourceNode.prototype.toString = function SourceNode_toString() {\n                            var str = \"\"\n                            this.walk(function(chunk) {\n                                str += chunk\n                            })\n                            return str\n                        }\n\n                        /**\n                         * Returns the string representation of this source node along with a source\n                         * map.\n                         */\n                        SourceNode.prototype.toStringWithSourceMap = function SourceNode_toStringWithSourceMap(\n                            aArgs\n                        ) {\n                            var generated = {\n                                code: \"\",\n                                line: 1,\n                                column: 0\n                            }\n                            var map = new SourceMapGenerator(aArgs)\n                            var sourceMappingActive = false\n                            var lastOriginalSource = null\n                            var lastOriginalLine = null\n                            var lastOriginalColumn = null\n                            var lastOriginalName = null\n                            this.walk(function(chunk, original) {\n                                generated.code += chunk\n                                if (\n                                    original.source !== null &&\n                                    original.line !== null &&\n                                    original.column !== null\n                                ) {\n                                    if (\n                                        lastOriginalSource !== original.source ||\n                                        lastOriginalLine !== original.line ||\n                                        lastOriginalColumn !== original.column ||\n                                        lastOriginalName !== original.name\n                                    ) {\n                                        map.addMapping({\n                                            source: original.source,\n                                            original: {\n                                                line: original.line,\n                                                column: original.column\n                                            },\n                                            generated: {\n                                                line: generated.line,\n                                                column: generated.column\n                                            },\n                                            name: original.name\n                                        })\n                                    }\n                                    lastOriginalSource = original.source\n                                    lastOriginalLine = original.line\n                                    lastOriginalColumn = original.column\n                                    lastOriginalName = original.name\n                                    sourceMappingActive = true\n                                } else if (sourceMappingActive) {\n                                    map.addMapping({\n                                        generated: {\n                                            line: generated.line,\n                                            column: generated.column\n                                        }\n                                    })\n                                    lastOriginalSource = null\n                                    sourceMappingActive = false\n                                }\n                                chunk.split(\"\").forEach(function(ch) {\n                                    if (ch === \"\\n\") {\n                                        generated.line++\n                                        generated.column = 0\n                                    } else {\n                                        generated.column++\n                                    }\n                                })\n                            })\n                            this.walkSourceContents(function(sourceFile, sourceContent) {\n                                map.setSourceContent(sourceFile, sourceContent)\n                            })\n\n                            return { code: generated.code, map: map }\n                        }\n\n                        exports.SourceNode = SourceNode\n                    })\n                },\n                { \"./source-map-generator\": 17, \"./util\": 19, amdefine: 20 }\n            ],\n            19: [\n                function(_dereq_, module, exports) {\n                    /* -*- Mode: js; js-indent-level: 2; -*- */\n                    /*\n                     * Copyright 2011 Mozilla Foundation and contributors\n                     * Licensed under the New BSD license. See LICENSE or:\n                     * http://opensource.org/licenses/BSD-3-Clause\n                     */\n                    if (typeof define !== \"function\") {\n                        var define = _dereq_(\"amdefine\")(module, _dereq_)\n                    }\n                    define(function(_dereq_, exports, module) {\n                        /**\n                         * This is a helper function for getting values from parameter/options\n                         * objects.\n                         *\n                         * @param args The object we are extracting values from\n                         * @param name The name of the property we are getting.\n                         * @param defaultValue An optional value to return if the property is missing\n                         * from the object. If this is not specified and the property is missing, an\n                         * error will be thrown.\n                         */\n                        function getArg(aArgs, aName, aDefaultValue) {\n                            if (aName in aArgs) {\n                                return aArgs[aName]\n                            } else if (arguments.length === 3) {\n                                return aDefaultValue\n                            } else {\n                                throw new Error('\"' + aName + '\" is a required argument.')\n                            }\n                        }\n                        exports.getArg = getArg\n\n                        var urlRegexp = /([\\w+\\-.]+):\\/\\/((\\w+:\\w+)@)?([\\w.]+)?(:(\\d+))?(\\S+)?/\n                        var dataUrlRegexp = /^data:.+\\,.+/\n\n                        function urlParse(aUrl) {\n                            var match = aUrl.match(urlRegexp)\n                            if (!match) {\n                                return null\n                            }\n                            return {\n                                scheme: match[1],\n                                auth: match[3],\n                                host: match[4],\n                                port: match[6],\n                                path: match[7]\n                            }\n                        }\n                        exports.urlParse = urlParse\n\n                        function urlGenerate(aParsedUrl) {\n                            var url = aParsedUrl.scheme + \"://\"\n                            if (aParsedUrl.auth) {\n                                url += aParsedUrl.auth + \"@\"\n                            }\n                            if (aParsedUrl.host) {\n                                url += aParsedUrl.host\n                            }\n                            if (aParsedUrl.port) {\n                                url += \":\" + aParsedUrl.port\n                            }\n                            if (aParsedUrl.path) {\n                                url += aParsedUrl.path\n                            }\n                            return url\n                        }\n                        exports.urlGenerate = urlGenerate\n\n                        function join(aRoot, aPath) {\n                            var url\n\n                            if (aPath.match(urlRegexp) || aPath.match(dataUrlRegexp)) {\n                                return aPath\n                            }\n\n                            if (aPath.charAt(0) === \"/\" && (url = urlParse(aRoot))) {\n                                url.path = aPath\n                                return urlGenerate(url)\n                            }\n\n                            return aRoot.replace(/\\/$/, \"\") + \"/\" + aPath\n                        }\n                        exports.join = join\n\n                        /**\n                         * Because behavior goes wacky when you set `__proto__` on objects, we\n                         * have to prefix all the strings in our set with an arbitrary character.\n                         *\n                         * See https://github.com/mozilla/source-map/pull/31 and\n                         * https://github.com/mozilla/source-map/issues/30\n                         *\n                         * @param String aStr\n                         */\n                        function toSetString(aStr) {\n                            return \"$\" + aStr\n                        }\n                        exports.toSetString = toSetString\n\n                        function fromSetString(aStr) {\n                            return aStr.substr(1)\n                        }\n                        exports.fromSetString = fromSetString\n\n                        function relative(aRoot, aPath) {\n                            aRoot = aRoot.replace(/\\/$/, \"\")\n\n                            var url = urlParse(aRoot)\n                            if (aPath.charAt(0) == \"/\" && url && url.path == \"/\") {\n                                return aPath.slice(1)\n                            }\n\n                            return aPath.indexOf(aRoot + \"/\") === 0\n                                ? aPath.substr(aRoot.length + 1)\n                                : aPath\n                        }\n                        exports.relative = relative\n\n                        function strcmp(aStr1, aStr2) {\n                            var s1 = aStr1 || \"\"\n                            var s2 = aStr2 || \"\"\n                            return (s1 > s2) - (s1 < s2)\n                        }\n\n                        /**\n                         * Comparator between two mappings where the original positions are compared.\n                         *\n                         * Optionally pass in `true` as `onlyCompareGenerated` to consider two\n                         * mappings with the same original source/line/column, but different generated\n                         * line and column the same. Useful when searching for a mapping with a\n                         * stubbed out mapping.\n                         */\n                        function compareByOriginalPositions(\n                            mappingA,\n                            mappingB,\n                            onlyCompareOriginal\n                        ) {\n                            var cmp\n\n                            cmp = strcmp(mappingA.source, mappingB.source)\n                            if (cmp) {\n                                return cmp\n                            }\n\n                            cmp = mappingA.originalLine - mappingB.originalLine\n                            if (cmp) {\n                                return cmp\n                            }\n\n                            cmp = mappingA.originalColumn - mappingB.originalColumn\n                            if (cmp || onlyCompareOriginal) {\n                                return cmp\n                            }\n\n                            cmp = strcmp(mappingA.name, mappingB.name)\n                            if (cmp) {\n                                return cmp\n                            }\n\n                            cmp = mappingA.generatedLine - mappingB.generatedLine\n                            if (cmp) {\n                                return cmp\n                            }\n\n                            return mappingA.generatedColumn - mappingB.generatedColumn\n                        }\n                        exports.compareByOriginalPositions = compareByOriginalPositions\n\n                        /**\n                         * Comparator between two mappings where the generated positions are\n                         * compared.\n                         *\n                         * Optionally pass in `true` as `onlyCompareGenerated` to consider two\n                         * mappings with the same generated line and column, but different\n                         * source/name/original line and column the same. Useful when searching for a\n                         * mapping with a stubbed out mapping.\n                         */\n                        function compareByGeneratedPositions(\n                            mappingA,\n                            mappingB,\n                            onlyCompareGenerated\n                        ) {\n                            var cmp\n\n                            cmp = mappingA.generatedLine - mappingB.generatedLine\n                            if (cmp) {\n                                return cmp\n                            }\n\n                            cmp = mappingA.generatedColumn - mappingB.generatedColumn\n                            if (cmp || onlyCompareGenerated) {\n                                return cmp\n                            }\n\n                            cmp = strcmp(mappingA.source, mappingB.source)\n                            if (cmp) {\n                                return cmp\n                            }\n\n                            cmp = mappingA.originalLine - mappingB.originalLine\n                            if (cmp) {\n                                return cmp\n                            }\n\n                            cmp = mappingA.originalColumn - mappingB.originalColumn\n                            if (cmp) {\n                                return cmp\n                            }\n\n                            return strcmp(mappingA.name, mappingB.name)\n                        }\n                        exports.compareByGeneratedPositions = compareByGeneratedPositions\n                    })\n                },\n                { amdefine: 20 }\n            ],\n            20: [\n                function(_dereq_, module, exports) {\n                    ;(function(process, __filename) {\n                        /** vim: et:ts=4:sw=4:sts=4\n                         * @license amdefine 0.1.0 Copyright (c) 2011, The Dojo Foundation All Rights Reserved.\n                         * Available via the MIT or new BSD license.\n                         * see: http://github.com/jrburke/amdefine for details\n                         */\n\n                        /*jslint node: true */\n                        /*global module, process */\n                        \"use strict\"\n\n                        /**\n                         * Creates a define for node.\n                         * @param {Object} module the \"module\" object that is defined by Node for the\n                         * current module.\n                         * @param {Function} [requireFn]. Node's require function for the current module.\n                         * It only needs to be passed in Node versions before 0.5, when module.require\n                         * did not exist.\n                         * @returns {Function} a define function that is usable for the current node\n                         * module.\n                         */\n                        function amdefine(module, requireFn) {\n                            \"use strict\"\n                            var defineCache = {},\n                                loaderCache = {},\n                                alreadyCalled = false,\n                                path = _dereq_(\"path\"),\n                                makeRequire,\n                                stringRequire\n\n                            /**\n                             * Trims the . and .. from an array of path segments.\n                             * It will keep a leading path segment if a .. will become\n                             * the first path segment, to help with module name lookups,\n                             * which act like paths, but can be remapped. But the end result,\n                             * all paths that use this function should look normalized.\n                             * NOTE: this method MODIFIES the input array.\n                             * @param {Array} ary the array of path segments.\n                             */\n                            function trimDots(ary) {\n                                var i, part\n                                for (i = 0; ary[i]; i += 1) {\n                                    part = ary[i]\n                                    if (part === \".\") {\n                                        ary.splice(i, 1)\n                                        i -= 1\n                                    } else if (part === \"..\") {\n                                        if (i === 1 && (ary[2] === \"..\" || ary[0] === \"..\")) {\n                                            //End of the line. Keep at least one non-dot\n                                            //path segment at the front so it can be mapped\n                                            //correctly to disk. Otherwise, there is likely\n                                            //no path mapping for a path starting with '..'.\n                                            //This can still fail, but catches the most reasonable\n                                            //uses of ..\n                                            break\n                                        } else if (i > 0) {\n                                            ary.splice(i - 1, 2)\n                                            i -= 2\n                                        }\n                                    }\n                                }\n                            }\n\n                            function normalize(name, baseName) {\n                                var baseParts\n\n                                //Adjust any relative paths.\n                                if (name && name.charAt(0) === \".\") {\n                                    //If have a base name, try to normalize against it,\n                                    //otherwise, assume it is a top-level require that will\n                                    //be relative to baseUrl in the end.\n                                    if (baseName) {\n                                        baseParts = baseName.split(\"/\")\n                                        baseParts = baseParts.slice(0, baseParts.length - 1)\n                                        baseParts = baseParts.concat(name.split(\"/\"))\n                                        trimDots(baseParts)\n                                        name = baseParts.join(\"/\")\n                                    }\n                                }\n\n                                return name\n                            }\n\n                            /**\n                             * Create the normalize() function passed to a loader plugin's\n                             * normalize method.\n                             */\n                            function makeNormalize(relName) {\n                                return function(name) {\n                                    return normalize(name, relName)\n                                }\n                            }\n\n                            function makeLoad(id) {\n                                function load(value) {\n                                    loaderCache[id] = value\n                                }\n\n                                load.fromText = function(id, text) {\n                                    //This one is difficult because the text can/probably uses\n                                    //define, and any relative paths and requires should be relative\n                                    //to that id was it would be found on disk. But this would require\n                                    //bootstrapping a module/require fairly deeply from node core.\n                                    //Not sure how best to go about that yet.\n                                    throw new Error(\"amdefine does not implement load.fromText\")\n                                }\n\n                                return load\n                            }\n\n                            makeRequire = function(systemRequire, exports, module, relId) {\n                                function amdRequire(deps, callback) {\n                                    if (typeof deps === \"string\") {\n                                        //Synchronous, single module require('')\n                                        return stringRequire(\n                                            systemRequire,\n                                            exports,\n                                            module,\n                                            deps,\n                                            relId\n                                        )\n                                    } else {\n                                        //Array of dependencies with a callback.\n\n                                        //Convert the dependencies to modules.\n                                        deps = deps.map(function(depName) {\n                                            return stringRequire(\n                                                systemRequire,\n                                                exports,\n                                                module,\n                                                depName,\n                                                relId\n                                            )\n                                        })\n\n                                        //Wait for next tick to call back the require call.\n                                        process.nextTick(function() {\n                                            callback.apply(null, deps)\n                                        })\n                                    }\n                                }\n\n                                amdRequire.toUrl = function(filePath) {\n                                    if (filePath.indexOf(\".\") === 0) {\n                                        return normalize(filePath, path.dirname(module.filename))\n                                    } else {\n                                        return filePath\n                                    }\n                                }\n\n                                return amdRequire\n                            }\n\n                            //Favor explicit value, passed in if the module wants to support Node 0.4.\n                            requireFn =\n                                requireFn ||\n                                function req() {\n                                    return module.require.apply(module, arguments)\n                                }\n\n                            function runFactory(id, deps, factory) {\n                                var r, e, m, result\n\n                                if (id) {\n                                    e = loaderCache[id] = {}\n                                    m = {\n                                        id: id,\n                                        uri: __filename,\n                                        exports: e\n                                    }\n                                    r = makeRequire(requireFn, e, m, id)\n                                } else {\n                                    //Only support one define call per file\n                                    if (alreadyCalled) {\n                                        throw new Error(\n                                            \"amdefine with no module ID cannot be called more than once per file.\"\n                                        )\n                                    }\n                                    alreadyCalled = true\n\n                                    //Use the real variables from node\n                                    //Use module.exports for exports, since\n                                    //the exports in here is amdefine exports.\n                                    e = module.exports\n                                    m = module\n                                    r = makeRequire(requireFn, e, m, module.id)\n                                }\n\n                                //If there are dependencies, they are strings, so need\n                                //to convert them to dependency values.\n                                if (deps) {\n                                    deps = deps.map(function(depName) {\n                                        return r(depName)\n                                    })\n                                }\n\n                                //Call the factory with the right dependencies.\n                                if (typeof factory === \"function\") {\n                                    result = factory.apply(m.exports, deps)\n                                } else {\n                                    result = factory\n                                }\n\n                                if (result !== undefined) {\n                                    m.exports = result\n                                    if (id) {\n                                        loaderCache[id] = m.exports\n                                    }\n                                }\n                            }\n\n                            stringRequire = function(systemRequire, exports, module, id, relId) {\n                                //Split the ID by a ! so that\n                                var index = id.indexOf(\"!\"),\n                                    originalId = id,\n                                    prefix,\n                                    plugin\n\n                                if (index === -1) {\n                                    id = normalize(id, relId)\n\n                                    //Straight module lookup. If it is one of the special dependencies,\n                                    //deal with it, otherwise, delegate to node.\n                                    if (id === \"require\") {\n                                        return makeRequire(systemRequire, exports, module, relId)\n                                    } else if (id === \"exports\") {\n                                        return exports\n                                    } else if (id === \"module\") {\n                                        return module\n                                    } else if (loaderCache.hasOwnProperty(id)) {\n                                        return loaderCache[id]\n                                    } else if (defineCache[id]) {\n                                        runFactory.apply(null, defineCache[id])\n                                        return loaderCache[id]\n                                    } else {\n                                        if (systemRequire) {\n                                            return systemRequire(originalId)\n                                        } else {\n                                            throw new Error(\"No module with ID: \" + id)\n                                        }\n                                    }\n                                } else {\n                                    //There is a plugin in play.\n                                    prefix = id.substring(0, index)\n                                    id = id.substring(index + 1, id.length)\n\n                                    plugin = stringRequire(\n                                        systemRequire,\n                                        exports,\n                                        module,\n                                        prefix,\n                                        relId\n                                    )\n\n                                    if (plugin.normalize) {\n                                        id = plugin.normalize(id, makeNormalize(relId))\n                                    } else {\n                                        //Normalize the ID normally.\n                                        id = normalize(id, relId)\n                                    }\n\n                                    if (loaderCache[id]) {\n                                        return loaderCache[id]\n                                    } else {\n                                        plugin.load(\n                                            id,\n                                            makeRequire(systemRequire, exports, module, relId),\n                                            makeLoad(id),\n                                            {}\n                                        )\n\n                                        return loaderCache[id]\n                                    }\n                                }\n                            }\n\n                            //Create a define function specific to the module asking for amdefine.\n                            function define(id, deps, factory) {\n                                if (Array.isArray(id)) {\n                                    factory = deps\n                                    deps = id\n                                    id = undefined\n                                } else if (typeof id !== \"string\") {\n                                    factory = id\n                                    id = deps = undefined\n                                }\n\n                                if (deps && !Array.isArray(deps)) {\n                                    factory = deps\n                                    deps = undefined\n                                }\n\n                                if (!deps) {\n                                    deps = [\"require\", \"exports\", \"module\"]\n                                }\n\n                                //Set up properties for this module. If an ID, then use\n                                //internal cache. If no ID, then use the external variables\n                                //for this node module.\n                                if (id) {\n                                    //Put the module in deep freeze until there is a\n                                    //require call for it.\n                                    defineCache[id] = [id, deps, factory]\n                                } else {\n                                    runFactory(id, deps, factory)\n                                }\n                            }\n\n                            //define.require, which has access to all the values in the\n                            //cache. Useful for AMD modules that all have IDs in the file,\n                            //but need to finally export a value to node based on one of those\n                            //IDs.\n                            define.require = function(id) {\n                                if (loaderCache[id]) {\n                                    return loaderCache[id]\n                                }\n\n                                if (defineCache[id]) {\n                                    runFactory.apply(null, defineCache[id])\n                                    return loaderCache[id]\n                                }\n                            }\n\n                            define.amd = {}\n\n                            return define\n                        }\n\n                        module.exports = amdefine\n                    }.call(\n                        this,\n                        _dereq_(\"_process\"),\n                        \"/node_modules/jstransform/node_modules/source-map/node_modules/amdefine/amdefine.js\"\n                    ))\n                },\n                { _process: 8, path: 7 }\n            ],\n            21: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013 Facebook, Inc.\n                     *\n                     * Licensed under the Apache License, Version 2.0 (the \"License\");\n                     * you may not use this file except in compliance with the License.\n                     * You may obtain a copy of the License at\n                     *\n                     * http://www.apache.org/licenses/LICENSE-2.0\n                     *\n                     * Unless required by applicable law or agreed to in writing, software\n                     * distributed under the License is distributed on an \"AS IS\" BASIS,\n                     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n                     * See the License for the specific language governing permissions and\n                     * limitations under the License.\n                     */\n\n                    var docblockRe = /^\\s*(\\/\\*\\*(.|\\r?\\n)*?\\*\\/)/\n                    var ltrimRe = /^\\s*/\n                    /**\n                     * @param {String} contents\n                     * @return {String}\n                     */\n                    function extract(contents) {\n                        var match = contents.match(docblockRe)\n                        if (match) {\n                            return match[0].replace(ltrimRe, \"\") || \"\"\n                        }\n                        return \"\"\n                    }\n\n                    var commentStartRe = /^\\/\\*\\*?/\n                    var commentEndRe = /\\*+\\/$/\n                    var wsRe = /[\\t ]+/g\n                    var stringStartRe = /(\\r?\\n|^) *\\*/g\n                    var multilineRe = /(?:^|\\r?\\n) *(@[^\\r\\n]*?) *\\r?\\n *([^@\\r\\n\\s][^@\\r\\n]+?) *\\r?\\n/g\n                    var propertyRe = /(?:^|\\r?\\n) *@(\\S+) *([^\\r\\n]*)/g\n\n                    /**\n                     * @param {String} contents\n                     * @return {Array}\n                     */\n                    function parse(docblock) {\n                        docblock = docblock\n                            .replace(commentStartRe, \"\")\n                            .replace(commentEndRe, \"\")\n                            .replace(wsRe, \" \")\n                            .replace(stringStartRe, \"$1\")\n\n                        // Normalize multi-line directives\n                        var prev = \"\"\n                        while (prev != docblock) {\n                            prev = docblock\n                            docblock = docblock.replace(multilineRe, \"\\n$1 $2\\n\")\n                        }\n                        docblock = docblock.trim()\n\n                        var result = []\n                        var match\n                        while ((match = propertyRe.exec(docblock))) {\n                            result.push([match[1], match[2]])\n                        }\n\n                        return result\n                    }\n\n                    /**\n                     * Same as parse but returns an object of prop: value instead of array of paris\n                     * If a property appers more than once the last one will be returned\n                     *\n                     * @param {String} contents\n                     * @return {Object}\n                     */\n                    function parseAsObject(docblock) {\n                        var pairs = parse(docblock)\n                        var result = {}\n                        for (var i = 0; i < pairs.length; i++) {\n                            result[pairs[i][0]] = pairs[i][1]\n                        }\n                        return result\n                    }\n\n                    exports.extract = extract\n                    exports.parse = parse\n                    exports.parseAsObject = parseAsObject\n                },\n                {}\n            ],\n            22: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013 Facebook, Inc.\n                     *\n                     * Licensed under the Apache License, Version 2.0 (the \"License\");\n                     * you may not use this file except in compliance with the License.\n                     * You may obtain a copy of the License at\n                     *\n                     * http://www.apache.org/licenses/LICENSE-2.0\n                     *\n                     * Unless required by applicable law or agreed to in writing, software\n                     * distributed under the License is distributed on an \"AS IS\" BASIS,\n                     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n                     * See the License for the specific language governing permissions and\n                     * limitations under the License.\n                     */\n\n                    /*jslint node: true*/\n                    \"use strict\"\n\n                    var esprima = _dereq_(\"esprima-fb\")\n                    var utils = _dereq_(\"./utils\")\n\n                    var getBoundaryNode = utils.getBoundaryNode\n                    var declareIdentInScope = utils.declareIdentInLocalScope\n                    var initScopeMetadata = utils.initScopeMetadata\n                    var Syntax = esprima.Syntax\n\n                    /**\n                     * @param {object} node\n                     * @param {object} parentNode\n                     * @return {boolean}\n                     */\n                    function _nodeIsClosureScopeBoundary(node, parentNode) {\n                        if (node.type === Syntax.Program) {\n                            return true\n                        }\n\n                        var parentIsFunction =\n                            parentNode.type === Syntax.FunctionDeclaration ||\n                            parentNode.type === Syntax.FunctionExpression ||\n                            parentNode.type === Syntax.ArrowFunctionExpression\n\n                        var parentIsCurlylessArrowFunc =\n                            parentNode.type === Syntax.ArrowFunctionExpression &&\n                            node === parentNode.body\n\n                        return (\n                            parentIsFunction &&\n                            (node.type === Syntax.BlockStatement || parentIsCurlylessArrowFunc)\n                        )\n                    }\n\n                    function _nodeIsBlockScopeBoundary(node, parentNode) {\n                        if (node.type === Syntax.Program) {\n                            return false\n                        }\n\n                        return (\n                            node.type === Syntax.BlockStatement &&\n                            parentNode.type === Syntax.CatchClause\n                        )\n                    }\n\n                    /**\n                     * @param {object} node\n                     * @param {array} path\n                     * @param {object} state\n                     */\n                    function traverse(node, path, state) {\n                        /*jshint -W004*/\n                        // Create a scope stack entry if this is the first node we've encountered in\n                        // its local scope\n                        var startIndex = null\n                        var parentNode = path[0]\n                        if (!Array.isArray(node) && state.localScope.parentNode !== parentNode) {\n                            if (_nodeIsClosureScopeBoundary(node, parentNode)) {\n                                var scopeIsStrict = state.scopeIsStrict\n                                if (\n                                    !scopeIsStrict &&\n                                    (node.type === Syntax.BlockStatement ||\n                                        node.type === Syntax.Program)\n                                ) {\n                                    scopeIsStrict =\n                                        node.body.length > 0 &&\n                                        node.body[0].type === Syntax.ExpressionStatement &&\n                                        node.body[0].expression.type === Syntax.Literal &&\n                                        node.body[0].expression.value === \"use strict\"\n                                }\n\n                                if (node.type === Syntax.Program) {\n                                    startIndex = state.g.buffer.length\n                                    state = utils.updateState(state, {\n                                        scopeIsStrict: scopeIsStrict\n                                    })\n                                } else {\n                                    startIndex = state.g.buffer.length + 1\n                                    state = utils.updateState(state, {\n                                        localScope: {\n                                            parentNode: parentNode,\n                                            parentScope: state.localScope,\n                                            identifiers: {},\n                                            tempVarIndex: 0,\n                                            tempVars: []\n                                        },\n                                        scopeIsStrict: scopeIsStrict\n                                    })\n\n                                    // All functions have an implicit 'arguments' object in scope\n                                    declareIdentInScope(\"arguments\", initScopeMetadata(node), state)\n\n                                    // Include function arg identifiers in the scope boundaries of the\n                                    // function\n                                    if (parentNode.params.length > 0) {\n                                        var param\n                                        var metadata = initScopeMetadata(\n                                            parentNode,\n                                            path.slice(1),\n                                            path[0]\n                                        )\n                                        for (var i = 0; i < parentNode.params.length; i++) {\n                                            param = parentNode.params[i]\n                                            if (param.type === Syntax.Identifier) {\n                                                declareIdentInScope(param.name, metadata, state)\n                                            }\n                                        }\n                                    }\n\n                                    // Include rest arg identifiers in the scope boundaries of their\n                                    // functions\n                                    if (parentNode.rest) {\n                                        var metadata = initScopeMetadata(\n                                            parentNode,\n                                            path.slice(1),\n                                            path[0]\n                                        )\n                                        declareIdentInScope(parentNode.rest.name, metadata, state)\n                                    }\n\n                                    // Named FunctionExpressions scope their name within the body block of\n                                    // themselves only\n                                    if (\n                                        parentNode.type === Syntax.FunctionExpression &&\n                                        parentNode.id\n                                    ) {\n                                        var metaData = initScopeMetadata(\n                                            parentNode,\n                                            path.parentNodeslice,\n                                            parentNode\n                                        )\n                                        declareIdentInScope(parentNode.id.name, metaData, state)\n                                    }\n                                }\n\n                                // Traverse and find all local identifiers in this closure first to\n                                // account for function/variable declaration hoisting\n                                collectClosureIdentsAndTraverse(node, path, state)\n                            }\n\n                            if (_nodeIsBlockScopeBoundary(node, parentNode)) {\n                                startIndex = state.g.buffer.length\n                                state = utils.updateState(state, {\n                                    localScope: {\n                                        parentNode: parentNode,\n                                        parentScope: state.localScope,\n                                        identifiers: {},\n                                        tempVarIndex: 0,\n                                        tempVars: []\n                                    }\n                                })\n\n                                if (parentNode.type === Syntax.CatchClause) {\n                                    var metadata = initScopeMetadata(\n                                        parentNode,\n                                        path.slice(1),\n                                        parentNode\n                                    )\n                                    declareIdentInScope(parentNode.param.name, metadata, state)\n                                }\n                                collectBlockIdentsAndTraverse(node, path, state)\n                            }\n                        }\n\n                        // Only catchup() before and after traversing a child node\n                        function traverser(node, path, state) {\n                            node.range && utils.catchup(node.range[0], state)\n                            traverse(node, path, state)\n                            node.range && utils.catchup(node.range[1], state)\n                        }\n\n                        utils.analyzeAndTraverse(walker, traverser, node, path, state)\n\n                        // Inject temp variables into the scope.\n                        if (startIndex !== null) {\n                            utils.injectTempVarDeclarations(state, startIndex)\n                        }\n                    }\n\n                    function collectClosureIdentsAndTraverse(node, path, state) {\n                        utils.analyzeAndTraverse(\n                            visitLocalClosureIdentifiers,\n                            collectClosureIdentsAndTraverse,\n                            node,\n                            path,\n                            state\n                        )\n                    }\n\n                    function collectBlockIdentsAndTraverse(node, path, state) {\n                        utils.analyzeAndTraverse(\n                            visitLocalBlockIdentifiers,\n                            collectBlockIdentsAndTraverse,\n                            node,\n                            path,\n                            state\n                        )\n                    }\n\n                    function visitLocalClosureIdentifiers(node, path, state) {\n                        var metaData\n                        switch (node.type) {\n                            case Syntax.ArrowFunctionExpression:\n                            case Syntax.FunctionExpression:\n                                // Function expressions don't get their names (if there is one) added to\n                                // the closure scope they're defined in\n                                return false\n                            case Syntax.ClassDeclaration:\n                            case Syntax.ClassExpression:\n                            case Syntax.FunctionDeclaration:\n                                if (node.id) {\n                                    metaData = initScopeMetadata(\n                                        getBoundaryNode(path),\n                                        path.slice(),\n                                        node\n                                    )\n                                    declareIdentInScope(node.id.name, metaData, state)\n                                }\n                                return false\n                            case Syntax.VariableDeclarator:\n                                // Variables have function-local scope\n                                if (path[0].kind === \"var\") {\n                                    metaData = initScopeMetadata(\n                                        getBoundaryNode(path),\n                                        path.slice(),\n                                        node\n                                    )\n                                    declareIdentInScope(node.id.name, metaData, state)\n                                }\n                                break\n                        }\n                    }\n\n                    function visitLocalBlockIdentifiers(node, path, state) {\n                        // TODO: Support 'let' here...maybe...one day...or something...\n                        if (node.type === Syntax.CatchClause) {\n                            return false\n                        }\n                    }\n\n                    function walker(node, path, state) {\n                        var visitors = state.g.visitors\n                        for (var i = 0; i < visitors.length; i++) {\n                            if (visitors[i].test(node, path, state)) {\n                                return visitors[i](traverse, node, path, state)\n                            }\n                        }\n                    }\n\n                    var _astCache = {}\n\n                    function getAstForSource(source, options) {\n                        if (_astCache[source] && !options.disableAstCache) {\n                            return _astCache[source]\n                        }\n                        var ast = esprima.parse(source, {\n                            comment: true,\n                            loc: true,\n                            range: true,\n                            sourceType: options.sourceType\n                        })\n                        if (!options.disableAstCache) {\n                            _astCache[source] = ast\n                        }\n                        return ast\n                    }\n\n                    /**\n                     * Applies all available transformations to the source\n                     * @param {array} visitors\n                     * @param {string} source\n                     * @param {?object} options\n                     * @return {object}\n                     */\n                    function transform(visitors, source, options) {\n                        options = options || {}\n                        var ast\n                        try {\n                            ast = getAstForSource(source, options)\n                        } catch (e) {\n                            e.message = \"Parse Error: \" + e.message\n                            throw e\n                        }\n                        var state = utils.createState(source, ast, options)\n                        state.g.visitors = visitors\n\n                        if (options.sourceMap) {\n                            var SourceMapGenerator = _dereq_(\"source-map\").SourceMapGenerator\n                            state.g.sourceMap = new SourceMapGenerator({\n                                file: options.filename || \"transformed.js\"\n                            })\n                        }\n\n                        traverse(ast, [], state)\n                        utils.catchup(source.length, state)\n\n                        var ret = { code: state.g.buffer, extra: state.g.extra }\n                        if (options.sourceMap) {\n                            ret.sourceMap = state.g.sourceMap\n                            ret.sourceMapFilename = options.filename || \"source.js\"\n                        }\n                        return ret\n                    }\n\n                    exports.transform = transform\n                    exports.Syntax = Syntax\n                },\n                { \"./utils\": 23, \"esprima-fb\": 9, \"source-map\": 11 }\n            ],\n            23: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013 Facebook, Inc.\n                     *\n                     * Licensed under the Apache License, Version 2.0 (the \"License\");\n                     * you may not use this file except in compliance with the License.\n                     * You may obtain a copy of the License at\n                     *\n                     * http://www.apache.org/licenses/LICENSE-2.0\n                     *\n                     * Unless required by applicable law or agreed to in writing, software\n                     * distributed under the License is distributed on an \"AS IS\" BASIS,\n                     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n                     * See the License for the specific language governing permissions and\n                     * limitations under the License.\n                     */\n\n                    /*jslint node: true*/\n                    var Syntax = _dereq_(\"esprima-fb\").Syntax\n                    var leadingIndentRegexp = /(^|\\n)( {2}|\\t)/g\n                    var nonWhiteRegexp = /(\\S)/g\n\n                    /**\n                     * A `state` object represents the state of the parser. It has \"local\" and\n                     * \"global\" parts. Global contains parser position, source, etc. Local contains\n                     * scope based properties like current class name. State should contain all the\n                     * info required for transformation. It's the only mandatory object that is\n                     * being passed to every function in transform chain.\n                     *\n                     * @param  {string} source\n                     * @param  {object} transformOptions\n                     * @return {object}\n                     */\n                    function createState(source, rootNode, transformOptions) {\n                        return {\n                            /**\n                             * A tree representing the current local scope (and its lexical scope chain)\n                             * Useful for tracking identifiers from parent scopes, etc.\n                             * @type {Object}\n                             */\n                            localScope: {\n                                parentNode: rootNode,\n                                parentScope: null,\n                                identifiers: {},\n                                tempVarIndex: 0,\n                                tempVars: []\n                            },\n                            /**\n                             * The name (and, if applicable, expression) of the super class\n                             * @type {Object}\n                             */\n                            superClass: null,\n                            /**\n                             * The namespace to use when munging identifiers\n                             * @type {String}\n                             */\n                            mungeNamespace: \"\",\n                            /**\n                             * Ref to the node for the current MethodDefinition\n                             * @type {Object}\n                             */\n                            methodNode: null,\n                            /**\n                             * Ref to the node for the FunctionExpression of the enclosing\n                             * MethodDefinition\n                             * @type {Object}\n                             */\n                            methodFuncNode: null,\n                            /**\n                             * Name of the enclosing class\n                             * @type {String}\n                             */\n                            className: null,\n                            /**\n                             * Whether we're currently within a `strict` scope\n                             * @type {Bool}\n                             */\n                            scopeIsStrict: null,\n                            /**\n                             * Indentation offset\n                             * @type {Number}\n                             */\n                            indentBy: 0,\n                            /**\n                             * Global state (not affected by updateState)\n                             * @type {Object}\n                             */\n                            g: {\n                                /**\n                                 * A set of general options that transformations can consider while doing\n                                 * a transformation:\n                                 *\n                                 * - minify\n                                 *   Specifies that transformation steps should do their best to minify\n                                 *   the output source when possible. This is useful for places where\n                                 *   minification optimizations are possible with higher-level context\n                                 *   info than what jsxmin can provide.\n                                 *\n                                 *   For example, the ES6 class transform will minify munged private\n                                 *   variables if this flag is set.\n                                 */\n                                opts: transformOptions,\n                                /**\n                                 * Current position in the source code\n                                 * @type {Number}\n                                 */\n                                position: 0,\n                                /**\n                                 * Auxiliary data to be returned by transforms\n                                 * @type {Object}\n                                 */\n                                extra: {},\n                                /**\n                                 * Buffer containing the result\n                                 * @type {String}\n                                 */\n                                buffer: \"\",\n                                /**\n                                 * Source that is being transformed\n                                 * @type {String}\n                                 */\n                                source: source,\n\n                                /**\n                                 * Cached parsed docblock (see getDocblock)\n                                 * @type {object}\n                                 */\n                                docblock: null,\n\n                                /**\n                                 * Whether the thing was used\n                                 * @type {Boolean}\n                                 */\n                                tagNamespaceUsed: false,\n\n                                /**\n                                 * If using bolt xjs transformation\n                                 * @type {Boolean}\n                                 */\n                                isBolt: undefined,\n\n                                /**\n                                 * Whether to record source map (expensive) or not\n                                 * @type {SourceMapGenerator|null}\n                                 */\n                                sourceMap: null,\n\n                                /**\n                                 * Filename of the file being processed. Will be returned as a source\n                                 * attribute in the source map\n                                 */\n                                sourceMapFilename: \"source.js\",\n\n                                /**\n                                 * Only when source map is used: last line in the source for which\n                                 * source map was generated\n                                 * @type {Number}\n                                 */\n                                sourceLine: 1,\n\n                                /**\n                                 * Only when source map is used: last line in the buffer for which\n                                 * source map was generated\n                                 * @type {Number}\n                                 */\n                                bufferLine: 1,\n\n                                /**\n                                 * The top-level Program AST for the original file.\n                                 */\n                                originalProgramAST: null,\n\n                                sourceColumn: 0,\n                                bufferColumn: 0\n                            }\n                        }\n                    }\n\n                    /**\n                     * Updates a copy of a given state with \"update\" and returns an updated state.\n                     *\n                     * @param  {object} state\n                     * @param  {object} update\n                     * @return {object}\n                     */\n                    function updateState(state, update) {\n                        var ret = Object.create(state)\n                        Object.keys(update).forEach(function(updatedKey) {\n                            ret[updatedKey] = update[updatedKey]\n                        })\n                        return ret\n                    }\n\n                    /**\n                     * Given a state fill the resulting buffer from the original source up to\n                     * the end\n                     *\n                     * @param {number} end\n                     * @param {object} state\n                     * @param {?function} contentTransformer Optional callback to transform newly\n                     *                                       added content.\n                     */\n                    function catchup(end, state, contentTransformer) {\n                        if (end < state.g.position) {\n                            // cannot move backwards\n                            return\n                        }\n                        var source = state.g.source.substring(state.g.position, end)\n                        var transformed = updateIndent(source, state)\n                        if (state.g.sourceMap && transformed) {\n                            // record where we are\n                            state.g.sourceMap.addMapping({\n                                generated: {\n                                    line: state.g.bufferLine,\n                                    column: state.g.bufferColumn\n                                },\n                                original: {\n                                    line: state.g.sourceLine,\n                                    column: state.g.sourceColumn\n                                },\n                                source: state.g.sourceMapFilename\n                            })\n\n                            // record line breaks in transformed source\n                            var sourceLines = source.split(\"\\n\")\n                            var transformedLines = transformed.split(\"\\n\")\n                            // Add line break mappings between last known mapping and the end of the\n                            // added piece. So for the code piece\n                            //  (foo, bar);\n                            // > var x = 2;\n                            // > var b = 3;\n                            //   var c =\n                            // only add lines marked with \">\": 2, 3.\n                            for (var i = 1; i < sourceLines.length - 1; i++) {\n                                state.g.sourceMap.addMapping({\n                                    generated: { line: state.g.bufferLine, column: 0 },\n                                    original: { line: state.g.sourceLine, column: 0 },\n                                    source: state.g.sourceMapFilename\n                                })\n                                state.g.sourceLine++\n                                state.g.bufferLine++\n                            }\n                            // offset for the last piece\n                            if (sourceLines.length > 1) {\n                                state.g.sourceLine++\n                                state.g.bufferLine++\n                                state.g.sourceColumn = 0\n                                state.g.bufferColumn = 0\n                            }\n                            state.g.sourceColumn += sourceLines[sourceLines.length - 1].length\n                            state.g.bufferColumn +=\n                                transformedLines[transformedLines.length - 1].length\n                        }\n                        state.g.buffer += contentTransformer\n                            ? contentTransformer(transformed)\n                            : transformed\n                        state.g.position = end\n                    }\n\n                    /**\n                     * Returns original source for an AST node.\n                     * @param {object} node\n                     * @param {object} state\n                     * @return {string}\n                     */\n                    function getNodeSourceText(node, state) {\n                        return state.g.source.substring(node.range[0], node.range[1])\n                    }\n\n                    function _replaceNonWhite(value) {\n                        return value.replace(nonWhiteRegexp, \" \")\n                    }\n\n                    /**\n                     * Removes all non-whitespace characters\n                     */\n                    function _stripNonWhite(value) {\n                        return value.replace(nonWhiteRegexp, \"\")\n                    }\n\n                    /**\n                     * Finds the position of the next instance of the specified syntactic char in\n                     * the pending source.\n                     *\n                     * NOTE: This will skip instances of the specified char if they sit inside a\n                     *       comment body.\n                     *\n                     * NOTE: This function also assumes that the buffer's current position is not\n                     *       already within a comment or a string. This is rarely the case since all\n                     *       of the buffer-advancement utility methods tend to be used on syntactic\n                     *       nodes' range values -- but it's a small gotcha that's worth mentioning.\n                     */\n                    function getNextSyntacticCharOffset(char, state) {\n                        var pendingSource = state.g.source.substring(state.g.position)\n                        var pendingSourceLines = pendingSource.split(\"\\n\")\n\n                        var charOffset = 0\n                        var line\n                        var withinBlockComment = false\n                        var withinString = false\n                        lineLoop: while ((line = pendingSourceLines.shift()) !== undefined) {\n                            var lineEndPos = charOffset + line.length\n                            charLoop: for (; charOffset < lineEndPos; charOffset++) {\n                                var currChar = pendingSource[charOffset]\n                                if (currChar === '\"' || currChar === \"'\") {\n                                    withinString = !withinString\n                                    continue charLoop\n                                } else if (withinString) {\n                                    continue charLoop\n                                } else if (charOffset + 1 < lineEndPos) {\n                                    var nextTwoChars = currChar + line[charOffset + 1]\n                                    if (nextTwoChars === \"//\") {\n                                        charOffset = lineEndPos + 1\n                                        continue lineLoop\n                                    } else if (nextTwoChars === \"/*\") {\n                                        withinBlockComment = true\n                                        charOffset += 1\n                                        continue charLoop\n                                    } else if (nextTwoChars === \"*/\") {\n                                        withinBlockComment = false\n                                        charOffset += 1\n                                        continue charLoop\n                                    }\n                                }\n\n                                if (!withinBlockComment && currChar === char) {\n                                    return charOffset + state.g.position\n                                }\n                            }\n\n                            // Account for '\\n'\n                            charOffset++\n                            withinString = false\n                        }\n\n                        throw new Error(\"`\" + char + \"` not found!\")\n                    }\n\n                    /**\n                     * Catches up as `catchup` but replaces non-whitespace chars with spaces.\n                     */\n                    function catchupWhiteOut(end, state) {\n                        catchup(end, state, _replaceNonWhite)\n                    }\n\n                    /**\n                     * Catches up as `catchup` but removes all non-whitespace characters.\n                     */\n                    function catchupWhiteSpace(end, state) {\n                        catchup(end, state, _stripNonWhite)\n                    }\n\n                    /**\n                     * Removes all non-newline characters\n                     */\n                    var reNonNewline = /[^\\n]/g\n                    function stripNonNewline(value) {\n                        return value.replace(reNonNewline, function() {\n                            return \"\"\n                        })\n                    }\n\n                    /**\n                     * Catches up as `catchup` but removes all non-newline characters.\n                     *\n                     * Equivalent to appending as many newlines as there are in the original source\n                     * between the current position and `end`.\n                     */\n                    function catchupNewlines(end, state) {\n                        catchup(end, state, stripNonNewline)\n                    }\n\n                    /**\n                     * Same as catchup but does not touch the buffer\n                     *\n                     * @param  {number} end\n                     * @param  {object} state\n                     */\n                    function move(end, state) {\n                        // move the internal cursors\n                        if (state.g.sourceMap) {\n                            if (end < state.g.position) {\n                                state.g.position = 0\n                                state.g.sourceLine = 1\n                                state.g.sourceColumn = 0\n                            }\n\n                            var source = state.g.source.substring(state.g.position, end)\n                            var sourceLines = source.split(\"\\n\")\n                            if (sourceLines.length > 1) {\n                                state.g.sourceLine += sourceLines.length - 1\n                                state.g.sourceColumn = 0\n                            }\n                            state.g.sourceColumn += sourceLines[sourceLines.length - 1].length\n                        }\n                        state.g.position = end\n                    }\n\n                    /**\n                     * Appends a string of text to the buffer\n                     *\n                     * @param {string} str\n                     * @param {object} state\n                     */\n                    function append(str, state) {\n                        if (state.g.sourceMap && str) {\n                            state.g.sourceMap.addMapping({\n                                generated: {\n                                    line: state.g.bufferLine,\n                                    column: state.g.bufferColumn\n                                },\n                                original: {\n                                    line: state.g.sourceLine,\n                                    column: state.g.sourceColumn\n                                },\n                                source: state.g.sourceMapFilename\n                            })\n                            var transformedLines = str.split(\"\\n\")\n                            if (transformedLines.length > 1) {\n                                state.g.bufferLine += transformedLines.length - 1\n                                state.g.bufferColumn = 0\n                            }\n                            state.g.bufferColumn +=\n                                transformedLines[transformedLines.length - 1].length\n                        }\n                        state.g.buffer += str\n                    }\n\n                    /**\n                     * Update indent using state.indentBy property. Indent is measured in\n                     * double spaces. Updates a single line only.\n                     *\n                     * @param {string} str\n                     * @param {object} state\n                     * @return {string}\n                     */\n                    function updateIndent(str, state) {\n                        /*jshint -W004*/\n                        var indentBy = state.indentBy\n                        if (indentBy < 0) {\n                            for (var i = 0; i < -indentBy; i++) {\n                                str = str.replace(leadingIndentRegexp, \"$1\")\n                            }\n                        } else {\n                            for (var i = 0; i < indentBy; i++) {\n                                str = str.replace(leadingIndentRegexp, \"$1$2$2\")\n                            }\n                        }\n                        return str\n                    }\n\n                    /**\n                     * Calculates indent from the beginning of the line until \"start\" or the first\n                     * character before start.\n                     * @example\n                     *   \"  foo.bar()\"\n                     *         ^\n                     *       start\n                     *   indent will be \"  \"\n                     *\n                     * @param  {number} start\n                     * @param  {object} state\n                     * @return {string}\n                     */\n                    function indentBefore(start, state) {\n                        var end = start\n                        start = start - 1\n\n                        while (start > 0 && state.g.source[start] != \"\\n\") {\n                            if (!state.g.source[start].match(/[ \\t]/)) {\n                                end = start\n                            }\n                            start--\n                        }\n                        return state.g.source.substring(start + 1, end)\n                    }\n\n                    function getDocblock(state) {\n                        if (!state.g.docblock) {\n                            var docblock = _dereq_(\"./docblock\")\n                            state.g.docblock = docblock.parseAsObject(\n                                docblock.extract(state.g.source)\n                            )\n                        }\n                        return state.g.docblock\n                    }\n\n                    function identWithinLexicalScope(identName, state, stopBeforeNode) {\n                        var currScope = state.localScope\n                        while (currScope) {\n                            if (currScope.identifiers[identName] !== undefined) {\n                                return true\n                            }\n\n                            if (stopBeforeNode && currScope.parentNode === stopBeforeNode) {\n                                break\n                            }\n\n                            currScope = currScope.parentScope\n                        }\n                        return false\n                    }\n\n                    function identInLocalScope(identName, state) {\n                        return state.localScope.identifiers[identName] !== undefined\n                    }\n\n                    /**\n                     * @param {object} boundaryNode\n                     * @param {?array} path\n                     * @return {?object} node\n                     */\n                    function initScopeMetadata(boundaryNode, path, node) {\n                        return {\n                            boundaryNode: boundaryNode,\n                            bindingPath: path,\n                            bindingNode: node\n                        }\n                    }\n\n                    function declareIdentInLocalScope(identName, metaData, state) {\n                        state.localScope.identifiers[identName] = {\n                            boundaryNode: metaData.boundaryNode,\n                            path: metaData.bindingPath,\n                            node: metaData.bindingNode,\n                            state: Object.create(state)\n                        }\n                    }\n\n                    function getLexicalBindingMetadata(identName, state) {\n                        var currScope = state.localScope\n                        while (currScope) {\n                            if (currScope.identifiers[identName] !== undefined) {\n                                return currScope.identifiers[identName]\n                            }\n\n                            currScope = currScope.parentScope\n                        }\n                    }\n\n                    function getLocalBindingMetadata(identName, state) {\n                        return state.localScope.identifiers[identName]\n                    }\n\n                    /**\n                     * Apply the given analyzer function to the current node. If the analyzer\n                     * doesn't return false, traverse each child of the current node using the given\n                     * traverser function.\n                     *\n                     * @param {function} analyzer\n                     * @param {function} traverser\n                     * @param {object} node\n                     * @param {array} path\n                     * @param {object} state\n                     */\n                    function analyzeAndTraverse(analyzer, traverser, node, path, state) {\n                        if (node.type) {\n                            if (analyzer(node, path, state) === false) {\n                                return\n                            }\n                            path.unshift(node)\n                        }\n\n                        getOrderedChildren(node).forEach(function(child) {\n                            traverser(child, path, state)\n                        })\n\n                        node.type && path.shift()\n                    }\n\n                    /**\n                     * It is crucial that we traverse in order, or else catchup() on a later\n                     * node that is processed out of order can move the buffer past a node\n                     * that we haven't handled yet, preventing us from modifying that node.\n                     *\n                     * This can happen when a node has multiple properties containing children.\n                     * For example, XJSElement nodes have `openingElement`, `closingElement` and\n                     * `children`. If we traverse `openingElement`, then `closingElement`, then\n                     * when we get to `children`, the buffer has already caught up to the end of\n                     * the closing element, after the children.\n                     *\n                     * This is basically a Schwartzian transform. Collects an array of children,\n                     * each one represented as [child, startIndex]; sorts the array by start\n                     * index; then traverses the children in that order.\n                     */\n                    function getOrderedChildren(node) {\n                        var queue = []\n                        for (var key in node) {\n                            if (node.hasOwnProperty(key)) {\n                                enqueueNodeWithStartIndex(queue, node[key])\n                            }\n                        }\n                        queue.sort(function(a, b) {\n                            return a[1] - b[1]\n                        })\n                        return queue.map(function(pair) {\n                            return pair[0]\n                        })\n                    }\n\n                    /**\n                     * Helper function for analyzeAndTraverse which queues up all of the children\n                     * of the given node.\n                     *\n                     * Children can also be found in arrays, so we basically want to merge all of\n                     * those arrays together so we can sort them and then traverse the children\n                     * in order.\n                     *\n                     * One example is the Program node. It contains `body` and `comments`, both\n                     * arrays. Lexographically, comments are interspersed throughout the body\n                     * nodes, but esprima's AST groups them together.\n                     */\n                    function enqueueNodeWithStartIndex(queue, node) {\n                        if (typeof node !== \"object\" || node === null) {\n                            return\n                        }\n                        if (node.range) {\n                            queue.push([node, node.range[0]])\n                        } else if (Array.isArray(node)) {\n                            for (var ii = 0; ii < node.length; ii++) {\n                                enqueueNodeWithStartIndex(queue, node[ii])\n                            }\n                        }\n                    }\n\n                    /**\n                     * Checks whether a node or any of its sub-nodes contains\n                     * a syntactic construct of the passed type.\n                     * @param {object} node - AST node to test.\n                     * @param {string} type - node type to lookup.\n                     */\n                    function containsChildOfType(node, type) {\n                        return containsChildMatching(node, function(node) {\n                            return node.type === type\n                        })\n                    }\n\n                    function containsChildMatching(node, matcher) {\n                        var foundMatchingChild = false\n                        function nodeTypeAnalyzer(node) {\n                            if (matcher(node) === true) {\n                                foundMatchingChild = true\n                                return false\n                            }\n                        }\n                        function nodeTypeTraverser(child, path, state) {\n                            if (!foundMatchingChild) {\n                                foundMatchingChild = containsChildMatching(child, matcher)\n                            }\n                        }\n                        analyzeAndTraverse(nodeTypeAnalyzer, nodeTypeTraverser, node, [])\n                        return foundMatchingChild\n                    }\n\n                    var scopeTypes = {}\n                    scopeTypes[Syntax.ArrowFunctionExpression] = true\n                    scopeTypes[Syntax.FunctionExpression] = true\n                    scopeTypes[Syntax.FunctionDeclaration] = true\n                    scopeTypes[Syntax.Program] = true\n\n                    function getBoundaryNode(path) {\n                        for (var ii = 0; ii < path.length; ++ii) {\n                            if (scopeTypes[path[ii].type]) {\n                                return path[ii]\n                            }\n                        }\n                        throw new Error(\n                            \"Expected to find a node with one of the following types in path:\\n\" +\n                                JSON.stringify(Object.keys(scopeTypes))\n                        )\n                    }\n\n                    function getTempVar(tempVarIndex) {\n                        return \"$__\" + tempVarIndex\n                    }\n\n                    function injectTempVar(state) {\n                        var tempVar = \"$__\" + state.localScope.tempVarIndex++\n                        state.localScope.tempVars.push(tempVar)\n                        return tempVar\n                    }\n\n                    function injectTempVarDeclarations(state, index) {\n                        if (state.localScope.tempVars.length) {\n                            state.g.buffer =\n                                state.g.buffer.slice(0, index) +\n                                \"var \" +\n                                state.localScope.tempVars.join(\", \") +\n                                \";\" +\n                                state.g.buffer.slice(index)\n                            state.localScope.tempVars = []\n                        }\n                    }\n\n                    exports.analyzeAndTraverse = analyzeAndTraverse\n                    exports.append = append\n                    exports.catchup = catchup\n                    exports.catchupNewlines = catchupNewlines\n                    exports.catchupWhiteOut = catchupWhiteOut\n                    exports.catchupWhiteSpace = catchupWhiteSpace\n                    exports.containsChildMatching = containsChildMatching\n                    exports.containsChildOfType = containsChildOfType\n                    exports.createState = createState\n                    exports.declareIdentInLocalScope = declareIdentInLocalScope\n                    exports.getBoundaryNode = getBoundaryNode\n                    exports.getDocblock = getDocblock\n                    exports.getLexicalBindingMetadata = getLexicalBindingMetadata\n                    exports.getLocalBindingMetadata = getLocalBindingMetadata\n                    exports.getNextSyntacticCharOffset = getNextSyntacticCharOffset\n                    exports.getNodeSourceText = getNodeSourceText\n                    exports.getOrderedChildren = getOrderedChildren\n                    exports.getTempVar = getTempVar\n                    exports.identInLocalScope = identInLocalScope\n                    exports.identWithinLexicalScope = identWithinLexicalScope\n                    exports.indentBefore = indentBefore\n                    exports.initScopeMetadata = initScopeMetadata\n                    exports.injectTempVar = injectTempVar\n                    exports.injectTempVarDeclarations = injectTempVarDeclarations\n                    exports.move = move\n                    exports.scopeTypes = scopeTypes\n                    exports.updateIndent = updateIndent\n                    exports.updateState = updateState\n                },\n                { \"./docblock\": 21, \"esprima-fb\": 9 }\n            ],\n            24: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013 Facebook, Inc.\n                     *\n                     * Licensed under the Apache License, Version 2.0 (the \"License\");\n                     * you may not use this file except in compliance with the License.\n                     * You may obtain a copy of the License at\n                     *\n                     * http://www.apache.org/licenses/LICENSE-2.0\n                     *\n                     * Unless required by applicable law or agreed to in writing, software\n                     * distributed under the License is distributed on an \"AS IS\" BASIS,\n                     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n                     * See the License for the specific language governing permissions and\n                     * limitations under the License.\n                     */\n\n                    /*global exports:true*/\n\n                    /**\n                     * Desugars ES6 Arrow functions to ES3 function expressions.\n                     * If the function contains `this` expression -- automatically\n                     * binds the function to current value of `this`.\n                     *\n                     * Single parameter, simple expression:\n                     *\n                     * [1, 2, 3].map(x => x * x);\n                     *\n                     * [1, 2, 3].map(function(x) { return x * x; });\n                     *\n                     * Several parameters, complex block:\n                     *\n                     * this.users.forEach((user, idx) => {\n                     *   return this.isActive(idx) && this.send(user);\n                     * });\n                     *\n                     * this.users.forEach(function(user, idx) {\n                     *   return this.isActive(idx) && this.send(user);\n                     * }.bind(this));\n                     *\n                     */\n                    var restParamVisitors = _dereq_(\"./es6-rest-param-visitors\")\n                    var destructuringVisitors = _dereq_(\"./es6-destructuring-visitors\")\n\n                    var Syntax = _dereq_(\"esprima-fb\").Syntax\n                    var utils = _dereq_(\"../src/utils\")\n\n                    /**\n                     * @public\n                     */\n                    function visitArrowFunction(traverse, node, path, state) {\n                        var notInExpression = path[0].type === Syntax.ExpressionStatement\n\n                        // Wrap a function into a grouping operator, if it's not\n                        // in the expression position.\n                        if (notInExpression) {\n                            utils.append(\"(\", state)\n                        }\n\n                        utils.append(\"function\", state)\n                        renderParams(traverse, node, path, state)\n\n                        // Skip arrow.\n                        utils.catchupWhiteSpace(node.body.range[0], state)\n\n                        var renderBody =\n                            node.body.type == Syntax.BlockStatement\n                                ? renderStatementBody\n                                : renderExpressionBody\n\n                        path.unshift(node)\n                        renderBody(traverse, node, path, state)\n                        path.shift()\n\n                        // Bind the function only if `this` value is used\n                        // inside it or inside any sub-expression.\n                        var containsBindingSyntax = utils.containsChildMatching(node.body, function(\n                            node\n                        ) {\n                            return (\n                                node.type === Syntax.ThisExpression ||\n                                (node.type === Syntax.Identifier && node.name === \"super\")\n                            )\n                        })\n\n                        if (containsBindingSyntax) {\n                            utils.append(\".bind(this)\", state)\n                        }\n\n                        utils.catchupWhiteSpace(node.range[1], state)\n\n                        // Close wrapper if not in the expression.\n                        if (notInExpression) {\n                            utils.append(\")\", state)\n                        }\n\n                        return false\n                    }\n\n                    function renderParams(traverse, node, path, state) {\n                        // To preserve inline typechecking directives, we\n                        // distinguish between parens-free and parenthesized single param.\n                        if (isParensFreeSingleParam(node, state) || !node.params.length) {\n                            utils.append(\"(\", state)\n                        }\n                        if (node.params.length !== 0) {\n                            path.unshift(node)\n                            traverse(node.params, path, state)\n                            path.unshift()\n                        }\n                        utils.append(\")\", state)\n                    }\n\n                    function isParensFreeSingleParam(node, state) {\n                        return node.params.length === 1 && state.g.source[state.g.position] !== \"(\"\n                    }\n\n                    function renderExpressionBody(traverse, node, path, state) {\n                        // Wrap simple expression bodies into a block\n                        // with explicit return statement.\n                        utils.append(\"{\", state)\n\n                        // Special handling of rest param.\n                        if (node.rest) {\n                            utils.append(restParamVisitors.renderRestParamSetup(node, state), state)\n                        }\n\n                        // Special handling of destructured params.\n                        destructuringVisitors.renderDestructuredComponents(\n                            node,\n                            utils.updateState(state, {\n                                localScope: {\n                                    parentNode: state.parentNode,\n                                    parentScope: state.parentScope,\n                                    identifiers: state.identifiers,\n                                    tempVarIndex: 0\n                                }\n                            })\n                        )\n\n                        utils.append(\"return \", state)\n                        renderStatementBody(traverse, node, path, state)\n                        utils.append(\";}\", state)\n                    }\n\n                    function renderStatementBody(traverse, node, path, state) {\n                        traverse(node.body, path, state)\n                        utils.catchup(node.body.range[1], state)\n                    }\n\n                    visitArrowFunction.test = function(node, path, state) {\n                        return node.type === Syntax.ArrowFunctionExpression\n                    }\n\n                    exports.visitorList = [visitArrowFunction]\n                },\n                {\n                    \"../src/utils\": 23,\n                    \"./es6-destructuring-visitors\": 27,\n                    \"./es6-rest-param-visitors\": 30,\n                    \"esprima-fb\": 9\n                }\n            ],\n            25: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2004-present Facebook. All Rights Reserved.\n                     */\n                    /*global exports:true*/\n\n                    /**\n                     * Implements ES6 call spread.\n                     *\n                     * instance.method(a, b, c, ...d)\n                     *\n                     * instance.method.apply(instance, [a, b, c].concat(d))\n                     *\n                     */\n\n                    var Syntax = _dereq_(\"esprima-fb\").Syntax\n                    var utils = _dereq_(\"../src/utils\")\n\n                    function process(traverse, node, path, state) {\n                        utils.move(node.range[0], state)\n                        traverse(node, path, state)\n                        utils.catchup(node.range[1], state)\n                    }\n\n                    function visitCallSpread(traverse, node, path, state) {\n                        utils.catchup(node.range[0], state)\n\n                        if (node.type === Syntax.NewExpression) {\n                            // Input  = new Set(1, 2, ...list)\n                            // Output = new (Function.prototype.bind.apply(Set, [null, 1, 2].concat(list)))\n                            utils.append(\"new (Function.prototype.bind.apply(\", state)\n                            process(traverse, node.callee, path, state)\n                        } else if (node.callee.type === Syntax.MemberExpression) {\n                            // Input  = get().fn(1, 2, ...more)\n                            // Output = (_ = get()).fn.apply(_, [1, 2].apply(more))\n                            var tempVar = utils.injectTempVar(state)\n                            utils.append(\"(\" + tempVar + \" = \", state)\n                            process(traverse, node.callee.object, path, state)\n                            utils.append(\")\", state)\n                            if (node.callee.property.type === Syntax.Identifier) {\n                                utils.append(\".\", state)\n                                process(traverse, node.callee.property, path, state)\n                            } else {\n                                utils.append(\"[\", state)\n                                process(traverse, node.callee.property, path, state)\n                                utils.append(\"]\", state)\n                            }\n                            utils.append(\".apply(\" + tempVar, state)\n                        } else {\n                            // Input  = max(1, 2, ...list)\n                            // Output = max.apply(null, [1, 2].concat(list))\n                            var needsToBeWrappedInParenthesis =\n                                node.callee.type === Syntax.FunctionDeclaration ||\n                                node.callee.type === Syntax.FunctionExpression\n                            if (needsToBeWrappedInParenthesis) {\n                                utils.append(\"(\", state)\n                            }\n                            process(traverse, node.callee, path, state)\n                            if (needsToBeWrappedInParenthesis) {\n                                utils.append(\")\", state)\n                            }\n                            utils.append(\".apply(null\", state)\n                        }\n                        utils.append(\", \", state)\n\n                        var args = node.arguments.slice()\n                        var spread = args.pop()\n                        if (args.length || node.type === Syntax.NewExpression) {\n                            utils.append(\"[\", state)\n                            if (node.type === Syntax.NewExpression) {\n                                utils.append(\"null\" + (args.length ? \", \" : \"\"), state)\n                            }\n                            while (args.length) {\n                                var arg = args.shift()\n                                utils.move(arg.range[0], state)\n                                traverse(arg, path, state)\n                                if (args.length) {\n                                    utils.catchup(args[0].range[0], state)\n                                } else {\n                                    utils.catchup(arg.range[1], state)\n                                }\n                            }\n                            utils.append(\"].concat(\", state)\n                            process(traverse, spread.argument, path, state)\n                            utils.append(\")\", state)\n                        } else {\n                            process(traverse, spread.argument, path, state)\n                        }\n                        utils.append(node.type === Syntax.NewExpression ? \"))\" : \")\", state)\n\n                        utils.move(node.range[1], state)\n                        return false\n                    }\n\n                    visitCallSpread.test = function(node, path, state) {\n                        return (\n                            (node.type === Syntax.CallExpression ||\n                                node.type === Syntax.NewExpression) &&\n                            node.arguments.length > 0 &&\n                            node.arguments[node.arguments.length - 1].type === Syntax.SpreadElement\n                        )\n                    }\n\n                    exports.visitorList = [visitCallSpread]\n                },\n                { \"../src/utils\": 23, \"esprima-fb\": 9 }\n            ],\n            26: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013 Facebook, Inc.\n                     *\n                     * Licensed under the Apache License, Version 2.0 (the \"License\");\n                     * you may not use this file except in compliance with the License.\n                     * You may obtain a copy of the License at\n                     *\n                     * http://www.apache.org/licenses/LICENSE-2.0\n                     *\n                     * Unless required by applicable law or agreed to in writing, software\n                     * distributed under the License is distributed on an \"AS IS\" BASIS,\n                     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n                     * See the License for the specific language governing permissions and\n                     * limitations under the License.\n                     */\n\n                    /*jslint node:true*/\n\n                    /**\n                     * @typechecks\n                     */\n                    \"use strict\"\n\n                    var base62 = _dereq_(\"base62\")\n                    var Syntax = _dereq_(\"esprima-fb\").Syntax\n                    var utils = _dereq_(\"../src/utils\")\n                    var reservedWordsHelper = _dereq_(\"./reserved-words-helper\")\n\n                    var declareIdentInLocalScope = utils.declareIdentInLocalScope\n                    var initScopeMetadata = utils.initScopeMetadata\n\n                    var SUPER_PROTO_IDENT_PREFIX = \"____SuperProtoOf\"\n\n                    var _anonClassUUIDCounter = 0\n                    var _mungedSymbolMaps = {}\n\n                    function resetSymbols() {\n                        _anonClassUUIDCounter = 0\n                        _mungedSymbolMaps = {}\n                    }\n\n                    /**\n                     * Used to generate a unique class for use with code-gens for anonymous class\n                     * expressions.\n                     *\n                     * @param {object} state\n                     * @return {string}\n                     */\n                    function _generateAnonymousClassName(state) {\n                        var mungeNamespace = state.mungeNamespace || \"\"\n                        return \"____Class\" + mungeNamespace + base62.encode(_anonClassUUIDCounter++)\n                    }\n\n                    /**\n                     * Given an identifier name, munge it using the current state's mungeNamespace.\n                     *\n                     * @param {string} identName\n                     * @param {object} state\n                     * @return {string}\n                     */\n                    function _getMungedName(identName, state) {\n                        var mungeNamespace = state.mungeNamespace\n                        var shouldMinify = state.g.opts.minify\n\n                        if (shouldMinify) {\n                            if (!_mungedSymbolMaps[mungeNamespace]) {\n                                _mungedSymbolMaps[mungeNamespace] = {\n                                    symbolMap: {},\n                                    identUUIDCounter: 0\n                                }\n                            }\n\n                            var symbolMap = _mungedSymbolMaps[mungeNamespace].symbolMap\n                            if (!symbolMap[identName]) {\n                                symbolMap[identName] = base62.encode(\n                                    _mungedSymbolMaps[mungeNamespace].identUUIDCounter++\n                                )\n                            }\n                            identName = symbolMap[identName]\n                        }\n                        return \"$\" + mungeNamespace + identName\n                    }\n\n                    /**\n                     * Extracts super class information from a class node.\n                     *\n                     * Information includes name of the super class and/or the expression string\n                     * (if extending from an expression)\n                     *\n                     * @param {object} node\n                     * @param {object} state\n                     * @return {object}\n                     */\n                    function _getSuperClassInfo(node, state) {\n                        var ret = {\n                            name: null,\n                            expression: null\n                        }\n                        if (node.superClass) {\n                            if (node.superClass.type === Syntax.Identifier) {\n                                ret.name = node.superClass.name\n                            } else {\n                                // Extension from an expression\n                                ret.name = _generateAnonymousClassName(state)\n                                ret.expression = state.g.source.substring(\n                                    node.superClass.range[0],\n                                    node.superClass.range[1]\n                                )\n                            }\n                        }\n                        return ret\n                    }\n\n                    /**\n                     * Used with .filter() to find the constructor method in a list of\n                     * MethodDefinition nodes.\n                     *\n                     * @param {object} classElement\n                     * @return {boolean}\n                     */\n                    function _isConstructorMethod(classElement) {\n                        return (\n                            classElement.type === Syntax.MethodDefinition &&\n                            classElement.key.type === Syntax.Identifier &&\n                            classElement.key.name === \"constructor\"\n                        )\n                    }\n\n                    /**\n                     * @param {object} node\n                     * @param {object} state\n                     * @return {boolean}\n                     */\n                    function _shouldMungeIdentifier(node, state) {\n                        return (\n                            !!state.methodFuncNode &&\n                            !utils.getDocblock(state).hasOwnProperty(\"preventMunge\") &&\n                            /^_(?!_)/.test(node.name)\n                        )\n                    }\n\n                    /**\n                     * @param {function} traverse\n                     * @param {object} node\n                     * @param {array} path\n                     * @param {object} state\n                     */\n                    function visitClassMethod(traverse, node, path, state) {\n                        if (!state.g.opts.es5 && (node.kind === \"get\" || node.kind === \"set\")) {\n                            throw new Error(\n                                \"This transform does not support \" +\n                                    node.kind +\n                                    \"ter methods for ES6 \" +\n                                    \"classes. (line: \" +\n                                    node.loc.start.line +\n                                    \", col: \" +\n                                    node.loc.start.column +\n                                    \")\"\n                            )\n                        }\n                        state = utils.updateState(state, {\n                            methodNode: node\n                        })\n                        utils.catchup(node.range[0], state)\n                        path.unshift(node)\n                        traverse(node.value, path, state)\n                        path.shift()\n                        return false\n                    }\n                    visitClassMethod.test = function(node, path, state) {\n                        return node.type === Syntax.MethodDefinition\n                    }\n\n                    /**\n                     * @param {function} traverse\n                     * @param {object} node\n                     * @param {array} path\n                     * @param {object} state\n                     */\n                    function visitClassFunctionExpression(traverse, node, path, state) {\n                        var methodNode = path[0]\n                        var isGetter = methodNode.kind === \"get\"\n                        var isSetter = methodNode.kind === \"set\"\n\n                        state = utils.updateState(state, {\n                            methodFuncNode: node\n                        })\n\n                        if (methodNode.key.name === \"constructor\") {\n                            utils.append(\"function \" + state.className, state)\n                        } else {\n                            var methodAccessorComputed = false\n                            var methodAccessor\n                            var prototypeOrStatic = methodNode[\"static\"] ? \"\" : \".prototype\"\n                            var objectAccessor = state.className + prototypeOrStatic\n\n                            if (methodNode.key.type === Syntax.Identifier) {\n                                // foo() {}\n                                methodAccessor = methodNode.key.name\n                                if (_shouldMungeIdentifier(methodNode.key, state)) {\n                                    methodAccessor = _getMungedName(methodAccessor, state)\n                                }\n                                if (isGetter || isSetter) {\n                                    methodAccessor = JSON.stringify(methodAccessor)\n                                } else if (reservedWordsHelper.isReservedWord(methodAccessor)) {\n                                    methodAccessorComputed = true\n                                    methodAccessor = JSON.stringify(methodAccessor)\n                                }\n                            } else if (methodNode.key.type === Syntax.Literal) {\n                                // 'foo bar'() {}  | get 'foo bar'() {} | set 'foo bar'() {}\n                                methodAccessor = JSON.stringify(methodNode.key.value)\n                                methodAccessorComputed = true\n                            }\n\n                            if (isSetter || isGetter) {\n                                utils.append(\n                                    \"Object.defineProperty(\" +\n                                        objectAccessor +\n                                        \",\" +\n                                        methodAccessor +\n                                        \",\" +\n                                        \"{configurable:true,\" +\n                                        methodNode.kind +\n                                        \":function\",\n                                    state\n                                )\n                            } else {\n                                if (state.g.opts.es3) {\n                                    if (methodAccessorComputed) {\n                                        methodAccessor = \"[\" + methodAccessor + \"]\"\n                                    } else {\n                                        methodAccessor = \".\" + methodAccessor\n                                    }\n                                    utils.append(\n                                        objectAccessor +\n                                            methodAccessor +\n                                            \"=function\" +\n                                            (node.generator ? \"*\" : \"\"),\n                                        state\n                                    )\n                                } else {\n                                    if (!methodAccessorComputed) {\n                                        methodAccessor = JSON.stringify(methodAccessor)\n                                    }\n                                    utils.append(\n                                        \"Object.defineProperty(\" +\n                                            objectAccessor +\n                                            \",\" +\n                                            methodAccessor +\n                                            \",\" +\n                                            \"{writable:true,configurable:true,\" +\n                                            \"value:function\" +\n                                            (node.generator ? \"*\" : \"\"),\n                                        state\n                                    )\n                                }\n                            }\n                        }\n                        utils.move(methodNode.key.range[1], state)\n                        utils.append(\"(\", state)\n\n                        var params = node.params\n                        if (params.length > 0) {\n                            utils.catchupNewlines(params[0].range[0], state)\n                            for (var i = 0; i < params.length; i++) {\n                                utils.catchup(node.params[i].range[0], state)\n                                path.unshift(node)\n                                traverse(params[i], path, state)\n                                path.shift()\n                            }\n                        }\n\n                        var closingParenPosition = utils.getNextSyntacticCharOffset(\")\", state)\n                        utils.catchupWhiteSpace(closingParenPosition, state)\n\n                        var openingBracketPosition = utils.getNextSyntacticCharOffset(\"{\", state)\n                        utils.catchup(openingBracketPosition + 1, state)\n\n                        if (!state.scopeIsStrict) {\n                            utils.append('\"use strict\";', state)\n                            state = utils.updateState(state, {\n                                scopeIsStrict: true\n                            })\n                        }\n                        utils.move(node.body.range[0] + \"{\".length, state)\n\n                        path.unshift(node)\n                        traverse(node.body, path, state)\n                        path.shift()\n                        utils.catchup(node.body.range[1], state)\n\n                        if (methodNode.key.name !== \"constructor\") {\n                            if (isGetter || isSetter || !state.g.opts.es3) {\n                                utils.append(\"})\", state)\n                            }\n                            utils.append(\";\", state)\n                        }\n                        return false\n                    }\n                    visitClassFunctionExpression.test = function(node, path, state) {\n                        return (\n                            node.type === Syntax.FunctionExpression &&\n                            path[0].type === Syntax.MethodDefinition\n                        )\n                    }\n\n                    function visitClassMethodParam(traverse, node, path, state) {\n                        var paramName = node.name\n                        if (_shouldMungeIdentifier(node, state)) {\n                            paramName = _getMungedName(node.name, state)\n                        }\n                        utils.append(paramName, state)\n                        utils.move(node.range[1], state)\n                    }\n                    visitClassMethodParam.test = function(node, path, state) {\n                        if (!path[0] || !path[1]) {\n                            return\n                        }\n\n                        var parentFuncExpr = path[0]\n                        var parentClassMethod = path[1]\n\n                        return (\n                            parentFuncExpr.type === Syntax.FunctionExpression &&\n                            parentClassMethod.type === Syntax.MethodDefinition &&\n                            node.type === Syntax.Identifier\n                        )\n                    }\n\n                    /**\n                     * @param {function} traverse\n                     * @param {object} node\n                     * @param {array} path\n                     * @param {object} state\n                     */\n                    function _renderClassBody(traverse, node, path, state) {\n                        var className = state.className\n                        var superClass = state.superClass\n\n                        // Set up prototype of constructor on same line as `extends` for line-number\n                        // preservation. This relies on function-hoisting if a constructor function is\n                        // defined in the class body.\n                        if (superClass.name) {\n                            // If the super class is an expression, we need to memoize the output of the\n                            // expression into the generated class name variable and use that to refer\n                            // to the super class going forward. Example:\n                            //\n                            //   class Foo extends mixin(Bar, Baz) {}\n                            //     --transforms to--\n                            //   function Foo() {} var ____Class0Blah = mixin(Bar, Baz);\n                            if (superClass.expression !== null) {\n                                utils.append(\n                                    \"var \" + superClass.name + \"=\" + superClass.expression + \";\",\n                                    state\n                                )\n                            }\n\n                            var keyName = superClass.name + \"____Key\"\n                            var keyNameDeclarator = \"\"\n                            if (!utils.identWithinLexicalScope(keyName, state)) {\n                                keyNameDeclarator = \"var \"\n                                declareIdentInLocalScope(keyName, initScopeMetadata(node), state)\n                            }\n                            utils.append(\n                                \"for(\" +\n                                    keyNameDeclarator +\n                                    keyName +\n                                    \" in \" +\n                                    superClass.name +\n                                    \"){\" +\n                                    \"if(\" +\n                                    superClass.name +\n                                    \".hasOwnProperty(\" +\n                                    keyName +\n                                    \")){\" +\n                                    className +\n                                    \"[\" +\n                                    keyName +\n                                    \"]=\" +\n                                    superClass.name +\n                                    \"[\" +\n                                    keyName +\n                                    \"];\" +\n                                    \"}\" +\n                                    \"}\",\n                                state\n                            )\n\n                            var superProtoIdentStr = SUPER_PROTO_IDENT_PREFIX + superClass.name\n                            if (!utils.identWithinLexicalScope(superProtoIdentStr, state)) {\n                                utils.append(\n                                    \"var \" +\n                                        superProtoIdentStr +\n                                        \"=\" +\n                                        superClass.name +\n                                        \"===null?\" +\n                                        \"null:\" +\n                                        superClass.name +\n                                        \".prototype;\",\n                                    state\n                                )\n                                declareIdentInLocalScope(\n                                    superProtoIdentStr,\n                                    initScopeMetadata(node),\n                                    state\n                                )\n                            }\n\n                            utils.append(\n                                className + \".prototype=Object.create(\" + superProtoIdentStr + \");\",\n                                state\n                            )\n                            utils.append(\n                                className + \".prototype.constructor=\" + className + \";\",\n                                state\n                            )\n                            utils.append(\n                                className + \".__superConstructor__=\" + superClass.name + \";\",\n                                state\n                            )\n                        }\n\n                        // If there's no constructor method specified in the class body, create an\n                        // empty constructor function at the top (same line as the class keyword)\n                        if (!node.body.body.filter(_isConstructorMethod).pop()) {\n                            utils.append(\"function \" + className + \"(){\", state)\n                            if (!state.scopeIsStrict) {\n                                utils.append('\"use strict\";', state)\n                            }\n                            if (superClass.name) {\n                                utils.append(\n                                    \"if(\" +\n                                        superClass.name +\n                                        \"!==null){\" +\n                                        superClass.name +\n                                        \".apply(this,arguments);}\",\n                                    state\n                                )\n                            }\n                            utils.append(\"}\", state)\n                        }\n\n                        utils.move(node.body.range[0] + \"{\".length, state)\n                        traverse(node.body, path, state)\n                        utils.catchupWhiteSpace(node.range[1], state)\n                    }\n\n                    /**\n                     * @param {function} traverse\n                     * @param {object} node\n                     * @param {array} path\n                     * @param {object} state\n                     */\n                    function visitClassDeclaration(traverse, node, path, state) {\n                        var className = node.id.name\n                        var superClass = _getSuperClassInfo(node, state)\n\n                        state = utils.updateState(state, {\n                            mungeNamespace: className,\n                            className: className,\n                            superClass: superClass\n                        })\n\n                        _renderClassBody(traverse, node, path, state)\n\n                        return false\n                    }\n                    visitClassDeclaration.test = function(node, path, state) {\n                        return node.type === Syntax.ClassDeclaration\n                    }\n\n                    /**\n                     * @param {function} traverse\n                     * @param {object} node\n                     * @param {array} path\n                     * @param {object} state\n                     */\n                    function visitClassExpression(traverse, node, path, state) {\n                        var className =\n                            (node.id && node.id.name) || _generateAnonymousClassName(state)\n                        var superClass = _getSuperClassInfo(node, state)\n\n                        utils.append(\"(function(){\", state)\n\n                        state = utils.updateState(state, {\n                            mungeNamespace: className,\n                            className: className,\n                            superClass: superClass\n                        })\n\n                        _renderClassBody(traverse, node, path, state)\n\n                        utils.append(\"return \" + className + \";})()\", state)\n                        return false\n                    }\n                    visitClassExpression.test = function(node, path, state) {\n                        return node.type === Syntax.ClassExpression\n                    }\n\n                    /**\n                     * @param {function} traverse\n                     * @param {object} node\n                     * @param {array} path\n                     * @param {object} state\n                     */\n                    function visitPrivateIdentifier(traverse, node, path, state) {\n                        utils.append(_getMungedName(node.name, state), state)\n                        utils.move(node.range[1], state)\n                    }\n                    visitPrivateIdentifier.test = function(node, path, state) {\n                        if (\n                            node.type === Syntax.Identifier &&\n                            _shouldMungeIdentifier(node, state)\n                        ) {\n                            // Always munge non-computed properties of MemberExpressions\n                            // (a la preventing access of properties of unowned objects)\n                            if (\n                                path[0].type === Syntax.MemberExpression &&\n                                path[0].object !== node &&\n                                path[0].computed === false\n                            ) {\n                                return true\n                            }\n\n                            // Always munge identifiers that were declared within the method function\n                            // scope\n                            if (\n                                utils.identWithinLexicalScope(\n                                    node.name,\n                                    state,\n                                    state.methodFuncNode\n                                )\n                            ) {\n                                return true\n                            }\n\n                            // Always munge private keys on object literals defined within a method's\n                            // scope.\n                            if (\n                                path[0].type === Syntax.Property &&\n                                path[1].type === Syntax.ObjectExpression\n                            ) {\n                                return true\n                            }\n\n                            // Always munge function parameters\n                            if (\n                                path[0].type === Syntax.FunctionExpression ||\n                                path[0].type === Syntax.FunctionDeclaration ||\n                                path[0].type === Syntax.ArrowFunctionExpression\n                            ) {\n                                for (var i = 0; i < path[0].params.length; i++) {\n                                    if (path[0].params[i] === node) {\n                                        return true\n                                    }\n                                }\n                            }\n                        }\n                        return false\n                    }\n\n                    /**\n                     * @param {function} traverse\n                     * @param {object} node\n                     * @param {array} path\n                     * @param {object} state\n                     */\n                    function visitSuperCallExpression(traverse, node, path, state) {\n                        var superClassName = state.superClass.name\n\n                        if (node.callee.type === Syntax.Identifier) {\n                            if (_isConstructorMethod(state.methodNode)) {\n                                utils.append(superClassName + \".call(\", state)\n                            } else {\n                                var protoProp = SUPER_PROTO_IDENT_PREFIX + superClassName\n                                if (state.methodNode.key.type === Syntax.Identifier) {\n                                    protoProp += \".\" + state.methodNode.key.name\n                                } else if (state.methodNode.key.type === Syntax.Literal) {\n                                    protoProp +=\n                                        \"[\" + JSON.stringify(state.methodNode.key.value) + \"]\"\n                                }\n                                utils.append(protoProp + \".call(\", state)\n                            }\n                            utils.move(node.callee.range[1], state)\n                        } else if (node.callee.type === Syntax.MemberExpression) {\n                            utils.append(SUPER_PROTO_IDENT_PREFIX + superClassName, state)\n                            utils.move(node.callee.object.range[1], state)\n\n                            if (node.callee.computed) {\n                                // [\"a\" + \"b\"]\n                                utils.catchup(node.callee.property.range[1] + \"]\".length, state)\n                            } else {\n                                // .ab\n                                utils.append(\".\" + node.callee.property.name, state)\n                            }\n\n                            utils.append(\".call(\", state)\n                            utils.move(node.callee.range[1], state)\n                        }\n\n                        utils.append(\"this\", state)\n                        if (node.arguments.length > 0) {\n                            utils.append(\",\", state)\n                            utils.catchupWhiteSpace(node.arguments[0].range[0], state)\n                            traverse(node.arguments, path, state)\n                        }\n\n                        utils.catchupWhiteSpace(node.range[1], state)\n                        utils.append(\")\", state)\n                        return false\n                    }\n                    visitSuperCallExpression.test = function(node, path, state) {\n                        if (state.superClass && node.type === Syntax.CallExpression) {\n                            var callee = node.callee\n                            if (\n                                (callee.type === Syntax.Identifier && callee.name === \"super\") ||\n                                (callee.type == Syntax.MemberExpression &&\n                                    callee.object.name === \"super\")\n                            ) {\n                                return true\n                            }\n                        }\n                        return false\n                    }\n\n                    /**\n                     * @param {function} traverse\n                     * @param {object} node\n                     * @param {array} path\n                     * @param {object} state\n                     */\n                    function visitSuperMemberExpression(traverse, node, path, state) {\n                        var superClassName = state.superClass.name\n\n                        utils.append(SUPER_PROTO_IDENT_PREFIX + superClassName, state)\n                        utils.move(node.object.range[1], state)\n                    }\n                    visitSuperMemberExpression.test = function(node, path, state) {\n                        return (\n                            state.superClass &&\n                            node.type === Syntax.MemberExpression &&\n                            node.object.type === Syntax.Identifier &&\n                            node.object.name === \"super\"\n                        )\n                    }\n\n                    exports.resetSymbols = resetSymbols\n\n                    exports.visitorList = [\n                        visitClassDeclaration,\n                        visitClassExpression,\n                        visitClassFunctionExpression,\n                        visitClassMethod,\n                        visitClassMethodParam,\n                        visitPrivateIdentifier,\n                        visitSuperCallExpression,\n                        visitSuperMemberExpression\n                    ]\n                },\n                { \"../src/utils\": 23, \"./reserved-words-helper\": 34, base62: 10, \"esprima-fb\": 9 }\n            ],\n            27: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2014 Facebook, Inc.\n                     *\n                     * Licensed under the Apache License, Version 2.0 (the \"License\");\n                     * you may not use this file except in compliance with the License.\n                     * You may obtain a copy of the License at\n                     *\n                     * http://www.apache.org/licenses/LICENSE-2.0\n                     *\n                     * Unless required by applicable law or agreed to in writing, software\n                     * distributed under the License is distributed on an \"AS IS\" BASIS,\n                     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n                     * See the License for the specific language governing permissions and\n                     * limitations under the License.\n                     */\n                    /*global exports:true*/\n\n                    /**\n                     * Implements ES6 destructuring assignment and pattern matching.\n                     *\n                     * function init({port, ip, coords: [x, y]}) {\n                     *   return (x && y) ? {id, port} : {ip};\n                     * };\n                     *\n                     * function init($__0) {\n                     *   var\n                     *    port = $__0.port,\n                     *    ip = $__0.ip,\n                     *    $__1 = $__0.coords,\n                     *    x = $__1[0],\n                     *    y = $__1[1];\n                     *   return (x && y) ? {id, port} : {ip};\n                     * }\n                     *\n                     * var x, {ip, port} = init({ip, port});\n                     *\n                     * var x, $__0 = init({ip, port}), ip = $__0.ip, port = $__0.port;\n                     *\n                     */\n                    var Syntax = _dereq_(\"esprima-fb\").Syntax\n                    var utils = _dereq_(\"../src/utils\")\n\n                    var reservedWordsHelper = _dereq_(\"./reserved-words-helper\")\n                    var restParamVisitors = _dereq_(\"./es6-rest-param-visitors\")\n                    var restPropertyHelpers = _dereq_(\"./es7-rest-property-helpers\")\n\n                    // -------------------------------------------------------\n                    // 1. Structured variable declarations.\n                    //\n                    // var [a, b] = [b, a];\n                    // var {x, y} = {y, x};\n                    // -------------------------------------------------------\n\n                    function visitStructuredVariable(traverse, node, path, state) {\n                        // Allocate new temp for the pattern.\n                        utils.append(utils.getTempVar(state.localScope.tempVarIndex) + \"=\", state)\n                        // Skip the pattern and assign the init to the temp.\n                        utils.catchupWhiteSpace(node.init.range[0], state)\n                        traverse(node.init, path, state)\n                        utils.catchup(node.init.range[1], state)\n                        // Render the destructured data.\n                        utils.append(\",\" + getDestructuredComponents(node.id, state), state)\n                        state.localScope.tempVarIndex++\n                        return false\n                    }\n\n                    visitStructuredVariable.test = function(node, path, state) {\n                        return (\n                            node.type === Syntax.VariableDeclarator && isStructuredPattern(node.id)\n                        )\n                    }\n\n                    function isStructuredPattern(node) {\n                        return (\n                            node.type === Syntax.ObjectPattern || node.type === Syntax.ArrayPattern\n                        )\n                    }\n\n                    // Main function which does actual recursive destructuring\n                    // of nested complex structures.\n                    function getDestructuredComponents(node, state) {\n                        var tmpIndex = state.localScope.tempVarIndex\n                        var components = []\n                        var patternItems = getPatternItems(node)\n\n                        for (var idx = 0; idx < patternItems.length; idx++) {\n                            var item = patternItems[idx]\n                            if (!item) {\n                                continue\n                            }\n\n                            if (item.type === Syntax.SpreadElement) {\n                                // Spread/rest of an array.\n                                // TODO(dmitrys): support spread in the middle of a pattern\n                                // and also for function param patterns: [x, ...xs, y]\n                                components.push(\n                                    item.argument.name +\n                                        \"=Array.prototype.slice.call(\" +\n                                        utils.getTempVar(tmpIndex) +\n                                        \",\" +\n                                        idx +\n                                        \")\"\n                                )\n                                continue\n                            }\n\n                            if (item.type === Syntax.SpreadProperty) {\n                                var restExpression = restPropertyHelpers.renderRestExpression(\n                                    utils.getTempVar(tmpIndex),\n                                    patternItems\n                                )\n                                components.push(item.argument.name + \"=\" + restExpression)\n                                continue\n                            }\n\n                            // Depending on pattern type (Array or Object), we get\n                            // corresponding pattern item parts.\n                            var accessor = getPatternItemAccessor(node, item, tmpIndex, idx)\n                            var value = getPatternItemValue(node, item)\n\n                            // TODO(dmitrys): implement default values: {x, y=5}\n                            if (value.type === Syntax.Identifier) {\n                                // Simple pattern item.\n                                components.push(value.name + \"=\" + accessor)\n                            } else {\n                                // Complex sub-structure.\n                                components.push(\n                                    utils.getTempVar(++state.localScope.tempVarIndex) +\n                                        \"=\" +\n                                        accessor +\n                                        \",\" +\n                                        getDestructuredComponents(value, state)\n                                )\n                            }\n                        }\n\n                        return components.join(\",\")\n                    }\n\n                    function getPatternItems(node) {\n                        return node.properties || node.elements\n                    }\n\n                    function getPatternItemAccessor(node, patternItem, tmpIndex, idx) {\n                        var tmpName = utils.getTempVar(tmpIndex)\n                        if (node.type === Syntax.ObjectPattern) {\n                            if (reservedWordsHelper.isReservedWord(patternItem.key.name)) {\n                                return tmpName + '[\"' + patternItem.key.name + '\"]'\n                            } else if (patternItem.key.type === Syntax.Literal) {\n                                return tmpName + \"[\" + JSON.stringify(patternItem.key.value) + \"]\"\n                            } else if (patternItem.key.type === Syntax.Identifier) {\n                                return tmpName + \".\" + patternItem.key.name\n                            }\n                        } else if (node.type === Syntax.ArrayPattern) {\n                            return tmpName + \"[\" + idx + \"]\"\n                        }\n                    }\n\n                    function getPatternItemValue(node, patternItem) {\n                        return node.type === Syntax.ObjectPattern ? patternItem.value : patternItem\n                    }\n\n                    // -------------------------------------------------------\n                    // 2. Assignment expression.\n                    //\n                    // [a, b] = [b, a];\n                    // ({x, y} = {y, x});\n                    // -------------------------------------------------------\n\n                    function visitStructuredAssignment(traverse, node, path, state) {\n                        var exprNode = node.expression\n                        utils.append(\n                            \"var \" + utils.getTempVar(state.localScope.tempVarIndex) + \"=\",\n                            state\n                        )\n\n                        utils.catchupWhiteSpace(exprNode.right.range[0], state)\n                        traverse(exprNode.right, path, state)\n                        utils.catchup(exprNode.right.range[1], state)\n\n                        utils.append(\n                            \";\" + getDestructuredComponents(exprNode.left, state) + \";\",\n                            state\n                        )\n\n                        utils.catchupWhiteSpace(node.range[1], state)\n                        state.localScope.tempVarIndex++\n                        return false\n                    }\n\n                    visitStructuredAssignment.test = function(node, path, state) {\n                        // We consider the expression statement rather than just assignment\n                        // expression to cover case with object patters which should be\n                        // wrapped in grouping operator: ({x, y} = {y, x});\n                        return (\n                            node.type === Syntax.ExpressionStatement &&\n                            node.expression.type === Syntax.AssignmentExpression &&\n                            isStructuredPattern(node.expression.left)\n                        )\n                    }\n\n                    // -------------------------------------------------------\n                    // 3. Structured parameter.\n                    //\n                    // function foo({x, y}) { ... }\n                    // -------------------------------------------------------\n\n                    function visitStructuredParameter(traverse, node, path, state) {\n                        utils.append(utils.getTempVar(getParamIndex(node, path)), state)\n                        utils.catchupWhiteSpace(node.range[1], state)\n                        return true\n                    }\n\n                    function getParamIndex(paramNode, path) {\n                        var funcNode = path[0]\n                        var tmpIndex = 0\n                        for (var k = 0; k < funcNode.params.length; k++) {\n                            var param = funcNode.params[k]\n                            if (param === paramNode) {\n                                break\n                            }\n                            if (isStructuredPattern(param)) {\n                                tmpIndex++\n                            }\n                        }\n                        return tmpIndex\n                    }\n\n                    visitStructuredParameter.test = function(node, path, state) {\n                        return isStructuredPattern(node) && isFunctionNode(path[0])\n                    }\n\n                    function isFunctionNode(node) {\n                        return (\n                            node.type == Syntax.FunctionDeclaration ||\n                            node.type == Syntax.FunctionExpression ||\n                            node.type == Syntax.MethodDefinition ||\n                            node.type == Syntax.ArrowFunctionExpression\n                        )\n                    }\n\n                    // -------------------------------------------------------\n                    // 4. Function body for structured parameters.\n                    //\n                    // function foo({x, y}) { x; y; }\n                    // -------------------------------------------------------\n\n                    function visitFunctionBodyForStructuredParameter(traverse, node, path, state) {\n                        var funcNode = path[0]\n\n                        utils.catchup(funcNode.body.range[0] + 1, state)\n                        renderDestructuredComponents(funcNode, state)\n\n                        if (funcNode.rest) {\n                            utils.append(\n                                restParamVisitors.renderRestParamSetup(funcNode, state),\n                                state\n                            )\n                        }\n\n                        return true\n                    }\n\n                    function renderDestructuredComponents(funcNode, state) {\n                        var destructuredComponents = []\n\n                        for (var k = 0; k < funcNode.params.length; k++) {\n                            var param = funcNode.params[k]\n                            if (isStructuredPattern(param)) {\n                                destructuredComponents.push(getDestructuredComponents(param, state))\n                                state.localScope.tempVarIndex++\n                            }\n                        }\n\n                        if (destructuredComponents.length) {\n                            utils.append(\"var \" + destructuredComponents.join(\",\") + \";\", state)\n                        }\n                    }\n\n                    visitFunctionBodyForStructuredParameter.test = function(node, path, state) {\n                        return node.type === Syntax.BlockStatement && isFunctionNode(path[0])\n                    }\n\n                    exports.visitorList = [\n                        visitStructuredVariable,\n                        visitStructuredAssignment,\n                        visitStructuredParameter,\n                        visitFunctionBodyForStructuredParameter\n                    ]\n\n                    exports.renderDestructuredComponents = renderDestructuredComponents\n                },\n                {\n                    \"../src/utils\": 23,\n                    \"./es6-rest-param-visitors\": 30,\n                    \"./es7-rest-property-helpers\": 32,\n                    \"./reserved-words-helper\": 34,\n                    \"esprima-fb\": 9\n                }\n            ],\n            28: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013 Facebook, Inc.\n                     *\n                     * Licensed under the Apache License, Version 2.0 (the \"License\");\n                     * you may not use this file except in compliance with the License.\n                     * You may obtain a copy of the License at\n                     *\n                     * http://www.apache.org/licenses/LICENSE-2.0\n                     *\n                     * Unless required by applicable law or agreed to in writing, software\n                     * distributed under the License is distributed on an \"AS IS\" BASIS,\n                     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n                     * See the License for the specific language governing permissions and\n                     * limitations under the License.\n                     */\n\n                    /*jslint node:true*/\n\n                    /**\n                     * Desugars concise methods of objects to function expressions.\n                     *\n                     * var foo = {\n                     *   method(x, y) { ... }\n                     * };\n                     *\n                     * var foo = {\n                     *   method: function(x, y) { ... }\n                     * };\n                     *\n                     */\n\n                    var Syntax = _dereq_(\"esprima-fb\").Syntax\n                    var utils = _dereq_(\"../src/utils\")\n                    var reservedWordsHelper = _dereq_(\"./reserved-words-helper\")\n\n                    function visitObjectConciseMethod(traverse, node, path, state) {\n                        var isGenerator = node.value.generator\n                        if (isGenerator) {\n                            utils.catchupWhiteSpace(node.range[0] + 1, state)\n                        }\n                        if (node.computed) {\n                            // [<expr>]() { ...}\n                            utils.catchup(node.key.range[1] + 1, state)\n                        } else if (reservedWordsHelper.isReservedWord(node.key.name)) {\n                            utils.catchup(node.key.range[0], state)\n                            utils.append('\"', state)\n                            utils.catchup(node.key.range[1], state)\n                            utils.append('\"', state)\n                        }\n\n                        utils.catchup(node.key.range[1], state)\n                        utils.append(\":function\" + (isGenerator ? \"*\" : \"\"), state)\n                        path.unshift(node)\n                        traverse(node.value, path, state)\n                        path.shift()\n                        return false\n                    }\n\n                    visitObjectConciseMethod.test = function(node, path, state) {\n                        return (\n                            node.type === Syntax.Property &&\n                            node.value.type === Syntax.FunctionExpression &&\n                            node.method === true\n                        )\n                    }\n\n                    exports.visitorList = [visitObjectConciseMethod]\n                },\n                { \"../src/utils\": 23, \"./reserved-words-helper\": 34, \"esprima-fb\": 9 }\n            ],\n            29: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013 Facebook, Inc.\n                     *\n                     * Licensed under the Apache License, Version 2.0 (the \"License\");\n                     * you may not use this file except in compliance with the License.\n                     * You may obtain a copy of the License at\n                     *\n                     * http://www.apache.org/licenses/LICENSE-2.0\n                     *\n                     * Unless required by applicable law or agreed to in writing, software\n                     * distributed under the License is distributed on an \"AS IS\" BASIS,\n                     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n                     * See the License for the specific language governing permissions and\n                     * limitations under the License.\n                     */\n\n                    /*jslint node: true*/\n\n                    /**\n                     * Desugars ES6 Object Literal short notations into ES3 full notation.\n                     *\n                     * // Easier return values.\n                     * function foo(x, y) {\n                     *   return {x, y}; // {x: x, y: y}\n                     * };\n                     *\n                     * // Destructuring.\n                     * function init({port, ip, coords: {x, y}}) { ... }\n                     *\n                     */\n                    var Syntax = _dereq_(\"esprima-fb\").Syntax\n                    var utils = _dereq_(\"../src/utils\")\n\n                    /**\n                     * @public\n                     */\n                    function visitObjectLiteralShortNotation(traverse, node, path, state) {\n                        utils.catchup(node.key.range[1], state)\n                        utils.append(\":\" + node.key.name, state)\n                        return false\n                    }\n\n                    visitObjectLiteralShortNotation.test = function(node, path, state) {\n                        return (\n                            node.type === Syntax.Property &&\n                            node.kind === \"init\" &&\n                            node.shorthand === true &&\n                            path[0].type !== Syntax.ObjectPattern\n                        )\n                    }\n\n                    exports.visitorList = [visitObjectLiteralShortNotation]\n                },\n                { \"../src/utils\": 23, \"esprima-fb\": 9 }\n            ],\n            30: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013 Facebook, Inc.\n                     *\n                     * Licensed under the Apache License, Version 2.0 (the \"License\");\n                     * you may not use this file except in compliance with the License.\n                     * You may obtain a copy of the License at\n                     *\n                     * http://www.apache.org/licenses/LICENSE-2.0\n                     *\n                     * Unless required by applicable law or agreed to in writing, software\n                     * distributed under the License is distributed on an \"AS IS\" BASIS,\n                     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n                     * See the License for the specific language governing permissions and\n                     * limitations under the License.\n                     */\n\n                    /*jslint node:true*/\n\n                    /**\n                     * Desugars ES6 rest parameters into an ES3 arguments array.\n                     *\n                     * function printf(template, ...args) {\n                     *   args.forEach(...);\n                     * }\n                     *\n                     * We could use `Array.prototype.slice.call`, but that usage of arguments causes\n                     * functions to be deoptimized in V8, so instead we use a for-loop.\n                     *\n                     * function printf(template) {\n                     *   for (var args = [], $__0 = 1, $__1 = arguments.length; $__0 < $__1; $__0++)\n                     *     args.push(arguments[$__0]);\n                     *   args.forEach(...);\n                     * }\n                     *\n                     */\n                    var Syntax = _dereq_(\"esprima-fb\").Syntax\n                    var utils = _dereq_(\"../src/utils\")\n\n                    function _nodeIsFunctionWithRestParam(node) {\n                        return (\n                            (node.type === Syntax.FunctionDeclaration ||\n                                node.type === Syntax.FunctionExpression ||\n                                node.type === Syntax.ArrowFunctionExpression) &&\n                            node.rest\n                        )\n                    }\n\n                    function visitFunctionParamsWithRestParam(traverse, node, path, state) {\n                        if (node.parametricType) {\n                            utils.catchup(node.parametricType.range[0], state)\n                            path.unshift(node)\n                            traverse(node.parametricType, path, state)\n                            path.shift()\n                        }\n\n                        // Render params.\n                        if (node.params.length) {\n                            path.unshift(node)\n                            traverse(node.params, path, state)\n                            path.shift()\n                        } else {\n                            // -3 is for ... of the rest.\n                            utils.catchup(node.rest.range[0] - 3, state)\n                        }\n                        utils.catchupWhiteSpace(node.rest.range[1], state)\n\n                        path.unshift(node)\n                        traverse(node.body, path, state)\n                        path.shift()\n\n                        return false\n                    }\n\n                    visitFunctionParamsWithRestParam.test = function(node, path, state) {\n                        return _nodeIsFunctionWithRestParam(node)\n                    }\n\n                    function renderRestParamSetup(functionNode, state) {\n                        var idx = state.localScope.tempVarIndex++\n                        var len = state.localScope.tempVarIndex++\n\n                        return (\n                            \"for (var \" +\n                            functionNode.rest.name +\n                            \"=[],\" +\n                            utils.getTempVar(idx) +\n                            \"=\" +\n                            functionNode.params.length +\n                            \",\" +\n                            utils.getTempVar(len) +\n                            \"=arguments.length;\" +\n                            utils.getTempVar(idx) +\n                            \"<\" +\n                            utils.getTempVar(len) +\n                            \";\" +\n                            utils.getTempVar(idx) +\n                            \"++) \" +\n                            functionNode.rest.name +\n                            \".push(arguments[\" +\n                            utils.getTempVar(idx) +\n                            \"]);\"\n                        )\n                    }\n\n                    function visitFunctionBodyWithRestParam(traverse, node, path, state) {\n                        utils.catchup(node.range[0] + 1, state)\n                        var parentNode = path[0]\n                        utils.append(renderRestParamSetup(parentNode, state), state)\n                        return true\n                    }\n\n                    visitFunctionBodyWithRestParam.test = function(node, path, state) {\n                        return (\n                            node.type === Syntax.BlockStatement &&\n                            _nodeIsFunctionWithRestParam(path[0])\n                        )\n                    }\n\n                    exports.renderRestParamSetup = renderRestParamSetup\n                    exports.visitorList = [\n                        visitFunctionParamsWithRestParam,\n                        visitFunctionBodyWithRestParam\n                    ]\n                },\n                { \"../src/utils\": 23, \"esprima-fb\": 9 }\n            ],\n            31: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013 Facebook, Inc.\n                     *\n                     * Licensed under the Apache License, Version 2.0 (the \"License\");\n                     * you may not use this file except in compliance with the License.\n                     * You may obtain a copy of the License at\n                     *\n                     * http://www.apache.org/licenses/LICENSE-2.0\n                     *\n                     * Unless required by applicable law or agreed to in writing, software\n                     * distributed under the License is distributed on an \"AS IS\" BASIS,\n                     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n                     * See the License for the specific language governing permissions and\n                     * limitations under the License.\n                     */\n\n                    /*jslint node:true*/\n\n                    /**\n                     * @typechecks\n                     */\n                    \"use strict\"\n\n                    var Syntax = _dereq_(\"esprima-fb\").Syntax\n                    var utils = _dereq_(\"../src/utils\")\n\n                    /**\n                     * http://people.mozilla.org/~jorendorff/es6-draft.html#sec-12.1.9\n                     */\n                    function visitTemplateLiteral(traverse, node, path, state) {\n                        var templateElements = node.quasis\n\n                        utils.append(\"(\", state)\n                        for (var ii = 0; ii < templateElements.length; ii++) {\n                            var templateElement = templateElements[ii]\n                            if (templateElement.value.raw !== \"\") {\n                                utils.append(getCookedValue(templateElement), state)\n                                if (!templateElement.tail) {\n                                    // + between element and substitution\n                                    utils.append(\" + \", state)\n                                }\n                                // maintain line numbers\n                                utils.move(templateElement.range[0], state)\n                                utils.catchupNewlines(templateElement.range[1], state)\n                            } else {\n                                // templateElement.value.raw === ''\n                                // Concatenat adjacent substitutions, e.g. `${x}${y}`. Empty templates\n                                // appear before the first and after the last element - nothing to add in\n                                // those cases.\n                                if (ii > 0 && !templateElement.tail) {\n                                    // + between substitution and substitution\n                                    utils.append(\" + \", state)\n                                }\n                            }\n\n                            utils.move(templateElement.range[1], state)\n                            if (!templateElement.tail) {\n                                var substitution = node.expressions[ii]\n                                if (\n                                    substitution.type === Syntax.Identifier ||\n                                    substitution.type === Syntax.MemberExpression ||\n                                    substitution.type === Syntax.CallExpression\n                                ) {\n                                    utils.catchup(substitution.range[1], state)\n                                } else {\n                                    utils.append(\"(\", state)\n                                    traverse(substitution, path, state)\n                                    utils.catchup(substitution.range[1], state)\n                                    utils.append(\")\", state)\n                                }\n                                // if next templateElement isn't empty...\n                                if (templateElements[ii + 1].value.cooked !== \"\") {\n                                    utils.append(\" + \", state)\n                                }\n                            }\n                        }\n                        utils.move(node.range[1], state)\n                        utils.append(\")\", state)\n                        return false\n                    }\n\n                    visitTemplateLiteral.test = function(node, path, state) {\n                        return node.type === Syntax.TemplateLiteral\n                    }\n\n                    /**\n                     * http://people.mozilla.org/~jorendorff/es6-draft.html#sec-12.2.6\n                     */\n                    function visitTaggedTemplateExpression(traverse, node, path, state) {\n                        var template = node.quasi\n                        var numQuasis = template.quasis.length\n\n                        // print the tag\n                        utils.move(node.tag.range[0], state)\n                        traverse(node.tag, path, state)\n                        utils.catchup(node.tag.range[1], state)\n\n                        // print array of template elements\n                        utils.append(\"(function() { var siteObj = [\", state)\n                        for (var ii = 0; ii < numQuasis; ii++) {\n                            utils.append(getCookedValue(template.quasis[ii]), state)\n                            if (ii !== numQuasis - 1) {\n                                utils.append(\", \", state)\n                            }\n                        }\n                        utils.append(\"]; siteObj.raw = [\", state)\n                        for (ii = 0; ii < numQuasis; ii++) {\n                            utils.append(getRawValue(template.quasis[ii]), state)\n                            if (ii !== numQuasis - 1) {\n                                utils.append(\", \", state)\n                            }\n                        }\n                        utils.append(\n                            \"]; Object.freeze(siteObj.raw); Object.freeze(siteObj); return siteObj; }()\",\n                            state\n                        )\n\n                        // print substitutions\n                        if (numQuasis > 1) {\n                            for (ii = 0; ii < template.expressions.length; ii++) {\n                                var expression = template.expressions[ii]\n                                utils.append(\", \", state)\n\n                                // maintain line numbers by calling catchupWhiteSpace over the whole\n                                // previous TemplateElement\n                                utils.move(template.quasis[ii].range[0], state)\n                                utils.catchupNewlines(template.quasis[ii].range[1], state)\n\n                                utils.move(expression.range[0], state)\n                                traverse(expression, path, state)\n                                utils.catchup(expression.range[1], state)\n                            }\n                        }\n\n                        // print blank lines to push the closing ) down to account for the final\n                        // TemplateElement.\n                        utils.catchupNewlines(node.range[1], state)\n\n                        utils.append(\")\", state)\n\n                        return false\n                    }\n\n                    visitTaggedTemplateExpression.test = function(node, path, state) {\n                        return node.type === Syntax.TaggedTemplateExpression\n                    }\n\n                    function getCookedValue(templateElement) {\n                        return JSON.stringify(templateElement.value.cooked)\n                    }\n\n                    function getRawValue(templateElement) {\n                        return JSON.stringify(templateElement.value.raw)\n                    }\n\n                    exports.visitorList = [visitTemplateLiteral, visitTaggedTemplateExpression]\n                },\n                { \"../src/utils\": 23, \"esprima-fb\": 9 }\n            ],\n            32: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013 Facebook, Inc.\n                     *\n                     * Licensed under the Apache License, Version 2.0 (the \"License\");\n                     * you may not use this file except in compliance with the License.\n                     * You may obtain a copy of the License at\n                     *\n                     * http://www.apache.org/licenses/LICENSE-2.0\n                     *\n                     * Unless required by applicable law or agreed to in writing, software\n                     * distributed under the License is distributed on an \"AS IS\" BASIS,\n                     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n                     * See the License for the specific language governing permissions and\n                     * limitations under the License.\n                     */\n\n                    /*jslint node:true*/\n\n                    /**\n                     * Desugars ES7 rest properties into ES5 object iteration.\n                     */\n\n                    var Syntax = _dereq_(\"esprima-fb\").Syntax\n\n                    // TODO: This is a pretty massive helper, it should only be defined once, in the\n                    // transform's runtime environment. We don't currently have a runtime though.\n                    var restFunction =\n                        \"(function(source, exclusion) {\" +\n                        \"var rest = {};\" +\n                        \"var hasOwn = Object.prototype.hasOwnProperty;\" +\n                        \"if (source == null) {\" +\n                        \"throw new TypeError();\" +\n                        \"}\" +\n                        \"for (var key in source) {\" +\n                        \"if (hasOwn.call(source, key) && !hasOwn.call(exclusion, key)) {\" +\n                        \"rest[key] = source[key];\" +\n                        \"}\" +\n                        \"}\" +\n                        \"return rest;\" +\n                        \"})\"\n\n                    function getPropertyNames(properties) {\n                        var names = []\n                        for (var i = 0; i < properties.length; i++) {\n                            var property = properties[i]\n                            if (property.type === Syntax.SpreadProperty) {\n                                continue\n                            }\n                            if (property.type === Syntax.Identifier) {\n                                names.push(property.name)\n                            } else {\n                                names.push(property.key.name)\n                            }\n                        }\n                        return names\n                    }\n\n                    function getRestFunctionCall(source, exclusion) {\n                        return restFunction + \"(\" + source + \",\" + exclusion + \")\"\n                    }\n\n                    function getSimpleShallowCopy(accessorExpression) {\n                        // This could be faster with 'Object.assign({}, ' + accessorExpression + ')'\n                        // but to unify code paths and avoid a ES6 dependency we use the same\n                        // helper as for the exclusion case.\n                        return getRestFunctionCall(accessorExpression, \"{}\")\n                    }\n\n                    function renderRestExpression(accessorExpression, excludedProperties) {\n                        var excludedNames = getPropertyNames(excludedProperties)\n                        if (!excludedNames.length) {\n                            return getSimpleShallowCopy(accessorExpression)\n                        }\n                        return getRestFunctionCall(\n                            accessorExpression,\n                            \"{\" + excludedNames.join(\":1,\") + \":1}\"\n                        )\n                    }\n\n                    exports.renderRestExpression = renderRestExpression\n                },\n                { \"esprima-fb\": 9 }\n            ],\n            33: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2004-present Facebook. All Rights Reserved.\n                     */\n                    /*global exports:true*/\n\n                    /**\n                     * Implements ES7 object spread property.\n                     * https://gist.github.com/sebmarkbage/aa849c7973cb4452c547\n                     *\n                     * { ...a, x: 1 }\n                     *\n                     * Object.assign({}, a, {x: 1 })\n                     *\n                     */\n\n                    var Syntax = _dereq_(\"esprima-fb\").Syntax\n                    var utils = _dereq_(\"../src/utils\")\n\n                    function visitObjectLiteralSpread(traverse, node, path, state) {\n                        utils.catchup(node.range[0], state)\n\n                        utils.append(\"Object.assign({\", state)\n\n                        // Skip the original {\n                        utils.move(node.range[0] + 1, state)\n\n                        var previousWasSpread = false\n\n                        for (var i = 0; i < node.properties.length; i++) {\n                            var property = node.properties[i]\n                            if (property.type === Syntax.SpreadProperty) {\n                                // Close the previous object or initial object\n                                if (!previousWasSpread) {\n                                    utils.append(\"}\", state)\n                                }\n\n                                if (i === 0) {\n                                    // Normally there will be a comma when we catch up, but not before\n                                    // the first property.\n                                    utils.append(\",\", state)\n                                }\n\n                                utils.catchup(property.range[0], state)\n\n                                // skip ...\n                                utils.move(property.range[0] + 3, state)\n\n                                traverse(property.argument, path, state)\n\n                                utils.catchup(property.range[1], state)\n\n                                previousWasSpread = true\n                            } else {\n                                utils.catchup(property.range[0], state)\n\n                                if (previousWasSpread) {\n                                    utils.append(\"{\", state)\n                                }\n\n                                traverse(property, path, state)\n\n                                utils.catchup(property.range[1], state)\n\n                                previousWasSpread = false\n                            }\n                        }\n\n                        // Strip any non-whitespace between the last item and the end.\n                        // We only catch up on whitespace so that we ignore any trailing commas which\n                        // are stripped out for IE8 support. Unfortunately, this also strips out any\n                        // trailing comments.\n                        utils.catchupWhiteSpace(node.range[1] - 1, state)\n\n                        // Skip the trailing }\n                        utils.move(node.range[1], state)\n\n                        if (!previousWasSpread) {\n                            utils.append(\"}\", state)\n                        }\n\n                        utils.append(\")\", state)\n                        return false\n                    }\n\n                    visitObjectLiteralSpread.test = function(node, path, state) {\n                        if (node.type !== Syntax.ObjectExpression) {\n                            return false\n                        }\n                        // Tight loop optimization\n                        var hasAtLeastOneSpreadProperty = false\n                        for (var i = 0; i < node.properties.length; i++) {\n                            var property = node.properties[i]\n                            if (property.type === Syntax.SpreadProperty) {\n                                hasAtLeastOneSpreadProperty = true\n                            } else if (property.kind !== \"init\") {\n                                return false\n                            }\n                        }\n                        return hasAtLeastOneSpreadProperty\n                    }\n\n                    exports.visitorList = [visitObjectLiteralSpread]\n                },\n                { \"../src/utils\": 23, \"esprima-fb\": 9 }\n            ],\n            34: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2014 Facebook, Inc.\n                     *\n                     * Licensed under the Apache License, Version 2.0 (the \"License\");\n                     * you may not use this file except in compliance with the License.\n                     * You may obtain a copy of the License at\n                     *\n                     * http://www.apache.org/licenses/LICENSE-2.0\n                     *\n                     * Unless required by applicable law or agreed to in writing, software\n                     * distributed under the License is distributed on an \"AS IS\" BASIS,\n                     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n                     * See the License for the specific language governing permissions and\n                     * limitations under the License.\n                     */\n\n                    var KEYWORDS = [\n                        \"break\",\n                        \"do\",\n                        \"in\",\n                        \"typeof\",\n                        \"case\",\n                        \"else\",\n                        \"instanceof\",\n                        \"var\",\n                        \"catch\",\n                        \"export\",\n                        \"new\",\n                        \"void\",\n                        \"class\",\n                        \"extends\",\n                        \"return\",\n                        \"while\",\n                        \"const\",\n                        \"finally\",\n                        \"super\",\n                        \"with\",\n                        \"continue\",\n                        \"for\",\n                        \"switch\",\n                        \"yield\",\n                        \"debugger\",\n                        \"function\",\n                        \"this\",\n                        \"default\",\n                        \"if\",\n                        \"throw\",\n                        \"delete\",\n                        \"import\",\n                        \"try\"\n                    ]\n\n                    var FUTURE_RESERVED_WORDS = [\n                        \"enum\",\n                        \"await\",\n                        \"implements\",\n                        \"package\",\n                        \"protected\",\n                        \"static\",\n                        \"interface\",\n                        \"private\",\n                        \"public\"\n                    ]\n\n                    var LITERALS = [\"null\", \"true\", \"false\"]\n\n                    // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reserved-words\n                    var RESERVED_WORDS = [].concat(KEYWORDS, FUTURE_RESERVED_WORDS, LITERALS)\n\n                    var reservedWordsMap = Object.create(null)\n                    RESERVED_WORDS.forEach(function(k) {\n                        reservedWordsMap[k] = true\n                    })\n\n                    /**\n                     * This list should not grow as new reserved words are introduced. This list is\n                     * of words that need to be quoted because ES3-ish browsers do not allow their\n                     * use as identifier names.\n                     */\n                    var ES3_FUTURE_RESERVED_WORDS = [\n                        \"enum\",\n                        \"implements\",\n                        \"package\",\n                        \"protected\",\n                        \"static\",\n                        \"interface\",\n                        \"private\",\n                        \"public\"\n                    ]\n\n                    var ES3_RESERVED_WORDS = [].concat(\n                        KEYWORDS,\n                        ES3_FUTURE_RESERVED_WORDS,\n                        LITERALS\n                    )\n\n                    var es3ReservedWordsMap = Object.create(null)\n                    ES3_RESERVED_WORDS.forEach(function(k) {\n                        es3ReservedWordsMap[k] = true\n                    })\n\n                    exports.isReservedWord = function(word) {\n                        return !!reservedWordsMap[word]\n                    }\n\n                    exports.isES3ReservedWord = function(word) {\n                        return !!es3ReservedWordsMap[word]\n                    }\n                },\n                {}\n            ],\n            35: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2014 Facebook, Inc.\n                     *\n                     * Licensed under the Apache License, Version 2.0 (the \"License\");\n                     * you may not use this file except in compliance with the License.\n                     * You may obtain a copy of the License at\n                     *\n                     * http://www.apache.org/licenses/LICENSE-2.0\n                     *\n                     * Unless required by applicable law or agreed to in writing, software\n                     * distributed under the License is distributed on an \"AS IS\" BASIS,\n                     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n                     * See the License for the specific language governing permissions and\n                     * limitations under the License.\n                     *\n                     */\n                    /*global exports:true*/\n\n                    var Syntax = _dereq_(\"esprima-fb\").Syntax\n                    var utils = _dereq_(\"../src/utils\")\n                    var reserverdWordsHelper = _dereq_(\"./reserved-words-helper\")\n\n                    /**\n                     * Code adapted from https://github.com/spicyj/es3ify\n                     * The MIT License (MIT)\n                     * Copyright (c) 2014 Ben Alpert\n                     */\n\n                    function visitProperty(traverse, node, path, state) {\n                        utils.catchup(node.key.range[0], state)\n                        utils.append('\"', state)\n                        utils.catchup(node.key.range[1], state)\n                        utils.append('\"', state)\n                        utils.catchup(node.value.range[0], state)\n                        traverse(node.value, path, state)\n                        return false\n                    }\n\n                    visitProperty.test = function(node) {\n                        return (\n                            node.type === Syntax.Property &&\n                            node.key.type === Syntax.Identifier &&\n                            !node.method &&\n                            !node.shorthand &&\n                            !node.computed &&\n                            reserverdWordsHelper.isES3ReservedWord(node.key.name)\n                        )\n                    }\n\n                    function visitMemberExpression(traverse, node, path, state) {\n                        traverse(node.object, path, state)\n                        utils.catchup(node.property.range[0] - 1, state)\n                        utils.append(\"[\", state)\n                        utils.catchupWhiteSpace(node.property.range[0], state)\n                        utils.append('\"', state)\n                        utils.catchup(node.property.range[1], state)\n                        utils.append('\"]', state)\n                        return false\n                    }\n\n                    visitMemberExpression.test = function(node) {\n                        return (\n                            node.type === Syntax.MemberExpression &&\n                            node.property.type === Syntax.Identifier &&\n                            reserverdWordsHelper.isES3ReservedWord(node.property.name)\n                        )\n                    }\n\n                    exports.visitorList = [visitProperty, visitMemberExpression]\n                },\n                { \"../src/utils\": 23, \"./reserved-words-helper\": 34, \"esprima-fb\": 9 }\n            ],\n            36: [\n                function(_dereq_, module, exports) {\n                    var esprima = _dereq_(\"esprima-fb\")\n                    var utils = _dereq_(\"../src/utils\")\n\n                    var Syntax = esprima.Syntax\n\n                    function _isFunctionNode(node) {\n                        return (\n                            node.type === Syntax.FunctionDeclaration ||\n                            node.type === Syntax.FunctionExpression ||\n                            node.type === Syntax.ArrowFunctionExpression\n                        )\n                    }\n\n                    function visitClassProperty(traverse, node, path, state) {\n                        utils.catchup(node.range[0], state)\n                        utils.catchupWhiteOut(node.range[1], state)\n                        return false\n                    }\n                    visitClassProperty.test = function(node, path, state) {\n                        return node.type === Syntax.ClassProperty\n                    }\n\n                    function visitTypeAlias(traverse, node, path, state) {\n                        utils.catchupWhiteOut(node.range[1], state)\n                        return false\n                    }\n                    visitTypeAlias.test = function(node, path, state) {\n                        return node.type === Syntax.TypeAlias\n                    }\n\n                    function visitTypeCast(traverse, node, path, state) {\n                        path.unshift(node)\n                        traverse(node.expression, path, state)\n                        path.shift()\n\n                        utils.catchup(node.typeAnnotation.range[0], state)\n                        utils.catchupWhiteOut(node.typeAnnotation.range[1], state)\n                        return false\n                    }\n                    visitTypeCast.test = function(node, path, state) {\n                        return node.type === Syntax.TypeCastExpression\n                    }\n\n                    function visitInterfaceDeclaration(traverse, node, path, state) {\n                        utils.catchupWhiteOut(node.range[1], state)\n                        return false\n                    }\n                    visitInterfaceDeclaration.test = function(node, path, state) {\n                        return node.type === Syntax.InterfaceDeclaration\n                    }\n\n                    function visitDeclare(traverse, node, path, state) {\n                        utils.catchupWhiteOut(node.range[1], state)\n                        return false\n                    }\n                    visitDeclare.test = function(node, path, state) {\n                        switch (node.type) {\n                            case Syntax.DeclareVariable:\n                            case Syntax.DeclareFunction:\n                            case Syntax.DeclareClass:\n                            case Syntax.DeclareModule:\n                                return true\n                        }\n                        return false\n                    }\n\n                    function visitFunctionParametricAnnotation(traverse, node, path, state) {\n                        utils.catchup(node.range[0], state)\n                        utils.catchupWhiteOut(node.range[1], state)\n                        return false\n                    }\n                    visitFunctionParametricAnnotation.test = function(node, path, state) {\n                        return (\n                            node.type === Syntax.TypeParameterDeclaration &&\n                            path[0] &&\n                            _isFunctionNode(path[0]) &&\n                            node === path[0].typeParameters\n                        )\n                    }\n\n                    function visitFunctionReturnAnnotation(traverse, node, path, state) {\n                        utils.catchup(node.range[0], state)\n                        utils.catchupWhiteOut(node.range[1], state)\n                        return false\n                    }\n                    visitFunctionReturnAnnotation.test = function(node, path, state) {\n                        return path[0] && _isFunctionNode(path[0]) && node === path[0].returnType\n                    }\n\n                    function visitOptionalFunctionParameterAnnotation(traverse, node, path, state) {\n                        utils.catchup(node.range[0] + node.name.length, state)\n                        utils.catchupWhiteOut(node.range[1], state)\n                        return false\n                    }\n                    visitOptionalFunctionParameterAnnotation.test = function(node, path, state) {\n                        return (\n                            node.type === Syntax.Identifier &&\n                            node.optional &&\n                            path[0] &&\n                            _isFunctionNode(path[0])\n                        )\n                    }\n\n                    function visitTypeAnnotatedIdentifier(traverse, node, path, state) {\n                        utils.catchup(node.typeAnnotation.range[0], state)\n                        utils.catchupWhiteOut(node.typeAnnotation.range[1], state)\n                        return false\n                    }\n                    visitTypeAnnotatedIdentifier.test = function(node, path, state) {\n                        return node.type === Syntax.Identifier && node.typeAnnotation\n                    }\n\n                    function visitTypeAnnotatedObjectOrArrayPattern(traverse, node, path, state) {\n                        utils.catchup(node.typeAnnotation.range[0], state)\n                        utils.catchupWhiteOut(node.typeAnnotation.range[1], state)\n                        return false\n                    }\n                    visitTypeAnnotatedObjectOrArrayPattern.test = function(node, path, state) {\n                        var rightType =\n                            node.type === Syntax.ObjectPattern || node.type === Syntax.ArrayPattern\n                        return rightType && node.typeAnnotation\n                    }\n\n                    /**\n                     * Methods cause trouble, since esprima parses them as a key/value pair, where\n                     * the location of the value starts at the method body. For example\n                     * { bar(x:number,...y:Array<number>):number {} }\n                     * is parsed as\n                     * { bar: function(x: number, ...y:Array<number>): number {} }\n                     * except that the location of the FunctionExpression value is 40-something,\n                     * which is the location of the function body. This means that by the time we\n                     * visit the params, rest param, and return type organically, we've already\n                     * catchup()'d passed them.\n                     */\n                    function visitMethod(traverse, node, path, state) {\n                        path.unshift(node)\n                        traverse(node.key, path, state)\n\n                        path.unshift(node.value)\n                        traverse(node.value.params, path, state)\n                        node.value.rest && traverse(node.value.rest, path, state)\n                        node.value.returnType && traverse(node.value.returnType, path, state)\n                        traverse(node.value.body, path, state)\n\n                        path.shift()\n\n                        path.shift()\n                        return false\n                    }\n\n                    visitMethod.test = function(node, path, state) {\n                        return (\n                            (node.type === \"Property\" &&\n                                (node.method || node.kind === \"set\" || node.kind === \"get\")) ||\n                            node.type === \"MethodDefinition\"\n                        )\n                    }\n\n                    function visitImportType(traverse, node, path, state) {\n                        utils.catchupWhiteOut(node.range[1], state)\n                        return false\n                    }\n                    visitImportType.test = function(node, path, state) {\n                        return node.type === \"ImportDeclaration\" && node.isType\n                    }\n\n                    exports.visitorList = [\n                        visitClassProperty,\n                        visitDeclare,\n                        visitImportType,\n                        visitInterfaceDeclaration,\n                        visitFunctionParametricAnnotation,\n                        visitFunctionReturnAnnotation,\n                        visitMethod,\n                        visitOptionalFunctionParameterAnnotation,\n                        visitTypeAlias,\n                        visitTypeCast,\n                        visitTypeAnnotatedIdentifier,\n                        visitTypeAnnotatedObjectOrArrayPattern\n                    ]\n                },\n                { \"../src/utils\": 23, \"esprima-fb\": 9 }\n            ],\n            37: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     */\n                    /*global exports:true*/\n                    \"use strict\"\n                    var Syntax = _dereq_(\"jstransform\").Syntax\n                    var utils = _dereq_(\"jstransform/src/utils\")\n\n                    function renderJSXLiteral(object, isLast, state, start, end) {\n                        var lines = object.value.split(/\\r\\n|\\n|\\r/)\n\n                        if (start) {\n                            utils.append(start, state)\n                        }\n\n                        var lastNonEmptyLine = 0\n\n                        lines.forEach(function(line, index) {\n                            if (line.match(/[^ \\t]/)) {\n                                lastNonEmptyLine = index\n                            }\n                        })\n\n                        lines.forEach(function(line, index) {\n                            var isFirstLine = index === 0\n                            var isLastLine = index === lines.length - 1\n                            var isLastNonEmptyLine = index === lastNonEmptyLine\n\n                            // replace rendered whitespace tabs with spaces\n                            var trimmedLine = line.replace(/\\t/g, \" \")\n\n                            // trim whitespace touching a newline\n                            if (!isFirstLine) {\n                                trimmedLine = trimmedLine.replace(/^[ ]+/, \"\")\n                            }\n                            if (!isLastLine) {\n                                trimmedLine = trimmedLine.replace(/[ ]+$/, \"\")\n                            }\n\n                            if (!isFirstLine) {\n                                utils.append(line.match(/^[ \\t]*/)[0], state)\n                            }\n\n                            if (trimmedLine || isLastNonEmptyLine) {\n                                utils.append(\n                                    JSON.stringify(trimmedLine) +\n                                        (!isLastNonEmptyLine ? \" + ' ' +\" : \"\"),\n                                    state\n                                )\n\n                                if (isLastNonEmptyLine) {\n                                    if (end) {\n                                        utils.append(end, state)\n                                    }\n                                    if (!isLast) {\n                                        utils.append(\", \", state)\n                                    }\n                                }\n\n                                // only restore tail whitespace if line had literals\n                                if (trimmedLine && !isLastLine) {\n                                    utils.append(line.match(/[ \\t]*$/)[0], state)\n                                }\n                            }\n\n                            if (!isLastLine) {\n                                utils.append(\"\\n\", state)\n                            }\n                        })\n\n                        utils.move(object.range[1], state)\n                    }\n\n                    function renderJSXExpressionContainer(traverse, object, isLast, path, state) {\n                        // Plus 1 to skip `{`.\n                        utils.move(object.range[0] + 1, state)\n                        utils.catchup(object.expression.range[0], state)\n                        traverse(object.expression, path, state)\n\n                        if (!isLast && object.expression.type !== Syntax.JSXEmptyExpression) {\n                            // If we need to append a comma, make sure to do so after the expression.\n                            utils.catchup(object.expression.range[1], state, trimLeft)\n                            utils.append(\", \", state)\n                        }\n\n                        // Minus 1 to skip `}`.\n                        utils.catchup(object.range[1] - 1, state, trimLeft)\n                        utils.move(object.range[1], state)\n                        return false\n                    }\n\n                    function quoteAttrName(attr) {\n                        // Quote invalid JS identifiers.\n                        if (!/^[a-z_$][a-z\\d_$]*$/i.test(attr)) {\n                            return '\"' + attr + '\"'\n                        }\n                        return attr\n                    }\n\n                    function trimLeft(value) {\n                        return value.replace(/^[ ]+/, \"\")\n                    }\n\n                    exports.renderJSXExpressionContainer = renderJSXExpressionContainer\n                    exports.renderJSXLiteral = renderJSXLiteral\n                    exports.quoteAttrName = quoteAttrName\n                    exports.trimLeft = trimLeft\n                },\n                { jstransform: 22, \"jstransform/src/utils\": 23 }\n            ],\n            38: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     */\n                    /*global exports:true*/\n                    \"use strict\"\n\n                    var Syntax = _dereq_(\"jstransform\").Syntax\n                    var utils = _dereq_(\"jstransform/src/utils\")\n\n                    var renderJSXExpressionContainer = _dereq_(\"./jsx\").renderJSXExpressionContainer\n                    var renderJSXLiteral = _dereq_(\"./jsx\").renderJSXLiteral\n                    var quoteAttrName = _dereq_(\"./jsx\").quoteAttrName\n\n                    var trimLeft = _dereq_(\"./jsx\").trimLeft\n\n                    /**\n                     * Customized desugar processor for React JSX. Currently:\n                     *\n                     * <X> </X> => React.createElement(X, null)\n                     * <X prop=\"1\" /> => React.createElement(X, {prop: '1'}, null)\n                     * <X prop=\"2\"><Y /></X> => React.createElement(X, {prop:'2'},\n                     *   React.createElement(Y, null)\n                     * )\n                     * <div /> => React.createElement(\"div\", null)\n                     */\n\n                    /**\n                     * Removes all non-whitespace/parenthesis characters\n                     */\n                    var reNonWhiteParen = /([^\\s\\(\\)])/g\n                    function stripNonWhiteParen(value) {\n                        return value.replace(reNonWhiteParen, \"\")\n                    }\n\n                    var tagConvention = /^[a-z]|\\-/\n                    function isTagName(name) {\n                        return tagConvention.test(name)\n                    }\n\n                    function visitReactTag(traverse, object, path, state) {\n                        var openingElement = object.openingElement\n                        var nameObject = openingElement.name\n                        var attributesObject = openingElement.attributes\n\n                        utils.catchup(openingElement.range[0], state, trimLeft)\n\n                        if (nameObject.type === Syntax.JSXNamespacedName && nameObject.namespace) {\n                            throw new Error(\n                                \"Namespace tags are not supported. ReactJSX is not XML.\"\n                            )\n                        }\n\n                        // We assume that the React runtime is already in scope\n                        utils.append(\"React.createElement(\", state)\n\n                        if (\n                            nameObject.type === Syntax.JSXIdentifier &&\n                            isTagName(nameObject.name)\n                        ) {\n                            utils.append('\"' + nameObject.name + '\"', state)\n                            utils.move(nameObject.range[1], state)\n                        } else {\n                            // Use utils.catchup in this case so we can easily handle\n                            // JSXMemberExpressions which look like Foo.Bar.Baz. This also handles\n                            // JSXIdentifiers that aren't fallback tags.\n                            utils.move(nameObject.range[0], state)\n                            utils.catchup(nameObject.range[1], state)\n                        }\n\n                        utils.append(\", \", state)\n\n                        var hasAttributes = attributesObject.length\n\n                        var hasAtLeastOneSpreadProperty = attributesObject.some(function(attr) {\n                            return attr.type === Syntax.JSXSpreadAttribute\n                        })\n\n                        // if we don't have any attributes, pass in null\n                        if (hasAtLeastOneSpreadProperty) {\n                            utils.append(\"React.__spread({\", state)\n                        } else if (hasAttributes) {\n                            utils.append(\"{\", state)\n                        } else {\n                            utils.append(\"null\", state)\n                        }\n\n                        // keep track of if the previous attribute was a spread attribute\n                        var previousWasSpread = false\n\n                        // write attributes\n                        attributesObject.forEach(function(attr, index) {\n                            var isLast = index === attributesObject.length - 1\n\n                            if (attr.type === Syntax.JSXSpreadAttribute) {\n                                // Close the previous object or initial object\n                                if (!previousWasSpread) {\n                                    utils.append(\"}, \", state)\n                                }\n\n                                // Move to the expression start, ignoring everything except parenthesis\n                                // and whitespace.\n                                utils.catchup(attr.range[0], state, stripNonWhiteParen)\n                                // Plus 1 to skip `{`.\n                                utils.move(attr.range[0] + 1, state)\n                                utils.catchup(attr.argument.range[0], state, stripNonWhiteParen)\n\n                                traverse(attr.argument, path, state)\n\n                                utils.catchup(attr.argument.range[1], state)\n\n                                // Move to the end, ignoring parenthesis and the closing `}`\n                                utils.catchup(attr.range[1] - 1, state, stripNonWhiteParen)\n\n                                if (!isLast) {\n                                    utils.append(\", \", state)\n                                }\n\n                                utils.move(attr.range[1], state)\n\n                                previousWasSpread = true\n\n                                return\n                            }\n\n                            // If the next attribute is a spread, we're effective last in this object\n                            if (!isLast) {\n                                isLast =\n                                    attributesObject[index + 1].type === Syntax.JSXSpreadAttribute\n                            }\n\n                            if (attr.name.namespace) {\n                                throw new Error(\n                                    \"Namespace attributes are not supported. ReactJSX is not XML.\"\n                                )\n                            }\n                            var name = attr.name.name\n\n                            utils.catchup(attr.range[0], state, trimLeft)\n\n                            if (previousWasSpread) {\n                                utils.append(\"{\", state)\n                            }\n\n                            utils.append(quoteAttrName(name), state)\n                            utils.append(\": \", state)\n\n                            if (!attr.value) {\n                                state.g.buffer += \"true\"\n                                state.g.position = attr.name.range[1]\n                                if (!isLast) {\n                                    utils.append(\", \", state)\n                                }\n                            } else {\n                                utils.move(attr.name.range[1], state)\n                                // Use catchupNewlines to skip over the '=' in the attribute\n                                utils.catchupNewlines(attr.value.range[0], state)\n                                if (attr.value.type === Syntax.Literal) {\n                                    renderJSXLiteral(attr.value, isLast, state)\n                                } else {\n                                    renderJSXExpressionContainer(\n                                        traverse,\n                                        attr.value,\n                                        isLast,\n                                        path,\n                                        state\n                                    )\n                                }\n                            }\n\n                            utils.catchup(attr.range[1], state, trimLeft)\n\n                            previousWasSpread = false\n                        })\n\n                        if (!openingElement.selfClosing) {\n                            utils.catchup(openingElement.range[1] - 1, state, trimLeft)\n                            utils.move(openingElement.range[1], state)\n                        }\n\n                        if (hasAttributes && !previousWasSpread) {\n                            utils.append(\"}\", state)\n                        }\n\n                        if (hasAtLeastOneSpreadProperty) {\n                            utils.append(\")\", state)\n                        }\n\n                        // filter out whitespace\n                        var childrenToRender = object.children.filter(function(child) {\n                            return !(\n                                child.type === Syntax.Literal &&\n                                typeof child.value === \"string\" &&\n                                child.value.match(/^[ \\t]*[\\r\\n][ \\t\\r\\n]*$/)\n                            )\n                        })\n                        if (childrenToRender.length > 0) {\n                            var lastRenderableIndex\n\n                            childrenToRender.forEach(function(child, index) {\n                                if (\n                                    child.type !== Syntax.JSXExpressionContainer ||\n                                    child.expression.type !== Syntax.JSXEmptyExpression\n                                ) {\n                                    lastRenderableIndex = index\n                                }\n                            })\n\n                            if (lastRenderableIndex !== undefined) {\n                                utils.append(\", \", state)\n                            }\n\n                            childrenToRender.forEach(function(child, index) {\n                                utils.catchup(child.range[0], state, trimLeft)\n\n                                var isLast = index >= lastRenderableIndex\n\n                                if (child.type === Syntax.Literal) {\n                                    renderJSXLiteral(child, isLast, state)\n                                } else if (child.type === Syntax.JSXExpressionContainer) {\n                                    renderJSXExpressionContainer(\n                                        traverse,\n                                        child,\n                                        isLast,\n                                        path,\n                                        state\n                                    )\n                                } else {\n                                    traverse(child, path, state)\n                                    if (!isLast) {\n                                        utils.append(\", \", state)\n                                    }\n                                }\n\n                                utils.catchup(child.range[1], state, trimLeft)\n                            })\n                        }\n\n                        if (openingElement.selfClosing) {\n                            // everything up to />\n                            utils.catchup(openingElement.range[1] - 2, state, trimLeft)\n                            utils.move(openingElement.range[1], state)\n                        } else {\n                            // everything up to </ sdflksjfd>\n                            utils.catchup(object.closingElement.range[0], state, trimLeft)\n                            utils.move(object.closingElement.range[1], state)\n                        }\n\n                        utils.append(\")\", state)\n                        return false\n                    }\n\n                    visitReactTag.test = function(object, path, state) {\n                        return object.type === Syntax.JSXElement\n                    }\n\n                    exports.visitorList = [visitReactTag]\n                },\n                { \"./jsx\": 37, jstransform: 22, \"jstransform/src/utils\": 23 }\n            ],\n            39: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     */\n                    /*global exports:true*/\n                    \"use strict\"\n\n                    var Syntax = _dereq_(\"jstransform\").Syntax\n                    var utils = _dereq_(\"jstransform/src/utils\")\n\n                    function addDisplayName(displayName, object, state) {\n                        if (\n                            object &&\n                            object.type === Syntax.CallExpression &&\n                            object.callee.type === Syntax.MemberExpression &&\n                            object.callee.object.type === Syntax.Identifier &&\n                            object.callee.object.name === \"React\" &&\n                            object.callee.property.type === Syntax.Identifier &&\n                            object.callee.property.name === \"createClass\" &&\n                            object.arguments.length === 1 &&\n                            object.arguments[0].type === Syntax.ObjectExpression\n                        ) {\n                            // Verify that the displayName property isn't already set\n                            var properties = object.arguments[0].properties\n                            var safe = properties.every(function(property) {\n                                var value =\n                                    property.key.type === Syntax.Identifier\n                                        ? property.key.name\n                                        : property.key.value\n                                return value !== \"displayName\"\n                            })\n\n                            if (safe) {\n                                utils.catchup(object.arguments[0].range[0] + 1, state)\n                                utils.append('displayName: \"' + displayName + '\",', state)\n                            }\n                        }\n                    }\n\n                    /**\n                     * Transforms the following:\n                     *\n                     * var MyComponent = React.createClass({\n                     *    render: ...\n                     * });\n                     *\n                     * into:\n                     *\n                     * var MyComponent = React.createClass({\n                     *    displayName: 'MyComponent',\n                     *    render: ...\n                     * });\n                     *\n                     * Also catches:\n                     *\n                     * MyComponent = React.createClass(...);\n                     * exports.MyComponent = React.createClass(...);\n                     * module.exports = {MyComponent: React.createClass(...)};\n                     */\n                    function visitReactDisplayName(traverse, object, path, state) {\n                        var left, right\n\n                        if (object.type === Syntax.AssignmentExpression) {\n                            left = object.left\n                            right = object.right\n                        } else if (object.type === Syntax.Property) {\n                            left = object.key\n                            right = object.value\n                        } else if (object.type === Syntax.VariableDeclarator) {\n                            left = object.id\n                            right = object.init\n                        }\n\n                        if (left && left.type === Syntax.MemberExpression) {\n                            left = left.property\n                        }\n                        if (left && left.type === Syntax.Identifier) {\n                            addDisplayName(left.name, right, state)\n                        }\n                    }\n\n                    visitReactDisplayName.test = function(object, path, state) {\n                        return (\n                            object.type === Syntax.AssignmentExpression ||\n                            object.type === Syntax.Property ||\n                            object.type === Syntax.VariableDeclarator\n                        )\n                    }\n\n                    exports.visitorList = [visitReactDisplayName]\n                },\n                { jstransform: 22, \"jstransform/src/utils\": 23 }\n            ],\n            40: [\n                function(_dereq_, module, exports) {\n                    /*global exports:true*/\n\n                    \"use strict\"\n\n                    var es6ArrowFunctions = _dereq_(\n                        \"jstransform/visitors/es6-arrow-function-visitors\"\n                    )\n                    var es6Classes = _dereq_(\"jstransform/visitors/es6-class-visitors\")\n                    var es6Destructuring = _dereq_(\n                        \"jstransform/visitors/es6-destructuring-visitors\"\n                    )\n                    var es6ObjectConciseMethod = _dereq_(\n                        \"jstransform/visitors/es6-object-concise-method-visitors\"\n                    )\n                    var es6ObjectShortNotation = _dereq_(\n                        \"jstransform/visitors/es6-object-short-notation-visitors\"\n                    )\n                    var es6RestParameters = _dereq_(\"jstransform/visitors/es6-rest-param-visitors\")\n                    var es6Templates = _dereq_(\"jstransform/visitors/es6-template-visitors\")\n                    var es6CallSpread = _dereq_(\"jstransform/visitors/es6-call-spread-visitors\")\n                    var es7SpreadProperty = _dereq_(\n                        \"jstransform/visitors/es7-spread-property-visitors\"\n                    )\n                    var react = _dereq_(\"./transforms/react\")\n                    var reactDisplayName = _dereq_(\"./transforms/reactDisplayName\")\n                    var reservedWords = _dereq_(\"jstransform/visitors/reserved-words-visitors\")\n\n                    /**\n                     * Map from transformName => orderedListOfVisitors.\n                     */\n                    var transformVisitors = {\n                        \"es6-arrow-functions\": es6ArrowFunctions.visitorList,\n                        \"es6-classes\": es6Classes.visitorList,\n                        \"es6-destructuring\": es6Destructuring.visitorList,\n                        \"es6-object-concise-method\": es6ObjectConciseMethod.visitorList,\n                        \"es6-object-short-notation\": es6ObjectShortNotation.visitorList,\n                        \"es6-rest-params\": es6RestParameters.visitorList,\n                        \"es6-templates\": es6Templates.visitorList,\n                        \"es6-call-spread\": es6CallSpread.visitorList,\n                        \"es7-spread-property\": es7SpreadProperty.visitorList,\n                        react: react.visitorList.concat(reactDisplayName.visitorList),\n                        \"reserved-words\": reservedWords.visitorList\n                    }\n\n                    var transformSets = {\n                        harmony: [\n                            \"es6-arrow-functions\",\n                            \"es6-object-concise-method\",\n                            \"es6-object-short-notation\",\n                            \"es6-classes\",\n                            \"es6-rest-params\",\n                            \"es6-templates\",\n                            \"es6-destructuring\",\n                            \"es6-call-spread\",\n                            \"es7-spread-property\"\n                        ],\n                        es3: [\"reserved-words\"],\n                        react: [\"react\"]\n                    }\n\n                    /**\n                     * Specifies the order in which each transform should run.\n                     */\n                    var transformRunOrder = [\n                        \"reserved-words\",\n                        \"es6-arrow-functions\",\n                        \"es6-object-concise-method\",\n                        \"es6-object-short-notation\",\n                        \"es6-classes\",\n                        \"es6-rest-params\",\n                        \"es6-templates\",\n                        \"es6-destructuring\",\n                        \"es6-call-spread\",\n                        \"es7-spread-property\",\n                        \"react\"\n                    ]\n\n                    /**\n                     * Given a list of transform names, return the ordered list of visitors to be\n                     * passed to the transform() function.\n                     *\n                     * @param {array?} excludes\n                     * @return {array}\n                     */\n                    function getAllVisitors(excludes) {\n                        var ret = []\n                        for (var i = 0, il = transformRunOrder.length; i < il; i++) {\n                            if (!excludes || excludes.indexOf(transformRunOrder[i]) === -1) {\n                                ret = ret.concat(transformVisitors[transformRunOrder[i]])\n                            }\n                        }\n                        return ret\n                    }\n\n                    /**\n                     * Given a list of visitor set names, return the ordered list of visitors to be\n                     * passed to jstransform.\n                     *\n                     * @param {array}\n                     * @return {array}\n                     */\n                    function getVisitorsBySet(sets) {\n                        var visitorsToInclude = sets.reduce(function(visitors, set) {\n                            if (!transformSets.hasOwnProperty(set)) {\n                                throw new Error(\"Unknown visitor set: \" + set)\n                            }\n                            transformSets[set].forEach(function(visitor) {\n                                visitors[visitor] = true\n                            })\n                            return visitors\n                        }, {})\n\n                        var visitorList = []\n                        for (var i = 0; i < transformRunOrder.length; i++) {\n                            if (visitorsToInclude.hasOwnProperty(transformRunOrder[i])) {\n                                visitorList = visitorList.concat(\n                                    transformVisitors[transformRunOrder[i]]\n                                )\n                            }\n                        }\n\n                        return visitorList\n                    }\n\n                    exports.getVisitorsBySet = getVisitorsBySet\n                    exports.getAllVisitors = getAllVisitors\n                    exports.transformVisitors = transformVisitors\n                },\n                {\n                    \"./transforms/react\": 38,\n                    \"./transforms/reactDisplayName\": 39,\n                    \"jstransform/visitors/es6-arrow-function-visitors\": 24,\n                    \"jstransform/visitors/es6-call-spread-visitors\": 25,\n                    \"jstransform/visitors/es6-class-visitors\": 26,\n                    \"jstransform/visitors/es6-destructuring-visitors\": 27,\n                    \"jstransform/visitors/es6-object-concise-method-visitors\": 28,\n                    \"jstransform/visitors/es6-object-short-notation-visitors\": 29,\n                    \"jstransform/visitors/es6-rest-param-visitors\": 30,\n                    \"jstransform/visitors/es6-template-visitors\": 31,\n                    \"jstransform/visitors/es7-spread-property-visitors\": 33,\n                    \"jstransform/visitors/reserved-words-visitors\": 35\n                }\n            ],\n            41: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     */\n\n                    \"use strict\"\n                    /*eslint-disable no-undef*/\n                    var Buffer = _dereq_(\"buffer\").Buffer\n\n                    function inlineSourceMap(sourceMap, sourceCode, sourceFilename) {\n                        // This can be used with a sourcemap that has already has toJSON called on it.\n                        // Check first.\n                        var json = sourceMap\n                        if (typeof sourceMap.toJSON === \"function\") {\n                            json = sourceMap.toJSON()\n                        }\n                        json.sources = [sourceFilename]\n                        json.sourcesContent = [sourceCode]\n                        var base64 = Buffer(JSON.stringify(json)).toString(\"base64\")\n                        return \"//# sourceMappingURL=data:application/json;base64,\" + base64\n                    }\n\n                    module.exports = inlineSourceMap\n                },\n                { buffer: 3 }\n            ]\n        },\n        {},\n        [1]\n    )(1)\n})\n"
  },
  {
    "path": "docs/assets/getting-started-assets/javascripts/codemirror/javascript/index.html",
    "content": "<!doctype html>\n\n<title>CodeMirror: JavaScript mode</title>\n<meta charset=\"utf-8\"/>\n<link rel=stylesheet href=\"../../doc/docs.css\">\n\n<link rel=\"stylesheet\" href=\"../../lib/codemirror.css\">\n<script src=\"../../lib/codemirror.js\"></script>\n<script src=\"../../addon/edit/matchbrackets.js\"></script>\n<script src=\"../../addon/comment/continuecomment.js\"></script>\n<script src=\"../../addon/comment/comment.js\"></script>\n<script src=\"javascript.js\"></script>\n<style type=\"text/css\">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>\n<div id=nav>\n  <a href=\"http://codemirror.net\"><h1>CodeMirror</h1><img id=logo src=\"../../doc/logo.png\"></a>\n\n  <ul>\n    <li><a href=\"../../index.html\">Home</a>\n    <li><a href=\"../../doc/manual.html\">Manual</a>\n    <li><a href=\"https://github.com/codemirror/codemirror\">Code</a>\n  </ul>\n  <ul>\n    <li><a href=\"../index.html\">Language modes</a>\n    <li><a class=active href=\"#\">JavaScript</a>\n  </ul>\n</div>\n\n<article>\n<h2>JavaScript mode</h2>\n\n\n<div><textarea id=\"code\" name=\"code\">\n// Demo code (the actual new parser character stream implementation)\n\nfunction StringStream(string) {\n  this.pos = 0;\n  this.string = string;\n}\n\nStringStream.prototype = {\n  done: function() {return this.pos >= this.string.length;},\n  peek: function() {return this.string.charAt(this.pos);},\n  next: function() {\n    if (this.pos &lt; this.string.length)\n      return this.string.charAt(this.pos++);\n  },\n  eat: function(match) {\n    var ch = this.string.charAt(this.pos);\n    if (typeof match == \"string\") var ok = ch == match;\n    else var ok = ch &amp;&amp; match.test ? match.test(ch) : match(ch);\n    if (ok) {this.pos++; return ch;}\n  },\n  eatWhile: function(match) {\n    var start = this.pos;\n    while (this.eat(match));\n    if (this.pos > start) return this.string.slice(start, this.pos);\n  },\n  backUp: function(n) {this.pos -= n;},\n  column: function() {return this.pos;},\n  eatSpace: function() {\n    var start = this.pos;\n    while (/\\s/.test(this.string.charAt(this.pos))) this.pos++;\n    return this.pos - start;\n  },\n  match: function(pattern, consume, caseInsensitive) {\n    if (typeof pattern == \"string\") {\n      function cased(str) {return caseInsensitive ? str.toLowerCase() : str;}\n      if (cased(this.string).indexOf(cased(pattern), this.pos) == this.pos) {\n        if (consume !== false) this.pos += str.length;\n        return true;\n      }\n    }\n    else {\n      var match = this.string.slice(this.pos).match(pattern);\n      if (match &amp;&amp; consume !== false) this.pos += match[0].length;\n      return match;\n    }\n  }\n};\n</textarea></div>\n\n    <script>\n      var editor = CodeMirror.fromTextArea(document.getElementById(\"code\"), {\n        lineNumbers: true,\n        matchBrackets: true,\n        continueComments: \"Enter\",\n        extraKeys: {\"Ctrl-Q\": \"toggleComment\"}\n      });\n    </script>\n\n    <p>\n      JavaScript mode supports several configuration options:\n      <ul>\n        <li><code>json</code> which will set the mode to expect JSON\n        data rather than a JavaScript program.</li>\n        <li><code>jsonld</code> which will set the mode to expect\n        <a href=\"http://json-ld.org\">JSON-LD</a> linked data rather\n        than a JavaScript program (<a href=\"json-ld.html\">demo</a>).</li>\n        <li><code>typescript</code> which will activate additional\n        syntax highlighting and some other things for TypeScript code\n        (<a href=\"typescript.html\">demo</a>).</li>\n        <li><code>statementIndent</code> which (given a number) will\n        determine the amount of indentation to use for statements\n        continued on a new line.</li>\n        <li><code>wordCharacters</code>, a regexp that indicates which\n        characters should be considered part of an identifier.\n        Defaults to <code>/[\\w$]/</code>, which does not handle\n        non-ASCII identifiers. Can be set to something more elaborate\n        to improve Unicode support.</li>\n      </ul>\n    </p>\n\n    <p><strong>MIME types defined:</strong> <code>text/javascript</code>, <code>application/json</code>, <code>application/ld+json</code>, <code>text/typescript</code>, <code>application/typescript</code>.</p>\n  </article>\n"
  },
  {
    "path": "docs/assets/getting-started-assets/javascripts/codemirror/javascript/javascript.js",
    "content": "// CodeMirror, copyright (c) by Marijn Haverbeke and others\n// Distributed under an MIT license: http://codemirror.net/LICENSE\n\n// TODO actually recognize syntax of TypeScript constructs\n\n;(function(mod) {\n    if (typeof exports == \"object\" && typeof module == \"object\")\n        // CommonJS\n        mod(require(\"../../lib/codemirror\"))\n    else if (typeof define == \"function\" && define.amd)\n        // AMD\n        define([\"../../lib/codemirror\"], mod)\n    // Plain browser env\n    else mod(CodeMirror)\n})(function(CodeMirror) {\n    \"use strict\"\n\n    CodeMirror.defineMode(\"javascript\", function(config, parserConfig) {\n        var indentUnit = config.indentUnit\n        var statementIndent = parserConfig.statementIndent\n        var jsonldMode = parserConfig.jsonld\n        var jsonMode = parserConfig.json || jsonldMode\n        var isTS = parserConfig.typescript\n        var wordRE = parserConfig.wordCharacters || /[\\w$\\xa1-\\uffff]/\n\n        // Tokenizer\n\n        var keywords = (function() {\n            function kw(type) {\n                return { type: type, style: \"keyword\" }\n            }\n            var A = kw(\"keyword a\"),\n                B = kw(\"keyword b\"),\n                C = kw(\"keyword c\")\n            var operator = kw(\"operator\"),\n                atom = { type: \"atom\", style: \"atom\" }\n\n            var jsKeywords = {\n                if: kw(\"if\"),\n                while: A,\n                with: A,\n                else: B,\n                do: B,\n                try: B,\n                finally: B,\n                return: C,\n                break: C,\n                continue: C,\n                new: C,\n                delete: C,\n                throw: C,\n                debugger: C,\n                var: kw(\"var\"),\n                const: kw(\"var\"),\n                let: kw(\"var\"),\n                function: kw(\"function\"),\n                catch: kw(\"catch\"),\n                for: kw(\"for\"),\n                switch: kw(\"switch\"),\n                case: kw(\"case\"),\n                default: kw(\"default\"),\n                in: operator,\n                typeof: operator,\n                instanceof: operator,\n                true: atom,\n                false: atom,\n                null: atom,\n                undefined: atom,\n                NaN: atom,\n                Infinity: atom,\n                this: kw(\"this\"),\n                module: kw(\"module\"),\n                class: kw(\"class\"),\n                super: kw(\"atom\"),\n                yield: C,\n                export: kw(\"export\"),\n                import: kw(\"import\"),\n                extends: C\n            }\n\n            // Extend the 'normal' keywords with the TypeScript language extensions\n            if (isTS) {\n                var type = { type: \"variable\", style: \"variable-3\" }\n                var tsKeywords = {\n                    // object-like things\n                    interface: kw(\"interface\"),\n                    extends: kw(\"extends\"),\n                    constructor: kw(\"constructor\"),\n\n                    // scope modifiers\n                    public: kw(\"public\"),\n                    private: kw(\"private\"),\n                    protected: kw(\"protected\"),\n                    static: kw(\"static\"),\n\n                    // types\n                    string: type,\n                    number: type,\n                    bool: type,\n                    any: type\n                }\n\n                for (var attr in tsKeywords) {\n                    jsKeywords[attr] = tsKeywords[attr]\n                }\n            }\n\n            return jsKeywords\n        })()\n\n        var isOperatorChar = /[+\\-*&%=<>!?|~^]/\n        var isJsonldKeyword = /^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)\"/\n\n        function readRegexp(stream) {\n            var escaped = false,\n                next,\n                inSet = false\n            while ((next = stream.next()) != null) {\n                if (!escaped) {\n                    if (next == \"/\" && !inSet) return\n                    if (next == \"[\") inSet = true\n                    else if (inSet && next == \"]\") inSet = false\n                }\n                escaped = !escaped && next == \"\\\\\"\n            }\n        }\n\n        // Used as scratch variables to communicate multiple values without\n        // consing up tons of objects.\n        var type, content\n        function ret(tp, style, cont) {\n            type = tp\n            content = cont\n            return style\n        }\n        function tokenBase(stream, state) {\n            var ch = stream.next()\n            if (ch == '\"' || ch == \"'\") {\n                state.tokenize = tokenString(ch)\n                return state.tokenize(stream, state)\n            } else if (ch == \".\" && stream.match(/^\\d+(?:[eE][+\\-]?\\d+)?/)) {\n                return ret(\"number\", \"number\")\n            } else if (ch == \".\" && stream.match(\"..\")) {\n                return ret(\"spread\", \"meta\")\n            } else if (/[\\[\\]{}\\(\\),;\\:\\.]/.test(ch)) {\n                return ret(ch)\n            } else if (ch == \"=\" && stream.eat(\">\")) {\n                return ret(\"=>\", \"operator\")\n            } else if (ch == \"0\" && stream.eat(/x/i)) {\n                stream.eatWhile(/[\\da-f]/i)\n                return ret(\"number\", \"number\")\n            } else if (/\\d/.test(ch)) {\n                stream.match(/^\\d*(?:\\.\\d*)?(?:[eE][+\\-]?\\d+)?/)\n                return ret(\"number\", \"number\")\n            } else if (ch == \"/\") {\n                if (stream.eat(\"*\")) {\n                    state.tokenize = tokenComment\n                    return tokenComment(stream, state)\n                } else if (stream.eat(\"/\")) {\n                    stream.skipToEnd()\n                    return ret(\"comment\", \"comment\")\n                } else if (\n                    state.lastType == \"operator\" ||\n                    state.lastType == \"keyword c\" ||\n                    state.lastType == \"sof\" ||\n                    /^[\\[{}\\(,;:]$/.test(state.lastType)\n                ) {\n                    readRegexp(stream)\n                    stream.match(/^\\b(([gimyu])(?![gimyu]*\\2))+\\b/)\n                    return ret(\"regexp\", \"string-2\")\n                } else {\n                    stream.eatWhile(isOperatorChar)\n                    return ret(\"operator\", \"operator\", stream.current())\n                }\n            } else if (ch == \"`\") {\n                state.tokenize = tokenQuasi\n                return tokenQuasi(stream, state)\n            } else if (ch == \"#\") {\n                stream.skipToEnd()\n                return ret(\"error\", \"error\")\n            } else if (isOperatorChar.test(ch)) {\n                stream.eatWhile(isOperatorChar)\n                return ret(\"operator\", \"operator\", stream.current())\n            } else if (wordRE.test(ch)) {\n                stream.eatWhile(wordRE)\n                var word = stream.current(),\n                    known = keywords.propertyIsEnumerable(word) && keywords[word]\n                return known && state.lastType != \".\"\n                    ? ret(known.type, known.style, word)\n                    : ret(\"variable\", \"variable\", word)\n            }\n        }\n\n        function tokenString(quote) {\n            return function(stream, state) {\n                var escaped = false,\n                    next\n                if (jsonldMode && stream.peek() == \"@\" && stream.match(isJsonldKeyword)) {\n                    state.tokenize = tokenBase\n                    return ret(\"jsonld-keyword\", \"meta\")\n                }\n                while ((next = stream.next()) != null) {\n                    if (next == quote && !escaped) break\n                    escaped = !escaped && next == \"\\\\\"\n                }\n                if (!escaped) state.tokenize = tokenBase\n                return ret(\"string\", \"string\")\n            }\n        }\n\n        function tokenComment(stream, state) {\n            var maybeEnd = false,\n                ch\n            while ((ch = stream.next())) {\n                if (ch == \"/\" && maybeEnd) {\n                    state.tokenize = tokenBase\n                    break\n                }\n                maybeEnd = ch == \"*\"\n            }\n            return ret(\"comment\", \"comment\")\n        }\n\n        function tokenQuasi(stream, state) {\n            var escaped = false,\n                next\n            while ((next = stream.next()) != null) {\n                if (!escaped && (next == \"`\" || (next == \"$\" && stream.eat(\"{\")))) {\n                    state.tokenize = tokenBase\n                    break\n                }\n                escaped = !escaped && next == \"\\\\\"\n            }\n            return ret(\"quasi\", \"string-2\", stream.current())\n        }\n\n        var brackets = \"([{}])\"\n        // This is a crude lookahead trick to try and notice that we're\n        // parsing the argument patterns for a fat-arrow function before we\n        // actually hit the arrow token. It only works if the arrow is on\n        // the same line as the arguments and there's no strange noise\n        // (comments) in between. Fallback is to only notice when we hit the\n        // arrow, and not declare the arguments as locals for the arrow\n        // body.\n        function findFatArrow(stream, state) {\n            if (state.fatArrowAt) state.fatArrowAt = null\n            var arrow = stream.string.indexOf(\"=>\", stream.start)\n            if (arrow < 0) return\n\n            var depth = 0,\n                sawSomething = false\n            for (var pos = arrow - 1; pos >= 0; --pos) {\n                var ch = stream.string.charAt(pos)\n                var bracket = brackets.indexOf(ch)\n                if (bracket >= 0 && bracket < 3) {\n                    if (!depth) {\n                        ++pos\n                        break\n                    }\n                    if (--depth == 0) break\n                } else if (bracket >= 3 && bracket < 6) {\n                    ++depth\n                } else if (wordRE.test(ch)) {\n                    sawSomething = true\n                } else if (/[\"'\\/]/.test(ch)) {\n                    return\n                } else if (sawSomething && !depth) {\n                    ++pos\n                    break\n                }\n            }\n            if (sawSomething && !depth) state.fatArrowAt = pos\n        }\n\n        // Parser\n\n        var atomicTypes = {\n            atom: true,\n            number: true,\n            variable: true,\n            string: true,\n            regexp: true,\n            this: true,\n            \"jsonld-keyword\": true\n        }\n\n        function JSLexical(indented, column, type, align, prev, info) {\n            this.indented = indented\n            this.column = column\n            this.type = type\n            this.prev = prev\n            this.info = info\n            if (align != null) this.align = align\n        }\n\n        function inScope(state, varname) {\n            for (var v = state.localVars; v; v = v.next) if (v.name == varname) return true\n            for (var cx = state.context; cx; cx = cx.prev) {\n                for (var v = cx.vars; v; v = v.next) if (v.name == varname) return true\n            }\n        }\n\n        function parseJS(state, style, type, content, stream) {\n            var cc = state.cc\n            // Communicate our context to the combinators.\n            // (Less wasteful than consing up a hundred closures on every call.)\n            cx.state = state\n            cx.stream = stream\n            ;(cx.marked = null), (cx.cc = cc)\n            cx.style = style\n\n            if (!state.lexical.hasOwnProperty(\"align\")) state.lexical.align = true\n\n            while (true) {\n                var combinator = cc.length ? cc.pop() : jsonMode ? expression : statement\n                if (combinator(type, content)) {\n                    while (cc.length && cc[cc.length - 1].lex) cc.pop()()\n                    if (cx.marked) return cx.marked\n                    if (type == \"variable\" && inScope(state, content)) return \"variable-2\"\n                    return style\n                }\n            }\n        }\n\n        // Combinator utils\n\n        var cx = { state: null, column: null, marked: null, cc: null }\n        function pass() {\n            for (var i = arguments.length - 1; i >= 0; i--) cx.cc.push(arguments[i])\n        }\n        function cont() {\n            pass.apply(null, arguments)\n            return true\n        }\n        function register(varname) {\n            function inList(list) {\n                for (var v = list; v; v = v.next) if (v.name == varname) return true\n                return false\n            }\n            var state = cx.state\n            if (state.context) {\n                cx.marked = \"def\"\n                if (inList(state.localVars)) return\n                state.localVars = { name: varname, next: state.localVars }\n            } else {\n                if (inList(state.globalVars)) return\n                if (parserConfig.globalVars)\n                    state.globalVars = { name: varname, next: state.globalVars }\n            }\n        }\n\n        // Combinators\n\n        var defaultVars = { name: \"this\", next: { name: \"arguments\" } }\n        function pushcontext() {\n            cx.state.context = { prev: cx.state.context, vars: cx.state.localVars }\n            cx.state.localVars = defaultVars\n        }\n        function popcontext() {\n            cx.state.localVars = cx.state.context.vars\n            cx.state.context = cx.state.context.prev\n        }\n        function pushlex(type, info) {\n            var result = function() {\n                var state = cx.state,\n                    indent = state.indented\n                if (state.lexical.type == \"stat\") indent = state.lexical.indented\n                else\n                    for (\n                        var outer = state.lexical;\n                        outer && outer.type == \")\" && outer.align;\n                        outer = outer.prev\n                    )\n                        indent = outer.indented\n                state.lexical = new JSLexical(\n                    indent,\n                    cx.stream.column(),\n                    type,\n                    null,\n                    state.lexical,\n                    info\n                )\n            }\n            result.lex = true\n            return result\n        }\n        function poplex() {\n            var state = cx.state\n            if (state.lexical.prev) {\n                if (state.lexical.type == \")\") state.indented = state.lexical.indented\n                state.lexical = state.lexical.prev\n            }\n        }\n        poplex.lex = true\n\n        function expect(wanted) {\n            function exp(type) {\n                if (type == wanted) return cont()\n                else if (wanted == \";\") return pass()\n                else return cont(exp)\n            }\n            return exp\n        }\n\n        function statement(type, value) {\n            if (type == \"var\")\n                return cont(pushlex(\"vardef\", value.length), vardef, expect(\";\"), poplex)\n            if (type == \"keyword a\") return cont(pushlex(\"form\"), expression, statement, poplex)\n            if (type == \"keyword b\") return cont(pushlex(\"form\"), statement, poplex)\n            if (type == \"{\") return cont(pushlex(\"}\"), block, poplex)\n            if (type == \";\") return cont()\n            if (type == \"if\") {\n                if (\n                    cx.state.lexical.info == \"else\" &&\n                    cx.state.cc[cx.state.cc.length - 1] == poplex\n                )\n                    cx.state.cc.pop()()\n                return cont(pushlex(\"form\"), expression, statement, poplex, maybeelse)\n            }\n            if (type == \"function\") return cont(functiondef)\n            if (type == \"for\") return cont(pushlex(\"form\"), forspec, statement, poplex)\n            if (type == \"variable\") return cont(pushlex(\"stat\"), maybelabel)\n            if (type == \"switch\")\n                return cont(\n                    pushlex(\"form\"),\n                    expression,\n                    pushlex(\"}\", \"switch\"),\n                    expect(\"{\"),\n                    block,\n                    poplex,\n                    poplex\n                )\n            if (type == \"case\") return cont(expression, expect(\":\"))\n            if (type == \"default\") return cont(expect(\":\"))\n            if (type == \"catch\")\n                return cont(\n                    pushlex(\"form\"),\n                    pushcontext,\n                    expect(\"(\"),\n                    funarg,\n                    expect(\")\"),\n                    statement,\n                    poplex,\n                    popcontext\n                )\n            if (type == \"module\")\n                return cont(pushlex(\"form\"), pushcontext, afterModule, popcontext, poplex)\n            if (type == \"class\") return cont(pushlex(\"form\"), className, poplex)\n            if (type == \"export\") return cont(pushlex(\"form\"), afterExport, poplex)\n            if (type == \"import\") return cont(pushlex(\"form\"), afterImport, poplex)\n            return pass(pushlex(\"stat\"), expression, expect(\";\"), poplex)\n        }\n        function expression(type) {\n            return expressionInner(type, false)\n        }\n        function expressionNoComma(type) {\n            return expressionInner(type, true)\n        }\n        function expressionInner(type, noComma) {\n            if (cx.state.fatArrowAt == cx.stream.start) {\n                var body = noComma ? arrowBodyNoComma : arrowBody\n                if (type == \"(\")\n                    return cont(\n                        pushcontext,\n                        pushlex(\")\"),\n                        commasep(pattern, \")\"),\n                        poplex,\n                        expect(\"=>\"),\n                        body,\n                        popcontext\n                    )\n                else if (type == \"variable\")\n                    return pass(pushcontext, pattern, expect(\"=>\"), body, popcontext)\n            }\n\n            var maybeop = noComma ? maybeoperatorNoComma : maybeoperatorComma\n            if (atomicTypes.hasOwnProperty(type)) return cont(maybeop)\n            if (type == \"function\") return cont(functiondef, maybeop)\n            if (type == \"keyword c\") return cont(noComma ? maybeexpressionNoComma : maybeexpression)\n            if (type == \"(\")\n                return cont(\n                    pushlex(\")\"),\n                    maybeexpression,\n                    comprehension,\n                    expect(\")\"),\n                    poplex,\n                    maybeop\n                )\n            if (type == \"operator\" || type == \"spread\")\n                return cont(noComma ? expressionNoComma : expression)\n            if (type == \"[\") return cont(pushlex(\"]\"), arrayLiteral, poplex, maybeop)\n            if (type == \"{\") return contCommasep(objprop, \"}\", null, maybeop)\n            if (type == \"quasi\") {\n                return pass(quasi, maybeop)\n            }\n            return cont()\n        }\n        function maybeexpression(type) {\n            if (type.match(/[;\\}\\)\\],]/)) return pass()\n            return pass(expression)\n        }\n        function maybeexpressionNoComma(type) {\n            if (type.match(/[;\\}\\)\\],]/)) return pass()\n            return pass(expressionNoComma)\n        }\n\n        function maybeoperatorComma(type, value) {\n            if (type == \",\") return cont(expression)\n            return maybeoperatorNoComma(type, value, false)\n        }\n        function maybeoperatorNoComma(type, value, noComma) {\n            var me = noComma == false ? maybeoperatorComma : maybeoperatorNoComma\n            var expr = noComma == false ? expression : expressionNoComma\n            if (type == \"=>\")\n                return cont(pushcontext, noComma ? arrowBodyNoComma : arrowBody, popcontext)\n            if (type == \"operator\") {\n                if (/\\+\\+|--/.test(value)) return cont(me)\n                if (value == \"?\") return cont(expression, expect(\":\"), expr)\n                return cont(expr)\n            }\n            if (type == \"quasi\") {\n                return pass(quasi, me)\n            }\n            if (type == \";\") return\n            if (type == \"(\") return contCommasep(expressionNoComma, \")\", \"call\", me)\n            if (type == \".\") return cont(property, me)\n            if (type == \"[\") return cont(pushlex(\"]\"), maybeexpression, expect(\"]\"), poplex, me)\n        }\n        function quasi(type, value) {\n            if (type != \"quasi\") return pass()\n            if (value.slice(value.length - 2) != \"${\") return cont(quasi)\n            return cont(expression, continueQuasi)\n        }\n        function continueQuasi(type) {\n            if (type == \"}\") {\n                cx.marked = \"string-2\"\n                cx.state.tokenize = tokenQuasi\n                return cont(quasi)\n            }\n        }\n        function arrowBody(type) {\n            findFatArrow(cx.stream, cx.state)\n            return pass(type == \"{\" ? statement : expression)\n        }\n        function arrowBodyNoComma(type) {\n            findFatArrow(cx.stream, cx.state)\n            return pass(type == \"{\" ? statement : expressionNoComma)\n        }\n        function maybelabel(type) {\n            if (type == \":\") return cont(poplex, statement)\n            return pass(maybeoperatorComma, expect(\";\"), poplex)\n        }\n        function property(type) {\n            if (type == \"variable\") {\n                cx.marked = \"property\"\n                return cont()\n            }\n        }\n        function objprop(type, value) {\n            if (type == \"variable\" || cx.style == \"keyword\") {\n                cx.marked = \"property\"\n                if (value == \"get\" || value == \"set\") return cont(getterSetter)\n                return cont(afterprop)\n            } else if (type == \"number\" || type == \"string\") {\n                cx.marked = jsonldMode ? \"property\" : cx.style + \" property\"\n                return cont(afterprop)\n            } else if (type == \"jsonld-keyword\") {\n                return cont(afterprop)\n            } else if (type == \"[\") {\n                return cont(expression, expect(\"]\"), afterprop)\n            }\n        }\n        function getterSetter(type) {\n            if (type != \"variable\") return pass(afterprop)\n            cx.marked = \"property\"\n            return cont(functiondef)\n        }\n        function afterprop(type) {\n            if (type == \":\") return cont(expressionNoComma)\n            if (type == \"(\") return pass(functiondef)\n        }\n        function commasep(what, end) {\n            function proceed(type) {\n                if (type == \",\") {\n                    var lex = cx.state.lexical\n                    if (lex.info == \"call\") lex.pos = (lex.pos || 0) + 1\n                    return cont(what, proceed)\n                }\n                if (type == end) return cont()\n                return cont(expect(end))\n            }\n            return function(type) {\n                if (type == end) return cont()\n                return pass(what, proceed)\n            }\n        }\n        function contCommasep(what, end, info) {\n            for (var i = 3; i < arguments.length; i++) cx.cc.push(arguments[i])\n            return cont(pushlex(end, info), commasep(what, end), poplex)\n        }\n        function block(type) {\n            if (type == \"}\") return cont()\n            return pass(statement, block)\n        }\n        function maybetype(type) {\n            if (isTS && type == \":\") return cont(typedef)\n        }\n        function maybedefault(_, value) {\n            if (value == \"=\") return cont(expressionNoComma)\n        }\n        function typedef(type) {\n            if (type == \"variable\") {\n                cx.marked = \"variable-3\"\n                return cont()\n            }\n        }\n        function vardef() {\n            return pass(pattern, maybetype, maybeAssign, vardefCont)\n        }\n        function pattern(type, value) {\n            if (type == \"variable\") {\n                register(value)\n                return cont()\n            }\n            if (type == \"[\") return contCommasep(pattern, \"]\")\n            if (type == \"{\") return contCommasep(proppattern, \"}\")\n        }\n        function proppattern(type, value) {\n            if (type == \"variable\" && !cx.stream.match(/^\\s*:/, false)) {\n                register(value)\n                return cont(maybeAssign)\n            }\n            if (type == \"variable\") cx.marked = \"property\"\n            return cont(expect(\":\"), pattern, maybeAssign)\n        }\n        function maybeAssign(_type, value) {\n            if (value == \"=\") return cont(expressionNoComma)\n        }\n        function vardefCont(type) {\n            if (type == \",\") return cont(vardef)\n        }\n        function maybeelse(type, value) {\n            if (type == \"keyword b\" && value == \"else\")\n                return cont(pushlex(\"form\", \"else\"), statement, poplex)\n        }\n        function forspec(type) {\n            if (type == \"(\") return cont(pushlex(\")\"), forspec1, expect(\")\"), poplex)\n        }\n        function forspec1(type) {\n            if (type == \"var\") return cont(vardef, expect(\";\"), forspec2)\n            if (type == \";\") return cont(forspec2)\n            if (type == \"variable\") return cont(formaybeinof)\n            return pass(expression, expect(\";\"), forspec2)\n        }\n        function formaybeinof(_type, value) {\n            if (value == \"in\" || value == \"of\") {\n                cx.marked = \"keyword\"\n                return cont(expression)\n            }\n            return cont(maybeoperatorComma, forspec2)\n        }\n        function forspec2(type, value) {\n            if (type == \";\") return cont(forspec3)\n            if (value == \"in\" || value == \"of\") {\n                cx.marked = \"keyword\"\n                return cont(expression)\n            }\n            return pass(expression, expect(\";\"), forspec3)\n        }\n        function forspec3(type) {\n            if (type != \")\") cont(expression)\n        }\n        function functiondef(type, value) {\n            if (value == \"*\") {\n                cx.marked = \"keyword\"\n                return cont(functiondef)\n            }\n            if (type == \"variable\") {\n                register(value)\n                return cont(functiondef)\n            }\n            if (type == \"(\")\n                return cont(\n                    pushcontext,\n                    pushlex(\")\"),\n                    commasep(funarg, \")\"),\n                    poplex,\n                    statement,\n                    popcontext\n                )\n        }\n        function funarg(type) {\n            if (type == \"spread\") return cont(funarg)\n            return pass(pattern, maybetype, maybedefault)\n        }\n        function className(type, value) {\n            if (type == \"variable\") {\n                register(value)\n                return cont(classNameAfter)\n            }\n        }\n        function classNameAfter(type, value) {\n            if (value == \"extends\") return cont(expression, classNameAfter)\n            if (type == \"{\") return cont(pushlex(\"}\"), classBody, poplex)\n        }\n        function classBody(type, value) {\n            if (type == \"variable\" || cx.style == \"keyword\") {\n                if (value == \"static\") {\n                    cx.marked = \"keyword\"\n                    return cont(classBody)\n                }\n                cx.marked = \"property\"\n                if (value == \"get\" || value == \"set\")\n                    return cont(classGetterSetter, functiondef, classBody)\n                return cont(functiondef, classBody)\n            }\n            if (value == \"*\") {\n                cx.marked = \"keyword\"\n                return cont(classBody)\n            }\n            if (type == \";\") return cont(classBody)\n            if (type == \"}\") return cont()\n        }\n        function classGetterSetter(type) {\n            if (type != \"variable\") return pass()\n            cx.marked = \"property\"\n            return cont()\n        }\n        function afterModule(type, value) {\n            if (type == \"string\") return cont(statement)\n            if (type == \"variable\") {\n                register(value)\n                return cont(maybeFrom)\n            }\n        }\n        function afterExport(_type, value) {\n            if (value == \"*\") {\n                cx.marked = \"keyword\"\n                return cont(maybeFrom, expect(\";\"))\n            }\n            if (value == \"default\") {\n                cx.marked = \"keyword\"\n                return cont(expression, expect(\";\"))\n            }\n            return pass(statement)\n        }\n        function afterImport(type) {\n            if (type == \"string\") return cont()\n            return pass(importSpec, maybeFrom)\n        }\n        function importSpec(type, value) {\n            if (type == \"{\") return contCommasep(importSpec, \"}\")\n            if (type == \"variable\") register(value)\n            if (value == \"*\") cx.marked = \"keyword\"\n            return cont(maybeAs)\n        }\n        function maybeAs(_type, value) {\n            if (value == \"as\") {\n                cx.marked = \"keyword\"\n                return cont(importSpec)\n            }\n        }\n        function maybeFrom(_type, value) {\n            if (value == \"from\") {\n                cx.marked = \"keyword\"\n                return cont(expression)\n            }\n        }\n        function arrayLiteral(type) {\n            if (type == \"]\") return cont()\n            return pass(expressionNoComma, maybeArrayComprehension)\n        }\n        function maybeArrayComprehension(type) {\n            if (type == \"for\") return pass(comprehension, expect(\"]\"))\n            if (type == \",\") return cont(commasep(maybeexpressionNoComma, \"]\"))\n            return pass(commasep(expressionNoComma, \"]\"))\n        }\n        function comprehension(type) {\n            if (type == \"for\") return cont(forspec, comprehension)\n            if (type == \"if\") return cont(expression, comprehension)\n        }\n\n        function isContinuedStatement(state, textAfter) {\n            return (\n                state.lastType == \"operator\" ||\n                state.lastType == \",\" ||\n                isOperatorChar.test(textAfter.charAt(0)) ||\n                /[,.]/.test(textAfter.charAt(0))\n            )\n        }\n\n        // Interface\n\n        return {\n            startState: function(basecolumn) {\n                var state = {\n                    tokenize: tokenBase,\n                    lastType: \"sof\",\n                    cc: [],\n                    lexical: new JSLexical((basecolumn || 0) - indentUnit, 0, \"block\", false),\n                    localVars: parserConfig.localVars,\n                    context: parserConfig.localVars && { vars: parserConfig.localVars },\n                    indented: 0\n                }\n                if (parserConfig.globalVars && typeof parserConfig.globalVars == \"object\")\n                    state.globalVars = parserConfig.globalVars\n                return state\n            },\n\n            token: function(stream, state) {\n                if (stream.sol()) {\n                    if (!state.lexical.hasOwnProperty(\"align\")) state.lexical.align = false\n                    state.indented = stream.indentation()\n                    findFatArrow(stream, state)\n                }\n                if (state.tokenize != tokenComment && stream.eatSpace()) return null\n                var style = state.tokenize(stream, state)\n                if (type == \"comment\") return style\n                state.lastType =\n                    type == \"operator\" && (content == \"++\" || content == \"--\") ? \"incdec\" : type\n                return parseJS(state, style, type, content, stream)\n            },\n\n            indent: function(state, textAfter) {\n                if (state.tokenize == tokenComment) return CodeMirror.Pass\n                if (state.tokenize != tokenBase) return 0\n                var firstChar = textAfter && textAfter.charAt(0),\n                    lexical = state.lexical\n                // Kludge to prevent 'maybelse' from blocking lexical scope pops\n                if (!/^\\s*else\\b/.test(textAfter))\n                    for (var i = state.cc.length - 1; i >= 0; --i) {\n                        var c = state.cc[i]\n                        if (c == poplex) lexical = lexical.prev\n                        else if (c != maybeelse) break\n                    }\n                if (lexical.type == \"stat\" && firstChar == \"}\") lexical = lexical.prev\n                if (statementIndent && lexical.type == \")\" && lexical.prev.type == \"stat\")\n                    lexical = lexical.prev\n                var type = lexical.type,\n                    closing = firstChar == type\n\n                if (type == \"vardef\")\n                    return (\n                        lexical.indented +\n                        (state.lastType == \"operator\" || state.lastType == \",\"\n                            ? lexical.info + 1\n                            : 0)\n                    )\n                else if (type == \"form\" && firstChar == \"{\") return lexical.indented\n                else if (type == \"form\") return lexical.indented + indentUnit\n                else if (type == \"stat\")\n                    return (\n                        lexical.indented +\n                        (isContinuedStatement(state, textAfter) ? statementIndent || indentUnit : 0)\n                    )\n                else if (\n                    lexical.info == \"switch\" &&\n                    !closing &&\n                    parserConfig.doubleIndentSwitch != false\n                )\n                    return (\n                        lexical.indented +\n                        (/^(?:case|default)\\b/.test(textAfter) ? indentUnit : 2 * indentUnit)\n                    )\n                else if (lexical.align) return lexical.column + (closing ? 0 : 1)\n                else return lexical.indented + (closing ? 0 : indentUnit)\n            },\n\n            electricInput: /^\\s*(?:case .*?:|default:|\\{|\\})$/,\n            blockCommentStart: jsonMode ? null : \"/*\",\n            blockCommentEnd: jsonMode ? null : \"*/\",\n            lineComment: jsonMode ? null : \"//\",\n            fold: \"brace\",\n            closeBrackets: \"()[]{}''\\\"\\\"``\",\n\n            helperType: jsonMode ? \"json\" : \"javascript\",\n            jsonldMode: jsonldMode,\n            jsonMode: jsonMode\n        }\n    })\n\n    CodeMirror.registerHelper(\"wordChars\", \"javascript\", /[\\w$]/)\n\n    CodeMirror.defineMIME(\"text/javascript\", \"javascript\")\n    CodeMirror.defineMIME(\"text/ecmascript\", \"javascript\")\n    CodeMirror.defineMIME(\"application/javascript\", \"javascript\")\n    CodeMirror.defineMIME(\"application/x-javascript\", \"javascript\")\n    CodeMirror.defineMIME(\"application/ecmascript\", \"javascript\")\n    CodeMirror.defineMIME(\"application/json\", { name: \"javascript\", json: true })\n    CodeMirror.defineMIME(\"application/x-json\", { name: \"javascript\", json: true })\n    CodeMirror.defineMIME(\"application/ld+json\", { name: \"javascript\", jsonld: true })\n    CodeMirror.defineMIME(\"text/typescript\", { name: \"javascript\", typescript: true })\n    CodeMirror.defineMIME(\"application/typescript\", { name: \"javascript\", typescript: true })\n})\n"
  },
  {
    "path": "docs/assets/getting-started-assets/javascripts/codemirror/javascript/json-ld.html",
    "content": "<!doctype html>\n\n<title>CodeMirror: JSON-LD mode</title>\n<meta charset=\"utf-8\"/>\n<link rel=stylesheet href=\"../../doc/docs.css\">\n\n<link rel=\"stylesheet\" href=\"../../lib/codemirror.css\">\n<script src=\"../../lib/codemirror.js\"></script>\n<script src=\"../../addon/edit/matchbrackets.js\"></script>\n<script src=\"../../addon/comment/continuecomment.js\"></script>\n<script src=\"../../addon/comment/comment.js\"></script>\n<script src=\"javascript.js\"></script>\n<style type=\"text/css\">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>\n<div id=\"nav\">\n  <a href=\"http://codemirror.net\"><h1>CodeMirror</h1><img id=logo src=\"../../doc/logo.png\"/></a>\n\n  <ul>\n    <li><a href=\"../../index.html\">Home</a>\n    <li><a href=\"../../doc/manual.html\">Manual</a>\n    <li><a href=\"https://github.com/codemirror/codemirror\">Code</a>\n  </ul>\n  <ul>\n    <li><a href=\"../index.html\">Language modes</a>\n    <li><a class=active href=\"#\">JSON-LD</a>\n  </ul>\n</div>\n\n<article>\n<h2>JSON-LD mode</h2>\n\n\n<div><textarea id=\"code\" name=\"code\">\n{\n  \"@context\": {\n    \"name\": \"http://schema.org/name\",\n    \"description\": \"http://schema.org/description\",\n    \"image\": {\n      \"@id\": \"http://schema.org/image\",\n      \"@type\": \"@id\"\n    },\n    \"geo\": \"http://schema.org/geo\",\n    \"latitude\": {\n      \"@id\": \"http://schema.org/latitude\",\n      \"@type\": \"xsd:float\"\n    },\n    \"longitude\": {\n      \"@id\": \"http://schema.org/longitude\",\n      \"@type\": \"xsd:float\"\n    },\n    \"xsd\": \"http://www.w3.org/2001/XMLSchema#\"\n  },\n  \"name\": \"The Empire State Building\",\n  \"description\": \"The Empire State Building is a 102-story landmark in New York City.\",\n  \"image\": \"http://www.civil.usherbrooke.ca/cours/gci215a/empire-state-building.jpg\",\n  \"geo\": {\n    \"latitude\": \"40.75\",\n    \"longitude\": \"73.98\"\n  }\n}\n</textarea></div>\n\n    <script>\n      var editor = CodeMirror.fromTextArea(document.getElementById(\"code\"), {\n        matchBrackets: true,\n        autoCloseBrackets: true,\n        mode: \"application/ld+json\",\n        lineWrapping: true\n      });\n    </script>\n    \n    <p>This is a specialization of the <a href=\"index.html\">JavaScript mode</a>.</p>\n  </article>\n"
  },
  {
    "path": "docs/assets/getting-started-assets/javascripts/codemirror/javascript/test.js",
    "content": "// CodeMirror, copyright (c) by Marijn Haverbeke and others\n// Distributed under an MIT license: http://codemirror.net/LICENSE\n\n;(function() {\n    var mode = CodeMirror.getMode({ indentUnit: 2 }, \"javascript\")\n    function MT(name) {\n        test.mode(name, mode, Array.prototype.slice.call(arguments, 1))\n    }\n\n    MT(\n        \"locals\",\n        \"[keyword function] [variable foo]([def a], [def b]) { [keyword var] [def c] [operator =] [number 10]; [keyword return] [variable-2 a] [operator +] [variable-2 c] [operator +] [variable d]; }\"\n    )\n\n    MT(\n        \"comma-and-binop\",\n        \"[keyword function](){ [keyword var] [def x] [operator =] [number 1] [operator +] [number 2], [def y]; }\"\n    )\n\n    MT(\n        \"destructuring\",\n        \"([keyword function]([def a], [[[def b], [def c] ]]) {\",\n        \"  [keyword let] {[def d], [property foo]: [def c][operator =][number 10], [def x]} [operator =] [variable foo]([variable-2 a]);\",\n        \"  [[[variable-2 c], [variable y] ]] [operator =] [variable-2 c];\",\n        \"})();\"\n    )\n\n    MT(\n        \"class_body\",\n        \"[keyword class] [variable Foo] {\",\n        \"  [property constructor]() {}\",\n        \"  [property sayName]() {\",\n        \"    [keyword return] [string-2 `foo${][variable foo][string-2 }oo`];\",\n        \"  }\",\n        \"}\"\n    )\n\n    MT(\n        \"class\",\n        \"[keyword class] [variable Point] [keyword extends] [variable SuperThing] {\",\n        \"  [property get] [property prop]() { [keyword return] [number 24]; }\",\n        \"  [property constructor]([def x], [def y]) {\",\n        \"    [keyword super]([string 'something']);\",\n        \"    [keyword this].[property x] [operator =] [variable-2 x];\",\n        \"  }\",\n        \"}\"\n    )\n\n    MT(\n        \"module\",\n        \"[keyword module] [string 'foo'] {\",\n        \"  [keyword export] [keyword let] [def x] [operator =] [number 42];\",\n        \"  [keyword export] [keyword *] [keyword from] [string 'somewhere'];\",\n        \"}\"\n    )\n\n    MT(\n        \"import\",\n        \"[keyword function] [variable foo]() {\",\n        \"  [keyword import] [def $] [keyword from] [string 'jquery'];\",\n        \"  [keyword module] [def crypto] [keyword from] [string 'crypto'];\",\n        \"  [keyword import] { [def encrypt], [def decrypt] } [keyword from] [string 'crypto'];\",\n        \"}\"\n    )\n\n    MT(\n        \"const\",\n        \"[keyword function] [variable f]() {\",\n        \"  [keyword const] [[ [def a], [def b] ]] [operator =] [[ [number 1], [number 2] ]];\",\n        \"}\"\n    )\n\n    MT(\"for/of\", \"[keyword for]([keyword let] [variable of] [keyword of] [variable something]) {}\")\n\n    MT(\n        \"generator\",\n        \"[keyword function*] [variable repeat]([def n]) {\",\n        \"  [keyword for]([keyword var] [def i] [operator =] [number 0]; [variable-2 i] [operator <] [variable-2 n]; [operator ++][variable-2 i])\",\n        \"    [keyword yield] [variable-2 i];\",\n        \"}\"\n    )\n\n    MT(\n        \"quotedStringAddition\",\n        \"[keyword let] [variable f] [operator =] [variable a] [operator +] [string 'fatarrow'] [operator +] [variable c];\"\n    )\n\n    MT(\n        \"quotedFatArrow\",\n        \"[keyword let] [variable f] [operator =] [variable a] [operator +] [string '=>'] [operator +] [variable c];\"\n    )\n\n    MT(\n        \"fatArrow\",\n        \"[variable array].[property filter]([def a] [operator =>] [variable-2 a] [operator +] [number 1]);\",\n        \"[variable a];\", // No longer in scope\n        \"[keyword let] [variable f] [operator =] ([[ [def a], [def b] ]], [def c]) [operator =>] [variable-2 a] [operator +] [variable-2 c];\",\n        \"[variable c];\"\n    )\n\n    MT(\n        \"spread\",\n        \"[keyword function] [variable f]([def a], [meta ...][def b]) {\",\n        \"  [variable something]([variable-2 a], [meta ...][variable-2 b]);\",\n        \"}\"\n    )\n\n    MT(\n        \"comprehension\",\n        \"[keyword function] [variable f]() {\",\n        \"  [[([variable x] [operator +] [number 1]) [keyword for] ([keyword var] [def x] [keyword in] [variable y]) [keyword if] [variable pred]([variable-2 x]) ]];\",\n        \"  ([variable u] [keyword for] ([keyword var] [def u] [keyword of] [variable generateValues]()) [keyword if] ([variable-2 u].[property color] [operator ===] [string 'blue']));\",\n        \"}\"\n    )\n\n    MT(\n        \"quasi\",\n        \"[variable re][string-2 `fofdlakj${][variable x] [operator +] ([variable re][string-2 `foo`]) [operator +] [number 1][string-2 }fdsa`] [operator +] [number 2]\"\n    )\n\n    MT(\n        \"quasi_no_function\",\n        \"[variable x] [operator =] [string-2 `fofdlakj${][variable x] [operator +] [string-2 `foo`] [operator +] [number 1][string-2 }fdsa`] [operator +] [number 2]\"\n    )\n\n    MT(\n        \"indent_statement\",\n        \"[keyword var] [variable x] [operator =] [number 10]\",\n        \"[variable x] [operator +=] [variable y] [operator +]\",\n        \"  [atom Infinity]\",\n        \"[keyword debugger];\"\n    )\n\n    MT(\n        \"indent_if\",\n        \"[keyword if] ([number 1])\",\n        \"  [keyword break];\",\n        \"[keyword else] [keyword if] ([number 2])\",\n        \"  [keyword continue];\",\n        \"[keyword else]\",\n        \"  [number 10];\",\n        \"[keyword if] ([number 1]) {\",\n        \"  [keyword break];\",\n        \"} [keyword else] [keyword if] ([number 2]) {\",\n        \"  [keyword continue];\",\n        \"} [keyword else] {\",\n        \"  [number 10];\",\n        \"}\"\n    )\n\n    MT(\n        \"indent_for\",\n        \"[keyword for] ([keyword var] [variable i] [operator =] [number 0];\",\n        \"     [variable i] [operator <] [number 100];\",\n        \"     [variable i][operator ++])\",\n        \"  [variable doSomething]([variable i]);\",\n        \"[keyword debugger];\"\n    )\n\n    MT(\"indent_c_style\", \"[keyword function] [variable foo]()\", \"{\", \"  [keyword debugger];\", \"}\")\n\n    MT(\n        \"indent_else\",\n        \"[keyword for] (;;)\",\n        \"  [keyword if] ([variable foo])\",\n        \"    [keyword if] ([variable bar])\",\n        \"      [number 1];\",\n        \"    [keyword else]\",\n        \"      [number 2];\",\n        \"  [keyword else]\",\n        \"    [number 3];\"\n    )\n\n    MT(\n        \"indent_funarg\",\n        \"[variable foo]([number 10000],\",\n        \"    [keyword function]([def a]) {\",\n        \"  [keyword debugger];\",\n        \"};\"\n    )\n\n    MT(\n        \"indent_below_if\",\n        \"[keyword for] (;;)\",\n        \"  [keyword if] ([variable foo])\",\n        \"    [number 1];\",\n        \"[number 2];\"\n    )\n\n    MT(\n        \"multilinestring\",\n        \"[keyword var] [variable x] [operator =] [string 'foo\\\\]\",\n        \"[string bar'];\"\n    )\n\n    MT(\"scary_regexp\", \"[string-2 /foo[[/]]bar/];\")\n\n    MT(\n        \"indent_strange_array\",\n        \"[keyword var] [variable x] [operator =] [[\",\n        \"  [number 1],,\",\n        \"  [number 2],\",\n        \"]];\",\n        \"[number 10];\"\n    )\n\n    MT(\n        \"param_default\",\n        \"[keyword function] [variable foo]([def x] [operator =] [string-2 `foo${][number 10][string-2 }bar`]) {\",\n        \"  [keyword return] [variable-2 x];\",\n        \"}\"\n    )\n\n    var jsonld_mode = CodeMirror.getMode({ indentUnit: 2 }, { name: \"javascript\", jsonld: true })\n    function LD(name) {\n        test.mode(name, jsonld_mode, Array.prototype.slice.call(arguments, 1))\n    }\n\n    LD(\n        \"json_ld_keywords\",\n        \"{\",\n        '  [meta \"@context\"]: {',\n        '    [meta \"@base\"]: [string \"http://example.com\"],',\n        '    [meta \"@vocab\"]: [string \"http://xmlns.com/foaf/0.1/\"],',\n        '    [property \"likesFlavor\"]: {',\n        '      [meta \"@container\"]: [meta \"@list\"]',\n        '      [meta \"@reverse\"]: [string \"@beFavoriteOf\"]',\n        \"    },\",\n        '    [property \"nick\"]: { [meta \"@container\"]: [meta \"@set\"] },',\n        '    [property \"nick\"]: { [meta \"@container\"]: [meta \"@index\"] }',\n        \"  },\",\n        '  [meta \"@graph\"]: [[ {',\n        '    [meta \"@id\"]: [string \"http://dbpedia.org/resource/John_Lennon\"],',\n        '    [property \"name\"]: [string \"John Lennon\"],',\n        '    [property \"modified\"]: {',\n        '      [meta \"@value\"]: [string \"2010-05-29T14:17:39+02:00\"],',\n        '      [meta \"@type\"]: [string \"http://www.w3.org/2001/XMLSchema#dateTime\"]',\n        \"    }\",\n        \"  } ]]\",\n        \"}\"\n    )\n\n    LD(\n        \"json_ld_fake\",\n        \"{\",\n        '  [property \"@fake\"]: [string \"@fake\"],',\n        '  [property \"@contextual\"]: [string \"@identifier\"],',\n        '  [property \"user@domain.com\"]: [string \"@graphical\"],',\n        '  [property \"@ID\"]: [string \"@@ID\"]',\n        \"}\"\n    )\n})()\n"
  },
  {
    "path": "docs/assets/getting-started-assets/javascripts/codemirror/javascript/typescript.html",
    "content": "<!doctype html>\n\n<title>CodeMirror: TypeScript mode</title>\n<meta charset=\"utf-8\"/>\n<link rel=stylesheet href=\"../../doc/docs.css\">\n\n<link rel=\"stylesheet\" href=\"../../lib/codemirror.css\">\n<script src=\"../../lib/codemirror.js\"></script>\n<script src=\"javascript.js\"></script>\n<style type=\"text/css\">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>\n<div id=nav>\n  <a href=\"http://codemirror.net\"><h1>CodeMirror</h1><img id=logo src=\"../../doc/logo.png\"></a>\n\n  <ul>\n    <li><a href=\"../../index.html\">Home</a>\n    <li><a href=\"../../doc/manual.html\">Manual</a>\n    <li><a href=\"https://github.com/codemirror/codemirror\">Code</a>\n  </ul>\n  <ul>\n    <li><a href=\"../index.html\">Language modes</a>\n    <li><a class=active href=\"#\">TypeScript</a>\n  </ul>\n</div>\n\n<article>\n<h2>TypeScript mode</h2>\n\n\n<div><textarea id=\"code\" name=\"code\">\nclass Greeter {\n\tgreeting: string;\n\tconstructor (message: string) {\n\t\tthis.greeting = message;\n\t}\n\tgreet() {\n\t\treturn \"Hello, \" + this.greeting;\n\t}\n}   \n\nvar greeter = new Greeter(\"world\");\n\nvar button = document.createElement('button')\nbutton.innerText = \"Say Hello\"\nbutton.onclick = function() {\n\talert(greeter.greet())\n}\n\ndocument.body.appendChild(button)\n\n</textarea></div>\n\n    <script>\n      var editor = CodeMirror.fromTextArea(document.getElementById(\"code\"), {\n        lineNumbers: true,\n        matchBrackets: true,\n        mode: \"text/typescript\"\n      });\n    </script>\n\n    <p>This is a specialization of the <a href=\"index.html\">JavaScript mode</a>.</p>\n  </article>\n"
  },
  {
    "path": "docs/assets/getting-started-assets/javascripts/codemirror/lib/codemirror.css",
    "content": "/* BASICS */\n\n.CodeMirror {\n    /* Set height, width, borders, and global font properties here */\n    font-family: monospace;\n    height: 300px;\n    color: black;\n    direction: ltr;\n  }\n  \n  /* PADDING */\n  \n  .CodeMirror-lines {\n    padding: 4px 0; /* Vertical padding around content */\n  }\n  .CodeMirror pre.CodeMirror-line,\n  .CodeMirror pre.CodeMirror-line-like {\n    padding: 0 4px; /* Horizontal padding of content */\n  }\n  \n  .CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {\n    background-color: white; /* The little square between H and V scrollbars */\n  }\n  \n  /* GUTTER */\n  \n  .CodeMirror-gutters {\n    border-right: 1px solid #ddd;\n    background-color: #f7f7f7;\n    white-space: nowrap;\n  }\n  .CodeMirror-linenumbers {}\n  .CodeMirror-linenumber {\n    padding: 0 3px 0 5px;\n    min-width: 20px;\n    text-align: right;\n    color: #999;\n    white-space: nowrap;\n  }\n  \n  .CodeMirror-guttermarker { color: black; }\n  .CodeMirror-guttermarker-subtle { color: #999; }\n  \n  /* CURSOR */\n  \n  .CodeMirror-cursor {\n    border-left: 1px solid black;\n    border-right: none;\n    width: 0;\n  }\n  /* Shown when moving in bi-directional text */\n  .CodeMirror div.CodeMirror-secondarycursor {\n    border-left: 1px solid silver;\n  }\n  .cm-fat-cursor .CodeMirror-cursor {\n    width: auto;\n    border: 0 !important;\n    background: #7e7;\n  }\n  .cm-fat-cursor div.CodeMirror-cursors {\n    z-index: 1;\n  }\n  .cm-fat-cursor-mark {\n    background-color: rgba(20, 255, 20, 0.5);\n    -webkit-animation: blink 1.06s steps(1) infinite;\n    -moz-animation: blink 1.06s steps(1) infinite;\n    animation: blink 1.06s steps(1) infinite;\n  }\n  .cm-animate-fat-cursor {\n    width: auto;\n    border: 0;\n    -webkit-animation: blink 1.06s steps(1) infinite;\n    -moz-animation: blink 1.06s steps(1) infinite;\n    animation: blink 1.06s steps(1) infinite;\n    background-color: #7e7;\n  }\n  @-moz-keyframes blink {\n    0% {}\n    50% { background-color: transparent; }\n    100% {}\n  }\n  @-webkit-keyframes blink {\n    0% {}\n    50% { background-color: transparent; }\n    100% {}\n  }\n  @keyframes blink {\n    0% {}\n    50% { background-color: transparent; }\n    100% {}\n  }\n  \n  /* Can style cursor different in overwrite (non-insert) mode */\n  .CodeMirror-overwrite .CodeMirror-cursor {}\n  \n  .cm-tab { display: inline-block; text-decoration: inherit; }\n  \n  .CodeMirror-rulers {\n    position: absolute;\n    left: 0; right: 0; top: -50px; bottom: 0;\n    overflow: hidden;\n  }\n  .CodeMirror-ruler {\n    border-left: 1px solid #ccc;\n    top: 0; bottom: 0;\n    position: absolute;\n  }\n  \n  /* DEFAULT THEME */\n  \n  .cm-s-default .cm-header {color: blue;}\n  .cm-s-default .cm-quote {color: #090;}\n  .cm-negative {color: #d44;}\n  .cm-positive {color: #292;}\n  .cm-header, .cm-strong {font-weight: bold;}\n  .cm-em {font-style: italic;}\n  .cm-link {text-decoration: underline;}\n  .cm-strikethrough {text-decoration: line-through;}\n  \n  .cm-s-default .cm-keyword {color: #708;}\n  .cm-s-default .cm-atom {color: #219;}\n  .cm-s-default .cm-number {color: #164;}\n  .cm-s-default .cm-def {color: #00f;}\n  .cm-s-default .cm-variable,\n  .cm-s-default .cm-punctuation,\n  .cm-s-default .cm-property,\n  .cm-s-default .cm-operator {}\n  .cm-s-default .cm-variable-2 {color: #05a;}\n  .cm-s-default .cm-variable-3, .cm-s-default .cm-type {color: #085;}\n  .cm-s-default .cm-comment {color: #a50;}\n  .cm-s-default .cm-string {color: #a11;}\n  .cm-s-default .cm-string-2 {color: #f50;}\n  .cm-s-default .cm-meta {color: #555;}\n  .cm-s-default .cm-qualifier {color: #555;}\n  .cm-s-default .cm-builtin {color: #30a;}\n  .cm-s-default .cm-bracket {color: #997;}\n  .cm-s-default .cm-tag {color: #170;}\n  .cm-s-default .cm-attribute {color: #00c;}\n  .cm-s-default .cm-hr {color: #999;}\n  .cm-s-default .cm-link {color: #00c;}\n  \n  .cm-s-default .cm-error {color: #f00;}\n  .cm-invalidchar {color: #f00;}\n  \n  .CodeMirror-composing { border-bottom: 2px solid; }\n  \n  /* Default styles for common addons */\n  \n  div.CodeMirror span.CodeMirror-matchingbracket {color: #0b0;}\n  div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #a22;}\n  .CodeMirror-matchingtag { background: rgba(255, 150, 0, .3); }\n  .CodeMirror-activeline-background {background: #e8f2ff;}\n  \n  /* STOP */\n  \n  /* The rest of this file contains styles related to the mechanics of\n     the editor. You probably shouldn't touch them. */\n  \n  .CodeMirror {\n    position: relative;\n    overflow: hidden;\n    background: white;\n  }\n  \n  .CodeMirror-scroll {\n    overflow: scroll !important; /* Things will break if this is overridden */\n    /* 30px is the magic margin used to hide the element's real scrollbars */\n    /* See overflow: hidden in .CodeMirror */\n    margin-bottom: -30px; margin-right: -30px;\n    padding-bottom: 30px;\n    height: 100%;\n    outline: none; /* Prevent dragging from highlighting the element */\n    position: relative;\n  }\n  .CodeMirror-sizer {\n    position: relative;\n    border-right: 30px solid transparent;\n  }\n  \n  /* The fake, visible scrollbars. Used to force redraw during scrolling\n     before actual scrolling happens, thus preventing shaking and\n     flickering artifacts. */\n  .CodeMirror-vscrollbar, .CodeMirror-hscrollbar, .CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {\n    position: absolute;\n    z-index: 6;\n    display: none;\n  }\n  .CodeMirror-vscrollbar {\n    right: 0; top: 0;\n    overflow-x: hidden;\n    overflow-y: scroll;\n  }\n  .CodeMirror-hscrollbar {\n    bottom: 0; left: 0;\n    overflow-y: hidden;\n    overflow-x: scroll;\n  }\n  .CodeMirror-scrollbar-filler {\n    right: 0; bottom: 0;\n  }\n  .CodeMirror-gutter-filler {\n    left: 0; bottom: 0;\n  }\n  \n  .CodeMirror-gutters {\n    position: absolute; left: 0; top: 0;\n    min-height: 100%;\n    z-index: 3;\n  }\n  .CodeMirror-gutter {\n    white-space: normal;\n    height: 100%;\n    display: inline-block;\n    vertical-align: top;\n    margin-bottom: -30px;\n  }\n  .CodeMirror-gutter-wrapper {\n    position: absolute;\n    z-index: 4;\n    background: none !important;\n    border: none !important;\n  }\n  .CodeMirror-gutter-background {\n    position: absolute;\n    top: 0; bottom: 0;\n    z-index: 4;\n  }\n  .CodeMirror-gutter-elt {\n    position: absolute;\n    cursor: default;\n    z-index: 4;\n  }\n  .CodeMirror-gutter-wrapper ::selection { background-color: transparent }\n  .CodeMirror-gutter-wrapper ::-moz-selection { background-color: transparent }\n  \n  .CodeMirror-lines {\n    cursor: text;\n    min-height: 1px; /* prevents collapsing before first draw */\n  }\n  .CodeMirror pre.CodeMirror-line,\n  .CodeMirror pre.CodeMirror-line-like {\n    /* Reset some styles that the rest of the page might have set */\n    -moz-border-radius: 0; -webkit-border-radius: 0; border-radius: 0;\n    border-width: 0;\n    background: transparent;\n    font-family: inherit;\n    font-size: inherit;\n    margin: 0;\n    white-space: pre;\n    word-wrap: normal;\n    line-height: inherit;\n    color: inherit;\n    z-index: 2;\n    position: relative;\n    overflow: visible;\n    -webkit-tap-highlight-color: transparent;\n    -webkit-font-variant-ligatures: contextual;\n    font-variant-ligatures: contextual;\n  }\n  .CodeMirror-wrap pre.CodeMirror-line,\n  .CodeMirror-wrap pre.CodeMirror-line-like {\n    word-wrap: break-word;\n    white-space: pre-wrap;\n    word-break: normal;\n  }\n  \n  .CodeMirror-linebackground {\n    position: absolute;\n    left: 0; right: 0; top: 0; bottom: 0;\n    z-index: 0;\n  }\n  \n  .CodeMirror-linewidget {\n    position: relative;\n    z-index: 2;\n    padding: 0.1px; /* Force widget margins to stay inside of the container */\n  }\n  \n  .CodeMirror-widget {}\n  \n  .CodeMirror-rtl pre { direction: rtl; }\n  \n  .CodeMirror-code {\n    outline: none;\n  }\n  \n  /* Force content-box sizing for the elements where we expect it */\n  .CodeMirror-scroll,\n  .CodeMirror-sizer,\n  .CodeMirror-gutter,\n  .CodeMirror-gutters,\n  .CodeMirror-linenumber {\n    -moz-box-sizing: content-box;\n    box-sizing: content-box;\n  }\n  \n  .CodeMirror-measure {\n    position: absolute;\n    width: 100%;\n    height: 0;\n    overflow: hidden;\n    visibility: hidden;\n  }\n  \n  .CodeMirror-cursor {\n    position: absolute;\n    pointer-events: none;\n  }\n  .CodeMirror-measure pre { position: static; }\n  \n  div.CodeMirror-cursors {\n    visibility: hidden;\n    position: relative;\n    z-index: 3;\n  }\n  div.CodeMirror-dragcursors {\n    visibility: visible;\n  }\n  \n  .CodeMirror-focused div.CodeMirror-cursors {\n    visibility: visible;\n  }\n  \n  .CodeMirror-selected { background: #d9d9d9; }\n  .CodeMirror-focused .CodeMirror-selected { background: #d7d4f0; }\n  .CodeMirror-crosshair { cursor: crosshair; }\n  .CodeMirror-line::selection, .CodeMirror-line > span::selection, .CodeMirror-line > span > span::selection { background: #d7d4f0; }\n  .CodeMirror-line::-moz-selection, .CodeMirror-line > span::-moz-selection, .CodeMirror-line > span > span::-moz-selection { background: #d7d4f0; }\n  \n  .cm-searching {\n    background-color: #ffa;\n    background-color: rgba(255, 255, 0, .4);\n  }\n  \n  /* Used to force a border model for a node */\n  .cm-force-border { padding-right: .1px; }\n  \n  @media print {\n    /* Hide the cursor when printing */\n    .CodeMirror div.CodeMirror-cursors {\n      visibility: hidden;\n    }\n  }\n  \n  /* See issue #2901 */\n  .cm-tab-wrap-hack:after { content: ''; }\n  \n  /* Help users use markselection to safely style text background */\n  span.CodeMirror-selectedtext { background: none; }\n  "
  },
  {
    "path": "docs/assets/getting-started-assets/javascripts/codemirror/lib/codemirror.js",
    "content": "// CodeMirror, copyright (c) by Marijn Haverbeke and others\n// Distributed under an MIT license: https://codemirror.net/LICENSE\n\n// This is CodeMirror (https://codemirror.net), a code editor\n// implemented in JavaScript on top of the browser's DOM.\n//\n// You can find some technical background for some of the code below\n// at http://marijnhaverbeke.nl/blog/#cm-internals .\n\n;(function(global, factory) {\n    typeof exports === \"object\" && typeof module !== \"undefined\"\n        ? (module.exports = factory())\n        : typeof define === \"function\" && define.amd\n        ? define(factory)\n        : ((global = global || self), (global.CodeMirror = factory()))\n})(this, function() {\n    \"use strict\"\n\n    // Kludges for bugs and behavior differences that can't be feature\n    // detected are enabled based on userAgent etc sniffing.\n    var userAgent = navigator.userAgent\n    var platform = navigator.platform\n\n    var gecko = /gecko\\/\\d/i.test(userAgent)\n    var ie_upto10 = /MSIE \\d/.test(userAgent)\n    var ie_11up = /Trident\\/(?:[7-9]|\\d{2,})\\..*rv:(\\d+)/.exec(userAgent)\n    var edge = /Edge\\/(\\d+)/.exec(userAgent)\n    var ie = ie_upto10 || ie_11up || edge\n    var ie_version = ie && (ie_upto10 ? document.documentMode || 6 : +(edge || ie_11up)[1])\n    var webkit = !edge && /WebKit\\//.test(userAgent)\n    var qtwebkit = webkit && /Qt\\/\\d+\\.\\d+/.test(userAgent)\n    var chrome = !edge && /Chrome\\//.test(userAgent)\n    var presto = /Opera\\//.test(userAgent)\n    var safari = /Apple Computer/.test(navigator.vendor)\n    var mac_geMountainLion = /Mac OS X 1\\d\\D([8-9]|\\d\\d)\\D/.test(userAgent)\n    var phantom = /PhantomJS/.test(userAgent)\n\n    var ios = !edge && /AppleWebKit/.test(userAgent) && /Mobile\\/\\w+/.test(userAgent)\n    var android = /Android/.test(userAgent)\n    // This is woefully incomplete. Suggestions for alternative methods welcome.\n    var mobile =\n        ios || android || /webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(userAgent)\n    var mac = ios || /Mac/.test(platform)\n    var chromeOS = /\\bCrOS\\b/.test(userAgent)\n    var windows = /win/i.test(platform)\n\n    var presto_version = presto && userAgent.match(/Version\\/(\\d*\\.\\d*)/)\n    if (presto_version) {\n        presto_version = Number(presto_version[1])\n    }\n    if (presto_version && presto_version >= 15) {\n        presto = false\n        webkit = true\n    }\n    // Some browsers use the wrong event properties to signal cmd/ctrl on OS X\n    var flipCtrlCmd =\n        mac && (qtwebkit || (presto && (presto_version == null || presto_version < 12.11)))\n    var captureRightClick = gecko || (ie && ie_version >= 9)\n\n    function classTest(cls) {\n        return new RegExp(\"(^|\\\\s)\" + cls + \"(?:$|\\\\s)\\\\s*\")\n    }\n\n    var rmClass = function(node, cls) {\n        var current = node.className\n        var match = classTest(cls).exec(current)\n        if (match) {\n            var after = current.slice(match.index + match[0].length)\n            node.className = current.slice(0, match.index) + (after ? match[1] + after : \"\")\n        }\n    }\n\n    function removeChildren(e) {\n        for (var count = e.childNodes.length; count > 0; --count) {\n            e.removeChild(e.firstChild)\n        }\n        return e\n    }\n\n    function removeChildrenAndAdd(parent, e) {\n        return removeChildren(parent).appendChild(e)\n    }\n\n    function elt(tag, content, className, style) {\n        var e = document.createElement(tag)\n        if (className) {\n            e.className = className\n        }\n        if (style) {\n            e.style.cssText = style\n        }\n        if (typeof content == \"string\") {\n            e.appendChild(document.createTextNode(content))\n        } else if (content) {\n            for (var i = 0; i < content.length; ++i) {\n                e.appendChild(content[i])\n            }\n        }\n        return e\n    }\n    // wrapper for elt, which removes the elt from the accessibility tree\n    function eltP(tag, content, className, style) {\n        var e = elt(tag, content, className, style)\n        e.setAttribute(\"role\", \"presentation\")\n        return e\n    }\n\n    var range\n    if (document.createRange) {\n        range = function(node, start, end, endNode) {\n            var r = document.createRange()\n            r.setEnd(endNode || node, end)\n            r.setStart(node, start)\n            return r\n        }\n    } else {\n        range = function(node, start, end) {\n            var r = document.body.createTextRange()\n            try {\n                r.moveToElementText(node.parentNode)\n            } catch (e) {\n                return r\n            }\n            r.collapse(true)\n            r.moveEnd(\"character\", end)\n            r.moveStart(\"character\", start)\n            return r\n        }\n    }\n\n    function contains(parent, child) {\n        if (child.nodeType == 3) {\n            // Android browser always returns false when child is a textnode\n            child = child.parentNode\n        }\n        if (parent.contains) {\n            return parent.contains(child)\n        }\n        do {\n            if (child.nodeType == 11) {\n                child = child.host\n            }\n            if (child == parent) {\n                return true\n            }\n        } while ((child = child.parentNode))\n    }\n\n    function activeElt() {\n        // IE and Edge may throw an \"Unspecified Error\" when accessing document.activeElement.\n        // IE < 10 will throw when accessed while the page is loading or in an iframe.\n        // IE > 9 and Edge will throw when accessed in an iframe if document.body is unavailable.\n        var activeElement\n        try {\n            activeElement = document.activeElement\n        } catch (e) {\n            activeElement = document.body || null\n        }\n        while (\n            activeElement &&\n            activeElement.shadowRoot &&\n            activeElement.shadowRoot.activeElement\n        ) {\n            activeElement = activeElement.shadowRoot.activeElement\n        }\n        return activeElement\n    }\n\n    function addClass(node, cls) {\n        var current = node.className\n        if (!classTest(cls).test(current)) {\n            node.className += (current ? \" \" : \"\") + cls\n        }\n    }\n    function joinClasses(a, b) {\n        var as = a.split(\" \")\n        for (var i = 0; i < as.length; i++) {\n            if (as[i] && !classTest(as[i]).test(b)) {\n                b += \" \" + as[i]\n            }\n        }\n        return b\n    }\n\n    var selectInput = function(node) {\n        node.select()\n    }\n    if (ios) {\n        // Mobile Safari apparently has a bug where select() is broken.\n        selectInput = function(node) {\n            node.selectionStart = 0\n            node.selectionEnd = node.value.length\n        }\n    } else if (ie) {\n        // Suppress mysterious IE10 errors\n        selectInput = function(node) {\n            try {\n                node.select()\n            } catch (_e) {}\n        }\n    }\n\n    function bind(f) {\n        var args = Array.prototype.slice.call(arguments, 1)\n        return function() {\n            return f.apply(null, args)\n        }\n    }\n\n    function copyObj(obj, target, overwrite) {\n        if (!target) {\n            target = {}\n        }\n        for (var prop in obj) {\n            if (obj.hasOwnProperty(prop) && (overwrite !== false || !target.hasOwnProperty(prop))) {\n                target[prop] = obj[prop]\n            }\n        }\n        return target\n    }\n\n    // Counts the column offset in a string, taking tabs into account.\n    // Used mostly to find indentation.\n    function countColumn(string, end, tabSize, startIndex, startValue) {\n        if (end == null) {\n            end = string.search(/[^\\s\\u00a0]/)\n            if (end == -1) {\n                end = string.length\n            }\n        }\n        for (var i = startIndex || 0, n = startValue || 0; ; ) {\n            var nextTab = string.indexOf(\"\\t\", i)\n            if (nextTab < 0 || nextTab >= end) {\n                return n + (end - i)\n            }\n            n += nextTab - i\n            n += tabSize - (n % tabSize)\n            i = nextTab + 1\n        }\n    }\n\n    var Delayed = function() {\n        this.id = null\n        this.f = null\n        this.time = 0\n        this.handler = bind(this.onTimeout, this)\n    }\n    Delayed.prototype.onTimeout = function(self) {\n        self.id = 0\n        if (self.time <= +new Date()) {\n            self.f()\n        } else {\n            setTimeout(self.handler, self.time - +new Date())\n        }\n    }\n    Delayed.prototype.set = function(ms, f) {\n        this.f = f\n        var time = +new Date() + ms\n        if (!this.id || time < this.time) {\n            clearTimeout(this.id)\n            this.id = setTimeout(this.handler, ms)\n            this.time = time\n        }\n    }\n\n    function indexOf(array, elt) {\n        for (var i = 0; i < array.length; ++i) {\n            if (array[i] == elt) {\n                return i\n            }\n        }\n        return -1\n    }\n\n    // Number of pixels added to scroller and sizer to hide scrollbar\n    var scrollerGap = 30\n\n    // Returned or thrown by various protocols to signal 'I'm not\n    // handling this'.\n    var Pass = {\n        toString: function() {\n            return \"CodeMirror.Pass\"\n        }\n    }\n\n    // Reused option objects for setSelection & friends\n    var sel_dontScroll = { scroll: false },\n        sel_mouse = { origin: \"*mouse\" },\n        sel_move = { origin: \"+move\" }\n\n    // The inverse of countColumn -- find the offset that corresponds to\n    // a particular column.\n    function findColumn(string, goal, tabSize) {\n        for (var pos = 0, col = 0; ; ) {\n            var nextTab = string.indexOf(\"\\t\", pos)\n            if (nextTab == -1) {\n                nextTab = string.length\n            }\n            var skipped = nextTab - pos\n            if (nextTab == string.length || col + skipped >= goal) {\n                return pos + Math.min(skipped, goal - col)\n            }\n            col += nextTab - pos\n            col += tabSize - (col % tabSize)\n            pos = nextTab + 1\n            if (col >= goal) {\n                return pos\n            }\n        }\n    }\n\n    var spaceStrs = [\"\"]\n    function spaceStr(n) {\n        while (spaceStrs.length <= n) {\n            spaceStrs.push(lst(spaceStrs) + \" \")\n        }\n        return spaceStrs[n]\n    }\n\n    function lst(arr) {\n        return arr[arr.length - 1]\n    }\n\n    function map(array, f) {\n        var out = []\n        for (var i = 0; i < array.length; i++) {\n            out[i] = f(array[i], i)\n        }\n        return out\n    }\n\n    function insertSorted(array, value, score) {\n        var pos = 0,\n            priority = score(value)\n        while (pos < array.length && score(array[pos]) <= priority) {\n            pos++\n        }\n        array.splice(pos, 0, value)\n    }\n\n    function nothing() {}\n\n    function createObj(base, props) {\n        var inst\n        if (Object.create) {\n            inst = Object.create(base)\n        } else {\n            nothing.prototype = base\n            inst = new nothing()\n        }\n        if (props) {\n            copyObj(props, inst)\n        }\n        return inst\n    }\n\n    var nonASCIISingleCaseWordChar = /[\\u00df\\u0587\\u0590-\\u05f4\\u0600-\\u06ff\\u3040-\\u309f\\u30a0-\\u30ff\\u3400-\\u4db5\\u4e00-\\u9fcc\\uac00-\\ud7af]/\n    function isWordCharBasic(ch) {\n        return (\n            /\\w/.test(ch) ||\n            (ch > \"\\x80\" &&\n                (ch.toUpperCase() != ch.toLowerCase() || nonASCIISingleCaseWordChar.test(ch)))\n        )\n    }\n    function isWordChar(ch, helper) {\n        if (!helper) {\n            return isWordCharBasic(ch)\n        }\n        if (helper.source.indexOf(\"\\\\w\") > -1 && isWordCharBasic(ch)) {\n            return true\n        }\n        return helper.test(ch)\n    }\n\n    function isEmpty(obj) {\n        for (var n in obj) {\n            if (obj.hasOwnProperty(n) && obj[n]) {\n                return false\n            }\n        }\n        return true\n    }\n\n    // Extending unicode characters. A series of a non-extending char +\n    // any number of extending chars is treated as a single unit as far\n    // as editing and measuring is concerned. This is not fully correct,\n    // since some scripts/fonts/browsers also treat other configurations\n    // of code points as a group.\n    var extendingChars = /[\\u0300-\\u036f\\u0483-\\u0489\\u0591-\\u05bd\\u05bf\\u05c1\\u05c2\\u05c4\\u05c5\\u05c7\\u0610-\\u061a\\u064b-\\u065e\\u0670\\u06d6-\\u06dc\\u06de-\\u06e4\\u06e7\\u06e8\\u06ea-\\u06ed\\u0711\\u0730-\\u074a\\u07a6-\\u07b0\\u07eb-\\u07f3\\u0816-\\u0819\\u081b-\\u0823\\u0825-\\u0827\\u0829-\\u082d\\u0900-\\u0902\\u093c\\u0941-\\u0948\\u094d\\u0951-\\u0955\\u0962\\u0963\\u0981\\u09bc\\u09be\\u09c1-\\u09c4\\u09cd\\u09d7\\u09e2\\u09e3\\u0a01\\u0a02\\u0a3c\\u0a41\\u0a42\\u0a47\\u0a48\\u0a4b-\\u0a4d\\u0a51\\u0a70\\u0a71\\u0a75\\u0a81\\u0a82\\u0abc\\u0ac1-\\u0ac5\\u0ac7\\u0ac8\\u0acd\\u0ae2\\u0ae3\\u0b01\\u0b3c\\u0b3e\\u0b3f\\u0b41-\\u0b44\\u0b4d\\u0b56\\u0b57\\u0b62\\u0b63\\u0b82\\u0bbe\\u0bc0\\u0bcd\\u0bd7\\u0c3e-\\u0c40\\u0c46-\\u0c48\\u0c4a-\\u0c4d\\u0c55\\u0c56\\u0c62\\u0c63\\u0cbc\\u0cbf\\u0cc2\\u0cc6\\u0ccc\\u0ccd\\u0cd5\\u0cd6\\u0ce2\\u0ce3\\u0d3e\\u0d41-\\u0d44\\u0d4d\\u0d57\\u0d62\\u0d63\\u0dca\\u0dcf\\u0dd2-\\u0dd4\\u0dd6\\u0ddf\\u0e31\\u0e34-\\u0e3a\\u0e47-\\u0e4e\\u0eb1\\u0eb4-\\u0eb9\\u0ebb\\u0ebc\\u0ec8-\\u0ecd\\u0f18\\u0f19\\u0f35\\u0f37\\u0f39\\u0f71-\\u0f7e\\u0f80-\\u0f84\\u0f86\\u0f87\\u0f90-\\u0f97\\u0f99-\\u0fbc\\u0fc6\\u102d-\\u1030\\u1032-\\u1037\\u1039\\u103a\\u103d\\u103e\\u1058\\u1059\\u105e-\\u1060\\u1071-\\u1074\\u1082\\u1085\\u1086\\u108d\\u109d\\u135f\\u1712-\\u1714\\u1732-\\u1734\\u1752\\u1753\\u1772\\u1773\\u17b7-\\u17bd\\u17c6\\u17c9-\\u17d3\\u17dd\\u180b-\\u180d\\u18a9\\u1920-\\u1922\\u1927\\u1928\\u1932\\u1939-\\u193b\\u1a17\\u1a18\\u1a56\\u1a58-\\u1a5e\\u1a60\\u1a62\\u1a65-\\u1a6c\\u1a73-\\u1a7c\\u1a7f\\u1b00-\\u1b03\\u1b34\\u1b36-\\u1b3a\\u1b3c\\u1b42\\u1b6b-\\u1b73\\u1b80\\u1b81\\u1ba2-\\u1ba5\\u1ba8\\u1ba9\\u1c2c-\\u1c33\\u1c36\\u1c37\\u1cd0-\\u1cd2\\u1cd4-\\u1ce0\\u1ce2-\\u1ce8\\u1ced\\u1dc0-\\u1de6\\u1dfd-\\u1dff\\u200c\\u200d\\u20d0-\\u20f0\\u2cef-\\u2cf1\\u2de0-\\u2dff\\u302a-\\u302f\\u3099\\u309a\\ua66f-\\ua672\\ua67c\\ua67d\\ua6f0\\ua6f1\\ua802\\ua806\\ua80b\\ua825\\ua826\\ua8c4\\ua8e0-\\ua8f1\\ua926-\\ua92d\\ua947-\\ua951\\ua980-\\ua982\\ua9b3\\ua9b6-\\ua9b9\\ua9bc\\uaa29-\\uaa2e\\uaa31\\uaa32\\uaa35\\uaa36\\uaa43\\uaa4c\\uaab0\\uaab2-\\uaab4\\uaab7\\uaab8\\uaabe\\uaabf\\uaac1\\uabe5\\uabe8\\uabed\\udc00-\\udfff\\ufb1e\\ufe00-\\ufe0f\\ufe20-\\ufe26\\uff9e\\uff9f]/\n    function isExtendingChar(ch) {\n        return ch.charCodeAt(0) >= 768 && extendingChars.test(ch)\n    }\n\n    // Returns a number from the range [`0`; `str.length`] unless `pos` is outside that range.\n    function skipExtendingChars(str, pos, dir) {\n        while ((dir < 0 ? pos > 0 : pos < str.length) && isExtendingChar(str.charAt(pos))) {\n            pos += dir\n        }\n        return pos\n    }\n\n    // Returns the value from the range [`from`; `to`] that satisfies\n    // `pred` and is closest to `from`. Assumes that at least `to`\n    // satisfies `pred`. Supports `from` being greater than `to`.\n    function findFirst(pred, from, to) {\n        // At any point we are certain `to` satisfies `pred`, don't know\n        // whether `from` does.\n        var dir = from > to ? -1 : 1\n        for (;;) {\n            if (from == to) {\n                return from\n            }\n            var midF = (from + to) / 2,\n                mid = dir < 0 ? Math.ceil(midF) : Math.floor(midF)\n            if (mid == from) {\n                return pred(mid) ? from : to\n            }\n            if (pred(mid)) {\n                to = mid\n            } else {\n                from = mid + dir\n            }\n        }\n    }\n\n    // BIDI HELPERS\n\n    function iterateBidiSections(order, from, to, f) {\n        if (!order) {\n            return f(from, to, \"ltr\", 0)\n        }\n        var found = false\n        for (var i = 0; i < order.length; ++i) {\n            var part = order[i]\n            if ((part.from < to && part.to > from) || (from == to && part.to == from)) {\n                f(\n                    Math.max(part.from, from),\n                    Math.min(part.to, to),\n                    part.level == 1 ? \"rtl\" : \"ltr\",\n                    i\n                )\n                found = true\n            }\n        }\n        if (!found) {\n            f(from, to, \"ltr\")\n        }\n    }\n\n    var bidiOther = null\n    function getBidiPartAt(order, ch, sticky) {\n        var found\n        bidiOther = null\n        for (var i = 0; i < order.length; ++i) {\n            var cur = order[i]\n            if (cur.from < ch && cur.to > ch) {\n                return i\n            }\n            if (cur.to == ch) {\n                if (cur.from != cur.to && sticky == \"before\") {\n                    found = i\n                } else {\n                    bidiOther = i\n                }\n            }\n            if (cur.from == ch) {\n                if (cur.from != cur.to && sticky != \"before\") {\n                    found = i\n                } else {\n                    bidiOther = i\n                }\n            }\n        }\n        return found != null ? found : bidiOther\n    }\n\n    // Bidirectional ordering algorithm\n    // See http://unicode.org/reports/tr9/tr9-13.html for the algorithm\n    // that this (partially) implements.\n\n    // One-char codes used for character types:\n    // L (L):   Left-to-Right\n    // R (R):   Right-to-Left\n    // r (AL):  Right-to-Left Arabic\n    // 1 (EN):  European Number\n    // + (ES):  European Number Separator\n    // % (ET):  European Number Terminator\n    // n (AN):  Arabic Number\n    // , (CS):  Common Number Separator\n    // m (NSM): Non-Spacing Mark\n    // b (BN):  Boundary Neutral\n    // s (B):   Paragraph Separator\n    // t (S):   Segment Separator\n    // w (WS):  Whitespace\n    // N (ON):  Other Neutrals\n\n    // Returns null if characters are ordered as they appear\n    // (left-to-right), or an array of sections ({from, to, level}\n    // objects) in the order in which they occur visually.\n    var bidiOrdering = (function() {\n        // Character types for codepoints 0 to 0xff\n        var lowTypes =\n            \"bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN\"\n        // Character types for codepoints 0x600 to 0x6f9\n        var arabicTypes =\n            \"nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111\"\n        function charType(code) {\n            if (code <= 0xf7) {\n                return lowTypes.charAt(code)\n            } else if (0x590 <= code && code <= 0x5f4) {\n                return \"R\"\n            } else if (0x600 <= code && code <= 0x6f9) {\n                return arabicTypes.charAt(code - 0x600)\n            } else if (0x6ee <= code && code <= 0x8ac) {\n                return \"r\"\n            } else if (0x2000 <= code && code <= 0x200b) {\n                return \"w\"\n            } else if (code == 0x200c) {\n                return \"b\"\n            } else {\n                return \"L\"\n            }\n        }\n\n        var bidiRE = /[\\u0590-\\u05f4\\u0600-\\u06ff\\u0700-\\u08ac]/\n        var isNeutral = /[stwN]/,\n            isStrong = /[LRr]/,\n            countsAsLeft = /[Lb1n]/,\n            countsAsNum = /[1n]/\n\n        function BidiSpan(level, from, to) {\n            this.level = level\n            this.from = from\n            this.to = to\n        }\n\n        return function(str, direction) {\n            var outerType = direction == \"ltr\" ? \"L\" : \"R\"\n\n            if (str.length == 0 || (direction == \"ltr\" && !bidiRE.test(str))) {\n                return false\n            }\n            var len = str.length,\n                types = []\n            for (var i = 0; i < len; ++i) {\n                types.push(charType(str.charCodeAt(i)))\n            }\n\n            // W1. Examine each non-spacing mark (NSM) in the level run, and\n            // change the type of the NSM to the type of the previous\n            // character. If the NSM is at the start of the level run, it will\n            // get the type of sor.\n            for (var i$1 = 0, prev = outerType; i$1 < len; ++i$1) {\n                var type = types[i$1]\n                if (type == \"m\") {\n                    types[i$1] = prev\n                } else {\n                    prev = type\n                }\n            }\n\n            // W2. Search backwards from each instance of a European number\n            // until the first strong type (R, L, AL, or sor) is found. If an\n            // AL is found, change the type of the European number to Arabic\n            // number.\n            // W3. Change all ALs to R.\n            for (var i$2 = 0, cur = outerType; i$2 < len; ++i$2) {\n                var type$1 = types[i$2]\n                if (type$1 == \"1\" && cur == \"r\") {\n                    types[i$2] = \"n\"\n                } else if (isStrong.test(type$1)) {\n                    cur = type$1\n                    if (type$1 == \"r\") {\n                        types[i$2] = \"R\"\n                    }\n                }\n            }\n\n            // W4. A single European separator between two European numbers\n            // changes to a European number. A single common separator between\n            // two numbers of the same type changes to that type.\n            for (var i$3 = 1, prev$1 = types[0]; i$3 < len - 1; ++i$3) {\n                var type$2 = types[i$3]\n                if (type$2 == \"+\" && prev$1 == \"1\" && types[i$3 + 1] == \"1\") {\n                    types[i$3] = \"1\"\n                } else if (\n                    type$2 == \",\" &&\n                    prev$1 == types[i$3 + 1] &&\n                    (prev$1 == \"1\" || prev$1 == \"n\")\n                ) {\n                    types[i$3] = prev$1\n                }\n                prev$1 = type$2\n            }\n\n            // W5. A sequence of European terminators adjacent to European\n            // numbers changes to all European numbers.\n            // W6. Otherwise, separators and terminators change to Other\n            // Neutral.\n            for (var i$4 = 0; i$4 < len; ++i$4) {\n                var type$3 = types[i$4]\n                if (type$3 == \",\") {\n                    types[i$4] = \"N\"\n                } else if (type$3 == \"%\") {\n                    var end = void 0\n                    for (end = i$4 + 1; end < len && types[end] == \"%\"; ++end) {}\n                    var replace =\n                        (i$4 && types[i$4 - 1] == \"!\") || (end < len && types[end] == \"1\")\n                            ? \"1\"\n                            : \"N\"\n                    for (var j = i$4; j < end; ++j) {\n                        types[j] = replace\n                    }\n                    i$4 = end - 1\n                }\n            }\n\n            // W7. Search backwards from each instance of a European number\n            // until the first strong type (R, L, or sor) is found. If an L is\n            // found, then change the type of the European number to L.\n            for (var i$5 = 0, cur$1 = outerType; i$5 < len; ++i$5) {\n                var type$4 = types[i$5]\n                if (cur$1 == \"L\" && type$4 == \"1\") {\n                    types[i$5] = \"L\"\n                } else if (isStrong.test(type$4)) {\n                    cur$1 = type$4\n                }\n            }\n\n            // N1. A sequence of neutrals takes the direction of the\n            // surrounding strong text if the text on both sides has the same\n            // direction. European and Arabic numbers act as if they were R in\n            // terms of their influence on neutrals. Start-of-level-run (sor)\n            // and end-of-level-run (eor) are used at level run boundaries.\n            // N2. Any remaining neutrals take the embedding direction.\n            for (var i$6 = 0; i$6 < len; ++i$6) {\n                if (isNeutral.test(types[i$6])) {\n                    var end$1 = void 0\n                    for (end$1 = i$6 + 1; end$1 < len && isNeutral.test(types[end$1]); ++end$1) {}\n                    var before = (i$6 ? types[i$6 - 1] : outerType) == \"L\"\n                    var after = (end$1 < len ? types[end$1] : outerType) == \"L\"\n                    var replace$1 = before == after ? (before ? \"L\" : \"R\") : outerType\n                    for (var j$1 = i$6; j$1 < end$1; ++j$1) {\n                        types[j$1] = replace$1\n                    }\n                    i$6 = end$1 - 1\n                }\n            }\n\n            // Here we depart from the documented algorithm, in order to avoid\n            // building up an actual levels array. Since there are only three\n            // levels (0, 1, 2) in an implementation that doesn't take\n            // explicit embedding into account, we can build up the order on\n            // the fly, without following the level-based algorithm.\n            var order = [],\n                m\n            for (var i$7 = 0; i$7 < len; ) {\n                if (countsAsLeft.test(types[i$7])) {\n                    var start = i$7\n                    for (++i$7; i$7 < len && countsAsLeft.test(types[i$7]); ++i$7) {}\n                    order.push(new BidiSpan(0, start, i$7))\n                } else {\n                    var pos = i$7,\n                        at = order.length,\n                        isRTL = direction == \"rtl\" ? 1 : 0\n                    for (++i$7; i$7 < len && types[i$7] != \"L\"; ++i$7) {}\n                    for (var j$2 = pos; j$2 < i$7; ) {\n                        if (countsAsNum.test(types[j$2])) {\n                            if (pos < j$2) {\n                                order.splice(at, 0, new BidiSpan(1, pos, j$2))\n                                at += isRTL\n                            }\n                            var nstart = j$2\n                            for (++j$2; j$2 < i$7 && countsAsNum.test(types[j$2]); ++j$2) {}\n                            order.splice(at, 0, new BidiSpan(2, nstart, j$2))\n                            at += isRTL\n                            pos = j$2\n                        } else {\n                            ++j$2\n                        }\n                    }\n                    if (pos < i$7) {\n                        order.splice(at, 0, new BidiSpan(1, pos, i$7))\n                    }\n                }\n            }\n            if (direction == \"ltr\") {\n                if (order[0].level == 1 && (m = str.match(/^\\s+/))) {\n                    order[0].from = m[0].length\n                    order.unshift(new BidiSpan(0, 0, m[0].length))\n                }\n                if (lst(order).level == 1 && (m = str.match(/\\s+$/))) {\n                    lst(order).to -= m[0].length\n                    order.push(new BidiSpan(0, len - m[0].length, len))\n                }\n            }\n\n            return direction == \"rtl\" ? order.reverse() : order\n        }\n    })()\n\n    // Get the bidi ordering for the given line (and cache it). Returns\n    // false for lines that are fully left-to-right, and an array of\n    // BidiSpan objects otherwise.\n    function getOrder(line, direction) {\n        var order = line.order\n        if (order == null) {\n            order = line.order = bidiOrdering(line.text, direction)\n        }\n        return order\n    }\n\n    // EVENT HANDLING\n\n    // Lightweight event framework. on/off also work on DOM nodes,\n    // registering native DOM handlers.\n\n    var noHandlers = []\n\n    var on = function(emitter, type, f) {\n        if (emitter.addEventListener) {\n            emitter.addEventListener(type, f, false)\n        } else if (emitter.attachEvent) {\n            emitter.attachEvent(\"on\" + type, f)\n        } else {\n            var map = emitter._handlers || (emitter._handlers = {})\n            map[type] = (map[type] || noHandlers).concat(f)\n        }\n    }\n\n    function getHandlers(emitter, type) {\n        return (emitter._handlers && emitter._handlers[type]) || noHandlers\n    }\n\n    function off(emitter, type, f) {\n        if (emitter.removeEventListener) {\n            emitter.removeEventListener(type, f, false)\n        } else if (emitter.detachEvent) {\n            emitter.detachEvent(\"on\" + type, f)\n        } else {\n            var map = emitter._handlers,\n                arr = map && map[type]\n            if (arr) {\n                var index = indexOf(arr, f)\n                if (index > -1) {\n                    map[type] = arr.slice(0, index).concat(arr.slice(index + 1))\n                }\n            }\n        }\n    }\n\n    function signal(emitter, type /*, values...*/) {\n        var handlers = getHandlers(emitter, type)\n        if (!handlers.length) {\n            return\n        }\n        var args = Array.prototype.slice.call(arguments, 2)\n        for (var i = 0; i < handlers.length; ++i) {\n            handlers[i].apply(null, args)\n        }\n    }\n\n    // The DOM events that CodeMirror handles can be overridden by\n    // registering a (non-DOM) handler on the editor for the event name,\n    // and preventDefault-ing the event in that handler.\n    function signalDOMEvent(cm, e, override) {\n        if (typeof e == \"string\") {\n            e = {\n                type: e,\n                preventDefault: function() {\n                    this.defaultPrevented = true\n                }\n            }\n        }\n        signal(cm, override || e.type, cm, e)\n        return e_defaultPrevented(e) || e.codemirrorIgnore\n    }\n\n    function signalCursorActivity(cm) {\n        var arr = cm._handlers && cm._handlers.cursorActivity\n        if (!arr) {\n            return\n        }\n        var set = cm.curOp.cursorActivityHandlers || (cm.curOp.cursorActivityHandlers = [])\n        for (var i = 0; i < arr.length; ++i) {\n            if (indexOf(set, arr[i]) == -1) {\n                set.push(arr[i])\n            }\n        }\n    }\n\n    function hasHandler(emitter, type) {\n        return getHandlers(emitter, type).length > 0\n    }\n\n    // Add on and off methods to a constructor's prototype, to make\n    // registering events on such objects more convenient.\n    function eventMixin(ctor) {\n        ctor.prototype.on = function(type, f) {\n            on(this, type, f)\n        }\n        ctor.prototype.off = function(type, f) {\n            off(this, type, f)\n        }\n    }\n\n    // Due to the fact that we still support jurassic IE versions, some\n    // compatibility wrappers are needed.\n\n    function e_preventDefault(e) {\n        if (e.preventDefault) {\n            e.preventDefault()\n        } else {\n            e.returnValue = false\n        }\n    }\n    function e_stopPropagation(e) {\n        if (e.stopPropagation) {\n            e.stopPropagation()\n        } else {\n            e.cancelBubble = true\n        }\n    }\n    function e_defaultPrevented(e) {\n        return e.defaultPrevented != null ? e.defaultPrevented : e.returnValue == false\n    }\n    function e_stop(e) {\n        e_preventDefault(e)\n        e_stopPropagation(e)\n    }\n\n    function e_target(e) {\n        return e.target || e.srcElement\n    }\n    function e_button(e) {\n        var b = e.which\n        if (b == null) {\n            if (e.button & 1) {\n                b = 1\n            } else if (e.button & 2) {\n                b = 3\n            } else if (e.button & 4) {\n                b = 2\n            }\n        }\n        if (mac && e.ctrlKey && b == 1) {\n            b = 3\n        }\n        return b\n    }\n\n    // Detect drag-and-drop\n    var dragAndDrop = (function() {\n        // There is *some* kind of drag-and-drop support in IE6-8, but I\n        // couldn't get it to work yet.\n        if (ie && ie_version < 9) {\n            return false\n        }\n        var div = elt(\"div\")\n        return \"draggable\" in div || \"dragDrop\" in div\n    })()\n\n    var zwspSupported\n    function zeroWidthElement(measure) {\n        if (zwspSupported == null) {\n            var test = elt(\"span\", \"\\u200b\")\n            removeChildrenAndAdd(measure, elt(\"span\", [test, document.createTextNode(\"x\")]))\n            if (measure.firstChild.offsetHeight != 0) {\n                zwspSupported =\n                    test.offsetWidth <= 1 && test.offsetHeight > 2 && !(ie && ie_version < 8)\n            }\n        }\n        var node = zwspSupported\n            ? elt(\"span\", \"\\u200b\")\n            : elt(\"span\", \"\\u00a0\", null, \"display: inline-block; width: 1px; margin-right: -1px\")\n        node.setAttribute(\"cm-text\", \"\")\n        return node\n    }\n\n    // Feature-detect IE's crummy client rect reporting for bidi text\n    var badBidiRects\n    function hasBadBidiRects(measure) {\n        if (badBidiRects != null) {\n            return badBidiRects\n        }\n        var txt = removeChildrenAndAdd(measure, document.createTextNode(\"A\\u062eA\"))\n        var r0 = range(txt, 0, 1).getBoundingClientRect()\n        var r1 = range(txt, 1, 2).getBoundingClientRect()\n        removeChildren(measure)\n        if (!r0 || r0.left == r0.right) {\n            return false\n        } // Safari returns null in some cases (#2780)\n        return (badBidiRects = r1.right - r0.right < 3)\n    }\n\n    // See if \"\".split is the broken IE version, if so, provide an\n    // alternative way to split lines.\n    var splitLinesAuto =\n        \"\\n\\nb\".split(/\\n/).length != 3\n            ? function(string) {\n                  var pos = 0,\n                      result = [],\n                      l = string.length\n                  while (pos <= l) {\n                      var nl = string.indexOf(\"\\n\", pos)\n                      if (nl == -1) {\n                          nl = string.length\n                      }\n                      var line = string.slice(pos, string.charAt(nl - 1) == \"\\r\" ? nl - 1 : nl)\n                      var rt = line.indexOf(\"\\r\")\n                      if (rt != -1) {\n                          result.push(line.slice(0, rt))\n                          pos += rt + 1\n                      } else {\n                          result.push(line)\n                          pos = nl + 1\n                      }\n                  }\n                  return result\n              }\n            : function(string) {\n                  return string.split(/\\r\\n?|\\n/)\n              }\n\n    var hasSelection = window.getSelection\n        ? function(te) {\n              try {\n                  return te.selectionStart != te.selectionEnd\n              } catch (e) {\n                  return false\n              }\n          }\n        : function(te) {\n              var range\n              try {\n                  range = te.ownerDocument.selection.createRange()\n              } catch (e) {}\n              if (!range || range.parentElement() != te) {\n                  return false\n              }\n              return range.compareEndPoints(\"StartToEnd\", range) != 0\n          }\n\n    var hasCopyEvent = (function() {\n        var e = elt(\"div\")\n        if (\"oncopy\" in e) {\n            return true\n        }\n        e.setAttribute(\"oncopy\", \"return;\")\n        return typeof e.oncopy == \"function\"\n    })()\n\n    var badZoomedRects = null\n    function hasBadZoomedRects(measure) {\n        if (badZoomedRects != null) {\n            return badZoomedRects\n        }\n        var node = removeChildrenAndAdd(measure, elt(\"span\", \"x\"))\n        var normal = node.getBoundingClientRect()\n        var fromRange = range(node, 0, 1).getBoundingClientRect()\n        return (badZoomedRects = Math.abs(normal.left - fromRange.left) > 1)\n    }\n\n    // Known modes, by name and by MIME\n    var modes = {},\n        mimeModes = {}\n\n    // Extra arguments are stored as the mode's dependencies, which is\n    // used by (legacy) mechanisms like loadmode.js to automatically\n    // load a mode. (Preferred mechanism is the require/define calls.)\n    function defineMode(name, mode) {\n        if (arguments.length > 2) {\n            mode.dependencies = Array.prototype.slice.call(arguments, 2)\n        }\n        modes[name] = mode\n    }\n\n    function defineMIME(mime, spec) {\n        mimeModes[mime] = spec\n    }\n\n    // Given a MIME type, a {name, ...options} config object, or a name\n    // string, return a mode config object.\n    function resolveMode(spec) {\n        if (typeof spec == \"string\" && mimeModes.hasOwnProperty(spec)) {\n            spec = mimeModes[spec]\n        } else if (spec && typeof spec.name == \"string\" && mimeModes.hasOwnProperty(spec.name)) {\n            var found = mimeModes[spec.name]\n            if (typeof found == \"string\") {\n                found = { name: found }\n            }\n            spec = createObj(found, spec)\n            spec.name = found.name\n        } else if (typeof spec == \"string\" && /^[\\w\\-]+\\/[\\w\\-]+\\+xml$/.test(spec)) {\n            return resolveMode(\"application/xml\")\n        } else if (typeof spec == \"string\" && /^[\\w\\-]+\\/[\\w\\-]+\\+json$/.test(spec)) {\n            return resolveMode(\"application/json\")\n        }\n        if (typeof spec == \"string\") {\n            return { name: spec }\n        } else {\n            return spec || { name: \"null\" }\n        }\n    }\n\n    // Given a mode spec (anything that resolveMode accepts), find and\n    // initialize an actual mode object.\n    function getMode(options, spec) {\n        spec = resolveMode(spec)\n        var mfactory = modes[spec.name]\n        if (!mfactory) {\n            return getMode(options, \"text/plain\")\n        }\n        var modeObj = mfactory(options, spec)\n        if (modeExtensions.hasOwnProperty(spec.name)) {\n            var exts = modeExtensions[spec.name]\n            for (var prop in exts) {\n                if (!exts.hasOwnProperty(prop)) {\n                    continue\n                }\n                if (modeObj.hasOwnProperty(prop)) {\n                    modeObj[\"_\" + prop] = modeObj[prop]\n                }\n                modeObj[prop] = exts[prop]\n            }\n        }\n        modeObj.name = spec.name\n        if (spec.helperType) {\n            modeObj.helperType = spec.helperType\n        }\n        if (spec.modeProps) {\n            for (var prop$1 in spec.modeProps) {\n                modeObj[prop$1] = spec.modeProps[prop$1]\n            }\n        }\n\n        return modeObj\n    }\n\n    // This can be used to attach properties to mode objects from\n    // outside the actual mode definition.\n    var modeExtensions = {}\n    function extendMode(mode, properties) {\n        var exts = modeExtensions.hasOwnProperty(mode)\n            ? modeExtensions[mode]\n            : (modeExtensions[mode] = {})\n        copyObj(properties, exts)\n    }\n\n    function copyState(mode, state) {\n        if (state === true) {\n            return state\n        }\n        if (mode.copyState) {\n            return mode.copyState(state)\n        }\n        var nstate = {}\n        for (var n in state) {\n            var val = state[n]\n            if (val instanceof Array) {\n                val = val.concat([])\n            }\n            nstate[n] = val\n        }\n        return nstate\n    }\n\n    // Given a mode and a state (for that mode), find the inner mode and\n    // state at the position that the state refers to.\n    function innerMode(mode, state) {\n        var info\n        while (mode.innerMode) {\n            info = mode.innerMode(state)\n            if (!info || info.mode == mode) {\n                break\n            }\n            state = info.state\n            mode = info.mode\n        }\n        return info || { mode: mode, state: state }\n    }\n\n    function startState(mode, a1, a2) {\n        return mode.startState ? mode.startState(a1, a2) : true\n    }\n\n    // STRING STREAM\n\n    // Fed to the mode parsers, provides helper functions to make\n    // parsers more succinct.\n\n    var StringStream = function(string, tabSize, lineOracle) {\n        this.pos = this.start = 0\n        this.string = string\n        this.tabSize = tabSize || 8\n        this.lastColumnPos = this.lastColumnValue = 0\n        this.lineStart = 0\n        this.lineOracle = lineOracle\n    }\n\n    StringStream.prototype.eol = function() {\n        return this.pos >= this.string.length\n    }\n    StringStream.prototype.sol = function() {\n        return this.pos == this.lineStart\n    }\n    StringStream.prototype.peek = function() {\n        return this.string.charAt(this.pos) || undefined\n    }\n    StringStream.prototype.next = function() {\n        if (this.pos < this.string.length) {\n            return this.string.charAt(this.pos++)\n        }\n    }\n    StringStream.prototype.eat = function(match) {\n        var ch = this.string.charAt(this.pos)\n        var ok\n        if (typeof match == \"string\") {\n            ok = ch == match\n        } else {\n            ok = ch && (match.test ? match.test(ch) : match(ch))\n        }\n        if (ok) {\n            ++this.pos\n            return ch\n        }\n    }\n    StringStream.prototype.eatWhile = function(match) {\n        var start = this.pos\n        while (this.eat(match)) {}\n        return this.pos > start\n    }\n    StringStream.prototype.eatSpace = function() {\n        var start = this.pos\n        while (/[\\s\\u00a0]/.test(this.string.charAt(this.pos))) {\n            ++this.pos\n        }\n        return this.pos > start\n    }\n    StringStream.prototype.skipToEnd = function() {\n        this.pos = this.string.length\n    }\n    StringStream.prototype.skipTo = function(ch) {\n        var found = this.string.indexOf(ch, this.pos)\n        if (found > -1) {\n            this.pos = found\n            return true\n        }\n    }\n    StringStream.prototype.backUp = function(n) {\n        this.pos -= n\n    }\n    StringStream.prototype.column = function() {\n        if (this.lastColumnPos < this.start) {\n            this.lastColumnValue = countColumn(\n                this.string,\n                this.start,\n                this.tabSize,\n                this.lastColumnPos,\n                this.lastColumnValue\n            )\n            this.lastColumnPos = this.start\n        }\n        return (\n            this.lastColumnValue -\n            (this.lineStart ? countColumn(this.string, this.lineStart, this.tabSize) : 0)\n        )\n    }\n    StringStream.prototype.indentation = function() {\n        return (\n            countColumn(this.string, null, this.tabSize) -\n            (this.lineStart ? countColumn(this.string, this.lineStart, this.tabSize) : 0)\n        )\n    }\n    StringStream.prototype.match = function(pattern, consume, caseInsensitive) {\n        if (typeof pattern == \"string\") {\n            var cased = function(str) {\n                return caseInsensitive ? str.toLowerCase() : str\n            }\n            var substr = this.string.substr(this.pos, pattern.length)\n            if (cased(substr) == cased(pattern)) {\n                if (consume !== false) {\n                    this.pos += pattern.length\n                }\n                return true\n            }\n        } else {\n            var match = this.string.slice(this.pos).match(pattern)\n            if (match && match.index > 0) {\n                return null\n            }\n            if (match && consume !== false) {\n                this.pos += match[0].length\n            }\n            return match\n        }\n    }\n    StringStream.prototype.current = function() {\n        return this.string.slice(this.start, this.pos)\n    }\n    StringStream.prototype.hideFirstChars = function(n, inner) {\n        this.lineStart += n\n        try {\n            return inner()\n        } finally {\n            this.lineStart -= n\n        }\n    }\n    StringStream.prototype.lookAhead = function(n) {\n        var oracle = this.lineOracle\n        return oracle && oracle.lookAhead(n)\n    }\n    StringStream.prototype.baseToken = function() {\n        var oracle = this.lineOracle\n        return oracle && oracle.baseToken(this.pos)\n    }\n\n    // Find the line object corresponding to the given line number.\n    function getLine(doc, n) {\n        n -= doc.first\n        if (n < 0 || n >= doc.size) {\n            throw new Error(\"There is no line \" + (n + doc.first) + \" in the document.\")\n        }\n        var chunk = doc\n        while (!chunk.lines) {\n            for (var i = 0; ; ++i) {\n                var child = chunk.children[i],\n                    sz = child.chunkSize()\n                if (n < sz) {\n                    chunk = child\n                    break\n                }\n                n -= sz\n            }\n        }\n        return chunk.lines[n]\n    }\n\n    // Get the part of a document between two positions, as an array of\n    // strings.\n    function getBetween(doc, start, end) {\n        var out = [],\n            n = start.line\n        doc.iter(start.line, end.line + 1, function(line) {\n            var text = line.text\n            if (n == end.line) {\n                text = text.slice(0, end.ch)\n            }\n            if (n == start.line) {\n                text = text.slice(start.ch)\n            }\n            out.push(text)\n            ++n\n        })\n        return out\n    }\n    // Get the lines between from and to, as array of strings.\n    function getLines(doc, from, to) {\n        var out = []\n        doc.iter(from, to, function(line) {\n            out.push(line.text)\n        }) // iter aborts when callback returns truthy value\n        return out\n    }\n\n    // Update the height of a line, propagating the height change\n    // upwards to parent nodes.\n    function updateLineHeight(line, height) {\n        var diff = height - line.height\n        if (diff) {\n            for (var n = line; n; n = n.parent) {\n                n.height += diff\n            }\n        }\n    }\n\n    // Given a line object, find its line number by walking up through\n    // its parent links.\n    function lineNo(line) {\n        if (line.parent == null) {\n            return null\n        }\n        var cur = line.parent,\n            no = indexOf(cur.lines, line)\n        for (var chunk = cur.parent; chunk; cur = chunk, chunk = chunk.parent) {\n            for (var i = 0; ; ++i) {\n                if (chunk.children[i] == cur) {\n                    break\n                }\n                no += chunk.children[i].chunkSize()\n            }\n        }\n        return no + cur.first\n    }\n\n    // Find the line at the given vertical position, using the height\n    // information in the document tree.\n    function lineAtHeight(chunk, h) {\n        var n = chunk.first\n        outer: do {\n            for (var i$1 = 0; i$1 < chunk.children.length; ++i$1) {\n                var child = chunk.children[i$1],\n                    ch = child.height\n                if (h < ch) {\n                    chunk = child\n                    continue outer\n                }\n                h -= ch\n                n += child.chunkSize()\n            }\n            return n\n        } while (!chunk.lines)\n        var i = 0\n        for (; i < chunk.lines.length; ++i) {\n            var line = chunk.lines[i],\n                lh = line.height\n            if (h < lh) {\n                break\n            }\n            h -= lh\n        }\n        return n + i\n    }\n\n    function isLine(doc, l) {\n        return l >= doc.first && l < doc.first + doc.size\n    }\n\n    function lineNumberFor(options, i) {\n        return String(options.lineNumberFormatter(i + options.firstLineNumber))\n    }\n\n    // A Pos instance represents a position within the text.\n    function Pos(line, ch, sticky) {\n        if (sticky === void 0) sticky = null\n\n        if (!(this instanceof Pos)) {\n            return new Pos(line, ch, sticky)\n        }\n        this.line = line\n        this.ch = ch\n        this.sticky = sticky\n    }\n\n    // Compare two positions, return 0 if they are the same, a negative\n    // number when a is less, and a positive number otherwise.\n    function cmp(a, b) {\n        return a.line - b.line || a.ch - b.ch\n    }\n\n    function equalCursorPos(a, b) {\n        return a.sticky == b.sticky && cmp(a, b) == 0\n    }\n\n    function copyPos(x) {\n        return Pos(x.line, x.ch)\n    }\n    function maxPos(a, b) {\n        return cmp(a, b) < 0 ? b : a\n    }\n    function minPos(a, b) {\n        return cmp(a, b) < 0 ? a : b\n    }\n\n    // Most of the external API clips given positions to make sure they\n    // actually exist within the document.\n    function clipLine(doc, n) {\n        return Math.max(doc.first, Math.min(n, doc.first + doc.size - 1))\n    }\n    function clipPos(doc, pos) {\n        if (pos.line < doc.first) {\n            return Pos(doc.first, 0)\n        }\n        var last = doc.first + doc.size - 1\n        if (pos.line > last) {\n            return Pos(last, getLine(doc, last).text.length)\n        }\n        return clipToLen(pos, getLine(doc, pos.line).text.length)\n    }\n    function clipToLen(pos, linelen) {\n        var ch = pos.ch\n        if (ch == null || ch > linelen) {\n            return Pos(pos.line, linelen)\n        } else if (ch < 0) {\n            return Pos(pos.line, 0)\n        } else {\n            return pos\n        }\n    }\n    function clipPosArray(doc, array) {\n        var out = []\n        for (var i = 0; i < array.length; i++) {\n            out[i] = clipPos(doc, array[i])\n        }\n        return out\n    }\n\n    var SavedContext = function(state, lookAhead) {\n        this.state = state\n        this.lookAhead = lookAhead\n    }\n\n    var Context = function(doc, state, line, lookAhead) {\n        this.state = state\n        this.doc = doc\n        this.line = line\n        this.maxLookAhead = lookAhead || 0\n        this.baseTokens = null\n        this.baseTokenPos = 1\n    }\n\n    Context.prototype.lookAhead = function(n) {\n        var line = this.doc.getLine(this.line + n)\n        if (line != null && n > this.maxLookAhead) {\n            this.maxLookAhead = n\n        }\n        return line\n    }\n\n    Context.prototype.baseToken = function(n) {\n        if (!this.baseTokens) {\n            return null\n        }\n        while (this.baseTokens[this.baseTokenPos] <= n) {\n            this.baseTokenPos += 2\n        }\n        var type = this.baseTokens[this.baseTokenPos + 1]\n        return {\n            type: type && type.replace(/( |^)overlay .*/, \"\"),\n            size: this.baseTokens[this.baseTokenPos] - n\n        }\n    }\n\n    Context.prototype.nextLine = function() {\n        this.line++\n        if (this.maxLookAhead > 0) {\n            this.maxLookAhead--\n        }\n    }\n\n    Context.fromSaved = function(doc, saved, line) {\n        if (saved instanceof SavedContext) {\n            return new Context(doc, copyState(doc.mode, saved.state), line, saved.lookAhead)\n        } else {\n            return new Context(doc, copyState(doc.mode, saved), line)\n        }\n    }\n\n    Context.prototype.save = function(copy) {\n        var state = copy !== false ? copyState(this.doc.mode, this.state) : this.state\n        return this.maxLookAhead > 0 ? new SavedContext(state, this.maxLookAhead) : state\n    }\n\n    // Compute a style array (an array starting with a mode generation\n    // -- for invalidation -- followed by pairs of end positions and\n    // style strings), which is used to highlight the tokens on the\n    // line.\n    function highlightLine(cm, line, context, forceToEnd) {\n        // A styles array always starts with a number identifying the\n        // mode/overlays that it is based on (for easy invalidation).\n        var st = [cm.state.modeGen],\n            lineClasses = {}\n        // Compute the base array of styles\n        runMode(\n            cm,\n            line.text,\n            cm.doc.mode,\n            context,\n            function(end, style) {\n                return st.push(end, style)\n            },\n            lineClasses,\n            forceToEnd\n        )\n        var state = context.state\n\n        // Run overlays, adjust style array.\n        var loop = function(o) {\n            context.baseTokens = st\n            var overlay = cm.state.overlays[o],\n                i = 1,\n                at = 0\n            context.state = true\n            runMode(\n                cm,\n                line.text,\n                overlay.mode,\n                context,\n                function(end, style) {\n                    var start = i\n                    // Ensure there's a token end at the current position, and that i points at it\n                    while (at < end) {\n                        var i_end = st[i]\n                        if (i_end > end) {\n                            st.splice(i, 1, end, st[i + 1], i_end)\n                        }\n                        i += 2\n                        at = Math.min(end, i_end)\n                    }\n                    if (!style) {\n                        return\n                    }\n                    if (overlay.opaque) {\n                        st.splice(start, i - start, end, \"overlay \" + style)\n                        i = start + 2\n                    } else {\n                        for (; start < i; start += 2) {\n                            var cur = st[start + 1]\n                            st[start + 1] = (cur ? cur + \" \" : \"\") + \"overlay \" + style\n                        }\n                    }\n                },\n                lineClasses\n            )\n            context.state = state\n            context.baseTokens = null\n            context.baseTokenPos = 1\n        }\n\n        for (var o = 0; o < cm.state.overlays.length; ++o) loop(o)\n\n        return {\n            styles: st,\n            classes: lineClasses.bgClass || lineClasses.textClass ? lineClasses : null\n        }\n    }\n\n    function getLineStyles(cm, line, updateFrontier) {\n        if (!line.styles || line.styles[0] != cm.state.modeGen) {\n            var context = getContextBefore(cm, lineNo(line))\n            var resetState =\n                line.text.length > cm.options.maxHighlightLength &&\n                copyState(cm.doc.mode, context.state)\n            var result = highlightLine(cm, line, context)\n            if (resetState) {\n                context.state = resetState\n            }\n            line.stateAfter = context.save(!resetState)\n            line.styles = result.styles\n            if (result.classes) {\n                line.styleClasses = result.classes\n            } else if (line.styleClasses) {\n                line.styleClasses = null\n            }\n            if (updateFrontier === cm.doc.highlightFrontier) {\n                cm.doc.modeFrontier = Math.max(cm.doc.modeFrontier, ++cm.doc.highlightFrontier)\n            }\n        }\n        return line.styles\n    }\n\n    function getContextBefore(cm, n, precise) {\n        var doc = cm.doc,\n            display = cm.display\n        if (!doc.mode.startState) {\n            return new Context(doc, true, n)\n        }\n        var start = findStartLine(cm, n, precise)\n        var saved = start > doc.first && getLine(doc, start - 1).stateAfter\n        var context = saved\n            ? Context.fromSaved(doc, saved, start)\n            : new Context(doc, startState(doc.mode), start)\n\n        doc.iter(start, n, function(line) {\n            processLine(cm, line.text, context)\n            var pos = context.line\n            line.stateAfter =\n                pos == n - 1 || pos % 5 == 0 || (pos >= display.viewFrom && pos < display.viewTo)\n                    ? context.save()\n                    : null\n            context.nextLine()\n        })\n        if (precise) {\n            doc.modeFrontier = context.line\n        }\n        return context\n    }\n\n    // Lightweight form of highlight -- proceed over this line and\n    // update state, but don't save a style array. Used for lines that\n    // aren't currently visible.\n    function processLine(cm, text, context, startAt) {\n        var mode = cm.doc.mode\n        var stream = new StringStream(text, cm.options.tabSize, context)\n        stream.start = stream.pos = startAt || 0\n        if (text == \"\") {\n            callBlankLine(mode, context.state)\n        }\n        while (!stream.eol()) {\n            readToken(mode, stream, context.state)\n            stream.start = stream.pos\n        }\n    }\n\n    function callBlankLine(mode, state) {\n        if (mode.blankLine) {\n            return mode.blankLine(state)\n        }\n        if (!mode.innerMode) {\n            return\n        }\n        var inner = innerMode(mode, state)\n        if (inner.mode.blankLine) {\n            return inner.mode.blankLine(inner.state)\n        }\n    }\n\n    function readToken(mode, stream, state, inner) {\n        for (var i = 0; i < 10; i++) {\n            if (inner) {\n                inner[0] = innerMode(mode, state).mode\n            }\n            var style = mode.token(stream, state)\n            if (stream.pos > stream.start) {\n                return style\n            }\n        }\n        throw new Error(\"Mode \" + mode.name + \" failed to advance stream.\")\n    }\n\n    var Token = function(stream, type, state) {\n        this.start = stream.start\n        this.end = stream.pos\n        this.string = stream.current()\n        this.type = type || null\n        this.state = state\n    }\n\n    // Utility for getTokenAt and getLineTokens\n    function takeToken(cm, pos, precise, asArray) {\n        var doc = cm.doc,\n            mode = doc.mode,\n            style\n        pos = clipPos(doc, pos)\n        var line = getLine(doc, pos.line),\n            context = getContextBefore(cm, pos.line, precise)\n        var stream = new StringStream(line.text, cm.options.tabSize, context),\n            tokens\n        if (asArray) {\n            tokens = []\n        }\n        while ((asArray || stream.pos < pos.ch) && !stream.eol()) {\n            stream.start = stream.pos\n            style = readToken(mode, stream, context.state)\n            if (asArray) {\n                tokens.push(new Token(stream, style, copyState(doc.mode, context.state)))\n            }\n        }\n        return asArray ? tokens : new Token(stream, style, context.state)\n    }\n\n    function extractLineClasses(type, output) {\n        if (type) {\n            for (;;) {\n                var lineClass = type.match(/(?:^|\\s+)line-(background-)?(\\S+)/)\n                if (!lineClass) {\n                    break\n                }\n                type =\n                    type.slice(0, lineClass.index) +\n                    type.slice(lineClass.index + lineClass[0].length)\n                var prop = lineClass[1] ? \"bgClass\" : \"textClass\"\n                if (output[prop] == null) {\n                    output[prop] = lineClass[2]\n                } else if (!new RegExp(\"(?:^|s)\" + lineClass[2] + \"(?:$|s)\").test(output[prop])) {\n                    output[prop] += \" \" + lineClass[2]\n                }\n            }\n        }\n        return type\n    }\n\n    // Run the given mode's parser over a line, calling f for each token.\n    function runMode(cm, text, mode, context, f, lineClasses, forceToEnd) {\n        var flattenSpans = mode.flattenSpans\n        if (flattenSpans == null) {\n            flattenSpans = cm.options.flattenSpans\n        }\n        var curStart = 0,\n            curStyle = null\n        var stream = new StringStream(text, cm.options.tabSize, context),\n            style\n        var inner = cm.options.addModeClass && [null]\n        if (text == \"\") {\n            extractLineClasses(callBlankLine(mode, context.state), lineClasses)\n        }\n        while (!stream.eol()) {\n            if (stream.pos > cm.options.maxHighlightLength) {\n                flattenSpans = false\n                if (forceToEnd) {\n                    processLine(cm, text, context, stream.pos)\n                }\n                stream.pos = text.length\n                style = null\n            } else {\n                style = extractLineClasses(\n                    readToken(mode, stream, context.state, inner),\n                    lineClasses\n                )\n            }\n            if (inner) {\n                var mName = inner[0].name\n                if (mName) {\n                    style = \"m-\" + (style ? mName + \" \" + style : mName)\n                }\n            }\n            if (!flattenSpans || curStyle != style) {\n                while (curStart < stream.start) {\n                    curStart = Math.min(stream.start, curStart + 5000)\n                    f(curStart, curStyle)\n                }\n                curStyle = style\n            }\n            stream.start = stream.pos\n        }\n        while (curStart < stream.pos) {\n            // Webkit seems to refuse to render text nodes longer than 57444\n            // characters, and returns inaccurate measurements in nodes\n            // starting around 5000 chars.\n            var pos = Math.min(stream.pos, curStart + 5000)\n            f(pos, curStyle)\n            curStart = pos\n        }\n    }\n\n    // Finds the line to start with when starting a parse. Tries to\n    // find a line with a stateAfter, so that it can start with a\n    // valid state. If that fails, it returns the line with the\n    // smallest indentation, which tends to need the least context to\n    // parse correctly.\n    function findStartLine(cm, n, precise) {\n        var minindent,\n            minline,\n            doc = cm.doc\n        var lim = precise ? -1 : n - (cm.doc.mode.innerMode ? 1000 : 100)\n        for (var search = n; search > lim; --search) {\n            if (search <= doc.first) {\n                return doc.first\n            }\n            var line = getLine(doc, search - 1),\n                after = line.stateAfter\n            if (\n                after &&\n                (!precise ||\n                    search + (after instanceof SavedContext ? after.lookAhead : 0) <=\n                        doc.modeFrontier)\n            ) {\n                return search\n            }\n            var indented = countColumn(line.text, null, cm.options.tabSize)\n            if (minline == null || minindent > indented) {\n                minline = search - 1\n                minindent = indented\n            }\n        }\n        return minline\n    }\n\n    function retreatFrontier(doc, n) {\n        doc.modeFrontier = Math.min(doc.modeFrontier, n)\n        if (doc.highlightFrontier < n - 10) {\n            return\n        }\n        var start = doc.first\n        for (var line = n - 1; line > start; line--) {\n            var saved = getLine(doc, line).stateAfter\n            // change is on 3\n            // state on line 1 looked ahead 2 -- so saw 3\n            // test 1 + 2 < 3 should cover this\n            if (saved && (!(saved instanceof SavedContext) || line + saved.lookAhead < n)) {\n                start = line + 1\n                break\n            }\n        }\n        doc.highlightFrontier = Math.min(doc.highlightFrontier, start)\n    }\n\n    // Optimize some code when these features are not used.\n    var sawReadOnlySpans = false,\n        sawCollapsedSpans = false\n\n    function seeReadOnlySpans() {\n        sawReadOnlySpans = true\n    }\n\n    function seeCollapsedSpans() {\n        sawCollapsedSpans = true\n    }\n\n    // TEXTMARKER SPANS\n\n    function MarkedSpan(marker, from, to) {\n        this.marker = marker\n        this.from = from\n        this.to = to\n    }\n\n    // Search an array of spans for a span matching the given marker.\n    function getMarkedSpanFor(spans, marker) {\n        if (spans) {\n            for (var i = 0; i < spans.length; ++i) {\n                var span = spans[i]\n                if (span.marker == marker) {\n                    return span\n                }\n            }\n        }\n    }\n    // Remove a span from an array, returning undefined if no spans are\n    // left (we don't store arrays for lines without spans).\n    function removeMarkedSpan(spans, span) {\n        var r\n        for (var i = 0; i < spans.length; ++i) {\n            if (spans[i] != span) {\n                ;(r || (r = [])).push(spans[i])\n            }\n        }\n        return r\n    }\n    // Add a span to a line.\n    function addMarkedSpan(line, span) {\n        line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span]\n        span.marker.attachLine(line)\n    }\n\n    // Used for the algorithm that adjusts markers for a change in the\n    // document. These functions cut an array of spans at a given\n    // character position, returning an array of remaining chunks (or\n    // undefined if nothing remains).\n    function markedSpansBefore(old, startCh, isInsert) {\n        var nw\n        if (old) {\n            for (var i = 0; i < old.length; ++i) {\n                var span = old[i],\n                    marker = span.marker\n                var startsBefore =\n                    span.from == null ||\n                    (marker.inclusiveLeft ? span.from <= startCh : span.from < startCh)\n                if (\n                    startsBefore ||\n                    (span.from == startCh &&\n                        marker.type == \"bookmark\" &&\n                        (!isInsert || !span.marker.insertLeft))\n                ) {\n                    var endsAfter =\n                        span.to == null ||\n                        (marker.inclusiveRight ? span.to >= startCh : span.to > startCh)\n                    ;(nw || (nw = [])).push(\n                        new MarkedSpan(marker, span.from, endsAfter ? null : span.to)\n                    )\n                }\n            }\n        }\n        return nw\n    }\n    function markedSpansAfter(old, endCh, isInsert) {\n        var nw\n        if (old) {\n            for (var i = 0; i < old.length; ++i) {\n                var span = old[i],\n                    marker = span.marker\n                var endsAfter =\n                    span.to == null || (marker.inclusiveRight ? span.to >= endCh : span.to > endCh)\n                if (\n                    endsAfter ||\n                    (span.from == endCh &&\n                        marker.type == \"bookmark\" &&\n                        (!isInsert || span.marker.insertLeft))\n                ) {\n                    var startsBefore =\n                        span.from == null ||\n                        (marker.inclusiveLeft ? span.from <= endCh : span.from < endCh)\n                    ;(nw || (nw = [])).push(\n                        new MarkedSpan(\n                            marker,\n                            startsBefore ? null : span.from - endCh,\n                            span.to == null ? null : span.to - endCh\n                        )\n                    )\n                }\n            }\n        }\n        return nw\n    }\n\n    // Given a change object, compute the new set of marker spans that\n    // cover the line in which the change took place. Removes spans\n    // entirely within the change, reconnects spans belonging to the\n    // same marker that appear on both sides of the change, and cuts off\n    // spans partially within the change. Returns an array of span\n    // arrays with one element for each line in (after) the change.\n    function stretchSpansOverChange(doc, change) {\n        if (change.full) {\n            return null\n        }\n        var oldFirst = isLine(doc, change.from.line) && getLine(doc, change.from.line).markedSpans\n        var oldLast = isLine(doc, change.to.line) && getLine(doc, change.to.line).markedSpans\n        if (!oldFirst && !oldLast) {\n            return null\n        }\n\n        var startCh = change.from.ch,\n            endCh = change.to.ch,\n            isInsert = cmp(change.from, change.to) == 0\n        // Get the spans that 'stick out' on both sides\n        var first = markedSpansBefore(oldFirst, startCh, isInsert)\n        var last = markedSpansAfter(oldLast, endCh, isInsert)\n\n        // Next, merge those two ends\n        var sameLine = change.text.length == 1,\n            offset = lst(change.text).length + (sameLine ? startCh : 0)\n        if (first) {\n            // Fix up .to properties of first\n            for (var i = 0; i < first.length; ++i) {\n                var span = first[i]\n                if (span.to == null) {\n                    var found = getMarkedSpanFor(last, span.marker)\n                    if (!found) {\n                        span.to = startCh\n                    } else if (sameLine) {\n                        span.to = found.to == null ? null : found.to + offset\n                    }\n                }\n            }\n        }\n        if (last) {\n            // Fix up .from in last (or move them into first in case of sameLine)\n            for (var i$1 = 0; i$1 < last.length; ++i$1) {\n                var span$1 = last[i$1]\n                if (span$1.to != null) {\n                    span$1.to += offset\n                }\n                if (span$1.from == null) {\n                    var found$1 = getMarkedSpanFor(first, span$1.marker)\n                    if (!found$1) {\n                        span$1.from = offset\n                        if (sameLine) {\n                            ;(first || (first = [])).push(span$1)\n                        }\n                    }\n                } else {\n                    span$1.from += offset\n                    if (sameLine) {\n                        ;(first || (first = [])).push(span$1)\n                    }\n                }\n            }\n        }\n        // Make sure we didn't create any zero-length spans\n        if (first) {\n            first = clearEmptySpans(first)\n        }\n        if (last && last != first) {\n            last = clearEmptySpans(last)\n        }\n\n        var newMarkers = [first]\n        if (!sameLine) {\n            // Fill gap with whole-line-spans\n            var gap = change.text.length - 2,\n                gapMarkers\n            if (gap > 0 && first) {\n                for (var i$2 = 0; i$2 < first.length; ++i$2) {\n                    if (first[i$2].to == null) {\n                        ;(gapMarkers || (gapMarkers = [])).push(\n                            new MarkedSpan(first[i$2].marker, null, null)\n                        )\n                    }\n                }\n            }\n            for (var i$3 = 0; i$3 < gap; ++i$3) {\n                newMarkers.push(gapMarkers)\n            }\n            newMarkers.push(last)\n        }\n        return newMarkers\n    }\n\n    // Remove spans that are empty and don't have a clearWhenEmpty\n    // option of false.\n    function clearEmptySpans(spans) {\n        for (var i = 0; i < spans.length; ++i) {\n            var span = spans[i]\n            if (span.from != null && span.from == span.to && span.marker.clearWhenEmpty !== false) {\n                spans.splice(i--, 1)\n            }\n        }\n        if (!spans.length) {\n            return null\n        }\n        return spans\n    }\n\n    // Used to 'clip' out readOnly ranges when making a change.\n    function removeReadOnlyRanges(doc, from, to) {\n        var markers = null\n        doc.iter(from.line, to.line + 1, function(line) {\n            if (line.markedSpans) {\n                for (var i = 0; i < line.markedSpans.length; ++i) {\n                    var mark = line.markedSpans[i].marker\n                    if (mark.readOnly && (!markers || indexOf(markers, mark) == -1)) {\n                        ;(markers || (markers = [])).push(mark)\n                    }\n                }\n            }\n        })\n        if (!markers) {\n            return null\n        }\n        var parts = [{ from: from, to: to }]\n        for (var i = 0; i < markers.length; ++i) {\n            var mk = markers[i],\n                m = mk.find(0)\n            for (var j = 0; j < parts.length; ++j) {\n                var p = parts[j]\n                if (cmp(p.to, m.from) < 0 || cmp(p.from, m.to) > 0) {\n                    continue\n                }\n                var newParts = [j, 1],\n                    dfrom = cmp(p.from, m.from),\n                    dto = cmp(p.to, m.to)\n                if (dfrom < 0 || (!mk.inclusiveLeft && !dfrom)) {\n                    newParts.push({ from: p.from, to: m.from })\n                }\n                if (dto > 0 || (!mk.inclusiveRight && !dto)) {\n                    newParts.push({ from: m.to, to: p.to })\n                }\n                parts.splice.apply(parts, newParts)\n                j += newParts.length - 3\n            }\n        }\n        return parts\n    }\n\n    // Connect or disconnect spans from a line.\n    function detachMarkedSpans(line) {\n        var spans = line.markedSpans\n        if (!spans) {\n            return\n        }\n        for (var i = 0; i < spans.length; ++i) {\n            spans[i].marker.detachLine(line)\n        }\n        line.markedSpans = null\n    }\n    function attachMarkedSpans(line, spans) {\n        if (!spans) {\n            return\n        }\n        for (var i = 0; i < spans.length; ++i) {\n            spans[i].marker.attachLine(line)\n        }\n        line.markedSpans = spans\n    }\n\n    // Helpers used when computing which overlapping collapsed span\n    // counts as the larger one.\n    function extraLeft(marker) {\n        return marker.inclusiveLeft ? -1 : 0\n    }\n    function extraRight(marker) {\n        return marker.inclusiveRight ? 1 : 0\n    }\n\n    // Returns a number indicating which of two overlapping collapsed\n    // spans is larger (and thus includes the other). Falls back to\n    // comparing ids when the spans cover exactly the same range.\n    function compareCollapsedMarkers(a, b) {\n        var lenDiff = a.lines.length - b.lines.length\n        if (lenDiff != 0) {\n            return lenDiff\n        }\n        var aPos = a.find(),\n            bPos = b.find()\n        var fromCmp = cmp(aPos.from, bPos.from) || extraLeft(a) - extraLeft(b)\n        if (fromCmp) {\n            return -fromCmp\n        }\n        var toCmp = cmp(aPos.to, bPos.to) || extraRight(a) - extraRight(b)\n        if (toCmp) {\n            return toCmp\n        }\n        return b.id - a.id\n    }\n\n    // Find out whether a line ends or starts in a collapsed span. If\n    // so, return the marker for that span.\n    function collapsedSpanAtSide(line, start) {\n        var sps = sawCollapsedSpans && line.markedSpans,\n            found\n        if (sps) {\n            for (var sp = void 0, i = 0; i < sps.length; ++i) {\n                sp = sps[i]\n                if (\n                    sp.marker.collapsed &&\n                    (start ? sp.from : sp.to) == null &&\n                    (!found || compareCollapsedMarkers(found, sp.marker) < 0)\n                ) {\n                    found = sp.marker\n                }\n            }\n        }\n        return found\n    }\n    function collapsedSpanAtStart(line) {\n        return collapsedSpanAtSide(line, true)\n    }\n    function collapsedSpanAtEnd(line) {\n        return collapsedSpanAtSide(line, false)\n    }\n\n    function collapsedSpanAround(line, ch) {\n        var sps = sawCollapsedSpans && line.markedSpans,\n            found\n        if (sps) {\n            for (var i = 0; i < sps.length; ++i) {\n                var sp = sps[i]\n                if (\n                    sp.marker.collapsed &&\n                    (sp.from == null || sp.from < ch) &&\n                    (sp.to == null || sp.to > ch) &&\n                    (!found || compareCollapsedMarkers(found, sp.marker) < 0)\n                ) {\n                    found = sp.marker\n                }\n            }\n        }\n        return found\n    }\n\n    // Test whether there exists a collapsed span that partially\n    // overlaps (covers the start or end, but not both) of a new span.\n    // Such overlap is not allowed.\n    function conflictingCollapsedRange(doc, lineNo, from, to, marker) {\n        var line = getLine(doc, lineNo)\n        var sps = sawCollapsedSpans && line.markedSpans\n        if (sps) {\n            for (var i = 0; i < sps.length; ++i) {\n                var sp = sps[i]\n                if (!sp.marker.collapsed) {\n                    continue\n                }\n                var found = sp.marker.find(0)\n                var fromCmp = cmp(found.from, from) || extraLeft(sp.marker) - extraLeft(marker)\n                var toCmp = cmp(found.to, to) || extraRight(sp.marker) - extraRight(marker)\n                if ((fromCmp >= 0 && toCmp <= 0) || (fromCmp <= 0 && toCmp >= 0)) {\n                    continue\n                }\n                if (\n                    (fromCmp <= 0 &&\n                        (sp.marker.inclusiveRight && marker.inclusiveLeft\n                            ? cmp(found.to, from) >= 0\n                            : cmp(found.to, from) > 0)) ||\n                    (fromCmp >= 0 &&\n                        (sp.marker.inclusiveRight && marker.inclusiveLeft\n                            ? cmp(found.from, to) <= 0\n                            : cmp(found.from, to) < 0))\n                ) {\n                    return true\n                }\n            }\n        }\n    }\n\n    // A visual line is a line as drawn on the screen. Folding, for\n    // example, can cause multiple logical lines to appear on the same\n    // visual line. This finds the start of the visual line that the\n    // given line is part of (usually that is the line itself).\n    function visualLine(line) {\n        var merged\n        while ((merged = collapsedSpanAtStart(line))) {\n            line = merged.find(-1, true).line\n        }\n        return line\n    }\n\n    function visualLineEnd(line) {\n        var merged\n        while ((merged = collapsedSpanAtEnd(line))) {\n            line = merged.find(1, true).line\n        }\n        return line\n    }\n\n    // Returns an array of logical lines that continue the visual line\n    // started by the argument, or undefined if there are no such lines.\n    function visualLineContinued(line) {\n        var merged, lines\n        while ((merged = collapsedSpanAtEnd(line))) {\n            line = merged.find(1, true).line\n            ;(lines || (lines = [])).push(line)\n        }\n        return lines\n    }\n\n    // Get the line number of the start of the visual line that the\n    // given line number is part of.\n    function visualLineNo(doc, lineN) {\n        var line = getLine(doc, lineN),\n            vis = visualLine(line)\n        if (line == vis) {\n            return lineN\n        }\n        return lineNo(vis)\n    }\n\n    // Get the line number of the start of the next visual line after\n    // the given line.\n    function visualLineEndNo(doc, lineN) {\n        if (lineN > doc.lastLine()) {\n            return lineN\n        }\n        var line = getLine(doc, lineN),\n            merged\n        if (!lineIsHidden(doc, line)) {\n            return lineN\n        }\n        while ((merged = collapsedSpanAtEnd(line))) {\n            line = merged.find(1, true).line\n        }\n        return lineNo(line) + 1\n    }\n\n    // Compute whether a line is hidden. Lines count as hidden when they\n    // are part of a visual line that starts with another line, or when\n    // they are entirely covered by collapsed, non-widget span.\n    function lineIsHidden(doc, line) {\n        var sps = sawCollapsedSpans && line.markedSpans\n        if (sps) {\n            for (var sp = void 0, i = 0; i < sps.length; ++i) {\n                sp = sps[i]\n                if (!sp.marker.collapsed) {\n                    continue\n                }\n                if (sp.from == null) {\n                    return true\n                }\n                if (sp.marker.widgetNode) {\n                    continue\n                }\n                if (sp.from == 0 && sp.marker.inclusiveLeft && lineIsHiddenInner(doc, line, sp)) {\n                    return true\n                }\n            }\n        }\n    }\n    function lineIsHiddenInner(doc, line, span) {\n        if (span.to == null) {\n            var end = span.marker.find(1, true)\n            return lineIsHiddenInner(\n                doc,\n                end.line,\n                getMarkedSpanFor(end.line.markedSpans, span.marker)\n            )\n        }\n        if (span.marker.inclusiveRight && span.to == line.text.length) {\n            return true\n        }\n        for (var sp = void 0, i = 0; i < line.markedSpans.length; ++i) {\n            sp = line.markedSpans[i]\n            if (\n                sp.marker.collapsed &&\n                !sp.marker.widgetNode &&\n                sp.from == span.to &&\n                (sp.to == null || sp.to != span.from) &&\n                (sp.marker.inclusiveLeft || span.marker.inclusiveRight) &&\n                lineIsHiddenInner(doc, line, sp)\n            ) {\n                return true\n            }\n        }\n    }\n\n    // Find the height above the given line.\n    function heightAtLine(lineObj) {\n        lineObj = visualLine(lineObj)\n\n        var h = 0,\n            chunk = lineObj.parent\n        for (var i = 0; i < chunk.lines.length; ++i) {\n            var line = chunk.lines[i]\n            if (line == lineObj) {\n                break\n            } else {\n                h += line.height\n            }\n        }\n        for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {\n            for (var i$1 = 0; i$1 < p.children.length; ++i$1) {\n                var cur = p.children[i$1]\n                if (cur == chunk) {\n                    break\n                } else {\n                    h += cur.height\n                }\n            }\n        }\n        return h\n    }\n\n    // Compute the character length of a line, taking into account\n    // collapsed ranges (see markText) that might hide parts, and join\n    // other lines onto it.\n    function lineLength(line) {\n        if (line.height == 0) {\n            return 0\n        }\n        var len = line.text.length,\n            merged,\n            cur = line\n        while ((merged = collapsedSpanAtStart(cur))) {\n            var found = merged.find(0, true)\n            cur = found.from.line\n            len += found.from.ch - found.to.ch\n        }\n        cur = line\n        while ((merged = collapsedSpanAtEnd(cur))) {\n            var found$1 = merged.find(0, true)\n            len -= cur.text.length - found$1.from.ch\n            cur = found$1.to.line\n            len += cur.text.length - found$1.to.ch\n        }\n        return len\n    }\n\n    // Find the longest line in the document.\n    function findMaxLine(cm) {\n        var d = cm.display,\n            doc = cm.doc\n        d.maxLine = getLine(doc, doc.first)\n        d.maxLineLength = lineLength(d.maxLine)\n        d.maxLineChanged = true\n        doc.iter(function(line) {\n            var len = lineLength(line)\n            if (len > d.maxLineLength) {\n                d.maxLineLength = len\n                d.maxLine = line\n            }\n        })\n    }\n\n    // LINE DATA STRUCTURE\n\n    // Line objects. These hold state related to a line, including\n    // highlighting info (the styles array).\n    var Line = function(text, markedSpans, estimateHeight) {\n        this.text = text\n        attachMarkedSpans(this, markedSpans)\n        this.height = estimateHeight ? estimateHeight(this) : 1\n    }\n\n    Line.prototype.lineNo = function() {\n        return lineNo(this)\n    }\n    eventMixin(Line)\n\n    // Change the content (text, markers) of a line. Automatically\n    // invalidates cached information and tries to re-estimate the\n    // line's height.\n    function updateLine(line, text, markedSpans, estimateHeight) {\n        line.text = text\n        if (line.stateAfter) {\n            line.stateAfter = null\n        }\n        if (line.styles) {\n            line.styles = null\n        }\n        if (line.order != null) {\n            line.order = null\n        }\n        detachMarkedSpans(line)\n        attachMarkedSpans(line, markedSpans)\n        var estHeight = estimateHeight ? estimateHeight(line) : 1\n        if (estHeight != line.height) {\n            updateLineHeight(line, estHeight)\n        }\n    }\n\n    // Detach a line from the document tree and its markers.\n    function cleanUpLine(line) {\n        line.parent = null\n        detachMarkedSpans(line)\n    }\n\n    // Convert a style as returned by a mode (either null, or a string\n    // containing one or more styles) to a CSS style. This is cached,\n    // and also looks for line-wide styles.\n    var styleToClassCache = {},\n        styleToClassCacheWithMode = {}\n    function interpretTokenStyle(style, options) {\n        if (!style || /^\\s*$/.test(style)) {\n            return null\n        }\n        var cache = options.addModeClass ? styleToClassCacheWithMode : styleToClassCache\n        return cache[style] || (cache[style] = style.replace(/\\S+/g, \"cm-$&\"))\n    }\n\n    // Render the DOM representation of the text of a line. Also builds\n    // up a 'line map', which points at the DOM nodes that represent\n    // specific stretches of text, and is used by the measuring code.\n    // The returned object contains the DOM node, this map, and\n    // information about line-wide styles that were set by the mode.\n    function buildLineContent(cm, lineView) {\n        // The padding-right forces the element to have a 'border', which\n        // is needed on Webkit to be able to get line-level bounding\n        // rectangles for it (in measureChar).\n        var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null)\n        var builder = {\n            pre: eltP(\"pre\", [content], \"CodeMirror-line\"),\n            content: content,\n            col: 0,\n            pos: 0,\n            cm: cm,\n            trailingSpace: false,\n            splitSpaces: cm.getOption(\"lineWrapping\")\n        }\n        lineView.measure = {}\n\n        // Iterate over the logical lines that make up this visual line.\n        for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n            var line = i ? lineView.rest[i - 1] : lineView.line,\n                order = void 0\n            builder.pos = 0\n            builder.addToken = buildToken\n            // Optionally wire in some hacks into the token-rendering\n            // algorithm, to deal with browser quirks.\n            if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction))) {\n                builder.addToken = buildTokenBadBidi(builder.addToken, order)\n            }\n            builder.map = []\n            var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line)\n            insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate))\n            if (line.styleClasses) {\n                if (line.styleClasses.bgClass) {\n                    builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\")\n                }\n                if (line.styleClasses.textClass) {\n                    builder.textClass = joinClasses(\n                        line.styleClasses.textClass,\n                        builder.textClass || \"\"\n                    )\n                }\n            }\n\n            // Ensure at least a single node is present, for measuring.\n            if (builder.map.length == 0) {\n                builder.map.push(\n                    0,\n                    0,\n                    builder.content.appendChild(zeroWidthElement(cm.display.measure))\n                )\n            }\n\n            // Store the map and a cache object for the current logical line\n            if (i == 0) {\n                lineView.measure.map = builder.map\n                lineView.measure.cache = {}\n            } else {\n                ;(lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n                ;(lineView.measure.caches || (lineView.measure.caches = [])).push({})\n            }\n        }\n\n        // See issue #2901\n        if (webkit) {\n            var last = builder.content.lastChild\n            if (\n                /\\bcm-tab\\b/.test(last.className) ||\n                (last.querySelector && last.querySelector(\".cm-tab\"))\n            ) {\n                builder.content.className = \"cm-tab-wrap-hack\"\n            }\n        }\n\n        signal(cm, \"renderLine\", cm, lineView.line, builder.pre)\n        if (builder.pre.className) {\n            builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\")\n        }\n\n        return builder\n    }\n\n    function defaultSpecialCharPlaceholder(ch) {\n        var token = elt(\"span\", \"\\u2022\", \"cm-invalidchar\")\n        token.title = \"\\\\u\" + ch.charCodeAt(0).toString(16)\n        token.setAttribute(\"aria-label\", token.title)\n        return token\n    }\n\n    // Build up the DOM representation for a single token, and add it to\n    // the line map. Takes care to render special characters separately.\n    function buildToken(builder, text, style, startStyle, endStyle, css, attributes) {\n        if (!text) {\n            return\n        }\n        var displayText = builder.splitSpaces ? splitSpaces(text, builder.trailingSpace) : text\n        var special = builder.cm.state.specialChars,\n            mustWrap = false\n        var content\n        if (!special.test(text)) {\n            builder.col += text.length\n            content = document.createTextNode(displayText)\n            builder.map.push(builder.pos, builder.pos + text.length, content)\n            if (ie && ie_version < 9) {\n                mustWrap = true\n            }\n            builder.pos += text.length\n        } else {\n            content = document.createDocumentFragment()\n            var pos = 0\n            while (true) {\n                special.lastIndex = pos\n                var m = special.exec(text)\n                var skipped = m ? m.index - pos : text.length - pos\n                if (skipped) {\n                    var txt = document.createTextNode(displayText.slice(pos, pos + skipped))\n                    if (ie && ie_version < 9) {\n                        content.appendChild(elt(\"span\", [txt]))\n                    } else {\n                        content.appendChild(txt)\n                    }\n                    builder.map.push(builder.pos, builder.pos + skipped, txt)\n                    builder.col += skipped\n                    builder.pos += skipped\n                }\n                if (!m) {\n                    break\n                }\n                pos += skipped + 1\n                var txt$1 = void 0\n                if (m[0] == \"\\t\") {\n                    var tabSize = builder.cm.options.tabSize,\n                        tabWidth = tabSize - (builder.col % tabSize)\n                    txt$1 = content.appendChild(elt(\"span\", spaceStr(tabWidth), \"cm-tab\"))\n                    txt$1.setAttribute(\"role\", \"presentation\")\n                    txt$1.setAttribute(\"cm-text\", \"\\t\")\n                    builder.col += tabWidth\n                } else if (m[0] == \"\\r\" || m[0] == \"\\n\") {\n                    txt$1 = content.appendChild(\n                        elt(\"span\", m[0] == \"\\r\" ? \"\\u240d\" : \"\\u2424\", \"cm-invalidchar\")\n                    )\n                    txt$1.setAttribute(\"cm-text\", m[0])\n                    builder.col += 1\n                } else {\n                    txt$1 = builder.cm.options.specialCharPlaceholder(m[0])\n                    txt$1.setAttribute(\"cm-text\", m[0])\n                    if (ie && ie_version < 9) {\n                        content.appendChild(elt(\"span\", [txt$1]))\n                    } else {\n                        content.appendChild(txt$1)\n                    }\n                    builder.col += 1\n                }\n                builder.map.push(builder.pos, builder.pos + 1, txt$1)\n                builder.pos++\n            }\n        }\n        builder.trailingSpace = displayText.charCodeAt(text.length - 1) == 32\n        if (style || startStyle || endStyle || mustWrap || css) {\n            var fullStyle = style || \"\"\n            if (startStyle) {\n                fullStyle += startStyle\n            }\n            if (endStyle) {\n                fullStyle += endStyle\n            }\n            var token = elt(\"span\", [content], fullStyle, css)\n            if (attributes) {\n                for (var attr in attributes) {\n                    if (attributes.hasOwnProperty(attr) && attr != \"style\" && attr != \"class\") {\n                        token.setAttribute(attr, attributes[attr])\n                    }\n                }\n            }\n            return builder.content.appendChild(token)\n        }\n        builder.content.appendChild(content)\n    }\n\n    // Change some spaces to NBSP to prevent the browser from collapsing\n    // trailing spaces at the end of a line when rendering text (issue #1362).\n    function splitSpaces(text, trailingBefore) {\n        if (text.length > 1 && !/  /.test(text)) {\n            return text\n        }\n        var spaceBefore = trailingBefore,\n            result = \"\"\n        for (var i = 0; i < text.length; i++) {\n            var ch = text.charAt(i)\n            if (\n                ch == \" \" &&\n                spaceBefore &&\n                (i == text.length - 1 || text.charCodeAt(i + 1) == 32)\n            ) {\n                ch = \"\\u00a0\"\n            }\n            result += ch\n            spaceBefore = ch == \" \"\n        }\n        return result\n    }\n\n    // Work around nonsense dimensions being reported for stretches of\n    // right-to-left text.\n    function buildTokenBadBidi(inner, order) {\n        return function(builder, text, style, startStyle, endStyle, css, attributes) {\n            style = style ? style + \" cm-force-border\" : \"cm-force-border\"\n            var start = builder.pos,\n                end = start + text.length\n            for (;;) {\n                // Find the part that overlaps with the start of this text\n                var part = void 0\n                for (var i = 0; i < order.length; i++) {\n                    part = order[i]\n                    if (part.to > start && part.from <= start) {\n                        break\n                    }\n                }\n                if (part.to >= end) {\n                    return inner(builder, text, style, startStyle, endStyle, css, attributes)\n                }\n                inner(\n                    builder,\n                    text.slice(0, part.to - start),\n                    style,\n                    startStyle,\n                    null,\n                    css,\n                    attributes\n                )\n                startStyle = null\n                text = text.slice(part.to - start)\n                start = part.to\n            }\n        }\n    }\n\n    function buildCollapsedSpan(builder, size, marker, ignoreWidget) {\n        var widget = !ignoreWidget && marker.widgetNode\n        if (widget) {\n            builder.map.push(builder.pos, builder.pos + size, widget)\n        }\n        if (!ignoreWidget && builder.cm.display.input.needsContentAttribute) {\n            if (!widget) {\n                widget = builder.content.appendChild(document.createElement(\"span\"))\n            }\n            widget.setAttribute(\"cm-marker\", marker.id)\n        }\n        if (widget) {\n            builder.cm.display.input.setUneditable(widget)\n            builder.content.appendChild(widget)\n        }\n        builder.pos += size\n        builder.trailingSpace = false\n    }\n\n    // Outputs a number of spans to make up a line, taking highlighting\n    // and marked text into account.\n    function insertLineContent(line, builder, styles) {\n        var spans = line.markedSpans,\n            allText = line.text,\n            at = 0\n        if (!spans) {\n            for (var i$1 = 1; i$1 < styles.length; i$1 += 2) {\n                builder.addToken(\n                    builder,\n                    allText.slice(at, (at = styles[i$1])),\n                    interpretTokenStyle(styles[i$1 + 1], builder.cm.options)\n                )\n            }\n            return\n        }\n\n        var len = allText.length,\n            pos = 0,\n            i = 1,\n            text = \"\",\n            style,\n            css\n        var nextChange = 0,\n            spanStyle,\n            spanEndStyle,\n            spanStartStyle,\n            collapsed,\n            attributes\n        for (;;) {\n            if (nextChange == pos) {\n                // Update current marker set\n                spanStyle = spanEndStyle = spanStartStyle = css = \"\"\n                attributes = null\n                collapsed = null\n                nextChange = Infinity\n                var foundBookmarks = [],\n                    endStyles = void 0\n                for (var j = 0; j < spans.length; ++j) {\n                    var sp = spans[j],\n                        m = sp.marker\n                    if (m.type == \"bookmark\" && sp.from == pos && m.widgetNode) {\n                        foundBookmarks.push(m)\n                    } else if (\n                        sp.from <= pos &&\n                        (sp.to == null ||\n                            sp.to > pos ||\n                            (m.collapsed && sp.to == pos && sp.from == pos))\n                    ) {\n                        if (sp.to != null && sp.to != pos && nextChange > sp.to) {\n                            nextChange = sp.to\n                            spanEndStyle = \"\"\n                        }\n                        if (m.className) {\n                            spanStyle += \" \" + m.className\n                        }\n                        if (m.css) {\n                            css = (css ? css + \";\" : \"\") + m.css\n                        }\n                        if (m.startStyle && sp.from == pos) {\n                            spanStartStyle += \" \" + m.startStyle\n                        }\n                        if (m.endStyle && sp.to == nextChange) {\n                            ;(endStyles || (endStyles = [])).push(m.endStyle, sp.to)\n                        }\n                        // support for the old title property\n                        // https://github.com/codemirror/CodeMirror/pull/5673\n                        if (m.title) {\n                            ;(attributes || (attributes = {})).title = m.title\n                        }\n                        if (m.attributes) {\n                            for (var attr in m.attributes) {\n                                ;(attributes || (attributes = {}))[attr] = m.attributes[attr]\n                            }\n                        }\n                        if (\n                            m.collapsed &&\n                            (!collapsed || compareCollapsedMarkers(collapsed.marker, m) < 0)\n                        ) {\n                            collapsed = sp\n                        }\n                    } else if (sp.from > pos && nextChange > sp.from) {\n                        nextChange = sp.from\n                    }\n                }\n                if (endStyles) {\n                    for (var j$1 = 0; j$1 < endStyles.length; j$1 += 2) {\n                        if (endStyles[j$1 + 1] == nextChange) {\n                            spanEndStyle += \" \" + endStyles[j$1]\n                        }\n                    }\n                }\n\n                if (!collapsed || collapsed.from == pos) {\n                    for (var j$2 = 0; j$2 < foundBookmarks.length; ++j$2) {\n                        buildCollapsedSpan(builder, 0, foundBookmarks[j$2])\n                    }\n                }\n                if (collapsed && (collapsed.from || 0) == pos) {\n                    buildCollapsedSpan(\n                        builder,\n                        (collapsed.to == null ? len + 1 : collapsed.to) - pos,\n                        collapsed.marker,\n                        collapsed.from == null\n                    )\n                    if (collapsed.to == null) {\n                        return\n                    }\n                    if (collapsed.to == pos) {\n                        collapsed = false\n                    }\n                }\n            }\n            if (pos >= len) {\n                break\n            }\n\n            var upto = Math.min(len, nextChange)\n            while (true) {\n                if (text) {\n                    var end = pos + text.length\n                    if (!collapsed) {\n                        var tokenText = end > upto ? text.slice(0, upto - pos) : text\n                        builder.addToken(\n                            builder,\n                            tokenText,\n                            style ? style + spanStyle : spanStyle,\n                            spanStartStyle,\n                            pos + tokenText.length == nextChange ? spanEndStyle : \"\",\n                            css,\n                            attributes\n                        )\n                    }\n                    if (end >= upto) {\n                        text = text.slice(upto - pos)\n                        pos = upto\n                        break\n                    }\n                    pos = end\n                    spanStartStyle = \"\"\n                }\n                text = allText.slice(at, (at = styles[i++]))\n                style = interpretTokenStyle(styles[i++], builder.cm.options)\n            }\n        }\n    }\n\n    // These objects are used to represent the visible (currently drawn)\n    // part of the document. A LineView may correspond to multiple\n    // logical lines, if those are connected by collapsed ranges.\n    function LineView(doc, line, lineN) {\n        // The starting line\n        this.line = line\n        // Continuing lines, if any\n        this.rest = visualLineContinued(line)\n        // Number of logical lines in this visual line\n        this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1\n        this.node = this.text = null\n        this.hidden = lineIsHidden(doc, line)\n    }\n\n    // Create a range of LineView objects for the given lines.\n    function buildViewArray(cm, from, to) {\n        var array = [],\n            nextPos\n        for (var pos = from; pos < to; pos = nextPos) {\n            var view = new LineView(cm.doc, getLine(cm.doc, pos), pos)\n            nextPos = pos + view.size\n            array.push(view)\n        }\n        return array\n    }\n\n    var operationGroup = null\n\n    function pushOperation(op) {\n        if (operationGroup) {\n            operationGroup.ops.push(op)\n        } else {\n            op.ownsGroup = operationGroup = {\n                ops: [op],\n                delayedCallbacks: []\n            }\n        }\n    }\n\n    function fireCallbacksForOps(group) {\n        // Calls delayed callbacks and cursorActivity handlers until no\n        // new ones appear\n        var callbacks = group.delayedCallbacks,\n            i = 0\n        do {\n            for (; i < callbacks.length; i++) {\n                callbacks[i].call(null)\n            }\n            for (var j = 0; j < group.ops.length; j++) {\n                var op = group.ops[j]\n                if (op.cursorActivityHandlers) {\n                    while (op.cursorActivityCalled < op.cursorActivityHandlers.length) {\n                        op.cursorActivityHandlers[op.cursorActivityCalled++].call(null, op.cm)\n                    }\n                }\n            }\n        } while (i < callbacks.length)\n    }\n\n    function finishOperation(op, endCb) {\n        var group = op.ownsGroup\n        if (!group) {\n            return\n        }\n\n        try {\n            fireCallbacksForOps(group)\n        } finally {\n            operationGroup = null\n            endCb(group)\n        }\n    }\n\n    var orphanDelayedCallbacks = null\n\n    // Often, we want to signal events at a point where we are in the\n    // middle of some work, but don't want the handler to start calling\n    // other methods on the editor, which might be in an inconsistent\n    // state or simply not expect any other events to happen.\n    // signalLater looks whether there are any handlers, and schedules\n    // them to be executed when the last operation ends, or, if no\n    // operation is active, when a timeout fires.\n    function signalLater(emitter, type /*, values...*/) {\n        var arr = getHandlers(emitter, type)\n        if (!arr.length) {\n            return\n        }\n        var args = Array.prototype.slice.call(arguments, 2),\n            list\n        if (operationGroup) {\n            list = operationGroup.delayedCallbacks\n        } else if (orphanDelayedCallbacks) {\n            list = orphanDelayedCallbacks\n        } else {\n            list = orphanDelayedCallbacks = []\n            setTimeout(fireOrphanDelayed, 0)\n        }\n        var loop = function(i) {\n            list.push(function() {\n                return arr[i].apply(null, args)\n            })\n        }\n\n        for (var i = 0; i < arr.length; ++i) loop(i)\n    }\n\n    function fireOrphanDelayed() {\n        var delayed = orphanDelayedCallbacks\n        orphanDelayedCallbacks = null\n        for (var i = 0; i < delayed.length; ++i) {\n            delayed[i]()\n        }\n    }\n\n    // When an aspect of a line changes, a string is added to\n    // lineView.changes. This updates the relevant part of the line's\n    // DOM structure.\n    function updateLineForChanges(cm, lineView, lineN, dims) {\n        for (var j = 0; j < lineView.changes.length; j++) {\n            var type = lineView.changes[j]\n            if (type == \"text\") {\n                updateLineText(cm, lineView)\n            } else if (type == \"gutter\") {\n                updateLineGutter(cm, lineView, lineN, dims)\n            } else if (type == \"class\") {\n                updateLineClasses(cm, lineView)\n            } else if (type == \"widget\") {\n                updateLineWidgets(cm, lineView, dims)\n            }\n        }\n        lineView.changes = null\n    }\n\n    // Lines with gutter elements, widgets or a background class need to\n    // be wrapped, and have the extra elements added to the wrapper div\n    function ensureLineWrapped(lineView) {\n        if (lineView.node == lineView.text) {\n            lineView.node = elt(\"div\", null, null, \"position: relative\")\n            if (lineView.text.parentNode) {\n                lineView.text.parentNode.replaceChild(lineView.node, lineView.text)\n            }\n            lineView.node.appendChild(lineView.text)\n            if (ie && ie_version < 8) {\n                lineView.node.style.zIndex = 2\n            }\n        }\n        return lineView.node\n    }\n\n    function updateLineBackground(cm, lineView) {\n        var cls = lineView.bgClass\n            ? lineView.bgClass + \" \" + (lineView.line.bgClass || \"\")\n            : lineView.line.bgClass\n        if (cls) {\n            cls += \" CodeMirror-linebackground\"\n        }\n        if (lineView.background) {\n            if (cls) {\n                lineView.background.className = cls\n            } else {\n                lineView.background.parentNode.removeChild(lineView.background)\n                lineView.background = null\n            }\n        } else if (cls) {\n            var wrap = ensureLineWrapped(lineView)\n            lineView.background = wrap.insertBefore(elt(\"div\", null, cls), wrap.firstChild)\n            cm.display.input.setUneditable(lineView.background)\n        }\n    }\n\n    // Wrapper around buildLineContent which will reuse the structure\n    // in display.externalMeasured when possible.\n    function getLineContent(cm, lineView) {\n        var ext = cm.display.externalMeasured\n        if (ext && ext.line == lineView.line) {\n            cm.display.externalMeasured = null\n            lineView.measure = ext.measure\n            return ext.built\n        }\n        return buildLineContent(cm, lineView)\n    }\n\n    // Redraw the line's text. Interacts with the background and text\n    // classes because the mode may output tokens that influence these\n    // classes.\n    function updateLineText(cm, lineView) {\n        var cls = lineView.text.className\n        var built = getLineContent(cm, lineView)\n        if (lineView.text == lineView.node) {\n            lineView.node = built.pre\n        }\n        lineView.text.parentNode.replaceChild(built.pre, lineView.text)\n        lineView.text = built.pre\n        if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n            lineView.bgClass = built.bgClass\n            lineView.textClass = built.textClass\n            updateLineClasses(cm, lineView)\n        } else if (cls) {\n            lineView.text.className = cls\n        }\n    }\n\n    function updateLineClasses(cm, lineView) {\n        updateLineBackground(cm, lineView)\n        if (lineView.line.wrapClass) {\n            ensureLineWrapped(lineView).className = lineView.line.wrapClass\n        } else if (lineView.node != lineView.text) {\n            lineView.node.className = \"\"\n        }\n        var textClass = lineView.textClass\n            ? lineView.textClass + \" \" + (lineView.line.textClass || \"\")\n            : lineView.line.textClass\n        lineView.text.className = textClass || \"\"\n    }\n\n    function updateLineGutter(cm, lineView, lineN, dims) {\n        if (lineView.gutter) {\n            lineView.node.removeChild(lineView.gutter)\n            lineView.gutter = null\n        }\n        if (lineView.gutterBackground) {\n            lineView.node.removeChild(lineView.gutterBackground)\n            lineView.gutterBackground = null\n        }\n        if (lineView.line.gutterClass) {\n            var wrap = ensureLineWrapped(lineView)\n            lineView.gutterBackground = elt(\n                \"div\",\n                null,\n                \"CodeMirror-gutter-background \" + lineView.line.gutterClass,\n                \"left: \" +\n                    (cm.options.fixedGutter ? dims.fixedPos : -dims.gutterTotalWidth) +\n                    \"px; width: \" +\n                    dims.gutterTotalWidth +\n                    \"px\"\n            )\n            cm.display.input.setUneditable(lineView.gutterBackground)\n            wrap.insertBefore(lineView.gutterBackground, lineView.text)\n        }\n        var markers = lineView.line.gutterMarkers\n        if (cm.options.lineNumbers || markers) {\n            var wrap$1 = ensureLineWrapped(lineView)\n            var gutterWrap = (lineView.gutter = elt(\n                \"div\",\n                null,\n                \"CodeMirror-gutter-wrapper\",\n                \"left: \" + (cm.options.fixedGutter ? dims.fixedPos : -dims.gutterTotalWidth) + \"px\"\n            ))\n            cm.display.input.setUneditable(gutterWrap)\n            wrap$1.insertBefore(gutterWrap, lineView.text)\n            if (lineView.line.gutterClass) {\n                gutterWrap.className += \" \" + lineView.line.gutterClass\n            }\n            if (cm.options.lineNumbers && (!markers || !markers[\"CodeMirror-linenumbers\"])) {\n                lineView.lineNumber = gutterWrap.appendChild(\n                    elt(\n                        \"div\",\n                        lineNumberFor(cm.options, lineN),\n                        \"CodeMirror-linenumber CodeMirror-gutter-elt\",\n                        \"left: \" +\n                            dims.gutterLeft[\"CodeMirror-linenumbers\"] +\n                            \"px; width: \" +\n                            cm.display.lineNumInnerWidth +\n                            \"px\"\n                    )\n                )\n            }\n            if (markers) {\n                for (var k = 0; k < cm.display.gutterSpecs.length; ++k) {\n                    var id = cm.display.gutterSpecs[k].className,\n                        found = markers.hasOwnProperty(id) && markers[id]\n                    if (found) {\n                        gutterWrap.appendChild(\n                            elt(\n                                \"div\",\n                                [found],\n                                \"CodeMirror-gutter-elt\",\n                                \"left: \" +\n                                    dims.gutterLeft[id] +\n                                    \"px; width: \" +\n                                    dims.gutterWidth[id] +\n                                    \"px\"\n                            )\n                        )\n                    }\n                }\n            }\n        }\n    }\n\n    function updateLineWidgets(cm, lineView, dims) {\n        if (lineView.alignable) {\n            lineView.alignable = null\n        }\n        var isWidget = classTest(\"CodeMirror-linewidget\")\n        for (var node = lineView.node.firstChild, next = void 0; node; node = next) {\n            next = node.nextSibling\n            if (isWidget.test(node.className)) {\n                lineView.node.removeChild(node)\n            }\n        }\n        insertLineWidgets(cm, lineView, dims)\n    }\n\n    // Build a line's DOM representation from scratch\n    function buildLineElement(cm, lineView, lineN, dims) {\n        var built = getLineContent(cm, lineView)\n        lineView.text = lineView.node = built.pre\n        if (built.bgClass) {\n            lineView.bgClass = built.bgClass\n        }\n        if (built.textClass) {\n            lineView.textClass = built.textClass\n        }\n\n        updateLineClasses(cm, lineView)\n        updateLineGutter(cm, lineView, lineN, dims)\n        insertLineWidgets(cm, lineView, dims)\n        return lineView.node\n    }\n\n    // A lineView may contain multiple logical lines (when merged by\n    // collapsed spans). The widgets for all of them need to be drawn.\n    function insertLineWidgets(cm, lineView, dims) {\n        insertLineWidgetsFor(cm, lineView.line, lineView, dims, true)\n        if (lineView.rest) {\n            for (var i = 0; i < lineView.rest.length; i++) {\n                insertLineWidgetsFor(cm, lineView.rest[i], lineView, dims, false)\n            }\n        }\n    }\n\n    function insertLineWidgetsFor(cm, line, lineView, dims, allowAbove) {\n        if (!line.widgets) {\n            return\n        }\n        var wrap = ensureLineWrapped(lineView)\n        for (var i = 0, ws = line.widgets; i < ws.length; ++i) {\n            var widget = ws[i],\n                node = elt(\n                    \"div\",\n                    [widget.node],\n                    \"CodeMirror-linewidget\" + (widget.className ? \" \" + widget.className : \"\")\n                )\n            if (!widget.handleMouseEvents) {\n                node.setAttribute(\"cm-ignore-events\", \"true\")\n            }\n            positionLineWidget(widget, node, lineView, dims)\n            cm.display.input.setUneditable(node)\n            if (allowAbove && widget.above) {\n                wrap.insertBefore(node, lineView.gutter || lineView.text)\n            } else {\n                wrap.appendChild(node)\n            }\n            signalLater(widget, \"redraw\")\n        }\n    }\n\n    function positionLineWidget(widget, node, lineView, dims) {\n        if (widget.noHScroll) {\n            ;(lineView.alignable || (lineView.alignable = [])).push(node)\n            var width = dims.wrapperWidth\n            node.style.left = dims.fixedPos + \"px\"\n            if (!widget.coverGutter) {\n                width -= dims.gutterTotalWidth\n                node.style.paddingLeft = dims.gutterTotalWidth + \"px\"\n            }\n            node.style.width = width + \"px\"\n        }\n        if (widget.coverGutter) {\n            node.style.zIndex = 5\n            node.style.position = \"relative\"\n            if (!widget.noHScroll) {\n                node.style.marginLeft = -dims.gutterTotalWidth + \"px\"\n            }\n        }\n    }\n\n    function widgetHeight(widget) {\n        if (widget.height != null) {\n            return widget.height\n        }\n        var cm = widget.doc.cm\n        if (!cm) {\n            return 0\n        }\n        if (!contains(document.body, widget.node)) {\n            var parentStyle = \"position: relative;\"\n            if (widget.coverGutter) {\n                parentStyle += \"margin-left: -\" + cm.display.gutters.offsetWidth + \"px;\"\n            }\n            if (widget.noHScroll) {\n                parentStyle += \"width: \" + cm.display.wrapper.clientWidth + \"px;\"\n            }\n            removeChildrenAndAdd(cm.display.measure, elt(\"div\", [widget.node], null, parentStyle))\n        }\n        return (widget.height = widget.node.parentNode.offsetHeight)\n    }\n\n    // Return true when the given mouse event happened in a widget\n    function eventInWidget(display, e) {\n        for (var n = e_target(e); n != display.wrapper; n = n.parentNode) {\n            if (\n                !n ||\n                (n.nodeType == 1 && n.getAttribute(\"cm-ignore-events\") == \"true\") ||\n                (n.parentNode == display.sizer && n != display.mover)\n            ) {\n                return true\n            }\n        }\n    }\n\n    // POSITION MEASUREMENT\n\n    function paddingTop(display) {\n        return display.lineSpace.offsetTop\n    }\n    function paddingVert(display) {\n        return display.mover.offsetHeight - display.lineSpace.offsetHeight\n    }\n    function paddingH(display) {\n        if (display.cachedPaddingH) {\n            return display.cachedPaddingH\n        }\n        var e = removeChildrenAndAdd(display.measure, elt(\"pre\", \"x\", \"CodeMirror-line-like\"))\n        var style = window.getComputedStyle ? window.getComputedStyle(e) : e.currentStyle\n        var data = { left: parseInt(style.paddingLeft), right: parseInt(style.paddingRight) }\n        if (!isNaN(data.left) && !isNaN(data.right)) {\n            display.cachedPaddingH = data\n        }\n        return data\n    }\n\n    function scrollGap(cm) {\n        return scrollerGap - cm.display.nativeBarWidth\n    }\n    function displayWidth(cm) {\n        return cm.display.scroller.clientWidth - scrollGap(cm) - cm.display.barWidth\n    }\n    function displayHeight(cm) {\n        return cm.display.scroller.clientHeight - scrollGap(cm) - cm.display.barHeight\n    }\n\n    // Ensure the lineView.wrapping.heights array is populated. This is\n    // an array of bottom offsets for the lines that make up a drawn\n    // line. When lineWrapping is on, there might be more than one\n    // height.\n    function ensureLineHeights(cm, lineView, rect) {\n        var wrapping = cm.options.lineWrapping\n        var curWidth = wrapping && displayWidth(cm)\n        if (!lineView.measure.heights || (wrapping && lineView.measure.width != curWidth)) {\n            var heights = (lineView.measure.heights = [])\n            if (wrapping) {\n                lineView.measure.width = curWidth\n                var rects = lineView.text.firstChild.getClientRects()\n                for (var i = 0; i < rects.length - 1; i++) {\n                    var cur = rects[i],\n                        next = rects[i + 1]\n                    if (Math.abs(cur.bottom - next.bottom) > 2) {\n                        heights.push((cur.bottom + next.top) / 2 - rect.top)\n                    }\n                }\n            }\n            heights.push(rect.bottom - rect.top)\n        }\n    }\n\n    // Find a line map (mapping character offsets to text nodes) and a\n    // measurement cache for the given line number. (A line view might\n    // contain multiple lines when collapsed ranges are present.)\n    function mapFromLineView(lineView, line, lineN) {\n        if (lineView.line == line) {\n            return { map: lineView.measure.map, cache: lineView.measure.cache }\n        }\n        for (var i = 0; i < lineView.rest.length; i++) {\n            if (lineView.rest[i] == line) {\n                return { map: lineView.measure.maps[i], cache: lineView.measure.caches[i] }\n            }\n        }\n        for (var i$1 = 0; i$1 < lineView.rest.length; i$1++) {\n            if (lineNo(lineView.rest[i$1]) > lineN) {\n                return {\n                    map: lineView.measure.maps[i$1],\n                    cache: lineView.measure.caches[i$1],\n                    before: true\n                }\n            }\n        }\n    }\n\n    // Render a line into the hidden node display.externalMeasured. Used\n    // when measurement is needed for a line that's not in the viewport.\n    function updateExternalMeasurement(cm, line) {\n        line = visualLine(line)\n        var lineN = lineNo(line)\n        var view = (cm.display.externalMeasured = new LineView(cm.doc, line, lineN))\n        view.lineN = lineN\n        var built = (view.built = buildLineContent(cm, view))\n        view.text = built.pre\n        removeChildrenAndAdd(cm.display.lineMeasure, built.pre)\n        return view\n    }\n\n    // Get a {top, bottom, left, right} box (in line-local coordinates)\n    // for a given character.\n    function measureChar(cm, line, ch, bias) {\n        return measureCharPrepared(cm, prepareMeasureForLine(cm, line), ch, bias)\n    }\n\n    // Find a line view that corresponds to the given line number.\n    function findViewForLine(cm, lineN) {\n        if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo) {\n            return cm.display.view[findViewIndex(cm, lineN)]\n        }\n        var ext = cm.display.externalMeasured\n        if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size) {\n            return ext\n        }\n    }\n\n    // Measurement can be split in two steps, the set-up work that\n    // applies to the whole line, and the measurement of the actual\n    // character. Functions like coordsChar, that need to do a lot of\n    // measurements in a row, can thus ensure that the set-up work is\n    // only done once.\n    function prepareMeasureForLine(cm, line) {\n        var lineN = lineNo(line)\n        var view = findViewForLine(cm, lineN)\n        if (view && !view.text) {\n            view = null\n        } else if (view && view.changes) {\n            updateLineForChanges(cm, view, lineN, getDimensions(cm))\n            cm.curOp.forceUpdate = true\n        }\n        if (!view) {\n            view = updateExternalMeasurement(cm, line)\n        }\n\n        var info = mapFromLineView(view, line, lineN)\n        return {\n            line: line,\n            view: view,\n            rect: null,\n            map: info.map,\n            cache: info.cache,\n            before: info.before,\n            hasHeights: false\n        }\n    }\n\n    // Given a prepared measurement object, measures the position of an\n    // actual character (or fetches it from the cache).\n    function measureCharPrepared(cm, prepared, ch, bias, varHeight) {\n        if (prepared.before) {\n            ch = -1\n        }\n        var key = ch + (bias || \"\"),\n            found\n        if (prepared.cache.hasOwnProperty(key)) {\n            found = prepared.cache[key]\n        } else {\n            if (!prepared.rect) {\n                prepared.rect = prepared.view.text.getBoundingClientRect()\n            }\n            if (!prepared.hasHeights) {\n                ensureLineHeights(cm, prepared.view, prepared.rect)\n                prepared.hasHeights = true\n            }\n            found = measureCharInner(cm, prepared, ch, bias)\n            if (!found.bogus) {\n                prepared.cache[key] = found\n            }\n        }\n        return {\n            left: found.left,\n            right: found.right,\n            top: varHeight ? found.rtop : found.top,\n            bottom: varHeight ? found.rbottom : found.bottom\n        }\n    }\n\n    var nullRect = { left: 0, right: 0, top: 0, bottom: 0 }\n\n    function nodeAndOffsetInLineMap(map, ch, bias) {\n        var node, start, end, collapse, mStart, mEnd\n        // First, search the line map for the text node corresponding to,\n        // or closest to, the target character.\n        for (var i = 0; i < map.length; i += 3) {\n            mStart = map[i]\n            mEnd = map[i + 1]\n            if (ch < mStart) {\n                start = 0\n                end = 1\n                collapse = \"left\"\n            } else if (ch < mEnd) {\n                start = ch - mStart\n                end = start + 1\n            } else if (i == map.length - 3 || (ch == mEnd && map[i + 3] > ch)) {\n                end = mEnd - mStart\n                start = end - 1\n                if (ch >= mEnd) {\n                    collapse = \"right\"\n                }\n            }\n            if (start != null) {\n                node = map[i + 2]\n                if (mStart == mEnd && bias == (node.insertLeft ? \"left\" : \"right\")) {\n                    collapse = bias\n                }\n                if (bias == \"left\" && start == 0) {\n                    while (i && map[i - 2] == map[i - 3] && map[i - 1].insertLeft) {\n                        node = map[(i -= 3) + 2]\n                        collapse = \"left\"\n                    }\n                }\n                if (bias == \"right\" && start == mEnd - mStart) {\n                    while (\n                        i < map.length - 3 &&\n                        map[i + 3] == map[i + 4] &&\n                        !map[i + 5].insertLeft\n                    ) {\n                        node = map[(i += 3) + 2]\n                        collapse = \"right\"\n                    }\n                }\n                break\n            }\n        }\n        return {\n            node: node,\n            start: start,\n            end: end,\n            collapse: collapse,\n            coverStart: mStart,\n            coverEnd: mEnd\n        }\n    }\n\n    function getUsefulRect(rects, bias) {\n        var rect = nullRect\n        if (bias == \"left\") {\n            for (var i = 0; i < rects.length; i++) {\n                if ((rect = rects[i]).left != rect.right) {\n                    break\n                }\n            }\n        } else {\n            for (var i$1 = rects.length - 1; i$1 >= 0; i$1--) {\n                if ((rect = rects[i$1]).left != rect.right) {\n                    break\n                }\n            }\n        }\n        return rect\n    }\n\n    function measureCharInner(cm, prepared, ch, bias) {\n        var place = nodeAndOffsetInLineMap(prepared.map, ch, bias)\n        var node = place.node,\n            start = place.start,\n            end = place.end,\n            collapse = place.collapse\n\n        var rect\n        if (node.nodeType == 3) {\n            // If it is a text node, use a range to retrieve the coordinates.\n            for (var i$1 = 0; i$1 < 4; i$1++) {\n                // Retry a maximum of 4 times when nonsense rectangles are returned\n                while (\n                    start &&\n                    isExtendingChar(prepared.line.text.charAt(place.coverStart + start))\n                ) {\n                    --start\n                }\n                while (\n                    place.coverStart + end < place.coverEnd &&\n                    isExtendingChar(prepared.line.text.charAt(place.coverStart + end))\n                ) {\n                    ++end\n                }\n                if (\n                    ie &&\n                    ie_version < 9 &&\n                    start == 0 &&\n                    end == place.coverEnd - place.coverStart\n                ) {\n                    rect = node.parentNode.getBoundingClientRect()\n                } else {\n                    rect = getUsefulRect(range(node, start, end).getClientRects(), bias)\n                }\n                if (rect.left || rect.right || start == 0) {\n                    break\n                }\n                end = start\n                start = start - 1\n                collapse = \"right\"\n            }\n            if (ie && ie_version < 11) {\n                rect = maybeUpdateRectForZooming(cm.display.measure, rect)\n            }\n        } else {\n            // If it is a widget, simply get the box for the whole widget.\n            if (start > 0) {\n                collapse = bias = \"right\"\n            }\n            var rects\n            if (cm.options.lineWrapping && (rects = node.getClientRects()).length > 1) {\n                rect = rects[bias == \"right\" ? rects.length - 1 : 0]\n            } else {\n                rect = node.getBoundingClientRect()\n            }\n        }\n        if (ie && ie_version < 9 && !start && (!rect || (!rect.left && !rect.right))) {\n            var rSpan = node.parentNode.getClientRects()[0]\n            if (rSpan) {\n                rect = {\n                    left: rSpan.left,\n                    right: rSpan.left + charWidth(cm.display),\n                    top: rSpan.top,\n                    bottom: rSpan.bottom\n                }\n            } else {\n                rect = nullRect\n            }\n        }\n\n        var rtop = rect.top - prepared.rect.top,\n            rbot = rect.bottom - prepared.rect.top\n        var mid = (rtop + rbot) / 2\n        var heights = prepared.view.measure.heights\n        var i = 0\n        for (; i < heights.length - 1; i++) {\n            if (mid < heights[i]) {\n                break\n            }\n        }\n        var top = i ? heights[i - 1] : 0,\n            bot = heights[i]\n        var result = {\n            left: (collapse == \"right\" ? rect.right : rect.left) - prepared.rect.left,\n            right: (collapse == \"left\" ? rect.left : rect.right) - prepared.rect.left,\n            top: top,\n            bottom: bot\n        }\n        if (!rect.left && !rect.right) {\n            result.bogus = true\n        }\n        if (!cm.options.singleCursorHeightPerLine) {\n            result.rtop = rtop\n            result.rbottom = rbot\n        }\n\n        return result\n    }\n\n    // Work around problem with bounding client rects on ranges being\n    // returned incorrectly when zoomed on IE10 and below.\n    function maybeUpdateRectForZooming(measure, rect) {\n        if (\n            !window.screen ||\n            screen.logicalXDPI == null ||\n            screen.logicalXDPI == screen.deviceXDPI ||\n            !hasBadZoomedRects(measure)\n        ) {\n            return rect\n        }\n        var scaleX = screen.logicalXDPI / screen.deviceXDPI\n        var scaleY = screen.logicalYDPI / screen.deviceYDPI\n        return {\n            left: rect.left * scaleX,\n            right: rect.right * scaleX,\n            top: rect.top * scaleY,\n            bottom: rect.bottom * scaleY\n        }\n    }\n\n    function clearLineMeasurementCacheFor(lineView) {\n        if (lineView.measure) {\n            lineView.measure.cache = {}\n            lineView.measure.heights = null\n            if (lineView.rest) {\n                for (var i = 0; i < lineView.rest.length; i++) {\n                    lineView.measure.caches[i] = {}\n                }\n            }\n        }\n    }\n\n    function clearLineMeasurementCache(cm) {\n        cm.display.externalMeasure = null\n        removeChildren(cm.display.lineMeasure)\n        for (var i = 0; i < cm.display.view.length; i++) {\n            clearLineMeasurementCacheFor(cm.display.view[i])\n        }\n    }\n\n    function clearCaches(cm) {\n        clearLineMeasurementCache(cm)\n        cm.display.cachedCharWidth = cm.display.cachedTextHeight = cm.display.cachedPaddingH = null\n        if (!cm.options.lineWrapping) {\n            cm.display.maxLineChanged = true\n        }\n        cm.display.lineNumChars = null\n    }\n\n    function pageScrollX() {\n        // Work around https://bugs.chromium.org/p/chromium/issues/detail?id=489206\n        // which causes page_Offset and bounding client rects to use\n        // different reference viewports and invalidate our calculations.\n        if (chrome && android) {\n            return -(\n                document.body.getBoundingClientRect().left -\n                parseInt(getComputedStyle(document.body).marginLeft)\n            )\n        }\n        return window.pageXOffset || (document.documentElement || document.body).scrollLeft\n    }\n    function pageScrollY() {\n        if (chrome && android) {\n            return -(\n                document.body.getBoundingClientRect().top -\n                parseInt(getComputedStyle(document.body).marginTop)\n            )\n        }\n        return window.pageYOffset || (document.documentElement || document.body).scrollTop\n    }\n\n    function widgetTopHeight(lineObj) {\n        var height = 0\n        if (lineObj.widgets) {\n            for (var i = 0; i < lineObj.widgets.length; ++i) {\n                if (lineObj.widgets[i].above) {\n                    height += widgetHeight(lineObj.widgets[i])\n                }\n            }\n        }\n        return height\n    }\n\n    // Converts a {top, bottom, left, right} box from line-local\n    // coordinates into another coordinate system. Context may be one of\n    // \"line\", \"div\" (display.lineDiv), \"local\"./null (editor), \"window\",\n    // or \"page\".\n    function intoCoordSystem(cm, lineObj, rect, context, includeWidgets) {\n        if (!includeWidgets) {\n            var height = widgetTopHeight(lineObj)\n            rect.top += height\n            rect.bottom += height\n        }\n        if (context == \"line\") {\n            return rect\n        }\n        if (!context) {\n            context = \"local\"\n        }\n        var yOff = heightAtLine(lineObj)\n        if (context == \"local\") {\n            yOff += paddingTop(cm.display)\n        } else {\n            yOff -= cm.display.viewOffset\n        }\n        if (context == \"page\" || context == \"window\") {\n            var lOff = cm.display.lineSpace.getBoundingClientRect()\n            yOff += lOff.top + (context == \"window\" ? 0 : pageScrollY())\n            var xOff = lOff.left + (context == \"window\" ? 0 : pageScrollX())\n            rect.left += xOff\n            rect.right += xOff\n        }\n        rect.top += yOff\n        rect.bottom += yOff\n        return rect\n    }\n\n    // Coverts a box from \"div\" coords to another coordinate system.\n    // Context may be \"window\", \"page\", \"div\", or \"local\"./null.\n    function fromCoordSystem(cm, coords, context) {\n        if (context == \"div\") {\n            return coords\n        }\n        var left = coords.left,\n            top = coords.top\n        // First move into \"page\" coordinate system\n        if (context == \"page\") {\n            left -= pageScrollX()\n            top -= pageScrollY()\n        } else if (context == \"local\" || !context) {\n            var localBox = cm.display.sizer.getBoundingClientRect()\n            left += localBox.left\n            top += localBox.top\n        }\n\n        var lineSpaceBox = cm.display.lineSpace.getBoundingClientRect()\n        return { left: left - lineSpaceBox.left, top: top - lineSpaceBox.top }\n    }\n\n    function charCoords(cm, pos, context, lineObj, bias) {\n        if (!lineObj) {\n            lineObj = getLine(cm.doc, pos.line)\n        }\n        return intoCoordSystem(cm, lineObj, measureChar(cm, lineObj, pos.ch, bias), context)\n    }\n\n    // Returns a box for a given cursor position, which may have an\n    // 'other' property containing the position of the secondary cursor\n    // on a bidi boundary.\n    // A cursor Pos(line, char, \"before\") is on the same visual line as `char - 1`\n    // and after `char - 1` in writing order of `char - 1`\n    // A cursor Pos(line, char, \"after\") is on the same visual line as `char`\n    // and before `char` in writing order of `char`\n    // Examples (upper-case letters are RTL, lower-case are LTR):\n    //     Pos(0, 1, ...)\n    //     before   after\n    // ab     a|b     a|b\n    // aB     a|B     aB|\n    // Ab     |Ab     A|b\n    // AB     B|A     B|A\n    // Every position after the last character on a line is considered to stick\n    // to the last character on the line.\n    function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {\n        lineObj = lineObj || getLine(cm.doc, pos.line)\n        if (!preparedMeasure) {\n            preparedMeasure = prepareMeasureForLine(cm, lineObj)\n        }\n        function get(ch, right) {\n            var m = measureCharPrepared(\n                cm,\n                preparedMeasure,\n                ch,\n                right ? \"right\" : \"left\",\n                varHeight\n            )\n            if (right) {\n                m.left = m.right\n            } else {\n                m.right = m.left\n            }\n            return intoCoordSystem(cm, lineObj, m, context)\n        }\n        var order = getOrder(lineObj, cm.doc.direction),\n            ch = pos.ch,\n            sticky = pos.sticky\n        if (ch >= lineObj.text.length) {\n            ch = lineObj.text.length\n            sticky = \"before\"\n        } else if (ch <= 0) {\n            ch = 0\n            sticky = \"after\"\n        }\n        if (!order) {\n            return get(sticky == \"before\" ? ch - 1 : ch, sticky == \"before\")\n        }\n\n        function getBidi(ch, partPos, invert) {\n            var part = order[partPos],\n                right = part.level == 1\n            return get(invert ? ch - 1 : ch, right != invert)\n        }\n        var partPos = getBidiPartAt(order, ch, sticky)\n        var other = bidiOther\n        var val = getBidi(ch, partPos, sticky == \"before\")\n        if (other != null) {\n            val.other = getBidi(ch, other, sticky != \"before\")\n        }\n        return val\n    }\n\n    // Used to cheaply estimate the coordinates for a position. Used for\n    // intermediate scroll updates.\n    function estimateCoords(cm, pos) {\n        var left = 0\n        pos = clipPos(cm.doc, pos)\n        if (!cm.options.lineWrapping) {\n            left = charWidth(cm.display) * pos.ch\n        }\n        var lineObj = getLine(cm.doc, pos.line)\n        var top = heightAtLine(lineObj) + paddingTop(cm.display)\n        return { left: left, right: left, top: top, bottom: top + lineObj.height }\n    }\n\n    // Positions returned by coordsChar contain some extra information.\n    // xRel is the relative x position of the input coordinates compared\n    // to the found position (so xRel > 0 means the coordinates are to\n    // the right of the character position, for example). When outside\n    // is true, that means the coordinates lie outside the line's\n    // vertical range.\n    function PosWithInfo(line, ch, sticky, outside, xRel) {\n        var pos = Pos(line, ch, sticky)\n        pos.xRel = xRel\n        if (outside) {\n            pos.outside = outside\n        }\n        return pos\n    }\n\n    // Compute the character position closest to the given coordinates.\n    // Input must be lineSpace-local (\"div\" coordinate system).\n    function coordsChar(cm, x, y) {\n        var doc = cm.doc\n        y += cm.display.viewOffset\n        if (y < 0) {\n            return PosWithInfo(doc.first, 0, null, -1, -1)\n        }\n        var lineN = lineAtHeight(doc, y),\n            last = doc.first + doc.size - 1\n        if (lineN > last) {\n            return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, 1, 1)\n        }\n        if (x < 0) {\n            x = 0\n        }\n\n        var lineObj = getLine(doc, lineN)\n        for (;;) {\n            var found = coordsCharInner(cm, lineObj, lineN, x, y)\n            var collapsed = collapsedSpanAround(\n                lineObj,\n                found.ch + (found.xRel > 0 || found.outside > 0 ? 1 : 0)\n            )\n            if (!collapsed) {\n                return found\n            }\n            var rangeEnd = collapsed.find(1)\n            if (rangeEnd.line == lineN) {\n                return rangeEnd\n            }\n            lineObj = getLine(doc, (lineN = rangeEnd.line))\n        }\n    }\n\n    function wrappedLineExtent(cm, lineObj, preparedMeasure, y) {\n        y -= widgetTopHeight(lineObj)\n        var end = lineObj.text.length\n        var begin = findFirst(\n            function(ch) {\n                return measureCharPrepared(cm, preparedMeasure, ch - 1).bottom <= y\n            },\n            end,\n            0\n        )\n        end = findFirst(\n            function(ch) {\n                return measureCharPrepared(cm, preparedMeasure, ch).top > y\n            },\n            begin,\n            end\n        )\n        return { begin: begin, end: end }\n    }\n\n    function wrappedLineExtentChar(cm, lineObj, preparedMeasure, target) {\n        if (!preparedMeasure) {\n            preparedMeasure = prepareMeasureForLine(cm, lineObj)\n        }\n        var targetTop = intoCoordSystem(\n            cm,\n            lineObj,\n            measureCharPrepared(cm, preparedMeasure, target),\n            \"line\"\n        ).top\n        return wrappedLineExtent(cm, lineObj, preparedMeasure, targetTop)\n    }\n\n    // Returns true if the given side of a box is after the given\n    // coordinates, in top-to-bottom, left-to-right order.\n    function boxIsAfter(box, x, y, left) {\n        return box.bottom <= y ? false : box.top > y ? true : (left ? box.left : box.right) > x\n    }\n\n    function coordsCharInner(cm, lineObj, lineNo, x, y) {\n        // Move y into line-local coordinate space\n        y -= heightAtLine(lineObj)\n        var preparedMeasure = prepareMeasureForLine(cm, lineObj)\n        // When directly calling `measureCharPrepared`, we have to adjust\n        // for the widgets at this line.\n        var widgetHeight = widgetTopHeight(lineObj)\n        var begin = 0,\n            end = lineObj.text.length,\n            ltr = true\n\n        var order = getOrder(lineObj, cm.doc.direction)\n        // If the line isn't plain left-to-right text, first figure out\n        // which bidi section the coordinates fall into.\n        if (order) {\n            var part = (cm.options.lineWrapping ? coordsBidiPartWrapped : coordsBidiPart)(\n                cm,\n                lineObj,\n                lineNo,\n                preparedMeasure,\n                order,\n                x,\n                y\n            )\n            ltr = part.level != 1\n            // The awkward -1 offsets are needed because findFirst (called\n            // on these below) will treat its first bound as inclusive,\n            // second as exclusive, but we want to actually address the\n            // characters in the part's range\n            begin = ltr ? part.from : part.to - 1\n            end = ltr ? part.to : part.from - 1\n        }\n\n        // A binary search to find the first character whose bounding box\n        // starts after the coordinates. If we run across any whose box wrap\n        // the coordinates, store that.\n        var chAround = null,\n            boxAround = null\n        var ch = findFirst(\n            function(ch) {\n                var box = measureCharPrepared(cm, preparedMeasure, ch)\n                box.top += widgetHeight\n                box.bottom += widgetHeight\n                if (!boxIsAfter(box, x, y, false)) {\n                    return false\n                }\n                if (box.top <= y && box.left <= x) {\n                    chAround = ch\n                    boxAround = box\n                }\n                return true\n            },\n            begin,\n            end\n        )\n\n        var baseX,\n            sticky,\n            outside = false\n        // If a box around the coordinates was found, use that\n        if (boxAround) {\n            // Distinguish coordinates nearer to the left or right side of the box\n            var atLeft = x - boxAround.left < boxAround.right - x,\n                atStart = atLeft == ltr\n            ch = chAround + (atStart ? 0 : 1)\n            sticky = atStart ? \"after\" : \"before\"\n            baseX = atLeft ? boxAround.left : boxAround.right\n        } else {\n            // (Adjust for extended bound, if necessary.)\n            if (!ltr && (ch == end || ch == begin)) {\n                ch++\n            }\n            // To determine which side to associate with, get the box to the\n            // left of the character and compare it's vertical position to the\n            // coordinates\n            sticky =\n                ch == 0\n                    ? \"after\"\n                    : ch == lineObj.text.length\n                    ? \"before\"\n                    : measureCharPrepared(cm, preparedMeasure, ch - (ltr ? 1 : 0)).bottom +\n                          widgetHeight <=\n                          y ==\n                      ltr\n                    ? \"after\"\n                    : \"before\"\n            // Now get accurate coordinates for this place, in order to get a\n            // base X position\n            var coords = cursorCoords(cm, Pos(lineNo, ch, sticky), \"line\", lineObj, preparedMeasure)\n            baseX = coords.left\n            outside = y < coords.top ? -1 : y >= coords.bottom ? 1 : 0\n        }\n\n        ch = skipExtendingChars(lineObj.text, ch, 1)\n        return PosWithInfo(lineNo, ch, sticky, outside, x - baseX)\n    }\n\n    function coordsBidiPart(cm, lineObj, lineNo, preparedMeasure, order, x, y) {\n        // Bidi parts are sorted left-to-right, and in a non-line-wrapping\n        // situation, we can take this ordering to correspond to the visual\n        // ordering. This finds the first part whose end is after the given\n        // coordinates.\n        var index = findFirst(\n            function(i) {\n                var part = order[i],\n                    ltr = part.level != 1\n                return boxIsAfter(\n                    cursorCoords(\n                        cm,\n                        Pos(lineNo, ltr ? part.to : part.from, ltr ? \"before\" : \"after\"),\n                        \"line\",\n                        lineObj,\n                        preparedMeasure\n                    ),\n                    x,\n                    y,\n                    true\n                )\n            },\n            0,\n            order.length - 1\n        )\n        var part = order[index]\n        // If this isn't the first part, the part's start is also after\n        // the coordinates, and the coordinates aren't on the same line as\n        // that start, move one part back.\n        if (index > 0) {\n            var ltr = part.level != 1\n            var start = cursorCoords(\n                cm,\n                Pos(lineNo, ltr ? part.from : part.to, ltr ? \"after\" : \"before\"),\n                \"line\",\n                lineObj,\n                preparedMeasure\n            )\n            if (boxIsAfter(start, x, y, true) && start.top > y) {\n                part = order[index - 1]\n            }\n        }\n        return part\n    }\n\n    function coordsBidiPartWrapped(cm, lineObj, _lineNo, preparedMeasure, order, x, y) {\n        // In a wrapped line, rtl text on wrapping boundaries can do things\n        // that don't correspond to the ordering in our `order` array at\n        // all, so a binary search doesn't work, and we want to return a\n        // part that only spans one line so that the binary search in\n        // coordsCharInner is safe. As such, we first find the extent of the\n        // wrapped line, and then do a flat search in which we discard any\n        // spans that aren't on the line.\n        var ref = wrappedLineExtent(cm, lineObj, preparedMeasure, y)\n        var begin = ref.begin\n        var end = ref.end\n        if (/\\s/.test(lineObj.text.charAt(end - 1))) {\n            end--\n        }\n        var part = null,\n            closestDist = null\n        for (var i = 0; i < order.length; i++) {\n            var p = order[i]\n            if (p.from >= end || p.to <= begin) {\n                continue\n            }\n            var ltr = p.level != 1\n            var endX = measureCharPrepared(\n                cm,\n                preparedMeasure,\n                ltr ? Math.min(end, p.to) - 1 : Math.max(begin, p.from)\n            ).right\n            // Weigh against spans ending before this, so that they are only\n            // picked if nothing ends after\n            var dist = endX < x ? x - endX + 1e9 : endX - x\n            if (!part || closestDist > dist) {\n                part = p\n                closestDist = dist\n            }\n        }\n        if (!part) {\n            part = order[order.length - 1]\n        }\n        // Clip the part to the wrapped line.\n        if (part.from < begin) {\n            part = { from: begin, to: part.to, level: part.level }\n        }\n        if (part.to > end) {\n            part = { from: part.from, to: end, level: part.level }\n        }\n        return part\n    }\n\n    var measureText\n    // Compute the default text height.\n    function textHeight(display) {\n        if (display.cachedTextHeight != null) {\n            return display.cachedTextHeight\n        }\n        if (measureText == null) {\n            measureText = elt(\"pre\", null, \"CodeMirror-line-like\")\n            // Measure a bunch of lines, for browsers that compute\n            // fractional heights.\n            for (var i = 0; i < 49; ++i) {\n                measureText.appendChild(document.createTextNode(\"x\"))\n                measureText.appendChild(elt(\"br\"))\n            }\n            measureText.appendChild(document.createTextNode(\"x\"))\n        }\n        removeChildrenAndAdd(display.measure, measureText)\n        var height = measureText.offsetHeight / 50\n        if (height > 3) {\n            display.cachedTextHeight = height\n        }\n        removeChildren(display.measure)\n        return height || 1\n    }\n\n    // Compute the default character width.\n    function charWidth(display) {\n        if (display.cachedCharWidth != null) {\n            return display.cachedCharWidth\n        }\n        var anchor = elt(\"span\", \"xxxxxxxxxx\")\n        var pre = elt(\"pre\", [anchor], \"CodeMirror-line-like\")\n        removeChildrenAndAdd(display.measure, pre)\n        var rect = anchor.getBoundingClientRect(),\n            width = (rect.right - rect.left) / 10\n        if (width > 2) {\n            display.cachedCharWidth = width\n        }\n        return width || 10\n    }\n\n    // Do a bulk-read of the DOM positions and sizes needed to draw the\n    // view, so that we don't interleave reading and writing to the DOM.\n    function getDimensions(cm) {\n        var d = cm.display,\n            left = {},\n            width = {}\n        var gutterLeft = d.gutters.clientLeft\n        for (var n = d.gutters.firstChild, i = 0; n; n = n.nextSibling, ++i) {\n            var id = cm.display.gutterSpecs[i].className\n            left[id] = n.offsetLeft + n.clientLeft + gutterLeft\n            width[id] = n.clientWidth\n        }\n        return {\n            fixedPos: compensateForHScroll(d),\n            gutterTotalWidth: d.gutters.offsetWidth,\n            gutterLeft: left,\n            gutterWidth: width,\n            wrapperWidth: d.wrapper.clientWidth\n        }\n    }\n\n    // Computes display.scroller.scrollLeft + display.gutters.offsetWidth,\n    // but using getBoundingClientRect to get a sub-pixel-accurate\n    // result.\n    function compensateForHScroll(display) {\n        return (\n            display.scroller.getBoundingClientRect().left -\n            display.sizer.getBoundingClientRect().left\n        )\n    }\n\n    // Returns a function that estimates the height of a line, to use as\n    // first approximation until the line becomes visible (and is thus\n    // properly measurable).\n    function estimateHeight(cm) {\n        var th = textHeight(cm.display),\n            wrapping = cm.options.lineWrapping\n        var perLine =\n            wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3)\n        return function(line) {\n            if (lineIsHidden(cm.doc, line)) {\n                return 0\n            }\n\n            var widgetsHeight = 0\n            if (line.widgets) {\n                for (var i = 0; i < line.widgets.length; i++) {\n                    if (line.widgets[i].height) {\n                        widgetsHeight += line.widgets[i].height\n                    }\n                }\n            }\n\n            if (wrapping) {\n                return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th\n            } else {\n                return widgetsHeight + th\n            }\n        }\n    }\n\n    function estimateLineHeights(cm) {\n        var doc = cm.doc,\n            est = estimateHeight(cm)\n        doc.iter(function(line) {\n            var estHeight = est(line)\n            if (estHeight != line.height) {\n                updateLineHeight(line, estHeight)\n            }\n        })\n    }\n\n    // Given a mouse event, find the corresponding position. If liberal\n    // is false, it checks whether a gutter or scrollbar was clicked,\n    // and returns null if it was. forRect is used by rectangular\n    // selections, and tries to estimate a character position even for\n    // coordinates beyond the right of the text.\n    function posFromMouse(cm, e, liberal, forRect) {\n        var display = cm.display\n        if (!liberal && e_target(e).getAttribute(\"cm-not-content\") == \"true\") {\n            return null\n        }\n\n        var x,\n            y,\n            space = display.lineSpace.getBoundingClientRect()\n        // Fails unpredictably on IE[67] when mouse is dragged around quickly.\n        try {\n            x = e.clientX - space.left\n            y = e.clientY - space.top\n        } catch (e) {\n            return null\n        }\n        var coords = coordsChar(cm, x, y),\n            line\n        if (\n            forRect &&\n            coords.xRel > 0 &&\n            (line = getLine(cm.doc, coords.line).text).length == coords.ch\n        ) {\n            var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length\n            coords = Pos(\n                coords.line,\n                Math.max(\n                    0,\n                    Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff\n                )\n            )\n        }\n        return coords\n    }\n\n    // Find the view element corresponding to a given line. Return null\n    // when the line isn't visible.\n    function findViewIndex(cm, n) {\n        if (n >= cm.display.viewTo) {\n            return null\n        }\n        n -= cm.display.viewFrom\n        if (n < 0) {\n            return null\n        }\n        var view = cm.display.view\n        for (var i = 0; i < view.length; i++) {\n            n -= view[i].size\n            if (n < 0) {\n                return i\n            }\n        }\n    }\n\n    // Updates the display.view data structure for a given change to the\n    // document. From and to are in pre-change coordinates. Lendiff is\n    // the amount of lines added or subtracted by the change. This is\n    // used for changes that span multiple lines, or change the way\n    // lines are divided into visual lines. regLineChange (below)\n    // registers single-line changes.\n    function regChange(cm, from, to, lendiff) {\n        if (from == null) {\n            from = cm.doc.first\n        }\n        if (to == null) {\n            to = cm.doc.first + cm.doc.size\n        }\n        if (!lendiff) {\n            lendiff = 0\n        }\n\n        var display = cm.display\n        if (\n            lendiff &&\n            to < display.viewTo &&\n            (display.updateLineNumbers == null || display.updateLineNumbers > from)\n        ) {\n            display.updateLineNumbers = from\n        }\n\n        cm.curOp.viewChanged = true\n\n        if (from >= display.viewTo) {\n            // Change after\n            if (sawCollapsedSpans && visualLineNo(cm.doc, from) < display.viewTo) {\n                resetView(cm)\n            }\n        } else if (to <= display.viewFrom) {\n            // Change before\n            if (sawCollapsedSpans && visualLineEndNo(cm.doc, to + lendiff) > display.viewFrom) {\n                resetView(cm)\n            } else {\n                display.viewFrom += lendiff\n                display.viewTo += lendiff\n            }\n        } else if (from <= display.viewFrom && to >= display.viewTo) {\n            // Full overlap\n            resetView(cm)\n        } else if (from <= display.viewFrom) {\n            // Top overlap\n            var cut = viewCuttingPoint(cm, to, to + lendiff, 1)\n            if (cut) {\n                display.view = display.view.slice(cut.index)\n                display.viewFrom = cut.lineN\n                display.viewTo += lendiff\n            } else {\n                resetView(cm)\n            }\n        } else if (to >= display.viewTo) {\n            // Bottom overlap\n            var cut$1 = viewCuttingPoint(cm, from, from, -1)\n            if (cut$1) {\n                display.view = display.view.slice(0, cut$1.index)\n                display.viewTo = cut$1.lineN\n            } else {\n                resetView(cm)\n            }\n        } else {\n            // Gap in the middle\n            var cutTop = viewCuttingPoint(cm, from, from, -1)\n            var cutBot = viewCuttingPoint(cm, to, to + lendiff, 1)\n            if (cutTop && cutBot) {\n                display.view = display.view\n                    .slice(0, cutTop.index)\n                    .concat(buildViewArray(cm, cutTop.lineN, cutBot.lineN))\n                    .concat(display.view.slice(cutBot.index))\n                display.viewTo += lendiff\n            } else {\n                resetView(cm)\n            }\n        }\n\n        var ext = display.externalMeasured\n        if (ext) {\n            if (to < ext.lineN) {\n                ext.lineN += lendiff\n            } else if (from < ext.lineN + ext.size) {\n                display.externalMeasured = null\n            }\n        }\n    }\n\n    // Register a change to a single line. Type must be one of \"text\",\n    // \"gutter\", \"class\", \"widget\"\n    function regLineChange(cm, line, type) {\n        cm.curOp.viewChanged = true\n        var display = cm.display,\n            ext = cm.display.externalMeasured\n        if (ext && line >= ext.lineN && line < ext.lineN + ext.size) {\n            display.externalMeasured = null\n        }\n\n        if (line < display.viewFrom || line >= display.viewTo) {\n            return\n        }\n        var lineView = display.view[findViewIndex(cm, line)]\n        if (lineView.node == null) {\n            return\n        }\n        var arr = lineView.changes || (lineView.changes = [])\n        if (indexOf(arr, type) == -1) {\n            arr.push(type)\n        }\n    }\n\n    // Clear the view.\n    function resetView(cm) {\n        cm.display.viewFrom = cm.display.viewTo = cm.doc.first\n        cm.display.view = []\n        cm.display.viewOffset = 0\n    }\n\n    function viewCuttingPoint(cm, oldN, newN, dir) {\n        var index = findViewIndex(cm, oldN),\n            diff,\n            view = cm.display.view\n        if (!sawCollapsedSpans || newN == cm.doc.first + cm.doc.size) {\n            return { index: index, lineN: newN }\n        }\n        var n = cm.display.viewFrom\n        for (var i = 0; i < index; i++) {\n            n += view[i].size\n        }\n        if (n != oldN) {\n            if (dir > 0) {\n                if (index == view.length - 1) {\n                    return null\n                }\n                diff = n + view[index].size - oldN\n                index++\n            } else {\n                diff = n - oldN\n            }\n            oldN += diff\n            newN += diff\n        }\n        while (visualLineNo(cm.doc, newN) != newN) {\n            if (index == (dir < 0 ? 0 : view.length - 1)) {\n                return null\n            }\n            newN += dir * view[index - (dir < 0 ? 1 : 0)].size\n            index += dir\n        }\n        return { index: index, lineN: newN }\n    }\n\n    // Force the view to cover a given range, adding empty view element\n    // or clipping off existing ones as needed.\n    function adjustView(cm, from, to) {\n        var display = cm.display,\n            view = display.view\n        if (view.length == 0 || from >= display.viewTo || to <= display.viewFrom) {\n            display.view = buildViewArray(cm, from, to)\n            display.viewFrom = from\n        } else {\n            if (display.viewFrom > from) {\n                display.view = buildViewArray(cm, from, display.viewFrom).concat(display.view)\n            } else if (display.viewFrom < from) {\n                display.view = display.view.slice(findViewIndex(cm, from))\n            }\n            display.viewFrom = from\n            if (display.viewTo < to) {\n                display.view = display.view.concat(buildViewArray(cm, display.viewTo, to))\n            } else if (display.viewTo > to) {\n                display.view = display.view.slice(0, findViewIndex(cm, to))\n            }\n        }\n        display.viewTo = to\n    }\n\n    // Count the number of lines in the view whose DOM representation is\n    // out of date (or nonexistent).\n    function countDirtyView(cm) {\n        var view = cm.display.view,\n            dirty = 0\n        for (var i = 0; i < view.length; i++) {\n            var lineView = view[i]\n            if (!lineView.hidden && (!lineView.node || lineView.changes)) {\n                ++dirty\n            }\n        }\n        return dirty\n    }\n\n    function updateSelection(cm) {\n        cm.display.input.showSelection(cm.display.input.prepareSelection())\n    }\n\n    function prepareSelection(cm, primary) {\n        if (primary === void 0) primary = true\n\n        var doc = cm.doc,\n            result = {}\n        var curFragment = (result.cursors = document.createDocumentFragment())\n        var selFragment = (result.selection = document.createDocumentFragment())\n\n        for (var i = 0; i < doc.sel.ranges.length; i++) {\n            if (!primary && i == doc.sel.primIndex) {\n                continue\n            }\n            var range = doc.sel.ranges[i]\n            if (range.from().line >= cm.display.viewTo || range.to().line < cm.display.viewFrom) {\n                continue\n            }\n            var collapsed = range.empty()\n            if (collapsed || cm.options.showCursorWhenSelecting) {\n                drawSelectionCursor(cm, range.head, curFragment)\n            }\n            if (!collapsed) {\n                drawSelectionRange(cm, range, selFragment)\n            }\n        }\n        return result\n    }\n\n    // Draws a cursor for the given range\n    function drawSelectionCursor(cm, head, output) {\n        var pos = cursorCoords(cm, head, \"div\", null, null, !cm.options.singleCursorHeightPerLine)\n\n        var cursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor\"))\n        cursor.style.left = pos.left + \"px\"\n        cursor.style.top = pos.top + \"px\"\n        cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + \"px\"\n\n        if (pos.other) {\n            // Secondary cursor, shown when on a 'jump' in bi-directional text\n            var otherCursor = output.appendChild(\n                elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor CodeMirror-secondarycursor\")\n            )\n            otherCursor.style.display = \"\"\n            otherCursor.style.left = pos.other.left + \"px\"\n            otherCursor.style.top = pos.other.top + \"px\"\n            otherCursor.style.height = (pos.other.bottom - pos.other.top) * 0.85 + \"px\"\n        }\n    }\n\n    function cmpCoords(a, b) {\n        return a.top - b.top || a.left - b.left\n    }\n\n    // Draws the given range as a highlighted selection\n    function drawSelectionRange(cm, range, output) {\n        var display = cm.display,\n            doc = cm.doc\n        var fragment = document.createDocumentFragment()\n        var padding = paddingH(cm.display),\n            leftSide = padding.left\n        var rightSide =\n            Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) -\n            padding.right\n        var docLTR = doc.direction == \"ltr\"\n\n        function add(left, top, width, bottom) {\n            if (top < 0) {\n                top = 0\n            }\n            top = Math.round(top)\n            bottom = Math.round(bottom)\n            fragment.appendChild(\n                elt(\n                    \"div\",\n                    null,\n                    \"CodeMirror-selected\",\n                    \"position: absolute; left: \" +\n                        left +\n                        \"px;\\n                             top: \" +\n                        top +\n                        \"px; width: \" +\n                        (width == null ? rightSide - left : width) +\n                        \"px;\\n                             height: \" +\n                        (bottom - top) +\n                        \"px\"\n                )\n            )\n        }\n\n        function drawForLine(line, fromArg, toArg) {\n            var lineObj = getLine(doc, line)\n            var lineLen = lineObj.text.length\n            var start, end\n            function coords(ch, bias) {\n                return charCoords(cm, Pos(line, ch), \"div\", lineObj, bias)\n            }\n\n            function wrapX(pos, dir, side) {\n                var extent = wrappedLineExtentChar(cm, lineObj, null, pos)\n                var prop = (dir == \"ltr\") == (side == \"after\") ? \"left\" : \"right\"\n                var ch =\n                    side == \"after\"\n                        ? extent.begin\n                        : extent.end - (/\\s/.test(lineObj.text.charAt(extent.end - 1)) ? 2 : 1)\n                return coords(ch, prop)[prop]\n            }\n\n            var order = getOrder(lineObj, doc.direction)\n            iterateBidiSections(order, fromArg || 0, toArg == null ? lineLen : toArg, function(\n                from,\n                to,\n                dir,\n                i\n            ) {\n                var ltr = dir == \"ltr\"\n                var fromPos = coords(from, ltr ? \"left\" : \"right\")\n                var toPos = coords(to - 1, ltr ? \"right\" : \"left\")\n\n                var openStart = fromArg == null && from == 0,\n                    openEnd = toArg == null && to == lineLen\n                var first = i == 0,\n                    last = !order || i == order.length - 1\n                if (toPos.top - fromPos.top <= 3) {\n                    // Single line\n                    var openLeft = (docLTR ? openStart : openEnd) && first\n                    var openRight = (docLTR ? openEnd : openStart) && last\n                    var left = openLeft ? leftSide : (ltr ? fromPos : toPos).left\n                    var right = openRight ? rightSide : (ltr ? toPos : fromPos).right\n                    add(left, fromPos.top, right - left, fromPos.bottom)\n                } else {\n                    // Multiple lines\n                    var topLeft, topRight, botLeft, botRight\n                    if (ltr) {\n                        topLeft = docLTR && openStart && first ? leftSide : fromPos.left\n                        topRight = docLTR ? rightSide : wrapX(from, dir, \"before\")\n                        botLeft = docLTR ? leftSide : wrapX(to, dir, \"after\")\n                        botRight = docLTR && openEnd && last ? rightSide : toPos.right\n                    } else {\n                        topLeft = !docLTR ? leftSide : wrapX(from, dir, \"before\")\n                        topRight = !docLTR && openStart && first ? rightSide : fromPos.right\n                        botLeft = !docLTR && openEnd && last ? leftSide : toPos.left\n                        botRight = !docLTR ? rightSide : wrapX(to, dir, \"after\")\n                    }\n                    add(topLeft, fromPos.top, topRight - topLeft, fromPos.bottom)\n                    if (fromPos.bottom < toPos.top) {\n                        add(leftSide, fromPos.bottom, null, toPos.top)\n                    }\n                    add(botLeft, toPos.top, botRight - botLeft, toPos.bottom)\n                }\n\n                if (!start || cmpCoords(fromPos, start) < 0) {\n                    start = fromPos\n                }\n                if (cmpCoords(toPos, start) < 0) {\n                    start = toPos\n                }\n                if (!end || cmpCoords(fromPos, end) < 0) {\n                    end = fromPos\n                }\n                if (cmpCoords(toPos, end) < 0) {\n                    end = toPos\n                }\n            })\n            return { start: start, end: end }\n        }\n\n        var sFrom = range.from(),\n            sTo = range.to()\n        if (sFrom.line == sTo.line) {\n            drawForLine(sFrom.line, sFrom.ch, sTo.ch)\n        } else {\n            var fromLine = getLine(doc, sFrom.line),\n                toLine = getLine(doc, sTo.line)\n            var singleVLine = visualLine(fromLine) == visualLine(toLine)\n            var leftEnd = drawForLine(\n                sFrom.line,\n                sFrom.ch,\n                singleVLine ? fromLine.text.length + 1 : null\n            ).end\n            var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start\n            if (singleVLine) {\n                if (leftEnd.top < rightStart.top - 2) {\n                    add(leftEnd.right, leftEnd.top, null, leftEnd.bottom)\n                    add(leftSide, rightStart.top, rightStart.left, rightStart.bottom)\n                } else {\n                    add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom)\n                }\n            }\n            if (leftEnd.bottom < rightStart.top) {\n                add(leftSide, leftEnd.bottom, null, rightStart.top)\n            }\n        }\n\n        output.appendChild(fragment)\n    }\n\n    // Cursor-blinking\n    function restartBlink(cm) {\n        if (!cm.state.focused) {\n            return\n        }\n        var display = cm.display\n        clearInterval(display.blinker)\n        var on = true\n        display.cursorDiv.style.visibility = \"\"\n        if (cm.options.cursorBlinkRate > 0) {\n            display.blinker = setInterval(function() {\n                return (display.cursorDiv.style.visibility = (on = !on) ? \"\" : \"hidden\")\n            }, cm.options.cursorBlinkRate)\n        } else if (cm.options.cursorBlinkRate < 0) {\n            display.cursorDiv.style.visibility = \"hidden\"\n        }\n    }\n\n    function ensureFocus(cm) {\n        if (!cm.state.focused) {\n            cm.display.input.focus()\n            onFocus(cm)\n        }\n    }\n\n    function delayBlurEvent(cm) {\n        cm.state.delayingBlurEvent = true\n        setTimeout(function() {\n            if (cm.state.delayingBlurEvent) {\n                cm.state.delayingBlurEvent = false\n                onBlur(cm)\n            }\n        }, 100)\n    }\n\n    function onFocus(cm, e) {\n        if (cm.state.delayingBlurEvent) {\n            cm.state.delayingBlurEvent = false\n        }\n\n        if (cm.options.readOnly == \"nocursor\") {\n            return\n        }\n        if (!cm.state.focused) {\n            signal(cm, \"focus\", cm, e)\n            cm.state.focused = true\n            addClass(cm.display.wrapper, \"CodeMirror-focused\")\n            // This test prevents this from firing when a context\n            // menu is closed (since the input reset would kill the\n            // select-all detection hack)\n            if (!cm.curOp && cm.display.selForContextMenu != cm.doc.sel) {\n                cm.display.input.reset()\n                if (webkit) {\n                    setTimeout(function() {\n                        return cm.display.input.reset(true)\n                    }, 20)\n                } // Issue #1730\n            }\n            cm.display.input.receivedFocus()\n        }\n        restartBlink(cm)\n    }\n    function onBlur(cm, e) {\n        if (cm.state.delayingBlurEvent) {\n            return\n        }\n\n        if (cm.state.focused) {\n            signal(cm, \"blur\", cm, e)\n            cm.state.focused = false\n            rmClass(cm.display.wrapper, \"CodeMirror-focused\")\n        }\n        clearInterval(cm.display.blinker)\n        setTimeout(function() {\n            if (!cm.state.focused) {\n                cm.display.shift = false\n            }\n        }, 150)\n    }\n\n    // Read the actual heights of the rendered lines, and update their\n    // stored heights to match.\n    function updateHeightsInViewport(cm) {\n        var display = cm.display\n        var prevBottom = display.lineDiv.offsetTop\n        for (var i = 0; i < display.view.length; i++) {\n            var cur = display.view[i],\n                wrapping = cm.options.lineWrapping\n            var height = void 0,\n                width = 0\n            if (cur.hidden) {\n                continue\n            }\n            if (ie && ie_version < 8) {\n                var bot = cur.node.offsetTop + cur.node.offsetHeight\n                height = bot - prevBottom\n                prevBottom = bot\n            } else {\n                var box = cur.node.getBoundingClientRect()\n                height = box.bottom - box.top\n                // Check that lines don't extend past the right of the current\n                // editor width\n                if (!wrapping && cur.text.firstChild) {\n                    width = cur.text.firstChild.getBoundingClientRect().right - box.left - 1\n                }\n            }\n            var diff = cur.line.height - height\n            if (diff > 0.005 || diff < -0.005) {\n                updateLineHeight(cur.line, height)\n                updateWidgetHeight(cur.line)\n                if (cur.rest) {\n                    for (var j = 0; j < cur.rest.length; j++) {\n                        updateWidgetHeight(cur.rest[j])\n                    }\n                }\n            }\n            if (width > cm.display.sizerWidth) {\n                var chWidth = Math.ceil(width / charWidth(cm.display))\n                if (chWidth > cm.display.maxLineLength) {\n                    cm.display.maxLineLength = chWidth\n                    cm.display.maxLine = cur.line\n                    cm.display.maxLineChanged = true\n                }\n            }\n        }\n    }\n\n    // Read and store the height of line widgets associated with the\n    // given line.\n    function updateWidgetHeight(line) {\n        if (line.widgets) {\n            for (var i = 0; i < line.widgets.length; ++i) {\n                var w = line.widgets[i],\n                    parent = w.node.parentNode\n                if (parent) {\n                    w.height = parent.offsetHeight\n                }\n            }\n        }\n    }\n\n    // Compute the lines that are visible in a given viewport (defaults\n    // the the current scroll position). viewport may contain top,\n    // height, and ensure (see op.scrollToPos) properties.\n    function visibleLines(display, doc, viewport) {\n        var top =\n            viewport && viewport.top != null\n                ? Math.max(0, viewport.top)\n                : display.scroller.scrollTop\n        top = Math.floor(top - paddingTop(display))\n        var bottom =\n            viewport && viewport.bottom != null\n                ? viewport.bottom\n                : top + display.wrapper.clientHeight\n\n        var from = lineAtHeight(doc, top),\n            to = lineAtHeight(doc, bottom)\n        // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n        // forces those lines into the viewport (if possible).\n        if (viewport && viewport.ensure) {\n            var ensureFrom = viewport.ensure.from.line,\n                ensureTo = viewport.ensure.to.line\n            if (ensureFrom < from) {\n                from = ensureFrom\n                to = lineAtHeight(\n                    doc,\n                    heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight\n                )\n            } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n                from = lineAtHeight(\n                    doc,\n                    heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight\n                )\n                to = ensureTo\n            }\n        }\n        return { from: from, to: Math.max(to, from + 1) }\n    }\n\n    // SCROLLING THINGS INTO VIEW\n\n    // If an editor sits on the top or bottom of the window, partially\n    // scrolled out of view, this ensures that the cursor is visible.\n    function maybeScrollWindow(cm, rect) {\n        if (signalDOMEvent(cm, \"scrollCursorIntoView\")) {\n            return\n        }\n\n        var display = cm.display,\n            box = display.sizer.getBoundingClientRect(),\n            doScroll = null\n        if (rect.top + box.top < 0) {\n            doScroll = true\n        } else if (\n            rect.bottom + box.top >\n            (window.innerHeight || document.documentElement.clientHeight)\n        ) {\n            doScroll = false\n        }\n        if (doScroll != null && !phantom) {\n            var scrollNode = elt(\n                \"div\",\n                \"\\u200b\",\n                null,\n                \"position: absolute;\\n                         top: \" +\n                    (rect.top - display.viewOffset - paddingTop(cm.display)) +\n                    \"px;\\n                         height: \" +\n                    (rect.bottom - rect.top + scrollGap(cm) + display.barHeight) +\n                    \"px;\\n                         left: \" +\n                    rect.left +\n                    \"px; width: \" +\n                    Math.max(2, rect.right - rect.left) +\n                    \"px;\"\n            )\n            cm.display.lineSpace.appendChild(scrollNode)\n            scrollNode.scrollIntoView(doScroll)\n            cm.display.lineSpace.removeChild(scrollNode)\n        }\n    }\n\n    // Scroll a given position into view (immediately), verifying that\n    // it actually became visible (as line heights are accurately\n    // measured, the position of something may 'drift' during drawing).\n    function scrollPosIntoView(cm, pos, end, margin) {\n        if (margin == null) {\n            margin = 0\n        }\n        var rect\n        if (!cm.options.lineWrapping && pos == end) {\n            // Set pos and end to the cursor positions around the character pos sticks to\n            // If pos.sticky == \"before\", that is around pos.ch - 1, otherwise around pos.ch\n            // If pos == Pos(_, 0, \"before\"), pos and end are unchanged\n            pos = pos.ch\n                ? Pos(pos.line, pos.sticky == \"before\" ? pos.ch - 1 : pos.ch, \"after\")\n                : pos\n            end = pos.sticky == \"before\" ? Pos(pos.line, pos.ch + 1, \"before\") : pos\n        }\n        for (var limit = 0; limit < 5; limit++) {\n            var changed = false\n            var coords = cursorCoords(cm, pos)\n            var endCoords = !end || end == pos ? coords : cursorCoords(cm, end)\n            rect = {\n                left: Math.min(coords.left, endCoords.left),\n                top: Math.min(coords.top, endCoords.top) - margin,\n                right: Math.max(coords.left, endCoords.left),\n                bottom: Math.max(coords.bottom, endCoords.bottom) + margin\n            }\n            var scrollPos = calculateScrollPos(cm, rect)\n            var startTop = cm.doc.scrollTop,\n                startLeft = cm.doc.scrollLeft\n            if (scrollPos.scrollTop != null) {\n                updateScrollTop(cm, scrollPos.scrollTop)\n                if (Math.abs(cm.doc.scrollTop - startTop) > 1) {\n                    changed = true\n                }\n            }\n            if (scrollPos.scrollLeft != null) {\n                setScrollLeft(cm, scrollPos.scrollLeft)\n                if (Math.abs(cm.doc.scrollLeft - startLeft) > 1) {\n                    changed = true\n                }\n            }\n            if (!changed) {\n                break\n            }\n        }\n        return rect\n    }\n\n    // Scroll a given set of coordinates into view (immediately).\n    function scrollIntoView(cm, rect) {\n        var scrollPos = calculateScrollPos(cm, rect)\n        if (scrollPos.scrollTop != null) {\n            updateScrollTop(cm, scrollPos.scrollTop)\n        }\n        if (scrollPos.scrollLeft != null) {\n            setScrollLeft(cm, scrollPos.scrollLeft)\n        }\n    }\n\n    // Calculate a new scroll position needed to scroll the given\n    // rectangle into view. Returns an object with scrollTop and\n    // scrollLeft properties. When these are undefined, the\n    // vertical/horizontal position does not need to be adjusted.\n    function calculateScrollPos(cm, rect) {\n        var display = cm.display,\n            snapMargin = textHeight(cm.display)\n        if (rect.top < 0) {\n            rect.top = 0\n        }\n        var screentop =\n            cm.curOp && cm.curOp.scrollTop != null ? cm.curOp.scrollTop : display.scroller.scrollTop\n        var screen = displayHeight(cm),\n            result = {}\n        if (rect.bottom - rect.top > screen) {\n            rect.bottom = rect.top + screen\n        }\n        var docBottom = cm.doc.height + paddingVert(display)\n        var atTop = rect.top < snapMargin,\n            atBottom = rect.bottom > docBottom - snapMargin\n        if (rect.top < screentop) {\n            result.scrollTop = atTop ? 0 : rect.top\n        } else if (rect.bottom > screentop + screen) {\n            var newTop = Math.min(rect.top, (atBottom ? docBottom : rect.bottom) - screen)\n            if (newTop != screentop) {\n                result.scrollTop = newTop\n            }\n        }\n\n        var screenleft =\n            cm.curOp && cm.curOp.scrollLeft != null\n                ? cm.curOp.scrollLeft\n                : display.scroller.scrollLeft\n        var screenw = displayWidth(cm) - (cm.options.fixedGutter ? display.gutters.offsetWidth : 0)\n        var tooWide = rect.right - rect.left > screenw\n        if (tooWide) {\n            rect.right = rect.left + screenw\n        }\n        if (rect.left < 10) {\n            result.scrollLeft = 0\n        } else if (rect.left < screenleft) {\n            result.scrollLeft = Math.max(0, rect.left - (tooWide ? 0 : 10))\n        } else if (rect.right > screenw + screenleft - 3) {\n            result.scrollLeft = rect.right + (tooWide ? 0 : 10) - screenw\n        }\n        return result\n    }\n\n    // Store a relative adjustment to the scroll position in the current\n    // operation (to be applied when the operation finishes).\n    function addToScrollTop(cm, top) {\n        if (top == null) {\n            return\n        }\n        resolveScrollToPos(cm)\n        cm.curOp.scrollTop =\n            (cm.curOp.scrollTop == null ? cm.doc.scrollTop : cm.curOp.scrollTop) + top\n    }\n\n    // Make sure that at the end of the operation the current cursor is\n    // shown.\n    function ensureCursorVisible(cm) {\n        resolveScrollToPos(cm)\n        var cur = cm.getCursor()\n        cm.curOp.scrollToPos = { from: cur, to: cur, margin: cm.options.cursorScrollMargin }\n    }\n\n    function scrollToCoords(cm, x, y) {\n        if (x != null || y != null) {\n            resolveScrollToPos(cm)\n        }\n        if (x != null) {\n            cm.curOp.scrollLeft = x\n        }\n        if (y != null) {\n            cm.curOp.scrollTop = y\n        }\n    }\n\n    function scrollToRange(cm, range) {\n        resolveScrollToPos(cm)\n        cm.curOp.scrollToPos = range\n    }\n\n    // When an operation has its scrollToPos property set, and another\n    // scroll action is applied before the end of the operation, this\n    // 'simulates' scrolling that position into view in a cheap way, so\n    // that the effect of intermediate scroll commands is not ignored.\n    function resolveScrollToPos(cm) {\n        var range = cm.curOp.scrollToPos\n        if (range) {\n            cm.curOp.scrollToPos = null\n            var from = estimateCoords(cm, range.from),\n                to = estimateCoords(cm, range.to)\n            scrollToCoordsRange(cm, from, to, range.margin)\n        }\n    }\n\n    function scrollToCoordsRange(cm, from, to, margin) {\n        var sPos = calculateScrollPos(cm, {\n            left: Math.min(from.left, to.left),\n            top: Math.min(from.top, to.top) - margin,\n            right: Math.max(from.right, to.right),\n            bottom: Math.max(from.bottom, to.bottom) + margin\n        })\n        scrollToCoords(cm, sPos.scrollLeft, sPos.scrollTop)\n    }\n\n    // Sync the scrollable area and scrollbars, ensure the viewport\n    // covers the visible area.\n    function updateScrollTop(cm, val) {\n        if (Math.abs(cm.doc.scrollTop - val) < 2) {\n            return\n        }\n        if (!gecko) {\n            updateDisplaySimple(cm, { top: val })\n        }\n        setScrollTop(cm, val, true)\n        if (gecko) {\n            updateDisplaySimple(cm)\n        }\n        startWorker(cm, 100)\n    }\n\n    function setScrollTop(cm, val, forceScroll) {\n        val = Math.max(\n            0,\n            Math.min(cm.display.scroller.scrollHeight - cm.display.scroller.clientHeight, val)\n        )\n        if (cm.display.scroller.scrollTop == val && !forceScroll) {\n            return\n        }\n        cm.doc.scrollTop = val\n        cm.display.scrollbars.setScrollTop(val)\n        if (cm.display.scroller.scrollTop != val) {\n            cm.display.scroller.scrollTop = val\n        }\n    }\n\n    // Sync scroller and scrollbar, ensure the gutter elements are\n    // aligned.\n    function setScrollLeft(cm, val, isScroller, forceScroll) {\n        val = Math.max(\n            0,\n            Math.min(val, cm.display.scroller.scrollWidth - cm.display.scroller.clientWidth)\n        )\n        if (\n            (isScroller ? val == cm.doc.scrollLeft : Math.abs(cm.doc.scrollLeft - val) < 2) &&\n            !forceScroll\n        ) {\n            return\n        }\n        cm.doc.scrollLeft = val\n        alignHorizontally(cm)\n        if (cm.display.scroller.scrollLeft != val) {\n            cm.display.scroller.scrollLeft = val\n        }\n        cm.display.scrollbars.setScrollLeft(val)\n    }\n\n    // SCROLLBARS\n\n    // Prepare DOM reads needed to update the scrollbars. Done in one\n    // shot to minimize update/measure roundtrips.\n    function measureForScrollbars(cm) {\n        var d = cm.display,\n            gutterW = d.gutters.offsetWidth\n        var docH = Math.round(cm.doc.height + paddingVert(cm.display))\n        return {\n            clientHeight: d.scroller.clientHeight,\n            viewHeight: d.wrapper.clientHeight,\n            scrollWidth: d.scroller.scrollWidth,\n            clientWidth: d.scroller.clientWidth,\n            viewWidth: d.wrapper.clientWidth,\n            barLeft: cm.options.fixedGutter ? gutterW : 0,\n            docHeight: docH,\n            scrollHeight: docH + scrollGap(cm) + d.barHeight,\n            nativeBarWidth: d.nativeBarWidth,\n            gutterWidth: gutterW\n        }\n    }\n\n    var NativeScrollbars = function(place, scroll, cm) {\n        this.cm = cm\n        var vert = (this.vert = elt(\n            \"div\",\n            [elt(\"div\", null, null, \"min-width: 1px\")],\n            \"CodeMirror-vscrollbar\"\n        ))\n        var horiz = (this.horiz = elt(\n            \"div\",\n            [elt(\"div\", null, null, \"height: 100%; min-height: 1px\")],\n            \"CodeMirror-hscrollbar\"\n        ))\n        vert.tabIndex = horiz.tabIndex = -1\n        place(vert)\n        place(horiz)\n\n        on(vert, \"scroll\", function() {\n            if (vert.clientHeight) {\n                scroll(vert.scrollTop, \"vertical\")\n            }\n        })\n        on(horiz, \"scroll\", function() {\n            if (horiz.clientWidth) {\n                scroll(horiz.scrollLeft, \"horizontal\")\n            }\n        })\n\n        this.checkedZeroWidth = false\n        // Need to set a minimum width to see the scrollbar on IE7 (but must not set it on IE8).\n        if (ie && ie_version < 8) {\n            this.horiz.style.minHeight = this.vert.style.minWidth = \"18px\"\n        }\n    }\n\n    NativeScrollbars.prototype.update = function(measure) {\n        var needsH = measure.scrollWidth > measure.clientWidth + 1\n        var needsV = measure.scrollHeight > measure.clientHeight + 1\n        var sWidth = measure.nativeBarWidth\n\n        if (needsV) {\n            this.vert.style.display = \"block\"\n            this.vert.style.bottom = needsH ? sWidth + \"px\" : \"0\"\n            var totalHeight = measure.viewHeight - (needsH ? sWidth : 0)\n            // A bug in IE8 can cause this value to be negative, so guard it.\n            this.vert.firstChild.style.height =\n                Math.max(0, measure.scrollHeight - measure.clientHeight + totalHeight) + \"px\"\n        } else {\n            this.vert.style.display = \"\"\n            this.vert.firstChild.style.height = \"0\"\n        }\n\n        if (needsH) {\n            this.horiz.style.display = \"block\"\n            this.horiz.style.right = needsV ? sWidth + \"px\" : \"0\"\n            this.horiz.style.left = measure.barLeft + \"px\"\n            var totalWidth = measure.viewWidth - measure.barLeft - (needsV ? sWidth : 0)\n            this.horiz.firstChild.style.width =\n                Math.max(0, measure.scrollWidth - measure.clientWidth + totalWidth) + \"px\"\n        } else {\n            this.horiz.style.display = \"\"\n            this.horiz.firstChild.style.width = \"0\"\n        }\n\n        if (!this.checkedZeroWidth && measure.clientHeight > 0) {\n            if (sWidth == 0) {\n                this.zeroWidthHack()\n            }\n            this.checkedZeroWidth = true\n        }\n\n        return { right: needsV ? sWidth : 0, bottom: needsH ? sWidth : 0 }\n    }\n\n    NativeScrollbars.prototype.setScrollLeft = function(pos) {\n        if (this.horiz.scrollLeft != pos) {\n            this.horiz.scrollLeft = pos\n        }\n        if (this.disableHoriz) {\n            this.enableZeroWidthBar(this.horiz, this.disableHoriz, \"horiz\")\n        }\n    }\n\n    NativeScrollbars.prototype.setScrollTop = function(pos) {\n        if (this.vert.scrollTop != pos) {\n            this.vert.scrollTop = pos\n        }\n        if (this.disableVert) {\n            this.enableZeroWidthBar(this.vert, this.disableVert, \"vert\")\n        }\n    }\n\n    NativeScrollbars.prototype.zeroWidthHack = function() {\n        var w = mac && !mac_geMountainLion ? \"12px\" : \"18px\"\n        this.horiz.style.height = this.vert.style.width = w\n        this.horiz.style.pointerEvents = this.vert.style.pointerEvents = \"none\"\n        this.disableHoriz = new Delayed()\n        this.disableVert = new Delayed()\n    }\n\n    NativeScrollbars.prototype.enableZeroWidthBar = function(bar, delay, type) {\n        bar.style.pointerEvents = \"auto\"\n        function maybeDisable() {\n            // To find out whether the scrollbar is still visible, we\n            // check whether the element under the pixel in the bottom\n            // right corner of the scrollbar box is the scrollbar box\n            // itself (when the bar is still visible) or its filler child\n            // (when the bar is hidden). If it is still visible, we keep\n            // it enabled, if it's hidden, we disable pointer events.\n            var box = bar.getBoundingClientRect()\n            var elt =\n                type == \"vert\"\n                    ? document.elementFromPoint(box.right - 1, (box.top + box.bottom) / 2)\n                    : document.elementFromPoint((box.right + box.left) / 2, box.bottom - 1)\n            if (elt != bar) {\n                bar.style.pointerEvents = \"none\"\n            } else {\n                delay.set(1000, maybeDisable)\n            }\n        }\n        delay.set(1000, maybeDisable)\n    }\n\n    NativeScrollbars.prototype.clear = function() {\n        var parent = this.horiz.parentNode\n        parent.removeChild(this.horiz)\n        parent.removeChild(this.vert)\n    }\n\n    var NullScrollbars = function() {}\n\n    NullScrollbars.prototype.update = function() {\n        return { bottom: 0, right: 0 }\n    }\n    NullScrollbars.prototype.setScrollLeft = function() {}\n    NullScrollbars.prototype.setScrollTop = function() {}\n    NullScrollbars.prototype.clear = function() {}\n\n    function updateScrollbars(cm, measure) {\n        if (!measure) {\n            measure = measureForScrollbars(cm)\n        }\n        var startWidth = cm.display.barWidth,\n            startHeight = cm.display.barHeight\n        updateScrollbarsInner(cm, measure)\n        for (\n            var i = 0;\n            (i < 4 && startWidth != cm.display.barWidth) || startHeight != cm.display.barHeight;\n            i++\n        ) {\n            if (startWidth != cm.display.barWidth && cm.options.lineWrapping) {\n                updateHeightsInViewport(cm)\n            }\n            updateScrollbarsInner(cm, measureForScrollbars(cm))\n            startWidth = cm.display.barWidth\n            startHeight = cm.display.barHeight\n        }\n    }\n\n    // Re-synchronize the fake scrollbars with the actual size of the\n    // content.\n    function updateScrollbarsInner(cm, measure) {\n        var d = cm.display\n        var sizes = d.scrollbars.update(measure)\n\n        d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\"\n        d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\"\n        d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\"\n\n        if (sizes.right && sizes.bottom) {\n            d.scrollbarFiller.style.display = \"block\"\n            d.scrollbarFiller.style.height = sizes.bottom + \"px\"\n            d.scrollbarFiller.style.width = sizes.right + \"px\"\n        } else {\n            d.scrollbarFiller.style.display = \"\"\n        }\n        if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n            d.gutterFiller.style.display = \"block\"\n            d.gutterFiller.style.height = sizes.bottom + \"px\"\n            d.gutterFiller.style.width = measure.gutterWidth + \"px\"\n        } else {\n            d.gutterFiller.style.display = \"\"\n        }\n    }\n\n    var scrollbarModel = { native: NativeScrollbars, null: NullScrollbars }\n\n    function initScrollbars(cm) {\n        if (cm.display.scrollbars) {\n            cm.display.scrollbars.clear()\n            if (cm.display.scrollbars.addClass) {\n                rmClass(cm.display.wrapper, cm.display.scrollbars.addClass)\n            }\n        }\n\n        cm.display.scrollbars = new scrollbarModel[cm.options.scrollbarStyle](\n            function(node) {\n                cm.display.wrapper.insertBefore(node, cm.display.scrollbarFiller)\n                // Prevent clicks in the scrollbars from killing focus\n                on(node, \"mousedown\", function() {\n                    if (cm.state.focused) {\n                        setTimeout(function() {\n                            return cm.display.input.focus()\n                        }, 0)\n                    }\n                })\n                node.setAttribute(\"cm-not-content\", \"true\")\n            },\n            function(pos, axis) {\n                if (axis == \"horizontal\") {\n                    setScrollLeft(cm, pos)\n                } else {\n                    updateScrollTop(cm, pos)\n                }\n            },\n            cm\n        )\n        if (cm.display.scrollbars.addClass) {\n            addClass(cm.display.wrapper, cm.display.scrollbars.addClass)\n        }\n    }\n\n    // Operations are used to wrap a series of changes to the editor\n    // state in such a way that each change won't have to update the\n    // cursor and display (which would be awkward, slow, and\n    // error-prone). Instead, display updates are batched and then all\n    // combined and executed at once.\n\n    var nextOpId = 0\n    // Start a new operation.\n    function startOperation(cm) {\n        cm.curOp = {\n            cm: cm,\n            viewChanged: false, // Flag that indicates that lines might need to be redrawn\n            startHeight: cm.doc.height, // Used to detect need to update scrollbar\n            forceUpdate: false, // Used to force a redraw\n            updateInput: 0, // Whether to reset the input textarea\n            typing: false, // Whether this reset should be careful to leave existing text (for compositing)\n            changeObjs: null, // Accumulated changes, for firing change events\n            cursorActivityHandlers: null, // Set of handlers to fire cursorActivity on\n            cursorActivityCalled: 0, // Tracks which cursorActivity handlers have been called already\n            selectionChanged: false, // Whether the selection needs to be redrawn\n            updateMaxLine: false, // Set when the widest line needs to be determined anew\n            scrollLeft: null,\n            scrollTop: null, // Intermediate scroll position, not pushed to DOM yet\n            scrollToPos: null, // Used to scroll to a specific position\n            focus: false,\n            id: ++nextOpId // Unique ID\n        }\n        pushOperation(cm.curOp)\n    }\n\n    // Finish an operation, updating the display and signalling delayed events\n    function endOperation(cm) {\n        var op = cm.curOp\n        if (op) {\n            finishOperation(op, function(group) {\n                for (var i = 0; i < group.ops.length; i++) {\n                    group.ops[i].cm.curOp = null\n                }\n                endOperations(group)\n            })\n        }\n    }\n\n    // The DOM updates done when an operation finishes are batched so\n    // that the minimum number of relayouts are required.\n    function endOperations(group) {\n        var ops = group.ops\n        for (\n            var i = 0;\n            i < ops.length;\n            i++ // Read DOM\n        ) {\n            endOperation_R1(ops[i])\n        }\n        for (\n            var i$1 = 0;\n            i$1 < ops.length;\n            i$1++ // Write DOM (maybe)\n        ) {\n            endOperation_W1(ops[i$1])\n        }\n        for (\n            var i$2 = 0;\n            i$2 < ops.length;\n            i$2++ // Read DOM\n        ) {\n            endOperation_R2(ops[i$2])\n        }\n        for (\n            var i$3 = 0;\n            i$3 < ops.length;\n            i$3++ // Write DOM (maybe)\n        ) {\n            endOperation_W2(ops[i$3])\n        }\n        for (\n            var i$4 = 0;\n            i$4 < ops.length;\n            i$4++ // Read DOM\n        ) {\n            endOperation_finish(ops[i$4])\n        }\n    }\n\n    function endOperation_R1(op) {\n        var cm = op.cm,\n            display = cm.display\n        maybeClipScrollbars(cm)\n        if (op.updateMaxLine) {\n            findMaxLine(cm)\n        }\n\n        op.mustUpdate =\n            op.viewChanged ||\n            op.forceUpdate ||\n            op.scrollTop != null ||\n            (op.scrollToPos &&\n                (op.scrollToPos.from.line < display.viewFrom ||\n                    op.scrollToPos.to.line >= display.viewTo)) ||\n            (display.maxLineChanged && cm.options.lineWrapping)\n        op.update =\n            op.mustUpdate &&\n            new DisplayUpdate(\n                cm,\n                op.mustUpdate && { top: op.scrollTop, ensure: op.scrollToPos },\n                op.forceUpdate\n            )\n    }\n\n    function endOperation_W1(op) {\n        op.updatedDisplay = op.mustUpdate && updateDisplayIfNeeded(op.cm, op.update)\n    }\n\n    function endOperation_R2(op) {\n        var cm = op.cm,\n            display = cm.display\n        if (op.updatedDisplay) {\n            updateHeightsInViewport(cm)\n        }\n\n        op.barMeasure = measureForScrollbars(cm)\n\n        // If the max line changed since it was last measured, measure it,\n        // and ensure the document's width matches it.\n        // updateDisplay_W2 will use these properties to do the actual resizing\n        if (display.maxLineChanged && !cm.options.lineWrapping) {\n            op.adjustWidthTo =\n                measureChar(cm, display.maxLine, display.maxLine.text.length).left + 3\n            cm.display.sizerWidth = op.adjustWidthTo\n            op.barMeasure.scrollWidth = Math.max(\n                display.scroller.clientWidth,\n                display.sizer.offsetLeft + op.adjustWidthTo + scrollGap(cm) + cm.display.barWidth\n            )\n            op.maxScrollLeft = Math.max(\n                0,\n                display.sizer.offsetLeft + op.adjustWidthTo - displayWidth(cm)\n            )\n        }\n\n        if (op.updatedDisplay || op.selectionChanged) {\n            op.preparedSelection = display.input.prepareSelection()\n        }\n    }\n\n    function endOperation_W2(op) {\n        var cm = op.cm\n\n        if (op.adjustWidthTo != null) {\n            cm.display.sizer.style.minWidth = op.adjustWidthTo + \"px\"\n            if (op.maxScrollLeft < cm.doc.scrollLeft) {\n                setScrollLeft(cm, Math.min(cm.display.scroller.scrollLeft, op.maxScrollLeft), true)\n            }\n            cm.display.maxLineChanged = false\n        }\n\n        var takeFocus = op.focus && op.focus == activeElt()\n        if (op.preparedSelection) {\n            cm.display.input.showSelection(op.preparedSelection, takeFocus)\n        }\n        if (op.updatedDisplay || op.startHeight != cm.doc.height) {\n            updateScrollbars(cm, op.barMeasure)\n        }\n        if (op.updatedDisplay) {\n            setDocumentHeight(cm, op.barMeasure)\n        }\n\n        if (op.selectionChanged) {\n            restartBlink(cm)\n        }\n\n        if (cm.state.focused && op.updateInput) {\n            cm.display.input.reset(op.typing)\n        }\n        if (takeFocus) {\n            ensureFocus(op.cm)\n        }\n    }\n\n    function endOperation_finish(op) {\n        var cm = op.cm,\n            display = cm.display,\n            doc = cm.doc\n\n        if (op.updatedDisplay) {\n            postUpdateDisplay(cm, op.update)\n        }\n\n        // Abort mouse wheel delta measurement, when scrolling explicitly\n        if (\n            display.wheelStartX != null &&\n            (op.scrollTop != null || op.scrollLeft != null || op.scrollToPos)\n        ) {\n            display.wheelStartX = display.wheelStartY = null\n        }\n\n        // Propagate the scroll position to the actual DOM scroller\n        if (op.scrollTop != null) {\n            setScrollTop(cm, op.scrollTop, op.forceScroll)\n        }\n\n        if (op.scrollLeft != null) {\n            setScrollLeft(cm, op.scrollLeft, true, true)\n        }\n        // If we need to scroll a specific position into view, do so.\n        if (op.scrollToPos) {\n            var rect = scrollPosIntoView(\n                cm,\n                clipPos(doc, op.scrollToPos.from),\n                clipPos(doc, op.scrollToPos.to),\n                op.scrollToPos.margin\n            )\n            maybeScrollWindow(cm, rect)\n        }\n\n        // Fire events for markers that are hidden/unidden by editing or\n        // undoing\n        var hidden = op.maybeHiddenMarkers,\n            unhidden = op.maybeUnhiddenMarkers\n        if (hidden) {\n            for (var i = 0; i < hidden.length; ++i) {\n                if (!hidden[i].lines.length) {\n                    signal(hidden[i], \"hide\")\n                }\n            }\n        }\n        if (unhidden) {\n            for (var i$1 = 0; i$1 < unhidden.length; ++i$1) {\n                if (unhidden[i$1].lines.length) {\n                    signal(unhidden[i$1], \"unhide\")\n                }\n            }\n        }\n\n        if (display.wrapper.offsetHeight) {\n            doc.scrollTop = cm.display.scroller.scrollTop\n        }\n\n        // Fire change events, and delayed event handlers\n        if (op.changeObjs) {\n            signal(cm, \"changes\", cm, op.changeObjs)\n        }\n        if (op.update) {\n            op.update.finish()\n        }\n    }\n\n    // Run the given function in an operation\n    function runInOp(cm, f) {\n        if (cm.curOp) {\n            return f()\n        }\n        startOperation(cm)\n        try {\n            return f()\n        } finally {\n            endOperation(cm)\n        }\n    }\n    // Wraps a function in an operation. Returns the wrapped function.\n    function operation(cm, f) {\n        return function() {\n            if (cm.curOp) {\n                return f.apply(cm, arguments)\n            }\n            startOperation(cm)\n            try {\n                return f.apply(cm, arguments)\n            } finally {\n                endOperation(cm)\n            }\n        }\n    }\n    // Used to add methods to editor and doc instances, wrapping them in\n    // operations.\n    function methodOp(f) {\n        return function() {\n            if (this.curOp) {\n                return f.apply(this, arguments)\n            }\n            startOperation(this)\n            try {\n                return f.apply(this, arguments)\n            } finally {\n                endOperation(this)\n            }\n        }\n    }\n    function docMethodOp(f) {\n        return function() {\n            var cm = this.cm\n            if (!cm || cm.curOp) {\n                return f.apply(this, arguments)\n            }\n            startOperation(cm)\n            try {\n                return f.apply(this, arguments)\n            } finally {\n                endOperation(cm)\n            }\n        }\n    }\n\n    // HIGHLIGHT WORKER\n\n    function startWorker(cm, time) {\n        if (cm.doc.highlightFrontier < cm.display.viewTo) {\n            cm.state.highlight.set(time, bind(highlightWorker, cm))\n        }\n    }\n\n    function highlightWorker(cm) {\n        var doc = cm.doc\n        if (doc.highlightFrontier >= cm.display.viewTo) {\n            return\n        }\n        var end = +new Date() + cm.options.workTime\n        var context = getContextBefore(cm, doc.highlightFrontier)\n        var changedLines = []\n\n        doc.iter(context.line, Math.min(doc.first + doc.size, cm.display.viewTo + 500), function(\n            line\n        ) {\n            if (context.line >= cm.display.viewFrom) {\n                // Visible\n                var oldStyles = line.styles\n                var resetState =\n                    line.text.length > cm.options.maxHighlightLength\n                        ? copyState(doc.mode, context.state)\n                        : null\n                var highlighted = highlightLine(cm, line, context, true)\n                if (resetState) {\n                    context.state = resetState\n                }\n                line.styles = highlighted.styles\n                var oldCls = line.styleClasses,\n                    newCls = highlighted.classes\n                if (newCls) {\n                    line.styleClasses = newCls\n                } else if (oldCls) {\n                    line.styleClasses = null\n                }\n                var ischange =\n                    !oldStyles ||\n                    oldStyles.length != line.styles.length ||\n                    (oldCls != newCls &&\n                        (!oldCls ||\n                            !newCls ||\n                            oldCls.bgClass != newCls.bgClass ||\n                            oldCls.textClass != newCls.textClass))\n                for (var i = 0; !ischange && i < oldStyles.length; ++i) {\n                    ischange = oldStyles[i] != line.styles[i]\n                }\n                if (ischange) {\n                    changedLines.push(context.line)\n                }\n                line.stateAfter = context.save()\n                context.nextLine()\n            } else {\n                if (line.text.length <= cm.options.maxHighlightLength) {\n                    processLine(cm, line.text, context)\n                }\n                line.stateAfter = context.line % 5 == 0 ? context.save() : null\n                context.nextLine()\n            }\n            if (+new Date() > end) {\n                startWorker(cm, cm.options.workDelay)\n                return true\n            }\n        })\n        doc.highlightFrontier = context.line\n        doc.modeFrontier = Math.max(doc.modeFrontier, context.line)\n        if (changedLines.length) {\n            runInOp(cm, function() {\n                for (var i = 0; i < changedLines.length; i++) {\n                    regLineChange(cm, changedLines[i], \"text\")\n                }\n            })\n        }\n    }\n\n    // DISPLAY DRAWING\n\n    var DisplayUpdate = function(cm, viewport, force) {\n        var display = cm.display\n\n        this.viewport = viewport\n        // Store some values that we'll need later (but don't want to force a relayout for)\n        this.visible = visibleLines(display, cm.doc, viewport)\n        this.editorIsHidden = !display.wrapper.offsetWidth\n        this.wrapperHeight = display.wrapper.clientHeight\n        this.wrapperWidth = display.wrapper.clientWidth\n        this.oldDisplayWidth = displayWidth(cm)\n        this.force = force\n        this.dims = getDimensions(cm)\n        this.events = []\n    }\n\n    DisplayUpdate.prototype.signal = function(emitter, type) {\n        if (hasHandler(emitter, type)) {\n            this.events.push(arguments)\n        }\n    }\n    DisplayUpdate.prototype.finish = function() {\n        for (var i = 0; i < this.events.length; i++) {\n            signal.apply(null, this.events[i])\n        }\n    }\n\n    function maybeClipScrollbars(cm) {\n        var display = cm.display\n        if (!display.scrollbarsClipped && display.scroller.offsetWidth) {\n            display.nativeBarWidth = display.scroller.offsetWidth - display.scroller.clientWidth\n            display.heightForcer.style.height = scrollGap(cm) + \"px\"\n            display.sizer.style.marginBottom = -display.nativeBarWidth + \"px\"\n            display.sizer.style.borderRightWidth = scrollGap(cm) + \"px\"\n            display.scrollbarsClipped = true\n        }\n    }\n\n    function selectionSnapshot(cm) {\n        if (cm.hasFocus()) {\n            return null\n        }\n        var active = activeElt()\n        if (!active || !contains(cm.display.lineDiv, active)) {\n            return null\n        }\n        var result = { activeElt: active }\n        if (window.getSelection) {\n            var sel = window.getSelection()\n            if (sel.anchorNode && sel.extend && contains(cm.display.lineDiv, sel.anchorNode)) {\n                result.anchorNode = sel.anchorNode\n                result.anchorOffset = sel.anchorOffset\n                result.focusNode = sel.focusNode\n                result.focusOffset = sel.focusOffset\n            }\n        }\n        return result\n    }\n\n    function restoreSelection(snapshot) {\n        if (!snapshot || !snapshot.activeElt || snapshot.activeElt == activeElt()) {\n            return\n        }\n        snapshot.activeElt.focus()\n        if (\n            snapshot.anchorNode &&\n            contains(document.body, snapshot.anchorNode) &&\n            contains(document.body, snapshot.focusNode)\n        ) {\n            var sel = window.getSelection(),\n                range = document.createRange()\n            range.setEnd(snapshot.anchorNode, snapshot.anchorOffset)\n            range.collapse(false)\n            sel.removeAllRanges()\n            sel.addRange(range)\n            sel.extend(snapshot.focusNode, snapshot.focusOffset)\n        }\n    }\n\n    // Does the actual updating of the line display. Bails out\n    // (returning false) when there is nothing to be done and forced is\n    // false.\n    function updateDisplayIfNeeded(cm, update) {\n        var display = cm.display,\n            doc = cm.doc\n\n        if (update.editorIsHidden) {\n            resetView(cm)\n            return false\n        }\n\n        // Bail out if the visible area is already rendered and nothing changed.\n        if (\n            !update.force &&\n            update.visible.from >= display.viewFrom &&\n            update.visible.to <= display.viewTo &&\n            (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\n            display.renderedView == display.view &&\n            countDirtyView(cm) == 0\n        ) {\n            return false\n        }\n\n        if (maybeUpdateLineNumberWidth(cm)) {\n            resetView(cm)\n            update.dims = getDimensions(cm)\n        }\n\n        // Compute a suitable new viewport (from & to)\n        var end = doc.first + doc.size\n        var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first)\n        var to = Math.min(end, update.visible.to + cm.options.viewportMargin)\n        if (display.viewFrom < from && from - display.viewFrom < 20) {\n            from = Math.max(doc.first, display.viewFrom)\n        }\n        if (display.viewTo > to && display.viewTo - to < 20) {\n            to = Math.min(end, display.viewTo)\n        }\n        if (sawCollapsedSpans) {\n            from = visualLineNo(cm.doc, from)\n            to = visualLineEndNo(cm.doc, to)\n        }\n\n        var different =\n            from != display.viewFrom ||\n            to != display.viewTo ||\n            display.lastWrapHeight != update.wrapperHeight ||\n            display.lastWrapWidth != update.wrapperWidth\n        adjustView(cm, from, to)\n\n        display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom))\n        // Position the mover div to align with the current scroll position\n        cm.display.mover.style.top = display.viewOffset + \"px\"\n\n        var toUpdate = countDirtyView(cm)\n        if (\n            !different &&\n            toUpdate == 0 &&\n            !update.force &&\n            display.renderedView == display.view &&\n            (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo)\n        ) {\n            return false\n        }\n\n        // For big changes, we hide the enclosing element during the\n        // update, since that speeds up the operations on most browsers.\n        var selSnapshot = selectionSnapshot(cm)\n        if (toUpdate > 4) {\n            display.lineDiv.style.display = \"none\"\n        }\n        patchDisplay(cm, display.updateLineNumbers, update.dims)\n        if (toUpdate > 4) {\n            display.lineDiv.style.display = \"\"\n        }\n        display.renderedView = display.view\n        // There might have been a widget with a focused element that got\n        // hidden or updated, if so re-focus it.\n        restoreSelection(selSnapshot)\n\n        // Prevent selection and cursors from interfering with the scroll\n        // width and height.\n        removeChildren(display.cursorDiv)\n        removeChildren(display.selectionDiv)\n        display.gutters.style.height = display.sizer.style.minHeight = 0\n\n        if (different) {\n            display.lastWrapHeight = update.wrapperHeight\n            display.lastWrapWidth = update.wrapperWidth\n            startWorker(cm, 400)\n        }\n\n        display.updateLineNumbers = null\n\n        return true\n    }\n\n    function postUpdateDisplay(cm, update) {\n        var viewport = update.viewport\n\n        for (var first = true; ; first = false) {\n            if (!first || !cm.options.lineWrapping || update.oldDisplayWidth == displayWidth(cm)) {\n                // Clip forced viewport to actual scrollable area.\n                if (viewport && viewport.top != null) {\n                    viewport = {\n                        top: Math.min(\n                            cm.doc.height + paddingVert(cm.display) - displayHeight(cm),\n                            viewport.top\n                        )\n                    }\n                }\n                // Updated line heights might result in the drawn area not\n                // actually covering the viewport. Keep looping until it does.\n                update.visible = visibleLines(cm.display, cm.doc, viewport)\n                if (\n                    update.visible.from >= cm.display.viewFrom &&\n                    update.visible.to <= cm.display.viewTo\n                ) {\n                    break\n                }\n            }\n            if (!updateDisplayIfNeeded(cm, update)) {\n                break\n            }\n            updateHeightsInViewport(cm)\n            var barMeasure = measureForScrollbars(cm)\n            updateSelection(cm)\n            updateScrollbars(cm, barMeasure)\n            setDocumentHeight(cm, barMeasure)\n            update.force = false\n        }\n\n        update.signal(cm, \"update\", cm)\n        if (\n            cm.display.viewFrom != cm.display.reportedViewFrom ||\n            cm.display.viewTo != cm.display.reportedViewTo\n        ) {\n            update.signal(cm, \"viewportChange\", cm, cm.display.viewFrom, cm.display.viewTo)\n            cm.display.reportedViewFrom = cm.display.viewFrom\n            cm.display.reportedViewTo = cm.display.viewTo\n        }\n    }\n\n    function updateDisplaySimple(cm, viewport) {\n        var update = new DisplayUpdate(cm, viewport)\n        if (updateDisplayIfNeeded(cm, update)) {\n            updateHeightsInViewport(cm)\n            postUpdateDisplay(cm, update)\n            var barMeasure = measureForScrollbars(cm)\n            updateSelection(cm)\n            updateScrollbars(cm, barMeasure)\n            setDocumentHeight(cm, barMeasure)\n            update.finish()\n        }\n    }\n\n    // Sync the actual display DOM structure with display.view, removing\n    // nodes for lines that are no longer in view, and creating the ones\n    // that are not there yet, and updating the ones that are out of\n    // date.\n    function patchDisplay(cm, updateNumbersFrom, dims) {\n        var display = cm.display,\n            lineNumbers = cm.options.lineNumbers\n        var container = display.lineDiv,\n            cur = container.firstChild\n\n        function rm(node) {\n            var next = node.nextSibling\n            // Works around a throw-scroll bug in OS X Webkit\n            if (webkit && mac && cm.display.currentWheelTarget == node) {\n                node.style.display = \"none\"\n            } else {\n                node.parentNode.removeChild(node)\n            }\n            return next\n        }\n\n        var view = display.view,\n            lineN = display.viewFrom\n        // Loop over the elements in the view, syncing cur (the DOM nodes\n        // in display.lineDiv) with the view as we go.\n        for (var i = 0; i < view.length; i++) {\n            var lineView = view[i]\n            if (lineView.hidden);\n            else if (!lineView.node || lineView.node.parentNode != container) {\n                // Not drawn yet\n                var node = buildLineElement(cm, lineView, lineN, dims)\n                container.insertBefore(node, cur)\n            } else {\n                // Already drawn\n                while (cur != lineView.node) {\n                    cur = rm(cur)\n                }\n                var updateNumber =\n                    lineNumbers &&\n                    updateNumbersFrom != null &&\n                    updateNumbersFrom <= lineN &&\n                    lineView.lineNumber\n                if (lineView.changes) {\n                    if (indexOf(lineView.changes, \"gutter\") > -1) {\n                        updateNumber = false\n                    }\n                    updateLineForChanges(cm, lineView, lineN, dims)\n                }\n                if (updateNumber) {\n                    removeChildren(lineView.lineNumber)\n                    lineView.lineNumber.appendChild(\n                        document.createTextNode(lineNumberFor(cm.options, lineN))\n                    )\n                }\n                cur = lineView.node.nextSibling\n            }\n            lineN += lineView.size\n        }\n        while (cur) {\n            cur = rm(cur)\n        }\n    }\n\n    function updateGutterSpace(display) {\n        var width = display.gutters.offsetWidth\n        display.sizer.style.marginLeft = width + \"px\"\n    }\n\n    function setDocumentHeight(cm, measure) {\n        cm.display.sizer.style.minHeight = measure.docHeight + \"px\"\n        cm.display.heightForcer.style.top = measure.docHeight + \"px\"\n        cm.display.gutters.style.height =\n            measure.docHeight + cm.display.barHeight + scrollGap(cm) + \"px\"\n    }\n\n    // Re-align line numbers and gutter marks to compensate for\n    // horizontal scrolling.\n    function alignHorizontally(cm) {\n        var display = cm.display,\n            view = display.view\n        if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) {\n            return\n        }\n        var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft\n        var gutterW = display.gutters.offsetWidth,\n            left = comp + \"px\"\n        for (var i = 0; i < view.length; i++) {\n            if (!view[i].hidden) {\n                if (cm.options.fixedGutter) {\n                    if (view[i].gutter) {\n                        view[i].gutter.style.left = left\n                    }\n                    if (view[i].gutterBackground) {\n                        view[i].gutterBackground.style.left = left\n                    }\n                }\n                var align = view[i].alignable\n                if (align) {\n                    for (var j = 0; j < align.length; j++) {\n                        align[j].style.left = left\n                    }\n                }\n            }\n        }\n        if (cm.options.fixedGutter) {\n            display.gutters.style.left = comp + gutterW + \"px\"\n        }\n    }\n\n    // Used to ensure that the line number gutter is still the right\n    // size for the current document size. Returns true when an update\n    // is needed.\n    function maybeUpdateLineNumberWidth(cm) {\n        if (!cm.options.lineNumbers) {\n            return false\n        }\n        var doc = cm.doc,\n            last = lineNumberFor(cm.options, doc.first + doc.size - 1),\n            display = cm.display\n        if (last.length != display.lineNumChars) {\n            var test = display.measure.appendChild(\n                elt(\"div\", [elt(\"div\", last)], \"CodeMirror-linenumber CodeMirror-gutter-elt\")\n            )\n            var innerW = test.firstChild.offsetWidth,\n                padding = test.offsetWidth - innerW\n            display.lineGutter.style.width = \"\"\n            display.lineNumInnerWidth =\n                Math.max(innerW, display.lineGutter.offsetWidth - padding) + 1\n            display.lineNumWidth = display.lineNumInnerWidth + padding\n            display.lineNumChars = display.lineNumInnerWidth ? last.length : -1\n            display.lineGutter.style.width = display.lineNumWidth + \"px\"\n            updateGutterSpace(cm.display)\n            return true\n        }\n        return false\n    }\n\n    function getGutters(gutters, lineNumbers) {\n        var result = [],\n            sawLineNumbers = false\n        for (var i = 0; i < gutters.length; i++) {\n            var name = gutters[i],\n                style = null\n            if (typeof name != \"string\") {\n                style = name.style\n                name = name.className\n            }\n            if (name == \"CodeMirror-linenumbers\") {\n                if (!lineNumbers) {\n                    continue\n                } else {\n                    sawLineNumbers = true\n                }\n            }\n            result.push({ className: name, style: style })\n        }\n        if (lineNumbers && !sawLineNumbers) {\n            result.push({ className: \"CodeMirror-linenumbers\", style: null })\n        }\n        return result\n    }\n\n    // Rebuild the gutter elements, ensure the margin to the left of the\n    // code matches their width.\n    function renderGutters(display) {\n        var gutters = display.gutters,\n            specs = display.gutterSpecs\n        removeChildren(gutters)\n        display.lineGutter = null\n        for (var i = 0; i < specs.length; ++i) {\n            var ref = specs[i]\n            var className = ref.className\n            var style = ref.style\n            var gElt = gutters.appendChild(elt(\"div\", null, \"CodeMirror-gutter \" + className))\n            if (style) {\n                gElt.style.cssText = style\n            }\n            if (className == \"CodeMirror-linenumbers\") {\n                display.lineGutter = gElt\n                gElt.style.width = (display.lineNumWidth || 1) + \"px\"\n            }\n        }\n        gutters.style.display = specs.length ? \"\" : \"none\"\n        updateGutterSpace(display)\n    }\n\n    function updateGutters(cm) {\n        renderGutters(cm.display)\n        regChange(cm)\n        alignHorizontally(cm)\n    }\n\n    // The display handles the DOM integration, both for input reading\n    // and content drawing. It holds references to DOM nodes and\n    // display-related state.\n\n    function Display(place, doc, input, options) {\n        var d = this\n        this.input = input\n\n        // Covers bottom-right square when both scrollbars are present.\n        d.scrollbarFiller = elt(\"div\", null, \"CodeMirror-scrollbar-filler\")\n        d.scrollbarFiller.setAttribute(\"cm-not-content\", \"true\")\n        // Covers bottom of gutter when coverGutterNextToScrollbar is on\n        // and h scrollbar is present.\n        d.gutterFiller = elt(\"div\", null, \"CodeMirror-gutter-filler\")\n        d.gutterFiller.setAttribute(\"cm-not-content\", \"true\")\n        // Will contain the actual code, positioned to cover the viewport.\n        d.lineDiv = eltP(\"div\", null, \"CodeMirror-code\")\n        // Elements are added to these to represent selection and cursors.\n        d.selectionDiv = elt(\"div\", null, null, \"position: relative; z-index: 1\")\n        d.cursorDiv = elt(\"div\", null, \"CodeMirror-cursors\")\n        // A visibility: hidden element used to find the size of things.\n        d.measure = elt(\"div\", null, \"CodeMirror-measure\")\n        // When lines outside of the viewport are measured, they are drawn in this.\n        d.lineMeasure = elt(\"div\", null, \"CodeMirror-measure\")\n        // Wraps everything that needs to exist inside the vertically-padded coordinate system\n        d.lineSpace = eltP(\n            \"div\",\n            [d.measure, d.lineMeasure, d.selectionDiv, d.cursorDiv, d.lineDiv],\n            null,\n            \"position: relative; outline: none\"\n        )\n        var lines = eltP(\"div\", [d.lineSpace], \"CodeMirror-lines\")\n        // Moved around its parent to cover visible view.\n        d.mover = elt(\"div\", [lines], null, \"position: relative\")\n        // Set to the height of the document, allowing scrolling.\n        d.sizer = elt(\"div\", [d.mover], \"CodeMirror-sizer\")\n        d.sizerWidth = null\n        // Behavior of elts with overflow: auto and padding is\n        // inconsistent across browsers. This is used to ensure the\n        // scrollable area is big enough.\n        d.heightForcer = elt(\n            \"div\",\n            null,\n            null,\n            \"position: absolute; height: \" + scrollerGap + \"px; width: 1px;\"\n        )\n        // Will contain the gutters, if any.\n        d.gutters = elt(\"div\", null, \"CodeMirror-gutters\")\n        d.lineGutter = null\n        // Actual scrollable element.\n        d.scroller = elt(\"div\", [d.sizer, d.heightForcer, d.gutters], \"CodeMirror-scroll\")\n        d.scroller.setAttribute(\"tabIndex\", \"-1\")\n        // The element in which the editor lives.\n        d.wrapper = elt(\"div\", [d.scrollbarFiller, d.gutterFiller, d.scroller], \"CodeMirror\")\n\n        // Work around IE7 z-index bug (not perfect, hence IE7 not really being supported)\n        if (ie && ie_version < 8) {\n            d.gutters.style.zIndex = -1\n            d.scroller.style.paddingRight = 0\n        }\n        if (!webkit && !(gecko && mobile)) {\n            d.scroller.draggable = true\n        }\n\n        if (place) {\n            if (place.appendChild) {\n                place.appendChild(d.wrapper)\n            } else {\n                place(d.wrapper)\n            }\n        }\n\n        // Current rendered range (may be bigger than the view window).\n        d.viewFrom = d.viewTo = doc.first\n        d.reportedViewFrom = d.reportedViewTo = doc.first\n        // Information about the rendered lines.\n        d.view = []\n        d.renderedView = null\n        // Holds info about a single rendered line when it was rendered\n        // for measurement, while not in view.\n        d.externalMeasured = null\n        // Empty space (in pixels) above the view\n        d.viewOffset = 0\n        d.lastWrapHeight = d.lastWrapWidth = 0\n        d.updateLineNumbers = null\n\n        d.nativeBarWidth = d.barHeight = d.barWidth = 0\n        d.scrollbarsClipped = false\n\n        // Used to only resize the line number gutter when necessary (when\n        // the amount of lines crosses a boundary that makes its width change)\n        d.lineNumWidth = d.lineNumInnerWidth = d.lineNumChars = null\n        // Set to true when a non-horizontal-scrolling line widget is\n        // added. As an optimization, line widget aligning is skipped when\n        // this is false.\n        d.alignWidgets = false\n\n        d.cachedCharWidth = d.cachedTextHeight = d.cachedPaddingH = null\n\n        // Tracks the maximum line length so that the horizontal scrollbar\n        // can be kept static when scrolling.\n        d.maxLine = null\n        d.maxLineLength = 0\n        d.maxLineChanged = false\n\n        // Used for measuring wheel scrolling granularity\n        d.wheelDX = d.wheelDY = d.wheelStartX = d.wheelStartY = null\n\n        // True when shift is held down.\n        d.shift = false\n\n        // Used to track whether anything happened since the context menu\n        // was opened.\n        d.selForContextMenu = null\n\n        d.activeTouch = null\n\n        d.gutterSpecs = getGutters(options.gutters, options.lineNumbers)\n        renderGutters(d)\n\n        input.init(d)\n    }\n\n    // Since the delta values reported on mouse wheel events are\n    // unstandardized between browsers and even browser versions, and\n    // generally horribly unpredictable, this code starts by measuring\n    // the scroll effect that the first few mouse wheel events have,\n    // and, from that, detects the way it can convert deltas to pixel\n    // offsets afterwards.\n    //\n    // The reason we want to know the amount a wheel event will scroll\n    // is that it gives us a chance to update the display before the\n    // actual scrolling happens, reducing flickering.\n\n    var wheelSamples = 0,\n        wheelPixelsPerUnit = null\n    // Fill in a browser-detected starting value on browsers where we\n    // know one. These don't have to be accurate -- the result of them\n    // being wrong would just be a slight flicker on the first wheel\n    // scroll (if it is large enough).\n    if (ie) {\n        wheelPixelsPerUnit = -0.53\n    } else if (gecko) {\n        wheelPixelsPerUnit = 15\n    } else if (chrome) {\n        wheelPixelsPerUnit = -0.7\n    } else if (safari) {\n        wheelPixelsPerUnit = -1 / 3\n    }\n\n    function wheelEventDelta(e) {\n        var dx = e.wheelDeltaX,\n            dy = e.wheelDeltaY\n        if (dx == null && e.detail && e.axis == e.HORIZONTAL_AXIS) {\n            dx = e.detail\n        }\n        if (dy == null && e.detail && e.axis == e.VERTICAL_AXIS) {\n            dy = e.detail\n        } else if (dy == null) {\n            dy = e.wheelDelta\n        }\n        return { x: dx, y: dy }\n    }\n    function wheelEventPixels(e) {\n        var delta = wheelEventDelta(e)\n        delta.x *= wheelPixelsPerUnit\n        delta.y *= wheelPixelsPerUnit\n        return delta\n    }\n\n    function onScrollWheel(cm, e) {\n        var delta = wheelEventDelta(e),\n            dx = delta.x,\n            dy = delta.y\n\n        var display = cm.display,\n            scroll = display.scroller\n        // Quit if there's nothing to scroll here\n        var canScrollX = scroll.scrollWidth > scroll.clientWidth\n        var canScrollY = scroll.scrollHeight > scroll.clientHeight\n        if (!((dx && canScrollX) || (dy && canScrollY))) {\n            return\n        }\n\n        // Webkit browsers on OS X abort momentum scrolls when the target\n        // of the scroll event is removed from the scrollable element.\n        // This hack (see related code in patchDisplay) makes sure the\n        // element is kept around.\n        if (dy && mac && webkit) {\n            outer: for (\n                var cur = e.target, view = display.view;\n                cur != scroll;\n                cur = cur.parentNode\n            ) {\n                for (var i = 0; i < view.length; i++) {\n                    if (view[i].node == cur) {\n                        cm.display.currentWheelTarget = cur\n                        break outer\n                    }\n                }\n            }\n        }\n\n        // On some browsers, horizontal scrolling will cause redraws to\n        // happen before the gutter has been realigned, causing it to\n        // wriggle around in a most unseemly way. When we have an\n        // estimated pixels/delta value, we just handle horizontal\n        // scrolling entirely here. It'll be slightly off from native, but\n        // better than glitching out.\n        if (dx && !gecko && !presto && wheelPixelsPerUnit != null) {\n            if (dy && canScrollY) {\n                updateScrollTop(cm, Math.max(0, scroll.scrollTop + dy * wheelPixelsPerUnit))\n            }\n            setScrollLeft(cm, Math.max(0, scroll.scrollLeft + dx * wheelPixelsPerUnit))\n            // Only prevent default scrolling if vertical scrolling is\n            // actually possible. Otherwise, it causes vertical scroll\n            // jitter on OSX trackpads when deltaX is small and deltaY\n            // is large (issue #3579)\n            if (!dy || (dy && canScrollY)) {\n                e_preventDefault(e)\n            }\n            display.wheelStartX = null // Abort measurement, if in progress\n            return\n        }\n\n        // 'Project' the visible viewport to cover the area that is being\n        // scrolled into view (if we know enough to estimate it).\n        if (dy && wheelPixelsPerUnit != null) {\n            var pixels = dy * wheelPixelsPerUnit\n            var top = cm.doc.scrollTop,\n                bot = top + display.wrapper.clientHeight\n            if (pixels < 0) {\n                top = Math.max(0, top + pixels - 50)\n            } else {\n                bot = Math.min(cm.doc.height, bot + pixels + 50)\n            }\n            updateDisplaySimple(cm, { top: top, bottom: bot })\n        }\n\n        if (wheelSamples < 20) {\n            if (display.wheelStartX == null) {\n                display.wheelStartX = scroll.scrollLeft\n                display.wheelStartY = scroll.scrollTop\n                display.wheelDX = dx\n                display.wheelDY = dy\n                setTimeout(function() {\n                    if (display.wheelStartX == null) {\n                        return\n                    }\n                    var movedX = scroll.scrollLeft - display.wheelStartX\n                    var movedY = scroll.scrollTop - display.wheelStartY\n                    var sample =\n                        (movedY && display.wheelDY && movedY / display.wheelDY) ||\n                        (movedX && display.wheelDX && movedX / display.wheelDX)\n                    display.wheelStartX = display.wheelStartY = null\n                    if (!sample) {\n                        return\n                    }\n                    wheelPixelsPerUnit =\n                        (wheelPixelsPerUnit * wheelSamples + sample) / (wheelSamples + 1)\n                    ++wheelSamples\n                }, 200)\n            } else {\n                display.wheelDX += dx\n                display.wheelDY += dy\n            }\n        }\n    }\n\n    // Selection objects are immutable. A new one is created every time\n    // the selection changes. A selection is one or more non-overlapping\n    // (and non-touching) ranges, sorted, and an integer that indicates\n    // which one is the primary selection (the one that's scrolled into\n    // view, that getCursor returns, etc).\n    var Selection = function(ranges, primIndex) {\n        this.ranges = ranges\n        this.primIndex = primIndex\n    }\n\n    Selection.prototype.primary = function() {\n        return this.ranges[this.primIndex]\n    }\n\n    Selection.prototype.equals = function(other) {\n        if (other == this) {\n            return true\n        }\n        if (other.primIndex != this.primIndex || other.ranges.length != this.ranges.length) {\n            return false\n        }\n        for (var i = 0; i < this.ranges.length; i++) {\n            var here = this.ranges[i],\n                there = other.ranges[i]\n            if (\n                !equalCursorPos(here.anchor, there.anchor) ||\n                !equalCursorPos(here.head, there.head)\n            ) {\n                return false\n            }\n        }\n        return true\n    }\n\n    Selection.prototype.deepCopy = function() {\n        var out = []\n        for (var i = 0; i < this.ranges.length; i++) {\n            out[i] = new Range(copyPos(this.ranges[i].anchor), copyPos(this.ranges[i].head))\n        }\n        return new Selection(out, this.primIndex)\n    }\n\n    Selection.prototype.somethingSelected = function() {\n        for (var i = 0; i < this.ranges.length; i++) {\n            if (!this.ranges[i].empty()) {\n                return true\n            }\n        }\n        return false\n    }\n\n    Selection.prototype.contains = function(pos, end) {\n        if (!end) {\n            end = pos\n        }\n        for (var i = 0; i < this.ranges.length; i++) {\n            var range = this.ranges[i]\n            if (cmp(end, range.from()) >= 0 && cmp(pos, range.to()) <= 0) {\n                return i\n            }\n        }\n        return -1\n    }\n\n    var Range = function(anchor, head) {\n        this.anchor = anchor\n        this.head = head\n    }\n\n    Range.prototype.from = function() {\n        return minPos(this.anchor, this.head)\n    }\n    Range.prototype.to = function() {\n        return maxPos(this.anchor, this.head)\n    }\n    Range.prototype.empty = function() {\n        return this.head.line == this.anchor.line && this.head.ch == this.anchor.ch\n    }\n\n    // Take an unsorted, potentially overlapping set of ranges, and\n    // build a selection out of it. 'Consumes' ranges array (modifying\n    // it).\n    function normalizeSelection(cm, ranges, primIndex) {\n        var mayTouch = cm && cm.options.selectionsMayTouch\n        var prim = ranges[primIndex]\n        ranges.sort(function(a, b) {\n            return cmp(a.from(), b.from())\n        })\n        primIndex = indexOf(ranges, prim)\n        for (var i = 1; i < ranges.length; i++) {\n            var cur = ranges[i],\n                prev = ranges[i - 1]\n            var diff = cmp(prev.to(), cur.from())\n            if (mayTouch && !cur.empty() ? diff > 0 : diff >= 0) {\n                var from = minPos(prev.from(), cur.from()),\n                    to = maxPos(prev.to(), cur.to())\n                var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head\n                if (i <= primIndex) {\n                    --primIndex\n                }\n                ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to))\n            }\n        }\n        return new Selection(ranges, primIndex)\n    }\n\n    function simpleSelection(anchor, head) {\n        return new Selection([new Range(anchor, head || anchor)], 0)\n    }\n\n    // Compute the position of the end of a change (its 'to' property\n    // refers to the pre-change end).\n    function changeEnd(change) {\n        if (!change.text) {\n            return change.to\n        }\n        return Pos(\n            change.from.line + change.text.length - 1,\n            lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0)\n        )\n    }\n\n    // Adjust a position to refer to the post-change position of the\n    // same text, or the end of the change if the change covers it.\n    function adjustForChange(pos, change) {\n        if (cmp(pos, change.from) < 0) {\n            return pos\n        }\n        if (cmp(pos, change.to) <= 0) {\n            return changeEnd(change)\n        }\n\n        var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1,\n            ch = pos.ch\n        if (pos.line == change.to.line) {\n            ch += changeEnd(change).ch - change.to.ch\n        }\n        return Pos(line, ch)\n    }\n\n    function computeSelAfterChange(doc, change) {\n        var out = []\n        for (var i = 0; i < doc.sel.ranges.length; i++) {\n            var range = doc.sel.ranges[i]\n            out.push(\n                new Range(\n                    adjustForChange(range.anchor, change),\n                    adjustForChange(range.head, change)\n                )\n            )\n        }\n        return normalizeSelection(doc.cm, out, doc.sel.primIndex)\n    }\n\n    function offsetPos(pos, old, nw) {\n        if (pos.line == old.line) {\n            return Pos(nw.line, pos.ch - old.ch + nw.ch)\n        } else {\n            return Pos(nw.line + (pos.line - old.line), pos.ch)\n        }\n    }\n\n    // Used by replaceSelections to allow moving the selection to the\n    // start or around the replaced test. Hint may be \"start\" or \"around\".\n    function computeReplacedSel(doc, changes, hint) {\n        var out = []\n        var oldPrev = Pos(doc.first, 0),\n            newPrev = oldPrev\n        for (var i = 0; i < changes.length; i++) {\n            var change = changes[i]\n            var from = offsetPos(change.from, oldPrev, newPrev)\n            var to = offsetPos(changeEnd(change), oldPrev, newPrev)\n            oldPrev = change.to\n            newPrev = to\n            if (hint == \"around\") {\n                var range = doc.sel.ranges[i],\n                    inv = cmp(range.head, range.anchor) < 0\n                out[i] = new Range(inv ? to : from, inv ? from : to)\n            } else {\n                out[i] = new Range(from, from)\n            }\n        }\n        return new Selection(out, doc.sel.primIndex)\n    }\n\n    // Used to get the editor into a consistent state again when options change.\n\n    function loadMode(cm) {\n        cm.doc.mode = getMode(cm.options, cm.doc.modeOption)\n        resetModeState(cm)\n    }\n\n    function resetModeState(cm) {\n        cm.doc.iter(function(line) {\n            if (line.stateAfter) {\n                line.stateAfter = null\n            }\n            if (line.styles) {\n                line.styles = null\n            }\n        })\n        cm.doc.modeFrontier = cm.doc.highlightFrontier = cm.doc.first\n        startWorker(cm, 100)\n        cm.state.modeGen++\n        if (cm.curOp) {\n            regChange(cm)\n        }\n    }\n\n    // DOCUMENT DATA STRUCTURE\n\n    // By default, updates that start and end at the beginning of a line\n    // are treated specially, in order to make the association of line\n    // widgets and marker elements with the text behave more intuitive.\n    function isWholeLineUpdate(doc, change) {\n        return (\n            change.from.ch == 0 &&\n            change.to.ch == 0 &&\n            lst(change.text) == \"\" &&\n            (!doc.cm || doc.cm.options.wholeLineUpdateBefore)\n        )\n    }\n\n    // Perform a change on the document data structure.\n    function updateDoc(doc, change, markedSpans, estimateHeight) {\n        function spansFor(n) {\n            return markedSpans ? markedSpans[n] : null\n        }\n        function update(line, text, spans) {\n            updateLine(line, text, spans, estimateHeight)\n            signalLater(line, \"change\", line, change)\n        }\n        function linesFor(start, end) {\n            var result = []\n            for (var i = start; i < end; ++i) {\n                result.push(new Line(text[i], spansFor(i), estimateHeight))\n            }\n            return result\n        }\n\n        var from = change.from,\n            to = change.to,\n            text = change.text\n        var firstLine = getLine(doc, from.line),\n            lastLine = getLine(doc, to.line)\n        var lastText = lst(text),\n            lastSpans = spansFor(text.length - 1),\n            nlines = to.line - from.line\n\n        // Adjust the line structure\n        if (change.full) {\n            doc.insert(0, linesFor(0, text.length))\n            doc.remove(text.length, doc.size - text.length)\n        } else if (isWholeLineUpdate(doc, change)) {\n            // This is a whole-line replace. Treated specially to make\n            // sure line objects move the way they are supposed to.\n            var added = linesFor(0, text.length - 1)\n            update(lastLine, lastLine.text, lastSpans)\n            if (nlines) {\n                doc.remove(from.line, nlines)\n            }\n            if (added.length) {\n                doc.insert(from.line, added)\n            }\n        } else if (firstLine == lastLine) {\n            if (text.length == 1) {\n                update(\n                    firstLine,\n                    firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch),\n                    lastSpans\n                )\n            } else {\n                var added$1 = linesFor(1, text.length - 1)\n                added$1.push(\n                    new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight)\n                )\n                update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0))\n                doc.insert(from.line + 1, added$1)\n            }\n        } else if (text.length == 1) {\n            update(\n                firstLine,\n                firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch),\n                spansFor(0)\n            )\n            doc.remove(from.line + 1, nlines)\n        } else {\n            update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0))\n            update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans)\n            var added$2 = linesFor(1, text.length - 1)\n            if (nlines > 1) {\n                doc.remove(from.line + 1, nlines - 1)\n            }\n            doc.insert(from.line + 1, added$2)\n        }\n\n        signalLater(doc, \"change\", doc, change)\n    }\n\n    // Call f for all linked documents.\n    function linkedDocs(doc, f, sharedHistOnly) {\n        function propagate(doc, skip, sharedHist) {\n            if (doc.linked) {\n                for (var i = 0; i < doc.linked.length; ++i) {\n                    var rel = doc.linked[i]\n                    if (rel.doc == skip) {\n                        continue\n                    }\n                    var shared = sharedHist && rel.sharedHist\n                    if (sharedHistOnly && !shared) {\n                        continue\n                    }\n                    f(rel.doc, shared)\n                    propagate(rel.doc, doc, shared)\n                }\n            }\n        }\n        propagate(doc, null, true)\n    }\n\n    // Attach a document to an editor.\n    function attachDoc(cm, doc) {\n        if (doc.cm) {\n            throw new Error(\"This document is already in use.\")\n        }\n        cm.doc = doc\n        doc.cm = cm\n        estimateLineHeights(cm)\n        loadMode(cm)\n        setDirectionClass(cm)\n        if (!cm.options.lineWrapping) {\n            findMaxLine(cm)\n        }\n        cm.options.mode = doc.modeOption\n        regChange(cm)\n    }\n\n    function setDirectionClass(cm) {\n        ;(cm.doc.direction == \"rtl\" ? addClass : rmClass)(cm.display.lineDiv, \"CodeMirror-rtl\")\n    }\n\n    function directionChanged(cm) {\n        runInOp(cm, function() {\n            setDirectionClass(cm)\n            regChange(cm)\n        })\n    }\n\n    function History(startGen) {\n        // Arrays of change events and selections. Doing something adds an\n        // event to done and clears undo. Undoing moves events from done\n        // to undone, redoing moves them in the other direction.\n        this.done = []\n        this.undone = []\n        this.undoDepth = Infinity\n        // Used to track when changes can be merged into a single undo\n        // event\n        this.lastModTime = this.lastSelTime = 0\n        this.lastOp = this.lastSelOp = null\n        this.lastOrigin = this.lastSelOrigin = null\n        // Used by the isClean() method\n        this.generation = this.maxGeneration = startGen || 1\n    }\n\n    // Create a history change event from an updateDoc-style change\n    // object.\n    function historyChangeFromChange(doc, change) {\n        var histChange = {\n            from: copyPos(change.from),\n            to: changeEnd(change),\n            text: getBetween(doc, change.from, change.to)\n        }\n        attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1)\n        linkedDocs(\n            doc,\n            function(doc) {\n                return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1)\n            },\n            true\n        )\n        return histChange\n    }\n\n    // Pop all selection events off the end of a history array. Stop at\n    // a change event.\n    function clearSelectionEvents(array) {\n        while (array.length) {\n            var last = lst(array)\n            if (last.ranges) {\n                array.pop()\n            } else {\n                break\n            }\n        }\n    }\n\n    // Find the top change event in the history. Pop off selection\n    // events that are in the way.\n    function lastChangeEvent(hist, force) {\n        if (force) {\n            clearSelectionEvents(hist.done)\n            return lst(hist.done)\n        } else if (hist.done.length && !lst(hist.done).ranges) {\n            return lst(hist.done)\n        } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {\n            hist.done.pop()\n            return lst(hist.done)\n        }\n    }\n\n    // Register a change in the history. Merges changes that are within\n    // a single operation, or are close together with an origin that\n    // allows merging (starting with \"+\") into a single event.\n    function addChangeToHistory(doc, change, selAfter, opId) {\n        var hist = doc.history\n        hist.undone.length = 0\n        var time = +new Date(),\n            cur\n        var last\n\n        if (\n            (hist.lastOp == opId ||\n                (hist.lastOrigin == change.origin &&\n                    change.origin &&\n                    ((change.origin.charAt(0) == \"+\" &&\n                        hist.lastModTime >\n                            time - (doc.cm ? doc.cm.options.historyEventDelay : 500)) ||\n                        change.origin.charAt(0) == \"*\"))) &&\n            (cur = lastChangeEvent(hist, hist.lastOp == opId))\n        ) {\n            // Merge this change into the last event\n            last = lst(cur.changes)\n            if (cmp(change.from, change.to) == 0 && cmp(change.from, last.to) == 0) {\n                // Optimized case for simple insertion -- don't want to add\n                // new changesets for every character typed\n                last.to = changeEnd(change)\n            } else {\n                // Add new sub-event\n                cur.changes.push(historyChangeFromChange(doc, change))\n            }\n        } else {\n            // Can not be merged, start a new event.\n            var before = lst(hist.done)\n            if (!before || !before.ranges) {\n                pushSelectionToHistory(doc.sel, hist.done)\n            }\n            cur = { changes: [historyChangeFromChange(doc, change)], generation: hist.generation }\n            hist.done.push(cur)\n            while (hist.done.length > hist.undoDepth) {\n                hist.done.shift()\n                if (!hist.done[0].ranges) {\n                    hist.done.shift()\n                }\n            }\n        }\n        hist.done.push(selAfter)\n        hist.generation = ++hist.maxGeneration\n        hist.lastModTime = hist.lastSelTime = time\n        hist.lastOp = hist.lastSelOp = opId\n        hist.lastOrigin = hist.lastSelOrigin = change.origin\n\n        if (!last) {\n            signal(doc, \"historyAdded\")\n        }\n    }\n\n    function selectionEventCanBeMerged(doc, origin, prev, sel) {\n        var ch = origin.charAt(0)\n        return (\n            ch == \"*\" ||\n            (ch == \"+\" &&\n                prev.ranges.length == sel.ranges.length &&\n                prev.somethingSelected() == sel.somethingSelected() &&\n                new Date() - doc.history.lastSelTime <=\n                    (doc.cm ? doc.cm.options.historyEventDelay : 500))\n        )\n    }\n\n    // Called whenever the selection changes, sets the new selection as\n    // the pending selection in the history, and pushes the old pending\n    // selection into the 'done' array when it was significantly\n    // different (in number of selected ranges, emptiness, or time).\n    function addSelectionToHistory(doc, sel, opId, options) {\n        var hist = doc.history,\n            origin = options && options.origin\n\n        // A new event is started when the previous origin does not match\n        // the current, or the origins don't allow matching. Origins\n        // starting with * are always merged, those starting with + are\n        // merged when similar and close together in time.\n        if (\n            opId == hist.lastSelOp ||\n            (origin &&\n                hist.lastSelOrigin == origin &&\n                ((hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin) ||\n                    selectionEventCanBeMerged(doc, origin, lst(hist.done), sel)))\n        ) {\n            hist.done[hist.done.length - 1] = sel\n        } else {\n            pushSelectionToHistory(sel, hist.done)\n        }\n\n        hist.lastSelTime = +new Date()\n        hist.lastSelOrigin = origin\n        hist.lastSelOp = opId\n        if (options && options.clearRedo !== false) {\n            clearSelectionEvents(hist.undone)\n        }\n    }\n\n    function pushSelectionToHistory(sel, dest) {\n        var top = lst(dest)\n        if (!(top && top.ranges && top.equals(sel))) {\n            dest.push(sel)\n        }\n    }\n\n    // Used to store marked span information in the history.\n    function attachLocalSpans(doc, change, from, to) {\n        var existing = change[\"spans_\" + doc.id],\n            n = 0\n        doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function(line) {\n            if (line.markedSpans) {\n                ;(existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans\n            }\n            ++n\n        })\n    }\n\n    // When un/re-doing restores text containing marked spans, those\n    // that have been explicitly cleared should not be restored.\n    function removeClearedSpans(spans) {\n        if (!spans) {\n            return null\n        }\n        var out\n        for (var i = 0; i < spans.length; ++i) {\n            if (spans[i].marker.explicitlyCleared) {\n                if (!out) {\n                    out = spans.slice(0, i)\n                }\n            } else if (out) {\n                out.push(spans[i])\n            }\n        }\n        return !out ? spans : out.length ? out : null\n    }\n\n    // Retrieve and filter the old marked spans stored in a change event.\n    function getOldSpans(doc, change) {\n        var found = change[\"spans_\" + doc.id]\n        if (!found) {\n            return null\n        }\n        var nw = []\n        for (var i = 0; i < change.text.length; ++i) {\n            nw.push(removeClearedSpans(found[i]))\n        }\n        return nw\n    }\n\n    // Used for un/re-doing changes from the history. Combines the\n    // result of computing the existing spans with the set of spans that\n    // existed in the history (so that deleting around a span and then\n    // undoing brings back the span).\n    function mergeOldSpans(doc, change) {\n        var old = getOldSpans(doc, change)\n        var stretched = stretchSpansOverChange(doc, change)\n        if (!old) {\n            return stretched\n        }\n        if (!stretched) {\n            return old\n        }\n\n        for (var i = 0; i < old.length; ++i) {\n            var oldCur = old[i],\n                stretchCur = stretched[i]\n            if (oldCur && stretchCur) {\n                spans: for (var j = 0; j < stretchCur.length; ++j) {\n                    var span = stretchCur[j]\n                    for (var k = 0; k < oldCur.length; ++k) {\n                        if (oldCur[k].marker == span.marker) {\n                            continue spans\n                        }\n                    }\n                    oldCur.push(span)\n                }\n            } else if (stretchCur) {\n                old[i] = stretchCur\n            }\n        }\n        return old\n    }\n\n    // Used both to provide a JSON-safe object in .getHistory, and, when\n    // detaching a document, to split the history in two\n    function copyHistoryArray(events, newGroup, instantiateSel) {\n        var copy = []\n        for (var i = 0; i < events.length; ++i) {\n            var event = events[i]\n            if (event.ranges) {\n                copy.push(instantiateSel ? Selection.prototype.deepCopy.call(event) : event)\n                continue\n            }\n            var changes = event.changes,\n                newChanges = []\n            copy.push({ changes: newChanges })\n            for (var j = 0; j < changes.length; ++j) {\n                var change = changes[j],\n                    m = void 0\n                newChanges.push({ from: change.from, to: change.to, text: change.text })\n                if (newGroup) {\n                    for (var prop in change) {\n                        if ((m = prop.match(/^spans_(\\d+)$/))) {\n                            if (indexOf(newGroup, Number(m[1])) > -1) {\n                                lst(newChanges)[prop] = change[prop]\n                                delete change[prop]\n                            }\n                        }\n                    }\n                }\n            }\n        }\n        return copy\n    }\n\n    // The 'scroll' parameter given to many of these indicated whether\n    // the new cursor position should be scrolled into view after\n    // modifying the selection.\n\n    // If shift is held or the extend flag is set, extends a range to\n    // include a given position (and optionally a second position).\n    // Otherwise, simply returns the range between the given positions.\n    // Used for cursor motion and such.\n    function extendRange(range, head, other, extend) {\n        if (extend) {\n            var anchor = range.anchor\n            if (other) {\n                var posBefore = cmp(head, anchor) < 0\n                if (posBefore != cmp(other, anchor) < 0) {\n                    anchor = head\n                    head = other\n                } else if (posBefore != cmp(head, other) < 0) {\n                    head = other\n                }\n            }\n            return new Range(anchor, head)\n        } else {\n            return new Range(other || head, head)\n        }\n    }\n\n    // Extend the primary selection range, discard the rest.\n    function extendSelection(doc, head, other, options, extend) {\n        if (extend == null) {\n            extend = doc.cm && (doc.cm.display.shift || doc.extend)\n        }\n        setSelection(\n            doc,\n            new Selection([extendRange(doc.sel.primary(), head, other, extend)], 0),\n            options\n        )\n    }\n\n    // Extend all selections (pos is an array of selections with length\n    // equal the number of selections)\n    function extendSelections(doc, heads, options) {\n        var out = []\n        var extend = doc.cm && (doc.cm.display.shift || doc.extend)\n        for (var i = 0; i < doc.sel.ranges.length; i++) {\n            out[i] = extendRange(doc.sel.ranges[i], heads[i], null, extend)\n        }\n        var newSel = normalizeSelection(doc.cm, out, doc.sel.primIndex)\n        setSelection(doc, newSel, options)\n    }\n\n    // Updates a single range in the selection.\n    function replaceOneSelection(doc, i, range, options) {\n        var ranges = doc.sel.ranges.slice(0)\n        ranges[i] = range\n        setSelection(doc, normalizeSelection(doc.cm, ranges, doc.sel.primIndex), options)\n    }\n\n    // Reset the selection to a single range.\n    function setSimpleSelection(doc, anchor, head, options) {\n        setSelection(doc, simpleSelection(anchor, head), options)\n    }\n\n    // Give beforeSelectionChange handlers a change to influence a\n    // selection update.\n    function filterSelectionChange(doc, sel, options) {\n        var obj = {\n            ranges: sel.ranges,\n            update: function(ranges) {\n                this.ranges = []\n                for (var i = 0; i < ranges.length; i++) {\n                    this.ranges[i] = new Range(\n                        clipPos(doc, ranges[i].anchor),\n                        clipPos(doc, ranges[i].head)\n                    )\n                }\n            },\n            origin: options && options.origin\n        }\n        signal(doc, \"beforeSelectionChange\", doc, obj)\n        if (doc.cm) {\n            signal(doc.cm, \"beforeSelectionChange\", doc.cm, obj)\n        }\n        if (obj.ranges != sel.ranges) {\n            return normalizeSelection(doc.cm, obj.ranges, obj.ranges.length - 1)\n        } else {\n            return sel\n        }\n    }\n\n    function setSelectionReplaceHistory(doc, sel, options) {\n        var done = doc.history.done,\n            last = lst(done)\n        if (last && last.ranges) {\n            done[done.length - 1] = sel\n            setSelectionNoUndo(doc, sel, options)\n        } else {\n            setSelection(doc, sel, options)\n        }\n    }\n\n    // Set a new selection.\n    function setSelection(doc, sel, options) {\n        setSelectionNoUndo(doc, sel, options)\n        addSelectionToHistory(doc, doc.sel, doc.cm ? doc.cm.curOp.id : NaN, options)\n    }\n\n    function setSelectionNoUndo(doc, sel, options) {\n        if (\n            hasHandler(doc, \"beforeSelectionChange\") ||\n            (doc.cm && hasHandler(doc.cm, \"beforeSelectionChange\"))\n        ) {\n            sel = filterSelectionChange(doc, sel, options)\n        }\n\n        var bias =\n            (options && options.bias) ||\n            (cmp(sel.primary().head, doc.sel.primary().head) < 0 ? -1 : 1)\n        setSelectionInner(doc, skipAtomicInSelection(doc, sel, bias, true))\n\n        if (!(options && options.scroll === false) && doc.cm) {\n            ensureCursorVisible(doc.cm)\n        }\n    }\n\n    function setSelectionInner(doc, sel) {\n        if (sel.equals(doc.sel)) {\n            return\n        }\n\n        doc.sel = sel\n\n        if (doc.cm) {\n            doc.cm.curOp.updateInput = 1\n            doc.cm.curOp.selectionChanged = true\n            signalCursorActivity(doc.cm)\n        }\n        signalLater(doc, \"cursorActivity\", doc)\n    }\n\n    // Verify that the selection does not partially select any atomic\n    // marked ranges.\n    function reCheckSelection(doc) {\n        setSelectionInner(doc, skipAtomicInSelection(doc, doc.sel, null, false))\n    }\n\n    // Return a selection that does not partially select any atomic\n    // ranges.\n    function skipAtomicInSelection(doc, sel, bias, mayClear) {\n        var out\n        for (var i = 0; i < sel.ranges.length; i++) {\n            var range = sel.ranges[i]\n            var old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i]\n            var newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear)\n            var newHead = skipAtomic(doc, range.head, old && old.head, bias, mayClear)\n            if (out || newAnchor != range.anchor || newHead != range.head) {\n                if (!out) {\n                    out = sel.ranges.slice(0, i)\n                }\n                out[i] = new Range(newAnchor, newHead)\n            }\n        }\n        return out ? normalizeSelection(doc.cm, out, sel.primIndex) : sel\n    }\n\n    function skipAtomicInner(doc, pos, oldPos, dir, mayClear) {\n        var line = getLine(doc, pos.line)\n        if (line.markedSpans) {\n            for (var i = 0; i < line.markedSpans.length; ++i) {\n                var sp = line.markedSpans[i],\n                    m = sp.marker\n\n                // Determine if we should prevent the cursor being placed to the left/right of an atomic marker\n                // Historically this was determined using the inclusiveLeft/Right option, but the new way to control it\n                // is with selectLeft/Right\n                var preventCursorLeft = \"selectLeft\" in m ? !m.selectLeft : m.inclusiveLeft\n                var preventCursorRight = \"selectRight\" in m ? !m.selectRight : m.inclusiveRight\n\n                if (\n                    (sp.from == null ||\n                        (preventCursorLeft ? sp.from <= pos.ch : sp.from < pos.ch)) &&\n                    (sp.to == null || (preventCursorRight ? sp.to >= pos.ch : sp.to > pos.ch))\n                ) {\n                    if (mayClear) {\n                        signal(m, \"beforeCursorEnter\")\n                        if (m.explicitlyCleared) {\n                            if (!line.markedSpans) {\n                                break\n                            } else {\n                                --i\n                                continue\n                            }\n                        }\n                    }\n                    if (!m.atomic) {\n                        continue\n                    }\n\n                    if (oldPos) {\n                        var near = m.find(dir < 0 ? 1 : -1),\n                            diff = void 0\n                        if (dir < 0 ? preventCursorRight : preventCursorLeft) {\n                            near = movePos(\n                                doc,\n                                near,\n                                -dir,\n                                near && near.line == pos.line ? line : null\n                            )\n                        }\n                        if (\n                            near &&\n                            near.line == pos.line &&\n                            (diff = cmp(near, oldPos)) &&\n                            (dir < 0 ? diff < 0 : diff > 0)\n                        ) {\n                            return skipAtomicInner(doc, near, pos, dir, mayClear)\n                        }\n                    }\n\n                    var far = m.find(dir < 0 ? -1 : 1)\n                    if (dir < 0 ? preventCursorLeft : preventCursorRight) {\n                        far = movePos(doc, far, dir, far.line == pos.line ? line : null)\n                    }\n                    return far ? skipAtomicInner(doc, far, pos, dir, mayClear) : null\n                }\n            }\n        }\n        return pos\n    }\n\n    // Ensure a given position is not inside an atomic range.\n    function skipAtomic(doc, pos, oldPos, bias, mayClear) {\n        var dir = bias || 1\n        var found =\n            skipAtomicInner(doc, pos, oldPos, dir, mayClear) ||\n            (!mayClear && skipAtomicInner(doc, pos, oldPos, dir, true)) ||\n            skipAtomicInner(doc, pos, oldPos, -dir, mayClear) ||\n            (!mayClear && skipAtomicInner(doc, pos, oldPos, -dir, true))\n        if (!found) {\n            doc.cantEdit = true\n            return Pos(doc.first, 0)\n        }\n        return found\n    }\n\n    function movePos(doc, pos, dir, line) {\n        if (dir < 0 && pos.ch == 0) {\n            if (pos.line > doc.first) {\n                return clipPos(doc, Pos(pos.line - 1))\n            } else {\n                return null\n            }\n        } else if (dir > 0 && pos.ch == (line || getLine(doc, pos.line)).text.length) {\n            if (pos.line < doc.first + doc.size - 1) {\n                return Pos(pos.line + 1, 0)\n            } else {\n                return null\n            }\n        } else {\n            return new Pos(pos.line, pos.ch + dir)\n        }\n    }\n\n    function selectAll(cm) {\n        cm.setSelection(Pos(cm.firstLine(), 0), Pos(cm.lastLine()), sel_dontScroll)\n    }\n\n    // UPDATING\n\n    // Allow \"beforeChange\" event handlers to influence a change\n    function filterChange(doc, change, update) {\n        var obj = {\n            canceled: false,\n            from: change.from,\n            to: change.to,\n            text: change.text,\n            origin: change.origin,\n            cancel: function() {\n                return (obj.canceled = true)\n            }\n        }\n        if (update) {\n            obj.update = function(from, to, text, origin) {\n                if (from) {\n                    obj.from = clipPos(doc, from)\n                }\n                if (to) {\n                    obj.to = clipPos(doc, to)\n                }\n                if (text) {\n                    obj.text = text\n                }\n                if (origin !== undefined) {\n                    obj.origin = origin\n                }\n            }\n        }\n        signal(doc, \"beforeChange\", doc, obj)\n        if (doc.cm) {\n            signal(doc.cm, \"beforeChange\", doc.cm, obj)\n        }\n\n        if (obj.canceled) {\n            if (doc.cm) {\n                doc.cm.curOp.updateInput = 2\n            }\n            return null\n        }\n        return { from: obj.from, to: obj.to, text: obj.text, origin: obj.origin }\n    }\n\n    // Apply a change to a document, and add it to the document's\n    // history, and propagating it to all linked documents.\n    function makeChange(doc, change, ignoreReadOnly) {\n        if (doc.cm) {\n            if (!doc.cm.curOp) {\n                return operation(doc.cm, makeChange)(doc, change, ignoreReadOnly)\n            }\n            if (doc.cm.state.suppressEdits) {\n                return\n            }\n        }\n\n        if (hasHandler(doc, \"beforeChange\") || (doc.cm && hasHandler(doc.cm, \"beforeChange\"))) {\n            change = filterChange(doc, change, true)\n            if (!change) {\n                return\n            }\n        }\n\n        // Possibly split or suppress the update based on the presence\n        // of read-only spans in its range.\n        var split =\n            sawReadOnlySpans && !ignoreReadOnly && removeReadOnlyRanges(doc, change.from, change.to)\n        if (split) {\n            for (var i = split.length - 1; i >= 0; --i) {\n                makeChangeInner(doc, {\n                    from: split[i].from,\n                    to: split[i].to,\n                    text: i ? [\"\"] : change.text,\n                    origin: change.origin\n                })\n            }\n        } else {\n            makeChangeInner(doc, change)\n        }\n    }\n\n    function makeChangeInner(doc, change) {\n        if (change.text.length == 1 && change.text[0] == \"\" && cmp(change.from, change.to) == 0) {\n            return\n        }\n        var selAfter = computeSelAfterChange(doc, change)\n        addChangeToHistory(doc, change, selAfter, doc.cm ? doc.cm.curOp.id : NaN)\n\n        makeChangeSingleDoc(doc, change, selAfter, stretchSpansOverChange(doc, change))\n        var rebased = []\n\n        linkedDocs(doc, function(doc, sharedHist) {\n            if (!sharedHist && indexOf(rebased, doc.history) == -1) {\n                rebaseHist(doc.history, change)\n                rebased.push(doc.history)\n            }\n            makeChangeSingleDoc(doc, change, null, stretchSpansOverChange(doc, change))\n        })\n    }\n\n    // Revert a change stored in a document's history.\n    function makeChangeFromHistory(doc, type, allowSelectionOnly) {\n        var suppress = doc.cm && doc.cm.state.suppressEdits\n        if (suppress && !allowSelectionOnly) {\n            return\n        }\n\n        var hist = doc.history,\n            event,\n            selAfter = doc.sel\n        var source = type == \"undo\" ? hist.done : hist.undone,\n            dest = type == \"undo\" ? hist.undone : hist.done\n\n        // Verify that there is a useable event (so that ctrl-z won't\n        // needlessly clear selection events)\n        var i = 0\n        for (; i < source.length; i++) {\n            event = source[i]\n            if (allowSelectionOnly ? event.ranges && !event.equals(doc.sel) : !event.ranges) {\n                break\n            }\n        }\n        if (i == source.length) {\n            return\n        }\n        hist.lastOrigin = hist.lastSelOrigin = null\n\n        for (;;) {\n            event = source.pop()\n            if (event.ranges) {\n                pushSelectionToHistory(event, dest)\n                if (allowSelectionOnly && !event.equals(doc.sel)) {\n                    setSelection(doc, event, { clearRedo: false })\n                    return\n                }\n                selAfter = event\n            } else if (suppress) {\n                source.push(event)\n                return\n            } else {\n                break\n            }\n        }\n\n        // Build up a reverse change object to add to the opposite history\n        // stack (redo when undoing, and vice versa).\n        var antiChanges = []\n        pushSelectionToHistory(selAfter, dest)\n        dest.push({ changes: antiChanges, generation: hist.generation })\n        hist.generation = event.generation || ++hist.maxGeneration\n\n        var filter =\n            hasHandler(doc, \"beforeChange\") || (doc.cm && hasHandler(doc.cm, \"beforeChange\"))\n\n        var loop = function(i) {\n            var change = event.changes[i]\n            change.origin = type\n            if (filter && !filterChange(doc, change, false)) {\n                source.length = 0\n                return {}\n            }\n\n            antiChanges.push(historyChangeFromChange(doc, change))\n\n            var after = i ? computeSelAfterChange(doc, change) : lst(source)\n            makeChangeSingleDoc(doc, change, after, mergeOldSpans(doc, change))\n            if (!i && doc.cm) {\n                doc.cm.scrollIntoView({ from: change.from, to: changeEnd(change) })\n            }\n            var rebased = []\n\n            // Propagate to the linked documents\n            linkedDocs(doc, function(doc, sharedHist) {\n                if (!sharedHist && indexOf(rebased, doc.history) == -1) {\n                    rebaseHist(doc.history, change)\n                    rebased.push(doc.history)\n                }\n                makeChangeSingleDoc(doc, change, null, mergeOldSpans(doc, change))\n            })\n        }\n\n        for (var i$1 = event.changes.length - 1; i$1 >= 0; --i$1) {\n            var returned = loop(i$1)\n\n            if (returned) return returned.v\n        }\n    }\n\n    // Sub-views need their line numbers shifted when text is added\n    // above or below them in the parent document.\n    function shiftDoc(doc, distance) {\n        if (distance == 0) {\n            return\n        }\n        doc.first += distance\n        doc.sel = new Selection(\n            map(doc.sel.ranges, function(range) {\n                return new Range(\n                    Pos(range.anchor.line + distance, range.anchor.ch),\n                    Pos(range.head.line + distance, range.head.ch)\n                )\n            }),\n            doc.sel.primIndex\n        )\n        if (doc.cm) {\n            regChange(doc.cm, doc.first, doc.first - distance, distance)\n            for (var d = doc.cm.display, l = d.viewFrom; l < d.viewTo; l++) {\n                regLineChange(doc.cm, l, \"gutter\")\n            }\n        }\n    }\n\n    // More lower-level change function, handling only a single document\n    // (not linked ones).\n    function makeChangeSingleDoc(doc, change, selAfter, spans) {\n        if (doc.cm && !doc.cm.curOp) {\n            return operation(doc.cm, makeChangeSingleDoc)(doc, change, selAfter, spans)\n        }\n\n        if (change.to.line < doc.first) {\n            shiftDoc(doc, change.text.length - 1 - (change.to.line - change.from.line))\n            return\n        }\n        if (change.from.line > doc.lastLine()) {\n            return\n        }\n\n        // Clip the change to the size of this doc\n        if (change.from.line < doc.first) {\n            var shift = change.text.length - 1 - (doc.first - change.from.line)\n            shiftDoc(doc, shift)\n            change = {\n                from: Pos(doc.first, 0),\n                to: Pos(change.to.line + shift, change.to.ch),\n                text: [lst(change.text)],\n                origin: change.origin\n            }\n        }\n        var last = doc.lastLine()\n        if (change.to.line > last) {\n            change = {\n                from: change.from,\n                to: Pos(last, getLine(doc, last).text.length),\n                text: [change.text[0]],\n                origin: change.origin\n            }\n        }\n\n        change.removed = getBetween(doc, change.from, change.to)\n\n        if (!selAfter) {\n            selAfter = computeSelAfterChange(doc, change)\n        }\n        if (doc.cm) {\n            makeChangeSingleDocInEditor(doc.cm, change, spans)\n        } else {\n            updateDoc(doc, change, spans)\n        }\n        setSelectionNoUndo(doc, selAfter, sel_dontScroll)\n\n        if (doc.cantEdit && skipAtomic(doc, Pos(doc.firstLine(), 0))) {\n            doc.cantEdit = false\n        }\n    }\n\n    // Handle the interaction of a change to a document with the editor\n    // that this document is part of.\n    function makeChangeSingleDocInEditor(cm, change, spans) {\n        var doc = cm.doc,\n            display = cm.display,\n            from = change.from,\n            to = change.to\n\n        var recomputeMaxLength = false,\n            checkWidthStart = from.line\n        if (!cm.options.lineWrapping) {\n            checkWidthStart = lineNo(visualLine(getLine(doc, from.line)))\n            doc.iter(checkWidthStart, to.line + 1, function(line) {\n                if (line == display.maxLine) {\n                    recomputeMaxLength = true\n                    return true\n                }\n            })\n        }\n\n        if (doc.sel.contains(change.from, change.to) > -1) {\n            signalCursorActivity(cm)\n        }\n\n        updateDoc(doc, change, spans, estimateHeight(cm))\n\n        if (!cm.options.lineWrapping) {\n            doc.iter(checkWidthStart, from.line + change.text.length, function(line) {\n                var len = lineLength(line)\n                if (len > display.maxLineLength) {\n                    display.maxLine = line\n                    display.maxLineLength = len\n                    display.maxLineChanged = true\n                    recomputeMaxLength = false\n                }\n            })\n            if (recomputeMaxLength) {\n                cm.curOp.updateMaxLine = true\n            }\n        }\n\n        retreatFrontier(doc, from.line)\n        startWorker(cm, 400)\n\n        var lendiff = change.text.length - (to.line - from.line) - 1\n        // Remember that these lines changed, for updating the display\n        if (change.full) {\n            regChange(cm)\n        } else if (\n            from.line == to.line &&\n            change.text.length == 1 &&\n            !isWholeLineUpdate(cm.doc, change)\n        ) {\n            regLineChange(cm, from.line, \"text\")\n        } else {\n            regChange(cm, from.line, to.line + 1, lendiff)\n        }\n\n        var changesHandler = hasHandler(cm, \"changes\"),\n            changeHandler = hasHandler(cm, \"change\")\n        if (changeHandler || changesHandler) {\n            var obj = {\n                from: from,\n                to: to,\n                text: change.text,\n                removed: change.removed,\n                origin: change.origin\n            }\n            if (changeHandler) {\n                signalLater(cm, \"change\", cm, obj)\n            }\n            if (changesHandler) {\n                ;(cm.curOp.changeObjs || (cm.curOp.changeObjs = [])).push(obj)\n            }\n        }\n        cm.display.selForContextMenu = null\n    }\n\n    function replaceRange(doc, code, from, to, origin) {\n        var assign\n\n        if (!to) {\n            to = from\n        }\n        if (cmp(to, from) < 0) {\n            ;(assign = [to, from]), (from = assign[0]), (to = assign[1])\n        }\n        if (typeof code == \"string\") {\n            code = doc.splitLines(code)\n        }\n        makeChange(doc, { from: from, to: to, text: code, origin: origin })\n    }\n\n    // Rebasing/resetting history to deal with externally-sourced changes\n\n    function rebaseHistSelSingle(pos, from, to, diff) {\n        if (to < pos.line) {\n            pos.line += diff\n        } else if (from < pos.line) {\n            pos.line = from\n            pos.ch = 0\n        }\n    }\n\n    // Tries to rebase an array of history events given a change in the\n    // document. If the change touches the same lines as the event, the\n    // event, and everything 'behind' it, is discarded. If the change is\n    // before the event, the event's positions are updated. Uses a\n    // copy-on-write scheme for the positions, to avoid having to\n    // reallocate them all on every rebase, but also avoid problems with\n    // shared position objects being unsafely updated.\n    function rebaseHistArray(array, from, to, diff) {\n        for (var i = 0; i < array.length; ++i) {\n            var sub = array[i],\n                ok = true\n            if (sub.ranges) {\n                if (!sub.copied) {\n                    sub = array[i] = sub.deepCopy()\n                    sub.copied = true\n                }\n                for (var j = 0; j < sub.ranges.length; j++) {\n                    rebaseHistSelSingle(sub.ranges[j].anchor, from, to, diff)\n                    rebaseHistSelSingle(sub.ranges[j].head, from, to, diff)\n                }\n                continue\n            }\n            for (var j$1 = 0; j$1 < sub.changes.length; ++j$1) {\n                var cur = sub.changes[j$1]\n                if (to < cur.from.line) {\n                    cur.from = Pos(cur.from.line + diff, cur.from.ch)\n                    cur.to = Pos(cur.to.line + diff, cur.to.ch)\n                } else if (from <= cur.to.line) {\n                    ok = false\n                    break\n                }\n            }\n            if (!ok) {\n                array.splice(0, i + 1)\n                i = 0\n            }\n        }\n    }\n\n    function rebaseHist(hist, change) {\n        var from = change.from.line,\n            to = change.to.line,\n            diff = change.text.length - (to - from) - 1\n        rebaseHistArray(hist.done, from, to, diff)\n        rebaseHistArray(hist.undone, from, to, diff)\n    }\n\n    // Utility for applying a change to a line by handle or number,\n    // returning the number and optionally registering the line as\n    // changed.\n    function changeLine(doc, handle, changeType, op) {\n        var no = handle,\n            line = handle\n        if (typeof handle == \"number\") {\n            line = getLine(doc, clipLine(doc, handle))\n        } else {\n            no = lineNo(handle)\n        }\n        if (no == null) {\n            return null\n        }\n        if (op(line, no) && doc.cm) {\n            regLineChange(doc.cm, no, changeType)\n        }\n        return line\n    }\n\n    // The document is represented as a BTree consisting of leaves, with\n    // chunk of lines in them, and branches, with up to ten leaves or\n    // other branch nodes below them. The top node is always a branch\n    // node, and is the document object itself (meaning it has\n    // additional methods and properties).\n    //\n    // All nodes have parent links. The tree is used both to go from\n    // line numbers to line objects, and to go from objects to numbers.\n    // It also indexes by height, and is used to convert between height\n    // and line object, and to find the total height of the document.\n    //\n    // See also http://marijnhaverbeke.nl/blog/codemirror-line-tree.html\n\n    function LeafChunk(lines) {\n        this.lines = lines\n        this.parent = null\n        var height = 0\n        for (var i = 0; i < lines.length; ++i) {\n            lines[i].parent = this\n            height += lines[i].height\n        }\n        this.height = height\n    }\n\n    LeafChunk.prototype = {\n        chunkSize: function() {\n            return this.lines.length\n        },\n\n        // Remove the n lines at offset 'at'.\n        removeInner: function(at, n) {\n            for (var i = at, e = at + n; i < e; ++i) {\n                var line = this.lines[i]\n                this.height -= line.height\n                cleanUpLine(line)\n                signalLater(line, \"delete\")\n            }\n            this.lines.splice(at, n)\n        },\n\n        // Helper used to collapse a small branch into a single leaf.\n        collapse: function(lines) {\n            lines.push.apply(lines, this.lines)\n        },\n\n        // Insert the given array of lines at offset 'at', count them as\n        // having the given height.\n        insertInner: function(at, lines, height) {\n            this.height += height\n            this.lines = this.lines\n                .slice(0, at)\n                .concat(lines)\n                .concat(this.lines.slice(at))\n            for (var i = 0; i < lines.length; ++i) {\n                lines[i].parent = this\n            }\n        },\n\n        // Used to iterate over a part of the tree.\n        iterN: function(at, n, op) {\n            for (var e = at + n; at < e; ++at) {\n                if (op(this.lines[at])) {\n                    return true\n                }\n            }\n        }\n    }\n\n    function BranchChunk(children) {\n        this.children = children\n        var size = 0,\n            height = 0\n        for (var i = 0; i < children.length; ++i) {\n            var ch = children[i]\n            size += ch.chunkSize()\n            height += ch.height\n            ch.parent = this\n        }\n        this.size = size\n        this.height = height\n        this.parent = null\n    }\n\n    BranchChunk.prototype = {\n        chunkSize: function() {\n            return this.size\n        },\n\n        removeInner: function(at, n) {\n            this.size -= n\n            for (var i = 0; i < this.children.length; ++i) {\n                var child = this.children[i],\n                    sz = child.chunkSize()\n                if (at < sz) {\n                    var rm = Math.min(n, sz - at),\n                        oldHeight = child.height\n                    child.removeInner(at, rm)\n                    this.height -= oldHeight - child.height\n                    if (sz == rm) {\n                        this.children.splice(i--, 1)\n                        child.parent = null\n                    }\n                    if ((n -= rm) == 0) {\n                        break\n                    }\n                    at = 0\n                } else {\n                    at -= sz\n                }\n            }\n            // If the result is smaller than 25 lines, ensure that it is a\n            // single leaf node.\n            if (\n                this.size - n < 25 &&\n                (this.children.length > 1 || !(this.children[0] instanceof LeafChunk))\n            ) {\n                var lines = []\n                this.collapse(lines)\n                this.children = [new LeafChunk(lines)]\n                this.children[0].parent = this\n            }\n        },\n\n        collapse: function(lines) {\n            for (var i = 0; i < this.children.length; ++i) {\n                this.children[i].collapse(lines)\n            }\n        },\n\n        insertInner: function(at, lines, height) {\n            this.size += lines.length\n            this.height += height\n            for (var i = 0; i < this.children.length; ++i) {\n                var child = this.children[i],\n                    sz = child.chunkSize()\n                if (at <= sz) {\n                    child.insertInner(at, lines, height)\n                    if (child.lines && child.lines.length > 50) {\n                        // To avoid memory thrashing when child.lines is huge (e.g. first view of a large file), it's never spliced.\n                        // Instead, small slices are taken. They're taken in order because sequential memory accesses are fastest.\n                        var remaining = (child.lines.length % 25) + 25\n                        for (var pos = remaining; pos < child.lines.length; ) {\n                            var leaf = new LeafChunk(child.lines.slice(pos, (pos += 25)))\n                            child.height -= leaf.height\n                            this.children.splice(++i, 0, leaf)\n                            leaf.parent = this\n                        }\n                        child.lines = child.lines.slice(0, remaining)\n                        this.maybeSpill()\n                    }\n                    break\n                }\n                at -= sz\n            }\n        },\n\n        // When a node has grown, check whether it should be split.\n        maybeSpill: function() {\n            if (this.children.length <= 10) {\n                return\n            }\n            var me = this\n            do {\n                var spilled = me.children.splice(me.children.length - 5, 5)\n                var sibling = new BranchChunk(spilled)\n                if (!me.parent) {\n                    // Become the parent node\n                    var copy = new BranchChunk(me.children)\n                    copy.parent = me\n                    me.children = [copy, sibling]\n                    me = copy\n                } else {\n                    me.size -= sibling.size\n                    me.height -= sibling.height\n                    var myIndex = indexOf(me.parent.children, me)\n                    me.parent.children.splice(myIndex + 1, 0, sibling)\n                }\n                sibling.parent = me.parent\n            } while (me.children.length > 10)\n            me.parent.maybeSpill()\n        },\n\n        iterN: function(at, n, op) {\n            for (var i = 0; i < this.children.length; ++i) {\n                var child = this.children[i],\n                    sz = child.chunkSize()\n                if (at < sz) {\n                    var used = Math.min(n, sz - at)\n                    if (child.iterN(at, used, op)) {\n                        return true\n                    }\n                    if ((n -= used) == 0) {\n                        break\n                    }\n                    at = 0\n                } else {\n                    at -= sz\n                }\n            }\n        }\n    }\n\n    // Line widgets are block elements displayed above or below a line.\n\n    var LineWidget = function(doc, node, options) {\n        if (options) {\n            for (var opt in options) {\n                if (options.hasOwnProperty(opt)) {\n                    this[opt] = options[opt]\n                }\n            }\n        }\n        this.doc = doc\n        this.node = node\n    }\n\n    LineWidget.prototype.clear = function() {\n        var cm = this.doc.cm,\n            ws = this.line.widgets,\n            line = this.line,\n            no = lineNo(line)\n        if (no == null || !ws) {\n            return\n        }\n        for (var i = 0; i < ws.length; ++i) {\n            if (ws[i] == this) {\n                ws.splice(i--, 1)\n            }\n        }\n        if (!ws.length) {\n            line.widgets = null\n        }\n        var height = widgetHeight(this)\n        updateLineHeight(line, Math.max(0, line.height - height))\n        if (cm) {\n            runInOp(cm, function() {\n                adjustScrollWhenAboveVisible(cm, line, -height)\n                regLineChange(cm, no, \"widget\")\n            })\n            signalLater(cm, \"lineWidgetCleared\", cm, this, no)\n        }\n    }\n\n    LineWidget.prototype.changed = function() {\n        var this$1 = this\n\n        var oldH = this.height,\n            cm = this.doc.cm,\n            line = this.line\n        this.height = null\n        var diff = widgetHeight(this) - oldH\n        if (!diff) {\n            return\n        }\n        if (!lineIsHidden(this.doc, line)) {\n            updateLineHeight(line, line.height + diff)\n        }\n        if (cm) {\n            runInOp(cm, function() {\n                cm.curOp.forceUpdate = true\n                adjustScrollWhenAboveVisible(cm, line, diff)\n                signalLater(cm, \"lineWidgetChanged\", cm, this$1, lineNo(line))\n            })\n        }\n    }\n    eventMixin(LineWidget)\n\n    function adjustScrollWhenAboveVisible(cm, line, diff) {\n        if (heightAtLine(line) < ((cm.curOp && cm.curOp.scrollTop) || cm.doc.scrollTop)) {\n            addToScrollTop(cm, diff)\n        }\n    }\n\n    function addLineWidget(doc, handle, node, options) {\n        var widget = new LineWidget(doc, node, options)\n        var cm = doc.cm\n        if (cm && widget.noHScroll) {\n            cm.display.alignWidgets = true\n        }\n        changeLine(doc, handle, \"widget\", function(line) {\n            var widgets = line.widgets || (line.widgets = [])\n            if (widget.insertAt == null) {\n                widgets.push(widget)\n            } else {\n                widgets.splice(\n                    Math.min(widgets.length - 1, Math.max(0, widget.insertAt)),\n                    0,\n                    widget\n                )\n            }\n            widget.line = line\n            if (cm && !lineIsHidden(doc, line)) {\n                var aboveVisible = heightAtLine(line) < doc.scrollTop\n                updateLineHeight(line, line.height + widgetHeight(widget))\n                if (aboveVisible) {\n                    addToScrollTop(cm, widget.height)\n                }\n                cm.curOp.forceUpdate = true\n            }\n            return true\n        })\n        if (cm) {\n            signalLater(\n                cm,\n                \"lineWidgetAdded\",\n                cm,\n                widget,\n                typeof handle == \"number\" ? handle : lineNo(handle)\n            )\n        }\n        return widget\n    }\n\n    // TEXTMARKERS\n\n    // Created with markText and setBookmark methods. A TextMarker is a\n    // handle that can be used to clear or find a marked position in the\n    // document. Line objects hold arrays (markedSpans) containing\n    // {from, to, marker} object pointing to such marker objects, and\n    // indicating that such a marker is present on that line. Multiple\n    // lines may point to the same marker when it spans across lines.\n    // The spans will have null for their from/to properties when the\n    // marker continues beyond the start/end of the line. Markers have\n    // links back to the lines they currently touch.\n\n    // Collapsed markers have unique ids, in order to be able to order\n    // them, which is needed for uniquely determining an outer marker\n    // when they overlap (they may nest, but not partially overlap).\n    var nextMarkerId = 0\n\n    var TextMarker = function(doc, type) {\n        this.lines = []\n        this.type = type\n        this.doc = doc\n        this.id = ++nextMarkerId\n    }\n\n    // Clear the marker.\n    TextMarker.prototype.clear = function() {\n        if (this.explicitlyCleared) {\n            return\n        }\n        var cm = this.doc.cm,\n            withOp = cm && !cm.curOp\n        if (withOp) {\n            startOperation(cm)\n        }\n        if (hasHandler(this, \"clear\")) {\n            var found = this.find()\n            if (found) {\n                signalLater(this, \"clear\", found.from, found.to)\n            }\n        }\n        var min = null,\n            max = null\n        for (var i = 0; i < this.lines.length; ++i) {\n            var line = this.lines[i]\n            var span = getMarkedSpanFor(line.markedSpans, this)\n            if (cm && !this.collapsed) {\n                regLineChange(cm, lineNo(line), \"text\")\n            } else if (cm) {\n                if (span.to != null) {\n                    max = lineNo(line)\n                }\n                if (span.from != null) {\n                    min = lineNo(line)\n                }\n            }\n            line.markedSpans = removeMarkedSpan(line.markedSpans, span)\n            if (span.from == null && this.collapsed && !lineIsHidden(this.doc, line) && cm) {\n                updateLineHeight(line, textHeight(cm.display))\n            }\n        }\n        if (cm && this.collapsed && !cm.options.lineWrapping) {\n            for (var i$1 = 0; i$1 < this.lines.length; ++i$1) {\n                var visual = visualLine(this.lines[i$1]),\n                    len = lineLength(visual)\n                if (len > cm.display.maxLineLength) {\n                    cm.display.maxLine = visual\n                    cm.display.maxLineLength = len\n                    cm.display.maxLineChanged = true\n                }\n            }\n        }\n\n        if (min != null && cm && this.collapsed) {\n            regChange(cm, min, max + 1)\n        }\n        this.lines.length = 0\n        this.explicitlyCleared = true\n        if (this.atomic && this.doc.cantEdit) {\n            this.doc.cantEdit = false\n            if (cm) {\n                reCheckSelection(cm.doc)\n            }\n        }\n        if (cm) {\n            signalLater(cm, \"markerCleared\", cm, this, min, max)\n        }\n        if (withOp) {\n            endOperation(cm)\n        }\n        if (this.parent) {\n            this.parent.clear()\n        }\n    }\n\n    // Find the position of the marker in the document. Returns a {from,\n    // to} object by default. Side can be passed to get a specific side\n    // -- 0 (both), -1 (left), or 1 (right). When lineObj is true, the\n    // Pos objects returned contain a line object, rather than a line\n    // number (used to prevent looking up the same line twice).\n    TextMarker.prototype.find = function(side, lineObj) {\n        if (side == null && this.type == \"bookmark\") {\n            side = 1\n        }\n        var from, to\n        for (var i = 0; i < this.lines.length; ++i) {\n            var line = this.lines[i]\n            var span = getMarkedSpanFor(line.markedSpans, this)\n            if (span.from != null) {\n                from = Pos(lineObj ? line : lineNo(line), span.from)\n                if (side == -1) {\n                    return from\n                }\n            }\n            if (span.to != null) {\n                to = Pos(lineObj ? line : lineNo(line), span.to)\n                if (side == 1) {\n                    return to\n                }\n            }\n        }\n        return from && { from: from, to: to }\n    }\n\n    // Signals that the marker's widget changed, and surrounding layout\n    // should be recomputed.\n    TextMarker.prototype.changed = function() {\n        var this$1 = this\n\n        var pos = this.find(-1, true),\n            widget = this,\n            cm = this.doc.cm\n        if (!pos || !cm) {\n            return\n        }\n        runInOp(cm, function() {\n            var line = pos.line,\n                lineN = lineNo(pos.line)\n            var view = findViewForLine(cm, lineN)\n            if (view) {\n                clearLineMeasurementCacheFor(view)\n                cm.curOp.selectionChanged = cm.curOp.forceUpdate = true\n            }\n            cm.curOp.updateMaxLine = true\n            if (!lineIsHidden(widget.doc, line) && widget.height != null) {\n                var oldHeight = widget.height\n                widget.height = null\n                var dHeight = widgetHeight(widget) - oldHeight\n                if (dHeight) {\n                    updateLineHeight(line, line.height + dHeight)\n                }\n            }\n            signalLater(cm, \"markerChanged\", cm, this$1)\n        })\n    }\n\n    TextMarker.prototype.attachLine = function(line) {\n        if (!this.lines.length && this.doc.cm) {\n            var op = this.doc.cm.curOp\n            if (!op.maybeHiddenMarkers || indexOf(op.maybeHiddenMarkers, this) == -1) {\n                ;(op.maybeUnhiddenMarkers || (op.maybeUnhiddenMarkers = [])).push(this)\n            }\n        }\n        this.lines.push(line)\n    }\n\n    TextMarker.prototype.detachLine = function(line) {\n        this.lines.splice(indexOf(this.lines, line), 1)\n        if (!this.lines.length && this.doc.cm) {\n            var op = this.doc.cm.curOp\n            ;(op.maybeHiddenMarkers || (op.maybeHiddenMarkers = [])).push(this)\n        }\n    }\n    eventMixin(TextMarker)\n\n    // Create a marker, wire it up to the right lines, and\n    function markText(doc, from, to, options, type) {\n        // Shared markers (across linked documents) are handled separately\n        // (markTextShared will call out to this again, once per\n        // document).\n        if (options && options.shared) {\n            return markTextShared(doc, from, to, options, type)\n        }\n        // Ensure we are in an operation.\n        if (doc.cm && !doc.cm.curOp) {\n            return operation(doc.cm, markText)(doc, from, to, options, type)\n        }\n\n        var marker = new TextMarker(doc, type),\n            diff = cmp(from, to)\n        if (options) {\n            copyObj(options, marker, false)\n        }\n        // Don't connect empty markers unless clearWhenEmpty is false\n        if (diff > 0 || (diff == 0 && marker.clearWhenEmpty !== false)) {\n            return marker\n        }\n        if (marker.replacedWith) {\n            // Showing up as a widget implies collapsed (widget replaces text)\n            marker.collapsed = true\n            marker.widgetNode = eltP(\"span\", [marker.replacedWith], \"CodeMirror-widget\")\n            if (!options.handleMouseEvents) {\n                marker.widgetNode.setAttribute(\"cm-ignore-events\", \"true\")\n            }\n            if (options.insertLeft) {\n                marker.widgetNode.insertLeft = true\n            }\n        }\n        if (marker.collapsed) {\n            if (\n                conflictingCollapsedRange(doc, from.line, from, to, marker) ||\n                (from.line != to.line && conflictingCollapsedRange(doc, to.line, from, to, marker))\n            ) {\n                throw new Error(\"Inserting collapsed marker partially overlapping an existing one\")\n            }\n            seeCollapsedSpans()\n        }\n\n        if (marker.addToHistory) {\n            addChangeToHistory(doc, { from: from, to: to, origin: \"markText\" }, doc.sel, NaN)\n        }\n\n        var curLine = from.line,\n            cm = doc.cm,\n            updateMaxLine\n        doc.iter(curLine, to.line + 1, function(line) {\n            if (\n                cm &&\n                marker.collapsed &&\n                !cm.options.lineWrapping &&\n                visualLine(line) == cm.display.maxLine\n            ) {\n                updateMaxLine = true\n            }\n            if (marker.collapsed && curLine != from.line) {\n                updateLineHeight(line, 0)\n            }\n            addMarkedSpan(\n                line,\n                new MarkedSpan(\n                    marker,\n                    curLine == from.line ? from.ch : null,\n                    curLine == to.line ? to.ch : null\n                )\n            )\n            ++curLine\n        })\n        // lineIsHidden depends on the presence of the spans, so needs a second pass\n        if (marker.collapsed) {\n            doc.iter(from.line, to.line + 1, function(line) {\n                if (lineIsHidden(doc, line)) {\n                    updateLineHeight(line, 0)\n                }\n            })\n        }\n\n        if (marker.clearOnEnter) {\n            on(marker, \"beforeCursorEnter\", function() {\n                return marker.clear()\n            })\n        }\n\n        if (marker.readOnly) {\n            seeReadOnlySpans()\n            if (doc.history.done.length || doc.history.undone.length) {\n                doc.clearHistory()\n            }\n        }\n        if (marker.collapsed) {\n            marker.id = ++nextMarkerId\n            marker.atomic = true\n        }\n        if (cm) {\n            // Sync editor state\n            if (updateMaxLine) {\n                cm.curOp.updateMaxLine = true\n            }\n            if (marker.collapsed) {\n                regChange(cm, from.line, to.line + 1)\n            } else if (\n                marker.className ||\n                marker.startStyle ||\n                marker.endStyle ||\n                marker.css ||\n                marker.attributes ||\n                marker.title\n            ) {\n                for (var i = from.line; i <= to.line; i++) {\n                    regLineChange(cm, i, \"text\")\n                }\n            }\n            if (marker.atomic) {\n                reCheckSelection(cm.doc)\n            }\n            signalLater(cm, \"markerAdded\", cm, marker)\n        }\n        return marker\n    }\n\n    // SHARED TEXTMARKERS\n\n    // A shared marker spans multiple linked documents. It is\n    // implemented as a meta-marker-object controlling multiple normal\n    // markers.\n    var SharedTextMarker = function(markers, primary) {\n        this.markers = markers\n        this.primary = primary\n        for (var i = 0; i < markers.length; ++i) {\n            markers[i].parent = this\n        }\n    }\n\n    SharedTextMarker.prototype.clear = function() {\n        if (this.explicitlyCleared) {\n            return\n        }\n        this.explicitlyCleared = true\n        for (var i = 0; i < this.markers.length; ++i) {\n            this.markers[i].clear()\n        }\n        signalLater(this, \"clear\")\n    }\n\n    SharedTextMarker.prototype.find = function(side, lineObj) {\n        return this.primary.find(side, lineObj)\n    }\n    eventMixin(SharedTextMarker)\n\n    function markTextShared(doc, from, to, options, type) {\n        options = copyObj(options)\n        options.shared = false\n        var markers = [markText(doc, from, to, options, type)],\n            primary = markers[0]\n        var widget = options.widgetNode\n        linkedDocs(doc, function(doc) {\n            if (widget) {\n                options.widgetNode = widget.cloneNode(true)\n            }\n            markers.push(markText(doc, clipPos(doc, from), clipPos(doc, to), options, type))\n            for (var i = 0; i < doc.linked.length; ++i) {\n                if (doc.linked[i].isParent) {\n                    return\n                }\n            }\n            primary = lst(markers)\n        })\n        return new SharedTextMarker(markers, primary)\n    }\n\n    function findSharedMarkers(doc) {\n        return doc.findMarks(Pos(doc.first, 0), doc.clipPos(Pos(doc.lastLine())), function(m) {\n            return m.parent\n        })\n    }\n\n    function copySharedMarkers(doc, markers) {\n        for (var i = 0; i < markers.length; i++) {\n            var marker = markers[i],\n                pos = marker.find()\n            var mFrom = doc.clipPos(pos.from),\n                mTo = doc.clipPos(pos.to)\n            if (cmp(mFrom, mTo)) {\n                var subMark = markText(doc, mFrom, mTo, marker.primary, marker.primary.type)\n                marker.markers.push(subMark)\n                subMark.parent = marker\n            }\n        }\n    }\n\n    function detachSharedMarkers(markers) {\n        var loop = function(i) {\n            var marker = markers[i],\n                linked = [marker.primary.doc]\n            linkedDocs(marker.primary.doc, function(d) {\n                return linked.push(d)\n            })\n            for (var j = 0; j < marker.markers.length; j++) {\n                var subMarker = marker.markers[j]\n                if (indexOf(linked, subMarker.doc) == -1) {\n                    subMarker.parent = null\n                    marker.markers.splice(j--, 1)\n                }\n            }\n        }\n\n        for (var i = 0; i < markers.length; i++) loop(i)\n    }\n\n    var nextDocId = 0\n    var Doc = function(text, mode, firstLine, lineSep, direction) {\n        if (!(this instanceof Doc)) {\n            return new Doc(text, mode, firstLine, lineSep, direction)\n        }\n        if (firstLine == null) {\n            firstLine = 0\n        }\n\n        BranchChunk.call(this, [new LeafChunk([new Line(\"\", null)])])\n        this.first = firstLine\n        this.scrollTop = this.scrollLeft = 0\n        this.cantEdit = false\n        this.cleanGeneration = 1\n        this.modeFrontier = this.highlightFrontier = firstLine\n        var start = Pos(firstLine, 0)\n        this.sel = simpleSelection(start)\n        this.history = new History(null)\n        this.id = ++nextDocId\n        this.modeOption = mode\n        this.lineSep = lineSep\n        this.direction = direction == \"rtl\" ? \"rtl\" : \"ltr\"\n        this.extend = false\n\n        if (typeof text == \"string\") {\n            text = this.splitLines(text)\n        }\n        updateDoc(this, { from: start, to: start, text: text })\n        setSelection(this, simpleSelection(start), sel_dontScroll)\n    }\n\n    Doc.prototype = createObj(BranchChunk.prototype, {\n        constructor: Doc,\n        // Iterate over the document. Supports two forms -- with only one\n        // argument, it calls that for each line in the document. With\n        // three, it iterates over the range given by the first two (with\n        // the second being non-inclusive).\n        iter: function(from, to, op) {\n            if (op) {\n                this.iterN(from - this.first, to - from, op)\n            } else {\n                this.iterN(this.first, this.first + this.size, from)\n            }\n        },\n\n        // Non-public interface for adding and removing lines.\n        insert: function(at, lines) {\n            var height = 0\n            for (var i = 0; i < lines.length; ++i) {\n                height += lines[i].height\n            }\n            this.insertInner(at - this.first, lines, height)\n        },\n        remove: function(at, n) {\n            this.removeInner(at - this.first, n)\n        },\n\n        // From here, the methods are part of the public interface. Most\n        // are also available from CodeMirror (editor) instances.\n\n        getValue: function(lineSep) {\n            var lines = getLines(this, this.first, this.first + this.size)\n            if (lineSep === false) {\n                return lines\n            }\n            return lines.join(lineSep || this.lineSeparator())\n        },\n        setValue: docMethodOp(function(code) {\n            var top = Pos(this.first, 0),\n                last = this.first + this.size - 1\n            makeChange(\n                this,\n                {\n                    from: top,\n                    to: Pos(last, getLine(this, last).text.length),\n                    text: this.splitLines(code),\n                    origin: \"setValue\",\n                    full: true\n                },\n                true\n            )\n            if (this.cm) {\n                scrollToCoords(this.cm, 0, 0)\n            }\n            setSelection(this, simpleSelection(top), sel_dontScroll)\n        }),\n        replaceRange: function(code, from, to, origin) {\n            from = clipPos(this, from)\n            to = to ? clipPos(this, to) : from\n            replaceRange(this, code, from, to, origin)\n        },\n        getRange: function(from, to, lineSep) {\n            var lines = getBetween(this, clipPos(this, from), clipPos(this, to))\n            if (lineSep === false) {\n                return lines\n            }\n            return lines.join(lineSep || this.lineSeparator())\n        },\n\n        getLine: function(line) {\n            var l = this.getLineHandle(line)\n            return l && l.text\n        },\n\n        getLineHandle: function(line) {\n            if (isLine(this, line)) {\n                return getLine(this, line)\n            }\n        },\n        getLineNumber: function(line) {\n            return lineNo(line)\n        },\n\n        getLineHandleVisualStart: function(line) {\n            if (typeof line == \"number\") {\n                line = getLine(this, line)\n            }\n            return visualLine(line)\n        },\n\n        lineCount: function() {\n            return this.size\n        },\n        firstLine: function() {\n            return this.first\n        },\n        lastLine: function() {\n            return this.first + this.size - 1\n        },\n\n        clipPos: function(pos) {\n            return clipPos(this, pos)\n        },\n\n        getCursor: function(start) {\n            var range = this.sel.primary(),\n                pos\n            if (start == null || start == \"head\") {\n                pos = range.head\n            } else if (start == \"anchor\") {\n                pos = range.anchor\n            } else if (start == \"end\" || start == \"to\" || start === false) {\n                pos = range.to()\n            } else {\n                pos = range.from()\n            }\n            return pos\n        },\n        listSelections: function() {\n            return this.sel.ranges\n        },\n        somethingSelected: function() {\n            return this.sel.somethingSelected()\n        },\n\n        setCursor: docMethodOp(function(line, ch, options) {\n            setSimpleSelection(\n                this,\n                clipPos(this, typeof line == \"number\" ? Pos(line, ch || 0) : line),\n                null,\n                options\n            )\n        }),\n        setSelection: docMethodOp(function(anchor, head, options) {\n            setSimpleSelection(this, clipPos(this, anchor), clipPos(this, head || anchor), options)\n        }),\n        extendSelection: docMethodOp(function(head, other, options) {\n            extendSelection(this, clipPos(this, head), other && clipPos(this, other), options)\n        }),\n        extendSelections: docMethodOp(function(heads, options) {\n            extendSelections(this, clipPosArray(this, heads), options)\n        }),\n        extendSelectionsBy: docMethodOp(function(f, options) {\n            var heads = map(this.sel.ranges, f)\n            extendSelections(this, clipPosArray(this, heads), options)\n        }),\n        setSelections: docMethodOp(function(ranges, primary, options) {\n            if (!ranges.length) {\n                return\n            }\n            var out = []\n            for (var i = 0; i < ranges.length; i++) {\n                out[i] = new Range(clipPos(this, ranges[i].anchor), clipPos(this, ranges[i].head))\n            }\n            if (primary == null) {\n                primary = Math.min(ranges.length - 1, this.sel.primIndex)\n            }\n            setSelection(this, normalizeSelection(this.cm, out, primary), options)\n        }),\n        addSelection: docMethodOp(function(anchor, head, options) {\n            var ranges = this.sel.ranges.slice(0)\n            ranges.push(new Range(clipPos(this, anchor), clipPos(this, head || anchor)))\n            setSelection(this, normalizeSelection(this.cm, ranges, ranges.length - 1), options)\n        }),\n\n        getSelection: function(lineSep) {\n            var ranges = this.sel.ranges,\n                lines\n            for (var i = 0; i < ranges.length; i++) {\n                var sel = getBetween(this, ranges[i].from(), ranges[i].to())\n                lines = lines ? lines.concat(sel) : sel\n            }\n            if (lineSep === false) {\n                return lines\n            } else {\n                return lines.join(lineSep || this.lineSeparator())\n            }\n        },\n        getSelections: function(lineSep) {\n            var parts = [],\n                ranges = this.sel.ranges\n            for (var i = 0; i < ranges.length; i++) {\n                var sel = getBetween(this, ranges[i].from(), ranges[i].to())\n                if (lineSep !== false) {\n                    sel = sel.join(lineSep || this.lineSeparator())\n                }\n                parts[i] = sel\n            }\n            return parts\n        },\n        replaceSelection: function(code, collapse, origin) {\n            var dup = []\n            for (var i = 0; i < this.sel.ranges.length; i++) {\n                dup[i] = code\n            }\n            this.replaceSelections(dup, collapse, origin || \"+input\")\n        },\n        replaceSelections: docMethodOp(function(code, collapse, origin) {\n            var changes = [],\n                sel = this.sel\n            for (var i = 0; i < sel.ranges.length; i++) {\n                var range = sel.ranges[i]\n                changes[i] = {\n                    from: range.from(),\n                    to: range.to(),\n                    text: this.splitLines(code[i]),\n                    origin: origin\n                }\n            }\n            var newSel =\n                collapse && collapse != \"end\" && computeReplacedSel(this, changes, collapse)\n            for (var i$1 = changes.length - 1; i$1 >= 0; i$1--) {\n                makeChange(this, changes[i$1])\n            }\n            if (newSel) {\n                setSelectionReplaceHistory(this, newSel)\n            } else if (this.cm) {\n                ensureCursorVisible(this.cm)\n            }\n        }),\n        undo: docMethodOp(function() {\n            makeChangeFromHistory(this, \"undo\")\n        }),\n        redo: docMethodOp(function() {\n            makeChangeFromHistory(this, \"redo\")\n        }),\n        undoSelection: docMethodOp(function() {\n            makeChangeFromHistory(this, \"undo\", true)\n        }),\n        redoSelection: docMethodOp(function() {\n            makeChangeFromHistory(this, \"redo\", true)\n        }),\n\n        setExtending: function(val) {\n            this.extend = val\n        },\n        getExtending: function() {\n            return this.extend\n        },\n\n        historySize: function() {\n            var hist = this.history,\n                done = 0,\n                undone = 0\n            for (var i = 0; i < hist.done.length; i++) {\n                if (!hist.done[i].ranges) {\n                    ++done\n                }\n            }\n            for (var i$1 = 0; i$1 < hist.undone.length; i$1++) {\n                if (!hist.undone[i$1].ranges) {\n                    ++undone\n                }\n            }\n            return { undo: done, redo: undone }\n        },\n        clearHistory: function() {\n            var this$1 = this\n\n            this.history = new History(this.history.maxGeneration)\n            linkedDocs(\n                this,\n                function(doc) {\n                    return (doc.history = this$1.history)\n                },\n                true\n            )\n        },\n\n        markClean: function() {\n            this.cleanGeneration = this.changeGeneration(true)\n        },\n        changeGeneration: function(forceSplit) {\n            if (forceSplit) {\n                this.history.lastOp = this.history.lastSelOp = this.history.lastOrigin = null\n            }\n            return this.history.generation\n        },\n        isClean: function(gen) {\n            return this.history.generation == (gen || this.cleanGeneration)\n        },\n\n        getHistory: function() {\n            return {\n                done: copyHistoryArray(this.history.done),\n                undone: copyHistoryArray(this.history.undone)\n            }\n        },\n        setHistory: function(histData) {\n            var hist = (this.history = new History(this.history.maxGeneration))\n            hist.done = copyHistoryArray(histData.done.slice(0), null, true)\n            hist.undone = copyHistoryArray(histData.undone.slice(0), null, true)\n        },\n\n        setGutterMarker: docMethodOp(function(line, gutterID, value) {\n            return changeLine(this, line, \"gutter\", function(line) {\n                var markers = line.gutterMarkers || (line.gutterMarkers = {})\n                markers[gutterID] = value\n                if (!value && isEmpty(markers)) {\n                    line.gutterMarkers = null\n                }\n                return true\n            })\n        }),\n\n        clearGutter: docMethodOp(function(gutterID) {\n            var this$1 = this\n\n            this.iter(function(line) {\n                if (line.gutterMarkers && line.gutterMarkers[gutterID]) {\n                    changeLine(this$1, line, \"gutter\", function() {\n                        line.gutterMarkers[gutterID] = null\n                        if (isEmpty(line.gutterMarkers)) {\n                            line.gutterMarkers = null\n                        }\n                        return true\n                    })\n                }\n            })\n        }),\n\n        lineInfo: function(line) {\n            var n\n            if (typeof line == \"number\") {\n                if (!isLine(this, line)) {\n                    return null\n                }\n                n = line\n                line = getLine(this, line)\n                if (!line) {\n                    return null\n                }\n            } else {\n                n = lineNo(line)\n                if (n == null) {\n                    return null\n                }\n            }\n            return {\n                line: n,\n                handle: line,\n                text: line.text,\n                gutterMarkers: line.gutterMarkers,\n                textClass: line.textClass,\n                bgClass: line.bgClass,\n                wrapClass: line.wrapClass,\n                widgets: line.widgets\n            }\n        },\n\n        addLineClass: docMethodOp(function(handle, where, cls) {\n            return changeLine(this, handle, where == \"gutter\" ? \"gutter\" : \"class\", function(line) {\n                var prop =\n                    where == \"text\"\n                        ? \"textClass\"\n                        : where == \"background\"\n                        ? \"bgClass\"\n                        : where == \"gutter\"\n                        ? \"gutterClass\"\n                        : \"wrapClass\"\n                if (!line[prop]) {\n                    line[prop] = cls\n                } else if (classTest(cls).test(line[prop])) {\n                    return false\n                } else {\n                    line[prop] += \" \" + cls\n                }\n                return true\n            })\n        }),\n        removeLineClass: docMethodOp(function(handle, where, cls) {\n            return changeLine(this, handle, where == \"gutter\" ? \"gutter\" : \"class\", function(line) {\n                var prop =\n                    where == \"text\"\n                        ? \"textClass\"\n                        : where == \"background\"\n                        ? \"bgClass\"\n                        : where == \"gutter\"\n                        ? \"gutterClass\"\n                        : \"wrapClass\"\n                var cur = line[prop]\n                if (!cur) {\n                    return false\n                } else if (cls == null) {\n                    line[prop] = null\n                } else {\n                    var found = cur.match(classTest(cls))\n                    if (!found) {\n                        return false\n                    }\n                    var end = found.index + found[0].length\n                    line[prop] =\n                        cur.slice(0, found.index) +\n                            (!found.index || end == cur.length ? \"\" : \" \") +\n                            cur.slice(end) || null\n                }\n                return true\n            })\n        }),\n\n        addLineWidget: docMethodOp(function(handle, node, options) {\n            return addLineWidget(this, handle, node, options)\n        }),\n        removeLineWidget: function(widget) {\n            widget.clear()\n        },\n\n        markText: function(from, to, options) {\n            return markText(\n                this,\n                clipPos(this, from),\n                clipPos(this, to),\n                options,\n                (options && options.type) || \"range\"\n            )\n        },\n        setBookmark: function(pos, options) {\n            var realOpts = {\n                replacedWith: options && (options.nodeType == null ? options.widget : options),\n                insertLeft: options && options.insertLeft,\n                clearWhenEmpty: false,\n                shared: options && options.shared,\n                handleMouseEvents: options && options.handleMouseEvents\n            }\n            pos = clipPos(this, pos)\n            return markText(this, pos, pos, realOpts, \"bookmark\")\n        },\n        findMarksAt: function(pos) {\n            pos = clipPos(this, pos)\n            var markers = [],\n                spans = getLine(this, pos.line).markedSpans\n            if (spans) {\n                for (var i = 0; i < spans.length; ++i) {\n                    var span = spans[i]\n                    if (\n                        (span.from == null || span.from <= pos.ch) &&\n                        (span.to == null || span.to >= pos.ch)\n                    ) {\n                        markers.push(span.marker.parent || span.marker)\n                    }\n                }\n            }\n            return markers\n        },\n        findMarks: function(from, to, filter) {\n            from = clipPos(this, from)\n            to = clipPos(this, to)\n            var found = [],\n                lineNo = from.line\n            this.iter(from.line, to.line + 1, function(line) {\n                var spans = line.markedSpans\n                if (spans) {\n                    for (var i = 0; i < spans.length; i++) {\n                        var span = spans[i]\n                        if (\n                            !(\n                                (span.to != null && lineNo == from.line && from.ch >= span.to) ||\n                                (span.from == null && lineNo != from.line) ||\n                                (span.from != null && lineNo == to.line && span.from >= to.ch)\n                            ) &&\n                            (!filter || filter(span.marker))\n                        ) {\n                            found.push(span.marker.parent || span.marker)\n                        }\n                    }\n                }\n                ++lineNo\n            })\n            return found\n        },\n        getAllMarks: function() {\n            var markers = []\n            this.iter(function(line) {\n                var sps = line.markedSpans\n                if (sps) {\n                    for (var i = 0; i < sps.length; ++i) {\n                        if (sps[i].from != null) {\n                            markers.push(sps[i].marker)\n                        }\n                    }\n                }\n            })\n            return markers\n        },\n\n        posFromIndex: function(off) {\n            var ch,\n                lineNo = this.first,\n                sepSize = this.lineSeparator().length\n            this.iter(function(line) {\n                var sz = line.text.length + sepSize\n                if (sz > off) {\n                    ch = off\n                    return true\n                }\n                off -= sz\n                ++lineNo\n            })\n            return clipPos(this, Pos(lineNo, ch))\n        },\n        indexFromPos: function(coords) {\n            coords = clipPos(this, coords)\n            var index = coords.ch\n            if (coords.line < this.first || coords.ch < 0) {\n                return 0\n            }\n            var sepSize = this.lineSeparator().length\n            this.iter(this.first, coords.line, function(line) {\n                // iter aborts when callback returns a truthy value\n                index += line.text.length + sepSize\n            })\n            return index\n        },\n\n        copy: function(copyHistory) {\n            var doc = new Doc(\n                getLines(this, this.first, this.first + this.size),\n                this.modeOption,\n                this.first,\n                this.lineSep,\n                this.direction\n            )\n            doc.scrollTop = this.scrollTop\n            doc.scrollLeft = this.scrollLeft\n            doc.sel = this.sel\n            doc.extend = false\n            if (copyHistory) {\n                doc.history.undoDepth = this.history.undoDepth\n                doc.setHistory(this.getHistory())\n            }\n            return doc\n        },\n\n        linkedDoc: function(options) {\n            if (!options) {\n                options = {}\n            }\n            var from = this.first,\n                to = this.first + this.size\n            if (options.from != null && options.from > from) {\n                from = options.from\n            }\n            if (options.to != null && options.to < to) {\n                to = options.to\n            }\n            var copy = new Doc(\n                getLines(this, from, to),\n                options.mode || this.modeOption,\n                from,\n                this.lineSep,\n                this.direction\n            )\n            if (options.sharedHist) {\n                copy.history = this.history\n            }\n            ;(this.linked || (this.linked = [])).push({ doc: copy, sharedHist: options.sharedHist })\n            copy.linked = [{ doc: this, isParent: true, sharedHist: options.sharedHist }]\n            copySharedMarkers(copy, findSharedMarkers(this))\n            return copy\n        },\n        unlinkDoc: function(other) {\n            if (other instanceof CodeMirror) {\n                other = other.doc\n            }\n            if (this.linked) {\n                for (var i = 0; i < this.linked.length; ++i) {\n                    var link = this.linked[i]\n                    if (link.doc != other) {\n                        continue\n                    }\n                    this.linked.splice(i, 1)\n                    other.unlinkDoc(this)\n                    detachSharedMarkers(findSharedMarkers(this))\n                    break\n                }\n            }\n            // If the histories were shared, split them again\n            if (other.history == this.history) {\n                var splitIds = [other.id]\n                linkedDocs(\n                    other,\n                    function(doc) {\n                        return splitIds.push(doc.id)\n                    },\n                    true\n                )\n                other.history = new History(null)\n                other.history.done = copyHistoryArray(this.history.done, splitIds)\n                other.history.undone = copyHistoryArray(this.history.undone, splitIds)\n            }\n        },\n        iterLinkedDocs: function(f) {\n            linkedDocs(this, f)\n        },\n\n        getMode: function() {\n            return this.mode\n        },\n        getEditor: function() {\n            return this.cm\n        },\n\n        splitLines: function(str) {\n            if (this.lineSep) {\n                return str.split(this.lineSep)\n            }\n            return splitLinesAuto(str)\n        },\n        lineSeparator: function() {\n            return this.lineSep || \"\\n\"\n        },\n\n        setDirection: docMethodOp(function(dir) {\n            if (dir != \"rtl\") {\n                dir = \"ltr\"\n            }\n            if (dir == this.direction) {\n                return\n            }\n            this.direction = dir\n            this.iter(function(line) {\n                return (line.order = null)\n            })\n            if (this.cm) {\n                directionChanged(this.cm)\n            }\n        })\n    })\n\n    // Public alias.\n    Doc.prototype.eachLine = Doc.prototype.iter\n\n    // Kludge to work around strange IE behavior where it'll sometimes\n    // re-fire a series of drag-related events right after the drop (#1551)\n    var lastDrop = 0\n\n    function onDrop(e) {\n        var cm = this\n        clearDragCursor(cm)\n        if (signalDOMEvent(cm, e) || eventInWidget(cm.display, e)) {\n            return\n        }\n        e_preventDefault(e)\n        if (ie) {\n            lastDrop = +new Date()\n        }\n        var pos = posFromMouse(cm, e, true),\n            files = e.dataTransfer.files\n        if (!pos || cm.isReadOnly()) {\n            return\n        }\n        // Might be a file drop, in which case we simply extract the text\n        // and insert it.\n        if (files && files.length && window.FileReader && window.File) {\n            var n = files.length,\n                text = Array(n),\n                read = 0\n            var markAsReadAndPasteIfAllFilesAreRead = function() {\n                if (++read == n) {\n                    operation(cm, function() {\n                        pos = clipPos(cm.doc, pos)\n                        var change = {\n                            from: pos,\n                            to: pos,\n                            text: cm.doc.splitLines(\n                                text\n                                    .filter(function(t) {\n                                        return t != null\n                                    })\n                                    .join(cm.doc.lineSeparator())\n                            ),\n                            origin: \"paste\"\n                        }\n                        makeChange(cm.doc, change)\n                        setSelectionReplaceHistory(\n                            cm.doc,\n                            simpleSelection(\n                                clipPos(cm.doc, pos),\n                                clipPos(cm.doc, changeEnd(change))\n                            )\n                        )\n                    })()\n                }\n            }\n            var readTextFromFile = function(file, i) {\n                if (\n                    cm.options.allowDropFileTypes &&\n                    indexOf(cm.options.allowDropFileTypes, file.type) == -1\n                ) {\n                    markAsReadAndPasteIfAllFilesAreRead()\n                    return\n                }\n                var reader = new FileReader()\n                reader.onerror = function() {\n                    return markAsReadAndPasteIfAllFilesAreRead()\n                }\n                reader.onload = function() {\n                    var content = reader.result\n                    if (/[\\x00-\\x08\\x0e-\\x1f]{2}/.test(content)) {\n                        markAsReadAndPasteIfAllFilesAreRead()\n                        return\n                    }\n                    text[i] = content\n                    markAsReadAndPasteIfAllFilesAreRead()\n                }\n                reader.readAsText(file)\n            }\n            for (var i = 0; i < files.length; i++) {\n                readTextFromFile(files[i], i)\n            }\n        } else {\n            // Normal drop\n            // Don't do a replace if the drop happened inside of the selected text.\n            if (cm.state.draggingText && cm.doc.sel.contains(pos) > -1) {\n                cm.state.draggingText(e)\n                // Ensure the editor is re-focused\n                setTimeout(function() {\n                    return cm.display.input.focus()\n                }, 20)\n                return\n            }\n            try {\n                var text$1 = e.dataTransfer.getData(\"Text\")\n                if (text$1) {\n                    var selected\n                    if (cm.state.draggingText && !cm.state.draggingText.copy) {\n                        selected = cm.listSelections()\n                    }\n                    setSelectionNoUndo(cm.doc, simpleSelection(pos, pos))\n                    if (selected) {\n                        for (var i$1 = 0; i$1 < selected.length; ++i$1) {\n                            replaceRange(\n                                cm.doc,\n                                \"\",\n                                selected[i$1].anchor,\n                                selected[i$1].head,\n                                \"drag\"\n                            )\n                        }\n                    }\n                    cm.replaceSelection(text$1, \"around\", \"paste\")\n                    cm.display.input.focus()\n                }\n            } catch (e) {}\n        }\n    }\n\n    function onDragStart(cm, e) {\n        if (ie && (!cm.state.draggingText || +new Date() - lastDrop < 100)) {\n            e_stop(e)\n            return\n        }\n        if (signalDOMEvent(cm, e) || eventInWidget(cm.display, e)) {\n            return\n        }\n\n        e.dataTransfer.setData(\"Text\", cm.getSelection())\n        e.dataTransfer.effectAllowed = \"copyMove\"\n\n        // Use dummy image instead of default browsers image.\n        // Recent Safari (~6.0.2) have a tendency to segfault when this happens, so we don't do it there.\n        if (e.dataTransfer.setDragImage && !safari) {\n            var img = elt(\"img\", null, null, \"position: fixed; left: 0; top: 0;\")\n            img.src = \"data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==\"\n            if (presto) {\n                img.width = img.height = 1\n                cm.display.wrapper.appendChild(img)\n                // Force a relayout, or Opera won't use our image for some obscure reason\n                img._top = img.offsetTop\n            }\n            e.dataTransfer.setDragImage(img, 0, 0)\n            if (presto) {\n                img.parentNode.removeChild(img)\n            }\n        }\n    }\n\n    function onDragOver(cm, e) {\n        var pos = posFromMouse(cm, e)\n        if (!pos) {\n            return\n        }\n        var frag = document.createDocumentFragment()\n        drawSelectionCursor(cm, pos, frag)\n        if (!cm.display.dragCursor) {\n            cm.display.dragCursor = elt(\"div\", null, \"CodeMirror-cursors CodeMirror-dragcursors\")\n            cm.display.lineSpace.insertBefore(cm.display.dragCursor, cm.display.cursorDiv)\n        }\n        removeChildrenAndAdd(cm.display.dragCursor, frag)\n    }\n\n    function clearDragCursor(cm) {\n        if (cm.display.dragCursor) {\n            cm.display.lineSpace.removeChild(cm.display.dragCursor)\n            cm.display.dragCursor = null\n        }\n    }\n\n    // These must be handled carefully, because naively registering a\n    // handler for each editor will cause the editors to never be\n    // garbage collected.\n\n    function forEachCodeMirror(f) {\n        if (!document.getElementsByClassName) {\n            return\n        }\n        var byClass = document.getElementsByClassName(\"CodeMirror\"),\n            editors = []\n        for (var i = 0; i < byClass.length; i++) {\n            var cm = byClass[i].CodeMirror\n            if (cm) {\n                editors.push(cm)\n            }\n        }\n        if (editors.length) {\n            editors[0].operation(function() {\n                for (var i = 0; i < editors.length; i++) {\n                    f(editors[i])\n                }\n            })\n        }\n    }\n\n    var globalsRegistered = false\n    function ensureGlobalHandlers() {\n        if (globalsRegistered) {\n            return\n        }\n        registerGlobalHandlers()\n        globalsRegistered = true\n    }\n    function registerGlobalHandlers() {\n        // When the window resizes, we need to refresh active editors.\n        var resizeTimer\n        on(window, \"resize\", function() {\n            if (resizeTimer == null) {\n                resizeTimer = setTimeout(function() {\n                    resizeTimer = null\n                    forEachCodeMirror(onResize)\n                }, 100)\n            }\n        })\n        // When the window loses focus, we want to show the editor as blurred\n        on(window, \"blur\", function() {\n            return forEachCodeMirror(onBlur)\n        })\n    }\n    // Called when the window resizes\n    function onResize(cm) {\n        var d = cm.display\n        // Might be a text scaling operation, clear size caches.\n        d.cachedCharWidth = d.cachedTextHeight = d.cachedPaddingH = null\n        d.scrollbarsClipped = false\n        cm.setSize()\n    }\n\n    var keyNames = {\n        3: \"Pause\",\n        8: \"Backspace\",\n        9: \"Tab\",\n        13: \"Enter\",\n        16: \"Shift\",\n        17: \"Ctrl\",\n        18: \"Alt\",\n        19: \"Pause\",\n        20: \"CapsLock\",\n        27: \"Esc\",\n        32: \"Space\",\n        33: \"PageUp\",\n        34: \"PageDown\",\n        35: \"End\",\n        36: \"Home\",\n        37: \"Left\",\n        38: \"Up\",\n        39: \"Right\",\n        40: \"Down\",\n        44: \"PrintScrn\",\n        45: \"Insert\",\n        46: \"Delete\",\n        59: \";\",\n        61: \"=\",\n        91: \"Mod\",\n        92: \"Mod\",\n        93: \"Mod\",\n        106: \"*\",\n        107: \"=\",\n        109: \"-\",\n        110: \".\",\n        111: \"/\",\n        145: \"ScrollLock\",\n        173: \"-\",\n        186: \";\",\n        187: \"=\",\n        188: \",\",\n        189: \"-\",\n        190: \".\",\n        191: \"/\",\n        192: \"`\",\n        219: \"[\",\n        220: \"\\\\\",\n        221: \"]\",\n        222: \"'\",\n        63232: \"Up\",\n        63233: \"Down\",\n        63234: \"Left\",\n        63235: \"Right\",\n        63272: \"Delete\",\n        63273: \"Home\",\n        63275: \"End\",\n        63276: \"PageUp\",\n        63277: \"PageDown\",\n        63302: \"Insert\"\n    }\n\n    // Number keys\n    for (var i = 0; i < 10; i++) {\n        keyNames[i + 48] = keyNames[i + 96] = String(i)\n    }\n    // Alphabetic keys\n    for (var i$1 = 65; i$1 <= 90; i$1++) {\n        keyNames[i$1] = String.fromCharCode(i$1)\n    }\n    // Function keys\n    for (var i$2 = 1; i$2 <= 12; i$2++) {\n        keyNames[i$2 + 111] = keyNames[i$2 + 63235] = \"F\" + i$2\n    }\n\n    var keyMap = {}\n\n    keyMap.basic = {\n        Left: \"goCharLeft\",\n        Right: \"goCharRight\",\n        Up: \"goLineUp\",\n        Down: \"goLineDown\",\n        End: \"goLineEnd\",\n        Home: \"goLineStartSmart\",\n        PageUp: \"goPageUp\",\n        PageDown: \"goPageDown\",\n        Delete: \"delCharAfter\",\n        Backspace: \"delCharBefore\",\n        \"Shift-Backspace\": \"delCharBefore\",\n        Tab: \"defaultTab\",\n        \"Shift-Tab\": \"indentAuto\",\n        Enter: \"newlineAndIndent\",\n        Insert: \"toggleOverwrite\",\n        Esc: \"singleSelection\"\n    }\n    // Note that the save and find-related commands aren't defined by\n    // default. User code or addons can define them. Unknown commands\n    // are simply ignored.\n    keyMap.pcDefault = {\n        \"Ctrl-A\": \"selectAll\",\n        \"Ctrl-D\": \"deleteLine\",\n        \"Ctrl-Z\": \"undo\",\n        \"Shift-Ctrl-Z\": \"redo\",\n        \"Ctrl-Y\": \"redo\",\n        \"Ctrl-Home\": \"goDocStart\",\n        \"Ctrl-End\": \"goDocEnd\",\n        \"Ctrl-Up\": \"goLineUp\",\n        \"Ctrl-Down\": \"goLineDown\",\n        \"Ctrl-Left\": \"goGroupLeft\",\n        \"Ctrl-Right\": \"goGroupRight\",\n        \"Alt-Left\": \"goLineStart\",\n        \"Alt-Right\": \"goLineEnd\",\n        \"Ctrl-Backspace\": \"delGroupBefore\",\n        \"Ctrl-Delete\": \"delGroupAfter\",\n        \"Ctrl-S\": \"save\",\n        \"Ctrl-F\": \"find\",\n        \"Ctrl-G\": \"findNext\",\n        \"Shift-Ctrl-G\": \"findPrev\",\n        \"Shift-Ctrl-F\": \"replace\",\n        \"Shift-Ctrl-R\": \"replaceAll\",\n        \"Ctrl-[\": \"indentLess\",\n        \"Ctrl-]\": \"indentMore\",\n        \"Ctrl-U\": \"undoSelection\",\n        \"Shift-Ctrl-U\": \"redoSelection\",\n        \"Alt-U\": \"redoSelection\",\n        fallthrough: \"basic\"\n    }\n    // Very basic readline/emacs-style bindings, which are standard on Mac.\n    keyMap.emacsy = {\n        \"Ctrl-F\": \"goCharRight\",\n        \"Ctrl-B\": \"goCharLeft\",\n        \"Ctrl-P\": \"goLineUp\",\n        \"Ctrl-N\": \"goLineDown\",\n        \"Alt-F\": \"goWordRight\",\n        \"Alt-B\": \"goWordLeft\",\n        \"Ctrl-A\": \"goLineStart\",\n        \"Ctrl-E\": \"goLineEnd\",\n        \"Ctrl-V\": \"goPageDown\",\n        \"Shift-Ctrl-V\": \"goPageUp\",\n        \"Ctrl-D\": \"delCharAfter\",\n        \"Ctrl-H\": \"delCharBefore\",\n        \"Alt-D\": \"delWordAfter\",\n        \"Alt-Backspace\": \"delWordBefore\",\n        \"Ctrl-K\": \"killLine\",\n        \"Ctrl-T\": \"transposeChars\",\n        \"Ctrl-O\": \"openLine\"\n    }\n    keyMap.macDefault = {\n        \"Cmd-A\": \"selectAll\",\n        \"Cmd-D\": \"deleteLine\",\n        \"Cmd-Z\": \"undo\",\n        \"Shift-Cmd-Z\": \"redo\",\n        \"Cmd-Y\": \"redo\",\n        \"Cmd-Home\": \"goDocStart\",\n        \"Cmd-Up\": \"goDocStart\",\n        \"Cmd-End\": \"goDocEnd\",\n        \"Cmd-Down\": \"goDocEnd\",\n        \"Alt-Left\": \"goGroupLeft\",\n        \"Alt-Right\": \"goGroupRight\",\n        \"Cmd-Left\": \"goLineLeft\",\n        \"Cmd-Right\": \"goLineRight\",\n        \"Alt-Backspace\": \"delGroupBefore\",\n        \"Ctrl-Alt-Backspace\": \"delGroupAfter\",\n        \"Alt-Delete\": \"delGroupAfter\",\n        \"Cmd-S\": \"save\",\n        \"Cmd-F\": \"find\",\n        \"Cmd-G\": \"findNext\",\n        \"Shift-Cmd-G\": \"findPrev\",\n        \"Cmd-Alt-F\": \"replace\",\n        \"Shift-Cmd-Alt-F\": \"replaceAll\",\n        \"Cmd-[\": \"indentLess\",\n        \"Cmd-]\": \"indentMore\",\n        \"Cmd-Backspace\": \"delWrappedLineLeft\",\n        \"Cmd-Delete\": \"delWrappedLineRight\",\n        \"Cmd-U\": \"undoSelection\",\n        \"Shift-Cmd-U\": \"redoSelection\",\n        \"Ctrl-Up\": \"goDocStart\",\n        \"Ctrl-Down\": \"goDocEnd\",\n        fallthrough: [\"basic\", \"emacsy\"]\n    }\n    keyMap[\"default\"] = mac ? keyMap.macDefault : keyMap.pcDefault\n\n    // KEYMAP DISPATCH\n\n    function normalizeKeyName(name) {\n        var parts = name.split(/-(?!$)/)\n        name = parts[parts.length - 1]\n        var alt, ctrl, shift, cmd\n        for (var i = 0; i < parts.length - 1; i++) {\n            var mod = parts[i]\n            if (/^(cmd|meta|m)$/i.test(mod)) {\n                cmd = true\n            } else if (/^a(lt)?$/i.test(mod)) {\n                alt = true\n            } else if (/^(c|ctrl|control)$/i.test(mod)) {\n                ctrl = true\n            } else if (/^s(hift)?$/i.test(mod)) {\n                shift = true\n            } else {\n                throw new Error(\"Unrecognized modifier name: \" + mod)\n            }\n        }\n        if (alt) {\n            name = \"Alt-\" + name\n        }\n        if (ctrl) {\n            name = \"Ctrl-\" + name\n        }\n        if (cmd) {\n            name = \"Cmd-\" + name\n        }\n        if (shift) {\n            name = \"Shift-\" + name\n        }\n        return name\n    }\n\n    // This is a kludge to keep keymaps mostly working as raw objects\n    // (backwards compatibility) while at the same time support features\n    // like normalization and multi-stroke key bindings. It compiles a\n    // new normalized keymap, and then updates the old object to reflect\n    // this.\n    function normalizeKeyMap(keymap) {\n        var copy = {}\n        for (var keyname in keymap) {\n            if (keymap.hasOwnProperty(keyname)) {\n                var value = keymap[keyname]\n                if (/^(name|fallthrough|(de|at)tach)$/.test(keyname)) {\n                    continue\n                }\n                if (value == \"...\") {\n                    delete keymap[keyname]\n                    continue\n                }\n\n                var keys = map(keyname.split(\" \"), normalizeKeyName)\n                for (var i = 0; i < keys.length; i++) {\n                    var val = void 0,\n                        name = void 0\n                    if (i == keys.length - 1) {\n                        name = keys.join(\" \")\n                        val = value\n                    } else {\n                        name = keys.slice(0, i + 1).join(\" \")\n                        val = \"...\"\n                    }\n                    var prev = copy[name]\n                    if (!prev) {\n                        copy[name] = val\n                    } else if (prev != val) {\n                        throw new Error(\"Inconsistent bindings for \" + name)\n                    }\n                }\n                delete keymap[keyname]\n            }\n        }\n        for (var prop in copy) {\n            keymap[prop] = copy[prop]\n        }\n        return keymap\n    }\n\n    function lookupKey(key, map, handle, context) {\n        map = getKeyMap(map)\n        var found = map.call ? map.call(key, context) : map[key]\n        if (found === false) {\n            return \"nothing\"\n        }\n        if (found === \"...\") {\n            return \"multi\"\n        }\n        if (found != null && handle(found)) {\n            return \"handled\"\n        }\n\n        if (map.fallthrough) {\n            if (Object.prototype.toString.call(map.fallthrough) != \"[object Array]\") {\n                return lookupKey(key, map.fallthrough, handle, context)\n            }\n            for (var i = 0; i < map.fallthrough.length; i++) {\n                var result = lookupKey(key, map.fallthrough[i], handle, context)\n                if (result) {\n                    return result\n                }\n            }\n        }\n    }\n\n    // Modifier key presses don't count as 'real' key presses for the\n    // purpose of keymap fallthrough.\n    function isModifierKey(value) {\n        var name = typeof value == \"string\" ? value : keyNames[value.keyCode]\n        return name == \"Ctrl\" || name == \"Alt\" || name == \"Shift\" || name == \"Mod\"\n    }\n\n    function addModifierNames(name, event, noShift) {\n        var base = name\n        if (event.altKey && base != \"Alt\") {\n            name = \"Alt-\" + name\n        }\n        if ((flipCtrlCmd ? event.metaKey : event.ctrlKey) && base != \"Ctrl\") {\n            name = \"Ctrl-\" + name\n        }\n        if ((flipCtrlCmd ? event.ctrlKey : event.metaKey) && base != \"Cmd\") {\n            name = \"Cmd-\" + name\n        }\n        if (!noShift && event.shiftKey && base != \"Shift\") {\n            name = \"Shift-\" + name\n        }\n        return name\n    }\n\n    // Look up the name of a key as indicated by an event object.\n    function keyName(event, noShift) {\n        if (presto && event.keyCode == 34 && event[\"char\"]) {\n            return false\n        }\n        var name = keyNames[event.keyCode]\n        if (name == null || event.altGraphKey) {\n            return false\n        }\n        // Ctrl-ScrollLock has keyCode 3, same as Ctrl-Pause,\n        // so we'll use event.code when available (Chrome 48+, FF 38+, Safari 10.1+)\n        if (event.keyCode == 3 && event.code) {\n            name = event.code\n        }\n        return addModifierNames(name, event, noShift)\n    }\n\n    function getKeyMap(val) {\n        return typeof val == \"string\" ? keyMap[val] : val\n    }\n\n    // Helper for deleting text near the selection(s), used to implement\n    // backspace, delete, and similar functionality.\n    function deleteNearSelection(cm, compute) {\n        var ranges = cm.doc.sel.ranges,\n            kill = []\n        // Build up a set of ranges to kill first, merging overlapping\n        // ranges.\n        for (var i = 0; i < ranges.length; i++) {\n            var toKill = compute(ranges[i])\n            while (kill.length && cmp(toKill.from, lst(kill).to) <= 0) {\n                var replaced = kill.pop()\n                if (cmp(replaced.from, toKill.from) < 0) {\n                    toKill.from = replaced.from\n                    break\n                }\n            }\n            kill.push(toKill)\n        }\n        // Next, remove those actual ranges.\n        runInOp(cm, function() {\n            for (var i = kill.length - 1; i >= 0; i--) {\n                replaceRange(cm.doc, \"\", kill[i].from, kill[i].to, \"+delete\")\n            }\n            ensureCursorVisible(cm)\n        })\n    }\n\n    function moveCharLogically(line, ch, dir) {\n        var target = skipExtendingChars(line.text, ch + dir, dir)\n        return target < 0 || target > line.text.length ? null : target\n    }\n\n    function moveLogically(line, start, dir) {\n        var ch = moveCharLogically(line, start.ch, dir)\n        return ch == null ? null : new Pos(start.line, ch, dir < 0 ? \"after\" : \"before\")\n    }\n\n    function endOfLine(visually, cm, lineObj, lineNo, dir) {\n        if (visually) {\n            if (cm.doc.direction == \"rtl\") {\n                dir = -dir\n            }\n            var order = getOrder(lineObj, cm.doc.direction)\n            if (order) {\n                var part = dir < 0 ? lst(order) : order[0]\n                var moveInStorageOrder = dir < 0 == (part.level == 1)\n                var sticky = moveInStorageOrder ? \"after\" : \"before\"\n                var ch\n                // With a wrapped rtl chunk (possibly spanning multiple bidi parts),\n                // it could be that the last bidi part is not on the last visual line,\n                // since visual lines contain content order-consecutive chunks.\n                // Thus, in rtl, we are looking for the first (content-order) character\n                // in the rtl chunk that is on the last line (that is, the same line\n                // as the last (content-order) character).\n                if (part.level > 0 || cm.doc.direction == \"rtl\") {\n                    var prep = prepareMeasureForLine(cm, lineObj)\n                    ch = dir < 0 ? lineObj.text.length - 1 : 0\n                    var targetTop = measureCharPrepared(cm, prep, ch).top\n                    ch = findFirst(\n                        function(ch) {\n                            return measureCharPrepared(cm, prep, ch).top == targetTop\n                        },\n                        dir < 0 == (part.level == 1) ? part.from : part.to - 1,\n                        ch\n                    )\n                    if (sticky == \"before\") {\n                        ch = moveCharLogically(lineObj, ch, 1)\n                    }\n                } else {\n                    ch = dir < 0 ? part.to : part.from\n                }\n                return new Pos(lineNo, ch, sticky)\n            }\n        }\n        return new Pos(lineNo, dir < 0 ? lineObj.text.length : 0, dir < 0 ? \"before\" : \"after\")\n    }\n\n    function moveVisually(cm, line, start, dir) {\n        var bidi = getOrder(line, cm.doc.direction)\n        if (!bidi) {\n            return moveLogically(line, start, dir)\n        }\n        if (start.ch >= line.text.length) {\n            start.ch = line.text.length\n            start.sticky = \"before\"\n        } else if (start.ch <= 0) {\n            start.ch = 0\n            start.sticky = \"after\"\n        }\n        var partPos = getBidiPartAt(bidi, start.ch, start.sticky),\n            part = bidi[partPos]\n        if (\n            cm.doc.direction == \"ltr\" &&\n            part.level % 2 == 0 &&\n            (dir > 0 ? part.to > start.ch : part.from < start.ch)\n        ) {\n            // Case 1: We move within an ltr part in an ltr editor. Even with wrapped lines,\n            // nothing interesting happens.\n            return moveLogically(line, start, dir)\n        }\n\n        var mv = function(pos, dir) {\n            return moveCharLogically(line, pos instanceof Pos ? pos.ch : pos, dir)\n        }\n        var prep\n        var getWrappedLineExtent = function(ch) {\n            if (!cm.options.lineWrapping) {\n                return { begin: 0, end: line.text.length }\n            }\n            prep = prep || prepareMeasureForLine(cm, line)\n            return wrappedLineExtentChar(cm, line, prep, ch)\n        }\n        var wrappedLineExtent = getWrappedLineExtent(\n            start.sticky == \"before\" ? mv(start, -1) : start.ch\n        )\n\n        if (cm.doc.direction == \"rtl\" || part.level == 1) {\n            var moveInStorageOrder = (part.level == 1) == dir < 0\n            var ch = mv(start, moveInStorageOrder ? 1 : -1)\n            if (\n                ch != null &&\n                (!moveInStorageOrder\n                    ? ch >= part.from && ch >= wrappedLineExtent.begin\n                    : ch <= part.to && ch <= wrappedLineExtent.end)\n            ) {\n                // Case 2: We move within an rtl part or in an rtl editor on the same visual line\n                var sticky = moveInStorageOrder ? \"before\" : \"after\"\n                return new Pos(start.line, ch, sticky)\n            }\n        }\n\n        // Case 3: Could not move within this bidi part in this visual line, so leave\n        // the current bidi part\n\n        var searchInVisualLine = function(partPos, dir, wrappedLineExtent) {\n            var getRes = function(ch, moveInStorageOrder) {\n                return moveInStorageOrder\n                    ? new Pos(start.line, mv(ch, 1), \"before\")\n                    : new Pos(start.line, ch, \"after\")\n            }\n\n            for (; partPos >= 0 && partPos < bidi.length; partPos += dir) {\n                var part = bidi[partPos]\n                var moveInStorageOrder = dir > 0 == (part.level != 1)\n                var ch = moveInStorageOrder\n                    ? wrappedLineExtent.begin\n                    : mv(wrappedLineExtent.end, -1)\n                if (part.from <= ch && ch < part.to) {\n                    return getRes(ch, moveInStorageOrder)\n                }\n                ch = moveInStorageOrder ? part.from : mv(part.to, -1)\n                if (wrappedLineExtent.begin <= ch && ch < wrappedLineExtent.end) {\n                    return getRes(ch, moveInStorageOrder)\n                }\n            }\n        }\n\n        // Case 3a: Look for other bidi parts on the same visual line\n        var res = searchInVisualLine(partPos + dir, dir, wrappedLineExtent)\n        if (res) {\n            return res\n        }\n\n        // Case 3b: Look for other bidi parts on the next visual line\n        var nextCh = dir > 0 ? wrappedLineExtent.end : mv(wrappedLineExtent.begin, -1)\n        if (nextCh != null && !(dir > 0 && nextCh == line.text.length)) {\n            res = searchInVisualLine(\n                dir > 0 ? 0 : bidi.length - 1,\n                dir,\n                getWrappedLineExtent(nextCh)\n            )\n            if (res) {\n                return res\n            }\n        }\n\n        // Case 4: Nowhere to move\n        return null\n    }\n\n    // Commands are parameter-less actions that can be performed on an\n    // editor, mostly used for keybindings.\n    var commands = {\n        selectAll: selectAll,\n        singleSelection: function(cm) {\n            return cm.setSelection(cm.getCursor(\"anchor\"), cm.getCursor(\"head\"), sel_dontScroll)\n        },\n        killLine: function(cm) {\n            return deleteNearSelection(cm, function(range) {\n                if (range.empty()) {\n                    var len = getLine(cm.doc, range.head.line).text.length\n                    if (range.head.ch == len && range.head.line < cm.lastLine()) {\n                        return { from: range.head, to: Pos(range.head.line + 1, 0) }\n                    } else {\n                        return { from: range.head, to: Pos(range.head.line, len) }\n                    }\n                } else {\n                    return { from: range.from(), to: range.to() }\n                }\n            })\n        },\n        deleteLine: function(cm) {\n            return deleteNearSelection(cm, function(range) {\n                return {\n                    from: Pos(range.from().line, 0),\n                    to: clipPos(cm.doc, Pos(range.to().line + 1, 0))\n                }\n            })\n        },\n        delLineLeft: function(cm) {\n            return deleteNearSelection(cm, function(range) {\n                return {\n                    from: Pos(range.from().line, 0),\n                    to: range.from()\n                }\n            })\n        },\n        delWrappedLineLeft: function(cm) {\n            return deleteNearSelection(cm, function(range) {\n                var top = cm.charCoords(range.head, \"div\").top + 5\n                var leftPos = cm.coordsChar({ left: 0, top: top }, \"div\")\n                return { from: leftPos, to: range.from() }\n            })\n        },\n        delWrappedLineRight: function(cm) {\n            return deleteNearSelection(cm, function(range) {\n                var top = cm.charCoords(range.head, \"div\").top + 5\n                var rightPos = cm.coordsChar(\n                    { left: cm.display.lineDiv.offsetWidth + 100, top: top },\n                    \"div\"\n                )\n                return { from: range.from(), to: rightPos }\n            })\n        },\n        undo: function(cm) {\n            return cm.undo()\n        },\n        redo: function(cm) {\n            return cm.redo()\n        },\n        undoSelection: function(cm) {\n            return cm.undoSelection()\n        },\n        redoSelection: function(cm) {\n            return cm.redoSelection()\n        },\n        goDocStart: function(cm) {\n            return cm.extendSelection(Pos(cm.firstLine(), 0))\n        },\n        goDocEnd: function(cm) {\n            return cm.extendSelection(Pos(cm.lastLine()))\n        },\n        goLineStart: function(cm) {\n            return cm.extendSelectionsBy(\n                function(range) {\n                    return lineStart(cm, range.head.line)\n                },\n                { origin: \"+move\", bias: 1 }\n            )\n        },\n        goLineStartSmart: function(cm) {\n            return cm.extendSelectionsBy(\n                function(range) {\n                    return lineStartSmart(cm, range.head)\n                },\n                { origin: \"+move\", bias: 1 }\n            )\n        },\n        goLineEnd: function(cm) {\n            return cm.extendSelectionsBy(\n                function(range) {\n                    return lineEnd(cm, range.head.line)\n                },\n                { origin: \"+move\", bias: -1 }\n            )\n        },\n        goLineRight: function(cm) {\n            return cm.extendSelectionsBy(function(range) {\n                var top = cm.cursorCoords(range.head, \"div\").top + 5\n                return cm.coordsChar(\n                    { left: cm.display.lineDiv.offsetWidth + 100, top: top },\n                    \"div\"\n                )\n            }, sel_move)\n        },\n        goLineLeft: function(cm) {\n            return cm.extendSelectionsBy(function(range) {\n                var top = cm.cursorCoords(range.head, \"div\").top + 5\n                return cm.coordsChar({ left: 0, top: top }, \"div\")\n            }, sel_move)\n        },\n        goLineLeftSmart: function(cm) {\n            return cm.extendSelectionsBy(function(range) {\n                var top = cm.cursorCoords(range.head, \"div\").top + 5\n                var pos = cm.coordsChar({ left: 0, top: top }, \"div\")\n                if (pos.ch < cm.getLine(pos.line).search(/\\S/)) {\n                    return lineStartSmart(cm, range.head)\n                }\n                return pos\n            }, sel_move)\n        },\n        goLineUp: function(cm) {\n            return cm.moveV(-1, \"line\")\n        },\n        goLineDown: function(cm) {\n            return cm.moveV(1, \"line\")\n        },\n        goPageUp: function(cm) {\n            return cm.moveV(-1, \"page\")\n        },\n        goPageDown: function(cm) {\n            return cm.moveV(1, \"page\")\n        },\n        goCharLeft: function(cm) {\n            return cm.moveH(-1, \"char\")\n        },\n        goCharRight: function(cm) {\n            return cm.moveH(1, \"char\")\n        },\n        goColumnLeft: function(cm) {\n            return cm.moveH(-1, \"column\")\n        },\n        goColumnRight: function(cm) {\n            return cm.moveH(1, \"column\")\n        },\n        goWordLeft: function(cm) {\n            return cm.moveH(-1, \"word\")\n        },\n        goGroupRight: function(cm) {\n            return cm.moveH(1, \"group\")\n        },\n        goGroupLeft: function(cm) {\n            return cm.moveH(-1, \"group\")\n        },\n        goWordRight: function(cm) {\n            return cm.moveH(1, \"word\")\n        },\n        delCharBefore: function(cm) {\n            return cm.deleteH(-1, \"char\")\n        },\n        delCharAfter: function(cm) {\n            return cm.deleteH(1, \"char\")\n        },\n        delWordBefore: function(cm) {\n            return cm.deleteH(-1, \"word\")\n        },\n        delWordAfter: function(cm) {\n            return cm.deleteH(1, \"word\")\n        },\n        delGroupBefore: function(cm) {\n            return cm.deleteH(-1, \"group\")\n        },\n        delGroupAfter: function(cm) {\n            return cm.deleteH(1, \"group\")\n        },\n        indentAuto: function(cm) {\n            return cm.indentSelection(\"smart\")\n        },\n        indentMore: function(cm) {\n            return cm.indentSelection(\"add\")\n        },\n        indentLess: function(cm) {\n            return cm.indentSelection(\"subtract\")\n        },\n        insertTab: function(cm) {\n            return cm.replaceSelection(\"\\t\")\n        },\n        insertSoftTab: function(cm) {\n            var spaces = [],\n                ranges = cm.listSelections(),\n                tabSize = cm.options.tabSize\n            for (var i = 0; i < ranges.length; i++) {\n                var pos = ranges[i].from()\n                var col = countColumn(cm.getLine(pos.line), pos.ch, tabSize)\n                spaces.push(spaceStr(tabSize - (col % tabSize)))\n            }\n            cm.replaceSelections(spaces)\n        },\n        defaultTab: function(cm) {\n            if (cm.somethingSelected()) {\n                cm.indentSelection(\"add\")\n            } else {\n                cm.execCommand(\"insertTab\")\n            }\n        },\n        // Swap the two chars left and right of each selection's head.\n        // Move cursor behind the two swapped characters afterwards.\n        //\n        // Doesn't consider line feeds a character.\n        // Doesn't scan more than one line above to find a character.\n        // Doesn't do anything on an empty line.\n        // Doesn't do anything with non-empty selections.\n        transposeChars: function(cm) {\n            return runInOp(cm, function() {\n                var ranges = cm.listSelections(),\n                    newSel = []\n                for (var i = 0; i < ranges.length; i++) {\n                    if (!ranges[i].empty()) {\n                        continue\n                    }\n                    var cur = ranges[i].head,\n                        line = getLine(cm.doc, cur.line).text\n                    if (line) {\n                        if (cur.ch == line.length) {\n                            cur = new Pos(cur.line, cur.ch - 1)\n                        }\n                        if (cur.ch > 0) {\n                            cur = new Pos(cur.line, cur.ch + 1)\n                            cm.replaceRange(\n                                line.charAt(cur.ch - 1) + line.charAt(cur.ch - 2),\n                                Pos(cur.line, cur.ch - 2),\n                                cur,\n                                \"+transpose\"\n                            )\n                        } else if (cur.line > cm.doc.first) {\n                            var prev = getLine(cm.doc, cur.line - 1).text\n                            if (prev) {\n                                cur = new Pos(cur.line, 1)\n                                cm.replaceRange(\n                                    line.charAt(0) +\n                                        cm.doc.lineSeparator() +\n                                        prev.charAt(prev.length - 1),\n                                    Pos(cur.line - 1, prev.length - 1),\n                                    cur,\n                                    \"+transpose\"\n                                )\n                            }\n                        }\n                    }\n                    newSel.push(new Range(cur, cur))\n                }\n                cm.setSelections(newSel)\n            })\n        },\n        newlineAndIndent: function(cm) {\n            return runInOp(cm, function() {\n                var sels = cm.listSelections()\n                for (var i = sels.length - 1; i >= 0; i--) {\n                    cm.replaceRange(cm.doc.lineSeparator(), sels[i].anchor, sels[i].head, \"+input\")\n                }\n                sels = cm.listSelections()\n                for (var i$1 = 0; i$1 < sels.length; i$1++) {\n                    cm.indentLine(sels[i$1].from().line, null, true)\n                }\n                ensureCursorVisible(cm)\n            })\n        },\n        openLine: function(cm) {\n            return cm.replaceSelection(\"\\n\", \"start\")\n        },\n        toggleOverwrite: function(cm) {\n            return cm.toggleOverwrite()\n        }\n    }\n\n    function lineStart(cm, lineN) {\n        var line = getLine(cm.doc, lineN)\n        var visual = visualLine(line)\n        if (visual != line) {\n            lineN = lineNo(visual)\n        }\n        return endOfLine(true, cm, visual, lineN, 1)\n    }\n    function lineEnd(cm, lineN) {\n        var line = getLine(cm.doc, lineN)\n        var visual = visualLineEnd(line)\n        if (visual != line) {\n            lineN = lineNo(visual)\n        }\n        return endOfLine(true, cm, line, lineN, -1)\n    }\n    function lineStartSmart(cm, pos) {\n        var start = lineStart(cm, pos.line)\n        var line = getLine(cm.doc, start.line)\n        var order = getOrder(line, cm.doc.direction)\n        if (!order || order[0].level == 0) {\n            var firstNonWS = Math.max(start.ch, line.text.search(/\\S/))\n            var inWS = pos.line == start.line && pos.ch <= firstNonWS && pos.ch\n            return Pos(start.line, inWS ? 0 : firstNonWS, start.sticky)\n        }\n        return start\n    }\n\n    // Run a handler that was bound to a key.\n    function doHandleBinding(cm, bound, dropShift) {\n        if (typeof bound == \"string\") {\n            bound = commands[bound]\n            if (!bound) {\n                return false\n            }\n        }\n        // Ensure previous input has been read, so that the handler sees a\n        // consistent view of the document\n        cm.display.input.ensurePolled()\n        var prevShift = cm.display.shift,\n            done = false\n        try {\n            if (cm.isReadOnly()) {\n                cm.state.suppressEdits = true\n            }\n            if (dropShift) {\n                cm.display.shift = false\n            }\n            done = bound(cm) != Pass\n        } finally {\n            cm.display.shift = prevShift\n            cm.state.suppressEdits = false\n        }\n        return done\n    }\n\n    function lookupKeyForEditor(cm, name, handle) {\n        for (var i = 0; i < cm.state.keyMaps.length; i++) {\n            var result = lookupKey(name, cm.state.keyMaps[i], handle, cm)\n            if (result) {\n                return result\n            }\n        }\n        return (\n            (cm.options.extraKeys && lookupKey(name, cm.options.extraKeys, handle, cm)) ||\n            lookupKey(name, cm.options.keyMap, handle, cm)\n        )\n    }\n\n    // Note that, despite the name, this function is also used to check\n    // for bound mouse clicks.\n\n    var stopSeq = new Delayed()\n\n    function dispatchKey(cm, name, e, handle) {\n        var seq = cm.state.keySeq\n        if (seq) {\n            if (isModifierKey(name)) {\n                return \"handled\"\n            }\n            if (/\\'$/.test(name)) {\n                cm.state.keySeq = null\n            } else {\n                stopSeq.set(50, function() {\n                    if (cm.state.keySeq == seq) {\n                        cm.state.keySeq = null\n                        cm.display.input.reset()\n                    }\n                })\n            }\n            if (dispatchKeyInner(cm, seq + \" \" + name, e, handle)) {\n                return true\n            }\n        }\n        return dispatchKeyInner(cm, name, e, handle)\n    }\n\n    function dispatchKeyInner(cm, name, e, handle) {\n        var result = lookupKeyForEditor(cm, name, handle)\n\n        if (result == \"multi\") {\n            cm.state.keySeq = name\n        }\n        if (result == \"handled\") {\n            signalLater(cm, \"keyHandled\", cm, name, e)\n        }\n\n        if (result == \"handled\" || result == \"multi\") {\n            e_preventDefault(e)\n            restartBlink(cm)\n        }\n\n        return !!result\n    }\n\n    // Handle a key from the keydown event.\n    function handleKeyBinding(cm, e) {\n        var name = keyName(e, true)\n        if (!name) {\n            return false\n        }\n\n        if (e.shiftKey && !cm.state.keySeq) {\n            // First try to resolve full name (including 'Shift-'). Failing\n            // that, see if there is a cursor-motion command (starting with\n            // 'go') bound to the keyname without 'Shift-'.\n            return (\n                dispatchKey(cm, \"Shift-\" + name, e, function(b) {\n                    return doHandleBinding(cm, b, true)\n                }) ||\n                dispatchKey(cm, name, e, function(b) {\n                    if (typeof b == \"string\" ? /^go[A-Z]/.test(b) : b.motion) {\n                        return doHandleBinding(cm, b)\n                    }\n                })\n            )\n        } else {\n            return dispatchKey(cm, name, e, function(b) {\n                return doHandleBinding(cm, b)\n            })\n        }\n    }\n\n    // Handle a key from the keypress event\n    function handleCharBinding(cm, e, ch) {\n        return dispatchKey(cm, \"'\" + ch + \"'\", e, function(b) {\n            return doHandleBinding(cm, b, true)\n        })\n    }\n\n    var lastStoppedKey = null\n    function onKeyDown(e) {\n        var cm = this\n        cm.curOp.focus = activeElt()\n        if (signalDOMEvent(cm, e)) {\n            return\n        }\n        // IE does strange things with escape.\n        if (ie && ie_version < 11 && e.keyCode == 27) {\n            e.returnValue = false\n        }\n        var code = e.keyCode\n        cm.display.shift = code == 16 || e.shiftKey\n        var handled = handleKeyBinding(cm, e)\n        if (presto) {\n            lastStoppedKey = handled ? code : null\n            // Opera has no cut event... we try to at least catch the key combo\n            if (!handled && code == 88 && !hasCopyEvent && (mac ? e.metaKey : e.ctrlKey)) {\n                cm.replaceSelection(\"\", null, \"cut\")\n            }\n        }\n        if (\n            gecko &&\n            !mac &&\n            !handled &&\n            code == 46 &&\n            e.shiftKey &&\n            !e.ctrlKey &&\n            document.execCommand\n        ) {\n            document.execCommand(\"cut\")\n        }\n\n        // Turn mouse into crosshair when Alt is held on Mac.\n        if (code == 18 && !/\\bCodeMirror-crosshair\\b/.test(cm.display.lineDiv.className)) {\n            showCrossHair(cm)\n        }\n    }\n\n    function showCrossHair(cm) {\n        var lineDiv = cm.display.lineDiv\n        addClass(lineDiv, \"CodeMirror-crosshair\")\n\n        function up(e) {\n            if (e.keyCode == 18 || !e.altKey) {\n                rmClass(lineDiv, \"CodeMirror-crosshair\")\n                off(document, \"keyup\", up)\n                off(document, \"mouseover\", up)\n            }\n        }\n        on(document, \"keyup\", up)\n        on(document, \"mouseover\", up)\n    }\n\n    function onKeyUp(e) {\n        if (e.keyCode == 16) {\n            this.doc.sel.shift = false\n        }\n        signalDOMEvent(this, e)\n    }\n\n    function onKeyPress(e) {\n        var cm = this\n        if (\n            eventInWidget(cm.display, e) ||\n            signalDOMEvent(cm, e) ||\n            (e.ctrlKey && !e.altKey) ||\n            (mac && e.metaKey)\n        ) {\n            return\n        }\n        var keyCode = e.keyCode,\n            charCode = e.charCode\n        if (presto && keyCode == lastStoppedKey) {\n            lastStoppedKey = null\n            e_preventDefault(e)\n            return\n        }\n        if (presto && (!e.which || e.which < 10) && handleKeyBinding(cm, e)) {\n            return\n        }\n        var ch = String.fromCharCode(charCode == null ? keyCode : charCode)\n        // Some browsers fire keypress events for backspace\n        if (ch == \"\\x08\") {\n            return\n        }\n        if (handleCharBinding(cm, e, ch)) {\n            return\n        }\n        cm.display.input.onKeyPress(e)\n    }\n\n    var DOUBLECLICK_DELAY = 400\n\n    var PastClick = function(time, pos, button) {\n        this.time = time\n        this.pos = pos\n        this.button = button\n    }\n\n    PastClick.prototype.compare = function(time, pos, button) {\n        return (\n            this.time + DOUBLECLICK_DELAY > time && cmp(pos, this.pos) == 0 && button == this.button\n        )\n    }\n\n    var lastClick, lastDoubleClick\n    function clickRepeat(pos, button) {\n        var now = +new Date()\n        if (lastDoubleClick && lastDoubleClick.compare(now, pos, button)) {\n            lastClick = lastDoubleClick = null\n            return \"triple\"\n        } else if (lastClick && lastClick.compare(now, pos, button)) {\n            lastDoubleClick = new PastClick(now, pos, button)\n            lastClick = null\n            return \"double\"\n        } else {\n            lastClick = new PastClick(now, pos, button)\n            lastDoubleClick = null\n            return \"single\"\n        }\n    }\n\n    // A mouse down can be a single click, double click, triple click,\n    // start of selection drag, start of text drag, new cursor\n    // (ctrl-click), rectangle drag (alt-drag), or xwin\n    // middle-click-paste. Or it might be a click on something we should\n    // not interfere with, such as a scrollbar or widget.\n    function onMouseDown(e) {\n        var cm = this,\n            display = cm.display\n        if (signalDOMEvent(cm, e) || (display.activeTouch && display.input.supportsTouch())) {\n            return\n        }\n        display.input.ensurePolled()\n        display.shift = e.shiftKey\n\n        if (eventInWidget(display, e)) {\n            if (!webkit) {\n                // Briefly turn off draggability, to allow widgets to do\n                // normal dragging things.\n                display.scroller.draggable = false\n                setTimeout(function() {\n                    return (display.scroller.draggable = true)\n                }, 100)\n            }\n            return\n        }\n        if (clickInGutter(cm, e)) {\n            return\n        }\n        var pos = posFromMouse(cm, e),\n            button = e_button(e),\n            repeat = pos ? clickRepeat(pos, button) : \"single\"\n        window.focus()\n\n        // #3261: make sure, that we're not starting a second selection\n        if (button == 1 && cm.state.selectingText) {\n            cm.state.selectingText(e)\n        }\n\n        if (pos && handleMappedButton(cm, button, pos, repeat, e)) {\n            return\n        }\n\n        if (button == 1) {\n            if (pos) {\n                leftButtonDown(cm, pos, repeat, e)\n            } else if (e_target(e) == display.scroller) {\n                e_preventDefault(e)\n            }\n        } else if (button == 2) {\n            if (pos) {\n                extendSelection(cm.doc, pos)\n            }\n            setTimeout(function() {\n                return display.input.focus()\n            }, 20)\n        } else if (button == 3) {\n            if (captureRightClick) {\n                cm.display.input.onContextMenu(e)\n            } else {\n                delayBlurEvent(cm)\n            }\n        }\n    }\n\n    function handleMappedButton(cm, button, pos, repeat, event) {\n        var name = \"Click\"\n        if (repeat == \"double\") {\n            name = \"Double\" + name\n        } else if (repeat == \"triple\") {\n            name = \"Triple\" + name\n        }\n        name = (button == 1 ? \"Left\" : button == 2 ? \"Middle\" : \"Right\") + name\n\n        return dispatchKey(cm, addModifierNames(name, event), event, function(bound) {\n            if (typeof bound == \"string\") {\n                bound = commands[bound]\n            }\n            if (!bound) {\n                return false\n            }\n            var done = false\n            try {\n                if (cm.isReadOnly()) {\n                    cm.state.suppressEdits = true\n                }\n                done = bound(cm, pos) != Pass\n            } finally {\n                cm.state.suppressEdits = false\n            }\n            return done\n        })\n    }\n\n    function configureMouse(cm, repeat, event) {\n        var option = cm.getOption(\"configureMouse\")\n        var value = option ? option(cm, repeat, event) : {}\n        if (value.unit == null) {\n            var rect = chromeOS ? event.shiftKey && event.metaKey : event.altKey\n            value.unit = rect\n                ? \"rectangle\"\n                : repeat == \"single\"\n                ? \"char\"\n                : repeat == \"double\"\n                ? \"word\"\n                : \"line\"\n        }\n        if (value.extend == null || cm.doc.extend) {\n            value.extend = cm.doc.extend || event.shiftKey\n        }\n        if (value.addNew == null) {\n            value.addNew = mac ? event.metaKey : event.ctrlKey\n        }\n        if (value.moveOnDrag == null) {\n            value.moveOnDrag = !(mac ? event.altKey : event.ctrlKey)\n        }\n        return value\n    }\n\n    function leftButtonDown(cm, pos, repeat, event) {\n        if (ie) {\n            setTimeout(bind(ensureFocus, cm), 0)\n        } else {\n            cm.curOp.focus = activeElt()\n        }\n\n        var behavior = configureMouse(cm, repeat, event)\n\n        var sel = cm.doc.sel,\n            contained\n        if (\n            cm.options.dragDrop &&\n            dragAndDrop &&\n            !cm.isReadOnly() &&\n            repeat == \"single\" &&\n            (contained = sel.contains(pos)) > -1 &&\n            (cmp((contained = sel.ranges[contained]).from(), pos) < 0 || pos.xRel > 0) &&\n            (cmp(contained.to(), pos) > 0 || pos.xRel < 0)\n        ) {\n            leftButtonStartDrag(cm, event, pos, behavior)\n        } else {\n            leftButtonSelect(cm, event, pos, behavior)\n        }\n    }\n\n    // Start a text drag. When it ends, see if any dragging actually\n    // happen, and treat as a click if it didn't.\n    function leftButtonStartDrag(cm, event, pos, behavior) {\n        var display = cm.display,\n            moved = false\n        var dragEnd = operation(cm, function(e) {\n            if (webkit) {\n                display.scroller.draggable = false\n            }\n            cm.state.draggingText = false\n            off(display.wrapper.ownerDocument, \"mouseup\", dragEnd)\n            off(display.wrapper.ownerDocument, \"mousemove\", mouseMove)\n            off(display.scroller, \"dragstart\", dragStart)\n            off(display.scroller, \"drop\", dragEnd)\n            if (!moved) {\n                e_preventDefault(e)\n                if (!behavior.addNew) {\n                    extendSelection(cm.doc, pos, null, null, behavior.extend)\n                }\n                // Work around unexplainable focus problem in IE9 (#2127) and Chrome (#3081)\n                if (webkit || (ie && ie_version == 9)) {\n                    setTimeout(function() {\n                        display.wrapper.ownerDocument.body.focus()\n                        display.input.focus()\n                    }, 20)\n                } else {\n                    display.input.focus()\n                }\n            }\n        })\n        var mouseMove = function(e2) {\n            moved =\n                moved ||\n                Math.abs(event.clientX - e2.clientX) + Math.abs(event.clientY - e2.clientY) >= 10\n        }\n        var dragStart = function() {\n            return (moved = true)\n        }\n        // Let the drag handler handle this.\n        if (webkit) {\n            display.scroller.draggable = true\n        }\n        cm.state.draggingText = dragEnd\n        dragEnd.copy = !behavior.moveOnDrag\n        // IE's approach to draggable\n        if (display.scroller.dragDrop) {\n            display.scroller.dragDrop()\n        }\n        on(display.wrapper.ownerDocument, \"mouseup\", dragEnd)\n        on(display.wrapper.ownerDocument, \"mousemove\", mouseMove)\n        on(display.scroller, \"dragstart\", dragStart)\n        on(display.scroller, \"drop\", dragEnd)\n\n        delayBlurEvent(cm)\n        setTimeout(function() {\n            return display.input.focus()\n        }, 20)\n    }\n\n    function rangeForUnit(cm, pos, unit) {\n        if (unit == \"char\") {\n            return new Range(pos, pos)\n        }\n        if (unit == \"word\") {\n            return cm.findWordAt(pos)\n        }\n        if (unit == \"line\") {\n            return new Range(Pos(pos.line, 0), clipPos(cm.doc, Pos(pos.line + 1, 0)))\n        }\n        var result = unit(cm, pos)\n        return new Range(result.from, result.to)\n    }\n\n    // Normal selection, as opposed to text dragging.\n    function leftButtonSelect(cm, event, start, behavior) {\n        var display = cm.display,\n            doc = cm.doc\n        e_preventDefault(event)\n\n        var ourRange,\n            ourIndex,\n            startSel = doc.sel,\n            ranges = startSel.ranges\n        if (behavior.addNew && !behavior.extend) {\n            ourIndex = doc.sel.contains(start)\n            if (ourIndex > -1) {\n                ourRange = ranges[ourIndex]\n            } else {\n                ourRange = new Range(start, start)\n            }\n        } else {\n            ourRange = doc.sel.primary()\n            ourIndex = doc.sel.primIndex\n        }\n\n        if (behavior.unit == \"rectangle\") {\n            if (!behavior.addNew) {\n                ourRange = new Range(start, start)\n            }\n            start = posFromMouse(cm, event, true, true)\n            ourIndex = -1\n        } else {\n            var range = rangeForUnit(cm, start, behavior.unit)\n            if (behavior.extend) {\n                ourRange = extendRange(ourRange, range.anchor, range.head, behavior.extend)\n            } else {\n                ourRange = range\n            }\n        }\n\n        if (!behavior.addNew) {\n            ourIndex = 0\n            setSelection(doc, new Selection([ourRange], 0), sel_mouse)\n            startSel = doc.sel\n        } else if (ourIndex == -1) {\n            ourIndex = ranges.length\n            setSelection(doc, normalizeSelection(cm, ranges.concat([ourRange]), ourIndex), {\n                scroll: false,\n                origin: \"*mouse\"\n            })\n        } else if (\n            ranges.length > 1 &&\n            ranges[ourIndex].empty() &&\n            behavior.unit == \"char\" &&\n            !behavior.extend\n        ) {\n            setSelection(\n                doc,\n                normalizeSelection(\n                    cm,\n                    ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)),\n                    0\n                ),\n                { scroll: false, origin: \"*mouse\" }\n            )\n            startSel = doc.sel\n        } else {\n            replaceOneSelection(doc, ourIndex, ourRange, sel_mouse)\n        }\n\n        var lastPos = start\n        function extendTo(pos) {\n            if (cmp(lastPos, pos) == 0) {\n                return\n            }\n            lastPos = pos\n\n            if (behavior.unit == \"rectangle\") {\n                var ranges = [],\n                    tabSize = cm.options.tabSize\n                var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize)\n                var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize)\n                var left = Math.min(startCol, posCol),\n                    right = Math.max(startCol, posCol)\n                for (\n                    var line = Math.min(start.line, pos.line),\n                        end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));\n                    line <= end;\n                    line++\n                ) {\n                    var text = getLine(doc, line).text,\n                        leftPos = findColumn(text, left, tabSize)\n                    if (left == right) {\n                        ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos)))\n                    } else if (text.length > leftPos) {\n                        ranges.push(\n                            new Range(\n                                Pos(line, leftPos),\n                                Pos(line, findColumn(text, right, tabSize))\n                            )\n                        )\n                    }\n                }\n                if (!ranges.length) {\n                    ranges.push(new Range(start, start))\n                }\n                setSelection(\n                    doc,\n                    normalizeSelection(\n                        cm,\n                        startSel.ranges.slice(0, ourIndex).concat(ranges),\n                        ourIndex\n                    ),\n                    { origin: \"*mouse\", scroll: false }\n                )\n                cm.scrollIntoView(pos)\n            } else {\n                var oldRange = ourRange\n                var range = rangeForUnit(cm, pos, behavior.unit)\n                var anchor = oldRange.anchor,\n                    head\n                if (cmp(range.anchor, anchor) > 0) {\n                    head = range.head\n                    anchor = minPos(oldRange.from(), range.anchor)\n                } else {\n                    head = range.anchor\n                    anchor = maxPos(oldRange.to(), range.head)\n                }\n                var ranges$1 = startSel.ranges.slice(0)\n                ranges$1[ourIndex] = bidiSimplify(cm, new Range(clipPos(doc, anchor), head))\n                setSelection(doc, normalizeSelection(cm, ranges$1, ourIndex), sel_mouse)\n            }\n        }\n\n        var editorSize = display.wrapper.getBoundingClientRect()\n        // Used to ensure timeout re-tries don't fire when another extend\n        // happened in the meantime (clearTimeout isn't reliable -- at\n        // least on Chrome, the timeouts still happen even when cleared,\n        // if the clear happens after their scheduled firing time).\n        var counter = 0\n\n        function extend(e) {\n            var curCount = ++counter\n            var cur = posFromMouse(cm, e, true, behavior.unit == \"rectangle\")\n            if (!cur) {\n                return\n            }\n            if (cmp(cur, lastPos) != 0) {\n                cm.curOp.focus = activeElt()\n                extendTo(cur)\n                var visible = visibleLines(display, doc)\n                if (cur.line >= visible.to || cur.line < visible.from) {\n                    setTimeout(\n                        operation(cm, function() {\n                            if (counter == curCount) {\n                                extend(e)\n                            }\n                        }),\n                        150\n                    )\n                }\n            } else {\n                var outside =\n                    e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0\n                if (outside) {\n                    setTimeout(\n                        operation(cm, function() {\n                            if (counter != curCount) {\n                                return\n                            }\n                            display.scroller.scrollTop += outside\n                            extend(e)\n                        }),\n                        50\n                    )\n                }\n            }\n        }\n\n        function done(e) {\n            cm.state.selectingText = false\n            counter = Infinity\n            // If e is null or undefined we interpret this as someone trying\n            // to explicitly cancel the selection rather than the user\n            // letting go of the mouse button.\n            if (e) {\n                e_preventDefault(e)\n                display.input.focus()\n            }\n            off(display.wrapper.ownerDocument, \"mousemove\", move)\n            off(display.wrapper.ownerDocument, \"mouseup\", up)\n            doc.history.lastSelOrigin = null\n        }\n\n        var move = operation(cm, function(e) {\n            if (e.buttons === 0 || !e_button(e)) {\n                done(e)\n            } else {\n                extend(e)\n            }\n        })\n        var up = operation(cm, done)\n        cm.state.selectingText = up\n        on(display.wrapper.ownerDocument, \"mousemove\", move)\n        on(display.wrapper.ownerDocument, \"mouseup\", up)\n    }\n\n    // Used when mouse-selecting to adjust the anchor to the proper side\n    // of a bidi jump depending on the visual position of the head.\n    function bidiSimplify(cm, range) {\n        var anchor = range.anchor\n        var head = range.head\n        var anchorLine = getLine(cm.doc, anchor.line)\n        if (cmp(anchor, head) == 0 && anchor.sticky == head.sticky) {\n            return range\n        }\n        var order = getOrder(anchorLine)\n        if (!order) {\n            return range\n        }\n        var index = getBidiPartAt(order, anchor.ch, anchor.sticky),\n            part = order[index]\n        if (part.from != anchor.ch && part.to != anchor.ch) {\n            return range\n        }\n        var boundary = index + ((part.from == anchor.ch) == (part.level != 1) ? 0 : 1)\n        if (boundary == 0 || boundary == order.length) {\n            return range\n        }\n\n        // Compute the relative visual position of the head compared to the\n        // anchor (<0 is to the left, >0 to the right)\n        var leftSide\n        if (head.line != anchor.line) {\n            leftSide = (head.line - anchor.line) * (cm.doc.direction == \"ltr\" ? 1 : -1) > 0\n        } else {\n            var headIndex = getBidiPartAt(order, head.ch, head.sticky)\n            var dir = headIndex - index || (head.ch - anchor.ch) * (part.level == 1 ? -1 : 1)\n            if (headIndex == boundary - 1 || headIndex == boundary) {\n                leftSide = dir < 0\n            } else {\n                leftSide = dir > 0\n            }\n        }\n\n        var usePart = order[boundary + (leftSide ? -1 : 0)]\n        var from = leftSide == (usePart.level == 1)\n        var ch = from ? usePart.from : usePart.to,\n            sticky = from ? \"after\" : \"before\"\n        return anchor.ch == ch && anchor.sticky == sticky\n            ? range\n            : new Range(new Pos(anchor.line, ch, sticky), head)\n    }\n\n    // Determines whether an event happened in the gutter, and fires the\n    // handlers for the corresponding event.\n    function gutterEvent(cm, e, type, prevent) {\n        var mX, mY\n        if (e.touches) {\n            mX = e.touches[0].clientX\n            mY = e.touches[0].clientY\n        } else {\n            try {\n                mX = e.clientX\n                mY = e.clientY\n            } catch (e) {\n                return false\n            }\n        }\n        if (mX >= Math.floor(cm.display.gutters.getBoundingClientRect().right)) {\n            return false\n        }\n        if (prevent) {\n            e_preventDefault(e)\n        }\n\n        var display = cm.display\n        var lineBox = display.lineDiv.getBoundingClientRect()\n\n        if (mY > lineBox.bottom || !hasHandler(cm, type)) {\n            return e_defaultPrevented(e)\n        }\n        mY -= lineBox.top - display.viewOffset\n\n        for (var i = 0; i < cm.display.gutterSpecs.length; ++i) {\n            var g = display.gutters.childNodes[i]\n            if (g && g.getBoundingClientRect().right >= mX) {\n                var line = lineAtHeight(cm.doc, mY)\n                var gutter = cm.display.gutterSpecs[i]\n                signal(cm, type, cm, line, gutter.className, e)\n                return e_defaultPrevented(e)\n            }\n        }\n    }\n\n    function clickInGutter(cm, e) {\n        return gutterEvent(cm, e, \"gutterClick\", true)\n    }\n\n    // CONTEXT MENU HANDLING\n\n    // To make the context menu work, we need to briefly unhide the\n    // textarea (making it as unobtrusive as possible) to let the\n    // right-click take effect on it.\n    function onContextMenu(cm, e) {\n        if (eventInWidget(cm.display, e) || contextMenuInGutter(cm, e)) {\n            return\n        }\n        if (signalDOMEvent(cm, e, \"contextmenu\")) {\n            return\n        }\n        if (!captureRightClick) {\n            cm.display.input.onContextMenu(e)\n        }\n    }\n\n    function contextMenuInGutter(cm, e) {\n        if (!hasHandler(cm, \"gutterContextMenu\")) {\n            return false\n        }\n        return gutterEvent(cm, e, \"gutterContextMenu\", false)\n    }\n\n    function themeChanged(cm) {\n        cm.display.wrapper.className =\n            cm.display.wrapper.className.replace(/\\s*cm-s-\\S+/g, \"\") +\n            cm.options.theme.replace(/(^|\\s)\\s*/g, \" cm-s-\")\n        clearCaches(cm)\n    }\n\n    var Init = {\n        toString: function() {\n            return \"CodeMirror.Init\"\n        }\n    }\n\n    var defaults = {}\n    var optionHandlers = {}\n\n    function defineOptions(CodeMirror) {\n        var optionHandlers = CodeMirror.optionHandlers\n\n        function option(name, deflt, handle, notOnInit) {\n            CodeMirror.defaults[name] = deflt\n            if (handle) {\n                optionHandlers[name] = notOnInit\n                    ? function(cm, val, old) {\n                          if (old != Init) {\n                              handle(cm, val, old)\n                          }\n                      }\n                    : handle\n            }\n        }\n\n        CodeMirror.defineOption = option\n\n        // Passed to option handlers when there is no old value.\n        CodeMirror.Init = Init\n\n        // These two are, on init, called from the constructor because they\n        // have to be initialized before the editor can start at all.\n        option(\n            \"value\",\n            \"\",\n            function(cm, val) {\n                return cm.setValue(val)\n            },\n            true\n        )\n        option(\n            \"mode\",\n            null,\n            function(cm, val) {\n                cm.doc.modeOption = val\n                loadMode(cm)\n            },\n            true\n        )\n\n        option(\"indentUnit\", 2, loadMode, true)\n        option(\"indentWithTabs\", false)\n        option(\"smartIndent\", true)\n        option(\n            \"tabSize\",\n            4,\n            function(cm) {\n                resetModeState(cm)\n                clearCaches(cm)\n                regChange(cm)\n            },\n            true\n        )\n\n        option(\"lineSeparator\", null, function(cm, val) {\n            cm.doc.lineSep = val\n            if (!val) {\n                return\n            }\n            var newBreaks = [],\n                lineNo = cm.doc.first\n            cm.doc.iter(function(line) {\n                for (var pos = 0; ; ) {\n                    var found = line.text.indexOf(val, pos)\n                    if (found == -1) {\n                        break\n                    }\n                    pos = found + val.length\n                    newBreaks.push(Pos(lineNo, found))\n                }\n                lineNo++\n            })\n            for (var i = newBreaks.length - 1; i >= 0; i--) {\n                replaceRange(\n                    cm.doc,\n                    val,\n                    newBreaks[i],\n                    Pos(newBreaks[i].line, newBreaks[i].ch + val.length)\n                )\n            }\n        })\n        option(\n            \"specialChars\",\n            /[\\u0000-\\u001f\\u007f-\\u009f\\u00ad\\u061c\\u200b-\\u200f\\u2028\\u2029\\ufeff\\ufff9-\\ufffc]/g,\n            function(cm, val, old) {\n                cm.state.specialChars = new RegExp(val.source + (val.test(\"\\t\") ? \"\" : \"|\\t\"), \"g\")\n                if (old != Init) {\n                    cm.refresh()\n                }\n            }\n        )\n        option(\n            \"specialCharPlaceholder\",\n            defaultSpecialCharPlaceholder,\n            function(cm) {\n                return cm.refresh()\n            },\n            true\n        )\n        option(\"electricChars\", true)\n        option(\n            \"inputStyle\",\n            mobile ? \"contenteditable\" : \"textarea\",\n            function() {\n                throw new Error(\"inputStyle can not (yet) be changed in a running editor\") // FIXME\n            },\n            true\n        )\n        option(\n            \"spellcheck\",\n            false,\n            function(cm, val) {\n                return (cm.getInputField().spellcheck = val)\n            },\n            true\n        )\n        option(\n            \"autocorrect\",\n            false,\n            function(cm, val) {\n                return (cm.getInputField().autocorrect = val)\n            },\n            true\n        )\n        option(\n            \"autocapitalize\",\n            false,\n            function(cm, val) {\n                return (cm.getInputField().autocapitalize = val)\n            },\n            true\n        )\n        option(\"rtlMoveVisually\", !windows)\n        option(\"wholeLineUpdateBefore\", true)\n\n        option(\n            \"theme\",\n            \"default\",\n            function(cm) {\n                themeChanged(cm)\n                updateGutters(cm)\n            },\n            true\n        )\n        option(\"keyMap\", \"default\", function(cm, val, old) {\n            var next = getKeyMap(val)\n            var prev = old != Init && getKeyMap(old)\n            if (prev && prev.detach) {\n                prev.detach(cm, next)\n            }\n            if (next.attach) {\n                next.attach(cm, prev || null)\n            }\n        })\n        option(\"extraKeys\", null)\n        option(\"configureMouse\", null)\n\n        option(\"lineWrapping\", false, wrappingChanged, true)\n        option(\n            \"gutters\",\n            [],\n            function(cm, val) {\n                cm.display.gutterSpecs = getGutters(val, cm.options.lineNumbers)\n                updateGutters(cm)\n            },\n            true\n        )\n        option(\n            \"fixedGutter\",\n            true,\n            function(cm, val) {\n                cm.display.gutters.style.left = val ? compensateForHScroll(cm.display) + \"px\" : \"0\"\n                cm.refresh()\n            },\n            true\n        )\n        option(\n            \"coverGutterNextToScrollbar\",\n            false,\n            function(cm) {\n                return updateScrollbars(cm)\n            },\n            true\n        )\n        option(\n            \"scrollbarStyle\",\n            \"native\",\n            function(cm) {\n                initScrollbars(cm)\n                updateScrollbars(cm)\n                cm.display.scrollbars.setScrollTop(cm.doc.scrollTop)\n                cm.display.scrollbars.setScrollLeft(cm.doc.scrollLeft)\n            },\n            true\n        )\n        option(\n            \"lineNumbers\",\n            false,\n            function(cm, val) {\n                cm.display.gutterSpecs = getGutters(cm.options.gutters, val)\n                updateGutters(cm)\n            },\n            true\n        )\n        option(\"firstLineNumber\", 1, updateGutters, true)\n        option(\n            \"lineNumberFormatter\",\n            function(integer) {\n                return integer\n            },\n            updateGutters,\n            true\n        )\n        option(\"showCursorWhenSelecting\", false, updateSelection, true)\n\n        option(\"resetSelectionOnContextMenu\", true)\n        option(\"lineWiseCopyCut\", true)\n        option(\"pasteLinesPerSelection\", true)\n        option(\"selectionsMayTouch\", false)\n\n        option(\"readOnly\", false, function(cm, val) {\n            if (val == \"nocursor\") {\n                onBlur(cm)\n                cm.display.input.blur()\n            }\n            cm.display.input.readOnlyChanged(val)\n        })\n        option(\n            \"disableInput\",\n            false,\n            function(cm, val) {\n                if (!val) {\n                    cm.display.input.reset()\n                }\n            },\n            true\n        )\n        option(\"dragDrop\", true, dragDropChanged)\n        option(\"allowDropFileTypes\", null)\n\n        option(\"cursorBlinkRate\", 530)\n        option(\"cursorScrollMargin\", 0)\n        option(\"cursorHeight\", 1, updateSelection, true)\n        option(\"singleCursorHeightPerLine\", true, updateSelection, true)\n        option(\"workTime\", 100)\n        option(\"workDelay\", 100)\n        option(\"flattenSpans\", true, resetModeState, true)\n        option(\"addModeClass\", false, resetModeState, true)\n        option(\"pollInterval\", 100)\n        option(\"undoDepth\", 200, function(cm, val) {\n            return (cm.doc.history.undoDepth = val)\n        })\n        option(\"historyEventDelay\", 1250)\n        option(\n            \"viewportMargin\",\n            10,\n            function(cm) {\n                return cm.refresh()\n            },\n            true\n        )\n        option(\"maxHighlightLength\", 10000, resetModeState, true)\n        option(\"moveInputWithCursor\", true, function(cm, val) {\n            if (!val) {\n                cm.display.input.resetPosition()\n            }\n        })\n\n        option(\"tabindex\", null, function(cm, val) {\n            return (cm.display.input.getField().tabIndex = val || \"\")\n        })\n        option(\"autofocus\", null)\n        option(\n            \"direction\",\n            \"ltr\",\n            function(cm, val) {\n                return cm.doc.setDirection(val)\n            },\n            true\n        )\n        option(\"phrases\", null)\n    }\n\n    function dragDropChanged(cm, value, old) {\n        var wasOn = old && old != Init\n        if (!value != !wasOn) {\n            var funcs = cm.display.dragFunctions\n            var toggle = value ? on : off\n            toggle(cm.display.scroller, \"dragstart\", funcs.start)\n            toggle(cm.display.scroller, \"dragenter\", funcs.enter)\n            toggle(cm.display.scroller, \"dragover\", funcs.over)\n            toggle(cm.display.scroller, \"dragleave\", funcs.leave)\n            toggle(cm.display.scroller, \"drop\", funcs.drop)\n        }\n    }\n\n    function wrappingChanged(cm) {\n        if (cm.options.lineWrapping) {\n            addClass(cm.display.wrapper, \"CodeMirror-wrap\")\n            cm.display.sizer.style.minWidth = \"\"\n            cm.display.sizerWidth = null\n        } else {\n            rmClass(cm.display.wrapper, \"CodeMirror-wrap\")\n            findMaxLine(cm)\n        }\n        estimateLineHeights(cm)\n        regChange(cm)\n        clearCaches(cm)\n        setTimeout(function() {\n            return updateScrollbars(cm)\n        }, 100)\n    }\n\n    // A CodeMirror instance represents an editor. This is the object\n    // that user code is usually dealing with.\n\n    function CodeMirror(place, options) {\n        var this$1 = this\n\n        if (!(this instanceof CodeMirror)) {\n            return new CodeMirror(place, options)\n        }\n\n        this.options = options = options ? copyObj(options) : {}\n        // Determine effective options based on given values and defaults.\n        copyObj(defaults, options, false)\n\n        var doc = options.value\n        if (typeof doc == \"string\") {\n            doc = new Doc(doc, options.mode, null, options.lineSeparator, options.direction)\n        } else if (options.mode) {\n            doc.modeOption = options.mode\n        }\n        this.doc = doc\n\n        var input = new CodeMirror.inputStyles[options.inputStyle](this)\n        var display = (this.display = new Display(place, doc, input, options))\n        display.wrapper.CodeMirror = this\n        themeChanged(this)\n        if (options.lineWrapping) {\n            this.display.wrapper.className += \" CodeMirror-wrap\"\n        }\n        initScrollbars(this)\n\n        this.state = {\n            keyMaps: [], // stores maps added by addKeyMap\n            overlays: [], // highlighting overlays, as added by addOverlay\n            modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info\n            overwrite: false,\n            delayingBlurEvent: false,\n            focused: false,\n            suppressEdits: false, // used to disable editing during key handlers when in readOnly mode\n            pasteIncoming: -1,\n            cutIncoming: -1, // help recognize paste/cut edits in input.poll\n            selectingText: false,\n            draggingText: false,\n            highlight: new Delayed(), // stores highlight worker timeout\n            keySeq: null, // Unfinished key sequence\n            specialChars: null\n        }\n\n        if (options.autofocus && !mobile) {\n            display.input.focus()\n        }\n\n        // Override magic textarea content restore that IE sometimes does\n        // on our hidden textarea on reload\n        if (ie && ie_version < 11) {\n            setTimeout(function() {\n                return this$1.display.input.reset(true)\n            }, 20)\n        }\n\n        registerEventHandlers(this)\n        ensureGlobalHandlers()\n\n        startOperation(this)\n        this.curOp.forceUpdate = true\n        attachDoc(this, doc)\n\n        if ((options.autofocus && !mobile) || this.hasFocus()) {\n            setTimeout(bind(onFocus, this), 20)\n        } else {\n            onBlur(this)\n        }\n\n        for (var opt in optionHandlers) {\n            if (optionHandlers.hasOwnProperty(opt)) {\n                optionHandlers[opt](this, options[opt], Init)\n            }\n        }\n        maybeUpdateLineNumberWidth(this)\n        if (options.finishInit) {\n            options.finishInit(this)\n        }\n        for (var i = 0; i < initHooks.length; ++i) {\n            initHooks[i](this)\n        }\n        endOperation(this)\n        // Suppress optimizelegibility in Webkit, since it breaks text\n        // measuring on line wrapping boundaries.\n        if (\n            webkit &&\n            options.lineWrapping &&\n            getComputedStyle(display.lineDiv).textRendering == \"optimizelegibility\"\n        ) {\n            display.lineDiv.style.textRendering = \"auto\"\n        }\n    }\n\n    // The default configuration options.\n    CodeMirror.defaults = defaults\n    // Functions to run when options are changed.\n    CodeMirror.optionHandlers = optionHandlers\n\n    // Attach the necessary event handlers when initializing the editor\n    function registerEventHandlers(cm) {\n        var d = cm.display\n        on(d.scroller, \"mousedown\", operation(cm, onMouseDown))\n        // Older IE's will not fire a second mousedown for a double click\n        if (ie && ie_version < 11) {\n            on(\n                d.scroller,\n                \"dblclick\",\n                operation(cm, function(e) {\n                    if (signalDOMEvent(cm, e)) {\n                        return\n                    }\n                    var pos = posFromMouse(cm, e)\n                    if (!pos || clickInGutter(cm, e) || eventInWidget(cm.display, e)) {\n                        return\n                    }\n                    e_preventDefault(e)\n                    var word = cm.findWordAt(pos)\n                    extendSelection(cm.doc, word.anchor, word.head)\n                })\n            )\n        } else {\n            on(d.scroller, \"dblclick\", function(e) {\n                return signalDOMEvent(cm, e) || e_preventDefault(e)\n            })\n        }\n        // Some browsers fire contextmenu *after* opening the menu, at\n        // which point we can't mess with it anymore. Context menu is\n        // handled in onMouseDown for these browsers.\n        on(d.scroller, \"contextmenu\", function(e) {\n            return onContextMenu(cm, e)\n        })\n        on(d.input.getField(), \"contextmenu\", function(e) {\n            if (!d.scroller.contains(e.target)) {\n                onContextMenu(cm, e)\n            }\n        })\n\n        // Used to suppress mouse event handling when a touch happens\n        var touchFinished,\n            prevTouch = { end: 0 }\n        function finishTouch() {\n            if (d.activeTouch) {\n                touchFinished = setTimeout(function() {\n                    return (d.activeTouch = null)\n                }, 1000)\n                prevTouch = d.activeTouch\n                prevTouch.end = +new Date()\n            }\n        }\n        function isMouseLikeTouchEvent(e) {\n            if (e.touches.length != 1) {\n                return false\n            }\n            var touch = e.touches[0]\n            return touch.radiusX <= 1 && touch.radiusY <= 1\n        }\n        function farAway(touch, other) {\n            if (other.left == null) {\n                return true\n            }\n            var dx = other.left - touch.left,\n                dy = other.top - touch.top\n            return dx * dx + dy * dy > 20 * 20\n        }\n        on(d.scroller, \"touchstart\", function(e) {\n            if (!signalDOMEvent(cm, e) && !isMouseLikeTouchEvent(e) && !clickInGutter(cm, e)) {\n                d.input.ensurePolled()\n                clearTimeout(touchFinished)\n                var now = +new Date()\n                d.activeTouch = {\n                    start: now,\n                    moved: false,\n                    prev: now - prevTouch.end <= 300 ? prevTouch : null\n                }\n                if (e.touches.length == 1) {\n                    d.activeTouch.left = e.touches[0].pageX\n                    d.activeTouch.top = e.touches[0].pageY\n                }\n            }\n        })\n        on(d.scroller, \"touchmove\", function() {\n            if (d.activeTouch) {\n                d.activeTouch.moved = true\n            }\n        })\n        on(d.scroller, \"touchend\", function(e) {\n            var touch = d.activeTouch\n            if (\n                touch &&\n                !eventInWidget(d, e) &&\n                touch.left != null &&\n                !touch.moved &&\n                new Date() - touch.start < 300\n            ) {\n                var pos = cm.coordsChar(d.activeTouch, \"page\"),\n                    range\n                if (!touch.prev || farAway(touch, touch.prev)) {\n                    // Single tap\n                    range = new Range(pos, pos)\n                } else if (!touch.prev.prev || farAway(touch, touch.prev.prev)) {\n                    // Double tap\n                    range = cm.findWordAt(pos)\n                } // Triple tap\n                else {\n                    range = new Range(Pos(pos.line, 0), clipPos(cm.doc, Pos(pos.line + 1, 0)))\n                }\n                cm.setSelection(range.anchor, range.head)\n                cm.focus()\n                e_preventDefault(e)\n            }\n            finishTouch()\n        })\n        on(d.scroller, \"touchcancel\", finishTouch)\n\n        // Sync scrolling between fake scrollbars and real scrollable\n        // area, ensure viewport is updated when scrolling.\n        on(d.scroller, \"scroll\", function() {\n            if (d.scroller.clientHeight) {\n                updateScrollTop(cm, d.scroller.scrollTop)\n                setScrollLeft(cm, d.scroller.scrollLeft, true)\n                signal(cm, \"scroll\", cm)\n            }\n        })\n\n        // Listen to wheel events in order to try and update the viewport on time.\n        on(d.scroller, \"mousewheel\", function(e) {\n            return onScrollWheel(cm, e)\n        })\n        on(d.scroller, \"DOMMouseScroll\", function(e) {\n            return onScrollWheel(cm, e)\n        })\n\n        // Prevent wrapper from ever scrolling\n        on(d.wrapper, \"scroll\", function() {\n            return (d.wrapper.scrollTop = d.wrapper.scrollLeft = 0)\n        })\n\n        d.dragFunctions = {\n            enter: function(e) {\n                if (!signalDOMEvent(cm, e)) {\n                    e_stop(e)\n                }\n            },\n            over: function(e) {\n                if (!signalDOMEvent(cm, e)) {\n                    onDragOver(cm, e)\n                    e_stop(e)\n                }\n            },\n            start: function(e) {\n                return onDragStart(cm, e)\n            },\n            drop: operation(cm, onDrop),\n            leave: function(e) {\n                if (!signalDOMEvent(cm, e)) {\n                    clearDragCursor(cm)\n                }\n            }\n        }\n\n        var inp = d.input.getField()\n        on(inp, \"keyup\", function(e) {\n            return onKeyUp.call(cm, e)\n        })\n        on(inp, \"keydown\", operation(cm, onKeyDown))\n        on(inp, \"keypress\", operation(cm, onKeyPress))\n        on(inp, \"focus\", function(e) {\n            return onFocus(cm, e)\n        })\n        on(inp, \"blur\", function(e) {\n            return onBlur(cm, e)\n        })\n    }\n\n    var initHooks = []\n    CodeMirror.defineInitHook = function(f) {\n        return initHooks.push(f)\n    }\n\n    // Indent the given line. The how parameter can be \"smart\",\n    // \"add\"/null, \"subtract\", or \"prev\". When aggressive is false\n    // (typically set to true for forced single-line indents), empty\n    // lines are not indented, and places where the mode returns Pass\n    // are left alone.\n    function indentLine(cm, n, how, aggressive) {\n        var doc = cm.doc,\n            state\n        if (how == null) {\n            how = \"add\"\n        }\n        if (how == \"smart\") {\n            // Fall back to \"prev\" when the mode doesn't have an indentation\n            // method.\n            if (!doc.mode.indent) {\n                how = \"prev\"\n            } else {\n                state = getContextBefore(cm, n).state\n            }\n        }\n\n        var tabSize = cm.options.tabSize\n        var line = getLine(doc, n),\n            curSpace = countColumn(line.text, null, tabSize)\n        if (line.stateAfter) {\n            line.stateAfter = null\n        }\n        var curSpaceString = line.text.match(/^\\s*/)[0],\n            indentation\n        if (!aggressive && !/\\S/.test(line.text)) {\n            indentation = 0\n            how = \"not\"\n        } else if (how == \"smart\") {\n            indentation = doc.mode.indent(state, line.text.slice(curSpaceString.length), line.text)\n            if (indentation == Pass || indentation > 150) {\n                if (!aggressive) {\n                    return\n                }\n                how = \"prev\"\n            }\n        }\n        if (how == \"prev\") {\n            if (n > doc.first) {\n                indentation = countColumn(getLine(doc, n - 1).text, null, tabSize)\n            } else {\n                indentation = 0\n            }\n        } else if (how == \"add\") {\n            indentation = curSpace + cm.options.indentUnit\n        } else if (how == \"subtract\") {\n            indentation = curSpace - cm.options.indentUnit\n        } else if (typeof how == \"number\") {\n            indentation = curSpace + how\n        }\n        indentation = Math.max(0, indentation)\n\n        var indentString = \"\",\n            pos = 0\n        if (cm.options.indentWithTabs) {\n            for (var i = Math.floor(indentation / tabSize); i; --i) {\n                pos += tabSize\n                indentString += \"\\t\"\n            }\n        }\n        if (pos < indentation) {\n            indentString += spaceStr(indentation - pos)\n        }\n\n        if (indentString != curSpaceString) {\n            replaceRange(doc, indentString, Pos(n, 0), Pos(n, curSpaceString.length), \"+input\")\n            line.stateAfter = null\n            return true\n        } else {\n            // Ensure that, if the cursor was in the whitespace at the start\n            // of the line, it is moved to the end of that space.\n            for (var i$1 = 0; i$1 < doc.sel.ranges.length; i$1++) {\n                var range = doc.sel.ranges[i$1]\n                if (range.head.line == n && range.head.ch < curSpaceString.length) {\n                    var pos$1 = Pos(n, curSpaceString.length)\n                    replaceOneSelection(doc, i$1, new Range(pos$1, pos$1))\n                    break\n                }\n            }\n        }\n    }\n\n    // This will be set to a {lineWise: bool, text: [string]} object, so\n    // that, when pasting, we know what kind of selections the copied\n    // text was made out of.\n    var lastCopied = null\n\n    function setLastCopied(newLastCopied) {\n        lastCopied = newLastCopied\n    }\n\n    function applyTextInput(cm, inserted, deleted, sel, origin) {\n        var doc = cm.doc\n        cm.display.shift = false\n        if (!sel) {\n            sel = doc.sel\n        }\n\n        var recent = +new Date() - 200\n        var paste = origin == \"paste\" || cm.state.pasteIncoming > recent\n        var textLines = splitLinesAuto(inserted),\n            multiPaste = null\n        // When pasting N lines into N selections, insert one line per selection\n        if (paste && sel.ranges.length > 1) {\n            if (lastCopied && lastCopied.text.join(\"\\n\") == inserted) {\n                if (sel.ranges.length % lastCopied.text.length == 0) {\n                    multiPaste = []\n                    for (var i = 0; i < lastCopied.text.length; i++) {\n                        multiPaste.push(doc.splitLines(lastCopied.text[i]))\n                    }\n                }\n            } else if (textLines.length == sel.ranges.length && cm.options.pasteLinesPerSelection) {\n                multiPaste = map(textLines, function(l) {\n                    return [l]\n                })\n            }\n        }\n\n        var updateInput = cm.curOp.updateInput\n        // Normal behavior is to insert the new text into every selection\n        for (var i$1 = sel.ranges.length - 1; i$1 >= 0; i$1--) {\n            var range = sel.ranges[i$1]\n            var from = range.from(),\n                to = range.to()\n            if (range.empty()) {\n                if (deleted && deleted > 0) {\n                    // Handle deletion\n                    from = Pos(from.line, from.ch - deleted)\n                } else if (cm.state.overwrite && !paste) {\n                    // Handle overwrite\n                    to = Pos(\n                        to.line,\n                        Math.min(getLine(doc, to.line).text.length, to.ch + lst(textLines).length)\n                    )\n                } else if (\n                    paste &&\n                    lastCopied &&\n                    lastCopied.lineWise &&\n                    lastCopied.text.join(\"\\n\") == inserted\n                ) {\n                    from = to = Pos(from.line, 0)\n                }\n            }\n            var changeEvent = {\n                from: from,\n                to: to,\n                text: multiPaste ? multiPaste[i$1 % multiPaste.length] : textLines,\n                origin:\n                    origin || (paste ? \"paste\" : cm.state.cutIncoming > recent ? \"cut\" : \"+input\")\n            }\n            makeChange(cm.doc, changeEvent)\n            signalLater(cm, \"inputRead\", cm, changeEvent)\n        }\n        if (inserted && !paste) {\n            triggerElectric(cm, inserted)\n        }\n\n        ensureCursorVisible(cm)\n        if (cm.curOp.updateInput < 2) {\n            cm.curOp.updateInput = updateInput\n        }\n        cm.curOp.typing = true\n        cm.state.pasteIncoming = cm.state.cutIncoming = -1\n    }\n\n    function handlePaste(e, cm) {\n        var pasted = e.clipboardData && e.clipboardData.getData(\"Text\")\n        if (pasted) {\n            e.preventDefault()\n            if (!cm.isReadOnly() && !cm.options.disableInput) {\n                runInOp(cm, function() {\n                    return applyTextInput(cm, pasted, 0, null, \"paste\")\n                })\n            }\n            return true\n        }\n    }\n\n    function triggerElectric(cm, inserted) {\n        // When an 'electric' character is inserted, immediately trigger a reindent\n        if (!cm.options.electricChars || !cm.options.smartIndent) {\n            return\n        }\n        var sel = cm.doc.sel\n\n        for (var i = sel.ranges.length - 1; i >= 0; i--) {\n            var range = sel.ranges[i]\n            if (range.head.ch > 100 || (i && sel.ranges[i - 1].head.line == range.head.line)) {\n                continue\n            }\n            var mode = cm.getModeAt(range.head)\n            var indented = false\n            if (mode.electricChars) {\n                for (var j = 0; j < mode.electricChars.length; j++) {\n                    if (inserted.indexOf(mode.electricChars.charAt(j)) > -1) {\n                        indented = indentLine(cm, range.head.line, \"smart\")\n                        break\n                    }\n                }\n            } else if (mode.electricInput) {\n                if (\n                    mode.electricInput.test(\n                        getLine(cm.doc, range.head.line).text.slice(0, range.head.ch)\n                    )\n                ) {\n                    indented = indentLine(cm, range.head.line, \"smart\")\n                }\n            }\n            if (indented) {\n                signalLater(cm, \"electricInput\", cm, range.head.line)\n            }\n        }\n    }\n\n    function copyableRanges(cm) {\n        var text = [],\n            ranges = []\n        for (var i = 0; i < cm.doc.sel.ranges.length; i++) {\n            var line = cm.doc.sel.ranges[i].head.line\n            var lineRange = { anchor: Pos(line, 0), head: Pos(line + 1, 0) }\n            ranges.push(lineRange)\n            text.push(cm.getRange(lineRange.anchor, lineRange.head))\n        }\n        return { text: text, ranges: ranges }\n    }\n\n    function disableBrowserMagic(field, spellcheck, autocorrect, autocapitalize) {\n        field.setAttribute(\"autocorrect\", autocorrect ? \"\" : \"off\")\n        field.setAttribute(\"autocapitalize\", autocapitalize ? \"\" : \"off\")\n        field.setAttribute(\"spellcheck\", !!spellcheck)\n    }\n\n    function hiddenTextarea() {\n        var te = elt(\n            \"textarea\",\n            null,\n            null,\n            \"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none\"\n        )\n        var div = elt(\n            \"div\",\n            [te],\n            null,\n            \"overflow: hidden; position: relative; width: 3px; height: 0px;\"\n        )\n        // The textarea is kept positioned near the cursor to prevent the\n        // fact that it'll be scrolled into view on input from scrolling\n        // our fake cursor out of view. On webkit, when wrap=off, paste is\n        // very slow. So make the area wide instead.\n        if (webkit) {\n            te.style.width = \"1000px\"\n        } else {\n            te.setAttribute(\"wrap\", \"off\")\n        }\n        // If border: 0; -- iOS fails to open keyboard (issue #1287)\n        if (ios) {\n            te.style.border = \"1px solid black\"\n        }\n        disableBrowserMagic(te)\n        return div\n    }\n\n    // The publicly visible API. Note that methodOp(f) means\n    // 'wrap f in an operation, performed on its `this` parameter'.\n\n    // This is not the complete set of editor methods. Most of the\n    // methods defined on the Doc type are also injected into\n    // CodeMirror.prototype, for backwards compatibility and\n    // convenience.\n\n    function addEditorMethods(CodeMirror) {\n        var optionHandlers = CodeMirror.optionHandlers\n\n        var helpers = (CodeMirror.helpers = {})\n\n        CodeMirror.prototype = {\n            constructor: CodeMirror,\n            focus: function() {\n                window.focus()\n                this.display.input.focus()\n            },\n\n            setOption: function(option, value) {\n                var options = this.options,\n                    old = options[option]\n                if (options[option] == value && option != \"mode\") {\n                    return\n                }\n                options[option] = value\n                if (optionHandlers.hasOwnProperty(option)) {\n                    operation(this, optionHandlers[option])(this, value, old)\n                }\n                signal(this, \"optionChange\", this, option)\n            },\n\n            getOption: function(option) {\n                return this.options[option]\n            },\n            getDoc: function() {\n                return this.doc\n            },\n\n            addKeyMap: function(map, bottom) {\n                this.state.keyMaps[bottom ? \"push\" : \"unshift\"](getKeyMap(map))\n            },\n            removeKeyMap: function(map) {\n                var maps = this.state.keyMaps\n                for (var i = 0; i < maps.length; ++i) {\n                    if (maps[i] == map || maps[i].name == map) {\n                        maps.splice(i, 1)\n                        return true\n                    }\n                }\n            },\n\n            addOverlay: methodOp(function(spec, options) {\n                var mode = spec.token ? spec : CodeMirror.getMode(this.options, spec)\n                if (mode.startState) {\n                    throw new Error(\"Overlays may not be stateful.\")\n                }\n                insertSorted(\n                    this.state.overlays,\n                    {\n                        mode: mode,\n                        modeSpec: spec,\n                        opaque: options && options.opaque,\n                        priority: (options && options.priority) || 0\n                    },\n                    function(overlay) {\n                        return overlay.priority\n                    }\n                )\n                this.state.modeGen++\n                regChange(this)\n            }),\n            removeOverlay: methodOp(function(spec) {\n                var overlays = this.state.overlays\n                for (var i = 0; i < overlays.length; ++i) {\n                    var cur = overlays[i].modeSpec\n                    if (cur == spec || (typeof spec == \"string\" && cur.name == spec)) {\n                        overlays.splice(i, 1)\n                        this.state.modeGen++\n                        regChange(this)\n                        return\n                    }\n                }\n            }),\n\n            indentLine: methodOp(function(n, dir, aggressive) {\n                if (typeof dir != \"string\" && typeof dir != \"number\") {\n                    if (dir == null) {\n                        dir = this.options.smartIndent ? \"smart\" : \"prev\"\n                    } else {\n                        dir = dir ? \"add\" : \"subtract\"\n                    }\n                }\n                if (isLine(this.doc, n)) {\n                    indentLine(this, n, dir, aggressive)\n                }\n            }),\n            indentSelection: methodOp(function(how) {\n                var ranges = this.doc.sel.ranges,\n                    end = -1\n                for (var i = 0; i < ranges.length; i++) {\n                    var range = ranges[i]\n                    if (!range.empty()) {\n                        var from = range.from(),\n                            to = range.to()\n                        var start = Math.max(end, from.line)\n                        end = Math.min(this.lastLine(), to.line - (to.ch ? 0 : 1)) + 1\n                        for (var j = start; j < end; ++j) {\n                            indentLine(this, j, how)\n                        }\n                        var newRanges = this.doc.sel.ranges\n                        if (\n                            from.ch == 0 &&\n                            ranges.length == newRanges.length &&\n                            newRanges[i].from().ch > 0\n                        ) {\n                            replaceOneSelection(\n                                this.doc,\n                                i,\n                                new Range(from, newRanges[i].to()),\n                                sel_dontScroll\n                            )\n                        }\n                    } else if (range.head.line > end) {\n                        indentLine(this, range.head.line, how, true)\n                        end = range.head.line\n                        if (i == this.doc.sel.primIndex) {\n                            ensureCursorVisible(this)\n                        }\n                    }\n                }\n            }),\n\n            // Fetch the parser token for a given character. Useful for hacks\n            // that want to inspect the mode state (say, for completion).\n            getTokenAt: function(pos, precise) {\n                return takeToken(this, pos, precise)\n            },\n\n            getLineTokens: function(line, precise) {\n                return takeToken(this, Pos(line), precise, true)\n            },\n\n            getTokenTypeAt: function(pos) {\n                pos = clipPos(this.doc, pos)\n                var styles = getLineStyles(this, getLine(this.doc, pos.line))\n                var before = 0,\n                    after = (styles.length - 1) / 2,\n                    ch = pos.ch\n                var type\n                if (ch == 0) {\n                    type = styles[2]\n                } else {\n                    for (;;) {\n                        var mid = (before + after) >> 1\n                        if ((mid ? styles[mid * 2 - 1] : 0) >= ch) {\n                            after = mid\n                        } else if (styles[mid * 2 + 1] < ch) {\n                            before = mid + 1\n                        } else {\n                            type = styles[mid * 2 + 2]\n                            break\n                        }\n                    }\n                }\n                var cut = type ? type.indexOf(\"overlay \") : -1\n                return cut < 0 ? type : cut == 0 ? null : type.slice(0, cut - 1)\n            },\n\n            getModeAt: function(pos) {\n                var mode = this.doc.mode\n                if (!mode.innerMode) {\n                    return mode\n                }\n                return CodeMirror.innerMode(mode, this.getTokenAt(pos).state).mode\n            },\n\n            getHelper: function(pos, type) {\n                return this.getHelpers(pos, type)[0]\n            },\n\n            getHelpers: function(pos, type) {\n                var found = []\n                if (!helpers.hasOwnProperty(type)) {\n                    return found\n                }\n                var help = helpers[type],\n                    mode = this.getModeAt(pos)\n                if (typeof mode[type] == \"string\") {\n                    if (help[mode[type]]) {\n                        found.push(help[mode[type]])\n                    }\n                } else if (mode[type]) {\n                    for (var i = 0; i < mode[type].length; i++) {\n                        var val = help[mode[type][i]]\n                        if (val) {\n                            found.push(val)\n                        }\n                    }\n                } else if (mode.helperType && help[mode.helperType]) {\n                    found.push(help[mode.helperType])\n                } else if (help[mode.name]) {\n                    found.push(help[mode.name])\n                }\n                for (var i$1 = 0; i$1 < help._global.length; i$1++) {\n                    var cur = help._global[i$1]\n                    if (cur.pred(mode, this) && indexOf(found, cur.val) == -1) {\n                        found.push(cur.val)\n                    }\n                }\n                return found\n            },\n\n            getStateAfter: function(line, precise) {\n                var doc = this.doc\n                line = clipLine(doc, line == null ? doc.first + doc.size - 1 : line)\n                return getContextBefore(this, line + 1, precise).state\n            },\n\n            cursorCoords: function(start, mode) {\n                var pos,\n                    range = this.doc.sel.primary()\n                if (start == null) {\n                    pos = range.head\n                } else if (typeof start == \"object\") {\n                    pos = clipPos(this.doc, start)\n                } else {\n                    pos = start ? range.from() : range.to()\n                }\n                return cursorCoords(this, pos, mode || \"page\")\n            },\n\n            charCoords: function(pos, mode) {\n                return charCoords(this, clipPos(this.doc, pos), mode || \"page\")\n            },\n\n            coordsChar: function(coords, mode) {\n                coords = fromCoordSystem(this, coords, mode || \"page\")\n                return coordsChar(this, coords.left, coords.top)\n            },\n\n            lineAtHeight: function(height, mode) {\n                height = fromCoordSystem(this, { top: height, left: 0 }, mode || \"page\").top\n                return lineAtHeight(this.doc, height + this.display.viewOffset)\n            },\n            heightAtLine: function(line, mode, includeWidgets) {\n                var end = false,\n                    lineObj\n                if (typeof line == \"number\") {\n                    var last = this.doc.first + this.doc.size - 1\n                    if (line < this.doc.first) {\n                        line = this.doc.first\n                    } else if (line > last) {\n                        line = last\n                        end = true\n                    }\n                    lineObj = getLine(this.doc, line)\n                } else {\n                    lineObj = line\n                }\n                return (\n                    intoCoordSystem(\n                        this,\n                        lineObj,\n                        { top: 0, left: 0 },\n                        mode || \"page\",\n                        includeWidgets || end\n                    ).top + (end ? this.doc.height - heightAtLine(lineObj) : 0)\n                )\n            },\n\n            defaultTextHeight: function() {\n                return textHeight(this.display)\n            },\n            defaultCharWidth: function() {\n                return charWidth(this.display)\n            },\n\n            getViewport: function() {\n                return { from: this.display.viewFrom, to: this.display.viewTo }\n            },\n\n            addWidget: function(pos, node, scroll, vert, horiz) {\n                var display = this.display\n                pos = cursorCoords(this, clipPos(this.doc, pos))\n                var top = pos.bottom,\n                    left = pos.left\n                node.style.position = \"absolute\"\n                node.setAttribute(\"cm-ignore-events\", \"true\")\n                this.display.input.setUneditable(node)\n                display.sizer.appendChild(node)\n                if (vert == \"over\") {\n                    top = pos.top\n                } else if (vert == \"above\" || vert == \"near\") {\n                    var vspace = Math.max(display.wrapper.clientHeight, this.doc.height),\n                        hspace = Math.max(display.sizer.clientWidth, display.lineSpace.clientWidth)\n                    // Default to positioning above (if specified and possible); otherwise default to positioning below\n                    if (\n                        (vert == \"above\" || pos.bottom + node.offsetHeight > vspace) &&\n                        pos.top > node.offsetHeight\n                    ) {\n                        top = pos.top - node.offsetHeight\n                    } else if (pos.bottom + node.offsetHeight <= vspace) {\n                        top = pos.bottom\n                    }\n                    if (left + node.offsetWidth > hspace) {\n                        left = hspace - node.offsetWidth\n                    }\n                }\n                node.style.top = top + \"px\"\n                node.style.left = node.style.right = \"\"\n                if (horiz == \"right\") {\n                    left = display.sizer.clientWidth - node.offsetWidth\n                    node.style.right = \"0px\"\n                } else {\n                    if (horiz == \"left\") {\n                        left = 0\n                    } else if (horiz == \"middle\") {\n                        left = (display.sizer.clientWidth - node.offsetWidth) / 2\n                    }\n                    node.style.left = left + \"px\"\n                }\n                if (scroll) {\n                    scrollIntoView(this, {\n                        left: left,\n                        top: top,\n                        right: left + node.offsetWidth,\n                        bottom: top + node.offsetHeight\n                    })\n                }\n            },\n\n            triggerOnKeyDown: methodOp(onKeyDown),\n            triggerOnKeyPress: methodOp(onKeyPress),\n            triggerOnKeyUp: onKeyUp,\n            triggerOnMouseDown: methodOp(onMouseDown),\n\n            execCommand: function(cmd) {\n                if (commands.hasOwnProperty(cmd)) {\n                    return commands[cmd].call(null, this)\n                }\n            },\n\n            triggerElectric: methodOp(function(text) {\n                triggerElectric(this, text)\n            }),\n\n            findPosH: function(from, amount, unit, visually) {\n                var dir = 1\n                if (amount < 0) {\n                    dir = -1\n                    amount = -amount\n                }\n                var cur = clipPos(this.doc, from)\n                for (var i = 0; i < amount; ++i) {\n                    cur = findPosH(this.doc, cur, dir, unit, visually)\n                    if (cur.hitSide) {\n                        break\n                    }\n                }\n                return cur\n            },\n\n            moveH: methodOp(function(dir, unit) {\n                var this$1 = this\n\n                this.extendSelectionsBy(function(range) {\n                    if (this$1.display.shift || this$1.doc.extend || range.empty()) {\n                        return findPosH(\n                            this$1.doc,\n                            range.head,\n                            dir,\n                            unit,\n                            this$1.options.rtlMoveVisually\n                        )\n                    } else {\n                        return dir < 0 ? range.from() : range.to()\n                    }\n                }, sel_move)\n            }),\n\n            deleteH: methodOp(function(dir, unit) {\n                var sel = this.doc.sel,\n                    doc = this.doc\n                if (sel.somethingSelected()) {\n                    doc.replaceSelection(\"\", null, \"+delete\")\n                } else {\n                    deleteNearSelection(this, function(range) {\n                        var other = findPosH(doc, range.head, dir, unit, false)\n                        return dir < 0\n                            ? { from: other, to: range.head }\n                            : { from: range.head, to: other }\n                    })\n                }\n            }),\n\n            findPosV: function(from, amount, unit, goalColumn) {\n                var dir = 1,\n                    x = goalColumn\n                if (amount < 0) {\n                    dir = -1\n                    amount = -amount\n                }\n                var cur = clipPos(this.doc, from)\n                for (var i = 0; i < amount; ++i) {\n                    var coords = cursorCoords(this, cur, \"div\")\n                    if (x == null) {\n                        x = coords.left\n                    } else {\n                        coords.left = x\n                    }\n                    cur = findPosV(this, coords, dir, unit)\n                    if (cur.hitSide) {\n                        break\n                    }\n                }\n                return cur\n            },\n\n            moveV: methodOp(function(dir, unit) {\n                var this$1 = this\n\n                var doc = this.doc,\n                    goals = []\n                var collapse = !this.display.shift && !doc.extend && doc.sel.somethingSelected()\n                doc.extendSelectionsBy(function(range) {\n                    if (collapse) {\n                        return dir < 0 ? range.from() : range.to()\n                    }\n                    var headPos = cursorCoords(this$1, range.head, \"div\")\n                    if (range.goalColumn != null) {\n                        headPos.left = range.goalColumn\n                    }\n                    goals.push(headPos.left)\n                    var pos = findPosV(this$1, headPos, dir, unit)\n                    if (unit == \"page\" && range == doc.sel.primary()) {\n                        addToScrollTop(this$1, charCoords(this$1, pos, \"div\").top - headPos.top)\n                    }\n                    return pos\n                }, sel_move)\n                if (goals.length) {\n                    for (var i = 0; i < doc.sel.ranges.length; i++) {\n                        doc.sel.ranges[i].goalColumn = goals[i]\n                    }\n                }\n            }),\n\n            // Find the word at the given position (as returned by coordsChar).\n            findWordAt: function(pos) {\n                var doc = this.doc,\n                    line = getLine(doc, pos.line).text\n                var start = pos.ch,\n                    end = pos.ch\n                if (line) {\n                    var helper = this.getHelper(pos, \"wordChars\")\n                    if ((pos.sticky == \"before\" || end == line.length) && start) {\n                        --start\n                    } else {\n                        ++end\n                    }\n                    var startChar = line.charAt(start)\n                    var check = isWordChar(startChar, helper)\n                        ? function(ch) {\n                              return isWordChar(ch, helper)\n                          }\n                        : /\\s/.test(startChar)\n                        ? function(ch) {\n                              return /\\s/.test(ch)\n                          }\n                        : function(ch) {\n                              return !/\\s/.test(ch) && !isWordChar(ch)\n                          }\n                    while (start > 0 && check(line.charAt(start - 1))) {\n                        --start\n                    }\n                    while (end < line.length && check(line.charAt(end))) {\n                        ++end\n                    }\n                }\n                return new Range(Pos(pos.line, start), Pos(pos.line, end))\n            },\n\n            toggleOverwrite: function(value) {\n                if (value != null && value == this.state.overwrite) {\n                    return\n                }\n                if ((this.state.overwrite = !this.state.overwrite)) {\n                    addClass(this.display.cursorDiv, \"CodeMirror-overwrite\")\n                } else {\n                    rmClass(this.display.cursorDiv, \"CodeMirror-overwrite\")\n                }\n\n                signal(this, \"overwriteToggle\", this, this.state.overwrite)\n            },\n            hasFocus: function() {\n                return this.display.input.getField() == activeElt()\n            },\n            isReadOnly: function() {\n                return !!(this.options.readOnly || this.doc.cantEdit)\n            },\n\n            scrollTo: methodOp(function(x, y) {\n                scrollToCoords(this, x, y)\n            }),\n            getScrollInfo: function() {\n                var scroller = this.display.scroller\n                return {\n                    left: scroller.scrollLeft,\n                    top: scroller.scrollTop,\n                    height: scroller.scrollHeight - scrollGap(this) - this.display.barHeight,\n                    width: scroller.scrollWidth - scrollGap(this) - this.display.barWidth,\n                    clientHeight: displayHeight(this),\n                    clientWidth: displayWidth(this)\n                }\n            },\n\n            scrollIntoView: methodOp(function(range, margin) {\n                if (range == null) {\n                    range = { from: this.doc.sel.primary().head, to: null }\n                    if (margin == null) {\n                        margin = this.options.cursorScrollMargin\n                    }\n                } else if (typeof range == \"number\") {\n                    range = { from: Pos(range, 0), to: null }\n                } else if (range.from == null) {\n                    range = { from: range, to: null }\n                }\n                if (!range.to) {\n                    range.to = range.from\n                }\n                range.margin = margin || 0\n\n                if (range.from.line != null) {\n                    scrollToRange(this, range)\n                } else {\n                    scrollToCoordsRange(this, range.from, range.to, range.margin)\n                }\n            }),\n\n            setSize: methodOp(function(width, height) {\n                var this$1 = this\n\n                var interpret = function(val) {\n                    return typeof val == \"number\" || /^\\d+$/.test(String(val)) ? val + \"px\" : val\n                }\n                if (width != null) {\n                    this.display.wrapper.style.width = interpret(width)\n                }\n                if (height != null) {\n                    this.display.wrapper.style.height = interpret(height)\n                }\n                if (this.options.lineWrapping) {\n                    clearLineMeasurementCache(this)\n                }\n                var lineNo = this.display.viewFrom\n                this.doc.iter(lineNo, this.display.viewTo, function(line) {\n                    if (line.widgets) {\n                        for (var i = 0; i < line.widgets.length; i++) {\n                            if (line.widgets[i].noHScroll) {\n                                regLineChange(this$1, lineNo, \"widget\")\n                                break\n                            }\n                        }\n                    }\n                    ++lineNo\n                })\n                this.curOp.forceUpdate = true\n                signal(this, \"refresh\", this)\n            }),\n\n            operation: function(f) {\n                return runInOp(this, f)\n            },\n            startOperation: function() {\n                return startOperation(this)\n            },\n            endOperation: function() {\n                return endOperation(this)\n            },\n\n            refresh: methodOp(function() {\n                var oldHeight = this.display.cachedTextHeight\n                regChange(this)\n                this.curOp.forceUpdate = true\n                clearCaches(this)\n                scrollToCoords(this, this.doc.scrollLeft, this.doc.scrollTop)\n                updateGutterSpace(this.display)\n                if (oldHeight == null || Math.abs(oldHeight - textHeight(this.display)) > 0.5) {\n                    estimateLineHeights(this)\n                }\n                signal(this, \"refresh\", this)\n            }),\n\n            swapDoc: methodOp(function(doc) {\n                var old = this.doc\n                old.cm = null\n                // Cancel the current text selection if any (#5821)\n                if (this.state.selectingText) {\n                    this.state.selectingText()\n                }\n                attachDoc(this, doc)\n                clearCaches(this)\n                this.display.input.reset()\n                scrollToCoords(this, doc.scrollLeft, doc.scrollTop)\n                this.curOp.forceScroll = true\n                signalLater(this, \"swapDoc\", this, old)\n                return old\n            }),\n\n            phrase: function(phraseText) {\n                var phrases = this.options.phrases\n                return phrases && Object.prototype.hasOwnProperty.call(phrases, phraseText)\n                    ? phrases[phraseText]\n                    : phraseText\n            },\n\n            getInputField: function() {\n                return this.display.input.getField()\n            },\n            getWrapperElement: function() {\n                return this.display.wrapper\n            },\n            getScrollerElement: function() {\n                return this.display.scroller\n            },\n            getGutterElement: function() {\n                return this.display.gutters\n            }\n        }\n        eventMixin(CodeMirror)\n\n        CodeMirror.registerHelper = function(type, name, value) {\n            if (!helpers.hasOwnProperty(type)) {\n                helpers[type] = CodeMirror[type] = { _global: [] }\n            }\n            helpers[type][name] = value\n        }\n        CodeMirror.registerGlobalHelper = function(type, name, predicate, value) {\n            CodeMirror.registerHelper(type, name, value)\n            helpers[type]._global.push({ pred: predicate, val: value })\n        }\n    }\n\n    // Used for horizontal relative motion. Dir is -1 or 1 (left or\n    // right), unit can be \"char\", \"column\" (like char, but doesn't\n    // cross line boundaries), \"word\" (across next word), or \"group\" (to\n    // the start of next group of word or non-word-non-whitespace\n    // chars). The visually param controls whether, in right-to-left\n    // text, direction 1 means to move towards the next index in the\n    // string, or towards the character to the right of the current\n    // position. The resulting position will have a hitSide=true\n    // property if it reached the end of the document.\n    function findPosH(doc, pos, dir, unit, visually) {\n        var oldPos = pos\n        var origDir = dir\n        var lineObj = getLine(doc, pos.line)\n        var lineDir = visually && doc.direction == \"rtl\" ? -dir : dir\n        function findNextLine() {\n            var l = pos.line + lineDir\n            if (l < doc.first || l >= doc.first + doc.size) {\n                return false\n            }\n            pos = new Pos(l, pos.ch, pos.sticky)\n            return (lineObj = getLine(doc, l))\n        }\n        function moveOnce(boundToLine) {\n            var next\n            if (visually) {\n                next = moveVisually(doc.cm, lineObj, pos, dir)\n            } else {\n                next = moveLogically(lineObj, pos, dir)\n            }\n            if (next == null) {\n                if (!boundToLine && findNextLine()) {\n                    pos = endOfLine(visually, doc.cm, lineObj, pos.line, lineDir)\n                } else {\n                    return false\n                }\n            } else {\n                pos = next\n            }\n            return true\n        }\n\n        if (unit == \"char\") {\n            moveOnce()\n        } else if (unit == \"column\") {\n            moveOnce(true)\n        } else if (unit == \"word\" || unit == \"group\") {\n            var sawType = null,\n                group = unit == \"group\"\n            var helper = doc.cm && doc.cm.getHelper(pos, \"wordChars\")\n            for (var first = true; ; first = false) {\n                if (dir < 0 && !moveOnce(!first)) {\n                    break\n                }\n                var cur = lineObj.text.charAt(pos.ch) || \"\\n\"\n                var type = isWordChar(cur, helper)\n                    ? \"w\"\n                    : group && cur == \"\\n\"\n                    ? \"n\"\n                    : !group || /\\s/.test(cur)\n                    ? null\n                    : \"p\"\n                if (group && !first && !type) {\n                    type = \"s\"\n                }\n                if (sawType && sawType != type) {\n                    if (dir < 0) {\n                        dir = 1\n                        moveOnce()\n                        pos.sticky = \"after\"\n                    }\n                    break\n                }\n\n                if (type) {\n                    sawType = type\n                }\n                if (dir > 0 && !moveOnce(!first)) {\n                    break\n                }\n            }\n        }\n        var result = skipAtomic(doc, pos, oldPos, origDir, true)\n        if (equalCursorPos(oldPos, result)) {\n            result.hitSide = true\n        }\n        return result\n    }\n\n    // For relative vertical movement. Dir may be -1 or 1. Unit can be\n    // \"page\" or \"line\". The resulting position will have a hitSide=true\n    // property if it reached the end of the document.\n    function findPosV(cm, pos, dir, unit) {\n        var doc = cm.doc,\n            x = pos.left,\n            y\n        if (unit == \"page\") {\n            var pageSize = Math.min(\n                cm.display.wrapper.clientHeight,\n                window.innerHeight || document.documentElement.clientHeight\n            )\n            var moveAmount = Math.max(pageSize - 0.5 * textHeight(cm.display), 3)\n            y = (dir > 0 ? pos.bottom : pos.top) + dir * moveAmount\n        } else if (unit == \"line\") {\n            y = dir > 0 ? pos.bottom + 3 : pos.top - 3\n        }\n        var target\n        for (;;) {\n            target = coordsChar(cm, x, y)\n            if (!target.outside) {\n                break\n            }\n            if (dir < 0 ? y <= 0 : y >= doc.height) {\n                target.hitSide = true\n                break\n            }\n            y += dir * 5\n        }\n        return target\n    }\n\n    // CONTENTEDITABLE INPUT STYLE\n\n    var ContentEditableInput = function(cm) {\n        this.cm = cm\n        this.lastAnchorNode = this.lastAnchorOffset = this.lastFocusNode = this.lastFocusOffset = null\n        this.polling = new Delayed()\n        this.composing = null\n        this.gracePeriod = false\n        this.readDOMTimeout = null\n    }\n\n    ContentEditableInput.prototype.init = function(display) {\n        var this$1 = this\n\n        var input = this,\n            cm = input.cm\n        var div = (input.div = display.lineDiv)\n        disableBrowserMagic(\n            div,\n            cm.options.spellcheck,\n            cm.options.autocorrect,\n            cm.options.autocapitalize\n        )\n\n        on(div, \"paste\", function(e) {\n            if (signalDOMEvent(cm, e) || handlePaste(e, cm)) {\n                return\n            }\n            // IE doesn't fire input events, so we schedule a read for the pasted content in this way\n            if (ie_version <= 11) {\n                setTimeout(\n                    operation(cm, function() {\n                        return this$1.updateFromDOM()\n                    }),\n                    20\n                )\n            }\n        })\n\n        on(div, \"compositionstart\", function(e) {\n            this$1.composing = { data: e.data, done: false }\n        })\n        on(div, \"compositionupdate\", function(e) {\n            if (!this$1.composing) {\n                this$1.composing = { data: e.data, done: false }\n            }\n        })\n        on(div, \"compositionend\", function(e) {\n            if (this$1.composing) {\n                if (e.data != this$1.composing.data) {\n                    this$1.readFromDOMSoon()\n                }\n                this$1.composing.done = true\n            }\n        })\n\n        on(div, \"touchstart\", function() {\n            return input.forceCompositionEnd()\n        })\n\n        on(div, \"input\", function() {\n            if (!this$1.composing) {\n                this$1.readFromDOMSoon()\n            }\n        })\n\n        function onCopyCut(e) {\n            if (signalDOMEvent(cm, e)) {\n                return\n            }\n            if (cm.somethingSelected()) {\n                setLastCopied({ lineWise: false, text: cm.getSelections() })\n                if (e.type == \"cut\") {\n                    cm.replaceSelection(\"\", null, \"cut\")\n                }\n            } else if (!cm.options.lineWiseCopyCut) {\n                return\n            } else {\n                var ranges = copyableRanges(cm)\n                setLastCopied({ lineWise: true, text: ranges.text })\n                if (e.type == \"cut\") {\n                    cm.operation(function() {\n                        cm.setSelections(ranges.ranges, 0, sel_dontScroll)\n                        cm.replaceSelection(\"\", null, \"cut\")\n                    })\n                }\n            }\n            if (e.clipboardData) {\n                e.clipboardData.clearData()\n                var content = lastCopied.text.join(\"\\n\")\n                // iOS exposes the clipboard API, but seems to discard content inserted into it\n                e.clipboardData.setData(\"Text\", content)\n                if (e.clipboardData.getData(\"Text\") == content) {\n                    e.preventDefault()\n                    return\n                }\n            }\n            // Old-fashioned briefly-focus-a-textarea hack\n            var kludge = hiddenTextarea(),\n                te = kludge.firstChild\n            cm.display.lineSpace.insertBefore(kludge, cm.display.lineSpace.firstChild)\n            te.value = lastCopied.text.join(\"\\n\")\n            var hadFocus = document.activeElement\n            selectInput(te)\n            setTimeout(function() {\n                cm.display.lineSpace.removeChild(kludge)\n                hadFocus.focus()\n                if (hadFocus == div) {\n                    input.showPrimarySelection()\n                }\n            }, 50)\n        }\n        on(div, \"copy\", onCopyCut)\n        on(div, \"cut\", onCopyCut)\n    }\n\n    ContentEditableInput.prototype.prepareSelection = function() {\n        var result = prepareSelection(this.cm, false)\n        result.focus = this.cm.state.focused\n        return result\n    }\n\n    ContentEditableInput.prototype.showSelection = function(info, takeFocus) {\n        if (!info || !this.cm.display.view.length) {\n            return\n        }\n        if (info.focus || takeFocus) {\n            this.showPrimarySelection()\n        }\n        this.showMultipleSelections(info)\n    }\n\n    ContentEditableInput.prototype.getSelection = function() {\n        return this.cm.display.wrapper.ownerDocument.getSelection()\n    }\n\n    ContentEditableInput.prototype.showPrimarySelection = function() {\n        var sel = this.getSelection(),\n            cm = this.cm,\n            prim = cm.doc.sel.primary()\n        var from = prim.from(),\n            to = prim.to()\n\n        if (\n            cm.display.viewTo == cm.display.viewFrom ||\n            from.line >= cm.display.viewTo ||\n            to.line < cm.display.viewFrom\n        ) {\n            sel.removeAllRanges()\n            return\n        }\n\n        var curAnchor = domToPos(cm, sel.anchorNode, sel.anchorOffset)\n        var curFocus = domToPos(cm, sel.focusNode, sel.focusOffset)\n        if (\n            curAnchor &&\n            !curAnchor.bad &&\n            curFocus &&\n            !curFocus.bad &&\n            cmp(minPos(curAnchor, curFocus), from) == 0 &&\n            cmp(maxPos(curAnchor, curFocus), to) == 0\n        ) {\n            return\n        }\n\n        var view = cm.display.view\n        var start = (from.line >= cm.display.viewFrom && posToDOM(cm, from)) || {\n            node: view[0].measure.map[2],\n            offset: 0\n        }\n        var end = to.line < cm.display.viewTo && posToDOM(cm, to)\n        if (!end) {\n            var measure = view[view.length - 1].measure\n            var map = measure.maps ? measure.maps[measure.maps.length - 1] : measure.map\n            end = { node: map[map.length - 1], offset: map[map.length - 2] - map[map.length - 3] }\n        }\n\n        if (!start || !end) {\n            sel.removeAllRanges()\n            return\n        }\n\n        var old = sel.rangeCount && sel.getRangeAt(0),\n            rng\n        try {\n            rng = range(start.node, start.offset, end.offset, end.node)\n        } catch (e) {} // Our model of the DOM might be outdated, in which case the range we try to set can be impossible\n        if (rng) {\n            if (!gecko && cm.state.focused) {\n                sel.collapse(start.node, start.offset)\n                if (!rng.collapsed) {\n                    sel.removeAllRanges()\n                    sel.addRange(rng)\n                }\n            } else {\n                sel.removeAllRanges()\n                sel.addRange(rng)\n            }\n            if (old && sel.anchorNode == null) {\n                sel.addRange(old)\n            } else if (gecko) {\n                this.startGracePeriod()\n            }\n        }\n        this.rememberSelection()\n    }\n\n    ContentEditableInput.prototype.startGracePeriod = function() {\n        var this$1 = this\n\n        clearTimeout(this.gracePeriod)\n        this.gracePeriod = setTimeout(function() {\n            this$1.gracePeriod = false\n            if (this$1.selectionChanged()) {\n                this$1.cm.operation(function() {\n                    return (this$1.cm.curOp.selectionChanged = true)\n                })\n            }\n        }, 20)\n    }\n\n    ContentEditableInput.prototype.showMultipleSelections = function(info) {\n        removeChildrenAndAdd(this.cm.display.cursorDiv, info.cursors)\n        removeChildrenAndAdd(this.cm.display.selectionDiv, info.selection)\n    }\n\n    ContentEditableInput.prototype.rememberSelection = function() {\n        var sel = this.getSelection()\n        this.lastAnchorNode = sel.anchorNode\n        this.lastAnchorOffset = sel.anchorOffset\n        this.lastFocusNode = sel.focusNode\n        this.lastFocusOffset = sel.focusOffset\n    }\n\n    ContentEditableInput.prototype.selectionInEditor = function() {\n        var sel = this.getSelection()\n        if (!sel.rangeCount) {\n            return false\n        }\n        var node = sel.getRangeAt(0).commonAncestorContainer\n        return contains(this.div, node)\n    }\n\n    ContentEditableInput.prototype.focus = function() {\n        if (this.cm.options.readOnly != \"nocursor\") {\n            if (!this.selectionInEditor()) {\n                this.showSelection(this.prepareSelection(), true)\n            }\n            this.div.focus()\n        }\n    }\n    ContentEditableInput.prototype.blur = function() {\n        this.div.blur()\n    }\n    ContentEditableInput.prototype.getField = function() {\n        return this.div\n    }\n\n    ContentEditableInput.prototype.supportsTouch = function() {\n        return true\n    }\n\n    ContentEditableInput.prototype.receivedFocus = function() {\n        var input = this\n        if (this.selectionInEditor()) {\n            this.pollSelection()\n        } else {\n            runInOp(this.cm, function() {\n                return (input.cm.curOp.selectionChanged = true)\n            })\n        }\n\n        function poll() {\n            if (input.cm.state.focused) {\n                input.pollSelection()\n                input.polling.set(input.cm.options.pollInterval, poll)\n            }\n        }\n        this.polling.set(this.cm.options.pollInterval, poll)\n    }\n\n    ContentEditableInput.prototype.selectionChanged = function() {\n        var sel = this.getSelection()\n        return (\n            sel.anchorNode != this.lastAnchorNode ||\n            sel.anchorOffset != this.lastAnchorOffset ||\n            sel.focusNode != this.lastFocusNode ||\n            sel.focusOffset != this.lastFocusOffset\n        )\n    }\n\n    ContentEditableInput.prototype.pollSelection = function() {\n        if (this.readDOMTimeout != null || this.gracePeriod || !this.selectionChanged()) {\n            return\n        }\n        var sel = this.getSelection(),\n            cm = this.cm\n        // On Android Chrome (version 56, at least), backspacing into an\n        // uneditable block element will put the cursor in that element,\n        // and then, because it's not editable, hide the virtual keyboard.\n        // Because Android doesn't allow us to actually detect backspace\n        // presses in a sane way, this code checks for when that happens\n        // and simulates a backspace press in this case.\n        if (android && chrome && this.cm.display.gutterSpecs.length && isInGutter(sel.anchorNode)) {\n            this.cm.triggerOnKeyDown({ type: \"keydown\", keyCode: 8, preventDefault: Math.abs })\n            this.blur()\n            this.focus()\n            return\n        }\n        if (this.composing) {\n            return\n        }\n        this.rememberSelection()\n        var anchor = domToPos(cm, sel.anchorNode, sel.anchorOffset)\n        var head = domToPos(cm, sel.focusNode, sel.focusOffset)\n        if (anchor && head) {\n            runInOp(cm, function() {\n                setSelection(cm.doc, simpleSelection(anchor, head), sel_dontScroll)\n                if (anchor.bad || head.bad) {\n                    cm.curOp.selectionChanged = true\n                }\n            })\n        }\n    }\n\n    ContentEditableInput.prototype.pollContent = function() {\n        if (this.readDOMTimeout != null) {\n            clearTimeout(this.readDOMTimeout)\n            this.readDOMTimeout = null\n        }\n\n        var cm = this.cm,\n            display = cm.display,\n            sel = cm.doc.sel.primary()\n        var from = sel.from(),\n            to = sel.to()\n        if (from.ch == 0 && from.line > cm.firstLine()) {\n            from = Pos(from.line - 1, getLine(cm.doc, from.line - 1).length)\n        }\n        if (to.ch == getLine(cm.doc, to.line).text.length && to.line < cm.lastLine()) {\n            to = Pos(to.line + 1, 0)\n        }\n        if (from.line < display.viewFrom || to.line > display.viewTo - 1) {\n            return false\n        }\n\n        var fromIndex, fromLine, fromNode\n        if (from.line == display.viewFrom || (fromIndex = findViewIndex(cm, from.line)) == 0) {\n            fromLine = lineNo(display.view[0].line)\n            fromNode = display.view[0].node\n        } else {\n            fromLine = lineNo(display.view[fromIndex].line)\n            fromNode = display.view[fromIndex - 1].node.nextSibling\n        }\n        var toIndex = findViewIndex(cm, to.line)\n        var toLine, toNode\n        if (toIndex == display.view.length - 1) {\n            toLine = display.viewTo - 1\n            toNode = display.lineDiv.lastChild\n        } else {\n            toLine = lineNo(display.view[toIndex + 1].line) - 1\n            toNode = display.view[toIndex + 1].node.previousSibling\n        }\n\n        if (!fromNode) {\n            return false\n        }\n        var newText = cm.doc.splitLines(domTextBetween(cm, fromNode, toNode, fromLine, toLine))\n        var oldText = getBetween(\n            cm.doc,\n            Pos(fromLine, 0),\n            Pos(toLine, getLine(cm.doc, toLine).text.length)\n        )\n        while (newText.length > 1 && oldText.length > 1) {\n            if (lst(newText) == lst(oldText)) {\n                newText.pop()\n                oldText.pop()\n                toLine--\n            } else if (newText[0] == oldText[0]) {\n                newText.shift()\n                oldText.shift()\n                fromLine++\n            } else {\n                break\n            }\n        }\n\n        var cutFront = 0,\n            cutEnd = 0\n        var newTop = newText[0],\n            oldTop = oldText[0],\n            maxCutFront = Math.min(newTop.length, oldTop.length)\n        while (\n            cutFront < maxCutFront &&\n            newTop.charCodeAt(cutFront) == oldTop.charCodeAt(cutFront)\n        ) {\n            ++cutFront\n        }\n        var newBot = lst(newText),\n            oldBot = lst(oldText)\n        var maxCutEnd = Math.min(\n            newBot.length - (newText.length == 1 ? cutFront : 0),\n            oldBot.length - (oldText.length == 1 ? cutFront : 0)\n        )\n        while (\n            cutEnd < maxCutEnd &&\n            newBot.charCodeAt(newBot.length - cutEnd - 1) ==\n                oldBot.charCodeAt(oldBot.length - cutEnd - 1)\n        ) {\n            ++cutEnd\n        }\n        // Try to move start of change to start of selection if ambiguous\n        if (newText.length == 1 && oldText.length == 1 && fromLine == from.line) {\n            while (\n                cutFront &&\n                cutFront > from.ch &&\n                newBot.charCodeAt(newBot.length - cutEnd - 1) ==\n                    oldBot.charCodeAt(oldBot.length - cutEnd - 1)\n            ) {\n                cutFront--\n                cutEnd++\n            }\n        }\n\n        newText[newText.length - 1] = newBot\n            .slice(0, newBot.length - cutEnd)\n            .replace(/^\\u200b+/, \"\")\n        newText[0] = newText[0].slice(cutFront).replace(/\\u200b+$/, \"\")\n\n        var chFrom = Pos(fromLine, cutFront)\n        var chTo = Pos(toLine, oldText.length ? lst(oldText).length - cutEnd : 0)\n        if (newText.length > 1 || newText[0] || cmp(chFrom, chTo)) {\n            replaceRange(cm.doc, newText, chFrom, chTo, \"+input\")\n            return true\n        }\n    }\n\n    ContentEditableInput.prototype.ensurePolled = function() {\n        this.forceCompositionEnd()\n    }\n    ContentEditableInput.prototype.reset = function() {\n        this.forceCompositionEnd()\n    }\n    ContentEditableInput.prototype.forceCompositionEnd = function() {\n        if (!this.composing) {\n            return\n        }\n        clearTimeout(this.readDOMTimeout)\n        this.composing = null\n        this.updateFromDOM()\n        this.div.blur()\n        this.div.focus()\n    }\n    ContentEditableInput.prototype.readFromDOMSoon = function() {\n        var this$1 = this\n\n        if (this.readDOMTimeout != null) {\n            return\n        }\n        this.readDOMTimeout = setTimeout(function() {\n            this$1.readDOMTimeout = null\n            if (this$1.composing) {\n                if (this$1.composing.done) {\n                    this$1.composing = null\n                } else {\n                    return\n                }\n            }\n            this$1.updateFromDOM()\n        }, 80)\n    }\n\n    ContentEditableInput.prototype.updateFromDOM = function() {\n        var this$1 = this\n\n        if (this.cm.isReadOnly() || !this.pollContent()) {\n            runInOp(this.cm, function() {\n                return regChange(this$1.cm)\n            })\n        }\n    }\n\n    ContentEditableInput.prototype.setUneditable = function(node) {\n        node.contentEditable = \"false\"\n    }\n\n    ContentEditableInput.prototype.onKeyPress = function(e) {\n        if (e.charCode == 0 || this.composing) {\n            return\n        }\n        e.preventDefault()\n        if (!this.cm.isReadOnly()) {\n            operation(this.cm, applyTextInput)(\n                this.cm,\n                String.fromCharCode(e.charCode == null ? e.keyCode : e.charCode),\n                0\n            )\n        }\n    }\n\n    ContentEditableInput.prototype.readOnlyChanged = function(val) {\n        this.div.contentEditable = String(val != \"nocursor\")\n    }\n\n    ContentEditableInput.prototype.onContextMenu = function() {}\n    ContentEditableInput.prototype.resetPosition = function() {}\n\n    ContentEditableInput.prototype.needsContentAttribute = true\n\n    function posToDOM(cm, pos) {\n        var view = findViewForLine(cm, pos.line)\n        if (!view || view.hidden) {\n            return null\n        }\n        var line = getLine(cm.doc, pos.line)\n        var info = mapFromLineView(view, line, pos.line)\n\n        var order = getOrder(line, cm.doc.direction),\n            side = \"left\"\n        if (order) {\n            var partPos = getBidiPartAt(order, pos.ch)\n            side = partPos % 2 ? \"right\" : \"left\"\n        }\n        var result = nodeAndOffsetInLineMap(info.map, pos.ch, side)\n        result.offset = result.collapse == \"right\" ? result.end : result.start\n        return result\n    }\n\n    function isInGutter(node) {\n        for (var scan = node; scan; scan = scan.parentNode) {\n            if (/CodeMirror-gutter-wrapper/.test(scan.className)) {\n                return true\n            }\n        }\n        return false\n    }\n\n    function badPos(pos, bad) {\n        if (bad) {\n            pos.bad = true\n        }\n        return pos\n    }\n\n    function domTextBetween(cm, from, to, fromLine, toLine) {\n        var text = \"\",\n            closing = false,\n            lineSep = cm.doc.lineSeparator(),\n            extraLinebreak = false\n        function recognizeMarker(id) {\n            return function(marker) {\n                return marker.id == id\n            }\n        }\n        function close() {\n            if (closing) {\n                text += lineSep\n                if (extraLinebreak) {\n                    text += lineSep\n                }\n                closing = extraLinebreak = false\n            }\n        }\n        function addText(str) {\n            if (str) {\n                close()\n                text += str\n            }\n        }\n        function walk(node) {\n            if (node.nodeType == 1) {\n                var cmText = node.getAttribute(\"cm-text\")\n                if (cmText) {\n                    addText(cmText)\n                    return\n                }\n                var markerID = node.getAttribute(\"cm-marker\"),\n                    range\n                if (markerID) {\n                    var found = cm.findMarks(\n                        Pos(fromLine, 0),\n                        Pos(toLine + 1, 0),\n                        recognizeMarker(+markerID)\n                    )\n                    if (found.length && (range = found[0].find(0))) {\n                        addText(getBetween(cm.doc, range.from, range.to).join(lineSep))\n                    }\n                    return\n                }\n                if (node.getAttribute(\"contenteditable\") == \"false\") {\n                    return\n                }\n                var isBlock = /^(pre|div|p|li|table|br)$/i.test(node.nodeName)\n                if (!/^br$/i.test(node.nodeName) && node.textContent.length == 0) {\n                    return\n                }\n\n                if (isBlock) {\n                    close()\n                }\n                for (var i = 0; i < node.childNodes.length; i++) {\n                    walk(node.childNodes[i])\n                }\n\n                if (/^(pre|p)$/i.test(node.nodeName)) {\n                    extraLinebreak = true\n                }\n                if (isBlock) {\n                    closing = true\n                }\n            } else if (node.nodeType == 3) {\n                addText(node.nodeValue.replace(/\\u200b/g, \"\").replace(/\\u00a0/g, \" \"))\n            }\n        }\n        for (;;) {\n            walk(from)\n            if (from == to) {\n                break\n            }\n            from = from.nextSibling\n            extraLinebreak = false\n        }\n        return text\n    }\n\n    function domToPos(cm, node, offset) {\n        var lineNode\n        if (node == cm.display.lineDiv) {\n            lineNode = cm.display.lineDiv.childNodes[offset]\n            if (!lineNode) {\n                return badPos(cm.clipPos(Pos(cm.display.viewTo - 1)), true)\n            }\n            node = null\n            offset = 0\n        } else {\n            for (lineNode = node; ; lineNode = lineNode.parentNode) {\n                if (!lineNode || lineNode == cm.display.lineDiv) {\n                    return null\n                }\n                if (lineNode.parentNode && lineNode.parentNode == cm.display.lineDiv) {\n                    break\n                }\n            }\n        }\n        for (var i = 0; i < cm.display.view.length; i++) {\n            var lineView = cm.display.view[i]\n            if (lineView.node == lineNode) {\n                return locateNodeInLineView(lineView, node, offset)\n            }\n        }\n    }\n\n    function locateNodeInLineView(lineView, node, offset) {\n        var wrapper = lineView.text.firstChild,\n            bad = false\n        if (!node || !contains(wrapper, node)) {\n            return badPos(Pos(lineNo(lineView.line), 0), true)\n        }\n        if (node == wrapper) {\n            bad = true\n            node = wrapper.childNodes[offset]\n            offset = 0\n            if (!node) {\n                var line = lineView.rest ? lst(lineView.rest) : lineView.line\n                return badPos(Pos(lineNo(line), line.text.length), bad)\n            }\n        }\n\n        var textNode = node.nodeType == 3 ? node : null,\n            topNode = node\n        if (!textNode && node.childNodes.length == 1 && node.firstChild.nodeType == 3) {\n            textNode = node.firstChild\n            if (offset) {\n                offset = textNode.nodeValue.length\n            }\n        }\n        while (topNode.parentNode != wrapper) {\n            topNode = topNode.parentNode\n        }\n        var measure = lineView.measure,\n            maps = measure.maps\n\n        function find(textNode, topNode, offset) {\n            for (var i = -1; i < (maps ? maps.length : 0); i++) {\n                var map = i < 0 ? measure.map : maps[i]\n                for (var j = 0; j < map.length; j += 3) {\n                    var curNode = map[j + 2]\n                    if (curNode == textNode || curNode == topNode) {\n                        var line = lineNo(i < 0 ? lineView.line : lineView.rest[i])\n                        var ch = map[j] + offset\n                        if (offset < 0 || curNode != textNode) {\n                            ch = map[j + (offset ? 1 : 0)]\n                        }\n                        return Pos(line, ch)\n                    }\n                }\n            }\n        }\n        var found = find(textNode, topNode, offset)\n        if (found) {\n            return badPos(found, bad)\n        }\n\n        // FIXME this is all really shaky. might handle the few cases it needs to handle, but likely to cause problems\n        for (\n            var after = topNode.nextSibling,\n                dist = textNode ? textNode.nodeValue.length - offset : 0;\n            after;\n            after = after.nextSibling\n        ) {\n            found = find(after, after.firstChild, 0)\n            if (found) {\n                return badPos(Pos(found.line, found.ch - dist), bad)\n            } else {\n                dist += after.textContent.length\n            }\n        }\n        for (\n            var before = topNode.previousSibling, dist$1 = offset;\n            before;\n            before = before.previousSibling\n        ) {\n            found = find(before, before.firstChild, -1)\n            if (found) {\n                return badPos(Pos(found.line, found.ch + dist$1), bad)\n            } else {\n                dist$1 += before.textContent.length\n            }\n        }\n    }\n\n    // TEXTAREA INPUT STYLE\n\n    var TextareaInput = function(cm) {\n        this.cm = cm\n        // See input.poll and input.reset\n        this.prevInput = \"\"\n\n        // Flag that indicates whether we expect input to appear real soon\n        // now (after some event like 'keypress' or 'input') and are\n        // polling intensively.\n        this.pollingFast = false\n        // Self-resetting timeout for the poller\n        this.polling = new Delayed()\n        // Used to work around IE issue with selection being forgotten when focus moves away from textarea\n        this.hasSelection = false\n        this.composing = null\n    }\n\n    TextareaInput.prototype.init = function(display) {\n        var this$1 = this\n\n        var input = this,\n            cm = this.cm\n        this.createField(display)\n        var te = this.textarea\n\n        display.wrapper.insertBefore(this.wrapper, display.wrapper.firstChild)\n\n        // Needed to hide big blue blinking cursor on Mobile Safari (doesn't seem to work in iOS 8 anymore)\n        if (ios) {\n            te.style.width = \"0px\"\n        }\n\n        on(te, \"input\", function() {\n            if (ie && ie_version >= 9 && this$1.hasSelection) {\n                this$1.hasSelection = null\n            }\n            input.poll()\n        })\n\n        on(te, \"paste\", function(e) {\n            if (signalDOMEvent(cm, e) || handlePaste(e, cm)) {\n                return\n            }\n\n            cm.state.pasteIncoming = +new Date()\n            input.fastPoll()\n        })\n\n        function prepareCopyCut(e) {\n            if (signalDOMEvent(cm, e)) {\n                return\n            }\n            if (cm.somethingSelected()) {\n                setLastCopied({ lineWise: false, text: cm.getSelections() })\n            } else if (!cm.options.lineWiseCopyCut) {\n                return\n            } else {\n                var ranges = copyableRanges(cm)\n                setLastCopied({ lineWise: true, text: ranges.text })\n                if (e.type == \"cut\") {\n                    cm.setSelections(ranges.ranges, null, sel_dontScroll)\n                } else {\n                    input.prevInput = \"\"\n                    te.value = ranges.text.join(\"\\n\")\n                    selectInput(te)\n                }\n            }\n            if (e.type == \"cut\") {\n                cm.state.cutIncoming = +new Date()\n            }\n        }\n        on(te, \"cut\", prepareCopyCut)\n        on(te, \"copy\", prepareCopyCut)\n\n        on(display.scroller, \"paste\", function(e) {\n            if (eventInWidget(display, e) || signalDOMEvent(cm, e)) {\n                return\n            }\n            if (!te.dispatchEvent) {\n                cm.state.pasteIncoming = +new Date()\n                input.focus()\n                return\n            }\n\n            // Pass the `paste` event to the textarea so it's handled by its event listener.\n            var event = new Event(\"paste\")\n            event.clipboardData = e.clipboardData\n            te.dispatchEvent(event)\n        })\n\n        // Prevent normal selection in the editor (we handle our own)\n        on(display.lineSpace, \"selectstart\", function(e) {\n            if (!eventInWidget(display, e)) {\n                e_preventDefault(e)\n            }\n        })\n\n        on(te, \"compositionstart\", function() {\n            var start = cm.getCursor(\"from\")\n            if (input.composing) {\n                input.composing.range.clear()\n            }\n            input.composing = {\n                start: start,\n                range: cm.markText(start, cm.getCursor(\"to\"), { className: \"CodeMirror-composing\" })\n            }\n        })\n        on(te, \"compositionend\", function() {\n            if (input.composing) {\n                input.poll()\n                input.composing.range.clear()\n                input.composing = null\n            }\n        })\n    }\n\n    TextareaInput.prototype.createField = function(_display) {\n        // Wraps and hides input textarea\n        this.wrapper = hiddenTextarea()\n        // The semihidden textarea that is focused when the editor is\n        // focused, and receives input.\n        this.textarea = this.wrapper.firstChild\n    }\n\n    TextareaInput.prototype.prepareSelection = function() {\n        // Redraw the selection and/or cursor\n        var cm = this.cm,\n            display = cm.display,\n            doc = cm.doc\n        var result = prepareSelection(cm)\n\n        // Move the hidden textarea near the cursor to prevent scrolling artifacts\n        if (cm.options.moveInputWithCursor) {\n            var headPos = cursorCoords(cm, doc.sel.primary().head, \"div\")\n            var wrapOff = display.wrapper.getBoundingClientRect(),\n                lineOff = display.lineDiv.getBoundingClientRect()\n            result.teTop = Math.max(\n                0,\n                Math.min(display.wrapper.clientHeight - 10, headPos.top + lineOff.top - wrapOff.top)\n            )\n            result.teLeft = Math.max(\n                0,\n                Math.min(\n                    display.wrapper.clientWidth - 10,\n                    headPos.left + lineOff.left - wrapOff.left\n                )\n            )\n        }\n\n        return result\n    }\n\n    TextareaInput.prototype.showSelection = function(drawn) {\n        var cm = this.cm,\n            display = cm.display\n        removeChildrenAndAdd(display.cursorDiv, drawn.cursors)\n        removeChildrenAndAdd(display.selectionDiv, drawn.selection)\n        if (drawn.teTop != null) {\n            this.wrapper.style.top = drawn.teTop + \"px\"\n            this.wrapper.style.left = drawn.teLeft + \"px\"\n        }\n    }\n\n    // Reset the input to correspond to the selection (or to be empty,\n    // when not typing and nothing is selected)\n    TextareaInput.prototype.reset = function(typing) {\n        if (this.contextMenuPending || this.composing) {\n            return\n        }\n        var cm = this.cm\n        if (cm.somethingSelected()) {\n            this.prevInput = \"\"\n            var content = cm.getSelection()\n            this.textarea.value = content\n            if (cm.state.focused) {\n                selectInput(this.textarea)\n            }\n            if (ie && ie_version >= 9) {\n                this.hasSelection = content\n            }\n        } else if (!typing) {\n            this.prevInput = this.textarea.value = \"\"\n            if (ie && ie_version >= 9) {\n                this.hasSelection = null\n            }\n        }\n    }\n\n    TextareaInput.prototype.getField = function() {\n        return this.textarea\n    }\n\n    TextareaInput.prototype.supportsTouch = function() {\n        return false\n    }\n\n    TextareaInput.prototype.focus = function() {\n        if (this.cm.options.readOnly != \"nocursor\" && (!mobile || activeElt() != this.textarea)) {\n            try {\n                this.textarea.focus()\n            } catch (e) {} // IE8 will throw if the textarea is display: none or not in DOM\n        }\n    }\n\n    TextareaInput.prototype.blur = function() {\n        this.textarea.blur()\n    }\n\n    TextareaInput.prototype.resetPosition = function() {\n        this.wrapper.style.top = this.wrapper.style.left = 0\n    }\n\n    TextareaInput.prototype.receivedFocus = function() {\n        this.slowPoll()\n    }\n\n    // Poll for input changes, using the normal rate of polling. This\n    // runs as long as the editor is focused.\n    TextareaInput.prototype.slowPoll = function() {\n        var this$1 = this\n\n        if (this.pollingFast) {\n            return\n        }\n        this.polling.set(this.cm.options.pollInterval, function() {\n            this$1.poll()\n            if (this$1.cm.state.focused) {\n                this$1.slowPoll()\n            }\n        })\n    }\n\n    // When an event has just come in that is likely to add or change\n    // something in the input textarea, we poll faster, to ensure that\n    // the change appears on the screen quickly.\n    TextareaInput.prototype.fastPoll = function() {\n        var missed = false,\n            input = this\n        input.pollingFast = true\n        function p() {\n            var changed = input.poll()\n            if (!changed && !missed) {\n                missed = true\n                input.polling.set(60, p)\n            } else {\n                input.pollingFast = false\n                input.slowPoll()\n            }\n        }\n        input.polling.set(20, p)\n    }\n\n    // Read input from the textarea, and update the document to match.\n    // When something is selected, it is present in the textarea, and\n    // selected (unless it is huge, in which case a placeholder is\n    // used). When nothing is selected, the cursor sits after previously\n    // seen text (can be empty), which is stored in prevInput (we must\n    // not reset the textarea when typing, because that breaks IME).\n    TextareaInput.prototype.poll = function() {\n        var this$1 = this\n\n        var cm = this.cm,\n            input = this.textarea,\n            prevInput = this.prevInput\n        // Since this is called a *lot*, try to bail out as cheaply as\n        // possible when it is clear that nothing happened. hasSelection\n        // will be the case when there is a lot of text in the textarea,\n        // in which case reading its value would be expensive.\n        if (\n            this.contextMenuPending ||\n            !cm.state.focused ||\n            (hasSelection(input) && !prevInput && !this.composing) ||\n            cm.isReadOnly() ||\n            cm.options.disableInput ||\n            cm.state.keySeq\n        ) {\n            return false\n        }\n\n        var text = input.value\n        // If nothing changed, bail.\n        if (text == prevInput && !cm.somethingSelected()) {\n            return false\n        }\n        // Work around nonsensical selection resetting in IE9/10, and\n        // inexplicable appearance of private area unicode characters on\n        // some key combos in Mac (#2689).\n        if (\n            (ie && ie_version >= 9 && this.hasSelection === text) ||\n            (mac && /[\\uf700-\\uf7ff]/.test(text))\n        ) {\n            cm.display.input.reset()\n            return false\n        }\n\n        if (cm.doc.sel == cm.display.selForContextMenu) {\n            var first = text.charCodeAt(0)\n            if (first == 0x200b && !prevInput) {\n                prevInput = \"\\u200b\"\n            }\n            if (first == 0x21da) {\n                this.reset()\n                return this.cm.execCommand(\"undo\")\n            }\n        }\n        // Find the part of the input that is actually new\n        var same = 0,\n            l = Math.min(prevInput.length, text.length)\n        while (same < l && prevInput.charCodeAt(same) == text.charCodeAt(same)) {\n            ++same\n        }\n\n        runInOp(cm, function() {\n            applyTextInput(\n                cm,\n                text.slice(same),\n                prevInput.length - same,\n                null,\n                this$1.composing ? \"*compose\" : null\n            )\n\n            // Don't leave long text in the textarea, since it makes further polling slow\n            if (text.length > 1000 || text.indexOf(\"\\n\") > -1) {\n                input.value = this$1.prevInput = \"\"\n            } else {\n                this$1.prevInput = text\n            }\n\n            if (this$1.composing) {\n                this$1.composing.range.clear()\n                this$1.composing.range = cm.markText(this$1.composing.start, cm.getCursor(\"to\"), {\n                    className: \"CodeMirror-composing\"\n                })\n            }\n        })\n        return true\n    }\n\n    TextareaInput.prototype.ensurePolled = function() {\n        if (this.pollingFast && this.poll()) {\n            this.pollingFast = false\n        }\n    }\n\n    TextareaInput.prototype.onKeyPress = function() {\n        if (ie && ie_version >= 9) {\n            this.hasSelection = null\n        }\n        this.fastPoll()\n    }\n\n    TextareaInput.prototype.onContextMenu = function(e) {\n        var input = this,\n            cm = input.cm,\n            display = cm.display,\n            te = input.textarea\n        if (input.contextMenuPending) {\n            input.contextMenuPending()\n        }\n        var pos = posFromMouse(cm, e),\n            scrollPos = display.scroller.scrollTop\n        if (!pos || presto) {\n            return\n        } // Opera is difficult.\n\n        // Reset the current text selection only if the click is done outside of the selection\n        // and 'resetSelectionOnContextMenu' option is true.\n        var reset = cm.options.resetSelectionOnContextMenu\n        if (reset && cm.doc.sel.contains(pos) == -1) {\n            operation(cm, setSelection)(cm.doc, simpleSelection(pos), sel_dontScroll)\n        }\n\n        var oldCSS = te.style.cssText,\n            oldWrapperCSS = input.wrapper.style.cssText\n        var wrapperBox = input.wrapper.offsetParent.getBoundingClientRect()\n        input.wrapper.style.cssText = \"position: static\"\n        te.style.cssText =\n            \"position: absolute; width: 30px; height: 30px;\\n      top: \" +\n            (e.clientY - wrapperBox.top - 5) +\n            \"px; left: \" +\n            (e.clientX - wrapperBox.left - 5) +\n            \"px;\\n      z-index: 1000; background: \" +\n            (ie ? \"rgba(255, 255, 255, .05)\" : \"transparent\") +\n            \";\\n      outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);\"\n        var oldScrollY\n        if (webkit) {\n            oldScrollY = window.scrollY\n        } // Work around Chrome issue (#2712)\n        display.input.focus()\n        if (webkit) {\n            window.scrollTo(null, oldScrollY)\n        }\n        display.input.reset()\n        // Adds \"Select all\" to context menu in FF\n        if (!cm.somethingSelected()) {\n            te.value = input.prevInput = \" \"\n        }\n        input.contextMenuPending = rehide\n        display.selForContextMenu = cm.doc.sel\n        clearTimeout(display.detectingSelectAll)\n\n        // Select-all will be greyed out if there's nothing to select, so\n        // this adds a zero-width space so that we can later check whether\n        // it got selected.\n        function prepareSelectAllHack() {\n            if (te.selectionStart != null) {\n                var selected = cm.somethingSelected()\n                var extval = \"\\u200b\" + (selected ? te.value : \"\")\n                te.value = \"\\u21da\" // Used to catch context-menu undo\n                te.value = extval\n                input.prevInput = selected ? \"\" : \"\\u200b\"\n                te.selectionStart = 1\n                te.selectionEnd = extval.length\n                // Re-set this, in case some other handler touched the\n                // selection in the meantime.\n                display.selForContextMenu = cm.doc.sel\n            }\n        }\n        function rehide() {\n            if (input.contextMenuPending != rehide) {\n                return\n            }\n            input.contextMenuPending = false\n            input.wrapper.style.cssText = oldWrapperCSS\n            te.style.cssText = oldCSS\n            if (ie && ie_version < 9) {\n                display.scrollbars.setScrollTop((display.scroller.scrollTop = scrollPos))\n            }\n\n            // Try to detect the user choosing select-all\n            if (te.selectionStart != null) {\n                if (!ie || (ie && ie_version < 9)) {\n                    prepareSelectAllHack()\n                }\n                var i = 0,\n                    poll = function() {\n                        if (\n                            display.selForContextMenu == cm.doc.sel &&\n                            te.selectionStart == 0 &&\n                            te.selectionEnd > 0 &&\n                            input.prevInput == \"\\u200b\"\n                        ) {\n                            operation(cm, selectAll)(cm)\n                        } else if (i++ < 10) {\n                            display.detectingSelectAll = setTimeout(poll, 500)\n                        } else {\n                            display.selForContextMenu = null\n                            display.input.reset()\n                        }\n                    }\n                display.detectingSelectAll = setTimeout(poll, 200)\n            }\n        }\n\n        if (ie && ie_version >= 9) {\n            prepareSelectAllHack()\n        }\n        if (captureRightClick) {\n            e_stop(e)\n            var mouseup = function() {\n                off(window, \"mouseup\", mouseup)\n                setTimeout(rehide, 20)\n            }\n            on(window, \"mouseup\", mouseup)\n        } else {\n            setTimeout(rehide, 50)\n        }\n    }\n\n    TextareaInput.prototype.readOnlyChanged = function(val) {\n        if (!val) {\n            this.reset()\n        }\n        this.textarea.disabled = val == \"nocursor\"\n    }\n\n    TextareaInput.prototype.setUneditable = function() {}\n\n    TextareaInput.prototype.needsContentAttribute = false\n\n    function fromTextArea(textarea, options) {\n        options = options ? copyObj(options) : {}\n        options.value = textarea.value\n        if (!options.tabindex && textarea.tabIndex) {\n            options.tabindex = textarea.tabIndex\n        }\n        if (!options.placeholder && textarea.placeholder) {\n            options.placeholder = textarea.placeholder\n        }\n        // Set autofocus to true if this textarea is focused, or if it has\n        // autofocus and no other element is focused.\n        if (options.autofocus == null) {\n            var hasFocus = activeElt()\n            options.autofocus =\n                hasFocus == textarea ||\n                (textarea.getAttribute(\"autofocus\") != null && hasFocus == document.body)\n        }\n\n        function save() {\n            textarea.value = cm.getValue()\n        }\n\n        var realSubmit\n        if (textarea.form) {\n            on(textarea.form, \"submit\", save)\n            // Deplorable hack to make the submit method do the right thing.\n            if (!options.leaveSubmitMethodAlone) {\n                var form = textarea.form\n                realSubmit = form.submit\n                try {\n                    var wrappedSubmit = (form.submit = function() {\n                        save()\n                        form.submit = realSubmit\n                        form.submit()\n                        form.submit = wrappedSubmit\n                    })\n                } catch (e) {}\n            }\n        }\n\n        options.finishInit = function(cm) {\n            cm.save = save\n            cm.getTextArea = function() {\n                return textarea\n            }\n            cm.toTextArea = function() {\n                cm.toTextArea = isNaN // Prevent this from being ran twice\n                save()\n                textarea.parentNode.removeChild(cm.getWrapperElement())\n                textarea.style.display = \"\"\n                if (textarea.form) {\n                    off(textarea.form, \"submit\", save)\n                    if (\n                        !options.leaveSubmitMethodAlone &&\n                        typeof textarea.form.submit == \"function\"\n                    ) {\n                        textarea.form.submit = realSubmit\n                    }\n                }\n            }\n        }\n\n        textarea.style.display = \"none\"\n        var cm = CodeMirror(function(node) {\n            return textarea.parentNode.insertBefore(node, textarea.nextSibling)\n        }, options)\n        return cm\n    }\n\n    function addLegacyProps(CodeMirror) {\n        CodeMirror.off = off\n        CodeMirror.on = on\n        CodeMirror.wheelEventPixels = wheelEventPixels\n        CodeMirror.Doc = Doc\n        CodeMirror.splitLines = splitLinesAuto\n        CodeMirror.countColumn = countColumn\n        CodeMirror.findColumn = findColumn\n        CodeMirror.isWordChar = isWordCharBasic\n        CodeMirror.Pass = Pass\n        CodeMirror.signal = signal\n        CodeMirror.Line = Line\n        CodeMirror.changeEnd = changeEnd\n        CodeMirror.scrollbarModel = scrollbarModel\n        CodeMirror.Pos = Pos\n        CodeMirror.cmpPos = cmp\n        CodeMirror.modes = modes\n        CodeMirror.mimeModes = mimeModes\n        CodeMirror.resolveMode = resolveMode\n        CodeMirror.getMode = getMode\n        CodeMirror.modeExtensions = modeExtensions\n        CodeMirror.extendMode = extendMode\n        CodeMirror.copyState = copyState\n        CodeMirror.startState = startState\n        CodeMirror.innerMode = innerMode\n        CodeMirror.commands = commands\n        CodeMirror.keyMap = keyMap\n        CodeMirror.keyName = keyName\n        CodeMirror.isModifierKey = isModifierKey\n        CodeMirror.lookupKey = lookupKey\n        CodeMirror.normalizeKeyMap = normalizeKeyMap\n        CodeMirror.StringStream = StringStream\n        CodeMirror.SharedTextMarker = SharedTextMarker\n        CodeMirror.TextMarker = TextMarker\n        CodeMirror.LineWidget = LineWidget\n        CodeMirror.e_preventDefault = e_preventDefault\n        CodeMirror.e_stopPropagation = e_stopPropagation\n        CodeMirror.e_stop = e_stop\n        CodeMirror.addClass = addClass\n        CodeMirror.contains = contains\n        CodeMirror.rmClass = rmClass\n        CodeMirror.keyNames = keyNames\n    }\n\n    // EDITOR CONSTRUCTOR\n\n    defineOptions(CodeMirror)\n\n    addEditorMethods(CodeMirror)\n\n    // Set up methods on CodeMirror's prototype to redirect to the editor's document.\n    var dontDelegate = \"iter insert remove copy getEditor constructor\".split(\" \")\n    for (var prop in Doc.prototype) {\n        if (Doc.prototype.hasOwnProperty(prop) && indexOf(dontDelegate, prop) < 0) {\n            CodeMirror.prototype[prop] = (function(method) {\n                return function() {\n                    return method.apply(this.doc, arguments)\n                }\n            })(Doc.prototype[prop])\n        }\n    }\n\n    eventMixin(Doc)\n    CodeMirror.inputStyles = { textarea: TextareaInput, contenteditable: ContentEditableInput }\n\n    // Extra arguments are stored as the mode's dependencies, which is\n    // used by (legacy) mechanisms like loadmode.js to automatically\n    // load a mode. (Preferred mechanism is the require/define calls.)\n    CodeMirror.defineMode = function(name /*, mode, …*/) {\n        if (!CodeMirror.defaults.mode && name != \"null\") {\n            CodeMirror.defaults.mode = name\n        }\n        defineMode.apply(this, arguments)\n    }\n\n    CodeMirror.defineMIME = defineMIME\n\n    // Minimal default mode.\n    CodeMirror.defineMode(\"null\", function() {\n        return {\n            token: function(stream) {\n                return stream.skipToEnd()\n            }\n        }\n    })\n    CodeMirror.defineMIME(\"text/plain\", \"null\")\n\n    // EXTENSIONS\n\n    CodeMirror.defineExtension = function(name, func) {\n        CodeMirror.prototype[name] = func\n    }\n    CodeMirror.defineDocExtension = function(name, func) {\n        Doc.prototype[name] = func\n    }\n\n    CodeMirror.fromTextArea = fromTextArea\n\n    addLegacyProps(CodeMirror)\n\n    CodeMirror.version = \"5.51.0\"\n\n    return CodeMirror\n})\n"
  },
  {
    "path": "docs/assets/getting-started-assets/javascripts/codemirror/theme/xq-light.css",
    "content": "/*\nCopyright (C) 2011 by MarkLogic Corporation\nAuthor: Mike Brevoort <mike@brevoort.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*/\n.cm-s-xq-light span.cm-keyword {line-height: 1em; font-weight: bold; color: #5A5CAD; }\n.cm-s-xq-light span.cm-atom {color: #6C8CD5;}\n.cm-s-xq-light span.cm-number {color: #164;}\n.cm-s-xq-light span.cm-def {text-decoration:underline;}\n.cm-s-xq-light span.cm-variable {color: black; }\n.cm-s-xq-light span.cm-variable-2 {color:black;}\n.cm-s-xq-light span.cm-variable-3 {color: black; }\n.cm-s-xq-light span.cm-property {}\n.cm-s-xq-light span.cm-operator {}\n.cm-s-xq-light span.cm-comment {color: #0080FF; font-style: italic;}\n.cm-s-xq-light span.cm-string {color: red;}\n.cm-s-xq-light span.cm-meta {color: yellow;}\n.cm-s-xq-light span.cm-qualifier {color: grey}\n.cm-s-xq-light span.cm-builtin {color: #7EA656;}\n.cm-s-xq-light span.cm-bracket {color: #cc7;}\n.cm-s-xq-light span.cm-tag {color: #3F7F7F;}\n.cm-s-xq-light span.cm-attribute {color: #7F007F;}\n.cm-s-xq-light span.cm-error {color: #f00;}\n\n.cm-s-xq-light .CodeMirror-activeline-background {background: #e8f2ff !important;}\n.cm-s-xq-light .CodeMirror-matchingbracket {outline:1px solid grey;color:black !important;background:yellow;}"
  },
  {
    "path": "docs/assets/getting-started-assets/javascripts/mobx-react.js",
    "content": ";(function() {\n    function mrFactory(mobx, React, ReactDOM) {\n        if (!mobx) throw new Error(\"mobx-react requires the MobX package\")\n        if (!React) throw new Error(\"mobx-react requires React to be available\")\n\n        var isDevtoolsEnabled = false\n\n        // WeakMap<Node, Object>;\n        var componentByNodeRegistery = typeof WeakMap !== \"undefined\" ? new WeakMap() : undefined\n        var renderReporter = new mobx.SimpleEventEmitter()\n\n        function findDOMNode(component) {\n            if (ReactDOM) return ReactDOM.findDOMNode(component)\n            return null\n        }\n\n        function reportRendering(component) {\n            var node = findDOMNode(component)\n            if (node) componentByNodeRegistery.set(node, component)\n\n            renderReporter.emit({\n                event: \"render\",\n                renderTime: component.__$mobRenderEnd - component.__$mobRenderStart,\n                totalTime: Date.now() - component.__$mobRenderStart,\n                component: component,\n                node: node\n            })\n        }\n\n        var reactiveMixin = {\n            componentWillMount: function() {\n                // Generate friendly name for debugging\n                var name = [\n                    this.displayName ||\n                        this.name ||\n                        (this.constructor && this.constructor.name) ||\n                        \"<component>\",\n                    \"#\",\n                    this._reactInternalInstance && this._reactInternalInstance._rootNodeID,\n                    \".render()\"\n                ].join(\"\")\n\n                var baseRender = this.render.bind(this)\n                var self = this\n                var reaction = null\n                var isRenderingPending = false\n\n                function initialRender() {\n                    reaction = new mobx.Reaction(name, function() {\n                        if (!isRenderingPending) {\n                            isRenderingPending = true\n                            React.Component.prototype.forceUpdate.call(self)\n                        }\n                    })\n                    reactiveRender.$mobx = reaction\n                    self.render = reactiveRender\n                    return reactiveRender()\n                }\n\n                function reactiveRender() {\n                    isRenderingPending = false\n                    var rendering\n                    reaction.track(function() {\n                        if (isDevtoolsEnabled) self.__$mobRenderStart = Date.now()\n                        rendering = mobx.extras.allowStateChanges(false, baseRender)\n                        if (isDevtoolsEnabled) self.__$mobRenderEnd = Date.now()\n                    })\n                    return rendering\n                }\n\n                this.render = initialRender\n            },\n\n            componentWillUnmount: function() {\n                this.render.$mobx && this.render.$mobx.dispose()\n                if (isDevtoolsEnabled) {\n                    var node = findDOMNode(this)\n                    if (node) {\n                        componentByNodeRegistery.delete(node)\n                    }\n                    renderReporter.emit({\n                        event: \"destroy\",\n                        component: this,\n                        node: node\n                    })\n                }\n            },\n\n            componentDidMount: function() {\n                if (isDevtoolsEnabled) reportRendering(this)\n            },\n\n            componentDidUpdate: function() {\n                if (isDevtoolsEnabled) reportRendering(this)\n            },\n\n            shouldComponentUpdate: function(nextProps, nextState) {\n                // TODO: if context changed, return true.., see #18\n\n                // if props or state did change, but a render was scheduled already, no additional render needs to be scheduled\n                if (this.render.$mobx && this.render.$mobx.isScheduled() === true) return false\n\n                // update on any state changes (as is the default)\n                if (this.state !== nextState) return true\n                // update if props are shallowly not equal, inspired by PureRenderMixin\n                var keys = Object.keys(this.props)\n                var key\n                if (keys.length !== Object.keys(nextProps).length) return true\n                for (var i = keys.length - 1; i >= 0, (key = keys[i]); i--) {\n                    var newValue = nextProps[key]\n                    if (newValue !== this.props[key]) {\n                        return true\n                    } else if (\n                        newValue &&\n                        typeof newValue === \"object\" &&\n                        !mobx.isObservable(newValue)\n                    ) {\n                        /**\n                         * If the newValue is still the same object, but that object is not observable,\n                         * fallback to the default React behavior: update, because the object *might* have changed.\n                         * If you need the non default behavior, just use the React pure render mixin, as that one\n                         * will work fine with mobx as well, instead of the default implementation of\n                         * observer.\n                         */\n                        return true\n                    }\n                }\n                return false\n            }\n        }\n\n        function patch(target, funcName) {\n            var base = target[funcName]\n            var mixinFunc = reactiveMixin[funcName]\n            target[funcName] = function() {\n                base && base.apply(this, arguments)\n                mixinFunc.apply(this, arguments)\n            }\n        }\n\n        function observer(componentClass) {\n            // If it is function but doesn't seem to be a react class constructor,\n            // wrap it to a react class automatically\n            if (\n                typeof componentClass === \"function\" &&\n                !componentClass.prototype.render &&\n                !componentClass.isReactClass &&\n                !React.Component.isPrototypeOf(componentClass)\n            ) {\n                return observer(\n                    React.createClass({\n                        displayName: componentClass.displayName || componentClass.name,\n                        propTypes: componentClass.propTypes,\n                        contextTypes: componentClass.contextTypes,\n                        getDefaultProps: function() {\n                            return componentClass.defaultProps\n                        },\n                        render: function() {\n                            return componentClass.call(this, this.props, this.context)\n                        }\n                    })\n                )\n            }\n\n            if (!componentClass) throw new Error(\"Please pass a valid component to 'observer'\")\n            var target = componentClass.prototype || componentClass\n\n            ;[\n                \"componentWillMount\",\n                \"componentWillUnmount\",\n                \"componentDidMount\",\n                \"componentDidUpdate\"\n            ].forEach(function(funcName) {\n                patch(target, funcName)\n            })\n\n            if (!target.shouldComponentUpdate)\n                target.shouldComponentUpdate = reactiveMixin.shouldComponentUpdate\n            componentClass.isMobXReactObserver = true\n            return componentClass\n        }\n\n        function trackComponents() {\n            if (typeof WeakMap === \"undefined\")\n                throw new Error(\n                    \"[mobx-react] tracking components is not supported in this browser.\"\n                )\n            if (!isDevtoolsEnabled) isDevtoolsEnabled = true\n        }\n\n        return {\n            observer: observer,\n            reactiveComponent: function() {\n                console.warn(\n                    \"[mobx-react] `reactiveComponent` has been renamed to `observer` and will be removed in 1.1.\"\n                )\n                return observer.apply(null, arguments)\n            },\n            renderReporter: renderReporter,\n            componentByNodeRegistery: componentByNodeRegistery,\n            trackComponents: trackComponents\n        }\n    }\n\n    // UMD\n    if (typeof define === \"function\" && define.amd) {\n        define(\"mobx-react\", [\"mobx\", \"react\", \"react-dom\"], mrFactory)\n    } else if (typeof exports === \"object\") {\n        module.exports = mrFactory(require(\"mobx\"), require(\"react\"), require(\"react-dom\"))\n    } else {\n        this.mobxReact = mrFactory(this[\"mobx\"], this[\"React\"], this[\"ReactDOM\"])\n    }\n})()\n"
  },
  {
    "path": "docs/assets/getting-started-assets/javascripts/mobx.umd.js",
    "content": ";(function(f) {\n    if (typeof exports === \"object\" && typeof module !== \"undefined\") {\n        module.exports = f()\n    } else if (typeof define === \"function\" && define.amd) {\n        define([], f)\n    } else {\n        var g\n        if (typeof window !== \"undefined\") {\n            g = window\n        } else if (typeof global !== \"undefined\") {\n            g = global\n        } else if (typeof self !== \"undefined\") {\n            g = self\n        } else {\n            g = this\n        }\n        g.mobx = f()\n    }\n})(function() {\n    var define, module, exports\n    return (function e(t, n, r) {\n        function s(o, u) {\n            if (!n[o]) {\n                if (!t[o]) {\n                    var a = typeof require == \"function\" && require\n                    if (!u && a) return a(o, !0)\n                    if (i) return i(o, !0)\n                    var f = new Error(\"Cannot find module '\" + o + \"'\")\n                    throw ((f.code = \"MODULE_NOT_FOUND\"), f)\n                }\n                var l = (n[o] = { exports: {} })\n                t[o][0].call(\n                    l.exports,\n                    function(e) {\n                        var n = t[o][1][e]\n                        return s(n ? n : e)\n                    },\n                    l,\n                    l.exports,\n                    e,\n                    t,\n                    n,\n                    r\n                )\n            }\n            return n[o].exports\n        }\n        var i = typeof require == \"function\" && require\n        for (var o = 0; o < r.length; o++) s(r[o])\n        return s\n    })(\n        {\n            1: [\n                function(require, module, exports) {\n                    ;(function(global) {\n                        var __extends =\n                            (this && this.__extends) ||\n                            function(d, b) {\n                                for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]\n                                function __() {\n                                    this.constructor = d\n                                }\n                                d.prototype =\n                                    b === null\n                                        ? Object.create(b)\n                                        : ((__.prototype = b.prototype), new __())\n                            }\n                        registerGlobals()\n                        exports._ = {\n                            quickDiff: quickDiff,\n                            resetGlobalState: resetGlobalState\n                        }\n                        exports.extras = {\n                            getDependencyTree: getDependencyTree,\n                            getObserverTree: getObserverTree,\n                            trackTransitions: trackTransitions,\n                            isComputingDerivation: isComputingDerivation,\n                            allowStateChanges: allowStateChanges\n                        }\n                        function autorun(view, scope) {\n                            assertUnwrapped(view, \"autorun methods cannot have modifiers\")\n                            invariant(typeof view === \"function\", \"autorun expects a function\")\n                            invariant(\n                                view.length === 0,\n                                \"autorun expects a function without arguments\"\n                            )\n                            if (scope) view = view.bind(scope)\n                            var reaction = new Reaction(view.name || \"Autorun\", function() {\n                                this.track(view)\n                            })\n                            if (isComputingDerivation() || globalState.inTransaction > 0)\n                                globalState.pendingReactions.push(reaction)\n                            else reaction.runReaction()\n                            return reaction.getDisposer()\n                        }\n                        exports.autorun = autorun\n                        function when(predicate, effect, scope) {\n                            var disposeImmediately = false\n                            var disposer = autorun(function() {\n                                if (predicate.call(scope)) {\n                                    if (disposer) disposer()\n                                    else disposeImmediately = true\n                                    effect.call(scope)\n                                }\n                            })\n                            if (disposeImmediately) disposer()\n                            return disposer\n                        }\n                        exports.when = when\n                        function autorunUntil(predicate, effect, scope) {\n                            deprecated(\"`autorunUntil` is deprecated, please use `when`.\")\n                            return when.apply(null, arguments)\n                        }\n                        exports.autorunUntil = autorunUntil\n                        function autorunAsync(func, delay, scope) {\n                            if (delay === void 0) {\n                                delay = 1\n                            }\n                            if (scope) func = func.bind(scope)\n                            var isScheduled = false\n                            var r = new Reaction(func.name || \"AutorunAsync\", function() {\n                                if (!isScheduled) {\n                                    isScheduled = true\n                                    setTimeout(function() {\n                                        isScheduled = false\n                                        if (!r.isDisposed) r.track(func)\n                                    }, delay)\n                                }\n                            })\n                            r.runReaction()\n                            return r.getDisposer()\n                        }\n                        exports.autorunAsync = autorunAsync\n                        function computed(target, key, baseDescriptor, options) {\n                            if (arguments.length < 3 && typeof target === \"function\") {\n                                return observable(target, key)\n                            }\n                            if (arguments.length === 1) {\n                                var options_1 = target\n                                return function(target, key, baseDescriptor) {\n                                    return computed.call(\n                                        null,\n                                        target,\n                                        key,\n                                        baseDescriptor,\n                                        options_1\n                                    )\n                                }\n                            }\n                            invariant(\n                                baseDescriptor && baseDescriptor.hasOwnProperty(\"get\"),\n                                \"@computed can only be used on getter functions, like: '@computed get myProps() { return ...; }'\"\n                            )\n                            assertPropertyConfigurable(target, key)\n                            var descriptor = {}\n                            var getter = baseDescriptor.get\n                            invariant(\n                                typeof target === \"object\",\n                                \"The @observable decorator can only be used on objects\",\n                                key\n                            )\n                            invariant(\n                                typeof getter === \"function\",\n                                \"@observable expects a getter function if used on a property.\",\n                                key\n                            )\n                            invariant(\n                                !baseDescriptor.set,\n                                \"@observable properties cannot have a setter.\",\n                                key\n                            )\n                            invariant(\n                                getter.length === 0,\n                                \"@observable getter functions should not take arguments.\",\n                                key\n                            )\n                            descriptor.configurable = true\n                            descriptor.enumerable = false\n                            descriptor.get = function() {\n                                setObservableObjectProperty(\n                                    asObservableObject(this, undefined, ValueMode.Recursive),\n                                    key,\n                                    options && options.asStructure === true\n                                        ? asStructure(getter)\n                                        : getter\n                                )\n                                return this[key]\n                            }\n                            descriptor.set = throwingComputedValueSetter\n                            if (!baseDescriptor) {\n                                Object.defineProperty(target, key, descriptor)\n                            } else {\n                                return descriptor\n                            }\n                        }\n                        exports.computed = computed\n                        function throwingComputedValueSetter() {\n                            throw new Error(\n                                \"[ComputedValue] It is not allowed to assign new values to computed properties.\"\n                            )\n                        }\n                        function createTransformer(transformer, onCleanup) {\n                            invariant(\n                                typeof transformer === \"function\" && transformer.length === 1,\n                                \"createTransformer expects a function that accepts one argument\"\n                            )\n                            var objectCache = {}\n                            var Transformer = (function(_super) {\n                                __extends(Transformer, _super)\n                                function Transformer(sourceIdentifier, sourceObject) {\n                                    _super.call(\n                                        this,\n                                        function() {\n                                            return transformer(sourceObject)\n                                        },\n                                        null,\n                                        false,\n                                        \"Transformer-\" + transformer.name + \"-\" + sourceIdentifier\n                                    )\n                                    this.sourceIdentifier = sourceIdentifier\n                                    this.sourceObject = sourceObject\n                                }\n                                Transformer.prototype.onBecomeUnobserved = function() {\n                                    var lastValue = this.value\n                                    _super.prototype.onBecomeUnobserved.call(this)\n                                    delete objectCache[this.sourceIdentifier]\n                                    if (onCleanup) onCleanup(lastValue, this.sourceObject)\n                                }\n                                return Transformer\n                            })(ComputedValue)\n                            return function(object) {\n                                var identifier = getMemoizationId(object)\n                                var reactiveTransformer = objectCache[identifier]\n                                if (reactiveTransformer) return reactiveTransformer.get()\n                                reactiveTransformer = objectCache[identifier] = new Transformer(\n                                    identifier,\n                                    object\n                                )\n                                return reactiveTransformer.get()\n                            }\n                        }\n                        exports.createTransformer = createTransformer\n                        function getMemoizationId(object) {\n                            if (object === null || typeof object !== \"object\")\n                                throw new Error(\n                                    \"[mobx] transform expected some kind of object, got: \" + object\n                                )\n                            var tid = object.$transformId\n                            if (tid === undefined) return (object.$transformId = getNextId())\n                            return tid\n                        }\n                        function expr(expr, scope) {\n                            if (!isComputingDerivation())\n                                console.warn(\n                                    \"[mobx.expr] 'expr' should only be used inside other reactive functions.\"\n                                )\n                            return observable(expr, scope).get()\n                        }\n                        exports.expr = expr\n                        function extendObservable(target) {\n                            var properties = []\n                            for (var _i = 1; _i < arguments.length; _i++) {\n                                properties[_i - 1] = arguments[_i]\n                            }\n                            invariant(\n                                arguments.length >= 2,\n                                \"extendObservable expected 2 or more arguments\"\n                            )\n                            invariant(\n                                typeof target === \"object\",\n                                \"extendObservable expects an object as first argument\"\n                            )\n                            invariant(\n                                !(target instanceof ObservableMap),\n                                \"extendObservable should not be used on maps, use map.merge instead\"\n                            )\n                            properties.forEach(function(propSet) {\n                                invariant(\n                                    typeof propSet === \"object\",\n                                    \"all arguments of extendObservable should be objects\"\n                                )\n                                extendObservableHelper(target, propSet, ValueMode.Recursive, null)\n                            })\n                            return target\n                        }\n                        exports.extendObservable = extendObservable\n                        function extendObservableHelper(target, properties, mode, name) {\n                            var adm = asObservableObject(target, name, mode)\n                            for (var key in properties)\n                                if (properties.hasOwnProperty(key)) {\n                                    if (\n                                        target === properties &&\n                                        !isPropertyConfigurable(target, key)\n                                    )\n                                        continue\n                                    setObservableObjectProperty(adm, key, properties[key])\n                                }\n                            return target\n                        }\n                        function allowStateChanges(allowStateChanges, func) {\n                            var prev = globalState.allowStateChanges\n                            globalState.allowStateChanges = allowStateChanges\n                            var res = func()\n                            globalState.allowStateChanges = prev\n                            return res\n                        }\n                        var transitionTracker = null\n                        function reportTransition(node, state, changed) {\n                            if (changed === void 0) {\n                                changed = false\n                            }\n                            if (transitionTracker)\n                                transitionTracker.emit({\n                                    id: node.id,\n                                    name: node.name + \"@\" + node.id,\n                                    node: node,\n                                    state: state,\n                                    changed: changed\n                                })\n                        }\n                        function getDependencyTree(thing) {\n                            return nodeToDependencyTree(thing)\n                        }\n                        function nodeToDependencyTree(node) {\n                            var result = {\n                                id: node.id,\n                                name: node.name + \"@\" + node.id\n                            }\n                            if (node.observing && node.observing.length)\n                                result.dependencies = unique(node.observing).map(\n                                    nodeToDependencyTree\n                                )\n                            return result\n                        }\n                        function getObserverTree(thing) {\n                            return nodeToObserverTree(thing)\n                        }\n                        function nodeToObserverTree(node) {\n                            var result = {\n                                id: node.id,\n                                name: node.name + \"@\" + node.id\n                            }\n                            if (node.observers && node.observers.length)\n                                result.observers = unique(node.observers).map(nodeToObserverTree)\n                            return result\n                        }\n                        function createConsoleReporter(extensive) {\n                            var lines = []\n                            var scheduled = false\n                            return function(line) {\n                                if (extensive || line.changed) lines.push(line)\n                                if (!scheduled) {\n                                    scheduled = true\n                                    setTimeout(function() {\n                                        console[console[\"table\"] ? \"table\" : \"dir\"](lines)\n                                        lines = []\n                                        scheduled = false\n                                    }, 1)\n                                }\n                            }\n                        }\n                        function trackTransitions(extensive, onReport) {\n                            if (extensive === void 0) {\n                                extensive = false\n                            }\n                            if (!transitionTracker) transitionTracker = new SimpleEventEmitter()\n                            var reporter = onReport\n                                ? function(line) {\n                                      if (extensive || line.changed) onReport(line)\n                                  }\n                                : createConsoleReporter(extensive)\n                            var disposer = transitionTracker.on(reporter)\n                            return once(function() {\n                                disposer()\n                                if (transitionTracker.listeners.length === 0)\n                                    transitionTracker = null\n                            })\n                        }\n                        function isObservable(value, property) {\n                            if (value === null || value === undefined) return false\n                            if (property !== undefined) {\n                                if (\n                                    value instanceof ObservableMap ||\n                                    value instanceof ObservableArray\n                                )\n                                    throw new Error(\n                                        \"[mobx.isObservable] isObservable(object, propertyName) is not supported for arrays and maps. Use map.has or array.length instead.\"\n                                    )\n                                else if (isObservableObject(value)) {\n                                    var o = value.$mobx\n                                    return o.values && !!o.values[property]\n                                }\n                                return false\n                            }\n                            return (\n                                !!value.$mobx ||\n                                value instanceof Atom ||\n                                value instanceof Reaction ||\n                                value instanceof ComputedValue\n                            )\n                        }\n                        exports.isObservable = isObservable\n                        function observableDecorator(target, key, baseDescriptor) {\n                            invariant(\n                                arguments.length >= 2 && arguments.length <= 3,\n                                \"Illegal decorator config\",\n                                key\n                            )\n                            assertPropertyConfigurable(target, key)\n                            if (baseDescriptor && baseDescriptor.hasOwnProperty(\"get\")) {\n                                deprecated(\n                                    \"Using @observable on computed values is deprecated. Use @computed instead.\"\n                                )\n                                return computed.apply(null, arguments)\n                            }\n                            var descriptor = {}\n                            var baseValue = undefined\n                            if (baseDescriptor) {\n                                if (baseDescriptor.hasOwnProperty(\"value\"))\n                                    baseValue = baseDescriptor.value\n                                else if (baseDescriptor.initializer) {\n                                    baseValue = baseDescriptor.initializer()\n                                    if (typeof baseValue === \"function\")\n                                        baseValue = asReference(baseValue)\n                                }\n                            }\n                            invariant(\n                                typeof target === \"object\",\n                                \"The @observable decorator can only be used on objects\",\n                                key\n                            )\n                            descriptor.configurable = true\n                            descriptor.enumerable = true\n                            descriptor.get = function() {\n                                var _this = this\n                                allowStateChanges(true, function() {\n                                    setObservableObjectProperty(\n                                        asObservableObject(_this, undefined, ValueMode.Recursive),\n                                        key,\n                                        baseValue\n                                    )\n                                })\n                                return this[key]\n                            }\n                            descriptor.set = function(value) {\n                                setObservableObjectProperty(\n                                    asObservableObject(this, undefined, ValueMode.Recursive),\n                                    key,\n                                    typeof value === \"function\" ? asReference(value) : value\n                                )\n                            }\n                            if (!baseDescriptor) {\n                                Object.defineProperty(target, key, descriptor)\n                            } else {\n                                return descriptor\n                            }\n                        }\n                        function observable(v, keyOrScope) {\n                            if (typeof arguments[1] === \"string\")\n                                return observableDecorator.apply(null, arguments)\n                            invariant(\n                                arguments.length === 1 || arguments.length === 2,\n                                \"observable expects one or two arguments\"\n                            )\n                            if (isObservable(v)) return v\n                            var _a = getValueModeFromValue(v, ValueMode.Recursive),\n                                mode = _a[0],\n                                value = _a[1]\n                            var sourceType =\n                                mode === ValueMode.Reference\n                                    ? ValueType.Reference\n                                    : getTypeOfValue(value)\n                            switch (sourceType) {\n                                case ValueType.Array:\n                                case ValueType.PlainObject:\n                                    return makeChildObservable(value, mode)\n                                case ValueType.Reference:\n                                case ValueType.ComplexObject:\n                                    observableIsDeprecated()\n                                    return new ObservableValue(value, mode)\n                                case ValueType.ComplexFunction:\n                                    observableIsDeprecated()\n                                    throw new Error(\n                                        \"[mobx.observable] To be able to make a function reactive it should not have arguments. If you need an observable reference to a function, use `observable(asReference(f))`\"\n                                    )\n                                case ValueType.ViewFunction:\n                                    observableIsDeprecated()\n                                    return new ComputedValue(\n                                        value,\n                                        keyOrScope,\n                                        mode === ValueMode.Structure,\n                                        value.name || \"ComputedValue\"\n                                    )\n                            }\n                            invariant(false, \"Illegal State\")\n                        }\n                        exports.observable = observable\n                        function observableIsDeprecated() {\n                            deprecated(\n                                \"Invoking observable() on scalar values is deprecated. Use extendObservable or @observable instead.\"\n                            )\n                        }\n                        var ValueType\n                        ;(function(ValueType) {\n                            ValueType[(ValueType[\"Reference\"] = 0)] = \"Reference\"\n                            ValueType[(ValueType[\"PlainObject\"] = 1)] = \"PlainObject\"\n                            ValueType[(ValueType[\"ComplexObject\"] = 2)] = \"ComplexObject\"\n                            ValueType[(ValueType[\"Array\"] = 3)] = \"Array\"\n                            ValueType[(ValueType[\"ViewFunction\"] = 4)] = \"ViewFunction\"\n                            ValueType[(ValueType[\"ComplexFunction\"] = 5)] = \"ComplexFunction\"\n                        })(ValueType || (ValueType = {}))\n                        function getTypeOfValue(value) {\n                            if (value === null || value === undefined) return ValueType.Reference\n                            if (typeof value === \"function\")\n                                return value.length\n                                    ? ValueType.ComplexFunction\n                                    : ValueType.ViewFunction\n                            if (Array.isArray(value) || value instanceof ObservableArray)\n                                return ValueType.Array\n                            if (typeof value === \"object\")\n                                return isPlainObject(value)\n                                    ? ValueType.PlainObject\n                                    : ValueType.ComplexObject\n                            return ValueType.Reference\n                        }\n                        function observe(thing, propOrCb, cbOrFire, fireImmediately) {\n                            if (typeof cbOrFire === \"function\")\n                                return observeObservableProperty(\n                                    thing,\n                                    propOrCb,\n                                    cbOrFire,\n                                    fireImmediately\n                                )\n                            else return observeObservable(thing, propOrCb, cbOrFire)\n                        }\n                        exports.observe = observe\n                        function observeObservable(thing, listener, fireImmediately) {\n                            if (isObservableArray(thing)) return thing.observe(listener)\n                            if (isObservableMap(thing)) return thing.observe(listener)\n                            if (isObservableObject(thing))\n                                return observeObservableObject(thing, listener, fireImmediately)\n                            if (thing instanceof ObservableValue || thing instanceof ComputedValue)\n                                return thing.observe(listener, fireImmediately)\n                            if (isPlainObject(thing))\n                                return observeObservable(\n                                    observable(thing),\n                                    listener,\n                                    fireImmediately\n                                )\n                            invariant(\n                                false,\n                                \"first argument of observe should be some observable value or plain object\"\n                            )\n                        }\n                        function observeObservableProperty(\n                            thing,\n                            property,\n                            listener,\n                            fireImmediately\n                        ) {\n                            var propError =\n                                \"[mobx.observe] the provided observable map has no key with name: \" +\n                                property\n                            if (isObservableMap(thing)) {\n                                if (!thing._has(property)) throw new Error(propError)\n                                return observe(thing._data[property], listener)\n                            }\n                            if (isObservableObject(thing)) {\n                                if (!isObservable(thing, property)) throw new Error(propError)\n                                return observe(\n                                    thing.$mobx.values[property],\n                                    listener,\n                                    fireImmediately\n                                )\n                            }\n                            if (isPlainObject(thing)) {\n                                extendObservable(thing, {\n                                    property: thing[property]\n                                })\n                                return observeObservableProperty(\n                                    thing,\n                                    property,\n                                    listener,\n                                    fireImmediately\n                                )\n                            }\n                            invariant(\n                                false,\n                                \"first argument of observe should be an (observable)object or observableMap if a property name is given\"\n                            )\n                        }\n                        function toJSON(source, detectCycles, __alreadySeen) {\n                            if (detectCycles === void 0) {\n                                detectCycles = true\n                            }\n                            if (__alreadySeen === void 0) {\n                                __alreadySeen = null\n                            }\n                            function cache(value) {\n                                if (detectCycles) __alreadySeen.push([source, value])\n                                return value\n                            }\n                            if (detectCycles && __alreadySeen === null) __alreadySeen = []\n                            if (detectCycles && source !== null && typeof source === \"object\") {\n                                for (var i = 0, l = __alreadySeen.length; i < l; i++)\n                                    if (__alreadySeen[i][0] === source) return __alreadySeen[i][1]\n                            }\n                            if (!source) return source\n                            if (Array.isArray(source) || source instanceof ObservableArray) {\n                                var res = cache([])\n                                res.push.apply(\n                                    res,\n                                    source.map(function(value) {\n                                        return toJSON(value, detectCycles, __alreadySeen)\n                                    })\n                                )\n                                return res\n                            }\n                            if (source instanceof ObservableMap) {\n                                var res = cache({})\n                                source.forEach(function(value, key) {\n                                    return (res[key] = toJSON(value, detectCycles, __alreadySeen))\n                                })\n                                return res\n                            }\n                            if (typeof source === \"object\" && isPlainObject(source)) {\n                                var res = cache({})\n                                for (var key in source)\n                                    if (source.hasOwnProperty(key))\n                                        res[key] = toJSON(source[key], detectCycles, __alreadySeen)\n                                return res\n                            }\n                            if (isObservable(source) && source.$mobx instanceof ObservableValue)\n                                return toJSON(source(), detectCycles, __alreadySeen)\n                            return source\n                        }\n                        exports.toJSON = toJSON\n                        function propagateAtomReady(atom) {\n                            invariant(atom.isDirty, \"atom not dirty\")\n                            atom.isDirty = false\n                            reportTransition(atom, \"READY\", true)\n                            propagateReadiness(atom, true)\n                        }\n                        var Atom = (function() {\n                            function Atom(name, onBecomeObserved, onBecomeUnobserved) {\n                                if (name === void 0) {\n                                    name = \"Atom\"\n                                }\n                                if (onBecomeObserved === void 0) {\n                                    onBecomeObserved = noop\n                                }\n                                if (onBecomeUnobserved === void 0) {\n                                    onBecomeUnobserved = noop\n                                }\n                                this.name = name\n                                this.onBecomeObserved = onBecomeObserved\n                                this.onBecomeUnobserved = onBecomeUnobserved\n                                this.id = getNextId()\n                                this.isDirty = false\n                                this.staleObservers = []\n                                this.observers = []\n                            }\n                            Atom.prototype.reportObserved = function() {\n                                reportObserved(this)\n                            }\n                            Atom.prototype.reportChanged = function() {\n                                if (!this.isDirty) {\n                                    this.reportStale()\n                                    this.reportReady()\n                                }\n                            }\n                            Atom.prototype.reportStale = function() {\n                                if (!this.isDirty) {\n                                    this.isDirty = true\n                                    reportTransition(this, \"STALE\")\n                                    propagateStaleness(this)\n                                }\n                            }\n                            Atom.prototype.reportReady = function() {\n                                invariant(this.isDirty, \"atom not dirty\")\n                                if (globalState.inTransaction > 0)\n                                    globalState.changedAtoms.push(this)\n                                else {\n                                    propagateAtomReady(this)\n                                    runReactions()\n                                }\n                            }\n                            Atom.prototype.toString = function() {\n                                return this.name + \"@\" + this.id\n                            }\n                            return Atom\n                        })()\n                        exports.Atom = Atom\n                        var ComputedValue = (function() {\n                            function ComputedValue(derivation, scope, compareStructural, name) {\n                                var _this = this\n                                if (name === void 0) {\n                                    name = \"ComputedValue\"\n                                }\n                                this.derivation = derivation\n                                this.scope = scope\n                                this.compareStructural = compareStructural\n                                this.name = name\n                                this.id = getNextId()\n                                this.isLazy = true\n                                this.isComputing = false\n                                this.staleObservers = []\n                                this.observers = []\n                                this.observing = []\n                                this.dependencyChangeCount = 0\n                                this.dependencyStaleCount = 0\n                                this.value = undefined\n                                this.peek = function() {\n                                    _this.isComputing = true\n                                    globalState.isComputingComputedValue++\n                                    var prevAllowStateChanges = globalState.allowStateChanges\n                                    globalState.allowStateChanges = false\n                                    var res = derivation.call(scope)\n                                    globalState.allowStateChanges = prevAllowStateChanges\n                                    globalState.isComputingComputedValue--\n                                    _this.isComputing = false\n                                    return res\n                                }\n                            }\n                            ComputedValue.prototype.onBecomeObserved = function() {}\n                            ComputedValue.prototype.onBecomeUnobserved = function() {\n                                for (var i = 0, l = this.observing.length; i < l; i++)\n                                    removeObserver(this.observing[i], this)\n                                this.observing = []\n                                this.isLazy = true\n                                this.value = undefined\n                            }\n                            ComputedValue.prototype.onDependenciesReady = function() {\n                                var changed = this.trackAndCompute()\n                                reportTransition(this, \"READY\", changed)\n                                return changed\n                            }\n                            ComputedValue.prototype.get = function() {\n                                invariant(!this.isComputing, \"Cycle detected\", this.derivation)\n                                if (\n                                    this.dependencyStaleCount > 0 &&\n                                    globalState.inTransaction > 0\n                                ) {\n                                    return this.peek()\n                                }\n                                if (this.isLazy) {\n                                    if (isComputingDerivation()) {\n                                        this.isLazy = false\n                                        this.trackAndCompute()\n                                        reportObserved(this)\n                                    } else {\n                                        return this.peek()\n                                    }\n                                } else {\n                                    reportObserved(this)\n                                }\n                                return this.value\n                            }\n                            ComputedValue.prototype.set = function(_) {\n                                throw new Error(\n                                    \"[ComputedValue '\" +\n                                        name +\n                                        \"'] It is not possible to assign a new value to a computed value.\"\n                                )\n                            }\n                            ComputedValue.prototype.trackAndCompute = function() {\n                                var oldValue = this.value\n                                this.value = trackDerivedFunction(this, this.peek)\n                                return valueDidChange(this.compareStructural, this.value, oldValue)\n                            }\n                            ComputedValue.prototype.observe = function(listener, fireImmediately) {\n                                var _this = this\n                                var firstTime = true\n                                var prevValue = undefined\n                                return autorun(function() {\n                                    var newValue = _this.get()\n                                    if (!firstTime || fireImmediately) {\n                                        listener(newValue, prevValue)\n                                    }\n                                    firstTime = false\n                                    prevValue = newValue\n                                })\n                            }\n                            ComputedValue.prototype.toString = function() {\n                                return (\n                                    this.name +\n                                    \"@\" +\n                                    this.id +\n                                    \"[\" +\n                                    this.derivation.toString() +\n                                    \"]\"\n                                )\n                            }\n                            return ComputedValue\n                        })()\n                        function isComputingDerivation() {\n                            return globalState.derivationStack.length > 0\n                        }\n                        function checkIfStateModificationsAreAllowed() {\n                            invariant(\n                                globalState.allowStateChanges,\n                                \"It is not allowed to change the state when a computed value is being evaluated. Use 'autorun' to create reactive functions with side-effects. Or use 'extras.allowStateChanges(true, block)' to supress this message.\"\n                            )\n                        }\n                        function notifyDependencyStale(derivation) {\n                            if (++derivation.dependencyStaleCount === 1) {\n                                reportTransition(derivation, \"STALE\")\n                                propagateStaleness(derivation)\n                            }\n                        }\n                        function notifyDependencyReady(derivation, dependencyDidChange) {\n                            invariant(\n                                derivation.dependencyStaleCount > 0,\n                                \"unexpected ready notification\"\n                            )\n                            if (dependencyDidChange) derivation.dependencyChangeCount += 1\n                            if (--derivation.dependencyStaleCount === 0) {\n                                if (derivation.dependencyChangeCount > 0) {\n                                    derivation.dependencyChangeCount = 0\n                                    reportTransition(derivation, \"PENDING\")\n                                    var changed = derivation.onDependenciesReady()\n                                    propagateReadiness(derivation, changed)\n                                } else {\n                                    reportTransition(derivation, \"READY\", false)\n                                    propagateReadiness(derivation, false)\n                                }\n                            }\n                        }\n                        function trackDerivedFunction(derivation, f) {\n                            var prevObserving = derivation.observing\n                            derivation.observing = []\n                            globalState.derivationStack.push(derivation)\n                            var result = f()\n                            bindDependencies(derivation, prevObserving)\n                            return result\n                        }\n                        function bindDependencies(derivation, prevObserving) {\n                            globalState.derivationStack.length -= 1\n                            var _a = quickDiff(derivation.observing, prevObserving),\n                                added = _a[0],\n                                removed = _a[1]\n                            for (var i = 0, l = added.length; i < l; i++) {\n                                var dependency = added[i]\n                                invariant(\n                                    !findCycle(derivation, dependency),\n                                    \"Cycle detected\",\n                                    derivation\n                                )\n                                addObserver(added[i], derivation)\n                            }\n                            for (var i = 0, l = removed.length; i < l; i++)\n                                removeObserver(removed[i], derivation)\n                        }\n                        function findCycle(needle, node) {\n                            var obs = node.observing\n                            if (obs === undefined) return false\n                            if (obs.indexOf(node) !== -1) return true\n                            for (var l = obs.length, i = 0; i < l; i++)\n                                if (findCycle(needle, obs[i])) return true\n                            return false\n                        }\n                        var MobXGlobals = (function() {\n                            function MobXGlobals() {\n                                this.version = 1\n                                this.derivationStack = []\n                                this.mobxGuid = 0\n                                this.inTransaction = 0\n                                this.inUntracked = 0\n                                this.isRunningReactions = false\n                                this.isComputingComputedValue = 0\n                                this.changedAtoms = []\n                                this.pendingReactions = []\n                                this.allowStateChanges = true\n                            }\n                            return MobXGlobals\n                        })()\n                        var globalState = (function() {\n                            var res = new MobXGlobals()\n                            if (global.__mobservableTrackingStack || global.__mobservableViewStack)\n                                throw new Error(\n                                    \"[mobx] An incompatible version of mobservable is already loaded.\"\n                                )\n                            if (\n                                global.__mobxGlobal &&\n                                global.__mobxGlobal.version !== globalState.version\n                            )\n                                throw new Error(\n                                    \"[mobx] An incompatible version of mobx is already loaded.\"\n                                )\n                            if (global.__mobxGlobal) return global.__mobxGlobal\n                            return (global.__mobxGlobal = res)\n                        })()\n                        function getNextId() {\n                            return ++globalState.mobxGuid\n                        }\n                        function registerGlobals() {}\n                        function resetGlobalState() {\n                            var defaultGlobals = new MobXGlobals()\n                            for (var key in defaultGlobals) globalState[key] = defaultGlobals[key]\n                        }\n                        function addObserver(observable, node) {\n                            var obs = observable.observers,\n                                l = obs.length\n                            obs[l] = node\n                            if (l === 0) observable.onBecomeObserved()\n                        }\n                        function removeObserver(observable, node) {\n                            var obs = observable.observers,\n                                idx = obs.indexOf(node)\n                            if (idx !== -1) obs.splice(idx, 1)\n                            if (obs.length === 0) observable.onBecomeUnobserved()\n                        }\n                        function reportObserved(observable) {\n                            if (globalState.inUntracked > 0) return\n                            var derivationStack = globalState.derivationStack\n                            var l = derivationStack.length\n                            if (l > 0) {\n                                var deps = derivationStack[l - 1].observing,\n                                    depslength = deps.length\n                                if (\n                                    deps[depslength - 1] !== observable &&\n                                    deps[depslength - 2] !== observable\n                                )\n                                    deps[depslength] = observable\n                            }\n                        }\n                        function propagateStaleness(observable) {\n                            var os = observable.observers.slice()\n                            os.forEach(notifyDependencyStale)\n                            observable.staleObservers = observable.staleObservers.concat(os)\n                        }\n                        function propagateReadiness(observable, valueDidActuallyChange) {\n                            observable.staleObservers.splice(0).forEach(function(o) {\n                                return notifyDependencyReady(o, valueDidActuallyChange)\n                            })\n                        }\n                        function untracked(action) {\n                            deprecated(\n                                \"This feature is experimental and might be removed in a future minor release. Please report if you use this feature in production: https://github.com/mobxjs/mobx/issues/49\"\n                            )\n                            globalState.inUntracked++\n                            var res = action()\n                            globalState.inUntracked--\n                            return res\n                        }\n                        exports.untracked = untracked\n                        var Reaction = (function() {\n                            function Reaction(name, onInvalidate) {\n                                if (name === void 0) {\n                                    name = \"Reaction\"\n                                }\n                                this.name = name\n                                this.onInvalidate = onInvalidate\n                                this.id = getNextId()\n                                this.staleObservers = EMPTY_ARRAY\n                                this.observers = EMPTY_ARRAY\n                                this.observing = []\n                                this.dependencyChangeCount = 0\n                                this.dependencyStaleCount = 0\n                                this.isDisposed = false\n                                this._isScheduled = false\n                            }\n                            Reaction.prototype.onBecomeObserved = function() {}\n                            Reaction.prototype.onBecomeUnobserved = function() {}\n                            Reaction.prototype.onDependenciesReady = function() {\n                                if (!this._isScheduled) {\n                                    this._isScheduled = true\n                                    globalState.pendingReactions.push(this)\n                                }\n                                return false\n                            }\n                            Reaction.prototype.isScheduled = function() {\n                                return this.dependencyStaleCount > 0 || this._isScheduled\n                            }\n                            Reaction.prototype.runReaction = function() {\n                                if (!this.isDisposed) {\n                                    this._isScheduled = false\n                                    this.onInvalidate()\n                                    reportTransition(this, \"READY\", true)\n                                }\n                            }\n                            Reaction.prototype.track = function(fn) {\n                                trackDerivedFunction(this, fn)\n                            }\n                            Reaction.prototype.dispose = function() {\n                                if (!this.isDisposed) {\n                                    this.isDisposed = true\n                                    var deps = this.observing.splice(0)\n                                    for (var i = 0, l = deps.length; i < l; i++)\n                                        removeObserver(deps[i], this)\n                                }\n                            }\n                            Reaction.prototype.getDisposer = function() {\n                                var r = this.dispose.bind(this)\n                                r.$mobx = this\n                                return r\n                            }\n                            Reaction.prototype.toString = function() {\n                                return \"Reaction[\" + this.name + \"]\"\n                            }\n                            return Reaction\n                        })()\n                        exports.Reaction = Reaction\n                        var MAX_REACTION_ITERATIONS = 100\n                        function runReactions() {\n                            if (globalState.isRunningReactions) return\n                            globalState.isRunningReactions = true\n                            var pr = globalState.pendingReactions\n                            var iterations = 0\n                            while (pr.length) {\n                                if (++iterations === MAX_REACTION_ITERATIONS)\n                                    throw new Error(\n                                        \"Reaction doesn't converge to a stable state. Probably there is a cycle in the reactive function: \" +\n                                            pr[0].toString()\n                                    )\n                                var rs = pr.splice(0)\n                                for (var i = 0, l = rs.length; i < l; i++) rs[i].runReaction()\n                            }\n                            globalState.isRunningReactions = false\n                        }\n                        function transaction(action, thisArg) {\n                            globalState.inTransaction += 1\n                            var res = action.call(thisArg)\n                            if (--globalState.inTransaction === 0) {\n                                var values = globalState.changedAtoms.splice(0)\n                                for (var i = 0, l = values.length; i < l; i++)\n                                    propagateAtomReady(values[i])\n                                runReactions()\n                            }\n                            return res\n                        }\n                        exports.transaction = transaction\n                        var ValueMode\n                        ;(function(ValueMode) {\n                            ValueMode[(ValueMode[\"Recursive\"] = 0)] = \"Recursive\"\n                            ValueMode[(ValueMode[\"Reference\"] = 1)] = \"Reference\"\n                            ValueMode[(ValueMode[\"Structure\"] = 2)] = \"Structure\"\n                            ValueMode[(ValueMode[\"Flat\"] = 3)] = \"Flat\"\n                        })(ValueMode || (ValueMode = {}))\n                        function asReference(value) {\n                            return new AsReference(value)\n                        }\n                        exports.asReference = asReference\n                        function asStructure(value) {\n                            return new AsStructure(value)\n                        }\n                        exports.asStructure = asStructure\n                        function asFlat(value) {\n                            return new AsFlat(value)\n                        }\n                        exports.asFlat = asFlat\n                        var AsReference = (function() {\n                            function AsReference(value) {\n                                this.value = value\n                                assertUnwrapped(value, \"Modifiers are not allowed to be nested\")\n                            }\n                            return AsReference\n                        })()\n                        var AsStructure = (function() {\n                            function AsStructure(value) {\n                                this.value = value\n                                assertUnwrapped(value, \"Modifiers are not allowed to be nested\")\n                            }\n                            return AsStructure\n                        })()\n                        var AsFlat = (function() {\n                            function AsFlat(value) {\n                                this.value = value\n                                assertUnwrapped(value, \"Modifiers are not allowed to be nested\")\n                            }\n                            return AsFlat\n                        })()\n                        function getValueModeFromValue(value, defaultMode) {\n                            if (value instanceof AsReference)\n                                return [ValueMode.Reference, value.value]\n                            if (value instanceof AsStructure)\n                                return [ValueMode.Structure, value.value]\n                            if (value instanceof AsFlat) return [ValueMode.Flat, value.value]\n                            return [defaultMode, value]\n                        }\n                        function getValueModeFromModifierFunc(func) {\n                            if (func === asReference) return ValueMode.Reference\n                            else if (func === asStructure) return ValueMode.Structure\n                            else if (func === asFlat) return ValueMode.Flat\n                            invariant(\n                                func === undefined,\n                                \"Cannot determine value mode from function. Please pass in one of these: mobx.asReference, mobx.asStructure or mobx.asFlat, got: \" +\n                                    func\n                            )\n                            return ValueMode.Recursive\n                        }\n                        function makeChildObservable(value, parentMode, name) {\n                            var childMode\n                            if (isObservable(value)) return value\n                            switch (parentMode) {\n                                case ValueMode.Reference:\n                                    return value\n                                case ValueMode.Flat:\n                                    assertUnwrapped(\n                                        value,\n                                        \"Items inside 'asFlat' canont have modifiers\"\n                                    )\n                                    childMode = ValueMode.Reference\n                                    break\n                                case ValueMode.Structure:\n                                    assertUnwrapped(\n                                        value,\n                                        \"Items inside 'asStructure' canont have modifiers\"\n                                    )\n                                    childMode = ValueMode.Structure\n                                    break\n                                case ValueMode.Recursive:\n                                    ;(_a = getValueModeFromValue(value, ValueMode.Recursive)),\n                                        (childMode = _a[0]),\n                                        (value = _a[1])\n                                    break\n                                default:\n                                    invariant(false, \"Illegal State\")\n                            }\n                            if (Array.isArray(value) && Object.isExtensible(value))\n                                return createObservableArray(value, childMode, name)\n                            if (isPlainObject(value) && Object.isExtensible(value))\n                                return extendObservableHelper(value, value, childMode, name)\n                            return value\n                            var _a\n                        }\n                        function assertUnwrapped(value, message) {\n                            if (\n                                value instanceof AsReference ||\n                                value instanceof AsStructure ||\n                                value instanceof AsFlat\n                            )\n                                throw new Error(\n                                    \"[mobx] asStructure / asReference / asFlat cannot be used here. \" +\n                                        message\n                                )\n                        }\n                        var OBSERVABLE_ARRAY_BUFFER_SIZE = 0\n                        var StubArray = (function() {\n                            function StubArray() {}\n                            return StubArray\n                        })()\n                        StubArray.prototype = []\n                        function getArrayLength(adm) {\n                            adm.atom.reportObserved()\n                            return adm.values.length\n                        }\n                        function setArrayLength(adm, newLength) {\n                            if (typeof newLength !== \"number\" || newLength < 0)\n                                throw new Error(\"[mobx.array] Out of range: \" + newLength)\n                            var currentLength = adm.values.length\n                            if (newLength === currentLength) return\n                            else if (newLength > currentLength)\n                                spliceWithArray(\n                                    adm,\n                                    currentLength,\n                                    0,\n                                    new Array(newLength - currentLength)\n                                )\n                            else spliceWithArray(adm, newLength, currentLength - newLength)\n                        }\n                        function updateArrayLength(adm, oldLength, delta) {\n                            if (oldLength !== adm.lastKnownLength)\n                                throw new Error(\n                                    \"[mobx] Modification exception: the internal structure of an observable array was changed. Did you use peek() to change it?\"\n                                )\n                            checkIfStateModificationsAreAllowed()\n                            adm.lastKnownLength += delta\n                            if (delta > 0 && oldLength + delta > OBSERVABLE_ARRAY_BUFFER_SIZE)\n                                reserveArrayBuffer(oldLength + delta)\n                        }\n                        function spliceWithArray(adm, index, deleteCount, newItems) {\n                            var length = adm.values.length\n                            if (\n                                (newItems === undefined || newItems.length === 0) &&\n                                (deleteCount === 0 || length === 0)\n                            )\n                                return []\n                            if (index === undefined) index = 0\n                            else if (index > length) index = length\n                            else if (index < 0) index = Math.max(0, length + index)\n                            if (arguments.length === 2) deleteCount = length - index\n                            else if (deleteCount === undefined || deleteCount === null)\n                                deleteCount = 0\n                            else deleteCount = Math.max(0, Math.min(deleteCount, length - index))\n                            if (newItems === undefined) newItems = EMPTY_ARRAY\n                            else newItems = newItems.map(adm.makeChildReactive)\n                            var lengthDelta = newItems.length - deleteCount\n                            updateArrayLength(adm, length, lengthDelta)\n                            var res = (_a = adm.values).splice.apply(\n                                _a,\n                                [index, deleteCount].concat(newItems)\n                            )\n                            notifyArraySplice(adm, index, res, newItems)\n                            return res\n                            var _a\n                        }\n                        function makeReactiveArrayItem(value) {\n                            assertUnwrapped(value, \"Array values cannot have modifiers\")\n                            if (this.mode === ValueMode.Flat || this.mode === ValueMode.Reference)\n                                return value\n                            return makeChildObservable(\n                                value,\n                                this.mode,\n                                this.atom.name + \"@\" + this.atom.id + \" / ArrayEntry\"\n                            )\n                        }\n                        function notifyArrayChildUpdate(adm, index, oldValue) {\n                            adm.atom.reportChanged()\n                            if (adm.changeEvent)\n                                adm.changeEvent.emit({\n                                    object: adm.array,\n                                    type: \"update\",\n                                    index: index,\n                                    oldValue: oldValue\n                                })\n                        }\n                        function notifyArraySplice(adm, index, deleted, added) {\n                            if (deleted.length === 0 && added.length === 0) return\n                            adm.atom.reportChanged()\n                            if (adm.changeEvent)\n                                adm.changeEvent.emit({\n                                    object: adm.array,\n                                    type: \"splice\",\n                                    index: index,\n                                    addedCount: added.length,\n                                    removed: deleted\n                                })\n                        }\n                        var ObservableArray = (function(_super) {\n                            __extends(ObservableArray, _super)\n                            function ObservableArray(initialValues, mode, name) {\n                                _super.call(this)\n                                var adm = (this.$mobx = {\n                                    atom: new Atom(name || \"ObservableArray\"),\n                                    values: undefined,\n                                    changeEvent: undefined,\n                                    lastKnownLength: 0,\n                                    mode: mode,\n                                    array: this,\n                                    makeChildReactive: function(v) {\n                                        return makeReactiveArrayItem.call(adm, v)\n                                    }\n                                })\n                                Object.defineProperty(this, \"$mobx\", {\n                                    enumerable: false,\n                                    configurable: false,\n                                    writable: false\n                                })\n                                if (initialValues && initialValues.length) {\n                                    updateArrayLength(adm, 0, initialValues.length)\n                                    adm.values = initialValues.map(adm.makeChildReactive)\n                                } else adm.values = []\n                            }\n                            ObservableArray.prototype.observe = function(\n                                listener,\n                                fireImmediately\n                            ) {\n                                if (fireImmediately === void 0) {\n                                    fireImmediately = false\n                                }\n                                if (this.$mobx.changeEvent === undefined)\n                                    this.$mobx.changeEvent = new SimpleEventEmitter()\n                                if (fireImmediately)\n                                    listener({\n                                        object: this,\n                                        type: \"splice\",\n                                        index: 0,\n                                        addedCount: this.$mobx.values.length,\n                                        removed: []\n                                    })\n                                return this.$mobx.changeEvent.on(listener)\n                            }\n                            ObservableArray.prototype.clear = function() {\n                                return this.splice(0)\n                            }\n                            ObservableArray.prototype.replace = function(newItems) {\n                                return spliceWithArray(\n                                    this.$mobx,\n                                    0,\n                                    this.$mobx.values.length,\n                                    newItems\n                                )\n                            }\n                            ObservableArray.prototype.toJSON = function() {\n                                this.$mobx.atom.reportObserved()\n                                return this.$mobx.values.slice()\n                            }\n                            ObservableArray.prototype.peek = function() {\n                                return this.$mobx.values\n                            }\n                            ObservableArray.prototype.find = function(\n                                predicate,\n                                thisArg,\n                                fromIndex\n                            ) {\n                                if (fromIndex === void 0) {\n                                    fromIndex = 0\n                                }\n                                this.$mobx.atom.reportObserved()\n                                var items = this.$mobx.values,\n                                    l = items.length\n                                for (var i = fromIndex; i < l; i++)\n                                    if (predicate.call(thisArg, items[i], i, this)) return items[i]\n                                return null\n                            }\n                            ObservableArray.prototype.splice = function(index, deleteCount) {\n                                var newItems = []\n                                for (var _i = 2; _i < arguments.length; _i++) {\n                                    newItems[_i - 2] = arguments[_i]\n                                }\n                                switch (arguments.length) {\n                                    case 0:\n                                        return []\n                                    case 1:\n                                        return spliceWithArray(this.$mobx, index)\n                                    case 2:\n                                        return spliceWithArray(this.$mobx, index, deleteCount)\n                                }\n                                return spliceWithArray(this.$mobx, index, deleteCount, newItems)\n                            }\n                            ObservableArray.prototype.push = function() {\n                                var items = []\n                                for (var _i = 0; _i < arguments.length; _i++) {\n                                    items[_i - 0] = arguments[_i]\n                                }\n                                spliceWithArray(this.$mobx, this.$mobx.values.length, 0, items)\n                                return this.$mobx.values.length\n                            }\n                            ObservableArray.prototype.pop = function() {\n                                return this.splice(Math.max(this.$mobx.values.length - 1, 0), 1)[0]\n                            }\n                            ObservableArray.prototype.shift = function() {\n                                return this.splice(0, 1)[0]\n                            }\n                            ObservableArray.prototype.unshift = function() {\n                                var items = []\n                                for (var _i = 0; _i < arguments.length; _i++) {\n                                    items[_i - 0] = arguments[_i]\n                                }\n                                spliceWithArray(this.$mobx, 0, 0, items)\n                                return this.$mobx.values.length\n                            }\n                            ObservableArray.prototype.reverse = function() {\n                                this.$mobx.atom.reportObserved()\n                                var clone = this.slice()\n                                return clone.reverse.apply(clone, arguments)\n                            }\n                            ObservableArray.prototype.sort = function(compareFn) {\n                                this.$mobx.atom.reportObserved()\n                                var clone = this.slice()\n                                return clone.sort.apply(clone, arguments)\n                            }\n                            ObservableArray.prototype.remove = function(value) {\n                                var idx = this.$mobx.values.indexOf(value)\n                                if (idx > -1) {\n                                    this.splice(idx, 1)\n                                    return true\n                                }\n                                return false\n                            }\n                            ObservableArray.prototype.toString = function() {\n                                return (\n                                    \"[mobx.array] \" +\n                                    Array.prototype.toString.apply(this.$mobx.values, arguments)\n                                )\n                            }\n                            ObservableArray.prototype.toLocaleString = function() {\n                                return (\n                                    \"[mobx.array] \" +\n                                    Array.prototype.toLocaleString.apply(\n                                        this.$mobx.values,\n                                        arguments\n                                    )\n                                )\n                            }\n                            return ObservableArray\n                        })(StubArray)\n                        makeNonEnumerable(ObservableArray.prototype, [\n                            \"constructor\",\n                            \"clear\",\n                            \"find\",\n                            \"observe\",\n                            \"pop\",\n                            \"peek\",\n                            \"push\",\n                            \"remove\",\n                            \"replace\",\n                            \"reverse\",\n                            \"shift\",\n                            \"sort\",\n                            \"splice\",\n                            \"split\",\n                            \"toJSON\",\n                            \"toLocaleString\",\n                            \"toString\",\n                            \"unshift\"\n                        ])\n                        Object.defineProperty(ObservableArray.prototype, \"length\", {\n                            enumerable: false,\n                            configurable: true,\n                            get: function() {\n                                return getArrayLength(this.$mobx)\n                            },\n                            set: function(newLength) {\n                                setArrayLength(this.$mobx, newLength)\n                            }\n                        })\n                        ;[\n                            \"concat\",\n                            \"every\",\n                            \"filter\",\n                            \"forEach\",\n                            \"indexOf\",\n                            \"join\",\n                            \"lastIndexOf\",\n                            \"map\",\n                            \"reduce\",\n                            \"reduceRight\",\n                            \"slice\",\n                            \"some\"\n                        ].forEach(function(funcName) {\n                            var baseFunc = Array.prototype[funcName]\n                            Object.defineProperty(ObservableArray.prototype, funcName, {\n                                configurable: false,\n                                writable: true,\n                                enumerable: false,\n                                value: function() {\n                                    this.$mobx.atom.reportObserved()\n                                    return baseFunc.apply(this.$mobx.values, arguments)\n                                }\n                            })\n                        })\n                        function createArrayBufferItem(index) {\n                            Object.defineProperty(ObservableArray.prototype, \"\" + index, {\n                                enumerable: false,\n                                configurable: false,\n                                set: function(value) {\n                                    var impl = this.$mobx\n                                    var values = impl.values\n                                    assertUnwrapped(\n                                        value,\n                                        \"Modifiers cannot be used on array values. For non-reactive array values use makeReactive(asFlat(array)).\"\n                                    )\n                                    if (index < values.length) {\n                                        checkIfStateModificationsAreAllowed()\n                                        var oldValue = values[index]\n                                        var changed =\n                                            impl.mode === ValueMode.Structure\n                                                ? !deepEquals(oldValue, value)\n                                                : oldValue !== value\n                                        if (changed) {\n                                            values[index] = impl.makeChildReactive(value)\n                                            notifyArrayChildUpdate(impl, index, oldValue)\n                                        }\n                                    } else if (index === values.length)\n                                        spliceWithArray(impl, index, 0, [value])\n                                    else\n                                        throw new Error(\n                                            \"[mobx.array] Index out of bounds, \" +\n                                                index +\n                                                \" is larger than \" +\n                                                values.length\n                                        )\n                                },\n                                get: function() {\n                                    var impl = this.$mobx\n                                    if (impl && index < impl.values.length) {\n                                        impl.atom.reportObserved()\n                                        return impl.values[index]\n                                    }\n                                    return undefined\n                                }\n                            })\n                        }\n                        function reserveArrayBuffer(max) {\n                            for (var index = OBSERVABLE_ARRAY_BUFFER_SIZE; index < max; index++)\n                                createArrayBufferItem(index)\n                            OBSERVABLE_ARRAY_BUFFER_SIZE = max\n                        }\n                        reserveArrayBuffer(1000)\n                        function createObservableArray(initialValues, mode, name) {\n                            return new ObservableArray(initialValues, mode, name)\n                        }\n                        function fastArray(initialValues) {\n                            deprecated(\n                                \"fastArray is deprecated. Please use `observable(asFlat([]))`\"\n                            )\n                            return createObservableArray(initialValues, ValueMode.Flat, null)\n                        }\n                        exports.fastArray = fastArray\n                        function isObservableArray(thing) {\n                            return thing instanceof ObservableArray\n                        }\n                        exports.isObservableArray = isObservableArray\n                        var ObservableMapMarker = {}\n                        var ObservableMap = (function() {\n                            function ObservableMap(initialData, valueModeFunc) {\n                                var _this = this\n                                this.$mobx = ObservableMapMarker\n                                this._data = {}\n                                this._hasMap = {}\n                                this._events = undefined\n                                this.name = \"ObservableMap\"\n                                this.id = getNextId()\n                                this._keys = new ObservableArray(\n                                    null,\n                                    ValueMode.Reference,\n                                    this.name + \"@\" + this.id + \" / keys()\"\n                                )\n                                this._valueMode = getValueModeFromModifierFunc(valueModeFunc)\n                                if (isPlainObject(initialData)) this.merge(initialData)\n                                else if (Array.isArray(initialData))\n                                    initialData.forEach(function(_a) {\n                                        var key = _a[0],\n                                            value = _a[1]\n                                        return _this.set(key, value)\n                                    })\n                            }\n                            ObservableMap.prototype._has = function(key) {\n                                return typeof this._data[key] !== \"undefined\"\n                            }\n                            ObservableMap.prototype.has = function(key) {\n                                if (!this.isValidKey(key)) return false\n                                if (this._hasMap[key]) return this._hasMap[key].get()\n                                return this._updateHasMapEntry(key, false).get()\n                            }\n                            ObservableMap.prototype.set = function(key, value) {\n                                var _this = this\n                                this.assertValidKey(key)\n                                assertUnwrapped(\n                                    value,\n                                    \"[mobx.map.set] Expected unwrapped value to be inserted to key '\" +\n                                        key +\n                                        \"'. If you need to use modifiers pass them as second argument to the constructor\"\n                                )\n                                if (this._has(key)) {\n                                    var oldValue = this._data[key].value\n                                    var changed = this._data[key].set(value)\n                                    if (changed && this._events) {\n                                        this._events.emit({\n                                            type: \"update\",\n                                            object: this,\n                                            name: key,\n                                            oldValue: oldValue\n                                        })\n                                    }\n                                } else {\n                                    transaction(function() {\n                                        _this._data[key] = new ObservableValue(\n                                            value,\n                                            _this._valueMode,\n                                            _this.name + \"@\" + _this.id + ' / Entry \"' + key + '\"'\n                                        )\n                                        _this._updateHasMapEntry(key, true)\n                                        _this._keys.push(key)\n                                    })\n                                    this._events &&\n                                        this._events.emit({\n                                            type: \"add\",\n                                            object: this,\n                                            name: key\n                                        })\n                                }\n                            }\n                            ObservableMap.prototype.delete = function(key) {\n                                var _this = this\n                                if (this._has(key)) {\n                                    var oldValue = this._data[key].value\n                                    transaction(function() {\n                                        _this._keys.remove(key)\n                                        _this._updateHasMapEntry(key, false)\n                                        var observable = _this._data[key]\n                                        observable.set(undefined)\n                                        _this._data[key] = undefined\n                                    })\n                                    this._events &&\n                                        this._events.emit({\n                                            type: \"delete\",\n                                            object: this,\n                                            name: key,\n                                            oldValue: oldValue\n                                        })\n                                }\n                            }\n                            ObservableMap.prototype._updateHasMapEntry = function(key, value) {\n                                var entry = this._hasMap[key]\n                                if (entry) {\n                                    entry.set(value)\n                                } else {\n                                    entry = this._hasMap[key] = new ObservableValue(\n                                        value,\n                                        ValueMode.Reference,\n                                        this.name + \"@\" + this.id + ' / Contains \"' + key + '\"'\n                                    )\n                                }\n                                return entry\n                            }\n                            ObservableMap.prototype.get = function(key) {\n                                if (this.has(key)) return this._data[key].get()\n                                return undefined\n                            }\n                            ObservableMap.prototype.keys = function() {\n                                return this._keys.slice()\n                            }\n                            ObservableMap.prototype.values = function() {\n                                return this.keys().map(this.get, this)\n                            }\n                            ObservableMap.prototype.entries = function() {\n                                var _this = this\n                                return this.keys().map(function(key) {\n                                    return [key, _this.get(key)]\n                                })\n                            }\n                            ObservableMap.prototype.forEach = function(callback, thisArg) {\n                                var _this = this\n                                this.keys().forEach(function(key) {\n                                    return callback.call(thisArg, _this.get(key), key)\n                                })\n                            }\n                            ObservableMap.prototype.merge = function(other) {\n                                var _this = this\n                                transaction(function() {\n                                    if (other instanceof ObservableMap)\n                                        other.keys().forEach(function(key) {\n                                            return _this.set(key, other.get(key))\n                                        })\n                                    else\n                                        Object.keys(other).forEach(function(key) {\n                                            return _this.set(key, other[key])\n                                        })\n                                })\n                                return this\n                            }\n                            ObservableMap.prototype.clear = function() {\n                                var _this = this\n                                transaction(function() {\n                                    _this.keys().forEach(_this.delete, _this)\n                                })\n                            }\n                            Object.defineProperty(ObservableMap.prototype, \"size\", {\n                                get: function() {\n                                    return this._keys.length\n                                },\n                                enumerable: true,\n                                configurable: true\n                            })\n                            ObservableMap.prototype.toJs = function() {\n                                var _this = this\n                                var res = {}\n                                this.keys().forEach(function(key) {\n                                    return (res[key] = _this.get(key))\n                                })\n                                return res\n                            }\n                            ObservableMap.prototype.isValidKey = function(key) {\n                                if (key === null || key === undefined) return false\n                                if (typeof key !== \"string\" && typeof key !== \"number\") return false\n                                return true\n                            }\n                            ObservableMap.prototype.assertValidKey = function(key) {\n                                if (!this.isValidKey(key))\n                                    throw new Error(\"[mobx.map] Invalid key: '\" + key + \"'\")\n                            }\n                            ObservableMap.prototype.toString = function() {\n                                var _this = this\n                                return (\n                                    \"[mobx.map { \" +\n                                    this.keys()\n                                        .map(function(key) {\n                                            return key + \": \" + (\"\" + _this.get(key))\n                                        })\n                                        .join(\", \") +\n                                    \" }]\"\n                                )\n                            }\n                            ObservableMap.prototype.observe = function(callback) {\n                                if (!this._events) this._events = new SimpleEventEmitter()\n                                return this._events.on(callback)\n                            }\n                            return ObservableMap\n                        })()\n                        exports.ObservableMap = ObservableMap\n                        function map(initialValues, valueModifier) {\n                            return new ObservableMap(initialValues, valueModifier)\n                        }\n                        exports.map = map\n                        function isObservableMap(thing) {\n                            return thing instanceof ObservableMap\n                        }\n                        exports.isObservableMap = isObservableMap\n                        var ObservableObjectMarker = {}\n                        function asObservableObject(target, name, mode) {\n                            if (name === void 0) {\n                                name = \"ObservableObject\"\n                            }\n                            if (mode === void 0) {\n                                mode = ValueMode.Recursive\n                            }\n                            if (target.$mobx) {\n                                if (target.$mobx.type !== ObservableObjectMarker)\n                                    throw new Error(\n                                        \"The given object is observable but not an observable object\"\n                                    )\n                                return target.$mobx\n                            }\n                            var adm = {\n                                type: ObservableObjectMarker,\n                                values: {},\n                                events: undefined,\n                                id: getNextId(),\n                                target: target,\n                                name: name,\n                                mode: mode\n                            }\n                            Object.defineProperty(target, \"$mobx\", {\n                                enumerable: false,\n                                configurable: false,\n                                writable: false,\n                                value: adm\n                            })\n                            return adm\n                        }\n                        function setObservableObjectProperty(adm, propName, value) {\n                            if (adm.values[propName]) adm.target[propName] = value\n                            else defineObservableProperty(adm, propName, value)\n                        }\n                        function defineObservableProperty(adm, propName, value) {\n                            assertPropertyConfigurable(adm.target, propName)\n                            var observable\n                            var name = adm.name + \"@\" + adm.id + ' / Prop \"' + propName + '\"'\n                            if (typeof value === \"function\" && value.length === 0)\n                                observable = new ComputedValue(value, adm.target, false, name)\n                            else if (\n                                value instanceof AsStructure &&\n                                typeof value.value === \"function\" &&\n                                value.value.length === 0\n                            )\n                                observable = new ComputedValue(value.value, adm.target, true, name)\n                            else observable = new ObservableValue(value, adm.mode, name)\n                            adm.values[propName] = observable\n                            Object.defineProperty(adm.target, propName, {\n                                configurable: true,\n                                enumerable: observable instanceof ObservableValue,\n                                get: function() {\n                                    return observable.get()\n                                },\n                                set: function(newValue) {\n                                    var oldValue = observable.get()\n                                    if (observable.set(newValue) && adm.events !== undefined) {\n                                        adm.events.emit({\n                                            type: \"update\",\n                                            object: this,\n                                            name: propName,\n                                            oldValue: oldValue\n                                        })\n                                    }\n                                }\n                            })\n                            if (adm.events !== undefined) {\n                                adm.events.emit({\n                                    type: \"add\",\n                                    object: adm.target,\n                                    name: propName\n                                })\n                            }\n                        }\n                        function observeObservableObject(object, callback, fireImmediately) {\n                            invariant(isObservableObject(object), \"Expected observable object\")\n                            invariant(\n                                fireImmediately !== true,\n                                \"`observe` doesn't support the fire immediately property for observable objects.\"\n                            )\n                            var adm = object.$mobx\n                            if (adm.events === undefined) adm.events = new SimpleEventEmitter()\n                            return object.$mobx.events.on(callback)\n                        }\n                        function isObservableObject(thing) {\n                            return (\n                                thing && thing.$mobx && thing.$mobx.type === ObservableObjectMarker\n                            )\n                        }\n                        exports.isObservableObject = isObservableObject\n                        var ObservableValue = (function(_super) {\n                            __extends(ObservableValue, _super)\n                            function ObservableValue(value, mode, name) {\n                                if (name === void 0) {\n                                    name = \"ObservableValue\"\n                                }\n                                _super.call(this, name)\n                                this.mode = mode\n                                this.hasUnreportedChange = false\n                                this.events = null\n                                this.value = undefined\n                                var _a = getValueModeFromValue(value, ValueMode.Recursive),\n                                    childmode = _a[0],\n                                    unwrappedValue = _a[1]\n                                if (this.mode === ValueMode.Recursive) this.mode = childmode\n                                this.value = makeChildObservable(\n                                    unwrappedValue,\n                                    this.mode,\n                                    this.name\n                                )\n                            }\n                            ObservableValue.prototype.set = function(newValue) {\n                                assertUnwrapped(\n                                    newValue,\n                                    \"Modifiers cannot be used on non-initial values.\"\n                                )\n                                checkIfStateModificationsAreAllowed()\n                                var oldValue = this.value\n                                var changed = valueDidChange(\n                                    this.mode === ValueMode.Structure,\n                                    oldValue,\n                                    newValue\n                                )\n                                if (changed) {\n                                    this.value = makeChildObservable(newValue, this.mode, this.name)\n                                    this.reportChanged()\n                                    if (this.events) this.events.emit(newValue, oldValue)\n                                }\n                                return changed\n                            }\n                            ObservableValue.prototype.get = function() {\n                                this.reportObserved()\n                                return this.value\n                            }\n                            ObservableValue.prototype.observe = function(\n                                listener,\n                                fireImmediately\n                            ) {\n                                if (!this.events) this.events = new SimpleEventEmitter()\n                                if (fireImmediately) listener(this.value, undefined)\n                                return this.events.on(listener)\n                            }\n                            ObservableValue.prototype.toString = function() {\n                                return this.name + \"@\" + this.id + \"[\" + this.value + \"]\"\n                            }\n                            return ObservableValue\n                        })(Atom)\n                        var SimpleEventEmitter = (function() {\n                            function SimpleEventEmitter() {\n                                this.listeners = []\n                            }\n                            SimpleEventEmitter.prototype.emit = function() {\n                                var data = []\n                                for (var _i = 0; _i < arguments.length; _i++) {\n                                    data[_i - 0] = arguments[_i]\n                                }\n                                var listeners = this.listeners.slice()\n                                for (var i = 0, l = listeners.length; i < l; i++)\n                                    listeners[i].apply(null, arguments)\n                            }\n                            SimpleEventEmitter.prototype.on = function(listener) {\n                                var _this = this\n                                this.listeners.push(listener)\n                                return once(function() {\n                                    var idx = _this.listeners.indexOf(listener)\n                                    if (idx !== -1) _this.listeners.splice(idx, 1)\n                                })\n                            }\n                            SimpleEventEmitter.prototype.once = function(listener) {\n                                var subscription = this.on(function() {\n                                    subscription()\n                                    listener.apply(this, arguments)\n                                })\n                                return subscription\n                            }\n                            return SimpleEventEmitter\n                        })()\n                        exports.SimpleEventEmitter = SimpleEventEmitter\n                        var EMPTY_ARRAY = []\n                        Object.freeze(EMPTY_ARRAY)\n                        function invariant(check, message, thing) {\n                            if (!check)\n                                throw new Error(\n                                    \"[mobx] Invariant failed: \" +\n                                        message +\n                                        (thing ? \" in '\" + thing + \"'\" : \"\")\n                                )\n                        }\n                        var deprecatedMessages = []\n                        function deprecated(msg) {\n                            if (deprecatedMessages.indexOf(msg) !== -1) return\n                            deprecatedMessages.push(msg)\n                            console.error(\"[mobx] Deprecated: \" + msg)\n                        }\n                        function once(func) {\n                            var invoked = false\n                            return function() {\n                                if (invoked) return\n                                invoked = true\n                                return func.apply(this, arguments)\n                            }\n                        }\n                        var noop = function() {}\n                        function unique(list) {\n                            var res = []\n                            list.forEach(function(item) {\n                                if (res.indexOf(item) === -1) res.push(item)\n                            })\n                            return res\n                        }\n                        function isPlainObject(value) {\n                            return (\n                                value !== null &&\n                                typeof value === \"object\" &&\n                                Object.getPrototypeOf(value) === Object.prototype\n                            )\n                        }\n                        function valueDidChange(compareStructural, oldValue, newValue) {\n                            return compareStructural\n                                ? !deepEquals(oldValue, newValue)\n                                : oldValue !== newValue\n                        }\n                        function makeNonEnumerable(object, props) {\n                            for (var i = 0; i < props.length; i++) {\n                                Object.defineProperty(object, props[i], {\n                                    configurable: true,\n                                    writable: true,\n                                    enumerable: false,\n                                    value: object[props[i]]\n                                })\n                            }\n                        }\n                        function isPropertyConfigurable(object, prop) {\n                            var descriptor = Object.getOwnPropertyDescriptor(object, prop)\n                            return (\n                                !descriptor ||\n                                (descriptor.configurable !== false && descriptor.writable !== false)\n                            )\n                        }\n                        function assertPropertyConfigurable(object, prop) {\n                            invariant(\n                                isPropertyConfigurable(object, prop),\n                                \"Cannot make property '\" +\n                                    prop +\n                                    \"' observable, it is not configurable and writable in the target object\"\n                            )\n                        }\n                        function deepEquals(a, b) {\n                            if (a === null && b === null) return true\n                            if (a === undefined && b === undefined) return true\n                            var aIsArray = Array.isArray(a) || isObservableArray(a)\n                            if (aIsArray !== (Array.isArray(b) || isObservableArray(b))) {\n                                return false\n                            } else if (aIsArray) {\n                                if (a.length !== b.length) return false\n                                for (var i = a.length; i >= 0; i--)\n                                    if (!deepEquals(a[i], b[i])) return false\n                                return true\n                            } else if (typeof a === \"object\" && typeof b === \"object\") {\n                                if (a === null || b === null) return false\n                                if (Object.keys(a).length !== Object.keys(b).length) return false\n                                for (var prop in a) {\n                                    if (!b.hasOwnProperty(prop)) return false\n                                    if (!deepEquals(a[prop], b[prop])) return false\n                                }\n                                return true\n                            }\n                            return a === b\n                        }\n                        function quickDiff(current, base) {\n                            if (!base || !base.length) return [current, []]\n                            if (!current || !current.length) return [[], base]\n                            var added = []\n                            var removed = []\n                            var currentIndex = 0,\n                                currentSearch = 0,\n                                currentLength = current.length,\n                                currentExhausted = false,\n                                baseIndex = 0,\n                                baseSearch = 0,\n                                baseLength = base.length,\n                                isSearching = false,\n                                baseExhausted = false\n                            while (!baseExhausted && !currentExhausted) {\n                                if (!isSearching) {\n                                    if (\n                                        currentIndex < currentLength &&\n                                        baseIndex < baseLength &&\n                                        current[currentIndex] === base[baseIndex]\n                                    ) {\n                                        currentIndex++\n                                        baseIndex++\n                                        if (\n                                            currentIndex === currentLength &&\n                                            baseIndex === baseLength\n                                        )\n                                            return [added, removed]\n                                        continue\n                                    }\n                                    currentSearch = currentIndex\n                                    baseSearch = baseIndex\n                                    isSearching = true\n                                }\n                                baseSearch += 1\n                                currentSearch += 1\n                                if (baseSearch >= baseLength) baseExhausted = true\n                                if (currentSearch >= currentLength) currentExhausted = true\n                                if (\n                                    !currentExhausted &&\n                                    current[currentSearch] === base[baseIndex]\n                                ) {\n                                    added.push.apply(\n                                        added,\n                                        current.slice(currentIndex, currentSearch)\n                                    )\n                                    currentIndex = currentSearch + 1\n                                    baseIndex++\n                                    isSearching = false\n                                } else if (\n                                    !baseExhausted &&\n                                    base[baseSearch] === current[currentIndex]\n                                ) {\n                                    removed.push.apply(removed, base.slice(baseIndex, baseSearch))\n                                    baseIndex = baseSearch + 1\n                                    currentIndex++\n                                    isSearching = false\n                                }\n                            }\n                            added.push.apply(added, current.slice(currentIndex))\n                            removed.push.apply(removed, base.slice(baseIndex))\n                            return [added, removed]\n                        }\n                    }.call(\n                        this,\n                        typeof global !== \"undefined\"\n                            ? global\n                            : typeof self !== \"undefined\"\n                            ? self\n                            : typeof window !== \"undefined\"\n                            ? window\n                            : {}\n                    ))\n                },\n                {}\n            ]\n        },\n        {},\n        [1]\n    )(1)\n})\n"
  },
  {
    "path": "docs/assets/getting-started-assets/javascripts/react-with-addons.js",
    "content": "/**\n * React (with addons) v0.13.3\n */\n;(function(f) {\n    if (typeof exports === \"object\" && typeof module !== \"undefined\") {\n        module.exports = f()\n    } else if (typeof define === \"function\" && define.amd) {\n        define([], f)\n    } else {\n        var g\n        if (typeof window !== \"undefined\") {\n            g = window\n        } else if (typeof global !== \"undefined\") {\n            g = global\n        } else if (typeof self !== \"undefined\") {\n            g = self\n        } else {\n            g = this\n        }\n        g.React = f()\n    }\n})(function() {\n    var define, module, exports\n    return (function e(t, n, r) {\n        function s(o, u) {\n            if (!n[o]) {\n                if (!t[o]) {\n                    var a = typeof require == \"function\" && require\n                    if (!u && a) return a(o, !0)\n                    if (i) return i(o, !0)\n                    var f = new Error(\"Cannot find module '\" + o + \"'\")\n                    throw ((f.code = \"MODULE_NOT_FOUND\"), f)\n                }\n                var l = (n[o] = { exports: {} })\n                t[o][0].call(\n                    l.exports,\n                    function(e) {\n                        var n = t[o][1][e]\n                        return s(n ? n : e)\n                    },\n                    l,\n                    l.exports,\n                    e,\n                    t,\n                    n,\n                    r\n                )\n            }\n            return n[o].exports\n        }\n        var i = typeof require == \"function\" && require\n        for (var o = 0; o < r.length; o++) s(r[o])\n        return s\n    })(\n        {\n            1: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule ReactWithAddons\n                     */\n\n                    /**\n                     * This module exists purely in the open source project, and is meant as a way\n                     * to create a separate standalone build of React. This build has \"addons\", or\n                     * functionality we've built and think might be useful but doesn't have a good\n                     * place to live inside React core.\n                     */\n\n                    \"use strict\"\n\n                    var LinkedStateMixin = _dereq_(25)\n                    var React = _dereq_(31)\n                    var ReactComponentWithPureRenderMixin = _dereq_(42)\n                    var ReactCSSTransitionGroup = _dereq_(34)\n                    var ReactFragment = _dereq_(69)\n                    var ReactTransitionGroup = _dereq_(98)\n                    var ReactUpdates = _dereq_(100)\n\n                    var cx = _dereq_(127)\n                    var cloneWithProps = _dereq_(122)\n                    var update = _dereq_(170)\n\n                    React.addons = {\n                        CSSTransitionGroup: ReactCSSTransitionGroup,\n                        LinkedStateMixin: LinkedStateMixin,\n                        PureRenderMixin: ReactComponentWithPureRenderMixin,\n                        TransitionGroup: ReactTransitionGroup,\n\n                        batchedUpdates: ReactUpdates.batchedUpdates,\n                        classSet: cx,\n                        cloneWithProps: cloneWithProps,\n                        createFragment: ReactFragment.create,\n                        update: update\n                    }\n\n                    if (\"production\" !== \"development\") {\n                        React.addons.Perf = _dereq_(61)\n                        React.addons.TestUtils = _dereq_(95)\n                    }\n\n                    module.exports = React\n                },\n                {\n                    \"100\": 100,\n                    \"122\": 122,\n                    \"127\": 127,\n                    \"170\": 170,\n                    \"25\": 25,\n                    \"31\": 31,\n                    \"34\": 34,\n                    \"42\": 42,\n                    \"61\": 61,\n                    \"69\": 69,\n                    \"95\": 95,\n                    \"98\": 98\n                }\n            ],\n            2: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule AutoFocusMixin\n                     * @typechecks static-only\n                     */\n\n                    \"use strict\"\n\n                    var focusNode = _dereq_(134)\n\n                    var AutoFocusMixin = {\n                        componentDidMount: function() {\n                            if (this.props.autoFocus) {\n                                focusNode(this.getDOMNode())\n                            }\n                        }\n                    }\n\n                    module.exports = AutoFocusMixin\n                },\n                { \"134\": 134 }\n            ],\n            3: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015 Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule BeforeInputEventPlugin\n                     * @typechecks static-only\n                     */\n\n                    \"use strict\"\n\n                    var EventConstants = _dereq_(16)\n                    var EventPropagators = _dereq_(21)\n                    var ExecutionEnvironment = _dereq_(22)\n                    var FallbackCompositionState = _dereq_(23)\n                    var SyntheticCompositionEvent = _dereq_(106)\n                    var SyntheticInputEvent = _dereq_(110)\n\n                    var keyOf = _dereq_(157)\n\n                    var END_KEYCODES = [9, 13, 27, 32] // Tab, Return, Esc, Space\n                    var START_KEYCODE = 229\n\n                    var canUseCompositionEvent =\n                        ExecutionEnvironment.canUseDOM && \"CompositionEvent\" in window\n\n                    var documentMode = null\n                    if (ExecutionEnvironment.canUseDOM && \"documentMode\" in document) {\n                        documentMode = document.documentMode\n                    }\n\n                    // Webkit offers a very useful `textInput` event that can be used to\n                    // directly represent `beforeInput`. The IE `textinput` event is not as\n                    // useful, so we don't use it.\n                    var canUseTextInputEvent =\n                        ExecutionEnvironment.canUseDOM &&\n                        \"TextEvent\" in window &&\n                        !documentMode &&\n                        !isPresto()\n\n                    // In IE9+, we have access to composition events, but the data supplied\n                    // by the native compositionend event may be incorrect. Japanese ideographic\n                    // spaces, for instance (\\u3000) are not recorded correctly.\n                    var useFallbackCompositionData =\n                        ExecutionEnvironment.canUseDOM &&\n                        (!canUseCompositionEvent ||\n                            (documentMode && documentMode > 8 && documentMode <= 11))\n\n                    /**\n                     * Opera <= 12 includes TextEvent in window, but does not fire\n                     * text input events. Rely on keypress instead.\n                     */\n                    function isPresto() {\n                        var opera = window.opera\n                        return (\n                            typeof opera === \"object\" &&\n                            typeof opera.version === \"function\" &&\n                            parseInt(opera.version(), 10) <= 12\n                        )\n                    }\n\n                    var SPACEBAR_CODE = 32\n                    var SPACEBAR_CHAR = String.fromCharCode(SPACEBAR_CODE)\n\n                    var topLevelTypes = EventConstants.topLevelTypes\n\n                    // Events and their corresponding property names.\n                    var eventTypes = {\n                        beforeInput: {\n                            phasedRegistrationNames: {\n                                bubbled: keyOf({ onBeforeInput: null }),\n                                captured: keyOf({ onBeforeInputCapture: null })\n                            },\n                            dependencies: [\n                                topLevelTypes.topCompositionEnd,\n                                topLevelTypes.topKeyPress,\n                                topLevelTypes.topTextInput,\n                                topLevelTypes.topPaste\n                            ]\n                        },\n                        compositionEnd: {\n                            phasedRegistrationNames: {\n                                bubbled: keyOf({ onCompositionEnd: null }),\n                                captured: keyOf({ onCompositionEndCapture: null })\n                            },\n                            dependencies: [\n                                topLevelTypes.topBlur,\n                                topLevelTypes.topCompositionEnd,\n                                topLevelTypes.topKeyDown,\n                                topLevelTypes.topKeyPress,\n                                topLevelTypes.topKeyUp,\n                                topLevelTypes.topMouseDown\n                            ]\n                        },\n                        compositionStart: {\n                            phasedRegistrationNames: {\n                                bubbled: keyOf({ onCompositionStart: null }),\n                                captured: keyOf({ onCompositionStartCapture: null })\n                            },\n                            dependencies: [\n                                topLevelTypes.topBlur,\n                                topLevelTypes.topCompositionStart,\n                                topLevelTypes.topKeyDown,\n                                topLevelTypes.topKeyPress,\n                                topLevelTypes.topKeyUp,\n                                topLevelTypes.topMouseDown\n                            ]\n                        },\n                        compositionUpdate: {\n                            phasedRegistrationNames: {\n                                bubbled: keyOf({ onCompositionUpdate: null }),\n                                captured: keyOf({ onCompositionUpdateCapture: null })\n                            },\n                            dependencies: [\n                                topLevelTypes.topBlur,\n                                topLevelTypes.topCompositionUpdate,\n                                topLevelTypes.topKeyDown,\n                                topLevelTypes.topKeyPress,\n                                topLevelTypes.topKeyUp,\n                                topLevelTypes.topMouseDown\n                            ]\n                        }\n                    }\n\n                    // Track whether we've ever handled a keypress on the space key.\n                    var hasSpaceKeypress = false\n\n                    /**\n                     * Return whether a native keypress event is assumed to be a command.\n                     * This is required because Firefox fires `keypress` events for key commands\n                     * (cut, copy, select-all, etc.) even though no character is inserted.\n                     */\n                    function isKeypressCommand(nativeEvent) {\n                        return (\n                            (nativeEvent.ctrlKey || nativeEvent.altKey || nativeEvent.metaKey) &&\n                            // ctrlKey && altKey is equivalent to AltGr, and is not a command.\n                            !(nativeEvent.ctrlKey && nativeEvent.altKey)\n                        )\n                    }\n\n                    /**\n                     * Translate native top level events into event types.\n                     *\n                     * @param {string} topLevelType\n                     * @return {object}\n                     */\n                    function getCompositionEventType(topLevelType) {\n                        switch (topLevelType) {\n                            case topLevelTypes.topCompositionStart:\n                                return eventTypes.compositionStart\n                            case topLevelTypes.topCompositionEnd:\n                                return eventTypes.compositionEnd\n                            case topLevelTypes.topCompositionUpdate:\n                                return eventTypes.compositionUpdate\n                        }\n                    }\n\n                    /**\n                     * Does our fallback best-guess model think this event signifies that\n                     * composition has begun?\n                     *\n                     * @param {string} topLevelType\n                     * @param {object} nativeEvent\n                     * @return {boolean}\n                     */\n                    function isFallbackCompositionStart(topLevelType, nativeEvent) {\n                        return (\n                            topLevelType === topLevelTypes.topKeyDown &&\n                            nativeEvent.keyCode === START_KEYCODE\n                        )\n                    }\n\n                    /**\n                     * Does our fallback mode think that this event is the end of composition?\n                     *\n                     * @param {string} topLevelType\n                     * @param {object} nativeEvent\n                     * @return {boolean}\n                     */\n                    function isFallbackCompositionEnd(topLevelType, nativeEvent) {\n                        switch (topLevelType) {\n                            case topLevelTypes.topKeyUp:\n                                // Command keys insert or clear IME input.\n                                return END_KEYCODES.indexOf(nativeEvent.keyCode) !== -1\n                            case topLevelTypes.topKeyDown:\n                                // Expect IME keyCode on each keydown. If we get any other\n                                // code we must have exited earlier.\n                                return nativeEvent.keyCode !== START_KEYCODE\n                            case topLevelTypes.topKeyPress:\n                            case topLevelTypes.topMouseDown:\n                            case topLevelTypes.topBlur:\n                                // Events are not possible without cancelling IME.\n                                return true\n                            default:\n                                return false\n                        }\n                    }\n\n                    /**\n                     * Google Input Tools provides composition data via a CustomEvent,\n                     * with the `data` property populated in the `detail` object. If this\n                     * is available on the event object, use it. If not, this is a plain\n                     * composition event and we have nothing special to extract.\n                     *\n                     * @param {object} nativeEvent\n                     * @return {?string}\n                     */\n                    function getDataFromCustomEvent(nativeEvent) {\n                        var detail = nativeEvent.detail\n                        if (typeof detail === \"object\" && \"data\" in detail) {\n                            return detail.data\n                        }\n                        return null\n                    }\n\n                    // Track the current IME composition fallback object, if any.\n                    var currentComposition = null\n\n                    /**\n                     * @param {string} topLevelType Record from `EventConstants`.\n                     * @param {DOMEventTarget} topLevelTarget The listening component root node.\n                     * @param {string} topLevelTargetID ID of `topLevelTarget`.\n                     * @param {object} nativeEvent Native browser event.\n                     * @return {?object} A SyntheticCompositionEvent.\n                     */\n                    function extractCompositionEvent(\n                        topLevelType,\n                        topLevelTarget,\n                        topLevelTargetID,\n                        nativeEvent\n                    ) {\n                        var eventType\n                        var fallbackData\n\n                        if (canUseCompositionEvent) {\n                            eventType = getCompositionEventType(topLevelType)\n                        } else if (!currentComposition) {\n                            if (isFallbackCompositionStart(topLevelType, nativeEvent)) {\n                                eventType = eventTypes.compositionStart\n                            }\n                        } else if (isFallbackCompositionEnd(topLevelType, nativeEvent)) {\n                            eventType = eventTypes.compositionEnd\n                        }\n\n                        if (!eventType) {\n                            return null\n                        }\n\n                        if (useFallbackCompositionData) {\n                            // The current composition is stored statically and must not be\n                            // overwritten while composition continues.\n                            if (!currentComposition && eventType === eventTypes.compositionStart) {\n                                currentComposition = FallbackCompositionState.getPooled(\n                                    topLevelTarget\n                                )\n                            } else if (eventType === eventTypes.compositionEnd) {\n                                if (currentComposition) {\n                                    fallbackData = currentComposition.getData()\n                                }\n                            }\n                        }\n\n                        var event = SyntheticCompositionEvent.getPooled(\n                            eventType,\n                            topLevelTargetID,\n                            nativeEvent\n                        )\n\n                        if (fallbackData) {\n                            // Inject data generated from fallback path into the synthetic event.\n                            // This matches the property of native CompositionEventInterface.\n                            event.data = fallbackData\n                        } else {\n                            var customData = getDataFromCustomEvent(nativeEvent)\n                            if (customData !== null) {\n                                event.data = customData\n                            }\n                        }\n\n                        EventPropagators.accumulateTwoPhaseDispatches(event)\n                        return event\n                    }\n\n                    /**\n                     * @param {string} topLevelType Record from `EventConstants`.\n                     * @param {object} nativeEvent Native browser event.\n                     * @return {?string} The string corresponding to this `beforeInput` event.\n                     */\n                    function getNativeBeforeInputChars(topLevelType, nativeEvent) {\n                        switch (topLevelType) {\n                            case topLevelTypes.topCompositionEnd:\n                                return getDataFromCustomEvent(nativeEvent)\n                            case topLevelTypes.topKeyPress:\n                                /**\n                                 * If native `textInput` events are available, our goal is to make\n                                 * use of them. However, there is a special case: the spacebar key.\n                                 * In Webkit, preventing default on a spacebar `textInput` event\n                                 * cancels character insertion, but it *also* causes the browser\n                                 * to fall back to its default spacebar behavior of scrolling the\n                                 * page.\n                                 *\n                                 * Tracking at:\n                                 * https://code.google.com/p/chromium/issues/detail?id=355103\n                                 *\n                                 * To avoid this issue, use the keypress event as if no `textInput`\n                                 * event is available.\n                                 */\n                                var which = nativeEvent.which\n                                if (which !== SPACEBAR_CODE) {\n                                    return null\n                                }\n\n                                hasSpaceKeypress = true\n                                return SPACEBAR_CHAR\n\n                            case topLevelTypes.topTextInput:\n                                // Record the characters to be added to the DOM.\n                                var chars = nativeEvent.data\n\n                                // If it's a spacebar character, assume that we have already handled\n                                // it at the keypress level and bail immediately. Android Chrome\n                                // doesn't give us keycodes, so we need to blacklist it.\n                                if (chars === SPACEBAR_CHAR && hasSpaceKeypress) {\n                                    return null\n                                }\n\n                                return chars\n\n                            default:\n                                // For other native event types, do nothing.\n                                return null\n                        }\n                    }\n\n                    /**\n                     * For browsers that do not provide the `textInput` event, extract the\n                     * appropriate string to use for SyntheticInputEvent.\n                     *\n                     * @param {string} topLevelType Record from `EventConstants`.\n                     * @param {object} nativeEvent Native browser event.\n                     * @return {?string} The fallback string for this `beforeInput` event.\n                     */\n                    function getFallbackBeforeInputChars(topLevelType, nativeEvent) {\n                        // If we are currently composing (IME) and using a fallback to do so,\n                        // try to extract the composed characters from the fallback object.\n                        if (currentComposition) {\n                            if (\n                                topLevelType === topLevelTypes.topCompositionEnd ||\n                                isFallbackCompositionEnd(topLevelType, nativeEvent)\n                            ) {\n                                var chars = currentComposition.getData()\n                                FallbackCompositionState.release(currentComposition)\n                                currentComposition = null\n                                return chars\n                            }\n                            return null\n                        }\n\n                        switch (topLevelType) {\n                            case topLevelTypes.topPaste:\n                                // If a paste event occurs after a keypress, throw out the input\n                                // chars. Paste events should not lead to BeforeInput events.\n                                return null\n                            case topLevelTypes.topKeyPress:\n                                /**\n                                 * As of v27, Firefox may fire keypress events even when no character\n                                 * will be inserted. A few possibilities:\n                                 *\n                                 * - `which` is `0`. Arrow keys, Esc key, etc.\n                                 *\n                                 * - `which` is the pressed key code, but no char is available.\n                                 *   Ex: 'AltGr + d` in Polish. There is no modified character for\n                                 *   this key combination and no character is inserted into the\n                                 *   document, but FF fires the keypress for char code `100` anyway.\n                                 *   No `input` event will occur.\n                                 *\n                                 * - `which` is the pressed key code, but a command combination is\n                                 *   being used. Ex: `Cmd+C`. No character is inserted, and no\n                                 *   `input` event will occur.\n                                 */\n                                if (nativeEvent.which && !isKeypressCommand(nativeEvent)) {\n                                    return String.fromCharCode(nativeEvent.which)\n                                }\n                                return null\n                            case topLevelTypes.topCompositionEnd:\n                                return useFallbackCompositionData ? null : nativeEvent.data\n                            default:\n                                return null\n                        }\n                    }\n\n                    /**\n                     * Extract a SyntheticInputEvent for `beforeInput`, based on either native\n                     * `textInput` or fallback behavior.\n                     *\n                     * @param {string} topLevelType Record from `EventConstants`.\n                     * @param {DOMEventTarget} topLevelTarget The listening component root node.\n                     * @param {string} topLevelTargetID ID of `topLevelTarget`.\n                     * @param {object} nativeEvent Native browser event.\n                     * @return {?object} A SyntheticInputEvent.\n                     */\n                    function extractBeforeInputEvent(\n                        topLevelType,\n                        topLevelTarget,\n                        topLevelTargetID,\n                        nativeEvent\n                    ) {\n                        var chars\n\n                        if (canUseTextInputEvent) {\n                            chars = getNativeBeforeInputChars(topLevelType, nativeEvent)\n                        } else {\n                            chars = getFallbackBeforeInputChars(topLevelType, nativeEvent)\n                        }\n\n                        // If no characters are being inserted, no BeforeInput event should\n                        // be fired.\n                        if (!chars) {\n                            return null\n                        }\n\n                        var event = SyntheticInputEvent.getPooled(\n                            eventTypes.beforeInput,\n                            topLevelTargetID,\n                            nativeEvent\n                        )\n\n                        event.data = chars\n                        EventPropagators.accumulateTwoPhaseDispatches(event)\n                        return event\n                    }\n\n                    /**\n                     * Create an `onBeforeInput` event to match\n                     * http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105/#events-inputevents.\n                     *\n                     * This event plugin is based on the native `textInput` event\n                     * available in Chrome, Safari, Opera, and IE. This event fires after\n                     * `onKeyPress` and `onCompositionEnd`, but before `onInput`.\n                     *\n                     * `beforeInput` is spec'd but not implemented in any browsers, and\n                     * the `input` event does not provide any useful information about what has\n                     * actually been added, contrary to the spec. Thus, `textInput` is the best\n                     * available event to identify the characters that have actually been inserted\n                     * into the target node.\n                     *\n                     * This plugin is also responsible for emitting `composition` events, thus\n                     * allowing us to share composition fallback code for both `beforeInput` and\n                     * `composition` event types.\n                     */\n                    var BeforeInputEventPlugin = {\n                        eventTypes: eventTypes,\n\n                        /**\n                         * @param {string} topLevelType Record from `EventConstants`.\n                         * @param {DOMEventTarget} topLevelTarget The listening component root node.\n                         * @param {string} topLevelTargetID ID of `topLevelTarget`.\n                         * @param {object} nativeEvent Native browser event.\n                         * @return {*} An accumulation of synthetic events.\n                         * @see {EventPluginHub.extractEvents}\n                         */\n                        extractEvents: function(\n                            topLevelType,\n                            topLevelTarget,\n                            topLevelTargetID,\n                            nativeEvent\n                        ) {\n                            return [\n                                extractCompositionEvent(\n                                    topLevelType,\n                                    topLevelTarget,\n                                    topLevelTargetID,\n                                    nativeEvent\n                                ),\n                                extractBeforeInputEvent(\n                                    topLevelType,\n                                    topLevelTarget,\n                                    topLevelTargetID,\n                                    nativeEvent\n                                )\n                            ]\n                        }\n                    }\n\n                    module.exports = BeforeInputEventPlugin\n                },\n                { \"106\": 106, \"110\": 110, \"157\": 157, \"16\": 16, \"21\": 21, \"22\": 22, \"23\": 23 }\n            ],\n            4: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule CSSCore\n                     * @typechecks\n                     */\n\n                    var invariant = _dereq_(150)\n\n                    /**\n                     * The CSSCore module specifies the API (and implements most of the methods)\n                     * that should be used when dealing with the display of elements (via their\n                     * CSS classes and visibility on screen. It is an API focused on mutating the\n                     * display and not reading it as no logical state should be encoded in the\n                     * display of elements.\n                     */\n\n                    var CSSCore = {\n                        /**\n                         * Adds the class passed in to the element if it doesn't already have it.\n                         *\n                         * @param {DOMElement} element the element to set the class on\n                         * @param {string} className the CSS className\n                         * @return {DOMElement} the element passed in\n                         */\n                        addClass: function(element, className) {\n                            \"production\" !== \"development\"\n                                ? invariant(\n                                      !/\\s/.test(className),\n                                      'CSSCore.addClass takes only a single class name. \"%s\" contains ' +\n                                          \"multiple classes.\",\n                                      className\n                                  )\n                                : invariant(!/\\s/.test(className))\n\n                            if (className) {\n                                if (element.classList) {\n                                    element.classList.add(className)\n                                } else if (!CSSCore.hasClass(element, className)) {\n                                    element.className = element.className + \" \" + className\n                                }\n                            }\n                            return element\n                        },\n\n                        /**\n                         * Removes the class passed in from the element\n                         *\n                         * @param {DOMElement} element the element to set the class on\n                         * @param {string} className the CSS className\n                         * @return {DOMElement} the element passed in\n                         */\n                        removeClass: function(element, className) {\n                            \"production\" !== \"development\"\n                                ? invariant(\n                                      !/\\s/.test(className),\n                                      'CSSCore.removeClass takes only a single class name. \"%s\" contains ' +\n                                          \"multiple classes.\",\n                                      className\n                                  )\n                                : invariant(!/\\s/.test(className))\n\n                            if (className) {\n                                if (element.classList) {\n                                    element.classList.remove(className)\n                                } else if (CSSCore.hasClass(element, className)) {\n                                    element.className = element.className\n                                        .replace(\n                                            new RegExp(\"(^|\\\\s)\" + className + \"(?:\\\\s|$)\", \"g\"),\n                                            \"$1\"\n                                        )\n                                        .replace(/\\s+/g, \" \") // multiple spaces to one\n                                        .replace(/^\\s*|\\s*$/g, \"\") // trim the ends\n                                }\n                            }\n                            return element\n                        },\n\n                        /**\n                         * Helper to add or remove a class from an element based on a condition.\n                         *\n                         * @param {DOMElement} element the element to set the class on\n                         * @param {string} className the CSS className\n                         * @param {*} bool condition to whether to add or remove the class\n                         * @return {DOMElement} the element passed in\n                         */\n                        conditionClass: function(element, className, bool) {\n                            return (bool ? CSSCore.addClass : CSSCore.removeClass)(\n                                element,\n                                className\n                            )\n                        },\n\n                        /**\n                         * Tests whether the element has the class specified.\n                         *\n                         * @param {DOMNode|DOMWindow} element the element to set the class on\n                         * @param {string} className the CSS className\n                         * @return {boolean} true if the element has the class, false if not\n                         */\n                        hasClass: function(element, className) {\n                            \"production\" !== \"development\"\n                                ? invariant(\n                                      !/\\s/.test(className),\n                                      \"CSS.hasClass takes only a single class name.\"\n                                  )\n                                : invariant(!/\\s/.test(className))\n                            if (element.classList) {\n                                return !!className && element.classList.contains(className)\n                            }\n                            return (\n                                (\" \" + element.className + \" \").indexOf(\" \" + className + \" \") > -1\n                            )\n                        }\n                    }\n\n                    module.exports = CSSCore\n                },\n                { \"150\": 150 }\n            ],\n            5: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule CSSProperty\n                     */\n\n                    \"use strict\"\n\n                    /**\n                     * CSS properties which accept numbers but are not in units of \"px\".\n                     */\n                    var isUnitlessNumber = {\n                        boxFlex: true,\n                        boxFlexGroup: true,\n                        columnCount: true,\n                        flex: true,\n                        flexGrow: true,\n                        flexPositive: true,\n                        flexShrink: true,\n                        flexNegative: true,\n                        fontWeight: true,\n                        lineClamp: true,\n                        lineHeight: true,\n                        opacity: true,\n                        order: true,\n                        orphans: true,\n                        widows: true,\n                        zIndex: true,\n                        zoom: true,\n\n                        // SVG-related properties\n                        fillOpacity: true,\n                        strokeDashoffset: true,\n                        strokeOpacity: true,\n                        strokeWidth: true\n                    }\n\n                    /**\n                     * @param {string} prefix vendor-specific prefix, eg: Webkit\n                     * @param {string} key style name, eg: transitionDuration\n                     * @return {string} style name prefixed with `prefix`, properly camelCased, eg:\n                     * WebkitTransitionDuration\n                     */\n                    function prefixKey(prefix, key) {\n                        return prefix + key.charAt(0).toUpperCase() + key.substring(1)\n                    }\n\n                    /**\n                     * Support style names that may come passed in prefixed by adding permutations\n                     * of vendor prefixes.\n                     */\n                    var prefixes = [\"Webkit\", \"ms\", \"Moz\", \"O\"]\n\n                    // Using Object.keys here, or else the vanilla for-in loop makes IE8 go into an\n                    // infinite loop, because it iterates over the newly added props too.\n                    Object.keys(isUnitlessNumber).forEach(function(prop) {\n                        prefixes.forEach(function(prefix) {\n                            isUnitlessNumber[prefixKey(prefix, prop)] = isUnitlessNumber[prop]\n                        })\n                    })\n\n                    /**\n                     * Most style properties can be unset by doing .style[prop] = '' but IE8\n                     * doesn't like doing that with shorthand properties so for the properties that\n                     * IE8 breaks on, which are listed here, we instead unset each of the\n                     * individual properties. See http://bugs.jquery.com/ticket/12385.\n                     * The 4-value 'clock' properties like margin, padding, border-width seem to\n                     * behave without any problems. Curiously, list-style works too without any\n                     * special prodding.\n                     */\n                    var shorthandPropertyExpansions = {\n                        background: {\n                            backgroundImage: true,\n                            backgroundPosition: true,\n                            backgroundRepeat: true,\n                            backgroundColor: true\n                        },\n                        border: {\n                            borderWidth: true,\n                            borderStyle: true,\n                            borderColor: true\n                        },\n                        borderBottom: {\n                            borderBottomWidth: true,\n                            borderBottomStyle: true,\n                            borderBottomColor: true\n                        },\n                        borderLeft: {\n                            borderLeftWidth: true,\n                            borderLeftStyle: true,\n                            borderLeftColor: true\n                        },\n                        borderRight: {\n                            borderRightWidth: true,\n                            borderRightStyle: true,\n                            borderRightColor: true\n                        },\n                        borderTop: {\n                            borderTopWidth: true,\n                            borderTopStyle: true,\n                            borderTopColor: true\n                        },\n                        font: {\n                            fontStyle: true,\n                            fontVariant: true,\n                            fontWeight: true,\n                            fontSize: true,\n                            lineHeight: true,\n                            fontFamily: true\n                        }\n                    }\n\n                    var CSSProperty = {\n                        isUnitlessNumber: isUnitlessNumber,\n                        shorthandPropertyExpansions: shorthandPropertyExpansions\n                    }\n\n                    module.exports = CSSProperty\n                },\n                {}\n            ],\n            6: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule CSSPropertyOperations\n                     * @typechecks static-only\n                     */\n\n                    \"use strict\"\n\n                    var CSSProperty = _dereq_(5)\n                    var ExecutionEnvironment = _dereq_(22)\n\n                    var camelizeStyleName = _dereq_(121)\n                    var dangerousStyleValue = _dereq_(128)\n                    var hyphenateStyleName = _dereq_(148)\n                    var memoizeStringOnly = _dereq_(159)\n                    var warning = _dereq_(171)\n\n                    var processStyleName = memoizeStringOnly(function(styleName) {\n                        return hyphenateStyleName(styleName)\n                    })\n\n                    var styleFloatAccessor = \"cssFloat\"\n                    if (ExecutionEnvironment.canUseDOM) {\n                        // IE8 only supports accessing cssFloat (standard) as styleFloat\n                        if (document.documentElement.style.cssFloat === undefined) {\n                            styleFloatAccessor = \"styleFloat\"\n                        }\n                    }\n\n                    if (\"production\" !== \"development\") {\n                        // 'msTransform' is correct, but the other prefixes should be capitalized\n                        var badVendoredStyleNamePattern = /^(?:webkit|moz|o)[A-Z]/\n\n                        // style values shouldn't contain a semicolon\n                        var badStyleValueWithSemicolonPattern = /;\\s*$/\n\n                        var warnedStyleNames = {}\n                        var warnedStyleValues = {}\n\n                        var warnHyphenatedStyleName = function(name) {\n                            if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {\n                                return\n                            }\n\n                            warnedStyleNames[name] = true\n                            \"production\" !== \"development\"\n                                ? warning(\n                                      false,\n                                      \"Unsupported style property %s. Did you mean %s?\",\n                                      name,\n                                      camelizeStyleName(name)\n                                  )\n                                : null\n                        }\n\n                        var warnBadVendoredStyleName = function(name) {\n                            if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {\n                                return\n                            }\n\n                            warnedStyleNames[name] = true\n                            \"production\" !== \"development\"\n                                ? warning(\n                                      false,\n                                      \"Unsupported vendor-prefixed style property %s. Did you mean %s?\",\n                                      name,\n                                      name.charAt(0).toUpperCase() + name.slice(1)\n                                  )\n                                : null\n                        }\n\n                        var warnStyleValueWithSemicolon = function(name, value) {\n                            if (\n                                warnedStyleValues.hasOwnProperty(value) &&\n                                warnedStyleValues[value]\n                            ) {\n                                return\n                            }\n\n                            warnedStyleValues[value] = true\n                            \"production\" !== \"development\"\n                                ? warning(\n                                      false,\n                                      \"Style property values shouldn't contain a semicolon. \" +\n                                          'Try \"%s: %s\" instead.',\n                                      name,\n                                      value.replace(badStyleValueWithSemicolonPattern, \"\")\n                                  )\n                                : null\n                        }\n\n                        /**\n                         * @param {string} name\n                         * @param {*} value\n                         */\n                        var warnValidStyle = function(name, value) {\n                            if (name.indexOf(\"-\") > -1) {\n                                warnHyphenatedStyleName(name)\n                            } else if (badVendoredStyleNamePattern.test(name)) {\n                                warnBadVendoredStyleName(name)\n                            } else if (badStyleValueWithSemicolonPattern.test(value)) {\n                                warnStyleValueWithSemicolon(name, value)\n                            }\n                        }\n                    }\n\n                    /**\n                     * Operations for dealing with CSS properties.\n                     */\n                    var CSSPropertyOperations = {\n                        /**\n                         * Serializes a mapping of style properties for use as inline styles:\n                         *\n                         *   > createMarkupForStyles({width: '200px', height: 0})\n                         *   \"width:200px;height:0;\"\n                         *\n                         * Undefined values are ignored so that declarative programming is easier.\n                         * The result should be HTML-escaped before insertion into the DOM.\n                         *\n                         * @param {object} styles\n                         * @return {?string}\n                         */\n                        createMarkupForStyles: function(styles) {\n                            var serialized = \"\"\n                            for (var styleName in styles) {\n                                if (!styles.hasOwnProperty(styleName)) {\n                                    continue\n                                }\n                                var styleValue = styles[styleName]\n                                if (\"production\" !== \"development\") {\n                                    warnValidStyle(styleName, styleValue)\n                                }\n                                if (styleValue != null) {\n                                    serialized += processStyleName(styleName) + \":\"\n                                    serialized += dangerousStyleValue(styleName, styleValue) + \";\"\n                                }\n                            }\n                            return serialized || null\n                        },\n\n                        /**\n                         * Sets the value for multiple styles on a node.  If a value is specified as\n                         * '' (empty string), the corresponding style property will be unset.\n                         *\n                         * @param {DOMElement} node\n                         * @param {object} styles\n                         */\n                        setValueForStyles: function(node, styles) {\n                            var style = node.style\n                            for (var styleName in styles) {\n                                if (!styles.hasOwnProperty(styleName)) {\n                                    continue\n                                }\n                                if (\"production\" !== \"development\") {\n                                    warnValidStyle(styleName, styles[styleName])\n                                }\n                                var styleValue = dangerousStyleValue(styleName, styles[styleName])\n                                if (styleName === \"float\") {\n                                    styleName = styleFloatAccessor\n                                }\n                                if (styleValue) {\n                                    style[styleName] = styleValue\n                                } else {\n                                    var expansion =\n                                        CSSProperty.shorthandPropertyExpansions[styleName]\n                                    if (expansion) {\n                                        // Shorthand property that IE8 won't like unsetting, so unset each\n                                        // component to placate it\n                                        for (var individualStyleName in expansion) {\n                                            style[individualStyleName] = \"\"\n                                        }\n                                    } else {\n                                        style[styleName] = \"\"\n                                    }\n                                }\n                            }\n                        }\n                    }\n\n                    module.exports = CSSPropertyOperations\n                },\n                { \"121\": 121, \"128\": 128, \"148\": 148, \"159\": 159, \"171\": 171, \"22\": 22, \"5\": 5 }\n            ],\n            7: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule CallbackQueue\n                     */\n\n                    \"use strict\"\n\n                    var PooledClass = _dereq_(30)\n\n                    var assign = _dereq_(29)\n                    var invariant = _dereq_(150)\n\n                    /**\n                     * A specialized pseudo-event module to help keep track of components waiting to\n                     * be notified when their DOM representations are available for use.\n                     *\n                     * This implements `PooledClass`, so you should never need to instantiate this.\n                     * Instead, use `CallbackQueue.getPooled()`.\n                     *\n                     * @class ReactMountReady\n                     * @implements PooledClass\n                     * @internal\n                     */\n                    function CallbackQueue() {\n                        this._callbacks = null\n                        this._contexts = null\n                    }\n\n                    assign(CallbackQueue.prototype, {\n                        /**\n                         * Enqueues a callback to be invoked when `notifyAll` is invoked.\n                         *\n                         * @param {function} callback Invoked when `notifyAll` is invoked.\n                         * @param {?object} context Context to call `callback` with.\n                         * @internal\n                         */\n                        enqueue: function(callback, context) {\n                            this._callbacks = this._callbacks || []\n                            this._contexts = this._contexts || []\n                            this._callbacks.push(callback)\n                            this._contexts.push(context)\n                        },\n\n                        /**\n                         * Invokes all enqueued callbacks and clears the queue. This is invoked after\n                         * the DOM representation of a component has been created or updated.\n                         *\n                         * @internal\n                         */\n                        notifyAll: function() {\n                            var callbacks = this._callbacks\n                            var contexts = this._contexts\n                            if (callbacks) {\n                                \"production\" !== \"development\"\n                                    ? invariant(\n                                          callbacks.length === contexts.length,\n                                          \"Mismatched list of contexts in callback queue\"\n                                      )\n                                    : invariant(callbacks.length === contexts.length)\n                                this._callbacks = null\n                                this._contexts = null\n                                for (var i = 0, l = callbacks.length; i < l; i++) {\n                                    callbacks[i].call(contexts[i])\n                                }\n                                callbacks.length = 0\n                                contexts.length = 0\n                            }\n                        },\n\n                        /**\n                         * Resets the internal queue.\n                         *\n                         * @internal\n                         */\n                        reset: function() {\n                            this._callbacks = null\n                            this._contexts = null\n                        },\n\n                        /**\n                         * `PooledClass` looks for this.\n                         */\n                        destructor: function() {\n                            this.reset()\n                        }\n                    })\n\n                    PooledClass.addPoolingTo(CallbackQueue)\n\n                    module.exports = CallbackQueue\n                },\n                { \"150\": 150, \"29\": 29, \"30\": 30 }\n            ],\n            8: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule ChangeEventPlugin\n                     */\n\n                    \"use strict\"\n\n                    var EventConstants = _dereq_(16)\n                    var EventPluginHub = _dereq_(18)\n                    var EventPropagators = _dereq_(21)\n                    var ExecutionEnvironment = _dereq_(22)\n                    var ReactUpdates = _dereq_(100)\n                    var SyntheticEvent = _dereq_(108)\n\n                    var isEventSupported = _dereq_(151)\n                    var isTextInputElement = _dereq_(153)\n                    var keyOf = _dereq_(157)\n\n                    var topLevelTypes = EventConstants.topLevelTypes\n\n                    var eventTypes = {\n                        change: {\n                            phasedRegistrationNames: {\n                                bubbled: keyOf({ onChange: null }),\n                                captured: keyOf({ onChangeCapture: null })\n                            },\n                            dependencies: [\n                                topLevelTypes.topBlur,\n                                topLevelTypes.topChange,\n                                topLevelTypes.topClick,\n                                topLevelTypes.topFocus,\n                                topLevelTypes.topInput,\n                                topLevelTypes.topKeyDown,\n                                topLevelTypes.topKeyUp,\n                                topLevelTypes.topSelectionChange\n                            ]\n                        }\n                    }\n\n                    /**\n                     * For IE shims\n                     */\n                    var activeElement = null\n                    var activeElementID = null\n                    var activeElementValue = null\n                    var activeElementValueProp = null\n\n                    /**\n                     * SECTION: handle `change` event\n                     */\n                    function shouldUseChangeEvent(elem) {\n                        return (\n                            elem.nodeName === \"SELECT\" ||\n                            (elem.nodeName === \"INPUT\" && elem.type === \"file\")\n                        )\n                    }\n\n                    var doesChangeEventBubble = false\n                    if (ExecutionEnvironment.canUseDOM) {\n                        // See `handleChange` comment below\n                        doesChangeEventBubble =\n                            isEventSupported(\"change\") &&\n                            (!(\"documentMode\" in document) || document.documentMode > 8)\n                    }\n\n                    function manualDispatchChangeEvent(nativeEvent) {\n                        var event = SyntheticEvent.getPooled(\n                            eventTypes.change,\n                            activeElementID,\n                            nativeEvent\n                        )\n                        EventPropagators.accumulateTwoPhaseDispatches(event)\n\n                        // If change and propertychange bubbled, we'd just bind to it like all the\n                        // other events and have it go through ReactBrowserEventEmitter. Since it\n                        // doesn't, we manually listen for the events and so we have to enqueue and\n                        // process the abstract event manually.\n                        //\n                        // Batching is necessary here in order to ensure that all event handlers run\n                        // before the next rerender (including event handlers attached to ancestor\n                        // elements instead of directly on the input). Without this, controlled\n                        // components don't work properly in conjunction with event bubbling because\n                        // the component is rerendered and the value reverted before all the event\n                        // handlers can run. See https://github.com/facebook/react/issues/708.\n                        ReactUpdates.batchedUpdates(runEventInBatch, event)\n                    }\n\n                    function runEventInBatch(event) {\n                        EventPluginHub.enqueueEvents(event)\n                        EventPluginHub.processEventQueue()\n                    }\n\n                    function startWatchingForChangeEventIE8(target, targetID) {\n                        activeElement = target\n                        activeElementID = targetID\n                        activeElement.attachEvent(\"onchange\", manualDispatchChangeEvent)\n                    }\n\n                    function stopWatchingForChangeEventIE8() {\n                        if (!activeElement) {\n                            return\n                        }\n                        activeElement.detachEvent(\"onchange\", manualDispatchChangeEvent)\n                        activeElement = null\n                        activeElementID = null\n                    }\n\n                    function getTargetIDForChangeEvent(\n                        topLevelType,\n                        topLevelTarget,\n                        topLevelTargetID\n                    ) {\n                        if (topLevelType === topLevelTypes.topChange) {\n                            return topLevelTargetID\n                        }\n                    }\n                    function handleEventsForChangeEventIE8(\n                        topLevelType,\n                        topLevelTarget,\n                        topLevelTargetID\n                    ) {\n                        if (topLevelType === topLevelTypes.topFocus) {\n                            // stopWatching() should be a noop here but we call it just in case we\n                            // missed a blur event somehow.\n                            stopWatchingForChangeEventIE8()\n                            startWatchingForChangeEventIE8(topLevelTarget, topLevelTargetID)\n                        } else if (topLevelType === topLevelTypes.topBlur) {\n                            stopWatchingForChangeEventIE8()\n                        }\n                    }\n\n                    /**\n                     * SECTION: handle `input` event\n                     */\n                    var isInputEventSupported = false\n                    if (ExecutionEnvironment.canUseDOM) {\n                        // IE9 claims to support the input event but fails to trigger it when\n                        // deleting text, so we ignore its input events\n                        isInputEventSupported =\n                            isEventSupported(\"input\") &&\n                            (!(\"documentMode\" in document) || document.documentMode > 9)\n                    }\n\n                    /**\n                     * (For old IE.) Replacement getter/setter for the `value` property that gets\n                     * set on the active element.\n                     */\n                    var newValueProp = {\n                        get: function() {\n                            return activeElementValueProp.get.call(this)\n                        },\n                        set: function(val) {\n                            // Cast to a string so we can do equality checks.\n                            activeElementValue = \"\" + val\n                            activeElementValueProp.set.call(this, val)\n                        }\n                    }\n\n                    /**\n                     * (For old IE.) Starts tracking propertychange events on the passed-in element\n                     * and override the value property so that we can distinguish user events from\n                     * value changes in JS.\n                     */\n                    function startWatchingForValueChange(target, targetID) {\n                        activeElement = target\n                        activeElementID = targetID\n                        activeElementValue = target.value\n                        activeElementValueProp = Object.getOwnPropertyDescriptor(\n                            target.constructor.prototype,\n                            \"value\"\n                        )\n\n                        Object.defineProperty(activeElement, \"value\", newValueProp)\n                        activeElement.attachEvent(\"onpropertychange\", handlePropertyChange)\n                    }\n\n                    /**\n                     * (For old IE.) Removes the event listeners from the currently-tracked element,\n                     * if any exists.\n                     */\n                    function stopWatchingForValueChange() {\n                        if (!activeElement) {\n                            return\n                        }\n\n                        // delete restores the original property definition\n                        delete activeElement.value\n                        activeElement.detachEvent(\"onpropertychange\", handlePropertyChange)\n\n                        activeElement = null\n                        activeElementID = null\n                        activeElementValue = null\n                        activeElementValueProp = null\n                    }\n\n                    /**\n                     * (For old IE.) Handles a propertychange event, sending a `change` event if\n                     * the value of the active element has changed.\n                     */\n                    function handlePropertyChange(nativeEvent) {\n                        if (nativeEvent.propertyName !== \"value\") {\n                            return\n                        }\n                        var value = nativeEvent.srcElement.value\n                        if (value === activeElementValue) {\n                            return\n                        }\n                        activeElementValue = value\n\n                        manualDispatchChangeEvent(nativeEvent)\n                    }\n\n                    /**\n                     * If a `change` event should be fired, returns the target's ID.\n                     */\n                    function getTargetIDForInputEvent(\n                        topLevelType,\n                        topLevelTarget,\n                        topLevelTargetID\n                    ) {\n                        if (topLevelType === topLevelTypes.topInput) {\n                            // In modern browsers (i.e., not IE8 or IE9), the input event is exactly\n                            // what we want so fall through here and trigger an abstract event\n                            return topLevelTargetID\n                        }\n                    }\n\n                    // For IE8 and IE9.\n                    function handleEventsForInputEventIE(\n                        topLevelType,\n                        topLevelTarget,\n                        topLevelTargetID\n                    ) {\n                        if (topLevelType === topLevelTypes.topFocus) {\n                            // In IE8, we can capture almost all .value changes by adding a\n                            // propertychange handler and looking for events with propertyName\n                            // equal to 'value'\n                            // In IE9, propertychange fires for most input events but is buggy and\n                            // doesn't fire when text is deleted, but conveniently, selectionchange\n                            // appears to fire in all of the remaining cases so we catch those and\n                            // forward the event if the value has changed\n                            // In either case, we don't want to call the event handler if the value\n                            // is changed from JS so we redefine a setter for `.value` that updates\n                            // our activeElementValue variable, allowing us to ignore those changes\n                            //\n                            // stopWatching() should be a noop here but we call it just in case we\n                            // missed a blur event somehow.\n                            stopWatchingForValueChange()\n                            startWatchingForValueChange(topLevelTarget, topLevelTargetID)\n                        } else if (topLevelType === topLevelTypes.topBlur) {\n                            stopWatchingForValueChange()\n                        }\n                    }\n\n                    // For IE8 and IE9.\n                    function getTargetIDForInputEventIE(\n                        topLevelType,\n                        topLevelTarget,\n                        topLevelTargetID\n                    ) {\n                        if (\n                            topLevelType === topLevelTypes.topSelectionChange ||\n                            topLevelType === topLevelTypes.topKeyUp ||\n                            topLevelType === topLevelTypes.topKeyDown\n                        ) {\n                            // On the selectionchange event, the target is just document which isn't\n                            // helpful for us so just check activeElement instead.\n                            //\n                            // 99% of the time, keydown and keyup aren't necessary. IE8 fails to fire\n                            // propertychange on the first input event after setting `value` from a\n                            // script and fires only keydown, keypress, keyup. Catching keyup usually\n                            // gets it and catching keydown lets us fire an event for the first\n                            // keystroke if user does a key repeat (it'll be a little delayed: right\n                            // before the second keystroke). Other input methods (e.g., paste) seem to\n                            // fire selectionchange normally.\n                            if (activeElement && activeElement.value !== activeElementValue) {\n                                activeElementValue = activeElement.value\n                                return activeElementID\n                            }\n                        }\n                    }\n\n                    /**\n                     * SECTION: handle `click` event\n                     */\n                    function shouldUseClickEvent(elem) {\n                        // Use the `click` event to detect changes to checkbox and radio inputs.\n                        // This approach works across all browsers, whereas `change` does not fire\n                        // until `blur` in IE8.\n                        return (\n                            elem.nodeName === \"INPUT\" &&\n                            (elem.type === \"checkbox\" || elem.type === \"radio\")\n                        )\n                    }\n\n                    function getTargetIDForClickEvent(\n                        topLevelType,\n                        topLevelTarget,\n                        topLevelTargetID\n                    ) {\n                        if (topLevelType === topLevelTypes.topClick) {\n                            return topLevelTargetID\n                        }\n                    }\n\n                    /**\n                     * This plugin creates an `onChange` event that normalizes change events\n                     * across form elements. This event fires at a time when it's possible to\n                     * change the element's value without seeing a flicker.\n                     *\n                     * Supported elements are:\n                     * - input (see `isTextInputElement`)\n                     * - textarea\n                     * - select\n                     */\n                    var ChangeEventPlugin = {\n                        eventTypes: eventTypes,\n\n                        /**\n                         * @param {string} topLevelType Record from `EventConstants`.\n                         * @param {DOMEventTarget} topLevelTarget The listening component root node.\n                         * @param {string} topLevelTargetID ID of `topLevelTarget`.\n                         * @param {object} nativeEvent Native browser event.\n                         * @return {*} An accumulation of synthetic events.\n                         * @see {EventPluginHub.extractEvents}\n                         */\n                        extractEvents: function(\n                            topLevelType,\n                            topLevelTarget,\n                            topLevelTargetID,\n                            nativeEvent\n                        ) {\n                            var getTargetIDFunc, handleEventFunc\n                            if (shouldUseChangeEvent(topLevelTarget)) {\n                                if (doesChangeEventBubble) {\n                                    getTargetIDFunc = getTargetIDForChangeEvent\n                                } else {\n                                    handleEventFunc = handleEventsForChangeEventIE8\n                                }\n                            } else if (isTextInputElement(topLevelTarget)) {\n                                if (isInputEventSupported) {\n                                    getTargetIDFunc = getTargetIDForInputEvent\n                                } else {\n                                    getTargetIDFunc = getTargetIDForInputEventIE\n                                    handleEventFunc = handleEventsForInputEventIE\n                                }\n                            } else if (shouldUseClickEvent(topLevelTarget)) {\n                                getTargetIDFunc = getTargetIDForClickEvent\n                            }\n\n                            if (getTargetIDFunc) {\n                                var targetID = getTargetIDFunc(\n                                    topLevelType,\n                                    topLevelTarget,\n                                    topLevelTargetID\n                                )\n                                if (targetID) {\n                                    var event = SyntheticEvent.getPooled(\n                                        eventTypes.change,\n                                        targetID,\n                                        nativeEvent\n                                    )\n                                    EventPropagators.accumulateTwoPhaseDispatches(event)\n                                    return event\n                                }\n                            }\n\n                            if (handleEventFunc) {\n                                handleEventFunc(topLevelType, topLevelTarget, topLevelTargetID)\n                            }\n                        }\n                    }\n\n                    module.exports = ChangeEventPlugin\n                },\n                {\n                    \"100\": 100,\n                    \"108\": 108,\n                    \"151\": 151,\n                    \"153\": 153,\n                    \"157\": 157,\n                    \"16\": 16,\n                    \"18\": 18,\n                    \"21\": 21,\n                    \"22\": 22\n                }\n            ],\n            9: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule ClientReactRootIndex\n                     * @typechecks\n                     */\n\n                    \"use strict\"\n\n                    var nextReactRootIndex = 0\n\n                    var ClientReactRootIndex = {\n                        createReactRootIndex: function() {\n                            return nextReactRootIndex++\n                        }\n                    }\n\n                    module.exports = ClientReactRootIndex\n                },\n                {}\n            ],\n            10: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule DOMChildrenOperations\n                     * @typechecks static-only\n                     */\n\n                    \"use strict\"\n\n                    var Danger = _dereq_(13)\n                    var ReactMultiChildUpdateTypes = _dereq_(79)\n\n                    var setTextContent = _dereq_(165)\n                    var invariant = _dereq_(150)\n\n                    /**\n                     * Inserts `childNode` as a child of `parentNode` at the `index`.\n                     *\n                     * @param {DOMElement} parentNode Parent node in which to insert.\n                     * @param {DOMElement} childNode Child node to insert.\n                     * @param {number} index Index at which to insert the child.\n                     * @internal\n                     */\n                    function insertChildAt(parentNode, childNode, index) {\n                        // By exploiting arrays returning `undefined` for an undefined index, we can\n                        // rely exclusively on `insertBefore(node, null)` instead of also using\n                        // `appendChild(node)`. However, using `undefined` is not allowed by all\n                        // browsers so we must replace it with `null`.\n                        parentNode.insertBefore(childNode, parentNode.childNodes[index] || null)\n                    }\n\n                    /**\n                     * Operations for updating with DOM children.\n                     */\n                    var DOMChildrenOperations = {\n                        dangerouslyReplaceNodeWithMarkup: Danger.dangerouslyReplaceNodeWithMarkup,\n\n                        updateTextContent: setTextContent,\n\n                        /**\n                         * Updates a component's children by processing a series of updates. The\n                         * update configurations are each expected to have a `parentNode` property.\n                         *\n                         * @param {array<object>} updates List of update configurations.\n                         * @param {array<string>} markupList List of markup strings.\n                         * @internal\n                         */\n                        processUpdates: function(updates, markupList) {\n                            var update\n                            // Mapping from parent IDs to initial child orderings.\n                            var initialChildren = null\n                            // List of children that will be moved or removed.\n                            var updatedChildren = null\n\n                            for (var i = 0; i < updates.length; i++) {\n                                update = updates[i]\n                                if (\n                                    update.type === ReactMultiChildUpdateTypes.MOVE_EXISTING ||\n                                    update.type === ReactMultiChildUpdateTypes.REMOVE_NODE\n                                ) {\n                                    var updatedIndex = update.fromIndex\n                                    var updatedChild = update.parentNode.childNodes[updatedIndex]\n                                    var parentID = update.parentID\n\n                                    \"production\" !== \"development\"\n                                        ? invariant(\n                                              updatedChild,\n                                              \"processUpdates(): Unable to find child %s of element. This \" +\n                                                  \"probably means the DOM was unexpectedly mutated (e.g., by the \" +\n                                                  \"browser), usually due to forgetting a <tbody> when using tables, \" +\n                                                  \"nesting tags like <form>, <p>, or <a>, or using non-SVG elements \" +\n                                                  \"in an <svg> parent. Try inspecting the child nodes of the element \" +\n                                                  \"with React ID `%s`.\",\n                                              updatedIndex,\n                                              parentID\n                                          )\n                                        : invariant(updatedChild)\n\n                                    initialChildren = initialChildren || {}\n                                    initialChildren[parentID] = initialChildren[parentID] || []\n                                    initialChildren[parentID][updatedIndex] = updatedChild\n\n                                    updatedChildren = updatedChildren || []\n                                    updatedChildren.push(updatedChild)\n                                }\n                            }\n\n                            var renderedMarkup = Danger.dangerouslyRenderMarkup(markupList)\n\n                            // Remove updated children first so that `toIndex` is consistent.\n                            if (updatedChildren) {\n                                for (var j = 0; j < updatedChildren.length; j++) {\n                                    updatedChildren[j].parentNode.removeChild(updatedChildren[j])\n                                }\n                            }\n\n                            for (var k = 0; k < updates.length; k++) {\n                                update = updates[k]\n                                switch (update.type) {\n                                    case ReactMultiChildUpdateTypes.INSERT_MARKUP:\n                                        insertChildAt(\n                                            update.parentNode,\n                                            renderedMarkup[update.markupIndex],\n                                            update.toIndex\n                                        )\n                                        break\n                                    case ReactMultiChildUpdateTypes.MOVE_EXISTING:\n                                        insertChildAt(\n                                            update.parentNode,\n                                            initialChildren[update.parentID][update.fromIndex],\n                                            update.toIndex\n                                        )\n                                        break\n                                    case ReactMultiChildUpdateTypes.TEXT_CONTENT:\n                                        setTextContent(update.parentNode, update.textContent)\n                                        break\n                                    case ReactMultiChildUpdateTypes.REMOVE_NODE:\n                                        // Already removed by the for-loop above.\n                                        break\n                                }\n                            }\n                        }\n                    }\n\n                    module.exports = DOMChildrenOperations\n                },\n                { \"13\": 13, \"150\": 150, \"165\": 165, \"79\": 79 }\n            ],\n            11: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule DOMProperty\n                     * @typechecks static-only\n                     */\n\n                    /*jslint bitwise: true */\n\n                    \"use strict\"\n\n                    var invariant = _dereq_(150)\n\n                    function checkMask(value, bitmask) {\n                        return (value & bitmask) === bitmask\n                    }\n\n                    var DOMPropertyInjection = {\n                        /**\n                         * Mapping from normalized, camelcased property names to a configuration that\n                         * specifies how the associated DOM property should be accessed or rendered.\n                         */\n                        MUST_USE_ATTRIBUTE: 0x1,\n                        MUST_USE_PROPERTY: 0x2,\n                        HAS_SIDE_EFFECTS: 0x4,\n                        HAS_BOOLEAN_VALUE: 0x8,\n                        HAS_NUMERIC_VALUE: 0x10,\n                        HAS_POSITIVE_NUMERIC_VALUE: 0x20 | 0x10,\n                        HAS_OVERLOADED_BOOLEAN_VALUE: 0x40,\n\n                        /**\n                         * Inject some specialized knowledge about the DOM. This takes a config object\n                         * with the following properties:\n                         *\n                         * isCustomAttribute: function that given an attribute name will return true\n                         * if it can be inserted into the DOM verbatim. Useful for data-* or aria-*\n                         * attributes where it's impossible to enumerate all of the possible\n                         * attribute names,\n                         *\n                         * Properties: object mapping DOM property name to one of the\n                         * DOMPropertyInjection constants or null. If your attribute isn't in here,\n                         * it won't get written to the DOM.\n                         *\n                         * DOMAttributeNames: object mapping React attribute name to the DOM\n                         * attribute name. Attribute names not specified use the **lowercase**\n                         * normalized name.\n                         *\n                         * DOMPropertyNames: similar to DOMAttributeNames but for DOM properties.\n                         * Property names not specified use the normalized name.\n                         *\n                         * DOMMutationMethods: Properties that require special mutation methods. If\n                         * `value` is undefined, the mutation method should unset the property.\n                         *\n                         * @param {object} domPropertyConfig the config as described above.\n                         */\n                        injectDOMPropertyConfig: function(domPropertyConfig) {\n                            var Properties = domPropertyConfig.Properties || {}\n                            var DOMAttributeNames = domPropertyConfig.DOMAttributeNames || {}\n                            var DOMPropertyNames = domPropertyConfig.DOMPropertyNames || {}\n                            var DOMMutationMethods = domPropertyConfig.DOMMutationMethods || {}\n\n                            if (domPropertyConfig.isCustomAttribute) {\n                                DOMProperty._isCustomAttributeFunctions.push(\n                                    domPropertyConfig.isCustomAttribute\n                                )\n                            }\n\n                            for (var propName in Properties) {\n                                \"production\" !== \"development\"\n                                    ? invariant(\n                                          !DOMProperty.isStandardName.hasOwnProperty(propName),\n                                          \"injectDOMPropertyConfig(...): You're trying to inject DOM property \" +\n                                              \"'%s' which has already been injected. You may be accidentally \" +\n                                              \"injecting the same DOM property config twice, or you may be \" +\n                                              \"injecting two configs that have conflicting property names.\",\n                                          propName\n                                      )\n                                    : invariant(\n                                          !DOMProperty.isStandardName.hasOwnProperty(propName)\n                                      )\n\n                                DOMProperty.isStandardName[propName] = true\n\n                                var lowerCased = propName.toLowerCase()\n                                DOMProperty.getPossibleStandardName[lowerCased] = propName\n\n                                if (DOMAttributeNames.hasOwnProperty(propName)) {\n                                    var attributeName = DOMAttributeNames[propName]\n                                    DOMProperty.getPossibleStandardName[attributeName] = propName\n                                    DOMProperty.getAttributeName[propName] = attributeName\n                                } else {\n                                    DOMProperty.getAttributeName[propName] = lowerCased\n                                }\n\n                                DOMProperty.getPropertyName[\n                                    propName\n                                ] = DOMPropertyNames.hasOwnProperty(propName)\n                                    ? DOMPropertyNames[propName]\n                                    : propName\n\n                                if (DOMMutationMethods.hasOwnProperty(propName)) {\n                                    DOMProperty.getMutationMethod[propName] =\n                                        DOMMutationMethods[propName]\n                                } else {\n                                    DOMProperty.getMutationMethod[propName] = null\n                                }\n\n                                var propConfig = Properties[propName]\n                                DOMProperty.mustUseAttribute[propName] = checkMask(\n                                    propConfig,\n                                    DOMPropertyInjection.MUST_USE_ATTRIBUTE\n                                )\n                                DOMProperty.mustUseProperty[propName] = checkMask(\n                                    propConfig,\n                                    DOMPropertyInjection.MUST_USE_PROPERTY\n                                )\n                                DOMProperty.hasSideEffects[propName] = checkMask(\n                                    propConfig,\n                                    DOMPropertyInjection.HAS_SIDE_EFFECTS\n                                )\n                                DOMProperty.hasBooleanValue[propName] = checkMask(\n                                    propConfig,\n                                    DOMPropertyInjection.HAS_BOOLEAN_VALUE\n                                )\n                                DOMProperty.hasNumericValue[propName] = checkMask(\n                                    propConfig,\n                                    DOMPropertyInjection.HAS_NUMERIC_VALUE\n                                )\n                                DOMProperty.hasPositiveNumericValue[propName] = checkMask(\n                                    propConfig,\n                                    DOMPropertyInjection.HAS_POSITIVE_NUMERIC_VALUE\n                                )\n                                DOMProperty.hasOverloadedBooleanValue[propName] = checkMask(\n                                    propConfig,\n                                    DOMPropertyInjection.HAS_OVERLOADED_BOOLEAN_VALUE\n                                )\n\n                                \"production\" !== \"development\"\n                                    ? invariant(\n                                          !DOMProperty.mustUseAttribute[propName] ||\n                                              !DOMProperty.mustUseProperty[propName],\n                                          \"DOMProperty: Cannot require using both attribute and property: %s\",\n                                          propName\n                                      )\n                                    : invariant(\n                                          !DOMProperty.mustUseAttribute[propName] ||\n                                              !DOMProperty.mustUseProperty[propName]\n                                      )\n                                \"production\" !== \"development\"\n                                    ? invariant(\n                                          DOMProperty.mustUseProperty[propName] ||\n                                              !DOMProperty.hasSideEffects[propName],\n                                          \"DOMProperty: Properties that have side effects must use property: %s\",\n                                          propName\n                                      )\n                                    : invariant(\n                                          DOMProperty.mustUseProperty[propName] ||\n                                              !DOMProperty.hasSideEffects[propName]\n                                      )\n                                \"production\" !== \"development\"\n                                    ? invariant(\n                                          !!DOMProperty.hasBooleanValue[propName] +\n                                              !!DOMProperty.hasNumericValue[propName] +\n                                              !!DOMProperty.hasOverloadedBooleanValue[propName] <=\n                                              1,\n                                          \"DOMProperty: Value can be one of boolean, overloaded boolean, or \" +\n                                              \"numeric value, but not a combination: %s\",\n                                          propName\n                                      )\n                                    : invariant(\n                                          !!DOMProperty.hasBooleanValue[propName] +\n                                              !!DOMProperty.hasNumericValue[propName] +\n                                              !!DOMProperty.hasOverloadedBooleanValue[propName] <=\n                                              1\n                                      )\n                            }\n                        }\n                    }\n                    var defaultValueCache = {}\n\n                    /**\n                     * DOMProperty exports lookup objects that can be used like functions:\n                     *\n                     *   > DOMProperty.isValid['id']\n                     *   true\n                     *   > DOMProperty.isValid['foobar']\n                     *   undefined\n                     *\n                     * Although this may be confusing, it performs better in general.\n                     *\n                     * @see http://jsperf.com/key-exists\n                     * @see http://jsperf.com/key-missing\n                     */\n                    var DOMProperty = {\n                        ID_ATTRIBUTE_NAME: \"data-reactid\",\n\n                        /**\n                         * Checks whether a property name is a standard property.\n                         * @type {Object}\n                         */\n                        isStandardName: {},\n\n                        /**\n                         * Mapping from lowercase property names to the properly cased version, used\n                         * to warn in the case of missing properties.\n                         * @type {Object}\n                         */\n                        getPossibleStandardName: {},\n\n                        /**\n                         * Mapping from normalized names to attribute names that differ. Attribute\n                         * names are used when rendering markup or with `*Attribute()`.\n                         * @type {Object}\n                         */\n                        getAttributeName: {},\n\n                        /**\n                         * Mapping from normalized names to properties on DOM node instances.\n                         * (This includes properties that mutate due to external factors.)\n                         * @type {Object}\n                         */\n                        getPropertyName: {},\n\n                        /**\n                         * Mapping from normalized names to mutation methods. This will only exist if\n                         * mutation cannot be set simply by the property or `setAttribute()`.\n                         * @type {Object}\n                         */\n                        getMutationMethod: {},\n\n                        /**\n                         * Whether the property must be accessed and mutated as an object property.\n                         * @type {Object}\n                         */\n                        mustUseAttribute: {},\n\n                        /**\n                         * Whether the property must be accessed and mutated using `*Attribute()`.\n                         * (This includes anything that fails `<propName> in <element>`.)\n                         * @type {Object}\n                         */\n                        mustUseProperty: {},\n\n                        /**\n                         * Whether or not setting a value causes side effects such as triggering\n                         * resources to be loaded or text selection changes. We must ensure that\n                         * the value is only set if it has changed.\n                         * @type {Object}\n                         */\n                        hasSideEffects: {},\n\n                        /**\n                         * Whether the property should be removed when set to a falsey value.\n                         * @type {Object}\n                         */\n                        hasBooleanValue: {},\n\n                        /**\n                         * Whether the property must be numeric or parse as a\n                         * numeric and should be removed when set to a falsey value.\n                         * @type {Object}\n                         */\n                        hasNumericValue: {},\n\n                        /**\n                         * Whether the property must be positive numeric or parse as a positive\n                         * numeric and should be removed when set to a falsey value.\n                         * @type {Object}\n                         */\n                        hasPositiveNumericValue: {},\n\n                        /**\n                         * Whether the property can be used as a flag as well as with a value. Removed\n                         * when strictly equal to false; present without a value when strictly equal\n                         * to true; present with a value otherwise.\n                         * @type {Object}\n                         */\n                        hasOverloadedBooleanValue: {},\n\n                        /**\n                         * All of the isCustomAttribute() functions that have been injected.\n                         */\n                        _isCustomAttributeFunctions: [],\n\n                        /**\n                         * Checks whether a property name is a custom attribute.\n                         * @method\n                         */\n                        isCustomAttribute: function(attributeName) {\n                            for (\n                                var i = 0;\n                                i < DOMProperty._isCustomAttributeFunctions.length;\n                                i++\n                            ) {\n                                var isCustomAttributeFn = DOMProperty._isCustomAttributeFunctions[i]\n                                if (isCustomAttributeFn(attributeName)) {\n                                    return true\n                                }\n                            }\n                            return false\n                        },\n\n                        /**\n                         * Returns the default property value for a DOM property (i.e., not an\n                         * attribute). Most default values are '' or false, but not all. Worse yet,\n                         * some (in particular, `type`) vary depending on the type of element.\n                         *\n                         * TODO: Is it better to grab all the possible properties when creating an\n                         * element to avoid having to create the same element twice?\n                         */\n                        getDefaultValueForProperty: function(nodeName, prop) {\n                            var nodeDefaults = defaultValueCache[nodeName]\n                            var testElement\n                            if (!nodeDefaults) {\n                                defaultValueCache[nodeName] = nodeDefaults = {}\n                            }\n                            if (!(prop in nodeDefaults)) {\n                                testElement = document.createElement(nodeName)\n                                nodeDefaults[prop] = testElement[prop]\n                            }\n                            return nodeDefaults[prop]\n                        },\n\n                        injection: DOMPropertyInjection\n                    }\n\n                    module.exports = DOMProperty\n                },\n                { \"150\": 150 }\n            ],\n            12: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule DOMPropertyOperations\n                     * @typechecks static-only\n                     */\n\n                    \"use strict\"\n\n                    var DOMProperty = _dereq_(11)\n\n                    var quoteAttributeValueForBrowser = _dereq_(163)\n                    var warning = _dereq_(171)\n\n                    function shouldIgnoreValue(name, value) {\n                        return (\n                            value == null ||\n                            (DOMProperty.hasBooleanValue[name] && !value) ||\n                            (DOMProperty.hasNumericValue[name] && isNaN(value)) ||\n                            (DOMProperty.hasPositiveNumericValue[name] && value < 1) ||\n                            (DOMProperty.hasOverloadedBooleanValue[name] && value === false)\n                        )\n                    }\n\n                    if (\"production\" !== \"development\") {\n                        var reactProps = {\n                            children: true,\n                            dangerouslySetInnerHTML: true,\n                            key: true,\n                            ref: true\n                        }\n                        var warnedProperties = {}\n\n                        var warnUnknownProperty = function(name) {\n                            if (\n                                (reactProps.hasOwnProperty(name) && reactProps[name]) ||\n                                (warnedProperties.hasOwnProperty(name) && warnedProperties[name])\n                            ) {\n                                return\n                            }\n\n                            warnedProperties[name] = true\n                            var lowerCasedName = name.toLowerCase()\n\n                            // data-* attributes should be lowercase; suggest the lowercase version\n                            var standardName = DOMProperty.isCustomAttribute(lowerCasedName)\n                                ? lowerCasedName\n                                : DOMProperty.getPossibleStandardName.hasOwnProperty(lowerCasedName)\n                                ? DOMProperty.getPossibleStandardName[lowerCasedName]\n                                : null\n\n                            // For now, only warn when we have a suggested correction. This prevents\n                            // logging too much when using transferPropsTo.\n                            \"production\" !== \"development\"\n                                ? warning(\n                                      standardName == null,\n                                      \"Unknown DOM property %s. Did you mean %s?\",\n                                      name,\n                                      standardName\n                                  )\n                                : null\n                        }\n                    }\n\n                    /**\n                     * Operations for dealing with DOM properties.\n                     */\n                    var DOMPropertyOperations = {\n                        /**\n                         * Creates markup for the ID property.\n                         *\n                         * @param {string} id Unescaped ID.\n                         * @return {string} Markup string.\n                         */\n                        createMarkupForID: function(id) {\n                            return (\n                                DOMProperty.ID_ATTRIBUTE_NAME +\n                                \"=\" +\n                                quoteAttributeValueForBrowser(id)\n                            )\n                        },\n\n                        /**\n                         * Creates markup for a property.\n                         *\n                         * @param {string} name\n                         * @param {*} value\n                         * @return {?string} Markup string, or null if the property was invalid.\n                         */\n                        createMarkupForProperty: function(name, value) {\n                            if (\n                                DOMProperty.isStandardName.hasOwnProperty(name) &&\n                                DOMProperty.isStandardName[name]\n                            ) {\n                                if (shouldIgnoreValue(name, value)) {\n                                    return \"\"\n                                }\n                                var attributeName = DOMProperty.getAttributeName[name]\n                                if (\n                                    DOMProperty.hasBooleanValue[name] ||\n                                    (DOMProperty.hasOverloadedBooleanValue[name] && value === true)\n                                ) {\n                                    return attributeName\n                                }\n                                return attributeName + \"=\" + quoteAttributeValueForBrowser(value)\n                            } else if (DOMProperty.isCustomAttribute(name)) {\n                                if (value == null) {\n                                    return \"\"\n                                }\n                                return name + \"=\" + quoteAttributeValueForBrowser(value)\n                            } else if (\"production\" !== \"development\") {\n                                warnUnknownProperty(name)\n                            }\n                            return null\n                        },\n\n                        /**\n                         * Sets the value for a property on a node.\n                         *\n                         * @param {DOMElement} node\n                         * @param {string} name\n                         * @param {*} value\n                         */\n                        setValueForProperty: function(node, name, value) {\n                            if (\n                                DOMProperty.isStandardName.hasOwnProperty(name) &&\n                                DOMProperty.isStandardName[name]\n                            ) {\n                                var mutationMethod = DOMProperty.getMutationMethod[name]\n                                if (mutationMethod) {\n                                    mutationMethod(node, value)\n                                } else if (shouldIgnoreValue(name, value)) {\n                                    this.deleteValueForProperty(node, name)\n                                } else if (DOMProperty.mustUseAttribute[name]) {\n                                    // `setAttribute` with objects becomes only `[object]` in IE8/9,\n                                    // ('' + value) makes it output the correct toString()-value.\n                                    node.setAttribute(\n                                        DOMProperty.getAttributeName[name],\n                                        \"\" + value\n                                    )\n                                } else {\n                                    var propName = DOMProperty.getPropertyName[name]\n                                    // Must explicitly cast values for HAS_SIDE_EFFECTS-properties to the\n                                    // property type before comparing; only `value` does and is string.\n                                    if (\n                                        !DOMProperty.hasSideEffects[name] ||\n                                        \"\" + node[propName] !== \"\" + value\n                                    ) {\n                                        // Contrary to `setAttribute`, object properties are properly\n                                        // `toString`ed by IE8/9.\n                                        node[propName] = value\n                                    }\n                                }\n                            } else if (DOMProperty.isCustomAttribute(name)) {\n                                if (value == null) {\n                                    node.removeAttribute(name)\n                                } else {\n                                    node.setAttribute(name, \"\" + value)\n                                }\n                            } else if (\"production\" !== \"development\") {\n                                warnUnknownProperty(name)\n                            }\n                        },\n\n                        /**\n                         * Deletes the value for a property on a node.\n                         *\n                         * @param {DOMElement} node\n                         * @param {string} name\n                         */\n                        deleteValueForProperty: function(node, name) {\n                            if (\n                                DOMProperty.isStandardName.hasOwnProperty(name) &&\n                                DOMProperty.isStandardName[name]\n                            ) {\n                                var mutationMethod = DOMProperty.getMutationMethod[name]\n                                if (mutationMethod) {\n                                    mutationMethod(node, undefined)\n                                } else if (DOMProperty.mustUseAttribute[name]) {\n                                    node.removeAttribute(DOMProperty.getAttributeName[name])\n                                } else {\n                                    var propName = DOMProperty.getPropertyName[name]\n                                    var defaultValue = DOMProperty.getDefaultValueForProperty(\n                                        node.nodeName,\n                                        propName\n                                    )\n                                    if (\n                                        !DOMProperty.hasSideEffects[name] ||\n                                        \"\" + node[propName] !== defaultValue\n                                    ) {\n                                        node[propName] = defaultValue\n                                    }\n                                }\n                            } else if (DOMProperty.isCustomAttribute(name)) {\n                                node.removeAttribute(name)\n                            } else if (\"production\" !== \"development\") {\n                                warnUnknownProperty(name)\n                            }\n                        }\n                    }\n\n                    module.exports = DOMPropertyOperations\n                },\n                { \"11\": 11, \"163\": 163, \"171\": 171 }\n            ],\n            13: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule Danger\n                     * @typechecks static-only\n                     */\n\n                    /*jslint evil: true, sub: true */\n\n                    \"use strict\"\n\n                    var ExecutionEnvironment = _dereq_(22)\n\n                    var createNodesFromMarkup = _dereq_(126)\n                    var emptyFunction = _dereq_(129)\n                    var getMarkupWrap = _dereq_(142)\n                    var invariant = _dereq_(150)\n\n                    var OPEN_TAG_NAME_EXP = /^(<[^ \\/>]+)/\n                    var RESULT_INDEX_ATTR = \"data-danger-index\"\n\n                    /**\n                     * Extracts the `nodeName` from a string of markup.\n                     *\n                     * NOTE: Extracting the `nodeName` does not require a regular expression match\n                     * because we make assumptions about React-generated markup (i.e. there are no\n                     * spaces surrounding the opening tag and there is at least one attribute).\n                     *\n                     * @param {string} markup String of markup.\n                     * @return {string} Node name of the supplied markup.\n                     * @see http://jsperf.com/extract-nodename\n                     */\n                    function getNodeName(markup) {\n                        return markup.substring(1, markup.indexOf(\" \"))\n                    }\n\n                    var Danger = {\n                        /**\n                         * Renders markup into an array of nodes. The markup is expected to render\n                         * into a list of root nodes. Also, the length of `resultList` and\n                         * `markupList` should be the same.\n                         *\n                         * @param {array<string>} markupList List of markup strings to render.\n                         * @return {array<DOMElement>} List of rendered nodes.\n                         * @internal\n                         */\n                        dangerouslyRenderMarkup: function(markupList) {\n                            \"production\" !== \"development\"\n                                ? invariant(\n                                      ExecutionEnvironment.canUseDOM,\n                                      \"dangerouslyRenderMarkup(...): Cannot render markup in a worker \" +\n                                          \"thread. Make sure `window` and `document` are available globally \" +\n                                          \"before requiring React when unit testing or use \" +\n                                          \"React.renderToString for server rendering.\"\n                                  )\n                                : invariant(ExecutionEnvironment.canUseDOM)\n                            var nodeName\n                            var markupByNodeName = {}\n                            // Group markup by `nodeName` if a wrap is necessary, else by '*'.\n                            for (var i = 0; i < markupList.length; i++) {\n                                \"production\" !== \"development\"\n                                    ? invariant(\n                                          markupList[i],\n                                          \"dangerouslyRenderMarkup(...): Missing markup.\"\n                                      )\n                                    : invariant(markupList[i])\n                                nodeName = getNodeName(markupList[i])\n                                nodeName = getMarkupWrap(nodeName) ? nodeName : \"*\"\n                                markupByNodeName[nodeName] = markupByNodeName[nodeName] || []\n                                markupByNodeName[nodeName][i] = markupList[i]\n                            }\n                            var resultList = []\n                            var resultListAssignmentCount = 0\n                            for (nodeName in markupByNodeName) {\n                                if (!markupByNodeName.hasOwnProperty(nodeName)) {\n                                    continue\n                                }\n                                var markupListByNodeName = markupByNodeName[nodeName]\n\n                                // This for-in loop skips the holes of the sparse array. The order of\n                                // iteration should follow the order of assignment, which happens to match\n                                // numerical index order, but we don't rely on that.\n                                var resultIndex\n                                for (resultIndex in markupListByNodeName) {\n                                    if (markupListByNodeName.hasOwnProperty(resultIndex)) {\n                                        var markup = markupListByNodeName[resultIndex]\n\n                                        // Push the requested markup with an additional RESULT_INDEX_ATTR\n                                        // attribute.  If the markup does not start with a < character, it\n                                        // will be discarded below (with an appropriate console.error).\n                                        markupListByNodeName[resultIndex] = markup.replace(\n                                            OPEN_TAG_NAME_EXP,\n                                            // This index will be parsed back out below.\n                                            \"$1 \" + RESULT_INDEX_ATTR + '=\"' + resultIndex + '\" '\n                                        )\n                                    }\n                                }\n\n                                // Render each group of markup with similar wrapping `nodeName`.\n                                var renderNodes = createNodesFromMarkup(\n                                    markupListByNodeName.join(\"\"),\n                                    emptyFunction // Do nothing special with <script> tags.\n                                )\n\n                                for (var j = 0; j < renderNodes.length; ++j) {\n                                    var renderNode = renderNodes[j]\n                                    if (\n                                        renderNode.hasAttribute &&\n                                        renderNode.hasAttribute(RESULT_INDEX_ATTR)\n                                    ) {\n                                        resultIndex = +renderNode.getAttribute(RESULT_INDEX_ATTR)\n                                        renderNode.removeAttribute(RESULT_INDEX_ATTR)\n\n                                        \"production\" !== \"development\"\n                                            ? invariant(\n                                                  !resultList.hasOwnProperty(resultIndex),\n                                                  \"Danger: Assigning to an already-occupied result index.\"\n                                              )\n                                            : invariant(!resultList.hasOwnProperty(resultIndex))\n\n                                        resultList[resultIndex] = renderNode\n\n                                        // This should match resultList.length and markupList.length when\n                                        // we're done.\n                                        resultListAssignmentCount += 1\n                                    } else if (\"production\" !== \"development\") {\n                                        console.error(\n                                            \"Danger: Discarding unexpected node:\",\n                                            renderNode\n                                        )\n                                    }\n                                }\n                            }\n\n                            // Although resultList was populated out of order, it should now be a dense\n                            // array.\n                            \"production\" !== \"development\"\n                                ? invariant(\n                                      resultListAssignmentCount === resultList.length,\n                                      \"Danger: Did not assign to every index of resultList.\"\n                                  )\n                                : invariant(resultListAssignmentCount === resultList.length)\n\n                            \"production\" !== \"development\"\n                                ? invariant(\n                                      resultList.length === markupList.length,\n                                      \"Danger: Expected markup to render %s nodes, but rendered %s.\",\n                                      markupList.length,\n                                      resultList.length\n                                  )\n                                : invariant(resultList.length === markupList.length)\n\n                            return resultList\n                        },\n\n                        /**\n                         * Replaces a node with a string of markup at its current position within its\n                         * parent. The markup must render into a single root node.\n                         *\n                         * @param {DOMElement} oldChild Child node to replace.\n                         * @param {string} markup Markup to render in place of the child node.\n                         * @internal\n                         */\n                        dangerouslyReplaceNodeWithMarkup: function(oldChild, markup) {\n                            \"production\" !== \"development\"\n                                ? invariant(\n                                      ExecutionEnvironment.canUseDOM,\n                                      \"dangerouslyReplaceNodeWithMarkup(...): Cannot render markup in a \" +\n                                          \"worker thread. Make sure `window` and `document` are available \" +\n                                          \"globally before requiring React when unit testing or use \" +\n                                          \"React.renderToString for server rendering.\"\n                                  )\n                                : invariant(ExecutionEnvironment.canUseDOM)\n                            \"production\" !== \"development\"\n                                ? invariant(\n                                      markup,\n                                      \"dangerouslyReplaceNodeWithMarkup(...): Missing markup.\"\n                                  )\n                                : invariant(markup)\n                            \"production\" !== \"development\"\n                                ? invariant(\n                                      oldChild.tagName.toLowerCase() !== \"html\",\n                                      \"dangerouslyReplaceNodeWithMarkup(...): Cannot replace markup of the \" +\n                                          \"<html> node. This is because browser quirks make this unreliable \" +\n                                          \"and/or slow. If you want to render to the root you must use \" +\n                                          \"server rendering. See React.renderToString().\"\n                                  )\n                                : invariant(oldChild.tagName.toLowerCase() !== \"html\")\n\n                            var newChild = createNodesFromMarkup(markup, emptyFunction)[0]\n                            oldChild.parentNode.replaceChild(newChild, oldChild)\n                        }\n                    }\n\n                    module.exports = Danger\n                },\n                { \"126\": 126, \"129\": 129, \"142\": 142, \"150\": 150, \"22\": 22 }\n            ],\n            14: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule DefaultEventPluginOrder\n                     */\n\n                    \"use strict\"\n\n                    var keyOf = _dereq_(157)\n\n                    /**\n                     * Module that is injectable into `EventPluginHub`, that specifies a\n                     * deterministic ordering of `EventPlugin`s. A convenient way to reason about\n                     * plugins, without having to package every one of them. This is better than\n                     * having plugins be ordered in the same order that they are injected because\n                     * that ordering would be influenced by the packaging order.\n                     * `ResponderEventPlugin` must occur before `SimpleEventPlugin` so that\n                     * preventing default on events is convenient in `SimpleEventPlugin` handlers.\n                     */\n                    var DefaultEventPluginOrder = [\n                        keyOf({ ResponderEventPlugin: null }),\n                        keyOf({ SimpleEventPlugin: null }),\n                        keyOf({ TapEventPlugin: null }),\n                        keyOf({ EnterLeaveEventPlugin: null }),\n                        keyOf({ ChangeEventPlugin: null }),\n                        keyOf({ SelectEventPlugin: null }),\n                        keyOf({ BeforeInputEventPlugin: null }),\n                        keyOf({ AnalyticsEventPlugin: null }),\n                        keyOf({ MobileSafariClickEventPlugin: null })\n                    ]\n\n                    module.exports = DefaultEventPluginOrder\n                },\n                { \"157\": 157 }\n            ],\n            15: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule EnterLeaveEventPlugin\n                     * @typechecks static-only\n                     */\n\n                    \"use strict\"\n\n                    var EventConstants = _dereq_(16)\n                    var EventPropagators = _dereq_(21)\n                    var SyntheticMouseEvent = _dereq_(112)\n\n                    var ReactMount = _dereq_(77)\n                    var keyOf = _dereq_(157)\n\n                    var topLevelTypes = EventConstants.topLevelTypes\n                    var getFirstReactDOM = ReactMount.getFirstReactDOM\n\n                    var eventTypes = {\n                        mouseEnter: {\n                            registrationName: keyOf({ onMouseEnter: null }),\n                            dependencies: [topLevelTypes.topMouseOut, topLevelTypes.topMouseOver]\n                        },\n                        mouseLeave: {\n                            registrationName: keyOf({ onMouseLeave: null }),\n                            dependencies: [topLevelTypes.topMouseOut, topLevelTypes.topMouseOver]\n                        }\n                    }\n\n                    var extractedEvents = [null, null]\n\n                    var EnterLeaveEventPlugin = {\n                        eventTypes: eventTypes,\n\n                        /**\n                         * For almost every interaction we care about, there will be both a top-level\n                         * `mouseover` and `mouseout` event that occurs. Only use `mouseout` so that\n                         * we do not extract duplicate events. However, moving the mouse into the\n                         * browser from outside will not fire a `mouseout` event. In this case, we use\n                         * the `mouseover` top-level event.\n                         *\n                         * @param {string} topLevelType Record from `EventConstants`.\n                         * @param {DOMEventTarget} topLevelTarget The listening component root node.\n                         * @param {string} topLevelTargetID ID of `topLevelTarget`.\n                         * @param {object} nativeEvent Native browser event.\n                         * @return {*} An accumulation of synthetic events.\n                         * @see {EventPluginHub.extractEvents}\n                         */\n                        extractEvents: function(\n                            topLevelType,\n                            topLevelTarget,\n                            topLevelTargetID,\n                            nativeEvent\n                        ) {\n                            if (\n                                topLevelType === topLevelTypes.topMouseOver &&\n                                (nativeEvent.relatedTarget || nativeEvent.fromElement)\n                            ) {\n                                return null\n                            }\n                            if (\n                                topLevelType !== topLevelTypes.topMouseOut &&\n                                topLevelType !== topLevelTypes.topMouseOver\n                            ) {\n                                // Must not be a mouse in or mouse out - ignoring.\n                                return null\n                            }\n\n                            var win\n                            if (topLevelTarget.window === topLevelTarget) {\n                                // `topLevelTarget` is probably a window object.\n                                win = topLevelTarget\n                            } else {\n                                // TODO: Figure out why `ownerDocument` is sometimes undefined in IE8.\n                                var doc = topLevelTarget.ownerDocument\n                                if (doc) {\n                                    win = doc.defaultView || doc.parentWindow\n                                } else {\n                                    win = window\n                                }\n                            }\n\n                            var from, to\n                            if (topLevelType === topLevelTypes.topMouseOut) {\n                                from = topLevelTarget\n                                to =\n                                    getFirstReactDOM(\n                                        nativeEvent.relatedTarget || nativeEvent.toElement\n                                    ) || win\n                            } else {\n                                from = win\n                                to = topLevelTarget\n                            }\n\n                            if (from === to) {\n                                // Nothing pertains to our managed components.\n                                return null\n                            }\n\n                            var fromID = from ? ReactMount.getID(from) : \"\"\n                            var toID = to ? ReactMount.getID(to) : \"\"\n\n                            var leave = SyntheticMouseEvent.getPooled(\n                                eventTypes.mouseLeave,\n                                fromID,\n                                nativeEvent\n                            )\n                            leave.type = \"mouseleave\"\n                            leave.target = from\n                            leave.relatedTarget = to\n\n                            var enter = SyntheticMouseEvent.getPooled(\n                                eventTypes.mouseEnter,\n                                toID,\n                                nativeEvent\n                            )\n                            enter.type = \"mouseenter\"\n                            enter.target = to\n                            enter.relatedTarget = from\n\n                            EventPropagators.accumulateEnterLeaveDispatches(\n                                leave,\n                                enter,\n                                fromID,\n                                toID\n                            )\n\n                            extractedEvents[0] = leave\n                            extractedEvents[1] = enter\n\n                            return extractedEvents\n                        }\n                    }\n\n                    module.exports = EnterLeaveEventPlugin\n                },\n                { \"112\": 112, \"157\": 157, \"16\": 16, \"21\": 21, \"77\": 77 }\n            ],\n            16: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule EventConstants\n                     */\n\n                    \"use strict\"\n\n                    var keyMirror = _dereq_(156)\n\n                    var PropagationPhases = keyMirror({ bubbled: null, captured: null })\n\n                    /**\n                     * Types of raw signals from the browser caught at the top level.\n                     */\n                    var topLevelTypes = keyMirror({\n                        topBlur: null,\n                        topChange: null,\n                        topClick: null,\n                        topCompositionEnd: null,\n                        topCompositionStart: null,\n                        topCompositionUpdate: null,\n                        topContextMenu: null,\n                        topCopy: null,\n                        topCut: null,\n                        topDoubleClick: null,\n                        topDrag: null,\n                        topDragEnd: null,\n                        topDragEnter: null,\n                        topDragExit: null,\n                        topDragLeave: null,\n                        topDragOver: null,\n                        topDragStart: null,\n                        topDrop: null,\n                        topError: null,\n                        topFocus: null,\n                        topInput: null,\n                        topKeyDown: null,\n                        topKeyPress: null,\n                        topKeyUp: null,\n                        topLoad: null,\n                        topMouseDown: null,\n                        topMouseMove: null,\n                        topMouseOut: null,\n                        topMouseOver: null,\n                        topMouseUp: null,\n                        topPaste: null,\n                        topReset: null,\n                        topScroll: null,\n                        topSelectionChange: null,\n                        topSubmit: null,\n                        topTextInput: null,\n                        topTouchCancel: null,\n                        topTouchEnd: null,\n                        topTouchMove: null,\n                        topTouchStart: null,\n                        topWheel: null\n                    })\n\n                    var EventConstants = {\n                        topLevelTypes: topLevelTypes,\n                        PropagationPhases: PropagationPhases\n                    }\n\n                    module.exports = EventConstants\n                },\n                { \"156\": 156 }\n            ],\n            17: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     *\n                     * Licensed under the Apache License, Version 2.0 (the \"License\");\n                     * you may not use this file except in compliance with the License.\n                     * You may obtain a copy of the License at\n                     *\n                     * http://www.apache.org/licenses/LICENSE-2.0\n                     *\n                     * Unless required by applicable law or agreed to in writing, software\n                     * distributed under the License is distributed on an \"AS IS\" BASIS,\n                     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n                     * See the License for the specific language governing permissions and\n                     * limitations under the License.\n                     *\n                     * @providesModule EventListener\n                     * @typechecks\n                     */\n\n                    var emptyFunction = _dereq_(129)\n\n                    /**\n                     * Upstream version of event listener. Does not take into account specific\n                     * nature of platform.\n                     */\n                    var EventListener = {\n                        /**\n                         * Listen to DOM events during the bubble phase.\n                         *\n                         * @param {DOMEventTarget} target DOM element to register listener on.\n                         * @param {string} eventType Event type, e.g. 'click' or 'mouseover'.\n                         * @param {function} callback Callback function.\n                         * @return {object} Object with a `remove` method.\n                         */\n                        listen: function(target, eventType, callback) {\n                            if (target.addEventListener) {\n                                target.addEventListener(eventType, callback, false)\n                                return {\n                                    remove: function() {\n                                        target.removeEventListener(eventType, callback, false)\n                                    }\n                                }\n                            } else if (target.attachEvent) {\n                                target.attachEvent(\"on\" + eventType, callback)\n                                return {\n                                    remove: function() {\n                                        target.detachEvent(\"on\" + eventType, callback)\n                                    }\n                                }\n                            }\n                        },\n\n                        /**\n                         * Listen to DOM events during the capture phase.\n                         *\n                         * @param {DOMEventTarget} target DOM element to register listener on.\n                         * @param {string} eventType Event type, e.g. 'click' or 'mouseover'.\n                         * @param {function} callback Callback function.\n                         * @return {object} Object with a `remove` method.\n                         */\n                        capture: function(target, eventType, callback) {\n                            if (!target.addEventListener) {\n                                if (\"production\" !== \"development\") {\n                                    console.error(\n                                        \"Attempted to listen to events during the capture phase on a \" +\n                                            \"browser that does not support the capture phase. Your application \" +\n                                            \"will not receive some events.\"\n                                    )\n                                }\n                                return {\n                                    remove: emptyFunction\n                                }\n                            } else {\n                                target.addEventListener(eventType, callback, true)\n                                return {\n                                    remove: function() {\n                                        target.removeEventListener(eventType, callback, true)\n                                    }\n                                }\n                            }\n                        },\n\n                        registerDefault: function() {}\n                    }\n\n                    module.exports = EventListener\n                },\n                { \"129\": 129 }\n            ],\n            18: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule EventPluginHub\n                     */\n\n                    \"use strict\"\n\n                    var EventPluginRegistry = _dereq_(19)\n                    var EventPluginUtils = _dereq_(20)\n\n                    var accumulateInto = _dereq_(118)\n                    var forEachAccumulated = _dereq_(135)\n                    var invariant = _dereq_(150)\n\n                    /**\n                     * Internal store for event listeners\n                     */\n                    var listenerBank = {}\n\n                    /**\n                     * Internal queue of events that have accumulated their dispatches and are\n                     * waiting to have their dispatches executed.\n                     */\n                    var eventQueue = null\n\n                    /**\n                     * Dispatches an event and releases it back into the pool, unless persistent.\n                     *\n                     * @param {?object} event Synthetic event to be dispatched.\n                     * @private\n                     */\n                    var executeDispatchesAndRelease = function(event) {\n                        if (event) {\n                            var executeDispatch = EventPluginUtils.executeDispatch\n                            // Plugins can provide custom behavior when dispatching events.\n                            var PluginModule = EventPluginRegistry.getPluginModuleForEvent(event)\n                            if (PluginModule && PluginModule.executeDispatch) {\n                                executeDispatch = PluginModule.executeDispatch\n                            }\n                            EventPluginUtils.executeDispatchesInOrder(event, executeDispatch)\n\n                            if (!event.isPersistent()) {\n                                event.constructor.release(event)\n                            }\n                        }\n                    }\n\n                    /**\n                     * - `InstanceHandle`: [required] Module that performs logical traversals of DOM\n                     *   hierarchy given ids of the logical DOM elements involved.\n                     */\n                    var InstanceHandle = null\n\n                    function validateInstanceHandle() {\n                        var valid =\n                            InstanceHandle &&\n                            InstanceHandle.traverseTwoPhase &&\n                            InstanceHandle.traverseEnterLeave\n                        \"production\" !== \"development\"\n                            ? invariant(valid, \"InstanceHandle not injected before use!\")\n                            : invariant(valid)\n                    }\n\n                    /**\n                     * This is a unified interface for event plugins to be installed and configured.\n                     *\n                     * Event plugins can implement the following properties:\n                     *\n                     *   `extractEvents` {function(string, DOMEventTarget, string, object): *}\n                     *     Required. When a top-level event is fired, this method is expected to\n                     *     extract synthetic events that will in turn be queued and dispatched.\n                     *\n                     *   `eventTypes` {object}\n                     *     Optional, plugins that fire events must publish a mapping of registration\n                     *     names that are used to register listeners. Values of this mapping must\n                     *     be objects that contain `registrationName` or `phasedRegistrationNames`.\n                     *\n                     *   `executeDispatch` {function(object, function, string)}\n                     *     Optional, allows plugins to override how an event gets dispatched. By\n                     *     default, the listener is simply invoked.\n                     *\n                     * Each plugin that is injected into `EventsPluginHub` is immediately operable.\n                     *\n                     * @public\n                     */\n                    var EventPluginHub = {\n                        /**\n                         * Methods for injecting dependencies.\n                         */\n                        injection: {\n                            /**\n                             * @param {object} InjectedMount\n                             * @public\n                             */\n                            injectMount: EventPluginUtils.injection.injectMount,\n\n                            /**\n                             * @param {object} InjectedInstanceHandle\n                             * @public\n                             */\n                            injectInstanceHandle: function(InjectedInstanceHandle) {\n                                InstanceHandle = InjectedInstanceHandle\n                                if (\"production\" !== \"development\") {\n                                    validateInstanceHandle()\n                                }\n                            },\n\n                            getInstanceHandle: function() {\n                                if (\"production\" !== \"development\") {\n                                    validateInstanceHandle()\n                                }\n                                return InstanceHandle\n                            },\n\n                            /**\n                             * @param {array} InjectedEventPluginOrder\n                             * @public\n                             */\n                            injectEventPluginOrder: EventPluginRegistry.injectEventPluginOrder,\n\n                            /**\n                             * @param {object} injectedNamesToPlugins Map from names to plugin modules.\n                             */\n                            injectEventPluginsByName: EventPluginRegistry.injectEventPluginsByName\n                        },\n\n                        eventNameDispatchConfigs: EventPluginRegistry.eventNameDispatchConfigs,\n\n                        registrationNameModules: EventPluginRegistry.registrationNameModules,\n\n                        /**\n                         * Stores `listener` at `listenerBank[registrationName][id]`. Is idempotent.\n                         *\n                         * @param {string} id ID of the DOM element.\n                         * @param {string} registrationName Name of listener (e.g. `onClick`).\n                         * @param {?function} listener The callback to store.\n                         */\n                        putListener: function(id, registrationName, listener) {\n                            \"production\" !== \"development\"\n                                ? invariant(\n                                      !listener || typeof listener === \"function\",\n                                      \"Expected %s listener to be a function, instead got type %s\",\n                                      registrationName,\n                                      typeof listener\n                                  )\n                                : invariant(!listener || typeof listener === \"function\")\n\n                            var bankForRegistrationName =\n                                listenerBank[registrationName] ||\n                                (listenerBank[registrationName] = {})\n                            bankForRegistrationName[id] = listener\n                        },\n\n                        /**\n                         * @param {string} id ID of the DOM element.\n                         * @param {string} registrationName Name of listener (e.g. `onClick`).\n                         * @return {?function} The stored callback.\n                         */\n                        getListener: function(id, registrationName) {\n                            var bankForRegistrationName = listenerBank[registrationName]\n                            return bankForRegistrationName && bankForRegistrationName[id]\n                        },\n\n                        /**\n                         * Deletes a listener from the registration bank.\n                         *\n                         * @param {string} id ID of the DOM element.\n                         * @param {string} registrationName Name of listener (e.g. `onClick`).\n                         */\n                        deleteListener: function(id, registrationName) {\n                            var bankForRegistrationName = listenerBank[registrationName]\n                            if (bankForRegistrationName) {\n                                delete bankForRegistrationName[id]\n                            }\n                        },\n\n                        /**\n                         * Deletes all listeners for the DOM element with the supplied ID.\n                         *\n                         * @param {string} id ID of the DOM element.\n                         */\n                        deleteAllListeners: function(id) {\n                            for (var registrationName in listenerBank) {\n                                delete listenerBank[registrationName][id]\n                            }\n                        },\n\n                        /**\n                         * Allows registered plugins an opportunity to extract events from top-level\n                         * native browser events.\n                         *\n                         * @param {string} topLevelType Record from `EventConstants`.\n                         * @param {DOMEventTarget} topLevelTarget The listening component root node.\n                         * @param {string} topLevelTargetID ID of `topLevelTarget`.\n                         * @param {object} nativeEvent Native browser event.\n                         * @return {*} An accumulation of synthetic events.\n                         * @internal\n                         */\n                        extractEvents: function(\n                            topLevelType,\n                            topLevelTarget,\n                            topLevelTargetID,\n                            nativeEvent\n                        ) {\n                            var events\n                            var plugins = EventPluginRegistry.plugins\n                            for (var i = 0, l = plugins.length; i < l; i++) {\n                                // Not every plugin in the ordering may be loaded at runtime.\n                                var possiblePlugin = plugins[i]\n                                if (possiblePlugin) {\n                                    var extractedEvents = possiblePlugin.extractEvents(\n                                        topLevelType,\n                                        topLevelTarget,\n                                        topLevelTargetID,\n                                        nativeEvent\n                                    )\n                                    if (extractedEvents) {\n                                        events = accumulateInto(events, extractedEvents)\n                                    }\n                                }\n                            }\n                            return events\n                        },\n\n                        /**\n                         * Enqueues a synthetic event that should be dispatched when\n                         * `processEventQueue` is invoked.\n                         *\n                         * @param {*} events An accumulation of synthetic events.\n                         * @internal\n                         */\n                        enqueueEvents: function(events) {\n                            if (events) {\n                                eventQueue = accumulateInto(eventQueue, events)\n                            }\n                        },\n\n                        /**\n                         * Dispatches all synthetic events on the event queue.\n                         *\n                         * @internal\n                         */\n                        processEventQueue: function() {\n                            // Set `eventQueue` to null before processing it so that we can tell if more\n                            // events get enqueued while processing.\n                            var processingEventQueue = eventQueue\n                            eventQueue = null\n                            forEachAccumulated(processingEventQueue, executeDispatchesAndRelease)\n                            \"production\" !== \"development\"\n                                ? invariant(\n                                      !eventQueue,\n                                      \"processEventQueue(): Additional events were enqueued while processing \" +\n                                          \"an event queue. Support for this has not yet been implemented.\"\n                                  )\n                                : invariant(!eventQueue)\n                        },\n\n                        /**\n                         * These are needed for tests only. Do not use!\n                         */\n                        __purge: function() {\n                            listenerBank = {}\n                        },\n\n                        __getListenerBank: function() {\n                            return listenerBank\n                        }\n                    }\n\n                    module.exports = EventPluginHub\n                },\n                { \"118\": 118, \"135\": 135, \"150\": 150, \"19\": 19, \"20\": 20 }\n            ],\n            19: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule EventPluginRegistry\n                     * @typechecks static-only\n                     */\n\n                    \"use strict\"\n\n                    var invariant = _dereq_(150)\n\n                    /**\n                     * Injectable ordering of event plugins.\n                     */\n                    var EventPluginOrder = null\n\n                    /**\n                     * Injectable mapping from names to event plugin modules.\n                     */\n                    var namesToPlugins = {}\n\n                    /**\n                     * Recomputes the plugin list using the injected plugins and plugin ordering.\n                     *\n                     * @private\n                     */\n                    function recomputePluginOrdering() {\n                        if (!EventPluginOrder) {\n                            // Wait until an `EventPluginOrder` is injected.\n                            return\n                        }\n                        for (var pluginName in namesToPlugins) {\n                            var PluginModule = namesToPlugins[pluginName]\n                            var pluginIndex = EventPluginOrder.indexOf(pluginName)\n                            \"production\" !== \"development\"\n                                ? invariant(\n                                      pluginIndex > -1,\n                                      \"EventPluginRegistry: Cannot inject event plugins that do not exist in \" +\n                                          \"the plugin ordering, `%s`.\",\n                                      pluginName\n                                  )\n                                : invariant(pluginIndex > -1)\n                            if (EventPluginRegistry.plugins[pluginIndex]) {\n                                continue\n                            }\n                            \"production\" !== \"development\"\n                                ? invariant(\n                                      PluginModule.extractEvents,\n                                      \"EventPluginRegistry: Event plugins must implement an `extractEvents` \" +\n                                          \"method, but `%s` does not.\",\n                                      pluginName\n                                  )\n                                : invariant(PluginModule.extractEvents)\n                            EventPluginRegistry.plugins[pluginIndex] = PluginModule\n                            var publishedEvents = PluginModule.eventTypes\n                            for (var eventName in publishedEvents) {\n                                \"production\" !== \"development\"\n                                    ? invariant(\n                                          publishEventForPlugin(\n                                              publishedEvents[eventName],\n                                              PluginModule,\n                                              eventName\n                                          ),\n                                          \"EventPluginRegistry: Failed to publish event `%s` for plugin `%s`.\",\n                                          eventName,\n                                          pluginName\n                                      )\n                                    : invariant(\n                                          publishEventForPlugin(\n                                              publishedEvents[eventName],\n                                              PluginModule,\n                                              eventName\n                                          )\n                                      )\n                            }\n                        }\n                    }\n\n                    /**\n                     * Publishes an event so that it can be dispatched by the supplied plugin.\n                     *\n                     * @param {object} dispatchConfig Dispatch configuration for the event.\n                     * @param {object} PluginModule Plugin publishing the event.\n                     * @return {boolean} True if the event was successfully published.\n                     * @private\n                     */\n                    function publishEventForPlugin(dispatchConfig, PluginModule, eventName) {\n                        \"production\" !== \"development\"\n                            ? invariant(\n                                  !EventPluginRegistry.eventNameDispatchConfigs.hasOwnProperty(\n                                      eventName\n                                  ),\n                                  \"EventPluginHub: More than one plugin attempted to publish the same \" +\n                                      \"event name, `%s`.\",\n                                  eventName\n                              )\n                            : invariant(\n                                  !EventPluginRegistry.eventNameDispatchConfigs.hasOwnProperty(\n                                      eventName\n                                  )\n                              )\n                        EventPluginRegistry.eventNameDispatchConfigs[eventName] = dispatchConfig\n\n                        var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames\n                        if (phasedRegistrationNames) {\n                            for (var phaseName in phasedRegistrationNames) {\n                                if (phasedRegistrationNames.hasOwnProperty(phaseName)) {\n                                    var phasedRegistrationName = phasedRegistrationNames[phaseName]\n                                    publishRegistrationName(\n                                        phasedRegistrationName,\n                                        PluginModule,\n                                        eventName\n                                    )\n                                }\n                            }\n                            return true\n                        } else if (dispatchConfig.registrationName) {\n                            publishRegistrationName(\n                                dispatchConfig.registrationName,\n                                PluginModule,\n                                eventName\n                            )\n                            return true\n                        }\n                        return false\n                    }\n\n                    /**\n                     * Publishes a registration name that is used to identify dispatched events and\n                     * can be used with `EventPluginHub.putListener` to register listeners.\n                     *\n                     * @param {string} registrationName Registration name to add.\n                     * @param {object} PluginModule Plugin publishing the event.\n                     * @private\n                     */\n                    function publishRegistrationName(registrationName, PluginModule, eventName) {\n                        \"production\" !== \"development\"\n                            ? invariant(\n                                  !EventPluginRegistry.registrationNameModules[registrationName],\n                                  \"EventPluginHub: More than one plugin attempted to publish the same \" +\n                                      \"registration name, `%s`.\",\n                                  registrationName\n                              )\n                            : invariant(\n                                  !EventPluginRegistry.registrationNameModules[registrationName]\n                              )\n                        EventPluginRegistry.registrationNameModules[registrationName] = PluginModule\n                        EventPluginRegistry.registrationNameDependencies[registrationName] =\n                            PluginModule.eventTypes[eventName].dependencies\n                    }\n\n                    /**\n                     * Registers plugins so that they can extract and dispatch events.\n                     *\n                     * @see {EventPluginHub}\n                     */\n                    var EventPluginRegistry = {\n                        /**\n                         * Ordered list of injected plugins.\n                         */\n                        plugins: [],\n\n                        /**\n                         * Mapping from event name to dispatch config\n                         */\n                        eventNameDispatchConfigs: {},\n\n                        /**\n                         * Mapping from registration name to plugin module\n                         */\n                        registrationNameModules: {},\n\n                        /**\n                         * Mapping from registration name to event name\n                         */\n                        registrationNameDependencies: {},\n\n                        /**\n                         * Injects an ordering of plugins (by plugin name). This allows the ordering\n                         * to be decoupled from injection of the actual plugins so that ordering is\n                         * always deterministic regardless of packaging, on-the-fly injection, etc.\n                         *\n                         * @param {array} InjectedEventPluginOrder\n                         * @internal\n                         * @see {EventPluginHub.injection.injectEventPluginOrder}\n                         */\n                        injectEventPluginOrder: function(InjectedEventPluginOrder) {\n                            \"production\" !== \"development\"\n                                ? invariant(\n                                      !EventPluginOrder,\n                                      \"EventPluginRegistry: Cannot inject event plugin ordering more than \" +\n                                          \"once. You are likely trying to load more than one copy of React.\"\n                                  )\n                                : invariant(!EventPluginOrder)\n                            // Clone the ordering so it cannot be dynamically mutated.\n                            EventPluginOrder = Array.prototype.slice.call(InjectedEventPluginOrder)\n                            recomputePluginOrdering()\n                        },\n\n                        /**\n                         * Injects plugins to be used by `EventPluginHub`. The plugin names must be\n                         * in the ordering injected by `injectEventPluginOrder`.\n                         *\n                         * Plugins can be injected as part of page initialization or on-the-fly.\n                         *\n                         * @param {object} injectedNamesToPlugins Map from names to plugin modules.\n                         * @internal\n                         * @see {EventPluginHub.injection.injectEventPluginsByName}\n                         */\n                        injectEventPluginsByName: function(injectedNamesToPlugins) {\n                            var isOrderingDirty = false\n                            for (var pluginName in injectedNamesToPlugins) {\n                                if (!injectedNamesToPlugins.hasOwnProperty(pluginName)) {\n                                    continue\n                                }\n                                var PluginModule = injectedNamesToPlugins[pluginName]\n                                if (\n                                    !namesToPlugins.hasOwnProperty(pluginName) ||\n                                    namesToPlugins[pluginName] !== PluginModule\n                                ) {\n                                    \"production\" !== \"development\"\n                                        ? invariant(\n                                              !namesToPlugins[pluginName],\n                                              \"EventPluginRegistry: Cannot inject two different event plugins \" +\n                                                  \"using the same name, `%s`.\",\n                                              pluginName\n                                          )\n                                        : invariant(!namesToPlugins[pluginName])\n                                    namesToPlugins[pluginName] = PluginModule\n                                    isOrderingDirty = true\n                                }\n                            }\n                            if (isOrderingDirty) {\n                                recomputePluginOrdering()\n                            }\n                        },\n\n                        /**\n                         * Looks up the plugin for the supplied event.\n                         *\n                         * @param {object} event A synthetic event.\n                         * @return {?object} The plugin that created the supplied event.\n                         * @internal\n                         */\n                        getPluginModuleForEvent: function(event) {\n                            var dispatchConfig = event.dispatchConfig\n                            if (dispatchConfig.registrationName) {\n                                return (\n                                    EventPluginRegistry.registrationNameModules[\n                                        dispatchConfig.registrationName\n                                    ] || null\n                                )\n                            }\n                            for (var phase in dispatchConfig.phasedRegistrationNames) {\n                                if (!dispatchConfig.phasedRegistrationNames.hasOwnProperty(phase)) {\n                                    continue\n                                }\n                                var PluginModule =\n                                    EventPluginRegistry.registrationNameModules[\n                                        dispatchConfig.phasedRegistrationNames[phase]\n                                    ]\n                                if (PluginModule) {\n                                    return PluginModule\n                                }\n                            }\n                            return null\n                        },\n\n                        /**\n                         * Exposed for unit testing.\n                         * @private\n                         */\n                        _resetEventPlugins: function() {\n                            EventPluginOrder = null\n                            for (var pluginName in namesToPlugins) {\n                                if (namesToPlugins.hasOwnProperty(pluginName)) {\n                                    delete namesToPlugins[pluginName]\n                                }\n                            }\n                            EventPluginRegistry.plugins.length = 0\n\n                            var eventNameDispatchConfigs =\n                                EventPluginRegistry.eventNameDispatchConfigs\n                            for (var eventName in eventNameDispatchConfigs) {\n                                if (eventNameDispatchConfigs.hasOwnProperty(eventName)) {\n                                    delete eventNameDispatchConfigs[eventName]\n                                }\n                            }\n\n                            var registrationNameModules =\n                                EventPluginRegistry.registrationNameModules\n                            for (var registrationName in registrationNameModules) {\n                                if (registrationNameModules.hasOwnProperty(registrationName)) {\n                                    delete registrationNameModules[registrationName]\n                                }\n                            }\n                        }\n                    }\n\n                    module.exports = EventPluginRegistry\n                },\n                { \"150\": 150 }\n            ],\n            20: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule EventPluginUtils\n                     */\n\n                    \"use strict\"\n\n                    var EventConstants = _dereq_(16)\n\n                    var invariant = _dereq_(150)\n\n                    /**\n                     * Injected dependencies:\n                     */\n\n                    /**\n                     * - `Mount`: [required] Module that can convert between React dom IDs and\n                     *   actual node references.\n                     */\n                    var injection = {\n                        Mount: null,\n                        injectMount: function(InjectedMount) {\n                            injection.Mount = InjectedMount\n                            if (\"production\" !== \"development\") {\n                                \"production\" !== \"development\"\n                                    ? invariant(\n                                          InjectedMount && InjectedMount.getNode,\n                                          \"EventPluginUtils.injection.injectMount(...): Injected Mount module \" +\n                                              \"is missing getNode.\"\n                                      )\n                                    : invariant(InjectedMount && InjectedMount.getNode)\n                            }\n                        }\n                    }\n\n                    var topLevelTypes = EventConstants.topLevelTypes\n\n                    function isEndish(topLevelType) {\n                        return (\n                            topLevelType === topLevelTypes.topMouseUp ||\n                            topLevelType === topLevelTypes.topTouchEnd ||\n                            topLevelType === topLevelTypes.topTouchCancel\n                        )\n                    }\n\n                    function isMoveish(topLevelType) {\n                        return (\n                            topLevelType === topLevelTypes.topMouseMove ||\n                            topLevelType === topLevelTypes.topTouchMove\n                        )\n                    }\n                    function isStartish(topLevelType) {\n                        return (\n                            topLevelType === topLevelTypes.topMouseDown ||\n                            topLevelType === topLevelTypes.topTouchStart\n                        )\n                    }\n\n                    var validateEventDispatches\n                    if (\"production\" !== \"development\") {\n                        validateEventDispatches = function(event) {\n                            var dispatchListeners = event._dispatchListeners\n                            var dispatchIDs = event._dispatchIDs\n\n                            var listenersIsArr = Array.isArray(dispatchListeners)\n                            var idsIsArr = Array.isArray(dispatchIDs)\n                            var IDsLen = idsIsArr ? dispatchIDs.length : dispatchIDs ? 1 : 0\n                            var listenersLen = listenersIsArr\n                                ? dispatchListeners.length\n                                : dispatchListeners\n                                ? 1\n                                : 0\n\n                            \"production\" !== \"development\"\n                                ? invariant(\n                                      idsIsArr === listenersIsArr && IDsLen === listenersLen,\n                                      \"EventPluginUtils: Invalid `event`.\"\n                                  )\n                                : invariant(idsIsArr === listenersIsArr && IDsLen === listenersLen)\n                        }\n                    }\n\n                    /**\n                     * Invokes `cb(event, listener, id)`. Avoids using call if no scope is\n                     * provided. The `(listener,id)` pair effectively forms the \"dispatch\" but are\n                     * kept separate to conserve memory.\n                     */\n                    function forEachEventDispatch(event, cb) {\n                        var dispatchListeners = event._dispatchListeners\n                        var dispatchIDs = event._dispatchIDs\n                        if (\"production\" !== \"development\") {\n                            validateEventDispatches(event)\n                        }\n                        if (Array.isArray(dispatchListeners)) {\n                            for (var i = 0; i < dispatchListeners.length; i++) {\n                                if (event.isPropagationStopped()) {\n                                    break\n                                }\n                                // Listeners and IDs are two parallel arrays that are always in sync.\n                                cb(event, dispatchListeners[i], dispatchIDs[i])\n                            }\n                        } else if (dispatchListeners) {\n                            cb(event, dispatchListeners, dispatchIDs)\n                        }\n                    }\n\n                    /**\n                     * Default implementation of PluginModule.executeDispatch().\n                     * @param {SyntheticEvent} SyntheticEvent to handle\n                     * @param {function} Application-level callback\n                     * @param {string} domID DOM id to pass to the callback.\n                     */\n                    function executeDispatch(event, listener, domID) {\n                        event.currentTarget = injection.Mount.getNode(domID)\n                        var returnValue = listener(event, domID)\n                        event.currentTarget = null\n                        return returnValue\n                    }\n\n                    /**\n                     * Standard/simple iteration through an event's collected dispatches.\n                     */\n                    function executeDispatchesInOrder(event, cb) {\n                        forEachEventDispatch(event, cb)\n                        event._dispatchListeners = null\n                        event._dispatchIDs = null\n                    }\n\n                    /**\n                     * Standard/simple iteration through an event's collected dispatches, but stops\n                     * at the first dispatch execution returning true, and returns that id.\n                     *\n                     * @return id of the first dispatch execution who's listener returns true, or\n                     * null if no listener returned true.\n                     */\n                    function executeDispatchesInOrderStopAtTrueImpl(event) {\n                        var dispatchListeners = event._dispatchListeners\n                        var dispatchIDs = event._dispatchIDs\n                        if (\"production\" !== \"development\") {\n                            validateEventDispatches(event)\n                        }\n                        if (Array.isArray(dispatchListeners)) {\n                            for (var i = 0; i < dispatchListeners.length; i++) {\n                                if (event.isPropagationStopped()) {\n                                    break\n                                }\n                                // Listeners and IDs are two parallel arrays that are always in sync.\n                                if (dispatchListeners[i](event, dispatchIDs[i])) {\n                                    return dispatchIDs[i]\n                                }\n                            }\n                        } else if (dispatchListeners) {\n                            if (dispatchListeners(event, dispatchIDs)) {\n                                return dispatchIDs\n                            }\n                        }\n                        return null\n                    }\n\n                    /**\n                     * @see executeDispatchesInOrderStopAtTrueImpl\n                     */\n                    function executeDispatchesInOrderStopAtTrue(event) {\n                        var ret = executeDispatchesInOrderStopAtTrueImpl(event)\n                        event._dispatchIDs = null\n                        event._dispatchListeners = null\n                        return ret\n                    }\n\n                    /**\n                     * Execution of a \"direct\" dispatch - there must be at most one dispatch\n                     * accumulated on the event or it is considered an error. It doesn't really make\n                     * sense for an event with multiple dispatches (bubbled) to keep track of the\n                     * return values at each dispatch execution, but it does tend to make sense when\n                     * dealing with \"direct\" dispatches.\n                     *\n                     * @return The return value of executing the single dispatch.\n                     */\n                    function executeDirectDispatch(event) {\n                        if (\"production\" !== \"development\") {\n                            validateEventDispatches(event)\n                        }\n                        var dispatchListener = event._dispatchListeners\n                        var dispatchID = event._dispatchIDs\n                        \"production\" !== \"development\"\n                            ? invariant(\n                                  !Array.isArray(dispatchListener),\n                                  \"executeDirectDispatch(...): Invalid `event`.\"\n                              )\n                            : invariant(!Array.isArray(dispatchListener))\n                        var res = dispatchListener ? dispatchListener(event, dispatchID) : null\n                        event._dispatchListeners = null\n                        event._dispatchIDs = null\n                        return res\n                    }\n\n                    /**\n                     * @param {SyntheticEvent} event\n                     * @return {bool} True iff number of dispatches accumulated is greater than 0.\n                     */\n                    function hasDispatches(event) {\n                        return !!event._dispatchListeners\n                    }\n\n                    /**\n                     * General utilities that are useful in creating custom Event Plugins.\n                     */\n                    var EventPluginUtils = {\n                        isEndish: isEndish,\n                        isMoveish: isMoveish,\n                        isStartish: isStartish,\n\n                        executeDirectDispatch: executeDirectDispatch,\n                        executeDispatch: executeDispatch,\n                        executeDispatchesInOrder: executeDispatchesInOrder,\n                        executeDispatchesInOrderStopAtTrue: executeDispatchesInOrderStopAtTrue,\n                        hasDispatches: hasDispatches,\n                        injection: injection,\n                        useTouchEvents: false\n                    }\n\n                    module.exports = EventPluginUtils\n                },\n                { \"150\": 150, \"16\": 16 }\n            ],\n            21: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule EventPropagators\n                     */\n\n                    \"use strict\"\n\n                    var EventConstants = _dereq_(16)\n                    var EventPluginHub = _dereq_(18)\n\n                    var accumulateInto = _dereq_(118)\n                    var forEachAccumulated = _dereq_(135)\n\n                    var PropagationPhases = EventConstants.PropagationPhases\n                    var getListener = EventPluginHub.getListener\n\n                    /**\n                     * Some event types have a notion of different registration names for different\n                     * \"phases\" of propagation. This finds listeners by a given phase.\n                     */\n                    function listenerAtPhase(id, event, propagationPhase) {\n                        var registrationName =\n                            event.dispatchConfig.phasedRegistrationNames[propagationPhase]\n                        return getListener(id, registrationName)\n                    }\n\n                    /**\n                     * Tags a `SyntheticEvent` with dispatched listeners. Creating this function\n                     * here, allows us to not have to bind or create functions for each event.\n                     * Mutating the event's members allows us to not have to create a wrapping\n                     * \"dispatch\" object that pairs the event with the listener.\n                     */\n                    function accumulateDirectionalDispatches(domID, upwards, event) {\n                        if (\"production\" !== \"development\") {\n                            if (!domID) {\n                                throw new Error(\"Dispatching id must not be null\")\n                            }\n                        }\n                        var phase = upwards ? PropagationPhases.bubbled : PropagationPhases.captured\n                        var listener = listenerAtPhase(domID, event, phase)\n                        if (listener) {\n                            event._dispatchListeners = accumulateInto(\n                                event._dispatchListeners,\n                                listener\n                            )\n                            event._dispatchIDs = accumulateInto(event._dispatchIDs, domID)\n                        }\n                    }\n\n                    /**\n                     * Collect dispatches (must be entirely collected before dispatching - see unit\n                     * tests). Lazily allocate the array to conserve memory.  We must loop through\n                     * each event and perform the traversal for each one. We can not perform a\n                     * single traversal for the entire collection of events because each event may\n                     * have a different target.\n                     */\n                    function accumulateTwoPhaseDispatchesSingle(event) {\n                        if (event && event.dispatchConfig.phasedRegistrationNames) {\n                            EventPluginHub.injection\n                                .getInstanceHandle()\n                                .traverseTwoPhase(\n                                    event.dispatchMarker,\n                                    accumulateDirectionalDispatches,\n                                    event\n                                )\n                        }\n                    }\n\n                    /**\n                     * Accumulates without regard to direction, does not look for phased\n                     * registration names. Same as `accumulateDirectDispatchesSingle` but without\n                     * requiring that the `dispatchMarker` be the same as the dispatched ID.\n                     */\n                    function accumulateDispatches(id, ignoredDirection, event) {\n                        if (event && event.dispatchConfig.registrationName) {\n                            var registrationName = event.dispatchConfig.registrationName\n                            var listener = getListener(id, registrationName)\n                            if (listener) {\n                                event._dispatchListeners = accumulateInto(\n                                    event._dispatchListeners,\n                                    listener\n                                )\n                                event._dispatchIDs = accumulateInto(event._dispatchIDs, id)\n                            }\n                        }\n                    }\n\n                    /**\n                     * Accumulates dispatches on an `SyntheticEvent`, but only for the\n                     * `dispatchMarker`.\n                     * @param {SyntheticEvent} event\n                     */\n                    function accumulateDirectDispatchesSingle(event) {\n                        if (event && event.dispatchConfig.registrationName) {\n                            accumulateDispatches(event.dispatchMarker, null, event)\n                        }\n                    }\n\n                    function accumulateTwoPhaseDispatches(events) {\n                        forEachAccumulated(events, accumulateTwoPhaseDispatchesSingle)\n                    }\n\n                    function accumulateEnterLeaveDispatches(leave, enter, fromID, toID) {\n                        EventPluginHub.injection\n                            .getInstanceHandle()\n                            .traverseEnterLeave(fromID, toID, accumulateDispatches, leave, enter)\n                    }\n\n                    function accumulateDirectDispatches(events) {\n                        forEachAccumulated(events, accumulateDirectDispatchesSingle)\n                    }\n\n                    /**\n                     * A small set of propagation patterns, each of which will accept a small amount\n                     * of information, and generate a set of \"dispatch ready event objects\" - which\n                     * are sets of events that have already been annotated with a set of dispatched\n                     * listener functions/ids. The API is designed this way to discourage these\n                     * propagation strategies from actually executing the dispatches, since we\n                     * always want to collect the entire set of dispatches before executing event a\n                     * single one.\n                     *\n                     * @constructor EventPropagators\n                     */\n                    var EventPropagators = {\n                        accumulateTwoPhaseDispatches: accumulateTwoPhaseDispatches,\n                        accumulateDirectDispatches: accumulateDirectDispatches,\n                        accumulateEnterLeaveDispatches: accumulateEnterLeaveDispatches\n                    }\n\n                    module.exports = EventPropagators\n                },\n                { \"118\": 118, \"135\": 135, \"16\": 16, \"18\": 18 }\n            ],\n            22: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule ExecutionEnvironment\n                     */\n\n                    /*jslint evil: true */\n\n                    \"use strict\"\n\n                    var canUseDOM = !!(\n                        typeof window !== \"undefined\" &&\n                        window.document &&\n                        window.document.createElement\n                    )\n\n                    /**\n                     * Simple, lightweight module assisting with the detection and context of\n                     * Worker. Helps avoid circular dependencies and allows code to reason about\n                     * whether or not they are in a Worker, even if they never include the main\n                     * `ReactWorker` dependency.\n                     */\n                    var ExecutionEnvironment = {\n                        canUseDOM: canUseDOM,\n\n                        canUseWorkers: typeof Worker !== \"undefined\",\n\n                        canUseEventListeners:\n                            canUseDOM && !!(window.addEventListener || window.attachEvent),\n\n                        canUseViewport: canUseDOM && !!window.screen,\n\n                        isInWorker: !canUseDOM // For now, this is true - might change in the future.\n                    }\n\n                    module.exports = ExecutionEnvironment\n                },\n                {}\n            ],\n            23: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule FallbackCompositionState\n                     * @typechecks static-only\n                     */\n\n                    \"use strict\"\n\n                    var PooledClass = _dereq_(30)\n\n                    var assign = _dereq_(29)\n                    var getTextContentAccessor = _dereq_(145)\n\n                    /**\n                     * This helper class stores information about text content of a target node,\n                     * allowing comparison of content before and after a given event.\n                     *\n                     * Identify the node where selection currently begins, then observe\n                     * both its text content and its current position in the DOM. Since the\n                     * browser may natively replace the target node during composition, we can\n                     * use its position to find its replacement.\n                     *\n                     * @param {DOMEventTarget} root\n                     */\n                    function FallbackCompositionState(root) {\n                        this._root = root\n                        this._startText = this.getText()\n                        this._fallbackText = null\n                    }\n\n                    assign(FallbackCompositionState.prototype, {\n                        /**\n                         * Get current text of input.\n                         *\n                         * @return {string}\n                         */\n                        getText: function() {\n                            if (\"value\" in this._root) {\n                                return this._root.value\n                            }\n                            return this._root[getTextContentAccessor()]\n                        },\n\n                        /**\n                         * Determine the differing substring between the initially stored\n                         * text content and the current content.\n                         *\n                         * @return {string}\n                         */\n                        getData: function() {\n                            if (this._fallbackText) {\n                                return this._fallbackText\n                            }\n\n                            var start\n                            var startValue = this._startText\n                            var startLength = startValue.length\n                            var end\n                            var endValue = this.getText()\n                            var endLength = endValue.length\n\n                            for (start = 0; start < startLength; start++) {\n                                if (startValue[start] !== endValue[start]) {\n                                    break\n                                }\n                            }\n\n                            var minEnd = startLength - start\n                            for (end = 1; end <= minEnd; end++) {\n                                if (startValue[startLength - end] !== endValue[endLength - end]) {\n                                    break\n                                }\n                            }\n\n                            var sliceTail = end > 1 ? 1 - end : undefined\n                            this._fallbackText = endValue.slice(start, sliceTail)\n                            return this._fallbackText\n                        }\n                    })\n\n                    PooledClass.addPoolingTo(FallbackCompositionState)\n\n                    module.exports = FallbackCompositionState\n                },\n                { \"145\": 145, \"29\": 29, \"30\": 30 }\n            ],\n            24: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule HTMLDOMPropertyConfig\n                     */\n\n                    /*jslint bitwise: true*/\n\n                    \"use strict\"\n\n                    var DOMProperty = _dereq_(11)\n                    var ExecutionEnvironment = _dereq_(22)\n\n                    var MUST_USE_ATTRIBUTE = DOMProperty.injection.MUST_USE_ATTRIBUTE\n                    var MUST_USE_PROPERTY = DOMProperty.injection.MUST_USE_PROPERTY\n                    var HAS_BOOLEAN_VALUE = DOMProperty.injection.HAS_BOOLEAN_VALUE\n                    var HAS_SIDE_EFFECTS = DOMProperty.injection.HAS_SIDE_EFFECTS\n                    var HAS_NUMERIC_VALUE = DOMProperty.injection.HAS_NUMERIC_VALUE\n                    var HAS_POSITIVE_NUMERIC_VALUE =\n                        DOMProperty.injection.HAS_POSITIVE_NUMERIC_VALUE\n                    var HAS_OVERLOADED_BOOLEAN_VALUE =\n                        DOMProperty.injection.HAS_OVERLOADED_BOOLEAN_VALUE\n\n                    var hasSVG\n                    if (ExecutionEnvironment.canUseDOM) {\n                        var implementation = document.implementation\n                        hasSVG =\n                            implementation &&\n                            implementation.hasFeature &&\n                            implementation.hasFeature(\n                                \"http://www.w3.org/TR/SVG11/feature#BasicStructure\",\n                                \"1.1\"\n                            )\n                    }\n\n                    var HTMLDOMPropertyConfig = {\n                        isCustomAttribute: RegExp.prototype.test.bind(\n                            /^(data|aria)-[a-z_][a-z\\d_.\\-]*$/\n                        ),\n                        Properties: {\n                            /**\n                             * Standard Properties\n                             */\n                            accept: null,\n                            acceptCharset: null,\n                            accessKey: null,\n                            action: null,\n                            allowFullScreen: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,\n                            allowTransparency: MUST_USE_ATTRIBUTE,\n                            alt: null,\n                            async: HAS_BOOLEAN_VALUE,\n                            autoComplete: null,\n                            // autoFocus is polyfilled/normalized by AutoFocusMixin\n                            // autoFocus: HAS_BOOLEAN_VALUE,\n                            autoPlay: HAS_BOOLEAN_VALUE,\n                            cellPadding: null,\n                            cellSpacing: null,\n                            charSet: MUST_USE_ATTRIBUTE,\n                            checked: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,\n                            classID: MUST_USE_ATTRIBUTE,\n                            // To set className on SVG elements, it's necessary to use .setAttribute;\n                            // this works on HTML elements too in all browsers except IE8. Conveniently,\n                            // IE8 doesn't support SVG and so we can simply use the attribute in\n                            // browsers that support SVG and the property in browsers that don't,\n                            // regardless of whether the element is HTML or SVG.\n                            className: hasSVG ? MUST_USE_ATTRIBUTE : MUST_USE_PROPERTY,\n                            cols: MUST_USE_ATTRIBUTE | HAS_POSITIVE_NUMERIC_VALUE,\n                            colSpan: null,\n                            content: null,\n                            contentEditable: null,\n                            contextMenu: MUST_USE_ATTRIBUTE,\n                            controls: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,\n                            coords: null,\n                            crossOrigin: null,\n                            data: null, // For `<object />` acts as `src`.\n                            dateTime: MUST_USE_ATTRIBUTE,\n                            defer: HAS_BOOLEAN_VALUE,\n                            dir: null,\n                            disabled: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,\n                            download: HAS_OVERLOADED_BOOLEAN_VALUE,\n                            draggable: null,\n                            encType: null,\n                            form: MUST_USE_ATTRIBUTE,\n                            formAction: MUST_USE_ATTRIBUTE,\n                            formEncType: MUST_USE_ATTRIBUTE,\n                            formMethod: MUST_USE_ATTRIBUTE,\n                            formNoValidate: HAS_BOOLEAN_VALUE,\n                            formTarget: MUST_USE_ATTRIBUTE,\n                            frameBorder: MUST_USE_ATTRIBUTE,\n                            headers: null,\n                            height: MUST_USE_ATTRIBUTE,\n                            hidden: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,\n                            high: null,\n                            href: null,\n                            hrefLang: null,\n                            htmlFor: null,\n                            httpEquiv: null,\n                            icon: null,\n                            id: MUST_USE_PROPERTY,\n                            label: null,\n                            lang: null,\n                            list: MUST_USE_ATTRIBUTE,\n                            loop: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,\n                            low: null,\n                            manifest: MUST_USE_ATTRIBUTE,\n                            marginHeight: null,\n                            marginWidth: null,\n                            max: null,\n                            maxLength: MUST_USE_ATTRIBUTE,\n                            media: MUST_USE_ATTRIBUTE,\n                            mediaGroup: null,\n                            method: null,\n                            min: null,\n                            multiple: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,\n                            muted: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,\n                            name: null,\n                            noValidate: HAS_BOOLEAN_VALUE,\n                            open: HAS_BOOLEAN_VALUE,\n                            optimum: null,\n                            pattern: null,\n                            placeholder: null,\n                            poster: null,\n                            preload: null,\n                            radioGroup: null,\n                            readOnly: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,\n                            rel: null,\n                            required: HAS_BOOLEAN_VALUE,\n                            role: MUST_USE_ATTRIBUTE,\n                            rows: MUST_USE_ATTRIBUTE | HAS_POSITIVE_NUMERIC_VALUE,\n                            rowSpan: null,\n                            sandbox: null,\n                            scope: null,\n                            scoped: HAS_BOOLEAN_VALUE,\n                            scrolling: null,\n                            seamless: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,\n                            selected: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,\n                            shape: null,\n                            size: MUST_USE_ATTRIBUTE | HAS_POSITIVE_NUMERIC_VALUE,\n                            sizes: MUST_USE_ATTRIBUTE,\n                            span: HAS_POSITIVE_NUMERIC_VALUE,\n                            spellCheck: null,\n                            src: null,\n                            srcDoc: MUST_USE_PROPERTY,\n                            srcSet: MUST_USE_ATTRIBUTE,\n                            start: HAS_NUMERIC_VALUE,\n                            step: null,\n                            style: null,\n                            tabIndex: null,\n                            target: null,\n                            title: null,\n                            type: null,\n                            useMap: null,\n                            value: MUST_USE_PROPERTY | HAS_SIDE_EFFECTS,\n                            width: MUST_USE_ATTRIBUTE,\n                            wmode: MUST_USE_ATTRIBUTE,\n\n                            /**\n                             * Non-standard Properties\n                             */\n                            // autoCapitalize and autoCorrect are supported in Mobile Safari for\n                            // keyboard hints.\n                            autoCapitalize: null,\n                            autoCorrect: null,\n                            // itemProp, itemScope, itemType are for\n                            // Microdata support. See http://schema.org/docs/gs.html\n                            itemProp: MUST_USE_ATTRIBUTE,\n                            itemScope: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,\n                            itemType: MUST_USE_ATTRIBUTE,\n                            // itemID and itemRef are for Microdata support as well but\n                            // only specified in the the WHATWG spec document. See\n                            // https://html.spec.whatwg.org/multipage/microdata.html#microdata-dom-api\n                            itemID: MUST_USE_ATTRIBUTE,\n                            itemRef: MUST_USE_ATTRIBUTE,\n                            // property is supported for OpenGraph in meta tags.\n                            property: null,\n                            // IE-only attribute that controls focus behavior\n                            unselectable: MUST_USE_ATTRIBUTE\n                        },\n                        DOMAttributeNames: {\n                            acceptCharset: \"accept-charset\",\n                            className: \"class\",\n                            htmlFor: \"for\",\n                            httpEquiv: \"http-equiv\"\n                        },\n                        DOMPropertyNames: {\n                            autoCapitalize: \"autocapitalize\",\n                            autoComplete: \"autocomplete\",\n                            autoCorrect: \"autocorrect\",\n                            autoFocus: \"autofocus\",\n                            autoPlay: \"autoplay\",\n                            // `encoding` is equivalent to `enctype`, IE8 lacks an `enctype` setter.\n                            // http://www.w3.org/TR/html5/forms.html#dom-fs-encoding\n                            encType: \"encoding\",\n                            hrefLang: \"hreflang\",\n                            radioGroup: \"radiogroup\",\n                            spellCheck: \"spellcheck\",\n                            srcDoc: \"srcdoc\",\n                            srcSet: \"srcset\"\n                        }\n                    }\n\n                    module.exports = HTMLDOMPropertyConfig\n                },\n                { \"11\": 11, \"22\": 22 }\n            ],\n            25: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule LinkedStateMixin\n                     * @typechecks static-only\n                     */\n\n                    \"use strict\"\n\n                    var ReactLink = _dereq_(75)\n                    var ReactStateSetters = _dereq_(94)\n\n                    /**\n                     * A simple mixin around ReactLink.forState().\n                     */\n                    var LinkedStateMixin = {\n                        /**\n                         * Create a ReactLink that's linked to part of this component's state. The\n                         * ReactLink will have the current value of this.state[key] and will call\n                         * setState() when a change is requested.\n                         *\n                         * @param {string} key state key to update. Note: you may want to use keyOf()\n                         * if you're using Google Closure Compiler advanced mode.\n                         * @return {ReactLink} ReactLink instance linking to the state.\n                         */\n                        linkState: function(key) {\n                            return new ReactLink(\n                                this.state[key],\n                                ReactStateSetters.createStateKeySetter(this, key)\n                            )\n                        }\n                    }\n\n                    module.exports = LinkedStateMixin\n                },\n                { \"75\": 75, \"94\": 94 }\n            ],\n            26: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule LinkedValueUtils\n                     * @typechecks static-only\n                     */\n\n                    \"use strict\"\n\n                    var ReactPropTypes = _dereq_(86)\n\n                    var invariant = _dereq_(150)\n\n                    var hasReadOnlyValue = {\n                        button: true,\n                        checkbox: true,\n                        image: true,\n                        hidden: true,\n                        radio: true,\n                        reset: true,\n                        submit: true\n                    }\n\n                    function _assertSingleLink(input) {\n                        \"production\" !== \"development\"\n                            ? invariant(\n                                  input.props.checkedLink == null || input.props.valueLink == null,\n                                  \"Cannot provide a checkedLink and a valueLink. If you want to use \" +\n                                      \"checkedLink, you probably don't want to use valueLink and vice versa.\"\n                              )\n                            : invariant(\n                                  input.props.checkedLink == null || input.props.valueLink == null\n                              )\n                    }\n                    function _assertValueLink(input) {\n                        _assertSingleLink(input)\n                        \"production\" !== \"development\"\n                            ? invariant(\n                                  input.props.value == null && input.props.onChange == null,\n                                  \"Cannot provide a valueLink and a value or onChange event. If you want \" +\n                                      \"to use value or onChange, you probably don't want to use valueLink.\"\n                              )\n                            : invariant(input.props.value == null && input.props.onChange == null)\n                    }\n\n                    function _assertCheckedLink(input) {\n                        _assertSingleLink(input)\n                        \"production\" !== \"development\"\n                            ? invariant(\n                                  input.props.checked == null && input.props.onChange == null,\n                                  \"Cannot provide a checkedLink and a checked property or onChange event. \" +\n                                      \"If you want to use checked or onChange, you probably don't want to \" +\n                                      \"use checkedLink\"\n                              )\n                            : invariant(input.props.checked == null && input.props.onChange == null)\n                    }\n\n                    /**\n                     * @param {SyntheticEvent} e change event to handle\n                     */\n                    function _handleLinkedValueChange(e) {\n                        /*jshint validthis:true */\n                        this.props.valueLink.requestChange(e.target.value)\n                    }\n\n                    /**\n                     * @param {SyntheticEvent} e change event to handle\n                     */\n                    function _handleLinkedCheckChange(e) {\n                        /*jshint validthis:true */\n                        this.props.checkedLink.requestChange(e.target.checked)\n                    }\n\n                    /**\n                     * Provide a linked `value` attribute for controlled forms. You should not use\n                     * this outside of the ReactDOM controlled form components.\n                     */\n                    var LinkedValueUtils = {\n                        Mixin: {\n                            propTypes: {\n                                value: function(props, propName, componentName) {\n                                    if (\n                                        !props[propName] ||\n                                        hasReadOnlyValue[props.type] ||\n                                        props.onChange ||\n                                        props.readOnly ||\n                                        props.disabled\n                                    ) {\n                                        return null\n                                    }\n                                    return new Error(\n                                        \"You provided a `value` prop to a form field without an \" +\n                                            \"`onChange` handler. This will render a read-only field. If \" +\n                                            \"the field should be mutable use `defaultValue`. Otherwise, \" +\n                                            \"set either `onChange` or `readOnly`.\"\n                                    )\n                                },\n                                checked: function(props, propName, componentName) {\n                                    if (\n                                        !props[propName] ||\n                                        props.onChange ||\n                                        props.readOnly ||\n                                        props.disabled\n                                    ) {\n                                        return null\n                                    }\n                                    return new Error(\n                                        \"You provided a `checked` prop to a form field without an \" +\n                                            \"`onChange` handler. This will render a read-only field. If \" +\n                                            \"the field should be mutable use `defaultChecked`. Otherwise, \" +\n                                            \"set either `onChange` or `readOnly`.\"\n                                    )\n                                },\n                                onChange: ReactPropTypes.func\n                            }\n                        },\n\n                        /**\n                         * @param {ReactComponent} input Form component\n                         * @return {*} current value of the input either from value prop or link.\n                         */\n                        getValue: function(input) {\n                            if (input.props.valueLink) {\n                                _assertValueLink(input)\n                                return input.props.valueLink.value\n                            }\n                            return input.props.value\n                        },\n\n                        /**\n                         * @param {ReactComponent} input Form component\n                         * @return {*} current checked status of the input either from checked prop\n                         *             or link.\n                         */\n                        getChecked: function(input) {\n                            if (input.props.checkedLink) {\n                                _assertCheckedLink(input)\n                                return input.props.checkedLink.value\n                            }\n                            return input.props.checked\n                        },\n\n                        /**\n                         * @param {ReactComponent} input Form component\n                         * @return {function} change callback either from onChange prop or link.\n                         */\n                        getOnChange: function(input) {\n                            if (input.props.valueLink) {\n                                _assertValueLink(input)\n                                return _handleLinkedValueChange\n                            } else if (input.props.checkedLink) {\n                                _assertCheckedLink(input)\n                                return _handleLinkedCheckChange\n                            }\n                            return input.props.onChange\n                        }\n                    }\n\n                    module.exports = LinkedValueUtils\n                },\n                { \"150\": 150, \"86\": 86 }\n            ],\n            27: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2014-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule LocalEventTrapMixin\n                     */\n\n                    \"use strict\"\n\n                    var ReactBrowserEventEmitter = _dereq_(33)\n\n                    var accumulateInto = _dereq_(118)\n                    var forEachAccumulated = _dereq_(135)\n                    var invariant = _dereq_(150)\n\n                    function remove(event) {\n                        event.remove()\n                    }\n\n                    var LocalEventTrapMixin = {\n                        trapBubbledEvent: function(topLevelType, handlerBaseName) {\n                            \"production\" !== \"development\"\n                                ? invariant(this.isMounted(), \"Must be mounted to trap events\")\n                                : invariant(this.isMounted())\n                            // If a component renders to null or if another component fatals and causes\n                            // the state of the tree to be corrupted, `node` here can be null.\n                            var node = this.getDOMNode()\n                            \"production\" !== \"development\"\n                                ? invariant(\n                                      node,\n                                      \"LocalEventTrapMixin.trapBubbledEvent(...): Requires node to be rendered.\"\n                                  )\n                                : invariant(node)\n                            var listener = ReactBrowserEventEmitter.trapBubbledEvent(\n                                topLevelType,\n                                handlerBaseName,\n                                node\n                            )\n                            this._localEventListeners = accumulateInto(\n                                this._localEventListeners,\n                                listener\n                            )\n                        },\n\n                        // trapCapturedEvent would look nearly identical. We don't implement that\n                        // method because it isn't currently needed.\n\n                        componentWillUnmount: function() {\n                            if (this._localEventListeners) {\n                                forEachAccumulated(this._localEventListeners, remove)\n                            }\n                        }\n                    }\n\n                    module.exports = LocalEventTrapMixin\n                },\n                { \"118\": 118, \"135\": 135, \"150\": 150, \"33\": 33 }\n            ],\n            28: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule MobileSafariClickEventPlugin\n                     * @typechecks static-only\n                     */\n\n                    \"use strict\"\n\n                    var EventConstants = _dereq_(16)\n\n                    var emptyFunction = _dereq_(129)\n\n                    var topLevelTypes = EventConstants.topLevelTypes\n\n                    /**\n                     * Mobile Safari does not fire properly bubble click events on non-interactive\n                     * elements, which means delegated click listeners do not fire. The workaround\n                     * for this bug involves attaching an empty click listener on the target node.\n                     *\n                     * This particular plugin works around the bug by attaching an empty click\n                     * listener on `touchstart` (which does fire on every element).\n                     */\n                    var MobileSafariClickEventPlugin = {\n                        eventTypes: null,\n\n                        /**\n                         * @param {string} topLevelType Record from `EventConstants`.\n                         * @param {DOMEventTarget} topLevelTarget The listening component root node.\n                         * @param {string} topLevelTargetID ID of `topLevelTarget`.\n                         * @param {object} nativeEvent Native browser event.\n                         * @return {*} An accumulation of synthetic events.\n                         * @see {EventPluginHub.extractEvents}\n                         */\n                        extractEvents: function(\n                            topLevelType,\n                            topLevelTarget,\n                            topLevelTargetID,\n                            nativeEvent\n                        ) {\n                            if (topLevelType === topLevelTypes.topTouchStart) {\n                                var target = nativeEvent.target\n                                if (target && !target.onclick) {\n                                    target.onclick = emptyFunction\n                                }\n                            }\n                        }\n                    }\n\n                    module.exports = MobileSafariClickEventPlugin\n                },\n                { \"129\": 129, \"16\": 16 }\n            ],\n            29: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2014-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule Object.assign\n                     */\n\n                    // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.assign\n\n                    \"use strict\"\n\n                    function assign(target, sources) {\n                        if (target == null) {\n                            throw new TypeError(\"Object.assign target cannot be null or undefined\")\n                        }\n\n                        var to = Object(target)\n                        var hasOwnProperty = Object.prototype.hasOwnProperty\n\n                        for (var nextIndex = 1; nextIndex < arguments.length; nextIndex++) {\n                            var nextSource = arguments[nextIndex]\n                            if (nextSource == null) {\n                                continue\n                            }\n\n                            var from = Object(nextSource)\n\n                            // We don't currently support accessors nor proxies. Therefore this\n                            // copy cannot throw. If we ever supported this then we must handle\n                            // exceptions and side-effects. We don't support symbols so they won't\n                            // be transferred.\n\n                            for (var key in from) {\n                                if (hasOwnProperty.call(from, key)) {\n                                    to[key] = from[key]\n                                }\n                            }\n                        }\n\n                        return to\n                    }\n\n                    module.exports = assign\n                },\n                {}\n            ],\n            30: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule PooledClass\n                     */\n\n                    \"use strict\"\n\n                    var invariant = _dereq_(150)\n\n                    /**\n                     * Static poolers. Several custom versions for each potential number of\n                     * arguments. A completely generic pooler is easy to implement, but would\n                     * require accessing the `arguments` object. In each of these, `this` refers to\n                     * the Class itself, not an instance. If any others are needed, simply add them\n                     * here, or in their own files.\n                     */\n                    var oneArgumentPooler = function(copyFieldsFrom) {\n                        var Klass = this\n                        if (Klass.instancePool.length) {\n                            var instance = Klass.instancePool.pop()\n                            Klass.call(instance, copyFieldsFrom)\n                            return instance\n                        } else {\n                            return new Klass(copyFieldsFrom)\n                        }\n                    }\n\n                    var twoArgumentPooler = function(a1, a2) {\n                        var Klass = this\n                        if (Klass.instancePool.length) {\n                            var instance = Klass.instancePool.pop()\n                            Klass.call(instance, a1, a2)\n                            return instance\n                        } else {\n                            return new Klass(a1, a2)\n                        }\n                    }\n\n                    var threeArgumentPooler = function(a1, a2, a3) {\n                        var Klass = this\n                        if (Klass.instancePool.length) {\n                            var instance = Klass.instancePool.pop()\n                            Klass.call(instance, a1, a2, a3)\n                            return instance\n                        } else {\n                            return new Klass(a1, a2, a3)\n                        }\n                    }\n\n                    var fiveArgumentPooler = function(a1, a2, a3, a4, a5) {\n                        var Klass = this\n                        if (Klass.instancePool.length) {\n                            var instance = Klass.instancePool.pop()\n                            Klass.call(instance, a1, a2, a3, a4, a5)\n                            return instance\n                        } else {\n                            return new Klass(a1, a2, a3, a4, a5)\n                        }\n                    }\n\n                    var standardReleaser = function(instance) {\n                        var Klass = this\n                        \"production\" !== \"development\"\n                            ? invariant(\n                                  instance instanceof Klass,\n                                  \"Trying to release an instance into a pool of a different type.\"\n                              )\n                            : invariant(instance instanceof Klass)\n                        if (instance.destructor) {\n                            instance.destructor()\n                        }\n                        if (Klass.instancePool.length < Klass.poolSize) {\n                            Klass.instancePool.push(instance)\n                        }\n                    }\n\n                    var DEFAULT_POOL_SIZE = 10\n                    var DEFAULT_POOLER = oneArgumentPooler\n\n                    /**\n                     * Augments `CopyConstructor` to be a poolable class, augmenting only the class\n                     * itself (statically) not adding any prototypical fields. Any CopyConstructor\n                     * you give this may have a `poolSize` property, and will look for a\n                     * prototypical `destructor` on instances (optional).\n                     *\n                     * @param {Function} CopyConstructor Constructor that can be used to reset.\n                     * @param {Function} pooler Customizable pooler.\n                     */\n                    var addPoolingTo = function(CopyConstructor, pooler) {\n                        var NewKlass = CopyConstructor\n                        NewKlass.instancePool = []\n                        NewKlass.getPooled = pooler || DEFAULT_POOLER\n                        if (!NewKlass.poolSize) {\n                            NewKlass.poolSize = DEFAULT_POOL_SIZE\n                        }\n                        NewKlass.release = standardReleaser\n                        return NewKlass\n                    }\n\n                    var PooledClass = {\n                        addPoolingTo: addPoolingTo,\n                        oneArgumentPooler: oneArgumentPooler,\n                        twoArgumentPooler: twoArgumentPooler,\n                        threeArgumentPooler: threeArgumentPooler,\n                        fiveArgumentPooler: fiveArgumentPooler\n                    }\n\n                    module.exports = PooledClass\n                },\n                { \"150\": 150 }\n            ],\n            31: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule React\n                     */\n\n                    /* globals __REACT_DEVTOOLS_GLOBAL_HOOK__*/\n\n                    \"use strict\"\n\n                    var EventPluginUtils = _dereq_(20)\n                    var ReactChildren = _dereq_(37)\n                    var ReactComponent = _dereq_(39)\n                    var ReactClass = _dereq_(38)\n                    var ReactContext = _dereq_(44)\n                    var ReactCurrentOwner = _dereq_(45)\n                    var ReactElement = _dereq_(63)\n                    var ReactElementValidator = _dereq_(64)\n                    var ReactDOM = _dereq_(46)\n                    var ReactDOMTextComponent = _dereq_(57)\n                    var ReactDefaultInjection = _dereq_(60)\n                    var ReactInstanceHandles = _dereq_(72)\n                    var ReactMount = _dereq_(77)\n                    var ReactPerf = _dereq_(82)\n                    var ReactPropTypes = _dereq_(86)\n                    var ReactReconciler = _dereq_(89)\n                    var ReactServerRendering = _dereq_(92)\n\n                    var assign = _dereq_(29)\n                    var findDOMNode = _dereq_(132)\n                    var onlyChild = _dereq_(160)\n\n                    ReactDefaultInjection.inject()\n\n                    var createElement = ReactElement.createElement\n                    var createFactory = ReactElement.createFactory\n                    var cloneElement = ReactElement.cloneElement\n\n                    if (\"production\" !== \"development\") {\n                        createElement = ReactElementValidator.createElement\n                        createFactory = ReactElementValidator.createFactory\n                        cloneElement = ReactElementValidator.cloneElement\n                    }\n\n                    var render = ReactPerf.measure(\"React\", \"render\", ReactMount.render)\n\n                    var React = {\n                        Children: {\n                            map: ReactChildren.map,\n                            forEach: ReactChildren.forEach,\n                            count: ReactChildren.count,\n                            only: onlyChild\n                        },\n                        Component: ReactComponent,\n                        DOM: ReactDOM,\n                        PropTypes: ReactPropTypes,\n                        initializeTouchEvents: function(shouldUseTouch) {\n                            EventPluginUtils.useTouchEvents = shouldUseTouch\n                        },\n                        createClass: ReactClass.createClass,\n                        createElement: createElement,\n                        cloneElement: cloneElement,\n                        createFactory: createFactory,\n                        createMixin: function(mixin) {\n                            // Currently a noop. Will be used to validate and trace mixins.\n                            return mixin\n                        },\n                        constructAndRenderComponent: ReactMount.constructAndRenderComponent,\n                        constructAndRenderComponentByID: ReactMount.constructAndRenderComponentByID,\n                        findDOMNode: findDOMNode,\n                        render: render,\n                        renderToString: ReactServerRendering.renderToString,\n                        renderToStaticMarkup: ReactServerRendering.renderToStaticMarkup,\n                        unmountComponentAtNode: ReactMount.unmountComponentAtNode,\n                        isValidElement: ReactElement.isValidElement,\n                        withContext: ReactContext.withContext,\n\n                        // Hook for JSX spread, don't use this for anything else.\n                        __spread: assign\n                    }\n\n                    // Inject the runtime into a devtools global hook regardless of browser.\n                    // Allows for debugging when the hook is injected on the page.\n                    if (\n                        typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== \"undefined\" &&\n                        typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.inject === \"function\"\n                    ) {\n                        __REACT_DEVTOOLS_GLOBAL_HOOK__.inject({\n                            CurrentOwner: ReactCurrentOwner,\n                            InstanceHandles: ReactInstanceHandles,\n                            Mount: ReactMount,\n                            Reconciler: ReactReconciler,\n                            TextComponent: ReactDOMTextComponent\n                        })\n                    }\n\n                    if (\"production\" !== \"development\") {\n                        var ExecutionEnvironment = _dereq_(22)\n                        if (ExecutionEnvironment.canUseDOM && window.top === window.self) {\n                            // If we're in Chrome, look for the devtools marker and provide a download\n                            // link if not installed.\n                            if (navigator.userAgent.indexOf(\"Chrome\") > -1) {\n                                if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === \"undefined\") {\n                                    console.debug(\n                                        \"Download the React DevTools for a better development experience: \" +\n                                            \"https://fb.me/react-devtools\"\n                                    )\n                                }\n                            }\n\n                            var expectedFeatures = [\n                                // shims\n                                Array.isArray,\n                                Array.prototype.every,\n                                Array.prototype.forEach,\n                                Array.prototype.indexOf,\n                                Array.prototype.map,\n                                Date.now,\n                                Function.prototype.bind,\n                                Object.keys,\n                                String.prototype.split,\n                                String.prototype.trim,\n\n                                // shams\n                                Object.create,\n                                Object.freeze\n                            ]\n\n                            for (var i = 0; i < expectedFeatures.length; i++) {\n                                if (!expectedFeatures[i]) {\n                                    console.error(\n                                        \"One or more ES5 shim/shams expected by React are not available: \" +\n                                            \"https://fb.me/react-warning-polyfills\"\n                                    )\n                                    break\n                                }\n                            }\n                        }\n                    }\n\n                    React.version = \"0.13.3\"\n\n                    module.exports = React\n                },\n                {\n                    \"132\": 132,\n                    \"160\": 160,\n                    \"20\": 20,\n                    \"22\": 22,\n                    \"29\": 29,\n                    \"37\": 37,\n                    \"38\": 38,\n                    \"39\": 39,\n                    \"44\": 44,\n                    \"45\": 45,\n                    \"46\": 46,\n                    \"57\": 57,\n                    \"60\": 60,\n                    \"63\": 63,\n                    \"64\": 64,\n                    \"72\": 72,\n                    \"77\": 77,\n                    \"82\": 82,\n                    \"86\": 86,\n                    \"89\": 89,\n                    \"92\": 92\n                }\n            ],\n            32: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule ReactBrowserComponentMixin\n                     */\n\n                    \"use strict\"\n\n                    var findDOMNode = _dereq_(132)\n\n                    var ReactBrowserComponentMixin = {\n                        /**\n                         * Returns the DOM node rendered by this component.\n                         *\n                         * @return {DOMElement} The root node of this component.\n                         * @final\n                         * @protected\n                         */\n                        getDOMNode: function() {\n                            return findDOMNode(this)\n                        }\n                    }\n\n                    module.exports = ReactBrowserComponentMixin\n                },\n                { \"132\": 132 }\n            ],\n            33: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule ReactBrowserEventEmitter\n                     * @typechecks static-only\n                     */\n\n                    \"use strict\"\n\n                    var EventConstants = _dereq_(16)\n                    var EventPluginHub = _dereq_(18)\n                    var EventPluginRegistry = _dereq_(19)\n                    var ReactEventEmitterMixin = _dereq_(67)\n                    var ViewportMetrics = _dereq_(117)\n\n                    var assign = _dereq_(29)\n                    var isEventSupported = _dereq_(151)\n\n                    /**\n                     * Summary of `ReactBrowserEventEmitter` event handling:\n                     *\n                     *  - Top-level delegation is used to trap most native browser events. This\n                     *    may only occur in the main thread and is the responsibility of\n                     *    ReactEventListener, which is injected and can therefore support pluggable\n                     *    event sources. This is the only work that occurs in the main thread.\n                     *\n                     *  - We normalize and de-duplicate events to account for browser quirks. This\n                     *    may be done in the worker thread.\n                     *\n                     *  - Forward these native events (with the associated top-level type used to\n                     *    trap it) to `EventPluginHub`, which in turn will ask plugins if they want\n                     *    to extract any synthetic events.\n                     *\n                     *  - The `EventPluginHub` will then process each event by annotating them with\n                     *    \"dispatches\", a sequence of listeners and IDs that care about that event.\n                     *\n                     *  - The `EventPluginHub` then dispatches the events.\n                     *\n                     * Overview of React and the event system:\n                     *\n                     * +------------+    .\n                     * |    DOM     |    .\n                     * +------------+    .\n                     *       |           .\n                     *       v           .\n                     * +------------+    .\n                     * | ReactEvent |    .\n                     * |  Listener  |    .\n                     * +------------+    .                         +-----------+\n                     *       |           .               +--------+|SimpleEvent|\n                     *       |           .               |         |Plugin     |\n                     * +-----|------+    .               v         +-----------+\n                     * |     |      |    .    +--------------+                    +------------+\n                     * |     +-----------.--->|EventPluginHub|                    |    Event   |\n                     * |            |    .    |              |     +-----------+  | Propagators|\n                     * | ReactEvent |    .    |              |     |TapEvent   |  |------------|\n                     * |  Emitter   |    .    |              |<---+|Plugin     |  |other plugin|\n                     * |            |    .    |              |     +-----------+  |  utilities |\n                     * |     +-----------.--->|              |                    +------------+\n                     * |     |      |    .    +--------------+\n                     * +-----|------+    .                ^        +-----------+\n                     *       |           .                |        |Enter/Leave|\n                     *       +           .                +-------+|Plugin     |\n                     * +-------------+   .                         +-----------+\n                     * | application |   .\n                     * |-------------|   .\n                     * |             |   .\n                     * |             |   .\n                     * +-------------+   .\n                     *                   .\n                     *    React Core     .  General Purpose Event Plugin System\n                     */\n\n                    var alreadyListeningTo = {}\n                    var isMonitoringScrollValue = false\n                    var reactTopListenersCounter = 0\n\n                    // For events like 'submit' which don't consistently bubble (which we trap at a\n                    // lower node than `document`), binding at `document` would cause duplicate\n                    // events so we don't include them here\n                    var topEventMapping = {\n                        topBlur: \"blur\",\n                        topChange: \"change\",\n                        topClick: \"click\",\n                        topCompositionEnd: \"compositionend\",\n                        topCompositionStart: \"compositionstart\",\n                        topCompositionUpdate: \"compositionupdate\",\n                        topContextMenu: \"contextmenu\",\n                        topCopy: \"copy\",\n                        topCut: \"cut\",\n                        topDoubleClick: \"dblclick\",\n                        topDrag: \"drag\",\n                        topDragEnd: \"dragend\",\n                        topDragEnter: \"dragenter\",\n                        topDragExit: \"dragexit\",\n                        topDragLeave: \"dragleave\",\n                        topDragOver: \"dragover\",\n                        topDragStart: \"dragstart\",\n                        topDrop: \"drop\",\n                        topFocus: \"focus\",\n                        topInput: \"input\",\n                        topKeyDown: \"keydown\",\n                        topKeyPress: \"keypress\",\n                        topKeyUp: \"keyup\",\n                        topMouseDown: \"mousedown\",\n                        topMouseMove: \"mousemove\",\n                        topMouseOut: \"mouseout\",\n                        topMouseOver: \"mouseover\",\n                        topMouseUp: \"mouseup\",\n                        topPaste: \"paste\",\n                        topScroll: \"scroll\",\n                        topSelectionChange: \"selectionchange\",\n                        topTextInput: \"textInput\",\n                        topTouchCancel: \"touchcancel\",\n                        topTouchEnd: \"touchend\",\n                        topTouchMove: \"touchmove\",\n                        topTouchStart: \"touchstart\",\n                        topWheel: \"wheel\"\n                    }\n\n                    /**\n                     * To ensure no conflicts with other potential React instances on the page\n                     */\n                    var topListenersIDKey = \"_reactListenersID\" + String(Math.random()).slice(2)\n\n                    function getListeningForDocument(mountAt) {\n                        // In IE8, `mountAt` is a host object and doesn't have `hasOwnProperty`\n                        // directly.\n                        if (!Object.prototype.hasOwnProperty.call(mountAt, topListenersIDKey)) {\n                            mountAt[topListenersIDKey] = reactTopListenersCounter++\n                            alreadyListeningTo[mountAt[topListenersIDKey]] = {}\n                        }\n                        return alreadyListeningTo[mountAt[topListenersIDKey]]\n                    }\n\n                    /**\n                     * `ReactBrowserEventEmitter` is used to attach top-level event listeners. For\n                     * example:\n                     *\n                     *   ReactBrowserEventEmitter.putListener('myID', 'onClick', myFunction);\n                     *\n                     * This would allocate a \"registration\" of `('onClick', myFunction)` on 'myID'.\n                     *\n                     * @internal\n                     */\n                    var ReactBrowserEventEmitter = assign({}, ReactEventEmitterMixin, {\n                        /**\n                         * Injectable event backend\n                         */\n                        ReactEventListener: null,\n\n                        injection: {\n                            /**\n                             * @param {object} ReactEventListener\n                             */\n                            injectReactEventListener: function(ReactEventListener) {\n                                ReactEventListener.setHandleTopLevel(\n                                    ReactBrowserEventEmitter.handleTopLevel\n                                )\n                                ReactBrowserEventEmitter.ReactEventListener = ReactEventListener\n                            }\n                        },\n\n                        /**\n                         * Sets whether or not any created callbacks should be enabled.\n                         *\n                         * @param {boolean} enabled True if callbacks should be enabled.\n                         */\n                        setEnabled: function(enabled) {\n                            if (ReactBrowserEventEmitter.ReactEventListener) {\n                                ReactBrowserEventEmitter.ReactEventListener.setEnabled(enabled)\n                            }\n                        },\n\n                        /**\n                         * @return {boolean} True if callbacks are enabled.\n                         */\n                        isEnabled: function() {\n                            return !!(\n                                ReactBrowserEventEmitter.ReactEventListener &&\n                                ReactBrowserEventEmitter.ReactEventListener.isEnabled()\n                            )\n                        },\n\n                        /**\n                         * We listen for bubbled touch events on the document object.\n                         *\n                         * Firefox v8.01 (and possibly others) exhibited strange behavior when\n                         * mounting `onmousemove` events at some node that was not the document\n                         * element. The symptoms were that if your mouse is not moving over something\n                         * contained within that mount point (for example on the background) the\n                         * top-level listeners for `onmousemove` won't be called. However, if you\n                         * register the `mousemove` on the document object, then it will of course\n                         * catch all `mousemove`s. This along with iOS quirks, justifies restricting\n                         * top-level listeners to the document object only, at least for these\n                         * movement types of events and possibly all events.\n                         *\n                         * @see http://www.quirksmode.org/blog/archives/2010/09/click_event_del.html\n                         *\n                         * Also, `keyup`/`keypress`/`keydown` do not bubble to the window on IE, but\n                         * they bubble to document.\n                         *\n                         * @param {string} registrationName Name of listener (e.g. `onClick`).\n                         * @param {object} contentDocumentHandle Document which owns the container\n                         */\n                        listenTo: function(registrationName, contentDocumentHandle) {\n                            var mountAt = contentDocumentHandle\n                            var isListening = getListeningForDocument(mountAt)\n                            var dependencies =\n                                EventPluginRegistry.registrationNameDependencies[registrationName]\n\n                            var topLevelTypes = EventConstants.topLevelTypes\n                            for (var i = 0, l = dependencies.length; i < l; i++) {\n                                var dependency = dependencies[i]\n                                if (\n                                    !(\n                                        isListening.hasOwnProperty(dependency) &&\n                                        isListening[dependency]\n                                    )\n                                ) {\n                                    if (dependency === topLevelTypes.topWheel) {\n                                        if (isEventSupported(\"wheel\")) {\n                                            ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(\n                                                topLevelTypes.topWheel,\n                                                \"wheel\",\n                                                mountAt\n                                            )\n                                        } else if (isEventSupported(\"mousewheel\")) {\n                                            ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(\n                                                topLevelTypes.topWheel,\n                                                \"mousewheel\",\n                                                mountAt\n                                            )\n                                        } else {\n                                            // Firefox needs to capture a different mouse scroll event.\n                                            // @see http://www.quirksmode.org/dom/events/tests/scroll.html\n                                            ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(\n                                                topLevelTypes.topWheel,\n                                                \"DOMMouseScroll\",\n                                                mountAt\n                                            )\n                                        }\n                                    } else if (dependency === topLevelTypes.topScroll) {\n                                        if (isEventSupported(\"scroll\", true)) {\n                                            ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(\n                                                topLevelTypes.topScroll,\n                                                \"scroll\",\n                                                mountAt\n                                            )\n                                        } else {\n                                            ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(\n                                                topLevelTypes.topScroll,\n                                                \"scroll\",\n                                                ReactBrowserEventEmitter.ReactEventListener\n                                                    .WINDOW_HANDLE\n                                            )\n                                        }\n                                    } else if (\n                                        dependency === topLevelTypes.topFocus ||\n                                        dependency === topLevelTypes.topBlur\n                                    ) {\n                                        if (isEventSupported(\"focus\", true)) {\n                                            ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(\n                                                topLevelTypes.topFocus,\n                                                \"focus\",\n                                                mountAt\n                                            )\n                                            ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(\n                                                topLevelTypes.topBlur,\n                                                \"blur\",\n                                                mountAt\n                                            )\n                                        } else if (isEventSupported(\"focusin\")) {\n                                            // IE has `focusin` and `focusout` events which bubble.\n                                            // @see http://www.quirksmode.org/blog/archives/2008/04/delegating_the.html\n                                            ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(\n                                                topLevelTypes.topFocus,\n                                                \"focusin\",\n                                                mountAt\n                                            )\n                                            ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(\n                                                topLevelTypes.topBlur,\n                                                \"focusout\",\n                                                mountAt\n                                            )\n                                        }\n\n                                        // to make sure blur and focus event listeners are only attached once\n                                        isListening[topLevelTypes.topBlur] = true\n                                        isListening[topLevelTypes.topFocus] = true\n                                    } else if (topEventMapping.hasOwnProperty(dependency)) {\n                                        ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(\n                                            dependency,\n                                            topEventMapping[dependency],\n                                            mountAt\n                                        )\n                                    }\n\n                                    isListening[dependency] = true\n                                }\n                            }\n                        },\n\n                        trapBubbledEvent: function(topLevelType, handlerBaseName, handle) {\n                            return ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(\n                                topLevelType,\n                                handlerBaseName,\n                                handle\n                            )\n                        },\n\n                        trapCapturedEvent: function(topLevelType, handlerBaseName, handle) {\n                            return ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(\n                                topLevelType,\n                                handlerBaseName,\n                                handle\n                            )\n                        },\n\n                        /**\n                         * Listens to window scroll and resize events. We cache scroll values so that\n                         * application code can access them without triggering reflows.\n                         *\n                         * NOTE: Scroll events do not bubble.\n                         *\n                         * @see http://www.quirksmode.org/dom/events/scroll.html\n                         */\n                        ensureScrollValueMonitoring: function() {\n                            if (!isMonitoringScrollValue) {\n                                var refresh = ViewportMetrics.refreshScrollValues\n                                ReactBrowserEventEmitter.ReactEventListener.monitorScrollValue(\n                                    refresh\n                                )\n                                isMonitoringScrollValue = true\n                            }\n                        },\n\n                        eventNameDispatchConfigs: EventPluginHub.eventNameDispatchConfigs,\n\n                        registrationNameModules: EventPluginHub.registrationNameModules,\n\n                        putListener: EventPluginHub.putListener,\n\n                        getListener: EventPluginHub.getListener,\n\n                        deleteListener: EventPluginHub.deleteListener,\n\n                        deleteAllListeners: EventPluginHub.deleteAllListeners\n                    })\n\n                    module.exports = ReactBrowserEventEmitter\n                },\n                { \"117\": 117, \"151\": 151, \"16\": 16, \"18\": 18, \"19\": 19, \"29\": 29, \"67\": 67 }\n            ],\n            34: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @typechecks\n                     * @providesModule ReactCSSTransitionGroup\n                     */\n\n                    \"use strict\"\n\n                    var React = _dereq_(31)\n\n                    var assign = _dereq_(29)\n\n                    var ReactTransitionGroup = React.createFactory(_dereq_(98))\n                    var ReactCSSTransitionGroupChild = React.createFactory(_dereq_(35))\n\n                    var ReactCSSTransitionGroup = React.createClass({\n                        displayName: \"ReactCSSTransitionGroup\",\n\n                        propTypes: {\n                            transitionName: React.PropTypes.string.isRequired,\n                            transitionAppear: React.PropTypes.bool,\n                            transitionEnter: React.PropTypes.bool,\n                            transitionLeave: React.PropTypes.bool\n                        },\n\n                        getDefaultProps: function() {\n                            return {\n                                transitionAppear: false,\n                                transitionEnter: true,\n                                transitionLeave: true\n                            }\n                        },\n\n                        _wrapChild: function(child) {\n                            // We need to provide this childFactory so that\n                            // ReactCSSTransitionGroupChild can receive updates to name, enter, and\n                            // leave while it is leaving.\n                            return ReactCSSTransitionGroupChild(\n                                {\n                                    name: this.props.transitionName,\n                                    appear: this.props.transitionAppear,\n                                    enter: this.props.transitionEnter,\n                                    leave: this.props.transitionLeave\n                                },\n                                child\n                            )\n                        },\n\n                        render: function() {\n                            return ReactTransitionGroup(\n                                assign({}, this.props, { childFactory: this._wrapChild })\n                            )\n                        }\n                    })\n\n                    module.exports = ReactCSSTransitionGroup\n                },\n                { \"29\": 29, \"31\": 31, \"35\": 35, \"98\": 98 }\n            ],\n            35: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @typechecks\n                     * @providesModule ReactCSSTransitionGroupChild\n                     */\n\n                    \"use strict\"\n\n                    var React = _dereq_(31)\n\n                    var CSSCore = _dereq_(4)\n                    var ReactTransitionEvents = _dereq_(97)\n\n                    var onlyChild = _dereq_(160)\n                    var warning = _dereq_(171)\n\n                    // We don't remove the element from the DOM until we receive an animationend or\n                    // transitionend event. If the user screws up and forgets to add an animation\n                    // their node will be stuck in the DOM forever, so we detect if an animation\n                    // does not start and if it doesn't, we just call the end listener immediately.\n                    var TICK = 17\n                    var NO_EVENT_TIMEOUT = 5000\n\n                    var noEventListener = null\n\n                    if (\"production\" !== \"development\") {\n                        noEventListener = function() {\n                            \"production\" !== \"development\"\n                                ? warning(\n                                      false,\n                                      \"transition(): tried to perform an animation without \" +\n                                          \"an animationend or transitionend event after timeout (\" +\n                                          \"%sms). You should either disable this \" +\n                                          \"transition in JS or add a CSS animation/transition.\",\n                                      NO_EVENT_TIMEOUT\n                                  )\n                                : null\n                        }\n                    }\n\n                    var ReactCSSTransitionGroupChild = React.createClass({\n                        displayName: \"ReactCSSTransitionGroupChild\",\n\n                        transition: function(animationType, finishCallback) {\n                            var node = this.getDOMNode()\n                            var className = this.props.name + \"-\" + animationType\n                            var activeClassName = className + \"-active\"\n                            var noEventTimeout = null\n\n                            var endListener = function(e) {\n                                if (e && e.target !== node) {\n                                    return\n                                }\n                                if (\"production\" !== \"development\") {\n                                    clearTimeout(noEventTimeout)\n                                }\n\n                                CSSCore.removeClass(node, className)\n                                CSSCore.removeClass(node, activeClassName)\n\n                                ReactTransitionEvents.removeEndEventListener(node, endListener)\n\n                                // Usually this optional callback is used for informing an owner of\n                                // a leave animation and telling it to remove the child.\n                                if (finishCallback) {\n                                    finishCallback()\n                                }\n                            }\n\n                            ReactTransitionEvents.addEndEventListener(node, endListener)\n\n                            CSSCore.addClass(node, className)\n\n                            // Need to do this to actually trigger a transition.\n                            this.queueClass(activeClassName)\n\n                            if (\"production\" !== \"development\") {\n                                noEventTimeout = setTimeout(noEventListener, NO_EVENT_TIMEOUT)\n                            }\n                        },\n\n                        queueClass: function(className) {\n                            this.classNameQueue.push(className)\n\n                            if (!this.timeout) {\n                                this.timeout = setTimeout(this.flushClassNameQueue, TICK)\n                            }\n                        },\n\n                        flushClassNameQueue: function() {\n                            if (this.isMounted()) {\n                                this.classNameQueue.forEach(\n                                    CSSCore.addClass.bind(CSSCore, this.getDOMNode())\n                                )\n                            }\n                            this.classNameQueue.length = 0\n                            this.timeout = null\n                        },\n\n                        componentWillMount: function() {\n                            this.classNameQueue = []\n                        },\n\n                        componentWillUnmount: function() {\n                            if (this.timeout) {\n                                clearTimeout(this.timeout)\n                            }\n                        },\n\n                        componentWillAppear: function(done) {\n                            if (this.props.appear) {\n                                this.transition(\"appear\", done)\n                            } else {\n                                done()\n                            }\n                        },\n\n                        componentWillEnter: function(done) {\n                            if (this.props.enter) {\n                                this.transition(\"enter\", done)\n                            } else {\n                                done()\n                            }\n                        },\n\n                        componentWillLeave: function(done) {\n                            if (this.props.leave) {\n                                this.transition(\"leave\", done)\n                            } else {\n                                done()\n                            }\n                        },\n\n                        render: function() {\n                            return onlyChild(this.props.children)\n                        }\n                    })\n\n                    module.exports = ReactCSSTransitionGroupChild\n                },\n                { \"160\": 160, \"171\": 171, \"31\": 31, \"4\": 4, \"97\": 97 }\n            ],\n            36: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2014-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule ReactChildReconciler\n                     * @typechecks static-only\n                     */\n\n                    \"use strict\"\n\n                    var ReactReconciler = _dereq_(89)\n\n                    var flattenChildren = _dereq_(133)\n                    var instantiateReactComponent = _dereq_(149)\n                    var shouldUpdateReactComponent = _dereq_(167)\n\n                    /**\n                     * ReactChildReconciler provides helpers for initializing or updating a set of\n                     * children. Its output is suitable for passing it onto ReactMultiChild which\n                     * does diffed reordering and insertion.\n                     */\n                    var ReactChildReconciler = {\n                        /**\n                         * Generates a \"mount image\" for each of the supplied children. In the case\n                         * of `ReactDOMComponent`, a mount image is a string of markup.\n                         *\n                         * @param {?object} nestedChildNodes Nested child maps.\n                         * @return {?object} A set of child instances.\n                         * @internal\n                         */\n                        instantiateChildren: function(nestedChildNodes, transaction, context) {\n                            var children = flattenChildren(nestedChildNodes)\n                            for (var name in children) {\n                                if (children.hasOwnProperty(name)) {\n                                    var child = children[name]\n                                    // The rendered children must be turned into instances as they're\n                                    // mounted.\n                                    var childInstance = instantiateReactComponent(child, null)\n                                    children[name] = childInstance\n                                }\n                            }\n                            return children\n                        },\n\n                        /**\n                         * Updates the rendered children and returns a new set of children.\n                         *\n                         * @param {?object} prevChildren Previously initialized set of children.\n                         * @param {?object} nextNestedChildNodes Nested child maps.\n                         * @param {ReactReconcileTransaction} transaction\n                         * @param {object} context\n                         * @return {?object} A new set of child instances.\n                         * @internal\n                         */\n                        updateChildren: function(\n                            prevChildren,\n                            nextNestedChildNodes,\n                            transaction,\n                            context\n                        ) {\n                            // We currently don't have a way to track moves here but if we use iterators\n                            // instead of for..in we can zip the iterators and check if an item has\n                            // moved.\n                            // TODO: If nothing has changed, return the prevChildren object so that we\n                            // can quickly bailout if nothing has changed.\n                            var nextChildren = flattenChildren(nextNestedChildNodes)\n                            if (!nextChildren && !prevChildren) {\n                                return null\n                            }\n                            var name\n                            for (name in nextChildren) {\n                                if (!nextChildren.hasOwnProperty(name)) {\n                                    continue\n                                }\n                                var prevChild = prevChildren && prevChildren[name]\n                                var prevElement = prevChild && prevChild._currentElement\n                                var nextElement = nextChildren[name]\n                                if (shouldUpdateReactComponent(prevElement, nextElement)) {\n                                    ReactReconciler.receiveComponent(\n                                        prevChild,\n                                        nextElement,\n                                        transaction,\n                                        context\n                                    )\n                                    nextChildren[name] = prevChild\n                                } else {\n                                    if (prevChild) {\n                                        ReactReconciler.unmountComponent(prevChild, name)\n                                    }\n                                    // The child must be instantiated before it's mounted.\n                                    var nextChildInstance = instantiateReactComponent(\n                                        nextElement,\n                                        null\n                                    )\n                                    nextChildren[name] = nextChildInstance\n                                }\n                            }\n                            // Unmount children that are no longer present.\n                            for (name in prevChildren) {\n                                if (\n                                    prevChildren.hasOwnProperty(name) &&\n                                    !(nextChildren && nextChildren.hasOwnProperty(name))\n                                ) {\n                                    ReactReconciler.unmountComponent(prevChildren[name])\n                                }\n                            }\n                            return nextChildren\n                        },\n\n                        /**\n                         * Unmounts all rendered children. This should be used to clean up children\n                         * when this component is unmounted.\n                         *\n                         * @param {?object} renderedChildren Previously initialized set of children.\n                         * @internal\n                         */\n                        unmountChildren: function(renderedChildren) {\n                            for (var name in renderedChildren) {\n                                var renderedChild = renderedChildren[name]\n                                ReactReconciler.unmountComponent(renderedChild)\n                            }\n                        }\n                    }\n\n                    module.exports = ReactChildReconciler\n                },\n                { \"133\": 133, \"149\": 149, \"167\": 167, \"89\": 89 }\n            ],\n            37: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule ReactChildren\n                     */\n\n                    \"use strict\"\n\n                    var PooledClass = _dereq_(30)\n                    var ReactFragment = _dereq_(69)\n\n                    var traverseAllChildren = _dereq_(169)\n                    var warning = _dereq_(171)\n\n                    var twoArgumentPooler = PooledClass.twoArgumentPooler\n                    var threeArgumentPooler = PooledClass.threeArgumentPooler\n\n                    /**\n                     * PooledClass representing the bookkeeping associated with performing a child\n                     * traversal. Allows avoiding binding callbacks.\n                     *\n                     * @constructor ForEachBookKeeping\n                     * @param {!function} forEachFunction Function to perform traversal with.\n                     * @param {?*} forEachContext Context to perform context with.\n                     */\n                    function ForEachBookKeeping(forEachFunction, forEachContext) {\n                        this.forEachFunction = forEachFunction\n                        this.forEachContext = forEachContext\n                    }\n                    PooledClass.addPoolingTo(ForEachBookKeeping, twoArgumentPooler)\n\n                    function forEachSingleChild(traverseContext, child, name, i) {\n                        var forEachBookKeeping = traverseContext\n                        forEachBookKeeping.forEachFunction.call(\n                            forEachBookKeeping.forEachContext,\n                            child,\n                            i\n                        )\n                    }\n\n                    /**\n                     * Iterates through children that are typically specified as `props.children`.\n                     *\n                     * The provided forEachFunc(child, index) will be called for each\n                     * leaf child.\n                     *\n                     * @param {?*} children Children tree container.\n                     * @param {function(*, int)} forEachFunc.\n                     * @param {*} forEachContext Context for forEachContext.\n                     */\n                    function forEachChildren(children, forEachFunc, forEachContext) {\n                        if (children == null) {\n                            return children\n                        }\n\n                        var traverseContext = ForEachBookKeeping.getPooled(\n                            forEachFunc,\n                            forEachContext\n                        )\n                        traverseAllChildren(children, forEachSingleChild, traverseContext)\n                        ForEachBookKeeping.release(traverseContext)\n                    }\n\n                    /**\n                     * PooledClass representing the bookkeeping associated with performing a child\n                     * mapping. Allows avoiding binding callbacks.\n                     *\n                     * @constructor MapBookKeeping\n                     * @param {!*} mapResult Object containing the ordered map of results.\n                     * @param {!function} mapFunction Function to perform mapping with.\n                     * @param {?*} mapContext Context to perform mapping with.\n                     */\n                    function MapBookKeeping(mapResult, mapFunction, mapContext) {\n                        this.mapResult = mapResult\n                        this.mapFunction = mapFunction\n                        this.mapContext = mapContext\n                    }\n                    PooledClass.addPoolingTo(MapBookKeeping, threeArgumentPooler)\n\n                    function mapSingleChildIntoContext(traverseContext, child, name, i) {\n                        var mapBookKeeping = traverseContext\n                        var mapResult = mapBookKeeping.mapResult\n\n                        var keyUnique = !mapResult.hasOwnProperty(name)\n                        if (\"production\" !== \"development\") {\n                            \"production\" !== \"development\"\n                                ? warning(\n                                      keyUnique,\n                                      \"ReactChildren.map(...): Encountered two children with the same key, \" +\n                                          \"`%s`. Child keys must be unique; when two children share a key, only \" +\n                                          \"the first child will be used.\",\n                                      name\n                                  )\n                                : null\n                        }\n\n                        if (keyUnique) {\n                            var mappedChild = mapBookKeeping.mapFunction.call(\n                                mapBookKeeping.mapContext,\n                                child,\n                                i\n                            )\n                            mapResult[name] = mappedChild\n                        }\n                    }\n\n                    /**\n                     * Maps children that are typically specified as `props.children`.\n                     *\n                     * The provided mapFunction(child, key, index) will be called for each\n                     * leaf child.\n                     *\n                     * TODO: This may likely break any calls to `ReactChildren.map` that were\n                     * previously relying on the fact that we guarded against null children.\n                     *\n                     * @param {?*} children Children tree container.\n                     * @param {function(*, int)} mapFunction.\n                     * @param {*} mapContext Context for mapFunction.\n                     * @return {object} Object containing the ordered map of results.\n                     */\n                    function mapChildren(children, func, context) {\n                        if (children == null) {\n                            return children\n                        }\n\n                        var mapResult = {}\n                        var traverseContext = MapBookKeeping.getPooled(mapResult, func, context)\n                        traverseAllChildren(children, mapSingleChildIntoContext, traverseContext)\n                        MapBookKeeping.release(traverseContext)\n                        return ReactFragment.create(mapResult)\n                    }\n\n                    function forEachSingleChildDummy(traverseContext, child, name, i) {\n                        return null\n                    }\n\n                    /**\n                     * Count the number of children that are typically specified as\n                     * `props.children`.\n                     *\n                     * @param {?*} children Children tree container.\n                     * @return {number} The number of children.\n                     */\n                    function countChildren(children, context) {\n                        return traverseAllChildren(children, forEachSingleChildDummy, null)\n                    }\n\n                    var ReactChildren = {\n                        forEach: forEachChildren,\n                        map: mapChildren,\n                        count: countChildren\n                    }\n\n                    module.exports = ReactChildren\n                },\n                { \"169\": 169, \"171\": 171, \"30\": 30, \"69\": 69 }\n            ],\n            38: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule ReactClass\n                     */\n\n                    \"use strict\"\n\n                    var ReactComponent = _dereq_(39)\n                    var ReactCurrentOwner = _dereq_(45)\n                    var ReactElement = _dereq_(63)\n                    var ReactErrorUtils = _dereq_(66)\n                    var ReactInstanceMap = _dereq_(73)\n                    var ReactLifeCycle = _dereq_(74)\n                    var ReactPropTypeLocations = _dereq_(85)\n                    var ReactPropTypeLocationNames = _dereq_(84)\n                    var ReactUpdateQueue = _dereq_(99)\n\n                    var assign = _dereq_(29)\n                    var invariant = _dereq_(150)\n                    var keyMirror = _dereq_(156)\n                    var keyOf = _dereq_(157)\n                    var warning = _dereq_(171)\n\n                    var MIXINS_KEY = keyOf({ mixins: null })\n\n                    /**\n                     * Policies that describe methods in `ReactClassInterface`.\n                     */\n                    var SpecPolicy = keyMirror({\n                        /**\n                         * These methods may be defined only once by the class specification or mixin.\n                         */\n                        DEFINE_ONCE: null,\n                        /**\n                         * These methods may be defined by both the class specification and mixins.\n                         * Subsequent definitions will be chained. These methods must return void.\n                         */\n                        DEFINE_MANY: null,\n                        /**\n                         * These methods are overriding the base class.\n                         */\n                        OVERRIDE_BASE: null,\n                        /**\n                         * These methods are similar to DEFINE_MANY, except we assume they return\n                         * objects. We try to merge the keys of the return values of all the mixed in\n                         * functions. If there is a key conflict we throw.\n                         */\n                        DEFINE_MANY_MERGED: null\n                    })\n\n                    var injectedMixins = []\n\n                    /**\n                     * Composite components are higher-level components that compose other composite\n                     * or native components.\n                     *\n                     * To create a new type of `ReactClass`, pass a specification of\n                     * your new class to `React.createClass`. The only requirement of your class\n                     * specification is that you implement a `render` method.\n                     *\n                     *   var MyComponent = React.createClass({\n                     *     render: function() {\n                     *       return <div>Hello World</div>;\n                     *     }\n                     *   });\n                     *\n                     * The class specification supports a specific protocol of methods that have\n                     * special meaning (e.g. `render`). See `ReactClassInterface` for\n                     * more the comprehensive protocol. Any other properties and methods in the\n                     * class specification will available on the prototype.\n                     *\n                     * @interface ReactClassInterface\n                     * @internal\n                     */\n                    var ReactClassInterface = {\n                        /**\n                         * An array of Mixin objects to include when defining your component.\n                         *\n                         * @type {array}\n                         * @optional\n                         */\n                        mixins: SpecPolicy.DEFINE_MANY,\n\n                        /**\n                         * An object containing properties and methods that should be defined on\n                         * the component's constructor instead of its prototype (static methods).\n                         *\n                         * @type {object}\n                         * @optional\n                         */\n                        statics: SpecPolicy.DEFINE_MANY,\n\n                        /**\n                         * Definition of prop types for this component.\n                         *\n                         * @type {object}\n                         * @optional\n                         */\n                        propTypes: SpecPolicy.DEFINE_MANY,\n\n                        /**\n                         * Definition of context types for this component.\n                         *\n                         * @type {object}\n                         * @optional\n                         */\n                        contextTypes: SpecPolicy.DEFINE_MANY,\n\n                        /**\n                         * Definition of context types this component sets for its children.\n                         *\n                         * @type {object}\n                         * @optional\n                         */\n                        childContextTypes: SpecPolicy.DEFINE_MANY,\n\n                        // ==== Definition methods ====\n\n                        /**\n                         * Invoked when the component is mounted. Values in the mapping will be set on\n                         * `this.props` if that prop is not specified (i.e. using an `in` check).\n                         *\n                         * This method is invoked before `getInitialState` and therefore cannot rely\n                         * on `this.state` or use `this.setState`.\n                         *\n                         * @return {object}\n                         * @optional\n                         */\n                        getDefaultProps: SpecPolicy.DEFINE_MANY_MERGED,\n\n                        /**\n                         * Invoked once before the component is mounted. The return value will be used\n                         * as the initial value of `this.state`.\n                         *\n                         *   getInitialState: function() {\n                         *     return {\n                         *       isOn: false,\n                         *       fooBaz: new BazFoo()\n                         *     }\n                         *   }\n                         *\n                         * @return {object}\n                         * @optional\n                         */\n                        getInitialState: SpecPolicy.DEFINE_MANY_MERGED,\n\n                        /**\n                         * @return {object}\n                         * @optional\n                         */\n                        getChildContext: SpecPolicy.DEFINE_MANY_MERGED,\n\n                        /**\n                         * Uses props from `this.props` and state from `this.state` to render the\n                         * structure of the component.\n                         *\n                         * No guarantees are made about when or how often this method is invoked, so\n                         * it must not have side effects.\n                         *\n                         *   render: function() {\n                         *     var name = this.props.name;\n                         *     return <div>Hello, {name}!</div>;\n                         *   }\n                         *\n                         * @return {ReactComponent}\n                         * @nosideeffects\n                         * @required\n                         */\n                        render: SpecPolicy.DEFINE_ONCE,\n\n                        // ==== Delegate methods ====\n\n                        /**\n                         * Invoked when the component is initially created and about to be mounted.\n                         * This may have side effects, but any external subscriptions or data created\n                         * by this method must be cleaned up in `componentWillUnmount`.\n                         *\n                         * @optional\n                         */\n                        componentWillMount: SpecPolicy.DEFINE_MANY,\n\n                        /**\n                         * Invoked when the component has been mounted and has a DOM representation.\n                         * However, there is no guarantee that the DOM node is in the document.\n                         *\n                         * Use this as an opportunity to operate on the DOM when the component has\n                         * been mounted (initialized and rendered) for the first time.\n                         *\n                         * @param {DOMElement} rootNode DOM element representing the component.\n                         * @optional\n                         */\n                        componentDidMount: SpecPolicy.DEFINE_MANY,\n\n                        /**\n                         * Invoked before the component receives new props.\n                         *\n                         * Use this as an opportunity to react to a prop transition by updating the\n                         * state using `this.setState`. Current props are accessed via `this.props`.\n                         *\n                         *   componentWillReceiveProps: function(nextProps, nextContext) {\n                         *     this.setState({\n                         *       likesIncreasing: nextProps.likeCount > this.props.likeCount\n                         *     });\n                         *   }\n                         *\n                         * NOTE: There is no equivalent `componentWillReceiveState`. An incoming prop\n                         * transition may cause a state change, but the opposite is not true. If you\n                         * need it, you are probably looking for `componentWillUpdate`.\n                         *\n                         * @param {object} nextProps\n                         * @optional\n                         */\n                        componentWillReceiveProps: SpecPolicy.DEFINE_MANY,\n\n                        /**\n                         * Invoked while deciding if the component should be updated as a result of\n                         * receiving new props, state and/or context.\n                         *\n                         * Use this as an opportunity to `return false` when you're certain that the\n                         * transition to the new props/state/context will not require a component\n                         * update.\n                         *\n                         *   shouldComponentUpdate: function(nextProps, nextState, nextContext) {\n                         *     return !equal(nextProps, this.props) ||\n                         *       !equal(nextState, this.state) ||\n                         *       !equal(nextContext, this.context);\n                         *   }\n                         *\n                         * @param {object} nextProps\n                         * @param {?object} nextState\n                         * @param {?object} nextContext\n                         * @return {boolean} True if the component should update.\n                         * @optional\n                         */\n                        shouldComponentUpdate: SpecPolicy.DEFINE_ONCE,\n\n                        /**\n                         * Invoked when the component is about to update due to a transition from\n                         * `this.props`, `this.state` and `this.context` to `nextProps`, `nextState`\n                         * and `nextContext`.\n                         *\n                         * Use this as an opportunity to perform preparation before an update occurs.\n                         *\n                         * NOTE: You **cannot** use `this.setState()` in this method.\n                         *\n                         * @param {object} nextProps\n                         * @param {?object} nextState\n                         * @param {?object} nextContext\n                         * @param {ReactReconcileTransaction} transaction\n                         * @optional\n                         */\n                        componentWillUpdate: SpecPolicy.DEFINE_MANY,\n\n                        /**\n                         * Invoked when the component's DOM representation has been updated.\n                         *\n                         * Use this as an opportunity to operate on the DOM when the component has\n                         * been updated.\n                         *\n                         * @param {object} prevProps\n                         * @param {?object} prevState\n                         * @param {?object} prevContext\n                         * @param {DOMElement} rootNode DOM element representing the component.\n                         * @optional\n                         */\n                        componentDidUpdate: SpecPolicy.DEFINE_MANY,\n\n                        /**\n                         * Invoked when the component is about to be removed from its parent and have\n                         * its DOM representation destroyed.\n                         *\n                         * Use this as an opportunity to deallocate any external resources.\n                         *\n                         * NOTE: There is no `componentDidUnmount` since your component will have been\n                         * destroyed by that point.\n                         *\n                         * @optional\n                         */\n                        componentWillUnmount: SpecPolicy.DEFINE_MANY,\n\n                        // ==== Advanced methods ====\n\n                        /**\n                         * Updates the component's currently mounted DOM representation.\n                         *\n                         * By default, this implements React's rendering and reconciliation algorithm.\n                         * Sophisticated clients may wish to override this.\n                         *\n                         * @param {ReactReconcileTransaction} transaction\n                         * @internal\n                         * @overridable\n                         */\n                        updateComponent: SpecPolicy.OVERRIDE_BASE\n                    }\n\n                    /**\n                     * Mapping from class specification keys to special processing functions.\n                     *\n                     * Although these are declared like instance properties in the specification\n                     * when defining classes using `React.createClass`, they are actually static\n                     * and are accessible on the constructor instead of the prototype. Despite\n                     * being static, they must be defined outside of the \"statics\" key under\n                     * which all other static methods are defined.\n                     */\n                    var RESERVED_SPEC_KEYS = {\n                        displayName: function(Constructor, displayName) {\n                            Constructor.displayName = displayName\n                        },\n                        mixins: function(Constructor, mixins) {\n                            if (mixins) {\n                                for (var i = 0; i < mixins.length; i++) {\n                                    mixSpecIntoComponent(Constructor, mixins[i])\n                                }\n                            }\n                        },\n                        childContextTypes: function(Constructor, childContextTypes) {\n                            if (\"production\" !== \"development\") {\n                                validateTypeDef(\n                                    Constructor,\n                                    childContextTypes,\n                                    ReactPropTypeLocations.childContext\n                                )\n                            }\n                            Constructor.childContextTypes = assign(\n                                {},\n                                Constructor.childContextTypes,\n                                childContextTypes\n                            )\n                        },\n                        contextTypes: function(Constructor, contextTypes) {\n                            if (\"production\" !== \"development\") {\n                                validateTypeDef(\n                                    Constructor,\n                                    contextTypes,\n                                    ReactPropTypeLocations.context\n                                )\n                            }\n                            Constructor.contextTypes = assign(\n                                {},\n                                Constructor.contextTypes,\n                                contextTypes\n                            )\n                        },\n                        /**\n                         * Special case getDefaultProps which should move into statics but requires\n                         * automatic merging.\n                         */\n                        getDefaultProps: function(Constructor, getDefaultProps) {\n                            if (Constructor.getDefaultProps) {\n                                Constructor.getDefaultProps = createMergedResultFunction(\n                                    Constructor.getDefaultProps,\n                                    getDefaultProps\n                                )\n                            } else {\n                                Constructor.getDefaultProps = getDefaultProps\n                            }\n                        },\n                        propTypes: function(Constructor, propTypes) {\n                            if (\"production\" !== \"development\") {\n                                validateTypeDef(Constructor, propTypes, ReactPropTypeLocations.prop)\n                            }\n                            Constructor.propTypes = assign({}, Constructor.propTypes, propTypes)\n                        },\n                        statics: function(Constructor, statics) {\n                            mixStaticSpecIntoComponent(Constructor, statics)\n                        }\n                    }\n\n                    function validateTypeDef(Constructor, typeDef, location) {\n                        for (var propName in typeDef) {\n                            if (typeDef.hasOwnProperty(propName)) {\n                                // use a warning instead of an invariant so components\n                                // don't show up in prod but not in __DEV__\n                                \"production\" !== \"development\"\n                                    ? warning(\n                                          typeof typeDef[propName] === \"function\",\n                                          \"%s: %s type `%s` is invalid; it must be a function, usually from \" +\n                                              \"React.PropTypes.\",\n                                          Constructor.displayName || \"ReactClass\",\n                                          ReactPropTypeLocationNames[location],\n                                          propName\n                                      )\n                                    : null\n                            }\n                        }\n                    }\n\n                    function validateMethodOverride(proto, name) {\n                        var specPolicy = ReactClassInterface.hasOwnProperty(name)\n                            ? ReactClassInterface[name]\n                            : null\n\n                        // Disallow overriding of base class methods unless explicitly allowed.\n                        if (ReactClassMixin.hasOwnProperty(name)) {\n                            \"production\" !== \"development\"\n                                ? invariant(\n                                      specPolicy === SpecPolicy.OVERRIDE_BASE,\n                                      \"ReactClassInterface: You are attempting to override \" +\n                                          \"`%s` from your class specification. Ensure that your method names \" +\n                                          \"do not overlap with React methods.\",\n                                      name\n                                  )\n                                : invariant(specPolicy === SpecPolicy.OVERRIDE_BASE)\n                        }\n\n                        // Disallow defining methods more than once unless explicitly allowed.\n                        if (proto.hasOwnProperty(name)) {\n                            \"production\" !== \"development\"\n                                ? invariant(\n                                      specPolicy === SpecPolicy.DEFINE_MANY ||\n                                          specPolicy === SpecPolicy.DEFINE_MANY_MERGED,\n                                      \"ReactClassInterface: You are attempting to define \" +\n                                          \"`%s` on your component more than once. This conflict may be due \" +\n                                          \"to a mixin.\",\n                                      name\n                                  )\n                                : invariant(\n                                      specPolicy === SpecPolicy.DEFINE_MANY ||\n                                          specPolicy === SpecPolicy.DEFINE_MANY_MERGED\n                                  )\n                        }\n                    }\n\n                    /**\n                     * Mixin helper which handles policy validation and reserved\n                     * specification keys when building React classses.\n                     */\n                    function mixSpecIntoComponent(Constructor, spec) {\n                        if (!spec) {\n                            return\n                        }\n\n                        \"production\" !== \"development\"\n                            ? invariant(\n                                  typeof spec !== \"function\",\n                                  \"ReactClass: You're attempting to \" +\n                                      \"use a component class as a mixin. Instead, just use a regular object.\"\n                              )\n                            : invariant(typeof spec !== \"function\")\n                        \"production\" !== \"development\"\n                            ? invariant(\n                                  !ReactElement.isValidElement(spec),\n                                  \"ReactClass: You're attempting to \" +\n                                      \"use a component as a mixin. Instead, just use a regular object.\"\n                              )\n                            : invariant(!ReactElement.isValidElement(spec))\n\n                        var proto = Constructor.prototype\n\n                        // By handling mixins before any other properties, we ensure the same\n                        // chaining order is applied to methods with DEFINE_MANY policy, whether\n                        // mixins are listed before or after these methods in the spec.\n                        if (spec.hasOwnProperty(MIXINS_KEY)) {\n                            RESERVED_SPEC_KEYS.mixins(Constructor, spec.mixins)\n                        }\n\n                        for (var name in spec) {\n                            if (!spec.hasOwnProperty(name)) {\n                                continue\n                            }\n\n                            if (name === MIXINS_KEY) {\n                                // We have already handled mixins in a special case above\n                                continue\n                            }\n\n                            var property = spec[name]\n                            validateMethodOverride(proto, name)\n\n                            if (RESERVED_SPEC_KEYS.hasOwnProperty(name)) {\n                                RESERVED_SPEC_KEYS[name](Constructor, property)\n                            } else {\n                                // Setup methods on prototype:\n                                // The following member methods should not be automatically bound:\n                                // 1. Expected ReactClass methods (in the \"interface\").\n                                // 2. Overridden methods (that were mixed in).\n                                var isReactClassMethod = ReactClassInterface.hasOwnProperty(name)\n                                var isAlreadyDefined = proto.hasOwnProperty(name)\n                                var markedDontBind = property && property.__reactDontBind\n                                var isFunction = typeof property === \"function\"\n                                var shouldAutoBind =\n                                    isFunction &&\n                                    !isReactClassMethod &&\n                                    !isAlreadyDefined &&\n                                    !markedDontBind\n\n                                if (shouldAutoBind) {\n                                    if (!proto.__reactAutoBindMap) {\n                                        proto.__reactAutoBindMap = {}\n                                    }\n                                    proto.__reactAutoBindMap[name] = property\n                                    proto[name] = property\n                                } else {\n                                    if (isAlreadyDefined) {\n                                        var specPolicy = ReactClassInterface[name]\n\n                                        // These cases should already be caught by validateMethodOverride\n                                        \"production\" !== \"development\"\n                                            ? invariant(\n                                                  isReactClassMethod &&\n                                                      (specPolicy ===\n                                                          SpecPolicy.DEFINE_MANY_MERGED ||\n                                                          specPolicy === SpecPolicy.DEFINE_MANY),\n                                                  \"ReactClass: Unexpected spec policy %s for key %s \" +\n                                                      \"when mixing in component specs.\",\n                                                  specPolicy,\n                                                  name\n                                              )\n                                            : invariant(\n                                                  isReactClassMethod &&\n                                                      (specPolicy ===\n                                                          SpecPolicy.DEFINE_MANY_MERGED ||\n                                                          specPolicy === SpecPolicy.DEFINE_MANY)\n                                              )\n\n                                        // For methods which are defined more than once, call the existing\n                                        // methods before calling the new property, merging if appropriate.\n                                        if (specPolicy === SpecPolicy.DEFINE_MANY_MERGED) {\n                                            proto[name] = createMergedResultFunction(\n                                                proto[name],\n                                                property\n                                            )\n                                        } else if (specPolicy === SpecPolicy.DEFINE_MANY) {\n                                            proto[name] = createChainedFunction(\n                                                proto[name],\n                                                property\n                                            )\n                                        }\n                                    } else {\n                                        proto[name] = property\n                                        if (\"production\" !== \"development\") {\n                                            // Add verbose displayName to the function, which helps when looking\n                                            // at profiling tools.\n                                            if (\n                                                typeof property === \"function\" &&\n                                                spec.displayName\n                                            ) {\n                                                proto[name].displayName =\n                                                    spec.displayName + \"_\" + name\n                                            }\n                                        }\n                                    }\n                                }\n                            }\n                        }\n                    }\n\n                    function mixStaticSpecIntoComponent(Constructor, statics) {\n                        if (!statics) {\n                            return\n                        }\n                        for (var name in statics) {\n                            var property = statics[name]\n                            if (!statics.hasOwnProperty(name)) {\n                                continue\n                            }\n\n                            var isReserved = name in RESERVED_SPEC_KEYS\n                            \"production\" !== \"development\"\n                                ? invariant(\n                                      !isReserved,\n                                      \"ReactClass: You are attempting to define a reserved \" +\n                                          'property, `%s`, that shouldn\\'t be on the \"statics\" key. Define it ' +\n                                          \"as an instance property instead; it will still be accessible on the \" +\n                                          \"constructor.\",\n                                      name\n                                  )\n                                : invariant(!isReserved)\n\n                            var isInherited = name in Constructor\n                            \"production\" !== \"development\"\n                                ? invariant(\n                                      !isInherited,\n                                      \"ReactClass: You are attempting to define \" +\n                                          \"`%s` on your component more than once. This conflict may be \" +\n                                          \"due to a mixin.\",\n                                      name\n                                  )\n                                : invariant(!isInherited)\n                            Constructor[name] = property\n                        }\n                    }\n\n                    /**\n                     * Merge two objects, but throw if both contain the same key.\n                     *\n                     * @param {object} one The first object, which is mutated.\n                     * @param {object} two The second object\n                     * @return {object} one after it has been mutated to contain everything in two.\n                     */\n                    function mergeIntoWithNoDuplicateKeys(one, two) {\n                        \"production\" !== \"development\"\n                            ? invariant(\n                                  one && two && typeof one === \"object\" && typeof two === \"object\",\n                                  \"mergeIntoWithNoDuplicateKeys(): Cannot merge non-objects.\"\n                              )\n                            : invariant(\n                                  one && two && typeof one === \"object\" && typeof two === \"object\"\n                              )\n\n                        for (var key in two) {\n                            if (two.hasOwnProperty(key)) {\n                                \"production\" !== \"development\"\n                                    ? invariant(\n                                          one[key] === undefined,\n                                          \"mergeIntoWithNoDuplicateKeys(): \" +\n                                              \"Tried to merge two objects with the same key: `%s`. This conflict \" +\n                                              \"may be due to a mixin; in particular, this may be caused by two \" +\n                                              \"getInitialState() or getDefaultProps() methods returning objects \" +\n                                              \"with clashing keys.\",\n                                          key\n                                      )\n                                    : invariant(one[key] === undefined)\n                                one[key] = two[key]\n                            }\n                        }\n                        return one\n                    }\n\n                    /**\n                     * Creates a function that invokes two functions and merges their return values.\n                     *\n                     * @param {function} one Function to invoke first.\n                     * @param {function} two Function to invoke second.\n                     * @return {function} Function that invokes the two argument functions.\n                     * @private\n                     */\n                    function createMergedResultFunction(one, two) {\n                        return function mergedResult() {\n                            var a = one.apply(this, arguments)\n                            var b = two.apply(this, arguments)\n                            if (a == null) {\n                                return b\n                            } else if (b == null) {\n                                return a\n                            }\n                            var c = {}\n                            mergeIntoWithNoDuplicateKeys(c, a)\n                            mergeIntoWithNoDuplicateKeys(c, b)\n                            return c\n                        }\n                    }\n\n                    /**\n                     * Creates a function that invokes two functions and ignores their return vales.\n                     *\n                     * @param {function} one Function to invoke first.\n                     * @param {function} two Function to invoke second.\n                     * @return {function} Function that invokes the two argument functions.\n                     * @private\n                     */\n                    function createChainedFunction(one, two) {\n                        return function chainedFunction() {\n                            one.apply(this, arguments)\n                            two.apply(this, arguments)\n                        }\n                    }\n\n                    /**\n                     * Binds a method to the component.\n                     *\n                     * @param {object} component Component whose method is going to be bound.\n                     * @param {function} method Method to be bound.\n                     * @return {function} The bound method.\n                     */\n                    function bindAutoBindMethod(component, method) {\n                        var boundMethod = method.bind(component)\n                        if (\"production\" !== \"development\") {\n                            boundMethod.__reactBoundContext = component\n                            boundMethod.__reactBoundMethod = method\n                            boundMethod.__reactBoundArguments = null\n                            var componentName = component.constructor.displayName\n                            var _bind = boundMethod.bind\n                            /* eslint-disable block-scoped-var, no-undef */\n                            boundMethod.bind = function(newThis) {\n                                for (\n                                    var args = [], $__0 = 1, $__1 = arguments.length;\n                                    $__0 < $__1;\n                                    $__0++\n                                )\n                                    args.push(arguments[$__0])\n                                // User is trying to bind() an autobound method; we effectively will\n                                // ignore the value of \"this\" that the user is trying to use, so\n                                // let's warn.\n                                if (newThis !== component && newThis !== null) {\n                                    \"production\" !== \"development\"\n                                        ? warning(\n                                              false,\n                                              \"bind(): React component methods may only be bound to the \" +\n                                                  \"component instance. See %s\",\n                                              componentName\n                                          )\n                                        : null\n                                } else if (!args.length) {\n                                    \"production\" !== \"development\"\n                                        ? warning(\n                                              false,\n                                              \"bind(): You are binding a component method to the component. \" +\n                                                  \"React does this for you automatically in a high-performance \" +\n                                                  \"way, so you can safely remove this call. See %s\",\n                                              componentName\n                                          )\n                                        : null\n                                    return boundMethod\n                                }\n                                var reboundMethod = _bind.apply(boundMethod, arguments)\n                                reboundMethod.__reactBoundContext = component\n                                reboundMethod.__reactBoundMethod = method\n                                reboundMethod.__reactBoundArguments = args\n                                return reboundMethod\n                                /* eslint-enable */\n                            }\n                        }\n                        return boundMethod\n                    }\n\n                    /**\n                     * Binds all auto-bound methods in a component.\n                     *\n                     * @param {object} component Component whose method is going to be bound.\n                     */\n                    function bindAutoBindMethods(component) {\n                        for (var autoBindKey in component.__reactAutoBindMap) {\n                            if (component.__reactAutoBindMap.hasOwnProperty(autoBindKey)) {\n                                var method = component.__reactAutoBindMap[autoBindKey]\n                                component[autoBindKey] = bindAutoBindMethod(\n                                    component,\n                                    ReactErrorUtils.guard(\n                                        method,\n                                        component.constructor.displayName + \".\" + autoBindKey\n                                    )\n                                )\n                            }\n                        }\n                    }\n\n                    var typeDeprecationDescriptor = {\n                        enumerable: false,\n                        get: function() {\n                            var displayName = this.displayName || this.name || \"Component\"\n                            \"production\" !== \"development\"\n                                ? warning(\n                                      false,\n                                      \"%s.type is deprecated. Use %s directly to access the class.\",\n                                      displayName,\n                                      displayName\n                                  )\n                                : null\n                            Object.defineProperty(this, \"type\", {\n                                value: this\n                            })\n                            return this\n                        }\n                    }\n\n                    /**\n                     * Add more to the ReactClass base class. These are all legacy features and\n                     * therefore not already part of the modern ReactComponent.\n                     */\n                    var ReactClassMixin = {\n                        /**\n                         * TODO: This will be deprecated because state should always keep a consistent\n                         * type signature and the only use case for this, is to avoid that.\n                         */\n                        replaceState: function(newState, callback) {\n                            ReactUpdateQueue.enqueueReplaceState(this, newState)\n                            if (callback) {\n                                ReactUpdateQueue.enqueueCallback(this, callback)\n                            }\n                        },\n\n                        /**\n                         * Checks whether or not this composite component is mounted.\n                         * @return {boolean} True if mounted, false otherwise.\n                         * @protected\n                         * @final\n                         */\n                        isMounted: function() {\n                            if (\"production\" !== \"development\") {\n                                var owner = ReactCurrentOwner.current\n                                if (owner !== null) {\n                                    \"production\" !== \"development\"\n                                        ? warning(\n                                              owner._warnedAboutRefsInRender,\n                                              \"%s is accessing isMounted inside its render() function. \" +\n                                                  \"render() should be a pure function of props and state. It should \" +\n                                                  \"never access something that requires stale data from the previous \" +\n                                                  \"render, such as refs. Move this logic to componentDidMount and \" +\n                                                  \"componentDidUpdate instead.\",\n                                              owner.getName() || \"A component\"\n                                          )\n                                        : null\n                                    owner._warnedAboutRefsInRender = true\n                                }\n                            }\n                            var internalInstance = ReactInstanceMap.get(this)\n                            return (\n                                internalInstance &&\n                                internalInstance !== ReactLifeCycle.currentlyMountingInstance\n                            )\n                        },\n\n                        /**\n                         * Sets a subset of the props.\n                         *\n                         * @param {object} partialProps Subset of the next props.\n                         * @param {?function} callback Called after props are updated.\n                         * @final\n                         * @public\n                         * @deprecated\n                         */\n                        setProps: function(partialProps, callback) {\n                            ReactUpdateQueue.enqueueSetProps(this, partialProps)\n                            if (callback) {\n                                ReactUpdateQueue.enqueueCallback(this, callback)\n                            }\n                        },\n\n                        /**\n                         * Replace all the props.\n                         *\n                         * @param {object} newProps Subset of the next props.\n                         * @param {?function} callback Called after props are updated.\n                         * @final\n                         * @public\n                         * @deprecated\n                         */\n                        replaceProps: function(newProps, callback) {\n                            ReactUpdateQueue.enqueueReplaceProps(this, newProps)\n                            if (callback) {\n                                ReactUpdateQueue.enqueueCallback(this, callback)\n                            }\n                        }\n                    }\n\n                    var ReactClassComponent = function() {}\n                    assign(ReactClassComponent.prototype, ReactComponent.prototype, ReactClassMixin)\n\n                    /**\n                     * Module for creating composite components.\n                     *\n                     * @class ReactClass\n                     */\n                    var ReactClass = {\n                        /**\n                         * Creates a composite component class given a class specification.\n                         *\n                         * @param {object} spec Class specification (which must define `render`).\n                         * @return {function} Component constructor function.\n                         * @public\n                         */\n                        createClass: function(spec) {\n                            var Constructor = function(props, context) {\n                                // This constructor is overridden by mocks. The argument is used\n                                // by mocks to assert on what gets mounted.\n\n                                if (\"production\" !== \"development\") {\n                                    \"production\" !== \"development\"\n                                        ? warning(\n                                              this instanceof Constructor,\n                                              \"Something is calling a React component directly. Use a factory or \" +\n                                                  \"JSX instead. See: https://fb.me/react-legacyfactory\"\n                                          )\n                                        : null\n                                }\n\n                                // Wire up auto-binding\n                                if (this.__reactAutoBindMap) {\n                                    bindAutoBindMethods(this)\n                                }\n\n                                this.props = props\n                                this.context = context\n                                this.state = null\n\n                                // ReactClasses doesn't have constructors. Instead, they use the\n                                // getInitialState and componentWillMount methods for initialization.\n\n                                var initialState = this.getInitialState\n                                    ? this.getInitialState()\n                                    : null\n                                if (\"production\" !== \"development\") {\n                                    // We allow auto-mocks to proceed as if they're returning null.\n                                    if (\n                                        typeof initialState === \"undefined\" &&\n                                        this.getInitialState._isMockFunction\n                                    ) {\n                                        // This is probably bad practice. Consider warning here and\n                                        // deprecating this convenience.\n                                        initialState = null\n                                    }\n                                }\n                                \"production\" !== \"development\"\n                                    ? invariant(\n                                          typeof initialState === \"object\" &&\n                                              !Array.isArray(initialState),\n                                          \"%s.getInitialState(): must return an object or null\",\n                                          Constructor.displayName || \"ReactCompositeComponent\"\n                                      )\n                                    : invariant(\n                                          typeof initialState === \"object\" &&\n                                              !Array.isArray(initialState)\n                                      )\n\n                                this.state = initialState\n                            }\n                            Constructor.prototype = new ReactClassComponent()\n                            Constructor.prototype.constructor = Constructor\n\n                            injectedMixins.forEach(mixSpecIntoComponent.bind(null, Constructor))\n\n                            mixSpecIntoComponent(Constructor, spec)\n\n                            // Initialize the defaultProps property after all mixins have been merged\n                            if (Constructor.getDefaultProps) {\n                                Constructor.defaultProps = Constructor.getDefaultProps()\n                            }\n\n                            if (\"production\" !== \"development\") {\n                                // This is a tag to indicate that the use of these method names is ok,\n                                // since it's used with createClass. If it's not, then it's likely a\n                                // mistake so we'll warn you to use the static property, property\n                                // initializer or constructor respectively.\n                                if (Constructor.getDefaultProps) {\n                                    Constructor.getDefaultProps.isReactClassApproved = {}\n                                }\n                                if (Constructor.prototype.getInitialState) {\n                                    Constructor.prototype.getInitialState.isReactClassApproved = {}\n                                }\n                            }\n\n                            \"production\" !== \"development\"\n                                ? invariant(\n                                      Constructor.prototype.render,\n                                      \"createClass(...): Class specification must implement a `render` method.\"\n                                  )\n                                : invariant(Constructor.prototype.render)\n\n                            if (\"production\" !== \"development\") {\n                                \"production\" !== \"development\"\n                                    ? warning(\n                                          !Constructor.prototype.componentShouldUpdate,\n                                          \"%s has a method called \" +\n                                              \"componentShouldUpdate(). Did you mean shouldComponentUpdate()? \" +\n                                              \"The name is phrased as a question because the function is \" +\n                                              \"expected to return a value.\",\n                                          spec.displayName || \"A component\"\n                                      )\n                                    : null\n                            }\n\n                            // Reduce time spent doing lookups by setting these on the prototype.\n                            for (var methodName in ReactClassInterface) {\n                                if (!Constructor.prototype[methodName]) {\n                                    Constructor.prototype[methodName] = null\n                                }\n                            }\n\n                            // Legacy hook\n                            Constructor.type = Constructor\n                            if (\"production\" !== \"development\") {\n                                try {\n                                    Object.defineProperty(\n                                        Constructor,\n                                        \"type\",\n                                        typeDeprecationDescriptor\n                                    )\n                                } catch (x) {\n                                    // IE will fail on defineProperty (es5-shim/sham too)\n                                }\n                            }\n\n                            return Constructor\n                        },\n\n                        injection: {\n                            injectMixin: function(mixin) {\n                                injectedMixins.push(mixin)\n                            }\n                        }\n                    }\n\n                    module.exports = ReactClass\n                },\n                {\n                    \"150\": 150,\n                    \"156\": 156,\n                    \"157\": 157,\n                    \"171\": 171,\n                    \"29\": 29,\n                    \"39\": 39,\n                    \"45\": 45,\n                    \"63\": 63,\n                    \"66\": 66,\n                    \"73\": 73,\n                    \"74\": 74,\n                    \"84\": 84,\n                    \"85\": 85,\n                    \"99\": 99\n                }\n            ],\n            39: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule ReactComponent\n                     */\n\n                    \"use strict\"\n\n                    var ReactUpdateQueue = _dereq_(99)\n\n                    var invariant = _dereq_(150)\n                    var warning = _dereq_(171)\n\n                    /**\n                     * Base class helpers for the updating state of a component.\n                     */\n                    function ReactComponent(props, context) {\n                        this.props = props\n                        this.context = context\n                    }\n\n                    /**\n                     * Sets a subset of the state. Always use this to mutate\n                     * state. You should treat `this.state` as immutable.\n                     *\n                     * There is no guarantee that `this.state` will be immediately updated, so\n                     * accessing `this.state` after calling this method may return the old value.\n                     *\n                     * There is no guarantee that calls to `setState` will run synchronously,\n                     * as they may eventually be batched together.  You can provide an optional\n                     * callback that will be executed when the call to setState is actually\n                     * completed.\n                     *\n                     * When a function is provided to setState, it will be called at some point in\n                     * the future (not synchronously). It will be called with the up to date\n                     * component arguments (state, props, context). These values can be different\n                     * from this.* because your function may be called after receiveProps but before\n                     * shouldComponentUpdate, and this new state, props, and context will not yet be\n                     * assigned to this.\n                     *\n                     * @param {object|function} partialState Next partial state or function to\n                     *        produce next partial state to be merged with current state.\n                     * @param {?function} callback Called after state is updated.\n                     * @final\n                     * @protected\n                     */\n                    ReactComponent.prototype.setState = function(partialState, callback) {\n                        \"production\" !== \"development\"\n                            ? invariant(\n                                  typeof partialState === \"object\" ||\n                                      typeof partialState === \"function\" ||\n                                      partialState == null,\n                                  \"setState(...): takes an object of state variables to update or a \" +\n                                      \"function which returns an object of state variables.\"\n                              )\n                            : invariant(\n                                  typeof partialState === \"object\" ||\n                                      typeof partialState === \"function\" ||\n                                      partialState == null\n                              )\n                        if (\"production\" !== \"development\") {\n                            \"production\" !== \"development\"\n                                ? warning(\n                                      partialState != null,\n                                      \"setState(...): You passed an undefined or null state object; \" +\n                                          \"instead, use forceUpdate().\"\n                                  )\n                                : null\n                        }\n                        ReactUpdateQueue.enqueueSetState(this, partialState)\n                        if (callback) {\n                            ReactUpdateQueue.enqueueCallback(this, callback)\n                        }\n                    }\n\n                    /**\n                     * Forces an update. This should only be invoked when it is known with\n                     * certainty that we are **not** in a DOM transaction.\n                     *\n                     * You may want to call this when you know that some deeper aspect of the\n                     * component's state has changed but `setState` was not called.\n                     *\n                     * This will not invoke `shouldComponentUpdate`, but it will invoke\n                     * `componentWillUpdate` and `componentDidUpdate`.\n                     *\n                     * @param {?function} callback Called after update is complete.\n                     * @final\n                     * @protected\n                     */\n                    ReactComponent.prototype.forceUpdate = function(callback) {\n                        ReactUpdateQueue.enqueueForceUpdate(this)\n                        if (callback) {\n                            ReactUpdateQueue.enqueueCallback(this, callback)\n                        }\n                    }\n\n                    /**\n                     * Deprecated APIs. These APIs used to exist on classic React classes but since\n                     * we would like to deprecate them, we're not going to move them over to this\n                     * modern base class. Instead, we define a getter that warns if it's accessed.\n                     */\n                    if (\"production\" !== \"development\") {\n                        var deprecatedAPIs = {\n                            getDOMNode: [\"getDOMNode\", \"Use React.findDOMNode(component) instead.\"],\n                            isMounted: [\n                                \"isMounted\",\n                                \"Instead, make sure to clean up subscriptions and pending requests in \" +\n                                    \"componentWillUnmount to prevent memory leaks.\"\n                            ],\n                            replaceProps: [\n                                \"replaceProps\",\n                                \"Instead call React.render again at the top level.\"\n                            ],\n                            replaceState: [\n                                \"replaceState\",\n                                \"Refactor your code to use setState instead (see \" +\n                                    \"https://github.com/facebook/react/issues/3236).\"\n                            ],\n                            setProps: [\n                                \"setProps\",\n                                \"Instead call React.render again at the top level.\"\n                            ]\n                        }\n                        var defineDeprecationWarning = function(methodName, info) {\n                            try {\n                                Object.defineProperty(ReactComponent.prototype, methodName, {\n                                    get: function() {\n                                        \"production\" !== \"development\"\n                                            ? warning(\n                                                  false,\n                                                  \"%s(...) is deprecated in plain JavaScript React classes. %s\",\n                                                  info[0],\n                                                  info[1]\n                                              )\n                                            : null\n                                        return undefined\n                                    }\n                                })\n                            } catch (x) {\n                                // IE will fail on defineProperty (es5-shim/sham too)\n                            }\n                        }\n                        for (var fnName in deprecatedAPIs) {\n                            if (deprecatedAPIs.hasOwnProperty(fnName)) {\n                                defineDeprecationWarning(fnName, deprecatedAPIs[fnName])\n                            }\n                        }\n                    }\n\n                    module.exports = ReactComponent\n                },\n                { \"150\": 150, \"171\": 171, \"99\": 99 }\n            ],\n            40: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule ReactComponentBrowserEnvironment\n                     */\n\n                    /*jslint evil: true */\n\n                    \"use strict\"\n\n                    var ReactDOMIDOperations = _dereq_(50)\n                    var ReactMount = _dereq_(77)\n\n                    /**\n                     * Abstracts away all functionality of the reconciler that requires knowledge of\n                     * the browser context. TODO: These callers should be refactored to avoid the\n                     * need for this injection.\n                     */\n                    var ReactComponentBrowserEnvironment = {\n                        processChildrenUpdates:\n                            ReactDOMIDOperations.dangerouslyProcessChildrenUpdates,\n\n                        replaceNodeWithMarkupByID:\n                            ReactDOMIDOperations.dangerouslyReplaceNodeWithMarkupByID,\n\n                        /**\n                         * If a particular environment requires that some resources be cleaned up,\n                         * specify this in the injected Mixin. In the DOM, we would likely want to\n                         * purge any cached node ID lookups.\n                         *\n                         * @private\n                         */\n                        unmountIDFromEnvironment: function(rootNodeID) {\n                            ReactMount.purgeID(rootNodeID)\n                        }\n                    }\n\n                    module.exports = ReactComponentBrowserEnvironment\n                },\n                { \"50\": 50, \"77\": 77 }\n            ],\n            41: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2014-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule ReactComponentEnvironment\n                     */\n\n                    \"use strict\"\n\n                    var invariant = _dereq_(150)\n\n                    var injected = false\n\n                    var ReactComponentEnvironment = {\n                        /**\n                         * Optionally injectable environment dependent cleanup hook. (server vs.\n                         * browser etc). Example: A browser system caches DOM nodes based on component\n                         * ID and must remove that cache entry when this instance is unmounted.\n                         */\n                        unmountIDFromEnvironment: null,\n\n                        /**\n                         * Optionally injectable hook for swapping out mount images in the middle of\n                         * the tree.\n                         */\n                        replaceNodeWithMarkupByID: null,\n\n                        /**\n                         * Optionally injectable hook for processing a queue of child updates. Will\n                         * later move into MultiChildComponents.\n                         */\n                        processChildrenUpdates: null,\n\n                        injection: {\n                            injectEnvironment: function(environment) {\n                                \"production\" !== \"development\"\n                                    ? invariant(\n                                          !injected,\n                                          \"ReactCompositeComponent: injectEnvironment() can only be called once.\"\n                                      )\n                                    : invariant(!injected)\n                                ReactComponentEnvironment.unmountIDFromEnvironment =\n                                    environment.unmountIDFromEnvironment\n                                ReactComponentEnvironment.replaceNodeWithMarkupByID =\n                                    environment.replaceNodeWithMarkupByID\n                                ReactComponentEnvironment.processChildrenUpdates =\n                                    environment.processChildrenUpdates\n                                injected = true\n                            }\n                        }\n                    }\n\n                    module.exports = ReactComponentEnvironment\n                },\n                { \"150\": 150 }\n            ],\n            42: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule ReactComponentWithPureRenderMixin\n                     */\n\n                    \"use strict\"\n\n                    var shallowEqual = _dereq_(166)\n\n                    /**\n                     * If your React component's render function is \"pure\", e.g. it will render the\n                     * same result given the same props and state, provide this Mixin for a\n                     * considerable performance boost.\n                     *\n                     * Most React components have pure render functions.\n                     *\n                     * Example:\n                     *\n                     *   var ReactComponentWithPureRenderMixin =\n                     *     require('ReactComponentWithPureRenderMixin');\n                     *   React.createClass({\n                     *     mixins: [ReactComponentWithPureRenderMixin],\n                     *\n                     *     render: function() {\n                     *       return <div className={this.props.className}>foo</div>;\n                     *     }\n                     *   });\n                     *\n                     * Note: This only checks shallow equality for props and state. If these contain\n                     * complex data structures this mixin may have false-negatives for deeper\n                     * differences. Only mixin to components which have simple props and state, or\n                     * use `forceUpdate()` when you know deep data structures have changed.\n                     */\n                    var ReactComponentWithPureRenderMixin = {\n                        shouldComponentUpdate: function(nextProps, nextState) {\n                            return (\n                                !shallowEqual(this.props, nextProps) ||\n                                !shallowEqual(this.state, nextState)\n                            )\n                        }\n                    }\n\n                    module.exports = ReactComponentWithPureRenderMixin\n                },\n                { \"166\": 166 }\n            ],\n            43: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule ReactCompositeComponent\n                     */\n\n                    \"use strict\"\n\n                    var ReactComponentEnvironment = _dereq_(41)\n                    var ReactContext = _dereq_(44)\n                    var ReactCurrentOwner = _dereq_(45)\n                    var ReactElement = _dereq_(63)\n                    var ReactElementValidator = _dereq_(64)\n                    var ReactInstanceMap = _dereq_(73)\n                    var ReactLifeCycle = _dereq_(74)\n                    var ReactNativeComponent = _dereq_(80)\n                    var ReactPerf = _dereq_(82)\n                    var ReactPropTypeLocations = _dereq_(85)\n                    var ReactPropTypeLocationNames = _dereq_(84)\n                    var ReactReconciler = _dereq_(89)\n                    var ReactUpdates = _dereq_(100)\n\n                    var assign = _dereq_(29)\n                    var emptyObject = _dereq_(130)\n                    var invariant = _dereq_(150)\n                    var shouldUpdateReactComponent = _dereq_(167)\n                    var warning = _dereq_(171)\n\n                    function getDeclarationErrorAddendum(component) {\n                        var owner = component._currentElement._owner || null\n                        if (owner) {\n                            var name = owner.getName()\n                            if (name) {\n                                return \" Check the render method of `\" + name + \"`.\"\n                            }\n                        }\n                        return \"\"\n                    }\n\n                    /**\n                     * ------------------ The Life-Cycle of a Composite Component ------------------\n                     *\n                     * - constructor: Initialization of state. The instance is now retained.\n                     *   - componentWillMount\n                     *   - render\n                     *   - [children's constructors]\n                     *     - [children's componentWillMount and render]\n                     *     - [children's componentDidMount]\n                     *     - componentDidMount\n                     *\n                     *       Update Phases:\n                     *       - componentWillReceiveProps (only called if parent updated)\n                     *       - shouldComponentUpdate\n                     *         - componentWillUpdate\n                     *           - render\n                     *           - [children's constructors or receive props phases]\n                     *         - componentDidUpdate\n                     *\n                     *     - componentWillUnmount\n                     *     - [children's componentWillUnmount]\n                     *   - [children destroyed]\n                     * - (destroyed): The instance is now blank, released by React and ready for GC.\n                     *\n                     * -----------------------------------------------------------------------------\n                     */\n\n                    /**\n                     * An incrementing ID assigned to each component when it is mounted. This is\n                     * used to enforce the order in which `ReactUpdates` updates dirty components.\n                     *\n                     * @private\n                     */\n                    var nextMountID = 1\n\n                    /**\n                     * @lends {ReactCompositeComponent.prototype}\n                     */\n                    var ReactCompositeComponentMixin = {\n                        /**\n                         * Base constructor for all composite component.\n                         *\n                         * @param {ReactElement} element\n                         * @final\n                         * @internal\n                         */\n                        construct: function(element) {\n                            this._currentElement = element\n                            this._rootNodeID = null\n                            this._instance = null\n\n                            // See ReactUpdateQueue\n                            this._pendingElement = null\n                            this._pendingStateQueue = null\n                            this._pendingReplaceState = false\n                            this._pendingForceUpdate = false\n\n                            this._renderedComponent = null\n\n                            this._context = null\n                            this._mountOrder = 0\n                            this._isTopLevel = false\n\n                            // See ReactUpdates and ReactUpdateQueue.\n                            this._pendingCallbacks = null\n                        },\n\n                        /**\n                         * Initializes the component, renders markup, and registers event listeners.\n                         *\n                         * @param {string} rootID DOM ID of the root node.\n                         * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction\n                         * @return {?string} Rendered markup to be inserted into the DOM.\n                         * @final\n                         * @internal\n                         */\n                        mountComponent: function(rootID, transaction, context) {\n                            this._context = context\n                            this._mountOrder = nextMountID++\n                            this._rootNodeID = rootID\n\n                            var publicProps = this._processProps(this._currentElement.props)\n                            var publicContext = this._processContext(this._currentElement._context)\n\n                            var Component = ReactNativeComponent.getComponentClassForElement(\n                                this._currentElement\n                            )\n\n                            // Initialize the public class\n                            var inst = new Component(publicProps, publicContext)\n\n                            if (\"production\" !== \"development\") {\n                                // This will throw later in _renderValidatedComponent, but add an early\n                                // warning now to help debugging\n                                \"production\" !== \"development\"\n                                    ? warning(\n                                          inst.render != null,\n                                          \"%s(...): No `render` method found on the returned component \" +\n                                              \"instance: you may have forgotten to define `render` in your \" +\n                                              \"component or you may have accidentally tried to render an element \" +\n                                              \"whose type is a function that isn't a React component.\",\n                                          Component.displayName || Component.name || \"Component\"\n                                      )\n                                    : null\n                            }\n\n                            // These should be set up in the constructor, but as a convenience for\n                            // simpler class abstractions, we set them up after the fact.\n                            inst.props = publicProps\n                            inst.context = publicContext\n                            inst.refs = emptyObject\n\n                            this._instance = inst\n\n                            // Store a reference from the instance back to the internal representation\n                            ReactInstanceMap.set(inst, this)\n\n                            if (\"production\" !== \"development\") {\n                                this._warnIfContextsDiffer(this._currentElement._context, context)\n                            }\n\n                            if (\"production\" !== \"development\") {\n                                // Since plain JS classes are defined without any special initialization\n                                // logic, we can not catch common errors early. Therefore, we have to\n                                // catch them here, at initialization time, instead.\n                                \"production\" !== \"development\"\n                                    ? warning(\n                                          !inst.getInitialState ||\n                                              inst.getInitialState.isReactClassApproved,\n                                          \"getInitialState was defined on %s, a plain JavaScript class. \" +\n                                              \"This is only supported for classes created using React.createClass. \" +\n                                              \"Did you mean to define a state property instead?\",\n                                          this.getName() || \"a component\"\n                                      )\n                                    : null\n                                \"production\" !== \"development\"\n                                    ? warning(\n                                          !inst.getDefaultProps ||\n                                              inst.getDefaultProps.isReactClassApproved,\n                                          \"getDefaultProps was defined on %s, a plain JavaScript class. \" +\n                                              \"This is only supported for classes created using React.createClass. \" +\n                                              \"Use a static property to define defaultProps instead.\",\n                                          this.getName() || \"a component\"\n                                      )\n                                    : null\n                                \"production\" !== \"development\"\n                                    ? warning(\n                                          !inst.propTypes,\n                                          \"propTypes was defined as an instance property on %s. Use a static \" +\n                                              \"property to define propTypes instead.\",\n                                          this.getName() || \"a component\"\n                                      )\n                                    : null\n                                \"production\" !== \"development\"\n                                    ? warning(\n                                          !inst.contextTypes,\n                                          \"contextTypes was defined as an instance property on %s. Use a \" +\n                                              \"static property to define contextTypes instead.\",\n                                          this.getName() || \"a component\"\n                                      )\n                                    : null\n                                \"production\" !== \"development\"\n                                    ? warning(\n                                          typeof inst.componentShouldUpdate !== \"function\",\n                                          \"%s has a method called \" +\n                                              \"componentShouldUpdate(). Did you mean shouldComponentUpdate()? \" +\n                                              \"The name is phrased as a question because the function is \" +\n                                              \"expected to return a value.\",\n                                          this.getName() || \"A component\"\n                                      )\n                                    : null\n                            }\n\n                            var initialState = inst.state\n                            if (initialState === undefined) {\n                                inst.state = initialState = null\n                            }\n                            \"production\" !== \"development\"\n                                ? invariant(\n                                      typeof initialState === \"object\" &&\n                                          !Array.isArray(initialState),\n                                      \"%s.state: must be set to an object or null\",\n                                      this.getName() || \"ReactCompositeComponent\"\n                                  )\n                                : invariant(\n                                      typeof initialState === \"object\" &&\n                                          !Array.isArray(initialState)\n                                  )\n\n                            this._pendingStateQueue = null\n                            this._pendingReplaceState = false\n                            this._pendingForceUpdate = false\n\n                            var childContext\n                            var renderedElement\n\n                            var previouslyMounting = ReactLifeCycle.currentlyMountingInstance\n                            ReactLifeCycle.currentlyMountingInstance = this\n                            try {\n                                if (inst.componentWillMount) {\n                                    inst.componentWillMount()\n                                    // When mounting, calls to `setState` by `componentWillMount` will set\n                                    // `this._pendingStateQueue` without triggering a re-render.\n                                    if (this._pendingStateQueue) {\n                                        inst.state = this._processPendingState(\n                                            inst.props,\n                                            inst.context\n                                        )\n                                    }\n                                }\n\n                                childContext = this._getValidatedChildContext(context)\n                                renderedElement = this._renderValidatedComponent(childContext)\n                            } finally {\n                                ReactLifeCycle.currentlyMountingInstance = previouslyMounting\n                            }\n\n                            this._renderedComponent = this._instantiateReactComponent(\n                                renderedElement,\n                                this._currentElement.type // The wrapping type\n                            )\n\n                            var markup = ReactReconciler.mountComponent(\n                                this._renderedComponent,\n                                rootID,\n                                transaction,\n                                this._mergeChildContext(context, childContext)\n                            )\n                            if (inst.componentDidMount) {\n                                transaction\n                                    .getReactMountReady()\n                                    .enqueue(inst.componentDidMount, inst)\n                            }\n\n                            return markup\n                        },\n\n                        /**\n                         * Releases any resources allocated by `mountComponent`.\n                         *\n                         * @final\n                         * @internal\n                         */\n                        unmountComponent: function() {\n                            var inst = this._instance\n\n                            if (inst.componentWillUnmount) {\n                                var previouslyUnmounting =\n                                    ReactLifeCycle.currentlyUnmountingInstance\n                                ReactLifeCycle.currentlyUnmountingInstance = this\n                                try {\n                                    inst.componentWillUnmount()\n                                } finally {\n                                    ReactLifeCycle.currentlyUnmountingInstance = previouslyUnmounting\n                                }\n                            }\n\n                            ReactReconciler.unmountComponent(this._renderedComponent)\n                            this._renderedComponent = null\n\n                            // Reset pending fields\n                            this._pendingStateQueue = null\n                            this._pendingReplaceState = false\n                            this._pendingForceUpdate = false\n                            this._pendingCallbacks = null\n                            this._pendingElement = null\n\n                            // These fields do not really need to be reset since this object is no\n                            // longer accessible.\n                            this._context = null\n                            this._rootNodeID = null\n\n                            // Delete the reference from the instance to this internal representation\n                            // which allow the internals to be properly cleaned up even if the user\n                            // leaks a reference to the public instance.\n                            ReactInstanceMap.remove(inst)\n\n                            // Some existing components rely on inst.props even after they've been\n                            // destroyed (in event handlers).\n                            // TODO: inst.props = null;\n                            // TODO: inst.state = null;\n                            // TODO: inst.context = null;\n                        },\n\n                        /**\n                         * Schedule a partial update to the props. Only used for internal testing.\n                         *\n                         * @param {object} partialProps Subset of the next props.\n                         * @param {?function} callback Called after props are updated.\n                         * @final\n                         * @internal\n                         */\n                        _setPropsInternal: function(partialProps, callback) {\n                            // This is a deoptimized path. We optimize for always having an element.\n                            // This creates an extra internal element.\n                            var element = this._pendingElement || this._currentElement\n                            this._pendingElement = ReactElement.cloneAndReplaceProps(\n                                element,\n                                assign({}, element.props, partialProps)\n                            )\n                            ReactUpdates.enqueueUpdate(this, callback)\n                        },\n\n                        /**\n                         * Filters the context object to only contain keys specified in\n                         * `contextTypes`\n                         *\n                         * @param {object} context\n                         * @return {?object}\n                         * @private\n                         */\n                        _maskContext: function(context) {\n                            var maskedContext = null\n                            // This really should be getting the component class for the element,\n                            // but we know that we're not going to need it for built-ins.\n                            if (typeof this._currentElement.type === \"string\") {\n                                return emptyObject\n                            }\n                            var contextTypes = this._currentElement.type.contextTypes\n                            if (!contextTypes) {\n                                return emptyObject\n                            }\n                            maskedContext = {}\n                            for (var contextName in contextTypes) {\n                                maskedContext[contextName] = context[contextName]\n                            }\n                            return maskedContext\n                        },\n\n                        /**\n                         * Filters the context object to only contain keys specified in\n                         * `contextTypes`, and asserts that they are valid.\n                         *\n                         * @param {object} context\n                         * @return {?object}\n                         * @private\n                         */\n                        _processContext: function(context) {\n                            var maskedContext = this._maskContext(context)\n                            if (\"production\" !== \"development\") {\n                                var Component = ReactNativeComponent.getComponentClassForElement(\n                                    this._currentElement\n                                )\n                                if (Component.contextTypes) {\n                                    this._checkPropTypes(\n                                        Component.contextTypes,\n                                        maskedContext,\n                                        ReactPropTypeLocations.context\n                                    )\n                                }\n                            }\n                            return maskedContext\n                        },\n\n                        /**\n                         * @param {object} currentContext\n                         * @return {object}\n                         * @private\n                         */\n                        _getValidatedChildContext: function(currentContext) {\n                            var inst = this._instance\n                            var childContext = inst.getChildContext && inst.getChildContext()\n                            if (childContext) {\n                                \"production\" !== \"development\"\n                                    ? invariant(\n                                          typeof inst.constructor.childContextTypes === \"object\",\n                                          \"%s.getChildContext(): childContextTypes must be defined in order to \" +\n                                              \"use getChildContext().\",\n                                          this.getName() || \"ReactCompositeComponent\"\n                                      )\n                                    : invariant(\n                                          typeof inst.constructor.childContextTypes === \"object\"\n                                      )\n                                if (\"production\" !== \"development\") {\n                                    this._checkPropTypes(\n                                        inst.constructor.childContextTypes,\n                                        childContext,\n                                        ReactPropTypeLocations.childContext\n                                    )\n                                }\n                                for (var name in childContext) {\n                                    \"production\" !== \"development\"\n                                        ? invariant(\n                                              name in inst.constructor.childContextTypes,\n                                              '%s.getChildContext(): key \"%s\" is not defined in childContextTypes.',\n                                              this.getName() || \"ReactCompositeComponent\",\n                                              name\n                                          )\n                                        : invariant(name in inst.constructor.childContextTypes)\n                                }\n                                return childContext\n                            }\n                            return null\n                        },\n\n                        _mergeChildContext: function(currentContext, childContext) {\n                            if (childContext) {\n                                return assign({}, currentContext, childContext)\n                            }\n                            return currentContext\n                        },\n\n                        /**\n                         * Processes props by setting default values for unspecified props and\n                         * asserting that the props are valid. Does not mutate its argument; returns\n                         * a new props object with defaults merged in.\n                         *\n                         * @param {object} newProps\n                         * @return {object}\n                         * @private\n                         */\n                        _processProps: function(newProps) {\n                            if (\"production\" !== \"development\") {\n                                var Component = ReactNativeComponent.getComponentClassForElement(\n                                    this._currentElement\n                                )\n                                if (Component.propTypes) {\n                                    this._checkPropTypes(\n                                        Component.propTypes,\n                                        newProps,\n                                        ReactPropTypeLocations.prop\n                                    )\n                                }\n                            }\n                            return newProps\n                        },\n\n                        /**\n                         * Assert that the props are valid\n                         *\n                         * @param {object} propTypes Map of prop name to a ReactPropType\n                         * @param {object} props\n                         * @param {string} location e.g. \"prop\", \"context\", \"child context\"\n                         * @private\n                         */\n                        _checkPropTypes: function(propTypes, props, location) {\n                            // TODO: Stop validating prop types here and only use the element\n                            // validation.\n                            var componentName = this.getName()\n                            for (var propName in propTypes) {\n                                if (propTypes.hasOwnProperty(propName)) {\n                                    var error\n                                    try {\n                                        // This is intentionally an invariant that gets caught. It's the same\n                                        // behavior as without this statement except with a better message.\n                                        \"production\" !== \"development\"\n                                            ? invariant(\n                                                  typeof propTypes[propName] === \"function\",\n                                                  \"%s: %s type `%s` is invalid; it must be a function, usually \" +\n                                                      \"from React.PropTypes.\",\n                                                  componentName || \"React class\",\n                                                  ReactPropTypeLocationNames[location],\n                                                  propName\n                                              )\n                                            : invariant(typeof propTypes[propName] === \"function\")\n                                        error = propTypes[propName](\n                                            props,\n                                            propName,\n                                            componentName,\n                                            location\n                                        )\n                                    } catch (ex) {\n                                        error = ex\n                                    }\n                                    if (error instanceof Error) {\n                                        // We may want to extend this logic for similar errors in\n                                        // React.render calls, so I'm abstracting it away into\n                                        // a function to minimize refactoring in the future\n                                        var addendum = getDeclarationErrorAddendum(this)\n\n                                        if (location === ReactPropTypeLocations.prop) {\n                                            // Preface gives us something to blacklist in warning module\n                                            \"production\" !== \"development\"\n                                                ? warning(\n                                                      false,\n                                                      \"Failed Composite propType: %s%s\",\n                                                      error.message,\n                                                      addendum\n                                                  )\n                                                : null\n                                        } else {\n                                            \"production\" !== \"development\"\n                                                ? warning(\n                                                      false,\n                                                      \"Failed Context Types: %s%s\",\n                                                      error.message,\n                                                      addendum\n                                                  )\n                                                : null\n                                        }\n                                    }\n                                }\n                            }\n                        },\n\n                        receiveComponent: function(nextElement, transaction, nextContext) {\n                            var prevElement = this._currentElement\n                            var prevContext = this._context\n\n                            this._pendingElement = null\n\n                            this.updateComponent(\n                                transaction,\n                                prevElement,\n                                nextElement,\n                                prevContext,\n                                nextContext\n                            )\n                        },\n\n                        /**\n                         * If any of `_pendingElement`, `_pendingStateQueue`, or `_pendingForceUpdate`\n                         * is set, update the component.\n                         *\n                         * @param {ReactReconcileTransaction} transaction\n                         * @internal\n                         */\n                        performUpdateIfNecessary: function(transaction) {\n                            if (this._pendingElement != null) {\n                                ReactReconciler.receiveComponent(\n                                    this,\n                                    this._pendingElement || this._currentElement,\n                                    transaction,\n                                    this._context\n                                )\n                            }\n\n                            if (this._pendingStateQueue !== null || this._pendingForceUpdate) {\n                                if (\"production\" !== \"development\") {\n                                    ReactElementValidator.checkAndWarnForMutatedProps(\n                                        this._currentElement\n                                    )\n                                }\n\n                                this.updateComponent(\n                                    transaction,\n                                    this._currentElement,\n                                    this._currentElement,\n                                    this._context,\n                                    this._context\n                                )\n                            }\n                        },\n\n                        /**\n                         * Compare two contexts, warning if they are different\n                         * TODO: Remove this check when owner-context is removed\n                         */\n                        _warnIfContextsDiffer: function(ownerBasedContext, parentBasedContext) {\n                            ownerBasedContext = this._maskContext(ownerBasedContext)\n                            parentBasedContext = this._maskContext(parentBasedContext)\n                            var parentKeys = Object.keys(parentBasedContext).sort()\n                            var displayName = this.getName() || \"ReactCompositeComponent\"\n                            for (var i = 0; i < parentKeys.length; i++) {\n                                var key = parentKeys[i]\n                                \"production\" !== \"development\"\n                                    ? warning(\n                                          ownerBasedContext[key] === parentBasedContext[key],\n                                          \"owner-based and parent-based contexts differ \" +\n                                              \"(values: `%s` vs `%s`) for key (%s) while mounting %s \" +\n                                              \"(see: http://fb.me/react-context-by-parent)\",\n                                          ownerBasedContext[key],\n                                          parentBasedContext[key],\n                                          key,\n                                          displayName\n                                      )\n                                    : null\n                            }\n                        },\n\n                        /**\n                         * Perform an update to a mounted component. The componentWillReceiveProps and\n                         * shouldComponentUpdate methods are called, then (assuming the update isn't\n                         * skipped) the remaining update lifecycle methods are called and the DOM\n                         * representation is updated.\n                         *\n                         * By default, this implements React's rendering and reconciliation algorithm.\n                         * Sophisticated clients may wish to override this.\n                         *\n                         * @param {ReactReconcileTransaction} transaction\n                         * @param {ReactElement} prevParentElement\n                         * @param {ReactElement} nextParentElement\n                         * @internal\n                         * @overridable\n                         */\n                        updateComponent: function(\n                            transaction,\n                            prevParentElement,\n                            nextParentElement,\n                            prevUnmaskedContext,\n                            nextUnmaskedContext\n                        ) {\n                            var inst = this._instance\n\n                            var nextContext = inst.context\n                            var nextProps = inst.props\n\n                            // Distinguish between a props update versus a simple state update\n                            if (prevParentElement !== nextParentElement) {\n                                nextContext = this._processContext(nextParentElement._context)\n                                nextProps = this._processProps(nextParentElement.props)\n\n                                if (\"production\" !== \"development\") {\n                                    if (nextUnmaskedContext != null) {\n                                        this._warnIfContextsDiffer(\n                                            nextParentElement._context,\n                                            nextUnmaskedContext\n                                        )\n                                    }\n                                }\n\n                                // An update here will schedule an update but immediately set\n                                // _pendingStateQueue which will ensure that any state updates gets\n                                // immediately reconciled instead of waiting for the next batch.\n\n                                if (inst.componentWillReceiveProps) {\n                                    inst.componentWillReceiveProps(nextProps, nextContext)\n                                }\n                            }\n\n                            var nextState = this._processPendingState(nextProps, nextContext)\n\n                            var shouldUpdate =\n                                this._pendingForceUpdate ||\n                                !inst.shouldComponentUpdate ||\n                                inst.shouldComponentUpdate(nextProps, nextState, nextContext)\n\n                            if (\"production\" !== \"development\") {\n                                \"production\" !== \"development\"\n                                    ? warning(\n                                          typeof shouldUpdate !== \"undefined\",\n                                          \"%s.shouldComponentUpdate(): Returned undefined instead of a \" +\n                                              \"boolean value. Make sure to return true or false.\",\n                                          this.getName() || \"ReactCompositeComponent\"\n                                      )\n                                    : null\n                            }\n\n                            if (shouldUpdate) {\n                                this._pendingForceUpdate = false\n                                // Will set `this.props`, `this.state` and `this.context`.\n                                this._performComponentUpdate(\n                                    nextParentElement,\n                                    nextProps,\n                                    nextState,\n                                    nextContext,\n                                    transaction,\n                                    nextUnmaskedContext\n                                )\n                            } else {\n                                // If it's determined that a component should not update, we still want\n                                // to set props and state but we shortcut the rest of the update.\n                                this._currentElement = nextParentElement\n                                this._context = nextUnmaskedContext\n                                inst.props = nextProps\n                                inst.state = nextState\n                                inst.context = nextContext\n                            }\n                        },\n\n                        _processPendingState: function(props, context) {\n                            var inst = this._instance\n                            var queue = this._pendingStateQueue\n                            var replace = this._pendingReplaceState\n                            this._pendingReplaceState = false\n                            this._pendingStateQueue = null\n\n                            if (!queue) {\n                                return inst.state\n                            }\n\n                            if (replace && queue.length === 1) {\n                                return queue[0]\n                            }\n\n                            var nextState = assign({}, replace ? queue[0] : inst.state)\n                            for (var i = replace ? 1 : 0; i < queue.length; i++) {\n                                var partial = queue[i]\n                                assign(\n                                    nextState,\n                                    typeof partial === \"function\"\n                                        ? partial.call(inst, nextState, props, context)\n                                        : partial\n                                )\n                            }\n\n                            return nextState\n                        },\n\n                        /**\n                         * Merges new props and state, notifies delegate methods of update and\n                         * performs update.\n                         *\n                         * @param {ReactElement} nextElement Next element\n                         * @param {object} nextProps Next public object to set as properties.\n                         * @param {?object} nextState Next object to set as state.\n                         * @param {?object} nextContext Next public object to set as context.\n                         * @param {ReactReconcileTransaction} transaction\n                         * @param {?object} unmaskedContext\n                         * @private\n                         */\n                        _performComponentUpdate: function(\n                            nextElement,\n                            nextProps,\n                            nextState,\n                            nextContext,\n                            transaction,\n                            unmaskedContext\n                        ) {\n                            var inst = this._instance\n\n                            var prevProps = inst.props\n                            var prevState = inst.state\n                            var prevContext = inst.context\n\n                            if (inst.componentWillUpdate) {\n                                inst.componentWillUpdate(nextProps, nextState, nextContext)\n                            }\n\n                            this._currentElement = nextElement\n                            this._context = unmaskedContext\n                            inst.props = nextProps\n                            inst.state = nextState\n                            inst.context = nextContext\n\n                            this._updateRenderedComponent(transaction, unmaskedContext)\n\n                            if (inst.componentDidUpdate) {\n                                transaction\n                                    .getReactMountReady()\n                                    .enqueue(\n                                        inst.componentDidUpdate.bind(\n                                            inst,\n                                            prevProps,\n                                            prevState,\n                                            prevContext\n                                        ),\n                                        inst\n                                    )\n                            }\n                        },\n\n                        /**\n                         * Call the component's `render` method and update the DOM accordingly.\n                         *\n                         * @param {ReactReconcileTransaction} transaction\n                         * @internal\n                         */\n                        _updateRenderedComponent: function(transaction, context) {\n                            var prevComponentInstance = this._renderedComponent\n                            var prevRenderedElement = prevComponentInstance._currentElement\n                            var childContext = this._getValidatedChildContext()\n                            var nextRenderedElement = this._renderValidatedComponent(childContext)\n                            if (\n                                shouldUpdateReactComponent(prevRenderedElement, nextRenderedElement)\n                            ) {\n                                ReactReconciler.receiveComponent(\n                                    prevComponentInstance,\n                                    nextRenderedElement,\n                                    transaction,\n                                    this._mergeChildContext(context, childContext)\n                                )\n                            } else {\n                                // These two IDs are actually the same! But nothing should rely on that.\n                                var thisID = this._rootNodeID\n                                var prevComponentID = prevComponentInstance._rootNodeID\n                                ReactReconciler.unmountComponent(prevComponentInstance)\n\n                                this._renderedComponent = this._instantiateReactComponent(\n                                    nextRenderedElement,\n                                    this._currentElement.type\n                                )\n                                var nextMarkup = ReactReconciler.mountComponent(\n                                    this._renderedComponent,\n                                    thisID,\n                                    transaction,\n                                    this._mergeChildContext(context, childContext)\n                                )\n                                this._replaceNodeWithMarkupByID(prevComponentID, nextMarkup)\n                            }\n                        },\n\n                        /**\n                         * @protected\n                         */\n                        _replaceNodeWithMarkupByID: function(prevComponentID, nextMarkup) {\n                            ReactComponentEnvironment.replaceNodeWithMarkupByID(\n                                prevComponentID,\n                                nextMarkup\n                            )\n                        },\n\n                        /**\n                         * @protected\n                         */\n                        _renderValidatedComponentWithoutOwnerOrContext: function() {\n                            var inst = this._instance\n                            var renderedComponent = inst.render()\n                            if (\"production\" !== \"development\") {\n                                // We allow auto-mocks to proceed as if they're returning null.\n                                if (\n                                    typeof renderedComponent === \"undefined\" &&\n                                    inst.render._isMockFunction\n                                ) {\n                                    // This is probably bad practice. Consider warning here and\n                                    // deprecating this convenience.\n                                    renderedComponent = null\n                                }\n                            }\n\n                            return renderedComponent\n                        },\n\n                        /**\n                         * @private\n                         */\n                        _renderValidatedComponent: function(childContext) {\n                            var renderedComponent\n                            var previousContext = ReactContext.current\n                            ReactContext.current = this._mergeChildContext(\n                                this._currentElement._context,\n                                childContext\n                            )\n                            ReactCurrentOwner.current = this\n                            try {\n                                renderedComponent = this._renderValidatedComponentWithoutOwnerOrContext()\n                            } finally {\n                                ReactContext.current = previousContext\n                                ReactCurrentOwner.current = null\n                            }\n                            \"production\" !== \"development\"\n                                ? invariant(\n                                      // TODO: An `isValidNode` function would probably be more appropriate\n                                      renderedComponent === null ||\n                                          renderedComponent === false ||\n                                          ReactElement.isValidElement(renderedComponent),\n                                      \"%s.render(): A valid ReactComponent must be returned. You may have \" +\n                                          \"returned undefined, an array or some other invalid object.\",\n                                      this.getName() || \"ReactCompositeComponent\"\n                                  )\n                                : invariant(\n                                      // TODO: An `isValidNode` function would probably be more appropriate\n                                      renderedComponent === null ||\n                                          renderedComponent === false ||\n                                          ReactElement.isValidElement(renderedComponent)\n                                  )\n                            return renderedComponent\n                        },\n\n                        /**\n                         * Lazily allocates the refs object and stores `component` as `ref`.\n                         *\n                         * @param {string} ref Reference name.\n                         * @param {component} component Component to store as `ref`.\n                         * @final\n                         * @private\n                         */\n                        attachRef: function(ref, component) {\n                            var inst = this.getPublicInstance()\n                            var refs = inst.refs === emptyObject ? (inst.refs = {}) : inst.refs\n                            refs[ref] = component.getPublicInstance()\n                        },\n\n                        /**\n                         * Detaches a reference name.\n                         *\n                         * @param {string} ref Name to dereference.\n                         * @final\n                         * @private\n                         */\n                        detachRef: function(ref) {\n                            var refs = this.getPublicInstance().refs\n                            delete refs[ref]\n                        },\n\n                        /**\n                         * Get a text description of the component that can be used to identify it\n                         * in error messages.\n                         * @return {string} The name or null.\n                         * @internal\n                         */\n                        getName: function() {\n                            var type = this._currentElement.type\n                            var constructor = this._instance && this._instance.constructor\n                            return (\n                                type.displayName ||\n                                (constructor && constructor.displayName) ||\n                                type.name ||\n                                (constructor && constructor.name) ||\n                                null\n                            )\n                        },\n\n                        /**\n                         * Get the publicly accessible representation of this component - i.e. what\n                         * is exposed by refs and returned by React.render. Can be null for stateless\n                         * components.\n                         *\n                         * @return {ReactComponent} the public component instance.\n                         * @internal\n                         */\n                        getPublicInstance: function() {\n                            return this._instance\n                        },\n\n                        // Stub\n                        _instantiateReactComponent: null\n                    }\n\n                    ReactPerf.measureMethods(\n                        ReactCompositeComponentMixin,\n                        \"ReactCompositeComponent\",\n                        {\n                            mountComponent: \"mountComponent\",\n                            updateComponent: \"updateComponent\",\n                            _renderValidatedComponent: \"_renderValidatedComponent\"\n                        }\n                    )\n\n                    var ReactCompositeComponent = {\n                        Mixin: ReactCompositeComponentMixin\n                    }\n\n                    module.exports = ReactCompositeComponent\n                },\n                {\n                    \"100\": 100,\n                    \"130\": 130,\n                    \"150\": 150,\n                    \"167\": 167,\n                    \"171\": 171,\n                    \"29\": 29,\n                    \"41\": 41,\n                    \"44\": 44,\n                    \"45\": 45,\n                    \"63\": 63,\n                    \"64\": 64,\n                    \"73\": 73,\n                    \"74\": 74,\n                    \"80\": 80,\n                    \"82\": 82,\n                    \"84\": 84,\n                    \"85\": 85,\n                    \"89\": 89\n                }\n            ],\n            44: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule ReactContext\n                     */\n\n                    \"use strict\"\n\n                    var assign = _dereq_(29)\n                    var emptyObject = _dereq_(130)\n                    var warning = _dereq_(171)\n\n                    var didWarn = false\n\n                    /**\n                     * Keeps track of the current context.\n                     *\n                     * The context is automatically passed down the component ownership hierarchy\n                     * and is accessible via `this.context` on ReactCompositeComponents.\n                     */\n                    var ReactContext = {\n                        /**\n                         * @internal\n                         * @type {object}\n                         */\n                        current: emptyObject,\n\n                        /**\n                         * Temporarily extends the current context while executing scopedCallback.\n                         *\n                         * A typical use case might look like\n                         *\n                         *  render: function() {\n                         *    var children = ReactContext.withContext({foo: 'foo'}, () => (\n                         *\n                         *    ));\n                         *    return <div>{children}</div>;\n                         *  }\n                         *\n                         * @param {object} newContext New context to merge into the existing context\n                         * @param {function} scopedCallback Callback to run with the new context\n                         * @return {ReactComponent|array<ReactComponent>}\n                         */\n                        withContext: function(newContext, scopedCallback) {\n                            if (\"production\" !== \"development\") {\n                                \"production\" !== \"development\"\n                                    ? warning(\n                                          didWarn,\n                                          \"withContext is deprecated and will be removed in a future version. \" +\n                                              \"Use a wrapper component with getChildContext instead.\"\n                                      )\n                                    : null\n\n                                didWarn = true\n                            }\n\n                            var result\n                            var previousContext = ReactContext.current\n                            ReactContext.current = assign({}, previousContext, newContext)\n                            try {\n                                result = scopedCallback()\n                            } finally {\n                                ReactContext.current = previousContext\n                            }\n                            return result\n                        }\n                    }\n\n                    module.exports = ReactContext\n                },\n                { \"130\": 130, \"171\": 171, \"29\": 29 }\n            ],\n            45: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule ReactCurrentOwner\n                     */\n\n                    \"use strict\"\n\n                    /**\n                     * Keeps track of the current owner.\n                     *\n                     * The current owner is the component who should own any components that are\n                     * currently being constructed.\n                     *\n                     * The depth indicate how many composite components are above this render level.\n                     */\n                    var ReactCurrentOwner = {\n                        /**\n                         * @internal\n                         * @type {ReactComponent}\n                         */\n                        current: null\n                    }\n\n                    module.exports = ReactCurrentOwner\n                },\n                {}\n            ],\n            46: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule ReactDOM\n                     * @typechecks static-only\n                     */\n\n                    \"use strict\"\n\n                    var ReactElement = _dereq_(63)\n                    var ReactElementValidator = _dereq_(64)\n\n                    var mapObject = _dereq_(158)\n\n                    /**\n                     * Create a factory that creates HTML tag elements.\n                     *\n                     * @param {string} tag Tag name (e.g. `div`).\n                     * @private\n                     */\n                    function createDOMFactory(tag) {\n                        if (\"production\" !== \"development\") {\n                            return ReactElementValidator.createFactory(tag)\n                        }\n                        return ReactElement.createFactory(tag)\n                    }\n\n                    /**\n                     * Creates a mapping from supported HTML tags to `ReactDOMComponent` classes.\n                     * This is also accessible via `React.DOM`.\n                     *\n                     * @public\n                     */\n                    var ReactDOM = mapObject(\n                        {\n                            a: \"a\",\n                            abbr: \"abbr\",\n                            address: \"address\",\n                            area: \"area\",\n                            article: \"article\",\n                            aside: \"aside\",\n                            audio: \"audio\",\n                            b: \"b\",\n                            base: \"base\",\n                            bdi: \"bdi\",\n                            bdo: \"bdo\",\n                            big: \"big\",\n                            blockquote: \"blockquote\",\n                            body: \"body\",\n                            br: \"br\",\n                            button: \"button\",\n                            canvas: \"canvas\",\n                            caption: \"caption\",\n                            cite: \"cite\",\n                            code: \"code\",\n                            col: \"col\",\n                            colgroup: \"colgroup\",\n                            data: \"data\",\n                            datalist: \"datalist\",\n                            dd: \"dd\",\n                            del: \"del\",\n                            details: \"details\",\n                            dfn: \"dfn\",\n                            dialog: \"dialog\",\n                            div: \"div\",\n                            dl: \"dl\",\n                            dt: \"dt\",\n                            em: \"em\",\n                            embed: \"embed\",\n                            fieldset: \"fieldset\",\n                            figcaption: \"figcaption\",\n                            figure: \"figure\",\n                            footer: \"footer\",\n                            form: \"form\",\n                            h1: \"h1\",\n                            h2: \"h2\",\n                            h3: \"h3\",\n                            h4: \"h4\",\n                            h5: \"h5\",\n                            h6: \"h6\",\n                            head: \"head\",\n                            header: \"header\",\n                            hr: \"hr\",\n                            html: \"html\",\n                            i: \"i\",\n                            iframe: \"iframe\",\n                            img: \"img\",\n                            input: \"input\",\n                            ins: \"ins\",\n                            kbd: \"kbd\",\n                            keygen: \"keygen\",\n                            label: \"label\",\n                            legend: \"legend\",\n                            li: \"li\",\n                            link: \"link\",\n                            main: \"main\",\n                            map: \"map\",\n                            mark: \"mark\",\n                            menu: \"menu\",\n                            menuitem: \"menuitem\",\n                            meta: \"meta\",\n                            meter: \"meter\",\n                            nav: \"nav\",\n                            noscript: \"noscript\",\n                            object: \"object\",\n                            ol: \"ol\",\n                            optgroup: \"optgroup\",\n                            option: \"option\",\n                            output: \"output\",\n                            p: \"p\",\n                            param: \"param\",\n                            picture: \"picture\",\n                            pre: \"pre\",\n                            progress: \"progress\",\n                            q: \"q\",\n                            rp: \"rp\",\n                            rt: \"rt\",\n                            ruby: \"ruby\",\n                            s: \"s\",\n                            samp: \"samp\",\n                            script: \"script\",\n                            section: \"section\",\n                            select: \"select\",\n                            small: \"small\",\n                            source: \"source\",\n                            span: \"span\",\n                            strong: \"strong\",\n                            style: \"style\",\n                            sub: \"sub\",\n                            summary: \"summary\",\n                            sup: \"sup\",\n                            table: \"table\",\n                            tbody: \"tbody\",\n                            td: \"td\",\n                            textarea: \"textarea\",\n                            tfoot: \"tfoot\",\n                            th: \"th\",\n                            thead: \"thead\",\n                            time: \"time\",\n                            title: \"title\",\n                            tr: \"tr\",\n                            track: \"track\",\n                            u: \"u\",\n                            ul: \"ul\",\n                            var: \"var\",\n                            video: \"video\",\n                            wbr: \"wbr\",\n\n                            // SVG\n                            circle: \"circle\",\n                            clipPath: \"clipPath\",\n                            defs: \"defs\",\n                            ellipse: \"ellipse\",\n                            g: \"g\",\n                            line: \"line\",\n                            linearGradient: \"linearGradient\",\n                            mask: \"mask\",\n                            path: \"path\",\n                            pattern: \"pattern\",\n                            polygon: \"polygon\",\n                            polyline: \"polyline\",\n                            radialGradient: \"radialGradient\",\n                            rect: \"rect\",\n                            stop: \"stop\",\n                            svg: \"svg\",\n                            text: \"text\",\n                            tspan: \"tspan\"\n                        },\n                        createDOMFactory\n                    )\n\n                    module.exports = ReactDOM\n                },\n                { \"158\": 158, \"63\": 63, \"64\": 64 }\n            ],\n            47: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule ReactDOMButton\n                     */\n\n                    \"use strict\"\n\n                    var AutoFocusMixin = _dereq_(2)\n                    var ReactBrowserComponentMixin = _dereq_(32)\n                    var ReactClass = _dereq_(38)\n                    var ReactElement = _dereq_(63)\n\n                    var keyMirror = _dereq_(156)\n\n                    var button = ReactElement.createFactory(\"button\")\n\n                    var mouseListenerNames = keyMirror({\n                        onClick: true,\n                        onDoubleClick: true,\n                        onMouseDown: true,\n                        onMouseMove: true,\n                        onMouseUp: true,\n                        onClickCapture: true,\n                        onDoubleClickCapture: true,\n                        onMouseDownCapture: true,\n                        onMouseMoveCapture: true,\n                        onMouseUpCapture: true\n                    })\n\n                    /**\n                     * Implements a <button> native component that does not receive mouse events\n                     * when `disabled` is set.\n                     */\n                    var ReactDOMButton = ReactClass.createClass({\n                        displayName: \"ReactDOMButton\",\n                        tagName: \"BUTTON\",\n\n                        mixins: [AutoFocusMixin, ReactBrowserComponentMixin],\n\n                        render: function() {\n                            var props = {}\n\n                            // Copy the props; except the mouse listeners if we're disabled\n                            for (var key in this.props) {\n                                if (\n                                    this.props.hasOwnProperty(key) &&\n                                    (!this.props.disabled || !mouseListenerNames[key])\n                                ) {\n                                    props[key] = this.props[key]\n                                }\n                            }\n\n                            return button(props, this.props.children)\n                        }\n                    })\n\n                    module.exports = ReactDOMButton\n                },\n                { \"156\": 156, \"2\": 2, \"32\": 32, \"38\": 38, \"63\": 63 }\n            ],\n            48: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule ReactDOMComponent\n                     * @typechecks static-only\n                     */\n\n                    /* global hasOwnProperty:true */\n\n                    \"use strict\"\n\n                    var CSSPropertyOperations = _dereq_(6)\n                    var DOMProperty = _dereq_(11)\n                    var DOMPropertyOperations = _dereq_(12)\n                    var ReactBrowserEventEmitter = _dereq_(33)\n                    var ReactComponentBrowserEnvironment = _dereq_(40)\n                    var ReactMount = _dereq_(77)\n                    var ReactMultiChild = _dereq_(78)\n                    var ReactPerf = _dereq_(82)\n\n                    var assign = _dereq_(29)\n                    var escapeTextContentForBrowser = _dereq_(131)\n                    var invariant = _dereq_(150)\n                    var isEventSupported = _dereq_(151)\n                    var keyOf = _dereq_(157)\n                    var warning = _dereq_(171)\n\n                    var deleteListener = ReactBrowserEventEmitter.deleteListener\n                    var listenTo = ReactBrowserEventEmitter.listenTo\n                    var registrationNameModules = ReactBrowserEventEmitter.registrationNameModules\n\n                    // For quickly matching children type, to test if can be treated as content.\n                    var CONTENT_TYPES = { string: true, number: true }\n\n                    var STYLE = keyOf({ style: null })\n\n                    var ELEMENT_NODE_TYPE = 1\n\n                    /**\n                     * Optionally injectable operations for mutating the DOM\n                     */\n                    var BackendIDOperations = null\n\n                    /**\n                     * @param {?object} props\n                     */\n                    function assertValidProps(props) {\n                        if (!props) {\n                            return\n                        }\n                        // Note the use of `==` which checks for null or undefined.\n                        if (props.dangerouslySetInnerHTML != null) {\n                            \"production\" !== \"development\"\n                                ? invariant(\n                                      props.children == null,\n                                      \"Can only set one of `children` or `props.dangerouslySetInnerHTML`.\"\n                                  )\n                                : invariant(props.children == null)\n                            \"production\" !== \"development\"\n                                ? invariant(\n                                      typeof props.dangerouslySetInnerHTML === \"object\" &&\n                                          \"__html\" in props.dangerouslySetInnerHTML,\n                                      \"`props.dangerouslySetInnerHTML` must be in the form `{__html: ...}`. \" +\n                                          \"Please visit https://fb.me/react-invariant-dangerously-set-inner-html \" +\n                                          \"for more information.\"\n                                  )\n                                : invariant(\n                                      typeof props.dangerouslySetInnerHTML === \"object\" &&\n                                          \"__html\" in props.dangerouslySetInnerHTML\n                                  )\n                        }\n                        if (\"production\" !== \"development\") {\n                            \"production\" !== \"development\"\n                                ? warning(\n                                      props.innerHTML == null,\n                                      \"Directly setting property `innerHTML` is not permitted. \" +\n                                          \"For more information, lookup documentation on `dangerouslySetInnerHTML`.\"\n                                  )\n                                : null\n                            \"production\" !== \"development\"\n                                ? warning(\n                                      !props.contentEditable || props.children == null,\n                                      \"A component is `contentEditable` and contains `children` managed by \" +\n                                          \"React. It is now your responsibility to guarantee that none of \" +\n                                          \"those nodes are unexpectedly modified or duplicated. This is \" +\n                                          \"probably not intentional.\"\n                                  )\n                                : null\n                        }\n                        \"production\" !== \"development\"\n                            ? invariant(\n                                  props.style == null || typeof props.style === \"object\",\n                                  \"The `style` prop expects a mapping from style properties to values, \" +\n                                      \"not a string. For example, style={{marginRight: spacing + 'em'}} when \" +\n                                      \"using JSX.\"\n                              )\n                            : invariant(props.style == null || typeof props.style === \"object\")\n                    }\n\n                    function putListener(id, registrationName, listener, transaction) {\n                        if (\"production\" !== \"development\") {\n                            // IE8 has no API for event capturing and the `onScroll` event doesn't\n                            // bubble.\n                            \"production\" !== \"development\"\n                                ? warning(\n                                      registrationName !== \"onScroll\" ||\n                                          isEventSupported(\"scroll\", true),\n                                      \"This browser doesn't support the `onScroll` event\"\n                                  )\n                                : null\n                        }\n                        var container = ReactMount.findReactContainerForID(id)\n                        if (container) {\n                            var doc =\n                                container.nodeType === ELEMENT_NODE_TYPE\n                                    ? container.ownerDocument\n                                    : container\n                            listenTo(registrationName, doc)\n                        }\n                        transaction\n                            .getPutListenerQueue()\n                            .enqueuePutListener(id, registrationName, listener)\n                    }\n\n                    // For HTML, certain tags should omit their close tag. We keep a whitelist for\n                    // those special cased tags.\n\n                    var omittedCloseTags = {\n                        area: true,\n                        base: true,\n                        br: true,\n                        col: true,\n                        embed: true,\n                        hr: true,\n                        img: true,\n                        input: true,\n                        keygen: true,\n                        link: true,\n                        meta: true,\n                        param: true,\n                        source: true,\n                        track: true,\n                        wbr: true\n                        // NOTE: menuitem's close tag should be omitted, but that causes problems.\n                    }\n\n                    // We accept any tag to be rendered but since this gets injected into abitrary\n                    // HTML, we want to make sure that it's a safe tag.\n                    // http://www.w3.org/TR/REC-xml/#NT-Name\n\n                    var VALID_TAG_REGEX = /^[a-zA-Z][a-zA-Z:_\\.\\-\\d]*$/ // Simplified subset\n                    var validatedTagCache = {}\n                    var hasOwnProperty = {}.hasOwnProperty\n\n                    function validateDangerousTag(tag) {\n                        if (!hasOwnProperty.call(validatedTagCache, tag)) {\n                            \"production\" !== \"development\"\n                                ? invariant(VALID_TAG_REGEX.test(tag), \"Invalid tag: %s\", tag)\n                                : invariant(VALID_TAG_REGEX.test(tag))\n                            validatedTagCache[tag] = true\n                        }\n                    }\n\n                    /**\n                     * Creates a new React class that is idempotent and capable of containing other\n                     * React components. It accepts event listeners and DOM properties that are\n                     * valid according to `DOMProperty`.\n                     *\n                     *  - Event listeners: `onClick`, `onMouseDown`, etc.\n                     *  - DOM properties: `className`, `name`, `title`, etc.\n                     *\n                     * The `style` property functions differently from the DOM API. It accepts an\n                     * object mapping of style properties to values.\n                     *\n                     * @constructor ReactDOMComponent\n                     * @extends ReactMultiChild\n                     */\n                    function ReactDOMComponent(tag) {\n                        validateDangerousTag(tag)\n                        this._tag = tag\n                        this._renderedChildren = null\n                        this._previousStyleCopy = null\n                        this._rootNodeID = null\n                    }\n\n                    ReactDOMComponent.displayName = \"ReactDOMComponent\"\n\n                    ReactDOMComponent.Mixin = {\n                        construct: function(element) {\n                            this._currentElement = element\n                        },\n\n                        /**\n                         * Generates root tag markup then recurses. This method has side effects and\n                         * is not idempotent.\n                         *\n                         * @internal\n                         * @param {string} rootID The root DOM ID for this node.\n                         * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction\n                         * @return {string} The computed markup.\n                         */\n                        mountComponent: function(rootID, transaction, context) {\n                            this._rootNodeID = rootID\n                            assertValidProps(this._currentElement.props)\n                            var closeTag = omittedCloseTags[this._tag] ? \"\" : \"</\" + this._tag + \">\"\n                            return (\n                                this._createOpenTagMarkupAndPutListeners(transaction) +\n                                this._createContentMarkup(transaction, context) +\n                                closeTag\n                            )\n                        },\n\n                        /**\n                         * Creates markup for the open tag and all attributes.\n                         *\n                         * This method has side effects because events get registered.\n                         *\n                         * Iterating over object properties is faster than iterating over arrays.\n                         * @see http://jsperf.com/obj-vs-arr-iteration\n                         *\n                         * @private\n                         * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction\n                         * @return {string} Markup of opening tag.\n                         */\n                        _createOpenTagMarkupAndPutListeners: function(transaction) {\n                            var props = this._currentElement.props\n                            var ret = \"<\" + this._tag\n\n                            for (var propKey in props) {\n                                if (!props.hasOwnProperty(propKey)) {\n                                    continue\n                                }\n                                var propValue = props[propKey]\n                                if (propValue == null) {\n                                    continue\n                                }\n                                if (registrationNameModules.hasOwnProperty(propKey)) {\n                                    putListener(this._rootNodeID, propKey, propValue, transaction)\n                                } else {\n                                    if (propKey === STYLE) {\n                                        if (propValue) {\n                                            propValue = this._previousStyleCopy = assign(\n                                                {},\n                                                props.style\n                                            )\n                                        }\n                                        propValue = CSSPropertyOperations.createMarkupForStyles(\n                                            propValue\n                                        )\n                                    }\n                                    var markup = DOMPropertyOperations.createMarkupForProperty(\n                                        propKey,\n                                        propValue\n                                    )\n                                    if (markup) {\n                                        ret += \" \" + markup\n                                    }\n                                }\n                            }\n\n                            // For static pages, no need to put React ID and checksum. Saves lots of\n                            // bytes.\n                            if (transaction.renderToStaticMarkup) {\n                                return ret + \">\"\n                            }\n\n                            var markupForID = DOMPropertyOperations.createMarkupForID(\n                                this._rootNodeID\n                            )\n                            return ret + \" \" + markupForID + \">\"\n                        },\n\n                        /**\n                         * Creates markup for the content between the tags.\n                         *\n                         * @private\n                         * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction\n                         * @param {object} context\n                         * @return {string} Content markup.\n                         */\n                        _createContentMarkup: function(transaction, context) {\n                            var prefix = \"\"\n                            if (\n                                this._tag === \"listing\" ||\n                                this._tag === \"pre\" ||\n                                this._tag === \"textarea\"\n                            ) {\n                                // Add an initial newline because browsers ignore the first newline in\n                                // a <listing>, <pre>, or <textarea> as an \"authoring convenience\" -- see\n                                // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inbody.\n                                prefix = \"\\n\"\n                            }\n\n                            var props = this._currentElement.props\n\n                            // Intentional use of != to avoid catching zero/false.\n                            var innerHTML = props.dangerouslySetInnerHTML\n                            if (innerHTML != null) {\n                                if (innerHTML.__html != null) {\n                                    return prefix + innerHTML.__html\n                                }\n                            } else {\n                                var contentToUse = CONTENT_TYPES[typeof props.children]\n                                    ? props.children\n                                    : null\n                                var childrenToUse = contentToUse != null ? null : props.children\n                                if (contentToUse != null) {\n                                    return prefix + escapeTextContentForBrowser(contentToUse)\n                                } else if (childrenToUse != null) {\n                                    var mountImages = this.mountChildren(\n                                        childrenToUse,\n                                        transaction,\n                                        context\n                                    )\n                                    return prefix + mountImages.join(\"\")\n                                }\n                            }\n                            return prefix\n                        },\n\n                        receiveComponent: function(nextElement, transaction, context) {\n                            var prevElement = this._currentElement\n                            this._currentElement = nextElement\n                            this.updateComponent(transaction, prevElement, nextElement, context)\n                        },\n\n                        /**\n                         * Updates a native DOM component after it has already been allocated and\n                         * attached to the DOM. Reconciles the root DOM node, then recurses.\n                         *\n                         * @param {ReactReconcileTransaction} transaction\n                         * @param {ReactElement} prevElement\n                         * @param {ReactElement} nextElement\n                         * @internal\n                         * @overridable\n                         */\n                        updateComponent: function(transaction, prevElement, nextElement, context) {\n                            assertValidProps(this._currentElement.props)\n                            this._updateDOMProperties(prevElement.props, transaction)\n                            this._updateDOMChildren(prevElement.props, transaction, context)\n                        },\n\n                        /**\n                         * Reconciles the properties by detecting differences in property values and\n                         * updating the DOM as necessary. This function is probably the single most\n                         * critical path for performance optimization.\n                         *\n                         * TODO: Benchmark whether checking for changed values in memory actually\n                         *       improves performance (especially statically positioned elements).\n                         * TODO: Benchmark the effects of putting this at the top since 99% of props\n                         *       do not change for a given reconciliation.\n                         * TODO: Benchmark areas that can be improved with caching.\n                         *\n                         * @private\n                         * @param {object} lastProps\n                         * @param {ReactReconcileTransaction} transaction\n                         */\n                        _updateDOMProperties: function(lastProps, transaction) {\n                            var nextProps = this._currentElement.props\n                            var propKey\n                            var styleName\n                            var styleUpdates\n                            for (propKey in lastProps) {\n                                if (\n                                    nextProps.hasOwnProperty(propKey) ||\n                                    !lastProps.hasOwnProperty(propKey)\n                                ) {\n                                    continue\n                                }\n                                if (propKey === STYLE) {\n                                    var lastStyle = this._previousStyleCopy\n                                    for (styleName in lastStyle) {\n                                        if (lastStyle.hasOwnProperty(styleName)) {\n                                            styleUpdates = styleUpdates || {}\n                                            styleUpdates[styleName] = \"\"\n                                        }\n                                    }\n                                    this._previousStyleCopy = null\n                                } else if (registrationNameModules.hasOwnProperty(propKey)) {\n                                    deleteListener(this._rootNodeID, propKey)\n                                } else if (\n                                    DOMProperty.isStandardName[propKey] ||\n                                    DOMProperty.isCustomAttribute(propKey)\n                                ) {\n                                    BackendIDOperations.deletePropertyByID(\n                                        this._rootNodeID,\n                                        propKey\n                                    )\n                                }\n                            }\n                            for (propKey in nextProps) {\n                                var nextProp = nextProps[propKey]\n                                var lastProp =\n                                    propKey === STYLE ? this._previousStyleCopy : lastProps[propKey]\n                                if (!nextProps.hasOwnProperty(propKey) || nextProp === lastProp) {\n                                    continue\n                                }\n                                if (propKey === STYLE) {\n                                    if (nextProp) {\n                                        nextProp = this._previousStyleCopy = assign({}, nextProp)\n                                    } else {\n                                        this._previousStyleCopy = null\n                                    }\n                                    if (lastProp) {\n                                        // Unset styles on `lastProp` but not on `nextProp`.\n                                        for (styleName in lastProp) {\n                                            if (\n                                                lastProp.hasOwnProperty(styleName) &&\n                                                (!nextProp || !nextProp.hasOwnProperty(styleName))\n                                            ) {\n                                                styleUpdates = styleUpdates || {}\n                                                styleUpdates[styleName] = \"\"\n                                            }\n                                        }\n                                        // Update styles that changed since `lastProp`.\n                                        for (styleName in nextProp) {\n                                            if (\n                                                nextProp.hasOwnProperty(styleName) &&\n                                                lastProp[styleName] !== nextProp[styleName]\n                                            ) {\n                                                styleUpdates = styleUpdates || {}\n                                                styleUpdates[styleName] = nextProp[styleName]\n                                            }\n                                        }\n                                    } else {\n                                        // Relies on `updateStylesByID` not mutating `styleUpdates`.\n                                        styleUpdates = nextProp\n                                    }\n                                } else if (registrationNameModules.hasOwnProperty(propKey)) {\n                                    putListener(this._rootNodeID, propKey, nextProp, transaction)\n                                } else if (\n                                    DOMProperty.isStandardName[propKey] ||\n                                    DOMProperty.isCustomAttribute(propKey)\n                                ) {\n                                    BackendIDOperations.updatePropertyByID(\n                                        this._rootNodeID,\n                                        propKey,\n                                        nextProp\n                                    )\n                                }\n                            }\n                            if (styleUpdates) {\n                                BackendIDOperations.updateStylesByID(this._rootNodeID, styleUpdates)\n                            }\n                        },\n\n                        /**\n                         * Reconciles the children with the various properties that affect the\n                         * children content.\n                         *\n                         * @param {object} lastProps\n                         * @param {ReactReconcileTransaction} transaction\n                         */\n                        _updateDOMChildren: function(lastProps, transaction, context) {\n                            var nextProps = this._currentElement.props\n\n                            var lastContent = CONTENT_TYPES[typeof lastProps.children]\n                                ? lastProps.children\n                                : null\n                            var nextContent = CONTENT_TYPES[typeof nextProps.children]\n                                ? nextProps.children\n                                : null\n\n                            var lastHtml =\n                                lastProps.dangerouslySetInnerHTML &&\n                                lastProps.dangerouslySetInnerHTML.__html\n                            var nextHtml =\n                                nextProps.dangerouslySetInnerHTML &&\n                                nextProps.dangerouslySetInnerHTML.__html\n\n                            // Note the use of `!=` which checks for null or undefined.\n                            var lastChildren = lastContent != null ? null : lastProps.children\n                            var nextChildren = nextContent != null ? null : nextProps.children\n\n                            // If we're switching from children to content/html or vice versa, remove\n                            // the old content\n                            var lastHasContentOrHtml = lastContent != null || lastHtml != null\n                            var nextHasContentOrHtml = nextContent != null || nextHtml != null\n                            if (lastChildren != null && nextChildren == null) {\n                                this.updateChildren(null, transaction, context)\n                            } else if (lastHasContentOrHtml && !nextHasContentOrHtml) {\n                                this.updateTextContent(\"\")\n                            }\n\n                            if (nextContent != null) {\n                                if (lastContent !== nextContent) {\n                                    this.updateTextContent(\"\" + nextContent)\n                                }\n                            } else if (nextHtml != null) {\n                                if (lastHtml !== nextHtml) {\n                                    BackendIDOperations.updateInnerHTMLByID(\n                                        this._rootNodeID,\n                                        nextHtml\n                                    )\n                                }\n                            } else if (nextChildren != null) {\n                                this.updateChildren(nextChildren, transaction, context)\n                            }\n                        },\n\n                        /**\n                         * Destroys all event registrations for this instance. Does not remove from\n                         * the DOM. That must be done by the parent.\n                         *\n                         * @internal\n                         */\n                        unmountComponent: function() {\n                            this.unmountChildren()\n                            ReactBrowserEventEmitter.deleteAllListeners(this._rootNodeID)\n                            ReactComponentBrowserEnvironment.unmountIDFromEnvironment(\n                                this._rootNodeID\n                            )\n                            this._rootNodeID = null\n                        }\n                    }\n\n                    ReactPerf.measureMethods(ReactDOMComponent, \"ReactDOMComponent\", {\n                        mountComponent: \"mountComponent\",\n                        updateComponent: \"updateComponent\"\n                    })\n\n                    assign(\n                        ReactDOMComponent.prototype,\n                        ReactDOMComponent.Mixin,\n                        ReactMultiChild.Mixin\n                    )\n\n                    ReactDOMComponent.injection = {\n                        injectIDOperations: function(IDOperations) {\n                            ReactDOMComponent.BackendIDOperations = BackendIDOperations = IDOperations\n                        }\n                    }\n\n                    module.exports = ReactDOMComponent\n                },\n                {\n                    \"11\": 11,\n                    \"12\": 12,\n                    \"131\": 131,\n                    \"150\": 150,\n                    \"151\": 151,\n                    \"157\": 157,\n                    \"171\": 171,\n                    \"29\": 29,\n                    \"33\": 33,\n                    \"40\": 40,\n                    \"6\": 6,\n                    \"77\": 77,\n                    \"78\": 78,\n                    \"82\": 82\n                }\n            ],\n            49: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule ReactDOMForm\n                     */\n\n                    \"use strict\"\n\n                    var EventConstants = _dereq_(16)\n                    var LocalEventTrapMixin = _dereq_(27)\n                    var ReactBrowserComponentMixin = _dereq_(32)\n                    var ReactClass = _dereq_(38)\n                    var ReactElement = _dereq_(63)\n\n                    var form = ReactElement.createFactory(\"form\")\n\n                    /**\n                     * Since onSubmit doesn't bubble OR capture on the top level in IE8, we need\n                     * to capture it on the <form> element itself. There are lots of hacks we could\n                     * do to accomplish this, but the most reliable is to make <form> a\n                     * composite component and use `componentDidMount` to attach the event handlers.\n                     */\n                    var ReactDOMForm = ReactClass.createClass({\n                        displayName: \"ReactDOMForm\",\n                        tagName: \"FORM\",\n\n                        mixins: [ReactBrowserComponentMixin, LocalEventTrapMixin],\n\n                        render: function() {\n                            // TODO: Instead of using `ReactDOM` directly, we should use JSX. However,\n                            // `jshint` fails to parse JSX so in order for linting to work in the open\n                            // source repo, we need to just use `ReactDOM.form`.\n                            return form(this.props)\n                        },\n\n                        componentDidMount: function() {\n                            this.trapBubbledEvent(EventConstants.topLevelTypes.topReset, \"reset\")\n                            this.trapBubbledEvent(EventConstants.topLevelTypes.topSubmit, \"submit\")\n                        }\n                    })\n\n                    module.exports = ReactDOMForm\n                },\n                { \"16\": 16, \"27\": 27, \"32\": 32, \"38\": 38, \"63\": 63 }\n            ],\n            50: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule ReactDOMIDOperations\n                     * @typechecks static-only\n                     */\n\n                    /*jslint evil: true */\n\n                    \"use strict\"\n\n                    var CSSPropertyOperations = _dereq_(6)\n                    var DOMChildrenOperations = _dereq_(10)\n                    var DOMPropertyOperations = _dereq_(12)\n                    var ReactMount = _dereq_(77)\n                    var ReactPerf = _dereq_(82)\n\n                    var invariant = _dereq_(150)\n                    var setInnerHTML = _dereq_(164)\n\n                    /**\n                     * Errors for properties that should not be updated with `updatePropertyById()`.\n                     *\n                     * @type {object}\n                     * @private\n                     */\n                    var INVALID_PROPERTY_ERRORS = {\n                        dangerouslySetInnerHTML:\n                            \"`dangerouslySetInnerHTML` must be set using `updateInnerHTMLByID()`.\",\n                        style: \"`style` must be set using `updateStylesByID()`.\"\n                    }\n\n                    /**\n                     * Operations used to process updates to DOM nodes. This is made injectable via\n                     * `ReactDOMComponent.BackendIDOperations`.\n                     */\n                    var ReactDOMIDOperations = {\n                        /**\n                         * Updates a DOM node with new property values. This should only be used to\n                         * update DOM properties in `DOMProperty`.\n                         *\n                         * @param {string} id ID of the node to update.\n                         * @param {string} name A valid property name, see `DOMProperty`.\n                         * @param {*} value New value of the property.\n                         * @internal\n                         */\n                        updatePropertyByID: function(id, name, value) {\n                            var node = ReactMount.getNode(id)\n                            \"production\" !== \"development\"\n                                ? invariant(\n                                      !INVALID_PROPERTY_ERRORS.hasOwnProperty(name),\n                                      \"updatePropertyByID(...): %s\",\n                                      INVALID_PROPERTY_ERRORS[name]\n                                  )\n                                : invariant(!INVALID_PROPERTY_ERRORS.hasOwnProperty(name))\n\n                            // If we're updating to null or undefined, we should remove the property\n                            // from the DOM node instead of inadvertantly setting to a string. This\n                            // brings us in line with the same behavior we have on initial render.\n                            if (value != null) {\n                                DOMPropertyOperations.setValueForProperty(node, name, value)\n                            } else {\n                                DOMPropertyOperations.deleteValueForProperty(node, name)\n                            }\n                        },\n\n                        /**\n                         * Updates a DOM node to remove a property. This should only be used to remove\n                         * DOM properties in `DOMProperty`.\n                         *\n                         * @param {string} id ID of the node to update.\n                         * @param {string} name A property name to remove, see `DOMProperty`.\n                         * @internal\n                         */\n                        deletePropertyByID: function(id, name, value) {\n                            var node = ReactMount.getNode(id)\n                            \"production\" !== \"development\"\n                                ? invariant(\n                                      !INVALID_PROPERTY_ERRORS.hasOwnProperty(name),\n                                      \"updatePropertyByID(...): %s\",\n                                      INVALID_PROPERTY_ERRORS[name]\n                                  )\n                                : invariant(!INVALID_PROPERTY_ERRORS.hasOwnProperty(name))\n                            DOMPropertyOperations.deleteValueForProperty(node, name, value)\n                        },\n\n                        /**\n                         * Updates a DOM node with new style values. If a value is specified as '',\n                         * the corresponding style property will be unset.\n                         *\n                         * @param {string} id ID of the node to update.\n                         * @param {object} styles Mapping from styles to values.\n                         * @internal\n                         */\n                        updateStylesByID: function(id, styles) {\n                            var node = ReactMount.getNode(id)\n                            CSSPropertyOperations.setValueForStyles(node, styles)\n                        },\n\n                        /**\n                         * Updates a DOM node's innerHTML.\n                         *\n                         * @param {string} id ID of the node to update.\n                         * @param {string} html An HTML string.\n                         * @internal\n                         */\n                        updateInnerHTMLByID: function(id, html) {\n                            var node = ReactMount.getNode(id)\n                            setInnerHTML(node, html)\n                        },\n\n                        /**\n                         * Updates a DOM node's text content set by `props.content`.\n                         *\n                         * @param {string} id ID of the node to update.\n                         * @param {string} content Text content.\n                         * @internal\n                         */\n                        updateTextContentByID: function(id, content) {\n                            var node = ReactMount.getNode(id)\n                            DOMChildrenOperations.updateTextContent(node, content)\n                        },\n\n                        /**\n                         * Replaces a DOM node that exists in the document with markup.\n                         *\n                         * @param {string} id ID of child to be replaced.\n                         * @param {string} markup Dangerous markup to inject in place of child.\n                         * @internal\n                         * @see {Danger.dangerouslyReplaceNodeWithMarkup}\n                         */\n                        dangerouslyReplaceNodeWithMarkupByID: function(id, markup) {\n                            var node = ReactMount.getNode(id)\n                            DOMChildrenOperations.dangerouslyReplaceNodeWithMarkup(node, markup)\n                        },\n\n                        /**\n                         * Updates a component's children by processing a series of updates.\n                         *\n                         * @param {array<object>} updates List of update configurations.\n                         * @param {array<string>} markup List of markup strings.\n                         * @internal\n                         */\n                        dangerouslyProcessChildrenUpdates: function(updates, markup) {\n                            for (var i = 0; i < updates.length; i++) {\n                                updates[i].parentNode = ReactMount.getNode(updates[i].parentID)\n                            }\n                            DOMChildrenOperations.processUpdates(updates, markup)\n                        }\n                    }\n\n                    ReactPerf.measureMethods(ReactDOMIDOperations, \"ReactDOMIDOperations\", {\n                        updatePropertyByID: \"updatePropertyByID\",\n                        deletePropertyByID: \"deletePropertyByID\",\n                        updateStylesByID: \"updateStylesByID\",\n                        updateInnerHTMLByID: \"updateInnerHTMLByID\",\n                        updateTextContentByID: \"updateTextContentByID\",\n                        dangerouslyReplaceNodeWithMarkupByID:\n                            \"dangerouslyReplaceNodeWithMarkupByID\",\n                        dangerouslyProcessChildrenUpdates: \"dangerouslyProcessChildrenUpdates\"\n                    })\n\n                    module.exports = ReactDOMIDOperations\n                },\n                { \"10\": 10, \"12\": 12, \"150\": 150, \"164\": 164, \"6\": 6, \"77\": 77, \"82\": 82 }\n            ],\n            51: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule ReactDOMIframe\n                     */\n\n                    \"use strict\"\n\n                    var EventConstants = _dereq_(16)\n                    var LocalEventTrapMixin = _dereq_(27)\n                    var ReactBrowserComponentMixin = _dereq_(32)\n                    var ReactClass = _dereq_(38)\n                    var ReactElement = _dereq_(63)\n\n                    var iframe = ReactElement.createFactory(\"iframe\")\n\n                    /**\n                     * Since onLoad doesn't bubble OR capture on the top level in IE8, we need to\n                     * capture it on the <iframe> element itself. There are lots of hacks we could\n                     * do to accomplish this, but the most reliable is to make <iframe> a composite\n                     * component and use `componentDidMount` to attach the event handlers.\n                     */\n                    var ReactDOMIframe = ReactClass.createClass({\n                        displayName: \"ReactDOMIframe\",\n                        tagName: \"IFRAME\",\n\n                        mixins: [ReactBrowserComponentMixin, LocalEventTrapMixin],\n\n                        render: function() {\n                            return iframe(this.props)\n                        },\n\n                        componentDidMount: function() {\n                            this.trapBubbledEvent(EventConstants.topLevelTypes.topLoad, \"load\")\n                        }\n                    })\n\n                    module.exports = ReactDOMIframe\n                },\n                { \"16\": 16, \"27\": 27, \"32\": 32, \"38\": 38, \"63\": 63 }\n            ],\n            52: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule ReactDOMImg\n                     */\n\n                    \"use strict\"\n\n                    var EventConstants = _dereq_(16)\n                    var LocalEventTrapMixin = _dereq_(27)\n                    var ReactBrowserComponentMixin = _dereq_(32)\n                    var ReactClass = _dereq_(38)\n                    var ReactElement = _dereq_(63)\n\n                    var img = ReactElement.createFactory(\"img\")\n\n                    /**\n                     * Since onLoad doesn't bubble OR capture on the top level in IE8, we need to\n                     * capture it on the <img> element itself. There are lots of hacks we could do\n                     * to accomplish this, but the most reliable is to make <img> a composite\n                     * component and use `componentDidMount` to attach the event handlers.\n                     */\n                    var ReactDOMImg = ReactClass.createClass({\n                        displayName: \"ReactDOMImg\",\n                        tagName: \"IMG\",\n\n                        mixins: [ReactBrowserComponentMixin, LocalEventTrapMixin],\n\n                        render: function() {\n                            return img(this.props)\n                        },\n\n                        componentDidMount: function() {\n                            this.trapBubbledEvent(EventConstants.topLevelTypes.topLoad, \"load\")\n                            this.trapBubbledEvent(EventConstants.topLevelTypes.topError, \"error\")\n                        }\n                    })\n\n                    module.exports = ReactDOMImg\n                },\n                { \"16\": 16, \"27\": 27, \"32\": 32, \"38\": 38, \"63\": 63 }\n            ],\n            53: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule ReactDOMInput\n                     */\n\n                    \"use strict\"\n\n                    var AutoFocusMixin = _dereq_(2)\n                    var DOMPropertyOperations = _dereq_(12)\n                    var LinkedValueUtils = _dereq_(26)\n                    var ReactBrowserComponentMixin = _dereq_(32)\n                    var ReactClass = _dereq_(38)\n                    var ReactElement = _dereq_(63)\n                    var ReactMount = _dereq_(77)\n                    var ReactUpdates = _dereq_(100)\n\n                    var assign = _dereq_(29)\n                    var invariant = _dereq_(150)\n\n                    var input = ReactElement.createFactory(\"input\")\n\n                    var instancesByReactID = {}\n\n                    function forceUpdateIfMounted() {\n                        /*jshint validthis:true */\n                        if (this.isMounted()) {\n                            this.forceUpdate()\n                        }\n                    }\n\n                    /**\n                     * Implements an <input> native component that allows setting these optional\n                     * props: `checked`, `value`, `defaultChecked`, and `defaultValue`.\n                     *\n                     * If `checked` or `value` are not supplied (or null/undefined), user actions\n                     * that affect the checked state or value will trigger updates to the element.\n                     *\n                     * If they are supplied (and not null/undefined), the rendered element will not\n                     * trigger updates to the element. Instead, the props must change in order for\n                     * the rendered element to be updated.\n                     *\n                     * The rendered element will be initialized as unchecked (or `defaultChecked`)\n                     * with an empty value (or `defaultValue`).\n                     *\n                     * @see http://www.w3.org/TR/2012/WD-html5-20121025/the-input-element.html\n                     */\n                    var ReactDOMInput = ReactClass.createClass({\n                        displayName: \"ReactDOMInput\",\n                        tagName: \"INPUT\",\n\n                        mixins: [\n                            AutoFocusMixin,\n                            LinkedValueUtils.Mixin,\n                            ReactBrowserComponentMixin\n                        ],\n\n                        getInitialState: function() {\n                            var defaultValue = this.props.defaultValue\n                            return {\n                                initialChecked: this.props.defaultChecked || false,\n                                initialValue: defaultValue != null ? defaultValue : null\n                            }\n                        },\n\n                        render: function() {\n                            // Clone `this.props` so we don't mutate the input.\n                            var props = assign({}, this.props)\n\n                            props.defaultChecked = null\n                            props.defaultValue = null\n\n                            var value = LinkedValueUtils.getValue(this)\n                            props.value = value != null ? value : this.state.initialValue\n\n                            var checked = LinkedValueUtils.getChecked(this)\n                            props.checked = checked != null ? checked : this.state.initialChecked\n\n                            props.onChange = this._handleChange\n\n                            return input(props, this.props.children)\n                        },\n\n                        componentDidMount: function() {\n                            var id = ReactMount.getID(this.getDOMNode())\n                            instancesByReactID[id] = this\n                        },\n\n                        componentWillUnmount: function() {\n                            var rootNode = this.getDOMNode()\n                            var id = ReactMount.getID(rootNode)\n                            delete instancesByReactID[id]\n                        },\n\n                        componentDidUpdate: function(prevProps, prevState, prevContext) {\n                            var rootNode = this.getDOMNode()\n                            if (this.props.checked != null) {\n                                DOMPropertyOperations.setValueForProperty(\n                                    rootNode,\n                                    \"checked\",\n                                    this.props.checked || false\n                                )\n                            }\n\n                            var value = LinkedValueUtils.getValue(this)\n                            if (value != null) {\n                                // Cast `value` to a string to ensure the value is set correctly. While\n                                // browsers typically do this as necessary, jsdom doesn't.\n                                DOMPropertyOperations.setValueForProperty(\n                                    rootNode,\n                                    \"value\",\n                                    \"\" + value\n                                )\n                            }\n                        },\n\n                        _handleChange: function(event) {\n                            var returnValue\n                            var onChange = LinkedValueUtils.getOnChange(this)\n                            if (onChange) {\n                                returnValue = onChange.call(this, event)\n                            }\n                            // Here we use asap to wait until all updates have propagated, which\n                            // is important when using controlled components within layers:\n                            // https://github.com/facebook/react/issues/1698\n                            ReactUpdates.asap(forceUpdateIfMounted, this)\n\n                            var name = this.props.name\n                            if (this.props.type === \"radio\" && name != null) {\n                                var rootNode = this.getDOMNode()\n                                var queryRoot = rootNode\n\n                                while (queryRoot.parentNode) {\n                                    queryRoot = queryRoot.parentNode\n                                }\n\n                                // If `rootNode.form` was non-null, then we could try `form.elements`,\n                                // but that sometimes behaves strangely in IE8. We could also try using\n                                // `form.getElementsByName`, but that will only return direct children\n                                // and won't include inputs that use the HTML5 `form=` attribute. Since\n                                // the input might not even be in a form, let's just use the global\n                                // `querySelectorAll` to ensure we don't miss anything.\n                                var group = queryRoot.querySelectorAll(\n                                    \"input[name=\" + JSON.stringify(\"\" + name) + '][type=\"radio\"]'\n                                )\n\n                                for (var i = 0, groupLen = group.length; i < groupLen; i++) {\n                                    var otherNode = group[i]\n                                    if (\n                                        otherNode === rootNode ||\n                                        otherNode.form !== rootNode.form\n                                    ) {\n                                        continue\n                                    }\n                                    var otherID = ReactMount.getID(otherNode)\n                                    \"production\" !== \"development\"\n                                        ? invariant(\n                                              otherID,\n                                              \"ReactDOMInput: Mixing React and non-React radio inputs with the \" +\n                                                  \"same `name` is not supported.\"\n                                          )\n                                        : invariant(otherID)\n                                    var otherInstance = instancesByReactID[otherID]\n                                    \"production\" !== \"development\"\n                                        ? invariant(\n                                              otherInstance,\n                                              \"ReactDOMInput: Unknown radio button ID %s.\",\n                                              otherID\n                                          )\n                                        : invariant(otherInstance)\n                                    // If this is a controlled radio button group, forcing the input that\n                                    // was previously checked to update will cause it to be come re-checked\n                                    // as appropriate.\n                                    ReactUpdates.asap(forceUpdateIfMounted, otherInstance)\n                                }\n                            }\n\n                            return returnValue\n                        }\n                    })\n\n                    module.exports = ReactDOMInput\n                },\n                {\n                    \"100\": 100,\n                    \"12\": 12,\n                    \"150\": 150,\n                    \"2\": 2,\n                    \"26\": 26,\n                    \"29\": 29,\n                    \"32\": 32,\n                    \"38\": 38,\n                    \"63\": 63,\n                    \"77\": 77\n                }\n            ],\n            54: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule ReactDOMOption\n                     */\n\n                    \"use strict\"\n\n                    var ReactBrowserComponentMixin = _dereq_(32)\n                    var ReactClass = _dereq_(38)\n                    var ReactElement = _dereq_(63)\n\n                    var warning = _dereq_(171)\n\n                    var option = ReactElement.createFactory(\"option\")\n\n                    /**\n                     * Implements an <option> native component that warns when `selected` is set.\n                     */\n                    var ReactDOMOption = ReactClass.createClass({\n                        displayName: \"ReactDOMOption\",\n                        tagName: \"OPTION\",\n\n                        mixins: [ReactBrowserComponentMixin],\n\n                        componentWillMount: function() {\n                            // TODO (yungsters): Remove support for `selected` in <option>.\n                            if (\"production\" !== \"development\") {\n                                \"production\" !== \"development\"\n                                    ? warning(\n                                          this.props.selected == null,\n                                          \"Use the `defaultValue` or `value` props on <select> instead of \" +\n                                              \"setting `selected` on <option>.\"\n                                      )\n                                    : null\n                            }\n                        },\n\n                        render: function() {\n                            return option(this.props, this.props.children)\n                        }\n                    })\n\n                    module.exports = ReactDOMOption\n                },\n                { \"171\": 171, \"32\": 32, \"38\": 38, \"63\": 63 }\n            ],\n            55: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule ReactDOMSelect\n                     */\n\n                    \"use strict\"\n\n                    var AutoFocusMixin = _dereq_(2)\n                    var LinkedValueUtils = _dereq_(26)\n                    var ReactBrowserComponentMixin = _dereq_(32)\n                    var ReactClass = _dereq_(38)\n                    var ReactElement = _dereq_(63)\n                    var ReactUpdates = _dereq_(100)\n\n                    var assign = _dereq_(29)\n\n                    var select = ReactElement.createFactory(\"select\")\n\n                    function updateOptionsIfPendingUpdateAndMounted() {\n                        /*jshint validthis:true */\n                        if (this._pendingUpdate) {\n                            this._pendingUpdate = false\n                            var value = LinkedValueUtils.getValue(this)\n                            if (value != null && this.isMounted()) {\n                                updateOptions(this, value)\n                            }\n                        }\n                    }\n\n                    /**\n                     * Validation function for `value` and `defaultValue`.\n                     * @private\n                     */\n                    function selectValueType(props, propName, componentName) {\n                        if (props[propName] == null) {\n                            return null\n                        }\n                        if (props.multiple) {\n                            if (!Array.isArray(props[propName])) {\n                                return new Error(\n                                    \"The `\" +\n                                        propName +\n                                        \"` prop supplied to <select> must be an array if \" +\n                                        \"`multiple` is true.\"\n                                )\n                            }\n                        } else {\n                            if (Array.isArray(props[propName])) {\n                                return new Error(\n                                    \"The `\" +\n                                        propName +\n                                        \"` prop supplied to <select> must be a scalar \" +\n                                        \"value if `multiple` is false.\"\n                                )\n                            }\n                        }\n                    }\n\n                    /**\n                     * @param {ReactComponent} component Instance of ReactDOMSelect\n                     * @param {*} propValue A stringable (with `multiple`, a list of stringables).\n                     * @private\n                     */\n                    function updateOptions(component, propValue) {\n                        var selectedValue, i, l\n                        var options = component.getDOMNode().options\n\n                        if (component.props.multiple) {\n                            selectedValue = {}\n                            for (i = 0, l = propValue.length; i < l; i++) {\n                                selectedValue[\"\" + propValue[i]] = true\n                            }\n                            for (i = 0, l = options.length; i < l; i++) {\n                                var selected = selectedValue.hasOwnProperty(options[i].value)\n                                if (options[i].selected !== selected) {\n                                    options[i].selected = selected\n                                }\n                            }\n                        } else {\n                            // Do not set `select.value` as exact behavior isn't consistent across all\n                            // browsers for all cases.\n                            selectedValue = \"\" + propValue\n                            for (i = 0, l = options.length; i < l; i++) {\n                                if (options[i].value === selectedValue) {\n                                    options[i].selected = true\n                                    return\n                                }\n                            }\n                            if (options.length) {\n                                options[0].selected = true\n                            }\n                        }\n                    }\n\n                    /**\n                     * Implements a <select> native component that allows optionally setting the\n                     * props `value` and `defaultValue`. If `multiple` is false, the prop must be a\n                     * stringable. If `multiple` is true, the prop must be an array of stringables.\n                     *\n                     * If `value` is not supplied (or null/undefined), user actions that change the\n                     * selected option will trigger updates to the rendered options.\n                     *\n                     * If it is supplied (and not null/undefined), the rendered options will not\n                     * update in response to user actions. Instead, the `value` prop must change in\n                     * order for the rendered options to update.\n                     *\n                     * If `defaultValue` is provided, any options with the supplied values will be\n                     * selected.\n                     */\n                    var ReactDOMSelect = ReactClass.createClass({\n                        displayName: \"ReactDOMSelect\",\n                        tagName: \"SELECT\",\n\n                        mixins: [\n                            AutoFocusMixin,\n                            LinkedValueUtils.Mixin,\n                            ReactBrowserComponentMixin\n                        ],\n\n                        propTypes: {\n                            defaultValue: selectValueType,\n                            value: selectValueType\n                        },\n\n                        render: function() {\n                            // Clone `this.props` so we don't mutate the input.\n                            var props = assign({}, this.props)\n\n                            props.onChange = this._handleChange\n                            props.value = null\n\n                            return select(props, this.props.children)\n                        },\n\n                        componentWillMount: function() {\n                            this._pendingUpdate = false\n                        },\n\n                        componentDidMount: function() {\n                            var value = LinkedValueUtils.getValue(this)\n                            if (value != null) {\n                                updateOptions(this, value)\n                            } else if (this.props.defaultValue != null) {\n                                updateOptions(this, this.props.defaultValue)\n                            }\n                        },\n\n                        componentDidUpdate: function(prevProps) {\n                            var value = LinkedValueUtils.getValue(this)\n                            if (value != null) {\n                                this._pendingUpdate = false\n                                updateOptions(this, value)\n                            } else if (!prevProps.multiple !== !this.props.multiple) {\n                                // For simplicity, reapply `defaultValue` if `multiple` is toggled.\n                                if (this.props.defaultValue != null) {\n                                    updateOptions(this, this.props.defaultValue)\n                                } else {\n                                    // Revert the select back to its default unselected state.\n                                    updateOptions(this, this.props.multiple ? [] : \"\")\n                                }\n                            }\n                        },\n\n                        _handleChange: function(event) {\n                            var returnValue\n                            var onChange = LinkedValueUtils.getOnChange(this)\n                            if (onChange) {\n                                returnValue = onChange.call(this, event)\n                            }\n\n                            this._pendingUpdate = true\n                            ReactUpdates.asap(updateOptionsIfPendingUpdateAndMounted, this)\n                            return returnValue\n                        }\n                    })\n\n                    module.exports = ReactDOMSelect\n                },\n                { \"100\": 100, \"2\": 2, \"26\": 26, \"29\": 29, \"32\": 32, \"38\": 38, \"63\": 63 }\n            ],\n            56: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule ReactDOMSelection\n                     */\n\n                    \"use strict\"\n\n                    var ExecutionEnvironment = _dereq_(22)\n\n                    var getNodeForCharacterOffset = _dereq_(143)\n                    var getTextContentAccessor = _dereq_(145)\n\n                    /**\n                     * While `isCollapsed` is available on the Selection object and `collapsed`\n                     * is available on the Range object, IE11 sometimes gets them wrong.\n                     * If the anchor/focus nodes and offsets are the same, the range is collapsed.\n                     */\n                    function isCollapsed(anchorNode, anchorOffset, focusNode, focusOffset) {\n                        return anchorNode === focusNode && anchorOffset === focusOffset\n                    }\n\n                    /**\n                     * Get the appropriate anchor and focus node/offset pairs for IE.\n                     *\n                     * The catch here is that IE's selection API doesn't provide information\n                     * about whether the selection is forward or backward, so we have to\n                     * behave as though it's always forward.\n                     *\n                     * IE text differs from modern selection in that it behaves as though\n                     * block elements end with a new line. This means character offsets will\n                     * differ between the two APIs.\n                     *\n                     * @param {DOMElement} node\n                     * @return {object}\n                     */\n                    function getIEOffsets(node) {\n                        var selection = document.selection\n                        var selectedRange = selection.createRange()\n                        var selectedLength = selectedRange.text.length\n\n                        // Duplicate selection so we can move range without breaking user selection.\n                        var fromStart = selectedRange.duplicate()\n                        fromStart.moveToElementText(node)\n                        fromStart.setEndPoint(\"EndToStart\", selectedRange)\n\n                        var startOffset = fromStart.text.length\n                        var endOffset = startOffset + selectedLength\n\n                        return {\n                            start: startOffset,\n                            end: endOffset\n                        }\n                    }\n\n                    /**\n                     * @param {DOMElement} node\n                     * @return {?object}\n                     */\n                    function getModernOffsets(node) {\n                        var selection = window.getSelection && window.getSelection()\n\n                        if (!selection || selection.rangeCount === 0) {\n                            return null\n                        }\n\n                        var anchorNode = selection.anchorNode\n                        var anchorOffset = selection.anchorOffset\n                        var focusNode = selection.focusNode\n                        var focusOffset = selection.focusOffset\n\n                        var currentRange = selection.getRangeAt(0)\n\n                        // If the node and offset values are the same, the selection is collapsed.\n                        // `Selection.isCollapsed` is available natively, but IE sometimes gets\n                        // this value wrong.\n                        var isSelectionCollapsed = isCollapsed(\n                            selection.anchorNode,\n                            selection.anchorOffset,\n                            selection.focusNode,\n                            selection.focusOffset\n                        )\n\n                        var rangeLength = isSelectionCollapsed ? 0 : currentRange.toString().length\n\n                        var tempRange = currentRange.cloneRange()\n                        tempRange.selectNodeContents(node)\n                        tempRange.setEnd(currentRange.startContainer, currentRange.startOffset)\n\n                        var isTempRangeCollapsed = isCollapsed(\n                            tempRange.startContainer,\n                            tempRange.startOffset,\n                            tempRange.endContainer,\n                            tempRange.endOffset\n                        )\n\n                        var start = isTempRangeCollapsed ? 0 : tempRange.toString().length\n                        var end = start + rangeLength\n\n                        // Detect whether the selection is backward.\n                        var detectionRange = document.createRange()\n                        detectionRange.setStart(anchorNode, anchorOffset)\n                        detectionRange.setEnd(focusNode, focusOffset)\n                        var isBackward = detectionRange.collapsed\n\n                        return {\n                            start: isBackward ? end : start,\n                            end: isBackward ? start : end\n                        }\n                    }\n\n                    /**\n                     * @param {DOMElement|DOMTextNode} node\n                     * @param {object} offsets\n                     */\n                    function setIEOffsets(node, offsets) {\n                        var range = document.selection.createRange().duplicate()\n                        var start, end\n\n                        if (typeof offsets.end === \"undefined\") {\n                            start = offsets.start\n                            end = start\n                        } else if (offsets.start > offsets.end) {\n                            start = offsets.end\n                            end = offsets.start\n                        } else {\n                            start = offsets.start\n                            end = offsets.end\n                        }\n\n                        range.moveToElementText(node)\n                        range.moveStart(\"character\", start)\n                        range.setEndPoint(\"EndToStart\", range)\n                        range.moveEnd(\"character\", end - start)\n                        range.select()\n                    }\n\n                    /**\n                     * In modern non-IE browsers, we can support both forward and backward\n                     * selections.\n                     *\n                     * Note: IE10+ supports the Selection object, but it does not support\n                     * the `extend` method, which means that even in modern IE, it's not possible\n                     * to programatically create a backward selection. Thus, for all IE\n                     * versions, we use the old IE API to create our selections.\n                     *\n                     * @param {DOMElement|DOMTextNode} node\n                     * @param {object} offsets\n                     */\n                    function setModernOffsets(node, offsets) {\n                        if (!window.getSelection) {\n                            return\n                        }\n\n                        var selection = window.getSelection()\n                        var length = node[getTextContentAccessor()].length\n                        var start = Math.min(offsets.start, length)\n                        var end =\n                            typeof offsets.end === \"undefined\"\n                                ? start\n                                : Math.min(offsets.end, length)\n\n                        // IE 11 uses modern selection, but doesn't support the extend method.\n                        // Flip backward selections, so we can set with a single range.\n                        if (!selection.extend && start > end) {\n                            var temp = end\n                            end = start\n                            start = temp\n                        }\n\n                        var startMarker = getNodeForCharacterOffset(node, start)\n                        var endMarker = getNodeForCharacterOffset(node, end)\n\n                        if (startMarker && endMarker) {\n                            var range = document.createRange()\n                            range.setStart(startMarker.node, startMarker.offset)\n                            selection.removeAllRanges()\n\n                            if (start > end) {\n                                selection.addRange(range)\n                                selection.extend(endMarker.node, endMarker.offset)\n                            } else {\n                                range.setEnd(endMarker.node, endMarker.offset)\n                                selection.addRange(range)\n                            }\n                        }\n                    }\n\n                    var useIEOffsets =\n                        ExecutionEnvironment.canUseDOM &&\n                        \"selection\" in document &&\n                        !(\"getSelection\" in window)\n\n                    var ReactDOMSelection = {\n                        /**\n                         * @param {DOMElement} node\n                         */\n                        getOffsets: useIEOffsets ? getIEOffsets : getModernOffsets,\n\n                        /**\n                         * @param {DOMElement|DOMTextNode} node\n                         * @param {object} offsets\n                         */\n                        setOffsets: useIEOffsets ? setIEOffsets : setModernOffsets\n                    }\n\n                    module.exports = ReactDOMSelection\n                },\n                { \"143\": 143, \"145\": 145, \"22\": 22 }\n            ],\n            57: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule ReactDOMTextComponent\n                     * @typechecks static-only\n                     */\n\n                    \"use strict\"\n\n                    var DOMPropertyOperations = _dereq_(12)\n                    var ReactComponentBrowserEnvironment = _dereq_(40)\n                    var ReactDOMComponent = _dereq_(48)\n\n                    var assign = _dereq_(29)\n                    var escapeTextContentForBrowser = _dereq_(131)\n\n                    /**\n                     * Text nodes violate a couple assumptions that React makes about components:\n                     *\n                     *  - When mounting text into the DOM, adjacent text nodes are merged.\n                     *  - Text nodes cannot be assigned a React root ID.\n                     *\n                     * This component is used to wrap strings in elements so that they can undergo\n                     * the same reconciliation that is applied to elements.\n                     *\n                     * TODO: Investigate representing React components in the DOM with text nodes.\n                     *\n                     * @class ReactDOMTextComponent\n                     * @extends ReactComponent\n                     * @internal\n                     */\n                    var ReactDOMTextComponent = function(props) {\n                        // This constructor and its argument is currently used by mocks.\n                    }\n\n                    assign(ReactDOMTextComponent.prototype, {\n                        /**\n                         * @param {ReactText} text\n                         * @internal\n                         */\n                        construct: function(text) {\n                            // TODO: This is really a ReactText (ReactNode), not a ReactElement\n                            this._currentElement = text\n                            this._stringText = \"\" + text\n\n                            // Properties\n                            this._rootNodeID = null\n                            this._mountIndex = 0\n                        },\n\n                        /**\n                         * Creates the markup for this text node. This node is not intended to have\n                         * any features besides containing text content.\n                         *\n                         * @param {string} rootID DOM ID of the root node.\n                         * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction\n                         * @return {string} Markup for this text node.\n                         * @internal\n                         */\n                        mountComponent: function(rootID, transaction, context) {\n                            this._rootNodeID = rootID\n                            var escapedText = escapeTextContentForBrowser(this._stringText)\n\n                            if (transaction.renderToStaticMarkup) {\n                                // Normally we'd wrap this in a `span` for the reasons stated above, but\n                                // since this is a situation where React won't take over (static pages),\n                                // we can simply return the text as it is.\n                                return escapedText\n                            }\n\n                            return (\n                                \"<span \" +\n                                DOMPropertyOperations.createMarkupForID(rootID) +\n                                \">\" +\n                                escapedText +\n                                \"</span>\"\n                            )\n                        },\n\n                        /**\n                         * Updates this component by updating the text content.\n                         *\n                         * @param {ReactText} nextText The next text content\n                         * @param {ReactReconcileTransaction} transaction\n                         * @internal\n                         */\n                        receiveComponent: function(nextText, transaction) {\n                            if (nextText !== this._currentElement) {\n                                this._currentElement = nextText\n                                var nextStringText = \"\" + nextText\n                                if (nextStringText !== this._stringText) {\n                                    // TODO: Save this as pending props and use performUpdateIfNecessary\n                                    // and/or updateComponent to do the actual update for consistency with\n                                    // other component types?\n                                    this._stringText = nextStringText\n                                    ReactDOMComponent.BackendIDOperations.updateTextContentByID(\n                                        this._rootNodeID,\n                                        nextStringText\n                                    )\n                                }\n                            }\n                        },\n\n                        unmountComponent: function() {\n                            ReactComponentBrowserEnvironment.unmountIDFromEnvironment(\n                                this._rootNodeID\n                            )\n                        }\n                    })\n\n                    module.exports = ReactDOMTextComponent\n                },\n                { \"12\": 12, \"131\": 131, \"29\": 29, \"40\": 40, \"48\": 48 }\n            ],\n            58: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule ReactDOMTextarea\n                     */\n\n                    \"use strict\"\n\n                    var AutoFocusMixin = _dereq_(2)\n                    var DOMPropertyOperations = _dereq_(12)\n                    var LinkedValueUtils = _dereq_(26)\n                    var ReactBrowserComponentMixin = _dereq_(32)\n                    var ReactClass = _dereq_(38)\n                    var ReactElement = _dereq_(63)\n                    var ReactUpdates = _dereq_(100)\n\n                    var assign = _dereq_(29)\n                    var invariant = _dereq_(150)\n\n                    var warning = _dereq_(171)\n\n                    var textarea = ReactElement.createFactory(\"textarea\")\n\n                    function forceUpdateIfMounted() {\n                        /*jshint validthis:true */\n                        if (this.isMounted()) {\n                            this.forceUpdate()\n                        }\n                    }\n\n                    /**\n                     * Implements a <textarea> native component that allows setting `value`, and\n                     * `defaultValue`. This differs from the traditional DOM API because value is\n                     * usually set as PCDATA children.\n                     *\n                     * If `value` is not supplied (or null/undefined), user actions that affect the\n                     * value will trigger updates to the element.\n                     *\n                     * If `value` is supplied (and not null/undefined), the rendered element will\n                     * not trigger updates to the element. Instead, the `value` prop must change in\n                     * order for the rendered element to be updated.\n                     *\n                     * The rendered element will be initialized with an empty value, the prop\n                     * `defaultValue` if specified, or the children content (deprecated).\n                     */\n                    var ReactDOMTextarea = ReactClass.createClass({\n                        displayName: \"ReactDOMTextarea\",\n                        tagName: \"TEXTAREA\",\n\n                        mixins: [\n                            AutoFocusMixin,\n                            LinkedValueUtils.Mixin,\n                            ReactBrowserComponentMixin\n                        ],\n\n                        getInitialState: function() {\n                            var defaultValue = this.props.defaultValue\n                            // TODO (yungsters): Remove support for children content in <textarea>.\n                            var children = this.props.children\n                            if (children != null) {\n                                if (\"production\" !== \"development\") {\n                                    \"production\" !== \"development\"\n                                        ? warning(\n                                              false,\n                                              \"Use the `defaultValue` or `value` props instead of setting \" +\n                                                  \"children on <textarea>.\"\n                                          )\n                                        : null\n                                }\n                                \"production\" !== \"development\"\n                                    ? invariant(\n                                          defaultValue == null,\n                                          \"If you supply `defaultValue` on a <textarea>, do not pass children.\"\n                                      )\n                                    : invariant(defaultValue == null)\n                                if (Array.isArray(children)) {\n                                    \"production\" !== \"development\"\n                                        ? invariant(\n                                              children.length <= 1,\n                                              \"<textarea> can only have at most one child.\"\n                                          )\n                                        : invariant(children.length <= 1)\n                                    children = children[0]\n                                }\n\n                                defaultValue = \"\" + children\n                            }\n                            if (defaultValue == null) {\n                                defaultValue = \"\"\n                            }\n                            var value = LinkedValueUtils.getValue(this)\n                            return {\n                                // We save the initial value so that `ReactDOMComponent` doesn't update\n                                // `textContent` (unnecessary since we update value).\n                                // The initial value can be a boolean or object so that's why it's\n                                // forced to be a string.\n                                initialValue: \"\" + (value != null ? value : defaultValue)\n                            }\n                        },\n\n                        render: function() {\n                            // Clone `this.props` so we don't mutate the input.\n                            var props = assign({}, this.props)\n\n                            \"production\" !== \"development\"\n                                ? invariant(\n                                      props.dangerouslySetInnerHTML == null,\n                                      \"`dangerouslySetInnerHTML` does not make sense on <textarea>.\"\n                                  )\n                                : invariant(props.dangerouslySetInnerHTML == null)\n\n                            props.defaultValue = null\n                            props.value = null\n                            props.onChange = this._handleChange\n\n                            // Always set children to the same thing. In IE9, the selection range will\n                            // get reset if `textContent` is mutated.\n                            return textarea(props, this.state.initialValue)\n                        },\n\n                        componentDidUpdate: function(prevProps, prevState, prevContext) {\n                            var value = LinkedValueUtils.getValue(this)\n                            if (value != null) {\n                                var rootNode = this.getDOMNode()\n                                // Cast `value` to a string to ensure the value is set correctly. While\n                                // browsers typically do this as necessary, jsdom doesn't.\n                                DOMPropertyOperations.setValueForProperty(\n                                    rootNode,\n                                    \"value\",\n                                    \"\" + value\n                                )\n                            }\n                        },\n\n                        _handleChange: function(event) {\n                            var returnValue\n                            var onChange = LinkedValueUtils.getOnChange(this)\n                            if (onChange) {\n                                returnValue = onChange.call(this, event)\n                            }\n                            ReactUpdates.asap(forceUpdateIfMounted, this)\n                            return returnValue\n                        }\n                    })\n\n                    module.exports = ReactDOMTextarea\n                },\n                {\n                    \"100\": 100,\n                    \"12\": 12,\n                    \"150\": 150,\n                    \"171\": 171,\n                    \"2\": 2,\n                    \"26\": 26,\n                    \"29\": 29,\n                    \"32\": 32,\n                    \"38\": 38,\n                    \"63\": 63\n                }\n            ],\n            59: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule ReactDefaultBatchingStrategy\n                     */\n\n                    \"use strict\"\n\n                    var ReactUpdates = _dereq_(100)\n                    var Transaction = _dereq_(116)\n\n                    var assign = _dereq_(29)\n                    var emptyFunction = _dereq_(129)\n\n                    var RESET_BATCHED_UPDATES = {\n                        initialize: emptyFunction,\n                        close: function() {\n                            ReactDefaultBatchingStrategy.isBatchingUpdates = false\n                        }\n                    }\n\n                    var FLUSH_BATCHED_UPDATES = {\n                        initialize: emptyFunction,\n                        close: ReactUpdates.flushBatchedUpdates.bind(ReactUpdates)\n                    }\n\n                    var TRANSACTION_WRAPPERS = [FLUSH_BATCHED_UPDATES, RESET_BATCHED_UPDATES]\n\n                    function ReactDefaultBatchingStrategyTransaction() {\n                        this.reinitializeTransaction()\n                    }\n\n                    assign(ReactDefaultBatchingStrategyTransaction.prototype, Transaction.Mixin, {\n                        getTransactionWrappers: function() {\n                            return TRANSACTION_WRAPPERS\n                        }\n                    })\n\n                    var transaction = new ReactDefaultBatchingStrategyTransaction()\n\n                    var ReactDefaultBatchingStrategy = {\n                        isBatchingUpdates: false,\n\n                        /**\n                         * Call the provided function in a context within which calls to `setState`\n                         * and friends are batched such that components aren't updated unnecessarily.\n                         */\n                        batchedUpdates: function(callback, a, b, c, d) {\n                            var alreadyBatchingUpdates =\n                                ReactDefaultBatchingStrategy.isBatchingUpdates\n\n                            ReactDefaultBatchingStrategy.isBatchingUpdates = true\n\n                            // The code is written this way to avoid extra allocations\n                            if (alreadyBatchingUpdates) {\n                                callback(a, b, c, d)\n                            } else {\n                                transaction.perform(callback, null, a, b, c, d)\n                            }\n                        }\n                    }\n\n                    module.exports = ReactDefaultBatchingStrategy\n                },\n                { \"100\": 100, \"116\": 116, \"129\": 129, \"29\": 29 }\n            ],\n            60: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule ReactDefaultInjection\n                     */\n\n                    \"use strict\"\n\n                    var BeforeInputEventPlugin = _dereq_(3)\n                    var ChangeEventPlugin = _dereq_(8)\n                    var ClientReactRootIndex = _dereq_(9)\n                    var DefaultEventPluginOrder = _dereq_(14)\n                    var EnterLeaveEventPlugin = _dereq_(15)\n                    var ExecutionEnvironment = _dereq_(22)\n                    var HTMLDOMPropertyConfig = _dereq_(24)\n                    var MobileSafariClickEventPlugin = _dereq_(28)\n                    var ReactBrowserComponentMixin = _dereq_(32)\n                    var ReactClass = _dereq_(38)\n                    var ReactComponentBrowserEnvironment = _dereq_(40)\n                    var ReactDefaultBatchingStrategy = _dereq_(59)\n                    var ReactDOMComponent = _dereq_(48)\n                    var ReactDOMButton = _dereq_(47)\n                    var ReactDOMForm = _dereq_(49)\n                    var ReactDOMImg = _dereq_(52)\n                    var ReactDOMIDOperations = _dereq_(50)\n                    var ReactDOMIframe = _dereq_(51)\n                    var ReactDOMInput = _dereq_(53)\n                    var ReactDOMOption = _dereq_(54)\n                    var ReactDOMSelect = _dereq_(55)\n                    var ReactDOMTextarea = _dereq_(58)\n                    var ReactDOMTextComponent = _dereq_(57)\n                    var ReactElement = _dereq_(63)\n                    var ReactEventListener = _dereq_(68)\n                    var ReactInjection = _dereq_(70)\n                    var ReactInstanceHandles = _dereq_(72)\n                    var ReactMount = _dereq_(77)\n                    var ReactReconcileTransaction = _dereq_(88)\n                    var SelectEventPlugin = _dereq_(102)\n                    var ServerReactRootIndex = _dereq_(103)\n                    var SimpleEventPlugin = _dereq_(104)\n                    var SVGDOMPropertyConfig = _dereq_(101)\n\n                    var createFullPageComponent = _dereq_(125)\n\n                    function autoGenerateWrapperClass(type) {\n                        return ReactClass.createClass({\n                            tagName: type.toUpperCase(),\n                            render: function() {\n                                return new ReactElement(type, null, null, null, null, this.props)\n                            }\n                        })\n                    }\n\n                    function inject() {\n                        ReactInjection.EventEmitter.injectReactEventListener(ReactEventListener)\n\n                        /**\n                         * Inject modules for resolving DOM hierarchy and plugin ordering.\n                         */\n                        ReactInjection.EventPluginHub.injectEventPluginOrder(\n                            DefaultEventPluginOrder\n                        )\n                        ReactInjection.EventPluginHub.injectInstanceHandle(ReactInstanceHandles)\n                        ReactInjection.EventPluginHub.injectMount(ReactMount)\n\n                        /**\n                         * Some important event plugins included by default (without having to require\n                         * them).\n                         */\n                        ReactInjection.EventPluginHub.injectEventPluginsByName({\n                            SimpleEventPlugin: SimpleEventPlugin,\n                            EnterLeaveEventPlugin: EnterLeaveEventPlugin,\n                            ChangeEventPlugin: ChangeEventPlugin,\n                            MobileSafariClickEventPlugin: MobileSafariClickEventPlugin,\n                            SelectEventPlugin: SelectEventPlugin,\n                            BeforeInputEventPlugin: BeforeInputEventPlugin\n                        })\n\n                        ReactInjection.NativeComponent.injectGenericComponentClass(\n                            ReactDOMComponent\n                        )\n\n                        ReactInjection.NativeComponent.injectTextComponentClass(\n                            ReactDOMTextComponent\n                        )\n\n                        ReactInjection.NativeComponent.injectAutoWrapper(autoGenerateWrapperClass)\n\n                        // This needs to happen before createFullPageComponent() otherwise the mixin\n                        // won't be included.\n                        ReactInjection.Class.injectMixin(ReactBrowserComponentMixin)\n\n                        ReactInjection.NativeComponent.injectComponentClasses({\n                            button: ReactDOMButton,\n                            form: ReactDOMForm,\n                            iframe: ReactDOMIframe,\n                            img: ReactDOMImg,\n                            input: ReactDOMInput,\n                            option: ReactDOMOption,\n                            select: ReactDOMSelect,\n                            textarea: ReactDOMTextarea,\n\n                            html: createFullPageComponent(\"html\"),\n                            head: createFullPageComponent(\"head\"),\n                            body: createFullPageComponent(\"body\")\n                        })\n\n                        ReactInjection.DOMProperty.injectDOMPropertyConfig(HTMLDOMPropertyConfig)\n                        ReactInjection.DOMProperty.injectDOMPropertyConfig(SVGDOMPropertyConfig)\n\n                        ReactInjection.EmptyComponent.injectEmptyComponent(\"noscript\")\n\n                        ReactInjection.Updates.injectReconcileTransaction(ReactReconcileTransaction)\n                        ReactInjection.Updates.injectBatchingStrategy(ReactDefaultBatchingStrategy)\n\n                        ReactInjection.RootIndex.injectCreateReactRootIndex(\n                            ExecutionEnvironment.canUseDOM\n                                ? ClientReactRootIndex.createReactRootIndex\n                                : ServerReactRootIndex.createReactRootIndex\n                        )\n\n                        ReactInjection.Component.injectEnvironment(ReactComponentBrowserEnvironment)\n                        ReactInjection.DOMComponent.injectIDOperations(ReactDOMIDOperations)\n\n                        if (\"production\" !== \"development\") {\n                            var url = (ExecutionEnvironment.canUseDOM && window.location.href) || \"\"\n                            if (/[?&]react_perf\\b/.test(url)) {\n                                var ReactDefaultPerf = _dereq_(61)\n                                ReactDefaultPerf.start()\n                            }\n                        }\n                    }\n\n                    module.exports = {\n                        inject: inject\n                    }\n                },\n                {\n                    \"101\": 101,\n                    \"102\": 102,\n                    \"103\": 103,\n                    \"104\": 104,\n                    \"125\": 125,\n                    \"14\": 14,\n                    \"15\": 15,\n                    \"22\": 22,\n                    \"24\": 24,\n                    \"28\": 28,\n                    \"3\": 3,\n                    \"32\": 32,\n                    \"38\": 38,\n                    \"40\": 40,\n                    \"47\": 47,\n                    \"48\": 48,\n                    \"49\": 49,\n                    \"50\": 50,\n                    \"51\": 51,\n                    \"52\": 52,\n                    \"53\": 53,\n                    \"54\": 54,\n                    \"55\": 55,\n                    \"57\": 57,\n                    \"58\": 58,\n                    \"59\": 59,\n                    \"61\": 61,\n                    \"63\": 63,\n                    \"68\": 68,\n                    \"70\": 70,\n                    \"72\": 72,\n                    \"77\": 77,\n                    \"8\": 8,\n                    \"88\": 88,\n                    \"9\": 9\n                }\n            ],\n            61: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule ReactDefaultPerf\n                     * @typechecks static-only\n                     */\n\n                    \"use strict\"\n\n                    var DOMProperty = _dereq_(11)\n                    var ReactDefaultPerfAnalysis = _dereq_(62)\n                    var ReactMount = _dereq_(77)\n                    var ReactPerf = _dereq_(82)\n\n                    var performanceNow = _dereq_(162)\n\n                    function roundFloat(val) {\n                        return Math.floor(val * 100) / 100\n                    }\n\n                    function addValue(obj, key, val) {\n                        obj[key] = (obj[key] || 0) + val\n                    }\n\n                    var ReactDefaultPerf = {\n                        _allMeasurements: [], // last item in the list is the current one\n                        _mountStack: [0],\n                        _injected: false,\n\n                        start: function() {\n                            if (!ReactDefaultPerf._injected) {\n                                ReactPerf.injection.injectMeasure(ReactDefaultPerf.measure)\n                            }\n\n                            ReactDefaultPerf._allMeasurements.length = 0\n                            ReactPerf.enableMeasure = true\n                        },\n\n                        stop: function() {\n                            ReactPerf.enableMeasure = false\n                        },\n\n                        getLastMeasurements: function() {\n                            return ReactDefaultPerf._allMeasurements\n                        },\n\n                        printExclusive: function(measurements) {\n                            measurements = measurements || ReactDefaultPerf._allMeasurements\n                            var summary = ReactDefaultPerfAnalysis.getExclusiveSummary(measurements)\n                            console.table(\n                                summary.map(function(item) {\n                                    return {\n                                        \"Component class name\": item.componentName,\n                                        \"Total inclusive time (ms)\": roundFloat(item.inclusive),\n                                        \"Exclusive mount time (ms)\": roundFloat(item.exclusive),\n                                        \"Exclusive render time (ms)\": roundFloat(item.render),\n                                        \"Mount time per instance (ms)\": roundFloat(\n                                            item.exclusive / item.count\n                                        ),\n                                        \"Render time per instance (ms)\": roundFloat(\n                                            item.render / item.count\n                                        ),\n                                        Instances: item.count\n                                    }\n                                })\n                            )\n                            // TODO: ReactDefaultPerfAnalysis.getTotalTime() does not return the correct\n                            // number.\n                        },\n\n                        printInclusive: function(measurements) {\n                            measurements = measurements || ReactDefaultPerf._allMeasurements\n                            var summary = ReactDefaultPerfAnalysis.getInclusiveSummary(measurements)\n                            console.table(\n                                summary.map(function(item) {\n                                    return {\n                                        \"Owner > component\": item.componentName,\n                                        \"Inclusive time (ms)\": roundFloat(item.time),\n                                        Instances: item.count\n                                    }\n                                })\n                            )\n                            console.log(\n                                \"Total time:\",\n                                ReactDefaultPerfAnalysis.getTotalTime(measurements).toFixed(2) +\n                                    \" ms\"\n                            )\n                        },\n\n                        getMeasurementsSummaryMap: function(measurements) {\n                            var summary = ReactDefaultPerfAnalysis.getInclusiveSummary(\n                                measurements,\n                                true\n                            )\n                            return summary.map(function(item) {\n                                return {\n                                    \"Owner > component\": item.componentName,\n                                    \"Wasted time (ms)\": item.time,\n                                    Instances: item.count\n                                }\n                            })\n                        },\n\n                        printWasted: function(measurements) {\n                            measurements = measurements || ReactDefaultPerf._allMeasurements\n                            console.table(ReactDefaultPerf.getMeasurementsSummaryMap(measurements))\n                            console.log(\n                                \"Total time:\",\n                                ReactDefaultPerfAnalysis.getTotalTime(measurements).toFixed(2) +\n                                    \" ms\"\n                            )\n                        },\n\n                        printDOM: function(measurements) {\n                            measurements = measurements || ReactDefaultPerf._allMeasurements\n                            var summary = ReactDefaultPerfAnalysis.getDOMSummary(measurements)\n                            console.table(\n                                summary.map(function(item) {\n                                    var result = {}\n                                    result[DOMProperty.ID_ATTRIBUTE_NAME] = item.id\n                                    result[\"type\"] = item.type\n                                    result[\"args\"] = JSON.stringify(item.args)\n                                    return result\n                                })\n                            )\n                            console.log(\n                                \"Total time:\",\n                                ReactDefaultPerfAnalysis.getTotalTime(measurements).toFixed(2) +\n                                    \" ms\"\n                            )\n                        },\n\n                        _recordWrite: function(id, fnName, totalTime, args) {\n                            // TODO: totalTime isn't that useful since it doesn't count paints/reflows\n                            var writes =\n                                ReactDefaultPerf._allMeasurements[\n                                    ReactDefaultPerf._allMeasurements.length - 1\n                                ].writes\n                            writes[id] = writes[id] || []\n                            writes[id].push({\n                                type: fnName,\n                                time: totalTime,\n                                args: args\n                            })\n                        },\n\n                        measure: function(moduleName, fnName, func) {\n                            return function() {\n                                for (\n                                    var args = [], $__0 = 0, $__1 = arguments.length;\n                                    $__0 < $__1;\n                                    $__0++\n                                )\n                                    args.push(arguments[$__0])\n                                var totalTime\n                                var rv\n                                var start\n\n                                if (\n                                    fnName === \"_renderNewRootComponent\" ||\n                                    fnName === \"flushBatchedUpdates\"\n                                ) {\n                                    // A \"measurement\" is a set of metrics recorded for each flush. We want\n                                    // to group the metrics for a given flush together so we can look at the\n                                    // components that rendered and the DOM operations that actually\n                                    // happened to determine the amount of \"wasted work\" performed.\n                                    ReactDefaultPerf._allMeasurements.push({\n                                        exclusive: {},\n                                        inclusive: {},\n                                        render: {},\n                                        counts: {},\n                                        writes: {},\n                                        displayNames: {},\n                                        totalTime: 0\n                                    })\n                                    start = performanceNow()\n                                    rv = func.apply(this, args)\n                                    ReactDefaultPerf._allMeasurements[\n                                        ReactDefaultPerf._allMeasurements.length - 1\n                                    ].totalTime = performanceNow() - start\n                                    return rv\n                                } else if (\n                                    fnName === \"_mountImageIntoNode\" ||\n                                    moduleName === \"ReactDOMIDOperations\"\n                                ) {\n                                    start = performanceNow()\n                                    rv = func.apply(this, args)\n                                    totalTime = performanceNow() - start\n\n                                    if (fnName === \"_mountImageIntoNode\") {\n                                        var mountID = ReactMount.getID(args[1])\n                                        ReactDefaultPerf._recordWrite(\n                                            mountID,\n                                            fnName,\n                                            totalTime,\n                                            args[0]\n                                        )\n                                    } else if (fnName === \"dangerouslyProcessChildrenUpdates\") {\n                                        // special format\n                                        args[0].forEach(function(update) {\n                                            var writeArgs = {}\n                                            if (update.fromIndex !== null) {\n                                                writeArgs.fromIndex = update.fromIndex\n                                            }\n                                            if (update.toIndex !== null) {\n                                                writeArgs.toIndex = update.toIndex\n                                            }\n                                            if (update.textContent !== null) {\n                                                writeArgs.textContent = update.textContent\n                                            }\n                                            if (update.markupIndex !== null) {\n                                                writeArgs.markup = args[1][update.markupIndex]\n                                            }\n                                            ReactDefaultPerf._recordWrite(\n                                                update.parentID,\n                                                update.type,\n                                                totalTime,\n                                                writeArgs\n                                            )\n                                        })\n                                    } else {\n                                        // basic format\n                                        ReactDefaultPerf._recordWrite(\n                                            args[0],\n                                            fnName,\n                                            totalTime,\n                                            Array.prototype.slice.call(args, 1)\n                                        )\n                                    }\n                                    return rv\n                                } else if (\n                                    moduleName === \"ReactCompositeComponent\" && // TODO: receiveComponent()?\n                                    (fnName === \"mountComponent\" ||\n                                        fnName === \"updateComponent\" ||\n                                        fnName === \"_renderValidatedComponent\")\n                                ) {\n                                    if (typeof this._currentElement.type === \"string\") {\n                                        return func.apply(this, args)\n                                    }\n\n                                    var rootNodeID =\n                                        fnName === \"mountComponent\" ? args[0] : this._rootNodeID\n                                    var isRender = fnName === \"_renderValidatedComponent\"\n                                    var isMount = fnName === \"mountComponent\"\n\n                                    var mountStack = ReactDefaultPerf._mountStack\n                                    var entry =\n                                        ReactDefaultPerf._allMeasurements[\n                                            ReactDefaultPerf._allMeasurements.length - 1\n                                        ]\n\n                                    if (isRender) {\n                                        addValue(entry.counts, rootNodeID, 1)\n                                    } else if (isMount) {\n                                        mountStack.push(0)\n                                    }\n\n                                    start = performanceNow()\n                                    rv = func.apply(this, args)\n                                    totalTime = performanceNow() - start\n\n                                    if (isRender) {\n                                        addValue(entry.render, rootNodeID, totalTime)\n                                    } else if (isMount) {\n                                        var subMountTime = mountStack.pop()\n                                        mountStack[mountStack.length - 1] += totalTime\n                                        addValue(\n                                            entry.exclusive,\n                                            rootNodeID,\n                                            totalTime - subMountTime\n                                        )\n                                        addValue(entry.inclusive, rootNodeID, totalTime)\n                                    } else {\n                                        addValue(entry.inclusive, rootNodeID, totalTime)\n                                    }\n\n                                    entry.displayNames[rootNodeID] = {\n                                        current: this.getName(),\n                                        owner: this._currentElement._owner\n                                            ? this._currentElement._owner.getName()\n                                            : \"<root>\"\n                                    }\n\n                                    return rv\n                                } else {\n                                    return func.apply(this, args)\n                                }\n                            }\n                        }\n                    }\n\n                    module.exports = ReactDefaultPerf\n                },\n                { \"11\": 11, \"162\": 162, \"62\": 62, \"77\": 77, \"82\": 82 }\n            ],\n            62: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule ReactDefaultPerfAnalysis\n                     */\n\n                    var assign = _dereq_(29)\n\n                    // Don't try to save users less than 1.2ms (a number I made up)\n                    var DONT_CARE_THRESHOLD = 1.2\n                    var DOM_OPERATION_TYPES = {\n                        _mountImageIntoNode: \"set innerHTML\",\n                        INSERT_MARKUP: \"set innerHTML\",\n                        MOVE_EXISTING: \"move\",\n                        REMOVE_NODE: \"remove\",\n                        TEXT_CONTENT: \"set textContent\",\n                        updatePropertyByID: \"update attribute\",\n                        deletePropertyByID: \"delete attribute\",\n                        updateStylesByID: \"update styles\",\n                        updateInnerHTMLByID: \"set innerHTML\",\n                        dangerouslyReplaceNodeWithMarkupByID: \"replace\"\n                    }\n\n                    function getTotalTime(measurements) {\n                        // TODO: return number of DOM ops? could be misleading.\n                        // TODO: measure dropped frames after reconcile?\n                        // TODO: log total time of each reconcile and the top-level component\n                        // class that triggered it.\n                        var totalTime = 0\n                        for (var i = 0; i < measurements.length; i++) {\n                            var measurement = measurements[i]\n                            totalTime += measurement.totalTime\n                        }\n                        return totalTime\n                    }\n\n                    function getDOMSummary(measurements) {\n                        var items = []\n                        for (var i = 0; i < measurements.length; i++) {\n                            var measurement = measurements[i]\n                            var id\n\n                            for (id in measurement.writes) {\n                                measurement.writes[id].forEach(function(write) {\n                                    items.push({\n                                        id: id,\n                                        type: DOM_OPERATION_TYPES[write.type] || write.type,\n                                        args: write.args\n                                    })\n                                })\n                            }\n                        }\n                        return items\n                    }\n\n                    function getExclusiveSummary(measurements) {\n                        var candidates = {}\n                        var displayName\n\n                        for (var i = 0; i < measurements.length; i++) {\n                            var measurement = measurements[i]\n                            var allIDs = assign({}, measurement.exclusive, measurement.inclusive)\n\n                            for (var id in allIDs) {\n                                displayName = measurement.displayNames[id].current\n\n                                candidates[displayName] = candidates[displayName] || {\n                                    componentName: displayName,\n                                    inclusive: 0,\n                                    exclusive: 0,\n                                    render: 0,\n                                    count: 0\n                                }\n                                if (measurement.render[id]) {\n                                    candidates[displayName].render += measurement.render[id]\n                                }\n                                if (measurement.exclusive[id]) {\n                                    candidates[displayName].exclusive += measurement.exclusive[id]\n                                }\n                                if (measurement.inclusive[id]) {\n                                    candidates[displayName].inclusive += measurement.inclusive[id]\n                                }\n                                if (measurement.counts[id]) {\n                                    candidates[displayName].count += measurement.counts[id]\n                                }\n                            }\n                        }\n\n                        // Now make a sorted array with the results.\n                        var arr = []\n                        for (displayName in candidates) {\n                            if (candidates[displayName].exclusive >= DONT_CARE_THRESHOLD) {\n                                arr.push(candidates[displayName])\n                            }\n                        }\n\n                        arr.sort(function(a, b) {\n                            return b.exclusive - a.exclusive\n                        })\n\n                        return arr\n                    }\n\n                    function getInclusiveSummary(measurements, onlyClean) {\n                        var candidates = {}\n                        var inclusiveKey\n\n                        for (var i = 0; i < measurements.length; i++) {\n                            var measurement = measurements[i]\n                            var allIDs = assign({}, measurement.exclusive, measurement.inclusive)\n                            var cleanComponents\n\n                            if (onlyClean) {\n                                cleanComponents = getUnchangedComponents(measurement)\n                            }\n\n                            for (var id in allIDs) {\n                                if (onlyClean && !cleanComponents[id]) {\n                                    continue\n                                }\n\n                                var displayName = measurement.displayNames[id]\n\n                                // Inclusive time is not useful for many components without knowing where\n                                // they are instantiated. So we aggregate inclusive time with both the\n                                // owner and current displayName as the key.\n                                inclusiveKey = displayName.owner + \" > \" + displayName.current\n\n                                candidates[inclusiveKey] = candidates[inclusiveKey] || {\n                                    componentName: inclusiveKey,\n                                    time: 0,\n                                    count: 0\n                                }\n\n                                if (measurement.inclusive[id]) {\n                                    candidates[inclusiveKey].time += measurement.inclusive[id]\n                                }\n                                if (measurement.counts[id]) {\n                                    candidates[inclusiveKey].count += measurement.counts[id]\n                                }\n                            }\n                        }\n\n                        // Now make a sorted array with the results.\n                        var arr = []\n                        for (inclusiveKey in candidates) {\n                            if (candidates[inclusiveKey].time >= DONT_CARE_THRESHOLD) {\n                                arr.push(candidates[inclusiveKey])\n                            }\n                        }\n\n                        arr.sort(function(a, b) {\n                            return b.time - a.time\n                        })\n\n                        return arr\n                    }\n\n                    function getUnchangedComponents(measurement) {\n                        // For a given reconcile, look at which components did not actually\n                        // render anything to the DOM and return a mapping of their ID to\n                        // the amount of time it took to render the entire subtree.\n                        var cleanComponents = {}\n                        var dirtyLeafIDs = Object.keys(measurement.writes)\n                        var allIDs = assign({}, measurement.exclusive, measurement.inclusive)\n\n                        for (var id in allIDs) {\n                            var isDirty = false\n                            // For each component that rendered, see if a component that triggered\n                            // a DOM op is in its subtree.\n                            for (var i = 0; i < dirtyLeafIDs.length; i++) {\n                                if (dirtyLeafIDs[i].indexOf(id) === 0) {\n                                    isDirty = true\n                                    break\n                                }\n                            }\n                            if (!isDirty && measurement.counts[id] > 0) {\n                                cleanComponents[id] = true\n                            }\n                        }\n                        return cleanComponents\n                    }\n\n                    var ReactDefaultPerfAnalysis = {\n                        getExclusiveSummary: getExclusiveSummary,\n                        getInclusiveSummary: getInclusiveSummary,\n                        getDOMSummary: getDOMSummary,\n                        getTotalTime: getTotalTime\n                    }\n\n                    module.exports = ReactDefaultPerfAnalysis\n                },\n                { \"29\": 29 }\n            ],\n            63: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2014-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule ReactElement\n                     */\n\n                    \"use strict\"\n\n                    var ReactContext = _dereq_(44)\n                    var ReactCurrentOwner = _dereq_(45)\n\n                    var assign = _dereq_(29)\n                    var warning = _dereq_(171)\n\n                    var RESERVED_PROPS = {\n                        key: true,\n                        ref: true\n                    }\n\n                    /**\n                     * Warn for mutations.\n                     *\n                     * @internal\n                     * @param {object} object\n                     * @param {string} key\n                     */\n                    function defineWarningProperty(object, key) {\n                        Object.defineProperty(object, key, {\n                            configurable: false,\n                            enumerable: true,\n\n                            get: function() {\n                                if (!this._store) {\n                                    return null\n                                }\n                                return this._store[key]\n                            },\n\n                            set: function(value) {\n                                \"production\" !== \"development\"\n                                    ? warning(\n                                          false,\n                                          \"Don't set the %s property of the React element. Instead, \" +\n                                              \"specify the correct value when initially creating the element.\",\n                                          key\n                                      )\n                                    : null\n                                this._store[key] = value\n                            }\n                        })\n                    }\n\n                    /**\n                     * This is updated to true if the membrane is successfully created.\n                     */\n                    var useMutationMembrane = false\n\n                    /**\n                     * Warn for mutations.\n                     *\n                     * @internal\n                     * @param {object} element\n                     */\n                    function defineMutationMembrane(prototype) {\n                        try {\n                            var pseudoFrozenProperties = {\n                                props: true\n                            }\n                            for (var key in pseudoFrozenProperties) {\n                                defineWarningProperty(prototype, key)\n                            }\n                            useMutationMembrane = true\n                        } catch (x) {\n                            // IE will fail on defineProperty\n                        }\n                    }\n\n                    /**\n                     * Base constructor for all React elements. This is only used to make this\n                     * work with a dynamic instanceof check. Nothing should live on this prototype.\n                     *\n                     * @param {*} type\n                     * @param {string|object} ref\n                     * @param {*} key\n                     * @param {*} props\n                     * @internal\n                     */\n                    var ReactElement = function(type, key, ref, owner, context, props) {\n                        // Built-in properties that belong on the element\n                        this.type = type\n                        this.key = key\n                        this.ref = ref\n\n                        // Record the component responsible for creating this element.\n                        this._owner = owner\n\n                        // TODO: Deprecate withContext, and then the context becomes accessible\n                        // through the owner.\n                        this._context = context\n\n                        if (\"production\" !== \"development\") {\n                            // The validation flag and props are currently mutative. We put them on\n                            // an external backing store so that we can freeze the whole object.\n                            // This can be replaced with a WeakMap once they are implemented in\n                            // commonly used development environments.\n                            this._store = { props: props, originalProps: assign({}, props) }\n\n                            // To make comparing ReactElements easier for testing purposes, we make\n                            // the validation flag non-enumerable (where possible, which should\n                            // include every environment we run tests in), so the test framework\n                            // ignores it.\n                            try {\n                                Object.defineProperty(this._store, \"validated\", {\n                                    configurable: false,\n                                    enumerable: false,\n                                    writable: true\n                                })\n                            } catch (x) {}\n                            this._store.validated = false\n\n                            // We're not allowed to set props directly on the object so we early\n                            // return and rely on the prototype membrane to forward to the backing\n                            // store.\n                            if (useMutationMembrane) {\n                                Object.freeze(this)\n                                return\n                            }\n                        }\n\n                        this.props = props\n                    }\n\n                    // We intentionally don't expose the function on the constructor property.\n                    // ReactElement should be indistinguishable from a plain object.\n                    ReactElement.prototype = {\n                        _isReactElement: true\n                    }\n\n                    if (\"production\" !== \"development\") {\n                        defineMutationMembrane(ReactElement.prototype)\n                    }\n\n                    ReactElement.createElement = function(type, config, children) {\n                        var propName\n\n                        // Reserved names are extracted\n                        var props = {}\n\n                        var key = null\n                        var ref = null\n\n                        if (config != null) {\n                            ref = config.ref === undefined ? null : config.ref\n                            key = config.key === undefined ? null : \"\" + config.key\n                            // Remaining properties are added to a new props object\n                            for (propName in config) {\n                                if (\n                                    config.hasOwnProperty(propName) &&\n                                    !RESERVED_PROPS.hasOwnProperty(propName)\n                                ) {\n                                    props[propName] = config[propName]\n                                }\n                            }\n                        }\n\n                        // Children can be more than one argument, and those are transferred onto\n                        // the newly allocated props object.\n                        var childrenLength = arguments.length - 2\n                        if (childrenLength === 1) {\n                            props.children = children\n                        } else if (childrenLength > 1) {\n                            var childArray = Array(childrenLength)\n                            for (var i = 0; i < childrenLength; i++) {\n                                childArray[i] = arguments[i + 2]\n                            }\n                            props.children = childArray\n                        }\n\n                        // Resolve default props\n                        if (type && type.defaultProps) {\n                            var defaultProps = type.defaultProps\n                            for (propName in defaultProps) {\n                                if (typeof props[propName] === \"undefined\") {\n                                    props[propName] = defaultProps[propName]\n                                }\n                            }\n                        }\n\n                        return new ReactElement(\n                            type,\n                            key,\n                            ref,\n                            ReactCurrentOwner.current,\n                            ReactContext.current,\n                            props\n                        )\n                    }\n\n                    ReactElement.createFactory = function(type) {\n                        var factory = ReactElement.createElement.bind(null, type)\n                        // Expose the type on the factory and the prototype so that it can be\n                        // easily accessed on elements. E.g. <Foo />.type === Foo.type.\n                        // This should not be named `constructor` since this may not be the function\n                        // that created the element, and it may not even be a constructor.\n                        // Legacy hook TODO: Warn if this is accessed\n                        factory.type = type\n                        return factory\n                    }\n\n                    ReactElement.cloneAndReplaceProps = function(oldElement, newProps) {\n                        var newElement = new ReactElement(\n                            oldElement.type,\n                            oldElement.key,\n                            oldElement.ref,\n                            oldElement._owner,\n                            oldElement._context,\n                            newProps\n                        )\n\n                        if (\"production\" !== \"development\") {\n                            // If the key on the original is valid, then the clone is valid\n                            newElement._store.validated = oldElement._store.validated\n                        }\n                        return newElement\n                    }\n\n                    ReactElement.cloneElement = function(element, config, children) {\n                        var propName\n\n                        // Original props are copied\n                        var props = assign({}, element.props)\n\n                        // Reserved names are extracted\n                        var key = element.key\n                        var ref = element.ref\n\n                        // Owner will be preserved, unless ref is overridden\n                        var owner = element._owner\n\n                        if (config != null) {\n                            if (config.ref !== undefined) {\n                                // Silently steal the ref from the parent.\n                                ref = config.ref\n                                owner = ReactCurrentOwner.current\n                            }\n                            if (config.key !== undefined) {\n                                key = \"\" + config.key\n                            }\n                            // Remaining properties override existing props\n                            for (propName in config) {\n                                if (\n                                    config.hasOwnProperty(propName) &&\n                                    !RESERVED_PROPS.hasOwnProperty(propName)\n                                ) {\n                                    props[propName] = config[propName]\n                                }\n                            }\n                        }\n\n                        // Children can be more than one argument, and those are transferred onto\n                        // the newly allocated props object.\n                        var childrenLength = arguments.length - 2\n                        if (childrenLength === 1) {\n                            props.children = children\n                        } else if (childrenLength > 1) {\n                            var childArray = Array(childrenLength)\n                            for (var i = 0; i < childrenLength; i++) {\n                                childArray[i] = arguments[i + 2]\n                            }\n                            props.children = childArray\n                        }\n\n                        return new ReactElement(\n                            element.type,\n                            key,\n                            ref,\n                            owner,\n                            element._context,\n                            props\n                        )\n                    }\n\n                    /**\n                     * @param {?object} object\n                     * @return {boolean} True if `object` is a valid component.\n                     * @final\n                     */\n                    ReactElement.isValidElement = function(object) {\n                        // ReactTestUtils is often used outside of beforeEach where as React is\n                        // within it. This leads to two different instances of React on the same\n                        // page. To identify a element from a different React instance we use\n                        // a flag instead of an instanceof check.\n                        var isElement = !!(object && object._isReactElement)\n                        // if (isElement && !(object instanceof ReactElement)) {\n                        // This is an indicator that you're using multiple versions of React at the\n                        // same time. This will screw with ownership and stuff. Fix it, please.\n                        // TODO: We could possibly warn here.\n                        // }\n                        return isElement\n                    }\n\n                    module.exports = ReactElement\n                },\n                { \"171\": 171, \"29\": 29, \"44\": 44, \"45\": 45 }\n            ],\n            64: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2014-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule ReactElementValidator\n                     */\n\n                    /**\n                     * ReactElementValidator provides a wrapper around a element factory\n                     * which validates the props passed to the element. This is intended to be\n                     * used only in DEV and could be replaced by a static type checker for languages\n                     * that support it.\n                     */\n\n                    \"use strict\"\n\n                    var ReactElement = _dereq_(63)\n                    var ReactFragment = _dereq_(69)\n                    var ReactPropTypeLocations = _dereq_(85)\n                    var ReactPropTypeLocationNames = _dereq_(84)\n                    var ReactCurrentOwner = _dereq_(45)\n                    var ReactNativeComponent = _dereq_(80)\n\n                    var getIteratorFn = _dereq_(141)\n                    var invariant = _dereq_(150)\n                    var warning = _dereq_(171)\n\n                    function getDeclarationErrorAddendum() {\n                        if (ReactCurrentOwner.current) {\n                            var name = ReactCurrentOwner.current.getName()\n                            if (name) {\n                                return \" Check the render method of `\" + name + \"`.\"\n                            }\n                        }\n                        return \"\"\n                    }\n\n                    /**\n                     * Warn if there's no key explicitly set on dynamic arrays of children or\n                     * object keys are not valid. This allows us to keep track of children between\n                     * updates.\n                     */\n                    var ownerHasKeyUseWarning = {}\n\n                    var loggedTypeFailures = {}\n\n                    var NUMERIC_PROPERTY_REGEX = /^\\d+$/\n\n                    /**\n                     * Gets the instance's name for use in warnings.\n                     *\n                     * @internal\n                     * @return {?string} Display name or undefined\n                     */\n                    function getName(instance) {\n                        var publicInstance = instance && instance.getPublicInstance()\n                        if (!publicInstance) {\n                            return undefined\n                        }\n                        var constructor = publicInstance.constructor\n                        if (!constructor) {\n                            return undefined\n                        }\n                        return constructor.displayName || constructor.name || undefined\n                    }\n\n                    /**\n                     * Gets the current owner's displayName for use in warnings.\n                     *\n                     * @internal\n                     * @return {?string} Display name or undefined\n                     */\n                    function getCurrentOwnerDisplayName() {\n                        var current = ReactCurrentOwner.current\n                        return (current && getName(current)) || undefined\n                    }\n\n                    /**\n                     * Warn if the element doesn't have an explicit key assigned to it.\n                     * This element is in an array. The array could grow and shrink or be\n                     * reordered. All children that haven't already been validated are required to\n                     * have a \"key\" property assigned to it.\n                     *\n                     * @internal\n                     * @param {ReactElement} element Element that requires a key.\n                     * @param {*} parentType element's parent's type.\n                     */\n                    function validateExplicitKey(element, parentType) {\n                        if (element._store.validated || element.key != null) {\n                            return\n                        }\n                        element._store.validated = true\n\n                        warnAndMonitorForKeyUse(\n                            'Each child in an array or iterator should have a unique \"key\" prop.',\n                            element,\n                            parentType\n                        )\n                    }\n\n                    /**\n                     * Warn if the key is being defined as an object property but has an incorrect\n                     * value.\n                     *\n                     * @internal\n                     * @param {string} name Property name of the key.\n                     * @param {ReactElement} element Component that requires a key.\n                     * @param {*} parentType element's parent's type.\n                     */\n                    function validatePropertyKey(name, element, parentType) {\n                        if (!NUMERIC_PROPERTY_REGEX.test(name)) {\n                            return\n                        }\n                        warnAndMonitorForKeyUse(\n                            \"Child objects should have non-numeric keys so ordering is preserved.\",\n                            element,\n                            parentType\n                        )\n                    }\n\n                    /**\n                     * Shared warning and monitoring code for the key warnings.\n                     *\n                     * @internal\n                     * @param {string} message The base warning that gets output.\n                     * @param {ReactElement} element Component that requires a key.\n                     * @param {*} parentType element's parent's type.\n                     */\n                    function warnAndMonitorForKeyUse(message, element, parentType) {\n                        var ownerName = getCurrentOwnerDisplayName()\n                        var parentName =\n                            typeof parentType === \"string\"\n                                ? parentType\n                                : parentType.displayName || parentType.name\n\n                        var useName = ownerName || parentName\n                        var memoizer =\n                            ownerHasKeyUseWarning[message] || (ownerHasKeyUseWarning[message] = {})\n                        if (memoizer.hasOwnProperty(useName)) {\n                            return\n                        }\n                        memoizer[useName] = true\n\n                        var parentOrOwnerAddendum = ownerName\n                            ? \" Check the render method of \" + ownerName + \".\"\n                            : parentName\n                            ? \" Check the React.render call using <\" + parentName + \">.\"\n                            : \"\"\n\n                        // Usually the current owner is the offender, but if it accepts children as a\n                        // property, it may be the creator of the child that's responsible for\n                        // assigning it a key.\n                        var childOwnerAddendum = \"\"\n                        if (\n                            element &&\n                            element._owner &&\n                            element._owner !== ReactCurrentOwner.current\n                        ) {\n                            // Name of the component that originally created this child.\n                            var childOwnerName = getName(element._owner)\n\n                            childOwnerAddendum =\n                                \" It was passed a child from \" + childOwnerName + \".\"\n                        }\n\n                        \"production\" !== \"development\"\n                            ? warning(\n                                  false,\n                                  message +\n                                      \"%s%s See https://fb.me/react-warning-keys for more information.\",\n                                  parentOrOwnerAddendum,\n                                  childOwnerAddendum\n                              )\n                            : null\n                    }\n\n                    /**\n                     * Ensure that every element either is passed in a static location, in an\n                     * array with an explicit keys property defined, or in an object literal\n                     * with valid key property.\n                     *\n                     * @internal\n                     * @param {ReactNode} node Statically passed child of any type.\n                     * @param {*} parentType node's parent's type.\n                     */\n                    function validateChildKeys(node, parentType) {\n                        if (Array.isArray(node)) {\n                            for (var i = 0; i < node.length; i++) {\n                                var child = node[i]\n                                if (ReactElement.isValidElement(child)) {\n                                    validateExplicitKey(child, parentType)\n                                }\n                            }\n                        } else if (ReactElement.isValidElement(node)) {\n                            // This element was passed in a valid location.\n                            node._store.validated = true\n                        } else if (node) {\n                            var iteratorFn = getIteratorFn(node)\n                            // Entry iterators provide implicit keys.\n                            if (iteratorFn) {\n                                if (iteratorFn !== node.entries) {\n                                    var iterator = iteratorFn.call(node)\n                                    var step\n                                    while (!(step = iterator.next()).done) {\n                                        if (ReactElement.isValidElement(step.value)) {\n                                            validateExplicitKey(step.value, parentType)\n                                        }\n                                    }\n                                }\n                            } else if (typeof node === \"object\") {\n                                var fragment = ReactFragment.extractIfFragment(node)\n                                for (var key in fragment) {\n                                    if (fragment.hasOwnProperty(key)) {\n                                        validatePropertyKey(key, fragment[key], parentType)\n                                    }\n                                }\n                            }\n                        }\n                    }\n\n                    /**\n                     * Assert that the props are valid\n                     *\n                     * @param {string} componentName Name of the component for error messages.\n                     * @param {object} propTypes Map of prop name to a ReactPropType\n                     * @param {object} props\n                     * @param {string} location e.g. \"prop\", \"context\", \"child context\"\n                     * @private\n                     */\n                    function checkPropTypes(componentName, propTypes, props, location) {\n                        for (var propName in propTypes) {\n                            if (propTypes.hasOwnProperty(propName)) {\n                                var error\n                                // Prop type validation may throw. In case they do, we don't want to\n                                // fail the render phase where it didn't fail before. So we log it.\n                                // After these have been cleaned up, we'll let them throw.\n                                try {\n                                    // This is intentionally an invariant that gets caught. It's the same\n                                    // behavior as without this statement except with a better message.\n                                    \"production\" !== \"development\"\n                                        ? invariant(\n                                              typeof propTypes[propName] === \"function\",\n                                              \"%s: %s type `%s` is invalid; it must be a function, usually from \" +\n                                                  \"React.PropTypes.\",\n                                              componentName || \"React class\",\n                                              ReactPropTypeLocationNames[location],\n                                              propName\n                                          )\n                                        : invariant(typeof propTypes[propName] === \"function\")\n                                    error = propTypes[propName](\n                                        props,\n                                        propName,\n                                        componentName,\n                                        location\n                                    )\n                                } catch (ex) {\n                                    error = ex\n                                }\n                                if (\n                                    error instanceof Error &&\n                                    !(error.message in loggedTypeFailures)\n                                ) {\n                                    // Only monitor this failure once because there tends to be a lot of the\n                                    // same error.\n                                    loggedTypeFailures[error.message] = true\n\n                                    var addendum = getDeclarationErrorAddendum(this)\n                                    \"production\" !== \"development\"\n                                        ? warning(\n                                              false,\n                                              \"Failed propType: %s%s\",\n                                              error.message,\n                                              addendum\n                                          )\n                                        : null\n                                }\n                            }\n                        }\n                    }\n\n                    var warnedPropsMutations = {}\n\n                    /**\n                     * Warn about mutating props when setting `propName` on `element`.\n                     *\n                     * @param {string} propName The string key within props that was set\n                     * @param {ReactElement} element\n                     */\n                    function warnForPropsMutation(propName, element) {\n                        var type = element.type\n                        var elementName = typeof type === \"string\" ? type : type.displayName\n                        var ownerName = element._owner\n                            ? element._owner.getPublicInstance().constructor.displayName\n                            : null\n\n                        var warningKey = propName + \"|\" + elementName + \"|\" + ownerName\n                        if (warnedPropsMutations.hasOwnProperty(warningKey)) {\n                            return\n                        }\n                        warnedPropsMutations[warningKey] = true\n\n                        var elementInfo = \"\"\n                        if (elementName) {\n                            elementInfo = \" <\" + elementName + \" />\"\n                        }\n                        var ownerInfo = \"\"\n                        if (ownerName) {\n                            ownerInfo = \" The element was created by \" + ownerName + \".\"\n                        }\n\n                        \"production\" !== \"development\"\n                            ? warning(\n                                  false,\n                                  \"Don't set .props.%s of the React component%s. Instead, specify the \" +\n                                      \"correct value when initially creating the element or use \" +\n                                      \"React.cloneElement to make a new element with updated props.%s\",\n                                  propName,\n                                  elementInfo,\n                                  ownerInfo\n                              )\n                            : null\n                    }\n\n                    // Inline Object.is polyfill\n                    function is(a, b) {\n                        if (a !== a) {\n                            // NaN\n                            return b !== b\n                        }\n                        if (a === 0 && b === 0) {\n                            // +-0\n                            return 1 / a === 1 / b\n                        }\n                        return a === b\n                    }\n\n                    /**\n                     * Given an element, check if its props have been mutated since element\n                     * creation (or the last call to this function). In particular, check if any\n                     * new props have been added, which we can't directly catch by defining warning\n                     * properties on the props object.\n                     *\n                     * @param {ReactElement} element\n                     */\n                    function checkAndWarnForMutatedProps(element) {\n                        if (!element._store) {\n                            // Element was created using `new ReactElement` directly or with\n                            // `ReactElement.createElement`; skip mutation checking\n                            return\n                        }\n\n                        var originalProps = element._store.originalProps\n                        var props = element.props\n\n                        for (var propName in props) {\n                            if (props.hasOwnProperty(propName)) {\n                                if (\n                                    !originalProps.hasOwnProperty(propName) ||\n                                    !is(originalProps[propName], props[propName])\n                                ) {\n                                    warnForPropsMutation(propName, element)\n\n                                    // Copy over the new value so that the two props objects match again\n                                    originalProps[propName] = props[propName]\n                                }\n                            }\n                        }\n                    }\n\n                    /**\n                     * Given an element, validate that its props follow the propTypes definition,\n                     * provided by the type.\n                     *\n                     * @param {ReactElement} element\n                     */\n                    function validatePropTypes(element) {\n                        if (element.type == null) {\n                            // This has already warned. Don't throw.\n                            return\n                        }\n                        // Extract the component class from the element. Converts string types\n                        // to a composite class which may have propTypes.\n                        // TODO: Validating a string's propTypes is not decoupled from the\n                        // rendering target which is problematic.\n                        var componentClass = ReactNativeComponent.getComponentClassForElement(\n                            element\n                        )\n                        var name = componentClass.displayName || componentClass.name\n                        if (componentClass.propTypes) {\n                            checkPropTypes(\n                                name,\n                                componentClass.propTypes,\n                                element.props,\n                                ReactPropTypeLocations.prop\n                            )\n                        }\n                        if (typeof componentClass.getDefaultProps === \"function\") {\n                            \"production\" !== \"development\"\n                                ? warning(\n                                      componentClass.getDefaultProps.isReactClassApproved,\n                                      \"getDefaultProps is only used on classic React.createClass \" +\n                                          \"definitions. Use a static property named `defaultProps` instead.\"\n                                  )\n                                : null\n                        }\n                    }\n\n                    var ReactElementValidator = {\n                        checkAndWarnForMutatedProps: checkAndWarnForMutatedProps,\n\n                        createElement: function(type, props, children) {\n                            // We warn in this case but don't throw. We expect the element creation to\n                            // succeed and there will likely be errors in render.\n                            \"production\" !== \"development\"\n                                ? warning(\n                                      type != null,\n                                      \"React.createElement: type should not be null or undefined. It should \" +\n                                          \"be a string (for DOM elements) or a ReactClass (for composite \" +\n                                          \"components).\"\n                                  )\n                                : null\n\n                            var element = ReactElement.createElement.apply(this, arguments)\n\n                            // The result can be nullish if a mock or a custom function is used.\n                            // TODO: Drop this when these are no longer allowed as the type argument.\n                            if (element == null) {\n                                return element\n                            }\n\n                            for (var i = 2; i < arguments.length; i++) {\n                                validateChildKeys(arguments[i], type)\n                            }\n\n                            validatePropTypes(element)\n\n                            return element\n                        },\n\n                        createFactory: function(type) {\n                            var validatedFactory = ReactElementValidator.createElement.bind(\n                                null,\n                                type\n                            )\n                            // Legacy hook TODO: Warn if this is accessed\n                            validatedFactory.type = type\n\n                            if (\"production\" !== \"development\") {\n                                try {\n                                    Object.defineProperty(validatedFactory, \"type\", {\n                                        enumerable: false,\n                                        get: function() {\n                                            \"production\" !== \"development\"\n                                                ? warning(\n                                                      false,\n                                                      \"Factory.type is deprecated. Access the class directly \" +\n                                                          \"before passing it to createFactory.\"\n                                                  )\n                                                : null\n                                            Object.defineProperty(this, \"type\", {\n                                                value: type\n                                            })\n                                            return type\n                                        }\n                                    })\n                                } catch (x) {\n                                    // IE will fail on defineProperty (es5-shim/sham too)\n                                }\n                            }\n\n                            return validatedFactory\n                        },\n\n                        cloneElement: function(element, props, children) {\n                            var newElement = ReactElement.cloneElement.apply(this, arguments)\n                            for (var i = 2; i < arguments.length; i++) {\n                                validateChildKeys(arguments[i], newElement.type)\n                            }\n                            validatePropTypes(newElement)\n                            return newElement\n                        }\n                    }\n\n                    module.exports = ReactElementValidator\n                },\n                {\n                    \"141\": 141,\n                    \"150\": 150,\n                    \"171\": 171,\n                    \"45\": 45,\n                    \"63\": 63,\n                    \"69\": 69,\n                    \"80\": 80,\n                    \"84\": 84,\n                    \"85\": 85\n                }\n            ],\n            65: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2014-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule ReactEmptyComponent\n                     */\n\n                    \"use strict\"\n\n                    var ReactElement = _dereq_(63)\n                    var ReactInstanceMap = _dereq_(73)\n\n                    var invariant = _dereq_(150)\n\n                    var component\n                    // This registry keeps track of the React IDs of the components that rendered to\n                    // `null` (in reality a placeholder such as `noscript`)\n                    var nullComponentIDsRegistry = {}\n\n                    var ReactEmptyComponentInjection = {\n                        injectEmptyComponent: function(emptyComponent) {\n                            component = ReactElement.createFactory(emptyComponent)\n                        }\n                    }\n\n                    var ReactEmptyComponentType = function() {}\n                    ReactEmptyComponentType.prototype.componentDidMount = function() {\n                        var internalInstance = ReactInstanceMap.get(this)\n                        // TODO: Make sure we run these methods in the correct order, we shouldn't\n                        // need this check. We're going to assume if we're here it means we ran\n                        // componentWillUnmount already so there is no internal instance (it gets\n                        // removed as part of the unmounting process).\n                        if (!internalInstance) {\n                            return\n                        }\n                        registerNullComponentID(internalInstance._rootNodeID)\n                    }\n                    ReactEmptyComponentType.prototype.componentWillUnmount = function() {\n                        var internalInstance = ReactInstanceMap.get(this)\n                        // TODO: Get rid of this check. See TODO in componentDidMount.\n                        if (!internalInstance) {\n                            return\n                        }\n                        deregisterNullComponentID(internalInstance._rootNodeID)\n                    }\n                    ReactEmptyComponentType.prototype.render = function() {\n                        \"production\" !== \"development\"\n                            ? invariant(\n                                  component,\n                                  \"Trying to return null from a render, but no null placeholder component \" +\n                                      \"was injected.\"\n                              )\n                            : invariant(component)\n                        return component()\n                    }\n\n                    var emptyElement = ReactElement.createElement(ReactEmptyComponentType)\n\n                    /**\n                     * Mark the component as having rendered to null.\n                     * @param {string} id Component's `_rootNodeID`.\n                     */\n                    function registerNullComponentID(id) {\n                        nullComponentIDsRegistry[id] = true\n                    }\n\n                    /**\n                     * Unmark the component as having rendered to null: it renders to something now.\n                     * @param {string} id Component's `_rootNodeID`.\n                     */\n                    function deregisterNullComponentID(id) {\n                        delete nullComponentIDsRegistry[id]\n                    }\n\n                    /**\n                     * @param {string} id Component's `_rootNodeID`.\n                     * @return {boolean} True if the component is rendered to null.\n                     */\n                    function isNullComponentID(id) {\n                        return !!nullComponentIDsRegistry[id]\n                    }\n\n                    var ReactEmptyComponent = {\n                        emptyElement: emptyElement,\n                        injection: ReactEmptyComponentInjection,\n                        isNullComponentID: isNullComponentID\n                    }\n\n                    module.exports = ReactEmptyComponent\n                },\n                { \"150\": 150, \"63\": 63, \"73\": 73 }\n            ],\n            66: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule ReactErrorUtils\n                     * @typechecks\n                     */\n\n                    \"use strict\"\n\n                    var ReactErrorUtils = {\n                        /**\n                         * Creates a guarded version of a function. This is supposed to make debugging\n                         * of event handlers easier. To aid debugging with the browser's debugger,\n                         * this currently simply returns the original function.\n                         *\n                         * @param {function} func Function to be executed\n                         * @param {string} name The name of the guard\n                         * @return {function}\n                         */\n                        guard: function(func, name) {\n                            return func\n                        }\n                    }\n\n                    module.exports = ReactErrorUtils\n                },\n                {}\n            ],\n            67: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule ReactEventEmitterMixin\n                     */\n\n                    \"use strict\"\n\n                    var EventPluginHub = _dereq_(18)\n\n                    function runEventQueueInBatch(events) {\n                        EventPluginHub.enqueueEvents(events)\n                        EventPluginHub.processEventQueue()\n                    }\n\n                    var ReactEventEmitterMixin = {\n                        /**\n                         * Streams a fired top-level event to `EventPluginHub` where plugins have the\n                         * opportunity to create `ReactEvent`s to be dispatched.\n                         *\n                         * @param {string} topLevelType Record from `EventConstants`.\n                         * @param {object} topLevelTarget The listening component root node.\n                         * @param {string} topLevelTargetID ID of `topLevelTarget`.\n                         * @param {object} nativeEvent Native environment event.\n                         */\n                        handleTopLevel: function(\n                            topLevelType,\n                            topLevelTarget,\n                            topLevelTargetID,\n                            nativeEvent\n                        ) {\n                            var events = EventPluginHub.extractEvents(\n                                topLevelType,\n                                topLevelTarget,\n                                topLevelTargetID,\n                                nativeEvent\n                            )\n\n                            runEventQueueInBatch(events)\n                        }\n                    }\n\n                    module.exports = ReactEventEmitterMixin\n                },\n                { \"18\": 18 }\n            ],\n            68: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule ReactEventListener\n                     * @typechecks static-only\n                     */\n\n                    \"use strict\"\n\n                    var EventListener = _dereq_(17)\n                    var ExecutionEnvironment = _dereq_(22)\n                    var PooledClass = _dereq_(30)\n                    var ReactInstanceHandles = _dereq_(72)\n                    var ReactMount = _dereq_(77)\n                    var ReactUpdates = _dereq_(100)\n\n                    var assign = _dereq_(29)\n                    var getEventTarget = _dereq_(140)\n                    var getUnboundedScrollPosition = _dereq_(146)\n\n                    /**\n                     * Finds the parent React component of `node`.\n                     *\n                     * @param {*} node\n                     * @return {?DOMEventTarget} Parent container, or `null` if the specified node\n                     *                           is not nested.\n                     */\n                    function findParent(node) {\n                        // TODO: It may be a good idea to cache this to prevent unnecessary DOM\n                        // traversal, but caching is difficult to do correctly without using a\n                        // mutation observer to listen for all DOM changes.\n                        var nodeID = ReactMount.getID(node)\n                        var rootID = ReactInstanceHandles.getReactRootIDFromNodeID(nodeID)\n                        var container = ReactMount.findReactContainerForID(rootID)\n                        var parent = ReactMount.getFirstReactDOM(container)\n                        return parent\n                    }\n\n                    // Used to store ancestor hierarchy in top level callback\n                    function TopLevelCallbackBookKeeping(topLevelType, nativeEvent) {\n                        this.topLevelType = topLevelType\n                        this.nativeEvent = nativeEvent\n                        this.ancestors = []\n                    }\n                    assign(TopLevelCallbackBookKeeping.prototype, {\n                        destructor: function() {\n                            this.topLevelType = null\n                            this.nativeEvent = null\n                            this.ancestors.length = 0\n                        }\n                    })\n                    PooledClass.addPoolingTo(\n                        TopLevelCallbackBookKeeping,\n                        PooledClass.twoArgumentPooler\n                    )\n\n                    function handleTopLevelImpl(bookKeeping) {\n                        var topLevelTarget =\n                            ReactMount.getFirstReactDOM(getEventTarget(bookKeeping.nativeEvent)) ||\n                            window\n\n                        // Loop through the hierarchy, in case there's any nested components.\n                        // It's important that we build the array of ancestors before calling any\n                        // event handlers, because event handlers can modify the DOM, leading to\n                        // inconsistencies with ReactMount's node cache. See #1105.\n                        var ancestor = topLevelTarget\n                        while (ancestor) {\n                            bookKeeping.ancestors.push(ancestor)\n                            ancestor = findParent(ancestor)\n                        }\n\n                        for (var i = 0, l = bookKeeping.ancestors.length; i < l; i++) {\n                            topLevelTarget = bookKeeping.ancestors[i]\n                            var topLevelTargetID = ReactMount.getID(topLevelTarget) || \"\"\n                            ReactEventListener._handleTopLevel(\n                                bookKeeping.topLevelType,\n                                topLevelTarget,\n                                topLevelTargetID,\n                                bookKeeping.nativeEvent\n                            )\n                        }\n                    }\n\n                    function scrollValueMonitor(cb) {\n                        var scrollPosition = getUnboundedScrollPosition(window)\n                        cb(scrollPosition)\n                    }\n\n                    var ReactEventListener = {\n                        _enabled: true,\n                        _handleTopLevel: null,\n\n                        WINDOW_HANDLE: ExecutionEnvironment.canUseDOM ? window : null,\n\n                        setHandleTopLevel: function(handleTopLevel) {\n                            ReactEventListener._handleTopLevel = handleTopLevel\n                        },\n\n                        setEnabled: function(enabled) {\n                            ReactEventListener._enabled = !!enabled\n                        },\n\n                        isEnabled: function() {\n                            return ReactEventListener._enabled\n                        },\n\n                        /**\n                         * Traps top-level events by using event bubbling.\n                         *\n                         * @param {string} topLevelType Record from `EventConstants`.\n                         * @param {string} handlerBaseName Event name (e.g. \"click\").\n                         * @param {object} handle Element on which to attach listener.\n                         * @return {object} An object with a remove function which will forcefully\n                         *                  remove the listener.\n                         * @internal\n                         */\n                        trapBubbledEvent: function(topLevelType, handlerBaseName, handle) {\n                            var element = handle\n                            if (!element) {\n                                return null\n                            }\n                            return EventListener.listen(\n                                element,\n                                handlerBaseName,\n                                ReactEventListener.dispatchEvent.bind(null, topLevelType)\n                            )\n                        },\n\n                        /**\n                         * Traps a top-level event by using event capturing.\n                         *\n                         * @param {string} topLevelType Record from `EventConstants`.\n                         * @param {string} handlerBaseName Event name (e.g. \"click\").\n                         * @param {object} handle Element on which to attach listener.\n                         * @return {object} An object with a remove function which will forcefully\n                         *                  remove the listener.\n                         * @internal\n                         */\n                        trapCapturedEvent: function(topLevelType, handlerBaseName, handle) {\n                            var element = handle\n                            if (!element) {\n                                return null\n                            }\n                            return EventListener.capture(\n                                element,\n                                handlerBaseName,\n                                ReactEventListener.dispatchEvent.bind(null, topLevelType)\n                            )\n                        },\n\n                        monitorScrollValue: function(refresh) {\n                            var callback = scrollValueMonitor.bind(null, refresh)\n                            EventListener.listen(window, \"scroll\", callback)\n                        },\n\n                        dispatchEvent: function(topLevelType, nativeEvent) {\n                            if (!ReactEventListener._enabled) {\n                                return\n                            }\n\n                            var bookKeeping = TopLevelCallbackBookKeeping.getPooled(\n                                topLevelType,\n                                nativeEvent\n                            )\n                            try {\n                                // Event queue being processed in the same cycle allows\n                                // `preventDefault`.\n                                ReactUpdates.batchedUpdates(handleTopLevelImpl, bookKeeping)\n                            } finally {\n                                TopLevelCallbackBookKeeping.release(bookKeeping)\n                            }\n                        }\n                    }\n\n                    module.exports = ReactEventListener\n                },\n                {\n                    \"100\": 100,\n                    \"140\": 140,\n                    \"146\": 146,\n                    \"17\": 17,\n                    \"22\": 22,\n                    \"29\": 29,\n                    \"30\": 30,\n                    \"72\": 72,\n                    \"77\": 77\n                }\n            ],\n            69: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule ReactFragment\n                     */\n\n                    \"use strict\"\n\n                    var ReactElement = _dereq_(63)\n\n                    var warning = _dereq_(171)\n\n                    /**\n                     * We used to allow keyed objects to serve as a collection of ReactElements,\n                     * or nested sets. This allowed us a way to explicitly key a set a fragment of\n                     * components. This is now being replaced with an opaque data structure.\n                     * The upgrade path is to call React.addons.createFragment({ key: value }) to\n                     * create a keyed fragment. The resulting data structure is opaque, for now.\n                     */\n\n                    if (\"production\" !== \"development\") {\n                        var fragmentKey = \"_reactFragment\"\n                        var didWarnKey = \"_reactDidWarn\"\n                        var canWarnForReactFragment = false\n\n                        try {\n                            // Feature test. Don't even try to issue this warning if we can't use\n                            // enumerable: false.\n\n                            var dummy = function() {\n                                return 1\n                            }\n\n                            Object.defineProperty({}, fragmentKey, {\n                                enumerable: false,\n                                value: true\n                            })\n\n                            Object.defineProperty({}, \"key\", { enumerable: true, get: dummy })\n\n                            canWarnForReactFragment = true\n                        } catch (x) {}\n\n                        var proxyPropertyAccessWithWarning = function(obj, key) {\n                            Object.defineProperty(obj, key, {\n                                enumerable: true,\n                                get: function() {\n                                    \"production\" !== \"development\"\n                                        ? warning(\n                                              this[didWarnKey],\n                                              \"A ReactFragment is an opaque type. Accessing any of its \" +\n                                                  \"properties is deprecated. Pass it to one of the React.Children \" +\n                                                  \"helpers.\"\n                                          )\n                                        : null\n                                    this[didWarnKey] = true\n                                    return this[fragmentKey][key]\n                                },\n                                set: function(value) {\n                                    \"production\" !== \"development\"\n                                        ? warning(\n                                              this[didWarnKey],\n                                              \"A ReactFragment is an immutable opaque type. Mutating its \" +\n                                                  \"properties is deprecated.\"\n                                          )\n                                        : null\n                                    this[didWarnKey] = true\n                                    this[fragmentKey][key] = value\n                                }\n                            })\n                        }\n\n                        var issuedWarnings = {}\n\n                        var didWarnForFragment = function(fragment) {\n                            // We use the keys and the type of the value as a heuristic to dedupe the\n                            // warning to avoid spamming too much.\n                            var fragmentCacheKey = \"\"\n                            for (var key in fragment) {\n                                fragmentCacheKey += key + \":\" + typeof fragment[key] + \",\"\n                            }\n                            var alreadyWarnedOnce = !!issuedWarnings[fragmentCacheKey]\n                            issuedWarnings[fragmentCacheKey] = true\n                            return alreadyWarnedOnce\n                        }\n                    }\n\n                    var ReactFragment = {\n                        // Wrap a keyed object in an opaque proxy that warns you if you access any\n                        // of its properties.\n                        create: function(object) {\n                            if (\"production\" !== \"development\") {\n                                if (\n                                    typeof object !== \"object\" ||\n                                    !object ||\n                                    Array.isArray(object)\n                                ) {\n                                    \"production\" !== \"development\"\n                                        ? warning(\n                                              false,\n                                              \"React.addons.createFragment only accepts a single object.\",\n                                              object\n                                          )\n                                        : null\n                                    return object\n                                }\n                                if (ReactElement.isValidElement(object)) {\n                                    \"production\" !== \"development\"\n                                        ? warning(\n                                              false,\n                                              \"React.addons.createFragment does not accept a ReactElement \" +\n                                                  \"without a wrapper object.\"\n                                          )\n                                        : null\n                                    return object\n                                }\n                                if (canWarnForReactFragment) {\n                                    var proxy = {}\n                                    Object.defineProperty(proxy, fragmentKey, {\n                                        enumerable: false,\n                                        value: object\n                                    })\n                                    Object.defineProperty(proxy, didWarnKey, {\n                                        writable: true,\n                                        enumerable: false,\n                                        value: false\n                                    })\n                                    for (var key in object) {\n                                        proxyPropertyAccessWithWarning(proxy, key)\n                                    }\n                                    Object.preventExtensions(proxy)\n                                    return proxy\n                                }\n                            }\n                            return object\n                        },\n                        // Extract the original keyed object from the fragment opaque type. Warn if\n                        // a plain object is passed here.\n                        extract: function(fragment) {\n                            if (\"production\" !== \"development\") {\n                                if (canWarnForReactFragment) {\n                                    if (!fragment[fragmentKey]) {\n                                        \"production\" !== \"development\"\n                                            ? warning(\n                                                  didWarnForFragment(fragment),\n                                                  \"Any use of a keyed object should be wrapped in \" +\n                                                      \"React.addons.createFragment(object) before being passed as a \" +\n                                                      \"child.\"\n                                              )\n                                            : null\n                                        return fragment\n                                    }\n                                    return fragment[fragmentKey]\n                                }\n                            }\n                            return fragment\n                        },\n                        // Check if this is a fragment and if so, extract the keyed object. If it\n                        // is a fragment-like object, warn that it should be wrapped. Ignore if we\n                        // can't determine what kind of object this is.\n                        extractIfFragment: function(fragment) {\n                            if (\"production\" !== \"development\") {\n                                if (canWarnForReactFragment) {\n                                    // If it is the opaque type, return the keyed object.\n                                    if (fragment[fragmentKey]) {\n                                        return fragment[fragmentKey]\n                                    }\n                                    // Otherwise, check each property if it has an element, if it does\n                                    // it is probably meant as a fragment, so we can warn early. Defer,\n                                    // the warning to extract.\n                                    for (var key in fragment) {\n                                        if (\n                                            fragment.hasOwnProperty(key) &&\n                                            ReactElement.isValidElement(fragment[key])\n                                        ) {\n                                            // This looks like a fragment object, we should provide an\n                                            // early warning.\n                                            return ReactFragment.extract(fragment)\n                                        }\n                                    }\n                                }\n                            }\n                            return fragment\n                        }\n                    }\n\n                    module.exports = ReactFragment\n                },\n                { \"171\": 171, \"63\": 63 }\n            ],\n            70: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule ReactInjection\n                     */\n\n                    \"use strict\"\n\n                    var DOMProperty = _dereq_(11)\n                    var EventPluginHub = _dereq_(18)\n                    var ReactComponentEnvironment = _dereq_(41)\n                    var ReactClass = _dereq_(38)\n                    var ReactEmptyComponent = _dereq_(65)\n                    var ReactBrowserEventEmitter = _dereq_(33)\n                    var ReactNativeComponent = _dereq_(80)\n                    var ReactDOMComponent = _dereq_(48)\n                    var ReactPerf = _dereq_(82)\n                    var ReactRootIndex = _dereq_(91)\n                    var ReactUpdates = _dereq_(100)\n\n                    var ReactInjection = {\n                        Component: ReactComponentEnvironment.injection,\n                        Class: ReactClass.injection,\n                        DOMComponent: ReactDOMComponent.injection,\n                        DOMProperty: DOMProperty.injection,\n                        EmptyComponent: ReactEmptyComponent.injection,\n                        EventPluginHub: EventPluginHub.injection,\n                        EventEmitter: ReactBrowserEventEmitter.injection,\n                        NativeComponent: ReactNativeComponent.injection,\n                        Perf: ReactPerf.injection,\n                        RootIndex: ReactRootIndex.injection,\n                        Updates: ReactUpdates.injection\n                    }\n\n                    module.exports = ReactInjection\n                },\n                {\n                    \"100\": 100,\n                    \"11\": 11,\n                    \"18\": 18,\n                    \"33\": 33,\n                    \"38\": 38,\n                    \"41\": 41,\n                    \"48\": 48,\n                    \"65\": 65,\n                    \"80\": 80,\n                    \"82\": 82,\n                    \"91\": 91\n                }\n            ],\n            71: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule ReactInputSelection\n                     */\n\n                    \"use strict\"\n\n                    var ReactDOMSelection = _dereq_(56)\n\n                    var containsNode = _dereq_(123)\n                    var focusNode = _dereq_(134)\n                    var getActiveElement = _dereq_(136)\n\n                    function isInDocument(node) {\n                        return containsNode(document.documentElement, node)\n                    }\n\n                    /**\n                     * @ReactInputSelection: React input selection module. Based on Selection.js,\n                     * but modified to be suitable for react and has a couple of bug fixes (doesn't\n                     * assume buttons have range selections allowed).\n                     * Input selection module for React.\n                     */\n                    var ReactInputSelection = {\n                        hasSelectionCapabilities: function(elem) {\n                            return (\n                                elem &&\n                                ((elem.nodeName === \"INPUT\" && elem.type === \"text\") ||\n                                    elem.nodeName === \"TEXTAREA\" ||\n                                    elem.contentEditable === \"true\")\n                            )\n                        },\n\n                        getSelectionInformation: function() {\n                            var focusedElem = getActiveElement()\n                            return {\n                                focusedElem: focusedElem,\n                                selectionRange: ReactInputSelection.hasSelectionCapabilities(\n                                    focusedElem\n                                )\n                                    ? ReactInputSelection.getSelection(focusedElem)\n                                    : null\n                            }\n                        },\n\n                        /**\n                         * @restoreSelection: If any selection information was potentially lost,\n                         * restore it. This is useful when performing operations that could remove dom\n                         * nodes and place them back in, resulting in focus being lost.\n                         */\n                        restoreSelection: function(priorSelectionInformation) {\n                            var curFocusedElem = getActiveElement()\n                            var priorFocusedElem = priorSelectionInformation.focusedElem\n                            var priorSelectionRange = priorSelectionInformation.selectionRange\n                            if (\n                                curFocusedElem !== priorFocusedElem &&\n                                isInDocument(priorFocusedElem)\n                            ) {\n                                if (\n                                    ReactInputSelection.hasSelectionCapabilities(priorFocusedElem)\n                                ) {\n                                    ReactInputSelection.setSelection(\n                                        priorFocusedElem,\n                                        priorSelectionRange\n                                    )\n                                }\n                                focusNode(priorFocusedElem)\n                            }\n                        },\n\n                        /**\n                         * @getSelection: Gets the selection bounds of a focused textarea, input or\n                         * contentEditable node.\n                         * -@input: Look up selection bounds of this input\n                         * -@return {start: selectionStart, end: selectionEnd}\n                         */\n                        getSelection: function(input) {\n                            var selection\n\n                            if (\"selectionStart\" in input) {\n                                // Modern browser with input or textarea.\n                                selection = {\n                                    start: input.selectionStart,\n                                    end: input.selectionEnd\n                                }\n                            } else if (document.selection && input.nodeName === \"INPUT\") {\n                                // IE8 input.\n                                var range = document.selection.createRange()\n                                // There can only be one selection per document in IE, so it must\n                                // be in our element.\n                                if (range.parentElement() === input) {\n                                    selection = {\n                                        start: -range.moveStart(\"character\", -input.value.length),\n                                        end: -range.moveEnd(\"character\", -input.value.length)\n                                    }\n                                }\n                            } else {\n                                // Content editable or old IE textarea.\n                                selection = ReactDOMSelection.getOffsets(input)\n                            }\n\n                            return selection || { start: 0, end: 0 }\n                        },\n\n                        /**\n                         * @setSelection: Sets the selection bounds of a textarea or input and focuses\n                         * the input.\n                         * -@input     Set selection bounds of this input or textarea\n                         * -@offsets   Object of same form that is returned from get*\n                         */\n                        setSelection: function(input, offsets) {\n                            var start = offsets.start\n                            var end = offsets.end\n                            if (typeof end === \"undefined\") {\n                                end = start\n                            }\n\n                            if (\"selectionStart\" in input) {\n                                input.selectionStart = start\n                                input.selectionEnd = Math.min(end, input.value.length)\n                            } else if (document.selection && input.nodeName === \"INPUT\") {\n                                var range = input.createTextRange()\n                                range.collapse(true)\n                                range.moveStart(\"character\", start)\n                                range.moveEnd(\"character\", end - start)\n                                range.select()\n                            } else {\n                                ReactDOMSelection.setOffsets(input, offsets)\n                            }\n                        }\n                    }\n\n                    module.exports = ReactInputSelection\n                },\n                { \"123\": 123, \"134\": 134, \"136\": 136, \"56\": 56 }\n            ],\n            72: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule ReactInstanceHandles\n                     * @typechecks static-only\n                     */\n\n                    \"use strict\"\n\n                    var ReactRootIndex = _dereq_(91)\n\n                    var invariant = _dereq_(150)\n\n                    var SEPARATOR = \".\"\n                    var SEPARATOR_LENGTH = SEPARATOR.length\n\n                    /**\n                     * Maximum depth of traversals before we consider the possibility of a bad ID.\n                     */\n                    var MAX_TREE_DEPTH = 100\n\n                    /**\n                     * Creates a DOM ID prefix to use when mounting React components.\n                     *\n                     * @param {number} index A unique integer\n                     * @return {string} React root ID.\n                     * @internal\n                     */\n                    function getReactRootIDString(index) {\n                        return SEPARATOR + index.toString(36)\n                    }\n\n                    /**\n                     * Checks if a character in the supplied ID is a separator or the end.\n                     *\n                     * @param {string} id A React DOM ID.\n                     * @param {number} index Index of the character to check.\n                     * @return {boolean} True if the character is a separator or end of the ID.\n                     * @private\n                     */\n                    function isBoundary(id, index) {\n                        return id.charAt(index) === SEPARATOR || index === id.length\n                    }\n\n                    /**\n                     * Checks if the supplied string is a valid React DOM ID.\n                     *\n                     * @param {string} id A React DOM ID, maybe.\n                     * @return {boolean} True if the string is a valid React DOM ID.\n                     * @private\n                     */\n                    function isValidID(id) {\n                        return (\n                            id === \"\" ||\n                            (id.charAt(0) === SEPARATOR && id.charAt(id.length - 1) !== SEPARATOR)\n                        )\n                    }\n\n                    /**\n                     * Checks if the first ID is an ancestor of or equal to the second ID.\n                     *\n                     * @param {string} ancestorID\n                     * @param {string} descendantID\n                     * @return {boolean} True if `ancestorID` is an ancestor of `descendantID`.\n                     * @internal\n                     */\n                    function isAncestorIDOf(ancestorID, descendantID) {\n                        return (\n                            descendantID.indexOf(ancestorID) === 0 &&\n                            isBoundary(descendantID, ancestorID.length)\n                        )\n                    }\n\n                    /**\n                     * Gets the parent ID of the supplied React DOM ID, `id`.\n                     *\n                     * @param {string} id ID of a component.\n                     * @return {string} ID of the parent, or an empty string.\n                     * @private\n                     */\n                    function getParentID(id) {\n                        return id ? id.substr(0, id.lastIndexOf(SEPARATOR)) : \"\"\n                    }\n\n                    /**\n                     * Gets the next DOM ID on the tree path from the supplied `ancestorID` to the\n                     * supplied `destinationID`. If they are equal, the ID is returned.\n                     *\n                     * @param {string} ancestorID ID of an ancestor node of `destinationID`.\n                     * @param {string} destinationID ID of the destination node.\n                     * @return {string} Next ID on the path from `ancestorID` to `destinationID`.\n                     * @private\n                     */\n                    function getNextDescendantID(ancestorID, destinationID) {\n                        \"production\" !== \"development\"\n                            ? invariant(\n                                  isValidID(ancestorID) && isValidID(destinationID),\n                                  \"getNextDescendantID(%s, %s): Received an invalid React DOM ID.\",\n                                  ancestorID,\n                                  destinationID\n                              )\n                            : invariant(isValidID(ancestorID) && isValidID(destinationID))\n                        \"production\" !== \"development\"\n                            ? invariant(\n                                  isAncestorIDOf(ancestorID, destinationID),\n                                  \"getNextDescendantID(...): React has made an invalid assumption about \" +\n                                      \"the DOM hierarchy. Expected `%s` to be an ancestor of `%s`.\",\n                                  ancestorID,\n                                  destinationID\n                              )\n                            : invariant(isAncestorIDOf(ancestorID, destinationID))\n                        if (ancestorID === destinationID) {\n                            return ancestorID\n                        }\n                        // Skip over the ancestor and the immediate separator. Traverse until we hit\n                        // another separator or we reach the end of `destinationID`.\n                        var start = ancestorID.length + SEPARATOR_LENGTH\n                        var i\n                        for (i = start; i < destinationID.length; i++) {\n                            if (isBoundary(destinationID, i)) {\n                                break\n                            }\n                        }\n                        return destinationID.substr(0, i)\n                    }\n\n                    /**\n                     * Gets the nearest common ancestor ID of two IDs.\n                     *\n                     * Using this ID scheme, the nearest common ancestor ID is the longest common\n                     * prefix of the two IDs that immediately preceded a \"marker\" in both strings.\n                     *\n                     * @param {string} oneID\n                     * @param {string} twoID\n                     * @return {string} Nearest common ancestor ID, or the empty string if none.\n                     * @private\n                     */\n                    function getFirstCommonAncestorID(oneID, twoID) {\n                        var minLength = Math.min(oneID.length, twoID.length)\n                        if (minLength === 0) {\n                            return \"\"\n                        }\n                        var lastCommonMarkerIndex = 0\n                        // Use `<=` to traverse until the \"EOL\" of the shorter string.\n                        for (var i = 0; i <= minLength; i++) {\n                            if (isBoundary(oneID, i) && isBoundary(twoID, i)) {\n                                lastCommonMarkerIndex = i\n                            } else if (oneID.charAt(i) !== twoID.charAt(i)) {\n                                break\n                            }\n                        }\n                        var longestCommonID = oneID.substr(0, lastCommonMarkerIndex)\n                        \"production\" !== \"development\"\n                            ? invariant(\n                                  isValidID(longestCommonID),\n                                  \"getFirstCommonAncestorID(%s, %s): Expected a valid React DOM ID: %s\",\n                                  oneID,\n                                  twoID,\n                                  longestCommonID\n                              )\n                            : invariant(isValidID(longestCommonID))\n                        return longestCommonID\n                    }\n\n                    /**\n                     * Traverses the parent path between two IDs (either up or down). The IDs must\n                     * not be the same, and there must exist a parent path between them. If the\n                     * callback returns `false`, traversal is stopped.\n                     *\n                     * @param {?string} start ID at which to start traversal.\n                     * @param {?string} stop ID at which to end traversal.\n                     * @param {function} cb Callback to invoke each ID with.\n                     * @param {?boolean} skipFirst Whether or not to skip the first node.\n                     * @param {?boolean} skipLast Whether or not to skip the last node.\n                     * @private\n                     */\n                    function traverseParentPath(start, stop, cb, arg, skipFirst, skipLast) {\n                        start = start || \"\"\n                        stop = stop || \"\"\n                        \"production\" !== \"development\"\n                            ? invariant(\n                                  start !== stop,\n                                  \"traverseParentPath(...): Cannot traverse from and to the same ID, `%s`.\",\n                                  start\n                              )\n                            : invariant(start !== stop)\n                        var traverseUp = isAncestorIDOf(stop, start)\n                        \"production\" !== \"development\"\n                            ? invariant(\n                                  traverseUp || isAncestorIDOf(start, stop),\n                                  \"traverseParentPath(%s, %s, ...): Cannot traverse from two IDs that do \" +\n                                      \"not have a parent path.\",\n                                  start,\n                                  stop\n                              )\n                            : invariant(traverseUp || isAncestorIDOf(start, stop))\n                        // Traverse from `start` to `stop` one depth at a time.\n                        var depth = 0\n                        var traverse = traverseUp ? getParentID : getNextDescendantID\n                        for (var id = start /* until break */; ; id = traverse(id, stop)) {\n                            var ret\n                            if ((!skipFirst || id !== start) && (!skipLast || id !== stop)) {\n                                ret = cb(id, traverseUp, arg)\n                            }\n                            if (ret === false || id === stop) {\n                                // Only break //after// visiting `stop`.\n                                break\n                            }\n                            \"production\" !== \"development\"\n                                ? invariant(\n                                      depth++ < MAX_TREE_DEPTH,\n                                      \"traverseParentPath(%s, %s, ...): Detected an infinite loop while \" +\n                                          \"traversing the React DOM ID tree. This may be due to malformed IDs: %s\",\n                                      start,\n                                      stop\n                                  )\n                                : invariant(depth++ < MAX_TREE_DEPTH)\n                        }\n                    }\n\n                    /**\n                     * Manages the IDs assigned to DOM representations of React components. This\n                     * uses a specific scheme in order to traverse the DOM efficiently (e.g. in\n                     * order to simulate events).\n                     *\n                     * @internal\n                     */\n                    var ReactInstanceHandles = {\n                        /**\n                         * Constructs a React root ID\n                         * @return {string} A React root ID.\n                         */\n                        createReactRootID: function() {\n                            return getReactRootIDString(ReactRootIndex.createReactRootIndex())\n                        },\n\n                        /**\n                         * Constructs a React ID by joining a root ID with a name.\n                         *\n                         * @param {string} rootID Root ID of a parent component.\n                         * @param {string} name A component's name (as flattened children).\n                         * @return {string} A React ID.\n                         * @internal\n                         */\n                        createReactID: function(rootID, name) {\n                            return rootID + name\n                        },\n\n                        /**\n                         * Gets the DOM ID of the React component that is the root of the tree that\n                         * contains the React component with the supplied DOM ID.\n                         *\n                         * @param {string} id DOM ID of a React component.\n                         * @return {?string} DOM ID of the React component that is the root.\n                         * @internal\n                         */\n                        getReactRootIDFromNodeID: function(id) {\n                            if (id && id.charAt(0) === SEPARATOR && id.length > 1) {\n                                var index = id.indexOf(SEPARATOR, 1)\n                                return index > -1 ? id.substr(0, index) : id\n                            }\n                            return null\n                        },\n\n                        /**\n                         * Traverses the ID hierarchy and invokes the supplied `cb` on any IDs that\n                         * should would receive a `mouseEnter` or `mouseLeave` event.\n                         *\n                         * NOTE: Does not invoke the callback on the nearest common ancestor because\n                         * nothing \"entered\" or \"left\" that element.\n                         *\n                         * @param {string} leaveID ID being left.\n                         * @param {string} enterID ID being entered.\n                         * @param {function} cb Callback to invoke on each entered/left ID.\n                         * @param {*} upArg Argument to invoke the callback with on left IDs.\n                         * @param {*} downArg Argument to invoke the callback with on entered IDs.\n                         * @internal\n                         */\n                        traverseEnterLeave: function(leaveID, enterID, cb, upArg, downArg) {\n                            var ancestorID = getFirstCommonAncestorID(leaveID, enterID)\n                            if (ancestorID !== leaveID) {\n                                traverseParentPath(leaveID, ancestorID, cb, upArg, false, true)\n                            }\n                            if (ancestorID !== enterID) {\n                                traverseParentPath(ancestorID, enterID, cb, downArg, true, false)\n                            }\n                        },\n\n                        /**\n                         * Simulates the traversal of a two-phase, capture/bubble event dispatch.\n                         *\n                         * NOTE: This traversal happens on IDs without touching the DOM.\n                         *\n                         * @param {string} targetID ID of the target node.\n                         * @param {function} cb Callback to invoke.\n                         * @param {*} arg Argument to invoke the callback with.\n                         * @internal\n                         */\n                        traverseTwoPhase: function(targetID, cb, arg) {\n                            if (targetID) {\n                                traverseParentPath(\"\", targetID, cb, arg, true, false)\n                                traverseParentPath(targetID, \"\", cb, arg, false, true)\n                            }\n                        },\n\n                        /**\n                         * Traverse a node ID, calling the supplied `cb` for each ancestor ID. For\n                         * example, passing `.0.$row-0.1` would result in `cb` getting called\n                         * with `.0`, `.0.$row-0`, and `.0.$row-0.1`.\n                         *\n                         * NOTE: This traversal happens on IDs without touching the DOM.\n                         *\n                         * @param {string} targetID ID of the target node.\n                         * @param {function} cb Callback to invoke.\n                         * @param {*} arg Argument to invoke the callback with.\n                         * @internal\n                         */\n                        traverseAncestors: function(targetID, cb, arg) {\n                            traverseParentPath(\"\", targetID, cb, arg, true, false)\n                        },\n\n                        /**\n                         * Exposed for unit testing.\n                         * @private\n                         */\n                        _getFirstCommonAncestorID: getFirstCommonAncestorID,\n\n                        /**\n                         * Exposed for unit testing.\n                         * @private\n                         */\n                        _getNextDescendantID: getNextDescendantID,\n\n                        isAncestorIDOf: isAncestorIDOf,\n\n                        SEPARATOR: SEPARATOR\n                    }\n\n                    module.exports = ReactInstanceHandles\n                },\n                { \"150\": 150, \"91\": 91 }\n            ],\n            73: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule ReactInstanceMap\n                     */\n\n                    \"use strict\"\n\n                    /**\n                     * `ReactInstanceMap` maintains a mapping from a public facing stateful\n                     * instance (key) and the internal representation (value). This allows public\n                     * methods to accept the user facing instance as an argument and map them back\n                     * to internal methods.\n                     */\n\n                    // TODO: Replace this with ES6: var ReactInstanceMap = new Map();\n                    var ReactInstanceMap = {\n                        /**\n                         * This API should be called `delete` but we'd have to make sure to always\n                         * transform these to strings for IE support. When this transform is fully\n                         * supported we can rename it.\n                         */\n                        remove: function(key) {\n                            key._reactInternalInstance = undefined\n                        },\n\n                        get: function(key) {\n                            return key._reactInternalInstance\n                        },\n\n                        has: function(key) {\n                            return key._reactInternalInstance !== undefined\n                        },\n\n                        set: function(key, value) {\n                            key._reactInternalInstance = value\n                        }\n                    }\n\n                    module.exports = ReactInstanceMap\n                },\n                {}\n            ],\n            74: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule ReactLifeCycle\n                     */\n\n                    \"use strict\"\n\n                    /**\n                     * This module manages the bookkeeping when a component is in the process\n                     * of being mounted or being unmounted. This is used as a way to enforce\n                     * invariants (or warnings) when it is not recommended to call\n                     * setState/forceUpdate.\n                     *\n                     * currentlyMountingInstance: During the construction phase, it is not possible\n                     * to trigger an update since the instance is not fully mounted yet. However, we\n                     * currently allow this as a convenience for mutating the initial state.\n                     *\n                     * currentlyUnmountingInstance: During the unmounting phase, the instance is\n                     * still mounted and can therefore schedule an update. However, this is not\n                     * recommended and probably an error since it's about to be unmounted.\n                     * Therefore we still want to trigger in an error for that case.\n                     */\n\n                    var ReactLifeCycle = {\n                        currentlyMountingInstance: null,\n                        currentlyUnmountingInstance: null\n                    }\n\n                    module.exports = ReactLifeCycle\n                },\n                {}\n            ],\n            75: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule ReactLink\n                     * @typechecks static-only\n                     */\n\n                    \"use strict\"\n\n                    /**\n                     * ReactLink encapsulates a common pattern in which a component wants to modify\n                     * a prop received from its parent. ReactLink allows the parent to pass down a\n                     * value coupled with a callback that, when invoked, expresses an intent to\n                     * modify that value. For example:\n                     *\n                     * React.createClass({\n                     *   getInitialState: function() {\n                     *     return {value: ''};\n                     *   },\n                     *   render: function() {\n                     *     var valueLink = new ReactLink(this.state.value, this._handleValueChange);\n                     *     return <input valueLink={valueLink} />;\n                     *   },\n                     *   this._handleValueChange: function(newValue) {\n                     *     this.setState({value: newValue});\n                     *   }\n                     * });\n                     *\n                     * We have provided some sugary mixins to make the creation and\n                     * consumption of ReactLink easier; see LinkedValueUtils and LinkedStateMixin.\n                     */\n\n                    var React = _dereq_(31)\n\n                    /**\n                     * @param {*} value current value of the link\n                     * @param {function} requestChange callback to request a change\n                     */\n                    function ReactLink(value, requestChange) {\n                        this.value = value\n                        this.requestChange = requestChange\n                    }\n\n                    /**\n                     * Creates a PropType that enforces the ReactLink API and optionally checks the\n                     * type of the value being passed inside the link. Example:\n                     *\n                     * MyComponent.propTypes = {\n                     *   tabIndexLink: ReactLink.PropTypes.link(React.PropTypes.number)\n                     * }\n                     */\n                    function createLinkTypeChecker(linkType) {\n                        var shapes = {\n                            value:\n                                typeof linkType === \"undefined\"\n                                    ? React.PropTypes.any.isRequired\n                                    : linkType.isRequired,\n                            requestChange: React.PropTypes.func.isRequired\n                        }\n                        return React.PropTypes.shape(shapes)\n                    }\n\n                    ReactLink.PropTypes = {\n                        link: createLinkTypeChecker\n                    }\n\n                    module.exports = ReactLink\n                },\n                { \"31\": 31 }\n            ],\n            76: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule ReactMarkupChecksum\n                     */\n\n                    \"use strict\"\n\n                    var adler32 = _dereq_(119)\n\n                    var ReactMarkupChecksum = {\n                        CHECKSUM_ATTR_NAME: \"data-react-checksum\",\n\n                        /**\n                         * @param {string} markup Markup string\n                         * @return {string} Markup string with checksum attribute attached\n                         */\n                        addChecksumToMarkup: function(markup) {\n                            var checksum = adler32(markup)\n                            return markup.replace(\n                                \">\",\n                                \" \" +\n                                    ReactMarkupChecksum.CHECKSUM_ATTR_NAME +\n                                    '=\"' +\n                                    checksum +\n                                    '\">'\n                            )\n                        },\n\n                        /**\n                         * @param {string} markup to use\n                         * @param {DOMElement} element root React element\n                         * @returns {boolean} whether or not the markup is the same\n                         */\n                        canReuseMarkup: function(markup, element) {\n                            var existingChecksum = element.getAttribute(\n                                ReactMarkupChecksum.CHECKSUM_ATTR_NAME\n                            )\n                            existingChecksum = existingChecksum && parseInt(existingChecksum, 10)\n                            var markupChecksum = adler32(markup)\n                            return markupChecksum === existingChecksum\n                        }\n                    }\n\n                    module.exports = ReactMarkupChecksum\n                },\n                { \"119\": 119 }\n            ],\n            77: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule ReactMount\n                     */\n\n                    \"use strict\"\n\n                    var DOMProperty = _dereq_(11)\n                    var ReactBrowserEventEmitter = _dereq_(33)\n                    var ReactCurrentOwner = _dereq_(45)\n                    var ReactElement = _dereq_(63)\n                    var ReactElementValidator = _dereq_(64)\n                    var ReactEmptyComponent = _dereq_(65)\n                    var ReactInstanceHandles = _dereq_(72)\n                    var ReactInstanceMap = _dereq_(73)\n                    var ReactMarkupChecksum = _dereq_(76)\n                    var ReactPerf = _dereq_(82)\n                    var ReactReconciler = _dereq_(89)\n                    var ReactUpdateQueue = _dereq_(99)\n                    var ReactUpdates = _dereq_(100)\n\n                    var emptyObject = _dereq_(130)\n                    var containsNode = _dereq_(123)\n                    var getReactRootElementInContainer = _dereq_(144)\n                    var instantiateReactComponent = _dereq_(149)\n                    var invariant = _dereq_(150)\n                    var setInnerHTML = _dereq_(164)\n                    var shouldUpdateReactComponent = _dereq_(167)\n                    var warning = _dereq_(171)\n\n                    var SEPARATOR = ReactInstanceHandles.SEPARATOR\n\n                    var ATTR_NAME = DOMProperty.ID_ATTRIBUTE_NAME\n                    var nodeCache = {}\n\n                    var ELEMENT_NODE_TYPE = 1\n                    var DOC_NODE_TYPE = 9\n\n                    /** Mapping from reactRootID to React component instance. */\n                    var instancesByReactRootID = {}\n\n                    /** Mapping from reactRootID to `container` nodes. */\n                    var containersByReactRootID = {}\n\n                    if (\"production\" !== \"development\") {\n                        /** __DEV__-only mapping from reactRootID to root elements. */\n                        var rootElementsByReactRootID = {}\n                    }\n\n                    // Used to store breadth-first search state in findComponentRoot.\n                    var findComponentRootReusableArray = []\n\n                    /**\n                     * Finds the index of the first character\n                     * that's not common between the two given strings.\n                     *\n                     * @return {number} the index of the character where the strings diverge\n                     */\n                    function firstDifferenceIndex(string1, string2) {\n                        var minLen = Math.min(string1.length, string2.length)\n                        for (var i = 0; i < minLen; i++) {\n                            if (string1.charAt(i) !== string2.charAt(i)) {\n                                return i\n                            }\n                        }\n                        return string1.length === string2.length ? -1 : minLen\n                    }\n\n                    /**\n                     * @param {DOMElement} container DOM element that may contain a React component.\n                     * @return {?string} A \"reactRoot\" ID, if a React component is rendered.\n                     */\n                    function getReactRootID(container) {\n                        var rootElement = getReactRootElementInContainer(container)\n                        return rootElement && ReactMount.getID(rootElement)\n                    }\n\n                    /**\n                     * Accessing node[ATTR_NAME] or calling getAttribute(ATTR_NAME) on a form\n                     * element can return its control whose name or ID equals ATTR_NAME. All\n                     * DOM nodes support `getAttributeNode` but this can also get called on\n                     * other objects so just return '' if we're given something other than a\n                     * DOM node (such as window).\n                     *\n                     * @param {?DOMElement|DOMWindow|DOMDocument|DOMTextNode} node DOM node.\n                     * @return {string} ID of the supplied `domNode`.\n                     */\n                    function getID(node) {\n                        var id = internalGetID(node)\n                        if (id) {\n                            if (nodeCache.hasOwnProperty(id)) {\n                                var cached = nodeCache[id]\n                                if (cached !== node) {\n                                    \"production\" !== \"development\"\n                                        ? invariant(\n                                              !isValid(cached, id),\n                                              \"ReactMount: Two valid but unequal nodes with the same `%s`: %s\",\n                                              ATTR_NAME,\n                                              id\n                                          )\n                                        : invariant(!isValid(cached, id))\n\n                                    nodeCache[id] = node\n                                }\n                            } else {\n                                nodeCache[id] = node\n                            }\n                        }\n\n                        return id\n                    }\n\n                    function internalGetID(node) {\n                        // If node is something like a window, document, or text node, none of\n                        // which support attributes or a .getAttribute method, gracefully return\n                        // the empty string, as if the attribute were missing.\n                        return (node && node.getAttribute && node.getAttribute(ATTR_NAME)) || \"\"\n                    }\n\n                    /**\n                     * Sets the React-specific ID of the given node.\n                     *\n                     * @param {DOMElement} node The DOM node whose ID will be set.\n                     * @param {string} id The value of the ID attribute.\n                     */\n                    function setID(node, id) {\n                        var oldID = internalGetID(node)\n                        if (oldID !== id) {\n                            delete nodeCache[oldID]\n                        }\n                        node.setAttribute(ATTR_NAME, id)\n                        nodeCache[id] = node\n                    }\n\n                    /**\n                     * Finds the node with the supplied React-generated DOM ID.\n                     *\n                     * @param {string} id A React-generated DOM ID.\n                     * @return {DOMElement} DOM node with the suppled `id`.\n                     * @internal\n                     */\n                    function getNode(id) {\n                        if (!nodeCache.hasOwnProperty(id) || !isValid(nodeCache[id], id)) {\n                            nodeCache[id] = ReactMount.findReactNodeByID(id)\n                        }\n                        return nodeCache[id]\n                    }\n\n                    /**\n                     * Finds the node with the supplied public React instance.\n                     *\n                     * @param {*} instance A public React instance.\n                     * @return {?DOMElement} DOM node with the suppled `id`.\n                     * @internal\n                     */\n                    function getNodeFromInstance(instance) {\n                        var id = ReactInstanceMap.get(instance)._rootNodeID\n                        if (ReactEmptyComponent.isNullComponentID(id)) {\n                            return null\n                        }\n                        if (!nodeCache.hasOwnProperty(id) || !isValid(nodeCache[id], id)) {\n                            nodeCache[id] = ReactMount.findReactNodeByID(id)\n                        }\n                        return nodeCache[id]\n                    }\n\n                    /**\n                     * A node is \"valid\" if it is contained by a currently mounted container.\n                     *\n                     * This means that the node does not have to be contained by a document in\n                     * order to be considered valid.\n                     *\n                     * @param {?DOMElement} node The candidate DOM node.\n                     * @param {string} id The expected ID of the node.\n                     * @return {boolean} Whether the node is contained by a mounted container.\n                     */\n                    function isValid(node, id) {\n                        if (node) {\n                            \"production\" !== \"development\"\n                                ? invariant(\n                                      internalGetID(node) === id,\n                                      \"ReactMount: Unexpected modification of `%s`\",\n                                      ATTR_NAME\n                                  )\n                                : invariant(internalGetID(node) === id)\n\n                            var container = ReactMount.findReactContainerForID(id)\n                            if (container && containsNode(container, node)) {\n                                return true\n                            }\n                        }\n\n                        return false\n                    }\n\n                    /**\n                     * Causes the cache to forget about one React-specific ID.\n                     *\n                     * @param {string} id The ID to forget.\n                     */\n                    function purgeID(id) {\n                        delete nodeCache[id]\n                    }\n\n                    var deepestNodeSoFar = null\n                    function findDeepestCachedAncestorImpl(ancestorID) {\n                        var ancestor = nodeCache[ancestorID]\n                        if (ancestor && isValid(ancestor, ancestorID)) {\n                            deepestNodeSoFar = ancestor\n                        } else {\n                            // This node isn't populated in the cache, so presumably none of its\n                            // descendants are. Break out of the loop.\n                            return false\n                        }\n                    }\n\n                    /**\n                     * Return the deepest cached node whose ID is a prefix of `targetID`.\n                     */\n                    function findDeepestCachedAncestor(targetID) {\n                        deepestNodeSoFar = null\n                        ReactInstanceHandles.traverseAncestors(\n                            targetID,\n                            findDeepestCachedAncestorImpl\n                        )\n\n                        var foundNode = deepestNodeSoFar\n                        deepestNodeSoFar = null\n                        return foundNode\n                    }\n\n                    /**\n                     * Mounts this component and inserts it into the DOM.\n                     *\n                     * @param {ReactComponent} componentInstance The instance to mount.\n                     * @param {string} rootID DOM ID of the root node.\n                     * @param {DOMElement} container DOM element to mount into.\n                     * @param {ReactReconcileTransaction} transaction\n                     * @param {boolean} shouldReuseMarkup If true, do not insert markup\n                     */\n                    function mountComponentIntoNode(\n                        componentInstance,\n                        rootID,\n                        container,\n                        transaction,\n                        shouldReuseMarkup\n                    ) {\n                        var markup = ReactReconciler.mountComponent(\n                            componentInstance,\n                            rootID,\n                            transaction,\n                            emptyObject\n                        )\n                        componentInstance._isTopLevel = true\n                        ReactMount._mountImageIntoNode(markup, container, shouldReuseMarkup)\n                    }\n\n                    /**\n                     * Batched mount.\n                     *\n                     * @param {ReactComponent} componentInstance The instance to mount.\n                     * @param {string} rootID DOM ID of the root node.\n                     * @param {DOMElement} container DOM element to mount into.\n                     * @param {boolean} shouldReuseMarkup If true, do not insert markup\n                     */\n                    function batchedMountComponentIntoNode(\n                        componentInstance,\n                        rootID,\n                        container,\n                        shouldReuseMarkup\n                    ) {\n                        var transaction = ReactUpdates.ReactReconcileTransaction.getPooled()\n                        transaction.perform(\n                            mountComponentIntoNode,\n                            null,\n                            componentInstance,\n                            rootID,\n                            container,\n                            transaction,\n                            shouldReuseMarkup\n                        )\n                        ReactUpdates.ReactReconcileTransaction.release(transaction)\n                    }\n\n                    /**\n                     * Mounting is the process of initializing a React component by creating its\n                     * representative DOM elements and inserting them into a supplied `container`.\n                     * Any prior content inside `container` is destroyed in the process.\n                     *\n                     *   ReactMount.render(\n                     *     component,\n                     *     document.getElementById('container')\n                     *   );\n                     *\n                     *   <div id=\"container\">                   <-- Supplied `container`.\n                     *     <div data-reactid=\".3\">              <-- Rendered reactRoot of React\n                     *       // ...                                 component.\n                     *     </div>\n                     *   </div>\n                     *\n                     * Inside of `container`, the first element rendered is the \"reactRoot\".\n                     */\n                    var ReactMount = {\n                        /** Exposed for debugging purposes **/\n                        _instancesByReactRootID: instancesByReactRootID,\n\n                        /**\n                         * This is a hook provided to support rendering React components while\n                         * ensuring that the apparent scroll position of its `container` does not\n                         * change.\n                         *\n                         * @param {DOMElement} container The `container` being rendered into.\n                         * @param {function} renderCallback This must be called once to do the render.\n                         */\n                        scrollMonitor: function(container, renderCallback) {\n                            renderCallback()\n                        },\n\n                        /**\n                         * Take a component that's already mounted into the DOM and replace its props\n                         * @param {ReactComponent} prevComponent component instance already in the DOM\n                         * @param {ReactElement} nextElement component instance to render\n                         * @param {DOMElement} container container to render into\n                         * @param {?function} callback function triggered on completion\n                         */\n                        _updateRootComponent: function(\n                            prevComponent,\n                            nextElement,\n                            container,\n                            callback\n                        ) {\n                            if (\"production\" !== \"development\") {\n                                ReactElementValidator.checkAndWarnForMutatedProps(nextElement)\n                            }\n\n                            ReactMount.scrollMonitor(container, function() {\n                                ReactUpdateQueue.enqueueElementInternal(prevComponent, nextElement)\n                                if (callback) {\n                                    ReactUpdateQueue.enqueueCallbackInternal(\n                                        prevComponent,\n                                        callback\n                                    )\n                                }\n                            })\n\n                            if (\"production\" !== \"development\") {\n                                // Record the root element in case it later gets transplanted.\n                                rootElementsByReactRootID[\n                                    getReactRootID(container)\n                                ] = getReactRootElementInContainer(container)\n                            }\n\n                            return prevComponent\n                        },\n\n                        /**\n                         * Register a component into the instance map and starts scroll value\n                         * monitoring\n                         * @param {ReactComponent} nextComponent component instance to render\n                         * @param {DOMElement} container container to render into\n                         * @return {string} reactRoot ID prefix\n                         */\n                        _registerComponent: function(nextComponent, container) {\n                            \"production\" !== \"development\"\n                                ? invariant(\n                                      container &&\n                                          (container.nodeType === ELEMENT_NODE_TYPE ||\n                                              container.nodeType === DOC_NODE_TYPE),\n                                      \"_registerComponent(...): Target container is not a DOM element.\"\n                                  )\n                                : invariant(\n                                      container &&\n                                          (container.nodeType === ELEMENT_NODE_TYPE ||\n                                              container.nodeType === DOC_NODE_TYPE)\n                                  )\n\n                            ReactBrowserEventEmitter.ensureScrollValueMonitoring()\n\n                            var reactRootID = ReactMount.registerContainer(container)\n                            instancesByReactRootID[reactRootID] = nextComponent\n                            return reactRootID\n                        },\n\n                        /**\n                         * Render a new component into the DOM.\n                         * @param {ReactElement} nextElement element to render\n                         * @param {DOMElement} container container to render into\n                         * @param {boolean} shouldReuseMarkup if we should skip the markup insertion\n                         * @return {ReactComponent} nextComponent\n                         */\n                        _renderNewRootComponent: function(\n                            nextElement,\n                            container,\n                            shouldReuseMarkup\n                        ) {\n                            // Various parts of our code (such as ReactCompositeComponent's\n                            // _renderValidatedComponent) assume that calls to render aren't nested;\n                            // verify that that's the case.\n                            \"production\" !== \"development\"\n                                ? warning(\n                                      ReactCurrentOwner.current == null,\n                                      \"_renderNewRootComponent(): Render methods should be a pure function \" +\n                                          \"of props and state; triggering nested component updates from \" +\n                                          \"render is not allowed. If necessary, trigger nested updates in \" +\n                                          \"componentDidUpdate.\"\n                                  )\n                                : null\n\n                            var componentInstance = instantiateReactComponent(nextElement, null)\n                            var reactRootID = ReactMount._registerComponent(\n                                componentInstance,\n                                container\n                            )\n\n                            // The initial render is synchronous but any updates that happen during\n                            // rendering, in componentWillMount or componentDidMount, will be batched\n                            // according to the current batching strategy.\n\n                            ReactUpdates.batchedUpdates(\n                                batchedMountComponentIntoNode,\n                                componentInstance,\n                                reactRootID,\n                                container,\n                                shouldReuseMarkup\n                            )\n\n                            if (\"production\" !== \"development\") {\n                                // Record the root element in case it later gets transplanted.\n                                rootElementsByReactRootID[\n                                    reactRootID\n                                ] = getReactRootElementInContainer(container)\n                            }\n\n                            return componentInstance\n                        },\n\n                        /**\n                         * Renders a React component into the DOM in the supplied `container`.\n                         *\n                         * If the React component was previously rendered into `container`, this will\n                         * perform an update on it and only mutate the DOM as necessary to reflect the\n                         * latest React component.\n                         *\n                         * @param {ReactElement} nextElement Component element to render.\n                         * @param {DOMElement} container DOM element to render into.\n                         * @param {?function} callback function triggered on completion\n                         * @return {ReactComponent} Component instance rendered in `container`.\n                         */\n                        render: function(nextElement, container, callback) {\n                            \"production\" !== \"development\"\n                                ? invariant(\n                                      ReactElement.isValidElement(nextElement),\n                                      \"React.render(): Invalid component element.%s\",\n                                      typeof nextElement === \"string\"\n                                          ? \" Instead of passing an element string, make sure to instantiate \" +\n                                                \"it by passing it to React.createElement.\"\n                                          : typeof nextElement === \"function\"\n                                          ? \" Instead of passing a component class, make sure to instantiate \" +\n                                            \"it by passing it to React.createElement.\"\n                                          : // Check if it quacks like an element\n                                          nextElement != null && nextElement.props !== undefined\n                                          ? \" This may be caused by unintentionally loading two independent \" +\n                                            \"copies of React.\"\n                                          : \"\"\n                                  )\n                                : invariant(ReactElement.isValidElement(nextElement))\n\n                            var prevComponent = instancesByReactRootID[getReactRootID(container)]\n\n                            if (prevComponent) {\n                                var prevElement = prevComponent._currentElement\n                                if (shouldUpdateReactComponent(prevElement, nextElement)) {\n                                    return ReactMount._updateRootComponent(\n                                        prevComponent,\n                                        nextElement,\n                                        container,\n                                        callback\n                                    ).getPublicInstance()\n                                } else {\n                                    ReactMount.unmountComponentAtNode(container)\n                                }\n                            }\n\n                            var reactRootElement = getReactRootElementInContainer(container)\n                            var containerHasReactMarkup =\n                                reactRootElement && ReactMount.isRenderedByReact(reactRootElement)\n\n                            if (\"production\" !== \"development\") {\n                                if (!containerHasReactMarkup || reactRootElement.nextSibling) {\n                                    var rootElementSibling = reactRootElement\n                                    while (rootElementSibling) {\n                                        if (ReactMount.isRenderedByReact(rootElementSibling)) {\n                                            \"production\" !== \"development\"\n                                                ? warning(\n                                                      false,\n                                                      \"render(): Target node has markup rendered by React, but there \" +\n                                                          \"are unrelated nodes as well. This is most commonly caused by \" +\n                                                          \"white-space inserted around server-rendered markup.\"\n                                                  )\n                                                : null\n                                            break\n                                        }\n\n                                        rootElementSibling = rootElementSibling.nextSibling\n                                    }\n                                }\n                            }\n\n                            var shouldReuseMarkup = containerHasReactMarkup && !prevComponent\n\n                            var component = ReactMount._renderNewRootComponent(\n                                nextElement,\n                                container,\n                                shouldReuseMarkup\n                            ).getPublicInstance()\n                            if (callback) {\n                                callback.call(component)\n                            }\n                            return component\n                        },\n\n                        /**\n                         * Constructs a component instance of `constructor` with `initialProps` and\n                         * renders it into the supplied `container`.\n                         *\n                         * @param {function} constructor React component constructor.\n                         * @param {?object} props Initial props of the component instance.\n                         * @param {DOMElement} container DOM element to render into.\n                         * @return {ReactComponent} Component instance rendered in `container`.\n                         */\n                        constructAndRenderComponent: function(constructor, props, container) {\n                            var element = ReactElement.createElement(constructor, props)\n                            return ReactMount.render(element, container)\n                        },\n\n                        /**\n                         * Constructs a component instance of `constructor` with `initialProps` and\n                         * renders it into a container node identified by supplied `id`.\n                         *\n                         * @param {function} componentConstructor React component constructor\n                         * @param {?object} props Initial props of the component instance.\n                         * @param {string} id ID of the DOM element to render into.\n                         * @return {ReactComponent} Component instance rendered in the container node.\n                         */\n                        constructAndRenderComponentByID: function(constructor, props, id) {\n                            var domNode = document.getElementById(id)\n                            \"production\" !== \"development\"\n                                ? invariant(\n                                      domNode,\n                                      'Tried to get element with id of \"%s\" but it is not present on the page.',\n                                      id\n                                  )\n                                : invariant(domNode)\n                            return ReactMount.constructAndRenderComponent(\n                                constructor,\n                                props,\n                                domNode\n                            )\n                        },\n\n                        /**\n                         * Registers a container node into which React components will be rendered.\n                         * This also creates the \"reactRoot\" ID that will be assigned to the element\n                         * rendered within.\n                         *\n                         * @param {DOMElement} container DOM element to register as a container.\n                         * @return {string} The \"reactRoot\" ID of elements rendered within.\n                         */\n                        registerContainer: function(container) {\n                            var reactRootID = getReactRootID(container)\n                            if (reactRootID) {\n                                // If one exists, make sure it is a valid \"reactRoot\" ID.\n                                reactRootID = ReactInstanceHandles.getReactRootIDFromNodeID(\n                                    reactRootID\n                                )\n                            }\n                            if (!reactRootID) {\n                                // No valid \"reactRoot\" ID found, create one.\n                                reactRootID = ReactInstanceHandles.createReactRootID()\n                            }\n                            containersByReactRootID[reactRootID] = container\n                            return reactRootID\n                        },\n\n                        /**\n                         * Unmounts and destroys the React component rendered in the `container`.\n                         *\n                         * @param {DOMElement} container DOM element containing a React component.\n                         * @return {boolean} True if a component was found in and unmounted from\n                         *                   `container`\n                         */\n                        unmountComponentAtNode: function(container) {\n                            // Various parts of our code (such as ReactCompositeComponent's\n                            // _renderValidatedComponent) assume that calls to render aren't nested;\n                            // verify that that's the case. (Strictly speaking, unmounting won't cause a\n                            // render but we still don't expect to be in a render call here.)\n                            \"production\" !== \"development\"\n                                ? warning(\n                                      ReactCurrentOwner.current == null,\n                                      \"unmountComponentAtNode(): Render methods should be a pure function of \" +\n                                          \"props and state; triggering nested component updates from render is \" +\n                                          \"not allowed. If necessary, trigger nested updates in \" +\n                                          \"componentDidUpdate.\"\n                                  )\n                                : null\n\n                            \"production\" !== \"development\"\n                                ? invariant(\n                                      container &&\n                                          (container.nodeType === ELEMENT_NODE_TYPE ||\n                                              container.nodeType === DOC_NODE_TYPE),\n                                      \"unmountComponentAtNode(...): Target container is not a DOM element.\"\n                                  )\n                                : invariant(\n                                      container &&\n                                          (container.nodeType === ELEMENT_NODE_TYPE ||\n                                              container.nodeType === DOC_NODE_TYPE)\n                                  )\n\n                            var reactRootID = getReactRootID(container)\n                            var component = instancesByReactRootID[reactRootID]\n                            if (!component) {\n                                return false\n                            }\n                            ReactMount.unmountComponentFromNode(component, container)\n                            delete instancesByReactRootID[reactRootID]\n                            delete containersByReactRootID[reactRootID]\n                            if (\"production\" !== \"development\") {\n                                delete rootElementsByReactRootID[reactRootID]\n                            }\n                            return true\n                        },\n\n                        /**\n                         * Unmounts a component and removes it from the DOM.\n                         *\n                         * @param {ReactComponent} instance React component instance.\n                         * @param {DOMElement} container DOM element to unmount from.\n                         * @final\n                         * @internal\n                         * @see {ReactMount.unmountComponentAtNode}\n                         */\n                        unmountComponentFromNode: function(instance, container) {\n                            ReactReconciler.unmountComponent(instance)\n\n                            if (container.nodeType === DOC_NODE_TYPE) {\n                                container = container.documentElement\n                            }\n\n                            // http://jsperf.com/emptying-a-node\n                            while (container.lastChild) {\n                                container.removeChild(container.lastChild)\n                            }\n                        },\n\n                        /**\n                         * Finds the container DOM element that contains React component to which the\n                         * supplied DOM `id` belongs.\n                         *\n                         * @param {string} id The ID of an element rendered by a React component.\n                         * @return {?DOMElement} DOM element that contains the `id`.\n                         */\n                        findReactContainerForID: function(id) {\n                            var reactRootID = ReactInstanceHandles.getReactRootIDFromNodeID(id)\n                            var container = containersByReactRootID[reactRootID]\n\n                            if (\"production\" !== \"development\") {\n                                var rootElement = rootElementsByReactRootID[reactRootID]\n                                if (rootElement && rootElement.parentNode !== container) {\n                                    \"production\" !== \"development\"\n                                        ? invariant(\n                                              // Call internalGetID here because getID calls isValid which calls\n                                              // findReactContainerForID (this function).\n                                              internalGetID(rootElement) === reactRootID,\n                                              \"ReactMount: Root element ID differed from reactRootID.\"\n                                          )\n                                        : invariant(\n                                              // Call internalGetID here because getID calls isValid which calls\n                                              // findReactContainerForID (this function).\n                                              internalGetID(rootElement) === reactRootID\n                                          )\n\n                                    var containerChild = container.firstChild\n                                    if (\n                                        containerChild &&\n                                        reactRootID === internalGetID(containerChild)\n                                    ) {\n                                        // If the container has a new child with the same ID as the old\n                                        // root element, then rootElementsByReactRootID[reactRootID] is\n                                        // just stale and needs to be updated. The case that deserves a\n                                        // warning is when the container is empty.\n                                        rootElementsByReactRootID[reactRootID] = containerChild\n                                    } else {\n                                        \"production\" !== \"development\"\n                                            ? warning(\n                                                  false,\n                                                  \"ReactMount: Root element has been removed from its original \" +\n                                                      \"container. New container:\",\n                                                  rootElement.parentNode\n                                              )\n                                            : null\n                                    }\n                                }\n                            }\n\n                            return container\n                        },\n\n                        /**\n                         * Finds an element rendered by React with the supplied ID.\n                         *\n                         * @param {string} id ID of a DOM node in the React component.\n                         * @return {DOMElement} Root DOM node of the React component.\n                         */\n                        findReactNodeByID: function(id) {\n                            var reactRoot = ReactMount.findReactContainerForID(id)\n                            return ReactMount.findComponentRoot(reactRoot, id)\n                        },\n\n                        /**\n                         * True if the supplied `node` is rendered by React.\n                         *\n                         * @param {*} node DOM Element to check.\n                         * @return {boolean} True if the DOM Element appears to be rendered by React.\n                         * @internal\n                         */\n                        isRenderedByReact: function(node) {\n                            if (node.nodeType !== 1) {\n                                // Not a DOMElement, therefore not a React component\n                                return false\n                            }\n                            var id = ReactMount.getID(node)\n                            return id ? id.charAt(0) === SEPARATOR : false\n                        },\n\n                        /**\n                         * Traverses up the ancestors of the supplied node to find a node that is a\n                         * DOM representation of a React component.\n                         *\n                         * @param {*} node\n                         * @return {?DOMEventTarget}\n                         * @internal\n                         */\n                        getFirstReactDOM: function(node) {\n                            var current = node\n                            while (current && current.parentNode !== current) {\n                                if (ReactMount.isRenderedByReact(current)) {\n                                    return current\n                                }\n                                current = current.parentNode\n                            }\n                            return null\n                        },\n\n                        /**\n                         * Finds a node with the supplied `targetID` inside of the supplied\n                         * `ancestorNode`.  Exploits the ID naming scheme to perform the search\n                         * quickly.\n                         *\n                         * @param {DOMEventTarget} ancestorNode Search from this root.\n                         * @pararm {string} targetID ID of the DOM representation of the component.\n                         * @return {DOMEventTarget} DOM node with the supplied `targetID`.\n                         * @internal\n                         */\n                        findComponentRoot: function(ancestorNode, targetID) {\n                            var firstChildren = findComponentRootReusableArray\n                            var childIndex = 0\n\n                            var deepestAncestor =\n                                findDeepestCachedAncestor(targetID) || ancestorNode\n\n                            firstChildren[0] = deepestAncestor.firstChild\n                            firstChildren.length = 1\n\n                            while (childIndex < firstChildren.length) {\n                                var child = firstChildren[childIndex++]\n                                var targetChild\n\n                                while (child) {\n                                    var childID = ReactMount.getID(child)\n                                    if (childID) {\n                                        // Even if we find the node we're looking for, we finish looping\n                                        // through its siblings to ensure they're cached so that we don't have\n                                        // to revisit this node again. Otherwise, we make n^2 calls to getID\n                                        // when visiting the many children of a single node in order.\n\n                                        if (targetID === childID) {\n                                            targetChild = child\n                                        } else if (\n                                            ReactInstanceHandles.isAncestorIDOf(childID, targetID)\n                                        ) {\n                                            // If we find a child whose ID is an ancestor of the given ID,\n                                            // then we can be sure that we only want to search the subtree\n                                            // rooted at this child, so we can throw out the rest of the\n                                            // search state.\n                                            firstChildren.length = childIndex = 0\n                                            firstChildren.push(child.firstChild)\n                                        }\n                                    } else {\n                                        // If this child had no ID, then there's a chance that it was\n                                        // injected automatically by the browser, as when a `<table>`\n                                        // element sprouts an extra `<tbody>` child as a side effect of\n                                        // `.innerHTML` parsing. Optimistically continue down this\n                                        // branch, but not before examining the other siblings.\n                                        firstChildren.push(child.firstChild)\n                                    }\n\n                                    child = child.nextSibling\n                                }\n\n                                if (targetChild) {\n                                    // Emptying firstChildren/findComponentRootReusableArray is\n                                    // not necessary for correctness, but it helps the GC reclaim\n                                    // any nodes that were left at the end of the search.\n                                    firstChildren.length = 0\n\n                                    return targetChild\n                                }\n                            }\n\n                            firstChildren.length = 0\n\n                            \"production\" !== \"development\"\n                                ? invariant(\n                                      false,\n                                      \"findComponentRoot(..., %s): Unable to find element. This probably \" +\n                                          \"means the DOM was unexpectedly mutated (e.g., by the browser), \" +\n                                          \"usually due to forgetting a <tbody> when using tables, nesting tags \" +\n                                          \"like <form>, <p>, or <a>, or using non-SVG elements in an <svg> \" +\n                                          \"parent. \" +\n                                          \"Try inspecting the child nodes of the element with React ID `%s`.\",\n                                      targetID,\n                                      ReactMount.getID(ancestorNode)\n                                  )\n                                : invariant(false)\n                        },\n\n                        _mountImageIntoNode: function(markup, container, shouldReuseMarkup) {\n                            \"production\" !== \"development\"\n                                ? invariant(\n                                      container &&\n                                          (container.nodeType === ELEMENT_NODE_TYPE ||\n                                              container.nodeType === DOC_NODE_TYPE),\n                                      \"mountComponentIntoNode(...): Target container is not valid.\"\n                                  )\n                                : invariant(\n                                      container &&\n                                          (container.nodeType === ELEMENT_NODE_TYPE ||\n                                              container.nodeType === DOC_NODE_TYPE)\n                                  )\n\n                            if (shouldReuseMarkup) {\n                                var rootElement = getReactRootElementInContainer(container)\n                                if (ReactMarkupChecksum.canReuseMarkup(markup, rootElement)) {\n                                    return\n                                } else {\n                                    var checksum = rootElement.getAttribute(\n                                        ReactMarkupChecksum.CHECKSUM_ATTR_NAME\n                                    )\n                                    rootElement.removeAttribute(\n                                        ReactMarkupChecksum.CHECKSUM_ATTR_NAME\n                                    )\n\n                                    var rootMarkup = rootElement.outerHTML\n                                    rootElement.setAttribute(\n                                        ReactMarkupChecksum.CHECKSUM_ATTR_NAME,\n                                        checksum\n                                    )\n\n                                    var diffIndex = firstDifferenceIndex(markup, rootMarkup)\n                                    var difference =\n                                        \" (client) \" +\n                                        markup.substring(diffIndex - 20, diffIndex + 20) +\n                                        \"\\n (server) \" +\n                                        rootMarkup.substring(diffIndex - 20, diffIndex + 20)\n\n                                    \"production\" !== \"development\"\n                                        ? invariant(\n                                              container.nodeType !== DOC_NODE_TYPE,\n                                              \"You're trying to render a component to the document using \" +\n                                                  \"server rendering but the checksum was invalid. This usually \" +\n                                                  \"means you rendered a different component type or props on \" +\n                                                  \"the client from the one on the server, or your render() \" +\n                                                  \"methods are impure. React cannot handle this case due to \" +\n                                                  \"cross-browser quirks by rendering at the document root. You \" +\n                                                  \"should look for environment dependent code in your components \" +\n                                                  \"and ensure the props are the same client and server side:\\n%s\",\n                                              difference\n                                          )\n                                        : invariant(container.nodeType !== DOC_NODE_TYPE)\n\n                                    if (\"production\" !== \"development\") {\n                                        \"production\" !== \"development\"\n                                            ? warning(\n                                                  false,\n                                                  \"React attempted to reuse markup in a container but the \" +\n                                                      \"checksum was invalid. This generally means that you are \" +\n                                                      \"using server rendering and the markup generated on the \" +\n                                                      \"server was not what the client was expecting. React injected \" +\n                                                      \"new markup to compensate which works but you have lost many \" +\n                                                      \"of the benefits of server rendering. Instead, figure out \" +\n                                                      \"why the markup being generated is different on the client \" +\n                                                      \"or server:\\n%s\",\n                                                  difference\n                                              )\n                                            : null\n                                    }\n                                }\n                            }\n\n                            \"production\" !== \"development\"\n                                ? invariant(\n                                      container.nodeType !== DOC_NODE_TYPE,\n                                      \"You're trying to render a component to the document but \" +\n                                          \"you didn't use server rendering. We can't do this \" +\n                                          \"without using server rendering due to cross-browser quirks. \" +\n                                          \"See React.renderToString() for server rendering.\"\n                                  )\n                                : invariant(container.nodeType !== DOC_NODE_TYPE)\n\n                            setInnerHTML(container, markup)\n                        },\n\n                        /**\n                         * React ID utilities.\n                         */\n\n                        getReactRootID: getReactRootID,\n\n                        getID: getID,\n\n                        setID: setID,\n\n                        getNode: getNode,\n\n                        getNodeFromInstance: getNodeFromInstance,\n\n                        purgeID: purgeID\n                    }\n\n                    ReactPerf.measureMethods(ReactMount, \"ReactMount\", {\n                        _renderNewRootComponent: \"_renderNewRootComponent\",\n                        _mountImageIntoNode: \"_mountImageIntoNode\"\n                    })\n\n                    module.exports = ReactMount\n                },\n                {\n                    \"100\": 100,\n                    \"11\": 11,\n                    \"123\": 123,\n                    \"130\": 130,\n                    \"144\": 144,\n                    \"149\": 149,\n                    \"150\": 150,\n                    \"164\": 164,\n                    \"167\": 167,\n                    \"171\": 171,\n                    \"33\": 33,\n                    \"45\": 45,\n                    \"63\": 63,\n                    \"64\": 64,\n                    \"65\": 65,\n                    \"72\": 72,\n                    \"73\": 73,\n                    \"76\": 76,\n                    \"82\": 82,\n                    \"89\": 89,\n                    \"99\": 99\n                }\n            ],\n            78: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule ReactMultiChild\n                     * @typechecks static-only\n                     */\n\n                    \"use strict\"\n\n                    var ReactComponentEnvironment = _dereq_(41)\n                    var ReactMultiChildUpdateTypes = _dereq_(79)\n\n                    var ReactReconciler = _dereq_(89)\n                    var ReactChildReconciler = _dereq_(36)\n\n                    /**\n                     * Updating children of a component may trigger recursive updates. The depth is\n                     * used to batch recursive updates to render markup more efficiently.\n                     *\n                     * @type {number}\n                     * @private\n                     */\n                    var updateDepth = 0\n\n                    /**\n                     * Queue of update configuration objects.\n                     *\n                     * Each object has a `type` property that is in `ReactMultiChildUpdateTypes`.\n                     *\n                     * @type {array<object>}\n                     * @private\n                     */\n                    var updateQueue = []\n\n                    /**\n                     * Queue of markup to be rendered.\n                     *\n                     * @type {array<string>}\n                     * @private\n                     */\n                    var markupQueue = []\n\n                    /**\n                     * Enqueues markup to be rendered and inserted at a supplied index.\n                     *\n                     * @param {string} parentID ID of the parent component.\n                     * @param {string} markup Markup that renders into an element.\n                     * @param {number} toIndex Destination index.\n                     * @private\n                     */\n                    function enqueueMarkup(parentID, markup, toIndex) {\n                        // NOTE: Null values reduce hidden classes.\n                        updateQueue.push({\n                            parentID: parentID,\n                            parentNode: null,\n                            type: ReactMultiChildUpdateTypes.INSERT_MARKUP,\n                            markupIndex: markupQueue.push(markup) - 1,\n                            textContent: null,\n                            fromIndex: null,\n                            toIndex: toIndex\n                        })\n                    }\n\n                    /**\n                     * Enqueues moving an existing element to another index.\n                     *\n                     * @param {string} parentID ID of the parent component.\n                     * @param {number} fromIndex Source index of the existing element.\n                     * @param {number} toIndex Destination index of the element.\n                     * @private\n                     */\n                    function enqueueMove(parentID, fromIndex, toIndex) {\n                        // NOTE: Null values reduce hidden classes.\n                        updateQueue.push({\n                            parentID: parentID,\n                            parentNode: null,\n                            type: ReactMultiChildUpdateTypes.MOVE_EXISTING,\n                            markupIndex: null,\n                            textContent: null,\n                            fromIndex: fromIndex,\n                            toIndex: toIndex\n                        })\n                    }\n\n                    /**\n                     * Enqueues removing an element at an index.\n                     *\n                     * @param {string} parentID ID of the parent component.\n                     * @param {number} fromIndex Index of the element to remove.\n                     * @private\n                     */\n                    function enqueueRemove(parentID, fromIndex) {\n                        // NOTE: Null values reduce hidden classes.\n                        updateQueue.push({\n                            parentID: parentID,\n                            parentNode: null,\n                            type: ReactMultiChildUpdateTypes.REMOVE_NODE,\n                            markupIndex: null,\n                            textContent: null,\n                            fromIndex: fromIndex,\n                            toIndex: null\n                        })\n                    }\n\n                    /**\n                     * Enqueues setting the text content.\n                     *\n                     * @param {string} parentID ID of the parent component.\n                     * @param {string} textContent Text content to set.\n                     * @private\n                     */\n                    function enqueueTextContent(parentID, textContent) {\n                        // NOTE: Null values reduce hidden classes.\n                        updateQueue.push({\n                            parentID: parentID,\n                            parentNode: null,\n                            type: ReactMultiChildUpdateTypes.TEXT_CONTENT,\n                            markupIndex: null,\n                            textContent: textContent,\n                            fromIndex: null,\n                            toIndex: null\n                        })\n                    }\n\n                    /**\n                     * Processes any enqueued updates.\n                     *\n                     * @private\n                     */\n                    function processQueue() {\n                        if (updateQueue.length) {\n                            ReactComponentEnvironment.processChildrenUpdates(\n                                updateQueue,\n                                markupQueue\n                            )\n                            clearQueue()\n                        }\n                    }\n\n                    /**\n                     * Clears any enqueued updates.\n                     *\n                     * @private\n                     */\n                    function clearQueue() {\n                        updateQueue.length = 0\n                        markupQueue.length = 0\n                    }\n\n                    /**\n                     * ReactMultiChild are capable of reconciling multiple children.\n                     *\n                     * @class ReactMultiChild\n                     * @internal\n                     */\n                    var ReactMultiChild = {\n                        /**\n                         * Provides common functionality for components that must reconcile multiple\n                         * children. This is used by `ReactDOMComponent` to mount, update, and\n                         * unmount child components.\n                         *\n                         * @lends {ReactMultiChild.prototype}\n                         */\n                        Mixin: {\n                            /**\n                             * Generates a \"mount image\" for each of the supplied children. In the case\n                             * of `ReactDOMComponent`, a mount image is a string of markup.\n                             *\n                             * @param {?object} nestedChildren Nested child maps.\n                             * @return {array} An array of mounted representations.\n                             * @internal\n                             */\n                            mountChildren: function(nestedChildren, transaction, context) {\n                                var children = ReactChildReconciler.instantiateChildren(\n                                    nestedChildren,\n                                    transaction,\n                                    context\n                                )\n                                this._renderedChildren = children\n                                var mountImages = []\n                                var index = 0\n                                for (var name in children) {\n                                    if (children.hasOwnProperty(name)) {\n                                        var child = children[name]\n                                        // Inlined for performance, see `ReactInstanceHandles.createReactID`.\n                                        var rootID = this._rootNodeID + name\n                                        var mountImage = ReactReconciler.mountComponent(\n                                            child,\n                                            rootID,\n                                            transaction,\n                                            context\n                                        )\n                                        child._mountIndex = index\n                                        mountImages.push(mountImage)\n                                        index++\n                                    }\n                                }\n                                return mountImages\n                            },\n\n                            /**\n                             * Replaces any rendered children with a text content string.\n                             *\n                             * @param {string} nextContent String of content.\n                             * @internal\n                             */\n                            updateTextContent: function(nextContent) {\n                                updateDepth++\n                                var errorThrown = true\n                                try {\n                                    var prevChildren = this._renderedChildren\n                                    // Remove any rendered children.\n                                    ReactChildReconciler.unmountChildren(prevChildren)\n                                    // TODO: The setTextContent operation should be enough\n                                    for (var name in prevChildren) {\n                                        if (prevChildren.hasOwnProperty(name)) {\n                                            this._unmountChildByName(prevChildren[name], name)\n                                        }\n                                    }\n                                    // Set new text content.\n                                    this.setTextContent(nextContent)\n                                    errorThrown = false\n                                } finally {\n                                    updateDepth--\n                                    if (!updateDepth) {\n                                        if (errorThrown) {\n                                            clearQueue()\n                                        } else {\n                                            processQueue()\n                                        }\n                                    }\n                                }\n                            },\n\n                            /**\n                             * Updates the rendered children with new children.\n                             *\n                             * @param {?object} nextNestedChildren Nested child maps.\n                             * @param {ReactReconcileTransaction} transaction\n                             * @internal\n                             */\n                            updateChildren: function(nextNestedChildren, transaction, context) {\n                                updateDepth++\n                                var errorThrown = true\n                                try {\n                                    this._updateChildren(nextNestedChildren, transaction, context)\n                                    errorThrown = false\n                                } finally {\n                                    updateDepth--\n                                    if (!updateDepth) {\n                                        if (errorThrown) {\n                                            clearQueue()\n                                        } else {\n                                            processQueue()\n                                        }\n                                    }\n                                }\n                            },\n\n                            /**\n                             * Improve performance by isolating this hot code path from the try/catch\n                             * block in `updateChildren`.\n                             *\n                             * @param {?object} nextNestedChildren Nested child maps.\n                             * @param {ReactReconcileTransaction} transaction\n                             * @final\n                             * @protected\n                             */\n                            _updateChildren: function(nextNestedChildren, transaction, context) {\n                                var prevChildren = this._renderedChildren\n                                var nextChildren = ReactChildReconciler.updateChildren(\n                                    prevChildren,\n                                    nextNestedChildren,\n                                    transaction,\n                                    context\n                                )\n                                this._renderedChildren = nextChildren\n                                if (!nextChildren && !prevChildren) {\n                                    return\n                                }\n                                var name\n                                // `nextIndex` will increment for each child in `nextChildren`, but\n                                // `lastIndex` will be the last index visited in `prevChildren`.\n                                var lastIndex = 0\n                                var nextIndex = 0\n                                for (name in nextChildren) {\n                                    if (!nextChildren.hasOwnProperty(name)) {\n                                        continue\n                                    }\n                                    var prevChild = prevChildren && prevChildren[name]\n                                    var nextChild = nextChildren[name]\n                                    if (prevChild === nextChild) {\n                                        this.moveChild(prevChild, nextIndex, lastIndex)\n                                        lastIndex = Math.max(prevChild._mountIndex, lastIndex)\n                                        prevChild._mountIndex = nextIndex\n                                    } else {\n                                        if (prevChild) {\n                                            // Update `lastIndex` before `_mountIndex` gets unset by unmounting.\n                                            lastIndex = Math.max(prevChild._mountIndex, lastIndex)\n                                            this._unmountChildByName(prevChild, name)\n                                        }\n                                        // The child must be instantiated before it's mounted.\n                                        this._mountChildByNameAtIndex(\n                                            nextChild,\n                                            name,\n                                            nextIndex,\n                                            transaction,\n                                            context\n                                        )\n                                    }\n                                    nextIndex++\n                                }\n                                // Remove children that are no longer present.\n                                for (name in prevChildren) {\n                                    if (\n                                        prevChildren.hasOwnProperty(name) &&\n                                        !(nextChildren && nextChildren.hasOwnProperty(name))\n                                    ) {\n                                        this._unmountChildByName(prevChildren[name], name)\n                                    }\n                                }\n                            },\n\n                            /**\n                             * Unmounts all rendered children. This should be used to clean up children\n                             * when this component is unmounted.\n                             *\n                             * @internal\n                             */\n                            unmountChildren: function() {\n                                var renderedChildren = this._renderedChildren\n                                ReactChildReconciler.unmountChildren(renderedChildren)\n                                this._renderedChildren = null\n                            },\n\n                            /**\n                             * Moves a child component to the supplied index.\n                             *\n                             * @param {ReactComponent} child Component to move.\n                             * @param {number} toIndex Destination index of the element.\n                             * @param {number} lastIndex Last index visited of the siblings of `child`.\n                             * @protected\n                             */\n                            moveChild: function(child, toIndex, lastIndex) {\n                                // If the index of `child` is less than `lastIndex`, then it needs to\n                                // be moved. Otherwise, we do not need to move it because a child will be\n                                // inserted or moved before `child`.\n                                if (child._mountIndex < lastIndex) {\n                                    enqueueMove(this._rootNodeID, child._mountIndex, toIndex)\n                                }\n                            },\n\n                            /**\n                             * Creates a child component.\n                             *\n                             * @param {ReactComponent} child Component to create.\n                             * @param {string} mountImage Markup to insert.\n                             * @protected\n                             */\n                            createChild: function(child, mountImage) {\n                                enqueueMarkup(this._rootNodeID, mountImage, child._mountIndex)\n                            },\n\n                            /**\n                             * Removes a child component.\n                             *\n                             * @param {ReactComponent} child Child to remove.\n                             * @protected\n                             */\n                            removeChild: function(child) {\n                                enqueueRemove(this._rootNodeID, child._mountIndex)\n                            },\n\n                            /**\n                             * Sets this text content string.\n                             *\n                             * @param {string} textContent Text content to set.\n                             * @protected\n                             */\n                            setTextContent: function(textContent) {\n                                enqueueTextContent(this._rootNodeID, textContent)\n                            },\n\n                            /**\n                             * Mounts a child with the supplied name.\n                             *\n                             * NOTE: This is part of `updateChildren` and is here for readability.\n                             *\n                             * @param {ReactComponent} child Component to mount.\n                             * @param {string} name Name of the child.\n                             * @param {number} index Index at which to insert the child.\n                             * @param {ReactReconcileTransaction} transaction\n                             * @private\n                             */\n                            _mountChildByNameAtIndex: function(\n                                child,\n                                name,\n                                index,\n                                transaction,\n                                context\n                            ) {\n                                // Inlined for performance, see `ReactInstanceHandles.createReactID`.\n                                var rootID = this._rootNodeID + name\n                                var mountImage = ReactReconciler.mountComponent(\n                                    child,\n                                    rootID,\n                                    transaction,\n                                    context\n                                )\n                                child._mountIndex = index\n                                this.createChild(child, mountImage)\n                            },\n\n                            /**\n                             * Unmounts a rendered child by name.\n                             *\n                             * NOTE: This is part of `updateChildren` and is here for readability.\n                             *\n                             * @param {ReactComponent} child Component to unmount.\n                             * @param {string} name Name of the child in `this._renderedChildren`.\n                             * @private\n                             */\n                            _unmountChildByName: function(child, name) {\n                                this.removeChild(child)\n                                child._mountIndex = null\n                            }\n                        }\n                    }\n\n                    module.exports = ReactMultiChild\n                },\n                { \"36\": 36, \"41\": 41, \"79\": 79, \"89\": 89 }\n            ],\n            79: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule ReactMultiChildUpdateTypes\n                     */\n\n                    \"use strict\"\n\n                    var keyMirror = _dereq_(156)\n\n                    /**\n                     * When a component's children are updated, a series of update configuration\n                     * objects are created in order to batch and serialize the required changes.\n                     *\n                     * Enumerates all the possible types of update configurations.\n                     *\n                     * @internal\n                     */\n                    var ReactMultiChildUpdateTypes = keyMirror({\n                        INSERT_MARKUP: null,\n                        MOVE_EXISTING: null,\n                        REMOVE_NODE: null,\n                        TEXT_CONTENT: null\n                    })\n\n                    module.exports = ReactMultiChildUpdateTypes\n                },\n                { \"156\": 156 }\n            ],\n            80: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2014-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule ReactNativeComponent\n                     */\n\n                    \"use strict\"\n\n                    var assign = _dereq_(29)\n                    var invariant = _dereq_(150)\n\n                    var autoGenerateWrapperClass = null\n                    var genericComponentClass = null\n                    // This registry keeps track of wrapper classes around native tags\n                    var tagToComponentClass = {}\n                    var textComponentClass = null\n\n                    var ReactNativeComponentInjection = {\n                        // This accepts a class that receives the tag string. This is a catch all\n                        // that can render any kind of tag.\n                        injectGenericComponentClass: function(componentClass) {\n                            genericComponentClass = componentClass\n                        },\n                        // This accepts a text component class that takes the text string to be\n                        // rendered as props.\n                        injectTextComponentClass: function(componentClass) {\n                            textComponentClass = componentClass\n                        },\n                        // This accepts a keyed object with classes as values. Each key represents a\n                        // tag. That particular tag will use this class instead of the generic one.\n                        injectComponentClasses: function(componentClasses) {\n                            assign(tagToComponentClass, componentClasses)\n                        },\n                        // Temporary hack since we expect DOM refs to behave like composites,\n                        // for this release.\n                        injectAutoWrapper: function(wrapperFactory) {\n                            autoGenerateWrapperClass = wrapperFactory\n                        }\n                    }\n\n                    /**\n                     * Get a composite component wrapper class for a specific tag.\n                     *\n                     * @param {ReactElement} element The tag for which to get the class.\n                     * @return {function} The React class constructor function.\n                     */\n                    function getComponentClassForElement(element) {\n                        if (typeof element.type === \"function\") {\n                            return element.type\n                        }\n                        var tag = element.type\n                        var componentClass = tagToComponentClass[tag]\n                        if (componentClass == null) {\n                            tagToComponentClass[tag] = componentClass = autoGenerateWrapperClass(\n                                tag\n                            )\n                        }\n                        return componentClass\n                    }\n\n                    /**\n                     * Get a native internal component class for a specific tag.\n                     *\n                     * @param {ReactElement} element The element to create.\n                     * @return {function} The internal class constructor function.\n                     */\n                    function createInternalComponent(element) {\n                        \"production\" !== \"development\"\n                            ? invariant(\n                                  genericComponentClass,\n                                  \"There is no registered component for the tag %s\",\n                                  element.type\n                              )\n                            : invariant(genericComponentClass)\n                        return new genericComponentClass(element.type, element.props)\n                    }\n\n                    /**\n                     * @param {ReactText} text\n                     * @return {ReactComponent}\n                     */\n                    function createInstanceForText(text) {\n                        return new textComponentClass(text)\n                    }\n\n                    /**\n                     * @param {ReactComponent} component\n                     * @return {boolean}\n                     */\n                    function isTextComponent(component) {\n                        return component instanceof textComponentClass\n                    }\n\n                    var ReactNativeComponent = {\n                        getComponentClassForElement: getComponentClassForElement,\n                        createInternalComponent: createInternalComponent,\n                        createInstanceForText: createInstanceForText,\n                        isTextComponent: isTextComponent,\n                        injection: ReactNativeComponentInjection\n                    }\n\n                    module.exports = ReactNativeComponent\n                },\n                { \"150\": 150, \"29\": 29 }\n            ],\n            81: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule ReactOwner\n                     */\n\n                    \"use strict\"\n\n                    var invariant = _dereq_(150)\n\n                    /**\n                     * ReactOwners are capable of storing references to owned components.\n                     *\n                     * All components are capable of //being// referenced by owner components, but\n                     * only ReactOwner components are capable of //referencing// owned components.\n                     * The named reference is known as a \"ref\".\n                     *\n                     * Refs are available when mounted and updated during reconciliation.\n                     *\n                     *   var MyComponent = React.createClass({\n                     *     render: function() {\n                     *       return (\n                     *         <div onClick={this.handleClick}>\n                     *           <CustomComponent ref=\"custom\" />\n                     *         </div>\n                     *       );\n                     *     },\n                     *     handleClick: function() {\n                     *       this.refs.custom.handleClick();\n                     *     },\n                     *     componentDidMount: function() {\n                     *       this.refs.custom.initialize();\n                     *     }\n                     *   });\n                     *\n                     * Refs should rarely be used. When refs are used, they should only be done to\n                     * control data that is not handled by React's data flow.\n                     *\n                     * @class ReactOwner\n                     */\n                    var ReactOwner = {\n                        /**\n                         * @param {?object} object\n                         * @return {boolean} True if `object` is a valid owner.\n                         * @final\n                         */\n                        isValidOwner: function(object) {\n                            return !!(\n                                object &&\n                                typeof object.attachRef === \"function\" &&\n                                typeof object.detachRef === \"function\"\n                            )\n                        },\n\n                        /**\n                         * Adds a component by ref to an owner component.\n                         *\n                         * @param {ReactComponent} component Component to reference.\n                         * @param {string} ref Name by which to refer to the component.\n                         * @param {ReactOwner} owner Component on which to record the ref.\n                         * @final\n                         * @internal\n                         */\n                        addComponentAsRefTo: function(component, ref, owner) {\n                            \"production\" !== \"development\"\n                                ? invariant(\n                                      ReactOwner.isValidOwner(owner),\n                                      \"addComponentAsRefTo(...): Only a ReactOwner can have refs. This \" +\n                                          \"usually means that you're trying to add a ref to a component that \" +\n                                          \"doesn't have an owner (that is, was not created inside of another \" +\n                                          \"component's `render` method). Try rendering this component inside of \" +\n                                          \"a new top-level component which will hold the ref.\"\n                                  )\n                                : invariant(ReactOwner.isValidOwner(owner))\n                            owner.attachRef(ref, component)\n                        },\n\n                        /**\n                         * Removes a component by ref from an owner component.\n                         *\n                         * @param {ReactComponent} component Component to dereference.\n                         * @param {string} ref Name of the ref to remove.\n                         * @param {ReactOwner} owner Component on which the ref is recorded.\n                         * @final\n                         * @internal\n                         */\n                        removeComponentAsRefFrom: function(component, ref, owner) {\n                            \"production\" !== \"development\"\n                                ? invariant(\n                                      ReactOwner.isValidOwner(owner),\n                                      \"removeComponentAsRefFrom(...): Only a ReactOwner can have refs. This \" +\n                                          \"usually means that you're trying to remove a ref to a component that \" +\n                                          \"doesn't have an owner (that is, was not created inside of another \" +\n                                          \"component's `render` method). Try rendering this component inside of \" +\n                                          \"a new top-level component which will hold the ref.\"\n                                  )\n                                : invariant(ReactOwner.isValidOwner(owner))\n                            // Check that `component` is still the current ref because we do not want to\n                            // detach the ref if another component stole it.\n                            if (\n                                owner.getPublicInstance().refs[ref] ===\n                                component.getPublicInstance()\n                            ) {\n                                owner.detachRef(ref)\n                            }\n                        }\n                    }\n\n                    module.exports = ReactOwner\n                },\n                { \"150\": 150 }\n            ],\n            82: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule ReactPerf\n                     * @typechecks static-only\n                     */\n\n                    \"use strict\"\n\n                    /**\n                     * ReactPerf is a general AOP system designed to measure performance. This\n                     * module only has the hooks: see ReactDefaultPerf for the analysis tool.\n                     */\n                    var ReactPerf = {\n                        /**\n                         * Boolean to enable/disable measurement. Set to false by default to prevent\n                         * accidental logging and perf loss.\n                         */\n                        enableMeasure: false,\n\n                        /**\n                         * Holds onto the measure function in use. By default, don't measure\n                         * anything, but we'll override this if we inject a measure function.\n                         */\n                        storedMeasure: _noMeasure,\n\n                        /**\n                         * @param {object} object\n                         * @param {string} objectName\n                         * @param {object<string>} methodNames\n                         */\n                        measureMethods: function(object, objectName, methodNames) {\n                            if (\"production\" !== \"development\") {\n                                for (var key in methodNames) {\n                                    if (!methodNames.hasOwnProperty(key)) {\n                                        continue\n                                    }\n                                    object[key] = ReactPerf.measure(\n                                        objectName,\n                                        methodNames[key],\n                                        object[key]\n                                    )\n                                }\n                            }\n                        },\n\n                        /**\n                         * Use this to wrap methods you want to measure. Zero overhead in production.\n                         *\n                         * @param {string} objName\n                         * @param {string} fnName\n                         * @param {function} func\n                         * @return {function}\n                         */\n                        measure: function(objName, fnName, func) {\n                            if (\"production\" !== \"development\") {\n                                var measuredFunc = null\n                                var wrapper = function() {\n                                    if (ReactPerf.enableMeasure) {\n                                        if (!measuredFunc) {\n                                            measuredFunc = ReactPerf.storedMeasure(\n                                                objName,\n                                                fnName,\n                                                func\n                                            )\n                                        }\n                                        return measuredFunc.apply(this, arguments)\n                                    }\n                                    return func.apply(this, arguments)\n                                }\n                                wrapper.displayName = objName + \"_\" + fnName\n                                return wrapper\n                            }\n                            return func\n                        },\n\n                        injection: {\n                            /**\n                             * @param {function} measure\n                             */\n                            injectMeasure: function(measure) {\n                                ReactPerf.storedMeasure = measure\n                            }\n                        }\n                    }\n\n                    /**\n                     * Simply passes through the measured function, without measuring it.\n                     *\n                     * @param {string} objName\n                     * @param {string} fnName\n                     * @param {function} func\n                     * @return {function}\n                     */\n                    function _noMeasure(objName, fnName, func) {\n                        return func\n                    }\n\n                    module.exports = ReactPerf\n                },\n                {}\n            ],\n            83: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule ReactPropTransferer\n                     */\n\n                    \"use strict\"\n\n                    var assign = _dereq_(29)\n                    var emptyFunction = _dereq_(129)\n                    var joinClasses = _dereq_(155)\n\n                    /**\n                     * Creates a transfer strategy that will merge prop values using the supplied\n                     * `mergeStrategy`. If a prop was previously unset, this just sets it.\n                     *\n                     * @param {function} mergeStrategy\n                     * @return {function}\n                     */\n                    function createTransferStrategy(mergeStrategy) {\n                        return function(props, key, value) {\n                            if (!props.hasOwnProperty(key)) {\n                                props[key] = value\n                            } else {\n                                props[key] = mergeStrategy(props[key], value)\n                            }\n                        }\n                    }\n\n                    var transferStrategyMerge = createTransferStrategy(function(a, b) {\n                        // `merge` overrides the first object's (`props[key]` above) keys using the\n                        // second object's (`value`) keys. An object's style's existing `propA` would\n                        // get overridden. Flip the order here.\n                        return assign({}, b, a)\n                    })\n\n                    /**\n                     * Transfer strategies dictate how props are transferred by `transferPropsTo`.\n                     * NOTE: if you add any more exceptions to this list you should be sure to\n                     * update `cloneWithProps()` accordingly.\n                     */\n                    var TransferStrategies = {\n                        /**\n                         * Never transfer `children`.\n                         */\n                        children: emptyFunction,\n                        /**\n                         * Transfer the `className` prop by merging them.\n                         */\n                        className: createTransferStrategy(joinClasses),\n                        /**\n                         * Transfer the `style` prop (which is an object) by merging them.\n                         */\n                        style: transferStrategyMerge\n                    }\n\n                    /**\n                     * Mutates the first argument by transferring the properties from the second\n                     * argument.\n                     *\n                     * @param {object} props\n                     * @param {object} newProps\n                     * @return {object}\n                     */\n                    function transferInto(props, newProps) {\n                        for (var thisKey in newProps) {\n                            if (!newProps.hasOwnProperty(thisKey)) {\n                                continue\n                            }\n\n                            var transferStrategy = TransferStrategies[thisKey]\n\n                            if (transferStrategy && TransferStrategies.hasOwnProperty(thisKey)) {\n                                transferStrategy(props, thisKey, newProps[thisKey])\n                            } else if (!props.hasOwnProperty(thisKey)) {\n                                props[thisKey] = newProps[thisKey]\n                            }\n                        }\n                        return props\n                    }\n\n                    /**\n                     * ReactPropTransferer are capable of transferring props to another component\n                     * using a `transferPropsTo` method.\n                     *\n                     * @class ReactPropTransferer\n                     */\n                    var ReactPropTransferer = {\n                        /**\n                         * Merge two props objects using TransferStrategies.\n                         *\n                         * @param {object} oldProps original props (they take precedence)\n                         * @param {object} newProps new props to merge in\n                         * @return {object} a new object containing both sets of props merged.\n                         */\n                        mergeProps: function(oldProps, newProps) {\n                            return transferInto(assign({}, oldProps), newProps)\n                        }\n                    }\n\n                    module.exports = ReactPropTransferer\n                },\n                { \"129\": 129, \"155\": 155, \"29\": 29 }\n            ],\n            84: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule ReactPropTypeLocationNames\n                     */\n\n                    \"use strict\"\n\n                    var ReactPropTypeLocationNames = {}\n\n                    if (\"production\" !== \"development\") {\n                        ReactPropTypeLocationNames = {\n                            prop: \"prop\",\n                            context: \"context\",\n                            childContext: \"child context\"\n                        }\n                    }\n\n                    module.exports = ReactPropTypeLocationNames\n                },\n                {}\n            ],\n            85: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule ReactPropTypeLocations\n                     */\n\n                    \"use strict\"\n\n                    var keyMirror = _dereq_(156)\n\n                    var ReactPropTypeLocations = keyMirror({\n                        prop: null,\n                        context: null,\n                        childContext: null\n                    })\n\n                    module.exports = ReactPropTypeLocations\n                },\n                { \"156\": 156 }\n            ],\n            86: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule ReactPropTypes\n                     */\n\n                    \"use strict\"\n\n                    var ReactElement = _dereq_(63)\n                    var ReactFragment = _dereq_(69)\n                    var ReactPropTypeLocationNames = _dereq_(84)\n\n                    var emptyFunction = _dereq_(129)\n\n                    /**\n                     * Collection of methods that allow declaration and validation of props that are\n                     * supplied to React components. Example usage:\n                     *\n                     *   var Props = require('ReactPropTypes');\n                     *   var MyArticle = React.createClass({\n                     *     propTypes: {\n                     *       // An optional string prop named \"description\".\n                     *       description: Props.string,\n                     *\n                     *       // A required enum prop named \"category\".\n                     *       category: Props.oneOf(['News','Photos']).isRequired,\n                     *\n                     *       // A prop named \"dialog\" that requires an instance of Dialog.\n                     *       dialog: Props.instanceOf(Dialog).isRequired\n                     *     },\n                     *     render: function() { ... }\n                     *   });\n                     *\n                     * A more formal specification of how these methods are used:\n                     *\n                     *   type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)\n                     *   decl := ReactPropTypes.{type}(.isRequired)?\n                     *\n                     * Each and every declaration produces a function with the same signature. This\n                     * allows the creation of custom validation functions. For example:\n                     *\n                     *  var MyLink = React.createClass({\n                     *    propTypes: {\n                     *      // An optional string or URI prop named \"href\".\n                     *      href: function(props, propName, componentName) {\n                     *        var propValue = props[propName];\n                     *        if (propValue != null && typeof propValue !== 'string' &&\n                     *            !(propValue instanceof URI)) {\n                     *          return new Error(\n                     *            'Expected a string or an URI for ' + propName + ' in ' +\n                     *            componentName\n                     *          );\n                     *        }\n                     *      }\n                     *    },\n                     *    render: function() {...}\n                     *  });\n                     *\n                     * @internal\n                     */\n\n                    var ANONYMOUS = \"<<anonymous>>\"\n\n                    var elementTypeChecker = createElementTypeChecker()\n                    var nodeTypeChecker = createNodeChecker()\n\n                    var ReactPropTypes = {\n                        array: createPrimitiveTypeChecker(\"array\"),\n                        bool: createPrimitiveTypeChecker(\"boolean\"),\n                        func: createPrimitiveTypeChecker(\"function\"),\n                        number: createPrimitiveTypeChecker(\"number\"),\n                        object: createPrimitiveTypeChecker(\"object\"),\n                        string: createPrimitiveTypeChecker(\"string\"),\n\n                        any: createAnyTypeChecker(),\n                        arrayOf: createArrayOfTypeChecker,\n                        element: elementTypeChecker,\n                        instanceOf: createInstanceTypeChecker,\n                        node: nodeTypeChecker,\n                        objectOf: createObjectOfTypeChecker,\n                        oneOf: createEnumTypeChecker,\n                        oneOfType: createUnionTypeChecker,\n                        shape: createShapeTypeChecker\n                    }\n\n                    function createChainableTypeChecker(validate) {\n                        function checkType(isRequired, props, propName, componentName, location) {\n                            componentName = componentName || ANONYMOUS\n                            if (props[propName] == null) {\n                                var locationName = ReactPropTypeLocationNames[location]\n                                if (isRequired) {\n                                    return new Error(\n                                        \"Required \" +\n                                            locationName +\n                                            \" `\" +\n                                            propName +\n                                            \"` was not specified in \" +\n                                            (\"`\" + componentName + \"`.\")\n                                    )\n                                }\n                                return null\n                            } else {\n                                return validate(props, propName, componentName, location)\n                            }\n                        }\n\n                        var chainedCheckType = checkType.bind(null, false)\n                        chainedCheckType.isRequired = checkType.bind(null, true)\n\n                        return chainedCheckType\n                    }\n\n                    function createPrimitiveTypeChecker(expectedType) {\n                        function validate(props, propName, componentName, location) {\n                            var propValue = props[propName]\n                            var propType = getPropType(propValue)\n                            if (propType !== expectedType) {\n                                var locationName = ReactPropTypeLocationNames[location]\n                                // `propValue` being instance of, say, date/regexp, pass the 'object'\n                                // check, but we can offer a more precise error message here rather than\n                                // 'of type `object`'.\n                                var preciseType = getPreciseType(propValue)\n\n                                return new Error(\n                                    \"Invalid \" +\n                                        locationName +\n                                        \" `\" +\n                                        propName +\n                                        \"` of type `\" +\n                                        preciseType +\n                                        \"` \" +\n                                        (\"supplied to `\" +\n                                            componentName +\n                                            \"`, expected `\" +\n                                            expectedType +\n                                            \"`.\")\n                                )\n                            }\n                            return null\n                        }\n                        return createChainableTypeChecker(validate)\n                    }\n\n                    function createAnyTypeChecker() {\n                        return createChainableTypeChecker(emptyFunction.thatReturns(null))\n                    }\n\n                    function createArrayOfTypeChecker(typeChecker) {\n                        function validate(props, propName, componentName, location) {\n                            var propValue = props[propName]\n                            if (!Array.isArray(propValue)) {\n                                var locationName = ReactPropTypeLocationNames[location]\n                                var propType = getPropType(propValue)\n                                return new Error(\n                                    \"Invalid \" +\n                                        locationName +\n                                        \" `\" +\n                                        propName +\n                                        \"` of type \" +\n                                        (\"`\" +\n                                            propType +\n                                            \"` supplied to `\" +\n                                            componentName +\n                                            \"`, expected an array.\")\n                                )\n                            }\n                            for (var i = 0; i < propValue.length; i++) {\n                                var error = typeChecker(propValue, i, componentName, location)\n                                if (error instanceof Error) {\n                                    return error\n                                }\n                            }\n                            return null\n                        }\n                        return createChainableTypeChecker(validate)\n                    }\n\n                    function createElementTypeChecker() {\n                        function validate(props, propName, componentName, location) {\n                            if (!ReactElement.isValidElement(props[propName])) {\n                                var locationName = ReactPropTypeLocationNames[location]\n                                return new Error(\n                                    \"Invalid \" +\n                                        locationName +\n                                        \" `\" +\n                                        propName +\n                                        \"` supplied to \" +\n                                        (\"`\" + componentName + \"`, expected a ReactElement.\")\n                                )\n                            }\n                            return null\n                        }\n                        return createChainableTypeChecker(validate)\n                    }\n\n                    function createInstanceTypeChecker(expectedClass) {\n                        function validate(props, propName, componentName, location) {\n                            if (!(props[propName] instanceof expectedClass)) {\n                                var locationName = ReactPropTypeLocationNames[location]\n                                var expectedClassName = expectedClass.name || ANONYMOUS\n                                return new Error(\n                                    \"Invalid \" +\n                                        locationName +\n                                        \" `\" +\n                                        propName +\n                                        \"` supplied to \" +\n                                        (\"`\" +\n                                            componentName +\n                                            \"`, expected instance of `\" +\n                                            expectedClassName +\n                                            \"`.\")\n                                )\n                            }\n                            return null\n                        }\n                        return createChainableTypeChecker(validate)\n                    }\n\n                    function createEnumTypeChecker(expectedValues) {\n                        function validate(props, propName, componentName, location) {\n                            var propValue = props[propName]\n                            for (var i = 0; i < expectedValues.length; i++) {\n                                if (propValue === expectedValues[i]) {\n                                    return null\n                                }\n                            }\n\n                            var locationName = ReactPropTypeLocationNames[location]\n                            var valuesString = JSON.stringify(expectedValues)\n                            return new Error(\n                                \"Invalid \" +\n                                    locationName +\n                                    \" `\" +\n                                    propName +\n                                    \"` of value `\" +\n                                    propValue +\n                                    \"` \" +\n                                    (\"supplied to `\" +\n                                        componentName +\n                                        \"`, expected one of \" +\n                                        valuesString +\n                                        \".\")\n                            )\n                        }\n                        return createChainableTypeChecker(validate)\n                    }\n\n                    function createObjectOfTypeChecker(typeChecker) {\n                        function validate(props, propName, componentName, location) {\n                            var propValue = props[propName]\n                            var propType = getPropType(propValue)\n                            if (propType !== \"object\") {\n                                var locationName = ReactPropTypeLocationNames[location]\n                                return new Error(\n                                    \"Invalid \" +\n                                        locationName +\n                                        \" `\" +\n                                        propName +\n                                        \"` of type \" +\n                                        (\"`\" +\n                                            propType +\n                                            \"` supplied to `\" +\n                                            componentName +\n                                            \"`, expected an object.\")\n                                )\n                            }\n                            for (var key in propValue) {\n                                if (propValue.hasOwnProperty(key)) {\n                                    var error = typeChecker(propValue, key, componentName, location)\n                                    if (error instanceof Error) {\n                                        return error\n                                    }\n                                }\n                            }\n                            return null\n                        }\n                        return createChainableTypeChecker(validate)\n                    }\n\n                    function createUnionTypeChecker(arrayOfTypeCheckers) {\n                        function validate(props, propName, componentName, location) {\n                            for (var i = 0; i < arrayOfTypeCheckers.length; i++) {\n                                var checker = arrayOfTypeCheckers[i]\n                                if (checker(props, propName, componentName, location) == null) {\n                                    return null\n                                }\n                            }\n\n                            var locationName = ReactPropTypeLocationNames[location]\n                            return new Error(\n                                \"Invalid \" +\n                                    locationName +\n                                    \" `\" +\n                                    propName +\n                                    \"` supplied to \" +\n                                    (\"`\" + componentName + \"`.\")\n                            )\n                        }\n                        return createChainableTypeChecker(validate)\n                    }\n\n                    function createNodeChecker() {\n                        function validate(props, propName, componentName, location) {\n                            if (!isNode(props[propName])) {\n                                var locationName = ReactPropTypeLocationNames[location]\n                                return new Error(\n                                    \"Invalid \" +\n                                        locationName +\n                                        \" `\" +\n                                        propName +\n                                        \"` supplied to \" +\n                                        (\"`\" + componentName + \"`, expected a ReactNode.\")\n                                )\n                            }\n                            return null\n                        }\n                        return createChainableTypeChecker(validate)\n                    }\n\n                    function createShapeTypeChecker(shapeTypes) {\n                        function validate(props, propName, componentName, location) {\n                            var propValue = props[propName]\n                            var propType = getPropType(propValue)\n                            if (propType !== \"object\") {\n                                var locationName = ReactPropTypeLocationNames[location]\n                                return new Error(\n                                    \"Invalid \" +\n                                        locationName +\n                                        \" `\" +\n                                        propName +\n                                        \"` of type `\" +\n                                        propType +\n                                        \"` \" +\n                                        (\"supplied to `\" + componentName + \"`, expected `object`.\")\n                                )\n                            }\n                            for (var key in shapeTypes) {\n                                var checker = shapeTypes[key]\n                                if (!checker) {\n                                    continue\n                                }\n                                var error = checker(propValue, key, componentName, location)\n                                if (error) {\n                                    return error\n                                }\n                            }\n                            return null\n                        }\n                        return createChainableTypeChecker(validate)\n                    }\n\n                    function isNode(propValue) {\n                        switch (typeof propValue) {\n                            case \"number\":\n                            case \"string\":\n                            case \"undefined\":\n                                return true\n                            case \"boolean\":\n                                return !propValue\n                            case \"object\":\n                                if (Array.isArray(propValue)) {\n                                    return propValue.every(isNode)\n                                }\n                                if (propValue === null || ReactElement.isValidElement(propValue)) {\n                                    return true\n                                }\n                                propValue = ReactFragment.extractIfFragment(propValue)\n                                for (var k in propValue) {\n                                    if (!isNode(propValue[k])) {\n                                        return false\n                                    }\n                                }\n                                return true\n                            default:\n                                return false\n                        }\n                    }\n\n                    // Equivalent of `typeof` but with special handling for array and regexp.\n                    function getPropType(propValue) {\n                        var propType = typeof propValue\n                        if (Array.isArray(propValue)) {\n                            return \"array\"\n                        }\n                        if (propValue instanceof RegExp) {\n                            // Old webkits (at least until Android 4.0) return 'function' rather than\n                            // 'object' for typeof a RegExp. We'll normalize this here so that /bla/\n                            // passes PropTypes.object.\n                            return \"object\"\n                        }\n                        return propType\n                    }\n\n                    // This handles more types than `getPropType`. Only used for error messages.\n                    // See `createPrimitiveTypeChecker`.\n                    function getPreciseType(propValue) {\n                        var propType = getPropType(propValue)\n                        if (propType === \"object\") {\n                            if (propValue instanceof Date) {\n                                return \"date\"\n                            } else if (propValue instanceof RegExp) {\n                                return \"regexp\"\n                            }\n                        }\n                        return propType\n                    }\n\n                    module.exports = ReactPropTypes\n                },\n                { \"129\": 129, \"63\": 63, \"69\": 69, \"84\": 84 }\n            ],\n            87: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule ReactPutListenerQueue\n                     */\n\n                    \"use strict\"\n\n                    var PooledClass = _dereq_(30)\n                    var ReactBrowserEventEmitter = _dereq_(33)\n\n                    var assign = _dereq_(29)\n\n                    function ReactPutListenerQueue() {\n                        this.listenersToPut = []\n                    }\n\n                    assign(ReactPutListenerQueue.prototype, {\n                        enqueuePutListener: function(rootNodeID, propKey, propValue) {\n                            this.listenersToPut.push({\n                                rootNodeID: rootNodeID,\n                                propKey: propKey,\n                                propValue: propValue\n                            })\n                        },\n\n                        putListeners: function() {\n                            for (var i = 0; i < this.listenersToPut.length; i++) {\n                                var listenerToPut = this.listenersToPut[i]\n                                ReactBrowserEventEmitter.putListener(\n                                    listenerToPut.rootNodeID,\n                                    listenerToPut.propKey,\n                                    listenerToPut.propValue\n                                )\n                            }\n                        },\n\n                        reset: function() {\n                            this.listenersToPut.length = 0\n                        },\n\n                        destructor: function() {\n                            this.reset()\n                        }\n                    })\n\n                    PooledClass.addPoolingTo(ReactPutListenerQueue)\n\n                    module.exports = ReactPutListenerQueue\n                },\n                { \"29\": 29, \"30\": 30, \"33\": 33 }\n            ],\n            88: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule ReactReconcileTransaction\n                     * @typechecks static-only\n                     */\n\n                    \"use strict\"\n\n                    var CallbackQueue = _dereq_(7)\n                    var PooledClass = _dereq_(30)\n                    var ReactBrowserEventEmitter = _dereq_(33)\n                    var ReactInputSelection = _dereq_(71)\n                    var ReactPutListenerQueue = _dereq_(87)\n                    var Transaction = _dereq_(116)\n\n                    var assign = _dereq_(29)\n\n                    /**\n                     * Ensures that, when possible, the selection range (currently selected text\n                     * input) is not disturbed by performing the transaction.\n                     */\n                    var SELECTION_RESTORATION = {\n                        /**\n                         * @return {Selection} Selection information.\n                         */\n                        initialize: ReactInputSelection.getSelectionInformation,\n                        /**\n                         * @param {Selection} sel Selection information returned from `initialize`.\n                         */\n                        close: ReactInputSelection.restoreSelection\n                    }\n\n                    /**\n                     * Suppresses events (blur/focus) that could be inadvertently dispatched due to\n                     * high level DOM manipulations (like temporarily removing a text input from the\n                     * DOM).\n                     */\n                    var EVENT_SUPPRESSION = {\n                        /**\n                         * @return {boolean} The enabled status of `ReactBrowserEventEmitter` before\n                         * the reconciliation.\n                         */\n                        initialize: function() {\n                            var currentlyEnabled = ReactBrowserEventEmitter.isEnabled()\n                            ReactBrowserEventEmitter.setEnabled(false)\n                            return currentlyEnabled\n                        },\n\n                        /**\n                         * @param {boolean} previouslyEnabled Enabled status of\n                         *   `ReactBrowserEventEmitter` before the reconciliation occurred. `close`\n                         *   restores the previous value.\n                         */\n                        close: function(previouslyEnabled) {\n                            ReactBrowserEventEmitter.setEnabled(previouslyEnabled)\n                        }\n                    }\n\n                    /**\n                     * Provides a queue for collecting `componentDidMount` and\n                     * `componentDidUpdate` callbacks during the the transaction.\n                     */\n                    var ON_DOM_READY_QUEUEING = {\n                        /**\n                         * Initializes the internal `onDOMReady` queue.\n                         */\n                        initialize: function() {\n                            this.reactMountReady.reset()\n                        },\n\n                        /**\n                         * After DOM is flushed, invoke all registered `onDOMReady` callbacks.\n                         */\n                        close: function() {\n                            this.reactMountReady.notifyAll()\n                        }\n                    }\n\n                    var PUT_LISTENER_QUEUEING = {\n                        initialize: function() {\n                            this.putListenerQueue.reset()\n                        },\n\n                        close: function() {\n                            this.putListenerQueue.putListeners()\n                        }\n                    }\n\n                    /**\n                     * Executed within the scope of the `Transaction` instance. Consider these as\n                     * being member methods, but with an implied ordering while being isolated from\n                     * each other.\n                     */\n                    var TRANSACTION_WRAPPERS = [\n                        PUT_LISTENER_QUEUEING,\n                        SELECTION_RESTORATION,\n                        EVENT_SUPPRESSION,\n                        ON_DOM_READY_QUEUEING\n                    ]\n\n                    /**\n                     * Currently:\n                     * - The order that these are listed in the transaction is critical:\n                     * - Suppresses events.\n                     * - Restores selection range.\n                     *\n                     * Future:\n                     * - Restore document/overflow scroll positions that were unintentionally\n                     *   modified via DOM insertions above the top viewport boundary.\n                     * - Implement/integrate with customized constraint based layout system and keep\n                     *   track of which dimensions must be remeasured.\n                     *\n                     * @class ReactReconcileTransaction\n                     */\n                    function ReactReconcileTransaction() {\n                        this.reinitializeTransaction()\n                        // Only server-side rendering really needs this option (see\n                        // `ReactServerRendering`), but server-side uses\n                        // `ReactServerRenderingTransaction` instead. This option is here so that it's\n                        // accessible and defaults to false when `ReactDOMComponent` and\n                        // `ReactTextComponent` checks it in `mountComponent`.`\n                        this.renderToStaticMarkup = false\n                        this.reactMountReady = CallbackQueue.getPooled(null)\n                        this.putListenerQueue = ReactPutListenerQueue.getPooled()\n                    }\n\n                    var Mixin = {\n                        /**\n                         * @see Transaction\n                         * @abstract\n                         * @final\n                         * @return {array<object>} List of operation wrap proceedures.\n                         *   TODO: convert to array<TransactionWrapper>\n                         */\n                        getTransactionWrappers: function() {\n                            return TRANSACTION_WRAPPERS\n                        },\n\n                        /**\n                         * @return {object} The queue to collect `onDOMReady` callbacks with.\n                         */\n                        getReactMountReady: function() {\n                            return this.reactMountReady\n                        },\n\n                        getPutListenerQueue: function() {\n                            return this.putListenerQueue\n                        },\n\n                        /**\n                         * `PooledClass` looks for this, and will invoke this before allowing this\n                         * instance to be resused.\n                         */\n                        destructor: function() {\n                            CallbackQueue.release(this.reactMountReady)\n                            this.reactMountReady = null\n\n                            ReactPutListenerQueue.release(this.putListenerQueue)\n                            this.putListenerQueue = null\n                        }\n                    }\n\n                    assign(ReactReconcileTransaction.prototype, Transaction.Mixin, Mixin)\n\n                    PooledClass.addPoolingTo(ReactReconcileTransaction)\n\n                    module.exports = ReactReconcileTransaction\n                },\n                { \"116\": 116, \"29\": 29, \"30\": 30, \"33\": 33, \"7\": 7, \"71\": 71, \"87\": 87 }\n            ],\n            89: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule ReactReconciler\n                     */\n\n                    \"use strict\"\n\n                    var ReactRef = _dereq_(90)\n                    var ReactElementValidator = _dereq_(64)\n\n                    /**\n                     * Helper to call ReactRef.attachRefs with this composite component, split out\n                     * to avoid allocations in the transaction mount-ready queue.\n                     */\n                    function attachRefs() {\n                        ReactRef.attachRefs(this, this._currentElement)\n                    }\n\n                    var ReactReconciler = {\n                        /**\n                         * Initializes the component, renders markup, and registers event listeners.\n                         *\n                         * @param {ReactComponent} internalInstance\n                         * @param {string} rootID DOM ID of the root node.\n                         * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction\n                         * @return {?string} Rendered markup to be inserted into the DOM.\n                         * @final\n                         * @internal\n                         */\n                        mountComponent: function(internalInstance, rootID, transaction, context) {\n                            var markup = internalInstance.mountComponent(\n                                rootID,\n                                transaction,\n                                context\n                            )\n                            if (\"production\" !== \"development\") {\n                                ReactElementValidator.checkAndWarnForMutatedProps(\n                                    internalInstance._currentElement\n                                )\n                            }\n                            transaction.getReactMountReady().enqueue(attachRefs, internalInstance)\n                            return markup\n                        },\n\n                        /**\n                         * Releases any resources allocated by `mountComponent`.\n                         *\n                         * @final\n                         * @internal\n                         */\n                        unmountComponent: function(internalInstance) {\n                            ReactRef.detachRefs(internalInstance, internalInstance._currentElement)\n                            internalInstance.unmountComponent()\n                        },\n\n                        /**\n                         * Update a component using a new element.\n                         *\n                         * @param {ReactComponent} internalInstance\n                         * @param {ReactElement} nextElement\n                         * @param {ReactReconcileTransaction} transaction\n                         * @param {object} context\n                         * @internal\n                         */\n                        receiveComponent: function(\n                            internalInstance,\n                            nextElement,\n                            transaction,\n                            context\n                        ) {\n                            var prevElement = internalInstance._currentElement\n\n                            if (nextElement === prevElement && nextElement._owner != null) {\n                                // Since elements are immutable after the owner is rendered,\n                                // we can do a cheap identity compare here to determine if this is a\n                                // superfluous reconcile. It's possible for state to be mutable but such\n                                // change should trigger an update of the owner which would recreate\n                                // the element. We explicitly check for the existence of an owner since\n                                // it's possible for an element created outside a composite to be\n                                // deeply mutated and reused.\n                                return\n                            }\n\n                            if (\"production\" !== \"development\") {\n                                ReactElementValidator.checkAndWarnForMutatedProps(nextElement)\n                            }\n\n                            var refsChanged = ReactRef.shouldUpdateRefs(prevElement, nextElement)\n\n                            if (refsChanged) {\n                                ReactRef.detachRefs(internalInstance, prevElement)\n                            }\n\n                            internalInstance.receiveComponent(nextElement, transaction, context)\n\n                            if (refsChanged) {\n                                transaction\n                                    .getReactMountReady()\n                                    .enqueue(attachRefs, internalInstance)\n                            }\n                        },\n\n                        /**\n                         * Flush any dirty changes in a component.\n                         *\n                         * @param {ReactComponent} internalInstance\n                         * @param {ReactReconcileTransaction} transaction\n                         * @internal\n                         */\n                        performUpdateIfNecessary: function(internalInstance, transaction) {\n                            internalInstance.performUpdateIfNecessary(transaction)\n                        }\n                    }\n\n                    module.exports = ReactReconciler\n                },\n                { \"64\": 64, \"90\": 90 }\n            ],\n            90: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule ReactRef\n                     */\n\n                    \"use strict\"\n\n                    var ReactOwner = _dereq_(81)\n\n                    var ReactRef = {}\n\n                    function attachRef(ref, component, owner) {\n                        if (typeof ref === \"function\") {\n                            ref(component.getPublicInstance())\n                        } else {\n                            // Legacy ref\n                            ReactOwner.addComponentAsRefTo(component, ref, owner)\n                        }\n                    }\n\n                    function detachRef(ref, component, owner) {\n                        if (typeof ref === \"function\") {\n                            ref(null)\n                        } else {\n                            // Legacy ref\n                            ReactOwner.removeComponentAsRefFrom(component, ref, owner)\n                        }\n                    }\n\n                    ReactRef.attachRefs = function(instance, element) {\n                        var ref = element.ref\n                        if (ref != null) {\n                            attachRef(ref, instance, element._owner)\n                        }\n                    }\n\n                    ReactRef.shouldUpdateRefs = function(prevElement, nextElement) {\n                        // If either the owner or a `ref` has changed, make sure the newest owner\n                        // has stored a reference to `this`, and the previous owner (if different)\n                        // has forgotten the reference to `this`. We use the element instead\n                        // of the public this.props because the post processing cannot determine\n                        // a ref. The ref conceptually lives on the element.\n\n                        // TODO: Should this even be possible? The owner cannot change because\n                        // it's forbidden by shouldUpdateReactComponent. The ref can change\n                        // if you swap the keys of but not the refs. Reconsider where this check\n                        // is made. It probably belongs where the key checking and\n                        // instantiateReactComponent is done.\n\n                        return (\n                            nextElement._owner !== prevElement._owner ||\n                            nextElement.ref !== prevElement.ref\n                        )\n                    }\n\n                    ReactRef.detachRefs = function(instance, element) {\n                        var ref = element.ref\n                        if (ref != null) {\n                            detachRef(ref, instance, element._owner)\n                        }\n                    }\n\n                    module.exports = ReactRef\n                },\n                { \"81\": 81 }\n            ],\n            91: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule ReactRootIndex\n                     * @typechecks\n                     */\n\n                    \"use strict\"\n\n                    var ReactRootIndexInjection = {\n                        /**\n                         * @param {function} _createReactRootIndex\n                         */\n                        injectCreateReactRootIndex: function(_createReactRootIndex) {\n                            ReactRootIndex.createReactRootIndex = _createReactRootIndex\n                        }\n                    }\n\n                    var ReactRootIndex = {\n                        createReactRootIndex: null,\n                        injection: ReactRootIndexInjection\n                    }\n\n                    module.exports = ReactRootIndex\n                },\n                {}\n            ],\n            92: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @typechecks static-only\n                     * @providesModule ReactServerRendering\n                     */\n                    \"use strict\"\n\n                    var ReactElement = _dereq_(63)\n                    var ReactInstanceHandles = _dereq_(72)\n                    var ReactMarkupChecksum = _dereq_(76)\n                    var ReactServerRenderingTransaction = _dereq_(93)\n\n                    var emptyObject = _dereq_(130)\n                    var instantiateReactComponent = _dereq_(149)\n                    var invariant = _dereq_(150)\n\n                    /**\n                     * @param {ReactElement} element\n                     * @return {string} the HTML markup\n                     */\n                    function renderToString(element) {\n                        \"production\" !== \"development\"\n                            ? invariant(\n                                  ReactElement.isValidElement(element),\n                                  \"renderToString(): You must pass a valid ReactElement.\"\n                              )\n                            : invariant(ReactElement.isValidElement(element))\n\n                        var transaction\n                        try {\n                            var id = ReactInstanceHandles.createReactRootID()\n                            transaction = ReactServerRenderingTransaction.getPooled(false)\n\n                            return transaction.perform(function() {\n                                var componentInstance = instantiateReactComponent(element, null)\n                                var markup = componentInstance.mountComponent(\n                                    id,\n                                    transaction,\n                                    emptyObject\n                                )\n                                return ReactMarkupChecksum.addChecksumToMarkup(markup)\n                            }, null)\n                        } finally {\n                            ReactServerRenderingTransaction.release(transaction)\n                        }\n                    }\n\n                    /**\n                     * @param {ReactElement} element\n                     * @return {string} the HTML markup, without the extra React ID and checksum\n                     * (for generating static pages)\n                     */\n                    function renderToStaticMarkup(element) {\n                        \"production\" !== \"development\"\n                            ? invariant(\n                                  ReactElement.isValidElement(element),\n                                  \"renderToStaticMarkup(): You must pass a valid ReactElement.\"\n                              )\n                            : invariant(ReactElement.isValidElement(element))\n\n                        var transaction\n                        try {\n                            var id = ReactInstanceHandles.createReactRootID()\n                            transaction = ReactServerRenderingTransaction.getPooled(true)\n\n                            return transaction.perform(function() {\n                                var componentInstance = instantiateReactComponent(element, null)\n                                return componentInstance.mountComponent(\n                                    id,\n                                    transaction,\n                                    emptyObject\n                                )\n                            }, null)\n                        } finally {\n                            ReactServerRenderingTransaction.release(transaction)\n                        }\n                    }\n\n                    module.exports = {\n                        renderToString: renderToString,\n                        renderToStaticMarkup: renderToStaticMarkup\n                    }\n                },\n                { \"130\": 130, \"149\": 149, \"150\": 150, \"63\": 63, \"72\": 72, \"76\": 76, \"93\": 93 }\n            ],\n            93: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2014-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule ReactServerRenderingTransaction\n                     * @typechecks\n                     */\n\n                    \"use strict\"\n\n                    var PooledClass = _dereq_(30)\n                    var CallbackQueue = _dereq_(7)\n                    var ReactPutListenerQueue = _dereq_(87)\n                    var Transaction = _dereq_(116)\n\n                    var assign = _dereq_(29)\n                    var emptyFunction = _dereq_(129)\n\n                    /**\n                     * Provides a `CallbackQueue` queue for collecting `onDOMReady` callbacks\n                     * during the performing of the transaction.\n                     */\n                    var ON_DOM_READY_QUEUEING = {\n                        /**\n                         * Initializes the internal `onDOMReady` queue.\n                         */\n                        initialize: function() {\n                            this.reactMountReady.reset()\n                        },\n\n                        close: emptyFunction\n                    }\n\n                    var PUT_LISTENER_QUEUEING = {\n                        initialize: function() {\n                            this.putListenerQueue.reset()\n                        },\n\n                        close: emptyFunction\n                    }\n\n                    /**\n                     * Executed within the scope of the `Transaction` instance. Consider these as\n                     * being member methods, but with an implied ordering while being isolated from\n                     * each other.\n                     */\n                    var TRANSACTION_WRAPPERS = [PUT_LISTENER_QUEUEING, ON_DOM_READY_QUEUEING]\n\n                    /**\n                     * @class ReactServerRenderingTransaction\n                     * @param {boolean} renderToStaticMarkup\n                     */\n                    function ReactServerRenderingTransaction(renderToStaticMarkup) {\n                        this.reinitializeTransaction()\n                        this.renderToStaticMarkup = renderToStaticMarkup\n                        this.reactMountReady = CallbackQueue.getPooled(null)\n                        this.putListenerQueue = ReactPutListenerQueue.getPooled()\n                    }\n\n                    var Mixin = {\n                        /**\n                         * @see Transaction\n                         * @abstract\n                         * @final\n                         * @return {array} Empty list of operation wrap proceedures.\n                         */\n                        getTransactionWrappers: function() {\n                            return TRANSACTION_WRAPPERS\n                        },\n\n                        /**\n                         * @return {object} The queue to collect `onDOMReady` callbacks with.\n                         */\n                        getReactMountReady: function() {\n                            return this.reactMountReady\n                        },\n\n                        getPutListenerQueue: function() {\n                            return this.putListenerQueue\n                        },\n\n                        /**\n                         * `PooledClass` looks for this, and will invoke this before allowing this\n                         * instance to be resused.\n                         */\n                        destructor: function() {\n                            CallbackQueue.release(this.reactMountReady)\n                            this.reactMountReady = null\n\n                            ReactPutListenerQueue.release(this.putListenerQueue)\n                            this.putListenerQueue = null\n                        }\n                    }\n\n                    assign(ReactServerRenderingTransaction.prototype, Transaction.Mixin, Mixin)\n\n                    PooledClass.addPoolingTo(ReactServerRenderingTransaction)\n\n                    module.exports = ReactServerRenderingTransaction\n                },\n                { \"116\": 116, \"129\": 129, \"29\": 29, \"30\": 30, \"7\": 7, \"87\": 87 }\n            ],\n            94: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule ReactStateSetters\n                     */\n\n                    \"use strict\"\n\n                    var ReactStateSetters = {\n                        /**\n                         * Returns a function that calls the provided function, and uses the result\n                         * of that to set the component's state.\n                         *\n                         * @param {ReactCompositeComponent} component\n                         * @param {function} funcReturningState Returned callback uses this to\n                         *                                      determine how to update state.\n                         * @return {function} callback that when invoked uses funcReturningState to\n                         *                    determined the object literal to setState.\n                         */\n                        createStateSetter: function(component, funcReturningState) {\n                            return function(a, b, c, d, e, f) {\n                                var partialState = funcReturningState.call(\n                                    component,\n                                    a,\n                                    b,\n                                    c,\n                                    d,\n                                    e,\n                                    f\n                                )\n                                if (partialState) {\n                                    component.setState(partialState)\n                                }\n                            }\n                        },\n\n                        /**\n                         * Returns a single-argument callback that can be used to update a single\n                         * key in the component's state.\n                         *\n                         * Note: this is memoized function, which makes it inexpensive to call.\n                         *\n                         * @param {ReactCompositeComponent} component\n                         * @param {string} key The key in the state that you should update.\n                         * @return {function} callback of 1 argument which calls setState() with\n                         *                    the provided keyName and callback argument.\n                         */\n                        createStateKeySetter: function(component, key) {\n                            // Memoize the setters.\n                            var cache = component.__keySetters || (component.__keySetters = {})\n                            return cache[key] || (cache[key] = createStateKeySetter(component, key))\n                        }\n                    }\n\n                    function createStateKeySetter(component, key) {\n                        // Partial state is allocated outside of the function closure so it can be\n                        // reused with every call, avoiding memory allocation when this function\n                        // is called.\n                        var partialState = {}\n                        return function stateKeySetter(value) {\n                            partialState[key] = value\n                            component.setState(partialState)\n                        }\n                    }\n\n                    ReactStateSetters.Mixin = {\n                        /**\n                         * Returns a function that calls the provided function, and uses the result\n                         * of that to set the component's state.\n                         *\n                         * For example, these statements are equivalent:\n                         *\n                         *   this.setState({x: 1});\n                         *   this.createStateSetter(function(xValue) {\n                         *     return {x: xValue};\n                         *   })(1);\n                         *\n                         * @param {function} funcReturningState Returned callback uses this to\n                         *                                      determine how to update state.\n                         * @return {function} callback that when invoked uses funcReturningState to\n                         *                    determined the object literal to setState.\n                         */\n                        createStateSetter: function(funcReturningState) {\n                            return ReactStateSetters.createStateSetter(this, funcReturningState)\n                        },\n\n                        /**\n                         * Returns a single-argument callback that can be used to update a single\n                         * key in the component's state.\n                         *\n                         * For example, these statements are equivalent:\n                         *\n                         *   this.setState({x: 1});\n                         *   this.createStateKeySetter('x')(1);\n                         *\n                         * Note: this is memoized function, which makes it inexpensive to call.\n                         *\n                         * @param {string} key The key in the state that you should update.\n                         * @return {function} callback of 1 argument which calls setState() with\n                         *                    the provided keyName and callback argument.\n                         */\n                        createStateKeySetter: function(key) {\n                            return ReactStateSetters.createStateKeySetter(this, key)\n                        }\n                    }\n\n                    module.exports = ReactStateSetters\n                },\n                {}\n            ],\n            95: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule ReactTestUtils\n                     */\n\n                    \"use strict\"\n\n                    var EventConstants = _dereq_(16)\n                    var EventPluginHub = _dereq_(18)\n                    var EventPropagators = _dereq_(21)\n                    var React = _dereq_(31)\n                    var ReactElement = _dereq_(63)\n                    var ReactEmptyComponent = _dereq_(65)\n                    var ReactBrowserEventEmitter = _dereq_(33)\n                    var ReactCompositeComponent = _dereq_(43)\n                    var ReactInstanceHandles = _dereq_(72)\n                    var ReactInstanceMap = _dereq_(73)\n                    var ReactMount = _dereq_(77)\n                    var ReactUpdates = _dereq_(100)\n                    var SyntheticEvent = _dereq_(108)\n\n                    var assign = _dereq_(29)\n                    var emptyObject = _dereq_(130)\n\n                    var topLevelTypes = EventConstants.topLevelTypes\n\n                    function Event(suffix) {}\n\n                    /**\n                     * @class ReactTestUtils\n                     */\n\n                    /**\n                     * Todo: Support the entire DOM.scry query syntax. For now, these simple\n                     * utilities will suffice for testing purposes.\n                     * @lends ReactTestUtils\n                     */\n                    var ReactTestUtils = {\n                        renderIntoDocument: function(instance) {\n                            var div = document.createElement(\"div\")\n                            // None of our tests actually require attaching the container to the\n                            // DOM, and doing so creates a mess that we rely on test isolation to\n                            // clean up, so we're going to stop honoring the name of this method\n                            // (and probably rename it eventually) if no problems arise.\n                            // document.documentElement.appendChild(div);\n                            return React.render(instance, div)\n                        },\n\n                        isElement: function(element) {\n                            return ReactElement.isValidElement(element)\n                        },\n\n                        isElementOfType: function(inst, convenienceConstructor) {\n                            return (\n                                ReactElement.isValidElement(inst) &&\n                                inst.type === convenienceConstructor\n                            )\n                        },\n\n                        isDOMComponent: function(inst) {\n                            // TODO: Fix this heuristic. It's just here because composites can currently\n                            // pretend to be DOM components.\n                            return !!(inst && inst.tagName && inst.getDOMNode)\n                        },\n\n                        isDOMComponentElement: function(inst) {\n                            return !!(inst && ReactElement.isValidElement(inst) && !!inst.tagName)\n                        },\n\n                        isCompositeComponent: function(inst) {\n                            return (\n                                typeof inst.render === \"function\" &&\n                                typeof inst.setState === \"function\"\n                            )\n                        },\n\n                        isCompositeComponentWithType: function(inst, type) {\n                            return !!(\n                                ReactTestUtils.isCompositeComponent(inst) &&\n                                inst.constructor === type\n                            )\n                        },\n\n                        isCompositeComponentElement: function(inst) {\n                            if (!ReactElement.isValidElement(inst)) {\n                                return false\n                            }\n                            // We check the prototype of the type that will get mounted, not the\n                            // instance itself. This is a future proof way of duck typing.\n                            var prototype = inst.type.prototype\n                            return (\n                                typeof prototype.render === \"function\" &&\n                                typeof prototype.setState === \"function\"\n                            )\n                        },\n\n                        isCompositeComponentElementWithType: function(inst, type) {\n                            return !!(\n                                ReactTestUtils.isCompositeComponentElement(inst) &&\n                                inst.constructor === type\n                            )\n                        },\n\n                        getRenderedChildOfCompositeComponent: function(inst) {\n                            if (!ReactTestUtils.isCompositeComponent(inst)) {\n                                return null\n                            }\n                            var internalInstance = ReactInstanceMap.get(inst)\n                            return internalInstance._renderedComponent.getPublicInstance()\n                        },\n\n                        findAllInRenderedTree: function(inst, test) {\n                            if (!inst) {\n                                return []\n                            }\n                            var ret = test(inst) ? [inst] : []\n                            if (ReactTestUtils.isDOMComponent(inst)) {\n                                var internalInstance = ReactInstanceMap.get(inst)\n                                var renderedChildren =\n                                    internalInstance._renderedComponent._renderedChildren\n                                var key\n                                for (key in renderedChildren) {\n                                    if (!renderedChildren.hasOwnProperty(key)) {\n                                        continue\n                                    }\n                                    if (!renderedChildren[key].getPublicInstance) {\n                                        continue\n                                    }\n                                    ret = ret.concat(\n                                        ReactTestUtils.findAllInRenderedTree(\n                                            renderedChildren[key].getPublicInstance(),\n                                            test\n                                        )\n                                    )\n                                }\n                            } else if (ReactTestUtils.isCompositeComponent(inst)) {\n                                ret = ret.concat(\n                                    ReactTestUtils.findAllInRenderedTree(\n                                        ReactTestUtils.getRenderedChildOfCompositeComponent(inst),\n                                        test\n                                    )\n                                )\n                            }\n                            return ret\n                        },\n\n                        /**\n                         * Finds all instance of components in the rendered tree that are DOM\n                         * components with the class name matching `className`.\n                         * @return an array of all the matches.\n                         */\n                        scryRenderedDOMComponentsWithClass: function(root, className) {\n                            return ReactTestUtils.findAllInRenderedTree(root, function(inst) {\n                                var instClassName = inst.props.className\n                                return (\n                                    ReactTestUtils.isDOMComponent(inst) &&\n                                    (instClassName &&\n                                        (\" \" + instClassName + \" \").indexOf(\n                                            \" \" + className + \" \"\n                                        ) !== -1)\n                                )\n                            })\n                        },\n\n                        /**\n                         * Like scryRenderedDOMComponentsWithClass but expects there to be one result,\n                         * and returns that one result, or throws exception if there is any other\n                         * number of matches besides one.\n                         * @return {!ReactDOMComponent} The one match.\n                         */\n                        findRenderedDOMComponentWithClass: function(root, className) {\n                            var all = ReactTestUtils.scryRenderedDOMComponentsWithClass(\n                                root,\n                                className\n                            )\n                            if (all.length !== 1) {\n                                throw new Error(\n                                    \"Did not find exactly one match \" +\n                                        \"(found: \" +\n                                        all.length +\n                                        \") for class:\" +\n                                        className\n                                )\n                            }\n                            return all[0]\n                        },\n\n                        /**\n                         * Finds all instance of components in the rendered tree that are DOM\n                         * components with the tag name matching `tagName`.\n                         * @return an array of all the matches.\n                         */\n                        scryRenderedDOMComponentsWithTag: function(root, tagName) {\n                            return ReactTestUtils.findAllInRenderedTree(root, function(inst) {\n                                return (\n                                    ReactTestUtils.isDOMComponent(inst) &&\n                                    inst.tagName === tagName.toUpperCase()\n                                )\n                            })\n                        },\n\n                        /**\n                         * Like scryRenderedDOMComponentsWithTag but expects there to be one result,\n                         * and returns that one result, or throws exception if there is any other\n                         * number of matches besides one.\n                         * @return {!ReactDOMComponent} The one match.\n                         */\n                        findRenderedDOMComponentWithTag: function(root, tagName) {\n                            var all = ReactTestUtils.scryRenderedDOMComponentsWithTag(root, tagName)\n                            if (all.length !== 1) {\n                                throw new Error(\"Did not find exactly one match for tag:\" + tagName)\n                            }\n                            return all[0]\n                        },\n\n                        /**\n                         * Finds all instances of components with type equal to `componentType`.\n                         * @return an array of all the matches.\n                         */\n                        scryRenderedComponentsWithType: function(root, componentType) {\n                            return ReactTestUtils.findAllInRenderedTree(root, function(inst) {\n                                return ReactTestUtils.isCompositeComponentWithType(\n                                    inst,\n                                    componentType\n                                )\n                            })\n                        },\n\n                        /**\n                         * Same as `scryRenderedComponentsWithType` but expects there to be one result\n                         * and returns that one result, or throws exception if there is any other\n                         * number of matches besides one.\n                         * @return {!ReactComponent} The one match.\n                         */\n                        findRenderedComponentWithType: function(root, componentType) {\n                            var all = ReactTestUtils.scryRenderedComponentsWithType(\n                                root,\n                                componentType\n                            )\n                            if (all.length !== 1) {\n                                throw new Error(\n                                    \"Did not find exactly one match for componentType:\" +\n                                        componentType\n                                )\n                            }\n                            return all[0]\n                        },\n\n                        /**\n                         * Pass a mocked component module to this method to augment it with\n                         * useful methods that allow it to be used as a dummy React component.\n                         * Instead of rendering as usual, the component will become a simple\n                         * <div> containing any provided children.\n                         *\n                         * @param {object} module the mock function object exported from a\n                         *                        module that defines the component to be mocked\n                         * @param {?string} mockTagName optional dummy root tag name to return\n                         *                              from render method (overrides\n                         *                              module.mockTagName if provided)\n                         * @return {object} the ReactTestUtils object (for chaining)\n                         */\n                        mockComponent: function(module, mockTagName) {\n                            mockTagName = mockTagName || module.mockTagName || \"div\"\n\n                            module.prototype.render.mockImplementation(function() {\n                                return React.createElement(mockTagName, null, this.props.children)\n                            })\n\n                            return this\n                        },\n\n                        /**\n                         * Simulates a top level event being dispatched from a raw event that occurred\n                         * on an `Element` node.\n                         * @param topLevelType {Object} A type from `EventConstants.topLevelTypes`\n                         * @param {!Element} node The dom to simulate an event occurring on.\n                         * @param {?Event} fakeNativeEvent Fake native event to use in SyntheticEvent.\n                         */\n                        simulateNativeEventOnNode: function(topLevelType, node, fakeNativeEvent) {\n                            fakeNativeEvent.target = node\n                            ReactBrowserEventEmitter.ReactEventListener.dispatchEvent(\n                                topLevelType,\n                                fakeNativeEvent\n                            )\n                        },\n\n                        /**\n                         * Simulates a top level event being dispatched from a raw event that occurred\n                         * on the `ReactDOMComponent` `comp`.\n                         * @param topLevelType {Object} A type from `EventConstants.topLevelTypes`.\n                         * @param comp {!ReactDOMComponent}\n                         * @param {?Event} fakeNativeEvent Fake native event to use in SyntheticEvent.\n                         */\n                        simulateNativeEventOnDOMComponent: function(\n                            topLevelType,\n                            comp,\n                            fakeNativeEvent\n                        ) {\n                            ReactTestUtils.simulateNativeEventOnNode(\n                                topLevelType,\n                                comp.getDOMNode(),\n                                fakeNativeEvent\n                            )\n                        },\n\n                        nativeTouchData: function(x, y) {\n                            return {\n                                touches: [{ pageX: x, pageY: y }]\n                            }\n                        },\n\n                        createRenderer: function() {\n                            return new ReactShallowRenderer()\n                        },\n\n                        Simulate: null,\n                        SimulateNative: {}\n                    }\n\n                    /**\n                     * @class ReactShallowRenderer\n                     */\n                    var ReactShallowRenderer = function() {\n                        this._instance = null\n                    }\n\n                    ReactShallowRenderer.prototype.getRenderOutput = function() {\n                        return (\n                            (this._instance &&\n                                this._instance._renderedComponent &&\n                                this._instance._renderedComponent._renderedOutput) ||\n                            null\n                        )\n                    }\n\n                    var NoopInternalComponent = function(element) {\n                        this._renderedOutput = element\n                        this._currentElement =\n                            element === null || element === false\n                                ? ReactEmptyComponent.emptyElement\n                                : element\n                    }\n\n                    NoopInternalComponent.prototype = {\n                        mountComponent: function() {},\n\n                        receiveComponent: function(element) {\n                            this._renderedOutput = element\n                            this._currentElement =\n                                element === null || element === false\n                                    ? ReactEmptyComponent.emptyElement\n                                    : element\n                        },\n\n                        unmountComponent: function() {}\n                    }\n\n                    var ShallowComponentWrapper = function() {}\n                    assign(ShallowComponentWrapper.prototype, ReactCompositeComponent.Mixin, {\n                        _instantiateReactComponent: function(element) {\n                            return new NoopInternalComponent(element)\n                        },\n                        _replaceNodeWithMarkupByID: function() {},\n                        _renderValidatedComponent:\n                            ReactCompositeComponent.Mixin\n                                ._renderValidatedComponentWithoutOwnerOrContext\n                    })\n\n                    ReactShallowRenderer.prototype.render = function(element, context) {\n                        if (!context) {\n                            context = emptyObject\n                        }\n                        var transaction = ReactUpdates.ReactReconcileTransaction.getPooled()\n                        this._render(element, transaction, context)\n                        ReactUpdates.ReactReconcileTransaction.release(transaction)\n                    }\n\n                    ReactShallowRenderer.prototype.unmount = function() {\n                        if (this._instance) {\n                            this._instance.unmountComponent()\n                        }\n                    }\n\n                    ReactShallowRenderer.prototype._render = function(\n                        element,\n                        transaction,\n                        context\n                    ) {\n                        if (!this._instance) {\n                            var rootID = ReactInstanceHandles.createReactRootID()\n                            var instance = new ShallowComponentWrapper(element.type)\n                            instance.construct(element)\n\n                            instance.mountComponent(rootID, transaction, context)\n\n                            this._instance = instance\n                        } else {\n                            this._instance.receiveComponent(element, transaction, context)\n                        }\n                    }\n\n                    /**\n                     * Exports:\n                     *\n                     * - `ReactTestUtils.Simulate.click(Element/ReactDOMComponent)`\n                     * - `ReactTestUtils.Simulate.mouseMove(Element/ReactDOMComponent)`\n                     * - `ReactTestUtils.Simulate.change(Element/ReactDOMComponent)`\n                     * - ... (All keys from event plugin `eventTypes` objects)\n                     */\n                    function makeSimulator(eventType) {\n                        return function(domComponentOrNode, eventData) {\n                            var node\n                            if (ReactTestUtils.isDOMComponent(domComponentOrNode)) {\n                                node = domComponentOrNode.getDOMNode()\n                            } else if (domComponentOrNode.tagName) {\n                                node = domComponentOrNode\n                            }\n\n                            var fakeNativeEvent = new Event()\n                            fakeNativeEvent.target = node\n                            // We don't use SyntheticEvent.getPooled in order to not have to worry about\n                            // properly destroying any properties assigned from `eventData` upon release\n                            var event = new SyntheticEvent(\n                                ReactBrowserEventEmitter.eventNameDispatchConfigs[eventType],\n                                ReactMount.getID(node),\n                                fakeNativeEvent\n                            )\n                            assign(event, eventData)\n                            EventPropagators.accumulateTwoPhaseDispatches(event)\n\n                            ReactUpdates.batchedUpdates(function() {\n                                EventPluginHub.enqueueEvents(event)\n                                EventPluginHub.processEventQueue()\n                            })\n                        }\n                    }\n\n                    function buildSimulators() {\n                        ReactTestUtils.Simulate = {}\n\n                        var eventType\n                        for (eventType in ReactBrowserEventEmitter.eventNameDispatchConfigs) {\n                            /**\n                             * @param {!Element || ReactDOMComponent} domComponentOrNode\n                             * @param {?object} eventData Fake event data to use in SyntheticEvent.\n                             */\n                            ReactTestUtils.Simulate[eventType] = makeSimulator(eventType)\n                        }\n                    }\n\n                    // Rebuild ReactTestUtils.Simulate whenever event plugins are injected\n                    var oldInjectEventPluginOrder = EventPluginHub.injection.injectEventPluginOrder\n                    EventPluginHub.injection.injectEventPluginOrder = function() {\n                        oldInjectEventPluginOrder.apply(this, arguments)\n                        buildSimulators()\n                    }\n                    var oldInjectEventPlugins = EventPluginHub.injection.injectEventPluginsByName\n                    EventPluginHub.injection.injectEventPluginsByName = function() {\n                        oldInjectEventPlugins.apply(this, arguments)\n                        buildSimulators()\n                    }\n\n                    buildSimulators()\n\n                    /**\n                     * Exports:\n                     *\n                     * - `ReactTestUtils.SimulateNative.click(Element/ReactDOMComponent)`\n                     * - `ReactTestUtils.SimulateNative.mouseMove(Element/ReactDOMComponent)`\n                     * - `ReactTestUtils.SimulateNative.mouseIn/ReactDOMComponent)`\n                     * - `ReactTestUtils.SimulateNative.mouseOut(Element/ReactDOMComponent)`\n                     * - ... (All keys from `EventConstants.topLevelTypes`)\n                     *\n                     * Note: Top level event types are a subset of the entire set of handler types\n                     * (which include a broader set of \"synthetic\" events). For example, onDragDone\n                     * is a synthetic event. Except when testing an event plugin or React's event\n                     * handling code specifically, you probably want to use ReactTestUtils.Simulate\n                     * to dispatch synthetic events.\n                     */\n\n                    function makeNativeSimulator(eventType) {\n                        return function(domComponentOrNode, nativeEventData) {\n                            var fakeNativeEvent = new Event(eventType)\n                            assign(fakeNativeEvent, nativeEventData)\n                            if (ReactTestUtils.isDOMComponent(domComponentOrNode)) {\n                                ReactTestUtils.simulateNativeEventOnDOMComponent(\n                                    eventType,\n                                    domComponentOrNode,\n                                    fakeNativeEvent\n                                )\n                            } else if (!!domComponentOrNode.tagName) {\n                                // Will allow on actual dom nodes.\n                                ReactTestUtils.simulateNativeEventOnNode(\n                                    eventType,\n                                    domComponentOrNode,\n                                    fakeNativeEvent\n                                )\n                            }\n                        }\n                    }\n\n                    var eventType\n                    for (eventType in topLevelTypes) {\n                        // Event type is stored as 'topClick' - we transform that to 'click'\n                        var convenienceName =\n                            eventType.indexOf(\"top\") === 0\n                                ? eventType.charAt(3).toLowerCase() + eventType.substr(4)\n                                : eventType\n                        /**\n                         * @param {!Element || ReactDOMComponent} domComponentOrNode\n                         * @param {?Event} nativeEventData Fake native event to use in SyntheticEvent.\n                         */\n                        ReactTestUtils.SimulateNative[convenienceName] = makeNativeSimulator(\n                            eventType\n                        )\n                    }\n\n                    module.exports = ReactTestUtils\n                },\n                {\n                    \"100\": 100,\n                    \"108\": 108,\n                    \"130\": 130,\n                    \"16\": 16,\n                    \"18\": 18,\n                    \"21\": 21,\n                    \"29\": 29,\n                    \"31\": 31,\n                    \"33\": 33,\n                    \"43\": 43,\n                    \"63\": 63,\n                    \"65\": 65,\n                    \"72\": 72,\n                    \"73\": 73,\n                    \"77\": 77\n                }\n            ],\n            96: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @typechecks static-only\n                     * @providesModule ReactTransitionChildMapping\n                     */\n\n                    \"use strict\"\n\n                    var ReactChildren = _dereq_(37)\n                    var ReactFragment = _dereq_(69)\n\n                    var ReactTransitionChildMapping = {\n                        /**\n                         * Given `this.props.children`, return an object mapping key to child. Just\n                         * simple syntactic sugar around ReactChildren.map().\n                         *\n                         * @param {*} children `this.props.children`\n                         * @return {object} Mapping of key to child\n                         */\n                        getChildMapping: function(children) {\n                            if (!children) {\n                                return children\n                            }\n                            return ReactFragment.extract(\n                                ReactChildren.map(children, function(child) {\n                                    return child\n                                })\n                            )\n                        },\n\n                        /**\n                         * When you're adding or removing children some may be added or removed in the\n                         * same render pass. We want to show *both* since we want to simultaneously\n                         * animate elements in and out. This function takes a previous set of keys\n                         * and a new set of keys and merges them with its best guess of the correct\n                         * ordering. In the future we may expose some of the utilities in\n                         * ReactMultiChild to make this easy, but for now React itself does not\n                         * directly have this concept of the union of prevChildren and nextChildren\n                         * so we implement it here.\n                         *\n                         * @param {object} prev prev children as returned from\n                         * `ReactTransitionChildMapping.getChildMapping()`.\n                         * @param {object} next next children as returned from\n                         * `ReactTransitionChildMapping.getChildMapping()`.\n                         * @return {object} a key set that contains all keys in `prev` and all keys\n                         * in `next` in a reasonable order.\n                         */\n                        mergeChildMappings: function(prev, next) {\n                            prev = prev || {}\n                            next = next || {}\n\n                            function getValueForKey(key) {\n                                if (next.hasOwnProperty(key)) {\n                                    return next[key]\n                                } else {\n                                    return prev[key]\n                                }\n                            }\n\n                            // For each key of `next`, the list of keys to insert before that key in\n                            // the combined list\n                            var nextKeysPending = {}\n\n                            var pendingKeys = []\n                            for (var prevKey in prev) {\n                                if (next.hasOwnProperty(prevKey)) {\n                                    if (pendingKeys.length) {\n                                        nextKeysPending[prevKey] = pendingKeys\n                                        pendingKeys = []\n                                    }\n                                } else {\n                                    pendingKeys.push(prevKey)\n                                }\n                            }\n\n                            var i\n                            var childMapping = {}\n                            for (var nextKey in next) {\n                                if (nextKeysPending.hasOwnProperty(nextKey)) {\n                                    for (i = 0; i < nextKeysPending[nextKey].length; i++) {\n                                        var pendingNextKey = nextKeysPending[nextKey][i]\n                                        childMapping[nextKeysPending[nextKey][i]] = getValueForKey(\n                                            pendingNextKey\n                                        )\n                                    }\n                                }\n                                childMapping[nextKey] = getValueForKey(nextKey)\n                            }\n\n                            // Finally, add the keys which didn't appear before any key in `next`\n                            for (i = 0; i < pendingKeys.length; i++) {\n                                childMapping[pendingKeys[i]] = getValueForKey(pendingKeys[i])\n                            }\n\n                            return childMapping\n                        }\n                    }\n\n                    module.exports = ReactTransitionChildMapping\n                },\n                { \"37\": 37, \"69\": 69 }\n            ],\n            97: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule ReactTransitionEvents\n                     */\n\n                    \"use strict\"\n\n                    var ExecutionEnvironment = _dereq_(22)\n\n                    /**\n                     * EVENT_NAME_MAP is used to determine which event fired when a\n                     * transition/animation ends, based on the style property used to\n                     * define that event.\n                     */\n                    var EVENT_NAME_MAP = {\n                        transitionend: {\n                            transition: \"transitionend\",\n                            WebkitTransition: \"webkitTransitionEnd\",\n                            MozTransition: \"mozTransitionEnd\",\n                            OTransition: \"oTransitionEnd\",\n                            msTransition: \"MSTransitionEnd\"\n                        },\n\n                        animationend: {\n                            animation: \"animationend\",\n                            WebkitAnimation: \"webkitAnimationEnd\",\n                            MozAnimation: \"mozAnimationEnd\",\n                            OAnimation: \"oAnimationEnd\",\n                            msAnimation: \"MSAnimationEnd\"\n                        }\n                    }\n\n                    var endEvents = []\n\n                    function detectEvents() {\n                        var testEl = document.createElement(\"div\")\n                        var style = testEl.style\n\n                        // On some platforms, in particular some releases of Android 4.x,\n                        // the un-prefixed \"animation\" and \"transition\" properties are defined on the\n                        // style object but the events that fire will still be prefixed, so we need\n                        // to check if the un-prefixed events are useable, and if not remove them\n                        // from the map\n                        if (!(\"AnimationEvent\" in window)) {\n                            delete EVENT_NAME_MAP.animationend.animation\n                        }\n\n                        if (!(\"TransitionEvent\" in window)) {\n                            delete EVENT_NAME_MAP.transitionend.transition\n                        }\n\n                        for (var baseEventName in EVENT_NAME_MAP) {\n                            var baseEvents = EVENT_NAME_MAP[baseEventName]\n                            for (var styleName in baseEvents) {\n                                if (styleName in style) {\n                                    endEvents.push(baseEvents[styleName])\n                                    break\n                                }\n                            }\n                        }\n                    }\n\n                    if (ExecutionEnvironment.canUseDOM) {\n                        detectEvents()\n                    }\n\n                    // We use the raw {add|remove}EventListener() call because EventListener\n                    // does not know how to remove event listeners and we really should\n                    // clean up. Also, these events are not triggered in older browsers\n                    // so we should be A-OK here.\n\n                    function addEventListener(node, eventName, eventListener) {\n                        node.addEventListener(eventName, eventListener, false)\n                    }\n\n                    function removeEventListener(node, eventName, eventListener) {\n                        node.removeEventListener(eventName, eventListener, false)\n                    }\n\n                    var ReactTransitionEvents = {\n                        addEndEventListener: function(node, eventListener) {\n                            if (endEvents.length === 0) {\n                                // If CSS transitions are not supported, trigger an \"end animation\"\n                                // event immediately.\n                                window.setTimeout(eventListener, 0)\n                                return\n                            }\n                            endEvents.forEach(function(endEvent) {\n                                addEventListener(node, endEvent, eventListener)\n                            })\n                        },\n\n                        removeEndEventListener: function(node, eventListener) {\n                            if (endEvents.length === 0) {\n                                return\n                            }\n                            endEvents.forEach(function(endEvent) {\n                                removeEventListener(node, endEvent, eventListener)\n                            })\n                        }\n                    }\n\n                    module.exports = ReactTransitionEvents\n                },\n                { \"22\": 22 }\n            ],\n            98: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule ReactTransitionGroup\n                     */\n\n                    \"use strict\"\n\n                    var React = _dereq_(31)\n                    var ReactTransitionChildMapping = _dereq_(96)\n\n                    var assign = _dereq_(29)\n                    var cloneWithProps = _dereq_(122)\n                    var emptyFunction = _dereq_(129)\n\n                    var ReactTransitionGroup = React.createClass({\n                        displayName: \"ReactTransitionGroup\",\n\n                        propTypes: {\n                            component: React.PropTypes.any,\n                            childFactory: React.PropTypes.func\n                        },\n\n                        getDefaultProps: function() {\n                            return {\n                                component: \"span\",\n                                childFactory: emptyFunction.thatReturnsArgument\n                            }\n                        },\n\n                        getInitialState: function() {\n                            return {\n                                children: ReactTransitionChildMapping.getChildMapping(\n                                    this.props.children\n                                )\n                            }\n                        },\n\n                        componentWillMount: function() {\n                            this.currentlyTransitioningKeys = {}\n                            this.keysToEnter = []\n                            this.keysToLeave = []\n                        },\n\n                        componentDidMount: function() {\n                            var initialChildMapping = this.state.children\n                            for (var key in initialChildMapping) {\n                                if (initialChildMapping[key]) {\n                                    this.performAppear(key)\n                                }\n                            }\n                        },\n\n                        componentWillReceiveProps: function(nextProps) {\n                            var nextChildMapping = ReactTransitionChildMapping.getChildMapping(\n                                nextProps.children\n                            )\n                            var prevChildMapping = this.state.children\n\n                            this.setState({\n                                children: ReactTransitionChildMapping.mergeChildMappings(\n                                    prevChildMapping,\n                                    nextChildMapping\n                                )\n                            })\n\n                            var key\n\n                            for (key in nextChildMapping) {\n                                var hasPrev =\n                                    prevChildMapping && prevChildMapping.hasOwnProperty(key)\n                                if (\n                                    nextChildMapping[key] &&\n                                    !hasPrev &&\n                                    !this.currentlyTransitioningKeys[key]\n                                ) {\n                                    this.keysToEnter.push(key)\n                                }\n                            }\n\n                            for (key in prevChildMapping) {\n                                var hasNext =\n                                    nextChildMapping && nextChildMapping.hasOwnProperty(key)\n                                if (\n                                    prevChildMapping[key] &&\n                                    !hasNext &&\n                                    !this.currentlyTransitioningKeys[key]\n                                ) {\n                                    this.keysToLeave.push(key)\n                                }\n                            }\n\n                            // If we want to someday check for reordering, we could do it here.\n                        },\n\n                        componentDidUpdate: function() {\n                            var keysToEnter = this.keysToEnter\n                            this.keysToEnter = []\n                            keysToEnter.forEach(this.performEnter)\n\n                            var keysToLeave = this.keysToLeave\n                            this.keysToLeave = []\n                            keysToLeave.forEach(this.performLeave)\n                        },\n\n                        performAppear: function(key) {\n                            this.currentlyTransitioningKeys[key] = true\n\n                            var component = this.refs[key]\n\n                            if (component.componentWillAppear) {\n                                component.componentWillAppear(\n                                    this._handleDoneAppearing.bind(this, key)\n                                )\n                            } else {\n                                this._handleDoneAppearing(key)\n                            }\n                        },\n\n                        _handleDoneAppearing: function(key) {\n                            var component = this.refs[key]\n                            if (component.componentDidAppear) {\n                                component.componentDidAppear()\n                            }\n\n                            delete this.currentlyTransitioningKeys[key]\n\n                            var currentChildMapping = ReactTransitionChildMapping.getChildMapping(\n                                this.props.children\n                            )\n\n                            if (!currentChildMapping || !currentChildMapping.hasOwnProperty(key)) {\n                                // This was removed before it had fully appeared. Remove it.\n                                this.performLeave(key)\n                            }\n                        },\n\n                        performEnter: function(key) {\n                            this.currentlyTransitioningKeys[key] = true\n\n                            var component = this.refs[key]\n\n                            if (component.componentWillEnter) {\n                                component.componentWillEnter(\n                                    this._handleDoneEntering.bind(this, key)\n                                )\n                            } else {\n                                this._handleDoneEntering(key)\n                            }\n                        },\n\n                        _handleDoneEntering: function(key) {\n                            var component = this.refs[key]\n                            if (component.componentDidEnter) {\n                                component.componentDidEnter()\n                            }\n\n                            delete this.currentlyTransitioningKeys[key]\n\n                            var currentChildMapping = ReactTransitionChildMapping.getChildMapping(\n                                this.props.children\n                            )\n\n                            if (!currentChildMapping || !currentChildMapping.hasOwnProperty(key)) {\n                                // This was removed before it had fully entered. Remove it.\n                                this.performLeave(key)\n                            }\n                        },\n\n                        performLeave: function(key) {\n                            this.currentlyTransitioningKeys[key] = true\n\n                            var component = this.refs[key]\n                            if (component.componentWillLeave) {\n                                component.componentWillLeave(\n                                    this._handleDoneLeaving.bind(this, key)\n                                )\n                            } else {\n                                // Note that this is somewhat dangerous b/c it calls setState()\n                                // again, effectively mutating the component before all the work\n                                // is done.\n                                this._handleDoneLeaving(key)\n                            }\n                        },\n\n                        _handleDoneLeaving: function(key) {\n                            var component = this.refs[key]\n\n                            if (component.componentDidLeave) {\n                                component.componentDidLeave()\n                            }\n\n                            delete this.currentlyTransitioningKeys[key]\n\n                            var currentChildMapping = ReactTransitionChildMapping.getChildMapping(\n                                this.props.children\n                            )\n\n                            if (currentChildMapping && currentChildMapping.hasOwnProperty(key)) {\n                                // This entered again before it fully left. Add it again.\n                                this.performEnter(key)\n                            } else {\n                                var newChildren = assign({}, this.state.children)\n                                delete newChildren[key]\n                                this.setState({ children: newChildren })\n                            }\n                        },\n\n                        render: function() {\n                            // TODO: we could get rid of the need for the wrapper node\n                            // by cloning a single child\n                            var childrenToRender = []\n                            for (var key in this.state.children) {\n                                var child = this.state.children[key]\n                                if (child) {\n                                    // You may need to apply reactive updates to a child as it is leaving.\n                                    // The normal React way to do it won't work since the child will have\n                                    // already been removed. In case you need this behavior you can provide\n                                    // a childFactory function to wrap every child, even the ones that are\n                                    // leaving.\n                                    childrenToRender.push(\n                                        cloneWithProps(this.props.childFactory(child), {\n                                            ref: key,\n                                            key: key\n                                        })\n                                    )\n                                }\n                            }\n                            return React.createElement(\n                                this.props.component,\n                                this.props,\n                                childrenToRender\n                            )\n                        }\n                    })\n\n                    module.exports = ReactTransitionGroup\n                },\n                { \"122\": 122, \"129\": 129, \"29\": 29, \"31\": 31, \"96\": 96 }\n            ],\n            99: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule ReactUpdateQueue\n                     */\n\n                    \"use strict\"\n\n                    var ReactLifeCycle = _dereq_(74)\n                    var ReactCurrentOwner = _dereq_(45)\n                    var ReactElement = _dereq_(63)\n                    var ReactInstanceMap = _dereq_(73)\n                    var ReactUpdates = _dereq_(100)\n\n                    var assign = _dereq_(29)\n                    var invariant = _dereq_(150)\n                    var warning = _dereq_(171)\n\n                    function enqueueUpdate(internalInstance) {\n                        if (internalInstance !== ReactLifeCycle.currentlyMountingInstance) {\n                            // If we're in a componentWillMount handler, don't enqueue a rerender\n                            // because ReactUpdates assumes we're in a browser context (which is\n                            // wrong for server rendering) and we're about to do a render anyway.\n                            // See bug in #1740.\n                            ReactUpdates.enqueueUpdate(internalInstance)\n                        }\n                    }\n\n                    function getInternalInstanceReadyForUpdate(publicInstance, callerName) {\n                        \"production\" !== \"development\"\n                            ? invariant(\n                                  ReactCurrentOwner.current == null,\n                                  \"%s(...): Cannot update during an existing state transition \" +\n                                      \"(such as within `render`). Render methods should be a pure function \" +\n                                      \"of props and state.\",\n                                  callerName\n                              )\n                            : invariant(ReactCurrentOwner.current == null)\n\n                        var internalInstance = ReactInstanceMap.get(publicInstance)\n                        if (!internalInstance) {\n                            if (\"production\" !== \"development\") {\n                                // Only warn when we have a callerName. Otherwise we should be silent.\n                                // We're probably calling from enqueueCallback. We don't want to warn\n                                // there because we already warned for the corresponding lifecycle method.\n                                \"production\" !== \"development\"\n                                    ? warning(\n                                          !callerName,\n                                          \"%s(...): Can only update a mounted or mounting component. \" +\n                                              \"This usually means you called %s() on an unmounted \" +\n                                              \"component. This is a no-op.\",\n                                          callerName,\n                                          callerName\n                                      )\n                                    : null\n                            }\n                            return null\n                        }\n\n                        if (internalInstance === ReactLifeCycle.currentlyUnmountingInstance) {\n                            return null\n                        }\n\n                        return internalInstance\n                    }\n\n                    /**\n                     * ReactUpdateQueue allows for state updates to be scheduled into a later\n                     * reconciliation step.\n                     */\n                    var ReactUpdateQueue = {\n                        /**\n                         * Enqueue a callback that will be executed after all the pending updates\n                         * have processed.\n                         *\n                         * @param {ReactClass} publicInstance The instance to use as `this` context.\n                         * @param {?function} callback Called after state is updated.\n                         * @internal\n                         */\n                        enqueueCallback: function(publicInstance, callback) {\n                            \"production\" !== \"development\"\n                                ? invariant(\n                                      typeof callback === \"function\",\n                                      \"enqueueCallback(...): You called `setProps`, `replaceProps`, \" +\n                                          \"`setState`, `replaceState`, or `forceUpdate` with a callback that \" +\n                                          \"isn't callable.\"\n                                  )\n                                : invariant(typeof callback === \"function\")\n                            var internalInstance = getInternalInstanceReadyForUpdate(publicInstance)\n\n                            // Previously we would throw an error if we didn't have an internal\n                            // instance. Since we want to make it a no-op instead, we mirror the same\n                            // behavior we have in other enqueue* methods.\n                            // We also need to ignore callbacks in componentWillMount. See\n                            // enqueueUpdates.\n                            if (\n                                !internalInstance ||\n                                internalInstance === ReactLifeCycle.currentlyMountingInstance\n                            ) {\n                                return null\n                            }\n\n                            if (internalInstance._pendingCallbacks) {\n                                internalInstance._pendingCallbacks.push(callback)\n                            } else {\n                                internalInstance._pendingCallbacks = [callback]\n                            }\n                            // TODO: The callback here is ignored when setState is called from\n                            // componentWillMount. Either fix it or disallow doing so completely in\n                            // favor of getInitialState. Alternatively, we can disallow\n                            // componentWillMount during server-side rendering.\n                            enqueueUpdate(internalInstance)\n                        },\n\n                        enqueueCallbackInternal: function(internalInstance, callback) {\n                            \"production\" !== \"development\"\n                                ? invariant(\n                                      typeof callback === \"function\",\n                                      \"enqueueCallback(...): You called `setProps`, `replaceProps`, \" +\n                                          \"`setState`, `replaceState`, or `forceUpdate` with a callback that \" +\n                                          \"isn't callable.\"\n                                  )\n                                : invariant(typeof callback === \"function\")\n                            if (internalInstance._pendingCallbacks) {\n                                internalInstance._pendingCallbacks.push(callback)\n                            } else {\n                                internalInstance._pendingCallbacks = [callback]\n                            }\n                            enqueueUpdate(internalInstance)\n                        },\n\n                        /**\n                         * Forces an update. This should only be invoked when it is known with\n                         * certainty that we are **not** in a DOM transaction.\n                         *\n                         * You may want to call this when you know that some deeper aspect of the\n                         * component's state has changed but `setState` was not called.\n                         *\n                         * This will not invoke `shouldUpdateComponent`, but it will invoke\n                         * `componentWillUpdate` and `componentDidUpdate`.\n                         *\n                         * @param {ReactClass} publicInstance The instance that should rerender.\n                         * @internal\n                         */\n                        enqueueForceUpdate: function(publicInstance) {\n                            var internalInstance = getInternalInstanceReadyForUpdate(\n                                publicInstance,\n                                \"forceUpdate\"\n                            )\n\n                            if (!internalInstance) {\n                                return\n                            }\n\n                            internalInstance._pendingForceUpdate = true\n\n                            enqueueUpdate(internalInstance)\n                        },\n\n                        /**\n                         * Replaces all of the state. Always use this or `setState` to mutate state.\n                         * You should treat `this.state` as immutable.\n                         *\n                         * There is no guarantee that `this.state` will be immediately updated, so\n                         * accessing `this.state` after calling this method may return the old value.\n                         *\n                         * @param {ReactClass} publicInstance The instance that should rerender.\n                         * @param {object} completeState Next state.\n                         * @internal\n                         */\n                        enqueueReplaceState: function(publicInstance, completeState) {\n                            var internalInstance = getInternalInstanceReadyForUpdate(\n                                publicInstance,\n                                \"replaceState\"\n                            )\n\n                            if (!internalInstance) {\n                                return\n                            }\n\n                            internalInstance._pendingStateQueue = [completeState]\n                            internalInstance._pendingReplaceState = true\n\n                            enqueueUpdate(internalInstance)\n                        },\n\n                        /**\n                         * Sets a subset of the state. This only exists because _pendingState is\n                         * internal. This provides a merging strategy that is not available to deep\n                         * properties which is confusing. TODO: Expose pendingState or don't use it\n                         * during the merge.\n                         *\n                         * @param {ReactClass} publicInstance The instance that should rerender.\n                         * @param {object} partialState Next partial state to be merged with state.\n                         * @internal\n                         */\n                        enqueueSetState: function(publicInstance, partialState) {\n                            var internalInstance = getInternalInstanceReadyForUpdate(\n                                publicInstance,\n                                \"setState\"\n                            )\n\n                            if (!internalInstance) {\n                                return\n                            }\n\n                            var queue =\n                                internalInstance._pendingStateQueue ||\n                                (internalInstance._pendingStateQueue = [])\n                            queue.push(partialState)\n\n                            enqueueUpdate(internalInstance)\n                        },\n\n                        /**\n                         * Sets a subset of the props.\n                         *\n                         * @param {ReactClass} publicInstance The instance that should rerender.\n                         * @param {object} partialProps Subset of the next props.\n                         * @internal\n                         */\n                        enqueueSetProps: function(publicInstance, partialProps) {\n                            var internalInstance = getInternalInstanceReadyForUpdate(\n                                publicInstance,\n                                \"setProps\"\n                            )\n\n                            if (!internalInstance) {\n                                return\n                            }\n\n                            \"production\" !== \"development\"\n                                ? invariant(\n                                      internalInstance._isTopLevel,\n                                      \"setProps(...): You called `setProps` on a \" +\n                                          \"component with a parent. This is an anti-pattern since props will \" +\n                                          \"get reactively updated when rendered. Instead, change the owner's \" +\n                                          \"`render` method to pass the correct value as props to the component \" +\n                                          \"where it is created.\"\n                                  )\n                                : invariant(internalInstance._isTopLevel)\n\n                            // Merge with the pending element if it exists, otherwise with existing\n                            // element props.\n                            var element =\n                                internalInstance._pendingElement || internalInstance._currentElement\n                            var props = assign({}, element.props, partialProps)\n                            internalInstance._pendingElement = ReactElement.cloneAndReplaceProps(\n                                element,\n                                props\n                            )\n\n                            enqueueUpdate(internalInstance)\n                        },\n\n                        /**\n                         * Replaces all of the props.\n                         *\n                         * @param {ReactClass} publicInstance The instance that should rerender.\n                         * @param {object} props New props.\n                         * @internal\n                         */\n                        enqueueReplaceProps: function(publicInstance, props) {\n                            var internalInstance = getInternalInstanceReadyForUpdate(\n                                publicInstance,\n                                \"replaceProps\"\n                            )\n\n                            if (!internalInstance) {\n                                return\n                            }\n\n                            \"production\" !== \"development\"\n                                ? invariant(\n                                      internalInstance._isTopLevel,\n                                      \"replaceProps(...): You called `replaceProps` on a \" +\n                                          \"component with a parent. This is an anti-pattern since props will \" +\n                                          \"get reactively updated when rendered. Instead, change the owner's \" +\n                                          \"`render` method to pass the correct value as props to the component \" +\n                                          \"where it is created.\"\n                                  )\n                                : invariant(internalInstance._isTopLevel)\n\n                            // Merge with the pending element if it exists, otherwise with existing\n                            // element props.\n                            var element =\n                                internalInstance._pendingElement || internalInstance._currentElement\n                            internalInstance._pendingElement = ReactElement.cloneAndReplaceProps(\n                                element,\n                                props\n                            )\n\n                            enqueueUpdate(internalInstance)\n                        },\n\n                        enqueueElementInternal: function(internalInstance, newElement) {\n                            internalInstance._pendingElement = newElement\n                            enqueueUpdate(internalInstance)\n                        }\n                    }\n\n                    module.exports = ReactUpdateQueue\n                },\n                {\n                    \"100\": 100,\n                    \"150\": 150,\n                    \"171\": 171,\n                    \"29\": 29,\n                    \"45\": 45,\n                    \"63\": 63,\n                    \"73\": 73,\n                    \"74\": 74\n                }\n            ],\n            100: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule ReactUpdates\n                     */\n\n                    \"use strict\"\n\n                    var CallbackQueue = _dereq_(7)\n                    var PooledClass = _dereq_(30)\n                    var ReactCurrentOwner = _dereq_(45)\n                    var ReactPerf = _dereq_(82)\n                    var ReactReconciler = _dereq_(89)\n                    var Transaction = _dereq_(116)\n\n                    var assign = _dereq_(29)\n                    var invariant = _dereq_(150)\n                    var warning = _dereq_(171)\n\n                    var dirtyComponents = []\n                    var asapCallbackQueue = CallbackQueue.getPooled()\n                    var asapEnqueued = false\n\n                    var batchingStrategy = null\n\n                    function ensureInjected() {\n                        \"production\" !== \"development\"\n                            ? invariant(\n                                  ReactUpdates.ReactReconcileTransaction && batchingStrategy,\n                                  \"ReactUpdates: must inject a reconcile transaction class and batching \" +\n                                      \"strategy\"\n                              )\n                            : invariant(ReactUpdates.ReactReconcileTransaction && batchingStrategy)\n                    }\n\n                    var NESTED_UPDATES = {\n                        initialize: function() {\n                            this.dirtyComponentsLength = dirtyComponents.length\n                        },\n                        close: function() {\n                            if (this.dirtyComponentsLength !== dirtyComponents.length) {\n                                // Additional updates were enqueued by componentDidUpdate handlers or\n                                // similar; before our own UPDATE_QUEUEING wrapper closes, we want to run\n                                // these new updates so that if A's componentDidUpdate calls setState on\n                                // B, B will update before the callback A's updater provided when calling\n                                // setState.\n                                dirtyComponents.splice(0, this.dirtyComponentsLength)\n                                flushBatchedUpdates()\n                            } else {\n                                dirtyComponents.length = 0\n                            }\n                        }\n                    }\n\n                    var UPDATE_QUEUEING = {\n                        initialize: function() {\n                            this.callbackQueue.reset()\n                        },\n                        close: function() {\n                            this.callbackQueue.notifyAll()\n                        }\n                    }\n\n                    var TRANSACTION_WRAPPERS = [NESTED_UPDATES, UPDATE_QUEUEING]\n\n                    function ReactUpdatesFlushTransaction() {\n                        this.reinitializeTransaction()\n                        this.dirtyComponentsLength = null\n                        this.callbackQueue = CallbackQueue.getPooled()\n                        this.reconcileTransaction = ReactUpdates.ReactReconcileTransaction.getPooled()\n                    }\n\n                    assign(ReactUpdatesFlushTransaction.prototype, Transaction.Mixin, {\n                        getTransactionWrappers: function() {\n                            return TRANSACTION_WRAPPERS\n                        },\n\n                        destructor: function() {\n                            this.dirtyComponentsLength = null\n                            CallbackQueue.release(this.callbackQueue)\n                            this.callbackQueue = null\n                            ReactUpdates.ReactReconcileTransaction.release(\n                                this.reconcileTransaction\n                            )\n                            this.reconcileTransaction = null\n                        },\n\n                        perform: function(method, scope, a) {\n                            // Essentially calls `this.reconcileTransaction.perform(method, scope, a)`\n                            // with this transaction's wrappers around it.\n                            return Transaction.Mixin.perform.call(\n                                this,\n                                this.reconcileTransaction.perform,\n                                this.reconcileTransaction,\n                                method,\n                                scope,\n                                a\n                            )\n                        }\n                    })\n\n                    PooledClass.addPoolingTo(ReactUpdatesFlushTransaction)\n\n                    function batchedUpdates(callback, a, b, c, d) {\n                        ensureInjected()\n                        batchingStrategy.batchedUpdates(callback, a, b, c, d)\n                    }\n\n                    /**\n                     * Array comparator for ReactComponents by mount ordering.\n                     *\n                     * @param {ReactComponent} c1 first component you're comparing\n                     * @param {ReactComponent} c2 second component you're comparing\n                     * @return {number} Return value usable by Array.prototype.sort().\n                     */\n                    function mountOrderComparator(c1, c2) {\n                        return c1._mountOrder - c2._mountOrder\n                    }\n\n                    function runBatchedUpdates(transaction) {\n                        var len = transaction.dirtyComponentsLength\n                        \"production\" !== \"development\"\n                            ? invariant(\n                                  len === dirtyComponents.length,\n                                  \"Expected flush transaction's stored dirty-components length (%s) to \" +\n                                      \"match dirty-components array length (%s).\",\n                                  len,\n                                  dirtyComponents.length\n                              )\n                            : invariant(len === dirtyComponents.length)\n\n                        // Since reconciling a component higher in the owner hierarchy usually (not\n                        // always -- see shouldComponentUpdate()) will reconcile children, reconcile\n                        // them before their children by sorting the array.\n                        dirtyComponents.sort(mountOrderComparator)\n\n                        for (var i = 0; i < len; i++) {\n                            // If a component is unmounted before pending changes apply, it will still\n                            // be here, but we assume that it has cleared its _pendingCallbacks and\n                            // that performUpdateIfNecessary is a noop.\n                            var component = dirtyComponents[i]\n\n                            // If performUpdateIfNecessary happens to enqueue any new updates, we\n                            // shouldn't execute the callbacks until the next render happens, so\n                            // stash the callbacks first\n                            var callbacks = component._pendingCallbacks\n                            component._pendingCallbacks = null\n\n                            ReactReconciler.performUpdateIfNecessary(\n                                component,\n                                transaction.reconcileTransaction\n                            )\n\n                            if (callbacks) {\n                                for (var j = 0; j < callbacks.length; j++) {\n                                    transaction.callbackQueue.enqueue(\n                                        callbacks[j],\n                                        component.getPublicInstance()\n                                    )\n                                }\n                            }\n                        }\n                    }\n\n                    var flushBatchedUpdates = function() {\n                        // ReactUpdatesFlushTransaction's wrappers will clear the dirtyComponents\n                        // array and perform any updates enqueued by mount-ready handlers (i.e.,\n                        // componentDidUpdate) but we need to check here too in order to catch\n                        // updates enqueued by setState callbacks and asap calls.\n                        while (dirtyComponents.length || asapEnqueued) {\n                            if (dirtyComponents.length) {\n                                var transaction = ReactUpdatesFlushTransaction.getPooled()\n                                transaction.perform(runBatchedUpdates, null, transaction)\n                                ReactUpdatesFlushTransaction.release(transaction)\n                            }\n\n                            if (asapEnqueued) {\n                                asapEnqueued = false\n                                var queue = asapCallbackQueue\n                                asapCallbackQueue = CallbackQueue.getPooled()\n                                queue.notifyAll()\n                                CallbackQueue.release(queue)\n                            }\n                        }\n                    }\n                    flushBatchedUpdates = ReactPerf.measure(\n                        \"ReactUpdates\",\n                        \"flushBatchedUpdates\",\n                        flushBatchedUpdates\n                    )\n\n                    /**\n                     * Mark a component as needing a rerender, adding an optional callback to a\n                     * list of functions which will be executed once the rerender occurs.\n                     */\n                    function enqueueUpdate(component) {\n                        ensureInjected()\n\n                        // Various parts of our code (such as ReactCompositeComponent's\n                        // _renderValidatedComponent) assume that calls to render aren't nested;\n                        // verify that that's the case. (This is called by each top-level update\n                        // function, like setProps, setState, forceUpdate, etc.; creation and\n                        // destruction of top-level components is guarded in ReactMount.)\n                        \"production\" !== \"development\"\n                            ? warning(\n                                  ReactCurrentOwner.current == null,\n                                  \"enqueueUpdate(): Render methods should be a pure function of props \" +\n                                      \"and state; triggering nested component updates from render is not \" +\n                                      \"allowed. If necessary, trigger nested updates in \" +\n                                      \"componentDidUpdate.\"\n                              )\n                            : null\n\n                        if (!batchingStrategy.isBatchingUpdates) {\n                            batchingStrategy.batchedUpdates(enqueueUpdate, component)\n                            return\n                        }\n\n                        dirtyComponents.push(component)\n                    }\n\n                    /**\n                     * Enqueue a callback to be run at the end of the current batching cycle. Throws\n                     * if no updates are currently being performed.\n                     */\n                    function asap(callback, context) {\n                        \"production\" !== \"development\"\n                            ? invariant(\n                                  batchingStrategy.isBatchingUpdates,\n                                  \"ReactUpdates.asap: Can't enqueue an asap callback in a context where\" +\n                                      \"updates are not being batched.\"\n                              )\n                            : invariant(batchingStrategy.isBatchingUpdates)\n                        asapCallbackQueue.enqueue(callback, context)\n                        asapEnqueued = true\n                    }\n\n                    var ReactUpdatesInjection = {\n                        injectReconcileTransaction: function(ReconcileTransaction) {\n                            \"production\" !== \"development\"\n                                ? invariant(\n                                      ReconcileTransaction,\n                                      \"ReactUpdates: must provide a reconcile transaction class\"\n                                  )\n                                : invariant(ReconcileTransaction)\n                            ReactUpdates.ReactReconcileTransaction = ReconcileTransaction\n                        },\n\n                        injectBatchingStrategy: function(_batchingStrategy) {\n                            \"production\" !== \"development\"\n                                ? invariant(\n                                      _batchingStrategy,\n                                      \"ReactUpdates: must provide a batching strategy\"\n                                  )\n                                : invariant(_batchingStrategy)\n                            \"production\" !== \"development\"\n                                ? invariant(\n                                      typeof _batchingStrategy.batchedUpdates === \"function\",\n                                      \"ReactUpdates: must provide a batchedUpdates() function\"\n                                  )\n                                : invariant(typeof _batchingStrategy.batchedUpdates === \"function\")\n                            \"production\" !== \"development\"\n                                ? invariant(\n                                      typeof _batchingStrategy.isBatchingUpdates === \"boolean\",\n                                      \"ReactUpdates: must provide an isBatchingUpdates boolean attribute\"\n                                  )\n                                : invariant(\n                                      typeof _batchingStrategy.isBatchingUpdates === \"boolean\"\n                                  )\n                            batchingStrategy = _batchingStrategy\n                        }\n                    }\n\n                    var ReactUpdates = {\n                        /**\n                         * React references `ReactReconcileTransaction` using this property in order\n                         * to allow dependency injection.\n                         *\n                         * @internal\n                         */\n                        ReactReconcileTransaction: null,\n\n                        batchedUpdates: batchedUpdates,\n                        enqueueUpdate: enqueueUpdate,\n                        flushBatchedUpdates: flushBatchedUpdates,\n                        injection: ReactUpdatesInjection,\n                        asap: asap\n                    }\n\n                    module.exports = ReactUpdates\n                },\n                {\n                    \"116\": 116,\n                    \"150\": 150,\n                    \"171\": 171,\n                    \"29\": 29,\n                    \"30\": 30,\n                    \"45\": 45,\n                    \"7\": 7,\n                    \"82\": 82,\n                    \"89\": 89\n                }\n            ],\n            101: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule SVGDOMPropertyConfig\n                     */\n\n                    /*jslint bitwise: true*/\n\n                    \"use strict\"\n\n                    var DOMProperty = _dereq_(11)\n\n                    var MUST_USE_ATTRIBUTE = DOMProperty.injection.MUST_USE_ATTRIBUTE\n\n                    var SVGDOMPropertyConfig = {\n                        Properties: {\n                            clipPath: MUST_USE_ATTRIBUTE,\n                            cx: MUST_USE_ATTRIBUTE,\n                            cy: MUST_USE_ATTRIBUTE,\n                            d: MUST_USE_ATTRIBUTE,\n                            dx: MUST_USE_ATTRIBUTE,\n                            dy: MUST_USE_ATTRIBUTE,\n                            fill: MUST_USE_ATTRIBUTE,\n                            fillOpacity: MUST_USE_ATTRIBUTE,\n                            fontFamily: MUST_USE_ATTRIBUTE,\n                            fontSize: MUST_USE_ATTRIBUTE,\n                            fx: MUST_USE_ATTRIBUTE,\n                            fy: MUST_USE_ATTRIBUTE,\n                            gradientTransform: MUST_USE_ATTRIBUTE,\n                            gradientUnits: MUST_USE_ATTRIBUTE,\n                            markerEnd: MUST_USE_ATTRIBUTE,\n                            markerMid: MUST_USE_ATTRIBUTE,\n                            markerStart: MUST_USE_ATTRIBUTE,\n                            offset: MUST_USE_ATTRIBUTE,\n                            opacity: MUST_USE_ATTRIBUTE,\n                            patternContentUnits: MUST_USE_ATTRIBUTE,\n                            patternUnits: MUST_USE_ATTRIBUTE,\n                            points: MUST_USE_ATTRIBUTE,\n                            preserveAspectRatio: MUST_USE_ATTRIBUTE,\n                            r: MUST_USE_ATTRIBUTE,\n                            rx: MUST_USE_ATTRIBUTE,\n                            ry: MUST_USE_ATTRIBUTE,\n                            spreadMethod: MUST_USE_ATTRIBUTE,\n                            stopColor: MUST_USE_ATTRIBUTE,\n                            stopOpacity: MUST_USE_ATTRIBUTE,\n                            stroke: MUST_USE_ATTRIBUTE,\n                            strokeDasharray: MUST_USE_ATTRIBUTE,\n                            strokeLinecap: MUST_USE_ATTRIBUTE,\n                            strokeOpacity: MUST_USE_ATTRIBUTE,\n                            strokeWidth: MUST_USE_ATTRIBUTE,\n                            textAnchor: MUST_USE_ATTRIBUTE,\n                            transform: MUST_USE_ATTRIBUTE,\n                            version: MUST_USE_ATTRIBUTE,\n                            viewBox: MUST_USE_ATTRIBUTE,\n                            x1: MUST_USE_ATTRIBUTE,\n                            x2: MUST_USE_ATTRIBUTE,\n                            x: MUST_USE_ATTRIBUTE,\n                            y1: MUST_USE_ATTRIBUTE,\n                            y2: MUST_USE_ATTRIBUTE,\n                            y: MUST_USE_ATTRIBUTE\n                        },\n                        DOMAttributeNames: {\n                            clipPath: \"clip-path\",\n                            fillOpacity: \"fill-opacity\",\n                            fontFamily: \"font-family\",\n                            fontSize: \"font-size\",\n                            gradientTransform: \"gradientTransform\",\n                            gradientUnits: \"gradientUnits\",\n                            markerEnd: \"marker-end\",\n                            markerMid: \"marker-mid\",\n                            markerStart: \"marker-start\",\n                            patternContentUnits: \"patternContentUnits\",\n                            patternUnits: \"patternUnits\",\n                            preserveAspectRatio: \"preserveAspectRatio\",\n                            spreadMethod: \"spreadMethod\",\n                            stopColor: \"stop-color\",\n                            stopOpacity: \"stop-opacity\",\n                            strokeDasharray: \"stroke-dasharray\",\n                            strokeLinecap: \"stroke-linecap\",\n                            strokeOpacity: \"stroke-opacity\",\n                            strokeWidth: \"stroke-width\",\n                            textAnchor: \"text-anchor\",\n                            viewBox: \"viewBox\"\n                        }\n                    }\n\n                    module.exports = SVGDOMPropertyConfig\n                },\n                { \"11\": 11 }\n            ],\n            102: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule SelectEventPlugin\n                     */\n\n                    \"use strict\"\n\n                    var EventConstants = _dereq_(16)\n                    var EventPropagators = _dereq_(21)\n                    var ReactInputSelection = _dereq_(71)\n                    var SyntheticEvent = _dereq_(108)\n\n                    var getActiveElement = _dereq_(136)\n                    var isTextInputElement = _dereq_(153)\n                    var keyOf = _dereq_(157)\n                    var shallowEqual = _dereq_(166)\n\n                    var topLevelTypes = EventConstants.topLevelTypes\n\n                    var eventTypes = {\n                        select: {\n                            phasedRegistrationNames: {\n                                bubbled: keyOf({ onSelect: null }),\n                                captured: keyOf({ onSelectCapture: null })\n                            },\n                            dependencies: [\n                                topLevelTypes.topBlur,\n                                topLevelTypes.topContextMenu,\n                                topLevelTypes.topFocus,\n                                topLevelTypes.topKeyDown,\n                                topLevelTypes.topMouseDown,\n                                topLevelTypes.topMouseUp,\n                                topLevelTypes.topSelectionChange\n                            ]\n                        }\n                    }\n\n                    var activeElement = null\n                    var activeElementID = null\n                    var lastSelection = null\n                    var mouseDown = false\n\n                    /**\n                     * Get an object which is a unique representation of the current selection.\n                     *\n                     * The return value will not be consistent across nodes or browsers, but\n                     * two identical selections on the same node will return identical objects.\n                     *\n                     * @param {DOMElement} node\n                     * @param {object}\n                     */\n                    function getSelection(node) {\n                        if (\n                            \"selectionStart\" in node &&\n                            ReactInputSelection.hasSelectionCapabilities(node)\n                        ) {\n                            return {\n                                start: node.selectionStart,\n                                end: node.selectionEnd\n                            }\n                        } else if (window.getSelection) {\n                            var selection = window.getSelection()\n                            return {\n                                anchorNode: selection.anchorNode,\n                                anchorOffset: selection.anchorOffset,\n                                focusNode: selection.focusNode,\n                                focusOffset: selection.focusOffset\n                            }\n                        } else if (document.selection) {\n                            var range = document.selection.createRange()\n                            return {\n                                parentElement: range.parentElement(),\n                                text: range.text,\n                                top: range.boundingTop,\n                                left: range.boundingLeft\n                            }\n                        }\n                    }\n\n                    /**\n                     * Poll selection to see whether it's changed.\n                     *\n                     * @param {object} nativeEvent\n                     * @return {?SyntheticEvent}\n                     */\n                    function constructSelectEvent(nativeEvent) {\n                        // Ensure we have the right element, and that the user is not dragging a\n                        // selection (this matches native `select` event behavior). In HTML5, select\n                        // fires only on input and textarea thus if there's no focused element we\n                        // won't dispatch.\n                        if (\n                            mouseDown ||\n                            activeElement == null ||\n                            activeElement !== getActiveElement()\n                        ) {\n                            return null\n                        }\n\n                        // Only fire when selection has actually changed.\n                        var currentSelection = getSelection(activeElement)\n                        if (!lastSelection || !shallowEqual(lastSelection, currentSelection)) {\n                            lastSelection = currentSelection\n\n                            var syntheticEvent = SyntheticEvent.getPooled(\n                                eventTypes.select,\n                                activeElementID,\n                                nativeEvent\n                            )\n\n                            syntheticEvent.type = \"select\"\n                            syntheticEvent.target = activeElement\n\n                            EventPropagators.accumulateTwoPhaseDispatches(syntheticEvent)\n\n                            return syntheticEvent\n                        }\n                    }\n\n                    /**\n                     * This plugin creates an `onSelect` event that normalizes select events\n                     * across form elements.\n                     *\n                     * Supported elements are:\n                     * - input (see `isTextInputElement`)\n                     * - textarea\n                     * - contentEditable\n                     *\n                     * This differs from native browser implementations in the following ways:\n                     * - Fires on contentEditable fields as well as inputs.\n                     * - Fires for collapsed selection.\n                     * - Fires after user input.\n                     */\n                    var SelectEventPlugin = {\n                        eventTypes: eventTypes,\n\n                        /**\n                         * @param {string} topLevelType Record from `EventConstants`.\n                         * @param {DOMEventTarget} topLevelTarget The listening component root node.\n                         * @param {string} topLevelTargetID ID of `topLevelTarget`.\n                         * @param {object} nativeEvent Native browser event.\n                         * @return {*} An accumulation of synthetic events.\n                         * @see {EventPluginHub.extractEvents}\n                         */\n                        extractEvents: function(\n                            topLevelType,\n                            topLevelTarget,\n                            topLevelTargetID,\n                            nativeEvent\n                        ) {\n                            switch (topLevelType) {\n                                // Track the input node that has focus.\n                                case topLevelTypes.topFocus:\n                                    if (\n                                        isTextInputElement(topLevelTarget) ||\n                                        topLevelTarget.contentEditable === \"true\"\n                                    ) {\n                                        activeElement = topLevelTarget\n                                        activeElementID = topLevelTargetID\n                                        lastSelection = null\n                                    }\n                                    break\n                                case topLevelTypes.topBlur:\n                                    activeElement = null\n                                    activeElementID = null\n                                    lastSelection = null\n                                    break\n\n                                // Don't fire the event while the user is dragging. This matches the\n                                // semantics of the native select event.\n                                case topLevelTypes.topMouseDown:\n                                    mouseDown = true\n                                    break\n                                case topLevelTypes.topContextMenu:\n                                case topLevelTypes.topMouseUp:\n                                    mouseDown = false\n                                    return constructSelectEvent(nativeEvent)\n\n                                // Chrome and IE fire non-standard event when selection is changed (and\n                                // sometimes when it hasn't).\n                                // Firefox doesn't support selectionchange, so check selection status\n                                // after each key entry. The selection changes after keydown and before\n                                // keyup, but we check on keydown as well in the case of holding down a\n                                // key, when multiple keydown events are fired but only one keyup is.\n                                case topLevelTypes.topSelectionChange:\n                                case topLevelTypes.topKeyDown:\n                                case topLevelTypes.topKeyUp:\n                                    return constructSelectEvent(nativeEvent)\n                            }\n                        }\n                    }\n\n                    module.exports = SelectEventPlugin\n                },\n                {\n                    \"108\": 108,\n                    \"136\": 136,\n                    \"153\": 153,\n                    \"157\": 157,\n                    \"16\": 16,\n                    \"166\": 166,\n                    \"21\": 21,\n                    \"71\": 71\n                }\n            ],\n            103: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule ServerReactRootIndex\n                     * @typechecks\n                     */\n\n                    \"use strict\"\n\n                    /**\n                     * Size of the reactRoot ID space. We generate random numbers for React root\n                     * IDs and if there's a collision the events and DOM update system will\n                     * get confused. In the future we need a way to generate GUIDs but for\n                     * now this will work on a smaller scale.\n                     */\n                    var GLOBAL_MOUNT_POINT_MAX = Math.pow(2, 53)\n\n                    var ServerReactRootIndex = {\n                        createReactRootIndex: function() {\n                            return Math.ceil(Math.random() * GLOBAL_MOUNT_POINT_MAX)\n                        }\n                    }\n\n                    module.exports = ServerReactRootIndex\n                },\n                {}\n            ],\n            104: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule SimpleEventPlugin\n                     */\n\n                    \"use strict\"\n\n                    var EventConstants = _dereq_(16)\n                    var EventPluginUtils = _dereq_(20)\n                    var EventPropagators = _dereq_(21)\n                    var SyntheticClipboardEvent = _dereq_(105)\n                    var SyntheticEvent = _dereq_(108)\n                    var SyntheticFocusEvent = _dereq_(109)\n                    var SyntheticKeyboardEvent = _dereq_(111)\n                    var SyntheticMouseEvent = _dereq_(112)\n                    var SyntheticDragEvent = _dereq_(107)\n                    var SyntheticTouchEvent = _dereq_(113)\n                    var SyntheticUIEvent = _dereq_(114)\n                    var SyntheticWheelEvent = _dereq_(115)\n\n                    var getEventCharCode = _dereq_(137)\n\n                    var invariant = _dereq_(150)\n                    var keyOf = _dereq_(157)\n                    var warning = _dereq_(171)\n\n                    var topLevelTypes = EventConstants.topLevelTypes\n\n                    var eventTypes = {\n                        blur: {\n                            phasedRegistrationNames: {\n                                bubbled: keyOf({ onBlur: true }),\n                                captured: keyOf({ onBlurCapture: true })\n                            }\n                        },\n                        click: {\n                            phasedRegistrationNames: {\n                                bubbled: keyOf({ onClick: true }),\n                                captured: keyOf({ onClickCapture: true })\n                            }\n                        },\n                        contextMenu: {\n                            phasedRegistrationNames: {\n                                bubbled: keyOf({ onContextMenu: true }),\n                                captured: keyOf({ onContextMenuCapture: true })\n                            }\n                        },\n                        copy: {\n                            phasedRegistrationNames: {\n                                bubbled: keyOf({ onCopy: true }),\n                                captured: keyOf({ onCopyCapture: true })\n                            }\n                        },\n                        cut: {\n                            phasedRegistrationNames: {\n                                bubbled: keyOf({ onCut: true }),\n                                captured: keyOf({ onCutCapture: true })\n                            }\n                        },\n                        doubleClick: {\n                            phasedRegistrationNames: {\n                                bubbled: keyOf({ onDoubleClick: true }),\n                                captured: keyOf({ onDoubleClickCapture: true })\n                            }\n                        },\n                        drag: {\n                            phasedRegistrationNames: {\n                                bubbled: keyOf({ onDrag: true }),\n                                captured: keyOf({ onDragCapture: true })\n                            }\n                        },\n                        dragEnd: {\n                            phasedRegistrationNames: {\n                                bubbled: keyOf({ onDragEnd: true }),\n                                captured: keyOf({ onDragEndCapture: true })\n                            }\n                        },\n                        dragEnter: {\n                            phasedRegistrationNames: {\n                                bubbled: keyOf({ onDragEnter: true }),\n                                captured: keyOf({ onDragEnterCapture: true })\n                            }\n                        },\n                        dragExit: {\n                            phasedRegistrationNames: {\n                                bubbled: keyOf({ onDragExit: true }),\n                                captured: keyOf({ onDragExitCapture: true })\n                            }\n                        },\n                        dragLeave: {\n                            phasedRegistrationNames: {\n                                bubbled: keyOf({ onDragLeave: true }),\n                                captured: keyOf({ onDragLeaveCapture: true })\n                            }\n                        },\n                        dragOver: {\n                            phasedRegistrationNames: {\n                                bubbled: keyOf({ onDragOver: true }),\n                                captured: keyOf({ onDragOverCapture: true })\n                            }\n                        },\n                        dragStart: {\n                            phasedRegistrationNames: {\n                                bubbled: keyOf({ onDragStart: true }),\n                                captured: keyOf({ onDragStartCapture: true })\n                            }\n                        },\n                        drop: {\n                            phasedRegistrationNames: {\n                                bubbled: keyOf({ onDrop: true }),\n                                captured: keyOf({ onDropCapture: true })\n                            }\n                        },\n                        focus: {\n                            phasedRegistrationNames: {\n                                bubbled: keyOf({ onFocus: true }),\n                                captured: keyOf({ onFocusCapture: true })\n                            }\n                        },\n                        input: {\n                            phasedRegistrationNames: {\n                                bubbled: keyOf({ onInput: true }),\n                                captured: keyOf({ onInputCapture: true })\n                            }\n                        },\n                        keyDown: {\n                            phasedRegistrationNames: {\n                                bubbled: keyOf({ onKeyDown: true }),\n                                captured: keyOf({ onKeyDownCapture: true })\n                            }\n                        },\n                        keyPress: {\n                            phasedRegistrationNames: {\n                                bubbled: keyOf({ onKeyPress: true }),\n                                captured: keyOf({ onKeyPressCapture: true })\n                            }\n                        },\n                        keyUp: {\n                            phasedRegistrationNames: {\n                                bubbled: keyOf({ onKeyUp: true }),\n                                captured: keyOf({ onKeyUpCapture: true })\n                            }\n                        },\n                        load: {\n                            phasedRegistrationNames: {\n                                bubbled: keyOf({ onLoad: true }),\n                                captured: keyOf({ onLoadCapture: true })\n                            }\n                        },\n                        error: {\n                            phasedRegistrationNames: {\n                                bubbled: keyOf({ onError: true }),\n                                captured: keyOf({ onErrorCapture: true })\n                            }\n                        },\n                        // Note: We do not allow listening to mouseOver events. Instead, use the\n                        // onMouseEnter/onMouseLeave created by `EnterLeaveEventPlugin`.\n                        mouseDown: {\n                            phasedRegistrationNames: {\n                                bubbled: keyOf({ onMouseDown: true }),\n                                captured: keyOf({ onMouseDownCapture: true })\n                            }\n                        },\n                        mouseMove: {\n                            phasedRegistrationNames: {\n                                bubbled: keyOf({ onMouseMove: true }),\n                                captured: keyOf({ onMouseMoveCapture: true })\n                            }\n                        },\n                        mouseOut: {\n                            phasedRegistrationNames: {\n                                bubbled: keyOf({ onMouseOut: true }),\n                                captured: keyOf({ onMouseOutCapture: true })\n                            }\n                        },\n                        mouseOver: {\n                            phasedRegistrationNames: {\n                                bubbled: keyOf({ onMouseOver: true }),\n                                captured: keyOf({ onMouseOverCapture: true })\n                            }\n                        },\n                        mouseUp: {\n                            phasedRegistrationNames: {\n                                bubbled: keyOf({ onMouseUp: true }),\n                                captured: keyOf({ onMouseUpCapture: true })\n                            }\n                        },\n                        paste: {\n                            phasedRegistrationNames: {\n                                bubbled: keyOf({ onPaste: true }),\n                                captured: keyOf({ onPasteCapture: true })\n                            }\n                        },\n                        reset: {\n                            phasedRegistrationNames: {\n                                bubbled: keyOf({ onReset: true }),\n                                captured: keyOf({ onResetCapture: true })\n                            }\n                        },\n                        scroll: {\n                            phasedRegistrationNames: {\n                                bubbled: keyOf({ onScroll: true }),\n                                captured: keyOf({ onScrollCapture: true })\n                            }\n                        },\n                        submit: {\n                            phasedRegistrationNames: {\n                                bubbled: keyOf({ onSubmit: true }),\n                                captured: keyOf({ onSubmitCapture: true })\n                            }\n                        },\n                        touchCancel: {\n                            phasedRegistrationNames: {\n                                bubbled: keyOf({ onTouchCancel: true }),\n                                captured: keyOf({ onTouchCancelCapture: true })\n                            }\n                        },\n                        touchEnd: {\n                            phasedRegistrationNames: {\n                                bubbled: keyOf({ onTouchEnd: true }),\n                                captured: keyOf({ onTouchEndCapture: true })\n                            }\n                        },\n                        touchMove: {\n                            phasedRegistrationNames: {\n                                bubbled: keyOf({ onTouchMove: true }),\n                                captured: keyOf({ onTouchMoveCapture: true })\n                            }\n                        },\n                        touchStart: {\n                            phasedRegistrationNames: {\n                                bubbled: keyOf({ onTouchStart: true }),\n                                captured: keyOf({ onTouchStartCapture: true })\n                            }\n                        },\n                        wheel: {\n                            phasedRegistrationNames: {\n                                bubbled: keyOf({ onWheel: true }),\n                                captured: keyOf({ onWheelCapture: true })\n                            }\n                        }\n                    }\n\n                    var topLevelEventsToDispatchConfig = {\n                        topBlur: eventTypes.blur,\n                        topClick: eventTypes.click,\n                        topContextMenu: eventTypes.contextMenu,\n                        topCopy: eventTypes.copy,\n                        topCut: eventTypes.cut,\n                        topDoubleClick: eventTypes.doubleClick,\n                        topDrag: eventTypes.drag,\n                        topDragEnd: eventTypes.dragEnd,\n                        topDragEnter: eventTypes.dragEnter,\n                        topDragExit: eventTypes.dragExit,\n                        topDragLeave: eventTypes.dragLeave,\n                        topDragOver: eventTypes.dragOver,\n                        topDragStart: eventTypes.dragStart,\n                        topDrop: eventTypes.drop,\n                        topError: eventTypes.error,\n                        topFocus: eventTypes.focus,\n                        topInput: eventTypes.input,\n                        topKeyDown: eventTypes.keyDown,\n                        topKeyPress: eventTypes.keyPress,\n                        topKeyUp: eventTypes.keyUp,\n                        topLoad: eventTypes.load,\n                        topMouseDown: eventTypes.mouseDown,\n                        topMouseMove: eventTypes.mouseMove,\n                        topMouseOut: eventTypes.mouseOut,\n                        topMouseOver: eventTypes.mouseOver,\n                        topMouseUp: eventTypes.mouseUp,\n                        topPaste: eventTypes.paste,\n                        topReset: eventTypes.reset,\n                        topScroll: eventTypes.scroll,\n                        topSubmit: eventTypes.submit,\n                        topTouchCancel: eventTypes.touchCancel,\n                        topTouchEnd: eventTypes.touchEnd,\n                        topTouchMove: eventTypes.touchMove,\n                        topTouchStart: eventTypes.touchStart,\n                        topWheel: eventTypes.wheel\n                    }\n\n                    for (var type in topLevelEventsToDispatchConfig) {\n                        topLevelEventsToDispatchConfig[type].dependencies = [type]\n                    }\n\n                    var SimpleEventPlugin = {\n                        eventTypes: eventTypes,\n\n                        /**\n                         * Same as the default implementation, except cancels the event when return\n                         * value is false. This behavior will be disabled in a future release.\n                         *\n                         * @param {object} Event to be dispatched.\n                         * @param {function} Application-level callback.\n                         * @param {string} domID DOM ID to pass to the callback.\n                         */\n                        executeDispatch: function(event, listener, domID) {\n                            var returnValue = EventPluginUtils.executeDispatch(\n                                event,\n                                listener,\n                                domID\n                            )\n\n                            \"production\" !== \"development\"\n                                ? warning(\n                                      typeof returnValue !== \"boolean\",\n                                      \"Returning `false` from an event handler is deprecated and will be \" +\n                                          \"ignored in a future release. Instead, manually call \" +\n                                          \"e.stopPropagation() or e.preventDefault(), as appropriate.\"\n                                  )\n                                : null\n\n                            if (returnValue === false) {\n                                event.stopPropagation()\n                                event.preventDefault()\n                            }\n                        },\n\n                        /**\n                         * @param {string} topLevelType Record from `EventConstants`.\n                         * @param {DOMEventTarget} topLevelTarget The listening component root node.\n                         * @param {string} topLevelTargetID ID of `topLevelTarget`.\n                         * @param {object} nativeEvent Native browser event.\n                         * @return {*} An accumulation of synthetic events.\n                         * @see {EventPluginHub.extractEvents}\n                         */\n                        extractEvents: function(\n                            topLevelType,\n                            topLevelTarget,\n                            topLevelTargetID,\n                            nativeEvent\n                        ) {\n                            var dispatchConfig = topLevelEventsToDispatchConfig[topLevelType]\n                            if (!dispatchConfig) {\n                                return null\n                            }\n                            var EventConstructor\n                            switch (topLevelType) {\n                                case topLevelTypes.topInput:\n                                case topLevelTypes.topLoad:\n                                case topLevelTypes.topError:\n                                case topLevelTypes.topReset:\n                                case topLevelTypes.topSubmit:\n                                    // HTML Events\n                                    // @see http://www.w3.org/TR/html5/index.html#events-0\n                                    EventConstructor = SyntheticEvent\n                                    break\n                                case topLevelTypes.topKeyPress:\n                                    // FireFox creates a keypress event for function keys too. This removes\n                                    // the unwanted keypress events. Enter is however both printable and\n                                    // non-printable. One would expect Tab to be as well (but it isn't).\n                                    if (getEventCharCode(nativeEvent) === 0) {\n                                        return null\n                                    }\n                                /* falls through */\n                                case topLevelTypes.topKeyDown:\n                                case topLevelTypes.topKeyUp:\n                                    EventConstructor = SyntheticKeyboardEvent\n                                    break\n                                case topLevelTypes.topBlur:\n                                case topLevelTypes.topFocus:\n                                    EventConstructor = SyntheticFocusEvent\n                                    break\n                                case topLevelTypes.topClick:\n                                    // Firefox creates a click event on right mouse clicks. This removes the\n                                    // unwanted click events.\n                                    if (nativeEvent.button === 2) {\n                                        return null\n                                    }\n                                /* falls through */\n                                case topLevelTypes.topContextMenu:\n                                case topLevelTypes.topDoubleClick:\n                                case topLevelTypes.topMouseDown:\n                                case topLevelTypes.topMouseMove:\n                                case topLevelTypes.topMouseOut:\n                                case topLevelTypes.topMouseOver:\n                                case topLevelTypes.topMouseUp:\n                                    EventConstructor = SyntheticMouseEvent\n                                    break\n                                case topLevelTypes.topDrag:\n                                case topLevelTypes.topDragEnd:\n                                case topLevelTypes.topDragEnter:\n                                case topLevelTypes.topDragExit:\n                                case topLevelTypes.topDragLeave:\n                                case topLevelTypes.topDragOver:\n                                case topLevelTypes.topDragStart:\n                                case topLevelTypes.topDrop:\n                                    EventConstructor = SyntheticDragEvent\n                                    break\n                                case topLevelTypes.topTouchCancel:\n                                case topLevelTypes.topTouchEnd:\n                                case topLevelTypes.topTouchMove:\n                                case topLevelTypes.topTouchStart:\n                                    EventConstructor = SyntheticTouchEvent\n                                    break\n                                case topLevelTypes.topScroll:\n                                    EventConstructor = SyntheticUIEvent\n                                    break\n                                case topLevelTypes.topWheel:\n                                    EventConstructor = SyntheticWheelEvent\n                                    break\n                                case topLevelTypes.topCopy:\n                                case topLevelTypes.topCut:\n                                case topLevelTypes.topPaste:\n                                    EventConstructor = SyntheticClipboardEvent\n                                    break\n                            }\n                            \"production\" !== \"development\"\n                                ? invariant(\n                                      EventConstructor,\n                                      \"SimpleEventPlugin: Unhandled event type, `%s`.\",\n                                      topLevelType\n                                  )\n                                : invariant(EventConstructor)\n                            var event = EventConstructor.getPooled(\n                                dispatchConfig,\n                                topLevelTargetID,\n                                nativeEvent\n                            )\n                            EventPropagators.accumulateTwoPhaseDispatches(event)\n                            return event\n                        }\n                    }\n\n                    module.exports = SimpleEventPlugin\n                },\n                {\n                    \"105\": 105,\n                    \"107\": 107,\n                    \"108\": 108,\n                    \"109\": 109,\n                    \"111\": 111,\n                    \"112\": 112,\n                    \"113\": 113,\n                    \"114\": 114,\n                    \"115\": 115,\n                    \"137\": 137,\n                    \"150\": 150,\n                    \"157\": 157,\n                    \"16\": 16,\n                    \"171\": 171,\n                    \"20\": 20,\n                    \"21\": 21\n                }\n            ],\n            105: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule SyntheticClipboardEvent\n                     * @typechecks static-only\n                     */\n\n                    \"use strict\"\n\n                    var SyntheticEvent = _dereq_(108)\n\n                    /**\n                     * @interface Event\n                     * @see http://www.w3.org/TR/clipboard-apis/\n                     */\n                    var ClipboardEventInterface = {\n                        clipboardData: function(event) {\n                            return \"clipboardData\" in event\n                                ? event.clipboardData\n                                : window.clipboardData\n                        }\n                    }\n\n                    /**\n                     * @param {object} dispatchConfig Configuration used to dispatch this event.\n                     * @param {string} dispatchMarker Marker identifying the event target.\n                     * @param {object} nativeEvent Native browser event.\n                     * @extends {SyntheticUIEvent}\n                     */\n                    function SyntheticClipboardEvent(dispatchConfig, dispatchMarker, nativeEvent) {\n                        SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent)\n                    }\n\n                    SyntheticEvent.augmentClass(SyntheticClipboardEvent, ClipboardEventInterface)\n\n                    module.exports = SyntheticClipboardEvent\n                },\n                { \"108\": 108 }\n            ],\n            106: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule SyntheticCompositionEvent\n                     * @typechecks static-only\n                     */\n\n                    \"use strict\"\n\n                    var SyntheticEvent = _dereq_(108)\n\n                    /**\n                     * @interface Event\n                     * @see http://www.w3.org/TR/DOM-Level-3-Events/#events-compositionevents\n                     */\n                    var CompositionEventInterface = {\n                        data: null\n                    }\n\n                    /**\n                     * @param {object} dispatchConfig Configuration used to dispatch this event.\n                     * @param {string} dispatchMarker Marker identifying the event target.\n                     * @param {object} nativeEvent Native browser event.\n                     * @extends {SyntheticUIEvent}\n                     */\n                    function SyntheticCompositionEvent(\n                        dispatchConfig,\n                        dispatchMarker,\n                        nativeEvent\n                    ) {\n                        SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent)\n                    }\n\n                    SyntheticEvent.augmentClass(\n                        SyntheticCompositionEvent,\n                        CompositionEventInterface\n                    )\n\n                    module.exports = SyntheticCompositionEvent\n                },\n                { \"108\": 108 }\n            ],\n            107: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule SyntheticDragEvent\n                     * @typechecks static-only\n                     */\n\n                    \"use strict\"\n\n                    var SyntheticMouseEvent = _dereq_(112)\n\n                    /**\n                     * @interface DragEvent\n                     * @see http://www.w3.org/TR/DOM-Level-3-Events/\n                     */\n                    var DragEventInterface = {\n                        dataTransfer: null\n                    }\n\n                    /**\n                     * @param {object} dispatchConfig Configuration used to dispatch this event.\n                     * @param {string} dispatchMarker Marker identifying the event target.\n                     * @param {object} nativeEvent Native browser event.\n                     * @extends {SyntheticUIEvent}\n                     */\n                    function SyntheticDragEvent(dispatchConfig, dispatchMarker, nativeEvent) {\n                        SyntheticMouseEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent)\n                    }\n\n                    SyntheticMouseEvent.augmentClass(SyntheticDragEvent, DragEventInterface)\n\n                    module.exports = SyntheticDragEvent\n                },\n                { \"112\": 112 }\n            ],\n            108: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule SyntheticEvent\n                     * @typechecks static-only\n                     */\n\n                    \"use strict\"\n\n                    var PooledClass = _dereq_(30)\n\n                    var assign = _dereq_(29)\n                    var emptyFunction = _dereq_(129)\n                    var getEventTarget = _dereq_(140)\n\n                    /**\n                     * @interface Event\n                     * @see http://www.w3.org/TR/DOM-Level-3-Events/\n                     */\n                    var EventInterface = {\n                        type: null,\n                        target: getEventTarget,\n                        // currentTarget is set when dispatching; no use in copying it here\n                        currentTarget: emptyFunction.thatReturnsNull,\n                        eventPhase: null,\n                        bubbles: null,\n                        cancelable: null,\n                        timeStamp: function(event) {\n                            return event.timeStamp || Date.now()\n                        },\n                        defaultPrevented: null,\n                        isTrusted: null\n                    }\n\n                    /**\n                     * Synthetic events are dispatched by event plugins, typically in response to a\n                     * top-level event delegation handler.\n                     *\n                     * These systems should generally use pooling to reduce the frequency of garbage\n                     * collection. The system should check `isPersistent` to determine whether the\n                     * event should be released into the pool after being dispatched. Users that\n                     * need a persisted event should invoke `persist`.\n                     *\n                     * Synthetic events (and subclasses) implement the DOM Level 3 Events API by\n                     * normalizing browser quirks. Subclasses do not necessarily have to implement a\n                     * DOM interface; custom application-specific events can also subclass this.\n                     *\n                     * @param {object} dispatchConfig Configuration used to dispatch this event.\n                     * @param {string} dispatchMarker Marker identifying the event target.\n                     * @param {object} nativeEvent Native browser event.\n                     */\n                    function SyntheticEvent(dispatchConfig, dispatchMarker, nativeEvent) {\n                        this.dispatchConfig = dispatchConfig\n                        this.dispatchMarker = dispatchMarker\n                        this.nativeEvent = nativeEvent\n\n                        var Interface = this.constructor.Interface\n                        for (var propName in Interface) {\n                            if (!Interface.hasOwnProperty(propName)) {\n                                continue\n                            }\n                            var normalize = Interface[propName]\n                            if (normalize) {\n                                this[propName] = normalize(nativeEvent)\n                            } else {\n                                this[propName] = nativeEvent[propName]\n                            }\n                        }\n\n                        var defaultPrevented =\n                            nativeEvent.defaultPrevented != null\n                                ? nativeEvent.defaultPrevented\n                                : nativeEvent.returnValue === false\n                        if (defaultPrevented) {\n                            this.isDefaultPrevented = emptyFunction.thatReturnsTrue\n                        } else {\n                            this.isDefaultPrevented = emptyFunction.thatReturnsFalse\n                        }\n                        this.isPropagationStopped = emptyFunction.thatReturnsFalse\n                    }\n\n                    assign(SyntheticEvent.prototype, {\n                        preventDefault: function() {\n                            this.defaultPrevented = true\n                            var event = this.nativeEvent\n                            if (event.preventDefault) {\n                                event.preventDefault()\n                            } else {\n                                event.returnValue = false\n                            }\n                            this.isDefaultPrevented = emptyFunction.thatReturnsTrue\n                        },\n\n                        stopPropagation: function() {\n                            var event = this.nativeEvent\n                            if (event.stopPropagation) {\n                                event.stopPropagation()\n                            } else {\n                                event.cancelBubble = true\n                            }\n                            this.isPropagationStopped = emptyFunction.thatReturnsTrue\n                        },\n\n                        /**\n                         * We release all dispatched `SyntheticEvent`s after each event loop, adding\n                         * them back into the pool. This allows a way to hold onto a reference that\n                         * won't be added back into the pool.\n                         */\n                        persist: function() {\n                            this.isPersistent = emptyFunction.thatReturnsTrue\n                        },\n\n                        /**\n                         * Checks if this event should be released back into the pool.\n                         *\n                         * @return {boolean} True if this should not be released, false otherwise.\n                         */\n                        isPersistent: emptyFunction.thatReturnsFalse,\n\n                        /**\n                         * `PooledClass` looks for `destructor` on each instance it releases.\n                         */\n                        destructor: function() {\n                            var Interface = this.constructor.Interface\n                            for (var propName in Interface) {\n                                this[propName] = null\n                            }\n                            this.dispatchConfig = null\n                            this.dispatchMarker = null\n                            this.nativeEvent = null\n                        }\n                    })\n\n                    SyntheticEvent.Interface = EventInterface\n\n                    /**\n                     * Helper to reduce boilerplate when creating subclasses.\n                     *\n                     * @param {function} Class\n                     * @param {?object} Interface\n                     */\n                    SyntheticEvent.augmentClass = function(Class, Interface) {\n                        var Super = this\n\n                        var prototype = Object.create(Super.prototype)\n                        assign(prototype, Class.prototype)\n                        Class.prototype = prototype\n                        Class.prototype.constructor = Class\n\n                        Class.Interface = assign({}, Super.Interface, Interface)\n                        Class.augmentClass = Super.augmentClass\n\n                        PooledClass.addPoolingTo(Class, PooledClass.threeArgumentPooler)\n                    }\n\n                    PooledClass.addPoolingTo(SyntheticEvent, PooledClass.threeArgumentPooler)\n\n                    module.exports = SyntheticEvent\n                },\n                { \"129\": 129, \"140\": 140, \"29\": 29, \"30\": 30 }\n            ],\n            109: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule SyntheticFocusEvent\n                     * @typechecks static-only\n                     */\n\n                    \"use strict\"\n\n                    var SyntheticUIEvent = _dereq_(114)\n\n                    /**\n                     * @interface FocusEvent\n                     * @see http://www.w3.org/TR/DOM-Level-3-Events/\n                     */\n                    var FocusEventInterface = {\n                        relatedTarget: null\n                    }\n\n                    /**\n                     * @param {object} dispatchConfig Configuration used to dispatch this event.\n                     * @param {string} dispatchMarker Marker identifying the event target.\n                     * @param {object} nativeEvent Native browser event.\n                     * @extends {SyntheticUIEvent}\n                     */\n                    function SyntheticFocusEvent(dispatchConfig, dispatchMarker, nativeEvent) {\n                        SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent)\n                    }\n\n                    SyntheticUIEvent.augmentClass(SyntheticFocusEvent, FocusEventInterface)\n\n                    module.exports = SyntheticFocusEvent\n                },\n                { \"114\": 114 }\n            ],\n            110: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule SyntheticInputEvent\n                     * @typechecks static-only\n                     */\n\n                    \"use strict\"\n\n                    var SyntheticEvent = _dereq_(108)\n\n                    /**\n                     * @interface Event\n                     * @see http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105\n                     *      /#events-inputevents\n                     */\n                    var InputEventInterface = {\n                        data: null\n                    }\n\n                    /**\n                     * @param {object} dispatchConfig Configuration used to dispatch this event.\n                     * @param {string} dispatchMarker Marker identifying the event target.\n                     * @param {object} nativeEvent Native browser event.\n                     * @extends {SyntheticUIEvent}\n                     */\n                    function SyntheticInputEvent(dispatchConfig, dispatchMarker, nativeEvent) {\n                        SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent)\n                    }\n\n                    SyntheticEvent.augmentClass(SyntheticInputEvent, InputEventInterface)\n\n                    module.exports = SyntheticInputEvent\n                },\n                { \"108\": 108 }\n            ],\n            111: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule SyntheticKeyboardEvent\n                     * @typechecks static-only\n                     */\n\n                    \"use strict\"\n\n                    var SyntheticUIEvent = _dereq_(114)\n\n                    var getEventCharCode = _dereq_(137)\n                    var getEventKey = _dereq_(138)\n                    var getEventModifierState = _dereq_(139)\n\n                    /**\n                     * @interface KeyboardEvent\n                     * @see http://www.w3.org/TR/DOM-Level-3-Events/\n                     */\n                    var KeyboardEventInterface = {\n                        key: getEventKey,\n                        location: null,\n                        ctrlKey: null,\n                        shiftKey: null,\n                        altKey: null,\n                        metaKey: null,\n                        repeat: null,\n                        locale: null,\n                        getModifierState: getEventModifierState,\n                        // Legacy Interface\n                        charCode: function(event) {\n                            // `charCode` is the result of a KeyPress event and represents the value of\n                            // the actual printable character.\n\n                            // KeyPress is deprecated, but its replacement is not yet final and not\n                            // implemented in any major browser. Only KeyPress has charCode.\n                            if (event.type === \"keypress\") {\n                                return getEventCharCode(event)\n                            }\n                            return 0\n                        },\n                        keyCode: function(event) {\n                            // `keyCode` is the result of a KeyDown/Up event and represents the value of\n                            // physical keyboard key.\n\n                            // The actual meaning of the value depends on the users' keyboard layout\n                            // which cannot be detected. Assuming that it is a US keyboard layout\n                            // provides a surprisingly accurate mapping for US and European users.\n                            // Due to this, it is left to the user to implement at this time.\n                            if (event.type === \"keydown\" || event.type === \"keyup\") {\n                                return event.keyCode\n                            }\n                            return 0\n                        },\n                        which: function(event) {\n                            // `which` is an alias for either `keyCode` or `charCode` depending on the\n                            // type of the event.\n                            if (event.type === \"keypress\") {\n                                return getEventCharCode(event)\n                            }\n                            if (event.type === \"keydown\" || event.type === \"keyup\") {\n                                return event.keyCode\n                            }\n                            return 0\n                        }\n                    }\n\n                    /**\n                     * @param {object} dispatchConfig Configuration used to dispatch this event.\n                     * @param {string} dispatchMarker Marker identifying the event target.\n                     * @param {object} nativeEvent Native browser event.\n                     * @extends {SyntheticUIEvent}\n                     */\n                    function SyntheticKeyboardEvent(dispatchConfig, dispatchMarker, nativeEvent) {\n                        SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent)\n                    }\n\n                    SyntheticUIEvent.augmentClass(SyntheticKeyboardEvent, KeyboardEventInterface)\n\n                    module.exports = SyntheticKeyboardEvent\n                },\n                { \"114\": 114, \"137\": 137, \"138\": 138, \"139\": 139 }\n            ],\n            112: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule SyntheticMouseEvent\n                     * @typechecks static-only\n                     */\n\n                    \"use strict\"\n\n                    var SyntheticUIEvent = _dereq_(114)\n                    var ViewportMetrics = _dereq_(117)\n\n                    var getEventModifierState = _dereq_(139)\n\n                    /**\n                     * @interface MouseEvent\n                     * @see http://www.w3.org/TR/DOM-Level-3-Events/\n                     */\n                    var MouseEventInterface = {\n                        screenX: null,\n                        screenY: null,\n                        clientX: null,\n                        clientY: null,\n                        ctrlKey: null,\n                        shiftKey: null,\n                        altKey: null,\n                        metaKey: null,\n                        getModifierState: getEventModifierState,\n                        button: function(event) {\n                            // Webkit, Firefox, IE9+\n                            // which:  1 2 3\n                            // button: 0 1 2 (standard)\n                            var button = event.button\n                            if (\"which\" in event) {\n                                return button\n                            }\n                            // IE<9\n                            // which:  undefined\n                            // button: 0 0 0\n                            // button: 1 4 2 (onmouseup)\n                            return button === 2 ? 2 : button === 4 ? 1 : 0\n                        },\n                        buttons: null,\n                        relatedTarget: function(event) {\n                            return (\n                                event.relatedTarget ||\n                                (event.fromElement === event.srcElement\n                                    ? event.toElement\n                                    : event.fromElement)\n                            )\n                        },\n                        // \"Proprietary\" Interface.\n                        pageX: function(event) {\n                            return \"pageX\" in event\n                                ? event.pageX\n                                : event.clientX + ViewportMetrics.currentScrollLeft\n                        },\n                        pageY: function(event) {\n                            return \"pageY\" in event\n                                ? event.pageY\n                                : event.clientY + ViewportMetrics.currentScrollTop\n                        }\n                    }\n\n                    /**\n                     * @param {object} dispatchConfig Configuration used to dispatch this event.\n                     * @param {string} dispatchMarker Marker identifying the event target.\n                     * @param {object} nativeEvent Native browser event.\n                     * @extends {SyntheticUIEvent}\n                     */\n                    function SyntheticMouseEvent(dispatchConfig, dispatchMarker, nativeEvent) {\n                        SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent)\n                    }\n\n                    SyntheticUIEvent.augmentClass(SyntheticMouseEvent, MouseEventInterface)\n\n                    module.exports = SyntheticMouseEvent\n                },\n                { \"114\": 114, \"117\": 117, \"139\": 139 }\n            ],\n            113: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule SyntheticTouchEvent\n                     * @typechecks static-only\n                     */\n\n                    \"use strict\"\n\n                    var SyntheticUIEvent = _dereq_(114)\n\n                    var getEventModifierState = _dereq_(139)\n\n                    /**\n                     * @interface TouchEvent\n                     * @see http://www.w3.org/TR/touch-events/\n                     */\n                    var TouchEventInterface = {\n                        touches: null,\n                        targetTouches: null,\n                        changedTouches: null,\n                        altKey: null,\n                        metaKey: null,\n                        ctrlKey: null,\n                        shiftKey: null,\n                        getModifierState: getEventModifierState\n                    }\n\n                    /**\n                     * @param {object} dispatchConfig Configuration used to dispatch this event.\n                     * @param {string} dispatchMarker Marker identifying the event target.\n                     * @param {object} nativeEvent Native browser event.\n                     * @extends {SyntheticUIEvent}\n                     */\n                    function SyntheticTouchEvent(dispatchConfig, dispatchMarker, nativeEvent) {\n                        SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent)\n                    }\n\n                    SyntheticUIEvent.augmentClass(SyntheticTouchEvent, TouchEventInterface)\n\n                    module.exports = SyntheticTouchEvent\n                },\n                { \"114\": 114, \"139\": 139 }\n            ],\n            114: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule SyntheticUIEvent\n                     * @typechecks static-only\n                     */\n\n                    \"use strict\"\n\n                    var SyntheticEvent = _dereq_(108)\n\n                    var getEventTarget = _dereq_(140)\n\n                    /**\n                     * @interface UIEvent\n                     * @see http://www.w3.org/TR/DOM-Level-3-Events/\n                     */\n                    var UIEventInterface = {\n                        view: function(event) {\n                            if (event.view) {\n                                return event.view\n                            }\n\n                            var target = getEventTarget(event)\n                            if (target != null && target.window === target) {\n                                // target is a window object\n                                return target\n                            }\n\n                            var doc = target.ownerDocument\n                            // TODO: Figure out why `ownerDocument` is sometimes undefined in IE8.\n                            if (doc) {\n                                return doc.defaultView || doc.parentWindow\n                            } else {\n                                return window\n                            }\n                        },\n                        detail: function(event) {\n                            return event.detail || 0\n                        }\n                    }\n\n                    /**\n                     * @param {object} dispatchConfig Configuration used to dispatch this event.\n                     * @param {string} dispatchMarker Marker identifying the event target.\n                     * @param {object} nativeEvent Native browser event.\n                     * @extends {SyntheticEvent}\n                     */\n                    function SyntheticUIEvent(dispatchConfig, dispatchMarker, nativeEvent) {\n                        SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent)\n                    }\n\n                    SyntheticEvent.augmentClass(SyntheticUIEvent, UIEventInterface)\n\n                    module.exports = SyntheticUIEvent\n                },\n                { \"108\": 108, \"140\": 140 }\n            ],\n            115: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule SyntheticWheelEvent\n                     * @typechecks static-only\n                     */\n\n                    \"use strict\"\n\n                    var SyntheticMouseEvent = _dereq_(112)\n\n                    /**\n                     * @interface WheelEvent\n                     * @see http://www.w3.org/TR/DOM-Level-3-Events/\n                     */\n                    var WheelEventInterface = {\n                        deltaX: function(event) {\n                            return \"deltaX\" in event\n                                ? event.deltaX\n                                : // Fallback to `wheelDeltaX` for Webkit and normalize (right is positive).\n                                \"wheelDeltaX\" in event\n                                ? -event.wheelDeltaX\n                                : 0\n                        },\n                        deltaY: function(event) {\n                            return \"deltaY\" in event\n                                ? event.deltaY\n                                : // Fallback to `wheelDeltaY` for Webkit and normalize (down is positive).\n                                \"wheelDeltaY\" in event\n                                ? -event.wheelDeltaY\n                                : // Fallback to `wheelDelta` for IE<9 and normalize (down is positive).\n                                \"wheelDelta\" in event\n                                ? -event.wheelDelta\n                                : 0\n                        },\n                        deltaZ: null,\n\n                        // Browsers without \"deltaMode\" is reporting in raw wheel delta where one\n                        // notch on the scroll is always +/- 120, roughly equivalent to pixels.\n                        // A good approximation of DOM_DELTA_LINE (1) is 5% of viewport size or\n                        // ~40 pixels, for DOM_DELTA_SCREEN (2) it is 87.5% of viewport size.\n                        deltaMode: null\n                    }\n\n                    /**\n                     * @param {object} dispatchConfig Configuration used to dispatch this event.\n                     * @param {string} dispatchMarker Marker identifying the event target.\n                     * @param {object} nativeEvent Native browser event.\n                     * @extends {SyntheticMouseEvent}\n                     */\n                    function SyntheticWheelEvent(dispatchConfig, dispatchMarker, nativeEvent) {\n                        SyntheticMouseEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent)\n                    }\n\n                    SyntheticMouseEvent.augmentClass(SyntheticWheelEvent, WheelEventInterface)\n\n                    module.exports = SyntheticWheelEvent\n                },\n                { \"112\": 112 }\n            ],\n            116: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule Transaction\n                     */\n\n                    \"use strict\"\n\n                    var invariant = _dereq_(150)\n\n                    /**\n                     * `Transaction` creates a black box that is able to wrap any method such that\n                     * certain invariants are maintained before and after the method is invoked\n                     * (Even if an exception is thrown while invoking the wrapped method). Whoever\n                     * instantiates a transaction can provide enforcers of the invariants at\n                     * creation time. The `Transaction` class itself will supply one additional\n                     * automatic invariant for you - the invariant that any transaction instance\n                     * should not be run while it is already being run. You would typically create a\n                     * single instance of a `Transaction` for reuse multiple times, that potentially\n                     * is used to wrap several different methods. Wrappers are extremely simple -\n                     * they only require implementing two methods.\n                     *\n                     * <pre>\n                     *                       wrappers (injected at creation time)\n                     *                                      +        +\n                     *                                      |        |\n                     *                    +-----------------|--------|--------------+\n                     *                    |                 v        |              |\n                     *                    |      +---------------+   |              |\n                     *                    |   +--|    wrapper1   |---|----+         |\n                     *                    |   |  +---------------+   v    |         |\n                     *                    |   |          +-------------+  |         |\n                     *                    |   |     +----|   wrapper2  |--------+   |\n                     *                    |   |     |    +-------------+  |     |   |\n                     *                    |   |     |                     |     |   |\n                     *                    |   v     v                     v     v   | wrapper\n                     *                    | +---+ +---+   +---------+   +---+ +---+ | invariants\n                     * perform(anyMethod) | |   | |   |   |         |   |   | |   | | maintained\n                     * +----------------->|-|---|-|---|-->|anyMethod|---|---|-|---|-|-------->\n                     *                    | |   | |   |   |         |   |   | |   | |\n                     *                    | |   | |   |   |         |   |   | |   | |\n                     *                    | |   | |   |   |         |   |   | |   | |\n                     *                    | +---+ +---+   +---------+   +---+ +---+ |\n                     *                    |  initialize                    close    |\n                     *                    +-----------------------------------------+\n                     * </pre>\n                     *\n                     * Use cases:\n                     * - Preserving the input selection ranges before/after reconciliation.\n                     *   Restoring selection even in the event of an unexpected error.\n                     * - Deactivating events while rearranging the DOM, preventing blurs/focuses,\n                     *   while guaranteeing that afterwards, the event system is reactivated.\n                     * - Flushing a queue of collected DOM mutations to the main UI thread after a\n                     *   reconciliation takes place in a worker thread.\n                     * - Invoking any collected `componentDidUpdate` callbacks after rendering new\n                     *   content.\n                     * - (Future use case): Wrapping particular flushes of the `ReactWorker` queue\n                     *   to preserve the `scrollTop` (an automatic scroll aware DOM).\n                     * - (Future use case): Layout calculations before and after DOM updates.\n                     *\n                     * Transactional plugin API:\n                     * - A module that has an `initialize` method that returns any precomputation.\n                     * - and a `close` method that accepts the precomputation. `close` is invoked\n                     *   when the wrapped process is completed, or has failed.\n                     *\n                     * @param {Array<TransactionalWrapper>} transactionWrapper Wrapper modules\n                     * that implement `initialize` and `close`.\n                     * @return {Transaction} Single transaction for reuse in thread.\n                     *\n                     * @class Transaction\n                     */\n                    var Mixin = {\n                        /**\n                         * Sets up this instance so that it is prepared for collecting metrics. Does\n                         * so such that this setup method may be used on an instance that is already\n                         * initialized, in a way that does not consume additional memory upon reuse.\n                         * That can be useful if you decide to make your subclass of this mixin a\n                         * \"PooledClass\".\n                         */\n                        reinitializeTransaction: function() {\n                            this.transactionWrappers = this.getTransactionWrappers()\n                            if (!this.wrapperInitData) {\n                                this.wrapperInitData = []\n                            } else {\n                                this.wrapperInitData.length = 0\n                            }\n                            this._isInTransaction = false\n                        },\n\n                        _isInTransaction: false,\n\n                        /**\n                         * @abstract\n                         * @return {Array<TransactionWrapper>} Array of transaction wrappers.\n                         */\n                        getTransactionWrappers: null,\n\n                        isInTransaction: function() {\n                            return !!this._isInTransaction\n                        },\n\n                        /**\n                         * Executes the function within a safety window. Use this for the top level\n                         * methods that result in large amounts of computation/mutations that would\n                         * need to be safety checked.\n                         *\n                         * @param {function} method Member of scope to call.\n                         * @param {Object} scope Scope to invoke from.\n                         * @param {Object?=} args... Arguments to pass to the method (optional).\n                         *                           Helps prevent need to bind in many cases.\n                         * @return Return value from `method`.\n                         */\n                        perform: function(method, scope, a, b, c, d, e, f) {\n                            \"production\" !== \"development\"\n                                ? invariant(\n                                      !this.isInTransaction(),\n                                      \"Transaction.perform(...): Cannot initialize a transaction when there \" +\n                                          \"is already an outstanding transaction.\"\n                                  )\n                                : invariant(!this.isInTransaction())\n                            var errorThrown\n                            var ret\n                            try {\n                                this._isInTransaction = true\n                                // Catching errors makes debugging more difficult, so we start with\n                                // errorThrown set to true before setting it to false after calling\n                                // close -- if it's still set to true in the finally block, it means\n                                // one of these calls threw.\n                                errorThrown = true\n                                this.initializeAll(0)\n                                ret = method.call(scope, a, b, c, d, e, f)\n                                errorThrown = false\n                            } finally {\n                                try {\n                                    if (errorThrown) {\n                                        // If `method` throws, prefer to show that stack trace over any thrown\n                                        // by invoking `closeAll`.\n                                        try {\n                                            this.closeAll(0)\n                                        } catch (err) {}\n                                    } else {\n                                        // Since `method` didn't throw, we don't want to silence the exception\n                                        // here.\n                                        this.closeAll(0)\n                                    }\n                                } finally {\n                                    this._isInTransaction = false\n                                }\n                            }\n                            return ret\n                        },\n\n                        initializeAll: function(startIndex) {\n                            var transactionWrappers = this.transactionWrappers\n                            for (var i = startIndex; i < transactionWrappers.length; i++) {\n                                var wrapper = transactionWrappers[i]\n                                try {\n                                    // Catching errors makes debugging more difficult, so we start with the\n                                    // OBSERVED_ERROR state before overwriting it with the real return value\n                                    // of initialize -- if it's still set to OBSERVED_ERROR in the finally\n                                    // block, it means wrapper.initialize threw.\n                                    this.wrapperInitData[i] = Transaction.OBSERVED_ERROR\n                                    this.wrapperInitData[i] = wrapper.initialize\n                                        ? wrapper.initialize.call(this)\n                                        : null\n                                } finally {\n                                    if (this.wrapperInitData[i] === Transaction.OBSERVED_ERROR) {\n                                        // The initializer for wrapper i threw an error; initialize the\n                                        // remaining wrappers but silence any exceptions from them to ensure\n                                        // that the first error is the one to bubble up.\n                                        try {\n                                            this.initializeAll(i + 1)\n                                        } catch (err) {}\n                                    }\n                                }\n                            }\n                        },\n\n                        /**\n                         * Invokes each of `this.transactionWrappers.close[i]` functions, passing into\n                         * them the respective return values of `this.transactionWrappers.init[i]`\n                         * (`close`rs that correspond to initializers that failed will not be\n                         * invoked).\n                         */\n                        closeAll: function(startIndex) {\n                            \"production\" !== \"development\"\n                                ? invariant(\n                                      this.isInTransaction(),\n                                      \"Transaction.closeAll(): Cannot close transaction when none are open.\"\n                                  )\n                                : invariant(this.isInTransaction())\n                            var transactionWrappers = this.transactionWrappers\n                            for (var i = startIndex; i < transactionWrappers.length; i++) {\n                                var wrapper = transactionWrappers[i]\n                                var initData = this.wrapperInitData[i]\n                                var errorThrown\n                                try {\n                                    // Catching errors makes debugging more difficult, so we start with\n                                    // errorThrown set to true before setting it to false after calling\n                                    // close -- if it's still set to true in the finally block, it means\n                                    // wrapper.close threw.\n                                    errorThrown = true\n                                    if (initData !== Transaction.OBSERVED_ERROR && wrapper.close) {\n                                        wrapper.close.call(this, initData)\n                                    }\n                                    errorThrown = false\n                                } finally {\n                                    if (errorThrown) {\n                                        // The closer for wrapper i threw an error; close the remaining\n                                        // wrappers but silence any exceptions from them to ensure that the\n                                        // first error is the one to bubble up.\n                                        try {\n                                            this.closeAll(i + 1)\n                                        } catch (e) {}\n                                    }\n                                }\n                            }\n                            this.wrapperInitData.length = 0\n                        }\n                    }\n\n                    var Transaction = {\n                        Mixin: Mixin,\n\n                        /**\n                         * Token to look for to determine if an error occurred.\n                         */\n                        OBSERVED_ERROR: {}\n                    }\n\n                    module.exports = Transaction\n                },\n                { \"150\": 150 }\n            ],\n            117: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule ViewportMetrics\n                     */\n\n                    \"use strict\"\n\n                    var ViewportMetrics = {\n                        currentScrollLeft: 0,\n\n                        currentScrollTop: 0,\n\n                        refreshScrollValues: function(scrollPosition) {\n                            ViewportMetrics.currentScrollLeft = scrollPosition.x\n                            ViewportMetrics.currentScrollTop = scrollPosition.y\n                        }\n                    }\n\n                    module.exports = ViewportMetrics\n                },\n                {}\n            ],\n            118: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2014-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule accumulateInto\n                     */\n\n                    \"use strict\"\n\n                    var invariant = _dereq_(150)\n\n                    /**\n                     *\n                     * Accumulates items that must not be null or undefined into the first one. This\n                     * is used to conserve memory by avoiding array allocations, and thus sacrifices\n                     * API cleanness. Since `current` can be null before being passed in and not\n                     * null after this function, make sure to assign it back to `current`:\n                     *\n                     * `a = accumulateInto(a, b);`\n                     *\n                     * This API should be sparingly used. Try `accumulate` for something cleaner.\n                     *\n                     * @return {*|array<*>} An accumulation of items.\n                     */\n\n                    function accumulateInto(current, next) {\n                        \"production\" !== \"development\"\n                            ? invariant(\n                                  next != null,\n                                  \"accumulateInto(...): Accumulated items must not be null or undefined.\"\n                              )\n                            : invariant(next != null)\n                        if (current == null) {\n                            return next\n                        }\n\n                        // Both are not empty. Warning: Never call x.concat(y) when you are not\n                        // certain that x is an Array (x could be a string with concat method).\n                        var currentIsArray = Array.isArray(current)\n                        var nextIsArray = Array.isArray(next)\n\n                        if (currentIsArray && nextIsArray) {\n                            current.push.apply(current, next)\n                            return current\n                        }\n\n                        if (currentIsArray) {\n                            current.push(next)\n                            return current\n                        }\n\n                        if (nextIsArray) {\n                            // A bit too dangerous to mutate `next`.\n                            return [current].concat(next)\n                        }\n\n                        return [current, next]\n                    }\n\n                    module.exports = accumulateInto\n                },\n                { \"150\": 150 }\n            ],\n            119: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule adler32\n                     */\n\n                    /* jslint bitwise:true */\n\n                    \"use strict\"\n\n                    var MOD = 65521\n\n                    // This is a clean-room implementation of adler32 designed for detecting\n                    // if markup is not what we expect it to be. It does not need to be\n                    // cryptographically strong, only reasonably good at detecting if markup\n                    // generated on the server is different than that on the client.\n                    function adler32(data) {\n                        var a = 1\n                        var b = 0\n                        for (var i = 0; i < data.length; i++) {\n                            a = (a + data.charCodeAt(i)) % MOD\n                            b = (b + a) % MOD\n                        }\n                        return a | (b << 16)\n                    }\n\n                    module.exports = adler32\n                },\n                {}\n            ],\n            120: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule camelize\n                     * @typechecks\n                     */\n\n                    var _hyphenPattern = /-(.)/g\n\n                    /**\n                     * Camelcases a hyphenated string, for example:\n                     *\n                     *   > camelize('background-color')\n                     *   < \"backgroundColor\"\n                     *\n                     * @param {string} string\n                     * @return {string}\n                     */\n                    function camelize(string) {\n                        return string.replace(_hyphenPattern, function(_, character) {\n                            return character.toUpperCase()\n                        })\n                    }\n\n                    module.exports = camelize\n                },\n                {}\n            ],\n            121: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2014-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule camelizeStyleName\n                     * @typechecks\n                     */\n\n                    \"use strict\"\n\n                    var camelize = _dereq_(120)\n\n                    var msPattern = /^-ms-/\n\n                    /**\n                     * Camelcases a hyphenated CSS property name, for example:\n                     *\n                     *   > camelizeStyleName('background-color')\n                     *   < \"backgroundColor\"\n                     *   > camelizeStyleName('-moz-transition')\n                     *   < \"MozTransition\"\n                     *   > camelizeStyleName('-ms-transition')\n                     *   < \"msTransition\"\n                     *\n                     * As Andi Smith suggests\n                     * (http://www.andismith.com/blog/2012/02/modernizr-prefixed/), an `-ms` prefix\n                     * is converted to lowercase `ms`.\n                     *\n                     * @param {string} string\n                     * @return {string}\n                     */\n                    function camelizeStyleName(string) {\n                        return camelize(string.replace(msPattern, \"ms-\"))\n                    }\n\n                    module.exports = camelizeStyleName\n                },\n                { \"120\": 120 }\n            ],\n            122: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @typechecks static-only\n                     * @providesModule cloneWithProps\n                     */\n\n                    \"use strict\"\n\n                    var ReactElement = _dereq_(63)\n                    var ReactPropTransferer = _dereq_(83)\n\n                    var keyOf = _dereq_(157)\n                    var warning = _dereq_(171)\n\n                    var CHILDREN_PROP = keyOf({ children: null })\n\n                    /**\n                     * Sometimes you want to change the props of a child passed to you. Usually\n                     * this is to add a CSS class.\n                     *\n                     * @param {ReactElement} child child element you'd like to clone\n                     * @param {object} props props you'd like to modify. className and style will be\n                     * merged automatically.\n                     * @return {ReactElement} a clone of child with props merged in.\n                     */\n                    function cloneWithProps(child, props) {\n                        if (\"production\" !== \"development\") {\n                            \"production\" !== \"development\"\n                                ? warning(\n                                      !child.ref,\n                                      \"You are calling cloneWithProps() on a child with a ref. This is \" +\n                                          \"dangerous because you're creating a new child which will not be \" +\n                                          \"added as a ref to its parent.\"\n                                  )\n                                : null\n                        }\n\n                        var newProps = ReactPropTransferer.mergeProps(props, child.props)\n\n                        // Use `child.props.children` if it is provided.\n                        if (\n                            !newProps.hasOwnProperty(CHILDREN_PROP) &&\n                            child.props.hasOwnProperty(CHILDREN_PROP)\n                        ) {\n                            newProps.children = child.props.children\n                        }\n\n                        // The current API doesn't retain _owner and _context, which is why this\n                        // doesn't use ReactElement.cloneAndReplaceProps.\n                        return ReactElement.createElement(child.type, newProps)\n                    }\n\n                    module.exports = cloneWithProps\n                },\n                { \"157\": 157, \"171\": 171, \"63\": 63, \"83\": 83 }\n            ],\n            123: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule containsNode\n                     * @typechecks\n                     */\n\n                    var isTextNode = _dereq_(154)\n\n                    /*jslint bitwise:true */\n\n                    /**\n                     * Checks if a given DOM node contains or is another DOM node.\n                     *\n                     * @param {?DOMNode} outerNode Outer DOM node.\n                     * @param {?DOMNode} innerNode Inner DOM node.\n                     * @return {boolean} True if `outerNode` contains or is `innerNode`.\n                     */\n                    function containsNode(outerNode, innerNode) {\n                        if (!outerNode || !innerNode) {\n                            return false\n                        } else if (outerNode === innerNode) {\n                            return true\n                        } else if (isTextNode(outerNode)) {\n                            return false\n                        } else if (isTextNode(innerNode)) {\n                            return containsNode(outerNode, innerNode.parentNode)\n                        } else if (outerNode.contains) {\n                            return outerNode.contains(innerNode)\n                        } else if (outerNode.compareDocumentPosition) {\n                            return !!(outerNode.compareDocumentPosition(innerNode) & 16)\n                        } else {\n                            return false\n                        }\n                    }\n\n                    module.exports = containsNode\n                },\n                { \"154\": 154 }\n            ],\n            124: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule createArrayFromMixed\n                     * @typechecks\n                     */\n\n                    var toArray = _dereq_(168)\n\n                    /**\n                     * Perform a heuristic test to determine if an object is \"array-like\".\n                     *\n                     *   A monk asked Joshu, a Zen master, \"Has a dog Buddha nature?\"\n                     *   Joshu replied: \"Mu.\"\n                     *\n                     * This function determines if its argument has \"array nature\": it returns\n                     * true if the argument is an actual array, an `arguments' object, or an\n                     * HTMLCollection (e.g. node.childNodes or node.getElementsByTagName()).\n                     *\n                     * It will return false for other array-like objects like Filelist.\n                     *\n                     * @param {*} obj\n                     * @return {boolean}\n                     */\n                    function hasArrayNature(obj) {\n                        return (\n                            // not null/false\n                            !!obj &&\n                            // arrays are objects, NodeLists are functions in Safari\n                            (typeof obj == \"object\" || typeof obj == \"function\") &&\n                            // quacks like an array\n                            \"length\" in obj &&\n                            // not window\n                            !(\"setInterval\" in obj) &&\n                            // no DOM node should be considered an array-like\n                            // a 'select' element has 'length' and 'item' properties on IE8\n                            typeof obj.nodeType != \"number\" && // HTMLCollection/NodeList\n                            // a real array\n                            (Array.isArray(obj) ||\n                                // arguments\n                                \"callee\" in obj ||\n                                \"item\" in obj)\n                        )\n                    }\n\n                    /**\n                     * Ensure that the argument is an array by wrapping it in an array if it is not.\n                     * Creates a copy of the argument if it is already an array.\n                     *\n                     * This is mostly useful idiomatically:\n                     *\n                     *   var createArrayFromMixed = require('createArrayFromMixed');\n                     *\n                     *   function takesOneOrMoreThings(things) {\n                     *     things = createArrayFromMixed(things);\n                     *     ...\n                     *   }\n                     *\n                     * This allows you to treat `things' as an array, but accept scalars in the API.\n                     *\n                     * If you need to convert an array-like object, like `arguments`, into an array\n                     * use toArray instead.\n                     *\n                     * @param {*} obj\n                     * @return {array}\n                     */\n                    function createArrayFromMixed(obj) {\n                        if (!hasArrayNature(obj)) {\n                            return [obj]\n                        } else if (Array.isArray(obj)) {\n                            return obj.slice()\n                        } else {\n                            return toArray(obj)\n                        }\n                    }\n\n                    module.exports = createArrayFromMixed\n                },\n                { \"168\": 168 }\n            ],\n            125: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule createFullPageComponent\n                     * @typechecks\n                     */\n\n                    \"use strict\"\n\n                    // Defeat circular references by requiring this directly.\n                    var ReactClass = _dereq_(38)\n                    var ReactElement = _dereq_(63)\n\n                    var invariant = _dereq_(150)\n\n                    /**\n                     * Create a component that will throw an exception when unmounted.\n                     *\n                     * Components like <html> <head> and <body> can't be removed or added\n                     * easily in a cross-browser way, however it's valuable to be able to\n                     * take advantage of React's reconciliation for styling and <title>\n                     * management. So we just document it and throw in dangerous cases.\n                     *\n                     * @param {string} tag The tag to wrap\n                     * @return {function} convenience constructor of new component\n                     */\n                    function createFullPageComponent(tag) {\n                        var elementFactory = ReactElement.createFactory(tag)\n\n                        var FullPageComponent = ReactClass.createClass({\n                            tagName: tag.toUpperCase(),\n                            displayName: \"ReactFullPageComponent\" + tag,\n\n                            componentWillUnmount: function() {\n                                \"production\" !== \"development\"\n                                    ? invariant(\n                                          false,\n                                          \"%s tried to unmount. Because of cross-browser quirks it is \" +\n                                              \"impossible to unmount some top-level components (eg <html>, <head>, \" +\n                                              \"and <body>) reliably and efficiently. To fix this, have a single \" +\n                                              \"top-level component that never unmounts render these elements.\",\n                                          this.constructor.displayName\n                                      )\n                                    : invariant(false)\n                            },\n\n                            render: function() {\n                                return elementFactory(this.props)\n                            }\n                        })\n\n                        return FullPageComponent\n                    }\n\n                    module.exports = createFullPageComponent\n                },\n                { \"150\": 150, \"38\": 38, \"63\": 63 }\n            ],\n            126: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule createNodesFromMarkup\n                     * @typechecks\n                     */\n\n                    /*jslint evil: true, sub: true */\n\n                    var ExecutionEnvironment = _dereq_(22)\n\n                    var createArrayFromMixed = _dereq_(124)\n                    var getMarkupWrap = _dereq_(142)\n                    var invariant = _dereq_(150)\n\n                    /**\n                     * Dummy container used to render all markup.\n                     */\n                    var dummyNode = ExecutionEnvironment.canUseDOM\n                        ? document.createElement(\"div\")\n                        : null\n\n                    /**\n                     * Pattern used by `getNodeName`.\n                     */\n                    var nodeNamePattern = /^\\s*<(\\w+)/\n\n                    /**\n                     * Extracts the `nodeName` of the first element in a string of markup.\n                     *\n                     * @param {string} markup String of markup.\n                     * @return {?string} Node name of the supplied markup.\n                     */\n                    function getNodeName(markup) {\n                        var nodeNameMatch = markup.match(nodeNamePattern)\n                        return nodeNameMatch && nodeNameMatch[1].toLowerCase()\n                    }\n\n                    /**\n                     * Creates an array containing the nodes rendered from the supplied markup. The\n                     * optionally supplied `handleScript` function will be invoked once for each\n                     * <script> element that is rendered. If no `handleScript` function is supplied,\n                     * an exception is thrown if any <script> elements are rendered.\n                     *\n                     * @param {string} markup A string of valid HTML markup.\n                     * @param {?function} handleScript Invoked once for each rendered <script>.\n                     * @return {array<DOMElement|DOMTextNode>} An array of rendered nodes.\n                     */\n                    function createNodesFromMarkup(markup, handleScript) {\n                        var node = dummyNode\n                        \"production\" !== \"development\"\n                            ? invariant(!!dummyNode, \"createNodesFromMarkup dummy not initialized\")\n                            : invariant(!!dummyNode)\n                        var nodeName = getNodeName(markup)\n\n                        var wrap = nodeName && getMarkupWrap(nodeName)\n                        if (wrap) {\n                            node.innerHTML = wrap[1] + markup + wrap[2]\n\n                            var wrapDepth = wrap[0]\n                            while (wrapDepth--) {\n                                node = node.lastChild\n                            }\n                        } else {\n                            node.innerHTML = markup\n                        }\n\n                        var scripts = node.getElementsByTagName(\"script\")\n                        if (scripts.length) {\n                            \"production\" !== \"development\"\n                                ? invariant(\n                                      handleScript,\n                                      \"createNodesFromMarkup(...): Unexpected <script> element rendered.\"\n                                  )\n                                : invariant(handleScript)\n                            createArrayFromMixed(scripts).forEach(handleScript)\n                        }\n\n                        var nodes = createArrayFromMixed(node.childNodes)\n                        while (node.lastChild) {\n                            node.removeChild(node.lastChild)\n                        }\n                        return nodes\n                    }\n\n                    module.exports = createNodesFromMarkup\n                },\n                { \"124\": 124, \"142\": 142, \"150\": 150, \"22\": 22 }\n            ],\n            127: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule cx\n                     */\n\n                    /**\n                     * This function is used to mark string literals representing CSS class names\n                     * so that they can be transformed statically. This allows for modularization\n                     * and minification of CSS class names.\n                     *\n                     * In static_upstream, this function is actually implemented, but it should\n                     * eventually be replaced with something more descriptive, and the transform\n                     * that is used in the main stack should be ported for use elsewhere.\n                     *\n                     * @param string|object className to modularize, or an object of key/values.\n                     *                      In the object case, the values are conditions that\n                     *                      determine if the className keys should be included.\n                     * @param [string ...]  Variable list of classNames in the string case.\n                     * @return string       Renderable space-separated CSS className.\n                     */\n\n                    \"use strict\"\n                    var warning = _dereq_(171)\n\n                    var warned = false\n\n                    function cx(classNames) {\n                        if (\"production\" !== \"development\") {\n                            \"production\" !== \"development\"\n                                ? warning(\n                                      warned,\n                                      \"React.addons.classSet will be deprecated in a future version. See \" +\n                                          \"http://fb.me/react-addons-classset\"\n                                  )\n                                : null\n                            warned = true\n                        }\n\n                        if (typeof classNames == \"object\") {\n                            return Object.keys(classNames)\n                                .filter(function(className) {\n                                    return classNames[className]\n                                })\n                                .join(\" \")\n                        } else {\n                            return Array.prototype.join.call(arguments, \" \")\n                        }\n                    }\n\n                    module.exports = cx\n                },\n                { \"171\": 171 }\n            ],\n            128: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule dangerousStyleValue\n                     * @typechecks static-only\n                     */\n\n                    \"use strict\"\n\n                    var CSSProperty = _dereq_(5)\n\n                    var isUnitlessNumber = CSSProperty.isUnitlessNumber\n\n                    /**\n                     * Convert a value into the proper css writable value. The style name `name`\n                     * should be logical (no hyphens), as specified\n                     * in `CSSProperty.isUnitlessNumber`.\n                     *\n                     * @param {string} name CSS property name such as `topMargin`.\n                     * @param {*} value CSS property value such as `10px`.\n                     * @return {string} Normalized style value with dimensions applied.\n                     */\n                    function dangerousStyleValue(name, value) {\n                        // Note that we've removed escapeTextForBrowser() calls here since the\n                        // whole string will be escaped when the attribute is injected into\n                        // the markup. If you provide unsafe user data here they can inject\n                        // arbitrary CSS which may be problematic (I couldn't repro this):\n                        // https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet\n                        // http://www.thespanner.co.uk/2007/11/26/ultimate-xss-css-injection/\n                        // This is not an XSS hole but instead a potential CSS injection issue\n                        // which has lead to a greater discussion about how we're going to\n                        // trust URLs moving forward. See #2115901\n\n                        var isEmpty = value == null || typeof value === \"boolean\" || value === \"\"\n                        if (isEmpty) {\n                            return \"\"\n                        }\n\n                        var isNonNumeric = isNaN(value)\n                        if (\n                            isNonNumeric ||\n                            value === 0 ||\n                            (isUnitlessNumber.hasOwnProperty(name) && isUnitlessNumber[name])\n                        ) {\n                            return \"\" + value // cast to string\n                        }\n\n                        if (typeof value === \"string\") {\n                            value = value.trim()\n                        }\n                        return value + \"px\"\n                    }\n\n                    module.exports = dangerousStyleValue\n                },\n                { \"5\": 5 }\n            ],\n            129: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule emptyFunction\n                     */\n\n                    function makeEmptyFunction(arg) {\n                        return function() {\n                            return arg\n                        }\n                    }\n\n                    /**\n                     * This function accepts and discards inputs; it has no side effects. This is\n                     * primarily useful idiomatically for overridable function endpoints which\n                     * always need to be callable, since JS lacks a null-call idiom ala Cocoa.\n                     */\n                    function emptyFunction() {}\n\n                    emptyFunction.thatReturns = makeEmptyFunction\n                    emptyFunction.thatReturnsFalse = makeEmptyFunction(false)\n                    emptyFunction.thatReturnsTrue = makeEmptyFunction(true)\n                    emptyFunction.thatReturnsNull = makeEmptyFunction(null)\n                    emptyFunction.thatReturnsThis = function() {\n                        return this\n                    }\n                    emptyFunction.thatReturnsArgument = function(arg) {\n                        return arg\n                    }\n\n                    module.exports = emptyFunction\n                },\n                {}\n            ],\n            130: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule emptyObject\n                     */\n\n                    \"use strict\"\n\n                    var emptyObject = {}\n\n                    if (\"production\" !== \"development\") {\n                        Object.freeze(emptyObject)\n                    }\n\n                    module.exports = emptyObject\n                },\n                {}\n            ],\n            131: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule escapeTextContentForBrowser\n                     */\n\n                    \"use strict\"\n\n                    var ESCAPE_LOOKUP = {\n                        \"&\": \"&amp;\",\n                        \">\": \"&gt;\",\n                        \"<\": \"&lt;\",\n                        '\"': \"&quot;\",\n                        \"'\": \"&#x27;\"\n                    }\n\n                    var ESCAPE_REGEX = /[&><\"']/g\n\n                    function escaper(match) {\n                        return ESCAPE_LOOKUP[match]\n                    }\n\n                    /**\n                     * Escapes text to prevent scripting attacks.\n                     *\n                     * @param {*} text Text value to escape.\n                     * @return {string} An escaped string.\n                     */\n                    function escapeTextContentForBrowser(text) {\n                        return (\"\" + text).replace(ESCAPE_REGEX, escaper)\n                    }\n\n                    module.exports = escapeTextContentForBrowser\n                },\n                {}\n            ],\n            132: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule findDOMNode\n                     * @typechecks static-only\n                     */\n\n                    \"use strict\"\n\n                    var ReactCurrentOwner = _dereq_(45)\n                    var ReactInstanceMap = _dereq_(73)\n                    var ReactMount = _dereq_(77)\n\n                    var invariant = _dereq_(150)\n                    var isNode = _dereq_(152)\n                    var warning = _dereq_(171)\n\n                    /**\n                     * Returns the DOM node rendered by this element.\n                     *\n                     * @param {ReactComponent|DOMElement} componentOrElement\n                     * @return {DOMElement} The root node of this element.\n                     */\n                    function findDOMNode(componentOrElement) {\n                        if (\"production\" !== \"development\") {\n                            var owner = ReactCurrentOwner.current\n                            if (owner !== null) {\n                                \"production\" !== \"development\"\n                                    ? warning(\n                                          owner._warnedAboutRefsInRender,\n                                          \"%s is accessing getDOMNode or findDOMNode inside its render(). \" +\n                                              \"render() should be a pure function of props and state. It should \" +\n                                              \"never access something that requires stale data from the previous \" +\n                                              \"render, such as refs. Move this logic to componentDidMount and \" +\n                                              \"componentDidUpdate instead.\",\n                                          owner.getName() || \"A component\"\n                                      )\n                                    : null\n                                owner._warnedAboutRefsInRender = true\n                            }\n                        }\n                        if (componentOrElement == null) {\n                            return null\n                        }\n                        if (isNode(componentOrElement)) {\n                            return componentOrElement\n                        }\n                        if (ReactInstanceMap.has(componentOrElement)) {\n                            return ReactMount.getNodeFromInstance(componentOrElement)\n                        }\n                        \"production\" !== \"development\"\n                            ? invariant(\n                                  componentOrElement.render == null ||\n                                      typeof componentOrElement.render !== \"function\",\n                                  \"Component (with keys: %s) contains `render` method \" +\n                                      \"but is not mounted in the DOM\",\n                                  Object.keys(componentOrElement)\n                              )\n                            : invariant(\n                                  componentOrElement.render == null ||\n                                      typeof componentOrElement.render !== \"function\"\n                              )\n                        \"production\" !== \"development\"\n                            ? invariant(\n                                  false,\n                                  \"Element appears to be neither ReactComponent nor DOMNode (keys: %s)\",\n                                  Object.keys(componentOrElement)\n                              )\n                            : invariant(false)\n                    }\n\n                    module.exports = findDOMNode\n                },\n                { \"150\": 150, \"152\": 152, \"171\": 171, \"45\": 45, \"73\": 73, \"77\": 77 }\n            ],\n            133: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule flattenChildren\n                     */\n\n                    \"use strict\"\n\n                    var traverseAllChildren = _dereq_(169)\n                    var warning = _dereq_(171)\n\n                    /**\n                     * @param {function} traverseContext Context passed through traversal.\n                     * @param {?ReactComponent} child React child component.\n                     * @param {!string} name String name of key path to child.\n                     */\n                    function flattenSingleChildIntoContext(traverseContext, child, name) {\n                        // We found a component instance.\n                        var result = traverseContext\n                        var keyUnique = !result.hasOwnProperty(name)\n                        if (\"production\" !== \"development\") {\n                            \"production\" !== \"development\"\n                                ? warning(\n                                      keyUnique,\n                                      \"flattenChildren(...): Encountered two children with the same key, \" +\n                                          \"`%s`. Child keys must be unique; when two children share a key, only \" +\n                                          \"the first child will be used.\",\n                                      name\n                                  )\n                                : null\n                        }\n                        if (keyUnique && child != null) {\n                            result[name] = child\n                        }\n                    }\n\n                    /**\n                     * Flattens children that are typically specified as `props.children`. Any null\n                     * children will not be included in the resulting object.\n                     * @return {!object} flattened children keyed by name.\n                     */\n                    function flattenChildren(children) {\n                        if (children == null) {\n                            return children\n                        }\n                        var result = {}\n                        traverseAllChildren(children, flattenSingleChildIntoContext, result)\n                        return result\n                    }\n\n                    module.exports = flattenChildren\n                },\n                { \"169\": 169, \"171\": 171 }\n            ],\n            134: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2014-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule focusNode\n                     */\n\n                    \"use strict\"\n\n                    /**\n                     * @param {DOMElement} node input/textarea to focus\n                     */\n                    function focusNode(node) {\n                        // IE8 can throw \"Can't move focus to the control because it is invisible,\n                        // not enabled, or of a type that does not accept the focus.\" for all kinds of\n                        // reasons that are too expensive and fragile to test.\n                        try {\n                            node.focus()\n                        } catch (e) {}\n                    }\n\n                    module.exports = focusNode\n                },\n                {}\n            ],\n            135: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule forEachAccumulated\n                     */\n\n                    \"use strict\"\n\n                    /**\n                     * @param {array} an \"accumulation\" of items which is either an Array or\n                     * a single item. Useful when paired with the `accumulate` module. This is a\n                     * simple utility that allows us to reason about a collection of items, but\n                     * handling the case when there is exactly one item (and we do not need to\n                     * allocate an array).\n                     */\n                    var forEachAccumulated = function(arr, cb, scope) {\n                        if (Array.isArray(arr)) {\n                            arr.forEach(cb, scope)\n                        } else if (arr) {\n                            cb.call(scope, arr)\n                        }\n                    }\n\n                    module.exports = forEachAccumulated\n                },\n                {}\n            ],\n            136: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule getActiveElement\n                     * @typechecks\n                     */\n\n                    /**\n                     * Same as document.activeElement but wraps in a try-catch block. In IE it is\n                     * not safe to call document.activeElement if there is nothing focused.\n                     *\n                     * The activeElement will be null only if the document body is not yet defined.\n                     */\n                    function getActiveElement() /*?DOMElement*/ {\n                        try {\n                            return document.activeElement || document.body\n                        } catch (e) {\n                            return document.body\n                        }\n                    }\n\n                    module.exports = getActiveElement\n                },\n                {}\n            ],\n            137: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule getEventCharCode\n                     * @typechecks static-only\n                     */\n\n                    \"use strict\"\n\n                    /**\n                     * `charCode` represents the actual \"character code\" and is safe to use with\n                     * `String.fromCharCode`. As such, only keys that correspond to printable\n                     * characters produce a valid `charCode`, the only exception to this is Enter.\n                     * The Tab-key is considered non-printable and does not have a `charCode`,\n                     * presumably because it does not produce a tab-character in browsers.\n                     *\n                     * @param {object} nativeEvent Native browser event.\n                     * @return {string} Normalized `charCode` property.\n                     */\n                    function getEventCharCode(nativeEvent) {\n                        var charCode\n                        var keyCode = nativeEvent.keyCode\n\n                        if (\"charCode\" in nativeEvent) {\n                            charCode = nativeEvent.charCode\n\n                            // FF does not set `charCode` for the Enter-key, check against `keyCode`.\n                            if (charCode === 0 && keyCode === 13) {\n                                charCode = 13\n                            }\n                        } else {\n                            // IE8 does not implement `charCode`, but `keyCode` has the correct value.\n                            charCode = keyCode\n                        }\n\n                        // Some non-printable keys are reported in `charCode`/`keyCode`, discard them.\n                        // Must not discard the (non-)printable Enter-key.\n                        if (charCode >= 32 || charCode === 13) {\n                            return charCode\n                        }\n\n                        return 0\n                    }\n\n                    module.exports = getEventCharCode\n                },\n                {}\n            ],\n            138: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule getEventKey\n                     * @typechecks static-only\n                     */\n\n                    \"use strict\"\n\n                    var getEventCharCode = _dereq_(137)\n\n                    /**\n                     * Normalization of deprecated HTML5 `key` values\n                     * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names\n                     */\n                    var normalizeKey = {\n                        Esc: \"Escape\",\n                        Spacebar: \" \",\n                        Left: \"ArrowLeft\",\n                        Up: \"ArrowUp\",\n                        Right: \"ArrowRight\",\n                        Down: \"ArrowDown\",\n                        Del: \"Delete\",\n                        Win: \"OS\",\n                        Menu: \"ContextMenu\",\n                        Apps: \"ContextMenu\",\n                        Scroll: \"ScrollLock\",\n                        MozPrintableKey: \"Unidentified\"\n                    }\n\n                    /**\n                     * Translation from legacy `keyCode` to HTML5 `key`\n                     * Only special keys supported, all others depend on keyboard layout or browser\n                     * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names\n                     */\n                    var translateToKey = {\n                        8: \"Backspace\",\n                        9: \"Tab\",\n                        12: \"Clear\",\n                        13: \"Enter\",\n                        16: \"Shift\",\n                        17: \"Control\",\n                        18: \"Alt\",\n                        19: \"Pause\",\n                        20: \"CapsLock\",\n                        27: \"Escape\",\n                        32: \" \",\n                        33: \"PageUp\",\n                        34: \"PageDown\",\n                        35: \"End\",\n                        36: \"Home\",\n                        37: \"ArrowLeft\",\n                        38: \"ArrowUp\",\n                        39: \"ArrowRight\",\n                        40: \"ArrowDown\",\n                        45: \"Insert\",\n                        46: \"Delete\",\n                        112: \"F1\",\n                        113: \"F2\",\n                        114: \"F3\",\n                        115: \"F4\",\n                        116: \"F5\",\n                        117: \"F6\",\n                        118: \"F7\",\n                        119: \"F8\",\n                        120: \"F9\",\n                        121: \"F10\",\n                        122: \"F11\",\n                        123: \"F12\",\n                        144: \"NumLock\",\n                        145: \"ScrollLock\",\n                        224: \"Meta\"\n                    }\n\n                    /**\n                     * @param {object} nativeEvent Native browser event.\n                     * @return {string} Normalized `key` property.\n                     */\n                    function getEventKey(nativeEvent) {\n                        if (nativeEvent.key) {\n                            // Normalize inconsistent values reported by browsers due to\n                            // implementations of a working draft specification.\n\n                            // FireFox implements `key` but returns `MozPrintableKey` for all\n                            // printable characters (normalized to `Unidentified`), ignore it.\n                            var key = normalizeKey[nativeEvent.key] || nativeEvent.key\n                            if (key !== \"Unidentified\") {\n                                return key\n                            }\n                        }\n\n                        // Browser does not implement `key`, polyfill as much of it as we can.\n                        if (nativeEvent.type === \"keypress\") {\n                            var charCode = getEventCharCode(nativeEvent)\n\n                            // The enter-key is technically both printable and non-printable and can\n                            // thus be captured by `keypress`, no other non-printable key should.\n                            return charCode === 13 ? \"Enter\" : String.fromCharCode(charCode)\n                        }\n                        if (nativeEvent.type === \"keydown\" || nativeEvent.type === \"keyup\") {\n                            // While user keyboard layout determines the actual meaning of each\n                            // `keyCode` value, almost all function keys have a universal value.\n                            return translateToKey[nativeEvent.keyCode] || \"Unidentified\"\n                        }\n                        return \"\"\n                    }\n\n                    module.exports = getEventKey\n                },\n                { \"137\": 137 }\n            ],\n            139: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule getEventModifierState\n                     * @typechecks static-only\n                     */\n\n                    \"use strict\"\n\n                    /**\n                     * Translation from modifier key to the associated property in the event.\n                     * @see http://www.w3.org/TR/DOM-Level-3-Events/#keys-Modifiers\n                     */\n\n                    var modifierKeyToProp = {\n                        Alt: \"altKey\",\n                        Control: \"ctrlKey\",\n                        Meta: \"metaKey\",\n                        Shift: \"shiftKey\"\n                    }\n\n                    // IE8 does not implement getModifierState so we simply map it to the only\n                    // modifier keys exposed by the event itself, does not support Lock-keys.\n                    // Currently, all major browsers except Chrome seems to support Lock-keys.\n                    function modifierStateGetter(keyArg) {\n                        /*jshint validthis:true */\n                        var syntheticEvent = this\n                        var nativeEvent = syntheticEvent.nativeEvent\n                        if (nativeEvent.getModifierState) {\n                            return nativeEvent.getModifierState(keyArg)\n                        }\n                        var keyProp = modifierKeyToProp[keyArg]\n                        return keyProp ? !!nativeEvent[keyProp] : false\n                    }\n\n                    function getEventModifierState(nativeEvent) {\n                        return modifierStateGetter\n                    }\n\n                    module.exports = getEventModifierState\n                },\n                {}\n            ],\n            140: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule getEventTarget\n                     * @typechecks static-only\n                     */\n\n                    \"use strict\"\n\n                    /**\n                     * Gets the target node from a native browser event by accounting for\n                     * inconsistencies in browser DOM APIs.\n                     *\n                     * @param {object} nativeEvent Native browser event.\n                     * @return {DOMEventTarget} Target node.\n                     */\n                    function getEventTarget(nativeEvent) {\n                        var target = nativeEvent.target || nativeEvent.srcElement || window\n                        // Safari may fire events on text nodes (Node.TEXT_NODE is 3).\n                        // @see http://www.quirksmode.org/js/events_properties.html\n                        return target.nodeType === 3 ? target.parentNode : target\n                    }\n\n                    module.exports = getEventTarget\n                },\n                {}\n            ],\n            141: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule getIteratorFn\n                     * @typechecks static-only\n                     */\n\n                    \"use strict\"\n\n                    /* global Symbol */\n                    var ITERATOR_SYMBOL = typeof Symbol === \"function\" && Symbol.iterator\n                    var FAUX_ITERATOR_SYMBOL = \"@@iterator\" // Before Symbol spec.\n\n                    /**\n                     * Returns the iterator method function contained on the iterable object.\n                     *\n                     * Be sure to invoke the function with the iterable as context:\n                     *\n                     *     var iteratorFn = getIteratorFn(myIterable);\n                     *     if (iteratorFn) {\n                     *       var iterator = iteratorFn.call(myIterable);\n                     *       ...\n                     *     }\n                     *\n                     * @param {?object} maybeIterable\n                     * @return {?function}\n                     */\n                    function getIteratorFn(maybeIterable) {\n                        var iteratorFn =\n                            maybeIterable &&\n                            ((ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL]) ||\n                                maybeIterable[FAUX_ITERATOR_SYMBOL])\n                        if (typeof iteratorFn === \"function\") {\n                            return iteratorFn\n                        }\n                    }\n\n                    module.exports = getIteratorFn\n                },\n                {}\n            ],\n            142: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule getMarkupWrap\n                     */\n\n                    var ExecutionEnvironment = _dereq_(22)\n\n                    var invariant = _dereq_(150)\n\n                    /**\n                     * Dummy container used to detect which wraps are necessary.\n                     */\n                    var dummyNode = ExecutionEnvironment.canUseDOM\n                        ? document.createElement(\"div\")\n                        : null\n\n                    /**\n                     * Some browsers cannot use `innerHTML` to render certain elements standalone,\n                     * so we wrap them, render the wrapped nodes, then extract the desired node.\n                     *\n                     * In IE8, certain elements cannot render alone, so wrap all elements ('*').\n                     */\n                    var shouldWrap = {\n                        // Force wrapping for SVG elements because if they get created inside a <div>,\n                        // they will be initialized in the wrong namespace (and will not display).\n                        circle: true,\n                        clipPath: true,\n                        defs: true,\n                        ellipse: true,\n                        g: true,\n                        line: true,\n                        linearGradient: true,\n                        path: true,\n                        polygon: true,\n                        polyline: true,\n                        radialGradient: true,\n                        rect: true,\n                        stop: true,\n                        text: true\n                    }\n\n                    var selectWrap = [1, '<select multiple=\"true\">', \"</select>\"]\n                    var tableWrap = [1, \"<table>\", \"</table>\"]\n                    var trWrap = [3, \"<table><tbody><tr>\", \"</tr></tbody></table>\"]\n\n                    var svgWrap = [1, \"<svg>\", \"</svg>\"]\n\n                    var markupWrap = {\n                        \"*\": [1, \"?<div>\", \"</div>\"],\n\n                        area: [1, \"<map>\", \"</map>\"],\n                        col: [2, \"<table><tbody></tbody><colgroup>\", \"</colgroup></table>\"],\n                        legend: [1, \"<fieldset>\", \"</fieldset>\"],\n                        param: [1, \"<object>\", \"</object>\"],\n                        tr: [2, \"<table><tbody>\", \"</tbody></table>\"],\n\n                        optgroup: selectWrap,\n                        option: selectWrap,\n\n                        caption: tableWrap,\n                        colgroup: tableWrap,\n                        tbody: tableWrap,\n                        tfoot: tableWrap,\n                        thead: tableWrap,\n\n                        td: trWrap,\n                        th: trWrap,\n\n                        circle: svgWrap,\n                        clipPath: svgWrap,\n                        defs: svgWrap,\n                        ellipse: svgWrap,\n                        g: svgWrap,\n                        line: svgWrap,\n                        linearGradient: svgWrap,\n                        path: svgWrap,\n                        polygon: svgWrap,\n                        polyline: svgWrap,\n                        radialGradient: svgWrap,\n                        rect: svgWrap,\n                        stop: svgWrap,\n                        text: svgWrap\n                    }\n\n                    /**\n                     * Gets the markup wrap configuration for the supplied `nodeName`.\n                     *\n                     * NOTE: This lazily detects which wraps are necessary for the current browser.\n                     *\n                     * @param {string} nodeName Lowercase `nodeName`.\n                     * @return {?array} Markup wrap configuration, if applicable.\n                     */\n                    function getMarkupWrap(nodeName) {\n                        \"production\" !== \"development\"\n                            ? invariant(!!dummyNode, \"Markup wrapping node not initialized\")\n                            : invariant(!!dummyNode)\n                        if (!markupWrap.hasOwnProperty(nodeName)) {\n                            nodeName = \"*\"\n                        }\n                        if (!shouldWrap.hasOwnProperty(nodeName)) {\n                            if (nodeName === \"*\") {\n                                dummyNode.innerHTML = \"<link />\"\n                            } else {\n                                dummyNode.innerHTML = \"<\" + nodeName + \"></\" + nodeName + \">\"\n                            }\n                            shouldWrap[nodeName] = !dummyNode.firstChild\n                        }\n                        return shouldWrap[nodeName] ? markupWrap[nodeName] : null\n                    }\n\n                    module.exports = getMarkupWrap\n                },\n                { \"150\": 150, \"22\": 22 }\n            ],\n            143: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule getNodeForCharacterOffset\n                     */\n\n                    \"use strict\"\n\n                    /**\n                     * Given any node return the first leaf node without children.\n                     *\n                     * @param {DOMElement|DOMTextNode} node\n                     * @return {DOMElement|DOMTextNode}\n                     */\n                    function getLeafNode(node) {\n                        while (node && node.firstChild) {\n                            node = node.firstChild\n                        }\n                        return node\n                    }\n\n                    /**\n                     * Get the next sibling within a container. This will walk up the\n                     * DOM if a node's siblings have been exhausted.\n                     *\n                     * @param {DOMElement|DOMTextNode} node\n                     * @return {?DOMElement|DOMTextNode}\n                     */\n                    function getSiblingNode(node) {\n                        while (node) {\n                            if (node.nextSibling) {\n                                return node.nextSibling\n                            }\n                            node = node.parentNode\n                        }\n                    }\n\n                    /**\n                     * Get object describing the nodes which contain characters at offset.\n                     *\n                     * @param {DOMElement|DOMTextNode} root\n                     * @param {number} offset\n                     * @return {?object}\n                     */\n                    function getNodeForCharacterOffset(root, offset) {\n                        var node = getLeafNode(root)\n                        var nodeStart = 0\n                        var nodeEnd = 0\n\n                        while (node) {\n                            if (node.nodeType === 3) {\n                                nodeEnd = nodeStart + node.textContent.length\n\n                                if (nodeStart <= offset && nodeEnd >= offset) {\n                                    return {\n                                        node: node,\n                                        offset: offset - nodeStart\n                                    }\n                                }\n\n                                nodeStart = nodeEnd\n                            }\n\n                            node = getLeafNode(getSiblingNode(node))\n                        }\n                    }\n\n                    module.exports = getNodeForCharacterOffset\n                },\n                {}\n            ],\n            144: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule getReactRootElementInContainer\n                     */\n\n                    \"use strict\"\n\n                    var DOC_NODE_TYPE = 9\n\n                    /**\n                     * @param {DOMElement|DOMDocument} container DOM element that may contain\n                     *                                           a React component\n                     * @return {?*} DOM element that may have the reactRoot ID, or null.\n                     */\n                    function getReactRootElementInContainer(container) {\n                        if (!container) {\n                            return null\n                        }\n\n                        if (container.nodeType === DOC_NODE_TYPE) {\n                            return container.documentElement\n                        } else {\n                            return container.firstChild\n                        }\n                    }\n\n                    module.exports = getReactRootElementInContainer\n                },\n                {}\n            ],\n            145: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule getTextContentAccessor\n                     */\n\n                    \"use strict\"\n\n                    var ExecutionEnvironment = _dereq_(22)\n\n                    var contentKey = null\n\n                    /**\n                     * Gets the key used to access text content on a DOM node.\n                     *\n                     * @return {?string} Key used to access text content.\n                     * @internal\n                     */\n                    function getTextContentAccessor() {\n                        if (!contentKey && ExecutionEnvironment.canUseDOM) {\n                            // Prefer textContent to innerText because many browsers support both but\n                            // SVG <text> elements don't support innerText even when <div> does.\n                            contentKey =\n                                \"textContent\" in document.documentElement\n                                    ? \"textContent\"\n                                    : \"innerText\"\n                        }\n                        return contentKey\n                    }\n\n                    module.exports = getTextContentAccessor\n                },\n                { \"22\": 22 }\n            ],\n            146: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule getUnboundedScrollPosition\n                     * @typechecks\n                     */\n\n                    \"use strict\"\n\n                    /**\n                     * Gets the scroll position of the supplied element or window.\n                     *\n                     * The return values are unbounded, unlike `getScrollPosition`. This means they\n                     * may be negative or exceed the element boundaries (which is possible using\n                     * inertial scrolling).\n                     *\n                     * @param {DOMWindow|DOMElement} scrollable\n                     * @return {object} Map with `x` and `y` keys.\n                     */\n                    function getUnboundedScrollPosition(scrollable) {\n                        if (scrollable === window) {\n                            return {\n                                x: window.pageXOffset || document.documentElement.scrollLeft,\n                                y: window.pageYOffset || document.documentElement.scrollTop\n                            }\n                        }\n                        return {\n                            x: scrollable.scrollLeft,\n                            y: scrollable.scrollTop\n                        }\n                    }\n\n                    module.exports = getUnboundedScrollPosition\n                },\n                {}\n            ],\n            147: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule hyphenate\n                     * @typechecks\n                     */\n\n                    var _uppercasePattern = /([A-Z])/g\n\n                    /**\n                     * Hyphenates a camelcased string, for example:\n                     *\n                     *   > hyphenate('backgroundColor')\n                     *   < \"background-color\"\n                     *\n                     * For CSS style names, use `hyphenateStyleName` instead which works properly\n                     * with all vendor prefixes, including `ms`.\n                     *\n                     * @param {string} string\n                     * @return {string}\n                     */\n                    function hyphenate(string) {\n                        return string.replace(_uppercasePattern, \"-$1\").toLowerCase()\n                    }\n\n                    module.exports = hyphenate\n                },\n                {}\n            ],\n            148: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule hyphenateStyleName\n                     * @typechecks\n                     */\n\n                    \"use strict\"\n\n                    var hyphenate = _dereq_(147)\n\n                    var msPattern = /^ms-/\n\n                    /**\n                     * Hyphenates a camelcased CSS property name, for example:\n                     *\n                     *   > hyphenateStyleName('backgroundColor')\n                     *   < \"background-color\"\n                     *   > hyphenateStyleName('MozTransition')\n                     *   < \"-moz-transition\"\n                     *   > hyphenateStyleName('msTransition')\n                     *   < \"-ms-transition\"\n                     *\n                     * As Modernizr suggests (http://modernizr.com/docs/#prefixed), an `ms` prefix\n                     * is converted to `-ms-`.\n                     *\n                     * @param {string} string\n                     * @return {string}\n                     */\n                    function hyphenateStyleName(string) {\n                        return hyphenate(string).replace(msPattern, \"-ms-\")\n                    }\n\n                    module.exports = hyphenateStyleName\n                },\n                { \"147\": 147 }\n            ],\n            149: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule instantiateReactComponent\n                     * @typechecks static-only\n                     */\n\n                    \"use strict\"\n\n                    var ReactCompositeComponent = _dereq_(43)\n                    var ReactEmptyComponent = _dereq_(65)\n                    var ReactNativeComponent = _dereq_(80)\n\n                    var assign = _dereq_(29)\n                    var invariant = _dereq_(150)\n                    var warning = _dereq_(171)\n\n                    // To avoid a cyclic dependency, we create the final class in this module\n                    var ReactCompositeComponentWrapper = function() {}\n                    assign(\n                        ReactCompositeComponentWrapper.prototype,\n                        ReactCompositeComponent.Mixin,\n                        {\n                            _instantiateReactComponent: instantiateReactComponent\n                        }\n                    )\n\n                    /**\n                     * Check if the type reference is a known internal type. I.e. not a user\n                     * provided composite type.\n                     *\n                     * @param {function} type\n                     * @return {boolean} Returns true if this is a valid internal type.\n                     */\n                    function isInternalComponentType(type) {\n                        return (\n                            typeof type === \"function\" &&\n                            typeof type.prototype !== \"undefined\" &&\n                            typeof type.prototype.mountComponent === \"function\" &&\n                            typeof type.prototype.receiveComponent === \"function\"\n                        )\n                    }\n\n                    /**\n                     * Given a ReactNode, create an instance that will actually be mounted.\n                     *\n                     * @param {ReactNode} node\n                     * @param {*} parentCompositeType The composite type that resolved this.\n                     * @return {object} A new instance of the element's constructor.\n                     * @protected\n                     */\n                    function instantiateReactComponent(node, parentCompositeType) {\n                        var instance\n\n                        if (node === null || node === false) {\n                            node = ReactEmptyComponent.emptyElement\n                        }\n\n                        if (typeof node === \"object\") {\n                            var element = node\n                            if (\"production\" !== \"development\") {\n                                \"production\" !== \"development\"\n                                    ? warning(\n                                          element &&\n                                              (typeof element.type === \"function\" ||\n                                                  typeof element.type === \"string\"),\n                                          \"Only functions or strings can be mounted as React components.\"\n                                      )\n                                    : null\n                            }\n\n                            // Special case string values\n                            if (\n                                parentCompositeType === element.type &&\n                                typeof element.type === \"string\"\n                            ) {\n                                // Avoid recursion if the wrapper renders itself.\n                                instance = ReactNativeComponent.createInternalComponent(element)\n                                // All native components are currently wrapped in a composite so we're\n                                // safe to assume that this is what we should instantiate.\n                            } else if (isInternalComponentType(element.type)) {\n                                // This is temporarily available for custom components that are not string\n                                // represenations. I.e. ART. Once those are updated to use the string\n                                // representation, we can drop this code path.\n                                instance = new element.type(element)\n                            } else {\n                                instance = new ReactCompositeComponentWrapper()\n                            }\n                        } else if (typeof node === \"string\" || typeof node === \"number\") {\n                            instance = ReactNativeComponent.createInstanceForText(node)\n                        } else {\n                            \"production\" !== \"development\"\n                                ? invariant(\n                                      false,\n                                      \"Encountered invalid React node of type %s\",\n                                      typeof node\n                                  )\n                                : invariant(false)\n                        }\n\n                        if (\"production\" !== \"development\") {\n                            \"production\" !== \"development\"\n                                ? warning(\n                                      typeof instance.construct === \"function\" &&\n                                          typeof instance.mountComponent === \"function\" &&\n                                          typeof instance.receiveComponent === \"function\" &&\n                                          typeof instance.unmountComponent === \"function\",\n                                      \"Only React Components can be mounted.\"\n                                  )\n                                : null\n                        }\n\n                        // Sets up the instance. This can probably just move into the constructor now.\n                        instance.construct(node)\n\n                        // These two fields are used by the DOM and ART diffing algorithms\n                        // respectively. Instead of using expandos on components, we should be\n                        // storing the state needed by the diffing algorithms elsewhere.\n                        instance._mountIndex = 0\n                        instance._mountImage = null\n\n                        if (\"production\" !== \"development\") {\n                            instance._isOwnerNecessary = false\n                            instance._warnedAboutRefsInRender = false\n                        }\n\n                        // Internal instances should fully constructed at this point, so they should\n                        // not get any new fields added to them at this point.\n                        if (\"production\" !== \"development\") {\n                            if (Object.preventExtensions) {\n                                Object.preventExtensions(instance)\n                            }\n                        }\n\n                        return instance\n                    }\n\n                    module.exports = instantiateReactComponent\n                },\n                { \"150\": 150, \"171\": 171, \"29\": 29, \"43\": 43, \"65\": 65, \"80\": 80 }\n            ],\n            150: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule invariant\n                     */\n\n                    \"use strict\"\n\n                    /**\n                     * Use invariant() to assert state which your program assumes to be true.\n                     *\n                     * Provide sprintf-style format (only %s is supported) and arguments\n                     * to provide information about what broke and what you were\n                     * expecting.\n                     *\n                     * The invariant message will be stripped in production, but the invariant\n                     * will remain to ensure logic does not differ in production.\n                     */\n\n                    var invariant = function(condition, format, a, b, c, d, e, f) {\n                        if (\"production\" !== \"development\") {\n                            if (format === undefined) {\n                                throw new Error(\"invariant requires an error message argument\")\n                            }\n                        }\n\n                        if (!condition) {\n                            var error\n                            if (format === undefined) {\n                                error = new Error(\n                                    \"Minified exception occurred; use the non-minified dev environment \" +\n                                        \"for the full error message and additional helpful warnings.\"\n                                )\n                            } else {\n                                var args = [a, b, c, d, e, f]\n                                var argIndex = 0\n                                error = new Error(\n                                    \"Invariant Violation: \" +\n                                        format.replace(/%s/g, function() {\n                                            return args[argIndex++]\n                                        })\n                                )\n                            }\n\n                            error.framesToPop = 1 // we don't care about invariant's own frame\n                            throw error\n                        }\n                    }\n\n                    module.exports = invariant\n                },\n                {}\n            ],\n            151: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule isEventSupported\n                     */\n\n                    \"use strict\"\n\n                    var ExecutionEnvironment = _dereq_(22)\n\n                    var useHasFeature\n                    if (ExecutionEnvironment.canUseDOM) {\n                        useHasFeature =\n                            document.implementation &&\n                            document.implementation.hasFeature &&\n                            // always returns true in newer browsers as per the standard.\n                            // @see http://dom.spec.whatwg.org/#dom-domimplementation-hasfeature\n                            document.implementation.hasFeature(\"\", \"\") !== true\n                    }\n\n                    /**\n                     * Checks if an event is supported in the current execution environment.\n                     *\n                     * NOTE: This will not work correctly for non-generic events such as `change`,\n                     * `reset`, `load`, `error`, and `select`.\n                     *\n                     * Borrows from Modernizr.\n                     *\n                     * @param {string} eventNameSuffix Event name, e.g. \"click\".\n                     * @param {?boolean} capture Check if the capture phase is supported.\n                     * @return {boolean} True if the event is supported.\n                     * @internal\n                     * @license Modernizr 3.0.0pre (Custom Build) | MIT\n                     */\n                    function isEventSupported(eventNameSuffix, capture) {\n                        if (\n                            !ExecutionEnvironment.canUseDOM ||\n                            (capture && !(\"addEventListener\" in document))\n                        ) {\n                            return false\n                        }\n\n                        var eventName = \"on\" + eventNameSuffix\n                        var isSupported = eventName in document\n\n                        if (!isSupported) {\n                            var element = document.createElement(\"div\")\n                            element.setAttribute(eventName, \"return;\")\n                            isSupported = typeof element[eventName] === \"function\"\n                        }\n\n                        if (!isSupported && useHasFeature && eventNameSuffix === \"wheel\") {\n                            // This is the only way to test support for the `wheel` event in IE9+.\n                            isSupported = document.implementation.hasFeature(\"Events.wheel\", \"3.0\")\n                        }\n\n                        return isSupported\n                    }\n\n                    module.exports = isEventSupported\n                },\n                { \"22\": 22 }\n            ],\n            152: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule isNode\n                     * @typechecks\n                     */\n\n                    /**\n                     * @param {*} object The object to check.\n                     * @return {boolean} Whether or not the object is a DOM node.\n                     */\n                    function isNode(object) {\n                        return !!(\n                            object &&\n                            (typeof Node === \"function\"\n                                ? object instanceof Node\n                                : typeof object === \"object\" &&\n                                  typeof object.nodeType === \"number\" &&\n                                  typeof object.nodeName === \"string\")\n                        )\n                    }\n\n                    module.exports = isNode\n                },\n                {}\n            ],\n            153: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule isTextInputElement\n                     */\n\n                    \"use strict\"\n\n                    /**\n                     * @see http://www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary\n                     */\n                    var supportedInputTypes = {\n                        color: true,\n                        date: true,\n                        datetime: true,\n                        \"datetime-local\": true,\n                        email: true,\n                        month: true,\n                        number: true,\n                        password: true,\n                        range: true,\n                        search: true,\n                        tel: true,\n                        text: true,\n                        time: true,\n                        url: true,\n                        week: true\n                    }\n\n                    function isTextInputElement(elem) {\n                        return (\n                            elem &&\n                            ((elem.nodeName === \"INPUT\" && supportedInputTypes[elem.type]) ||\n                                elem.nodeName === \"TEXTAREA\")\n                        )\n                    }\n\n                    module.exports = isTextInputElement\n                },\n                {}\n            ],\n            154: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule isTextNode\n                     * @typechecks\n                     */\n\n                    var isNode = _dereq_(152)\n\n                    /**\n                     * @param {*} object The object to check.\n                     * @return {boolean} Whether or not the object is a DOM text node.\n                     */\n                    function isTextNode(object) {\n                        return isNode(object) && object.nodeType == 3\n                    }\n\n                    module.exports = isTextNode\n                },\n                { \"152\": 152 }\n            ],\n            155: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule joinClasses\n                     * @typechecks static-only\n                     */\n\n                    \"use strict\"\n\n                    /**\n                     * Combines multiple className strings into one.\n                     * http://jsperf.com/joinclasses-args-vs-array\n                     *\n                     * @param {...?string} classes\n                     * @return {string}\n                     */\n                    function joinClasses(className /*, ... */) {\n                        if (!className) {\n                            className = \"\"\n                        }\n                        var nextClass\n                        var argLength = arguments.length\n                        if (argLength > 1) {\n                            for (var ii = 1; ii < argLength; ii++) {\n                                nextClass = arguments[ii]\n                                if (nextClass) {\n                                    className = (className ? className + \" \" : \"\") + nextClass\n                                }\n                            }\n                        }\n                        return className\n                    }\n\n                    module.exports = joinClasses\n                },\n                {}\n            ],\n            156: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule keyMirror\n                     * @typechecks static-only\n                     */\n\n                    \"use strict\"\n\n                    var invariant = _dereq_(150)\n\n                    /**\n                     * Constructs an enumeration with keys equal to their value.\n                     *\n                     * For example:\n                     *\n                     *   var COLORS = keyMirror({blue: null, red: null});\n                     *   var myColor = COLORS.blue;\n                     *   var isColorValid = !!COLORS[myColor];\n                     *\n                     * The last line could not be performed if the values of the generated enum were\n                     * not equal to their keys.\n                     *\n                     *   Input:  {key1: val1, key2: val2}\n                     *   Output: {key1: key1, key2: key2}\n                     *\n                     * @param {object} obj\n                     * @return {object}\n                     */\n                    var keyMirror = function(obj) {\n                        var ret = {}\n                        var key\n                        \"production\" !== \"development\"\n                            ? invariant(\n                                  obj instanceof Object && !Array.isArray(obj),\n                                  \"keyMirror(...): Argument must be an object.\"\n                              )\n                            : invariant(obj instanceof Object && !Array.isArray(obj))\n                        for (key in obj) {\n                            if (!obj.hasOwnProperty(key)) {\n                                continue\n                            }\n                            ret[key] = key\n                        }\n                        return ret\n                    }\n\n                    module.exports = keyMirror\n                },\n                { \"150\": 150 }\n            ],\n            157: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule keyOf\n                     */\n\n                    /**\n                     * Allows extraction of a minified key. Let's the build system minify keys\n                     * without loosing the ability to dynamically use key strings as values\n                     * themselves. Pass in an object with a single key/val pair and it will return\n                     * you the string key of that single record. Suppose you want to grab the\n                     * value for a key 'className' inside of an object. Key/val minification may\n                     * have aliased that key to be 'xa12'. keyOf({className: null}) will return\n                     * 'xa12' in that case. Resolve keys you want to use once at startup time, then\n                     * reuse those resolutions.\n                     */\n                    var keyOf = function(oneKeyObj) {\n                        var key\n                        for (key in oneKeyObj) {\n                            if (!oneKeyObj.hasOwnProperty(key)) {\n                                continue\n                            }\n                            return key\n                        }\n                        return null\n                    }\n\n                    module.exports = keyOf\n                },\n                {}\n            ],\n            158: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule mapObject\n                     */\n\n                    \"use strict\"\n\n                    var hasOwnProperty = Object.prototype.hasOwnProperty\n\n                    /**\n                     * Executes the provided `callback` once for each enumerable own property in the\n                     * object and constructs a new object from the results. The `callback` is\n                     * invoked with three arguments:\n                     *\n                     *  - the property value\n                     *  - the property name\n                     *  - the object being traversed\n                     *\n                     * Properties that are added after the call to `mapObject` will not be visited\n                     * by `callback`. If the values of existing properties are changed, the value\n                     * passed to `callback` will be the value at the time `mapObject` visits them.\n                     * Properties that are deleted before being visited are not visited.\n                     *\n                     * @grep function objectMap()\n                     * @grep function objMap()\n                     *\n                     * @param {?object} object\n                     * @param {function} callback\n                     * @param {*} context\n                     * @return {?object}\n                     */\n                    function mapObject(object, callback, context) {\n                        if (!object) {\n                            return null\n                        }\n                        var result = {}\n                        for (var name in object) {\n                            if (hasOwnProperty.call(object, name)) {\n                                result[name] = callback.call(context, object[name], name, object)\n                            }\n                        }\n                        return result\n                    }\n\n                    module.exports = mapObject\n                },\n                {}\n            ],\n            159: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule memoizeStringOnly\n                     * @typechecks static-only\n                     */\n\n                    \"use strict\"\n\n                    /**\n                     * Memoizes the return value of a function that accepts one string argument.\n                     *\n                     * @param {function} callback\n                     * @return {function}\n                     */\n                    function memoizeStringOnly(callback) {\n                        var cache = {}\n                        return function(string) {\n                            if (!cache.hasOwnProperty(string)) {\n                                cache[string] = callback.call(this, string)\n                            }\n                            return cache[string]\n                        }\n                    }\n\n                    module.exports = memoizeStringOnly\n                },\n                {}\n            ],\n            160: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule onlyChild\n                     */\n                    \"use strict\"\n\n                    var ReactElement = _dereq_(63)\n\n                    var invariant = _dereq_(150)\n\n                    /**\n                     * Returns the first child in a collection of children and verifies that there\n                     * is only one child in the collection. The current implementation of this\n                     * function assumes that a single child gets passed without a wrapper, but the\n                     * purpose of this helper function is to abstract away the particular structure\n                     * of children.\n                     *\n                     * @param {?object} children Child collection structure.\n                     * @return {ReactComponent} The first and only `ReactComponent` contained in the\n                     * structure.\n                     */\n                    function onlyChild(children) {\n                        \"production\" !== \"development\"\n                            ? invariant(\n                                  ReactElement.isValidElement(children),\n                                  \"onlyChild must be passed a children with exactly one child.\"\n                              )\n                            : invariant(ReactElement.isValidElement(children))\n                        return children\n                    }\n\n                    module.exports = onlyChild\n                },\n                { \"150\": 150, \"63\": 63 }\n            ],\n            161: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule performance\n                     * @typechecks\n                     */\n\n                    \"use strict\"\n\n                    var ExecutionEnvironment = _dereq_(22)\n\n                    var performance\n\n                    if (ExecutionEnvironment.canUseDOM) {\n                        performance =\n                            window.performance || window.msPerformance || window.webkitPerformance\n                    }\n\n                    module.exports = performance || {}\n                },\n                { \"22\": 22 }\n            ],\n            162: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule performanceNow\n                     * @typechecks\n                     */\n\n                    var performance = _dereq_(161)\n\n                    /**\n                     * Detect if we can use `window.performance.now()` and gracefully fallback to\n                     * `Date.now()` if it doesn't exist. We need to support Firefox < 15 for now\n                     * because of Facebook's testing infrastructure.\n                     */\n                    if (!performance || !performance.now) {\n                        performance = Date\n                    }\n\n                    var performanceNow = performance.now.bind(performance)\n\n                    module.exports = performanceNow\n                },\n                { \"161\": 161 }\n            ],\n            163: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule quoteAttributeValueForBrowser\n                     */\n\n                    \"use strict\"\n\n                    var escapeTextContentForBrowser = _dereq_(131)\n\n                    /**\n                     * Escapes attribute value to prevent scripting attacks.\n                     *\n                     * @param {*} value Value to escape.\n                     * @return {string} An escaped string.\n                     */\n                    function quoteAttributeValueForBrowser(value) {\n                        return '\"' + escapeTextContentForBrowser(value) + '\"'\n                    }\n\n                    module.exports = quoteAttributeValueForBrowser\n                },\n                { \"131\": 131 }\n            ],\n            164: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule setInnerHTML\n                     */\n\n                    /* globals MSApp */\n\n                    \"use strict\"\n\n                    var ExecutionEnvironment = _dereq_(22)\n\n                    var WHITESPACE_TEST = /^[ \\r\\n\\t\\f]/\n                    var NONVISIBLE_TEST = /<(!--|link|noscript|meta|script|style)[ \\r\\n\\t\\f\\/>]/\n\n                    /**\n                     * Set the innerHTML property of a node, ensuring that whitespace is preserved\n                     * even in IE8.\n                     *\n                     * @param {DOMElement} node\n                     * @param {string} html\n                     * @internal\n                     */\n                    var setInnerHTML = function(node, html) {\n                        node.innerHTML = html\n                    }\n\n                    // Win8 apps: Allow all html to be inserted\n                    if (typeof MSApp !== \"undefined\" && MSApp.execUnsafeLocalFunction) {\n                        setInnerHTML = function(node, html) {\n                            MSApp.execUnsafeLocalFunction(function() {\n                                node.innerHTML = html\n                            })\n                        }\n                    }\n\n                    if (ExecutionEnvironment.canUseDOM) {\n                        // IE8: When updating a just created node with innerHTML only leading\n                        // whitespace is removed. When updating an existing node with innerHTML\n                        // whitespace in root TextNodes is also collapsed.\n                        // @see quirksmode.org/bugreports/archives/2004/11/innerhtml_and_t.html\n\n                        // Feature detection; only IE8 is known to behave improperly like this.\n                        var testElement = document.createElement(\"div\")\n                        testElement.innerHTML = \" \"\n                        if (testElement.innerHTML === \"\") {\n                            setInnerHTML = function(node, html) {\n                                // Magic theory: IE8 supposedly differentiates between added and updated\n                                // nodes when processing innerHTML, innerHTML on updated nodes suffers\n                                // from worse whitespace behavior. Re-adding a node like this triggers\n                                // the initial and more favorable whitespace behavior.\n                                // TODO: What to do on a detached node?\n                                if (node.parentNode) {\n                                    node.parentNode.replaceChild(node, node)\n                                }\n\n                                // We also implement a workaround for non-visible tags disappearing into\n                                // thin air on IE8, this only happens if there is no visible text\n                                // in-front of the non-visible tags. Piggyback on the whitespace fix\n                                // and simply check if any non-visible tags appear in the source.\n                                if (\n                                    WHITESPACE_TEST.test(html) ||\n                                    (html[0] === \"<\" && NONVISIBLE_TEST.test(html))\n                                ) {\n                                    // Recover leading whitespace by temporarily prepending any character.\n                                    // \\uFEFF has the potential advantage of being zero-width/invisible.\n                                    node.innerHTML = \"\\uFEFF\" + html\n\n                                    // deleteData leaves an empty `TextNode` which offsets the index of all\n                                    // children. Definitely want to avoid this.\n                                    var textNode = node.firstChild\n                                    if (textNode.data.length === 1) {\n                                        node.removeChild(textNode)\n                                    } else {\n                                        textNode.deleteData(0, 1)\n                                    }\n                                } else {\n                                    node.innerHTML = html\n                                }\n                            }\n                        }\n                    }\n\n                    module.exports = setInnerHTML\n                },\n                { \"22\": 22 }\n            ],\n            165: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule setTextContent\n                     */\n\n                    \"use strict\"\n\n                    var ExecutionEnvironment = _dereq_(22)\n                    var escapeTextContentForBrowser = _dereq_(131)\n                    var setInnerHTML = _dereq_(164)\n\n                    /**\n                     * Set the textContent property of a node, ensuring that whitespace is preserved\n                     * even in IE8. innerText is a poor substitute for textContent and, among many\n                     * issues, inserts <br> instead of the literal newline chars. innerHTML behaves\n                     * as it should.\n                     *\n                     * @param {DOMElement} node\n                     * @param {string} text\n                     * @internal\n                     */\n                    var setTextContent = function(node, text) {\n                        node.textContent = text\n                    }\n\n                    if (ExecutionEnvironment.canUseDOM) {\n                        if (!(\"textContent\" in document.documentElement)) {\n                            setTextContent = function(node, text) {\n                                setInnerHTML(node, escapeTextContentForBrowser(text))\n                            }\n                        }\n                    }\n\n                    module.exports = setTextContent\n                },\n                { \"131\": 131, \"164\": 164, \"22\": 22 }\n            ],\n            166: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule shallowEqual\n                     */\n\n                    \"use strict\"\n\n                    /**\n                     * Performs equality by iterating through keys on an object and returning\n                     * false when any key has values which are not strictly equal between\n                     * objA and objB. Returns true when the values of all keys are strictly equal.\n                     *\n                     * @return {boolean}\n                     */\n                    function shallowEqual(objA, objB) {\n                        if (objA === objB) {\n                            return true\n                        }\n                        var key\n                        // Test for A's keys different from B.\n                        for (key in objA) {\n                            if (\n                                objA.hasOwnProperty(key) &&\n                                (!objB.hasOwnProperty(key) || objA[key] !== objB[key])\n                            ) {\n                                return false\n                            }\n                        }\n                        // Test for B's keys missing from A.\n                        for (key in objB) {\n                            if (objB.hasOwnProperty(key) && !objA.hasOwnProperty(key)) {\n                                return false\n                            }\n                        }\n                        return true\n                    }\n\n                    module.exports = shallowEqual\n                },\n                {}\n            ],\n            167: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule shouldUpdateReactComponent\n                     * @typechecks static-only\n                     */\n\n                    \"use strict\"\n\n                    var warning = _dereq_(171)\n\n                    /**\n                     * Given a `prevElement` and `nextElement`, determines if the existing\n                     * instance should be updated as opposed to being destroyed or replaced by a new\n                     * instance. Both arguments are elements. This ensures that this logic can\n                     * operate on stateless trees without any backing instance.\n                     *\n                     * @param {?object} prevElement\n                     * @param {?object} nextElement\n                     * @return {boolean} True if the existing instance should be updated.\n                     * @protected\n                     */\n                    function shouldUpdateReactComponent(prevElement, nextElement) {\n                        if (prevElement != null && nextElement != null) {\n                            var prevType = typeof prevElement\n                            var nextType = typeof nextElement\n                            if (prevType === \"string\" || prevType === \"number\") {\n                                return nextType === \"string\" || nextType === \"number\"\n                            } else {\n                                if (\n                                    nextType === \"object\" &&\n                                    prevElement.type === nextElement.type &&\n                                    prevElement.key === nextElement.key\n                                ) {\n                                    var ownersMatch = prevElement._owner === nextElement._owner\n                                    var prevName = null\n                                    var nextName = null\n                                    var nextDisplayName = null\n                                    if (\"production\" !== \"development\") {\n                                        if (!ownersMatch) {\n                                            if (\n                                                prevElement._owner != null &&\n                                                prevElement._owner.getPublicInstance() != null &&\n                                                prevElement._owner.getPublicInstance()\n                                                    .constructor != null\n                                            ) {\n                                                prevName = prevElement._owner.getPublicInstance()\n                                                    .constructor.displayName\n                                            }\n                                            if (\n                                                nextElement._owner != null &&\n                                                nextElement._owner.getPublicInstance() != null &&\n                                                nextElement._owner.getPublicInstance()\n                                                    .constructor != null\n                                            ) {\n                                                nextName = nextElement._owner.getPublicInstance()\n                                                    .constructor.displayName\n                                            }\n                                            if (\n                                                nextElement.type != null &&\n                                                nextElement.type.displayName != null\n                                            ) {\n                                                nextDisplayName = nextElement.type.displayName\n                                            }\n                                            if (\n                                                nextElement.type != null &&\n                                                typeof nextElement.type === \"string\"\n                                            ) {\n                                                nextDisplayName = nextElement.type\n                                            }\n                                            if (\n                                                typeof nextElement.type !== \"string\" ||\n                                                nextElement.type === \"input\" ||\n                                                nextElement.type === \"textarea\"\n                                            ) {\n                                                if (\n                                                    (prevElement._owner != null &&\n                                                        prevElement._owner._isOwnerNecessary ===\n                                                            false) ||\n                                                    (nextElement._owner != null &&\n                                                        nextElement._owner._isOwnerNecessary ===\n                                                            false)\n                                                ) {\n                                                    if (prevElement._owner != null) {\n                                                        prevElement._owner._isOwnerNecessary = true\n                                                    }\n                                                    if (nextElement._owner != null) {\n                                                        nextElement._owner._isOwnerNecessary = true\n                                                    }\n                                                    \"production\" !== \"development\"\n                                                        ? warning(\n                                                              false,\n                                                              \"<%s /> is being rendered by both %s and %s using the same \" +\n                                                                  \"key (%s) in the same place. Currently, this means that \" +\n                                                                  \"they don't preserve state. This behavior should be very \" +\n                                                                  \"rare so we're considering deprecating it. Please contact \" +\n                                                                  \"the React team and explain your use case so that we can \" +\n                                                                  \"take that into consideration.\",\n                                                              nextDisplayName ||\n                                                                  \"Unknown Component\",\n                                                              prevName || \"[Unknown]\",\n                                                              nextName || \"[Unknown]\",\n                                                              prevElement.key\n                                                          )\n                                                        : null\n                                                }\n                                            }\n                                        }\n                                    }\n                                    return ownersMatch\n                                }\n                            }\n                        }\n                        return false\n                    }\n\n                    module.exports = shouldUpdateReactComponent\n                },\n                { \"171\": 171 }\n            ],\n            168: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2014-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule toArray\n                     * @typechecks\n                     */\n\n                    var invariant = _dereq_(150)\n\n                    /**\n                     * Convert array-like objects to arrays.\n                     *\n                     * This API assumes the caller knows the contents of the data type. For less\n                     * well defined inputs use createArrayFromMixed.\n                     *\n                     * @param {object|function|filelist} obj\n                     * @return {array}\n                     */\n                    function toArray(obj) {\n                        var length = obj.length\n\n                        // Some browse builtin objects can report typeof 'function' (e.g. NodeList in\n                        // old versions of Safari).\n                        \"production\" !== \"development\"\n                            ? invariant(\n                                  !Array.isArray(obj) &&\n                                      (typeof obj === \"object\" || typeof obj === \"function\"),\n                                  \"toArray: Array-like object expected\"\n                              )\n                            : invariant(\n                                  !Array.isArray(obj) &&\n                                      (typeof obj === \"object\" || typeof obj === \"function\")\n                              )\n\n                        \"production\" !== \"development\"\n                            ? invariant(\n                                  typeof length === \"number\",\n                                  \"toArray: Object needs a length property\"\n                              )\n                            : invariant(typeof length === \"number\")\n\n                        \"production\" !== \"development\"\n                            ? invariant(\n                                  length === 0 || length - 1 in obj,\n                                  \"toArray: Object should have keys for indices\"\n                              )\n                            : invariant(length === 0 || length - 1 in obj)\n\n                        // Old IE doesn't give collections access to hasOwnProperty. Assume inputs\n                        // without method will throw during the slice call and skip straight to the\n                        // fallback.\n                        if (obj.hasOwnProperty) {\n                            try {\n                                return Array.prototype.slice.call(obj)\n                            } catch (e) {\n                                // IE < 9 does not support Array#slice on collections objects\n                            }\n                        }\n\n                        // Fall back to copying key by key. This assumes all keys have a value,\n                        // so will not preserve sparsely populated inputs.\n                        var ret = Array(length)\n                        for (var ii = 0; ii < length; ii++) {\n                            ret[ii] = obj[ii]\n                        }\n                        return ret\n                    }\n\n                    module.exports = toArray\n                },\n                { \"150\": 150 }\n            ],\n            169: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule traverseAllChildren\n                     */\n\n                    \"use strict\"\n\n                    var ReactElement = _dereq_(63)\n                    var ReactFragment = _dereq_(69)\n                    var ReactInstanceHandles = _dereq_(72)\n\n                    var getIteratorFn = _dereq_(141)\n                    var invariant = _dereq_(150)\n                    var warning = _dereq_(171)\n\n                    var SEPARATOR = ReactInstanceHandles.SEPARATOR\n                    var SUBSEPARATOR = \":\"\n\n                    /**\n                     * TODO: Test that a single child and an array with one item have the same key\n                     * pattern.\n                     */\n\n                    var userProvidedKeyEscaperLookup = {\n                        \"=\": \"=0\",\n                        \".\": \"=1\",\n                        \":\": \"=2\"\n                    }\n\n                    var userProvidedKeyEscapeRegex = /[=.:]/g\n\n                    var didWarnAboutMaps = false\n\n                    function userProvidedKeyEscaper(match) {\n                        return userProvidedKeyEscaperLookup[match]\n                    }\n\n                    /**\n                     * Generate a key string that identifies a component within a set.\n                     *\n                     * @param {*} component A component that could contain a manual key.\n                     * @param {number} index Index that is used if a manual key is not provided.\n                     * @return {string}\n                     */\n                    function getComponentKey(component, index) {\n                        if (component && component.key != null) {\n                            // Explicit key\n                            return wrapUserProvidedKey(component.key)\n                        }\n                        // Implicit key determined by the index in the set\n                        return index.toString(36)\n                    }\n\n                    /**\n                     * Escape a component key so that it is safe to use in a reactid.\n                     *\n                     * @param {*} key Component key to be escaped.\n                     * @return {string} An escaped string.\n                     */\n                    function escapeUserProvidedKey(text) {\n                        return (\"\" + text).replace(\n                            userProvidedKeyEscapeRegex,\n                            userProvidedKeyEscaper\n                        )\n                    }\n\n                    /**\n                     * Wrap a `key` value explicitly provided by the user to distinguish it from\n                     * implicitly-generated keys generated by a component's index in its parent.\n                     *\n                     * @param {string} key Value of a user-provided `key` attribute\n                     * @return {string}\n                     */\n                    function wrapUserProvidedKey(key) {\n                        return \"$\" + escapeUserProvidedKey(key)\n                    }\n\n                    /**\n                     * @param {?*} children Children tree container.\n                     * @param {!string} nameSoFar Name of the key path so far.\n                     * @param {!number} indexSoFar Number of children encountered until this point.\n                     * @param {!function} callback Callback to invoke with each child found.\n                     * @param {?*} traverseContext Used to pass information throughout the traversal\n                     * process.\n                     * @return {!number} The number of children in this subtree.\n                     */\n                    function traverseAllChildrenImpl(\n                        children,\n                        nameSoFar,\n                        indexSoFar,\n                        callback,\n                        traverseContext\n                    ) {\n                        var type = typeof children\n\n                        if (type === \"undefined\" || type === \"boolean\") {\n                            // All of the above are perceived as null.\n                            children = null\n                        }\n\n                        if (\n                            children === null ||\n                            type === \"string\" ||\n                            type === \"number\" ||\n                            ReactElement.isValidElement(children)\n                        ) {\n                            callback(\n                                traverseContext,\n                                children,\n                                // If it's the only child, treat the name as if it was wrapped in an array\n                                // so that it's consistent if the number of children grows.\n                                nameSoFar === \"\"\n                                    ? SEPARATOR + getComponentKey(children, 0)\n                                    : nameSoFar,\n                                indexSoFar\n                            )\n                            return 1\n                        }\n\n                        var child, nextName, nextIndex\n                        var subtreeCount = 0 // Count of children found in the current subtree.\n\n                        if (Array.isArray(children)) {\n                            for (var i = 0; i < children.length; i++) {\n                                child = children[i]\n                                nextName =\n                                    (nameSoFar !== \"\" ? nameSoFar + SUBSEPARATOR : SEPARATOR) +\n                                    getComponentKey(child, i)\n                                nextIndex = indexSoFar + subtreeCount\n                                subtreeCount += traverseAllChildrenImpl(\n                                    child,\n                                    nextName,\n                                    nextIndex,\n                                    callback,\n                                    traverseContext\n                                )\n                            }\n                        } else {\n                            var iteratorFn = getIteratorFn(children)\n                            if (iteratorFn) {\n                                var iterator = iteratorFn.call(children)\n                                var step\n                                if (iteratorFn !== children.entries) {\n                                    var ii = 0\n                                    while (!(step = iterator.next()).done) {\n                                        child = step.value\n                                        nextName =\n                                            (nameSoFar !== \"\"\n                                                ? nameSoFar + SUBSEPARATOR\n                                                : SEPARATOR) + getComponentKey(child, ii++)\n                                        nextIndex = indexSoFar + subtreeCount\n                                        subtreeCount += traverseAllChildrenImpl(\n                                            child,\n                                            nextName,\n                                            nextIndex,\n                                            callback,\n                                            traverseContext\n                                        )\n                                    }\n                                } else {\n                                    if (\"production\" !== \"development\") {\n                                        \"production\" !== \"development\"\n                                            ? warning(\n                                                  didWarnAboutMaps,\n                                                  \"Using Maps as children is not yet fully supported. It is an \" +\n                                                      \"experimental feature that might be removed. Convert it to a \" +\n                                                      \"sequence / iterable of keyed ReactElements instead.\"\n                                              )\n                                            : null\n                                        didWarnAboutMaps = true\n                                    }\n                                    // Iterator will provide entry [k,v] tuples rather than values.\n                                    while (!(step = iterator.next()).done) {\n                                        var entry = step.value\n                                        if (entry) {\n                                            child = entry[1]\n                                            nextName =\n                                                (nameSoFar !== \"\"\n                                                    ? nameSoFar + SUBSEPARATOR\n                                                    : SEPARATOR) +\n                                                wrapUserProvidedKey(entry[0]) +\n                                                SUBSEPARATOR +\n                                                getComponentKey(child, 0)\n                                            nextIndex = indexSoFar + subtreeCount\n                                            subtreeCount += traverseAllChildrenImpl(\n                                                child,\n                                                nextName,\n                                                nextIndex,\n                                                callback,\n                                                traverseContext\n                                            )\n                                        }\n                                    }\n                                }\n                            } else if (type === \"object\") {\n                                \"production\" !== \"development\"\n                                    ? invariant(\n                                          children.nodeType !== 1,\n                                          \"traverseAllChildren(...): Encountered an invalid child; DOM \" +\n                                              \"elements are not valid children of React components.\"\n                                      )\n                                    : invariant(children.nodeType !== 1)\n                                var fragment = ReactFragment.extract(children)\n                                for (var key in fragment) {\n                                    if (fragment.hasOwnProperty(key)) {\n                                        child = fragment[key]\n                                        nextName =\n                                            (nameSoFar !== \"\"\n                                                ? nameSoFar + SUBSEPARATOR\n                                                : SEPARATOR) +\n                                            wrapUserProvidedKey(key) +\n                                            SUBSEPARATOR +\n                                            getComponentKey(child, 0)\n                                        nextIndex = indexSoFar + subtreeCount\n                                        subtreeCount += traverseAllChildrenImpl(\n                                            child,\n                                            nextName,\n                                            nextIndex,\n                                            callback,\n                                            traverseContext\n                                        )\n                                    }\n                                }\n                            }\n                        }\n\n                        return subtreeCount\n                    }\n\n                    /**\n                     * Traverses children that are typically specified as `props.children`, but\n                     * might also be specified through attributes:\n                     *\n                     * - `traverseAllChildren(this.props.children, ...)`\n                     * - `traverseAllChildren(this.props.leftPanelChildren, ...)`\n                     *\n                     * The `traverseContext` is an optional argument that is passed through the\n                     * entire traversal. It can be used to store accumulations or anything else that\n                     * the callback might find relevant.\n                     *\n                     * @param {?*} children Children tree object.\n                     * @param {!function} callback To invoke upon traversing each child.\n                     * @param {?*} traverseContext Context for traversal.\n                     * @return {!number} The number of children in this subtree.\n                     */\n                    function traverseAllChildren(children, callback, traverseContext) {\n                        if (children == null) {\n                            return 0\n                        }\n\n                        return traverseAllChildrenImpl(children, \"\", 0, callback, traverseContext)\n                    }\n\n                    module.exports = traverseAllChildren\n                },\n                { \"141\": 141, \"150\": 150, \"171\": 171, \"63\": 63, \"69\": 69, \"72\": 72 }\n            ],\n            170: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2013-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule update\n                     */\n\n                    /* global hasOwnProperty:true */\n\n                    \"use strict\"\n\n                    var assign = _dereq_(29)\n                    var keyOf = _dereq_(157)\n                    var invariant = _dereq_(150)\n                    var hasOwnProperty = {}.hasOwnProperty\n\n                    function shallowCopy(x) {\n                        if (Array.isArray(x)) {\n                            return x.concat()\n                        } else if (x && typeof x === \"object\") {\n                            return assign(new x.constructor(), x)\n                        } else {\n                            return x\n                        }\n                    }\n\n                    var COMMAND_PUSH = keyOf({ $push: null })\n                    var COMMAND_UNSHIFT = keyOf({ $unshift: null })\n                    var COMMAND_SPLICE = keyOf({ $splice: null })\n                    var COMMAND_SET = keyOf({ $set: null })\n                    var COMMAND_MERGE = keyOf({ $merge: null })\n                    var COMMAND_APPLY = keyOf({ $apply: null })\n\n                    var ALL_COMMANDS_LIST = [\n                        COMMAND_PUSH,\n                        COMMAND_UNSHIFT,\n                        COMMAND_SPLICE,\n                        COMMAND_SET,\n                        COMMAND_MERGE,\n                        COMMAND_APPLY\n                    ]\n\n                    var ALL_COMMANDS_SET = {}\n\n                    ALL_COMMANDS_LIST.forEach(function(command) {\n                        ALL_COMMANDS_SET[command] = true\n                    })\n\n                    function invariantArrayCase(value, spec, command) {\n                        \"production\" !== \"development\"\n                            ? invariant(\n                                  Array.isArray(value),\n                                  \"update(): expected target of %s to be an array; got %s.\",\n                                  command,\n                                  value\n                              )\n                            : invariant(Array.isArray(value))\n                        var specValue = spec[command]\n                        \"production\" !== \"development\"\n                            ? invariant(\n                                  Array.isArray(specValue),\n                                  \"update(): expected spec of %s to be an array; got %s. \" +\n                                      \"Did you forget to wrap your parameter in an array?\",\n                                  command,\n                                  specValue\n                              )\n                            : invariant(Array.isArray(specValue))\n                    }\n\n                    function update(value, spec) {\n                        \"production\" !== \"development\"\n                            ? invariant(\n                                  typeof spec === \"object\",\n                                  \"update(): You provided a key path to update() that did not contain one \" +\n                                      \"of %s. Did you forget to include {%s: ...}?\",\n                                  ALL_COMMANDS_LIST.join(\", \"),\n                                  COMMAND_SET\n                              )\n                            : invariant(typeof spec === \"object\")\n\n                        if (hasOwnProperty.call(spec, COMMAND_SET)) {\n                            \"production\" !== \"development\"\n                                ? invariant(\n                                      Object.keys(spec).length === 1,\n                                      \"Cannot have more than one key in an object with %s\",\n                                      COMMAND_SET\n                                  )\n                                : invariant(Object.keys(spec).length === 1)\n\n                            return spec[COMMAND_SET]\n                        }\n\n                        var nextValue = shallowCopy(value)\n\n                        if (hasOwnProperty.call(spec, COMMAND_MERGE)) {\n                            var mergeObj = spec[COMMAND_MERGE]\n                            \"production\" !== \"development\"\n                                ? invariant(\n                                      mergeObj && typeof mergeObj === \"object\",\n                                      \"update(): %s expects a spec of type 'object'; got %s\",\n                                      COMMAND_MERGE,\n                                      mergeObj\n                                  )\n                                : invariant(mergeObj && typeof mergeObj === \"object\")\n                            \"production\" !== \"development\"\n                                ? invariant(\n                                      nextValue && typeof nextValue === \"object\",\n                                      \"update(): %s expects a target of type 'object'; got %s\",\n                                      COMMAND_MERGE,\n                                      nextValue\n                                  )\n                                : invariant(nextValue && typeof nextValue === \"object\")\n                            assign(nextValue, spec[COMMAND_MERGE])\n                        }\n\n                        if (hasOwnProperty.call(spec, COMMAND_PUSH)) {\n                            invariantArrayCase(value, spec, COMMAND_PUSH)\n                            spec[COMMAND_PUSH].forEach(function(item) {\n                                nextValue.push(item)\n                            })\n                        }\n\n                        if (hasOwnProperty.call(spec, COMMAND_UNSHIFT)) {\n                            invariantArrayCase(value, spec, COMMAND_UNSHIFT)\n                            spec[COMMAND_UNSHIFT].forEach(function(item) {\n                                nextValue.unshift(item)\n                            })\n                        }\n\n                        if (hasOwnProperty.call(spec, COMMAND_SPLICE)) {\n                            \"production\" !== \"development\"\n                                ? invariant(\n                                      Array.isArray(value),\n                                      \"Expected %s target to be an array; got %s\",\n                                      COMMAND_SPLICE,\n                                      value\n                                  )\n                                : invariant(Array.isArray(value))\n                            \"production\" !== \"development\"\n                                ? invariant(\n                                      Array.isArray(spec[COMMAND_SPLICE]),\n                                      \"update(): expected spec of %s to be an array of arrays; got %s. \" +\n                                          \"Did you forget to wrap your parameters in an array?\",\n                                      COMMAND_SPLICE,\n                                      spec[COMMAND_SPLICE]\n                                  )\n                                : invariant(Array.isArray(spec[COMMAND_SPLICE]))\n                            spec[COMMAND_SPLICE].forEach(function(args) {\n                                \"production\" !== \"development\"\n                                    ? invariant(\n                                          Array.isArray(args),\n                                          \"update(): expected spec of %s to be an array of arrays; got %s. \" +\n                                              \"Did you forget to wrap your parameters in an array?\",\n                                          COMMAND_SPLICE,\n                                          spec[COMMAND_SPLICE]\n                                      )\n                                    : invariant(Array.isArray(args))\n                                nextValue.splice.apply(nextValue, args)\n                            })\n                        }\n\n                        if (hasOwnProperty.call(spec, COMMAND_APPLY)) {\n                            \"production\" !== \"development\"\n                                ? invariant(\n                                      typeof spec[COMMAND_APPLY] === \"function\",\n                                      \"update(): expected spec of %s to be a function; got %s.\",\n                                      COMMAND_APPLY,\n                                      spec[COMMAND_APPLY]\n                                  )\n                                : invariant(typeof spec[COMMAND_APPLY] === \"function\")\n                            nextValue = spec[COMMAND_APPLY](nextValue)\n                        }\n\n                        for (var k in spec) {\n                            if (!(ALL_COMMANDS_SET.hasOwnProperty(k) && ALL_COMMANDS_SET[k])) {\n                                nextValue[k] = update(value[k], spec[k])\n                            }\n                        }\n\n                        return nextValue\n                    }\n\n                    module.exports = update\n                },\n                { \"150\": 150, \"157\": 157, \"29\": 29 }\n            ],\n            171: [\n                function(_dereq_, module, exports) {\n                    /**\n                     * Copyright 2014-2015, Facebook, Inc.\n                     * All rights reserved.\n                     *\n                     * This source code is licensed under the BSD-style license found in the\n                     * LICENSE file in the root directory of this source tree. An additional grant\n                     * of patent rights can be found in the PATENTS file in the same directory.\n                     *\n                     * @providesModule warning\n                     */\n\n                    \"use strict\"\n\n                    var emptyFunction = _dereq_(129)\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\n                    var warning = emptyFunction\n\n                    if (\"production\" !== \"development\") {\n                        warning = function(condition, format) {\n                            for (\n                                var args = [], $__0 = 2, $__1 = arguments.length;\n                                $__0 < $__1;\n                                $__0++\n                            )\n                                args.push(arguments[$__0])\n                            if (format === undefined) {\n                                throw new Error(\n                                    \"`warning(condition, format, ...args)` requires a warning \" +\n                                        \"message argument\"\n                                )\n                            }\n\n                            if (format.length < 10 || /^[s\\W]*$/.test(format)) {\n                                throw new Error(\n                                    \"The warning format should be able to uniquely identify this \" +\n                                        \"warning. Please, use a more descriptive format than: \" +\n                                        format\n                                )\n                            }\n\n                            if (format.indexOf(\"Failed Composite propType: \") === 0) {\n                                return // Ignore CompositeComponent proptype check.\n                            }\n\n                            if (!condition) {\n                                var argIndex = 0\n                                var message =\n                                    \"Warning: \" +\n                                    format.replace(/%s/g, function() {\n                                        return args[argIndex++]\n                                    })\n                                console.warn(message)\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                                    throw new Error(message)\n                                } catch (x) {}\n                            }\n                        }\n                    }\n\n                    module.exports = warning\n                },\n                { \"129\": 129 }\n            ]\n        },\n        {},\n        [1]\n    )(1)\n})\n"
  },
  {
    "path": "docs/assets/getting-started-assets/script.js",
    "content": "/* For demo purposes only, component to track its own (and parents) amount of renderings */\nvar RenderCounter = function() {\n    var _c = React.useRef(0);\n    return React.createElement(\n        \"div\",\n        { className: \"render-counter \" + (++_c.current % 2 ? \"odd\" : \"even\") },\n        _c.current\n    )\n}\n\n// Save the original source before pretty printer is fired\nfunction getCodeFromTA(elem) {\n    var cm = $(elem).data(\"cm\")\n    if (!cm) {\n        console.log(\"Code editors not yet loaded\")\n        return \"\"\n    }\n    var code = cm.getDoc().getValue()\n    return code\n}\n\nfunction runCodeHelper(code) {\n    // some global vars..\n    window.observable = mobx.observable\n    window.autorun = mobx.autorun\n    window.computed = mobx.computed\n    window.action = mobx.action\n    window.observer = mobxReactLite.observer\n    window.makeObservable = mobx.makeObservable\n    window.makeAutoObservable = mobx.makeAutoObservable\n\n    var globalEval = eval // global scope trick, See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/eval\n\n    try {\n    code = Babel.transform(code, {\n        presets: [\"react\", \"es2015-no-commonjs\", \"stage-1\"],\n    }).code.replace(/\"use strict\"/g, \"\")\n        globalEval(code)\n    } catch (e) {\n        console.error(e)\n    }\n}\n\nfunction runCode(ids) {\n    $(ids.join(\",\")).each(function(i, elem) {\n        clearConsole()\n        var code = getCodeFromTA(elem)\n        runCodeHelper(code)\n    })\n}\n\nvar runLineHandle = null\nvar runLineIndex = 0\nvar lineMarker\n\nfunction runCodePerLine() {\n    if (typeof observableTodoStore === \"undefined\") {\n        runCode([\"#code1\", \"#code3\", \"#code4\", \"#react1\"])\n    }\n\n    function runNext() {\n        var cm = $(\"#play1\").data(\"cm\")\n        var code = cm.getDoc().getValue()\n        var lines = code.split(\"\\n\")\n        var idx = runLineIndex % lines.length\n        var line = lines[idx]\n        if (lineMarker) lineMarker.clear()\n        lineMarker = cm\n            .getDoc()\n            .markText(\n                { line: idx, ch: 0 },\n                { line: idx, ch: line.length },\n                { css: \"background-color:#ff9955;\" }\n            )\n        runCodeHelper(line)\n        runLineIndex++\n    }\n\n    if (!runLineHandle) {\n        $(\"#runline-btn\").text(\"Pause\")\n        runNext()\n        runLineHandle = setInterval(runNext, 2000)\n    } else {\n        clearInterval(runLineHandle)\n        runLineHandle = null\n        $(\"#runline-btn\").text(\"Continue\")\n    }\n}\n\n$console = $(\"#consoleout\")\nvar baseLog = console.log,\n    baseError = console.error\nconsole.log = function(arg) {\n    baseLog.apply(console, arguments)\n    $console.html($console.html() + \"<div>\" + escapeHtml(arg).replace(\"\\n\", \"<br/>\\n\") + \"</div>\")\n}\nconsole.error = function(arg) {\n    baseError.apply(console, arguments)\n    $console.html(\n        $console.html() +\n            \"<pre style='color:white;background:red;padding:10px;'>\" +\n            escapeHtml(arg).replace(/\\n/, \"<br/>\") +\n            \"</pre>\\n\"\n    )\n}\n\nfunction clearConsole() {\n    $(\"#consoleout\").text(\"\")\n}\n\nvar entityMap = {\n    \"&\": \"&amp;\",\n    \"<\": \"&lt;\",\n    \">\": \"&gt;\",\n    '\"': \"&quot;\",\n    \"'\": \"&#39;\",\n    \"/\": \"&#x2F;\"\n}\n\nfunction escapeHtml(string) {\n    return String(string).replace(/[&<>\"'\\/]/g, function(s) {\n        return entityMap[s]\n    })\n}\n\n$(function() {\n    $(\"textarea\").each(function(i, t) {\n        var cm = CodeMirror.fromTextArea(t, {\n            lineNumbers: false,\n            mode: \"javascript\",\n            theme: \"xq-light\"\n        })\n        $(t).data(\"cm\", cm)\n    })\n})\n"
  },
  {
    "path": "docs/assets/getting-started-assets/style.css",
    "content": "body, html {\n    padding: 0;\n    margin: 0;\n    height: 100%;\n\tfont-family: 'PT Serif', serif;\n}\n.root {\n    height: 100vh;\n    width: 100%;\n    border-spacing: 0px;\n}\n.left, .right {\n    padding: 0px;\n    width: 50%;\n    vertical-align: top;\n}\n.left-content-wrapper {\n    height:100vh;\n    overflow: scroll;\n}\n.left-content {\n\tmargin-left: auto;\n\tmargin-right: 0;\n}\n.right {\n\tbackground: #3B64AF;\n\tcolor: white;\n}\n.right-content, .left-content {\n\tmax-width: 600px;\n\tpadding: 40px;\n}\n.right-content {\n}\nh1,h2,h3,h4 {\n\tfont-weight: bold;\n    font-size: 2em;\n}\nh1 {\n\tsize: 40pt;\n}\nhr {\n\tborder: none;\n\tborder-top: 1px dotted #999;\n\twidth: 30%;\n}\n\n#project_title {\n\tfont-size: 60pt;\n}\n#project_tagline {\n\tclear: left;\n\tfont-family: 'arial';\n\tfont-size: 18pt;\n\ttext-align: center;\n}\n\ntextarea, body .CodeMirror {\n    width: 560px;\n}\n\ntextarea {\n    border-style: none;\n    white-space: pre;\n    overflow: auto;\n    padding: 20px;\n    font-family: courier new;\n    color: #333;\n    font-size: 10pt;\n    text-shadow: #fff 1px 1px;\n    margin: 30px 0 20px;\n}\nbody .CodeMirror {\n\tborder: 1px solid #999;\n    height: auto;\n    font-size: 10pt;\n    font-family: courier new;\n    margin-top: 30px;\n    margin-bottom: 30px;\n    padding: 14px;\n}\ncode {\n    padding: 0;\n    margin: 0;\n    box-shadow: none;\n    color: #007edf;\n    font-family: 'courier new';\n    font-size: 11pt;\n    background: none;\n}\n.right li {\n\tcolor: white;\n    padding-left: 10px;\n}\nbutton {\n    cursor: pointer;\n}\n.btn-run {\n    margin-left: 8px;\n    float: right;\n    position: relative;\n    padding: 4px 10px;\n    top: -22px;\n    left: 7px;\n}\n.btn-run:hover {\n\toutline: 2px solid #ff9955;\n}\n.right h3 {\n\tmargin-bottom: 4px;\n}\n#reactjs-app {\n    margin-left: -20px;\n    padding: 20px;\n    width: 100%;\n}\n#consoleout div {\n    border-bottom: 1px solid #ccc;\n    padding: 4px 0;\n    font-family: courier new;\n    font-size: 10pt;\n}\n.render-counter {\n    position: relative;\n    float: right;\n    border-radius: 8px;\n    background-color: #bbb;\n    font-family: arial;\n    font-size: 8pt;\n    font-weight: bold;\n    text-align: center;\n    display: inline-block;\n    padding: 1px 5px;\n    color: white;\n    top: 2px;\n}\n@keyframes blink1 {\n    0% { background-color : #bbb}\n    50% { background-color : #ff9955}\n    100% { background-color : #bbb}\n}\n@keyframes blink2 {\n    0% { background-color : #bbb}\n    50% { background-color : #ff9955}\n    100% { background-color : #bbb}\n}\n.render-counter.odd {\n    animation: blink1 1s ease;\n}\n.render-counter.even {\n    animation: blink2 1s ease;\n}\nsmall {\n    color: #999;\n    font-size: 10pt;\n    font-style: italic;\n}\n#reactjs-app {\n    font-size: 16pt;\n}\n#reactjs-app small {\n    color: white;\n    padding-left: 10px;\n}\n\nbody .github-fork-ribbon {\n    background-color: cornflowerblue;\n}\n\n#devtools {\n    color: black;\n}\n\npre {\n    background-color: #e9e9e9;\n    padding: 20px;\n}"
  },
  {
    "path": "docs/assets/getting-started-assets/stylesheets/github-light.css",
    "content": "/*\n   Copyright 2014 GitHub Inc.\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n\n*/\n\n.pl-c /* comment */ {\n  color: #969896;\n}\n\n.pl-c1      /* constant, markup.raw, meta.diff.header, meta.module-reference, meta.property-name, support, support.constant, support.variable, variable.other.constant */,\n.pl-s .pl-v /* string variable */ {\n  color: #0086b3;\n}\n\n.pl-e  /* entity */,\n.pl-en /* entity.name */ {\n  color: #795da3;\n}\n\n.pl-s .pl-s1 /* string source */,\n.pl-smi      /* storage.modifier.import, storage.modifier.package, storage.type.java, variable.other, variable.parameter.function */ {\n  color: #333;\n}\n\n.pl-ent /* entity.name.tag */ {\n  color: #63a35c;\n}\n\n.pl-k /* keyword, storage, storage.type */ {\n  color: #a71d5d;\n}\n\n.pl-pds              /* punctuation.definition.string, string.regexp.character-class */,\n.pl-s                /* string */,\n.pl-s .pl-pse .pl-s1 /* string punctuation.section.embedded source */,\n.pl-sr               /* string.regexp */,\n.pl-sr .pl-cce       /* string.regexp constant.character.escape */,\n.pl-sr .pl-sra       /* string.regexp string.regexp.arbitrary-repitition */,\n.pl-sr .pl-sre       /* string.regexp source.ruby.embedded */ {\n  color: #183691;\n}\n\n.pl-v /* variable */ {\n  color: #ed6a43;\n}\n\n.pl-id /* invalid.deprecated */ {\n  color: #b52a1d;\n}\n\n.pl-ii /* invalid.illegal */ {\n  background-color: #b52a1d;\n  color: #f8f8f8;\n}\n\n.pl-sr .pl-cce /* string.regexp constant.character.escape */ {\n  color: #63a35c;\n  font-weight: bold;\n}\n\n.pl-ml /* markup.list */ {\n  color: #693a17;\n}\n\n.pl-mh        /* markup.heading */,\n.pl-mh .pl-en /* markup.heading entity.name */,\n.pl-ms        /* meta.separator */ {\n  color: #1d3e81;\n  font-weight: bold;\n}\n\n.pl-mq /* markup.quote */ {\n  color: #008080;\n}\n\n.pl-mi /* markup.italic */ {\n  color: #333;\n  font-style: italic;\n}\n\n.pl-mb /* markup.bold */ {\n  color: #333;\n  font-weight: bold;\n}\n\n.pl-md /* markup.deleted, meta.diff.header.from-file */ {\n  background-color: #ffecec;\n  color: #bd2c00;\n}\n\n.pl-mi1 /* markup.inserted, meta.diff.header.to-file */ {\n  background-color: #eaffea;\n  color: #55a532;\n}\n\n.pl-mdr /* meta.diff.range */ {\n  color: #795da3;\n  font-weight: bold;\n}\n\n.pl-mo /* meta.output */ {\n  color: #1d3e81;\n}\n\n"
  },
  {
    "path": "docs/assets/getting-started-assets/stylesheets/stylesheet.css",
    "content": "@import url(github-light.css);\n\n/*\nOverrides by mweststrate\n*/\n#usps {\n  border-style: none;\n}\n#usps td {\n  border-style: none;\n  vertical-align: top;\n  text-align: center;\n  width: 50%;\n}\n#usps h4 {\n  text-transform: uppercase;\n}\n#approot {\n  padding: 20px;\n  background-color: white;\n  border: 3px solid orange;\n\n}\n#logo {\n  float: left;\n  border-style: none;\n  box-shadow: none;\n  margin-right: 20px;\n  height: 100px;\n}\n#overview_content {\n  background-color: #ff9955;\n}\n#overview_content h3{\n  color: #fff;\n}\n#overview_content .inner {\n  text-align: center;\n  padding: 0;\n}\n#overview_img {\n  margin: auto;\n  width: 520px;\n  box-shadow: none;\n  border-style: none;\n}\n#shout {\n  text-align: center;\n  color: #ff9955;\n}\n\n/*******************************************************************************\nSlate Theme for GitHub Pages\nby Jason Costello, @jsncostello\n*******************************************************************************/\n\n\n/*******************************************************************************\nMeyerWeb Reset\n*******************************************************************************/\n\nhtml, body, div, span, applet, object, iframe,\nh1, h2, h3, h4, h5, h6, p, blockquote, pre,\na, abbr, acronym, address, big, cite, code,\ndel, dfn, em, img, ins, kbd, q, s, samp,\nsmall, strike, strong, sub, sup, tt, var,\nb, u, i, center,\ndl, dt, dd, ol, ul, li,\nfieldset, form, label, legend,\ntable, caption, tbody, tfoot, thead, tr, th, td,\narticle, aside, canvas, details, embed,\nfigure, figcaption, footer, header, hgroup,\nmenu, nav, output, ruby, section, summary,\ntime, mark, audio, video {\n  margin: 0;\n  padding: 0;\n  border: 0;\n  font: inherit;\n  vertical-align: baseline;\n}\n\n/* HTML5 display-role reset for older browsers */\narticle, aside, details, figcaption, figure,\nfooter, header, hgroup, menu, nav, section {\n  display: block;\n}\n\nol, ul {\n  list-style: none;\n}\n\ntable {\n  border-collapse: collapse;\n  border-spacing: 0;\n}\n\n/*******************************************************************************\nTheme Styles\n*******************************************************************************/\n\nbody {\n  box-sizing: border-box;\n  color:#373737;\n  background: #212121;\n  font-size: 16px;\n  font-family: 'Myriad Pro', Calibri, Helvetica, Arial, sans-serif;\n  line-height: 1.5;\n  -webkit-font-smoothing: antialiased;\n}\n\nh1, h2, h3, h4, h5, h6 {\n  margin: 10px 0;\n  font-weight: 700;\n  color:#222222;\n  font-family: 'Lucida Grande', 'Calibri', Helvetica, Arial, sans-serif;\n  letter-spacing: -1px;\n}\n\nh1 {\n  font-size: 36px;\n  font-weight: 700;\n}\n\nh2 {\n  padding-bottom: 10px;\n  font-size: 32px;\n  background: url('../images/bg_hr.png') repeat-x bottom;\n}\n\nh3 {\n  font-size: 24px;\n}\n\nh4 {\n  font-size: 21px;\n}\n\nh5 {\n  font-size: 18px;\n}\n\nh6 {\n  font-size: 16px;\n}\n\np {\n  margin: 10px 0 15px 0;\n}\n\nfooter p {\n  color: #f2f2f2;\n}\n\na {\n  text-decoration: none;\n  color: #007edf;\n  text-shadow: none;\n\n  transition: color 0.5s ease;\n  transition: text-shadow 0.5s ease;\n  -webkit-transition: color 0.5s ease;\n  -webkit-transition: text-shadow 0.5s ease;\n  -moz-transition: color 0.5s ease;\n  -moz-transition: text-shadow 0.5s ease;\n  -o-transition: color 0.5s ease;\n  -o-transition: text-shadow 0.5s ease;\n  -ms-transition: color 0.5s ease;\n  -ms-transition: text-shadow 0.5s ease;\n}\n\na:hover, a:focus {text-decoration: underline;}\n\nfooter a {\n  color: #F2F2F2;\n  text-decoration: underline;\n}\n\nem {\n  font-style: italic;\n}\n\nstrong {\n  font-weight: bold;\n}\n\nimg {\n  position: relative;\n  margin: 0 auto;\n  max-width: 739px;\n  padding: 5px;\n  margin: 10px 0 10px 0;\n  border: 1px solid #ebebeb;\n\n  box-shadow: 0 0 5px #ebebeb;\n  -webkit-box-shadow: 0 0 5px #ebebeb;\n  -moz-box-shadow: 0 0 5px #ebebeb;\n  -o-box-shadow: 0 0 5px #ebebeb;\n  -ms-box-shadow: 0 0 5px #ebebeb;\n}\n\np img {\n  display: inline;\n  margin: 0;\n  padding: 0;\n  vertical-align: middle;\n  text-align: center;\n  border: none;\n}\n\npre, code {\n  width: 100%;\n  color: #222;\n  background-color: #fff;\n\n  font-family: Monaco, \"Bitstream Vera Sans Mono\", \"Lucida Console\", Terminal, monospace;\n  font-size: 14px;\n\n  border-radius: 2px;\n  -moz-border-radius: 2px;\n  -webkit-border-radius: 2px;\n}\n\npre {\n  width: 100%;\n  padding: 10px;\n  box-shadow: 0 0 10px rgba(0,0,0,.1);\n  overflow: auto;\n}\n\ncode {\n  padding: 3px;\n  margin: 0 3px;\n  box-shadow: 0 0 10px rgba(0,0,0,.1);\n}\n\npre code {\n  display: block;\n  box-shadow: none;\n}\n\nblockquote {\n  color: #666;\n  margin-bottom: 20px;\n  padding: 0 0 0 20px;\n  border-left: 3px solid #bbb;\n}\n\n\nul, ol, dl {\n  margin-bottom: 15px\n}\n\nul {\n  list-style-position: inside;\n  list-style: disc;\n  padding-left: 20px;\n}\n\nol {\n  list-style-position: inside;\n  list-style: decimal;\n  padding-left: 20px;\n}\n\ndl dt {\n  font-weight: bold;\n}\n\ndl dd {\n  padding-left: 20px;\n  font-style: italic;\n}\n\ndl p {\n  padding-left: 20px;\n  font-style: italic;\n}\n\nhr {\n  height: 1px;\n  margin-bottom: 5px;\n  border: none;\n  background: url('../images/bg_hr.png') repeat-x center;\n}\n\ntable {\n  border: 1px solid #373737;\n  margin-bottom: 20px;\n  text-align: left;\n }\n\nth {\n  font-family: 'Lucida Grande', 'Helvetica Neue', Helvetica, Arial, sans-serif;\n  padding: 10px;\n  background: #373737;\n  color: #fff;\n }\n\ntd {\n  padding: 10px;\n  border: 1px solid #373737;\n }\n\nform {\n  background: #f2f2f2;\n  padding: 20px;\n}\n\n/*******************************************************************************\nFull-Width Styles\n*******************************************************************************/\n\n.outer {\n  width: 100%;\n}\n\n.inner {\n  position: relative;\n  max-width: 640px;\n  padding: 20px 10px;\n  margin: 0 auto;\n}\n\n#forkme_banner {\n  display: block;\n  position: absolute;\n  top:0;\n  right: 10px;\n  z-index: 10;\n  padding: 10px 50px 10px 10px;\n  color: #fff;\n  background: url('../images/blacktocat.png') #0090ff no-repeat 95% 50%;\n  font-weight: 700;\n  box-shadow: 0 0 10px rgba(0,0,0,.5);\n  border-bottom-left-radius: 2px;\n  border-bottom-right-radius: 2px;\n}\n\n#header_wrap {\n  background: #212121;\n  background: -moz-linear-gradient(top, #373737, #212121);\n  background: -webkit-linear-gradient(top, #373737, #212121);\n  background: -ms-linear-gradient(top, #373737, #212121);\n  background: -o-linear-gradient(top, #373737, #212121);\n  background: linear-gradient(top, #373737, #212121);\n}\n\n#header_wrap .inner {\n  padding: 40px 10px 10px 10px; /*50px 10px 30px 10px*/\n\n}\n\n#project_title {\n  margin: 0;\n  color: #fff;\n  font-size: 42px;\n  font-weight: 700;\n  text-shadow: #111 0px 0px 10px;\n}\n\n#project_tagline {\n  color: #fff;\n  font-size: 24px;\n  font-weight: 300;\n  background: none;\n  text-shadow: #111 0px 0px 10px;\n}\n\n#downloads {\n  position: absolute;\n  width: 210px;\n  z-index: 10;\n  bottom: -40px;\n  right: 0;\n  height: 70px;\n  background: url('../images/icon_download.png') no-repeat 0% 90%;\n}\n\n.zip_download_link {\n  display: block;\n  float: right;\n  width: 90px;\n  height:70px;\n  text-indent: -5000px;\n  overflow: hidden;\n  background: url(../images/sprite_download.png) no-repeat bottom left;\n}\n\n.tar_download_link {\n  display: block;\n  float: right;\n  width: 90px;\n  height:70px;\n  text-indent: -5000px;\n  overflow: hidden;\n  background: url(../images/sprite_download.png) no-repeat bottom right;\n  margin-left: 10px;\n}\n\n.zip_download_link:hover {\n  background: url(../images/sprite_download.png) no-repeat top left;\n}\n\n.tar_download_link:hover {\n  background: url(../images/sprite_download.png) no-repeat top right;\n}\n\n#main_content_wrap {\n  background: #f2f2f2;\n  /*border-top: 1px solid #111;*/\n  border-bottom: 1px solid #111;\n}\n\n#main_content {\n  padding-top: 10px;/*40px*/\n}\n\n#footer_wrap {\n  background: #212121;\n}\n\n\n\n/*******************************************************************************\nSmall Device Styles\n*******************************************************************************/\n\n@media screen and (max-width: 480px) {\n  body {\n    font-size:14px;\n  }\n\n  #downloads {\n    display: none;\n  }\n\n  .inner {\n    min-width: 320px;\n    max-width: 480px;\n  }\n\n  #project_title {\n  font-size: 32px;\n  }\n\n  h1 {\n    font-size: 28px;\n  }\n\n  h2 {\n    font-size: 24px;\n  }\n\n  h3 {\n    font-size: 21px;\n  }\n\n  h4 {\n    font-size: 18px;\n  }\n\n  h5 {\n    font-size: 14px;\n  }\n\n  h6 {\n    font-size: 12px;\n  }\n\n  code, pre {\n    min-width: 320px;\n    max-width: 480px;\n    font-size: 11px;\n  }\n\n}\n"
  },
  {
    "path": "docs/backers-sponsors.md",
    "content": "---\ntitle: MobX Backers and Sponsors\nhide_title: true\n---\n\n<script async type=\"text/javascript\" src=\"//cdn.carbonads.com/carbon.js?serve=CEBD4KQ7&placement=mobxjsorg\" id=\"_carbonads_js\"></script>\n\n# MobX Backers and Sponsors\n\nThanks to your backers and sponsors for their generous support!\n\n## Backers\n\nSupport us with a monthly donation and help us continue our activities. [[Become a backer](https://opencollective.com/mobx#backer)]\n\n<a href=\"https://opencollective.com/mobx/backer/0/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/backer/0/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/backer/1/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/backer/1/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/backer/2/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/backer/2/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/backer/3/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/backer/3/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/backer/4/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/backer/4/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/backer/5/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/backer/5/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/backer/6/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/backer/6/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/backer/7/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/backer/7/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/backer/8/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/backer/8/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/backer/9/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/backer/9/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/backer/10/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/backer/10/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/backer/11/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/backer/11/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/backer/12/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/backer/12/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/backer/13/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/backer/13/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/backer/14/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/backer/14/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/backer/15/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/backer/15/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/backer/16/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/backer/16/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/backer/17/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/backer/17/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/backer/18/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/backer/18/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/backer/19/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/backer/19/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/backer/20/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/backer/20/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/backer/21/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/backer/21/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/backer/22/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/backer/22/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/backer/23/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/backer/23/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/backer/24/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/backer/24/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/backer/25/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/backer/25/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/backer/26/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/backer/26/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/backer/27/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/backer/27/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/backer/28/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/backer/28/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/backer/29/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/backer/29/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/backer/30/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/backer/30/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/backer/31/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/backer/31/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/backer/32/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/backer/32/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/backer/33/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/backer/33/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/backer/34/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/backer/34/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/backer/35/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/backer/35/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/backer/36/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/backer/36/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/backer/37/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/backer/37/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/backer/38/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/backer/38/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/backer/39/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/backer/39/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/backer/40/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/backer/40/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/backer/41/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/backer/41/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/backer/42/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/backer/42/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/backer/43/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/backer/43/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/backer/44/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/backer/44/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/backer/45/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/backer/45/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/backer/46/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/backer/46/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/backer/47/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/backer/47/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/backer/48/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/backer/48/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/backer/49/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/backer/49/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/backer/50/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/backer/50/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/backer/51/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/backer/51/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/backer/52/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/backer/52/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/backer/53/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/backer/53/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/backer/54/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/backer/54/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/backer/55/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/backer/55/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/backer/56/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/backer/56/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/backer/57/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/backer/57/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/backer/58/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/backer/58/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/backer/59/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/backer/59/avatar.svg\"></a>\n\n## Sponsors\n\nBecome a sponsor and get your logo on our README on Github with a link to your site. [[Become a sponsor](https://opencollective.com/mobx#sponsor)]\n\n<a href=\"https://opencollective.com/mobx/sponsor/0/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/sponsor/0/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/sponsor/1/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/sponsor/1/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/sponsor/2/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/sponsor/2/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/sponsor/3/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/sponsor/3/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/sponsor/4/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/sponsor/4/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/sponsor/5/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/sponsor/5/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/sponsor/6/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/sponsor/6/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/sponsor/7/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/sponsor/7/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/sponsor/8/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/sponsor/8/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/sponsor/9/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/sponsor/9/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/sponsor/10/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/sponsor/10/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/sponsor/11/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/sponsor/11/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/sponsor/12/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/sponsor/12/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/sponsor/13/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/sponsor/13/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/sponsor/14/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/sponsor/14/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/sponsor/15/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/sponsor/15/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/sponsor/16/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/sponsor/16/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/sponsor/17/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/sponsor/17/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/sponsor/18/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/sponsor/18/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/sponsor/19/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/sponsor/19/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/sponsor/20/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/sponsor/20/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/sponsor/21/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/sponsor/21/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/sponsor/22/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/sponsor/22/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/sponsor/23/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/sponsor/23/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/sponsor/24/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/sponsor/24/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/sponsor/25/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/sponsor/25/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/sponsor/26/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/sponsor/26/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/sponsor/27/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/sponsor/27/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/sponsor/28/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/sponsor/28/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/sponsor/29/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/sponsor/29/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/sponsor/30/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/sponsor/30/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/sponsor/31/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/sponsor/31/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/sponsor/32/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/sponsor/32/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/sponsor/33/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/sponsor/33/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/sponsor/34/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/sponsor/34/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/sponsor/35/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/sponsor/35/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/sponsor/36/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/sponsor/36/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/sponsor/37/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/sponsor/37/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/sponsor/38/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/sponsor/38/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/sponsor/39/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/sponsor/39/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/sponsor/40/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/sponsor/40/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/sponsor/41/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/sponsor/41/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/sponsor/42/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/sponsor/42/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/sponsor/43/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/sponsor/43/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/sponsor/44/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/sponsor/44/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/sponsor/45/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/sponsor/45/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/sponsor/46/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/sponsor/46/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/sponsor/47/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/sponsor/47/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/sponsor/48/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/sponsor/48/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/sponsor/49/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/sponsor/49/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/sponsor/50/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/sponsor/50/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/sponsor/51/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/sponsor/51/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/sponsor/52/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/sponsor/52/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/sponsor/53/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/sponsor/53/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/sponsor/54/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/sponsor/54/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/sponsor/55/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/sponsor/55/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/sponsor/56/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/sponsor/56/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/sponsor/57/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/sponsor/57/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/sponsor/58/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/sponsor/58/avatar.svg\"></a>\n<a href=\"https://opencollective.com/mobx/sponsor/59/website\" target=\"_blank\"><img src=\"https://opencollective.com/mobx/sponsor/59/avatar.svg\"></a>\n"
  },
  {
    "path": "docs/best/debugging-mobx.md",
    "content": "---\ntitle: Analyzing reactivity\nhide_title: true\n---\n\n<script async type=\"text/javascript\" src=\"//cdn.carbonads.com/carbon.js?serve=CEBD4KQ7&placement=mobxjsorg\" id=\"_carbonads_js\"></script>\n\n# This document has been updated and moved\n\n[Please click on this link to open the updated version.](../analyzing-reactivity.md)\n"
  },
  {
    "path": "docs/best/decorators.md",
    "content": "---\ntitle: Enabling decorators\nhide_title: true\n---\n\n<script async type=\"text/javascript\" src=\"//cdn.carbonads.com/carbon.js?serve=CEBD4KQ7&placement=mobxjsorg\" id=\"_carbonads_js\"></script>\n\n# This document has been updated and moved\n\n[Please click on this link to open the updated version.](../enabling-decorators.md)\n"
  },
  {
    "path": "docs/best/store.md",
    "content": "---\ntitle: Defining data stores\nhide_title: true\n---\n\n<script async type=\"text/javascript\" src=\"//cdn.carbonads.com/carbon.js?serve=CEBD4KQ7&placement=mobxjsorg\" id=\"_carbonads_js\"></script>\n\n# This document has been updated and moved\n\n[Please click on this link to open the updated version.](../defining-data-stores.md)\n"
  },
  {
    "path": "docs/best/what-does-mobx-react-to.md",
    "content": "---\ntitle: Understanding reactivity\nhide_title: true\n---\n\n<script async type=\"text/javascript\" src=\"//cdn.carbonads.com/carbon.js?serve=CEBD4KQ7&placement=mobxjsorg\" id=\"_carbonads_js\"></script>\n\n# This document has been updated and moved\n\n[Please click on this link to open the updated version.](../understanding-reactivity.md)\n"
  },
  {
    "path": "docs/collection-utilities.md",
    "content": "---\ntitle: Collection utilities\nsidebar_label: Collection utilities {🚀}\nhide_title: true\n---\n\n<script async type=\"text/javascript\" src=\"//cdn.carbonads.com/carbon.js?serve=CEBD4KQ7&placement=mobxjsorg\" id=\"_carbonads_js\"></script>\n\n# Collection utilities {🚀}\n\nThey enable manipulating observable arrays, objects and Maps with the same generic API.\nThese APIs are fully reactive, which means that even [without `Proxy` support](configuration.md#limitations-without-proxy-support) new property declarations can be detected by MobX if `set` is used to add them, and `values` or `keys` are used to iterate over them.\n\nAnother benefit of `values`, `keys` and `entries` is that they return arrays rather than iterators, which makes it possible to, for example, immediately call `.map(fn)` on the results.\n\nAll that being said, a typical project has little reason to use these APIs.\n\nAccess:\n\n-   `values(collection)` returns an array of all the values in the collection.\n-   `keys(collection)` returns an array of all the keys in the collection.\n-   `entries(collection)` returns an array of all the entries `[key, value]` pairs in the collection.\n\nMutation:\n\n-   `set(collection, key, value)` or `set(collection, { key: value })` update the given collection with the provided key / value pair(s).\n-   `remove(collection, key)` removes the specified child from the collection. Splicing is used for arrays.\n-   `has(collection, key)` returns _true_ if the collection has the specified _observable_ property.\n-   `get(collection, key)` returns the child under the specified key.\n\nIf you use the access APIs in an environment without `Proxy` support, then also use the mutation APIs so they can detect the changes.\n\n```javascript\nimport { autorun, get, set, observable, values } from \"mobx\"\n\nconst twitterUrls = observable.object({\n    Joe: \"twitter.com/joey\"\n})\n\nautorun(() => {\n    // Get can track not yet existing properties.\n    console.log(get(twitterUrls, \"Sara\"))\n})\n\nautorun(() => {\n    console.log(\"All urls: \" + values(twitterUrls).join(\", \"))\n})\n\nset(twitterUrls, { Sara: \"twitter.com/horsejs\" })\n```\n"
  },
  {
    "path": "docs/computeds-with-args.md",
    "content": "---\ntitle: Computeds with arguments\nsidebar_label: Computeds with arguments {🚀}\nhide_title: true\n---\n\n<script async type=\"text/javascript\" src=\"//cdn.carbonads.com/carbon.js?serve=CEBD4KQ7&placement=mobxjsorg\" id=\"_carbonads_js\"></script>\n\n# Computeds with arguments {🚀}\n\nThe `computed` annotation can only be used on getters, which don't take arguments.\nWhat about computations that do take arguments?\nTake the below example of a React component that renders a specific `Item`,\nand the application supports multi-selection.\n\nHow can we implement a derivation like `store.isSelected(item.id)`?\n\n```javascript\nimport * as React from 'react'\nimport { observer } from 'mobx-react-lite'\n\nconst Item = observer(({ item, store }) => (\n    <div className={store.isSelected(item.id) ? \"selected\" : \"\"}>\n        {item.title}\n    </div>\n))\n```\n\nThere are four ways in which we can approach this. You can try the solutions below in [this CodeSandbox](https://codesandbox.io/s/multi-selection-odup1?file=/src/index.tsx).\n\n## 1. Derivations don't _need_ to be `computed`\n\nA function doesn't need to be marked as `computed` in order for MobX to track it.\nThe above example would already work completely fine out of the box.\nIt is important to realize that computed values are only _caching points_.\nIf the derivations are pure (and they should be), having a getter or function without `computed` doesn't change the behavior, it is just slightly less efficient.\n\nThe above example works fine despite `isSelected` not being a `computed`. The `observer` component will detect and subscribe to any observables that were read by `isSelected` because the function executes as part of rendering that is tracked.\n\nIt is good to realize that all `Item` components, in this case, will respond to future selection changes,\nas they all subscribe directly to the observables that capture the selection.\nThis is a worst-case example. In general, it is completely fine to have unmarked functions that derive information, and this is a good default strategy until numbers prove anything else should be done.\n\n## 2. Close over the arguments\n\nThis is a more efficient implementation compared to the original.\n\n```javascript\nimport * as React from 'react'\nimport { computed } from 'mobx'\nimport { observer } from 'mobx-react-lite'\n\nconst Item = observer(({ item, store }) => {\n    const isSelected = computed(() => store.isSelected(item.id)).get()\n    return (\n        <div className={isSelected ? \"selected\" : \"\"}>\n            {item.title}\n        </div>\n    )\n})\n```\n\nWe create a fresh computed value in the middle of a reaction. This works fine and does introduce that additional caching point, avoiding all components having to directly respond to every selection change.\nThe advantage of this approach is that the component itself will only re-render if the\n`isSelected` state toggles, in which case we indeed have to re-render to swap the `className`.\n\nThe fact that we create a new `computed` in a next render is fine, this one will now become the caching\npoint and the previous one will be cleaned up nicely.\nThis is a great and advanced optimization technique.\n\n## 3. Move the state\n\nIn this specific case the selection could also be stored as an `isSelected` observable on the `Item`. The selection in the store could then be expressed as a `computed` rather than an observable: `get selection() { return this.items.filter(item => item.isSelected) }`, and we don't need `isSelected` anymore.\n\n## 4. Use computedFn {🚀}\n\nFinally,\n[`computedFn`](https://github.com/mobxjs/mobx-utils#computedfn) from `mobx-utils` can be used in the definition of `todoStore.selected` to automatically memoize `isSelected`.\nIt creates a function that memoizes the output for every combination of input arguments.\n\nWe recommend to not resort to this one too quickly. It is typical for memoization, that you will need to think about how many different arguments the function is going to be called with, before you can reason about the memory consumption.\nIt does however automatically clean up entries if their results aren't observed by any reaction, so it won't leak memory in normal circumstances.\n\nAgain, check out the [linked CodeSandbox](https://codesandbox.io/s/multi-selection-odup1?file=/src/index.tsx) to try this one out.\n"
  },
  {
    "path": "docs/computeds.md",
    "content": "---\ntitle: Deriving information with computeds\nsidebar_label: Computeds\nhide_title: true\n---\n\n<script async type=\"text/javascript\" src=\"//cdn.carbonads.com/carbon.js?serve=CEBD4KQ7&placement=mobxjsorg\" id=\"_carbonads_js\"></script>\n\n# Deriving information with computeds\n\nUsage:\n\n-   `computed` _(annotation)_\n-   `computed(options)` _(annotation)_\n-   `computed(fn, options?)`\n-   `@computed` _(getter decorator)_\n-   `@computed(options)` _(getter decorator)_\n\nComputed values can be used to derive information from other observables.\nThey evaluate lazily, caching their output and only recomputing if one of the underlying observables has changed.\nIf they are not observed by anything, they suspend entirely.\n\nConceptually, they are very similar to formulas in spreadsheets, and can't be underestimated. They help in reducing the amount of state you have to store and are highly optimized. Use them wherever possible.\n\n## Example\n\nComputed values can be created by annotating JavaScript [getters](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/get) with `computed`.\nUse `makeObservable` to declare a getter as computed. If you instead want all getters to be automatically declared as `computed`, you can use either `makeAutoObservable`, `observable` or `extendObservable`. Computed getters become non-enumerable.\n\nTo help illustrate the point of computed values, the example below relies on [`autorun`](reactions.md#autorun) from the [Reactions {🚀}](reactions.md) advanced section.\n\n```javascript\nimport { makeObservable, observable, computed, autorun } from \"mobx\"\n\nclass OrderLine {\n    price = 0\n    amount = 1\n\n    constructor(price) {\n        makeObservable(this, {\n            price: observable,\n            amount: observable,\n            total: computed\n        })\n        this.price = price\n    }\n\n    get total() {\n        console.log(\"Computing...\")\n        return this.price * this.amount\n    }\n}\n\nconst order = new OrderLine(0)\n\nconst stop = autorun(() => {\n    console.log(\"Total: \" + order.total)\n})\n// Computing...\n// Total: 0\n\nconsole.log(order.total)\n// (No recomputing!)\n// 0\n\norder.amount = 5\n// Computing...\n// (No autorun)\n\norder.price = 2\n// Computing...\n// Total: 10\n\nstop()\n\norder.price = 3\n// Neither the computation nor autorun will be recomputed.\n```\n\nThe above example nicely demonstrates the benefits of a `computed` value, it acts as a caching point.\nEven though we change the `amount`, and this will trigger the `total` to recompute,\nit won't trigger the `autorun`, as `total` will detect its output hasn't been affected, so there is no need to update the `autorun`.\n\nIn comparison, if `total` would not be annotated, the `autorun` would run its effect 3 times,\nas it would directly depend on `price` and `amount`. [Try it out yourself](https://codesandbox.io/s/computed-3cjo9?file=/src/index.tsx).\n\n![computed graph](assets/computed-example.png)\n\nThis is the dependency graph that would be created for the above example.\n\n## Rules\n\nWhen using computed values there are a couple of best practices to follow:\n\n1. They should not have side effects or update other observables.\n2. Avoid creating and returning new observables.\n3. They should not depend on non-observable values.\n\n## Tips\n\n<details id=\"computed-suspend\"><summary>**Tip:** computed values will be suspended if they are _not_ observed<a href=\"#computed-suspend\" class=\"tip-anchor\"></a></summary>\n\nIt sometimes confuses people new to MobX, perhaps used to a library like [Reselect](https://github.com/reduxjs/reselect), that if you create a computed property but don't use it anywhere in a reaction, it is not memoized and appears to be recomputed more often than necessary.\nFor example, if we extended the above example with calling `console.log(order.total)` twice, after we called `stop()`, the value would be recomputed twice.\n\nThis allows MobX to automatically suspend computations that are not actively in use\nto avoid unnecessary updates to computed values that are not being accessed. But if a computed property is _not_ in use by some reaction, then computed expressions are evaluated each time their value is requested, so they behave just like a normal property.\n\nIf you only fiddle around computed properties might not seem efficient, but when applied in a project that uses `observer`, `autorun`, etc., they become very efficient.\n\nThe following code demonstrates the issue:\n\n```javascript\n// OrderLine has a computed property `total`.\nconst line = new OrderLine(2.0)\n\n// If you access `line.total` outside of a reaction, it is recomputed every time.\nsetInterval(() => {\n    console.log(line.total)\n}, 60)\n```\n\nIt can be overridden by setting the annotation with the `keepAlive` option ([try it out yourself](https://codesandbox.io/s/computed-3cjo9?file=/src/index.tsx)) or by creating a no-op `autorun(() => { someObject.someComputed })`, which can be nicely cleaned up later if needed.\nNote that both solutions have the risk of creating memory leaks. Changing the default behavior here is an anti-pattern.\n\nMobX can also be configured with the [`computedRequiresReaction`](configuration.md#computedrequiresreaction-boolean) option, to report an error when computeds are accessed outside of a reactive context.\n\n</details>\n\n<details id=\"computed-setter\"><summary>**Tip:** computed values can have setters<a href=\"#computed-setter\" class=\"tip-anchor\"></a></summary>\n\nIt is possible to define a [setter](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/set) for computed values as well. Note that these setters cannot be used to alter the value of the computed property directly,\nbut they can be used as an \"inverse\" of the derivation. Setters are automatically marked as actions. For example:\n\n```javascript\nclass Dimension {\n    length = 2\n\n    constructor() {\n        makeAutoObservable(this)\n    }\n\n    get squared() {\n        return this.length * this.length\n    }\n    set squared(value) {\n        this.length = Math.sqrt(value)\n    }\n}\n```\n\n</details>\n\n<details id=\"computed-struct\"><summary>{🚀} **Tip:** `computed.struct` for comparing output structurally <a href=\"#computed-struct\" class=\"tip-anchor\"></a></summary>\n\nIf the output of a computed value that is structurally equivalent to the previous computation doesn't need to notify observers, `computed.struct` can be used. It will make a structural comparison first, rather than a reference equality check, before notifying observers. For example:\n\n```javascript\nclass Box {\n    width = 0\n    height = 0\n\n    constructor() {\n        makeObservable(this, {\n            width: observable,\n            height: observable,\n            topRight: computed.struct\n        })\n    }\n\n    get topRight() {\n        return {\n            x: this.width,\n            y: this.height\n        }\n    }\n}\n```\n\nBy default, the output of a `computed` is compared by reference. Since `topRight` in the above example will always produce a new result object, it is never going to be considered equal to a previous output. Unless `computed.struct` is used.\n\nHowever, in the above example _we actually don't need `computed.struct`_!\nComputed values normally only re-evaluate if the backing values change.\nThat's why `topRight` will only react to changes in `width` or `height`.\nSince if any of those change, we would get a different `topRight` coordinate anyway. `computed.struct` would never have a cache hit and be a waste of effort, so we don't need it.\n\nIn practice, `computed.struct` is less useful than it sounds. Only use it if changes in the underlying observables can still lead to the same output. For example, if we were rounding the coordinates first, the rounded coordinates might be equal to the previously rounded coordinates even though the underlying values aren't.\n\nCheck out the [`equals`](#equals) option for further customizations on determining whether the output has changed.\n\n</details>\n\n<details id=\"computed-with-args\"><summary>{🚀} **Tip:** computed values with arguments<a href=\"#computed-with-args\" class=\"tip-anchor\"></a></summary>\n\nAlthough getters don't take arguments, several strategies to work with derived values that need arguments are discussed [here](computeds-with-args.md).\n\n</details>\n\n<details id=\"standalone\"><summary>{🚀} **Tip:** create standalone computed values with `computed(expression)`<a href=\"#standalone\" class=\"tip-anchor\"></a></summary>\n\n`computed` can also be invoked directly as a function, just like [`observable.box`](api.md#observablebox) creates a standalone computed value.\nUse `.get()` on the returned object to get the current value of the computation.\nThis form of `computed` is not used very often, but in some cases where you need to pass a \"boxed\" computed value around it might prove itself useful, one such case is discussed [here](computeds-with-args.md).\n\n</details>\n\n## Options {🚀}\n\n`computed` usually behaves the way you want it to out of the box, but it's possible to customize its behavior by passing in an `options` argument.\n\n### `name`\n\nThis string is used as a debug name in the [Spy event listeners](analyzing-reactivity.md#spy) and [MobX developer tools](https://github.com/mobxjs/mobx-devtools).\n\n### `equals`\n\nSet to `comparer.default` by default. It acts as a comparison function for comparing the previous value with the next value. If this function considers the values to be equal, then the observers will not be re-evaluated.\n\nThis is useful when working with structural data and types from other libraries. For example, a computed [moment](https://momentjs.com/) instance could use `(a, b) => a.isSame(b)`. `comparer.structural` and `comparer.shallow` come in handy if you want to use structural / shallow comparison to determine whether the new value is different from the previous value, and as a result notify its observers.\n\nCheck out the [`computed.struct`](#computed-struct) section above.\n\n#### Built-in comparers\n\nMobX provides four built-in `comparer` methods which should cover most needs of the `equals` option of `computed`:\n\n-   `comparer.identity` uses the identity (`===`) operator to determine if two values are the same.\n-   `comparer.default` is the same as `comparer.identity`, but also considers `NaN` to be equal to `NaN`.\n-   `comparer.structural` performs deep structural comparison to determine if two values are the same.\n-   `comparer.shallow` performs shallow structural comparison to determine if two values are the same.\n\nYou can import `comparer` from `mobx` to access these methods. They can be used for `reaction` as well.\n\n### `requiresReaction`\n\nIt is recommended to set this one to `true` on very expensive computed values. If you try to read its value outside of the reactive context, in which case it might not be cached, it will cause the computed to throw instead of doing an expensive re-evalution.\n\n### `keepAlive`\n\nThis avoids suspending computed values when they are not being observed by anything (see the above explanation). Can potentially create memory leaks, similar to the ones discussed for [reactions](reactions.md#always-dispose-of-reactions).\n"
  },
  {
    "path": "docs/configuration.md",
    "content": "---\ntitle: Configuration\nsidebar_label: Configuration {🚀}\nhide_title: true\n---\n\n<script async type=\"text/javascript\" src=\"//cdn.carbonads.com/carbon.js?serve=CEBD4KQ7&placement=mobxjsorg\" id=\"_carbonads_js\"></script>\n\n# Configuration {🚀}\n\nMobX has several configurations depending on how you prefer to use it, which JavaScript engines you want to target, and whether you want MobX to hint at best practices.\nMost configuration options can be set by using the `configure` method.\n\n## Proxy support\n\nBy default, MobX uses proxies to make arrays and plain objects observable. Proxies provide the best performance and most consistent behavior across environments.\nHowever, if you are targeting an environment that doesn't support proxies, proxy support has to be disabled.\nMost notably this is the case when targeting Internet Explorer or React Native without using the Hermes engine.\n\nProxy support can be disabled by using `configure`:\n\n```typescript\nimport { configure } from \"mobx\"\n\nconfigure({\n    useProxies: \"never\"\n})\n```\n\nAccepted values for the `useProxies` configuration are:\n\n-   `\"always\"` (**default**): MobX expects to run only in environments with [`Proxy` support](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy) and it will error if such an environment is not available.\n-   `\"never\"`: Proxies are not used and MobX falls back on non-proxy alternatives. This is compatible with all ES5 environments, but causes various [limitations](#limitations-without-proxy-support).\n-   `\"ifavailable\"` (experimental): Proxies are used if they are available, and otherwise MobX falls back to non-proxy alternatives. The benefit of this mode is that MobX will try to warn if APIs or language features that wouldn't work in ES5 environments are used, triggering errors when hitting an ES5 limitation running on a modern environment.\n\n**Note:** before MobX 6, one had to pick either MobX 4 for older engines, or MobX 5 for new engines. However, MobX 6 supports both, although polyfills for certain APIs like Map will be required when targetting older JavaScript engines.\nProxies cannot be polyfilled. Even though polyfills do exist, they don't support the full spec and are unsuitable for MobX. Don't use them.\n\n### Limitations without Proxy support\n\n1.  Observable arrays are not real arrays, so they won't pass the `Array.isArray()` check. The practical consequence is that you often need to `.slice()` the array first (to get a shallow copy of the real array) before passing it to third party libraries. For example, concatenating observable arrays doesn't work as expected, so `.slice()` them first.\n2.  Adding or deleting properties of existing observable plain objects after creation is not automatically picked up. If you intend to use objects as index based lookup maps, in other words, as dynamic collections of things, use observable Maps instead.\n\nIt is possible to dynamically add properties to objects, and detect their additions, even when Proxies aren't enabled.\nThis can be achieved by using the [Collection utilities {🚀}](collection-utilities.md). Make sure that (new) properties are set using the `set` utility, and that the objects are iterated using one of the `values` / `keys` or `entries` utilities, rather than the built-in JavaScript mechanisms.\nBut, since this is really easy to forget, we instead recommend using observable Maps if possible.\n\n## Decorator support\n\nFor enabling experimental decorator support check out the [Enabling decorators {🚀}](enabling-decorators.md) section.\n\n## Linting options\n\nTo help you adopt the patterns advocated by MobX, a strict separation between actions, state and derivations, MobX can _\"lint\"_ your coding patterns at runtime by hinting at smells. To make sure MobX is as strict as possible, adopt the following settings and read on for their explanations:\n\n```typescript\nimport { configure } from \"mobx\"\n\nconfigure({\n    enforceActions: \"always\",\n    computedRequiresReaction: true,\n    reactionRequiresObservable: true,\n    observableRequiresReaction: true,\n    disableErrorBoundaries: true\n})\n```\n\nAt some point you will discover that this level of strictness can be pretty annoying.\nIt is fine to disable these rules to gain productivity once you are sure you (and your colleagues) grokked the mental model of MobX.\n\nAlso, occasionally you will have a case where you have to suppress the warnings triggered by these rules (for example by wrapping in `runInAction`).\nThat is fine, there are good exceptions to these recommendations.\nDon't be fundamentalist about them.\n\nMake sure to also try our [`eslint` plugin](https://github.com/mobxjs/mobx/blob/main/packages/eslint-plugin-mobx/README.md).\nWhile some problems are discoverable statically, others are detectable only at runtime.\nThe plugin is intended to complement these rules, not to replace them.\nThe autofix feature can also help with the boilerplate code.\n\n#### `enforceActions`\n\nThe goal of _enforceActions_ is that you don't forget to wrap event handlers in [`action`](actions.md).\n\nPossible options:\n\n-   `\"observed\"` (**default**): All state that is observed _somewhere_ needs to be changed through actions. This is the default, and the recommended strictness mode in non-trivial applications.\n-   `\"never\"`: State can be changed from anywhere.\n-   `\"always\"`: State always needs to be changed through actions, which in practice also includes creation.\n\nThe benefit of `\"observed\"` is that it allows you to create observables outside of actions and modify them freely, as long as they aren't used anywhere yet.\n\nSince state should in principle always be created from some event handlers, and event handlers should be wrapped, `\"always\"` captures this the best. But you probably don't want to use this mode in unit tests.\n\nIn the rare case where you create observables lazily, for example in a computed property, you can wrap the creation ad-hoc in an action using `runInAction`.\n\n#### `computedRequiresReaction: boolean`\n\nForbids the direct access of any unobserved computed value from outside an action or reaction.\nThis guarantees you aren't using computed values in a way where MobX won't cache them. **Default: `false`**.\n\nIn the following example, MobX won't cache the computed value in the first code block, but will cache the result in the second and third block:\n\n```javascript\nclass Clock {\n    seconds = 0\n\n    get milliseconds() {\n        console.log(\"computing\")\n        return this.seconds * 1000\n    }\n\n    constructor() {\n        makeAutoObservable(this)\n    }\n}\n\nconst clock = new Clock()\n{\n    // This would compute twice, but is warned against by this flag.\n    console.log(clock.milliseconds)\n    console.log(clock.milliseconds)\n}\n{\n    runInAction(() => {\n        // Will compute only once.\n        console.log(clock.milliseconds)\n        console.log(clock.milliseconds)\n    })\n}\n{\n    autorun(() => {\n        // Will compute only once.\n        console.log(clock.milliseconds)\n        console.log(clock.milliseconds)\n    })\n}\n```\n\n#### `observableRequiresReaction: boolean`\n\nWarns about any unobserved observable access.\nUse this if you want to check whether you are using observables without a \"MobX context\".\nThis is a great way to find any missing `observer` wrappers, for example in React components. But it will find missing actions as well. **Default: `false`**\n\n```javascript\nconfigure({ observableRequiresReaction: true })\n```\n\n**Note:** using propTypes on components that are wrapped with `observer` might trigger false positives for this rule.\n\n#### `reactionRequiresObservable: boolean`\n\nWarns when a reaction (e.g. `autorun`) is created without accessing any observables.\nUse this to check whether you are unnecessarily wrapping React components with `observer`, wrapping functions with `action`, or find cases where you simply forgot to make some data structures or properties observable. **Default: `false`**\n\n```javascript\nconfigure({ reactionRequiresObservable: true })\n```\n\n#### `disableErrorBoundaries: boolean`\n\nBy default, MobX will catch and re-throw exceptions happening in your code to make sure that a reaction in one exception does not prevent the scheduled execution of other, possibly unrelated, reactions. This means exceptions are not propagated back to the original causing code and therefore you won't be able to catch them using try/catch.\n\nBy disabling error boundaries, exceptions can escape derivations. This might ease debugging, but might leave MobX and by extension your application in an unrecoverable broken state. **Default: `false`**.\n\nThis option is great for unit tests, but remember to call `_resetGlobalState` after each test, for example by using `afterEach` in jest, for example:\n\n```js\nimport { _resetGlobalState, observable, autorun, configure } from \"mobx\"\n\nconfigure({ disableErrorBoundaries: true })\n\ntest(\"Throw if age is negative\", () => {\n    expect(() => {\n        const age = observable.box(10)\n        autorun(() => {\n            if (age.get() < 0) throw new Error(\"Age should not be negative\")\n        })\n        age.set(-1)\n    }).toThrow(\"Age should not be negative\")\n})\n\nafterEach(() => {\n    _resetGlobalState()\n})\n```\n\n#### `safeDescriptors: boolean`\n\nMobX makes some fields **non-configurable** or **non-writable** to prevent you from doing things that are not supported or would most likely break your code. However this can also prevent **spying/mocking/stubbing** in your tests.\n`configure({ safeDescriptors: false })` disables this safety measure, making everything **configurable** and **writable**.\nNote it doesn't affect existing observables, only the ones created after it's been configured.\n<span style=\"color:red\">**Use with caution**</span> and only when needed - do not turn this off globally for all tests, otherwise you risk false positives (passing tests with broken code). **Default: `true`**\n\n```javascript\nconfigure({ safeDescriptors: false })\n```\n\n## Further configuration options\n\n#### `isolateGlobalState: boolean`\n\nIsolates the global state of MobX when there are multiple instances of MobX active in the same environment. This is useful when you have an encapsulated library that is using MobX, living in the same page as the app that is using MobX. The reactivity inside the library will remain self-contained when you call `configure({ isolateGlobalState: true })` from it.\n\nWithout this option, if multiple MobX instances are active, their internal state will be shared. The benefit is that observables from both instances work together, the downside is that the MobX versions have to match. **Default: `false`**\n\n```javascript\nconfigure({ isolateGlobalState: true })\n```\n\n#### `reactionScheduler: (f: () => void) => void`\n\nSets a new function that executes all MobX reactions.\nBy default `reactionScheduler` just runs the `f` reaction without any other behavior.\nThis can be useful for basic debugging, or slowing down reactions to visualize application updates. **Default: `f => f()`**\n\n```javascript\nconfigure({\n    reactionScheduler: (f): void => {\n        console.log(\"Running an event after a delay:\", f)\n        setTimeout(f, 100)\n    }\n})\n```\n"
  },
  {
    "path": "docs/custom-observables.md",
    "content": "---\ntitle: Creating custom observables\nsidebar_label: Custom observables {🚀}\nhide_title: true\n---\n\n<script async type=\"text/javascript\" src=\"//cdn.carbonads.com/carbon.js?serve=CEBD4KQ7&placement=mobxjsorg\" id=\"_carbonads_js\"></script>\n\n# Creating custom observables {🚀}\n\nAt some point you might want to have more data structures or other things (like streams) that can be used in reactive computations.\nAchieving this is pretty simple by using **atoms**, which is the class that MobX uses internally for all observable data types.\nAtoms can be used to signal to MobX that some observable data source has been observed or changed, and MobX will let the atom know when it's being used and when it's not.\n\n> _**Tip**: In many cases you can avoid the need to create your own atoms just by creating a normal observable, and using\nthe [`onBecomeObserved`](lazy-observables.md) utility to be notified when MobX starts tracking it._\n\nThe following example demonstrates how you can create an observable `Clock` that returns the current date-time, which can then be used in reactive functions.\nThis clock will only actually tick if it is being observed by someone.\n\nThe complete API of the `Atom` class is demonstrated by this example. For further information, see [`createAtom`](api.md#createAtom).\n\n```javascript\nimport { createAtom, autorun } from \"mobx\"\n\nclass Clock {\n    atom\n    intervalHandler = null\n    currentDateTime\n\n    constructor() {\n        // Creates an atom to interact with the MobX core algorithm.\n        this.atom = createAtom(\n            // 1st parameter:\n            // - Atom's name, for debugging purposes.\n            \"Clock\",\n            // 2nd (optional) parameter:\n            // - Callback for when this atom transitions from unobserved to observed.\n            () => this.startTicking(),\n            // 3rd (optional) parameter:\n            // - Callback for when this atom transitions from observed to unobserved.\n            () => this.stopTicking()\n            // The same atom transitions between these two states multiple times.\n        )\n    }\n\n    getTime() {\n        // Let MobX know this observable data source has been used.\n        //\n        // reportObserved will return true if the atom is currently being observed\n        // by some reaction. If needed, it will also trigger the startTicking\n        // onBecomeObserved event handler.\n        if (this.atom.reportObserved()) {\n            return this.currentDateTime\n        } else {\n            // getTime was called, but not while a reaction was running, hence\n            // nobody depends on this value, and the startTicking onBecomeObserved\n            // handler won't be fired.\n            //\n            // Depending on the nature of your atom it might behave differently\n            // in such circumstances, like throwing an error, returning a default\n            // value, etc.\n            return new Date()\n        }\n    }\n\n    tick() {\n        this.currentDateTime = new Date()\n        this.atom.reportChanged() // Let MobX know that this data source has changed.\n    }\n\n    startTicking() {\n        this.tick() // Initial tick.\n        this.intervalHandler = setInterval(() => this.tick(), 1000)\n    }\n\n    stopTicking() {\n        clearInterval(this.intervalHandler)\n        this.intervalHandler = null\n    }\n}\n\nconst clock = new Clock()\n\nconst disposer = autorun(() => console.log(clock.getTime()))\n// Prints the time every second.\n\n// Stop printing. If nobody else uses the same `clock`, it will stop ticking as well.\ndisposer()\n```\n"
  },
  {
    "path": "docs/defining-data-stores.md",
    "content": "---\ntitle: Defining data stores\nsidebar_label: Defining data stores\nhide_title: true\n---\n\n<script async type=\"text/javascript\" src=\"//cdn.carbonads.com/carbon.js?serve=CEBD4KQ7&placement=mobxjsorg\" id=\"_carbonads_js\"></script>\n\n# Defining data stores\n\nThis section contains some of the best practices for building large scale maintainable projects we discovered at Mendix while working with MobX.\nThis section is opinionated and you are in no way forced to apply these practices.\nThere are many ways of working with MobX and React, and this is just one of them.\n\nThis section focuses on an unobtrusive way of working with MobX, which works well in existing codebases, or with classic MVC patterns. Alternative, more opinionated ways of organizing stores are [mobx-state-tree](https://github.com/mobxjs/mobx-state-tree) and [mobx-keystone](https://mobx-keystone.js.org/). Both ship with cool features such as structurally shared snapshots, action middlewares, JSON patch support etc. out of the box.\n\n## Stores\n\nStores can be found in any Flux architecture and can be compared a bit with controllers in the MVC pattern.\nThe main responsibility of stores is to move _logic_ and _state_ out of your components into a standalone testable unit that can be used in both frontend and backend JavaScript.\n\nMost applications benefit from having at least two stores: one for the _domain state_ and another one for the _UI state_. The advantage of separating those two is you can reuse and test _domain state_ universally, and you might very well reuse it in other applications.\n\n## Domain Stores\n\nYour application will contain one or multiple _domain_ stores.\nThese stores store the data your application is all about.\nTodo items, users, books, movies, orders, you name it.\nYour application will most probably have at least one domain store.\n\nA single domain store should be responsible for a single concept in your application. A single store is often organized as a tree structure with\nmultiple domain objects inside.\n\nFor example: one domain store for your products, and one for your orders and orderlines.\nAs a rule of thumb: if the nature of the relationship between two items is containment, they should typically be in the same store.\nSo a store just manages _domain objects_.\n\nThese are the responsibilities of a store:\n\n-   Instantiate domain objects. Make sure domain objects know the store they belong to.\n-   Make sure there is only one instance of each of your domain objects.\n    The same user, order or todo should not be stored twice in memory.\n    This way you can safely use references and also be sure you are looking at the latest instance, without ever having to resolve a reference.\n    This is fast, straightforward and convenient when debugging.\n-   Provide backend integration. Store data when needed.\n-   Update existing instances if updates are received from the backend.\n-   Provide a standalone, universal, testable component of your application.\n-   To make sure your store is testable and can be run server-side, you will probably move doing actual websocket / http requests to a separate object so that you can abstract over your communication layer.\n-   There should be only one instance of a store.\n\n### Domain objects\n\nEach domain object should be expressed using its own class (or constructor function).\nThere is no need to treat your client-side application state as some kind of database.\nReal references, cyclic data structures and instance methods are powerful concepts in JavaScript.\nDomain objects are allowed to refer directly to domain objects from other stores.\nRemember: we want to keep our actions and views as simple as possible and needing to manage references and doing garbage collection yourself might be a step backward.\nUnlike many Flux architectures such as Redux, with MobX there is no need to normalize your data, and this makes it a lot simpler to build the _essentially_ complex parts of your application:\nyour business rules, actions and user interface.\n\nDomain objects can delegate all their logic to the store they belong to if that suits your application well.\nIt is possible to express your domain objects as plain objects, but classes have some important advantages over plain objects:\n\n-   They can have methods.\n    This makes your domain concepts easier to use standalone and reduces the amount of contextual awareness that is needed in your application.\n    Just pass objects around.\n    You don't have to pass stores around, or have to figure out which actions can be applied to an object if they are just available as instance methods.\n    This is especially important in large applications.\n-   They offer fine grained control over the visibility of attributes and methods.\n-   Objects created using a constructor function can freely mix observable properties and methods, and non-observable properties and methods.\n-   They are easily recognizable and can be strictly type-checked.\n\n### Example domain store\n\n```javascript\nimport { makeAutoObservable, runInAction, reaction } from \"mobx\"\nimport uuid from \"node-uuid\"\n\nexport class TodoStore {\n    authorStore\n    transportLayer\n    todos = []\n    isLoading = true\n\n    constructor(transportLayer, authorStore) {\n        makeAutoObservable(this)\n        this.authorStore = authorStore // Store that can resolve authors.\n        this.transportLayer = transportLayer // Thing that can make server requests.\n        this.transportLayer.onReceiveTodoUpdate(updatedTodo =>\n            this.updateTodoFromServer(updatedTodo)\n        )\n        this.loadTodos()\n    }\n\n    // Fetches all Todos from the server.\n    loadTodos() {\n        this.isLoading = true\n        this.transportLayer.fetchTodos().then(fetchedTodos => {\n            runInAction(() => {\n                fetchedTodos.forEach(json => this.updateTodoFromServer(json))\n                this.isLoading = false\n            })\n        })\n    }\n\n    // Update a Todo with information from the server. Guarantees a Todo only\n    // exists once. Might either construct a new Todo, update an existing one,\n    // or remove a Todo if it has been deleted on the server.\n    updateTodoFromServer(json) {\n        let todo = this.todos.find(todo => todo.id === json.id)\n        if (!todo) {\n            todo = new Todo(this, json.id)\n            this.todos.push(todo)\n        }\n        if (json.isDeleted) {\n            this.removeTodo(todo)\n        } else {\n            todo.updateFromJson(json)\n        }\n    }\n\n    // Creates a fresh Todo on the client and the server.\n    createTodo() {\n        const todo = new Todo(this)\n        this.todos.push(todo)\n        return todo\n    }\n\n    // A Todo was somehow deleted, clean it from the client memory.\n    removeTodo(todo) {\n        this.todos.splice(this.todos.indexOf(todo), 1)\n        todo.dispose()\n    }\n}\n\n// Domain object Todo.\nexport class Todo {\n    id = null // Unique id of this Todo, immutable.\n    completed = false\n    task = \"\"\n    author = null // Reference to an Author object (from the authorStore).\n    store = null\n    autoSave = true // Indicator for submitting changes in this Todo to the server.\n    saveHandler = null // Disposer of the side effect auto-saving this Todo (dispose).\n\n    constructor(store, id = uuid.v4()) {\n        makeAutoObservable(this, {\n            id: false,\n            store: false,\n            autoSave: false,\n            saveHandler: false,\n            dispose: false\n        })\n        this.store = store\n        this.id = id\n\n        this.saveHandler = reaction(\n            () => this.asJson, // Observe everything that is used in the JSON.\n            json => {\n                // If autoSave is true, send JSON to the server.\n                if (this.autoSave) {\n                    this.store.transportLayer.saveTodo(json)\n                }\n            }\n        )\n    }\n\n    // Remove this Todo from the client and the server.\n    delete() {\n        this.store.transportLayer.deleteTodo(this.id)\n        this.store.removeTodo(this)\n    }\n\n    get asJson() {\n        return {\n            id: this.id,\n            completed: this.completed,\n            task: this.task,\n            authorId: this.author ? this.author.id : null\n        }\n    }\n\n    // Update this Todo with information from the server.\n    updateFromJson(json) {\n        this.autoSave = false // Prevent sending of our changes back to the server.\n        this.completed = json.completed\n        this.task = json.task\n        this.author = this.store.authorStore.resolveAuthor(json.authorId)\n        this.autoSave = true\n    }\n\n    // Clean up the observer.\n    dispose() {\n        this.saveHandler()\n    }\n}\n```\n\n## UI stores\n\nThe _ui-state-store_ is often very specific for your application, but usually very simple as well.\nThis store typically doesn't have much logic in it, but will store a plethora of loosely coupled pieces of information about the UI.\nThis is ideal as most applications will change the UI state often during the development process.\n\nThings you will typically find in UI stores:\n\n-   Session information\n-   Information about how far your application has loaded\n-   Information that will not be stored in the backend\n-   Information that affects the UI globally\n    -   Window dimensions\n    -   Accessibility information\n    -   Current language\n    -   Currently active theme\n-   User interface state as soon as it affects multiple, further unrelated components:\n    -   Current selection\n    -   Visibility of toolbars, etc.\n    -   State of a wizard\n    -   State of a global overlay\n\nIt might very well be that these pieces of information start as internal state of a specific component (for example the visibility of a toolbar), but after a while you discover that you need this information somewhere else in your application.\nInstead of pushing state in such a case upwards in the component tree, like you would do in plain React apps, you just move that state to the _ui-state-store_.\n\nFor isomorphic applications you might also want to provide a stub implementation of this store with sane defaults so that all components render as expected.\nYou might distribute the _ui-state-store_ through your application by passing it as React context.\n\nExample of a store (using ES6 syntax):\n\n```javascript\nimport { makeAutoObservable, observable, computed } from \"mobx\"\n\nexport class UiState {\n    language = \"en_US\"\n    pendingRequestCount = 0\n\n    // .struct makes sure observer won't be signaled unless the\n    // dimensions object changed in a deepEqual manner.\n    windowDimensions = {\n        width: window.innerWidth,\n        height: window.innerHeight\n    }\n\n    constructor() {\n        makeAutoObservable(this, { windowDimensions: observable.struct })\n        window.onresize = () => {\n            this.windowDimensions = getWindowDimensions()\n        }\n    }\n\n    get appIsInSync() {\n        return this.pendingRequestCount === 0\n    }\n}\n```\n\n## Combining multiple stores\n\nAn often asked question is how to combine multiple stores without using singletons. How will they know about each other?\n\nAn effective pattern is to create a `RootStore` that instantiates all stores, and share references. The advantage of this pattern is:\n\n1. Simple to set up.\n2. Supports strong typing well.\n3. Makes complex unit tests easy as you just have to instantiate a root store.\n\nExample:\n\n```javascript\nclass RootStore {\n    constructor() {\n        this.userStore = new UserStore(this)\n        this.todoStore = new TodoStore(this)\n    }\n}\n\nclass UserStore {\n    constructor(rootStore) {\n        this.rootStore = rootStore\n    }\n\n    getTodos(user) {\n        // Access todoStore through the root store.\n        return this.rootStore.todoStore.todos.filter(todo => todo.author === user)\n    }\n}\n\nclass TodoStore {\n    todos = []\n    rootStore\n\n    constructor(rootStore) {\n        makeAutoObservable(this)\n        this.rootStore = rootStore\n    }\n}\n```\n\nWhen using React, this root store is typically inserted into the component tree by using React context.\n"
  },
  {
    "path": "docs/enabling-decorators.md",
    "content": "---\ntitle: Decorators\nsidebar_label: Decorators {🚀}\nhide_title: true\n---\n\n<script async type=\"text/javascript\" src=\"//cdn.carbonads.com/carbon.js?serve=CEBD4KQ7&placement=mobxjsorg\" id=\"_carbonads_js\"></script>\n\n# Decorators\n\n## Enabling decorators\n\nAfter years of alterations, ES decorators have finally reached Stage 3 in the TC39 process, meaning that they are quite stable and won't undergo breaking changes again like the previous decorator proposals have. MobX has implemented support for this new \"2022.3/Stage 3\" decorator syntax.\nWith modern decorators, it is no longer needed to call `makeObservable` / `makeAutoObservable`.\n\n2022.3 Decorators are supported in:\n\n-   TypeScript (5.0 and higher, make sure that the `experimentalDecorators` flag is NOT enabled). [Example commit](https://github.com/mweststrate/currencies-demo/commit/acb9ac8c148e8beef88042c847bb395131e85d60).\n-   For Babel make sure the plugin [`proposal-decorators`](https://babeljs.io/docs/babel-plugin-proposal-decorators) is enabled with the highest version (currently `2023-05`). [Example commit](https://github.com/mweststrate/currencies-demo/commit/4999d2228208f3e1e10bc00a272046eaefde8585).\n\n```js\n// tsconfig.json\n{\n    \"compilerOptions\": {\n        \"experimentalDecorators\": false /* or just remove the flag */\n    }\n}\n\n// babel.config.json (or equivalent)\n{\n    \"plugins\": [\n        [\n            \"@babel/plugin-proposal-decorators\",\n            {\n                \"version\": \"2023-05\"\n            }\n        ]\n    ]\n}\n```\n\n-   Vite configuration\n\n```js\n// vite.config.js\n{\n    plugins: [\n        react({\n            babel: {\n                plugins: [\n                    [\n                        \"@babel/plugin-proposal-decorators\",\n                        {\n                            version: \"2023-05\"\n                        }\n                    ]\n                ]\n            }\n        })\n    ]\n}\n```\n\n## Using decorators\n\n```javascript\nimport { observable, computed, action } from \"mobx\"\n\nclass Todo {\n    id = Math.random()\n    @observable accessor title = \"\"\n    @observable accessor finished = false\n\n    @action\n    toggle() {\n        this.finished = !this.finished\n    }\n}\n\nclass TodoList {\n    @observable accessor todos = []\n\n    @computed\n    get unfinishedTodoCount() {\n        return this.todos.filter(todo => !todo.finished).length\n    }\n}\n```\n\nNotice the usage of the new `accessor` keyword when using `@observable`.\nIt is part of the 2022.3 spec and is required if you want to use modern decorators.\n\n<details id=\"legacy-decorators\"><summary>Using legacy decorators</summary>\n\nWe do not recommend codebases to use TypeScript / Babel legacy decorators since they well never become an official part of the language, but you can still use them. It does require a specific setup for transpilation:\n\nMobX before version 6 encouraged the use of legacy decorators and mark things as `observable`, `computed` and `action`.\nWhile MobX 6 recommends against using these decorators (and instead use either modern decorators or [`makeObservable` / `makeAutoObservable`](observable-state.md)), it is in the current major version still possible.\nSupport for legacy decorators will be removed in MobX 7.\n\n```javascript\nimport { makeObservable, observable, computed, action } from \"mobx\"\n\nclass Todo {\n    id = Math.random()\n    @observable title = \"\"\n    @observable finished = false\n\n    constructor() {\n        makeObservable(this)\n    }\n\n    @action\n    toggle() {\n        this.finished = !this.finished\n    }\n}\n\nclass TodoList {\n    @observable todos = []\n\n    @computed\n    get unfinishedTodoCount() {\n        return this.todos.filter(todo => !todo.finished).length\n    }\n\n    constructor() {\n        makeObservable(this)\n    }\n}\n```\n\n</details>\n\n<details id=\"migrate-decorators\"><summary>Migrating from legacy decorators</summary>\n\nTo migrate from legacy decorators to modern decorators, perform the following steps:\n\n1. Disable / remove the `experimentalDecorators` flag from your TypeScript configuration (or Babel equivalent)\n2. Remove all `makeObservable(this)` calls from class constructors that use decorators.\n3. Replace all instances of `@observable` (and variations) with `@observable accessor`\n\nPlease note that adding `accessor` to a class property will change it into `get` and `set` class methods. Unlike class properties, class methods are not enumerable. This may introduce new behavior with some APIs, such as `Object.keys`, `JSON.stringify`, etc.\n\n</details>\n\n<details id=\"gotchas\"><summary>Decorator changes / gotchas</summary>\n\nMobX' 2022.3 Decorators are very similar to the MobX 5 decorators, so usage is mostly the same, but there are some gotchas:\n\n-   `@observable accessor` decorators are _not_ enumerable. `accessor`s do not have a direct equivalent in the past - they're a new concept in the language. We've chosen to make them non-enumerable, non-own properties in order to better follow the spirit of the ES language and what `accessor` means.\n    The main cases for enumerability seem to have been around serialization and rest destructuring.\n    -   Regarding serialization, implicitly serializing all properties probably isn't ideal in an OOP-world anyway, so this doesn't seem like a substantial issue (consider implementing `toJSON` or using `serializr` as possible alternatives)\n    -   Addressing rest-destructuring, such is an anti-pattern in MobX - doing so would (likely unwantedly) touch all observables and make the observer overly-reactive).\n-   `@action some_field = () => {}` was and is valid usage. However, inheritance is different between legacy decorators and modern decorators.\n    -   In legacy decorators, if superclass has a field decorated by `@action`, and subclass tries to override the same field, it will throw a `TypeError: Cannot redefine property`.\n    -   In modern decorators, if superclass has a field decorated by `@action`, and subclass tries to override the same field, it's allowed to override the field. However, the field on subclass is not an action unless it's also decorated with `@action` in subclass declaration.\n\n</details>\n\n## Using `observer` as a decorator\n\nThe `observer` function from `mobx-react` is both a function and a decorator that can be used on class components:\n\n```javascript\n@observer\nclass Timer extends React.Component {\n    /* ... */\n}\n```\n"
  },
  {
    "path": "docs/faq/migrate-to-6.md",
    "content": "---\ntitle: Migrating from MobX 4/5\nhide_title: true\n---\n\n<script async type=\"text/javascript\" src=\"//cdn.carbonads.com/carbon.js?serve=CEBD4KQ7&placement=mobxjsorg\" id=\"_carbonads_js\"></script>\n\n# This document has been updated and moved\n\n[Please click on this link to open the updated version.](../migrating-from-4-or-5.md)\n"
  },
  {
    "path": "docs/installation.md",
    "content": "---\ntitle: Installation\nsidebar_label: Installation\nhide_title: true\n---\n\n<script async type=\"text/javascript\" src=\"//cdn.carbonads.com/carbon.js?serve=CEBD4KQ7&placement=mobxjsorg\" id=\"_carbonads_js\"></script>\n\n# Installation\n\nMobX works in any ES5 environment, which includes browsers and NodeJS.\n\nThere are three types of React bindings:\n- [mobx-react-lite](https://github.com/mobxjs/mobx/tree/main/packages/mobx-react-lite). Utilities to manually apply observation\n- [mobx-react-observer](https://github.com/christianalfoni/mobx-react-observer). Babel/swc plugin to automatically apply observation to components\n- [mobx-react](https://github.com/mobxjs/mobx/tree/main/packages/mobx-react). Support for class components\n\nAppend the appropriate bindings for your use case to the _Yarn_ or _NPM_ command below:\n\n**Yarn:** `yarn add mobx`\n\n**NPM:** `npm install --save mobx`\n\n**CDN:** https://cdnjs.com/libraries/mobx / https://unpkg.com/mobx/dist/mobx.umd.production.min.js\n\n# Transpilation settings\n\n## MobX and Decorators\n\nBased on your preference, MobX can be used with or without decorators.\nBoth the legacy implementation and the standardised TC-39 version of decorators are currently supported.\nSee [enabling-decorators](enabling-decorators.md) for more details on how to enable them.\nLegacy decorator support will be removed in MobX 7, in favor of the standard.\n\n## Use spec compliant transpilation for class properties\n\nWhen using MobX with TypeScript or Babel, and you plan to use classes; make sure to update your configuration to use a TC-39 spec compliant transpilation for class fields, since this is not always the default. Without this, class fields cannot be made observable before they are initialized.\n\n-   **TypeScript**: Set the compiler option `\"useDefineForClassFields\": true`.\n-   **Babel**: Make sure to use at least version 7.12, with the following configuration:\n    ```json\n    {\n        // Babel < 7.13.0\n        \"plugins\": [[\"@babel/plugin-proposal-class-properties\", { \"loose\": false }]],\n\n        // Babel >= 7.13.0 (https://babeljs.io/docs/en/assumptions)\n        \"plugins\": [[\"@babel/plugin-proposal-class-properties\"]],\n        \"assumptions\": {\n            \"setPublicClassFields\": false\n        }\n    }\n    ```\nFor verification insert this piece of code at the beginning of your sources (eg. `index.js`)\n```javascript\nif (!new class { x }().hasOwnProperty('x')) throw new Error('Transpiler is not configured correctly');\n```\n\n## MobX on older JavaScript environments\n\nBy default, MobX uses proxies for optimal performance and compatibility. However, on older JavaScript engines `Proxy` is not available (check out [Proxy support](https://compat-table.github.io/compat-table/es6/#test-Proxy)). Examples of such are Internet Explorer (before Edge), Node.js < 6, iOS < 10, Android before RN 0.59.\n\nIn such cases, MobX can fallback to an ES5 compatible implementation which works almost identically, although there are a few [limitations without Proxy support](configuration.md#limitations-without-proxy-support). You will have to explicitly enable the fallback implementation by configuring [`useProxies`](configuration.md#proxy-support):\n\n```javascript\nimport { configure } from \"mobx\"\n\nconfigure({ useProxies: \"never\" }) // Or \"ifavailable\".\n```\n\nThis option will be removed in MobX 7.\n\n## MobX on other frameworks / platforms\n\n-   [MobX.dart](https://mobx.netlify.app/): MobX for Flutter / Dart\n-   [lit-mobx](https://github.com/adobe/lit-mobx): MobX for lit-element\n-   [mobx-angular](https://github.com/mobxjs/mobx-angular): MobX for angular\n-   [mobx-vue](https://github.com/mobxjs/mobx-vue): MobX for Vue\n"
  },
  {
    "path": "docs/intercept-and-observe.md",
    "content": "---\ntitle: Intercept & Observe\nsidebar_label: Intercept & Observe {🚀}\nhide_title: true\n---\n\n<script async type=\"text/javascript\" src=\"//cdn.carbonads.com/carbon.js?serve=CEBD4KQ7&placement=mobxjsorg\" id=\"_carbonads_js\"></script>\n\n# Intercept & Observe {🚀}\n\n_⚠️ **Warning**: intercept and observe are low level utilities, and should not be needed in practice. Use some form of [reaction](reactions.md) instead, as `observe` doesn't respect transactions and doesn't support deep observing of changes. Using these utilities is an anti-pattern. If you intend to get access to the old and new value using `observe`, use [`reaction`](reactions.md#reaction) instead. ⚠️_\n\n`observe` and `intercept` can be used to monitor the changes of a single observable, but they **_don't_** track nested observables.\n\n-   `intercept` can be used to detect and modify mutations before they are applied to the observable (validating, normalizing or cancelling).\n-   `observe` allows you to intercept changes after they have been made.\n\n## Intercept\n\nUsage: `intercept(target, propertyName?, interceptor)`\n\n_Please avoid this API. It basically provides a bit of aspect-oriented programming, creating flows that are really hard to debug. Instead, do things like data validation **before** updating any state, rather than during._\n\n-   `target`: the observable to guard.\n-   `propertyName`: optional parameter to specify a specific property to intercept. Note that `intercept(user.name, interceptor)` is fundamentally different from `intercept(user, \"name\", interceptor)`. The first tries to add an interceptor to the _current_ `value` inside `user.name`, which might not be an observable at all. The latter intercepts changes to the `name` _property_ of `user`.\n-   `interceptor`: callback that is invoked for _each_ change that is made to the observable. Receives a single change object describing the mutation.\n\nThe `intercept` should tell MobX what needs to happen with the current change.\nTherefore it should do one of the following things:\n\n1. Return the received `change` object as-is from the function, in which case the mutation will be applied.\n2. Modify the `change` object and return it, for example to normalize the data. Not all fields are modifiable, see below.\n3. Return `null`, this indicates that the change can be ignored and shouldn't be applied. This is a powerful concept with which you can for example make your objects temporarily immutable.\n4. Throw an exception, if for example some invariant isn't met.\n\nThe function returns a `disposer` function that can be used to cancel the interceptor when invoked.\nIt is possible to register multiple interceptors to the same observable.\nThey will be chained in registration order.\nIf one of the interceptors returns `null` or throws an exception, the other interceptors won't be evaluated anymore.\nIt is also possible to register an interceptor both on a parent object and on an individual property.\nIn that case the parent object interceptors are run before the property interceptors.\n\n```javascript\nconst theme = observable({\n    backgroundColor: \"#ffffff\"\n})\n\nconst disposer = intercept(theme, \"backgroundColor\", change => {\n    if (!change.newValue) {\n        // Ignore attempts to unset the background color.\n        return null\n    }\n    if (change.newValue.length === 6) {\n        // Correct missing '#' prefix.\n        change.newValue = \"#\" + change.newValue\n        return change\n    }\n    if (change.newValue.length === 7) {\n        // This must be a properly formatted color code!\n        return change\n    }\n    if (change.newValue.length > 10) {\n        // Stop intercepting future changes.\n        disposer()\n    }\n    throw new Error(\"This doesn't look like a color at all: \" + change.newValue)\n})\n```\n\n## Observe\n\nUsage: `observe(target, propertyName?, listener, invokeImmediately?)`\n\n_See above notice, please avoid this API and use [`reaction`](reactions.md#reaction) instead._\n\n-   `target`: the observable to observe.\n-   `propertyName`: optional parameter to specify a specific property to observe. Note that `observe(user.name, listener)` is fundamentally different from `observe(user, \"name\", listener)`. The first observes the _current_ `value` inside `user.name`, which might not be an observable at all. The latter observes the `name` _property_ of `user`.\n-   `listener`: callback that will be invoked for _each_ change that is made to the observable. Receives a single change object describing the mutation, except for boxed observables, which will invoke the `listener` with two parameters: `newValue, oldValue`.\n-   `invokeImmediately`: _false_ by default. Set it to _true_ if you want `observe` to invoke the `listener` directly with the state of the observable, instead of waiting for the first change. Not supported (yet) by all kinds of observables.\n\nThe function returns a `disposer` function that can be used to cancel the observer.\nNote that `transaction` does not affect the working of the `observe` method(s).\nThis means that even inside a transaction `observe` will fire its listeners for each mutation.\nHence [`autorun`](reactions.md#autorun) is usually a more powerful and declarative alternative to `observe`.\n\n_`observe` reacts to **mutations** when they are being made, while reactions like `autorun` or `reaction` react to **new values** when they become available. In many cases the latter is sufficient._\n\nExample:\n\n```javascript\nimport { observable, observe } from \"mobx\"\n\nconst person = observable({\n    firstName: \"Maarten\",\n    lastName: \"Luther\"\n})\n\n// Observe all fields.\nconst disposer = observe(person, change => {\n    console.log(change.type, change.name, \"from\", change.oldValue, \"to\", change.object[change.name])\n})\n\nperson.firstName = \"Martin\"\n// Prints: 'update firstName from Maarten to Martin'\n\n// Ignore any future updates.\ndisposer()\n\n// Observe a single field.\nconst disposer2 = observe(person, \"lastName\", change => {\n    console.log(\"LastName changed to \", change.newValue)\n})\n```\n\nRelated blog: [Object.observe is dead. Long live mobx.observe](https://medium.com/@mweststrate/object-observe-is-dead-long-live-mobservable-observe-ad96930140c5)\n\n## Event overview\n\nThe callbacks of `intercept` and `observe` will receive an event object which has at least the following properties:\n\n-   `object`: the observable triggering the event.\n-   `debugObjectName`: the name of the observable triggering the event (for debugging).\n-   `observableKind`: the type of the observable (value, set, array, object, map, computed).\n-   `type` (string): the type of the current event.\n\nThese are the additional fields that are available per type:\n\n| Observable type              | Event type | Property     | Description                                                                                       | Available during intercept | Can be modified by intercept |\n| ---------------------------- | ---------- | ------------ | ------------------------------------------------------------------------------------------------- | -------------------------- | ---------------------------- |\n| Object                       | add        | name         | Name of the property being added.                                                                 | √                          |                              |\n|                              |            | newValue     | The new value being assigned.                                                                     | √                          | √                            |\n|                              | update\\*   | name         | Name of the property being updated.                                                               | √                          |                              |\n|                              |            | newValue     | The new value being assigned.                                                                     | √                          | √                            |\n|                              |            | oldValue     | The value that is replaced.                                                                       |                            |                              |\n| Array                        | splice     | index        | Starting index of the splice. Splices are also fired by `push`, `unshift`, `replace`, etc.        | √                          |                              |\n|                              |            | removedCount | Amount of items being removed.                                                                    | √                          | √                            |\n|                              |            | added        | Array with items being added.                                                                     | √                          | √                            |\n|                              |            | removed      | Array with items that were removed.                                                               |                            |                              |\n|                              |            | addedCount   | Amount of items that were added.                                                                  |                            |                              |\n|                              | update     | index        | Index of the single entry being updated.                                                          | √                          |                              |\n|                              |            | newValue     | The newValue that is / will be assigned.                                                          | √                          | √                            |\n|                              |            | oldValue     | The old value that was replaced.                                                                  |                            |                              |\n| Map                          | add        | name         | The name of the entry that was added.                                                             | √                          |                              |\n|                              |            | newValue     | The new value that is being assigned.                                                             | √                          | √                            |\n|                              | update     | name         | The name of the entry being updated.                                                              | √                          |                              |\n|                              |            | newValue     | The new value that is being assigned.                                                             | √                          | √                            |\n|                              |            | oldValue     | The value that has been replaced.                                                                 |                            |                              |\n|                              | delete     | name         | The name of the entry being removed.                                                              | √                          |                              |\n|                              |            | oldValue     | The value of the entry that was removed.                                                          |                            |                              |\n| Boxed & computed observables | create     | newValue     | The value that was assigned during creation. Only available as `spy` event for boxed observables. |                            |                              |\n|                              | update     | newValue     | The new value being assigned.                                                                     | √                          | √                            |\n|                              |            | oldValue     | The previous value of the observable.                                                             |                            |                              |\n\n**Note:** object `update` events won't fire for updated computed values (as those aren't mutations). But it is possible to observe them by explicitly subscribing to the specific property using `observe(object, 'computedPropertyName', listener)`.\n"
  },
  {
    "path": "docs/intro/concepts.md",
    "content": "---\ntitle: The gist of MobX\nhide_title: true\n---\n\n<script async type=\"text/javascript\" src=\"//cdn.carbonads.com/carbon.js?serve=CEBD4KQ7&placement=mobxjsorg\" id=\"_carbonads_js\"></script>\n\n# This document has been updated and moved\n\n[Please click on this link to open the updated version.](../the-gist-of-mobx.md)\n"
  },
  {
    "path": "docs/intro/how-to-read.md",
    "content": "---\ntitle: About this documentation\nhide_title: true\n---\n\n<script async type=\"text/javascript\" src=\"//cdn.carbonads.com/carbon.js?serve=CEBD4KQ7&placement=mobxjsorg\" id=\"_carbonads_js\"></script>\n\n# This document has been updated and moved\n\n[Please click on this link to open the updated version.](../about-this-documentation.md)\n"
  },
  {
    "path": "docs/intro/installation.md",
    "content": "---\ntitle: Installation\nhide_title: true\n---\n\n<script async type=\"text/javascript\" src=\"//cdn.carbonads.com/carbon.js?serve=CEBD4KQ7&placement=mobxjsorg\" id=\"_carbonads_js\"></script>\n\n# This document has been updated and moved\n\n[Please click on this link to open the updated version.](../installation.md)\n"
  },
  {
    "path": "docs/lazy-observables.md",
    "content": "---\ntitle: Creating lazy observables\nsidebar_label: Lazy observables {🚀}\nhide_title: true\n---\n\n<script async type=\"text/javascript\" src=\"//cdn.carbonads.com/carbon.js?serve=CEBD4KQ7&placement=mobxjsorg\" id=\"_carbonads_js\"></script>\n\n# Creating lazy observables {🚀}\n\nUsage:\n\n-   `onBecomeObserved(observable, property?, listener: () => void): (() => void)`\n-   `onBecomeUnobserved(observable, property?, listener: () => void): (() => void)`\n\nFunctions `onBecomeObserved` and `onBecomeUnobserved` can be used to attach lazy behavior or side effects to existing observables. They hook into the observability system of MobX and get notified when an observable _starts_ and _stops_ becoming observed. They both return a _disposer_ function that detaches the _listener_.\n\nIn the example below we use them to perform network fetches only when the observed value is actually in use.\n\n```javascript\nexport class City {\n    location\n    temperature\n    interval\n\n    constructor(location) {\n        makeAutoObservable(this, {\n            resume: false,\n            suspend: false\n        })\n        this.location = location\n        // Only start data fetching if temperature is actually used!\n        onBecomeObserved(this, \"temperature\", this.resume)\n        onBecomeUnobserved(this, \"temperature\", this.suspend)\n    }\n\n    resume = () => {\n        log(`Resuming ${this.location}`)\n        this.interval = setInterval(() => this.fetchTemperature(), 5000)\n    }\n\n    suspend = () => {\n        log(`Suspending ${this.location}`)\n        this.temperature = undefined\n        clearInterval(this.interval)\n    }\n\n    fetchTemperature = flow(function* () {\n        // Data fetching logic...\n    })\n}\n```\n"
  },
  {
    "path": "docs/migrating-from-4-or-5.md",
    "content": "---\ntitle: Migrating from MobX 4/5\nsidebar_label: Migrating from MobX 4/5 {🚀}\nhide_title: true\n---\n\n<script async type=\"text/javascript\" src=\"//cdn.carbonads.com/carbon.js?serve=CEBD4KQ7&placement=mobxjsorg\" id=\"_carbonads_js\"></script>\n\n# Migrating from MobX 4/5 {🚀}\n\nMobX 6 is quite different from MobX 5. This pages covers a migration guide from MobX 4 and 5 to 6, and an extensive list of all the changes.\n\nFor a better understanding, check out the MobX 6.0 [CHANGELOG](https://github.com/mobxjs/mobx/blob/main/packages/mobx/CHANGELOG.md#600).\n\n_⚠️ **Warning**: Depending on factors like the size and complexity of your code base, your MobX usage patterns, and the quality of your automated tests, this migration guide might take you anywhere between an hour and a couple of days. Please refrain from upgrading if you don't trust your Continuous Integration or QA / test procedures enough to pick up any unexpected breakages. Unexpected behavioral changes might be caused by changes in MobX itself or the changes needed to your Babel / TypeScript build configuration. ⚠️_\n\n## Getting started\n\n1. Update `mobx` to the latest version of MobX 4/5 and solve any deprecation messages.\n2. Update `mobx` to version 6.\n3. If you are upgrading from MobX 4, and you will need to support Internet Explorer / React Native without proxies, call `import { configure } from \"mobx\"; configure({ useProxies: \"never\" })` at the initialization of your application, to back-out of the Proxy implementation. Check out the [Proxy Support](configuration.md#proxy-support) section for more details.\n4. For babel users:\n    - If you are using Babel and have class-properties enabled, disable the legacy loose field support: `[\"@babel/plugin-proposal-class-properties\", { \"loose\": false }]`\n    - (Optional) In MobX 6 decorators have become opt-in. If you no longer wish to use decorators, remove `plugin-proposal-decorators` from your babel configuration and dependencies. Check out the [Enabling decorators {🚀}](enabling-decorators.md) section for more details.\n5. For TypeScript users:\n    - Add the flag `\"useDefineForClassFields\": true` to your compiler config.\n    - (Optional) In MobX 6 decorators have become opt-in. If you no longer wish to use decorators, remove / disable the `experimentalDecorators` configuration from your TypeScript config. Check out the [Enabling decorators {🚀}](enabling-decorators.md) section for more details.\n6. The MobX default configuration has become more strict. We recommend to adopt the new defaults after completing the upgrade, check out the [Configuration {🚀}](configuration.md) section. During migration, we recommend to configure MobX in the same way as it would be in v4/v5 out of the box: `import {configure} from \"mobx\"; configure({ enforceActions: \"never\" });`. After finishing the entire migration process and validating that your project works as expected, consider enabling the flags `computedRequiresReaction`, `reactionRequiresObservable` and `observableRequiresReaction` and `enforceActions: \"observed\"` to write more idiomatic MobX code.\n\n## Upgrading classes to use `makeObservable`\n\nDue to standardized JavaScript limitations in how class fields are constructed, it is no longer possible for MobX to alter the behavior of class fields by means of decorators or the `decorate` utility. Instead, fields have to be made observable by the `constructor`. This can be done in three different ways:\n\n1. Remove all decorators and call `makeObservable` in the `constructor` and explicitly define which field should be made observable using which decorator. For example: `makeObservable(this, { count: observable, tick: action, elapsedTime: computed })` (note that the second argument corresponds to what would be passed to `decorate`). This is the recommended approach if you want to drop decorators in your code base, and the project isn't yet too big.\n2. Leave all the decorators and call `makeObservable(this)` in the `constructor`. This will pick up the metadata generated by the decorators. This is the recommended way if you want to limit the impact of a MobX 6 migration.\n3. Remove decorators and use `makeAutoObservable(this)` in the class `constructor`'s.\n\nCheck out [makeObservable / makeAutoObservable](observable-state.md) for more details.\n\nSome specifics to note:\n\n1. Using `makeObservable` / `makeAutoObservable` needs to be done in every class definition that declares MobX based members. So if a sub-class and super-class both introduce observable members, they will both have to call `makeObservable`.\n2. `makeAutoObservable` will mark methods using a new decorator [`autoAction`](observable-state.md#autoAction), that will apply `action` only if it is not in a derivation context. This makes it safe to call automatically decorated methods also from computed properties.\n\nMigrating a large code base with lots of classes might be daunting. But no worries, there is a code-mod available that will automate the above process!!\n\n## Upgrading your code with the `mobx-undecorate` codemod\n\nIf you are an existing MobX user you have code that uses a lot of decorators, or the equivalent calls to `decorate`.\n\nThe [`mobx-undecorate`](https://www.npmjs.com/package/mobx-undecorate) package provides a codemod that can automatically update your code to be conformant to MobX 6. There is no need to install it; instead you download and execute it using the [`npx`](https://www.npmjs.com/package/npx) tool which you do need to install if you haven't already.\n\nTo get rid of all uses of MobX decorators and replace them with the equivalent `makeObservable` calls, go to the directory that contains your source code and run:\n\n```shell\nnpx mobx-undecorate\n```\n\nMobX will continue to support decorators -- so if you want to retain them\nand only introduce `makeObservable(this)` where required, you can use the `--keepDecorators` option:\n\n```shell\nnpx mobx-undecorate --keepDecorators\n```\n\nSee [documentation](https://www.npmjs.com/package/mobx-undecorate) for more options.\n\n### Limitations of `mobx-undecorate`\n\nThe `mobx-undecorate` command has to introduce a constructor in classes that do not yet have one. If base class of the constructor expects arguments, the codemod cannot introduce these arguments for the subclass being upgraded, and the `super` call won't pass them either. You have to fix these manually.\nThe tool will generate a `// TODO: [mobx-undecorate]` comment in these cases.\n\nWe do have a special case for React class components to do the right thing and\npass along `props` to the superclass.\n\n## Functions are auto-converted\n\nFunctions that become part of a deep observable structure are automatically converted to [`autoAction`](observable-state.md#autoAction) or to [`flow`](actions.md#using-flow-instead-of-async--await-) if it's a generator function. See [inference rules](observable-state.md#makeautoobservable) for details.\nThis means that the original function reference is not preserved - in the same spirit as the original array/object/set/map reference is lost when converted to observable. [This can be surprising in some situations](https://github.com/mobxjs/mobx/issues/3616).\nIf this behavior is not desired use [`observable.shallow`](observable-state.md#available-annotations) / [`observable.ref`](observable-state.md#available-annotations) / [`false`](observable-state.md#available-annotations) / [`deep: false`](observable-state.md#options-) to prevent the conversion process or make sure the function is already an `action` as shown in the issue.\n"
  },
  {
    "path": "docs/mobx-utils.md",
    "content": "---\ntitle: MobX-utils\nsidebar_label: MobX-utils {🚀}\nhide_title: true\n---\n\n<script async type=\"text/javascript\" src=\"//cdn.carbonads.com/carbon.js?serve=CEBD4KQ7&placement=mobxjsorg\" id=\"_carbonads_js\"></script>\n\n# MobX-utils {🚀}\n\n[MobX-utils](https://github.com/mobxjs/mobx-utils) provides an extensive series of additional utility functions, observables and common patterns for MobX.\n"
  },
  {
    "path": "docs/observable-state.md",
    "content": "---\ntitle: Creating observable state\nsidebar_label: Observable state\nhide_title: true\n---\n\n<script async type=\"text/javascript\" src=\"//cdn.carbonads.com/carbon.js?serve=CEBD4KQ7&placement=mobxjsorg\" id=\"_carbonads_js\"></script>\n\n# Creating observable state\n\nProperties, entire objects, arrays, Maps and Sets can all be made observable.\nThe basics of making objects observable is specifying an annotation per property using `makeObservable`.\nThe most important annotations are:\n\n-   [`observable`](#observable) defines a trackable field that stores the state.\n-   [`action`](actions.md) marks a method as an action that will modify the state.\n-   [`computed`](computeds.md) marks a getter that will derive new facts from the state and cache its output.\n\n## `makeObservable`\n\nUsage:\n\n-   `makeObservable(target, annotations?, options?)`\n\nThis function can be used to make _existing_ object properties observable. Any JavaScript object (including class instances) can be passed into `target`.\nTypically `makeObservable` is used in the constructor of a class, and its first argument is `this`.\nThe `annotations` argument maps [annotations](#available-annotations) to each member. Only annotated members are affected.\n\nAlternatively, decorators like `@observable` can be used on class members instead of calling `makeObservable` in the constructor.\n\nMethods that derive information and take arguments (for example `findUsersOlderThan(age: number): User[]`) can not be annotated as `computed` – their read operations will still be tracked when they are called from a reaction, but their output won't be memoized to avoid memory leaks. To memoize such methods you can use [MobX-utils computedFn {🚀}](https://github.com/mobxjs/mobx-utils#computedfn) instead.\n\n[Subclassing is supported with some limitations](subclassing.md) by using the `override` annotation (see the example [here](subclassing.md)).\n\n<!--DOCUSAURUS_CODE_TABS-->\n<!--class + makeObservable-->\n\n```javascript\nimport { makeObservable, observable, computed, action, flow } from \"mobx\"\n\nclass Doubler {\n    value\n\n    constructor(value) {\n        makeObservable(this, {\n            value: observable,\n            double: computed,\n            increment: action,\n            fetch: flow\n        })\n        this.value = value\n    }\n\n    get double() {\n        return this.value * 2\n    }\n\n    increment() {\n        this.value++\n    }\n\n    *fetch() {\n        const response = yield fetch(\"/api/value\")\n        this.value = response.json()\n    }\n}\n```\n\n**All annotated** fields are **non-configurable**.<br>\n**All non-observable** (stateless) fields (`action`, `flow`) are **non-writable**.\n\n<!--class + decorators-->\n\nWhen using modern decorators, there is no need to call `makeObservable`, below is what a decorator based class looks like.\nNote that the `@observable` annotation should always be used in combination with the `accessor` keyword.\n\n```javascript\nimport { observable, computed, action, flow } from \"mobx\"\n\nclass Doubler {\n    @observable accessor value\n\n    constructor(value) {\n        this.value = value\n    }\n\n    @computed\n    get double() {\n        return this.value * 2\n    }\n\n    @action\n    increment() {\n        this.value++\n    }\n\n    @flow\n    *fetch() {\n        const response = yield fetch(\"/api/value\")\n        this.value = response.json()\n    }\n}\n```\n\n<!--factory function + makeAutoObservable-->\n\n```javascript\nimport { makeAutoObservable } from \"mobx\"\n\nfunction createDoubler(value) {\n    return makeAutoObservable({\n        value,\n        get double() {\n            return this.value * 2\n        },\n        increment() {\n            this.value++\n        }\n    })\n}\n```\n\nNote that classes can leverage `makeAutoObservable` as well.\nThe difference in the examples just demonstrates how MobX can be applied to different programming styles.\n\n<!--observable-->\n\n```javascript\nimport { observable } from \"mobx\"\n\nconst todosById = observable({\n    \"TODO-123\": {\n        title: \"find a decent task management system\",\n        done: false\n    }\n})\n\ntodosById[\"TODO-456\"] = {\n    title: \"close all tickets older than two weeks\",\n    done: true\n}\n\nconst tags = observable([\"high prio\", \"medium prio\", \"low prio\"])\ntags.push(\"prio: for fun\")\n```\n\nIn contrast to the first example with `makeObservable`, `observable` supports adding (and removing) _fields_ to an object.\nThis makes `observable` great for collections like dynamically keyed objects, arrays, Maps and Sets.\n\n<!--class + decorators (legacy)-->\n\nTo use legacy decorators, `makeObservable(this)` should be called in the constructor to make sure decorators work.\n\n```javascript\nimport { observable, computed, action, flow } from \"mobx\"\n\nclass Doubler {\n    @observable value\n\n    constructor(value) {\n        makeObservable(this)\n        this.value = value\n    }\n\n    @computed\n    get double() {\n        return this.value * 2\n    }\n\n    @action\n    increment() {\n        this.value++\n    }\n\n    @flow\n    *fetch() {\n        const response = yield fetch(\"/api/value\")\n        this.value = response.json()\n    }\n}\n```\n\n<!--END_DOCUSAURUS_CODE_TABS-->\n\n## `makeAutoObservable`\n\nUsage:\n\n-   `makeAutoObservable(target, overrides?, options?)`\n\n`makeAutoObservable` is like `makeObservable` on steroids, as it infers all the properties by default. You can however use the `overrides` parameter to override the default behavior with specific annotations —\nin particular `false` can be used to exclude a property or method from being processed entirely.\nCheck out the code above for an example.\n\nThe `makeAutoObservable` function can be more compact and easier to maintain than using `makeObservable`, since new members don't have to be mentioned explicitly.\nHowever, `makeAutoObservable` cannot be used on classes that have super or are [subclassed](subclassing.md).\n\nInference rules:\n\n-   All _own_ properties become `observable`.\n-   All `getters` become `computed`.\n-   All `setters` become `action`.\n-   All _functions_ become [`autoAction`](#autoAction).\n-   All _generator_ functions become `flow`. (Note that generator functions are not detectable in some transpiler configurations, if flow doesn't work as expected, make sure to specify `flow` explicitly.)\n-   Members marked with `false` in the `overrides` argument will not be annotated. For example, using it for read only fields such as identifiers.\n\n## `observable`\n\nUsage:\n\n-   `observable(source, overrides?, options?)`\n-   `@observable accessor` _(field decorator)_\n\nThe `observable` annotation can also be called as a function to make an entire object observable at once.\nThe `source` object will be cloned and all members will be made observable, similar to how it would be done by `makeAutoObservable`.\nLikewise, an `overrides` map can be provided to specify the annotations of specific members.\nCheck out the above code block for an example.\n\nThe object returned by `observable` will be a Proxy, which means that properties that are added later to the object will be picked up and made observable as well (except when [proxy usage](configuration.md#proxy-support) is disabled).\n\nThe `observable` method can also be called with collections types like [arrays](api.md#observablearray), [Maps](api.md#observablemap) and [Sets](api.md#observableset). Those will be cloned as well and converted into their observable counterparts.\n\n> Tip: as holds for JavaScript in general, don't use observable plain objects to create a keyed collection (for example to store a mapping from a user's UUID to user object), use maps instead. Object descriptors are aggressively cached by MobX, so if property names are unstable, this might result in memory leaks.\n\n<details id=\"observable-array\"><summary>**Example:** observable array<a href=\"#observable-array\" class=\"tip-anchor\"></a></summary>\n\nThe following example creates an observable and observes it using [`autorun`](reactions.md#autorun).\nWorking with Map and Set collections works similarly.\n\n```javascript\nimport { observable, autorun } from \"mobx\"\n\nconst todos = observable([\n    { title: \"Spoil tea\", completed: true },\n    { title: \"Make coffee\", completed: false }\n])\n\nautorun(() => {\n    console.log(\n        \"Remaining:\",\n        todos\n            .filter(todo => !todo.completed)\n            .map(todo => todo.title)\n            .join(\", \")\n    )\n})\n// Prints: 'Remaining: Make coffee'\n\ntodos[0].completed = false\n// Prints: 'Remaining: Spoil tea, Make coffee'\n\ntodos[2] = { title: \"Take a nap\", completed: false }\n// Prints: 'Remaining: Spoil tea, Make coffee, Take a nap'\n\ntodos.shift()\n// Prints: 'Remaining: Make coffee, Take a nap'\n```\n\nObservable arrays have some additional nifty utility functions:\n\n-   `clear()` removes all current entries from the array.\n-   `replace(newItems)` replaces all existing entries in the array with new ones.\n-   `remove(value)` removes a single item by value from the array. Returns `true` if the item was found and removed.\n\n</details>\n\n<details id=\"non-convertibles\"><summary>**Note:** primitives and class instances are never converted to observables<a href=\"#non-convertibles\" class=\"tip-anchor\"></a></summary>\n\nPrimitive values cannot be made observable by MobX since they are immutable in JavaScript (but they can be [boxed](api.md#observablebox)).\nAlthough there is typically no use for this mechanism outside libraries.\n\nClass instances will never be made observable automatically by passing them to `observable` or assigning them to an `observable` property.\nMaking class members observable is considered the responsibility of the class constructor.\n\n</details>\n\n<details id=\"avoid-proxies\"><summary>{🚀} **Tip:** observable (proxied) versus makeObservable (unproxied)<a href=\"#avoid-proxies\" class=\"tip-anchor\"></a></summary>\n\nThe primary difference between `make(Auto)Observable` and `observable` is that the first one modifies the object you are passing in as first argument, while `observable` creates a _clone_ that is made observable.\n\nThe second difference is that `observable` creates a [`Proxy`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy) object, to be able to trap future property additions in case you use the object as a dynamic lookup map.\nIf the object you want to make observable has a regular structure where all members are known up-front, we recommend to use `makeObservable` as non proxied objects are a little faster, and they are easier to inspect in the debugger and `console.log`.\n\nBecause of that, `make(Auto)Observable` is the recommended API to use in factory functions.\nNote that it is possible to pass `{ proxy: false }` as an option to `observable` to get a non proxied clone.\n\n</details>\n\n## Available annotations\n\n| Annotation                                 | Description                                                                                                                                                                                                                                                                                                                                       |\n| ------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `observable`<br/>`observable.deep`         | Defines a trackable field that stores state. If possible, any value assigned to `observable` is automatically converted to (deep) `observable`, [`autoAction`](#autoAction) or `flow` based on its type. Only `plain object`, `array`, `Map`, `Set`, `function`, `generator function` are convertible. Class instances and others are untouched. |\n| `observable.ref`                           | Like `observable`, but only reassignments will be tracked. The assigned values are completely ignored and will NOT be automatically converted to `observable`/[`autoAction`](#autoAction)/`flow`. For example, use this if you intend to store immutable data in an observable field.                                                             |\n| `observable.shallow`                       | Like `observable.ref` but for collections. Any collection assigned will be made observable, but the contents of the collection itself won't become observable.                                                                                                                                                                                    |\n| `observable.struct`                        | Like `observable`, except that any assigned value that is structurally equal to the current value will be ignored.                                                                                                                                                                                                                                |\n| `action`                                   | Mark a method as an action that will modify the state. Check out [actions](actions.md) for more details. Non-writable.                                                                                                                                                                                                                            |\n| `action.bound`                             | Like action, but will also bind the action to the instance so that `this` will always be set. Non-writable.                                                                                                                                                                                                                                       |\n| `computed`                                 | Can be used on a [getter](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/get) to declare it as a derived value that can be cached. Check out [computeds](computeds.md) for more details.                                                                                                                             |\n| `computed.struct`                          | Like `computed`, except that if after recomputing the result is structurally equal to the previous result, no observers will be notified.                                                                                                                                                                                                         |\n| `true`                                     | Infer the best annotation. Check out [makeAutoObservable](#makeautoobservable) for more details.                                                                                                                                                                                                                                                  |\n| `false`                                    | Explicitly do not annotate this property.                                                                                                                                                                                                                                                                                                         |\n| `flow`                                     | Creates a `flow` to manage asynchronous processes. Check out [flow](actions.md#using-flow-instead-of-async--await-) for more details. Note that the inferred return type in TypeScript might be off. Non-writable.                                                                                                                                |\n| `flow.bound`                               | Like flow, but will also bind the flow to the instance so that `this` will always be set. Non-writable.                                                                                                                                                                                                                                           |\n| `override`                                 | [Applicable to inherited `action`, `flow`, `computed`, `action.bound` overridden by subclass](subclassing.md).                                                                                                                                                                                                                                    |\n| <span id=\"autoAction\"></span> `autoAction` | Should not be used explicitly, but is used under the hood by `makeAutoObservable` to mark methods that can act as action or derivation, based on their calling context. It will be determined at runtime if the function is a derivation or action.                                                                                               |\n\n## Limitations\n\n1. `make(Auto)Observable` only supports properties that are already defined. Make sure your [**compiler configuration** is correct](installation.md#use-spec-compliant-transpilation-for-class-properties), or as work-around, that a value is assigned to all properties before using `make(Auto)Observable`. Without correct configuration, fields that are declared but not initialized (like in `class X { y; }`) will not be picked up correctly.\n1. `makeObservable` can only annotate properties declared by its own class definition. If a sub- or superclass introduces observable fields, it will have to call `makeObservable` for those properties itself.\n1. `options` argument can be provided only once. Passed `options` are _\"sticky\"_ and can NOT be changed later (eg. in [subclass](subclassing.md)).\n1. **Every field can be annotated only once** (except for `override`). The field annotation or configuration can't change in [subclass](subclassing.md).\n1. **All annotated** fields of non-plain objects (**classes**) are **non-configurable**.<br>\n   [Can be disabled with `configure({ safeDescriptors: false })` {🚀☣️} ](configuration.md#safedescriptors-boolean).\n1. **All non-observable** (stateless) fields (`action`, `flow`) are **non-writable**.<br>\n   [Can be disabled with `configure({ safeDescriptors: false })` {🚀☣️} ](configuration.md#safedescriptors-boolean).\n1. [Only **`action`, `computed`, `flow`, `action.bound`** defined **on prototype** can be **overridden** by subclass](subclassing.md).\n1. By default _TypeScript_ will not allow you to annotate **private** fields. This can be overcome by explicitly passing the relevant private fields as generic argument, like this: `makeObservable<MyStore, \"privateField\" | \"privateField2\">(this, { privateField: observable, privateField2: observable })`\n1. **Calling `make(Auto)Observable`** and providing annotations must be done **unconditionally**, as this makes it possible to cache the inference results.\n1. **Modifying prototypes** after **`make(Auto)Observable`** has been called is **not supported**.\n1. _EcmaScript_ **private** fields (**`#field`**) are **not supported** by `make(Auto)Observable`. Use auto-accessor + Stage-3 decorators (`@observable accessor #field`) syntax instead. Otherwise, when using _TypeScript_, it is recommended to use the `private` modifier.\n1. **Mixing annotations and decorators** within single inheritance chain is **not supported** - eg. you can't use decorators for superclass and annotations for subclass.\n1. `makeObservable`,`extendObservable` cannot be used on other builtin observable types (`ObservableMap`, `ObservableSet`, `ObservableArray`, etc)\n1. `makeObservable(Object.create(prototype))` copies properties from `prototype` to created object and makes them `observable`. This behavior is wrong, unexpected and therefore **deprecated** and will likely change in future versions. Don't rely on it.\n\n## Options {🚀}\n\nThe above APIs take an optional `options` argument which is an object that supports the following options:\n\n-   **`autoBind: true`** uses `action.bound`/`flow.bound` by default, rather than `action`/`flow`. Does not affect explicitly annotated members.\n-   **`deep: false`** uses `observable.ref` by default, rather than `observable`. Does not affect explicitly annotated members.\n-   **`name: <string>`** gives the object a debug name that is printed in error messages and reflection APIs.\n-   **`proxy: false`** forces `observable(thing)` to use non-[**proxy**](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy) implementation. This is a good option if the shape of the object will not change over time, as non-proxied objects are easier to debug and faster. This option is **not** available for `make(Auto)Observable`, see [avoiding proxies](#avoid-proxies).\n\n<details id=\"one-options-per-target\"><summary>**Note:** options are *sticky* and can be provided only once<a href=\"#one-options-per-target\" class=\"tip-anchor\"></a></summary>\n`options` argument can be provided only for `target` that is NOT observable yet.<br>\nIt is NOT possible to change options once the observable object was initialized.<br>\nOptions are stored on target and respected by subsequent `makeObservable`/`extendObservable` calls.<br>\nYou can't pass different options in [subclass](subclassing.md).\n</details>\n\n## Converting observables back to vanilla JavaScript collections\n\nSometimes it is necessary to convert observable data structures back to their vanilla counterparts.\nFor example when passing observable objects to a React component that can't track observables, or to obtain a clone that should not be further mutated.\n\nTo convert a collection shallowly, the usual JavaScript mechanisms work:\n\n```javascript\nconst plainObject = { ...observableObject }\nconst plainArray = observableArray.slice()\nconst plainMap = new Map(observableMap)\n```\n\nTo convert a data tree recursively to plain objects, the [`toJS`](api.md#tojs) utility can be used.\nFor classes, it is recommended to implement a `toJSON()` method, as it will be picked up by `JSON.stringify`.\n\n## A short note on classes\n\nSo far most examples above have been leaning towards the class syntax.\nMobX is in principle unopinionated about this, and there are probably just as many MobX users that use plain objects.\nHowever, a slight benefit of classes is that they have more easily discoverable APIs, e.g. TypeScript.\nAlso, `instanceof` checks are really powerful for type inference, and class instances aren't wrapped in `Proxy` objects, giving them a better experience in debuggers.\nFinally, classes benefit from a lot of engine optimizations, since their shape is predictable, and methods are shared on the prototype.\nBut heavy inheritance patterns can easily become foot-guns, so if you use classes, keep them simple.\nSo, even though there is a slight preference to use classes, we definitely want to encourage you to deviate from this style if that suits you better.\n"
  },
  {
    "path": "docs/react/react-integration.md",
    "content": "---\ntitle: React integration\nhide_title: true\n---\n\n<script async type=\"text/javascript\" src=\"//cdn.carbonads.com/carbon.js?serve=CEBD4KQ7&placement=mobxjsorg\" id=\"_carbonads_js\"></script>\n\n# This document has been updated and moved\n\n[Please click on this link to open the updated version.](../react-integration.md)\n"
  },
  {
    "path": "docs/react/react-performance.md",
    "content": "---\ntitle: Optimizing React component rendering\nhide_title: true\n---\n\n<script async type=\"text/javascript\" src=\"//cdn.carbonads.com/carbon.js?serve=CEBD4KQ7&placement=mobxjsorg\" id=\"_carbonads_js\"></script>\n\n# This document has been updated and moved\n\n[Please click on this link to open the updated version.](../react-optimizations.md)\n"
  },
  {
    "path": "docs/react-integration.md",
    "content": "---\ntitle: React integration\nsidebar_label: React integration\nhide_title: true\n---\n\n<script async type=\"text/javascript\" src=\"//cdn.carbonads.com/carbon.js?serve=CEBD4KQ7&placement=mobxjsorg\" id=\"_carbonads_js\"></script>\n\n# React integration\n\nThis documentation outlines how to manually apply observation to React components. However, by using the [mobx-react-observer](https://github.com/christianalfoni/mobx-react-observer) Babel/SWC plugin, you can automatically handle observation without manual intervention. Still, understanding how MobX observation integrates with React components remains valuable, even when leveraging automated solutions.\n\n```javascript\nimport { observer } from \"mobx-react-lite\" // Or \"mobx-react\".\n\nconst MyComponent = observer(props => ReactElement)\n```\n\nWhile MobX works independently from React, they are most commonly used together. In [The gist of MobX](the-gist-of-mobx.md) you have already seen the most important part of this integration: the `observer` [HoC](https://reactjs.org/docs/higher-order-components.html) that you can wrap around a React component.\n\n`observer` is provided by a separate React bindings package you choose [during installation](installation.md#installation). In this example, we're going to use the more lightweight [`mobx-react-lite` package](https://github.com/mobxjs/mobx/tree/main/packages/mobx-react-lite).\n\n```javascript\nimport React from \"react\"\nimport ReactDOM from \"react-dom\"\nimport { makeAutoObservable } from \"mobx\"\nimport { observer } from \"mobx-react-lite\"\n\nclass Timer {\n    secondsPassed = 0\n\n    constructor() {\n        makeAutoObservable(this)\n    }\n\n    increaseTimer() {\n        this.secondsPassed += 1\n    }\n}\n\nconst myTimer = new Timer()\n\n// A function component wrapped with `observer` will react\n// to any future change in an observable it used before.\nconst TimerView = observer(({ timer }) => <span>Seconds passed: {timer.secondsPassed}</span>)\n\nReactDOM.render(<TimerView timer={myTimer} />, document.body)\n\nsetInterval(() => {\n    myTimer.increaseTimer()\n}, 1000)\n```\n\n**Hint:** you can play with the above example yourself on [CodeSandbox](https://codesandbox.io/s/minimal-observer-p9ti4?file=/src/index.tsx).\n\nThe `observer` HoC automatically subscribes React components to _any observables_ that are used _during rendering_.\nAs a result, components will automatically re-render when relevant observables change.\nIt also makes sure that components don't re-render when there are _no relevant_ changes.\nSo, observables that are accessible by the component, but not actually read, won't ever cause a re-render.\n\nIn practice this makes MobX applications very well optimized out of the box and they typically don't need any additional code to prevent excessive rendering.\n\nFor `observer` to work, it doesn't matter _how_ the observables arrive in the component, only that they are read.\nReading observables deeply is fine, complex expression like `todos[0].author.displayName` work out of the box.\nThis makes the subscription mechanism much more precise and efficient compared to other frameworks in which data dependencies have to be declared explicitly or be pre-computed (e.g. selectors).\n\n## Local and external state\n\nThere is great flexibility in how state is organized, since it doesn't matter (technically that is) which observables we read or where observables originated from.\nThe examples below demonstrate different patterns on how external and local observable state can be used in components wrapped with `observer`.\n\n### Using external state in `observer` components\n\n<!--DOCUSAURUS_CODE_TABS-->\n<!--using props-->\n\nObservables can be passed into components as props (as in the example above):\n\n```javascript\nimport { observer } from \"mobx-react-lite\"\n\nconst myTimer = new Timer() // See the Timer definition above.\n\nconst TimerView = observer(({ timer }) => <span>Seconds passed: {timer.secondsPassed}</span>)\n\n// Pass myTimer as a prop.\nReactDOM.render(<TimerView timer={myTimer} />, document.body)\n```\n\n<!--using global variables-->\n\nSince it doesn't matter _how_ we got the reference to an observable, we can consume\nobservables from outer scopes directly (including from imports, etc.):\n\n```javascript\nconst myTimer = new Timer() // See the Timer definition above.\n\n// No props, `myTimer` is directly consumed from the closure.\nconst TimerView = observer(() => <span>Seconds passed: {myTimer.secondsPassed}</span>)\n\nReactDOM.render(<TimerView />, document.body)\n```\n\nUsing observables directly works very well, but since this typically introduces module state, this pattern might complicate unit testing. Instead, we recommend using React Context instead.\n\n<!--using React context-->\n\n[React Context](https://reactjs.org/docs/context.html) is a great mechanism to share observables with an entire subtree:\n\n```javascript\nimport {observer} from 'mobx-react-lite'\nimport {createContext, useContext} from \"react\"\n\nconst TimerContext = createContext<Timer>()\n\nconst TimerView = observer(() => {\n    // Grab the timer from the context.\n    const timer = useContext(TimerContext) // See the Timer definition above.\n    return (\n        <span>Seconds passed: {timer.secondsPassed}</span>\n    )\n})\n\nReactDOM.render(\n    <TimerContext.Provider value={new Timer()}>\n        <TimerView />\n    </TimerContext.Provider>,\n    document.body\n)\n```\n\nNote that we don't recommend ever replacing the `value` of a `Provider` with a different one. Using MobX, there should be no need for that, since the observable that is shared can be updated itself.\n\n<!--END_DOCUSAURUS_CODE_TABS-->\n\n### Using local observable state in `observer` components\n\nSince observables used by `observer` can come from anywhere, they can be local state as well.\nAgain, different options are available for us.\n\n<!--DOCUSAURUS_CODE_TABS-->\n<!--`useState` with observable class-->\n\nThe simplest way to use local observable state is to store a reference to an observable class with `useState`.\nNote that, since we typically don't want to replace the reference, we totally ignore the updater function returned by `useState`:\n\n```javascript\nimport { observer } from \"mobx-react-lite\"\nimport { useState } from \"react\"\n\nconst TimerView = observer(() => {\n    const [timer] = useState(() => new Timer()) // See the Timer definition above.\n    return <span>Seconds passed: {timer.secondsPassed}</span>\n})\n\nReactDOM.render(<TimerView />, document.body)\n```\n\nIf you want to automatically update the timer like we did in the original example,\n`useEffect` could be used in typical React fashion:\n\n```javascript\nuseEffect(() => {\n    const handle = setInterval(() => {\n        timer.increaseTimer()\n    }, 1000)\n    return () => {\n        clearInterval(handle)\n    }\n}, [timer])\n```\n\n<!--`useState` with local observable object-->\n\nAs stated before, instead of using classes, it is possible to directly create observable objects.\nWe can leverage [observable](observable-state.md#observable) for that:\n\n```javascript\nimport { observer } from \"mobx-react-lite\"\nimport { observable } from \"mobx\"\nimport { useState } from \"react\"\n\nconst TimerView = observer(() => {\n    const [timer] = useState(() =>\n        observable({\n            secondsPassed: 0,\n            increaseTimer() {\n                this.secondsPassed++\n            }\n        })\n    )\n    return <span>Seconds passed: {timer.secondsPassed}</span>\n})\n\nReactDOM.render(<TimerView />, document.body)\n```\n\n<!--`useLocalObservable` hook-->\n\nThe combination `const [store] = useState(() => observable({ /* something */}))` is\nquite common. To make this pattern simpler the [`useLocalObservable`](https://github.com/mobxjs/mobx-react#uselocalobservable-hook) hook is exposed from `mobx-react-lite` package, making it possible to simplify the earlier example to:\n\n```javascript\nimport { observer, useLocalObservable } from \"mobx-react-lite\"\n\nconst TimerView = observer(() => {\n    const timer = useLocalObservable(() => ({\n        secondsPassed: 0,\n        increaseTimer() {\n            this.secondsPassed++\n        }\n    }))\n    return <span>Seconds passed: {timer.secondsPassed}</span>\n})\n\nReactDOM.render(<TimerView />, document.body)\n```\n\n<!--END_DOCUSAURUS_CODE_TABS-->\n\n### You might not need locally observable state\n\nIn general, we recommend to not resort to MobX observables for local component state too quickly, as this can theoretically lock you out of some features of React's Suspense mechanism.\nAs a rule of thumb, use MobX observables when the state captures domain data that is shared among components (including children). Such as todo items, users, bookings, etc.\n\nState that only captures UI state, like loading state, selections, etc, might be better served by the [`useState` hook](https://reactjs.org/docs/hooks-state.html), since this will allow you to leverage React suspense features in the future.\n\nUsing observables inside React components adds value as soon as they are either 1) deep, 2) have computed values or 3) are shared with other `observer` components.\n\n## Always read observables inside `observer` components\n\nYou might be wondering, when do I apply `observer`? The rule of thumb is: _apply `observer` to all components that read observable data_.\n\n`observer` only enhances the component you are decorating, not the components called by it. So usually all your components should be wrapped by `observer`. Don't worry, this is not inefficient. On the contrary, more `observer` components make rendering more efficient as updates become more fine-grained.\n\n### Tip: Grab values from objects as late as possible\n\n`observer` works best if you pass object references around as long as possible, and only read their properties inside the `observer` based components that are going to render them into the DOM / low-level components.\nIn other words, `observer` reacts to the fact that you 'dereference' a value from an object.\n\nIn the above example, the `TimerView` component would **not** react to future changes if it was defined\nas follows, because the `.secondsPassed` is not read inside the `observer` component, but outside, and is hence _not_ tracked:\n\n```javascript\nconst TimerView = observer(({ secondsPassed }) => <span>Seconds passed: {secondsPassed}</span>)\n\nReact.render(<TimerView secondsPassed={myTimer.secondsPassed} />, document.body)\n```\n\nNote that this is a different mindset from other libraries like `react-redux`, where it is a good practice to dereference early and pass primitives down, to better leverage memoization.\nIf the problem is not entirely clear, make sure to check out the [Understanding reactivity](understanding-reactivity.md) section.\n\n### Don't pass observables into components that aren't `observer`\n\nComponents wrapped with `observer` _only_ subscribe to observables used during their _own_ rendering of the component. So if observable objects / arrays / maps are passed to child components, those have to be wrapped with `observer` as well.\nThis is also true for any callback based components.\n\nIf you want to pass observables to a component that isn't an `observer`, either because it is a third-party component, or because you want to keep that component MobX agnostic, you will have to [convert the observables to plain JavaScript values or structures](observable-state.md#converting-observables-back-to-vanilla-javascript-collections) before passing them on.\n\nTo elaborate on the above,\ntake the following example observable `todo` object, a `TodoView` component (observer) and an imaginary `GridRow` component that takes a column / value mapping, but which isn't an `observer`:\n\n```javascript\nclass Todo {\n    title = \"test\"\n    done = true\n\n    constructor() {\n        makeAutoObservable(this)\n    }\n}\n\nconst TodoView = observer(({ todo }: { todo: Todo }) =>\n   // WRONG: GridRow won't pick up changes in todo.title / todo.done\n   //        since it isn't an observer.\n   return <GridRow data={todo} />\n\n   // CORRECT: let `TodoView` detect relevant changes in `todo`,\n   //          and pass plain data down.\n   return <GridRow data={{\n       title: todo.title,\n       done: todo.done\n   }} />\n\n   // CORRECT: using `toJS` works as well, but being explicit is typically better.\n   return <GridRow data={toJS(todo)} />\n)\n```\n\n### Callback components might require `<Observer>`\n\nImagine the same example, where `GridRow` takes an `onRender` callback instead.\nSince `onRender` is part of the rendering cycle of `GridRow`, rather than `TodoView`'s render (even though that is where it syntactically appears), we have to make sure that the callback component uses an `observer` component.\nOr, we can create an in-line anonymous observer using [`<Observer />`](https://github.com/mobxjs/mobx-react#observer):\n\n```javascript\nconst TodoView = observer(({ todo }: { todo: Todo }) => {\n    // WRONG: GridRow.onRender won't pick up changes in todo.title / todo.done\n    //        since it isn't an observer.\n    return <GridRow onRender={() => <td>{todo.title}</td>} />\n\n    // CORRECT: wrap the callback rendering in Observer to be able to detect changes.\n    return <GridRow onRender={() => <Observer>{() => <td>{todo.title}</td>}</Observer>} />\n})\n```\n\n## Tips\n\n<details id=\"static-rendering\"><summary>Server Side Rendering (SSR)<a href=\"#static-rendering\" class=\"tip-anchor\"></a></summary>\nIf `observer` is used in server side rendering context; make sure to call `enableStaticRendering(true)`, so that `observer` won't subscribe to any observables used, and no GC problems are introduced.\n</details>\n\n<details id=\"react-vs-lite\"><summary>**Note:** mobx-react vs. mobx-react-lite<a href=\"#react-vs-lite\" class=\"tip-anchor\"></a></summary>\nIn this documentation we used `mobx-react-lite` as default.\n[mobx-react](https://github.com/mobxjs/mobx-react/) is its big brother, which uses `mobx-react-lite` under the hood.\nIt offers a few more features which are typically not needed anymore in greenfield projects. The additional things offered by mobx-react:\n\n1. Support for React class components.\n1. `Provider` and `inject`. MobX's own React.createContext predecessor which is not needed anymore.\n1. Observable specific `propTypes`.\n\nNote that `mobx-react` fully repackages and re-exports `mobx-react-lite`, including functional component support.\nIf you use `mobx-react`, there is no need to add `mobx-react-lite` as a dependency or import from it anywhere.\n\n</details>\n\n<details id=\"observer-vs-memo\"><summary>**Note:** `observer` or `React.memo`?<a href=\"#observer-vs-memo\" class=\"tip-anchor\"></a></summary>\n`observer` automatically applies `memo`, so `observer` components never need to be wrapped in `memo`.\n`memo` can be applied safely to observer components because mutations (deeply) inside the props will be picked up by `observer` anyway if relevant.\n</details>\n\n<details id=\"class-comp\"><summary>**Tip:** `observer` for class based React components<a href=\"#class-comp\" class=\"tip-anchor\"></a>\n</summary>\nAs stated above, class based components are only supported through `mobx-react`, and not `mobx-react-lite`.\nBriefly, you can wrap class-based components in `observer` just like\nyou can wrap function components:\n\n```javascript\nimport React from \"react\"\n\nconst TimerView = observer(\n    class TimerView extends React.Component {\n        render() {\n            const { timer } = this.props\n            return <span>Seconds passed: {timer.secondsPassed} </span>\n        }\n    }\n)\n```\n\nCheck out [mobx-react docs](https://github.com/mobxjs/mobx/tree/main/packages/mobx-react#class-components) for more information.\n\n</details>\n\n<details id=\"displayname\"><summary>**Tip:** nice component names in React DevTools<a href=\"#displayname\" class=\"tip-anchor\"></a>\n</summary>\n[React DevTools](https://reactjs.org/blog/2019/08/15/new-react-devtools.html) uses the display name information of components to properly display the component hierarchy.\n\nIf you use:\n\n```javascript\nexport const MyComponent = observer(props => <div>hi</div>)\n```\n\nthen no display name will be visible in the DevTools.\n\n![devtools-noname](assets/devtools-noDisplayName.png)\n\nThe following approaches can be used to fix this:\n\n-   use `function` with a name instead of an arrow function. `mobx-react` infers component name from the function name:\n\n    ```javascript\n    export const MyComponent = observer(function MyComponent(props) {\n        return <div>hi</div>\n    })\n    ```\n\n-   Transpilers (like Babel or TypeScript) infer component name from the variable name:\n\n    ```javascript\n    const _MyComponent = props => <div>hi</div>\n    export const MyComponent = observer(_MyComponent)\n    ```\n\n-   Infer from the variable name again, using default export:\n\n    ```javascript\n    const MyComponent = props => <div>hi</div>\n    export default observer(MyComponent)\n    ```\n\n-   [**Broken**] Set `displayName` explicitly:\n\n    ```javascript\n    export const MyComponent = observer(props => <div>hi</div>)\n    MyComponent.displayName = \"MyComponent\"\n    ```\n\n    This is broken in React 16 at the time of writing; mobx-react `observer` uses a React.memo and runs into this bug: https://github.com/facebook/react/issues/18026, but it will be fixed in React 17.\n\nNow you can see component names:\n\n![devtools-withname](assets/devtools-withDisplayName.png)\n\n</details>\n\n<details id=\"wrap-order\"><summary>{🚀} **Tip:** when combining `observer` with other higher-order-components, apply `observer` first<a href=\"#wrap-order\" class=\"tip-anchor\"></a></summary>\n\nWhen `observer` needs to be combined with other decorators or higher-order-components, make sure that `observer` is the innermost (first applied) decorator;\notherwise it might do nothing at all.\n\n</details>\n\n<details id=\"computed-props\"><summary>{🚀} **Tip:** deriving computeds from props<a href=\"#computed-props\" class=\"tip-anchor\"></a></summary>\nIn some cases the computed values of your local observables might depend on some of the props your component receives.\nHowever, the set of props that a React component receives is in itself not observable, so changes to the props won't be reflected in any computed values. You have to manually update local observable state in order to properly derive computed values from latest data.\n\n```javascript\nimport { observer, useLocalObservable } from \"mobx-react-lite\"\nimport { useEffect } from \"react\"\n\nconst TimerView = observer(({ offset = 0 }) => {\n    const timer = useLocalObservable(() => ({\n        offset, // The initial offset value\n        secondsPassed: 0,\n        increaseTimer() {\n            this.secondsPassed++\n        },\n        get offsetTime() {\n            return this.secondsPassed - this.offset // Not 'offset' from 'props'!\n        }\n    }))\n\n    useEffect(() => {\n        // Sync the offset from 'props' into the observable 'timer'\n        timer.offset = offset\n    }, [offset])\n\n    // Effect to set up a timer, only for demo purposes.\n    useEffect(() => {\n        const handle = setInterval(timer.increaseTimer, 1000)\n        return () => {\n            clearInterval(handle)\n        }\n    }, [])\n\n    return <span>Seconds passed: {timer.offsetTime}</span>\n})\n\nReactDOM.render(<TimerView />, document.body)\n```\n\nIn practice you will rarely need this pattern, since\n`return <span>Seconds passed: {timer.secondsPassed - offset}</span>`\nis a much simpler, albeit slightly less efficient solution.\n\n</details>\n\n<details id=\"useeffect\"><summary>{🚀} **Tip:** useEffect and observables<a href=\"#useeffect\" class=\"tip-anchor\"></a></summary>\n\n`useEffect` can be used to set up side effects that need to happen, and which are bound to the life-cycle of the React component.\nUsing `useEffect` requires specifying dependencies.\nWith MobX that isn't really needed, since MobX has already a way to automatically determine the dependencies of an effect, `autorun`.\nCombining `autorun` and coupling it to the life-cycle of the component using `useEffect` is luckily straightforward:\n\n```javascript\nimport { observer, useLocalObservable, useAsObservableSource } from \"mobx-react-lite\"\nimport { useState } from \"react\"\n\nconst TimerView = observer(() => {\n    const timer = useLocalObservable(() => ({\n        secondsPassed: 0,\n        increaseTimer() {\n            this.secondsPassed++\n        }\n    }))\n\n    // Effect that triggers upon observable changes.\n    useEffect(\n        () =>\n            autorun(() => {\n                if (timer.secondsPassed > 60) alert(\"Still there. It's a minute already?!!\")\n            }),\n        []\n    )\n\n    // Effect to set up a timer, only for demo purposes.\n    useEffect(() => {\n        const handle = setInterval(timer.increaseTimer, 1000)\n        return () => {\n            clearInterval(handle)\n        }\n    }, [])\n\n    return <span>Seconds passed: {timer.secondsPassed}</span>\n})\n\nReactDOM.render(<TimerView />, document.body)\n```\n\nNote that we return the disposer created by `autorun` from our effect function.\nThis is important, since it makes sure the `autorun` gets cleaned up once the component unmounts!\n\nThe dependency array can typically be left empty, unless a non-observable value should trigger a re-run of the autorun, in which case you will need to add it there.\nTo make your linter happy, you can define `timer` (in the above example) as a dependency.\nThat is safe and has no further effect, since the reference will never actually change.\n\nIf you'd rather explicitly define which observables should trigger the effect, use `reaction` instead of `autorun`, beyond that the pattern remains identical.\n\n</details>\n\n### How can I further optimize my React components?\n\nCheck out the [React optimizations {🚀}](react-optimizations.md) section.\n\n## Troubleshooting\n\nHelp! My component isn't re-rendering...\n\n1. Make sure you didn't forget `observer` (yes, this is the most common mistake).\n1. Verify that the thing you intend to react to is indeed observable. Use utilities like [`isObservable`](api.md#isobservable), [`isObservableProp`](api.md#isobservableprop) if needed to verify this at runtime.\n1. Check the console logs in the browsers for any warnings or errors.\n1. Make sure you grok how tracking works in general. Check out the [Understanding reactivity](understanding-reactivity.md) section.\n1. Read the common pitfalls as described above.\n1. [Configure](configuration.md#linting-options) MobX to warn you of unsound usage of mechanisms and check the console logs.\n1. Use [trace](analyzing-reactivity.md) to verify that you are subscribing to the right things or check what MobX is doing in general using [spy](analyzing-reactivity.md#spy) / the [mobx-log](https://github.com/kubk/mobx-log) package.\n"
  },
  {
    "path": "docs/react-optimizations.md",
    "content": "---\ntitle: Optimizing React component rendering\nsidebar_label: React optimizations {🚀}\nhide_title: true\n---\n\n<script async type=\"text/javascript\" src=\"//cdn.carbonads.com/carbon.js?serve=CEBD4KQ7&placement=mobxjsorg\" id=\"_carbonads_js\"></script>\n\n# Optimizing React component rendering {🚀}\n\nMobX is very fast, [often even faster than Redux](https://twitter.com/mweststrate/status/718444275239882753), but here are some tips to get most out of React and MobX. Most apply to React in general and are not specific to MobX.\nNote that while it's good to be aware of these patterns, usually your application\nwill be fast enough even if you don't worry about them at all.\n\nPrioritize performance only when it's an actual issue!\n\n## Use many small components\n\n`observer` components will track all values they use and re-render if any of them changes.\nSo the smaller your components are, the smaller the change they have to re-render. It means that more parts of your user interface have the possibility to render independently of each other.\n\n## Render lists in dedicated components\n\nThe above is especially true when rendering big collections.\nReact is notoriously bad at rendering large collections as the reconciler has to evaluate the components produced by a collection on each collection change.\nIt is therefore recommended to have components that just map over a collection and render it, and render nothing else.\n\nBad:\n\n```javascript\nconst MyComponent = observer(({ todos, user }) => (\n    <div>\n        {user.name}\n        <ul>\n            {todos.map(todo => (\n                <TodoView todo={todo} key={todo.id} />\n            ))}\n        </ul>\n    </div>\n))\n```\n\nIn the above listing React will unnecessarily need to reconcile all `TodoView` components when the `user.name` changes. They won't re-render, but the reconcile process is expensive in itself.\n\nGood:\n\n```javascript\nconst MyComponent = observer(({ todos, user }) => (\n    <div>\n        {user.name}\n        <TodosView todos={todos} />\n    </div>\n))\n\nconst TodosView = observer(({ todos }) => (\n    <ul>\n        {todos.map(todo => (\n            <TodoView todo={todo} key={todo.id} />\n        ))}\n    </ul>\n))\n```\n\n## Don't use array indexes as keys\n\nDon't use array indexes or any value that might change in the future as key. Generate ids for your objects if needed.\nCheck out this [blog post](https://medium.com/@robinpokorny/index-as-a-key-is-an-anti-pattern-e0349aece318).\n\n## Dereference values late\n\nWhen using `mobx-react` it is recommended to dereference values as late as possible.\nThis is because MobX will re-render components that dereference observable values automatically.\nIf this happens deeper in your component tree, less components have to re-render.\n\nSlower:\n\n```javascript\n<DisplayName name={person.name} />\n```\n\nFaster:\n\n```javascript\n<DisplayName person={person} />\n```\n\nIn the faster example, a change in the `name` property triggers only `DisplayName` to re-render, while in the slower one the owner of the component has to re-render as well. There is nothing wrong with that, and if rendering of the owning component is fast enough (usually it is!), then this approach works well.\n\n### Function props {🚀}\n\nYou may notice that to dereference values late, you have to create lots of small observer components where each is customized to render a different part of data, for example:\n\n```javascript\nconst PersonNameDisplayer = observer(({ person }) => <DisplayName name={person.name} />)\n\nconst CarNameDisplayer = observer(({ car }) => <DisplayName name={car.model} />)\n\nconst ManufacturerNameDisplayer = observer(({ car }) => \n    <DisplayName name={car.manufacturer.name} />\n)\n```\n\nThis quickly becomes tedious if you have lots of data of different shape. An alternative is to use a function that returns the data that you want your `*Displayer` to render:\n\n```javascript\nconst GenericNameDisplayer = observer(({ getName }) => <DisplayName name={getName()} />)\n```\n\nThen, you can use the component like this:\n\n```javascript\nconst MyComponent = ({ person, car }) => (\n    <>\n        <GenericNameDisplayer getName={() => person.name} />\n        <GenericNameDisplayer getName={() => car.model} />\n        <GenericNameDisplayer getName={() => car.manufacturer.name} />\n    </>\n)\n```\n\nThis approach will allow `GenericNameDisplayer` to be reused throughout your application to render any name, and you still keep component re-rendering\nto a minimum.\n"
  },
  {
    "path": "docs/reactions.md",
    "content": "---\ntitle: Running side effects with reactions\nsidebar_label: Reactions {🚀}\nhide_title: true\n---\n\n<script async type=\"text/javascript\" src=\"//cdn.carbonads.com/carbon.js?serve=CEBD4KQ7&placement=mobxjsorg\" id=\"_carbonads_js\"></script>\n\n# Running side effects with reactions {🚀}\n\nReactions are an important concept to understand, as it is where everything in MobX comes together.\nThe goal of reactions is to model side effects that happen automatically.\nTheir significance is in creating consumers for your observable state and _automatically_ running side effects whenever something _relevant_ changes.\n\nHowever, with that in mind, it is important to realize that the APIs discussed here should rarely be used.\nThey are often abstracted away in other libraries (like mobx-react) or abstractions specific to your application.\n\nBut, to grok MobX, let's take a look at how reactions can be created.\nThe simplest way is to use the [`autorun`](#autorun) utility.\nBeyond that, there are also [`reaction`](#reaction) and [`when`](#when).\n\n## Autorun\n\nUsage:\n\n-   `autorun(effect: (reaction) => void, options?)`\n\nThe `autorun` function accepts one function that should run every time anything it observes changes.\nIt also runs once when you create the `autorun` itself. It only responds to changes in observable state, things you have annotated `observable` or `computed`.\n\n### How tracking works\n\nAutorun works by running the `effect` in a _reactive context_. During the execution of the provided function, MobX keeps track of all observable and computed values that are directly or indirectly _read_ by the effect.\nOnce the function finishes, MobX will collect and subscribe to all observables that were read and wait until any of them changes again.\nOnce they do, the `autorun` will trigger again, repeating the entire process.\n\n![autorun](assets/autorun.png)\n\nThis is how the example below works like.\n\n### Example\n\n```javascript\nimport { makeAutoObservable, autorun } from \"mobx\"\n\nclass Animal {\n    name\n    energyLevel\n\n    constructor(name) {\n        this.name = name\n        this.energyLevel = 100\n        makeAutoObservable(this)\n    }\n\n    reduceEnergy() {\n        this.energyLevel -= 10\n    }\n\n    get isHungry() {\n        return this.energyLevel < 50\n    }\n}\n\nconst giraffe = new Animal(\"Gary\")\n\nautorun(() => {\n    console.log(\"Energy level:\", giraffe.energyLevel)\n})\n\nautorun(() => {\n    if (giraffe.isHungry) {\n        console.log(\"Now I'm hungry!\")\n    } else {\n        console.log(\"I'm not hungry!\")\n    }\n})\n\nconsole.log(\"Now let's change state!\")\nfor (let i = 0; i < 10; i++) {\n    giraffe.reduceEnergy()\n}\n```\n\nRunning this code, you will get the following output:\n\n```\nEnergy level: 100\nI'm not hungry!\nNow let's change state!\nEnergy level: 90\nEnergy level: 80\nEnergy level: 70\nEnergy level: 60\nEnergy level: 50\nEnergy level: 40\nNow I'm hungry!\nEnergy level: 30\nEnergy level: 20\nEnergy level: 10\nEnergy level: 0\n```\n\nAs you can see in the first two lines of the output above, both `autorun` functions run once when they are initialized. This is all you would see without the `for` loop.\n\nOnce we run the `for` loop to change the `energyLevel` with the `reduceEnergy`\naction, we see a new log entry every time an `autorun` function observes a\nchange in its observable state:\n\n1.  For the _\"Energy level\"_ function, this is every time the `energyLevel` observable changes, 10 times in total.\n\n2.  For the _\"Now I'm hungry\"_ function, this is every time the `isHungry` computed\n    changes, only one time.\n\n## Reaction\n\nUsage:\n\n-   `reaction(() => value, (value, previousValue, reaction) => { sideEffect }, options?)`.\n\n`reaction` is like `autorun`, but gives more fine grained control on which observables will be tracked.\nIt takes two functions: the first, _data_ function, is tracked and returns the data that is used as input for the second, _effect_ function.\nIt is important to note that the side effect _only_ reacts to data that was _accessed_ in the data function, which might be less than the data that is actually used in the effect function.\n\nThe typical pattern is that you produce the things you need in your side effect\nin the _data_ function, and in that way control more precisely when the effect triggers.\nBy default, the result of the _data_ function has to change in order for the _effect_ function to be triggered.\nUnlike `autorun`, the side effect won't run once when initialized, but only after the data expression returns a new value for the first time.\n\n<details id=\"reaction-example\"><summary>**Example:** the data and effect functions<a href=\"#reaction-example\" class=\"tip-anchor\"></a></summary>\n\nIn the example below, the reaction is only triggered once, when `isHungry` changes.\nChanges to `giraffe.energyLevel`, which is used by the _effect_ function, do not cause the _effect_ function to be executed. If you wanted `reaction` to respond to this\nas well, you would have to also access it in the _data_ function and return it.\n\n```javascript\nimport { makeAutoObservable, reaction } from \"mobx\"\n\nclass Animal {\n    name\n    energyLevel\n\n    constructor(name) {\n        this.name = name\n        this.energyLevel = 100\n        makeAutoObservable(this)\n    }\n\n    reduceEnergy() {\n        this.energyLevel -= 10\n    }\n\n    get isHungry() {\n        return this.energyLevel < 50\n    }\n}\n\nconst giraffe = new Animal(\"Gary\")\n\nreaction(\n    () => giraffe.isHungry,\n    isHungry => {\n        if (isHungry) {\n            console.log(\"Now I'm hungry!\")\n        } else {\n            console.log(\"I'm not hungry!\")\n        }\n        console.log(\"Energy level:\", giraffe.energyLevel)\n    }\n)\n\nconsole.log(\"Now let's change state!\")\nfor (let i = 0; i < 10; i++) {\n    giraffe.reduceEnergy()\n}\n```\n\nOutput:\n\n```\nNow let's change state!\nNow I'm hungry!\nEnergy level: 40\n```\n\n</details>\n\n## When\n\nUsage:\n\n-   `when(predicate: () => boolean, effect?: () => void, options?)`\n-   `when(predicate: () => boolean, options?): Promise`\n\n`when` observes and runs the given _predicate_ function until it returns `true`.\nOnce that happens, the given _effect_ function is executed and the autorunner is disposed.\n\nThe `when` function returns a disposer, allowing you to cancel it manually, unless you don't pass in a second `effect` function, in which case it returns a `Promise`.\n\n<details id=\"when-example\">\n  <summary>**Example:** dispose of things in a reactive way<a href=\"#when-example\" class=\"tip-anchor\"></a></summary>\n\n`when` is really useful for disposing or canceling of things in a reactive way.\nFor example:\n\n```javascript\nimport { when, makeAutoObservable } from \"mobx\"\n\nclass MyResource {\n    constructor() {\n        makeAutoObservable(this, { dispose: false })\n        when(\n            // Once...\n            () => !this.isVisible,\n            // ... then.\n            () => this.dispose()\n        )\n    }\n\n    get isVisible() {\n        // Indicate whether this item is visible.\n    }\n\n    dispose() {\n        // Clean up some resources.\n    }\n}\n```\n\nAs soon as `isVisible` becomes `false`, the `dispose` method is called that\nthen does some cleanup for `MyResource`.\n\n</details>\n\n### `await when(...)`\n\nIf no `effect` function is provided, `when` returns a `Promise`. This combines nicely with `async / await` to let you wait for changes in observable state.\n\n```javascript\nasync function() {\n\tawait when(() => that.isVisible)\n\t// etc...\n}\n```\n\nTo cancel `when` prematurely, it is possible to call `.cancel()` on the promise returned by itself.\n\n## Rules\n\nThere are a few rules that apply to any reactive context:\n\n1. Affected reactions run by default immediately (synchronously) if an observable is changed. However, they won't run before the end of the current outermost (trans)action.\n2. Autorun tracks only the observables that are read during the synchronous execution of the provided function, but it won't track anything that happens asynchronously.\n3. Autorun won't track observables that are read by an action invoked by the autorun, as actions are always _untracked_.\n\nFor more examples on what precisely MobX will and will not react to, check out the [Understanding reactivity](understanding-reactivity.md) section.\nFor a more detailed technical breakdown on how tracking works, read the blog post [Becoming fully reactive: an in-depth explanation of MobX](https://hackernoon.com/becoming-fully-reactive-an-in-depth-explanation-of-mobservable-55995262a254).\n\n## Always dispose of reactions\n\nThe functions passed to `autorun`, `reaction` and `when` are only garbage collected if all objects they observe are garbage collected themselves. In principle, they keep waiting forever for new changes to happen in the observables they use.\nTo be able to stop them from waiting until forever has passed, they all return a disposer function that can be used to stop them and unsubscribe from any observables they used.\n\n```javascript\nconst counter = observable({ count: 0 })\n\n// Sets up the autorun and prints 0.\nconst disposer = autorun(() => {\n    console.log(counter.count)\n})\n\n// Prints: 1\ncounter.count++\n\n// Stops the autorun.\ndisposer()\n\n// Will not print.\ncounter.count++\n```\n\nWe strongly recommend to always use the disposer function that is returned from these methods as soon as their side effect is no longer needed.\nFailing to do so can lead to memory leaks.\n\nThe `reaction` argument that is passed as second argument to the effect functions of `reaction` and `autorun`, can be used to prematurely clean up the reaction as well by calling `reaction.dispose()`.\n\n<details id=\"mem-leak-example\"><summary>**Example:** memory leak<a href=\"#mem-leak-example\" class=\"tip-anchor\"></a></summary>\n\n```javascript\nclass Vat {\n    value = 1.2\n\n    constructor() {\n        makeAutoObservable(this)\n    }\n}\n\nconst vat = new Vat()\n\nclass OrderLine {\n    price = 10\n    amount = 1\n    constructor() {\n        makeAutoObservable(this)\n\n        // This autorun will be GC-ed together with the current orderline\n        // instance as it only uses observables from `this`. It's not strictly\n        // necessary to dispose of it once an OrderLine instance is deleted.\n        this.disposer1 = autorun(() => {\n            doSomethingWith(this.price * this.amount)\n        })\n\n        // This autorun won't be GC-ed together with the current orderline\n        // instance, since vat keeps a reference to notify this autorun, which\n        // in turn keeps 'this' in scope.\n        this.disposer2 = autorun(() => {\n            doSomethingWith(this.price * this.amount * vat.value)\n        })\n    }\n\n    dispose() {\n        // So, to avoid subtle memory issues, always call the\n        // disposers when the reactions are no longer needed.\n        this.disposer1()\n        this.disposer2()\n    }\n}\n```\n\n</details>\n\nIn environments that support [Explicit Resource Management](https://github.com/tc39/proposal-explicit-resource-management),\nthe disposer function includes a `[Symbol.dispose]` method that can be used to\ndispose of the reaction. This can be useful when disposing of several reactions\nsimultaneously or when disposing of reactions alongside other Disposables.\n\n<details id=\"disposable-stack\"><summary>**Example:** using DisposableStack<a href=\"#disposable-stack\" class=\"tip-anchor\"></a></summary>\n\n```javascript\nfunction createSomeDisposableResource() {}\n\nclass Vat {\n    value = 1.2\n\n    constructor() {\n        makeAutoObservable(this)\n    }\n}\n\nconst vat = new Vat()\n\nclass OrderLine {\n    price = 10\n    amount = 1\n    disposableStack = new DisposableStack()\n    someDisposableResource\n\n    constructor() {\n        makeAutoObservable(this)\n\n        this.disposableStack.use(autorun(() => {\n            doSomethingWith(this.price * this.amount)\n        }))\n\n        this.disposableStack.use(autorun(() => {\n            doSomethingWith(this.price * this.amount * vat.value)\n        }))\n\n        this.someDisposableResource = this.disposableStack.use(createSomeDisposableResource())\n    }\n\n    [Symbol.dispose]() {\n        this.disposableStack[Symbol.dispose]();\n    }\n}\n```\n\n</details>\n\n## Use reactions sparingly!\n\nAs it was already said, you won't create reactions very often.\nIt might very well be that your application doesn't use any of these APIs directly, and the only way reactions are constructed is indirectly, through for example `observer` from the mobx-react bindings.\n\nBefore you set up a reaction, it is good to first check if it conforms to the following principles:\n\n1. **Only use Reactions if there is no direct relation between cause and effect**: If a side effect should happen in response to a very limited set of events / actions, it will often be clearer to directly trigger the effect from those specific actions. For example, if pressing a form submit button should lead to a network request to be posted, it is clearer to trigger this effect directly in response of the `onClick` event, rather than indirectly through a reaction. In contrast, if any change you make to the form state should automatically end up in local storage, then a reaction can be very useful, so that you don't have to trigger this effect from every individual `onChange` event.\n1. **Reactions shouldn't update other observables**: Is the reaction going to modify other observables? If the answer is yes, typically the observable you want to update should be annotated as a [`computed`](computeds.md) value instead. For example, if a collection of todos is altered, don't use a reaction to compute the amount of `remainingTodos`, but annotate `remainingTodos` as a computed value. That will lead to much clearer and easier to debug code. Reactions should not compute new data, but only cause effects.\n1. **Reactions should be independent**: Does your code rely on some other reaction having to run first? If that is the case, you probably\n   either violated the first rule, or the new reaction you are about to create should be merged into the one it is depending upon. MobX does not guarantee the order in which reactions will be run.\n\nThere are real-life scenarios that do not fit in the above principles. That is why they are _principles_, not _laws_.\nBut, the exceptions are rare so only violate them as a last resort.\n\n## Options {🚀}\n\nThe behavior of `autorun`, `reaction` and `when` can be further fine-tuned by passing in an `options` argument as shown in the usages above.\n\n### `name`\n\nThis string is used as a debug name for this reaction in the [Spy event listeners](analyzing-reactivity.md#spy) and [MobX developer tools](https://github.com/mobxjs/mobx-devtools).\n\n### `fireImmediately` _(reaction)_\n\nBoolean indicating that the _effect_ function should immediately be triggered after the first run of the _data_ function. `false` by default.\n\n### `delay` _(autorun, reaction)_\n\nNumber of milliseconds that can be used to throttle the effect function. If zero (default), no throttling happens.\n\n### `timeout` _(when)_\n\nSet a limited amount of time that `when` will wait for. If the deadline passes, `when` will reject / throw.\n\n### `signal`\n\nAn AbortSignal object instance; can be used as an alternative method for disposal.<br>\nWhen used with promise version of `when`, the promise rejects with the \"WHEN_ABORTED\" error.\n\n### `onError`\n\nBy default, any exception thrown inside an reaction will be logged, but not further thrown. This is to make sure that an exception in one reaction does not prevent the scheduled execution of other, possibly unrelated reactions. This also allows reactions to recover from exceptions. Throwing an exception does not break the tracking done by MobX, so subsequent runs of the reaction might complete normally again if the cause for the exception is removed. This option allows overriding that behavior. It is possible to set a global error handler or to disable catching errors completely using [configure](configuration.md#disableerrorboundaries-boolean).\n\n### `scheduler` _(autorun, reaction)_\n\nSet a custom scheduler to determine how re-running the autorun function should be scheduled. It takes a function that should be invoked at some point in the future, for example: `{ scheduler: run => { setTimeout(run, 1000) }}`\n\n### `equals`: (reaction)\n\nSet to `comparer.default` by default. If specified, this comparer function is used to compare the previous and next values produced by the _data_ function. The _effect_ function is only invoked if this function returns false.\n\nCheck out the [Built-in comparers](computeds.md#built-in-comparers) section.\n"
  },
  {
    "path": "docs/refguide/action.md",
    "content": "---\ntitle: Updating state using actions\nhide_title: true\n---\n\n<script async type=\"text/javascript\" src=\"//cdn.carbonads.com/carbon.js?serve=CEBD4KQ7&placement=mobxjsorg\" id=\"_carbonads_js\"></script>\n\n# This document has been updated and moved\n\n[Please click on this link to open the updated version.](../actions.md)\n"
  },
  {
    "path": "docs/refguide/api.md",
    "content": "---\ntitle: MobX API overview\nhide_title: true\n---\n\n<script async type=\"text/javascript\" src=\"//cdn.carbonads.com/carbon.js?serve=CEBD4KQ7&placement=mobxjsorg\" id=\"_carbonads_js\"></script>\n\n# This document has been updated and moved\n\n[Please click on this link to open the updated version.](../api.md)\n"
  },
  {
    "path": "docs/refguide/autorun.md",
    "content": "---\ntitle: Running side effects with reactions\nhide_title: true\n---\n\n<script async type=\"text/javascript\" src=\"//cdn.carbonads.com/carbon.js?serve=CEBD4KQ7&placement=mobxjsorg\" id=\"_carbonads_js\"></script>\n\n# This document has been updated and moved\n\n[Please click on this link to open the updated version.](../reactions.md)\n"
  },
  {
    "path": "docs/refguide/computed-with-args.md",
    "content": "---\ntitle: Computeds with arguments\nhide_title: true\n---\n\n<script async type=\"text/javascript\" src=\"//cdn.carbonads.com/carbon.js?serve=CEBD4KQ7&placement=mobxjsorg\" id=\"_carbonads_js\"></script>\n\n# This document has been updated and moved\n\n[Please click on this link to open the updated version.](../computeds-with-args.md)\n"
  },
  {
    "path": "docs/refguide/computed.md",
    "content": "---\ntitle: Deriving information with computeds\nhide_title: true\n---\n\n<script async type=\"text/javascript\" src=\"//cdn.carbonads.com/carbon.js?serve=CEBD4KQ7&placement=mobxjsorg\" id=\"_carbonads_js\"></script>\n\n# This document has been updated and moved\n\n[Please click on this link to open the updated version.](../computeds.md)\n"
  },
  {
    "path": "docs/refguide/configure.md",
    "content": "---\ntitle: Configuration\nhide_title: true\n---\n\n<script async type=\"text/javascript\" src=\"//cdn.carbonads.com/carbon.js?serve=CEBD4KQ7&placement=mobxjsorg\" id=\"_carbonads_js\"></script>\n\n# This document has been updated and moved\n\n[Please click on this link to open the updated version.](../configuration.md)\n"
  },
  {
    "path": "docs/refguide/extending.md",
    "content": "---\ntitle: Creating custom observables\nhide_title: true\n---\n\n<script async type=\"text/javascript\" src=\"//cdn.carbonads.com/carbon.js?serve=CEBD4KQ7&placement=mobxjsorg\" id=\"_carbonads_js\"></script>\n\n# This document has been updated and moved\n\n[Please click on this link to open the updated version.](../custom-observables.md)\n"
  },
  {
    "path": "docs/refguide/mobx-utils.md",
    "content": "---\ntitle: MobX-utils\nhide_title: true\n---\n\n<script async type=\"text/javascript\" src=\"//cdn.carbonads.com/carbon.js?serve=CEBD4KQ7&placement=mobxjsorg\" id=\"_carbonads_js\"></script>\n\n# This document has been updated and moved\n\n[Please click on this link to open the updated version.](../mobx-utils.md)\n"
  },
  {
    "path": "docs/refguide/modifiers.md",
    "content": "---\ntitle: Observable modifiers\nhide_title: true\n---\n\n<script async type=\"text/javascript\" src=\"//cdn.carbonads.com/carbon.js?serve=CEBD4KQ7&placement=mobxjsorg\" id=\"_carbonads_js\"></script>\n\n# This document has been updated and moved\n\n[Please click on this link to open the updated version.](../observable-state.md#available-annotations)\n"
  },
  {
    "path": "docs/refguide/object-api.md",
    "content": "---\ntitle: Collection utilities\nhide_title: true\n---\n\n<script async type=\"text/javascript\" src=\"//cdn.carbonads.com/carbon.js?serve=CEBD4KQ7&placement=mobxjsorg\" id=\"_carbonads_js\"></script>\n\n# This document has been updated and moved\n\n[Please click on this link to open the updated version.](../collection-utilities.md)\n"
  },
  {
    "path": "docs/refguide/object.md",
    "content": "---\ntitle: Observable Objects\nhide_title: true\n---\n\n<script async type=\"text/javascript\" src=\"//cdn.carbonads.com/carbon.js?serve=CEBD4KQ7&placement=mobxjsorg\" id=\"_carbonads_js\"></script>\n\n# This document has been updated and moved\n\n[Please click on this link to open the updated version.](../api.md#observableobject)\n"
  },
  {
    "path": "docs/refguide/observable.md",
    "content": "---\ntitle: Creating observable state\nhide_title: true\n---\n\n<script async type=\"text/javascript\" src=\"//cdn.carbonads.com/carbon.js?serve=CEBD4KQ7&placement=mobxjsorg\" id=\"_carbonads_js\"></script>\n\n# This document has been updated and moved\n\n[Please click on this link to open the updated version.](../observable-state.md)\n"
  },
  {
    "path": "docs/refguide/observe.md",
    "content": "---\ntitle: Intercept & Observe\nhide_title: true\n---\n\n<script async type=\"text/javascript\" src=\"//cdn.carbonads.com/carbon.js?serve=CEBD4KQ7&placement=mobxjsorg\" id=\"_carbonads_js\"></script>\n\n# This document has been updated and moved\n\n[Please click on this link to open the updated version.](../intercept-and-observe.md)\n"
  },
  {
    "path": "docs/refguide/on-become-observed.md",
    "content": "---\ntitle: Creating lazy observables\nhide_title: true\n---\n\n<script async type=\"text/javascript\" src=\"//cdn.carbonads.com/carbon.js?serve=CEBD4KQ7&placement=mobxjsorg\" id=\"_carbonads_js\"></script>\n\n# This document has been updated and moved\n\n[Please click on this link to open the updated version.](../lazy-observables.md)\n"
  },
  {
    "path": "docs/refguide/set.md",
    "content": "---\ntitle: Observable Sets\nhide_title: true\n---\n\n<script async type=\"text/javascript\" src=\"//cdn.carbonads.com/carbon.js?serve=CEBD4KQ7&placement=mobxjsorg\" id=\"_carbonads_js\"></script>\n\n# This document has been updated and moved\n\n[Please click on this link to open the updated version.](../api.md#observableset)\n"
  },
  {
    "path": "docs/styles/website.css",
    "content": "h1 {\n    display: -ms-flexbox;\n    display: flex;\n    width: 100%;\n    -ms-flex-pack: start;\n    justify-content: flex-start;\n}\n"
  },
  {
    "path": "docs/subclassing.md",
    "content": "---\ntitle: Subclassing\nsidebar_label: Subclassing\nhide_title: true\n---\n\n<script async type=\"text/javascript\" src=\"//cdn.carbonads.com/carbon.js?serve=CEBD4KQ7&placement=mobxjsorg\" id=\"_carbonads_js\"></script>\n\n# Subclassing\n\nSubclassing is supported with [limitations](#limitations). Most notably you can only **override actions/flows/computeds on prototype** - you cannot override _[field declarations](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes#field_declarations)_. Use the `override` annotation for methods/getters overridden in a subclass - see example below. Try to keep things simple and prefer composition over inheritance.\n\n```javascript\nimport { makeObservable, observable, computed, action, override } from \"mobx\"\n\nclass Parent {\n    // Annotated instance fields are NOT overridable\n    observable = 0\n    arrowAction = () => {}\n\n    // Non-annotated instance fields are overridable\n    overridableArrowAction = action(() => {})\n\n    // Annotated prototype methods/getters are overridable\n    action() {}\n    actionBound() {}\n    get computed() {}\n\n    constructor(value) {\n        makeObservable(this, {\n            observable: observable,\n            arrowAction: action\n            action: action,\n            actionBound: action.bound,\n            computed: computed,\n        })\n    }\n}\n\nclass Child extends Parent {\n    /* --- INHERITED --- */\n    // THROWS - TypeError: Cannot redefine property\n    // observable = 5\n    // arrowAction = () = {}\n\n    // OK - not annotated\n    overridableArrowAction = action(() => {})\n\n    // OK - prototype\n    action() {}\n    actionBound() {}\n    get computed() {}\n\n    /* --- NEW --- */\n    childObservable = 0;\n    childArrowAction = () => {}\n    childAction() {}\n    childActionBound() {}\n    get childComputed() {}\n\n    constructor(value) {\n        super()\n        makeObservable(this, {\n            // inherited\n            action: override,\n            actionBound: override,\n            computed: override,\n            // new\n            childObservable: observable,\n            childArrowAction: action,\n            childAction: action,\n            childActionBound: action.bound,\n            childComputed: computed,\n        })\n    }\n}\n```\n\n## Limitations\n\n1. Only `action`, `computed`, `flow`, `action.bound` defined **on prototype** can be **overridden** by subclass.\n1. Field can't be re-annotated in subclass, except with `override`.\n1. `makeAutoObservable` does not support subclassing.\n1. Extending builtins (`ObservableMap`, `ObservableArray`, etc) is not supported.\n1. You can't provide different options to `makeObservable` in subclass.\n1. You can't mix annotations/decorators in single inheritance chain.\n1. [All other limitations apply as well](observable-state.md#limitations)\n\n### `TypeError: Cannot redefine property`\n\nIf you see this, you're probably trying to **override arrow function** in subclass `x = () => {}`. That's not possible because **all annotated** fields of classes are **non-configurable** ([see limitations](observable-state.md#limitations)). You have two options:\n\n<details><summary>1. Move function to prototype and use `action.bound` annotation instead</summary>\n\n```javascript\nclass Parent {\n    // action = () => {};\n    // =>\n    action() {}\n\n    constructor() {\n        makeObservable(this, {\n            action: action.bound\n        })\n    }\n}\nclass Child {\n    action() {}\n\n    constructor() {\n        super()\n        makeObservable(this, {\n            action: override\n        })\n    }\n}\n```\n\n</details>\n<details><summary>2. Remove `action` annotation and wrap the function in action manually: `x = action(() => {})`</summary>\n\n```javascript\nclass Parent {\n    // action = () => {};\n    // =>\n    action = action(() => {})\n\n    constructor() {\n        makeObservable(this, {}) // <-- annotation removed\n    }\n}\nclass Child {\n    action = action(() => {})\n\n    constructor() {\n        super()\n        makeObservable(this, {}) // <-- annotation removed\n    }\n}\n```\n\n</details>\n"
  },
  {
    "path": "docs/the-gist-of-mobx.md",
    "content": "---\ntitle: The gist of MobX\nsidebar_label: The gist of MobX\nhide_title: true\n---\n\n<script async type=\"text/javascript\" src=\"//cdn.carbonads.com/carbon.js?serve=CEBD4KQ7&placement=mobxjsorg\" id=\"_carbonads_js\"></script>\n\n# The gist of MobX\n\n## Concepts\n\nMobX distinguishes between the following three concepts in your application:\n\n1. State\n2. Actions\n3. Derivations\n\nLet's take a closer look at these concepts below, or alternatively, in the [10 minute introduction to MobX and React](https://mobx.js.org/getting-started), where you can interactively dive deeper into these concepts step by step and build a simple Todo list app.\n\nSome might recognise the concept of \"Signals\" in the concepts described below.\nThis is correct, MobX is a signal based state management library avant la lettre.\n\n### 1. Define state and make it observable\n\n_State_ is the data that drives your application.\nUsually, there is _domain specific state_ like a list of todo items, and there is _view state_, such as the currently selected element.\nState is like spreadsheet cells that hold a value.\n\nStore state in any data structure you like: plain objects, arrays, classes, cyclic data structures or references. It doesn't matter for the workings of MobX.\nJust make sure that all properties you want to change over time are marked as `observable` so MobX can track them.\n\nHere is a simple example:\n\n```javascript\nimport { makeObservable, observable, action } from \"mobx\"\n\nclass Todo {\n    id = Math.random()\n    title = \"\"\n    finished = false\n\n    constructor(title) {\n        makeObservable(this, {\n            title: observable,\n            finished: observable,\n            toggle: action\n        })\n        this.title = title\n    }\n\n    toggle() {\n        this.finished = !this.finished\n    }\n}\n```\n\nUsing `observable` is like turning a property of an object into a spreadsheet cell.\nBut unlike spreadsheets, these values can not only be primitive values, but also references, objects and arrays.\n\n<details><summary>Tip: Prefer classes, plain objects or decorators? MobX supports many styles.</summary>\n\nThis example can be shortened using [`makeAutoObservable`](observable-state.md), but by being explicit we can showcase the different concepts in greater detail.\nNote that MobX doesn't dictate an object style, plain objects instead can be used as well, as can decorators for even more concise classes. See the page for more details.\n\n</details>\n\nBut what about `toggle`, which we marked as `action`?\n\n### 2. Update state using actions\n\nAn _action_ is any piece of code that changes the _state_. User events, backend data pushes, scheduled events, etc.\nAn action is like a user that enters a new value into a spreadsheet cell.\n\nIn the `Todo` model above you can see that we have a `toggle` method that changes the value of `finished`. `finished` is marked as `observable`. It is recommended that you mark any piece of code that changes `observable`'s as an [`action`](actions.md). That way MobX can automatically apply transactions for effortless optimal performance.\n\nUsing actions helps you structure your code and prevents you from inadvertently changing state when you don't intend to.\nMethods that modify state are called _actions_ in MobX terminology. In contrast to _views_, which compute new information based on the current state.\nEvery method should serve at most one of those two goals.\n\n### 3. Create derivations that automatically respond to state changes\n\n_Anything_ that can be derived from the _state_ without any further interaction is a derivation.\nDerivations exist in many forms:\n\n-   The _user interface_\n-   _Derived data_, such as the number of remaining `todos`\n-   _Backend integrations_, e.g. sending changes to the server\n\nMobX distinguishes between two kinds of derivations:\n\n-   _Computed values_, which can always be derived from the current observable state using a pure function\n-   _Reactions_, side effects that need to happen automatically when the state changes (bridge between imperative and reactive programming)\n\nWhen starting with MobX, people tend to overuse reactions.\nThe golden rule is, always use `computed` if you want to create a value based on the current state.\n\n#### 3.1. Model derived values using computed\n\nTo create a _computed_ value, define a property using a JS getter function `get` and mark it as `computed` with `makeObservable`.\n\n```javascript\nimport { makeObservable, observable, computed } from \"mobx\"\n\nclass TodoList {\n    todos = []\n    get unfinishedTodoCount() {\n        return this.todos.filter(todo => !todo.finished).length\n    }\n    constructor(todos) {\n        makeObservable(this, {\n            todos: observable,\n            unfinishedTodoCount: computed\n        })\n        this.todos = todos\n    }\n}\n```\n\nMobX will ensure that `unfinishedTodoCount` is updated automatically when a todo is added or when one of the `finished` properties is modified.\n\nThese computations resemble formulas in spreadsheet programs like MS Excel. They update automatically, but only when required. That is, if something is interested in their outcome.\n\n#### 3.2. Model side effects using reactions\n\nFor you as a user to be able to see a change in state or computed values on the screen, a _reaction_ that repaints a part of the GUI is needed.\n\nReactions are similar to computed values, but instead of producing information, they produce side effects like printing to the console, making network requests, incrementally updating React component tree to patch the DOM, etc.\n\nIn short, reactions bridge the worlds of [reactive](https://en.wikipedia.org/wiki/Reactive_programming) and [imperative](https://en.wikipedia.org/wiki/Imperative_programming) programming.\n\nBy far the most used form of reactions are UI components.\nNote that it is possible to trigger side effects from both actions and reactions.\nSide effects that have a clear, explicit origin from which they can be triggered, such\nas making a network request when submitting a form, should be triggered explicitly from the relevant event handler.\n\n#### 3.3. Reactive React components\n\nIf you are using React, you can make your components reactive by wrapping them with the [`observer`](react-integration.md) function from the bindings package you've [chosen during installation](installation.md#installation). In this example, we're going to use the more lightweight `mobx-react-lite` package.\n\n```javascript\nimport * as React from \"react\"\nimport { render } from \"react-dom\"\nimport { observer } from \"mobx-react-lite\"\n\nconst TodoListView = observer(({ todoList }) => (\n    <div>\n        <ul>\n            {todoList.todos.map(todo => (\n                <TodoView todo={todo} key={todo.id} />\n            ))}\n        </ul>\n        Tasks left: {todoList.unfinishedTodoCount}\n    </div>\n))\n\nconst TodoView = observer(({ todo }) => (\n    <li>\n        <input type=\"checkbox\" checked={todo.finished} onClick={() => todo.toggle()} />\n        {todo.title}\n    </li>\n))\n\nconst store = new TodoList([new Todo(\"Get Coffee\"), new Todo(\"Write simpler code\")])\nrender(<TodoListView todoList={store} />, document.getElementById(\"root\"))\n```\n\n`observer` converts React components into derivations of the data they render.\nWhen using MobX there are no smart or dumb components.\nAll components render smartly, but are defined in a dumb manner. MobX will simply make sure the components are always re-rendered whenever needed, and never more than that.\n\nSo the `onClick` handler in the above example will force the proper `TodoView` component to re-render as it uses the `toggle` action, but will only cause the `TodoListView` component to re-render if the number of unfinished tasks has changed.\nAnd if you would remove the `Tasks left` line (or put it into a separate component), the `TodoListView` component would no longer re-render when ticking a task.\n\nTo learn more about how React works with MobX, check out the [React integration](react-integration.md) section.\n\n#### 3.4. Custom reactions\n\nYou will need them rarely, but they can be created using the [`autorun`](reactions.md#autorun),\n[`reaction`](reactions.md#reaction) or [`when`](reactions.md#when) functions to fit your specific situations.\nFor example, the following `autorun` prints a log message every time the amount of `unfinishedTodoCount` changes:\n\n```javascript\n// A function that automatically observes the state.\nautorun(() => {\n    console.log(\"Tasks left: \" + todos.unfinishedTodoCount)\n})\n```\n\nWhy does a new message get printed every time the `unfinishedTodoCount` is changed? The answer is this rule of thumb:\n\n_MobX reacts to any existing observable property that is read during the execution of a tracked function._\n\nTo learn more about how MobX determines which observables need to be reacted to, check out the [Understanding reactivity](understanding-reactivity.md) section.\n\n## Principles\n\nMobX uses a uni-directional data flow where _actions_ change the _state_, which in turn updates all affected _views_.\n\n\n![Action, State, View](assets/action-state-view.png)\n\n1. All _derivations_ are updated **automatically** and **atomically** when the _state_ changes. As a result, it is never possible to observe intermediate values.\n\n2. All _derivations_ are updated **synchronously** by default. This means that, for example, _actions_ can safely inspect a computed value directly after altering the _state_.\n\n3. _Computed values_ are updated **lazily**. Any computed value that is not actively in use will not be updated until it is needed for a side effect (I/O).\n   If a view is no longer in use it will be garbage collected automatically.\n\n4. All _computed values_ should be **pure**. They are not supposed to change _state_.\n\nTo learn more about the background context, check out [the fundamental principles behind MobX](https://hackernoon.com/the-fundamental-principles-behind-mobx-7a725f71f3e8).\n\n## Try it out!\n\nYou can play with the above examples yourself on [CodeSandbox](https://codesandbox.io/s/concepts-principles-il8lt?file=/src/index.js:1161-1252).\n\n## Linting\n\nIf you find it hard to adopt the mental model of MobX, configure it to be very strict and warn you at runtime whenever you deviate from these patterns. Check out the [linting MobX](configuration.md#linting-options) section.\n"
  },
  {
    "path": "docs/understanding-reactivity.md",
    "content": "---\ntitle: Understanding reactivity\nsidebar_label: Understanding reactivity\nhide_title: true\n---\n\n<script async type=\"text/javascript\" src=\"//cdn.carbonads.com/carbon.js?serve=CEBD4KQ7&placement=mobxjsorg\" id=\"_carbonads_js\"></script>\n\n# Understanding reactivity\n\nMobX usually reacts to exactly the things you expect it to, which means that in 90% of your use cases MobX should \"just work\".\nHowever, at some point you will encounter a case where it does not do what you expected.\nAt that point it is invaluable to understand how MobX determines what to react to.\n\n> MobX reacts to any _existing_ **observable** _property_ that is read during the execution of a tracked function.\n\n-   _\"reading\"_ is dereferencing an object's property, which can be done through \"dotting into\" it (eg. `user.name`) or using the bracket notation (eg. `user['name']`, `todos[3]`) or destructuring (eg. `const {name} = user`).\n-   _\"tracked functions\"_ are the expression of `computed`, the _rendering_ of an `observer` React function component, the `render()` method of an `observer` based React class component, and the functions that are passed as the first param to `autorun`, `reaction` and `when`.\n-   _\"during\"_ means that only those observables that are read while the function is executing are tracked. It doesn't matter whether these values are used directly or indirectly by the tracked function. But things that have been 'spawned' from the function won't be tracked (e.g. `setTimeout`, `promise.then`, `await` etc).\n\nIn other words, MobX will not react to:\n\n-   Values that are obtained from observables, but outside a tracked function\n-   Observables that are read in an asynchronously invoked code block\n\n## MobX tracks property access, not values\n\nTo elaborate on the above rules with an example, suppose that you have the following observable instance:\n\n```javascript\nclass Message {\n    title\n    author\n    likes\n    constructor(title, author, likes) {\n        makeAutoObservable(this)\n        this.title = title\n        this.author = author\n        this.likes = likes\n    }\n\n    updateTitle(title) {\n        this.title = title\n    }\n}\n\nlet message = new Message(\"Foo\", { name: \"Michel\" }, [\"Joe\", \"Sara\"])\n```\n\nIn memory this looks as follows. The green boxes indicate _observable_ properties. Note that the _values_ themselves are not observable!\n\n![MobX reacts to changing references](assets/observed-refs.png)\n\nWhat MobX basically does is recording which _arrows_ you use in your function. After that, it will re-run whenever one of these _arrows_ changes; when they start to refer to something else.\n\n## Examples\n\nLet's show that with a bunch of examples (based on the `message` variable defined above):\n\n#### Correct: dereference inside the tracked function\n\n```javascript\nautorun(() => {\n    console.log(message.title)\n})\nmessage.updateTitle(\"Bar\")\n```\n\nThis will react as expected. The `.title` property was dereferenced by the autorun, and changed afterwards, so this change is detected.\n\nYou can verify what MobX will track by calling [`trace()`](analyzing-reactivity.md) inside the tracked function. In the case of the above function it outputs the following:\n\n```javascript\nimport { trace } from \"mobx\"\n\nconst disposer = autorun(() => {\n    console.log(message.title)\n    trace()\n})\n// Outputs:\n// [mobx.trace] 'Autorun@2' tracing enabled\n\nmessage.updateTitle(\"Hello\")\n// Outputs:\n// [mobx.trace] 'Autorun@2' is invalidated due to a change in: 'Message@1.title'\nHello\n```\n\nIt is also possible to get the internal dependency (or observer) tree by using `getDependencyTree`:\n\n```javascript\nimport { getDependencyTree } from \"mobx\"\n\n// Prints the dependency tree of the reaction coupled to the disposer.\nconsole.log(getDependencyTree(disposer))\n// Outputs:\n// { name: 'Autorun@2', dependencies: [ { name: 'Message@1.title' } ] }\n```\n\n#### Incorrect: changing a non-observable reference\n\n```javascript\nautorun(() => {\n    console.log(message.title)\n})\nmessage = new Message(\"Bar\", { name: \"Martijn\" }, [\"Felicia\", \"Marcus\"])\n```\n\nThis will **not** react. `message` was changed, but `message` is not an observable, just a variable which _refers to_ an observable, but the variable (reference) itself is not observable.\n\n#### Incorrect: dereference outside of a tracked function\n\n```javascript\nlet title = message.title\nautorun(() => {\n    console.log(title)\n})\nmessage.updateMessage(\"Bar\")\n```\n\nThis will **not** react. `message.title` was dereferenced outside of `autorun`, and just contains the value of `message.title` at the moment of dereferencing (the string `\"Foo\"`). `title` is not an observable so `autorun` will never react.\n\n#### Correct: dereference inside the tracked function\n\n```javascript\nautorun(() => {\n    console.log(message.author.name)\n})\n\nrunInAction(() => {\n    message.author.name = \"Sara\"\n})\nrunInAction(() => {\n    message.author = { name: \"Joe\" }\n})\n```\n\nThis reacts to both changes. Both `author` and `author.name` are dotted into, allowing MobX to track these references.\n\nNote that we had to use `runInAction` here to be allowed to make changes outside\nof an `action`.\n\n#### Incorrect: store a local reference to an observable object without tracking\n\n```javascript\nconst author = message.author\nautorun(() => {\n    console.log(author.name)\n})\n\nrunInAction(() => {\n    message.author.name = \"Sara\"\n})\nrunInAction(() => {\n    message.author = { name: \"Joe\" }\n})\n```\n\nThe first change will be picked up, `message.author` and `author` are the same object, and the `.name` property is dereferenced in the autorun.\nHowever, the second change is **not** picked up, because the `message.author` relation is not tracked by the `autorun`. Autorun is still using the \"old\" `author`.\n\n#### Common pitfall: console.log\n\n```javascript\nautorun(() => {\n    console.log(message)\n})\n\n// Won't trigger a re-run.\nmessage.updateTitle(\"Hello world\")\n```\n\nIn the above example, the updated message title won't be printed, because it is not used inside the autorun.\nThe autorun only depends on `message`, which is not an observable, but a variable. In other words, as far as MobX is concerned, `title` is not used in the `autorun`.\n\nIf you use this in a web browser debugging tool, you may be able to find the\nupdated value of `title` after all, but this is misleading -- autorun run after all has run once when it was first called. This happens because `console.log` is an asynchronous function and the object is only formatted later in time. This means that if you follow the title in the debugging toolbar, you can find the updated value. But the `autorun` does not track any updates.\n\nThe way to make this work is to make sure to always pass immutable data or defensive copies to `console.log`. So the following solutions all react to changes in `message.title`:\n\n```javascript\nautorun(() => {\n    console.log(message.title) // Clearly, the `.title` observable is used.\n})\n\nautorun(() => {\n    console.log(mobx.toJS(message)) // toJS creates a deep clone, and thus will read the message.\n})\n\nautorun(() => {\n    console.log({ ...message }) // Creates a shallow clone, also using `.title` in the process.\n})\n\nautorun(() => {\n    console.log(JSON.stringify(message)) // Also reads the entire structure.\n})\n```\n\n#### Correct: access array properties in tracked function\n\n```javascript\nautorun(() => {\n    console.log(message.likes.length)\n})\nmessage.likes.push(\"Jennifer\")\n```\n\nThis will react as expected. `.length` counts towards a property.\nNote that this will react to _any_ change in the array.\nArrays are not tracked per index / property (like observable objects and maps), but as a whole.\n\n#### Incorrect: access out-of-bounds indices in tracked function\n\n```javascript\nautorun(() => {\n    console.log(message.likes[0])\n})\nmessage.likes.push(\"Jennifer\")\n```\n\nThis will react with the above sample data because array indexes count as property access. But **only** if the provided `index < length`.\nMobX does not track not-yet-existing array indices.\nSo always guard your array index based access with a `.length` check.\n\n#### Correct: access array functions in tracked function\n\n```javascript\nautorun(() => {\n    console.log(message.likes.join(\", \"))\n})\nmessage.likes.push(\"Jennifer\")\n```\n\nThis will react as expected. All array functions that do not mutate the array are tracked automatically.\n\n---\n\n```javascript\nautorun(() => {\n    console.log(message.likes.join(\", \"))\n})\nmessage.likes[2] = \"Jennifer\"\n```\n\nThis will react as expected. All array index assignments are detected, but only if `index <= length`.\n\n#### Incorrect: \"use\" an observable but without accessing any of its properties\n\n```javascript\nautorun(() => {\n    message.likes\n})\nmessage.likes.push(\"Jennifer\")\n```\n\nThis will **not** react. Simply because the `likes` array itself is not being used by the `autorun`, only the reference to the array.\nSo in contrast, `message.likes = [\"Jennifer\"]` would be picked up; that statement does not modify the array, but the `likes` property itself.\n\n#### Correct: using not yet existing map entries\n\n```javascript\nconst twitterUrls = observable.map({\n    Joe: \"twitter.com/joey\"\n})\n\nautorun(() => {\n    console.log(twitterUrls.get(\"Sara\"))\n})\n\nrunInAction(() => {\n    twitterUrls.set(\"Sara\", \"twitter.com/horsejs\")\n})\n```\n\nThis **will** react. Observable maps support observing entries that may not exist.\nNote that this will initially print `undefined`.\nYou can check for the existence of an entry first by using `twitterUrls.has(\"Sara\")`.\nSo in an environment without Proxy support for dynamically keyed collections always use observable maps. If you do have Proxy support you can use observable maps as well,\nbut you also have the option to use plain objects.\n\n#### MobX does not track asynchronously accessed data\n\n```javascript\nfunction upperCaseAuthorName(author) {\n    const baseName = author.name\n    return baseName.toUpperCase()\n}\nautorun(() => {\n    console.log(upperCaseAuthorName(message.author))\n})\n\nrunInAction(() => {\n    message.author.name = \"Chesterton\"\n})\n```\n\nThis will react. Even though `author.name` is not dereferenced by the function passed to `autorun` itself, MobX will still track the dereferencing that happens in `upperCaseAuthorName`, because it happens _during_ the execution of the autorun.\n\n---\n\n```javascript\nautorun(() => {\n    setTimeout(() => console.log(message.likes.join(\", \")), 10)\n})\n\nrunInAction(() => {\n    message.likes.push(\"Jennifer\")\n})\n```\n\nThis will **not** react because during the execution of the `autorun` no observables were accessed, only during the `setTimeout`, which is an asynchronous function.\n\nCheck out the [Asynchronous actions](actions.md#asynchronous-actions) section as well.\n\n#### Using non-observable object properties\n\n```javascript\nautorun(() => {\n    console.log(message.author.age)\n})\n\nrunInAction(() => {\n    message.author.age = 10\n})\n```\n\nThis **will** react if you run React in an environment that supports Proxy.\nNote that this is only done for objects created with `observable` or `observable.object`. New properties on class instances will not be made observable automatically.\n\n_Environments without Proxy support_\n\nThis will **not** react. MobX can only track observable properties, and 'age' has not been defined as observable property above.\n\nHowever, it is possible to use the `get` and `set` methods as exposed by MobX to work around this:\n\n```javascript\nimport { get, set } from \"mobx\"\n\nautorun(() => {\n    console.log(get(message.author, \"age\"))\n})\nset(message.author, \"age\", 10)\n```\n\n#### [Without Proxy support] Incorrect: using not yet existing observable object properties\n\n```javascript\nautorun(() => {\n    console.log(message.author.age)\n})\nextendObservable(message.author, {\n    age: 10\n})\n```\n\nThis will **not** react. MobX will not react to observable properties that did not exist when tracking started.\nIf the two statements are swapped, or if any other observable causes the `autorun` to re-run, the `autorun` will start tracking the `age` as well.\n\n#### [Without Proxy support] Correct: using MobX utilities to read / write to objects\n\nIf you are in an environment without proxy support and still want to use observable\nobjects as a dynamic collection, you can handle them using the MobX `get` and `set`\nAPI.\n\nThe following will react as well:\n\n```javascript\nimport { get, set, observable } from \"mobx\"\n\nconst twitterUrls = observable.object({\n    Joe: \"twitter.com/joey\"\n})\n\nautorun(() => {\n    console.log(get(twitterUrls, \"Sara\")) // `get` can track not yet existing properties.\n})\n\nrunInAction(() => {\n    set(twitterUrls, { Sara: \"twitter.com/horsejs\" })\n})\n```\n\nCheck out the [Collection utilities API](api.md#collection-utilities-) for more details.\n\n#### TL;DR\n\n> MobX reacts to any _existing_ **observable** _property_ that is read during the execution of a tracked function.\n"
  },
  {
    "path": "jest.base.config.js",
    "content": "const fs = require(\"fs\")\nconst path = require(\"path\")\n\nmodule.exports = function buildConfig(\n    packageDirectory,\n    pkgConfig,\n    tsConfig = \"tsconfig.test.json\"\n) {\n    const packageName = require(`${packageDirectory}/package.json`).name\n    const packageTsconfig = path.resolve(packageDirectory, tsConfig)\n    return {\n        preset: \"ts-jest/presets/js-with-ts\",\n        testEnvironment: \"jsdom\",\n        globals: {\n            __DEV__: true\n        },\n        transform: {\n            \"^.+\\\\.[jt]sx?$\": [\n                \"ts-jest\",\n                {\n                    tsconfig: fs.existsSync(packageTsconfig)\n                        ? packageTsconfig\n                        : path.resolve(__dirname, tsConfig)\n                }\n            ]\n        },\n        testRegex: \"__tests__/.*\\\\.(j|t)sx?$\",\n        coverageDirectory: \"<rootDir>/coverage/\",\n        coverageReporters: [\"lcov\", \"text\"],\n        collectCoverageFrom: [\"<rootDir>/src/**/*.{ts,tsx}\", \"!**/node_modules/**\"],\n        displayName: packageName,\n        ...pkgConfig\n    }\n}\n"
  },
  {
    "path": "jest.config.js",
    "content": "module.exports = {\n    coverageDirectory: \"<rootDir>/coverage/\",\n    coverageReporters: [\"lcov\", \"text\"],\n    projects: [\"<rootDir>/packages/*/jest.config.js\", \"<rootDir>/packages/*/jest.config-*.js\"]\n}\n"
  },
  {
    "path": "lerna.json",
    "content": "{\n    \"packages\": [\"packages/*\"],\n    \"version\": \"independent\",\n    \"npmClient\": \"yarn\",\n    \"useWorkspaces\": true\n}\n"
  },
  {
    "path": "package.json",
    "content": "{\n    \"name\": \"mobx-root\",\n    \"private\": true,\n    \"workspaces\": [\n        \"packages/*\"\n    ],\n    \"resolutions\": {\n        \"jest\": \"^30.3.0\",\n        \"typescript\": \"^5.9.2\",\n        \"recast\": \"^0.23.1\"\n    },\n    \"repository\": {\n        \"type\": \"git\",\n        \"url\": \"https://github.com/mobxjs/mobx.git\"\n    },\n    \"scripts\": {\n        \"test\": \"jest\",\n        \"coverage\": \"jest --coverage\",\n        \"lint\": \"eslint packages/*/src/**/* --ext .js,.ts,.tsx\",\n        \"prettier\": \"prettier --write **/*.{js,ts,md}\",\n        \"release\": \"yarn lerna run prepublishOnly && yarn changeset publish\",\n        \"mobx\": \"yarn workspace mobx\",\n        \"mobx-react\": \"yarn workspace mobx-react\",\n        \"mobx-react-lite\": \"yarn workspace mobx-react-lite\",\n        \"mobx-undecorate\": \"yarn workspace mobx-undecorate\",\n        \"eslint-plugin-mobx\": \"yarn workspace eslint-plugin-mobx\",\n        \"docs:build\": \"yarn --cwd website build\",\n        \"docs:start\": \"yarn --cwd website start\",\n        \"docs:publish\": \"yarn --cwd website publish-gh-pages\",\n        \"prepare\": \"yarn dedup && yarn --cwd website install\",\n        \"dedup\": \"npx yarn-deduplicate --strategy fewer yarn.lock\"\n    },\n    \"devDependencies\": {\n        \"@changesets/changelog-github\": \"^0.2.7\",\n        \"@changesets/cli\": \"^2.11.0\",\n        \"@testing-library/dom\": \"^10.4.0\",\n        \"@testing-library/jest-dom\": \"^5.16.4\",\n        \"@testing-library/react\": \"^16.1.0\",\n        \"@types/jest\": \"^30.0.0\",\n        \"@types/node\": \"18\",\n        \"@types/prop-types\": \"^15.5.2\",\n        \"@types/react\": \"^18.0.0\",\n        \"@types/react-dom\": \"^18.0.0\",\n        \"@typescript-eslint/eslint-plugin\": \"^5.0.0\",\n        \"@typescript-eslint/parser\": \"^5.0.0\",\n        \"coveralls\": \"^3.1.0\",\n        \"eslint\": \"^6.8.0\",\n        \"execa\": \"^4.1.0\",\n        \"fs-extra\": \"9.0.1\",\n        \"husky\": \"^4.2.5\",\n        \"import-size\": \"^1.0.2\",\n        \"iterall\": \"^1.3.0\",\n        \"jest\": \"^30.3.0\",\n        \"jest-environment-jsdom\": \"^30.3.0\",\n        \"jest-mock-console\": \"^1.0.1\",\n        \"lerna\": \"^3.22.1\",\n        \"lint-staged\": \"^10.1.7\",\n        \"lodash\": \"^4.17.4\",\n        \"minimist\": \"^1.2.5\",\n        \"mkdirp\": \"1.0.4\",\n        \"prettier\": \"^2.8.4\",\n        \"pretty-quick\": \"3.1.0\",\n        \"prop-types\": \"15.6.2\",\n        \"react\": \"^19.0.0\",\n        \"react-dom\": \"^19.0.0\",\n        \"react-test-renderer\": \"^18.0.0\",\n        \"serializr\": \"^2.0.3\",\n        \"tape\": \"^5.0.1\",\n        \"ts-jest\": \"^29.4.6\",\n        \"tsdx\": \"^0.14.1\",\n        \"typescript\": \"^5.9.2\"\n    },\n    \"husky\": {\n        \"hooks\": {\n            \"pre-commit\": \"pretty-quick --staged\"\n        }\n    },\n    \"packageManager\": \"yarn@1.22.21+sha1.1959a18351b811cdeedbd484a8f86c3cc3bbaf72\"\n}\n"
  },
  {
    "path": "packages/eslint-plugin-mobx/.babelrc.js",
    "content": "module.exports = {\n  \"presets\": [\n    [\"@babel/preset-env\"],\n  ],\n  \"plugins\": [\n    //\"@babel/plugin-transform-runtime\"\n  ]\n};"
  },
  {
    "path": "packages/eslint-plugin-mobx/CHANGELOG.md",
    "content": "# eslint-plugin-mobx\n\n## 0.0.14\n\n### Patch Changes\n\n-   [`f65bc0700461846b05294f857beb211f45eead6f`](https://github.com/mobxjs/mobx/commit/f65bc0700461846b05294f857beb211f45eead6f) [#4613](https://github.com/mobxjs/mobx/pull/4613) Thanks [@roli-lpci](https://github.com/roli-lpci)! - Replace deprecated context.getSourceCode() with context.sourceCode for ESLint 10 compatibility\n\n## 0.0.13\n\n### Patch Changes\n\n-   [`88aa10828eabdf9edf2d0e523e0388c854c79dea`](https://github.com/mobxjs/mobx/commit/88aa10828eabdf9edf2d0e523e0388c854c79dea) [#3947](https://github.com/mobxjs/mobx/pull/3947) Thanks [@dartess](https://github.com/dartess)! - fix config name for recommended flat config\n\n## 0.0.12\n\n### Patch Changes\n\n-   [`218ebde877712775054e027cfda812210d2aa7d6`](https://github.com/mobxjs/mobx/commit/218ebde877712775054e027cfda812210d2aa7d6) [#3942](https://github.com/mobxjs/mobx/pull/3942) Thanks [@dartess](https://github.com/dartess)! - add eslint@9 support and flat config\n\n## 0.0.11\n\n### Patch Changes\n\n-   [`638533e592f4fda7663fa351447380f9d0917d14`](https://github.com/mobxjs/mobx/commit/638533e592f4fda7663fa351447380f9d0917d14) [#3909](https://github.com/mobxjs/mobx/pull/3909) Thanks [@urugator](https://github.com/urugator)! - mobx/missing-observer rule false positive with forwardRef #3908\n\n## 0.0.10\n\n### Patch Changes\n\n-   [`44a5fe07`](https://github.com/mobxjs/mobx/commit/44a5fe07fb95c2ba24d8df19f18b57ee92abb1a9) [#3881](https://github.com/mobxjs/mobx/pull/3881) Thanks [@kade-robertson](https://github.com/kade-robertson)! - Adds an option for the `mobx/exhaustive-make-observable` eslint rule to configure whether fields are annotated with `true` or `false` with the autofixer.\n\n    This option defaults to `true` if not present or an invalid value is received to maintain existing behavior.\n\n## 0.0.9\n\n### Patch Changes\n\n-   [`e63c2df0`](https://github.com/mobxjs/mobx/commit/e63c2df0ef166868675bce21892cd686a46db953) [#3443](https://github.com/mobxjs/mobx/pull/3443) Thanks [@urugator](https://github.com/urugator)! - changeset for PR #3423: deprecate no-anonymous-observer\n\n## 0.0.8\n\n### Patch Changes\n\n-   [`aafda613`](https://github.com/mobxjs/mobx/commit/aafda6136afd107c6cbdd73d9bab57e45a2eb9f5) [#3256](https://github.com/mobxjs/mobx/pull/3256) Thanks [@urugator](https://github.com/urugator)! - fix `no-anonymous-observer` autofix for arrow functions without BlockStatement body\n\n## 0.0.7\n\n### Patch Changes\n\n-   [`0aaf1831`](https://github.com/mobxjs/mobx/commit/0aaf183131f3eadd40c05ccc94139282bd8d7d56) [#3231](https://github.com/mobxjs/mobx/pull/3231) Thanks [@ahoisl](https://github.com/ahoisl)! - fix(lint): fix 'missing-make-observable' rule with constructor overloads\n\n## 0.0.6\n\n### Patch Changes\n\n-   [`4b1337ec`](https://github.com/mobxjs/mobx/commit/4b1337ecd64c7bfc904a04063bd1b07e62e392f1) [#3228](https://github.com/mobxjs/mobx/pull/3228) Thanks [@ahoisl](https://github.com/ahoisl)! - fix name for missing-observer rule in recommended\n\n## 0.0.5\n\n### Patch Changes\n\n-   [`021f34ec`](https://github.com/mobxjs/mobx/commit/021f34ec81daed9e5b5ed8425b2f3e0fa85dfe5b) [#3219](https://github.com/mobxjs/mobx/pull/3219) Thanks [@urugator](https://github.com/urugator)! - Add [`mobx/missing-observer`](https://github.com/mobxjs/mobx/tree/main/packages/eslint-plugin-mobx#mobxmissing-observer),\n    [`mobx/no-anonymous-observer`](https://github.com/mobxjs/mobx/tree/main/packages/eslint-plugin-mobx#mobxno-anonymous-observer) rules,\n\n## 0.0.4\n\n### Patch Changes\n\n-   [`5b6f3001`](https://github.com/mobxjs/mobx/commit/5b6f30017939a2082f7d767a857e0189210a91a7) [#3204](https://github.com/mobxjs/mobx/pull/3204) Thanks [@urugator](https://github.com/urugator)! - changed build process\n\n## 0.0.3\n\n### Patch Changes\n\n-   [`cd6a6a68`](https://github.com/mobxjs/mobx/commit/cd6a6a68245f082bdc35a3109214a5449ef9818d) [#3200](https://github.com/mobxjs/mobx/pull/3200) Thanks [@urugator](https://github.com/urugator)! - fix package.json\n"
  },
  {
    "path": "packages/eslint-plugin-mobx/LICENSE",
    "content": "The MIT License (MIT)\n\nCopyright (c) 2015 Michel Weststrate\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": "packages/eslint-plugin-mobx/README.md",
    "content": "# eslint-plugin-mobx\n\nMobx specific linting rules for `eslint`.\n\n## Installation\n\n```\nnpm install --save-dev eslint @typescript-eslint/parser eslint-plugin-mobx\n```\n\n## Configuration\n\n### Legacy Config\n\n```javascript\n// .eslintrc.js\nmodule.exports = {\n    parser: \"@typescript-eslint/parser\",\n    // Include \"mobx\" in plugins array:\n    plugins: [\"mobx\"],\n    // Either extend our recommended configuration:\n    extends: \"plugin:mobx/recommended\",\n    // ...or specify and customize individual rules:\n    rules: {\n        // these values are the same as recommended\n        \"mobx/exhaustive-make-observable\": \"warn\",\n        \"mobx/unconditional-make-observable\": \"error\",\n        \"mobx/missing-make-observable\": \"error\",\n        \"mobx/missing-observer\": \"warn\"\n    }\n}\n```\n\n### Flat Config\n\n```javascript\n// eslint.config.js\nimport pluginMobx from \"eslint-plugin-mobx\"\n\nexport default [\n    // ...\n\n    // Either extend our recommended configuration:\n    pluginMobx.flatConfigs.recommended,\n\n    // ...or specify and customize individual rules:\n    {\n        plugins: { mobx: pluginMobx },\n        rules: {\n            // these values are the same as recommended\n            \"mobx/exhaustive-make-observable\": \"warn\",\n            \"mobx/unconditional-make-observable\": \"error\",\n            \"mobx/missing-make-observable\": \"error\",\n            \"mobx/missing-observer\": \"warn\"\n        }\n    }\n]\n```\n\n## Rules\n\n### mobx/exhaustive-make-observable\n\nMakes sure that `makeObservable` annotates all fields defined on class or object literal.<br>\nTo exclude a field, annotate it using `field: false`.<br>\nDoes not support fields introduced by constructor (`this.foo = 5`).<br>\nDoes not warn about annotated non-existing fields (there is a runtime check, but the autofix removing the field could be handy...).<br>\n**Autofix** adds `field: true` for each missing field by default. You can change this behaviour by specifying options in your eslint config:\n\n```json\n{\n    \"rules\": {\n        \"mobx/exhaustive-make-observable\": [\"error\", { \"autofixAnnotation\": false }]\n    }\n}\n```\n\nThis is a boolean value that controls if the field is annotated with `true` or `false`.\nIf you are migrating an existing project using `makeObservable` and do not want this rule to override\nyour current usage (even if it may be wrong), you should run the autofix with the annotation set to `false` to maintain existing behaviour: `eslint --no-eslintrc --fix --rule='mobx/exhaustive-make-observable: [2, { \"autofixAnnotation\": false }]' .`\n\n### mobx/missing-make-observable\n\n_When using decorators (eg `@observable foo = 5`)_, makes sure that `makeObservable(this)` is called in a constructor.<br>\n**Autofix** creates a constructor if necessary and adds `makeObservable(this)` at it's end.\n\n### mobx/unconditional-make-observable\n\nMakes sure the `make(Auto)Observable(this)` is called unconditionally inside a constructor.\n\n### mobx/missing-observer\n\nMakes sure every React component is wrapped with `observer`. A React component is considered to be any _class_ extending from `Component` or `React.Component` and any _function_ which name has the first letter capitalized (for anonymous functions the name is inferred from variable). These are all considered components:\n\n```javascript\nclass Cmp extends React.Component { }\nclass Cmp extends Component { }\nconst Cmp = class extends React.Component { }\nconst Cmp = class extends Component { }\nclass extends Component { }\nclass extends React.Component { }\n\nfunction Named() { }\nconst foo = function Named() { }\nconst Anonym = function () { };\nconst Arrow = () => { };\n```\n\n**Autofix** wraps the component with `observer` and if necessary declares a constant of the same name: `const Name = observer(function Name() {})`.\nIt's a bit opinionated and can lead to a lot of false positives depending on your conventions. You will probably want to combine this rule with `overrides` option, eg:\n\n```javascript\n// .eslintrc.js\n\"overrides\": [\n  {\n    \"files\": [\"*.jsx\"],\n    \"rules\": {\n      \"mobx/missing-observer\": \"error\"\n    }\n  }\n]\n```\n\n### mobx/no-anonymous-observer (deprecated)\n\n_Deprecated in favor of [react/display-name](https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/display-name.md) + [componentWrapperFunctions](https://github.com/jsx-eslint/eslint-plugin-react). Example of **.eslintrc**:_\n\n```\n{\n  \"rules\": {\n    \"react/display-name\": \"warn\"\n  },\n  \"settings\": {\n    \"componentWrapperFunctions\": [\n      \"observer\"\n    ]\n  }\n}\n```\n\n---\n\nForbids anonymous functions or classes as `observer` components.\nImproves debugging experience and [avoids problem with inability to customize `displayName`](https://github.com/mobxjs/mobx/issues/2721).\nPlays nice with `eslint-plugin-react-hooks` and `mobx/missing-observer` as both of these don't recognize anonymous function as component.\n**Autofix** infers the name from variable if possible.\n"
  },
  {
    "path": "packages/eslint-plugin-mobx/__tests__/exhaustive-make-observable.js",
    "content": "import { getRuleTester } from \"./utils/get-rule-tester\";\n\nimport rule from \"../src/exhaustive-make-observable.js\";\n\nconst tester = getRuleTester();\n\nconst decoratedFields = [\n  '@observable o = 5',\n  '@observable.ref or = []',\n  '@observable.shallow os = []',\n  '@observable.deep od = {}',\n  '@computed get c() {}',\n  '@computed.struct get cs() {}',\n  '@computed({ equals }) get co() {}',\n  '@action a() {}',\n  '@action.bound ab() {}',\n  '@flow *f() {}',\n  '@flow.bound *fb() {}',\n];\n\nconst valid1 = decoratedFields.map(field => `\nclass C {     \n  ${field}\n\n  constructor() {\n    makeObservable(this) \n  }      \n}\n`).map(code => ({ code }))\n\nconst valid2 = {\n  code: `\nclass C {     \n  o = 5\n  get c() {}\n  a() {}\n  *f() {}\n  \n  constructor() {\n    makeObservable(this, {\n      o: true,\n      a: true,\n      c: true,\n      f: true,\n    }) \n  }  \n}\n`\n}\n\nconst valid3 = {\n  code: `\nclass C {     \n  o = 5\n  get c() {}\n  a() {}\n  *f() {}\n  \n  constructor() {\n    makeObservable({})\n  }  \n}\n`\n}\n\nconst invalid1 = {\n  code: `\nclass C {\n  o = 5\n  get c() {}\n  a() {}\n  *f() {}\n  \n  constructor() {\n    makeObservable(this, {\n      a: true,\n      c: true,\n      f: true,\n    })\n  }\n}\n`,\n  errors: [{ messageId: 'missingAnnotation' }],\n  output: `\nclass C {\n  o = 5\n  get c() {}\n  a() {}\n  *f() {}\n  \n  constructor() {\n    makeObservable(this, { o: true, \n      a: true,\n      c: true,\n      f: true,\n    })\n  }\n}\n`\n}\n\nconst invalid2 = {\n  code: `\nclass C {\n  o = 5\n  get c() {}\n  a() {}\n  *f() {}\n  \n  constructor() {\n    makeObservable(this, {\n      o: true,\n      c: true,\n      f: true,\n    })\n  }\n}\n`,\n  errors: [{ messageId: 'missingAnnotation' }],\n  output: `\nclass C {\n  o = 5\n  get c() {}\n  a() {}\n  *f() {}\n  \n  constructor() {\n    makeObservable(this, { a: true, \n      o: true,\n      c: true,\n      f: true,\n    })\n  }\n}\n`\n}\n\nconst invalid3 = {\n  code: `\nclass C {\n  o = 5\n  get c() {}\n  a() {}\n  *f() {}\n  \n  constructor() {\n    makeObservable(this, {\n      o: true,\n      a: true,\n      f: true,\n    })\n  }\n}\n`,\n  errors: [{ messageId: 'missingAnnotation' }],\n  output: `\nclass C {\n  o = 5\n  get c() {}\n  a() {}\n  *f() {}\n  \n  constructor() {\n    makeObservable(this, { c: true, \n      o: true,\n      a: true,\n      f: true,\n    })\n  }\n}\n`\n}\n\nconst invalid4 = {\n  code: `\nclass C {\n  o = 5\n  get c() {}\n  a() {}\n  *f() {}\n  \n  constructor() {\n    makeObservable(this, {\n      o: true,\n      a: true,\n      c: true,\n    })\n  }\n}\n`,\n  errors: [{ messageId: 'missingAnnotation' }],\n  output: `\nclass C {\n  o = 5\n  get c() {}\n  a() {}\n  *f() {}\n  \n  constructor() {\n    makeObservable(this, { f: true, \n      o: true,\n      a: true,\n      c: true,\n    })\n  }\n}\n`\n}\n\nconst invalid5 = {\n  code: `\nclass C {\n  o = 5\n  get c() {}\n  a() {}\n  *f() {}\n  \n  constructor() {\n    makeObservable(this)\n  }\n}\n`,\n  errors: [{ messageId: 'missingAnnotation' }],\n  output: `\nclass C {\n  o = 5\n  get c() {}\n  a() {}\n  *f() {}\n  \n  constructor() {\n    makeObservable(this, { o: true, c: true, a: true, f: true, })\n  }\n}\n`\n}\n\ntester.run(\"exhaustive-make-observable\", rule, {\n  valid: [\n    ...valid1,\n    valid2,\n    valid3,\n  ],\n  invalid: [\n    invalid1,\n    invalid2,\n    invalid3,\n    invalid4,\n    invalid5,\n  ],\n});"
  },
  {
    "path": "packages/eslint-plugin-mobx/__tests__/missing-make-observable.js",
    "content": "import { getRuleTester } from \"./utils/get-rule-tester\";\n\nimport rule from \"../src/missing-make-observable.js\";\n\nconst tester = getRuleTester();\n\nconst fields = [\n  '@observable o = 5',\n  '@observable.ref or = []',\n  '@observable.shallow os = []',\n  '@observable.deep od = {}',\n  '@computed get c() {}',\n  '@computed.struct get cs() {}',\n  '@computed({ equals }) get co() {}',\n  '@action a() {}',\n  '@action.bound ab() {}',\n  '@flow *f() {}',\n  '@flow.bound *fb() {}',\n];\n\nconst valid1 = fields.map(field => `\nclass C {     \n  ${field}\n\n  constructor() {\n    makeObservable(this) \n  }      \n}\n`).map(code => ({ code }))\n\nconst valid2 = {\n  code: `\nclass C {       \n  o = 5;\n  get c() {};\n  a() {};\n  *f() {};\n\n  constructor() {\n    makeObservable(this, {}) \n  }      \n}\n`\n}\n\nconst valid3 = fields.map(field => `\nclass C {     \n  ${field}\n\n  constructor() {\n    makeObservable(this, null, { name: 'foo' }) \n  }      \n}\n`).map(code => ({ code }))\n\nconst valid4 = fields.map(field => `\nclass C {     \n  ${field}\n\n  constructor(aString: string);\n  constructor(aNum: number);\n  constructor(stringOrNum: string | number) {\n    makeObservable(this, null, { name: 'foo' }) \n  }      \n}\n`).map(code => ({ code }))\n\nconst invalid1 = fields.map(field => ({\n  code: `\nclass C {\n  ${field}\n}\n`,\n  errors: [\n    { messageId: 'missingMakeObservable' },\n  ],\n  output: `\nclass C {\nconstructor() { makeObservable(this); }\n  ${field}\n}\n`\n}))\n\nconst invalid2 = fields.map(field => ({\n  code: `\nclass C {\n  ${field}\n  constructor() {}\n}\n`,\n  errors: [\n    { messageId: 'missingMakeObservable' },\n  ],\n  output: `\nclass C {\n  ${field}\n  constructor() {;makeObservable(this);}\n}\n`,\n}))\n\nconst invalid3 = fields.map(field => ({\n  code: `\nclass C {\n  ${field}\n  constructor() {\n    makeObservable({ a: 5 });\n  }\n}\n`,\n  errors: [\n    { messageId: 'missingMakeObservable' },\n  ],\n  output: `\nclass C {\n  ${field}\n  constructor() {\n    makeObservable({ a: 5 });\n  ;makeObservable(this);}\n}\n`,\n}))\n\nconst invalid4 = fields.map(field => ({\n  code: `\nclass C {\n  ${field}\n  constructor()\n}\n`,\n  errors: [\n    { messageId: 'missingMakeObservable' },\n  ],\n  output: `\nclass C {\n  ${field}\n  constructor() { makeObservable(this); }\n}\n`,\n}))\n\n\nconst invalid5 = fields.map(field => ({\n  code: `\nclass C {\n  ${field}\n  constructor() {\n    makeObservable(this, { o: observable.ref });\n  }\n}\n`,\n  errors: [\n    { messageId: 'secondArgMustBeNullish' },\n  ],\n}))\n\n\ntester.run(\"missing-make-observable\", rule, {\n  valid: [\n    ...valid1,\n    valid2,\n    ...valid3,\n    ...valid4,\n  ],\n  invalid: [\n    ...invalid1,\n    ...invalid2,\n    ...invalid3,\n    ...invalid4,\n    ...invalid5,\n  ],\n});"
  },
  {
    "path": "packages/eslint-plugin-mobx/__tests__/missing-observer.js",
    "content": "import { getRuleTester } from \"./utils/get-rule-tester\";\n\nimport rule from \"../src/missing-observer.js\"\n\nconst tester = getRuleTester();\n\nconst valids = [\n    \"observer(function Named() { });\",\n    \"const foo = observer(function Named() { })\",\n    \"const Anonym = observer(function () { });\",\n    \"const Arrow = observer(() => { });\",\n    \"function notCmp() { }\",\n    \"const notCmp = function notCmp() { }\",\n    \"const notCmp = function () { }\",\n    \"const notCmp = () => { }\",\n    \"class NotCmp { }\",\n    \"class NotCmp extends Foo { }\",\n    \"class NotCmp extends React.Foo { }\",\n    \"const Cmp = observer(class Cmp extends React.Component { })\",\n    \"const Cmp = observer(class Cmp extends Component { })\",\n    \"const Cmp = observer(class extends React.Component { })\",\n    \"const Cmp = observer(class extends Component { })\"\n]\n\nconst invalids = [\n    [\"function Named() { }\", \"const Named = observer(function Named() { })\"],\n    [\"const foo = function Named() { }\", \"const foo = observer(function Named() { })\"],\n    [\"const Anonym = function () { };\", \"const Anonym = observer(function () { });\"],\n    [\"const Arrow = () => { };\", \"const Arrow = observer(() => { });\"],\n    [\n        \"class Cmp extends React.Component { }\",\n        \"const Cmp = observer(class Cmp extends React.Component { })\"\n    ],\n    [\"class Cmp extends Component { }\", \"const Cmp = observer(class Cmp extends Component { })\"],\n    [\n        \"const Cmp = class extends React.Component { }\",\n        \"const Cmp = observer(class extends React.Component { })\"\n    ],\n    [\n        \"const Cmp = class extends Component { }\",\n        \"const Cmp = observer(class extends Component { })\"\n    ],\n    [\"class extends Component { }\", \"observer(class extends Component { })\"],\n    [\"class extends React.Component { }\", \"observer(class extends React.Component { })\"]\n]\n\ntester.run(\"missing-observer\", rule, {\n    valid: valids.map(code => ({ code })),\n    invalid: invalids.map(([code, output]) => ({\n        code,\n        output,\n        errors: [{ messageId: \"missingObserver\" }]\n    }))\n})\n"
  },
  {
    "path": "packages/eslint-plugin-mobx/__tests__/no-anonymous-observer.js",
    "content": "import { getRuleTester } from \"./utils/get-rule-tester\";\n\nimport rule from \"../src/no-anonymous-observer.js\"\n\nconst tester = getRuleTester();\n\nconst valids = [\"observer(function Name() {})\", \"observer(class Name {})\"]\n\nconst invalidsNotFixed = [\"observer(() => {})\", \"observer(function () {})\", \"observer(class {})\"]\n\nconst invalidsFixed = [\n    [\"const Cmp = observer(() => {})\", \"const Cmp = observer(function Cmp()  {})\"],\n    ['const Cmp = observer(() => \"\")', 'const Cmp = observer(function Cmp()  { return \"\" })'],\n    [\n        \"const Cmp = observer(() => expr())\",\n        \"const Cmp = observer(function Cmp()  { return expr() })\"\n    ],\n    [\n        \"const Cmp = observer(() => literal)\",\n        \"const Cmp = observer(function Cmp()  { return literal })\"\n    ],\n    [\"const Cmp = observer(function () {})\", \"const Cmp = observer(function Cmp () {})\"],\n    [\"const Cmp = observer(class {})\", \"const Cmp = observer(class Cmp {})\"]\n]\n\ntester.run(\"no-anonymous-observer\", rule, {\n    valid: valids.map(code => ({ code })),\n    invalid: [\n        ...invalidsNotFixed.map(code => ({\n            code,\n            errors: [{ messageId: \"observerComponentMustHaveName\" }]\n        })),\n        ...invalidsFixed.map(([code, output]) => ({\n            code,\n            output,\n            errors: [{ messageId: \"observerComponentMustHaveName\" }]\n        }))\n    ]\n})\n"
  },
  {
    "path": "packages/eslint-plugin-mobx/__tests__/unconditional-make-observable.js",
    "content": "import { getRuleTester } from \"./utils/get-rule-tester\";\n\nimport rule from \"../src/unconditional-make-observable.js\";\n\nconst tester = getRuleTester();\n\nconst valid1 = {\n  code: `\nclass C {\n  constructor() {\n    makeObservable()\n    makeObservable({})\n    makeObservable(this)\n    function f() {\n      makeObservable(this, {});\n    }\n    const ff = function () {\n      makeObservable(this, {});\n    }\n  }    \n}\n`\n}\n\nconst invalid1 = {\n  code: `\nclass C {\n  constructor() {    \n    if (true) {\n      makeObservable(this, {});\n      makeAutoObservable(this, {});\n    }\n    for (let i = 0; i < 1; i++) {\n      makeObservable(this, {});\n      makeAutoObservable(this, {});\n    }\n    while (Math.random() > 1) {\n      makeObservable(this, {});\n      makeAutoObservable(this, {});\n    }\n    const a = () => {\n      makeObservable(this, {});\n    }\n  }    \n}\n`,\n  errors: [\n    { messageId: 'mustCallUnconditionally' },\n    { messageId: 'mustCallUnconditionally' },\n    { messageId: 'mustCallUnconditionally' },\n    { messageId: 'mustCallUnconditionally' },\n    { messageId: 'mustCallUnconditionally' },\n    { messageId: 'mustCallUnconditionally' },\n    { messageId: 'mustCallUnconditionally' },\n  ],\n}\n\ntester.run(\"unconditional-make-observable\", rule, {\n  valid: [\n    valid1,\n  ],\n  invalid: [\n    invalid1\n  ],\n});"
  },
  {
    "path": "packages/eslint-plugin-mobx/__tests__/utils/get-rule-tester.js",
    "content": "const version = global.ESLINT_V;\n\nconst { RuleTester } = require(`eslint-${version}`);\nconst typescriptEslintParser = require(\"@typescript-eslint/parser\");\n\nfunction getRuleTesterConfig() {\n    switch (version) {\n        case 7:\n            return {\n                parser: require.resolve(\"@typescript-eslint/parser\"),\n                parserOptions: {},\n            };\n        case 9:\n            return {\n                languageOptions: {\n                    parser: typescriptEslintParser,\n                    parserOptions: {},\n                },\n            };\n        default:\n            throw new Error(`Unknown or unspecified ESLINT_V (${String(version)})`);\n    }\n}\n\nfunction getRuleTester() {\n    return new RuleTester(getRuleTesterConfig());\n}\n\nexport { getRuleTester }"
  },
  {
    "path": "packages/eslint-plugin-mobx/jest.config-eslint-7.js",
    "content": "const buildConfig = require(\"../../jest.base.config\")\n\nmodule.exports = buildConfig(__dirname, {\n    displayName: 'eslint-plugin-mobx with eslint@7',\n    setupFilesAfterEnv: [\"<rootDir>/jest.setup.js\"],\n    testRegex: \"__tests__/[^/]+\\\\.(t|j)sx?$\",\n    globals: {\n        ESLINT_V: 7\n    }\n})\n"
  },
  {
    "path": "packages/eslint-plugin-mobx/jest.config-eslint-9.js",
    "content": "const buildConfig = require(\"../../jest.base.config\")\n\nmodule.exports = buildConfig(__dirname, {\n    displayName: 'eslint-plugin-mobx with eslint@9',\n    setupFilesAfterEnv: [\"<rootDir>/jest.setup.js\"],\n    testRegex: \"__tests__/[^/]+\\\\.(t|j)sx?$\",\n    globals: {\n        ESLINT_V: 9\n    }\n})\n"
  },
  {
    "path": "packages/eslint-plugin-mobx/jest.setup.js",
    "content": "/** @see https://github.com/jsdom/jsdom/issues/3363 */\nglobal.structuredClone = val => {\n    return JSON.parse(JSON.stringify(val))\n}\n"
  },
  {
    "path": "packages/eslint-plugin-mobx/package.json",
    "content": "{\n    \"name\": \"eslint-plugin-mobx\",\n    \"version\": \"0.0.14\",\n    \"description\": \"ESLint rules for MobX\",\n    \"main\": \"dist/index.js\",\n    \"repository\": {\n        \"type\": \"git\",\n        \"url\": \"https://github.com/mobxjs/mobx.git\",\n        \"directory\": \"packages/eslint-plugin-mobx\"\n    },\n    \"license\": \"MIT\",\n    \"funding\": {\n        \"type\": \"opencollective\",\n        \"url\": \"https://opencollective.com/mobx\"\n    },\n    \"bugs\": {\n        \"url\": \"https://github.com/mobxjs/mobx/issues\"\n    },\n    \"files\": [\n        \"src\",\n        \"dist\",\n        \"LICENSE\",\n        \"CHANGELOG.md\",\n        \"README.md\"\n    ],\n    \"homepage\": \"https://mobx.js.org/\",\n    \"peerDependencies\": {\n        \"eslint\": \"^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0 || ^9.0.0 || ^10.0.0\"\n    },\n    \"devDependencies\": {\n        \"@babel/core\": \"^7.16.0\",\n        \"@babel/preset-env\": \"^7.16.4\",\n        \"@rollup/plugin-babel\": \"^5.3.0\",\n        \"@rollup/plugin-commonjs\": \"^21.0.1\",\n        \"@rollup/plugin-node-resolve\": \"13.0.6\",\n        \"@typescript-eslint/eslint-plugin\": \"^5.0.0\",\n        \"@typescript-eslint/parser\": \"^5.0.0\",\n        \"eslint\": \"^7.0.0\",\n        \"eslint-7\": \"npm:eslint@^7.0.0\",\n        \"eslint-9\": \"npm:eslint@^9.0.0\",\n        \"rollup\": \"^2.60.2\"\n    },\n    \"keywords\": [\n        \"eslint\",\n        \"eslint-plugin\",\n        \"eslintplugin\",\n        \"mobx\"\n    ],\n    \"scripts\": {\n        \"test:7\": \"jest --config jest.config-eslint-7.js\",\n        \"test:9\": \"jest --config jest.config-eslint-9.js\",\n        \"test\": \"npm run test:7 && npm run test:9\",\n        \"build\": \"yarn rollup --config\",\n        \"prepublishOnly\": \"yarn build\"\n    }\n}\n"
  },
  {
    "path": "packages/eslint-plugin-mobx/preview/.eslintrc.js",
    "content": "module.exports = {\n    \"extends\": [\n        \"plugin:mobx/recommended\"\n    ],\n    \"env\": {\n        \"browser\": true,\n        \"es6\": true,\n        \"node\": true\n    },\n    \"parser\": \"@typescript-eslint/parser\",\n    \"parserOptions\": {\n        \"ecmaVersion\": 2018,\n        \"sourceType\": \"module\"\n    },\n    \"plugins\": [\n        \"mobx\",\n        //\"@typescript-eslint\"\n    ],\n    \"rules\": {\n        //'mobx/exhaustive-make-observable': 'off',\n        //'mobx/unconditional-make-observable': 'off',\n        //'mobx/missing-observer': 'off',\n    }\n};"
  },
  {
    "path": "packages/eslint-plugin-mobx/preview/.gitignore",
    "content": "!node_modules\n"
  },
  {
    "path": "packages/eslint-plugin-mobx/preview/make-observable.js",
    "content": "/* eslint mobx/exhaustive-make-observable: \"error\" */\n/* eslint mobx/missing-make-observable: \"error\" */\n/* eslint mobx/unconditional-make-observable: \"error\" */\n\nmakeObservable();\nmakeObservable(foo, {});\nmakeObservable(this, {});\nmakeAutoObservable();\nmakeAutoObservable(foo, {});\nmakeAutoObservable(this, {});\n\nmakeObservable({\n  o: 5,\n  a() { },\n  get c() { },\n  set c() { },\n  \"lit\": 1,\n  [cmp()]() { },\n});\n\n// ok\nmakeObservable({\n  o: 5,\n  a() { },\n  get c() { },\n  set c() { },\n  \"lit\": 1,\n}, {\n  o: observable,\n  a: action,\n  c: computed,\n  \"lit\": 1,\n  [cmp()]() { },\n});\n\nclass Exhaustive1 {\n  o = 5;\n  a() { };\n  get c() { };\n  set c() { };\n  \"lit\" = 1;\n  [cmp()]() { };\n\n  constructor() {\n    makeObservable(this, {})\n  }\n}\n\nclass Exhaustive2 {\n  o = 5;\n  a() { };\n  get c() { };\n  set c() { };\n  \"lit\" = 1;\n  [cmp()]() { };\n\n  constructor() {\n    // ok\n    makeObservable(this, {\n      o: observable,\n      a: action,\n      c: computed,\n      \"lit\": 1,\n      [cmp()]() { },\n    })\n  }\n}\n\nclass Exhaustive3 {\n  o = 5;\n  o2 = 5;\n  a() { };\n  a2() { };\n  get c() { };\n  get c2() { };\n\n  constructor() {\n    makeObservable(this, {\n      o: observable,\n      a: action,\n      c: computed,\n    })\n  }\n}\n\nclass Exhaustive4 {\n  o = 5;\n  a() { };\n  get c() { };\n\n  constructor() {\n    function a() {\n      makeObservable(this) // ok - `this` doesn't refer to class instance  \n    }\n  }\n}\n\nclass Exhaustive4 {\n  o = 5;\n  a() { };\n  get c() { };\n\n  constructor() {\n    makeObservable({}); // ok - not making `this` observable \n  }\n}\n\nclass Unconditional2 {\n  constructor() {\n    makeObservable(this, {}); // ok - no condition\n    makeObservable() // ok - no `this`\n    makeObservable({}) // ok - no `this`\n    if (true) {\n      makeObservable(this, {});\n      makeAutoObservable(this, {});\n    }\n    for (let i = 0; i < 1; i++) {\n      makeObservable(this, {});\n      makeAutoObservable(this, {});\n    }\n    while (Math.random() > 1) {\n      makeObservable(this, {});\n      makeAutoObservable(this, {});\n    }\n    const a = () => {\n      makeObservable(this, {});\n    }\n    function f() {\n      makeObservable(this, {}); // ok - `this` doesn't refer to class instance    \n    }\n    const ff = function () {\n      makeObservable(this, {}); // ok - `this` doesn't refer to class instance    \n    }\n  }\n}\n\nclass MissingMakeObservable1 {\n  @observable o = 5;\n}\n\nclass MissingMakeObservable2 {\n  @observable o = 5;\n  constructor() { }\n}\n\nclass MissingMakeObservable3 {\n  @observable o = 5;\n  constructor() {\n    makeObservable({})\n  }\n}\n\nclass MissingMakeObservable4 {\n  @observable o = 5;\n  constructor()\n}\n\n// ok\nclass MissingMakeObservable5 {\n  @observable o = 5;\n  constructor() {\n    makeObservable(this)\n  }\n}"
  },
  {
    "path": "packages/eslint-plugin-mobx/preview/missing-observer.js",
    "content": "/* eslint mobx/missing-observer: \"error\" */\n\nfunction Named() {}\nconst named = function Named() {}\nconst namedRef = forwardRef(function Named() {})\nconst Anonym = function () {}\nconst AnonymRef = forwardRef(function () {})\nconst Arrow = () => {}\nconst ArrowRef = forwardRef(() => {})\n\nobserver(function Named() {})\nobserver(forwardRef(function Named() {}))\nconst namedObs = observer(function Named() {})\nconst namedRefObs = observer(forwardRef(function Named() {}))\nconst AnonymObs = observer(function () {})\nconst AnonymRefObs = observer(forwardRef(function () {}))\nconst ArrowObs = observer(() => {})\nconst ArrowRefObs = observer(forwardRef(() => {}))\n\nfunction notCmp() {}\nconst notCmp = function notCmp() {}\nconst notCmp = function () {}\nconst notCmp = () => {}\nconst notCmp = forwardRef(() => {})\n\nclass Cmp extends React.Component {}\nclass Cmp extends Component {}\nconst Cmp = class extends React.Component {}\nconst Cmp = class extends Component {}\n;(class extends Component {})\n;(class extends React.Component {})\n\nclass NotCmp {}\nclass NotCmp extends Foo {}\nclass NotCmp extends React.Foo {}\n\nconst Cmp = observer(class Cmp extends React.Component {})\nconst Cmp = observer(class Cmp extends Component {})\nconst Cmp = observer(class extends React.Component {})\nconst Cmp = observer(class extends Component {})\n"
  },
  {
    "path": "packages/eslint-plugin-mobx/preview/no-anonymous-observer.js",
    "content": "/* eslint mobx/no-anonymous-observer: \"error\" */\n\nobserver(() => {})\nobserver(function () {})\nobserver(class {})\n\nconst Cmp = observer(() => {})\nconst Cmp = observer(() => \"\") // different autofix\nconst Cmp = observer(() => expr()) // different autofix\nconst Cmp = observer(() => literal) // different autofix\nconst Cmp = observer(function () {})\nconst Cmp = observer(class {})\n\nobserver(function Name() {})\nobserver(class Name {})\n"
  },
  {
    "path": "packages/eslint-plugin-mobx/preview/node_modules/eslint-plugin-mobx/index.js",
    "content": "// At the time of writing, eslint config does not allow filenames as plugins.\n// This is a fake module used as workaround.\nmodule.exports = require('../../../src/index.js');"
  },
  {
    "path": "packages/eslint-plugin-mobx/rollup.config.js",
    "content": "import { nodeResolve } from \"@rollup/plugin-node-resolve\";\nimport commonjs from \"@rollup/plugin-commonjs\";\nimport babel from \"@rollup/plugin-babel\";\nimport pkg from \"./package.json\";\n\nexport default [\n  {\n    input: \"src/index.js\",\n    plugins: [\n      nodeResolve(),\n      commonjs(),\n      babel({\n        babelHelpers: \"bundled\",\n        exclude: \"**/node_modules/**\",\n      }),\n    ],\n    output: [\n      { file: pkg.main, format: \"cjs\", exports: \"auto\" },\n    ],\n  },\n];"
  },
  {
    "path": "packages/eslint-plugin-mobx/src/exhaustive-make-observable.js",
    "content": "\"use strict\"\n\nconst { findAncestor, isMobxDecorator } = require(\"./utils.js\")\n\n// TODO support this.foo = 5; in constructor\n// TODO? report on field as well\nfunction create(context) {\n    const sourceCode = context.sourceCode ?? context.getSourceCode()\n    const autofixAnnotation = context.options[0]?.autofixAnnotation ?? true\n\n    function fieldToKey(field) {\n        // TODO cache on field?\n        const key = sourceCode.getText(field.key)\n        return field.computed ? `[${key}]` : key\n    }\n\n    return {\n        'CallExpression[callee.name=\"makeObservable\"]': makeObservable => {\n            // Only interested about makeObservable(this, ...) in constructor or makeObservable({}, ...)\n            // ClassDeclaration\n            //   ClassBody\n            //     MethodDefinition[kind=\"constructor\"]\n            //       FunctionExpression\n            //         BlockStatement\n            //           ExpressionStatement\n            //             CallExpression[callee.name=\"makeObservable\"]\n            const [firstArg, secondArg] = makeObservable.arguments\n            if (!firstArg) return\n            let members\n            if (firstArg.type === \"ThisExpression\") {\n                const closestFunction = findAncestor(\n                    makeObservable,\n                    node =>\n                        node.type === \"FunctionExpression\" || node.type === \"FunctionDeclaration\"\n                )\n                if (closestFunction?.parent?.kind !== \"constructor\") return\n                members = closestFunction.parent.parent.parent.body.body\n            } else if (firstArg.type === \"ObjectExpression\") {\n                members = firstArg.properties\n            } else {\n                return\n            }\n\n            const annotationProps = secondArg?.properties || []\n            const nonAnnotatedMembers = []\n            let hasAnyDecorator = false\n\n            members.forEach(member => {\n                if (member.static) return\n                if (member.kind === \"constructor\") return\n                //if (member.type !== 'MethodDefinition' && member.type !== 'ClassProperty') return;\n                hasAnyDecorator =\n                    hasAnyDecorator || member.decorators?.some(isMobxDecorator) || false\n                if (!annotationProps.some(prop => fieldToKey(prop) === fieldToKey(member))) {\n                    // TODO optimize?\n                    nonAnnotatedMembers.push(member)\n                }\n            })\n            /*\n      // With decorators, second arg must be null/undefined or not provided\n      if (hasAnyDecorator && secondArg && secondArg.name !== \"undefined\" && secondArg.value !== null) {\n        context.report({\n          node: makeObservable,\n          message: 'When using decorators, second arg must be `null`, `undefined` or not provided.',\n        })\n      }\n      // Without decorators, in constructor, second arg must be object literal\n      if (!hasAnyDecorator && firstArg.type === 'ThisExpression' && (!secondArg || secondArg.type !== 'ObjectExpression')) {\n        context.report({\n          node: makeObservable,\n          message: 'Second argument must be object in form of `{ key: annotation }`.',\n        })\n      }\n      */\n\n            if (!hasAnyDecorator && nonAnnotatedMembers.length) {\n                // Set avoids reporting twice for setter+getter pair or actual duplicates\n                const keys = [...new Set(nonAnnotatedMembers.map(fieldToKey))]\n                const keyList = keys.map(key => `\\`${key}\\``).join(\", \")\n\n                const fix = fixer => {\n                    const annotationList =\n                        keys.map(key => `${key}: ${autofixAnnotation}`).join(\", \") + \",\"\n                    if (!secondArg) {\n                        return fixer.insertTextAfter(firstArg, `, { ${annotationList} }`)\n                    } else if (secondArg.type !== \"ObjectExpression\") {\n                        return fixer.replaceText(secondArg, `{ ${annotationList} }`)\n                    } else {\n                        const openingBracket = sourceCode.getFirstToken(secondArg)\n                        return fixer.insertTextAfter(openingBracket, ` ${annotationList} `)\n                    }\n                }\n\n                context.report({\n                    node: makeObservable,\n                    messageId: \"missingAnnotation\",\n                    data: { keyList },\n                    fix\n                })\n            }\n        }\n    }\n}\n\nmodule.exports = {\n    meta: {\n        type: \"suggestion\",\n        fixable: \"code\",\n        schema: [\n            {\n                type: \"object\",\n                properties: {\n                    autofixAnnotation: {\n                        type: \"boolean\"\n                    }\n                },\n                additionalProperties: false\n            }\n        ],\n        docs: {\n            description: \"enforce all fields being listen in `makeObservable`\",\n            recommended: true,\n            suggestion: false\n        },\n        messages: {\n            missingAnnotation:\n                \"Missing annotation for {{ keyList }}. To exclude a field, use `false` as annotation.\"\n        }\n    },\n    create\n}\n"
  },
  {
    "path": "packages/eslint-plugin-mobx/src/index.js",
    "content": "\"use strict\"\n\nconst fs = require(\"fs\")\nconst path = require(\"path\")\n\nconst exhaustiveMakeObservable = require(\"./exhaustive-make-observable.js\")\nconst unconditionalMakeObservable = require(\"./unconditional-make-observable.js\")\nconst missingMakeObservable = require(\"./missing-make-observable.js\")\nconst missingObserver = require(\"./missing-observer\")\nconst noAnonymousObserver = require(\"./no-anonymous-observer.js\")\n\nconst pkg = JSON.parse(fs.readFileSync(path.join(__dirname, \"..\", \"package.json\"), \"utf8\"))\n\nconst pluginMobx = {\n    meta: {\n        name: pkg.name,\n        version: pkg.version\n    },\n    rules: {\n        \"exhaustive-make-observable\": exhaustiveMakeObservable,\n        \"unconditional-make-observable\": unconditionalMakeObservable,\n        \"missing-make-observable\": missingMakeObservable,\n        \"missing-observer\": missingObserver,\n        \"no-anonymous-observer\": noAnonymousObserver\n    }\n}\n\nconst recommendedRules = {\n    \"mobx/exhaustive-make-observable\": \"warn\",\n    \"mobx/unconditional-make-observable\": \"error\",\n    \"mobx/missing-make-observable\": \"error\",\n    \"mobx/missing-observer\": \"warn\"\n}\n\nmodule.exports = {\n    ...pluginMobx,\n    configs: {\n        recommended: {\n            plugins: [\"mobx\"],\n            rules: recommendedRules\n        }\n    },\n    flatConfigs: {\n        recommended: {\n            name: \"mobx/recommended\",\n            plugins: { mobx: pluginMobx },\n            rules: recommendedRules\n        }\n    }\n}\n"
  },
  {
    "path": "packages/eslint-plugin-mobx/src/missing-make-observable.js",
    "content": "'use strict';\n\nconst { findAncestor, isMobxDecorator } = require('./utils.js');\n\nfunction create(context) {\n  const sourceCode = context.sourceCode ?? context.getSourceCode();\n\n  return {\n    'Decorator': decorator => {\n      if (!isMobxDecorator(decorator)) return;\n      const clazz = findAncestor(decorator, node => node.type === 'ClassDeclaration' || node.type === 'ClassExpression');\n      if (!clazz) return;\n      // ClassDeclaration > ClassBody > []\n      const constructor = clazz.body.body.find(node => node.kind === 'constructor' && node.value.type === 'FunctionExpression') ??\n        clazz.body.body.find(node => node.kind === 'constructor');\n      // MethodDefinition > FunctionExpression > BlockStatement > []\n      const isMakeObservable = node => node.expression?.callee?.name === 'makeObservable' && node.expression?.arguments[0]?.type === 'ThisExpression';\n      const makeObservable = constructor?.value.body?.body.find(isMakeObservable)?.expression;\n\n      if (makeObservable) {\n        // make sure second arg is nullish\n        const secondArg = makeObservable.arguments[1];\n        if (secondArg && secondArg.value !== null && secondArg.name !== 'undefined') {\n          context.report({\n            node: makeObservable,\n            messageId: 'secondArgMustBeNullish',\n          })\n        }\n      } else {\n        const fix = fixer => {\n          if (constructor?.value.type === 'TSEmptyBodyFunctionExpression') {\n            // constructor() - yes this a thing\n            const closingBracket = sourceCode.getLastToken(constructor.value);\n            return fixer.insertTextAfter(closingBracket, ' { makeObservable(this); }')\n          } else if (constructor) {\n            // constructor() {}\n            const closingBracket = sourceCode.getLastToken(constructor.value.body);\n            return fixer.insertTextBefore(closingBracket, ';makeObservable(this);')\n          } else {\n            // class C {}\n            const openingBracket = sourceCode.getFirstToken(clazz.body);\n            return fixer.insertTextAfter(openingBracket, '\\nconstructor() { makeObservable(this); }')\n          }\n        };\n\n        context.report({\n          node: clazz,\n          messageId: 'missingMakeObservable',\n          fix,\n        })\n      }\n    },\n  };\n}\n\nmodule.exports = {\n  meta: {\n    type: 'problem',\n    fixable: 'code',\n    docs: {\n      description: 'prevents missing `makeObservable(this)` when using decorators',\n      recommended: true,\n      suggestion: false,\n    },\n    messages: {\n      missingMakeObservable: \"Constructor is missing `makeObservable(this)`.\",\n      secondArgMustBeNullish: \"`makeObservable`'s second argument must be nullish or not provided when using decorators.\"\n    },\n  },\n  create,\n};"
  },
  {
    "path": "packages/eslint-plugin-mobx/src/missing-observer.js",
    "content": "\"use strict\"\n\nfunction create(context) {\n    const sourceCode = context.sourceCode ?? context.getSourceCode()\n\n    return {\n        \"FunctionDeclaration,FunctionExpression,ArrowFunctionExpression,ClassDeclaration,ClassExpression\":\n            cmp => {\n                if (\n                    cmp.parent &&\n                    cmp.parent.type === \"CallExpression\" &&\n                    cmp.parent.callee.name === \"observer\"\n                ) {\n                    // observer(...)\n                    return\n                }\n                let forwardRef =\n                    cmp.parent &&\n                    cmp.parent.type === \"CallExpression\" &&\n                    cmp.parent.callee.name === \"forwardRef\"\n                        ? cmp.parent\n                        : undefined\n                if (\n                    forwardRef &&\n                    forwardRef.parent &&\n                    forwardRef.parent.type === \"CallExpression\" &&\n                    forwardRef.parent.callee.name === \"observer\"\n                ) {\n                    // forwardRef(observer(...))\n                    return\n                }\n\n                const cmpOrForwardRef = forwardRef || cmp\n                let name = cmp.id?.name\n                // If anonymous try to infer name from variable declaration\n                if (!name && cmpOrForwardRef.parent?.type === \"VariableDeclarator\") {\n                    name = cmpOrForwardRef.parent.id.name\n                }\n                if (cmp.type.startsWith(\"Class\")) {\n                    // Must extend Component or React.Component\n                    const { superClass } = cmp\n                    if (!superClass) {\n                        // not a component\n                        return\n                    }\n                    const superClassText = sourceCode.getText(superClass)\n                    if (superClassText !== \"Component\" && superClassText !== \"React.Component\") {\n                        // not a component\n                        return\n                    }\n                } else {\n                    // Name must start with uppercase letter\n                    if (!name?.charAt(0).match(/^[A-Z]$/)) {\n                        // not a component\n                        return\n                    }\n                }\n\n                const fix = fixer => {\n                    return [\n                        fixer.insertTextBefore(\n                            sourceCode.getFirstToken(cmpOrForwardRef),\n                            (name && cmp.type.endsWith(\"Declaration\") ? `const ${name} = ` : \"\") +\n                                \"observer(\"\n                        ),\n                        fixer.insertTextAfter(sourceCode.getLastToken(cmpOrForwardRef), \")\")\n                    ]\n                }\n                context.report({\n                    node: cmp,\n                    messageId: \"missingObserver\",\n                    data: {\n                        name: name || \"<anonymous>\"\n                    },\n                    fix\n                })\n            }\n    }\n}\n\nmodule.exports = {\n    meta: {\n        type: \"problem\",\n        fixable: \"code\",\n        docs: {\n            description: \"prevents missing `observer` on react component\",\n            recommended: true\n        },\n        messages: {\n            missingObserver: \"Component `{{ name }}` is missing `observer`.\"\n        }\n    },\n    create\n}\n"
  },
  {
    "path": "packages/eslint-plugin-mobx/src/no-anonymous-observer.js",
    "content": "\"use strict\"\n\nfunction create(context) {\n    const sourceCode = context.sourceCode ?? context.getSourceCode()\n\n    return {\n        'CallExpression[callee.name=\"observer\"]': observer => {\n            const cmp = observer.arguments[0]\n            if (!cmp) return\n            if (cmp?.id?.name) return\n\n            const fix = fixer => {\n                // Use name from variable for autofix\n                const name =\n                    observer.parent?.type === \"VariableDeclarator\"\n                        ? observer.parent.id.name\n                        : undefined\n\n                if (!name) return\n                if (cmp.type === \"ArrowFunctionExpression\") {\n                    const arrowToken = sourceCode.getTokenBefore(cmp.body)\n                    const fixes = [\n                        fixer.replaceText(arrowToken, \"\"),\n                        fixer.insertTextBefore(cmp, `function ${name}`)\n                    ]\n                    if (cmp.body.type !== \"BlockStatement\") {\n                        fixes.push(\n                            fixer.insertTextBefore(cmp.body, `{ return `),\n                            fixer.insertTextAfter(cmp.body, ` }`)\n                        )\n                    }\n                    return fixes\n                }\n                if (cmp.type === \"FunctionExpression\") {\n                    const functionToken = sourceCode.getFirstToken(cmp)\n                    return fixer.replaceText(functionToken, `function ${name}`)\n                }\n                if (cmp.type === \"ClassExpression\") {\n                    const classToken = sourceCode.getFirstToken(cmp)\n                    return fixer.replaceText(classToken, `class ${name}`)\n                }\n            }\n            context.report({\n                node: cmp,\n                messageId: \"observerComponentMustHaveName\",\n                fix\n            })\n        }\n    }\n}\n\nmodule.exports = {\n    meta: {\n        type: \"problem\",\n        fixable: \"code\",\n        docs: {\n            description: \"forbids anonymous functions or classes as `observer` components\",\n            recommended: true\n        },\n        messages: {\n            observerComponentMustHaveName: \"`observer` component must have a name.\"\n        }\n    },\n    create\n}\n"
  },
  {
    "path": "packages/eslint-plugin-mobx/src/unconditional-make-observable.js",
    "content": "'use strict';\n\nconst { findAncestor } = require('./utils.js');\n\nfunction create(context) {\n  return {\n    'CallExpression[callee.name=/(makeObservable|makeAutoObservable)/]': makeObservable => {\n      // Only iterested about makeObservable(this, ...) inside constructor and not inside nested bindable function\n      const [firstArg] = makeObservable.arguments;\n      if (!firstArg) return;\n      if (firstArg.type !== 'ThisExpression') return;\n      //     MethodDefinition[key.name=\"constructor\"][kind=\"constructor\"]\n      //       FunctionExpression\n      //         BlockStatement\n      //           ExpressionStatement\n      //             CallExpression[callee.name=\"makeObservable\"]\n      const closestFunction = findAncestor(makeObservable, node => node.type === 'FunctionExpression' || node.type === 'FunctionDeclaration');\n      if (closestFunction?.parent?.kind !== 'constructor') return;\n      if (makeObservable.parent.parent.parent !== closestFunction) {\n        context.report({\n          node: makeObservable,\n          messageId: 'mustCallUnconditionally',\n          data: {\n            name: makeObservable.callee.name,\n          }\n        });\n      }\n    },\n  };\n}\n\nmodule.exports = {\n  meta: {\n    type: 'problem',\n    docs: {\n      description: 'disallows calling `makeObservable(this)` conditionally inside constructors',\n      recommended: true,\n    },\n    messages: {\n      mustCallUnconditionally: '`{{ name }}` must be called unconditionally inside constructor.',\n    }\n  },\n  create,\n}"
  },
  {
    "path": "packages/eslint-plugin-mobx/src/utils.js",
    "content": "'use strict';\n\nconst mobxDecorators = new Set(['observable', 'computed', 'action', 'flow', 'override']);\n\nfunction isMobxDecorator(decorator) {\n  return mobxDecorators.has(decorator.expression.name) // @foo\n    || mobxDecorators.has(decorator.expression.callee?.name) // @foo()\n    || mobxDecorators.has(decorator.expression.object?.name) // @foo.bar\n}\n\nfunction findAncestor(node, match) {\n  const { parent } = node;\n  if (!parent) return;\n  if (match(parent)) return parent;\n  return findAncestor(parent, match);\n}\n\nfunction assert(expr, error) {\n  if (!expr) {\n    error ??= 'Assertion failed';\n    error = error instanceof Error ? error : new Error(error)\n    throw error;\n  }\n}\n\nmodule.exports = {\n  findAncestor,\n  isMobxDecorator,\n}"
  },
  {
    "path": "packages/mobx/.flowconfig",
    "content": "[ignore]\n.*/node_modules\n\n[include]\n__tests__/v5/flow\n\n[libs]\nflow-typed/\n\n[options]\nsuppress_comment= \\\\(.\\\\|\\n\\\\)*\\\\$ExpectError\n"
  },
  {
    "path": "packages/mobx/.gitignore",
    "content": "# Both are copied during the build\nREADME.md\nLICENSE\n\ntemp\nperf_report"
  },
  {
    "path": "packages/mobx/CHANGELOG.md",
    "content": "# mobx\n\n## 6.15.1\n\n### Patch Changes\n\n-   [`df81c144fb148b64140d761aa61f032a7f429e12`](https://github.com/mobxjs/mobx/commit/df81c144fb148b64140d761aa61f032a7f429e12) [#4523](https://github.com/mobxjs/mobx/pull/4523) Thanks [@exzos28](https://github.com/exzos28)! - Make `FlowCancellationError` a proper `Error` instance while preserving its previous string representation.\n\n-   [`21fc4de6c09a77caf115aedd2fe6df972637412b`](https://github.com/mobxjs/mobx/commit/21fc4de6c09a77caf115aedd2fe6df972637412b) [#4626](https://github.com/mobxjs/mobx/pull/4626) Thanks [@kubk](https://github.com/kubk)! - Export `CancellablePromise` from the public `mobx` entrypoint.\n\n## 6.15.0\n\n### Minor Changes\n\n-   [`2e703388eda4ba3eefed2bf1f5ca3958980978c3`](https://github.com/mobxjs/mobx/commit/2e703388eda4ba3eefed2bf1f5ca3958980978c3) [#4584](https://github.com/mobxjs/mobx/pull/4584) Thanks [@mweststrate](https://github.com/mweststrate)! - Fix #4753: Wrong inferred type of observable.map in TS 5.9+, by @mbest in #578\n\n### Patch Changes\n\n-   [`61d6cf39764f28c6c2e0d2b3912364889739c619`](https://github.com/mobxjs/mobx/commit/61d6cf39764f28c6c2e0d2b3912364889739c619) [#4563](https://github.com/mobxjs/mobx/pull/4563) Thanks [@mweststrate](https://github.com/mweststrate)! - Fixed memory leak where makeAutoObservable would keep wrapping setters defined on the prototype. Fixes #4553\n\n## 6.14.0\n\n### Minor Changes\n\n-   [`fe1d3f45cfd0d21189e963579e5c9d764329fea9`](https://github.com/mobxjs/mobx/commit/fe1d3f45cfd0d21189e963579e5c9d764329fea9) [#4558](https://github.com/mobxjs/mobx/pull/4558) Thanks [@vkrol](https://github.com/vkrol)! - Add Explicit Resource Management support in reactions\n\n## 6.13.7\n\n### Patch Changes\n\n-   [`54e3f71ca02f09b3107290f18d8484b70a6e2f0b`](https://github.com/mobxjs/mobx/commit/54e3f71ca02f09b3107290f18d8484b70a6e2f0b) [#4528](https://github.com/mobxjs/mobx/pull/4528) Thanks [@k-g-a](https://github.com/k-g-a)! - Fix observable.set not respecting the new value from interceptors\n\n## 6.13.6\n\n### Patch Changes\n\n-   [`bca3841347f4fba50ad910e1c4176c56ba0173d1`](https://github.com/mobxjs/mobx/commit/bca3841347f4fba50ad910e1c4176c56ba0173d1) [#3993](https://github.com/mobxjs/mobx/pull/3993) Thanks [@tonyraoul](https://github.com/tonyraoul)! - Improve observableset memory footprint and performance\n\n## 6.13.5\n\n### Patch Changes\n\n-   [`4c077738776d5fc7ba0f108805a9ec816c2709b9`](https://github.com/mobxjs/mobx/commit/4c077738776d5fc7ba0f108805a9ec816c2709b9) [#3943](https://github.com/mobxjs/mobx/pull/3943) Thanks [@tonyraoul](https://github.com/tonyraoul)! - Fix browser compatability issue introduced in 6.13.4 release\n\n## 6.13.4\n\n### Patch Changes\n\n-   [`f91d2e1dc85a53b729c03bd28ab39ffcf0838403`](https://github.com/mobxjs/mobx/commit/f91d2e1dc85a53b729c03bd28ab39ffcf0838403) [#3935](https://github.com/mobxjs/mobx/pull/3935) Thanks [@tonyraoul](https://github.com/tonyraoul)! - Update typescript version to 5.6.2 and added support for esnext iterator helpers\n\n## 6.13.3\n\n### Patch Changes\n\n-   [`a1cf2c63ef92d3d42a5b42a23ff6c7a745664cfd`](https://github.com/mobxjs/mobx/commit/a1cf2c63ef92d3d42a5b42a23ff6c7a745664cfd) [#3902](https://github.com/mobxjs/mobx/pull/3902) Thanks [@jzhan-canva](https://github.com/jzhan-canva)! - Fix 2022.3 @action decorators on fields no longer require makeObservable\n\n## 6.13.2\n\n### Patch Changes\n\n-   [`f1f922152b45357a49ee6b310e9e0ecf38bd3955`](https://github.com/mobxjs/mobx/commit/f1f922152b45357a49ee6b310e9e0ecf38bd3955) [#3921](https://github.com/mobxjs/mobx/pull/3921) Thanks [@urugator](https://github.com/urugator)! - fix: #3919 new set methods not working with observable set\n\n## 6.13.1\n\n### Patch Changes\n\n-   [`5e711e0b4737fd6b5b3c6f9b32afd4f195bc5fc3`](https://github.com/mobxjs/mobx/commit/5e711e0b4737fd6b5b3c6f9b32afd4f195bc5fc3) [#3901](https://github.com/mobxjs/mobx/pull/3901) Thanks [@peterm-canva](https://github.com/peterm-canva)! - Shrink Atom and Reaction using a bitfield\n\n## 6.13.0\n\n### Minor Changes\n\n-   [`16f070e6aac60e9010c2591b1743276d700b23d5`](https://github.com/mobxjs/mobx/commit/16f070e6aac60e9010c2591b1743276d700b23d5) [#3898](https://github.com/mobxjs/mobx/pull/3898) Thanks [@inoyakaigor](https://github.com/inoyakaigor)! - Added new Set methods\n\n## 6.12.5\n\n### Patch Changes\n\n-   [`ba890343`](https://github.com/mobxjs/mobx/commit/ba8903430ce96746db5dcde6b78edeb195ea8018) [#3893](https://github.com/mobxjs/mobx/pull/3893) Thanks [@g6123](https://github.com/g6123)! - Fix ES6 Map/Set checks for cross-window scripts\n\n## 6.12.4\n\n### Patch Changes\n\n-   [`e9e1955f`](https://github.com/mobxjs/mobx/commit/e9e1955f745545d796d906b6e0ba04a6cde3f1ee) [#3880](https://github.com/mobxjs/mobx/pull/3880) Thanks [@peterm-canva](https://github.com/peterm-canva)! - Shrink ComputedValue using a bitfield\n\n## 6.12.2\n\n### Patch Changes\n\n-   [`61abc53f`](https://github.com/mobxjs/mobx/commit/61abc53ff10554d1d5ce3e85466f6beda4d63fa2) [#3852](https://github.com/mobxjs/mobx/pull/3852) Thanks [@mweststrate](https://github.com/mweststrate)! - Patched the release process, forcing release to get everything in pristine state.\n\n*   [`b28e0ebb`](https://github.com/mobxjs/mobx/commit/b28e0ebbfc9aa11293bc185216da92997e497fd3) [#3816](https://github.com/mobxjs/mobx/pull/3816) Thanks [@barroij](https://github.com/barroij)! - Fix `IReactionDisposer` and `IIsObservableObject` interface definition so that Typescript knows the property key `$mobx` is a symbol and not a string\n\n## 6.12.1\n\n### Patch Changes\n\n-   [`620f78c7`](https://github.com/mobxjs/mobx/commit/620f78c74e66bc532a96e28b26fd2d0ed1b67d54) [#3812](https://github.com/mobxjs/mobx/pull/3812) Thanks [@barroij](https://github.com/barroij)! - Prevent `reaction` from heeping a Reference to the OldValue that would prevent GC.\n\n*   [`6111b093`](https://github.com/mobxjs/mobx/commit/6111b0939d0d3c0d46dc325ba6bbd5f740a161d3) [#3833](https://github.com/mobxjs/mobx/pull/3833) Thanks [@realyze](https://github.com/realyze)! - Reduce memory overhead of tracking dependencies\n\n## 6.12.0\n\n### Minor Changes\n\n-   [`ec5db592`](https://github.com/mobxjs/mobx/commit/ec5db592d7756826c31e710b1c759d7e9406b153) [#3792](https://github.com/mobxjs/mobx/pull/3792) Thanks [@tonyraoul](https://github.com/tonyraoul)! - Improve observablearray proxy pefromance for es2023.array and es2022.array methods\n\n### Patch Changes\n\n-   [`86616c11`](https://github.com/mobxjs/mobx/commit/86616c11c108a511331eb05e55c08fc2c5a23f4d) [#3654](https://github.com/mobxjs/mobx/pull/3654) Thanks [@ahoisl](https://github.com/ahoisl)! - fix: action transparently forwards toString of underlying function\n\n## 6.11.0\n\n### Minor Changes\n\n-   [`c9260974`](https://github.com/mobxjs/mobx/commit/c9260974f726f58de0fd4974ea024c644d9b7c6f) [#3790](https://github.com/mobxjs/mobx/pull/3790) Thanks [@mweststrate](https://github.com/mweststrate)! - Added support for modern 2022.3 Decorators. [#3790](https://github.com/mobxjs/mobx/pull/3790)\n    -   [Installation / usage instruction](https://mobx.js.org/enabling-decorators.html).\n    -   [Introduction announcement](https://michel.codes/blogs/mobx-decorators)\n    -   Original PR by [@Matchlighter](https://github.com/Matchlighter) in [#3638](https://github.com/mobxjs/mobx/pull/3638),\n\n## 6.10.2\n\n### Patch Changes\n\n-   [`c8d9374d`](https://github.com/mobxjs/mobx/commit/c8d9374d4f3b05cfec0d690e0eb3ada4f619ff0b) [#3748](https://github.com/mobxjs/mobx/pull/3748) Thanks [@mweststrate](https://github.com/mweststrate)! - Fixed: #3747, computed values becoming stale if the underlying observable was created and updated outside a reactive context\n\n## 6.10.1\n\n### Patch Changes\n\n-   [`3ceeb865`](https://github.com/mobxjs/mobx/commit/3ceeb8651e328c4c7211c875696b3f5269fea834) [#3732](https://github.com/mobxjs/mobx/pull/3732) Thanks [@urugator](https://github.com/urugator)! - - fix: #3728: Observable initialization updates state version.\n    -   fix: Observable set initialization violates `enforceActions: \"always\"`.\n    -   fix: Changing keys of observable object does not respect `enforceActions`.\n\n## 6.10.0\n\n### Minor Changes\n\n-   [`bebd5f05`](https://github.com/mobxjs/mobx/commit/bebd5f0507a109145f401c78630ed9d59e4a1101) [#3727](https://github.com/mobxjs/mobx/pull/3727) Thanks [@rluvaton](https://github.com/rluvaton)! - Added support for `signal` (AbortSignal) in `autorun`, `reaction` and sync `when` options to dispose them\n\n### Patch Changes\n\n-   [`55f78ddc`](https://github.com/mobxjs/mobx/commit/55f78ddc20e84f38a7aa88b99a51ad994e558241) [#3717](https://github.com/mobxjs/mobx/pull/3717) Thanks [@liucan233](https://github.com/liucan233)! - remove proxy option for makeObservable and makeAutoObservable\n\n## 6.9.1\n\n### Patch Changes\n\n-   [`4792303e`](https://github.com/mobxjs/mobx/commit/4792303ec9119c1ba54134fff7e845d21a1d9337) [#3709](https://github.com/mobxjs/mobx/pull/3709) Thanks [@kubk](https://github.com/kubk)! - Make trace() noop in production build\n\n## 6.9.0\n\n### Minor Changes\n\n-   [`44a2cf42`](https://github.com/mobxjs/mobx/commit/44a2cf42dec7635f639ddbfb19202ebc710bac54) [#3590](https://github.com/mobxjs/mobx/pull/3590) Thanks [@urugator](https://github.com/urugator)! - Better support for React 18: Mobx now keeps track of a global state version, which updates with each mutation.\n\n## 6.8.0\n\n### Minor Changes\n\n-   [`fed3ff14`](https://github.com/mobxjs/mobx/commit/fed3ff14ca4dcbc788c4678e6d3f4edf747ffdb0) [#3608](https://github.com/mobxjs/mobx/pull/3608) Thanks [@emereum](https://github.com/emereum)! - Do not expose the methods `observe_` or `intercept_` on computed values and observable values.\n\n### Patch Changes\n\n-   [`42f8ac05`](https://github.com/mobxjs/mobx/commit/42f8ac057ec70c508232339016cc7249123f0fd0) [#3596](https://github.com/mobxjs/mobx/pull/3596) Thanks [@urugator](https://github.com/urugator)! - fix #3595 onBecomeObserved is not called for ObservableSet\n\n*   [`2bccc5b3`](https://github.com/mobxjs/mobx/commit/2bccc5b3ca1df6444c942c715718519d590281e0) [#3583](https://github.com/mobxjs/mobx/pull/3583) Thanks [@urugator](https://github.com/urugator)! - fix #3582: AbortSignal leaks @types/node\n\n-   [`7095fa45`](https://github.com/mobxjs/mobx/commit/7095fa4569afb538b7f153ce2b2a8078f2dbe1fc) [#3609](https://github.com/mobxjs/mobx/pull/3609) Thanks [@emereum](https://github.com/emereum)! - Restore generic types for newValue and oldValue on IValueDidChange and IBoxDidChange.\n\n## 6.7.0\n\n### Minor Changes\n\n-   [`8cf4784f`](https://github.com/mobxjs/mobx/commit/8cf4784f53857cc977aed641bd778f2c14a080f5) [#3559](https://github.com/mobxjs/mobx/pull/3559) Thanks [@urugator](https://github.com/urugator)! - Proxied observable arrays can now safely read/write out of bound indices. See https://github.com/mobxjs/mobx/discussions/3537\n\n*   [`223e3688`](https://github.com/mobxjs/mobx/commit/223e3688631528a327c79d39e2f497c6e1506165) [#3551](https://github.com/mobxjs/mobx/pull/3551) Thanks [@deadbeef84](https://github.com/deadbeef84)! - Added new option `signal` to `when()`, to support abortion using an AbortSignal / AbortController.\n\n### Patch Changes\n\n-   [`fe25cfed`](https://github.com/mobxjs/mobx/commit/fe25cfede0aee3bddd7fa434a14ed4b40a57ee26) [#3566](https://github.com/mobxjs/mobx/pull/3566) Thanks [@upsuper](https://github.com/upsuper)! - Make return value of reportObserved match invoke of onBecomeObserved\n\n## 6.6.2\n\n### Patch Changes\n\n-   [`b375535c`](https://github.com/mobxjs/mobx/commit/b375535c422453963f5d3485a2ef5233568c12a6) [#3344](https://github.com/mobxjs/mobx/pull/3344) Thanks [@Nokel81](https://github.com/Nokel81)! - Allow readonly tuples as part of IObservableMapInitialValues\n\n*   [`7260cd41`](https://github.com/mobxjs/mobx/commit/7260cd413b1e52449523826ac239c2a197b2880f) [#3516](https://github.com/mobxjs/mobx/pull/3516) Thanks [@urugator](https://github.com/urugator)! - fix regression #3514: LegacyObservableArray compat with Safari 9.\\*\n\n-   [`78d1aa23`](https://github.com/mobxjs/mobx/commit/78d1aa2362b4dc5d521518688d6ac7e2d4f7ad3a) [#3458](https://github.com/mobxjs/mobx/pull/3458) Thanks [@egilll](https://github.com/egilll)! - A slight revamp of the README, wording, and clearer links\n\n## 6.6.1\n\n### Patch Changes\n\n-   [`63698d06`](https://github.com/mobxjs/mobx/commit/63698d0681988194bac5fc01851882b417b35f18) [#3427](https://github.com/mobxjs/mobx/pull/3427) Thanks [@RyanCavanaugh](https://github.com/RyanCavanaugh)! - Apply 'object' constraint where required\n\n## 6.6.0\n\n### Minor Changes\n\n-   [`8e204c7b`](https://github.com/mobxjs/mobx/commit/8e204c7b7d1dbad597761fa83beda77f027ee34c) [#3409](https://github.com/mobxjs/mobx/pull/3409) Thanks [@Nokel81](https://github.com/Nokel81)! - Remove observable.box type inconsistancy\n\n## 6.5.0\n\n### Minor Changes\n\n-   [`767baff0`](https://github.com/mobxjs/mobx/commit/767baff0373e5a5e2b7da274b25042078f9a205c) [#3338](https://github.com/mobxjs/mobx/pull/3338) Thanks [@kubk](https://github.com/kubk)! - Replace any with a generic in Set methods\n\n## 6.4.2\n\n### Patch Changes\n\n-   [`2caf7e1a`](https://github.com/mobxjs/mobx/commit/2caf7e1a3504dde3d7c9bde3c6fb56ca85168018) [#3316](https://github.com/mobxjs/mobx/pull/3316) Thanks [@urugator](https://github.com/urugator)! - `requiresObservable` always takes precedence over global `reactionRequiresObservable`\n\n## 6.4.1\n\n### Patch Changes\n\n-   [`d6fa9a19`](https://github.com/mobxjs/mobx/commit/d6fa9a1970ebfb8a8adaf5bf0dc73125acec2dee) [#3306](https://github.com/mobxjs/mobx/pull/3306) Thanks [@urugator](https://github.com/urugator)! - fix missing type inferrence of `observe` and `intercept` for arrays\n\n## 6.4.0\n\n### Minor Changes\n\n-   [`6b926833`](https://github.com/mobxjs/mobx/commit/6b926833ac7abbf92ff5c309613d2345f72527ee) [#3287](https://github.com/mobxjs/mobx/pull/3287) Thanks [@kubk](https://github.com/kubk)! - Remove any from 'merge' and 'replace' methods of ObservableMap\n\n### Patch Changes\n\n-   [`dee35be4`](https://github.com/mobxjs/mobx/commit/dee35be427989b6adc3c8f7ae8dc632ea66f3538) [#3300](https://github.com/mobxjs/mobx/pull/3300) Thanks [@kubk](https://github.com/kubk)! - Make the error message about Object.freeze more informative\n\n## 6.3.13\n\n### Patch Changes\n\n-   [`23803202`](https://github.com/mobxjs/mobx/commit/2380320263f5edcd06d7ba6bdf02aff3fd7d305a) [#3273](https://github.com/mobxjs/mobx/pull/3273) Thanks [@urugator](https://github.com/urugator)! - fix `flow.bound` #3271\n\n## 6.3.12\n\n### Patch Changes\n\n-   [`654a2013`](https://github.com/mobxjs/mobx/commit/654a2013107ac6e5bbe3851e4eed22f0c9130525) [#3257](https://github.com/mobxjs/mobx/pull/3257) Thanks [@urugator](https://github.com/urugator)! - fix: observable map initialization violates `enforceActions: \"always\"`\n\n## 6.3.11\n\n### Patch Changes\n\n-   [`bf5da6ba`](https://github.com/mobxjs/mobx/commit/bf5da6bad982dc3d955d5f27f7fea6f94b041ea7) [#3239](https://github.com/mobxjs/mobx/pull/3239) Thanks [@bernardobelchior](https://github.com/bernardobelchior)! - Improved `toJS` jsdoc\n\n## 6.3.10\n\n### Patch Changes\n\n-   [`2d70798e`](https://github.com/mobxjs/mobx/commit/2d70798eb327187d93757757ceaf410a608735b2) [#3233](https://github.com/mobxjs/mobx/pull/3233) Thanks [@anderlaw](https://github.com/anderlaw)! - `eq.ts` fix comparer logic\n\n## 6.3.9\n\n### Patch Changes\n\n-   [`87e5a037`](https://github.com/mobxjs/mobx/commit/87e5a03735dbc1930e54a15b5ce88ad684bc3dc1) [#3214](https://github.com/mobxjs/mobx/pull/3214) Thanks [@urugator](https://github.com/urugator)! - `requiresReaction` always takes precedence over global `computedRequiresReaction`\n\n*   [`9b90e25c`](https://github.com/mobxjs/mobx/commit/9b90e25c7bc0cdc0a07d1f847683604e86790f24) [#3198](https://github.com/mobxjs/mobx/pull/3198) Thanks [@urugator](https://github.com/urugator)! - fix `isPlainObject` impl (fixes #3197)\n\n## 6.3.8\n\n### Patch Changes\n\n-   [`9d5e65cb`](https://github.com/mobxjs/mobx/commit/9d5e65cbd612f262d925e57cebb559f5cf36c502) [#3193](https://github.com/mobxjs/mobx/pull/3193) Thanks [@ChocolateLoverRaj](https://github.com/ChocolateLoverRaj)! - Make `IAtom['reportObserved']` return `boolean`\n\n*   [`55508af6`](https://github.com/mobxjs/mobx/commit/55508af690fa875e6affaf30f34280b3f27b6126) [#3189](https://github.com/mobxjs/mobx/pull/3189) Thanks [@RvanderLaan](https://github.com/RvanderLaan)! - Fix for RangeError in ObservableArray.replace for large arrays\n\n## 6.3.7\n\n### Patch Changes\n\n-   [`3a7dee6f`](https://github.com/mobxjs/mobx/commit/3a7dee6fdaddbb4b79205b054601a8020c226fcc) [#3180](https://github.com/mobxjs/mobx/pull/3180) Thanks [@kubk](https://github.com/kubk)! - Fix type inference of observe function\n\n## 6.3.6\n\n### Patch Changes\n\n-   [`49468204`](https://github.com/mobxjs/mobx/commit/49468204d3bc28d15dbf383c0b7f874ca26dff30) [#3162](https://github.com/mobxjs/mobx/pull/3162) Thanks [@upsuper](https://github.com/upsuper)! - Have cancelled when reject with an error rather than a string\n\n*   [`4afb1ec2`](https://github.com/mobxjs/mobx/commit/4afb1ec24427cf8e1f768d0c6fc49d0f44f4ab8e) [#3154](https://github.com/mobxjs/mobx/pull/3154) Thanks [@urugator](https://github.com/urugator)! - `makeObservable` throws when mixing @decorator syntax with annotations\n\n## 6.3.5\n\n### Patch Changes\n\n-   [`4ac6b454`](https://github.com/mobxjs/mobx/commit/4ac6b45473c2e3b07c8e683cd395bc5edfaa8e15) [#3146](https://github.com/mobxjs/mobx/pull/3146) Thanks [@urugator](https://github.com/urugator)! - fix #3109: spy: computed shouldn't report update unless the value changed\n\n## 6.3.4\n\n### Patch Changes\n\n-   [`0dbf3eb6`](https://github.com/mobxjs/mobx/commit/0dbf3eb6eecfa9cd6cd9dc7d707e8d70927e79bf) [#3141](https://github.com/mobxjs/mobx/pull/3141) Thanks [@urugator](https://github.com/urugator)! - [spy: bound actions report correct object](https://github.com/mobxjs/mobx/discussions/3140)\n\n## 6.3.3\n\n### Patch Changes\n\n-   [`d78a1592`](https://github.com/mobxjs/mobx/commit/d78a15929052b96698b3355a0b4c8335750422db) [#2902](https://github.com/mobxjs/mobx/pull/2902) Thanks [@z3rog](https://github.com/z3rog)! - chore: observable use internal constants\n\n*   [`db21d85f`](https://github.com/mobxjs/mobx/commit/db21d85fcd41c6c142998f53e722ee0a0e9b5c18) [#2998](https://github.com/mobxjs/mobx/pull/2998) Thanks [@urugator](https://github.com/urugator)! - `trace()`: log when computed becomes suspended\n    `requiresReaction` warns instead of throwing\n\n-   [`b9fa119c`](https://github.com/mobxjs/mobx/commit/b9fa119c90e23d4b327763189f24c00be2fb2c26) [#3056](https://github.com/mobxjs/mobx/pull/3056) Thanks [@upsuper](https://github.com/upsuper)! - Create WHEN_TIMEOUT error earlier to capture useful stack\n\n*   [`99491ec2`](https://github.com/mobxjs/mobx/commit/99491ec2d315a3a01cdbe40d9a24d920a09cbd0e) [#2972](https://github.com/mobxjs/mobx/pull/2972) Thanks [@kk-gjyang](https://github.com/kk-gjyang)! - Polyfill `Object.is` for old/unsupported browsers\n\n-   [`0d28db8a`](https://github.com/mobxjs/mobx/commit/0d28db8a0ba99f5cce744bb83b5bd88ec45a7e41) [#2927](https://github.com/mobxjs/mobx/pull/2927) Thanks [@upsuper](https://github.com/upsuper)! - Give proper typing to opts.equals of reaction\n\n*   [`c6dc925c`](https://github.com/mobxjs/mobx/commit/c6dc925c6cf7eeff9237ee07c55927a7bbc14cb7) [#2985](https://github.com/mobxjs/mobx/pull/2985) Thanks [@fecqs](https://github.com/fecqs)! - Remove duplicate global property check\n\n## 6.3.2\n\n### Patch Changes\n\n-   [`4011b378`](https://github.com/mobxjs/mobx/commit/4011b3789d57e3dab0b85a835fe2979033133ce9) [#2949](https://github.com/mobxjs/mobx/pull/2949) Thanks [@urugator](https://github.com/urugator)! - fix #2948: flow ignores `autoBind` option\n\n## 6.3.1\n\n### Patch Changes\n\n-   [`d678ebd7`](https://github.com/mobxjs/mobx/commit/d678ebd7e54efb3aeae4541f87f5bcf93a623ec6) [#2944](https://github.com/mobxjs/mobx/pull/2944) Thanks [@urugator](https://github.com/urugator)! - Fix [#2941](https://github.com/mobxjs/mobx/issues/2941) - flow.bound replaces method on proto with bound function\n\n## 6.3.0\n\n### Minor Changes\n\n-   [`035bf409`](https://github.com/mobxjs/mobx/commit/035bf4096dd72d296af1fc25304adaade73cc7eb) [#2906](https://github.com/mobxjs/mobx/pull/2906) Thanks [@urugator](https://github.com/urugator)! - Provide `flow.bound` annotation/decorator\n\n### Patch Changes\n\n-   [`3dedb4d4`](https://github.com/mobxjs/mobx/commit/3dedb4d4b5376f3991183923838da942a9a81506) [#2904](https://github.com/mobxjs/mobx/pull/2904) Thanks [@ahoisl](https://github.com/ahoisl)! - Make toJS work with computed value props\n\n## 6.2.0\n\n### Minor Changes\n\n-   [`bc8db3df`](https://github.com/mobxjs/mobx/commit/bc8db3df9405034999f8feb8c95ba8045c7ae008) [#2779](https://github.com/mobxjs/mobx/pull/2779) Thanks [@urugator](https://github.com/urugator)! - In mobx5 all own properties were by default observable regardless of their value. Since mobx6 we treat functional properties as `action`s or to be precise `autoAction`s. `autoAction` provides `action`'s benefits to your functions, without the need to explicitely annotate them as `actions`.\n    We think this is useful, but as a consequence, such properties are no longer `observable` and therefore non-writable and also non-enumerable. This turned out to be suprising and inconvinient to some users:\n    https://github.com/mobxjs/mobx/discussions/2760\n    https://github.com/mobxjs/mobx/discussions/2586\n    https://github.com/mobxjs/mobx/issues/2835\n    https://github.com/mobxjs/mobx/issues/2629\n    https://github.com/mobxjs/mobx/issues/2551\n    https://github.com/mobxjs/mobx/issues/2637\n    So we decided to change it: All _own_ props _including functions_ are `observable` (enumerable, writable) as in v5, but additionally all functions that become part of deeply observable structure are by default converted to `autoAction`/`flow`.\n    Note that `deep` option affects this conversion in the same way as it affects conversion of other values (object/array/map/set).\n\n    -   by default all functions are converted to `autoAction`s/`flow`s\n    -   by default all originally _own_ props are now observable and enumerable (as in pre v6)\n    -   `deep: false` ignores _all_ property values (including functions that would be previously converted to `autoAction`/`flow`)\n    -   by default _lone_ setters are converted to `action`s\n\n### Patch Changes\n\n-   [`16cab8b1`](https://github.com/mobxjs/mobx/commit/16cab8b14cf4a0d995d3f367123abfab5aed8326) [#2806](https://github.com/mobxjs/mobx/pull/2806) Thanks [@urugator](https://github.com/urugator)! - Annotations refactor - reduced code duplication\n\n*   [`6b324edc`](https://github.com/mobxjs/mobx/commit/6b324edc69e7e9041a01e20d2e86f424046f3e25) [#2873](https://github.com/mobxjs/mobx/pull/2873) Thanks [@urugator](https://github.com/urugator)! - Fix [#2871](https://github.com/mobxjs/mobx/issues/2871): `toJS` throws with `configure({ useProxies: \"ifavailable\" })`\n\n-   [`b5141883`](https://github.com/mobxjs/mobx/commit/b5141883434cba86b257d68a7badff5038c14296) [#2872](https://github.com/mobxjs/mobx/pull/2872) Thanks [@urugator](https://github.com/urugator)! - Fix [#2859](https://github.com/mobxjs/mobx/issues/2859): Trace log only if derivation is actually about to re-run\n\n*   [`0945c265`](https://github.com/mobxjs/mobx/commit/0945c26513057457e1534a80558a3eb98487dc96) [#2840](https://github.com/mobxjs/mobx/pull/2840) Thanks [@iChenLei](https://github.com/iChenLei)! - export IComputedFactory typescript type definition\n\n## 6.1.8\n\n### Patch Changes\n\n-   [`ca4914f9`](https://github.com/mobxjs/mobx/commit/ca4914f978aef427e7b2223328fd66b82e522d89) [#2836](https://github.com/mobxjs/mobx/pull/2836) Thanks [@urugator](https://github.com/urugator)! - Fix [#2832](https://github.com/mobxjs/mobx/issues/2832) - annotation cache ignores overrides\n\n## 6.1.7\n\n### Patch Changes\n\n-   [`5640aa77`](https://github.com/mobxjs/mobx/commit/5640aa7794420a5fc2f99ac0819de11696d6ba71) [#2799](https://github.com/mobxjs/mobx/pull/2799) Thanks [@urugator](https://github.com/urugator)! - - fix: user provided debug names are not preserved on production\n    -   fix: property atom's debug name is dynamic on production\n    -   fix: `observable(primitive, options)` ignores `options`\n    -   fix: `getDebugName(action)` throws `[MobX] Cannot obtain atom from undefined`\n    -   [fix: terser using `unsafe: true`](https://github.com/mobxjs/mobx/issues/2751#issuecomment-778171773)\n\n## 6.1.6\n\n### Patch Changes\n\n-   [`9b195b17`](https://github.com/mobxjs/mobx/commit/9b195b17bd661b9c0c4ab3a8ef323e23c2f118e4) [#2780](https://github.com/mobxjs/mobx/pull/2780) Thanks [@iChenLei](https://github.com/iChenLei)! - The overall memory usage of MobX has been reduced in production builds by skipping the generation of debug identifiers. The internal `mapid_` field of Reaction has been removed as part of the change.\n\n## 6.1.5\n\n### Patch Changes\n\n-   [`3979bee3`](https://github.com/mobxjs/mobx/commit/3979bee36c82d342050978834197ea15a7ddbbf8) [#2773](https://github.com/mobxjs/mobx/pull/2773) Thanks [@urugator](https://github.com/urugator)! - Decorators optimization\n\n*   [`7820e5ea`](https://github.com/mobxjs/mobx/commit/7820e5eae0c9dcdfa1e69cf92e0bfa209b2b478b) [#2769](https://github.com/mobxjs/mobx/pull/2769) Thanks [@iChenLei](https://github.com/iChenLei)! - add warn for extending builtins\n\n-   [`a7c15171`](https://github.com/mobxjs/mobx/commit/a7c1517133915c2891e92a865fe5475627b6b89f) [#2775](https://github.com/mobxjs/mobx/pull/2775) Thanks [@pkit](https://github.com/pkit)! - use globalThis in global detection\n\n*   [`5d41b646`](https://github.com/mobxjs/mobx/commit/5d41b6462cf609df869a088e353bc485846c88f8) [#2774](https://github.com/mobxjs/mobx/pull/2774) Thanks [@urugator](https://github.com/urugator)! - Fix: `makeAutoObservable` now working properly with symbolic keys\n    Fix: `isComputedProp` and `getAtom` second arg type is incompatible with Symbols\n\n## 6.1.4\n\n### Patch Changes\n\n-   [`0677c0e7`](https://github.com/mobxjs/mobx/commit/0677c0e788bc11ceba909bba16b2b009e90a4c97) [#2766](https://github.com/mobxjs/mobx/pull/2766) Thanks [@urugator](https://github.com/urugator)! - Fix: Inherited annotated fields are not assignable\n\n## 6.1.3\n\n### Patch Changes\n\n-   [`d2a2a52e`](https://github.com/mobxjs/mobx/commit/d2a2a52e59e1cf5867bf72e49e7f134c7055ac5d) [#2763](https://github.com/mobxjs/mobx/pull/2763) Thanks [@vkrol](https://github.com/vkrol)! - Add `safeDescriptors` to `configure` options type\n\n## 6.1.2\n\n### Patch Changes\n\n-   [`ca09f2f5`](https://github.com/mobxjs/mobx/commit/ca09f2f5744f438b0b6572b60e055ca8b59646de) [#2761](https://github.com/mobxjs/mobx/pull/2761) Thanks [@urugator](https://github.com/urugator)! - `configure({ safeDescriptors: false })` now forces all props of observable objects to be writable and configurable\n\n## 6.1.1\n\n### Patch Changes\n\n-   [`39eca50d`](https://github.com/mobxjs/mobx/commit/39eca50de3936807037cb1205bbab29a3e328bc0) [#2757](https://github.com/mobxjs/mobx/pull/2757) Thanks [@urugator](https://github.com/urugator)! - Fix error stringification on minified build\n    Fix `isObservableProp` not supporting `Symbols`\n    Fix `makeAutoObservable` not ignoring `inferredAnnotationsSymbol`\n\n## 6.1.0\n\nThis release fixes a plethora of bugs related to sub-classing and reflecting / iterating on observable objects.\nThe behavior of MobX is in many edge cases much more explicitly defined now.\n\nA new annotation was introduced: `@override` / `override` to support re-defining actions and computed values(!) on sub classses.\n\nFor idiomatic MobX usage this release should have little impact, but if you are using a lot of sub-classing, reflection APIs or direct object manipulations like `defineProperty`,\nthis release might introduce previously unseen errors for cases that silently failed before, or even worked successfully even though the correct behavior wasn't specified earlier.\n\nIf you are migrating from MobX 4/5 we strongly recommend to go to 6.1 in one go, and skip 6.0.\\*, as some buggy behavior compared to the previous majors has been corrected.\n\nAs always, our libraries come as-is and are maintained by volunteers. Upgrades are at own risk and voluntary. Bug reports require a minimal reproductions and a correctly filled out issue template.\n\nSupport the ongoing maintenance at: https://opencollective.com/mobx\n\n### Minor Changes\n\n[`28f8a11d`](https://github.com/mobxjs/mobx/commit/28f8a11d8b94f1aca2eec4ae9c5f45c5ea2f4362) [#2641](https://github.com/mobxjs/mobx/pull/2641) Thanks [@urugator](https://github.com/urugator)!\n\n-   `action`, `computed`, `flow` defined on prototype can be overridden by subclass via `override` annotation/decorator. Previously broken.\n-   Overriding anything defined on instance itself (`this`) is not supported and should throw. Previously partially possible or broken.\n-   Attempt to re-annotate property always throws. Previously mostly undefined outcome.\n-   All annotated and non-observable props (action/flow) are non-writable. Previously writable.\n-   All annotated props of non-plain object are non-configurable. Previously configurable.\n-   Observable object should now work more reliably in various (edge) cases.\n-   Proxied objects now support `Object.defineProperty`. Previously unsupported/broken.\n-   `extendObservable/makeObservable/defineProperty` notifies observers/listeners/interceptors about added props. Previously inconsistent.\n-   `keys/values/entries` works like `Object.keys/values/entries`. Previously included only observables.\n-   `has` works like `in`. Previously reported `true` only for existing own observable props.\n-   `set` no longer transforms existing non-observable prop to observable prop, but simply sets the value.\n-   `remove/delete` works with non-observable and computed props. Previously unsupported/broken.\n-   Passing `options` to `observable/extendObservable/makeObservable` throws if the object is already observable . Previously passed options were mostly ignored.\n-   `autoBind` option is now sticky - same as `deep` and `name` option.\n-   `observable/extendObservable` now also picks non-enumerable keys (same as `make[Auto]Observable`).\n-   Removed deprecated `action.bound(\"name\")`\n-   Proxied objects should be compatible with `Reflect` API. Previously throwing instead of returning booleans.\n\n## 6.0.5\n\n### Patch Changes\n\n-   [`6b304232`](https://github.com/mobxjs/mobx/commit/6b30423266e5418a3f20389d0bd0eae31f3384d2) [#2644](https://github.com/mobxjs/mobx/pull/2644) Thanks [@rokoroku](https://github.com/rokoroku)! - Fix broken error reference in errors.ts\n\n*   [`83b84fd3`](https://github.com/mobxjs/mobx/commit/83b84fd354f2253fdd8ea556e217a92fc2633c00) [#2740](https://github.com/mobxjs/mobx/pull/2740) Thanks [@iChenLei](https://github.com/iChenLei)! - Infer optional / promise `action` args type correctly\n\n-   [`65c7b73b`](https://github.com/mobxjs/mobx/commit/65c7b73b7f0b1a69a1a2786b5f484419d129d10b) [#2717](https://github.com/mobxjs/mobx/pull/2717) Thanks [@ahoisl](https://github.com/ahoisl)! - The TypeScript type `CreateObservableOptions` is now exported.\n\n*   [`989390d4`](https://github.com/mobxjs/mobx/commit/989390d46bbe9941b61ac6c6d1292f96445e7cc3) [#2594](https://github.com/mobxjs/mobx/pull/2594) Thanks [@urugator](https://github.com/urugator)! - Fixed [#2579](https://github.com/mobxjs/mobx/issues/2579) - `observable` does not ignore class instances\n\n-   [`dea1cf18`](https://github.com/mobxjs/mobx/commit/dea1cf189b0f43929f4f626229d34a80bd10212e) [#2726](https://github.com/mobxjs/mobx/pull/2726) Thanks [@mweststrate](https://github.com/mweststrate)! - fix: `onBecomeObserved` was not triggered correctly for computed dependencies of computeds. Fixes #2686, #2667\n\n*   [`592e6e99`](https://github.com/mobxjs/mobx/commit/592e6e996c2d5264e162cfb0921a071c1d815c92) [#2743](https://github.com/mobxjs/mobx/pull/2743) Thanks [@vkrol](https://github.com/vkrol)! - Remove `sideEffects` section in `mobx-react-lite` `package.json`\n\n> 🚨🚨🚨 If you are upgrading from V4/V5, please follow [the migration guide](https://mobx.js.org/migrating-from-4-or-5.html).\n\n## 6.0.4\n\n### Patch Changes\n\n-   [`79a09f49`](https://github.com/mobxjs/mobx/commit/79a09f49a9f2baddbab8d89e9a7ac07cffadf624) [#2615](https://github.com/mobxjs/mobx/pull/2615) Thanks [@urugator](https://github.com/urugator)! - Fix [#2614](https://github.com/mobxjs/mobx/issues/2614) - `makeObservable` does not respect `options.name`\n\n## 6.0.3\n\n### Patch Changes\n\n-   [`d0e6778d`](https://github.com/mobxjs/mobx/commit/d0e6778de73f6dfad61283c04103049732b2aea2) - Create ESM bundles with NODE_ENV correctly replaced so it can be used in browser (#2564)\n\n## 6.0.2\n\n### Patch Changes\n\n-   [`b5d64d19`](https://github.com/mobxjs/mobx/commit/b5d64d1965ecd9a593886279ddaf96eda61c4a77) [#2548](https://github.com/mobxjs/mobx/pull/2548) Thanks [@urugator](https://github.com/urugator)! - Fixed [2542](https://github.com/mobxjs/mobx/issues/2542), makeAutoObservable not respecting deep option [@urugator](https://github.com/urugator)\n\n*   [`f4c22925`](https://github.com/mobxjs/mobx/commit/f4c229259a72f0497d3f9b6a05af9d9c4280d8b1) [#2582](https://github.com/mobxjs/mobx/pull/2582) Thanks [@tomenden](https://github.com/tomenden)! - Support running in a web-worker\n\n## 6.0.1\n\n-   Fixed issue in TS typings of `makeObservable` in combination with a member named `toString()`\n\n## 6.0.0\n\n### New features\n\n-   [`makeObservable(target, annotations)`](../../docs/observable-state.md#makeobservable) is now the recommended way to make objects with a fixed shape observable, such as classes.\n-   [`makeAutoObservable(target)`](../../docs/observable-state.md#makeautoobservable) will automatically determine the annotations used by `makeObservable`. Methods will be marked as 'autoAction', so that they can be used both from a computed value or as standalone method.\n-   MobX 6 can be used in both modern environments, and environments that don't support Proxy. So both MobX 4 and 5 users can upgrade to 6. See [proxy support](../../docs/configuration.md#proxy-support) for more details.\n-   `observable.array` now supports `{ proxy: false }` as option.\n-   `reaction`'s effect function now receives the previous value seen by the reaction as second argument.\n-   `flow` can now be used as annotation as well. You might need `flowResult` in case you use TypeScript to extract the correct result type. [details](../../docs/actions.md#using-flow-instead-of-async--await-).\n\n### Breaking changes\n\n#### Changes that might affect you\n\n-   The `decorate` API has been removed, and needs to be replaced by `makeObservable` in the constructor of the targeted class. It accepts the same arguments. The `mobx-undecorate` can transform this automatically.\n-   When using `extendObservable` / `observable`, fields that contained functions used to be turned into observables. This is no longer the case, they will be converted into `autoActions`.\n-   [Strict mode](../../docs/configuration.md#enforceactions) for actions is now enabled by default in `observed` mode.\n-   `toJS` no longer takes any options. It no longer converts Maps and Sets to plain data structures. Generic, flexible serialization of data structures is out of scope for the MobX project, and writing custom serialization methods is a much more scalable approach to serialization (tip: leverage `computed`s to define how class instances should be serialized).\n-   The methods `intercept` and `observe` are no longer exposed on observable arrays, maps and boxed observables. Import them as utility from mobx instead: `import { observe, intercept } from \"mobx\"`, and pass the collection as first argument: `observer(collection, callback)`. Note that we still recommend to avoid these APIs.\n-   `observableMap.toPOJO()`, `observableMap.toJS()` have been dropped. Use `new Map(observableMap)` instead if you want to convert an observable map to a plain Map shallowly.\n-   `observableMap.toJSON()` now returns an entries array rather than a new Map, to better support serialization.\n-   `observableSet.toJS()` has been dropped. Use `new Set(observableSet)` instead if you want to convert an observable Set to a plain Set shallowly.\n-   `observableSet.toJSON()` now returns an array rather than a new Set, to better support serialization.\n-   Sorting or reversing an observableArray in a derivation (without slicing first) will now throw rather than warn. In contrast, it is now allowed to sort or reverse observable arrays in-place, as long as it happens in an action.\n-   `isArrayLike` is no longer exposed as utility. Use `Array.isArray(x) || isObservableArray(x)` instead.\n\n#### Obscure things that don't work anymore, but that probably won't affect you\n\n-   It is no longer possible to re-decorate a field (through either `@observable` or `makeObservable`) that is already declared in a super class.\n-   `runInAction` no longer supports passing a name as first argument. Name the original function or use `action(name, fn)()` if you care about the debug name.\n-   `computed(getterFn, setterFn)` no longer accepts a setter function as a second argument. Use the `set` option instead: `computed(getterFn, { set: setterFn })`.\n-   In observable arrays, for `findIndex` / `find` method, the `offset` argument (the third one) is no longer supported, to be consistent with ES arrays.\n-   The option `computedConfigurable` of `configure` is no longer supported as it is now the default.\n-   `observableArray.toJS()` has been removed, use `observableArray.slice()` instead, which does the same.\n-   Killed support for the `IGNORE_MOBX_MINIFY_WARNING` environment flag.\n-   `_allowStateChangesInComputation(fn)` is no longer needed, use `runInAction(fn)` instead.\n-   In `computed`, the `when` predicate (first arg), and `reaction` predicate (first arg) it is now forbidden to directly change state. State changes should be done in their effect functions, or otherwise at least wrapped in `runInAction` (only the state change, not the observables you want to track!). Note that this is still an anti-pattern.\n-   The `observableArray.get()` and `observableArray.set()` methods are no longer supported.\n-   The `IObservableObject` interface is no longer exported from MobX.\n-   The second argument to the `reaction` effect function, the disposer object, is now passed in as third argument. The second argument is now the previous value seen by the reaction.\n-   `onBecomeObserved` / `onBecomeUnobserved` will now only trigger for observables that are actually used by a reaction (see [#2309](https://github.com/mobxjs/mobx/issues/2309) for background).\n\n### Fixes\n\n-   [#2326](https://github.com/mobxjs/mobx/issues/2326): Incorrect `this` for array callbacks such as in `array.forEach`\n-   [#2379](https://github.com/mobxjs/mobx/issues/2379): Fixed issue with `array.concat`\n-   [#2309](https://github.com/mobxjs/mobx/issues/2309): Fixed several inconsistencies between keepAlive'd computed values and `on(un)BecomeObserved`\n-   Fixed several inconsistencies when `on(un)BecomeObserved` was triggered for observables changed in actions without having an observer\n\n## 5.15.7 / 4.15.7\n\n-   Fixed [2438](https://github.com/mobxjs/mobx/issues/2438), factory types caused eslint warnings, by [@amareis](https://github.com/Amareis) through [2439](https://github.com/mobxjs/mobx/pull/2439)\n-   Fixed [2432](https://github.com/mobxjs/mobx/issues/2423), array.reduce without initial value by [@urugator](https://github.com/urugator)\n\n## 5.15.6 / 4.15.6\n\n-   Fixed [2423](https://github.com/mobxjs/mobx/issues/2423), array methods not dehancing by [@urugator](https://github.com/urugator)\n-   Fixed [2424](https://github.com/mobxjs/mobx/issues/2424) Map / Set instantiation triggering a strict warning, through [#2425](https://github.com/mobxjs/mobx/pull/2425) by [@moonball](https://github.com/moonball)\n\n## 5.15.5 / 4.15.5\n\n-   Fixed ObservableSet.prototype.forEach not being reactive in 4.x [#2341](https://github.com/mobxjs/mobx/pull/2341) by [@melnikov-s](https://github.com/melnikov-s)\n-   Add error when computed value declared for unspecified getter [#1867](https://github.com/mobxjs/mobx/issues/1867) by [@berrunder](https://github.com/berrunder)\n-   Fixed [#2326](https://github.com/mobxjs/mobx/issues/2326) correct array is passed to callbacks by [@urugator](https://github.com/urugator)\n-   Fixed [#2278](https://github.com/mobxjs/mobx/issues/2278), `map.delete` should respect strict mode, by [@urugator](https://github.com/urugator)\n-   Fixed [#2253](https://github.com/mobxjs/mobx/issues/2253), [#1980](https://github.com/mobxjs/mobx/issues/1980), map key order not always preserved by [@urugator](https://github.com/urugator)\n-   Fixed [#2412](https://github.com/mobxjs/mobx/issues/2412), non-enumerable getters not being picked up by `extendObservable` by [@urugator](https://github.com/urugator)\n\n-   Several performance improvements\n-   Dropped `browser` fields from `package.json`\n\n## 5.15.4 / 4.15.4\n\n-   Fix process.env replacement in build [#2267](https://github.com/mobxjs/mobx/pull/2267) by [@fredyc](https://github.com/fredyc)\n\n## 5.15.3 / 4.15.3\n\n-   Define action name to be as the function name [#2262](https://github.com/mobxjs/mobx/pull/2262) by [@nadavkaner](https://github.com/nadavkaner)\n\n## 5.15.2 / 4.15.2\n\n-   Fixed [#2230](https://github.com/mobxjs/mobx/issue/2230) computedvalue: throw error object instead of string when options is empty [#2243](https://github.com/mobxjs/mobx/pull/2243) by [@ramkumarvenkat](https://github.com/ramkumarvenkat)\n-   supports ES6 Sets and Maps in shallow comparer. [#2238](https://github.com/mobxjs/mobx/pull/2238) by [@hearnden](https://github.com/hearnden)\n-   `extendObservable`: can be used existing properties again. Fixes [#2250](https://github.com/mobxjs/mobx/issue/2250) through [#2252](https://github.com/mobxjs/mobx/pull/2252) by [@davefeucht](https://github.com/davefeucht)\n\n## 5.15.1 / 4.15.1\n\n-   Make initial values of observable set accept readonly array [#2202](https://github.com/mobxjs/mobx/pull/2202)\n-   Expose `_allowStateReadsStart` & `_allowStateReadsEnd`. This is low level stuff you shouldn't need that's mostly useful for library creators. [#2233](https://github.com/mobxjs/mobx/pull/2233)\n-   Fixed an issue with `observableRequiresReaction` and updating observable during reaction [#2195](https://github.com/mobxjs/mobx/pull/2196)\n-   Improved type inference for `action` [#2213](https://github.com/mobxjs/mobx/pull/2213) ([see detailed explanation](https://github.com/mobxjs/mobx/pull/2218#discussion_r349889440))\n\n## 5.15.0\n\n**The minimum required TypeScript version is now 3.6**\n\n-   Fixed flow typings with Typescript v3.6. This means that version of Typescript is required when using flows.\n-   Cancelled flows now reject with a `FlowCancellationError` instance whose error message is the same as in previous versions (`\"FLOW_CANCELLED\"`) so this is not breaking. [#2172](https://github.com/mobxjs/mobx/pull/2172) by [@vonovak](https://github.com/vonovak)\n-   Fix running mobx in web worker [#2184](https://github.com/mobxjs/mobx/pull/2184/files) by [@shahata](https://github.com/shahata)\n-   Fixed flow typings for Facebook's Flow. A new `CancellablePromise` Flow type is exported. [#2164](https://github.com/mobxjs/mobx/pull/2164) by [@vonovak](https://github.com/vonovak)\n-   Added support for symbol keys on observable properties (MobX 5 only). [#2175](https://github.com/mobxjs/mobx/pull/2175) by [@StephenHaney](https://github.com/StephenHaney)\n\n## 5.14.2\n\n-   Fixed installation issue trying to run `postinstall` hook for a website [#2165](https://github.com/mobxjs/mobx/issues/2165).\n\n## 5.14.1 / 4.14.1\n\n-   Fixed a possible issue with action stack errors and multiple mobx versions installed at the same time [#2135](https://github.com/mobxjs/mobx/issues/2135).\n-   Added `comparer.shallow` for shallow object/array comparisons [#1561](https://github.com/mobxjs/mobx/issues/1561).\n-   Fixed disposing an interception within an interception throwing an error [#1950](https://github.com/mobxjs/mobx/issues/1950).\n\n## 5.14.0 / 4.14.0\n\n-   Added experimental `reactionRequiresObservable` & `observableRequiresReaction` config [#2079](https://github.com/mobxjs/mobx/pull/2079), [Docs](https://github.com/mobxjs/mobx/pull/2082)\n-   Added experimental `requiresObservable` config to `reaction`, `autorun` & `when` options [#2079](https://github.com/mobxjs/mobx/pull/2079), [Docs](https://github.com/mobxjs/mobx/pull/2082)\n\n## 5.13.1 / 4.13.1\n\n-   Don't use `global` and `self` keywords unless defined. Fixes [#2070](https://github.com/mobxjs/mobx/issues/2070).\n-   onBecome(Un)Observed didn't trigger when using number as key of observable map. Fixes [#2067](https://github.com/mobxjs/mobx/issues/2067).\n-   Exposed `_startAction` and `_endAction` to be able to start and action and finish it without needing a code block. This is low level stuff you shouldn't need that's mostly useful for library creators.\n\n## 5.13.0 / 4.13.0\n\n-   Fixed potential memory leak in observable maps, when non-primitive values are used as keys. Fixes [#2031](https://github.com/mobxjs/mobx/issues/2031) through [#2032](https://github.com/mobxjs/mobx/pull/2032).\n-   Added support to store additional non-observable(!) fields (string or symbol based) on array, to better reflect behavior of MobX 4. Fixes [#2044](https://github.com/mobxjs/mobx/issues/2044) through [#2046](https://github.com/mobxjs/mobx/pull/2046)\n\n## 5.11.0 / 4.12.0\n\n-   Added `computedConfigurable` config [#2011](https://github.com/mobxjs/mobx/pull/2011), [#2013](https://github.com/mobxjs/mobx/pull/2014)\n\n## 4.11.0\n\n**BREAKING CHANGE**\n\nReverted the support of Symbols in general in MobX 4, as it gives to many potential build errors and increases the system requirements for MobX 4 (which was an oversight in 4.10.0). Apologies for the breaking change (lack of new major version numbers). If lock files are properly used however, no harm should be caused by this change.\n\n-   Reverted `Symbol` support in observable maps and objects. Reverts [#1944](https://github.com/mobxjs/mobx/pull/1944) through [#1988](https://github.com/mobxjs/mobx/pull/1988). Fixes [#1986](https://github.com/mobxjs/mobx/issues/1986), [#1987](https://github.com/mobxjs/mobx/issues/1987)\n\n## 5.10.1\n\n-   Fixed a recent regression where array update events would send undefined as `change.object` through [#1985](https://github.com/mobxjs/mobx/pull/1985) by [xaviergonz](https://github.com/xaviergonz)\n\n## 5.10.0 / 4.10.0\n\n-   Added support for symbol named properties in maps and objects. Fixes [#1809](https://github.com/mobxjs/mobx/issues/1809) and [#1925](https://github.com/mobxjs/mobx/issues/1925) through [#1944](https://github.com/mobxjs/mobx/pull/1944) by [@loklaan](https://github.com/loklaan)\n-   Added `set` support for `observable.set`, see [#1945](https://github.com/mobxjs/mobx/pull/1945) by [xaviergonz](https://github.com/xaviergonz)\n-   Fixed events for arrays using the wrong object, [#1964](https://github.com/mobxjs/mobx/pull/1964) by [xaviergonz](https://github.com/xaviergonz)\n-   Improved flow typings [#1960](https://github.com/mobxjs/mobx/pull/1960) by [@tbezman](https://github.com/tbezman)\n-   Updated tooling, [#1949](https://github.com/mobxjs/mobx/pull/1949) and [#1931](https://github.com/mobxjs/mobx/pull/1931) by [xaviergonz](https://github.com/xaviergonz)\n\n## 5.9.4 / 4.9.4\n\n-   Allow symbol keys in `ObservableMap`, see [#1930](https://github.com/mobxjs/mobx/pull/1930) by [pimterry](https://github.com/pimterry)\n-   Fixed type definitions of `toStringTag` for Maps and Sets, see [#1929](https://github.com/mobxjs/mobx/pull/1929) by [lennerd](https://github.com/lennerd)\n\n## 4.9.3\n\n-   Fixed `observable.set` compatibility with IE 11, see [#1917](https://github.com/mobxjs/mobx/pull/1917) by [kalmi](https://github.com/kalmi)\n\n## 4.9.2\n\n-   Fixed regression [#1878](https://github.com/mobxjs/mobx/issues/1878), accidental use of `Symbol` breaking Internet Explorer / React Native compatibility.\n\n## 4.9.1\n\n-   Fixed regression in `toJS`: observable maps were not properly serialized. Fixes [#1875](https://github.com/mobxjs/mobx/issues/1875)\n\n## 5.9.0 / 4.9.0\n\n**Features**\n\n-   Introduced support for observable sets! Through [#1592](https://github.com/mobxjs/mobx/pull/1592) by [@newraina](https://github.com/newraina)\n-   `observable.box` now accepts an `equals` option, to be able to pass a custom comparision function. Through [#1862](https://github.com/mobxjs/mobx/pull/1862), [#1874](https://github.com/mobxjs/mobx/pull/1874) by [@fi3ework](https://github.com/fi3ework). Fixes [#1580](https://github.com/mobxjs/mobx/issues/1580)\n-   Improved logging of reactions; if an action throws an exception, errors in reactions that react to that are only logged as warnings. Fixes [#1836](https://github.com/mobxjs/mobx/issues/1836)\n\n**Fixes**\n\n-   Improved typings for `flow`, see [#1827](https://github.com/mobxjs/mobx/pull/1827) by [@xaviergonz](https://github.com/xaviergonz)\n-   Don't allow subclassing map, fixes [#1858](https://github.com/mobxjs/mobx/issues/1858)\n-   Fixed `trace(true)` not being able to handle multi-line comments in traced function. Fixes [#1850](https://github.com/mobxjs/mobx/issues/1850)\n-   `@computed` now introduces non-configurable properties, to fail fast on incorrect inheritance or property deletion. Fixes [#1867](https://github.com/mobxjs/mobx/issues/1867)\n-   The options `enforceActions` and `isolateGlobalState` now work correctly when used together. Fixes [#1869](https://github.com/mobxjs/mobx/issues/1869)\n\n## 5.8.0 / 4.8.0\n\n-   MobX now requires TypeScript 3 (this was already the case in 5.7.0, but in this version the difference is actually noticeable in the typings).\n-   Fixed array dehancer sometimes skipping. Fixes [#1839](https://github.com/mobxjs/mobx/issues/1839) through [#1841](https://github.com/mobxjs/mobx/pull/1841) by [k-g-a](https://github.com/k-g-a)\n-   Fixed issue where webpack 4 wouldn't use the ESM module [#1834](https://github.com/mobxjs/mobx/pull/1834) by [mrtnbroder](https://github.com/mrtnbroder)\n-   Improved type inference for `flow` in TypeScript 3. Fixes [#1816](https://github.com/mobxjs/mobx/issue/1816) through [#1825](https://github.com/mobxjs/mobx/pull/1825) by [ismailhabib](https://github.com/ismailhabib)\n-   Introduced support for global environment variable `IGNORE_MOBX_MINIFIY_WARNING=true` to skip the built-in minification warning. See [#1835](https://github.com/mobxjs/mobx/pull/1835) by [fi3ework](https://github.com/fi3ework)\n-   Fixed onBecome(Un)Observed dispoer cleanup. Fixes [#1537](https://github.com/mobxjs/mobx/issues/1537) through [#1833](https://github.com/mobxjs/mobx/pull/1833) by [fi3ework](https://github.com/fi3ework)\n\n## 5.7.1 / 4.7.1\n\n-   Fixed [#1839](https://github.com/mobxjs/mobx/issues/1839), ObservableArrayAdministration.dehanceValues does not dehance last value.\n\n## 5.7.0 / 4.7.0\n\n-   Upgraded typings to TypeScript 3\n-   Fixed [#1742](https://github.com/mobxjs/mobx/issues/1742), change detection fails when multiple mobx instances were active.\n-   Fixed [#1624](https://github.com/mobxjs/mobx/issues/1624), use built-in flow types for iterators\n-   Fixed [#1777](https://github.com/mobxjs/mobx/issues/1777) through [#1826](https://github.com/mobxjs/mobx/pull/1826), stack overflow exception, in development mode, when using `@computed` on a React component. The MobX 5 behavior here has been reverted to the MobX 4 behavior.\n\n## 5.6.0 / 4.6.0\n\n-   `keepAlive` has become smarter and won't recomputed computed values that are kept alive, as long as they aren't read. Implements [#1534](https://github.com/mobxjs/mobx/issues/1534)\n-   Fixed [#1796](https://github.com/mobxjs/mobx/issues/1796), undeleting a property that had an initial value of `undefined` was undetected\n-   Improved Flow typings, see [#1794](https://github.com/mobxjs/mobx/pull/1794) and [#1786](https://github.com/mobxjs/mobx/pull/1786)\n\n## 5.5.2 / 4.5.2\n\n-   Fixed bug in `toJS` not handling `null` values correctly. Fixes [#1557](https://github.com/mobxjs/mobx/issues/1557) through [#1783](https://github.com/mobxjs/mobx/pull/1783) by [@wangyiz4262](https://github.com/wangyiz4262)\n\n## 5.5.1 / 4.5.1\n\n-   `toJS` now has a `recurseEverything` everything option, that even detects and converts observable objects that are \"behind\" non-observable objects. See [#1699](https://github.com/mobxjs/mobx/pull/1699) by [wangyiz4262](https://github.com/wangyiz4262)\n-   Added flow typings form `comparer`, see [#1751](https://github.com/mobxjs/mobx/pull/1752) by [pdong](https://github.com/pdong)\n-   Update flow typings for configuration options, [#1772](https://github.com/mobxjs/mobx/pull/1772) by [alexandersorokin](https://github.com/alexandersorokin)\n\n## 5.5.0 / 4.5.0\n\n(Minor version of `5` was bumped significantly to make the number better correlate together :-))\n\n-   Fixed [#1740](https://github.com/mobxjs/mobx/issues/1740): combining decorators and `extendObservable` in a class constructor caused errors to be thrown\n-   Fixed [#1739](https://github.com/mobxjs/mobx/issues/1740):\n    -   Proxies: `delete`-ing a property was not always picked up by the reactivity system\n    -   Non-proxies: `remove()`-ing a property was not always picked up by the `has()` and `get()` utilities\n    -   `has` now returns `true` for computed fields\n    -   `get` now returns a value for computed fields\n-   Introduced `_allowStateChangeInsideComputed`. Don't use it :-).\n-   MobX is now transpiled using babel 7\n\n## 5.1.2 / 4.4.2\n\n-   Fixed [#1650](https://github.com/mobxjs/mobx/issues/1650), decorating fields with the name `toString` does not behave correctly.\n\n## 5.1.1 / 4.4.1\n\n-   Improved typings of `decorate`, see [#1711](https://github.com/mobxjs/mobx/pull/1711) by [makepost](https://github.com/makepost)\n\n## 5.1.0 / 4.4.0\n\n-   Improved handling of multiple MobX instances. MobX will no longer complain about being loaded multiple times (one should still prevent it though, to prevent blowing up bundle size!), but merge internal state by default. If multiple MobX versions need to be loaded, call `configure({ isolateGlobalState: true })`. Note that this means that observables from the different MobX instances won't cooperate. Fixes [#1681](https://github.com/mobxjs/mobx/issues/1681), [#1082](https://github.com/mobxjs/mobx/issues/1082)\n-   `enforceActions` options now supports the values: `\"never\"`, `\"observed\"` and `\"always\"` to make the behavior more clear. Fixes [#1680](https://github.com/mobxjs/mobx/issues/1680), [#1473](https://github.com/mobxjs/mobx/issues/1473)\n\n## 5.0.5\n\n-   Fixed [#1667](https://github.com/mobxjs/mobx/issues/1667): creating a large array could result in undefined items (MobX 4.\\* was not affected)\n\n## 4.3.2 / 5.0.4\n\n-   Fixed [#1685](https://github.com/mobxjs/mobx/issues/1685): expose `IAutorunOptions`\n-   `decorate` now can apply multiple decorators, by accepting an array and applying them right to left: `decorate(Todo, { title: [serializable(primitive), persist('object'), observable] })`. By [@ramybenaroya](https://github.com/ramybenaroya) through [#1691](https://github.com/mobxjs/mobx/pull/1691) and [#1686](https://github.com/mobxjs/mobx/pull/1686)\n-   Improved typings of `flow` so that it accepts async generators. By [@dannsam](https://github.com/dannsam) through [#1656](https://github.com/mobxjs/mobx/pull/1656) and [#1655](https://github.com/mobxjs/mobx/pull/1655)\n-   `keys()` now also supports arrays. Fixes [#1600](https://github.com/mobxjs/mobx/pull/1600) through [#1601](https://github.com/mobxjs/mobx/pull/1601) by [@nunocastromartins](https://github.com/nunocastromartins)\n\n## 5.0.3\n\n-   Fixed issue where it was no longer possible to define custom properties on observable arrays\n\n## 5.0.2\n\n-   Fixed issue where iterators where not compiled to ES5, breaking the ES5 based builds.\n\n## 5.0.1 (Unpublished)\n\n-   Fixed regression bug: `ObservableMap.size` was no longer observable. Fixes [#1583](https://github.com/mobxjs/mobx/issues/1583)\n-   Downgraded lib export from ES6 to ES5. To many build tools still trip over ES6. Fixes [#1584](https://github.com/mobxjs/mobx/issues/1584). A modern build is available through `import ... from \"mobx/lib/mobx.es6\"` (or setup an alias in your build system)\n-   Added support for mobx-react-devtools\n\n## 5.0.0\n\n[Release blogpost](https://medium.com/p/4852bce05572/)\n\n### Proxy support!\n\nMobX 5 is the first MobX version fully leveraging Proxies. This has two big advantages\n\n1. MobX can now detect the addition of properties on plain observable objects, so it is now possible to use plain observable objects as dynamic collections.\n2. Observable arrays are now recognized as arrays by all third party libraries, which will avoid the need to slice them.\n\n### The system requirements to run MobX has been upped\n\n-   MobX 5 can only be used on environments that support `Proxies`. See the [browser support](https://github.com/mobxjs/mobx#browser-support) for details.\n-   Since MobX no longer runs on older browsers, the compilation target has been upgraded to ES2015 syntax supporting browsers. This means that MobX is not loadable on older browsers without down compilation to ES5.\n-   If for whatever reason your project cannot meet this requirements, please stick to MobX 4. It will be actively maintained. All current features of MobX 5 are expressable in MobX 4 as well, but it means that for example to use dynamic objects some [additional APIs](https://mobx.js.org/refguide/object-api.html) are needed.\n-   The performance footprint of MobX 5 should be pretty similar to MobX 4. In our performance tests we saw some minor improvements in memory footprint, but overall it should be pretty comparable.\n\n### Breaking changes\n\n-   The required runtime needs to support the non-polyfillable `Proxy` API.\n-   The minimum runtime target is now ES2015, not ES5\n-   `spy` has become a no-op in production builds\n-   All earlier deprecated APIs are dropped. Make sure to not have any deprecation warnings before upgrading.\n-   `array.move` and `array.peek` are removed from the API\n-   Dropped the third argument to `array.find` and `array.findIndex` since they were not standardized in ES.\n-   `.$mobx` property has been dropped from all observables and replaced by a Symbol. Instead of using `x.$mobx.name`, use `import { $mobx } from \"mobx\"; x[$mobx].name` etc.\n-   In some cases, the order in which autoruns are fired could have changed due to some internal optimizations (note that MobX never had a guarantee about the order in which autoruns fired!)\n\n### New features\n\n-   It is possible to pass the `proxy: false` argument to `observable.object` to disable proxying (theoretically slightly faster, but removes no dynamic key addition)\n\n### Known Issues\n\n-   Observable objects can no longer be frozen (otherwise they would become un-observable😎). If you are actually trying to do so MobX will now throw an exception like: `[mobx] Dynamic observable objects cannot be frozen]`. A place where that might happen unexpectedly is when passing an observable object as `style` property to a React component. Like `<span style={someObservableObject} />`, since React will freeze all style objects. The work-around is to simply pass a fresh, non-observable object for styling like: `<span style={{...someObservableObject}} />`.\n-   ~~If you are using `mobx` with `mobx-react`, and you are upgrading `mobx-react` to the MobX 5 compatible version (`mobx-react@5.2.0`) you will notice that `this.props` or `this.state` are not yet observable in the `constructor` or `componentWillMount`. This is for forward compatibility with React 16.3 where `componentWillMount` has been deprecated. In most cases using `componentDidMount` instead will suffice, especially when the goal is to setup reactions. For more info see [#478](https://github.com/mobxjs/mobx-react/issues/478).~~ Fixed in mobx-react 5.2.1. But note that you should still migrate away from `componentWillMount`😎.\n-   Jest `toEqual` might throw an error `allKeys[x].match is not a function` when trying to equal observable arrays. This is a bug in Jest [report](https://github.com/facebook/jest/issues/6398). The simple work around for now is to slice (or `toJS` if the problem is recursive) the array first.\n-   Jest `toEqual` matcher might no longer correctly equal your class instances, complaining about differences in the MobX adminstration. This is due to a bug with the processing of symbols: [report](https://github.com/facebook/jest/issues/6392). For now you might want to use a custom matcher if you are directly equalling observable objects. As a work around `toJS(object)` could be used before diffing.\n\n_Note June 7th, 2018:_ Both issues are already in Jest master and should be released soon.\n\n### Migration guide\n\n-   Make sure to not use any API that produces deprecation warnings in MobX 4. Beyond that MobX 5 should pretty well as drop-in replacement of MobX 4.\n-   You _could_ perform the following clean ups:\n    -   Don't `slice()` arrays when passing them to external libraries. (Note you still shouldn't pass observable data structures to non-`observer` React components, which is an orthogonal concept)\n    -   You could replace observable maps with observable objects if you are only using string-based keys.\n-   Don't call the `reverse` or `sort` operations directly on observableArray's anymore, as it's behavior slightly differed from the built-in implementations of those methods. Instead use `observableArray.slice().sort()` to perform the sort on a copy. This gives no additional performance overhead compared to MobX 4. (The reason behind this is that built-in `sort` updates the array in place, but the observable array implementation always performed the sort on a defensive copy, and this change makes that explicit).\n-   you may remove usages of `isArrayLike()` since `Array.isArray()` will now return true for observable arrays\n\n### API's that have been dropped\n\n-   The `arrayBuffer` setting is no longer supported by `configure` (it has become irrelevant)\n-   `observable.shallowBox`, `observable.shallowArray`, `observable.shallowMap`, `observable.shallowObject`, `extendShallowObservable` api's have been removed. Instead, pass `{ deep: false }` to their non-shallow counter parts.\n-   `observableArray.peek`, `observableArray.move`\n\n## 4.3.1\n\n-   Fixed [#1534](Fixes https://github.com/mobxjs/mobx/issues/1534): @computed({keepAlive: true}) no long calculates before being accessed.\n-   Added the `$mobx` export symbol for MobX 5 forward compatibity\n\n## 4.3.0\n\n-   Introduced the `entries(observable)` API, by @samjacobclift through [#1536](https://github.com/mobxjs/mobx/pull/1536)\n-   Fixed [#1535](https://github.com/mobxjs/mobx/issues/1535): Change in nested computed value was not propagated if read outside action context when there is a pending reaction. For more details see the exact test case.\n-   Illegal property access through prototypes is now a warning instead of an error. Fixes [#1506](https://github.com/mobxjs/mobx/issues/1506). By @AmazingTurtle through [#1529](https://github.com/mobxjs/mobx/pull/1529)\n-   Fixed issue where providing a custom setter to `@computed({ set: ... })` wasn't picked up\n-   Fixed #1545: Actions properties where not re-assignable when using TypeScript\n-   Illegal Access checks are now a warning instead of an error. Fix\n\n## 4.2.1\n\n-   Fixed flow typings for `mobx.configure` [#1521](https://github.com/mobxjs/mobx/pull/1521) by @andrew--r\n-   Improved typings for `mobx.flow`, fixes [#1527](https://github.com/mobxjs/mobx/issues/1527)\n-   Throw error when using `@observable` in combination with a getter. [#1511](https://github.com/mobxjs/mobx/pull/1511) by @quanganhtran\n-   `toJS` now uses Map internally, for faster detection of cycles. [#1517](https://github.com/mobxjs/mobx/pull/1517) by @loatheb\n-   Fixed [#1512](https://github.com/mobxjs/mobx/issues/1512): `observe` hooks not being triggered when using `mobx.set`, Fixed in [#1514](https://github.com/mobxjs/mobx/pull/1514) by @quanganhtran\n-   Several minor improvements, additional tests and doc improvements.\n\n## 4.2.0\n\n-   Introduced `configure({ enforceActions: \"strict\" })`, which is more strict then `enforceActions: true`, as it will also throw on non-observed changes to observables. See also [#1473](https://github.com/mobxjs/mobx/issues/1473)\n-   Fixed [#1480](https://github.com/mobxjs/mobx/issues/1480): Exceptions in the effect handler of `reaction` where not properly picked up by the global reaction system\n-   Fixed a bug where computed values updated their cached value, even when the comparer considered the new value equal to the previous one. Thanks @kuitos for finding this and fixing it! [#1499](https://github.com/mobxjs/mobx/pull/1499)\n-   Undeprecated `ObservableMap`, fixes [#1496](https://github.com/mobxjs/mobx/issues/1496)\n-   Observable arrays now support `Symbol.toStringTag` (if available / polyfilled). This allows libraries like Ramda to detect automatically that observable arrays are arrays. Fixes [#1490](https://github.com/mobxjs/mobx/issues/1490). Note that `Array.isArray` will keep returning false for the entire MobX 4 range.\n-   Actions are now always `configurable` and `writable`, like in MobX 3. Fixes [#1477](https://github.com/mobxjs/mobx/issues/1477)\n-   Merged several improvements to the flow typings. [#1501](https://github.com/mobxjs/mobx/pull/1501) by @quanganhtran\n-   Fixed several accidental usages of the global `fail`, by @mtaran-google through [#1483](https://github.com/mobxjs/mobx/pull/1483) and [#1482](https://github.com/mobxjs/mobx/pull/1482)\n\n## 4.1.1\n\n-   Import `default` from MobX will no longer throw, but only warn instead. This fixes some issues with tools that reflect on the `default` export of a module\n-   Disposing a spy listener inside a spy handler no longer causes an exception. Fixes [#1459](https://github.com/mobxjs/mobx/issues/1459) through [#1460](https://github.com/mobxjs/mobx/pull/1460) by [farwayer](https://github.com/farwayer)\n-   Added a missing `runInAction` overload in the flow typings. [#1451](https://github.com/mobxjs/mobx/pull/1451) by [AMilassin](https://github.com/mobxjs/mobx/issues?q=is%3Apr+author%3AAMilassin)\n-   Improved the typings of `decorate`. See [#1450](https://github.com/mobxjs/mobx/pull/1450) by [makepost](https://github.com/mobxjs/mobx/issues?q=is%3Apr+author%3Amakepost)\n\n## 4.1.0\n\n-   Introduced `keepAlive` as option to `computed`\n-   All observable api's now default to `any` for their generic arguments\n-   Improved `flow` cancellation\n-   The effect of `when` is now automatically an action.\n-   `@computed` properties are now declared on their owner rather then the protoptype. Fixes an issue where `@computed` fields didn't work in React Native on proxied objects. See [#1396](https://github.com/mobxjs/mobx/issues/1396)\n-   `action` and `action.bound` decorated fields are now reassignable, so that they can be stubbed\n\n## 4.0.2\n\n-   Fixed issue where exceptions like `TypeError: Cannot define property:__mobxDidRunLazyInitializers, object is not extensible.` were thrown. Fixes [#1404](https://github.com/mobxjs/mobx/issues/1404)\n-   Improved flow typings for `flow`, [#1399](https://github.com/mobxjs/mobx/pull/1399) by @ismailhabib\n\n## 4.0.1\n\n-   Updated flow typings, see [#1393](https://github.com/mobxjs/mobx/pull/1393) by [andrew--r](https://github.com/andrew--r)\n\n## 4.0.0\n\n-   For the highlights of this release, read the [blog](https://medium.com/p/c1fbc08008da/):\n-   For migration notes: see the [wiki page](https://github.com/mobxjs/mobx/wiki/Migrating-from-mobx-3-to-mobx-4)\n-   Note; many things that were removed to make the api surface smaller. If you think some feature shouldn't have been removed, feel free to open an issue!\n\nThis is the extensive list of all changes.\n\n### New features\n\nThe changes mentioned here are discussed in detail in the [release highlights](https://medium.com/p/c1fbc08008da/), or were simply updated in the docs.\n\n-   MobX 4 introduces separation between the production and non production build. The production build strips most typechecks, resulting in a faster and smaller build. Make sure to substitute process.env.NODE_ENV = \"production\" in your build process! If you are using MobX in a react project, you most probably already have set this up. Otherwise, the idea is explained [here](https://reactjs.org/docs/add-react-to-an-existing-app.html).\n-   Introduced `flow` to create a chain of async actions. This is the same function as [`asyncActions`](https://github.com/mobxjs/mobx-utils#asyncaction) of the mobx-utils package\n-   These `flow`'s are now cancellable, by calling `.cancel()` on the returned promise, which will throw a cancellation exception into the generator function.\n-   `flow` also has experimental support for async iterators (`async * function`)\n-   Introduced `decorate(thing, decorators)` to decorate classes or object without needing decorator syntax.\n-   Introduced `onBecomeObserved` and `onBecomeUnobserved`. These API's enable hooking into the observability system and get notified about when an observable starts / stops becoming used. This is great to automaticaly fetch data from external resources, or stop doing so.\n-   `computed` / `@computed` now accepts a `requiresReaction` option. If it set, the computed value will throw an exception if it is being read while not being tracked by some reaction.\n-   To make `requiresReaction` the default, use `mobx.configure({ computedRequiresReaction: true })`\n-   Introduced `mobx.configure({ disableErrorBoundaries })`, for easier debugging of exceptoins. By [NaridaL](https://github.com/NaridaL) through [#1262](https://github.com/mobxjs/mobx/pull/1262)\n-   `toJS` now accepts the options: `{ detectCycles?: boolean, exportMapsAsObjects?: boolean }`, both `true` by default\n-   Observable maps are now backed by real ES6 Maps. This means that any value can be used as key now, not just strings and numbers.\n-   The flow typings have been updated. Since this is a manual effort, there can be mistakes, so feel free to PR!\n\n-   `computed(fn, options?)` / `@computed(options) get fn()` now accept the following options:\n\n    -   `set: (value) => void` to set a custom setter on the computed property\n    -   `name: \"debug name\"`\n    -   `equals: fn` the equality value to use for the computed to determine whether its output has changed. The default is `comparer.default`. Alternatives are `comparer.structural`, `comparer.identity` or just your own comparison function.\n    -   `requiresReaction: boolean` see above.\n\n-   `autorun(fn, options?)` now accepts the following options:\n\n    -   `delay: number` debounce the autorun with the given amount of milliseconds. This replaces the MobX 3 api `autorunAsync`\n    -   `name: \"debug name\"`\n    -   `scheduler: function` a custom scheduler to run the autorun. For example to connect running the autorun to `requestAnimationFrame`. See the docs for more details\n    -   `onError`. A custom error handler to be notified when an autorun throws an exception.\n\n-   `reaction(expr, effect, options?)` now accepts the following options:\n\n    -   `delay: number` debounce the autorun with the given amount of milliseconds. This replaces the MobX 3 api `autorunAsync`\n    -   `fireImmediately`. Immediately fire the effect function after the first evaluation of `expr`\n    -   `equals`. Custom equality function to determine whether the `expr` function differed from its previous result, and hence should fire `effect`. Accepts the same options as the `equals` option of computed.\n    -   All the options `autorun` accepts\n\n-   `when(predicate, effect?, options?)` now accepts the following options:\n    -   `name: \"debug name\"`\n    -   `onError`. A custom error handler to be notified when an autorun throws an exception.\n    -   `timeout: number` a timeout in milliseconds, after which the `onError` handler will be triggered to signal the condition not being met within a certain time\n-   The `effect` parameter of `when` has become optional. If it is omitted, `when` will return a promise. This makes it easy to `await` a condition, for example: `await when(() => user.profile.loaded)`. The returned promise can be cancelled using `promise.cancel()`\n\n-   There is now an utility API that enables manipulating observable maps, objects and arrays with the same api. These api's are fully reactive, which means that even new property declarations can be detected by mobx if `set` is used to add them, and `values` or `keys` to iterate them.\n\n    -   `values(thing)` returns all values in the collection as array\n    -   `keys(thing)` returns all keys in the collection as array\n    -   `set(thing, key, value)` or `set(thing, { key: value })` Updates the given collection with the provided key / value pair(s).\n    -   `remove(thing, key)` removes the specified child from the collection. For arrays splicing is used.\n    -   `has(thing, key)` returns true if the collection has the specified _observable_ property.\n    -   `get(thing, key)` returns the chlid under the specified key.\n\n-   `observable`, `observable.array`, `observable.object`, `observable.map` and `extendObservable` now accept an additional options object, which can specify the following attributes:\n    -   `name: \"debug name\"`\n    -   `deep: boolean`. `true` by default, indicates whether the children of this collection are automatically converted into observables as well.\n    -   `defaultDecorator: <decorator>` specifies the default decorator used for new children / properties, by default: `observable.deep`, but could be changed to `observable.ref`, `observable.struct` etc. (The `deep` property is just a short-hand for switching between `observable.deep` or `observable.ref` as default decorator for new properties)\n\n### Breaking changes\n\nThe changes mentioned here are discussed in detail in the [migration notes](https://github.com/mobxjs/mobx/wiki/Migrating-from-mobx-3-to-mobx-4)\n\n-   MobX 4 requires `Map` to be globally available. Polyfill it if targeting IE < 11 or other older browsers.\n-   For typescript users, MobX now requires `Map` and several `Symbol`s to exist for its typings. So make sure that the `lib` configuration of your project is set to `\"es6\"`. (The compilation target can still be `\"es5\"`)\n-   `observable.shallowArray(values)` has been removed, instead use `observable.array(values, { deep: false })`\n-   `observable.shallowMap(values)` has been removed, instead use `observable.map(values, { deep: false })`\n-   `observable.shallowObject(values)` has been removed, instead use `observable.object(values, {}, { deep: false })`\n-   `extendShallowObservable(target, props)`, instead use `extendObservable(target, props, {}, { deep: false })`\n-   The decorators `observable.ref`, `observable.shallow`, `observable.deep`, `observable.struct` can no longer be used as functions. Instead, they should be passed as part of the `decorators` param to resp. `observable.object` and `extendObservable`\n-   The new signature of `extendObservable` is `extendObservable(target, props, decorators?, options?)`. This also means it is no longer possible to pass multiple bags of properties to `extendObservable`. ~~`extendObservable` can no longer be used to re-declare properties. Use `set` instead to update existing properties (or introduce new ones).~~ Update 13-01-2020: the latter limitation has been reverted in MobX 4.15.2 / 5.15.2\n-   Iterating maps now follows the spec, that is, `map.values()`, `map.entries()`, `map.keys()`, `map[@@iterator]()` and `array[@@iterator]()` no longer return an array, but an iterator. Use `mobx.values(map)` or `Array.from(map)` to convert the iterators to arrays.\n-   dropped `@computed.equals`, instead, you can now use `@computed({ equals: ... })`\n-   `useStrict(boolean)` was dropped, use `configure({ enforceActions: boolean })` instead\n-   `isolateGlobalState` was dropped, use `configure({ isolateGlobalState: true})` instead\n-   If there are multiple mobx instances active in a single project, an exception will be thrown. Previously only a warning was printed. Fixes #1098. For details, see [#1082](https://github.com/mobxjs/mobx/issues/1082).\n-   Dropped the `shareGlobalState` feature. Instead, projects should be setup properly and it is up to the hosting package to make sure that there is only one MobX instance\n-   `expr` has been moved to mobx-utils. Remember, `expr(fn)` is just `computed(fn).get()`\n-   `createTransformer` has been moved to mobx-utils\n-   Passing `context` explicitly to `autorun`, `reaction` etc is no longer supported. Use arrow functions or function.bind instead.\n-   Removed `autorunAsync`. Use the `delay` option of `autorun` instead.\n-   `autorun`, `when`, `reaction` don't support name as first argument anymore, instead pass the `name` option.\n-   The `extras.` namespace has been dropped to enable tree-shaking non-used MobX features. All methods that where there originally are now exported at top level. If they are part of the official public API (you are encouraged to use them) they are exported as is. If they are experimental or somehow internal (you are discouraged to use them), they are prefixed with `_`.\n-   Dropped bower support. Fixes #1263\n-   The `spyReportStart`, `spyReportEnd`, `spyReport` and `isSpyEnabled` are no longer public. It is no longer possible to emit custom spy events as to avoid confusing in listeners what the possible set of events is.\n-   Dropped `isStrictModeEnabled`\n-   `observable(value)` will only succeed if it can turn the value into an observable data structure (a Map, Array or observable object). But it will no longer create an observable box for other values to avoid confusion. Call `observable.box(value)` explictly in such cases.\n-   `isComputed` and `isObservable` no longer accept a property as second argument. Instead use `isComputedProp` and `isObservableProp`.\n-   Removed `whyRun`, use `trace` instead\n-   The spy event signature has slightly changed\n-   The `Atom` class is no longer exposed. Use `createAtom` instead (same signature).\n-   Calling reportObserved() on a self made atom will no longer trigger the hooks if reportObserved is triggered outside a reactive context.\n-   The options `struct` and `compareStructural` for computed values are deprecated, use `@computed.struct` or `computed({ equals: comparer.structural})` instead.\n-   `isModifierDescriptor` is no longer exposed.\n-   `deepEqual` is no longer exposed, use `comparer.structural` instead.\n-   `setReactionScheduler` -> `configure({ reactionScheduler: fn })`\n-   `reserveArrayBuffer` -> `configure({ reactionErrorHandler: fn })`\n-   `ObservableMap` is no longer exposed as constructor, use `observable.map` or `isObservableMap` instead\n-   `map` -> `observable.map`\n-   `runInAction` no longer accepts a custom scope\n-   Dropped the already deprecated and broken `default` export that made it harder to tree-shake mobx. Make sure to always use `import { x } from \"mobx\"` and not `import mobx from \"mobx\"`.\n-   Killed the already deprecated modifiers `asFlat` etc. If you war still using this, see the MobX 2 -> 3 migration notes.\n-   Observable maps now fully implement the map interface. See [#1361](https://github.com/mobxjs/mobx/pull/1361) by [Marc Fallows](https://github.com/marcfallows)\n-   Observable arrays will no longer expose the `.move` method\n-   Dropped the `observable.deep.struct` modifier\n-   Dropped the `observable.ref.struct` modifier\n-   `observable.struct` now behaves like `observable.ref.struct` (this used to be `observable.deep.struct`). That is; values in an `observable.struct` field will be stored as is, but structural comparison will be used when assigning a new value\n-   IReactionDisposer.onError has been removed, use the `onError` option of reactions instead\n\n### Issues fixed in this release:\n\nThe issues are incoprorated in the above notes.\n\n-   [#1316](https://github.com/mobxjs/mobx/issues/1316) - Improve `observable` api\n-   [#992](https://github.com/mobxjs/mobx/issues/992) - `onBecomeObserved` & `onBecomeUnobserved`\n-   [#1301](https://github.com/mobxjs/mobx/issues/1301) - Set `onError` handler when creating reactions\n-   [#817](https://github.com/mobxjs/mobx/issues/817) - Improve typings of `observe`\n-   [#800](https://github.com/mobxjs/mobx/issues/800) - Use `Map` as backend implementation of observable maps\n-   [#1361](https://github.com/mobxjs/mobx/issues/1361) - Make observableMaps structurally correct maps\n-   [#813](https://github.com/mobxjs/mobx/issues/813) - Create separate dev and production builds\n-   [#961](https://github.com/mobxjs/mobx/issues/961), [#1197](https://github.com/mobxjs/mobx/issues/1197) - Make it possible to forbid reading an untracked computed value\n-   [#1098](https://github.com/mobxjs/mobx/issues/1098) - Throw instead of warn if multiple MobX instances are active\n-   [#1122](https://github.com/mobxjs/mobx/issues/1122) - Atom hooks fired to often for observable maps\n-   [#1148](https://github.com/mobxjs/mobx/issues/1148) - Disposer of reactions should also cancel all scheduled effects\n-   [#1241](https://github.com/mobxjs/mobx/issues/1241) - Make it possible to disable error boundaries, to make it easier to find exceptions\n-   [#1263](https://github.com/mobxjs/mobx/issues/1263) - Remove bower.json\n\n## 3.6.2\n\n-   Fixed accidental dependency on the `node` typings. Fixes [#1387](https://github.com/mobxjs/mobx/issues/1387) / [#1362](https://github.com/mobxjs/mobx/issues/1387)\n\n## 3.6.1\n\n-   Fixed [#1358](https://github.com/mobxjs/mobx/pull/1359): Deep comparison failing on IE11. By [le0nik](https://github.com/le0nik) through [#1359](https://github.com/mobxjs/mobx/pull/1359)\n\n## 3.6.0\n\n-   Fixed [#1118](https://github.com/mobxjs/mobx/issues/1118), the deepEquals operator build into mobx gave wrong results for non-primitive objects. This affected for example `computed.struct`, or the `compareStructural` of `reaction`\n\n## 3.5.0/1\n\n-   Introduced `trace` for easier debugging of reactions / computed values. See the [docs](https://mobx.js.org/best/trace.html) for details.\n-   Improved typings of `observableArray.find`, see [#1324](https://github.com/mobxjs/mobx/pull/1324) for details.\n\n## 3.4.1\n\n-   Republished 3.4.0, because the package update doesn't seem to distibute consistently through yarn / npm\n\n## 3.4.0\n\n-   Improve Flow support by exposing typings regularly. Flow will automatically include them now. In your `.flowconfig` will have to remove the import in the `[libs]` section (as it's done [here](https://github.com/mobxjs/mobx/pull/1254#issuecomment-348926416)). Fixes [#1232](https://github.com/mobxjs/mobx/issues/1232).\n\n## 3.3.3\n\n-   Fixed regression bug where observable map contents could not be replaced using another observable map [#1258](https://github.com/mobxjs/mobx/issues/1258)\n-   Fixed weird exception abot not being able to read `length` property of a function, see[#1238](https://github.com/mobxjs/mobx/issues/1238) through [#1257](https://github.com/mobxjs/mobx/issues/1238) by @dannsam\n\n## 3.3.2\n\n-   Fix bug where custom comparers could be invoked with `undefined` values. Fixes [#1208](https://github.com/mobxjs/mobx/issues/1208)\n-   Make typings for observable stricter when using flow [#1194](https://github.com/mobxjs/mobx/issues/1194), [#1231](https://github.com/mobxjs/mobx/issues/1231)\n-   Fix a bug where `map.replace` would trigger reactions for unchanged values, fixes [#1243](https://github.com/mobxjs/mobx/issues/1243)\n-   Fixed issue where `NaN` was considered unequal to `NaN` when a deep compare was made [#1249](https://github.com/mobxjs/mobx/issues/1249)\n\n## 3.3.1\n\n-   Fix bug allowing maps to be modified outside actions when using strict mode, fixes [#940](https://github.com/mobxjs/mobx/issues/940)\n-   Fixed [#1139](https://github.com/mobxjs/mobx/issues/1139) properly: `transaction` is no longer deprecated and doesn't disable tracking properties anymore\n-   Fixed [#1120](https://github.com/mobxjs/mobx/issues/1139): `isComputed` should return false for non-existing properties\n\n## 3.3.0\n\n-   Undeprecated `transaction`, see [#1139](https://github.com/mobxjs/mobx/issues/1139)\n-   Fixed typings of reaction [#1136](https://github.com/mobxjs/mobx/issues/1136)\n-   It is now possible to re-define a computed property [#1121](https://github.com/mobxjs/mobx/issues/1121)\n-   Print an helpful error message when using `@action` on a getter [#971](https://github.com/mobxjs/mobx/issues/971)\n-   Improved typings of intercept [#1119](https://github.com/mobxjs/mobx/issues/1119)\n-   Made code base Prettier [#1103](https://github.com/mobxjs/mobx/issues/1103)\n-   react-native will now by default use the es module build as well.\n-   Added support for Weex, see [#1163](https://github.com/mobxjs/mobx/pull/1163/)\n-   Added workaround for Firefox issue causing MobX to crash, see [#614](https://github.com/mobxjs/mobx/issues/614)\n\n## 3.2.2\n\n-   Fixes a bug (or a known limitation) described in [#1092](https://github.com/mobxjs/mobx/issue/1092/). It is now possible to have different observable administration on different levels of the prototype chain. By @guillaumeleclerc\n-   Fixed a build issue when using mobx in a project that was using rollup, fixes [#1099](https://github.com/mobxjs/mobx/issue/1099/) by @rossipedia\n-   Fixed typings of `useStrict`, by @rickbeerendonk\n\n## 3.2.1\n\n-   Introduced customizable value comperators to reactions and computed values. `reaction` and `computed` now support an additional option, `equals`, which takes a comparision function. See [#951](https://github.com/mobxjs/mobx/pull/951/) by @jamiewinder. Fixes #802 and #943. See the updated [`computed` docs](https://mobx.js.org/refguide/computed-decorator.html) for more details.\n\n## 3.2.0\n\n-   MobX will warn again when there are multiple instances of MobX loaded, as this lead to often to confusing bugs if the project setup was not properly. The signal mobx that multiple instances are loaded on purpose, use `mobx.extras.runInSandbox`. See [#1082](https://github.com/mobxjs/mobx/issues/1082) for details.\n\n## 3.1.17\n\n-   Improved typings of `IObservableArray.intercept`: use more restrictive types for `change` parameter of `handler`, by @bvanreeven\n-   Fixed [#1072](https://github.com/mobxjs/mobx/issues/1072), fields without a default value could not be observed yet when using TypeScript\n\n## 3.1.16\n\n-   Restored `default` export (and added warning), which broke code that was importing mobx like `import mobx from \"mobx\"`. Use `import * as mobx from \"mobx\"` or use named importes instead. By @andykog, see #1043, #1050\n-   Fixed several typos in exceptions and documentation\n\n## 3.1.15\n\n-   Fixed issue where `array.remove` did not work correctly in combination with `extras.interceptReads`\n\n## 3.1.14\n\n-   Fixed 3.1.12 / 3.1.13 module packing. See #1039; `module` target is now transpiled to ES5 as well\n\n## 3.1.13 (Unpublished: Uglify chokes on it in CRA)\n\n-   Fixed build issue with webpack 2, see #1040\n\n## 3.1.12 (Unpublished: wasn't being bundled correctly by all bundlers)\n\n-   Added support for ES modules. See #1027 by @rossipedia\n-   Improved flow typings. See #1019 by @fb55\n-   Introduced experimental feature `extras.interceptReads(observable: ObservableMap | ObservableArray | ObservableObject | ObservableBox, property?: string, handler: value => value): Disposer` that can be used to intercept _reads_ from observable objects, to transform values on the fly when a value is read. One can achieve similar things with this as with proxying reads. See #1036\n\n## 3.1.11\n\n-   Using rollup as bundler, instead of custom hacked build scripts, by @rossipedia, see #1023\n\n## 3.1.10\n\n-   Fixed flow typings for `when`, by @jamsea\n-   Add flow typings for `map.replace`, by @leader22\n-   Added `observableArray.findIndex`, by @leader22\n-   Improved typings of `autorun` / `autorunAsync` to better support async / await, by @capaj\n-   Fixed typings of `action.bound`, see #803\n\n## 3.1.9\n\n-   Introduced explicit `.get(index)` and `.set(index, value)` methods on observable arrays, for issues that have trouble handling many property descriptors on objects. See also #734\n-   Made sure it is safe to call `onBecomeObserved` twice in row, fixes #874, #898\n-   Fixed typings of `IReactionDisposer`\n\n## 3.1.8\n\n-   Fixed edge case where `autorun` was not triggered again if a computed value was invalidated by the reaction itself, see [#916](https://github.com/mobxjs/mobx/issues/916), by @andykog\n-   Added support for primtive keys in `createTransformer`, See #920 by @dnakov\n-   Improved typings of `isArrayLike`, see #904, by @mohsen1\n\n## 3.1.7\n\n-   Reverted ES2015 module changes, as they broke with webpack 2 (will be re-released later)\n\n## 3.1.6 (Unpublished)\n\n-   Expose ES2015 modules to be used with advanced bundlers, by @mohsen1, fixes #868\n-   Improved typings of `IObservableArray.intercept`: remove superflous type parameter, by @bvanreeven\n-   Improved typings of map changes, by @hediet\n\n## 3.1.5\n\n-   Improved typings of map changes, see #847, by @hediet\n-   Fixed issue with `reaction` if `fireImmediately` was combined with `delay` option, see #837, by @SaboteurSpk\n\n## 3.1.4\n\n-   Observable maps initialized from ES6 didn't deeply convert their values to observables. (fixes #869,by @ggarek)\n\n## 3.1.3\n\n-   Make sure that `ObservableArray.replace` can handle large arrays by not using splats internally. (See e.g. #859)\n-   Exposed `ObservableArray.spliceWithArray`, that unlike a normal splice, doesn't use a variadic argument list so that it is possible to splice in new arrays that are larger then allowed by the callstack.\n\n## 3.1.2\n\n-   Fixed incompatiblity issue with `mobx-react@4.1.0`\n\n## 3.1.1 (unpublished)\n\n-   Introduced `isBoxedObservable(value)`, fixes #804\n\n## 3.1.0\n\n### Improved strict mode\n\nStrict mode has been relaxed a bit in this release. Also computed values can now better handle creating new observables (in an action if needed). The semantics are now as follows:\n\n-   In strict mode, it is not allowed to modify state that is already being _observed_ by some reaction.\n-   It is allowed to create and modify observable values in computed blocks, as long as they are not _observed_ yet.\n\nIn order words: Observables that are not in use anywhere yet, are not protected by MobX strict mode.\nThis is fine as the main goal of strict mode is to avoid kicking of reactions at undesired places.\nAlso strict mode enforces batched mutations of observables (through action).\nHowever, for unobserved observables this is not relevant; they won't kick of reactions at all.\n\nThis fixes some uses cases where one now have to jump through hoops like:\n\n-   Creating observables in computed properties was fine already, but threw if this was done with the aid of an action. See issue [#798](https://github.com/mobxjs/mobx/issues/798).\n-   In strict mode, it was not possible to _update_ observable values without wrapping the code in `runInAction` or `action`. See issue [#563](https://github.com/mobxjs/mobx/issues/563)\n\nNote that the following constructions are still anti patterns, although MobX won't throw anymore on them:\n\n-   Changing unobserved, but not just created observables in a computed value\n-   Invoke actions in computed values. Use reactions like `autorun` or `reaction` instead.\n\nNote that observables that are not in use by a reaction, but that have `.observe` listeners attached, do _not_ count towards being observed.\nObserve and intercept callbacks are concepts that do not relate to strict mode, actions or transactions.\n\n### Other changes\n\n-   Reactions and observable values now consider `NaN === NaN`, See #805 by @andykog\n-   Merged #783: extract error messages to seperate file, so that they can be optimized in production builds (not yet done), by @reisel, #GoodnessSquad\n-   Improved typings of actions, see #796 by @mattiamanzati\n\n## 3.0.2\n\n-   Fixed issue where MobX failed on environments where `Map` is not defined, #779 by @dirtyrolf\n-   MobX can now be compiled on windows as well! #772 by @madarauchiha #GoodnessSquad\n-   Added documentation on how Flow typings can be used, #766 by @wietsevenema\n-   Added support for `Symbol.toPrimitive()` and `valueOf()`, see #773 by @eladnava #GoodnessSquad\n-   Supressed an exception that was thrown when using the Chrome Developer tools to inspect arrays, see #752\n\nRe-introduced _structural comparison_. Seems we couldn't part from it yet :). So the following things have been added:\n\n-   `struct` option to `reaction` (alias for `compareStructural`, to get more consistency in naming)\n-   `observable.struct`, as alias for `observable.deep.struct`\n-   `observable.deep.struct`: Only stores a new value and notify observers if the new value is not structurally the same as the previous value. Beware of cycles! Converts new values automatically to observables (like `observable.deep`)\n-   `observable.ref.struct`: Only stores a new value and notify observers if the new value is not structurally the same as the previous value. Beware of cycles! Doesn't convert the new value into observables.\n-   `extras.deepEquals`: Check if two data structures are deeply equal. supports observable and non observable data structures.\n\n## 3.0.1\n\n-   `toString()` of observable arrays now behaves like normal arrays (by @capaj, see #759)\n-   Improved flow types of `toJS`by @jamsea (#758)\n\n## 3.0.0\n\nThe changelog of MobX 3 might look quite overwhelming, but migrating to MobX 3 should be pretty straight forward nonetheless.\nThe api has now become more layered, and the api is more uniform and modifiers are cleaned up.\nIn practice, you should check your usage of modifiers (`asFlat`, `asMap` etc.). Besides that the migration should be pretty painless.\nPlease report if this isn't the case!\nNote that no changes to the runtime algorithm where made, almost all changes evolve in making the creation of observables more uniform, and removing deprecated stuff.\n\n## `observable` api has been redesigned\n\nThe api to create observables has been redesigned.\nBy default, it keeps the automatic conversion behavior from MobX 2.\nHowever, one can now have more fine grained control on how / which observables are constructed.\nModifiers still exists, but they are more regular, and there should be less need for them.\n\n### `observable(plainObject)` will no longer enhance objects, but clone instead\n\nWhen passing a plain object to `observable`, MobX used to modify that object inplace and give it observable capabilities.\nThis also happened when assigning a plain object to an observable array etc.\nHowever, this behavior has changed for a few reasons\n\n1.  Both arrays and maps create new data structure, however, `observable(object)` didn't\n2.  It resulted in unnecessary and confusing side effects. If you passed an object you received from some api to a function that added it, for example, to an observable collection. Suddenly your object would be modified as side effect of passing it down to that function. This was often confusing for beginners and could lead to subtle bugs.\n3.  If MobX in the future uses Proxies behind the scenes, this would need to change as well\n\nIf you want, you can still enhance existing plainObjects, but simply using `extendObservable(data, data)`. This was actually the old implementation, which has now changed to `extendObservable({}, data)`.\n\nAs always, it is best practice not to have transportation objects etc lingering around; there should be only one source of truth, and that is the data that is in your observable state.\nIf you already adhered to this rule, this change won't impact you.\n\nSee [#649](https://github.com/mobxjs/mobx/issues/649)\n\n### Factories per observable type\n\nThere are now explicit methods to create an observable of a specific type.\n\n-   `observable.object(props, name?)` creates a new observable object, by cloning the give props and making them observable\n-   `observable.array(initialValues, name?)`. Take a guess..\n-   `observable.map(initialValues, name?)`\n-   `observable.box(initialValue, name?)`. Creates a [boxed](http://mobxjs.github.io/mobx/refguide/boxed.html) value, which can be read from / written to using `.get()` and `.set(newValue)`\n-   `observable(value)`, as-is, based on the type of `value`, uses any of the above four functions to create a new observable.\n\n### Shallow factories per type\n\nThe standard observable factories create observable structures that will try to turn any plain javascript value (arrays, objects or Maps) into observables.\nAllthough this is fine in most cases, in some cases you might want to disable this autoconversion.\nFor example when storing objects from external libraries.\nIn MobX 2 you needed to use `asFlat` or `asReference` modifiers for this.\nIn MobX 3, there are factories to directly create non-converting data structures:\n\n-   `observable.shallowObject(props, name?)`\n-   `observable.shallowArray(initialValues, name?)`\n-   `observable.shallowMap(initialValues, name?)`\n-   `observable.shallowBox(initialValue, name?)`\n\nSo for example, `observable.shallowArray([todo1, todo2])` will create an observable array, but it won't try to convert the todos inside the array into observables as well.\n\n### Shallow properties\n\nThe `@observable` decorator can still be used to introduce observable properties. And like in MobX 2, it will automatically convert its values.\n\nHowever, sometimes you want to create an observable property that does not convert its _value_ into an observable automatically.\nPreviously that could be written as `@observable x = asReference(value)`.\n\n### Structurally comparison of observables have been removed\n\nThis was not for a technical reason, but they just seemed hardly used.\nStructural comparision for computed properties and reactions is still possible.\nFeel free to file an issue, including use case, to re-introduce this feature if you think you really need it.\nHowever, we noticed that in practice people rarely use it. And in cases where it is used `reference` / `shallow` is often a better fit (when using immutable data for example).\n\n### Modifiers\n\nModifiers can be used in combination `@observable`, `extendObservable` and `observable.object` to change the autoconversion rules of specific properties.\n\nThe following modifiers are available:\n\n-   `observable.deep`: This is the default modifier, used by any observable. It converts any assigned, non-primitive value into an observable value if it isn't one yet.\n-   `observable.ref`: Disables automatic observable conversion, just creates an observable reference instead.\n-   `observable.shallow`: Can only used in combination with collections. Turns any assigned collection into an collection, which is shallowly observable (instead of deep)\n\nModifiers can be used as decorator:\n\n```javascript\nclass TaskStore {\n    @observable.shallow tasks = []\n}\n```\n\nOr as property modifier in combination with `observable.object` / `observable.extendObservable`.\nNote that modifiers always 'stick' to the property. So they will remain in effect even if a new value is assigned.\n\n```javascript\nconst taskStore = observable({\n    tasks: observable.shallow([])\n})\n```\n\nSee [modifiers](http://mobxjs.github.io/mobx/refguide/modifiers.html)\n\n### `computed` api has been simplified\n\nUsing `computed` to create boxed observables has been simplified, and `computed` can now be invoked as follows:\n\n-   `computed(expr)`\n-   `computed(expr, setter)`\n-   `computed(expr, options)`, where options is an object that can specify one or more of the following fields: `name`, `setter`, `compareStructural` or `context` (the \"this\").\n\nComputed can also be used as a decorator:\n\n-   `@computed`\n-   `@computed.struct` when you want to compareStructural (previously was `@computed({asStructure: true})`)\n\n### `reaction` api has been simplified\n\nThe signature of `reaction` is now `reaction(dataFunc, effectFunc, options?)`, where the following options are accepted:\n\n-   `context`: The `this` to be used in the functions\n-   `fireImmediately`\n-   `delay`: Number in milliseconds that can be used to debounce the effect function.\n-   `compareStructural`: `false` by default. If `true`, the return value of the _data_ function is structurally compared to its previous return value, and the _effect_ function will only be invoked if there is a structural change in the output.\n-   `name`: String\n\n### Bound actions\n\nIt is now possible to create actions and bind them in one go using `action.bound`. See [#699](https://github.com/mobxjs/mobx/issues/699).\nThis means that now the following is possible:\n\n```javascript\nclass Ticker {\n    @observable tick = 0\n\n    @action.bound\n    increment() {\n        this.tick++ // 'this' will always be correct\n    }\n}\n\nconst ticker = new Ticker()\nsetInterval(ticker.increment, 1000)\n```\n\n### Improve error handling\n\nError handling in MobX has been made more consistent. In MobX 2 there was a best-effort recovery attempt if a derivation throws, but MobX 3 introduced\nmore consistent behavior:\n\n-   Computed values that throw, store the exception and throw it to the next consumer(s). They keep tracking their data, so they are able to recover from exceptions in next re-runs.\n-   Reactions (like `autorun`, `when`, `reaction`, `render()` of `observer` components) will always catch their exceptions, and just log the error. They will keep tracking their data, so they are able to recover in next re-runs.\n-   The disposer of a reaction exposes an `onError(handler)` method, which makes it possible to attach custom error handling logic to an reaction (that overrides the default logging behavior).\n-   `extras.onReactionError(handler)` can be used to register a global onError handler for reactions (will fire after spy \"error\" event). This can be useful in tests etc.\n\nSee [#731](https://github.com/mobxjs/mobx/issues/731)\n\n### Removed error handling, improved error recovery\n\nMobX always printed a warning when an exception was thrown from a computed value, reaction or react component: `[mobx] An uncaught exception occurred while calculating....`.\nThis warning was often confusing for people because they either had the impression that this was a mobx exception, while it actually is just informing about an exception that happened in userland code.\nAnd sometimes, the actual exception was silently caught somewhere else.\nMobX now does not print any warnings anymore, and just makes sure its internal state is still stable.\nNot throwing or handling an exception is now entirely the responsibility of the user.\n\nThrowing an exception doesn't revert the causing mutation, but it does reset tracking information, which makes it possible to recover from exceptions by changing the state in such a way that a next run of the derivation doesn't throw.\n\n### Flow-Types Support 🎉🎉🎉\n\nFlow typings have been added by [A-gambit](https://github.com/A-gambit).\nAdd flow types for methods and interfaces of observable variables:\n\n```js\nconst observableValue: IObservableValue<number> = observable(1)\nconst observableArray: IObservableArray<number> = observable([1, 2, 3])\n\nconst sum: IComputedValue<number> = computed(() => {\n    return observableArray.reduce((a: number, b: number): number => a + b, 0)\n})\n```\n\nSee [#640](https://github.com/mobxjs/mobx/issues/640)\n\n### MobX will no longer share global state by default\n\nFor historical reasons (at Mendix), MobX had a feature that it would warn if different versions of the MobX package are being loaded into the same javascript runtime multiple times.\nThis is because multiple instances by default try to share their state.\nThis allows reactions from one package to react to observables created by another package,\neven when both packages where shipped with their own (embedded) version of MobX (!).\n\nObviously this is a nasty default as it breaks package isolation and might actually start to throw errors unintentionally when MobX is loaded multiple times in the same runtime by completely unrelated packages.\nSo this sharing behavior is now by default turned off.\nSharing MobX should be achieved by means of proper bundling, de-duplication of packages or using peer dependencies / externals if needed.\nThis is similar to packages like React, which will also bail out if you try to load it multiple times.\n\nIf you still want to use the old behavior, this can be achieved by running `mobx.extras.shareGlobalState()` on _all_ packages that want to share state with each other.\nSince this behavior is probably not used outside Mendix, it has been deprecated immediately, so if you rely on this feature, please report in #621, so that it can be undeprecated if there is no more elegant solution.\n\nSee [#621](https://github.com/mobxjs/mobx/issues/621)\n\n### Using the @action decorator inside individual objects\n\nDon't use the `@action` decorator on an individual object that you pass to `observable()` or `extendObservable()`. If you have code that looks like `observable({ @action f: () => {})`, you should change it to `observable({ f: action(() => {})`.\n\nWhether or not this was ever a good idea is debatable, but it stopped working in this version. If you're using classes, it's a non-issue.\n\n### Other changes\n\n-   **Breaking change:** The arguments to `observe` listeners for computed and boxed observables have changed and are now consistent with the other apis. Instead of invoking the callback with `(newValue: T, oldValue: T)` they are now invoked with a single change object: `(change: {newValue: T, oldValue: T, object, type: \"update\"})`\n-   Using transaction is now deprecated, use `action` or `runInAction` instead. Transactions now will enter an `untracked` block as well, just as actions, which removes the conceptual difference.\n-   Upgraded to typescript 2\n-   It is now possible to pass ES6 Maps to `observable` / observable maps. The map will be converted to an observable map (if keys are string like)\n-   Made `action` more debug friendly, it should now be easier to step through\n-   ObservableMap now has an additional method, `.replace(data)`, which is a combination of `clear()` and `merge(data)`.\n-   Passing a function to `observable` will now create a boxed observable refering to that function\n-   Fixed #603: exceptions in transaction breaks future reactions\n-   Fixed #698: createTransformer should support default arguments\n-   Transactions are no longer reported grouped in spy events. If you want to group events, use actions instead.\n-   Normalized `spy` events further. Computed values and actions now report `object` instead of `target` for the scope they have been applied to.\n-   The following deprecated methods have been removed:\n    -   `transaction`\n    -   `autorunUntil`\n    -   `trackTransitions`\n    -   `fastArray`\n    -   `SimpleEventEmitter`\n    -   `ObservableMap.toJs` (use `toJS`)\n    -   `toJSlegacy`\n    -   `toJSON` (use `toJS`)\n    -   invoking `observe` and `inject` with plain javascript objects\n\n---\n\n## 2.7.0\n\n### Automatic inference of computed properties has been deprecated.\n\nA deprecation message will now be printed if creating computed properties while relying on automatical inferrence of argumentless functions as computed values. In other words, when using `observable` or `extendObservable` in the following manner:\n\n```javascript\nconst x = observable({\n    computedProp: function () {\n        return someComputation\n    }\n})\n\n// Due to automatic inferrence now available as computed property:\nx.computedProp\n// And not !\nx.computedProp()\n```\n\nInstead, to create a computed property, use:\n\n```javascript\nobservable({\n    get computedProp() {\n        return someComputation\n    }\n})\n```\n\nor alternatively:\n\n```javascript\nobservable({\n    computedProp: computed(function () {\n        return someComputation\n    })\n})\n```\n\nThis change should avoid confusing experiences when trying to create methods that don't take arguments.\nThe current behavior will be kept as-is in the MobX 2.\\* range,\nbut from MobX 3 onward the argumentless functions will no longer be turned\nautomatically into computed values; they will be treated the same as function with arguments.\nAn observable _reference_ to the function will be made and the function itself will be preserved.\nSee for more details [#532](https://github.com/mobxjs/mobx/issues/532)\n\nN.B. If you want to introduce actions on an observable that modify its state, using `action` is still the recommended approach:\n\n```javascript\nobservable({\n    counter: 0,\n    increment: action(function () {\n        this.counter++\n    })\n})\n```\n\nBy the way, if you have code such as:\n\n```\nobservable({\n    @computed get someProp() { ... }\n});\n```\n\nThat code will no longer work. Rather, reactions will fail silently. Remove `@computed`.\nNote, this only applies when using observable in this way; it doesn't apply when using\n`@observable` on a property within a class declaration.\n\n### Misc\n\n-   Fixed #701: `toJS` sometimes failing to convert objects decorated with `@observable` (cause: `isObservable` sometimes returned false on these object)\n-   Fixed typings for `when` / `autorun` / `reaction`; they all return a disposer function.\n\n## 2.6.5\n\n-   Added `move` operation to observable array, see [#697](https://github.com/mobxjs/mobx/pull/697)\n\n## 2.6.4\n\n-   Fixed potential clean up issue if an exception was thrown from an intercept handler\n-   Improved typings of `asStructure` (by @nidu, see #687)\n-   Added support for `computed(asStructure(() => expr))` (by @yotambarzilay, see #685)\n\n## 2.6.3\n\n-   Fixed #603: exceptions in transaction breaks future reactions\n-   Improved typings of `toJS`\n-   Introduced `setReactionScheduler`. Internal api used by mobx-react@4 to be notified when reactions will be run\n\n## 2.6.2\n\n-   Changes related to `toJS` as mentioned in version `2.6.0` where not actually shipped. This has been fixed, so see release notes below.\n\n## 2.6.1\n\n-   Introduced convenience `isArrayLike`: returns whether the argument is either a JS- or observable array. By @dslmeinte\n-   Improved readme. By @DavidLGoldberg\n-   Improved assertion message, by @ncammarate (See [#618](https://github.com/mobxjs/mobx/pull/618))\n-   Added HashNode badge, by @sandeeppanda92\n\n## 2.6.0\n\n_Marked as minor release as the behavior of `toJS` has been changed, which might be interpreted both as bug-fix or as breaking change, depending of how you interpreted the docs_\n\n-   Fixed [#566](https://github.com/mobxjs/mobx/pull/566): Fixed incorrect behavior of `toJS`: `toJS` will now only recurse into observable object, not all objects. The new behavior is now aligned with what is suggested in the docs, but as a result the semantics changed a bit. `toJSlegacy` will be around for a while implementing the old behavior. See [#589](See https://github.com/mobxjs/mobx/pull/589) for more details.\n-   Fixed [#571](https://github.com/mobxjs/mobx/pull/571): Don't use `instanceof` operator. Should fix issues if MobX is included multiple times in the same bundle.\n-   Fixed [#576](https://github.com/mobxjs/mobx/pull/576): disallow passing actions directly to `autorun`; as they won't be tracked by @jeffijoe\n-   Extending observable objects with other observable (objects) is now explicitly forbidden, fixes [#540](https://github.com/mobxjs/mobx/pull/540).\n\n## 2.5.2\n\n-   Introduced `isComputed`\n-   Observable objects can now have a type: `IObservableObject`, see [#484](https://github.com/mobxjs/mobx/pull/484) by @spiffytech\n-   Restored 2.4 behavior of boxed observables inside observable objects, see [#558](https://github.com/mobxjs/mobx/issues/558)\n\n## 2.5.1\n\n-   Computed properties can now be created by using getter / setter functions. This is the idiomatic way to introduce computed properties from now on:\n\n```javascript\nconst box = observable({\n    length: 2,\n    get squared() {\n        return this.length * this.length\n    },\n    set squared(value) {\n        this.length = Math.sqrt(value)\n    }\n})\n```\n\n## 2.5.0\n\n-   Core derivation algorithm has received some majore improvements by @asterius1! See below. Pr #452, 489\n-   Introduced setters for computed properties, use `computed(expr, setter)` or `@computed get name() { return expr } set name (value) { action }`. `computed` can now be used as modifier in `observable` / `extendObservable`, #421, #463 (see below for example)\n-   Introduced `isStrictModeEnabled()`, deprecated `useStrict()` without arguments, see #464\n-   Fixed #505, accessing an observable property throws before it is initialized\n\nMobX is now able track and memoize computed values while an (trans)action is running.\nBefore 2.5, accessing a computed value during a transaction always resulted in a recomputation each time the computed value was accessed, because one of the upstream observables (might) have changed.\nIn 2.5, MobX actively tracks whether one of the observables has changed and won't recompute computed values unnecessary.\nThis means that computed values are now always memoized for the duration of the current action.\nIn specific cases, this might signficantly speed up actions that extensively make decisions based on computed values.\n\nExample:\n\n```javascript\nclass Square {\n    @observable length = 2\n    @computed get squared() {\n        return this.length * this.length\n    }\n    // mobx now supports setters for computed values\n    set squared(surfaceSize) {\n        this.length = Math.sqrt(surfaceSize)\n    }\n\n    // core changes make actions more efficient if extensively using computed values:\n    @action stuff() {\n        this.length = 3\n        console.log(this.squared) // recomputes in both 2.5 and before\n        console.log(this.squared) // no longer recomputes\n        this.length = 4\n        console.log(this.squared) // recomputes in both 2.5 and before\n        // after the action, before 2.5 squared would compute another time (if in use by a reaction), that is no longer the case\n    }\n}\n```\n\nES5 example for setters:\n\n```javascript\nfunction Square() {\n    extendObservable(this, {\n        length: 2,\n        squared: computed(\n            function () {\n                return this.squared * this.squared\n            },\n            function (surfaceSize) {\n                this.length = Math.sqrt(surfaceSize)\n            }\n        )\n    })\n}\n```\n\n## 2.4.4\n\n-   Fixed #503: map.delete returns boolean\n-   Fix return type of `runInAction`, #499 by @Strate\n-   Fixed enumerability of observable array methods, see #496.\n-   Use TypeScript typeguards, #487 by @Strate\n-   Added overloads to `action` for better type inference, #500 by @Strate\n-   Fixed #502: `extendObservable` fails on objects created with `Object.create(null)`\n-   Implemented #480 / #488: better typings for `asMap`, by @Strate\n\n## 2.4.3\n\n-   Objects with a `null` prototype are now considered plain objects as well\n-   Improved error message for non-converging cyclic reactions\n-   Fixed potential HMR issue\n\n## 2.4.2\n\n-   Improved error message when wrongly using `@computed`, by @bb (#450)\n-   `observableArray.slice` now automatically converts observable arrays to plain arrays, fixes #460\n-   Improved error message when an uncaught exception is thrown by a MobX tracked function\n\n## 2.4.1\n\n-   `@action` decorated methods are now configurable. Fixes #441\n-   The `onBecomeObserved` event handler is now triggered when an atom is observed, instead of when it is bound as dependency. Fixes #427 and makes atoms easier to extend.\n-   if `useStrict()` is invoked without arguments, it now returns the current value of strict mode.\n-   the current reaction is now always passed as first argument to the callbacks of `autorun`, `autorunAsync`, `when` and `reaction`. This allows reactions to be immediately disposed during the first run. See #438, by @andykog\n\n## 2.4.0\n\n-   _Note: the internal version of MobX has been bumped. This version has no breaking api changes, but if you have MobX loaded multiple times in your project, they all have to be upgraded to `2.4.0`. MobX will report this when starting._\n-   Made dependency tracking and binding significant faster. Should result in huge performance improvements when working with large collections.\n-   Fixed typescript decorator issue, #423, #425? (by @bb)\n\n## 2.3.7\n\n-   Fixed issue where computed values were tracked and accidentally kept alive during actions\n\n## 2.3.6\n\n-   Fixed #406: Observable maps doesn't work with empty initial value in Safari\n-   Implemented #357, #348: ObservableMap and ObservableArray now support iterators. Use [`@@iterator()` or iterall](https://github.com/leebyron/iterall) in ES5 environments.\n\n## 2.3.5\n\n-   Fixed #364: Observable arrays not reacting properly to index assignments under iOS safari (mobile) 9.1.1 By @andykog\n-   Fixed #387: Typings of boxed values\n-   Added warning when reading array entries out of bounds. See #381\n\n## 2.3.4\n\n-   Fixed #360: Removed expensive cycle detection (cycles are still detected, but a bit later)\n-   Fixed #377: `toJS` serialization of Dates and Regexes preserves the original values\n-   Fixed #379: `@action` decorated methods can now be inherited / overridden\n\n## 2.3.3\n\n-   Fixed #186: Log a warning instead of an error if an exception is thrown in a derivation. Fixes issue where React Native would produce unusable error screens (because it shows the first logged error)\n-   Fixed #333: Fixed some interoperability issues in combination with `Reflect` / `InversifyJS` decorators. @andykog\n-   Fixed #333: `@observable` class properties are now _owned_ by their instance again, meaning they will show up in `Object.keys()` and `.hasOwnProperty` @andykog\n\n## 2.3.2\n\n-   Fixed #328: Fixed exception when inspecting observable in `onBecomeObserved`\n-   Fixed #341: `array.find` now returns `undefined` instead of `null` when nothing was found, behavior now matches the docs. (By @hellectronic)\n\n## 2.3.1\n\n-   Fixed #327: spy not working with runInAction\n\n## 2.3.0\n\n### Introduced `whyRun`:\n\nUsage:\n\n-   `whyRun()`\n-   `whyRun(Reaction object / ComputedValue object / disposer function)`\n-   `whyRun(object, \"computed property name\")`\n\n`whyRun` is a small utility that can be used inside computed value or reaction (`autorun`, `reaction` or the `render` method of an `observer` React component)\nand prints why the derivation is currently running, and under which circumstances it will run again.\nThis should help to get a deeper understanding when and why MobX runs stuff, and prevent some beginner mistakes.\n\nThis feature can probably be improved based on your feedback, so feel free to file issues with suggestions!\n\n### Semantic changes:\n\n-   `@observable` is now always defined on the class prototypes and not in the instances. This means that `@observable` properties are enumerable, but won't appear if `Object.keys` or `hasOwnProperty` is used on a class _instance_.\n-   Updated semantics of `reaction` as discussed in `#278`. The expression now needs to return a value and the side effect won't be triggered if the result didn't change. `asStructure` is supported in these cases. In contrast to MobX 2.2, effects will no longer be run if the output of the expression didn't change.\n\n### Enhancements\n\n-   Introduces `isAction(fn)` #290\n-   If an (argumentless) action is passed to `observable` / `extendObservable`, it will not be converted into a computed property.\n-   Fixed #285: class instances are now also supported by `toJS`. Also members defined on prototypes which are enumerable are converted.\n-   Map keys are now always coerced to strings. Fixes #308\n-   `when`, `autorun` and `autorunAsync` now accept custom debug names (see #293, by @jamiewinder)\n-   Fixed #286: autoruns no longer stop working if an action throws an exception\n-   Implemented `runInAction`, can be used to create on the fly actions (especially useful in combination with `async/await`, see #299\n-   Improved performance and reduced mem usage of decorators signficantly (by defining the properties on the prototype if possible), and removed subtle differences between the implementation and behavior in babel and typescript.\n-   Updated logo as per #244. Tnx @osenvosem!\n\n# 2.2.2:\n\n-   Fixed issue #267: exception when `useStrict(true)` was invoked in combination with `@observable` attributes when using Babel\n-   Fixed issue #269: @action in combination with typescript targeting ES6 and reflect.ts\n-   Improved compatibility with `JSON.stringify`, removed incorrect deprecation message\n-   Improved some error messages\n\n# 2.2.1\n\n-   Fixed issue where typescript threw a compile error when using `@action` without params on a field\n-   Fixed issue where context was accidentally shared between class instances when using `@action` on a field\n\n# 2.2.0\n\nSee the [release announcement](https://medium.com/@mweststrate/45cdc73c7c8d) for the full details of this release:\n\nIntroduced:\n\n-   `action` / `@action`\n-   `intercept`\n-   `spy`\n-   `reaction`\n-   `useStrict`\n-   improved debug names\n-   `toJSON` was renamed to `toJS`\n-   `observable(asMap())` is the new idiomatic way to create maps\n-   the effect of `when` is now untracked, similar to `reaction.\n-   `extras.trackTransations` is deprecated, use `spy` instead\n-   `untracked` has been undeprecated\n-   introduced / documented: `getAtom`, `getDebugName`, `isSpyEnabled`, `spyReport`, `spyReportStart`, `spyReportEnd`\n-   deprecated `extras.SimpleEventEmitter`\n-   array splice events now also report the `added` collection and `removedCount`\n\n# 2.1.7\n\n-   Fixed a false negative in cycle detection, as reported in #236\n\n# 2.1.6\n\n-   Fixed #236, #237 call stack issues when working with large arrays\n\n# 2.1.5\n\n-   Fix #222 (by @andykog) run `observe` callback of computed properties in untracked mode.\n\n# 2.1.4\n\n-   Fixed #201 (see also #160), another iOS enumerability issue... By @luosong\n\n# 2.1.3\n\n-   Fixed #191, when using babel, complex field initializers where shared. By @andykog\n-   Added `lib/mobx.umd.min.js` for minified cdn builds, see #85\n\n# 2.1.2\n\n-   Improved debug names of objects created using a constructor\n-   Fixed(?) some issues with iOS7 as reported in #60 by @bstst\n\n# 2.1.1\n\n-   Fixed issue where `autorun`s created inside `autorun`s were not always kicked off. (`mobx-react`'s `observer` was not affected). Please upgrade if you often use autorun.\n-   Fixed typings of `mobx.map`, a list of entries is also acceptable.\n-   (Experimental) Improved error recovery a bit further\n\n# 2.1.0\n\n-   MobX is now chatty again when an exception occurs inside a autorun / computed value / React.render. Previously this was considered to be the responsibility of the surrounding code. But if exceptions were eaten this would be really tricky to debug.\n-   (Experimental) MobX will now do a poor attempt to recover from exceptions that occured in autorun / computed value / React.render.\n\n# 2.0.6\n\n-   `resetGlobalState` is now part of the `mobx.extras` namespace, as it is useful for test setup, to restore inconsistent state after test failures.\n-   `resetGlobalState` now also resets the caches of `createTransformer`, see #163.\n\n# 2.0.5\n\n-   WIP on bower support\n\n# 2.0.4\n\n-   `$transformId` property on transformed objects should be non-enumerable. Fixes #170.\n\n# 2.0.3\n\n-   Always peek if inspecting a stale, computed value. Fixes #165.\n\n# 2.0.2\n\n-   Fixed issue where changing an object property was tracked, which could lead to unending loops in `autorunAsync`.\n\n# 2.0.1\n\n-   Undeprecated `observable(scalar)` (see 143)\n-   `expr` no longer prints incorrect deprecated messages (see 143)\n-   Requires `mobx` twice no longer fails.\n\n# 2.0.0\n\n## A new name...\n\nWelcome to ~Mobservable~ MobX 2! First of all, there is the name change.\nThe new name is shorter and funnier and it has the right emphasis: MobX is about reactive programming.\nNot about observability of data structures, which is just a technical necessity.\nMobX now has its own [mobxjs](https://github.com/mobxjs) organization on GitHub. Just report an issue if you want to join.\n\nAll MobX 2.0 two compatible packages and repos have been renamed. So `mobx-react`, `mobx-react-devtools` etc.\nFor the 1.0 versions, use the old `mobservable` based names.\n\n## Migrating from Mobservable 1.x to MobX 2.0\n\nMigrating from Mobservable should be pretty straight-forward as the public api is largely the same.\nHowever there are some conceptual changes which justifies a Major version bump as it might alter the behavior of MobX in edge cases.\nBesides that, MobX is just a large collection of minor improvements over Mobservable.\nMake sure to remove your old `mobservable` dependencies when installing the new `mobx` dependencies!\n\n## `autorun`s are now allowed to cause cycles!\n\n`autorun` is now allowed to have cycles. In Mobservable 1 an exception was thrown as soon as an autorun modified a variable which it was reading as well.\nIn MobX 2 these situations are now allowed and the autorun will trigger itself to be fired again immediately after the current execution.\nThis is fine as long as the autorun terminates within a reasonable amount of iterations (100).\nThis should avoid the need for work-arounds involving `setTimeout` etc.\nNote that computed values (created using `observable(func)` are still not allowed to have cycles.\n\n## [Breaking] `observable(scalar)` returns an object instead of a function and has been deprecated.\n\nCreating an observable from a primitive or a reference no longer returns a getter/setter function, but a method with a `.get` and `.set` method.\nThis is less confusing, easier to debug and more efficient.\n\nSo to read or write from an observable scalar use:\n\n```javascript\nconst temperature = observable(27)\ntemperature.set(15) // previously: temperature(15)\ntemperature.get() // previously: temperature()\n```\n\n`observable(scalar)` has been deprecated to make the api smaller and the syntax more uniform. In practice having observable objects, arrays and decorators seems to suffice in 99% of the cases. Deprecating this functionality means that people have simply less concepts to learn. Probably creating observable scalars will continue to work for a long time, as it is important to the internals of MobX and very convenient for testing.\n\n## Introduced `@computed`\n\nMobX introduced the `@computed` decorator for ES6 class properties with getter functions.\nIt does technically the same as `@observable` for getter properties. But having a separate decorator makes it easier to communicate about the code.\n`@observable` is for mutable state properties, `@computed` is for derived values.\n\n`@computed` can now also be parameterized. `@computed({asStructure: true})` makes sure that the result of a derivation is compared structurally instead of referentially with its preview value. This makes sure that observers of the computation don't re-evaluate if new structures are returned that are structurally equal to the original ones. This is very useful when working with point, vector or color structures for example. It behaves the same as the `asStructure` modifier for observable values.\n\n`@computed` properties are no longer enumerable.\n\n## MobX is now extensible!\n\nThe core algorithm of MobX has been largely rewritten to improve the clarity, extensibility, performance and stability of the source code.\nIt is now possible to define your own custom observable data sources by using the `Atom` class.\nIt is also possible to create your own reactive functions using the `Reaction` class. `autorun`, `autorunAsync` and `@observer` have now all been implemented using the concept of Reactions.\nSo feel free to write your own reactive [constructions](http://mobxjs.github.io/mobx/refguide/extending.html)!\n\n## Mobservable now fails fast\n\nIn Mobservable 1 exceptions would be caught and sometimes re-thrown after logging them.\nThis was confusing and not all derivations were able to recover from these exceptions.\nIn MobX 2 it is no longer allowed for a computed function or `autorun` to throw an exception.\n\n## Improved build\n\n-   MobX is roughly 20% faster\n-   MobX is smaller: 75KB -> 60KB unminified, and 54KB -> 30KB minified.\n-   Distributable builds are no longer available in the git repository, use unpkg instead:\n-   Commonjs build: https://unpkg.com/mobx@^2.0.0/lib/mobx.js\n-   Minified commonjs build: https://unpkg.com/mobx@^2.0.0/lib/mobx.min.js\n-   UMD build: https://unpkg.com/mobx@^2.0.0/lib/mobx.umd.js\n-   To use the minified build, require / import the lib from `\"mobx/lib/mobx.min.js\"` (or set up an alias in your webpack configuration if applicable)\n\n## Other changes\n\n-   Improved debug names of all observables. This is especially visible when using `mobx-react-devtools` or `extras.trackTransitions`.\n-   Renamed `extras.SimpleEventEmitter` to `SimpleEventEmitter`\n-   Removed already deprecated methods: `isReactive`, `makeReactive`, `observeUntil`, `observeAsync`\n-   Removed `extras.getDNode`\n-   Invoking `ObservableArray.peek` is no longer registered as listener\n-   Deprecated `untracked`. It wasn't documented and nobody seems to miss it.\n\n# 1.2.5\n\n-   Map no longer throws when `.has`, `.get` or `.delete` is invoked with an invalid key (#116)\n-   Files are now compiled without sourcemap to avoid issues when loading mobservable in a debugger when `src/` folder is not available.\n\n# 1.2.4\n\n-   Fixed: observable arrays didn't properly apply modifiers if created using `asFlat([])` or `fastArray([])`\n-   Don't try to make frozen objects observable (by @andykog)\n-   `observableArray.reverse` no longer mutates the arry but just returns a sorted copy\n-   Updated tests to use babel6\n\n# 1.2.3\n\n-   observableArray.sort no longer mutates the array being sorted but returns a sorted clone instead (#90)\n-   removed an incorrect internal state assumption (#97)\n\n# 1.2.2\n\n-   Add bower support\n\n# 1.2.1\n\n-   Computed value now yields consistent results when being inspected while in transaction\n\n# 1.2.0\n\n-   Implemented #67: Reactive graph transformations. See: http://mobxjs.github.io/mobservable/refguide/create-transformer.html\n\n# 1.1.8\n\n-   Implemented #59, `isObservable` and `observe` now support a property name as second param to observe individual values on maps and objects.\n\n# 1.1.7\n\n-   Fixed #77: package consumers with --noImplicitAny should be able to build\n\n# 1.1.6\n\n-   Introduced `mobservable.fastArray(array)`, in addition to `mobservable.observable(array)`. Which is much faster when adding items but doesn't support enumerability (`for (var idx in ar) ..` loops).\n-   Introduced `observableArray.peek()`, for fast access to the array values. Should be used read-only.\n\n# 1.1.5\n\n-   Fixed 71: transactions should not influence running computations\n\n# 1.1.4\n\n-   Fixed #65; illegal state exception when using a transaction inside a reactive function. Credits: @kmalakoff\n\n# 1.1.3\n\n-   Fixed #61; if autorun was created during a transaction, postpone execution until the end of the transaction\n\n# 1.1.2\n\n-   Fixed exception when autorunUntil finished immediately\n\n# 1.1.1\n\n-   `toJSON` now serializes object trees with cycles as well. If you know the object tree is acyclic, pass in `false` as second parameter for a performance gain.\n\n# 1.1.0\n\n-   Exposed `ObservableMap` type\n-   Introduced `mobservable.untracked(block)`\n-   Introduced `mobservable.autorunAsync(block, delay)`\n\n# 1.0.9\n\nRemoved accidental log message\n\n# 1.0.7 / 1.0.8\n\nFixed inconsistency when using `transaction` and `@observer`, which sometimes caused stale values to be displayed.\n\n# 1.0.6\n\nFix incompatibility issue with systemjs bundler (see PR 52)\n\n# 1.0.4/5\n\n-   `map.size` is now a property instead of a function\n-   `map()` now accepts an array as entries to construct the new map\n-   introduced `isObservableObject`, `isObservableArray` and `isObservableMap`\n-   introduced `observe`, to observe observable arrays, objects and maps, similarly to Object.observe and Array.observe\n\n# 1.0.3\n\n-   `extendObservable` now supports passing in multiple object properties\n\n# 1.0.2\n\n-   added `mobservable.map()`, which creates a new map similarly to ES6 maps, yet observable. Until properly documentation, see the [MDN docs](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map).\n\n# 1.0.1\n\n-   Stricter argument checking for several apis.\n\n# 1.0\n\n## Renames\n\n-   `isReactive` -> `isObservable`\n-   `makeReactive` -> `observable`\n-   `extendReactive` -> `extendObservable`\n-   `observe` -> `autorun`\n-   `observeUntil` -> `autorunUntil`\n-   `observeAsync` -> `autorunAsync`\n-   `reactiveComponent` -> `observer` (in `mobservable-react` package)\n\n## Breaking changes\n\n-   dropped the `strict` and `logLevel` settings of mobservable. View functions are by default run in `strict` mode, `autorun` (formerly: `observe`) functions in `non-strict` mode (strict indicates that it is allowed to change other observable values during the computation of a view funtion).\n    Use `extras.withStrict(boolean, block)` if you want to deviate from the default behavior.\n-   `observable` (formerly `makeReactive`) no longer accepts an options object. The modifiers `asReference`, `asStructure` and `asFlat` can be used instead.\n-   dropped the `default` export of observable\n-   Removed all earlier deprecated functions\n\n## Bugfixes / improvements\n\n-   `mobservable` now ships with TypeScript 1.6 compliant module typings, no external typings file is required anymore.\n-   `mobservable-react` supports React Native as well through the import `\"mobservable-react/native\"`.\n-   Improved debugger support\n-   `for (var key in observablearray)` now lists the correct keys\n-   `@observable` now works correct on classes that are transpiled by either TypeScript or Babel (Not all constructions where supported in Babel earlier)\n-   Simplified error handling, mobservable will no longer catch errors in views, which makes the stack traces easier to debug.\n-   Removed the initial 'welcom to mobservable' logline that was printed during start-up.\n\n# 0.7.1\n\n-   Backported Babel support for the @observable decorator from the 1.0 branch. The decorator should now behave the same when compiled with either Typescript or Babeljs.\n\n# 0.7.0\n\n-   Introduced `strict` mode (see issues [#30](), [#31]())\n-   Renamed `sideEffect` to `observe`\n-   Renamed `when` to `observeUntil`\n-   Introduced `observeAsync`.\n-   Fixed issue where changing the `logLevel` was not picked up.\n-   Improved typings.\n-   Introduces `asStructure` (see [#8]()) and `asFlat`.\n-   Assigning a plain object to a reactive structure no longer clones the object, instead, the original object is decorated. (Arrays are still cloned due to Javascript limitations to extend arrays).\n-   Reintroduced `expr(func)` as shorthand for `makeReactive(func)()`, which is useful to create temporarily views inside views\n-   Deprecated the options object that could be passed to `makeReactive`.\n-   Deprecated the options object that could be passed to `makeReactive`:\n    -   A `thisArg` can be passed as second param.\n    -   A name (for debugging) can be passed as second or third param\n    -   The `as` modifier is no longer needed, use `asReference` (instead of `as:'reference'`) or `asFlat` (instead of `recurse:false`).\n\n# 0.6.10\n\n-   Fixed issue where @observable did not properly create a stand-alone view\n\n# 0.6.9\n\n-   Fixed bug where views where sometimes not triggered again if the dependency tree changed to much.\n\n# 0.6.8\n\n-   Introduced `when`, which, given a reactive predicate, observes it until it returns true.\n-   Renamed `sideEffect -> observe`\n\n# 0.6.7:\n\n-   Improved logging\n\n# 0.6.6:\n\n-   Deprecated observable array `.values()` and `.clone()`\n-   Deprecated observeUntilInvalid; use sideEffect instead\n-   Renamed mobservable.toJson to mobservable.toJSON\n\n# 0.6.5:\n\n-   It is no longer possible to create impure views; views that alter other reactive values.\n-   Update links to the new documentation.\n\n# 0.6.4:\n\n-   2nd argument of sideEffect is now the scope, instead of an options object which hadn't any useful properties\n\n# 0.6.3\n\n-   Deprecated: reactiveComponent, reactiveComponent from the separate package mobservable-react should be used instead\n-   Store the trackingstack globally, so that multiple instances of mobservable can run together\n\n# 0.6.2\n\n-   Deprecated: @observable on functions (use getter functions instead)\n-   Introduced: `getDependencyTree`, `getObserverTree` and `trackTransitions`\n-   Minor performance improvements\n"
  },
  {
    "path": "packages/mobx/__tests__/.babelrc",
    "content": "{\n    \"presets\": [\"@babel/preset-env\"],\n    \"plugins\": [\n        [\n            \"@babel/plugin-transform-runtime\",\n            {\n                \"regenerator\": true\n            }\n        ],\n        [\"@babel/plugin-proposal-decorators\", { \"legacy\": true }],\n        [\"@babel/plugin-proposal-class-properties\", { \"loose\": false }]\n    ]\n}\n"
  },
  {
    "path": "packages/mobx/__tests__/decorators_20223/stage3-decorators.ts",
    "content": "\"use strict\"\n\nimport {\n    observe,\n    computed,\n    observable,\n    autorun,\n    extendObservable,\n    action,\n    IObservableArray,\n    IArrayWillChange,\n    IArrayWillSplice,\n    IObservableValue,\n    isObservable,\n    isObservableProp,\n    isObservableObject,\n    transaction,\n    IObjectDidChange,\n    spy,\n    configure,\n    isAction,\n    IAtom,\n    createAtom,\n    runInAction,\n    makeObservable\n} from \"../../src/mobx\"\nimport { type ObservableArrayAdministration } from \"../../src/internal\"\nimport * as mobx from \"../../src/mobx\"\n\nconst testFunction = function (a: any) {}\n\n// lazy wrapper around yest\n\nconst t = {\n    equal(a: any, b: any) {\n        expect(a).toBe(b)\n    },\n    deepEqual(a: any, b: any) {\n        expect(a).toEqual(b)\n    },\n    notEqual(a: any, b: any) {\n        expect(a).not.toEqual(b)\n    },\n\n    throws(a: any, b: any) {\n        expect(a).toThrow(b)\n    }\n}\n\ntest(\"decorators\", () => {\n    class Order {\n        @observable accessor price: number = 3\n        @observable accessor amount: number = 2\n        @observable accessor orders: string[] = []\n        @observable accessor aFunction = testFunction\n\n        @computed\n        get total() {\n            return this.amount * this.price * (1 + this.orders.length)\n        }\n    }\n\n    const o = new Order()\n    t.equal(isObservableObject(o), true)\n    t.equal(isObservableProp(o, \"amount\"), true)\n    t.equal(isObservableProp(o, \"total\"), true)\n\n    const events: any[] = []\n    const d1 = observe(o, (ev: IObjectDidChange) => events.push(ev.name, (ev as any).oldValue))\n    const d2 = observe(o, \"price\", ev => events.push(ev.newValue, ev.oldValue))\n    const d3 = observe(o, \"total\", ev => events.push(ev.newValue, ev.oldValue))\n\n    o.price = 4\n\n    d1()\n    d2()\n    d3()\n\n    o.price = 5\n\n    t.deepEqual(events, [\n        8, // new total\n        6, // old total\n        4, // new price\n        3, // old price\n        \"price\", // event name\n        3 // event oldValue\n    ])\n})\n\ntest(\"annotations\", () => {\n    const fn0 = () => 0\n    class Order {\n        @observable accessor price: number = 3\n        @observable accessor amount: number = 2\n        @observable accessor orders: string[] = []\n        @observable accessor aFunction = fn0\n\n        @computed\n        get total() {\n            return this.amount * this.price * (1 + this.orders.length)\n        }\n    }\n\n    const order1totals: number[] = []\n    const order1 = new Order()\n    const order2 = new Order()\n\n    const disposer = autorun(() => {\n        order1totals.push(order1.total)\n    })\n\n    order2.price = 4\n    order1.amount = 1\n\n    t.equal(order1.price, 3)\n    t.equal(order1.total, 3)\n    t.equal(order2.total, 8)\n    order2.orders.push(\"bla\")\n    t.equal(order2.total, 16)\n\n    order1.orders.splice(0, 0, \"boe\", \"hoi\")\n    t.deepEqual(order1totals, [6, 3, 9])\n\n    disposer()\n    order1.orders.pop()\n    t.equal(order1.total, 6)\n    t.deepEqual(order1totals, [6, 3, 9])\n    expect(isAction(order1.aFunction)).toBe(true)\n    expect(order1.aFunction()).toBe(0)\n    order1.aFunction = () => 1\n    expect(isAction(order1.aFunction)).toBe(true)\n    expect(order1.aFunction()).toBe(1)\n})\n\ntest(\"box\", () => {\n    class Box {\n        @observable accessor uninitialized: any\n        @observable accessor height = 20\n        @observable accessor sizes = [2]\n        @observable accessor someFunc = function () {\n            return 2\n        }\n        @computed\n        get width() {\n            return this.height * this.sizes.length * this.someFunc() * (this.uninitialized ? 2 : 1)\n        }\n        @action(\"test\")\n        addSize() {\n            this.sizes.push(3)\n            this.sizes.push(4)\n        }\n    }\n\n    const box = new Box()\n\n    const ar: number[] = []\n\n    autorun(() => {\n        ar.push(box.width)\n    })\n\n    t.deepEqual(ar.slice(), [40])\n    box.height = 10\n    t.deepEqual(ar.slice(), [40, 20])\n    box.sizes.push(3, 4)\n    t.deepEqual(ar.slice(), [40, 20, 60])\n    box.someFunc = () => 7\n    t.deepEqual(ar.slice(), [40, 20, 60, 210])\n    box.uninitialized = true\n    t.deepEqual(ar.slice(), [40, 20, 60, 210, 420])\n    box.addSize()\n    expect(ar.slice()).toEqual([40, 20, 60, 210, 420, 700])\n})\n\ntest(\"computed setter should succeed\", () => {\n    class Bla {\n        @observable accessor a = 3\n        @computed\n        get propX() {\n            return this.a * 2\n        }\n        set propX(v) {\n            this.a = v\n        }\n    }\n\n    const b = new Bla()\n    t.equal(b.propX, 6)\n    b.propX = 4\n    t.equal(b.propX, 8)\n})\n\ntest(\"ClassFieldDecorators should NOT work without accessor without legacy compilation\", () => {\n    expect(() => {\n        class Order {\n            @observable price: number = 3\n        }\n    }).toThrow(\"[MobX] Please use `@observable accessor price` instead of `@observable price`\")\n})\n\ntest(\"Reasonable error for decorator kind mismatch\", () => {\n    expect(() => {\n        class Order {\n            // @ts-ignore\n            @computed total = 3\n        }\n    }).toThrow(\"[MobX] The decorator applied to 'total' cannot be used on a field element\")\n})\n\ntest(\"typescript: parameterized computed decorator\", () => {\n    class TestClass {\n        @observable accessor x = 3\n        @observable accessor y = 3\n        @computed.struct\n        get boxedSum() {\n            return { sum: Math.round(this.x) + Math.round(this.y) }\n        }\n    }\n\n    const t1 = new TestClass()\n    const changes: { sum: number }[] = []\n    const d = autorun(() => changes.push(t1.boxedSum))\n\n    t1.y = 4 // change\n    t.equal(changes.length, 2)\n    t1.y = 4.2 // no change\n    t.equal(changes.length, 2)\n    transaction(() => {\n        t1.y = 3\n        t1.x = 4\n    }) // no change\n    t.equal(changes.length, 2)\n    t1.x = 6 // change\n    t.equal(changes.length, 3)\n    d()\n\n    t.deepEqual(changes, [{ sum: 6 }, { sum: 7 }, { sum: 9 }])\n})\n\ntest(\"issue 165\", () => {\n    function report<T>(msg: string, value: T) {\n        // console.log(msg, \":\", value)\n        return value\n    }\n\n    class Card {\n        constructor(public game: Game, public id: number) {\n            makeObservable(this)\n        }\n\n        @computed\n        get isWrong() {\n            return report(\n                \"Computing isWrong for card \" + this.id,\n                this.isSelected && this.game.isMatchWrong\n            )\n        }\n\n        @computed\n        get isSelected() {\n            return report(\n                \"Computing isSelected for card\" + this.id,\n                this.game.firstCardSelected === this || this.game.secondCardSelected === this\n            )\n        }\n    }\n\n    class Game {\n        @observable accessor firstCardSelected: Card | null = null\n        @observable accessor secondCardSelected: Card | null = null\n\n        @computed\n        get isMatchWrong() {\n            return report(\n                \"Computing isMatchWrong\",\n                this.secondCardSelected !== null &&\n                    this.firstCardSelected!.id !== this.secondCardSelected.id\n            )\n        }\n    }\n\n    let game = new Game()\n    let card1 = new Card(game, 1),\n        card2 = new Card(game, 2)\n\n    autorun(() => {\n        card1.isWrong\n        card2.isWrong\n        // console.log(\"card1.isWrong =\", card1.isWrong)\n        // console.log(\"card2.isWrong =\", card2.isWrong)\n        // console.log(\"------------------------------\")\n    })\n\n    // console.log(\"Selecting first card\")\n    game.firstCardSelected = card1\n    // console.log(\"Selecting second card\")\n    game.secondCardSelected = card2\n\n    t.equal(card1.isWrong, true)\n    t.equal(card2.isWrong, true)\n})\n\ntest(\"issue 191 - shared initializers (2022.3)\", () => {\n    class Test {\n        @observable accessor obj = { a: 1 }\n        @observable accessor array = [2]\n    }\n\n    const t1 = new Test()\n    t1.obj.a = 2\n    t1.array.push(3)\n\n    const t2 = new Test()\n    t2.obj.a = 3\n    t2.array.push(4)\n\n    t.notEqual(t1.obj, t2.obj)\n    t.notEqual(t1.array, t2.array)\n    t.equal(t1.obj.a, 2)\n    t.equal(t2.obj.a, 3)\n\n    t.deepEqual(t1.array.slice(), [2, 3])\n    t.deepEqual(t2.array.slice(), [2, 4])\n})\n\nfunction normalizeSpyEvents(events: any[]) {\n    events.forEach(ev => {\n        delete ev.fn\n        delete ev.time\n    })\n    return events\n}\n\ntest(\"action decorator (2022.3)\", () => {\n    class Store {\n        constructor(private multiplier: number) {}\n\n        @action\n        add(a: number, b: number): number {\n            return (a + b) * this.multiplier\n        }\n    }\n\n    const store1 = new Store(2)\n    const store2 = new Store(3)\n    const events: any[] = []\n    const d = spy(events.push.bind(events))\n    t.equal(store1.add(3, 4), 14)\n    t.equal(store2.add(2, 2), 12)\n    t.equal(store1.add(1, 1), 4)\n\n    t.deepEqual(normalizeSpyEvents(events), [\n        { arguments: [3, 4], name: \"add\", spyReportStart: true, object: store1, type: \"action\" },\n        { type: \"report-end\", spyReportEnd: true },\n        { arguments: [2, 2], name: \"add\", spyReportStart: true, object: store2, type: \"action\" },\n        { type: \"report-end\", spyReportEnd: true },\n        { arguments: [1, 1], name: \"add\", spyReportStart: true, object: store1, type: \"action\" },\n        { type: \"report-end\", spyReportEnd: true }\n    ])\n\n    d()\n})\n\ntest(\"custom action decorator (2022.3)\", () => {\n    class Store {\n        constructor(private multiplier: number) {}\n\n        @action(\"zoem zoem\")\n        add(a: number, b: number): number {\n            return (a + b) * this.multiplier\n        }\n    }\n\n    const store1 = new Store(2)\n    const store2 = new Store(3)\n    const events: any[] = []\n    const d = spy(events.push.bind(events))\n    t.equal(store1.add(3, 4), 14)\n    t.equal(store2.add(2, 2), 12)\n    t.equal(store1.add(1, 1), 4)\n\n    t.deepEqual(normalizeSpyEvents(events), [\n        {\n            arguments: [3, 4],\n            name: \"zoem zoem\",\n            spyReportStart: true,\n            object: store1,\n            type: \"action\"\n        },\n        { type: \"report-end\", spyReportEnd: true },\n        {\n            arguments: [2, 2],\n            name: \"zoem zoem\",\n            spyReportStart: true,\n            object: store2,\n            type: \"action\"\n        },\n        { type: \"report-end\", spyReportEnd: true },\n        {\n            arguments: [1, 1],\n            name: \"zoem zoem\",\n            spyReportStart: true,\n            object: store1,\n            type: \"action\"\n        },\n        { type: \"report-end\", spyReportEnd: true }\n    ])\n\n    d()\n})\n\ntest(\"action decorator on field (2022.3)\", () => {\n    class Store {\n        constructor(private multiplier: number) {}\n\n        @action\n        add = (a: number, b: number) => {\n            return (a + b) * this.multiplier\n        }\n    }\n\n    const store1 = new Store(2)\n    const store2 = new Store(7)\n    expect(store1.add).not.toEqual(store2.add)\n\n    const events: any[] = []\n    const d = spy(events.push.bind(events))\n    t.equal(store1.add(3, 4), 14)\n    t.equal(store2.add(4, 5), 63)\n    t.equal(store1.add(2, 2), 8)\n\n    t.deepEqual(normalizeSpyEvents(events), [\n        { arguments: [3, 4], name: \"add\", spyReportStart: true, object: store1, type: \"action\" },\n        { type: \"report-end\", spyReportEnd: true },\n        { arguments: [4, 5], name: \"add\", spyReportStart: true, object: store2, type: \"action\" },\n        { type: \"report-end\", spyReportEnd: true },\n        { arguments: [2, 2], name: \"add\", spyReportStart: true, object: store1, type: \"action\" },\n        { type: \"report-end\", spyReportEnd: true }\n    ])\n\n    d()\n})\n\ntest(\"custom action decorator on field (2022.3)\", () => {\n    class Store {\n        constructor(private multiplier: number) {}\n\n        @action(\"zoem zoem\")\n        add = (a: number, b: number) => {\n            return (a + b) * this.multiplier\n        }\n    }\n\n    const store1 = new Store(2)\n    const store2 = new Store(7)\n\n    const events: any[] = []\n    const d = spy(events.push.bind(events))\n    t.equal(store1.add(3, 4), 14)\n    t.equal(store2.add(4, 5), 63)\n    t.equal(store1.add(2, 2), 8)\n\n    t.deepEqual(normalizeSpyEvents(events), [\n        {\n            arguments: [3, 4],\n            name: \"zoem zoem\",\n            spyReportStart: true,\n            object: store1,\n            type: \"action\"\n        },\n        { type: \"report-end\", spyReportEnd: true },\n        {\n            arguments: [4, 5],\n            name: \"zoem zoem\",\n            spyReportStart: true,\n            object: store2,\n            type: \"action\"\n        },\n        { type: \"report-end\", spyReportEnd: true },\n        {\n            arguments: [2, 2],\n            name: \"zoem zoem\",\n            spyReportStart: true,\n            object: store1,\n            type: \"action\"\n        },\n        { type: \"report-end\", spyReportEnd: true }\n    ])\n\n    d()\n})\n\ntest(\"267 (2022.3) should be possible to declare properties observable outside strict mode\", () => {\n    configure({ enforceActions: \"observed\" })\n\n    class Store {\n        @observable accessor timer: number | null = null\n    }\n\n    configure({ enforceActions: \"never\" })\n})\n\ntest(\"288 atom not detected for object property\", () => {\n    class Store {\n        @observable accessor foo = \"\"\n    }\n\n    const store = new Store()\n\n    mobx.observe(\n        store,\n        \"foo\",\n        () => {\n            // console.log(\"Change observed\")\n        },\n        true\n    )\n})\n\ntest.skip(\"observable performance - ts - decorators\", () => {\n    const AMOUNT = 100000\n\n    class A {\n        @observable accessor a = 1\n        @observable accessor b = 2\n        @observable accessor c = 3\n        @computed\n        get d() {\n            return this.a + this.b + this.c\n        }\n    }\n\n    const objs: any[] = []\n    const start = Date.now()\n\n    for (let i = 0; i < AMOUNT; i++) objs.push(new A())\n\n    console.log(\"created in \", Date.now() - start)\n\n    for (let j = 0; j < 4; j++) {\n        for (let i = 0; i < AMOUNT; i++) {\n            const obj = objs[i]\n            obj.a += 3\n            obj.b *= 4\n            obj.c = obj.b - obj.a\n            obj.d\n        }\n    }\n\n    console.log(\"changed in \", Date.now() - start)\n})\n\ntest(\"unbound methods\", () => {\n    class A {\n        // shared across all instances\n        @action\n        m1() {}\n    }\n\n    const a1 = new A()\n    const a2 = new A()\n\n    t.equal(a1.m1, a2.m1)\n    t.equal(Object.hasOwnProperty.call(a1, \"m1\"), false)\n    t.equal(Object.hasOwnProperty.call(a2, \"m1\"), false)\n})\n\ntest(\"inheritance\", () => {\n    class A {\n        @observable accessor a = 2\n    }\n\n    class B extends A {\n        @observable accessor b = 3\n        @computed\n        get c() {\n            return this.a + this.b\n        }\n        constructor() {\n            super()\n            makeObservable(this)\n        }\n    }\n    const b1 = new B()\n    const b2 = new B()\n    const values: any[] = []\n    mobx.autorun(() => values.push(b1.c + b2.c))\n\n    b1.a = 3\n    b1.b = 4\n    b2.b = 5\n    b2.a = 6\n\n    t.deepEqual(values, [10, 11, 12, 14, 18])\n})\n\ntest(\"inheritance overrides observable\", () => {\n    class A {\n        @observable accessor a = 2\n    }\n\n    class B {\n        @observable accessor a = 5\n        @observable accessor b = 3\n        @computed\n        get c() {\n            return this.a + this.b\n        }\n    }\n\n    const b1 = new B()\n    const b2 = new B()\n    const values: any[] = []\n    mobx.autorun(() => values.push(b1.c + b2.c))\n\n    b1.a = 3\n    b1.b = 4\n    b2.b = 5\n    b2.a = 6\n\n    t.deepEqual(values, [16, 14, 15, 17, 18])\n})\n\ntest(\"reusing initializers\", () => {\n    class A {\n        @observable accessor a = 3\n        @observable accessor b = this.a + 2\n        @computed\n        get c() {\n            return this.a + this.b\n        }\n        @computed\n        get d() {\n            return this.c + 1\n        }\n    }\n\n    const a = new A()\n    const values: any[] = []\n    mobx.autorun(() => values.push(a.d))\n\n    a.a = 4\n    t.deepEqual(values, [9, 10])\n})\n\ntest(\"enumerability\", () => {\n    class A {\n        @observable accessor a = 1 // enumerable, on proto\n        @computed\n        get b() {\n            return this.a\n        } // non-enumerable, (and, ideally, on proto)\n        @action\n        m() {} // non-enumerable, on proto\n    }\n\n    const a = new A()\n\n    // not initialized yet\n    let ownProps = Object.keys(a)\n    let enumProps: string[] = []\n    for (const key in a) enumProps.push(key)\n\n    t.deepEqual(ownProps, [])\n\n    t.deepEqual(enumProps, [])\n\n    t.equal(\"a\" in a, true)\n    // eslint-disable-next-line\n    t.equal(a.hasOwnProperty(\"a\"), false)\n    // eslint-disable-next-line\n    t.equal(a.hasOwnProperty(\"b\"), false)\n    // eslint-disable-next-line\n    t.equal(a.hasOwnProperty(\"m\"), false)\n\n    t.equal(mobx.isAction(a.m), true)\n\n    // after initialization\n    a.a\n    a.b\n    a.m\n\n    ownProps = Object.keys(a)\n    enumProps = []\n    for (const key in a) enumProps.push(key)\n\n    t.deepEqual(ownProps, [])\n\n    t.deepEqual(enumProps, [])\n\n    t.equal(\"a\" in a, true)\n    // eslint-disable-next-line\n    t.equal(a.hasOwnProperty(\"a\"), false)\n    // eslint-disable-next-line\n    t.equal(a.hasOwnProperty(\"b\"), false)\n    // eslint-disable-next-line\n    t.equal(a.hasOwnProperty(\"m\"), false)\n})\n\n// Re-enable when late initialization is supported in TS\ntest.skip(\"issue 285 (2022.3)\", () => {\n    const { observable, toJS } = mobx\n\n    class Todo {\n        id = 1\n        @observable accessor title: string\n        @observable accessor finished = false\n        @observable accessor childThings = [1, 2, 3]\n        @computed get bla() {\n            return 3\n        }\n        @action someMethod() {}\n        constructor(title: string) {\n            this.title = title\n        }\n    }\n\n    const todo = new Todo(\"Something to do\")\n\n    t.deepEqual(toJS(todo), {\n        id: 1,\n        title: \"Something to do\",\n        finished: false,\n        childThings: [1, 2, 3]\n    })\n})\n\n// Re-enable when late initialization is supported in TS\ntest.skip(\"verify object assign (2022.3) (legacy/field decorator)\", () => {\n    class Todo {\n        @observable accessor title = \"test\"\n        @computed\n        get upperCase() {\n            return this.title.toUpperCase()\n        }\n    }\n\n    t.deepEqual((Object as any).assign({}, new Todo()), {\n        title: \"test\"\n    })\n})\n\ntest(\"373 - fix isObservable for unused computed\", () => {\n    class Bla {\n        ts_53332_workaround: string = \"\"\n\n        @computed\n        get computedVal() {\n            return 3\n        }\n        constructor() {\n            makeObservable(this)\n            t.equal(isObservableProp(this, \"computedVal\"), true)\n            this.computedVal\n            t.equal(isObservableProp(this, \"computedVal\"), true)\n        }\n    }\n\n    new Bla()\n})\n\ntest(\"705 - setter undoing caching (2022.3)\", () => {\n    let recomputes = 0\n    let autoruns = 0\n\n    class Person {\n        @observable accessor name: string = \"\"\n        @observable accessor title: string = \"\"\n\n        // Typescript bug: if fullName is before the getter, the property is defined twice / incorrectly, see #705\n        // set fullName(val) {\n        // \t// Noop\n        // }\n        @computed\n        get fullName() {\n            recomputes++\n            return this.title + \" \" + this.name\n        }\n        // Should also be possible to define the setter _before_ the fullname\n        set fullName(val) {\n            // Noop\n        }\n    }\n\n    let p1 = new Person()\n    p1.name = \"Tom Tank\"\n    p1.title = \"Mr.\"\n\n    t.equal(recomputes, 0)\n    t.equal(autoruns, 0)\n\n    const d1 = autorun(() => {\n        autoruns++\n        p1.fullName\n    })\n\n    const d2 = autorun(() => {\n        autoruns++\n        p1.fullName\n    })\n\n    t.equal(recomputes, 1)\n    t.equal(autoruns, 2)\n\n    p1.title = \"Master\"\n    t.equal(recomputes, 2)\n    t.equal(autoruns, 4)\n\n    d1()\n    d2()\n})\n\ntest(\"@observable.ref (2022.3)\", () => {\n    class A {\n        @observable.ref accessor ref = { a: 3 }\n    }\n\n    const a = new A()\n    t.equal(a.ref.a, 3)\n    t.equal(mobx.isObservable(a.ref), false)\n    t.equal(mobx.isObservableProp(a, \"ref\"), true)\n})\n\ntest(\"@observable.shallow (2022.3)\", () => {\n    class A {\n        @observable.shallow accessor arr = [{ todo: 1 }]\n    }\n\n    const a = new A()\n    const todo2 = { todo: 2 }\n    a.arr.push(todo2)\n    t.equal(mobx.isObservable(a.arr), true)\n    t.equal(mobx.isObservableProp(a, \"arr\"), true)\n    t.equal(mobx.isObservable(a.arr[0]), false)\n    t.equal(mobx.isObservable(a.arr[1]), false)\n    t.equal(a.arr[1] === todo2, true)\n})\n\ntest(\"@observable.shallow - 2 (2022.3)\", () => {\n    class A {\n        @observable.shallow accessor arr: Record<string, any> = { x: { todo: 1 } }\n    }\n\n    const a = new A()\n    const todo2 = { todo: 2 }\n    a.arr.y = todo2\n    t.equal(mobx.isObservable(a.arr), true)\n    t.equal(mobx.isObservableProp(a, \"arr\"), true)\n    t.equal(mobx.isObservable(a.arr.x), false)\n    t.equal(mobx.isObservable(a.arr.y), false)\n    t.equal(a.arr.y === todo2, true)\n})\n\ntest(\"@observable.deep (2022.3)\", () => {\n    class A {\n        @observable.deep accessor arr = [{ todo: 1 }]\n    }\n\n    const a = new A()\n    const todo2 = { todo: 2 }\n    a.arr.push(todo2)\n\n    t.equal(mobx.isObservable(a.arr), true)\n    t.equal(mobx.isObservableProp(a, \"arr\"), true)\n    t.equal(mobx.isObservable(a.arr[0]), true)\n    t.equal(mobx.isObservable(a.arr[1]), true)\n    t.equal(a.arr[1] !== todo2, true)\n    t.equal(isObservable(todo2), false)\n})\n\ntest(\"action.bound binds (2022.3)\", () => {\n    class A {\n        @observable accessor x = 0\n        @action.bound\n        inc(value: number) {\n            this.x += value\n        }\n    }\n\n    const a = new A()\n    const runner = a.inc\n    runner(2)\n\n    t.equal(a.x, 2)\n})\n\ntest(\"action.bound binds property function (2022.3)\", () => {\n    class A {\n        @observable accessor x = 0\n        @action.bound\n        inc = function (value: number) {\n            this.x += value\n        }\n    }\n\n    const a = new A()\n    const runner = a.inc\n    runner(2)\n\n    t.equal(a.x, 2)\n})\n\ntest(\"@computed.equals (2022.3)\", () => {\n    const sameTime = (from: Time, to: Time) => from.hour === to.hour && from.minute === to.minute\n    class Time {\n        constructor(hour: number, minute: number) {\n            makeObservable(this)\n            this.hour = hour\n            this.minute = minute\n        }\n\n        @observable public accessor hour: number\n        @observable public accessor minute: number\n\n        @computed({ equals: sameTime })\n        public get time() {\n            return { hour: this.hour, minute: this.minute }\n        }\n    }\n    const time = new Time(9, 0)\n\n    const changes: Array<{ hour: number; minute: number }> = []\n    const disposeAutorun = autorun(() => changes.push(time.time))\n\n    t.deepEqual(changes, [{ hour: 9, minute: 0 }])\n    time.hour = 9\n    t.deepEqual(changes, [{ hour: 9, minute: 0 }])\n    time.minute = 0\n    t.deepEqual(changes, [{ hour: 9, minute: 0 }])\n    time.hour = 10\n    t.deepEqual(changes, [\n        { hour: 9, minute: 0 },\n        { hour: 10, minute: 0 }\n    ])\n    time.minute = 30\n    t.deepEqual(changes, [\n        { hour: 9, minute: 0 },\n        { hour: 10, minute: 0 },\n        { hour: 10, minute: 30 }\n    ])\n\n    disposeAutorun()\n})\n\ntest(\"1072 - @observable accessor without initial value and observe before first access\", () => {\n    class User {\n        @observable accessor loginCount: number = 0\n    }\n\n    const user = new User()\n    observe(user, \"loginCount\", () => {})\n})\n\ntest(\"unobserved computed reads should warn with requiresReaction enabled\", () => {\n    const consoleWarn = console.warn\n    const warnings: string[] = []\n    console.warn = function (...args) {\n        warnings.push(...args)\n    }\n    try {\n        class A {\n            @observable accessor x = 0\n\n            @computed({ requiresReaction: true })\n            get y() {\n                return this.x * 2\n            }\n        }\n\n        const a = new A()\n\n        a.y\n        const d = mobx.reaction(\n            () => a.y,\n            () => {}\n        )\n        a.y\n        d()\n        a.y\n\n        expect(warnings.length).toEqual(2)\n        expect(warnings[0]).toContain(\n            \"is being read outside a reactive context. Doing a full recompute.\"\n        )\n        expect(warnings[1]).toContain(\n            \"is being read outside a reactive context. Doing a full recompute.\"\n        )\n    } finally {\n        console.warn = consoleWarn\n    }\n})\n\ntest(\"multiple inheritance should work\", () => {\n    class A {\n        @observable accessor x = 1\n    }\n\n    class B extends A {\n        @observable accessor y = 1\n\n        constructor() {\n            super()\n            makeObservable(this)\n        }\n    }\n\n    const obsvKeys = [\n        ...(mobx._getAdministration(new B()) as ObservableArrayAdministration).values_.keys()\n    ]\n    expect(obsvKeys).toEqual([\"x\", \"y\"])\n})\n\n// 19.12.2020 @urugator:\n// All annotated non-observable fields are not writable.\n// All annotated fields of non-plain objects are non-configurable.\n// https://github.com/mobxjs/mobx/pull/2641\ntest.skip(\"actions are reassignable\", () => {\n    // See #1398 and #1545, make actions reassignable to support stubbing\n    class A {\n        @action\n        m1() {}\n        @action.bound\n        m3() {}\n    }\n\n    const a = new A()\n    expect(isAction(a.m1)).toBe(true)\n    expect(isAction(a.m3)).toBe(true)\n    a.m1 = () => {}\n    expect(isAction(a.m1)).toBe(false)\n    a.m3 = () => {}\n    expect(isAction(a.m3)).toBe(false)\n})\n\ntest(\"it should support asyncAction as decorator (2022.3)\", async () => {\n    mobx.configure({ enforceActions: \"observed\" })\n\n    class X {\n        @observable accessor a = 1\n\n        f = mobx.flow(function* f(this: X, initial: number) {\n            this.a = initial // this runs in action\n            this.a += yield Promise.resolve(5) as any\n            this.a = this.a * 2\n            return this.a\n        })\n    }\n\n    const x = new X()\n\n    expect(await x.f(3)).toBe(16)\n})\n\ntest(\"toJS bug #1413 (2022.3)\", () => {\n    class X {\n        @observable\n        accessor test = {\n            test1: 1\n        }\n    }\n\n    const x = new X()\n    const res = mobx.toJS(x.test) as any\n    expect(res).toEqual({ test1: 1 })\n    expect(res.__mobxDidRunLazyInitializers).toBe(undefined)\n})\n\ntest(\"#2159 - computed property keys\", () => {\n    const testSymbol = Symbol(\"test symbol\")\n    const testString = \"testString\"\n\n    class TestClass {\n        @observable accessor [testSymbol] = \"original symbol value\"\n        @observable accessor [testString] = \"original string value\"\n    }\n\n    const o = new TestClass()\n\n    const events: any[] = []\n    observe(o, testSymbol, ev => events.push(ev.newValue, ev.oldValue))\n    observe(o, testString, ev => events.push(ev.newValue, ev.oldValue))\n\n    runInAction(() => {\n        o[testSymbol] = \"new symbol value\"\n        o[testString] = \"new string value\"\n    })\n\n    t.deepEqual(events, [\n        \"new symbol value\", // new symbol\n        \"original symbol value\", // original symbol\n        \"new string value\", // new string\n        \"original string value\" // original string\n    ])\n})\n\ntest(`decorated field can be inherited, but doesn't inherite the effect of decorator`, () => {\n    class Store {\n        @action\n        action = () => {\n            return\n        }\n    }\n\n    class SubStore extends Store {\n        action = () => {\n            // should not be a MobX action\n            return\n        }\n    }\n\n    const store = new Store()\n    expect(isAction(store.action)).toBe(true)\n\n    const subStore = new SubStore()\n    expect(isAction(subStore.action)).toBe(false)\n})\n"
  },
  {
    "path": "packages/mobx/__tests__/decorators_20223/tsconfig.json",
    "content": "{\n    \"extends\": [\"../../tsconfig.json\", \"../../../../tsconfig.test.json\"],\n    \"compilerOptions\": {\n        \"target\": \"ES6\",\n        \"experimentalDecorators\": false,\n        \"useDefineForClassFields\": true,\n\n        \"rootDir\": \"../../\"\n    },\n    \"exclude\": [\"__tests__\"],\n    \"include\": [\"./\", \"../../src\"] // [\"../../src\", \"./\"]\n}\n"
  },
  {
    "path": "packages/mobx/__tests__/mixed-versions/mixed-versions.js",
    "content": "const fs = require(\"fs\")\nconst child_process = require(\"child_process\")\n\nif (!fs.existsSync(__dirname + \"/../../dist/mobx.umd.development.js\")) {\n    // make sure the minified build exists\n    child_process.execSync(\"yarn build\", { stdio: \"inherit\" })\n}\n\nconst mobx1 = require(\"../../dist\")\n/* istanbul ignore next */\nconst mobx2 = require(\"../../dist/mobx.umd.development.js\")\n\ntest(\"two versions should not work together by default\", () => {\n    expect(global.__mobxInstanceCount).toBe(2)\n    expect(global.__mobxGlobals).not.toBe(undefined)\n\n    const a = mobx1.observable({\n        x: 1\n    })\n    const b = mobx2.observable({\n        x: 3\n    })\n\n    const values = []\n    const d1 = mobx1.autorun(() => {\n        values.push(b.x)\n    })\n    const d2 = mobx2.autorun(() => {\n        values.push(a.x)\n    })\n\n    a.x = 2\n    b.x = 4\n\n    d1()\n    d2()\n\n    expect(values).toEqual([3, 1, 2, 4])\n})\n\ntest(\"two versions should not work together if state is isolated\", () => {\n    mobx1.configure({ isolateGlobalState: true })\n    expect(global.__mobxInstanceCount).toBe(1)\n    expect(global.__mobxGlobals).not.toBe(undefined)\n\n    const a = mobx1.observable({\n        x: 1\n    })\n    const b = mobx2.observable({\n        x: 3\n    })\n\n    const values = []\n    const d1 = mobx1.autorun(() => {\n        values.push(b.x)\n    })\n    const d2 = mobx2.autorun(() => {\n        values.push(a.x)\n    })\n\n    a.x = 2\n    b.x = 4\n\n    d1()\n    d2()\n\n    expect(values).toEqual([3, 1])\n})\n\ntest(\"global state should disappear if all imports are isolated\", () => {\n    mobx2.configure({ isolateGlobalState: true })\n    expect(global.__mobxInstanceCount).toBe(0)\n    expect(global.__mobxGlobals).toBe(undefined)\n    const a = mobx1.observable({\n        x: 1\n    })\n    const b = mobx2.observable({\n        x: 3\n    })\n\n    const values = []\n    const d1 = mobx1.autorun(() => {\n        values.push(b.x)\n    })\n    const d2 = mobx2.autorun(() => {\n        values.push(a.x)\n    })\n\n    a.x = 2\n    b.x = 4\n\n    d1()\n    d2()\n\n    expect(values).toEqual([3, 1])\n})\n"
  },
  {
    "path": "packages/mobx/__tests__/mixed-versions/state-sharing.js",
    "content": "\"use strict\"\nconst child_process = require(\"child_process\")\n\nfunction testOutput(cmd, expected) {\n    it(\"Global state sharing: \" + cmd, done => {\n        child_process.exec(\"node -e '\" + cmd + \"'\", { cwd: __dirname }, (e, stdout, stderr) => {\n            if (e) {\n                if (!expected) done.fail(e)\n                else {\n                    expect(\"\" + e).toContain(expected)\n                    done()\n                }\n            } else {\n                expect(stdout.toString()).toBe(\"\")\n                expect(stderr.toString()).toBe(expected)\n                done()\n            }\n        })\n    })\n}\n\ndescribe(\"it should handle multiple instances with the correct warnings\", () => {\n    testOutput(\n        'require(\"../../dist\");global.__mobxGlobals.version = -1; require(\"../../dist/mobx.umd.development.js\")',\n        \"There are multiple, different versions of MobX active. Make sure MobX is loaded only once\"\n    )\n    testOutput(\n        'const m = require(\"../../dist/\"); global.__mobxGlobals.version = -1; m.configure({isolateGlobalState: true});require(\"../../dist/mobx.umd.development.js\").configure({isolateGlobalState: true})',\n        \"\"\n    )\n    // testOutput(\n    //     'require(\"../../\");global.__mobxGlobals.version = -1;require(\"../../mobx.umd.development.js\").configure({isolateGlobalState: true})',\n    //     \"\"\n    // )\n    testOutput(\n        'const m = require(\"../../dist/\");global.__mobxGlobals.version = -1;m.configure({isolateGlobalState: true});require(\"../../dist/mobx.umd.development.js\")',\n        \"\"\n    )\n})\n"
  },
  {
    "path": "packages/mobx/__tests__/perf/index.js",
    "content": "const start = Date.now()\nconst mkdirp = require(\"mkdirp\")\n\nconst ver = process.argv[2]\nif (!ver || !ver.match(/legacy|proxy/)) {\n    throw new Error(\"specify version to perf test as (legacy|proxy)\")\n}\n\nif (process.env.PERSIST) {\n    const fs = require(\"fs\")\n    const path = require(\"path\")\n    const logFile = path.resolve(`${__dirname}/../../perf_report/${ver}.txt`)\n    mkdirp.sync(path.dirname(logFile))\n    // clear previous results\n    if (fs.existsSync(logFile)) fs.unlinkSync(logFile)\n\n    exports.logMeasurement = function (msg) {\n        console.log(msg)\n        fs.appendFileSync(logFile, \"\\n\" + msg, \"utf8\")\n    }\n} else {\n    exports.logMeasurement = function (msg) {\n        console.log(msg)\n    }\n}\n\nconst perf = require(\"./perf.js\")\nperf(ver)\n\n// This test runs last..\nrequire(\"tape\")(t => {\n    exports.logMeasurement(\n        \"\\n\\nCompleted performance suite in \" + (Date.now() - start) / 1000 + \" sec.\"\n    )\n    t.end()\n})\n"
  },
  {
    "path": "packages/mobx/__tests__/perf/perf.js",
    "content": "const test = require(\"tape\")\nconst log = require(\"./index.js\").logMeasurement\n\nfunction gc() {\n    if (typeof global.gc === \"function\") global.gc()\n}\n\nfunction voidObserver() {\n    // nothing, nada, noppes.\n}\n\nmodule.exports = function runForVersion(version) {\n    /*\nresults of this test:\n300/40000 mseconds on netbook (AMD c60 processor, same test is on Intel i7 3770 ~10 times faster)\n220/37000 after removing forEach\n140/30000 after not using (un)shift / pop / push\n186/113 after remove filter/length call to detect whether depencies are stable. 300 times faster. w00t.\n\n*/\n    const mobx = require(`../../dist/mobx.cjs.production.min.js`)\n    if (version === \"legacy\") {\n        mobx.configure({ useProxies: false })\n    }\n    const observable = mobx.observable\n    const computed = mobx.computed\n\n    test(`${version} - one observes ten thousand that observe one`, function (t) {\n        gc()\n        const a = observable.box(2)\n\n        // many observers that listen to one..\n        const observers = []\n        for (let i = 0; i < 10000; i++) {\n            ;(function (idx) {\n                observers.push(\n                    computed(function () {\n                        return a.get() * idx\n                    })\n                )\n            })(i)\n        }\n\n        // let bCalcs = 0\n        // one observers that listens to many..\n        const b = computed(function () {\n            let res = 0\n            for (let i = 0; i < observers.length; i++) res += observers[i].get()\n            // bCalcs += 1\n            return res\n        })\n\n        const start = now()\n\n        mobx.observe(b, voidObserver, true) // start observers\n        t.equal(99990000, b.get())\n        const initial = now()\n\n        a.set(3)\n        t.equal(149985000, b.get()) // yes, I verified ;-).\n        //t.equal(2, bCalcs);\n        const end = now()\n\n        log(\n            \"One observers many observes one - Started/Updated in \" +\n                (initial - start) +\n                \"/\" +\n                (end - initial) +\n                \" ms.\"\n        )\n        t.end()\n    })\n\n    test(`${version} - five hundrend properties that observe their sibling`, function (t) {\n        gc()\n        const observables = [observable.box(1)]\n        for (let i = 0; i < 500; i++) {\n            ;(function (idx) {\n                observables.push(\n                    computed(function () {\n                        return observables[idx].get() + 1\n                    })\n                )\n            })(i)\n        }\n\n        const start = now()\n\n        const last = observables[observables.length - 1]\n        mobx.observe(last, voidObserver)\n        t.equal(501, last.get())\n        const initial = now()\n\n        observables[0].set(2)\n        t.equal(502, last.get())\n        const end = now()\n\n        log(\n            \"500 props observing sibling -  Started/Updated in \" +\n                (initial - start) +\n                \"/\" +\n                (end - initial) +\n                \" ms.\"\n        )\n        t.end()\n    })\n\n    test(`${version} - late dependency change`, function (t) {\n        gc()\n        const values = []\n        for (let i = 0; i < 100; i++) values.push(observable.box(0))\n\n        const sum = computed(function () {\n            let sum = 0\n            for (let i = 0; i < 100; i++) sum += values[i].get()\n            return sum\n        })\n\n        mobx.observe(sum, voidObserver, true)\n\n        const start = new Date()\n\n        for (let i = 0; i < 10000; i++) values[99].set(i)\n\n        t.equal(sum.get(), 9999)\n        log(\"Late dependency change - Updated in \" + (new Date() - start) + \"ms.\")\n        t.end()\n    })\n\n    test(`${version} - lots of unused computables`, function (t) {\n        gc()\n        const a = observable.box(1)\n\n        // many observers that listen to one..\n        const observers = []\n        for (let i = 0; i < 10000; i++) {\n            ;(function (idx) {\n                observers.push(\n                    computed(function () {\n                        return a.get() * idx\n                    })\n                )\n            })(i)\n        }\n\n        // one observers that listens to many..\n        const b = computed(function () {\n            let res = 0\n            for (let i = 0; i < observers.length; i++) res += observers[i].get()\n            return res\n        })\n\n        let sum = 0\n        const subscription = mobx.observe(\n            b,\n            function (e) {\n                sum = e.newValue\n            },\n            true\n        )\n\n        t.equal(sum, 49995000)\n\n        // unsubscribe, nobody should listen to a() now!\n        subscription()\n\n        const start = now()\n\n        a.set(3)\n        t.equal(sum, 49995000) // unchanged!\n\n        const end = now()\n\n        log(\"Unused computables -   Updated in \" + (end - start) + \" ms.\")\n        t.end()\n    })\n\n    test(`${version} - many unreferenced observables`, function (t) {\n        gc()\n        const a = observable.box(3)\n        const b = observable.box(6)\n        const c = observable.box(7)\n        const d = computed(function () {\n            return a.get() * b.get() * c.get()\n        })\n        t.equal(d.get(), 126)\n        const start = now()\n        for (let i = 0; i < 10000; i++) {\n            c.set(i)\n            d.get()\n        }\n        const end = now()\n\n        log(\"Unused observables -  Updated in \" + (end - start) + \" ms.\")\n\n        t.end()\n    })\n\n    test(`${version} - array.es2023 findLastIndex methods`, function (t) {\n        gc()\n        let aCalc = 0\n        let bCalc = 0\n        const ar = observable([0])\n        const findLastIndexOfZero = computed(function () {\n            aCalc++\n            return ar.findLastIndex(x => x === 0)\n        })\n        const lastIndexOfZero = computed(function () {\n            bCalc++\n            return ar.lastIndexOf(0)\n        })\n        mobx.observe(findLastIndexOfZero, voidObserver, true)\n        mobx.observe(lastIndexOfZero, voidObserver, true)\n\n        const start = now()\n\n        t.equal(1, aCalc)\n        t.equal(1, bCalc)\n        for (let i = 1; i < 10000; i++) ar.push(i)\n\n        t.equal(0, lastIndexOfZero.get())\n        t.equal(0, findLastIndexOfZero.get())\n        t.equal(10000, aCalc)\n        t.equal(10000, bCalc)\n\n        const end = now()\n\n        log(\"Array findLastIndex loop -  Updated in \" + (end - start) + \" ms.\")\n        t.end()\n    })\n\n    test(`${version} - array reduce`, function (t) {\n        gc()\n        let aCalc = 0\n        const ar = observable([])\n        const b = observable.box(1)\n\n        const sum = computed(function () {\n            aCalc++\n            return ar.reduce(function (a, c) {\n                return a + c * b.get()\n            }, 0)\n        })\n        mobx.observe(sum, voidObserver)\n\n        const start = now()\n\n        for (let i = 0; i < 1000; i++) ar.push(i)\n\n        t.equal(499500, sum.get())\n        t.equal(1001, aCalc)\n        aCalc = 0\n\n        const initial = now()\n\n        for (let i = 0; i < 1000; i++) ar[i] = ar[i] * 2\n        b.set(2)\n\n        t.equal(1998000, sum.get())\n        t.equal(1000, aCalc)\n\n        const end = now()\n\n        log(\n            \"Array reduce -  Started/Updated in \" +\n                (initial - start) +\n                \"/\" +\n                (end - initial) +\n                \" ms.\"\n        )\n        t.end()\n    })\n\n    test(`${version} - array classic loop`, function (t) {\n        gc()\n        const ar = observable([])\n        let aCalc = 0\n        const b = observable.box(1)\n        const sum = computed(function () {\n            let s = 0\n            aCalc++\n            for (let i = 0; i < ar.length; i++) s += ar[i] * b.get()\n            return s\n        })\n        mobx.observe(sum, voidObserver, true) // calculate\n\n        const start = now()\n\n        t.equal(1, aCalc)\n        for (let i = 0; i < 1000; i++) ar.push(i)\n\n        t.equal(499500, sum.get())\n        t.equal(1001, aCalc)\n\n        const initial = now()\n        aCalc = 0\n\n        for (let i = 0; i < 1000; i++) ar[i] = ar[i] * 2\n        b.set(2)\n\n        t.equal(1998000, sum.get())\n        t.equal(1000, aCalc)\n\n        const end = now()\n\n        log(\n            \"Array loop -  Started/Updated in \" + (initial - start) + \"/\" + (end - initial) + \" ms.\"\n        )\n        t.end()\n    })\n\n    function order_system_helper(t, usebatch, keepObserving) {\n        gc()\n        t.equal(mobx._isComputingDerivation(), false)\n        const orders = observable([])\n        const vat = observable.box(2)\n\n        const totalAmount = computed(function () {\n            let sum = 0,\n                l = orders.length\n            for (let i = 0; i < l; i++) sum += orders[i].total.get()\n            return sum\n        })\n\n        function OrderLine(order, price, amount) {\n            this.price = observable.box(price)\n            this.amount = observable.box(amount)\n            this.total = computed(\n                function () {\n                    return order.vat.get() * this.price.get() * this.amount.get()\n                },\n                { context: this }\n            )\n        }\n\n        function Order(includeVat) {\n            this.includeVat = observable.box(includeVat)\n            this.lines = observable([])\n\n            this.vat = computed(\n                function () {\n                    if (this.includeVat.get()) return vat.get()\n                    return 1\n                },\n                { context: this }\n            )\n\n            this.total = computed(\n                function () {\n                    return this.lines.reduce(function (acc, order) {\n                        return acc + order.total.get()\n                    }, 0)\n                },\n                { context: this }\n            )\n        }\n\n        let disp\n        if (keepObserving) disp = mobx.observe(totalAmount, voidObserver)\n\n        const start = now()\n\n        function setup() {\n            for (let i = 0; i < 100; i++) {\n                const c = new Order(i % 2 == 0)\n                orders.push(c)\n                for (let j = 0; j < 100; j++) c.lines.unshift(new OrderLine(c, 5, 5))\n            }\n        }\n\n        if (usebatch) mobx.transaction(setup)\n        else setup()\n\n        t.equal(totalAmount.get(), 375000)\n\n        const initial = now()\n\n        function update() {\n            for (let i = 0; i < 50; i++) orders[i].includeVat.set(!orders[i].includeVat.get())\n            vat.set(3)\n        }\n\n        if (usebatch) mobx.transaction(update)\n        else update()\n\n        t.equal(totalAmount.get(), 500000)\n\n        if (keepObserving) disp()\n\n        const end = now()\n        log(\n            \"Order system batched: \" +\n                usebatch +\n                \" tracked: \" +\n                keepObserving +\n                \"  Started/Updated in \" +\n                (initial - start) +\n                \"/\" +\n                (end - initial) +\n                \" ms.\"\n        )\n\n        t.end()\n    }\n\n    test(`${version} - order system observed`, function (t) {\n        order_system_helper(t, false, true)\n    })\n\n    test(`${version} - order system batched observed`, function (t) {\n        order_system_helper(t, true, true)\n    })\n\n    test(`${version} - order system lazy`, function (t) {\n        order_system_helper(t, false, false)\n    })\n\n    test(`${version} - order system batched lazy`, function (t) {\n        order_system_helper(t, true, false)\n    })\n\n    test(`${version} - create array`, function (t) {\n        gc()\n        const a = []\n        for (let i = 0; i < 1000; i++) a.push(i)\n        const start = now()\n        for (let i = 0; i < 1000; i++) observable.array(a)\n        log(\"\\nCreate array -  Created in \" + (now() - start) + \"ms.\")\n        t.end()\n    })\n\n    test(`${version} - create array (fast)`, function (t) {\n        gc()\n        const a = []\n        for (let i = 0; i < 1000; i++) a.push(i)\n        const start = now()\n        for (let i = 0; i < 1000; i++) mobx.observable.array(a, { deep: false })\n        log(\"\\nCreate array (non-recursive)  Created in \" + (now() - start) + \"ms.\")\n        t.end()\n    })\n\n    test(`${version} - observe and dispose`, t => {\n        gc()\n\n        const start = now()\n        const a = mobx.observable.box(1)\n        const observers = []\n        const MAX = 50000\n\n        for (let i = 0; i < MAX * 2; i++) observers.push(mobx.autorun(() => a.get()))\n        a.set(2)\n        // favorable order\n        // + unfavorable order\n        for (let i = 0; i < MAX; i++) {\n            observers[i]()\n            observers[observers.length - 1 - i]()\n        }\n\n        log(\"Observable with many observers  + dispose: \" + (now() - start) + \"ms\")\n        t.end()\n    })\n\n    test(`${version} - sort`, t => {\n        gc()\n\n        function Item(a, b, c) {\n            mobx.extendObservable(this, {\n                a: a,\n                b: b,\n                c: c,\n                get d() {\n                    return this.a + this.b + this.c\n                }\n            })\n        }\n        const items = mobx.observable([])\n\n        function sortFn(l, r) {\n            items.length // screw all optimizations!\n            l.d\n            r.d\n            if (l.a > r.a) return 1\n            if (l.a < r.a) return -1\n            if (l.b > r.b) return 1\n            if (l.b < r.b) return -1\n            if (l.c > r.c) return 1\n            if (l.c < r.c) return -1\n            return 0\n        }\n\n        const sorted = mobx.computed(() => {\n            items.slice().sort(sortFn)\n        })\n\n        let start = now()\n        const MAX = 100000\n\n        const ar = mobx.autorun(() => sorted.get())\n\n        mobx.transaction(() => {\n            for (let i = 0; i < MAX; i++) items.push(new Item(i % 10, i % 3, i % 7))\n        })\n\n        log(\"expensive sort: created \" + (now() - start))\n        start = now()\n\n        for (let i = 0; i < 5; i++) {\n            items[i * 1000].a = 7\n            items[i * 1100].b = 5\n            items[i * 1200].c = 9\n        }\n\n        log(\"expensive sort: updated \" + (now() - start))\n        start = now()\n\n        ar()\n\n        log(\"expensive sort: disposed \" + (now() - start))\n\n        const plain = mobx.toJS(items, false)\n        t.equal(plain.length, MAX)\n\n        start = now()\n        for (let i = 0; i < 5; i++) {\n            plain[i * 1000].a = 7\n            plain.sort(sortFn)\n            plain[i * 1100].b = 5\n            plain.sort(sortFn)\n            plain[i * 1200].c = 9\n            plain.sort(sortFn)\n        }\n        log(\"native plain sort: updated \" + (now() - start))\n\n        t.end()\n    })\n\n    test(`${version} - computed temporary memoization`, t => {\n        \"use strict\"\n        gc()\n        const computeds = []\n        for (let i = 0; i < 40; i++) {\n            computeds.push(\n                mobx.computed(() => (i ? computeds[i - 1].get() + computeds[i - 1].get() : 1))\n            )\n        }\n        const start = now()\n        t.equal(computeds[27].get(), 134217728)\n\n        log(\"computed memoization \" + (now() - start) + \"ms\")\n        t.end()\n    })\n\n    test(`${version} - Set: initializing`, function (t) {\n        gc()\n        const iterationsCount = 100000\n        let i\n\n        const start = Date.now()\n        for (i = 0; i < iterationsCount; i++) {\n            mobx.observable.set()\n        }\n        const end = Date.now()\n        log(\"Initilizing \" + iterationsCount + \" maps: \" + (end - start) + \" ms.\")\n        t.end()\n    })\n\n    test(`${version} - Set: setting and deleting properties`, function (t) {\n        gc()\n        const iterationsCount = 1000\n        const propertiesCount = 10000\n        const set = mobx.observable.set()\n        let i\n        let p\n\n        const start = Date.now()\n        for (i = 0; i < iterationsCount; i++) {\n            for (p = 0; p < propertiesCount; p++) {\n                set.add(\"\" + p)\n            }\n            for (p = 0; p < propertiesCount; p++) {\n                set.delete(\"\" + p)\n            }\n        }\n        const end = Date.now()\n\n        log(\n            \"Setting and deleting \" +\n                propertiesCount +\n                \" set properties \" +\n                iterationsCount +\n                \" times: \" +\n                (end - start) +\n                \" ms.\"\n        )\n        t.end()\n    })\n\n    test(`${version} - Set: looking up properties`, function (t) {\n        gc()\n        const iterationsCount = 1000\n        const propertiesCount = 10000\n        const set = mobx.observable.set()\n        let i\n        let p\n\n        for (p = 0; p < propertiesCount; p++) {\n            set.add(\"\" + p)\n        }\n\n        const start = Date.now()\n        for (i = 0; i < iterationsCount; i++) {\n            for (p = 0; p < propertiesCount; p++) {\n                set.has(\"\" + p)\n            }\n        }\n        const end = Date.now()\n\n        log(\n            \"Looking up \" +\n                propertiesCount +\n                \" set properties \" +\n                iterationsCount +\n                \" times: \" +\n                (end - start) +\n                \" ms.\"\n        )\n        t.end()\n    })\n\n    test(`${version} - Set: iterator helpers`, function (t) {\n        gc()\n        const iterationsCount = 1000\n        const propertiesCount = 10000\n        const set = mobx.observable.set()\n        let i\n        let p\n\n        for (p = 0; p < propertiesCount; p++) {\n            set.add(\"\" + p)\n        }\n\n        const start = Date.now()\n        for (i = 0; i < iterationsCount; i++) {\n            set.entries().take(1)\n        }\n        const end = Date.now()\n\n        log(\n            \"Single take out of\" +\n                propertiesCount +\n                \" set properties \" +\n                iterationsCount +\n                \" times: \" +\n                (end - start) +\n                \" ms.\"\n        )\n        t.end()\n    })\n\n    test(`${version} - Set: conversion to array`, function (t) {\n        gc()\n        const iterationsCount = 1000\n        const propertiesCount = 10000\n        const set = mobx.observable.set()\n        let i\n        let p\n\n        for (p = 0; p < propertiesCount; p++) {\n            set.add(\"\" + p)\n        }\n\n        const start = Date.now()\n        for (i = 0; i < iterationsCount; i++) {\n            Array.from(set.keys())\n            Array.from(set.values())\n            Array.from(set.entries())\n            ;[...set]\n        }\n        const end = Date.now()\n\n        log(\n            \"Converting \" +\n                propertiesCount +\n                \" set properties into an array\" +\n                iterationsCount +\n                \" times: \" +\n                (end - start) +\n                \" ms.\"\n        )\n        t.end()\n    })\n\n    test(`${version} - Map: initializing`, function (t) {\n        gc()\n        const iterationsCount = 100000\n        let i\n\n        const start = Date.now()\n        for (i = 0; i < iterationsCount; i++) {\n            mobx.observable.map()\n        }\n        const end = Date.now()\n        log(\"Initilizing \" + iterationsCount + \" maps: \" + (end - start) + \" ms.\")\n        t.end()\n    })\n\n    test(`${version} - Map: looking up properties`, function (t) {\n        gc()\n        const iterationsCount = 1000\n        const propertiesCount = 100\n        const map = mobx.observable.map()\n        let i\n        let p\n\n        for (p = 0; p < propertiesCount; p++) {\n            map.set(\"\" + p, p)\n        }\n\n        const start = Date.now()\n        for (i = 0; i < iterationsCount; i++) {\n            for (p = 0; p < propertiesCount; p++) {\n                map.get(\"\" + p)\n            }\n        }\n        const end = Date.now()\n\n        log(\n            \"Looking up \" +\n                propertiesCount +\n                \" map properties \" +\n                iterationsCount +\n                \" times: \" +\n                (end - start) +\n                \" ms.\"\n        )\n        t.end()\n    })\n\n    test(`${version} - Map: setting and deleting properties`, function (t) {\n        gc()\n        const iterationsCount = 1000\n        const propertiesCount = 100\n        const map = mobx.observable.map()\n        let i\n        let p\n\n        const start = Date.now()\n        for (i = 0; i < iterationsCount; i++) {\n            for (p = 0; p < propertiesCount; p++) {\n                map.set(\"\" + p, i)\n            }\n            for (p = 0; p < propertiesCount; p++) {\n                map.delete(\"\" + p, i)\n            }\n        }\n        const end = Date.now()\n\n        log(\n            \"Setting and deleting \" +\n                propertiesCount +\n                \" map properties \" +\n                iterationsCount +\n                \" times: \" +\n                (end - start) +\n                \" ms.\"\n        )\n        t.end()\n    })\n}\n\nfunction now() {\n    return +new Date()\n}\n"
  },
  {
    "path": "packages/mobx/__tests__/tsconfig.json",
    "content": "{\n    \"extends\": \"../../../tsconfig.test.json\"\n}\n"
  },
  {
    "path": "packages/mobx/__tests__/v4/base/__snapshots__/array.js.snap",
    "content": "// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing\n\nexports[`very long arrays can be safely passed to nativeArray.concat #2379 1`] = `\n[MockFunction] {\n  \"calls\": [\n    [\n      \"[mobx.array] Attempt to read an array index (10000) that is out of bounds (10000). Please check length first. Out of bound indices will not be tracked by MobX\",\n    ],\n  ],\n  \"results\": [\n    {\n      \"type\": \"return\",\n      \"value\": undefined,\n    },\n  ],\n}\n`;\n"
  },
  {
    "path": "packages/mobx/__tests__/v4/base/__snapshots__/extras.js.snap",
    "content": "// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing\n\nexports[`spy 1 1`] = `\n[\n  {\n    \"debugObjectName\": \"ObservableValue@6\",\n    \"newValue\": 4,\n    \"observableKind\": \"value\",\n    \"oldValue\": 3,\n    \"spyReportStart\": true,\n    \"type\": \"update\",\n  },\n  {\n    \"debugObjectName\": \"ComputedValue@7\",\n    \"newValue\": 8,\n    \"observableKind\": \"computed\",\n    \"oldValue\": 6,\n    \"type\": \"update\",\n  },\n  {\n    \"name\": \"Autorun@8\",\n    \"spyReportStart\": true,\n    \"type\": \"reaction\",\n  },\n  {\n    \"spyReportEnd\": true,\n    \"type\": \"report-end\",\n  },\n  {\n    \"spyReportEnd\": true,\n    \"type\": \"report-end\",\n  },\n]\n`;\n"
  },
  {
    "path": "packages/mobx/__tests__/v4/base/__snapshots__/makereactive.js.snap",
    "content": "// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing\n\nexports[`computed value 1`] = `\"ComputedValue@1[() => 3]\"`;\n"
  },
  {
    "path": "packages/mobx/__tests__/v4/base/__snapshots__/object-api.js.snap",
    "content": "// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing\n\nexports[`observe & intercept 1`] = `\n[\n  {\n    \"intercept\": {\n      \"name\": \"b\",\n      \"newValue\": {\n        \"title\": \"get tea\",\n      },\n      \"object\": {\n        \"a\": {\n          \"title\": \"get coffee\",\n        },\n      },\n      \"type\": \"add\",\n    },\n  },\n  {\n    \"intercept\": {\n      \"name\": \"a\",\n      \"object\": {\n        \"a\": {\n          \"title\": \"get coffee\",\n        },\n      },\n      \"type\": \"remove\",\n    },\n  },\n]\n`;\n\nexports[`observe & intercept 2`] = `\n[\n  {\n    \"observe\": {\n      \"debugObjectName\": \"TestObject\",\n      \"name\": \"b\",\n      \"newValue\": {\n        \"title\": \"get tea\",\n      },\n      \"object\": {\n        \"b\": {\n          \"title\": \"get tea\",\n        },\n      },\n      \"observableKind\": \"object\",\n      \"type\": \"add\",\n    },\n  },\n  {\n    \"observe\": {\n      \"debugObjectName\": \"TestObject\",\n      \"name\": \"a\",\n      \"object\": {\n        \"b\": {\n          \"title\": \"get tea\",\n        },\n      },\n      \"observableKind\": \"object\",\n      \"oldValue\": {\n        \"title\": \"get coffee\",\n      },\n      \"type\": \"remove\",\n    },\n  },\n]\n`;\n"
  },
  {
    "path": "packages/mobx/__tests__/v4/base/__snapshots__/observables.js.snap",
    "content": "// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing\n\nexports[`delay autorun until end of transaction 1`] = `\n[\n  {\n    \"debugObjectName\": \"ObservableObject@1\",\n    \"name\": \"a\",\n    \"newValue\": 3,\n    \"observableKind\": \"object\",\n    \"oldValue\": 2,\n    \"spyReportStart\": true,\n    \"type\": \"update\",\n  },\n  {\n    \"spyReportEnd\": true,\n    \"type\": \"report-end\",\n  },\n  {\n    \"debugObjectName\": \"ObservableObject@1\",\n    \"name\": \"a\",\n    \"newValue\": 4,\n    \"observableKind\": \"object\",\n    \"oldValue\": 3,\n    \"spyReportStart\": true,\n    \"type\": \"update\",\n  },\n  {\n    \"spyReportEnd\": true,\n    \"type\": \"report-end\",\n  },\n  \"end1\",\n  {\n    \"debugObjectName\": \"ObservableObject@1\",\n    \"name\": \"a\",\n    \"newValue\": 5,\n    \"observableKind\": \"object\",\n    \"oldValue\": 4,\n    \"spyReportStart\": true,\n    \"type\": \"update\",\n  },\n  {\n    \"spyReportEnd\": true,\n    \"type\": \"report-end\",\n  },\n  \"end2\",\n  {\n    \"name\": \"test\",\n    \"spyReportStart\": true,\n    \"type\": \"reaction\",\n  },\n  \"auto\",\n  \"calc y\",\n  {\n    \"debugObjectName\": \"ObservableObject@1.b\",\n    \"newValue\": 5,\n    \"observableKind\": \"computed\",\n    \"oldValue\": CaughtException {\n      \"cause\": null,\n    },\n    \"type\": \"update\",\n  },\n  {\n    \"spyReportEnd\": true,\n    \"type\": \"report-end\",\n  },\n  \"post trans1\",\n  {\n    \"debugObjectName\": \"ObservableObject@1\",\n    \"name\": \"a\",\n    \"newValue\": 6,\n    \"observableKind\": \"object\",\n    \"oldValue\": 5,\n    \"spyReportStart\": true,\n    \"type\": \"update\",\n  },\n  \"calc y\",\n  {\n    \"debugObjectName\": \"ObservableObject@1.b\",\n    \"newValue\": 6,\n    \"observableKind\": \"computed\",\n    \"oldValue\": 5,\n    \"type\": \"update\",\n  },\n  {\n    \"name\": \"test\",\n    \"spyReportStart\": true,\n    \"type\": \"reaction\",\n  },\n  \"auto\",\n  {\n    \"spyReportEnd\": true,\n    \"type\": \"report-end\",\n  },\n  {\n    \"spyReportEnd\": true,\n    \"type\": \"report-end\",\n  },\n  \"post trans2\",\n  {\n    \"debugObjectName\": \"ObservableObject@1\",\n    \"name\": \"a\",\n    \"newValue\": 3,\n    \"observableKind\": \"object\",\n    \"oldValue\": 6,\n    \"spyReportStart\": true,\n    \"type\": \"update\",\n  },\n  {\n    \"spyReportEnd\": true,\n    \"type\": \"report-end\",\n  },\n  \"post trans3\",\n]\n`;\n\nexports[`issue 50 1`] = `\n[\n  \"auto\",\n  \"calc c\",\n  \"transstart\",\n  {\n    \"debugObjectName\": \"ObservableObject@1\",\n    \"name\": \"a\",\n    \"newValue\": false,\n    \"observableKind\": \"object\",\n    \"oldValue\": true,\n    \"spyReportStart\": true,\n    \"type\": \"update\",\n  },\n  {\n    \"spyReportEnd\": true,\n    \"type\": \"report-end\",\n  },\n  {\n    \"debugObjectName\": \"ObservableObject@1\",\n    \"name\": \"b\",\n    \"newValue\": true,\n    \"observableKind\": \"object\",\n    \"oldValue\": false,\n    \"spyReportStart\": true,\n    \"type\": \"update\",\n  },\n  {\n    \"spyReportEnd\": true,\n    \"type\": \"report-end\",\n  },\n  \"transpreend\",\n  {\n    \"name\": \"ar\",\n    \"spyReportStart\": true,\n    \"type\": \"reaction\",\n  },\n  \"auto\",\n  \"calc c\",\n  {\n    \"debugObjectName\": \"ObservableObject@1.c\",\n    \"newValue\": true,\n    \"observableKind\": \"computed\",\n    \"oldValue\": false,\n    \"type\": \"update\",\n  },\n  {\n    \"spyReportEnd\": true,\n    \"type\": \"report-end\",\n  },\n  \"transpostend\",\n]\n`;\n\nexports[`verify transaction events 1`] = `\n[\n  \"auto\",\n  \"calc c\",\n  \"transstart\",\n  {\n    \"debugObjectName\": \"ObservableObject@1\",\n    \"name\": \"b\",\n    \"newValue\": 2,\n    \"observableKind\": \"object\",\n    \"oldValue\": 1,\n    \"spyReportStart\": true,\n    \"type\": \"update\",\n  },\n  {\n    \"spyReportEnd\": true,\n    \"type\": \"report-end\",\n  },\n  \"transpreend\",\n  \"calc c\",\n  {\n    \"debugObjectName\": \"ObservableObject@1.c\",\n    \"newValue\": 2,\n    \"observableKind\": \"computed\",\n    \"oldValue\": 1,\n    \"type\": \"update\",\n  },\n  {\n    \"name\": \"ar\",\n    \"spyReportStart\": true,\n    \"type\": \"reaction\",\n  },\n  \"auto\",\n  {\n    \"spyReportEnd\": true,\n    \"type\": \"report-end\",\n  },\n  \"transpostend\",\n]\n`;\n"
  },
  {
    "path": "packages/mobx/__tests__/v4/base/__snapshots__/spy.js.snap",
    "content": "// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing\n\nexports[`spy error 1`] = `\n[\n  {\n    \"name\": \"autorun\",\n    \"spyReportStart\": true,\n    \"type\": \"reaction\",\n  },\n  {\n    \"debugObjectName\": \"ObservableObject@1.y\",\n    \"newValue\": 4,\n    \"observableKind\": \"computed\",\n    \"oldValue\": CaughtException {\n      \"cause\": null,\n    },\n    \"type\": \"update\",\n  },\n  {\n    \"spyReportEnd\": true,\n    \"type\": \"report-end\",\n  },\n  {\n    \"debugObjectName\": \"ObservableObject@1\",\n    \"name\": \"x\",\n    \"newValue\": 3,\n    \"observableKind\": \"object\",\n    \"oldValue\": 2,\n    \"spyReportStart\": true,\n    \"type\": \"update\",\n  },\n  {\n    \"debugObjectName\": \"ObservableObject@1.y\",\n    \"newValue\": CaughtException {\n      \"cause\": \"Oops\",\n    },\n    \"observableKind\": \"computed\",\n    \"oldValue\": 4,\n    \"type\": \"update\",\n  },\n  {\n    \"name\": \"autorun\",\n    \"spyReportStart\": true,\n    \"type\": \"reaction\",\n  },\n  {\n    \"error\": \"Oops\",\n    \"message\": \"[mobx] Encountered an uncaught exception that was thrown by a reaction or observer component, in: 'Reaction[autorun]'\",\n    \"name\": \"autorun\",\n    \"type\": \"error\",\n  },\n  {\n    \"spyReportEnd\": true,\n    \"type\": \"report-end\",\n  },\n  {\n    \"spyReportEnd\": true,\n    \"type\": \"report-end\",\n  },\n]\n`;\n\nexports[`spy output 1`] = `\n[\n  {\n    \"debugObjectName\": \"ObservableValue@1\",\n    \"newValue\": \"2\",\n    \"observableKind\": \"value\",\n    \"type\": \"create\",\n  },\n  {\n    \"debugObjectName\": \"ObservableValue@1\",\n    \"newValue\": 3,\n    \"observableKind\": \"value\",\n    \"oldValue\": 2,\n    \"spyReportStart\": true,\n    \"type\": \"update\",\n  },\n  {\n    \"spyReportEnd\": true,\n    \"type\": \"report-end\",\n  },\n  {\n    \"debugObjectName\": \"ObservableObject@2\",\n    \"name\": \"c\",\n    \"newValue\": 4,\n    \"observableKind\": \"object\",\n    \"spyReportStart\": true,\n    \"type\": \"add\",\n  },\n  {\n    \"spyReportEnd\": true,\n    \"type\": \"report-end\",\n  },\n  {\n    \"debugObjectName\": \"ObservableObject@2\",\n    \"name\": \"c\",\n    \"newValue\": 5,\n    \"observableKind\": \"object\",\n    \"oldValue\": 4,\n    \"spyReportStart\": true,\n    \"type\": \"update\",\n  },\n  {\n    \"spyReportEnd\": true,\n    \"type\": \"report-end\",\n  },\n  {\n    \"debugObjectName\": \"ObservableObject@2\",\n    \"name\": \"d\",\n    \"newValue\": 6,\n    \"observableKind\": \"object\",\n    \"spyReportStart\": true,\n    \"type\": \"add\",\n  },\n  {\n    \"spyReportEnd\": true,\n    \"type\": \"report-end\",\n  },\n  {\n    \"debugObjectName\": \"ObservableObject@2\",\n    \"name\": \"d\",\n    \"newValue\": 7,\n    \"observableKind\": \"object\",\n    \"oldValue\": 6,\n    \"spyReportStart\": true,\n    \"type\": \"update\",\n  },\n  {\n    \"spyReportEnd\": true,\n    \"type\": \"report-end\",\n  },\n  {\n    \"added\": [\n      1,\n      2,\n    ],\n    \"addedCount\": 2,\n    \"debugObjectName\": \"ObservableArray@3\",\n    \"index\": 0,\n    \"observableKind\": \"array\",\n    \"removed\": [],\n    \"removedCount\": 0,\n    \"spyReportStart\": true,\n    \"type\": \"splice\",\n  },\n  {\n    \"spyReportEnd\": true,\n    \"type\": \"report-end\",\n  },\n  {\n    \"added\": [\n      3,\n      4,\n    ],\n    \"addedCount\": 2,\n    \"debugObjectName\": \"ObservableArray@3\",\n    \"index\": 2,\n    \"observableKind\": \"array\",\n    \"removed\": [],\n    \"removedCount\": 0,\n    \"spyReportStart\": true,\n    \"type\": \"splice\",\n  },\n  {\n    \"spyReportEnd\": true,\n    \"type\": \"report-end\",\n  },\n  {\n    \"added\": [],\n    \"addedCount\": 0,\n    \"debugObjectName\": \"ObservableArray@3\",\n    \"index\": 0,\n    \"observableKind\": \"array\",\n    \"removed\": [\n      1,\n    ],\n    \"removedCount\": 1,\n    \"spyReportStart\": true,\n    \"type\": \"splice\",\n  },\n  {\n    \"spyReportEnd\": true,\n    \"type\": \"report-end\",\n  },\n  {\n    \"debugObjectName\": \"ObservableArray@3\",\n    \"index\": 2,\n    \"newValue\": 5,\n    \"observableKind\": \"array\",\n    \"oldValue\": 4,\n    \"spyReportStart\": true,\n    \"type\": \"update\",\n  },\n  {\n    \"spyReportEnd\": true,\n    \"type\": \"report-end\",\n  },\n  {\n    \"debugObjectName\": \"ObservableMap@4\",\n    \"name\": \"g\",\n    \"newValue\": 1,\n    \"observableKind\": \"map\",\n    \"spyReportStart\": true,\n    \"type\": \"add\",\n  },\n  {\n    \"spyReportEnd\": true,\n    \"type\": \"report-end\",\n  },\n  {\n    \"debugObjectName\": \"ObservableMap@4\",\n    \"name\": \"g\",\n    \"observableKind\": \"map\",\n    \"oldValue\": 1,\n    \"spyReportStart\": true,\n    \"type\": \"delete\",\n  },\n  {\n    \"spyReportEnd\": true,\n    \"type\": \"report-end\",\n  },\n  {\n    \"debugObjectName\": \"ObservableMap@4\",\n    \"name\": \"i\",\n    \"newValue\": 5,\n    \"observableKind\": \"map\",\n    \"spyReportStart\": true,\n    \"type\": \"add\",\n  },\n  {\n    \"spyReportEnd\": true,\n    \"type\": \"report-end\",\n  },\n  {\n    \"debugObjectName\": \"ObservableMap@4\",\n    \"name\": \"i\",\n    \"newValue\": 6,\n    \"observableKind\": \"map\",\n    \"oldValue\": 5,\n    \"spyReportStart\": true,\n    \"type\": \"update\",\n  },\n  {\n    \"spyReportEnd\": true,\n    \"type\": \"report-end\",\n  },\n  {\n    \"name\": \"Autorun@6\",\n    \"spyReportStart\": true,\n    \"type\": \"reaction\",\n  },\n  {\n    \"debugObjectName\": \"ComputedValue@5\",\n    \"newValue\": 6,\n    \"observableKind\": \"computed\",\n    \"oldValue\": CaughtException {\n      \"cause\": null,\n    },\n    \"type\": \"update\",\n  },\n  {\n    \"spyReportEnd\": true,\n    \"type\": \"report-end\",\n  },\n  {\n    \"debugObjectName\": \"ObservableValue@1\",\n    \"newValue\": 4,\n    \"observableKind\": \"value\",\n    \"oldValue\": 3,\n    \"spyReportStart\": true,\n    \"type\": \"update\",\n  },\n  {\n    \"debugObjectName\": \"ComputedValue@5\",\n    \"newValue\": 8,\n    \"observableKind\": \"computed\",\n    \"oldValue\": 6,\n    \"type\": \"update\",\n  },\n  {\n    \"name\": \"Autorun@6\",\n    \"spyReportStart\": true,\n    \"type\": \"reaction\",\n  },\n  {\n    \"spyReportEnd\": true,\n    \"type\": \"report-end\",\n  },\n  {\n    \"spyReportEnd\": true,\n    \"type\": \"report-end\",\n  },\n  {\n    \"debugObjectName\": \"ObservableValue@1\",\n    \"newValue\": 5,\n    \"observableKind\": \"value\",\n    \"oldValue\": 4,\n    \"spyReportStart\": true,\n    \"type\": \"update\",\n  },\n  {\n    \"spyReportEnd\": true,\n    \"type\": \"report-end\",\n  },\n  {\n    \"debugObjectName\": \"ObservableValue@1\",\n    \"newValue\": 6,\n    \"observableKind\": \"value\",\n    \"oldValue\": 5,\n    \"spyReportStart\": true,\n    \"type\": \"update\",\n  },\n  {\n    \"spyReportEnd\": true,\n    \"type\": \"report-end\",\n  },\n  {\n    \"debugObjectName\": \"ComputedValue@5\",\n    \"newValue\": 12,\n    \"observableKind\": \"computed\",\n    \"oldValue\": 8,\n    \"type\": \"update\",\n  },\n  {\n    \"name\": \"Autorun@6\",\n    \"spyReportStart\": true,\n    \"type\": \"reaction\",\n  },\n  {\n    \"spyReportEnd\": true,\n    \"type\": \"report-end\",\n  },\n  {\n    \"arguments\": [\n      7,\n    ],\n    \"name\": \"myTestAction\",\n    \"spyReportStart\": true,\n    \"type\": \"action\",\n  },\n  {\n    \"debugObjectName\": \"ObservableValue@1\",\n    \"newValue\": 7,\n    \"observableKind\": \"value\",\n    \"oldValue\": 6,\n    \"spyReportStart\": true,\n    \"type\": \"update\",\n  },\n  {\n    \"spyReportEnd\": true,\n    \"type\": \"report-end\",\n  },\n  {\n    \"debugObjectName\": \"ComputedValue@5\",\n    \"newValue\": 14,\n    \"observableKind\": \"computed\",\n    \"oldValue\": 12,\n    \"type\": \"update\",\n  },\n  {\n    \"name\": \"Autorun@6\",\n    \"spyReportStart\": true,\n    \"type\": \"reaction\",\n  },\n  {\n    \"spyReportEnd\": true,\n    \"type\": \"report-end\",\n  },\n  {\n    \"spyReportEnd\": true,\n    \"type\": \"report-end\",\n  },\n]\n`;\n"
  },
  {
    "path": "packages/mobx/__tests__/v4/base/array.js",
    "content": "\"use strict\"\n\nconst { LegacyObservableArray } = require(\"../../../src/internal\")\nconst mobx = require(\"../mobx4\")\nconst { observable, _getAdministration, reaction, makeObservable } = mobx\nconst iterall = require(\"iterall\")\n\nlet consoleWarnMock\nafterEach(() => {\n    consoleWarnMock?.mockRestore()\n})\n\nexpect.addEqualityTesters([\n    function (a, b, ...rest) {\n        if (a instanceof LegacyObservableArray || b instanceof LegacyObservableArray) {\n            return this.equals([...a], [...b], ...rest)\n        }\n        return undefined\n    }\n])\n\ntest(\"test1\", function () {\n    const a = observable.array([])\n    expect(a.length).toBe(0)\n    expect(Object.keys(a)).toEqual([])\n    expect(a.slice()).toEqual([])\n\n    a.push(1)\n    expect(a.length).toBe(1)\n    expect(a.slice()).toEqual([1])\n\n    a[1] = 2\n    expect(a.length).toBe(2)\n    expect(a.slice()).toEqual([1, 2])\n\n    const sum = mobx.computed(function () {\n        return (\n            -1 +\n            a.reduce(function (a, b) {\n                return a + b\n            }, 1)\n        )\n    })\n\n    expect(sum.get()).toBe(3)\n\n    a[1] = 3\n    expect(a.length).toBe(2)\n    expect(a.slice()).toEqual([1, 3])\n    expect(sum.get()).toBe(4)\n\n    a.splice(1, 1, 4, 5)\n    expect(a.length).toBe(3)\n    expect(a.slice()).toEqual([1, 4, 5])\n    expect(sum.get()).toBe(10)\n\n    a.replace([2, 4])\n    expect(sum.get()).toBe(6)\n\n    a.splice(1, 1)\n    expect(sum.get()).toBe(2)\n    expect(a.slice()).toEqual([2])\n\n    a.spliceWithArray(0, 0, [4, 3])\n    expect(sum.get()).toBe(9)\n    expect(a.slice()).toEqual([4, 3, 2])\n\n    a.clear()\n    expect(sum.get()).toBe(0)\n    expect(a.slice()).toEqual([])\n\n    a.length = 4\n    expect(isNaN(sum.get())).toBe(true)\n    expect(a.length).toEqual(4)\n\n    expect(a.slice()).toEqual([undefined, undefined, undefined, undefined])\n\n    a.replace([1, 2, 2, 4])\n    expect(sum.get()).toBe(9)\n    a.length = 4\n    expect(sum.get()).toBe(9)\n\n    a.length = 2\n    expect(sum.get()).toBe(3)\n    expect(a.slice()).toEqual([1, 2])\n\n    expect(a.reverse()).toEqual([2, 1])\n    expect(a).toEqual([2, 1])\n    expect(a.slice()).toEqual([2, 1])\n\n    a.unshift(3)\n    expect(a.sort()).toEqual([1, 2, 3])\n    expect(a.slice()).toEqual([1, 2, 3])\n\n    expect(JSON.stringify(a)).toBe(\"[1,2,3]\")\n\n    expect(a[1]).toBe(2)\n    a[2] = 4\n    expect(a[2]).toBe(4)\n\n    //\tt.deepEqual(Object.keys(a), ['0', '1', '2']); // ideally....\n    expect(Object.keys(a)).toEqual([])\n})\n\ntest(\"array should support iterall / iterable \", () => {\n    const a = observable([1, 2, 3])\n\n    expect(iterall.isIterable(a)).toBe(true)\n\n    const values = []\n    iterall.forEach(a, v => values.push(v))\n\n    expect(values).toEqual([1, 2, 3])\n\n    let iter = iterall.getIterator(a)\n    expect(iter.next()).toEqual({ value: 1, done: false })\n    expect(iter.next()).toEqual({ value: 2, done: false })\n    expect(iter.next()).toEqual({ value: 3, done: false })\n    expect(iter.next()).toEqual({ value: undefined, done: true })\n\n    a.replace([])\n    iter = iterall.getIterator(a)\n    expect(iter.next()).toEqual({ value: undefined, done: true })\n})\n\ntest(\"find(findIndex) and remove\", function () {\n    const a = mobx.observable([10, 20, 20])\n    let idx = -1\n    function predicate(item, index) {\n        if (item === 20) {\n            idx = index\n            return true\n        }\n        return false\n    }\n\n    expect(a.find(predicate)).toBe(20)\n    expect(idx).toBe(1)\n    expect(a.findIndex(predicate)).toBe(1)\n    expect(a.find(predicate, null)).toBe(20)\n    expect(idx).toBe(1)\n    idx = -1\n\n    expect(a.remove(20)).toBe(true)\n    expect(a.find(predicate)).toBe(20)\n    expect(idx).toBe(1)\n    expect(a.findIndex(predicate)).toBe(1)\n    idx = -1\n    expect(a.remove(20)).toBe(true)\n    expect(a.find(predicate)).toBe(undefined)\n    expect(idx).toBe(-1)\n    expect(a.findIndex(predicate)).toBe(-1)\n\n    expect(a.remove(20)).toBe(false)\n})\n\ntest(\"findLast(findLastIndex) and remove\", function () {\n    const a = mobx.observable([10, 20, 20])\n    let idx = -1\n    function predicate(item, index) {\n        if (item === 20) {\n            idx = index\n            return true\n        }\n        return false\n    }\n    ;[].findLastIndex;\n    expect(a.findLast(predicate)).toBe(20)\n    expect(a.findLastIndex(predicate)).toBe(2)\n    expect(a.findLast(predicate)).toBe(20)\n\n    expect(a.remove(20)).toBe(true)\n    expect(a.find(predicate)).toBe(20)\n    expect(idx).toBe(1)\n    expect(a.findIndex(predicate)).toBe(1)\n    idx = -1\n    expect(a.remove(20)).toBe(true)\n    expect(a.findLast(predicate)).toBe(undefined)\n    expect(idx).toBe(-1)\n    expect(a.findLastIndex(predicate)).toBe(-1)\n\n    expect(a.remove(20)).toBe(false)\n})\n\ntest(\"concat should automatically slice observable arrays, #260\", () => {\n    const a1 = mobx.observable([1, 2])\n    const a2 = mobx.observable([3, 4])\n    expect(a1.concat(a2)).toEqual([1, 2, 3, 4])\n})\n\ntest(\"observe\", function () {\n    const ar = mobx.observable([1, 4])\n    const buf = []\n    const disposer = mobx.observe(\n        ar,\n        function (changes) {\n            buf.push(changes)\n        },\n        true\n    )\n\n    ar[1] = 3 // 1,3\n    ar[2] = 0 // 1, 3, 0\n    ar.shift() // 3, 0\n    ar.push(1, 2) // 3, 0, 1, 2\n    ar.splice(1, 2, 3, 4) // 3, 3, 4, 2\n    expect(ar.slice()).toEqual([3, 3, 4, 2])\n    ar.splice(6)\n    ar.splice(6, 2)\n    ar.replace([\"a\"])\n    ar.pop()\n    ar.pop() // does not fire anything\n\n    // check the object param\n    buf.forEach(function (change) {\n        expect(change.object).toBe(ar)\n        delete change.object\n        expect(change.observableKind).toBe(\"array\")\n        delete change.observableKind\n        delete change.debugObjectName\n    })\n\n    const result = [\n        { type: \"splice\", index: 0, addedCount: 2, removed: [], added: [1, 4], removedCount: 0 },\n        { type: \"update\", index: 1, oldValue: 4, newValue: 3 },\n        { type: \"splice\", index: 2, addedCount: 1, removed: [], added: [0], removedCount: 0 },\n        { type: \"splice\", index: 0, addedCount: 0, removed: [1], added: [], removedCount: 1 },\n        { type: \"splice\", index: 2, addedCount: 2, removed: [], added: [1, 2], removedCount: 0 },\n        {\n            type: \"splice\",\n            index: 1,\n            addedCount: 2,\n            removed: [0, 1],\n            added: [3, 4],\n            removedCount: 2\n        },\n        {\n            type: \"splice\",\n            index: 0,\n            addedCount: 1,\n            removed: [3, 3, 4, 2],\n            added: [\"a\"],\n            removedCount: 4\n        },\n        { type: \"splice\", index: 0, addedCount: 0, removed: [\"a\"], added: [], removedCount: 1 }\n    ]\n\n    expect(buf).toEqual(result)\n\n    disposer()\n    ar[0] = 5\n    expect(buf).toEqual(result)\n})\n\ntest(\"array modification1\", function () {\n    const a = mobx.observable([1, 2, 3])\n    const r = a.splice(-10, 5, 4, 5, 6)\n    expect(a.slice()).toEqual([4, 5, 6])\n    expect(r).toEqual([1, 2, 3])\n})\n\ntest(\"serialize\", function () {\n    let a = [1, 2, 3]\n    const m = mobx.observable(a)\n\n    expect(JSON.stringify(m)).toEqual(JSON.stringify(a))\n    expect(a).toEqual(m.slice())\n\n    a = [4]\n    m.replace(a)\n    expect(JSON.stringify(m)).toEqual(JSON.stringify(a))\n    expect(a).toEqual(m.toJSON())\n})\n\ntest(\"array modification functions\", function () {\n    const ars = [[], [1, 2, 3]]\n    const funcs = [\"push\", \"pop\", \"shift\", \"unshift\"]\n    funcs.forEach(function (f) {\n        ars.forEach(function (ar) {\n            const a = ar.slice()\n            const b = mobx.observable(a)\n            const res1 = a[f](4)\n            const res2 = b[f](4)\n            expect(res1).toEqual(res2)\n            expect(a).toEqual(b.slice())\n        })\n    })\n})\n\ntest(\"array modifications\", function () {\n    const a2 = mobx.observable([])\n    const inputs = [undefined, -10, -4, -3, -1, 0, 1, 3, 4, 10]\n    const arrays = [\n        [],\n        [1],\n        [1, 2, 3, 4],\n        [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11],\n        [1, undefined],\n        [undefined]\n    ]\n    for (let i = 0; i < inputs.length; i++)\n        for (let j = 0; j < inputs.length; j++)\n            for (let k = 0; k < arrays.length; k++)\n                for (let l = 0; l < arrays.length; l++) {\n                    ;[\n                        \"array mod: [\",\n                        arrays[k].toString(),\n                        \"] i: \",\n                        inputs[i],\n                        \" d: \",\n                        inputs[j],\n                        \" [\",\n                        arrays[l].toString(),\n                        \"]\"\n                    ].join(\" \")\n                    const a1 = arrays[k].slice()\n                    a2.replace(a1)\n                    const res1 = a1.splice.apply(a1, [inputs[i], inputs[j]].concat(arrays[l]))\n                    const res2 = a2.splice.apply(a2, [inputs[i], inputs[j]].concat(arrays[l]))\n                    expect(a1.slice()).toEqual(a2.slice())\n                    expect(res1).toEqual(res2)\n                    expect(a1.length).toBe(a2.length)\n                }\n})\n\ntest(\"is array\", function () {\n    const x = mobx.observable([])\n    expect(x instanceof Array).toBe(true)\n\n    // would be cool if this would return true...\n    expect(Array.isArray(x)).toBe(false)\n})\n\ntest(\"stringifies same as ecma array\", function () {\n    const x = mobx.observable([])\n    expect(x instanceof Array).toBe(true)\n\n    // would be cool if these two would return true...\n    expect(x.toString()).toBe(\"\")\n    expect(x.toLocaleString()).toBe(\"\")\n    x.push(1, 2)\n    expect(x.toString()).toBe(\"1,2\")\n    expect(x.toLocaleString()).toBe(\"1,2\")\n})\n\ntest(\"observes when stringified\", function () {\n    const x = mobx.observable([])\n    let c = 0\n    mobx.autorun(function () {\n        x.toString()\n        c++\n    })\n    x.push(1)\n    expect(c).toBe(2)\n})\n\ntest(\"observes when stringified to locale\", function () {\n    const x = mobx.observable([])\n    let c = 0\n    mobx.autorun(function () {\n        x.toLocaleString()\n        c++\n    })\n    x.push(1)\n    expect(c).toBe(2)\n})\n\ntest(\"react to sort changes\", function () {\n    const x = mobx.observable([4, 2, 3])\n    const sortedX = mobx.computed(function () {\n        return x.slice().sort()\n    })\n    let sorted\n\n    mobx.autorun(function () {\n        sorted = sortedX.get()\n    })\n\n    expect(x.slice()).toEqual([4, 2, 3])\n    expect(sorted).toEqual([2, 3, 4])\n    x.push(1)\n    expect(x.slice()).toEqual([4, 2, 3, 1])\n    expect(sorted).toEqual([1, 2, 3, 4])\n    x.shift()\n    expect(x.slice()).toEqual([2, 3, 1])\n    expect(sorted).toEqual([1, 2, 3])\n})\n\ntest(\"autoextend buffer length\", function () {\n    const ar = observable(new Array(1000))\n    let changesCount = 0\n    mobx.observe(ar, () => ++changesCount)\n\n    ar[ar.length] = 0\n    ar.push(0)\n\n    expect(changesCount).toBe(2)\n})\n\ntest(\"array exposes correct keys\", () => {\n    const keys = []\n    const ar = observable([1, 2])\n    for (const key in ar) keys.push(key)\n\n    expect(keys).toEqual([])\n})\n\ntest(\"accessing out of bound values throws\", () => {\n    const a = mobx.observable([])\n\n    let warns = 0\n    const baseWarn = console.warn\n    console.warn = () => {\n        warns++\n    }\n\n    a[0] // out of bounds\n    a[1] // out of bounds\n\n    expect(warns).toBe(2)\n\n    expect(() => (a[0] = 3)).not.toThrow()\n    expect(() => (a[2] = 4)).toThrow(/Index out of bounds, 2 is larger than 1/)\n\n    console.warn = baseWarn\n})\n\ntest(\"replace can handle large arrays\", () => {\n    const a = mobx.observable([])\n    const b = []\n    b.length = 1000 * 1000\n    expect(() => {\n        a.replace(b)\n    }).not.toThrow()\n\n    expect(() => {\n        a.spliceWithArray(0, 0, b)\n    }).not.toThrow()\n})\n\ntest(\"can iterate arrays\", () => {\n    const x = mobx.observable([])\n    const y = []\n    const d = mobx.reaction(\n        () => Array.from(x),\n        items => y.push(items),\n        { fireImmediately: true }\n    )\n\n    x.push(\"a\")\n    x.push(\"b\")\n    expect(y).toEqual([[], [\"a\"], [\"a\", \"b\"]])\n    d()\n})\n\ntest(\"array is concat spreadable, #1395\", () => {\n    const x = mobx.observable([1, 2, 3, 4])\n    const y = [5].concat(x)\n    expect(y.length).toBe(2) // Should become 5 in MobX 5\n    expect(y).toEqual([5, x]) // should become [5, 1,2,3,4] in MobX 5\n})\n\ntest(\"array is spreadable, #1395\", () => {\n    const x = mobx.observable([1, 2, 3, 4])\n    expect([5, ...x]).toEqual([5, 1, 2, 3, 4])\n\n    const y = mobx.observable([])\n    expect([5, ...y]).toEqual([5])\n})\n\ntest(\"array supports toStringTag, #1490\", () => {\n    // N.B. on old environments this requires polyfils for these symbols *and* Object.prototype.toString.\n    // core-js provides both\n    const a = mobx.observable([])\n    expect(Object.prototype.toString.call(a)).toBe(\"[object Array]\")\n})\n\ntest(\"concats correctly #1667\", () => {\n    const x = observable({ data: [] })\n\n    function generate(count) {\n        const d = []\n        for (let i = 0; i < count; i++) d.push({})\n        return d\n    }\n\n    x.data = generate(10000)\n    const first = x.data[0]\n\n    x.data = x.data.concat(generate(1000))\n    expect(x.data[0]).toBe(first)\n    expect(x.data.length).toBe(11000)\n})\n\ntest(\"dehances last value on shift/pop\", () => {\n    const x1 = observable([3, 5])\n    _getAdministration(x1).dehancer = value => {\n        return value * 2\n    }\n    expect(x1.shift()).toBe(6)\n    expect(x1.shift()).toBe(10)\n\n    const x2 = observable([3, 5])\n    _getAdministration(x2).dehancer = value => {\n        return value * 2\n    }\n    expect(x2.pop()).toBe(10)\n    expect(x2.pop()).toBe(6)\n})\n\ntest(\"#2044 symbol key on array\", () => {\n    const x = observable([1, 2])\n    const s = Symbol(\"test\")\n    x[s] = 3\n    expect(x[s]).toBe(3)\n\n    let reacted = false\n    const d = reaction(\n        () => x[s],\n        () => {\n            reacted = true\n        }\n    )\n\n    x[s] = 4\n    expect(x[s]).toBe(4)\n\n    // although x[s] can be stored, it won't be reactive!\n    expect(reacted).toBe(false)\n    d()\n})\n\ntest(\"#2044 non-symbol key on array\", () => {\n    const x = observable([1, 2])\n    const s = \"test\"\n    x[s] = 3\n    expect(x[s]).toBe(3)\n\n    let reacted = false\n    const d = reaction(\n        () => x[s],\n        () => {\n            reacted = true\n        }\n    )\n\n    x[s] = 4\n    expect(x[s]).toBe(4)\n\n    // although x[s] can be stored, it won't be reactive!\n    expect(reacted).toBe(false)\n    d()\n})\n\ndescribe(\"extended array prototype\", () => {\n    const extensionKey = \"__extension\"\n\n    // A single setup/teardown for all tests because we're pretending to do a\n    // singular global (dirty) change to the \"environment\".\n    beforeAll(() => {\n        Array.prototype[extensionKey] = () => {}\n    })\n    afterAll(() => {\n        delete Array.prototype[extensionKey]\n    })\n\n    test(\"creating an observable should work\", () => {\n        mobx.observable({ b: \"b\" })\n    })\n\n    test(\"extending an observable should work\", () => {\n        const a = { b: \"b\" }\n        mobx.extendObservable(a, {})\n    })\n})\n\ntest(\"reproduce #2021\", () => {\n    expect.assertions(1)\n    try {\n        Array.prototype.extension = function () {\n            console.log(\"I'm the extension!\", this.length)\n        }\n\n        class Test {\n            data = null\n\n            constructor() {\n                makeObservable(this, {\n                    data: observable\n                })\n            }\n        }\n\n        const test = new Test()\n\n        mobx.autorun(() => {\n            if (test.data) expect(test.data.someStr).toBe(\"123\")\n        })\n\n        test.data = { someStr: \"123\" }\n    } finally {\n        delete Array.prototype.extension\n    }\n})\n\ntest(\"correct array should be passed to callbacks #2326\", () => {\n    const array = observable([1, 2, 3])\n\n    function callback() {\n        const lastArg = arguments[arguments.length - 1]\n        expect(lastArg).toBe(array)\n    }\n    ;[\n        \"every\",\n        \"filter\",\n        \"find\",\n        \"findIndex\",\n        \"findLast\",\n        \"findLastIndex\",\n        \"flatMap\",\n        \"forEach\",\n        \"map\",\n        \"reduce\",\n        \"reduceRight\",\n        \"some\"\n    ].forEach(method => {\n        if (Array.prototype[method]) array[method](callback)\n        else console.warn(\"SKIPPING: \" + method)\n    })\n})\n\ntest(\"very long arrays can be safely passed to nativeArray.concat #2379\", () => {\n    const nativeArray = [\"a\", \"b\"]\n    const longNativeArray = [...Array(10000).keys()]\n    const longObservableArray = observable(longNativeArray)\n    expect(longObservableArray.length).toBe(10000)\n    expect(longObservableArray).toEqual(longNativeArray)\n    expect(longObservableArray[9000]).toBe(longNativeArray[9000])\n    expect(longObservableArray[9999]).toBe(longNativeArray[9999])\n    consoleWarnMock = jest.spyOn(console, \"warn\").mockImplementation(() => {})\n    expect(longObservableArray[10000]).toBe(longNativeArray[10000])\n    expect(consoleWarnMock).toMatchSnapshot()\n\n    const expectedArray = nativeArray.concat(longNativeArray)\n    const actualArray = nativeArray.concat(longObservableArray.slice()) // NOTE: in MobX4 slice is needed\n\n    expect(actualArray).toEqual(expectedArray)\n\n    const anotherArray = [0, 1, 2, 3, 4, 5]\n    const observableArray = observable(anotherArray)\n    const r1 = anotherArray.splice(2, 2, ...longNativeArray)\n    const r2 = observableArray.splice(2, 2, ...longNativeArray)\n    expect(r2).toEqual(r1)\n    expect(observableArray).toEqual(anotherArray)\n})\n\ndescribe(\"dehances\", () => {\n    function supressConsoleWarn(fn) {\n        const { warn } = console\n        console.warn = () => {}\n        const result = fn()\n        console.warn = warn\n        return result\n    }\n\n    const dehancer = thing => {\n        // Dehance only objects of a proper type\n        if (thing && typeof thing === \"object\" && thing.hasOwnProperty(\"value\")) {\n            return thing.value\n        }\n        // Support nested arrays\n        if (Array.isArray(thing)) {\n            // If array has own dehancer it's still applied prior to ours.\n            // It doesn't matter how many dehancers we apply,\n            // if they ignore unknown types.\n            return thing.map(dehancer)\n        }\n        // Ignore unknown types\n        return thing\n    }\n\n    let enhanced, dehanced, array\n\n    beforeEach(() => {\n        enhanced = [{ value: 1 }, { value: 2 }, { value: 3 }]\n        dehanced = enhanced.map(dehancer)\n        array = observable(enhanced)\n        mobx._getAdministration(array).dehancer = dehancer\n    })\n\n    test(\"slice\", () => {\n        expect(array.slice()).toEqual(dehanced.slice())\n    })\n\n    test(\"filter\", () => {\n        const predicate = value => value === 2\n        expect(array.filter(predicate)).toEqual(dehanced.filter(predicate))\n    })\n\n    test(\"concat\", () => {\n        expect(array.concat(4)).toEqual(dehanced.concat(4))\n    })\n\n    test(\"entries\", () => {\n        expect([...array.entries()]).toEqual([...dehanced.entries()])\n    })\n\n    test(\"every\", () => {\n        array.every((value, index) => {\n            expect(value).toEqual(dehanced[index])\n            return true\n        })\n    })\n\n    test(\"find\", () => {\n        const predicate = value => value === 2\n        expect(array.find(predicate)).toEqual(dehanced.find(predicate))\n    })\n\n    test(\"forEach\", () => {\n        array.forEach((value, index) => {\n            expect(value).toEqual(dehanced[index])\n        })\n    })\n\n    test(\"includes\", () => {\n        expect(array.includes(2)).toEqual(dehanced.includes(2))\n    })\n\n    test(\"indexOf\", () => {\n        expect(array.indexOf(2)).toEqual(dehanced.indexOf(2))\n    })\n\n    test(\"join\", () => {\n        expect(array.join()).toEqual(dehanced.join())\n    })\n\n    test(\"lastIndexOf\", () => {\n        expect(array.lastIndexOf(2)).toEqual(dehanced.lastIndexOf(2))\n    })\n\n    test(\"map\", () => {\n        array.map((value, index) => {\n            expect(value).toEqual(dehanced[index])\n            return value\n        })\n    })\n\n    test(\"pop\", () => {\n        expect(array.pop()).toEqual(dehanced.pop())\n    })\n\n    test(\"reduce\", () => {\n        array.reduce((_, value, index) => {\n            expect(value).toEqual(dehanced[index])\n        })\n    })\n\n    test(\"reduceRight\", () => {\n        array.reduceRight((_, value, index) => {\n            expect(value).toEqual(dehanced[index])\n        })\n    })\n\n    test(\"reverse\", () => {\n        const reversedArray = supressConsoleWarn(() => array.reverse())\n        expect(reversedArray).toEqual(dehanced.reverse())\n    })\n\n    test(\"shift\", () => {\n        expect(array.shift()).toEqual(dehanced.shift())\n    })\n\n    test(\"some\", () => {\n        array.some((value, index) => {\n            expect(value).toEqual(dehanced[index])\n            return false\n        })\n    })\n\n    test(\"splice\", () => {\n        expect(array.splice(1, 2)).toEqual(dehanced.splice(1, 2))\n    })\n\n    test(\"sort\", () => {\n        const comparator = (a, b) => {\n            expect(typeof a).toEqual(\"number\")\n            expect(typeof b).toEqual(\"number\")\n            return b > a\n        }\n        const sortedArray = supressConsoleWarn(() => array.sort(comparator))\n        expect(sortedArray).toEqual(dehanced.sort(comparator))\n    })\n\n    test(\"values\", () => {\n        expect([...array.values()]).toEqual([...dehanced.values()])\n    })\n\n    test(\"toReversed\", () => {\n        expect(array.toReversed()).toEqual(dehanced.toReversed())\n    })\n \n     test(\"toSorted\", () => {\n        expect(array.toSorted()).toEqual(dehanced.toSorted())\n    })\n \n     test(\"toSorted with args\", () => {\n        expect(array.toSorted((a, b) => a - b)).toEqual(dehanced.toSorted((a, b) => a - b))\n    })\n \n     test(\"toSpliced\", () => {\n        expect(array.toSpliced(1, 2)).toEqual(dehanced.toSpliced(1, 2))\n    })\n \n     test(\"with\", () => {\n        expect(array.with(1, 5)).toEqual(dehanced.with(1, 5))\n    })\n\n    test(\"at\", () => {\n        expect(array.at(1)).toEqual(dehanced.at(1))\n        expect(array.at(-1)).toEqual(dehanced.at(-1))\n    })\n\n    test(\"flat/flatMap\", () => {\n        // not supported in V4\n    })\n})\n\ntest(\"reduce without initial value #2432\", () => {\n    const array = [1, 2, 3]\n    const observableArray = observable(array)\n\n    const arrayReducerArgs = []\n    const observableArrayReducerArgs = []\n\n    const arraySum = array.reduce((...args) => {\n        arrayReducerArgs.push(args)\n        return args[0] + args[1]\n    })\n\n    const observableArraySum = observableArray.reduce((...args) => {\n        observableArrayReducerArgs.push(args)\n        return args[0] + args[1]\n    })\n\n    expect(arraySum).toEqual(1 + 2 + 3)\n    expect(observableArraySum).toEqual(arraySum)\n    expect(arrayReducerArgs).toEqual(observableArrayReducerArgs)\n})\n"
  },
  {
    "path": "packages/mobx/__tests__/v4/base/autorun.js",
    "content": "/**\n * @type {typeof import(\"./../../../src/v4/mobx\")}\n */\nconst mobx = require(\"../mobx4\")\nconst utils = require(\"../../v5/utils/test-utils\")\n\ntest(\"autorun passes Reaction as an argument to view function\", function () {\n    const a = mobx.observable.box(1)\n    const values = []\n\n    mobx.autorun(r => {\n        expect(typeof r.dispose).toBe(\"function\")\n        if (a.get() === \"pleaseDispose\") r.dispose()\n        values.push(a.get())\n    })\n\n    a.set(2)\n    a.set(2)\n    a.set(\"pleaseDispose\")\n    a.set(3)\n    a.set(4)\n\n    expect(values).toEqual([1, 2, \"pleaseDispose\"])\n})\n\ntest(\"autorun can be disposed on first run\", function () {\n    const a = mobx.observable.box(1)\n    const values = []\n\n    mobx.autorun(r => {\n        r.dispose()\n        values.push(a.get())\n    })\n\n    a.set(2)\n\n    expect(values).toEqual([1])\n})\n\ntest(\"autorun warns when passed an action\", function () {\n    const action = mobx.action(() => {})\n    expect.assertions(1)\n    expect(() => mobx.autorun(action)).toThrow(/Autorun does not accept actions/)\n})\n\ntest(\"autorun batches automatically\", function () {\n    let runs = 0\n    let a1runs = 0\n    let a2runs = 0\n\n    const x = mobx.observable({\n        a: 1,\n        b: 1,\n        c: 1,\n        get d() {\n            runs++\n            return this.c + this.b\n        }\n    })\n\n    const d1 = mobx.autorun(() => {\n        a1runs++\n        x.d // read\n    })\n\n    const d2 = mobx.autorun(() => {\n        a2runs++\n        x.b = x.a\n        x.c = x.a\n    })\n\n    expect(a1runs).toBe(1)\n    expect(a2runs).toBe(1)\n    expect(runs).toBe(1)\n\n    x.a = 17\n\n    expect(a1runs).toBe(2)\n    expect(a2runs).toBe(2)\n    expect(runs).toBe(2)\n\n    d1()\n    d2()\n})\n\ntest(\"autorun tracks invalidation of unbound dependencies\", function () {\n    const a = mobx.observable.box(0)\n    const b = mobx.observable.box(0)\n    const c = mobx.computed(() => a.get() + b.get())\n    const values = []\n\n    mobx.autorun(() => {\n        values.push(c.get())\n        b.set(100)\n    })\n\n    a.set(1)\n    expect(values).toEqual([0, 100, 101])\n})\n\ntest(\"when effect is an action\", function (done) {\n    const a = mobx.observable.box(0)\n\n    mobx.configure({ enforceActions: \"observed\" })\n    mobx.when(\n        () => a.get() === 1,\n        () => {\n            a.set(2)\n\n            mobx.configure({ enforceActions: \"never\" })\n            done()\n        },\n        { timeout: 1 }\n    )\n\n    mobx.runInAction(() => {\n        a.set(1)\n    })\n})\n\ndescribe(\"autorun opts requiresObservable\", () => {\n    test(\"warn when no observable\", () => {\n        utils.consoleWarn(() => {\n            const disposer = mobx.autorun(() => 2, {\n                requiresObservable: true\n            })\n\n            disposer()\n        }, /is created\\/updated without reading any observable value/)\n    })\n\n    test(\"Don't warn when observable\", () => {\n        const obsr = mobx.observable({\n            x: 1\n        })\n\n        const messages = utils.supressConsole(() => {\n            const disposer = mobx.autorun(() => obsr.x, {\n                requiresObservable: true\n            })\n\n            disposer()\n        })\n\n        expect(messages.length).toBe(0)\n    })\n})\n"
  },
  {
    "path": "packages/mobx/__tests__/v4/base/cycles.js",
    "content": "const m = require(\"../mobx4\")\n\ntest(\"cascading active state (form 1)\", function () {\n    const Store = function () {\n        m.extendObservable(this, { _activeItem: null })\n    }\n    Store.prototype.activeItem = function (item) {\n        const _this = this\n\n        if (arguments.length === 0) return this._activeItem\n\n        m.transaction(function () {\n            if (_this._activeItem === item) return\n            if (_this._activeItem) _this._activeItem.isActive = false\n            _this._activeItem = item\n            if (_this._activeItem) _this._activeItem.isActive = true\n        })\n    }\n\n    const Item = function () {\n        m.extendObservable(this, { isActive: false })\n    }\n\n    const store = new Store()\n    const item1 = new Item(),\n        item2 = new Item()\n    expect(store.activeItem()).toBe(null)\n    expect(item1.isActive).toBe(false)\n    expect(item2.isActive).toBe(false)\n\n    store.activeItem(item1)\n    expect(store.activeItem()).toBe(item1)\n    expect(item1.isActive).toBe(true)\n    expect(item2.isActive).toBe(false)\n\n    store.activeItem(item2)\n    expect(store.activeItem()).toBe(item2)\n    expect(item1.isActive).toBe(false)\n    expect(item2.isActive).toBe(true)\n\n    store.activeItem(null)\n    expect(store.activeItem()).toBe(null)\n    expect(item1.isActive).toBe(false)\n    expect(item2.isActive).toBe(false)\n})\n\ntest(\"cascading active state (form 2)\", function () {\n    const Store = function () {\n        const _this = this\n        m.extendObservable(this, { activeItem: null })\n\n        m.autorun(function () {\n            if (_this._activeItem === _this.activeItem) return\n            if (_this._activeItem) _this._activeItem.isActive = false\n            _this._activeItem = _this.activeItem\n            if (_this._activeItem) _this._activeItem.isActive = true\n        })\n    }\n\n    const Item = function () {\n        m.extendObservable(this, { isActive: false })\n    }\n\n    const store = new Store()\n    const item1 = new Item(),\n        item2 = new Item()\n    expect(store.activeItem).toBe(null)\n    expect(item1.isActive).toBe(false)\n    expect(item2.isActive).toBe(false)\n\n    store.activeItem = item1\n    expect(store.activeItem).toBe(item1)\n    expect(item1.isActive).toBe(true)\n    expect(item2.isActive).toBe(false)\n\n    store.activeItem = item2\n    expect(store.activeItem).toBe(item2)\n    expect(item1.isActive).toBe(false)\n    expect(item2.isActive).toBe(true)\n\n    store.activeItem = null\n    expect(store.activeItem).toBe(null)\n    expect(item1.isActive).toBe(false)\n    expect(item2.isActive).toBe(false)\n})\n\ntest(\"emulate rendering\", function () {\n    let renderCount = 0\n\n    const Component = function (props) {\n        this.props = props\n    }\n    Component.prototype.destroy = function () {\n        if (this.handler) {\n            this.handler()\n            this.handler = null\n        }\n    }\n\n    Component.prototype.render = function () {\n        const _this = this\n\n        if (this.handler) {\n            this.handler()\n            this.handler = null\n        }\n        this.handler = m.autorun(function () {\n            if (!_this.props.data.title) _this.props.data.title = \"HELLO\"\n            renderCount++\n        })\n    }\n\n    const data = {}\n    m.extendObservable(data, { title: null })\n    const component = new Component({ data: data })\n    expect(renderCount).toBe(0)\n\n    component.render()\n    expect(renderCount).toBe(1)\n\n    data.title = \"WORLD\"\n    expect(renderCount).toBe(2)\n\n    data.title = null\n    // Note that this causes two invalidations\n    // however, the real mobx-react binding optimizes this as well\n    // see mobx-react #12, so maybe this ain't the best test\n    expect(renderCount).toBe(4)\n\n    data.title = \"WORLD\"\n    expect(renderCount).toBe(5)\n\n    component.destroy()\n    data.title = \"HELLO\"\n    expect(renderCount).toBe(5)\n})\n\ntest(\"efficient selection\", function () {\n    function Item(value) {\n        m.extendObservable(this, {\n            selected: false,\n            value: value\n        })\n    }\n\n    function Store() {\n        this.prevSelection = null\n        m.extendObservable(this, {\n            selection: null,\n            items: [new Item(1), new Item(2), new Item(3)]\n        })\n        m.autorun(() => {\n            if (this.previousSelection === this.selection) return true // converging condition\n            if (this.previousSelection) this.previousSelection.selected = false\n            if (this.selection) this.selection.selected = true\n            this.previousSelection = this.selection\n        })\n    }\n\n    const store = new Store()\n\n    expect(store.selection).toBe(null)\n    expect(\n        store.items.filter(function (i) {\n            return i.selected\n        }).length\n    ).toBe(0)\n\n    store.selection = store.items[1]\n    expect(\n        store.items.filter(function (i) {\n            return i.selected\n        }).length\n    ).toBe(1)\n    expect(store.selection).toBe(store.items[1])\n    expect(store.items[1].selected).toBe(true)\n\n    store.selection = store.items[2]\n    expect(\n        store.items.filter(function (i) {\n            return i.selected\n        }).length\n    ).toBe(1)\n    expect(store.selection).toBe(store.items[2])\n    expect(store.items[2].selected).toBe(true)\n\n    store.selection = null\n    expect(\n        store.items.filter(function (i) {\n            return i.selected\n        }).length\n    ).toBe(0)\n    expect(store.selection).toBe(null)\n})\n"
  },
  {
    "path": "packages/mobx/__tests__/v4/base/extendObservable.js",
    "content": "// @ts-check\n\nimport {\n    action,\n    autorun,\n    isObservable,\n    isObservableProp,\n    isComputedProp,\n    isAction,\n    extendObservable\n} from \"../mobx4\"\n\ntest(\"extendObservable should work\", function () {\n    class Box {\n        // @ts-ignore\n        uninitialized\n        height = 20\n        sizes = [2]\n        someFunc = function () {\n            return 2\n        }\n        get width() {\n            return (\n                this.undeclared *\n                this.height *\n                this.sizes.length *\n                this.someFunc() *\n                (this.uninitialized ? 2 : 1)\n            )\n        }\n        addSize() {\n            // @ts-ignore\n            this.sizes.push([3])\n            // @ts-ignore\n            this.sizes.push([4])\n        }\n        constructor() {\n            this.undeclared = 1\n        }\n    }\n\n    const box = new Box()\n\n    extendObservable(box, {\n        height: 20,\n        sizes: [2],\n        get someFunc() {\n            return 2\n        },\n        width: 40\n    })\n\n    expect(isObservableProp(box, \"height\")).toBe(true)\n    expect(isObservableProp(box, \"sizes\")).toBe(true)\n    expect(isObservable(box.sizes)).toBe(true)\n    expect(isObservableProp(box, \"someFunc\")).toBe(true)\n    expect(isComputedProp(box, \"someFunc\")).toBe(true)\n    expect(isObservableProp(box, \"width\")).toBe(true)\n\n    const ar = []\n\n    autorun(() => {\n        ar.push(box.width)\n    })\n\n    expect(ar.slice()).toEqual([40])\n})\n\ntest(\"extendObservable should work with plain object\", function () {\n    const box = {\n        /** @type {boolean | undefined} */\n        uninitialized: undefined,\n        height: 20,\n        sizes: [2],\n        someFunc: function () {\n            return 2\n        },\n        get width() {\n            return (\n                this.undeclared *\n                this.height *\n                this.sizes.length *\n                this.someFunc() *\n                (this.uninitialized ? 2 : 1)\n            )\n        },\n        addSize() {\n            // @ts-ignore\n            this.sizes.push([3])\n            // @ts-ignore\n            this.sizes.push([4])\n        }\n    }\n\n    box.undeclared = 1\n\n    extendObservable(box, {\n        height: 20,\n        sizes: [2],\n        get someFunc() {\n            return 2\n        },\n        width: 40\n    })\n\n    expect(isObservableProp(box, \"height\")).toBe(true)\n    expect(isObservableProp(box, \"sizes\")).toBe(true)\n    expect(isObservable(box.sizes)).toBe(true)\n    expect(isObservableProp(box, \"someFunc\")).toBe(true)\n    expect(isComputedProp(box, \"someFunc\")).toBe(true)\n    expect(isObservableProp(box, \"width\")).toBe(true)\n\n    const ar = []\n\n    autorun(() => {\n        ar.push(box.width)\n    })\n\n    expect(ar.slice()).toEqual([40])\n})\n\ntest(\"extendObservable should apply specified decorators\", function () {\n    const box = {\n        /** @type {boolean | undefined} */\n        uninitialized: undefined,\n        height: 20,\n        sizes: [2],\n        someFunc: function () {\n            return 2\n        },\n        get width() {\n            return (\n                this.undeclared *\n                this.height *\n                this.sizes.length *\n                this.someFunc() *\n                (this.uninitialized ? 2 : 1)\n            )\n        },\n        addSize() {\n            // @ts-ignore\n            this.sizes.push([3])\n            // @ts-ignore\n            this.sizes.push([4])\n        }\n    }\n\n    box.undeclared = 1\n\n    extendObservable(\n        box,\n        {\n            someFunc: function () {\n                return 2\n            }\n        },\n        // @ts-ignore\n        { someFunc: action }\n    )\n\n    expect(isAction(box.someFunc)).toBe(true)\n    expect(box.someFunc()).toEqual(2)\n})\n"
  },
  {
    "path": "packages/mobx/__tests__/v4/base/extras.js",
    "content": "const mobx = require(\"../mobx4\")\nconst m = mobx\nconst { $mobx } = mobx\n\ntest(\"treeD\", function () {\n    m._resetGlobalState()\n    mobx._getGlobalState().mobxGuid = 0\n    const a = m.observable.box(3)\n    const aName = \"ObservableValue@1\"\n\n    const dtree = m.getDependencyTree\n    expect(dtree(a)).toEqual({\n        name: aName\n    })\n\n    const b = m.computed(() => a.get() * a.get())\n    const bName = \"ComputedValue@2\"\n    expect(dtree(b)).toEqual({\n        name: bName\n        // no dependencies yet, since it isn't observed yet\n    })\n\n    const c = m.autorun(() => b.get())\n    const cName = \"Autorun@3\"\n    expect(dtree(c[$mobx])).toEqual({\n        name: cName,\n        dependencies: [\n            {\n                name: bName,\n                dependencies: [\n                    {\n                        name: aName\n                    }\n                ]\n            }\n        ]\n    })\n\n    expect(aName !== bName).toBeTruthy()\n    expect(bName !== cName).toBeTruthy()\n\n    expect(m.getObserverTree(a)).toEqual({\n        name: aName,\n        observers: [\n            {\n                name: bName,\n                observers: [\n                    {\n                        name: cName\n                    }\n                ]\n            }\n        ]\n    })\n\n    const x = mobx.observable.map({ temperature: 0 })\n    const d = mobx.autorun(function () {\n        x.keys()\n        if (x.has(\"temperature\")) x.get(\"temperature\")\n        x.has(\"absent\")\n    })\n\n    expect(m.getDependencyTree(d[$mobx])).toEqual({\n        name: \"Autorun@5\",\n        dependencies: [\n            {\n                name: \"ObservableMap@4.keys()\"\n            },\n            {\n                name: \"ObservableMap@4.temperature?\"\n            },\n            {\n                name: \"ObservableMap@4.temperature\"\n            },\n            {\n                name: \"ObservableMap@4.absent?\"\n            }\n        ]\n    })\n})\n\nfunction stripTrackerOutput(output) {\n    return output.map(function (i) {\n        if (Array.isArray(i)) return stripTrackerOutput(i)\n        delete i.object\n        delete i.time\n        delete i.fn\n        return i\n    })\n}\n\ntest(\"spy 1\", function () {\n    m._resetGlobalState()\n    const lines = []\n\n    const a = m.observable.box(3)\n    const b = m.computed(function () {\n        return a.get() * 2\n    })\n    m.autorun(function () {\n        b.get()\n    })\n    const stop = m.spy(function (line) {\n        lines.push(line)\n    })\n\n    a.set(4)\n    stop()\n    a.set(5)\n    expect(stripTrackerOutput(lines)).toMatchSnapshot()\n})\n\ntest(\"get atom\", function () {\n    mobx._resetGlobalState()\n    mobx._getGlobalState().mobxGuid = 0 // hmm dangerous reset?\n\n    function Clazz() {\n        mobx.extendObservable(this, {\n            a: 17\n        })\n    }\n\n    const a = mobx.observable.box(3)\n    const b = mobx.observable({ a: 3 })\n    const c = mobx.observable.map({ a: 3 })\n    const d = mobx.observable([1, 2])\n    const e = mobx.computed(() => 3)\n    const f = mobx.autorun(() => c.has(\"b\"))\n    const g = new Clazz()\n\n    function atom(thing, prop) {\n        return mobx.getAtom(thing, prop).constructor.name\n    }\n\n    const ovClassName = mobx.observable.box(3).constructor.name\n    const atomClassName = mobx.createAtom(\"test\").constructor.name\n    // const reactionClassName = mobx.Reaction.name\n\n    expect(atom(a)).toBe(ovClassName)\n\n    expect(atom(b, \"a\")).toBe(ovClassName)\n    expect(() => atom(b)).toThrow(/please specify a property/)\n    expect(() => atom(b, \"b\")).toThrow(\n        /no observable property 'b' found on the observable object 'ObservableObject@2'/\n    )\n\n    expect(atom(c)).toBe(atomClassName) // returns ke, \"bla\".constructor, === \"Atomys\n    expect(atom(c, \"a\")).toBe(ovClassName) // returns ent, \"bla\".constructor, === \"Atomry\n    expect(atom(c, \"b\")).toBe(ovClassName) // returns has entry (see autoru, \"bla\", \"Atomn)\n    expect(() => atom(c, \"c\")).toThrow(\n        /the entry 'c' does not exist in the observable map 'ObservableMap@3'/\n    )\n\n    expect(atom(d)).toBe(atomClassName)\n    expect(() => atom(d, 0)).toThrow(/It is not possible to get index atoms from arrays/)\n\n    expect(atom(e)).toBe(mobx.computed(() => {}).constructor.name)\n    expect(atom(f)).toBe(mobx.Reaction.name)\n\n    expect(() => atom(g)).toThrow(/please specify a property/)\n    expect(atom(g, \"a\")).toBe(ovClassName)\n\n    f()\n})\n\ntest(\"get debug name\", function () {\n    mobx._resetGlobalState()\n    mobx._getGlobalState().mobxGuid = 0 // hmm dangerous reset?\n\n    function Clazz() {\n        mobx.extendObservable(this, {\n            a: 17\n        })\n    }\n\n    const a = mobx.observable.box(3)\n    const b = mobx.observable({ a: 3 })\n    const c = mobx.observable.map({ a: 3 })\n    const d = mobx.observable([1, 2])\n    const e = mobx.computed(() => 3)\n    const f = mobx.autorun(() => c.has(\"b\"))\n    const g = new Clazz()\n\n    function name(thing, prop) {\n        return mobx.getDebugName(thing, prop)\n    }\n\n    expect(name(a)).toBe(\"ObservableValue@1\")\n\n    expect(name(b, \"a\")).toBe(\"ObservableObject@2.a\")\n    expect(() => name(b, \"b\")).toThrow(\n        /no observable property 'b' found on the observable object 'ObservableObject@2'/\n    )\n\n    expect(name(c)).toBe(\"ObservableMap@3\") // returns ke, \"bla\"ys\n    expect(name(c, \"a\")).toBe(\"ObservableMap@3.a\") // returns ent, \"bla\"ry\n    expect(name(c, \"b\")).toBe(\"ObservableMap@3.b?\") // returns has entry (see autoru, \"bla\"n)\n    expect(() => name(c, \"c\")).toThrow(\n        /the entry 'c' does not exist in the observable map 'ObservableMap@3'/\n    )\n\n    expect(name(d)).toBe(\"ObservableArray@4\")\n    expect(() => name(d, 0)).toThrow(/It is not possible to get index atoms from arrays/)\n\n    expect(name(e)).toBe(\"ComputedValue@5\")\n    expect(name(f)).toBe(\"Autorun@6\")\n\n    expect(name(g)).toBe(\"Clazz@7\")\n    expect(name(g, \"a\")).toBe(\"Clazz@7.a\")\n\n    f()\n})\n\ntest(\"get administration\", function () {\n    mobx._resetGlobalState()\n    mobx._getGlobalState().mobxGuid = 0 // hmm dangerous reset?\n\n    function Clazz() {\n        mobx.extendObservable(this, {\n            a: 17\n        })\n    }\n\n    const a = mobx.observable.box(3)\n    const b = mobx.observable({ a: 3 })\n    const c = mobx.observable.map({ a: 3 })\n    const d = mobx.observable([1, 2])\n    const e = mobx.computed(() => 3)\n    const f = mobx.autorun(() => c.has(\"b\"))\n    const g = new Clazz()\n\n    function adm(thing, prop) {\n        return mobx._getAdministration(thing, prop).constructor.name\n    }\n\n    const ovClassName = mobx.observable.box(3).constructor.name\n    const mapClassName = mobx.observable.map().constructor.name\n\n    expect(adm(a)).toBe(ovClassName)\n\n    expect(adm(b, \"a\")).toBe(ovClassName)\n    expect(adm(b)).toBe(b[$mobx].constructor.name)\n    expect(() => adm(b, \"b\")).toThrow(\n        /no observable property 'b' found on the observable object 'ObservableObject@2'/\n    )\n\n    expect(adm(c)).toBe(mapClassName)\n    expect(adm(c, \"a\")).toBe(ovClassName)\n    expect(adm(c, \"b\")).toBe(ovClassName)\n    expect(() => adm(c, \"c\")).toThrow(\n        /the entry 'c' does not exist in the observable map 'ObservableMap@3'/\n    )\n\n    expect(adm(d)).toBe(d[$mobx].constructor.name)\n    expect(() => adm(d, 0)).toThrow(/It is not possible to get index atoms from arrays/)\n\n    expect(adm(e)).toBe(mobx.computed(() => {}).constructor.name)\n    expect(adm(f)).toBe(mobx.Reaction.name)\n\n    expect(adm(g)).toBe(b[$mobx].constructor.name)\n    expect(adm(g, \"a\")).toBe(ovClassName)\n\n    f()\n})\n\ntest(\"onBecome(Un)Observed simple\", () => {\n    const x = mobx.observable.box(3)\n    const events = []\n\n    mobx.onBecomeObserved(x, () => {\n        events.push(\"x observed\")\n    })\n    mobx.onBecomeUnobserved(x, () => {\n        events.push(\"x unobserved\")\n    })\n\n    expect(events.length).toBe(0) // nothing happened yet\n    x.get()\n    expect(events.length).toBe(0) // nothing happened yet\n    x.set(4)\n    expect(events.length).toBe(0) // nothing happened yet\n\n    const d5 = mobx.reaction(\n        () => x.get(),\n        () => {}\n    )\n    expect(events.length).toBe(1)\n    expect(events).toEqual([\"x observed\"])\n\n    d5()\n    expect(events.length).toBe(2)\n    expect(events).toEqual([\"x observed\", \"x unobserved\"])\n})\n\ntest(\"onBecome(Un)Observed - less simple\", () => {\n    const x = mobx.observable({\n        a: 3,\n        get b() {\n            return this.a * 2\n        }\n    })\n    const events = []\n\n    const d1 = mobx.onBecomeObserved(x, \"a\", () => {\n        events.push(\"a observed\")\n    })\n    const d2 = mobx.onBecomeUnobserved(x, \"a\", () => {\n        events.push(\"a unobserved\")\n    })\n    const d3 = mobx.onBecomeObserved(x, \"b\", () => {\n        events.push(\"b observed\")\n    })\n    const d4 = mobx.onBecomeUnobserved(x, \"b\", () => {\n        events.push(\"b unobserved\")\n    })\n\n    x.b\n    x.a = 4\n\n    expect(events.length).toBe(0) // nothing happened yet\n\n    const d5 = mobx.reaction(\n        () => x.b,\n        () => {}\n    )\n    expect(events.length).toBe(2)\n    expect(events).toEqual([\"b observed\", \"a observed\"])\n\n    const d6 = mobx.reaction(\n        () => x.b,\n        () => {}\n    )\n    expect(events.length).toBe(2)\n\n    d5()\n    expect(events.length).toBe(2)\n    d6()\n    expect(events.length).toBe(4)\n    expect(events).toEqual([\"b observed\", \"a observed\", \"b unobserved\", \"a unobserved\"])\n\n    d1()\n    d2()\n    d3()\n    d4()\n    events.splice(0)\n    const d7 = mobx.reaction(\n        () => x.b,\n        () => {}\n    )\n    d7()\n    expect(events.length).toBe(0)\n})\n\ntest(\"deepEquals should yield correct results for complex objects #1118 - 1\", () => {\n    const d2016jan1 = new Date(\"2016-01-01\")\n    const d2016jan1_2 = new Date(\"2016-01-01\")\n    const d2017jan1 = new Date(\"2017-01-01\")\n\n    expect(d2016jan1).toEqual(d2016jan1_2)\n    expect(d2016jan1).not.toEqual(d2017jan1)\n    expect(mobx.comparer.structural(d2016jan1, d2016jan1)).toBe(true)\n    expect(mobx.comparer.structural(d2016jan1, d2017jan1)).toBe(false)\n    expect(mobx.comparer.structural(d2016jan1, d2016jan1_2)).toBe(true)\n})\n\ntest(\"deepEquals should yield correct results for complex objects #1118 - 2\", () => {\n    class A {\n        x = 3\n        y = 4\n\n        constructor(x) {\n            this.x = x\n        }\n    }\n\n    const a1 = new A(2)\n    const a2 = new A(2)\n    const a3 = new A(3)\n    const a4 = new A(2)\n    a4.z = 2\n\n    expect(a1).toEqual(a2)\n    expect(a1).not.toEqual(a3)\n    expect(mobx.comparer.structural(a1, a1)).toBe(true)\n    expect(mobx.comparer.structural(a1, a3)).toBe(false)\n    expect(mobx.comparer.structural(a1, a2)).toBe(true)\n    expect(mobx.comparer.structural(a1, a4)).toBe(false)\n})\n\ntest(\"comparer.shallow should work\", () => {\n    const sh = mobx.comparer.shallow\n\n    expect(sh(1, 1)).toBe(true)\n\n    expect(sh(1, 2)).toBe(false)\n\n    expect(sh({}, {})).toBe(true)\n    expect(sh([], [])).toBe(true)\n\n    expect(sh({}, [])).toBe(false)\n    expect(sh([], {})).toBe(false)\n\n    expect(sh({ a: 1, b: 2, c: 3 }, { a: 1, b: 2, c: 3 })).toBe(true)\n\n    expect(sh({ a: 1, b: 2, c: 3, d: 4 }, { a: 1, b: 2, c: 3 })).toBe(false)\n    expect(sh({ a: 1, b: 2, c: 3 }, { a: 1, b: 2, c: 3, d: 4 })).toBe(false)\n    expect(sh({ a: {}, b: 2, c: 3 }, { a: {}, b: 2, c: 3 })).toBe(false)\n\n    expect(sh([1, 2, 3], [1, 2, 3])).toBe(true)\n\n    expect(sh([1, 2, 3, 4], [1, 2, 3])).toBe(false)\n    expect(sh([1, 2, 3], [1, 2, 3, 4])).toBe(false)\n    expect(sh([{}, 2, 3], [{}, 2, 3])).toBe(false)\n})\n"
  },
  {
    "path": "packages/mobx/__tests__/v4/base/intercept.js",
    "content": "const m = require(\"../mobx4\")\nconst intercept = m.intercept\n\ntest(\"intercept observable value\", () => {\n    const a = m.observable.box(1)\n\n    let d = intercept(a, () => {\n        return null\n    })\n\n    a.set(2)\n\n    expect(a.get()).toBe(1)\n\n    d()\n\n    a.set(3)\n    expect(a.get()).toBe(3)\n\n    d = intercept(a, c => {\n        if (c.newValue % 2 === 0) {\n            throw \"value should be odd!\"\n        }\n        return c\n    })\n\n    expect(() => {\n        a.set(4)\n    }).toThrow(/value should be odd/)\n\n    expect(a.get()).toBe(3)\n    a.set(5)\n    expect(a.get()).toBe(5)\n\n    d()\n    d = intercept(a, c => {\n        c.newValue *= 2\n        return c\n    })\n\n    a.set(6)\n    expect(a.get()).toBe(12)\n\n    intercept(a, c => {\n        c.newValue += 1\n        return c\n    })\n\n    a.set(7)\n    expect(a.get()).toBe(15)\n\n    d()\n    a.set(8)\n    expect(a.get()).toBe(9)\n})\n\ntest(\"intercept array\", () => {\n    const a = m.observable([1, 2])\n\n    let d = m.intercept(a, () => null)\n    a.push(2)\n    expect(a.slice()).toEqual([1, 2])\n\n    d()\n\n    d = intercept(a, c => {\n        if (c.type === \"splice\") {\n            c.added.push(c.added[0] * 2)\n            c.removedCount = 1\n            return c\n        } else if (c.type === \"update\") {\n            c.newValue = c.newValue * 3\n            return c\n        }\n    })\n\n    a.unshift(3, 4)\n\n    expect(a.slice()).toEqual([3, 4, 6, 2])\n    a[2] = 5\n    expect(a.slice()).toEqual([3, 4, 15, 2])\n})\n\ntest(\"intercept object\", () => {\n    const a = m.observable({\n        b: 3\n    })\n\n    intercept(a, change => {\n        change.newValue *= 3\n        return change\n    })\n\n    a.b = 4\n\n    expect(a.b).toBe(12)\n\n    intercept(a, \"b\", change => {\n        change.newValue += 1\n        return change\n    })\n\n    a.b = 5\n    expect(a.b).toBe(16)\n\n    const d3 = intercept(a, c => {\n        expect(c.name).toBe(\"b\")\n        expect(c.object).toBe(a)\n        expect(c.type).toBe(\"update\")\n        return null\n    })\n\n    a.b = 7\n    expect(a.b).toBe(16)\n\n    d3()\n    a.b = 7\n    expect(a.b).toBe(22)\n})\n\ntest(\"intercept property additions\", () => {\n    const a = m.observable({})\n    const d4 = intercept(a, change => {\n        if (change.type === \"add\") {\n            return null\n        }\n        return change\n    })\n\n    m.extendObservable(a, { c: 1 }) // not added!\n    expect(a.c).toBe(undefined)\n    expect(m.isObservableProp(a, \"c\")).toBe(false)\n\n    d4()\n\n    m.extendObservable(a, { c: 2 })\n    expect(a.c).toBe(2)\n    expect(m.isObservableProp(a, \"c\")).toBe(true)\n})\n\ntest(\"intercept map\", () => {\n    const a = m.observable.map({\n        b: 3\n    })\n\n    intercept(a, c => {\n        c.newValue *= 3\n        return c\n    })\n\n    a.set(\"b\", 4)\n\n    expect(a.get(\"b\")).toBe(12)\n\n    intercept(a, \"b\", c => {\n        c.newValue += 1\n        return c\n    })\n\n    a.set(\"b\", 5)\n    expect(a.get(\"b\")).toBe(16)\n\n    const d3 = intercept(a, c => {\n        expect(c.name).toBe(\"b\"), expect(c.object).toBe(a)\n        expect(c.type).toBe(\"update\")\n        return null\n    })\n\n    a.set(\"b\", 7)\n    expect(a.get(\"b\")).toBe(16)\n\n    d3()\n    a.set(\"b\", 7)\n    expect(a.get(\"b\")).toBe(22)\n\n    const d4 = intercept(a, c => {\n        if (c.type === \"delete\") return null\n        return c\n    })\n\n    a.delete(\"b\")\n    expect(a.has(\"b\")).toBe(true)\n    expect(a.get(\"b\")).toBe(22)\n\n    d4()\n    a.delete(\"b\")\n    expect(a.has(\"b\")).toBe(false)\n    expect(a.get(\"c\")).toBe(undefined)\n})\n"
  },
  {
    "path": "packages/mobx/__tests__/v4/base/jsconfig.json",
    "content": "{\n    \"compilerOptions\": {\n        \"target\": \"es2015\",\n        \"experimentalDecorators\": true\n    }\n}\n"
  },
  {
    "path": "packages/mobx/__tests__/v4/base/makereactive.js",
    "content": "const mobx = require(\"../mobx4\")\nconst m = mobx\nconst o = mobx.observable\nconst { makeObservable } = mobx\n\nfunction buffer() {\n    const b = []\n    const res = function (x) {\n        b.push(x)\n    }\n    res.toArray = function () {\n        return b\n    }\n    return res\n}\n\ntest(\"isObservable\", function () {\n    function Order() {}\n\n    function ReactiveOrder(price) {\n        m.extendObservable(this, {\n            price: price\n        })\n    }\n    expect(m.isObservable(null)).toBe(false)\n    expect(m.isObservable(null)).toBe(false)\n\n    expect(m.isObservable(m.observable([]))).toBe(true)\n    expect(m.isObservable(m.observable({}))).toBe(true)\n    expect(m.isObservable(m.observable.box(function () {}))).toBe(true)\n    expect(m.isObservable(m.computed(function () {}))).toBe(true)\n\n    expect(m.isObservable([])).toBe(false)\n    expect(m.isObservable({})).toBe(false)\n    expect(m.isObservable(function () {})).toBe(false)\n\n    expect(m.isObservable(new Order())).toBe(false)\n    expect(m.isObservable(m.observable.box(new Order()))).toBe(true)\n\n    expect(m.isObservable(new ReactiveOrder())).toBe(true)\n    expect(m.isObservable(m.observable.box(3))).toBe(true)\n\n    const obj = {}\n    expect(m.isObservable(obj)).toBe(false)\n\n    expect(m.isObservable(m.observable.box(function () {}))).toBe(true)\n    expect(m.isObservable(m.autorun(function () {}))).toBe(true)\n\n    expect(m.isObservableProp(m.observable({ a: 1 }), \"a\")).toBe(true)\n    expect(m.isObservableProp(m.observable({ a: 1 }), \"b\")).toBe(false)\n\n    expect(m.isObservable(m.observable.map())).toBe(true)\n\n    const base = { a: 3 }\n    const obs = m.observable(base)\n    expect(m.isObservable(base)).toBe(false)\n    expect(m.isObservableProp(base, \"a\")).toBe(false)\n    expect(m.isObservable(obs)).toBe(true)\n    expect(m.isObservableProp(obs, \"a\")).toBe(true)\n})\n\ntest(\"isBoxedObservable\", function () {\n    expect(m.isBoxedObservable(m.observable({}))).toBe(false)\n    expect(m.isBoxedObservable(m.computed(() => 3))).toBe(false)\n    expect(m.isBoxedObservable(m.observable.box(3))).toBe(true)\n    expect(m.isBoxedObservable(m.observable.box(3))).toBe(true)\n    expect(m.isBoxedObservable(m.observable.box({}))).toBe(true)\n})\n\ntest(\"observable1\", function () {\n    m._resetGlobalState()\n\n    // recursive structure\n    const x = m.observable({\n        a: {\n            b: {\n                c: 3\n            }\n        }\n    })\n    const b = buffer()\n    m.autorun(function () {\n        b(x.a.b.c)\n    })\n    x.a = { b: { c: 4 } }\n    x.a.b.c = 5 // new structure was reactive as well\n    expect(b.toArray()).toEqual([3, 4, 5])\n\n    // recursive structure, but asReference passed in\n    expect(m.isObservable(x.a.b)).toBe(true)\n    const x2 = m.observable.object(\n        {\n            a: {\n                b: {\n                    c: 3\n                }\n            }\n        },\n        {\n            a: m.observable.ref\n        }\n    )\n\n    expect(m.isObservable(x2)).toBe(true)\n    expect(m.isObservable(x2.a)).toBe(false)\n    expect(m.isObservable(x2.a.b)).toBe(false)\n\n    const b2 = buffer()\n    m.autorun(function () {\n        b2(x2.a.b.c)\n    })\n    x2.a = { b: { c: 4 } }\n    x2.a.b.c = 5 // not picked up, not reactive, since passed as reference\n    expect(b2.toArray()).toEqual([3, 4])\n\n    // non recursive structure\n    const x3 = o.object(\n        {\n            a: {\n                b: {\n                    c: 3\n                }\n            }\n        },\n        {},\n        { deep: false }\n    )\n    const b3 = buffer()\n    m.autorun(function () {\n        b3(x3.a.b.c)\n    })\n    x3.a = { b: { c: 4 } }\n    x3.a.b.c = 5 // sub structure not reactive\n    expect(b3.toArray()).toEqual([3, 4])\n})\n\ntest(\"observable3\", function () {\n    function Order(price) {\n        this.price = price\n    }\n\n    const x = m.observable({\n        orders: [new Order(1), new Order(2)]\n    })\n\n    const b = buffer()\n    m.autorun(function () {\n        b(x.orders.length)\n    })\n\n    expect(m.isObservable(x.orders)).toBe(true)\n    expect(m.isObservable(x.orders[0])).toBe(false)\n    x.orders[2] = new Order(3)\n    x.orders = []\n    expect(m.isObservable(x.orders)).toBe(true)\n    x.orders[0] = new Order(2)\n    expect(b.toArray()).toEqual([2, 3, 0, 1])\n})\n\ntest(\"observable4\", function () {\n    const x = m.observable([{ x: 1 }, { x: 2 }])\n\n    const b = buffer()\n    m.observe(\n        m.computed(function () {\n            return x.map(function (d) {\n                return d.x\n            })\n        }),\n        x => b(x.newValue),\n        true\n    )\n\n    x[0].x = 3\n    x.shift()\n    x.push({ x: 5 })\n    expect(b.toArray()).toEqual([[1, 2], [3, 2], [2], [2, 5]])\n\n    // non recursive\n    const x2 = o.array([{ x: 1 }, { x: 2 }], { deep: false })\n\n    const b2 = buffer()\n    m.observe(\n        m.computed(function () {\n            return x2.map(function (d) {\n                return d.x\n            })\n        }),\n        x => b2(x.newValue),\n        true\n    )\n\n    x2[0].x = 3\n    x2.shift()\n    x2.push({ x: 5 })\n    expect(b2.toArray()).toEqual([[1, 2], [2], [2, 5]])\n})\n\ntest(\"observable5\", function () {\n    let x = m.computed(function () {})\n    expect(function () {\n        x.set(7) // set not allowed\n    }).toThrow(/It is not possible to assign a new value to a computed value/)\n\n    let f = m._autoAction(function () {})\n    const x2 = m.observable.box(f)\n    expect(x2.get()).toBe(f)\n    x2.set(null) // allowed\n\n    f = m._autoAction(function () {\n        return this.price\n    })\n    x = m.observable(\n        {\n            price: 17,\n            get reactive() {\n                return this.price\n            },\n            nonReactive: f\n        },\n        {\n            nonReactive: false\n        }\n    )\n\n    const b = buffer()\n    m.autorun(function () {\n        b([x.reactive, x.nonReactive, x.nonReactive()])\n    })\n\n    x.price = 18\n    const three = function () {\n        return 3\n    }\n    x.nonReactive = three\n\n    expect(b.toArray()).toEqual([\n        [17, f, 17],\n        [18, f, 18]\n    ])\n})\n\ntest(\"flat array\", function () {\n    const x = m.observable.object(\n        {\n            x: [\n                {\n                    a: 1\n                }\n            ]\n        },\n        { x: m.observable.shallow }\n    )\n\n    let result\n    let updates = 0\n    m.autorun(function () {\n        updates++\n        result = JSON.stringify(mobx.toJS(x))\n    })\n\n    expect(result).toEqual(JSON.stringify({ x: [{ a: 1 }] }))\n    expect(updates).toBe(1)\n\n    x.x[0].a = 2 // not picked up; object is not made reactive\n    expect(result).toEqual(JSON.stringify({ x: [{ a: 1 }] }))\n    expect(updates).toBe(1)\n\n    x.x.push({ a: 3 }) // picked up, array is reactive\n    expect(result).toEqual(JSON.stringify({ x: [{ a: 2 }, { a: 3 }] }))\n    expect(updates).toBe(2)\n\n    x.x[0] = { a: 4 } // picked up, array is reactive\n    expect(result).toEqual(JSON.stringify({ x: [{ a: 4 }, { a: 3 }] }))\n    expect(updates).toBe(3)\n\n    x.x[1].a = 6 // not picked up\n    expect(result).toEqual(JSON.stringify({ x: [{ a: 4 }, { a: 3 }] }))\n    expect(updates).toBe(3)\n})\n\ntest(\"flat object\", function () {\n    const y = m.observable.object(\n        {\n            x: { z: 3 }\n        },\n        {},\n        { deep: false }\n    )\n\n    let result\n    let updates = 0\n    m.autorun(function () {\n        updates++\n        result = JSON.stringify(mobx.toJS(y))\n    })\n\n    expect(result).toEqual(JSON.stringify({ x: { z: 3 } }))\n    expect(updates).toBe(1)\n\n    y.x.z = 4 // not picked up\n    expect(result).toEqual(JSON.stringify({ x: { z: 3 } }))\n    expect(updates).toBe(1)\n\n    y.x = { z: 5 }\n    expect(result).toEqual(JSON.stringify({ x: { z: 5 } }))\n    expect(updates).toBe(2)\n\n    y.x.z = 6 // not picked up\n    expect(result).toEqual(JSON.stringify({ x: { z: 5 } }))\n    expect(updates).toBe(2)\n})\n\ntest(\"as structure\", function () {\n    const x = m.observable.object(\n        {\n            x: null\n        },\n        {\n            x: m.observable.struct\n        }\n    )\n\n    let changed = 0\n    const dis = m.autorun(function () {\n        changed++\n        JSON.stringify(x)\n    })\n\n    function c() {\n        expect(changed).toBe(1)\n        if (changed !== 1) console.trace()\n        changed = 0\n    }\n\n    function nc() {\n        expect(changed).toBe(0)\n        if (changed !== 0) console.trace()\n        changed = 0\n    }\n\n    // nc = no change, c = changed.\n    c()\n    x.x = null\n    nc()\n    x.x = undefined\n    c()\n    x.x = 3\n    c()\n    x.x = 1 * x.x\n    nc()\n    x.x = \"3\"\n    c()\n\n    x.x = {\n        y: 3\n    }\n    c()\n    x.x.y = 3\n    nc()\n    x.x = {\n        y: 3\n    }\n    nc()\n    x.x = {\n        y: 4\n    }\n    c()\n    x.x = {\n        y: 3\n    }\n    c()\n    x.x = {\n        y: {\n            y: 3\n        }\n    }\n    c()\n    x.x.y.y = 3\n    nc()\n    x.x.y = { y: 3 }\n    nc()\n    x.x = { y: { y: 3 } }\n    nc()\n    x.x = { y: { y: 4 } }\n    c()\n    x.x = {}\n    c()\n    x.x = {}\n    nc()\n\n    x.x = []\n    c()\n    x.x = []\n    nc()\n    x.x = [3, 2, 1]\n    c()\n    x.x.sort()\n    nc()\n    x.x.sort()\n    nc()\n    x.x[1] = 2\n    nc()\n    x.x[0] = 0\n    nc() // not detected\n\n    dis()\n})\n\ntest(\"as structure view\", function () {\n    const x = m.observable.object(\n        {\n            a: 1,\n            aa: 1,\n            get b() {\n                this.a\n                return { a: this.aa }\n            },\n            get c() {\n                this.b\n                return { a: this.aa }\n            }\n        },\n        {\n            c: m.computed({ compareStructural: true })\n        }\n    )\n\n    let bc = 0\n    m.autorun(function () {\n        x.b\n        bc++\n    })\n    expect(bc).toBe(1)\n\n    let cc = 0\n    m.autorun(function () {\n        x.c\n        cc++\n    })\n    expect(cc).toBe(1)\n\n    x.a = 2\n    x.a = 3\n    expect(bc).toBe(3)\n    expect(cc).toBe(1)\n    x.aa = 3\n    expect(bc).toBe(4)\n    expect(cc).toBe(2)\n})\n\ntest(\"540 - extendobservable should not report cycles\", function () {\n    expect(() => m.extendObservable(Object.freeze({}), {})).toThrow(\n        /Cannot make the designated object observable/\n    )\n\n    const objWrapper = mobx.observable({\n        value: null\n    })\n\n    const obj = {\n        name: \"Hello\"\n    }\n\n    objWrapper.value = obj\n    expect(() => mobx.extendObservable(objWrapper, objWrapper.value)).toThrow(\n        /Extending an object with another observable \\(object\\) is not supported/\n    )\n})\n\ntest(\"computed value\", () => {\n    mobx._getGlobalState().mobxGuid = 0\n    const c = mobx.computed(() => 3)\n\n    expect(0 + c).toBe(3)\n    expect(mobx.isComputed(c)).toBe(true)\n    expect(c.toString()).toMatchSnapshot()\n})\n\ntest(\"boxed value json\", () => {\n    const a = mobx.observable.box({ x: 1 })\n    expect(a.get().x).toEqual(1)\n    a.set(3)\n    expect(a.get()).toEqual(3)\n    expect(\"\" + a).toBe(\"3\")\n    expect(a.toJSON()).toBe(3)\n})\n\ntest(\"computed value scope\", () => {\n    const a = mobx.observable({\n        x: 1,\n        get y() {\n            return this.x * 2\n        },\n        set y(v) {\n            this.x = v\n        }\n    })\n\n    expect(a.y).toBe(2)\n    a.x = 2\n    expect(a.y).toBe(4)\n    a.y = 3\n    expect(a.y).toBe(6)\n})\n\ntest(\"shallow array\", () => {\n    const a = mobx.observable.array([], { deep: false })\n    a.push({ x: 1 }, [], 2, mobx.observable({ y: 3 }))\n\n    expect(mobx.isObservable(a)).toBe(true)\n    expect(mobx.isObservable(a[0])).toBe(false)\n    expect(mobx.isObservable(a[1])).toBe(false)\n    expect(mobx.isObservable(a[2])).toBe(false)\n    expect(mobx.isObservable(a[3])).toBe(true)\n})\n\ntest(\"761 - deeply nested modifiers work\", () => {\n    const a = {}\n    mobx.extendObservable(a, {\n        someKey: mobx.observable.object(\n            {\n                someNestedKey: []\n            },\n            {\n                someNestedKey: mobx.observable.ref\n            }\n        )\n    })\n\n    expect(mobx.isObservable(a)).toBe(true)\n    expect(mobx.isObservableProp(a, \"someKey\")).toBe(true)\n    expect(mobx.isObservable(a.someKey)).toBe(true)\n    expect(mobx.isObservableProp(a.someKey, \"someNestedKey\")).toBe(true)\n    expect(mobx.isObservable(a.someKey.someNestedKey)).toBe(false)\n    expect(Array.isArray(a.someKey.someNestedKey)).toBe(true)\n\n    Object.assign(a, { someKey: { someNestedKey: [1, 2, 3] } })\n    expect(mobx.isObservable(a)).toBe(true)\n    expect(mobx.isObservableProp(a, \"someKey\")).toBe(true)\n    expect(mobx.isObservable(a.someKey)).toBe(true)\n    expect(mobx.isObservableProp(a.someKey, \"someNestedKey\")).toBe(true)\n    expect(mobx.isObservable(a.someKey.someNestedKey)).toBe(true) // Too bad: no deep merge with Object.assign! someKey object gets replaced in its entirity\n    expect(Array.isArray(a.someKey.someNestedKey)).toBe(false)\n})\n\ntest(\"compare structurally, ref\", () => {\n    const a = mobx.observable.object(\n        {\n            x: undefined\n        },\n        {\n            x: mobx.observable.struct\n        }\n    )\n\n    let changed = 0\n    const d = mobx.autorun(() => {\n        mobx.toJS(a)\n        changed++\n    })\n\n    expect(changed).toBe(1)\n    a.x = { y: 2 }\n    expect(changed).toBe(2)\n    a.x.y = 3\n    expect(mobx.isObservable(a.x)).toBe(false)\n    expect(changed).toBe(2)\n\n    a.x = { y: 3 }\n    expect(changed).toBe(2)\n\n    a.x = { y: 4 }\n    expect(changed).toBe(3)\n    a.x = { y: 4 }\n    expect(changed).toBe(3)\n\n    d()\n})\n\ntest(\"structural collections\", () => {\n    const o = mobx.observable(\n        {\n            x: [1, 2, 3]\n        },\n        {\n            x: mobx.observable.struct\n        }\n    )\n\n    expect(mobx.isObservable(o.x)).toBeFalsy()\n    const x = o.x\n    o.x = [1, 2, 3]\n    expect(o.x).toBe(x)\n    expect(() => {\n        o.x = mobx.observable([1, 2, 3])\n    }).toThrow(\"observable.struct should not be used with observable values\")\n})\n\ntest(\"yest object equals issue - reference\", () => {\n    class Store {\n        constructor() {\n            mobx.extendObservable(this, { x: 3 })\n        }\n    }\n\n    const store = new Store()\n    expect(store).toEqual(new Store())\n})\n\ntest(\"yest object equals issue\", () => {\n    class Store {\n        @mobx.observable x = 2\n\n        constructor() {\n            makeObservable(this)\n            this.x = 3\n        }\n    }\n\n    const store = new Store()\n    expect(store).toEqual(new Store())\n})\n\ntest(\"yest array equals issue\", () => {\n    class Store {\n        @mobx.observable things = []\n\n        constructor() {\n            makeObservable(this)\n        }\n    }\n\n    const store = new Store()\n    expect(store.things).toEqual([])\n})\n\ntest(\"#1650, toString is not treated correctly\", () => {\n    const o = { a: \"a\", toString: \"toString\" }\n    const oo = mobx.observable(o)\n    expect(oo.toString).toBe(\"toString\")\n})\n"
  },
  {
    "path": "packages/mobx/__tests__/v4/base/nested.js",
    "content": "\"use strict\"\n\nimport { extendObservable, observable, autorun, computed, runInAction } from \"../mobx4\"\n\ntest(\"nested computeds should not run unnecessary\", () => {\n    function Item(name) {\n        extendObservable(this, {\n            name: name,\n            get index() {\n                const i = store.items.indexOf(this)\n                if (i === -1) throw \"not found\"\n                return i\n            }\n        })\n    }\n\n    const store = observable({\n        items: [],\n        get asString() {\n            return this.items.map(item => item.index + \":\" + item.name).join(\",\")\n        }\n    })\n    store.items.push(new Item(\"item1\"))\n\n    const values = []\n    autorun(() => {\n        values.push(store.asString)\n    })\n\n    store.items.replace([new Item(\"item2\")])\n\n    expect(values).toEqual([\"0:item1\", \"0:item2\"])\n})\n\ntest(\"fix #1535: stale observables\", cb => {\n    // see https://codesandbox.io/s/k92o2jmz63\n    const snapshots = []\n\n    const x = observable.box(1)\n\n    // Depends on observable x\n    const derived1 = computed(() => {\n        return x.get() + 1\n    })\n\n    // Depends on computed derived1\n    const derived2 = computed(() => {\n        return derived1.get() + 1\n    })\n\n    function increment() {\n        runInAction(() => {\n            x.set(x.get() + 1)\n            // No problems here\n            derived1.get()\n            derived2.get()\n        })\n    }\n\n    function brokenIncrement() {\n        runInAction(() => x.set(x.get() + 1))\n        // Acessing computed outside of action causes staleness\n        // NOTE IT DOESN'T MATTER WHICH COMPUTED IS ACCESSED\n        // derived1.get();\n        derived2.get()\n    }\n\n    autorun(\n        () => {\n            snapshots.push(`${x.get()}, ${derived1.get()}, ${derived2.get()}`)\n        },\n        {\n            scheduler(f) {\n                setImmediate(f)\n            }\n        }\n    )\n\n    increment()\n    setTimeout(() => {\n        brokenIncrement()\n    }, 100)\n    setTimeout(() => {\n        expect(snapshots).toEqual([\"2, 3, 4\", \"3, 4, 5\"])\n        cb()\n    }, 1000)\n})\n"
  },
  {
    "path": "packages/mobx/__tests__/v4/base/object-api.js",
    "content": "const mobx = require(\"../mobx4\")\nconst { autorun, keys, when, set, remove, values, entries, reaction, observable, has, get } = mobx\n\ntest(\"keys should be observable when extending\", () => {\n    const todos = observable({})\n\n    const todoTitles = []\n    reaction(\n        () => keys(todos).map(key => `${key}: ${todos[key]}`),\n        titles => todoTitles.push(titles.join(\",\"))\n    )\n\n    mobx.set(todos, {\n        lewis: \"Read Lewis\",\n        chesterton: \"Be mind blown by Chesterton\"\n    })\n    expect(todoTitles).toEqual([\"lewis: Read Lewis,chesterton: Be mind blown by Chesterton\"])\n\n    mobx.set(todos, { lewis: \"Read Lewis twice\" })\n    mobx.set(todos, { coffee: \"Grab coffee\" })\n    expect(todoTitles).toEqual([\n        \"lewis: Read Lewis,chesterton: Be mind blown by Chesterton\",\n        \"lewis: Read Lewis twice,chesterton: Be mind blown by Chesterton\",\n        \"lewis: Read Lewis twice,chesterton: Be mind blown by Chesterton,coffee: Grab coffee\"\n    ])\n})\n\ntest(\"toJS respects key changes\", () => {\n    const todos = observable({})\n\n    const serialized = []\n    mobx.autorun(() => {\n        serialized.push(JSON.stringify(mobx.toJS(todos)))\n    })\n\n    mobx.set(todos, {\n        lewis: \"Read Lewis\",\n        chesterton: \"Be mind blown by Chesterton\"\n    })\n    mobx.set(todos, { lewis: \"Read Lewis twice\" })\n    mobx.set(todos, { coffee: \"Grab coffee\" })\n    expect(serialized).toEqual([\n        \"{}\",\n        '{\"lewis\":\"Read Lewis\",\"chesterton\":\"Be mind blown by Chesterton\"}',\n        '{\"lewis\":\"Read Lewis twice\",\"chesterton\":\"Be mind blown by Chesterton\"}',\n        '{\"lewis\":\"Read Lewis twice\",\"chesterton\":\"Be mind blown by Chesterton\",\"coffee\":\"Grab coffee\"}'\n    ])\n})\n\ntest(\"keys(object), values(object), entries(object)\", () => {\n    const todos = observable({})\n    const plain = {}\n    const keysSnapshots = []\n    const valuesSnapshots = []\n    const entriesSnapshots = []\n    const expectedKeysSnapshots = []\n    const expectedValuesSnapshots = []\n    const expectedEntriesSnapshots = []\n\n    const s1 = Symbol()\n    const s2 = Symbol()\n\n    function expectEquality() {\n        expect(todos).toEqual(plain)\n    }\n\n    function expectKeysReaction() {\n        expectedKeysSnapshots.push(Object.keys(plain))\n    }\n\n    function expectValuesReaction() {\n        expectedValuesSnapshots.push(Object.values(plain))\n    }\n\n    function expectEntriesReaction() {\n        expectedEntriesSnapshots.push(Object.entries(plain))\n    }\n\n    reaction(\n        () => keys(todos),\n        result => keysSnapshots.push(result)\n    )\n\n    reaction(\n        () => values(todos),\n        result => valuesSnapshots.push(result)\n    )\n\n    reaction(\n        () => entries(todos),\n        result => entriesSnapshots.push(result)\n    )\n\n    expectEquality()\n    // add\n    set(todos, \"k1\", 1)\n    plain[\"k1\"] = 1\n    expectEquality()\n    expectKeysReaction()\n    expectValuesReaction()\n    expectEntriesReaction()\n    // add symbol\n    set(todos, s1, 2)\n    plain[s1] = 2\n    expectEquality()\n    // see ObservableObjectAdministration.keys() for explanation\n    expectKeysReaction()\n    expectValuesReaction()\n    expectEntriesReaction()\n    // delete non-existent\n    remove(todos, \"-\")\n    delete plain[\"-\"]\n    expectEquality()\n    // delete non-existent symbol\n    remove(todos, Symbol())\n    delete plain[Symbol()]\n    expectEquality()\n    // add second\n    set(todos, \"k2\", 3)\n    plain[\"k2\"] = 3\n    expectEquality()\n    expectKeysReaction()\n    expectValuesReaction()\n    expectEntriesReaction()\n    // add second symbol\n    set(todos, s2, 4)\n    plain[s2] = 4\n    expectEquality()\n    // see ObservableObjectAdministration.keys() for explanation\n    expectKeysReaction()\n    expectValuesReaction()\n    expectEntriesReaction()\n    // update\n    set(todos, \"k1\", 11)\n    plain[\"k1\"] = 11\n    expectEquality()\n    expectValuesReaction()\n    expectEntriesReaction()\n    // update symbol\n    set(todos, s1, 22)\n    plain[s1] = 22\n    expectEquality()\n    // delete\n    remove(todos, \"k1\")\n    delete plain[\"k1\"]\n    expectEquality()\n    expectKeysReaction()\n    expectValuesReaction()\n    expectEntriesReaction()\n    // delete symbol\n    remove(todos, s1)\n    delete plain[s1]\n    expectEquality()\n    // see ObservableObjectAdministration.keys() for explanation\n    expectKeysReaction()\n    expectValuesReaction()\n    expectEntriesReaction()\n\n    expect(keysSnapshots).toEqual(expectedKeysSnapshots)\n    expect(valuesSnapshots).toEqual(expectedValuesSnapshots)\n    expect(entriesSnapshots).toEqual(expectedEntriesSnapshots)\n})\n\ntest(\"map - set, remove, values are reactive\", () => {\n    const todos = observable.map({})\n    const snapshots = []\n\n    reaction(\n        () => values(todos),\n        values => snapshots.push(values)\n    )\n\n    expect(has(todos, \"x\")).toBe(false)\n    expect(get(todos, \"x\")).toBe(undefined)\n    set(todos, \"x\", 3)\n    expect(has(todos, \"x\")).toBe(true)\n    expect(get(todos, \"x\")).toBe(3)\n    remove(todos, \"y\")\n    set(todos, \"z\", 4)\n    set(todos, \"x\", 5)\n    remove(todos, \"z\")\n\n    expect(snapshots).toEqual([[3], [3, 4], [5, 4], [5]])\n})\n\ntest(\"map - set, remove, entries are reactive\", () => {\n    const todos = observable.map({})\n    const snapshots = []\n\n    reaction(\n        () => entries(todos),\n        entries => snapshots.push(entries)\n    )\n\n    expect(has(todos, \"x\")).toBe(false)\n    expect(get(todos, \"x\")).toBe(undefined)\n    set(todos, \"x\", 3)\n    expect(has(todos, \"x\")).toBe(true)\n    expect(get(todos, \"x\")).toBe(3)\n    remove(todos, \"y\")\n    set(todos, \"z\", 4)\n    set(todos, \"x\", 5)\n    remove(todos, \"z\")\n\n    expect(snapshots).toEqual([\n        [[\"x\", 3]],\n        [\n            [\"x\", 3],\n            [\"z\", 4]\n        ],\n        [\n            [\"x\", 5],\n            [\"z\", 4]\n        ],\n        [[\"x\", 5]]\n    ])\n})\n\ntest(\"map - set, remove, keys are reactive\", () => {\n    const todos = observable.map({ a: 3 })\n    const snapshots = []\n\n    reaction(\n        () => keys(todos),\n        keys => snapshots.push(keys)\n    )\n\n    set(todos, \"x\", 3)\n    remove(todos, \"y\")\n    set(todos, \"z\", 4)\n    set(todos, \"x\", 5)\n    remove(todos, \"z\")\n    remove(todos, \"a\")\n\n    expect(snapshots).toEqual([[\"a\", \"x\"], [\"a\", \"x\", \"z\"], [\"a\", \"x\"], [\"x\"]])\n})\n\ntest(\"array - set, remove, values are reactive\", () => {\n    const todos = observable.array()\n    const snapshots = []\n\n    reaction(\n        () => values(todos),\n        values => snapshots.push(values)\n    )\n\n    expect(has(todos, 0)).toBe(false)\n    expect(get(todos, 0)).toBe(undefined)\n    set(todos, 0, 2)\n    expect(has(todos, 0)).toBe(true)\n    expect(get(todos, 0)).toBe(2)\n\n    set(todos, \"1\", 4)\n    set(todos, 3, 4)\n    set(todos, 1, 3)\n    remove(todos, 2)\n    remove(todos, \"0\")\n\n    expect(snapshots).toEqual([\n        [2],\n        [2, 4],\n        [2, 4, undefined, 4],\n        [2, 3, undefined, 4],\n        [2, 3, 4],\n        [3, 4]\n    ])\n})\n\ntest(\"array - set, remove, entries are reactive\", () => {\n    const todos = observable.array()\n    const snapshots = []\n\n    reaction(\n        () => entries(todos),\n        entries => snapshots.push(entries)\n    )\n\n    expect(has(todos, 0)).toBe(false)\n    expect(get(todos, 0)).toBe(undefined)\n    set(todos, 0, 2)\n    expect(has(todos, 0)).toBe(true)\n    expect(get(todos, 0)).toBe(2)\n\n    set(todos, \"1\", 4)\n    set(todos, 3, 4)\n    set(todos, 1, 3)\n    remove(todos, 2)\n    remove(todos, \"0\")\n\n    expect(snapshots).toEqual([\n        [[0, 2]],\n        [\n            [0, 2],\n            [1, 4]\n        ],\n        [\n            [0, 2],\n            [1, 4],\n            [2, undefined],\n            [3, 4]\n        ],\n        [\n            [0, 2],\n            [1, 3],\n            [2, undefined],\n            [3, 4]\n        ],\n        [\n            [0, 2],\n            [1, 3],\n            [2, 4]\n        ],\n        [\n            [0, 3],\n            [1, 4]\n        ]\n    ])\n})\n\ntest(\"array - set, remove, keys are reactive\", () => {\n    const todos = observable.array()\n    const snapshots = []\n\n    reaction(\n        () => keys(todos),\n        keys => snapshots.push(keys)\n    )\n\n    set(todos, 0, 2)\n    set(todos, \"1\", 4)\n    set(todos, 3, 4)\n    set(todos, 1, 3)\n    remove(todos, 2)\n    remove(todos, \"0\")\n\n    expect(snapshots).toEqual([[0], [0, 1], [0, 1, 2, 3], [0, 1, 2, 3], [0, 1, 2], [0, 1]])\n})\n\ntest(\"observe & intercept\", () => {\n    let events = []\n    const todos = observable(\n        {\n            a: { title: \"get coffee\" }\n        },\n        {},\n        { deep: false, name: \"TestObject\" }\n    )\n    mobx.observe(todos, c => events.push({ observe: c }))\n    const d = mobx.intercept(todos, c => {\n        events.push({ intercept: c })\n        return null // no addition!\n    })\n\n    set(todos, { b: { title: \"get tea\" } })\n    remove(todos, \"a\")\n    expect(events).toMatchSnapshot()\n    expect(mobx.toJS(todos)).toEqual({\n        a: { title: \"get coffee\" }\n    })\n\n    events.splice(0)\n    d()\n    set(todos, { b: { title: \"get tea\" } })\n    remove(todos, \"a\")\n    expect(events).toMatchSnapshot()\n    expect(mobx.toJS(todos)).toEqual({\n        b: { title: \"get tea\" }\n    })\n})\n\ntest(\"observe & intercept set called multiple times\", () => {\n    const a = mobx.observable({})\n    const interceptLogs = []\n    const observeLogs = []\n\n    mobx.intercept(a, change => {\n        interceptLogs.push(`${change.name}: ${change.newValue}`)\n        return change\n    })\n    mobx.observe(a, change => observeLogs.push(`${change.name}: ${change.newValue}`))\n\n    mobx.set(a, \"x\", 0)\n    a.x = 1\n    mobx.set(a, \"x\", 2)\n\n    expect(interceptLogs).toEqual([\"x: 0\", \"x: 1\", \"x: 2\"])\n    expect(observeLogs).toEqual([\"x: 0\", \"x: 1\", \"x: 2\"])\n})\n\ntest(\"dynamically adding properties should preserve the original modifiers of an object\", () => {\n    const todos = observable(\n        {\n            a: { title: \"get coffee\" }\n        },\n        {},\n        { deep: false }\n    )\n    expect(mobx.isObservable(todos.a)).toBe(false)\n    set(todos, { b: { title: \"get tea\" } })\n    expect(mobx.isObservable(todos.b)).toBe(false)\n})\n\ntest(\"has and get are reactive\", async () => {\n    const todos = observable({})\n\n    const p1 = when(() => has(todos, \"x\"))\n    const p2 = when(() => get(todos, \"y\") === 3)\n\n    setTimeout(() => {\n        set(todos, { x: false, y: 3 })\n    }, 100)\n\n    await p1\n    await p2\n})\n\ntest(\"computed props are considered part of collections\", () => {\n    const x = observable({\n        get y() {\n            return 3\n        }\n    })\n    expect(mobx.isComputedProp(x, \"y\")).toBe(true)\n    expect(x.y).toBe(3)\n    expect(has(x, \"y\")).toBe(true)\n    expect(get(x, \"y\")).toBe(3)\n    expect(keys(x)).toEqual([])\n    expect(values(x)).toEqual([])\n    expect(entries(x)).toEqual([])\n})\n\ntest(\"#1739 - delete and undelete should work\", () => {\n    const x = observable({})\n\n    const events = []\n    autorun(() => {\n        events.push(has(x, \"a\"))\n    })\n\n    set(x, \"a\", 1)\n    set(x, \"a\", 2)\n    remove(x, \"a\")\n    set(x, \"a\", 2)\n    remove(x, \"a\")\n    set(x, \"a\", 3)\n    expect(events).toEqual([false, true, false, true, false, true])\n})\n\ntest(\"set - set, remove, keys are reactive\", () => {\n    const todos = observable.set([1])\n    const snapshots = []\n\n    reaction(\n        () => keys(todos),\n        keys => snapshots.push(keys)\n    )\n\n    set(todos, 2)\n    remove(todos, 2)\n    set(todos, 3)\n    set(todos, 4)\n    remove(todos, 3)\n\n    expect(snapshots).toEqual([[1, 2], [1], [1, 3], [1, 3, 4], [1, 4]])\n})\n\ntest(\"defineProperty - configurable: false\", () => {\n    const obj = mobx.observable({})\n    const desc = {\n        enumerable: true,\n        configurable: false,\n        writable: true,\n        value: 0\n    }\n    mobx.defineProperty(obj, \"foo\", desc)\n    expect(Object.getOwnPropertyDescriptor(obj, \"foo\")).toEqual(desc)\n    expect(mobx.isObservableProp(obj, \"foo\")).toBe(false)\n    obj.foo++\n    expect(obj.foo).toBe(1)\n    expect(() => mobx.extendObservable(obj, { foo: 0 })).toThrow(TypeError)\n    expect(() => mobx.makeObservable(obj, { foo: mobx.observable })).toThrow(TypeError)\n    expect(() => mobx.defineProperty(obj, \"foo\", { configurable: false })).toThrow(TypeError)\n})\n\ntest(\"defineProperty - writable: false\", () => {\n    const obj = mobx.observable({})\n    const desc = {\n        enumerable: true,\n        configurable: true,\n        writable: false,\n        value: 0\n    }\n    mobx.defineProperty(obj, \"foo\", desc)\n    expect(Object.getOwnPropertyDescriptor(obj, \"foo\")).toEqual(desc)\n    expect(mobx.isObservableProp(obj, \"foo\")).toBe(false)\n    expect(() => obj.foo++).toThrow(TypeError)\n    mobx.extendObservable(obj, { foo: 0 })\n    expect(mobx.isObservableProp(obj, \"foo\")).toBe(true)\n    obj.foo++\n    expect(obj.foo).toBe(1)\n})\n\ntest(\"defineProperty - redefine observable\", () => {\n    const obj = mobx.observable({ foo: 0 })\n    expect(mobx.isObservableProp(obj, \"foo\")).toBe(true)\n    const desc = {\n        enumerable: true,\n        configurable: true,\n        writable: false,\n        value: 0\n    }\n    mobx.defineProperty(obj, \"foo\", desc)\n    expect(Object.getOwnPropertyDescriptor(obj, \"foo\")).toEqual(desc)\n    expect(mobx.isObservableProp(obj, \"foo\")).toBe(false)\n})\n\ntest(\"defineProperty notifies keys observers\", () => {\n    const obj = mobx.observable({})\n    let reactionCount = 0\n    reaction(\n        () => mobx.keys(obj),\n        () => reactionCount++\n    )\n\n    const desc = {\n        enumerable: true,\n        configurable: true,\n        writable: true,\n        value: 0\n    }\n    mobx.defineProperty(obj, \"foo\", desc)\n    expect(Object.getOwnPropertyDescriptor(obj, \"foo\")).toEqual(desc)\n    expect(mobx.isObservableProp(obj, \"foo\")).toBe(false)\n    expect(reactionCount).toBe(1)\n    mobx.remove(obj, 'foo')\n    expect(obj.hasOwnProperty(\"foo\")).toBe(false)\n    expect(reactionCount).toBe(2)\n})"
  },
  {
    "path": "packages/mobx/__tests__/v4/base/observables.js",
    "content": "\"use strict\"\n\nconst mobx = require(\"../mobx4\")\nconst m = mobx\nconst { $mobx, makeObservable, observable, computed, transaction, autorun, extendObservable } = mobx\nconst utils = require(\"../../v5/utils/test-utils\")\n\nconst voidObserver = function () {}\n\nfunction buffer() {\n    const b = []\n    const res = function (x) {\n        if (typeof x.newValue === \"object\") {\n            const copy = { ...x.newValue }\n            delete copy[$mobx]\n            b.push(copy)\n        } else {\n            b.push(x.newValue)\n        }\n    }\n    res.toArray = function () {\n        return b\n    }\n    return res\n}\n\ntest(\"argumentless observable\", () => {\n    const a = observable.box()\n\n    expect(m.isObservable(a)).toBe(true)\n    expect(a.get()).toBe(undefined)\n})\n\ntest(\"basic\", function () {\n    const x = observable.box(3)\n    const b = buffer()\n    m.observe(x, b)\n    expect(3).toBe(x.get())\n\n    x.set(5)\n    expect(5).toBe(x.get())\n    expect([5]).toEqual(b.toArray())\n    expect(mobx._isComputingDerivation()).toBe(false)\n})\n\ntest(\"basic2\", function () {\n    const x = observable.box(3)\n    const z = computed(function () {\n        return x.get() * 2\n    })\n    const y = computed(function () {\n        return x.get() * 3\n    })\n\n    m.observe(z, voidObserver)\n\n    expect(z.get()).toBe(6)\n    expect(y.get()).toBe(9)\n\n    x.set(5)\n    expect(z.get()).toBe(10)\n    expect(y.get()).toBe(15)\n\n    expect(mobx._isComputingDerivation()).toBe(false)\n})\n\ntest(\"computed with asStructure modifier\", function () {\n    const x1 = observable.box(3)\n    const x2 = observable.box(5)\n    const y = m.computed(\n        function () {\n            return {\n                sum: x1.get() + x2.get()\n            }\n        },\n        { compareStructural: true }\n    )\n    const b = buffer()\n    m.observe(y, b, true)\n\n    expect(8).toBe(y.get().sum)\n\n    x1.set(4)\n    expect(9).toBe(y.get().sum)\n\n    m.transaction(function () {\n        // swap values, computation results is structuraly unchanged\n        x1.set(5)\n        x2.set(4)\n    })\n\n    expect(b.toArray()).toEqual([{ sum: 8 }, { sum: 9 }])\n    expect(mobx._isComputingDerivation()).toBe(false)\n})\n\ntest(\"dynamic\", function (done) {\n    try {\n        const x = observable.box(3)\n        const y = m.computed(function () {\n            return x.get()\n        })\n        const b = buffer()\n        m.observe(y, b, true)\n\n        expect(3).toBe(y.get()) // First evaluation here..\n\n        x.set(5)\n        expect(5).toBe(y.get())\n\n        expect(b.toArray()).toEqual([3, 5])\n        expect(mobx._isComputingDerivation()).toBe(false)\n\n        done()\n    } catch (e) {\n        console.log(e.stack)\n    }\n})\n\ntest(\"dynamic2\", function (done) {\n    try {\n        const x = observable.box(3)\n        const y = computed(function () {\n            return x.get() * x.get()\n        })\n\n        expect(9).toBe(y.get())\n        const b = buffer()\n        m.observe(y, b)\n\n        x.set(5)\n        expect(25).toBe(y.get())\n\n        //no intermediate value 15!\n        expect([25]).toEqual(b.toArray())\n        expect(mobx._isComputingDerivation()).toBe(false)\n\n        done()\n    } catch (e) {\n        console.log(e.stack)\n    }\n})\n\ntest(\"box uses equals\", function (done) {\n    try {\n        const x = observable.box(\"a\", {\n            equals: (oldValue, newValue) => {\n                return oldValue.toLowerCase() === newValue.toLowerCase()\n            }\n        })\n\n        const b = buffer()\n        m.observe(x, b)\n\n        x.set(\"A\")\n        x.set(\"b\")\n        x.set(\"B\")\n        x.set(\"C\")\n\n        expect([\"b\", \"C\"]).toEqual(b.toArray())\n        expect(mobx._isComputingDerivation()).toBe(false)\n\n        done()\n    } catch (e) {\n        console.log(e.stack)\n    }\n})\n\ntest(\"box uses equals2\", function (done) {\n    try {\n        const x = observable.box(\"01\", {\n            equals: (oldValue, newValue) => {\n                return parseInt(oldValue) === parseInt(newValue)\n            }\n        })\n\n        const y = computed(function () {\n            return parseInt(x)\n        })\n\n        const b = buffer()\n        m.observe(y, b)\n\n        x.set(\"2\")\n        x.set(\"02\")\n        x.set(\"002\")\n        x.set(\"03\")\n\n        expect([2, 3]).toEqual(b.toArray())\n        expect(mobx._isComputingDerivation()).toBe(false)\n\n        done()\n    } catch (e) {\n        console.log(e.stack)\n    }\n})\n\ntest(\"readme1\", function (done) {\n    try {\n        const b = buffer()\n\n        const vat = observable.box(0.2)\n        const order = {}\n        order.price = observable.box(10)\n        // Prints: New price: 24\n        // in TS, just: value(() => this.price() * (1+vat()))\n        order.priceWithVat = computed(function () {\n            return order.price.get() * (1 + vat.get())\n        })\n\n        m.observe(order.priceWithVat, b)\n\n        order.price.set(20)\n        expect([24]).toEqual(b.toArray())\n        order.price.set(10)\n        expect([24, 12]).toEqual(b.toArray())\n        expect(mobx._isComputingDerivation()).toBe(false)\n\n        done()\n    } catch (e) {\n        console.log(e.stack)\n        throw e\n    }\n})\n\ntest(\"batch\", function () {\n    const a = observable.box(2)\n    const b = observable.box(3)\n    const c = computed(function () {\n        return a.get() * b.get()\n    })\n    const d = computed(function () {\n        return c.get() * b.get()\n    })\n    const buf = buffer()\n    m.observe(d, buf)\n\n    a.set(4)\n    b.set(5)\n    // Note, 60 should not happen! (that is d begin computed before c after update of b)\n    expect(buf.toArray()).toEqual([36, 100])\n\n    const x = mobx.transaction(function () {\n        a.set(2)\n        b.set(3)\n        a.set(6)\n        expect(d.value_).toBe(100) // not updated; in transaction\n        expect(d.get()).toBe(54) // consistent due to inspection\n        return 2\n    })\n\n    expect(x).toBe(2) // test return value\n    expect(buf.toArray()).toEqual([36, 100, 54]) // only one new value for d\n})\n\ntest(\"transaction with inspection\", function () {\n    const a = observable.box(2)\n    let calcs = 0\n    const b = computed(function () {\n        calcs++\n        return a.get() * 2\n    })\n\n    // if not inspected during transaction, postpone value to end\n    mobx.transaction(function () {\n        a.set(3)\n        expect(b.get()).toBe(6)\n        expect(calcs).toBe(1)\n    })\n    expect(b.get()).toBe(6)\n    expect(calcs).toBe(2)\n\n    // if inspected, evaluate eagerly\n    mobx.transaction(function () {\n        a.set(4)\n        expect(b.get()).toBe(8)\n        expect(calcs).toBe(3)\n    })\n    expect(b.get()).toBe(8)\n    expect(calcs).toBe(4)\n})\n\ntest(\"transaction with inspection 2\", function () {\n    const a = observable.box(2)\n    let calcs = 0\n    let b\n    mobx.autorun(function () {\n        calcs++\n        b = a.get() * 2\n    })\n\n    // if not inspected during transaction, postpone value to end\n    mobx.transaction(function () {\n        a.set(3)\n        expect(b).toBe(4)\n        expect(calcs).toBe(1)\n    })\n    expect(b).toBe(6)\n    expect(calcs).toBe(2)\n\n    // if inspected, evaluate eagerly\n    mobx.transaction(function () {\n        a.set(4)\n        expect(b).toBe(6)\n        expect(calcs).toBe(2)\n    })\n    expect(b).toBe(8)\n    expect(calcs).toBe(3)\n})\n\ntest(\"scope\", function () {\n    const vat = observable.box(0.2)\n    const Order = function () {\n        this.price = observable.box(20)\n        this.amount = observable.box(2)\n        this.total = computed(\n            function () {\n                return (1 + vat.get()) * this.price.get() * this.amount.get()\n            },\n            { context: this }\n        )\n    }\n\n    const order = new Order()\n    m.observe(order.total, voidObserver)\n    order.price.set(10)\n    order.amount.set(3)\n    expect(36).toBe(order.total.get())\n    expect(mobx._isComputingDerivation()).toBe(false)\n})\n\ntest(\"props1\", function () {\n    const vat = observable.box(0.2)\n    const Order = function () {\n        mobx.extendObservable(this, {\n            price: 20,\n            amount: 2,\n            get total() {\n                return (1 + vat.get()) * this.price * this.amount // price and amount are now properties!\n            }\n        })\n    }\n\n    const order = new Order()\n    expect(48).toBe(order.total)\n    order.price = 10\n    order.amount = 3\n    expect(36).toBe(order.total)\n\n    const totals = []\n    const sub = mobx.autorun(function () {\n        totals.push(order.total)\n    })\n    order.amount = 4\n    sub()\n    order.amount = 5\n    expect(totals).toEqual([36, 48])\n\n    expect(mobx._isComputingDerivation()).toBe(false)\n})\n\ntest(\"props2\", function () {\n    const vat = observable.box(0.2)\n    const Order = function () {\n        mobx.extendObservable(this, {\n            price: 20,\n            amount: 2,\n            get total() {\n                return (1 + vat.get()) * this.price * this.amount // price and amount are now properties!\n            }\n        })\n    }\n\n    const order = new Order()\n    expect(48).toBe(order.total)\n    order.price = 10\n    order.amount = 3\n    expect(36).toBe(order.total)\n})\n\ntest(\"props4\", function () {\n    function Bzz() {\n        mobx.extendObservable(this, {\n            fluff: [1, 2],\n            get sum() {\n                return this.fluff.reduce(function (a, b) {\n                    return a + b\n                }, 0)\n            }\n        })\n    }\n\n    const x = new Bzz()\n    x.fluff\n    expect(x.sum).toBe(3)\n    x.fluff.push(3)\n    expect(x.sum).toBe(6)\n    x.fluff = [5, 6]\n    expect(x.sum).toBe(11)\n    x.fluff.push(2)\n    expect(x.sum).toBe(13)\n})\n\ntest(\"object enumerable props\", function () {\n    const x = mobx.observable({\n        a: 3,\n        get b() {\n            return 2 * this.a\n        }\n    })\n    mobx.extendObservable(x, { c: 4 })\n    const ar = []\n    for (const key in x) ar.push(key)\n    expect(ar).toEqual([\"a\", \"c\"])\n})\n\ntest(\"observe property\", function () {\n    const sb = []\n    const mb = []\n\n    const Wrapper = function (chocolateBar) {\n        mobx.extendObservable(this, {\n            chocolateBar: chocolateBar,\n            get calories() {\n                return this.chocolateBar.calories\n            }\n        })\n    }\n\n    const snickers = mobx.observable({\n        calories: null\n    })\n    const mars = mobx.observable({\n        calories: undefined\n    })\n\n    const wrappedSnickers = new Wrapper(snickers)\n    const wrappedMars = new Wrapper(mars)\n\n    const disposeSnickers = mobx.autorun(function () {\n        sb.push(wrappedSnickers.calories)\n    })\n    const disposeMars = mobx.autorun(function () {\n        mb.push(wrappedMars.calories)\n    })\n    snickers.calories = 10\n    mars.calories = 15\n\n    disposeSnickers()\n    disposeMars()\n    snickers.calories = 5\n    mars.calories = 7\n\n    expect(sb).toEqual([null, 10])\n    expect(mb).toEqual([undefined, 15])\n})\n\ntest(\"observe object\", function () {\n    let events = []\n    const a = observable({\n        a: 1,\n        get da() {\n            return this.a * 2\n        }\n    })\n    const stop = m.observe(a, function (change) {\n        expect(change.observableKind).toEqual(\"object\")\n        delete change.observableKind\n        delete change.debugObjectName\n        events.push(change)\n    })\n\n    a.a = 2\n    mobx.extendObservable(a, {\n        b: 3\n    })\n    a.a = 4\n    a.b = 5\n    expect(events).toEqual([\n        {\n            type: \"update\",\n            object: a,\n            name: \"a\",\n            newValue: 2,\n            oldValue: 1\n        },\n        {\n            type: \"add\",\n            object: a,\n            newValue: 3,\n            name: \"b\"\n        },\n        {\n            type: \"update\",\n            object: a,\n            name: \"a\",\n            newValue: 4,\n            oldValue: 2\n        },\n        {\n            type: \"update\",\n            object: a,\n            name: \"b\",\n            newValue: 5,\n            oldValue: 3\n        }\n    ])\n\n    stop()\n    events = []\n    a.a = 6\n    expect(events.length).toBe(0)\n})\n\ntest(\"mobx.observe\", function () {\n    const events = []\n    const o = observable({ b: 2 })\n    const ar = observable([3])\n    const map = mobx.observable.map({})\n\n    const push = function (event) {\n        delete event.debugObjectName\n        events.push(event)\n    }\n\n    const stop2 = mobx.observe(o, push)\n    const stop3 = mobx.observe(ar, push)\n    const stop4 = mobx.observe(map, push)\n\n    o.b = 5\n    ar[0] = 6\n    map.set(\"d\", 7)\n\n    stop2()\n    stop3()\n    stop4()\n\n    o.b = 9\n    ar[0] = 10\n    map.set(\"d\", 11)\n\n    expect(events).toEqual([\n        {\n            type: \"update\",\n            observableKind: \"object\",\n            object: o,\n            name: \"b\",\n            newValue: 5,\n            oldValue: 2\n        },\n        {\n            type: \"update\",\n            observableKind: \"array\",\n            object: ar,\n            index: 0,\n            newValue: 6,\n            oldValue: 3\n        },\n        {\n            type: \"add\",\n            observableKind: \"map\",\n            object: map,\n            newValue: 7,\n            name: \"d\"\n        }\n    ])\n})\n\ntest(\"change count optimization\", function () {\n    let bCalcs = 0\n    let cCalcs = 0\n    const a = observable.box(3)\n    const b = computed(function () {\n        bCalcs += 1\n        return 4 + a.get() - a.get()\n    })\n    const c = computed(function () {\n        cCalcs += 1\n        return b.get()\n    })\n\n    m.observe(c, voidObserver)\n\n    expect(b.get()).toBe(4)\n    expect(c.get()).toBe(4)\n    expect(bCalcs).toBe(1)\n    expect(cCalcs).toBe(1)\n\n    a.set(5)\n\n    expect(b.get()).toBe(4)\n    expect(c.get()).toBe(4)\n    expect(bCalcs).toBe(2)\n    expect(cCalcs).toBe(1)\n\n    expect(mobx._isComputingDerivation()).toBe(false)\n})\n\ntest(\"observables removed\", function () {\n    let calcs = 0\n    const a = observable.box(1)\n    const b = observable.box(2)\n    const c = computed(function () {\n        calcs++\n        if (a.get() === 1) return b.get() * a.get() * b.get()\n        return 3\n    })\n\n    expect(calcs).toBe(0)\n    m.observe(c, voidObserver)\n    expect(c.get()).toBe(4)\n    expect(calcs).toBe(1)\n    a.set(2)\n    expect(c.get()).toBe(3)\n    expect(calcs).toBe(2)\n\n    b.set(3) // should not retrigger calc\n    expect(c.get()).toBe(3)\n    expect(calcs).toBe(2)\n\n    a.set(1)\n    expect(c.get()).toBe(9)\n    expect(calcs).toBe(3)\n\n    expect(mobx._isComputingDerivation()).toBe(false)\n})\n\ntest(\"lazy evaluation\", function () {\n    let bCalcs = 0\n    let cCalcs = 0\n    let dCalcs = 0\n    let observerChanges = 0\n\n    const a = observable.box(1)\n    const b = computed(function () {\n        bCalcs += 1\n        return a.get() + 1\n    })\n\n    const c = computed(function () {\n        cCalcs += 1\n        return b.get() + 1\n    })\n\n    expect(bCalcs).toBe(0)\n    expect(cCalcs).toBe(0)\n    expect(c.get()).toBe(3)\n    expect(bCalcs).toBe(1)\n    expect(cCalcs).toBe(1)\n\n    expect(c.get()).toBe(3)\n    expect(bCalcs).toBe(2)\n    expect(cCalcs).toBe(2)\n\n    a.set(2)\n    expect(bCalcs).toBe(2)\n    expect(cCalcs).toBe(2)\n\n    expect(c.get()).toBe(4)\n    expect(bCalcs).toBe(3)\n    expect(cCalcs).toBe(3)\n\n    const d = computed(function () {\n        dCalcs += 1\n        return b.get() * 2\n    })\n\n    const handle = m.observe(\n        d,\n        function () {\n            observerChanges += 1\n        },\n        false\n    )\n    expect(bCalcs).toBe(4)\n    expect(cCalcs).toBe(3)\n    expect(dCalcs).toBe(1) // d is evaluated, so that its dependencies are known\n\n    a.set(3)\n    expect(d.get()).toBe(8)\n    expect(bCalcs).toBe(5)\n    expect(cCalcs).toBe(3)\n    expect(dCalcs).toBe(2)\n\n    expect(c.get()).toBe(5)\n    expect(bCalcs).toBe(5)\n    expect(cCalcs).toBe(4)\n    expect(dCalcs).toBe(2)\n\n    expect(b.get()).toBe(4)\n    expect(bCalcs).toBe(5)\n    expect(cCalcs).toBe(4)\n    expect(dCalcs).toBe(2)\n\n    handle() // unlisten\n    expect(d.get()).toBe(8)\n    expect(bCalcs).toBe(6) // gone to sleep\n    expect(cCalcs).toBe(4)\n    expect(dCalcs).toBe(3)\n\n    expect(observerChanges).toBe(1)\n\n    expect(mobx._isComputingDerivation()).toBe(false)\n})\n\ntest(\"multiple view dependencies\", function () {\n    let bCalcs = 0\n    let dCalcs = 0\n    const a = observable.box(1)\n    const b = computed(function () {\n        bCalcs++\n        return 2 * a.get()\n    })\n    const c = observable.box(2)\n    const d = computed(function () {\n        dCalcs++\n        return 3 * c.get()\n    })\n\n    let zwitch = true\n    const buffer = []\n    let fCalcs = 0\n    const dis = mobx.autorun(function () {\n        fCalcs++\n        if (zwitch) buffer.push(b.get() + d.get())\n        else buffer.push(d.get() + b.get())\n    })\n\n    zwitch = false\n    c.set(3)\n    expect(bCalcs).toBe(1)\n    expect(dCalcs).toBe(2)\n    expect(fCalcs).toBe(2)\n    expect(buffer).toEqual([8, 11])\n\n    c.set(4)\n    expect(bCalcs).toBe(1)\n    expect(dCalcs).toBe(3)\n    expect(fCalcs).toBe(3)\n    expect(buffer).toEqual([8, 11, 14])\n\n    dis()\n    c.set(5)\n    expect(bCalcs).toBe(1)\n    expect(dCalcs).toBe(3)\n    expect(fCalcs).toBe(3)\n    expect(buffer).toEqual([8, 11, 14])\n})\n\ntest(\"nested observable2\", function () {\n    const factor = observable.box(0)\n    const price = observable.box(100)\n    let totalCalcs = 0\n    let innerCalcs = 0\n\n    const total = computed(function () {\n        totalCalcs += 1 // outer observable shouldn't recalc if inner observable didn't publish a real change\n        return (\n            price.get() *\n            computed(function () {\n                innerCalcs += 1\n                return factor.get() % 2 === 0 ? 1 : 3\n            }).get()\n        )\n    })\n\n    const b = []\n    m.observe(\n        total,\n        function (x) {\n            b.push(x.newValue)\n        },\n        true\n    )\n\n    price.set(150)\n    factor.set(7) // triggers innerCalc twice, because changing the outcome triggers the outer calculation which recreates the inner calculation\n    factor.set(5) // doesn't trigger outer calc\n    factor.set(3) // doesn't trigger outer calc\n    factor.set(4) // triggers innerCalc twice\n    price.set(20)\n\n    expect(b).toEqual([100, 150, 450, 150, 20])\n    expect(innerCalcs).toBe(9)\n    expect(totalCalcs).toBe(5)\n})\n\ntest(\"observe\", function () {\n    const x = observable.box(3)\n    const x2 = computed(function () {\n        return x.get() * 2\n    })\n    const b = []\n\n    const cancel = mobx.autorun(function () {\n        b.push(x2.get())\n    })\n\n    x.set(4)\n    x.set(5)\n    expect(b).toEqual([6, 8, 10])\n    cancel()\n    x.set(7)\n    expect(b).toEqual([6, 8, 10])\n})\n\ntest(\"when\", function () {\n    const x = observable.box(3)\n\n    let called = 0\n    mobx.when(\n        function () {\n            return x.get() === 4\n        },\n        function () {\n            called += 1\n        }\n    )\n\n    x.set(5)\n    expect(called).toBe(0)\n    x.set(4)\n    expect(called).toBe(1)\n    x.set(3)\n    expect(called).toBe(1)\n    x.set(4)\n    expect(called).toBe(1)\n})\n\ntest(\"when 2\", function () {\n    const x = observable.box(3)\n\n    let called = 0\n    const d = mobx.when(\n        function () {\n            return x.get() === 3\n        },\n        function () {\n            called += 1\n        },\n        { name: \"when x is 3\" }\n    )\n\n    expect(called).toBe(1)\n    x.set(5)\n    x.set(3)\n    expect(called).toBe(1)\n\n    expect(d[$mobx].name_).toBe(\"when x is 3\")\n})\n\nfunction stripSpyOutput(events) {\n    events.forEach(ev => {\n        delete ev.time\n        delete ev.fn\n        delete ev.object\n    })\n    return events\n}\n\ntest(\"issue 50\", function (done) {\n    m._resetGlobalState()\n    mobx._getGlobalState().mobxGuid = 0\n    const x = observable({\n        a: true,\n        b: false,\n        get c() {\n            events.push(\"calc c\")\n            return this.b\n        }\n    })\n\n    let result\n    const events = []\n    const disposer1 = mobx.autorun(function ar() {\n        events.push(\"auto\")\n        result = [x.a, x.b, x.c].join(\",\")\n    })\n\n    const disposer2 = mobx.spy(function (info) {\n        events.push(info)\n    })\n\n    setTimeout(function () {\n        mobx.transaction(function () {\n            events.push(\"transstart\")\n            x.a = !x.a\n            x.b = !x.b\n            events.push(\"transpreend\")\n        })\n        events.push(\"transpostend\")\n        expect(result).toBe(\"false,true,true\")\n        expect(x.c).toBe(x.b)\n\n        expect(stripSpyOutput(events)).toMatchSnapshot()\n\n        disposer1()\n        disposer2()\n        done()\n    }, 500)\n})\n\ntest(\"verify transaction events\", function () {\n    m._resetGlobalState()\n    mobx._getGlobalState().mobxGuid = 0\n\n    const x = observable({\n        b: 1,\n        get c() {\n            events.push(\"calc c\")\n            return this.b\n        }\n    })\n\n    const events = []\n    const disposer1 = mobx.autorun(function ar() {\n        events.push(\"auto\")\n        x.c\n    })\n\n    const disposer2 = mobx.spy(function (info) {\n        events.push(info)\n    })\n\n    mobx.transaction(function () {\n        events.push(\"transstart\")\n        x.b = 1\n        x.b = 2\n        events.push(\"transpreend\")\n    })\n    events.push(\"transpostend\")\n\n    expect(stripSpyOutput(events)).toMatchSnapshot()\n\n    disposer1()\n    disposer2()\n})\n\ntest(\"verify array in transaction\", function () {\n    const ar = observable([])\n    let aCount = 0\n    let aValue\n\n    mobx.autorun(function () {\n        aCount++\n        aValue = 0\n        for (let i = 0; i < ar.length; i++) aValue += ar[i]\n    })\n\n    mobx.transaction(function () {\n        ar.push(2)\n        ar.push(3)\n        ar.push(4)\n        ar.unshift(1)\n    })\n    expect(aValue).toBe(10)\n    expect(aCount).toBe(2)\n})\n\ntest(\"delay autorun until end of transaction\", function () {\n    m._resetGlobalState()\n    mobx._getGlobalState().mobxGuid = 0\n    const events = []\n    const x = observable({\n        a: 2,\n        get b() {\n            events.push(\"calc y\")\n            return this.a\n        }\n    })\n    let disposer1\n    const disposer2 = mobx.spy(function (info) {\n        events.push(info)\n    })\n    let didRun = false\n\n    mobx.transaction(function () {\n        mobx.transaction(function () {\n            disposer1 = mobx.autorun(function test() {\n                didRun = true\n                events.push(\"auto\")\n                x.b\n            })\n\n            expect(didRun).toBe(false)\n\n            x.a = 3\n            x.a = 4\n\n            events.push(\"end1\")\n        })\n        expect(didRun).toBe(false)\n        x.a = 5\n        events.push(\"end2\")\n    })\n\n    expect(didRun).toBe(true)\n    events.push(\"post trans1\")\n    x.a = 6\n    events.push(\"post trans2\")\n    disposer1()\n    x.a = 3\n    events.push(\"post trans3\")\n\n    expect(stripSpyOutput(events)).toMatchSnapshot()\n\n    disposer2()\n})\n\ntest(\"computed values believe NaN === NaN\", function () {\n    const a = observable.box(2)\n    const b = observable.box(3)\n    const c = computed(function () {\n        return String(a.get() * b.get())\n    })\n    const buf = buffer()\n    m.observe(c, buf)\n\n    a.set(NaN)\n    b.set(NaN)\n    a.set(NaN)\n    a.set(2)\n    b.set(3)\n\n    expect(buf.toArray()).toEqual([\"NaN\", \"6\"])\n})\n\ntest(\"computed values believe deep NaN === deep NaN when using compareStructural\", function () {\n    const a = observable({ b: { a: 1 } })\n    const c = computed(\n        function () {\n            return a.b\n        },\n        { compareStructural: true }\n    )\n\n    const buf = new buffer()\n    m.observe(c, newValue => {\n        buf(newValue)\n    })\n\n    a.b = { a: NaN }\n    a.b = { a: NaN }\n    a.b = { a: NaN }\n    a.b = { a: 2 }\n    a.b = { a: NaN }\n\n    const bufArray = buf.toArray()\n    expect(isNaN(bufArray[0].b)).toBe(true)\n    expect(bufArray[1]).toEqual({ a: 2 })\n    expect(isNaN(bufArray[2].b)).toEqual(true)\n    expect(bufArray.length).toBe(3)\n})\n\ntest(\"issue 71, transacting running transformation\", function () {\n    const state = mobx.observable({\n        things: []\n    })\n\n    function Thing(value) {\n        mobx.extendObservable(this, {\n            value: value,\n            get pos() {\n                return state.things.indexOf(this)\n            },\n            get isVisible() {\n                return this.pos !== -1\n            }\n        })\n\n        mobx.when(\n            () => {\n                return this.isVisible\n            },\n            () => {\n                if (this.pos < 4) state.things.push(new Thing(value + 1))\n            }\n        )\n    }\n\n    let copy\n    let vSum\n    mobx.autorun(function () {\n        copy = state.things.map(function (thing) {\n            return thing.value\n        })\n        vSum = state.things.reduce(function (a, thing) {\n            return a + thing.value\n        }, 0)\n    })\n\n    expect(copy).toEqual([])\n\n    mobx.transaction(function () {\n        state.things.push(new Thing(1))\n    })\n\n    expect(copy).toEqual([1, 2, 3, 4, 5])\n    expect(vSum).toBe(15)\n\n    state.things.splice(0, 2)\n    state.things.push(new Thing(6))\n\n    expect(copy).toEqual([3, 4, 5, 6, 7])\n    expect(vSum).toBe(25)\n})\n\ntest(\"eval in transaction\", function () {\n    let bCalcs = 0\n    const x = mobx.observable({\n        a: 1,\n        get b() {\n            bCalcs++\n            return this.a * 2\n        }\n    })\n    let c\n\n    mobx.autorun(function () {\n        c = x.b\n    })\n\n    expect(bCalcs).toBe(1)\n    expect(c).toBe(2)\n\n    mobx.transaction(function () {\n        x.a = 3\n        expect(x.b).toBe(6)\n        expect(bCalcs).toBe(2)\n        expect(c).toBe(2)\n\n        x.a = 4\n        expect(x.b).toBe(8)\n        expect(bCalcs).toBe(3)\n        expect(c).toBe(2)\n    })\n    expect(bCalcs).toBe(3) // 2 or 3 would be fine as well\n    expect(c).toBe(8)\n})\n\ntest(\"forcefully tracked reaction should still yield valid results\", function () {\n    const x = observable.box(3)\n    let z\n    let runCount = 0\n    const identity = function () {\n        runCount++\n        z = x.get()\n    }\n    const a = new mobx.Reaction(\"test\", function () {\n        this.track(identity)\n    })\n    a.runReaction_()\n\n    expect(z).toBe(3)\n    expect(runCount).toBe(1)\n\n    transaction(function () {\n        x.set(4)\n        a.track(identity)\n        expect(a.isScheduled).toBe(true)\n        expect(z).toBe(4)\n        expect(runCount).toBe(2)\n    })\n\n    expect(z).toBe(4)\n    expect(runCount).toBe(2) // x is observed, so it should recompute only on dependency change\n\n    transaction(function () {\n        x.set(5)\n        expect(a.isScheduled).toBe(true)\n        a.track(identity)\n        expect(z).toBe(5)\n        expect(runCount).toBe(3)\n        expect(a.isScheduled).toBe(true)\n\n        x.set(6)\n        expect(z).toBe(5)\n        expect(runCount).toBe(3)\n    })\n    expect(a.isScheduled).toBe(false)\n    expect(z).toBe(6)\n    expect(runCount).toBe(4)\n})\n\ntest(\"autoruns created in autoruns should kick off\", function () {\n    const x = observable.box(3)\n    const x2 = []\n    let d\n\n    const a = m.autorun(function () {\n        if (d) {\n            // dispose previous autorun\n            d()\n        }\n        d = m.autorun(function () {\n            x2.push(x.get() * 2)\n        })\n    })\n\n    // a should be observed by the inner autorun, not the outer\n    expect(a[$mobx].observing_.length).toBe(0)\n    expect(d[$mobx].observing_.length).toBe(1)\n\n    x.set(4)\n    expect(x2).toEqual([6, 8])\n})\n\ntest(\"#502 extendObservable throws on objects created with Object.create(null)\", () => {\n    const a = Object.create(null)\n    mobx.extendObservable(a, { b: 3 })\n    expect(mobx.isObservableProp(a, \"b\")).toBe(true)\n})\n\ntest(\"#328 atom throwing exception if observing stuff in onObserved\", () => {\n    const b = mobx.observable.box(1)\n    const a = mobx.createAtom(\"test atom\", () => {\n        b.get()\n    })\n    const d = mobx.autorun(() => {\n        a.reportObserved() // threw\n    })\n    d()\n})\n\ntest(\"prematurely ended autoruns are cleaned up properly\", () => {\n    const a = mobx.observable.box(1)\n    const b = mobx.observable.box(2)\n    const c = mobx.observable.box(3)\n    let called = 0\n\n    const d = mobx.autorun(() => {\n        called++\n        if (a.get() === 2) {\n            d() // dispose\n            b.get() // consume\n            a.set(3) // cause itself to re-run, but, disposed!\n        } else {\n            c.get()\n        }\n    })\n\n    expect(called).toBe(1)\n\n    a.set(2)\n\n    expect(called).toBe(2)\n})\n\ntest(\"unoptimizable subscriptions are diffed correctly\", () => {\n    const a = mobx.observable.box(1)\n    const b = mobx.observable.box(1)\n    const c = mobx.computed(() => {\n        a.get()\n        return 3\n    })\n    let called = 0\n    let val = 0\n\n    const d = mobx.autorun(() => {\n        called++\n        a.get()\n        c.get() // reads a as well\n        val = a.get()\n        if (\n            b.get() === 1 // only on first run\n        )\n            a.get() // second run: one read less for a\n    })\n\n    expect(called).toBe(1)\n    expect(val).toBe(1)\n\n    b.set(2)\n\n    expect(called).toBe(2)\n    expect(val).toBe(1)\n\n    a.set(2)\n\n    expect(called).toBe(3)\n    expect(val).toBe(2)\n\n    d()\n})\n\ntest(\"atom events #427\", () => {\n    let start = 0\n    let stop = 0\n    let runs = 0\n\n    const a = mobx.createAtom(\n        \"test\",\n        () => start++,\n        () => stop++\n    )\n    expect(a.reportObserved()).toEqual(false)\n\n    expect(start).toBe(0)\n    expect(stop).toBe(0)\n\n    let d = mobx.autorun(() => {\n        runs++\n        expect(a.reportObserved()).toBe(true)\n        expect(start).toBe(1)\n        expect(a.reportObserved()).toBe(true)\n        expect(start).toBe(1)\n    })\n\n    expect(runs).toBe(1)\n    expect(start).toBe(1)\n    expect(stop).toBe(0)\n    a.reportChanged()\n    expect(runs).toBe(2)\n    expect(start).toBe(1)\n    expect(stop).toBe(0)\n\n    d()\n    expect(runs).toBe(2)\n    expect(start).toBe(1)\n    expect(stop).toBe(1)\n\n    expect(a.reportObserved()).toBe(false)\n    expect(start).toBe(1)\n    expect(stop).toBe(1)\n\n    d = mobx.autorun(() => {\n        expect(a.reportObserved()).toBe(true)\n        expect(start).toBe(2)\n        a.reportObserved()\n        expect(start).toBe(2)\n    })\n\n    expect(start).toBe(2)\n    expect(stop).toBe(1)\n    a.reportChanged()\n    expect(start).toBe(2)\n    expect(stop).toBe(1)\n\n    d()\n    expect(stop).toBe(2)\n})\n\ntest(\"verify calculation count\", () => {\n    const calcs = []\n    const a = observable.box(1)\n    const b = mobx.computed(() => {\n        calcs.push(\"b\")\n        return a.get()\n    })\n    const c = mobx.computed(() => {\n        calcs.push(\"c\")\n        return b.get()\n    })\n    const d = mobx.autorun(() => {\n        calcs.push(\"d\")\n        return b.get()\n    })\n    const e = mobx.autorun(() => {\n        calcs.push(\"e\")\n        return c.get()\n    })\n    const f = mobx.computed(() => {\n        calcs.push(\"f\")\n        return c.get()\n    })\n\n    expect(f.get()).toBe(1)\n\n    calcs.push(\"change\")\n    a.set(2)\n\n    expect(f.get()).toBe(2)\n\n    calcs.push(\"transaction\")\n    transaction(() => {\n        expect(b.get()).toBe(2)\n        expect(c.get()).toBe(2)\n        expect(f.get()).toBe(2)\n        expect(f.get()).toBe(2)\n        calcs.push(\"change\")\n        a.set(3)\n        expect(b.get()).toBe(3)\n        expect(b.get()).toBe(3)\n        calcs.push(\"try c\")\n        expect(c.get()).toBe(3)\n        expect(c.get()).toBe(3)\n        calcs.push(\"try f\")\n        expect(f.get()).toBe(3)\n        expect(f.get()).toBe(3)\n        calcs.push(\"end transaction\")\n    })\n\n    expect(calcs).toEqual([\n        \"d\",\n        \"b\",\n        \"e\",\n        \"c\",\n        \"f\",\n        \"change\",\n        \"b\",\n        \"d\",\n        \"c\",\n        \"e\",\n        \"f\", // would have expected b c e d f, but alas\n        \"transaction\",\n        \"f\",\n        \"change\",\n        \"b\",\n        \"try c\",\n        \"c\",\n        \"try f\",\n        \"f\",\n        \"end transaction\",\n        \"d\",\n        \"e\"\n    ])\n\n    d()\n    e()\n})\n\ntest(\"support computed property getters / setters\", () => {\n    let a = observable({\n        size: 1,\n        get volume() {\n            return this.size * this.size\n        }\n    })\n\n    expect(a.volume).toBe(1)\n    a.size = 3\n    expect(a.volume).toBe(9)\n\n    expect(() => (a.volume = 9)).toThrow(\n        /It is not possible to assign a new value to a computed value/\n    )\n\n    a = {}\n    mobx.extendObservable(a, {\n        size: 2,\n        get volume() {\n            return this.size * this.size\n        },\n        set volume(v) {\n            this.size = Math.sqrt(v)\n        }\n    })\n\n    const values = []\n    const d = mobx.autorun(() => values.push(a.volume))\n\n    a.volume = 9\n    mobx.transaction(() => {\n        a.volume = 100\n        a.volume = 64\n    })\n\n    expect(values).toEqual([4, 9, 64])\n    expect(a.size).toEqual(8)\n\n    d()\n})\n\ntest(\"computed getter / setter for plan objects should succeed\", function () {\n    const b = observable({\n        a: 3,\n        get propX() {\n            return this.a * 2\n        },\n        set propX(v) {\n            this.a = v\n        }\n    })\n\n    const values = []\n    mobx.autorun(function () {\n        return values.push(b.propX)\n    })\n    expect(b.propX).toBe(6)\n    b.propX = 4\n    expect(b.propX).toBe(8)\n\n    expect(values).toEqual([6, 8])\n})\n\ntest(\"helpful error for self referencing setter\", function () {\n    const a = observable({\n        x: 1,\n        get y() {\n            return this.x\n        },\n        set y(v) {\n            this.y = v // woops...;-)\n        }\n    })\n\n    expect(() => (a.y = 2)).toThrow(/The setter of computed value/)\n})\n\ntest(\"#558 boxed observables stay boxed observables\", function () {\n    const a = observable({\n        x: observable.box(3)\n    })\n\n    expect(typeof a.x).toBe(\"object\")\n    expect(typeof a.x.get).toBe(\"function\")\n})\n\ntest(\"iscomputed\", function () {\n    expect(mobx.isComputed(observable.box(3))).toBe(false)\n    expect(\n        mobx.isComputed(\n            mobx.computed(function () {\n                return 3\n            })\n        )\n    ).toBe(true)\n\n    const x = observable({\n        a: 3,\n        get b() {\n            return this.a\n        }\n    })\n\n    expect(mobx.isComputedProp(x, \"a\")).toBe(false)\n    expect(mobx.isComputedProp(x, \"b\")).toBe(true)\n})\n\ntest(\"603 - transaction should not kill reactions\", () => {\n    const a = observable.box(1)\n    let b = 1\n    const d = mobx.autorun(() => {\n        b = a.get()\n    })\n\n    try {\n        mobx.transaction(() => {\n            a.set(2)\n            throw 3\n        })\n    } catch (e) {\n        // empty\n    }\n\n    const g = m._getGlobalState()\n    expect(g.inBatch).toEqual(0)\n    expect(g.pendingReactions.length).toEqual(0)\n    expect(g.pendingUnobservations.length).toEqual(0)\n    expect(g.trackingDerivation).toEqual(null)\n\n    expect(b).toBe(2)\n    a.set(3)\n    expect(b).toBe(3)\n    d()\n})\n\ntest(\"#561 test toPrimitive() of observable objects\", function () {\n    if (typeof Symbol !== \"undefined\" && Symbol.toPrimitive) {\n        let x = observable.box(3)\n\n        expect(x.valueOf()).toBe(3)\n        expect(x[Symbol.toPrimitive]()).toBe(3)\n\n        expect(+x).toBe(3)\n        expect(++x).toBe(4)\n\n        const y = observable.box(3)\n\n        expect(y + 7).toBe(10)\n\n        const z = computed(() => ({ a: 3 }))\n        expect(3 + z).toBe(\"3[object Object]\")\n    } else {\n        let x = observable.box(3)\n\n        expect(x.valueOf()).toBe(3)\n        expect(x[\"@@toPrimitive\"]()).toBe(3)\n\n        expect(+x).toBe(3)\n        expect(++x).toBe(4)\n\n        const y = observable.box(3)\n\n        expect(y + 7).toBe(10)\n\n        const z = computed(() => ({ a: 3 }))\n        expect(\"3\" + z[\"@@toPrimitive\"]()).toBe(\"3[object Object]\")\n    }\n})\n\ntest(\"computed equals function only invoked when necessary\", () => {\n    utils.supressConsole(() => {\n        const comparisons = []\n        const loggingComparer = (from, to) => {\n            comparisons.push({ from, to })\n            return from === to\n        }\n\n        const left = mobx.observable.box(\"A\")\n        const right = mobx.observable.box(\"B\")\n        const combinedToLowerCase = mobx.computed(\n            () => left.get().toLowerCase() + right.get().toLowerCase(),\n            { equals: loggingComparer }\n        )\n\n        const values = []\n        let disposeAutorun = mobx.autorun(() => values.push(combinedToLowerCase.get()))\n\n        // No comparison should be made on the first value\n        expect(comparisons).toEqual([])\n\n        // First change will cause a comparison\n        left.set(\"C\")\n        expect(comparisons).toEqual([{ from: \"ab\", to: \"cb\" }])\n\n        // Transition *to* CaughtException in the computed won't cause a comparison\n        left.set(null)\n        expect(comparisons).toEqual([{ from: \"ab\", to: \"cb\" }])\n\n        // Transition *between* CaughtException-s in the computed won't cause a comparison\n        right.set(null)\n        expect(comparisons).toEqual([{ from: \"ab\", to: \"cb\" }])\n\n        // Transition *from* CaughtException in the computed won't cause a comparison\n        left.set(\"D\")\n        right.set(\"E\")\n        expect(comparisons).toEqual([{ from: \"ab\", to: \"cb\" }])\n\n        // Another value change will cause a comparison\n        right.set(\"F\")\n        expect(comparisons).toEqual([\n            { from: \"ab\", to: \"cb\" },\n            { from: \"de\", to: \"df\" }\n        ])\n\n        // Becoming unobserved, then observed won't cause a comparison\n        disposeAutorun()\n        disposeAutorun = mobx.autorun(() => values.push(combinedToLowerCase.get()))\n        expect(comparisons).toEqual([\n            { from: \"ab\", to: \"cb\" },\n            { from: \"de\", to: \"df\" }\n        ])\n\n        expect(values).toEqual([\"ab\", \"cb\", \"de\", \"df\", \"df\"])\n\n        disposeAutorun()\n    })\n})\n\n// document that extendObservable is not inheritance compatible,\n// and make sure this does work with decorate\ntest(\"Issue 1092 - Should not access attributes of siblings in the prot. chain\", () => {\n    // The parent is an observable\n    // and has an attribute\n    const parent = {}\n    mobx.extendObservable(parent, {\n        staticObservable: 11\n    })\n\n    // Child1 \"inherit\" from the parent\n    // and has an observable attribute\n    const child1 = Object.create(parent)\n    mobx.extendObservable(child1, {\n        attribute: 7\n    })\n\n    // Child2 also \"inherit\" from the parent\n    // But does not have any observable attribute\n    const child2 = Object.create(parent)\n\n    // The second child should not be aware of the attribute of his\n    // sibling child1\n    expect(typeof child2.attribute).toBe(\"undefined\")\n\n    expect(parent.staticObservable).toBe(11)\n    parent.staticObservable = 12\n    expect(parent.staticObservable).toBe(12)\n})\n\ntest(\"Issue 1092 - We should be able to define observable on all siblings\", () => {\n    expect.assertions(1)\n\n    // The parent is an observable\n    const parent = {}\n    mobx.extendObservable(parent, {})\n\n    // Child1 \"inherit\" from the parent\n    // and has an observable attribute\n    const child1 = Object.create(parent)\n    mobx.extendObservable(child1, {\n        attribute: 7\n    })\n\n    // Child2 also \"inherit\" from the parent\n    // But does not have any observable attribute\n    const child2 = Object.create(parent)\n    expect(() => {\n        mobx.extendObservable(child2, {\n            attribute: 8\n        })\n    }).not.toThrow()\n})\n\ntest(\"Issue 1120 - isComputed should return false for a non existing property\", () => {\n    expect(mobx.isComputedProp({}, \"x\")).toBe(false)\n    expect(mobx.isComputedProp(observable({}), \"x\")).toBe(false)\n})\n\ntest(\"computed comparer works with decorate (plain)\", () => {\n    const sameTime = (from, to) => from.hour === to.hour && from.minute === to.minute\n    function Time(hour, minute) {\n        this.hour = hour\n        this.minute = minute\n        makeObservable(this, {\n            hour: observable,\n            minute: observable,\n            time: computed({ equals: sameTime })\n        })\n    }\n\n    Object.defineProperty(Time.prototype, \"time\", {\n        configurable: true,\n        enumerable: true,\n        get() {\n            return { hour: this.hour, minute: this.minute }\n        }\n    })\n    const time = new Time(9, 0)\n\n    const changes = []\n    const disposeAutorun = autorun(() => changes.push(time.time))\n\n    expect(changes).toEqual([{ hour: 9, minute: 0 }])\n    time.hour = 9\n    expect(changes).toEqual([{ hour: 9, minute: 0 }])\n    time.minute = 0\n    expect(changes).toEqual([{ hour: 9, minute: 0 }])\n    time.hour = 10\n    expect(changes).toEqual([\n        { hour: 9, minute: 0 },\n        { hour: 10, minute: 0 }\n    ])\n    time.minute = 30\n    expect(changes).toEqual([\n        { hour: 9, minute: 0 },\n        { hour: 10, minute: 0 },\n        { hour: 10, minute: 30 }\n    ])\n\n    disposeAutorun()\n})\n\ntest(\"computed comparer works with decorate (plain) - 2\", () => {\n    const sameTime = (from, to) => from.hour === to.hour && from.minute === to.minute\n    function Time(hour, minute) {\n        extendObservable(\n            this,\n            {\n                hour,\n                minute,\n                get time() {\n                    return { hour: this.hour, minute: this.minute }\n                }\n            },\n            {\n                time: computed({ equals: sameTime })\n            }\n        )\n    }\n    const time = new Time(9, 0)\n\n    const changes = []\n    const disposeAutorun = autorun(() => changes.push(time.time))\n\n    expect(changes).toEqual([{ hour: 9, minute: 0 }])\n    time.hour = 9\n    expect(changes).toEqual([{ hour: 9, minute: 0 }])\n    time.minute = 0\n    expect(changes).toEqual([{ hour: 9, minute: 0 }])\n    time.hour = 10\n    expect(changes).toEqual([\n        { hour: 9, minute: 0 },\n        { hour: 10, minute: 0 }\n    ])\n    time.minute = 30\n    expect(changes).toEqual([\n        { hour: 9, minute: 0 },\n        { hour: 10, minute: 0 },\n        { hour: 10, minute: 30 }\n    ])\n\n    disposeAutorun()\n})\n\ntest(\"computed comparer works with decorate (plain) - 3\", () => {\n    const sameTime = (from, to) => from.hour === to.hour && from.minute === to.minute\n    const time = observable.object(\n        {\n            hour: 9,\n            minute: 0,\n            get time() {\n                return { hour: this.hour, minute: this.minute }\n            }\n        },\n        {\n            time: computed({ equals: sameTime })\n        }\n    )\n\n    const changes = []\n    const disposeAutorun = autorun(() => changes.push(time.time))\n\n    expect(changes).toEqual([{ hour: 9, minute: 0 }])\n    time.hour = 9\n    expect(changes).toEqual([{ hour: 9, minute: 0 }])\n    time.minute = 0\n    expect(changes).toEqual([{ hour: 9, minute: 0 }])\n    time.hour = 10\n    expect(changes).toEqual([\n        { hour: 9, minute: 0 },\n        { hour: 10, minute: 0 }\n    ])\n    time.minute = 30\n    expect(changes).toEqual([\n        { hour: 9, minute: 0 },\n        { hour: 10, minute: 0 },\n        { hour: 10, minute: 30 }\n    ])\n\n    disposeAutorun()\n})\n\ntest(\"can create computed with setter\", () => {\n    let y = 1\n    let x = mobx.computed(() => y, {\n        set: v => {\n            y = v * 2\n        }\n    })\n    expect(x.get()).toBe(1)\n    x.set(3)\n    expect(x.get()).toBe(6)\n})\n\ntest(\"can make non-extenible objects observable\", () => {\n    const base = { x: 3 }\n    Object.freeze(base)\n    const o = mobx.observable(base)\n    o.x = 4\n    expect(o.x).toBe(4)\n    expect(mobx.isObservableProp(o, \"x\")).toBeTruthy()\n})\n\ntest(\"keeping computed properties alive does not run before access\", () => {\n    let calcs = 0\n    observable(\n        {\n            x: 1,\n            get y() {\n                calcs++\n                return this.x * 2\n            }\n        },\n        {\n            y: mobx.computed({ keepAlive: true })\n        }\n    )\n\n    expect(calcs).toBe(0) // initially there is no calculation done\n})\n\ntest(\"(for objects) keeping computed properties alive does not run before access\", () => {\n    let calcs = 0\n    class Foo {\n        @observable x = 1\n\n        constructor() {\n            makeObservable(this)\n        }\n\n        @computed({ keepAlive: true })\n        get y() {\n            calcs++\n            return this.x * 2\n        }\n    }\n    new Foo()\n\n    expect(calcs).toBe(0) // initially there is no calculation done\n})\n\ntest(\"keeping computed properties alive runs on first access\", () => {\n    let calcs = 0\n    const x = observable(\n        {\n            x: 1,\n            get y() {\n                calcs++\n                return this.x * 2\n            }\n        },\n        {\n            y: mobx.computed({ keepAlive: true })\n        }\n    )\n\n    expect(calcs).toBe(0)\n    expect(x.y).toBe(2) // perform calculation on access\n    expect(calcs).toBe(1)\n})\n\ntest(\"keeping computed properties alive caches values on subsequent accesses\", () => {\n    let calcs = 0\n    const x = observable(\n        {\n            x: 1,\n            get y() {\n                calcs++\n                return this.x * 2\n            }\n        },\n        {\n            y: mobx.computed({ keepAlive: true })\n        }\n    )\n\n    expect(x.y).toBe(2) // first access: do calculation\n    expect(x.y).toBe(2) // second access: use cached value, no calculation\n    expect(calcs).toBe(1) // only one calculation: cached!\n})\n\ntest(\"keeping computed properties alive does not recalculate when dirty\", () => {\n    let calcs = 0\n    const x = observable(\n        {\n            x: 1,\n            get y() {\n                calcs++\n                return this.x * 2\n            }\n        },\n        {\n            y: mobx.computed({ keepAlive: true })\n        }\n    )\n\n    expect(x.y).toBe(2) // first access: do calculation\n    expect(calcs).toBe(1)\n    x.x = 3 // mark as dirty: no calculation\n    expect(calcs).toBe(1)\n    expect(x.y).toBe(6)\n})\n\ntest(\"keeping computed properties alive recalculates when accessing it dirty\", () => {\n    let calcs = 0\n    const x = observable(\n        {\n            x: 1,\n            get y() {\n                calcs++\n                return this.x * 2\n            }\n        },\n        {\n            y: mobx.computed({ keepAlive: true })\n        }\n    )\n\n    expect(x.y).toBe(2) // first access: do calculation\n    expect(calcs).toBe(1)\n    x.x = 3 // mark as dirty: no calculation\n    expect(calcs).toBe(1)\n    expect(x.y).toBe(6) // second access: do calculation because it is dirty\n    expect(calcs).toBe(2)\n})\n\ntest(\"(for objects) keeping computed properties alive recalculates when accessing it dirty\", () => {\n    let calcs = 0\n    class Foo {\n        @observable x = 1\n\n        constructor() {\n            makeObservable(this)\n        }\n\n        @computed({ keepAlive: true })\n        get y() {\n            calcs++\n            return this.x * 2\n        }\n    }\n    const x = new Foo()\n\n    expect(x.y).toBe(2) // first access: do calculation\n    expect(calcs).toBe(1)\n    x.x = 3 // mark as dirty: no calculation\n    expect(calcs).toBe(1)\n    expect(x.y).toBe(6) // second access: do calculation because it is dirty\n    expect(calcs).toBe(2)\n})\n\ntest(\"tuples\", () => {\n    // See #1391\n    function tuple() {\n        const res = new Array(arguments.length)\n        for (let i = 0; i < arguments.length; i++) mobx.extendObservable(res, { [i]: arguments[i] })\n        return res\n    }\n\n    const myStuff = tuple(1, 3)\n    const events = []\n\n    mobx.reaction(\n        () => myStuff[0],\n        val => events.push(val)\n    )\n    myStuff[1] = 17 // should not react\n    myStuff[0] = 2 // should react\n    expect(events).toEqual([2])\n\n    expect(myStuff.map(x => x * 2)).toEqual([4, 34])\n})\n"
  },
  {
    "path": "packages/mobx/__tests__/v4/base/observe.ts",
    "content": "import { observable, observe, computed } from \"../mobx4\"\n\ntest(\"observe object and map properties\", function () {\n    const map = observable.map({ a: 1 })\n    const events: any[] = []\n\n    expect(() => observe(map, \"b\", () => {})).toThrow(\n        /the entry 'b' does not exist in the observable map/\n    )\n\n    const d1 = observe(map, \"a\", e => events.push([e.newValue, e.oldValue]))\n\n    map.set(\"a\", 2)\n    map.set(\"a\", 3)\n    d1()\n    map.set(\"a\", 4)\n\n    const o = observable({ a: 5 })\n\n    expect(() => observe(o, \"b\" as any, () => {})).toThrow(\n        /no observable property 'b' found on the observable object/\n    )\n    const d2 = observe(o, \"a\", e => events.push([e.newValue, e.oldValue]))\n\n    o.a = 6\n    o.a = 7\n    d2()\n    o.a = 8\n\n    expect(events).toEqual([\n        [2, 1],\n        [3, 2],\n        [6, 5],\n        [7, 6]\n    ])\n})\n\ntest(\"observe computed values\", () => {\n    const events: any[] = []\n\n    const v = observable.box(0)\n    const f = observable.box(0)\n    const c = computed(() => v.get())\n\n    observe(c, e => {\n        v.get()\n        f.get()\n        events.push([e.newValue, e.oldValue])\n    })\n\n    v.set(6)\n    f.set(10)\n\n    expect(events).toEqual([[6, 0]])\n})\n"
  },
  {
    "path": "packages/mobx/__tests__/v4/base/spy.js",
    "content": "\"use strict\"\nconst mobx = require(\"../mobx4\")\nconst utils = require(\"../../v5/utils/test-utils\")\n\ntest(\"spy output\", () => {\n    const events = []\n\n    const stop = mobx.spy(c => events.push(c))\n\n    doStuff()\n\n    stop()\n\n    doStuff()\n\n    events.forEach(ev => {\n        delete ev.object\n        delete ev.fn\n        delete ev.time\n    })\n\n    expect(events).toMatchSnapshot()\n})\n\nfunction doStuff() {\n    const a = mobx.observable.box(2)\n    a.set(3)\n\n    const b = mobx.observable({\n        c: 4\n    })\n    b.c = 5\n    mobx.extendObservable(b, { d: 6 })\n    b.d = 7\n\n    const e = mobx.observable([1, 2])\n    e.push(3, 4)\n    e.shift()\n    e[2] = 5\n\n    const f = mobx.observable.map({ g: 1 })\n    f.delete(\"h\")\n    f.delete(\"g\")\n    f.set(\"i\", 5)\n    f.set(\"i\", 6)\n\n    const j = mobx.computed(() => a.get() * 2)\n\n    mobx.autorun(() => {\n        j.get()\n    })\n\n    a.set(4)\n\n    mobx.transaction(function myTransaction() {\n        a.set(5)\n        a.set(6)\n    })\n\n    mobx.action(\"myTestAction\", newValue => {\n        a.set(newValue)\n    }).call({}, 7)\n}\n\ntest(\"spy error\", () => {\n    utils.supressConsole(() => {\n        mobx._getGlobalState().mobxGuid = 0\n\n        const a = mobx.observable({\n            x: 2,\n            get y() {\n                if (this.x === 3) throw \"Oops\"\n                return this.x * 2\n            }\n        })\n\n        const events = []\n        const stop = mobx.spy(c => events.push(c))\n\n        const d = mobx.autorun(() => a.y, { name: \"autorun\" })\n\n        a.x = 3\n\n        events.forEach(x => {\n            delete x.fn\n            delete x.object\n            delete x.time\n        })\n\n        expect(events).toMatchSnapshot()\n\n        d()\n        stop()\n    })\n})\n\ntest(\"spy stop listen from handler, #1459\", () => {\n    const stop = mobx.spy(() => stop())\n    mobx.spy(() => {})\n    doStuff()\n})\n"
  },
  {
    "path": "packages/mobx/__tests__/v4/base/tojs.js",
    "content": "\"use strict\"\n\nconst mobx = require(\"../mobx4\")\nconst m = mobx\nconst observable = mobx.observable\nconst { makeObservable } = mobx\n\ntest(\"json1\", function () {\n    mobx._resetGlobalState()\n\n    const todos = observable([\n        {\n            title: \"write blog\"\n        },\n        {\n            title: \"improve coverge\"\n        }\n    ])\n\n    let output\n    mobx.autorun(function () {\n        output = todos\n            .map(function (todo) {\n                return todo.title\n            })\n            .join(\", \")\n    })\n\n    todos[1].title = \"improve coverage\" // prints: write blog, improve coverage\n    expect(output).toBe(\"write blog, improve coverage\")\n    todos.push({ title: \"take a nap\" }) // prints: write blog, improve coverage, take a nap\n    expect(output).toBe(\"write blog, improve coverage, take a nap\")\n})\n\ntest(\"json2\", function () {\n    const source = {\n        todos: [\n            {\n                title: \"write blog\",\n                tags: [\"react\", \"frp\"],\n                details: {\n                    url: \"somewhere\"\n                }\n            },\n            {\n                title: \"do the dishes\",\n                tags: [\"mweh\"],\n                details: {\n                    url: \"here\"\n                }\n            }\n        ]\n    }\n\n    const o = mobx.observable(JSON.parse(JSON.stringify(source)))\n\n    expect(mobx.toJS(o)).toEqual(source)\n\n    const analyze = mobx.computed(function () {\n        return [o.todos.length, o.todos[1].details.url]\n    })\n\n    const alltags = mobx.computed(function () {\n        return o.todos\n            .map(function (todo) {\n                return todo.tags.join(\",\")\n            })\n            .join(\",\")\n    })\n\n    let ab = []\n    let tb = []\n\n    m.observe(\n        analyze,\n        function (d) {\n            ab.push(d.newValue)\n        },\n        true\n    )\n    m.observe(\n        alltags,\n        function (d) {\n            tb.push(d.newValue)\n        },\n        true\n    )\n\n    o.todos[0].details.url = \"boe\"\n    o.todos[1].details.url = \"ba\"\n    o.todos[0].tags[0] = \"reactjs\"\n    o.todos[1].tags.push(\"pff\")\n\n    expect(mobx.toJS(o)).toEqual({\n        todos: [\n            {\n                title: \"write blog\",\n                tags: [\"reactjs\", \"frp\"],\n                details: {\n                    url: \"boe\"\n                }\n            },\n            {\n                title: \"do the dishes\",\n                tags: [\"mweh\", \"pff\"],\n                details: {\n                    url: \"ba\"\n                }\n            }\n        ]\n    })\n    expect(ab).toEqual([\n        [2, \"here\"],\n        [2, \"ba\"]\n    ])\n    expect(tb).toEqual([\"react,frp,mweh\", \"reactjs,frp,mweh\", \"reactjs,frp,mweh,pff\"])\n    ab = []\n    tb = []\n\n    o.todos.push(\n        mobx.observable({\n            title: \"test\",\n            tags: [\"x\"]\n        })\n    )\n\n    expect(mobx.toJS(o)).toEqual({\n        todos: [\n            {\n                title: \"write blog\",\n                tags: [\"reactjs\", \"frp\"],\n                details: {\n                    url: \"boe\"\n                }\n            },\n            {\n                title: \"do the dishes\",\n                tags: [\"mweh\", \"pff\"],\n                details: {\n                    url: \"ba\"\n                }\n            },\n            {\n                title: \"test\",\n                tags: [\"x\"]\n            }\n        ]\n    })\n    expect(ab).toEqual([[3, \"ba\"]])\n    expect(tb).toEqual([\"reactjs,frp,mweh,pff,x\"])\n    ab = []\n    tb = []\n\n    o.todos[1] = mobx.observable({\n        title: \"clean the attic\",\n        tags: [\"needs sabbatical\"],\n        details: {\n            url: \"booking.com\"\n        }\n    })\n    expect(JSON.parse(JSON.stringify(o))).toEqual({\n        todos: [\n            {\n                title: \"write blog\",\n                tags: [\"reactjs\", \"frp\"],\n                details: {\n                    url: \"boe\"\n                }\n            },\n            {\n                title: \"clean the attic\",\n                tags: [\"needs sabbatical\"],\n                details: {\n                    url: \"booking.com\"\n                }\n            },\n            {\n                title: \"test\",\n                tags: [\"x\"]\n            }\n        ]\n    })\n    expect(ab).toEqual([[3, \"booking.com\"]])\n    expect(tb).toEqual([\"reactjs,frp,needs sabbatical,x\"])\n    ab = []\n    tb = []\n\n    o.todos[1].details = mobx.observable({ url: \"google\" })\n    o.todos[1].tags = [\"foo\", \"bar\"]\n    expect(mobx.toJS(o)).toEqual({\n        todos: [\n            {\n                title: \"write blog\",\n                tags: [\"reactjs\", \"frp\"],\n                details: {\n                    url: \"boe\"\n                }\n            },\n            {\n                title: \"clean the attic\",\n                tags: [\"foo\", \"bar\"],\n                details: {\n                    url: \"google\"\n                }\n            },\n            {\n                title: \"test\",\n                tags: [\"x\"]\n            }\n        ]\n    })\n    expect(mobx.toJS(o)).toEqual(mobx.toJS(o))\n    expect(ab).toEqual([[3, \"google\"]])\n    expect(tb).toEqual([\"reactjs,frp,foo,bar,x\"])\n})\n\ntest(\"toJS handles dates\", () => {\n    const a = observable({\n        d: new Date()\n    })\n\n    const b = mobx.toJS(a)\n    expect(b.d instanceof Date).toBe(true)\n    expect(a.d === b.d).toBe(true)\n})\n\ntest(\"json cycles\", function () {\n    const a = observable({\n        b: 1,\n        c: [2],\n        d: mobx.observable.map()\n    })\n\n    a.e = a\n    a.c.push(a, a.d)\n    a.d.set(\"f\", a)\n    a.d.set(\"d\", a.d)\n    a.d.set(\"c\", a.c)\n\n    const cloneA = mobx.toJS(a)\n    const cloneC = cloneA.c\n    const cloneD = cloneA.d\n\n    expect(cloneA.b).toBe(1)\n    expect(cloneA.c[0]).toBe(2)\n    expect(cloneA.c[1]).toBe(cloneA)\n    expect(cloneA.c[2]).toBe(cloneD)\n    expect(cloneD.get(\"f\")).toBe(cloneA)\n    expect(cloneD.get(\"d\")).toBe(cloneD)\n    expect(cloneD.get(\"c\")).toBe(cloneC)\n    expect(cloneA.e).toBe(cloneA)\n})\n\ntest(\"#285 class instances with toJS\", () => {\n    function Person() {\n        this.firstName = \"michel\"\n        mobx.extendObservable(this, {\n            lastName: \"weststrate\",\n            tags: [\"user\", \"mobx-member\"],\n            get fullName() {\n                return this.firstName + this.lastName\n            }\n        })\n    }\n\n    const p1 = new Person()\n    // check before lazy initialization\n    expect(mobx.toJS(p1)).toEqual({\n        firstName: \"michel\",\n        lastName: \"weststrate\",\n        tags: [\"user\", \"mobx-member\"]\n    })\n\n    // check after lazy initialization\n    expect(mobx.toJS(p1)).toEqual({\n        firstName: \"michel\",\n        lastName: \"weststrate\",\n        tags: [\"user\", \"mobx-member\"]\n    })\n})\n\ntest(\"#285 non-mobx class instances with toJS\", () => {\n    const nameObservable = mobx.observable.box(\"weststrate\")\n    function Person() {\n        this.firstName = \"michel\"\n        this.lastName = nameObservable\n    }\n\n    const p1 = new Person()\n    // check before lazy initialization\n    expect(mobx.toJS(p1)).toEqual({\n        firstName: \"michel\",\n        lastName: nameObservable // toJS doesn't recurse into non observable objects!\n    })\n})\n\ntest(\"verify #566 solution\", () => {\n    function MyClass() {}\n    const a = new MyClass()\n    const b = mobx.observable({ x: 3 })\n    const c = mobx.observable({ a: a, b: b })\n\n    expect(mobx.toJS(c).a === a).toBeTruthy() // true\n    expect(mobx.toJS(c).b !== b).toBeTruthy() // false, cloned\n    expect(mobx.toJS(c).b.x === b.x).toBeTruthy() // true, both 3\n})\n\ntest(\"verify already seen\", () => {\n    const a = mobx.observable({ x: null, y: 3 })\n    a.x = a\n\n    const res = mobx.toJS(a)\n    expect(res.y).toBe(3)\n    expect(res.x === res).toBeTruthy()\n    expect(res.x === a).toBeFalsy()\n})\n\ntest(\"json cycles when exporting maps as maps\", function () {\n    const a = observable({\n        b: 1,\n        c: [2],\n        d: mobx.observable.map()\n    })\n\n    a.e = a\n    a.c.push(a, a.d)\n    a.d.set(\"f\", a)\n    a.d.set(\"d\", a.d)\n    a.d.set(\"c\", a.c)\n\n    const cloneA = mobx.toJS(a)\n    const cloneC = cloneA.c\n    const cloneD = cloneA.d\n\n    expect(cloneA.b).toBe(1)\n    expect(cloneA.c[0]).toBe(2)\n    expect(cloneA.c[1]).toBe(cloneA)\n    expect(cloneA.c[2]).toBe(cloneD)\n    expect(cloneD).toBeInstanceOf(Map)\n    expect(cloneD.get(\"f\")).toBe(cloneA)\n    expect(cloneD.get(\"d\")).toBe(cloneD)\n    expect(cloneD.get(\"c\")).toBe(cloneC)\n    expect(cloneA.e).toBe(cloneA)\n})\n\ntest(\"map to JS\", () => {\n    class MyClass {\n        @observable meta = new Map()\n\n        constructor() {\n            makeObservable(this)\n            this.meta.set(\"test\", { abc: \"def\", ghi: \"jkl\" })\n\n            expect(mobx.toJS(this.meta).constructor.name).toBe(\"Map\")\n        }\n    }\n    new MyClass()\n})\n\ntest(\"Correctly converts observable objects with computed values\", () => {\n    const a = observable({ key: \"value\" })\n    const c = observable({ computedValue: mobx.computed(() => a.key) })\n\n    const j = mobx.toJS(c)\n    expect(j).toMatchObject({ computedValue: \"value\" })\n})\n"
  },
  {
    "path": "packages/mobx/__tests__/v4/base/untracked.ts",
    "content": "import { autorun, observable, computed, untracked } from \"../mobx4\"\n\ntest(\"untracked 1\", () => {\n    let cCalcs = 0,\n        dCalcs = 0\n    const a = observable.box(1)\n    const b = observable.box(2)\n    const c = computed(() => {\n        cCalcs++\n        return a.get() + untracked(() => b.get())\n    })\n    let result\n\n    autorun(() => {\n        dCalcs++\n        result = c.get()\n    })\n\n    expect(result).toBe(3)\n    expect(cCalcs).toBe(1)\n    expect(dCalcs).toBe(1)\n\n    b.set(3)\n    expect(result).toBe(3)\n    expect(cCalcs).toBe(1)\n    expect(dCalcs).toBe(1)\n\n    a.set(2)\n    expect(result).toBe(5)\n    expect(cCalcs).toBe(2)\n    expect(dCalcs).toBe(2)\n})\n"
  },
  {
    "path": "packages/mobx/__tests__/v4/mobx4.ts",
    "content": "import { configure } from \"../../src/mobx\"\n\nconfigure({\n    useProxies: \"never\",\n    enforceActions: \"never\"\n})\n\nexport * from \"../../src/mobx\"\n"
  },
  {
    "path": "packages/mobx/__tests__/v5/base/__snapshots__/action.js.snap",
    "content": "// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing\n\nexports[`error logging, #1836 - 1 1`] = `\n[\n  \"<STDOUT> [mobx] (error in reaction 'Autorun@44' suppressed, fix error of causing action below)\",\n  \"<STDERR> Error: Action error\",\n]\n`;\n\nexports[`error logging, #1836 - 2 1`] = `\n[\n  \"<STDERR> [mobx] Encountered an uncaught exception that was thrown by a reaction or observer component, in: 'Reaction[Autorun@46]'\",\n]\n`;\n"
  },
  {
    "path": "packages/mobx/__tests__/v5/base/__snapshots__/extras.js.snap",
    "content": "// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing\n\nexports[`spy 1 1`] = `\n[\n  {\n    \"debugObjectName\": \"ObservableValue@5\",\n    \"newValue\": 4,\n    \"observableKind\": \"value\",\n    \"oldValue\": 3,\n    \"spyReportStart\": true,\n    \"type\": \"update\",\n  },\n  {\n    \"debugObjectName\": \"ComputedValue@6\",\n    \"newValue\": 8,\n    \"observableKind\": \"computed\",\n    \"oldValue\": 6,\n    \"type\": \"update\",\n  },\n  {\n    \"name\": \"Autorun@7\",\n    \"spyReportStart\": true,\n    \"type\": \"reaction\",\n  },\n  {\n    \"spyReportEnd\": true,\n    \"type\": \"report-end\",\n  },\n  {\n    \"spyReportEnd\": true,\n    \"type\": \"report-end\",\n  },\n]\n`;\n"
  },
  {
    "path": "packages/mobx/__tests__/v5/base/__snapshots__/flow.js.snap",
    "content": "// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing\n\nexports[`it should support logging 1`] = `\n[\n  {\n    \"arguments\": [\n      2,\n    ],\n    \"name\": \"myaction - runid: 6 - init\",\n    \"spyReportStart\": true,\n    \"type\": \"action\",\n  },\n  {\n    \"spyReportEnd\": true,\n    \"type\": \"report-end\",\n  },\n  {\n    \"arguments\": [\n      undefined,\n    ],\n    \"name\": \"myaction - runid: 6 - yield 0\",\n    \"spyReportStart\": true,\n    \"type\": \"action\",\n  },\n  {\n    \"debugObjectName\": \"ObservableObject@7\",\n    \"name\": \"a\",\n    \"newValue\": 2,\n    \"observableKind\": \"object\",\n    \"oldValue\": 1,\n    \"spyReportStart\": true,\n    \"type\": \"update\",\n  },\n  {\n    \"spyReportEnd\": true,\n    \"type\": \"report-end\",\n  },\n  {\n    \"spyReportEnd\": true,\n    \"type\": \"report-end\",\n  },\n  {\n    \"arguments\": [\n      5,\n    ],\n    \"name\": \"myaction - runid: 6 - yield 1\",\n    \"spyReportStart\": true,\n    \"type\": \"action\",\n  },\n  {\n    \"debugObjectName\": \"ObservableObject@7\",\n    \"name\": \"a\",\n    \"newValue\": 5,\n    \"observableKind\": \"object\",\n    \"oldValue\": 2,\n    \"spyReportStart\": true,\n    \"type\": \"update\",\n  },\n  {\n    \"spyReportEnd\": true,\n    \"type\": \"report-end\",\n  },\n  {\n    \"debugObjectName\": \"ObservableObject@7\",\n    \"name\": \"a\",\n    \"newValue\": 4,\n    \"observableKind\": \"object\",\n    \"oldValue\": 5,\n    \"spyReportStart\": true,\n    \"type\": \"update\",\n  },\n  {\n    \"spyReportEnd\": true,\n    \"type\": \"report-end\",\n  },\n  {\n    \"spyReportEnd\": true,\n    \"type\": \"report-end\",\n  },\n  {\n    \"arguments\": [\n      3,\n    ],\n    \"name\": \"myaction - runid: 6 - yield 2\",\n    \"spyReportStart\": true,\n    \"type\": \"action\",\n  },\n  {\n    \"debugObjectName\": \"ObservableObject@7\",\n    \"name\": \"a\",\n    \"newValue\": 3,\n    \"observableKind\": \"object\",\n    \"oldValue\": 4,\n    \"spyReportStart\": true,\n    \"type\": \"update\",\n  },\n  {\n    \"spyReportEnd\": true,\n    \"type\": \"report-end\",\n  },\n  {\n    \"spyReportEnd\": true,\n    \"type\": \"report-end\",\n  },\n]\n`;\n"
  },
  {
    "path": "packages/mobx/__tests__/v5/base/__snapshots__/makereactive.js.snap",
    "content": "// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing\n\nexports[`computed value 1`] = `\"ComputedValue@1[() => 3]\"`;\n"
  },
  {
    "path": "packages/mobx/__tests__/v5/base/__snapshots__/object-api.js.snap",
    "content": "// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing\n\nexports[`observe & intercept 1`] = `\n[\n  {\n    \"intercept\": {\n      \"name\": \"b\",\n      \"newValue\": {\n        \"title\": \"get tea\",\n      },\n      \"object\": \"skip\",\n      \"type\": \"add\",\n    },\n  },\n  {\n    \"intercept\": {\n      \"name\": \"a\",\n      \"object\": \"skip\",\n      \"type\": \"remove\",\n    },\n  },\n]\n`;\n\nexports[`observe & intercept 2`] = `\n[\n  {\n    \"observe\": {\n      \"debugObjectName\": \"TestObject\",\n      \"name\": \"b\",\n      \"newValue\": {\n        \"title\": \"get tea\",\n      },\n      \"object\": \"skip\",\n      \"observableKind\": \"object\",\n      \"type\": \"add\",\n    },\n  },\n  {\n    \"observe\": {\n      \"debugObjectName\": \"TestObject\",\n      \"name\": \"a\",\n      \"object\": \"skip\",\n      \"observableKind\": \"object\",\n      \"oldValue\": {\n        \"title\": \"get coffee\",\n      },\n      \"type\": \"remove\",\n    },\n  },\n]\n`;\n"
  },
  {
    "path": "packages/mobx/__tests__/v5/base/__snapshots__/observables.js.snap",
    "content": "// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing\n\nexports[`delay autorun until end of transaction 1`] = `\n[\n  {\n    \"debugObjectName\": \"ObservableObject@1\",\n    \"name\": \"a\",\n    \"newValue\": 3,\n    \"observableKind\": \"object\",\n    \"oldValue\": 2,\n    \"spyReportStart\": true,\n    \"type\": \"update\",\n  },\n  {\n    \"spyReportEnd\": true,\n    \"type\": \"report-end\",\n  },\n  {\n    \"debugObjectName\": \"ObservableObject@1\",\n    \"name\": \"a\",\n    \"newValue\": 4,\n    \"observableKind\": \"object\",\n    \"oldValue\": 3,\n    \"spyReportStart\": true,\n    \"type\": \"update\",\n  },\n  {\n    \"spyReportEnd\": true,\n    \"type\": \"report-end\",\n  },\n  \"end1\",\n  {\n    \"debugObjectName\": \"ObservableObject@1\",\n    \"name\": \"a\",\n    \"newValue\": 5,\n    \"observableKind\": \"object\",\n    \"oldValue\": 4,\n    \"spyReportStart\": true,\n    \"type\": \"update\",\n  },\n  {\n    \"spyReportEnd\": true,\n    \"type\": \"report-end\",\n  },\n  \"end2\",\n  {\n    \"name\": \"test\",\n    \"spyReportStart\": true,\n    \"type\": \"reaction\",\n  },\n  \"auto\",\n  \"calc y\",\n  {\n    \"debugObjectName\": \"ObservableObject@1.b\",\n    \"newValue\": 5,\n    \"observableKind\": \"computed\",\n    \"oldValue\": CaughtException {\n      \"cause\": null,\n    },\n    \"type\": \"update\",\n  },\n  {\n    \"spyReportEnd\": true,\n    \"type\": \"report-end\",\n  },\n  \"post trans1\",\n  {\n    \"debugObjectName\": \"ObservableObject@1\",\n    \"name\": \"a\",\n    \"newValue\": 6,\n    \"observableKind\": \"object\",\n    \"oldValue\": 5,\n    \"spyReportStart\": true,\n    \"type\": \"update\",\n  },\n  \"calc y\",\n  {\n    \"debugObjectName\": \"ObservableObject@1.b\",\n    \"newValue\": 6,\n    \"observableKind\": \"computed\",\n    \"oldValue\": 5,\n    \"type\": \"update\",\n  },\n  {\n    \"name\": \"test\",\n    \"spyReportStart\": true,\n    \"type\": \"reaction\",\n  },\n  \"auto\",\n  {\n    \"spyReportEnd\": true,\n    \"type\": \"report-end\",\n  },\n  {\n    \"spyReportEnd\": true,\n    \"type\": \"report-end\",\n  },\n  \"post trans2\",\n  {\n    \"debugObjectName\": \"ObservableObject@1\",\n    \"name\": \"a\",\n    \"newValue\": 3,\n    \"observableKind\": \"object\",\n    \"oldValue\": 6,\n    \"spyReportStart\": true,\n    \"type\": \"update\",\n  },\n  {\n    \"spyReportEnd\": true,\n    \"type\": \"report-end\",\n  },\n  \"post trans3\",\n]\n`;\n\nexports[`issue 50 1`] = `\n[\n  \"auto\",\n  \"calc c\",\n  \"transstart\",\n  {\n    \"debugObjectName\": \"ObservableObject@1\",\n    \"name\": \"a\",\n    \"newValue\": false,\n    \"observableKind\": \"object\",\n    \"oldValue\": true,\n    \"spyReportStart\": true,\n    \"type\": \"update\",\n  },\n  {\n    \"spyReportEnd\": true,\n    \"type\": \"report-end\",\n  },\n  {\n    \"debugObjectName\": \"ObservableObject@1\",\n    \"name\": \"b\",\n    \"newValue\": true,\n    \"observableKind\": \"object\",\n    \"oldValue\": false,\n    \"spyReportStart\": true,\n    \"type\": \"update\",\n  },\n  {\n    \"spyReportEnd\": true,\n    \"type\": \"report-end\",\n  },\n  \"transpreend\",\n  {\n    \"name\": \"ar\",\n    \"spyReportStart\": true,\n    \"type\": \"reaction\",\n  },\n  \"auto\",\n  \"calc c\",\n  {\n    \"debugObjectName\": \"ObservableObject@1.c\",\n    \"newValue\": true,\n    \"observableKind\": \"computed\",\n    \"oldValue\": false,\n    \"type\": \"update\",\n  },\n  {\n    \"spyReportEnd\": true,\n    \"type\": \"report-end\",\n  },\n  \"transpostend\",\n]\n`;\n\nexports[`verify transaction events 1`] = `\n[\n  \"auto\",\n  \"calc c\",\n  \"transstart\",\n  {\n    \"debugObjectName\": \"ObservableObject@1\",\n    \"name\": \"b\",\n    \"newValue\": 2,\n    \"observableKind\": \"object\",\n    \"oldValue\": 1,\n    \"spyReportStart\": true,\n    \"type\": \"update\",\n  },\n  {\n    \"spyReportEnd\": true,\n    \"type\": \"report-end\",\n  },\n  \"transpreend\",\n  \"calc c\",\n  {\n    \"debugObjectName\": \"ObservableObject@1.c\",\n    \"newValue\": 2,\n    \"observableKind\": \"computed\",\n    \"oldValue\": 1,\n    \"type\": \"update\",\n  },\n  {\n    \"name\": \"ar\",\n    \"spyReportStart\": true,\n    \"type\": \"reaction\",\n  },\n  \"auto\",\n  {\n    \"spyReportEnd\": true,\n    \"type\": \"report-end\",\n  },\n  \"transpostend\",\n]\n`;\n"
  },
  {
    "path": "packages/mobx/__tests__/v5/base/__snapshots__/proxies.js.snap",
    "content": "// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing\n\nexports[`decorate proxies 1`] = `\n{\n  \"b\": {\n    \"configurable\": true,\n    \"enumerable\": true,\n    \"get\": [Function],\n    \"set\": [Function],\n  },\n  \"double\": {\n    \"configurable\": true,\n    \"enumerable\": false,\n    \"value\": [Function],\n    \"writable\": false,\n  },\n  \"x\": {\n    \"configurable\": true,\n    \"enumerable\": true,\n    \"get\": [Function],\n    \"set\": [Function],\n  },\n  \"y\": {\n    \"configurable\": true,\n    \"enumerable\": false,\n    \"get\": [Function],\n    \"set\": [Function],\n  },\n  Symbol(mobx administration): {\n    \"configurable\": true,\n    \"enumerable\": false,\n    \"value\": \"(omitted)\",\n    \"writable\": true,\n  },\n}\n`;\n\nexports[`extend proxies 1`] = `\n{\n  \"b\": {\n    \"configurable\": true,\n    \"enumerable\": true,\n    \"get\": [Function],\n    \"set\": [Function],\n  },\n  \"double\": {\n    \"configurable\": true,\n    \"enumerable\": false,\n    \"value\": [Function],\n    \"writable\": false,\n  },\n  \"x\": {\n    \"configurable\": true,\n    \"enumerable\": true,\n    \"get\": [Function],\n    \"set\": [Function],\n  },\n  \"y\": {\n    \"configurable\": true,\n    \"enumerable\": false,\n    \"get\": [Function],\n    \"set\": [Function],\n  },\n  Symbol(mobx administration): {\n    \"configurable\": true,\n    \"enumerable\": false,\n    \"value\": \"(omitted)\",\n    \"writable\": true,\n  },\n}\n`;\n\nexports[`non-proxied object 1`] = `\n{\n  \"b\": {\n    \"configurable\": true,\n    \"enumerable\": true,\n    \"value\": 4,\n    \"writable\": true,\n  },\n  \"double\": {\n    \"configurable\": true,\n    \"enumerable\": false,\n    \"value\": [Function],\n    \"writable\": false,\n  },\n  \"x\": {\n    \"configurable\": true,\n    \"enumerable\": true,\n    \"get\": [Function],\n    \"set\": [Function],\n  },\n  \"y\": {\n    \"configurable\": true,\n    \"enumerable\": false,\n    \"get\": [Function],\n    \"set\": [Function],\n  },\n  Symbol(mobx administration): {\n    \"configurable\": true,\n    \"enumerable\": false,\n    \"value\": \"(omitted)\",\n    \"writable\": true,\n  },\n}\n`;\n"
  },
  {
    "path": "packages/mobx/__tests__/v5/base/__snapshots__/spy.js.snap",
    "content": "// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing\n\nexports[`spy error 1`] = `\n[\n  {\n    \"name\": \"autorun\",\n    \"spyReportStart\": true,\n    \"type\": \"reaction\",\n  },\n  {\n    \"debugObjectName\": \"ObservableObject@1.y\",\n    \"newValue\": 4,\n    \"observableKind\": \"computed\",\n    \"oldValue\": CaughtException {\n      \"cause\": null,\n    },\n    \"type\": \"update\",\n  },\n  {\n    \"spyReportEnd\": true,\n    \"type\": \"report-end\",\n  },\n  {\n    \"debugObjectName\": \"ObservableObject@1\",\n    \"name\": \"x\",\n    \"newValue\": 3,\n    \"observableKind\": \"object\",\n    \"oldValue\": 2,\n    \"spyReportStart\": true,\n    \"type\": \"update\",\n  },\n  {\n    \"debugObjectName\": \"ObservableObject@1.y\",\n    \"newValue\": CaughtException {\n      \"cause\": \"Oops\",\n    },\n    \"observableKind\": \"computed\",\n    \"oldValue\": 4,\n    \"type\": \"update\",\n  },\n  {\n    \"name\": \"autorun\",\n    \"spyReportStart\": true,\n    \"type\": \"reaction\",\n  },\n  {\n    \"error\": \"Oops\",\n    \"message\": \"[mobx] Encountered an uncaught exception that was thrown by a reaction or observer component, in: 'Reaction[autorun]'\",\n    \"name\": \"autorun\",\n    \"type\": \"error\",\n  },\n  {\n    \"spyReportEnd\": true,\n    \"type\": \"report-end\",\n  },\n  {\n    \"spyReportEnd\": true,\n    \"type\": \"report-end\",\n  },\n  {\n    \"arguments\": [\n      4,\n    ],\n    \"name\": \"setX\",\n    \"spyReportStart\": true,\n    \"type\": \"action\",\n  },\n  {\n    \"debugObjectName\": \"ObservableObject@1\",\n    \"name\": \"x\",\n    \"newValue\": 4,\n    \"observableKind\": \"object\",\n    \"oldValue\": 3,\n    \"spyReportStart\": true,\n    \"type\": \"update\",\n  },\n  {\n    \"spyReportEnd\": true,\n    \"type\": \"report-end\",\n  },\n  {\n    \"debugObjectName\": \"ObservableObject@1.y\",\n    \"newValue\": 8,\n    \"observableKind\": \"computed\",\n    \"oldValue\": CaughtException {\n      \"cause\": \"Oops\",\n    },\n    \"type\": \"update\",\n  },\n  {\n    \"name\": \"autorun\",\n    \"spyReportStart\": true,\n    \"type\": \"reaction\",\n  },\n  {\n    \"spyReportEnd\": true,\n    \"type\": \"report-end\",\n  },\n  {\n    \"spyReportEnd\": true,\n    \"type\": \"report-end\",\n  },\n]\n`;\n\nexports[`spy output 1`] = `\n[\n  {\n    \"debugObjectName\": \"ObservableValue@1\",\n    \"newValue\": \"2\",\n    \"observableKind\": \"value\",\n    \"type\": \"create\",\n  },\n  {\n    \"debugObjectName\": \"ObservableValue@1\",\n    \"newValue\": 3,\n    \"observableKind\": \"value\",\n    \"oldValue\": 2,\n    \"spyReportStart\": true,\n    \"type\": \"update\",\n  },\n  {\n    \"spyReportEnd\": true,\n    \"type\": \"report-end\",\n  },\n  {\n    \"debugObjectName\": \"ObservableObject@2\",\n    \"name\": \"c\",\n    \"newValue\": 4,\n    \"observableKind\": \"object\",\n    \"spyReportStart\": true,\n    \"type\": \"add\",\n  },\n  {\n    \"spyReportEnd\": true,\n    \"type\": \"report-end\",\n  },\n  {\n    \"debugObjectName\": \"ObservableObject@2\",\n    \"name\": \"c\",\n    \"newValue\": 5,\n    \"observableKind\": \"object\",\n    \"oldValue\": 4,\n    \"spyReportStart\": true,\n    \"type\": \"update\",\n  },\n  {\n    \"spyReportEnd\": true,\n    \"type\": \"report-end\",\n  },\n  {\n    \"debugObjectName\": \"ObservableObject@2\",\n    \"name\": \"d\",\n    \"newValue\": 6,\n    \"observableKind\": \"object\",\n    \"spyReportStart\": true,\n    \"type\": \"add\",\n  },\n  {\n    \"spyReportEnd\": true,\n    \"type\": \"report-end\",\n  },\n  {\n    \"debugObjectName\": \"ObservableObject@2\",\n    \"name\": \"d\",\n    \"newValue\": 7,\n    \"observableKind\": \"object\",\n    \"oldValue\": 6,\n    \"spyReportStart\": true,\n    \"type\": \"update\",\n  },\n  {\n    \"spyReportEnd\": true,\n    \"type\": \"report-end\",\n  },\n  {\n    \"added\": [\n      1,\n      2,\n    ],\n    \"addedCount\": 2,\n    \"debugObjectName\": \"ObservableArray@3\",\n    \"index\": 0,\n    \"observableKind\": \"array\",\n    \"removed\": [],\n    \"removedCount\": 0,\n    \"spyReportStart\": true,\n    \"type\": \"splice\",\n  },\n  {\n    \"spyReportEnd\": true,\n    \"type\": \"report-end\",\n  },\n  {\n    \"added\": [\n      3,\n      4,\n    ],\n    \"addedCount\": 2,\n    \"debugObjectName\": \"ObservableArray@3\",\n    \"index\": 2,\n    \"observableKind\": \"array\",\n    \"removed\": [],\n    \"removedCount\": 0,\n    \"spyReportStart\": true,\n    \"type\": \"splice\",\n  },\n  {\n    \"spyReportEnd\": true,\n    \"type\": \"report-end\",\n  },\n  {\n    \"added\": [],\n    \"addedCount\": 0,\n    \"debugObjectName\": \"ObservableArray@3\",\n    \"index\": 0,\n    \"observableKind\": \"array\",\n    \"removed\": [\n      1,\n    ],\n    \"removedCount\": 1,\n    \"spyReportStart\": true,\n    \"type\": \"splice\",\n  },\n  {\n    \"spyReportEnd\": true,\n    \"type\": \"report-end\",\n  },\n  {\n    \"debugObjectName\": \"ObservableArray@3\",\n    \"index\": 2,\n    \"newValue\": 5,\n    \"observableKind\": \"array\",\n    \"oldValue\": 4,\n    \"spyReportStart\": true,\n    \"type\": \"update\",\n  },\n  {\n    \"spyReportEnd\": true,\n    \"type\": \"report-end\",\n  },\n  {\n    \"debugObjectName\": \"ObservableMap@4\",\n    \"name\": \"g\",\n    \"newValue\": 1,\n    \"observableKind\": \"map\",\n    \"spyReportStart\": true,\n    \"type\": \"add\",\n  },\n  {\n    \"spyReportEnd\": true,\n    \"type\": \"report-end\",\n  },\n  {\n    \"debugObjectName\": \"ObservableMap@4\",\n    \"name\": \"g\",\n    \"observableKind\": \"map\",\n    \"oldValue\": 1,\n    \"spyReportStart\": true,\n    \"type\": \"delete\",\n  },\n  {\n    \"spyReportEnd\": true,\n    \"type\": \"report-end\",\n  },\n  {\n    \"debugObjectName\": \"ObservableMap@4\",\n    \"name\": \"i\",\n    \"newValue\": 5,\n    \"observableKind\": \"map\",\n    \"spyReportStart\": true,\n    \"type\": \"add\",\n  },\n  {\n    \"spyReportEnd\": true,\n    \"type\": \"report-end\",\n  },\n  {\n    \"debugObjectName\": \"ObservableMap@4\",\n    \"name\": \"i\",\n    \"newValue\": 6,\n    \"observableKind\": \"map\",\n    \"oldValue\": 5,\n    \"spyReportStart\": true,\n    \"type\": \"update\",\n  },\n  {\n    \"spyReportEnd\": true,\n    \"type\": \"report-end\",\n  },\n  {\n    \"name\": \"Autorun@6\",\n    \"spyReportStart\": true,\n    \"type\": \"reaction\",\n  },\n  {\n    \"debugObjectName\": \"ComputedValue@5\",\n    \"newValue\": 6,\n    \"observableKind\": \"computed\",\n    \"oldValue\": CaughtException {\n      \"cause\": null,\n    },\n    \"type\": \"update\",\n  },\n  {\n    \"spyReportEnd\": true,\n    \"type\": \"report-end\",\n  },\n  {\n    \"debugObjectName\": \"ObservableValue@1\",\n    \"newValue\": 4,\n    \"observableKind\": \"value\",\n    \"oldValue\": 3,\n    \"spyReportStart\": true,\n    \"type\": \"update\",\n  },\n  {\n    \"debugObjectName\": \"ComputedValue@5\",\n    \"newValue\": 8,\n    \"observableKind\": \"computed\",\n    \"oldValue\": 6,\n    \"type\": \"update\",\n  },\n  {\n    \"name\": \"Autorun@6\",\n    \"spyReportStart\": true,\n    \"type\": \"reaction\",\n  },\n  {\n    \"spyReportEnd\": true,\n    \"type\": \"report-end\",\n  },\n  {\n    \"spyReportEnd\": true,\n    \"type\": \"report-end\",\n  },\n  {\n    \"debugObjectName\": \"ObservableValue@1\",\n    \"newValue\": 5,\n    \"observableKind\": \"value\",\n    \"oldValue\": 4,\n    \"spyReportStart\": true,\n    \"type\": \"update\",\n  },\n  {\n    \"spyReportEnd\": true,\n    \"type\": \"report-end\",\n  },\n  {\n    \"debugObjectName\": \"ObservableValue@1\",\n    \"newValue\": 6,\n    \"observableKind\": \"value\",\n    \"oldValue\": 5,\n    \"spyReportStart\": true,\n    \"type\": \"update\",\n  },\n  {\n    \"spyReportEnd\": true,\n    \"type\": \"report-end\",\n  },\n  {\n    \"debugObjectName\": \"ComputedValue@5\",\n    \"newValue\": 12,\n    \"observableKind\": \"computed\",\n    \"oldValue\": 8,\n    \"type\": \"update\",\n  },\n  {\n    \"name\": \"Autorun@6\",\n    \"spyReportStart\": true,\n    \"type\": \"reaction\",\n  },\n  {\n    \"spyReportEnd\": true,\n    \"type\": \"report-end\",\n  },\n  {\n    \"arguments\": [\n      7,\n    ],\n    \"name\": \"myTestAction\",\n    \"spyReportStart\": true,\n    \"type\": \"action\",\n  },\n  {\n    \"debugObjectName\": \"ObservableValue@1\",\n    \"newValue\": 7,\n    \"observableKind\": \"value\",\n    \"oldValue\": 6,\n    \"spyReportStart\": true,\n    \"type\": \"update\",\n  },\n  {\n    \"spyReportEnd\": true,\n    \"type\": \"report-end\",\n  },\n  {\n    \"debugObjectName\": \"ComputedValue@5\",\n    \"newValue\": 14,\n    \"observableKind\": \"computed\",\n    \"oldValue\": 12,\n    \"type\": \"update\",\n  },\n  {\n    \"name\": \"Autorun@6\",\n    \"spyReportStart\": true,\n    \"type\": \"reaction\",\n  },\n  {\n    \"spyReportEnd\": true,\n    \"type\": \"report-end\",\n  },\n  {\n    \"spyReportEnd\": true,\n    \"type\": \"report-end\",\n  },\n]\n`;\n"
  },
  {
    "path": "packages/mobx/__tests__/v5/base/action.js",
    "content": "import * as mobx from \"../../../src/mobx\"\nimport * as utils from \"../utils/test-utils\"\n\ntest(\"action should wrap in transaction\", () => {\n    const values = []\n\n    const observable = mobx.observable.box(0)\n    mobx.autorun(() => values.push(observable.get()))\n\n    const increment = mobx.action(\"increment\", amount => {\n        observable.set(observable.get() + amount * 2)\n        observable.set(observable.get() - amount) // oops\n    })\n\n    expect(mobx.isAction(increment)).toBe(true)\n    expect(mobx.isAction(function () {})).toBe(false)\n\n    increment(7)\n\n    expect(values).toEqual([0, 7])\n})\n\ntest(\"action modifications should be picked up 1\", () => {\n    const a = mobx.observable.box(1)\n    let i = 3\n    let b = 0\n\n    mobx.autorun(() => {\n        b = a.get() * 2\n    })\n\n    expect(b).toBe(2)\n\n    const action = mobx.action(() => {\n        a.set(++i)\n    })\n\n    action()\n    expect(b).toBe(8)\n\n    action()\n    expect(b).toBe(10)\n})\n\ntest(\"action modifications should be picked up 1\", () => {\n    const a = mobx.observable.box(1)\n    let b = 0\n\n    mobx.autorun(() => {\n        b = a.get() * 2\n    })\n\n    expect(b).toBe(2)\n\n    const action = mobx.action(() => {\n        a.set(a.get() + 1) // ha, no loop!\n    })\n\n    action()\n    expect(b).toBe(4)\n\n    action()\n    expect(b).toBe(6)\n})\n\ntest(\"action modifications should be picked up 3\", () => {\n    const a = mobx.observable.box(1)\n    let b = 0\n\n    const doubler = mobx.computed(() => a.get() * 2)\n\n    mobx.observe(\n        doubler,\n        () => {\n            b = doubler.get()\n        },\n        true\n    )\n\n    expect(b).toBe(2)\n\n    const action = mobx.action(() => {\n        a.set(a.get() + 1) // ha, no loop!\n    })\n\n    action()\n    expect(b).toBe(4)\n\n    action()\n    expect(b).toBe(6)\n})\n\ntest(\"test action should be untracked\", () => {\n    const a = mobx.observable.box(3)\n    const b = mobx.observable.box(4)\n    let latest = 0\n    let runs = 0\n\n    const action = mobx.action(baseValue => {\n        b.set(baseValue * 2)\n        latest = b.get() // without action this would trigger loop\n    })\n\n    const d = mobx.autorun(() => {\n        runs++\n        const current = a.get()\n        action(current)\n    })\n\n    expect(b.get()).toBe(6)\n    expect(latest).toBe(6)\n\n    a.set(7)\n    expect(b.get()).toBe(14)\n    expect(latest).toBe(14)\n\n    a.set(8)\n    expect(b.get()).toBe(16)\n    expect(latest).toBe(16)\n\n    b.set(7) // should have no effect\n    expect(a.get()).toBe(8)\n    expect(b.get()).toBe(7)\n    expect(latest).toBe(16) // effect not triggered\n\n    a.set(3)\n    expect(b.get()).toBe(6)\n    expect(latest).toBe(6)\n\n    expect(runs).toBe(4)\n\n    d()\n})\n\ntest(\"should be possible to create autorun in action\", () => {\n    const a = mobx.observable.box(1)\n    const values = []\n\n    const adder = mobx.action(inc => {\n        return mobx.autorun(() => {\n            values.push(a.get() + inc)\n        })\n    })\n\n    const d1 = adder(2)\n    a.set(3)\n    const d2 = adder(17)\n    a.set(24)\n    d1()\n    a.set(11)\n    d2()\n    a.set(100)\n\n    expect(values).toEqual([3, 5, 20, 26, 41, 28]) // n.b. order could swap as autorun creation order doesn't guarantee stuff\n})\n\ntest(\"should be possible to change unobserved state in an action called from computed\", () => {\n    const a = mobx.observable.box(2)\n\n    const testAction = mobx.action(() => {\n        a.set(3)\n    })\n\n    const c = mobx.computed(() => {\n        testAction()\n    })\n\n    expect.assertions(1)\n    mobx.autorun(() => {\n        expect(() => {\n            c.get()\n        }).not.toThrow(/bla/)\n    })\n\n    mobx._resetGlobalState()\n})\n\ntest(\"should be possible to change observed state in an action called from computed\", () => {\n    const a = mobx.observable.box(2)\n    const d = mobx.autorun(() => {\n        a.get()\n    })\n\n    const testAction = mobx.action(() => {\n        a.set(5) // this is fine\n        expect(a.get()).toBe(5)\n    })\n\n    const c = mobx.computed(() => {\n        expect(\n            utils.grabConsole(() => {\n                a.set(4)\n            })\n        ).toMatchInlineSnapshot(\n            `\"<STDOUT> [MobX] Side effects like changing state are not allowed at this point. Are you trying to modify state from, for example, a computed value or the render function of a React component? You can wrap side effects in 'runInAction' (or decorate functions with 'action') if needed. Tried to modify: ObservableValue@19\"`\n        )\n        expect(a.get()).toBe(4)\n        testAction()\n        return a.get()\n    })\n\n    expect(c.get()).toBe(5)\n\n    mobx._resetGlobalState()\n    d()\n})\n\ntest(\"should be possible to change observed state in an action called from computed\", () => {\n    const a = mobx.observable.box(2)\n    const d = mobx.autorun(() => {\n        a.get()\n    })\n\n    const testAction = mobx.action(() => {\n        a.set(3)\n    })\n\n    const c = mobx.computed(() => {\n        testAction()\n        return a.get()\n    })\n\n    expect(\n        utils.grabConsole(() => {\n            c.get()\n        })\n    ).toBe(\"\")\n\n    mobx._resetGlobalState()\n    d()\n})\n\ntest(\"action in autorun should be untracked\", () => {\n    const a = mobx.observable.box(2)\n    const b = mobx.observable.box(3)\n\n    const data = []\n    const multiplier = mobx.action(val => val * b.get())\n\n    const d = mobx.autorun(() => {\n        data.push(multiplier(a.get()))\n    })\n\n    a.set(3)\n    b.set(4)\n    a.set(5)\n\n    d()\n\n    a.set(6)\n\n    expect(data).toEqual([6, 9, 20])\n})\n\ntest(\"action should not be converted to computed when using (extend)observable\", () => {\n    const a = mobx.observable({\n        a: 1,\n        b: mobx.action(function () {\n            this.a++\n        })\n    })\n\n    expect(mobx.isAction(a.b)).toBe(true)\n    a.b()\n    expect(a.a).toBe(2)\n\n    mobx.extendObservable(a, {\n        c: mobx.action(function () {\n            this.a *= 3\n        })\n    })\n\n    expect(mobx.isAction(a.c)).toBe(true)\n    a.c()\n    expect(a.a).toBe(6)\n})\n\ntest(\"#286 exceptions in actions should not affect global state\", () => {\n    let autorunTimes = 0\n    function Todos() {\n        mobx.extendObservable(this, {\n            count: 0,\n            add: mobx.action(function () {\n                this.count++\n                if (this.count === 2) {\n                    throw new Error(\"An Action Error!\")\n                }\n            })\n        })\n    }\n    const todo = new Todos()\n    mobx.autorun(() => {\n        autorunTimes++\n        return todo.count\n    })\n    try {\n        todo.add()\n        expect(autorunTimes).toBe(2)\n        todo.add()\n    } catch (e) {\n        expect(autorunTimes).toBe(3)\n        todo.add()\n        expect(autorunTimes).toBe(4)\n    }\n})\n\ntest(\"runInAction\", () => {\n    mobx.configure({ enforceActions: \"observed\" })\n    const values = []\n    const events = []\n    const spyDisposer = mobx.spy(ev => {\n        if (ev.type === \"action\")\n            events.push({\n                name: ev.name,\n                arguments: ev.arguments\n            })\n    })\n\n    const observable = mobx.observable.box(0)\n    const d = mobx.autorun(() => values.push(observable.get()))\n\n    let res = mobx.runInAction(() => {\n        observable.set(observable.get() + 6 * 2)\n        observable.set(observable.get() - 3) // oops\n        return 2\n    })\n\n    expect(res).toBe(2)\n    expect(values).toEqual([0, 9])\n\n    res = mobx.runInAction(() => {\n        observable.set(observable.get() + 5 * 2)\n        observable.set(observable.get() - 4) // oops\n        return 3\n    })\n\n    expect(res).toBe(3)\n    expect(values).toEqual([0, 9, 15])\n    expect(events).toEqual([\n        { arguments: [], name: \"<unnamed action>\" },\n        { arguments: [], name: \"<unnamed action>\" }\n    ])\n\n    mobx.configure({ enforceActions: \"never\" })\n    spyDisposer()\n\n    d()\n})\n\ntest(\"action in autorun does not keep / make computed values alive\", () => {\n    let calls = 0\n    const myComputed = mobx.computed(() => calls++)\n    const callComputedTwice = () => {\n        myComputed.get()\n        myComputed.get()\n    }\n\n    const runWithMemoizing = fun => {\n        mobx.autorun(fun)()\n    }\n\n    callComputedTwice()\n    expect(calls).toBe(2)\n\n    runWithMemoizing(callComputedTwice)\n    expect(calls).toBe(3)\n\n    callComputedTwice()\n    expect(calls).toBe(5)\n\n    runWithMemoizing(function () {\n        mobx.runInAction(callComputedTwice)\n    })\n    expect(calls).toBe(6)\n\n    callComputedTwice()\n    expect(calls).toBe(8)\n})\n\ntest(\"computed values and actions\", () => {\n    let calls = 0\n\n    const number = mobx.observable.box(1)\n    const squared = mobx.computed(() => {\n        calls++\n        return number.get() * number.get()\n    })\n    const changeNumber10Times = mobx.action(() => {\n        squared.get()\n        squared.get()\n        for (let i = 0; i < 10; i++) number.set(number.get() + 1)\n    })\n\n    changeNumber10Times()\n    expect(calls).toBe(1)\n\n    mobx.autorun(() => {\n        changeNumber10Times()\n        expect(calls).toBe(2)\n    })()\n    expect(calls).toBe(2)\n\n    changeNumber10Times()\n    expect(calls).toBe(3)\n})\n\ntest(\"extendObservable respects action decorators\", () => {\n    const x = mobx.observable(\n        {\n            a1() {\n                return this\n            },\n            a2() {\n                return this\n            },\n            a3() {\n                return this\n            }\n        },\n        {\n            a1: mobx.action,\n            a2: mobx.action.bound,\n            a3: false\n        }\n    )\n    expect(mobx.isAction(x.a1)).toBe(true)\n    expect(mobx.isAction(x.a2)).toBe(true)\n    expect(mobx.isAction(x.a3)).toBe(false)\n\n    // const global = (function() {\n    //     return this\n    // })()\n\n    const { a1, a2, a3 } = x\n    expect(a1.call(x)).toBe(x)\n    // expect(a1()).toBe(global)\n    expect(a2.call(x)).toBeTruthy() // it is not this! proxies :) see test in proxies.js\n    expect(a2()).toBeTruthy()\n    expect(a3.call(x)).toBe(x)\n    // expect(a3()).toBe(global)\n})\n\ntest(\"expect warning for invalid decorator\", () => {\n    expect(() => {\n        mobx.observable({ x: 1 }, { x: undefined })\n    }).toThrow(/Invalid annotation/)\n})\n\ntest(\"bound actions bind\", () => {\n    let called = 0\n    const x = mobx.observable(\n        {\n            y: 0,\n            z: function (v) {\n                this.y += v\n                this.y += v\n            },\n            get yValue() {\n                called++\n                return this.y\n            }\n        },\n        {\n            z: mobx.action.bound\n        }\n    )\n\n    const d = mobx.autorun(() => {\n        x.yValue\n    })\n    const events = []\n    const d2 = mobx.spy(e => events.push(e))\n\n    const runner = x.z\n    runner(3)\n    expect(x.yValue).toBe(6)\n    expect(called).toBe(2)\n\n    expect(events.filter(e => e.type === \"action\").map(e => e.name)).toEqual([\"z\"])\n    expect(Object.keys(x)).toEqual([\"y\"])\n\n    d()\n    d2()\n})\n\ntest(\"Fix #1367\", () => {\n    const x = mobx.extendObservable(\n        {},\n        {\n            method() {}\n        },\n        {\n            method: mobx.action\n        }\n    )\n    expect(mobx.isAction(x.method)).toBe(true)\n})\n\ntest(\"error logging, #1836 - 1\", () => {\n    const messages = utils.supressConsole(() => {\n        try {\n            const a = mobx.observable.box(3)\n            mobx.autorun(() => {\n                if (a.get() === 4) throw new Error(\"Reaction error\")\n            })\n\n            mobx.action(() => {\n                a.set(4)\n                throw new Error(\"Action error\")\n            })()\n        } catch (e) {\n            expect(e.toString()).toEqual(\"Error: Action error\")\n            console.error(e)\n        }\n    })\n\n    expect(messages).toMatchSnapshot()\n})\n\ntest(\"error logging, #1836 - 2\", () => {\n    const messages = utils.supressConsole(() => {\n        try {\n            const a = mobx.observable.box(3)\n            mobx.autorun(() => {\n                if (a.get() === 4) throw new Error(\"Reaction error\")\n            })\n\n            mobx.action(() => {\n                a.set(4)\n            })()\n        } catch (e) {\n            expect(e.toString()).toEqual(\"Error: Action error\")\n            console.error(e)\n        }\n    })\n\n    expect(messages).toMatchSnapshot()\n})\n\ntest(\"out of order startAction / endAction\", () => {\n    const a1 = mobx._startAction(\"a1\")\n    const a2 = mobx._startAction(\"a2\")\n\n    expect(() => mobx._endAction(a1)).toThrow(\"invalid action stack\")\n\n    mobx._endAction(a2)\n\n    // double finishing\n    expect(() => mobx._endAction(a2)).toThrow(\"invalid action stack\")\n\n    mobx._endAction(a1)\n})\n\ntest(\"given actionName, the action function name should be defined as the actionName\", () => {\n    const a1 = mobx.action(\"testAction\", () => {})\n    expect(a1.name).toBe(\"testAction\")\n})\n\ntest(\"given anonymous action, the action name should be <unnamed action>\", () => {\n    const a1 = mobx.action(() => {})\n    expect(a1.name).toBe(\"<unnamed action>\")\n})\n\ntest(\"given function declaration, the action name should be as the function name\", () => {\n    const a1 = mobx.action(function testAction() {})\n    expect(a1.name).toBe(\"testAction\")\n})\n\ntest(\"auto action can be used in a derivation and is tracked\", () => {\n    const a = mobx.observable(1)\n    const events = []\n\n    const double = mobx._autoAction(() => {\n        return a.get() * 2\n    })\n\n    const d = mobx.autorun(() => {\n        events.push(double())\n    })\n\n    a.set(2)\n    expect(events).toEqual([2, 4])\n    d()\n})\n\ntest(\"auto action can be used to update and is batched\", () => {\n    const a = mobx.observable(1)\n    const events = []\n\n    const d = mobx.autorun(() => {\n        events.push(a.get() * 2)\n    })\n\n    mobx._autoAction(() => {\n        a.set(2)\n        a.set(3)\n    })()\n\n    expect(events).toEqual([2, 6]) // No 4!\n    d()\n})\n\ntest(\"auto action should not update state from inside a derivation\", async () => {\n    const a = mobx.observable(1)\n\n    const d = mobx.autorun(() => a.get()) // observe\n\n    const double = mobx._autoAction(() => {\n        a.set(a.get() * 2)\n    })\n\n    await mobx.when(() => {\n        expect(\n            utils.grabConsole(() => {\n                double()\n            })\n        ).toMatchInlineSnapshot(\n            `\"<STDOUT> [MobX] Side effects like changing state are not allowed at this point. Are you trying to modify state from, for example, a computed value or the render function of a React component? You can wrap side effects in 'runInAction' (or decorate functions with 'action') if needed. Tried to modify: ObservableValue@51\"`\n        )\n        return a.get() === 2\n    })\n    d()\n})\n\ntest(\"auto action should not update state from inside a derivation\", async () => {\n    const a = mobx.observable(1)\n\n    const d = mobx.autorun(() => a.get()) // observe\n\n    const double = mobx._autoAction(() => {\n        a.set(a.get() * 2)\n    })\n\n    await mobx.when(() => {\n        expect(\n            utils.grabConsole(() => {\n                mobx.runInAction(() => {\n                    // extra nesting, just in case\n                    mobx._autoAction(() => {\n                        double()\n                    })()\n                })\n            })\n        ).toBe(\"\")\n        return a.get() === 2\n    })\n    d()\n})\n\ntest(\"action forwards toString of underlying function\", async () => {\n    const fn = () => {\n        /* not actually doing anything */\n    }\n    fn.a = 42\n    fn.toString = function () {\n        return `toString referencing this, a=${this.a}`\n    }\n\n    const act = mobx.action(fn)\n\n    expect(fn.toString()).toBe(\"toString referencing this, a=42\")\n    expect(act.toString()).toBe(\"toString referencing this, a=42\")\n})\n"
  },
  {
    "path": "packages/mobx/__tests__/v5/base/api.js",
    "content": "const mobx = require(\"../../../src/mobx.ts\")\n\ntest(\"correct api should be exposed\", function () {\n    expect(\n        Object.keys(mobx)\n            .filter(key => mobx[key] !== undefined)\n            .sort()\n    ).toEqual(\n        [\n            \"$mobx\", // adminstration symbol\n            \"action\",\n            \"_allowStateChanges\",\n            \"_allowStateChangesInsideComputed\",\n            \"_allowStateReadsEnd\",\n            \"_allowStateReadsStart\",\n            \"_autoAction\",\n            \"autorun\",\n            \"comparer\",\n            \"computed\",\n            \"configure\",\n            \"createAtom\",\n            \"defineProperty\",\n            \"extendObservable\",\n            \"flow\",\n            \"isFlow\",\n            \"flowResult\",\n            \"FlowCancellationError\",\n            \"isFlowCancellationError\",\n            \"get\",\n            \"_getAdministration\",\n            \"getAtom\",\n            \"getDebugName\",\n            \"getDependencyTree\",\n            \"has\",\n            \"_getGlobalState\",\n            \"getObserverTree\",\n            \"intercept\",\n            \"_interceptReads\",\n            \"isAction\",\n            \"isBoxedObservable\",\n            \"isComputed\",\n            \"isComputedProp\",\n            \"_isComputingDerivation\",\n            \"isObservable\",\n            \"isObservableArray\",\n            \"isObservableMap\",\n            \"isObservableSet\",\n            \"isObservableObject\",\n            \"isObservableProp\",\n            \"keys\",\n            \"makeAutoObservable\",\n            \"makeObservable\",\n            \"ObservableMap\",\n            \"ObservableSet\",\n            \"observable\",\n            \"observe\",\n            \"onReactionError\",\n            \"onBecomeObserved\",\n            \"onBecomeUnobserved\",\n            \"ownKeys\",\n            \"Reaction\",\n            \"reaction\",\n            \"remove\",\n            \"_resetGlobalState\",\n            \"runInAction\",\n            \"set\",\n            \"spy\",\n            \"toJS\",\n            \"trace\",\n            \"transaction\",\n            \"untracked\",\n            \"values\",\n            \"entries\",\n            \"when\",\n            \"_startAction\",\n            \"_endAction\",\n            \"override\"\n        ].sort()\n    )\n})\n\ntest(\"mobx has no dependencies\", () => {\n    const pkg = require(\"../../../package.json\")\n    expect(pkg.dependencies).toEqual({})\n})\n"
  },
  {
    "path": "packages/mobx/__tests__/v5/base/array.js",
    "content": "\"use strict\"\n\nconst mobx = require(\"../../../src/mobx.ts\")\nconst { observable, when, _getAdministration, reaction, computed, makeObservable, autorun } = mobx\nconst iterall = require(\"iterall\")\n\nlet consoleWarnSpy\nafterEach(() => {\n    consoleWarnSpy?.mockRestore()\n})\n\ntest(\"test1\", function () {\n    const a = observable.array([])\n    expect(a.length).toBe(0)\n    expect(Object.keys(a)).toEqual([])\n    expect(a.slice()).toEqual([])\n\n    a.push(1)\n    expect(a.length).toBe(1)\n    expect(a.slice()).toEqual([1])\n\n    a[1] = 2\n    expect(a.length).toBe(2)\n    expect(a.slice()).toEqual([1, 2])\n\n    const sum = mobx.computed(function () {\n        return (\n            -1 +\n            a.reduce(function (a, b) {\n                return a + b\n            }, 1)\n        )\n    })\n\n    expect(sum.get()).toBe(3)\n\n    a[1] = 3\n    expect(a.length).toBe(2)\n    expect(a.slice()).toEqual([1, 3])\n    expect(sum.get()).toBe(4)\n\n    a.splice(1, 1, 4, 5)\n    expect(a.length).toBe(3)\n    expect(a.slice()).toEqual([1, 4, 5])\n    expect(sum.get()).toBe(10)\n\n    a.replace([2, 4])\n    expect(sum.get()).toBe(6)\n\n    a.splice(1, 1)\n    expect(sum.get()).toBe(2)\n    expect(a.slice()).toEqual([2])\n\n    a.spliceWithArray(0, 0, [4, 3])\n    expect(sum.get()).toBe(9)\n    expect(a.slice()).toEqual([4, 3, 2])\n\n    a.clear()\n    expect(sum.get()).toBe(0)\n    expect(a.slice()).toEqual([])\n\n    a.length = 4\n    expect(isNaN(sum.get())).toBe(true)\n    expect(a.length).toEqual(4)\n\n    expect(a.slice()).toEqual([undefined, undefined, undefined, undefined])\n\n    a.replace([1, 2, 2, 4])\n    expect(sum.get()).toBe(9)\n    a.length = 4\n    expect(sum.get()).toBe(9)\n\n    a.length = 2\n    expect(sum.get()).toBe(3)\n    expect(a.slice()).toEqual([1, 2])\n\n    expect(a.reverse()).toEqual([2, 1])\n    expect(a).toEqual([2, 1])\n    expect(a.slice()).toEqual([2, 1])\n\n    a.unshift(3)\n    expect(a.sort()).toEqual([1, 2, 3])\n    expect(a).toEqual([1, 2, 3])\n    expect(a.slice()).toEqual([1, 2, 3])\n\n    expect(JSON.stringify(a)).toBe(\"[1,2,3]\")\n\n    expect(a[1]).toBe(2)\n    a[2] = 4\n    expect(a[2]).toBe(4)\n\n    expect(Object.keys(a)).toEqual([\"0\", \"1\", \"2\"])\n})\n\ntest(\"cannot reverse or sort an array in a derivation\", () => {\n    const ar = observable([3, 2, 1])\n    reaction(\n        () => {\n            expect(() => {\n                ar.sort()\n            }).toThrowErrorMatchingInlineSnapshot(\n                `\"[MobX] [mobx] \\`observableArray.sort()\\` mutates the array in-place, which is not allowed inside a derivation. Use \\`array.slice().sort()\\` instead\"`\n            )\n        },\n        () => {}\n    )()\n    reaction(\n        () => {\n            expect(() => {\n                ar.reverse()\n            }).toThrowErrorMatchingInlineSnapshot(\n                `\"[MobX] [mobx] \\`observableArray.reverse()\\` mutates the array in-place, which is not allowed inside a derivation. Use \\`array.slice().reverse()\\` instead\"`\n            )\n        },\n        () => {}\n    )()\n\n    const c = computed(() => {\n        ar.sort()\n    })\n    autorun(() => {\n        expect(() => {\n            c.get()\n        }).toThrowErrorMatchingInlineSnapshot(\n            `\"[MobX] [mobx] \\`observableArray.sort()\\` mutates the array in-place, which is not allowed inside a derivation. Use \\`array.slice().sort()\\` instead\"`\n        )\n    })()\n\n    expect(ar).toEqual([3, 2, 1])\n})\n\ntest(\"array should support iterall / iterable \", () => {\n    const a = observable([1, 2, 3])\n\n    expect(iterall.isIterable(a)).toBe(true)\n\n    const values = []\n    iterall.forEach(a, v => values.push(v))\n\n    expect(values).toEqual([1, 2, 3])\n\n    let iter = iterall.getIterator(a)\n    expect(iter.next()).toEqual({ value: 1, done: false })\n    expect(iter.next()).toEqual({ value: 2, done: false })\n    expect(iter.next()).toEqual({ value: 3, done: false })\n    expect(iter.next()).toEqual({ value: undefined, done: true })\n\n    a.replace([])\n    iter = iterall.getIterator(a)\n    expect(iter.next()).toEqual({ value: undefined, done: true })\n})\n\ntest(\"find(findIndex) and remove\", function () {\n    const a = mobx.observable([10, 20, 20])\n    let idx = -1\n    function predicate(item, index) {\n        if (item === 20) {\n            idx = index\n            return true\n        }\n        return false\n    }\n    ;[].findIndex\n    expect(a.find(predicate)).toBe(20)\n    expect(a.findIndex(predicate)).toBe(1)\n    expect(a.find(predicate)).toBe(20)\n\n    expect(a.remove(20)).toBe(true)\n    expect(a.find(predicate)).toBe(20)\n    expect(idx).toBe(1)\n    expect(a.findIndex(predicate)).toBe(1)\n    idx = -1\n    expect(a.remove(20)).toBe(true)\n    expect(a.find(predicate)).toBe(undefined)\n    expect(idx).toBe(-1)\n    expect(a.findIndex(predicate)).toBe(-1)\n\n    expect(a.remove(20)).toBe(false)\n})\n\ntest(\"findLast(findLastIndex) and remove\", function () {\n    const a = mobx.observable([10, 20, 20])\n    let idx = -1\n    function predicate(item, index) {\n        if (item === 20) {\n            idx = index\n            return true\n        }\n        return false\n    }\n    ;[].findLastIndex;\n    expect(a.findLast(predicate)).toBe(20)\n    expect(a.findLastIndex(predicate)).toBe(2)\n    expect(a.findLast(predicate)).toBe(20)\n\n    expect(a.remove(20)).toBe(true)\n    expect(a.find(predicate)).toBe(20)\n    expect(idx).toBe(1)\n    expect(a.findIndex(predicate)).toBe(1)\n    idx = -1\n    expect(a.remove(20)).toBe(true)\n    expect(a.findLast(predicate)).toBe(undefined)\n    expect(idx).toBe(-1)\n    expect(a.findLastIndex(predicate)).toBe(-1)\n\n    expect(a.remove(20)).toBe(false)\n})\n\ntest(\"concat should automatically slice observable arrays, #260\", () => {\n    const a1 = mobx.observable([1, 2])\n    const a2 = mobx.observable([3, 4])\n    expect(a1.concat(a2)).toEqual([1, 2, 3, 4])\n})\n\ntest(\"observe\", function () {\n    const ar = mobx.observable([1, 4])\n    const buf = []\n    const disposer = mobx.observe(\n        ar,\n        function (changes) {\n            buf.push(changes)\n        },\n        true\n    )\n\n    ar[1] = 3 // 1,3\n    ar[2] = 0 // 1, 3, 0\n    ar.shift() // 3, 0\n    ar.push(1, 2) // 3, 0, 1, 2\n    ar.splice(1, 2, 3, 4) // 3, 3, 4, 2\n    expect(ar.slice()).toEqual([3, 3, 4, 2])\n    ar.splice(6)\n    ar.splice(6, 2)\n    ar.replace([\"a\"])\n    ar.pop()\n    ar.pop() // does not fire anything\n\n    // check the object param\n    buf.forEach(function (change) {\n        expect(change.object).toBe(ar)\n        delete change.object\n        expect(change.observableKind).toBe(\"array\")\n        delete change.observableKind\n        delete change.debugObjectName\n    })\n\n    const result = [\n        { type: \"splice\", index: 0, addedCount: 2, removed: [], added: [1, 4], removedCount: 0 },\n        { type: \"update\", index: 1, oldValue: 4, newValue: 3 },\n        { type: \"splice\", index: 2, addedCount: 1, removed: [], added: [0], removedCount: 0 },\n        { type: \"splice\", index: 0, addedCount: 0, removed: [1], added: [], removedCount: 1 },\n        { type: \"splice\", index: 2, addedCount: 2, removed: [], added: [1, 2], removedCount: 0 },\n        {\n            type: \"splice\",\n            index: 1,\n            addedCount: 2,\n            removed: [0, 1],\n            added: [3, 4],\n            removedCount: 2\n        },\n        {\n            type: \"splice\",\n            index: 0,\n            addedCount: 1,\n            removed: [3, 3, 4, 2],\n            added: [\"a\"],\n            removedCount: 4\n        },\n        { type: \"splice\", index: 0, addedCount: 0, removed: [\"a\"], added: [], removedCount: 1 }\n    ]\n\n    expect(buf).toEqual(result)\n\n    disposer()\n    ar[0] = 5\n    expect(buf).toEqual(result)\n})\n\ntest(\"array modification1\", function () {\n    const a = mobx.observable([1, 2, 3])\n    const r = a.splice(-10, 5, 4, 5, 6)\n    expect(a.slice()).toEqual([4, 5, 6])\n    expect(r).toEqual([1, 2, 3])\n})\n\ntest(\"serialize\", function () {\n    let a = [1, 2, 3]\n    const m = mobx.observable(a)\n\n    expect(JSON.stringify(m)).toEqual(JSON.stringify(a))\n\n    expect(a).toEqual(m.slice())\n\n    a = [4]\n    m.replace(a)\n    expect(JSON.stringify(m)).toEqual(JSON.stringify(a))\n    expect(a).toEqual(m.toJSON())\n})\n\ntest(\"array modification functions\", function () {\n    const ars = [[], [1, 2, 3]]\n    const funcs = [\"push\", \"pop\", \"shift\", \"unshift\"]\n    funcs.forEach(function (f) {\n        ars.forEach(function (ar) {\n            const a = ar.slice()\n            const b = mobx.observable(a)\n            const res1 = a[f](4)\n            const res2 = b[f](4)\n            expect(res1).toEqual(res2)\n            expect(a).toEqual(b.slice())\n        })\n    })\n})\n\ntest(\"array modifications\", function () {\n    const a2 = mobx.observable([])\n    const inputs = [undefined, -10, -4, -3, -1, 0, 1, 3, 4, 10]\n    const arrays = [\n        [],\n        [1],\n        [1, 2, 3, 4],\n        [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11],\n        [1, undefined],\n        [undefined]\n    ]\n    for (let i = 0; i < inputs.length; i++)\n        for (let j = 0; j < inputs.length; j++)\n            for (let k = 0; k < arrays.length; k++)\n                for (let l = 0; l < arrays.length; l++) {\n                    ;[\n                        \"array mod: [\",\n                        arrays[k].toString(),\n                        \"] i: \",\n                        inputs[i],\n                        \" d: \",\n                        inputs[j],\n                        \" [\",\n                        arrays[l].toString(),\n                        \"]\"\n                    ].join(\" \")\n                    const a1 = arrays[k].slice()\n                    a2.replace(a1)\n                    const res1 = a1.splice.apply(a1, [inputs[i], inputs[j]].concat(arrays[l]))\n                    const res2 = a2.splice.apply(a2, [inputs[i], inputs[j]].concat(arrays[l]))\n                    expect(a1.slice()).toEqual(a2.slice())\n                    expect(res1).toEqual(res2)\n                    expect(a1.length).toBe(a2.length)\n                }\n})\n\ntest(\"is array\", function () {\n    const x = mobx.observable([])\n    expect(x instanceof Array).toBe(true)\n\n    // would be cool if this would return true...\n    expect(Array.isArray(x)).toBe(true)\n})\n\ntest(\"stringifies same as ecma array\", function () {\n    const x = mobx.observable([])\n    expect(x instanceof Array).toBe(true)\n\n    // would be cool if these two would return true...\n    expect(x.toString()).toBe(\"\")\n    expect(x.toLocaleString()).toBe(\"\")\n    x.push(1, 2)\n    expect(x.toString()).toBe(\"1,2\")\n    expect(x.toLocaleString()).toBe(\"1,2\")\n})\n\ntest(\"observes when stringified\", function () {\n    const x = mobx.observable([])\n    let c = 0\n    mobx.autorun(function () {\n        x.toString()\n        c++\n    })\n    x.push(1)\n    expect(c).toBe(2)\n})\n\ntest(\"observes when stringified to locale\", function () {\n    const x = mobx.observable([])\n    let c = 0\n    mobx.autorun(function () {\n        x.toLocaleString()\n        c++\n    })\n    x.push(1)\n    expect(c).toBe(2)\n})\n\ntest(\"react to sort changes\", function () {\n    const x = mobx.observable([4, 2, 3])\n    const sortedX = mobx.computed(function () {\n        return x.slice().sort()\n    })\n    let sorted\n\n    mobx.autorun(function () {\n        sorted = sortedX.get()\n    })\n\n    expect(x.slice()).toEqual([4, 2, 3])\n    expect(sorted).toEqual([2, 3, 4])\n    x.push(1)\n    expect(x.slice()).toEqual([4, 2, 3, 1])\n    expect(sorted).toEqual([1, 2, 3, 4])\n    x.shift()\n    expect(x.slice()).toEqual([2, 3, 1])\n    expect(sorted).toEqual([1, 2, 3])\n})\n\ntest(\"autoextend buffer length\", function () {\n    const ar = observable(new Array(1000))\n    let changesCount = 0\n    mobx.observe(ar, () => ++changesCount)\n\n    ar[ar.length] = 0\n    ar.push(0)\n\n    expect(changesCount).toBe(2)\n})\n\ntest(\"array exposes correct keys\", () => {\n    const keys = []\n    const ar = observable([1, 2])\n    for (const key in ar) keys.push(key)\n\n    expect(keys).toEqual([\"0\", \"1\"])\n})\n\ntest(\"replace can handle large arrays\", () => {\n    const a = mobx.observable([])\n    const b = []\n    b.length = 1000 * 1000\n    expect(() => {\n        a.replace(b)\n    }).not.toThrow()\n\n    expect(() => {\n        a.spliceWithArray(0, 0, b)\n    }).not.toThrow()\n})\n\ntest(\"can iterate arrays\", () => {\n    const x = mobx.observable([])\n    const y = []\n    const d = mobx.reaction(\n        () => Array.from(x),\n        items => y.push(items),\n        { fireImmediately: true }\n    )\n\n    x.push(\"a\")\n    x.push(\"b\")\n    expect(y).toEqual([[], [\"a\"], [\"a\", \"b\"]])\n    d()\n})\n\ntest(\"array is concat spreadable, #1395\", () => {\n    const x = mobx.observable([1, 2, 3, 4])\n    const y = [5].concat(x)\n    expect(y.length).toBe(5)\n    expect(y).toEqual([5, 1, 2, 3, 4])\n})\n\ntest(\"array is spreadable, #1395\", () => {\n    const x = mobx.observable([1, 2, 3, 4])\n    expect([5, ...x]).toEqual([5, 1, 2, 3, 4])\n\n    const y = mobx.observable([])\n    expect([5, ...y]).toEqual([5])\n})\n\ntest(\"array supports toStringTag, #1490\", () => {\n    // N.B. on old environments this requires polyfils for these symbols *and* Object.prototype.toString.\n    // core-js provides both\n    const a = mobx.observable([])\n    expect(Object.prototype.toString.call(a)).toBe(\"[object Array]\")\n})\n\ntest(\"slice works\", () => {\n    const a = mobx.observable([1, 2, 3])\n    expect(a.slice(0, 2)).toEqual([1, 2])\n})\n\ntest(\"slice is reactive\", () => {\n    const a = mobx.observable([1, 2, 3])\n    let ok = false\n    when(\n        () => a.slice().length === 4,\n        () => (ok = true)\n    )\n    expect(ok).toBe(false)\n    a.push(1)\n    expect(ok).toBe(true)\n})\n\ntest(\"toString\", () => {\n    expect(mobx.observable([1, 2]).toString()).toEqual([1, 2].toString())\n    expect(mobx.observable([1, 2]).toLocaleString()).toEqual([1, 2].toLocaleString())\n})\n\ntest(\"can define properties on arrays\", () => {\n    const ar = observable.array([1, 2])\n    Object.defineProperty(ar, \"toString\", {\n        enumerable: false,\n        configurable: true,\n        value: function () {\n            return \"hoi\"\n        }\n    })\n\n    expect(ar.toString()).toBe(\"hoi\")\n    expect(\"\" + ar).toBe(\"hoi\")\n})\n\ntest(\"concats correctly #1667\", () => {\n    const x = observable({ data: [] })\n\n    function generate(count) {\n        const d = []\n        for (let i = 0; i < count; i++) d.push({})\n        return d\n    }\n\n    x.data = generate(10000)\n    const first = x.data[0]\n    expect(Array.isArray(x.data)).toBe(true)\n\n    x.data = x.data.concat(generate(1000))\n    expect(Array.isArray(x.data)).toBe(true)\n    expect(x.data[0]).toBe(first)\n    expect(x.data.length).toBe(11000)\n})\n\ntest(\"dehances last value on shift/pop\", () => {\n    const x1 = observable([3, 5])\n    _getAdministration(x1).dehancer = value => {\n        return value * 2\n    }\n    expect(x1.shift()).toBe(6)\n    expect(x1.shift()).toBe(10)\n\n    const x2 = observable([3, 5])\n    _getAdministration(x2).dehancer = value => {\n        return value * 2\n    }\n    expect(x2.pop()).toBe(10)\n    expect(x2.pop()).toBe(6)\n})\n\ntest(\"#2044 symbol key on array\", () => {\n    const x = observable([1, 2])\n    const s = Symbol(\"test\")\n    x[s] = 3\n    expect(x[s]).toBe(3)\n\n    let reacted = false\n    const d = reaction(\n        () => x[s],\n        () => {\n            reacted = true\n        }\n    )\n\n    x[s] = 4\n    expect(x[s]).toBe(4)\n\n    // although x[s] can be stored, it won't be reactive!\n    expect(reacted).toBe(false)\n    d()\n})\n\ntest(\"#2044 non-symbol key on array\", () => {\n    const x = observable([1, 2])\n    const s = \"test\"\n    x[s] = 3\n    expect(x[s]).toBe(3)\n\n    let reacted = false\n    const d = reaction(\n        () => x[s],\n        () => {\n            reacted = true\n        }\n    )\n\n    x[s] = 4\n    expect(x[s]).toBe(4)\n\n    // although x[s] can be stored, it won't be reactive!\n    expect(reacted).toBe(false)\n    d()\n})\n\ndescribe(\"extended array prototype\", () => {\n    const extensionKey = \"__extension\"\n\n    // A single setup/teardown for all tests because we're pretending to do a\n    // singular global (dirty) change to the \"environment\".\n    beforeAll(() => {\n        Array.prototype[extensionKey] = () => {}\n    })\n    afterAll(() => {\n        delete Array.prototype[extensionKey]\n    })\n\n    test(\"creating an observable should work\", () => {\n        mobx.observable({ b: \"b\" })\n    })\n\n    test(\"extending an observable should work\", () => {\n        const a = { b: \"b\" }\n        mobx.extendObservable(a, {})\n    })\n})\n\ntest(\"reproduce #2021\", () => {\n    expect.assertions(1)\n    try {\n        Array.prototype.extension = function () {\n            console.log(\"I'm the extension!\", this.length)\n        }\n\n        class Test {\n            data = null\n\n            constructor() {\n                makeObservable(this, {\n                    data: observable\n                })\n            }\n        }\n\n        const test = new Test()\n\n        mobx.autorun(() => {\n            if (test.data) expect(test.data.someStr).toBe(\"123\")\n        })\n\n        test.data = { someStr: \"123\" }\n    } finally {\n        delete Array.prototype.extension\n    }\n})\n\ntest(\"correct array should be passed to callbacks #2326\", () => {\n    const array = observable([1, 2, 3])\n\n    function callback() {\n        const lastArg = arguments[arguments.length - 1]\n        expect(lastArg).toBe(array)\n    }\n    ;[\n        \"every\",\n        \"filter\",\n        \"find\",\n        \"findIndex\",\n        \"findLast\",\n        \"findLastIndex\",\n        \"flatMap\",\n        \"forEach\",\n        \"map\",\n        \"reduce\",\n        \"reduceRight\",\n        \"some\"\n    ].forEach(method => {\n        if (Array.prototype[method]) array[method](callback)\n        else console.warn(\"SKIPPING: \" + method)\n    })\n})\n\ntest(\"very long arrays can be safely passed to nativeArray.concat #2379\", () => {\n    const nativeArray = [\"a\", \"b\"]\n    const longNativeArray = [...Array(10000).keys()] // MAX_SPLICE_SIZE seems to be the threshold\n    const longObservableArray = observable(longNativeArray)\n    expect(longObservableArray.length).toBe(10000)\n    expect(longObservableArray).toEqual(longNativeArray)\n    expect(longObservableArray[9000]).toBe(longNativeArray[9000])\n    expect(longObservableArray[9999]).toBe(longNativeArray[9999])\n    expect(longObservableArray[10000]).toBe(longNativeArray[10000])\n\n    const expectedArray = nativeArray.concat(longNativeArray)\n    const actualArray = nativeArray.concat(longObservableArray)\n\n    expect(actualArray).toEqual(expectedArray)\n\n    const anotherArray = [0, 1, 2, 3, 4, 5]\n    const observableArray = observable(anotherArray)\n    const r1 = anotherArray.splice(2, 2, ...longNativeArray)\n    const r2 = observableArray.splice(2, 2, ...longNativeArray)\n    expect(r2).toEqual(r1)\n    expect(observableArray).toEqual(anotherArray)\n})\n\ndescribe(\"dehances\", () => {\n    function supressConsoleWarn(fn) {\n        const { warn } = console\n        console.warn = () => {}\n        const result = fn()\n        console.warn = warn\n        return result\n    }\n\n    const dehancer = thing => {\n        // Dehance only objects of a proper type\n        if (thing && typeof thing === \"object\" && thing.hasOwnProperty(\"value\")) {\n            return thing.value\n        }\n        // Support nested arrays\n        if (Array.isArray(thing)) {\n            // If array has own dehancer it's still applied prior to ours.\n            // It doesn't matter how many dehancers we apply,\n            // if they ignore unknown types.\n            return thing.map(dehancer)\n        }\n        // Ignore unknown types\n        return thing\n    }\n\n    let enhanced, dehanced, array\n\n    beforeEach(() => {\n        enhanced = [{ value: 1 }, { value: 2 }, { value: 3 }]\n        dehanced = enhanced.map(dehancer)\n        array = observable(enhanced)\n        mobx._getAdministration(array).dehancer = dehancer\n    })\n\n    test(\"slice\", () => {\n        expect(array.slice()).toEqual(dehanced.slice())\n    })\n\n    test(\"filter\", () => {\n        const predicate = value => value === 2\n        expect(array.filter(predicate)).toEqual(dehanced.filter(predicate))\n    })\n\n    test(\"concat\", () => {\n        expect(array.concat(4)).toEqual(dehanced.concat(4))\n    })\n\n    test(\"entries\", () => {\n        expect([...array.entries()]).toEqual([...dehanced.entries()])\n    })\n\n    test(\"every\", () => {\n        array.every((value, index) => {\n            expect(value).toEqual(dehanced[index])\n            return true\n        })\n    })\n\n    test(\"find\", () => {\n        const predicate = value => value === 2\n        expect(array.find(predicate)).toEqual(dehanced.find(predicate))\n    })\n\n    test(\"forEach\", () => {\n        array.forEach((value, index) => {\n            expect(value).toEqual(dehanced[index])\n        })\n    })\n\n    test(\"includes\", () => {\n        expect(array.includes(2)).toEqual(dehanced.includes(2))\n    })\n\n    test(\"indexOf\", () => {\n        expect(array.indexOf(2)).toEqual(dehanced.indexOf(2))\n    })\n\n    test(\"join\", () => {\n        expect(array.join()).toEqual(dehanced.join())\n    })\n\n    test(\"lastIndexOf\", () => {\n        expect(array.lastIndexOf(2)).toEqual(dehanced.lastIndexOf(2))\n    })\n\n    test(\"map\", () => {\n        array.map((value, index) => {\n            expect(value).toEqual(dehanced[index])\n            return value\n        })\n    })\n\n    test(\"pop\", () => {\n        expect(array.pop()).toEqual(dehanced.pop())\n    })\n\n    test(\"reduce\", () => {\n        array.reduce((_, value, index) => {\n            expect(value).toEqual(dehanced[index])\n        })\n    })\n\n    test(\"reduceRight\", () => {\n        array.reduceRight((_, value, index) => {\n            expect(value).toEqual(dehanced[index])\n        })\n    })\n\n    test(\"reverse\", () => {\n        const reversedArray = supressConsoleWarn(() => array.reverse())\n        expect(reversedArray).toEqual(dehanced.reverse())\n    })\n\n    test(\"shift\", () => {\n        expect(array.shift()).toEqual(dehanced.shift())\n    })\n\n    test(\"some\", () => {\n        array.some((value, index) => {\n            expect(value).toEqual(dehanced[index])\n            return false\n        })\n    })\n\n    test(\"splice\", () => {\n        expect(array.splice(1, 2)).toEqual(dehanced.splice(1, 2))\n    })\n\n    test(\"sort\", () => {\n        const comparator = (a, b) => {\n            expect(typeof a).toEqual(\"number\")\n            expect(typeof b).toEqual(\"number\")\n            return b > a\n        }\n        const sortedArray = supressConsoleWarn(() => array.sort(comparator))\n        expect(sortedArray).toEqual(dehanced.sort(comparator))\n    })\n\n    test(\"values\", () => {\n        expect([...array.values()]).toEqual([...dehanced.values()])\n    })\n\n    test(\"toReversed\", () => {\n        expect(array.toReversed()).toEqual(dehanced.toReversed())\n    })\n\n    test(\"toSorted\", () => {\n        expect(array.toSorted()).toEqual(dehanced.toSorted())\n    })\n\n    test(\"toSorted with args\", () => {\n        expect(array.toSorted((a, b) => a - b)).toEqual(dehanced.toSorted((a, b) => a - b))\n    })\n\n    test(\"toSpliced\", () => {\n        expect(array.toSpliced(1, 2)).toEqual(dehanced.toSpliced(1, 2))\n    })\n\n    test(\"with\", () => {\n        expect(array.with(1, 5)).toEqual(dehanced.with(1, 5))\n    })\n\n    test(\"at\", () => {\n        expect(array.at(1)).toEqual(dehanced.at(1))\n        expect(array.at(-1)).toEqual(dehanced.at(-1))\n    })\n\n    test(\"flat/flatMap\", () => {\n        const nestedArray = [{ value: 1 }, [{ value: 2 }, [{ value: 3 }]]]\n        const dehancedNestedArray = nestedArray.map(dehancer)\n\n        // flat\n        array.replace(nestedArray)\n        expect(array.flat(Infinity)).toEqual(dehancedNestedArray.flat(Infinity))\n\n        // flatMap\n        const flattenedArray = array.flatMap((value, index) => {\n            expect(value).toEqual(dehancedNestedArray[index])\n            return value\n        })\n        expect(flattenedArray).toEqual(dehancedNestedArray.flat(1))\n    })\n})\n\ntest(\"reduce without initial value #2432\", () => {\n    const array = [1, 2, 3]\n    const observableArray = observable(array)\n\n    const arrayReducerArgs = []\n    const observableArrayReducerArgs = []\n\n    const arraySum = array.reduce((...args) => {\n        arrayReducerArgs.push(args)\n        return args[0] + args[1]\n    })\n\n    const observableArraySum = observableArray.reduce((...args) => {\n        observableArrayReducerArgs.push(args)\n        return args[0] + args[1]\n    })\n\n    expect(arraySum).toEqual(1 + 2 + 3)\n    expect(observableArraySum).toEqual(arraySum)\n    expect(arrayReducerArgs).toEqual(observableArrayReducerArgs)\n})\n\ntest(\"accessing out of bound indices is supported\", () => {\n    consoleWarnSpy = jest.spyOn(console, \"warn\").mockImplementation(() => {\n        throw new Error(`Unexpected console.warn call`)\n    })\n\n    const array = observable([])\n\n    array[1]\n    array[2]\n    array[1001] = \"foo\"\n    expect(array.length).toBe(1002)\n    expect(array[1001]).toBe(\"foo\")\n})\n"
  },
  {
    "path": "packages/mobx/__tests__/v5/base/autorun.js",
    "content": "/**\n * @type {typeof import(\"./../../../src/v5/mobx\")}\n */\nconst mobx = require(\"../../../src/mobx.ts\")\nconst utils = require(\"../../v5/utils/test-utils\")\n\ntest(\"autorun passes Reaction as an argument to view function\", function () {\n    const a = mobx.observable.box(1)\n    const values = []\n\n    mobx.autorun(r => {\n        expect(typeof r.dispose).toBe(\"function\")\n        if (a.get() === \"pleaseDispose\") r.dispose()\n        values.push(a.get())\n    })\n\n    a.set(2)\n    a.set(2)\n    a.set(\"pleaseDispose\")\n    a.set(3)\n    a.set(4)\n\n    expect(values).toEqual([1, 2, \"pleaseDispose\"])\n})\n\ntest(\"autorun can be disposed on first run\", function () {\n    const a = mobx.observable.box(1)\n    const values = []\n\n    mobx.autorun(r => {\n        r.dispose()\n        values.push(a.get())\n    })\n\n    a.set(2)\n\n    expect(values).toEqual([1])\n})\n\ntest(\"autorun can be disposed using AbortSignal\", function () {\n    const a = mobx.observable.box(1)\n    const ac = new AbortController()\n    const values = []\n\n    mobx.autorun(\n        () => {\n            values.push(a.get())\n        },\n        { signal: ac.signal }\n    )\n\n    a.set(2)\n    a.set(3)\n    ac.abort()\n    a.set(4)\n\n    expect(values).toEqual([1, 2, 3])\n})\n\ntest(\"autorun should not run first time when passing already aborted AbortSignal\", function () {\n    const a = mobx.observable.box(1)\n    const ac = new AbortController()\n    const values = []\n\n    ac.abort()\n\n    mobx.autorun(\n        () => {\n            values.push(a.get())\n        },\n        { signal: ac.signal }\n    )\n\n    expect(values).toEqual([])\n})\n\ntest(\"autorun warns when passed an action\", function () {\n    const action = mobx.action(() => {})\n    expect.assertions(1)\n    expect(() => mobx.autorun(action)).toThrow(/Autorun does not accept actions/)\n})\n\ntest(\"autorun batches automatically\", function () {\n    let runs = 0\n    let a1runs = 0\n    let a2runs = 0\n\n    const x = mobx.observable({\n        a: 1,\n        b: 1,\n        c: 1,\n        get d() {\n            runs++\n            return this.c + this.b\n        }\n    })\n\n    const d1 = mobx.autorun(() => {\n        a1runs++\n        x.d // read\n    })\n\n    const d2 = mobx.autorun(() => {\n        a2runs++\n        x.b = x.a\n        x.c = x.a\n    })\n\n    expect(a1runs).toBe(1)\n    expect(a2runs).toBe(1)\n    expect(runs).toBe(1)\n\n    x.a = 17\n\n    expect(a1runs).toBe(2)\n    expect(a2runs).toBe(2)\n    expect(runs).toBe(2)\n\n    d1()\n    d2()\n})\n\ntest(\"autorun tracks invalidation of unbound dependencies\", function () {\n    const a = mobx.observable.box(0)\n    const b = mobx.observable.box(0)\n    const c = mobx.computed(() => a.get() + b.get())\n    const values = []\n\n    mobx.autorun(() => {\n        values.push(c.get())\n        b.set(100)\n    })\n\n    a.set(1)\n    expect(values).toEqual([0, 100, 101])\n})\n\ntest(\"when effect is an action\", function (done) {\n    const a = mobx.observable.box(0)\n\n    mobx.configure({ enforceActions: \"observed\" })\n    mobx.when(\n        () => a.get() === 1,\n        () => {\n            a.set(2)\n\n            mobx.configure({ enforceActions: \"never\" })\n            done()\n        },\n        { timeout: 1 }\n    )\n\n    mobx.runInAction(() => {\n        a.set(1)\n    })\n})\n\ndescribe(\"autorun opts requiresObservable\", () => {\n    test(\"warn when no observable\", () => {\n        utils.consoleWarn(() => {\n            const disposer = mobx.autorun(() => 2, {\n                requiresObservable: true\n            })\n\n            disposer()\n        }, /is created\\/updated without reading any observable value/)\n    })\n\n    test(\"Don't warn when observable\", () => {\n        const obsr = mobx.observable({\n            x: 1\n        })\n\n        const messages = utils.supressConsole(() => {\n            const disposer = mobx.autorun(() => obsr.x, {\n                requiresObservable: true\n            })\n\n            disposer()\n        })\n\n        expect(messages.length).toBe(0)\n    })\n})\n"
  },
  {
    "path": "packages/mobx/__tests__/v5/base/autorunAsync.js",
    "content": "/**\n * @type {typeof import(\"../../../src/v5/mobx\")}\n */\nconst mobx = require(\"../../../src/mobx.ts\")\n\nconst utils = require(\"../../v5/utils/test-utils\")\n\nconst { $mobx } = mobx\n\ntest(\"autorun 1\", function (done) {\n    let _fired = 0\n    let _result = null\n    let _cCalcs = 0\n    const to = setTimeout\n\n    function check(fired, cCalcs, result) {\n        expect(_fired).toBe(fired)\n        expect(_cCalcs).toBe(cCalcs)\n        if (fired) expect(_result).toBe(result)\n        _fired = 0\n        _cCalcs = 0\n    }\n\n    const a = mobx.observable.box(2)\n    const b = mobx.observable.box(3)\n    const c = mobx.computed(function () {\n        _cCalcs++\n        return a.get() * b.get()\n    })\n    const d = mobx.observable.box(1)\n    const autorun = function () {\n        _fired++\n        _result = d.get() > 0 ? a.get() * c.get() : d.get()\n    }\n    let disp = mobx.autorun(autorun, { delay: 20 })\n\n    check(0, 0, null)\n    disp()\n    to(function () {\n        check(0, 0, null)\n        disp = mobx.autorun(autorun, { delay: 20 })\n\n        to(function () {\n            check(1, 1, 12)\n            a.set(4)\n            b.set(5)\n            a.set(6)\n            check(0, 0, null) // a change triggered async rerun, compute will trigger after 20ms of async timeout\n            to(function () {\n                check(1, 1, 180)\n                d.set(2)\n\n                to(function () {\n                    check(1, 0, 180)\n\n                    d.set(-2)\n                    to(function () {\n                        check(1, 0, -2)\n\n                        a.set(7)\n                        to(function () {\n                            check(0, 0, 0) // change a has no effect\n\n                            a.set(4)\n                            b.set(2)\n                            d.set(2)\n\n                            to(function () {\n                                check(1, 1, 32)\n\n                                disp()\n                                a.set(1)\n                                b.set(2)\n                                d.set(4)\n                                to(function () {\n                                    check(0, 0, 0)\n                                    done()\n                                }, 30)\n                            }, 30)\n                        }, 30)\n                    }, 30)\n                }, 30)\n            }, 30)\n        }, 30)\n    }, 30)\n})\n\ntest(\"autorun should not result in loop\", function (done) {\n    let i = 0\n    const a = mobx.observable({\n        x: i\n    })\n\n    let autoRunsCalled = 0\n    const d = mobx.autorun(\n        function () {\n            autoRunsCalled++\n            a.x = ++i\n            setTimeout(function () {\n                a.x = ++i\n            }, 10)\n        },\n        { delay: 10, name: \"named async\" }\n    )\n\n    setTimeout(function () {\n        expect(autoRunsCalled).toBe(1)\n        done()\n\n        expect(d[$mobx].name_).toBe(\"named async\")\n        d()\n    }, 100)\n})\n\ntest(\"autorunAsync passes Reaction as an argument to view function\", function (done) {\n    const a = mobx.observable.box(1)\n\n    let autoRunsCalled = 0\n\n    mobx.autorun(\n        r => {\n            expect(typeof r.dispose).toBe(\"function\")\n            autoRunsCalled++\n            if (a.get() === \"pleaseDispose\") r.dispose()\n        },\n        { delay: 10 }\n    )\n\n    setTimeout(() => a.set(2), 250)\n    setTimeout(() => a.set(\"pleaseDispose\"), 400)\n    setTimeout(() => a.set(3), 550)\n    setTimeout(() => a.set(4), 700)\n\n    setTimeout(function () {\n        expect(autoRunsCalled).toBe(3)\n        done()\n    }, 1000)\n})\n\ntest(\"autorunAsync accepts a scheduling function\", function (done) {\n    const a = mobx.observable({\n        x: 0,\n        y: 1\n    })\n\n    let autoRunsCalled = 0\n    let schedulingsCalled = 0\n\n    mobx.autorun(\n        function () {\n            autoRunsCalled++\n            expect(a.y).toBe(a.x + 1)\n\n            if (a.x < 10) {\n                // Queue the two actions separately, if this was autorun it would fail\n                setTimeout(function () {\n                    a.x = a.x + 1\n                }, 0)\n                setTimeout(function () {\n                    a.y = a.y + 1\n                }, 0)\n            }\n        },\n        {\n            scheduler: function (fn) {\n                schedulingsCalled++\n                setTimeout(fn, 0)\n            }\n        }\n    )\n\n    setTimeout(function () {\n        expect(autoRunsCalled).toBe(11)\n        expect(schedulingsCalled).toBe(11)\n        done()\n    }, 1000)\n})\n\ntest(\"reaction accepts a scheduling function\", function (done) {\n    const a = mobx.observable({\n        x: 0,\n        y: 1\n    })\n\n    let autoRunsCalled = 0\n    let schedulingsCalled = 0\n    let exprCalled = 0\n\n    const values = []\n\n    mobx.reaction(\n        () => {\n            exprCalled++\n            return a.x\n        },\n        () => {\n            autoRunsCalled++\n            values.push(a.x)\n        },\n        {\n            fireImmediately: true,\n            scheduler: function (fn) {\n                schedulingsCalled++\n                setTimeout(fn, 2)\n            }\n        }\n    )\n\n    a.x++\n    a.x++\n    a.x++\n    setTimeout(() => {\n        a.x++\n        a.x++\n        a.x++\n    }, 20)\n\n    setTimeout(function () {\n        expect(exprCalled).toBe(3) // start, 2 batches\n        expect(autoRunsCalled).toBe(3) // start, 2 batches\n        expect(schedulingsCalled).toBe(2) // skipped first time due to fireImmediately\n        expect(values).toEqual([0, 3, 6])\n        done()\n    }, 100)\n})\n\ntest(\"autorunAsync warns when passed an action\", function () {\n    const action = mobx.action(() => {})\n    expect.assertions(1)\n    expect(() => mobx.autorun(action)).toThrow(/Autorun does not accept actions/)\n})\n\ntest(\"whenWithTimeout should operate normally\", done => {\n    const a = mobx.observable.box(1)\n\n    mobx.when(\n        () => a.get() === 2,\n        () => done(),\n        {\n            timeout: 500,\n            onError: () => done.fail(\"error triggered\")\n        }\n    )\n\n    setTimeout(\n        mobx.action(() => a.set(2)),\n        200\n    )\n})\n\ntest(\"whenWithTimeout should timeout\", done => {\n    const a = mobx.observable.box(1)\n\n    mobx.when(\n        () => a.get() === 2,\n        () => done.fail(\"should have timed out\"),\n        {\n            timeout: 500,\n            onError: e => {\n                expect(\"\" + e).toMatch(/WHEN_TIMEOUT/)\n                done()\n            }\n        }\n    )\n\n    setTimeout(\n        mobx.action(() => a.set(2)),\n        1000\n    )\n})\n\ntest(\"whenWithTimeout should dispose\", done => {\n    const a = mobx.observable.box(1)\n\n    const d1 = mobx.when(\n        () => a.get() === 2,\n        () => done.fail(\"1 should not finsih\"),\n        {\n            timeout: 100,\n            onError: () => done.fail(\"1 should not timeout\")\n        }\n    )\n\n    const d2 = mobx.when(\n        () => a.get() === 2,\n        () => t.fail(\"2 should not finsih\"),\n        {\n            timeout: 200,\n            onError: () => done.fail(\"2 should not timeout\")\n        }\n    )\n\n    d1()\n    d2()\n\n    setTimeout(\n        mobx.action(() => {\n            a.set(2)\n            done()\n        }),\n        150\n    )\n})\n\ndescribe(\"when opts requiresObservable\", () => {\n    test(\"warn when no observable\", () => {\n        utils.consoleWarn(() => {\n            const disposer = mobx.when(() => 2, {\n                requiresObservable: true\n            })\n\n            disposer.cancel()\n        }, /is created\\/updated without reading any observable value/)\n    })\n\n    test(\"Don't warn when observable\", () => {\n        const obsr = mobx.observable({\n            x: 1\n        })\n\n        const messages = utils.supressConsole(() => {\n            const disposer = mobx.when(() => obsr.x, {\n                requiresObservable: true\n            })\n\n            disposer.cancel()\n        })\n\n        expect(messages.length).toBe(0)\n    })\n})\n"
  },
  {
    "path": "packages/mobx/__tests__/v5/base/babel-decorators.js",
    "content": "import {\n    observable,\n    computed,\n    transaction,\n    autorun,\n    extendObservable,\n    action,\n    isObservableObject,\n    observe,\n    isObservable,\n    isObservableProp,\n    isComputedProp,\n    spy,\n    isAction,\n    configure,\n    makeObservable\n} from \"../../../src/mobx\"\nimport * as mobx from \"../../../src/mobx\"\n\ntest(\"babel\", function () {\n    class Box {\n        @observable uninitialized\n        @observable height = 20\n        @observable sizes = [2]\n        @observable\n        someFunc = function () {\n            return 2\n        }\n\n        constructor() {\n            makeObservable(this)\n        }\n\n        @computed\n        get width() {\n            return this.height * this.sizes.length * this.someFunc() * (this.uninitialized ? 2 : 1)\n        }\n        @action\n        addSize() {\n            this.sizes.push(3)\n            this.sizes.push(4)\n        }\n    }\n\n    const box = new Box()\n    const ar = []\n    autorun(() => {\n        ar.push(box.width)\n    })\n\n    let s = ar.slice()\n    expect(s).toEqual([40])\n    box.height = 10\n    s = ar.slice()\n    expect(s).toEqual([40, 20])\n    box.sizes.push(3, 4)\n    s = ar.slice()\n    expect(s).toEqual([40, 20, 60])\n    box.someFunc = () => 7\n    s = ar.slice()\n    expect(s).toEqual([40, 20, 60, 210])\n    box.uninitialized = true\n    s = ar.slice()\n    expect(s).toEqual([40, 20, 60, 210, 420])\n    box.addSize()\n    s = ar.slice()\n    expect(s).toEqual([40, 20, 60, 210, 420, 700])\n})\n\ntest(\"should not be possible to use @action with getters\", () => {\n    class A {\n        constructor() {\n            makeObservable(this)\n        }\n\n        @action\n        get Test() {}\n    }\n    expect(() => {\n        new A()\n    }).toThrow(/can only be used on properties with a function value/)\n\n    mobx._resetGlobalState()\n})\n\ntest(\"babel: parameterized computed decorator\", () => {\n    class TestClass {\n        @observable x = 3\n        @observable y = 3\n\n        constructor() {\n            makeObservable(this)\n        }\n\n        @computed.struct\n        get boxedSum() {\n            return { sum: Math.round(this.x) + Math.round(this.y) }\n        }\n    }\n\n    const t1 = new TestClass()\n    const changes = []\n    const d = autorun(() => changes.push(t1.boxedSum))\n\n    t1.y = 4 // change\n    expect(changes.length).toBe(2)\n    t1.y = 4.2 // no change\n    expect(changes.length).toBe(2)\n    transaction(() => {\n        t1.y = 3\n        t1.x = 4\n    }) // no change\n    expect(changes.length).toBe(2)\n    t1.x = 6 // change\n    expect(changes.length).toBe(3)\n    d()\n\n    expect(changes).toEqual([{ sum: 6 }, { sum: 7 }, { sum: 9 }])\n})\n\ntest(\"computed value should be the same around changing which was considered equivalent\", () => {\n    class TestClass {\n        @observable c = null\n        defaultCollection = []\n\n        constructor() {\n            makeObservable(this)\n        }\n\n        @computed.struct\n        get collection() {\n            return this.c || this.defaultCollection\n        }\n    }\n\n    const t1 = new TestClass()\n\n    const d = autorun(() => t1.collection)\n\n    const oldCollection = t1.collection\n    t1.c = []\n    const newCollection = t1.collection\n\n    expect(oldCollection).toBe(newCollection)\n\n    d()\n})\n\nclass Order {\n    @observable price = 3\n    @observable amount = 2\n    @observable orders = []\n    @observable aFunction = function () {}\n\n    constructor() {\n        makeObservable(this)\n    }\n\n    @computed\n    get total() {\n        return this.amount * this.price * (1 + this.orders.length)\n    }\n}\n\ntest(\"issue 191 - shared initializers (babel)\", function () {\n    class Test {\n        @observable obj = { a: 1 }\n        @observable array = [2]\n\n        constructor() {\n            makeObservable(this)\n        }\n    }\n\n    const t1 = new Test()\n    t1.obj.a = 2\n    t1.array.push(3)\n\n    const t2 = new Test()\n    t2.obj.a = 3\n    t2.array.push(4)\n\n    expect(t1.obj).not.toBe(t2.obj)\n    expect(t1.array).not.toBe(t2.array)\n    expect(t1.obj.a).toBe(2)\n    expect(t2.obj.a).toBe(3)\n\n    expect(t1.array.slice()).toEqual([2, 3])\n    expect(t2.array.slice()).toEqual([2, 4])\n})\n\ntest(\"705 - setter undoing caching (babel)\", () => {\n    let recomputes = 0\n    let autoruns = 0\n\n    class Person {\n        @observable name\n        @observable title\n\n        constructor() {\n            makeObservable(this)\n        }\n\n        set fullName(val) {\n            // Noop\n        }\n        @computed\n        get fullName() {\n            recomputes++\n            return this.title + \" \" + this.name\n        }\n    }\n\n    let p1 = new Person()\n    p1.name = \"Tom Tank\"\n    p1.title = \"Mr.\"\n\n    expect(recomputes).toBe(0)\n    expect(autoruns).toBe(0)\n\n    const d1 = autorun(() => {\n        autoruns++\n        p1.fullName\n    })\n\n    const d2 = autorun(() => {\n        autoruns++\n        p1.fullName\n    })\n\n    expect(recomputes).toBe(1)\n    expect(autoruns).toBe(2)\n\n    p1.title = \"Master\"\n    expect(recomputes).toBe(2)\n    expect(autoruns).toBe(4)\n\n    d1()\n    d2()\n})\n\nfunction normalizeSpyEvents(events) {\n    events.forEach(ev => {\n        delete ev.fn\n        delete ev.time\n    })\n    return events\n}\n\ntest(\"action decorator (babel)\", function () {\n    class Store {\n        constructor(multiplier) {\n            makeObservable(this)\n            this.multiplier = multiplier\n        }\n\n        @action\n        add(a, b) {\n            return (a + b) * this.multiplier\n        }\n    }\n\n    const store1 = new Store(2)\n    const store2 = new Store(3)\n    const events = []\n    const d = spy(events.push.bind(events))\n    expect(store1.add(3, 4)).toBe(14)\n    expect(store2.add(3, 4)).toBe(21)\n    expect(store1.add(1, 1)).toBe(4)\n\n    expect(normalizeSpyEvents(events)).toEqual([\n        { arguments: [3, 4], name: \"add\", spyReportStart: true, object: store1, type: \"action\" },\n        { type: \"report-end\", spyReportEnd: true },\n        { arguments: [3, 4], name: \"add\", spyReportStart: true, object: store2, type: \"action\" },\n        { type: \"report-end\", spyReportEnd: true },\n        { arguments: [1, 1], name: \"add\", spyReportStart: true, object: store1, type: \"action\" },\n        { type: \"report-end\", spyReportEnd: true }\n    ])\n\n    d()\n})\n\ntest(\"custom action decorator (babel)\", function () {\n    class Store {\n        constructor(multiplier) {\n            makeObservable(this)\n            this.multiplier = multiplier\n        }\n\n        @action(\"zoem zoem\")\n        add(a, b) {\n            return (a + b) * this.multiplier\n        }\n    }\n\n    const store1 = new Store(2)\n    const store2 = new Store(3)\n    const events = []\n    const d = spy(events.push.bind(events))\n    expect(store1.add(3, 4)).toBe(14)\n    expect(store2.add(3, 4)).toBe(21)\n    expect(store1.add(1, 1)).toBe(4)\n\n    expect(normalizeSpyEvents(events)).toEqual([\n        {\n            arguments: [3, 4],\n            name: \"zoem zoem\",\n            spyReportStart: true,\n            object: store1,\n            type: \"action\"\n        },\n        { type: \"report-end\", spyReportEnd: true },\n        {\n            arguments: [3, 4],\n            name: \"zoem zoem\",\n            spyReportStart: true,\n            object: store2,\n            type: \"action\"\n        },\n        { type: \"report-end\", spyReportEnd: true },\n        {\n            arguments: [1, 1],\n            name: \"zoem zoem\",\n            spyReportStart: true,\n            object: store1,\n            type: \"action\"\n        },\n        { type: \"report-end\", spyReportEnd: true }\n    ])\n\n    d()\n})\n\ntest(\"action decorator on field (babel)\", function () {\n    class Store {\n        constructor(multiplier) {\n            makeObservable(this)\n            this.multiplier = multiplier\n        }\n\n        @action\n        add = (a, b) => {\n            return (a + b) * this.multiplier\n        }\n    }\n\n    const store1 = new Store(2)\n    const store2 = new Store(7)\n\n    const events = []\n    const d = spy(events.push.bind(events))\n    expect(store1.add(3, 4)).toBe(14)\n    expect(store2.add(5, 4)).toBe(63)\n    expect(store1.add(2, 2)).toBe(8)\n\n    expect(normalizeSpyEvents(events)).toEqual([\n        { arguments: [3, 4], name: \"add\", spyReportStart: true, object: store1, type: \"action\" },\n        { type: \"report-end\", spyReportEnd: true },\n        { arguments: [5, 4], name: \"add\", spyReportStart: true, object: store2, type: \"action\" },\n        { type: \"report-end\", spyReportEnd: true },\n        { arguments: [2, 2], name: \"add\", spyReportStart: true, object: store1, type: \"action\" },\n        { type: \"report-end\", spyReportEnd: true }\n    ])\n\n    d()\n})\n\ntest(\"custom action decorator on field (babel)\", function () {\n    class Store {\n        constructor(multiplier) {\n            makeObservable(this)\n            this.multiplier = multiplier\n        }\n\n        @action(\"zoem zoem\")\n        add = (a, b) => {\n            return (a + b) * this.multiplier\n        }\n    }\n\n    const store1 = new Store(2)\n    const store2 = new Store(7)\n\n    const events = []\n    const d = spy(events.push.bind(events))\n    expect(store1.add(3, 4)).toBe(14)\n    expect(store2.add(5, 4)).toBe(63)\n    expect(store1.add(2, 2)).toBe(8)\n\n    expect(normalizeSpyEvents(events)).toEqual([\n        {\n            arguments: [3, 4],\n            name: \"zoem zoem\",\n            spyReportStart: true,\n            object: store1,\n            type: \"action\"\n        },\n        { type: \"report-end\", spyReportEnd: true },\n        {\n            arguments: [5, 4],\n            name: \"zoem zoem\",\n            spyReportStart: true,\n            object: store2,\n            type: \"action\"\n        },\n        { type: \"report-end\", spyReportEnd: true },\n        {\n            arguments: [2, 2],\n            name: \"zoem zoem\",\n            spyReportStart: true,\n            object: store1,\n            type: \"action\"\n        },\n        { type: \"report-end\", spyReportEnd: true }\n    ])\n\n    d()\n})\n\ntest(\"267 (babel) should be possible to declare properties observable outside strict mode\", () => {\n    configure({ enforceActions: \"observed\" })\n\n    class Store {\n        @observable timer\n\n        constructor() {\n            makeObservable(this)\n        }\n    }\n    Store // just to avoid linter warning\n\n    configure({ enforceActions: \"never\" })\n})\n\ntest(\"288 atom not detected for object property\", () => {\n    class Store {\n        @mobx.observable foo = \"\"\n\n        constructor() {\n            makeObservable(this)\n        }\n    }\n\n    const store = new Store()\n    let changed = false\n\n    mobx.observe(\n        store,\n        \"foo\",\n        () => {\n            changed = true\n        },\n        true\n    )\n    expect(changed).toBe(true)\n})\n\ntest.skip(\"observable performance - babel - decorators\", () => {\n    const AMOUNT = 100000\n\n    class A {\n        @observable a = 1\n        @observable b = 2\n        @observable c = 3\n\n        constructor() {\n            makeObservable(this)\n        }\n\n        @computed\n        get d() {\n            return this.a + this.b + this.c\n        }\n    }\n\n    const objs = []\n    const start = Date.now()\n\n    for (let i = 0; i < AMOUNT; i++) objs.push(new A())\n\n    console.log(\"created in \", Date.now() - start)\n\n    for (let j = 0; j < 4; j++) {\n        for (let i = 0; i < AMOUNT; i++) {\n            const obj = objs[i]\n            obj.a += 3\n            obj.b *= 4\n            obj.c = obj.b - obj.a\n            obj.d\n        }\n    }\n\n    console.log(\"changed in \", Date.now() - start)\n})\n\ntest(\"unbound methods\", () => {\n    class A {\n        constructor() {\n            makeObservable(this)\n        }\n\n        // shared across all instances\n        @action\n        m1() {}\n\n        // per instance\n        @action m2 = () => {}\n    }\n\n    const a1 = new A()\n    const a2 = new A()\n\n    expect(a1.m1).toBe(a2.m1)\n    expect(a1.m2).not.toBe(a2.m2)\n    expect(a1.hasOwnProperty(\"m1\")).toBe(false)\n    expect(a1.hasOwnProperty(\"m2\")).toBe(true)\n    expect(a2.hasOwnProperty(\"m1\")).toBe(false)\n    expect(a2.hasOwnProperty(\"m2\")).toBe(true)\n})\n\ntest(\"inheritance\", () => {\n    class A {\n        @observable a = 2\n\n        constructor() {\n            makeObservable(this)\n        }\n    }\n\n    class B extends A {\n        @observable b = 3\n\n        constructor() {\n            super()\n            makeObservable(this)\n        }\n\n        @computed\n        get c() {\n            return this.a + this.b\n        }\n    }\n\n    const b1 = new B()\n    const b2 = new B()\n    const values = []\n    mobx.autorun(() => values.push(b1.c + b2.c))\n\n    b1.a = 3\n    b1.b = 4\n    b2.b = 5\n    b2.a = 6\n\n    expect(values).toEqual([10, 11, 12, 14, 18])\n})\n\ntest(\"reusing initializers\", () => {\n    class A {\n        @observable a = 3\n        @observable b = this.a + 2\n\n        constructor() {\n            makeObservable(this)\n        }\n\n        @computed\n        get c() {\n            return this.a + this.b\n        }\n        @computed\n        get d() {\n            return this.c + 1\n        }\n    }\n\n    const a = new A()\n    const values = []\n    mobx.autorun(() => values.push(a.d))\n\n    a.a = 4\n    expect(values).toEqual([9, 10])\n})\n\ntest(\"enumerability\", () => {\n    class A {\n        @observable a = 1 // enumerable, on proto\n        @observable a2 = 2\n\n        constructor() {\n            makeObservable(this)\n        }\n\n        @computed\n        get b() {\n            return this.a\n        } // non-enumerable, (and, ideally, on proto)\n        @action\n        m() {} // non-enumerable, on proto\n        @action m2 = () => {} // non-enumerable, on self\n    }\n\n    const a = new A()\n\n    // not initialized yet\n    let ownProps = Object.keys(a)\n    let props = []\n    for (const key in a) props.push(key)\n\n    expect(ownProps).toEqual([\"a\", \"a2\"])\n\n    expect(props).toEqual([\"a\", \"a2\"])\n\n    expect(\"a\" in a).toBe(true)\n    expect(a.hasOwnProperty(\"a\")).toBe(true)\n    expect(a.hasOwnProperty(\"b\")).toBe(true)\n    expect(a.hasOwnProperty(\"m\")).toBe(false)\n    expect(a.hasOwnProperty(\"m2\")).toBe(true)\n\n    expect(mobx.isAction(a.m)).toBe(true)\n    expect(mobx.isAction(a.m2)).toBe(true)\n\n    // after initialization\n    a.a\n    a.b\n    a.m\n    a.m2\n\n    ownProps = Object.keys(a)\n    props = []\n    for (const key in a) props.push(key)\n\n    expect(ownProps).toEqual([\n        \"a\",\n        \"a2\" // a2 is now initialized as well, altough never accessed!\n    ])\n\n    expect(props).toEqual([\"a\", \"a2\"])\n\n    expect(\"a\" in a).toBe(true)\n    expect(a.hasOwnProperty(\"a\")).toBe(true)\n    expect(a.hasOwnProperty(\"a2\")).toBe(true)\n    expect(a.hasOwnProperty(\"b\")).toBe(true) // true would better.. but, #1777\n    expect(a.hasOwnProperty(\"m\")).toBe(false)\n    expect(a.hasOwnProperty(\"m2\")).toBe(true)\n})\n\ntest(\"enumerability - workaround\", () => {\n    class A {\n        @observable a = 1 // enumerable, on proto\n        @observable a2 = 2\n        @computed\n        get b() {\n            return this.a\n        } // non-enumerable, (and, ideally, on proto)\n        @action\n        m() {} // non-enumerable, on proto\n        @action m2 = () => {} // non-enumerable, on self\n\n        constructor() {\n            makeObservable(this)\n            this.a = 1\n            this.a2 = 2\n        }\n    }\n\n    const a = new A()\n\n    const ownProps = Object.keys(a)\n    const props = []\n    for (const key in a) props.push(key)\n\n    expect(ownProps).toEqual([\n        \"a\",\n        \"a2\" // a2 is now initialized as well, altough never accessed!\n    ])\n\n    expect(props).toEqual([\"a\", \"a2\"])\n\n    expect(\"a\" in a).toBe(true)\n    expect(a.hasOwnProperty(\"a\")).toBe(true)\n    expect(a.hasOwnProperty(\"a2\")).toBe(true)\n    expect(a.hasOwnProperty(\"b\")).toBe(true) // ideally, false, but #1777\n    expect(a.hasOwnProperty(\"m\")).toBe(false)\n    expect(a.hasOwnProperty(\"m2\")).toBe(true)\n})\n\ntest(\"issue 285 (babel)\", () => {\n    const { observable, toJS } = mobx\n\n    class Todo {\n        id = 1\n        @observable title\n        @observable finished = false\n        @observable childThings = [1, 2, 3]\n        constructor(title) {\n            makeObservable(this)\n            this.title = title\n        }\n    }\n\n    const todo = new Todo(\"Something to do\")\n\n    expect(toJS(todo)).toEqual({\n        id: 1,\n        title: \"Something to do\",\n        finished: false,\n        childThings: [1, 2, 3]\n    })\n})\n\ntest(\"verify object assign (babel)\", () => {\n    class Todo {\n        @observable title = \"test\"\n\n        constructor() {\n            makeObservable(this)\n        }\n\n        @computed\n        get upperCase() {\n            return this.title.toUpperCase()\n        }\n    }\n\n    const todo = new Todo()\n    expect(Object.assign({}, todo)).toEqual({\n        title: \"test\"\n    })\n})\n\ntest(\"379, inheritable actions (babel)\", () => {\n    class A {\n        constructor() {\n            makeObservable(this)\n        }\n\n        @action\n        method() {\n            return 42\n        }\n    }\n\n    class B extends A {\n        constructor() {\n            super()\n            makeObservable(this)\n        }\n\n        method() {\n            return super.method() * 2\n        }\n    }\n\n    class C extends B {\n        constructor() {\n            super()\n            makeObservable(this)\n        }\n\n        method() {\n            return super.method() + 3\n        }\n    }\n\n    const b = new B()\n    expect(b.method()).toBe(84)\n    expect(isAction(b.method)).toBe(true)\n\n    const a = new A()\n    expect(a.method()).toBe(42)\n    expect(isAction(a.method)).toBe(true)\n\n    const c = new C()\n    expect(c.method()).toBe(87)\n    expect(isAction(c.method)).toBe(true)\n})\n\ntest(\"505, don't throw when accessing subclass fields in super constructor (babel)\", () => {\n    const values = {}\n    class A {\n        @observable a = 1\n        constructor() {\n            makeObservable(this)\n            values.b = this.b\n            values.a = this.a\n        }\n    }\n\n    class B extends A {\n        @observable b = 2\n\n        constructor() {\n            super()\n            makeObservable(this)\n        }\n    }\n\n    new B()\n    expect(values).toEqual({ a: 1, b: undefined })\n})\n\ntest(\"computed setter should succeed (babel)\", function () {\n    class Bla {\n        @observable a = 3\n\n        constructor() {\n            makeObservable(this)\n        }\n\n        @computed\n        get propX() {\n            return this.a * 2\n        }\n        set propX(v) {\n            this.a = v\n        }\n    }\n\n    const b = new Bla()\n    expect(b.propX).toBe(6)\n    b.propX = 4\n    expect(b.propX).toBe(8)\n})\n\ntest(\"issue #701\", () => {\n    class Model {\n        @observable a = 5\n\n        constructor() {\n            makeObservable(this)\n        }\n    }\n\n    const model = new Model()\n\n    expect(mobx.toJS(model)).toEqual({ a: 5 })\n    expect(mobx.isObservable(model)).toBe(true)\n    expect(mobx.isObservableObject(model)).toBe(true)\n})\n\ntest(\"@observable.ref (Babel)\", () => {\n    class A {\n        @observable.ref ref = { a: 3 }\n\n        constructor() {\n            makeObservable(this)\n        }\n    }\n\n    const a = new A()\n    expect(a.ref.a).toBe(3)\n    expect(mobx.isObservable(a.ref)).toBe(false)\n    expect(mobx.isObservableProp(a, \"ref\")).toBe(true)\n})\n\ntest(\"@observable.shallow (Babel)\", () => {\n    class A {\n        @observable.shallow arr = [{ todo: 1 }]\n\n        constructor() {\n            makeObservable(this)\n        }\n    }\n\n    const a = new A()\n    const todo2 = { todo: 2 }\n    a.arr.push(todo2)\n    expect(mobx.isObservable(a.arr)).toBe(true)\n    expect(mobx.isObservableProp(a, \"arr\")).toBe(true)\n    expect(mobx.isObservable(a.arr[0])).toBe(false)\n    expect(mobx.isObservable(a.arr[1])).toBe(false)\n    expect(a.arr[1] === todo2).toBeTruthy()\n})\n\ntest(\"@observable.deep (Babel)\", () => {\n    class A {\n        @observable.deep arr = [{ todo: 1 }]\n\n        constructor() {\n            makeObservable(this)\n        }\n    }\n\n    const a = new A()\n    const todo2 = { todo: 2 }\n    a.arr.push(todo2)\n\n    expect(mobx.isObservable(a.arr)).toBe(true)\n    expect(mobx.isObservableProp(a, \"arr\")).toBe(true)\n    expect(mobx.isObservable(a.arr[0])).toBe(true)\n    expect(mobx.isObservable(a.arr[1])).toBe(true)\n    expect(a.arr[1] !== todo2).toBeTruthy()\n    expect(isObservable(todo2)).toBe(false)\n})\n\ntest(\"action.bound binds (Babel)\", () => {\n    class A {\n        @observable x = 0\n\n        constructor() {\n            makeObservable(this)\n        }\n\n        @action.bound\n        inc(value) {\n            this.x += value\n        }\n    }\n\n    const a = new A()\n    const runner = a.inc\n    runner(2)\n\n    expect(a.x).toBe(2)\n})\n\ntest(\"@computed.equals (Babel)\", () => {\n    const sameTime = (from, to) => from.hour === to.hour && from.minute === to.minute\n    class Time {\n        constructor(hour, minute) {\n            makeObservable(this)\n            this.hour = hour\n            this.minute = minute\n        }\n\n        @observable hour\n        @observable minute\n\n        @computed({ equals: sameTime })\n        get time() {\n            return { hour: this.hour, minute: this.minute }\n        }\n    }\n    const time = new Time(9, 0)\n\n    const changes = []\n    const disposeAutorun = autorun(() => changes.push(time.time))\n\n    expect(changes).toEqual([{ hour: 9, minute: 0 }])\n    time.hour = 9\n    expect(changes).toEqual([{ hour: 9, minute: 0 }])\n    time.minute = 0\n    expect(changes).toEqual([{ hour: 9, minute: 0 }])\n    time.hour = 10\n    expect(changes).toEqual([\n        { hour: 9, minute: 0 },\n        { hour: 10, minute: 0 }\n    ])\n    time.minute = 30\n    expect(changes).toEqual([\n        { hour: 9, minute: 0 },\n        { hour: 10, minute: 0 },\n        { hour: 10, minute: 30 }\n    ])\n\n    disposeAutorun()\n})\n\n// 19.12.2020 @urugator:\n// All annotated non-observable fields are not writable.\n// All annotated fields of non-plain objects are non-configurable.\n// https://github.com/mobxjs/mobx/pull/2641\ntest.skip(\"actions are reassignable\", () => {\n    // See #1398, make actions reassignable to support stubbing\n    class A {\n        constructor() {\n            makeObservable(this)\n        }\n\n        @action\n        m1() {}\n        @action m2 = () => {}\n        @action.bound\n        m3() {}\n        @action.bound m4 = () => {}\n    }\n\n    const a = new A()\n    expect(isAction(a.m1)).toBe(true)\n    expect(isAction(a.m2)).toBe(true)\n    expect(isAction(a.m3)).toBe(true)\n    expect(isAction(a.m4)).toBe(true)\n    a.m1 = () => {}\n    expect(isAction(a.m1)).toBe(false)\n    a.m2 = () => {}\n    expect(isAction(a.m2)).toBe(false)\n    a.m3 = () => {}\n    expect(isAction(a.m3)).toBe(false)\n    a.m4 = () => {}\n    expect(isAction(a.m4)).toBe(false)\n})\n\ntest(\"it should support asyncAction (babel)\", async () => {\n    mobx.configure({ enforceActions: \"observed\" })\n\n    class X {\n        @observable a = 1\n\n        f = mobx.flow(function* f(initial) {\n            this.a = initial // this runs in action\n            this.a += yield Promise.resolve(5)\n            this.a = this.a * 2\n            return this.a\n        })\n\n        constructor() {\n            makeObservable(this)\n        }\n    }\n\n    const x = new X()\n\n    expect(await x.f(3)).toBe(16)\n})\n\ntest(\"toJS bug #1413 (babel)\", () => {\n    class X {\n        @observable\n        test = {\n            test1: 1\n        }\n\n        constructor() {\n            makeObservable(this)\n        }\n    }\n\n    const x = new X()\n    const res = mobx.toJS(x.test)\n    expect(res).toEqual({ test1: 1 })\n    expect(res.__mobxDidRunLazyInitializers).toBe(undefined)\n})\n\ntest(\"computed setter problem\", () => {\n    class Contact {\n        @observable firstName = \"\"\n        @observable lastName = \"\"\n\n        constructor() {\n            makeObservable(this)\n        }\n\n        @computed({\n            set(value) {\n                const [firstName, lastName] = value.split(\" \")\n\n                this.firstName = firstName\n                this.lastName = lastName\n            }\n        })\n        get fullName() {\n            return `${this.firstName} ${this.lastName}`\n        }\n\n        set fullName(value) {\n            const [firstName, lastName] = value.split(\" \")\n\n            this.firstName = firstName\n            this.lastName = lastName\n        }\n    }\n\n    const c = new Contact()\n\n    c.firstName = \"Pavan\"\n    c.lastName = \"Podila\"\n\n    expect(c.fullName).toBe(\"Pavan Podila\")\n\n    c.fullName = \"Michel Weststrate\"\n    expect(c.firstName).toBe(\"Michel\")\n    expect(c.lastName).toBe(\"Weststrate\")\n})\n\ntest(\"#1740, combining extendObservable & decorators\", () => {\n    class AppState {\n        constructor(id) {\n            makeObservable(this)\n            extendObservable(this, {\n                id\n            })\n            expect(this.foo).toBe(id)\n        }\n\n        @computed\n        get foo() {\n            return this.id\n        }\n    }\n\n    let app = new AppState(1)\n    expect(app.id).toBe(1)\n    expect(app.foo).toBe(1)\n    expect(isObservableProp(app, \"id\")).toBe(true)\n    expect(isComputedProp(app, \"foo\")).toBe(true)\n\n    app = new AppState(2)\n    expect(app.id).toBe(2)\n    expect(app.foo).toBe(2)\n    expect(isObservableProp(app, \"id\")).toBe(true)\n    expect(isComputedProp(app, \"foo\")).toBe(true)\n})\n"
  },
  {
    "path": "packages/mobx/__tests__/v5/base/babel-tests.js",
    "content": "import {\n    observable,\n    computed,\n    transaction,\n    autorun,\n    extendObservable,\n    action,\n    isObservableObject,\n    observe,\n    isObservable,\n    isObservableProp,\n    isComputedProp,\n    spy,\n    isAction,\n    configure,\n    makeObservable\n} from \"../../../src/mobx\"\nimport * as mobx from \"../../../src/mobx\"\n\ntest(\"babel\", function () {\n    class Box {\n        uninitialized\n        height = 20\n        sizes = [2]\n        someFunc = function () {\n            return 2\n        }\n\n        constructor() {\n            makeObservable(this, {\n                uninitialized: observable,\n                height: observable,\n                sizes: observable,\n                someFunc: observable,\n                width: computed,\n                addSize: action\n            })\n        }\n\n        get width() {\n            return this.height * this.sizes.length * this.someFunc() * (this.uninitialized ? 2 : 1)\n        }\n        addSize() {\n            this.sizes.push(3)\n            this.sizes.push(4)\n        }\n    }\n\n    const box = new Box()\n    const ar = []\n    autorun(() => {\n        ar.push(box.width)\n    })\n\n    let s = ar.slice()\n    expect(s).toEqual([40])\n    box.height = 10\n    s = ar.slice()\n    expect(s).toEqual([40, 20])\n    box.sizes.push(3, 4)\n    s = ar.slice()\n    expect(s).toEqual([40, 20, 60])\n    box.someFunc = () => 7\n    s = ar.slice()\n    expect(s).toEqual([40, 20, 60, 210])\n    box.uninitialized = true\n    s = ar.slice()\n    expect(s).toEqual([40, 20, 60, 210, 420])\n    box.addSize()\n    s = ar.slice()\n    expect(s).toEqual([40, 20, 60, 210, 420, 700])\n})\n\ntest(\"should not be possible to use @action with getters\", () => {\n    expect(() => {\n        class A {\n            constructor() {\n                makeObservable(this, {\n                    Test: action\n                })\n            }\n\n            get Test() {}\n        }\n        return new A()\n    }).toThrow(/can only be used on properties with a function value/)\n\n    mobx._resetGlobalState()\n})\n\ntest(\"babel: parameterized computed decorator\", () => {\n    class TestClass {\n        x = 3\n        y = 3\n\n        constructor() {\n            makeObservable(this, {\n                x: observable,\n                y: observable,\n                boxedSum: computed.struct\n            })\n        }\n\n        get boxedSum() {\n            return { sum: Math.round(this.x) + Math.round(this.y) }\n        }\n    }\n\n    const t1 = new TestClass()\n    const changes = []\n    const d = autorun(() => changes.push(t1.boxedSum))\n\n    t1.y = 4 // change\n    expect(changes.length).toBe(2)\n    t1.y = 4.2 // no change\n    expect(changes.length).toBe(2)\n    transaction(() => {\n        t1.y = 3\n        t1.x = 4\n    }) // no change\n    expect(changes.length).toBe(2)\n    t1.x = 6 // change\n    expect(changes.length).toBe(3)\n    d()\n\n    expect(changes).toEqual([{ sum: 6 }, { sum: 7 }, { sum: 9 }])\n})\n\ntest(\"computed value should be the same around changing which was considered equivalent\", () => {\n    class TestClass {\n        c = null\n        defaultCollection = []\n\n        constructor() {\n            makeObservable(this, {\n                c: observable,\n                collection: computed.struct\n            })\n        }\n\n        get collection() {\n            return this.c || this.defaultCollection\n        }\n    }\n\n    const t1 = new TestClass()\n\n    const d = autorun(() => t1.collection)\n\n    const oldCollection = t1.collection\n    t1.c = []\n    const newCollection = t1.collection\n\n    expect(oldCollection).toBe(newCollection)\n\n    d()\n})\n\nclass Order {\n    price = 3\n    amount = 2\n    orders = []\n    aFunction = function () {}\n\n    constructor() {\n        makeObservable(this, {\n            price: observable,\n            amount: observable,\n            orders: observable,\n            aFunction: observable,\n            total: computed\n        })\n    }\n\n    get total() {\n        return this.amount * this.price * (1 + this.orders.length)\n    }\n}\n\ntest(\"decorators\", function () {\n    const o = new Order()\n    expect(isObservableObject(o)).toBe(true)\n    expect(isObservableProp(o, \"amount\")).toBe(true)\n    expect(o.total).toBe(6) // .... this is required to initialize the props which are made reactive lazily...\n    expect(isObservableProp(o, \"total\")).toBe(true)\n\n    const events = []\n    const d1 = observe(o, ev => events.push(ev.name, ev.oldValue))\n    const d2 = observe(o, \"price\", ev => events.push(ev.newValue, ev.oldValue))\n    const d3 = observe(o, \"total\", ev => events.push(ev.newValue, ev.oldValue))\n\n    o.price = 4\n\n    d1()\n    d2()\n    d3()\n\n    o.price = 5\n\n    expect(events).toEqual([\n        8, // new total\n        6, // old total\n        4, // new price\n        3, // old price\n        \"price\", // event name\n        3 // event oldValue\n    ])\n})\n\ntest(\"issue 191 - shared initializers (babel)\", function () {\n    class Test {\n        obj = { a: 1 }\n        array = [2]\n\n        constructor() {\n            makeObservable(this, {\n                obj: observable,\n                array: observable\n            })\n        }\n    }\n\n    const t1 = new Test()\n    t1.obj.a = 2\n    t1.array.push(3)\n\n    const t2 = new Test()\n    t2.obj.a = 3\n    t2.array.push(4)\n\n    expect(t1.obj).not.toBe(t2.obj)\n    expect(t1.array).not.toBe(t2.array)\n    expect(t1.obj.a).toBe(2)\n    expect(t2.obj.a).toBe(3)\n\n    expect(t1.array.slice()).toEqual([2, 3])\n    expect(t2.array.slice()).toEqual([2, 4])\n})\n\ntest(\"705 - setter undoing caching (babel)\", () => {\n    let recomputes = 0\n    let autoruns = 0\n\n    class Person {\n        name\n        title\n\n        constructor() {\n            makeObservable(this, {\n                name: observable,\n                title: observable,\n                fullName: computed\n            })\n        }\n\n        set fullName(val) {\n            // Noop\n        }\n        get fullName() {\n            recomputes++\n            return this.title + \" \" + this.name\n        }\n    }\n\n    let p1 = new Person()\n    p1.name = \"Tom Tank\"\n    p1.title = \"Mr.\"\n\n    expect(recomputes).toBe(0)\n    expect(autoruns).toBe(0)\n\n    const d1 = autorun(() => {\n        autoruns++\n        p1.fullName\n    })\n\n    const d2 = autorun(() => {\n        autoruns++\n        p1.fullName\n    })\n\n    expect(recomputes).toBe(1)\n    expect(autoruns).toBe(2)\n\n    p1.title = \"Master\"\n    expect(recomputes).toBe(2)\n    expect(autoruns).toBe(4)\n\n    d1()\n    d2()\n})\n\nfunction normalizeSpyEvents(events) {\n    events.forEach(ev => {\n        delete ev.fn\n        delete ev.time\n    })\n    return events\n}\n\ntest(\"action decorator (babel)\", function () {\n    class Store {\n        constructor(multiplier) {\n            makeObservable(this, {\n                add: action\n            })\n\n            this.multiplier = multiplier\n        }\n\n        add(a, b) {\n            return (a + b) * this.multiplier\n        }\n    }\n\n    const store1 = new Store(2)\n    const store2 = new Store(3)\n    const events = []\n    const d = spy(events.push.bind(events))\n    expect(store1.add(3, 4)).toBe(14)\n    expect(store2.add(3, 4)).toBe(21)\n    expect(store1.add(1, 1)).toBe(4)\n\n    expect(normalizeSpyEvents(events)).toEqual([\n        { arguments: [3, 4], name: \"add\", spyReportStart: true, object: store1, type: \"action\" },\n        { type: \"report-end\", spyReportEnd: true },\n        { arguments: [3, 4], name: \"add\", spyReportStart: true, object: store2, type: \"action\" },\n        { type: \"report-end\", spyReportEnd: true },\n        { arguments: [1, 1], name: \"add\", spyReportStart: true, object: store1, type: \"action\" },\n        { type: \"report-end\", spyReportEnd: true }\n    ])\n\n    d()\n})\n\ntest(\"custom action decorator (babel)\", function () {\n    class Store {\n        constructor(multiplier) {\n            makeObservable(this, {\n                add: action(\"zoem zoem\")\n            })\n\n            this.multiplier = multiplier\n        }\n\n        add(a, b) {\n            return (a + b) * this.multiplier\n        }\n    }\n\n    const store1 = new Store(2)\n    const store2 = new Store(3)\n    const events = []\n    const d = spy(events.push.bind(events))\n    expect(store1.add(3, 4)).toBe(14)\n    expect(store2.add(3, 4)).toBe(21)\n    expect(store1.add(1, 1)).toBe(4)\n\n    expect(normalizeSpyEvents(events)).toEqual([\n        {\n            arguments: [3, 4],\n            name: \"zoem zoem\",\n            spyReportStart: true,\n            object: store1,\n            type: \"action\"\n        },\n        { type: \"report-end\", spyReportEnd: true },\n        {\n            arguments: [3, 4],\n            name: \"zoem zoem\",\n            spyReportStart: true,\n            object: store2,\n            type: \"action\"\n        },\n        { type: \"report-end\", spyReportEnd: true },\n        {\n            arguments: [1, 1],\n            name: \"zoem zoem\",\n            spyReportStart: true,\n            object: store1,\n            type: \"action\"\n        },\n        { type: \"report-end\", spyReportEnd: true }\n    ])\n\n    d()\n})\n\ntest(\"action decorator on field (babel)\", function () {\n    class Store {\n        constructor(multiplier) {\n            makeObservable(this, {\n                add: action\n            })\n\n            this.multiplier = multiplier\n        }\n\n        add = (a, b) => {\n            return (a + b) * this.multiplier\n        }\n    }\n\n    const store1 = new Store(2)\n    const store2 = new Store(7)\n\n    const events = []\n    const d = spy(events.push.bind(events))\n    expect(store1.add(3, 4)).toBe(14)\n    expect(store2.add(5, 4)).toBe(63)\n    expect(store1.add(2, 2)).toBe(8)\n\n    expect(normalizeSpyEvents(events)).toEqual([\n        { arguments: [3, 4], name: \"add\", spyReportStart: true, object: store1, type: \"action\" },\n        { type: \"report-end\", spyReportEnd: true },\n        { arguments: [5, 4], name: \"add\", spyReportStart: true, object: store2, type: \"action\" },\n        { type: \"report-end\", spyReportEnd: true },\n        { arguments: [2, 2], name: \"add\", spyReportStart: true, object: store1, type: \"action\" },\n        { type: \"report-end\", spyReportEnd: true }\n    ])\n\n    d()\n})\n\ntest(\"custom action decorator on field (babel)\", function () {\n    class Store {\n        constructor(multiplier) {\n            makeObservable(this, {\n                add: action(\"zoem zoem\")\n            })\n\n            this.multiplier = multiplier\n        }\n\n        add = (a, b) => {\n            return (a + b) * this.multiplier\n        }\n    }\n\n    const store1 = new Store(2)\n    const store2 = new Store(7)\n\n    const events = []\n    const d = spy(events.push.bind(events))\n    expect(store1.add(3, 4)).toBe(14)\n    expect(store2.add(5, 4)).toBe(63)\n    expect(store1.add(2, 2)).toBe(8)\n\n    expect(normalizeSpyEvents(events)).toEqual([\n        {\n            arguments: [3, 4],\n            name: \"zoem zoem\",\n            spyReportStart: true,\n            object: store1,\n            type: \"action\"\n        },\n        { type: \"report-end\", spyReportEnd: true },\n        {\n            arguments: [5, 4],\n            name: \"zoem zoem\",\n            spyReportStart: true,\n            object: store2,\n            type: \"action\"\n        },\n        { type: \"report-end\", spyReportEnd: true },\n        {\n            arguments: [2, 2],\n            name: \"zoem zoem\",\n            spyReportStart: true,\n            object: store1,\n            type: \"action\"\n        },\n        { type: \"report-end\", spyReportEnd: true }\n    ])\n\n    d()\n})\n\ntest(\"267 (babel) should be possible to declare properties observable outside strict mode\", () => {\n    configure({ enforceActions: \"observed\" })\n\n    class Store {\n        timer\n\n        constructor() {\n            makeObservable(this, {\n                timer: observable\n            })\n        }\n    }\n    Store // just to avoid linter warning\n\n    configure({ enforceActions: \"never\" })\n})\n\ntest(\"288 atom not detected for object property\", () => {\n    class Store {\n        foo = \"\"\n\n        constructor() {\n            makeObservable(this, {\n                foo: mobx.observable\n            })\n        }\n    }\n\n    const store = new Store()\n    let changed = false\n\n    mobx.observe(\n        store,\n        \"foo\",\n        () => {\n            changed = true\n        },\n        true\n    )\n    expect(changed).toBe(true)\n})\n\ntest.skip(\"observable performance - babel\", () => {\n    const AMOUNT = 100000\n\n    class A {\n        a = 1\n        b = 2\n        c = 3\n\n        constructor() {\n            makeObservable(this, {\n                a: observable,\n                b: observable,\n                c: observable,\n                d: computed\n            })\n        }\n\n        get d() {\n            return this.a + this.b + this.c\n        }\n    }\n\n    const objs = []\n    const start = Date.now()\n\n    for (let i = 0; i < AMOUNT; i++) objs.push(new A())\n\n    console.log(\"created in \", Date.now() - start)\n\n    for (let j = 0; j < 4; j++) {\n        for (let i = 0; i < AMOUNT; i++) {\n            const obj = objs[i]\n            obj.a += 3\n            obj.b *= 4\n            obj.c = obj.b - obj.a\n            obj.d\n        }\n    }\n\n    console.log(\"changed in \", Date.now() - start)\n})\n\ntest.skip(\"observable performance - babel - decorators\", () => {\n    const AMOUNT = 100000\n\n    class A {\n        @observable\n        a = 1\n        @observable\n        b = 2\n        @observable\n        c = 3\n\n        constructor() {\n            makeObservable(this)\n        }\n\n        @computed\n        get d() {\n            return this.a + this.b + this.c\n        }\n    }\n\n    const objs = []\n    const start = Date.now()\n\n    for (let i = 0; i < AMOUNT; i++) objs.push(new A())\n\n    console.log(\"created in \", Date.now() - start)\n\n    for (let j = 0; j < 4; j++) {\n        for (let i = 0; i < AMOUNT; i++) {\n            const obj = objs[i]\n            obj.a += 3\n            obj.b *= 4\n            obj.c = obj.b - obj.a\n            obj.d\n        }\n    }\n\n    console.log(\"changed in \", Date.now() - start)\n})\ntest(\"unbound methods\", () => {\n    class A {\n        constructor() {\n            makeObservable(this, {\n                m1: action,\n                m2: action\n            })\n        }\n\n        // shared across all instances\n        m1() {}\n\n        // per instance\n        m2 = () => {}\n    }\n\n    const a1 = new A()\n    const a2 = new A()\n\n    expect(a1.m1).toBe(a2.m1)\n    expect(a1.m2).not.toBe(a2.m2)\n    expect(a1.hasOwnProperty(\"m1\")).toBe(false)\n    expect(a1.hasOwnProperty(\"m2\")).toBe(true)\n    expect(a2.hasOwnProperty(\"m1\")).toBe(false)\n    expect(a2.hasOwnProperty(\"m2\")).toBe(true)\n})\n\ntest(\"inheritance\", () => {\n    class A {\n        a = 2\n\n        constructor() {\n            makeObservable(this, {\n                a: observable\n            })\n        }\n    }\n\n    class B extends A {\n        b = 3\n\n        constructor() {\n            super()\n            makeObservable(this, {\n                b: observable,\n                c: computed\n            })\n        }\n\n        get c() {\n            return this.a + this.b\n        }\n    }\n\n    const b1 = new B()\n    const b2 = new B()\n    const values = []\n    mobx.autorun(() => values.push(b1.c + b2.c))\n\n    b1.a = 3\n    b1.b = 4\n    b2.b = 5\n    b2.a = 6\n\n    expect(values).toEqual([10, 11, 12, 14, 18])\n})\n\ntest(\"inheritance - 2\", () => {\n    class A {\n        b = 3\n\n        constructor() {\n            makeObservable(this, {\n                b: observable,\n                c: computed\n            })\n        }\n\n        get c() {\n            return this.a + this.b\n        }\n    }\n\n    class B extends A {\n        a = 2\n\n        constructor() {\n            super()\n            makeObservable(this, {\n                a: observable\n            })\n        }\n    }\n\n    const b1 = new B()\n    const b2 = new B()\n    const values = []\n    mobx.autorun(() => values.push(b1.c + b2.c))\n\n    b1.a = 3\n    b1.b = 4\n    b2.b = 5\n    b2.a = 6\n\n    expect(values).toEqual([10, 11, 12, 14, 18])\n})\n\ntest(\"reusing initializers\", () => {\n    class A {\n        a = 3\n        b = this.a + 2\n\n        constructor() {\n            makeObservable(this, {\n                a: observable,\n                b: observable,\n                c: computed,\n                d: computed\n            })\n        }\n\n        get c() {\n            return this.a + this.b\n        }\n        get d() {\n            return this.c + 1\n        }\n    }\n\n    const a = new A()\n    const values = []\n    mobx.autorun(() => values.push(a.d))\n\n    a.a = 4\n    expect(values).toEqual([9, 10])\n})\n\ntest(\"enumerability\", () => {\n    class A {\n        a = 1\n        a2 = 2\n\n        constructor() {\n            makeObservable(this, {\n                a: observable,\n                a2: observable,\n                b: computed,\n                m: action,\n                m2: action\n            })\n        }\n\n        get b() {\n            return this.a\n        } // non-enumerable, (and, ideally, on proto)\n        m() {} // non-enumerable, on proto\n        m2 = () => {} // non-enumerable, on self\n    }\n\n    const a = new A()\n\n    // not initialized yet\n    let ownProps = Object.keys(a)\n    let props = []\n    for (const key in a) props.push(key)\n\n    expect(ownProps).toEqual([\"a\", \"a2\"])\n\n    expect(props).toEqual([\"a\", \"a2\"])\n\n    expect(\"a\" in a).toBe(true)\n    expect(a.hasOwnProperty(\"a\")).toBe(true)\n    expect(a.hasOwnProperty(\"b\")).toBe(true) // false could be ok as well\n    expect(a.hasOwnProperty(\"m\")).toBe(false)\n    expect(a.hasOwnProperty(\"m2\")).toBe(true)\n\n    expect(mobx.isAction(a.m)).toBe(true)\n    expect(mobx.isAction(a.m2)).toBe(true)\n\n    // after initialization\n    a.a\n    a.b\n    a.m\n    a.m2\n\n    ownProps = Object.keys(a)\n    props = []\n    for (const key in a) props.push(key)\n\n    expect(ownProps).toEqual([\n        \"a\",\n        \"a2\" // a2 is now initialized as well, altough never accessed!\n    ])\n\n    expect(props).toEqual([\"a\", \"a2\"])\n\n    expect(\"a\" in a).toBe(true)\n    expect(a.hasOwnProperty(\"a\")).toBe(true)\n    expect(a.hasOwnProperty(\"a2\")).toBe(true)\n    expect(a.hasOwnProperty(\"b\")).toBe(true) // true would better.. but, #1777\n    expect(a.hasOwnProperty(\"m\")).toBe(false)\n    expect(a.hasOwnProperty(\"m2\")).toBe(true)\n})\n\ntest(\"enumerability - workaround\", () => {\n    class A {\n        a = 1 // enumerable, on proto\n        a2 = 2\n        get b() {\n            return this.a\n        } // non-enumerable, (and, ideally, on proto)\n        m() {} // non-enumerable, on proto\n        m2 = () => {} // non-enumerable, on self\n\n        constructor() {\n            makeObservable(this, {\n                a: observable,\n                a2: observable,\n                b: computed,\n                m: action,\n                m2: action\n            })\n\n            this.a = 1\n            this.a2 = 2\n        }\n    }\n\n    const a = new A()\n\n    const ownProps = Object.keys(a)\n    const props = []\n    for (const key in a) props.push(key)\n\n    expect(ownProps).toEqual([\n        \"a\",\n        \"a2\" // a2 is now initialized as well, altough never accessed!\n    ])\n\n    expect(props).toEqual([\"a\", \"a2\"])\n\n    expect(\"a\" in a).toBe(true)\n    expect(a.hasOwnProperty(\"a\")).toBe(true)\n    expect(a.hasOwnProperty(\"a2\")).toBe(true)\n    expect(a.hasOwnProperty(\"b\")).toBe(true) // ideally, false, but #1777\n    expect(a.hasOwnProperty(\"m\")).toBe(false)\n    expect(a.hasOwnProperty(\"m2\")).toBe(true)\n})\n\ntest(\"issue 285 (babel)\", () => {\n    const { observable, toJS } = mobx\n\n    class Todo {\n        id = 1\n        title\n        finished = false\n        childThings = [1, 2, 3]\n        constructor(title) {\n            makeObservable(this, {\n                title: observable,\n                finished: observable,\n                childThings: observable\n            })\n\n            this.title = title\n        }\n    }\n\n    const todo = new Todo(\"Something to do\")\n\n    expect(toJS(todo)).toEqual({\n        id: 1,\n        title: \"Something to do\",\n        finished: false,\n        childThings: [1, 2, 3]\n    })\n})\n\ntest(\"verify object assign (babel)\", () => {\n    class Todo {\n        title = \"test\"\n\n        constructor() {\n            makeObservable(this, {\n                title: observable,\n                upperCase: computed\n            })\n        }\n\n        get upperCase() {\n            return this.title.toUpperCase()\n        }\n    }\n\n    const todo = new Todo()\n    expect(Object.assign({}, todo)).toEqual({\n        title: \"test\"\n    })\n})\n\ntest(\"379, inheritable actions (babel)\", () => {\n    class A {\n        constructor() {\n            makeObservable(this, {\n                method: action\n            })\n        }\n\n        method() {\n            return 42\n        }\n    }\n\n    class B extends A {\n        method() {\n            return super.method() * 2\n        }\n    }\n\n    class C extends B {\n        method() {\n            return super.method() + 3\n        }\n    }\n\n    const b = new B()\n    expect(b.method()).toBe(84)\n    expect(isAction(b.method)).toBe(true)\n\n    const a = new A()\n    expect(a.method()).toBe(42)\n    expect(isAction(a.method)).toBe(true)\n\n    const c = new C()\n    expect(c.method()).toBe(87)\n    expect(isAction(c.method)).toBe(true)\n})\n\ntest(\"505, don't throw when accessing subclass fields in super constructor (babel)\", () => {\n    const values = {}\n    class A {\n        a = 1\n        constructor() {\n            makeObservable(this, {\n                a: observable\n            })\n\n            values.b = this.b\n            values.a = this.a\n        }\n    }\n\n    class B extends A {\n        b = 2\n\n        constructor() {\n            super()\n\n            makeObservable(this, {\n                b: observable\n            })\n        }\n    }\n\n    new B()\n    expect(values).toEqual({ a: 1, b: undefined })\n})\n\ntest(\"computed setter should succeed (babel)\", function () {\n    class Bla {\n        a = 3\n\n        constructor() {\n            makeObservable(this, {\n                a: observable,\n                propX: computed\n            })\n        }\n\n        get propX() {\n            return this.a * 2\n        }\n        set propX(v) {\n            this.a = v\n        }\n    }\n\n    const b = new Bla()\n    expect(b.propX).toBe(6)\n    b.propX = 4\n    expect(b.propX).toBe(8)\n})\n\ntest(\"computed getter / setter for plan objects should succeed (babel)\", function () {\n    const b = observable({\n        a: 3,\n        get propX() {\n            return this.a * 2\n        },\n        set propX(v) {\n            this.a = v\n        }\n    })\n\n    const values = []\n    mobx.autorun(() => values.push(b.propX))\n    expect(b.propX).toBe(6)\n    b.propX = 4\n    expect(b.propX).toBe(8)\n\n    expect(values).toEqual([6, 8])\n})\n\ntest(\"issue #701\", () => {\n    class Model {\n        a = 5\n\n        constructor() {\n            makeObservable(this, {\n                a: observable\n            })\n        }\n    }\n\n    const model = new Model()\n\n    expect(mobx.toJS(model)).toEqual({ a: 5 })\n    expect(mobx.isObservable(model)).toBe(true)\n    expect(mobx.isObservableObject(model)).toBe(true)\n})\n\ntest(\"@observable.ref (Babel)\", () => {\n    class A {\n        ref = { a: 3 }\n\n        constructor() {\n            makeObservable(this, {\n                ref: observable.ref\n            })\n        }\n    }\n\n    const a = new A()\n    expect(a.ref.a).toBe(3)\n    expect(mobx.isObservable(a.ref)).toBe(false)\n    expect(mobx.isObservableProp(a, \"ref\")).toBe(true)\n})\n\ntest(\"@observable.shallow (Babel)\", () => {\n    class A {\n        arr = [{ todo: 1 }]\n\n        constructor() {\n            makeObservable(this, {\n                arr: observable.shallow\n            })\n        }\n    }\n\n    const a = new A()\n    const todo2 = { todo: 2 }\n    a.arr.push(todo2)\n    expect(mobx.isObservable(a.arr)).toBe(true)\n    expect(mobx.isObservableProp(a, \"arr\")).toBe(true)\n    expect(mobx.isObservable(a.arr[0])).toBe(false)\n    expect(mobx.isObservable(a.arr[1])).toBe(false)\n    expect(a.arr[1] === todo2).toBeTruthy()\n})\n\ntest(\"@observable.deep (Babel)\", () => {\n    class A {\n        arr = [{ todo: 1 }]\n\n        constructor() {\n            makeObservable(this, {\n                arr: observable.deep\n            })\n        }\n    }\n\n    const a = new A()\n    const todo2 = { todo: 2 }\n    a.arr.push(todo2)\n\n    expect(mobx.isObservable(a.arr)).toBe(true)\n    expect(mobx.isObservableProp(a, \"arr\")).toBe(true)\n    expect(mobx.isObservable(a.arr[0])).toBe(true)\n    expect(mobx.isObservable(a.arr[1])).toBe(true)\n    expect(a.arr[1] !== todo2).toBeTruthy()\n    expect(isObservable(todo2)).toBe(false)\n})\n\ntest(\"action.bound binds (Babel)\", () => {\n    class A {\n        x = 0\n\n        constructor() {\n            makeObservable(this, {\n                x: observable,\n                inc: action.bound\n            })\n        }\n\n        inc(value) {\n            this.x += value\n        }\n    }\n\n    const a = new A()\n    const runner = a.inc\n    runner(2)\n\n    expect(a.x).toBe(2)\n})\n\ntest(\"@computed.equals (Babel)\", () => {\n    const sameTime = (from, to) => from.hour === to.hour && from.minute === to.minute\n    class Time {\n        constructor(hour, minute) {\n            makeObservable(this, {\n                hour: observable,\n                minute: observable,\n                time: computed({ equals: sameTime })\n            })\n\n            this.hour = hour\n            this.minute = minute\n        }\n\n        hour\n        minute\n\n        get time() {\n            return { hour: this.hour, minute: this.minute }\n        }\n    }\n    const time = new Time(9, 0)\n\n    const changes = []\n    const disposeAutorun = autorun(() => changes.push(time.time))\n\n    expect(changes).toEqual([{ hour: 9, minute: 0 }])\n    time.hour = 9\n    expect(changes).toEqual([{ hour: 9, minute: 0 }])\n    time.minute = 0\n    expect(changes).toEqual([{ hour: 9, minute: 0 }])\n    time.hour = 10\n    expect(changes).toEqual([\n        { hour: 9, minute: 0 },\n        { hour: 10, minute: 0 }\n    ])\n    time.minute = 30\n    expect(changes).toEqual([\n        { hour: 9, minute: 0 },\n        { hour: 10, minute: 0 },\n        { hour: 10, minute: 30 }\n    ])\n\n    disposeAutorun()\n})\n\ntest(\"computed comparer works with decorate (babel)\", () => {\n    const sameTime = (from, to) => from.hour === to.hour && from.minute === to.minute\n    class Time {\n        hour\n        minute\n\n        constructor(hour, minute) {\n            makeObservable(this, {\n                hour: observable,\n                minute: observable,\n                time: computed({ equals: sameTime })\n            })\n\n            this.hour = hour\n            this.minute = minute\n        }\n\n        get time() {\n            return { hour: this.hour, minute: this.minute }\n        }\n    }\n    const time = new Time(9, 0)\n\n    const changes = []\n    const disposeAutorun = autorun(() => changes.push(time.time))\n\n    expect(changes).toEqual([{ hour: 9, minute: 0 }])\n    time.hour = 9\n    expect(changes).toEqual([{ hour: 9, minute: 0 }])\n    time.minute = 0\n    expect(changes).toEqual([{ hour: 9, minute: 0 }])\n    time.hour = 10\n    expect(changes).toEqual([\n        { hour: 9, minute: 0 },\n        { hour: 10, minute: 0 }\n    ])\n    time.minute = 30\n    expect(changes).toEqual([\n        { hour: 9, minute: 0 },\n        { hour: 10, minute: 0 },\n        { hour: 10, minute: 30 }\n    ])\n\n    disposeAutorun()\n})\n\ntest(\"computed comparer works with decorate (babel) - 2\", () => {\n    const sameTime = (from, to) => from.hour === to.hour && from.minute === to.minute\n    class Time {\n        constructor(hour, minute) {\n            extendObservable(\n                this,\n                {\n                    hour,\n                    minute,\n                    get time() {\n                        return { hour: this.hour, minute: this.minute }\n                    }\n                },\n                {\n                    time: computed({ equals: sameTime })\n                }\n            )\n        }\n    }\n    const time = new Time(9, 0)\n\n    const changes = []\n    const disposeAutorun = autorun(() => changes.push(time.time))\n\n    expect(changes).toEqual([{ hour: 9, minute: 0 }])\n    time.hour = 9\n    expect(changes).toEqual([{ hour: 9, minute: 0 }])\n    time.minute = 0\n    expect(changes).toEqual([{ hour: 9, minute: 0 }])\n    time.hour = 10\n    expect(changes).toEqual([\n        { hour: 9, minute: 0 },\n        { hour: 10, minute: 0 }\n    ])\n    time.minute = 30\n    expect(changes).toEqual([\n        { hour: 9, minute: 0 },\n        { hour: 10, minute: 0 },\n        { hour: 10, minute: 30 }\n    ])\n\n    disposeAutorun()\n})\n\ntest(\"computed comparer works with decorate (babel) - 3\", () => {\n    const sameTime = (from, to) => from.hour === to.hour && from.minute === to.minute\n    const time = observable.object(\n        {\n            hour: 9,\n            minute: 0,\n            get time() {\n                return { hour: this.hour, minute: this.minute }\n            }\n        },\n        {\n            time: computed({ equals: sameTime })\n        }\n    )\n\n    const changes = []\n    const disposeAutorun = autorun(() => changes.push(time.time))\n\n    expect(changes).toEqual([{ hour: 9, minute: 0 }])\n    time.hour = 9\n    expect(changes).toEqual([{ hour: 9, minute: 0 }])\n    time.minute = 0\n    expect(changes).toEqual([{ hour: 9, minute: 0 }])\n    time.hour = 10\n    expect(changes).toEqual([\n        { hour: 9, minute: 0 },\n        { hour: 10, minute: 0 }\n    ])\n    time.minute = 30\n    expect(changes).toEqual([\n        { hour: 9, minute: 0 },\n        { hour: 10, minute: 0 },\n        { hour: 10, minute: 30 }\n    ])\n\n    disposeAutorun()\n})\n\n// 19.12.2020 @urugator:\n// All annotated non-observable fields are not writable.\n// All annotated fields of non-plain objects are non-configurable.\n// https://github.com/mobxjs/mobx/pull/2641\ntest.skip(\"actions are reassignable\", () => {\n    // See #1398, make actions reassignable to support stubbing\n    class A {\n        constructor() {\n            makeObservable(this, {\n                m1: action,\n                m2: action,\n                m3: action.bound,\n                m4: action.bound\n            })\n        }\n\n        m1() {}\n        m2 = () => {}\n        m3() {}\n        m4 = () => {}\n    }\n\n    const a = new A()\n    expect(isAction(a.m1)).toBe(true)\n    expect(isAction(a.m2)).toBe(true)\n    expect(isAction(a.m3)).toBe(true)\n    expect(isAction(a.m4)).toBe(true)\n    a.m1 = () => {}\n    expect(isAction(a.m1)).toBe(false)\n    a.m2 = () => {}\n    expect(isAction(a.m2)).toBe(false)\n    a.m3 = () => {}\n    expect(isAction(a.m3)).toBe(false)\n    a.m4 = () => {}\n    expect(isAction(a.m4)).toBe(false)\n})\n\ntest(\"it should support asyncAction (babel)\", async () => {\n    mobx.configure({ enforceActions: \"observed\" })\n\n    class X {\n        a = 1\n\n        f = mobx.flow(function* f(initial) {\n            this.a = initial // this runs in action\n            this.a += yield Promise.resolve(5)\n            this.a = this.a * 2\n            return this.a\n        })\n\n        constructor() {\n            makeObservable(this, {\n                a: observable\n            })\n        }\n    }\n\n    const x = new X()\n\n    expect(await x.f(3)).toBe(16)\n})\n\ntest(\"toJS bug #1413 (babel)\", () => {\n    class X {\n        test = {\n            test1: 1\n        }\n\n        constructor() {\n            makeObservable(this, {\n                test: observable\n            })\n        }\n    }\n\n    const x = new X()\n    const res = mobx.toJS(x.test)\n    expect(res).toEqual({ test1: 1 })\n    expect(res.__mobxDidRunLazyInitializers).toBe(undefined)\n})\n\ntest(\"computed setter problem\", () => {\n    class Contact {\n        firstName = \"\"\n        lastName = \"\"\n\n        constructor() {\n            makeObservable(this, {\n                firstName: observable,\n                lastName: observable,\n\n                fullName: computed({\n                    set(value) {\n                        const [firstName, lastName] = value.split(\" \")\n\n                        this.firstName = firstName\n                        this.lastName = lastName\n                    }\n                })\n            })\n        }\n\n        get fullName() {\n            return `${this.firstName} ${this.lastName}`\n        }\n\n        set fullName(value) {\n            const [firstName, lastName] = value.split(\" \")\n\n            this.firstName = firstName\n            this.lastName = lastName\n        }\n    }\n\n    const c = new Contact()\n\n    c.firstName = \"Pavan\"\n    c.lastName = \"Podila\"\n\n    expect(c.fullName).toBe(\"Pavan Podila\")\n\n    c.fullName = \"Michel Weststrate\"\n    expect(c.firstName).toBe(\"Michel\")\n    expect(c.lastName).toBe(\"Weststrate\")\n})\n\ntest(\"#1740, combining extendObservable & decorators\", () => {\n    class AppState {\n        constructor(id) {\n            makeObservable(this, {\n                foo: computed\n            })\n\n            extendObservable(this, {\n                id\n            })\n            expect(this.foo).toBe(id)\n        }\n\n        get foo() {\n            return this.id\n        }\n    }\n\n    let app = new AppState(1)\n    expect(app.id).toBe(1)\n    expect(app.foo).toBe(1)\n    expect(isObservableProp(app, \"id\")).toBe(true)\n    expect(isComputedProp(app, \"foo\")).toBe(true)\n\n    app = new AppState(2)\n    expect(app.id).toBe(2)\n    expect(app.foo).toBe(2)\n    expect(isObservableProp(app, \"id\")).toBe(true)\n    expect(isComputedProp(app, \"foo\")).toBe(true)\n})\n"
  },
  {
    "path": "packages/mobx/__tests__/v5/base/become-observed.ts",
    "content": "import {\n    autorun,\n    onBecomeObserved,\n    observable,\n    computed,\n    action,\n    makeObservable,\n    onBecomeUnobserved,\n    runInAction,\n    makeAutoObservable\n} from \"../../../src/mobx\"\n\ndescribe(\"become-observed\", () => {\n    it(\"work on map with number as key\", () => {\n        const oMap = observable.map()\n        const key = 1\n        oMap.set(key, observable.box(\"value\"))\n        const cb = jest.fn()\n        onBecomeObserved(oMap, key, cb)\n        autorun(() => oMap.get(key))\n        expect(cb).toHaveBeenCalled()\n    })\n})\n\ntest(\"#2309 don't trigger oBO for computeds that aren't subscribed to\", () => {\n    const events: string[] = []\n\n    class Asd {\n        @observable prop = 42\n\n        @computed\n        get computed() {\n            return this.prop\n        }\n\n        @action\n        actionProp() {\n            const foo = this.prop\n        }\n\n        @action\n        actionComputed() {\n            const bar = this.computed\n        }\n\n        constructor() {\n            makeObservable(this)\n        }\n    }\n\n    const asd = new Asd()\n    onBecomeObserved(asd, \"prop\", () => {\n        events.push(\"onBecomeObserved\")\n    })\n\n    onBecomeUnobserved(asd, \"prop\", () => {\n        events.push(\"onBecomeUnobserved\")\n    })\n\n    asd.actionProp()\n    events.push(\"--\")\n    asd.actionComputed()\n    expect(events).toEqual([\"--\"])\n})\n\ndescribe(\"#2309 onBecomeObserved inconsistencies\", () => {\n    let events: string[] = []\n\n    beforeEach(() => {\n        events = []\n    })\n\n    test(\"caseA\", () => {\n        // Computed {keepAlive: false} -> Observable\n        const o = observable.box(1)\n        const ca = computed(\n            () => {\n                return o.get()\n            },\n            { keepAlive: false }\n        )\n\n        onBecomeObserved(o, () => events.push(`o observed`))\n        onBecomeUnobserved(o, () => events.push(`o unobserved`))\n        onBecomeObserved(ca, () => events.push(`ca observed`))\n        onBecomeUnobserved(ca, () => events.push(`ca unobserved`))\n        expect(events).toEqual([])\n        ca.get()\n        expect(events).toEqual([])\n    })\n\n    test(\"caseB\", () => {\n        // Computed {keepAlive: false} -> Computed {keepAlive: false} -> Observable\n        const o = observable.box(1)\n        const ca = computed(\n            () => {\n                return o.get()\n            },\n            { keepAlive: false }\n        )\n\n        const cb = computed(\n            () => {\n                return ca.get() * 2\n            },\n            { keepAlive: false }\n        )\n\n        onBecomeObserved(o, () => events.push(`o observed`))\n        onBecomeUnobserved(o, () => events.push(`o unobserved`))\n        onBecomeObserved(ca, () => events.push(`ca observed`))\n        onBecomeUnobserved(ca, () => events.push(`ca unobserved`))\n        onBecomeObserved(cb, () => events.push(`cb observed`))\n        onBecomeUnobserved(cb, () => events.push(`cb unobserved`))\n        expect(events).toEqual([])\n        cb.get()\n        expect(events).toEqual([])\n    })\n\n    test(\"caseC\", () => {\n        // Computed {keepAlive: true} -> Observable\n        const o = observable.box(1)\n        const ca = computed(\n            () => {\n                return o.get()\n            },\n            { keepAlive: true }\n        )\n\n        onBecomeObserved(o, () => events.push(`o observed`))\n        onBecomeUnobserved(o, () => events.push(`o unobserved`))\n        onBecomeObserved(ca, () => events.push(`ca observed`))\n        onBecomeUnobserved(ca, () => events.push(`ca unobserved`))\n        expect(events).toEqual([])\n        ca.get()\n        expect(events).toEqual([\"o observed\"]) // everything is hot, and 'o' is really observed so that the keptAlive computed knows about its state\n    })\n\n    test(\"caseD\", () => {\n        // Computed {keepAlive: true} -> Computed {keepAlive: false} -> Observable\n        // logs: `o observed`\n        // potential issue: why are the callbacks not called on `ca` ?\n        const o = observable.box(1)\n        const ca = computed(\n            () => {\n                return o.get()\n            },\n            { keepAlive: false }\n        )\n\n        const cb = computed(\n            () => {\n                return ca.get() * 2\n            },\n            { keepAlive: true }\n        )\n\n        onBecomeObserved(o, () => events.push(`o observed`))\n        onBecomeUnobserved(o, () => events.push(`o unobserved`))\n        onBecomeObserved(ca, () => events.push(`ca observed`))\n        onBecomeUnobserved(ca, () => events.push(`ca unobserved`))\n        onBecomeObserved(cb, () => events.push(`cb observed`))\n        onBecomeUnobserved(cb, () => events.push(`cb unobserved`))\n        expect(events).toEqual([])\n        cb.get()\n        expect(events).toEqual([\"ca observed\", \"o observed\"]) // see above\n    })\n\n    test(\"caseE - base\", () => {\n        const o = observable.box(1)\n        const ca = computed(\n            () => {\n                return o.get()\n            },\n            { keepAlive: false }\n        )\n\n        const cb = computed(\n            () => {\n                return ca.get() * 2\n            },\n            { keepAlive: false }\n        )\n\n        onBecomeObserved(o, () => events.push(`o observed`))\n        onBecomeUnobserved(o, () => events.push(`o unobserved`))\n        onBecomeObserved(ca, () => events.push(`ca observed`))\n        onBecomeUnobserved(ca, () => events.push(`ca unobserved`))\n        onBecomeObserved(cb, () => events.push(`cb observed`))\n        onBecomeUnobserved(cb, () => events.push(`cb unobserved`))\n\n        const u = autorun(() => cb.get())\n        u()\n        expect(events).toEqual([\n            \"cb observed\",\n            \"ca observed\",\n            \"o observed\",\n            \"cb unobserved\",\n            \"ca unobserved\",\n            \"o unobserved\"\n        ])\n    })\n\n    test(\"caseE\", () => {\n        const o = observable.box(1)\n        const ca = computed(\n            () => {\n                return o.get()\n            },\n            { keepAlive: false }\n        )\n\n        const cb = computed(\n            () => {\n                return ca.get() * 2\n            },\n            { keepAlive: true }\n        )\n\n        onBecomeObserved(o, () => events.push(`o observed`))\n        onBecomeUnobserved(o, () => events.push(`o unobserved`))\n        onBecomeObserved(ca, () => events.push(`ca observed`))\n        onBecomeUnobserved(ca, () => events.push(`ca unobserved`))\n        onBecomeObserved(cb, () => events.push(`cb observed`))\n        onBecomeUnobserved(cb, () => events.push(`cb unobserved`))\n\n        const u = autorun(() => cb.get())\n        u()\n        // Note that at this point the observables never become unobserved anymore!\n        // That is correct, because if doing our kept-alive computed doesn't recompute until reobserved,\n        // itself it is still observing all the values of its own deps to figure whether it is still\n        // up to date or not\n        expect(events).toEqual([\"cb observed\", \"ca observed\", \"o observed\", \"cb unobserved\"])\n\n        events.splice(0)\n        const u2 = autorun(() => cb.get())\n        u2()\n        expect(events).toEqual([\"cb observed\", \"cb unobserved\"])\n    })\n\n    test(\"caseF\", () => {\n        // Computed {keepAlive: true} -> Computed {keepAlive: false} -> Observable\n        // cb.get() first then autorun() then unsub()\n        const o = observable.box(1)\n        const ca = computed(\n            () => {\n                return o.get()\n            },\n            { keepAlive: false }\n        )\n\n        const cb = computed(\n            () => {\n                return ca.get() * 2\n            },\n            { keepAlive: true }\n        )\n\n        onBecomeObserved(o, () => events.push(`o observed`))\n        onBecomeUnobserved(o, () => events.push(`o unobserved`))\n        onBecomeObserved(ca, () => events.push(`ca observed`))\n        onBecomeUnobserved(ca, () => events.push(`ca unobserved`))\n        onBecomeObserved(cb, () => events.push(`cb observed`))\n        onBecomeUnobserved(cb, () => events.push(`cb unobserved`))\n        cb.get()\n\n        expect(events).toEqual([\"ca observed\", \"o observed\"])\n        events.splice(0)\n        const u = autorun(() => cb.get())\n        u()\n        expect(events).toEqual([\"cb observed\", \"cb unobserved\"])\n    })\n})\n\ndescribe(\"nested computes don't trigger hooks #2686\", () => {\n    let events: string[] = []\n\n    class Lower {\n        public lowerValue$ = -1\n\n        public isObserved = false\n\n        constructor() {\n            makeObservable(this, {\n                lowerValue$: observable\n            })\n\n            onBecomeObserved(\n                this,\n                \"lowerValue$\",\n                action(() => {\n                    events.push(\"onBecomeObserved\")\n                    this.isObserved = true\n                })\n            )\n            onBecomeUnobserved(\n                this,\n                \"lowerValue$\",\n                action(() => {\n                    events.push(\"onBecomeUnobserved\")\n                    this.isObserved = false\n                })\n            )\n        }\n    }\n\n    class UpperComputed {\n        constructor() {\n            makeObservable(this, {\n                upperValue$: computed,\n                lower$: observable.ref\n            })\n        }\n\n        public lower$: Lower | undefined\n\n        public get upperValue$() {\n            events.push(\"upperValue$\")\n            const lower = this.lower$\n            return lower ? lower.lowerValue$ : -Infinity\n        }\n    }\n\n    const upperComputed = new UpperComputed()\n    const lowerForComputed = new Lower()\n\n    // Set up observers\n    const d = autorun(() => {\n        events.push(\"value read through computed: \" + upperComputed.upperValue$)\n    })\n\n    // Provide the 'lower' values\n    runInAction(() => {\n        upperComputed.lower$ = lowerForComputed\n    })\n\n    // Check if the lower values are being observed.\n    expect(lowerForComputed.isObserved).toBe(true)\n\n    d()\n    expect(lowerForComputed.isObserved).toBe(false)\n\n    expect(events).toEqual([\n        \"upperValue$\",\n        \"value read through computed: -Infinity\",\n        \"upperValue$\",\n        \"onBecomeObserved\",\n        \"value read through computed: -1\",\n        \"onBecomeUnobserved\"\n    ])\n})\n\ntest(\"#2686 - 2\", () => {\n    const events: string[] = []\n    const options = { useColors: false }\n    makeAutoObservable(options)\n    const selection = { color: \"red\" }\n    makeAutoObservable(selection)\n\n    const blue = computed(() => {\n        let val\n        if (options.useColors) {\n            const isSelected = computed(() => selection.color === \"blue\")\n            onBecomeObserved(isSelected, () => events.push(\"observing\"))\n            onBecomeUnobserved(isSelected, () => events.push(\"unobserving\"))\n            val = isSelected.get()\n        }\n        return { isSelected: val }\n    })\n\n    const d = autorun(() => events.push(blue.get().isSelected ? \"selected\" : \"unselected\"))\n\n    runInAction(() => {\n        options.useColors = true\n        selection.color = \"blue\"\n    })\n    d()\n    expect(events).toEqual([\"unselected\", \"observing\", \"selected\", \"unobserving\"])\n})\n\ntest(\"#2686 - 3\", () => {\n    const events: string[] = []\n\n    // half first element of array\n    function halfFirst(data) {\n        const first = computed(() => {\n            events.push(\"recalculating\")\n            return Math.round(data.elements[0] / 2) + data.suffix\n        })\n\n        onBecomeObserved(first, () => {\n            events.push(\"observing first\")\n        })\n\n        return first\n    }\n\n    // APP\n\n    const network = observable({ model: null as any })\n\n    // load\n    const load = computed(() => {\n        // wait to load it\n        if (network.model) {\n            return halfFirst(network.model)\n        }\n        return undefined\n    })\n\n    // display\n    const result = computed(() => (load.get() ? load.get()!.get() : \"loading\"))\n    autorun(() => {\n        events.push(\"Current result: \" + result.get())\n    })\n\n    runInAction(() => (network.model = observable({ suffix: \"$\", elements: [2, 4, 5] })))\n    runInAction(() => (network.model.elements[0] = 3))\n    runInAction(() => (network.model.elements[0] = 4))\n    runInAction(() => (network.model.elements[0] = 5))\n    expect(events).toEqual([\n        \"Current result: loading\",\n        \"observing first\",\n        \"recalculating\",\n        \"Current result: 1$\",\n        \"recalculating\",\n        \"Current result: 2$\",\n        \"recalculating\",\n        \"recalculating\",\n        \"Current result: 3$\"\n    ])\n})\n\ntest(\"#2667\", () => {\n    const events: any[] = []\n    class LazyInitializedList {\n        @observable\n        public items: string[] | undefined\n\n        @observable\n        public listName\n\n        public constructor(listName: string, lazyItems: string[]) {\n            makeObservable(this)\n            this.listName = listName\n            onBecomeObserved(\n                this,\n                \"items\",\n                action(() => {\n                    this.items = lazyItems\n                    events.push(\"onBecomeObserved\" + listName)\n                })\n            )\n            onBecomeUnobserved(\n                this,\n                \"items\",\n                action(() => {\n                    this.items = undefined\n                    events.push(\"onBecomeUnobserved\" + listName)\n                })\n            )\n        }\n    }\n\n    class ItemsStore {\n        @observable\n        private list: LazyInitializedList\n\n        public constructor() {\n            this.list = new LazyInitializedList(\"initial\", [\"a, b, c\"])\n            makeObservable(this)\n        }\n\n        @action\n        public changeList = () => {\n            this.list = new LazyInitializedList(\"new\", [\"b, c, a\"])\n        }\n\n        @computed\n        public get items(): string[] | undefined {\n            return this.list.items\n        }\n\n        @computed\n        public get activeListName(): string {\n            return this.list.listName\n        }\n    }\n\n    const store = new ItemsStore()\n\n    const d = autorun(() => {\n        events.push(store.items?.length ?? \"-\")\n        events.push(store.activeListName)\n    })\n\n    store.changeList()\n\n    d()\n\n    expect(events).toEqual([\n        \"onBecomeObservedinitial\",\n        1,\n        \"initial\",\n        \"onBecomeObservednew\",\n        1,\n        \"new\",\n        \"onBecomeUnobservedinitial\",\n        \"onBecomeUnobservednew\"\n    ])\n})\n\ntest(\"works with ObservableSet #3595\", () => {\n    const onSetObserved = jest.fn()\n    const onSetUnobserved = jest.fn()\n\n    const set = observable.set()\n\n    const disposeOBO = onBecomeObserved(set, onSetObserved)\n    const disposeOBU = onBecomeUnobserved(set, onSetUnobserved)\n    const diposeAutorun = autorun(() => set.size)\n    diposeAutorun()\n    disposeOBO()\n    disposeOBU()\n\n    expect(onSetObserved).toHaveBeenCalledTimes(1)\n    expect(onSetUnobserved).toHaveBeenCalledTimes(1)\n})\n"
  },
  {
    "path": "packages/mobx/__tests__/v5/base/cycles.js",
    "content": "const m = require(\"../../../src/mobx.ts\")\n\ntest(\"cascading active state (form 1)\", function () {\n    const Store = function () {\n        m.extendObservable(this, { _activeItem: null })\n    }\n    Store.prototype.activeItem = function (item) {\n        const _this = this\n\n        if (arguments.length === 0) return this._activeItem\n\n        m.transaction(function () {\n            if (_this._activeItem === item) return\n            if (_this._activeItem) _this._activeItem.isActive = false\n            _this._activeItem = item\n            if (_this._activeItem) _this._activeItem.isActive = true\n        })\n    }\n\n    const Item = function () {\n        m.extendObservable(this, { isActive: false })\n    }\n\n    const store = new Store()\n    const item1 = new Item(),\n        item2 = new Item()\n    expect(store.activeItem()).toBe(null)\n    expect(item1.isActive).toBe(false)\n    expect(item2.isActive).toBe(false)\n\n    store.activeItem(item1)\n    expect(store.activeItem()).toBe(item1)\n    expect(item1.isActive).toBe(true)\n    expect(item2.isActive).toBe(false)\n\n    store.activeItem(item2)\n    expect(store.activeItem()).toBe(item2)\n    expect(item1.isActive).toBe(false)\n    expect(item2.isActive).toBe(true)\n\n    store.activeItem(null)\n    expect(store.activeItem()).toBe(null)\n    expect(item1.isActive).toBe(false)\n    expect(item2.isActive).toBe(false)\n})\n\ntest(\"cascading active state (form 2)\", function () {\n    const Store = function () {\n        const _this = this\n        m.extendObservable(this, { activeItem: null })\n\n        m.autorun(function () {\n            if (_this._activeItem === _this.activeItem) return\n            if (_this._activeItem) _this._activeItem.isActive = false\n            _this._activeItem = _this.activeItem\n            if (_this._activeItem) _this._activeItem.isActive = true\n        })\n    }\n\n    const Item = function () {\n        m.extendObservable(this, { isActive: false })\n    }\n\n    const store = new Store()\n    const item1 = new Item(),\n        item2 = new Item()\n    expect(store.activeItem).toBe(null)\n    expect(item1.isActive).toBe(false)\n    expect(item2.isActive).toBe(false)\n\n    store.activeItem = item1\n    expect(store.activeItem).toBe(item1)\n    expect(item1.isActive).toBe(true)\n    expect(item2.isActive).toBe(false)\n\n    store.activeItem = item2\n    expect(store.activeItem).toBe(item2)\n    expect(item1.isActive).toBe(false)\n    expect(item2.isActive).toBe(true)\n\n    store.activeItem = null\n    expect(store.activeItem).toBe(null)\n    expect(item1.isActive).toBe(false)\n    expect(item2.isActive).toBe(false)\n})\n\ntest(\"emulate rendering\", function () {\n    let renderCount = 0\n\n    const Component = function (props) {\n        this.props = props\n    }\n    Component.prototype.destroy = function () {\n        if (this.handler) {\n            this.handler()\n            this.handler = null\n        }\n    }\n\n    Component.prototype.render = function () {\n        const _this = this\n\n        if (this.handler) {\n            this.handler()\n            this.handler = null\n        }\n        this.handler = m.autorun(function () {\n            if (!_this.props.data.title) _this.props.data.title = \"HELLO\"\n            renderCount++\n        })\n    }\n\n    const data = {}\n    m.extendObservable(data, { title: null })\n    const component = new Component({ data: data })\n    expect(renderCount).toBe(0)\n\n    component.render()\n    expect(renderCount).toBe(1)\n\n    data.title = \"WORLD\"\n    expect(renderCount).toBe(2)\n\n    data.title = null\n    // Note that this causes two invalidations\n    // however, the real mobx-react binding optimizes this as well\n    // see mobx-react #12, so maybe this ain't the best test\n    expect(renderCount).toBe(4)\n\n    data.title = \"WORLD\"\n    expect(renderCount).toBe(5)\n\n    component.destroy()\n    data.title = \"HELLO\"\n    expect(renderCount).toBe(5)\n})\n\ntest(\"efficient selection\", function () {\n    function Item(value) {\n        m.extendObservable(this, {\n            selected: false,\n            value: value\n        })\n    }\n\n    function Store() {\n        this.prevSelection = null\n        m.extendObservable(this, {\n            selection: null,\n            items: [new Item(1), new Item(2), new Item(3)]\n        })\n        m.autorun(() => {\n            if (this.previousSelection === this.selection) return true // converging condition\n            if (this.previousSelection) this.previousSelection.selected = false\n            if (this.selection) this.selection.selected = true\n            this.previousSelection = this.selection\n        })\n    }\n\n    const store = new Store()\n\n    expect(store.selection).toBe(null)\n    expect(\n        store.items.filter(function (i) {\n            return i.selected\n        }).length\n    ).toBe(0)\n\n    store.selection = store.items[1]\n    expect(\n        store.items.filter(function (i) {\n            return i.selected\n        }).length\n    ).toBe(1)\n    expect(store.selection).toBe(store.items[1])\n    expect(store.items[1].selected).toBe(true)\n\n    store.selection = store.items[2]\n    expect(\n        store.items.filter(function (i) {\n            return i.selected\n        }).length\n    ).toBe(1)\n    expect(store.selection).toBe(store.items[2])\n    expect(store.items[2].selected).toBe(true)\n\n    store.selection = null\n    expect(\n        store.items.filter(function (i) {\n            return i.selected\n        }).length\n    ).toBe(0)\n    expect(store.selection).toBe(null)\n})\n"
  },
  {
    "path": "packages/mobx/__tests__/v5/base/decorate.js",
    "content": "// @ts-check\n// Why @ts-check?\n\nimport {\n    observable,\n    computed,\n    autorun,\n    action,\n    isObservableObject,\n    isObservable,\n    isObservableProp,\n    isComputedProp,\n    isAction,\n    makeObservable\n} from \"../../../src/mobx\"\n\n// @ts-ignore\nimport { primitive, serialize, deserialize, createModelSchema } from \"serializr\"\n\ntest(\"throws on undeclared prop\", () => {\n    class Box {\n        constructor() {\n            makeObservable(this, {\n                // @ts-ignore\n                notExisting: true\n            })\n        }\n    }\n\n    expect(() => {\n        new Box()\n    }).toThrow(/Field not found/)\n})\n\ntest(\"decorate should work\", function () {\n    class Box {\n        // @ts-ignore\n        uninitialized\n        height = 20\n        sizes = [2]\n        someFunc = function () {\n            return 2\n        }\n        get width() {\n            return (\n                this.undeclared *\n                this.height *\n                this.sizes.length *\n                this.someFunc() *\n                (this.uninitialized ? 2 : 1)\n            )\n        }\n        addSize() {\n            // @ts-ignore\n            this.sizes.push([3])\n            // @ts-ignore\n            this.sizes.push([4])\n        }\n        constructor() {\n            makeObservable(this, {\n                uninitialized: observable.ref,\n                height: observable,\n                sizes: observable,\n                someFunc: observable,\n                width: computed,\n                addSize: action\n            })\n\n            this.undeclared = 1\n        }\n    }\n\n    const box = new Box()\n    expect(isObservableObject(box)).toBe(true)\n    expect(box.uninitialized).toBe(undefined)\n    expect(box.height).toBe(20)\n    expect(isObservableProp(box, \"uninitialized\")).toBe(true)\n    expect(isObservableProp(box, \"height\")).toBe(true)\n    expect(isObservableProp(box, \"sizes\")).toBe(true)\n    expect(isObservable(box.sizes)).toBe(true)\n    expect(isObservableProp(box, \"someFunc\")).toBe(true)\n    expect(isComputedProp(box, \"width\")).toBe(true)\n    expect(isAction(box.addSize)).toBe(true)\n\n    const ar = []\n\n    autorun(() => {\n        ar.push(box.width)\n    })\n\n    expect(ar.slice()).toEqual([40])\n    box.height = 10\n    expect(ar.slice()).toEqual([40, 20])\n    box.sizes.push(3, 4)\n    expect(ar.slice()).toEqual([40, 20, 60])\n    box.someFunc = () => 7\n    expect(ar.slice()).toEqual([40, 20, 60, 210])\n    box.uninitialized = true\n    expect(ar.slice()).toEqual([40, 20, 60, 210, 420])\n    box.addSize()\n    expect(ar.slice()).toEqual([40, 20, 60, 210, 420, 700])\n    box.undeclared = 2 // not observable, doesn't trigger anything\n    expect(ar.slice()).toEqual([40, 20, 60, 210, 420, 700])\n\n    const box2 = new Box()\n    expect(box2.width).toBe(40) // no shared state!\n})\n\ntest(\"decorate should work with plain object\", function () {\n    const box = {\n        /** @type {boolean | undefined} */\n        uninitialized: undefined,\n        height: 20,\n        sizes: [2],\n        someFunc: function () {\n            return 2\n        },\n        get width() {\n            return (\n                this.undeclared *\n                this.height *\n                this.sizes.length *\n                this.someFunc() *\n                (this.uninitialized ? 2 : 1)\n            )\n        },\n        addSize() {\n            // @ts-ignore\n            this.sizes.push([3])\n            // @ts-ignore\n            this.sizes.push([4])\n        }\n    }\n\n    makeObservable(box, {\n        uninitialized: observable,\n        height: observable,\n        sizes: observable,\n        someFunc: observable,\n        width: computed,\n        addSize: action\n    })\n    box.undeclared = 1\n\n    expect(isObservableObject(box)).toBe(true)\n    expect(box.uninitialized).toBe(undefined)\n    expect(box.height).toBe(20)\n    expect(isObservableProp(box, \"uninitialized\")).toBe(true)\n    expect(isObservableProp(box, \"height\")).toBe(true)\n    expect(isObservableProp(box, \"sizes\")).toBe(true)\n    expect(isObservable(box.sizes)).toBe(true)\n    expect(isObservableProp(box, \"someFunc\")).toBe(true)\n    expect(isComputedProp(box, \"width\")).toBe(true)\n    expect(isAction(box.addSize)).toBe(true)\n\n    const ar = []\n\n    autorun(() => {\n        ar.push(box.width)\n    })\n\n    expect(ar.slice()).toEqual([40])\n    box.height = 10\n    expect(ar.slice()).toEqual([40, 20])\n    box.sizes.push(3, 4)\n    expect(ar.slice()).toEqual([40, 20, 60])\n    box.someFunc = () => 7\n    expect(ar.slice()).toEqual([40, 20, 60, 210])\n    box.uninitialized = true\n    expect(ar.slice()).toEqual([40, 20, 60, 210, 420])\n    box.addSize()\n    expect(ar.slice()).toEqual([40, 20, 60, 210, 420, 700])\n    box.undeclared = 2 // not observable, doesn't trigger anything\n    expect(ar.slice()).toEqual([40, 20, 60, 210, 420, 700])\n})\n\n// 21.12.2020 @urugator:\n// Copying props from prototype to instance and making them observable doesn't make much sense.\n// Probably we shouldn't support this. TODO@major\ntest(\"decorate should work with Object.create\", function () {\n    const Box = {\n        uninitialized: undefined,\n        height: 20,\n        sizes: [2],\n        someFunc: function () {\n            return 2\n        },\n        get width() {\n            return (\n                this.undeclared *\n                this.height *\n                this.sizes.length *\n                this.someFunc() *\n                (this.uninitialized ? 2 : 1)\n            )\n        },\n        addSize() {\n            // @ts-ignore\n            this.sizes.push([3])\n            // @ts-ignore\n            this.sizes.push([4])\n        }\n    }\n\n    const box = Object.create(Box)\n    makeObservable(box, {\n        uninitialized: observable,\n        height: observable,\n        sizes: observable,\n        someFunc: observable,\n        width: computed,\n        addSize: action\n    })\n    box.undeclared = 1\n\n    expect(isObservableObject(box)).toBe(true)\n    expect(box.uninitialized).toBe(undefined)\n    expect(box.height).toBe(20)\n    expect(isObservableProp(box, \"uninitialized\")).toBe(true)\n    expect(isObservableProp(box, \"height\")).toBe(true)\n    expect(isObservableProp(box, \"sizes\")).toBe(true)\n    expect(isObservable(box.sizes)).toBe(true)\n    expect(isObservableProp(box, \"someFunc\")).toBe(true)\n    expect(isComputedProp(box, \"width\")).toBe(true)\n    expect(isAction(box.addSize)).toBe(true)\n\n    const ar = []\n\n    autorun(() => {\n        ar.push(box.width)\n    })\n\n    expect(ar.slice()).toEqual([40])\n    box.height = 10\n    expect(ar.slice()).toEqual([40, 20])\n    box.sizes.push(3, 4)\n    expect(ar.slice()).toEqual([40, 20, 60])\n    box.someFunc = () => 7\n    expect(ar.slice()).toEqual([40, 20, 60, 210])\n    box.uninitialized = true\n    expect(ar.slice()).toEqual([40, 20, 60, 210, 420])\n    box.addSize()\n    expect(ar.slice()).toEqual([40, 20, 60, 210, 420, 700])\n    box.undeclared = 2 // not observable, doesn't trigger anything\n    expect(ar.slice()).toEqual([40, 20, 60, 210, 420, 700])\n})\n\ntest(\"decorate should work with constructor function\", function () {\n    function Box() {\n        this.uninitialized = undefined\n        this.height = 20\n        Object.defineProperty(this, \"width\", {\n            configurable: true,\n            enumerable: false,\n            get() {\n                /** @type {Box} */\n                const t /** @type {any} */ = this\n\n                return (\n                    // @ts-ignore\n                    t.undeclared *\n                    t.height *\n                    t.sizes.length *\n                    t.someFunc() *\n                    (t.uninitialized ? 2 : 1)\n                )\n            }\n        })\n        this.sizes = [2]\n        this.someFunc = function () {\n            return 2\n        }\n        this.addSize = function () {\n            this.sizes.push(3)\n            this.sizes.push(4)\n        }\n        makeObservable(this, {\n            uninitialized: observable,\n            height: observable,\n            sizes: observable,\n            someFunc: observable,\n            // @ts-ignore TS is unable to see property through defineProperty\n            width: computed,\n            addSize: action\n        })\n    }\n\n    const box = new Box()\n    // @ts-ignore\n    box.undeclared = 1\n\n    expect(isObservableObject(box)).toBe(true)\n    expect(box.uninitialized).toBe(undefined)\n    expect(box.height).toBe(20)\n    expect(isObservableProp(box, \"uninitialized\")).toBe(true)\n    expect(isObservableProp(box, \"height\")).toBe(true)\n    expect(isObservableProp(box, \"sizes\")).toBe(true)\n    expect(isObservable(box.sizes)).toBe(true)\n    expect(isObservableProp(box, \"someFunc\")).toBe(true)\n    expect(isComputedProp(box, \"width\")).toBe(true)\n    expect(isAction(box.addSize)).toBe(true)\n\n    const ar = []\n\n    autorun(() => {\n        // @ts-ignore\n        ar.push(box.width)\n    })\n\n    expect(ar.slice()).toEqual([40])\n    box.height = 10\n    expect(ar.slice()).toEqual([40, 20])\n    box.sizes.push(3, 4)\n    expect(ar.slice()).toEqual([40, 20, 60])\n    box.someFunc = () => 7\n    expect(ar.slice()).toEqual([40, 20, 60, 210])\n    box.uninitialized = true\n    expect(ar.slice()).toEqual([40, 20, 60, 210, 420])\n    box.addSize()\n    expect(ar.slice()).toEqual([40, 20, 60, 210, 420, 700])\n\n    const box2 = new Box()\n    // @ts-ignore\n    box2.undeclared = 1\n    // @ts-ignore\n    expect(box2.width).toBe(40) // no shared state!\n})\n\ntest(\"decorate should work with inheritance through Object.create\", () => {\n    const P = {\n        x: 3\n    }\n    makeObservable(P, {\n        x: observable\n    })\n\n    const child1 = Object.create(P)\n    expect(child1.x).toBe(3)\n    child1.x = 4 // this modifies the prop on P, since that is what was made observable\n    expect(child1.x).toBe(4)\n    const child2 = Object.create(P)\n    expect(child2.x).toBe(4)\n    child2.x = 5\n    expect(child2.x).toBe(5)\n    expect(child1.x).toBe(5)\n})\n\ntest(\"decorator requires correct types\", function () {\n    const obj = {\n        x: 0,\n        get y() {\n            return 0\n        }\n    }\n\n    expect(() => {\n        makeObservable(obj, {\n            x: computed\n        })\n    }).toThrow(/can only be used on getter\\(\\+setter\\) properties/)\n\n    expect(() => {\n        makeObservable(obj, {\n            x: action\n        })\n    }).toThrow(/can only be used on properties with a function value/)\n\n    expect(() => {\n        makeObservable(obj, {\n            y: observable\n        })\n    }).toThrow(/cannot be used on getter\\/setter properties/)\n})\n\ntest(\"decorate a property with two decorators\", function () {\n    let updatedByAutorun\n\n    class Obj {\n        x = null\n\n        constructor() {\n            makeObservable(this, {\n                x: observable\n            })\n        }\n    }\n    createModelSchema(Obj, {\n        x: primitive()\n    })\n\n    const obj = deserialize(Obj, {\n        x: 0\n    })\n\n    const d = autorun(() => {\n        updatedByAutorun = obj.x\n    })\n\n    expect(isObservableProp(obj, \"x\")).toBe(true)\n    expect(updatedByAutorun).toEqual(0)\n    // @ts-ignore\n    obj.x++\n\n    expect(obj.x).toEqual(1)\n    expect(updatedByAutorun).toEqual(1)\n    expect(serialize(obj).x).toEqual(1)\n\n    d()\n})\n\ntest(\"expect warning for missing decorated getter\", () => {\n    const obj = {\n        x: 0,\n        get y() {\n            return 1\n        }\n    }\n\n    expect(() => {\n        makeObservable(obj, {\n            x: observable,\n            y: computed,\n            // @ts-expect-error\n            z: computed\n        })\n    }).toThrow(/Field not found/)\n})\n"
  },
  {
    "path": "packages/mobx/__tests__/v5/base/errorhandling.js",
    "content": "const mobx = require(\"../../../src/mobx.ts\")\nconst m = mobx\nconst utils = require(\"../../v5/utils/test-utils\")\n\nconst { observable, computed, $mobx, autorun } = mobx\n\nconst voidObserver = function () {}\n\nfunction checkGlobalState() {\n    const gs = mobx._getGlobalState()\n    expect(gs.isRunningReactions).toBe(false)\n    expect(gs.trackingDerivation).toBe(null)\n    expect(gs.inBatch).toBe(0)\n    expect(gs.allowStateChanges).toBe(!gs.strictMode)\n    expect(gs.pendingUnobservations.length).toBe(0)\n}\n\ntest(\"exception1\", function () {\n    const a = computed(function () {\n        throw \"hoi\"\n    })\n    expect(() => a.get()).toThrow(/hoi/)\n    checkGlobalState()\n})\n\ntest(\"exceptions in computed values can be recovered from\", () => {\n    const a = observable({\n        x: 1,\n        get y() {\n            if (this.x === 2) throw \"Uhoh\"\n            return this.x * 2\n        }\n    })\n\n    expect(a.y).toBe(2)\n    a.x = 2\n\n    expect(() => a.y).toThrow(/Uhoh/)\n\n    checkGlobalState()\n\n    a.x = 3\n    expect(a.y).toBe(6)\n    checkGlobalState()\n})\n\ntest(\"exception when starting autorun can be recovered from\", () => {\n    let b = undefined\n    const a = observable({\n        x: 2,\n        get y() {\n            if (this.x === 2) throw \"Uhoh\"\n            return this.x * 2\n        }\n    })\n\n    utils.consoleError(() => {\n        mobx.autorun(() => {\n            b = a.y\n        })\n    }, /Uhoh/)\n    expect(b).toBe(undefined)\n    checkGlobalState()\n    a.x = 3\n    expect(b).toBe(6)\n    checkGlobalState()\n    expect(mobx.getAtom(a, \"y\").observers_.size).toBe(1)\n})\n\ntest(\"exception in autorun can be recovered from\", () => {\n    let b = undefined\n    const a = observable({\n        x: 1,\n        get y() {\n            if (this.x === 2) throw \"Uhoh\"\n            return this.x * 2\n        }\n    })\n\n    const d = mobx.autorun(() => {\n        b = a.y\n    })\n    expect(a.y).toBe(2)\n    expect(b).toBe(2)\n    expect(mobx.getAtom(a, \"y\").observers_.size).toBe(1)\n\n    utils.consoleError(() => {\n        a.x = 2\n    }, /Uhoh/)\n\n    // exception is also rethrown to each consumer\n    expect(() => {\n        expect(a.y).toBe(2) // old cached value!\n    }).toThrow(/Uhoh/)\n    expect(mobx.getAtom(a, \"y\").observers_.size).toBe(1)\n\n    expect(b).toBe(2)\n    checkGlobalState()\n\n    a.x = 3\n    expect(a.y).toBe(6)\n    expect(b).toBe(6)\n    checkGlobalState()\n    expect(mobx.getAtom(a, \"y\").observers_.size).toBe(1)\n    d()\n    expect(mobx.getAtom(a, \"y\").observers_.size).toBe(0)\n})\n\ntest(\"multiple autoruns with exceptions are handled correctly\", () => {\n    const a = mobx.observable.box(1)\n    const values = []\n    const d1 = mobx.autorun(() => values.push(\"a\" + a.get()))\n    const d2 = mobx.autorun(() => {\n        if (a.get() === 2) throw /Uhoh/\n        values.push(\"b\" + a.get())\n    })\n    const d3 = mobx.autorun(() => values.push(\"c\" + a.get()))\n\n    expect(values).toEqual([\"a1\", \"b1\", \"c1\"])\n    values.splice(0)\n\n    utils.consoleError(() => a.set(2), /Uhoh/)\n    checkGlobalState()\n\n    expect(values.sort()).toEqual([\"a2\", \"c2\"]) // order is irrelevant\n    values.splice(0)\n\n    a.set(3)\n    expect(values.sort()).toEqual([\"a3\", \"b3\", \"c3\"]) // order is irrelevant\n\n    checkGlobalState()\n    d1()\n    d2()\n    d3()\n})\n\ntest(\"deny state changes in views\", function () {\n    const x = observable.box(3)\n    const z = observable.box(5)\n    const y = computed(function () {\n        z.set(6)\n        return x.get() * x.get()\n    })\n\n    expect(() => {\n        y.get() // modifying unobserved values in computeds is allowed, so that new observables can be created and returned\n    }).not.toThrow()\n\n    m.reaction(\n        () => z.get(),\n        () => {}\n    )\n    expect(\n        utils.grabConsole(() => {\n            y.get()\n        })\n    ).toMatchInlineSnapshot(\n        `\"<STDOUT> [MobX] Side effects like changing state are not allowed at this point. Are you trying to modify state from, for example, a computed value or the render function of a React component? You can wrap side effects in 'runInAction' (or decorate functions with 'action') if needed. Tried to modify: ObservableValue@15\"`\n    )\n\n    checkGlobalState()\n})\n\ntest(\"allow state changes in autorun\", function () {\n    const x = observable.box(3)\n    const z = observable.box(3)\n\n    m.autorun(function () {\n        if (x.get() !== 3) z.set(x.get())\n    })\n\n    expect(x.get()).toBe(3)\n    expect(z.get()).toBe(3)\n\n    x.set(5) // autorunneres are allowed to change state\n\n    expect(x.get()).toBe(5)\n    expect(z.get()).toBe(5)\n\n    expect(mobx._isComputingDerivation()).toBe(false)\n    checkGlobalState()\n})\n\ntest(\"deny array change in view\", function (done) {\n    const x = observable.box(3)\n    const z = observable([])\n    const y = computed(function () {\n        z.push(3)\n        return x.get() * x.get()\n    })\n\n    expect(function () {\n        y.get() // modifying z is allowed if nobody is observing\n    }).not.toThrow()\n    m.reaction(\n        () => z.length,\n        () => {}\n    )\n\n    expect(\n        utils.grabConsole(function () {\n            y.get()\n        })\n    ).toMatchInlineSnapshot(\n        `\"<STDOUT> [MobX] Side effects like changing state are not allowed at this point. Are you trying to modify state from, for example, a computed value or the render function of a React component? You can wrap side effects in 'runInAction' (or decorate functions with 'action') if needed. Tried to modify: ObservableArray@22\"`\n    )\n\n    expect(z.slice()).toEqual([3, 3])\n    expect(mobx._isComputingDerivation()).toBe(false)\n\n    checkGlobalState()\n    done()\n})\n\ntest(\"allow array change in autorun\", function () {\n    const x = observable.box(3)\n    const z = observable([])\n    m.autorun(function () {\n        if (x.get() > 4) z.push(x.get())\n    })\n\n    x.set(5)\n    x.set(6)\n    expect(z.slice()).toEqual([5, 6])\n    x.set(2)\n    expect(z.slice()).toEqual([5, 6])\n\n    expect(mobx._isComputingDerivation()).toBe(false)\n    checkGlobalState()\n})\n\ntest(\"throw error if modification loop\", function () {\n    const x = observable.box(3)\n    m.autorun(function () {\n        x.set(x.get() + 1) // is allowed to throw, but doesn't as the observables aren't bound yet during first execution\n    })\n    utils.consoleError(() => {\n        x.set(5)\n    }, /Reaction doesn't converge to a stable state/)\n    checkGlobalState()\n})\n\ntest(\"cycle1\", function () {\n    const p = computed(function () {\n        return p.get() * 2\n    }) // thats a cycle!\n    utils.consoleError(() => {\n        mobx.observe(p, voidObserver, true)\n    }, /Cycle detected/)\n    checkGlobalState()\n})\n\ntest(\"cycle2\", function () {\n    const a = computed(function () {\n        return b.get() * 2\n    })\n    const b = computed(function () {\n        return a.get() * 2\n    })\n    expect(() => {\n        b.get()\n    }).toThrow(/Cycle detected/)\n    checkGlobalState()\n})\n\ntest(\"cycle3\", function () {\n    const p = computed(function () {\n        return p.get() * 2\n    })\n    expect(() => {\n        p.get()\n    }).toThrow(/Cycle detected/)\n    checkGlobalState()\n})\n\ntest(\"cycle4\", function () {\n    const z = observable.box(true)\n    const a = computed(function () {\n        return z.get() ? 1 : b.get() * 2\n    })\n    const b = computed(function () {\n        return a.get() * 2\n    })\n\n    m.observe(b, voidObserver)\n    expect(1).toBe(a.get())\n\n    utils.consoleError(() => {\n        z.set(false) // introduces a cycle!\n    }, /Cycle detected/)\n    checkGlobalState()\n})\n\ntest(\"throws when the max iterations over reactions are done\", () => {\n    const foo = mobx.observable({\n        a: 1\n    })\n\n    mobx.autorun(\n        () => {\n            foo.a\n            foo.a = Math.random()\n        },\n        { name: \"bar\" }\n    )\n\n    utils.consoleError(\n        () => foo.a++,\n        /Reaction doesn't converge to a stable state after 100 iterations/\n    )\n    mobx._resetGlobalState()\n})\n\ntest(\"issue 86, converging cycles\", function () {\n    function findIndex(arr, predicate) {\n        for (let i = 0, l = arr.length; i < l; i++) if (predicate(arr[i]) === true) return i\n        return -1\n    }\n\n    const deleteThisId = mobx.observable.box(1)\n    const state = mobx.observable({ someArray: [] })\n    let calcs = 0\n\n    state.someArray.push({ id: 1, text: \"I am 1\" })\n    state.someArray.push({ id: 2, text: \"I am 2\" })\n\n    // should delete item 1 in first run, which works fine\n    mobx.autorun(() => {\n        calcs++\n        const i = findIndex(state.someArray, item => item.id === deleteThisId.get())\n        state.someArray.remove(state.someArray[i])\n    })\n\n    expect(state.someArray.length).toBe(1) // should be 1, which prints fine\n    expect(calcs).toBe(1)\n    deleteThisId.set(2) // should delete item 2, but it errors on cycle\n\n    expect(state.someArray.length).toBe(0) // should be 0, which never prints\n    expect(calcs).toBe(3)\n\n    checkGlobalState()\n})\n\ntest(\"slow converging cycle\", function () {\n    const x = mobx.observable.box(1)\n    let res = -1\n    mobx.autorun(() => {\n        if (x.get() === 100) res = x.get()\n        else x.set(x.get() + 1)\n    })\n\n    // ideally the outcome should be 100 / 100.\n    // autorun is only an observer of x *after* the first run, hence the initial outcome is not as expected..\n    // is there a practical use case where such a pattern would be expected?\n    // maybe we need to immediately register observers on the observable? but that would be slow....\n    // or detect cycles and re-run the autorun in that case once?\n    expect(x.get()).toBe(2)\n    expect(res).toBe(-1)\n\n    x.set(7)\n    expect(x.get()).toBe(100)\n    expect(res).toBe(100)\n\n    checkGlobalState()\n})\n\ntest(\"error handling assistence \", function (done) {\n    const baseError = console.error\n    const baseWarn = console.warn\n    const errors = [] // logged errors\n    const warns = [] // logged warns\n    const values = [] // produced errors\n    const thrown = [] // list of actually thrown exceptons\n\n    console.error = function (msg) {\n        errors.push(msg)\n    }\n    console.warn = function (msg) {\n        warns.push(msg)\n    }\n\n    const a = observable.box(3)\n    const b = computed(function () {\n        if (a.get() === 42) throw \"should not be 42\"\n        return a.get() * 2\n    })\n\n    m.autorun(function () {\n        values.push(b.get())\n    })\n\n    a.set(2)\n    try {\n        a.set(42)\n    } catch (e) {\n        thrown.push(e)\n    }\n    a.set(7)\n\n    // Test recovery\n    setTimeout(function () {\n        a.set(4)\n        try {\n            a.set(42)\n        } catch (e) {\n            thrown.push(e)\n        }\n\n        expect(values).toEqual([6, 4, 14, 8])\n        expect(errors.length).toBe(2)\n        expect(warns.length).toBe(0)\n        expect(thrown.length).toBe(0) // Mobx doesn't propagate throws from reactions\n\n        console.error = baseError\n        console.warn = baseWarn\n\n        checkGlobalState()\n        done()\n    }, 10)\n})\n\ntest(\"236 - cycles\", () => {\n    const Parent = function () {\n        m.extendObservable(this, {\n            children: [],\n            get total0() {\n                // Sum \"value\" of children of kind \"0\"\n                return this.children\n                    .filter(c => c.kind === 0)\n                    .map(c => c.value)\n                    .reduce((a, b) => a + b, 0)\n            },\n            get total1() {\n                // Sum \"value\" of children of kind \"1\"\n                return this.children\n                    .filter(c => c.kind === 1)\n                    .map(c => c.value)\n                    .reduce((a, b) => a + b, 0)\n            }\n        })\n    }\n\n    const Child = function (parent, kind) {\n        this.parent = parent\n        m.extendObservable(this, {\n            kind: kind,\n            get value() {\n                if (this.kind === 0) {\n                    return 3\n                } else {\n                    // Value of child of kind \"1\" depends on the total value for all children of kind \"0\"\n                    return this.parent.total0 * 2\n                }\n            }\n        })\n    }\n\n    const parent = new Parent()\n    parent.children.push(new Child(parent, 0))\n    parent.children.push(new Child(parent, 0))\n    parent.children.push(new Child(parent, 0))\n\n    const msg = []\n    m.autorun(() => {\n        msg.push(\"total0:\", parent.total0, \"total1:\", parent.total1)\n    })\n    // So far, so good: total0: 9 total1: 0\n    expect(msg).toEqual([\"total0:\", 9, \"total1:\", 0])\n    parent.children[0].kind = 1\n    expect(msg).toEqual([\"total0:\", 9, \"total1:\", 0, \"total0:\", 6, \"total1:\", 12])\n\n    checkGlobalState()\n})\n\ntest(\"peeking inside erroring computed value doesn't bork (global) state\", () => {\n    const a = mobx.observable.box(1)\n    const b = mobx.computed(() => {\n        a.get()\n        throw \"chocolademelk\"\n    })\n\n    expect(() => {\n        b.get()\n    }).toThrow(/chocolademelk/)\n\n    expect(a.isPendingUnobservation).toBe(false)\n    expect(a.observers_.size).toBe(0)\n    expect(a.diffValue).toBe(0)\n    expect(a.lowestObserverState_).toBe(-1)\n    expect(a.hasUnreportedChange_).toBe(false)\n    expect(a.value_).toBe(1)\n\n    expect(b.dependenciesState_).toBe(-1) // NOT_TRACKING\n    expect(b.observing_.length).toBe(0)\n    expect(b.newObserving_).toBe(null)\n    expect(b.isPendingUnobservation).toBe(false)\n    expect(b.observers_.size).toBe(0)\n    expect(b.diffValue).toBe(0)\n    expect(b.lowestObserverState_).toBe(0)\n    expect(b.unboundDepsCount_).toBe(0)\n    expect(() => {\n        b.get()\n    }).toThrow(/chocolademelk/)\n    expect(b.isComputing).toBe(false)\n\n    checkGlobalState()\n})\n\ndescribe(\"peeking inside autorun doesn't bork (global) state\", () => {\n    let r = -1\n    const a = mobx.observable.box(1)\n    const b = mobx.computed(() => {\n        const res = (r = a.get())\n        if (res === 2) throw \"chocolademelk\"\n        return res\n    })\n    const d = mobx.autorun(() => b.get())\n    const c = d[$mobx]\n\n    expect(b.get()).toBe(1)\n    expect(r).toBe(1)\n\n    test(\"it should update correctly initially\", () => {\n        expect(a.isPendingUnobservation).toBe(false)\n        expect(a.observers_.size).toBe(1)\n        expect(a.diffValue).toBe(0)\n        expect(a.lowestObserverState_).toBe(-1)\n        expect(a.hasUnreportedChange_).toBe(false)\n        expect(a.value_).toBe(1)\n\n        expect(b.dependenciesState_).toBe(0)\n        expect(b.observing_.length).toBe(1)\n        expect(b.newObserving_).toBe(null)\n        expect(b.isPendingUnobservation).toBe(false)\n        expect(b.observers_.size).toBe(1)\n        expect(b.diffValue).toBe(0)\n        expect(b.lowestObserverState_).toBe(0)\n        expect(b.unboundDepsCount_).toBe(1) // value is always the last bound amount of observers\n        expect(b.value_).toBe(1)\n        expect(b.isComputing).toBe(false)\n\n        expect(c.dependenciesState_).toBe(0)\n        expect(c.observing_.length).toBe(1)\n        expect(c.newObserving_).toBe(null)\n        expect(c.diffValue).toBe(0)\n        expect(c.unboundDepsCount_).toBe(1)\n        expect(c.isDisposed).toBe(false)\n        expect(c.isScheduled).toBe(false)\n        expect(c.isTrackPending).toBe(false)\n        expect(c.isRunning).toBe(false)\n        checkGlobalState()\n    })\n\n    test(\"it should not break internal consistency when exception occurred\", () => {\n        // Trigger exception\n        utils.consoleError(() => {\n            a.set(2)\n        }, /chocolademelk/)\n        expect(r).toBe(2)\n\n        expect(a.isPendingUnobservation).toBe(false)\n        expect(a.observers_.size).toBe(1)\n        expect(a.diffValue).toBe(0)\n        expect(a.lowestObserverState_).toBe(0)\n        expect(a.hasUnreportedChange_).toBe(false)\n        expect(a.value_).toBe(2)\n\n        expect(b.dependenciesState_).toBe(0) // up to date (for what it's worth)\n        expect(b.observing_.length).toBe(1)\n        expect(b.newObserving_).toBe(null)\n        expect(b.isPendingUnobservation).toBe(false)\n        expect(b.observers_.size).toBe(1)\n        expect(b.diffValue).toBe(0)\n        expect(b.lowestObserverState_).toBe(0)\n        expect(b.unboundDepsCount_).toBe(1)\n        expect(b.isComputing).toBe(false)\n        expect(() => b.get()).toThrow(/chocolademelk/)\n\n        expect(c.dependenciesState_).toBe(0)\n        expect(c.observing_.length).toBe(1)\n        expect(c.newObserving_).toBe(null)\n        expect(c.diffValue).toBe(0)\n        expect(c.unboundDepsCount_).toBe(1)\n        expect(c.isDisposed).toBe(false)\n        expect(c.isScheduled).toBe(false)\n        expect(c.isTrackPending).toBe(false)\n        expect(c.isRunning).toBe(false)\n        checkGlobalState()\n    })\n\n    // Trigger a new change, will this recover?\n    // is this actually a supported case or should we just give up?\n    test(\"it should recover from errors\", () => {\n        a.set(3)\n        expect(r).toBe(3)\n\n        expect(a.isPendingUnobservation).toBe(false)\n        expect(a.observers_.size).toBe(1)\n        expect(a.diffValue).toBe(0)\n        expect(a.lowestObserverState_).toBe(0)\n        expect(a.hasUnreportedChange_).toBe(false)\n        expect(a.value_).toBe(3)\n\n        expect(b.dependenciesState_).toBe(0) // up to date\n        expect(b.observing_.length).toBe(1)\n        expect(b.newObserving_).toBe(null)\n        expect(b.isPendingUnobservation).toBe(false)\n        expect(b.observers_.size).toBe(1)\n        expect(b.diffValue).toBe(0)\n        expect(b.lowestObserverState_).toBe(0)\n        expect(b.unboundDepsCount_).toBe(1)\n        expect(b.value_).toBe(3)\n        expect(b.isComputing).toBe(false)\n\n        expect(c.dependenciesState_).toBe(0)\n        expect(c.observing_.length).toBe(1)\n        expect(c.newObserving_).toBe(null)\n        expect(c.diffValue).toBe(0)\n        expect(c.unboundDepsCount_).toBe(1)\n        expect(c.isDisposed).toBe(false)\n        expect(c.isScheduled).toBe(false)\n        expect(c.isTrackPending).toBe(false)\n        expect(c.isRunning).toBe(false)\n\n        checkGlobalState()\n    })\n\n    test(\"it should clean up correctly\", () => {\n        d()\n\n        expect(a.isPendingUnobservation).toBe(false)\n        expect(a.observers_.size).toBe(0)\n        expect(a.diffValue).toBe(0)\n        expect(a.lowestObserverState_).toBe(0)\n        expect(a.hasUnreportedChange_).toBe(false)\n        expect(a.value_).toBe(3)\n\n        expect(b.dependenciesState_).toBe(-1) // not tracking\n        expect(b.observing_.length).toBe(0)\n        expect(b.newObserving_).toBe(null)\n        expect(b.isPendingUnobservation).toBe(false)\n        expect(b.observers_.size).toBe(0)\n        expect(b.diffValue).toBe(0)\n        expect(b.lowestObserverState_).toBe(0)\n        expect(b.unboundDepsCount_).toBe(1)\n        expect(b.value_).not.toBe(3)\n        expect(b.isComputing).toBe(false)\n\n        expect(c.dependenciesState_).toBe(-1)\n        expect(c.observing_.length).toBe(0)\n        expect(c.newObserving_).toBe(null)\n        expect(c.diffValue).toBe(0)\n        expect(c.unboundDepsCount_).toBe(1)\n        expect(c.isDisposed).toBe(true)\n        expect(c.isScheduled).toBe(false)\n        expect(c.isTrackPending).toBe(false)\n        expect(c.isRunning).toBe(false)\n\n        expect(b.get()).toBe(3)\n\n        checkGlobalState()\n    })\n})\n\ntest(\"it should be possible to handle exceptions in reaction\", () => {\n    utils.supressConsole(() => {\n        const errors = []\n        const a = mobx.observable.box(1)\n        const d = mobx.autorun(\n            function () {\n                throw a.get()\n            },\n            {\n                onError(e) {\n                    errors.push(e)\n                }\n            }\n        )\n\n        a.set(2)\n        a.set(3)\n\n        expect(errors).toEqual([1, 2, 3])\n        d()\n\n        checkGlobalState()\n    })\n})\n\ntest(\"it should be possible to handle global errors in reactions\", () => {\n    utils.supressConsole(() => {\n        const a = mobx.observable.box(1)\n        const errors = []\n        const d2 = mobx.onReactionError(e => errors.push(e))\n\n        const d = mobx.autorun(function () {\n            throw a.get()\n        })\n\n        a.set(2)\n        a.set(3)\n\n        d2()\n        a.set(4)\n\n        expect(errors).toEqual([1, 2, 3])\n        d()\n\n        checkGlobalState()\n    })\n})\n\ntest(\"it should be possible to handle global errors in reactions - 2 - #1480\", () => {\n    utils.supressConsole(() => {\n        const a = mobx.observable.box(1)\n        const errors = []\n        const d2 = mobx.onReactionError(e => errors.push(e))\n\n        const d = mobx.reaction(\n            () => a.get(),\n            a => {\n                if (a >= 2) throw a\n            }\n        )\n\n        a.set(2)\n        a.set(3)\n\n        d2()\n        a.set(4)\n\n        expect(errors).toEqual([2, 3])\n        d()\n\n        checkGlobalState()\n    })\n})\n\ntest(\"global error handling will be skipped when using disableErrorBoundaries - 1\", () => {\n    utils.supressConsole(() => {\n        mobx.configure({ disableErrorBoundaries: true })\n        try {\n            mobx.observable.box(1)\n\n            expect(() => {\n                mobx.autorun(function () {\n                    throw \"OOPS\"\n                })\n            }).toThrow(/OOPS/)\n        } finally {\n            mobx.configure({ disableErrorBoundaries: false })\n            mobx._resetGlobalState()\n        }\n    })\n})\n\ntest(\"global error handling will be skipped when using disableErrorBoundaries - 2\", () => {\n    utils.supressConsole(() => {\n        mobx.configure({ disableErrorBoundaries: true })\n        try {\n            const a = mobx.observable.box(1)\n\n            const d = mobx.reaction(\n                () => a.get(),\n                () => {\n                    throw \"OOPS\"\n                }\n            )\n            expect(() => {\n                a.set(2)\n            }).toThrow(/OOPS/)\n\n            d()\n        } finally {\n            mobx.configure({ disableErrorBoundaries: false })\n            mobx._resetGlobalState()\n        }\n    })\n})\n\ntest(\"error in effect of when is properly cleaned up\", () => {\n    checkGlobalState()\n\n    const b = mobx.observable.box(1)\n    utils.supressConsole(() => {\n        mobx.when(\n            () => b.get() === 2,\n            () => {\n                throw \"OOPS\"\n            }\n        )\n        b.set(2)\n    })\n\n    checkGlobalState()\n})\n\ndescribe(\"es5 compat warnings\", () => {\n    beforeEach(() => {\n        mobx.configure({\n            useProxies: \"ifavailable\"\n        })\n    })\n\n    test(\"adding / deleting property\", () => {\n        const x = observable({\n            z: 0\n        })\n\n        expect(() => {\n            x.y = 2\n        }).toThrowErrorMatchingInlineSnapshot(\n            `\"[MobX] MobX is currently configured to be able to run in ES5 mode, but in ES5 MobX won't be able to add a new observable property through direct assignment. Use 'set' from 'mobx' instead.\"`\n        )\n\n        expect(() => {\n            delete x.z\n        }).toThrowErrorMatchingInlineSnapshot(\n            `\"[MobX] MobX is currently configured to be able to run in ES5 mode, but in ES5 MobX won't be able to delete properties from an observable object. Use 'remove' from 'mobx' instead.\"`\n        )\n    })\n\n    test(\"iterating props\", () => {\n        const x = observable({\n            z: 0\n        })\n\n        expect(() => {\n            \"z\" in x\n        }).not.toThrow()\n\n        let e\n        autorun(() => {\n            try {\n                \"z\" in x\n            } catch (err) {\n                e = err\n            }\n        })\n        expect(e).toMatchInlineSnapshot(\n            `[Error: [MobX] MobX is currently configured to be able to run in ES5 mode, but in ES5 MobX won't be able to detect new properties using the 'in' operator. Use 'has' from 'mobx' instead.]`\n        )\n\n        e = undefined\n\n        expect(() => {\n            Object.getOwnPropertyNames(x)\n        }).not.toThrow()\n        autorun(() => {\n            try {\n                Object.getOwnPropertyNames(x)\n            } catch (err) {\n                e = err\n            }\n        })\n        expect(e).toMatchInlineSnapshot(\n            `[Error: [MobX] MobX is currently configured to be able to run in ES5 mode, but in ES5 MobX won't be able to iterate keys to detect added / removed properties. Use 'keys' from 'mobx' instead.]`\n        )\n    })\n\n    afterEach(() => {\n        mobx._resetGlobalState()\n        mobx.configure({\n            useProxies: \"always\"\n        })\n    })\n})\n\ntest(\"should throw when adding properties in ES5 compat mode\", () => {})\n"
  },
  {
    "path": "packages/mobx/__tests__/v5/base/extendObservable.js",
    "content": "// @ts-check\n\nimport {\n    action,\n    autorun,\n    isObservable,\n    isObservableProp,\n    isComputedProp,\n    isAction,\n    extendObservable,\n    observable,\n    reaction\n} from \"../../../src/mobx\"\n\ntest(\"extendObservable should work\", function () {\n    class Box {\n        // @ts-ignore\n        uninitialized\n        height = 20\n        sizes = [2]\n        someFunc = function () {\n            return 2\n        }\n        get width() {\n            return (\n                this.undeclared *\n                this.height *\n                this.sizes.length *\n                this.someFunc() *\n                (this.uninitialized ? 2 : 1)\n            )\n        }\n        addSize() {\n            // @ts-ignore\n            this.sizes.push([3])\n            // @ts-ignore\n            this.sizes.push([4])\n        }\n        constructor() {\n            this.undeclared = 1\n        }\n    }\n\n    const box = new Box()\n\n    extendObservable(box, {\n        height: 20,\n        sizes: [2],\n        get someFunc() {\n            return 2\n        },\n        width: 40\n    })\n\n    expect(isObservableProp(box, \"height\")).toBe(true)\n    expect(isObservableProp(box, \"sizes\")).toBe(true)\n    expect(isObservable(box.sizes)).toBe(true)\n    expect(isObservableProp(box, \"someFunc\")).toBe(true)\n    expect(isComputedProp(box, \"someFunc\")).toBe(true)\n    expect(isObservableProp(box, \"width\")).toBe(true)\n\n    const ar = []\n\n    autorun(() => {\n        ar.push(box.width)\n    })\n\n    expect(ar.slice()).toEqual([40])\n})\n\ntest(\"extendObservable should work with plain object\", function () {\n    const box = {\n        /** @type {boolean | undefined} */\n        uninitialized: undefined,\n        height: 20,\n        sizes: [2],\n        someFunc: function () {\n            return 2\n        },\n        get width() {\n            return (\n                this.undeclared *\n                this.height *\n                this.sizes.length *\n                this.someFunc() *\n                (this.uninitialized ? 2 : 1)\n            )\n        },\n        addSize() {\n            // @ts-ignore\n            this.sizes.push([3])\n            // @ts-ignore\n            this.sizes.push([4])\n        }\n    }\n\n    box.undeclared = 1\n\n    extendObservable(box, {\n        height: 20,\n        sizes: [2],\n        get someFunc() {\n            return 2\n        },\n        width: 40\n    })\n\n    expect(isObservableProp(box, \"height\")).toBe(true)\n    expect(isObservableProp(box, \"sizes\")).toBe(true)\n    expect(isObservable(box.sizes)).toBe(true)\n    expect(isObservableProp(box, \"someFunc\")).toBe(true)\n    expect(isComputedProp(box, \"someFunc\")).toBe(true)\n    expect(isObservableProp(box, \"width\")).toBe(true)\n\n    const ar = []\n\n    autorun(() => {\n        ar.push(box.width)\n    })\n\n    expect(ar.slice()).toEqual([40])\n})\n\ntest(\"extendObservable should apply specified decorators\", function () {\n    const box = {\n        /** @type {boolean | undefined} */\n        uninitialized: undefined,\n        height: 20,\n        sizes: [2],\n        someFunc: function () {\n            return 2\n        },\n        get width() {\n            return (\n                this.undeclared *\n                this.height *\n                this.sizes.length *\n                this.someFunc() *\n                (this.uninitialized ? 2 : 1)\n            )\n        },\n        addSize() {\n            // @ts-ignore\n            this.sizes.push([3])\n            // @ts-ignore\n            this.sizes.push([4])\n        }\n    }\n\n    box.undeclared = 1\n    extendObservable(\n        box,\n        {\n            someFunc: function () {\n                return 2\n            }\n        },\n        // @ts-ignore\n        { someFunc: action }\n    )\n\n    expect(isAction(box.someFunc)).toBe(true)\n    expect(box.someFunc()).toEqual(2)\n})\n\ntest(\"extendObservable notifies about added keys\", () => {\n    let reactionCalled = false\n    const o = observable({})\n    const disposeReaction = reaction(\n        () => Object.keys(o),\n        () => (reactionCalled = true)\n    )\n    extendObservable(o, { x: 0 })\n    expect(reactionCalled).toBe(true)\n    disposeReaction()\n})\n"
  },
  {
    "path": "packages/mobx/__tests__/v5/base/extras.js",
    "content": "const mobx = require(\"../../../src/mobx.ts\")\nconst m = mobx\n\nconst { $mobx } = mobx\n\ntest(\"treeD\", function () {\n    m._resetGlobalState()\n    mobx._getGlobalState().mobxGuid = 0\n    const a = m.observable.box(3)\n    const aName = \"ObservableValue@1\"\n\n    const dtree = m.getDependencyTree\n    expect(dtree(a)).toEqual({\n        name: aName\n    })\n\n    const b = m.computed(() => a.get() * a.get())\n    const bName = \"ComputedValue@2\"\n    expect(dtree(b)).toEqual({\n        name: bName\n        // no dependencies yet, since it isn't observed yet\n    })\n\n    const c = m.autorun(() => b.get())\n    const cName = \"Autorun@3\"\n    expect(dtree(c[$mobx])).toEqual({\n        name: cName,\n        dependencies: [\n            {\n                name: bName,\n                dependencies: [\n                    {\n                        name: aName\n                    }\n                ]\n            }\n        ]\n    })\n\n    expect(aName !== bName).toBeTruthy()\n    expect(bName !== cName).toBeTruthy()\n\n    expect(m.getObserverTree(a)).toEqual({\n        name: aName,\n        observers: [\n            {\n                name: bName,\n                observers: [\n                    {\n                        name: cName\n                    }\n                ]\n            }\n        ]\n    })\n\n    const x = mobx.observable.map({ temperature: 0 })\n    const d = mobx.autorun(function () {\n        Array.from(x.keys())\n        if (x.has(\"temperature\")) x.get(\"temperature\")\n        x.has(\"absent\")\n    })\n\n    expect(m.getDependencyTree(d[$mobx])).toEqual({\n        name: \"Autorun@5\",\n        dependencies: [\n            {\n                name: \"ObservableMap@4.keys()\"\n            },\n            {\n                name: \"ObservableMap@4.temperature?\"\n            },\n            {\n                name: \"ObservableMap@4.temperature\"\n            },\n            {\n                name: \"ObservableMap@4.absent?\"\n            }\n        ]\n    })\n})\n\ntest(\"names\", function () {\n    m._resetGlobalState()\n    mobx._getGlobalState().mobxGuid = 0\n\n    const struct = {\n        x: \"ObservableValue@1\",\n        y: {\n            z: 7\n        },\n        ar: [\n            4,\n            {\n                w: 5\n            }\n        ]\n    }\n\n    const rstruct = m.observable(struct)\n    m.extendObservable(rstruct.y, { a: { b: 2 } })\n    rstruct.ar.push({ b: 2 })\n    rstruct.ar.push([])\n    expect(rstruct[$mobx].values_.get(\"x\").name_).toBe(\"ObservableObject@1.x\")\n    expect(rstruct[$mobx].values_.get(\"y\").name_).toBe(\"ObservableObject@1.y\")\n    expect(rstruct.y[$mobx].values_.get(\"z\").name_).toBe(\"ObservableObject@1.y.z\")\n    expect(rstruct[$mobx].values_.get(\"ar\").name_).toBe(\"ObservableObject@1.ar\")\n    expect(rstruct.ar[$mobx].atom_.name_).toBe(\"ObservableObject@1.ar\")\n    expect(rstruct.ar[1][$mobx].values_.get(\"w\").name_).toBe(\"ObservableObject@1.ar[..].w\")\n    expect(rstruct.y.a[$mobx].values_.get(\"b\").name_).toBe(\"ObservableObject@1.y.a.b\")\n    expect(rstruct.ar[2][$mobx].values_.get(\"b\").name_).toBe(\"ObservableObject@1.ar[..].b\")\n\n    const d = m.autorun(function () {})\n    expect(d[$mobx].name_).toBeTruthy()\n\n    expect(m.autorun(function namedFunction() {})[$mobx].name_).toBe(\"namedFunction\")\n\n    expect(m.computed(function () {})).toBeTruthy()\n\n    expect(m.computed(function namedFunction() {}).name_).toBe(\"namedFunction\")\n\n    function Task() {\n        m.extendObservable(this, {\n            title: \"test\"\n        })\n    }\n\n    const task = new Task()\n    expect(task[$mobx].name_).toBe(\"Task@4\")\n    expect(task[$mobx].values_.get(\"title\").name_).toBe(\"Task@4.title\")\n})\n\nfunction stripTrackerOutput(output) {\n    return output.map(function (i) {\n        if (Array.isArray(i)) return stripTrackerOutput(i)\n        delete i.object\n        delete i.time\n        delete i.fn\n        return i\n    })\n}\n\ntest(\"spy 1\", function () {\n    m._resetGlobalState()\n    const lines = []\n\n    const a = m.observable.box(3)\n    const b = m.computed(function () {\n        return a.get() * 2\n    })\n    m.autorun(function () {\n        b.get()\n    })\n    const stop = m.spy(function (line) {\n        lines.push(line)\n    })\n\n    a.set(4)\n    stop()\n    a.set(5)\n    expect(stripTrackerOutput(lines)).toMatchSnapshot()\n})\n\ntest(\"get atom\", function () {\n    mobx._resetGlobalState()\n    mobx._getGlobalState().mobxGuid = 0 // hmm dangerous reset?\n\n    function Clazz() {\n        mobx.extendObservable(this, {\n            a: 17\n        })\n    }\n\n    const a = mobx.observable.box(3)\n    const b = mobx.observable({ a: 3 })\n    const c = mobx.observable.map({ a: 3 })\n    const d = mobx.observable([1, 2])\n    const e = mobx.computed(() => 3)\n    const f = mobx.autorun(() => c.has(\"b\"))\n    const g = new Clazz()\n\n    function atom(thing, prop) {\n        return mobx.getAtom(thing, prop).constructor.name_\n    }\n\n    const ovClassName = mobx.observable.box(3).constructor.name_\n    const atomClassName = mobx.createAtom(\"test\").constructor.name_\n    // const reactionClassName = mobx.Reaction.name_\n\n    expect(atom(a)).toBe(ovClassName)\n\n    expect(atom(b, \"a\")).toBe(ovClassName)\n    expect(() => atom(b)).toThrow(/please specify a property/)\n    expect(() => atom(b, \"b\")).toThrow(\n        /no observable property 'b' found on the observable object 'ObservableObject@2'/\n    )\n\n    expect(atom(c)).toBe(atomClassName) // returns ke, \"bla\".constructor, === \"Atomys\n    expect(atom(c, \"a\")).toBe(ovClassName) // returns ent, \"bla\".constructor, === \"Atomry\n    expect(atom(c, \"b\")).toBe(ovClassName) // returns has entry (see autoru, \"bla\", \"Atomn)\n    expect(() => atom(c, \"c\")).toThrow(\n        /the entry 'c' does not exist in the observable map 'ObservableMap@3'/\n    )\n\n    expect(atom(d)).toBe(atomClassName)\n    expect(() => atom(d, 0)).toThrow(/It is not possible to get index atoms from arrays/)\n\n    expect(atom(e)).toBe(mobx.computed(() => {}).constructor.name_)\n    expect(atom(f)).toBe(mobx.Reaction.name_)\n\n    expect(() => atom(g)).toThrow(/please specify a property/)\n    expect(atom(g, \"a\")).toBe(ovClassName)\n\n    f()\n})\n\ntest(\"get debug name\", function () {\n    mobx._resetGlobalState()\n    mobx._getGlobalState().mobxGuid = 0 // hmm dangerous reset?\n\n    function Clazz() {\n        mobx.extendObservable(this, {\n            a: 17\n        })\n    }\n\n    const a = mobx.observable.box(3)\n    const b = mobx.observable({ a: 3 })\n    const c = mobx.observable.map({ a: 3 })\n    const d = mobx.observable([1, 2])\n    const e = mobx.computed(() => 3)\n    const f = mobx.autorun(() => c.has(\"b\"))\n    const g = new Clazz()\n\n    function name(thing, prop) {\n        return mobx.getDebugName(thing, prop)\n    }\n\n    expect(name(a)).toBe(\"ObservableValue@1\")\n\n    expect(name(b, \"a\")).toBe(\"ObservableObject@2.a\")\n    expect(() => name(b, \"b\")).toThrow(\n        /no observable property 'b' found on the observable object 'ObservableObject@2'/\n    )\n\n    expect(name(c)).toBe(\"ObservableMap@3\") // returns ke, \"bla\"ys\n    expect(name(c, \"a\")).toBe(\"ObservableMap@3.a\") // returns ent, \"bla\"ry\n    expect(name(c, \"b\")).toBe(\"ObservableMap@3.b?\") // returns has entry (see autoru, \"bla\"n)\n    expect(() => name(c, \"c\")).toThrow(\n        /the entry 'c' does not exist in the observable map 'ObservableMap@3'/\n    )\n\n    expect(name(d)).toBe(\"ObservableArray@4\")\n    expect(() => name(d, 0)).toThrow(/It is not possible to get index atoms from arrays/)\n\n    expect(name(e)).toBe(\"ComputedValue@5\")\n    expect(name(f)).toBe(\"Autorun@6\")\n\n    expect(name(g)).toBe(\"Clazz@7\")\n    expect(name(g, \"a\")).toBe(\"Clazz@7.a\")\n\n    f()\n})\n\ntest(\"get administration\", function () {\n    mobx._resetGlobalState()\n    mobx._getGlobalState().mobxGuid = 0 // hmm dangerous reset?\n\n    function Clazz() {\n        mobx.extendObservable(this, {\n            a: 17\n        })\n    }\n\n    const a = mobx.observable.box(3)\n    const b = mobx.observable({ a: 3 })\n    const c = mobx.observable.map({ a: 3 })\n    const d = mobx.observable([1, 2])\n    const e = mobx.computed(() => 3)\n    const f = mobx.autorun(() => c.has(\"b\"))\n    const g = new Clazz()\n    const h = {}\n    mobx.extendObservable(h, { a: 3 })\n\n    function adm(thing, prop) {\n        return mobx._getAdministration(thing, prop).constructor.name_\n    }\n\n    const ovClassName = mobx.observable.box(3).constructor.name_\n    const mapClassName = mobx.observable.map().constructor.name_\n\n    expect(adm(a)).toBe(ovClassName)\n\n    expect(adm(b, \"a\")).toBe(ovClassName)\n    expect(adm(b)).toBe(b[$mobx].constructor.name_)\n    expect(() => adm(b, \"b\")).toThrow(\n        /no observable property 'b' found on the observable object 'ObservableObject@2'/\n    )\n    expect(adm(h, \"a\")).toBe(ovClassName)\n    expect(adm(h)).toBe(h[$mobx].constructor.name_)\n    expect(() => adm(h, \"b\")).toThrow(\n        /no observable property 'b' found on the observable object 'ObservableObject@8'/\n    )\n\n    expect(adm(c)).toBe(mapClassName)\n    expect(adm(c, \"a\")).toBe(ovClassName)\n    expect(adm(c, \"b\")).toBe(ovClassName)\n    expect(() => adm(c, \"c\")).toThrow(\n        /the entry 'c' does not exist in the observable map 'ObservableMap@3'/\n    )\n\n    expect(adm(d)).toBe(d[$mobx].constructor.name_)\n    expect(() => adm(d, 0)).toThrow(/It is not possible to get index atoms from arrays/)\n\n    expect(adm(e)).toBe(mobx.computed(() => {}).constructor.name_)\n    expect(adm(f)).toBe(mobx.Reaction.name_)\n\n    expect(adm(g)).toBe(h[$mobx].constructor.name_)\n    expect(adm(g, \"a\")).toBe(ovClassName)\n})\n\ntest(\"onBecome(Un)Observed simple\", () => {\n    const x = mobx.observable.box(3)\n    const events = []\n\n    mobx.onBecomeObserved(x, () => {\n        events.push(\"x observed\")\n    })\n    mobx.onBecomeUnobserved(x, () => {\n        events.push(\"x unobserved\")\n    })\n\n    expect(events.length).toBe(0) // nothing happened yet\n    x.get()\n    expect(events.length).toBe(0) // nothing happened yet\n    x.set(4)\n    expect(events.length).toBe(0) // nothing happened yet\n\n    const d5 = mobx.reaction(\n        () => x.get(),\n        () => {}\n    )\n    expect(events.length).toBe(1)\n    expect(events).toEqual([\"x observed\"])\n\n    d5()\n    expect(events.length).toBe(2)\n    expect(events).toEqual([\"x observed\", \"x unobserved\"])\n})\n\ntest(\"onBecome(Un)Observed - less simple\", () => {\n    const x = mobx.observable({\n        a: 3,\n        get b() {\n            return this.a * 2\n        }\n    })\n    const events = []\n\n    const d1 = mobx.onBecomeObserved(x, \"a\", () => {\n        events.push(\"a observed\")\n    })\n    const d2 = mobx.onBecomeUnobserved(x, \"a\", () => {\n        events.push(\"a unobserved\")\n    })\n    const d3 = mobx.onBecomeObserved(x, \"b\", () => {\n        events.push(\"b observed\")\n    })\n    const d4 = mobx.onBecomeUnobserved(x, \"b\", () => {\n        events.push(\"b unobserved\")\n    })\n\n    x.b\n    x.a = 4\n\n    expect(events.length).toBe(0) // nothing happened yet\n\n    const d5 = mobx.reaction(\n        () => x.b,\n        () => {}\n    )\n    expect(events.length).toBe(2)\n    expect(events).toEqual([\"b observed\", \"a observed\"])\n\n    const d6 = mobx.reaction(\n        () => x.b,\n        () => {}\n    )\n    expect(events.length).toBe(2)\n\n    d5()\n    expect(events.length).toBe(2)\n    d6()\n    expect(events.length).toBe(4)\n    expect(events).toEqual([\"b observed\", \"a observed\", \"b unobserved\", \"a unobserved\"])\n\n    d1()\n    d2()\n    d3()\n    d4()\n    events.splice(0)\n    const d7 = mobx.reaction(\n        () => x.b,\n        () => {}\n    )\n    d7()\n    expect(events.length).toBe(0)\n})\n\ntest(\"onBecomeObserved correctly disposes second listener #1537\", () => {\n    const x = mobx.observable.box(3)\n    const events = []\n    const d1 = mobx.onBecomeObserved(x, \"a\", () => {\n        events.push(\"a observed\")\n    })\n    mobx.onBecomeObserved(x, \"b\", () => {\n        events.push(\"b observed\")\n    })\n    d1()\n    mobx.reaction(\n        () => x.get(),\n        () => {}\n    )\n    expect(events.length).toBe(1)\n    expect(events).toEqual([\"b observed\"])\n})\n\ntest(\"onBecomeObserved correctly disposes second listener #1537\", () => {\n    const x = mobx.observable.box(3)\n    const events = []\n    const d1 = mobx.onBecomeObserved(x, \"a\", () => {\n        events.push(\"a observed\")\n    })\n    const d2 = mobx.onBecomeObserved(x, \"b\", () => {\n        events.push(\"b observed\")\n    })\n    d1()\n    const d3 = mobx.reaction(\n        () => x.get(),\n        () => {}\n    )\n    d3()\n    expect(events.length).toBe(1)\n    expect(events).toEqual([\"b observed\"])\n    d2()\n    mobx.reaction(\n        () => x.get(),\n        () => {}\n    )\n    expect(events).toEqual([\"b observed\"])\n})\n\ntest(\"onBecomeUnobserved correctly disposes second listener #1537\", () => {\n    const x = mobx.observable.box(3)\n    const events = []\n    const d1 = mobx.onBecomeUnobserved(x, \"a\", () => {\n        events.push(\"a unobserved\")\n    })\n    const d2 = mobx.onBecomeUnobserved(x, \"b\", () => {\n        events.push(\"b unobserved\")\n    })\n    d1()\n    const d3 = mobx.reaction(\n        () => x.get(),\n        () => {}\n    )\n    d3()\n    expect(events.length).toBe(1)\n    expect(events).toEqual([\"b unobserved\"])\n    d2()\n    mobx.reaction(\n        () => x.get(),\n        () => {}\n    )\n    expect(events).toEqual([\"b unobserved\"])\n})\n\ntest(\"deepEquals should yield correct results for complex objects #1118 - 1\", () => {\n    const d2016jan1 = new Date(\"2016-01-01\")\n    const d2016jan1_2 = new Date(\"2016-01-01\")\n    const d2017jan1 = new Date(\"2017-01-01\")\n\n    expect(d2016jan1).toEqual(d2016jan1_2)\n    expect(d2016jan1).not.toEqual(d2017jan1)\n    expect(mobx.comparer.structural(d2016jan1, d2016jan1)).toBe(true)\n    expect(mobx.comparer.structural(d2016jan1, d2017jan1)).toBe(false)\n    expect(mobx.comparer.structural(d2016jan1, d2016jan1_2)).toBe(true)\n})\n\ntest(\"deepEquals should yield correct results for complex objects #1118 - 2\", () => {\n    class A {\n        x = 3\n        y = 4\n\n        constructor(x) {\n            this.x = x\n        }\n    }\n\n    const a1 = new A(2)\n    const a2 = new A(2)\n    const a3 = new A(3)\n    const a4 = new A(2)\n    a4.z = 2\n\n    expect(a1).toEqual(a2)\n    expect(a1).not.toEqual(a3)\n    expect(mobx.comparer.structural(a1, a1)).toBe(true)\n    expect(mobx.comparer.structural(a1, a3)).toBe(false)\n    expect(mobx.comparer.structural(a1, a2)).toBe(true)\n    expect(mobx.comparer.structural(a1, a4)).toBe(false)\n})\n\ntest(\"comparer.shallow should require types to be equal\", () => {\n    const sh = mobx.comparer.shallow\n    const obs = mobx.observable\n\n    expect(sh({}, {})).toBe(true)\n    expect(sh({}, [])).toBe(false)\n    expect(sh({}, new Set())).toBe(false)\n    expect(sh({}, new Map())).toBe(false)\n    expect(sh({}, obs({}))).toBe(true)\n    expect(sh({}, obs([]))).toBe(false)\n    expect(sh({}, obs(new Set()))).toBe(false)\n    expect(sh({}, obs(new Map()))).toBe(false)\n\n    expect(sh([], {})).toBe(false)\n    expect(sh([], [])).toBe(true)\n    expect(sh([], new Set())).toBe(false)\n    expect(sh([], new Map())).toBe(false)\n    expect(sh([], obs({}))).toBe(false)\n    expect(sh([], obs([]))).toBe(true)\n    expect(sh([], obs(new Set()))).toBe(false)\n    expect(sh([], obs(new Map()))).toBe(false)\n\n    expect(sh(new Set(), {})).toBe(false)\n    expect(sh(new Set(), [])).toBe(false)\n    expect(sh(new Set(), new Set())).toBe(true)\n    expect(sh(new Set(), new Map())).toBe(false)\n    expect(sh(new Set(), obs({}))).toBe(false)\n    expect(sh(new Set(), obs([]))).toBe(false)\n    expect(sh(new Set(), obs(new Set()))).toBe(true)\n    expect(sh(new Set(), obs(new Map()))).toBe(false)\n\n    expect(sh(new Map(), {})).toBe(false)\n    expect(sh(new Map(), [])).toBe(false)\n    expect(sh(new Map(), new Set())).toBe(false)\n    expect(sh(new Map(), new Map())).toBe(true)\n    expect(sh(new Map(), obs({}))).toBe(false)\n    expect(sh(new Map(), obs([]))).toBe(false)\n    expect(sh(new Map(), obs(new Set()))).toBe(false)\n    expect(sh(new Map(), obs(new Map()))).toBe(true)\n\n    expect(sh(obs({}), {})).toBe(true)\n    expect(sh(obs({}), [])).toBe(false)\n    expect(sh(obs({}), new Set())).toBe(false)\n    expect(sh(obs({}), new Map())).toBe(false)\n    expect(sh(obs({}), obs({}))).toBe(true)\n    expect(sh(obs({}), obs([]))).toBe(false)\n    expect(sh(obs({}), obs(new Set()))).toBe(false)\n    expect(sh(obs({}), obs(new Map()))).toBe(false)\n\n    expect(sh(obs([]), {})).toBe(false)\n    expect(sh(obs([]), [])).toBe(true)\n    expect(sh(obs([]), new Set())).toBe(false)\n    expect(sh(obs([]), new Map())).toBe(false)\n    expect(sh(obs([]), obs({}))).toBe(false)\n    expect(sh(obs([]), obs([]))).toBe(true)\n    expect(sh(obs([]), obs(new Set()))).toBe(false)\n    expect(sh(obs([]), obs(new Map()))).toBe(false)\n\n    expect(sh(obs(new Set()), {})).toBe(false)\n    expect(sh(obs(new Set()), [])).toBe(false)\n    expect(sh(obs(new Set()), new Set())).toBe(true)\n    expect(sh(obs(new Set()), new Map())).toBe(false)\n    expect(sh(obs(new Set()), obs({}))).toBe(false)\n    expect(sh(obs(new Set()), obs([]))).toBe(false)\n    expect(sh(obs(new Set()), obs(new Set()))).toBe(true)\n    expect(sh(obs(new Set()), obs(new Map()))).toBe(false)\n\n    expect(sh(obs(new Map()), {})).toBe(false)\n    expect(sh(obs(new Map()), [])).toBe(false)\n    expect(sh(obs(new Map()), new Set())).toBe(false)\n    expect(sh(obs(new Map()), new Map())).toBe(true)\n    expect(sh(obs(new Map()), obs({}))).toBe(false)\n    expect(sh(obs(new Map()), obs([]))).toBe(false)\n    expect(sh(obs(new Map()), obs(new Set()))).toBe(false)\n    expect(sh(obs(new Map()), obs(new Map()))).toBe(true)\n})\ntest(\"comparer.shallow should work\", () => {\n    const sh = mobx.comparer.shallow\n    const obs = mobx.observable\n\n    expect(sh(1, 1)).toBe(true)\n    expect(sh(1, 2)).toBe(false)\n\n    // Object tests\n    expect(sh({ a: 1, b: 2 }, { a: 1, b: 2 })).toBe(true)\n    expect(sh({ a: 1, b: 2 }, { b: 2, a: 1 })).toBe(true) // order does not matter\n\n    expect(sh({ a: 1, b: 2 }, { c: 1, b: 2 })).toBe(false)\n    expect(sh({ a: 1, b: 2 }, { a: 3, b: 2 })).toBe(false)\n    expect(sh({ a: 1, b: 2 }, { a: 1, c: 2 })).toBe(false)\n    expect(sh({ a: 1, b: 2 }, { a: 1, b: 3 })).toBe(false)\n    expect(sh({ a: 1, b: 2 }, { a: 1 })).toBe(false)\n    expect(sh({ a: 1 }, { a: 1, b: 2 })).toBe(false)\n    expect(sh({ a: {} }, { a: {} })).toBe(false)\n\n    // Observable tests\n    expect(sh(obs({ a: 1, b: 2 }), obs({ a: 1, b: 2 }))).toBe(true)\n    expect(sh(obs({ a: 1, b: 2 }), obs({ b: 2, a: 1 }))).toBe(true) // order does not matter\n\n    expect(sh(obs({ a: 1, b: 2 }), obs({ c: 1, b: 2 }))).toBe(false)\n    expect(sh(obs({ a: 1, b: 2 }), obs({ a: 3, b: 2 }))).toBe(false)\n    expect(sh(obs({ a: 1, b: 2 }), obs({ a: 1, c: 2 }))).toBe(false)\n    expect(sh(obs({ a: 1, b: 2 }), obs({ a: 1, b: 3 }))).toBe(false)\n    expect(sh(obs({ a: 1, b: 2 }), obs({ a: 1 }))).toBe(false)\n    expect(sh(obs({ a: 1 }), obs({ a: 1, b: 2 }))).toBe(false)\n    expect(sh(obs({ a: {} }), obs({ a: {} }))).toBe(false)\n\n    // Array tests\n    expect(sh([1, 2], [1, 2])).toBe(true)\n\n    expect(sh([1, 2], [3, 2])).toBe(false)\n    expect(sh([1, 2], [1, 3])).toBe(false)\n    expect(sh([1, 2], [1])).toBe(false)\n    expect(sh([1], [1, 2])).toBe(false)\n    expect(sh([{}, 2], [{}, 2])).toBe(false)\n\n    // ObservableArray tests\n    expect(sh(obs([1, 2]), obs([1, 2]))).toBe(true)\n\n    expect(sh(obs([1, 2]), obs([3, 2]))).toBe(false)\n    expect(sh(obs([1, 2]), obs([1, 3]))).toBe(false)\n    expect(sh(obs([1, 2]), obs([1]))).toBe(false)\n    expect(sh(obs([1]), obs([1, 2]))).toBe(false)\n    expect(sh(obs([{}, 2]), obs([{}, 2]))).toBe(false)\n\n    // Set tests\n    expect(sh(new Set([1, 2]), new Set([1, 2]))).toBe(true)\n\n    expect(sh(new Set([1, 2]), new Set([2, 1]))).toBe(false) // order matters\n    expect(sh(new Set([1, 2]), new Set([3, 2]))).toBe(false)\n    expect(sh(new Set([1, 2]), new Set([1, 3]))).toBe(false)\n    expect(sh(new Set([1, 2]), new Set([1]))).toBe(false)\n    expect(sh(new Set([1]), new Set([1, 2]))).toBe(false)\n    expect(sh(new Set([{}]), new Set([{}]))).toBe(false)\n\n    // ObservableSet tests\n    expect(sh(obs(new Set([1, 2])), obs(new Set([1, 2])))).toBe(true)\n\n    expect(sh(obs(new Set([1, 2])), obs(new Set([2, 1])))).toBe(false) // order matters\n    expect(sh(obs(new Set([1, 2])), obs(new Set([3, 2])))).toBe(false)\n    expect(sh(obs(new Set([1, 2])), obs(new Set([1, 3])))).toBe(false)\n    expect(sh(obs(new Set([1, 2])), obs(new Set([1])))).toBe(false)\n    expect(sh(obs(new Set([1])), obs(new Set([1, 2])))).toBe(false)\n    expect(sh(obs(new Set([{}])), obs(new Set([{}])))).toBe(false)\n\n    // Map tests\n    expect(\n        sh(\n            new Map([\n                [\"a\", 1],\n                [\"b\", 2]\n            ]),\n            new Map([\n                [\"a\", 1],\n                [\"b\", 2]\n            ])\n        )\n    ).toBe(true)\n\n    expect(\n        sh(\n            new Map([\n                [\"a\", 1],\n                [\"b\", 2]\n            ]),\n            new Map([\n                [\"b\", 2],\n                [\"a\", 1]\n            ])\n        )\n    ).toBe(false) // order matters\n    expect(\n        sh(\n            new Map([\n                [\"a\", 1],\n                [\"b\", 2]\n            ]),\n            new Map([\n                [\"c\", 1],\n                [\"b\", 2]\n            ])\n        )\n    ).toBe(false)\n    expect(\n        sh(\n            new Map([\n                [\"a\", 1],\n                [\"b\", 2]\n            ]),\n            new Map([\n                [\"a\", 3],\n                [\"b\", 2]\n            ])\n        )\n    ).toBe(false)\n    expect(\n        sh(\n            new Map([\n                [\"a\", 1],\n                [\"b\", 2]\n            ]),\n            new Map([\n                [\"a\", 1],\n                [\"c\", 2]\n            ])\n        )\n    ).toBe(false)\n    expect(\n        sh(\n            new Map([\n                [\"a\", 1],\n                [\"b\", 2]\n            ]),\n            new Map([\n                [\"a\", 1],\n                [\"b\", 3]\n            ])\n        )\n    ).toBe(false)\n    expect(\n        sh(\n            new Map([\n                [\"a\", 1],\n                [\"b\", 2]\n            ]),\n            new Map([[\"a\", 1]])\n        )\n    ).toBe(false)\n    expect(\n        sh(\n            new Map([[\"a\", 1]]),\n            new Map([\n                [\"a\", 1],\n                [\"b\", 2]\n            ])\n        )\n    ).toBe(false)\n    expect(sh(new Map([[{}, 1]]), new Map([[{}, 1]]))).toBe(false)\n    expect(sh(new Map([[\"a\", {}]]), new Map([[\"a\", {}]]))).toBe(false)\n\n    // ObservableMap tests\n    expect(\n        sh(\n            obs(\n                new Map([\n                    [\"a\", 1],\n                    [\"b\", 2]\n                ])\n            ),\n            obs(\n                new Map([\n                    [\"a\", 1],\n                    [\"b\", 2]\n                ])\n            )\n        )\n    ).toBe(true)\n\n    expect(\n        sh(\n            obs(\n                new Map([\n                    [\"a\", 1],\n                    [\"b\", 2]\n                ])\n            ),\n            obs(\n                new Map([\n                    [\"b\", 2],\n                    [\"a\", 1]\n                ])\n            )\n        )\n    ).toBe(false) // order matters\n    expect(\n        sh(\n            obs(\n                new Map([\n                    [\"a\", 1],\n                    [\"b\", 2]\n                ])\n            ),\n            obs(\n                new Map([\n                    [\"c\", 1],\n                    [\"b\", 2]\n                ])\n            )\n        )\n    ).toBe(false)\n    expect(\n        sh(\n            obs(\n                new Map([\n                    [\"a\", 1],\n                    [\"b\", 2]\n                ])\n            ),\n            obs(\n                new Map([\n                    [\"a\", 3],\n                    [\"b\", 2]\n                ])\n            )\n        )\n    ).toBe(false)\n    expect(\n        sh(\n            obs(\n                new Map([\n                    [\"a\", 1],\n                    [\"b\", 2]\n                ])\n            ),\n            obs(\n                new Map([\n                    [\"a\", 1],\n                    [\"c\", 2]\n                ])\n            )\n        )\n    ).toBe(false)\n    expect(\n        sh(\n            obs(\n                new Map([\n                    [\"a\", 1],\n                    [\"b\", 2]\n                ])\n            ),\n            obs(\n                new Map([\n                    [\"a\", 1],\n                    [\"b\", 3]\n                ])\n            )\n        )\n    ).toBe(false)\n    expect(\n        sh(\n            obs(\n                new Map([\n                    [\"a\", 1],\n                    [\"b\", 2]\n                ])\n            ),\n            obs(new Map([[\"a\", 1]]))\n        )\n    ).toBe(false)\n    expect(\n        sh(\n            obs(new Map([[\"a\", 1]])),\n            obs(\n                new Map([\n                    [\"a\", 1],\n                    [\"b\", 2]\n                ])\n            )\n        )\n    ).toBe(false)\n    expect(sh(obs(new Map([[{}, 1]])), obs(new Map([[{}, 1]])))).toBe(false)\n    expect(sh(obs(new Map([[\"a\", {}]])), obs(new Map([[\"a\", {}]])))).toBe(false)\n})\n\ntest(\"getDebugName(action)\", () => {\n    expect(mobx.getDebugName(mobx.action(() => {}))).toBe(\"<unnamed action>\")\n    expect(mobx.getDebugName(mobx.action(function fn() {}))).toBe(\"fn\")\n    expect(mobx.getDebugName(mobx.action(\"custom\", function fn() {}))).toBe(\"custom\")\n})\n\ntest(\"Default debug names - development\", () => {\n    expect(mobx.getDebugName(mobx.observable({ x() {} }, { x: mobx.action }).x)).toBe(\"x\")\n    expect(/Atom@\\d+/.test(mobx.getDebugName(mobx.createAtom()))).toBe(true)\n    expect(/ComputedValue@\\d+/.test(mobx.getDebugName(mobx.computed(() => {})))).toBe(true)\n    expect(mobx.getDebugName(mobx.action(function fn() {}))).toBe(\"fn\")\n    expect(/ObservableObject@\\d+/.test(mobx.getDebugName(mobx.observable({})))).toBe(true)\n    expect(/ObservableObject@\\d+.x/.test(mobx.getDebugName(mobx.observable({ x: \"x\" }), \"x\"))).toBe(\n        true\n    )\n    expect(\n        /ObservableObject@\\d+.x/.test(mobx.getDebugName(mobx.observable({ get x() {} }), \"x\"))\n    ).toBe(true)\n    expect(/ObservableArray@\\d+/.test(mobx.getDebugName(mobx.observable([])))).toBe(true)\n    expect(\n        /ObservableArray@\\d+/.test(mobx.getDebugName(mobx.observable([], { proxy: false })))\n    ).toBe(true)\n    expect(/ObservableMap@\\d+/.test(mobx.getDebugName(mobx.observable(new Map())))).toBe(true)\n    expect(/ObservableSet@\\d+/.test(mobx.getDebugName(mobx.observable(new Set())))).toBe(true)\n    expect(/ObservableValue@\\d+/.test(mobx.getDebugName(mobx.observable(\"x\")))).toBe(true)\n    expect(\n        /Reaction@\\d+/.test(\n            mobx.getDebugName(\n                mobx.reaction(\n                    () => {},\n                    () => {}\n                )\n            )\n        )\n    ).toBe(true)\n    expect(/Autorun@\\d+/.test(mobx.getDebugName(mobx.autorun(() => {})))).toBe(true)\n})\n\ntest(\"Default debug names - production\", () => {\n    const mobx = require(`../../../dist/mobx.cjs.production.min.js`)\n\n    expect(mobx.getDebugName(mobx.observable({ x() {} }, { x: mobx.action }).x)).toBe(\"x\") // perhaps should be \"<unnamed action>\"??\n    expect(mobx.getDebugName(mobx.createAtom())).toBe(\"Atom\")\n    expect(mobx.getDebugName(mobx.computed(() => {}))).toBe(\"ComputedValue\")\n    expect(mobx.getDebugName(mobx.action(function fn() {}))).toBe(\"fn\")\n    expect(mobx.getDebugName(mobx.observable({}))).toBe(\"ObservableObject\")\n    expect(mobx.getDebugName(mobx.observable({ x: \"x\" }), \"x\")).toBe(\"ObservableObject.key\")\n    expect(mobx.getDebugName(mobx.observable({ get x() {} }), \"x\")).toBe(\"ObservableObject.key\")\n    expect(mobx.getDebugName(mobx.observable([]))).toBe(\"ObservableArray\")\n    expect(mobx.getDebugName(mobx.observable([], { proxy: false }))).toBe(\"ObservableArray\")\n    expect(mobx.getDebugName(mobx.observable(new Map()))).toBe(\"ObservableMap\")\n    expect(mobx.getDebugName(mobx.observable(new Set()))).toBe(\"ObservableSet\")\n    expect(mobx.getDebugName(mobx.observable(\"x\"))).toBe(\"ObservableValue\")\n    expect(\n        mobx.getDebugName(\n            mobx.reaction(\n                () => {},\n                () => {}\n            )\n        )\n    ).toBe(\"Reaction\")\n    expect(mobx.getDebugName(mobx.autorun(() => {}))).toBe(\"Autorun\")\n})\n\ntest(\"User provided debug names are always respected\", () => {\n    const mobxDevelopment = mobx\n    const mobxProduction = require(`../../../dist/mobx.cjs.production.min.js`)\n\n    const name = \"CustomName\"\n\n    ;[mobxDevelopment, mobxProduction].forEach(mobx => {\n        expect(mobx.getDebugName(mobx.action(name, function fn() {}))).toBe(name)\n        expect(mobx.getDebugName(mobx.createAtom(name))).toBe(name)\n        expect(mobx.getDebugName(mobx.computed(() => {}, { name }))).toBe(name)\n        expect(mobx.getDebugName(mobx.observable({}, {}, { name }))).toBe(name)\n        expect(mobx.getDebugName(mobx.observable([], { name }))).toBe(name)\n        expect(mobx.getDebugName(mobx.observable([], { name, proxy: false }))).toBe(name)\n        expect(mobx.getDebugName(mobx.observable(new Map(), { name }))).toBe(name)\n        expect(mobx.getDebugName(mobx.observable(new Set(), { name }))).toBe(name)\n        expect(mobx.getDebugName(mobx.observable(\"x\", { name }))).toBe(name)\n        expect(\n            mobx.getDebugName(\n                mobx.reaction(\n                    () => {},\n                    () => {},\n                    { name }\n                )\n            )\n        ).toBe(name)\n        expect(mobx.getDebugName(mobx.autorun(() => {}, { name }))).toBe(name)\n    })\n})\n"
  },
  {
    "path": "packages/mobx/__tests__/v5/base/flow.js",
    "content": "import * as mobx from \"../../../src/mobx\"\nimport {\n    flow,\n    FlowCancellationError,\n    isFlowCancellationError,\n    makeObservable\n} from \"../../../src/mobx\"\n\nfunction delay(time, value, shouldThrow = false) {\n    return new Promise((resolve, reject) => {\n        setTimeout(() => {\n            if (shouldThrow) reject(value)\n            else resolve(value)\n        }, time)\n    })\n}\n\ntest(\"it should support async generator actions\", done => {\n    mobx.configure({ enforceActions: \"observed\" })\n    const values = []\n    const x = mobx.observable({ a: 1 })\n    mobx.reaction(\n        () => x.a,\n        v => values.push(v),\n        { fireImmediately: true }\n    )\n\n    const f = mobx.flow(function* (initial) {\n        x.a = initial // this runs in action\n        x.a = yield delay(100, 3) // and this as well!\n        yield delay(100, 0)\n        x.a = 4\n        return x.a\n    })\n\n    setTimeout(() => {\n        f(2).then(v => {\n            // note: ideally, type of v should be inferred..\n            expect(v).toBe(4)\n            expect(values).toEqual([1, 2, 3, 4])\n            done()\n        })\n    }, 10)\n})\n\ntest(\"it should support try catch in async generator\", done => {\n    mobx.configure({ enforceActions: \"observed\" })\n    const values = []\n    const x = mobx.observable({ a: 1 })\n    mobx.reaction(\n        () => x.a,\n        v => values.push(v),\n        { fireImmediately: true }\n    )\n\n    const f = mobx.flow(function* (initial) {\n        x.a = initial // this runs in action\n        try {\n            x.a = yield delay(100, 5, true) // and this as well!\n            yield delay(100, 0)\n            x.a = 4\n        } catch (e) {\n            x.a = e\n        }\n        return x.a\n    })\n\n    setTimeout(() => {\n        f(2).then(v => {\n            // note: ideally, type of v should be inferred..\n            expect(v).toBe(5)\n            expect(values).toEqual(values, [1, 2, 5])\n            done()\n        })\n    }, 10)\n})\n\ntest(\"it should support throw from async generator\", done => {\n    mobx.flow(function* () {\n        yield \"a\"\n        throw 7\n    })().then(\n        () => {\n            done.fail(\"should fail\")\n        },\n        e => {\n            expect(e).toBe(7)\n            done()\n        }\n    )\n})\n\ntest(\"it should support throw from yielded promise generator\", done => {\n    mobx.flow(function* () {\n        return yield delay(10, 7, true)\n    })().then(\n        () => {\n            done.fail(\"should fail\")\n        },\n        e => {\n            expect(e).toBe(7)\n            done()\n        }\n    )\n})\n\ntest(\"it should support asyncAction in classes\", done => {\n    const values = []\n\n    mobx.configure({ enforceActions: \"observed\" })\n\n    class X {\n        a = 1\n\n        f = mobx.flow(function* (initial) {\n            this.a = initial // this runs in action\n            try {\n                this.a = yield delay(100, 5, true) // and this as well!\n                yield delay(100, 0)\n                this.a = 4\n            } catch (e) {\n                this.a = e\n            }\n            return this.a\n        })\n        constructor() {\n            makeObservable(this, {\n                a: true\n            })\n        }\n    }\n\n    const x = new X()\n    mobx.reaction(\n        () => x.a,\n        v => values.push(v),\n        { fireImmediately: true }\n    )\n\n    setTimeout(() => {\n        x.f(2).then(v => {\n            expect(v).toBe(5)\n            expect(values).toEqual([1, 2, 5])\n            expect(x.a).toBe(5)\n            done()\n        })\n    }, 10)\n})\n\ntest(\"it should support logging\", done => {\n    mobx.configure({ enforceActions: \"observed\" })\n    const events = []\n    const x = mobx.observable({ a: 1 })\n\n    const f = mobx.flow(function* myaction(initial) {\n        x.a = initial\n        x.a = yield delay(100, 5)\n        x.a = 4\n        x.a = yield delay(100, 3)\n        return x.a\n    })\n    const d = mobx.spy(ev => events.push(ev))\n\n    setTimeout(() => {\n        f(2).then(() => {\n            expect(stripEvents(events)).toMatchSnapshot()\n            d()\n            done()\n        })\n    }, 10)\n})\n\nfunction stripEvents(events) {\n    return events.map(e => {\n        delete e.object\n        delete e.fn\n        delete e.time\n        return e\n    })\n}\n\ntest(\"flows are cancelled with an instance of FlowCancellationError\", async () => {\n    const start = flow(function* () {\n        yield Promise.resolve()\n    })\n\n    const promise = start()\n\n    promise.cancel()\n    await expect(promise).rejects.toBeInstanceOf(FlowCancellationError)\n})\n\ntest(\"FlowCancellationError sanity check\", () => {\n    const cancellationError = new FlowCancellationError()\n    expect(cancellationError).toBeInstanceOf(Error)\n    expect(cancellationError).toBeInstanceOf(FlowCancellationError)\n    expect(cancellationError.message).toBe(\"FLOW_CANCELLED\")\n})\n\ntest(\"isFlowCancellationError returns true iff the argument is a FlowCancellationError\", () => {\n    expect(isFlowCancellationError(new FlowCancellationError())).toBe(true)\n    expect(isFlowCancellationError(new Error(\"some random error\"))).toBe(false)\n})\n\ntest(\"flows can be cancelled - 1 - uncaught cancellation\", done => {\n    let steps = 0\n    const start = flow(function* () {\n        steps = 1\n        yield Promise.resolve()\n        steps = 2\n    })\n\n    const promise = start()\n    promise.then(\n        () => {\n            fail()\n        },\n        err => {\n            expect(steps).toBe(1)\n            expect(\"\" + err).toBe(\"Error: FLOW_CANCELLED\")\n            done()\n        }\n    )\n    promise.cancel()\n})\n\ntest(\"flows can be cancelled - 2 - finally clauses are run\", done => {\n    let steps = 0\n    let finallyHandled = false\n    const start = flow(function* () {\n        steps = 1\n        try {\n            yield Promise.resolve()\n            steps = 2\n        } finally {\n            expect(steps).toBe(1)\n            finallyHandled = true\n        }\n    })\n    const promise = start()\n    promise.then(\n        () => {\n            fail()\n        },\n        err => {\n            expect(\"\" + err).toBe(\"Error: FLOW_CANCELLED\")\n            expect(finallyHandled).toBeTruthy()\n            done()\n        }\n    )\n    promise.cancel()\n})\n\ntest(\"flows can be cancelled - 3 - throw in finally should be caught\", done => {\n    const counter = mobx.observable({ counter: 0 })\n    const d = mobx.reaction(\n        () => counter.counter,\n        () => {}\n    )\n    mobx.configure({ enforceActions: \"observed\" })\n\n    const start = flow(function* () {\n        counter.counter = 1\n        try {\n            yield Promise.resolve()\n            counter.counter = 15\n        } finally {\n            counter.counter = 4\n            // eslint-disable-next-line no-unsafe-finally\n            throw \"OOPS\"\n        }\n    })\n\n    const promise = start()\n    promise.then(\n        () => fail(\"flow should not have failed\"),\n        err => {\n            expect(\"\" + err).toBe(\"OOPS\")\n            expect(counter.counter).toBe(4)\n            mobx.configure({ enforceActions: \"never\" })\n            d()\n            done()\n        }\n    )\n    promise.cancel()\n})\n\ntest(\"flows can be cancelled - 4 - pending Promise will be ignored\", done => {\n    let steps = 0\n    const start = flow(function* () {\n        steps = 1\n        yield Promise.reject(\"This won't be caught anywhere!\") // cancel will resolve this flow before this one is throw, so this promise goes uncaught\n        steps = 2\n    })\n\n    const promise = start()\n    promise.then(\n        () => fail(),\n        err => {\n            expect(steps).toBe(1)\n            expect(\"\" + err).toBe(\"Error: FLOW_CANCELLED\")\n            done()\n        }\n    )\n    promise.cancel()\n})\n\ntest(\"flows can be cancelled - 5 - return before cancel\", done => {\n    // eslint-disable-next-line require-yield\n    const start = flow(function* () {\n        return Promise.resolve(2) // cancel will be to late..\n    })\n\n    const promise = start()\n    promise.then(\n        value => {\n            expect(value).toBe(2), done()\n        },\n        () => {\n            fail()\n        }\n    )\n    promise.cancel() // no-op\n})\n\ntest(\"flows can be cancelled - 5 - flows cancel recursively\", done => {\n    let flow1cancelled = false\n    let flow2cancelled = false\n    let stepsReached = 0\n\n    const flow1 = flow(function* () {\n        try {\n            yield Promise.resolve()\n            stepsReached++\n        } finally {\n            flow1cancelled = true\n        }\n    })\n\n    const flow2 = flow(function* () {\n        try {\n            yield flow1()\n            stepsReached++\n        } finally {\n            flow2cancelled = true\n        }\n    })\n\n    const p = flow2()\n    p.then(\n        () => fail(),\n        err => {\n            expect(\"\" + err).toBe(\"Error: FLOW_CANCELLED\")\n            expect(stepsReached).toBe(0)\n            expect(flow2cancelled).toBeTruthy()\n            expect(flow1cancelled).toBeTruthy()\n            done()\n        }\n    )\n    p.cancel()\n})\n\ntest(\"flows yield anything\", async () => {\n    const start = flow(function* () {\n        const x = yield 2\n        return x\n    })\n\n    const res = await start()\n    expect(res).toBe(2)\n})\n\ntest(\"cancelled flow should not result in runaway reject\", async () => {\n    const start = flow(function* () {\n        try {\n            const x = yield 2\n            return x\n        } finally {\n            yield Promise.reject(\"Oh noes\")\n            // eslint-disable-next-line no-unsafe-finally\n            return 4\n        }\n    })\n\n    const p = start()\n    p.cancel()\n    try {\n        await p\n        fail()\n    } catch (e) {\n        expect(\"\" + e).toBe(\"Error: FLOW_CANCELLED\")\n    }\n})\n\ntest(\"it should support flow as annotation\", done => {\n    const values = []\n\n    mobx.configure({ enforceActions: \"observed\" })\n\n    class X {\n        a = 1\n\n        f = function* (initial) {\n            this.a = initial // this runs in action\n            try {\n                this.a = yield delay(100, 5, true) // and this as well!\n                yield delay(100, 0)\n                this.a = 4\n            } catch (e) {\n                this.a = e\n            }\n            return this.a\n        }\n        constructor() {\n            makeObservable(this, {\n                a: true,\n                f: flow\n            })\n        }\n    }\n\n    const x = new X()\n    mobx.reaction(\n        () => x.a,\n        v => values.push(v),\n        { fireImmediately: true }\n    )\n\n    const x2 = new X()\n    expect(x2.f).not.toBe(x.f) // local field!\n\n    setTimeout(() => {\n        x.f(2).then(v => {\n            expect(v).toBe(5)\n            expect(values).toEqual([1, 2, 5])\n            expect(x.a).toBe(5)\n            done()\n        })\n    }, 10)\n})\n\ntest(\"it should support flow in makeAutoObservable\", done => {\n    const values = []\n\n    mobx.configure({ enforceActions: \"observed\" })\n\n    class X {\n        a = 1;\n\n        *f(initial) {\n            this.a = initial // this runs in action\n            try {\n                this.a = yield delay(100, 5, true) // and this as well!\n                yield delay(100, 0)\n                this.a = 4\n            } catch (e) {\n                this.a = e\n            }\n            return this.a\n        }\n\n        constructor() {\n            mobx.makeAutoObservable(this)\n        }\n    }\n\n    const x = new X()\n    expect(mobx.isFlow(X.prototype.f)).toBe(true)\n    expect(x.hasOwnProperty(\"f\")).toBe(false)\n\n    mobx.reaction(\n        () => x.a,\n        v => values.push(v),\n        { fireImmediately: true }\n    )\n\n    setTimeout(() => {\n        x.f(2).then(v => {\n            expect(v).toBe(5)\n            expect(values).toEqual([1, 2, 5])\n            expect(x.a).toBe(5)\n            done()\n        })\n    }, 10)\n})\n\ntest(\"verify #2519\", done => {\n    mobx.configure({ enforceActions: \"observed\" })\n    const values = []\n    const x = mobx.observable({ a: 1 })\n    mobx.reaction(\n        () => x.a,\n        v => values.push(v),\n        { fireImmediately: true }\n    )\n\n    const f = mobx.flow(function* (initial) {\n        x.a = initial // this runs in action\n        try {\n            x.a = yield delay(100, 5, false) // and this as well!\n            yield delay(100, 0)\n            x.a = 4\n        } catch (e) {\n            x.a = e\n        }\n        return x.a\n    })\n\n    setTimeout(() => {\n        f(2).then(v => {\n            expect(v).toBe(4)\n            expect(values).toEqual(values, [1, 2, 5, 4])\n            done()\n        })\n    }, 10)\n})\n\ntest(\"flow is called with correct context\", async () => {\n    const thisArg = {}\n    const f = flow(function* () {\n        yield delay(100)\n        expect(this).toBe(thisArg)\n    })\n    await f.call(thisArg)\n})\n"
  },
  {
    "path": "packages/mobx/__tests__/v5/base/intercept.js",
    "content": "const m = require(\"../../../src/mobx.ts\")\nconst intercept = m.intercept\n\ntest(\"intercept observable value\", () => {\n    const a = m.observable.box(1)\n\n    let d = intercept(a, () => {\n        return null\n    })\n\n    a.set(2)\n\n    expect(a.get()).toBe(1)\n\n    d()\n\n    a.set(3)\n    expect(a.get()).toBe(3)\n\n    d = intercept(a, c => {\n        expect(c.object).toBe(a)\n        if (c.newValue % 2 === 0) {\n            throw \"value should be odd!\"\n        }\n        return c\n    })\n\n    expect(() => {\n        a.set(4)\n    }).toThrow(/value should be odd/)\n\n    expect(a.get()).toBe(3)\n    a.set(5)\n    expect(a.get()).toBe(5)\n\n    d()\n    d = intercept(a, c => {\n        expect(c.object).toBe(a)\n        c.newValue *= 2\n        return c\n    })\n\n    a.set(6)\n    expect(a.get()).toBe(12)\n\n    intercept(a, c => {\n        expect(c.object).toBe(a)\n        c.newValue += 1\n        return c\n    })\n\n    a.set(7)\n    expect(a.get()).toBe(15)\n\n    d()\n    a.set(8)\n    expect(a.get()).toBe(9)\n})\n\ntest(\"intercept array\", () => {\n    const a = m.observable([1, 2])\n\n    let d = m.intercept(a, () => null)\n    a.push(2)\n    expect(a.slice()).toEqual([1, 2])\n\n    d()\n\n    d = intercept(a, c => {\n        expect(c.object).toBe(a)\n        if (c.type === \"splice\") {\n            c.added.push(c.added[0] * 2)\n            c.removedCount = 1\n            return c\n        } else if (c.type === \"update\") {\n            c.newValue = c.newValue * 3\n            return c\n        }\n    })\n\n    a.unshift(3, 4)\n\n    expect(a.slice()).toEqual([3, 4, 6, 2])\n    a[2] = 5\n    expect(a.slice()).toEqual([3, 4, 15, 2])\n})\n\ntest(\"intercept object\", () => {\n    const a = m.observable({\n        b: 3\n    })\n\n    intercept(a, change => {\n        expect(change.object).toBe(a)\n        change.newValue *= 3\n        return change\n    })\n\n    a.b = 4\n\n    expect(a.b).toBe(12)\n\n    intercept(a, \"b\", change => {\n        change.newValue += 1\n        return change\n    })\n\n    a.b = 5\n    expect(a.b).toBe(16)\n\n    const d3 = intercept(a, c => {\n        expect(c.name).toBe(\"b\")\n        expect(c.object).toBe(a)\n        expect(c.type).toBe(\"update\")\n        return null\n    })\n\n    a.b = 7\n    expect(a.b).toBe(16)\n\n    d3()\n    a.b = 7\n    expect(a.b).toBe(22)\n})\n\ntest(\"intercept property additions\", () => {\n    const a = m.observable({})\n    const d4 = intercept(a, change => {\n        expect(change.object).toBe(a)\n        if (change.type === \"add\") {\n            return null\n        }\n        return change\n    })\n\n    m.extendObservable(a, { c: 1 }) // not added!\n    expect(a.c).toBe(undefined)\n    expect(m.isObservableProp(a, \"c\")).toBe(false)\n\n    d4()\n\n    m.extendObservable(a, { c: 2 })\n    expect(a.c).toBe(2)\n    expect(m.isObservableProp(a, \"c\")).toBe(true)\n})\n\ntest(\"intercept map\", () => {\n    const a = m.observable.map({\n        b: 3\n    })\n\n    intercept(a, c => {\n        expect(c.object).toBe(a)\n        c.newValue *= 3\n        return c\n    })\n\n    a.set(\"b\", 4)\n\n    expect(a.get(\"b\")).toBe(12)\n\n    intercept(a, \"b\", c => {\n        c.newValue += 1\n        return c\n    })\n\n    a.set(\"b\", 5)\n    expect(a.get(\"b\")).toBe(16)\n\n    const d3 = intercept(a, c => {\n        expect(c.object).toBe(a)\n        expect(c.name).toBe(\"b\"), expect(c.object).toBe(a)\n        expect(c.type).toBe(\"update\")\n        return null\n    })\n\n    a.set(\"b\", 7)\n    expect(a.get(\"b\")).toBe(16)\n\n    d3()\n    a.set(\"b\", 7)\n    expect(a.get(\"b\")).toBe(22)\n\n    const d4 = intercept(a, c => {\n        expect(c.object).toBe(a)\n        if (c.type === \"delete\") return null\n        return c\n    })\n\n    a.delete(\"b\")\n    expect(a.has(\"b\")).toBe(true)\n    expect(a.get(\"b\")).toBe(22)\n\n    d4()\n    a.delete(\"b\")\n    expect(a.has(\"b\")).toBe(false)\n    expect(a.get(\"c\")).toBe(undefined)\n})\n\ntest(\"intercept prevent dispose from breaking current execution\", () => {\n    const a = m.observable.box(1)\n\n    intercept(a, c => {\n        c.newValue += 1\n        return c\n    })\n\n    const d = intercept(a, c => {\n        d()\n        expect(c.object).toBe(a)\n        c.newValue *= 2\n        return c\n    })\n\n    intercept(a, c => {\n        c.newValue += 1\n        return c\n    })\n\n    a.set(2)\n\n    expect(a.get()).toBe(7)\n\n    a.set(2)\n\n    expect(a.get()).toBe(4)\n})\n"
  },
  {
    "path": "packages/mobx/__tests__/v5/base/make-observable.ts",
    "content": "import { isFlow } from \"../../../src/api/flow\"\nimport { deepEnhancer } from \"../../../src/internal\"\nimport {\n    makeObservable,\n    action,\n    computed,\n    observable,\n    isObservable,\n    isObservableObject,\n    isObservableProp,\n    isComputedProp,\n    isAction,\n    makeAutoObservable,\n    autorun,\n    extendObservable,\n    getDebugName,\n    _getAdministration,\n    configure,\n    flow,\n    override,\n    ObservableSet,\n    ObservableMap\n} from \"../../../src/mobx\"\n\ntest(\"makeObservable picks up decorators\", () => {\n    class Test {\n        @observable x = 3\n        y = 3\n\n        @computed\n        get double() {\n            return this.x * 2\n        }\n\n        @action\n        unbound() {\n            return this\n        }\n\n        @action.bound bound() {\n            return this\n        }\n\n        constructor() {\n            makeObservable(this)\n        }\n    }\n\n    const t = new Test()\n    expect(isObservableObject(t)).toBe(true)\n    expect(isObservableProp(t, \"x\")).toBe(true)\n    expect(isObservableProp(t, \"y\")).toBe(false)\n    expect(isComputedProp(t, \"double\")).toBe(true)\n    expect(isAction(t.unbound)).toBe(true)\n    expect(isAction(t.bound)).toBe(true)\n    expect(t.unbound.call(undefined)).toBe(undefined)\n    expect(t.bound.call(undefined)).toBe(t)\n})\n\ntest(\"makeObservable picks up annotations\", () => {\n    class Test {\n        x = 3\n        y = 2\n\n        get double() {\n            return this.x * 2\n        }\n\n        unbound() {\n            return this\n        }\n\n        bound() {\n            return this\n        }\n\n        constructor() {\n            makeObservable(this, {\n                x: observable,\n                double: computed,\n                unbound: action,\n                bound: action.bound\n            })\n        }\n    }\n\n    const t = new Test()\n    expect(isObservableObject(t)).toBe(true)\n    expect(isObservableProp(t, \"x\")).toBe(true)\n    expect(isObservableProp(t, \"y\")).toBe(false)\n\n    expect(isComputedProp(t, \"double\")).toBe(true)\n    expect(isAction(t.unbound)).toBe(true)\n    expect(isAction(t.bound)).toBe(true)\n    expect(t.unbound.call(undefined)).toBe(undefined)\n    expect(t.bound.call(undefined)).toBe(t)\n})\n\ntest(\"makeObservable supports private fields\", () => {\n    class Test {\n        private x = 3\n        private y = 2\n\n        private get double() {\n            return this.x * 2\n        }\n\n        private unbound() {\n            return this\n        }\n\n        private bound() {\n            return this\n        }\n\n        constructor() {\n            makeObservable<this, \"x\" | \"double\" | \"unbound\" | \"bound\">(this, {\n                x: observable,\n                double: computed,\n                unbound: action,\n                bound: action.bound\n            })\n            if (3 - 1 === 4) {\n                makeObservable<this, \"x\" | \"double\" | \"unbound\" | \"bound\">(this, {\n                    // @ts-expect-error\n                    z: false\n                })\n\n                makeObservable(this, {\n                    // @ts-expect-error\n                    z: false\n                })\n            }\n        }\n    }\n\n    const t: any = new Test()\n    expect(isObservableObject(t)).toBe(true)\n    expect(isObservableProp(t, \"x\")).toBe(true)\n    expect(isObservableProp(t, \"y\")).toBe(false)\n\n    expect(isComputedProp(t, \"double\")).toBe(true)\n    expect(isAction(t.unbound)).toBe(true)\n    expect(isAction(t.bound)).toBe(true)\n    expect(t.unbound.call(undefined)).toBe(undefined)\n    expect(t.bound.call(undefined)).toBe(t)\n})\n\ntest(\"makeObservable has sane defaults\", () => {\n    class Test {\n        x = 3\n        y = 2\n\n        get double() {\n            return this.x * 2\n        }\n\n        unbound() {\n            return this\n        }\n\n        bound() {\n            return this\n        }\n\n        constructor() {\n            makeObservable(this, {\n                x: true,\n                y: false,\n                double: true,\n                unbound: true,\n                bound: action.bound\n            })\n            if (3 - 1 === 4) {\n                makeObservable(this, {\n                    x: false,\n                    // @ts-expect-error\n                    z: true\n                })\n            }\n        }\n    }\n\n    const t = new Test()\n    expect(isObservableObject(t)).toBe(true)\n    expect(isObservableProp(t, \"x\")).toBe(true)\n    expect(isObservableProp(t, \"y\")).toBe(false)\n\n    expect(isComputedProp(t, \"double\")).toBe(true)\n    expect(isAction(t.unbound)).toBe(true)\n    expect(isAction(t.bound)).toBe(true)\n    expect(t.unbound.call(undefined)).toBe(undefined)\n    expect(t.bound.call(undefined)).toBe(t)\n})\n\ntest(\"makeObservable supports autoBind\", async () => {\n    class Test {\n        action() {\n            return this\n        }\n\n        actionBound() {\n            return this\n        }\n\n        *flow() {\n            return this\n        }\n\n        *flowBound() {\n            return this\n        }\n\n        constructor() {\n            makeObservable(\n                this,\n                {\n                    action: action,\n                    actionBound: true,\n                    flow: flow,\n                    flowBound: true\n                },\n                {\n                    autoBind: true\n                }\n            )\n        }\n    }\n\n    const t = new Test()\n    expect(isObservableObject(t)).toBe(true)\n    expect(isAction(t.action)).toBe(true)\n    expect(isAction(t.actionBound)).toBe(true)\n    expect(t.action.call(undefined)).toBe(undefined)\n    expect(t.actionBound.call(undefined)).toBe(t)\n    expect(isFlow(t.flow)).toBe(true)\n    expect(isFlow(t.flowBound)).toBe(true)\n    expect(await t.flow.call(undefined)).toBe(undefined)\n    expect(await t.flowBound.call(undefined)).toBe(t)\n})\n\ntest(\"Extending builtins is not support #2765\", () => {\n    class ObservableMapLimitedSize extends ObservableMap {\n        limitSize = 0\n        constructor(map: Map<any, any>, enhancer = deepEnhancer, name: string) {\n            super(map, enhancer, name)\n            makeObservable(this, {\n                limitSize: observable\n            })\n        }\n    }\n\n    class ObservableSetLimitedSize extends ObservableSet {\n        limitSize = 0\n        constructor(set: Set<any>, enhancer = deepEnhancer, name: string) {\n            super(set, enhancer, name)\n            makeObservable(this, {\n                limitSize: observable\n            })\n        }\n    }\n\n    expect(() => {\n        new ObservableMapLimitedSize(new Map([[\"key\", \"val\"]]), deepEnhancer, \"TestObject\")\n    }).toThrowErrorMatchingInlineSnapshot(`\n        \"[MobX] Cannot convert 'TestObject' into observable object:\n        The target is already observable of different type.\n        Extending builtins is not supported.\"\n    `)\n    expect(() => {\n        new ObservableSetLimitedSize(new Set(), deepEnhancer, \"TestObject\")\n    }).toThrowErrorMatchingInlineSnapshot(`\n        \"[MobX] Cannot convert 'TestObject' into observable object:\n        The target is already observable of different type.\n        Extending builtins is not supported.\"\n    `)\n})\n\ntest(\"makeAutoObservable has sane defaults\", () => {\n    class Test {\n        x = 3\n        y = 2\n\n        get double() {\n            return this.x * 2\n        }\n\n        unbound() {\n            return this\n        }\n\n        bound() {\n            return this\n        }\n\n        constructor() {\n            makeAutoObservable(this)\n        }\n    }\n\n    const t = new Test()\n    expect(isObservableObject(t)).toBe(true)\n    expect(isObservableProp(t, \"x\")).toBe(true)\n    expect(isObservableProp(t, \"y\")).toBe(true) // will be observable\n\n    expect(isComputedProp(t, \"double\")).toBe(true)\n    expect(isAction(t.unbound)).toBe(true)\n    expect(isAction(t.bound)).toBe(true)\n    expect(t.unbound.call(undefined)).toBe(undefined)\n    expect(t.bound.call(undefined)).toBe(undefined)\n})\n\ntest(\"makeAutoObservable supports autoBind\", async () => {\n    class Test {\n        action() {\n            return this\n        }\n\n        *flow() {\n            return this\n        }\n\n        constructor() {\n            makeAutoObservable(this, {}, { autoBind: true })\n        }\n    }\n\n    const t = new Test()\n    expect(isObservableObject(t)).toBe(true)\n    expect(isAction(t.action)).toBe(true)\n    expect(isFlow(t.flow)).toBe(true)\n    expect(t.action.call(undefined)).toBe(t)\n    expect(await t.flow.call(undefined)).toBe(t)\n})\n\ntest(\"makeAutoObservable allows overrides\", () => {\n    class Test {\n        x = 3\n        y = 2\n\n        get double() {\n            return this.x * 2\n        }\n\n        unbound() {\n            return this\n        }\n\n        bound() {\n            return this\n        }\n\n        constructor() {\n            makeAutoObservable(this, {\n                unbound: true,\n                bound: action.bound,\n                y: false\n            })\n            if (3 - 1 === 4) {\n                makeObservable(this, {\n                    // @ts-expect-error\n                    z: true\n                })\n            }\n        }\n    }\n\n    const t = new Test()\n    expect(isObservableObject(t)).toBe(true)\n    expect(isObservableProp(t, \"x\")).toBe(true)\n    expect(isObservableProp(t, \"y\")).toBe(false)\n\n    expect(isComputedProp(t, \"double\")).toBe(true)\n    expect(isAction(t.unbound)).toBe(true)\n    expect(isAction(t.bound)).toBe(true)\n    expect(t.unbound.call(undefined)).toBe(undefined)\n    expect(t.bound.call(undefined)).toBe(t)\n})\n\ntest(\"makeAutoObservable cannot be used on subclasses\", () => {\n    class A {}\n\n    class B extends A {\n        constructor() {\n            super()\n            makeAutoObservable(this)\n        }\n    }\n\n    expect(() => {\n        new B()\n    }).toThrowErrorMatchingInlineSnapshot(\n        `\"[MobX] 'makeAutoObservable' can only be used for classes that don't have a superclass\"`\n    )\n})\n\ntest(\"makeAutoObservable cannot be used on observable objects\", () => {\n    expect(() => {\n        makeAutoObservable(observable({ x: 3 }))\n    }).toThrowErrorMatchingInlineSnapshot(\n        `\"[MobX] makeAutoObservable can only be used on objects not already made observable\"`\n    )\n})\n\ntest(\"makeAutoObservable actions can be used for state updaters and state readers\", () => {\n    class A {\n        x = 1\n\n        constructor() {\n            makeAutoObservable(this)\n        }\n\n        double() {\n            return this.x * 2\n        }\n\n        addTwo() {\n            this.x++\n            this.x++\n        }\n    }\n\n    const events: number[] = []\n    const a = new A()\n\n    expect(isObservableProp(a, \"x\")).toBe(true)\n    expect(isAction(a.double)).toBe(true)\n    expect(isAction(a.addTwo)).toBe(true)\n\n    const d = autorun(() => {\n        events.push(a.double())\n    })\n\n    a.addTwo()\n\n    expect(a.x).toBe(3)\n\n    // tracked and batched!\n    expect(events).toEqual([2, 6])\n\n    d()\n})\n\ntest(\"observable actions can be used for state updaters and state readers\", () => {\n    const events: number[] = []\n    const a = observable({\n        x: 1,\n        double() {\n            return this.x * 2\n        },\n        addTwo() {\n            this.x++\n            this.x++\n        }\n    })\n    const d = autorun(() => {\n        events.push(a.double())\n    })\n\n    expect(isObservableProp(a, \"x\")).toBe(true)\n    expect(isAction(a.double)).toBe(true)\n    expect(isAction(a.addTwo)).toBe(true)\n\n    a.addTwo()\n\n    expect(a.x).toBe(3)\n\n    // tracked and batched!\n    expect(events).toEqual([2, 6])\n\n    d()\n})\n\ntest(\"makeObservable can be used late and support non-enumerable getters\", () => {\n    function MyClass() {\n        this.x = 1\n        Object.defineProperty(this, \"double\", {\n            get() {\n                return this.x\n            },\n            configurable: true,\n            enumerable: false\n        })\n        this.inc = function () {\n            this.x++\n        }\n        makeObservable(this, {\n            x: observable,\n            double: computed,\n            inc: action\n        })\n    }\n    const i = new MyClass()\n\n    expect(isObservableProp(i, \"x\")).toBe(true)\n    expect(isComputedProp(i, \"double\")).toBe(true)\n    expect(isAction(i.inc)).toBe(true)\n})\n\ntest(\"makeAutoObservable can be used late and support non-enumerable getters\", () => {\n    function MyClass() {\n        this.x = 1\n        Object.defineProperty(this, \"double\", {\n            get() {\n                return this.x\n            },\n            configurable: true,\n            enumerable: false\n        })\n        this.inc = function () {\n            this.x++\n        }\n        makeAutoObservable(this)\n    }\n    // check if annotations are cached\n    expect(Object.getOwnPropertySymbols(MyClass.prototype).length).toBe(0)\n    const x = new MyClass()\n    expect(Object.getOwnPropertySymbols(MyClass.prototype).length).toBe(1)\n\n    const i = new MyClass()\n\n    expect(isObservableProp(i, \"x\")).toBe(true)\n    expect(isComputedProp(i, \"double\")).toBe(true)\n    expect(isAction(i.inc)).toBe(true)\n})\n\ntest(\"extendObservable can be used late and support non-enumerable getters #2386\", () => {\n    function MyClass() {\n        const args = {\n            x: 1,\n            inc() {\n                this.x++\n            }\n        }\n        Object.defineProperty(args, \"double\", {\n            get() {\n                return this.x\n            },\n            enumerable: false\n        })\n        extendObservable(this, args)\n    }\n    const i = new MyClass()\n\n    expect(isObservableProp(i, \"x\")).toBe(true)\n    expect(isComputedProp(i, \"double\")).toBe(true)\n    expect(isAction(i.inc)).toBe(true)\n})\n\ntest(\"makeObservable doesn't trigger in always mode'\", () => {\n    configure({\n        enforceActions: \"always\"\n    })\n    class C {\n        x = 3\n        constructor() {\n            makeAutoObservable(this)\n        }\n    }\n\n    expect(new C()).toBeTruthy()\n})\n\ntest(\"#2457\", () => {\n    class BaseClass {\n        @observable\n        value1?: number\n\n        constructor() {\n            makeObservable(this)\n        }\n    }\n\n    class SubClass extends BaseClass {\n        constructor() {\n            super()\n            makeObservable(this)\n        }\n\n        @computed\n        get value1Computed() {\n            return this.value1\n        }\n    }\n\n    const t = new SubClass()\n    expect(isObservableObject(t)).toBe(true)\n    expect(isObservableProp(t, \"value1\")).toBe(true)\n    expect(isComputedProp(t, \"value1Computed\")).toBe(true)\n})\n\ntest(\"makeAutoObservable respects options.deep #2542'\", () => {\n    const o = makeAutoObservable({ nested: {} }, {}, { deep: false })\n    expect(isObservable(o)).toBe(true)\n    expect(isObservableProp(o, \"nested\")).toBe(true)\n    expect(isObservable(o.nested)).toBe(false)\n\n    const deepO = makeAutoObservable({ nested: {} }, {}, { deep: true })\n    expect(isObservable(deepO)).toBe(true)\n    expect(isObservableProp(deepO, \"nested\")).toBe(true)\n    expect(isObservable(deepO.nested)).toBe(true)\n})\n\ntest(\"makeObservable respects options.name #2614'\", () => {\n    const name = \"DebugName\"\n\n    class Clazz {\n        timer = 0\n        constructor() {\n            makeObservable(this, { timer: observable }, { name })\n        }\n    }\n\n    const instance = new Clazz()\n    const plain = makeObservable({ timer: 0 }, { timer: observable }, { name })\n\n    expect(getDebugName(instance)).toBe(name)\n    expect(getDebugName(plain)).toBe(name)\n})\n// \"makeObservable + @action + arrow function + subclass override #2614\"\n\ntest(\"class - annotations\", async () => {\n    class Foo {\n        [\"observable\"] = { nested: {} };\n        [\"observable.ref\"] = { nested: {} };\n        [\"observable.shallow\"] = { nested: {} }\n\n        constructor() {\n            makeObservable(this, {\n                observable: observable,\n                \"observable.ref\": observable.ref,\n                \"observable.shallow\": observable.shallow,\n                computed: computed,\n                action: action,\n                \"action.bound\": action.bound,\n                flow: flow,\n                \"flow.bound\": flow.bound\n            })\n        }\n\n        get computed() {\n            return this\n        }\n\n        [\"action\"]() {\n            return this\n        }\n\n        [\"action.bound\"]() {\n            return this\n        }\n\n        *[\"flow\"]() {\n            return this\n        }\n\n        *[\"flow.bound\"]() {\n            return this\n        }\n    }\n\n    const foo = new Foo()\n    expect(isObservableObject(foo)).toBe(true)\n\n    expect(isObservableProp(foo, \"observable\")).toBe(true)\n    expect(isObservableObject(foo[\"observable\"])).toBe(true)\n\n    expect(isObservableProp(foo, \"observable.ref\")).toBe(true)\n    expect(isObservableObject(foo[\"observable.ref\"])).toBe(false)\n    expect(isObservableObject(foo[\"observable.ref\"].nested)).toBe(false)\n\n    expect(isObservableProp(foo, \"observable.shallow\")).toBe(true)\n    expect(isObservableObject(foo[\"observable.shallow\"])).toBe(true)\n    expect(isObservableObject(foo[\"observable.shallow\"].nested)).toBe(false)\n\n    expect(isComputedProp(foo, \"computed\")).toBe(true)\n\n    expect(isAction(foo[\"action\"])).toBe(true)\n    expect(Object.getPrototypeOf(foo).hasOwnProperty(\"action\")).toBe(true)\n    expect(foo.hasOwnProperty(\"action\")).toBe(false)\n    expect(foo[\"action\"].call(null)).toBe(null)\n\n    expect(isAction(foo[\"action.bound\"])).toBe(true)\n    expect(Object.getPrototypeOf(foo).hasOwnProperty(\"action.bound\")).toBe(true)\n    expect(foo.hasOwnProperty(\"action.bound\")).toBe(true)\n    expect(foo[\"action.bound\"].call(null)).toBe(foo)\n\n    expect(isFlow(foo[\"flow\"])).toBe(true)\n    expect(Object.getPrototypeOf(foo).hasOwnProperty(\"flow\")).toBe(true)\n    expect(foo.hasOwnProperty(\"flow\")).toBe(false)\n\n    expect(isFlow(foo[\"flow.bound\"])).toBe(true)\n    expect(Object.getPrototypeOf(foo).hasOwnProperty(\"flow.bound\")).toBe(true)\n    expect(foo.hasOwnProperty(\"flow.bound\")).toBe(true)\n    expect(await foo[\"flow.bound\"].call(null)).toBe(foo)\n})\n\ntest(\"class - decorators\", async () => {\n    class Foo {\n        @observable\n        [\"observable\"] = { nested: {} };\n        @observable.ref\n        [\"observable.ref\"] = { nested: {} };\n        @observable.shallow\n        [\"observable.shallow\"] = { nested: {} }\n\n        constructor() {\n            makeObservable(this)\n        }\n\n        @computed\n        get computed() {\n            return this\n        }\n\n        @action\n        [\"action\"]() {\n            return this\n        }\n\n        @action.bound\n        [\"action.bound\"]() {\n            return this\n        }\n\n        @flow\n        *[\"flow\"]() {\n            return this\n        }\n\n        @flow.bound\n        *[\"flow.bound\"]() {\n            return this\n        }\n    }\n\n    const foo = new Foo()\n    expect(isObservableObject(foo)).toBe(true)\n\n    expect(isObservableProp(foo, \"observable\")).toBe(true)\n    expect(isObservableObject(foo[\"observable\"])).toBe(true)\n\n    expect(isObservableProp(foo, \"observable.ref\")).toBe(true)\n    expect(isObservableObject(foo[\"observable.ref\"])).toBe(false)\n    expect(isObservableObject(foo[\"observable.ref\"].nested)).toBe(false)\n\n    expect(isObservableProp(foo, \"observable.shallow\")).toBe(true)\n    expect(isObservableObject(foo[\"observable.shallow\"])).toBe(true)\n    expect(isObservableObject(foo[\"observable.shallow\"].nested)).toBe(false)\n\n    expect(isComputedProp(foo, \"computed\")).toBe(true)\n\n    expect(isAction(foo[\"action\"])).toBe(true)\n    expect(Object.getPrototypeOf(foo).hasOwnProperty(\"action\")).toBe(true)\n    expect(foo.hasOwnProperty(\"action\")).toBe(false)\n    expect(foo[\"action\"].call(null)).toBe(null)\n\n    expect(isAction(foo[\"action.bound\"])).toBe(true)\n    expect(Object.getPrototypeOf(foo).hasOwnProperty(\"action.bound\")).toBe(true)\n    expect(foo.hasOwnProperty(\"action.bound\")).toBe(true)\n    expect(foo[\"action.bound\"].call(null)).toBe(foo)\n\n    expect(isFlow(foo[\"flow\"])).toBe(true)\n    expect(Object.getPrototypeOf(foo).hasOwnProperty(\"flow\")).toBe(true)\n    expect(foo.hasOwnProperty(\"flow\")).toBe(false)\n\n    expect(isFlow(foo[\"flow.bound\"])).toBe(true)\n    expect(Object.getPrototypeOf(foo).hasOwnProperty(\"flow.bound\")).toBe(true)\n    expect(foo.hasOwnProperty(\"flow.bound\")).toBe(true)\n    expect(await foo[\"flow.bound\"].call(null)).toBe(foo)\n})\n\ntest(\"subclass - annotation\", () => {\n    class Parent {\n        [\"observable\"] = { nested: {} };\n        [\"observable.ref\"] = { nested: {} };\n        [\"observable.shallow\"] = { nested: {} }\n\n        constructor() {\n            makeObservable(this, {\n                observable: observable,\n                \"observable.ref\": observable.ref,\n                \"observable.shallow\": observable.shallow,\n                computed: computed,\n                action: action,\n                \"action.bound\": action.bound,\n                flow: flow\n            })\n        }\n\n        get computed() {\n            return this\n        }\n\n        [\"action\"]() {\n            return this\n        }\n\n        [\"action.bound\"]() {\n            return this\n        }\n\n        *[\"flow\"]() {\n            return this\n        }\n    }\n\n    class Child extends Parent {\n        [\"observable2\"] = { nested: {} };\n        [\"observable.ref2\"] = { nested: {} };\n        [\"observable.shallow2\"] = { nested: {} }\n\n        constructor() {\n            super()\n            makeObservable(this, {\n                observable2: observable,\n                \"observable.ref2\": observable.ref,\n                \"observable.shallow2\": observable.shallow,\n                computed2: computed,\n                action2: action,\n                \"action.bound2\": action.bound,\n                flow2: flow\n            })\n        }\n\n        get computed2() {\n            return this\n        }\n\n        [\"action2\"]() {\n            return this\n        }\n\n        [\"action.bound2\"]() {\n            return this\n        }\n\n        *[\"flow2\"]() {\n            return this\n        }\n    }\n\n    const child = new Child()\n    expect(isObservableObject(child)).toBe(true)\n\n    expect(isObservableProp(child, \"observable\")).toBe(true)\n    expect(isObservableObject(child[\"observable\"])).toBe(true)\n\n    expect(isObservableProp(child, \"observable.ref\")).toBe(true)\n    expect(isObservableObject(child[\"observable.ref\"])).toBe(false)\n    expect(isObservableObject(child[\"observable.ref\"].nested)).toBe(false)\n\n    expect(isObservableProp(child, \"observable.shallow\")).toBe(true)\n    expect(isObservableObject(child[\"observable.shallow\"])).toBe(true)\n    expect(isObservableObject(child[\"observable.shallow\"].nested)).toBe(false)\n\n    expect(isComputedProp(child, \"computed\")).toBe(true)\n\n    expect(isAction(child[\"action\"])).toBe(true)\n    expect(Object.getPrototypeOf(child).hasOwnProperty(\"action\")).toBe(false)\n    expect(child.hasOwnProperty(\"action\")).toBe(false)\n    expect(child[\"action\"].call(null)).toBe(null)\n\n    expect(isAction(child[\"action.bound\"])).toBe(true)\n    expect(Object.getPrototypeOf(child).hasOwnProperty(\"action.bound\")).toBe(false)\n    expect(child.hasOwnProperty(\"action.bound\")).toBe(true)\n    expect(child[\"action.bound\"].call(null)).toBe(child)\n\n    expect(isFlow(child[\"flow\"])).toBe(true)\n    expect(Object.getPrototypeOf(child).hasOwnProperty(\"flow\")).toBe(false)\n    expect(child.hasOwnProperty(\"flow\")).toBe(false)\n\n    expect(isObservableProp(child, \"observable2\")).toBe(true)\n    expect(isObservableObject(child[\"observable2\"])).toBe(true)\n\n    expect(isObservableProp(child, \"observable.ref2\")).toBe(true)\n    expect(isObservableObject(child[\"observable.ref2\"])).toBe(false)\n    expect(isObservableObject(child[\"observable.ref2\"].nested)).toBe(false)\n\n    expect(isObservableProp(child, \"observable.shallow2\")).toBe(true)\n    expect(isObservableObject(child[\"observable.shallow2\"])).toBe(true)\n    expect(isObservableObject(child[\"observable.shallow2\"].nested)).toBe(false)\n\n    expect(isComputedProp(child, \"computed2\")).toBe(true)\n\n    expect(isAction(child[\"action2\"])).toBe(true)\n    expect(Object.getPrototypeOf(child).hasOwnProperty(\"action2\")).toBe(true)\n    expect(child.hasOwnProperty(\"action2\")).toBe(false)\n    expect(child[\"action2\"].call(null)).toBe(null)\n\n    expect(isAction(child[\"action.bound2\"])).toBe(true)\n    expect(Object.getPrototypeOf(child).hasOwnProperty(\"action.bound2\")).toBe(true)\n    expect(child.hasOwnProperty(\"action.bound2\")).toBe(true)\n    expect(child[\"action.bound2\"].call(null)).toBe(child)\n\n    expect(isFlow(child[\"flow2\"])).toBe(true)\n    expect(Object.getPrototypeOf(child).hasOwnProperty(\"flow2\")).toBe(true)\n    expect(child.hasOwnProperty(\"flow2\")).toBe(false)\n})\n\ntest(\"subclass - decorator\", () => {\n    class Parent {\n        @observable\n        [\"observable\"] = { nested: {} };\n        @observable.ref\n        [\"observable.ref\"] = { nested: {} };\n        @observable.shallow\n        [\"observable.shallow\"] = { nested: {} }\n\n        constructor() {\n            makeObservable(this)\n        }\n\n        @computed\n        get computed() {\n            return this\n        }\n\n        @action\n        [\"action\"]() {\n            return this\n        }\n\n        @action.bound\n        [\"action.bound\"]() {\n            return this\n        }\n\n        @flow\n        *[\"flow\"]() {\n            return this\n        }\n    }\n\n    class Child extends Parent {\n        @observable\n        [\"observable2\"] = { nested: {} };\n        @observable.ref\n        [\"observable.ref2\"] = { nested: {} };\n        @observable.shallow\n        [\"observable.shallow2\"] = { nested: {} }\n\n        constructor() {\n            super()\n            makeObservable(this)\n        }\n\n        @computed\n        get computed2() {\n            return this\n        }\n\n        @action\n        [\"action2\"]() {\n            return this\n        }\n\n        @action.bound\n        [\"action.bound2\"]() {\n            return this\n        }\n\n        @flow\n        *[\"flow2\"]() {\n            return this\n        }\n    }\n\n    const child = new Child()\n    expect(isObservableObject(child)).toBe(true)\n\n    expect(isObservableProp(child, \"observable\")).toBe(true)\n    expect(isObservableObject(child[\"observable\"])).toBe(true)\n\n    expect(isObservableProp(child, \"observable.ref\")).toBe(true)\n    expect(isObservableObject(child[\"observable.ref\"])).toBe(false)\n    expect(isObservableObject(child[\"observable.ref\"].nested)).toBe(false)\n\n    expect(isObservableProp(child, \"observable.shallow\")).toBe(true)\n    expect(isObservableObject(child[\"observable.shallow\"])).toBe(true)\n    expect(isObservableObject(child[\"observable.shallow\"].nested)).toBe(false)\n\n    expect(isComputedProp(child, \"computed\")).toBe(true)\n\n    expect(isAction(child[\"action\"])).toBe(true)\n    expect(Object.getPrototypeOf(child).hasOwnProperty(\"action\")).toBe(false)\n    expect(child.hasOwnProperty(\"action\")).toBe(false)\n    expect(child[\"action\"].call(null)).toBe(null)\n\n    expect(isAction(child[\"action.bound\"])).toBe(true)\n    expect(Object.getPrototypeOf(child).hasOwnProperty(\"action.bound\")).toBe(false)\n    expect(child.hasOwnProperty(\"action.bound\")).toBe(true)\n    expect(child[\"action.bound\"].call(null)).toBe(child)\n\n    expect(isFlow(child[\"flow\"])).toBe(true)\n    expect(Object.getPrototypeOf(child).hasOwnProperty(\"flow\")).toBe(false)\n    expect(child.hasOwnProperty(\"flow\")).toBe(false)\n\n    expect(isObservableProp(child, \"observable2\")).toBe(true)\n    expect(isObservableObject(child[\"observable2\"])).toBe(true)\n\n    expect(isObservableProp(child, \"observable.ref2\")).toBe(true)\n    expect(isObservableObject(child[\"observable.ref2\"])).toBe(false)\n    expect(isObservableObject(child[\"observable.ref2\"].nested)).toBe(false)\n\n    expect(isObservableProp(child, \"observable.shallow2\")).toBe(true)\n    expect(isObservableObject(child[\"observable.shallow2\"])).toBe(true)\n    expect(isObservableObject(child[\"observable.shallow2\"].nested)).toBe(false)\n\n    expect(isComputedProp(child, \"computed2\")).toBe(true)\n\n    expect(isAction(child[\"action2\"])).toBe(true)\n    expect(Object.getPrototypeOf(child).hasOwnProperty(\"action2\")).toBe(true)\n    expect(child.hasOwnProperty(\"action2\")).toBe(false)\n    expect(child[\"action2\"].call(null)).toBe(null)\n\n    expect(isAction(child[\"action.bound2\"])).toBe(true)\n    expect(Object.getPrototypeOf(child).hasOwnProperty(\"action.bound2\")).toBe(true)\n    expect(child.hasOwnProperty(\"action.bound2\")).toBe(true)\n    expect(child[\"action.bound2\"].call(null)).toBe(child)\n\n    expect(isFlow(child[\"flow2\"])).toBe(true)\n    expect(Object.getPrototypeOf(child).hasOwnProperty(\"flow2\")).toBe(true)\n    expect(child.hasOwnProperty(\"flow2\")).toBe(false)\n})\n\ntest(\"subclass - annotation - override\", async () => {\n    class Parent {\n        constructor() {\n            makeObservable(this, {\n                action: action,\n                [\"action.bound\"]: action.bound,\n                computed: computed,\n                flow: flow,\n                [\"flow.bound\"]: flow.bound\n            })\n        }\n        action() {\n            return \"parent\"\n        }\n        [\"action.bound\"]() {\n            return \"parent\"\n        }\n        *flow() {\n            return \"parent\"\n        }\n        *[\"flow.bound\"]() {\n            return \"parent\"\n        }\n        get computed() {\n            return \"parent\"\n        }\n    }\n\n    class Child extends Parent {\n        action() {\n            return \"child of \" + super.action()\n        }\n        [\"action.bound\"]() {\n            return \"child of \" + super[\"action.bound\"]()\n        }\n        get computed() {\n            return \"child\"\n        }\n        *flow(): any {\n            const parent = yield super.flow()\n            return \"child of \" + parent\n        }\n        *[\"flow.bound\"](): any {\n            const parent = yield super[\"flow.bound\"]()\n            return \"child of \" + parent\n        }\n    }\n    const child = new Child()\n\n    // Action\n    expect(isAction(Parent.prototype.action)).toBe(true)\n    expect(isAction(Child.prototype.action)).toBe(true)\n    expect(isAction(child.action)).toBe(true)\n\n    expect(child.hasOwnProperty(\"action\")).toBe(false)\n\n    expect(Parent.prototype.action()).toBe(\"parent\")\n    expect(Child.prototype.action()).toBe(\"child of parent\")\n    expect(child.action()).toBe(\"child of parent\")\n\n    // Action bound\n    expect(isAction(Parent.prototype[\"action.bound\"])).toBe(false)\n    expect(isAction(Child.prototype[\"action.bound\"])).toBe(false)\n    expect(isAction(child[\"action.bound\"])).toBe(true)\n\n    expect(child.hasOwnProperty(\"action.bound\")).toBe(true)\n\n    expect(Parent.prototype[\"action.bound\"]()).toBe(\"parent\")\n    expect(Child.prototype[\"action.bound\"]()).toBe(\"child of parent\")\n    expect(child[\"action.bound\"]()).toBe(\"child of parent\")\n\n    // Computed\n    expect(isComputedProp(child, \"computed\")).toBe(true)\n    expect(child.computed).toBe(\"child\")\n\n    // Flow\n    expect(isFlow(Parent.prototype.flow)).toBe(true)\n    expect(isFlow(Child.prototype.flow)).toBe(true)\n    expect(isFlow(child.flow)).toBe(true)\n\n    expect(child.hasOwnProperty(\"flow\")).toBe(false)\n\n    expect(await Parent.prototype.flow()).toBe(\"parent\")\n    expect(await Child.prototype.flow()).toBe(\"child of parent\")\n    expect(await child.flow()).toBe(\"child of parent\")\n\n    // Flow bound\n    expect(isFlow(Parent.prototype[\"flow.bound\"])).toBe(true)\n    expect(isFlow(Child.prototype[\"flow.bound\"])).toBe(true)\n    expect(isFlow(child[\"flow.bound\"])).toBe(true)\n\n    expect(child.hasOwnProperty(\"flow.bound\")).toBe(true)\n\n    expect(await Parent.prototype[\"flow.bound\"]()).toBe(\"parent\")\n    expect(await Child.prototype[\"flow.bound\"]()).toBe(\"child of parent\")\n    expect(await child[\"flow.bound\"]()).toBe(\"child of parent\")\n})\n\ntest(\"subclass - decorator - override\", async () => {\n    class Parent {\n        constructor() {\n            makeObservable(this)\n        }\n        @action\n        action() {\n            return \"parent\"\n        }\n        @action.bound\n        [\"action.bound\"]() {\n            return \"parent\"\n        }\n        @flow\n        *flow() {\n            return \"parent\"\n        }\n        @flow.bound\n        *[\"flow.bound\"]() {\n            return \"parent\"\n        }\n        @computed\n        get computed() {\n            return \"parent\"\n        }\n    }\n\n    class Child extends Parent {\n        action() {\n            return \"child of \" + super.action()\n        }\n        [\"action.bound\"]() {\n            return \"child of \" + super[\"action.bound\"]()\n        }\n        get computed() {\n            return \"child\"\n        }\n        *flow(): any {\n            const parent = yield super.flow()\n            return \"child of \" + parent\n        }\n        *[\"flow.bound\"](): any {\n            const parent = yield super[\"flow.bound\"]()\n            return \"child of \" + parent\n        }\n    }\n    const child = new Child()\n\n    // Action\n    expect(isAction(Parent.prototype.action)).toBe(true)\n    expect(isAction(Child.prototype.action)).toBe(true)\n    expect(isAction(child.action)).toBe(true)\n\n    expect(child.hasOwnProperty(\"action\")).toBe(false)\n\n    expect(Parent.prototype.action()).toBe(\"parent\")\n    expect(Child.prototype.action()).toBe(\"child of parent\")\n    expect(child.action()).toBe(\"child of parent\")\n\n    // Action bound\n    expect(isAction(Parent.prototype[\"action.bound\"])).toBe(false)\n    expect(isAction(Child.prototype[\"action.bound\"])).toBe(false)\n    expect(isAction(child[\"action.bound\"])).toBe(true)\n\n    expect(child.hasOwnProperty(\"action.bound\")).toBe(true)\n\n    expect(Parent.prototype[\"action.bound\"]()).toBe(\"parent\")\n    expect(Child.prototype[\"action.bound\"]()).toBe(\"child of parent\")\n    expect(child[\"action.bound\"]()).toBe(\"child of parent\")\n\n    // Computed\n    expect(isComputedProp(child, \"computed\")).toBe(true)\n    expect(child.computed).toBe(\"child\")\n\n    // Flow\n    expect(isFlow(Parent.prototype.flow)).toBe(true)\n    expect(isFlow(Child.prototype.flow)).toBe(true)\n    expect(isFlow(child.flow)).toBe(true)\n\n    expect(child.hasOwnProperty(\"flow\")).toBe(false)\n\n    expect(await Parent.prototype.flow()).toBe(\"parent\")\n    expect(await Child.prototype.flow()).toBe(\"child of parent\")\n    expect(await child.flow()).toBe(\"child of parent\")\n\n    // Flow bound\n    expect(isFlow(Parent.prototype[\"flow.bound\"])).toBe(true)\n    expect(isFlow(Child.prototype[\"flow.bound\"])).toBe(true)\n    expect(isFlow(child[\"flow.bound\"])).toBe(true)\n\n    expect(child.hasOwnProperty(\"flow.bound\")).toBe(true)\n\n    expect(await Parent.prototype[\"flow.bound\"]()).toBe(\"parent\")\n    expect(await Child.prototype[\"flow.bound\"]()).toBe(\"child of parent\")\n    expect(await child[\"flow.bound\"]()).toBe(\"child of parent\")\n})\n\ntest(\"subclass - cannot re-annotate\", () => {\n    class Parent {\n        observable = 1\n        constructor() {\n            makeObservable(this, {\n                action: action,\n                observable: observable,\n                actionBound: action.bound,\n                flow: flow,\n                flowBound: flow.bound,\n                computed: computed\n            })\n        }\n        action() {}\n        actionBound() {}\n        *flow() {}\n        *flowBound() {}\n        get computed() {\n            return this\n        }\n    }\n\n    class ChildAction extends Parent {\n        constructor() {\n            super()\n            makeObservable(this, {\n                action: action\n            })\n        }\n        action() {}\n    }\n\n    class ChildActionBound extends Parent {\n        constructor() {\n            super()\n            makeObservable(this, {\n                actionBound: action.bound\n            })\n        }\n        actionBound() {}\n    }\n\n    class ChildFlow extends Parent {\n        constructor() {\n            super()\n            makeObservable(this, {\n                flow: flow\n            })\n        }\n        *flow() {}\n    }\n\n    class ChildFlowBound extends Parent {\n        constructor() {\n            super()\n            makeObservable(this, {\n                flowBound: flow.bound\n            })\n        }\n        *flowBound() {}\n    }\n\n    class ChildObservable extends Parent {\n        constructor() {\n            super()\n            this.observable = 2\n            makeObservable(this, {\n                observable: observable\n            })\n        }\n    }\n\n    class ChildComputed extends Parent {\n        constructor() {\n            super()\n            makeObservable(this, {\n                computed: computed\n            })\n        }\n        get computed() {\n            return this\n        }\n    }\n\n    expect(() => new ChildAction()).toThrow(/^\\[MobX\\] Cannot apply/)\n    expect(() => new ChildActionBound()).toThrow(/^\\[MobX\\] Cannot apply/)\n    expect(() => new ChildFlow()).toThrow(/^\\[MobX\\] Cannot apply/)\n    expect(() => new ChildFlowBound()).toThrow(/^\\[MobX\\] Cannot apply/)\n    expect(() => new ChildObservable()).toThrow(/^\\[MobX\\] Cannot apply/)\n    expect(() => new ChildComputed()).toThrow(/^\\[MobX\\] Cannot apply/)\n})\n\ntest(\"subclass - cannot re-decorate\", () => {\n    class Parent {\n        @observable\n        observable = 1\n        constructor() {\n            makeObservable(this)\n        }\n        @action\n        action() {}\n        @action.bound\n        actionBound() {}\n        @flow\n        *flow() {}\n        @flow.bound\n        *flowBound() {}\n        @computed\n        get computed() {\n            return this\n        }\n    }\n\n    expect(() => {\n        class ChildAction extends Parent {\n            constructor() {\n                super()\n                makeObservable(this)\n            }\n            @action\n            action() {}\n        }\n    }).toThrow(/^\\[MobX\\] Cannot apply/)\n\n    expect(() => {\n        class ChildActionBound extends Parent {\n            constructor() {\n                super()\n                makeObservable(this)\n            }\n            @action.bound\n            actionBound() {}\n        }\n    }).toThrow(/^\\[MobX\\] Cannot apply/)\n\n    expect(() => {\n        class ChildFlow extends Parent {\n            constructor() {\n                super()\n                makeObservable(this)\n            }\n            @flow\n            *flow() {}\n        }\n    }).toThrow(/^\\[MobX\\] Cannot apply/)\n\n    expect(() => {\n        class ChildFlowBound extends Parent {\n            constructor() {\n                super()\n                makeObservable(this)\n            }\n            @flow.bound\n            *flowBound() {}\n        }\n    }).toThrow(/^\\[MobX\\] Cannot apply/)\n\n    expect(() => {\n        class ChildObservable extends Parent {\n            @observable\n            observable = 1\n            constructor() {\n                super()\n                makeObservable(this)\n            }\n        }\n    }).toThrow(/^\\[MobX\\] Cannot apply/)\n\n    expect(() => {\n        class ChildComputed extends Parent {\n            constructor() {\n                super()\n                makeObservable(this)\n            }\n            @computed\n            get computed() {\n                return this\n            }\n        }\n    }).toThrow(/^\\[MobX\\] Cannot apply/)\n})\n\ntest(\"subclass - cannot redefine property\", () => {\n    class Parent {\n        observable = 1\n        constructor() {\n            makeObservable(this, {\n                observable: observable,\n                action: action,\n                computed: computed\n            })\n        }\n        action = () => {}\n        get computed() {\n            return this\n        }\n    }\n\n    class ChildAction extends Parent {\n        action = () => {}\n    }\n\n    class ChildObservable extends Parent {\n        observable = 2\n    }\n\n    class ChildComputed extends Parent {\n        // @ts-ignore\n        computed = \"foo\"\n    }\n\n    expect(() => new ChildAction()).toThrow(/^Cannot redefine property/)\n    expect(() => new ChildObservable()).toThrow(/^Cannot redefine property/)\n    expect(() => new ChildComputed()).toThrow(/^Cannot redefine property/)\n})\n\ntest(\"@override\", () => {\n    class Parent {\n        constructor() {\n            makeObservable(this)\n        }\n\n        @action\n        action() {\n            return \"parent\"\n        }\n    }\n\n    class Child extends Parent {\n        @override\n        action() {\n            return `child of ${super.action()}`\n        }\n    }\n\n    const child = new Child()\n    expect(isAction(Parent.prototype.action))\n    expect(Parent.prototype.action()).toBe(\"parent\")\n    expect(isAction(Child.prototype.action))\n    expect(isAction(child.action)).toBe(true)\n    expect(child.action()).toBe(\"child of parent\")\n})\n\ntest(\"override\", () => {\n    class Parent {\n        constructor() {\n            makeObservable(this, {\n                action: action\n            })\n        }\n        action() {\n            return \"parent\"\n        }\n    }\n\n    class Child extends Parent {\n        constructor() {\n            super()\n            makeObservable(this, {\n                action: override\n            })\n        }\n        action() {\n            return `child of ${super.action()}`\n        }\n    }\n\n    const child = new Child()\n    expect(isAction(Parent.prototype.action))\n    expect(Parent.prototype.action()).toBe(\"parent\")\n    expect(isAction(Child.prototype.action))\n    expect(isAction(child.action)).toBe(true)\n\n    expect(child.action()).toBe(\"child of parent\")\n})\n\ntest(\"override must override\", () => {\n    class Parent {\n        action() {\n            return \"parent\"\n        }\n    }\n\n    class Child extends Parent {\n        constructor() {\n            super()\n            makeObservable(this, {\n                action: override\n            })\n        }\n        action() {\n            return `child of ${super.action()}`\n        }\n    }\n\n    expect(() => new Child()).toThrow(\n        /^\\[MobX\\] 'Child@\\d+\\.action' is annotated with 'override', but no such annotated member was found on prototype\\./\n    )\n})\n\ntest(\"@override must override\", () => {\n    class Parent {\n        action() {\n            return \"parent\"\n        }\n    }\n\n    expect(() => {\n        class Child extends Parent {\n            constructor() {\n                super()\n                makeObservable(this)\n            }\n            @override\n            action() {\n                return `child of ${super.action()}`\n            }\n        }\n    }).toThrow(\n        /^\\[MobX\\] 'Child\\.prototype\\.action' is decorated with 'override', but no such decorated member was found on prototype\\./\n    )\n})\n\ntest(\"makeAutoObservable + production build #2751\", () => {\n    const mobx = require(`../../../dist/mobx.cjs.production.min.js`)\n    class Foo {\n        x = \"x\"\n        constructor() {\n            mobx.makeAutoObservable(this)\n        }\n    }\n    const foo = new Foo()\n    expect(mobx.isObservableObject(foo)).toBe(true)\n    expect(mobx.isObservableProp(foo, \"x\")).toBe(true)\n})\n\n// Makes sure that we don't define properties on proto as non-writable,\n// as that would prevent initializing prop on instance via assigment.\ntest(\"inherited fields are assignable before makeObservable\", () => {\n    class Foo {\n        constructor() {\n            this.action = () => {}\n            this.flow = function* flow() {}\n            makeObservable(this, {\n                action,\n                flow\n            })\n        }\n\n        action() {}\n        *flow() {}\n    }\n\n    const foo1 = new Foo()\n    expect(isAction(foo1.action)).toBe(true)\n    expect(isFlow(foo1.flow)).toBe(true)\n\n    const foo2 = new Foo()\n    expect(isAction(foo2.action)).toBe(true)\n    expect(isFlow(foo2.flow)).toBe(true)\n})\n\ntest(\"makeAutoObservable + symbolic keys\", () => {\n    const observableSymbol = Symbol()\n    const computedSymbol = Symbol()\n    const actionSymbol = Symbol()\n\n    class Foo {\n        observable = \"observable\";\n        [observableSymbol] = \"observableSymbol\"\n        get [computedSymbol]() {\n            return this.observable\n        }\n        [actionSymbol]() {}\n\n        constructor() {\n            makeAutoObservable(this)\n        }\n    }\n\n    ;[new Foo(), new Foo()].forEach(foo => {\n        expect(isObservableProp(foo, \"observable\")).toBe(true)\n        expect(isObservableProp(foo, observableSymbol)).toBe(true)\n        expect(isComputedProp(foo, computedSymbol)).toBe(true)\n        expect(isAction(foo[actionSymbol])).toBe(true)\n    })\n})\n\ntest(\"makeAutoObservable + override + annotation cache #2832\", () => {\n    class Clazz {\n        auto = []\n        override = []\n        constructor() {\n            makeAutoObservable(this, {\n                override: observable.ref\n            })\n        }\n    }\n\n    ;[new Clazz(), new Clazz()].forEach(x => {\n        expect(isObservableProp(x, \"auto\")).toBe(true)\n        expect(isObservable(x.auto)).toBe(true)\n        expect(isObservableProp(x, \"override\")).toBe(true)\n        expect(isObservable(x.override)).toBe(false)\n    })\n})\n\ntest(\"flow.bound #2941\", async () => {\n    class Clazz {\n        constructor() {\n            makeObservable(this, {\n                flowBound: flow.bound\n            })\n        }\n        *flowBound() {\n            return this\n        }\n    }\n    new Clazz()\n    new Clazz()\n    expect(isFlow(Clazz.prototype.flowBound)).toBe(true)\n    expect(await Clazz.prototype.flowBound.call(\"ctx\")).toBe(\"ctx\")\n})\n\ntest(\"makeObservable throws when mixing @decorators with annotations\", () => {\n    class Test {\n        @observable x = 3\n\n        constructor() {\n            makeObservable(this, {})\n        }\n    }\n\n    expect(() => new Test()).toThrow(\n        /makeObservable second arg must be nullish when using decorators/\n    )\n})\n\ntest(\"makeAutoObservable + Object.create #3197\", () => {\n    const proto = {\n        action() {},\n        *flow() {},\n        get computed() {\n            return null\n        }\n    }\n    const o = Object.create(proto)\n    o.observable = 5\n    makeAutoObservable(o)\n    expect(isAction(proto.action)).toBe(true)\n    expect(isFlow(proto.flow)).toBe(true)\n    expect(isComputedProp(o, \"computed\")).toBe(true)\n    expect(isObservableProp(o, \"observable\")).toBe(true)\n})\n\ntest(\"flow.bound #3271\", async () => {\n    class Test {\n        constructor() {\n            makeObservable(this, { flowBound: flow.bound })\n        }\n        *flowBound() {\n            return this\n        }\n    }\n\n    const t1 = new Test()\n    const t2 = new Test()\n\n    // Make sure flow is actually bindable\n    expect(\n        await flow(function* () {\n            return this\n        }).bind(t1)()\n    ).toBe(t1)\n\n    expect(t1.hasOwnProperty(\"flowBound\")).toBe(true)\n    expect(t2.hasOwnProperty(\"flowBound\")).toBe(true)\n\n    expect(t1.flowBound !== t2.flowBound).toBe(true)\n\n    expect(await t1.flowBound.call(null)).toBe(t1)\n    expect(await t2.flowBound.call(null)).toBe(t2)\n})\n"
  },
  {
    "path": "packages/mobx/__tests__/v5/base/makereactive.js",
    "content": "const { isAction, isObservable, isObservableProp } = require(\"../../../src/mobx\")\nconst mobx = require(\"../../../src/mobx.ts\")\nconst m = mobx\nconst o = mobx.observable\nconst { makeObservable } = mobx\n\nfunction buffer() {\n    const b = []\n    const res = function (x) {\n        b.push(x)\n    }\n    res.toArray = function () {\n        return b\n    }\n    return res\n}\n\ntest(\"isObservable\", function () {\n    function Order() {}\n\n    function ReactiveOrder(price) {\n        m.extendObservable(this, {\n            price: price\n        })\n    }\n    expect(m.isObservable(null)).toBe(false)\n    expect(m.isObservable(null)).toBe(false)\n\n    expect(m.isObservable(m.observable([]))).toBe(true)\n    expect(m.isObservable(m.observable({}))).toBe(true)\n    expect(m.isObservable(m.observable.box(function () {}))).toBe(true)\n    expect(m.isObservable(m.computed(function () {}))).toBe(true)\n\n    expect(m.isObservable([])).toBe(false)\n    expect(m.isObservable({})).toBe(false)\n    expect(m.isObservable(function () {})).toBe(false)\n\n    expect(m.isObservable(new Order())).toBe(false)\n    expect(m.isObservable(m.observable.box(new Order()))).toBe(true)\n\n    expect(m.isObservable(new ReactiveOrder())).toBe(true)\n    expect(m.isObservable(m.observable.box(3))).toBe(true)\n\n    const obj = {}\n    expect(m.isObservable(obj)).toBe(false)\n\n    expect(m.isObservable(m.observable.box(function () {}))).toBe(true)\n    expect(m.isObservable(m.autorun(function () {}))).toBe(true)\n\n    expect(m.isObservableProp(m.observable({ a: 1 }), \"a\")).toBe(true)\n    expect(m.isObservableProp(m.observable({ a: 1 }), \"b\")).toBe(false)\n\n    expect(m.isObservable(m.observable.map())).toBe(true)\n\n    const base = { a: 3 }\n    const obs = m.observable(base)\n    expect(m.isObservable(base)).toBe(false)\n    expect(m.isObservableProp(base, \"a\")).toBe(false)\n    expect(m.isObservable(obs)).toBe(true)\n    expect(m.isObservableProp(obs, \"a\")).toBe(true)\n})\n\ntest(\"isBoxedObservable\", function () {\n    expect(m.isBoxedObservable(m.observable({}))).toBe(false)\n    expect(m.isBoxedObservable(m.computed(() => 3))).toBe(false)\n    expect(m.isBoxedObservable(m.observable.box(3))).toBe(true)\n    expect(m.isBoxedObservable(m.observable.box(3))).toBe(true)\n    expect(m.isBoxedObservable(m.observable.box({}))).toBe(true)\n    expect(m.isBoxedObservable(m.observable.box({}, { deep: false }))).toBe(true)\n})\n\ntest(\"observable1\", function () {\n    m._resetGlobalState()\n\n    // recursive structure\n    const x = m.observable({\n        a: {\n            b: {\n                c: 3\n            }\n        }\n    })\n    const b = buffer()\n    m.autorun(function () {\n        b(x.a.b.c)\n    })\n    x.a = { b: { c: 4 } }\n    x.a.b.c = 5 // new structure was reactive as well\n    expect(b.toArray()).toEqual([3, 4, 5])\n\n    // recursive structure, but asReference passed in\n    expect(m.isObservable(x.a.b)).toBe(true)\n    const x2 = m.observable.object(\n        {\n            a: {\n                b: {\n                    c: 3\n                }\n            }\n        },\n        {\n            a: m.observable.ref\n        }\n    )\n\n    expect(m.isObservable(x2)).toBe(true)\n    expect(m.isObservable(x2.a)).toBe(false)\n    expect(m.isObservable(x2.a.b)).toBe(false)\n\n    const b2 = buffer()\n    m.autorun(function () {\n        b2(x2.a.b.c)\n    })\n    x2.a = { b: { c: 4 } }\n    x2.a.b.c = 5 // not picked up, not reactive, since passed as reference\n    expect(b2.toArray()).toEqual([3, 4])\n\n    // non recursive structure\n    const x3 = o.object(\n        {\n            a: {\n                b: {\n                    c: 3\n                }\n            }\n        },\n        {},\n        { deep: false }\n    )\n    const b3 = buffer()\n    m.autorun(function () {\n        b3(x3.a.b.c)\n    })\n    x3.a = { b: { c: 4 } }\n    x3.a.b.c = 5 // sub structure not reactive\n    expect(b3.toArray()).toEqual([3, 4])\n})\n\ntest(\"observable3\", function () {\n    function Order(price) {\n        this.price = price\n    }\n\n    const x = m.observable({\n        orders: [new Order(1), new Order(2)]\n    })\n\n    const b = buffer()\n    m.autorun(function () {\n        b(x.orders.length)\n    })\n\n    expect(m.isObservable(x.orders)).toBe(true)\n    expect(m.isObservable(x.orders[0])).toBe(false)\n    x.orders[2] = new Order(3)\n    x.orders = []\n    expect(m.isObservable(x.orders)).toBe(true)\n    x.orders[0] = new Order(2)\n    expect(b.toArray()).toEqual([2, 3, 0, 1])\n})\n\ntest(\"observable4\", function () {\n    const x = m.observable([{ x: 1 }, { x: 2 }])\n\n    const b = buffer()\n    m.observe(\n        m.computed(function () {\n            return x.map(function (d) {\n                return d.x\n            })\n        }),\n        x => b(x.newValue),\n        true\n    )\n\n    x[0].x = 3\n    x.shift()\n    x.push({ x: 5 })\n    expect(b.toArray()).toEqual([[1, 2], [3, 2], [2], [2, 5]])\n\n    // non recursive\n    const x2 = o.array([{ x: 1 }, { x: 2 }], { deep: false })\n\n    const b2 = buffer()\n    m.observe(\n        m.computed(function () {\n            return x2.map(function (d) {\n                return d.x\n            })\n        }),\n        x => b2(x.newValue),\n        true\n    )\n\n    x2[0].x = 3\n    x2.shift()\n    x2.push({ x: 5 })\n    expect(b2.toArray()).toEqual([[1, 2], [2], [2, 5]])\n})\n\ntest(\"observable5\", function () {\n    let x = m.computed(function () {})\n    expect(function () {\n        x.set(7) // set not allowed\n    }).toThrow(/It is not possible to assign a new value to a computed value/)\n\n    let f = m._autoAction(function () {})\n    const x2 = m.observable.box(f)\n    expect(x2.get()).toBe(f)\n    x2.set(null) // allowed\n\n    f = function () {\n        return this.price\n    }\n    x = m.observable(\n        {\n            price: 17,\n            get reactive() {\n                return this.price\n            },\n            nonReactive: f\n        },\n        {\n            nonReactive: false\n        }\n    )\n\n    const b = buffer()\n    m.autorun(function () {\n        b([x.reactive, x.nonReactive, x.nonReactive()])\n    })\n\n    x.price = 18\n    const three = function () {\n        return 3\n    }\n    // 20.12.2020 @urugator:\n    // Since https://github.com/mobxjs/mobx/pull/2641\n    // the non-observable field won't become suddenly observable on assigment.\n    // Firstly it doesn't make sense,\n    // secondly it's inconsistent - it works like this only for proxies/object api.\n    x.nonReactive = three\n    expect(b.toArray()).toEqual([\n        [17, f, 17],\n        [18, f, 18]\n        //[18, three, 3]\n    ])\n})\n\ntest(\"flat array\", function () {\n    const x = m.observable.object(\n        {\n            x: [\n                {\n                    a: 1\n                }\n            ]\n        },\n        { x: m.observable.shallow }\n    )\n\n    let result\n    let updates = 0\n    m.autorun(function () {\n        updates++\n        result = JSON.stringify(mobx.toJS(x))\n    })\n\n    expect(result).toEqual(JSON.stringify({ x: [{ a: 1 }] }))\n    expect(updates).toBe(1)\n\n    x.x[0].a = 2 // not picked up; object is not made reactive\n    expect(result).toEqual(JSON.stringify({ x: [{ a: 1 }] }))\n    expect(updates).toBe(1)\n\n    x.x.push({ a: 3 }) // picked up, array is reactive\n    expect(result).toEqual(JSON.stringify({ x: [{ a: 2 }, { a: 3 }] }))\n    expect(updates).toBe(2)\n\n    x.x[0] = { a: 4 } // picked up, array is reactive\n    expect(result).toEqual(JSON.stringify({ x: [{ a: 4 }, { a: 3 }] }))\n    expect(updates).toBe(3)\n\n    x.x[1].a = 6 // not picked up\n    expect(result).toEqual(JSON.stringify({ x: [{ a: 4 }, { a: 3 }] }))\n    expect(updates).toBe(3)\n})\n\ntest(\"flat object\", function () {\n    const y = m.observable.object(\n        {\n            x: { z: 3 }\n        },\n        {},\n        { deep: false }\n    )\n\n    let result\n    let updates = 0\n    m.autorun(function () {\n        updates++\n        result = JSON.stringify(mobx.toJS(y))\n    })\n\n    expect(result).toEqual(JSON.stringify({ x: { z: 3 } }))\n    expect(updates).toBe(1)\n\n    y.x.z = 4 // not picked up\n    expect(result).toEqual(JSON.stringify({ x: { z: 3 } }))\n    expect(updates).toBe(1)\n\n    y.x = { z: 5 }\n    expect(result).toEqual(JSON.stringify({ x: { z: 5 } }))\n    expect(updates).toBe(2)\n\n    y.x.z = 6 // not picked up\n    expect(result).toEqual(JSON.stringify({ x: { z: 5 } }))\n    expect(updates).toBe(2)\n})\n\ntest(\"as structure\", function () {\n    const x = m.observable.object(\n        {\n            x: null\n        },\n        {\n            x: m.observable.struct\n        }\n    )\n\n    let changed = 0\n    const dis = m.autorun(function () {\n        changed++\n        JSON.stringify(x)\n    })\n\n    function c() {\n        expect(changed).toBe(1)\n        if (changed !== 1) console.trace()\n        changed = 0\n    }\n\n    function nc() {\n        expect(changed).toBe(0)\n        if (changed !== 0) console.trace()\n        changed = 0\n    }\n\n    // nc = no change, c = changed.\n    c()\n    x.x = null\n    nc()\n    x.x = undefined\n    c()\n    x.x = 3\n    c()\n    x.x = 1 * x.x\n    nc()\n    x.x = \"3\"\n    c()\n\n    x.x = {\n        y: 3\n    }\n    c()\n    x.x.y = 3\n    nc()\n    x.x = {\n        y: 3\n    }\n    nc()\n    x.x = {\n        y: 4\n    }\n    c()\n    x.x = {\n        y: 3\n    }\n    c()\n    x.x = {\n        y: {\n            y: 3\n        }\n    }\n    c()\n    x.x.y.y = 3\n    nc()\n    x.x.y = { y: 3 }\n    nc()\n    x.x = { y: { y: 3 } }\n    nc()\n    x.x = { y: { y: 4 } }\n    c()\n    x.x = {}\n    c()\n    x.x = {}\n    nc()\n\n    x.x = []\n    c()\n    x.x = []\n    nc()\n    x.x = [3, 2, 1]\n    c()\n    x.x.sort()\n    nc()\n    x.x.sort()\n    nc()\n    x.x[1] = 2\n    nc()\n    x.x[0] = 0\n    nc() // not detected\n\n    dis()\n})\n\ntest(\"as structure view\", function () {\n    const x = m.observable.object(\n        {\n            a: 1,\n            aa: 1,\n            get b() {\n                this.a\n                return { a: this.aa }\n            },\n            get c() {\n                this.b\n                return { a: this.aa }\n            }\n        },\n        {\n            c: m.computed({ compareStructural: true })\n        }\n    )\n\n    let bc = 0\n    m.autorun(function () {\n        x.b\n        bc++\n    })\n    expect(bc).toBe(1)\n\n    let cc = 0\n    m.autorun(function () {\n        x.c\n        cc++\n    })\n    expect(cc).toBe(1)\n\n    x.a = 2\n    x.a = 3\n    expect(bc).toBe(3)\n    expect(cc).toBe(1)\n    x.aa = 3\n    expect(bc).toBe(4)\n    expect(cc).toBe(2)\n})\n\ntest(\"540 - extendobservable should not report cycles\", function () {\n    expect(() => m.extendObservable(Object.freeze({}), {})).toThrow(\n        /Cannot make the designated object observable/\n    )\n\n    const objWrapper = mobx.observable({\n        value: null\n    })\n\n    const obj = {\n        name: \"Hello\"\n    }\n\n    objWrapper.value = obj\n    expect(mobx.isObservable(objWrapper.value)).toBeTruthy()\n    expect(() => {\n        mobx.extendObservable(objWrapper, objWrapper.value)\n    }).toThrow(/Extending an object with another observable \\(object\\) is not supported/)\n})\n\ntest(\"mobx 3\", () => {\n    const x = mobx.observable({ a: 1 })\n\n    expect(x === mobx.observable(x)).toBeTruthy()\n\n    const y = mobx.observable.box(null, { deep: false })\n    const obj = { a: 2 }\n    y.set(obj)\n    expect(y.get() === obj).toBeTruthy()\n    expect(mobx.isObservable(y.get())).toBe(false)\n})\n\ntest(\"computed value\", () => {\n    mobx._getGlobalState().mobxGuid = 0\n    const c = mobx.computed(() => 3)\n\n    expect(0 + c).toBe(3)\n    expect(mobx.isComputed(c)).toBe(true)\n    expect(c.toString()).toMatchSnapshot()\n})\n\ntest(\"boxed value json\", () => {\n    const a = mobx.observable.box({ x: 1 })\n    expect(a.get().x).toEqual(1)\n    a.set(3)\n    expect(a.get()).toEqual(3)\n    expect(\"\" + a).toBe(\"3\")\n    expect(a.toJSON()).toBe(3)\n})\n\ntest(\"computed value scope\", () => {\n    const a = mobx.observable({\n        x: 1,\n        get y() {\n            return this.x * 2\n        },\n        set y(v) {\n            this.x = v\n        }\n    })\n\n    expect(a.y).toBe(2)\n    a.x = 2\n    expect(a.y).toBe(4)\n    a.y = 3\n    expect(a.y).toBe(6)\n})\n\ntest(\"shallow array\", () => {\n    const a = mobx.observable.array([], { deep: false })\n    a.push({ x: 1 }, [], 2, mobx.observable({ y: 3 }))\n\n    expect(mobx.isObservable(a)).toBe(true)\n    expect(mobx.isObservable(a[0])).toBe(false)\n    expect(mobx.isObservable(a[1])).toBe(false)\n    expect(mobx.isObservable(a[2])).toBe(false)\n    expect(mobx.isObservable(a[3])).toBe(true)\n})\n\ntest(\"761 - deeply nested modifiers work\", () => {\n    const a = {}\n    mobx.extendObservable(a, {\n        someKey: mobx.observable.object(\n            {\n                someNestedKey: []\n            },\n            {\n                someNestedKey: mobx.observable.ref\n            }\n        )\n    })\n\n    expect(mobx.isObservable(a)).toBe(true)\n    expect(mobx.isObservableProp(a, \"someKey\")).toBe(true)\n    expect(mobx.isObservable(a.someKey)).toBe(true)\n    expect(mobx.isObservableProp(a.someKey, \"someNestedKey\")).toBe(true)\n    expect(mobx.isObservable(a.someKey.someNestedKey)).toBe(false)\n    expect(Array.isArray(a.someKey.someNestedKey)).toBe(true)\n\n    Object.assign(a, { someKey: { someNestedKey: [1, 2, 3] } })\n    expect(mobx.isObservable(a)).toBe(true)\n    expect(mobx.isObservableProp(a, \"someKey\")).toBe(true)\n    expect(mobx.isObservable(a.someKey)).toBe(true)\n    expect(mobx.isObservableProp(a.someKey, \"someNestedKey\")).toBe(true)\n    expect(mobx.isObservable(a.someKey.someNestedKey)).toBe(true) // Too bad: no deep merge with Object.assign! someKey object gets replaced in its entirity\n    expect(Array.isArray(a.someKey.someNestedKey)).toBe(true)\n})\n\ntest(\"compare structurally, ref\", () => {\n    const a = mobx.observable.object(\n        {\n            x: undefined\n        },\n        {\n            x: mobx.observable.struct\n        }\n    )\n\n    let changed = 0\n    const d = mobx.autorun(() => {\n        mobx.toJS(a)\n        changed++\n    })\n\n    expect(changed).toBe(1)\n    a.x = { y: 2 }\n    expect(changed).toBe(2)\n    a.x.y = 3\n    expect(mobx.isObservable(a.x)).toBe(false)\n    expect(changed).toBe(2)\n\n    a.x = { y: 3 }\n    expect(changed).toBe(2)\n\n    a.x = { y: 4 }\n    expect(changed).toBe(3)\n    a.x = { y: 4 }\n    expect(changed).toBe(3)\n\n    d()\n})\n\ntest(\"double declare property\", () => {\n    const o = {}\n    mobx.extendObservable(o, {\n        a: 5\n    })\n    expect(() => {\n        mobx.extendObservable(\n            o,\n            { a: 2 },\n            {\n                a: mobx.observable.ref\n            }\n        )\n    }).toThrow(/The field is already annotated/)\n})\n\ntest(\"structural collections\", () => {\n    const o = mobx.observable(\n        {\n            x: [1, 2, 3]\n        },\n        {\n            x: mobx.observable.struct\n        }\n    )\n\n    expect(mobx.isObservable(o.x)).toBeFalsy()\n    const x = o.x\n    o.x = [1, 2, 3]\n    expect(o.x).toBe(x)\n    expect(() => {\n        o.x = mobx.observable([1, 2, 3])\n    }).toThrow(\"observable.struct should not be used with observable values\")\n})\n\ntest(\"jest is behaving correctly\", () => {\n    const symbol = Symbol(\"test\")\n    const a = []\n    const b = []\n    const c = []\n    a[symbol] = 1\n    b[symbol] = 1\n    c[symbol] = 2\n    expect(a).toEqual(b)\n    expect(a).not.toEqual(c)\n})\n\ntest(\"All non-enumerables should be treated equally!\", () => {\n    const actual1 = {\n        x: 3\n    }\n    Object.defineProperty(actual1, \"test\", {\n        enumerable: false,\n        value: 5\n    })\n\n    const actual2 = {\n        x: 3\n    }\n    const mySymbol = Symbol(\"test\")\n    Object.defineProperty(actual2, mySymbol, {\n        enumerable: false,\n        value: 5\n    })\n\n    expect(actual1).toEqual({ x: 3 })\n    expect(actual2).toEqual({ x: 3 })\n})\n\ntest(\"jest object equals issue - reference\", () => {\n    class Store {\n        constructor() {\n            mobx.extendObservable(this, { x: 3 })\n        }\n    }\n\n    const store = new Store()\n    expect(store).toEqual(new Store())\n})\n\ntest(\"jest object equals issue\", () => {\n    class Store {\n        x = 2\n\n        constructor() {\n            makeObservable(this, {\n                x: mobx.observable\n            })\n\n            this.x = 3\n        }\n    }\n\n    const store = new Store()\n    expect(store).toEqual(new Store())\n})\n\ntest(\"jest array equals issue\", () => {\n    class Store {\n        things = []\n\n        constructor() {\n            makeObservable(this, {\n                things: mobx.observable\n            })\n        }\n    }\n\n    const store = new Store()\n    expect(store.things).toEqual([])\n})\n\ntest(\"#1650, toString is not treated correctly\", () => {\n    const o = { a: \"a\", toString: \"toString\" }\n    const oo = mobx.observable(o)\n    expect(oo.toString).toBe(\"toString\")\n})\n"
  },
  {
    "path": "packages/mobx/__tests__/v5/base/map.js",
    "content": "\"use strict\"\n\nimport * as mobx from \"../../../src/mobx.ts\"\nimport {\n    observable,\n    autorun,\n    makeObservable,\n    computed,\n    action,\n    when,\n    runInAction,\n    configure,\n    _resetGlobalState\n} from \"../../../src/mobx.ts\"\n\nconst map = mobx.observable.map\nconst iterall = require(\"iterall\")\nimport { grabConsole } from \"../../v5/utils/test-utils\"\n\ntest(\"map crud\", function () {\n    mobx._getGlobalState().mobxGuid = 0 // hmm dangerous reset?\n\n    const events = []\n    const m = map({ 1: \"a\" })\n    mobx.observe(m, function (change) {\n        events.push(change)\n        expect(change.observableKind).toBe(\"map\")\n        delete change.observableKind\n        delete change.debugObjectName\n    })\n\n    expect(m.has(\"1\")).toBe(true)\n    expect(m.has(1)).toBe(false)\n    expect(m.get(\"1\")).toBe(\"a\")\n    expect(m.get(\"b\")).toBe(undefined)\n    expect(m.size).toBe(1)\n\n    m.set(\"1\", \"aa\")\n    m.set(1, \"b\")\n    expect(m.has(\"1\")).toBe(true)\n    expect(m.get(\"1\")).toBe(\"aa\")\n    expect(m.get(1)).toBe(\"b\")\n\n    const k = [\"arr\"]\n    m.set(k, \"arrVal\")\n    expect(m.has(k)).toBe(true)\n    expect(m.get(k)).toBe(\"arrVal\")\n\n    const s = Symbol(\"test\")\n    expect(m.has(s)).toBe(false)\n    expect(m.get(s)).toBe(undefined)\n    m.set(s, \"symbol-value\")\n    expect(m.get(s)).toBe(\"symbol-value\")\n    expect(m.get(s.toString())).toBe(undefined)\n\n    expect(mobx.keys(m)).toEqual([\"1\", 1, k, s])\n    expect(mobx.values(m)).toEqual([\"aa\", \"b\", \"arrVal\", \"symbol-value\"])\n    expect(Array.from(m)).toEqual([\n        [\"1\", \"aa\"],\n        [1, \"b\"],\n        [k, \"arrVal\"],\n        [s, \"symbol-value\"]\n    ])\n    expect(new Map(m)).toEqual(\n        new Map([\n            [\"1\", \"aa\"],\n            [1, \"b\"],\n            [k, \"arrVal\"],\n            [s, \"symbol-value\"]\n        ])\n    )\n    expect(JSON.stringify(m)).toMatchInlineSnapshot(\n        `\"[[\"1\",\"aa\"],[1,\"b\"],[[\"arr\"],\"arrVal\"],[null,\"symbol-value\"]]\"`\n    )\n    expect(m.toString()).toBe(\"[object ObservableMap]\")\n    expect(m.size).toBe(4)\n\n    m.clear()\n    expect(mobx.keys(m)).toEqual([])\n    expect(mobx.values(m)).toEqual([])\n    expect(m.toJSON()).toEqual([])\n    expect(m.size).toBe(0)\n\n    expect(m.has(\"a\")).toBe(false)\n    expect(m.has(\"b\")).toBe(false)\n    expect(m.get(\"a\")).toBe(undefined)\n    expect(m.get(\"b\")).toBe(undefined)\n\n    expect(events).toEqual([\n        { object: m, name: \"1\", newValue: \"aa\", oldValue: \"a\", type: \"update\" },\n        { object: m, name: 1, newValue: \"b\", type: \"add\" },\n        { object: m, name: [\"arr\"], newValue: \"arrVal\", type: \"add\" },\n        { object: m, name: s, newValue: \"symbol-value\", type: \"add\" },\n        { object: m, name: \"1\", oldValue: \"aa\", type: \"delete\" },\n        { object: m, name: 1, oldValue: \"b\", type: \"delete\" },\n        { object: m, name: [\"arr\"], oldValue: \"arrVal\", type: \"delete\" },\n        { object: m, name: s, oldValue: \"symbol-value\", type: \"delete\" }\n    ])\n\n    expect(JSON.stringify(m)).toBe(\"[]\")\n})\n\ntest(\"map merge\", function () {\n    const a = map({ a: 1, b: 2, c: 2 })\n    const b = map({ c: 3, d: 4 })\n    a.merge(b)\n    expect(a.toJSON()).toEqual([\n        [\"a\", 1],\n        [\"b\", 2],\n        [\"c\", 3],\n        [\"d\", 4]\n    ])\n})\n\ntest(\"observe value\", function () {\n    const a = map()\n    let hasX = false\n    let valueX = undefined\n    let valueY = undefined\n\n    autorun(function () {\n        hasX = a.has(\"x\")\n    })\n\n    autorun(function () {\n        valueX = a.get(\"x\")\n    })\n\n    autorun(function () {\n        valueY = a.get(\"y\")\n    })\n\n    expect(hasX).toBe(false)\n    expect(valueX).toBe(undefined)\n\n    a.set(\"x\", 3)\n    expect(hasX).toBe(true)\n    expect(valueX).toBe(3)\n\n    a.set(\"x\", 4)\n    expect(hasX).toBe(true)\n    expect(valueX).toBe(4)\n\n    a.delete(\"x\")\n    expect(hasX).toBe(false)\n    expect(valueX).toBe(undefined)\n\n    a.set(\"x\", 5)\n    expect(hasX).toBe(true)\n    expect(valueX).toBe(5)\n\n    expect(valueY).toBe(undefined)\n    a.merge({ y: \"hi\" })\n    expect(valueY).toBe(\"hi\")\n    a.merge({ y: \"hello\" })\n    expect(valueY).toBe(\"hello\")\n\n    a.replace({ y: \"stuff\", z: \"zoef\" })\n    expect(valueY).toBe(\"stuff\")\n    expect(mobx.keys(a)).toEqual([\"y\", \"z\"])\n})\n\ntest(\"initialize with entries\", function () {\n    const thing = [{ x: 3 }]\n    const a = map([\n        [\"a\", 1],\n        [thing, 2]\n    ])\n    expect(Array.from(a)).toEqual([\n        [\"a\", 1],\n        [thing, 2]\n    ])\n})\n\ntest(\"initialize with empty value\", function () {\n    const a = map()\n    const b = map({})\n    const c = map([])\n\n    a.set(\"0\", 0)\n    b.set(\"0\", 0)\n    c.set(\"0\", 0)\n\n    expect(a.toJSON()).toEqual([[\"0\", 0]])\n    expect(b.toJSON()).toEqual([[\"0\", 0]])\n    expect(c.toJSON()).toEqual([[\"0\", 0]])\n})\n\ntest(\"observe collections\", function () {\n    const x = map()\n    let keys, values, entries\n\n    autorun(function () {\n        keys = mobx.keys(x)\n    })\n    autorun(function () {\n        values = iteratorToArray(x.values())\n    })\n    autorun(function () {\n        entries = iteratorToArray(x.entries())\n    })\n\n    x.set(\"a\", 1)\n    expect(keys).toEqual([\"a\"])\n    expect(values).toEqual([1])\n    expect(entries).toEqual([[\"a\", 1]])\n\n    // should not retrigger:\n    keys = null\n    values = null\n    entries = null\n    x.set(\"a\", 1)\n    expect(keys).toEqual(null)\n    expect(values).toEqual(null)\n    expect(entries).toEqual(null)\n\n    x.set(\"a\", 2)\n    expect(values).toEqual([2])\n    expect(entries).toEqual([[\"a\", 2]])\n\n    x.set(\"b\", 3)\n    expect(keys).toEqual([\"a\", \"b\"])\n    expect(values).toEqual([2, 3])\n    expect(entries).toEqual([\n        [\"a\", 2],\n        [\"b\", 3]\n    ])\n\n    x.has(\"c\")\n    expect(keys).toEqual([\"a\", \"b\"])\n    expect(values).toEqual([2, 3])\n    expect(entries).toEqual([\n        [\"a\", 2],\n        [\"b\", 3]\n    ])\n\n    x.delete(\"a\")\n    expect(keys).toEqual([\"b\"])\n    expect(values).toEqual([3])\n    expect(entries).toEqual([[\"b\", 3]])\n})\n\ntest(\"cleanup\", function () {\n    const x = map({ a: 1 })\n\n    let aValue\n    const disposer = autorun(function () {\n        aValue = x.get(\"a\")\n    })\n\n    let observable = x.data_.get(\"a\")\n\n    expect(aValue).toBe(1)\n    expect(observable.observers_.size).toBe(1)\n    expect(x.hasMap_.get(\"a\").observers_.size).toBe(1)\n\n    expect(x.delete(\"a\")).toBe(true)\n    expect(x.delete(\"not-existing\")).toBe(false)\n\n    expect(aValue).toBe(undefined)\n    expect(observable.observers_.size).toBe(0)\n    expect(x.hasMap_.get(\"a\").observers_.size).toBe(1)\n\n    x.set(\"a\", 2)\n    observable = x.data_.get(\"a\")\n\n    expect(aValue).toBe(2)\n    expect(observable.observers_.size).toBe(1)\n    expect(x.hasMap_.get(\"a\").observers_.size).toBe(1)\n\n    disposer()\n    expect(aValue).toBe(2)\n    expect(observable.observers_.size).toBe(0)\n    expect(x.hasMap_.has(\"a\")).toBe(false)\n})\n\ntest(\"getAtom encapsulation leak test\", function () {\n    const x = map({})\n\n    let disposer = autorun(function () {\n        x.has(\"a\")\n    })\n\n    let atom = mobx.getAtom(x, \"a\")\n\n    disposer()\n\n    expect(x.hasMap_.get(\"a\")).toBe(undefined)\n\n    disposer = autorun(function () {\n        x.has(\"a\")\n        atom && atom.reportObserved()\n    })\n\n    expect(x.hasMap_.get(\"a\")).not.toBe(atom)\n})\n\ntest(\"strict\", function () {\n    const x = map()\n    autorun(function () {\n        x.get(\"y\") // should not throw\n    })\n})\n\ntest(\"issue 100\", function () {\n    const that = {}\n    mobx.extendObservable(that, {\n        myMap: map()\n    })\n    expect(mobx.isObservableMap(that.myMap)).toBe(true)\n})\n\ntest(\"issue 119 - unobserve before delete\", function () {\n    const propValues = []\n    const myObservable = mobx.observable({\n        myMap: map()\n    })\n    myObservable.myMap.set(\"myId\", {\n        myProp: \"myPropValue\",\n        get myCalculatedProp() {\n            if (myObservable.myMap.has(\"myId\"))\n                return myObservable.myMap.get(\"myId\").myProp + \" calculated\"\n            return undefined\n        }\n    })\n    // the error only happens if the value is observed\n    mobx.autorun(function () {\n        mobx.values(myObservable.myMap).forEach(function (value) {\n            propValues.push(value.myCalculatedProp)\n        })\n    })\n    myObservable.myMap.delete(\"myId\")\n\n    expect(propValues).toEqual([\"myPropValue calculated\"])\n})\n\ntest(\"issue 116 - has should not throw on invalid keys\", function () {\n    const x = map()\n    expect(x.has(undefined)).toBe(false)\n    expect(x.has({})).toBe(false)\n    expect(x.get({})).toBe(undefined)\n    expect(x.get(undefined)).toBe(undefined)\n})\n\ntest(\"map modifier\", () => {\n    let x = mobx.observable.map({ a: 1 })\n    expect(mobx.isObservableMap(x)).toBe(true)\n    expect(x.get(\"a\")).toBe(1)\n    x.set(\"b\", {})\n    expect(mobx.isObservableObject(x.get(\"b\"))).toBe(true)\n\n    x = mobx.observable.map([[\"a\", 1]])\n    expect(x.get(\"a\")).toBe(1)\n\n    x = mobx.observable.map()\n    expect(mobx.keys(x)).toEqual([])\n\n    x = mobx.observable({ a: mobx.observable.map({ b: { c: 3 } }) })\n    expect(mobx.isObservableObject(x)).toBe(true)\n    expect(mobx.isObservableObject(x.a)).toBe(false)\n    expect(mobx.isObservableMap(x.a)).toBe(true)\n    expect(mobx.isObservableObject(x.a.get(\"b\"))).toBe(true)\n})\n\ntest(\"map modifier with modifier\", () => {\n    let x = mobx.observable.map({ a: { c: 3 } })\n    expect(mobx.isObservableObject(x.get(\"a\"))).toBe(true)\n    x.set(\"b\", { d: 4 })\n    expect(mobx.isObservableObject(x.get(\"b\"))).toBe(true)\n\n    x = mobx.observable.map({ a: { c: 3 } }, { deep: false })\n    expect(mobx.isObservableObject(x.get(\"a\"))).toBe(false)\n    x.set(\"b\", { d: 4 })\n    expect(mobx.isObservableObject(x.get(\"b\"))).toBe(false)\n\n    x = mobx.observable({ a: mobx.observable.map({ b: {} }, { deep: false }) })\n    expect(mobx.isObservableObject(x)).toBe(true)\n    expect(mobx.isObservableMap(x.a)).toBe(true)\n    expect(mobx.isObservableObject(x.a.get(\"b\"))).toBe(false)\n    x.a.set(\"e\", {})\n    expect(mobx.isObservableObject(x.a.get(\"e\"))).toBe(false)\n})\n\ntest(\"256, map.clear should not be tracked\", () => {\n    const x = mobx.observable.map({ a: 3 })\n    let c = 0\n    const d = mobx.autorun(() => {\n        c++\n        x.clear()\n    })\n\n    expect(c).toBe(1)\n    x.set(\"b\", 3)\n    expect(c).toBe(1)\n\n    d()\n})\n\ntest(\"256, map.merge should be not be tracked for target\", () => {\n    const x = mobx.observable.map({ a: 3 })\n    const y = mobx.observable.map({ b: 3 })\n    let c = 0\n\n    const d = mobx.autorun(() => {\n        c++\n        x.merge(y)\n    })\n\n    expect(c).toBe(1)\n    expect(mobx.keys(x)).toEqual([\"a\", \"b\"])\n\n    y.set(\"c\", 4)\n    expect(c).toBe(2)\n    expect(mobx.keys(x)).toEqual([\"a\", \"b\", \"c\"])\n\n    x.set(\"d\", 5)\n    expect(c).toBe(2)\n    expect(mobx.keys(x)).toEqual([\"a\", \"b\", \"c\", \"d\"])\n\n    d()\n})\n\ntest(\"308, map keys should be coerced to strings correctly\", () => {\n    const m = mobx.observable.map()\n    m.set(1, true)\n    m.delete(1)\n    expect(mobx.keys(m)).toEqual([])\n\n    m.set(1, true)\n    m.set(\"1\", false)\n    m.set(0, true)\n    m.set(-0, false)\n    expect(Array.from(mobx.keys(m))).toEqual([1, \"1\", 0])\n    expect(m.get(-0)).toBe(false)\n    expect(m.get(1)).toBe(true)\n\n    m.delete(\"1\")\n    expect(Array.from(mobx.keys(m))).toEqual([1, 0])\n\n    m.delete(1)\n    expect(mobx.keys(m)).toEqual([0])\n\n    m.set(true, true)\n    expect(m.get(\"true\")).toBe(undefined)\n    expect(m.get(true)).toBe(true)\n    m.delete(true)\n    expect(mobx.keys(m)).toEqual([0])\n})\n\ntest(\"map should support iterall / iterable \", () => {\n    const a = mobx.observable.map({ a: 1, b: 2 })\n\n    function leech(iter) {\n        const values = []\n        let v\n        do {\n            v = iter.next()\n            if (!v.done) values.push(v.value)\n        } while (!v.done)\n        return values\n    }\n\n    expect(iterall.isIterable(a)).toBe(true)\n\n    expect(leech(iterall.getIterator(a))).toEqual([\n        [\"a\", 1],\n        [\"b\", 2]\n    ])\n\n    expect(leech(a.entries())).toEqual([\n        [\"a\", 1],\n        [\"b\", 2]\n    ])\n\n    expect(leech(a.keys())).toEqual([\"a\", \"b\"])\n    expect(leech(a.values())).toEqual([1, 2])\n})\n\ntest(\"support for ES6 Map\", () => {\n    const x = new Map()\n    x.set(\"x\", 3)\n    x.set(\"y\", 2)\n\n    const m = mobx.observable(x)\n    expect(mobx.isObservableMap(m)).toBe(true)\n    expect(Array.from(m)).toEqual([\n        [\"x\", 3],\n        [\"y\", 2]\n    ])\n\n    const x2 = new Map()\n    x2.set(\"y\", 4)\n    x2.set(\"z\", 5)\n    m.merge(x2)\n    expect(m.get(\"z\")).toEqual(5)\n\n    const x3 = new Map()\n    x3.set({ y: 2 }, { z: 4 })\n})\n\ntest(\"deepEqual map\", () => {\n    const x = new Map()\n    x.set(\"x\", 3)\n    x.set(\"y\", { z: 2 })\n\n    const x2 = mobx.observable.map()\n    x2.set(\"x\", 3)\n    x2.set(\"y\", { z: 3 })\n\n    expect(mobx.comparer.structural(x, x2)).toBe(false)\n    x2.get(\"y\").z = 2\n    expect(mobx.comparer.structural(x, x2)).toBe(true)\n\n    x2.set(\"z\", 1)\n    expect(mobx.comparer.structural(x, x2)).toBe(false)\n    x2.delete(\"z\")\n    expect(mobx.comparer.structural(x, x2)).toBe(true)\n    x2.delete(\"y\")\n    expect(mobx.comparer.structural(x, x2)).toBe(false)\n})\n\ntest(\"798, cannot return observable map from computed prop\", () => {\n    // MWE: this is an anti pattern, yet should be possible in certain cases nonetheless..?\n    // https://jsfiddle.net/7e6Ltscr/\n\n    const form = function () {\n        const form = mobx.observable({\n            reactPropsMap: mobx.observable.map({\n                onSubmit: function () {}\n            }),\n            model: {\n                value: \"TEST\"\n            }\n        })\n\n        form.reactPropsMap.set(\"onSubmit\", function () {})\n\n        return form\n    }\n\n    const customerSearchStore = function () {\n        const customerSearchStore = mobx.observable({\n            customerType: \"RUBY\",\n            searchTypeFormStore() {\n                return form(customerSearchStore.customerType)\n            },\n            customerSearchType() {\n                return form(customerSearchStore.searchTypeFormStore.model.value)\n            }\n        })\n        return customerSearchStore\n    }\n    const cs = customerSearchStore()\n\n    expect(() => {\n        Object.assign({}, cs.customerSearchType)\n    }).not.toThrow()\n})\n\ntest(\"869, deeply observable map should make added items observables as well\", () => {\n    const store = {\n        map_deep1: mobx.observable(new Map()),\n        map_deep2: mobx.observable.map()\n    }\n\n    expect(mobx.isObservable(store.map_deep1)).toBeTruthy()\n    expect(mobx.isObservableMap(store.map_deep1)).toBeTruthy()\n    expect(mobx.isObservable(store.map_deep2)).toBeTruthy()\n    expect(mobx.isObservableMap(store.map_deep2)).toBeTruthy()\n\n    store.map_deep2.set(\"a\", [])\n    expect(mobx.isObservable(store.map_deep2.get(\"a\"))).toBeTruthy()\n\n    store.map_deep1.set(\"a\", [])\n    expect(mobx.isObservable(store.map_deep1.get(\"a\"))).toBeTruthy()\n})\n\ntest(\"using deep map\", () => {\n    const store = {\n        map_deep: mobx.observable(new Map())\n    }\n    const seen = []\n\n    // Creating autorun triggers one observation, hence -1\n    let observed = -1\n    mobx.autorun(function () {\n        // Use the map, to observe all changes\n        seen.push(store.map_deep.toJSON())\n        // JSON.stringify(store.map_deep)\n        observed++\n    })\n\n    store.map_deep.set(\"shoes\", [])\n    expect(observed).toBe(1)\n    expect(seen).toEqual([[], [[\"shoes\", []]]])\n\n    store.map_deep.get(\"shoes\").push({ color: \"black\" })\n    expect(seen).toEqual([\n        [],\n        // N.B. although the referred array changed, it didn't trigger a change in the map itself,\n        // and is hence not observed by the autorun!\n        [[\"shoes\", [{ color: \"black\" }]]]\n    ])\n\n    expect(observed).toBe(1)\n\n    store.map_deep.get(\"shoes\")[0].color = \"red\"\n    // see above comment\n    expect(seen).toEqual([[], [[\"shoes\", [{ color: \"red\" }]]]])\n    expect(observed).toBe(1)\n})\n\ntest(\"using deep map - toJS\", () => {\n    const store = {\n        map_deep: mobx.observable(new Map())\n    }\n    const seen = []\n\n    // Creating autorun triggers one observation, hence -1\n    let observed = -1\n    mobx.autorun(function () {\n        // Use the map, to observe all changes\n        seen.push(mobx.toJS(store.map_deep))\n        // JSON.stringify(store.map_deep)\n        observed++\n    })\n\n    store.map_deep.set(\"shoes\", [])\n    expect(observed).toBe(1)\n    expect(seen).toEqual([new Map(), new Map([[\"shoes\", []]])])\n\n    store.map_deep.get(\"shoes\").push({ color: \"black\" })\n    expect(seen).toEqual([\n        new Map([]),\n        new Map([[\"shoes\", []]]),\n        new Map([[\"shoes\", [{ color: \"black\" }]]])\n    ])\n\n    expect(observed).toBe(2)\n    store.map_deep.get(\"shoes\")[0].color = \"red\"\n    // see above comment\n    expect(seen).toEqual([\n        new Map([]),\n        new Map([[\"shoes\", []]]),\n        new Map([[\"shoes\", [{ color: \"black\" }]]]),\n        new Map([[\"shoes\", [{ color: \"red\" }]]])\n    ])\n    expect(observed).toBe(3)\n})\n\ntest(\"issue 893\", () => {\n    const m = mobx.observable.map()\n    const keys = [\"constructor\", \"toString\", \"assertValidKey\", \"isValidKey\", \"toJSON\", \"toJS\"]\n    for (let key of keys) {\n        expect(m.get(key)).toBe(undefined)\n    }\n})\n\ntest(\"work with 'toString' key\", () => {\n    const m = mobx.observable.map()\n    expect(m.get(\"toString\")).toBe(undefined)\n    m.set(\"toString\", \"test\")\n    expect(m.get(\"toString\")).toBe(\"test\")\n})\n\ntest(\"issue 940, should not be possible to change maps outside strict mode\", () => {\n    mobx.configure({ enforceActions: \"observed\" })\n\n    try {\n        const m = mobx.observable.map()\n        const d = mobx.autorun(() => mobx.values(m))\n\n        expect(\n            grabConsole(() => {\n                m.set(\"x\", 1)\n            })\n        ).toMatchInlineSnapshot(\n            `\"<STDOUT> [MobX] Since strict-mode is enabled, changing (observed) observable values without using an action is not allowed. Tried to modify: ObservableMap@56.keys()\"`\n        )\n\n        expect(\n            grabConsole(() => {\n                m.set(\"x\", 2)\n            })\n        ).toMatchInlineSnapshot(\n            `\"<STDOUT> [MobX] Since strict-mode is enabled, changing (observed) observable values without using an action is not allowed. Tried to modify: ObservableMap@56.x\"`\n        )\n\n        expect(\n            grabConsole(() => {\n                m.delete(\"x\")\n            })\n        ).toMatchInlineSnapshot(\n            `\"<STDOUT> [MobX] Since strict-mode is enabled, changing (observed) observable values without using an action is not allowed. Tried to modify: ObservableMap@56.keys()\"`\n        )\n\n        d()\n    } finally {\n        mobx.configure({ enforceActions: \"never\" })\n    }\n})\n\ntest(\"issue 1243, .replace should not trigger change on unchanged values\", () => {\n    const m = mobx.observable.map({ a: 1, b: 2, c: 3 })\n\n    let recomputeCount = 0\n    const computedValue = mobx.computed(() => {\n        recomputeCount++\n        return m.get(\"a\")\n    })\n\n    const d = mobx.autorun(() => {\n        computedValue.get()\n    })\n\n    // recompute should happen once by now, due to the autorun\n    expect(recomputeCount).toBe(1)\n\n    // a hasn't changed, recompute should not happen\n    m.replace({ a: 1, d: 5 })\n\n    expect(recomputeCount).toBe(1)\n\n    // this should cause a recompute\n    m.replace({ a: 2 })\n    expect(recomputeCount).toBe(2)\n\n    // this should remove key a and cause a recompute\n    m.replace({ b: 2 })\n    expect(recomputeCount).toBe(3)\n\n    m.replace([[\"a\", 1]])\n    expect(recomputeCount).toBe(4)\n\n    const nativeMap = new Map()\n    nativeMap.set(\"a\", 2)\n    m.replace(nativeMap)\n    expect(recomputeCount).toBe(5)\n\n    expect(() => {\n        m.replace(\"not-an-object\")\n    }).toThrow(\"[MobX] Cannot convert to map from 'not-an-object'\")\n\n    d()\n})\n\ntest(\"#1980 .replace should not breaks entities order!\", () => {\n    const original = mobx.observable.map([\n        [\"a\", \"first\"],\n        [\"b\", \"second\"]\n    ])\n    const replacement = new Map([\n        [\"b\", \"first\"],\n        [\"a\", \"second\"]\n    ])\n    original.replace(replacement)\n    const newKeys = Array.from(replacement)\n    const originalKeys = Array.from(replacement)\n    for (let i = 0; i < newKeys.length; i++) {\n        expect(newKeys[i]).toEqual(originalKeys[i])\n    }\n})\n\ntest(\"#1980 .replace should invoke autorun\", () => {\n    const original = mobx.observable.map({ a: \"a\", b: \"b\" })\n    const replacement = { b: \"b\", a: \"a\" }\n    let numOfInvokes = 0\n    autorun(() => {\n        numOfInvokes = numOfInvokes + 1\n        return original.entries().next()\n    })\n    original.replace(replacement)\n    const orgKeys = Array.from(original.keys())\n    const newKeys = Object.keys(replacement)\n    for (let i = 0; i < newKeys.length; i++) {\n        expect(newKeys[i]).toEqual(orgKeys[i])\n    }\n    expect(numOfInvokes).toBe(2)\n})\n\ntest(\"#1980 .replace should not report changed unnecessarily\", () => {\n    const mapArray = [\n        [\"swappedA\", \"swappedA\"],\n        [\"swappedB\", \"swappedB\"],\n        [\"removed\", \"removed\"]\n    ]\n    const replacementArray = [mapArray[1], mapArray[0], [\"added\", \"added\"]]\n    const map = mobx.observable.map(mapArray)\n    let autorunInvocationCount = 0\n    autorun(() => {\n        map.get(\"swappedA\")\n        map.get(\"swappedB\")\n        autorunInvocationCount++\n    })\n    map.replace(replacementArray)\n    expect(Array.from(map.entries())).toEqual(replacementArray)\n    expect(autorunInvocationCount).toBe(1)\n})\n\ntest(\"#1258 cannot replace maps anymore\", () => {\n    const items = mobx.observable.map()\n    items.replace(mobx.observable.map())\n})\n\ntest(\"can iterate maps\", () => {\n    const x = mobx.observable.map()\n    const y = []\n    const d = mobx.reaction(\n        () => Array.from(x),\n        items => y.push(items),\n        { fireImmediately: true }\n    )\n\n    x.set(\"a\", \"A\")\n    x.set(\"b\", \"B\")\n    expect(y).toEqual([\n        [],\n        [[\"a\", \"A\"]],\n        [\n            [\"a\", \"A\"],\n            [\"b\", \"B\"]\n        ]\n    ])\n    d()\n})\n\nfunction iteratorToArray(it) {\n    const res = []\n    while (true) {\n        const r = it.next()\n        if (!r.done) {\n            res.push(r.value)\n        } else {\n            break\n        }\n    }\n    return res\n}\n\ntest(\"can iterate map - entries\", () => {\n    const x = mobx.observable.map()\n    const y = []\n    const d = mobx.reaction(\n        () => iteratorToArray(x.entries()),\n        items => y.push(items),\n        {\n            fireImmediately: true\n        }\n    )\n\n    x.set(\"a\", \"A\")\n    x.set(\"b\", \"B\")\n    expect(y).toEqual([\n        [],\n        [[\"a\", \"A\"]],\n        [\n            [\"a\", \"A\"],\n            [\"b\", \"B\"]\n        ]\n    ])\n    d()\n})\n\ntest(\"can iterate map - keys\", () => {\n    const x = mobx.observable.map()\n    const y = []\n    const d = mobx.reaction(\n        () => iteratorToArray(x.keys()),\n        items => y.push(items),\n        {\n            fireImmediately: true\n        }\n    )\n\n    x.set(\"a\", \"A\")\n    x.set(\"b\", \"B\")\n    expect(y).toEqual([[], [\"a\"], [\"a\", \"b\"]])\n    d()\n})\n\ntest(\"can iterate map - values\", () => {\n    const x = mobx.observable.map()\n    const y = []\n    const d = mobx.reaction(\n        () => iteratorToArray(x.values()),\n        items => y.push(items),\n        {\n            fireImmediately: true\n        }\n    )\n\n    x.set(\"a\", \"A\")\n    x.set(\"b\", \"B\")\n    expect(y).toEqual([[], [\"A\"], [\"A\", \"B\"]])\n    d()\n})\n\ntest(\"NaN as map key\", function () {\n    const a = map(new Map([[NaN, 0]]))\n    expect(a.has(NaN)).toBe(true)\n    expect(a.get(NaN)).toBe(0)\n    a.set(NaN, 1)\n    a.merge(map(new Map([[NaN, 2]])))\n    expect(a.get(NaN)).toBe(2)\n    expect(a.size).toBe(1)\n})\n\ntest(\"maps.values, keys and maps.entries are iterables\", () => {\n    const x = mobx.observable.map({ x: 1, y: 2 })\n    expect(Array.from(x.entries())).toEqual([\n        [\"x\", 1],\n        [\"y\", 2]\n    ])\n    expect(Array.from(x.values())).toEqual([1, 2])\n    expect(Array.from(x.keys())).toEqual([\"x\", \"y\"])\n})\n\n// Test support for [iterator-helpers](https://github.com/tc39/proposal-iterator-helpers)\ntest(\"esnext iterator helpers support\", () => {\n    const map = mobx.observable(\n        new Map([\n            [\"x\", [1, 2]],\n            [\"y\", [3, 4]]\n        ])\n    )\n\n    expect(Array.from(map.keys().map(value => value))).toEqual([\"x\", \"y\"])\n    expect(Array.from(map.values().map(value => value))).toEqual([\n        [1, 2],\n        [3, 4]\n    ])\n    expect(Array.from(map.entries().map(([, value]) => value))).toEqual([\n        [1, 2],\n        [3, 4]\n    ])\n\n    expect(Array.from(map.entries().take(1))).toEqual([[\"x\", [1, 2]]])\n    expect(Array.from(map.entries().drop(1))).toEqual([[\"y\", [3, 4]]])\n    expect(Array.from(map.entries().filter(([key]) => key === \"y\"))).toEqual([[\"y\", [3, 4]]])\n    expect(Array.from(map.entries().find(([key]) => key === \"y\"))).toEqual([\"y\", [3, 4]])\n    expect(map.entries().toArray()).toEqual(Array.from(map))\n\n    expect(map.entries().toString()).toEqual(\"[object MapIterator]\")\n})\n\ntest(\"toStringTag\", () => {\n    const x = mobx.observable.map({ x: 1, y: 2 })\n    expect(x[Symbol.toStringTag]).toBe(\"Map\")\n    expect(Object.prototype.toString.call(x)).toBe(\"[object Map]\")\n})\n\ntest(\"#1583 map.size not reactive\", () => {\n    const map = mobx.observable(new Map())\n    const sizes = []\n\n    const d = autorun(() => {\n        sizes.push(map.size)\n    })\n\n    map.set(1, 1)\n    map.set(2, 2)\n    d()\n    map.set(3, 3)\n    expect(sizes).toEqual([0, 1, 2])\n})\n\ntest(\"#1858 Map should not be inherited\", () => {\n    class MyMap extends Map {}\n\n    const map = new MyMap()\n    expect(() => {\n        mobx.observable.map(map)\n    }).toThrow(\"Cannot initialize from classes that inherit from Map: MyMap\")\n})\n\ntest(\"#2274\", () => {\n    const myMap = mobx.observable.map()\n    myMap.set(1, 1)\n    myMap.set(2, 1)\n    myMap.set(3, 1)\n\n    const newMap = mobx.observable.map()\n    newMap.set(4, 1)\n    newMap.set(5, 1)\n    newMap.set(6, 1)\n\n    myMap.replace(newMap)\n\n    expect(Array.from(myMap.data_.keys())).toEqual([4, 5, 6])\n    expect(myMap.has(2)).toBe(false)\n})\n\ntest(\".forEach() subscribes for key changes\", () => {\n    const map = mobx.observable.map()\n    let autorunInvocationCount = 0\n\n    autorun(() => {\n        autorunInvocationCount++\n        map.forEach(_ => {})\n    })\n\n    map.set(1, 1)\n    map.set(2, 2)\n    map.delete(1)\n\n    expect(autorunInvocationCount).toBe(4)\n})\n\ntest(\".keys() subscribes for key changes\", () => {\n    const map = mobx.observable.map()\n    let autorunInvocationCount = 0\n\n    autorun(() => {\n        autorunInvocationCount++\n        for (const _ of map.keys()) {\n            // empty\n        }\n    })\n\n    map.set(1, 1)\n    map.set(2, 2)\n    map.delete(1)\n\n    expect(autorunInvocationCount).toBe(4)\n})\n\ntest(\".values() subscribes for key changes\", () => {\n    const map = mobx.observable.map()\n    let autorunInvocationCount = 0\n\n    autorun(() => {\n        autorunInvocationCount++\n        for (const _ of map.values()) {\n            // empty\n        }\n    })\n\n    map.set(1, 1)\n    map.set(2, 2)\n    map.delete(1)\n\n    expect(autorunInvocationCount).toBe(4)\n})\n\ntest(\".entries() subscribes for key changes\", () => {\n    const map = mobx.observable.map()\n    let autorunInvocationCount = 0\n\n    autorun(() => {\n        autorunInvocationCount++\n        for (const _ of map.entries()) {\n            // empty\n        }\n    })\n\n    map.set(1, 1)\n    map.set(2, 2)\n    map.delete(1)\n\n    expect(autorunInvocationCount).toBe(4)\n})\n\ntest(\".toJSON() subscribes for key changes\", () => {\n    const map = mobx.observable.map()\n    let autorunInvocationCount = 0\n\n    autorun(() => {\n        autorunInvocationCount++\n        map.toJSON()\n    })\n\n    map.set(1, 1)\n    map.set(2, 2)\n    map.delete(1)\n\n    expect(autorunInvocationCount).toBe(4)\n})\n\ntest(\".entries() subscribes for value changes\", () => {\n    const map = mobx.observable.map([\n        [1, 1],\n        [2, 2],\n        [3, 3]\n    ])\n    let autorunInvocationCount = 0\n\n    autorun(() => {\n        autorunInvocationCount++\n        for (const _ of map.entries()) {\n            // empty\n        }\n    })\n\n    map.set(1, 11)\n    map.set(2, 22)\n    map.set(3, 33)\n\n    expect(autorunInvocationCount).toBe(4)\n})\n\ntest(\".values() subscribes for value changes\", () => {\n    const map = mobx.observable.map([\n        [1, 1],\n        [2, 2],\n        [3, 3]\n    ])\n    let autorunInvocationCount = 0\n\n    autorun(() => {\n        autorunInvocationCount++\n        for (const _ of map.values()) {\n            // empty\n        }\n    })\n\n    map.set(1, 11)\n    map.set(2, 22)\n    map.set(3, 33)\n\n    expect(autorunInvocationCount).toBe(4)\n})\n\ntest(\".forEach() subscribes for value changes\", () => {\n    const map = mobx.observable.map([\n        [1, 1],\n        [2, 2],\n        [3, 3]\n    ])\n    let autorunInvocationCount = 0\n\n    autorun(() => {\n        autorunInvocationCount++\n        map.forEach(_ => {})\n    })\n\n    map.set(1, 11)\n    map.set(2, 22)\n    map.set(3, 33)\n\n    expect(autorunInvocationCount).toBe(4)\n})\n\ntest(\".toJSON() subscribes for value changes\", () => {\n    const map = mobx.observable.map([\n        [1, 1],\n        [2, 2],\n        [3, 3]\n    ])\n    let autorunInvocationCount = 0\n\n    autorun(() => {\n        autorunInvocationCount++\n        map.toJSON()\n    })\n\n    map.set(1, 11)\n    map.set(2, 22)\n    map.set(3, 33)\n\n    expect(autorunInvocationCount).toBe(4)\n})\n\ntest(\".keys() does NOT subscribe for value changes\", () => {\n    const map = mobx.observable.map([\n        [1, 1],\n        [2, 2],\n        [3, 3]\n    ])\n    let autorunInvocationCount = 0\n\n    autorun(() => {\n        autorunInvocationCount++\n        for (const _ of map.keys()) {\n            // empty\n        }\n    })\n\n    map.set(1, 11)\n    map.set(2, 22)\n    map.set(3, 33)\n\n    expect(autorunInvocationCount).toBe(1)\n})\n\ntest(\"noop mutations do NOT reportChanges\", () => {\n    const map = mobx.observable.map([\n        [1, 1],\n        [2, 2],\n        [3, 3]\n    ])\n    let autorunInvocationCount = 0\n\n    autorun(() => {\n        autorunInvocationCount++\n        map.forEach(_ => {})\n    })\n\n    map.set(1, 1)\n    map.set(2, 2)\n    map.set(3, 3)\n    map.delete(\"NOT IN MAP\")\n    map.merge([])\n    map.merge([\n        [1, 1],\n        [3, 3]\n    ])\n    map.merge([\n        [1, 1],\n        [2, 2],\n        [3, 3]\n    ])\n    map.replace([\n        [1, 1],\n        [2, 2],\n        [3, 3]\n    ])\n\n    expect(autorunInvocationCount).toBe(1)\n})\n\ntest(\".replace() calls and respects interceptors\", () => {\n    const map = mobx.observable.map([\n        [0, 0],\n        [1, 1],\n        [2, 2],\n        [3, 3]\n    ])\n    const replacementMap = [\n        [3, 33],\n        [4, 44],\n        [5, 55],\n        [0, 0]\n    ]\n    const expectedMap = [\n        [2, 2],\n        [3, 3],\n        [5, 55],\n        [0, 0]\n    ]\n\n    mobx.intercept(map, change => {\n        // cancel delete 2\n        if (change.type === \"delete\" && change.name === 2) {\n            return null\n        }\n        // cancel update 3\n        if (change.type === \"update\" && change.name === 3) {\n            return null\n        }\n        // cancel add 4\n        if (change.type === \"add\" && change.name === 4) {\n            return null\n        }\n        return change\n    })\n\n    map.replace(replacementMap)\n\n    expect(Array.from(map)).toEqual(expectedMap)\n})\n\ntest(\".replace() should reportChanged on key order change\", () => {\n    const map = mobx.observable.map([\n        [1, 1],\n        [2, 2],\n        [3, 3]\n    ])\n    const replacementMap = [\n        [4, 44],\n        [3, 33],\n        [2, 22]\n    ]\n    const expectedMap = [\n        [1, 1],\n        [3, 33],\n        [2, 22]\n    ]\n    let autorunInvocationCount = 0\n\n    mobx.intercept(map, change => {\n        // cancel delete 1\n        if (change.type === \"delete\" && change.name === 1) {\n            return null\n        }\n        // cancel add 4\n        if (change.type === \"add\" && change.name === 4) {\n            return null\n        }\n        return change\n    })\n\n    autorun(() => {\n        autorunInvocationCount++\n        for (const _ of map.keys()) {\n            // empty\n        }\n    })\n\n    map.replace(replacementMap)\n\n    expect(Array.from(map)).toEqual(expectedMap)\n    expect(autorunInvocationCount).toBe(2)\n})\n\ntest(\"#2112 - iterators should be resilient to concurrent delete operation\", () => {\n    function testIterator(method) {\n        const map = mobx.observable.map([\n            [1, 1],\n            [2, 2],\n            [3, 3]\n        ])\n        const expectedMap = mobx.observable.map(map)\n        for (const entry of map[method]()) {\n            const key = Array.isArray(entry) ? entry[0] : entry\n            const deleted1 = map.delete(key)\n            const deleted2 = expectedMap.delete(key)\n            expect(deleted1).toBe(true)\n            expect(deleted2).toBe(true)\n            expect(map.size).toBe(expectedMap.size)\n            expect(Array.from(map)).toEqual(Array.from(expectedMap))\n        }\n    }\n\n    testIterator(\"keys\")\n    testIterator(\"values\")\n    testIterator(\"entries\")\n})\n\ntest(\"2346 - subscribe to not yet existing map keys\", async () => {\n    const events = observable([])\n\n    class Compute {\n        values = observable.map()\n\n        @computed get get42() {\n            return this.get(42)\n        }\n\n        constructor() {\n            makeObservable(this)\n        }\n\n        get(k) {\n            if (this.values.has(k)) return this.values.get(k)\n            this.fetchValue(k)\n            return this.values.get(k)\n        }\n\n        fetchValue = action(k => {\n            let v = k\n            this.values.set(k, k)\n            setImmediate(() =>\n                runInAction(() => {\n                    v *= 2\n                    this.values.set(k, v)\n                })\n            )\n        })\n    }\n\n    const c = new Compute()\n\n    autorun(() => events.push(c.get42))\n\n    await when(() => events.length > 1)\n    expect(events).toEqual([42, 84])\n})\n\ntest('initialization should not violate `enforceActions: \"always\"` - discussion #3255', async () => {\n    const consoleWarnSpy = jest.spyOn(console, \"warn\").mockImplementation(() => {\n        throw new Error(\"console.warn called\")\n    })\n    configure({ enforceActions: \"always\" })\n    observable(new Map([[\"x\", \"x\"]]))\n    _resetGlobalState()\n    consoleWarnSpy.mockRestore()\n})\n"
  },
  {
    "path": "packages/mobx/__tests__/v5/base/nested.js",
    "content": "\"use strict\"\n\nimport { extendObservable, observable, autorun, computed, runInAction } from \"../../../src/mobx\"\n\ntest(\"nested computeds should not run unnecessary\", () => {\n    function Item(name) {\n        extendObservable(this, {\n            name: name,\n            get index() {\n                const i = store.items.indexOf(this)\n                if (i === -1) throw \"not found\"\n                return i\n            }\n        })\n    }\n\n    const store = observable({\n        items: [],\n        get asString() {\n            return this.items.map(item => item.index + \":\" + item.name).join(\",\")\n        }\n    })\n    store.items.push(new Item(\"item1\"))\n\n    const values = []\n    autorun(() => {\n        values.push(store.asString)\n    })\n\n    store.items.replace([new Item(\"item2\")])\n\n    expect(values).toEqual([\"0:item1\", \"0:item2\"])\n})\n\ntest(\"fix #1535: stale observables\", cb => {\n    // see https://codesandbox.io/s/k92o2jmz63\n    const snapshots = []\n\n    const x = observable.box(1)\n\n    // Depends on observable x\n    const derived1 = computed(() => {\n        return x.get() + 1\n    })\n\n    // Depends on computed derived1\n    const derived2 = computed(() => {\n        return derived1.get() + 1\n    })\n\n    function increment() {\n        runInAction(() => {\n            x.set(x.get() + 1)\n            // No problems here\n            derived1.get()\n            derived2.get()\n        })\n    }\n\n    function brokenIncrement() {\n        runInAction(() => x.set(x.get() + 1))\n        // Acessing computed outside of action causes staleness\n        // NOTE IT DOESN'T MATTER WHICH COMPUTED IS ACCESSED\n        // derived1.get();\n        derived2.get()\n    }\n\n    autorun(\n        () => {\n            snapshots.push(`${x.get()}, ${derived1.get()}, ${derived2.get()}`)\n        },\n        {\n            scheduler(f) {\n                setImmediate(f)\n            }\n        }\n    )\n\n    increment()\n    setTimeout(() => {\n        brokenIncrement()\n    }, 100)\n    setTimeout(() => {\n        expect(snapshots).toEqual([\"2, 3, 4\", \"3, 4, 5\"])\n        cb()\n    }, 1000)\n})\n"
  },
  {
    "path": "packages/mobx/__tests__/v5/base/object-api-proxy.js",
    "content": "const mobx = require(\"../../../src/mobx\")\nconst { has, autorun, when, runInAction, reaction, observable } = mobx\n\ntest(\"keys should be observable when extending\", () => {\n    const todos = observable({})\n\n    const todoTitles = []\n    reaction(\n        () => Object.keys(todos).map(key => `${key}: ${todos[key]}`),\n        titles => todoTitles.push(titles.join(\",\"))\n    )\n\n    runInAction(() => {\n        Object.assign(todos, {\n            lewis: \"Read Lewis\",\n            chesterton: \"Be mind blown by Chesterton\"\n        })\n    })\n    expect(todoTitles).toEqual([\"lewis: Read Lewis,chesterton: Be mind blown by Chesterton\"])\n\n    Object.assign(todos, { lewis: \"Read Lewis twice\" })\n    Object.assign(todos, { coffee: \"Grab coffee\" })\n    expect(todoTitles).toEqual([\n        \"lewis: Read Lewis,chesterton: Be mind blown by Chesterton\",\n        \"lewis: Read Lewis twice,chesterton: Be mind blown by Chesterton\",\n        \"lewis: Read Lewis twice,chesterton: Be mind blown by Chesterton,coffee: Grab coffee\"\n    ])\n})\n\ntest(\"toJS respects key changes\", () => {\n    const todos = observable({})\n\n    const serialized = []\n    mobx.autorun(() => {\n        serialized.push(JSON.stringify(mobx.toJS(todos)))\n    })\n\n    runInAction(() => {\n        Object.assign(todos, {\n            lewis: \"Read Lewis\",\n            chesterton: \"Be mind blown by Chesterton\"\n        })\n    })\n    Object.assign(todos, { lewis: \"Read Lewis twice\" })\n    Object.assign(todos, { coffee: \"Grab coffee\" })\n    expect(serialized).toEqual([\n        \"{}\",\n        '{\"lewis\":\"Read Lewis\",\"chesterton\":\"Be mind blown by Chesterton\"}',\n        '{\"lewis\":\"Read Lewis twice\",\"chesterton\":\"Be mind blown by Chesterton\"}',\n        '{\"lewis\":\"Read Lewis twice\",\"chesterton\":\"Be mind blown by Chesterton\",\"coffee\":\"Grab coffee\"}'\n    ])\n})\n\ntest(\"keys(object), values(object), entries(object)\", () => {\n    const todos = observable({})\n    const plain = {}\n    const keysSnapshots = []\n    const valuesSnapshots = []\n    const entriesSnapshots = []\n    const expectedKeysSnapshots = []\n    const expectedValuesSnapshots = []\n    const expectedEntriesSnapshots = []\n\n    const s1 = Symbol()\n    const s2 = Symbol()\n\n    function expectEquality() {\n        expect(todos).toEqual(plain)\n    }\n\n    function expectKeysReaction() {\n        expectedKeysSnapshots.push(Object.keys(plain))\n    }\n\n    function expectValuesReaction() {\n        expectedValuesSnapshots.push(Object.values(plain))\n    }\n\n    function expectEntriesReaction() {\n        expectedEntriesSnapshots.push(Object.entries(plain))\n    }\n\n    reaction(\n        () => Object.keys(todos),\n        result => keysSnapshots.push(result)\n    )\n\n    reaction(\n        () => Object.values(todos),\n        result => valuesSnapshots.push(result)\n    )\n\n    reaction(\n        () => Object.entries(todos),\n        result => entriesSnapshots.push(result)\n    )\n\n    expectEquality()\n    // add\n    todos[\"k1\"] = 1\n    plain[\"k1\"] = 1\n    expectEquality()\n    expectKeysReaction()\n    expectValuesReaction()\n    expectEntriesReaction()\n    // add symbol\n    todos[s1] = 2\n    plain[s1] = 2\n    expectEquality()\n    // see ObservableObjectAdministration.keys() for explanation\n    expectKeysReaction()\n    expectValuesReaction()\n    expectEntriesReaction()\n    // delete non-existent\n    delete todos[\"-\"]\n    delete plain[\"-\"]\n    expectEquality()\n    // delete non-existent symbol\n    delete todos[Symbol()]\n    delete plain[Symbol()]\n    expectEquality()\n    // add second\n    todos[\"k2\"] = 3\n    plain[\"k2\"] = 3\n    expectEquality()\n    expectKeysReaction()\n    expectValuesReaction()\n    expectEntriesReaction()\n    // add second symbol\n    todos[s2] = 4\n    plain[s2] = 4\n    expectEquality()\n    // see ObservableObjectAdministration.keys() for explanation\n    expectKeysReaction()\n    expectValuesReaction()\n    expectEntriesReaction()\n    // update\n    todos[\"k1\"] = 11\n    plain[\"k1\"] = 11\n    expectEquality()\n    expectValuesReaction()\n    expectEntriesReaction()\n    // update symbol\n    todos[s1] = 22\n    plain[s1] = 22\n    expectEquality()\n    // delete\n    delete todos[\"k1\"]\n    delete plain[\"k1\"]\n    expectEquality()\n    expectKeysReaction()\n    expectValuesReaction()\n    expectEntriesReaction()\n    // delete symbol\n    delete todos[s1]\n    delete plain[s1]\n    expectEquality()\n    // see ObservableObjectAdministration.keys() for explanation\n    expectKeysReaction()\n    expectValuesReaction()\n    expectEntriesReaction()\n\n    expect(keysSnapshots).toEqual(expectedKeysSnapshots)\n    expect(valuesSnapshots).toEqual(expectedValuesSnapshots)\n    expect(entriesSnapshots).toEqual(expectedEntriesSnapshots)\n})\n\ntest(\"dynamically adding properties should preserve the original modifiers of an object\", () => {\n    const todos = observable.object(\n        {\n            a: { title: \"get coffee\" }\n        },\n        {},\n        { deep: false }\n    )\n    expect(mobx.isObservable(todos.a)).toBe(false)\n    Object.assign(todos, { b: { title: \"get tea\" } })\n    expect(mobx.isObservable(todos.b)).toBe(false)\n})\n\ntest(\"has and get are reactive\", async () => {\n    const todos = observable({})\n\n    const p1 = when(() => {\n        return \"x\" in todos\n    })\n    const p2 = when(() => {\n        return todos.y === 3\n    })\n\n    setTimeout(() => {\n        Object.assign(todos, { x: false, y: 3 })\n    }, 100)\n\n    await p1\n    await p2\n})\n\ntest(\"computed props are considered part of collections\", () => {\n    const x = observable({\n        get y() {\n            return 3\n        }\n    })\n    expect(mobx.isComputedProp(x, \"y\")).toBe(true)\n    expect(x.y).toBe(3)\n    expect(\"y\" in x).toBe(true) // `in` also checks proto type, so should return true!\n    expect(Object.keys(x)).toEqual([])\n    expect(Object.values(x)).toEqual([])\n    expect(Object.entries(x)).toEqual([])\n})\n\ntest(\"#1739 - delete and undelete should work\", () => {\n    const x = observable({})\n\n    const events = []\n    autorun(() => {\n        // events.push(\"a\" in x)\n        events.push(has(x, \"a\"))\n    })\n\n    x.a = 1\n    x.a++\n    delete x.a\n    x.a = 5\n    delete x.a\n    x.a = 5\n    expect(events).toEqual([false, true, false, true, false, true])\n})\n\ntest(\"defineProperty - configurable: false\", () => {\n    const obj = mobx.observable({})\n    const desc = {\n        enumerable: true,\n        configurable: false,\n        writable: true,\n        value: 0\n    }\n    Object.defineProperty(obj, \"foo\", desc)\n    expect(Object.getOwnPropertyDescriptor(obj, \"foo\")).toEqual(desc)\n    expect(mobx.isObservableProp(obj, \"foo\")).toBe(false)\n    obj.foo++\n    expect(obj.foo).toBe(1)\n    expect(() => mobx.extendObservable(obj, { foo: 0 })).toThrow(TypeError)\n    expect(() => mobx.makeObservable(obj, { foo: mobx.observable })).toThrow(TypeError)\n    expect(() => Object.defineProperty(obj, \"foo\", { configurable: false })).toThrow(TypeError)\n})\n\ntest(\"defineProperty - writable: false\", () => {\n    const obj = mobx.observable({})\n    const desc = {\n        enumerable: true,\n        configurable: true,\n        writable: false,\n        value: 0\n    }\n    Object.defineProperty(obj, \"foo\", desc)\n    expect(Object.getOwnPropertyDescriptor(obj, \"foo\")).toEqual(desc)\n    expect(mobx.isObservableProp(obj, \"foo\")).toBe(false)\n    expect(() => obj.foo++).toThrow(TypeError)\n    mobx.extendObservable(obj, { foo: 0 })\n    expect(mobx.isObservableProp(obj, \"foo\")).toBe(true)\n    obj.foo++\n    expect(obj.foo).toBe(1)\n})\n\ntest(\"defineProperty - redefine observable\", () => {\n    const obj = mobx.observable({ foo: 0 })\n    expect(mobx.isObservableProp(obj, \"foo\")).toBe(true)\n    const desc = {\n        enumerable: true,\n        configurable: true,\n        writable: false,\n        value: 0\n    }\n    Object.defineProperty(obj, \"foo\", desc)\n    expect(Object.getOwnPropertyDescriptor(obj, \"foo\")).toEqual(desc)\n    expect(mobx.isObservableProp(obj, \"foo\")).toBe(false)\n})\n\ntest(\"defineProperty notifies keys observers\", () => {\n    const obj = mobx.observable({})\n    let reactionCount = 0\n    reaction(\n        () => Object.keys(obj),\n        () => reactionCount++\n    )\n\n    const desc = {\n        enumerable: true,\n        configurable: true,\n        writable: true,\n        value: 0\n    }\n    Object.defineProperty(obj, \"foo\", desc)\n    expect(Object.getOwnPropertyDescriptor(obj, \"foo\")).toEqual(desc)\n    expect(mobx.isObservableProp(obj, \"foo\")).toBe(false)\n    expect(reactionCount).toBe(1)\n    delete obj.foo\n    expect(obj.hasOwnProperty(\"foo\")).toBe(false)\n    expect(reactionCount).toBe(2)\n})\n"
  },
  {
    "path": "packages/mobx/__tests__/v5/base/object-api.js",
    "content": "const mobx = require(\"../../../src/mobx\")\nconst { autorun, keys, when, set, remove, values, entries, reaction, observable, has, get } = mobx\n\ntest(\"keys should be observable when extending\", () => {\n    const todos = observable({})\n\n    const todoTitles = []\n    reaction(\n        () => keys(todos).map(key => `${key}: ${todos[key]}`),\n        titles => todoTitles.push(titles.join(\",\"))\n    )\n\n    mobx.set(todos, {\n        lewis: \"Read Lewis\",\n        chesterton: \"Be mind blown by Chesterton\"\n    })\n    expect(todoTitles).toEqual([\"lewis: Read Lewis,chesterton: Be mind blown by Chesterton\"])\n\n    mobx.set(todos, { lewis: \"Read Lewis twice\" })\n    mobx.set(todos, { coffee: \"Grab coffee\" })\n    expect(todoTitles).toEqual([\n        \"lewis: Read Lewis,chesterton: Be mind blown by Chesterton\",\n        \"lewis: Read Lewis twice,chesterton: Be mind blown by Chesterton\",\n        \"lewis: Read Lewis twice,chesterton: Be mind blown by Chesterton,coffee: Grab coffee\"\n    ])\n})\n\ntest(\"toJS respects key changes\", () => {\n    const todos = observable({})\n\n    const serialized = []\n    mobx.autorun(() => {\n        serialized.push(JSON.stringify(mobx.toJS(todos)))\n    })\n\n    mobx.set(todos, {\n        lewis: \"Read Lewis\",\n        chesterton: \"Be mind blown by Chesterton\"\n    })\n    mobx.set(todos, { lewis: \"Read Lewis twice\" })\n    mobx.set(todos, { coffee: \"Grab coffee\" })\n    expect(serialized).toEqual([\n        \"{}\",\n        '{\"lewis\":\"Read Lewis\",\"chesterton\":\"Be mind blown by Chesterton\"}',\n        '{\"lewis\":\"Read Lewis twice\",\"chesterton\":\"Be mind blown by Chesterton\"}',\n        '{\"lewis\":\"Read Lewis twice\",\"chesterton\":\"Be mind blown by Chesterton\",\"coffee\":\"Grab coffee\"}'\n    ])\n})\n\ntest(\"keys(object), values(object), entries(object)\", () => {\n    const todos = observable({})\n    const plain = {}\n    const keysSnapshots = []\n    const valuesSnapshots = []\n    const entriesSnapshots = []\n    const expectedKeysSnapshots = []\n    const expectedValuesSnapshots = []\n    const expectedEntriesSnapshots = []\n\n    const s1 = Symbol()\n    const s2 = Symbol()\n\n    function expectEquality() {\n        expect(todos).toEqual(plain)\n    }\n\n    function expectKeysReaction() {\n        expectedKeysSnapshots.push(Object.keys(plain))\n    }\n\n    function expectValuesReaction() {\n        expectedValuesSnapshots.push(Object.values(plain))\n    }\n\n    function expectEntriesReaction() {\n        expectedEntriesSnapshots.push(Object.entries(plain))\n    }\n\n    reaction(\n        () => keys(todos),\n        result => keysSnapshots.push(result)\n    )\n\n    reaction(\n        () => values(todos),\n        result => valuesSnapshots.push(result)\n    )\n\n    reaction(\n        () => entries(todos),\n        result => entriesSnapshots.push(result)\n    )\n\n    expectEquality()\n    // add\n    set(todos, \"k1\", 1)\n    plain[\"k1\"] = 1\n    expectEquality()\n    expectKeysReaction()\n    expectValuesReaction()\n    expectEntriesReaction()\n    // add symbol\n    set(todos, s1, 2)\n    plain[s1] = 2\n    expectEquality()\n    // see ObservableObjectAdministration.keys() for explanation\n    expectKeysReaction()\n    expectValuesReaction()\n    expectEntriesReaction()\n    // delete non-existent\n    remove(todos, \"-\")\n    delete plain[\"-\"]\n    expectEquality()\n    // delete non-existent symbol\n    remove(todos, Symbol())\n    delete plain[Symbol()]\n    expectEquality()\n    // add second\n    set(todos, \"k2\", 3)\n    plain[\"k2\"] = 3\n    expectEquality()\n    expectKeysReaction()\n    expectValuesReaction()\n    expectEntriesReaction()\n    // add second symbol\n    set(todos, s2, 4)\n    plain[s2] = 4\n    expectEquality()\n    // see ObservableObjectAdministration.keys() for explanation\n    expectKeysReaction()\n    expectValuesReaction()\n    expectEntriesReaction()\n    // update\n    set(todos, \"k1\", 11)\n    plain[\"k1\"] = 11\n    expectEquality()\n    expectValuesReaction()\n    expectEntriesReaction()\n    // update symbol\n    set(todos, s1, 22)\n    plain[s1] = 22\n    expectEquality()\n    // delete\n    remove(todos, \"k1\")\n    delete plain[\"k1\"]\n    expectEquality()\n    expectKeysReaction()\n    expectValuesReaction()\n    expectEntriesReaction()\n    // delete symbol\n    remove(todos, s1)\n    delete plain[s1]\n    expectEquality()\n    // see ObservableObjectAdministration.keys() for explanation\n    expectKeysReaction()\n    expectValuesReaction()\n    expectEntriesReaction()\n\n    expect(keysSnapshots).toEqual(expectedKeysSnapshots)\n    expect(valuesSnapshots).toEqual(expectedValuesSnapshots)\n    expect(entriesSnapshots).toEqual(expectedEntriesSnapshots)\n})\n\ntest(\"values(map)\", () => {\n    const todos = observable.map({})\n    const snapshots = []\n\n    reaction(\n        () => values(todos),\n        values => snapshots.push(values)\n    )\n\n    expect(has(todos, \"x\")).toBe(false)\n    expect(get(todos, \"x\")).toBe(undefined)\n    set(todos, \"x\", 3)\n    expect(has(todos, \"x\")).toBe(true)\n    expect(get(todos, \"x\")).toBe(3)\n    remove(todos, \"y\")\n    set(todos, \"z\", 4)\n    set(todos, \"x\", 5)\n    remove(todos, \"z\")\n\n    expect(snapshots).toEqual([[3], [3, 4], [5, 4], [5]])\n})\n\ntest(\"values(map) - symbols\", () => {\n    const todos = observable.map({})\n    const snapshots = []\n    const x = Symbol()\n    const y = Symbol()\n    const z = Symbol(\"z\")\n\n    reaction(\n        () => values(todos),\n        values => snapshots.push(values)\n    )\n\n    expect(has(todos, x)).toBe(false)\n    expect(get(todos, x)).toBe(undefined)\n    set(todos, x, 3)\n    expect(has(todos, x)).toBe(true)\n    expect(get(todos, x)).toBe(3)\n    remove(todos, y)\n    set(todos, z, 4)\n    set(todos, x, 5)\n    remove(todos, z)\n\n    expect(snapshots).toEqual([[3], [3, 4], [5, 4], [5]])\n})\n\ntest(\"entries(map)\", () => {\n    const todos = observable.map({})\n    const snapshots = []\n\n    reaction(\n        () => entries(todos),\n        entries => snapshots.push(entries)\n    )\n\n    expect(has(todos, \"x\")).toBe(false)\n    expect(get(todos, \"x\")).toBe(undefined)\n    set(todos, \"x\", 3)\n    expect(has(todos, \"x\")).toBe(true)\n    expect(get(todos, \"x\")).toBe(3)\n    remove(todos, \"y\")\n    set(todos, \"z\", 4)\n    set(todos, \"x\", 5)\n    remove(todos, \"z\")\n\n    expect(snapshots).toEqual([\n        [[\"x\", 3]],\n        [\n            [\"x\", 3],\n            [\"z\", 4]\n        ],\n        [\n            [\"x\", 5],\n            [\"z\", 4]\n        ],\n        [[\"x\", 5]]\n    ])\n})\n\ntest(\"entries(map) - symbols\", () => {\n    const todos = observable.map({})\n    const snapshots = []\n    const x = Symbol()\n    const y = Symbol()\n    const z = Symbol(\"z\")\n\n    reaction(\n        () => entries(todos),\n        entries => snapshots.push(entries)\n    )\n\n    expect(has(todos, x)).toBe(false)\n    expect(get(todos, x)).toBe(undefined)\n    set(todos, x, 3)\n    expect(has(todos, x)).toBe(true)\n    expect(get(todos, x)).toBe(3)\n    remove(todos, y)\n    set(todos, z, 4)\n    set(todos, x, 5)\n    remove(todos, z)\n\n    expect(snapshots).toEqual([\n        [[x, 3]],\n        [\n            [x, 3],\n            [z, 4]\n        ],\n        [\n            [x, 5],\n            [z, 4]\n        ],\n        [[x, 5]]\n    ])\n})\n\ntest(\"keys(map)\", () => {\n    const todos = observable.map({ a: 3 })\n    const snapshots = []\n\n    reaction(\n        () => keys(todos),\n        keys => snapshots.push(keys)\n    )\n\n    set(todos, \"x\", 3)\n    remove(todos, \"y\")\n    set(todos, \"z\", 4)\n    set(todos, \"x\", 5)\n    remove(todos, \"z\")\n    remove(todos, \"a\")\n\n    expect(snapshots).toEqual([[\"a\", \"x\"], [\"a\", \"x\", \"z\"], [\"a\", \"x\"], [\"x\"]])\n})\n\ntest(\"keys(map) - symbols\", () => {\n    const snapshots = []\n    const x = Symbol()\n    const y = Symbol()\n    const z = Symbol(\"z\")\n    const a = Symbol()\n    const todos = observable.map({ [a]: 3 })\n\n    reaction(\n        () => keys(todos),\n        keys => snapshots.push(keys)\n    )\n\n    set(todos, x, 3)\n    remove(todos, y)\n    set(todos, z, 4)\n    set(todos, x, 5)\n    remove(todos, z)\n    remove(todos, a)\n\n    expect(snapshots).toEqual([[a, x], [a, x, z], [a, x], [x]])\n})\n\ntest(\"values(array)\", () => {\n    const todos = observable.array()\n    const snapshots = []\n\n    reaction(\n        () => values(todos),\n        values => snapshots.push(values)\n    )\n\n    expect(has(todos, 0)).toBe(false)\n    expect(get(todos, 0)).toBe(undefined)\n    set(todos, 0, 2)\n    expect(has(todos, 0)).toBe(true)\n    expect(get(todos, 0)).toBe(2)\n\n    set(todos, \"1\", 4)\n    set(todos, 3, 4)\n    set(todos, 1, 3)\n    remove(todos, 2)\n    remove(todos, \"0\")\n\n    expect(snapshots).toEqual([\n        [2],\n        [2, 4],\n        [2, 4, undefined, 4],\n        [2, 3, undefined, 4],\n        [2, 3, 4],\n        [3, 4]\n    ])\n})\n\ntest(\"entries(array)\", () => {\n    const todos = observable.array()\n    const snapshots = []\n\n    reaction(\n        () => entries(todos),\n        entries => snapshots.push(entries)\n    )\n\n    expect(has(todos, 0)).toBe(false)\n    expect(get(todos, 0)).toBe(undefined)\n    set(todos, 0, 2)\n    expect(has(todos, 0)).toBe(true)\n    expect(get(todos, 0)).toBe(2)\n\n    set(todos, \"1\", 4)\n    set(todos, 3, 4)\n    set(todos, 1, 3)\n    remove(todos, 2)\n    remove(todos, \"0\")\n\n    expect(snapshots).toEqual([\n        [[0, 2]],\n        [\n            [0, 2],\n            [1, 4]\n        ],\n        [\n            [0, 2],\n            [1, 4],\n            [2, undefined],\n            [3, 4]\n        ],\n        [\n            [0, 2],\n            [1, 3],\n            [2, undefined],\n            [3, 4]\n        ],\n        [\n            [0, 2],\n            [1, 3],\n            [2, 4]\n        ],\n        [\n            [0, 3],\n            [1, 4]\n        ]\n    ])\n})\n\ntest(\"keys(array)\", () => {\n    const todos = observable.array()\n    const snapshots = []\n\n    reaction(\n        () => keys(todos),\n        keys => snapshots.push(keys)\n    )\n\n    set(todos, 0, 2)\n    set(todos, \"1\", 4)\n    set(todos, 3, 4)\n    set(todos, 1, 3)\n    remove(todos, 2)\n    remove(todos, \"0\")\n\n    expect(snapshots).toEqual([[0], [0, 1], [0, 1, 2, 3], [0, 1, 2, 3], [0, 1, 2], [0, 1]])\n})\n\ntest(\"observe & intercept\", () => {\n    let events = []\n    const todos = observable(\n        {\n            a: { title: \"get coffee\" }\n        },\n        {},\n        {\n            deep: false,\n            name: \"TestObject\" // stable name for snapshot\n        }\n    )\n    mobx.observe(todos, c => {\n        events.push({ observe: { ...c, object: \"skip\" } })\n    })\n    const d = mobx.intercept(todos, c => {\n        events.push({ intercept: { ...c, object: \"skip\" } })\n        return null // no addition!\n    })\n\n    set(todos, { b: { title: \"get tea\" } })\n    remove(todos, \"a\")\n    expect(events).toMatchSnapshot()\n    expect(mobx.toJS(todos)).toEqual({\n        a: { title: \"get coffee\" }\n    })\n\n    events.splice(0)\n    d()\n    set(todos, { b: { title: \"get tea\" } })\n    remove(todos, \"a\")\n    expect(events).toMatchSnapshot()\n    expect(mobx.toJS(todos)).toEqual({\n        b: { title: \"get tea\" }\n    })\n})\n\ntest(\"observe & intercept set called multiple times\", () => {\n    const a = mobx.observable({}, {}, { name: \"TestObject\" }) // stable name for snapshot\n    const interceptLogs = []\n    const observeLogs = []\n\n    mobx.intercept(a, change => {\n        interceptLogs.push(`${change.name}: ${change.newValue}`)\n        return change\n    })\n    mobx.observe(a, change => observeLogs.push(`${change.name}: ${change.newValue}`))\n\n    mobx.set(a, \"x\", 0)\n    a.x = 1\n    mobx.set(a, \"x\", 2)\n\n    expect(interceptLogs).toEqual([\"x: 0\", \"x: 1\", \"x: 2\"])\n    expect(observeLogs).toEqual([\"x: 0\", \"x: 1\", \"x: 2\"])\n})\n\ntest(\"dynamically adding properties should preserve the original modifiers of an object\", () => {\n    const todos = observable.object(\n        {\n            a: { title: \"get coffee\" }\n        },\n        {},\n        { deep: false }\n    )\n    expect(mobx.isObservable(todos.a)).toBe(false)\n    set(todos, { b: { title: \"get tea\" } })\n    expect(mobx.isObservable(todos.b)).toBe(false)\n})\n\ntest(\"has and get are reactive\", async () => {\n    const todos = observable({})\n\n    const p1 = when(() => has(todos, \"x\"))\n    const p2 = when(() => get(todos, \"y\") === 3)\n\n    setTimeout(() => {\n        set(todos, { x: false, y: 3 })\n    }, 100)\n\n    await p1\n    await p2\n})\n\ntest(\"computed props are considered part of collections\", () => {\n    const x = observable({\n        get y() {\n            return 3\n        }\n    })\n    expect(mobx.isComputedProp(x, \"y\")).toBe(true)\n    expect(x.y).toBe(3)\n    expect(has(x, \"y\")).toBe(true)\n    expect(get(x, \"y\")).toBe(3)\n    expect(keys(x)).toEqual([])\n    expect(values(x)).toEqual([])\n    expect(entries(x)).toEqual([])\n})\n\ntest(\"#1739 - delete and undelete should work\", () => {\n    const x = observable({})\n\n    const events = []\n    autorun(() => {\n        events.push(has(x, \"a\"))\n    })\n\n    set(x, \"a\", 1)\n    set(x, \"a\", 2)\n    remove(x, \"a\")\n    set(x, \"a\", 2)\n    remove(x, \"a\")\n    set(x, \"a\", 3)\n    expect(events).toEqual([false, true, false, true, false, true])\n})\n\ntest(\"keys(set)\", () => {\n    const todos = observable.set([1])\n    const snapshots = []\n\n    reaction(\n        () => keys(todos),\n        keys => snapshots.push(keys)\n    )\n\n    set(todos, 2)\n    remove(todos, 2)\n    set(todos, 3)\n    set(todos, 4)\n    remove(todos, 3)\n\n    expect(snapshots).toEqual([[1, 2], [1], [1, 3], [1, 3, 4], [1, 4]])\n})\n\ntest(\"defineProperty - configurable: false\", () => {\n    const obj = mobx.observable({})\n    const desc = {\n        enumerable: true,\n        configurable: false,\n        writable: true,\n        value: 0\n    }\n    mobx.defineProperty(obj, \"foo\", desc)\n    expect(Object.getOwnPropertyDescriptor(obj, \"foo\")).toEqual(desc)\n    expect(mobx.isObservableProp(obj, \"foo\")).toBe(false)\n    obj.foo++\n    expect(obj.foo).toBe(1)\n    expect(() => mobx.extendObservable(obj, { foo: 0 })).toThrow(TypeError)\n    expect(() => mobx.makeObservable(obj, { foo: mobx.observable })).toThrow(TypeError)\n    expect(() => mobx.defineProperty(obj, \"foo\", { configurable: false })).toThrow(TypeError)\n})\n\ntest(\"defineProperty - writable: false\", () => {\n    const obj = mobx.observable({})\n    const desc = {\n        enumerable: true,\n        configurable: true,\n        writable: false,\n        value: 0\n    }\n    mobx.defineProperty(obj, \"foo\", desc)\n    expect(Object.getOwnPropertyDescriptor(obj, \"foo\")).toEqual(desc)\n    expect(mobx.isObservableProp(obj, \"foo\")).toBe(false)\n    expect(() => obj.foo++).toThrow(TypeError)\n    mobx.extendObservable(obj, { foo: 0 })\n    expect(mobx.isObservableProp(obj, \"foo\")).toBe(true)\n    obj.foo++\n    expect(obj.foo).toBe(1)\n})\n\ntest(\"defineProperty - redefine observable\", () => {\n    const obj = mobx.observable({ foo: 0 })\n    expect(mobx.isObservableProp(obj, \"foo\")).toBe(true)\n    const desc = {\n        enumerable: true,\n        configurable: true,\n        writable: false,\n        value: 0\n    }\n    mobx.defineProperty(obj, \"foo\", desc)\n    expect(Object.getOwnPropertyDescriptor(obj, \"foo\")).toEqual(desc)\n    expect(mobx.isObservableProp(obj, \"foo\")).toBe(false)\n})\n\ntest(\"defineProperty notifies keys observers\", () => {\n    const obj = mobx.observable({})\n    let reactionCount = 0\n    reaction(\n        () => mobx.keys(obj),\n        () => reactionCount++\n    )\n\n    const desc = {\n        enumerable: true,\n        configurable: true,\n        writable: true,\n        value: 0\n    }\n    mobx.defineProperty(obj, \"foo\", desc)\n    expect(Object.getOwnPropertyDescriptor(obj, \"foo\")).toEqual(desc)\n    expect(mobx.isObservableProp(obj, \"foo\")).toBe(false)\n    expect(reactionCount).toBe(1)\n    mobx.remove(obj, 'foo');\n    expect(obj.hasOwnProperty(\"foo\")).toBe(false)\n    expect(reactionCount).toBe(2)\n})\n"
  },
  {
    "path": "packages/mobx/__tests__/v5/base/observables.js",
    "content": "\"use strict\"\n\nconst mobx = require(\"../../../src/mobx\")\nconst m = mobx\nconst {\n    $mobx,\n    observable,\n    computed,\n    transaction,\n    autorun,\n    extendObservable,\n    makeObservable,\n    isAction,\n    isFlow,\n    isObservableProp\n} = mobx\nconst utils = require(\"../../v5/utils/test-utils\")\nconst { MAX_SPLICE_SIZE, getGlobalState } = require(\"../../../src/internal\")\n\nconst voidObserver = function () {}\n\nfunction buffer() {\n    const b = []\n    const res = function (x) {\n        if (typeof x.newValue === \"object\") {\n            const copy = { ...x.newValue }\n            delete copy[$mobx]\n            b.push(copy)\n        } else {\n            b.push(x.newValue)\n        }\n    }\n    res.toArray = function () {\n        return b\n    }\n    return res\n}\n\ntest(\"argumentless observable\", () => {\n    const a = observable.box()\n\n    expect(m.isObservable(a)).toBe(true)\n    expect(a.get()).toBe(undefined)\n})\n\ntest(\"basic\", function () {\n    const x = observable.box(3)\n    const b = buffer()\n    m.observe(x, b)\n    expect(3).toBe(x.get())\n\n    x.set(5)\n    expect(5).toBe(x.get())\n    expect([5]).toEqual(b.toArray())\n    expect(mobx._isComputingDerivation()).toBe(false)\n})\n\ntest(\"basic2\", function () {\n    const x = observable.box(3)\n    const z = computed(function () {\n        return x.get() * 2\n    })\n    const y = computed(function () {\n        return x.get() * 3\n    })\n\n    m.observe(z, voidObserver)\n\n    expect(z.get()).toBe(6)\n    expect(y.get()).toBe(9)\n\n    x.set(5)\n    expect(z.get()).toBe(10)\n    expect(y.get()).toBe(15)\n\n    expect(mobx._isComputingDerivation()).toBe(false)\n})\n\ntest(\"computed with asStructure modifier\", function () {\n    const x1 = observable.box(3)\n    const x2 = observable.box(5)\n    const y = m.computed(\n        function () {\n            return {\n                sum: x1.get() + x2.get()\n            }\n        },\n        { compareStructural: true }\n    )\n    const b = buffer()\n    m.observe(y, b, true)\n\n    expect(8).toBe(y.get().sum)\n\n    x1.set(4)\n    expect(9).toBe(y.get().sum)\n\n    m.transaction(function () {\n        // swap values, computation results is structuraly unchanged\n        x1.set(5)\n        x2.set(4)\n    })\n\n    expect(b.toArray()).toEqual([{ sum: 8 }, { sum: 9 }])\n    expect(mobx._isComputingDerivation()).toBe(false)\n})\n\ntest(\"dynamic\", function (done) {\n    try {\n        const x = observable.box(3)\n        const y = m.computed(function () {\n            return x.get()\n        })\n        const b = buffer()\n        m.observe(y, b, true)\n\n        expect(3).toBe(y.get()) // First evaluation here..\n\n        x.set(5)\n        expect(5).toBe(y.get())\n\n        expect(b.toArray()).toEqual([3, 5])\n        expect(mobx._isComputingDerivation()).toBe(false)\n\n        done()\n    } catch (e) {\n        console.log(e.stack)\n    }\n})\n\ntest(\"dynamic2\", function (done) {\n    try {\n        const x = observable.box(3)\n        const y = computed(function () {\n            return x.get() * x.get()\n        })\n\n        expect(9).toBe(y.get())\n        const b = buffer()\n        m.observe(y, b)\n\n        x.set(5)\n        expect(25).toBe(y.get())\n\n        //no intermediate value 15!\n        expect([25]).toEqual(b.toArray())\n        expect(mobx._isComputingDerivation()).toBe(false)\n\n        done()\n    } catch (e) {\n        console.log(e.stack)\n    }\n})\n\ntest(\"box uses equals\", function (done) {\n    try {\n        const x = observable.box(\"a\", {\n            equals: (oldValue, newValue) => {\n                return oldValue.toLowerCase() === newValue.toLowerCase()\n            }\n        })\n\n        const b = buffer()\n        m.observe(x, b)\n\n        x.set(\"A\")\n        x.set(\"b\")\n        x.set(\"B\")\n        x.set(\"C\")\n\n        expect([\"b\", \"C\"]).toEqual(b.toArray())\n        expect(mobx._isComputingDerivation()).toBe(false)\n\n        done()\n    } catch (e) {\n        console.log(e.stack)\n    }\n})\n\ntest(\"box uses equals2\", function (done) {\n    try {\n        const x = observable.box(\"01\", {\n            equals: (oldValue, newValue) => {\n                return parseInt(oldValue) === parseInt(newValue)\n            }\n        })\n\n        const y = computed(function () {\n            return parseInt(x)\n        })\n\n        const b = buffer()\n        m.observe(y, b)\n\n        x.set(\"2\")\n        x.set(\"02\")\n        x.set(\"002\")\n        x.set(\"03\")\n\n        expect([2, 3]).toEqual(b.toArray())\n        expect(mobx._isComputingDerivation()).toBe(false)\n\n        done()\n    } catch (e) {\n        console.log(e.stack)\n    }\n})\n\ntest(\"readme1\", function (done) {\n    try {\n        const b = buffer()\n\n        const vat = observable.box(0.2)\n        const order = {}\n        order.price = observable.box(10)\n        // Prints: New price: 24\n        // in TS, just: value(() => this.price() * (1+vat()))\n        order.priceWithVat = computed(function () {\n            return order.price.get() * (1 + vat.get())\n        })\n\n        m.observe(order.priceWithVat, b)\n\n        order.price.set(20)\n        expect([24]).toEqual(b.toArray())\n        order.price.set(10)\n        expect([24, 12]).toEqual(b.toArray())\n        expect(mobx._isComputingDerivation()).toBe(false)\n\n        done()\n    } catch (e) {\n        console.log(e.stack)\n        throw e\n    }\n})\n\ntest(\"batch\", function () {\n    const a = observable.box(2)\n    const b = observable.box(3)\n    const c = computed(function () {\n        return a.get() * b.get()\n    })\n    const d = computed(function () {\n        return c.get() * b.get()\n    })\n    const buf = buffer()\n    m.observe(d, buf)\n\n    a.set(4)\n    b.set(5)\n    // Note, 60 should not happen! (that is d begin computed before c after update of b)\n    expect(buf.toArray()).toEqual([36, 100])\n\n    const x = mobx.transaction(function () {\n        a.set(2)\n        b.set(3)\n        a.set(6)\n        expect(d.value_).toBe(100) // not updated; in transaction\n        expect(d.get()).toBe(54) // consistent due to inspection\n        return 2\n    })\n\n    expect(x).toBe(2) // test return value\n    expect(buf.toArray()).toEqual([36, 100, 54]) // only one new value for d\n})\n\ntest(\"transaction with inspection\", function () {\n    const a = observable.box(2)\n    let calcs = 0\n    const b = computed(function () {\n        calcs++\n        return a.get() * 2\n    })\n\n    // if not inspected during transaction, postpone value to end\n    mobx.transaction(function () {\n        a.set(3)\n        expect(b.get()).toBe(6)\n        expect(calcs).toBe(1)\n    })\n    expect(b.get()).toBe(6)\n    expect(calcs).toBe(2)\n\n    // if inspected, evaluate eagerly\n    mobx.transaction(function () {\n        a.set(4)\n        expect(b.get()).toBe(8)\n        expect(calcs).toBe(3)\n    })\n    expect(b.get()).toBe(8)\n    expect(calcs).toBe(4)\n})\n\ntest(\"transaction with inspection 2\", function () {\n    const a = observable.box(2)\n    let calcs = 0\n    let b\n    mobx.autorun(function () {\n        calcs++\n        b = a.get() * 2\n    })\n\n    // if not inspected during transaction, postpone value to end\n    mobx.transaction(function () {\n        a.set(3)\n        expect(b).toBe(4)\n        expect(calcs).toBe(1)\n    })\n    expect(b).toBe(6)\n    expect(calcs).toBe(2)\n\n    // if inspected, evaluate eagerly\n    mobx.transaction(function () {\n        a.set(4)\n        expect(b).toBe(6)\n        expect(calcs).toBe(2)\n    })\n    expect(b).toBe(8)\n    expect(calcs).toBe(3)\n})\n\ntest(\"scope\", function () {\n    const vat = observable.box(0.2)\n    const Order = function () {\n        this.price = observable.box(20)\n        this.amount = observable.box(2)\n        this.total = computed(\n            function () {\n                return (1 + vat.get()) * this.price.get() * this.amount.get()\n            },\n            { context: this }\n        )\n    }\n\n    const order = new Order()\n    m.observe(order.total, voidObserver)\n    order.price.set(10)\n    order.amount.set(3)\n    expect(36).toBe(order.total.get())\n    expect(mobx._isComputingDerivation()).toBe(false)\n})\n\ntest(\"props1\", function () {\n    const vat = observable.box(0.2)\n    const Order = function () {\n        mobx.extendObservable(this, {\n            price: 20,\n            amount: 2,\n            get total() {\n                return (1 + vat.get()) * this.price * this.amount // price and amount are now properties!\n            }\n        })\n    }\n\n    const order = new Order()\n    expect(48).toBe(order.total)\n    order.price = 10\n    order.amount = 3\n    expect(36).toBe(order.total)\n\n    const totals = []\n    const sub = mobx.autorun(function () {\n        totals.push(order.total)\n    })\n    order.amount = 4\n    sub()\n    order.amount = 5\n    expect(totals).toEqual([36, 48])\n\n    expect(mobx._isComputingDerivation()).toBe(false)\n})\n\ntest(\"props2\", function () {\n    const vat = observable.box(0.2)\n    const Order = function () {\n        mobx.extendObservable(this, {\n            price: 20,\n            amount: 2,\n            get total() {\n                return (1 + vat.get()) * this.price * this.amount // price and amount are now properties!\n            }\n        })\n    }\n\n    const order = new Order()\n    expect(48).toBe(order.total)\n    order.price = 10\n    order.amount = 3\n    expect(36).toBe(order.total)\n})\n\ntest(\"props4\", function () {\n    function Bzz() {\n        mobx.extendObservable(this, {\n            fluff: [1, 2],\n            get sum() {\n                return this.fluff.reduce(function (a, b) {\n                    return a + b\n                }, 0)\n            }\n        })\n    }\n\n    const x = new Bzz()\n    x.fluff\n    expect(x.sum).toBe(3)\n    x.fluff.push(3)\n    expect(x.sum).toBe(6)\n    x.fluff = [5, 6]\n    expect(x.sum).toBe(11)\n    x.fluff.push(2)\n    expect(x.sum).toBe(13)\n})\n\ntest(\"object enumerable props\", function () {\n    const x = mobx.observable({\n        a: 3,\n        get b() {\n            return 2 * this.a\n        }\n    })\n    mobx.extendObservable(x, { c: 4 })\n    const ar = []\n    for (const key in x) ar.push(key)\n    expect(ar).toEqual([\"a\", \"c\"])\n})\n\ntest(\"observe property\", function () {\n    const sb = []\n    const mb = []\n\n    const Wrapper = function (chocolateBar) {\n        mobx.extendObservable(this, {\n            chocolateBar: chocolateBar,\n            get calories() {\n                return this.chocolateBar.calories\n            }\n        })\n    }\n\n    const snickers = mobx.observable({\n        calories: null\n    })\n    const mars = mobx.observable({\n        calories: undefined\n    })\n\n    const wrappedSnickers = new Wrapper(snickers)\n    const wrappedMars = new Wrapper(mars)\n\n    const disposeSnickers = mobx.autorun(function () {\n        sb.push(wrappedSnickers.calories)\n    })\n    const disposeMars = mobx.autorun(function () {\n        mb.push(wrappedMars.calories)\n    })\n    snickers.calories = 10\n    mars.calories = 15\n\n    disposeSnickers()\n    disposeMars()\n    snickers.calories = 5\n    mars.calories = 7\n\n    expect(sb).toEqual([null, 10])\n    expect(mb).toEqual([undefined, 15])\n})\n\ntest(\"observe object\", function () {\n    let events = []\n    const a = observable({\n        a: 1,\n        get da() {\n            return this.a * 2\n        }\n    })\n    const stop = m.observe(a, function (change) {\n        expect(change.observableKind).toEqual(\"object\")\n        delete change.observableKind\n        delete change.debugObjectName\n        events.push(change)\n    })\n\n    a.a = 2\n    mobx.extendObservable(a, {\n        b: 3\n    })\n    a.a = 4\n    a.b = 5\n    expect(events).toEqual([\n        {\n            type: \"update\",\n            object: a,\n            name: \"a\",\n            newValue: 2,\n            oldValue: 1\n        },\n        {\n            type: \"add\",\n            object: a,\n            newValue: 3,\n            name: \"b\"\n        },\n        {\n            type: \"update\",\n            object: a,\n            name: \"a\",\n            newValue: 4,\n            oldValue: 2\n        },\n        {\n            type: \"update\",\n            object: a,\n            name: \"b\",\n            newValue: 5,\n            oldValue: 3\n        }\n    ])\n\n    stop()\n    events = []\n    a.a = 6\n    expect(events.length).toBe(0)\n})\n\ntest(\"mobx.observe\", function () {\n    const events = []\n    const o = observable({ b: 2 })\n    const ar = observable([3])\n    const map = mobx.observable.map({})\n\n    const push = function (event) {\n        delete event.debugObjectName\n        events.push(event)\n    }\n\n    const stop2 = mobx.observe(o, push)\n    const stop3 = mobx.observe(ar, push)\n    const stop4 = mobx.observe(map, push)\n\n    o.b = 5\n    ar[0] = 6\n    map.set(\"d\", 7)\n\n    stop2()\n    stop3()\n    stop4()\n\n    o.b = 9\n    ar[0] = 10\n    map.set(\"d\", 11)\n\n    expect(events).toEqual([\n        {\n            type: \"update\",\n            observableKind: \"object\",\n            object: o,\n            name: \"b\",\n            newValue: 5,\n            oldValue: 2\n        },\n        {\n            object: ar,\n            type: \"update\",\n            observableKind: \"array\",\n            index: 0,\n            newValue: 6,\n            oldValue: 3\n        },\n        {\n            type: \"add\",\n            observableKind: \"map\",\n            object: map,\n            newValue: 7,\n            name: \"d\"\n        }\n    ])\n})\n\ntest(\"change count optimization\", function () {\n    let bCalcs = 0\n    let cCalcs = 0\n    const a = observable.box(3)\n    const b = computed(function () {\n        bCalcs += 1\n        return 4 + a.get() - a.get()\n    })\n    const c = computed(function () {\n        cCalcs += 1\n        return b.get()\n    })\n\n    m.observe(c, voidObserver)\n\n    expect(b.get()).toBe(4)\n    expect(c.get()).toBe(4)\n    expect(bCalcs).toBe(1)\n    expect(cCalcs).toBe(1)\n\n    a.set(5)\n\n    expect(b.get()).toBe(4)\n    expect(c.get()).toBe(4)\n    expect(bCalcs).toBe(2)\n    expect(cCalcs).toBe(1)\n\n    expect(mobx._isComputingDerivation()).toBe(false)\n})\n\ntest(\"observables removed\", function () {\n    let calcs = 0\n    const a = observable.box(1)\n    const b = observable.box(2)\n    const c = computed(function () {\n        calcs++\n        if (a.get() === 1) return b.get() * a.get() * b.get()\n        return 3\n    })\n\n    expect(calcs).toBe(0)\n    m.observe(c, voidObserver)\n    expect(c.get()).toBe(4)\n    expect(calcs).toBe(1)\n    a.set(2)\n    expect(c.get()).toBe(3)\n    expect(calcs).toBe(2)\n\n    b.set(3) // should not retrigger calc\n    expect(c.get()).toBe(3)\n    expect(calcs).toBe(2)\n\n    a.set(1)\n    expect(c.get()).toBe(9)\n    expect(calcs).toBe(3)\n\n    expect(mobx._isComputingDerivation()).toBe(false)\n})\n\ntest(\"lazy evaluation\", function () {\n    let bCalcs = 0\n    let cCalcs = 0\n    let dCalcs = 0\n    let observerChanges = 0\n\n    const a = observable.box(1)\n    const b = computed(function () {\n        bCalcs += 1\n        return a.get() + 1\n    })\n\n    const c = computed(function () {\n        cCalcs += 1\n        return b.get() + 1\n    })\n\n    expect(bCalcs).toBe(0)\n    expect(cCalcs).toBe(0)\n    expect(c.get()).toBe(3)\n    expect(bCalcs).toBe(1)\n    expect(cCalcs).toBe(1)\n\n    expect(c.get()).toBe(3)\n    expect(bCalcs).toBe(2)\n    expect(cCalcs).toBe(2)\n\n    a.set(2)\n    expect(bCalcs).toBe(2)\n    expect(cCalcs).toBe(2)\n\n    expect(c.get()).toBe(4)\n    expect(bCalcs).toBe(3)\n    expect(cCalcs).toBe(3)\n\n    const d = computed(function () {\n        dCalcs += 1\n        return b.get() * 2\n    })\n\n    const handle = m.observe(\n        d,\n        function () {\n            observerChanges += 1\n        },\n        false\n    )\n    expect(bCalcs).toBe(4)\n    expect(cCalcs).toBe(3)\n    expect(dCalcs).toBe(1) // d is evaluated, so that its dependencies are known\n\n    a.set(3)\n    expect(d.get()).toBe(8)\n    expect(bCalcs).toBe(5)\n    expect(cCalcs).toBe(3)\n    expect(dCalcs).toBe(2)\n\n    expect(c.get()).toBe(5)\n    expect(bCalcs).toBe(5)\n    expect(cCalcs).toBe(4)\n    expect(dCalcs).toBe(2)\n\n    expect(b.get()).toBe(4)\n    expect(bCalcs).toBe(5)\n    expect(cCalcs).toBe(4)\n    expect(dCalcs).toBe(2)\n\n    handle() // unlisten\n    expect(d.get()).toBe(8)\n    expect(bCalcs).toBe(6) // gone to sleep\n    expect(cCalcs).toBe(4)\n    expect(dCalcs).toBe(3)\n\n    expect(observerChanges).toBe(1)\n\n    expect(mobx._isComputingDerivation()).toBe(false)\n})\n\ntest(\"multiple view dependencies\", function () {\n    let bCalcs = 0\n    let dCalcs = 0\n    const a = observable.box(1)\n    const b = computed(function () {\n        bCalcs++\n        return 2 * a.get()\n    })\n    const c = observable.box(2)\n    const d = computed(function () {\n        dCalcs++\n        return 3 * c.get()\n    })\n\n    let zwitch = true\n    const buffer = []\n    let fCalcs = 0\n    const dis = mobx.autorun(function () {\n        fCalcs++\n        if (zwitch) buffer.push(b.get() + d.get())\n        else buffer.push(d.get() + b.get())\n    })\n\n    zwitch = false\n    c.set(3)\n    expect(bCalcs).toBe(1)\n    expect(dCalcs).toBe(2)\n    expect(fCalcs).toBe(2)\n    expect(buffer).toEqual([8, 11])\n\n    c.set(4)\n    expect(bCalcs).toBe(1)\n    expect(dCalcs).toBe(3)\n    expect(fCalcs).toBe(3)\n    expect(buffer).toEqual([8, 11, 14])\n\n    dis()\n    c.set(5)\n    expect(bCalcs).toBe(1)\n    expect(dCalcs).toBe(3)\n    expect(fCalcs).toBe(3)\n    expect(buffer).toEqual([8, 11, 14])\n})\n\ntest(\"nested observable2\", function () {\n    const factor = observable.box(0)\n    const price = observable.box(100)\n    let totalCalcs = 0\n    let innerCalcs = 0\n\n    const total = computed(function () {\n        totalCalcs += 1 // outer observable shouldn't recalc if inner observable didn't publish a real change\n        return (\n            price.get() *\n            computed(function () {\n                innerCalcs += 1\n                return factor.get() % 2 === 0 ? 1 : 3\n            }).get()\n        )\n    })\n\n    const b = []\n    m.observe(\n        total,\n        function (x) {\n            b.push(x.newValue)\n        },\n        true\n    )\n\n    price.set(150)\n    factor.set(7) // triggers innerCalc twice, because changing the outcome triggers the outer calculation which recreates the inner calculation\n    factor.set(5) // doesn't trigger outer calc\n    factor.set(3) // doesn't trigger outer calc\n    factor.set(4) // triggers innerCalc twice\n    price.set(20)\n\n    expect(b).toEqual([100, 150, 450, 150, 20])\n    expect(innerCalcs).toBe(9)\n    expect(totalCalcs).toBe(5)\n})\n\ntest(\"observe\", function () {\n    const x = observable.box(3)\n    const x2 = computed(function () {\n        return x.get() * 2\n    })\n    const b = []\n\n    const cancel = mobx.autorun(function () {\n        b.push(x2.get())\n    })\n\n    x.set(4)\n    x.set(5)\n    expect(b).toEqual([6, 8, 10])\n    cancel()\n    x.set(7)\n    expect(b).toEqual([6, 8, 10])\n})\n\ntest(\"when\", function () {\n    const x = observable.box(3)\n\n    let called = 0\n    mobx.when(\n        function () {\n            return x.get() === 4\n        },\n        function () {\n            called += 1\n        }\n    )\n\n    x.set(5)\n    expect(called).toBe(0)\n    x.set(4)\n    expect(called).toBe(1)\n    x.set(3)\n    expect(called).toBe(1)\n    x.set(4)\n    expect(called).toBe(1)\n})\n\ntest(\"when 2\", function () {\n    const x = observable.box(3)\n\n    let called = 0\n    const d = mobx.when(\n        function () {\n            return x.get() === 3\n        },\n        function () {\n            called += 1\n        },\n        { name: \"when x is 3\" }\n    )\n\n    expect(called).toBe(1)\n    expect(x.observers_.size).toBe(0)\n    x.set(5)\n    x.set(3)\n    expect(called).toBe(1)\n\n    expect(d[$mobx].name_).toBe(\"when x is 3\")\n})\n\nfunction stripSpyOutput(events) {\n    events.forEach(ev => {\n        delete ev.time\n        delete ev.fn\n        delete ev.object\n    })\n    return events\n}\n\ntest(\"issue 50\", function (done) {\n    m._resetGlobalState()\n    mobx._getGlobalState().mobxGuid = 0\n    const x = observable({\n        a: true,\n        b: false,\n        get c() {\n            events.push(\"calc c\")\n            return this.b\n        }\n    })\n\n    let result\n    const events = []\n    const disposer1 = mobx.autorun(function ar() {\n        events.push(\"auto\")\n        result = [x.a, x.b, x.c].join(\",\")\n    })\n\n    const disposer2 = mobx.spy(function (info) {\n        events.push(info)\n    })\n\n    setTimeout(function () {\n        mobx.transaction(function () {\n            events.push(\"transstart\")\n            x.a = !x.a\n            x.b = !x.b\n            events.push(\"transpreend\")\n        })\n        events.push(\"transpostend\")\n        expect(result).toBe(\"false,true,true\")\n        expect(x.c).toBe(x.b)\n\n        expect(stripSpyOutput(events)).toMatchSnapshot()\n\n        disposer1()\n        disposer2()\n        done()\n    }, 500)\n})\n\ntest(\"verify transaction events\", function () {\n    m._resetGlobalState()\n    mobx._getGlobalState().mobxGuid = 0\n\n    const x = observable({\n        b: 1,\n        get c() {\n            events.push(\"calc c\")\n            return this.b\n        }\n    })\n\n    const events = []\n    const disposer1 = mobx.autorun(function ar() {\n        events.push(\"auto\")\n        x.c\n    })\n\n    const disposer2 = mobx.spy(function (info) {\n        events.push(info)\n    })\n\n    mobx.transaction(function () {\n        events.push(\"transstart\")\n        x.b = 1\n        x.b = 2\n        events.push(\"transpreend\")\n    })\n    events.push(\"transpostend\")\n\n    expect(stripSpyOutput(events)).toMatchSnapshot()\n\n    disposer1()\n    disposer2()\n})\n\ntest(\"verify array in transaction\", function () {\n    const ar = observable([])\n    let aCount = 0\n    let aValue\n\n    mobx.autorun(function () {\n        aCount++\n        aValue = 0\n        for (let i = 0; i < ar.length; i++) aValue += ar[i]\n    })\n\n    mobx.transaction(function () {\n        ar.push(2)\n        ar.push(3)\n        ar.push(4)\n        ar.unshift(1)\n    })\n    expect(aValue).toBe(10)\n    expect(aCount).toBe(2)\n})\n\ntest(\"delay autorun until end of transaction\", function () {\n    m._resetGlobalState()\n    mobx._getGlobalState().mobxGuid = 0\n    const events = []\n    const x = observable({\n        a: 2,\n        get b() {\n            events.push(\"calc y\")\n            return this.a\n        }\n    })\n    let disposer1\n    const disposer2 = mobx.spy(function (info) {\n        events.push(info)\n    })\n    let didRun = false\n\n    mobx.transaction(function () {\n        mobx.transaction(function () {\n            disposer1 = mobx.autorun(function test() {\n                didRun = true\n                events.push(\"auto\")\n                x.b\n            })\n\n            expect(didRun).toBe(false)\n\n            x.a = 3\n            x.a = 4\n\n            events.push(\"end1\")\n        })\n        expect(didRun).toBe(false)\n        x.a = 5\n        events.push(\"end2\")\n    })\n\n    expect(didRun).toBe(true)\n    events.push(\"post trans1\")\n    x.a = 6\n    events.push(\"post trans2\")\n    disposer1()\n    x.a = 3\n    events.push(\"post trans3\")\n\n    expect(stripSpyOutput(events)).toMatchSnapshot()\n\n    disposer2()\n})\n\ntest(\"prematurely end autorun\", function () {\n    const x = observable.box(2)\n    let dis1, dis2\n    mobx.transaction(function () {\n        dis1 = mobx.autorun(function () {\n            x.get()\n        })\n        dis2 = mobx.autorun(function () {\n            x.get()\n        })\n\n        expect(x.observers_.size).toBe(0)\n        expect(dis1[$mobx].observing_.length).toBe(0)\n        expect(dis2[$mobx].observing_.length).toBe(0)\n\n        dis1()\n    })\n    expect(x.observers_.size).toBe(1)\n    expect(dis1[$mobx].observing_.length).toBe(0)\n    expect(dis2[$mobx].observing_.length).toBe(1)\n\n    dis2()\n\n    expect(x.observers_.size).toBe(0)\n    expect(dis1[$mobx].observing_.length).toBe(0)\n    expect(dis2[$mobx].observing_.length).toBe(0)\n})\n\ntest(\"computed values believe NaN === NaN\", function () {\n    const a = observable.box(2)\n    const b = observable.box(3)\n    const c = computed(function () {\n        return String(a.get() * b.get())\n    })\n    const buf = buffer()\n    m.observe(c, buf)\n\n    a.set(NaN)\n    b.set(NaN)\n    a.set(NaN)\n    a.set(2)\n    b.set(3)\n\n    expect(buf.toArray()).toEqual([\"NaN\", \"6\"])\n})\n\ntest(\"computed values believe deep NaN === deep NaN when using compareStructural\", function () {\n    const a = observable({ b: { a: 1 } })\n    const c = computed(\n        function () {\n            return a.b\n        },\n        { compareStructural: true }\n    )\n\n    const buf = new buffer()\n    m.observe(c, newValue => {\n        buf(newValue)\n    })\n\n    a.b = { a: NaN }\n    a.b = { a: NaN }\n    a.b = { a: NaN }\n    a.b = { a: 2 }\n    a.b = { a: NaN }\n\n    const bufArray = buf.toArray()\n    expect(isNaN(bufArray[0].b)).toBe(true)\n    expect(bufArray[1]).toEqual({ a: 2 })\n    expect(isNaN(bufArray[2].b)).toEqual(true)\n    expect(bufArray.length).toBe(3)\n})\n\ntest(\"issue 71, transacting running transformation\", function () {\n    const state = mobx.observable({\n        things: []\n    })\n\n    function Thing(value) {\n        mobx.extendObservable(this, {\n            value: value,\n            get pos() {\n                return state.things.indexOf(this)\n            },\n            get isVisible() {\n                return this.pos !== -1\n            }\n        })\n\n        mobx.when(\n            () => {\n                return this.isVisible\n            },\n            () => {\n                if (this.pos < 4) state.things.push(new Thing(value + 1))\n            }\n        )\n    }\n\n    let copy\n    let vSum\n    mobx.autorun(function () {\n        copy = state.things.map(function (thing) {\n            return thing.value\n        })\n        vSum = state.things.reduce(function (a, thing) {\n            return a + thing.value\n        }, 0)\n    })\n\n    expect(copy).toEqual([])\n\n    mobx.transaction(function () {\n        state.things.push(new Thing(1))\n    })\n\n    expect(copy).toEqual([1, 2, 3, 4, 5])\n    expect(vSum).toBe(15)\n\n    state.things.splice(0, 2)\n    state.things.push(new Thing(6))\n\n    expect(copy).toEqual([3, 4, 5, 6, 7])\n    expect(vSum).toBe(25)\n})\n\ntest(\"eval in transaction\", function () {\n    let bCalcs = 0\n    const x = mobx.observable({\n        a: 1,\n        get b() {\n            bCalcs++\n            return this.a * 2\n        }\n    })\n    let c\n\n    mobx.autorun(function () {\n        c = x.b\n    })\n\n    expect(bCalcs).toBe(1)\n    expect(c).toBe(2)\n\n    mobx.transaction(function () {\n        x.a = 3\n        expect(x.b).toBe(6)\n        expect(bCalcs).toBe(2)\n        expect(c).toBe(2)\n\n        x.a = 4\n        expect(x.b).toBe(8)\n        expect(bCalcs).toBe(3)\n        expect(c).toBe(2)\n    })\n    expect(bCalcs).toBe(3) // 2 or 3 would be fine as well\n    expect(c).toBe(8)\n})\n\ntest(\"forcefully tracked reaction should still yield valid results\", function () {\n    const x = observable.box(3)\n    let z\n    let runCount = 0\n    const identity = function () {\n        runCount++\n        z = x.get()\n    }\n    const a = new mobx.Reaction(\"test\", function () {\n        this.track(identity)\n    })\n    a.runReaction_()\n\n    expect(z).toBe(3)\n    expect(runCount).toBe(1)\n\n    transaction(function () {\n        x.set(4)\n        a.track(identity)\n        expect(a.isScheduled).toBe(true)\n        expect(z).toBe(4)\n        expect(runCount).toBe(2)\n    })\n\n    expect(z).toBe(4)\n    expect(runCount).toBe(2) // x is observed, so it should recompute only on dependency change\n\n    transaction(function () {\n        x.set(5)\n        expect(a.isScheduled).toBe(true)\n        a.track(identity)\n        expect(z).toBe(5)\n        expect(runCount).toBe(3)\n        expect(a.isScheduled).toBe(true)\n\n        x.set(6)\n        expect(z).toBe(5)\n        expect(runCount).toBe(3)\n    })\n    expect(a.isScheduled).toBe(false)\n    expect(z).toBe(6)\n    expect(runCount).toBe(4)\n})\n\ntest(\"autoruns created in autoruns should kick off\", function () {\n    const x = observable.box(3)\n    const x2 = []\n    let d\n\n    const a = m.autorun(function () {\n        if (d) {\n            // dispose previous autorun\n            d()\n        }\n        d = m.autorun(function () {\n            x2.push(x.get() * 2)\n        })\n    })\n\n    // a should be observed by the inner autorun, not the outer\n    expect(a[$mobx].observing_.length).toBe(0)\n    expect(d[$mobx].observing_.length).toBe(1)\n\n    x.set(4)\n    expect(x2).toEqual([6, 8])\n})\n\ntest(\"#502 extendObservable throws on objects created with Object.create(null)\", () => {\n    const a = Object.create(null)\n    mobx.extendObservable(a, { b: 3 })\n    expect(mobx.isObservableProp(a, \"b\")).toBe(true)\n})\n\ntest(\"#328 atom throwing exception if observing stuff in onObserved\", () => {\n    const b = mobx.observable.box(1)\n    const a = mobx.createAtom(\"test atom\", () => {\n        b.get()\n    })\n    const d = mobx.autorun(() => {\n        a.reportObserved() // threw\n    })\n    d()\n})\n\ntest(\"prematurely ended autoruns are cleaned up properly\", () => {\n    const a = mobx.observable.box(1)\n    const b = mobx.observable.box(2)\n    const c = mobx.observable.box(3)\n    let called = 0\n\n    const d = mobx.autorun(() => {\n        called++\n        if (a.get() === 2) {\n            d() // dispose\n            b.get() // consume\n            a.set(3) // cause itself to re-run, but, disposed!\n        } else {\n            c.get()\n        }\n    })\n\n    expect(called).toBe(1)\n    expect(a.observers_.size).toBe(1)\n    expect(b.observers_.size).toBe(0)\n    expect(c.observers_.size).toBe(1)\n    expect(d[$mobx].observing_.length).toBe(2)\n\n    a.set(2)\n\n    expect(called).toBe(2)\n    expect(a.observers_.size).toBe(0)\n    expect(b.observers_.size).toBe(0)\n    expect(c.observers_.size).toBe(0)\n    expect(d[$mobx].observing_.length).toBe(0)\n})\n\ntest(\"unoptimizable subscriptions are diffed correctly\", () => {\n    const a = mobx.observable.box(1)\n    const b = mobx.observable.box(1)\n    const c = mobx.computed(() => {\n        a.get()\n        return 3\n    })\n    let called = 0\n    let val = 0\n\n    const d = mobx.autorun(() => {\n        called++\n        a.get()\n        c.get() // reads a as well\n        val = a.get()\n        if (\n            b.get() === 1 // only on first run\n        )\n            a.get() // second run: one read less for a\n    })\n\n    expect(called).toBe(1)\n    expect(val).toBe(1)\n    expect(a.observers_.size).toBe(2)\n    expect(b.observers_.size).toBe(1)\n    expect(c.observers_.size).toBe(1)\n    expect(d[$mobx].observing_.length).toBe(3) // 3 would be better!\n\n    b.set(2)\n\n    expect(called).toBe(2)\n    expect(val).toBe(1)\n    expect(a.observers_.size).toBe(2)\n    expect(b.observers_.size).toBe(1)\n    expect(c.observers_.size).toBe(1)\n    expect(d[$mobx].observing_.length).toBe(3) // c was cached so accessing a was optimizable\n\n    a.set(2)\n\n    expect(called).toBe(3)\n    expect(val).toBe(2)\n    expect(a.observers_.size).toBe(2)\n    expect(b.observers_.size).toBe(1)\n    expect(c.observers_.size).toBe(1)\n    expect(d[$mobx].observing_.length).toBe(3) // c was cached so accessing a was optimizable\n\n    d()\n})\n\ntest(\"atom events #427\", () => {\n    let start = 0\n    let stop = 0\n    let runs = 0\n\n    const a = mobx.createAtom(\n        \"test\",\n        () => start++,\n        () => stop++\n    )\n    expect(a.reportObserved()).toEqual(false)\n\n    expect(start).toBe(0)\n    expect(stop).toBe(0)\n\n    let d = mobx.autorun(() => {\n        runs++\n        expect(a.reportObserved()).toBe(true)\n        expect(start).toBe(1)\n        expect(a.reportObserved()).toBe(true)\n        expect(start).toBe(1)\n    })\n\n    expect(runs).toBe(1)\n    expect(start).toBe(1)\n    expect(stop).toBe(0)\n    a.reportChanged()\n    expect(runs).toBe(2)\n    expect(start).toBe(1)\n    expect(stop).toBe(0)\n\n    d()\n    expect(runs).toBe(2)\n    expect(start).toBe(1)\n    expect(stop).toBe(1)\n\n    expect(a.reportObserved()).toBe(false)\n    expect(start).toBe(1)\n    expect(stop).toBe(1)\n\n    d = mobx.autorun(() => {\n        expect(a.reportObserved()).toBe(true)\n        expect(start).toBe(2)\n        a.reportObserved()\n        expect(start).toBe(2)\n    })\n\n    expect(start).toBe(2)\n    expect(stop).toBe(1)\n    a.reportChanged()\n    expect(start).toBe(2)\n    expect(stop).toBe(1)\n\n    d()\n    expect(stop).toBe(2)\n})\n\ntest(\"#3563 reportObserved in batch\", () => {\n    let start = 0\n    let stop = 0\n    let computed = 0\n    let observed = 0\n\n    const a = mobx.createAtom(\n        \"test\",\n        () => start++,\n        () => stop++\n    )\n    const c = mobx.computed(() => {\n        computed += 1\n        observed += a.reportObserved() ? 1 : 0\n    })\n    c.get()\n    expect(start).toBe(0)\n    expect(stop).toBe(0)\n    expect(computed).toBe(1)\n    expect(observed).toBe(0)\n\n    mobx.runInAction(() => {\n        c.get()\n        expect(start).toBe(0)\n        expect(stop).toBe(0)\n        expect(computed).toBe(2)\n        expect(observed).toBe(0)\n\n        c.get()\n        expect(computed).toBe(2)\n        expect(observed).toBe(0)\n    })\n\n    const c2 = mobx.computed(() => {\n        c.get()\n    })\n    c2.get()\n    expect(start).toBe(0)\n    expect(stop).toBe(0)\n    expect(computed).toBe(3)\n    expect(observed).toBe(0)\n})\n\ntest(\"verify calculation count\", () => {\n    const calcs = []\n    const a = observable.box(1)\n    const b = mobx.computed(() => {\n        calcs.push(\"b\")\n        return a.get()\n    })\n    const c = mobx.computed(() => {\n        calcs.push(\"c\")\n        return b.get()\n    })\n    const d = mobx.autorun(() => {\n        calcs.push(\"d\")\n        return b.get()\n    })\n    const e = mobx.autorun(() => {\n        calcs.push(\"e\")\n        return c.get()\n    })\n    const f = mobx.computed(() => {\n        calcs.push(\"f\")\n        return c.get()\n    })\n\n    expect(f.get()).toBe(1)\n\n    calcs.push(\"change\")\n    a.set(2)\n\n    expect(f.get()).toBe(2)\n\n    calcs.push(\"transaction\")\n    transaction(() => {\n        expect(b.get()).toBe(2)\n        expect(c.get()).toBe(2)\n        expect(f.get()).toBe(2)\n        expect(f.get()).toBe(2)\n        calcs.push(\"change\")\n        a.set(3)\n        expect(b.get()).toBe(3)\n        expect(b.get()).toBe(3)\n        calcs.push(\"try c\")\n        expect(c.get()).toBe(3)\n        expect(c.get()).toBe(3)\n        calcs.push(\"try f\")\n        expect(f.get()).toBe(3)\n        expect(f.get()).toBe(3)\n        calcs.push(\"end transaction\")\n    })\n\n    expect(calcs).toEqual([\n        \"d\",\n        \"b\",\n        \"e\",\n        \"c\",\n        \"f\",\n        \"change\",\n        \"b\",\n        \"d\",\n        \"c\",\n        \"e\",\n        \"f\", // would have expected b c e d f, but alas\n        \"transaction\",\n        \"f\",\n        \"change\",\n        \"b\",\n        \"try c\",\n        \"c\",\n        \"try f\",\n        \"f\",\n        \"end transaction\",\n        \"d\", // would have expected e d\n        \"e\"\n    ])\n\n    d()\n    e()\n})\n\ntest(\"support computed property getters / setters\", () => {\n    let a = observable({\n        size: 1,\n        get volume() {\n            return this.size * this.size\n        }\n    })\n\n    expect(a.volume).toBe(1)\n    a.size = 3\n    expect(a.volume).toBe(9)\n\n    expect(() => (a.volume = 9)).toThrow(\n        /It is not possible to assign a new value to a computed value/\n    )\n\n    a = {}\n    mobx.extendObservable(a, {\n        size: 2,\n        get volume() {\n            return this.size * this.size\n        },\n        set volume(v) {\n            this.size = Math.sqrt(v)\n        }\n    })\n\n    const values = []\n    const d = mobx.autorun(() => values.push(a.volume))\n\n    a.volume = 9\n    mobx.transaction(() => {\n        a.volume = 100\n        a.volume = 64\n    })\n\n    expect(values).toEqual([4, 9, 64])\n    expect(a.size).toEqual(8)\n\n    d()\n})\n\ntest(\"computed getter / setter for plan objects should succeed\", function () {\n    const b = observable({\n        a: 3,\n        get propX() {\n            return this.a * 2\n        },\n        set propX(v) {\n            this.a = v\n        }\n    })\n\n    const values = []\n    mobx.autorun(function () {\n        return values.push(b.propX)\n    })\n    expect(b.propX).toBe(6)\n    b.propX = 4\n    expect(b.propX).toBe(8)\n\n    expect(values).toEqual([6, 8])\n})\n\ntest(\"helpful error for self referencing setter\", function () {\n    const a = observable({\n        x: 1,\n        get y() {\n            return this.x\n        },\n        set y(v) {\n            this.y = v // woops...;-)\n        }\n    })\n\n    expect(() => (a.y = 2)).toThrow(/The setter of computed value/)\n})\n\ntest(\"#558 boxed observables stay boxed observables\", function () {\n    const a = observable({\n        x: observable.box(3)\n    })\n\n    expect(typeof a.x).toBe(\"object\")\n    expect(typeof a.x.get).toBe(\"function\")\n})\n\ntest(\"iscomputed\", function () {\n    expect(mobx.isComputed(observable.box(3))).toBe(false)\n    expect(\n        mobx.isComputed(\n            mobx.computed(function () {\n                return 3\n            })\n        )\n    ).toBe(true)\n\n    const x = observable({\n        a: 3,\n        get b() {\n            return this.a\n        }\n    })\n\n    expect(mobx.isComputedProp(x, \"a\")).toBe(false)\n    expect(mobx.isComputedProp(x, \"b\")).toBe(true)\n})\n\ntest(\"603 - transaction should not kill reactions\", () => {\n    const a = observable.box(1)\n    let b = 1\n    const d = mobx.autorun(() => {\n        b = a.get()\n    })\n\n    try {\n        mobx.transaction(() => {\n            a.set(2)\n            throw 3\n        })\n    } catch (e) {\n        // empty\n    }\n\n    expect(a.observers_.size).toBe(1)\n    expect(d[$mobx].observing_.length).toBe(1)\n    const g = m._getGlobalState()\n    expect(g.inBatch).toEqual(0)\n    expect(g.pendingReactions.length).toEqual(0)\n    expect(g.pendingUnobservations.length).toEqual(0)\n    expect(g.trackingDerivation).toEqual(null)\n\n    expect(b).toBe(2)\n    a.set(3)\n    expect(b).toBe(3)\n})\n\ntest(\"#561 test toPrimitive() of observable objects\", function () {\n    if (typeof Symbol !== \"undefined\" && Symbol.toPrimitive) {\n        let x = observable.box(3)\n\n        expect(x.valueOf()).toBe(3)\n        expect(x[Symbol.toPrimitive]()).toBe(3)\n\n        expect(+x).toBe(3)\n        expect(++x).toBe(4)\n\n        const y = observable.box(3)\n\n        expect(y + 7).toBe(10)\n\n        const z = computed(() => ({ a: 3 }))\n        expect(3 + z).toBe(\"3[object Object]\")\n    } else {\n        let x = observable.box(3)\n\n        expect(x.valueOf()).toBe(3)\n        expect(x[\"@@toPrimitive\"]()).toBe(3)\n\n        expect(+x).toBe(3)\n        expect(++x).toBe(4)\n\n        const y = observable.box(3)\n\n        expect(y + 7).toBe(10)\n\n        const z = computed(() => ({ a: 3 }))\n        expect(\"3\" + z[\"@@toPrimitive\"]()).toBe(\"3[object Object]\")\n    }\n})\n\ntest(\"computed equals function only invoked when necessary\", () => {\n    utils.supressConsole(() => {\n        const comparisons = []\n        const loggingComparer = (from, to) => {\n            comparisons.push({ from, to })\n            return from === to\n        }\n\n        const left = mobx.observable.box(\"A\")\n        const right = mobx.observable.box(\"B\")\n        const combinedToLowerCase = mobx.computed(\n            () => left.get().toLowerCase() + right.get().toLowerCase(),\n            { equals: loggingComparer }\n        )\n\n        const values = []\n        let disposeAutorun = mobx.autorun(() => values.push(combinedToLowerCase.get()))\n\n        // No comparison should be made on the first value\n        expect(comparisons).toEqual([])\n\n        // First change will cause a comparison\n        left.set(\"C\")\n        expect(comparisons).toEqual([{ from: \"ab\", to: \"cb\" }])\n\n        // Transition *to* CaughtException in the computed won't cause a comparison\n        left.set(null)\n        expect(comparisons).toEqual([{ from: \"ab\", to: \"cb\" }])\n\n        // Transition *between* CaughtException-s in the computed won't cause a comparison\n        right.set(null)\n        expect(comparisons).toEqual([{ from: \"ab\", to: \"cb\" }])\n\n        // Transition *from* CaughtException in the computed won't cause a comparison\n        left.set(\"D\")\n        right.set(\"E\")\n        expect(comparisons).toEqual([{ from: \"ab\", to: \"cb\" }])\n\n        // Another value change will cause a comparison\n        right.set(\"F\")\n        expect(comparisons).toEqual([\n            { from: \"ab\", to: \"cb\" },\n            { from: \"de\", to: \"df\" }\n        ])\n\n        // Becoming unobserved, then observed won't cause a comparison\n        disposeAutorun()\n        disposeAutorun = mobx.autorun(() => values.push(combinedToLowerCase.get()))\n        expect(comparisons).toEqual([\n            { from: \"ab\", to: \"cb\" },\n            { from: \"de\", to: \"df\" }\n        ])\n\n        expect(values).toEqual([\"ab\", \"cb\", \"de\", \"df\", \"df\"])\n\n        disposeAutorun()\n    })\n})\n\n// document that extendObservable is not inheritance compatible,\n// and make sure this does work with decorate\ntest(\"Issue 1092 - Should not access attributes of siblings in the prot. chain\", () => {\n    // The parent is an observable\n    // and has an attribute\n    const parent = {}\n    mobx.extendObservable(parent, {\n        staticObservable: 11\n    })\n\n    // Child1 \"inherit\" from the parent\n    // and has an observable attribute\n    const child1 = Object.create(parent)\n    mobx.extendObservable(child1, {\n        attribute: 7\n    })\n\n    // Child2 also \"inherit\" from the parent\n    // But does not have any observable attribute\n    const child2 = Object.create(parent)\n\n    // The second child should not be aware of the attribute of his\n    // sibling child1\n    expect(typeof child2.attribute).toBe(\"undefined\")\n\n    expect(parent.staticObservable).toBe(11)\n    parent.staticObservable = 12\n    expect(parent.staticObservable).toBe(12)\n})\n\ntest(\"Issue 1092 - We should be able to define observable on all siblings\", () => {\n    expect.assertions(1)\n\n    // The parent is an observable\n    const parent = {}\n    mobx.extendObservable(parent, {})\n\n    // Child1 \"inherit\" from the parent\n    // and has an observable attribute\n    const child1 = Object.create(parent)\n    mobx.extendObservable(child1, {\n        attribute: 7\n    })\n\n    // Child2 also \"inherit\" from the parent\n    // But does not have any observable attribute\n    const child2 = Object.create(parent)\n    expect(() => {\n        mobx.extendObservable(child2, {\n            attribute: 8\n        })\n    }).not.toThrow()\n})\n\ntest(\"Issue 1120 - isComputed should return false for a non existing property\", () => {\n    expect(mobx.isComputedProp({}, \"x\")).toBe(false)\n    expect(mobx.isComputedProp(observable({}), \"x\")).toBe(false)\n})\n\ntest(\"computed comparer works with decorate (plain)\", () => {\n    // TODO: this test was codemodded wrong\n    const sameTime = (from, to) => from.hour === to.hour && from.minute === to.minute\n    function Time(hour, minute) {\n        this.hour = hour\n        this.minute = minute\n        makeObservable(this, {\n            hour: observable,\n            minute: observable,\n            time: computed({ equals: sameTime })\n        })\n    }\n\n    Object.defineProperty(Time.prototype, \"time\", {\n        configurable: true,\n        enumerable: true,\n        get() {\n            return { hour: this.hour, minute: this.minute }\n        }\n    })\n    const time = new Time(9, 0)\n\n    const changes = []\n    const disposeAutorun = autorun(() => changes.push(time.time))\n\n    expect(changes).toEqual([{ hour: 9, minute: 0 }])\n    time.hour = 9\n    expect(changes).toEqual([{ hour: 9, minute: 0 }])\n    time.minute = 0\n    expect(changes).toEqual([{ hour: 9, minute: 0 }])\n    time.hour = 10\n    expect(changes).toEqual([\n        { hour: 9, minute: 0 },\n        { hour: 10, minute: 0 }\n    ])\n    time.minute = 30\n    expect(changes).toEqual([\n        { hour: 9, minute: 0 },\n        { hour: 10, minute: 0 },\n        { hour: 10, minute: 30 }\n    ])\n\n    disposeAutorun()\n})\n\ntest(\"computed comparer works with decorate (plain) - 2\", () => {\n    const sameTime = (from, to) => from.hour === to.hour && from.minute === to.minute\n    function Time(hour, minute) {\n        extendObservable(\n            this,\n            {\n                hour,\n                minute,\n                get time() {\n                    return { hour: this.hour, minute: this.minute }\n                }\n            },\n            {\n                time: computed({ equals: sameTime })\n            }\n        )\n    }\n    const time = new Time(9, 0)\n\n    const changes = []\n    const disposeAutorun = autorun(() => changes.push(time.time))\n\n    expect(changes).toEqual([{ hour: 9, minute: 0 }])\n    time.hour = 9\n    expect(changes).toEqual([{ hour: 9, minute: 0 }])\n    time.minute = 0\n    expect(changes).toEqual([{ hour: 9, minute: 0 }])\n    time.hour = 10\n    expect(changes).toEqual([\n        { hour: 9, minute: 0 },\n        { hour: 10, minute: 0 }\n    ])\n    time.minute = 30\n    expect(changes).toEqual([\n        { hour: 9, minute: 0 },\n        { hour: 10, minute: 0 },\n        { hour: 10, minute: 30 }\n    ])\n\n    disposeAutorun()\n})\n\ntest(\"computed comparer works with decorate (plain) - 3\", () => {\n    const sameTime = (from, to) => from.hour === to.hour && from.minute === to.minute\n    const time = observable.object(\n        {\n            hour: 9,\n            minute: 0,\n            get time() {\n                return { hour: this.hour, minute: this.minute }\n            }\n        },\n        {\n            time: computed({ equals: sameTime })\n        }\n    )\n\n    const changes = []\n    const disposeAutorun = autorun(() => changes.push(time.time))\n\n    expect(changes).toEqual([{ hour: 9, minute: 0 }])\n    time.hour = 9\n    expect(changes).toEqual([{ hour: 9, minute: 0 }])\n    time.minute = 0\n    expect(changes).toEqual([{ hour: 9, minute: 0 }])\n    time.hour = 10\n    expect(changes).toEqual([\n        { hour: 9, minute: 0 },\n        { hour: 10, minute: 0 }\n    ])\n    time.minute = 30\n    expect(changes).toEqual([\n        { hour: 9, minute: 0 },\n        { hour: 10, minute: 0 },\n        { hour: 10, minute: 30 }\n    ])\n\n    disposeAutorun()\n})\n\ntest(\"can create computed with setter\", () => {\n    let y = 1\n    let x = mobx.computed(() => y, {\n        set: v => {\n            y = v * 2\n        }\n    })\n    expect(x.get()).toBe(1)\n    x.set(3)\n    expect(x.get()).toBe(6)\n})\n\ntest(\"can make non-extenible objects observable\", () => {\n    const base = { x: 3 }\n    Object.freeze(base)\n    const o = mobx.observable(base)\n    o.x = 4\n    expect(o.x).toBe(4)\n    expect(mobx.isObservableProp(o, \"x\")).toBeTruthy()\n})\n\ntest(\"keeping computed properties alive does not run before access\", () => {\n    let calcs = 0\n    observable(\n        {\n            x: 1,\n            get y() {\n                calcs++\n                return this.x * 2\n            }\n        },\n        {\n            y: mobx.computed({ keepAlive: true })\n        }\n    )\n\n    expect(calcs).toBe(0) // initially there is no calculation done\n})\n\ntest(\"(for objects) keeping computed properties alive does not run before access\", () => {\n    let calcs = 0\n    class Foo {\n        x = 1\n\n        constructor() {\n            makeObservable(this, {\n                x: observable,\n                y: computed({ keepAlive: true })\n            })\n        }\n\n        get y() {\n            calcs++\n            return this.x * 2\n        }\n    }\n    new Foo()\n\n    expect(calcs).toBe(0) // initially there is no calculation done\n})\n\ntest(\"keeping computed properties alive runs on first access\", () => {\n    let calcs = 0\n    const x = observable(\n        {\n            x: 1,\n            get y() {\n                calcs++\n                return this.x * 2\n            }\n        },\n        {\n            y: mobx.computed({ keepAlive: true })\n        }\n    )\n\n    expect(calcs).toBe(0)\n    expect(x.y).toBe(2) // perform calculation on access\n    expect(calcs).toBe(1)\n})\n\ntest(\"keeping computed properties alive caches values on subsequent accesses\", () => {\n    let calcs = 0\n    const x = observable(\n        {\n            x: 1,\n            get y() {\n                calcs++\n                return this.x * 2\n            }\n        },\n        {\n            y: mobx.computed({ keepAlive: true })\n        }\n    )\n\n    expect(x.y).toBe(2) // first access: do calculation\n    expect(x.y).toBe(2) // second access: use cached value, no calculation\n    expect(calcs).toBe(1) // only one calculation: cached!\n})\n\ntest(\"keeping computed properties alive does not recalculate when dirty\", () => {\n    let calcs = 0\n    const x = observable(\n        {\n            x: 1,\n            get y() {\n                calcs++\n                return this.x * 2\n            }\n        },\n        {\n            y: mobx.computed({ keepAlive: true })\n        }\n    )\n\n    expect(x.y).toBe(2) // first access: do calculation\n    expect(calcs).toBe(1)\n    x.x = 3 // mark as dirty: no calculation\n    expect(calcs).toBe(1)\n    expect(x.y).toBe(6)\n})\n\ntest(\"keeping computed properties alive recalculates when accessing it dirty\", () => {\n    let calcs = 0\n    const x = observable(\n        {\n            x: 1,\n            get y() {\n                calcs++\n                return this.x * 2\n            }\n        },\n        {\n            y: mobx.computed({ keepAlive: true })\n        }\n    )\n\n    expect(x.y).toBe(2) // first access: do calculation\n    expect(calcs).toBe(1)\n    x.x = 3 // mark as dirty: no calculation\n    expect(calcs).toBe(1)\n    expect(x.y).toBe(6) // second access: do calculation because it is dirty\n    expect(calcs).toBe(2)\n})\n\ntest(\"(for objects) keeping computed properties alive recalculates when accessing it dirty\", () => {\n    let calcs = 0\n    class Foo {\n        x = 1\n\n        constructor() {\n            makeObservable(this, {\n                x: observable,\n                y: computed({ keepAlive: true })\n            })\n        }\n\n        get y() {\n            calcs++\n            return this.x * 2\n        }\n    }\n    const x = new Foo()\n\n    expect(x.y).toBe(2) // first access: do calculation\n    expect(calcs).toBe(1)\n    x.x = 3 // mark as dirty: no calculation\n    expect(calcs).toBe(1)\n    expect(x.y).toBe(6) // second access: do calculation because it is dirty\n    expect(calcs).toBe(2)\n})\n\ntest(\"tuples\", () => {\n    // See #1391\n    function tuple() {\n        const res = new Array(arguments.length)\n        for (let i = 0; i < arguments.length; i++) mobx.extendObservable(res, { [i]: arguments[i] })\n        return res\n    }\n\n    const myStuff = tuple(1, 3)\n    const events = []\n\n    mobx.reaction(\n        () => myStuff[0],\n        val => events.push(val)\n    )\n    myStuff[1] = 17 // should not react\n    myStuff[0] = 2 // should react\n    expect(events).toEqual([2])\n\n    expect(myStuff.map(x => x * 2)).toEqual([4, 34])\n})\n\ntest(\"extendObservable should not accept complex objects as second argument\", () => {\n    class X {\n        x = 3\n    }\n    expect(() => {\n        extendObservable({}, new X())\n    }).toThrowErrorMatchingInlineSnapshot(\n        `\"[MobX] 'extendObservable' only accepts plain objects as second argument\"`\n    )\n})\n\ntest(\"observable ignores class instances #2579\", () => {\n    class C {}\n    const c = new C()\n    expect(observable(c)).toBe(c)\n})\n\ntest(\"configure({ safeDescriptors: false })\", () => {\n    function checkDescriptors(thing) {\n        Reflect.ownKeys(thing).forEach(key => {\n            const { get, set, writable, configurable } = Object.getOwnPropertyDescriptor(thing, key)\n            expect(get || set || writable).toBeTruthy()\n            expect(configurable).toBe(true)\n        })\n    }\n\n    const globalState = mobx._getGlobalState()\n    expect(globalState.safeDescriptors).toBe(true)\n    mobx.configure({ safeDescriptors: false })\n    expect(globalState.safeDescriptors).toBe(false)\n\n    class Clazz {\n        observable = 0\n        action() {}\n        get computed() {}\n        *flow() {}\n        constructor() {\n            mobx.makeObservable(this, {\n                observable: mobx.observable,\n                action: mobx.action,\n                computed: mobx.computed,\n                flow: mobx.flow\n            })\n        }\n    }\n    checkDescriptors(Clazz.prototype)\n    const clazz = new Clazz()\n    checkDescriptors(clazz)\n\n    const plain = mobx.observable({\n        observable: 0,\n        action() {},\n        get computed() {},\n        *flow() {}\n    })\n\n    checkDescriptors(plain)\n\n    mobx.configure({ safeDescriptors: true })\n    expect(globalState.safeDescriptors).toBe(true)\n})\n\ntest(\"function props are observable auto actions\", () => {\n    const o = observable({\n        observable: 0,\n        observableAutoAction() {\n            return this.observable\n        }\n    })\n    expect(isObservableProp(o, \"observable\")).toBe(true)\n    expect(isObservableProp(o, \"observableAutoAction\")).toBe(true)\n    expect(isAction(o.observableAutoAction)).toBe(true)\n    const expectedValues = [0]\n    const values = []\n    autorun(() => values.push(o.observableAutoAction()))\n    o.observable++\n    expectedValues.push(1)\n})\n\ntest(\"generator props are observable flows\", () => {\n    const o = observable({\n        observable: 0,\n        *observableFlow() {\n            return this.observable\n        }\n    })\n    expect(isObservableProp(o, \"observable\")).toBe(true)\n    expect(isObservableProp(o, \"observableFlow\")).toBe(true)\n    expect(isFlow(o.observableFlow)).toBe(true)\n})\n\ntest(\"options can be provided only once\", () => {\n    const o = makeObservable({}, {}, { name: \"TestObject\" })\n    const error = `[MobX] Options can't be provided for already observable objects`\n    expect(() => {\n        extendObservable(o, { x: 0 }, {}, {})\n    }).toThrow(error)\n\n    expect(() => {\n        o.y = 0\n        makeObservable(o, { y: observable }, {})\n    }).toThrow(error)\n})\n\ntest(\"ObservableArray.replace\", () => {\n    // both lists are small\n    let ar = observable([1])\n    let del = ar.replace([2])\n    expect(ar.toJSON()).toEqual([2])\n    expect(del).toEqual([1])\n\n    // the replacement is large\n    ar = observable([1])\n    del = ar.replace(new Array(MAX_SPLICE_SIZE))\n    expect(ar.length).toEqual(MAX_SPLICE_SIZE)\n    expect(del).toEqual([1])\n\n    // the original is large\n    ar = observable(new Array(MAX_SPLICE_SIZE))\n    del = ar.replace([2])\n    expect(ar).toEqual([2])\n    expect(del.length).toEqual(MAX_SPLICE_SIZE)\n\n    // both are large; original larger than replacement\n    ar = observable(new Array(MAX_SPLICE_SIZE + 1))\n    del = ar.replace(new Array(MAX_SPLICE_SIZE))\n    expect(ar.length).toEqual(MAX_SPLICE_SIZE)\n    expect(del.length).toEqual(MAX_SPLICE_SIZE + 1)\n\n    // both are large; replacement larger than original\n    ar = observable(new Array(MAX_SPLICE_SIZE))\n    del = ar.replace(new Array(MAX_SPLICE_SIZE + 1))\n    expect(ar.length).toEqual(MAX_SPLICE_SIZE + 1)\n    expect(del.length).toEqual(MAX_SPLICE_SIZE)\n})\n\ntest(\"ObservableArray.splice\", () => {\n    // Deleting 1 item from a large list\n    let ar = observable(new Array(MAX_SPLICE_SIZE + 1))\n    let del = ar.splice(1, 1)\n    expect(ar.length).toEqual(MAX_SPLICE_SIZE)\n    expect(del.length).toEqual(1)\n\n    // Deleting many items from a large list\n    ar = observable(new Array(MAX_SPLICE_SIZE + 2))\n    del = ar.splice(1, MAX_SPLICE_SIZE + 1)\n    expect(ar.length).toEqual(1)\n    expect(del.length).toEqual(MAX_SPLICE_SIZE + 1)\n\n    // Deleting 1 item from a large list and inserting many items\n    ar = observable(new Array(MAX_SPLICE_SIZE + 1))\n    del = ar.splice(1, 1, ...new Array(MAX_SPLICE_SIZE + 1))\n    expect(ar.length).toEqual(MAX_SPLICE_SIZE * 2 + 1)\n    expect(del.length).toEqual(1)\n\n    // Deleting many items from a large list and inserting many items\n    ar = observable(new Array(MAX_SPLICE_SIZE + 10))\n    del = ar.splice(1, MAX_SPLICE_SIZE + 1, ...new Array(MAX_SPLICE_SIZE + 1))\n    expect(ar.length).toEqual(MAX_SPLICE_SIZE + 10)\n    expect(del.length).toEqual(MAX_SPLICE_SIZE + 1)\n})\n\ndescribe(\"`requiresReaction` takes precedence over global `computedRequiresReaction`\", () => {\n    const name = \"TestComputed\"\n    let warnMsg = `[mobx] Computed value '${name}' is being read outside a reactive context. Doing a full recompute.`\n    let consoleWarnSpy\n    beforeEach(() => {\n        consoleWarnSpy = jest.spyOn(console, \"warn\").mockImplementation()\n    })\n    afterEach(() => {\n        consoleWarnSpy.mockRestore()\n        mobx._resetGlobalState()\n    })\n\n    test(\"`undefined`\", () => {\n        mobx.configure({ computedRequiresReaction: true })\n        const c = mobx.computed(() => {}, { name })\n        c.get()\n        expect(consoleWarnSpy).toHaveBeenLastCalledWith(warnMsg)\n    })\n\n    test(\"`true` over `false`\", () => {\n        mobx.configure({ computedRequiresReaction: false })\n        const c = mobx.computed(() => {}, { name, requiresReaction: true })\n        c.get()\n        expect(consoleWarnSpy).toHaveBeenLastCalledWith(warnMsg)\n    })\n\n    test(\"`false` over `true`\", () => {\n        mobx.configure({ computedRequiresReaction: true })\n        const c = mobx.computed(() => {}, { name, requiresReaction: false })\n        c.get()\n        expect(consoleWarnSpy).not.toHaveBeenCalled()\n    })\n})\n\ndescribe(\"`requiresObservable` takes precedence over global `reactionRequiresObservable`\", () => {\n    const name = \"TestReaction\"\n    let warnMsg = `[mobx] Derivation '${name}' is created/updated without reading any observable value.`\n    let consoleWarnSpy\n    beforeEach(() => {\n        consoleWarnSpy = jest.spyOn(console, \"warn\").mockImplementation()\n    })\n    afterEach(() => {\n        consoleWarnSpy.mockRestore()\n        mobx._resetGlobalState()\n    })\n\n    test(\"`undefined`\", () => {\n        mobx.configure({ reactionRequiresObservable: true })\n        const dispose = mobx.autorun(() => {}, { name })\n        dispose()\n        expect(consoleWarnSpy).toHaveBeenLastCalledWith(warnMsg)\n    })\n\n    test(\"`true` over `false`\", () => {\n        mobx.configure({ reactionRequiresObservable: false })\n        const dispose = mobx.autorun(() => {}, { name, requiresObservable: true })\n        dispose()\n        expect(consoleWarnSpy).toHaveBeenLastCalledWith(warnMsg)\n    })\n\n    test(\"`false` over `true`\", () => {\n        mobx.configure({ reactionRequiresObservable: true })\n        const dispose = mobx.autorun(() => {}, { name, requiresObservable: false })\n        dispose()\n        expect(consoleWarnSpy).not.toHaveBeenCalled()\n    })\n})\n\ntest('Observables initialization does not violate `enforceActions: \"always\"`', () => {\n    const consoleWarnSpy = jest.spyOn(console, \"warn\").mockImplementation(() => {})\n\n    const check = cb => {\n        cb()\n        expect(consoleWarnSpy).not.toHaveBeenCalled()\n    }\n\n    class MakeObservable {\n        x = 0\n        constructor() {\n            mobx.makeObservable(this, { x: true })\n        }\n    }\n    class MakeAutoObservable {\n        x = 0\n        constructor() {\n            mobx.makeAutoObservable(this)\n        }\n    }\n\n    try {\n        mobx.configure({ enforceActions: \"always\" })\n        check(() => mobx.observable(0))\n        check(() => new MakeObservable())\n        check(() => mobx.makeObservable({ x: 0 }, { x: true }))\n        check(() => new MakeAutoObservable())\n        check(() => mobx.makeAutoObservable({ x: 0 }))\n        check(() => mobx.extendObservable({}, { x: 0 }))\n        check(() => mobx.observable(new Set([0])))\n        check(() => mobx.observable(new Map([[0, 0]])))\n        check(() => mobx.observable({ x: 0 }, { proxy: false }))\n        check(() => mobx.observable({ x: 0 }, { proxy: true }))\n        check(() => mobx.observable([0], { proxy: false }))\n        check(() => mobx.observable([0], { proxy: true }))\n        check(() => mobx.computed(() => 0))\n    } finally {\n        consoleWarnSpy.mockRestore()\n        mobx._resetGlobalState()\n    }\n})\n\ntest(\"enforceAction is respected when changing keys of observable object\", () => {\n    const consoleWarnSpy = jest.spyOn(console, \"warn\").mockImplementation(() => {})\n    try {\n        mobx.configure({ enforceActions: \"always\" })\n        const o = mobx.observable({ x: 0 })\n\n        o.y = 0\n        expect(consoleWarnSpy).toHaveBeenCalled()\n\n        consoleWarnSpy.mockClear()\n\n        delete o.x\n        expect(consoleWarnSpy).toHaveBeenCalled()\n    } finally {\n        consoleWarnSpy.mockRestore()\n        mobx._resetGlobalState()\n    }\n})\n\ntest(\"state version does not update on observable creation\", () => {\n    const globalState = getGlobalState()\n\n    const check = cb => {\n        const prevStateVersion = globalState.stateVersion\n        cb()\n        expect(prevStateVersion).toBe(globalState.stateVersion)\n    }\n\n    class MakeObservable {\n        x = 0\n        constructor() {\n            mobx.makeObservable(this, { x: true })\n        }\n    }\n    class MakeAutoObservable {\n        x = 0\n        constructor() {\n            mobx.makeAutoObservable(this)\n        }\n    }\n\n    class MakeObservableSubclass extends MakeObservable {\n        y = 0\n        constructor() {\n            super()\n            mobx.makeObservable(this, { y: true })\n        }\n    }\n\n    check(() => mobx.observable(0))\n    check(() => new MakeObservable())\n    // Batch is required by design - without batch reactions can be created/invoked inbetween individual constructors and they must see updated state version.\n    // https://github.com/mobxjs/mobx/pull/3732#discussion_r1285099080\n    check(mobx.action(() => new MakeObservableSubclass()))\n    check(() => mobx.makeObservable({ x: 0 }, { x: true }))\n    check(() => new MakeAutoObservable())\n    check(() => mobx.makeAutoObservable({ x: 0 }))\n    check(() => mobx.extendObservable({}, { x: 0 }))\n    check(() => mobx.observable(new Set([0])))\n    check(() => mobx.observable(new Map([[0, 0]])))\n    check(() => mobx.observable({ x: 0 }, { proxy: false }))\n    check(() => mobx.observable({ x: 0 }, { proxy: true }))\n    check(() => mobx.observable([0], { proxy: false }))\n    check(() => mobx.observable([0], { proxy: true }))\n    check(() => mobx.computed(() => 0))\n})\n\ntest(\"#3747\", () => {\n    mobx.runInAction(() => {\n        const o = observable.box(0)\n        const c = computed(() => o.get())\n        expect(c.get()).toBe(0)\n        o.set(1)\n        expect(c.get()).toBe(1) // would fail\n    })\n})\n"
  },
  {
    "path": "packages/mobx/__tests__/v5/base/observe.ts",
    "content": "import { observable, observe, computed } from \"../../../src/mobx\"\n\ntest(\"observe object and map properties\", () => {\n    const map = observable.map({ a: 1 })\n    const events: any[] = []\n\n    expect(() => observe(map, \"b\", () => {})).toThrow(\n        /the entry 'b' does not exist in the observable map/\n    )\n\n    const d1 = observe(map, \"a\", e => events.push([e.newValue, e.oldValue]))\n\n    map.set(\"a\", 2)\n    map.set(\"a\", 3)\n    d1()\n    map.set(\"a\", 4)\n\n    const o = observable({ a: 5 })\n\n    expect(() => observe(o, \"b\" as any, () => {})).toThrow(\n        /no observable property 'b' found on the observable object/\n    )\n    const d2 = observe(o, \"a\", e => events.push([e.newValue, e.oldValue]))\n\n    o.a = 6\n    o.a = 7\n    d2()\n    o.a = 8\n\n    expect(events).toEqual([\n        [2, 1],\n        [3, 2],\n        [6, 5],\n        [7, 6]\n    ])\n})\n\ntest(\"observe computed values\", () => {\n    const events: any[] = []\n\n    const v = observable.box(0)\n    const f = observable.box(0)\n    const c = computed(() => v.get())\n\n    observe(c, e => {\n        v.get()\n        f.get()\n        events.push([e.newValue, e.oldValue])\n    })\n\n    v.set(6)\n    f.set(10)\n\n    expect(events).toEqual([[6, 0]])\n})\n"
  },
  {
    "path": "packages/mobx/__tests__/v5/base/proxies.js",
    "content": "import {\n    computed,\n    isComputedProp,\n    isAction,\n    isObservableProp,\n    autorun,\n    observable,\n    action,\n    reaction,\n    extendObservable,\n    keys,\n    makeObservable\n} from \"../../../src/mobx\"\n\nimport { stripAdminFromDescriptors } from \"../utils/test-utils\"\n\ntest(\"should react to key removal (unless reconfiguraing to empty) - 1\", () => {\n    const events = []\n    const x = observable.object({\n        y: 1,\n        z: 1\n    })\n\n    reaction(\n        () => Object.keys(x),\n        keys => events.push(keys.join(\",\")),\n        { fireImmediately: true }\n    )\n    expect(events).toEqual([\"y,z\"])\n    delete x.y\n    expect(events).toEqual([\"y,z\", \"z\"])\n    // should not trigger another time..\n    delete x.y\n    expect(events).toEqual([\"y,z\", \"z\"])\n})\n\ntest(\"should react to key removal (unless reconfiguraing to empty) - 2\", () => {\n    const events = []\n    const x = observable.object({\n        y: 1,\n        z: 1\n    })\n\n    reaction(\n        () => x.z,\n        v => events.push(v)\n    )\n\n    delete x.z\n    expect(events).toEqual([undefined])\n})\n\ntest(\"should react to key removal (unless reconfiguraing to empty) - 2\", () => {\n    const events = []\n    const x = observable.object({\n        y: 1,\n        z: undefined\n    })\n\n    reaction(\n        () => x.z,\n        v => events.push(v)\n    )\n\n    delete x.z\n    expect(events).toEqual([])\n})\n\ntest(\"should react to future key additions - 1\", () => {\n    const events = []\n    const x = observable.object({})\n\n    reaction(\n        () => Object.keys(x),\n        keys => events.push(keys.join(\",\"))\n    )\n\n    x.y = undefined\n    expect(events).toEqual([\"y\"])\n})\n\ntest(\"should react to future key additions - 2\", () => {\n    const events = []\n    const x = observable.object({})\n\n    reaction(\n        () => {\n            return x.z\n        },\n        v => {\n            events.push(v)\n        }\n    )\n\n    x.z = undefined\n    expect(Object.keys(x)).toEqual([\"z\"])\n    x.y = 3\n    expect(events).toEqual([])\n    delete x.y\n    expect(events).toEqual([])\n    x.z = 4\n    expect(events).toEqual([4])\n})\n\ntest(\"correct keys are reported\", () => {\n    const x = observable.object({\n        x: 1,\n        get y() {\n            return 2\n        }\n    })\n    x.z = 3\n    extendObservable(x, {\n        a: 4,\n        get b() {\n            return 5\n        }\n    })\n    x.y\n    x.b // make sure it is read\n\n    expect(Object.keys(x)).toEqual([\"x\", \"z\", \"a\"])\n    expect(Object.values(x)).toEqual([1, 3, 4])\n    expect(Object.entries(x)).toEqual([\n        [\"x\", 1],\n        [\"z\", 3],\n        [\"a\", 4]\n    ])\n\n    expect(Object.getOwnPropertyNames(x)).toEqual([\"x\", \"y\", \"z\", \"a\", \"b\"])\n    expect(keys(x)).toEqual([\"x\", \"z\", \"a\"])\n\n    delete x.x\n    expect(Object.keys(x)).toEqual([\"z\", \"a\"])\n    expect(Object.getOwnPropertyNames(x)).toEqual([\"y\", \"z\", \"a\", \"b\"])\n    expect(keys(x)).toEqual([\"z\", \"a\"])\n})\n\ntest(\"in operator\", () => {\n    const x = observable.object({\n        x: 1,\n        get y() {\n            return 2\n        }\n    })\n    x.z = 3\n    extendObservable(x, {\n        a: 4,\n        get b() {\n            return 5\n        }\n    })\n    expect(\"x\" in x).toBeTruthy()\n    expect(\"y\" in x).toBeTruthy()\n    expect(\"a\" in x).toBeTruthy()\n    expect(\"b\" in x).toBeTruthy()\n    expect(\"z\" in x).toBeTruthy()\n    expect(\"c\" in x).toBeFalsy()\n    expect(\"c\" in x).toBeFalsy() // not accidentally create\n    delete x.x\n    expect(\"x\" in x).toBeFalsy()\n})\n\ntest(\"for-in operator\", () => {\n    const x = observable.object({\n        x: 1,\n        get y() {\n            return 2\n        }\n    })\n    x.z = 3\n    extendObservable(x, {\n        a: 4,\n        get b() {\n            return 5\n        }\n    })\n\n    function computeKeys() {\n        const res = []\n        for (let key in x) res.push(key)\n        return res\n    }\n\n    expect(computeKeys(x)).toEqual([\"x\", \"z\", \"a\"])\n    delete x.x\n    expect(computeKeys(x)).toEqual([\"z\", \"a\"])\n})\n\ntest(\"type coercion doesn't break\", () => {\n    const x = observable({})\n    expect(\"\" + x).toBe(\"[object Object]\")\n    expect(42 * x).toBeNaN()\n})\n\ntest(\"adding a different key doesn't trigger a pending key\", () => {\n    const x = observable({})\n    let counter = 0\n\n    const d = autorun(() => {\n        x.x\n        counter++\n    })\n    expect(counter).toBe(1)\n\n    x.y = 3\n    expect(counter).toBe(1)\n\n    x.x = 3\n    expect(counter).toBe(2)\n\n    d()\n})\n\ntest(\"proxy false reverts to original behavior\", () => {\n    const x = observable({ x: 3 }, {}, { proxy: false })\n    x.y = 3\n    expect(isObservableProp(x, \"x\")).toBe(true)\n    expect(isObservableProp(x, \"y\")).toBe(false)\n})\n\ntest(\"ownKeys invariant not broken - 1\", () => {\n    const a = observable({ x: 3, get y() {} })\n    expect(() => {\n        Object.freeze(a)\n    }).toThrow(\"cannot be frozen\")\n})\n\ntest(\"ownKeys invariant not broken - 2\", () => {\n    const a = observable([2])\n    expect(() => {\n        Object.freeze(a)\n    }).toThrow(\"cannot be frozen\")\n})\n\ntest(\"non-proxied object\", () => {\n    const a = observable({ x: 3 }, {}, { proxy: false })\n    a.b = 4\n    extendObservable(\n        a,\n        {\n            double() {\n                this.x = this.x * 2\n            },\n            get y() {\n                return this.x * 2\n            }\n        },\n        {\n            double: action\n        }\n    )\n\n    expect(a.y).toBe(6)\n    a.double()\n    expect(a.y).toBe(12)\n    expect(isComputedProp(a, \"y\")).toBe(true)\n    expect(isAction(a.double)).toBe(true)\n    expect(stripAdminFromDescriptors(Object.getOwnPropertyDescriptors(a))).toMatchSnapshot()\n    expect(Object.keys(a)).toEqual([\"x\", \"b\"])\n})\n\ntest(\"extend proxies\", () => {\n    const a = observable({ x: 3 })\n    a.b = 4\n    extendObservable(\n        a,\n        {\n            double() {\n                this.x = this.x * 2\n            },\n            get y() {\n                return this.x * 2\n            }\n        },\n        {\n            double: action\n        }\n    )\n\n    expect(a.y).toBe(6)\n    a.double()\n    expect(a.y).toBe(12)\n    expect(isComputedProp(a, \"y\")).toBe(true)\n    expect(isAction(a.double)).toBe(true)\n    expect(stripAdminFromDescriptors(Object.getOwnPropertyDescriptors(a))).toMatchSnapshot()\n    expect(Object.keys(a)).toEqual([\"x\", \"b\"])\n})\n\ntest(\"decorate proxies\", () => {\n    const a = observable({ x: 3 })\n    a.b = 4\n    extendObservable(\n        a,\n        {\n            double() {\n                this.x = this.x * 2\n            },\n            get y() {\n                return this.x * 2\n            }\n        },\n        {\n            double: action\n        }\n    )\n\n    expect(a.y).toBe(6)\n    a.double()\n    expect(a.y).toBe(12)\n    expect(isComputedProp(a, \"y\")).toBe(true)\n    expect(isAction(a.double)).toBe(true)\n    expect(stripAdminFromDescriptors(Object.getOwnPropertyDescriptors(a))).toMatchSnapshot()\n    expect(Object.keys(a)).toEqual([\"x\", \"b\"])\n})\n\ntest(\"predictable 'this' - 1\", () => {\n    const a = observable.object(\n        {\n            a0() {\n                return this\n            },\n            a1() {\n                return this\n            },\n            a2() {\n                return this\n            },\n            get computed() {\n                return this\n            }\n        },\n        {\n            a1: action,\n            a2: action.bound\n        }\n    )\n\n    expect(a.a0()).toBe(a)\n    expect(a.a1()).toBe(a)\n    expect(a.a2()).toBe(a) // pre-bound!\n    expect(a.computed).toBe(a)\n})\n\ntest(\"predictable 'this' - 2\", () => {\n    class A {\n        constructor() {\n            makeObservable(this, {\n                a1: action,\n                a2: action.bound,\n                computed: computed\n            })\n        }\n\n        a0() {\n            return this\n        }\n\n        a1() {\n            return this\n        }\n\n        a2() {\n            return this\n        }\n\n        get computed() {\n            return this\n        }\n    }\n\n    const a = new A()\n\n    expect(a.a0()).toBe(a)\n    expect(a.a1()).toBe(a)\n    expect(a.a2()).toBe(a)\n    expect(a.computed).toBe(a)\n})\n\ntest(\"1796 - delete -> recreate observable prop\", () => {\n    let value = observable({\n        foo: undefined // if foo is something like 'abc', it works.\n    })\n\n    const events = []\n\n    autorun(() => {\n        events.push(value.foo)\n    })\n    delete value.foo\n    value.foo = \"def\"\n    expect(events).toEqual([\n        undefined,\n        undefined, // ideally  not, but ok..\n        \"def\"\n    ])\n})\n\ntest(\"1796 - delete -> recreate computed prop\", () => {\n    let value = observable({\n        foo: undefined,\n        get bar() {\n            return this.foo\n        }\n    })\n\n    expect(isComputedProp(value, \"bar\")).toBe(true)\n\n    const events = []\n\n    autorun(() => {\n        events.push(value.bar)\n    })\n    delete value.bar\n    value.bar = \"def\"\n    expect(isObservableProp(value, \"bar\")).toBe(true)\n    expect(isComputedProp(value, \"bar\")).toBe(false)\n\n    expect(events).toEqual([undefined, undefined, \"def\"])\n})\n"
  },
  {
    "path": "packages/mobx/__tests__/v5/base/reaction.js",
    "content": "/**\n * @type {typeof import(\"./../../../src/v5/mobx\")}\n */\nconst mobx = require(\"../../../src/mobx.ts\")\nconst reaction = mobx.reaction\nconst $mobx = mobx.$mobx\nconst utils = require(\"../../v5/utils/test-utils\")\n\ntest(\"basic\", () => {\n    const a = mobx.observable.box(1)\n    const values = []\n\n    const d = reaction(\n        () => a.get(),\n        (newValue, oldValue) => {\n            values.push([newValue, oldValue])\n        }\n    )\n\n    a.set(2)\n    a.set(3)\n    d()\n    a.set(4)\n\n    expect(values).toEqual([\n        [2, 1],\n        [3, 2]\n    ])\n})\n\ntest(\"effect fireImmediately is honored\", () => {\n    const a = mobx.observable.box(1)\n    const values = []\n\n    const d = reaction(\n        () => a.get(),\n        newValue => {\n            values.push(newValue)\n        },\n        { fireImmediately: true }\n    )\n\n    a.set(2)\n    a.set(3)\n    d()\n    a.set(4)\n\n    expect(values).toEqual([1, 2, 3])\n})\n\ntest(\"effect is untracked\", () => {\n    const a = mobx.observable.box(1)\n    const b = mobx.observable.box(2)\n    const values = []\n\n    const d = reaction(\n        () => a.get(),\n        newValue => {\n            values.push(newValue * b.get())\n        },\n        { fireImmediately: true }\n    )\n\n    a.set(2)\n    b.set(7) // shoudn't trigger a new change\n    a.set(3)\n    d()\n    a.set(4)\n\n    expect(values).toEqual([2, 4, 21])\n})\n\nlet TIME_AMPLIFIER = 1\nif (process.env.CI === \"true\") {\n    console.log(\"Amplifying time\")\n    jest.setTimeout(50 * 1000)\n    TIME_AMPLIFIER = 10\n}\n\ntest(\"effect debounce is honored\", () => {\n    expect.assertions(2)\n\n    return new Promise((resolve, reject) => {\n        const a = mobx.observable.box(1)\n        const values = []\n        let exprCount = 0\n\n        const d = reaction(\n            () => {\n                exprCount++\n                return a.get()\n            },\n            newValue => {\n                values.push(newValue)\n            },\n            {\n                delay: 150 * TIME_AMPLIFIER,\n                fireImmediately: false\n            }\n        )\n\n        setTimeout(() => a.set(2), 40 * TIME_AMPLIFIER)\n        setTimeout(() => {\n            a.set(3) // should not be visible, combined with the next\n            setImmediate(() => {\n                a.set(4)\n            })\n        }, 300 * TIME_AMPLIFIER)\n        setTimeout(() => a.set(5), 600 * TIME_AMPLIFIER)\n        setTimeout(() => {\n            d()\n            a.set(6)\n        }, 1000 * TIME_AMPLIFIER)\n\n        setTimeout(() => {\n            try {\n                expect(values).toEqual([2, 4, 5])\n                expect(exprCount).toBe(4)\n                resolve()\n            } catch (e) {\n                reject(e)\n            }\n        }, 1200 * TIME_AMPLIFIER)\n    })\n})\n\ntest(\"effect debounce + fire immediately is honored\", () => {\n    expect.assertions(2)\n    return new Promise((resolve, reject) => {\n        const a = mobx.observable.box(1)\n        const values = []\n        let exprCount = 0\n\n        const d = reaction(\n            () => {\n                exprCount++\n                return a.get()\n            },\n            newValue => {\n                values.push(newValue)\n            },\n            {\n                fireImmediately: true,\n                delay: 100 * TIME_AMPLIFIER\n            }\n        )\n\n        setTimeout(() => a.set(3), 150 * TIME_AMPLIFIER)\n        setTimeout(() => a.set(4), 300 * TIME_AMPLIFIER)\n\n        setTimeout(() => {\n            try {\n                d()\n                expect(values).toEqual([1, 3, 4])\n                expect(exprCount).toBe(3)\n                resolve()\n            } catch (e) {\n                reject(e)\n            }\n        }, 500 * TIME_AMPLIFIER)\n    })\n})\n\ntest(\"passes Reaction as an argument to expression function\", () => {\n    const a = mobx.observable.box(1)\n    const values = []\n\n    reaction(\n        r => {\n            if (a.get() === \"pleaseDispose\") r.dispose()\n            return a.get()\n        },\n        newValue => {\n            values.push(newValue)\n        },\n        { fireImmediately: true }\n    )\n\n    a.set(2)\n    a.set(2)\n    a.set(\"pleaseDispose\")\n    a.set(3)\n    a.set(4)\n\n    expect(values).toEqual([1, 2, \"pleaseDispose\"])\n})\n\ntest(\"passes Reaction as an argument to effect function\", () => {\n    const a = mobx.observable.box(1)\n    const values = []\n\n    reaction(\n        () => a.get(),\n        (newValue, _oldValue, r) => {\n            if (a.get() === \"pleaseDispose\") r.dispose()\n            values.push(newValue)\n        },\n        { fireImmediately: true }\n    )\n\n    a.set(2)\n    a.set(2)\n    a.set(\"pleaseDispose\")\n    a.set(3)\n    a.set(4)\n\n    expect(values).toEqual([1, 2, \"pleaseDispose\"])\n})\n\ntest(\"can dispose reaction on first run\", () => {\n    const a = mobx.observable.box(1)\n\n    const valuesExpr1st = []\n    reaction(\n        () => a.get(),\n        (newValue, oldValue, r) => {\n            r.dispose()\n            valuesExpr1st.push([newValue, oldValue])\n        },\n        { fireImmediately: true }\n    )\n\n    const valuesEffect1st = []\n    reaction(\n        r => {\n            r.dispose()\n            return a.get()\n        },\n        (newValue, oldValue) => {\n            valuesEffect1st.push([newValue, oldValue])\n        },\n        { fireImmediately: true }\n    )\n\n    const valuesExpr = []\n    reaction(\n        () => a.get(),\n        (newValue, oldValue, r) => {\n            r.dispose()\n            valuesExpr.push([newValue, oldValue])\n        }\n    )\n\n    const valuesEffect = []\n    reaction(\n        r => {\n            r.dispose()\n            return a.get()\n        },\n        (newValue, oldValue) => {\n            valuesEffect.push([newValue, oldValue])\n        }\n    )\n\n    a.set(2)\n    a.set(3)\n\n    expect(valuesExpr1st).toEqual([[1, undefined]])\n    expect(valuesEffect1st).toEqual([[1, undefined]])\n    expect(valuesExpr).toEqual([[2, 1]])\n    expect(valuesEffect).toEqual([])\n})\n\ntest(\"can dispose reaction with AbortSignal\", () => {\n    const a = mobx.observable.box(1)\n    const ac = new AbortController()\n    const values = []\n\n    reaction(\n        () => a.get(),\n        (newValue, oldValue) => {\n            values.push([newValue, oldValue])\n        },\n        { signal: ac.signal }\n    )\n\n    a.set(2)\n    a.set(3)\n    ac.abort()\n    a.set(4)\n\n    expect(values).toEqual([\n        [2, 1],\n        [3, 2]\n    ])\n})\n\ntest(\"fireImmediately should not be honored when passed already aborted AbortSignal\", () => {\n    const a = mobx.observable.box(1)\n    const ac = new AbortController()\n    const values = []\n\n    ac.abort()\n\n    reaction(\n        () => a.get(),\n        (newValue) => {\n            values.push(newValue)\n        },\n        { signal: ac.signal, fireImmediately: true }\n    )\n\n    expect(values).toEqual([])\n})\n\ntest(\"#278 do not rerun if expr output doesn't change\", () => {\n    const a = mobx.observable.box(1)\n    const values = []\n\n    const d = reaction(\n        () => (a.get() < 10 ? a.get() : 11),\n        newValue => {\n            values.push(newValue)\n        }\n    )\n\n    a.set(2)\n    a.set(3)\n    a.set(10)\n    a.set(11)\n    a.set(12)\n    a.set(4)\n    a.set(5)\n    a.set(13)\n\n    d()\n    a.set(4)\n\n    expect(values).toEqual([2, 3, 11, 4, 5, 11])\n})\n\ntest(\"#278 do not rerun if expr output doesn't change structurally\", () => {\n    const users = mobx.observable([\n        {\n            name: \"jan\",\n            get uppername() {\n                return this.name.toUpperCase()\n            }\n        },\n        {\n            name: \"piet\",\n            get uppername() {\n                return this.name.toUpperCase()\n            }\n        }\n    ])\n    const values = []\n\n    const d = reaction(\n        () => users.map(user => user.uppername),\n        newValue => {\n            values.push(newValue)\n        },\n        {\n            fireImmediately: true,\n            compareStructural: true\n        }\n    )\n\n    users[0].name = \"john\"\n    users[0].name = \"JoHn\"\n    users[0].name = \"jOHN\"\n    users[1].name = \"johan\"\n\n    d()\n    users[1].name = \"w00t\"\n\n    expect(values).toEqual([\n        [\"JAN\", \"PIET\"],\n        [\"JOHN\", \"PIET\"],\n        [\"JOHN\", \"JOHAN\"]\n    ])\n})\n\ntest(\"do not rerun if prev & next expr output is NaN\", () => {\n    const v = mobx.observable.box(\"a\")\n    const values = []\n    const valuesS = []\n\n    const d = reaction(\n        () => v.get(),\n        newValue => {\n            values.push(String(newValue))\n        },\n        { fireImmediately: true }\n    )\n    const dd = reaction(\n        () => v.get(),\n        newValue => {\n            valuesS.push(String(newValue))\n        },\n        { fireImmediately: true, compareStructural: true }\n    )\n\n    v.set(NaN)\n    v.set(NaN)\n    v.set(NaN)\n    v.set(\"b\")\n\n    d()\n    dd()\n\n    expect(values).toEqual([\"a\", \"NaN\", \"b\"])\n    expect(valuesS).toEqual([\"a\", \"NaN\", \"b\"])\n})\n\ntest(\"reaction uses equals\", () => {\n    const o = mobx.observable.box(\"a\")\n    const values = []\n    const disposeReaction = mobx.reaction(\n        () => o.get(),\n        value => values.push(value.toLowerCase()),\n        { equals: (from, to) => from.toUpperCase() === to.toUpperCase(), fireImmediately: true }\n    )\n    expect(values).toEqual([\"a\"])\n    o.set(\"A\")\n    expect(values).toEqual([\"a\"])\n    o.set(\"B\")\n    expect(values).toEqual([\"a\", \"b\"])\n    o.set(\"A\")\n    expect(values).toEqual([\"a\", \"b\", \"a\"])\n\n    disposeReaction()\n})\n\ntest(\"reaction equals function only invoked when necessary\", () => {\n    utils.supressConsole(() => {\n        const comparisons = []\n        const loggingComparer = (from, to) => {\n            comparisons.push({ from, to })\n            return from === to\n        }\n\n        const left = mobx.observable.box(\"A\")\n        const right = mobx.observable.box(\"B\")\n\n        const values = []\n        const disposeReaction = mobx.reaction(\n            // Note: exceptions thrown here are intentional!\n            () => left.get().toLowerCase() + right.get().toLowerCase(),\n            value => values.push(value),\n            { equals: loggingComparer, fireImmediately: true }\n        )\n\n        // No comparison should be made on the first value\n        expect(comparisons).toEqual([])\n\n        // First change will cause a comparison\n        left.set(\"C\")\n        expect(comparisons).toEqual([{ from: \"ab\", to: \"cb\" }])\n\n        // Exception in the reaction expression won't cause a comparison\n        left.set(null)\n        expect(comparisons).toEqual([{ from: \"ab\", to: \"cb\" }])\n\n        // Another exception in the reaction expression won't cause a comparison\n        right.set(null)\n        expect(comparisons).toEqual([{ from: \"ab\", to: \"cb\" }])\n\n        // Transition from exception in the expression will cause a comparison with the last valid value\n        left.set(\"D\")\n        right.set(\"E\")\n        expect(comparisons).toEqual([\n            { from: \"ab\", to: \"cb\" },\n            { from: \"cb\", to: \"de\" }\n        ])\n\n        // Another value change will cause a comparison\n        right.set(\"F\")\n        expect(comparisons).toEqual([\n            { from: \"ab\", to: \"cb\" },\n            { from: \"cb\", to: \"de\" },\n            { from: \"de\", to: \"df\" }\n        ])\n\n        expect(values).toEqual([\"ab\", \"cb\", \"de\", \"df\"])\n\n        disposeReaction()\n    })\n})\n\ntest(\"issue #1148\", () => {\n    const a = mobx.observable.box(1)\n    let called = 0\n    const dispose = reaction(\n        () => a.get(),\n        () => {\n            called++\n        },\n        { delay: 1 }\n    )\n    a.set(2)\n    dispose()\n    expect(called).toBe(0)\n})\n\ntest(\"Introduce custom onError for - autorun - 1\", () => {\n    let error = \"\"\n    let globalHandlerCalled = false\n    const d = mobx.onReactionError(() => {\n        globalHandlerCalled = true\n    })\n    expect(() => {\n        mobx.autorun(\n            () => {\n                throw \"OOPS\"\n            },\n            {\n                onError(e) {\n                    error = e\n                }\n            }\n        )\n    }).not.toThrow()\n    expect(error).toBe(\"OOPS\")\n    expect(globalHandlerCalled).toBe(false)\n    d()\n})\n\ntest(\"Introduce custom onError for - autorun - 2\", done => {\n    let globalHandlerCalled = false\n    const d = mobx.onReactionError(() => {\n        globalHandlerCalled = true\n    })\n    expect(() => {\n        mobx.autorun(\n            () => {\n                throw \"OOPS\"\n            },\n            {\n                delay: 5,\n                onError(error) {\n                    setImmediate(() => {\n                        expect(error).toBe(\"OOPS\")\n                        expect(globalHandlerCalled).toBe(false)\n                        d()\n                        done()\n                    })\n                }\n            }\n        )\n    }).not.toThrow()\n})\n\ntest(\"Introduce custom onError for - reaction - 1\", () => {\n    let error = \"\"\n    let globalHandlerCalled = false\n    const d = mobx.onReactionError(() => {\n        globalHandlerCalled = true\n    })\n    expect(() => {\n        mobx.reaction(\n            () => {\n                throw \"OOPS\"\n            },\n            () => {},\n            {\n                onError(e) {\n                    error = e\n                }\n            }\n        )\n    }).not.toThrow()\n    expect(error).toBe(\"OOPS\")\n    expect(globalHandlerCalled).toBe(false)\n    d()\n})\n\ntest(\"Introduce custom onError for - reaction - 2\", () => {\n    let error = \"\"\n    let globalHandlerCalled = false\n    let box = mobx.observable.box(1)\n    const d = mobx.onReactionError(() => {\n        globalHandlerCalled = true\n    })\n    mobx.reaction(\n        () => box.get(),\n        () => {\n            throw \"OOPS\"\n        },\n        {\n            onError(e) {\n                error = e\n            }\n        }\n    )\n    expect(() => {\n        box.set(2)\n    }).not.toThrow()\n    expect(error).toBe(\"OOPS\")\n    expect(globalHandlerCalled).toBe(false)\n    d()\n})\n\ntest(\"Introduce custom onError for - reaction - 3\", done => {\n    let globalHandlerCalled = false\n    let box = mobx.observable.box(1)\n    const d = mobx.onReactionError(() => {\n        globalHandlerCalled = true\n    })\n    mobx.reaction(\n        () => box.get(),\n        () => {\n            throw \"OOPS\"\n        },\n        {\n            delay: 5,\n            onError(e) {\n                expect(e).toBe(\"OOPS\")\n                setImmediate(() => {\n                    expect(globalHandlerCalled).toBe(false)\n                    d()\n                    done()\n                })\n            }\n        }\n    )\n    expect(() => {\n        box.set(2)\n    }).not.toThrow()\n})\n\ntest(\"Introduce custom onError for - when - 1\", () => {\n    let error = \"\"\n    let globalHandlerCalled = false\n    const d = mobx.onReactionError(() => {\n        globalHandlerCalled = true\n    })\n    expect(() => {\n        mobx.when(\n            () => {\n                throw \"OOPS\"\n            },\n            () => {},\n            {\n                onError(e) {\n                    error = e\n                }\n            }\n        )\n    }).not.toThrow()\n    expect(error).toBe(\"OOPS\")\n    expect(globalHandlerCalled).toBe(false)\n    d()\n})\n\ntest(\"Introduce custom onError for - when - 2\", () => {\n    let error = \"\"\n    let globalHandlerCalled = false\n    let box = mobx.observable.box(1)\n    const d = mobx.onReactionError(() => {\n        globalHandlerCalled = true\n    })\n    mobx.when(\n        () => box.get() === 2,\n        () => {\n            throw \"OOPS\"\n        },\n        {\n            onError(e) {\n                error = e\n            }\n        }\n    )\n    expect(() => {\n        box.set(2)\n    }).not.toThrow()\n    expect(error).toBe(\"OOPS\")\n    expect(globalHandlerCalled).toBe(false)\n    d()\n})\n\ndescribe(\"reaction opts requiresObservable\", () => {\n    test(\"warn when no observable\", () => {\n        utils.consoleWarn(() => {\n            const disposer = mobx.reaction(\n                () => 2,\n                () => 1,\n                {\n                    requiresObservable: true\n                }\n            )\n\n            disposer()\n        }, /is created\\/updated without reading any observable value/)\n    })\n\n    test(\"Don't warn when observable\", () => {\n        const obsr = mobx.observable({\n            x: 1\n        })\n\n        const messages = utils.supressConsole(() => {\n            const disposer = mobx.reaction(\n                () => obsr.x,\n                () => 1,\n                {\n                    requiresObservable: true\n                }\n            )\n\n            disposer()\n        })\n\n        expect(messages.length).toBe(0)\n    })\n})\n\ndescribe(\"explicit resource management\", () => {\n    Symbol.dispose ??= Symbol(\"Symbol.dispose\")\n\n    test(\"reaction has [Symbol.dispose] and calling it disposes of reaction\", () => {\n        const a = mobx.observable.box(1)\n        const values = []\n\n        const disposeReaction = reaction(\n            () => a.get(),\n            newValue => {\n                values.push(newValue)\n            }\n        )\n\n        expect(disposeReaction[Symbol.dispose]).toBeInstanceOf(Function)\n\n        disposeReaction[Symbol.dispose]()\n        a.set(2)\n\n        expect(values).toEqual([])\n        expect(disposeReaction[$mobx].isDisposed).toBe(true)\n    })\n})\n"
  },
  {
    "path": "packages/mobx/__tests__/v5/base/set.js",
    "content": "\"use strict\"\n\nconst mobx = require(\"../../../src/mobx.ts\")\nconst set = mobx.observable.set\nconst autorun = mobx.autorun\nconst iterall = require(\"iterall\")\n\ntest(\"set crud\", function () {\n    const events = []\n    const s = set([1])\n\n    mobx.observe(s, change => {\n        expect(change.observableKind).toEqual(\"set\")\n        delete change.observableKind\n        delete change.debugObjectName\n        events.push(change)\n    })\n\n    expect(s.has(1)).toBe(true)\n    expect(s.has(\"1\")).toBe(false)\n    expect(s.size).toBe(1)\n\n    s.add(\"2\")\n\n    expect(s.has(\"2\")).toBe(true)\n    expect(s.size).toBe(2)\n    expect(mobx.keys(s)).toEqual([1, \"2\"])\n    expect(mobx.values(s)).toEqual([1, \"2\"])\n    expect(mobx.entries(s)).toEqual([\n        [1, 1],\n        [\"2\", \"2\"]\n    ])\n    expect(Array.from(s)).toEqual([1, \"2\"])\n    // TODO: fix! expect(mobx.toJS(s)).toEqual(new Set([1, \"2\"]))\n    expect(s.toJSON()).toEqual([1, \"2\"])\n    expect(s.toString()).toBe(\"[object ObservableSet]\")\n\n    s.replace(new Set([3]))\n\n    expect(mobx.keys(s)).toEqual([3])\n    expect(mobx.values(s)).toEqual([3])\n    expect(s.size).toBe(1)\n    expect(s.has(1)).toBe(false)\n    expect(s.has(\"2\")).toBe(false)\n    expect(s.has(3)).toBe(true)\n\n    s.replace(set([4]))\n\n    expect(mobx.keys(s)).toEqual([4])\n    expect(mobx.values(s)).toEqual([4])\n    expect(s.size).toBe(1)\n    expect(s.has(1)).toBe(false)\n    expect(s.has(\"2\")).toBe(false)\n    expect(s.has(3)).toBe(false)\n    expect(s.has(4)).toBe(true)\n\n    expect(() => {\n        s.replace(\"\")\n    }).toThrow(/Cannot initialize set from/)\n\n    s.clear()\n    expect(mobx.keys(s)).toEqual([])\n    expect(mobx.values(s)).toEqual([])\n    expect(s.size).toBe(0)\n    expect(s.has(1)).toBe(false)\n    expect(s.has(\"2\")).toBe(false)\n    expect(s.has(3)).toBe(false)\n    expect(s.has(4)).toBe(false)\n\n    expect(events).toEqual([\n        { object: s, newValue: \"2\", type: \"add\" },\n        { object: s, oldValue: 1, type: \"delete\" },\n        { object: s, oldValue: \"2\", type: \"delete\" },\n        { object: s, newValue: 3, type: \"add\" },\n        { object: s, oldValue: 3, type: \"delete\" },\n        { object: s, newValue: 4, type: \"add\" },\n        { object: s, oldValue: 4, type: \"delete\" }\n    ])\n})\n\ntest(\"observe value\", function () {\n    const s = set()\n    let hasX = false\n    let hasY = false\n\n    autorun(function () {\n        hasX = s.has(\"x\")\n    })\n    autorun(function () {\n        hasY = s.has(\"y\")\n    })\n\n    expect(hasX).toBe(false)\n\n    s.add(\"x\")\n    expect(hasX).toBe(true)\n\n    s.delete(\"x\")\n    expect(hasX).toBe(false)\n\n    s.replace([\"y\"])\n    expect(hasX).toBe(false)\n    expect(hasY).toBe(true)\n    expect(mobx.values(s)).toEqual([\"y\"])\n})\n\ntest(\"observe collections\", function () {\n    const x = set()\n    let keys, values, entries\n\n    autorun(function () {\n        keys = mobx.keys(x)\n    })\n    autorun(function () {\n        values = Array.from(x.values())\n    })\n    autorun(function () {\n        entries = Array.from(x.entries())\n    })\n\n    x.add(\"a\")\n    expect(keys).toEqual([\"a\"])\n    expect(values).toEqual([\"a\"])\n    expect(entries).toEqual([[\"a\", \"a\"]])\n\n    x.forEach(value => {\n        expect(x.has(value)).toBe(true)\n    })\n\n    // should not retrigger:\n    keys = null\n    values = null\n    entries = null\n    x.add(\"a\")\n    expect(keys).toEqual(null)\n    expect(values).toEqual(null)\n    expect(entries).toEqual(null)\n\n    x.add(\"b\")\n    expect(keys).toEqual([\"a\", \"b\"])\n    expect(values).toEqual([\"a\", \"b\"])\n    expect(entries).toEqual([\n        [\"a\", \"a\"],\n        [\"b\", \"b\"]\n    ])\n\n    x.delete(\"a\")\n    expect(keys).toEqual([\"b\"])\n    expect(values).toEqual([\"b\"])\n    expect(entries).toEqual([[\"b\", \"b\"]])\n})\n\ntest(\"set modifier\", () => {\n    const x = set([{ a: 1 }])\n    const y = mobx.observable({ a: x })\n\n    expect(mobx.isObservableSet(x)).toBe(true)\n    expect(mobx.isObservableObject(y)).toBe(true)\n    expect(mobx.isObservableObject(y.a)).toBe(false)\n    expect(mobx.isObservableSet(y.a)).toBe(true)\n})\n\ntest(\"cleanup\", function () {\n    const s = set([\"a\"])\n\n    let hasA\n\n    autorun(function () {\n        hasA = s.has(\"a\")\n    })\n\n    expect(hasA).toBe(true)\n    expect(s.delete(\"a\")).toBe(true)\n    expect(s.delete(\"not-existing\")).toBe(false)\n    expect(hasA).toBe(false)\n})\n\ntest(\"set should support iterall / iterable \", () => {\n    const a = set([1, 2])\n\n    function leech(iter) {\n        const values = []\n        let v\n        do {\n            v = iter.next()\n            if (!v.done) values.push(v.value)\n        } while (!v.done)\n        return values\n    }\n\n    expect(iterall.isIterable(a)).toBe(true)\n\n    expect(leech(iterall.getIterator(a))).toEqual([1, 2])\n\n    expect(leech(a.entries())).toEqual([\n        [1, 1],\n        [2, 2]\n    ])\n\n    expect(leech(a.keys())).toEqual([1, 2])\n    expect(leech(a.values())).toEqual([1, 2])\n})\n\n// Test support for [iterator-helpers](https://github.com/tc39/proposal-iterator-helpers)\ntest(\"esnext iterator helpers support\", () => {\n    const set = mobx.observable(\n        new Set([\n            [1, 2],\n            [3, 4]\n        ])\n    )\n\n    expect(Array.from(set.values().map(value => value))).toEqual([\n        [1, 2],\n        [3, 4]\n    ])\n\n    expect(Array.from(set.entries().map(([, value]) => value))).toEqual([\n        [1, 2],\n        [3, 4]\n    ])\n\n    expect(Array.from(set.values().take(1))).toEqual([[1, 2]])\n    expect(Array.from(set.values().drop(1))).toEqual([[3, 4]])\n    expect(Array.from(set.values().filter(value => value[0] === 3))).toEqual([[3, 4]])\n    expect(Array.from(set.values().find(value => value[0] === 3))).toEqual([3, 4])\n    expect(Array.from(set.values().flatMap(value => value))).toEqual([1, 2, 3, 4])\n\n    expect(set.entries().toString()).toEqual(\"[object SetIterator]\")\n})\n\ntest(\"support for ES6 Set\", () => {\n    const x = new Set()\n    x.add(1)\n    x.add(2)\n\n    const s = mobx.observable(x)\n    expect(mobx.isObservableSet(s)).toBe(true)\n    expect(Array.from(s)).toEqual([1, 2])\n})\n\ntest(\"deepEqual set\", () => {\n    const x = new Set()\n    x.add(1)\n    x.add({ z: 1 })\n\n    const x2 = mobx.observable.set()\n    x2.add(1)\n    x2.add({ z: 2 })\n\n    expect(mobx.comparer.structural(x, x2)).toBe(false)\n    x2.replace([1, { z: 1 }])\n    expect(mobx.comparer.structural(x, x2)).toBe(true)\n})\n\ntest(\"set.clear should not be tracked\", () => {\n    const x = set([1])\n    let c = 0\n    const d = mobx.autorun(() => {\n        c++\n        x.clear()\n    })\n\n    expect(c).toBe(1)\n    x.add(2)\n    expect(c).toBe(1)\n\n    d()\n})\n\ntest(\"toStringTag\", () => {\n    const x = set()\n    expect(x[Symbol.toStringTag]).toBe(\"Set\")\n    expect(Object.prototype.toString.call(x)).toBe(\"[object Set]\")\n})\n\ntest(\"getAtom\", () => {\n    const x = set([1])\n    expect(mobx.getAtom(x)).toBeTruthy()\n\n    expect(mobx.isObservableSet(x)).toBeTruthy()\n    expect(mobx.isObservable(x)).toBeTruthy()\n})\n\ntest(\"observe\", () => {\n    const vals = []\n    const x = set([1])\n    mobx.observe(x, change => {\n        delete change.debugObjectName\n        vals.push(change)\n    })\n    x.add(2)\n    x.add(1)\n    expect(vals).toEqual([{ newValue: 2, object: x, type: \"add\", observableKind: \"set\" }])\n})\n\ntest(\"toJS\", () => {\n    const x = mobx.observable({ x: 1 })\n    const y = set([x, 1])\n\n    const z = mobx.toJS(y)\n    expect(z).toEqual(new Set([{ x: 1 }, 1]))\n    expect(z.x).not.toBe(x)\n    expect(mobx.isObservable(z.x)).toBeFalsy()\n})\n\ntest(\"set.forEach is reactive\", () => {\n    let c = 0\n    const s = set()\n\n    autorun(() => {\n        s.forEach(() => {})\n        c++\n    })\n\n    s.add(1)\n    s.add(2)\n    expect(c).toBe(3)\n})\n\ndescribe(\"The Set object methods do what they are supposed to do\", () => {\n    const reactiveSet = set([1, 2, 3, 4, 5])\n\n    test(\"with native Set\", () => {\n        const intersectionObservableResult = reactiveSet.intersection(new Set([1, 2, 6]))\n        const unionObservableResult = reactiveSet.union(new Set([1, 2, 6]))\n        const differenceObservableResult = reactiveSet.difference(new Set([1, 2, 3, 4, 5, 6, 7]))\n        const symmetricDifferenceObservableResult = reactiveSet.symmetricDifference(new Set([3, 4]))\n        const isSubsetOfObservableResult = reactiveSet.isSubsetOf(new Set([1, 2, 3]))\n        const isSupersetOfObservableResult = reactiveSet.isSupersetOf(new Set([1, 2, 3, 4, 5, 6]))\n        const isDisjointFromObservableResult = reactiveSet.isDisjointFrom(new Set([6, 7]))\n\n        expect(intersectionObservableResult).toEqual(new Set([1, 2]))\n        expect(unionObservableResult).toEqual(new Set([1, 2, 3, 4, 5, 6]))\n        expect(differenceObservableResult).toEqual(new Set())\n        expect(symmetricDifferenceObservableResult).toEqual(new Set([1, 2, 5]))\n        expect(isSubsetOfObservableResult).toBeFalsy()\n        expect(isSupersetOfObservableResult).toBeFalsy()\n        expect(isDisjointFromObservableResult).toBeTruthy()\n    })\n\n    test(\"with ObservableSet #3919\", () => {\n        const intersectionObservableResult = reactiveSet.intersection(set([1, 2, 6]))\n        const unionObservableResult = reactiveSet.union(set([1, 2, 6]))\n        const differenceObservableResult = reactiveSet.difference(set([1, 2, 3, 4, 5, 6, 7]))\n        const symmetricDifferenceObservableResult = reactiveSet.symmetricDifference(set([3, 4]))\n        const isSubsetOfObservableResult = reactiveSet.isSubsetOf(set([1, 2, 3]))\n        const isSupersetOfObservableResult = reactiveSet.isSupersetOf(set([1, 2, 3, 4, 5, 6]))\n        const isDisjointFromObservableResult = reactiveSet.isDisjointFrom(set([6, 7]))\n\n        expect(intersectionObservableResult).toEqual(new Set([1, 2]))\n        expect(unionObservableResult).toEqual(new Set([1, 2, 3, 4, 5, 6]))\n        expect(differenceObservableResult).toEqual(new Set())\n        expect(symmetricDifferenceObservableResult).toEqual(new Set([1, 2, 5]))\n        expect(isSubsetOfObservableResult).toBeFalsy()\n        expect(isSupersetOfObservableResult).toBeFalsy()\n        expect(isDisjointFromObservableResult).toBeTruthy()\n    })\n\n    test(\"with Set-like\", () => {\n        const intersectionObservableResult = reactiveSet.intersection(\n            new Map([1, 2, 6].map(i => [i, i]))\n        )\n        const unionObservableResult = reactiveSet.union(new Map([1, 2, 6].map(i => [i, i])))\n        const differenceObservableResult = reactiveSet.difference(\n            new Map([1, 2, 3, 4, 5, 6, 7].map(i => [i, i]))\n        )\n        const symmetricDifferenceObservableResult = reactiveSet.symmetricDifference(\n            new Map([3, 4].map(i => [i, i]))\n        )\n        const isSubsetOfObservableResult = reactiveSet.isSubsetOf(\n            new Map([1, 2, 3].map(i => [i, i]))\n        )\n        const isSupersetOfObservableResult = reactiveSet.isSupersetOf(\n            new Map([1, 2, 3, 4, 5, 6].map(i => [i, i]))\n        )\n        const isDisjointFromObservableResult = reactiveSet.isDisjointFrom(\n            new Map([6, 7].map(i => [i, i]))\n        )\n\n        expect(intersectionObservableResult).toEqual(new Set([1, 2]))\n        expect(unionObservableResult).toEqual(new Set([1, 2, 3, 4, 5, 6]))\n        expect(differenceObservableResult).toEqual(new Set())\n        expect(symmetricDifferenceObservableResult).toEqual(new Set([1, 2, 5]))\n        expect(isSubsetOfObservableResult).toBeFalsy()\n        expect(isSupersetOfObservableResult).toBeFalsy()\n        expect(isDisjointFromObservableResult).toBeTruthy()\n    })\n})\n\ndescribe(\"Observable Set methods are reactive\", () => {\n    let c = 0\n    let s = set()\n\n    beforeEach(() => {\n        c = 0\n        s = set()\n    })\n\n    test(\"Intersection method is reactive\", () => {\n        autorun(() => {\n            s.intersection(new Set())\n            c++\n        })\n\n        s.add(1)\n        s.add(2)\n        expect(c).toBe(3)\n    })\n\n    test(\"Union method is reactive\", () => {\n        autorun(() => {\n            s.union(new Set())\n            c++\n        })\n\n        s.add(1)\n        s.add(2)\n        expect(c).toBe(3)\n    })\n\n    test(\"Difference method is reactive\", () => {\n        autorun(() => {\n            s.difference(new Set())\n            c++\n        })\n\n        s.add(1)\n        s.add(2)\n        expect(c).toBe(3)\n    })\n\n    test(\"symmetricDifference method is reactive\", () => {\n        autorun(() => {\n            s.symmetricDifference(new Set())\n            c++\n        })\n\n        s.add(1)\n        s.add(2)\n        expect(c).toBe(3)\n    })\n\n    test(\"isSubsetOf method is reactive\", () => {\n        autorun(() => {\n            s.isSubsetOf(new Set())\n            c++\n        })\n\n        s.add(1)\n        s.add(2)\n        expect(c).toBe(3)\n    })\n\n    test(\"isSupersetOf method is reactive\", () => {\n        autorun(() => {\n            s.isSupersetOf(new Set())\n            c++\n        })\n\n        s.add(1)\n        s.add(2)\n        expect(c).toBe(3)\n    })\n\n    test(\"isDisjointFrom method is reactive\", () => {\n        autorun(() => {\n            s.isDisjointFrom(new Set())\n            c++\n        })\n\n        s.add(1)\n        s.add(2)\n        expect(c).toBe(3)\n    })\n})\n\n\ndescribe(\"Observable Set interceptors\", () => {\n\n    let s = set()\n\n    beforeEach(() => {\n        s = set()\n    })\n\n    test(\"Add does not add value if interceptor returned no change\", () => {\n        mobx.intercept(s, (change) => {\n            if(change.type === 'add' && change.newValue === 2) {\n                return undefined;\n            }\n\n            return change;\n        })\n\n        s.add(1);\n        s.add(2);\n\n        expect([...s]).toStrictEqual([1]);\n\n\n    })\n\n    test(\"Add respects newValue from interceptor\", () => {\n\n        mobx.intercept(s, (change) => {\n            if(change.type === 'add' && change.newValue === 2) {\n                change.newValue = 10;\n            }\n\n            return change;\n        })\n\n        s.add(1);\n        s.add(2);\n\n        expect([...s]).toStrictEqual([1, 10])\n    })\n\n\n})"
  },
  {
    "path": "packages/mobx/__tests__/v5/base/spy.js",
    "content": "\"use strict\"\nconst mobx = require(\"../../../src/mobx.ts\")\nconst utils = require(\"../../v5/utils/test-utils\")\n\ntest(\"spy output\", () => {\n    const events = []\n\n    const stop = mobx.spy(c => events.push(c))\n\n    doStuff()\n\n    stop()\n\n    doStuff()\n\n    events.forEach(ev => {\n        delete ev.object\n        delete ev.fn\n        delete ev.time\n    })\n\n    expect(events).toMatchSnapshot()\n})\n\nfunction doStuff() {\n    const a = mobx.observable.box(2)\n    a.set(3)\n\n    const b = mobx.observable({\n        c: 4\n    })\n    b.c = 5\n    mobx.extendObservable(b, { d: 6 })\n    b.d = 7\n\n    const e = mobx.observable([1, 2])\n    e.push(3, 4)\n    e.shift()\n    e[2] = 5\n\n    const f = mobx.observable.map({ g: 1 })\n    f.delete(\"h\")\n    f.delete(\"g\")\n    f.set(\"i\", 5)\n    f.set(\"i\", 6)\n\n    const j = mobx.computed(() => a.get() * 2)\n\n    mobx.autorun(() => {\n        j.get()\n    })\n\n    a.set(4)\n\n    mobx.transaction(function myTransaction() {\n        a.set(5)\n        a.set(6)\n    })\n\n    mobx.action(\"myTestAction\", newValue => {\n        a.set(newValue)\n    }).call({}, 7)\n}\n\ntest(\"spy error\", () => {\n    utils.supressConsole(() => {\n        mobx._getGlobalState().mobxGuid = 0\n\n        const a = mobx.observable({\n            x: 2,\n            get y() {\n                if (this.x === 3) throw \"Oops\"\n                return this.x * 2\n            },\n            setX: mobx.action(function setX(x) {\n                this.x = x\n            })\n        })\n\n        const events = []\n        const stop = mobx.spy(c => events.push(c))\n\n        const d = mobx.autorun(() => a.y, { name: \"autorun\" })\n\n        a.x = 3\n        a.setX(4)\n        const actionEvents = events.filter(event => event.type === \"action\")\n        const isActionsTypeofObservable = actionEvents.reduce(\n            (ret, action) => ret && action.object === a,\n            true\n        )\n        events.forEach(x => {\n            delete x.fn\n            delete x.object\n            delete x.time\n        })\n        expect(isActionsTypeofObservable).toBe(true)\n        expect(events).toMatchSnapshot()\n\n        d()\n        stop()\n    })\n})\n\ntest(\"spy stop listen from handler, #1459\", () => {\n    const stop = mobx.spy(() => stop())\n    mobx.spy(() => { })\n    doStuff()\n})\n\ntest(\"bound actions report correct object (discussions/3140)\", () => {\n    class AppState {\n        constructor() {\n            mobx.makeAutoObservable(this, {\n                actionBound: mobx.action.bound,\n            }, { autoBind: true });\n        }\n\n        actionBound() { }\n        autoActionBound() { }\n    }\n\n    const appState = new AppState();\n    const { actionBound, autoActionBound } = appState;\n\n    let events = [];\n    const disposeSpy = mobx.spy((event) => {\n        if (event.type !== 'action') return;\n        events.push(event);\n    });\n\n    try {\n        actionBound();\n        expect(events.pop().object).toBe(appState)\n        autoActionBound();\n        expect(events.pop().object).toBe(appState)\n    } finally {\n        disposeSpy();\n    }\n})\n\ntest(\"computed shouldn't report update unless the value changed #3109\", () => {\n    const number = mobx.observable({\n        value: 0,\n        get isEven() {\n            return (this.value % 2) === 0;\n        }\n    })\n\n    const events = [];\n    const disposeSpy = mobx.spy(event => {\n        if (event.observableKind === 'computed' && event.type === 'update') {\n            events.push(event);\n        };\n    });\n\n    const disposeAutorun = mobx.autorun(() => number.isEven);\n\n    try {\n        expect(events.pop()).toMatchObject({ oldValue: { cause: null }, newValue: true });\n        number.value++; // 1        \n        expect(events.pop()).toMatchObject({ oldValue: true, newValue: false });\n        number.value++; // 2   \n        expect(events.pop()).toMatchObject({ oldValue: false, newValue: true });\n        number.value += 2; // 4       \n        expect(events.pop()).toBe(undefined);\n        number.value += 2; // 6\n        expect(events.pop()).toBe(undefined);\n    } finally {\n        disposeSpy();\n        disposeAutorun();\n    }\n})\n"
  },
  {
    "path": "packages/mobx/__tests__/v5/base/strict-mode.js",
    "content": "/**\n * @type {typeof import(\"../../../src/v5/mobx\")}\n */\nconst mobx = require(\"../../../src/mobx.ts\")\nconst utils = require(\"../../v5/utils/test-utils\")\nconst { makeObservable } = mobx\n\nconst strictError =\n    \"Since strict-mode is enabled, changing (observed) observable values without using an action is not allowed.\"\n\nbeforeEach(() => {\n    mobx.configure({ enforceActions: \"observed\" })\n})\n\ntest(\"strict mode should not allow changes outside action\", () => {\n    const a = mobx.observable.box(2)\n    mobx.configure({ enforceActions: \"observed\" })\n\n    // allowed, a is not observed\n    a.set(3)\n\n    const d = mobx.autorun(() => a.get())\n    // not-allowed, a is observed\n    expect(utils.grabConsole(() => a.set(3))).toMatch(strictError)\n    d()\n\n    mobx.configure({ enforceActions: \"never\" })\n    a.set(4)\n    expect(a.get()).toBe(4)\n})\n\ntest(\"actions can modify observed state in strict mode\", () => {\n    const a = mobx.observable.box(2)\n    const d = mobx.autorun(() => a.get())\n\n    mobx.configure({ enforceActions: \"observed\" })\n    mobx.action(() => {\n        a.set(3)\n        mobx.observable.box(4)\n    })()\n\n    mobx.configure({ enforceActions: \"never\" })\n    d()\n})\n\ntest(\"actions can modify non-observed state in strict mode\", () => {\n    const a = mobx.observable.box(2)\n\n    mobx.configure({ enforceActions: \"observed\" })\n    mobx.action(() => {\n        a.set(3)\n        mobx.observable.box(4)\n    })()\n\n    mobx.configure({ enforceActions: \"never\" })\n})\n\ntest(\"reactions cannot modify state in strict mode\", () => {\n    const a = mobx.observable.box(3)\n    const b = mobx.observable.box(4)\n    mobx.configure({ enforceActions: \"observed\" })\n    mobx._resetGlobalState() // should preserve strict mode\n\n    const bd = mobx.autorun(() => {\n        b.get() // make sure it is observed\n    })\n\n    let d = mobx.autorun(() => {\n        expect(\n            utils.grabConsole(() => {\n                a.get()\n                b.set(3)\n            })\n        ).toMatch(strictError)\n    })\n\n    d = mobx.autorun(() => {\n        if (a.get() > 5) b.set(7)\n    })\n\n    mobx.action(() => a.set(4))() // ok\n\n    expect(utils.grabConsole(() => a.set(5))).toMatch(strictError)\n\n    mobx.configure({ enforceActions: \"never\" })\n    d()\n    bd()\n})\n\ntest(\"action inside reaction in strict mode can modify state\", () => {\n    const a = mobx.observable.box(1)\n    const b = mobx.observable.box(2)\n\n    const bd = mobx.autorun(() => {\n        b.get() // make sure it is observed\n    })\n\n    mobx.configure({ enforceActions: \"observed\" })\n    const act = mobx.action(() => b.set(b.get() + 1))\n\n    const d = mobx.autorun(() => {\n        if (a.get() % 2 === 0) act()\n        if (a.get() == 16) {\n            expect(utils.grabConsole(() => b.set(55))).toMatch(strictError)\n        }\n    })\n\n    const setA = mobx.action(val => a.set(val))\n    expect(b.get()).toBe(2)\n    setA(4)\n    expect(b.get()).toBe(3)\n    setA(5)\n    expect(b.get()).toBe(3)\n    setA(16)\n    expect(b.get()).toBe(55)\n\n    mobx.configure({ enforceActions: \"never\" })\n    bd()\n    d()\n})\n\ntest(\"cannot create or modify objects in strict mode without action\", () => {\n    const obj = mobx.observable({ a: 2 })\n    /*const ar = */ mobx.observable([1])\n    /*const map = */ mobx.observable.map({ a: 2 })\n\n    mobx.configure({ enforceActions: \"observed\" })\n\n    // introducing new observables is ok!\n    // mobx.observable({ a: 2, b: function() { return this.a }});\n    // mobx.observable({ b: function() { return this.a } });\n    // mobx.observable.map({ a: 2});\n    // mobx.observable([1, 2, 3]);\n    // mobx.extendObservable(obj, { b: 4});\n\n    // t.throws(() => obj.a = 3, strictError);\n    // t.throws(() => ar[0] = 2, strictError);\n    // t.throws(() => ar.push(3), strictError);\n    // t.throws(() => map.set(\"a\", 3), strictError);\n    // t.throws(() => map.set(\"b\", 4), strictError);\n    // t.throws(() => map.delete(\"a\"), strictError);\n\n    mobx.configure({ enforceActions: \"never\" })\n\n    // can modify again\n    obj.a = 42\n})\n\ntest(\"can create objects in strict mode with action\", () => {\n    const obj = mobx.observable({ a: 2 })\n    const ar = mobx.observable([1])\n    const map = mobx.observable.map({ a: 2 })\n\n    mobx.configure({ enforceActions: \"observed\" })\n\n    mobx.action(() => {\n        mobx.observable({\n            a: 2,\n            b: function () {\n                return this.a\n            }\n        })\n        mobx.observable.map({ a: 2 })\n        mobx.observable([1, 2, 3])\n\n        obj.a = 3\n        mobx.extendObservable(obj, { b: 4 })\n        ar[0] = 2\n        ar.push(3)\n        map.set(\"a\", 3)\n        map.set(\"b\", 4)\n        map.delete(\"a\")\n    })()\n})\n\ntest(\"strict mode checks\", function () {\n    mobx.configure({\n        enforceActions: \"never\"\n    })\n    const x = mobx.observable.box(3)\n    const d = mobx.autorun(() => x.get())\n\n    mobx._allowStateChanges(false, function () {\n        x.get()\n    })\n\n    mobx._allowStateChanges(true, function () {\n        x.set(7)\n    })\n\n    expect(\n        utils.grabConsole(function () {\n            mobx._allowStateChanges(false, function () {\n                x.set(4)\n            })\n        })\n    ).toMatch(/Side effects like changing state are not allowed at this point/)\n\n    mobx._resetGlobalState()\n    d()\n})\n\ntest(\"enforceActions 'strict' does not allow changing unobserved observables\", () => {\n    try {\n        mobx.configure({ enforceActions: \"always\" })\n        const x = mobx.observable({\n            a: 1,\n            b: 2\n        })\n        const d = mobx.autorun(() => {\n            x.a\n        })\n\n        expect(\n            utils.grabConsole(() => {\n                x.a = 2\n            })\n        ).toMatch(/Since strict-mode is enabled/)\n        expect(\n            utils.grabConsole(() => {\n                x.b = 2\n            })\n        ).toMatch(/Since strict-mode is enabled/)\n\n        d()\n    } finally {\n        mobx.configure({ enforceActions: \"never\" })\n    }\n})\n\ntest(\"enforceActions 'strict' should not throw exception while observable array initialization\", () => {\n    try {\n        mobx.configure({ enforceActions: \"always\" })\n\n        expect(() => {\n            mobx.observable({\n                a: [1, 2]\n            })\n        }).not.toThrow(/Since strict-mode is enabled/)\n    } finally {\n        mobx.configure({ enforceActions: \"never\" })\n    }\n})\n\ntest(\"warn on unsafe reads of computed\", function () {\n    try {\n        mobx.configure({ computedRequiresReaction: true })\n        const x = mobx.observable({\n            y: 3,\n            get yy() {\n                return this.y * 2\n            }\n        })\n        utils.consoleWarn(() => {\n            x.yy\n        }, /being read outside a reactive context/)\n    } finally {\n        mobx.configure({ computedRequiresReaction: false })\n    }\n})\n\ndescribe(\"observableRequiresReaction\", function () {\n    test(\"warn on unsafe reads of observable\", function () {\n        try {\n            mobx.configure({ observableRequiresReaction: true })\n            const x = mobx.observable({\n                y: 3\n            })\n            utils.consoleWarn(() => {\n                x.y\n            }, /being read outside a reactive context/)\n        } finally {\n            mobx.configure({ observableRequiresReaction: false })\n        }\n    })\n\n    test(\"warn on unsafe reads of observable also when there are other subscriptions\", function () {\n        try {\n            mobx.configure({ observableRequiresReaction: true })\n            const x = mobx.observable({\n                y: 3\n            })\n\n            const dispose = mobx.autorun(() => x.y)\n\n            utils.consoleWarn(() => {\n                x.y\n            }, /being read outside a reactive context/)\n\n            dispose()\n        } finally {\n            mobx.configure({ observableRequiresReaction: false })\n        }\n    })\n\n    test(\"warn on unsafe reads of observable array\", function () {\n        try {\n            mobx.configure({ observableRequiresReaction: true })\n            const x = mobx.observable({\n                arr: [1, 2, 3]\n            })\n            utils.consoleWarn(() => {\n                x.arr[1]\n            }, /being read outside a reactive context/)\n        } finally {\n            mobx.configure({ observableRequiresReaction: false })\n        }\n    })\n    test(\"don't warn on reads inside a computed\", function () {\n        try {\n            mobx.configure({ observableRequiresReaction: true })\n            const x = mobx.observable({\n                y: 1\n            })\n\n            const fooComputed = mobx.computed(() => x.y + 1)\n\n            const messages = utils.supressConsole(() => {\n                const dispose = mobx.autorun(() => fooComputed.get())\n                dispose()\n            })\n\n            expect(messages.length).toBe(0)\n        } finally {\n            mobx.configure({ observableRequiresReaction: false })\n        }\n    })\n\n    test(\"don't warn on autorun tracks invalidation of unbound dependencies\", function () {\n        // #2195\n        try {\n            mobx.configure({ observableRequiresReaction: true, enforceActions: \"never\" })\n            const a = mobx.observable.box(0)\n            const b = mobx.observable.box(0)\n            const c = mobx.computed(() => a.get() + b.get())\n            const values = []\n\n            mobx.autorun(() => {\n                values.push(c.get())\n                b.set(100)\n            })\n\n            const messages = utils.supressConsole(() => {\n                a.set(1)\n            })\n\n            expect(messages.length).toBe(0)\n        } finally {\n            mobx.configure({ observableRequiresReaction: false })\n        }\n    })\n\n    test(\"don't warn on autorun tracks invalidation of unbound dependencies - also with action\", function () {\n        // #2195\n        try {\n            mobx.configure({ observableRequiresReaction: true, enforceActions: \"never\" })\n            const a = mobx.observable.box(0)\n            const b = mobx.observable.box(0)\n            const c = mobx.computed(() => a.get() + b.get())\n            const values = []\n\n            mobx.autorun(() => {\n                values.push(c.get())\n                b.set(100)\n            })\n\n            const messages = utils.supressConsole(\n                mobx.action(() => {\n                    a.set(1)\n                })\n            )\n\n            expect(messages.length).toBe(0)\n        } finally {\n            mobx.configure({ observableRequiresReaction: false })\n        }\n    })\n\n    test(\"don't warn on reads inside an action\", function () {\n        try {\n            mobx.configure({ observableRequiresReaction: true })\n            const x = mobx.observable({\n                y: 1\n            })\n\n            const fooAction = mobx.action(() => x.y)\n\n            const messages = utils.supressConsole(() => {\n                fooAction()\n            })\n\n            expect(messages.length).toBe(0)\n        } finally {\n            mobx.configure({ observableRequiresReaction: false })\n        }\n    })\n\n    test(\"warn on reads inside a transaction\", function () {\n        try {\n            mobx.configure({ observableRequiresReaction: true })\n            const x = mobx.observable({\n                y: 1\n            })\n\n            utils.consoleWarn(() => {\n                mobx.transaction(() => x.y)\n            }, /being read outside a reactive context/)\n        } finally {\n            mobx.configure({ observableRequiresReaction: false })\n        }\n    })\n})\n\ndescribe(\"reactionRequiresObservable\", function () {\n    test(\"warn on reaction creation without dependencies\", function () {\n        try {\n            mobx.configure({ reactionRequiresObservable: true })\n\n            utils.consoleWarn(() => {\n                const dispose = mobx.reaction(\n                    () => \"plain value\",\n                    newValue => newValue\n                )\n\n                dispose()\n            }, /is created\\/updated without reading any observable value/)\n        } finally {\n            mobx.configure({ reactionRequiresObservable: false })\n        }\n    })\n})\n\ntest(\"#1869\", function () {\n    const x = mobx.observable.box(3)\n    mobx.configure({ enforceActions: \"always\", isolateGlobalState: true })\n    expect(\n        utils.grabConsole(() => {\n            x.set(4)\n        })\n    ).toMatch(\"Since strict-mode is enabled\")\n    mobx._resetGlobalState() // should preserve strict mode\n})\n"
  },
  {
    "path": "packages/mobx/__tests__/v5/base/tojs.js",
    "content": "\"use strict\"\n\nconst mobx = require(\"../../../src/mobx.ts\")\nconst m = mobx\nconst observable = mobx.observable\n\ntest(\"json1\", function () {\n    mobx._resetGlobalState()\n\n    const todos = observable([\n        {\n            title: \"write blog\"\n        },\n        {\n            title: \"improve coverge\"\n        }\n    ])\n\n    let output\n    mobx.autorun(function () {\n        output = todos\n            .map(function (todo) {\n                return todo.title\n            })\n            .join(\", \")\n    })\n\n    todos[1].title = \"improve coverage\" // prints: write blog, improve coverage\n    expect(output).toBe(\"write blog, improve coverage\")\n    todos.push({ title: \"take a nap\" }) // prints: write blog, improve coverage, take a nap\n    expect(output).toBe(\"write blog, improve coverage, take a nap\")\n})\n\ntest(\"json2\", function () {\n    const source = {\n        todos: [\n            {\n                title: \"write blog\",\n                tags: [\"react\", \"frp\"],\n                details: {\n                    url: \"somewhere\"\n                }\n            },\n            {\n                title: \"do the dishes\",\n                tags: [\"mweh\"],\n                details: {\n                    url: \"here\"\n                }\n            }\n        ]\n    }\n\n    const o = mobx.observable(JSON.parse(JSON.stringify(source)))\n\n    expect(mobx.toJS(o)).toEqual(source)\n\n    const analyze = mobx.computed(function () {\n        return [o.todos.length, o.todos[1].details.url]\n    })\n\n    const alltags = mobx.computed(function () {\n        return o.todos\n            .map(function (todo) {\n                return todo.tags.join(\",\")\n            })\n            .join(\",\")\n    })\n\n    let ab = []\n    let tb = []\n\n    m.observe(\n        analyze,\n        function (d) {\n            ab.push(d.newValue)\n        },\n        true\n    )\n    m.observe(\n        alltags,\n        function (d) {\n            tb.push(d.newValue)\n        },\n        true\n    )\n\n    o.todos[0].details.url = \"boe\"\n    o.todos[1].details.url = \"ba\"\n    o.todos[0].tags[0] = \"reactjs\"\n    o.todos[1].tags.push(\"pff\")\n\n    expect(mobx.toJS(o)).toEqual({\n        todos: [\n            {\n                title: \"write blog\",\n                tags: [\"reactjs\", \"frp\"],\n                details: {\n                    url: \"boe\"\n                }\n            },\n            {\n                title: \"do the dishes\",\n                tags: [\"mweh\", \"pff\"],\n                details: {\n                    url: \"ba\"\n                }\n            }\n        ]\n    })\n    expect(ab).toEqual([\n        [2, \"here\"],\n        [2, \"ba\"]\n    ])\n    expect(tb).toEqual([\"react,frp,mweh\", \"reactjs,frp,mweh\", \"reactjs,frp,mweh,pff\"])\n    ab = []\n    tb = []\n\n    o.todos.push(\n        mobx.observable({\n            title: \"test\",\n            tags: [\"x\"]\n        })\n    )\n\n    expect(mobx.toJS(o)).toEqual({\n        todos: [\n            {\n                title: \"write blog\",\n                tags: [\"reactjs\", \"frp\"],\n                details: {\n                    url: \"boe\"\n                }\n            },\n            {\n                title: \"do the dishes\",\n                tags: [\"mweh\", \"pff\"],\n                details: {\n                    url: \"ba\"\n                }\n            },\n            {\n                title: \"test\",\n                tags: [\"x\"]\n            }\n        ]\n    })\n    expect(ab).toEqual([[3, \"ba\"]])\n    expect(tb).toEqual([\"reactjs,frp,mweh,pff,x\"])\n    ab = []\n    tb = []\n\n    o.todos[1] = mobx.observable({\n        title: \"clean the attic\",\n        tags: [\"needs sabbatical\"],\n        details: {\n            url: \"booking.com\"\n        }\n    })\n    expect(JSON.parse(JSON.stringify(o))).toEqual({\n        todos: [\n            {\n                title: \"write blog\",\n                tags: [\"reactjs\", \"frp\"],\n                details: {\n                    url: \"boe\"\n                }\n            },\n            {\n                title: \"clean the attic\",\n                tags: [\"needs sabbatical\"],\n                details: {\n                    url: \"booking.com\"\n                }\n            },\n            {\n                title: \"test\",\n                tags: [\"x\"]\n            }\n        ]\n    })\n    expect(ab).toEqual([[3, \"booking.com\"]])\n    expect(tb).toEqual([\"reactjs,frp,needs sabbatical,x\"])\n    ab = []\n    tb = []\n\n    o.todos[1].details = mobx.observable({ url: \"google\" })\n    o.todos[1].tags = [\"foo\", \"bar\"]\n    expect(mobx.toJS(o)).toEqual({\n        todos: [\n            {\n                title: \"write blog\",\n                tags: [\"reactjs\", \"frp\"],\n                details: {\n                    url: \"boe\"\n                }\n            },\n            {\n                title: \"clean the attic\",\n                tags: [\"foo\", \"bar\"],\n                details: {\n                    url: \"google\"\n                }\n            },\n            {\n                title: \"test\",\n                tags: [\"x\"]\n            }\n        ]\n    })\n    expect(mobx.toJS(o)).toEqual(mobx.toJS(o))\n    expect(ab).toEqual([[3, \"google\"]])\n    expect(tb).toEqual([\"reactjs,frp,foo,bar,x\"])\n})\n\ntest(\"toJS handles dates\", () => {\n    const a = observable({\n        d: new Date()\n    })\n\n    const b = mobx.toJS(a)\n    expect(b.d instanceof Date).toBe(true)\n    expect(a.d === b.d).toBe(true)\n})\n\ntest(\"toJS handles symbol keys in objects and maps\", () => {\n    const key = Symbol(\"key\")\n    const a = observable({\n        [key]: 42\n    })\n\n    expect(a[key]).toBe(42)\n    const b = mobx.toJS(a)\n    expect(b[key]).toBe(42)\n\n    const x = observable.map({\n        [key]: 43\n    })\n\n    const y = mobx.toJS(x)\n    expect(y.get(key)).toBe(43)\n})\n\ntest(\"json cycles\", function () {\n    const a = observable({\n        b: 1,\n        c: [2],\n        d: mobx.observable.map()\n    })\n\n    a.e = a\n    a.c.push(a, a.d)\n    a.d.set(\"f\", a)\n    a.d.set(\"d\", a.d)\n    a.d.set(\"c\", a.c)\n\n    const cloneA = mobx.toJS(a)\n    const cloneC = cloneA.c\n    const cloneD = cloneA.d\n\n    expect(cloneA.b).toBe(1)\n    expect(cloneA.c[0]).toBe(2)\n    expect(cloneA.c[1]).toBe(cloneA)\n    expect(cloneA.c[2]).toBe(cloneD)\n    expect(cloneD.get(\"f\")).toBe(cloneA)\n    expect(cloneD.get(\"d\")).toBe(cloneD)\n    expect(cloneD.get(\"c\")).toBe(cloneC)\n    expect(cloneA.e).toBe(cloneA)\n})\n\ntest(\"#285 class instances with toJS\", () => {\n    function Person() {\n        this.firstName = \"michel\"\n        mobx.extendObservable(this, {\n            lastName: \"weststrate\",\n            tags: [\"user\", \"mobx-member\"],\n            get fullName() {\n                return this.firstName + this.lastName\n            }\n        })\n    }\n\n    const p1 = new Person()\n    // check before lazy initialization\n    expect(mobx.toJS(p1)).toEqual({\n        firstName: \"michel\",\n        lastName: \"weststrate\",\n        tags: [\"user\", \"mobx-member\"]\n    })\n\n    // check after lazy initialization\n    expect(mobx.toJS(p1)).toEqual({\n        firstName: \"michel\",\n        lastName: \"weststrate\",\n        tags: [\"user\", \"mobx-member\"]\n    })\n})\n\ntest(\"#285 non-mobx class instances with toJS\", () => {\n    const nameObservable = mobx.observable.box(\"weststrate\")\n    function Person() {\n        this.firstName = \"michel\"\n        this.lastName = nameObservable\n    }\n\n    const p1 = new Person()\n    // check before lazy initialization\n    expect(mobx.toJS(p1)).toEqual({\n        firstName: \"michel\",\n        lastName: nameObservable // toJS doesn't recurse into non observable objects!\n    })\n})\n\ntest(\"verify #566 solution\", () => {\n    function MyClass() {}\n    const a = new MyClass()\n    const b = mobx.observable({ x: 3 })\n    const c = mobx.observable({ a: a, b: b })\n\n    expect(mobx.toJS(c).a === a).toBeTruthy() // true\n    expect(mobx.toJS(c).b !== b).toBeTruthy() // false, cloned\n    expect(mobx.toJS(c).b.x === b.x).toBeTruthy() // true, both 3\n})\n\ntest(\"verify already seen\", () => {\n    const a = mobx.observable({ x: null, y: 3 })\n    a.x = a\n\n    const res = mobx.toJS(a)\n    expect(res.y).toBe(3)\n    expect(res.x === res).toBeTruthy()\n    expect(res.x === a).toBeFalsy()\n})\n\ntest(\"json cycles when exporting maps as maps\", function () {\n    const a = observable({\n        b: 1,\n        c: [2],\n        d: mobx.observable.map()\n    })\n\n    a.e = a\n    a.c.push(a, a.d)\n    a.d.set(\"f\", a)\n    a.d.set(\"d\", a.d)\n    a.d.set(\"c\", a.c)\n\n    const cloneA = mobx.toJS(a)\n    const cloneC = cloneA.c\n    const cloneD = cloneA.d\n\n    expect(cloneA.b).toBe(1)\n    expect(cloneA.c[0]).toBe(2)\n    expect(cloneA.c[1]).toBe(cloneA)\n    expect(cloneA.c[2]).toBe(cloneD)\n    expect(cloneD).toBeInstanceOf(Map)\n    expect(cloneD.get(\"f\")).toBe(cloneA)\n    expect(cloneD.get(\"d\")).toBe(cloneD)\n    expect(cloneD.get(\"c\")).toBe(cloneC)\n    expect(cloneA.e).toBe(cloneA)\n})\n\ndescribe(\"recurseEverything set to true\", function () {\n    test(\"recurseEverything is no longer supported\", () => {\n        expect(() => mobx.toJS({}, { recurseEverything: true })).toThrowErrorMatchingInlineSnapshot(\n            `\"[MobX] toJS no longer supports options\"`\n        )\n    })\n})\n\ntest(\"Does not throw on object with configure({ useProxies: 'ifavailable'}) #2871\", () => {\n    const { useProxies } = mobx._resetGlobalState\n    mobx.configure({ useProxies: \"ifavailable\" })\n    expect(() => {\n        const o = mobx.observable({ key: \"value\" })\n        const dispose = mobx.autorun(() => mobx.toJS(o))\n        dispose()\n    }).not.toThrow()\n    mobx.configure({ useProxies })\n})\n\ntest(\"Correctly converts observable objects with computed values\", () => {\n    const a = observable({ key: \"value\" })\n    const c = observable({ computedValue: mobx.computed(() => a.key) })\n\n    const j = mobx.toJS(c)\n    expect(j).toMatchObject({ computedValue: \"value\" })\n})\n"
  },
  {
    "path": "packages/mobx/__tests__/v5/base/trace.ts",
    "content": "\"use strict\"\n\nimport * as mobx from \"../../../src/mobx\"\n\ndescribe(\"trace\", () => {\n    let consoleLogSpy\n    beforeEach(() => {\n        mobx._resetGlobalState()\n        consoleLogSpy = jest.spyOn(console, \"log\").mockImplementation()\n    })\n    afterEach(() => {\n        consoleLogSpy.mockRestore()\n    })\n\n    test(\"simple\", () => {\n        const expectedLogCalls: Array<any> = []\n        const x = mobx.observable(\n            {\n                firstname: \"Michel\",\n                lastname: \"Weststrate\",\n                get fullname() {\n                    /* test multi line comment\n                    (run this unit test from VS code, and pass 'true'  as third argument to trace below to verify)\n                */\n                    const res = this.firstname + \" \" + this.lastname\n                    mobx.trace(this, \"fullname\")\n                    return res\n                }\n            },\n            {},\n            { name: \"x\" }\n        )\n        x.fullname\n        expectedLogCalls.push([\"[mobx.trace] 'x.fullname' tracing enabled\"])\n\n        x.fullname\n        expectedLogCalls.push([\n            \"[mobx.trace] Computed value 'x.fullname' is being read outside a reactive context. Doing a full recompute.\"\n        ])\n\n        const dispose = mobx.autorun(\n            () => {\n                x.fullname\n                mobx.trace()\n            },\n            { name: \"autorun\" }\n        )\n        expectedLogCalls.push([\"[mobx.trace] 'autorun' tracing enabled\"])\n\n        mobx.transaction(() => {\n            x.firstname = \"John\"\n            expectedLogCalls.push([\n                \"[mobx.trace] 'x.fullname' is invalidated due to a change in: 'x.firstname'\"\n            ])\n            x.lastname = \"Doe\"\n        })\n\n        expectedLogCalls.push([\n            \"[mobx.trace] 'autorun' is invalidated due to a change in: 'x.fullname'\"\n        ])\n\n        dispose()\n\n        expectedLogCalls.push([\n            \"[mobx.trace] Computed value 'x.fullname' was suspended and it will recompute on the next access.\"\n        ])\n\n        expect(expectedLogCalls).toEqual(consoleLogSpy.mock.calls)\n    })\n\n    test(\"Log only if derivation is actually about to re-run #2859\", () => {\n        const expectedLogCalls: Array<any> = []\n        const x = mobx.observable(\n            {\n                foo: 0,\n                get fooIsGreaterThan5() {\n                    return this.foo > 5\n                }\n            },\n            {},\n            { name: \"x\" }\n        )\n        mobx.trace(x, \"fooIsGreaterThan5\")\n        expectedLogCalls.push([\"[mobx.trace] 'x.fooIsGreaterThan5' tracing enabled\"])\n\n        x.fooIsGreaterThan5\n        expectedLogCalls.push([\n            \"[mobx.trace] Computed value 'x.fooIsGreaterThan5' is being read outside a reactive context. Doing a full recompute.\"\n        ])\n\n        const dispose = mobx.autorun(\n            () => {\n                mobx.trace(true)\n                x.fooIsGreaterThan5\n            },\n            { name: \"autorun\" }\n        )\n        expectedLogCalls.push([\"[mobx.trace] 'autorun' tracing enabled\"])\n\n        mobx.transaction(() => {\n            x.foo = 1\n            expectedLogCalls.push([\n                \"[mobx.trace] 'x.fooIsGreaterThan5' is invalidated due to a change in: 'x.foo'\"\n            ])\n        })\n\n        mobx.transaction(() => {\n            x.foo = 6\n            expectedLogCalls.push([\n                \"[mobx.trace] 'x.fooIsGreaterThan5' is invalidated due to a change in: 'x.foo'\"\n            ])\n        })\n\n        expectedLogCalls.push([\n            \"[mobx.trace] 'autorun' is invalidated due to a change in: 'x.fooIsGreaterThan5'\"\n        ])\n\n        dispose()\n\n        expectedLogCalls.push([\n            \"[mobx.trace] Computed value 'x.fooIsGreaterThan5' was suspended and it will recompute on the next access.\"\n        ])\n\n        expect(expectedLogCalls).toEqual(consoleLogSpy.mock.calls)\n    })\n\n    test(\"1850\", () => {\n        const x = mobx.observable({\n            firstname: \"Michel\",\n            lastname: \"Weststrate\",\n            get fullname() {\n                /* test multi line comment\n                        (run this unit test from VS code, to manually verify serialization)\n                    */\n                const res = this.firstname + \" \" + this.lastname\n                mobx.trace(this, \"fullname\", true)\n                return res\n            }\n        })\n\n        mobx.autorun(() => {\n            x.fullname\n        })\n        expect(() => {\n            x.firstname += \"!\"\n        }).not.toThrow(\"Unexpected identifier\")\n    })\n})\n"
  },
  {
    "path": "packages/mobx/__tests__/v5/base/typescript-decorators.ts",
    "content": "\"use strict\"\n\nimport {\n    observe,\n    computed,\n    observable,\n    autorun,\n    extendObservable,\n    action,\n    IObservableArray,\n    IArrayWillChange,\n    IArrayWillSplice,\n    IObservableValue,\n    isObservable,\n    isObservableProp,\n    isObservableObject,\n    transaction,\n    IObjectDidChange,\n    spy,\n    configure,\n    isAction,\n    IAtom,\n    createAtom,\n    runInAction,\n    makeObservable,\n    flow,\n    flowResult\n} from \"../../../src/mobx\"\nimport * as mobx from \"../../../src/mobx\"\n\nconst testFunction = function (a: any) {}\n\n// lazy wrapper around yest\n\nconst t = {\n    equal(a: any, b: any) {\n        expect(a).toBe(b)\n    },\n    deepEqual(a: any, b: any) {\n        expect(a).toEqual(b)\n    },\n    notEqual(a: any, b: any) {\n        expect(a).not.toEqual(b)\n    },\n\n    throws(a: any, b: any) {\n        expect(a).toThrow(b)\n    }\n}\n\ntest(\"decorators\", () => {\n    class Order {\n        @observable price: number = 3\n        @observable amount: number = 2\n        @observable orders: string[] = []\n        @observable aFunction = testFunction\n\n        @computed\n        get total() {\n            return this.amount * this.price * (1 + this.orders.length)\n        }\n\n        constructor() {\n            makeObservable(this)\n        }\n\n        @flow\n        *testDouble(n: number): Generator<number, number> {\n            yield 3\n            return n * 2\n        }\n\n        async run() {\n            const x: number = await flowResult(this.testDouble(2))\n        }\n    }\n\n    const o = new Order()\n    t.equal(isObservableObject(o), true)\n    t.equal(isObservableProp(o, \"amount\"), true)\n    t.equal(isObservableProp(o, \"total\"), true)\n\n    const events: any[] = []\n    const d1 = observe(o, (ev: IObjectDidChange) => events.push(ev.name, (ev as any).oldValue))\n    const d2 = observe(o, \"price\", ev => events.push(ev.newValue, ev.oldValue))\n    const d3 = observe(o, \"total\", ev => events.push(ev.newValue, ev.oldValue))\n\n    o.price = 4\n\n    d1()\n    d2()\n    d3()\n\n    o.price = 5\n\n    t.deepEqual(events, [\n        8, // new total\n        6, // old total\n        4, // new price\n        3, // old price\n        \"price\", // event name\n        3 // event oldValue\n    ])\n})\n\ntest(\"annotations\", () => {\n    const fn0 = () => 0\n    class Order {\n        @observable price: number = 3\n        @observable amount: number = 2\n        @observable orders: string[] = []\n        @observable aFunction = fn0\n\n        @computed\n        get total() {\n            return this.amount * this.price * (1 + this.orders.length)\n        }\n\n        constructor() {\n            makeObservable(this)\n        }\n    }\n\n    const order1totals: number[] = []\n    const order1 = new Order()\n    const order2 = new Order()\n\n    const disposer = autorun(() => {\n        order1totals.push(order1.total)\n    })\n\n    order2.price = 4\n    order1.amount = 1\n\n    t.equal(order1.price, 3)\n    t.equal(order1.total, 3)\n    t.equal(order2.total, 8)\n    order2.orders.push(\"bla\")\n    t.equal(order2.total, 16)\n\n    order1.orders.splice(0, 0, \"boe\", \"hoi\")\n    t.deepEqual(order1totals, [6, 3, 9])\n\n    disposer()\n    order1.orders.pop()\n    t.equal(order1.total, 6)\n    t.deepEqual(order1totals, [6, 3, 9])\n    expect(isAction(order1.aFunction)).toBe(true)\n    expect(order1.aFunction()).toBe(0)\n    order1.aFunction = () => 1\n    expect(isAction(order1.aFunction)).toBe(true)\n    expect(order1.aFunction()).toBe(1)\n})\n\ntest(\"box\", () => {\n    class Box {\n        @observable uninitialized: any\n        @observable height = 20\n        @observable sizes = [2]\n        @observable\n        someFunc = function () {\n            return 2\n        }\n        @computed\n        get width() {\n            return this.height * this.sizes.length * this.someFunc() * (this.uninitialized ? 2 : 1)\n        }\n        @action(\"test\")\n        addSize() {\n            this.sizes.push(3)\n            this.sizes.push(4)\n        }\n\n        constructor() {\n            makeObservable(this)\n        }\n    }\n\n    const box = new Box()\n\n    const ar: number[] = []\n\n    autorun(() => {\n        ar.push(box.width)\n    })\n\n    t.deepEqual(ar.slice(), [40])\n    box.height = 10\n    t.deepEqual(ar.slice(), [40, 20])\n    box.sizes.push(3, 4)\n    t.deepEqual(ar.slice(), [40, 20, 60])\n    box.someFunc = () => 7\n    t.deepEqual(ar.slice(), [40, 20, 60, 210])\n    box.uninitialized = true\n    t.deepEqual(ar.slice(), [40, 20, 60, 210, 420])\n    box.addSize()\n    expect(ar.slice()).toEqual([40, 20, 60, 210, 420, 700])\n})\n\ntest(\"computed setter should succeed\", () => {\n    class Bla {\n        @observable a = 3\n        @computed\n        get propX() {\n            return this.a * 2\n        }\n        set propX(v) {\n            this.a = v\n        }\n\n        constructor() {\n            makeObservable(this)\n        }\n    }\n\n    const b = new Bla()\n    t.equal(b.propX, 6)\n    b.propX = 4\n    t.equal(b.propX, 8)\n})\n\ntest(\"typescript: parameterized computed decorator\", () => {\n    class TestClass {\n        @observable x = 3\n        @observable y = 3\n        @computed.struct\n        get boxedSum() {\n            return { sum: Math.round(this.x) + Math.round(this.y) }\n        }\n        constructor() {\n            makeObservable(this)\n        }\n    }\n\n    const t1 = new TestClass()\n    const changes: { sum: number }[] = []\n    const d = autorun(() => changes.push(t1.boxedSum))\n\n    t1.y = 4 // change\n    t.equal(changes.length, 2)\n    t1.y = 4.2 // no change\n    t.equal(changes.length, 2)\n    transaction(() => {\n        t1.y = 3\n        t1.x = 4\n    }) // no change\n    t.equal(changes.length, 2)\n    t1.x = 6 // change\n    t.equal(changes.length, 3)\n    d()\n\n    t.deepEqual(changes, [{ sum: 6 }, { sum: 7 }, { sum: 9 }])\n})\n\ntest(\"issue 165\", () => {\n    function report<T>(msg: string, value: T) {\n        // console.log(msg, \":\", value)\n        return value\n    }\n\n    class Card {\n        constructor(public game: Game, public id: number) {\n            makeObservable(this)\n        }\n\n        @computed\n        get isWrong() {\n            return report(\n                \"Computing isWrong for card \" + this.id,\n                this.isSelected && this.game.isMatchWrong\n            )\n        }\n\n        @computed\n        get isSelected() {\n            return report(\n                \"Computing isSelected for card\" + this.id,\n                this.game.firstCardSelected === this || this.game.secondCardSelected === this\n            )\n        }\n    }\n\n    class Game {\n        @observable firstCardSelected: Card | null = null\n        @observable secondCardSelected: Card | null = null\n\n        @computed\n        get isMatchWrong() {\n            return report(\n                \"Computing isMatchWrong\",\n                this.secondCardSelected !== null &&\n                    this.firstCardSelected!.id !== this.secondCardSelected.id\n            )\n        }\n\n        constructor() {\n            makeObservable(this)\n        }\n    }\n\n    let game = new Game()\n    let card1 = new Card(game, 1),\n        card2 = new Card(game, 2)\n\n    autorun(() => {\n        card1.isWrong\n        card2.isWrong\n        // console.log(\"card1.isWrong =\", card1.isWrong)\n        // console.log(\"card2.isWrong =\", card2.isWrong)\n        // console.log(\"------------------------------\")\n    })\n\n    // console.log(\"Selecting first card\")\n    game.firstCardSelected = card1\n    // console.log(\"Selecting second card\")\n    game.secondCardSelected = card2\n\n    t.equal(card1.isWrong, true)\n    t.equal(card2.isWrong, true)\n})\n\ntest(\"issue 191 - shared initializers (ts)\", () => {\n    class Test {\n        @observable obj = { a: 1 }\n        @observable array = [2]\n        constructor() {\n            makeObservable(this)\n        }\n    }\n\n    const t1 = new Test()\n    t1.obj.a = 2\n    t1.array.push(3)\n\n    const t2 = new Test()\n    t2.obj.a = 3\n    t2.array.push(4)\n\n    t.notEqual(t1.obj, t2.obj)\n    t.notEqual(t1.array, t2.array)\n    t.equal(t1.obj.a, 2)\n    t.equal(t2.obj.a, 3)\n\n    t.deepEqual(t1.array.slice(), [2, 3])\n    t.deepEqual(t2.array.slice(), [2, 4])\n})\n\nfunction normalizeSpyEvents(events: any[]) {\n    events.forEach(ev => {\n        delete ev.fn\n        delete ev.time\n    })\n    return events\n}\n\ntest(\"action decorator (typescript)\", () => {\n    class Store {\n        constructor(private multiplier: number) {\n            makeObservable(this)\n        }\n\n        @action\n        add(a: number, b: number): number {\n            return (a + b) * this.multiplier\n        }\n    }\n\n    const store1 = new Store(2)\n    const store2 = new Store(3)\n    const events: any[] = []\n    const d = spy(events.push.bind(events))\n    t.equal(store1.add(3, 4), 14)\n    t.equal(store2.add(2, 2), 12)\n    t.equal(store1.add(1, 1), 4)\n\n    t.deepEqual(normalizeSpyEvents(events), [\n        { arguments: [3, 4], name: \"add\", spyReportStart: true, object: store1, type: \"action\" },\n        { type: \"report-end\", spyReportEnd: true },\n        { arguments: [2, 2], name: \"add\", spyReportStart: true, object: store2, type: \"action\" },\n        { type: \"report-end\", spyReportEnd: true },\n        { arguments: [1, 1], name: \"add\", spyReportStart: true, object: store1, type: \"action\" },\n        { type: \"report-end\", spyReportEnd: true }\n    ])\n\n    d()\n})\n\ntest(\"custom action decorator (typescript)\", () => {\n    class Store {\n        constructor(private multiplier: number) {\n            makeObservable(this)\n        }\n\n        @action(\"zoem zoem\")\n        add(a: number, b: number): number {\n            return (a + b) * this.multiplier\n        }\n    }\n\n    const store1 = new Store(2)\n    const store2 = new Store(3)\n    const events: any[] = []\n    const d = spy(events.push.bind(events))\n    t.equal(store1.add(3, 4), 14)\n    t.equal(store2.add(2, 2), 12)\n    t.equal(store1.add(1, 1), 4)\n\n    t.deepEqual(normalizeSpyEvents(events), [\n        {\n            arguments: [3, 4],\n            name: \"zoem zoem\",\n            spyReportStart: true,\n            object: store1,\n            type: \"action\"\n        },\n        { type: \"report-end\", spyReportEnd: true },\n        {\n            arguments: [2, 2],\n            name: \"zoem zoem\",\n            spyReportStart: true,\n            object: store2,\n            type: \"action\"\n        },\n        { type: \"report-end\", spyReportEnd: true },\n        {\n            arguments: [1, 1],\n            name: \"zoem zoem\",\n            spyReportStart: true,\n            object: store1,\n            type: \"action\"\n        },\n        { type: \"report-end\", spyReportEnd: true }\n    ])\n\n    d()\n})\n\ntest(\"action decorator on field (typescript)\", () => {\n    class Store {\n        constructor(private multiplier: number) {\n            makeObservable(this)\n        }\n\n        @action\n        add = (a: number, b: number) => {\n            return (a + b) * this.multiplier\n        }\n    }\n\n    const store1 = new Store(2)\n    const store2 = new Store(7)\n    expect(store1.add).not.toEqual(store2.add)\n\n    const events: any[] = []\n    const d = spy(events.push.bind(events))\n    t.equal(store1.add(3, 4), 14)\n    t.equal(store2.add(4, 5), 63)\n    t.equal(store1.add(2, 2), 8)\n\n    t.deepEqual(normalizeSpyEvents(events), [\n        { arguments: [3, 4], name: \"add\", spyReportStart: true, object: store1, type: \"action\" },\n        { type: \"report-end\", spyReportEnd: true },\n        { arguments: [4, 5], name: \"add\", spyReportStart: true, object: store2, type: \"action\" },\n        { type: \"report-end\", spyReportEnd: true },\n        { arguments: [2, 2], name: \"add\", spyReportStart: true, object: store1, type: \"action\" },\n        { type: \"report-end\", spyReportEnd: true }\n    ])\n\n    d()\n})\n\ntest(\"custom action decorator on field (typescript)\", () => {\n    class Store {\n        constructor(private multiplier: number) {\n            makeObservable(this)\n        }\n\n        @action(\"zoem zoem\")\n        add = (a: number, b: number) => {\n            return (a + b) * this.multiplier\n        }\n    }\n\n    const store1 = new Store(2)\n    const store2 = new Store(7)\n\n    const events: any[] = []\n    const d = spy(events.push.bind(events))\n    t.equal(store1.add(3, 4), 14)\n    t.equal(store2.add(4, 5), 63)\n    t.equal(store1.add(2, 2), 8)\n\n    t.deepEqual(normalizeSpyEvents(events), [\n        {\n            arguments: [3, 4],\n            name: \"zoem zoem\",\n            spyReportStart: true,\n            object: store1,\n            type: \"action\"\n        },\n        { type: \"report-end\", spyReportEnd: true },\n        {\n            arguments: [4, 5],\n            name: \"zoem zoem\",\n            spyReportStart: true,\n            object: store2,\n            type: \"action\"\n        },\n        { type: \"report-end\", spyReportEnd: true },\n        {\n            arguments: [2, 2],\n            name: \"zoem zoem\",\n            spyReportStart: true,\n            object: store1,\n            type: \"action\"\n        },\n        { type: \"report-end\", spyReportEnd: true }\n    ])\n\n    d()\n})\n\ntest(\"267 (typescript) should be possible to declare properties observable outside strict mode\", () => {\n    configure({ enforceActions: \"observed\" })\n\n    class Store {\n        @observable timer: number | null = null\n\n        constructor() {\n            makeObservable(this)\n        }\n    }\n\n    configure({ enforceActions: \"never\" })\n})\n\ntest(\"288 atom not detected for object property\", () => {\n    class Store {\n        @observable foo = \"\"\n\n        constructor() {\n            makeObservable(this)\n        }\n    }\n\n    const store = new Store()\n\n    mobx.observe(\n        store,\n        \"foo\",\n        () => {\n            // console.log(\"Change observed\")\n        },\n        true\n    )\n})\n\ntest.skip(\"observable performance - ts - decorators\", () => {\n    const AMOUNT = 100000\n\n    class A {\n        @observable a = 1\n        @observable b = 2\n        @observable c = 3\n        @computed\n        get d() {\n            return this.a + this.b + this.c\n        }\n        constructor() {\n            makeObservable(this)\n        }\n    }\n\n    const objs: any[] = []\n    const start = Date.now()\n\n    for (let i = 0; i < AMOUNT; i++) objs.push(new A())\n\n    console.log(\"created in \", Date.now() - start)\n\n    for (let j = 0; j < 4; j++) {\n        for (let i = 0; i < AMOUNT; i++) {\n            const obj = objs[i]\n            obj.a += 3\n            obj.b *= 4\n            obj.c = obj.b - obj.a\n            obj.d\n        }\n    }\n\n    console.log(\"changed in \", Date.now() - start)\n})\n\ntest(\"unbound methods\", () => {\n    class A {\n        // shared across all instances\n        @action\n        m1() {}\n\n        // per instance\n        @action m2 = () => {}\n        constructor() {\n            makeObservable(this)\n        }\n    }\n\n    const a1 = new A()\n    const a2 = new A()\n\n    t.equal(a1.m1, a2.m1)\n    t.notEqual(a1.m2, a2.m2)\n    t.equal(Object.hasOwnProperty.call(a1, \"m1\"), false)\n    t.equal(Object.hasOwnProperty.call(a1, \"m2\"), true)\n    t.equal(Object.hasOwnProperty.call(a2, \"m1\"), false)\n    t.equal(Object.hasOwnProperty.call(a2, \"m2\"), true)\n})\n\ntest(\"inheritance\", () => {\n    class A {\n        @observable a = 2\n        constructor() {\n            makeObservable(this)\n        }\n    }\n\n    class B extends A {\n        @observable b = 3\n        @computed\n        get c() {\n            return this.a + this.b\n        }\n        constructor() {\n            super()\n            makeObservable(this)\n        }\n    }\n    const b1 = new B()\n    const b2 = new B()\n    const values: any[] = []\n    mobx.autorun(() => values.push(b1.c + b2.c))\n\n    b1.a = 3\n    b1.b = 4\n    b2.b = 5\n    b2.a = 6\n\n    t.deepEqual(values, [10, 11, 12, 14, 18])\n})\n\ntest(\"inheritance overrides observable\", () => {\n    class A {\n        @observable a = 2\n        constructor() {\n            makeObservable(this)\n        }\n    }\n\n    class B {\n        @observable a = 5\n        @observable b = 3\n        @computed\n        get c() {\n            return this.a + this.b\n        }\n        constructor() {\n            makeObservable(this)\n        }\n    }\n\n    const b1 = new B()\n    const b2 = new B()\n    const values: any[] = []\n    mobx.autorun(() => values.push(b1.c + b2.c))\n\n    b1.a = 3\n    b1.b = 4\n    b2.b = 5\n    b2.a = 6\n\n    t.deepEqual(values, [16, 14, 15, 17, 18])\n})\n\ntest(\"reusing initializers\", () => {\n    class A {\n        @observable a = 3\n        @observable b = this.a + 2\n        @computed\n        get c() {\n            return this.a + this.b\n        }\n        @computed\n        get d() {\n            return this.c + 1\n        }\n        constructor() {\n            makeObservable(this)\n        }\n    }\n\n    const a = new A()\n    const values: any[] = []\n    mobx.autorun(() => values.push(a.d))\n\n    a.a = 4\n    t.deepEqual(values, [9, 10])\n})\n\ntest(\"enumerability\", () => {\n    class A {\n        @observable a = 1 // enumerable, on proto\n        @computed\n        get b() {\n            return this.a\n        } // non-enumerable, (and, ideally, on proto)\n        @action\n        m() {} // non-enumerable, on proto\n        @action m2 = () => {} // non-enumerable, on self\n        constructor() {\n            makeObservable(this)\n        }\n    }\n\n    const a = new A()\n\n    // not initialized yet\n    let ownProps = Object.keys(a)\n    let props: string[] = []\n    for (const key in a) props.push(key)\n\n    t.deepEqual(ownProps, [\n        \"a\" // yeej!\n    ])\n\n    t.deepEqual(props, [\n        // also 'a' would be ok\n        \"a\"\n    ])\n\n    t.equal(\"a\" in a, true)\n    // eslint-disable-next-line\n    t.equal(a.hasOwnProperty(\"a\"), true)\n    // eslint-disable-next-line\n    t.equal(a.hasOwnProperty(\"b\"), true) // false would be slightly better, true also ok-ish, and, see #1777\n    // eslint-disable-next-line\n    t.equal(a.hasOwnProperty(\"m\"), false)\n    // eslint-disable-next-line\n    t.equal(a.hasOwnProperty(\"m2\"), true)\n\n    t.equal(mobx.isAction(a.m), true)\n    t.equal(mobx.isAction(a.m2), true)\n\n    // after initialization\n    a.a\n    a.b\n    a.m\n    a.m2\n\n    ownProps = Object.keys(a)\n    props = []\n    for (const key in a) props.push(key)\n\n    t.deepEqual(ownProps, [\"a\"])\n\n    t.deepEqual(props, [\"a\"])\n\n    t.equal(\"a\" in a, true)\n    // eslint-disable-next-line\n    t.equal(a.hasOwnProperty(\"a\"), true)\n    // eslint-disable-next-line\n    t.equal(a.hasOwnProperty(\"b\"), true) // false would be slightly better, true also ok-ish, and, see #1777\n    // eslint-disable-next-line\n    t.equal(a.hasOwnProperty(\"m\"), false)\n    // eslint-disable-next-line\n    t.equal(a.hasOwnProperty(\"m2\"), true)\n})\n\ntest(\"issue 285 (typescript)\", () => {\n    const { observable, toJS } = mobx\n\n    class Todo {\n        id = 1\n        @observable title: string\n        @observable finished = false\n        @observable childThings = [1, 2, 3]\n        constructor(title: string) {\n            makeObservable(this)\n            this.title = title\n        }\n    }\n\n    const todo = new Todo(\"Something to do\")\n\n    t.deepEqual(toJS(todo), {\n        id: 1,\n        title: \"Something to do\",\n        finished: false,\n        childThings: [1, 2, 3]\n    })\n})\n\ntest(\"verify object assign (typescript)\", () => {\n    class Todo {\n        @observable title = \"test\"\n        @computed\n        get upperCase() {\n            return this.title.toUpperCase()\n        }\n        constructor() {\n            makeObservable(this)\n        }\n    }\n\n    t.deepEqual((Object as any).assign({}, new Todo()), {\n        title: \"test\"\n    })\n})\n\ntest(\"379, inheritable actions (typescript)\", () => {\n    class A {\n        @action\n        method() {\n            return 42\n        }\n        constructor() {\n            makeObservable(this)\n        }\n    }\n\n    class B extends A {\n        method() {\n            return super.method() * 2\n        }\n        constructor() {\n            super()\n            makeObservable(this)\n        }\n    }\n\n    class C extends B {\n        method() {\n            return super.method() + 3\n        }\n        constructor() {\n            super()\n            makeObservable(this)\n        }\n    }\n\n    const b = new B()\n    t.equal(b.method(), 84)\n    t.equal(isAction(b.method), true)\n\n    const a = new A()\n    t.equal(a.method(), 42)\n    t.equal(isAction(a.method), true)\n\n    const c = new C()\n    t.equal(c.method(), 87)\n    t.equal(isAction(c.method), true)\n})\n\ntest(\"373 - fix isObservable for unused computed\", () => {\n    class Bla {\n        @computed\n        get computedVal() {\n            return 3\n        }\n        constructor() {\n            makeObservable(this)\n            t.equal(isObservableProp(this, \"computedVal\"), true)\n            this.computedVal\n            t.equal(isObservableProp(this, \"computedVal\"), true)\n        }\n    }\n\n    new Bla()\n})\n\ntest(\"505, don't throw when accessing subclass fields in super constructor (typescript)\", () => {\n    const values: any = {}\n    class A {\n        @observable a = 1\n        constructor() {\n            makeObservable(this)\n            values.b = (this as any)[\"b\"]\n            values.a = this.a\n        }\n    }\n\n    class B extends A {\n        @observable b = 2\n\n        constructor() {\n            super()\n            makeObservable(this)\n        }\n    }\n\n    new B()\n    t.deepEqual(values, { a: 1, b: undefined }) // undefined, as A constructor runs before B constructor\n})\n\ntest(\"705 - setter undoing caching (typescript)\", () => {\n    let recomputes = 0\n    let autoruns = 0\n\n    class Person {\n        @observable name: string = \"\"\n        @observable title: string = \"\"\n\n        // Typescript bug: if fullName is before the getter, the property is defined twice / incorrectly, see #705\n        // set fullName(val) {\n        // \t// Noop\n        // }\n        @computed\n        get fullName() {\n            recomputes++\n            return this.title + \" \" + this.name\n        }\n        // Should also be possible to define the setter _before_ the fullname\n        set fullName(val) {\n            // Noop\n        }\n        constructor() {\n            makeObservable(this)\n        }\n    }\n\n    let p1 = new Person()\n    p1.name = \"Tom Tank\"\n    p1.title = \"Mr.\"\n\n    t.equal(recomputes, 0)\n    t.equal(autoruns, 0)\n\n    const d1 = autorun(() => {\n        autoruns++\n        p1.fullName\n    })\n\n    const d2 = autorun(() => {\n        autoruns++\n        p1.fullName\n    })\n\n    t.equal(recomputes, 1)\n    t.equal(autoruns, 2)\n\n    p1.title = \"Master\"\n    t.equal(recomputes, 2)\n    t.equal(autoruns, 4)\n\n    d1()\n    d2()\n})\n\ntest(\"@observable.ref (TS)\", () => {\n    class A {\n        @observable.ref ref = { a: 3 }\n        constructor() {\n            makeObservable(this)\n        }\n    }\n\n    const a = new A()\n    t.equal(a.ref.a, 3)\n    t.equal(mobx.isObservable(a.ref), false)\n    t.equal(mobx.isObservableProp(a, \"ref\"), true)\n})\n\ntest(\"@observable.shallow (TS)\", () => {\n    class A {\n        @observable.shallow arr = [{ todo: 1 }]\n        constructor() {\n            makeObservable(this)\n        }\n    }\n\n    const a = new A()\n    const todo2 = { todo: 2 }\n    a.arr.push(todo2)\n    t.equal(mobx.isObservable(a.arr), true)\n    t.equal(mobx.isObservableProp(a, \"arr\"), true)\n    t.equal(mobx.isObservable(a.arr[0]), false)\n    t.equal(mobx.isObservable(a.arr[1]), false)\n    t.equal(a.arr[1] === todo2, true)\n})\n\ntest(\"@observable.shallow - 2 (TS)\", () => {\n    class A {\n        @observable.shallow arr: Record<string, any> = { x: { todo: 1 } }\n        constructor() {\n            makeObservable(this)\n        }\n    }\n\n    const a = new A()\n    const todo2 = { todo: 2 }\n    a.arr.y = todo2\n    t.equal(mobx.isObservable(a.arr), true)\n    t.equal(mobx.isObservableProp(a, \"arr\"), true)\n    t.equal(mobx.isObservable(a.arr.x), false)\n    t.equal(mobx.isObservable(a.arr.y), false)\n    t.equal(a.arr.y === todo2, true)\n})\n\ntest(\"@observable.deep (TS)\", () => {\n    class A {\n        @observable.deep arr = [{ todo: 1 }]\n        constructor() {\n            makeObservable(this)\n        }\n    }\n\n    const a = new A()\n    const todo2 = { todo: 2 }\n    a.arr.push(todo2)\n\n    t.equal(mobx.isObservable(a.arr), true)\n    t.equal(mobx.isObservableProp(a, \"arr\"), true)\n    t.equal(mobx.isObservable(a.arr[0]), true)\n    t.equal(mobx.isObservable(a.arr[1]), true)\n    t.equal(a.arr[1] !== todo2, true)\n    t.equal(isObservable(todo2), false)\n})\n\ntest(\"action.bound binds (TS)\", () => {\n    class A {\n        @observable x = 0\n        @action.bound\n        inc(value: number) {\n            this.x += value\n        }\n        constructor() {\n            makeObservable(this)\n        }\n    }\n\n    const a = new A()\n    const runner = a.inc\n    runner(2)\n\n    t.equal(a.x, 2)\n})\n\ntest(\"@computed.equals (TS)\", () => {\n    const sameTime = (from: Time, to: Time) => from.hour === to.hour && from.minute === to.minute\n    class Time {\n        constructor(hour: number, minute: number) {\n            makeObservable(this)\n            this.hour = hour\n            this.minute = minute\n        }\n\n        @observable public hour: number\n        @observable public minute: number\n\n        @computed({ equals: sameTime })\n        public get time() {\n            return { hour: this.hour, minute: this.minute }\n        }\n    }\n    const time = new Time(9, 0)\n\n    const changes: Array<{ hour: number; minute: number }> = []\n    const disposeAutorun = autorun(() => changes.push(time.time))\n\n    t.deepEqual(changes, [{ hour: 9, minute: 0 }])\n    time.hour = 9\n    t.deepEqual(changes, [{ hour: 9, minute: 0 }])\n    time.minute = 0\n    t.deepEqual(changes, [{ hour: 9, minute: 0 }])\n    time.hour = 10\n    t.deepEqual(changes, [\n        { hour: 9, minute: 0 },\n        { hour: 10, minute: 0 }\n    ])\n    time.minute = 30\n    t.deepEqual(changes, [\n        { hour: 9, minute: 0 },\n        { hour: 10, minute: 0 },\n        { hour: 10, minute: 30 }\n    ])\n\n    disposeAutorun()\n})\n\ntest(\"1072 - @observable without initial value and observe before first access\", () => {\n    class User {\n        @observable loginCount?: number\n\n        constructor() {\n            makeObservable(this)\n        }\n    }\n\n    const user = new User()\n    observe(user, \"loginCount\", () => {})\n})\n\ntest(\"unobserved computed reads should warn with requiresReaction enabled\", () => {\n    const consoleWarn = console.warn\n    const warnings: string[] = []\n    console.warn = function (...args) {\n        warnings.push(...args)\n    }\n    try {\n        const expectedWarnings: string[] = []\n\n        class A {\n            @observable x = 0\n\n            @computed({ requiresReaction: true })\n            get y() {\n                return this.x * 2\n            }\n            constructor() {\n                makeObservable(this, undefined, { name: \"a\" })\n            }\n        }\n\n        const a = new A()\n\n        a.y\n        expectedWarnings.push(\n            `[mobx] Computed value 'a.y' is being read outside a reactive context. Doing a full recompute.`\n        )\n\n        const d = mobx.reaction(\n            () => a.y,\n            () => {}\n        )\n\n        a.y\n\n        d()\n\n        a.y\n        expectedWarnings.push(\n            `[mobx] Computed value 'a.y' is being read outside a reactive context. Doing a full recompute.`\n        )\n\n        expect(warnings).toEqual(expectedWarnings)\n    } finally {\n        console.warn = consoleWarn\n    }\n})\n\ntest(\"multiple inheritance should work\", () => {\n    class A {\n        @observable x = 1\n\n        constructor() {\n            makeObservable(this)\n        }\n    }\n\n    class B extends A {\n        @observable y = 1\n\n        constructor() {\n            super()\n            makeObservable(this)\n        }\n    }\n\n    expect(mobx.keys(new B())).toEqual([\"x\", \"y\"])\n})\n\n// 19.12.2020 @urugator:\n// All annotated non-observable fields are not writable.\n// All annotated fields of non-plain objects are non-configurable.\n// https://github.com/mobxjs/mobx/pull/2641\ntest.skip(\"actions are reassignable\", () => {\n    // See #1398 and #1545, make actions reassignable to support stubbing\n    class A {\n        @action\n        m1() {}\n        @action m2 = () => {}\n        @action.bound\n        m3() {}\n        @action.bound m4 = () => {}\n\n        constructor() {\n            makeObservable(this)\n        }\n    }\n\n    const a = new A()\n    expect(isAction(a.m1)).toBe(true)\n    expect(isAction(a.m2)).toBe(true)\n    expect(isAction(a.m3)).toBe(true)\n    expect(isAction(a.m4)).toBe(true)\n    a.m1 = () => {}\n    expect(isAction(a.m1)).toBe(false)\n    a.m2 = () => {}\n    expect(isAction(a.m2)).toBe(false)\n    a.m3 = () => {}\n    expect(isAction(a.m3)).toBe(false)\n    a.m4 = () => {}\n    expect(isAction(a.m4)).toBe(false)\n})\n\ntest(\"it should support asyncAction as decorator (ts)\", async () => {\n    mobx.configure({ enforceActions: \"observed\" })\n\n    class X {\n        @observable a = 1\n\n        f = mobx.flow(function* f(this: X, initial: number) {\n            this.a = initial // this runs in action\n            this.a += yield Promise.resolve(5) as any\n            this.a = this.a * 2\n            return this.a\n        })\n\n        constructor() {\n            makeObservable(this)\n        }\n    }\n\n    const x = new X()\n\n    expect(await x.f(3)).toBe(16)\n})\n\ntest(\"toJS bug #1413 (TS)\", () => {\n    class X {\n        @observable\n        test = {\n            test1: 1\n        }\n\n        constructor() {\n            makeObservable(this)\n        }\n    }\n\n    const x = new X()\n    const res = mobx.toJS(x.test) as any\n    expect(res).toEqual({ test1: 1 })\n    expect(res.__mobxDidRunLazyInitializers).toBe(undefined)\n})\n\ntest(\"#2159 - computed property keys\", () => {\n    const testSymbol = Symbol(\"test symbol\")\n    const testString = \"testString\"\n\n    class TestClass {\n        @observable [testSymbol] = \"original symbol value\";\n        @observable [testString] = \"original string value\"\n\n        constructor() {\n            makeObservable(this)\n        }\n    }\n\n    const o = new TestClass()\n\n    const events: any[] = []\n    observe(o, testSymbol, ev => events.push(ev.newValue, ev.oldValue))\n    observe(o, testString, ev => events.push(ev.newValue, ev.oldValue))\n\n    runInAction(() => {\n        o[testSymbol] = \"new symbol value\"\n        o[testString] = \"new string value\"\n    })\n\n    t.deepEqual(events, [\n        \"new symbol value\", // new symbol\n        \"original symbol value\", // original symbol\n        \"new string value\", // new string\n        \"original string value\" // original string\n    ])\n})\n"
  },
  {
    "path": "packages/mobx/__tests__/v5/base/typescript-tests.ts",
    "content": "\"use strict\"\n\nimport {\n    observe,\n    computed,\n    observable,\n    autorun,\n    extendObservable,\n    action,\n    IArrayDidChange,\n    IArrayWillChange,\n    IArrayWillSplice,\n    IMapWillChange,\n    ISetWillChange,\n    IObservableValue,\n    isObservable,\n    isObservableProp,\n    isObservableObject,\n    transaction,\n    IObjectDidChange,\n    spy,\n    configure,\n    isAction,\n    makeObservable,\n    IAtom,\n    createAtom,\n    runInAction,\n    flow,\n    IMapDidChange,\n    IValueDidChange,\n    ISetDidChange,\n    IValueWillChange,\n    flowResult,\n    IObjectWillChange\n} from \"../../../src/mobx\"\nimport * as mobx from \"../../../src/mobx\"\nimport { assert, IsExact } from \"conditional-type-checks\"\n\nconst v = observable.box(3)\nobserve(v, () => {})\n\nconst a = observable([1, 2, 3])\n\nconst testFunction = function (a: any) {}\n\n// lazy wrapper around yest\n\nconst t = {\n    equal(a: any, b: any) {\n        expect(a).toBe(b)\n    },\n    deepEqual(a: any, b: any) {\n        expect(a).toEqual(b)\n    },\n    notEqual(a: any, b: any) {\n        expect(a).not.toEqual(b)\n    },\n\n    throws(a: any, b: any) {\n        expect(a).toThrow(b)\n    }\n}\n\ntest(\"decorators\", () => {\n    class Order {\n        price: number = 3\n        amount: number = 2\n        orders: string[] = []\n        aFunction = testFunction\n\n        constructor() {\n            makeObservable(this, {\n                price: observable,\n                amount: observable,\n                orders: observable,\n                aFunction: observable,\n                total: computed\n            })\n        }\n\n        get total() {\n            return this.amount * this.price * (1 + this.orders.length)\n        }\n\n        // Typescript classes cannot be defined inside functions,\n        // but if the next line is enabled it should throw...\n        // @observable hoepie() { return 3; }\n    }\n\n    const o = new Order()\n    t.equal(isObservableObject(o), true)\n    t.equal(isObservableProp(o, \"amount\"), true)\n    t.equal(isObservableProp(o, \"total\"), true)\n\n    const events: any[] = []\n    const d1 = observe(o, (ev: IObjectDidChange) => events.push(ev.name, (ev as any).oldValue))\n    const d2 = observe(o, \"price\", ev => events.push(ev.newValue, ev.oldValue))\n    const d3 = observe(o, \"total\", ev => events.push(ev.newValue, ev.oldValue))\n\n    o.price = 4\n\n    d1()\n    d2()\n    d3()\n\n    o.price = 5\n\n    t.deepEqual(events, [\n        8, // new total\n        6, // old total\n        4, // new price\n        3, // old price\n        \"price\", // event name\n        3 // event oldValue\n    ])\n})\n\ntest(\"observable\", () => {\n    const a = observable.box(3)\n    const b = computed(() => a.get() * 2)\n    t.equal(b.get(), 6)\n})\n\ntest(\"annotations\", () => {\n    const fn0 = () => 0\n    class Order {\n        price: number = 3\n        amount: number = 2\n        orders: string[] = []\n        aFunction = fn0\n\n        constructor() {\n            makeObservable(this, {\n                price: observable,\n                amount: observable,\n                orders: observable,\n                aFunction: observable,\n                total: computed\n            })\n        }\n\n        get total() {\n            return this.amount * this.price * (1 + this.orders.length)\n        }\n    }\n\n    const order1totals: number[] = []\n    const order1 = new Order()\n    const order2 = new Order()\n\n    const disposer = autorun(() => {\n        order1totals.push(order1.total)\n    })\n\n    order2.price = 4\n    order1.amount = 1\n\n    t.equal(order1.price, 3)\n    t.equal(order1.total, 3)\n    t.equal(order2.total, 8)\n    order2.orders.push(\"bla\")\n    t.equal(order2.total, 16)\n\n    order1.orders.splice(0, 0, \"boe\", \"hoi\")\n    t.deepEqual(order1totals, [6, 3, 9])\n\n    disposer()\n    order1.orders.pop()\n    t.equal(order1.total, 6)\n    t.deepEqual(order1totals, [6, 3, 9])\n    expect(isAction(order1.aFunction)).toBe(true)\n    expect(order1.aFunction()).toBe(0)\n    order1.aFunction = () => 1\n    expect(isAction(order1.aFunction)).toBe(true)\n    expect(order1.aFunction()).toBe(1)\n})\n\ntest(\"scope\", () => {\n    const x = observable({\n        y: 3,\n        // this wo't work here.\n        get z() {\n            return 2 * this.y\n        }\n    })\n\n    t.equal(x.z, 6)\n    x.y = 4\n    t.equal(x.z, 8)\n\n    interface IThing {\n        z: number\n        y: number\n    }\n\n    const Thing = function (this: any) {\n        extendObservable(this, {\n            y: 3,\n            // this will work here\n            get z() {\n                return 2 * this.y\n            }\n        })\n    }\n\n    const x3: IThing = new (<any>Thing)()\n    t.equal(x3.z, 6)\n    x3.y = 4\n    t.equal(x3.z, 8)\n})\n\ntest(\"box\", () => {\n    class Box {\n        uninitialized: any\n        height = 20\n        sizes = [2]\n        someFunc = function () {\n            return 2\n        }\n\n        constructor() {\n            makeObservable(this, {\n                uninitialized: observable,\n                height: observable,\n                sizes: observable,\n                someFunc: observable,\n                width: computed,\n                addSize: action\n            })\n        }\n\n        get width() {\n            return this.height * this.sizes.length * this.someFunc() * (this.uninitialized ? 2 : 1)\n        }\n        addSize() {\n            this.sizes.push(3)\n            this.sizes.push(4)\n        }\n    }\n\n    const box = new Box()\n\n    const ar: number[] = []\n\n    autorun(() => {\n        ar.push(box.width)\n    })\n\n    t.deepEqual(ar.slice(), [40])\n    box.height = 10\n    t.deepEqual(ar.slice(), [40, 20])\n    box.sizes.push(3, 4)\n    t.deepEqual(ar.slice(), [40, 20, 60])\n    box.someFunc = () => 7\n    t.deepEqual(ar.slice(), [40, 20, 60, 210])\n    box.uninitialized = true\n    t.deepEqual(ar.slice(), [40, 20, 60, 210, 420])\n    box.addSize()\n    expect(ar.slice()).toEqual([40, 20, 60, 210, 420, 700])\n\n    const x: IObservableValue<number> = observable.box(3)\n})\n\ntest(\"computed setter should succeed\", () => {\n    class Bla {\n        a = 3\n\n        constructor() {\n            makeObservable(this, {\n                a: observable,\n                propX: computed\n            })\n        }\n\n        get propX() {\n            return this.a * 2\n        }\n        set propX(v) {\n            this.a = v\n        }\n    }\n\n    const b = new Bla()\n    t.equal(b.propX, 6)\n    b.propX = 4\n    t.equal(b.propX, 8)\n})\n\ntest(\"atom clock example\", done => {\n    // TODO randomly fails, rework\n    let ticks = 0\n    const time_factor = process.env.CI === \"true\" ? 300 : 100 // speed up / slow down tests\n\n    class Clock {\n        atom: IAtom\n        intervalHandler: NodeJS.Timeout | null = null\n        currentDateTime: string | undefined = undefined\n\n        constructor() {\n            // console.log(\"create\")\n            // creates an atom to interact with the mobx core algorithm\n            this.atom = mobx.createAtom(\n                // first param a name for this atom, for debugging purposes\n                \"Clock\",\n                // second (optional) parameter: callback for when this atom transitions from unobserved to observed.\n                () => this.startTicking(),\n                // third (optional) parameter: callback for when this atom transitions from observed to unobserved\n                // note that the same atom transition multiple times between these two states\n                () => this.stopTicking()\n            )\n        }\n\n        getTime() {\n            // console.log(\"get time\")\n            // let mobx now this observable data source has been used\n            this.atom.reportObserved() // will trigger startTicking and thus tick\n            return this.currentDateTime\n        }\n\n        tick() {\n            // console.log(\"tick\")\n            ticks++\n            this.currentDateTime = new Date().toString()\n            this.atom.reportChanged()\n        }\n\n        startTicking() {\n            // console.log(\"start ticking\")\n            this.tick()\n            // The cast to any here is to force TypeScript to select the correct\n            // overload of setInterval: the one that returns number, as opposed\n            // to the one defined in @types/node\n            this.intervalHandler = setInterval(() => this.tick(), (1 * time_factor) as any)\n        }\n\n        stopTicking() {\n            // console.log(\"stop ticking\")\n            clearInterval(this.intervalHandler!)\n            this.intervalHandler = null\n        }\n    }\n\n    const clock = new Clock()\n\n    const values: string[] = []\n\n    // ... prints the time each second\n    const disposer = autorun(() => {\n        values.push(clock.getTime()!)\n        // console.log(clock.getTime())\n    })\n\n    // printing stops. If nobody else uses the same `clock` the clock will stop ticking as well.\n    setTimeout(disposer, 4.5 * time_factor)\n\n    setTimeout(() => {\n        expect(ticks).toEqual(5)\n        expect(values.length).toEqual(5)\n        expect(values.filter(x => x.length > 0).length).toBe(5)\n        done()\n    }, 10 * time_factor)\n})\n\ntest(\"typescript: parameterized computed decorator\", () => {\n    class TestClass {\n        x = 3\n        y = 3\n\n        constructor() {\n            makeObservable(this, {\n                x: observable,\n                y: observable,\n                boxedSum: computed.struct\n            })\n        }\n\n        get boxedSum() {\n            return { sum: Math.round(this.x) + Math.round(this.y) }\n        }\n    }\n\n    const t1 = new TestClass()\n    const changes: { sum: number }[] = []\n    const d = autorun(() => changes.push(t1.boxedSum))\n\n    t1.y = 4 // change\n    t.equal(changes.length, 2)\n    t1.y = 4.2 // no change\n    t.equal(changes.length, 2)\n    transaction(() => {\n        t1.y = 3\n        t1.x = 4\n    }) // no change\n    t.equal(changes.length, 2)\n    t1.x = 6 // change\n    t.equal(changes.length, 3)\n    d()\n\n    t.deepEqual(changes, [{ sum: 6 }, { sum: 7 }, { sum: 9 }])\n})\n\ntest(\"issue 165\", () => {\n    function report<T>(msg: string, value: T) {\n        // console.log(msg, \":\", value)\n        return value\n    }\n\n    class Card {\n        constructor(public game: Game, public id: number) {\n            makeObservable(this, {\n                isWrong: computed,\n                isSelected: computed\n            })\n        }\n\n        get isWrong() {\n            return report(\n                \"Computing isWrong for card \" + this.id,\n                this.isSelected && this.game.isMatchWrong\n            )\n        }\n\n        get isSelected() {\n            return report(\n                \"Computing isSelected for card\" + this.id,\n                this.game.firstCardSelected === this || this.game.secondCardSelected === this\n            )\n        }\n    }\n\n    class Game {\n        firstCardSelected: Card | null = null\n        secondCardSelected: Card | null = null\n\n        constructor() {\n            makeObservable(this, {\n                firstCardSelected: observable,\n                secondCardSelected: observable,\n                isMatchWrong: computed\n            })\n        }\n\n        get isMatchWrong() {\n            return report(\n                \"Computing isMatchWrong\",\n                this.secondCardSelected !== null &&\n                    this.firstCardSelected!.id !== this.secondCardSelected.id\n            )\n        }\n    }\n\n    let game = new Game()\n    let card1 = new Card(game, 1),\n        card2 = new Card(game, 2)\n\n    autorun(() => {\n        card1.isWrong\n        card2.isWrong\n        // console.log(\"card1.isWrong =\", card1.isWrong)\n        // console.log(\"card2.isWrong =\", card2.isWrong)\n        // console.log(\"------------------------------\")\n    })\n\n    // console.log(\"Selecting first card\")\n    game.firstCardSelected = card1\n    // console.log(\"Selecting second card\")\n    game.secondCardSelected = card2\n\n    t.equal(card1.isWrong, true)\n    t.equal(card2.isWrong, true)\n})\n\ntest(\"issue 191 - shared initializers (ts)\", () => {\n    class Test {\n        obj = { a: 1 }\n        array = [2]\n\n        constructor() {\n            makeObservable(this, {\n                obj: observable,\n                array: observable\n            })\n        }\n    }\n\n    const t1 = new Test()\n    t1.obj.a = 2\n    t1.array.push(3)\n\n    const t2 = new Test()\n    t2.obj.a = 3\n    t2.array.push(4)\n\n    t.notEqual(t1.obj, t2.obj)\n    t.notEqual(t1.array, t2.array)\n    t.equal(t1.obj.a, 2)\n    t.equal(t2.obj.a, 3)\n\n    t.deepEqual(t1.array.slice(), [2, 3])\n    t.deepEqual(t2.array.slice(), [2, 4])\n})\n\nfunction normalizeSpyEvents(events: any[]) {\n    events.forEach(ev => {\n        delete ev.fn\n        delete ev.time\n    })\n    return events\n}\n\ntest(\"action decorator (typescript)\", () => {\n    class Store {\n        constructor(private multiplier: number) {\n            makeObservable(this, {\n                add: action\n            })\n        }\n\n        add(a: number, b: number): number {\n            return (a + b) * this.multiplier\n        }\n    }\n\n    const store1 = new Store(2)\n    const store2 = new Store(3)\n    const events: any[] = []\n    const d = spy(events.push.bind(events))\n    t.equal(store1.add(3, 4), 14)\n    t.equal(store2.add(2, 2), 12)\n    t.equal(store1.add(1, 1), 4)\n\n    t.deepEqual(normalizeSpyEvents(events), [\n        { arguments: [3, 4], name: \"add\", spyReportStart: true, object: store1, type: \"action\" },\n        { type: \"report-end\", spyReportEnd: true },\n        { arguments: [2, 2], name: \"add\", spyReportStart: true, object: store2, type: \"action\" },\n        { type: \"report-end\", spyReportEnd: true },\n        { arguments: [1, 1], name: \"add\", spyReportStart: true, object: store1, type: \"action\" },\n        { type: \"report-end\", spyReportEnd: true }\n    ])\n\n    d()\n})\n\ntest(\"custom action decorator (typescript)\", () => {\n    class Store {\n        constructor(private multiplier: number) {\n            makeObservable(this, {\n                add: action(\"zoem zoem\")\n            })\n        }\n\n        add(a: number, b: number): number {\n            return (a + b) * this.multiplier\n        }\n    }\n\n    const store1 = new Store(2)\n    const store2 = new Store(3)\n    const events: any[] = []\n    const d = spy(events.push.bind(events))\n    t.equal(store1.add(3, 4), 14)\n    t.equal(store2.add(2, 2), 12)\n    t.equal(store1.add(1, 1), 4)\n\n    t.deepEqual(normalizeSpyEvents(events), [\n        {\n            arguments: [3, 4],\n            name: \"zoem zoem\",\n            spyReportStart: true,\n            object: store1,\n            type: \"action\"\n        },\n        { type: \"report-end\", spyReportEnd: true },\n        {\n            arguments: [2, 2],\n            name: \"zoem zoem\",\n            spyReportStart: true,\n            object: store2,\n            type: \"action\"\n        },\n        { type: \"report-end\", spyReportEnd: true },\n        {\n            arguments: [1, 1],\n            name: \"zoem zoem\",\n            spyReportStart: true,\n            object: store1,\n            type: \"action\"\n        },\n        { type: \"report-end\", spyReportEnd: true }\n    ])\n\n    d()\n})\n\ntest(\"action decorator on field (typescript)\", () => {\n    class Store {\n        constructor(private multiplier: number) {\n            makeObservable(this, {\n                add: action\n            })\n        }\n\n        add = (a: number, b: number) => {\n            return (a + b) * this.multiplier\n        }\n    }\n\n    const store1 = new Store(2)\n    const store2 = new Store(7)\n    expect(store1.add).not.toEqual(store2.add)\n\n    const events: any[] = []\n    const d = spy(events.push.bind(events))\n    t.equal(store1.add(3, 4), 14)\n    t.equal(store2.add(4, 5), 63)\n    t.equal(store1.add(2, 2), 8)\n\n    t.deepEqual(normalizeSpyEvents(events), [\n        { arguments: [3, 4], name: \"add\", spyReportStart: true, object: store1, type: \"action\" },\n        { type: \"report-end\", spyReportEnd: true },\n        { arguments: [4, 5], name: \"add\", spyReportStart: true, object: store2, type: \"action\" },\n        { type: \"report-end\", spyReportEnd: true },\n        { arguments: [2, 2], name: \"add\", spyReportStart: true, object: store1, type: \"action\" },\n        { type: \"report-end\", spyReportEnd: true }\n    ])\n\n    d()\n})\n\ntest(\"custom action decorator on field (typescript)\", () => {\n    class Store {\n        constructor(private multiplier: number) {\n            makeObservable(this, {\n                add: action(\"zoem zoem\")\n            })\n        }\n\n        add = (a: number, b: number) => {\n            return (a + b) * this.multiplier\n        }\n    }\n\n    const store1 = new Store(2)\n    const store2 = new Store(7)\n\n    const events: any[] = []\n    const d = spy(events.push.bind(events))\n    t.equal(store1.add(3, 4), 14)\n    t.equal(store2.add(4, 5), 63)\n    t.equal(store1.add(2, 2), 8)\n\n    t.deepEqual(normalizeSpyEvents(events), [\n        {\n            arguments: [3, 4],\n            name: \"zoem zoem\",\n            spyReportStart: true,\n            object: store1,\n            type: \"action\"\n        },\n        { type: \"report-end\", spyReportEnd: true },\n        {\n            arguments: [4, 5],\n            name: \"zoem zoem\",\n            spyReportStart: true,\n            object: store2,\n            type: \"action\"\n        },\n        { type: \"report-end\", spyReportEnd: true },\n        {\n            arguments: [2, 2],\n            name: \"zoem zoem\",\n            spyReportStart: true,\n            object: store1,\n            type: \"action\"\n        },\n        { type: \"report-end\", spyReportEnd: true }\n    ])\n\n    d()\n})\n\ntest(\"267 (typescript) should be possible to declare properties observable outside strict mode\", () => {\n    configure({ enforceActions: \"observed\" })\n\n    class Store {\n        timer: number | null = null\n\n        constructor() {\n            makeObservable(this, {\n                timer: observable\n            })\n        }\n    }\n\n    configure({ enforceActions: \"never\" })\n})\n\ntest(\"288 atom not detected for object property\", () => {\n    class Store {\n        foo = \"\"\n\n        constructor() {\n            makeObservable(this, {\n                foo: observable\n            })\n        }\n    }\n\n    const store = new Store()\n\n    mobx.observe(\n        store,\n        \"foo\",\n        () => {\n            // console.log(\"Change observed\")\n        },\n        true\n    )\n})\n\ntest.skip(\"observable performance - ts\", () => {\n    const AMOUNT = 100000\n\n    class A {\n        a = 1\n        b = 2\n        c = 3\n\n        constructor() {\n            makeObservable(this, {\n                a: observable,\n                b: observable,\n                c: observable,\n                d: computed\n            })\n        }\n\n        get d() {\n            return this.a + this.b + this.c\n        }\n    }\n\n    const objs: any[] = []\n    const start = Date.now()\n\n    for (let i = 0; i < AMOUNT; i++) objs.push(new A())\n\n    console.log(\"created in \", Date.now() - start)\n\n    for (let j = 0; j < 4; j++) {\n        for (let i = 0; i < AMOUNT; i++) {\n            const obj = objs[i]\n            obj.a += 3\n            obj.b *= 4\n            obj.c = obj.b - obj.a\n            obj.d\n        }\n    }\n\n    console.log(\"changed in \", Date.now() - start)\n})\n\ntest.skip(\"observable performance - ts - decorators\", () => {\n    const AMOUNT = 100000\n\n    class A {\n        @observable\n        a = 1\n        @observable\n        b = 2\n        @observable\n        c = 3\n\n        constructor() {\n            makeObservable(this)\n        }\n\n        @computed\n        get d() {\n            return this.a + this.b + this.c\n        }\n    }\n\n    const objs: any[] = []\n    const start = Date.now()\n\n    for (let i = 0; i < AMOUNT; i++) objs.push(new A())\n\n    console.log(\"created in \", Date.now() - start)\n\n    for (let j = 0; j < 4; j++) {\n        for (let i = 0; i < AMOUNT; i++) {\n            const obj = objs[i]\n            obj.a += 3\n            obj.b *= 4\n            obj.c = obj.b - obj.a\n            obj.d\n        }\n    }\n\n    console.log(\"changed in \", Date.now() - start)\n})\n\ntest(\"unbound methods\", () => {\n    class A {\n        constructor() {\n            makeObservable(this, {\n                m1: action,\n                m2: action\n            })\n        }\n\n        // shared across all instances\n        m1() {}\n\n        // per instance\n        m2 = () => {}\n    }\n\n    const a1 = new A()\n    const a2 = new A()\n\n    t.equal(a1.m1, a2.m1)\n    t.notEqual(a1.m2, a2.m2)\n    // eslint-disable-next-line\n    t.equal(a1.hasOwnProperty(\"m1\"), false)\n    // eslint-disable-next-line\n    t.equal(a1.hasOwnProperty(\"m2\"), true)\n    // eslint-disable-next-line\n    t.equal(a2.hasOwnProperty(\"m1\"), false)\n    // eslint-disable-next-line\n    t.equal(a2.hasOwnProperty(\"m2\"), true)\n})\n\ntest(\"inheritance\", () => {\n    class A {\n        a = 2\n\n        constructor() {\n            makeObservable(this, {\n                a: observable\n            })\n        }\n    }\n\n    class B extends A {\n        b = 3\n\n        constructor() {\n            super()\n\n            makeObservable(this, {\n                b: observable,\n                c: computed\n            })\n        }\n\n        get c() {\n            return this.a + this.b\n        }\n    }\n    const b1 = new B()\n    const b2 = new B()\n    const values: any[] = []\n    mobx.autorun(() => values.push(b1.c + b2.c))\n\n    b1.a = 3\n    b1.b = 4\n    b2.b = 5\n    b2.a = 6\n\n    t.deepEqual(values, [10, 11, 12, 14, 18])\n})\n\ntest(\"inheritance overrides observable\", () => {\n    class A {\n        a = 2\n\n        constructor() {\n            makeObservable(this, {\n                a: observable\n            })\n        }\n    }\n\n    class B {\n        a = 5\n        b = 3\n\n        constructor() {\n            makeObservable(this, {\n                a: observable,\n                b: observable,\n                c: computed\n            })\n        }\n\n        get c() {\n            return this.a + this.b\n        }\n    }\n\n    const b1 = new B()\n    const b2 = new B()\n    const values: any[] = []\n    mobx.autorun(() => values.push(b1.c + b2.c))\n\n    b1.a = 3\n    b1.b = 4\n    b2.b = 5\n    b2.a = 6\n\n    t.deepEqual(values, [16, 14, 15, 17, 18])\n})\n\ntest(\"reusing initializers\", () => {\n    class A {\n        a = 3\n        b = this.a + 2\n\n        constructor() {\n            makeObservable(this, {\n                a: observable,\n                b: observable,\n                c: computed,\n                d: computed\n            })\n        }\n\n        get c() {\n            return this.a + this.b\n        }\n        get d() {\n            return this.c + 1\n        }\n    }\n\n    const a = new A()\n    const values: any[] = []\n    mobx.autorun(() => values.push(a.d))\n\n    a.a = 4\n    t.deepEqual(values, [9, 10])\n})\n\ntest(\"enumerability\", () => {\n    class A {\n        a = 1 // enumerable, on proto\n\n        constructor() {\n            makeObservable(this, {\n                a: observable,\n                b: computed,\n                m: action,\n                m2: action\n            })\n        }\n\n        get b() {\n            return this.a\n        } // non-enumerable, (and, ideally, on proto)\n        m() {} // non-enumerable, on proto\n        m2 = () => {} // non-enumerable, on self\n    }\n\n    const a = new A()\n\n    // not initialized yet\n    let ownProps = Object.keys(a)\n    let props: string[] = []\n    for (const key in a) props.push(key)\n\n    t.deepEqual(ownProps, [\n        \"a\" // yeej!\n    ])\n\n    t.deepEqual(props, [\n        // also 'a' would be ok\n        \"a\"\n    ])\n\n    t.equal(\"a\" in a, true)\n    // eslint-disable-next-line\n    t.equal(a.hasOwnProperty(\"a\"), true)\n    // eslint-disable-next-line\n    t.equal(a.hasOwnProperty(\"b\"), true) // false would be slightly better, true also ok-ish, and, see #1777\n    // eslint-disable-next-line\n    t.equal(a.hasOwnProperty(\"m\"), false)\n    // eslint-disable-next-line\n    t.equal(a.hasOwnProperty(\"m2\"), true)\n\n    t.equal(mobx.isAction(a.m), true)\n    t.equal(mobx.isAction(a.m2), true)\n\n    // after initialization\n    a.a\n    a.b\n    a.m\n    a.m2\n\n    ownProps = Object.keys(a)\n    props = []\n    for (const key in a) props.push(key)\n\n    t.deepEqual(ownProps, [\"a\"])\n\n    t.deepEqual(props, [\"a\"])\n\n    t.equal(\"a\" in a, true)\n    // eslint-disable-next-line\n    t.equal(a.hasOwnProperty(\"a\"), true)\n    // eslint-disable-next-line\n    t.equal(a.hasOwnProperty(\"b\"), true) // false would be slightly better, true also ok-ish, and, see #1777\n    // eslint-disable-next-line\n    t.equal(a.hasOwnProperty(\"m\"), false)\n    // eslint-disable-next-line\n    t.equal(a.hasOwnProperty(\"m2\"), true)\n})\n\ntest(\"issue 285 (typescript)\", () => {\n    const { observable, toJS } = mobx\n\n    class Todo {\n        id = 1\n        title: string\n        finished = false\n        childThings = [1, 2, 3]\n        constructor(title: string) {\n            makeObservable(this, {\n                title: observable,\n                finished: observable,\n                childThings: observable\n            })\n\n            this.title = title\n        }\n    }\n\n    const todo = new Todo(\"Something to do\")\n\n    t.deepEqual(toJS(todo), {\n        id: 1,\n        title: \"Something to do\",\n        finished: false,\n        childThings: [1, 2, 3]\n    })\n})\n\ntest(\"verify object assign (typescript)\", () => {\n    class Todo {\n        title = \"test\"\n\n        constructor() {\n            makeObservable(this, {\n                title: observable,\n                upperCase: computed\n            })\n        }\n\n        get upperCase() {\n            return this.title.toUpperCase()\n        }\n    }\n\n    t.deepEqual((Object as any).assign({}, new Todo()), {\n        title: \"test\"\n    })\n})\n\ntest(\"379, inheritable actions (typescript)\", () => {\n    class A {\n        constructor() {\n            makeObservable(this, {\n                method: action\n            })\n        }\n\n        method() {\n            return 42\n        }\n    }\n\n    class B extends A {\n        method() {\n            return super.method() * 2\n        }\n    }\n\n    class C extends B {\n        method() {\n            return super.method() + 3\n        }\n    }\n\n    const b = new B()\n    t.equal(b.method(), 84)\n    t.equal(isAction(b.method), true)\n\n    const a = new A()\n    t.equal(a.method(), 42)\n    t.equal(isAction(a.method), true)\n\n    const c = new C()\n    t.equal(c.method(), 87)\n    t.equal(isAction(c.method), true)\n})\n\ntest(\"373 - fix isObservable for unused computed\", () => {\n    class Bla {\n        get computedVal() {\n            return 3\n        }\n        constructor() {\n            makeObservable(this, {\n                computedVal: computed\n            })\n\n            t.equal(isObservableProp(this, \"computedVal\"), true)\n            this.computedVal\n            t.equal(isObservableProp(this, \"computedVal\"), true)\n        }\n    }\n\n    new Bla()\n})\n\ntest(\"505, don't throw when accessing subclass fields in super constructor (typescript)\", () => {\n    const values: any = {}\n    class A {\n        a = 1\n        constructor() {\n            makeObservable(this, {\n                a: observable\n            })\n\n            values.b = (this as any)[\"b\"]\n            values.a = this.a\n        }\n    }\n\n    class B extends A {\n        b = 2\n\n        constructor() {\n            super()\n\n            makeObservable(this, {\n                b: observable\n            })\n        }\n    }\n\n    new B()\n    t.deepEqual(values, { a: 1, b: undefined }) // undefined, as A constructor runs before B constructor\n})\n\ntest(\"computed getter / setter for plan objects should succeed (typescript)\", () => {\n    const b = observable({\n        a: 3,\n        get propX() {\n            return this.a * 2\n        },\n        set propX(v) {\n            this.a = v\n        }\n    })\n\n    const values: number[] = []\n    mobx.autorun(() => values.push(b.propX))\n    t.equal(b.propX, 6)\n    b.propX = 4\n    t.equal(b.propX, 8)\n\n    t.deepEqual(values, [6, 8])\n})\n\ntest(\"484 - observable objects are still type T\", () => {\n    const o = observable({ stuff: \"things\" })\n    o.stuff = \"new things\"\n})\n\ntest(\"484 - isObservableObject type guard includes type T\", () => {\n    const o = observable({ stuff: \"things\" })\n    if (isObservableObject(o)) {\n        o.stuff = \"new things\"\n    } else {\n        throw \"failure\"\n    }\n})\n\ntest(\"705 - setter undoing caching (typescript)\", () => {\n    let recomputes = 0\n    let autoruns = 0\n\n    class Person {\n        name: string = \"\"\n        title: string = \"\"\n\n        constructor() {\n            makeObservable(this, {\n                name: observable,\n                title: observable,\n                fullName: computed\n            })\n        }\n\n        // Typescript bug: if fullName is before the getter, the property is defined twice / incorrectly, see #705\n        // set fullName(val) {\n        // \t// Noop\n        // }\n        get fullName() {\n            recomputes++\n            return this.title + \" \" + this.name\n        }\n        // Should also be possible to define the setter _before_ the fullname\n        set fullName(val) {\n            // Noop\n        }\n    }\n\n    let p1 = new Person()\n    p1.name = \"Tom Tank\"\n    p1.title = \"Mr.\"\n\n    t.equal(recomputes, 0)\n    t.equal(autoruns, 0)\n\n    const d1 = autorun(() => {\n        autoruns++\n        p1.fullName\n    })\n\n    const d2 = autorun(() => {\n        autoruns++\n        p1.fullName\n    })\n\n    t.equal(recomputes, 1)\n    t.equal(autoruns, 2)\n\n    p1.title = \"Master\"\n    t.equal(recomputes, 2)\n    t.equal(autoruns, 4)\n\n    d1()\n    d2()\n})\n\ntest(\"@observable.ref (TS)\", () => {\n    class A {\n        ref = { a: 3 }\n\n        constructor() {\n            makeObservable(this, {\n                ref: observable.ref\n            })\n        }\n    }\n\n    const a = new A()\n    t.equal(a.ref.a, 3)\n    t.equal(mobx.isObservable(a.ref), false)\n    t.equal(mobx.isObservableProp(a, \"ref\"), true)\n})\n\ntest(\"@observable.shallow (TS)\", () => {\n    class A {\n        arr = [{ todo: 1 }]\n\n        constructor() {\n            makeObservable(this, {\n                arr: observable.shallow\n            })\n        }\n    }\n\n    const a = new A()\n    const todo2 = { todo: 2 }\n    a.arr.push(todo2)\n    t.equal(mobx.isObservable(a.arr), true)\n    t.equal(mobx.isObservableProp(a, \"arr\"), true)\n    t.equal(mobx.isObservable(a.arr[0]), false)\n    t.equal(mobx.isObservable(a.arr[1]), false)\n    t.equal(a.arr[1] === todo2, true)\n})\n\ntest(\"@observable.deep (TS)\", () => {\n    class A {\n        arr = [{ todo: 1 }]\n\n        constructor() {\n            makeObservable(this, {\n                arr: observable.deep\n            })\n        }\n    }\n\n    const a = new A()\n    const todo2 = { todo: 2 }\n    a.arr.push(todo2)\n\n    t.equal(mobx.isObservable(a.arr), true)\n    t.equal(mobx.isObservableProp(a, \"arr\"), true)\n    t.equal(mobx.isObservable(a.arr[0]), true)\n    t.equal(mobx.isObservable(a.arr[1]), true)\n    t.equal(a.arr[1] !== todo2, true)\n    t.equal(isObservable(todo2), false)\n})\n\ntest(\"action.bound binds (TS)\", () => {\n    class A {\n        x = 0\n\n        constructor() {\n            makeObservable(this, {\n                x: observable,\n                inc: action.bound\n            })\n        }\n\n        inc(value: number) {\n            this.x += value\n        }\n    }\n\n    const a = new A()\n    const runner = a.inc\n    runner(2)\n\n    t.equal(a.x, 2)\n})\n\ntest(\"803 - action.bound and action preserve type info\", () => {\n    function thingThatAcceptsCallback(cb: (elem: { x: boolean }) => void) {}\n\n    thingThatAcceptsCallback(elem => {\n        // console.log(elem.x) // x is boolean\n    })\n\n    thingThatAcceptsCallback(\n        action((elem: any) => {\n            // ideally, type of action would be inferred!\n            console.log(elem.x) // x is boolean\n        })\n    )\n\n    const bound = action(() => {\n        return { x: \"3\" } as Object\n    }) as () => void\n\n    const bound2 = action(function () {}) as () => void\n})\n\ntest(\"@computed.equals (TS)\", () => {\n    const sameTime = (from: Time, to: Time) => from.hour === to.hour && from.minute === to.minute\n    class Time {\n        constructor(hour: number, minute: number) {\n            makeObservable(this, {\n                hour: observable,\n                minute: observable,\n                time: computed({ equals: sameTime })\n            })\n\n            this.hour = hour\n            this.minute = minute\n        }\n\n        public hour: number\n        public minute: number\n\n        public get time() {\n            return { hour: this.hour, minute: this.minute }\n        }\n    }\n    const time = new Time(9, 0)\n\n    const changes: Array<{ hour: number; minute: number }> = []\n    const disposeAutorun = autorun(() => changes.push(time.time))\n\n    t.deepEqual(changes, [{ hour: 9, minute: 0 }])\n    time.hour = 9\n    t.deepEqual(changes, [{ hour: 9, minute: 0 }])\n    time.minute = 0\n    t.deepEqual(changes, [{ hour: 9, minute: 0 }])\n    time.hour = 10\n    t.deepEqual(changes, [\n        { hour: 9, minute: 0 },\n        { hour: 10, minute: 0 }\n    ])\n    time.minute = 30\n    t.deepEqual(changes, [\n        { hour: 9, minute: 0 },\n        { hour: 10, minute: 0 },\n        { hour: 10, minute: 30 }\n    ])\n\n    disposeAutorun()\n})\n\ntest(\"computed comparer works with decorate (TS)\", () => {\n    const sameTime = (from: Time, to: Time) => from.hour === to.hour && from.minute === to.minute\n    class Time {\n        constructor(public hour: number, public minute: number) {\n            makeObservable(this, {\n                hour: observable,\n                minute: observable,\n                time: computed({ equals: sameTime })\n            })\n        }\n\n        get time() {\n            return { hour: this.hour, minute: this.minute }\n        }\n    }\n    const time = new Time(9, 0)\n\n    const changes: Array<{ hour: number; minute: number }> = []\n    const disposeAutorun = autorun(() => changes.push((time as any).time))\n\n    t.deepEqual(changes, [{ hour: 9, minute: 0 }])\n    time.hour = 9\n    t.deepEqual(changes, [{ hour: 9, minute: 0 }])\n    time.minute = 0\n    t.deepEqual(changes, [{ hour: 9, minute: 0 }])\n    time.hour = 10\n    t.deepEqual(changes, [\n        { hour: 9, minute: 0 },\n        { hour: 10, minute: 0 }\n    ])\n    time.minute = 30\n    t.deepEqual(changes, [\n        { hour: 9, minute: 0 },\n        { hour: 10, minute: 0 },\n        { hour: 10, minute: 30 }\n    ])\n\n    disposeAutorun()\n})\n\ntest(\"computed comparer works with decorate (TS)\", () => {\n    const sameTime = (from: Time, to: Time) => from.hour === to.hour && from.minute === to.minute\n    class Time {\n        constructor(public hour: number, public minute: number) {\n            makeObservable(this, {\n                hour: observable,\n                minute: observable,\n                time: computed({ equals: sameTime })\n            })\n        }\n\n        get time() {\n            return { hour: this.hour, minute: this.minute }\n        }\n    }\n    const time = new Time(9, 0)\n\n    const changes: Array<{ hour: number; minute: number }> = []\n    const disposeAutorun = autorun(() => changes.push((time as any).time))\n\n    t.deepEqual(changes, [{ hour: 9, minute: 0 }])\n    time.hour = 9\n    t.deepEqual(changes, [{ hour: 9, minute: 0 }])\n    time.minute = 0\n    t.deepEqual(changes, [{ hour: 9, minute: 0 }])\n    time.hour = 10\n    t.deepEqual(changes, [\n        { hour: 9, minute: 0 },\n        { hour: 10, minute: 0 }\n    ])\n    time.minute = 30\n    t.deepEqual(changes, [\n        { hour: 9, minute: 0 },\n        { hour: 10, minute: 0 },\n        { hour: 10, minute: 30 }\n    ])\n\n    disposeAutorun()\n})\n\ntest(\"computed comparer works with decorate (TS) - 2\", () => {\n    const sameTime = (from: Time, to: Time) => from.hour === to.hour && from.minute === to.minute\n    class Time {\n        hour!: number\n        minute!: number\n        readonly time!: number\n\n        constructor(hour: number, minute: number) {\n            extendObservable(\n                this,\n                {\n                    hour,\n                    minute,\n                    get time() {\n                        return { hour: this.hour, minute: this.minute }\n                    }\n                },\n                {\n                    time: computed({ equals: sameTime })\n                }\n            )\n        }\n    }\n    const time = new Time(9, 0)\n\n    const changes: Array<{ hour: number; minute: number }> = []\n    const disposeAutorun = autorun(() => changes.push((time as any).time))\n\n    t.deepEqual(changes, [{ hour: 9, minute: 0 }])\n    time.hour = 9\n    t.deepEqual(changes, [{ hour: 9, minute: 0 }])\n    time.minute = 0\n    t.deepEqual(changes, [{ hour: 9, minute: 0 }])\n    time.hour = 10\n    t.deepEqual(changes, [\n        { hour: 9, minute: 0 },\n        { hour: 10, minute: 0 }\n    ])\n    time.minute = 30\n    t.deepEqual(changes, [\n        { hour: 9, minute: 0 },\n        { hour: 10, minute: 0 },\n        { hour: 10, minute: 30 }\n    ])\n\n    disposeAutorun()\n})\n\ntest(\"computed comparer works with decorate (TS) - 3\", () => {\n    const sameTime = (from: any, to: any) => from.hour === to.hour && from.minute === to.minute\n    const time = observable.object(\n        {\n            hour: 9,\n            minute: 0,\n            get time() {\n                return { hour: this.hour, minute: this.minute }\n            }\n        },\n        {\n            time: computed({ equals: sameTime })\n        }\n    )\n\n    const changes: Array<{ hour: number; minute: number }> = []\n    const disposeAutorun = autorun(() => changes.push((time as any).time))\n\n    t.deepEqual(changes, [{ hour: 9, minute: 0 }])\n    time.hour = 9\n    t.deepEqual(changes, [{ hour: 9, minute: 0 }])\n    time.minute = 0\n    t.deepEqual(changes, [{ hour: 9, minute: 0 }])\n    time.hour = 10\n    t.deepEqual(changes, [\n        { hour: 9, minute: 0 },\n        { hour: 10, minute: 0 }\n    ])\n    time.minute = 30\n    t.deepEqual(changes, [\n        { hour: 9, minute: 0 },\n        { hour: 10, minute: 0 },\n        { hour: 10, minute: 30 }\n    ])\n\n    disposeAutorun()\n})\n\ntest(\"1072 - @observable without initial value and observe before first access\", () => {\n    class User {\n        loginCount?: number\n\n        constructor() {\n            makeObservable(this, {\n                loginCount: observable\n            })\n        }\n    }\n\n    const user = new User()\n    observe(user, \"loginCount\", () => {})\n})\n\ntest(\"typescript - decorate works with classes\", () => {\n    class Box {\n        height: number = 2\n\n        constructor() {\n            makeObservable(this, {\n                height: observable\n                // size: observable // MWE: enabling this should give type error!\n            })\n        }\n    }\n\n    const b = new Box()\n    expect(b.height).toBe(2)\n    expect(mobx.isObservableProp(b, \"height\")).toBe(true)\n})\n\ntest(\"typescript - decorate works with objects\", () => {\n    const b = observable(\n        {\n            height: 2\n        },\n        {\n            height: observable\n            // size: observable // MWE: enabling this should give type error!\n        }\n    )\n    expect(mobx.isObservableProp(b, \"height\")).toBe(true)\n    expect(b.height).toBe(2)\n})\n\ntest(\"typescript - decorate works with Object.create\", () => {\n    const Box = {\n        height: 2\n    }\n\n    makeObservable(Box, {\n        height: observable\n        // size: observable // MWE: enabling this should give type error!\n    })\n\n    const b = Object.create(Box)\n    expect(mobx.isObservableProp(b, \"height\")).toBe(true)\n    expect(b.height).toBe(2)\n})\n\ntest(\"issue #1122\", done => {\n    class ClassA {\n        _atom = createAtom(\n            \"Testing atom\",\n            () => {\n                // console.log(\"Value getting observed.\")\n            },\n            () => {\n                // console.log(\"Value getting unobserved.\")\n                runInAction(() => {}) // <-- INFINITE RECURSION\n            }\n        )\n        get value() {\n            this._atom.reportObserved()\n            return true\n        }\n    }\n\n    const a = new ClassA()\n    const unobserve = autorun(() => {\n        // console.log(a.value)\n    })\n\n    setTimeout(() => {\n        unobserve()\n        done()\n    }, 100)\n})\n\ntest(\"unobserved computed reads should warn with requiresReaction enabled\", () => {\n    const consoleWarn = console.warn\n    const warnings: string[] = []\n    console.warn = function (...args) {\n        warnings.push(...args)\n    }\n    try {\n        const expectedWarnings: string[] = []\n\n        class A {\n            x = 0\n            get y() {\n                return this.x * 2\n            }\n            constructor() {\n                makeObservable(\n                    this,\n                    {\n                        x: observable,\n                        y: computed({ requiresReaction: true })\n                    },\n                    { name: \"a\" }\n                )\n            }\n        }\n\n        const a = new A()\n\n        a.y\n        expectedWarnings.push(\n            `[mobx] Computed value 'a.y' is being read outside a reactive context. Doing a full recompute.`\n        )\n\n        const d = mobx.reaction(\n            () => a.y,\n            () => {}\n        )\n\n        a.y\n\n        d()\n\n        a.y\n        expectedWarnings.push(\n            `[mobx] Computed value 'a.y' is being read outside a reactive context. Doing a full recompute.`\n        )\n\n        expect(warnings).toEqual(expectedWarnings)\n    } finally {\n        console.warn = consoleWarn\n    }\n})\n\ntest(\"multiple inheritance should work\", () => {\n    class A {\n        x = 1\n\n        constructor() {\n            makeObservable(this, {\n                x: observable\n            })\n        }\n    }\n\n    class B extends A {\n        y = 1\n\n        constructor() {\n            super()\n\n            makeObservable(this, {\n                y: observable\n            })\n        }\n    }\n\n    expect(mobx.keys(new B())).toEqual([\"x\", \"y\"])\n})\n\n// 19.12.2020 @urugator:\n// All annotated non-observable fields are not writable.\n// All annotated fields of non-plain objects are non-configurable.\n// https://github.com/mobxjs/mobx/pull/2641\ntest.skip(\"actions are reassignable\", () => {\n    // See #1398 and #1545, make actions reassignable to support stubbing\n    class A {\n        constructor() {\n            makeObservable(this, {\n                m1: action,\n                m2: action,\n                m3: action.bound,\n                m4: action.bound\n            })\n        }\n\n        m1() {}\n        m2 = () => {}\n        m3() {}\n        m4 = () => {}\n    }\n\n    const a = new A()\n    expect(isAction(a.m1)).toBe(true)\n    expect(isAction(a.m2)).toBe(true)\n    expect(isAction(a.m3)).toBe(true)\n    expect(isAction(a.m4)).toBe(true)\n    a.m1 = () => {}\n    expect(isAction(a.m1)).toBe(false)\n    a.m2 = () => {}\n    expect(isAction(a.m2)).toBe(false)\n    a.m3 = () => {}\n    expect(isAction(a.m3)).toBe(false)\n    a.m4 = () => {}\n    expect(isAction(a.m4)).toBe(false)\n})\n\ntest(\"map should structurally match ES6 Map\", () => {\n    // Including this line strictly for type checking.\n    const m: Map<string, number> = mobx.observable.map({ a: 1, b: 2 })\n    expect(true).toBe(true)\n})\n\ntest(\"single arg when returns a promise\", async () => {\n    const x = mobx.observable.box(1)\n\n    setTimeout(() => x.set(3), 200)\n    await mobx.when(() => x.get() === 3)\n})\n\ntest(\"single arg when returns a can timeout\", async () => {\n    const x = mobx.observable.box(1)\n\n    setTimeout(() => x.set(3), 200)\n    try {\n        await mobx.when(() => x.get() === 3, { timeout: 100 })\n        fail(\"should timeout\")\n    } catch (e) {\n        expect(\"\" + e).toMatch(/WHEN_TIMEOUT/)\n    }\n})\n\ntest(\"promised when can be cancelled\", async () => {\n    const x = mobx.observable.box(1)\n\n    try {\n        const p = mobx.when(() => x.get() === 3)\n        setTimeout(() => p.cancel(), 100)\n        await p\n        fail(\"should cancel\")\n    } catch (e) {\n        expect(\"\" + e).toMatch(/WHEN_CANCELLED/)\n    }\n})\n\ntest(\"promised when can be aborted\", async () => {\n    const x = mobx.observable.box(1)\n\n    try {\n        const ac = new AbortController()\n        const p = mobx.when(() => x.get() === 3, { signal: ac.signal })\n        setTimeout(() => ac.abort(), 100)\n        await p\n        fail(\"should abort\")\n    } catch (e) {\n        expect(\"\" + e).toMatch(/WHEN_ABORTED/)\n    }\n})\n\ntest(\"sync when can be aborted\", async () => {\n    const x = mobx.observable.box(1)\n\n    const ac = new AbortController()\n    mobx.when(\n        () => x.get() === 3,\n        () => {\n            fail(\"should abort\")\n        },\n        { signal: ac.signal }\n    )\n    ac.abort()\n\n    x.set(3)\n})\n\ntest(\"it should support asyncAction as decorator (ts)\", async () => {\n    mobx.configure({ enforceActions: \"observed\" })\n\n    class X {\n        a = 1\n\n        f = mobx.flow(function* f(this: X, initial: number) {\n            this.a = initial // this runs in action\n            this.a += yield Promise.resolve(5) as any\n            this.a = this.a * 2\n            return this.a\n        })\n\n        constructor() {\n            makeObservable(this, {\n                a: observable\n            })\n        }\n    }\n\n    const x = new X()\n\n    expect(await x.f(3)).toBe(16)\n})\n\ntest(\"flow support async generators\", async () => {\n    if (!(Symbol as any).asyncIterator) {\n        ;(Symbol as any).asyncIterator = Symbol.for(\"Symbol.asyncIterator\")\n    }\n\n    async function* someNumbers() {\n        await Promise.resolve()\n        yield 1\n        await Promise.resolve()\n        yield 2\n        await Promise.resolve()\n        yield 3\n    }\n\n    const start = mobx.flow(async function* () {\n        let total = 0\n        for await (const number of someNumbers()) {\n            total += number\n        }\n        return total\n    })\n\n    const p = start()\n    const res = await p\n    expect(res).toBe(6)\n})\n\ntest(\"flow support throwing async generators\", async () => {\n    if (!(Symbol as any).asyncIterator) {\n        ;(Symbol as any).asyncIterator = Symbol.for(\"Symbol.asyncIterator\")\n    }\n\n    async function* someNumbers() {\n        await Promise.resolve()\n        yield 1\n        await Promise.resolve()\n        throw \"OOPS\"\n    }\n\n    const start = mobx.flow(async function* () {\n        let total = 0\n        for await (const number of someNumbers()) {\n            total += number\n        }\n        return total\n    })\n\n    const p = start()\n    try {\n        await p\n        fail()\n    } catch (e) {\n        expect(\"\" + e).toBe(\"OOPS\")\n    }\n})\n\ntest(\"allow 'as const' for creating tuples for map.replace()\", () => {\n    const map = mobx.observable.map<string, number>()\n    const srcValues = mobx.observable.array<string>()\n    const newValues = Array.from(srcValues, (value, index) => [value, index] as const)\n\n    map.replace(newValues)\n})\n\ntest(\"allow 'as const' for creating tuples for observable.map()\", () => {\n    const srcValues = mobx.observable.array<string>()\n    const newValues = Array.from(srcValues, (value, index) => [value, index] as const)\n\n    mobx.observable.map(newValues)\n})\n\ntest(\"infers tuple type for observable.map() when using array.map\", () => {\n    interface Usage {\n        daily: number\n        monthly: number\n    }\n    const data: Array<{ id: string; usage: Usage }> = [\n        { id: \"1\", usage: { daily: 5, monthly: 100 } },\n        { id: \"2\", usage: { daily: 10, monthly: 200 } },\n        { id: \"3\", usage: { daily: 15, monthly: 300 } }\n    ]\n\n    const map = mobx.observable.map(\n        data.map(app => [app.id, app.usage]),\n        { name: \"test\" }\n    )\n\n    expect(map.get(\"2\")).toEqual({ daily: 10, monthly: 200 })\n})\n\ntest(\"observable.map() accepts an undefined value with or without options\", () => {\n    const map = mobx.observable.map<string, number>(undefined, { name: \"custom name\" })\n    map.set(\"test\", 1)\n    expect(map.get(\"test\")).toBe(1)\n    expect(map.name_).toBe(\"custom name\")\n\n    // without options\n    mobx.observable.map(undefined)\n})\n\ntest(\"observable.map() accepts optional initial values\", () => {\n    interface Usage {}\n\n    ;(data?: [string, Usage][]) => observable.map(data, { name: \"test\" })\n    ;(data?: readonly (readonly [string, Usage])[]) => observable.map(data, { name: \"test\" })\n    ;(data?: Record<string, Usage>) => observable.map(data, { name: \"test\" })\n    ;(data?: Map<string, Usage>) => observable.map(data, { name: \"test\" })\n})\n\ntest(\"toJS bug #1413 (TS)\", () => {\n    class X {\n        test = {\n            test1: 1\n        }\n\n        constructor() {\n            makeObservable(this, {\n                test: observable\n            })\n        }\n    }\n\n    const x = new X()\n    const res = mobx.toJS(x.test) as any\n    expect(res).toEqual({ test1: 1 })\n    expect(res.__mobxDidRunLazyInitializers).toBe(undefined)\n})\n\ntest(\"verify #1528\", () => {\n    const appState = mobx.observable({\n        timer: 0\n    })\n\n    expect(appState.timer).toBe(0)\n})\n\ntest(\"type of flows that return promises\", async () => {\n    mobx.configure({ enforceActions: \"observed\" })\n\n    const f = mobx.flow(function* f() {\n        return Promise.resolve(5)\n    })\n\n    const n: number = await f()\n    expect(n).toBe(5)\n})\n\ntest(\"#2159 - computed property keys\", () => {\n    const testSymbol = Symbol(\"test symbol\")\n    const testString = \"testString\"\n\n    class TestClass {\n        [testSymbol] = \"original symbol value\";\n        [testString] = \"original string value\"\n\n        constructor() {\n            makeObservable(this, {\n                [testSymbol]: observable,\n                [testString]: observable\n            })\n        }\n    }\n\n    const o = new TestClass()\n\n    const events: any[] = []\n    observe(o, testSymbol, ev => events.push(ev.newValue, ev.oldValue))\n    observe(o, testString, ev => events.push(ev.newValue, ev.oldValue))\n\n    runInAction(() => {\n        o[testSymbol] = \"new symbol value\"\n        o[testString] = \"new string value\"\n    })\n\n    t.deepEqual(events, [\n        \"new symbol value\", // new symbol\n        \"original symbol value\", // original symbol\n        \"new string value\", // new string\n        \"original string value\" // original string\n    ])\n})\n\ntest(\"type inference of the action callback\", () => {\n    function test1arg(fn: (a: number) => any) {}\n\n    function test2args(fn: (a: string, b: number) => any) {}\n\n    function test7args(\n        fn: (a: object, b: number, c: number, d: string, e: string, f: number, g: string) => any\n    ) {}\n\n    // Nameless actions\n    test1arg(\n        action(a1 => {\n            assert<IsExact<typeof a1, number>>(true)\n        })\n    )\n    test2args(\n        action((a1, a2) => {\n            assert<IsExact<typeof a1, string>>(true)\n            assert<IsExact<typeof a2, number>>(true)\n        })\n    )\n    test7args(\n        action((a1, a2, a3, a4, a5, a6, a7) => {\n            assert<IsExact<typeof a1, object>>(true)\n            assert<IsExact<typeof a2, number>>(true)\n            assert<IsExact<typeof a3, number>>(true)\n            assert<IsExact<typeof a4, string>>(true)\n            assert<IsExact<typeof a5, string>>(true)\n            assert<IsExact<typeof a6, number>>(true)\n            assert<IsExact<typeof a7, string>>(true)\n        })\n    )\n\n    // Named actions\n    test1arg(\n        action(\"named action\", a1 => {\n            assert<IsExact<typeof a1, number>>(true)\n        })\n    )\n    test2args(\n        action(\"named action\", (a1, a2) => {\n            assert<IsExact<typeof a1, string>>(true)\n            assert<IsExact<typeof a2, number>>(true)\n        })\n    )\n    test7args(\n        action(\"named action\", (a1, a2, a3, a4, a5, a6, a7) => {\n            assert<IsExact<typeof a1, object>>(true)\n            assert<IsExact<typeof a2, number>>(true)\n            assert<IsExact<typeof a3, number>>(true)\n            assert<IsExact<typeof a4, string>>(true)\n            assert<IsExact<typeof a5, string>>(true)\n            assert<IsExact<typeof a6, number>>(true)\n            assert<IsExact<typeof a7, string>>(true)\n        })\n    )\n\n    // Promises\n    Promise.resolve(1).then(\n        action(arg => {\n            assert<IsExact<typeof arg, number>>(true)\n        })\n    )\n\n    // Promises with names actions\n    Promise.resolve(1).then(\n        action(\"named action\", arg => {\n            assert<IsExact<typeof arg, number>>(true)\n        })\n    )\n\n    // optional\n    const optionalActionTypeInfer: {\n        a?: (a1: number, a2: string, a3: boolean) => void\n    } = {\n        a: action((a1, a2, a3) => {\n            assert<IsExact<typeof a1, number>>(true)\n            assert<IsExact<typeof a2, string>>(true)\n            assert<IsExact<typeof a3, boolean>>(true)\n        })\n    }\n\n    // optional with names actions\n    const optionalNamedActionTypeInfer: {\n        a?: (a1: number, a2: string, a3: boolean) => void\n    } = {\n        a: action(\"named action\", (a1, a2, a3) => {\n            assert<IsExact<typeof a1, number>>(true)\n            assert<IsExact<typeof a2, string>>(true)\n            assert<IsExact<typeof a3, boolean>>(true)\n        })\n    }\n})\n\ntest(\"TS - type inference of Set\", () => {\n    const set = observable.set<number>()\n    set.add(1)\n    set.has(1)\n    set.delete(1)\n    // @ts-expect-error\n    set.add(\"1\")\n    // @ts-expect-error\n    set.has(\"1\")\n    // @ts-expect-error\n    set.delete(\"1\")\n})\n\ntest(\"TS - type inference of observe & intercept functions\", () => {\n    const array = [1, 2]\n    const object = { numberKey: 1, stringKey: \"string\" }\n    const map = new Map([[\"testKey\", 1]])\n    const set = new Set([1])\n\n    const { regularArray, regularObject, regularMap, regularSet } = observable({\n        regularArray: array,\n        regularObject: object,\n        regularMap: map,\n        regularSet: set\n    })\n\n    const observableArray = observable(array)\n    const observableObject = observable(object)\n    const observableMap = observable(map)\n    const observableSet = observable(set)\n\n    // Array\n    mobx.observe(regularArray, argument => {\n        assert<IsExact<typeof argument, IArrayDidChange<number>>>(true)\n    })\n    mobx.intercept(regularArray, argument => {\n        assert<IsExact<typeof argument, IArrayWillChange<number> | IArrayWillSplice<number>>>(true)\n        return argument\n    })\n    // ObservableArray\n    mobx.observe(observableArray, argument => {\n        assert<IsExact<typeof argument, IArrayDidChange<number>>>(true)\n    })\n    mobx.intercept(observableArray, argument => {\n        assert<IsExact<typeof argument, IArrayWillChange<number> | IArrayWillSplice<number>>>(true)\n        return argument\n    })\n    // Object\n    mobx.observe(regularObject, argument => {\n        assert<IsExact<typeof argument, IObjectDidChange>>(true)\n    })\n    mobx.intercept(regularObject, argument => {\n        assert<IsExact<typeof argument, IObjectWillChange>>(true)\n        return argument\n    })\n    mobx.observe(regularObject, \"numberKey\", argument => {\n        assert<IsExact<typeof argument, IValueDidChange<number>>>(true)\n    })\n    mobx.intercept(regularObject, \"numberKey\", argument => {\n        assert<IsExact<typeof argument, IValueWillChange<number>>>(true)\n        return argument\n    })\n    // ObservableObject\n    mobx.observe(observableObject, argument => {\n        assert<IsExact<typeof argument, IObjectDidChange>>(true)\n    })\n    mobx.intercept(observableObject, argument => {\n        assert<IsExact<typeof argument, IObjectWillChange>>(true)\n        return argument\n    })\n    mobx.observe(observableObject, \"numberKey\", argument => {\n        assert<IsExact<typeof argument, IValueDidChange<number>>>(true)\n    })\n    mobx.intercept(observableObject, \"numberKey\", argument => {\n        assert<IsExact<typeof argument, IValueWillChange<number>>>(true)\n        return argument\n    })\n    // Map\n    mobx.observe(regularMap, argument => {\n        assert<IsExact<typeof argument, IMapDidChange<string, number>>>(true)\n    })\n    mobx.intercept(regularMap, argument => {\n        assert<IsExact<typeof argument, IMapWillChange<string, number>>>(true)\n        return argument\n    })\n    mobx.observe(regularMap, \"testKey\", argument => {\n        assert<IsExact<typeof argument, IValueDidChange<number>>>(true)\n    })\n    mobx.intercept(regularMap, \"testKey\", argument => {\n        assert<IsExact<typeof argument, IValueWillChange<number>>>(true)\n        return argument\n    })\n    // ObservableMap\n    mobx.observe(observableMap, argument => {\n        assert<IsExact<typeof argument, IMapDidChange<string, number>>>(true)\n    })\n    mobx.intercept(observableMap, argument => {\n        assert<IsExact<typeof argument, IMapWillChange<string, number>>>(true)\n        return argument\n    })\n    mobx.observe(observableMap, \"testKey\", argument => {\n        assert<IsExact<typeof argument, IValueDidChange<number>>>(true)\n    })\n    mobx.intercept(observableMap, \"testKey\", argument => {\n        assert<IsExact<typeof argument, IValueWillChange<number>>>(true)\n        return argument\n    })\n    // Set\n    mobx.observe(regularSet, argument => {\n        assert<IsExact<typeof argument, ISetDidChange<number>>>(true)\n    })\n    mobx.intercept(regularSet, argument => {\n        assert<IsExact<typeof argument, ISetWillChange<number>>>(true)\n        return argument\n    })\n    // ObservableSet\n    mobx.observe(observableSet, argument => {\n        assert<IsExact<typeof argument, ISetDidChange<number>>>(true)\n    })\n    mobx.intercept(observableSet, argument => {\n        assert<IsExact<typeof argument, ISetWillChange<number>>>(true)\n        return argument\n    })\n})\n\ntest(\"TS - type inference of reaction opts.equals\", () => {\n    const data = observable({ a: 23 })\n    mobx.reaction(\n        () => data.a,\n        a => {},\n        {\n            equals: (a, b) => {\n                assert<IsExact<typeof a, string>>(false)\n                assert<IsExact<typeof b, string>>(false)\n                assert<IsExact<typeof a, number>>(true)\n                assert<IsExact<typeof b, number>>(true)\n                return a === b\n            }\n        }\n    )\n})\n\ntest(\"TS - it should support flow as function wrapper\", done => {\n    const values: number[] = []\n\n    mobx.configure({ enforceActions: \"observed\" })\n\n    class X {\n        a = 1\n\n        constructor() {\n            makeObservable(this, {\n                a: true\n            })\n        }\n\n        f = flow(function* f(this: X, initial) {\n            this.a = initial // this runs in action\n            try {\n                this.a = yield delay(100, 5, true) // and this as well!\n                yield delay(100, 0)\n                this.a = 4\n            } catch (e) {\n                this.a = e as number\n            }\n            return this.a\n        })\n    }\n\n    const x = new X()\n    mobx.reaction(\n        () => x.a,\n        v => values.push(v),\n        { fireImmediately: true }\n    )\n\n    const x2 = new X()\n    expect(x2.f).not.toBe(x.f) // not shared!\n\n    setTimeout(() => {\n        x.f(2).then(v => {\n            let _x: number = v\n            // @ts-expect-error\n            let _y: string = v\n            expect(v).toBe(5)\n            expect(values).toEqual([1, 2, 5])\n            expect(x.a).toBe(5)\n            done()\n        })\n    }, 10)\n})\n\ntest(\"TS - it should support flow as annotation\", done => {\n    const values: number[] = []\n\n    mobx.configure({ enforceActions: \"observed\" })\n\n    class X {\n        a = 1\n\n        constructor() {\n            makeObservable(this, {\n                a: true,\n                f: flow\n            })\n        }\n\n        *f(initial) {\n            this.a = initial // this runs in action\n            try {\n                this.a = yield delay(100, 5, true) // and this as well!\n                yield delay(100, 0)\n                this.a = 4\n            } catch (e) {\n                this.a = e as number\n            }\n            return this.a\n        }\n    }\n\n    const x = new X()\n    mobx.reaction(\n        () => x.a,\n        v => values.push(v),\n        { fireImmediately: true }\n    )\n\n    const x2 = new X()\n    expect(x2.f).toBe(x.f) // shared!\n\n    setTimeout(() => {\n        // Too bad...\n        flowResult(x.f(2)).then(v => {\n            let _x: number = v\n            // @ts-expect-error\n            let _y: string = v\n            expect(v).toBe(5)\n            expect(values).toEqual([1, 2, 5])\n            expect(x.a).toBe(5)\n            done()\n        })\n    }, 10)\n})\n\ntest(\"TS - it should support flow as decorator\", done => {\n    const values: number[] = []\n\n    mobx.configure({ enforceActions: \"observed\" })\n\n    class X {\n        @observable\n        a = 1\n\n        constructor() {\n            makeObservable(this)\n        }\n\n        @flow\n        *f(initial) {\n            this.a = initial // this runs in action\n            try {\n                this.a = yield delay(100, 5, true) // and this as well!\n                yield delay(100, 0)\n                this.a = 4\n            } catch (e) {\n                this.a = e as number\n            }\n            return this.a\n        }\n    }\n\n    const x = new X()\n    mobx.reaction(\n        () => x.a,\n        v => values.push(v),\n        { fireImmediately: true }\n    )\n\n    const x2 = new X()\n    expect(x2.f).toBe(x.f) // shared!\n\n    setTimeout(() => {\n        // Too bad...\n        flowResult(x.f(2)).then(v => {\n            let _x: number = v\n            // @ts-expect-error\n            let _y: string = v\n            expect(v).toBe(5)\n            expect(values).toEqual([1, 2, 5])\n            expect(x.a).toBe(5)\n            done()\n        })\n    }, 10)\n})\n\nfunction delay(time, value, shouldThrow = false) {\n    return new Promise((resolve, reject) => {\n        setTimeout(() => {\n            if (shouldThrow) reject(value)\n            else resolve(value)\n        }, time)\n    })\n}\n\ntest(\"#2485\", () => {\n    class Color {\n        public constructor(r: number, g: number, b: number, a?: number) {\n            makeObservable<Color, \"_r\" | \"_g\" | \"_b\" | \"_a\">(this, {\n                _r: observable,\n                r: computed,\n                _g: observable,\n                g: computed,\n                _b: observable,\n                b: computed,\n                _a: observable,\n                a: computed\n            })\n\n            this._r = r\n            this._g = g\n            this._b = b\n            this._a = a ?? 1\n        }\n\n        private _r: number\n        public get r(): number {\n            return this._r\n        }\n\n        private _g: number\n        public get g(): number {\n            return this._g\n        }\n\n        private _b: number\n        public get b(): number {\n            return this._b\n        }\n\n        private _a: number\n        public get a(): number {\n            return this._a\n        }\n\n        public stuff(): boolean {\n            return true\n        }\n\n        public toString(): string {\n            return `rgba(${this.r}, ${this.g}, ${this.b}, ${this.a})`\n        }\n\n        public toJSON(): number {\n            return 3\n        }\n    }\n\n    expect(new Color(1, 2, 3, 4).toString()).toMatchInlineSnapshot(`\"rgba(1, 2, 3, 4)\"`)\n})\n\ntest(\"argumentless observable adds undefined to the output type\", () => {\n    const a = observable.box<string>()\n    assert<IsExact<typeof a, IObservableValue<string | undefined>>>(true)\n})\n\ntest(\"with initial value observable does not adds undefined to the output type\", () => {\n    const a = observable.box<string>(\"hello\")\n    assert<IsExact<typeof a, IObservableValue<string>>>(true)\n})\n\ntest(\"observable.box should keep track of undefined and null in type\", () => {\n    const a = observable.box<string | undefined>()\n    assert<IsExact<typeof a, IObservableValue<string | undefined>>>(true)\n})\n"
  },
  {
    "path": "packages/mobx/__tests__/v5/base/untracked.ts",
    "content": "import { autorun, observable, computed, untracked } from \"../../../src/mobx\"\n\ntest(\"untracked 1\", () => {\n    let cCalcs = 0,\n        dCalcs = 0\n    const a = observable.box(1)\n    const b = observable.box(2)\n    const c = computed(() => {\n        cCalcs++\n        return a.get() + untracked(() => b.get())\n    })\n    let result\n\n    autorun(() => {\n        dCalcs++\n        result = c.get()\n    })\n\n    expect(result).toBe(3)\n    expect(cCalcs).toBe(1)\n    expect(dCalcs).toBe(1)\n\n    b.set(3)\n    expect(result).toBe(3)\n    expect(cCalcs).toBe(1)\n    expect(dCalcs).toBe(1)\n\n    a.set(2)\n    expect(result).toBe(5)\n    expect(cCalcs).toBe(2)\n    expect(dCalcs).toBe(2)\n})\n"
  },
  {
    "path": "packages/mobx/__tests__/v5/flow/test.js",
    "content": "//@flow\n\nimport type { IObservableValue, IObservableArray, IComputedValue } from \"../../../dist/index.js\"\nimport * as mobx from \"../../../dist/index.js\"\n\nconst action = mobx.action(() => console.log(1))\n// $ExpectError\nconst isAction: string = mobx.isAction(action)\n\nconst observableValue: IObservableValue<number> = mobx.observable.box(1)\n// $ExpectError\nconst initialValue: string = observableValue.get()\n\nconst observableArray: IObservableArray<number> = mobx.observable([1, 2, 3])\n// $ExpectError\nconst initialArray: Array<string> = observableArray.peek()\n\nconst sum: IComputedValue<number> = mobx.computed(() => {\n    return observableArray.reduce((a: number, b: number): number => {\n        return a + b\n    }, 0)\n})\n\nconst observableObject = mobx.observable({\n    a: true\n})\n// $ExpectError\nobservableObject.a = 12\n// $ExpectError\nobservableObject.b = 12\nobservableObject.a = false\n\nconst extendedObservableObject = mobx.extendObservable(mobx.observable({}), { a: true })\n// $ExpectError\nconst x: string = extendedObservableObject.a\n\nconst disposer = mobx.autorun(() => console.log(sum.get()))\ndisposer()\n\nconst emptyArray = observable([])\nconst arr = observable([1])\nconst object = observable.map({\n    nestedValue: arr\n})\n\nobject.get(\"nestedValue\").push(1)\nconst y: number = object.get(\"nestedValue\")[0]\n"
  },
  {
    "path": "packages/mobx/__tests__/v5/utils/test-utils.ts",
    "content": "// @ts-nocheck\nimport { $mobx } from \"../../../src/mobx\"\n\nexport function consoleError(block, regex) {\n    let messages = \"\"\n    const orig = console.error\n    console.error = function () {\n        Object.keys(arguments).forEach(key => {\n            messages += \", \" + arguments[key]\n        })\n        messages += \"\\n\"\n    }\n    try {\n        block()\n    } finally {\n        console.error = orig\n    }\n    expect(messages.length).toBeGreaterThan(0)\n    if (regex) expect(messages).toMatch(regex)\n    return messages\n}\n\nexport function consoleWarn(block, regex) {\n    let messages = \"\"\n    const orig = console.warn\n    console.warn = function () {\n        Object.keys(arguments).forEach(key => {\n            messages += \", \" + arguments[key]\n        })\n        messages += \"\\n\"\n    }\n    try {\n        block()\n    } finally {\n        console.warn = orig\n    }\n    expect(messages.length).toBeGreaterThan(0)\n    expect(messages).toMatch(regex)\n}\n\nexport function supressConsole(block) {\n    const messages = []\n    const { warn, error } = console\n    Object.assign(console, {\n        warn(e) {\n            messages.push(\"<STDOUT> \" + e)\n        },\n        error(e) {\n            messages.push(\"<STDERR> \" + e)\n        }\n    })\n    try {\n        block()\n    } finally {\n        Object.assign(console, { warn, error })\n    }\n    return messages\n}\n\nexport function stripAdminFromDescriptors(snapshot) {\n    const mobxProperty = snapshot[$mobx]\n    expect(mobxProperty).toBeTruthy()\n    return { ...snapshot, [$mobx]: { ...mobxProperty, value: \"(omitted)\" } }\n}\n\nexport function grabConsole(block) {\n    return supressConsole(block).join(\"\\n\")\n}\n"
  },
  {
    "path": "packages/mobx/flow-typed/mobx.js",
    "content": "// @flow\n\nexport type IObservableMapInitialValues<K, V> = IMapEntries<K, V> | KeyValueMap<V> | IMap<K, V>\n\nexport interface IMobxConfigurationOptions {\n    +enforceActions?: \"never\" | \"always\" | \"observed\";\n    computedRequiresReaction?: boolean;\n    /**\n     * (Experimental)\n     * Warn if you try to create to derivation / reactive context without accessing any observable.\n     */\n    reactionRequiresObservable?: boolean;\n    /**\n     * (Experimental)\n     * Warn if observables are accessed outside a reactive context\n     */\n    observableRequiresReaction?: boolean;\n    isolateGlobalState?: boolean;\n    disableErrorBoundaries?: boolean;\n    reactionScheduler?: (f: () => void) => void;\n    useProxies?: \"always\" | \"never\" | \"ifavailable\";\n}\n\ndeclare export function configure(options: IMobxConfigurationOptions): void\n\nexport interface IAutorunOptions {\n    delay?: number;\n    name?: string;\n    /**\n     *  warn if the derivation has no dependencies after creation/update\n     */\n    requiresObservable?: boolean;\n    scheduler?: (callback: () => void) => any;\n    onError?: (error: any) => void;\n}\n\nexport interface IReactionOptions extends IAutorunOptions {\n    fireImmediately?: boolean;\n    equals?: IEqualsComparer<any>;\n}\n\nexport interface IInterceptable<T> {\n    interceptors: IInterceptor<T>[] | any;\n    intercept(handler: IInterceptor<T>): Lambda;\n}\n\nexport type IEqualsComparer<T> = (a: T, b: T) => boolean\n\nexport type IInterceptor<T> = (change: T) => T\n\nexport type IMapEntry<K, V> = [K, V]\n\nexport type IMapEntries<K, V> = IMapEntry<K, V>[]\n\nexport interface IMap<K, V> {\n    clear(): void;\n    delete(key: K): boolean;\n    forEach(callbackfn: (value: V, index: K, map: IMap<K, V>) => void, thisArg?: any): void;\n    get(key: K): V | any;\n    has(key: K): boolean;\n    set(key: K, value?: V): any;\n    size: number;\n}\n\ndeclare export function isObservableMap(x: any): boolean\n\nexport interface IComputedValueOptions<T> {\n    get?: () => T;\n    set?: (value: T) => void;\n    name?: string;\n    equals?: IEqualsComparer<T>;\n    context?: any;\n}\n\ntype PropertyDescriptor<T> = {\n    enumerable?: boolean,\n    configurable?: boolean,\n    writable?: boolean,\n    value?: T,\n    get?: () => T,\n    set?: (value: T) => void\n}\n\nexport interface IComputed {\n    <T>(func: () => T, setter?: (value: T) => void): IComputedValue<T>;\n    <T>(func: () => T, options: IComputedValueOptions<T>): IComputedValue<T>;\n    (target: Object, key: string, baseDescriptor?: PropertyDescriptor<*>): void;\n    struct(target: Object, key: string, baseDescriptor?: PropertyDescriptor<*>): void;\n}\n\nexport interface IDependencyTree {\n    name: string;\n    dependencies?: IDependencyTree[];\n}\n\nexport interface IObserverTree {\n    name: string;\n    observers?: IObserverTree[];\n}\n\nexport interface IAtom {\n    reportObserved: () => void;\n    reportChanged: () => void;\n}\n\nexport interface IComputedValue<T> {\n    get(): T;\n    set(value: T): void;\n    observe(listener: (newValue: T, oldValue: T) => void, fireImmediately?: boolean): Lambda;\n}\n\nexport interface IObservable {}\n\nexport interface IDepTreeNode {\n    name: string;\n    observing?: IObservable[];\n}\n\nexport interface IDerivation {\n    name: string;\n}\n\nexport interface IReactionPublic {\n    dispose: () => void;\n    trace: (enterBreakPoint?: boolean) => void;\n}\n\ndeclare export class IListenable {\n    observe(handler: (change: any, oldValue?: any) => void, fireImmediately?: boolean): Lambda;\n}\n\nexport interface IObservableArray<T> extends Array<T> {\n    spliceWithArray(index: number, deleteCount?: number, newItems?: T[]): T[];\n    observe(\n        listener: (changeData: IArrayChange<T> | IArraySplice<T>) => void,\n        fireImmediately?: boolean\n    ): Lambda;\n    intercept(handler: IInterceptor<IArrayWillChange<T> | IArrayWillSplice<T>>): Lambda;\n    intercept(handler: IInterceptor<IArrayChange<T> | IArraySplice<T>>): Lambda; // TODO: remove in 4.0\n    intercept<T>(handler: IInterceptor<IArrayChange<T> | IArraySplice<T>>): Lambda; // TODO: remove in 4.0\n    clear(): T[];\n    peek(): T[];\n    replace(newItems: T[]): T[];\n    find(\n        predicate: (item: T, index: number, array: Array<T>) => mixed,\n        thisArg?: any,\n        fromIndex?: number\n    ): T | any;\n    findIndex(\n        predicate: (item: T, index: number, array: Array<T>) => mixed,\n        thisArg?: any,\n        fromIndex?: number\n    ): number;\n    remove(value: T): boolean;\n}\n\nexport interface IArrayChange<T> {\n    type: \"update\";\n    object: IObservableArray<T>;\n    index: number;\n    newValue: T;\n    oldValue: T;\n}\n\nexport interface IArraySplice<T> {\n    type: \"splice\";\n    object: IObservableArray<T>;\n    index: number;\n    added: T[];\n    addedCount: number;\n    removed: T[];\n    removedCount: number;\n}\n\nexport interface IArrayWillChange<T> {\n    type: \"update\";\n    object: IObservableArray<T>;\n    index: number;\n    newValue: T;\n}\n\nexport interface IArrayWillSplice<T> {\n    type: \"splice\";\n    object: IObservableArray<T>;\n    index: number;\n    added: T[];\n    removedCount: number;\n}\n\nexport type KeyValueMap<V> = {\n    [key: string]: V\n}\n\nexport interface IMapChange<K, T> {\n    object: ObservableMap<K, T>;\n    type: \"update\" | \"add\" | \"delete\";\n    name: K;\n    newValue?: any;\n    oldValue?: any;\n}\n\nexport interface IMapWillChange<K, T> {\n    object: ObservableMap<K, T>;\n    type: \"update\" | \"add\" | \"delete\";\n    name: K;\n    newValue?: any;\n}\n\nexport interface IObservableObject {}\n\nexport interface IObjectChange {\n    name: string;\n    object: any;\n    type: \"update\" | \"add\" | \"remove\";\n    oldValue?: any;\n    newValue: any;\n}\n\nexport interface IObjectWillChange {\n    object: any;\n    type: \"update\" | \"add\" | \"remove\";\n    name: string;\n    newValue: any;\n}\n\nexport interface IValueWillChange<T> {\n    object: any;\n    type: \"update\";\n    newValue: T;\n}\n\nexport interface IValueDidChange<T> extends IValueWillChange<T> {\n    oldValue: ?T;\n}\n\nexport interface IObservableValue<T> {\n    get(): T;\n    set(value: T): void;\n    intercept(handler: IInterceptor<IValueWillChange<T>>): Lambda;\n    observe(listener: (change: IValueDidChange<T>) => void, fireImmediately?: boolean): Lambda;\n}\n\nexport interface IEnhancer<T> {\n    (newValue: T, oldValue: T | void, name: string): T;\n}\n\nexport interface IObservableFactory {\n    // observable overloads\n    (target: Object, key: string, baseDescriptor?: PropertyDescriptor<*>): any;\n    <T>(value: Array<T>): IObservableArray<T>;\n    <T>(value: null | void): IObservableValue<T>;\n    (value: null | void): IObservableValue<any>;\n    <T>(value: IMap<string | number | boolean, T>): ObservableMap<T>;\n    <T: Object>(value: T): T;\n}\n\nexport type IObservableDecorator = {\n    (target: Object, property: string, descriptor?: PropertyDescriptor<*>): void,\n    enhancer: IEnhancer<any>\n}\n\nexport type CreateObservableOptions = {\n    name?: string,\n    deep?: boolean,\n    defaultDecorator?: IObservableDecorator\n}\n\ndeclare export class IObservableFactories {\n    box<T>(value?: T, options?: CreateObservableOptions): IObservableValue<T>;\n    array<T>(initialValues?: T[], options?: CreateObservableOptions): IObservableArray<T>;\n    set<V>(initialValues?: V[], options?: CreateObservableOptions): Set<V>;\n    map<K, V>(\n        initialValues?: IObservableMapInitialValues<K, V>,\n        options?: CreateObservableOptions\n    ): ObservableMap<K, V>;\n    object<T>(props: T, options?: CreateObservableOptions): T & IObservableObject;\n    ref(\n        target: Object,\n        property?: string,\n        descriptor?: PropertyDescriptor<*>\n    ): IObservableDecorator;\n    shallow(\n        target: Object,\n        property?: string,\n        descriptor?: PropertyDescriptor<*>\n    ): IObservableDecorator;\n    deep(\n        target: Object,\n        property?: string,\n        descriptor?: PropertyDescriptor<*>\n    ): IObservableDecorator;\n    struct(\n        target: Object,\n        property?: string,\n        descriptor?: PropertyDescriptor<*>\n    ): IObservableDecorator;\n}\n\nexport interface Lambda {\n    (): void;\n    name?: string;\n}\n\nexport interface IActionFactory {\n    (a1: any, a2?: any, a3?: any, a4?: any, a6?: any): any;\n    bound(target: Object, propertyKey: string, descriptor?: PropertyDescriptor<*>): void;\n}\n\ndeclare export class ObservableMap<K, V> {\n    constructor(initialData?: IMapEntries<K, V> | KeyValueMap<V>, valueModeFunc?: Function): this;\n    has(key: K): boolean;\n    set(key: K, value: V): void;\n    delete(key: K): boolean;\n    get(key: K): V;\n    keys(): Iterator<K>;\n    values(): Iterator<V>;\n    entries(): IMapEntries<K, V> & Iterator<IMapEntry<K, V>>;\n    forEach(callback: (value: V, key: K, object: KeyValueMap<K, V>) => void, thisArg?: any): void;\n    merge(other: ObservableMap<K, V> | KeyValueMap<K, V>): ObservableMap<K, V>;\n    clear(): void;\n    replace(other: ObservableMap<K, V> | KeyValueMap<K, V>): ObservableMap<K, V>;\n    size: number;\n    toJS(): Map<K, V>;\n    toPOJO(): KeyValueMap<V>;\n    toJSON(): KeyValueMap<V>;\n    toString(): string;\n    observe(listener: (changes: IMapChange<K, V>) => void, fireImmediately?: boolean): Lambda;\n    intercept(handler: IInterceptor<IMapWillChange<K, V>>): Lambda;\n}\n\ndeclare export function action(\n    targetOrName: any,\n    propertyKeyOrFuc?: any,\n    descriptor?: PropertyDescriptor<*>\n): any\ndeclare export function action<T>(name: string, func: T): T\ndeclare export function action<T>(func: T): T\n\ndeclare export function runInAction<T>(name: string, block: () => T): T\ndeclare export function runInAction<T>(block: () => T): T\ndeclare export function isAction(thing: any): boolean\ndeclare export function autorun(\n    nameOrFunction: string | ((r: IReactionPublic) => any),\n    options?: IAutorunOptions\n): any\ndeclare export function reaction<T>(\n    expression: (r: IReactionPublic) => T,\n    effect: (arg: T, r: IReactionPublic) => void,\n    opts?: IReactionOptions\n): () => mixed\n\nexport interface IWhenOptions {\n    name?: string;\n    timeout?: number;\n    onError?: (error: any) => void;\n    /**\n     *  warn if the derivation has no dependencies after creation/update\n     */\n    requiresObservable?: boolean;\n}\n\ndeclare export function when(\n    cond: () => boolean,\n    effect: Lambda,\n    options?: IWhenOptions\n): () => mixed\ndeclare export function when(cond: () => boolean, options?: IWhenOptions): Promise<any>\n\ndeclare export function computed<T>(\n    target: any,\n    key?: string,\n    baseDescriptor?: PropertyDescriptor<*>\n): any\n\ndeclare export function extendObservable<A, B>(\n    target: A,\n    properties: B,\n    decorators?: any,\n    options?: any\n): A & B\n\ndeclare export function makeObservable<A>(target: A, annotations?: any, options: any): A\n\ndeclare export function makeAutoObservable<A>(target: A, exceptions?: any, options: any): A\n\ndeclare export function intercept(\n    object: Object,\n    property: string,\n    handler: IInterceptor<any>\n): Lambda\n\ndeclare export function isComputed(value: any): boolean\ndeclare export function isComputedProp(value: any, property: string): boolean\n\ndeclare export function isObservable(value: any): boolean\ndeclare export function isObservableProp(value: any, property: string): boolean\n\ndeclare export var comparer: {\n    identity: IEqualsComparer<any>,\n    structural: IEqualsComparer<any>,\n    default: IEqualsComparer<any>\n}\n\ndeclare export var observable: IObservableFactory &\n    IObservableFactories & {\n        deep: {\n            struct<T>(initialValue?: T): T\n        },\n        ref: {\n            struct<T>(initialValue?: T): T\n        }\n    }\n\ndeclare export function observe<T>(\n    value: IObservableValue<T> | IComputedValue<T>,\n    listener: (change: IValueDidChange<T>) => void,\n    fireImmediately?: boolean\n): Lambda\ndeclare export function observe<T>(\n    observableArray: IObservableArray<T>,\n    listener: (change: IArrayChange<T> | IArraySplice<T>) => void,\n    fireImmediately?: boolean\n): Lambda\ndeclare export function observe<K, T>(\n    observableMap: ObservableMap<K, T>,\n    listener: (change: IMapChange<K, T>) => void,\n    fireImmediately?: boolean\n): Lambda\ndeclare export function observe<K, T>(\n    observableMap: ObservableMap<K, T>,\n    property: string,\n    listener: (change: IValueDidChange<K, T>) => void,\n    fireImmediately?: boolean\n): Lambda\ndeclare export function observe(\n    object: any,\n    listener: (change: IObjectChange) => void,\n    fireImmediately?: boolean\n): Lambda\ndeclare export function observe(\n    object: any,\n    property: string,\n    listener: (change: IValueDidChange<any>) => void,\n    fireImmediately?: boolean\n): Lambda\n\ndeclare export function toJS<T>(source: T): T\n\ndeclare export function untracked<T>(action: () => T): T\n\ndeclare export function spy(listener: (change: any) => void): Lambda\n\ndeclare export function transaction<T>(action: () => T, thisArg?: any, report?: boolean): T\n\ndeclare export function isObservableArray(thing: any): boolean\n\ndeclare export function isObservableObject<T>(thing: T): boolean\n\ndeclare export class Reaction {\n    name: string;\n    isDisposed: boolean;\n    constructor(name: string, onInvalidate: () => void): this;\n    schedule(): void;\n    isScheduled(): boolean;\n    track(fn: () => void): void;\n    dispose(): void;\n    getDisposer(): Lambda & {\n        $mosbservable: Reaction\n    };\n    toString(): string;\n    trace(enterBreakPoint?: boolean): void;\n}\n\ndeclare export function createAtom(\n    name: string,\n    onBecomeObservedHandler?: () => void,\n    onBecomeUnobservedHandler?: () => void\n): IAtom\n\ndeclare export function decorate<T>(target: T, decorators: any): T\n\nexport type CancellablePromise<T> = Promise<T> & { cancel: () => void }\n\ndeclare export function flow<T>(\n    fn: () => Generator<any, T | Promise<T>, any> | AsyncGenerator<any, T | Promise<T>, any>\n): () => CancellablePromise<T>\ndeclare export function flow<T, A>(\n    fn: (A) => Generator<any, T | Promise<T>, any> | AsyncGenerator<any, T | Promise<T>, any>\n): A => CancellablePromise<T>\ndeclare export function flow<T, A, B>(\n    fn: (A, B) => Generator<any, T | Promise<T>, any> | AsyncGenerator<any, T | Promise<T>, any>\n): (A, B) => CancellablePromise<T>\ndeclare export function flow<T, A, B, C>(\n    fn: (A, B, C) => Generator<any, T | Promise<T>, any> | AsyncGenerator<any, T | Promise<T>, any>\n): (A, B, C) => CancellablePromise<T>\ndeclare export function flow<T, A, B, C, D>(\n    fn: (\n        A,\n        B,\n        C,\n        D\n    ) => Generator<any, T | Promise<T>, any> | AsyncGenerator<any, T | Promise<T>, any>\n): (A, B, C, D) => CancellablePromise<T>\ndeclare export function flow<T, A, B, C, D, E>(\n    fn: (\n        A,\n        B,\n        C,\n        D,\n        E\n    ) => Generator<any, T | Promise<T>, any> | AsyncGenerator<any, T | Promise<T>, any>\n): (A, B, C, D, E) => CancellablePromise<T>\ndeclare export function flow<T, A, B, C, D, E, F>(\n    fn: (\n        A,\n        B,\n        C,\n        D,\n        E,\n        F\n    ) => Generator<any, T | Promise<T>, any> | AsyncGenerator<any, T | Promise<T>, any>\n): (A, B, C, D, E, F) => CancellablePromise<T>\ndeclare export function flow<T, A, B, C, D, E, F, G, H>(\n    fn: (\n        A,\n        B,\n        C,\n        D,\n        E,\n        F,\n        G,\n        H\n    ) => Generator<any, T | Promise<T>, any> | AsyncGenerator<any, T | Promise<T>, any>\n): (A, B, C, D, E, F, G, H) => CancellablePromise<T>\n\ndeclare export function isFlowCancellationError(error: Error): boolean\ndeclare export class FlowCancellationError extends Error {}\n\ndeclare export function keys<K>(map: ObservableMap<K, any>): K[]\ndeclare export function keys(obj: any): string[]\n\ndeclare export function values<K, T>(map: ObservableMap<K, T>): T[]\ndeclare export function values<T>(ar: IObservableArray<T>): T[]\ndeclare export function values(obj: any): any[]\n\ndeclare export function set<V>(obj: ObservableMap<string, V>, values: { [key: string]: V }): void\ndeclare export function set<K, V>(obj: ObservableMap<K, V>, key: K, value: V): void\ndeclare export function set<T>(obj: IObservableArray<T>, index: number, value: T): void\ndeclare export function set(obj: any, values: { [key: string]: any }): void\ndeclare export function set(obj: any, key: string, value: any): void\n\ndeclare export function remove<K, V>(obj: ObservableMap<K, V>, key: K): void\ndeclare export function remove<T>(obj: IObservableArray<T>, index: number): void\ndeclare export function remove(obj: any, key: string): void\n\ndeclare export function has<K>(obj: ObservableMap<K, any>, key: K): boolean\ndeclare export function has<T>(obj: IObservableArray<T>, index: number): boolean\ndeclare export function has(obj: any, key: string): boolean\n\ndeclare export function get<K, V>(obj: ObservableMap<K, V>, key: K): V | void\ndeclare export function get<T>(obj: IObservableArray<T>, index: number): T | void\ndeclare export function get(obj: any, key: string): any\n\ndeclare export function onReactionError(\n    handler: (error: any, derivation: IDerivation) => void\n): () => void\n\ndeclare export function onBecomeObserved(\n    value: IObservable | IComputedValue<any> | IObservableArray<any> | ObservableMap<any, any>,\n    listener: Lambda\n): Lambda\ndeclare export function onBecomeObserved<K>(\n    value: ObservableMap<K, any> | Object,\n    property: K,\n    listener: Lambda\n): Lambda\n\ndeclare export function onBecomeUnobserved(\n    value: IObservable | IComputedValue<any> | IObservableArray<any> | ObservableMap<any, any>,\n    listener: Lambda\n): Lambda\ndeclare export function onBecomeUnobserved<K>(\n    value: ObservableMap<K, any> | Object,\n    property: K,\n    listener: Lambda\n): Lambda\n\ndeclare export function getAtom(thing: any, property?: string): IDepTreeNode\ndeclare export function getDebugName(thing: any, property?: string): string\ndeclare export function getDependencyTree(thing: any, property?: string): IDependencyTree\ndeclare export function getObserverTree(thing: any, property?: string): IObserverTree\n"
  },
  {
    "path": "packages/mobx/jest.config-decorators.js",
    "content": "const path = require(\"path\")\nconst buildConfig = require(\"../../jest.base.config\")\n\nmodule.exports = buildConfig(\n    __dirname,\n    {\n        testRegex: \"__tests__/decorators_20223/.*\\\\.(t|j)sx?$\",\n        setupFilesAfterEnv: [`<rootDir>/jest.setup.ts`]\n    },\n    path.resolve(__dirname, \"./__tests__/decorators_20223/tsconfig.json\")\n)\n"
  },
  {
    "path": "packages/mobx/jest.config.js",
    "content": "const buildConfig = require(\"../../jest.base.config\")\n\nmodule.exports = buildConfig(__dirname, {\n    testRegex: \"__tests__/v[4|5]/base/.*\\\\.(t|j)sx?$\",\n    setupFilesAfterEnv: [`<rootDir>/jest.setup.ts`]\n})\n"
  },
  {
    "path": "packages/mobx/jest.projects.js",
    "content": "module.exports = {\n    collectCoverageFrom: [\"<rootDir>/src/**/*.{ts,tsx}\", \"!**/node_modules/**\"],\n    coverageDirectory: \"<rootDir>/coverage/\",\n    coverageReporters: [\"lcov\", \"text\"],\n    projects: [\"<rootDir>/jest.config.js\", \"<rootDir>/jest.config-decorators.js\"]\n}\n"
  },
  {
    "path": "packages/mobx/jest.setup.ts",
    "content": "import { configure, _resetGlobalState } from \"./src/mobx\"\n\nglobal.setImmediate = global.setImmediate || ((fn, ...args) => global.setTimeout(fn, 0, ...args))\n\nbeforeEach(() => {\n    // @ts-ignore\n    global.__DEV__ = true\n    _resetGlobalState()\n    configure({\n        enforceActions: \"never\"\n    })\n})\n"
  },
  {
    "path": "packages/mobx/package.json",
    "content": "{\n    \"name\": \"mobx\",\n    \"version\": \"6.15.1\",\n    \"description\": \"Simple, scalable state management.\",\n    \"source\": \"src/mobx.ts\",\n    \"main\": \"dist/index.js\",\n    \"umd:main\": \"dist/mobx.umd.production.min.js\",\n    \"unpkg\": \"dist/mobx.umd.production.min.js\",\n    \"jsdelivr\": \"dist/mobx.umd.production.min.js\",\n    \"jsnext:main\": \"dist/mobx.esm.production.min.js\",\n    \"module\": \"dist/mobx.esm.js\",\n    \"react-native\": \"dist/mobx.esm.js\",\n    \"types\": \"dist/mobx.d.ts\",\n    \"typings\": \"dist/mobx.d.ts\",\n    \"files\": [\n        \"src\",\n        \"dist\",\n        \"LICENSE\",\n        \"CHANGELOG.md\",\n        \"README.md\"\n    ],\n    \"sideEffects\": false,\n    \"repository\": {\n        \"type\": \"git\",\n        \"url\": \"https://github.com/mobxjs/mobx.git\"\n    },\n    \"author\": \"Michel Weststrate\",\n    \"license\": \"MIT\",\n    \"funding\": {\n        \"type\": \"opencollective\",\n        \"url\": \"https://opencollective.com/mobx\"\n    },\n    \"bugs\": {\n        \"url\": \"https://github.com/mobxjs/mobx/issues\"\n    },\n    \"homepage\": \"https://mobx.js.org/\",\n    \"dependencies\": {},\n    \"devDependencies\": {\n        \"@babel/core\": \"^7.9.0\",\n        \"@babel/plugin-proposal-class-properties\": \"^7.8.3\",\n        \"@babel/plugin-proposal-decorators\": \"^7.8.3\",\n        \"@babel/plugin-transform-runtime\": \"^7.9.0\",\n        \"@babel/preset-env\": \"^7.9.5\",\n        \"@babel/preset-typescript\": \"^7.9.0\",\n        \"@babel/runtime\": \"^7.9.2\",\n        \"conditional-type-checks\": \"^1.0.5\",\n        \"flow-bin\": \"^0.123.0\"\n    },\n    \"keywords\": [\n        \"mobx\",\n        \"mobservable\",\n        \"observable\",\n        \"react-component\",\n        \"react\",\n        \"reactjs\",\n        \"reactive\",\n        \"model\",\n        \"frp\",\n        \"functional-reactive-programming\",\n        \"state management\",\n        \"data flow\"\n    ],\n    \"scripts\": {\n        \"test\": \"jest --config jest.projects.js\",\n        \"lint\": \"eslint src/**/*\",\n        \"build\": \"node ../../scripts/build.js mobx\",\n        \"build:test\": \"yarn build --target test\",\n        \"perf\": \"scripts/perf.sh\",\n        \"perf-legacy\": \"node --expose-gc ./__tests__/perf/index.js legacy\",\n        \"perf-proxy\": \"node --expose-gc ./__tests__/perf/index.js proxy\",\n        \"test:performance\": \"yarn perf proxy && yarn perf legacy\",\n        \"test:mixed-versions\": \"yarn test --testRegex mixed-versions\",\n        \"test:types\": \"tsc --noEmit\",\n        \"test:flow\": \"flow check\",\n        \"test:coverage\": \"yarn test -i --coverage\",\n        \"test:size\": \"yarn import-size --report . observable computed autorun action\",\n        \"test:check\": \"yarn test:types\",\n        \"prepublishOnly\": \"node ./scripts/prepublish.js && yarn build --target publish\"\n    }\n}\n"
  },
  {
    "path": "packages/mobx/scripts/perf.sh",
    "content": "#!/bin/bash\n\ntime node --expose-gc ./__tests__/perf/index.js $1"
  },
  {
    "path": "packages/mobx/scripts/prepublish.js",
    "content": "const fs = require(\"fs-extra\")\nconst path = require(\"path\")\nconst execa = require(\"execa\")\n\nconst run = () => {\n    fs.copySync(\"flow-typed/mobx.js\", \"dist/index.js.flow\")\n    fs.copySync(\"../../README.md\", \"./README.md\")\n    fs.copySync(\"../../LICENSE\", \"./LICENSE\")\n}\n\nrun()\n"
  },
  {
    "path": "packages/mobx/src/api/action.ts",
    "content": "import {\n    createAction,\n    executeAction,\n    Annotation,\n    storeAnnotation,\n    die,\n    isFunction,\n    isStringish,\n    createDecoratorAnnotation,\n    createActionAnnotation,\n    is20223Decorator\n} from \"../internal\"\n\nimport type { ClassFieldDecorator, ClassMethodDecorator } from \"../types/decorator_fills\"\n\nexport const ACTION = \"action\"\nexport const ACTION_BOUND = \"action.bound\"\nexport const AUTOACTION = \"autoAction\"\nexport const AUTOACTION_BOUND = \"autoAction.bound\"\n\nconst DEFAULT_ACTION_NAME = \"<unnamed action>\"\n\nconst actionAnnotation = createActionAnnotation(ACTION)\nconst actionBoundAnnotation = createActionAnnotation(ACTION_BOUND, {\n    bound: true\n})\nconst autoActionAnnotation = createActionAnnotation(AUTOACTION, {\n    autoAction: true\n})\nconst autoActionBoundAnnotation = createActionAnnotation(AUTOACTION_BOUND, {\n    autoAction: true,\n    bound: true\n})\n\nexport interface IActionFactory\n    extends Annotation,\n        PropertyDecorator,\n        ClassMethodDecorator,\n        ClassFieldDecorator {\n    // nameless actions\n    <T extends Function | undefined | null>(fn: T): T\n    // named actions\n    <T extends Function | undefined | null>(name: string, fn: T): T\n\n    // named decorator\n    (customName: string): PropertyDecorator &\n        Annotation &\n        ClassMethodDecorator &\n        ClassFieldDecorator\n\n    // decorator (name no longer supported)\n    bound: Annotation & PropertyDecorator & ClassMethodDecorator & ClassFieldDecorator\n}\n\nfunction createActionFactory(autoAction: boolean): IActionFactory {\n    const res: IActionFactory = function action(arg1, arg2?): any {\n        // action(fn() {})\n        if (isFunction(arg1)) {\n            return createAction(arg1.name || DEFAULT_ACTION_NAME, arg1, autoAction)\n        }\n        // action(\"name\", fn() {})\n        if (isFunction(arg2)) {\n            return createAction(arg1, arg2, autoAction)\n        }\n        // @action (2022.3 Decorators)\n        if (is20223Decorator(arg2)) {\n            return (autoAction ? autoActionAnnotation : actionAnnotation).decorate_20223_(\n                arg1,\n                arg2\n            )\n        }\n        // @action\n        if (isStringish(arg2)) {\n            return storeAnnotation(arg1, arg2, autoAction ? autoActionAnnotation : actionAnnotation)\n        }\n        // action(\"name\") & @action(\"name\")\n        if (isStringish(arg1)) {\n            return createDecoratorAnnotation(\n                createActionAnnotation(autoAction ? AUTOACTION : ACTION, {\n                    name: arg1,\n                    autoAction\n                })\n            )\n        }\n\n        if (__DEV__) {\n            die(\"Invalid arguments for `action`\")\n        }\n    } as IActionFactory\n    return res\n}\n\nexport const action: IActionFactory = createActionFactory(false)\nObject.assign(action, actionAnnotation)\nexport const autoAction: IActionFactory = createActionFactory(true)\nObject.assign(autoAction, autoActionAnnotation)\n\naction.bound = createDecoratorAnnotation(actionBoundAnnotation)\nautoAction.bound = createDecoratorAnnotation(autoActionBoundAnnotation)\n\nexport function runInAction<T>(fn: () => T): T {\n    return executeAction(fn.name || DEFAULT_ACTION_NAME, false, fn, this, undefined)\n}\n\nexport function isAction(thing: any) {\n    return isFunction(thing) && thing.isMobxAction === true\n}\n"
  },
  {
    "path": "packages/mobx/src/api/annotation.ts",
    "content": "import { ObservableObjectAdministration, isFunction } from \"../internal\"\n\nexport const enum MakeResult {\n    Cancel,\n    Break,\n    Continue\n}\n\nexport type Annotation = {\n    annotationType_: string\n    make_(\n        adm: ObservableObjectAdministration,\n        key: PropertyKey,\n        descriptor: PropertyDescriptor,\n        source: object\n    ): MakeResult\n    extend_(\n        adm: ObservableObjectAdministration,\n        key: PropertyKey,\n        descriptor: PropertyDescriptor,\n        proxyTrap: boolean\n    ): boolean | null\n    decorate_20223_(value: any, context: DecoratorContext)\n    options_?: any\n}\n\nexport type AnnotationMapEntry =\n    | Annotation\n    | true /* follow the default decorator, usually deep */\n    | false /* don't decorate this property */\n\n// AdditionalFields can be used to declare additional keys that can be used, for example to be able to\n// declare annotations for private/ protected members, see #2339\nexport type AnnotationsMap<T, AdditionalFields extends PropertyKey> = {\n    [P in Exclude<keyof T, \"toString\">]?: AnnotationMapEntry\n} & Record<AdditionalFields, AnnotationMapEntry>\n\nexport function isAnnotation(thing: any) {\n    return (\n        // Can be function\n        thing instanceof Object &&\n        typeof thing.annotationType_ === \"string\" &&\n        isFunction(thing.make_) &&\n        isFunction(thing.extend_)\n    )\n}\n\nexport function isAnnotationMapEntry(thing: any) {\n    return typeof thing === \"boolean\" || isAnnotation(thing)\n}\n"
  },
  {
    "path": "packages/mobx/src/api/autorun.ts",
    "content": "import {\n    EMPTY_OBJECT,\n    IEqualsComparer,\n    IReactionDisposer,\n    IReactionPublic,\n    Lambda,\n    Reaction,\n    action,\n    comparer,\n    getNextId,\n    isAction,\n    isFunction,\n    isPlainObject,\n    die,\n    allowStateChanges,\n    GenericAbortSignal\n} from \"../internal\"\n\nexport interface IAutorunOptions {\n    delay?: number\n    name?: string\n    /**\n     * Experimental.\n     * Warns if the view doesn't track observables\n     */\n    requiresObservable?: boolean\n    scheduler?: (callback: () => void) => any\n    onError?: (error: any) => void\n    signal?: GenericAbortSignal\n}\n\n/**\n * Creates a named reactive view and keeps it alive, so that the view is always\n * updated if one of the dependencies changes, even when the view is not further used by something else.\n * @param view The reactive view\n * @returns disposer function, which can be used to stop the view from being updated in the future.\n */\nexport function autorun(\n    view: (r: IReactionPublic) => any,\n    opts: IAutorunOptions = EMPTY_OBJECT\n): IReactionDisposer {\n    if (__DEV__) {\n        if (!isFunction(view)) {\n            die(\"Autorun expects a function as first argument\")\n        }\n        if (isAction(view)) {\n            die(\"Autorun does not accept actions since actions are untrackable\")\n        }\n    }\n\n    const name: string =\n        opts?.name ?? (__DEV__ ? (view as any).name || \"Autorun@\" + getNextId() : \"Autorun\")\n    const runSync = !opts.scheduler && !opts.delay\n    let reaction: Reaction\n\n    if (runSync) {\n        // normal autorun\n        reaction = new Reaction(\n            name,\n            function (this: Reaction) {\n                this.track(reactionRunner)\n            },\n            opts.onError,\n            opts.requiresObservable\n        )\n    } else {\n        const scheduler = createSchedulerFromOptions(opts)\n        // debounced autorun\n        let isScheduled = false\n\n        reaction = new Reaction(\n            name,\n            () => {\n                if (!isScheduled) {\n                    isScheduled = true\n                    scheduler(() => {\n                        isScheduled = false\n                        if (!reaction.isDisposed) {\n                            reaction.track(reactionRunner)\n                        }\n                    })\n                }\n            },\n            opts.onError,\n            opts.requiresObservable\n        )\n    }\n\n    function reactionRunner() {\n        view(reaction)\n    }\n\n    if (!opts?.signal?.aborted) {\n        reaction.schedule_()\n    }\n    return reaction.getDisposer_(opts?.signal)\n}\n\nexport type IReactionOptions<T, FireImmediately extends boolean> = IAutorunOptions & {\n    fireImmediately?: FireImmediately\n    equals?: IEqualsComparer<T>\n}\n\nconst run = (f: Lambda) => f()\n\nfunction createSchedulerFromOptions(opts: IAutorunOptions) {\n    return opts.scheduler\n        ? opts.scheduler\n        : opts.delay\n        ? (f: Lambda) => setTimeout(f, opts.delay!)\n        : run\n}\n\nexport function reaction<T, FireImmediately extends boolean = false>(\n    expression: (r: IReactionPublic) => T,\n    effect: (\n        arg: T,\n        prev: FireImmediately extends true ? T | undefined : T,\n        r: IReactionPublic\n    ) => void,\n    opts: IReactionOptions<T, FireImmediately> = EMPTY_OBJECT\n): IReactionDisposer {\n    if (__DEV__) {\n        if (!isFunction(expression) || !isFunction(effect)) {\n            die(\"First and second argument to reaction should be functions\")\n        }\n        if (!isPlainObject(opts)) {\n            die(\"Third argument of reactions should be an object\")\n        }\n    }\n    const name = opts.name ?? (__DEV__ ? \"Reaction@\" + getNextId() : \"Reaction\")\n    const effectAction = action(\n        name,\n        opts.onError ? wrapErrorHandler(opts.onError, effect) : effect\n    )\n    const runSync = !opts.scheduler && !opts.delay\n    const scheduler = createSchedulerFromOptions(opts)\n\n    let firstTime = true\n    let isScheduled = false\n    let value: T\n\n    const equals: IEqualsComparer<T> = (opts as any).compareStructural\n        ? comparer.structural\n        : opts.equals || comparer.default\n\n    const r = new Reaction(\n        name,\n        () => {\n            if (firstTime || runSync) {\n                reactionRunner()\n            } else if (!isScheduled) {\n                isScheduled = true\n                scheduler!(reactionRunner)\n            }\n        },\n        opts.onError,\n        opts.requiresObservable\n    )\n\n    function reactionRunner() {\n        isScheduled = false\n        if (r.isDisposed) {\n            return\n        }\n        let changed: boolean = false\n        const oldValue = value\n        r.track(() => {\n            const nextValue = allowStateChanges(false, () => expression(r))\n            changed = firstTime || !equals(value, nextValue)\n            value = nextValue\n        })\n\n        // This casting is nesessary as TS cannot infer proper type in current function implementation\n        type OldValue = FireImmediately extends true ? T | undefined : T\n        if (firstTime && opts.fireImmediately!) {\n            effectAction(value, oldValue as OldValue, r)\n        } else if (!firstTime && changed) {\n            effectAction(value, oldValue as OldValue, r)\n        }\n        firstTime = false\n    }\n\n    if (!opts?.signal?.aborted) {\n        r.schedule_()\n    }\n    return r.getDisposer_(opts?.signal)\n}\n\nfunction wrapErrorHandler(errorHandler, baseFn) {\n    return function () {\n        try {\n            return baseFn.apply(this, arguments)\n        } catch (e) {\n            errorHandler.call(this, e)\n        }\n    }\n}\n"
  },
  {
    "path": "packages/mobx/src/api/become-observed.ts",
    "content": "import {\n    IComputedValue,\n    IObservable,\n    IObservableArray,\n    Lambda,\n    ObservableMap,\n    getAtom,\n    ObservableSet,\n    isFunction,\n    IObservableValue\n} from \"../internal\"\n\nconst ON_BECOME_OBSERVED = \"onBO\"\nconst ON_BECOME_UNOBSERVED = \"onBUO\"\n\nexport function onBecomeObserved(\n    value:\n        | IObservable\n        | IComputedValue<any>\n        | IObservableArray<any>\n        | ObservableMap<any, any>\n        | ObservableSet<any>\n        | IObservableValue<any>,\n    listener: Lambda\n): Lambda\nexport function onBecomeObserved<K, V = any>(\n    value: ObservableMap<K, V> | Object,\n    property: K,\n    listener: Lambda\n): Lambda\nexport function onBecomeObserved(thing, arg2, arg3?): Lambda {\n    return interceptHook(ON_BECOME_OBSERVED, thing, arg2, arg3)\n}\n\nexport function onBecomeUnobserved(\n    value:\n        | IObservable\n        | IComputedValue<any>\n        | IObservableArray<any>\n        | ObservableMap<any, any>\n        | ObservableSet<any>\n        | IObservableValue<any>,\n    listener: Lambda\n): Lambda\nexport function onBecomeUnobserved<K, V = any>(\n    value: ObservableMap<K, V> | Object,\n    property: K,\n    listener: Lambda\n): Lambda\nexport function onBecomeUnobserved(thing, arg2, arg3?): Lambda {\n    return interceptHook(ON_BECOME_UNOBSERVED, thing, arg2, arg3)\n}\n\nfunction interceptHook(hook: \"onBO\" | \"onBUO\", thing, arg2, arg3) {\n    const atom: IObservable =\n        typeof arg3 === \"function\" ? getAtom(thing, arg2) : (getAtom(thing) as any)\n    const cb = isFunction(arg3) ? arg3 : arg2\n    const listenersKey = `${hook}L` as \"onBOL\" | \"onBUOL\"\n\n    if (atom[listenersKey]) {\n        atom[listenersKey]!.add(cb)\n    } else {\n        atom[listenersKey] = new Set<Lambda>([cb])\n    }\n\n    return function () {\n        const hookListeners = atom[listenersKey]\n        if (hookListeners) {\n            hookListeners.delete(cb)\n            if (hookListeners.size === 0) {\n                delete atom[listenersKey]\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "packages/mobx/src/api/computed.ts",
    "content": "import {\n    ComputedValue,\n    IComputedValueOptions,\n    Annotation,\n    storeAnnotation,\n    createDecoratorAnnotation,\n    isStringish,\n    isPlainObject,\n    isFunction,\n    die,\n    IComputedValue,\n    createComputedAnnotation,\n    comparer,\n    is20223Decorator\n} from \"../internal\"\n\nimport type { ClassGetterDecorator } from \"../types/decorator_fills\"\n\nexport const COMPUTED = \"computed\"\nexport const COMPUTED_STRUCT = \"computed.struct\"\n\nexport interface IComputedFactory extends Annotation, PropertyDecorator, ClassGetterDecorator {\n    // @computed(opts)\n    <T>(options: IComputedValueOptions<T>): Annotation & PropertyDecorator & ClassGetterDecorator\n    // computed(fn, opts)\n    <T>(func: () => T, options?: IComputedValueOptions<T>): IComputedValue<T>\n\n    struct: Annotation & PropertyDecorator & ClassGetterDecorator\n}\n\nconst computedAnnotation = createComputedAnnotation(COMPUTED)\nconst computedStructAnnotation = createComputedAnnotation(COMPUTED_STRUCT, {\n    equals: comparer.structural\n})\n\n/**\n * Decorator for class properties: @computed get value() { return expr; }.\n * For legacy purposes also invokable as ES5 observable created: `computed(() => expr)`;\n */\nexport const computed: IComputedFactory = function computed(arg1, arg2) {\n    if (is20223Decorator(arg2)) {\n        // @computed (2022.3 Decorators)\n        return computedAnnotation.decorate_20223_(arg1, arg2)\n    }\n    if (isStringish(arg2)) {\n        // @computed\n        return storeAnnotation(arg1, arg2, computedAnnotation)\n    }\n    if (isPlainObject(arg1)) {\n        // @computed({ options })\n        return createDecoratorAnnotation(createComputedAnnotation(COMPUTED, arg1))\n    }\n\n    // computed(expr, options?)\n    if (__DEV__) {\n        if (!isFunction(arg1)) {\n            die(\"First argument to `computed` should be an expression.\")\n        }\n        if (isFunction(arg2)) {\n            die(\n                \"A setter as second argument is no longer supported, use `{ set: fn }` option instead\"\n            )\n        }\n    }\n    const opts: IComputedValueOptions<any> = isPlainObject(arg2) ? arg2 : {}\n    opts.get = arg1\n    opts.name ||= arg1.name || \"\" /* for generated name */\n\n    return new ComputedValue(opts)\n} as any\n\nObject.assign(computed, computedAnnotation)\n\ncomputed.struct = createDecoratorAnnotation(computedStructAnnotation)\n"
  },
  {
    "path": "packages/mobx/src/api/configure.ts",
    "content": "import { globalState, isolateGlobalState, setReactionScheduler } from \"../internal\"\n\nconst NEVER = \"never\"\nconst ALWAYS = \"always\"\nconst OBSERVED = \"observed\"\n// const IF_AVAILABLE = \"ifavailable\"\n\nexport function configure(options: {\n    enforceActions?: \"never\" | \"always\" | \"observed\"\n    computedRequiresReaction?: boolean\n    /**\n     * Warn if you try to create to derivation / reactive context without accessing any observable.\n     */\n    reactionRequiresObservable?: boolean\n    /**\n     * Warn if observables are accessed outside a reactive context\n     */\n    observableRequiresReaction?: boolean\n    isolateGlobalState?: boolean\n    disableErrorBoundaries?: boolean\n    safeDescriptors?: boolean\n    reactionScheduler?: (f: () => void) => void\n    useProxies?: \"always\" | \"never\" | \"ifavailable\"\n}): void {\n    if (options.isolateGlobalState === true) {\n        isolateGlobalState()\n    }\n    const { useProxies, enforceActions } = options\n    if (useProxies !== undefined) {\n        globalState.useProxies =\n            useProxies === ALWAYS\n                ? true\n                : useProxies === NEVER\n                ? false\n                : typeof Proxy !== \"undefined\"\n    }\n    if (useProxies === \"ifavailable\") {\n        globalState.verifyProxies = true\n    }\n    if (enforceActions !== undefined) {\n        const ea = enforceActions === ALWAYS ? ALWAYS : enforceActions === OBSERVED\n        globalState.enforceActions = ea\n        globalState.allowStateChanges = ea === true || ea === ALWAYS ? false : true\n    }\n    ;[\n        \"computedRequiresReaction\",\n        \"reactionRequiresObservable\",\n        \"observableRequiresReaction\",\n        \"disableErrorBoundaries\",\n        \"safeDescriptors\"\n    ].forEach(key => {\n        if (key in options) {\n            globalState[key] = !!options[key]\n        }\n    })\n    globalState.allowStateReads = !globalState.observableRequiresReaction\n    if (__DEV__ && globalState.disableErrorBoundaries === true) {\n        console.warn(\n            \"WARNING: Debug feature only. MobX will NOT recover from errors when `disableErrorBoundaries` is enabled.\"\n        )\n    }\n    if (options.reactionScheduler) {\n        setReactionScheduler(options.reactionScheduler)\n    }\n}\n"
  },
  {
    "path": "packages/mobx/src/api/decorators.ts",
    "content": "import { Annotation, addHiddenProp, AnnotationsMap, hasProp, die, isOverride } from \"../internal\"\n\nimport type { Decorator } from \"../types/decorator_fills\"\n\nexport const storedAnnotationsSymbol = Symbol(\"mobx-stored-annotations\")\n\n/**\n * Creates a function that acts as\n * - decorator\n * - annotation object\n */\nexport function createDecoratorAnnotation<D extends Decorator = Decorator>(\n    annotation: Annotation\n): PropertyDecorator & Annotation & D {\n    function decorator(target, property) {\n        if (is20223Decorator(property)) {\n            return annotation.decorate_20223_(target, property)\n        } else {\n            storeAnnotation(target, property, annotation)\n        }\n    }\n    return Object.assign(decorator, annotation) as any\n}\n\n/**\n * Stores annotation to prototype,\n * so it can be inspected later by `makeObservable` called from constructor\n */\nexport function storeAnnotation(prototype: any, key: PropertyKey, annotation: Annotation) {\n    if (!hasProp(prototype, storedAnnotationsSymbol)) {\n        addHiddenProp(prototype, storedAnnotationsSymbol, {\n            // Inherit annotations\n            ...prototype[storedAnnotationsSymbol]\n        })\n    }\n    // @override must override something\n    if (__DEV__ && isOverride(annotation) && !hasProp(prototype[storedAnnotationsSymbol], key)) {\n        const fieldName = `${prototype.constructor.name}.prototype.${key.toString()}`\n        die(\n            `'${fieldName}' is decorated with 'override', ` +\n                `but no such decorated member was found on prototype.`\n        )\n    }\n    // Cannot re-decorate\n    assertNotDecorated(prototype, annotation, key)\n\n    // Ignore override\n    if (!isOverride(annotation)) {\n        prototype[storedAnnotationsSymbol][key] = annotation\n    }\n}\n\nfunction assertNotDecorated(prototype: object, annotation: Annotation, key: PropertyKey) {\n    if (__DEV__ && !isOverride(annotation) && hasProp(prototype[storedAnnotationsSymbol], key)) {\n        const fieldName = `${prototype.constructor.name}.prototype.${key.toString()}`\n        const currentAnnotationType = prototype[storedAnnotationsSymbol][key].annotationType_\n        const requestedAnnotationType = annotation.annotationType_\n        die(\n            `Cannot apply '@${requestedAnnotationType}' to '${fieldName}':` +\n                `\\nThe field is already decorated with '@${currentAnnotationType}'.` +\n                `\\nRe-decorating fields is not allowed.` +\n                `\\nUse '@override' decorator for methods overridden by subclass.`\n        )\n    }\n}\n\n/**\n * Collects annotations from prototypes and stores them on target (instance)\n */\nexport function collectStoredAnnotations(target): AnnotationsMap<any, any> {\n    if (!hasProp(target, storedAnnotationsSymbol)) {\n        // if (__DEV__ && !target[storedAnnotationsSymbol]) {\n        //     die(\n        //         `No annotations were passed to makeObservable, but no decorated members have been found either`\n        //     )\n        // }\n        // We need a copy as we will remove annotation from the list once it's applied.\n        addHiddenProp(target, storedAnnotationsSymbol, { ...target[storedAnnotationsSymbol] })\n    }\n    return target[storedAnnotationsSymbol]\n}\n\nexport function is20223Decorator(context): context is DecoratorContext {\n    return typeof context == \"object\" && typeof context[\"kind\"] == \"string\"\n}\n\nexport function assert20223DecoratorType(\n    context: DecoratorContext,\n    types: DecoratorContext[\"kind\"][]\n) {\n    if (__DEV__ && !types.includes(context.kind)) {\n        die(\n            `The decorator applied to '${String(context.name)}' cannot be used on a ${\n                context.kind\n            } element`\n        )\n    }\n}\n"
  },
  {
    "path": "packages/mobx/src/api/extendobservable.ts",
    "content": "import {\n    CreateObservableOptions,\n    isObservableMap,\n    AnnotationsMap,\n    asObservableObject,\n    isPlainObject,\n    ObservableObjectAdministration,\n    isObservable,\n    die,\n    getOwnPropertyDescriptors,\n    $mobx,\n    ownKeys,\n    initObservable\n} from \"../internal\"\n\nexport function extendObservable<A extends Object, B extends Object>(\n    target: A,\n    properties: B,\n    annotations?: AnnotationsMap<B, never>,\n    options?: CreateObservableOptions\n): A & B {\n    if (__DEV__) {\n        if (arguments.length > 4) {\n            die(\"'extendObservable' expected 2-4 arguments\")\n        }\n        if (typeof target !== \"object\") {\n            die(\"'extendObservable' expects an object as first argument\")\n        }\n        if (isObservableMap(target)) {\n            die(\"'extendObservable' should not be used on maps, use map.merge instead\")\n        }\n        if (!isPlainObject(properties)) {\n            die(`'extendObservable' only accepts plain objects as second argument`)\n        }\n        if (isObservable(properties) || isObservable(annotations)) {\n            die(`Extending an object with another observable (object) is not supported`)\n        }\n    }\n    // Pull descriptors first, so we don't have to deal with props added by administration ($mobx)\n    const descriptors = getOwnPropertyDescriptors(properties)\n\n    initObservable(() => {\n        const adm: ObservableObjectAdministration = asObservableObject(target, options)[$mobx]\n        ownKeys(descriptors).forEach(key => {\n            adm.extend_(\n                key,\n                descriptors[key as any],\n                // must pass \"undefined\" for { key: undefined }\n                !annotations ? true : key in annotations ? annotations[key] : true\n            )\n        })\n    })\n\n    return target as any\n}\n"
  },
  {
    "path": "packages/mobx/src/api/extras.ts",
    "content": "import { IDepTreeNode, getAtom, getObservers, hasObservers } from \"../internal\"\n\nexport interface IDependencyTree {\n    name: string\n    dependencies?: IDependencyTree[]\n}\n\nexport interface IObserverTree {\n    name: string\n    observers?: IObserverTree[]\n}\n\nexport function getDependencyTree(thing: any, property?: string): IDependencyTree {\n    return nodeToDependencyTree(getAtom(thing, property))\n}\n\nfunction nodeToDependencyTree(node: IDepTreeNode): IDependencyTree {\n    const result: IDependencyTree = {\n        name: node.name_\n    }\n    if (node.observing_ && node.observing_.length > 0) {\n        result.dependencies = unique(node.observing_).map(nodeToDependencyTree)\n    }\n    return result\n}\n\nexport function getObserverTree(thing: any, property?: string): IObserverTree {\n    return nodeToObserverTree(getAtom(thing, property))\n}\n\nfunction nodeToObserverTree(node: IDepTreeNode): IObserverTree {\n    const result: IObserverTree = {\n        name: node.name_\n    }\n    if (hasObservers(node as any)) {\n        result.observers = Array.from(<any>getObservers(node as any)).map(<any>nodeToObserverTree)\n    }\n    return result\n}\n\nfunction unique<T>(list: T[]): T[] {\n    return Array.from(new Set(list))\n}\n"
  },
  {
    "path": "packages/mobx/src/api/flow.ts",
    "content": "import {\n    action,\n    noop,\n    die,\n    isFunction,\n    Annotation,\n    isStringish,\n    storeAnnotation,\n    createFlowAnnotation,\n    createDecoratorAnnotation,\n    is20223Decorator\n} from \"../internal\"\n\nimport type { ClassMethodDecorator } from \"../types/decorator_fills\"\n\nexport const FLOW = \"flow\"\n\nlet generatorId = 0\n\nexport class FlowCancellationError extends Error {\n    constructor() {\n        super(\"FLOW_CANCELLED\")\n        Object.setPrototypeOf(this, new.target.prototype)\n        this.name = \"FlowCancellationError\"\n    }\n\n    toString() {\n        return `Error: ${this.message}`\n    }\n}\n\nexport function isFlowCancellationError(error: Error) {\n    return error instanceof FlowCancellationError\n}\n\nexport type CancellablePromise<T> = Promise<T> & { cancel(): void }\n\ninterface Flow extends Annotation, PropertyDecorator, ClassMethodDecorator {\n    <R, Args extends any[]>(\n        generator: (...args: Args) => Generator<any, R, any> | AsyncGenerator<any, R, any>\n    ): (...args: Args) => CancellablePromise<R>\n    bound: Annotation & PropertyDecorator & ClassMethodDecorator\n}\n\nconst flowAnnotation = createFlowAnnotation(\"flow\")\nconst flowBoundAnnotation = createFlowAnnotation(\"flow.bound\", { bound: true })\n\nexport const flow: Flow = Object.assign(\n    function flow(arg1, arg2?) {\n        // @flow (2022.3 Decorators)\n        if (is20223Decorator(arg2)) {\n            return flowAnnotation.decorate_20223_(arg1, arg2)\n        }\n        // @flow\n        if (isStringish(arg2)) {\n            return storeAnnotation(arg1, arg2, flowAnnotation)\n        }\n        // flow(fn)\n        if (__DEV__ && arguments.length !== 1) {\n            die(`Flow expects single argument with generator function`)\n        }\n        const generator = arg1\n        const name = generator.name || \"<unnamed flow>\"\n\n        // Implementation based on https://github.com/tj/co/blob/master/index.js\n        const res = function () {\n            const ctx = this\n            const args = arguments\n            const runId = ++generatorId\n            const gen = action(`${name} - runid: ${runId} - init`, generator).apply(ctx, args)\n            let rejector: (error: any) => void\n            let pendingPromise: CancellablePromise<any> | undefined = undefined\n\n            const promise = new Promise(function (resolve, reject) {\n                let stepId = 0\n                rejector = reject\n\n                function onFulfilled(res: any) {\n                    pendingPromise = undefined\n                    let ret\n                    try {\n                        ret = action(\n                            `${name} - runid: ${runId} - yield ${stepId++}`,\n                            gen.next\n                        ).call(gen, res)\n                    } catch (e) {\n                        return reject(e)\n                    }\n\n                    next(ret)\n                }\n\n                function onRejected(err: any) {\n                    pendingPromise = undefined\n                    let ret\n                    try {\n                        ret = action(\n                            `${name} - runid: ${runId} - yield ${stepId++}`,\n                            gen.throw!\n                        ).call(gen, err)\n                    } catch (e) {\n                        return reject(e)\n                    }\n                    next(ret)\n                }\n\n                function next(ret: any) {\n                    if (isFunction(ret?.then)) {\n                        // an async iterator\n                        ret.then(next, reject)\n                        return\n                    }\n                    if (ret.done) {\n                        return resolve(ret.value)\n                    }\n                    pendingPromise = Promise.resolve(ret.value) as any\n                    return pendingPromise!.then(onFulfilled, onRejected)\n                }\n\n                onFulfilled(undefined) // kick off the process\n            }) as any\n\n            promise.cancel = action(`${name} - runid: ${runId} - cancel`, function () {\n                try {\n                    if (pendingPromise) {\n                        cancelPromise(pendingPromise)\n                    }\n                    // Finally block can return (or yield) stuff..\n                    const res = gen.return!(undefined as any)\n                    // eat anything that promise would do, it's cancelled!\n                    const yieldedPromise = Promise.resolve(res.value)\n                    yieldedPromise.then(noop, noop)\n                    cancelPromise(yieldedPromise) // maybe it can be cancelled :)\n                    // reject our original promise\n                    rejector(new FlowCancellationError())\n                } catch (e) {\n                    rejector(e) // there could be a throwing finally block\n                }\n            })\n            return promise\n        }\n        res.isMobXFlow = true\n        return res\n    } as any,\n    flowAnnotation\n)\n\nflow.bound = createDecoratorAnnotation(flowBoundAnnotation)\n\nfunction cancelPromise(promise) {\n    if (isFunction(promise.cancel)) {\n        promise.cancel()\n    }\n}\n\nexport function flowResult<T>(\n    result: T\n): T extends Generator<any, infer R, any>\n    ? CancellablePromise<R>\n    : T extends CancellablePromise<any>\n    ? T\n    : never {\n    return result as any // just tricking TypeScript :)\n}\n\nexport function isFlow(fn: any): boolean {\n    return fn?.isMobXFlow === true\n}\n"
  },
  {
    "path": "packages/mobx/src/api/intercept-read.ts",
    "content": "import {\n    IObservableArray,\n    IObservableValue,\n    Lambda,\n    ObservableMap,\n    getAdministration,\n    isObservableArray,\n    isObservableMap,\n    isObservableObject,\n    isObservableValue,\n    ObservableSet,\n    die,\n    isStringish\n} from \"../internal\"\n\nexport type ReadInterceptor<T> = (value: any) => T\n\n/** Experimental feature right now, tested indirectly via Mobx-State-Tree */\nexport function interceptReads<T>(value: IObservableValue<T>, handler: ReadInterceptor<T>): Lambda\nexport function interceptReads<T>(\n    observableArray: IObservableArray<T>,\n    handler: ReadInterceptor<T>\n): Lambda\nexport function interceptReads<K, V>(\n    observableMap: ObservableMap<K, V>,\n    handler: ReadInterceptor<V>\n): Lambda\nexport function interceptReads<V>(\n    observableSet: ObservableSet<V>,\n    handler: ReadInterceptor<V>\n): Lambda\nexport function interceptReads(\n    object: Object,\n    property: string,\n    handler: ReadInterceptor<any>\n): Lambda\nexport function interceptReads(thing, propOrHandler?, handler?): Lambda {\n    let target\n    if (isObservableMap(thing) || isObservableArray(thing) || isObservableValue(thing)) {\n        target = getAdministration(thing)\n    } else if (isObservableObject(thing)) {\n        if (__DEV__ && !isStringish(propOrHandler)) {\n            return die(\n                `InterceptReads can only be used with a specific property, not with an object in general`\n            )\n        }\n        target = getAdministration(thing, propOrHandler)\n    } else if (__DEV__) {\n        return die(`Expected observable map, object or array as first array`)\n    }\n    if (__DEV__ && target.dehancer !== undefined) {\n        return die(`An intercept reader was already established`)\n    }\n    target.dehancer = typeof propOrHandler === \"function\" ? propOrHandler : handler\n    return () => {\n        target.dehancer = undefined\n    }\n}\n"
  },
  {
    "path": "packages/mobx/src/api/intercept.ts",
    "content": "import {\n    IArrayWillChange,\n    IArrayWillSplice,\n    IInterceptor,\n    IMapWillChange,\n    IObjectWillChange,\n    IObservableArray,\n    IObservableValue,\n    IValueWillChange,\n    Lambda,\n    ObservableMap,\n    getAdministration,\n    ObservableSet,\n    ISetWillChange,\n    isFunction\n} from \"../internal\"\n\nexport function intercept<T>(\n    value: IObservableValue<T>,\n    handler: IInterceptor<IValueWillChange<T>>\n): Lambda\nexport function intercept<T>(\n    observableArray: IObservableArray<T> | Array<T>,\n    handler: IInterceptor<IArrayWillChange<T> | IArrayWillSplice<T>>\n): Lambda\nexport function intercept<K, V>(\n    observableMap: ObservableMap<K, V> | Map<K, V>,\n    handler: IInterceptor<IMapWillChange<K, V>>\n): Lambda\nexport function intercept<V>(\n    observableSet: ObservableSet<V> | Set<V>,\n    handler: IInterceptor<ISetWillChange<V>>\n): Lambda\nexport function intercept<K, V>(\n    observableMap: ObservableMap<K, V> | Map<K, V>,\n    property: K,\n    handler: IInterceptor<IValueWillChange<V>>\n): Lambda\nexport function intercept(object: object, handler: IInterceptor<IObjectWillChange>): Lambda\nexport function intercept<T extends object, K extends keyof T>(\n    object: T,\n    property: K,\n    handler: IInterceptor<IValueWillChange<T[K]>>\n): Lambda\nexport function intercept(thing, propOrHandler?, handler?): Lambda {\n    if (isFunction(handler)) {\n        return interceptProperty(thing, propOrHandler, handler)\n    } else {\n        return interceptInterceptable(thing, propOrHandler)\n    }\n}\n\nfunction interceptInterceptable(thing, handler) {\n    return getAdministration(thing).intercept_(handler)\n}\n\nfunction interceptProperty(thing, property, handler) {\n    return getAdministration(thing, property).intercept_(handler)\n}\n"
  },
  {
    "path": "packages/mobx/src/api/iscomputed.ts",
    "content": "import { $mobx, getAtom, isComputedValue, isObservableObject, die, isStringish } from \"../internal\"\n\nexport function _isComputed(value, property?: PropertyKey): boolean {\n    if (property === undefined) {\n        return isComputedValue(value)\n    }\n    if (isObservableObject(value) === false) {\n        return false\n    }\n    if (!value[$mobx].values_.has(property)) {\n        return false\n    }\n    const atom = getAtom(value, property)\n    return isComputedValue(atom)\n}\n\nexport function isComputed(value: any): boolean {\n    if (__DEV__ && arguments.length > 1) {\n        return die(\n            `isComputed expects only 1 argument. Use isComputedProp to inspect the observability of a property`\n        )\n    }\n    return _isComputed(value)\n}\n\nexport function isComputedProp(value: any, propName: PropertyKey): boolean {\n    if (__DEV__ && !isStringish(propName)) {\n        return die(`isComputed expected a property name as second argument`)\n    }\n    return _isComputed(value, propName)\n}\n"
  },
  {
    "path": "packages/mobx/src/api/isobservable.ts",
    "content": "import {\n    $mobx,\n    isAtom,\n    isComputedValue,\n    isObservableArray,\n    isObservableMap,\n    isObservableObject,\n    isReaction,\n    die,\n    isStringish\n} from \"../internal\"\n\nfunction _isObservable(value, property?: PropertyKey): boolean {\n    if (!value) {\n        return false\n    }\n    if (property !== undefined) {\n        if (__DEV__ && (isObservableMap(value) || isObservableArray(value))) {\n            return die(\n                \"isObservable(object, propertyName) is not supported for arrays and maps. Use map.has or array.length instead.\"\n            )\n        }\n        if (isObservableObject(value)) {\n            return value[$mobx].values_.has(property)\n        }\n        return false\n    }\n    // For first check, see #701\n    return (\n        isObservableObject(value) ||\n        !!value[$mobx] ||\n        isAtom(value) ||\n        isReaction(value) ||\n        isComputedValue(value)\n    )\n}\n\nexport function isObservable(value: any): boolean {\n    if (__DEV__ && arguments.length !== 1) {\n        die(\n            `isObservable expects only 1 argument. Use isObservableProp to inspect the observability of a property`\n        )\n    }\n    return _isObservable(value)\n}\n\nexport function isObservableProp(value: any, propName: PropertyKey): boolean {\n    if (__DEV__ && !isStringish(propName)) {\n        return die(`expected a property name as second argument`)\n    }\n    return _isObservable(value, propName)\n}\n"
  },
  {
    "path": "packages/mobx/src/api/makeObservable.ts",
    "content": "import {\n    $mobx,\n    asObservableObject,\n    AnnotationsMap,\n    CreateObservableOptions,\n    ObservableObjectAdministration,\n    collectStoredAnnotations,\n    isPlainObject,\n    isObservableObject,\n    die,\n    ownKeys,\n    extendObservable,\n    addHiddenProp,\n    storedAnnotationsSymbol,\n    initObservable\n} from \"../internal\"\n\n// Hack based on https://github.com/Microsoft/TypeScript/issues/14829#issuecomment-322267089\n// We need this, because otherwise, AdditionalKeys is going to be inferred to be any\n// set of superfluous keys. But, we rather want to get a compile error unless AdditionalKeys is\n// _explicity_ passed as generic argument\n// Fixes: https://github.com/mobxjs/mobx/issues/2325#issuecomment-691070022\ntype NoInfer<T> = [T][T extends any ? 0 : never]\n\ntype MakeObservableOptions = Omit<CreateObservableOptions, \"proxy\">\n\nexport function makeObservable<T extends object, AdditionalKeys extends PropertyKey = never>(\n    target: T,\n    annotations?: AnnotationsMap<T, NoInfer<AdditionalKeys>>,\n    options?: MakeObservableOptions\n): T {\n    initObservable(() => {\n        const adm: ObservableObjectAdministration = asObservableObject(target, options)[$mobx]\n        if (__DEV__ && annotations && target[storedAnnotationsSymbol]) {\n            die(\n                `makeObservable second arg must be nullish when using decorators. Mixing @decorator syntax with annotations is not supported.`\n            )\n        }\n        // Default to decorators\n        annotations ??= collectStoredAnnotations(target)\n\n        // Annotate\n        ownKeys(annotations).forEach(key => adm.make_(key, annotations![key]))\n    })\n    return target\n}\n\n// proto[keysSymbol] = new Set<PropertyKey>()\nconst keysSymbol = Symbol(\"mobx-keys\")\n\nexport function makeAutoObservable<T extends object, AdditionalKeys extends PropertyKey = never>(\n    target: T,\n    overrides?: AnnotationsMap<T, NoInfer<AdditionalKeys>>,\n    options?: MakeObservableOptions\n): T {\n    if (__DEV__) {\n        if (!isPlainObject(target) && !isPlainObject(Object.getPrototypeOf(target))) {\n            die(`'makeAutoObservable' can only be used for classes that don't have a superclass`)\n        }\n        if (isObservableObject(target)) {\n            die(`makeAutoObservable can only be used on objects not already made observable`)\n        }\n    }\n\n    // Optimization: avoid visiting protos\n    // Assumes that annotation.make_/.extend_ works the same for plain objects\n    if (isPlainObject(target)) {\n        return extendObservable(target, target, overrides, options)\n    }\n\n    initObservable(() => {\n        const adm: ObservableObjectAdministration = asObservableObject(target, options)[$mobx]\n\n        // Optimization: cache keys on proto\n        // Assumes makeAutoObservable can be called only once per object and can't be used in subclass\n        if (!target[keysSymbol]) {\n            const proto = Object.getPrototypeOf(target)\n            const keys = new Set([...ownKeys(target), ...ownKeys(proto)])\n            keys.delete(\"constructor\")\n            keys.delete($mobx)\n            addHiddenProp(proto, keysSymbol, keys)\n        }\n\n        target[keysSymbol].forEach(key =>\n            adm.make_(\n                key,\n                // must pass \"undefined\" for { key: undefined }\n                !overrides ? true : key in overrides ? overrides[key] : true\n            )\n        )\n    })\n\n    return target\n}\n"
  },
  {
    "path": "packages/mobx/src/api/object-api.ts",
    "content": "import {\n    $mobx,\n    IIsObservableObject,\n    IObservableArray,\n    ObservableMap,\n    ObservableSet,\n    ObservableObjectAdministration,\n    endBatch,\n    isObservableArray,\n    isObservableMap,\n    isObservableSet,\n    isObservableObject,\n    startBatch,\n    die\n} from \"../internal\"\n\nexport function keys<K>(map: ObservableMap<K, any>): ReadonlyArray<K>\nexport function keys<T>(ar: IObservableArray<T>): ReadonlyArray<number>\nexport function keys<T>(set: ObservableSet<T>): ReadonlyArray<T>\nexport function keys<T extends Object>(obj: T): ReadonlyArray<PropertyKey>\nexport function keys(obj: any): any {\n    if (isObservableObject(obj)) {\n        return (\n            (obj as any as IIsObservableObject)[$mobx] as ObservableObjectAdministration\n        ).keys_()\n    }\n    if (isObservableMap(obj) || isObservableSet(obj)) {\n        return Array.from(obj.keys())\n    }\n    if (isObservableArray(obj)) {\n        return obj.map((_, index) => index)\n    }\n    die(5)\n}\n\nexport function values<K, T>(map: ObservableMap<K, T>): ReadonlyArray<T>\nexport function values<T>(set: ObservableSet<T>): ReadonlyArray<T>\nexport function values<T>(ar: IObservableArray<T>): ReadonlyArray<T>\nexport function values<T = any>(obj: T): ReadonlyArray<T extends object ? T[keyof T] : any>\nexport function values(obj: any): string[] {\n    if (isObservableObject(obj)) {\n        return keys(obj).map(key => obj[key])\n    }\n    if (isObservableMap(obj)) {\n        return keys(obj).map(key => obj.get(key))\n    }\n    if (isObservableSet(obj)) {\n        return Array.from(obj.values())\n    }\n    if (isObservableArray(obj)) {\n        return obj.slice()\n    }\n    die(6)\n}\n\nexport function entries<K, T>(map: ObservableMap<K, T>): ReadonlyArray<[K, T]>\nexport function entries<T>(set: ObservableSet<T>): ReadonlyArray<[T, T]>\nexport function entries<T>(ar: IObservableArray<T>): ReadonlyArray<[number, T]>\nexport function entries<T = any>(\n    obj: T\n): ReadonlyArray<[string, T extends object ? T[keyof T] : any]>\nexport function entries(obj: any): any {\n    if (isObservableObject(obj)) {\n        return keys(obj).map(key => [key, obj[key]])\n    }\n    if (isObservableMap(obj)) {\n        return keys(obj).map(key => [key, obj.get(key)])\n    }\n    if (isObservableSet(obj)) {\n        return Array.from(obj.entries())\n    }\n    if (isObservableArray(obj)) {\n        return obj.map((key, index) => [index, key])\n    }\n    die(7)\n}\n\nexport function set<V>(obj: ObservableMap<PropertyKey, V>, values: { [key: string]: V })\nexport function set<K, V>(obj: ObservableMap<K, V>, key: K, value: V)\nexport function set<T>(obj: ObservableSet<T>, value: T)\nexport function set<T>(obj: IObservableArray<T>, index: number, value: T)\nexport function set<T extends Object>(obj: T, values: { [key: string]: any })\nexport function set<T extends Object>(obj: T, key: PropertyKey, value: any)\nexport function set(obj: any, key: any, value?: any): void {\n    if (arguments.length === 2 && !isObservableSet(obj)) {\n        startBatch()\n        const values = key\n        try {\n            for (let key in values) {\n                set(obj, key, values[key])\n            }\n        } finally {\n            endBatch()\n        }\n        return\n    }\n    if (isObservableObject(obj)) {\n        ;(obj as any as IIsObservableObject)[$mobx].set_(key, value)\n    } else if (isObservableMap(obj)) {\n        obj.set(key, value)\n    } else if (isObservableSet(obj)) {\n        obj.add(key)\n    } else if (isObservableArray(obj)) {\n        if (typeof key !== \"number\") {\n            key = parseInt(key, 10)\n        }\n        if (key < 0) {\n            die(`Invalid index: '${key}'`)\n        }\n        startBatch()\n        if (key >= obj.length) {\n            obj.length = key + 1\n        }\n        obj[key] = value\n        endBatch()\n    } else {\n        die(8)\n    }\n}\n\nexport function remove<K, V>(obj: ObservableMap<K, V>, key: K)\nexport function remove<T>(obj: ObservableSet<T>, key: T)\nexport function remove<T>(obj: IObservableArray<T>, index: number)\nexport function remove<T extends Object>(obj: T, key: string)\nexport function remove(obj: any, key: any): void {\n    if (isObservableObject(obj)) {\n        ;(obj as any as IIsObservableObject)[$mobx].delete_(key)\n    } else if (isObservableMap(obj)) {\n        obj.delete(key)\n    } else if (isObservableSet(obj)) {\n        obj.delete(key)\n    } else if (isObservableArray(obj)) {\n        if (typeof key !== \"number\") {\n            key = parseInt(key, 10)\n        }\n        obj.splice(key, 1)\n    } else {\n        die(9)\n    }\n}\n\nexport function has<K>(obj: ObservableMap<K, any>, key: K): boolean\nexport function has<T>(obj: ObservableSet<T>, key: T): boolean\nexport function has<T>(obj: IObservableArray<T>, index: number): boolean\nexport function has<T extends Object>(obj: T, key: string): boolean\nexport function has(obj: any, key: any): boolean {\n    if (isObservableObject(obj)) {\n        return (obj as any as IIsObservableObject)[$mobx].has_(key)\n    } else if (isObservableMap(obj)) {\n        return obj.has(key)\n    } else if (isObservableSet(obj)) {\n        return obj.has(key)\n    } else if (isObservableArray(obj)) {\n        return key >= 0 && key < obj.length\n    }\n    die(10)\n}\n\nexport function get<K, V>(obj: ObservableMap<K, V>, key: K): V | undefined\nexport function get<T>(obj: IObservableArray<T>, index: number): T | undefined\nexport function get<T extends Object>(obj: T, key: string): any\nexport function get(obj: any, key: any): any {\n    if (!has(obj, key)) {\n        return undefined\n    }\n    if (isObservableObject(obj)) {\n        return (obj as any as IIsObservableObject)[$mobx].get_(key)\n    } else if (isObservableMap(obj)) {\n        return obj.get(key)\n    } else if (isObservableArray(obj)) {\n        return obj[key]\n    }\n    die(11)\n}\n\nexport function apiDefineProperty(obj: Object, key: PropertyKey, descriptor: PropertyDescriptor) {\n    if (isObservableObject(obj)) {\n        return (obj as any as IIsObservableObject)[$mobx].defineProperty_(key, descriptor)\n    }\n    die(39)\n}\n\nexport function apiOwnKeys(obj: Object) {\n    if (isObservableObject(obj)) {\n        return (obj as any as IIsObservableObject)[$mobx].ownKeys_()\n    }\n    die(38)\n}\n"
  },
  {
    "path": "packages/mobx/src/api/observable.ts",
    "content": "import {\n    IEnhancer,\n    IEqualsComparer,\n    IObservableArray,\n    IObservableMapInitialValues,\n    IMapEntries,\n    IReadonlyMapEntries,\n    IKeyValueMap,\n    IObservableSetInitialValues,\n    IObservableValue,\n    ObservableMap,\n    ObservableSet,\n    ObservableValue,\n    asDynamicObservableObject,\n    createObservableArray,\n    deepEnhancer,\n    extendObservable,\n    isES6Map,\n    isES6Set,\n    isObservable,\n    isPlainObject,\n    referenceEnhancer,\n    Annotation,\n    shallowEnhancer,\n    refStructEnhancer,\n    AnnotationsMap,\n    asObservableObject,\n    storeAnnotation,\n    createDecoratorAnnotation,\n    createLegacyArray,\n    globalState,\n    assign,\n    isStringish,\n    createObservableAnnotation,\n    createAutoAnnotation,\n    is20223Decorator,\n    initObservable\n} from \"../internal\"\n\nimport type { ClassAccessorDecorator, ClassFieldDecorator } from \"../types/decorator_fills\"\n\nexport const OBSERVABLE = \"observable\"\nexport const OBSERVABLE_REF = \"observable.ref\"\nexport const OBSERVABLE_SHALLOW = \"observable.shallow\"\nexport const OBSERVABLE_STRUCT = \"observable.struct\"\n\nexport type CreateObservableOptions = {\n    name?: string\n    equals?: IEqualsComparer<any>\n    deep?: boolean\n    defaultDecorator?: Annotation\n    proxy?: boolean\n    autoBind?: boolean\n}\n\n// Predefined bags of create observable options, to avoid allocating temporarily option objects\n// in the majority of cases\nexport const defaultCreateObservableOptions: CreateObservableOptions = {\n    deep: true,\n    name: undefined,\n    defaultDecorator: undefined,\n    proxy: true\n}\nObject.freeze(defaultCreateObservableOptions)\n\nexport function asCreateObservableOptions(thing: any): CreateObservableOptions {\n    return thing || defaultCreateObservableOptions\n}\n\nconst observableAnnotation = createObservableAnnotation(OBSERVABLE)\nconst observableRefAnnotation = createObservableAnnotation(OBSERVABLE_REF, {\n    enhancer: referenceEnhancer\n})\nconst observableShallowAnnotation = createObservableAnnotation(OBSERVABLE_SHALLOW, {\n    enhancer: shallowEnhancer\n})\nconst observableStructAnnotation = createObservableAnnotation(OBSERVABLE_STRUCT, {\n    enhancer: refStructEnhancer\n})\nconst observableDecoratorAnnotation =\n    createDecoratorAnnotation<ClassAccessorDecorator>(observableAnnotation)\n\nexport function getEnhancerFromOptions(options: CreateObservableOptions): IEnhancer<any> {\n    return options.deep === true\n        ? deepEnhancer\n        : options.deep === false\n        ? referenceEnhancer\n        : getEnhancerFromAnnotation(options.defaultDecorator)\n}\n\nexport function getAnnotationFromOptions(\n    options?: CreateObservableOptions\n): Annotation | undefined {\n    return options ? options.defaultDecorator ?? createAutoAnnotation(options) : undefined\n}\n\nexport function getEnhancerFromAnnotation(annotation?: Annotation): IEnhancer<any> {\n    return !annotation ? deepEnhancer : annotation.options_?.enhancer ?? deepEnhancer\n}\n\n/**\n * Turns an object, array or function into a reactive structure.\n * @param v the value which should become observable.\n */\nfunction createObservable(v: any, arg2?: any, arg3?: any) {\n    // @observable someProp; (2022.3 Decorators)\n    if (is20223Decorator(arg2)) {\n        return observableAnnotation.decorate_20223_(v, arg2)\n    }\n\n    // @observable someProp;\n    if (isStringish(arg2)) {\n        storeAnnotation(v, arg2, observableAnnotation)\n        return\n    }\n\n    // already observable - ignore\n    if (isObservable(v)) {\n        return v\n    }\n\n    // plain object\n    if (isPlainObject(v)) {\n        return observable.object(v, arg2, arg3)\n    }\n\n    // Array\n    if (Array.isArray(v)) {\n        return observable.array(v, arg2)\n    }\n\n    // Map\n    if (isES6Map(v)) {\n        return observable.map(v, arg2)\n    }\n\n    // Set\n    if (isES6Set(v)) {\n        return observable.set(v, arg2)\n    }\n\n    // other object - ignore\n    if (typeof v === \"object\" && v !== null) {\n        return v\n    }\n\n    // anything else\n    return observable.box(v, arg2)\n}\nassign(createObservable, observableDecoratorAnnotation)\n\nexport interface IObservableValueFactory {\n    <T>(value: T, options?: CreateObservableOptions): IObservableValue<T>\n    <T>(value?: T, options?: CreateObservableOptions): IObservableValue<T | undefined>\n}\n\nexport interface IObservableMapFactory {\n    <K = any, V = any>(): ObservableMap<K, V>\n    <K, V>(initialValues?: IMapEntries<K, V>, options?: CreateObservableOptions): ObservableMap<\n        K,\n        V\n    >\n    <K, V>(\n        initialValues?: IReadonlyMapEntries<K, V>,\n        options?: CreateObservableOptions\n    ): ObservableMap<K, V>\n    <K, V>(initialValues?: IKeyValueMap<V>, options?: CreateObservableOptions): ObservableMap<K, V>\n    <K, V>(initialValues?: Map<K, V>, options?: CreateObservableOptions): ObservableMap<K, V>\n    <K = any, V = any>(initialValues: undefined, options?: CreateObservableOptions): ObservableMap<\n        K,\n        V\n    >\n}\n\nexport interface IObservableFactory\n    extends Annotation,\n        PropertyDecorator,\n        ClassAccessorDecorator,\n        ClassFieldDecorator {\n    // TODO: remove ClassFieldDecorator, this is only temporarily support for legacy decorators\n    <T = any>(value: T[], options?: CreateObservableOptions): IObservableArray<T>\n    <T = any>(value: Set<T>, options?: CreateObservableOptions): ObservableSet<T>\n    <K = any, V = any>(value: Map<K, V>, options?: CreateObservableOptions): ObservableMap<K, V>\n    <T extends object>(\n        value: T,\n        decorators?: AnnotationsMap<T, never>,\n        options?: CreateObservableOptions\n    ): T\n\n    box: IObservableValueFactory\n    array: <T = any>(initialValues?: T[], options?: CreateObservableOptions) => IObservableArray<T>\n    set: <T = any>(\n        initialValues?: IObservableSetInitialValues<T>,\n        options?: CreateObservableOptions\n    ) => ObservableSet<T>\n    map: IObservableMapFactory\n    object: <T = any>(\n        props: T,\n        decorators?: AnnotationsMap<T, never>,\n        options?: CreateObservableOptions\n    ) => T\n\n    /**\n     * Decorator that creates an observable that only observes the references, but doesn't try to turn the assigned value into an observable.ts.\n     */\n    ref: Annotation & PropertyDecorator & ClassAccessorDecorator & ClassFieldDecorator\n    /**\n     * Decorator that creates an observable converts its value (objects, maps or arrays) into a shallow observable structure\n     */\n    shallow: Annotation & PropertyDecorator & ClassAccessorDecorator & ClassFieldDecorator\n    deep: Annotation & PropertyDecorator & ClassAccessorDecorator & ClassFieldDecorator\n    struct: Annotation & PropertyDecorator & ClassAccessorDecorator & ClassFieldDecorator\n}\n\nconst observableFactories: IObservableFactory = {\n    box<T = any>(value: T, options?: CreateObservableOptions): IObservableValue<T> {\n        const o = asCreateObservableOptions(options)\n        return new ObservableValue(value, getEnhancerFromOptions(o), o.name, true, o.equals)\n    },\n    array<T = any>(initialValues?: T[], options?: CreateObservableOptions): IObservableArray<T> {\n        const o = asCreateObservableOptions(options)\n        return (\n            globalState.useProxies === false || o.proxy === false\n                ? createLegacyArray\n                : createObservableArray\n        )(initialValues, getEnhancerFromOptions(o), o.name)\n    },\n    map<K = any, V = any>(\n        initialValues?: IObservableMapInitialValues<K, V>,\n        options?: CreateObservableOptions\n    ): ObservableMap<K, V> {\n        const o = asCreateObservableOptions(options)\n        return new ObservableMap<K, V>(initialValues, getEnhancerFromOptions(o), o.name)\n    },\n    set<T = any>(\n        initialValues?: IObservableSetInitialValues<T>,\n        options?: CreateObservableOptions\n    ): ObservableSet<T> {\n        const o = asCreateObservableOptions(options)\n        return new ObservableSet<T>(initialValues, getEnhancerFromOptions(o), o.name)\n    },\n    object<T extends object = any>(\n        props: T,\n        decorators?: AnnotationsMap<T, never>,\n        options?: CreateObservableOptions\n    ): T {\n        return initObservable(() =>\n            extendObservable(\n                globalState.useProxies === false || options?.proxy === false\n                    ? asObservableObject({}, options)\n                    : asDynamicObservableObject({}, options),\n                props,\n                decorators\n            )\n        )\n    },\n    ref: createDecoratorAnnotation(observableRefAnnotation),\n    shallow: createDecoratorAnnotation(observableShallowAnnotation),\n    deep: observableDecoratorAnnotation,\n    struct: createDecoratorAnnotation(observableStructAnnotation)\n} as any\n\n// eslint-disable-next-line\nexport var observable: IObservableFactory = assign(createObservable, observableFactories)\n"
  },
  {
    "path": "packages/mobx/src/api/observe.ts",
    "content": "import {\n    IArrayDidChange,\n    IComputedValue,\n    IMapDidChange,\n    IObjectDidChange,\n    IObservableArray,\n    IObservableValue,\n    IValueDidChange,\n    Lambda,\n    ObservableMap,\n    getAdministration,\n    ObservableSet,\n    ISetDidChange,\n    isFunction\n} from \"../internal\"\n\nexport function observe<T>(\n    value: IObservableValue<T> | IComputedValue<T>,\n    listener: (change: IValueDidChange<T>) => void,\n    fireImmediately?: boolean\n): Lambda\nexport function observe<T>(\n    observableArray: IObservableArray<T> | Array<T>,\n    listener: (change: IArrayDidChange<T>) => void,\n    fireImmediately?: boolean\n): Lambda\nexport function observe<V>(\n    // ObservableSet/ObservableMap are required despite they implement Set/Map: https://github.com/mobxjs/mobx/pull/3180#discussion_r746542929\n    observableSet: ObservableSet<V> | Set<V>,\n    listener: (change: ISetDidChange<V>) => void,\n    fireImmediately?: boolean\n): Lambda\nexport function observe<K, V>(\n    observableMap: ObservableMap<K, V> | Map<K, V>,\n    listener: (change: IMapDidChange<K, V>) => void,\n    fireImmediately?: boolean\n): Lambda\nexport function observe<K, V>(\n    observableMap: ObservableMap<K, V> | Map<K, V>,\n    property: K,\n    listener: (change: IValueDidChange<V>) => void,\n    fireImmediately?: boolean\n): Lambda\nexport function observe(\n    object: Object,\n    listener: (change: IObjectDidChange) => void,\n    fireImmediately?: boolean\n): Lambda\nexport function observe<T, K extends keyof T>(\n    object: T,\n    property: K,\n    listener: (change: IValueDidChange<T[K]>) => void,\n    fireImmediately?: boolean\n): Lambda\nexport function observe(thing, propOrCb?, cbOrFire?, fireImmediately?): Lambda {\n    if (isFunction(cbOrFire)) {\n        return observeObservableProperty(thing, propOrCb, cbOrFire, fireImmediately)\n    } else {\n        return observeObservable(thing, propOrCb, cbOrFire)\n    }\n}\n\nfunction observeObservable(thing, listener, fireImmediately: boolean) {\n    return getAdministration(thing).observe_(listener, fireImmediately)\n}\n\nfunction observeObservableProperty(thing, property, listener, fireImmediately: boolean) {\n    return getAdministration(thing, property).observe_(listener, fireImmediately)\n}\n"
  },
  {
    "path": "packages/mobx/src/api/tojs.ts",
    "content": "import {\n    isObservable,\n    isObservableArray,\n    isObservableValue,\n    isObservableMap,\n    isObservableSet,\n    isComputedValue,\n    die,\n    apiOwnKeys,\n    objectPrototype\n} from \"../internal\"\n\nfunction cache<K, V>(map: Map<any, any>, key: K, value: V): V {\n    map.set(key, value)\n    return value\n}\n\nfunction toJSHelper(source, __alreadySeen: Map<any, any>) {\n    if (\n        source == null ||\n        typeof source !== \"object\" ||\n        source instanceof Date ||\n        !isObservable(source)\n    ) {\n        return source\n    }\n\n    if (isObservableValue(source) || isComputedValue(source)) {\n        return toJSHelper(source.get(), __alreadySeen)\n    }\n    if (__alreadySeen.has(source)) {\n        return __alreadySeen.get(source)\n    }\n    if (isObservableArray(source)) {\n        const res = cache(__alreadySeen, source, new Array(source.length))\n        source.forEach((value, idx) => {\n            res[idx] = toJSHelper(value, __alreadySeen)\n        })\n        return res\n    }\n    if (isObservableSet(source)) {\n        const res = cache(__alreadySeen, source, new Set())\n        source.forEach(value => {\n            res.add(toJSHelper(value, __alreadySeen))\n        })\n        return res\n    }\n    if (isObservableMap(source)) {\n        const res = cache(__alreadySeen, source, new Map())\n        source.forEach((value, key) => {\n            res.set(key, toJSHelper(value, __alreadySeen))\n        })\n        return res\n    } else {\n        // must be observable object\n        const res = cache(__alreadySeen, source, {})\n        apiOwnKeys(source).forEach((key: any) => {\n            if (objectPrototype.propertyIsEnumerable.call(source, key)) {\n                res[key] = toJSHelper(source[key], __alreadySeen)\n            }\n        })\n        return res\n    }\n}\n\n/**\n * Recursively converts an observable to it's non-observable native counterpart.\n * It does NOT recurse into non-observables, these are left as they are, even if they contain observables.\n * Computed and other non-enumerable properties are completely ignored.\n * Complex scenarios require custom solution, eg implementing `toJSON` or using `serializr` lib.\n */\nexport function toJS<T>(source: T, options?: any): T {\n    if (__DEV__ && options) {\n        die(\"toJS no longer supports options\")\n    }\n    return toJSHelper(source, new Map())\n}\n"
  },
  {
    "path": "packages/mobx/src/api/trace.ts",
    "content": "import { TraceMode, die, getAtom, globalState } from \"../internal\"\n\nexport function trace(thing?: any, prop?: string, enterBreakPoint?: boolean): void\nexport function trace(thing?: any, enterBreakPoint?: boolean): void\nexport function trace(enterBreakPoint?: boolean): void\nexport function trace(...args: any[]): void {\n    if (!__DEV__) {\n        return\n    }\n    let enterBreakPoint = false\n    if (typeof args[args.length - 1] === \"boolean\") {\n        enterBreakPoint = args.pop()\n    }\n    const derivation = getAtomFromArgs(args)\n    if (!derivation) {\n        return die(\n            `'trace(break?)' can only be used inside a tracked computed value or a Reaction. Consider passing in the computed value or reaction explicitly`\n        )\n    }\n    if (derivation.isTracing_ === TraceMode.NONE) {\n        console.log(`[mobx.trace] '${derivation.name_}' tracing enabled`)\n    }\n    derivation.isTracing_ = enterBreakPoint ? TraceMode.BREAK : TraceMode.LOG\n}\n\nfunction getAtomFromArgs(args): any {\n    switch (args.length) {\n        case 0:\n            return globalState.trackingDerivation\n        case 1:\n            return getAtom(args[0])\n        case 2:\n            return getAtom(args[0], args[1])\n    }\n}\n"
  },
  {
    "path": "packages/mobx/src/api/transaction.ts",
    "content": "import { endBatch, startBatch } from \"../internal\"\n\n/**\n * During a transaction no views are updated until the end of the transaction.\n * The transaction will be run synchronously nonetheless.\n *\n * @param action a function that updates some reactive state\n * @returns any value that was returned by the 'action' parameter.\n */\nexport function transaction<T>(action: () => T, thisArg = undefined): T {\n    startBatch()\n    try {\n        return action.apply(thisArg)\n    } finally {\n        endBatch()\n    }\n}\n"
  },
  {
    "path": "packages/mobx/src/api/when.ts",
    "content": "import {\n    $mobx,\n    IReactionDisposer,\n    Lambda,\n    autorun,\n    createAction,\n    getNextId,\n    die,\n    allowStateChanges,\n    GenericAbortSignal\n} from \"../internal\"\n\nexport interface IWhenOptions {\n    name?: string\n    timeout?: number\n    onError?: (error: any) => void\n    signal?: GenericAbortSignal\n}\n\nexport function when(\n    predicate: () => boolean,\n    opts?: IWhenOptions\n): Promise<void> & { cancel(): void }\nexport function when(\n    predicate: () => boolean,\n    effect: Lambda,\n    opts?: IWhenOptions\n): IReactionDisposer\nexport function when(predicate: any, arg1?: any, arg2?: any): any {\n    if (arguments.length === 1 || (arg1 && typeof arg1 === \"object\")) {\n        return whenPromise(predicate, arg1)\n    }\n    return _when(predicate, arg1, arg2 || {})\n}\n\nfunction _when(predicate: () => boolean, effect: Lambda, opts: IWhenOptions): IReactionDisposer {\n    let timeoutHandle: any\n    if (typeof opts.timeout === \"number\") {\n        const error = new Error(\"WHEN_TIMEOUT\")\n        timeoutHandle = setTimeout(() => {\n            if (!disposer[$mobx].isDisposed) {\n                disposer()\n                if (opts.onError) {\n                    opts.onError(error)\n                } else {\n                    throw error\n                }\n            }\n        }, opts.timeout)\n    }\n\n    opts.name = __DEV__ ? opts.name || \"When@\" + getNextId() : \"When\"\n    const effectAction = createAction(\n        __DEV__ ? opts.name + \"-effect\" : \"When-effect\",\n        effect as Function\n    )\n    // eslint-disable-next-line\n    var disposer = autorun(r => {\n        // predicate should not change state\n        let cond = allowStateChanges(false, predicate)\n        if (cond) {\n            r.dispose()\n            if (timeoutHandle) {\n                clearTimeout(timeoutHandle)\n            }\n            effectAction()\n        }\n    }, opts)\n    return disposer\n}\n\nfunction whenPromise(\n    predicate: () => boolean,\n    opts?: IWhenOptions\n): Promise<void> & { cancel(): void } {\n    if (__DEV__ && opts && opts.onError) {\n        return die(`the options 'onError' and 'promise' cannot be combined`)\n    }\n    if (opts?.signal?.aborted) {\n        return Object.assign(Promise.reject(new Error(\"WHEN_ABORTED\")), { cancel: () => null })\n    }\n    let cancel\n    let abort\n    const res = new Promise((resolve, reject) => {\n        let disposer = _when(predicate, resolve as Lambda, { ...opts, onError: reject })\n        cancel = () => {\n            disposer()\n            reject(new Error(\"WHEN_CANCELLED\"))\n        }\n        abort = () => {\n            disposer()\n            reject(new Error(\"WHEN_ABORTED\"))\n        }\n        opts?.signal?.addEventListener?.(\"abort\", abort)\n    }).finally(() => opts?.signal?.removeEventListener?.(\"abort\", abort))\n    ;(res as any).cancel = cancel\n    return res as any\n}\n"
  },
  {
    "path": "packages/mobx/src/core/action.ts",
    "content": "import {\n    IDerivation,\n    endBatch,\n    globalState,\n    isSpyEnabled,\n    spyReportEnd,\n    spyReportStart,\n    startBatch,\n    untrackedEnd,\n    untrackedStart,\n    isFunction,\n    allowStateReadsStart,\n    allowStateReadsEnd,\n    ACTION,\n    EMPTY_ARRAY,\n    die,\n    getDescriptor,\n    defineProperty\n} from \"../internal\"\n\n// we don't use globalState for these in order to avoid possible issues with multiple\n// mobx versions\nlet currentActionId = 0\nlet nextActionId = 1\nconst isFunctionNameConfigurable = getDescriptor(() => {}, \"name\")?.configurable ?? false\n\n// we can safely recycle this object\nconst tmpNameDescriptor: PropertyDescriptor = {\n    value: \"action\",\n    configurable: true,\n    writable: false,\n    enumerable: false\n}\n\nexport function createAction(\n    actionName: string,\n    fn: Function,\n    autoAction: boolean = false,\n    ref?: Object\n): Function {\n    if (__DEV__) {\n        if (!isFunction(fn)) {\n            die(\"`action` can only be invoked on functions\")\n        }\n        if (typeof actionName !== \"string\" || !actionName) {\n            die(`actions should have valid names, got: '${actionName}'`)\n        }\n    }\n    function res() {\n        return executeAction(actionName, autoAction, fn, ref || this, arguments)\n    }\n    res.isMobxAction = true\n    res.toString = () => fn.toString()\n    if (isFunctionNameConfigurable) {\n        tmpNameDescriptor.value = actionName\n        defineProperty(res, \"name\", tmpNameDescriptor)\n    }\n    return res\n}\n\nexport function executeAction(\n    actionName: string,\n    canRunAsDerivation: boolean,\n    fn: Function,\n    scope?: any,\n    args?: IArguments\n) {\n    const runInfo = _startAction(actionName, canRunAsDerivation, scope, args)\n    try {\n        return fn.apply(scope, args)\n    } catch (err) {\n        runInfo.error_ = err\n        throw err\n    } finally {\n        _endAction(runInfo)\n    }\n}\n\nexport interface IActionRunInfo {\n    prevDerivation_: IDerivation | null\n    prevAllowStateChanges_: boolean\n    prevAllowStateReads_: boolean\n    notifySpy_: boolean\n    startTime_: number\n    error_?: any\n    parentActionId_: number\n    actionId_: number\n    runAsAction_?: boolean\n}\n\nexport function _startAction(\n    actionName: string,\n    canRunAsDerivation: boolean, // true for autoAction\n    scope: any,\n    args?: IArguments\n): IActionRunInfo {\n    const notifySpy_ = __DEV__ && isSpyEnabled() && !!actionName\n    let startTime_: number = 0\n    if (__DEV__ && notifySpy_) {\n        startTime_ = Date.now()\n        const flattenedArgs = args ? Array.from(args) : EMPTY_ARRAY\n        spyReportStart({\n            type: ACTION,\n            name: actionName,\n            object: scope,\n            arguments: flattenedArgs\n        })\n    }\n    const prevDerivation_ = globalState.trackingDerivation\n    const runAsAction = !canRunAsDerivation || !prevDerivation_\n    startBatch()\n    let prevAllowStateChanges_ = globalState.allowStateChanges // by default preserve previous allow\n    if (runAsAction) {\n        untrackedStart()\n        prevAllowStateChanges_ = allowStateChangesStart(true)\n    }\n    const prevAllowStateReads_ = allowStateReadsStart(true)\n    const runInfo = {\n        runAsAction_: runAsAction,\n        prevDerivation_,\n        prevAllowStateChanges_,\n        prevAllowStateReads_,\n        notifySpy_,\n        startTime_,\n        actionId_: nextActionId++,\n        parentActionId_: currentActionId\n    }\n    currentActionId = runInfo.actionId_\n    return runInfo\n}\n\nexport function _endAction(runInfo: IActionRunInfo) {\n    if (currentActionId !== runInfo.actionId_) {\n        die(30)\n    }\n    currentActionId = runInfo.parentActionId_\n\n    if (runInfo.error_ !== undefined) {\n        globalState.suppressReactionErrors = true\n    }\n    allowStateChangesEnd(runInfo.prevAllowStateChanges_)\n    allowStateReadsEnd(runInfo.prevAllowStateReads_)\n    endBatch()\n    if (runInfo.runAsAction_) {\n        untrackedEnd(runInfo.prevDerivation_)\n    }\n    if (__DEV__ && runInfo.notifySpy_) {\n        spyReportEnd({ time: Date.now() - runInfo.startTime_ })\n    }\n    globalState.suppressReactionErrors = false\n}\n\nexport function allowStateChanges<T>(allowStateChanges: boolean, func: () => T): T {\n    const prev = allowStateChangesStart(allowStateChanges)\n    try {\n        return func()\n    } finally {\n        allowStateChangesEnd(prev)\n    }\n}\n\nexport function allowStateChangesStart(allowStateChanges: boolean) {\n    const prev = globalState.allowStateChanges\n    globalState.allowStateChanges = allowStateChanges\n    return prev\n}\n\nexport function allowStateChangesEnd(prev: boolean) {\n    globalState.allowStateChanges = prev\n}\n"
  },
  {
    "path": "packages/mobx/src/core/atom.ts",
    "content": "import {\n    IDerivationState_,\n    IObservable,\n    IDerivation,\n    createInstanceofPredicate,\n    endBatch,\n    getNextId,\n    noop,\n    onBecomeObserved,\n    onBecomeUnobserved,\n    propagateChanged,\n    reportObserved,\n    startBatch,\n    Lambda\n} from \"../internal\"\n\nimport { getFlag, setFlag } from \"../utils/utils\"\n\nexport const $mobx = Symbol(\"mobx administration\")\n\nexport interface IAtom extends IObservable {\n    reportObserved(): boolean\n    reportChanged(): void\n}\n\nexport class Atom implements IAtom {\n    private static readonly isBeingObservedMask_ = 0b001\n    private static readonly isPendingUnobservationMask_ = 0b010\n    private static readonly diffValueMask_ = 0b100\n    private flags_ = 0b000\n\n    observers_ = new Set<IDerivation>()\n\n    lastAccessedBy_ = 0\n    lowestObserverState_ = IDerivationState_.NOT_TRACKING_\n    /**\n     * Create a new atom. For debugging purposes it is recommended to give it a name.\n     * The onBecomeObserved and onBecomeUnobserved callbacks can be used for resource management.\n     */\n    constructor(public name_ = __DEV__ ? \"Atom@\" + getNextId() : \"Atom\") {}\n\n    // for effective unobserving. BaseAtom has true, for extra optimization, so its onBecomeUnobserved never gets called, because it's not needed\n    get isBeingObserved(): boolean {\n        return getFlag(this.flags_, Atom.isBeingObservedMask_)\n    }\n    set isBeingObserved(newValue: boolean) {\n        this.flags_ = setFlag(this.flags_, Atom.isBeingObservedMask_, newValue)\n    }\n\n    get isPendingUnobservation(): boolean {\n        return getFlag(this.flags_, Atom.isPendingUnobservationMask_)\n    }\n    set isPendingUnobservation(newValue: boolean) {\n        this.flags_ = setFlag(this.flags_, Atom.isPendingUnobservationMask_, newValue)\n    }\n\n    get diffValue(): 0 | 1 {\n        return getFlag(this.flags_, Atom.diffValueMask_) ? 1 : 0\n    }\n    set diffValue(newValue: 0 | 1) {\n        this.flags_ = setFlag(this.flags_, Atom.diffValueMask_, newValue === 1 ? true : false)\n    }\n\n    // onBecomeObservedListeners\n    public onBOL: Set<Lambda> | undefined\n    // onBecomeUnobservedListeners\n    public onBUOL: Set<Lambda> | undefined\n\n    public onBO() {\n        if (this.onBOL) {\n            this.onBOL.forEach(listener => listener())\n        }\n    }\n\n    public onBUO() {\n        if (this.onBUOL) {\n            this.onBUOL.forEach(listener => listener())\n        }\n    }\n\n    /**\n     * Invoke this method to notify mobx that your atom has been used somehow.\n     * Returns true if there is currently a reactive context.\n     */\n    public reportObserved(): boolean {\n        return reportObserved(this)\n    }\n\n    /**\n     * Invoke this method _after_ this method has changed to signal mobx that all its observers should invalidate.\n     */\n    public reportChanged() {\n        startBatch()\n        propagateChanged(this)\n        endBatch()\n    }\n\n    toString() {\n        return this.name_\n    }\n}\n\nexport const isAtom = createInstanceofPredicate(\"Atom\", Atom)\n\nexport function createAtom(\n    name: string,\n    onBecomeObservedHandler: () => void = noop,\n    onBecomeUnobservedHandler: () => void = noop\n): IAtom {\n    const atom = new Atom(name)\n    // default `noop` listener will not initialize the hook Set\n    if (onBecomeObservedHandler !== noop) {\n        onBecomeObserved(atom, onBecomeObservedHandler)\n    }\n\n    if (onBecomeUnobservedHandler !== noop) {\n        onBecomeUnobserved(atom, onBecomeUnobservedHandler)\n    }\n    return atom\n}\n"
  },
  {
    "path": "packages/mobx/src/core/computedvalue.ts",
    "content": "import {\n    CaughtException,\n    IDerivation,\n    IDerivationState_,\n    IEqualsComparer,\n    IObservable,\n    Lambda,\n    TraceMode,\n    autorun,\n    clearObserving,\n    comparer,\n    createAction,\n    createInstanceofPredicate,\n    endBatch,\n    getNextId,\n    globalState,\n    isCaughtException,\n    isSpyEnabled,\n    propagateChangeConfirmed,\n    propagateMaybeChanged,\n    reportObserved,\n    shouldCompute,\n    spyReport,\n    startBatch,\n    toPrimitive,\n    trackDerivedFunction,\n    untrackedEnd,\n    untrackedStart,\n    UPDATE,\n    die,\n    allowStateChangesStart,\n    allowStateChangesEnd\n} from \"../internal\"\n\nimport { getFlag, setFlag } from \"../utils/utils\"\n\nexport interface IComputedValue<T> {\n    get(): T\n    set(value: T): void\n}\n\nexport interface IComputedValueOptions<T> {\n    get?: () => T\n    set?: (value: T) => void\n    name?: string\n    equals?: IEqualsComparer<T>\n    context?: any\n    requiresReaction?: boolean\n    keepAlive?: boolean\n}\n\nexport type IComputedDidChange<T = any> = {\n    type: \"update\"\n    observableKind: \"computed\"\n    object: unknown\n    debugObjectName: string\n    newValue: T\n    oldValue: T | undefined\n}\n\n/**\n * A node in the state dependency root that observes other nodes, and can be observed itself.\n *\n * ComputedValue will remember the result of the computation for the duration of the batch, or\n * while being observed.\n *\n * During this time it will recompute only when one of its direct dependencies changed,\n * but only when it is being accessed with `ComputedValue.get()`.\n *\n * Implementation description:\n * 1. First time it's being accessed it will compute and remember result\n *    give back remembered result until 2. happens\n * 2. First time any deep dependency change, propagate POSSIBLY_STALE to all observers, wait for 3.\n * 3. When it's being accessed, recompute if any shallow dependency changed.\n *    if result changed: propagate STALE to all observers, that were POSSIBLY_STALE from the last step.\n *    go to step 2. either way\n *\n * If at any point it's outside batch and it isn't observed: reset everything and go to 1.\n */\nexport class ComputedValue<T> implements IObservable, IComputedValue<T>, IDerivation {\n    dependenciesState_ = IDerivationState_.NOT_TRACKING_\n    observing_: IObservable[] = [] // nodes we are looking at. Our value depends on these nodes\n    newObserving_ = null // during tracking it's an array with new observed observers\n    observers_ = new Set<IDerivation>()\n    runId_ = 0\n    lastAccessedBy_ = 0\n    lowestObserverState_ = IDerivationState_.UP_TO_DATE_\n    unboundDepsCount_ = 0\n    protected value_: T | undefined | CaughtException = new CaughtException(null)\n    name_: string\n    triggeredBy_?: string\n\n    private static readonly isComputingMask_ = 0b00001\n    private static readonly isRunningSetterMask_ = 0b00010\n    private static readonly isBeingObservedMask_ = 0b00100\n    private static readonly isPendingUnobservationMask_ = 0b01000\n    private static readonly diffValueMask_ = 0b10000\n    private flags_ = 0b00000\n\n    derivation: () => T // N.B: unminified as it is used by MST\n    setter_?: (value: T) => void\n    isTracing_: TraceMode = TraceMode.NONE\n    scope_: Object | undefined\n    private equals_: IEqualsComparer<any>\n    private requiresReaction_: boolean | undefined\n    keepAlive_: boolean\n\n    /**\n     * Create a new computed value based on a function expression.\n     *\n     * The `name` property is for debug purposes only.\n     *\n     * The `equals` property specifies the comparer function to use to determine if a newly produced\n     * value differs from the previous value. Two comparers are provided in the library; `defaultComparer`\n     * compares based on identity comparison (===), and `structuralComparer` deeply compares the structure.\n     * Structural comparison can be convenient if you always produce a new aggregated object and\n     * don't want to notify observers if it is structurally the same.\n     * This is useful for working with vectors, mouse coordinates etc.\n     */\n    constructor(options: IComputedValueOptions<T>) {\n        if (!options.get) {\n            die(31)\n        }\n        this.derivation = options.get!\n        this.name_ = options.name || (__DEV__ ? \"ComputedValue@\" + getNextId() : \"ComputedValue\")\n        if (options.set) {\n            this.setter_ = createAction(\n                __DEV__ ? this.name_ + \"-setter\" : \"ComputedValue-setter\",\n                options.set\n            ) as any\n        }\n        this.equals_ =\n            options.equals ||\n            ((options as any).compareStructural || (options as any).struct\n                ? comparer.structural\n                : comparer.default)\n        this.scope_ = options.context\n        this.requiresReaction_ = options.requiresReaction\n        this.keepAlive_ = !!options.keepAlive\n    }\n\n    onBecomeStale_() {\n        propagateMaybeChanged(this)\n    }\n\n    public onBOL: Set<Lambda> | undefined\n    public onBUOL: Set<Lambda> | undefined\n\n    public onBO() {\n        if (this.onBOL) {\n            this.onBOL.forEach(listener => listener())\n        }\n    }\n\n    public onBUO() {\n        if (this.onBUOL) {\n            this.onBUOL.forEach(listener => listener())\n        }\n    }\n\n    // to check for cycles\n    private get isComputing(): boolean {\n        return getFlag(this.flags_, ComputedValue.isComputingMask_)\n    }\n    private set isComputing(newValue: boolean) {\n        this.flags_ = setFlag(this.flags_, ComputedValue.isComputingMask_, newValue)\n    }\n\n    private get isRunningSetter(): boolean {\n        return getFlag(this.flags_, ComputedValue.isRunningSetterMask_)\n    }\n    private set isRunningSetter(newValue: boolean) {\n        this.flags_ = setFlag(this.flags_, ComputedValue.isRunningSetterMask_, newValue)\n    }\n\n    get isBeingObserved(): boolean {\n        return getFlag(this.flags_, ComputedValue.isBeingObservedMask_)\n    }\n    set isBeingObserved(newValue: boolean) {\n        this.flags_ = setFlag(this.flags_, ComputedValue.isBeingObservedMask_, newValue)\n    }\n\n    get isPendingUnobservation(): boolean {\n        return getFlag(this.flags_, ComputedValue.isPendingUnobservationMask_)\n    }\n    set isPendingUnobservation(newValue: boolean) {\n        this.flags_ = setFlag(this.flags_, ComputedValue.isPendingUnobservationMask_, newValue)\n    }\n\n    get diffValue(): 0 | 1 {\n        return getFlag(this.flags_, ComputedValue.diffValueMask_) ? 1 : 0\n    }\n    set diffValue(newValue: 0 | 1) {\n        this.flags_ = setFlag(\n            this.flags_,\n            ComputedValue.diffValueMask_,\n            newValue === 1 ? true : false\n        )\n    }\n\n    /**\n     * Returns the current value of this computed value.\n     * Will evaluate its computation first if needed.\n     */\n    public get(): T {\n        if (this.isComputing) {\n            die(32, this.name_, this.derivation)\n        }\n        if (\n            globalState.inBatch === 0 &&\n            // !globalState.trackingDerivatpion &&\n            this.observers_.size === 0 &&\n            !this.keepAlive_\n        ) {\n            if (shouldCompute(this)) {\n                this.warnAboutUntrackedRead_()\n                startBatch() // See perf test 'computed memoization'\n                this.value_ = this.computeValue_(false)\n                endBatch()\n            }\n        } else {\n            reportObserved(this)\n            if (shouldCompute(this)) {\n                let prevTrackingContext = globalState.trackingContext\n                if (this.keepAlive_ && !prevTrackingContext) {\n                    globalState.trackingContext = this\n                }\n                if (this.trackAndCompute()) {\n                    propagateChangeConfirmed(this)\n                }\n                globalState.trackingContext = prevTrackingContext\n            }\n        }\n        const result = this.value_!\n\n        if (isCaughtException(result)) {\n            throw result.cause\n        }\n        return result\n    }\n\n    public set(value: T) {\n        if (this.setter_) {\n            if (this.isRunningSetter) {\n                die(33, this.name_)\n            }\n            this.isRunningSetter = true\n            try {\n                this.setter_.call(this.scope_, value)\n            } finally {\n                this.isRunningSetter = false\n            }\n        } else {\n            die(34, this.name_)\n        }\n    }\n\n    trackAndCompute(): boolean {\n        // N.B: unminified as it is used by MST\n        const oldValue = this.value_\n        const wasSuspended =\n            /* see #1208 */ this.dependenciesState_ === IDerivationState_.NOT_TRACKING_\n        const newValue = this.computeValue_(true)\n\n        const changed =\n            wasSuspended ||\n            isCaughtException(oldValue) ||\n            isCaughtException(newValue) ||\n            !this.equals_(oldValue, newValue)\n\n        if (changed) {\n            this.value_ = newValue\n\n            if (__DEV__ && isSpyEnabled()) {\n                spyReport({\n                    observableKind: \"computed\",\n                    debugObjectName: this.name_,\n                    object: this.scope_,\n                    type: \"update\",\n                    oldValue,\n                    newValue\n                } as IComputedDidChange)\n            }\n        }\n\n        return changed\n    }\n\n    computeValue_(track: boolean) {\n        this.isComputing = true\n        // don't allow state changes during computation\n        const prev = allowStateChangesStart(false)\n        let res: T | CaughtException\n        if (track) {\n            res = trackDerivedFunction(this, this.derivation, this.scope_)\n        } else {\n            if (globalState.disableErrorBoundaries === true) {\n                res = this.derivation.call(this.scope_)\n            } else {\n                try {\n                    res = this.derivation.call(this.scope_)\n                } catch (e) {\n                    res = new CaughtException(e)\n                }\n            }\n        }\n        allowStateChangesEnd(prev)\n        this.isComputing = false\n        return res\n    }\n\n    suspend_() {\n        if (!this.keepAlive_) {\n            clearObserving(this)\n            this.value_ = undefined // don't hold on to computed value!\n            if (__DEV__ && this.isTracing_ !== TraceMode.NONE) {\n                console.log(\n                    `[mobx.trace] Computed value '${this.name_}' was suspended and it will recompute on the next access.`\n                )\n            }\n        }\n    }\n\n    observe_(listener: (change: IComputedDidChange<T>) => void, fireImmediately?: boolean): Lambda {\n        let firstTime = true\n        let prevValue: T | undefined = undefined\n        return autorun(() => {\n            // TODO: why is this in a different place than the spyReport() function? in all other observables it's called in the same place\n            let newValue = this.get()\n            if (!firstTime || fireImmediately) {\n                const prevU = untrackedStart()\n                listener({\n                    observableKind: \"computed\",\n                    debugObjectName: this.name_,\n                    type: UPDATE,\n                    object: this,\n                    newValue,\n                    oldValue: prevValue\n                })\n                untrackedEnd(prevU)\n            }\n            firstTime = false\n            prevValue = newValue\n        })\n    }\n\n    warnAboutUntrackedRead_() {\n        if (!__DEV__) {\n            return\n        }\n        if (this.isTracing_ !== TraceMode.NONE) {\n            console.log(\n                `[mobx.trace] Computed value '${this.name_}' is being read outside a reactive context. Doing a full recompute.`\n            )\n        }\n        if (\n            typeof this.requiresReaction_ === \"boolean\"\n                ? this.requiresReaction_\n                : globalState.computedRequiresReaction\n        ) {\n            console.warn(\n                `[mobx] Computed value '${this.name_}' is being read outside a reactive context. Doing a full recompute.`\n            )\n        }\n    }\n\n    toString() {\n        return `${this.name_}[${this.derivation.toString()}]`\n    }\n\n    valueOf(): T {\n        return toPrimitive(this.get())\n    }\n\n    [Symbol.toPrimitive]() {\n        return this.valueOf()\n    }\n}\n\nexport const isComputedValue = createInstanceofPredicate(\"ComputedValue\", ComputedValue)\n"
  },
  {
    "path": "packages/mobx/src/core/derivation.ts",
    "content": "import {\n    IAtom,\n    IDepTreeNode,\n    IObservable,\n    addObserver,\n    globalState,\n    isComputedValue,\n    removeObserver\n} from \"../internal\"\n\nexport enum IDerivationState_ {\n    // before being run or (outside batch and not being observed)\n    // at this point derivation is not holding any data about dependency tree\n    NOT_TRACKING_ = -1,\n    // no shallow dependency changed since last computation\n    // won't recalculate derivation\n    // this is what makes mobx fast\n    UP_TO_DATE_ = 0,\n    // some deep dependency changed, but don't know if shallow dependency changed\n    // will require to check first if UP_TO_DATE or POSSIBLY_STALE\n    // currently only ComputedValue will propagate POSSIBLY_STALE\n    //\n    // having this state is second big optimization:\n    // don't have to recompute on every dependency change, but only when it's needed\n    POSSIBLY_STALE_ = 1,\n    // A shallow dependency has changed since last computation and the derivation\n    // will need to recompute when it's needed next.\n    STALE_ = 2\n}\n\nexport enum TraceMode {\n    NONE,\n    LOG,\n    BREAK\n}\n\n/**\n * A derivation is everything that can be derived from the state (all the atoms) in a pure manner.\n * See https://medium.com/@mweststrate/becoming-fully-reactive-an-in-depth-explanation-of-mobservable-55995262a254#.xvbh6qd74\n */\nexport interface IDerivation extends IDepTreeNode {\n    observing_: IObservable[]\n    newObserving_: null | IObservable[]\n    dependenciesState_: IDerivationState_\n    /**\n     * Id of the current run of a derivation. Each time the derivation is tracked\n     * this number is increased by one. This number is globally unique\n     */\n    runId_: number\n    /**\n     * amount of dependencies used by the derivation in this run, which has not been bound yet.\n     */\n    unboundDepsCount_: number\n    onBecomeStale_(): void\n    isTracing_: TraceMode\n\n    /**\n     *  warn if the derivation has no dependencies after creation/update\n     */\n    requiresObservable_?: boolean\n}\n\nexport class CaughtException {\n    constructor(public cause: any) {\n        // Empty\n    }\n}\n\nexport function isCaughtException(e: any): e is CaughtException {\n    return e instanceof CaughtException\n}\n\n/**\n * Finds out whether any dependency of the derivation has actually changed.\n * If dependenciesState is 1 then it will recalculate dependencies,\n * if any dependency changed it will propagate it by changing dependenciesState to 2.\n *\n * By iterating over the dependencies in the same order that they were reported and\n * stopping on the first change, all the recalculations are only called for ComputedValues\n * that will be tracked by derivation. That is because we assume that if the first x\n * dependencies of the derivation doesn't change then the derivation should run the same way\n * up until accessing x-th dependency.\n */\nexport function shouldCompute(derivation: IDerivation): boolean {\n    switch (derivation.dependenciesState_) {\n        case IDerivationState_.UP_TO_DATE_:\n            return false\n        case IDerivationState_.NOT_TRACKING_:\n        case IDerivationState_.STALE_:\n            return true\n        case IDerivationState_.POSSIBLY_STALE_: {\n            // state propagation can occur outside of action/reactive context #2195\n            const prevAllowStateReads = allowStateReadsStart(true)\n            const prevUntracked = untrackedStart() // no need for those computeds to be reported, they will be picked up in trackDerivedFunction.\n            const obs = derivation.observing_,\n                l = obs.length\n            for (let i = 0; i < l; i++) {\n                const obj = obs[i]\n                if (isComputedValue(obj)) {\n                    if (globalState.disableErrorBoundaries) {\n                        obj.get()\n                    } else {\n                        try {\n                            obj.get()\n                        } catch (e) {\n                            // we are not interested in the value *or* exception at this moment, but if there is one, notify all\n                            untrackedEnd(prevUntracked)\n                            allowStateReadsEnd(prevAllowStateReads)\n                            return true\n                        }\n                    }\n                    // if ComputedValue `obj` actually changed it will be computed and propagated to its observers.\n                    // and `derivation` is an observer of `obj`\n                    // invariantShouldCompute(derivation)\n                    if ((derivation.dependenciesState_ as any) === IDerivationState_.STALE_) {\n                        untrackedEnd(prevUntracked)\n                        allowStateReadsEnd(prevAllowStateReads)\n                        return true\n                    }\n                }\n            }\n            changeDependenciesStateTo0(derivation)\n            untrackedEnd(prevUntracked)\n            allowStateReadsEnd(prevAllowStateReads)\n            return false\n        }\n    }\n}\n\nexport function isComputingDerivation() {\n    return globalState.trackingDerivation !== null // filter out actions inside computations\n}\n\nexport function checkIfStateModificationsAreAllowed(atom: IAtom) {\n    if (!__DEV__) {\n        return\n    }\n    const hasObservers = atom.observers_.size > 0\n    // Should not be possible to change observed state outside strict mode, except during initialization, see #563\n    if (\n        !globalState.allowStateChanges &&\n        (hasObservers || globalState.enforceActions === \"always\")\n    ) {\n        console.warn(\n            \"[MobX] \" +\n                (globalState.enforceActions\n                    ? \"Since strict-mode is enabled, changing (observed) observable values without using an action is not allowed. Tried to modify: \"\n                    : \"Side effects like changing state are not allowed at this point. Are you trying to modify state from, for example, a computed value or the render function of a React component? You can wrap side effects in 'runInAction' (or decorate functions with 'action') if needed. Tried to modify: \") +\n                atom.name_\n        )\n    }\n}\n\nexport function checkIfStateReadsAreAllowed(observable: IObservable) {\n    if (__DEV__ && !globalState.allowStateReads && globalState.observableRequiresReaction) {\n        console.warn(\n            `[mobx] Observable '${observable.name_}' being read outside a reactive context.`\n        )\n    }\n}\n\n/**\n * Executes the provided function `f` and tracks which observables are being accessed.\n * The tracking information is stored on the `derivation` object and the derivation is registered\n * as observer of any of the accessed observables.\n */\nexport function trackDerivedFunction<T>(derivation: IDerivation, f: () => T, context: any) {\n    const prevAllowStateReads = allowStateReadsStart(true)\n    changeDependenciesStateTo0(derivation)\n    // Preallocate array; will be trimmed by bindDependencies.\n    derivation.newObserving_ = new Array(\n        // Reserve constant space for initial dependencies, dynamic space otherwise.\n        // See https://github.com/mobxjs/mobx/pull/3833\n        derivation.runId_ === 0 ? 100 : derivation.observing_.length\n    )\n    derivation.unboundDepsCount_ = 0\n    derivation.runId_ = ++globalState.runId\n    const prevTracking = globalState.trackingDerivation\n    globalState.trackingDerivation = derivation\n    globalState.inBatch++\n    let result\n    if (globalState.disableErrorBoundaries === true) {\n        result = f.call(context)\n    } else {\n        try {\n            result = f.call(context)\n        } catch (e) {\n            result = new CaughtException(e)\n        }\n    }\n    globalState.inBatch--\n    globalState.trackingDerivation = prevTracking\n    bindDependencies(derivation)\n\n    warnAboutDerivationWithoutDependencies(derivation)\n    allowStateReadsEnd(prevAllowStateReads)\n    return result\n}\n\nfunction warnAboutDerivationWithoutDependencies(derivation: IDerivation) {\n    if (!__DEV__) {\n        return\n    }\n\n    if (derivation.observing_.length !== 0) {\n        return\n    }\n\n    if (\n        typeof derivation.requiresObservable_ === \"boolean\"\n            ? derivation.requiresObservable_\n            : globalState.reactionRequiresObservable\n    ) {\n        console.warn(\n            `[mobx] Derivation '${derivation.name_}' is created/updated without reading any observable value.`\n        )\n    }\n}\n\n/**\n * diffs newObserving with observing.\n * update observing to be newObserving with unique observables\n * notify observers that become observed/unobserved\n */\nfunction bindDependencies(derivation: IDerivation) {\n    // invariant(derivation.dependenciesState !== IDerivationState.NOT_TRACKING, \"INTERNAL ERROR bindDependencies expects derivation.dependenciesState !== -1\");\n    const prevObserving = derivation.observing_\n    const observing = (derivation.observing_ = derivation.newObserving_!)\n    let lowestNewObservingDerivationState = IDerivationState_.UP_TO_DATE_\n\n    // Go through all new observables and check diffValue: (this list can contain duplicates):\n    //   0: first occurrence, change to 1 and keep it\n    //   1: extra occurrence, drop it\n    let i0 = 0,\n        l = derivation.unboundDepsCount_\n    for (let i = 0; i < l; i++) {\n        const dep = observing[i]\n        if (dep.diffValue === 0) {\n            dep.diffValue = 1\n            if (i0 !== i) {\n                observing[i0] = dep\n            }\n            i0++\n        }\n\n        // Upcast is 'safe' here, because if dep is IObservable, `dependenciesState` will be undefined,\n        // not hitting the condition\n        if ((dep as any as IDerivation).dependenciesState_ > lowestNewObservingDerivationState) {\n            lowestNewObservingDerivationState = (dep as any as IDerivation).dependenciesState_\n        }\n    }\n    observing.length = i0\n\n    derivation.newObserving_ = null // newObserving shouldn't be needed outside tracking (statement moved down to work around FF bug, see #614)\n\n    // Go through all old observables and check diffValue: (it is unique after last bindDependencies)\n    //   0: it's not in new observables, unobserve it\n    //   1: it keeps being observed, don't want to notify it. change to 0\n    l = prevObserving.length\n    while (l--) {\n        const dep = prevObserving[l]\n        if (dep.diffValue === 0) {\n            removeObserver(dep, derivation)\n        }\n        dep.diffValue = 0\n    }\n\n    // Go through all new observables and check diffValue: (now it should be unique)\n    //   0: it was set to 0 in last loop. don't need to do anything.\n    //   1: it wasn't observed, let's observe it. set back to 0\n    while (i0--) {\n        const dep = observing[i0]\n        if (dep.diffValue === 1) {\n            dep.diffValue = 0\n            addObserver(dep, derivation)\n        }\n    }\n\n    // Some new observed derivations may become stale during this derivation computation\n    // so they have had no chance to propagate staleness (#916)\n    if (lowestNewObservingDerivationState !== IDerivationState_.UP_TO_DATE_) {\n        derivation.dependenciesState_ = lowestNewObservingDerivationState\n        derivation.onBecomeStale_()\n    }\n}\n\nexport function clearObserving(derivation: IDerivation) {\n    // invariant(globalState.inBatch > 0, \"INTERNAL ERROR clearObserving should be called only inside batch\");\n    const obs = derivation.observing_\n    derivation.observing_ = []\n    let i = obs.length\n    while (i--) {\n        removeObserver(obs[i], derivation)\n    }\n\n    derivation.dependenciesState_ = IDerivationState_.NOT_TRACKING_\n}\n\nexport function untracked<T>(action: () => T): T {\n    const prev = untrackedStart()\n    try {\n        return action()\n    } finally {\n        untrackedEnd(prev)\n    }\n}\n\nexport function untrackedStart(): IDerivation | null {\n    const prev = globalState.trackingDerivation\n    globalState.trackingDerivation = null\n    return prev\n}\n\nexport function untrackedEnd(prev: IDerivation | null) {\n    globalState.trackingDerivation = prev\n}\n\nexport function allowStateReadsStart(allowStateReads: boolean) {\n    const prev = globalState.allowStateReads\n    globalState.allowStateReads = allowStateReads\n    return prev\n}\n\nexport function allowStateReadsEnd(prev: boolean) {\n    globalState.allowStateReads = prev\n}\n\n/**\n * needed to keep `lowestObserverState` correct. when changing from (2 or 1) to 0\n *\n */\nexport function changeDependenciesStateTo0(derivation: IDerivation) {\n    if (derivation.dependenciesState_ === IDerivationState_.UP_TO_DATE_) {\n        return\n    }\n    derivation.dependenciesState_ = IDerivationState_.UP_TO_DATE_\n\n    const obs = derivation.observing_\n    let i = obs.length\n    while (i--) {\n        obs[i].lowestObserverState_ = IDerivationState_.UP_TO_DATE_\n    }\n}\n"
  },
  {
    "path": "packages/mobx/src/core/globalstate.ts",
    "content": "import { IDerivation, IObservable, Reaction, die, getGlobal } from \"../internal\"\nimport { ComputedValue } from \"./computedvalue\"\n\n/**\n * These values will persist if global state is reset\n */\nconst persistentKeys: (keyof MobXGlobals)[] = [\n    \"mobxGuid\",\n    \"spyListeners\",\n    \"enforceActions\",\n    \"computedRequiresReaction\",\n    \"reactionRequiresObservable\",\n    \"observableRequiresReaction\",\n    \"allowStateReads\",\n    \"disableErrorBoundaries\",\n    \"runId\",\n    \"UNCHANGED\",\n    \"useProxies\"\n]\n\nexport type IUNCHANGED = {}\n\nexport class MobXGlobals {\n    /**\n     * MobXGlobals version.\n     * MobX compatiblity with other versions loaded in memory as long as this version matches.\n     * It indicates that the global state still stores similar information\n     *\n     * N.B: this version is unrelated to the package version of MobX, and is only the version of the\n     * internal state storage of MobX, and can be the same across many different package versions\n     */\n    version = 6\n\n    /**\n     * globally unique token to signal unchanged\n     */\n    UNCHANGED: IUNCHANGED = {}\n\n    /**\n     * Currently running derivation\n     */\n    trackingDerivation: IDerivation | null = null\n\n    /**\n     * Currently running reaction. This determines if we currently have a reactive context.\n     * (Tracking derivation is also set for temporal tracking of computed values inside actions,\n     * but trackingReaction can only be set by a form of Reaction)\n     */\n    trackingContext: Reaction | ComputedValue<any> | null = null\n\n    /**\n     * Each time a derivation is tracked, it is assigned a unique run-id\n     */\n    runId = 0\n\n    /**\n     * 'guid' for general purpose. Will be persisted amongst resets.\n     */\n    mobxGuid = 0\n\n    /**\n     * Are we in a batch block? (and how many of them)\n     */\n    inBatch: number = 0\n\n    /**\n     * Observables that don't have observers anymore, and are about to be\n     * suspended, unless somebody else accesses it in the same batch\n     *\n     * @type {IObservable[]}\n     */\n    pendingUnobservations: IObservable[] = []\n\n    /**\n     * List of scheduled, not yet executed, reactions.\n     */\n    pendingReactions: Reaction[] = []\n\n    /**\n     * Are we currently processing reactions?\n     */\n    isRunningReactions = false\n\n    /**\n     * Is it allowed to change observables at this point?\n     * In general, MobX doesn't allow that when running computations and React.render.\n     * To ensure that those functions stay pure.\n     */\n    allowStateChanges = false\n\n    /**\n     * Is it allowed to read observables at this point?\n     * Used to hold the state needed for `observableRequiresReaction`\n     */\n    allowStateReads = true\n\n    /**\n     * If strict mode is enabled, state changes are by default not allowed\n     */\n    enforceActions: boolean | \"always\" = true\n\n    /**\n     * Spy callbacks\n     */\n    spyListeners: { (change: any): void }[] = []\n\n    /**\n     * Globally attached error handlers that react specifically to errors in reactions\n     */\n    globalReactionErrorHandlers: ((error: any, derivation: IDerivation) => void)[] = []\n\n    /**\n     * Warn if computed values are accessed outside a reactive context\n     */\n    computedRequiresReaction = false\n\n    /**\n     * (Experimental)\n     * Warn if you try to create to derivation / reactive context without accessing any observable.\n     */\n    reactionRequiresObservable = false\n\n    /**\n     * (Experimental)\n     * Warn if observables are accessed outside a reactive context\n     */\n    observableRequiresReaction = false\n\n    /*\n     * Don't catch and rethrow exceptions. This is useful for inspecting the state of\n     * the stack when an exception occurs while debugging.\n     */\n    disableErrorBoundaries = false\n\n    /*\n     * If true, we are already handling an exception in an action. Any errors in reactions should be suppressed, as\n     * they are not the cause, see: https://github.com/mobxjs/mobx/issues/1836\n     */\n    suppressReactionErrors = false\n\n    useProxies = true\n    /*\n     * print warnings about code that would fail if proxies weren't available\n     */\n    verifyProxies = false\n\n    /**\n     * False forces all object's descriptors to\n     * writable: true\n     * configurable: true\n     */\n    safeDescriptors = true\n}\n\nlet canMergeGlobalState = true\nlet isolateCalled = false\n\nexport let globalState: MobXGlobals = (function () {\n    let global = getGlobal()\n    if (global.__mobxInstanceCount > 0 && !global.__mobxGlobals) {\n        canMergeGlobalState = false\n    }\n    if (global.__mobxGlobals && global.__mobxGlobals.version !== new MobXGlobals().version) {\n        canMergeGlobalState = false\n    }\n\n    if (!canMergeGlobalState) {\n        // Because this is a IIFE we need to let isolateCalled a chance to change\n        // so we run it after the event loop completed at least 1 iteration\n        setTimeout(() => {\n            if (!isolateCalled) {\n                die(35)\n            }\n        }, 1)\n        return new MobXGlobals()\n    } else if (global.__mobxGlobals) {\n        global.__mobxInstanceCount += 1\n        if (!global.__mobxGlobals.UNCHANGED) {\n            global.__mobxGlobals.UNCHANGED = {}\n        } // make merge backward compatible\n        return global.__mobxGlobals\n    } else {\n        global.__mobxInstanceCount = 1\n        return (global.__mobxGlobals = new MobXGlobals())\n    }\n})()\n\nexport function isolateGlobalState() {\n    if (\n        globalState.pendingReactions.length ||\n        globalState.inBatch ||\n        globalState.isRunningReactions\n    ) {\n        die(36)\n    }\n    isolateCalled = true\n    if (canMergeGlobalState) {\n        let global = getGlobal()\n        if (--global.__mobxInstanceCount === 0) {\n            global.__mobxGlobals = undefined\n        }\n        globalState = new MobXGlobals()\n    }\n}\n\nexport function getGlobalState(): any {\n    return globalState\n}\n\n/**\n * For testing purposes only; this will break the internal state of existing observables,\n * but can be used to get back at a stable state after throwing errors\n */\nexport function resetGlobalState() {\n    const defaultGlobals = new MobXGlobals()\n    for (let key in defaultGlobals) {\n        if (persistentKeys.indexOf(key as any) === -1) {\n            globalState[key] = defaultGlobals[key]\n        }\n    }\n    globalState.allowStateChanges = !globalState.enforceActions\n}\n"
  },
  {
    "path": "packages/mobx/src/core/observable.ts",
    "content": "import {\n    Lambda,\n    ComputedValue,\n    IDependencyTree,\n    IDerivation,\n    IDerivationState_,\n    TraceMode,\n    getDependencyTree,\n    globalState,\n    runReactions,\n    checkIfStateReadsAreAllowed\n} from \"../internal\"\n\nexport interface IDepTreeNode {\n    name_: string\n    observing_?: IObservable[]\n}\n\nexport interface IObservable extends IDepTreeNode {\n    diffValue: number\n    /**\n     * Id of the derivation *run* that last accessed this observable.\n     * If this id equals the *run* id of the current derivation,\n     * the dependency is already established\n     */\n    lastAccessedBy_: number\n    isBeingObserved: boolean\n\n    lowestObserverState_: IDerivationState_ // Used to avoid redundant propagations\n    isPendingUnobservation: boolean // Used to push itself to global.pendingUnobservations at most once per batch.\n\n    observers_: Set<IDerivation>\n\n    onBUO(): void\n    onBO(): void\n\n    onBUOL: Set<Lambda> | undefined\n    onBOL: Set<Lambda> | undefined\n}\n\nexport function hasObservers(observable: IObservable): boolean {\n    return observable.observers_ && observable.observers_.size > 0\n}\n\nexport function getObservers(observable: IObservable): Set<IDerivation> {\n    return observable.observers_\n}\n\n// function invariantObservers(observable: IObservable) {\n//     const list = observable.observers\n//     const map = observable.observersIndexes\n//     const l = list.length\n//     for (let i = 0; i < l; i++) {\n//         const id = list[i].__mapid\n//         if (i) {\n//             invariant(map[id] === i, \"INTERNAL ERROR maps derivation.__mapid to index in list\") // for performance\n//         } else {\n//             invariant(!(id in map), \"INTERNAL ERROR observer on index 0 shouldn't be held in map.\") // for performance\n//         }\n//     }\n//     invariant(\n//         list.length === 0 || Object.keys(map).length === list.length - 1,\n//         \"INTERNAL ERROR there is no junk in map\"\n//     )\n// }\nexport function addObserver(observable: IObservable, node: IDerivation) {\n    // invariant(node.dependenciesState !== -1, \"INTERNAL ERROR, can add only dependenciesState !== -1\");\n    // invariant(observable._observers.indexOf(node) === -1, \"INTERNAL ERROR add already added node\");\n    // invariantObservers(observable);\n\n    observable.observers_.add(node)\n    if (observable.lowestObserverState_ > node.dependenciesState_) {\n        observable.lowestObserverState_ = node.dependenciesState_\n    }\n\n    // invariantObservers(observable);\n    // invariant(observable._observers.indexOf(node) !== -1, \"INTERNAL ERROR didn't add node\");\n}\n\nexport function removeObserver(observable: IObservable, node: IDerivation) {\n    // invariant(globalState.inBatch > 0, \"INTERNAL ERROR, remove should be called only inside batch\");\n    // invariant(observable._observers.indexOf(node) !== -1, \"INTERNAL ERROR remove already removed node\");\n    // invariantObservers(observable);\n    observable.observers_.delete(node)\n    if (observable.observers_.size === 0) {\n        // deleting last observer\n        queueForUnobservation(observable)\n    }\n    // invariantObservers(observable);\n    // invariant(observable._observers.indexOf(node) === -1, \"INTERNAL ERROR remove already removed node2\");\n}\n\nexport function queueForUnobservation(observable: IObservable) {\n    if (observable.isPendingUnobservation === false) {\n        // invariant(observable._observers.length === 0, \"INTERNAL ERROR, should only queue for unobservation unobserved observables\");\n        observable.isPendingUnobservation = true\n        globalState.pendingUnobservations.push(observable)\n    }\n}\n\n/**\n * Batch starts a transaction, at least for purposes of memoizing ComputedValues when nothing else does.\n * During a batch `onBecomeUnobserved` will be called at most once per observable.\n * Avoids unnecessary recalculations.\n */\nexport function startBatch() {\n    globalState.inBatch++\n}\n\nexport function endBatch() {\n    if (--globalState.inBatch === 0) {\n        runReactions()\n        // the batch is actually about to finish, all unobserving should happen here.\n        const list = globalState.pendingUnobservations\n        for (let i = 0; i < list.length; i++) {\n            const observable = list[i]\n            observable.isPendingUnobservation = false\n            if (observable.observers_.size === 0) {\n                if (observable.isBeingObserved) {\n                    // if this observable had reactive observers, trigger the hooks\n                    observable.isBeingObserved = false\n                    observable.onBUO()\n                }\n                if (observable instanceof ComputedValue) {\n                    // computed values are automatically teared down when the last observer leaves\n                    // this process happens recursively, this computed might be the last observabe of another, etc..\n                    observable.suspend_()\n                }\n            }\n        }\n        globalState.pendingUnobservations = []\n    }\n}\n\nexport function reportObserved(observable: IObservable): boolean {\n    checkIfStateReadsAreAllowed(observable)\n\n    const derivation = globalState.trackingDerivation\n    if (derivation !== null) {\n        /**\n         * Simple optimization, give each derivation run an unique id (runId)\n         * Check if last time this observable was accessed the same runId is used\n         * if this is the case, the relation is already known\n         */\n        if (derivation.runId_ !== observable.lastAccessedBy_) {\n            observable.lastAccessedBy_ = derivation.runId_\n            // Tried storing newObserving, or observing, or both as Set, but performance didn't come close...\n            derivation.newObserving_![derivation.unboundDepsCount_++] = observable\n            if (!observable.isBeingObserved && globalState.trackingContext) {\n                observable.isBeingObserved = true\n                observable.onBO()\n            }\n        }\n        return observable.isBeingObserved\n    } else if (observable.observers_.size === 0 && globalState.inBatch > 0) {\n        queueForUnobservation(observable)\n    }\n\n    return false\n}\n\n// function invariantLOS(observable: IObservable, msg: string) {\n//     // it's expensive so better not run it in produciton. but temporarily helpful for testing\n//     const min = getObservers(observable).reduce((a, b) => Math.min(a, b.dependenciesState), 2)\n//     if (min >= observable.lowestObserverState) return // <- the only assumption about `lowestObserverState`\n//     throw new Error(\n//         \"lowestObserverState is wrong for \" +\n//             msg +\n//             \" because \" +\n//             min +\n//             \" < \" +\n//             observable.lowestObserverState\n//     )\n// }\n\n/**\n * NOTE: current propagation mechanism will in case of self reruning autoruns behave unexpectedly\n * It will propagate changes to observers from previous run\n * It's hard or maybe impossible (with reasonable perf) to get it right with current approach\n * Hopefully self reruning autoruns aren't a feature people should depend on\n * Also most basic use cases should be ok\n */\n\n// Called by Atom when its value changes\nexport function propagateChanged(observable: IObservable) {\n    // invariantLOS(observable, \"changed start\");\n    if (observable.lowestObserverState_ === IDerivationState_.STALE_) {\n        return\n    }\n    observable.lowestObserverState_ = IDerivationState_.STALE_\n\n    // Ideally we use for..of here, but the downcompiled version is really slow...\n    observable.observers_.forEach(d => {\n        if (d.dependenciesState_ === IDerivationState_.UP_TO_DATE_) {\n            if (__DEV__ && d.isTracing_ !== TraceMode.NONE) {\n                logTraceInfo(d, observable)\n            }\n            d.onBecomeStale_()\n        }\n        d.dependenciesState_ = IDerivationState_.STALE_\n    })\n    // invariantLOS(observable, \"changed end\");\n}\n\n// Called by ComputedValue when it recalculate and its value changed\nexport function propagateChangeConfirmed(observable: IObservable) {\n    // invariantLOS(observable, \"confirmed start\");\n    if (observable.lowestObserverState_ === IDerivationState_.STALE_) {\n        return\n    }\n    observable.lowestObserverState_ = IDerivationState_.STALE_\n\n    observable.observers_.forEach(d => {\n        if (d.dependenciesState_ === IDerivationState_.POSSIBLY_STALE_) {\n            d.dependenciesState_ = IDerivationState_.STALE_\n            if (__DEV__ && d.isTracing_ !== TraceMode.NONE) {\n                logTraceInfo(d, observable)\n            }\n        } else if (\n            d.dependenciesState_ === IDerivationState_.UP_TO_DATE_ // this happens during computing of `d`, just keep lowestObserverState up to date.\n        ) {\n            observable.lowestObserverState_ = IDerivationState_.UP_TO_DATE_\n        }\n    })\n    // invariantLOS(observable, \"confirmed end\");\n}\n\n// Used by computed when its dependency changed, but we don't wan't to immediately recompute.\nexport function propagateMaybeChanged(observable: IObservable) {\n    // invariantLOS(observable, \"maybe start\");\n    if (observable.lowestObserverState_ !== IDerivationState_.UP_TO_DATE_) {\n        return\n    }\n    observable.lowestObserverState_ = IDerivationState_.POSSIBLY_STALE_\n\n    observable.observers_.forEach(d => {\n        if (d.dependenciesState_ === IDerivationState_.UP_TO_DATE_) {\n            d.dependenciesState_ = IDerivationState_.POSSIBLY_STALE_\n            d.onBecomeStale_()\n        }\n    })\n    // invariantLOS(observable, \"maybe end\");\n}\n\nfunction logTraceInfo(derivation: IDerivation, observable: IObservable) {\n    console.log(\n        `[mobx.trace] '${derivation.name_}' is invalidated due to a change in: '${observable.name_}'`\n    )\n    if (derivation.isTracing_ === TraceMode.BREAK) {\n        const lines = []\n        printDepTree(getDependencyTree(derivation), lines, 1)\n\n        // prettier-ignore\n        new Function(\n`debugger;\n/*\nTracing '${derivation.name_}'\n\nYou are entering this break point because derivation '${derivation.name_}' is being traced and '${observable.name_}' is now forcing it to update.\nJust follow the stacktrace you should now see in the devtools to see precisely what piece of your code is causing this update\nThe stackframe you are looking for is at least ~6-8 stack-frames up.\n\n${derivation instanceof ComputedValue ? derivation.derivation.toString().replace(/[*]\\//g, \"/\") : \"\"}\n\nThe dependencies for this derivation are:\n\n${lines.join(\"\\n\")}\n*/\n    `)()\n    }\n}\n\nfunction printDepTree(tree: IDependencyTree, lines: string[], depth: number) {\n    if (lines.length >= 1000) {\n        lines.push(\"(and many more)\")\n        return\n    }\n    lines.push(`${\"\\t\".repeat(depth - 1)}${tree.name}`)\n    if (tree.dependencies) {\n        tree.dependencies.forEach(child => printDepTree(child, lines, depth + 1))\n    }\n}\n"
  },
  {
    "path": "packages/mobx/src/core/reaction.ts",
    "content": "import {\n    $mobx,\n    IDerivation,\n    IDerivationState_,\n    IObservable,\n    Lambda,\n    TraceMode,\n    clearObserving,\n    createInstanceofPredicate,\n    endBatch,\n    getNextId,\n    globalState,\n    isCaughtException,\n    isSpyEnabled,\n    shouldCompute,\n    spyReport,\n    spyReportEnd,\n    spyReportStart,\n    startBatch,\n    trace,\n    trackDerivedFunction,\n    GenericAbortSignal\n} from \"../internal\"\n\nimport { getFlag, setFlag } from \"../utils/utils\"\n\n/**\n * Reactions are a special kind of derivations. Several things distinguishes them from normal reactive computations\n *\n * 1) They will always run, whether they are used by other computations or not.\n * This means that they are very suitable for triggering side effects like logging, updating the DOM and making network requests.\n * 2) They are not observable themselves\n * 3) They will always run after any 'normal' derivations\n * 4) They are allowed to change the state and thereby triggering themselves again, as long as they make sure the state propagates to a stable state in a reasonable amount of iterations.\n *\n * The state machine of a Reaction is as follows:\n *\n * 1) after creating, the reaction should be started by calling `runReaction` or by scheduling it (see also `autorun`)\n * 2) the `onInvalidate` handler should somehow result in a call to `this.track(someFunction)`\n * 3) all observables accessed in `someFunction` will be observed by this reaction.\n * 4) as soon as some of the dependencies has changed the Reaction will be rescheduled for another run (after the current mutation or transaction). `isScheduled` will yield true once a dependency is stale and during this period\n * 5) `onInvalidate` will be called, and we are back at step 1.\n *\n */\n\nexport interface IReactionPublic {\n    dispose(): void\n    trace(enterBreakPoint?: boolean): void\n}\n\nexport interface IReactionDisposer {\n    (): void\n    [$mobx]: Reaction\n}\n\nexport class Reaction implements IDerivation, IReactionPublic {\n    observing_: IObservable[] = [] // nodes we are looking at. Our value depends on these nodes\n    newObserving_: IObservable[] = []\n    dependenciesState_ = IDerivationState_.NOT_TRACKING_\n    runId_ = 0\n    unboundDepsCount_ = 0\n\n    private static readonly isDisposedMask_ = 0b00001\n    private static readonly isScheduledMask_ = 0b00010\n    private static readonly isTrackPendingMask_ = 0b00100\n    private static readonly isRunningMask_ = 0b01000\n    private static readonly diffValueMask_ = 0b10000\n    private flags_ = 0b00000\n\n    isTracing_: TraceMode = TraceMode.NONE\n\n    constructor(\n        public name_: string = __DEV__ ? \"Reaction@\" + getNextId() : \"Reaction\",\n        private onInvalidate_: () => void,\n        private errorHandler_?: (error: any, derivation: IDerivation) => void,\n        public requiresObservable_?\n    ) {}\n\n    get isDisposed() {\n        return getFlag(this.flags_, Reaction.isDisposedMask_)\n    }\n    set isDisposed(newValue: boolean) {\n        this.flags_ = setFlag(this.flags_, Reaction.isDisposedMask_, newValue)\n    }\n\n    get isScheduled() {\n        return getFlag(this.flags_, Reaction.isScheduledMask_)\n    }\n    set isScheduled(newValue: boolean) {\n        this.flags_ = setFlag(this.flags_, Reaction.isScheduledMask_, newValue)\n    }\n\n    get isTrackPending() {\n        return getFlag(this.flags_, Reaction.isTrackPendingMask_)\n    }\n    set isTrackPending(newValue: boolean) {\n        this.flags_ = setFlag(this.flags_, Reaction.isTrackPendingMask_, newValue)\n    }\n\n    get isRunning() {\n        return getFlag(this.flags_, Reaction.isRunningMask_)\n    }\n    set isRunning(newValue: boolean) {\n        this.flags_ = setFlag(this.flags_, Reaction.isRunningMask_, newValue)\n    }\n\n    get diffValue(): 0 | 1 {\n        return getFlag(this.flags_, Reaction.diffValueMask_) ? 1 : 0\n    }\n    set diffValue(newValue: 0 | 1) {\n        this.flags_ = setFlag(this.flags_, Reaction.diffValueMask_, newValue === 1 ? true : false)\n    }\n\n    onBecomeStale_() {\n        this.schedule_()\n    }\n\n    schedule_() {\n        if (!this.isScheduled) {\n            this.isScheduled = true\n            globalState.pendingReactions.push(this)\n            runReactions()\n        }\n    }\n\n    /**\n     * internal, use schedule() if you intend to kick off a reaction\n     */\n    runReaction_() {\n        if (!this.isDisposed) {\n            startBatch()\n            this.isScheduled = false\n            const prev = globalState.trackingContext\n            globalState.trackingContext = this\n            if (shouldCompute(this)) {\n                this.isTrackPending = true\n\n                try {\n                    this.onInvalidate_()\n                    if (__DEV__ && this.isTrackPending && isSpyEnabled()) {\n                        // onInvalidate didn't trigger track right away..\n                        spyReport({\n                            name: this.name_,\n                            type: \"scheduled-reaction\"\n                        })\n                    }\n                } catch (e) {\n                    this.reportExceptionInDerivation_(e)\n                }\n            }\n            globalState.trackingContext = prev\n            endBatch()\n        }\n    }\n\n    track(fn: () => void) {\n        if (this.isDisposed) {\n            return\n            // console.warn(\"Reaction already disposed\") // Note: Not a warning / error in mobx 4 either\n        }\n        startBatch()\n        const notify = isSpyEnabled()\n        let startTime\n        if (__DEV__ && notify) {\n            startTime = Date.now()\n            spyReportStart({\n                name: this.name_,\n                type: \"reaction\"\n            })\n        }\n        this.isRunning = true\n        const prevReaction = globalState.trackingContext // reactions could create reactions...\n        globalState.trackingContext = this\n        const result = trackDerivedFunction(this, fn, undefined)\n        globalState.trackingContext = prevReaction\n        this.isRunning = false\n        this.isTrackPending = false\n        if (this.isDisposed) {\n            // disposed during last run. Clean up everything that was bound after the dispose call.\n            clearObserving(this)\n        }\n        if (isCaughtException(result)) {\n            this.reportExceptionInDerivation_(result.cause)\n        }\n        if (__DEV__ && notify) {\n            spyReportEnd({\n                time: Date.now() - startTime\n            })\n        }\n        endBatch()\n    }\n\n    reportExceptionInDerivation_(error: any) {\n        if (this.errorHandler_) {\n            this.errorHandler_(error, this)\n            return\n        }\n\n        if (globalState.disableErrorBoundaries) {\n            throw error\n        }\n\n        const message = __DEV__\n            ? `[mobx] Encountered an uncaught exception that was thrown by a reaction or observer component, in: '${this}'`\n            : `[mobx] uncaught error in '${this}'`\n        if (!globalState.suppressReactionErrors) {\n            console.error(message, error)\n            /** If debugging brought you here, please, read the above message :-). Tnx! */\n        } else if (__DEV__) { console.warn(`[mobx] (error in reaction '${this.name_}' suppressed, fix error of causing action below)`) } // prettier-ignore\n\n        if (__DEV__ && isSpyEnabled()) {\n            spyReport({\n                type: \"error\",\n                name: this.name_,\n                message,\n                error: \"\" + error\n            })\n        }\n\n        globalState.globalReactionErrorHandlers.forEach(f => f(error, this))\n    }\n\n    dispose() {\n        if (!this.isDisposed) {\n            this.isDisposed = true\n            if (!this.isRunning) {\n                // if disposed while running, clean up later. Maybe not optimal, but rare case\n                startBatch()\n                clearObserving(this)\n                endBatch()\n            }\n        }\n    }\n\n    getDisposer_(abortSignal?: GenericAbortSignal): IReactionDisposer {\n        const dispose = (() => {\n            this.dispose()\n            abortSignal?.removeEventListener?.(\"abort\", dispose)\n        }) as IReactionDisposer\n        abortSignal?.addEventListener?.(\"abort\", dispose)\n        dispose[$mobx] = this\n\n        if (\"dispose\" in Symbol && typeof Symbol.dispose === \"symbol\") {\n            dispose[Symbol.dispose] = dispose\n        }\n\n        return dispose\n    }\n\n    toString() {\n        return `Reaction[${this.name_}]`\n    }\n\n    trace(enterBreakPoint: boolean = false) {\n        trace(this, enterBreakPoint)\n    }\n}\n\nexport function onReactionError(handler: (error: any, derivation: IDerivation) => void): Lambda {\n    globalState.globalReactionErrorHandlers.push(handler)\n    return () => {\n        const idx = globalState.globalReactionErrorHandlers.indexOf(handler)\n        if (idx >= 0) {\n            globalState.globalReactionErrorHandlers.splice(idx, 1)\n        }\n    }\n}\n\n/**\n * Magic number alert!\n * Defines within how many times a reaction is allowed to re-trigger itself\n * until it is assumed that this is gonna be a never ending loop...\n */\nconst MAX_REACTION_ITERATIONS = 100\n\nlet reactionScheduler: (fn: () => void) => void = f => f()\n\nexport function runReactions() {\n    // Trampolining, if runReactions are already running, new reactions will be picked up\n    if (globalState.inBatch > 0 || globalState.isRunningReactions) {\n        return\n    }\n    reactionScheduler(runReactionsHelper)\n}\n\nfunction runReactionsHelper() {\n    globalState.isRunningReactions = true\n    const allReactions = globalState.pendingReactions\n    let iterations = 0\n\n    // While running reactions, new reactions might be triggered.\n    // Hence we work with two variables and check whether\n    // we converge to no remaining reactions after a while.\n    while (allReactions.length > 0) {\n        if (++iterations === MAX_REACTION_ITERATIONS) {\n            console.error(\n                __DEV__\n                    ? `Reaction doesn't converge to a stable state after ${MAX_REACTION_ITERATIONS} iterations.` +\n                          ` Probably there is a cycle in the reactive function: ${allReactions[0]}`\n                    : `[mobx] cycle in reaction: ${allReactions[0]}`\n            )\n            allReactions.splice(0) // clear reactions\n        }\n        let remainingReactions = allReactions.splice(0)\n        for (let i = 0, l = remainingReactions.length; i < l; i++) {\n            remainingReactions[i].runReaction_()\n        }\n    }\n    globalState.isRunningReactions = false\n}\n\nexport const isReaction = createInstanceofPredicate(\"Reaction\", Reaction)\n\nexport function setReactionScheduler(fn: (f: () => void) => void) {\n    const baseScheduler = reactionScheduler\n    reactionScheduler = f => fn(() => baseScheduler(f))\n}\n"
  },
  {
    "path": "packages/mobx/src/core/spy.ts",
    "content": "import { IComputedDidChange } from \"./computedvalue\"\nimport { IValueDidChange, IBoxDidChange } from \"./../types/observablevalue\"\nimport { IObjectDidChange } from \"./../types/observableobject\"\nimport { IArrayDidChange } from \"./../types/observablearray\"\nimport { Lambda, globalState, once, ISetDidChange, IMapDidChange } from \"../internal\"\n\nexport function isSpyEnabled() {\n    return __DEV__ && !!globalState.spyListeners.length\n}\n\nexport type PureSpyEvent =\n    | { type: \"action\"; name: string; object: unknown; arguments: unknown[] }\n    | { type: \"scheduled-reaction\"; name: string }\n    | { type: \"reaction\"; name: string }\n    | { type: \"error\"; name: string; message: string; error: string }\n    | IComputedDidChange<unknown>\n    | IObjectDidChange<unknown>\n    | IArrayDidChange<unknown>\n    | IMapDidChange<unknown, unknown>\n    | ISetDidChange<unknown>\n    | IValueDidChange<unknown>\n    | IBoxDidChange<unknown>\n    | { type: \"report-end\"; spyReportEnd: true; time?: number }\n\ntype SpyEvent = PureSpyEvent & { spyReportStart?: true }\n\nexport function spyReport(event: SpyEvent) {\n    if (!__DEV__) {\n        return\n    } // dead code elimination can do the rest\n    if (!globalState.spyListeners.length) {\n        return\n    }\n    const listeners = globalState.spyListeners\n    for (let i = 0, l = listeners.length; i < l; i++) {\n        listeners[i](event)\n    }\n}\n\nexport function spyReportStart(event: PureSpyEvent) {\n    if (!__DEV__) {\n        return\n    }\n    const change = { ...event, spyReportStart: true as const }\n    spyReport(change)\n}\n\nconst END_EVENT: SpyEvent = { type: \"report-end\", spyReportEnd: true }\n\nexport function spyReportEnd(change?: { time?: number }) {\n    if (!__DEV__) {\n        return\n    }\n    if (change) {\n        spyReport({ ...change, type: \"report-end\", spyReportEnd: true })\n    } else {\n        spyReport(END_EVENT)\n    }\n}\n\nexport function spy(listener: (change: SpyEvent) => void): Lambda {\n    if (!__DEV__) {\n        console.warn(`[mobx.spy] Is a no-op in production builds`)\n        return function () {}\n    } else {\n        globalState.spyListeners.push(listener)\n        return once(() => {\n            globalState.spyListeners = globalState.spyListeners.filter(l => l !== listener)\n        })\n    }\n}\n"
  },
  {
    "path": "packages/mobx/src/errors.ts",
    "content": "const niceErrors = {\n    0: `Invalid value for configuration 'enforceActions', expected 'never', 'always' or 'observed'`,\n    1(annotationType, key: PropertyKey) {\n        return `Cannot apply '${annotationType}' to '${key.toString()}': Field not found.`\n    },\n    /*\n    2(prop) {\n        return `invalid decorator for '${prop.toString()}'`\n    },\n    3(prop) {\n        return `Cannot decorate '${prop.toString()}': action can only be used on properties with a function value.`\n    },\n    4(prop) {\n        return `Cannot decorate '${prop.toString()}': computed can only be used on getter properties.`\n    },\n    */\n    5: \"'keys()' can only be used on observable objects, arrays, sets and maps\",\n    6: \"'values()' can only be used on observable objects, arrays, sets and maps\",\n    7: \"'entries()' can only be used on observable objects, arrays and maps\",\n    8: \"'set()' can only be used on observable objects, arrays and maps\",\n    9: \"'remove()' can only be used on observable objects, arrays and maps\",\n    10: \"'has()' can only be used on observable objects, arrays and maps\",\n    11: \"'get()' can only be used on observable objects, arrays and maps\",\n    12: `Invalid annotation`,\n    13: `Dynamic observable objects cannot be frozen. If you're passing observables to 3rd party component/function that calls Object.freeze, pass copy instead: toJS(observable)`,\n    14: \"Intercept handlers should return nothing or a change object\",\n    15: `Observable arrays cannot be frozen. If you're passing observables to 3rd party component/function that calls Object.freeze, pass copy instead: toJS(observable)`,\n    16: `Modification exception: the internal structure of an observable array was changed.`,\n    17(index, length) {\n        return `[mobx.array] Index out of bounds, ${index} is larger than ${length}`\n    },\n    18: \"mobx.map requires Map polyfill for the current browser. Check babel-polyfill or core-js/es6/map.js\",\n    19(other) {\n        return \"Cannot initialize from classes that inherit from Map: \" + other.constructor.name\n    },\n    20(other) {\n        return \"Cannot initialize map from \" + other\n    },\n    21(dataStructure) {\n        return `Cannot convert to map from '${dataStructure}'`\n    },\n    22: \"mobx.set requires Set polyfill for the current browser. Check babel-polyfill or core-js/es6/set.js\",\n    23: \"It is not possible to get index atoms from arrays\",\n    24(thing) {\n        return \"Cannot obtain administration from \" + thing\n    },\n    25(property, name) {\n        return `the entry '${property}' does not exist in the observable map '${name}'`\n    },\n    26: \"please specify a property\",\n    27(property, name) {\n        return `no observable property '${property.toString()}' found on the observable object '${name}'`\n    },\n    28(thing) {\n        return \"Cannot obtain atom from \" + thing\n    },\n    29: \"Expecting some object\",\n    30: \"invalid action stack. did you forget to finish an action?\",\n    31: \"missing option for computed: get\",\n    32(name, derivation) {\n        return `Cycle detected in computation ${name}: ${derivation}`\n    },\n    33(name) {\n        return `The setter of computed value '${name}' is trying to update itself. Did you intend to update an _observable_ value, instead of the computed property?`\n    },\n    34(name) {\n        return `[ComputedValue '${name}'] It is not possible to assign a new value to a computed value.`\n    },\n    35: \"There are multiple, different versions of MobX active. Make sure MobX is loaded only once or use `configure({ isolateGlobalState: true })`\",\n    36: \"isolateGlobalState should be called before MobX is running any reactions\",\n    37(method) {\n        return `[mobx] \\`observableArray.${method}()\\` mutates the array in-place, which is not allowed inside a derivation. Use \\`array.slice().${method}()\\` instead`\n    },\n    38: \"'ownKeys()' can only be used on observable objects\",\n    39: \"'defineProperty()' can only be used on observable objects\"\n} as const\n\nconst errors: typeof niceErrors = __DEV__ ? niceErrors : ({} as any)\n\nexport function die(error: string | keyof typeof errors, ...args: any[]): never {\n    if (__DEV__) {\n        let e: any = typeof error === \"string\" ? error : errors[error]\n        if (typeof e === \"function\") e = e.apply(null, args as any)\n        throw new Error(`[MobX] ${e}`)\n    }\n    throw new Error(\n        typeof error === \"number\"\n            ? `[MobX] minified error nr: ${error}${\n                  args.length ? \" \" + args.map(String).join(\",\") : \"\"\n              }. Find the full error at: https://github.com/mobxjs/mobx/blob/main/packages/mobx/src/errors.ts`\n            : `[MobX] ${error}`\n    )\n}\n"
  },
  {
    "path": "packages/mobx/src/global.d.ts",
    "content": "declare const __DEV__: boolean\n"
  },
  {
    "path": "packages/mobx/src/internal.ts",
    "content": "/*\nThe only reason for this file to exist is pure horror:\nWithout it rollup can make the bundling fail at any point in time; when it rolls up the files in the wrong order\nit will cause undefined errors (for example because super classes or local variables not being hoisted).\nWith this file that will still happen,\nbut at least in this file we can magically reorder the imports with trial and error until the build succeeds again.\n*/\nexport * from \"./utils/global\"\nexport * from \"./errors\"\nexport * from \"./utils/utils\"\nexport * from \"./api/decorators\"\nexport * from \"./core/atom\"\nexport * from \"./utils/comparer\"\nexport * from \"./types/modifiers\"\nexport * from \"./types/overrideannotation\"\nexport * from \"./types/actionannotation\"\nexport * from \"./types/flowannotation\"\nexport * from \"./types/computedannotation\"\nexport * from \"./types/observableannotation\"\nexport * from \"./types/autoannotation\"\nexport * from \"./types/generic-abort-signal\"\nexport * from \"./api/observable\"\nexport * from \"./api/computed\"\nexport * from \"./core/action\"\nexport * from \"./types/observablevalue\"\nexport * from \"./core/computedvalue\"\nexport * from \"./core/derivation\"\nexport * from \"./core/globalstate\"\nexport * from \"./core/observable\"\nexport * from \"./core/reaction\"\nexport * from \"./core/spy\"\nexport * from \"./api/action\"\nexport * from \"./api/autorun\"\nexport * from \"./api/become-observed\"\nexport * from \"./api/configure\"\nexport * from \"./api/extendobservable\"\nexport * from \"./api/extras\"\nexport * from \"./api/flow\"\nexport * from \"./api/intercept-read\"\nexport * from \"./api/intercept\"\nexport * from \"./api/iscomputed\"\nexport * from \"./api/isobservable\"\nexport * from \"./api/object-api\"\nexport * from \"./api/observe\"\nexport * from \"./api/tojs\"\nexport * from \"./api/trace\"\nexport * from \"./api/transaction\"\nexport * from \"./api/when\"\nexport * from \"./types/dynamicobject\"\nexport * from \"./types/intercept-utils\"\nexport * from \"./types/listen-utils\"\nexport * from \"./api/makeObservable\"\nexport * from \"./types/observablearray\"\nexport * from \"./types/observablemap\"\nexport * from \"./types/observableset\"\nexport * from \"./types/observableobject\"\nexport * from \"./types/legacyobservablearray\"\nexport * from \"./types/type-utils\"\nexport * from \"./utils/eq\"\nexport * from \"./utils/iterable\"\nexport * from \"./api/annotation\"\n"
  },
  {
    "path": "packages/mobx/src/mobx.ts",
    "content": "/**\n * (c) Michel Weststrate 2015 - 2020\n * MIT Licensed\n *\n * Welcome to the mobx sources! To get a global overview of how MobX internally works,\n * this is a good place to start:\n * https://medium.com/@mweststrate/becoming-fully-reactive-an-in-depth-explanation-of-mobservable-55995262a254#.xvbh6qd74\n *\n * Source folders:\n * ===============\n *\n * - api/     Most of the public static methods exposed by the module can be found here.\n * - core/    Implementation of the MobX algorithm; atoms, derivations, reactions, dependency trees, optimizations. Cool stuff can be found here.\n * - types/   All the magic that is need to have observable objects, arrays and values is in this folder. Including the modifiers like `asFlat`.\n * - utils/   Utility stuff.\n *\n */\nimport { die } from \"./errors\"\nimport { getGlobal } from \"./utils/global\"\n;[\"Symbol\", \"Map\", \"Set\"].forEach(m => {\n    let g = getGlobal()\n    if (typeof g[m] === \"undefined\") {\n        die(`MobX requires global '${m}' to be available or polyfilled`)\n    }\n})\n\nimport { spy, getDebugName, $mobx } from \"./internal\"\n\nexport {\n    IObservable,\n    IDepTreeNode,\n    Reaction,\n    IReactionPublic,\n    IReactionDisposer,\n    untracked,\n    IAtom,\n    createAtom,\n    spy,\n    IComputedValue,\n    IEqualsComparer,\n    comparer,\n    IEnhancer,\n    IInterceptable,\n    IInterceptor,\n    IListenable,\n    IObjectWillChange,\n    IObjectDidChange,\n    isObservableObject,\n    IValueDidChange,\n    IValueWillChange,\n    IObservableValue,\n    isObservableValue as isBoxedObservable,\n    IObservableArray,\n    IArrayWillChange,\n    IArrayWillSplice,\n    IArraySplice,\n    IArrayUpdate,\n    IArrayDidChange,\n    isObservableArray,\n    IKeyValueMap,\n    ObservableMap,\n    IMapEntries,\n    IMapEntry,\n    IMapWillChange,\n    IMapDidChange,\n    isObservableMap,\n    IObservableMapInitialValues,\n    ObservableSet,\n    isObservableSet,\n    ISetDidChange,\n    ISetWillChange,\n    IObservableSetInitialValues,\n    transaction,\n    observable,\n    IObservableFactory,\n    CreateObservableOptions,\n    computed,\n    IComputedFactory,\n    isObservable,\n    isObservableProp,\n    isComputed,\n    isComputedProp,\n    extendObservable,\n    observe,\n    intercept,\n    autorun,\n    IAutorunOptions,\n    reaction,\n    IReactionOptions,\n    when,\n    IWhenOptions,\n    action,\n    isAction,\n    runInAction,\n    IActionFactory,\n    keys,\n    values,\n    entries,\n    set,\n    remove,\n    has,\n    get,\n    apiOwnKeys as ownKeys,\n    apiDefineProperty as defineProperty,\n    configure,\n    onBecomeObserved,\n    onBecomeUnobserved,\n    flow,\n    isFlow,\n    flowResult,\n    CancellablePromise,\n    FlowCancellationError,\n    isFlowCancellationError,\n    toJS,\n    trace,\n    IObserverTree,\n    IDependencyTree,\n    getDependencyTree,\n    getObserverTree,\n    resetGlobalState as _resetGlobalState,\n    getGlobalState as _getGlobalState,\n    getDebugName,\n    getAtom,\n    getAdministration as _getAdministration,\n    allowStateChanges as _allowStateChanges,\n    runInAction as _allowStateChangesInsideComputed, // This has become the default behavior in Mobx 6\n    Lambda,\n    $mobx,\n    isComputingDerivation as _isComputingDerivation,\n    onReactionError,\n    interceptReads as _interceptReads,\n    IComputedValueOptions,\n    IActionRunInfo,\n    _startAction,\n    _endAction,\n    allowStateReadsStart as _allowStateReadsStart,\n    allowStateReadsEnd as _allowStateReadsEnd,\n    makeObservable,\n    makeAutoObservable,\n    autoAction as _autoAction,\n    AnnotationsMap,\n    AnnotationMapEntry,\n    override\n} from \"./internal\"\n\n// Devtools support\ndeclare const __MOBX_DEVTOOLS_GLOBAL_HOOK__: { injectMobx: (any) => void }\nif (typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__ === \"object\") {\n    // See: https://github.com/andykog/mobx-devtools/\n    __MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({\n        spy,\n        extras: {\n            getDebugName\n        },\n        $mobx\n    })\n}\n"
  },
  {
    "path": "packages/mobx/src/types/actionannotation.ts",
    "content": "import {\n    ObservableObjectAdministration,\n    createAction,\n    isAction,\n    defineProperty,\n    die,\n    isFunction,\n    Annotation,\n    globalState,\n    MakeResult,\n    assert20223DecoratorType\n} from \"../internal\"\n\nexport function createActionAnnotation(name: string, options?: object): Annotation {\n    return {\n        annotationType_: name,\n        options_: options,\n        make_,\n        extend_,\n        decorate_20223_\n    }\n}\n\nfunction make_(\n    this: Annotation,\n    adm: ObservableObjectAdministration,\n    key: PropertyKey,\n    descriptor: PropertyDescriptor,\n    source: object\n): MakeResult {\n    // bound\n    if (this.options_?.bound) {\n        return this.extend_(adm, key, descriptor, false) === null\n            ? MakeResult.Cancel\n            : MakeResult.Break\n    }\n    // own\n    if (source === adm.target_) {\n        return this.extend_(adm, key, descriptor, false) === null\n            ? MakeResult.Cancel\n            : MakeResult.Continue\n    }\n    // prototype\n    if (isAction(descriptor.value)) {\n        // A prototype could have been annotated already by other constructor,\n        // rest of the proto chain must be annotated already\n        return MakeResult.Break\n    }\n    const actionDescriptor = createActionDescriptor(adm, this, key, descriptor, false)\n    defineProperty(source, key, actionDescriptor)\n    return MakeResult.Continue\n}\n\nfunction extend_(\n    this: Annotation,\n    adm: ObservableObjectAdministration,\n    key: PropertyKey,\n    descriptor: PropertyDescriptor,\n    proxyTrap: boolean\n): boolean | null {\n    const actionDescriptor = createActionDescriptor(adm, this, key, descriptor)\n    return adm.defineProperty_(key, actionDescriptor, proxyTrap)\n}\n\nfunction decorate_20223_(this: Annotation, mthd, context: DecoratorContext) {\n    if (__DEV__) {\n        assert20223DecoratorType(context, [\"method\", \"field\"])\n    }\n    const { kind, name, addInitializer } = context\n    const ann = this\n\n    const _createAction = m =>\n        createAction(ann.options_?.name ?? name!.toString(), m, ann.options_?.autoAction ?? false)\n\n    if (kind == \"field\") {\n        return function (initMthd) {\n            let mthd = initMthd\n            if (!isAction(mthd)) {\n                mthd = _createAction(mthd)\n            }\n            if (ann.options_?.bound) {\n                mthd = mthd.bind(this)\n                mthd.isMobxAction = true\n            }\n            return mthd\n        }\n    }\n\n    if (kind == \"method\") {\n        if (!isAction(mthd)) {\n            mthd = _createAction(mthd)\n        }\n\n        if (this.options_?.bound) {\n            addInitializer(function () {\n                const self = this as any\n                const bound = self[name].bind(self)\n                bound.isMobxAction = true\n                self[name] = bound\n            })\n        }\n\n        return mthd\n    }\n\n    die(\n        `Cannot apply '${ann.annotationType_}' to '${String(name)}' (kind: ${kind}):` +\n            `\\n'${ann.annotationType_}' can only be used on properties with a function value.`\n    )\n}\n\nfunction assertActionDescriptor(\n    adm: ObservableObjectAdministration,\n    { annotationType_ }: Annotation,\n    key: PropertyKey,\n    { value }: PropertyDescriptor\n) {\n    if (__DEV__ && !isFunction(value)) {\n        die(\n            `Cannot apply '${annotationType_}' to '${adm.name_}.${key.toString()}':` +\n                `\\n'${annotationType_}' can only be used on properties with a function value.`\n        )\n    }\n}\n\nexport function createActionDescriptor(\n    adm: ObservableObjectAdministration,\n    annotation: Annotation,\n    key: PropertyKey,\n    descriptor: PropertyDescriptor,\n    // provides ability to disable safeDescriptors for prototypes\n    safeDescriptors: boolean = globalState.safeDescriptors\n) {\n    assertActionDescriptor(adm, annotation, key, descriptor)\n    let { value } = descriptor\n    if (annotation.options_?.bound) {\n        value = value.bind(adm.proxy_ ?? adm.target_)\n    }\n    return {\n        value: createAction(\n            annotation.options_?.name ?? key.toString(),\n            value,\n            annotation.options_?.autoAction ?? false,\n            // https://github.com/mobxjs/mobx/discussions/3140\n            annotation.options_?.bound ? adm.proxy_ ?? adm.target_ : undefined\n        ),\n        // Non-configurable for classes\n        // prevents accidental field redefinition in subclass\n        configurable: safeDescriptors ? adm.isPlainObject_ : true,\n        // https://github.com/mobxjs/mobx/pull/2641#issuecomment-737292058\n        enumerable: false,\n        // Non-obsevable, therefore non-writable\n        // Also prevents rewriting in subclass constructor\n        writable: safeDescriptors ? false : true\n    }\n}\n"
  },
  {
    "path": "packages/mobx/src/types/autoannotation.ts",
    "content": "import {\n    ObservableObjectAdministration,\n    observable,\n    Annotation,\n    defineProperty,\n    createAction,\n    globalState,\n    flow,\n    computed,\n    autoAction,\n    isGenerator,\n    MakeResult,\n    die,\n    isAction\n} from \"../internal\"\n\nconst AUTO = \"true\"\n\nexport const autoAnnotation: Annotation = createAutoAnnotation()\n\nexport function createAutoAnnotation(options?: object): Annotation {\n    return {\n        annotationType_: AUTO,\n        options_: options,\n        make_,\n        extend_,\n        decorate_20223_\n    }\n}\n\nfunction make_(\n    adm: ObservableObjectAdministration,\n    key: PropertyKey,\n    descriptor: PropertyDescriptor,\n    source: object\n): MakeResult {\n    // getter -> computed\n    if (descriptor.get) {\n        return computed.make_(adm, key, descriptor, source)\n    }\n    // lone setter -> action setter\n    if (descriptor.set) {\n        // TODO make action applicable to setter and delegate to action.make_\n        const set = isAction(descriptor.set)\n            ? descriptor.set // See #4553\n            : (createAction(key.toString(), descriptor.set) as (v: any) => void)\n        // own\n        if (source === adm.target_) {\n            return adm.defineProperty_(key, {\n                configurable: globalState.safeDescriptors ? adm.isPlainObject_ : true,\n                set\n            }) === null\n                ? MakeResult.Cancel\n                : MakeResult.Continue\n        }\n        // proto\n        defineProperty(source, key, {\n            configurable: true,\n            set\n        })\n        return MakeResult.Continue\n    }\n    // function on proto -> autoAction/flow\n    if (source !== adm.target_ && typeof descriptor.value === \"function\") {\n        if (isGenerator(descriptor.value)) {\n            const flowAnnotation = this.options_?.autoBind ? flow.bound : flow\n            return flowAnnotation.make_(adm, key, descriptor, source)\n        }\n        const actionAnnotation = this.options_?.autoBind ? autoAction.bound : autoAction\n        return actionAnnotation.make_(adm, key, descriptor, source)\n    }\n    // other -> observable\n    // Copy props from proto as well, see test:\n    // \"decorate should work with Object.create\"\n    let observableAnnotation = this.options_?.deep === false ? observable.ref : observable\n    // if function respect autoBind option\n    if (typeof descriptor.value === \"function\" && this.options_?.autoBind) {\n        descriptor.value = descriptor.value.bind(adm.proxy_ ?? adm.target_)\n    }\n    return observableAnnotation.make_(adm, key, descriptor, source)\n}\n\nfunction extend_(\n    adm: ObservableObjectAdministration,\n    key: PropertyKey,\n    descriptor: PropertyDescriptor,\n    proxyTrap: boolean\n): boolean | null {\n    // getter -> computed\n    if (descriptor.get) {\n        return computed.extend_(adm, key, descriptor, proxyTrap)\n    }\n    // lone setter -> action setter\n    if (descriptor.set) {\n        // TODO make action applicable to setter and delegate to action.extend_\n        return adm.defineProperty_(\n            key,\n            {\n                configurable: globalState.safeDescriptors ? adm.isPlainObject_ : true,\n                set: createAction(key.toString(), descriptor.set) as (v: any) => void\n            },\n            proxyTrap\n        )\n    }\n    // other -> observable\n    // if function respect autoBind option\n    if (typeof descriptor.value === \"function\" && this.options_?.autoBind) {\n        descriptor.value = descriptor.value.bind(adm.proxy_ ?? adm.target_)\n    }\n    let observableAnnotation = this.options_?.deep === false ? observable.ref : observable\n    return observableAnnotation.extend_(adm, key, descriptor, proxyTrap)\n}\n\nfunction decorate_20223_(this: Annotation, desc, context: ClassGetterDecoratorContext) {\n    die(`'${this.annotationType_}' cannot be used as a decorator`)\n}\n"
  },
  {
    "path": "packages/mobx/src/types/computedannotation.ts",
    "content": "import {\n    ObservableObjectAdministration,\n    die,\n    Annotation,\n    MakeResult,\n    assert20223DecoratorType,\n    $mobx,\n    asObservableObject,\n    ComputedValue\n} from \"../internal\"\n\nexport function createComputedAnnotation(name: string, options?: object): Annotation {\n    return {\n        annotationType_: name,\n        options_: options,\n        make_,\n        extend_,\n        decorate_20223_\n    }\n}\n\nfunction make_(\n    this: Annotation,\n    adm: ObservableObjectAdministration,\n    key: PropertyKey,\n    descriptor: PropertyDescriptor\n): MakeResult {\n    return this.extend_(adm, key, descriptor, false) === null ? MakeResult.Cancel : MakeResult.Break\n}\n\nfunction extend_(\n    this: Annotation,\n    adm: ObservableObjectAdministration,\n    key: PropertyKey,\n    descriptor: PropertyDescriptor,\n    proxyTrap: boolean\n): boolean | null {\n    assertComputedDescriptor(adm, this, key, descriptor)\n    return adm.defineComputedProperty_(\n        key,\n        {\n            ...this.options_,\n            get: descriptor.get,\n            set: descriptor.set\n        },\n        proxyTrap\n    )\n}\n\nfunction decorate_20223_(this: Annotation, get, context: ClassGetterDecoratorContext) {\n    if (__DEV__) {\n        assert20223DecoratorType(context, [\"getter\"])\n    }\n    const ann = this\n    const { name: key, addInitializer } = context\n\n    addInitializer(function () {\n        const adm: ObservableObjectAdministration = asObservableObject(this)[$mobx]\n        const options = {\n            ...ann.options_,\n            get,\n            context: this\n        }\n        options.name ||= __DEV__\n            ? `${adm.name_}.${key.toString()}`\n            : `ObservableObject.${key.toString()}`\n        adm.values_.set(key, new ComputedValue(options))\n    })\n\n    return function () {\n        return this[$mobx].getObservablePropValue_(key)\n    }\n}\n\nfunction assertComputedDescriptor(\n    adm: ObservableObjectAdministration,\n    { annotationType_ }: Annotation,\n    key: PropertyKey,\n    { get }: PropertyDescriptor\n) {\n    if (__DEV__ && !get) {\n        die(\n            `Cannot apply '${annotationType_}' to '${adm.name_}.${key.toString()}':` +\n                `\\n'${annotationType_}' can only be used on getter(+setter) properties.`\n        )\n    }\n}\n"
  },
  {
    "path": "packages/mobx/src/types/decorator_fills.ts",
    "content": "// Hopefully these will be main-lined into Typescipt, but at the moment TS only declares the Contexts\n\nexport type ClassAccessorDecorator<This = any, Value = any> = (\n    value: ClassAccessorDecoratorTarget<This, Value>,\n    context: ClassAccessorDecoratorContext\n) => ClassAccessorDecoratorResult<This, Value> | void\n\nexport type ClassGetterDecorator<This = any, Value = any> = (\n    value: (this: This) => Value,\n    context: ClassGetterDecoratorContext\n) => ((this: This) => Value) | void\n\nexport type ClassSetterDecorator<This = any, Value = any> = (\n    value: (this: This, value: Value) => void,\n    context: ClassSetterDecoratorContext\n) => ((this: This, value: Value) => void) | void\n\nexport type ClassMethodDecorator<This = any, Value extends (...p: any[]) => any = any> = (\n    value: Value,\n    context: ClassMethodDecoratorContext<This, Value>\n) => Value | void\n\nexport type ClassFieldDecorator<This = any, Value extends (...p: any[]) => any = any> = (\n    value: Value,\n    context: ClassFieldDecoratorContext<This, Value>\n) => Value | void\n\nexport type Decorator =\n    | ClassAccessorDecorator\n    | ClassGetterDecorator\n    | ClassSetterDecorator\n    | ClassMethodDecorator\n    | ClassFieldDecorator\n"
  },
  {
    "path": "packages/mobx/src/types/dynamicobject.ts",
    "content": "import {\n    $mobx,\n    IIsObservableObject,\n    ObservableObjectAdministration,\n    warnAboutProxyRequirement,\n    assertProxies,\n    die,\n    isStringish,\n    globalState,\n    CreateObservableOptions,\n    asObservableObject\n} from \"../internal\"\n\nfunction getAdm(target): ObservableObjectAdministration {\n    return target[$mobx]\n}\n\n// Optimization: we don't need the intermediate objects and could have a completely custom administration for DynamicObjects,\n// and skip either the internal values map, or the base object with its property descriptors!\nconst objectProxyTraps: ProxyHandler<any> = {\n    has(target: IIsObservableObject, name: PropertyKey): boolean {\n        if (__DEV__ && globalState.trackingDerivation) {\n            warnAboutProxyRequirement(\n                \"detect new properties using the 'in' operator. Use 'has' from 'mobx' instead.\"\n            )\n        }\n        return getAdm(target).has_(name)\n    },\n    get(target: IIsObservableObject, name: PropertyKey): any {\n        return getAdm(target).get_(name)\n    },\n    set(target: IIsObservableObject, name: PropertyKey, value: any): boolean {\n        if (!isStringish(name)) {\n            return false\n        }\n        if (__DEV__ && !getAdm(target).values_.has(name)) {\n            warnAboutProxyRequirement(\n                \"add a new observable property through direct assignment. Use 'set' from 'mobx' instead.\"\n            )\n        }\n        // null (intercepted) -> true (success)\n        return getAdm(target).set_(name, value, true) ?? true\n    },\n    deleteProperty(target: IIsObservableObject, name: PropertyKey): boolean {\n        if (__DEV__) {\n            warnAboutProxyRequirement(\n                \"delete properties from an observable object. Use 'remove' from 'mobx' instead.\"\n            )\n        }\n        if (!isStringish(name)) {\n            return false\n        }\n        // null (intercepted) -> true (success)\n        return getAdm(target).delete_(name, true) ?? true\n    },\n    defineProperty(\n        target: IIsObservableObject,\n        name: PropertyKey,\n        descriptor: PropertyDescriptor\n    ): boolean {\n        if (__DEV__) {\n            warnAboutProxyRequirement(\n                \"define property on an observable object. Use 'defineProperty' from 'mobx' instead.\"\n            )\n        }\n        // null (intercepted) -> true (success)\n        return getAdm(target).defineProperty_(name, descriptor) ?? true\n    },\n    ownKeys(target: IIsObservableObject): ArrayLike<string | symbol> {\n        if (__DEV__ && globalState.trackingDerivation) {\n            warnAboutProxyRequirement(\n                \"iterate keys to detect added / removed properties. Use 'keys' from 'mobx' instead.\"\n            )\n        }\n        return getAdm(target).ownKeys_()\n    },\n    preventExtensions(target) {\n        die(13)\n    }\n}\n\nexport function asDynamicObservableObject(\n    target: any,\n    options?: CreateObservableOptions\n): IIsObservableObject {\n    assertProxies()\n    target = asObservableObject(target, options)\n    return (target[$mobx].proxy_ ??= new Proxy(target, objectProxyTraps))\n}\n"
  },
  {
    "path": "packages/mobx/src/types/flowannotation.ts",
    "content": "import {\n    ObservableObjectAdministration,\n    Annotation,\n    defineProperty,\n    die,\n    flow,\n    isFlow,\n    isFunction,\n    globalState,\n    MakeResult,\n    hasProp,\n    assert20223DecoratorType\n} from \"../internal\"\n\nexport function createFlowAnnotation(name: string, options?: object): Annotation {\n    return {\n        annotationType_: name,\n        options_: options,\n        make_,\n        extend_,\n        decorate_20223_\n    }\n}\n\nfunction make_(\n    this: Annotation,\n    adm: ObservableObjectAdministration,\n    key: PropertyKey,\n    descriptor: PropertyDescriptor,\n    source: object\n): MakeResult {\n    // own\n    if (source === adm.target_) {\n        return this.extend_(adm, key, descriptor, false) === null\n            ? MakeResult.Cancel\n            : MakeResult.Continue\n    }\n    // prototype\n    // bound - must annotate protos to support super.flow()\n    if (this.options_?.bound && (!hasProp(adm.target_, key) || !isFlow(adm.target_[key]))) {\n        if (this.extend_(adm, key, descriptor, false) === null) {\n            return MakeResult.Cancel\n        }\n    }\n    if (isFlow(descriptor.value)) {\n        // A prototype could have been annotated already by other constructor,\n        // rest of the proto chain must be annotated already\n        return MakeResult.Break\n    }\n    const flowDescriptor = createFlowDescriptor(adm, this, key, descriptor, false, false)\n    defineProperty(source, key, flowDescriptor)\n    return MakeResult.Continue\n}\n\nfunction extend_(\n    this: Annotation,\n    adm: ObservableObjectAdministration,\n    key: PropertyKey,\n    descriptor: PropertyDescriptor,\n    proxyTrap: boolean\n): boolean | null {\n    const flowDescriptor = createFlowDescriptor(adm, this, key, descriptor, this.options_?.bound)\n    return adm.defineProperty_(key, flowDescriptor, proxyTrap)\n}\n\nfunction decorate_20223_(this: Annotation, mthd, context: ClassMethodDecoratorContext) {\n    if (__DEV__) {\n        assert20223DecoratorType(context, [\"method\"])\n    }\n    const { name, addInitializer } = context\n\n    if (!isFlow(mthd)) {\n        mthd = flow(mthd)\n    }\n\n    if (this.options_?.bound) {\n        addInitializer(function () {\n            const self = this as any\n            const bound = self[name].bind(self)\n            bound.isMobXFlow = true\n            self[name] = bound\n        })\n    }\n\n    return mthd\n}\n\nfunction assertFlowDescriptor(\n    adm: ObservableObjectAdministration,\n    { annotationType_ }: Annotation,\n    key: PropertyKey,\n    { value }: PropertyDescriptor\n) {\n    if (__DEV__ && !isFunction(value)) {\n        die(\n            `Cannot apply '${annotationType_}' to '${adm.name_}.${key.toString()}':` +\n                `\\n'${annotationType_}' can only be used on properties with a generator function value.`\n        )\n    }\n}\n\nfunction createFlowDescriptor(\n    adm: ObservableObjectAdministration,\n    annotation: Annotation,\n    key: PropertyKey,\n    descriptor: PropertyDescriptor,\n    bound: boolean,\n    // provides ability to disable safeDescriptors for prototypes\n    safeDescriptors: boolean = globalState.safeDescriptors\n): PropertyDescriptor {\n    assertFlowDescriptor(adm, annotation, key, descriptor)\n    let { value } = descriptor\n    // In case of flow.bound, the descriptor can be from already annotated prototype\n    if (!isFlow(value)) {\n        value = flow(value)\n    }\n    if (bound) {\n        // We do not keep original function around, so we bind the existing flow\n        value = value.bind(adm.proxy_ ?? adm.target_)\n        // This is normally set by `flow`, but `bind` returns new function...\n        value.isMobXFlow = true\n    }\n    return {\n        value,\n        // Non-configurable for classes\n        // prevents accidental field redefinition in subclass\n        configurable: safeDescriptors ? adm.isPlainObject_ : true,\n        // https://github.com/mobxjs/mobx/pull/2641#issuecomment-737292058\n        enumerable: false,\n        // Non-obsevable, therefore non-writable\n        // Also prevents rewriting in subclass constructor\n        writable: safeDescriptors ? false : true\n    }\n}\n"
  },
  {
    "path": "packages/mobx/src/types/generic-abort-signal.ts",
    "content": "// https://github.com/mobxjs/mobx/issues/3582\nexport interface GenericAbortSignal {\n    readonly aborted: boolean\n    onabort?: ((...args: any) => any) | null\n    addEventListener?: (...args: any) => any\n    removeEventListener?: (...args: any) => any\n}\n"
  },
  {
    "path": "packages/mobx/src/types/intercept-utils.ts",
    "content": "import { Lambda, once, untrackedEnd, untrackedStart, die } from \"../internal\"\n\nexport type IInterceptor<T> = (change: T) => T | null\n\nexport interface IInterceptable<T> {\n    interceptors_: IInterceptor<T>[] | undefined\n}\n\nexport function hasInterceptors(interceptable: IInterceptable<any>) {\n    return interceptable.interceptors_ !== undefined && interceptable.interceptors_.length > 0\n}\n\nexport function registerInterceptor<T>(\n    interceptable: IInterceptable<T>,\n    handler: IInterceptor<T>\n): Lambda {\n    const interceptors = interceptable.interceptors_ || (interceptable.interceptors_ = [])\n    interceptors.push(handler)\n    return once(() => {\n        const idx = interceptors.indexOf(handler)\n        if (idx !== -1) {\n            interceptors.splice(idx, 1)\n        }\n    })\n}\n\nexport function interceptChange<T>(\n    interceptable: IInterceptable<T | null>,\n    change: T | null\n): T | null {\n    const prevU = untrackedStart()\n    try {\n        // Interceptor can modify the array, copy it to avoid concurrent modification, see #1950\n        const interceptors = [...(interceptable.interceptors_ || [])]\n        for (let i = 0, l = interceptors.length; i < l; i++) {\n            change = interceptors[i](change)\n            if (change && !(change as any).type) {\n                die(14)\n            }\n            if (!change) {\n                break\n            }\n        }\n        return change\n    } finally {\n        untrackedEnd(prevU)\n    }\n}\n"
  },
  {
    "path": "packages/mobx/src/types/legacyobservablearray.ts",
    "content": "import {\n    getNextId,\n    addHiddenFinalProp,\n    makeIterable,\n    addHiddenProp,\n    ObservableArrayAdministration,\n    $mobx,\n    arrayExtensions,\n    IEnhancer,\n    isObservableArray,\n    IObservableArray,\n    defineProperty,\n    initObservable\n} from \"../internal\"\n\n// Bug in safari 9.* (or iOS 9 safari mobile). See #364\nconst ENTRY_0 = createArrayEntryDescriptor(0)\n\nconst safariPrototypeSetterInheritanceBug = (() => {\n    let v = false\n    const p = {}\n    Object.defineProperty(p, \"0\", {\n        set: () => {\n            v = true\n        }\n    })\n    Object.create(p)[\"0\"] = 1\n    return v === false\n})()\n\n/**\n * This array buffer contains two lists of properties, so that all arrays\n * can recycle their property definitions, which significantly improves performance of creating\n * properties on the fly.\n */\nlet OBSERVABLE_ARRAY_BUFFER_SIZE = 0\n\n// Typescript workaround to make sure ObservableArray extends Array\nclass StubArray {}\nfunction inherit(ctor, proto) {\n    if (Object.setPrototypeOf) {\n        Object.setPrototypeOf(ctor.prototype, proto)\n    } else if (ctor.prototype.__proto__ !== undefined) {\n        ctor.prototype.__proto__ = proto\n    } else {\n        ctor.prototype = proto\n    }\n}\ninherit(StubArray, Array.prototype)\n\n// Weex proto freeze protection was here,\n// but it is unclear why the hack is need as MobX never changed the prototype\n// anyway, so removed it in V6\n\nexport class LegacyObservableArray<T> extends StubArray {\n    constructor(\n        initialValues: T[] | undefined,\n        enhancer: IEnhancer<T>,\n        name = __DEV__ ? \"ObservableArray@\" + getNextId() : \"ObservableArray\",\n        owned = false\n    ) {\n        super()\n        initObservable(() => {\n            const adm = new ObservableArrayAdministration(name, enhancer, owned, true)\n            adm.proxy_ = this as any\n            addHiddenFinalProp(this, $mobx, adm)\n\n            if (initialValues && initialValues.length) {\n                // @ts-ignore\n                this.spliceWithArray(0, 0, initialValues)\n            }\n\n            if (safariPrototypeSetterInheritanceBug) {\n                // Seems that Safari won't use numeric prototype setter until any * numeric property is\n                // defined on the instance. After that it works fine, even if this property is deleted.\n                Object.defineProperty(this, \"0\", ENTRY_0)\n            }\n        })\n    }\n\n    concat(...arrays: T[][]): T[] {\n        ;(this[$mobx] as ObservableArrayAdministration).atom_.reportObserved()\n        return Array.prototype.concat.apply(\n            (this as any).slice(),\n            //@ts-ignore\n            arrays.map(a => (isObservableArray(a) ? a.slice() : a))\n        )\n    }\n\n    get length(): number {\n        return (this[$mobx] as ObservableArrayAdministration).getArrayLength_()\n    }\n\n    set length(newLength: number) {\n        ;(this[$mobx] as ObservableArrayAdministration).setArrayLength_(newLength)\n    }\n\n    get [Symbol.toStringTag]() {\n        return \"Array\"\n    }\n\n    [Symbol.iterator]() {\n        const self = this\n        let nextIndex = 0\n        return makeIterable({\n            next() {\n                return nextIndex < self.length\n                    ? { value: self[nextIndex++], done: false }\n                    : { done: true, value: undefined }\n            }\n        })\n    }\n}\n\nObject.entries(arrayExtensions).forEach(([prop, fn]) => {\n    if (prop !== \"concat\") {\n        addHiddenProp(LegacyObservableArray.prototype, prop, fn)\n    }\n})\n\nfunction createArrayEntryDescriptor(index: number) {\n    return {\n        enumerable: false,\n        configurable: true,\n        get: function () {\n            return this[$mobx].get_(index)\n        },\n        set: function (value) {\n            this[$mobx].set_(index, value)\n        }\n    }\n}\n\nfunction createArrayBufferItem(index: number) {\n    defineProperty(LegacyObservableArray.prototype, \"\" + index, createArrayEntryDescriptor(index))\n}\n\nexport function reserveArrayBuffer(max: number) {\n    if (max > OBSERVABLE_ARRAY_BUFFER_SIZE) {\n        for (let index = OBSERVABLE_ARRAY_BUFFER_SIZE; index < max + 100; index++) {\n            createArrayBufferItem(index)\n        }\n        OBSERVABLE_ARRAY_BUFFER_SIZE = max\n    }\n}\n\nreserveArrayBuffer(1000)\n\nexport function createLegacyArray<T>(\n    initialValues: T[] | undefined,\n    enhancer: IEnhancer<T>,\n    name?: string\n): IObservableArray<T> {\n    return new LegacyObservableArray(initialValues, enhancer, name) as any\n}\n"
  },
  {
    "path": "packages/mobx/src/types/listen-utils.ts",
    "content": "import { Lambda, once, untrackedEnd, untrackedStart } from \"../internal\"\n\nexport interface IListenable {\n    changeListeners_: Function[] | undefined\n}\n\nexport function hasListeners(listenable: IListenable) {\n    return listenable.changeListeners_ !== undefined && listenable.changeListeners_.length > 0\n}\n\nexport function registerListener(listenable: IListenable, handler: Function): Lambda {\n    const listeners = listenable.changeListeners_ || (listenable.changeListeners_ = [])\n    listeners.push(handler)\n    return once(() => {\n        const idx = listeners.indexOf(handler)\n        if (idx !== -1) {\n            listeners.splice(idx, 1)\n        }\n    })\n}\n\nexport function notifyListeners<T>(listenable: IListenable, change: T) {\n    const prevU = untrackedStart()\n    let listeners = listenable.changeListeners_\n    if (!listeners) {\n        return\n    }\n    listeners = listeners.slice()\n    for (let i = 0, l = listeners.length; i < l; i++) {\n        listeners[i](change)\n    }\n    untrackedEnd(prevU)\n}\n"
  },
  {
    "path": "packages/mobx/src/types/modifiers.ts",
    "content": "import {\n    deepEqual,\n    isES6Map,\n    isES6Set,\n    isObservable,\n    isObservableArray,\n    isObservableMap,\n    isObservableSet,\n    isObservableObject,\n    isPlainObject,\n    observable,\n    die,\n    isAction,\n    autoAction,\n    flow,\n    isFlow,\n    isGenerator\n} from \"../internal\"\n\nexport interface IEnhancer<T> {\n    (newValue: T, oldValue: T | undefined, name: string): T\n}\n\nexport function deepEnhancer(v, _, name) {\n    // it is an observable already, done\n    if (isObservable(v)) {\n        return v\n    }\n\n    // something that can be converted and mutated?\n    if (Array.isArray(v)) {\n        return observable.array(v, { name })\n    }\n    if (isPlainObject(v)) {\n        return observable.object(v, undefined, { name })\n    }\n    if (isES6Map(v)) {\n        return observable.map(v, { name })\n    }\n    if (isES6Set(v)) {\n        return observable.set(v, { name })\n    }\n    if (typeof v === \"function\" && !isAction(v) && !isFlow(v)) {\n        if (isGenerator(v)) {\n            return flow(v)\n        } else {\n            return autoAction(name, v)\n        }\n    }\n    return v\n}\n\nexport function shallowEnhancer(v, _, name): any {\n    if (v === undefined || v === null) {\n        return v\n    }\n    if (isObservableObject(v) || isObservableArray(v) || isObservableMap(v) || isObservableSet(v)) {\n        return v\n    }\n    if (Array.isArray(v)) {\n        return observable.array(v, { name, deep: false })\n    }\n    if (isPlainObject(v)) {\n        return observable.object(v, undefined, { name, deep: false })\n    }\n    if (isES6Map(v)) {\n        return observable.map(v, { name, deep: false })\n    }\n    if (isES6Set(v)) {\n        return observable.set(v, { name, deep: false })\n    }\n\n    if (__DEV__) {\n        die(\n            \"The shallow modifier / decorator can only used in combination with arrays, objects, maps and sets\"\n        )\n    }\n}\n\nexport function referenceEnhancer(newValue?) {\n    // never turn into an observable\n    return newValue\n}\n\nexport function refStructEnhancer(v, oldValue): any {\n    if (__DEV__ && isObservable(v)) {\n        die(`observable.struct should not be used with observable values`)\n    }\n    if (deepEqual(v, oldValue)) {\n        return oldValue\n    }\n    return v\n}\n"
  },
  {
    "path": "packages/mobx/src/types/observableannotation.ts",
    "content": "import {\n    ObservableObjectAdministration,\n    deepEnhancer,\n    die,\n    Annotation,\n    MakeResult,\n    assert20223DecoratorType,\n    ObservableValue,\n    asObservableObject,\n    $mobx\n} from \"../internal\"\n\nexport function createObservableAnnotation(name: string, options?: object): Annotation {\n    return {\n        annotationType_: name,\n        options_: options,\n        make_,\n        extend_,\n        decorate_20223_\n    }\n}\n\nfunction make_(\n    this: Annotation,\n    adm: ObservableObjectAdministration,\n    key: PropertyKey,\n    descriptor: PropertyDescriptor\n): MakeResult {\n    return this.extend_(adm, key, descriptor, false) === null ? MakeResult.Cancel : MakeResult.Break\n}\n\nfunction extend_(\n    this: Annotation,\n    adm: ObservableObjectAdministration,\n    key: PropertyKey,\n    descriptor: PropertyDescriptor,\n    proxyTrap: boolean\n): boolean | null {\n    assertObservableDescriptor(adm, this, key, descriptor)\n    return adm.defineObservableProperty_(\n        key,\n        descriptor.value,\n        this.options_?.enhancer ?? deepEnhancer,\n        proxyTrap\n    )\n}\n\nfunction decorate_20223_(\n    this: Annotation,\n    desc,\n    context: ClassAccessorDecoratorContext | ClassFieldDecoratorContext\n) {\n    if (__DEV__) {\n        if (context.kind === \"field\") {\n            throw die(\n                `Please use \\`@observable accessor ${String(\n                    context.name\n                )}\\` instead of \\`@observable ${String(context.name)}\\``\n            )\n        }\n        assert20223DecoratorType(context, [\"accessor\"])\n    }\n\n    const ann = this\n    const { kind, name } = context\n\n    // The laziness here is not ideal... It's a workaround to how 2022.3 Decorators are implemented:\n    //   `addInitializer` callbacks are executed _before_ any accessors are defined (instead of the ideal-for-us right after each).\n    //   This means that, if we were to do our stuff in an `addInitializer`, we'd attempt to read a private slot\n    //   before it has been initialized. The runtime doesn't like that and throws a `Cannot read private member\n    //   from an object whose class did not declare it` error.\n    // TODO: it seems that this will not be required anymore in the final version of the spec\n    // See TODO: link\n    const initializedObjects = new WeakSet()\n\n    function initializeObservable(target, value) {\n        const adm: ObservableObjectAdministration = asObservableObject(target)[$mobx]\n        const observable = new ObservableValue(\n            value,\n            ann.options_?.enhancer ?? deepEnhancer,\n            __DEV__ ? `${adm.name_}.${name.toString()}` : `ObservableObject.${name.toString()}`,\n            false\n        )\n        adm.values_.set(name, observable)\n        initializedObjects.add(target)\n    }\n\n    if (kind == \"accessor\") {\n        return {\n            get() {\n                if (!initializedObjects.has(this)) {\n                    initializeObservable(this, desc.get.call(this))\n                }\n                return this[$mobx].getObservablePropValue_(name)\n            },\n            set(value) {\n                if (!initializedObjects.has(this)) {\n                    initializeObservable(this, value)\n                }\n                return this[$mobx].setObservablePropValue_(name, value)\n            },\n            init(value) {\n                if (!initializedObjects.has(this)) {\n                    initializeObservable(this, value)\n                }\n                return value\n            }\n        }\n    }\n\n    return\n}\n\nfunction assertObservableDescriptor(\n    adm: ObservableObjectAdministration,\n    { annotationType_ }: Annotation,\n    key: PropertyKey,\n    descriptor: PropertyDescriptor\n) {\n    if (__DEV__ && !(\"value\" in descriptor)) {\n        die(\n            `Cannot apply '${annotationType_}' to '${adm.name_}.${key.toString()}':` +\n                `\\n'${annotationType_}' cannot be used on getter/setter properties`\n        )\n    }\n}\n"
  },
  {
    "path": "packages/mobx/src/types/observablearray.ts",
    "content": "import {\n    $mobx,\n    Atom,\n    EMPTY_ARRAY,\n    IAtom,\n    IEnhancer,\n    IInterceptable,\n    IInterceptor,\n    IListenable,\n    Lambda,\n    addHiddenFinalProp,\n    checkIfStateModificationsAreAllowed,\n    createInstanceofPredicate,\n    getNextId,\n    hasInterceptors,\n    hasListeners,\n    interceptChange,\n    isObject,\n    isSpyEnabled,\n    notifyListeners,\n    registerInterceptor,\n    registerListener,\n    spyReportEnd,\n    spyReportStart,\n    assertProxies,\n    reserveArrayBuffer,\n    hasProp,\n    die,\n    globalState,\n    initObservable\n} from \"../internal\"\n\nconst SPLICE = \"splice\"\nexport const UPDATE = \"update\"\nexport const MAX_SPLICE_SIZE = 10000 // See e.g. https://github.com/mobxjs/mobx/issues/859\n\nexport interface IObservableArray<T = any> extends Array<T> {\n    spliceWithArray(index: number, deleteCount?: number, newItems?: T[]): T[]\n    clear(): T[]\n    replace(newItems: T[]): T[]\n    remove(value: T): boolean\n    toJSON(): T[]\n}\n\ninterface IArrayBaseChange<T> {\n    object: IObservableArray<T>\n    observableKind: \"array\"\n    debugObjectName: string\n    index: number\n}\n\nexport type IArrayDidChange<T = any> = IArrayUpdate<T> | IArraySplice<T>\n\nexport interface IArrayUpdate<T = any> extends IArrayBaseChange<T> {\n    type: \"update\"\n    newValue: T\n    oldValue: T\n}\n\nexport interface IArraySplice<T = any> extends IArrayBaseChange<T> {\n    type: \"splice\"\n    added: T[]\n    addedCount: number\n    removed: T[]\n    removedCount: number\n}\n\nexport interface IArrayWillChange<T = any> {\n    object: IObservableArray<T>\n    index: number\n    type: \"update\"\n    newValue: T\n}\n\nexport interface IArrayWillSplice<T = any> {\n    object: IObservableArray<T>\n    index: number\n    type: \"splice\"\n    added: T[]\n    removedCount: number\n}\n\nconst arrayTraps = {\n    get(target, name) {\n        const adm: ObservableArrayAdministration = target[$mobx]\n        if (name === $mobx) {\n            return adm\n        }\n        if (name === \"length\") {\n            return adm.getArrayLength_()\n        }\n        if (typeof name === \"string\" && !isNaN(name as any)) {\n            return adm.get_(parseInt(name))\n        }\n        if (hasProp(arrayExtensions, name)) {\n            return arrayExtensions[name]\n        }\n        return target[name]\n    },\n    set(target, name, value): boolean {\n        const adm: ObservableArrayAdministration = target[$mobx]\n        if (name === \"length\") {\n            adm.setArrayLength_(value)\n        }\n        if (typeof name === \"symbol\" || isNaN(name)) {\n            target[name] = value\n        } else {\n            // numeric string\n            adm.set_(parseInt(name), value)\n        }\n        return true\n    },\n    preventExtensions() {\n        die(15)\n    }\n}\n\nexport class ObservableArrayAdministration\n    implements IInterceptable<IArrayWillChange<any> | IArrayWillSplice<any>>, IListenable\n{\n    atom_: IAtom\n    readonly values_: any[] = [] // this is the prop that gets proxied, so can't replace it!\n    interceptors_\n    changeListeners_\n    enhancer_: (newV: any, oldV: any | undefined) => any\n    dehancer: any\n    proxy_!: IObservableArray<any>\n    lastKnownLength_ = 0\n\n    constructor(\n        name = __DEV__ ? \"ObservableArray@\" + getNextId() : \"ObservableArray\",\n        enhancer: IEnhancer<any>,\n        public owned_: boolean,\n        public legacyMode_: boolean\n    ) {\n        this.atom_ = new Atom(name)\n        this.enhancer_ = (newV, oldV) =>\n            enhancer(newV, oldV, __DEV__ ? name + \"[..]\" : \"ObservableArray[..]\")\n    }\n\n    dehanceValue_(value: any): any {\n        if (this.dehancer !== undefined) {\n            return this.dehancer(value)\n        }\n        return value\n    }\n\n    dehanceValues_(values: any[]): any[] {\n        if (this.dehancer !== undefined && values.length > 0) {\n            return values.map(this.dehancer) as any\n        }\n        return values\n    }\n\n    intercept_(handler: IInterceptor<IArrayWillChange<any> | IArrayWillSplice<any>>): Lambda {\n        return registerInterceptor<IArrayWillChange<any> | IArrayWillSplice<any>>(this, handler)\n    }\n\n    observe_(\n        listener: (changeData: IArrayDidChange<any>) => void,\n        fireImmediately = false\n    ): Lambda {\n        if (fireImmediately) {\n            listener(<IArraySplice<any>>{\n                observableKind: \"array\",\n                object: this.proxy_ as any,\n                debugObjectName: this.atom_.name_,\n                type: \"splice\",\n                index: 0,\n                added: this.values_.slice(),\n                addedCount: this.values_.length,\n                removed: [],\n                removedCount: 0\n            })\n        }\n        return registerListener(this, listener)\n    }\n\n    getArrayLength_(): number {\n        this.atom_.reportObserved()\n        return this.values_.length\n    }\n\n    setArrayLength_(newLength: number) {\n        if (typeof newLength !== \"number\" || isNaN(newLength) || newLength < 0) {\n            die(\"Out of range: \" + newLength)\n        }\n        let currentLength = this.values_.length\n        if (newLength === currentLength) {\n            return\n        } else if (newLength > currentLength) {\n            const newItems = new Array(newLength - currentLength)\n            for (let i = 0; i < newLength - currentLength; i++) {\n                newItems[i] = undefined\n            } // No Array.fill everywhere...\n            this.spliceWithArray_(currentLength, 0, newItems)\n        } else {\n            this.spliceWithArray_(newLength, currentLength - newLength)\n        }\n    }\n\n    updateArrayLength_(oldLength: number, delta: number) {\n        if (oldLength !== this.lastKnownLength_) {\n            die(16)\n        }\n        this.lastKnownLength_ += delta\n        if (this.legacyMode_ && delta > 0) {\n            reserveArrayBuffer(oldLength + delta + 1)\n        }\n    }\n\n    spliceWithArray_(index: number, deleteCount?: number, newItems?: any[]): any[] {\n        checkIfStateModificationsAreAllowed(this.atom_)\n        const length = this.values_.length\n\n        if (index === undefined) {\n            index = 0\n        } else if (index > length) {\n            index = length\n        } else if (index < 0) {\n            index = Math.max(0, length + index)\n        }\n\n        if (arguments.length === 1) {\n            deleteCount = length - index\n        } else if (deleteCount === undefined || deleteCount === null) {\n            deleteCount = 0\n        } else {\n            deleteCount = Math.max(0, Math.min(deleteCount, length - index))\n        }\n\n        if (newItems === undefined) {\n            newItems = EMPTY_ARRAY\n        }\n\n        if (hasInterceptors(this)) {\n            const change = interceptChange<IArrayWillSplice<any>>(this as any, {\n                object: this.proxy_ as any,\n                type: SPLICE,\n                index,\n                removedCount: deleteCount,\n                added: newItems\n            })\n            if (!change) {\n                return EMPTY_ARRAY\n            }\n            deleteCount = change.removedCount\n            newItems = change.added\n        }\n\n        newItems =\n            newItems.length === 0 ? newItems : newItems.map(v => this.enhancer_(v, undefined))\n        if (this.legacyMode_ || __DEV__) {\n            const lengthDelta = newItems.length - deleteCount\n            this.updateArrayLength_(length, lengthDelta) // checks if internal array wasn't modified\n        }\n        const res = this.spliceItemsIntoValues_(index, deleteCount, newItems)\n\n        if (deleteCount !== 0 || newItems.length !== 0) {\n            this.notifyArraySplice_(index, newItems, res)\n        }\n        return this.dehanceValues_(res)\n    }\n\n    spliceItemsIntoValues_(index: number, deleteCount: number, newItems: any[]): any[] {\n        if (newItems.length < MAX_SPLICE_SIZE) {\n            return this.values_.splice(index, deleteCount, ...newItems)\n        } else {\n            // The items removed by the splice\n            const res = this.values_.slice(index, index + deleteCount)\n            // The items that that should remain at the end of the array\n            let oldItems = this.values_.slice(index + deleteCount)\n            // New length is the previous length + addition count - deletion count\n            this.values_.length += newItems.length - deleteCount\n            for (let i = 0; i < newItems.length; i++) {\n                this.values_[index + i] = newItems[i]\n            }\n            for (let i = 0; i < oldItems.length; i++) {\n                this.values_[index + newItems.length + i] = oldItems[i]\n            }\n            return res\n        }\n    }\n\n    notifyArrayChildUpdate_(index: number, newValue: any, oldValue: any) {\n        const notifySpy = !this.owned_ && isSpyEnabled()\n        const notify = hasListeners(this)\n        const change: IArrayDidChange | null =\n            notify || notifySpy\n                ? ({\n                      observableKind: \"array\",\n                      object: this.proxy_,\n                      type: UPDATE,\n                      debugObjectName: this.atom_.name_,\n                      index,\n                      newValue,\n                      oldValue\n                  } as const)\n                : null\n\n        // The reason why this is on right hand side here (and not above), is this way the uglifier will drop it, but it won't\n        // cause any runtime overhead in development mode without NODE_ENV set, unless spying is enabled\n        if (__DEV__ && notifySpy) {\n            spyReportStart(change!)\n        }\n        this.atom_.reportChanged()\n        if (notify) {\n            notifyListeners(this, change)\n        }\n        if (__DEV__ && notifySpy) {\n            spyReportEnd()\n        }\n    }\n\n    notifyArraySplice_(index: number, added: any[], removed: any[]) {\n        const notifySpy = !this.owned_ && isSpyEnabled()\n        const notify = hasListeners(this)\n        const change: IArraySplice | null =\n            notify || notifySpy\n                ? ({\n                      observableKind: \"array\",\n                      object: this.proxy_,\n                      debugObjectName: this.atom_.name_,\n                      type: SPLICE,\n                      index,\n                      removed,\n                      added,\n                      removedCount: removed.length,\n                      addedCount: added.length\n                  } as const)\n                : null\n\n        if (__DEV__ && notifySpy) {\n            spyReportStart(change!)\n        }\n        this.atom_.reportChanged()\n        // conform: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/observe\n        if (notify) {\n            notifyListeners(this, change)\n        }\n        if (__DEV__ && notifySpy) {\n            spyReportEnd()\n        }\n    }\n\n    get_(index: number): any | undefined {\n        if (this.legacyMode_ && index >= this.values_.length) {\n            console.warn(\n                __DEV__\n                    ? `[mobx.array] Attempt to read an array index (${index}) that is out of bounds (${this.values_.length}). Please check length first. Out of bound indices will not be tracked by MobX`\n                    : `[mobx] Out of bounds read: ${index}`\n            )\n            return undefined\n        }\n        this.atom_.reportObserved()\n        return this.dehanceValue_(this.values_[index])\n    }\n\n    set_(index: number, newValue: any) {\n        const values = this.values_\n        if (this.legacyMode_ && index > values.length) {\n            // out of bounds\n            die(17, index, values.length)\n        }\n        if (index < values.length) {\n            // update at index in range\n            checkIfStateModificationsAreAllowed(this.atom_)\n            const oldValue = values[index]\n            if (hasInterceptors(this)) {\n                const change = interceptChange<IArrayWillChange<any>>(this as any, {\n                    type: UPDATE,\n                    object: this.proxy_ as any, // since \"this\" is the real array we need to pass its proxy\n                    index,\n                    newValue\n                })\n                if (!change) {\n                    return\n                }\n                newValue = change.newValue\n            }\n            newValue = this.enhancer_(newValue, oldValue)\n            const changed = newValue !== oldValue\n            if (changed) {\n                values[index] = newValue\n                this.notifyArrayChildUpdate_(index, newValue, oldValue)\n            }\n        } else {\n            // For out of bound index, we don't create an actual sparse array,\n            // but rather fill the holes with undefined (same as setArrayLength_).\n            // This could be considered a bug.\n            const newItems = new Array(index + 1 - values.length)\n            for (let i = 0; i < newItems.length - 1; i++) {\n                newItems[i] = undefined\n            } // No Array.fill everywhere...\n            newItems[newItems.length - 1] = newValue\n            this.spliceWithArray_(values.length, 0, newItems)\n        }\n    }\n}\n\nexport function createObservableArray<T>(\n    initialValues: T[] | undefined,\n    enhancer: IEnhancer<T>,\n    name = __DEV__ ? \"ObservableArray@\" + getNextId() : \"ObservableArray\",\n    owned = false\n): IObservableArray<T> {\n    assertProxies()\n    return initObservable(() => {\n        const adm = new ObservableArrayAdministration(name, enhancer, owned, false)\n        addHiddenFinalProp(adm.values_, $mobx, adm)\n        const proxy = new Proxy(adm.values_, arrayTraps) as any\n        adm.proxy_ = proxy\n        if (initialValues && initialValues.length) {\n            adm.spliceWithArray_(0, 0, initialValues)\n        }\n        return proxy\n    })\n}\n\n// eslint-disable-next-line\nexport var arrayExtensions = {\n    clear(): any[] {\n        return this.splice(0)\n    },\n\n    replace(newItems: any[]) {\n        const adm: ObservableArrayAdministration = this[$mobx]\n        return adm.spliceWithArray_(0, adm.values_.length, newItems)\n    },\n\n    // Used by JSON.stringify\n    toJSON(): any[] {\n        return this.slice()\n    },\n\n    /*\n     * functions that do alter the internal structure of the array, (based on lib.es6.d.ts)\n     * since these functions alter the inner structure of the array, the have side effects.\n     * Because the have side effects, they should not be used in computed function,\n     * and for that reason the do not call dependencyState.notifyObserved\n     */\n    splice(index: number, deleteCount?: number, ...newItems: any[]): any[] {\n        const adm: ObservableArrayAdministration = this[$mobx]\n        switch (arguments.length) {\n            case 0:\n                return []\n            case 1:\n                return adm.spliceWithArray_(index)\n            case 2:\n                return adm.spliceWithArray_(index, deleteCount)\n        }\n        return adm.spliceWithArray_(index, deleteCount, newItems)\n    },\n\n    spliceWithArray(index: number, deleteCount?: number, newItems?: any[]): any[] {\n        return (this[$mobx] as ObservableArrayAdministration).spliceWithArray_(\n            index,\n            deleteCount,\n            newItems\n        )\n    },\n\n    push(...items: any[]): number {\n        const adm: ObservableArrayAdministration = this[$mobx]\n        adm.spliceWithArray_(adm.values_.length, 0, items)\n        return adm.values_.length\n    },\n\n    pop() {\n        return this.splice(Math.max(this[$mobx].values_.length - 1, 0), 1)[0]\n    },\n\n    shift() {\n        return this.splice(0, 1)[0]\n    },\n\n    unshift(...items: any[]): number {\n        const adm: ObservableArrayAdministration = this[$mobx]\n        adm.spliceWithArray_(0, 0, items)\n        return adm.values_.length\n    },\n\n    reverse(): any[] {\n        // reverse by default mutates in place before returning the result\n        // which makes it both a 'derivation' and a 'mutation'.\n        if (globalState.trackingDerivation) {\n            die(37, \"reverse\")\n        }\n        this.replace(this.slice().reverse())\n        return this\n    },\n\n    sort(): any[] {\n        // sort by default mutates in place before returning the result\n        // which goes against all good practices. Let's not change the array in place!\n        if (globalState.trackingDerivation) {\n            die(37, \"sort\")\n        }\n        const copy = this.slice()\n        copy.sort.apply(copy, arguments)\n        this.replace(copy)\n        return this\n    },\n\n    remove(value: any): boolean {\n        const adm: ObservableArrayAdministration = this[$mobx]\n        const idx = adm.dehanceValues_(adm.values_).indexOf(value)\n        if (idx > -1) {\n            this.splice(idx, 1)\n            return true\n        }\n        return false\n    }\n}\n\n/**\n * Wrap function from prototype\n * Without this, everything works as well, but this works\n * faster as everything works on unproxied values\n */\naddArrayExtension(\"at\", simpleFunc)\naddArrayExtension(\"concat\", simpleFunc)\naddArrayExtension(\"flat\", simpleFunc)\naddArrayExtension(\"includes\", simpleFunc)\naddArrayExtension(\"indexOf\", simpleFunc)\naddArrayExtension(\"join\", simpleFunc)\naddArrayExtension(\"lastIndexOf\", simpleFunc)\naddArrayExtension(\"slice\", simpleFunc)\naddArrayExtension(\"toString\", simpleFunc)\naddArrayExtension(\"toLocaleString\", simpleFunc)\naddArrayExtension(\"toSorted\", simpleFunc)\naddArrayExtension(\"toSpliced\", simpleFunc)\naddArrayExtension(\"with\", simpleFunc)\n// map\naddArrayExtension(\"every\", mapLikeFunc)\naddArrayExtension(\"filter\", mapLikeFunc)\naddArrayExtension(\"find\", mapLikeFunc)\naddArrayExtension(\"findIndex\", mapLikeFunc)\naddArrayExtension(\"findLast\", mapLikeFunc)\naddArrayExtension(\"findLastIndex\", mapLikeFunc)\naddArrayExtension(\"flatMap\", mapLikeFunc)\naddArrayExtension(\"forEach\", mapLikeFunc)\naddArrayExtension(\"map\", mapLikeFunc)\naddArrayExtension(\"some\", mapLikeFunc)\naddArrayExtension(\"toReversed\", mapLikeFunc)\n// reduce\naddArrayExtension(\"reduce\", reduceLikeFunc)\naddArrayExtension(\"reduceRight\", reduceLikeFunc)\n\nfunction addArrayExtension(funcName, funcFactory) {\n    if (typeof Array.prototype[funcName] === \"function\") {\n        arrayExtensions[funcName] = funcFactory(funcName)\n    }\n}\n\n// Report and delegate to dehanced array\nfunction simpleFunc(funcName) {\n    return function () {\n        const adm: ObservableArrayAdministration = this[$mobx]\n        adm.atom_.reportObserved()\n        const dehancedValues = adm.dehanceValues_(adm.values_)\n        return dehancedValues[funcName].apply(dehancedValues, arguments)\n    }\n}\n\n// Make sure callbacks receive correct array arg #2326\nfunction mapLikeFunc(funcName) {\n    return function (callback, thisArg) {\n        const adm: ObservableArrayAdministration = this[$mobx]\n        adm.atom_.reportObserved()\n        const dehancedValues = adm.dehanceValues_(adm.values_)\n        return dehancedValues[funcName]((element, index) => {\n            return callback.call(thisArg, element, index, this)\n        })\n    }\n}\n\n// Make sure callbacks receive correct array arg #2326\nfunction reduceLikeFunc(funcName) {\n    return function () {\n        const adm: ObservableArrayAdministration = this[$mobx]\n        adm.atom_.reportObserved()\n        const dehancedValues = adm.dehanceValues_(adm.values_)\n        // #2432 - reduce behavior depends on arguments.length\n        const callback = arguments[0]\n        arguments[0] = (accumulator, currentValue, index) => {\n            return callback(accumulator, currentValue, index, this)\n        }\n        return dehancedValues[funcName].apply(dehancedValues, arguments)\n    }\n}\n\nconst isObservableArrayAdministration = createInstanceofPredicate(\n    \"ObservableArrayAdministration\",\n    ObservableArrayAdministration\n)\n\nexport function isObservableArray(thing): thing is IObservableArray<any> {\n    return isObject(thing) && isObservableArrayAdministration(thing[$mobx])\n}\n"
  },
  {
    "path": "packages/mobx/src/types/observablemap.ts",
    "content": "import {\n    $mobx,\n    IEnhancer,\n    IInterceptable,\n    IInterceptor,\n    IListenable,\n    Lambda,\n    ObservableValue,\n    checkIfStateModificationsAreAllowed,\n    createAtom,\n    createInstanceofPredicate,\n    makeIterable,\n    deepEnhancer,\n    getNextId,\n    getPlainObjectKeys,\n    hasInterceptors,\n    hasListeners,\n    interceptChange,\n    isES6Map,\n    isPlainES6Map,\n    isPlainObject,\n    isSpyEnabled,\n    notifyListeners,\n    referenceEnhancer,\n    registerInterceptor,\n    registerListener,\n    spyReportEnd,\n    spyReportStart,\n    stringifyKey,\n    transaction,\n    untracked,\n    onBecomeUnobserved,\n    globalState,\n    die,\n    isFunction,\n    UPDATE,\n    IAtom,\n    PureSpyEvent,\n    initObservable\n} from \"../internal\"\n\nexport interface IKeyValueMap<V = any> {\n    [key: string]: V\n}\n\nexport type IMapEntry<K = any, V = any> = [K, V]\nexport type IReadonlyMapEntry<K = any, V = any> = readonly [K, V]\nexport type IMapEntries<K = any, V = any> = IMapEntry<K, V>[]\nexport type IReadonlyMapEntries<K = any, V = any> = readonly IReadonlyMapEntry<K, V>[]\n\nexport type IMapDidChange<K = any, V = any> = { observableKind: \"map\"; debugObjectName: string } & (\n    | {\n          object: ObservableMap<K, V>\n          name: K // actual the key or index, but this is based on the ancient .observe proposal for consistency\n          type: \"update\"\n          newValue: V\n          oldValue: V\n      }\n    | {\n          object: ObservableMap<K, V>\n          name: K\n          type: \"add\"\n          newValue: V\n      }\n    | {\n          object: ObservableMap<K, V>\n          name: K\n          type: \"delete\"\n          oldValue: V\n      }\n)\n\nexport interface IMapWillChange<K = any, V = any> {\n    object: ObservableMap<K, V>\n    type: \"update\" | \"add\" | \"delete\"\n    name: K\n    newValue?: V\n}\n\nconst ObservableMapMarker = {}\n\nexport const ADD = \"add\"\nexport const DELETE = \"delete\"\n\nexport type IObservableMapInitialValues<K = any, V = any> =\n    | IMapEntries<K, V>\n    | IReadonlyMapEntries<K, V>\n    | IKeyValueMap<V>\n    | Map<K, V>\n\n// just extend Map? See also https://gist.github.com/nestharus/13b4d74f2ef4a2f4357dbd3fc23c1e54\n// But: https://github.com/mobxjs/mobx/issues/1556\nexport class ObservableMap<K = any, V = any>\n    implements Map<K, V>, IInterceptable<IMapWillChange<K, V>>, IListenable\n{\n    [$mobx] = ObservableMapMarker\n    data_!: Map<K, ObservableValue<V>>\n    hasMap_!: Map<K, ObservableValue<boolean>> // hasMap, not hashMap >-).\n    keysAtom_!: IAtom\n    interceptors_\n    changeListeners_\n    dehancer: any\n\n    constructor(\n        initialData?: IObservableMapInitialValues<K, V>,\n        public enhancer_: IEnhancer<V> = deepEnhancer,\n        public name_ = __DEV__ ? \"ObservableMap@\" + getNextId() : \"ObservableMap\"\n    ) {\n        if (!isFunction(Map)) {\n            die(18)\n        }\n        initObservable(() => {\n            this.keysAtom_ = createAtom(__DEV__ ? `${this.name_}.keys()` : \"ObservableMap.keys()\")\n            this.data_ = new Map()\n            this.hasMap_ = new Map()\n            if (initialData) {\n                this.merge(initialData)\n            }\n        })\n    }\n\n    private has_(key: K): boolean {\n        return this.data_.has(key)\n    }\n\n    has(key: K): boolean {\n        if (!globalState.trackingDerivation) {\n            return this.has_(key)\n        }\n\n        let entry = this.hasMap_.get(key)\n        if (!entry) {\n            const newEntry = (entry = new ObservableValue(\n                this.has_(key),\n                referenceEnhancer,\n                __DEV__ ? `${this.name_}.${stringifyKey(key)}?` : \"ObservableMap.key?\",\n                false\n            ))\n            this.hasMap_.set(key, newEntry)\n            onBecomeUnobserved(newEntry, () => this.hasMap_.delete(key))\n        }\n\n        return entry.get()\n    }\n\n    set(key: K, value: V) {\n        const hasKey = this.has_(key)\n        if (hasInterceptors(this)) {\n            const change = interceptChange<IMapWillChange<K, V>>(this, {\n                type: hasKey ? UPDATE : ADD,\n                object: this,\n                newValue: value,\n                name: key\n            })\n            if (!change) {\n                return this\n            }\n            value = change.newValue!\n        }\n        if (hasKey) {\n            this.updateValue_(key, value)\n        } else {\n            this.addValue_(key, value)\n        }\n        return this\n    }\n\n    delete(key: K): boolean {\n        checkIfStateModificationsAreAllowed(this.keysAtom_)\n        if (hasInterceptors(this)) {\n            const change = interceptChange<IMapWillChange<K, V>>(this, {\n                type: DELETE,\n                object: this,\n                name: key\n            })\n            if (!change) {\n                return false\n            }\n        }\n        if (this.has_(key)) {\n            const notifySpy = isSpyEnabled()\n            const notify = hasListeners(this)\n            const change: IMapDidChange<K, V> | null =\n                notify || notifySpy\n                    ? {\n                          observableKind: \"map\",\n                          debugObjectName: this.name_,\n                          type: DELETE,\n                          object: this,\n                          oldValue: (<any>this.data_.get(key)).value_,\n                          name: key\n                      }\n                    : null\n\n            if (__DEV__ && notifySpy) {\n                spyReportStart(change! as PureSpyEvent)\n            } // TODO fix type\n            transaction(() => {\n                this.keysAtom_.reportChanged()\n                this.hasMap_.get(key)?.setNewValue_(false)\n                const observable = this.data_.get(key)!\n                observable.setNewValue_(undefined as any)\n                this.data_.delete(key)\n            })\n            if (notify) {\n                notifyListeners(this, change)\n            }\n            if (__DEV__ && notifySpy) {\n                spyReportEnd()\n            }\n            return true\n        }\n        return false\n    }\n\n    private updateValue_(key: K, newValue: V | undefined) {\n        const observable = this.data_.get(key)!\n        newValue = (observable as any).prepareNewValue_(newValue) as V\n        if (newValue !== globalState.UNCHANGED) {\n            const notifySpy = isSpyEnabled()\n            const notify = hasListeners(this)\n            const change: IMapDidChange<K, V> | null =\n                notify || notifySpy\n                    ? {\n                          observableKind: \"map\",\n                          debugObjectName: this.name_,\n                          type: UPDATE,\n                          object: this,\n                          oldValue: (observable as any).value_,\n                          name: key,\n                          newValue\n                      }\n                    : null\n            if (__DEV__ && notifySpy) {\n                spyReportStart(change! as PureSpyEvent)\n            } // TODO fix type\n            observable.setNewValue_(newValue as V)\n            if (notify) {\n                notifyListeners(this, change)\n            }\n            if (__DEV__ && notifySpy) {\n                spyReportEnd()\n            }\n        }\n    }\n\n    private addValue_(key: K, newValue: V) {\n        checkIfStateModificationsAreAllowed(this.keysAtom_)\n        transaction(() => {\n            const observable = new ObservableValue(\n                newValue,\n                this.enhancer_,\n                __DEV__ ? `${this.name_}.${stringifyKey(key)}` : \"ObservableMap.key\",\n                false\n            )\n            this.data_.set(key, observable)\n            newValue = (observable as any).value_ // value might have been changed\n            this.hasMap_.get(key)?.setNewValue_(true)\n            this.keysAtom_.reportChanged()\n        })\n        const notifySpy = isSpyEnabled()\n        const notify = hasListeners(this)\n        const change: IMapDidChange<K, V> | null =\n            notify || notifySpy\n                ? {\n                      observableKind: \"map\",\n                      debugObjectName: this.name_,\n                      type: ADD,\n                      object: this,\n                      name: key,\n                      newValue\n                  }\n                : null\n        if (__DEV__ && notifySpy) {\n            spyReportStart(change! as PureSpyEvent)\n        } // TODO fix type\n        if (notify) {\n            notifyListeners(this, change)\n        }\n        if (__DEV__ && notifySpy) {\n            spyReportEnd()\n        }\n    }\n\n    get(key: K): V | undefined {\n        if (this.has(key)) {\n            return this.dehanceValue_(this.data_.get(key)!.get())\n        }\n        return this.dehanceValue_(undefined)\n    }\n\n    private dehanceValue_<X extends V | undefined>(value: X): X {\n        if (this.dehancer !== undefined) {\n            return this.dehancer(value)\n        }\n        return value\n    }\n\n    keys(): MapIterator<K> {\n        this.keysAtom_.reportObserved()\n        return this.data_.keys()\n    }\n\n    values(): MapIterator<V> {\n        const self = this\n        const keys = this.keys()\n        return makeIterableForMap({\n            next() {\n                const { done, value } = keys.next()\n                return {\n                    done,\n                    value: done ? (undefined as any) : self.get(value)\n                }\n            }\n        })\n    }\n\n    entries(): MapIterator<IMapEntry<K, V>> {\n        const self = this\n        const keys = this.keys()\n        return makeIterableForMap({\n            next() {\n                const { done, value } = keys.next()\n                return {\n                    done,\n                    value: done ? (undefined as any) : ([value, self.get(value)!] as [K, V])\n                }\n            }\n        })\n    }\n\n    [Symbol.iterator]() {\n        return this.entries()\n    }\n\n    forEach(callback: (value: V, key: K, object: Map<K, V>) => void, thisArg?) {\n        for (const [key, value] of this) {\n            callback.call(thisArg, value, key, this)\n        }\n    }\n\n    /** Merge another object into this object, returns this. */\n    merge(other?: IObservableMapInitialValues<K, V>): ObservableMap<K, V> {\n        if (isObservableMap(other)) {\n            other = new Map(other)\n        }\n        transaction(() => {\n            if (isPlainObject(other)) {\n                getPlainObjectKeys(other).forEach((key: any) =>\n                    this.set(key as K, (other as IKeyValueMap)[key])\n                )\n            } else if (Array.isArray(other)) {\n                other.forEach(([key, value]) => this.set(key, value))\n            } else if (isES6Map(other)) {\n                if (!isPlainES6Map(other)) {\n                    die(19, other)\n                }\n                other.forEach((value, key) => this.set(key, value))\n            } else if (other !== null && other !== undefined) {\n                die(20, other)\n            }\n        })\n        return this\n    }\n\n    clear() {\n        transaction(() => {\n            untracked(() => {\n                for (const key of this.keys()) {\n                    this.delete(key)\n                }\n            })\n        })\n    }\n\n    replace(values: IObservableMapInitialValues<K, V>): ObservableMap<K, V> {\n        // Implementation requirements:\n        // - respect ordering of replacement map\n        // - allow interceptors to run and potentially prevent individual operations\n        // - don't recreate observables that already exist in original map (so we don't destroy existing subscriptions)\n        // - don't _keysAtom.reportChanged if the keys of resulting map are indentical (order matters!)\n        // - note that result map may differ from replacement map due to the interceptors\n        transaction(() => {\n            // Convert to map so we can do quick key lookups\n            const replacementMap = convertToMap(values)\n            const orderedData = new Map()\n            // Used for optimization\n            let keysReportChangedCalled = false\n            // Delete keys that don't exist in replacement map\n            // if the key deletion is prevented by interceptor\n            // add entry at the beginning of the result map\n            for (const key of this.data_.keys()) {\n                // Concurrently iterating/deleting keys\n                // iterator should handle this correctly\n                if (!replacementMap.has(key)) {\n                    const deleted = this.delete(key)\n                    // Was the key removed?\n                    if (deleted) {\n                        // _keysAtom.reportChanged() was already called\n                        keysReportChangedCalled = true\n                    } else {\n                        // Delete prevented by interceptor\n                        const value = this.data_.get(key)\n                        orderedData.set(key, value)\n                    }\n                }\n            }\n            // Merge entries\n            for (const [key, value] of replacementMap.entries()) {\n                // We will want to know whether a new key is added\n                const keyExisted = this.data_.has(key)\n                // Add or update value\n                this.set(key, value)\n                // The addition could have been prevent by interceptor\n                if (this.data_.has(key)) {\n                    // The update could have been prevented by interceptor\n                    // and also we want to preserve existing values\n                    // so use value from _data map (instead of replacement map)\n                    const value = this.data_.get(key)\n                    orderedData.set(key, value)\n                    // Was a new key added?\n                    if (!keyExisted) {\n                        // _keysAtom.reportChanged() was already called\n                        keysReportChangedCalled = true\n                    }\n                }\n            }\n            // Check for possible key order change\n            if (!keysReportChangedCalled) {\n                if (this.data_.size !== orderedData.size) {\n                    // If size differs, keys are definitely modified\n                    this.keysAtom_.reportChanged()\n                } else {\n                    const iter1 = this.data_.keys()\n                    const iter2 = orderedData.keys()\n                    let next1 = iter1.next()\n                    let next2 = iter2.next()\n                    while (!next1.done) {\n                        if (next1.value !== next2.value) {\n                            this.keysAtom_.reportChanged()\n                            break\n                        }\n                        next1 = iter1.next()\n                        next2 = iter2.next()\n                    }\n                }\n            }\n            // Use correctly ordered map\n            this.data_ = orderedData\n        })\n        return this\n    }\n\n    get size(): number {\n        this.keysAtom_.reportObserved()\n        return this.data_.size\n    }\n\n    toString(): string {\n        return \"[object ObservableMap]\"\n    }\n\n    toJSON(): [K, V][] {\n        return Array.from(this)\n    }\n\n    get [Symbol.toStringTag]() {\n        return \"Map\"\n    }\n\n    /**\n     * Observes this object. Triggers for the events 'add', 'update' and 'delete'.\n     * See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/observe\n     * for callback details\n     */\n    observe_(listener: (changes: IMapDidChange<K, V>) => void, fireImmediately?: boolean): Lambda {\n        if (__DEV__ && fireImmediately === true) {\n            die(\"`observe` doesn't support fireImmediately=true in combination with maps.\")\n        }\n        return registerListener(this, listener)\n    }\n\n    intercept_(handler: IInterceptor<IMapWillChange<K, V>>): Lambda {\n        return registerInterceptor(this, handler)\n    }\n}\n\n// eslint-disable-next-line\nexport var isObservableMap = createInstanceofPredicate(\"ObservableMap\", ObservableMap) as (\n    thing: any\n) => thing is ObservableMap<any, any>\n\nfunction makeIterableForMap<T>(iterator: Iterator<T>): MapIterator<T> {\n    iterator[Symbol.toStringTag] = \"MapIterator\"\n    return makeIterable<T, BuiltinIteratorReturn>(iterator)\n}\n\nfunction convertToMap(dataStructure: any): Map<any, any> {\n    if (isES6Map(dataStructure) || isObservableMap(dataStructure)) {\n        return dataStructure\n    } else if (Array.isArray(dataStructure)) {\n        return new Map(dataStructure)\n    } else if (isPlainObject(dataStructure)) {\n        const map = new Map()\n        for (const key in dataStructure) {\n            map.set(key, dataStructure[key])\n        }\n        return map\n    } else {\n        return die(21, dataStructure)\n    }\n}\n"
  },
  {
    "path": "packages/mobx/src/types/observableobject.ts",
    "content": "import {\n    CreateObservableOptions,\n    getAnnotationFromOptions,\n    propagateChanged,\n    isAnnotation,\n    $mobx,\n    Atom,\n    Annotation,\n    ComputedValue,\n    IAtom,\n    IComputedValueOptions,\n    IEnhancer,\n    IInterceptable,\n    IListenable,\n    Lambda,\n    ObservableValue,\n    addHiddenProp,\n    createInstanceofPredicate,\n    endBatch,\n    getNextId,\n    hasInterceptors,\n    hasListeners,\n    interceptChange,\n    isObject,\n    isPlainObject,\n    isSpyEnabled,\n    notifyListeners,\n    referenceEnhancer,\n    registerInterceptor,\n    registerListener,\n    spyReportEnd,\n    spyReportStart,\n    startBatch,\n    stringifyKey,\n    globalState,\n    ADD,\n    UPDATE,\n    die,\n    hasProp,\n    getDescriptor,\n    storedAnnotationsSymbol,\n    ownKeys,\n    isOverride,\n    defineProperty,\n    autoAnnotation,\n    getAdministration,\n    getDebugName,\n    objectPrototype,\n    MakeResult,\n    checkIfStateModificationsAreAllowed\n} from \"../internal\"\n\nconst descriptorCache = Object.create(null)\n\nexport type IObjectDidChange<T = any> = {\n    observableKind: \"object\"\n    name: PropertyKey\n    object: T\n    debugObjectName: string\n} & (\n    | {\n          type: \"add\"\n          newValue: any\n      }\n    | {\n          type: \"update\"\n          oldValue: any\n          newValue: any\n      }\n    | {\n          type: \"remove\"\n          oldValue: any\n      }\n)\n\nexport type IObjectWillChange<T = any> =\n    | {\n          object: T\n          type: \"update\" | \"add\"\n          name: PropertyKey\n          newValue: any\n      }\n    | {\n          object: T\n          type: \"remove\"\n          name: PropertyKey\n      }\n\nconst REMOVE = \"remove\"\n\nexport class ObservableObjectAdministration\n    implements IInterceptable<IObjectWillChange>, IListenable\n{\n    keysAtom_: IAtom\n    changeListeners_\n    interceptors_\n    proxy_: any\n    isPlainObject_: boolean\n    appliedAnnotations_?: object\n    private pendingKeys_: undefined | Map<PropertyKey, ObservableValue<boolean>>\n\n    constructor(\n        public target_: any,\n        public values_ = new Map<PropertyKey, ObservableValue<any> | ComputedValue<any>>(),\n        public name_: string,\n        // Used anytime annotation is not explicitely provided\n        public defaultAnnotation_: Annotation = autoAnnotation\n    ) {\n        this.keysAtom_ = new Atom(__DEV__ ? `${this.name_}.keys` : \"ObservableObject.keys\")\n        // Optimization: we use this frequently\n        this.isPlainObject_ = isPlainObject(this.target_)\n        if (__DEV__ && !isAnnotation(this.defaultAnnotation_)) {\n            die(`defaultAnnotation must be valid annotation`)\n        }\n        if (__DEV__) {\n            // Prepare structure for tracking which fields were already annotated\n            this.appliedAnnotations_ = {}\n        }\n    }\n\n    getObservablePropValue_(key: PropertyKey): any {\n        return this.values_.get(key)!.get()\n    }\n\n    setObservablePropValue_(key: PropertyKey, newValue): boolean | null {\n        const observable = this.values_.get(key)\n        if (observable instanceof ComputedValue) {\n            observable.set(newValue)\n            return true\n        }\n\n        // intercept\n        if (hasInterceptors(this)) {\n            const change = interceptChange<IObjectWillChange>(this, {\n                type: UPDATE,\n                object: this.proxy_ || this.target_,\n                name: key,\n                newValue\n            })\n            if (!change) {\n                return null\n            }\n            newValue = (change as any).newValue\n        }\n        newValue = (observable as any).prepareNewValue_(newValue)\n\n        // notify spy & observers\n        if (newValue !== globalState.UNCHANGED) {\n            const notify = hasListeners(this)\n            const notifySpy = __DEV__ && isSpyEnabled()\n            const change: IObjectDidChange | null =\n                notify || notifySpy\n                    ? {\n                          type: UPDATE,\n                          observableKind: \"object\",\n                          debugObjectName: this.name_,\n                          object: this.proxy_ || this.target_,\n                          oldValue: (observable as any).value_,\n                          name: key,\n                          newValue\n                      }\n                    : null\n\n            if (__DEV__ && notifySpy) {\n                spyReportStart(change!)\n            }\n            ;(observable as ObservableValue<any>).setNewValue_(newValue)\n            if (notify) {\n                notifyListeners(this, change)\n            }\n            if (__DEV__ && notifySpy) {\n                spyReportEnd()\n            }\n        }\n        return true\n    }\n\n    get_(key: PropertyKey): any {\n        if (globalState.trackingDerivation && !hasProp(this.target_, key)) {\n            // Key doesn't exist yet, subscribe for it in case it's added later\n            this.has_(key)\n        }\n        return this.target_[key]\n    }\n\n    /**\n     * @param {PropertyKey} key\n     * @param {any} value\n     * @param {Annotation|boolean} annotation true - use default annotation, false - copy as is\n     * @param {boolean} proxyTrap whether it's called from proxy trap\n     * @returns {boolean|null} true on success, false on failure (proxyTrap + non-configurable), null when cancelled by interceptor\n     */\n    set_(key: PropertyKey, value: any, proxyTrap: boolean = false): boolean | null {\n        // Don't use .has(key) - we care about own\n        if (hasProp(this.target_, key)) {\n            // Existing prop\n            if (this.values_.has(key)) {\n                // Observable (can be intercepted)\n                return this.setObservablePropValue_(key, value)\n            } else if (proxyTrap) {\n                // Non-observable - proxy\n                return Reflect.set(this.target_, key, value)\n            } else {\n                // Non-observable\n                this.target_[key] = value\n                return true\n            }\n        } else {\n            // New prop\n            return this.extend_(\n                key,\n                { value, enumerable: true, writable: true, configurable: true },\n                this.defaultAnnotation_,\n                proxyTrap\n            )\n        }\n    }\n\n    // Trap for \"in\"\n    has_(key: PropertyKey): boolean {\n        if (!globalState.trackingDerivation) {\n            // Skip key subscription outside derivation\n            return key in this.target_\n        }\n        this.pendingKeys_ ||= new Map()\n        let entry = this.pendingKeys_.get(key)\n        if (!entry) {\n            entry = new ObservableValue(\n                key in this.target_,\n                referenceEnhancer,\n                __DEV__ ? `${this.name_}.${stringifyKey(key)}?` : \"ObservableObject.key?\",\n                false\n            )\n            this.pendingKeys_.set(key, entry)\n        }\n        return entry.get()\n    }\n\n    /**\n     * @param {PropertyKey} key\n     * @param {Annotation|boolean} annotation true - use default annotation, false - ignore prop\n     */\n    make_(key: PropertyKey, annotation: Annotation | boolean): void {\n        if (annotation === true) {\n            annotation = this.defaultAnnotation_\n        }\n        if (annotation === false) {\n            return\n        }\n        assertAnnotable(this, annotation, key)\n        if (!(key in this.target_)) {\n            // Throw on missing key, except for decorators:\n            // Decorator annotations are collected from whole prototype chain.\n            // When called from super() some props may not exist yet.\n            // However we don't have to worry about missing prop,\n            // because the decorator must have been applied to something.\n            if (this.target_[storedAnnotationsSymbol]?.[key]) {\n                return // will be annotated by subclass constructor\n            } else {\n                die(1, annotation.annotationType_, `${this.name_}.${key.toString()}`)\n            }\n        }\n        let source = this.target_\n        while (source && source !== objectPrototype) {\n            const descriptor = getDescriptor(source, key)\n            if (descriptor) {\n                const outcome = annotation.make_(this, key, descriptor, source)\n                if (outcome === MakeResult.Cancel) {\n                    return\n                }\n                if (outcome === MakeResult.Break) {\n                    break\n                }\n            }\n            source = Object.getPrototypeOf(source)\n        }\n        recordAnnotationApplied(this, annotation, key)\n    }\n\n    /**\n     * @param {PropertyKey} key\n     * @param {PropertyDescriptor} descriptor\n     * @param {Annotation|boolean} annotation true - use default annotation, false - copy as is\n     * @param {boolean} proxyTrap whether it's called from proxy trap\n     * @returns {boolean|null} true on success, false on failure (proxyTrap + non-configurable), null when cancelled by interceptor\n     */\n    extend_(\n        key: PropertyKey,\n        descriptor: PropertyDescriptor,\n        annotation: Annotation | boolean,\n        proxyTrap: boolean = false\n    ): boolean | null {\n        if (annotation === true) {\n            annotation = this.defaultAnnotation_\n        }\n        if (annotation === false) {\n            return this.defineProperty_(key, descriptor, proxyTrap)\n        }\n        assertAnnotable(this, annotation, key)\n        const outcome = annotation.extend_(this, key, descriptor, proxyTrap)\n        if (outcome) {\n            recordAnnotationApplied(this, annotation, key)\n        }\n        return outcome\n    }\n\n    /**\n     * @param {PropertyKey} key\n     * @param {PropertyDescriptor} descriptor\n     * @param {boolean} proxyTrap whether it's called from proxy trap\n     * @returns {boolean|null} true on success, false on failure (proxyTrap + non-configurable), null when cancelled by interceptor\n     */\n    defineProperty_(\n        key: PropertyKey,\n        descriptor: PropertyDescriptor,\n        proxyTrap: boolean = false\n    ): boolean | null {\n        checkIfStateModificationsAreAllowed(this.keysAtom_)\n        try {\n            startBatch()\n\n            // Delete\n            const deleteOutcome = this.delete_(key)\n            if (!deleteOutcome) {\n                // Failure or intercepted\n                return deleteOutcome\n            }\n\n            // ADD interceptor\n            if (hasInterceptors(this)) {\n                const change = interceptChange<IObjectWillChange>(this, {\n                    object: this.proxy_ || this.target_,\n                    name: key,\n                    type: ADD,\n                    newValue: descriptor.value\n                })\n                if (!change) {\n                    return null\n                }\n                const { newValue } = change as any\n                if (descriptor.value !== newValue) {\n                    descriptor = {\n                        ...descriptor,\n                        value: newValue\n                    }\n                }\n            }\n\n            // Define\n            if (proxyTrap) {\n                if (!Reflect.defineProperty(this.target_, key, descriptor)) {\n                    return false\n                }\n            } else {\n                defineProperty(this.target_, key, descriptor)\n            }\n\n            // Notify\n            this.notifyPropertyAddition_(key, descriptor.value)\n        } finally {\n            endBatch()\n        }\n        return true\n    }\n\n    // If original descriptor becomes relevant, move this to annotation directly\n    defineObservableProperty_(\n        key: PropertyKey,\n        value: any,\n        enhancer: IEnhancer<any>,\n        proxyTrap: boolean = false\n    ): boolean | null {\n        checkIfStateModificationsAreAllowed(this.keysAtom_)\n        try {\n            startBatch()\n\n            // Delete\n            const deleteOutcome = this.delete_(key)\n            if (!deleteOutcome) {\n                // Failure or intercepted\n                return deleteOutcome\n            }\n\n            // ADD interceptor\n            if (hasInterceptors(this)) {\n                const change = interceptChange<IObjectWillChange>(this, {\n                    object: this.proxy_ || this.target_,\n                    name: key,\n                    type: ADD,\n                    newValue: value\n                })\n                if (!change) {\n                    return null\n                }\n                value = (change as any).newValue\n            }\n\n            const cachedDescriptor = getCachedObservablePropDescriptor(key)\n            const descriptor = {\n                configurable: globalState.safeDescriptors ? this.isPlainObject_ : true,\n                enumerable: true,\n                get: cachedDescriptor.get,\n                set: cachedDescriptor.set\n            }\n\n            // Define\n            if (proxyTrap) {\n                if (!Reflect.defineProperty(this.target_, key, descriptor)) {\n                    return false\n                }\n            } else {\n                defineProperty(this.target_, key, descriptor)\n            }\n\n            const observable = new ObservableValue(\n                value,\n                enhancer,\n                __DEV__ ? `${this.name_}.${key.toString()}` : \"ObservableObject.key\",\n                false\n            )\n\n            this.values_.set(key, observable)\n\n            // Notify (value possibly changed by ObservableValue)\n            this.notifyPropertyAddition_(key, observable.value_)\n        } finally {\n            endBatch()\n        }\n        return true\n    }\n\n    // If original descriptor becomes relevant, move this to annotation directly\n    defineComputedProperty_(\n        key: PropertyKey,\n        options: IComputedValueOptions<any>,\n        proxyTrap: boolean = false\n    ): boolean | null {\n        checkIfStateModificationsAreAllowed(this.keysAtom_)\n        try {\n            startBatch()\n\n            // Delete\n            const deleteOutcome = this.delete_(key)\n            if (!deleteOutcome) {\n                // Failure or intercepted\n                return deleteOutcome\n            }\n\n            // ADD interceptor\n            if (hasInterceptors(this)) {\n                const change = interceptChange<IObjectWillChange>(this, {\n                    object: this.proxy_ || this.target_,\n                    name: key,\n                    type: ADD,\n                    newValue: undefined\n                })\n                if (!change) {\n                    return null\n                }\n            }\n            options.name ||= __DEV__ ? `${this.name_}.${key.toString()}` : \"ObservableObject.key\"\n            options.context = this.proxy_ || this.target_\n            const cachedDescriptor = getCachedObservablePropDescriptor(key)\n            const descriptor = {\n                configurable: globalState.safeDescriptors ? this.isPlainObject_ : true,\n                enumerable: false,\n                get: cachedDescriptor.get,\n                set: cachedDescriptor.set\n            }\n\n            // Define\n            if (proxyTrap) {\n                if (!Reflect.defineProperty(this.target_, key, descriptor)) {\n                    return false\n                }\n            } else {\n                defineProperty(this.target_, key, descriptor)\n            }\n\n            this.values_.set(key, new ComputedValue(options))\n\n            // Notify\n            this.notifyPropertyAddition_(key, undefined)\n        } finally {\n            endBatch()\n        }\n        return true\n    }\n\n    /**\n     * @param {PropertyKey} key\n     * @param {PropertyDescriptor} descriptor\n     * @param {boolean} proxyTrap whether it's called from proxy trap\n     * @returns {boolean|null} true on success, false on failure (proxyTrap + non-configurable), null when cancelled by interceptor\n     */\n    delete_(key: PropertyKey, proxyTrap: boolean = false): boolean | null {\n        checkIfStateModificationsAreAllowed(this.keysAtom_)\n        // No such prop\n        if (!hasProp(this.target_, key)) {\n            return true\n        }\n\n        // Intercept\n        if (hasInterceptors(this)) {\n            const change = interceptChange<IObjectWillChange>(this, {\n                object: this.proxy_ || this.target_,\n                name: key,\n                type: REMOVE\n            })\n            // Cancelled\n            if (!change) {\n                return null\n            }\n        }\n\n        // Delete\n        try {\n            startBatch()\n            const notify = hasListeners(this)\n            const notifySpy = __DEV__ && isSpyEnabled()\n            const observable = this.values_.get(key)\n            // Value needed for spies/listeners\n            let value = undefined\n            // Optimization: don't pull the value unless we will need it\n            if (!observable && (notify || notifySpy)) {\n                value = getDescriptor(this.target_, key)?.value\n            }\n            // delete prop (do first, may fail)\n            if (proxyTrap) {\n                if (!Reflect.deleteProperty(this.target_, key)) {\n                    return false\n                }\n            } else {\n                delete this.target_[key]\n            }\n            // Allow re-annotating this field\n            if (__DEV__) {\n                delete this.appliedAnnotations_![key]\n            }\n            // Clear observable\n            if (observable) {\n                this.values_.delete(key)\n                // for computed, value is undefined\n                if (observable instanceof ObservableValue) {\n                    value = observable.value_\n                }\n                // Notify: autorun(() => obj[key]), see #1796\n                propagateChanged(observable)\n            }\n            // Notify \"keys/entries/values\" observers\n            this.keysAtom_.reportChanged()\n\n            // Notify \"has\" observers\n            // \"in\" as it may still exist in proto\n            this.pendingKeys_?.get(key)?.set(key in this.target_)\n\n            // Notify spies/listeners\n            if (notify || notifySpy) {\n                const change: IObjectDidChange = {\n                    type: REMOVE,\n                    observableKind: \"object\",\n                    object: this.proxy_ || this.target_,\n                    debugObjectName: this.name_,\n                    oldValue: value,\n                    name: key\n                }\n                if (__DEV__ && notifySpy) {\n                    spyReportStart(change!)\n                }\n                if (notify) {\n                    notifyListeners(this, change)\n                }\n                if (__DEV__ && notifySpy) {\n                    spyReportEnd()\n                }\n            }\n        } finally {\n            endBatch()\n        }\n        return true\n    }\n\n    /**\n     * Observes this object. Triggers for the events 'add', 'update' and 'delete'.\n     * See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/observe\n     * for callback details\n     */\n    observe_(callback: (changes: IObjectDidChange) => void, fireImmediately?: boolean): Lambda {\n        if (__DEV__ && fireImmediately === true) {\n            die(\"`observe` doesn't support the fire immediately property for observable objects.\")\n        }\n        return registerListener(this, callback)\n    }\n\n    intercept_(handler): Lambda {\n        return registerInterceptor(this, handler)\n    }\n\n    notifyPropertyAddition_(key: PropertyKey, value: any) {\n        const notify = hasListeners(this)\n        const notifySpy = __DEV__ && isSpyEnabled()\n        if (notify || notifySpy) {\n            const change: IObjectDidChange | null =\n                notify || notifySpy\n                    ? ({\n                          type: ADD,\n                          observableKind: \"object\",\n                          debugObjectName: this.name_,\n                          object: this.proxy_ || this.target_,\n                          name: key,\n                          newValue: value\n                      } as const)\n                    : null\n\n            if (__DEV__ && notifySpy) {\n                spyReportStart(change!)\n            }\n            if (notify) {\n                notifyListeners(this, change)\n            }\n            if (__DEV__ && notifySpy) {\n                spyReportEnd()\n            }\n        }\n\n        this.pendingKeys_?.get(key)?.set(true)\n\n        // Notify \"keys/entries/values\" observers\n        this.keysAtom_.reportChanged()\n    }\n\n    ownKeys_(): Array<string | symbol> {\n        this.keysAtom_.reportObserved()\n        return ownKeys(this.target_)\n    }\n\n    keys_(): PropertyKey[] {\n        // Returns enumerable && own, but unfortunately keysAtom will report on ANY key change.\n        // There is no way to distinguish between Object.keys(object) and Reflect.ownKeys(object) - both are handled by ownKeys trap.\n        // We can either over-report in Object.keys(object) or under-report in Reflect.ownKeys(object)\n        // We choose to over-report in Object.keys(object), because:\n        // - typically it's used with simple data objects\n        // - when symbolic/non-enumerable keys are relevant Reflect.ownKeys works as expected\n        this.keysAtom_.reportObserved()\n        return Object.keys(this.target_)\n    }\n}\n\nexport interface IIsObservableObject {\n    [$mobx]: ObservableObjectAdministration\n}\n\nexport function asObservableObject(\n    target: any,\n    options?: CreateObservableOptions\n): IIsObservableObject {\n    if (__DEV__ && options && isObservableObject(target)) {\n        die(`Options can't be provided for already observable objects.`)\n    }\n\n    if (hasProp(target, $mobx)) {\n        if (__DEV__ && !(getAdministration(target) instanceof ObservableObjectAdministration)) {\n            die(\n                `Cannot convert '${getDebugName(target)}' into observable object:` +\n                    `\\nThe target is already observable of different type.` +\n                    `\\nExtending builtins is not supported.`\n            )\n        }\n        return target\n    }\n\n    if (__DEV__ && !Object.isExtensible(target)) {\n        die(\"Cannot make the designated object observable; it is not extensible\")\n    }\n\n    const name =\n        options?.name ??\n        (__DEV__\n            ? `${\n                  isPlainObject(target) ? \"ObservableObject\" : target.constructor.name\n              }@${getNextId()}`\n            : \"ObservableObject\")\n\n    const adm = new ObservableObjectAdministration(\n        target,\n        new Map(),\n        String(name),\n        getAnnotationFromOptions(options)\n    )\n\n    addHiddenProp(target, $mobx, adm)\n\n    return target\n}\n\nconst isObservableObjectAdministration = createInstanceofPredicate(\n    \"ObservableObjectAdministration\",\n    ObservableObjectAdministration\n)\n\nfunction getCachedObservablePropDescriptor(key) {\n    return (\n        descriptorCache[key] ||\n        (descriptorCache[key] = {\n            get() {\n                return this[$mobx].getObservablePropValue_(key)\n            },\n            set(value) {\n                return this[$mobx].setObservablePropValue_(key, value)\n            }\n        })\n    )\n}\n\nexport function isObservableObject(thing: any): boolean {\n    if (isObject(thing)) {\n        return isObservableObjectAdministration((thing as any)[$mobx])\n    }\n    return false\n}\n\nexport function recordAnnotationApplied(\n    adm: ObservableObjectAdministration,\n    annotation: Annotation,\n    key: PropertyKey\n) {\n    if (__DEV__) {\n        adm.appliedAnnotations_![key] = annotation\n    }\n    // Remove applied decorator annotation so we don't try to apply it again in subclass constructor\n    delete adm.target_[storedAnnotationsSymbol]?.[key]\n}\n\nfunction assertAnnotable(\n    adm: ObservableObjectAdministration,\n    annotation: Annotation,\n    key: PropertyKey\n) {\n    // Valid annotation\n    if (__DEV__ && !isAnnotation(annotation)) {\n        die(`Cannot annotate '${adm.name_}.${key.toString()}': Invalid annotation.`)\n    }\n\n    /*\n    // Configurable, not sealed, not frozen\n    // Possibly not needed, just a little better error then the one thrown by engine.\n    // Cases where this would be useful the most (subclass field initializer) are not interceptable by this.\n    if (__DEV__) {\n        const configurable = getDescriptor(adm.target_, key)?.configurable\n        const frozen = Object.isFrozen(adm.target_)\n        const sealed = Object.isSealed(adm.target_)\n        if (!configurable || frozen || sealed) {\n            const fieldName = `${adm.name_}.${key.toString()}`\n            const requestedAnnotationType = annotation.annotationType_\n            let error = `Cannot apply '${requestedAnnotationType}' to '${fieldName}':`\n            if (frozen) {\n                error += `\\nObject is frozen.`\n            }\n            if (sealed) {\n                error += `\\nObject is sealed.`\n            }\n            if (!configurable) {\n                error += `\\nproperty is not configurable.`\n                // Mention only if caused by us to avoid confusion\n                if (hasProp(adm.appliedAnnotations!, key)) {\n                    error += `\\nTo prevent accidental re-definition of a field by a subclass, `\n                    error += `all annotated fields of non-plain objects (classes) are not configurable.`\n                }\n            }\n            die(error)\n        }\n    }\n    */\n\n    // Not annotated\n    if (__DEV__ && !isOverride(annotation) && hasProp(adm.appliedAnnotations_!, key)) {\n        const fieldName = `${adm.name_}.${key.toString()}`\n        const currentAnnotationType = adm.appliedAnnotations_![key].annotationType_\n        const requestedAnnotationType = annotation.annotationType_\n        die(\n            `Cannot apply '${requestedAnnotationType}' to '${fieldName}':` +\n                `\\nThe field is already annotated with '${currentAnnotationType}'.` +\n                `\\nRe-annotating fields is not allowed.` +\n                `\\nUse 'override' annotation for methods overridden by subclass.`\n        )\n    }\n}\n"
  },
  {
    "path": "packages/mobx/src/types/observableset.ts",
    "content": "import {\n    $mobx,\n    createAtom,\n    deepEnhancer,\n    getNextId,\n    IEnhancer,\n    isSpyEnabled,\n    hasListeners,\n    IListenable,\n    registerListener,\n    Lambda,\n    spyReportStart,\n    notifyListeners,\n    spyReportEnd,\n    createInstanceofPredicate,\n    makeIterable,\n    hasInterceptors,\n    interceptChange,\n    IInterceptable,\n    IInterceptor,\n    registerInterceptor,\n    checkIfStateModificationsAreAllowed,\n    untracked,\n    transaction,\n    isES6Set,\n    IAtom,\n    DELETE,\n    ADD,\n    die,\n    isFunction,\n    initObservable\n} from \"../internal\"\n\nconst ObservableSetMarker = {}\n\nexport type IObservableSetInitialValues<T> = Set<T> | readonly T[]\n\nexport type ISetDidChange<T = any> =\n    | {\n          object: ObservableSet<T>\n          observableKind: \"set\"\n          debugObjectName: string\n          type: \"add\"\n          newValue: T\n      }\n    | {\n          object: ObservableSet<T>\n          observableKind: \"set\"\n          debugObjectName: string\n          type: \"delete\"\n          oldValue: T\n      }\n\nexport type ISetWillDeleteChange<T = any> = {\n    type: \"delete\"\n    object: ObservableSet<T>\n    oldValue: T\n};\nexport type ISetWillAddChange<T = any> = {\n    type: \"add\"\n    object: ObservableSet<T>\n    newValue: T\n};\n\nexport type ISetWillChange<T = any> =\n    | ISetWillDeleteChange<T>\n    | ISetWillAddChange<T>\n\nexport class ObservableSet<T = any> implements Set<T>, IInterceptable<ISetWillChange>, IListenable {\n    [$mobx] = ObservableSetMarker\n    private data_: Set<any> = new Set()\n    atom_!: IAtom\n    changeListeners_\n    interceptors_\n    dehancer: any\n    enhancer_: (newV: any, oldV: any | undefined) => any\n\n    constructor(\n        initialData?: IObservableSetInitialValues<T>,\n        enhancer: IEnhancer<T> = deepEnhancer,\n        public name_ = __DEV__ ? \"ObservableSet@\" + getNextId() : \"ObservableSet\"\n    ) {\n        if (!isFunction(Set)) {\n            die(22)\n        }\n        this.enhancer_ = (newV, oldV) => enhancer(newV, oldV, name_)\n        initObservable(() => {\n            this.atom_ = createAtom(this.name_)\n            if (initialData) {\n                this.replace(initialData)\n            }\n        })\n    }\n\n    private dehanceValue_<X extends T | undefined>(value: X): X {\n        if (this.dehancer !== undefined) {\n            return this.dehancer(value)\n        }\n        return value\n    }\n\n    clear() {\n        transaction(() => {\n            untracked(() => {\n                for (const value of this.data_.values()) {\n                    this.delete(value)\n                }\n            })\n        })\n    }\n\n    forEach(callbackFn: (value: T, value2: T, set: Set<T>) => void, thisArg?: any) {\n        for (const value of this) {\n            callbackFn.call(thisArg, value, value, this)\n        }\n    }\n\n    get size() {\n        this.atom_.reportObserved()\n        return this.data_.size\n    }\n\n    add(value: T) {\n        checkIfStateModificationsAreAllowed(this.atom_)\n        if (hasInterceptors(this)) {\n            const change = interceptChange<ISetWillAddChange<T>>(this, {\n                type: ADD,\n                object: this,\n                newValue: value\n            })\n            if (!change) {\n                return this\n            }\n\n            // implemented reassignment same as it's done for ObservableMap\n            value = change.newValue!;\n\n        }\n        if (!this.has(value)) {\n            transaction(() => {\n                this.data_.add(this.enhancer_(value, undefined))\n                this.atom_.reportChanged()\n            })\n            const notifySpy = __DEV__ && isSpyEnabled()\n            const notify = hasListeners(this)\n            const change =\n                notify || notifySpy\n                    ? <ISetDidChange<T>>{\n                          observableKind: \"set\",\n                          debugObjectName: this.name_,\n                          type: ADD,\n                          object: this,\n                          newValue: value\n                      }\n                    : null\n            if (notifySpy && __DEV__) {\n                spyReportStart(change!)\n            }\n            if (notify) {\n                notifyListeners(this, change)\n            }\n            if (notifySpy && __DEV__) {\n                spyReportEnd()\n            }\n        }\n\n        return this\n    }\n\n    delete(value: T) {\n        if (hasInterceptors(this)) {\n            const change = interceptChange<ISetWillDeleteChange<T>>(this, {\n                type: DELETE,\n                object: this,\n                oldValue: value\n            })\n            if (!change) {\n                return false\n            }\n        }\n        if (this.has(value)) {\n            const notifySpy = __DEV__ && isSpyEnabled()\n            const notify = hasListeners(this)\n            const change =\n                notify || notifySpy\n                    ? <ISetDidChange<T>>{\n                          observableKind: \"set\",\n                          debugObjectName: this.name_,\n                          type: DELETE,\n                          object: this,\n                          oldValue: value\n                      }\n                    : null\n\n            if (notifySpy && __DEV__) {\n                spyReportStart(change!)\n            }\n            transaction(() => {\n                this.atom_.reportChanged()\n                this.data_.delete(value)\n            })\n            if (notify) {\n                notifyListeners(this, change)\n            }\n            if (notifySpy && __DEV__) {\n                spyReportEnd()\n            }\n            return true\n        }\n        return false\n    }\n\n    has(value: T) {\n        this.atom_.reportObserved()\n        return this.data_.has(this.dehanceValue_(value))\n    }\n\n    entries() {\n        const values = this.values()\n        return makeIterableForSet<[T, T]>({\n            next() {\n                const { value, done } = values.next()\n                return !done ? { value: [value, value], done } : { value: undefined, done }\n            }\n        })\n    }\n\n    keys(): SetIterator<T> {\n        return this.values()\n    }\n\n    values(): SetIterator<T> {\n        this.atom_.reportObserved()\n        const self = this\n        const values = this.data_.values()\n        return makeIterableForSet({\n            next() {\n                const { value, done } = values.next()\n                return !done\n                    ? { value: self.dehanceValue_(value), done }\n                    : { value: undefined, done }\n            }\n        })\n    }\n\n    intersection<U>(otherSet: ReadonlySetLike<U> | Set<U>): Set<T & U> {\n        if (isES6Set(otherSet) && !isObservableSet(otherSet)) {\n            return otherSet.intersection(this)\n        } else {\n            const dehancedSet = new Set(this)\n            return dehancedSet.intersection(otherSet)\n        }\n    }\n\n    union<U>(otherSet: ReadonlySetLike<U> | Set<U>): Set<T | U> {\n        if (isES6Set(otherSet) && !isObservableSet(otherSet)) {\n            return otherSet.union(this)\n        } else {\n            const dehancedSet = new Set(this)\n            return dehancedSet.union(otherSet)\n        }\n    }\n\n    difference<U>(otherSet: ReadonlySetLike<U>): Set<T> {\n        return new Set(this).difference(otherSet)\n    }\n\n    symmetricDifference<U>(otherSet: ReadonlySetLike<U> | Set<U>): Set<T | U> {\n        if (isES6Set(otherSet) && !isObservableSet(otherSet)) {\n            return otherSet.symmetricDifference(this)\n        } else {\n            const dehancedSet = new Set(this)\n            return dehancedSet.symmetricDifference(otherSet)\n        }\n    }\n\n    isSubsetOf(otherSet: ReadonlySetLike<unknown>): boolean {\n        return new Set(this).isSubsetOf(otherSet)\n    }\n\n    isSupersetOf(otherSet: ReadonlySetLike<unknown>): boolean {\n        return new Set(this).isSupersetOf(otherSet)\n    }\n\n    isDisjointFrom(otherSet: ReadonlySetLike<unknown> | Set<unknown>): boolean {\n        if (isES6Set(otherSet) && !isObservableSet(otherSet)) {\n            return otherSet.isDisjointFrom(this)\n        } else {\n            const dehancedSet = new Set(this)\n            return dehancedSet.isDisjointFrom(otherSet)\n        }\n    }\n\n    replace(other: ObservableSet<T> | IObservableSetInitialValues<T>): ObservableSet<T> {\n        if (isObservableSet(other)) {\n            other = new Set(other)\n        }\n\n        transaction(() => {\n            if (Array.isArray(other)) {\n                this.clear()\n                other.forEach(value => this.add(value))\n            } else if (isES6Set(other)) {\n                this.clear()\n                other.forEach(value => this.add(value))\n            } else if (other !== null && other !== undefined) {\n                die(\"Cannot initialize set from \" + other)\n            }\n        })\n\n        return this\n    }\n    observe_(listener: (changes: ISetDidChange<T>) => void, fireImmediately?: boolean): Lambda {\n        // ... 'fireImmediately' could also be true?\n        if (__DEV__ && fireImmediately === true) {\n            die(\"`observe` doesn't support fireImmediately=true in combination with sets.\")\n        }\n        return registerListener(this, listener)\n    }\n\n    intercept_(handler: IInterceptor<ISetWillChange<T>>): Lambda {\n        return registerInterceptor(this, handler)\n    }\n\n    toJSON(): T[] {\n        return Array.from(this)\n    }\n\n    toString(): string {\n        return \"[object ObservableSet]\"\n    }\n\n    [Symbol.iterator]() {\n        return this.values()\n    }\n\n    get [Symbol.toStringTag]() {\n        return \"Set\"\n    }\n}\n\n// eslint-disable-next-line\nexport var isObservableSet = createInstanceofPredicate(\"ObservableSet\", ObservableSet) as (\n    thing: any\n) => thing is ObservableSet<any>\n\nfunction makeIterableForSet<T>(iterator: Iterator<T>): SetIterator<T> {\n    iterator[Symbol.toStringTag] = \"SetIterator\"\n    return makeIterable<T, BuiltinIteratorReturn>(iterator)\n}\n"
  },
  {
    "path": "packages/mobx/src/types/observablevalue.ts",
    "content": "import {\n    Atom,\n    IEnhancer,\n    IInterceptable,\n    IEqualsComparer,\n    IInterceptor,\n    IListenable,\n    Lambda,\n    checkIfStateModificationsAreAllowed,\n    comparer,\n    createInstanceofPredicate,\n    getNextId,\n    hasInterceptors,\n    hasListeners,\n    interceptChange,\n    isSpyEnabled,\n    notifyListeners,\n    registerInterceptor,\n    registerListener,\n    spyReport,\n    spyReportEnd,\n    spyReportStart,\n    toPrimitive,\n    globalState,\n    IUNCHANGED,\n    UPDATE\n} from \"../internal\"\n\nexport interface IValueWillChange<T> {\n    object: IObservableValue<T>\n    type: \"update\"\n    newValue: T\n}\n\nexport type IValueDidChange<T = any> = {\n    type: \"update\"\n    observableKind: \"value\"\n    object: IObservableValue<T>\n    debugObjectName: string\n    newValue: T\n    oldValue: T | undefined\n}\nexport type IBoxDidChange<T = any> =\n    | {\n          type: \"create\"\n          observableKind: \"value\"\n          object: IObservableValue<T>\n          debugObjectName: string\n          newValue: T\n      }\n    | IValueDidChange<T>\n\nexport interface IObservableValue<T> {\n    get(): T\n    set(value: T): void\n}\n\nconst CREATE = \"create\"\n\nexport class ObservableValue<T>\n    extends Atom\n    implements IObservableValue<T>, IInterceptable<IValueWillChange<T>>, IListenable\n{\n    hasUnreportedChange_ = false\n    interceptors_\n    changeListeners_\n    value_\n    dehancer: any\n\n    constructor(\n        value: T,\n        public enhancer: IEnhancer<T>,\n        public name_ = __DEV__ ? \"ObservableValue@\" + getNextId() : \"ObservableValue\",\n        notifySpy = true,\n        private equals: IEqualsComparer<any> = comparer.default\n    ) {\n        super(name_)\n        this.value_ = enhancer(value, undefined, name_)\n        if (__DEV__ && notifySpy && isSpyEnabled()) {\n            // only notify spy if this is a stand-alone observable\n            spyReport({\n                type: CREATE,\n                object: this,\n                observableKind: \"value\",\n                debugObjectName: this.name_,\n                newValue: \"\" + this.value_?.toString()\n            })\n        }\n    }\n\n    private dehanceValue(value: T): T {\n        if (this.dehancer !== undefined) {\n            return this.dehancer(value)\n        }\n        return value\n    }\n\n    public set(newValue: T) {\n        const oldValue = this.value_\n        newValue = this.prepareNewValue_(newValue) as any\n        if (newValue !== globalState.UNCHANGED) {\n            const notifySpy = isSpyEnabled()\n            if (__DEV__ && notifySpy) {\n                spyReportStart({\n                    type: UPDATE,\n                    object: this,\n                    observableKind: \"value\",\n                    debugObjectName: this.name_,\n                    newValue,\n                    oldValue\n                })\n            }\n            this.setNewValue_(newValue)\n            if (__DEV__ && notifySpy) {\n                spyReportEnd()\n            }\n        }\n    }\n\n    private prepareNewValue_(newValue): T | IUNCHANGED {\n        checkIfStateModificationsAreAllowed(this)\n        if (hasInterceptors(this)) {\n            const change = interceptChange<IValueWillChange<T>>(this, {\n                object: this,\n                type: UPDATE,\n                newValue\n            })\n            if (!change) {\n                return globalState.UNCHANGED\n            }\n            newValue = change.newValue\n        }\n        // apply modifier\n        newValue = this.enhancer(newValue, this.value_, this.name_)\n        return this.equals(this.value_, newValue) ? globalState.UNCHANGED : newValue\n    }\n\n    setNewValue_(newValue: T) {\n        const oldValue = this.value_\n        this.value_ = newValue\n        this.reportChanged()\n        if (hasListeners(this)) {\n            notifyListeners(this, {\n                type: UPDATE,\n                object: this,\n                newValue,\n                oldValue\n            })\n        }\n    }\n\n    public get(): T {\n        this.reportObserved()\n        return this.dehanceValue(this.value_)\n    }\n\n    intercept_(handler: IInterceptor<IValueWillChange<T>>): Lambda {\n        return registerInterceptor(this, handler)\n    }\n\n    observe_(listener: (change: IValueDidChange<T>) => void, fireImmediately?: boolean): Lambda {\n        if (fireImmediately) {\n            listener({\n                observableKind: \"value\",\n                debugObjectName: this.name_,\n                object: this,\n                type: UPDATE,\n                newValue: this.value_,\n                oldValue: undefined\n            })\n        }\n        return registerListener(this, listener)\n    }\n\n    raw() {\n        // used by MST ot get undehanced value\n        return this.value_\n    }\n\n    toJSON() {\n        return this.get()\n    }\n\n    toString() {\n        return `${this.name_}[${this.value_}]`\n    }\n\n    valueOf(): T {\n        return toPrimitive(this.get())\n    }\n\n    [Symbol.toPrimitive]() {\n        return this.valueOf()\n    }\n}\n\nexport const isObservableValue = createInstanceofPredicate(\"ObservableValue\", ObservableValue) as (\n    x: any\n) => x is IObservableValue<any>\n"
  },
  {
    "path": "packages/mobx/src/types/overrideannotation.ts",
    "content": "import {\n    die,\n    Annotation,\n    hasProp,\n    createDecoratorAnnotation,\n    ObservableObjectAdministration,\n    MakeResult\n} from \"../internal\"\n\nimport type { ClassMethodDecorator } from \"./decorator_fills\"\n\nconst OVERRIDE = \"override\"\n\nexport const override: Annotation & PropertyDecorator & ClassMethodDecorator =\n    createDecoratorAnnotation({\n        annotationType_: OVERRIDE,\n        make_,\n        extend_,\n        decorate_20223_\n    })\n\nexport function isOverride(annotation: Annotation): boolean {\n    return annotation.annotationType_ === OVERRIDE\n}\n\nfunction make_(this: Annotation, adm: ObservableObjectAdministration, key): MakeResult {\n    // Must not be plain object\n    if (__DEV__ && adm.isPlainObject_) {\n        die(\n            `Cannot apply '${this.annotationType_}' to '${adm.name_}.${key.toString()}':` +\n                `\\n'${this.annotationType_}' cannot be used on plain objects.`\n        )\n    }\n    // Must override something\n    if (__DEV__ && !hasProp(adm.appliedAnnotations_!, key)) {\n        die(\n            `'${adm.name_}.${key.toString()}' is annotated with '${this.annotationType_}', ` +\n                `but no such annotated member was found on prototype.`\n        )\n    }\n    return MakeResult.Cancel\n}\n\nfunction extend_(this: Annotation, adm, key, descriptor, proxyTrap): boolean {\n    die(`'${this.annotationType_}' can only be used with 'makeObservable'`)\n}\n\nfunction decorate_20223_(this: Annotation, desc, context: DecoratorContext) {\n    console.warn(`'${this.annotationType_}' cannot be used with decorators - this is a no-op`)\n}\n"
  },
  {
    "path": "packages/mobx/src/types/type-utils.ts",
    "content": "import { isAction } from \"../api/action\"\nimport {\n    $mobx,\n    IDepTreeNode,\n    isAtom,\n    isComputedValue,\n    isObservableArray,\n    isObservableMap,\n    isObservableObject,\n    isReaction,\n    isObservableSet,\n    die,\n    isFunction,\n    allowStateChangesStart,\n    untrackedStart,\n    allowStateChangesEnd,\n    untrackedEnd,\n    startBatch,\n    endBatch\n} from \"../internal\"\n\nexport function getAtom(thing: any, property?: PropertyKey): IDepTreeNode {\n    if (typeof thing === \"object\" && thing !== null) {\n        if (isObservableArray(thing)) {\n            if (property !== undefined) {\n                die(23)\n            }\n            return (thing as any)[$mobx].atom_\n        }\n        if (isObservableSet(thing)) {\n            return thing.atom_\n        }\n        if (isObservableMap(thing)) {\n            if (property === undefined) {\n                return thing.keysAtom_\n            }\n            const observable = thing.data_.get(property) || thing.hasMap_.get(property)\n            if (!observable) {\n                die(25, property, getDebugName(thing))\n            }\n            return observable\n        }\n        if (property && !thing[$mobx]) {\n            thing[property]\n        } // See #1072\n        if (isObservableObject(thing)) {\n            if (!property) {\n                return die(26)\n            }\n            const observable = (thing as any)[$mobx].values_.get(property)\n            if (!observable) {\n                die(27, property, getDebugName(thing))\n            }\n            return observable\n        }\n        if (isAtom(thing) || isComputedValue(thing) || isReaction(thing)) {\n            return thing\n        }\n    } else if (isFunction(thing)) {\n        if (isReaction(thing[$mobx])) {\n            // disposer function\n            return thing[$mobx]\n        }\n    }\n    die(28)\n}\n\nexport function getAdministration(thing: any, property?: string) {\n    if (!thing) {\n        die(29)\n    }\n    if (property !== undefined) {\n        return getAdministration(getAtom(thing, property))\n    }\n    if (isAtom(thing) || isComputedValue(thing) || isReaction(thing)) {\n        return thing\n    }\n    if (isObservableMap(thing) || isObservableSet(thing)) {\n        return thing\n    }\n    if (thing[$mobx]) {\n        return thing[$mobx]\n    }\n    die(24, thing)\n}\n\nexport function getDebugName(thing: any, property?: string): string {\n    let named\n    if (property !== undefined) {\n        named = getAtom(thing, property)\n    } else if (isAction(thing)) {\n        return thing.name\n    } else if (isObservableObject(thing) || isObservableMap(thing) || isObservableSet(thing)) {\n        named = getAdministration(thing)\n    } else {\n        // valid for arrays as well\n        named = getAtom(thing)\n    }\n    return named.name_\n}\n\n/**\n * Helper function for initializing observable structures, it applies:\n * 1. allowStateChanges so we don't violate enforceActions.\n * 2. untracked so we don't accidentaly subscribe to anything observable accessed during init in case the observable is created inside derivation.\n * 3. batch to avoid state version updates\n */\nexport function initObservable<T>(cb: () => T): T {\n    const derivation = untrackedStart()\n    const allowStateChanges = allowStateChangesStart(true)\n    startBatch()\n    try {\n        return cb()\n    } finally {\n        endBatch()\n        allowStateChangesEnd(allowStateChanges)\n        untrackedEnd(derivation)\n    }\n}\n"
  },
  {
    "path": "packages/mobx/src/utils/comparer.ts",
    "content": "import { deepEqual } from \"../internal\"\n\nexport interface IEqualsComparer<T> {\n    (a: T, b: T): boolean\n}\n\nfunction identityComparer(a: any, b: any): boolean {\n    return a === b\n}\n\nfunction structuralComparer(a: any, b: any): boolean {\n    return deepEqual(a, b)\n}\n\nfunction shallowComparer(a: any, b: any): boolean {\n    return deepEqual(a, b, 1)\n}\n\nfunction defaultComparer(a: any, b: any): boolean {\n    if (Object.is) {\n        return Object.is(a, b)\n    }\n\n    return a === b ? a !== 0 || 1 / a === 1 / b : a !== a && b !== b\n}\n\nexport const comparer = {\n    identity: identityComparer,\n    structural: structuralComparer,\n    default: defaultComparer,\n    shallow: shallowComparer\n}\n"
  },
  {
    "path": "packages/mobx/src/utils/eq.ts",
    "content": "import {\n    isES6Map,\n    isObservableArray,\n    isObservableMap,\n    isES6Set,\n    isObservableSet,\n    hasProp,\n    isFunction,\n    objectPrototype\n} from \"../internal\"\n\ndeclare const Symbol\nconst toString = objectPrototype.toString\n\nexport function deepEqual(a: any, b: any, depth: number = -1): boolean {\n    return eq(a, b, depth)\n}\n\n// Copied from https://github.com/jashkenas/underscore/blob/5c237a7c682fb68fd5378203f0bf22dce1624854/underscore.js#L1186-L1289\n// Modified: \"Deep compare objects\" part to iterate over keys in forward order instead of reverse order.\n//\n// Internal recursive comparison function for `isEqual`.\nfunction eq(a: any, b: any, depth: number, aStack?: any[], bStack?: any[]) {\n    // Identical objects are equal. `0 === -0`, but they aren't identical.\n    // See the [Harmony `egal` proposal](http://wiki.ecmascript.org/doku.php?id=harmony:egal).\n    if (a === b) {\n        return a !== 0 || 1 / a === 1 / b\n    }\n    // `null` or `undefined` only equal to itself (strict comparison).\n    if (a == null || b == null) {\n        return false\n    }\n    // `NaN`s are equivalent, but non-reflexive.\n    if (a !== a) {\n        return b !== b\n    }\n    // Exhaust primitive checks\n    const type = typeof a\n    if (type !== \"function\" && type !== \"object\" && typeof b != \"object\") {\n        return false\n    }\n\n    // Compare `[[Class]]` names.\n    const className = toString.call(a)\n    if (className !== toString.call(b)) {\n        return false\n    }\n    switch (className) {\n        // Strings, numbers, regular expressions, dates, and booleans are compared by value.\n        case \"[object RegExp]\":\n        // RegExps are coerced to strings for comparison (Note: '' + /a/i === '/a/i')\n        case \"[object String]\":\n            // Primitives and their corresponding object wrappers are equivalent; thus, `\"5\"` is\n            // equivalent to `new String(\"5\")`.\n            return \"\" + a === \"\" + b\n        case \"[object Number]\":\n            // `NaN`s are equivalent, but non-reflexive.\n            // Object(NaN) is equivalent to NaN.\n            if (+a !== +a) {\n                return +b !== +b\n            }\n            // An `egal` comparison is performed for other numeric values.\n            return +a === 0 ? 1 / +a === 1 / b : +a === +b\n        case \"[object Date]\":\n        case \"[object Boolean]\":\n            // Coerce dates and booleans to numeric primitive values. Dates are compared by their\n            // millisecond representations. Note that invalid dates with millisecond representations\n            // of `NaN` are not equivalent.\n            return +a === +b\n        case \"[object Symbol]\":\n            return (\n                typeof Symbol !== \"undefined\" && Symbol.valueOf.call(a) === Symbol.valueOf.call(b)\n            )\n        case \"[object Map]\":\n        case \"[object Set]\":\n            // Maps and Sets are unwrapped to arrays of entry-pairs, adding an incidental level.\n            // Hide this extra level by increasing the depth.\n            if (depth >= 0) {\n                depth++\n            }\n            break\n    }\n    // Unwrap any wrapped objects.\n    a = unwrap(a)\n    b = unwrap(b)\n\n    const areArrays = className === \"[object Array]\"\n    if (!areArrays) {\n        if (typeof a != \"object\" || typeof b != \"object\") {\n            return false\n        }\n\n        // Objects with different constructors are not equivalent, but `Object`s or `Array`s\n        // from different frames are.\n        const aCtor = a.constructor,\n            bCtor = b.constructor\n        if (\n            aCtor !== bCtor &&\n            !(\n                isFunction(aCtor) &&\n                aCtor instanceof aCtor &&\n                isFunction(bCtor) &&\n                bCtor instanceof bCtor\n            ) &&\n            \"constructor\" in a &&\n            \"constructor\" in b\n        ) {\n            return false\n        }\n    }\n\n    if (depth === 0) {\n        return false\n    } else if (depth < 0) {\n        depth = -1\n    }\n\n    // Assume equality for cyclic structures. The algorithm for detecting cyclic\n    // structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`.\n\n    // Initializing stack of traversed objects.\n    // It's done here since we only need them for objects and arrays comparison.\n    aStack = aStack || []\n    bStack = bStack || []\n    let length = aStack.length\n    while (length--) {\n        // Linear search. Performance is inversely proportional to the number of\n        // unique nested structures.\n        if (aStack[length] === a) {\n            return bStack[length] === b\n        }\n    }\n\n    // Add the first object to the stack of traversed objects.\n    aStack.push(a)\n    bStack.push(b)\n\n    // Recursively compare objects and arrays.\n    if (areArrays) {\n        // Compare array lengths to determine if a deep comparison is necessary.\n        length = a.length\n        if (length !== b.length) {\n            return false\n        }\n        // Deep compare the contents, ignoring non-numeric properties.\n        while (length--) {\n            if (!eq(a[length], b[length], depth - 1, aStack, bStack)) {\n                return false\n            }\n        }\n    } else {\n        // Deep compare objects.\n        const keys = Object.keys(a)\n        const length = keys.length\n        // Ensure that both objects contain the same number of properties before comparing deep equality.\n        if (Object.keys(b).length !== length) {\n            return false\n        }\n        for (let i = 0; i < length; i++) {\n            // Deep compare each member\n            const key = keys[i]\n            if (!(hasProp(b, key) && eq(a[key], b[key], depth - 1, aStack, bStack))) {\n                return false\n            }\n        }\n    }\n    // Remove the first object from the stack of traversed objects.\n    aStack.pop()\n    bStack.pop()\n    return true\n}\n\nfunction unwrap(a: any) {\n    if (isObservableArray(a)) {\n        return a.slice()\n    }\n    if (isES6Map(a) || isObservableMap(a)) {\n        return Array.from(a.entries())\n    }\n    if (isES6Set(a) || isObservableSet(a)) {\n        return Array.from(a.entries())\n    }\n    return a\n}\n"
  },
  {
    "path": "packages/mobx/src/utils/global.ts",
    "content": "declare const window: any\ndeclare const self: any\n\nconst mockGlobal = {}\n\nexport function getGlobal() {\n    if (typeof globalThis !== \"undefined\") {\n        return globalThis\n    }\n    if (typeof window !== \"undefined\") {\n        return window\n    }\n    if (typeof global !== \"undefined\") {\n        return global\n    }\n    if (typeof self !== \"undefined\") {\n        return self\n    }\n    return mockGlobal\n}\n"
  },
  {
    "path": "packages/mobx/src/utils/iterable.ts",
    "content": "import { getGlobal } from \"../internal\"\n\n// safely get iterator prototype if available\nconst maybeIteratorPrototype = getGlobal().Iterator?.prototype || {}\n\nexport function makeIterable<T, TReturn = unknown>(\n    iterator: Iterator<T>\n): IteratorObject<T, TReturn> {\n    iterator[Symbol.iterator] = getSelf\n    return Object.assign(Object.create(maybeIteratorPrototype), iterator)\n}\n\nfunction getSelf() {\n    return this\n}\n"
  },
  {
    "path": "packages/mobx/src/utils/utils.ts",
    "content": "import { globalState, die } from \"../internal\"\n\n// We shorten anything used > 5 times\nexport const assign = Object.assign\nexport const getDescriptor = Object.getOwnPropertyDescriptor\nexport const defineProperty = Object.defineProperty\nexport const objectPrototype = Object.prototype\n\nexport const EMPTY_ARRAY = []\nObject.freeze(EMPTY_ARRAY)\n\nexport const EMPTY_OBJECT = {}\nObject.freeze(EMPTY_OBJECT)\n\nexport interface Lambda {\n    (): void\n    name?: string\n}\n\nconst hasProxy = typeof Proxy !== \"undefined\"\nconst plainObjectString = Object.toString()\n\nexport function assertProxies() {\n    if (!hasProxy) {\n        die(\n            __DEV__\n                ? \"`Proxy` objects are not available in the current environment. Please configure MobX to enable a fallback implementation.`\"\n                : \"Proxy not available\"\n        )\n    }\n}\n\nexport function warnAboutProxyRequirement(msg: string) {\n    if (__DEV__ && globalState.verifyProxies) {\n        die(\n            \"MobX is currently configured to be able to run in ES5 mode, but in ES5 MobX won't be able to \" +\n                msg\n        )\n    }\n}\n\nexport function getNextId() {\n    return ++globalState.mobxGuid\n}\n\n/**\n * Makes sure that the provided function is invoked at most once.\n */\nexport function once(func: Lambda): Lambda {\n    let invoked = false\n    return function () {\n        if (invoked) {\n            return\n        }\n        invoked = true\n        return (func as any).apply(this, arguments)\n    }\n}\n\nexport const noop = () => {}\n\nexport function isFunction(fn: any): fn is Function {\n    return typeof fn === \"function\"\n}\n\nexport function isString(value: any): value is string {\n    return typeof value === \"string\"\n}\n\nexport function isStringish(value: any): value is string | number | symbol {\n    const t = typeof value\n    switch (t) {\n        case \"string\":\n        case \"symbol\":\n        case \"number\":\n            return true\n    }\n    return false\n}\n\nexport function isObject(value: any): value is Object {\n    return value !== null && typeof value === \"object\"\n}\n\nexport function isPlainObject(value: any) {\n    if (!isObject(value)) {\n        return false\n    }\n    const proto = Object.getPrototypeOf(value)\n    if (proto == null) {\n        return true\n    }\n    const protoConstructor = Object.hasOwnProperty.call(proto, \"constructor\") && proto.constructor\n    return (\n        typeof protoConstructor === \"function\" && protoConstructor.toString() === plainObjectString\n    )\n}\n\n// https://stackoverflow.com/a/37865170\nexport function isGenerator(obj: any): boolean {\n    const constructor = obj?.constructor\n    if (!constructor) {\n        return false\n    }\n    if (\n        \"GeneratorFunction\" === constructor.name ||\n        \"GeneratorFunction\" === constructor.displayName\n    ) {\n        return true\n    }\n    return false\n}\n\nexport function addHiddenProp(object: any, propName: PropertyKey, value: any) {\n    defineProperty(object, propName, {\n        enumerable: false,\n        writable: true,\n        configurable: true,\n        value\n    })\n}\n\nexport function addHiddenFinalProp(object: any, propName: PropertyKey, value: any) {\n    defineProperty(object, propName, {\n        enumerable: false,\n        writable: false,\n        configurable: true,\n        value\n    })\n}\n\nexport function createInstanceofPredicate<T>(\n    name: string,\n    theClass: new (...args: any[]) => T\n): (x: any) => x is T {\n    const propName = \"isMobX\" + name\n    theClass.prototype[propName] = true\n    return function (x) {\n        return isObject(x) && x[propName] === true\n    } as any\n}\n\n/**\n * Yields true for both native and observable Map, even across different windows.\n */\nexport function isES6Map(thing: unknown): thing is Map<any, any> {\n    return thing != null && Object.prototype.toString.call(thing) === \"[object Map]\"\n}\n\n/**\n * Makes sure a Map is an instance of non-inherited native or observable Map.\n */\nexport function isPlainES6Map(thing: Map<unknown, unknown>): boolean {\n    const mapProto = Object.getPrototypeOf(thing)\n    const objectProto = Object.getPrototypeOf(mapProto)\n    const nullProto = Object.getPrototypeOf(objectProto)\n    return nullProto === null\n}\n\n/**\n * Yields true for both native and observable Set, even across different windows.\n */\nexport function isES6Set(thing: unknown): thing is Set<any> {\n    return thing != null && Object.prototype.toString.call(thing) === \"[object Set]\"\n}\n\nconst hasGetOwnPropertySymbols = typeof Object.getOwnPropertySymbols !== \"undefined\"\n\n/**\n * Returns the following: own enumerable keys and symbols.\n */\nexport function getPlainObjectKeys(object: any) {\n    const keys = Object.keys(object)\n    // Not supported in IE, so there are not going to be symbol props anyway...\n    if (!hasGetOwnPropertySymbols) {\n        return keys\n    }\n    const symbols = Object.getOwnPropertySymbols(object)\n    if (!symbols.length) {\n        return keys\n    }\n    return [...keys, ...symbols.filter(s => objectPrototype.propertyIsEnumerable.call(object, s))]\n}\n\n// From Immer utils\n// Returns all own keys, including non-enumerable and symbolic\nexport const ownKeys: (target: any) => Array<string | symbol> =\n    typeof Reflect !== \"undefined\" && Reflect.ownKeys\n        ? Reflect.ownKeys\n        : hasGetOwnPropertySymbols\n        ? obj => Object.getOwnPropertyNames(obj).concat(Object.getOwnPropertySymbols(obj) as any)\n        : /* istanbul ignore next */ Object.getOwnPropertyNames\n\nexport function stringifyKey(key: any): string {\n    if (typeof key === \"string\") {\n        return key\n    }\n    if (typeof key === \"symbol\") {\n        return key.toString()\n    }\n    return new String(key).toString()\n}\n\nexport function toPrimitive(value: any) {\n    return value === null ? null : typeof value === \"object\" ? \"\" + value : value\n}\n\nexport function hasProp(target: Object, prop: PropertyKey): boolean {\n    return objectPrototype.hasOwnProperty.call(target, prop)\n}\n\n// From Immer utils\nexport const getOwnPropertyDescriptors =\n    Object.getOwnPropertyDescriptors ||\n    function getOwnPropertyDescriptors(target: any) {\n        // Polyfill needed for Hermes and IE, see https://github.com/facebook/hermes/issues/274\n        const res: any = {}\n        // Note: without polyfill for ownKeys, symbols won't be picked up\n        ownKeys(target).forEach(key => {\n            res[key] = getDescriptor(target, key)\n        })\n        return res\n    }\n\nexport function getFlag(flags: number, mask: number) {\n    return !!(flags & mask)\n}\n\nexport function setFlag(flags: number, mask: number, newValue: boolean): number {\n    if (newValue) {\n        flags |= mask\n    } else {\n        flags &= ~mask\n    }\n    return flags\n}\n"
  },
  {
    "path": "packages/mobx/tsconfig.json",
    "content": "{\n    \"extends\": \"../../tsconfig.json\",\n    \"compilerOptions\": {\n        \"rootDir\": \"src\"\n    },\n    \"include\": [\"src\"]\n}\n"
  },
  {
    "path": "packages/mobx/tsdx.config.js",
    "content": "const { terser } = require(\"rollup-plugin-terser\")\n\nmodule.exports = {\n    // This function will run for each entry/format/env combination\n    rollup(config, options) {\n        // MWE: disabled minifying esm builds as source maps aren't too reliable.\n        // It is a shame because mangle properties saves quite a bit (1 KB gzipped)\n        // For comparison:\n        // webpack + terser + unminified mobx:\n        // 13757\n        // webpack + pre-minified mobx:\n        // 12949\n        if (/*options.format === \"esm\" || */ options.env === \"production\") {\n            config.plugins.push(\n                terser({\n                    sourcemap: true,\n                    module: true,\n                    compress: {\n                        hoist_funs: true,\n                        passes: 2,\n                        keep_fargs: false,\n                        pure_getters: true,\n                        unsafe: false\n                    },\n                    mangle: {\n                        properties: {\n                            regex: /_$/\n                        }\n                    }\n                })\n            )\n        }\n        return config\n    }\n}\n"
  },
  {
    "path": "packages/mobx-react/.browserlistrc",
    "content": "{\n    \"targets\": {\n        \"chrome\": \"58\",\n        \"ie\": \"9\"\n    }\n}\n"
  },
  {
    "path": "packages/mobx-react/CHANGELOG.md",
    "content": "# mobx-react\n\n## 9.2.1\n\n### Patch Changes\n\n-   [`2e703388eda4ba3eefed2bf1f5ca3958980978c3`](https://github.com/mobxjs/mobx/commit/2e703388eda4ba3eefed2bf1f5ca3958980978c3) [#4584](https://github.com/mobxjs/mobx/pull/4584) Thanks [@mweststrate](https://github.com/mweststrate)! - Fix type definition of `observer`, when used in combination with a Higher Order Component. By @mbest in #4576\n\n-   Updated dependencies [[`2e703388eda4ba3eefed2bf1f5ca3958980978c3`](https://github.com/mobxjs/mobx/commit/2e703388eda4ba3eefed2bf1f5ca3958980978c3)]:\n    -   mobx-react-lite@4.1.1\n\n## 9.2.0\n\n### Minor Changes\n\n-   [`2587df31a1a967a6b385b7ab2d9f0d42fc94e4b0`](https://github.com/mobxjs/mobx/commit/2587df31a1a967a6b385b7ab2d9f0d42fc94e4b0) [#3985](https://github.com/mobxjs/mobx/pull/3985) Thanks [@imjordanxd](https://github.com/imjordanxd)! - \\* Added React 19 support, fixes #3986\n\n### Patch Changes\n\n-   Updated dependencies [[`2587df31a1a967a6b385b7ab2d9f0d42fc94e4b0`](https://github.com/mobxjs/mobx/commit/2587df31a1a967a6b385b7ab2d9f0d42fc94e4b0)]:\n    -   mobx-react-lite@4.1.0\n\n## 9.1.1\n\n### Patch Changes\n\n-   [`61abc53f`](https://github.com/mobxjs/mobx/commit/61abc53ff10554d1d5ce3e85466f6beda4d63fa2) [#3852](https://github.com/mobxjs/mobx/pull/3852) Thanks [@mweststrate](https://github.com/mweststrate)! - Patched the release process, forcing release to get everything in pristine state.\n\n-   Updated dependencies [[`61abc53f`](https://github.com/mobxjs/mobx/commit/61abc53ff10554d1d5ce3e85466f6beda4d63fa2), [`7bbb523a`](https://github.com/mobxjs/mobx/commit/7bbb523a7b81229570e0e2a176b989bfc74c4634)]:\n    -   mobx-react-lite@4.0.7\n\n## 9.1.0\n\n### Minor Changes\n\n-   [`c9260974`](https://github.com/mobxjs/mobx/commit/c9260974f726f58de0fd4974ea024c644d9b7c6f) [#3790](https://github.com/mobxjs/mobx/pull/3790) Thanks [@mweststrate](https://github.com/mweststrate)! - Added support for modern 2022.3 Decorators. [#3790](https://github.com/mobxjs/mobx/pull/3790)\n    -   [Installation / usage instruction](https://mobx.js.org/enabling-decorators.html).\n    -   [Introduction announcement](https://michel.codes/blogs/mobx-decorators)\n    -   Original PR by [@Matchlighter](https://github.com/Matchlighter) in [#3638](https://github.com/mobxjs/mobx/pull/3638),\n\n## 9.0.2\n\n### Patch Changes\n\n-   [`5063c38e`](https://github.com/mobxjs/mobx/commit/5063c38ead557624321e2bbeb1aff905438564b0) [#3776](https://github.com/mobxjs/mobx/pull/3776) Thanks [@wbercx](https://github.com/wbercx)! - Fixed premature disposal of class component observers.\n\n## 9.0.1\n\n### Patch Changes\n\n-   [`d813746c`](https://github.com/mobxjs/mobx/commit/d813746cfaa18d80daddee3724562fed6b307c0a) [#3731](https://github.com/mobxjs/mobx/pull/3731) Thanks [@urugator](https://github.com/urugator)! - fix #3730: class component does not react to state changes performed before mount\n\n-   Updated dependencies [[`3ceeb865`](https://github.com/mobxjs/mobx/commit/3ceeb8651e328c4c7211c875696b3f5269fea834)]:\n    -   mobx-react-lite@4.0.4\n\n## 9.0.0\n\n### Major Changes\n\n-   [`473cb3f5`](https://github.com/mobxjs/mobx/commit/473cb3f5fc8bf43abdd1c9c7857fe2820d2291fe) [#3718](https://github.com/mobxjs/mobx/pull/3718) Thanks [@mweststrate](https://github.com/mweststrate)! - - Fixed `observer` in `StrictMode` #3671\n    -   **[BREAKING CHANGE]** Class component's `props`/`state`/`context` are no longer observable. Attempt to use these in any derivation other than component's `render` throws and error. For details see https://github.com/mobxjs/mobx/blob/main/packages/mobx-react/README.md#note-on-using-props-and-state-in-derivations\n    -   Extending or applying `observer` classes is now explicitly forbidden\n\n### Patch Changes\n\n-   Updated dependencies [[`58bb052c`](https://github.com/mobxjs/mobx/commit/58bb052ca41b8592e5bd5c3003b68ec52da53f33), [`473cb3f5`](https://github.com/mobxjs/mobx/commit/473cb3f5fc8bf43abdd1c9c7857fe2820d2291fe)]:\n    -   mobx-react-lite@4.0.3\n\n## 8.0.0\n\n### Major Changes\n\n-   [`44a2cf42`](https://github.com/mobxjs/mobx/commit/44a2cf42dec7635f639ddbfb19202ebc710bac54) [#3590](https://github.com/mobxjs/mobx/pull/3590) Thanks [@urugator](https://github.com/urugator)! - Functional components now use `useSyncExternalStore`, which should prevent tearing - you have to update mobx, otherwise it should behave as previously.<br>\n    Improved displayName/name handling of functional components as discussed in #3438.<br>\n    Reactions of uncommited class components are now correctly disposed, fixes #3492.<br>\n    Reactions don't notify uncommited class components, avoiding the warning, fixes #3492.<br>\n    Removed symbol \"polyfill\" and replaced with actual Symbols.<br>\n    Removed `this.render` replacement detection + warning. `this.render` is no longer configurable/writable (possibly BC).<br>\n    Class component instance is no longer exposed as `component[$mobx][\"reactcomponent\"]` (possibly BC).<br>\n    Deprecated `disposeOnUnmount`, it's not compatible with remounting.<br>\n\n### Patch Changes\n\n-   Updated dependencies [[`44a2cf42`](https://github.com/mobxjs/mobx/commit/44a2cf42dec7635f639ddbfb19202ebc710bac54)]:\n    -   mobx-react-lite@4.0.0\n\n## 7.6.0\n\n### Minor Changes\n\n-   [`7aab223e`](https://github.com/mobxjs/mobx/commit/7aab223e99bdd453365103782dba2047e77e41d0) [#3565](https://github.com/mobxjs/mobx/pull/3565) Thanks [@kubk](https://github.com/kubk)! - Make mobx-react compatible with TS 4.8+\n\n## 7.5.3\n\n### Patch Changes\n\n-   [`78d1aa23`](https://github.com/mobxjs/mobx/commit/78d1aa2362b4dc5d521518688d6ac7e2d4f7ad3a) [#3458](https://github.com/mobxjs/mobx/pull/3458) Thanks [@egilll](https://github.com/egilll)! - A slight revamp of the README, wording, and clearer links\n\n## 7.5.2\n\n### Patch Changes\n\n-   [`a23aaf3f`](https://github.com/mobxjs/mobx/commit/a23aaf3ff50217c40729e0d58c85767911323ebe) [#3452](https://github.com/mobxjs/mobx/pull/3452) Thanks [@urugator](https://github.com/urugator)! - fix #3448 regression: static rendering + class component\n\n## 7.5.1\n\n### Patch Changes\n\n-   [`bbcb12dc`](https://github.com/mobxjs/mobx/commit/bbcb12dc754524552181b177a52ffdbe80ecb953) [#3434](https://github.com/mobxjs/mobx/pull/3434) Thanks [@urugator](https://github.com/urugator)! - Support re-mounting of class components. Fixes #3395: observer not working with React@18 &lt;StrictMode&gt;.\n\n## 7.5.0\n\n### Minor Changes\n\n-   [`1470b8e4`](https://github.com/mobxjs/mobx/commit/1470b8e4273d6b4046f3107b7f6c30fcffc70eeb) [#3404](https://github.com/mobxjs/mobx/pull/3404) Thanks [@pixelkritzel](https://github.com/pixelkritzel)! - `this.context` is observable if static contextType is set\n\n## 7.4.0\n\n### Minor Changes\n\n-   [`4c5e75cd`](https://github.com/mobxjs/mobx/commit/4c5e75cdfec08c04ad774c70dca0629bd2c77016) [#3382](https://github.com/mobxjs/mobx/pull/3382) Thanks [@iChenLei](https://github.com/iChenLei)! - replace the deprecated react type definition with recommended type definition\n\n*   [`bd4b70d8`](https://github.com/mobxjs/mobx/commit/bd4b70d8ded29673af8161aa42fb88dc4ad4420e) [#3387](https://github.com/mobxjs/mobx/pull/3387) Thanks [@mweststrate](https://github.com/mweststrate)! - Added experimental / poor man's support for React 18. Fixes #3363, #2526. Supersedes #3005\n\n    -   Updated tests, test / build infra, peerDependencies to React 18\n    -   **[breaking icmw upgrading to React 18]** Already deprecated hooks like `useMutableSource` will trigger warnings in React 18, which is correct and those shouldn't be used anymore.\n    -   **[breaking icmw upgrading to React 18]** When using React 18, it is important that `act` is used in **unit tests** around every programmatic mutation. Without it, changes won't propagate!\n    -   The React 18 support is poor man's support; that is, we don't do anything yet to play nicely with Suspense features. Although e.g. [startTransition](https://github.com/mweststrate/platform-app/commit/bdd995773ddc6551235a4d2b0a4c9bd57d30510e) basically works, MobX as is doesn't respect the Suspense model and will always reflect the latest state that is being rendered with, so tearing might occur. I think this is in theoretically addressable by using `useSyncExternalStore` and capturing the current values together with the dependency tree of every component instance. However that isn't included in this pull request 1) it would be a breaking change, whereas the current change is still compatible with React 16 and 17. 2) I want to collect use cases where the tearing leads to problems first to build a better problem understanding. If you run into the problem, please submit an issue describing your scenario, and a PR with a unit tests demonstrating the problem in simplified form. For further discussion see #2526, #3005\n\n### Patch Changes\n\n-   Updated dependencies [[`4c5e75cd`](https://github.com/mobxjs/mobx/commit/4c5e75cdfec08c04ad774c70dca0629bd2c77016), [`bd4b70d8`](https://github.com/mobxjs/mobx/commit/bd4b70d8ded29673af8161aa42fb88dc4ad4420e)]:\n    -   mobx-react-lite@3.4.0\n\n## 7.3.0\n\n### Minor Changes\n\n-   [`59b42c28`](https://github.com/mobxjs/mobx/commit/59b42c2826208435353ce6bf154ae59077edcc05) [#3282](https://github.com/mobxjs/mobx/pull/3282) Thanks [@urugator](https://github.com/urugator)! - `observer(forwardRef(fn))` no longer generates extra `<Observer>` element and applies `memo` correctly\n\n### Patch Changes\n\n-   Updated dependencies [[`59b42c28`](https://github.com/mobxjs/mobx/commit/59b42c2826208435353ce6bf154ae59077edcc05)]:\n    -   mobx-react-lite@3.3.0\n\n## 7.2.1\n\n### Patch Changes\n\n-   [`8a1ff856`](https://github.com/mobxjs/mobx/commit/8a1ff856043d59396f623f8ca209822b1331d85f) [#3103](https://github.com/mobxjs/mobx/pull/3103) Thanks [@urugator](https://github.com/urugator)! - Missing `render` on component prototype throws.\n\n## 7.2.0\n\n### Minor Changes\n\n-   [`87b3e1de`](https://github.com/mobxjs/mobx/commit/87b3e1de58069617a39552d71a4d5c5c134cbbaf) [#2930](https://github.com/mobxjs/mobx/pull/2930) Thanks [@vkrol](https://github.com/vkrol)! - inject shouldn't change original displayName of component that uses forwardRef\n\n## 7.1.0\n\n### Patch Changes\n\n-   Updated dependencies [[`28f8a11d`](https://github.com/mobxjs/mobx/commit/28f8a11d8b94f1aca2eec4ae9c5f45c5ea2f4362)]:\n    -   mobx@6.1.0\n    -   mobx-react-lite@4.0.0\n\n## 7.0.6\n\n### Patch Changes\n\n-   [`592e6e99`](https://github.com/mobxjs/mobx/commit/592e6e996c2d5264e162cfb0921a071c1d815c92) [#2743](https://github.com/mobxjs/mobx/pull/2743) Thanks [@vkrol](https://github.com/vkrol)! - Remove `sideEffects` section in `mobx-react-lite` `package.json`\n\n-   Updated dependencies [[`6b304232`](https://github.com/mobxjs/mobx/commit/6b30423266e5418a3f20389d0bd0eae31f3384d2), [`83b84fd3`](https://github.com/mobxjs/mobx/commit/83b84fd354f2253fdd8ea556e217a92fc2633c00), [`65c7b73b`](https://github.com/mobxjs/mobx/commit/65c7b73b7f0b1a69a1a2786b5f484419d129d10b), [`989390d4`](https://github.com/mobxjs/mobx/commit/989390d46bbe9941b61ac6c6d1292f96445e7cc3), [`dea1cf18`](https://github.com/mobxjs/mobx/commit/dea1cf189b0f43929f4f626229d34a80bd10212e), [`592e6e99`](https://github.com/mobxjs/mobx/commit/592e6e996c2d5264e162cfb0921a071c1d815c92)]:\n    -   mobx@6.0.5\n    -   mobx-react-lite@3.1.7\n\n## 7.0.5\n\n### Patch Changes\n\n-   [`2f3dcb27`](https://github.com/mobxjs/mobx/commit/2f3dcb274f795ffca4ae724b6b4795958620838d) Thanks [@FredyC](https://github.com/FredyC)! - Fix names of UMD exports [#2517](https://github.com/mobxjs/mobx/issues/2617)\n\n-   Updated dependencies [[`2f3dcb27`](https://github.com/mobxjs/mobx/commit/2f3dcb274f795ffca4ae724b6b4795958620838d), [`79a09f49`](https://github.com/mobxjs/mobx/commit/79a09f49a9f2baddbab8d89e9a7ac07cffadf624)]:\n    -   mobx-react-lite@3.1.6\n    -   mobx@6.0.4\n\n## 7.0.4\n\n### Patch Changes\n\n-   [`8bbbc7c0`](https://github.com/mobxjs/mobx/commit/8bbbc7c0df77cd79530add5db2d6a04cfe6d84b1) Thanks [@FredyC](https://github.com/FredyC)! - Fix names of dist files (for real now). Third time is the charm 😅\n\n-   Updated dependencies [[`8bbbc7c0`](https://github.com/mobxjs/mobx/commit/8bbbc7c0df77cd79530add5db2d6a04cfe6d84b1)]:\n    -   mobx-react-lite@3.1.4\n\n## 7.0.3\n\n### Patch Changes\n\n-   [`b7aa9d35`](https://github.com/mobxjs/mobx/commit/b7aa9d35432888ee5dd80a6c9dcbc18b04a0346c) Thanks [@FredyC](https://github.com/FredyC)! - Fixed wrong package name for dist files\n\n-   Updated dependencies [[`b7aa9d35`](https://github.com/mobxjs/mobx/commit/b7aa9d35432888ee5dd80a6c9dcbc18b04a0346c)]:\n    -   mobx-react-lite@3.1.3\n\n## 7.0.2\n\n### Patch Changes\n\n-   [`5239db80`](https://github.com/mobxjs/mobx/commit/5239db80cf000026906c28a035725933d4dd6823) Thanks [@FredyC](https://github.com/FredyC)! - Fixed release with missing dist files\n\n-   Updated dependencies [[`5239db80`](https://github.com/mobxjs/mobx/commit/5239db80cf000026906c28a035725933d4dd6823)]:\n    -   mobx-react-lite@3.1.2\n\n## 7.0.1\n\n### Patch Changes\n\n-   [`81a2f865`](https://github.com/mobxjs/mobx/commit/81a2f8654d9656e2e831176e45cbf926fbc364e0) Thanks [@FredyC](https://github.com/FredyC)! - ESM bundles without NODE_ENV present are available in dist folder. This useful for consumption in browser environment that supports ESM Choose either `esm.production.min.js` or `esm.development.js` from `dist` folder.\n\n-   Updated dependencies [[`81a2f865`](https://github.com/mobxjs/mobx/commit/81a2f8654d9656e2e831176e45cbf926fbc364e0)]:\n    -   mobx-react-lite@3.1.1\n\n## 7.0.0\n\nRelease for compatibility with MobX v6\n\n## 6.3.1\n\n### Patch Changes\n\n-   [`aa780c0`](https://github.com/mobxjs/mobx-react/commit/aa780c07162be99e198e7bbdbd6465c1f451f1d6) [#908](https://github.com/mobxjs/mobx-react/pull/908) Thanks [@FredyC](https://github.com/FredyC)! - Initial setup of [changesets](https://github.com/atlassian/changesets). No code changes present.\n\n## 6.3.0\n\n-   Updated mobx-react-lite to 2.2.0 which removes the need to manually configure batching. Fixes [#859](https://github.com/mobxjs/mobx-react/issues/859)\n\n## 6.2.4\n\n-   Fix error thrown in the already defined observer class component warning message when attempting to get the components display name. [#887](https://github.com/mobxjs/mobx-react/issues/887)\n\n## 6.2.3\n\n-   Log warning if class component is already an observer to prevent memory leaks. [#839](https://github.com/mobxjs/mobx-react/issues/839)\n-   Fix disposeOnUnmount when using react-hot-loader. [#725](https://github.com/mobxjs/mobx-react/issues/725)\n\n## 6.2.2\n\n-   Observer batching imports are kept in production builds as side effects ([see issue](https://github.com/mobxjs/mobx-react-lite/issues/273))\n\n## 6.2.1\n\n-   Remove auto configured observer batching using react-dom. Fixes: [#852](https://github.com/mobxjs/mobx-react/issues/852).\n\n## 6.2.0\n\n-   Updated to latest mobx-react-lite V2 for compatibility with `React.StrictMode`.\n-   Observer batching (see more [in the docs](https://github.com/mobxjs/mobx-react-lite/#observer-batching)).\n-   Possibly breaking change, the `dist/mobxreact.rn.module.js` is no longer available, use `dist/mobxreact.esm.js` instead.\n\n## 6.1.6 / 6.1.7\n\n-   Fix an issue with class components & observableRequiresReaction. [#806](https://github.com/mobxjs/mobx-react/issues/806) through [#829](https://github.com/mobxjs/mobx-react/pull/829)\n-   Use TSDX for building to mitigate issues with accessing `process.env` [#821](https://github.com/mobxjs/mobx-react/pull/821)\n\n## 6.1.5\n\n-   Added check if `process.env` is available, fixes [#801](https://github.com/mobxjs/mobx-react/issues/801) through [#812](https://github.com/mobxjs/mobx-react/pull/812) by [@ynejati](https://github.com/ynejati)\n-   Added warning if component's `render` method is accidentally overwritten. [#799](https://github.com/mobxjs/mobx-react/pull/799) by [@Venryx](https://github.com/Venryx). Helps prevent memory leaks as in: [#797](https://github.com/mobxjs/mobx-react/issues/797)\n\n## 6.1.4\n\n-   Update dependency mobx-react-lite@1.4.2 which includes fix for [RN Fast Refresh](https://github.com/mobxjs/mobx-react-lite/issues/226)\n\n## 6.1.2 / 6.1.3\n\n-   Add reexport of `useObserver` from `mobx-react-lite` [#734](https://github.com/mobxjs/mobx-react/issues/734)\n-   Add the ability to pass multiple children to Provider\n-   Fixed [#717](https://github.com/mobxjs/mobx-react/issues/717). Now `inject` works correctly with components that use `React.forwardRef`\n-   Observer checks for use of React.memo [#720](https://github.com/mobxjs/mobx-react/issues/720)\n-   Get rid of the redundant Injector wrapper [#716](https://github.com/mobxjs/mobx-react/pull/716)\n\n## 6.1.1\n\n-   Fixed issue where combining `@disposeOnUnmount` with `disposeOnUnmount` didn't clean up everything. Fixes [#666](https://github.com/mobxjs/mobx-react/issues/666) trough [#671](https://github.com/mobxjs/mobx-react/pull/671) by [@JabX](https://github.com/JabX)\n\n## 6.1.0\n\n-   Restored the classic implementation of `observer`: class based components are patched again, rather than wrapping them in `<Observer>`, see [#703](https://github.com/mobxjs/mobx-react/pull/703). Fixes:\n    -   `componentDidUpdate` not being triggered after a reactive render [#692](https://github.com/mobxjs/mobx-react/issues/692)\n    -   The appearance of an additional `<Observer>` component in the component tree, which complicates shallow testing [#699](https://github.com/mobxjs/mobx-react/issues/699)\n    -   Some regressions in `disposeOnUnmount` [#702](https://github.com/mobxjs/mobx-react/issues/702)\n    -   Note that dev tool support, and other constraints mentioned in the 6.0.0 release notes have not been restored.\n-   The function `useStaticRendering(value: boolean): void` from mobx-react-lite is now exposed\n\n## 6.0.4\n\n-   Fixed IE 11 compatibility which was accidentally broken. Fixes [#698](https://github.com/mobxjs/mobx-react/issues/698)\n\n## 6.0.3\n\n-   `disposeOnUnmount` now supports initializing it with an array of disposers. Fixes [#637](https://github.com/mobxjs/mobx-react/pull/637) through [#641](https://github.com/mobxjs/mobx-react/pull/641) by [@Amareis](https://github.com/Amareis)\n-   Fixed hoisting of statically declared members. Fixes [#678](https://github.com/mobxjs/mobx-react/issues/678) through [#682](https://github.com/mobxjs/mobx-react/pull/682) by [@meabed](https://github.com/meabed)\n\n## 6.0.2\n\n-   Added missing types for `MobXProviderContext`, `useLocalStore` and `useAsObservableSource`. Fixes #679.\n\n## 6.0.0\n\n**Breaking changes**\n\n-   The minimal supported version of React is 16.8.0\n-   Killed the possibility to directly pass store names to `observer`. Always use `inject` instead. (This was deprecated for a long time already). `observer([\"a\", \"b\"], component)` should now be written as `inject(\"a\", \"b\")(component)`.\n-   `observer` components no longer automatically recover from errors (to prevent potential memory leaks). Instead, this is the responsibility of error boundaries.\n-   `inject` now supports ref forwarding. As such, the `.wrappedInstance` property has been removed since refs can be used instead. (Fixes [#616](https://github.com/mobxjs/mobx-react/issues/616) (See also [#619](https://github.com/mobxjs/mobx-react/pull/619) by [42shadow42](https://github.com/42shadow42))\n-   Changing the set of stores in `Provider` is no longer supported and while throw a hard error (this was a warning before), as the model of `Provider` / `inject` has always been designed to inject final values into the tree. (That is, constanted references, the injected objects themselves can be stateful without problem). If you want to dynamically swap what is provided into the tree, use `React.createContext` instead of `Provider` / `inject`. The suppressChangedStoreWarning`flag for`Provider` has been dropped.\n-   The third argument of custom `storesToProps` functions passed to `inject` is no longer available.\n-   `<Observer>` no longer supports the deprecated `inject` property.\n-   Defining `shouldComponentUpdate` on `observer` based components is no longer supported\n-   `propTypes` is no longer exposed, use `PropTypes` instead\n-   `disposeOnUnmount` now only supports direct subclasses of `React.Component` and `React.PureComponent`. This prevents several unreliable edge cases that silently leaked memory before. Either only extend React.(Pure)Component when using `disposeOnUnmount`, or manually clean up stuff in `componentWillUnmount`.\n-   The `onError` global error handler has been removed. Use error boundaries instead.\n-   Improved dev tool names for `inject` wrapped components, see [#472](https://github.com/mobxjs/mobx-react/pull/472) by [SimeonC](https://github.com/SimeonC). Fixes [#466](https://github.com/mobxjs/mobx-react/issues/466)\n-   Dropped support for a build of mobx-react that doesn't target either `react-dom` or `react-native`. mobx-react doesn't need `react-dom` to be present, but to make sure your build tools don't fail, you might want to stub `react-dom` as an empty module.\n-   The `componentWillReact` has been dropped\n-   The MobX-react devtools (either as package or browser plugin) are no longer supported. Instead, the following tools can be analyzed to analyze your mobx-react application:\n    -   Visualizing re-rendering of components is now part of the standard React devtools\n    -   The dependency tree of a compent tree can be inspected by showing the state of the `useObserver` hook in the React devtools (at the time of this release it displays as just `Object`, but the next iteration of the React devtools will support those properly)\n    -   Spying on events can still be done with the [MobX-react browser plugin](https://github.com/mobxjs/mobx-devtools), through the [mobx-logger](https://github.com/winterbe/mobx-logger) package or manually by using the `spy` or `trace` utility from the mobx package.\n\n**Improvements**\n\n-   Hook based components are now supported by mobx-react (in fact, the package is now implemented using hooks)\n-   Class based `observer` components are now _recommended_ to extend `React.PureComponent`. Functional `observer` components are now automatically wrapped in `React.memo` internally. See section in [README](https://mobx.js.org/README.html#observercomponentclass) for more details.\n-   For `observer` based components, there will now be an additional `Observer` component in the tree.\n-   Two new hooks have been exposed, in case you want to manage local state in observable: `useLocalStore` and `useAsObservableSource`.\n-   `MobXProviderContext` is now exposed from the package, in case you want to consume the context used by `Provider` with a `useContext` hook.\n\n## 5.4.3\n\n-   Fixed [#612](https://github.com/mobxjs/mobx-react/issues/612), `contextType` was hoisted by `inject`, which shouldn't the case.\n\n## 5.4.1 / 5.4.2\n\n-   Fixed issue where `react-is` wasn't properly rolled-up into the package. Fixes [#608](https://github.com/mobxjs/mobx-react/issues/608)\n\n## 5.4.0\n\n-   Added support for forward refs, fixes [#602](https://github.com/mobxjs/mobx-react/issues/602)\n\n## 5.3.6\n\n-   Fixed some additional issues around life-cycle patching, take 3. See [#536](https://github.com/mobxjs/mobx-react/pull/586) by [@xaviergonz](https://github.com/xaviergonz). Fixed [#579](https://github.com/mobxjs/mobx-react/issues/579)\n\n## 5.3.5\n\n-   Fixed some additional issues around life-cycle patching, see [#583](https://github.com/mobxjs/mobx-react/pull/583) by [@xaviergonz](https://github.com/xaviergonz). Fixed [#581](https://github.com/mobxjs/mobx-react/issues/581)\n\n## 5.3.4\n\n-   Fixed unending recursing as a result of lifecylce patching. Fixes [#579](https://github.com/mobxjs/mobx-react/issues/579) through [#582](https://github.com/mobxjs/mobx-react/pull/582) by [@xaviergonz](https://github.com/xaviergonz)\n\n## 5.3.3\n\n-   Fixed `Cannot read property 'forEach' of undefined` exception if `disposeOnUnmount` was called conditionally. [#578](https://github.com/mobxjs/mobx-react/pull/578) by [Jef Hellemans](https://github.com/JefHellemans)\n\n## 5.3.2\n\n-   Fixed: \"process not defined\", [#574](https://github.com/mobxjs/mobx-react/pull/574/) through [#576](https://github.com/mobxjs/mobx-react/pull/576/) by [@xaviergonz](https://github.com/xaviergonz)\n\n## 5.3.0 / 5.3.1\n\n_5.3.0 was retracted as files were not generated correctly during publish_\n\n-   Added `disposeOnUnmount` utility / decorator to call disposable properties (reaction, autorun, etc) automatically on `componentWillUnmount`\n-   Introduced new method to patch lifecycle methods which should be more compatible with for example arrow functions.\n\n## 5.2.8\n\n-   Make sure `mobx-react` doesn't require `Object.assign` polyfill\n\n## 5.2.7\n\n-   Fixed issue where React 16.5 printed a warning when using `Provider`, fixes [#545](https://github.com/mobxjs/mobx-react/issues/545)\n\n## 5.2.6\n\n-   Fixed bug in defining properties (although the bug had no known observable effect). Fixes [#540](https://github.com/mobxjs/mobx-react/issues/540)\n\n## 5.2.4 / 5.2.5\n\n-   Improved compatibility with React-Hot-Loader, see [#522](https://github.com/mobxjs/mobx-react/pull/522) by [theKashey](https://github.com/theKashey). Fixes [#500](https://github.com/mobxjs/mobx-react/issues/500)\n\n## 5.2.3\n\n-   Fixed problem with `Symbol` feature detection. By [@Strate](https://github.com/Strate) through [#501](https://github.com/mobxjs/mobx-react/pull/501). Fixes [#498](https://github.com/mobxjs/mobx-react/issues/498) and [#503](https://github.com/mobxjs/mobx-react/issues/503).\n\n## 5.2.2\n\n-   Polyfill `Symbol` if it doesn't exist. By [@Strate](https://github.com/Strate) through [#499](https://github.com/mobxjs/mobx-react/pull/499).\n\n## 5.2.1\n\n-   Component `props` and `state` properties are now made observable during the instance creation. This restores the behavior from before 5.1.0 where `props` and `state` could safely be observed during mount. Actually it is now possible to do similar things in constructors as well. Fixes [#478](https://github.com/mobxjs/mobx-react/issues/478). Thanks [@Strate](https://github.com/Strate) for the idea and PR! [#496](https://github.com/mobxjs/mobx-react/pull/496).\n\n## 5.2.0\n\n-   Added backward compatible support for MobX 5.\n-   Fixed components sometimes being displayed as `undefined` in mobx-devtools. See [#470](https://github.com/mobxjs/mobx-react/pull/470) by [@MauricioAndrades](https://github.com/MauricioAndrades)\n-   Removed unnecessary warning `@observer` was used both on a sub and super class. See [#492](https://github.com/mobxjs/mobx-react/pull/476) by [@skiritsis](https://github.com/skiritsis). _N.B. putting `@observer` on a super and subclass is still not an supported pattern, use @observer on subclasses only!_\n\n## 5.1.2\n\n-   Fixed regression bug in integration with devtools. Fixed through [#465](https://github.com/mobxjs/mobx-react/pull/465) by @le0nik\n\n## 5.1.0\n\n-   Added support for React 16.3, including support for the `getDerivedStateFromProps` life-cycle hook. MobX will no longer use `componentWillMount` hook internally, so that it can be used in `StrictMode` react as well. Fixes [#447](https://github.com/mobxjs/mobx-react/issues/447)\n-   Static properties of a function component are now automatically hoisted when the component is wrapped by `observer`. Implements [#427](https://github.com/mobxjs/mobx-react/pull/427)\n-   Misspelled export `componentByNodeRegistery` is now properly export as `componentByNodeRegistry` as well, please update consumers, the mispelled version will be dropped in the next major. Fixes [#421](https://github.com/mobxjs/mobx-react/issues/421)\n-   Deprecated the support for the `inject` property on `Observer`, it is fundamentally broken and should not be used. Use `inject` on the enclosing component instead and grab the necessary stores from the closure. Fixes [#423](https://github.com/mobxjs/mobx-react/issues/423)\n-   Added warning about using `observer` on a React.PureComponent, this will become an exception in the next major. Fixes [#309](https://github.com/mobxjs/mobx-react/issues/309)\n-   Mobx-react will now print a warning when combining `observer` with a custom `shouldComponentUpdate` implementation. Fixes [#417](https://github.com/mobxjs/mobx-react/issues/417)\n\n## 5.0.0\n\n-   Added compatibility with MobX 4.x. This version is not compatible with older Mobx versions\n\n## 4.4.3\n\n-   The exposed React Native build now uses commonjs, to prevent the need of further transpilation. Fixes [#428](https://github.com/mobxjs/mobx-react/issues/428)\n\n## 4.4.2\n\n-   Fixed issue with mobx-react not compiling on react-native due to the presence of a `.babelrc` file. Fixes [#415](https://github.com/mobxjs/mobx-react/issues/415) by [Ryan Rampersad](https://github.com/ryanmr) through [#416](https://github.com/mobxjs/mobx-react/pull/416)\n\n## 4.4.1\n\n-   Fixed syntax error in 4.4.0 that escaped\n\n## 4.4.0\n\n-   `Observer` now supports render props, `render` and `inject`. See the updated readme. By [ZiYingMai](https://github.com/Sunshine168) through [#403](https://github.com/mobxjs/mobx-react/pull/403)\n-   Fixed: `NaN` is now considered to be equal to `NaN` when doing reconciliation. Fixes [#363](https://github.com/mobxjs/mobx-react/issues/363), by [Andrew Branch](https://github.com/andrewbranch) through [#402](https://github.com/mobxjs/mobx-react/pull/402)\n-   Improved typings of `Observer` component, by [Rafał Filipek](https://github.com/RafalFilipek) through [#376](https://github.com/mobxjs/mobx-react/pull/376)\n-   Fixed incorrect generation of component name, by [Andy Kogut](https://github.com/andykog) through [#368](https://github.com/mobxjs/mobx-react/pull/368)\n-   Lot of internal repo upgrades: Test suite is now in Jest, Prettier is used etc.\n\n## 4.3.5\n\nFixed some issues with the typescript typings. See for example #353\n\n## 4.3.4\n\nImproved typescript typings, including support for `strict` mode in TS 2.6. Fixes\n\n## 4.3.3\n\nAdded support for React 16. (No changes)\n\n## 4.3.2\n\nKilled accidentally exposed default exports.\n\nIf you are still using `import mobxReact from \"mobx-react\"`, use `import * as mobxReact from \"mobx-react\"`, or better `import { whatYouNeed } from \"mobx-react\"` instead.\n\n## 4.3.1\n\n## 4.3.0 (unpublished)\n\nImproved module rollup setup, enabling better tree shaking. See #324 / #328\n\n## 4.2.2\n\n-   Fixed check for stateless components, by @leader22, see #280\n\n## 4.2.1\n\n_Note: Due to pull / rebase issue the release commit is incorrect. This is the released [commit](https://github.com/mobxjs/mobx-react/commit/f1b3eefc5239cb451b317204fa8aad94b4dcfc2f)_\n\n-   Reduced module size by 31% (switched to rollup.js). See #244 by @rossipedia\n-   Skip creation of `.wrappedInstance` reference for stateless components. See #254 by @farwayer\n-   Introduced global `onError` handler hook to be notified on errors thrown by `@observer` components. See #262 by @andykog\n-   Improved typescript typings of the exposed `propTypes`, See #263 by @panjiesw\n\n## 4.2.0\n\n-   Same as 4.2.1, but contained build issue and is unpublished\n\n## 4.1.8\n\n-   Undid change introduced in 4.1.4 where the lifecycle hooks were protected, as this breaks react-hot-loader.... Fixes #231\n\n## 4.1.7\n\n-   Added support for React 15.5 (no deprecation warnings) and 16.0 (no proptypes / createClass), by @andykog, see #238. Fixes #233, #237\n\n## 4.1.5\n\n-   Improved typescript typings, fixes #223\n\n## 4.1.4\n\n-   Made lifecycle hooks used by mobx-react read-only to make sure they are not accidentally overwritten in component instances. Fixes, #195, #202. Note that they can still be defined, just make sure to define them on the prototype (`componentWillMount() {}`) instead of the instance (`componentWillMount = () => {}`). Which is best practice anyway.\n\n## 4.1.3\n\n-   Fixed `ReactDOM.findDOMNode` exception when using react-test-runner, #216\n\n## 4.1.2\n\n-   Exceptions caught during render are now rethrown with proper stack, fixes #206\n\n## 4.1.1\n\n-   Exposed `wrappedInstance` and `wrappedComponent` in typings\n-   Fixed accidental use of `default` import from `mobx` package.\n\n## 4.1.0\n\n-   Added support for MobX3. Note that using MobX3 changes the error semantics. If an `observer` component throws, it will no longer crash the app, but just log the exceptions instead.\n\n## 4.0.4\n\n-   Introduced `suppressChangedStoreWarning` to optionally supresss change store warnings, by @dropfen, see #182, #183\n\n## 4.0.3\n\n-   Fixed issue where userland componentWilMount was run before observer componentWillMount\n\n## 4.0.2\n\n-   Fixed order of `inject` overloads, see #169\n-   Fixed import of `mobx` when using Webpack without commonjs plugin, see: #168\n\n## 4.0.1\n\n-   Improved typings, by @timmolendijk, fixes #164, #166\n-   Fixed `inject` signature in readme, by @farwayer\n\n## 4.0.0\n\n### `observer` now uses shallow comparision for all props _(Breaking change)_\n\n`observer` used to compare all properties shallow in the built-in _shouldComponentUpdate_, except when it received\nnon-observable data structures.\nBecause mobx-react cannot know whether a non observable has been deeply modified, it took no chances and just re-renders.\n\nHowever, the downside of this when an unchanged, non-observable object is passed in to an observer component again, it would still cause a re-render.\nObjects such as styling etc. To fix this mobx-react will now always compare all properties in a pure manner.\nIn general this should cause no trouble, as typically mutable data in mobx based objects is captured in observable objects, which will still cause components to re-render if needed.\n\nIf you need to pass in a deeply modified object and still want to make sure to cause a re-render, either\n\n-   make sure the object / array is an observable\n-   do not decorate your component with `observer`, but use `Observer` regions instead (see below)\n\nSee [#160](https://github.com/mobxjs/mobx-react/issues/160) for more details.\n\n### `inject(fn)(component)` will now track `fn` as well\n\n`inject(func)` is now reactive as well, that means that transformations in the selector function will be tracked, see [#111](https://github.com/mobxjs/mobx-react/issues/111)\n\n```javascript\nconst NameDisplayer = ({ name }) => <h1>{name}</h1>\n\nconst UserNameDisplayer = inject(stores => ({\n    name: stores.userStore.name\n}))(NameDisplayer)\n\nconst user = mobx.observable({\n    name: \"Noa\"\n})\n\nconst App = () => (\n    <Provider userStore={user}>\n        <UserNameDisplayer />\n    </Provider>\n)\n\nReactDOM.render(<App />, document.body)\n```\n\n_N.B. note that in this specific case NameDisplayer doesn't have to be an `observer`, as it doesn't receive observables, but just plain data from the transformer function._\n\n### `this.props` and `this.state` in React components are now observables as well\n\nA common cause of confusion were cases like:\n\n```javascript\n@observer class MyComponent() {\n    @computed upperCaseName() {\n        return this.props.user.name.toUpperCase()\n    }\n\n    render() {\n        return <h1>{this.upperCaseName}</h1>\n    }\n}\n```\n\nThis component would re-render if `user.name` was modified, but it would still render the previous user's name if a complete new user was received!\nThe reason for that is that in the above example the only observable tracked by the computed value is `user.name`, but not `this.props.user`.\nSo a change to the first would be picked up, but a change in `props` itself, assigning a new user, not.\n\nAlthough this is technically correct, it was a source of confusion.\nFor that reason `this.state` and `this.props` are now automatically converted to observables in any `observer` based react component.\nFor more details, see [#136](https://github.com/mobxjs/mobx-react/pull/136) by @Strate\n\n### Better support for Server Side Rendering\n\nIntroduced `useStaticRendering(boolean)` to better support server-side rendering scenarios. See [#140](https://github.com/mobxjs/mobx-react/issues/140)\n\n### Introduced `Observer` as alternative syntax to the `observer` decorator.\n\n_This feature is still experimental and might change in the next minor release, or be deprecated_\n\nIntroduced `Observer`. Can be used as alternative to the `observer` decorator. Marks a component region as reactive.\nSee the Readme / [#138](https://github.com/mobxjs/mobx-react/issues/138)\nExample:\n\n```javascript\nconst UserNameDisplayer = ({ user }) => <Observer>{() => <div>{user.name}</div>}</Observer>\n```\n\n### Using `observer` to inject stores is deprecated\n\nThe fact that `observer` could inject stores as well caused quite some confusion.\nBecause in some cases `observer` would return the original component (when not inject), but it would return a HoC when injecting.\nTo make this more consistent, you should always use `inject` to inject stores into a component. So use:\n\n```\n@inject(\"store1\", \"store2\") @observer\nclass MyComponent extends React.Component {\n```\n\nor:\n\n```\nconst MyComponent = inject(\"store1\", \"store2\")(observer(props => rendering))\n```\n\nFor more info see the related [discussion](https://github.com/mobxjs/mobx-react/commit/666577b41b7af8209839e7b243064a31c9951632#commitcomment-19773706)\n\n### Other improvements\n\n-   If `mobx` and `mobx-react` are used in combination, all reactions are run as part of React's batched updates. This minimizes the work of the reconciler, guarantees optimal rendering order of components (if the rendering was not triggered from within a React event). Tnx @gkaemmer for the suggestion.\n-   It is now possible to directly define `propTypes` and `defaultProps` on components wrapped with `inject` (or `observer([\"stores\"])`) again, see #120, #142. Removed the warnings for this, and instead improved the docs.\n-   Clean up data subscriptions if an error is thrown by an `observer` component, see [#134](https://github.com/mobxjs/mobx-react/pull/134) by @andykog\n-   export `PropTypes` as well in typescript typings, fixes #153\n-   Add react as a peer dependency\n-   Added minified browser build: `index.min.js`, fixes #147\n-   Generate better component names when using `inject`\n\n---\n\n## 3.5.9\n\n-   Print warning when `inject` and `observer` are used in the wrong order, see #146, by @delaetthomas\n\n## 3.5.8\n\n-   Fixed issue where `props` where not passed properly to components in very rare cases. Also fixed #115\n\n## 3.5.7\n\n-   Bundles are no longer minified, fixes #127\n\n## 3.5.6\n\n-   Export `propTypes` as `PropTypes`, like React (@andykog, ##117)\n\n## 3.5.5\n\n-   Removed `experimental` status of `inject` / `Provider`. Official feature now.\n-   Fixed hot-reloading issue, #101\n\n## 3.5.4\n\n-   Introduced `wrappedInstance` by @rossipedia on `inject` decorated HOC's, see https://github.com/mobxjs/mobx-react/pull/90/\n-   print warnings when assign values to `propTypes`, `defaultProps`, or `contextTypes` of a HOC. (by @jtraub, see https://github.com/mobxjs/mobx-react/pull/88/)\n-   Static properties are now hoisted to HoC components when, #92\n-   If `inject` is used incombination with a function, the object return from the function will now be merged into the `nextProps` instead of replacing them, #80\n-   Always do propType checking untracked, partially fixes #56, #305\n\n## 3.5.3\n\n-   Fixed error `Cannot read property 'renderReporter' of undefined` (#96)\n\n## 3.5.2\n\n-   Added propTypes.observableArrayOf and propTypes.arrayOrObservableArrayOf (#91)\n\n## 3.5.1\n\n-   Fixed regression #85, changes caused by the constructor results in inconsistent rendering (N.B.: that is un-idiomatic React usage and React will warn about this!)\n\n## 3.5.0\n\n-   Introduced `inject(\"store1\", \"store2\")(component)` as alternative syntax to inject stores. Should address #77, #70\n-   Introduced the `wrappedComponent` property on injected higher order components, addresses #70, #72\n-   Fixed #76: error when no stores are provided through context\n-   Added typings for devTools related features (@benjamingr).\n-   Added MobX specific propTypes (@mattruby)\n-   Merged #44, fixes #73: don't re-render if component was somehow unmounted\n\n## 3.4.0\n\n-   Introduced `Provider` / context support (#53 / MobX #300)\n-   Fixed issues when using devtools with IE. #66 (By @pvasek)\n\n## 3.3.1\n\n-   Added typescript typings form `mobx-react/native` and `mobx-react/custom`\n-   Fixed #63: error when using stateless function components when using babel and typescript\n\n## 3.3.0\n\n-   Upgraded to MobX 2.2.0\n\n## 3.2.0\n\n-   Added support for react-native 0.25 and higher. By @danieldunderfelt.\n\n## 3.1.0\n\n-   Added support for custom renderers (without DOM), use: `mobx-react/custom` as import fixes #42\n-   Fixed some issues with rollup #43\n-   Minor optimization\n\n## 3.0.5\n\nIntroduced `componentWillReact`\n\n## 3.0.4\n\nThe debug name stateless function components of babel transpiled jsx are now properly picked up if the wrapper is applied after defining the component:\n\n```javascript\nconst MyComponent = () => <span>hi</span>\n\nexport default observer(MyComponent)\n```\n\n## 3.0.3\n\nRemoved peer dependencies, React 15 (and 0.13) are supported as well. By @bkniffler\n\n## 3.0.2\n\nRemoved the warning introduced in 3.0.1. It triggered always when using shallow rendering (when using shallow rendering `componentDidMount` won't fire. See https://github.com/facebook/react/issues/4919).\n\n## 3.0.1\n\nAdded warning when changing state in `getInitialState` / `constructor`.\n\n## 3.0.0\n\nUpgraded to MobX 2.0.0\n\n## 2.1.5\n\nImproved typescript typings overloads of `observer`\n\n## 2.1.4\n\nAdded empty 'dependencies' section to package.json, fixes #26\n\n## 2.1.3\n\nAdded support for context to stateless components. (by Kosta-Github).\n\n## 2.1.1\n\nFixed #12: fixed React warning when a component was unmounted after scheduling a re-render but before executing it.\n\n## 2.1.0\n\nUpped dependency of mobx to 1.1.1.\n\n## 2.0.1\n\nIt is now possible to define `propTypes` and `getDefaultProps` on a stateless component:\n\n```javascript\nconst myComponent = props => {\n    // render\n}\n\nmyComponent.propTypes = {\n    name: React.PropTypes.string\n}\n\nmyComponent.defaultProps = {\n    name: \"World\"\n}\n\nexport default observer(myComponent)\n```\n\nAll credits to Jiri Spac for this contribution!\n\n## 2.0.0\n\nUse React 0.14 instead of React 0.13. For React 0.13, use version `mobx-react@1.0.2` or higher.\n\n## 1.0.2\n\nMinor fixes and improvements\n\n## 1.0.1\n\nFixed issue with typescript typings. An example project with MobX, React, Typescript, TSX can be found here: https://github.com/mobxjs/mobx-react-typescript\n\n## 1.0.0\n\n`reactiveComponent` has been renamed to `observer`\n\n### 0.2.3\n\nAdded separte import for react-native: use `var reactiveComponent = require('mobx-react/native').reactiveComponent` for native support; webpack clients will refuse to build otherwise.\n\n### 0.2.2\n\nAdded react-native as dependency, so that the package works with either `react` or `react-native`.\n\n### 0.2.0\n\nUpgraded to MobX 0.7.0\n\n### 0.1.7\n\nFixed issue where Babel generated component classes where not properly picked up.\n\n### 0.1.6\n\n`observer` now accepts a pure render function as argument, besides constructor function. For example:\n\n```javascript\nvar TodoItem = observer(function TodoItem(props) {\n    var todo = props.todo\n    return <li>{todo.task}</li>\n})\n```\n\n### 0.1.5\n\nobserver is now defined in terms of side effects.\n\n### 0.1.4\n\nAdded support for React 0.14(RC) by dropping peer dependency\n"
  },
  {
    "path": "packages/mobx-react/LICENSE",
    "content": "The MIT License (MIT)\n\nCopyright (c) 2015 Michel Weststrate\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": "packages/mobx-react/README.md",
    "content": "# mobx-react\n\n[![CircleCI](https://circleci.com/gh/mobxjs/mobx-react.svg?style=svg)](https://circleci.com/gh/mobxjs/mobx-react)\n[![CDNJS](https://img.shields.io/cdnjs/v/mobx-react.svg)](https://cdnjs.com/libraries/mobx-react)\n[![Minzipped size](https://img.shields.io/bundlephobia/minzip/mobx-react.svg)](https://bundlephobia.com/result?p=mobx-react)\n[![Discuss on Github](https://img.shields.io/badge/discuss%20on-GitHub-orange)](https://github.com/mobxjs/mobx/discussions)\n[![View changelog](https://img.shields.io/badge/changelogs.xyz-Explore%20Changelog-brightgreen)](https://changelogs.xyz/mobx-react)\n\nPackage with React component wrapper for combining React with MobX.\nExports the `observer` decorator and other utilities.\nFor documentation, see the [MobX](https://mobx.js.org) project.\nThis package supports both React and React Native.\n\n## Compatibility matrix\n\nOnly the latest version is actively maintained. If you're missing a fix or a feature in older version, consider upgrading or using [patch-package](https://www.npmjs.com/package/patch-package)\n\n| NPM Version | Support MobX version | Supported React versions | Added support for:                                                               |\n| ----------- | -------------------- | ------------------------ | -------------------------------------------------------------------------------- |\n| v9          | 6.\\*                 | >16.8                    | Hooks, React 18.2 in strict mode                                                 |\n| v7          | 6.\\*                 | >16.8 < 18.2             | Hooks                                                                            |\n| v6          | 4.\\* / 5.\\*          | >16.8 <17                | Hooks                                                                            |\n| v5          | 4.\\* / 5.\\*          | >0.13 <17                | No, but it is possible to use `<Observer>` sections inside hook based components |\n\nmobx-react 6 / 7 is a repackage of the smaller [mobx-react-lite](https://github.com/mobxjs/mobx/tree/main/packages/mobx-react-lite) package + following features from the `mobx-react@5` package added:\n\n-   Support for class based components for `observer` and `@observer`\n-   `Provider / inject` to pass stores around (but consider to use `React.createContext` instead)\n-   `PropTypes` to describe observable based property checkers (but consider to use TypeScript instead)\n-   The `disposeOnUnmount` utility / decorator to easily clean up resources such as reactions created in your class based components.\n\n## Installation\n\n`npm install mobx-react --save`\n\nOr CDN: https://unpkg.com/mobx-react (UMD namespace: `mobxReact`)\n\n```javascript\nimport { observer } from \"mobx-react\"\n```\n\nThis package provides the bindings for MobX and React.\nSee the [official documentation](https://mobx.js.org/react-integration.html) for how to get started.\n\nFor greenfield projects you might want to consider to use [mobx-react-lite](https://github.com/mobxjs/mobx/tree/main/packages/mobx-react-lite), if you intend to only use function based components. `React.createContext` can be used to pass stores around.\n\n## API documentation\n\nPlease check [mobx.js.org](https://mobx.js.org/) for the general documentation. The documentation below highlights some specifics.\n\n### `observer(component)`\n\nFunction (and decorator) that converts a React component definition, React component class, or stand-alone render function, into a reactive component. A converted component will track which observables are used by its effective `render` and automatically re-render the component when one of these values changes.\n\n#### Functional Components\n\n`React.memo` is automatically applied to functional components provided to `observer`. `observer` does not accept a functional component already wrapped in `React.memo`, or an `observer`, in order to avoid consequences that might arise as a result of wrapping it twice.\n\n#### Class Components\n\n`shouldComponentUpdate` is not supported. As such, it is recommended that class components extend `React.PureComponent`. The `observer` will automatically patch non-pure class components with an internal implementation of `React.PureComponent` if necessary.\n\nExtending `observer` class components is not supported. Always apply `observer` only on the last class in the inheritance chain.\n\nSee the [MobX](https://mobx.js.org/react-integration.html#react-integration) documentation for more details.\n\n```javascript\nimport { observer } from \"mobx-react\"\n\n// ---- ES6 syntax ----\nconst TodoView = observer(\n    class TodoView extends React.Component {\n        render() {\n            return <div>{this.props.todo.title}</div>\n        }\n    }\n)\n\n// ---- ESNext syntax with decorator syntax enabled ----\n@observer\nclass TodoView extends React.Component {\n    render() {\n        return <div>{this.props.todo.title}</div>\n    }\n}\n\n// ---- or just use function components: ----\nconst TodoView = observer(({ todo }) => <div>{todo.title}</div>)\n```\n\n##### Note on using props and state in derivations\n\n`mobx-react` version 6 and lower would automatically turn `this.state` and `this.props` into observables.\nThis has the benefit that computed properties and reactions were able to observe those.\nHowever, since this pattern is fundamentally incompatible with `StrictMode` in React 18.2 and higher, this behavior has been removed in React 18.\n\nAs a result, we recommend to no longer mark properties as `@computed` in observer components if they depend on `this.state` or `this.props`.\n\n```javascript\n@observer\nclass Doubler extends React.Component<{ counter: number }> {\n    @computed // BROKEN! <-- @computed should be removed in mobx-react > 7\n    get doubleValue() {\n        // Changes to this.props will no longer be detected properly, to fix it,\n        // remove the @computed annotation.\n        return this.props * 2\n    }\n\n    render() {\n        return <div>{this.doubleValue}</div>\n    }\n}\n```\n\nSimilarly, reactions will no longer respond to `this.state` / `this.props`. This can be overcome by creating an observable copy:\n\n```javascript\n@observer\nclass Alerter extends React.Component<{ counter: number }> {\n    @observable observableCounter: number\n    reactionDisposer\n\n    constructor(props) {\n        this.observableCounter = counter\n    }\n\n    componentDidMount() {\n        // set up a reaction, by observing the observable,\n        // rather than the prop which is non-reactive:\n        this.reactionDisposer = autorun(() => {\n            if (this.observableCounter > 10) {\n                alert(\"Reached 10!\")\n            }\n        })\n    }\n\n    componentDidUpdate() {\n        // sync the observable from props\n        this.observableCounter = this.props.counter\n    }\n\n    componentWillUnmount() {\n        this.reactionDisposer()\n    }\n\n    render() {\n        return <div>{this.props.counter}</div>\n    }\n}\n```\n\nMobX-react will try to detect cases where `this.props`, `this.state` or `this.context` are used by any other derivation than the `render` method of the owning component and throw.\nThis is to make sure that neither computed properties, nor reactions, nor other components accidentally rely on those fields to be reactive.\n\nThis includes cases where a render callback is passed to a child, that will read from the props or state of a parent component.\nAs a result, passing a function that might later read a property of a parent in a reactive context will throw as well.\nInstead, when using a callback function that is being passed to an `observer` based child, the capture should be captured locally first:\n\n```javascript\n@observer\nclass ChildWrapper extends React.Component<{ counter: number }> {\n    render() {\n        // Collapsible is an observer component that should respond to this.counter,\n        // if it is expanded\n\n        // BAD:\n        return <Collapsible onRenderContent={() => <h1>{this.props.counter}</h1>} />\n\n        // GOOD: (causes to pass down a fresh callback whenever counter changes,\n        // that doesn't depend on its parents props)\n        const counter = this.props.counter\n        return <Collapsible onRenderContent={() => <h1>{counter}</h1>} />\n    }\n}\n```\n\n### `Observer`\n\n`Observer` is a React component, which applies `observer` to an anonymous region in your component.\nIt takes as children a single, argumentless function which should return exactly one React component.\nThe rendering in the function will be tracked and automatically re-rendered when needed.\nThis can come in handy when needing to pass render function to external components (for example the React Native listview), or if you\ndislike the `observer` decorator / function.\n\n```javascript\nclass App extends React.Component {\n    render() {\n        return (\n            <div>\n                {this.props.person.name}\n                <Observer>{() => <div>{this.props.person.name}</div>}</Observer>\n            </div>\n        )\n    }\n}\n\nconst person = observable({ name: \"John\" })\n\nReactDOM.render(<App person={person} />, document.body)\nperson.name = \"Mike\" // will cause the Observer region to re-render\n```\n\nIn case you are a fan of render props, you can use that instead of children. Be advised, that you cannot use both approaches at once, children have a precedence.\nExample\n\n```javascript\nclass App extends React.Component {\n    render() {\n        return (\n            <div>\n                {this.props.person.name}\n                <Observer render={() => <div>{this.props.person.name}</div>} />\n            </div>\n        )\n    }\n}\n\nconst person = observable({ name: \"John\" })\n\nReactDOM.render(<App person={person} />, document.body)\nperson.name = \"Mike\" // will cause the Observer region to re-render\n```\n\n### `useLocalObservable` hook\n\nLocal observable state can be introduced by using the `useLocalObservable` hook, that runs once to create an observable store. A quick example would be:\n\n```javascript\nimport { useLocalObservable, Observer } from \"mobx-react-lite\"\n\nconst Todo = () => {\n    const todo = useLocalObservable(() => ({\n        title: \"Test\",\n        done: true,\n        toggle() {\n            this.done = !this.done\n        }\n    }))\n\n    return (\n        <Observer>\n            {() => (\n                <h1 onClick={todo.toggle}>\n                    {todo.title} {todo.done ? \"[DONE]\" : \"[TODO]\"}\n                </h1>\n            )}\n        </Observer>\n    )\n}\n```\n\nWhen using `useLocalObservable`, all properties of the returned object will be made observable automatically, getters will be turned into computed properties, and methods will be bound to the store and apply mobx transactions automatically. If new class instances are returned from the initializer, they will be kept as is.\n\nIt is important to realize that the store is created only once! It is not possible to specify dependencies to force re-creation, _nor should you directly be referring to props for the initializer function_, as changes in those won't propagate.\n\nInstead, if your store needs to refer to props (or `useState` based local state), the `useLocalObservable` should be combined with the `useAsObservableSource` hook, see below.\n\nNote that in many cases it is possible to extract the initializer function to a function outside the component definition. Which makes it possible to test the store itself in a more straight-forward manner, and avoids creating the initializer closure on each re-render.\n\n_Note: using `useLocalObservable` is mostly beneficial for really complex local state, or to obtain more uniform code base. Note that using a local store might conflict with future React features like concurrent rendering._\n\n### Server Side Rendering with `enableStaticRendering`\n\nWhen using server side rendering, normal lifecycle hooks of React components are not fired, as the components are rendered only once.\nSince components are never unmounted, `observer` components would in this case leak memory when being rendered server side.\nTo avoid leaking memory, call `enableStaticRendering(true)` when using server side rendering.\n\n```javascript\nimport { enableStaticRendering } from \"mobx-react\"\n\nenableStaticRendering(true)\n```\n\nThis makes sure the component won't try to react to any future data changes.\n\n### Which components should be marked with `observer`?\n\nThe simple rule of thumb is: _all components that render observable data_.\nIf you don't want to mark a component as observer, for example to reduce the dependencies of a generic component package, make sure you only pass it plain data.\n\n### Enabling decorators (optional)\n\nDecorators are currently a stage-2 ESNext feature. How to enable them is documented [here](https://mobx.js.org/enabling-decorators.html#enabling-decorators-).\n\n### Should I still use smart and dumb components?\n\nSee this [thread](https://www.reddit.com/r/reactjs/comments/4vnxg5/free_eggheadio_course_learn_mobx_react_in_30/d61oh0l).\nTL;DR: the conceptual distinction makes a lot of sense when using MobX as well, but use `observer` on all components.\n\n### `PropTypes`\n\nMobX-react provides the following additional `PropTypes` which can be used to validate against MobX structures:\n\n-   `observableArray`\n-   `observableArrayOf(React.PropTypes.number)`\n-   `observableMap`\n-   `observableObject`\n-   `arrayOrObservableArray`\n-   `arrayOrObservableArrayOf(React.PropTypes.number)`\n-   `objectOrObservableObject`\n\nUse `import { PropTypes } from \"mobx-react\"` to import them, then use for example `PropTypes.observableArray`\n\n### `Provider` and `inject`\n\n_Note: usually there is no need anymore to use `Provider` / `inject` in new code bases; most of its features are now covered by `React.createContext`._\n\n`Provider` is a component that can pass stores (or other stuff) using React's context mechanism to child components.\nThis is useful if you have things that you don't want to pass through multiple layers of components explicitly.\n\n`inject` can be used to pick up those stores. It is a higher order component that takes a list of strings and makes those stores available to the wrapped component.\n\nExample (based on the official [context docs](https://facebook.github.io/react/docs/context.html#passing-info-automatically-through-a-tree)):\n\n```javascript\n@inject(\"color\")\n@observer\nclass Button extends React.Component {\n    render() {\n        return <button style={{ background: this.props.color }}>{this.props.children}</button>\n    }\n}\n\nclass Message extends React.Component {\n    render() {\n        return (\n            <div>\n                {this.props.text} <Button>Delete</Button>\n            </div>\n        )\n    }\n}\n\nclass MessageList extends React.Component {\n    render() {\n        const children = this.props.messages.map(message => <Message text={message.text} />)\n        return (\n            <Provider color=\"red\">\n                <div>{children}</div>\n            </Provider>\n        )\n    }\n}\n```\n\nNotes:\n\n-   It is possible to read the stores provided by `Provider` using `React.useContext`, by using the `MobXProviderContext` context that can be imported from `mobx-react`.\n-   If a component asks for a store and receives a store via a property with the same name, the property takes precedence. Use this to your advantage when testing!\n-   When using both `@inject` and `@observer`, make sure to apply them in the correct order: `observer` should be the inner decorator, `inject` the outer. There might be additional decorators in between.\n-   The original component wrapped by `inject` is available as the `wrappedComponent` property of the created higher order component.\n\n#### \"The set of provided stores has changed\" error\n\nValues provided through `Provider` should be final. Make sure that if you put things in `context` that might change over time, that they are `@observable` or provide some other means to listen to changes, like callbacks. However, if your stores will change over time, like an observable value of another store, MobX will throw an error.\nThis restriction exists mainly for legacy reasons. If you have a scenario where you need to modify the set of stores, please leave a comment about it in this issue https://github.com/mobxjs/mobx-react/issues/745. Or a preferred way is to [use React Context](https://reactjs.org/docs/context.html) directly which does not have this restriction.\n\n#### Inject as function\n\nThe above example in ES5 would start like:\n\n```javascript\nvar Button = inject(\"color\")(\n    observer(\n        class Button extends Component {\n            /* ... etc ... */\n        }\n    )\n)\n```\n\nA functional stateless component would look like:\n\n```javascript\nvar Button = inject(\"color\")(\n    observer(({ color }) => {\n        /* ... etc ... */\n    })\n)\n```\n\n#### Customizing inject\n\nInstead of passing a list of store names, it is also possible to create a custom mapper function and pass it to inject.\nThe mapper function receives all stores as argument, the properties with which the components are invoked and the context, and should produce a new set of properties,\nthat are mapped into the original:\n\n`mapperFunction: (allStores, props, context) => additionalProps`\n\nSince version 4.0 the `mapperFunction` itself is tracked as well, so it is possible to do things like:\n\n```javascript\nconst NameDisplayer = ({ name }) => <h1>{name}</h1>\n\nconst UserNameDisplayer = inject(stores => ({\n    name: stores.userStore.name\n}))(NameDisplayer)\n\nconst user = mobx.observable({\n    name: \"Noa\"\n})\n\nconst App = () => (\n    <Provider userStore={user}>\n        <UserNameDisplayer />\n    </Provider>\n)\n\nReactDOM.render(<App />, document.body)\n```\n\n_N.B. note that in this *specific* case neither `NameDisplayer` nor `UserNameDisplayer` needs to be decorated with `observer`, since the observable dereferencing is done in the mapper function_\n\n#### Using `PropTypes` and `defaultProps` and other static properties in combination with `inject`\n\nInject wraps a new component around the component you pass into it.\nThis means that assigning a static property to the resulting component, will be applied to the HoC, and not to the original component.\nSo if you take the following example:\n\n```javascript\nconst UserName = inject(\"userStore\")(({ userStore, bold }) => someRendering())\n\nUserName.propTypes = {\n    bold: PropTypes.boolean.isRequired,\n    userStore: PropTypes.object.isRequired // will always fail\n}\n```\n\nThe above propTypes are incorrect, `bold` needs to be provided by the caller of the `UserName` component and is checked by React.\nHowever, `userStore` does not need to be required! Although it is required for the original stateless function component, it is not\nrequired for the resulting inject component. After all, the whole point of that component is to provide that `userStore` itself.\n\nSo if you want to make assertions on the data that is being injected (either stores or data resulting from a mapper function), the propTypes\nshould be defined on the _wrapped_ component. Which is available through the static property `wrappedComponent` on the inject component:\n\n```javascript\nconst UserName = inject(\"userStore\")(({ userStore, bold }) => someRendering())\n\nUserName.propTypes = {\n    bold: PropTypes.boolean.isRequired // could be defined either here ...\n}\n\nUserName.wrappedComponent.propTypes = {\n    // ... or here\n    userStore: PropTypes.object.isRequired // correct\n}\n```\n\nThe same principle applies to `defaultProps` and other static React properties.\nNote that it is not allowed to redefine `contextTypes` on `inject` components (but is possible to define it on `wrappedComponent`)\n\nFinally, mobx-react will automatically move non React related static properties from wrappedComponent to the inject component so that all static fields are\nactually available to the outside world without needing `.wrappedComponent`.\n\n#### Strongly typing inject\n\n##### With TypeScript\n\n`inject` also accepts a function (`(allStores, nextProps, nextContext) => additionalProps`) that can be used to pick all the desired stores from the available stores like this.\nThe `additionalProps` will be merged into the original `nextProps` before being provided to the next component.\n\n```typescript\nimport { IUserStore } from \"myStore\"\n\n@inject(allStores => ({\n    userStore: allStores.userStore as IUserStore\n}))\nclass MyComponent extends React.Component<{ userStore?: IUserStore; otherProp: number }, {}> {\n    /* etc */\n}\n```\n\nMake sure to mark `userStore` as an optional property. It should not (necessarily) be passed in by parent components at all!\n\nNote: If you have strict null checking enabled, you could muffle the nullable type by using the `!` operator:\n\n```\npublic render() {\n   const {a, b} = this.store!\n   // ...\n}\n```\n\n#### Testing store injection\n\nIt is allowed to pass any declared store in directly as a property as well. This makes it easy to set up individual component tests without a provider.\n\nSo if you have in your app something like:\n\n```javascript\n<Provider profile={profile}>\n    <Person age={\"30\"} />\n</Provider>\n```\n\nIn your test you can easily test the `Person` component by passing the necessary store as prop directly:\n\n```\nconst profile = new Profile()\nconst mountedComponent = mount(\n   <Person age={'30'} profile={profile} />\n)\n```\n\nBear in mind that using shallow rendering won't provide any useful results when testing injected components; only the injector will be rendered.\nTo test with shallow rendering, instantiate the `wrappedComponent` instead: `shallow(<Person.wrappedComponent />)`\n\n### disposeOnUnmount(componentInstance, propertyKey | function | function[])\n\nFunction (and decorator) that makes sure a function (usually a disposer such as the ones returned by `reaction`, `autorun`, etc.) is automatically executed as part of the componentWillUnmount lifecycle event.\n\n```javascript\nimport { disposeOnUnmount } from \"mobx-react\"\n\nclass SomeComponent extends React.Component {\n    // decorator version\n    @disposeOnUnmount\n    someReactionDisposer = reaction(...)\n\n    // decorator version with arrays\n    @disposeOnUnmount\n    someReactionDisposers = [\n        reaction(...),\n        reaction(...)\n    ]\n\n\n    // function version over properties\n    someReactionDisposer = disposeOnUnmount(this, reaction(...))\n\n    // function version inside methods\n    componentDidMount() {\n        // single function\n        disposeOnUnmount(this, reaction(...))\n\n        // or function array\n        disposeOnUnmount(this, [\n            reaction(...),\n            reaction(...)\n        ])\n    }\n}\n```\n\n## DevTools\n\n`mobx-react@6` and higher are no longer compatible with the mobx-react-devtools.\nThat is, the MobX react devtools will no longer show render timings or dependency trees of the component.\nThe reason is that the standard React devtools are also capable of highlighting re-rendering components.\nAnd the dependency tree of a component can now be inspected by the standard devtools as well, as shown in the image below:\n\n![hooks.png](hooks.png)\n\n## FAQ\n\n**Should I use `observer` for each component?**\n\nYou should use `observer` on every component that displays observable data.\nEven the small ones. `observer` allows components to render independently from their parent and in general this means that\nthe more you use `observer`, the better the performance become.\nThe overhead of `observer` itself is negligible.\nSee also [Do child components need `@observer`?](https://github.com/mobxjs/mobx/issues/101)\n\n**I see React warnings about `forceUpdate` / `setState` from React**\n\nThe following warning will appear if you trigger a re-rendering between instantiating and rendering a component:\n\n```\n\nWarning: forceUpdate(...): Cannot update during an existing state transition (such as within `render`). Render methods should be a pure function of props and state.`\n\n```\n\n-- or --\n\n```\n\nWarning: setState(...): Cannot update during an existing state transition (such as within `render` or another component's constructor). Render methods should be a pure function of props and state; constructor side-effects are an anti-pattern, but can be moved to `componentWillMount`.\n\n```\n\nUsually this means that (another) component is trying to modify observables used by this components in their `constructor` or `getInitialState` methods.\nThis violates the React Lifecycle, `componentWillMount` should be used instead if state needs to be modified before mounting.\n"
  },
  {
    "path": "packages/mobx-react/__mocks__/react-native.js",
    "content": ""
  },
  {
    "path": "packages/mobx-react/__tests__/.eslintrc.yaml",
    "content": "env:\n    jest: true\nrules:\n    \"react/display-name\": \"off\"\n    \"react/prop-types\": \"off\"\n"
  },
  {
    "path": "packages/mobx-react/__tests__/Provider.test.tsx",
    "content": "import React from \"react\"\nimport { Provider } from \"../src\"\nimport { render } from \"@testing-library/react\"\nimport { MobXProviderContext } from \"../src/Provider\"\nimport { withConsole } from \"./utils/withConsole\"\n\ndescribe(\"Provider\", () => {\n    it(\"should work in a simple case\", () => {\n        function A() {\n            return (\n                <Provider foo=\"bar\">\n                    <MobXProviderContext.Consumer>{({ foo }) => foo}</MobXProviderContext.Consumer>\n                </Provider>\n            )\n        }\n\n        const { container } = render(<A />)\n        expect(container).toHaveTextContent(\"bar\")\n    })\n\n    it(\"should not provide the children prop\", () => {\n        function A() {\n            return (\n                <Provider>\n                    <MobXProviderContext.Consumer>\n                        {stores =>\n                            Reflect.has(stores, \"children\")\n                                ? \"children was provided\"\n                                : \"children was not provided\"\n                        }\n                    </MobXProviderContext.Consumer>\n                </Provider>\n            )\n        }\n\n        const { container } = render(<A />)\n        expect(container).toHaveTextContent(\"children was not provided\")\n    })\n\n    it(\"supports overriding stores\", () => {\n        function B() {\n            return (\n                <MobXProviderContext.Consumer>\n                    {({ overridable, nonOverridable }) => `${overridable} ${nonOverridable}`}\n                </MobXProviderContext.Consumer>\n            )\n        }\n\n        function A() {\n            return (\n                <Provider overridable=\"original\" nonOverridable=\"original\">\n                    <B />\n                    <Provider overridable=\"overridden\">\n                        <B />\n                    </Provider>\n                </Provider>\n            )\n        }\n        const { container } = render(<A />)\n        expect(container).toMatchInlineSnapshot(`\n<div>\n  original original\n  overridden original\n</div>\n`)\n    })\n\n    it(\"should throw an error when changing stores\", () => {\n        function A({ foo }) {\n            return (\n                <Provider foo={foo}>\n                    <MobXProviderContext.Consumer>{({ foo }) => foo}</MobXProviderContext.Consumer>\n                </Provider>\n            )\n        }\n\n        const { rerender } = render(<A foo={1} />)\n\n        withConsole(() => {\n            expect(() => {\n                rerender(<A foo={2} />)\n            }).toThrow(\"The set of provided stores has changed.\")\n        })\n    })\n})\n"
  },
  {
    "path": "packages/mobx-react/__tests__/__snapshots__/hooks.test.tsx.snap",
    "content": "// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing\n\nexports[`computed properties react to props when using hooks 1`] = `\n[MockFunction] {\n  \"calls\": [\n    [\n      \"[mobx-react-lite] 'useAsObservableSource' is deprecated, please store the values directly in an observable, for example by using 'useLocalObservable', and sync future updates using 'useEffect' when needed. See the README for examples.\",\n    ],\n    [\n      \"[mobx-react-lite] 'useLocalStore' is deprecated, use 'useLocalObservable' instead.\",\n    ],\n  ],\n  \"results\": [\n    {\n      \"type\": \"return\",\n      \"value\": undefined,\n    },\n    {\n      \"type\": \"return\",\n      \"value\": undefined,\n    },\n  ],\n}\n`;\n"
  },
  {
    "path": "packages/mobx-react/__tests__/__snapshots__/observer.test.tsx.snap",
    "content": "// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing\n\nexports[`#3492 should not cause warning by calling forceUpdate on uncommited components 1`] = `[MockFunction]`;\n\nexports[`Redeclaring an existing observer component as an observer should throw 1`] = `\"The provided component class (AlreadyObserver) has already been declared as an observer component.\"`;\n\nexports[`SSR works #3448 1`] = `[MockFunction]`;\n\nexports[`issue 12 1`] = `\n<div>\n  <div>\n    <span>\n      coffee\n      !\n    </span>\n    <span>\n      tea\n    </span>\n  </div>\n</div>\n`;\n\nexports[`issue 12 2`] = `\n<div>\n  <div>\n    <span>\n      soup\n    </span>\n  </div>\n</div>\n`;\n"
  },
  {
    "path": "packages/mobx-react/__tests__/__snapshots__/stateless.test.tsx.snap",
    "content": "// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing\n\nexports[`stateless component with forwardRef is reactive 1`] = `\n<div>\n  <div>\n    result: \n    hello world\n    , \n    got ref\n    , a.x: \n    2\n  </div>\n</div>\n`;\n\nexports[`stateless component with forwardRef render test correct 1`] = `\n<div>\n  <div>\n    result: \n    hello world\n    , \n    got ref\n    , a.x: \n    1\n  </div>\n</div>\n`;\n"
  },
  {
    "path": "packages/mobx-react/__tests__/context.test.tsx",
    "content": "import React from \"react\"\nimport { observable } from \"mobx\"\nimport { Provider, observer, inject } from \"../src\"\nimport { withConsole } from \"./utils/withConsole\"\nimport { render, act } from \"@testing-library/react\"\nimport { any } from \"prop-types\"\n\ntest(\"no warnings in modern react\", () => {\n    const box = observable.box(3)\n    const Child = inject(\"store\")(\n        observer(\n            class Child extends React.Component<any, any> {\n                render() {\n                    return (\n                        <div>\n                            {this.props.store} + {box.get()}\n                        </div>\n                    )\n                }\n            }\n        )\n    )\n\n    class App extends React.Component {\n        render() {\n            return (\n                <div>\n                    <React.StrictMode>\n                        <Provider store=\"42\">\n                            <Child />\n                        </Provider>\n                    </React.StrictMode>\n                </div>\n            )\n        }\n    }\n\n    const { container } = render(<App />)\n    expect(container).toHaveTextContent(\"42 + 3\")\n\n    withConsole([\"info\", \"warn\", \"error\"], () => {\n        act(() => {\n            box.set(4)\n        })\n        expect(container).toHaveTextContent(\"42 + 4\")\n\n        expect(console.info).not.toHaveBeenCalled()\n        expect(console.warn).not.toHaveBeenCalled()\n        expect(console.error).not.toHaveBeenCalled()\n    })\n})\n\ntest(\"getDerivedStateFromProps works #447\", () => {\n    class Main extends React.Component<any, any> {\n        static getDerivedStateFromProps(nextProps, prevState) {\n            return {\n                count: prevState.count + 1\n            }\n        }\n\n        state = {\n            count: 0\n        }\n\n        render() {\n            return (\n                <div>\n                    <h2>{`${this.state.count ? \"One \" : \"No \"}${this.props.thing}`}</h2>\n                </div>\n            )\n        }\n    }\n\n    const MainInjected = inject(({ store }: { store: { thing: number } }) => ({ thing: store.thing }))(Main)\n\n    const store = { thing: 3 }\n\n    const App = () => (\n        <Provider store={store}>\n            <MainInjected />\n        </Provider>\n    )\n\n    const { container } = render(<App />)\n    expect(container).toHaveTextContent(\"One 3\")\n})\n\ntest(\"no double runs for getDerivedStateFromProps\", () => {\n    let derived = 0\n    @observer\n    class Main extends React.Component<any, any> {\n        state = {\n            activePropertyElementMap: {}\n        }\n\n        constructor(props) {\n            // console.log(\"CONSTRUCTOR\")\n            super(props)\n        }\n\n        static getDerivedStateFromProps() {\n            derived++\n            // console.log(\"PREVSTATE\", nextProps)\n            return null\n        }\n\n        render() {\n            return <div>Test-content</div>\n        }\n    }\n    // This results in\n    //PREVSTATE\n    //CONSTRUCTOR\n    //PREVSTATE\n    let MainInjected = inject(() => ({\n        componentProp: \"def\"\n    }))(Main)\n    // Uncomment the following line to see default behaviour (without inject)\n    //CONSTRUCTOR\n    //PREVSTATE\n    //MainInjected = Main;\n\n    const store = {}\n\n    const App = () => (\n        <Provider store={store}>\n            <MainInjected injectedProp={\"abc\"} />\n        </Provider>\n    )\n\n    const { container } = render(<App />)\n    expect(container).toHaveTextContent(\"Test-content\")\n    expect(derived).toBe(1)\n})\n"
  },
  {
    "path": "packages/mobx-react/__tests__/disposeOnUnmount.test.tsx",
    "content": "import React from \"react\"\nimport { disposeOnUnmount, observer } from \"../src\"\nimport { render } from \"@testing-library/react\"\nimport { MockedComponentClass } from \"react-dom/test-utils\"\n\ninterface ClassC extends MockedComponentClass {\n    methodA?: any\n    methodB?: any\n    methodC?: any\n    methodD?: any\n}\n\nfunction testComponent(C: ClassC, afterMount?: Function, afterUnmount?: Function) {\n    const ref = React.createRef<ClassC>()\n    const { unmount } = render(<C ref={ref} />)\n\n    let cref = ref.current\n    expect(cref?.methodA).not.toHaveBeenCalled()\n    expect(cref?.methodB).not.toHaveBeenCalled()\n    if (afterMount) {\n        afterMount(cref)\n    }\n\n    unmount()\n\n    expect(cref?.methodA).toHaveBeenCalledTimes(1)\n    expect(cref?.methodB).toHaveBeenCalledTimes(1)\n    if (afterUnmount) {\n        afterUnmount(cref)\n    }\n}\n\ndescribe(\"without observer\", () => {\n    test(\"class without componentWillUnmount\", async () => {\n        class C extends React.Component {\n            @disposeOnUnmount\n            methodA = jest.fn()\n            @disposeOnUnmount\n            methodB = jest.fn()\n            @disposeOnUnmount\n            methodC = null\n            @disposeOnUnmount\n            methodD = undefined\n\n            render() {\n                return null\n            }\n        }\n\n        testComponent(C)\n    })\n\n    test(\"class with componentWillUnmount in the prototype\", () => {\n        let called = 0\n\n        class C extends React.Component {\n            @disposeOnUnmount\n            methodA = jest.fn()\n            @disposeOnUnmount\n            methodB = jest.fn()\n            @disposeOnUnmount\n            methodC = null\n            @disposeOnUnmount\n            methodD = undefined\n\n            render() {\n                return null\n            }\n\n            componentWillUnmount() {\n                called++\n            }\n        }\n\n        testComponent(\n            C,\n            () => {\n                expect(called).toBe(0)\n            },\n            () => {\n                expect(called).toBe(1)\n            }\n        )\n    })\n\n    test.skip(\"class with componentWillUnmount as an arrow function\", () => {\n        let called = 0\n\n        class C extends React.Component {\n            @disposeOnUnmount\n            methodA = jest.fn()\n            @disposeOnUnmount\n            methodB = jest.fn()\n            @disposeOnUnmount\n            methodC = null\n            @disposeOnUnmount\n            methodD = undefined\n\n            render() {\n                return null\n            }\n\n            componentWillUnmount = () => {\n                called++\n            }\n        }\n\n        testComponent(\n            C,\n            () => {\n                expect(called).toBe(0)\n            },\n            () => {\n                expect(called).toBe(1)\n            }\n        )\n    })\n\n    test(\"class without componentWillUnmount using non decorator version\", () => {\n        let methodC = jest.fn()\n        let methodD = jest.fn()\n        class C extends React.Component {\n            render() {\n                return null\n            }\n\n            methodA = disposeOnUnmount(this, jest.fn())\n            methodB = disposeOnUnmount(this, jest.fn())\n\n            constructor(props) {\n                super(props)\n                disposeOnUnmount(this, [methodC, methodD])\n            }\n        }\n\n        testComponent(\n            C,\n            () => {\n                expect(methodC).not.toHaveBeenCalled()\n                expect(methodD).not.toHaveBeenCalled()\n            },\n            () => {\n                expect(methodC).toHaveBeenCalledTimes(1)\n                expect(methodD).toHaveBeenCalledTimes(1)\n            }\n        )\n    })\n})\n\ndescribe(\"with observer\", () => {\n    test(\"class without componentWillUnmount\", () => {\n        @observer\n        class C extends React.Component {\n            @disposeOnUnmount\n            methodA = jest.fn()\n            @disposeOnUnmount\n            methodB = jest.fn()\n            @disposeOnUnmount\n            methodC = null\n            @disposeOnUnmount\n            methodD = undefined\n\n            render() {\n                return null\n            }\n        }\n\n        testComponent(C)\n    })\n\n    test(\"class with componentWillUnmount in the prototype\", () => {\n        let called = 0\n\n        @observer\n        class C extends React.Component {\n            @disposeOnUnmount\n            methodA = jest.fn()\n            @disposeOnUnmount\n            methodB = jest.fn()\n            @disposeOnUnmount\n            methodC = null\n            @disposeOnUnmount\n            methodD = undefined\n\n            render() {\n                return null\n            }\n\n            componentWillUnmount() {\n                called++\n            }\n        }\n\n        testComponent(\n            C,\n            () => {\n                expect(called).toBe(0)\n            },\n            () => {\n                expect(called).toBe(1)\n            }\n        )\n    })\n\n    test.skip(\"class with componentWillUnmount as an arrow function\", () => {\n        let called = 0\n\n        @observer\n        class C extends React.Component {\n            @disposeOnUnmount\n            methodA = jest.fn()\n            @disposeOnUnmount\n            methodB = jest.fn()\n            @disposeOnUnmount\n            methodC = null\n            @disposeOnUnmount\n            methodD = undefined\n\n            render() {\n                return null\n            }\n\n            componentWillUnmount = () => {\n                called++\n            }\n        }\n\n        testComponent(\n            C,\n            () => {\n                expect(called).toBe(0)\n            },\n            () => {\n                expect(called).toBe(1)\n            }\n        )\n    })\n\n    test(\"class without componentWillUnmount using non decorator version\", () => {\n        let methodC = jest.fn()\n        let methodD = jest.fn()\n\n        @observer\n        class C extends React.Component {\n            render() {\n                return null\n            }\n\n            methodA = disposeOnUnmount(this, jest.fn())\n            methodB = disposeOnUnmount(this, jest.fn())\n\n            constructor(props) {\n                super(props)\n                disposeOnUnmount(this, [methodC, methodD])\n            }\n        }\n\n        testComponent(\n            C,\n            () => {\n                expect(methodC).not.toHaveBeenCalled()\n                expect(methodD).not.toHaveBeenCalled()\n            },\n            () => {\n                expect(methodC).toHaveBeenCalledTimes(1)\n                expect(methodD).toHaveBeenCalledTimes(1)\n            }\n        )\n    })\n})\n\nit(\"componentDidMount should be different between components\", () => {\n    function doTest(withObserver) {\n        const events: Array<string> = []\n\n        class A extends React.Component {\n            didMount\n            willUnmount\n\n            componentDidMount() {\n                this.didMount = \"A\"\n                events.push(\"mountA\")\n            }\n\n            componentWillUnmount() {\n                this.willUnmount = \"A\"\n                events.push(\"unmountA\")\n            }\n\n            render() {\n                return null\n            }\n        }\n\n        class B extends React.Component {\n            didMount\n            willUnmount\n\n            componentDidMount() {\n                this.didMount = \"B\"\n                events.push(\"mountB\")\n            }\n\n            componentWillUnmount() {\n                this.willUnmount = \"B\"\n                events.push(\"unmountB\")\n            }\n\n            render() {\n                return null\n            }\n        }\n\n        if (withObserver) {\n            // @ts-ignore\n            // eslint-disable-next-line no-class-assign\n            A = observer(A)\n            // @ts-ignore\n            // eslint-disable-next-line no-class-assign\n            B = observer(B)\n        }\n\n        const aRef = React.createRef<A>()\n        const { rerender, unmount } = render(<A ref={aRef} />)\n        const caRef = aRef.current\n\n        expect(caRef?.didMount).toBe(\"A\")\n        expect(caRef?.willUnmount).toBeUndefined()\n        expect(events).toEqual([\"mountA\"])\n\n        const bRef = React.createRef<B>()\n        rerender(<B ref={bRef} />)\n        const cbRef = bRef.current\n\n        expect(caRef?.didMount).toBe(\"A\")\n        expect(caRef?.willUnmount).toBe(\"A\")\n\n        expect(cbRef?.didMount).toBe(\"B\")\n        expect(cbRef?.willUnmount).toBeUndefined()\n        expect(events).toEqual([\"mountA\", \"unmountA\", \"mountB\"])\n\n        unmount()\n\n        expect(caRef?.didMount).toBe(\"A\")\n        expect(caRef?.willUnmount).toBe(\"A\")\n\n        expect(cbRef?.didMount).toBe(\"B\")\n        expect(cbRef?.willUnmount).toBe(\"B\")\n        expect(events).toEqual([\"mountA\", \"unmountA\", \"mountB\", \"unmountB\"])\n    }\n\n    doTest(true)\n    doTest(false)\n})\n\ntest(\"base cWU should not be called if overridden\", () => {\n    let baseCalled = 0\n    let dCalled = 0\n    let oCalled = 0\n\n    class C extends React.Component {\n        componentWillUnmount() {\n            baseCalled++\n        }\n\n        constructor(props) {\n            super(props)\n            this.componentWillUnmount = () => {\n                oCalled++\n            }\n        }\n\n        render() {\n            return null\n        }\n\n        @disposeOnUnmount\n        fn() {\n            dCalled++\n        }\n    }\n    const { unmount } = render(<C />)\n    unmount()\n    expect(dCalled).toBe(1)\n    expect(oCalled).toBe(1)\n    expect(baseCalled).toBe(0)\n})\n\ntest(\"should error on inheritance\", () => {\n    class C extends React.Component {\n        render() {\n            return null\n        }\n    }\n\n    expect(() => {\n        // eslint-disable-next-line no-unused-vars\n        class B extends C {\n            @disposeOnUnmount\n            fn() {}\n        }\n    }).toThrow(\"disposeOnUnmount only supports direct subclasses\")\n})\n\ntest(\"should error on inheritance - 2\", () => {\n    class C extends React.Component {\n        render() {\n            return null\n        }\n    }\n\n    class B extends C {\n        fn\n        constructor(props) {\n            super(props)\n            expect(() => {\n                this.fn = disposeOnUnmount(this, function () {})\n            }).toThrow(\"disposeOnUnmount only supports direct subclasses\")\n        }\n    }\n\n    render(<B />)\n})\n\ndescribe(\"should work with arrays\", () => {\n    test(\"as a function\", () => {\n        class C extends React.Component {\n            methodA = jest.fn()\n            methodB = jest.fn()\n\n            componentDidMount() {\n                disposeOnUnmount(this, [this.methodA, this.methodB])\n            }\n\n            render() {\n                return null\n            }\n        }\n\n        testComponent(C)\n    })\n\n    test(\"as a decorator\", () => {\n        class C extends React.Component {\n            methodA = jest.fn()\n            methodB = jest.fn()\n\n            @disposeOnUnmount\n            disposers = [this.methodA, this.methodB]\n\n            render() {\n                return null\n            }\n        }\n\n        testComponent(C)\n    })\n})\n\nit(\"runDisposersOnUnmount only runs disposers from the declaring instance\", () => {\n    class A extends React.Component {\n        @disposeOnUnmount\n        a = jest.fn()\n\n        b = jest.fn()\n\n        constructor(props) {\n            super(props)\n            disposeOnUnmount(this, this.b)\n        }\n\n        render() {\n            return null\n        }\n    }\n\n    const ref1 = React.createRef<A>()\n    const ref2 = React.createRef<A>()\n    const { unmount } = render(<A ref={ref1} />)\n    render(<A ref={ref2} />)\n    const inst1 = ref1.current\n    const inst2 = ref2.current\n    unmount()\n\n    expect(inst1?.a).toHaveBeenCalledTimes(1)\n    expect(inst1?.b).toHaveBeenCalledTimes(1)\n    expect(inst2?.a).toHaveBeenCalledTimes(0)\n    expect(inst2?.b).toHaveBeenCalledTimes(0)\n})\n"
  },
  {
    "path": "packages/mobx-react/__tests__/finalizationRegistry.tsx",
    "content": "import { cleanup, render, waitFor } from \"@testing-library/react\"\nimport * as mobx from \"mobx\"\nimport * as React from \"react\"\n\n// @ts-ignore\nimport gc from \"expose-gc/function\"\nimport { observer } from \"../src\"\n\nafterEach(cleanup)\n\ntest(\"should not prevent GC of uncomitted components\", async () => {\n    expect(typeof globalThis.FinalizationRegistry).toBe(\"function\")\n\n    // This specific setup causes first instance of A not being commited.\n    // This is checked by comparing constructor and componentDidMount invocation counts.\n    // There is no profound reason why that's the case, if you know a simpler or more robust setup\n    // feel free to change this.\n\n    const o = mobx.observable({ x: 0 })\n    let aConstructorCount = 0\n    let aMountCount = 0\n\n    let firstARef: WeakRef<React.Component>\n\n    @observer\n    class A extends React.Component<any> {\n        constructor(props) {\n            super(props)\n            if (aConstructorCount === 0) {\n                firstARef = new WeakRef(this)\n            }\n            aConstructorCount++\n        }\n        componentDidMount(): void {\n            aMountCount++\n        }\n        render() {\n            return (\n                <React.Suspense fallback=\"fallback\">\n                    <LazyB />\n                    {o.x}\n                </React.Suspense>\n            )\n        }\n    }\n\n    class B extends React.Component {\n        render() {\n            return \"B\"\n        }\n    }\n\n    const LazyA = React.lazy(() => Promise.resolve({ default: A }))\n    const LazyB = React.lazy(() => Promise.resolve({ default: B }))\n\n    function App() {\n        return (\n            <React.Suspense fallback=\"fallback\">\n                <LazyA />\n            </React.Suspense>\n        )\n    }\n\n    const { unmount, container } = render(<App />)\n\n    expect(container).toHaveTextContent(\"fallback\")\n    await waitFor(() => expect(container).toHaveTextContent(\"B0\"))\n    expect(aConstructorCount).toBe(2)\n    expect(aMountCount).toBe(1)\n\n    await Promise.resolve()\n    gc()\n    await waitFor(() => expect(firstARef!.deref()).toBeUndefined(), {\n        timeout: 10_000,\n        interval: 150\n    })\n\n    unmount()\n})\n"
  },
  {
    "path": "packages/mobx-react/__tests__/hooks.test.tsx",
    "content": "import React from \"react\"\nimport { observer, Observer, useLocalStore, useAsObservableSource } from \"../src\"\nimport { render, act } from \"@testing-library/react\"\n\nafterEach(() => {\n    jest.useRealTimers()\n})\n\nlet consoleWarnMock: jest.SpyInstance | undefined\nafterEach(() => {\n    consoleWarnMock?.mockRestore()\n})\n\ntest(\"computed properties react to props when using hooks\", async () => {\n    jest.useFakeTimers()\n    consoleWarnMock = jest.spyOn(console, \"warn\").mockImplementation(() => {})\n\n    const seen: Array<string> = []\n\n    const Child = ({ x }) => {\n        const props = useAsObservableSource({ x })\n        const store = useLocalStore(() => ({\n            get getPropX() {\n                return props.x\n            }\n        }))\n\n        return (\n            <Observer>{() => (seen.push(store.getPropX), (<div>{store.getPropX}</div>))}</Observer>\n        )\n    }\n\n    const Parent = () => {\n        const [state, setState] = React.useState({ x: 0 })\n        seen.push(\"parent\")\n        React.useEffect(() => {\n            setTimeout(() => {\n                act(() => {\n                    setState({ x: 2 })\n                })\n            })\n        }, [])\n        return <Child x={state.x} />\n    }\n\n    const { container } = render(<Parent />)\n    expect(container).toHaveTextContent(\"0\")\n\n    act(() => {\n        jest.runAllTimers()\n    })\n    expect(seen).toEqual([\"parent\", 0, \"parent\", 2, 2])\n    expect(container).toHaveTextContent(\"2\")\n    expect(consoleWarnMock).toMatchSnapshot()\n})\n\ntest(\"computed properties result in double render when using observer instead of Observer\", async () => {\n    jest.useFakeTimers()\n\n    const seen: Array<string> = []\n\n    const Child = observer(({ x }) => {\n        const props = useAsObservableSource({ x })\n        const store = useLocalStore(() => ({\n            get getPropX() {\n                return props.x\n            }\n        }))\n\n        seen.push(store.getPropX)\n        return <div>{store.getPropX}</div>\n    })\n\n    const Parent = () => {\n        const [state, setState] = React.useState({ x: 0 })\n        seen.push(\"parent\")\n        React.useEffect(() => {\n            setTimeout(() => {\n                act(() => {\n                    setState({ x: 2 })\n                })\n            }, 100)\n        }, [])\n        return <Child x={state.x} />\n    }\n\n    const { container } = render(<Parent />)\n    expect(container).toHaveTextContent(\"0\")\n\n    act(() => {\n        jest.runAllTimers()\n    })\n    expect(seen).toEqual([\n        \"parent\",\n        0,\n        \"parent\",\n        2, // props changed\n        2 // observable source changed (setState during render)\n    ])\n    expect(container).toHaveTextContent(\"2\")\n})\n"
  },
  {
    "path": "packages/mobx-react/__tests__/inject.test.tsx",
    "content": "import React from \"react\"\nimport PropTypes from \"prop-types\"\nimport { action, observable, makeObservable } from \"mobx\"\nimport { observer, inject, Provider } from \"../src\"\nimport { IValueMap } from \"../src/types/IValueMap\"\nimport { render, act } from \"@testing-library/react\"\nimport { withConsole } from \"./utils/withConsole\"\nimport { IReactComponent } from \"../src/types/IReactComponent\"\n\ndescribe(\"inject based context\", () => {\n    test(\"basic context\", () => {\n        const C = inject(\"foo\")(\n            observer(\n                class X extends React.Component<any, any> {\n                    render() {\n                        return (\n                            <div>\n                                context:\n                                {this.props.foo}\n                            </div>\n                        )\n                    }\n                }\n            )\n        )\n        const B = () => <C />\n        const A = () => (\n            <Provider foo=\"bar\">\n                <B />\n            </Provider>\n        )\n        const { container } = render(<A />)\n        expect(container).toHaveTextContent(\"context:bar\")\n    })\n\n    test(\"props override context\", () => {\n        const C = inject(\"foo\")(\n            class T extends React.Component<any, any> {\n                render() {\n                    return (\n                        <div>\n                            context:\n                            {this.props.foo}\n                        </div>\n                    )\n                }\n            }\n        )\n        const B = () => <C foo={42} />\n        const A = class T extends React.Component<any, any> {\n            render() {\n                return (\n                    <Provider foo=\"bar\">\n                        <B />\n                    </Provider>\n                )\n            }\n        }\n        const { container } = render(<A />)\n        expect(container).toHaveTextContent(\"context:42\")\n    })\n\n    test(\"wraps displayName of original component\", () => {\n        const A: React.ComponentClass = inject(\"foo\")(\n            class ComponentA extends React.Component<any, any> {\n                render() {\n                    return (\n                        <div>\n                            context:\n                            {this.props.foo}\n                        </div>\n                    )\n                }\n            }\n        )\n        const B: React.ComponentClass = inject()(\n            class ComponentB extends React.Component<any, any> {\n                render() {\n                    return (\n                        <div>\n                            context:\n                            {this.props.foo}\n                        </div>\n                    )\n                }\n            }\n        )\n        const C: React.ComponentClass = inject(() => ({}))(\n            class ComponentC extends React.Component<any, any> {\n                render() {\n                    return (\n                        <div>\n                            context:\n                            {this.props.foo}\n                        </div>\n                    )\n                }\n            }\n        )\n        expect(A.displayName).toBe(\"inject-with-foo(ComponentA)\")\n        expect(B.displayName).toBe(\"inject(ComponentB)\")\n        expect(C.displayName).toBe(\"inject(ComponentC)\")\n    })\n\n    test(\"shouldn't change original displayName of component that uses forwardRef\", () => {\n        const FancyComp = React.forwardRef((_: any, ref: React.Ref<HTMLDivElement>) => {\n            return <div ref={ref} />\n        })\n        FancyComp.displayName = \"FancyComp\"\n\n        inject(\"bla\")(FancyComp)\n\n        expect(FancyComp.displayName).toBe(\"FancyComp\")\n    })\n\n    // FIXME: see other comments related to error catching in React\n    // test does work as expected when running manually\n    test(\"store should be available\", () => {\n        const C = inject(\"foo\")(\n            observer(\n                class C extends React.Component<any, any> {\n                    render() {\n                        return (\n                            <div>\n                                context:\n                                {this.props.foo}\n                            </div>\n                        )\n                    }\n                }\n            )\n        )\n        const B = () => <C />\n        const A = class A extends React.Component<any, any> {\n            render() {\n                return (\n                    <Provider baz={42}>\n                        <B />\n                    </Provider>\n                )\n            }\n        }\n\n        withConsole(() => {\n            expect(() => render(<A />)).toThrow(\n                /Store 'foo' is not available! Make sure it is provided by some Provider/\n            )\n        })\n    })\n\n    test(\"store is not required if prop is available\", () => {\n        const C = inject(\"foo\")(\n            observer(\n                class C extends React.Component<any, any> {\n                    render() {\n                        return (\n                            <div>\n                                context:\n                                {this.props.foo}\n                            </div>\n                        )\n                    }\n                }\n            )\n        )\n        const B = () => <C foo=\"bar\" />\n        const { container } = render(<B />)\n        expect(container).toHaveTextContent(\"context:bar\")\n    })\n\n    test(\"inject merges (and overrides) props\", () => {\n        const C = inject(() => ({ a: 1 }))(\n            observer(\n                class C extends React.Component<any, any> {\n                    render() {\n                        expect(this.props).toEqual({ a: 1, b: 2 })\n                        return null\n                    }\n                }\n            )\n        )\n        const B = () => <C a={2} b={2} />\n        render(<B />)\n    })\n\n    test(\"custom storesToProps\", () => {\n        const C = inject((stores: IValueMap, props: any) => {\n            expect(stores).toEqual({ foo: \"bar\" })\n            expect(props).toEqual({ baz: 42 })\n            return {\n                zoom: stores.foo,\n                baz: props.baz * 2\n            }\n        })(\n            observer(\n                class C extends React.Component<any, any> {\n                    render() {\n                        return (\n                            <div>\n                                context:\n                                {this.props.zoom}\n                                {this.props.baz}\n                            </div>\n                        )\n                    }\n                }\n            )\n        )\n        const B = class B extends React.Component<any, any> {\n            render() {\n                return <C baz={42} />\n            }\n        }\n        const A = () => (\n            <Provider foo=\"bar\">\n                <B />\n            </Provider>\n        )\n        const { container } = render(<A />)\n        expect(container).toHaveTextContent(\"context:bar84\")\n    })\n\n    test(\"inject forwards ref\", () => {\n        class FancyComp extends React.Component<any, any> {\n            didRender\n            render() {\n                this.didRender = true\n                return null\n            }\n\n            doSomething() {}\n        }\n\n        const ref = React.createRef<FancyComp>()\n        render(<FancyComp ref={ref} />)\n        expect(typeof ref.current?.doSomething).toBe(\"function\")\n        expect(ref.current?.didRender).toBe(true)\n\n        const InjectedFancyComp = inject(\"bla\")(FancyComp)\n        const ref2 = React.createRef<FancyComp>()\n\n        render(\n            <Provider bla={42}>\n                <InjectedFancyComp ref={ref2} />\n            </Provider>\n        )\n\n        expect(typeof ref2.current?.doSomething).toBe(\"function\")\n        expect(ref2.current?.didRender).toBe(true)\n    })\n\n    test(\"inject should work with components that use forwardRef\", () => {\n        const FancyComp = React.forwardRef((_: any, ref: React.Ref<HTMLDivElement>) => {\n            return <div ref={ref} />\n        })\n\n        const InjectedFancyComp = inject(\"bla\")(FancyComp)\n        const ref = React.createRef<HTMLDivElement>()\n\n        render(\n            <Provider bla={42}>\n                <InjectedFancyComp ref={ref} />\n            </Provider>\n        )\n\n        expect(ref.current).not.toBeNull()\n        expect(ref.current).toBeInstanceOf(HTMLDivElement)\n    })\n\n    test(\"support static hoisting, wrappedComponent and ref forwarding\", () => {\n        class B extends React.Component<any, any> {\n            static foo\n            static bar\n            testField\n\n            render() {\n                this.testField = 1\n                return null\n            }\n        }\n        ;(B as React.ComponentClass).propTypes = {\n            x: PropTypes.object\n        }\n        B.foo = 17\n        B.bar = {}\n        const C = inject(\"booh\")(B)\n        expect(C.wrappedComponent).toBe(B)\n        expect(B.foo).toBe(17)\n        expect(C.foo).toBe(17)\n        expect(C.bar === B.bar).toBeTruthy()\n        expect(Object.keys(C.wrappedComponent.propTypes!)).toEqual([\"x\"])\n\n        const ref = React.createRef<B>()\n\n        render(<C booh={42} ref={ref} />)\n        expect(ref.current?.testField).toBe(1)\n    })\n\n    // skipping because `propTypes` and `defaultProps` are dropped in React 19\n    test.skip(\"propTypes and defaultProps are forwarded\", () => {\n        const msg: Array<string> = []\n        const baseError = console.error\n        console.error = m => msg.push(m)\n\n        const C: React.ComponentClass<any> = inject(\"foo\")(\n            class C extends React.Component<any, any> {\n                render() {\n                    expect(this.props.y).toEqual(3)\n\n                    expect(this.props.x).toBeUndefined()\n                    return null\n                }\n            }\n        )\n        C.propTypes = {\n            x: PropTypes.func.isRequired,\n            z: PropTypes.string.isRequired\n        }\n        // @ts-ignore\n        C.wrappedComponent.propTypes = {\n            a: PropTypes.func.isRequired\n        }\n        C.defaultProps = {\n            y: 3\n        }\n        const B = () => <C z=\"test\" />\n        const A = () => (\n            <Provider foo=\"bar\">\n                <B />\n            </Provider>\n        )\n        render(<A />)\n        expect(msg.length).toBe(2)\n        // ! Somehow this got broken with upgraded deps and wasn't worth fixing it :)\n        // expect(msg[0].split(\"\\n\")[0]).toBe(\n        //     \"Warning: Failed prop type: The prop `x` is marked as required in `inject-with-foo(C)`, but its value is `undefined`.\"\n        // )\n        // expect(msg[1].split(\"\\n\")[0]).toBe(\n        //     \"Warning: Failed prop type: The prop `a` is marked as required in `C`, but its value is `undefined`.\"\n        // )\n        console.error = baseError\n    })\n\n    test(\"warning is not printed when attaching propTypes to injected component\", () => {\n        let msg = []\n        const baseWarn = console.warn\n        console.warn = m => (msg = m)\n\n        const C: React.ComponentClass = inject(\"foo\")(\n            class C extends React.Component<any, any> {\n                render() {\n                    return (\n                        <div>\n                            context:\n                            {this.props.foo}\n                        </div>\n                    )\n                }\n            }\n        )\n        C.propTypes = {}\n\n        expect(msg.length).toBe(0)\n        console.warn = baseWarn\n    })\n\n    test(\"warning is not printed when attaching propTypes to wrappedComponent\", () => {\n        let msg = []\n        const baseWarn = console.warn\n        console.warn = m => (msg = m)\n        const C = inject(\"foo\")(\n            class C extends React.Component<any, any> {\n                render() {\n                    return (\n                        <div>\n                            context:\n                            {this.props.foo}\n                        </div>\n                    )\n                }\n            }\n        )\n        C.wrappedComponent.propTypes = {}\n        expect(msg.length).toBe(0)\n        console.warn = baseWarn\n    })\n\n    test(\"using a custom injector is reactive\", () => {\n        const user = observable({ name: \"Noa\" })\n        const mapper = stores => ({ name: stores.user.name })\n        const DisplayName = props => <h1>{props.name}</h1>\n        const User = inject(mapper)(DisplayName)\n        const App = () => (\n            <Provider user={user}>\n                <User />\n            </Provider>\n        )\n        const { container } = render(<App />)\n        expect(container).toHaveTextContent(\"Noa\")\n\n        act(() => {\n            user.name = \"Veria\"\n        })\n        expect(container).toHaveTextContent(\"Veria\")\n    })\n\n    test(\"using a custom injector is not too reactive\", () => {\n        let listRender = 0\n        let itemRender = 0\n        let injectRender = 0\n\n        function connect() {\n            const args = arguments\n            return (component: IReactComponent) =>\n                // @ts-ignore\n                inject.apply(this, args)(observer(component))\n        }\n\n        class State {\n            @observable\n            highlighted = null\n            isHighlighted(item) {\n                return this.highlighted == item\n            }\n\n            @action\n            highlight = item => {\n                this.highlighted = item\n            }\n\n            constructor() {\n                makeObservable(this)\n            }\n        }\n\n        const items = observable([\n            { title: \"ItemA\" },\n            { title: \"ItemB\" },\n            { title: \"ItemC\" },\n            { title: \"ItemD\" },\n            { title: \"ItemE\" },\n            { title: \"ItemF\" }\n        ])\n\n        const state = new State()\n\n        class ListComponent extends React.PureComponent<any> {\n            render() {\n                listRender++\n                const { items } = this.props\n\n                return (\n                    <ul>\n                        {items.map(item => (\n                            <ItemComponent key={item.title} item={item} />\n                        ))}\n                    </ul>\n                )\n            }\n        }\n\n        // @ts-ignore\n        @connect(({ state }, { item }) => {\n            injectRender++\n            if (injectRender > 6) {\n                // debugger;\n            }\n            return {\n                // Using\n                // highlighted: expr(() => state.isHighlighted(item)) // seems to fix the problem\n                highlighted: state.isHighlighted(item),\n                highlight: state.highlight\n            }\n        })\n        class ItemComponent extends React.PureComponent<any> {\n            highlight = () => {\n                const { item, highlight } = this.props\n                highlight(item)\n            }\n\n            render() {\n                itemRender++\n                const { highlighted, item } = this.props\n                return (\n                    <li className={\"hl_\" + item.title} onClick={this.highlight}>\n                        {item.title} {highlighted ? \"(highlighted)\" : \"\"}{\" \"}\n                    </li>\n                )\n            }\n        }\n\n        const { container } = render(\n            <Provider state={state}>\n                <ListComponent items={items} />\n            </Provider>\n        )\n\n        expect(listRender).toBe(1)\n        expect(injectRender).toBe(6)\n        expect(itemRender).toBe(6)\n\n        act(() => {\n            container\n                .querySelectorAll(\".hl_ItemB\")\n                .forEach((e: Element) => (e as HTMLElement).click())\n        })\n\n        expect(listRender).toBe(1)\n        expect(injectRender).toBe(12) // ideally, 7\n        expect(itemRender).toBe(7)\n        act(() => {\n            container\n                .querySelectorAll(\".hl_ItemF\")\n                .forEach((e: Element) => (e as HTMLElement).click())\n        })\n\n        expect(listRender).toBe(1)\n        expect(injectRender).toBe(18) // ideally, 9\n        expect(itemRender).toBe(9)\n    })\n})\n\ntest(\"#612 - mixed context types\", () => {\n    const SomeContext = React.createContext(true)\n\n    class MainCompClass extends React.Component<any, any> {\n        static contextType = SomeContext\n        render() {\n            let active = this.context\n            return active ? this.props.value : \"Inactive\"\n        }\n    }\n\n    const MainComp = inject((stores: any) => ({\n        value: stores.appState.value\n    }))(MainCompClass)\n\n    const appState = observable({\n        value: \"Something\"\n    })\n\n    function App() {\n        return (\n            <Provider appState={appState}>\n                <SomeContext.Provider value={true}>\n                    <MainComp />\n                </SomeContext.Provider>\n            </Provider>\n        )\n    }\n\n    render(<App />)\n})\n"
  },
  {
    "path": "packages/mobx-react/__tests__/issue21.test.tsx",
    "content": "import React, { createElement } from \"react\"\nimport {\n    computed,\n    isObservable,\n    observable,\n    reaction,\n    transaction,\n    IReactionDisposer,\n    makeObservable\n} from \"mobx\"\nimport { observer } from \"../src\"\nimport _ from \"lodash\"\nimport { act, render } from \"@testing-library/react\"\n\nlet topRenderCount = 0\n\nconst wizardModel = observable(\n    {\n        steps: [\n            {\n                title: \"Size\",\n                active: true\n            },\n            {\n                title: \"Fabric\",\n                active: false\n            },\n            {\n                title: \"Finish\",\n                active: false\n            }\n        ],\n        get activeStep() {\n            return _.find(this.steps, \"active\")\n        },\n        activateNextStep: function () {\n            const nextStep = this.steps[_.findIndex(this.steps, \"active\") + 1]\n            if (!nextStep) {\n                return false\n            }\n            this.setActiveStep(nextStep)\n            return true\n        },\n        setActiveStep(modeToActivate) {\n            const self = this\n            transaction(() => {\n                _.find(self.steps, \"active\").active = false\n                modeToActivate.active = true\n            })\n        }\n    } as any,\n    {\n        activateNextStep: observable.ref\n    }\n)\n\n/** RENDERS **/\n\nconst Wizard = observer(\n    class Wizard extends React.Component<any, any> {\n        render() {\n            return createElement(\n                \"div\",\n                null,\n                <div>\n                    <h1>Active Step: </h1>\n                    <WizardStep step={this.props.model.activeStep} key=\"activeMode\" tester />\n                </div>,\n                <div>\n                    <h1>All Step: </h1>\n                    <p>\n                        Clicking on these steps will render the active step just once. This is what\n                        I expected.\n                    </p>\n                    <WizardStep step={this.props.model.steps} key=\"modeList\" />\n                </div>\n            )\n        }\n    }\n)\n\nconst WizardStep = observer(\n    class WizardStep extends React.Component<any, any> {\n        renderCount = 0\n        componentWillUnmount() {\n            // console.log(\"Unmounting!\")\n        }\n        render() {\n            // weird test hack:\n            if (this.props.tester === true) {\n                topRenderCount++\n            }\n            return createElement(\n                \"div\",\n                { onClick: this.modeClickHandler },\n                \"RenderCount: \" +\n                    this.renderCount++ +\n                    \" \" +\n                    this.props.step.title +\n                    \": isActive:\" +\n                    this.props.step.active\n            )\n        }\n        modeClickHandler = () => {\n            var step = this.props.step\n            wizardModel.setActiveStep(step)\n        }\n    }\n)\n\n/** END RENDERERS **/\n\nconst changeStep = stepNumber => act(() => wizardModel.setActiveStep(wizardModel.steps[stepNumber]))\n\ntest(\"verify issue 21\", () => {\n    render(<Wizard model={wizardModel} />)\n    expect(topRenderCount).toBe(1)\n    changeStep(0)\n    expect(topRenderCount).toBe(2)\n    changeStep(2)\n    expect(topRenderCount).toBe(3)\n})\n\ntest(\"verify prop changes are picked up\", () => {\n    function createItem(subid, label) {\n        const res = observable(\n            {\n                subid,\n                id: 1,\n                label: label,\n                get text() {\n                    events.push([\"compute\", this.subid])\n                    return (\n                        this.id +\n                        \".\" +\n                        this.subid +\n                        \".\" +\n                        this.label +\n                        \".\" +\n                        data.items.indexOf(this as any)\n                    )\n                }\n            },\n            {},\n            { proxy: false }\n        )\n        res.subid = subid // non reactive\n        return res\n    }\n    const data = observable({\n        items: [createItem(1, \"hi\")]\n    })\n    const events: Array<any> = []\n    const Child = observer(\n        class Child extends React.Component<any, any> {\n            componentDidUpdate(prevProps) {\n                events.push([\"update\", prevProps.item.subid, this.props.item.subid])\n            }\n            render() {\n                events.push([\"render\", this.props.item.subid, this.props.item.text])\n                return <span>{this.props.item.text}</span>\n            }\n        }\n    )\n\n    const Parent = observer(\n        class Parent extends React.Component<any, any> {\n            render() {\n                return (\n                    <div onClick={changeStuff.bind(this)} id=\"testDiv\">\n                        {data.items.map(item => (\n                            <Child key=\"fixed\" item={item} />\n                        ))}\n                    </div>\n                )\n            }\n        }\n    )\n\n    const Wrapper = () => <Parent />\n\n    function changeStuff() {\n        act(() => {\n            transaction(() => {\n                data.items[0].label = \"hello\" // schedules state change for Child\n                data.items[0] = createItem(2, \"test\") // Child should still receive new prop!\n            })\n\n            // @ts-ignore\n            this.setState({}) // trigger update\n        })\n    }\n\n    const { container } = render(<Wrapper />)\n    expect(events.sort()).toEqual(\n        [\n            [\"compute\", 1],\n            [\"render\", 1, \"1.1.hi.0\"]\n        ].sort()\n    )\n    events.splice(0)\n    let testDiv = container.querySelector(\"#testDiv\")! as HTMLElement\n    testDiv.click()\n    expect(events.sort()).toEqual(\n        [\n            [\"compute\", 1],\n            [\"update\", 1, 2],\n            [\"compute\", 2],\n            [\"render\", 2, \"1.2.test.0\"]\n        ].sort()\n    )\n    expect(container.textContent).toMatchInlineSnapshot(`\"1.2.test.0\"`)\n})\n\ntest(\"no re-render for shallow equal props\", async () => {\n    function createItem(subid, label) {\n        const res = observable({\n            subid,\n            id: 1,\n            label: label\n        })\n        res.subid = subid // non reactive\n        return res\n    }\n\n    const data = observable({\n        items: [createItem(1, \"hi\")],\n        parentValue: 0\n    })\n    const events: Array<Array<any>> = []\n\n    const Child = observer(\n        class Child extends React.Component<any, any> {\n            componentDidMount() {\n                events.push([\"mount\"])\n            }\n            componentDidUpdate(prevProps) {\n                events.push([\"update\", prevProps.item.subid, this.props.item.subid])\n            }\n            render() {\n                events.push([\"render\", this.props.item.subid, this.props.item.label])\n                return <span>{this.props.item.label}</span>\n            }\n        }\n    )\n\n    const Parent = observer(\n        class Parent extends React.Component<any, any> {\n            render() {\n                // \"object has become observable!\"\n                expect(isObservable(this.props.nonObservable)).toBeFalsy()\n                events.push([\"parent render\", data.parentValue])\n                return (\n                    <div onClick={changeStuff.bind(this)} id=\"testDiv\">\n                        {data.items.map(item => (\n                            <Child key=\"fixed\" item={item} value={5} />\n                        ))}\n                    </div>\n                )\n            }\n        }\n    )\n\n    const Wrapper = () => <Parent nonObservable={{}} />\n\n    function changeStuff() {\n        act(() => {\n            data.items[0].label = \"hi\" // no change.\n            data.parentValue = 1 // rerender parent\n        })\n    }\n\n    const { container } = render(<Wrapper />)\n    expect(events.sort()).toEqual([[\"parent render\", 0], [\"mount\"], [\"render\", 1, \"hi\"]].sort())\n    events.splice(0)\n    let testDiv = container.querySelector(\"#testDiv\") as HTMLElement\n    testDiv.click()\n    expect(events.sort()).toEqual([[\"parent render\", 1]].sort())\n})\n\ntest(\"lifecycle callbacks called with correct arguments\", () => {\n    var Comp = observer(\n        class Comp extends React.Component<any, any> {\n            componentDidUpdate(prevProps) {\n                expect(prevProps.counter).toBe(0)\n                expect(this.props.counter).toBe(1)\n            }\n            render() {\n                return (\n                    <div>\n                        <span key=\"1\">{[this.props.counter]}</span>\n                        <button key=\"2\" id=\"testButton\" onClick={this.props.onClick} />\n                    </div>\n                )\n            }\n        }\n    )\n    const Root = class T extends React.Component<any, any> {\n        state = { counter: 0 }\n        onButtonClick = () => {\n            act(() => this.setState({ counter: (this.state.counter || 0) + 1 }))\n        }\n        render() {\n            return <Comp counter={this.state.counter || 0} onClick={this.onButtonClick} />\n        }\n    }\n    const { container } = render(<Root />)\n    let testButton = container.querySelector(\"#testButton\") as HTMLElement\n    testButton.click()\n})\n"
  },
  {
    "path": "packages/mobx-react/__tests__/issue806.test.tsx",
    "content": "import React from \"react\"\nimport { configure, observable } from \"mobx\"\nimport { observer } from \"../src\"\nimport { render } from \"@testing-library/react\"\nimport { withConsole } from \"./utils/withConsole\"\n\n@observer\nclass Issue806Component extends React.Component<any> {\n    render() {\n        return (\n            <span>\n                {this.props.a}\n                <Issue806Component2 propA={this.props.a} propB={this.props.b} />\n            </span>\n        )\n    }\n}\n\n@observer\nclass Issue806Component2 extends React.Component<any> {\n    render() {\n        return (\n            <span>\n                {this.props.propA} - {this.props.propB}\n            </span>\n        )\n    }\n}\n\ntest(\"verify issue 806\", () => {\n    configure({\n        observableRequiresReaction: true\n    })\n\n    const x = observable({\n        a: 1\n    })\n\n    withConsole([\"warn\"], () => {\n        render(<Issue806Component a={\"a prop value\"} b={\"b prop value\"} x={x} />)\n        expect(console.warn).not.toHaveBeenCalled()\n    })\n\n    // make sure observableRequiresReaction is still working outside component\n    withConsole([\"warn\"], () => {\n        x.a.toString()\n        expect(console.warn).toHaveBeenCalledTimes(1)\n        expect(console.warn).toHaveBeenCalledWith(\n            \"[mobx] Observable 'ObservableObject@1.a' being read outside a reactive context.\"\n        )\n    })\n})\n"
  },
  {
    "path": "packages/mobx-react/__tests__/misc.test.tsx",
    "content": "import React from \"react\"\nimport { extendObservable, observable } from \"mobx\"\nimport { observer } from \"../src\"\nimport { act, render } from \"@testing-library/react\"\n\ntest(\"issue mobx 405\", () => {\n    function ExampleState() {\n        // @ts-ignore\n        extendObservable(this, {\n            name: \"test\",\n            get greetings() {\n                return \"Hello my name is \" + this.name\n            }\n        })\n    }\n\n    const ExampleView = observer(\n        class T extends React.Component<any, any> {\n            render() {\n                return (\n                    <div>\n                        <input\n                            type=\"text\"\n                            onChange={e => (this.props.exampleState.name = e.target.value)}\n                            value={this.props.exampleState.name}\n                        />\n                        <span>{this.props.exampleState.greetings}</span>\n                    </div>\n                )\n            }\n        }\n    )\n\n    const exampleState = new ExampleState()\n    const { container } = render(<ExampleView exampleState={exampleState} />)\n    expect(container).toMatchInlineSnapshot(`\n<div>\n  <div>\n    <input\n      type=\"text\"\n      value=\"test\"\n    />\n    <span>\n      Hello my name is test\n    </span>\n  </div>\n</div>\n`)\n})\n\ntest(\"#85 Should handle state changing in constructors\", () => {\n    const a = observable.box(2)\n    const Child = observer(\n        class Child extends React.Component {\n            constructor(p) {\n                super(p)\n                a.set(3) // one shouldn't do this!\n                this.state = {}\n            }\n            render() {\n                return (\n                    <div>\n                        child:\n                        {a.get()} -{\" \"}\n                    </div>\n                )\n            }\n        }\n    )\n    const ParentWrapper = observer(function Parent() {\n        return (\n            <span>\n                <Child />\n                parent:\n                {a.get()}\n            </span>\n        )\n    })\n    const { container } = render(<ParentWrapper />)\n    expect(container).toHaveTextContent(\"child:3 - parent:3\")\n\n    act(() => a.set(5))\n    expect(container).toHaveTextContent(\"child:5 - parent:5\")\n\n    act(() => a.set(7))\n    expect(container).toHaveTextContent(\"child:7 - parent:7\")\n})\n"
  },
  {
    "path": "packages/mobx-react/__tests__/observer.test.tsx",
    "content": "import React, { StrictMode, Suspense } from \"react\"\nimport { inject, observer, Observer, enableStaticRendering } from \"../src\"\nimport { render, act, waitFor } from \"@testing-library/react\"\nimport {\n    getObserverTree,\n    _getGlobalState,\n    _resetGlobalState,\n    action,\n    computed,\n    observable,\n    transaction,\n    makeObservable,\n    autorun,\n    IReactionDisposer,\n    reaction,\n    configure\n} from \"mobx\"\nimport { withConsole } from \"./utils/withConsole\"\nimport { shallowEqual } from \"../src/utils/utils\"\n/**\n *  \b\bsome test suite is too tedious\n */\n\nafterEach(() => {\n    jest.useRealTimers()\n})\n\nlet consoleWarnMock: jest.SpyInstance | undefined\nafterEach(() => {\n    consoleWarnMock?.mockRestore()\n})\n\n/*\n use TestUtils.renderIntoDocument will re-mounted the component with different props\n some misunderstanding will be cause？\n*/\ndescribe(\"nestedRendering\", () => {\n    let store\n\n    let todoItemRenderings\n    const TodoItem = observer(function TodoItem(props) {\n        todoItemRenderings++\n        return <li>|{props.todo.title}</li>\n    })\n\n    let todoListRenderings\n    const TodoList = observer(\n        class TodoList extends React.Component {\n            render() {\n                todoListRenderings++\n                const todos = store.todos\n                return (\n                    <div>\n                        <span>{todos.length}</span>\n                        {todos.map((todo, idx) => (\n                            <TodoItem key={idx} todo={todo} />\n                        ))}\n                    </div>\n                )\n            }\n        }\n    )\n\n    beforeEach(() => {\n        todoItemRenderings = 0\n        todoListRenderings = 0\n        store = observable({\n            todos: [\n                {\n                    title: \"a\",\n                    completed: false\n                }\n            ]\n        })\n    })\n\n    test(\"first rendering\", () => {\n        const { container } = render(<TodoList />)\n\n        expect(todoListRenderings).toBe(1)\n        expect(container.querySelectorAll(\"li\").length).toBe(1)\n        expect(container.querySelector(\"li\")).toHaveTextContent(\"|a\")\n        expect(todoItemRenderings).toBe(1)\n    })\n\n    test(\"second rendering with inner store changed\", () => {\n        render(<TodoList />)\n\n        act(() => {\n            store.todos[0].title += \"a\"\n        })\n\n        expect(todoListRenderings).toBe(1)\n        expect(todoItemRenderings).toBe(2)\n        expect(getObserverTree(store, \"todos\").observers!.length).toBe(1)\n        expect(getObserverTree(store.todos[0], \"title\").observers!.length).toBe(1)\n    })\n\n    test(\"rerendering with outer store added\", () => {\n        const { container } = render(<TodoList />)\n\n        act(() => {\n            store.todos.push({\n                title: \"b\",\n                completed: true\n            })\n        })\n\n        expect(container.querySelectorAll(\"li\").length).toBe(2)\n        expect(\n            Array.from(container.querySelectorAll(\"li\"))\n                .map((e: any) => e.innerHTML)\n                .sort()\n        ).toEqual([\"|a\", \"|b\"].sort())\n        expect(todoListRenderings).toBe(2)\n        expect(todoItemRenderings).toBe(2)\n        expect(getObserverTree(store.todos[1], \"title\").observers!.length).toBe(1)\n        expect(getObserverTree(store.todos[1], \"completed\").observers).toBe(undefined)\n    })\n\n    test(\"rerendering with outer store pop\", () => {\n        const { container } = render(<TodoList />)\n\n        let oldTodo\n        act(() => (oldTodo = store.todos.pop()))\n\n        expect(todoListRenderings).toBe(2)\n        expect(todoItemRenderings).toBe(1)\n        expect(container.querySelectorAll(\"li\").length).toBe(0)\n        expect(getObserverTree(oldTodo, \"title\").observers).toBe(undefined)\n        expect(getObserverTree(oldTodo, \"completed\").observers).toBe(undefined)\n    })\n})\n\ndescribe(\"isObjectShallowModified detects when React will update the component\", () => {\n    const store = observable({ count: 0 })\n    let counterRenderings = 0\n    const Counter: React.FunctionComponent<any> = observer(function TodoItem() {\n        counterRenderings++\n        return <div>{store.count}</div>\n    })\n\n    test(\"does not assume React will update due to NaN prop\", () => {\n        render(<Counter value={NaN} />)\n\n        act(() => {\n            store.count++\n        })\n\n        expect(counterRenderings).toBe(2)\n    })\n})\n\ndescribe(\"keep views alive\", () => {\n    let yCalcCount\n    let data\n    const TestComponent = observer(function testComponent() {\n        return (\n            <div>\n                {data.z}\n                {data.y}\n            </div>\n        )\n    })\n\n    beforeEach(() => {\n        yCalcCount = 0\n        data = observable({\n            x: 3,\n            get y() {\n                yCalcCount++\n                return this.x * 2\n            },\n            z: \"hi\"\n        })\n    })\n\n    test(\"init state\", () => {\n        const { container } = render(<TestComponent />)\n\n        expect(yCalcCount).toBe(1)\n        expect(container).toHaveTextContent(\"hi6\")\n    })\n\n    test(\"rerender should not need a recomputation of data.y\", () => {\n        const { container } = render(<TestComponent />)\n\n        act(() => {\n            data.z = \"hello\"\n        })\n\n        expect(yCalcCount).toBe(1)\n        expect(container).toHaveTextContent(\"hello6\")\n    })\n})\n\ndescribe(\"does not views alive when using static rendering\", () => {\n    let renderCount\n    let data\n\n    const TestComponent = observer(function testComponent() {\n        renderCount++\n        return <div>{data.z}</div>\n    })\n\n    beforeAll(() => {\n        enableStaticRendering(true)\n    })\n\n    beforeEach(() => {\n        renderCount = 0\n        data = observable({\n            z: \"hi\"\n        })\n    })\n\n    afterAll(() => {\n        enableStaticRendering(false)\n    })\n\n    test(\"init state is correct\", () => {\n        const { container } = render(<TestComponent />)\n\n        expect(renderCount).toBe(1)\n        expect(container).toHaveTextContent(\"hi\")\n    })\n\n    test(\"no re-rendering on static rendering\", () => {\n        const { container } = render(<TestComponent />)\n\n        act(() => {\n            data.z = \"hello\"\n        })\n\n        expect(getObserverTree(data, \"z\").observers).toBe(undefined)\n        expect(renderCount).toBe(1)\n        expect(container).toHaveTextContent(\"hi\")\n    })\n})\n\ntest(\"issue 12\", () => {\n    const events: Array<any> = []\n    const data = observable({\n        selected: \"coffee\",\n        items: [\n            {\n                name: \"coffee\"\n            },\n            {\n                name: \"tea\"\n            }\n        ]\n    })\n\n    /** Row Class */\n    class Row extends React.Component<any, any> {\n        constructor(props) {\n            super(props)\n        }\n\n        render() {\n            events.push(\"row: \" + this.props.item.name)\n            return (\n                <span>\n                    {this.props.item.name}\n                    {data.selected === this.props.item.name ? \"!\" : \"\"}\n                </span>\n            )\n        }\n    }\n    /** table stateles component */\n    const Table = observer(function table() {\n        events.push(\"table\")\n        JSON.stringify(data)\n        return (\n            <div>\n                {data.items.map(item => (\n                    <Row key={item.name} item={item} />\n                ))}\n            </div>\n        )\n    })\n\n    const { container } = render(<Table />)\n    expect(container).toMatchSnapshot()\n\n    act(() => {\n        transaction(() => {\n            data.items[1].name = \"boe\"\n            data.items.splice(0, 2, { name: \"soup\" })\n            data.selected = \"tea\"\n        })\n    })\n    expect(container).toMatchSnapshot()\n    expect(events).toEqual([\"table\", \"row: coffee\", \"row: tea\", \"table\", \"row: soup\"])\n})\n\ntest(\"changing state in render should fail\", () => {\n    const data = observable.box(2)\n    const Comp = observer(() => {\n        if (data.get() === 3) {\n            try {\n                data.set(4) // wouldn't throw first time for lack of observers.. (could we tighten this?)\n            } catch (err) {\n                expect(err).toBeInstanceOf(Error)\n                expect(err).toMatch(\n                    /Side effects like changing state are not allowed at this point/\n                )\n            }\n        }\n        return <div>{data.get()}</div>\n    })\n    render(<Comp />)\n\n    act(() => data.set(3))\n    _resetGlobalState()\n})\n\ntest(\"observer component can be injected\", () => {\n    const msg: Array<any> = []\n    const baseWarn = console.warn\n    console.warn = m => msg.push(m)\n\n    inject(\"foo\")(\n        observer(\n            class T extends React.Component {\n                render() {\n                    return null\n                }\n            }\n        )\n    )\n\n    // N.B, the injected component will be observer since mobx-react 4.0!\n    inject(() => ({}))(\n        observer(\n            class T extends React.Component {\n                render() {\n                    return null\n                }\n            }\n        )\n    )\n\n    expect(msg.length).toBe(0)\n    console.warn = baseWarn\n})\n\ntest(\"correctly wraps display name of child component\", () => {\n    const A = observer(\n        class ObserverClass extends React.Component {\n            render() {\n                return null\n            }\n        }\n    )\n    const B: React.FunctionComponent<any> = observer(function StatelessObserver() {\n        return null\n    })\n\n    expect(A.name).toEqual(\"ObserverClass\")\n    expect((B as any).type.name).toEqual(\"StatelessObserver\")\n    expect((B as any).type.displayName).toEqual(undefined)\n})\n\ndescribe(\"124 - react to changes in this.props via computed\", () => {\n    class T extends React.Component<any, any> {\n        @computed\n        get computedProp() {\n            return this.props.x\n        }\n        render() {\n            return (\n                <span>\n                    x:\n                    {this.computedProp}\n                </span>\n            )\n        }\n    }\n\n    const Comp = observer(T)\n\n    class Parent extends React.Component {\n        state = { v: 1 }\n        render() {\n            return (\n                <div onClick={() => this.setState({ v: 2 })}>\n                    <Comp x={this.state.v} />\n                </div>\n            )\n        }\n    }\n\n    test(\"init state is correct\", () => {\n        const { container } = render(<Parent />)\n\n        expect(container).toHaveTextContent(\"x:1\")\n    })\n\n    test(\"change after click\", () => {\n        const { container } = render(<Parent />)\n\n        act(() => container.querySelector(\"div\")!.click())\n        expect(container).toHaveTextContent(\"x:2\")\n    })\n})\n\n// Test on skip: since all reactions are now run in batched updates, the original issues can no longer be reproduced\n//this test case should be deprecated?\ntest(\"should stop updating if error was thrown in render (#134)\", () => {\n    const data = observable.box(0)\n    let renderingsCount = 0\n    let lastOwnRenderCount = 0\n    const errors: Array<any> = []\n\n    class Outer extends React.Component<any> {\n        state = { hasError: false }\n\n        render() {\n            return this.state.hasError ? <div>Error!</div> : <div>{this.props.children}</div>\n        }\n\n        static getDerivedStateFromError() {\n            return { hasError: true }\n        }\n\n        componentDidCatch(error, info) {\n            errors.push(error.toString().split(\"\\n\")[0], info)\n        }\n    }\n\n    const Comp = observer(\n        class X extends React.Component {\n            ownRenderCount = 0\n\n            render() {\n                lastOwnRenderCount = ++this.ownRenderCount\n                renderingsCount++\n                if (data.get() === 2) {\n                    throw new Error(\"Hello\")\n                }\n                return <div />\n            }\n        }\n    )\n    render(\n        <Outer>\n            <Comp />\n        </Outer>\n    )\n\n    // Check this\n    // @ts-ignore\n    expect(getObserverTree(data).observers!.length).toBe(1)\n    act(() => data.set(1))\n    expect(renderingsCount).toBe(2)\n    expect(lastOwnRenderCount).toBe(2)\n    withConsole(() => {\n        act(() => data.set(2))\n    })\n\n    // @ts-ignore\n    expect(getObserverTree(data).observers).toBe(undefined)\n    act(() => {\n        data.set(3)\n        data.set(4)\n        data.set(2)\n        data.set(5)\n    })\n    // MWE: not sure if these numbers make sense. Nor whether it really matters\n    expect(lastOwnRenderCount).toBe(4)\n    expect(renderingsCount).toBe(4)\n})\n\ndescribe(\"should render component even if setState called with exactly the same props\", () => {\n    let renderCount\n    const Comp = observer(\n        class T extends React.Component {\n            onClick = () => {\n                this.setState({})\n            }\n            render() {\n                renderCount++\n                return <div onClick={this.onClick} id=\"clickableDiv\" />\n            }\n        }\n    )\n\n    beforeEach(() => {\n        renderCount = 0\n    })\n\n    test(\"renderCount === 1\", () => {\n        render(<Comp />)\n\n        expect(renderCount).toBe(1)\n    })\n\n    test(\"after click once renderCount === 2\", () => {\n        const { container } = render(<Comp />)\n        const clickableDiv = container.querySelector(\"#clickableDiv\") as HTMLElement\n\n        act(() => clickableDiv.click())\n\n        expect(renderCount).toBe(2)\n    })\n\n    test(\"after click twice renderCount === 3\", () => {\n        const { container } = render(<Comp />)\n        const clickableDiv = container.querySelector(\"#clickableDiv\") as HTMLElement\n\n        act(() => clickableDiv.click())\n        act(() => clickableDiv.click())\n\n        expect(renderCount).toBe(3)\n    })\n})\n\ntest(\"it rerenders correctly if some props are non-observables - 1\", () => {\n    let odata = observable({ x: 1 })\n    let data = { y: 1 }\n\n    @observer\n    class Comp extends React.Component<any, any> {\n        @computed\n        get computed() {\n            // n.b: data.y would not rerender! shallowly new equal props are not stored\n            return this.props.odata.x\n        }\n        render() {\n            return (\n                <span onClick={stuff}>\n                    {this.props.odata.x}-{this.props.data.y}-{this.computed}\n                </span>\n            )\n        }\n    }\n\n    const Parent = observer(\n        class Parent extends React.Component<any, any> {\n            render() {\n                // this.props.odata.x;\n                return <Comp data={this.props.data} odata={this.props.odata} />\n            }\n        }\n    )\n\n    function stuff() {\n        act(() => {\n            data.y++\n            odata.x++\n        })\n    }\n\n    const { container } = render(<Parent odata={odata} data={data} />)\n\n    expect(container).toHaveTextContent(\"1-1-1\")\n    stuff()\n    expect(container).toHaveTextContent(\"2-2-2\")\n    stuff()\n    expect(container).toHaveTextContent(\"3-3-3\")\n})\n\ntest(\"it rerenders correctly if some props are non-observables - 2\", () => {\n    let renderCount = 0\n    let odata = observable({ x: 1 })\n\n    @observer\n    class Component extends React.PureComponent<any, any> {\n        @computed\n        get computed() {\n            return this.props.data.y // should recompute, since props.data is changed\n        }\n\n        render() {\n            renderCount++\n            return (\n                <span onClick={stuff}>\n                    {this.props.data.y}-{this.computed}\n                </span>\n            )\n        }\n    }\n\n    const Parent = observer(props => {\n        let data = { y: props.odata.x }\n        return <Component data={data} odata={props.odata} />\n    })\n\n    function stuff() {\n        odata.x++\n    }\n\n    const { container } = render(<Parent odata={odata} />)\n\n    expect(renderCount).toBe(1)\n    expect(container).toHaveTextContent(\"1-1\")\n\n    act(() => stuff())\n    expect(renderCount).toBe(2)\n    expect(container).toHaveTextContent(\"2-2\")\n\n    act(() => stuff())\n    expect(renderCount).toBe(3)\n    expect(container).toHaveTextContent(\"3-3\")\n})\n\ndescribe(\"Observer regions should react\", () => {\n    let data\n    const Comp = () => (\n        <div>\n            <Observer>{() => <span data-testid=\"inside-of-observer\">{data.get()}</span>}</Observer>\n            <span data-testid=\"outside-of-observer\">{data.get()}</span>\n        </div>\n    )\n\n    beforeEach(() => {\n        data = observable.box(\"hi\")\n    })\n\n    test(\"init state is correct\", () => {\n        const { queryByTestId } = render(<Comp />)\n\n        expect(queryByTestId(\"inside-of-observer\")).toHaveTextContent(\"hi\")\n        expect(queryByTestId(\"outside-of-observer\")).toHaveTextContent(\"hi\")\n    })\n\n    test(\"set the data to hello\", () => {\n        const { queryByTestId } = render(<Comp />)\n\n        act(() => data.set(\"hello\"))\n\n        expect(queryByTestId(\"inside-of-observer\")).toHaveTextContent(\"hello\")\n        expect(queryByTestId(\"outside-of-observer\")).toHaveTextContent(\"hi\")\n    })\n})\n\ntest(\"Observer should not re-render on shallow equal new props\", () => {\n    let childRendering = 0\n    let parentRendering = 0\n    const data = { x: 1 }\n    const odata = observable({ y: 1 })\n\n    const Child = observer(({ data }) => {\n        childRendering++\n        return <span>{data.x}</span>\n    })\n    const Parent = observer(() => {\n        parentRendering++\n        odata.y /// depend\n        return <Child data={data} />\n    })\n\n    const { container } = render(<Parent />)\n\n    expect(parentRendering).toBe(1)\n    expect(childRendering).toBe(1)\n    expect(container).toHaveTextContent(\"1\")\n\n    act(() => {\n        odata.y++\n    })\n    expect(parentRendering).toBe(2)\n    expect(childRendering).toBe(1)\n    expect(container).toHaveTextContent(\"1\")\n})\n\ntest(\"parent / childs render in the right order\", () => {\n    // See: https://jsfiddle.net/gkaemmer/q1kv7hbL/13/\n    let events: Array<any> = []\n\n    class User {\n        @observable\n        name = \"User's name\"\n    }\n\n    class Store {\n        @observable\n        user: User | null = new User()\n        @action\n        logout() {\n            this.user = null\n        }\n        constructor() {\n            makeObservable(this)\n        }\n    }\n\n    function tryLogout() {\n        try {\n            // ReactDOM.unstable_batchedUpdates(() => {\n            store.logout()\n            expect(true).toBeTruthy()\n            // });\n        } catch (e) {\n            // t.fail(e)\n        }\n    }\n\n    const store = new Store()\n\n    const Parent = observer(() => {\n        events.push(\"parent\")\n        if (!store.user) return <span>Not logged in.</span>\n        return (\n            <div>\n                <Child />\n                <button onClick={tryLogout}>Logout</button>\n            </div>\n        )\n    })\n\n    const Child = observer(() => {\n        events.push(\"child\")\n        return <span>Logged in as: {store.user?.name}</span>\n    })\n\n    render(<Parent />)\n\n    act(() => tryLogout())\n    expect(events).toEqual([\"parent\", \"child\", \"parent\"])\n})\n\ndescribe(\"use Observer inject and render sugar should work  \", () => {\n    test(\"use render without inject should be correct\", () => {\n        const Comp = () => (\n            <div>\n                <Observer render={() => <span>{123}</span>} />\n            </div>\n        )\n        const { container } = render(<Comp />)\n        expect(container).toHaveTextContent(\"123\")\n    })\n\n    test(\"use children without inject should be correct\", () => {\n        const Comp = () => (\n            <div>\n                <Observer>{() => <span>{123}</span>}</Observer>\n            </div>\n        )\n        const { container } = render(<Comp />)\n        expect(container).toHaveTextContent(\"123\")\n    })\n\n    test(\"show error when using children and render at same time \", () => {\n        const msg: Array<any> = []\n        const baseError = console.error\n        console.error = m => msg.push(m)\n\n        const Comp = () => (\n            <div>\n                <Observer render={() => <span>{123}</span>}>{() => <span>{123}</span>}</Observer>\n            </div>\n        )\n\n        render(<Comp />)\n        expect(msg.length).toBe(1)\n        console.error = baseError\n    })\n})\n\ntest(\"use PureComponent\", () => {\n    const msg: Array<any> = []\n    const baseWarn = console.warn\n    console.warn = m => msg.push(m)\n\n    try {\n        observer(\n            class X extends React.PureComponent {\n                render() {\n                    return <div />\n                }\n            }\n        )\n\n        expect(msg).toEqual([])\n    } finally {\n        console.warn = baseWarn\n    }\n})\n\ntest(\"static on function components are hoisted\", () => {\n    const Comp = () => <div />\n    Comp.foo = 3\n\n    const Comp2 = observer(Comp)\n\n    expect(Comp2.foo).toBe(3)\n})\n\ntest(\"computed properties react to props\", () => {\n    jest.useFakeTimers()\n\n    const seen: Array<any> = []\n    @observer\n    class Child extends React.Component<any, any> {\n        @computed\n        get getPropX() {\n            return this.props.x\n        }\n\n        render() {\n            seen.push(this.getPropX)\n            return <div>{this.getPropX}</div>\n        }\n    }\n\n    class Parent extends React.Component {\n        state = { x: 0 }\n        render() {\n            seen.push(\"parent\")\n            return <Child x={this.state.x} />\n        }\n\n        componentDidMount() {\n            setTimeout(() => this.setState({ x: 2 }), 100)\n        }\n    }\n\n    const { container } = render(<Parent />)\n    expect(container).toHaveTextContent(\"0\")\n\n    act(() => {\n        jest.runAllTimers()\n    })\n    expect(container).toHaveTextContent(\"2\")\n\n    expect(seen).toEqual([\"parent\", 0, \"parent\", 2])\n})\n\ntest(\"#692 - componentDidUpdate is triggered\", () => {\n    jest.useFakeTimers()\n\n    let cDUCount = 0\n\n    @observer\n    class Test extends React.Component<any, any> {\n        @observable\n        counter = 0\n\n        @action\n        inc = () => this.counter++\n\n        constructor(props) {\n            super(props)\n            makeObservable(this)\n            setTimeout(() => this.inc(), 300)\n        }\n\n        render() {\n            return <p>{this.counter}</p>\n        }\n\n        componentDidUpdate() {\n            cDUCount++\n        }\n    }\n    render(<Test />)\n    expect(cDUCount).toBe(0)\n\n    act(() => {\n        jest.runAllTimers()\n    })\n    expect(cDUCount).toBe(1)\n})\n\n// Not possible to properly test error catching (see ErrorCatcher)\ntest.skip(\"#709 - applying observer on React.memo component\", () => {\n    const WithMemo = React.memo(() => {\n        return null\n    })\n\n    const Observed = observer(WithMemo)\n    // @ts-ignore\n    // eslint-disable-next-line no-undef\n    render(<Observed />, { wrapper: ErrorCatcher })\n})\n\ntest(\"Redeclaring an existing observer component as an observer should throw\", () => {\n    @observer\n    class AlreadyObserver extends React.Component<any, any> {\n        render() {\n            return <div />\n        }\n    }\n\n    expect(() => observer(AlreadyObserver)).toThrowErrorMatchingSnapshot()\n})\n\ntest(\"Missing render should throw\", () => {\n    class Component extends React.Component<any, any> {\n        render = function () {\n            return <div />\n        }\n    }\n    expect(() => observer(Component)).toThrow()\n})\n\ntest(\"class observer supports re-mounting #3395\", () => {\n    const state = observable.box(1)\n    let mountCounter = 0\n\n    @observer\n    class TestCmp extends React.Component<any> {\n        componentDidMount() {\n            mountCounter++\n        }\n        render() {\n            return state.get()\n        }\n    }\n\n    const app = (\n        <StrictMode>\n            <TestCmp />\n        </StrictMode>\n    )\n\n    const { unmount, container } = render(app)\n\n    expect(mountCounter).toBe(2)\n    expect(container).toHaveTextContent(\"1\")\n    act(() => {\n        state.set(2)\n    })\n    expect(mountCounter).toBe(2)\n    expect(container).toHaveTextContent(\"2\")\n\n    unmount()\n})\n\ntest(\"SSR works #3448\", () => {\n    consoleWarnMock = jest.spyOn(console, \"warn\").mockImplementation(() => {})\n\n    @observer\n    class TestCmp extends React.Component<any> {\n        render() {\n            return \":)\"\n        }\n    }\n\n    const app = <TestCmp />\n\n    enableStaticRendering(true)\n    const { unmount, container } = render(app)\n    expect(container).toHaveTextContent(\":)\")\n    unmount()\n    enableStaticRendering(false)\n\n    expect(consoleWarnMock).toMatchSnapshot()\n})\n\ntest(\"#3492 should not cause warning by calling forceUpdate on uncommited components\", async () => {\n    consoleWarnMock = jest.spyOn(console, \"warn\").mockImplementation(() => {})\n\n    const o = observable({ x: 0 })\n    let aConstructorCount = 0\n    let aMountCount = 0\n    let aRenderCount = 0\n\n    @observer\n    class A extends React.Component<any> {\n        constructor(props) {\n            super(props)\n            aConstructorCount++\n        }\n        componentDidMount(): void {\n            aMountCount++\n        }\n        render() {\n            aRenderCount++\n            return (\n                <Suspense fallback=\"fallback\">\n                    <LazyB />\n                    {o.x}\n                </Suspense>\n            )\n        }\n    }\n\n    class B extends React.Component {\n        render() {\n            return \"B\"\n        }\n    }\n\n    const LazyA = React.lazy(() => Promise.resolve({ default: A }))\n    const LazyB = React.lazy(() => Promise.resolve({ default: B }))\n\n    function App() {\n        return (\n            <Suspense fallback=\"fallback\">\n                <LazyA />\n            </Suspense>\n        )\n    }\n\n    const { unmount, container } = render(<App />)\n\n    expect(container).toHaveTextContent(\"fallback\")\n    await waitFor(() => expect(container).toHaveTextContent(\"B0\"))\n    act(() => {\n        o.x++\n    })\n    expect(container).toHaveTextContent(\"B1\")\n    // React throws away the first instance, therefore the mismatch\n    expect(aConstructorCount).toBe(2)\n    expect(aMountCount).toBe(1)\n    expect(aRenderCount).toBe(3)\n    unmount()\n    expect(consoleWarnMock).toMatchSnapshot()\n})\n;[\"props\", \"state\", \"context\"].forEach(key => {\n    test(`using ${key} in computed throws`, () => {\n        // React prints errors even if we catch em\n        const consoleErrorSpy = jest.spyOn(console, \"error\").mockImplementation(() => {})\n\n        const TestCmp = observer(\n            class TestCmp extends React.Component {\n                render() {\n                    computed(() => this[key]).get()\n                    return \"\"\n                }\n            }\n        )\n\n        expect(() => render(<TestCmp />)).toThrow(\n            new RegExp(`^\\\\[mobx-react\\\\] Cannot read \"TestCmp.${key}\" in a reactive context`)\n        )\n\n        consoleErrorSpy.mockRestore()\n    })\n\n    test(`using ${key} in autorun throws`, () => {\n        // React prints errors even if we catch em\n        const consoleErrorSpy = jest.spyOn(console, \"error\").mockImplementation(() => {})\n\n        let caughtError\n\n        const TestCmp = observer(\n            class TestCmp extends React.Component {\n                disposeAutorun: IReactionDisposer | undefined\n\n                componentDidMount(): void {\n                    this.disposeAutorun = autorun(() => this[key], {\n                        onError: error => (caughtError = error)\n                    })\n                }\n\n                componentWillUnmount(): void {\n                    this.disposeAutorun?.()\n                }\n\n                render() {\n                    return \"\"\n                }\n            }\n        )\n\n        render(<TestCmp />)\n        expect(caughtError?.message).toMatch(\n            new RegExp(`^\\\\[mobx-react\\\\] Cannot read \"TestCmp.${key}\" in a reactive context`)\n        )\n\n        consoleErrorSpy.mockRestore()\n    })\n})\n\ntest(`Component react's to observable changes in componenDidMount #3691`, () => {\n    const o = observable.box(0)\n\n    const TestCmp = observer(\n        class TestCmp extends React.Component {\n            componentDidMount(): void {\n                o.set(o.get() + 1)\n            }\n\n            render() {\n                return o.get()\n            }\n        }\n    )\n\n    const { container, unmount } = render(<TestCmp />)\n    expect(container).toHaveTextContent(\"1\")\n    unmount()\n})\n\ntest(`Observable changes in componenWillUnmount don't cause any warnings or errors`, () => {\n    const consoleErrorSpy = jest.spyOn(console, \"error\").mockImplementation(() => {})\n    const consoleWarnSpy = jest.spyOn(console, \"warn\").mockImplementation(() => {})\n    const o = observable.box(0)\n\n    const TestCmp = observer(\n        class TestCmp extends React.Component {\n            componentWillUnmount(): void {\n                o.set(o.get() + 1)\n            }\n\n            render() {\n                return o.get()\n            }\n        }\n    )\n\n    const { container, unmount } = render(<TestCmp />)\n    expect(container).toHaveTextContent(\"0\")\n    unmount()\n\n    expect(consoleErrorSpy).not.toHaveBeenCalled()\n    expect(consoleWarnSpy).not.toHaveBeenCalled()\n\n    consoleErrorSpy.mockRestore()\n    consoleWarnSpy.mockRestore()\n})\n\ntest(`Observable prop workaround`, () => {\n    configure({\n        enforceActions: \"observed\"\n    })\n\n    const propValues: Array<any> = []\n\n    const TestCmp = observer(\n        class TestCmp extends React.Component<{ prop: number }> {\n            disposeReaction: IReactionDisposer | undefined\n            observableProp: number\n\n            get computed() {\n                return this.observableProp + 100\n            }\n\n            constructor(props) {\n                super(props)\n                // Synchronize our observableProp with the actual prop on the first render.\n                this.observableProp = this.props.prop\n                makeObservable(this, {\n                    observableProp: observable,\n                    computed: computed,\n                    // Mutates observable therefore must be action\n                    componentDidUpdate: action\n                })\n            }\n\n            componentDidMount(): void {\n                // Reactions/autoruns must be created in componenDidMount (not in constructor).\n                this.disposeReaction = reaction(\n                    () => this.observableProp,\n                    prop => propValues.push(prop),\n                    {\n                        fireImmediately: true\n                    }\n                )\n            }\n\n            componentDidUpdate(): void {\n                // Synchronize our observableProp with the actual prop on every update.\n                this.observableProp = this.props.prop\n            }\n\n            componentWillUnmount(): void {\n                this.disposeReaction?.()\n            }\n\n            render() {\n                return this.computed\n            }\n        }\n    )\n\n    const { container, unmount, rerender } = render(<TestCmp prop={1} />)\n    expect(container).toHaveTextContent(\"101\")\n    rerender(<TestCmp prop={2} />)\n    expect(container).toHaveTextContent(\"102\")\n    rerender(<TestCmp prop={3} />)\n    expect(container).toHaveTextContent(\"103\")\n    rerender(<TestCmp prop={4} />)\n    expect(container).toHaveTextContent(\"104\")\n    expect(propValues).toEqual([1, 2, 3, 4])\n    unmount()\n})\n\ntest(`Observable props/state/context workaround`, () => {\n    configure({\n        enforceActions: \"observed\"\n    })\n\n    const reactionResults: Array<string> = []\n\n    const ContextType = React.createContext(0)\n\n    const TestCmp = observer(\n        class TestCmp extends React.Component<any, any> {\n            static contextType = ContextType\n\n            disposeReaction: IReactionDisposer | undefined\n            observableProps: any\n            observableState: any\n            observableContext: any\n\n            constructor(props, context) {\n                super(props, context)\n                this.state = {\n                    x: 0\n                }\n                this.observableState = this.state\n                this.observableProps = this.props\n                this.observableContext = this.context\n                makeObservable(this, {\n                    observableProps: observable,\n                    observableState: observable,\n                    observableContext: observable,\n                    computed: computed,\n                    componentDidUpdate: action\n                })\n            }\n\n            get computed() {\n                return `${this.observableProps?.x}${this.observableState?.x}${this.observableContext}`\n            }\n\n            componentDidMount(): void {\n                this.disposeReaction = reaction(\n                    () => this.computed,\n                    prop => reactionResults.push(prop),\n                    {\n                        fireImmediately: true\n                    }\n                )\n            }\n\n            componentDidUpdate(): void {\n                // Props are different object with every update\n                if (!shallowEqual(this.observableProps, this.props)) {\n                    this.observableProps = this.props\n                }\n                if (!shallowEqual(this.observableState, this.state)) {\n                    this.observableState = this.state\n                }\n                if (!shallowEqual(this.observableContext, this.context)) {\n                    this.observableContext = this.context\n                }\n            }\n\n            componentWillUnmount(): void {\n                this.disposeReaction?.()\n            }\n\n            render() {\n                return (\n                    <span\n                        id=\"updateState\"\n                        onClick={() => this.setState(state => ({ x: state.x + 1 }))}\n                    >\n                        {this.computed}\n                    </span>\n                )\n            }\n        }\n    )\n\n    const App = () => {\n        const [context, setContext] = React.useState(0)\n        const [prop, setProp] = React.useState(0)\n        return (\n            <ContextType.Provider value={context}>\n                <span id=\"updateContext\" onClick={() => setContext(val => val + 1)}></span>\n                <span id=\"updateProp\" onClick={() => setProp(val => val + 1)}></span>\n                <TestCmp x={prop}></TestCmp>\n            </ContextType.Provider>\n        )\n    }\n\n    const { container, unmount } = render(<App />)\n\n    const updateProp = () =>\n        act(() => (container.querySelector(\"#updateProp\") as HTMLElement).click())\n    const updateState = () =>\n        act(() => (container.querySelector(\"#updateState\") as HTMLElement).click())\n    const updateContext = () =>\n        act(() => (container.querySelector(\"#updateContext\") as HTMLElement).click())\n\n    expect(container).toHaveTextContent(\"000\")\n    updateProp()\n    expect(container).toHaveTextContent(\"100\")\n    updateState()\n    expect(container).toHaveTextContent(\"110\")\n    updateContext()\n    expect(container).toHaveTextContent(\"111\")\n\n    expect(reactionResults).toEqual([\"000\", \"100\", \"110\", \"111\"])\n    unmount()\n})\n\ntest(\"Class observer can react to changes made before mount #3730\", () => {\n    const o = observable.box(0)\n\n    @observer\n    class Child extends React.Component {\n        componentDidMount(): void {\n            o.set(1)\n        }\n        render() {\n            return \"\"\n        }\n    }\n\n    @observer\n    class Parent extends React.Component {\n        render() {\n            return (\n                <span>\n                    {o.get()}\n                    <Child />\n                </span>\n            )\n        }\n    }\n\n    const { container, unmount } = render(<Parent />)\n    expect(container).toHaveTextContent(\"1\")\n    unmount()\n})\n"
  },
  {
    "path": "packages/mobx-react/__tests__/propTypes.test.ts",
    "content": "import PropTypes from \"prop-types\"\nimport { PropTypes as MRPropTypes } from \"../src\"\nimport { observable } from \"mobx\"\n\n// Cause `checkPropTypes` caches errors and doesn't print them twice....\n// https://github.com/facebook/prop-types/issues/91\nlet testComponentId = 0\n\nfunction typeCheckFail(declaration, value, message) {\n    const baseError = console.error\n    let error = \"\"\n    console.error = msg => {\n        error = msg\n    }\n\n    const props = { testProp: value }\n    const propTypes = { testProp: declaration }\n\n    const compId = \"testComponent\" + ++testComponentId\n    PropTypes.checkPropTypes(propTypes, props, \"prop\", compId)\n\n    error = error.replace(compId, \"testComponent\")\n    expect(error).toBe(\"Warning: Failed prop type: \" + message)\n    console.error = baseError\n}\n\nfunction typeCheckFailRequiredValues(declaration) {\n    const baseError = console.error\n    let error = \"\"\n    console.error = msg => {\n        error = msg\n    }\n\n    const propTypes = { testProp: declaration }\n    const specifiedButIsNullMsg = /but its value is `null`\\./\n    const unspecifiedMsg = /but its value is `undefined`\\./\n\n    const props1 = { testProp: null }\n    PropTypes.checkPropTypes(propTypes, props1, \"testProp\", \"testComponent\" + ++testComponentId)\n    expect(specifiedButIsNullMsg.test(error)).toBeTruthy()\n\n    error = \"\"\n    const props2 = { testProp: undefined }\n    PropTypes.checkPropTypes(propTypes, props2, \"testProp\", \"testComponent\" + ++testComponentId)\n    expect(unspecifiedMsg.test(error)).toBeTruthy()\n\n    error = \"\"\n    const props3 = {}\n    PropTypes.checkPropTypes(propTypes, props3, \"testProp\", \"testComponent\" + ++testComponentId)\n    expect(unspecifiedMsg.test(error)).toBeTruthy()\n\n    console.error = baseError\n}\n\nfunction typeCheckPass(declaration: any, value?: any) {\n    const props = { testProp: value }\n    const error = PropTypes.checkPropTypes(\n        { testProp: declaration },\n        props,\n        \"testProp\",\n        \"testComponent\" + ++testComponentId\n    )\n    expect(error).toBeUndefined()\n}\n\ntest(\"Valid values\", () => {\n    typeCheckPass(MRPropTypes.observableArray, observable([]))\n    typeCheckPass(MRPropTypes.observableArrayOf(PropTypes.string), observable([\"\"]))\n    typeCheckPass(MRPropTypes.arrayOrObservableArray, observable([]))\n    typeCheckPass(MRPropTypes.arrayOrObservableArray, [])\n    typeCheckPass(MRPropTypes.arrayOrObservableArrayOf(PropTypes.string), observable([\"\"]))\n    typeCheckPass(MRPropTypes.arrayOrObservableArrayOf(PropTypes.string), [\"\"])\n    typeCheckPass(MRPropTypes.observableObject, observable({}))\n    typeCheckPass(MRPropTypes.objectOrObservableObject, {})\n    typeCheckPass(MRPropTypes.objectOrObservableObject, observable({}))\n    typeCheckPass(MRPropTypes.observableMap, observable(observable.map({}, { deep: false })))\n})\n\ntest(\"should be implicitly optional and not warn\", () => {\n    typeCheckPass(MRPropTypes.observableArray)\n    typeCheckPass(MRPropTypes.observableArrayOf(PropTypes.string))\n    typeCheckPass(MRPropTypes.arrayOrObservableArray)\n    typeCheckPass(MRPropTypes.arrayOrObservableArrayOf(PropTypes.string))\n    typeCheckPass(MRPropTypes.observableObject)\n    typeCheckPass(MRPropTypes.objectOrObservableObject)\n    typeCheckPass(MRPropTypes.observableMap)\n})\n\ntest(\"should warn for missing required values, function (test)\", () => {\n    typeCheckFailRequiredValues(MRPropTypes.observableArray.isRequired)\n    typeCheckFailRequiredValues(MRPropTypes.observableArrayOf(PropTypes.string).isRequired)\n    typeCheckFailRequiredValues(MRPropTypes.arrayOrObservableArray.isRequired)\n    typeCheckFailRequiredValues(MRPropTypes.arrayOrObservableArrayOf(PropTypes.string).isRequired)\n    typeCheckFailRequiredValues(MRPropTypes.observableObject.isRequired)\n    typeCheckFailRequiredValues(MRPropTypes.objectOrObservableObject.isRequired)\n    typeCheckFailRequiredValues(MRPropTypes.observableMap.isRequired)\n})\n\ntest(\"should fail date and regexp correctly\", () => {\n    typeCheckFail(\n        MRPropTypes.observableObject,\n        new Date(),\n        \"Invalid prop `testProp` of type `date` supplied to \" +\n            \"`testComponent`, expected `mobx.ObservableObject`.\"\n    )\n    typeCheckFail(\n        MRPropTypes.observableArray,\n        /please/,\n        \"Invalid prop `testProp` of type `regexp` supplied to \" +\n            \"`testComponent`, expected `mobx.ObservableArray`.\"\n    )\n})\n\ntest(\"observableArray\", () => {\n    typeCheckFail(\n        MRPropTypes.observableArray,\n        [],\n        \"Invalid prop `testProp` of type `array` supplied to \" +\n            \"`testComponent`, expected `mobx.ObservableArray`.\"\n    )\n    typeCheckFail(\n        MRPropTypes.observableArray,\n        \"\",\n        \"Invalid prop `testProp` of type `string` supplied to \" +\n            \"`testComponent`, expected `mobx.ObservableArray`.\"\n    )\n})\n\ntest(\"arrayOrObservableArray\", () => {\n    typeCheckFail(\n        MRPropTypes.arrayOrObservableArray,\n        \"\",\n        \"Invalid prop `testProp` of type `string` supplied to \" +\n            \"`testComponent`, expected `mobx.ObservableArray` or javascript `array`.\"\n    )\n})\n\ntest(\"observableObject\", () => {\n    typeCheckFail(\n        MRPropTypes.observableObject,\n        {},\n        \"Invalid prop `testProp` of type `object` supplied to \" +\n            \"`testComponent`, expected `mobx.ObservableObject`.\"\n    )\n    typeCheckFail(\n        MRPropTypes.observableObject,\n        \"\",\n        \"Invalid prop `testProp` of type `string` supplied to \" +\n            \"`testComponent`, expected `mobx.ObservableObject`.\"\n    )\n})\n\ntest(\"objectOrObservableObject\", () => {\n    typeCheckFail(\n        MRPropTypes.objectOrObservableObject,\n        \"\",\n        \"Invalid prop `testProp` of type `string` supplied to \" +\n            \"`testComponent`, expected `mobx.ObservableObject` or javascript `object`.\"\n    )\n})\n\ntest(\"observableMap\", () => {\n    typeCheckFail(\n        MRPropTypes.observableMap,\n        {},\n        \"Invalid prop `testProp` of type `object` supplied to \" +\n            \"`testComponent`, expected `mobx.ObservableMap`.\"\n    )\n})\n\ntest(\"observableArrayOf\", () => {\n    typeCheckFail(\n        MRPropTypes.observableArrayOf(PropTypes.string),\n        2,\n        \"Invalid prop `testProp` of type `number` supplied to \" +\n            \"`testComponent`, expected `mobx.ObservableArray`.\"\n    )\n    typeCheckFail(\n        MRPropTypes.observableArrayOf(PropTypes.string),\n        observable([2]),\n        \"Invalid prop `testProp[0]` of type `number` supplied to \" +\n            \"`testComponent`, expected `string`.\"\n    )\n    typeCheckFail(\n        MRPropTypes.observableArrayOf({ foo: (MRPropTypes as any).string } as any),\n        { foo: \"bar\" },\n        \"Property `testProp` of component `testComponent` has invalid PropType notation.\"\n    )\n})\n\ntest(\"arrayOrObservableArrayOf\", () => {\n    typeCheckFail(\n        MRPropTypes.arrayOrObservableArrayOf(PropTypes.string),\n        2,\n        \"Invalid prop `testProp` of type `number` supplied to \" +\n            \"`testComponent`, expected `mobx.ObservableArray` or javascript `array`.\"\n    )\n    typeCheckFail(\n        MRPropTypes.arrayOrObservableArrayOf(PropTypes.string),\n        observable([2]),\n        \"Invalid prop `testProp[0]` of type `number` supplied to \" +\n            \"`testComponent`, expected `string`.\"\n    )\n    typeCheckFail(\n        MRPropTypes.arrayOrObservableArrayOf(PropTypes.string),\n        [2],\n        \"Invalid prop `testProp[0]` of type `number` supplied to \" +\n            \"`testComponent`, expected `string`.\"\n    )\n    // TODO:\n    typeCheckFail(\n        MRPropTypes.arrayOrObservableArrayOf({ foo: (MRPropTypes as any).string } as any),\n        { foo: \"bar\" },\n        \"Property `testProp` of component `testComponent` has invalid PropType notation.\"\n    )\n})\n"
  },
  {
    "path": "packages/mobx-react/__tests__/stateless.test.tsx",
    "content": "import React from \"react\"\nimport PropTypes from \"prop-types\"\nimport { observer, PropTypes as MRPropTypes } from \"../src\"\nimport { render, act } from \"@testing-library/react\"\nimport { observable } from \"mobx\"\n\nconst StatelessComp = ({ testProp }) => <div>result: {testProp}</div>\n\nStatelessComp.propTypes = {\n    testProp: PropTypes.string\n}\nStatelessComp.defaultProps = {\n    testProp: \"default value for prop testProp\"\n}\n\n// skipping because `propTypes` and `defaultProps` are dropped in React 19\ndescribe.skip(\"stateless component with propTypes\", () => {\n    const StatelessCompObserver: React.FunctionComponent<any> = observer(StatelessComp)\n\n    test(\"default property value should be propagated\", () => {\n        expect(StatelessComp.defaultProps.testProp).toBe(\"default value for prop testProp\")\n        expect(StatelessCompObserver.defaultProps!.testProp).toBe(\"default value for prop testProp\")\n    })\n\n    const originalConsoleError = console.error\n    let beenWarned = false\n    console.error = () => (beenWarned = true)\n    // eslint-disable-next-line no-unused-vars\n    const wrapper = <StatelessCompObserver testProp={10} />\n    console.error = originalConsoleError\n\n    test(\"an error should be logged with a property type warning\", () => {\n        expect(beenWarned).toBeTruthy()\n    })\n\n    test(\"render test correct\", async () => {\n        const { container } = render(<StatelessCompObserver testProp=\"hello world\" />)\n        expect(container.textContent).toBe(\"result: hello world\")\n    })\n})\n\ntest(\"stateless component with context support\", () => {\n    const C = React.createContext<any>({})\n\n    const StateLessCompWithContext = () => (\n        <C.Consumer>{value => <div>context: {value.testContext}</div>}</C.Consumer>\n    )\n\n    const StateLessCompWithContextObserver = observer(StateLessCompWithContext)\n\n    const ContextProvider = () => (\n        <C.Provider value={{ testContext: \"hello world\" }}>\n            <StateLessCompWithContextObserver />\n        </C.Provider>\n    )\n\n    const { container } = render(<ContextProvider />)\n    expect(container.textContent).toBe(\"context: hello world\")\n})\n\n// propTypes validation seems to have been removed from class components in React 19: https://react.dev/reference/react/Component\ntest.skip(\"component with observable propTypes\", () => {\n    class Comp extends React.Component {\n        render() {\n            return null\n        }\n        static propTypes = {\n            a1: MRPropTypes.observableArray,\n            a2: MRPropTypes.arrayOrObservableArray\n        }\n    }\n    const originalConsoleError = console.error\n    const warnings: Array<any> = []\n    console.error = msg => warnings.push(msg)\n    // eslint-disable-next-line no-unused-vars\n    const firstWrapper = <Comp a1={[]} a2={[]} />\n    expect(warnings.length).toBe(1)\n    // eslint-disable-next-line no-unused-vars\n    const secondWrapper = <Comp a1={observable([])} a2={observable([])} />\n    expect(warnings.length).toBe(1)\n    console.error = originalConsoleError\n})\n\ndescribe(\"stateless component with forwardRef\", () => {\n    const a = observable({\n        x: 1\n    })\n    const ForwardRefCompObserver: React.ForwardRefExoticComponent<any> = observer(\n        React.forwardRef(({ testProp }, ref) => {\n            return (\n                <div>\n                    result: {testProp}, {ref ? \"got ref\" : \"no ref\"}, a.x: {a.x}\n                </div>\n            )\n        })\n    )\n\n    test(\"render test correct\", () => {\n        const { container } = render(\n            <ForwardRefCompObserver testProp=\"hello world\" ref={React.createRef()} />\n        )\n        expect(container).toMatchSnapshot()\n    })\n\n    test(\"is reactive\", () => {\n        const { container } = render(\n            <ForwardRefCompObserver testProp=\"hello world\" ref={React.createRef()} />\n        )\n        act(() => {\n            a.x++\n        })\n        expect(container).toMatchSnapshot()\n    })\n})\n"
  },
  {
    "path": "packages/mobx-react/__tests__/timerBasedFinalizationRegistry.tsx",
    "content": "import \"./utils/killFinalizationRegistry\"\nimport { cleanup, render, act } from \"@testing-library/react\"\nimport * as mobx from \"mobx\"\nimport * as React from \"react\"\nimport { observer } from \"../src\"\nimport { clearTimers } from \"mobx-react-lite\"\n\nexpect(globalThis.FinalizationRegistry).toBeUndefined()\n\nafterEach(cleanup)\n\ntest(\"should unregister from FinalizationRegistry once commited #3776\", async () => {\n    const o = mobx.observable({ x: 0 })\n\n    @observer\n    class TestCmp extends React.Component<any> {\n        render() {\n            return o.x\n        }\n    }\n\n    const { unmount, container } = render(<TestCmp />)\n\n    expect(container).toHaveTextContent(\"0\")\n\n    // If not unregistered, clearTimes disposes reaction\n    clearTimers()\n\n    act(() => {\n        o.x++\n    })\n\n    expect(container).toHaveTextContent(\"1\")\n\n    unmount()\n})\n"
  },
  {
    "path": "packages/mobx-react/__tests__/transactions.test.tsx",
    "content": "import React from \"react\"\nimport { autorun, computed, observable, transaction } from \"mobx\"\nimport { observer } from \"../src\"\nimport { render, act } from \"@testing-library/react\"\n\ntest(\"mobx issue 50\", async () => {\n    const foo = {\n        a: observable.box(true),\n        b: observable.box(false),\n        c: computed(function () {\n            // console.log(\"evaluate c\")\n            return foo.b.get()\n        })\n    }\n    function flipStuff() {\n        transaction(() => {\n            foo.a.set(!foo.a.get())\n            foo.b.set(!foo.b.get())\n        })\n    }\n    let asText = \"\"\n    autorun(() => (asText = [foo.a.get(), foo.b.get(), foo.c.get()].join(\":\")))\n    const Test = observer(\n        class Test extends React.Component {\n            render() {\n                return <div id=\"x\">{[foo.a.get(), foo.b.get(), foo.c.get()].join(\",\")}</div>\n            }\n        }\n    )\n\n    render(<Test />)\n\n    // Flip a and b. This will change c.\n    act(() => flipStuff())\n\n    expect(asText).toBe(\"false:true:true\")\n    expect(document.getElementById(\"x\")!.innerHTML).toBe(\"false,true,true\")\n})\n\ntest(\"ReactDOM.render should respect transaction\", () => {\n    const a = observable.box(2)\n    const loaded = observable.box(false)\n    const valuesSeen: Array<number> = []\n\n    const Component = observer(() => {\n        valuesSeen.push(a.get())\n        if (loaded.get()) return <div>{a.get()}</div>\n        else return <div>loading</div>\n    })\n\n    const { container } = render(<Component />)\n\n    act(() =>\n        transaction(() => {\n            a.set(3)\n            a.set(4)\n            loaded.set(true)\n        })\n    )\n\n    expect(container.textContent).toBe(\"4\")\n    expect(valuesSeen.sort()).toEqual([2, 4].sort())\n})\n"
  },
  {
    "path": "packages/mobx-react/__tests__/tsconfig.json",
    "content": "{\n    \"extends\": \"../tsconfig.test.json\"\n}\n"
  },
  {
    "path": "packages/mobx-react/__tests__/utils/ErrorCatcher.tsx",
    "content": "import React from \"react\"\n\ninterface ErrorCatcherState {\n    hasError: boolean\n}\n\n// FIXME: saddly, this does not work as hoped, see: https://github.com/facebook/react/issues/10474#issuecomment-332810203\nexport default class ErrorCatcher extends React.Component<any, Readonly<ErrorCatcherState>> {\n    static lastError\n    static getError\n    constructor(props) {\n        super(props)\n        this.state = { hasError: false }\n    }\n\n    componentDidCatch(error, info) {\n        console.error(\"Caught react error\", error, info)\n        ErrorCatcher.lastError = \"\" + error\n        this.setState({ hasError: true })\n    }\n\n    render() {\n        if (this.state.hasError) {\n            return null\n        }\n        return this.props.children\n    }\n}\n\nErrorCatcher.lastError = \"\"\nErrorCatcher.getError = function () {\n    const res = ErrorCatcher.lastError\n    ErrorCatcher.lastError = \"\"\n    return res\n}\n"
  },
  {
    "path": "packages/mobx-react/__tests__/utils/compile-ts.tsx",
    "content": "import React from \"react\"\nimport ReactDOM from \"react-dom\"\nimport PropTypes from \"prop-types\"\nimport {\n    observer,\n    Provider,\n    inject,\n    Observer,\n    disposeOnUnmount,\n    PropTypes as MRPropTypes,\n    useLocalStore\n} from \"../src\"\n\n@observer\nclass T1 extends React.Component<{ pizza: number }, {}> {\n    render() {\n        return <div>{this.props.pizza}</div>\n    }\n}\n\nconst T2 = observer(\n    class T2 extends React.Component<{ cake: number; zoem: any[] }> {\n        defaultProps = { cake: 7 }\n        render() {\n            return (\n                <div>\n                    <T1 pizza={this.props.cake} />\n                </div>\n            )\n        }\n        static propTypes = {\n            zoem: MRPropTypes.arrayOrObservableArray\n        }\n    }\n)\n\nconst T3 = observer((props: { hamburger: number }) => {\n    return <T2 cake={props.hamburger} zoem={[]} />\n})\n\nconst T4 = ({ sandwich }: { sandwich: number }) => (\n    <div>\n        <T3 hamburger={sandwich} />\n    </div>\n)\n\nconst T5 = observer(() => {\n    return <T3 hamburger={17} />\n})\n\n@observer\nclass T6 extends React.Component<{}, {}> {\n    render() {\n        return (\n            <span>\n                <T3 hamburger={6} />\n                {/* doesn't work with tsc 1.7.5: https://github.com/Microsoft/TypeScript/issues/5675 */}\n                {/*<T4 sandwich={5} />*/}\n                <T5 />\n            </span>\n        )\n    }\n}\n\nconst x = React.createElement(T3, { hamburger: 4 })\n\nclass T7 extends React.Component<{ pizza: number }, {}> {\n    render() {\n        return <div>{this.props.pizza}</div>\n    }\n}\nReact.createElement(observer(T7), { pizza: 4 })\n\nReactDOM.render(<T5 />, document.body)\n\nclass ProviderTest extends React.Component<any, any> {\n    render() {\n        return (\n            <Provider foo={32}>\n                <div>hi</div>\n            </Provider>\n        )\n    }\n}\n\n@inject(() => ({ x: 3 }))\nclass T11 extends React.Component<{ pizza: number; x?: number }, {}> {\n    render() {\n        return (\n            <div>\n                {this.props.pizza}\n                {this.props.x}\n            </div>\n        )\n    }\n}\n\nclass T15 extends React.Component<{ pizza: number; x?: number }, {}> {\n    render() {\n        return (\n            <div>\n                {this.props.pizza}\n                {this.props.x}\n            </div>\n        )\n    }\n}\nconst T16 = inject(() => ({ x: 3 }))(T15)\n\nclass T17 extends React.Component<{}, {}> {\n    render() {\n        return (\n            <div>\n                <T11 pizza={3} x={1} />\n                <T15 pizza={3} x={1} />\n                <T16 pizza={4} x={2} />\n                <T11 pizza={3} />\n                <T15 pizza={3} />\n                <T16 pizza={4} />\n            </div>\n        )\n    }\n}\n\n@inject(\"a\", \"b\")\nclass T12 extends React.Component<{ pizza: number }, {}> {\n    render() {\n        return <div>{this.props.pizza}</div>\n    }\n}\n\n@inject(\"a\", \"b\")\n@observer\nclass T13 extends React.Component<{ pizza: number }, {}> {\n    render() {\n        return <div>{this.props.pizza}</div>\n    }\n}\n\nconst LoginContainer = inject((allStores, props) => ({\n    store: { y: true, z: 2 },\n    z: 7\n}))(\n    observer(\n        class _LoginContainer extends React.Component<\n            {\n                x: string\n                store?: { y: boolean; z: number }\n            },\n            {}\n        > {\n            static contextTypes: React.ValidationMap<any> = {\n                router: PropTypes.func.isRequired\n            }\n\n            render() {\n                return (\n                    <div>\n                        Hello!\n                        {this.props.x}\n                        {this.props.store!.y}\n                    </div>\n                )\n            }\n        }\n    )\n)\nReactDOM.render(<LoginContainer x=\"test\" />, document.body)\n\n@inject(allStores => ({\n    store: { y: true, z: 2 }\n}))\n@observer\nclass LoginContainer2 extends React.Component<\n    {\n        x: string\n        store?: { y: boolean }\n    },\n    {}\n> {\n    static contextTypes: React.ValidationMap<any> = {\n        router: PropTypes.func.isRequired\n    }\n\n    render() {\n        return (\n            <div>\n                Hello!\n                {this.props.x}\n                {this.props.store!.y}\n            </div>\n        )\n    }\n}\n\nReactDOM.render(<LoginContainer2 x=\"test\" />, document.body)\n\nclass ObserverTest extends React.Component<any, any> {\n    render() {\n        return <Observer>{() => <div>test</div>}</Observer>\n    }\n}\n\nclass ObserverTest2 extends React.Component<any, any> {\n    render() {\n        return <Observer render={() => <div>test</div>} />\n    }\n}\n\n@observer\nclass ComponentWithoutPropsAndState extends React.Component<{}, {}> {\n    componentDidUpdate() {}\n\n    render() {\n        return <div>Hello!</div>\n    }\n}\n\nconst AppInner = observer((props: { a: number }) => {\n    return (\n        <div>\n            <h1>Hello</h1>\n            {props.a}\n        </div>\n    )\n})\n\nconst App = inject(\"store\")(AppInner)\n\nApp.wrappedComponent\n\n@inject(\"store\")\n@observer\nclass App2 extends React.Component<{ a: number }, {}> {}\n\nclass InjectSomeStores extends React.Component<{ x: any }, {}> {\n    render() {\n        return <div>Hello World</div>\n    }\n}\n\ninject(({ x }) => ({ x }))(InjectSomeStores)\n\n{\n    class T extends React.Component<{ x: number }> {\n        render() {\n            return <div />\n        }\n    }\n\n    const Injected = inject(\"test\")(T)\n    ;<Injected.wrappedComponent x={3} />\n}\n\n{\n    // just to make sure it compiles\n    class DisposeOnUnmountComponent extends React.Component<{}> {\n        @disposeOnUnmount\n        methodA = () => {}\n\n        methodB = disposeOnUnmount(this, () => {})\n        manyMethods = disposeOnUnmount(this, [() => {}, () => {}])\n    }\n\n    // manual tests: this should not compile when the decorator is not applied over a react component class\n    /*\n    class DisposeOnUnmountNotAComponent {\n        @disposeOnUnmount\n        methodA = () => {}\n\n        methodB = disposeOnUnmount(this, () => {})\n    }\n    */\n}\n\n{\n    const TestComponent = () => {\n        const observable = useLocalStore(() => ({\n            test: 3\n        }))\n\n        return <h1>{observable.test * 2}</h1>\n    }\n    ;<TestComponent />\n}\n\ntest(\"ok\", () => {\n    // just to satisfy jest\n})\n"
  },
  {
    "path": "packages/mobx-react/__tests__/utils/killFinalizationRegistry.ts",
    "content": "// We want to be able to test reaction cleanup code that based on FinalizationRegistry & timers on the same run\n// For that we import this file on the beginning on the timer based test to the feature detection will pick the timers impl\n// @ts-ignore\nglobal.FinalizationRegistry = undefined\n"
  },
  {
    "path": "packages/mobx-react/__tests__/utils/withConsole.ts",
    "content": "import mockConsole, { MockObj } from \"jest-mock-console\"\n\nexport function withConsole(fn: Function): void\nexport function withConsole(settings: MockObj, fn: Function): void\nexport function withConsole(props: Array<ConsoleProps>, fn: Function): void\n\nexport function withConsole(...args: Array<any>): void {\n    let settings\n    let fn\n    if (typeof args[0] === \"function\") {\n        fn = args[0]\n    } else if (Array.isArray(args[0]) || typeof args[0] === \"object\") {\n        settings = args[0]\n\n        if (typeof args[1] === \"function\") {\n            fn = args[1]\n        }\n    }\n    const restoreConsole = mockConsole(settings)\n    fn && fn()\n    restoreConsole()\n}\n"
  },
  {
    "path": "packages/mobx-react/batchingForReactDom.js",
    "content": "require(\"mobx-react-lite/batchingForReactDom\")\n"
  },
  {
    "path": "packages/mobx-react/batchingForReactNative.js",
    "content": "require(\"mobx-react-lite/batchingForReactNative\")\n"
  },
  {
    "path": "packages/mobx-react/batchingOptOut.js",
    "content": "require(\"mobx-react-lite/batchingOptOut\")\n"
  },
  {
    "path": "packages/mobx-react/jest.config.js",
    "content": "const buildConfig = require(\"../../jest.base.config\")\n\nmodule.exports = buildConfig(__dirname, {\n    testRegex: \"__tests__/.*\\\\.tsx$\",\n    setupFilesAfterEnv: [`<rootDir>/jest.setup.ts`],\n    testPathIgnorePatterns: [\"node_modules\", \"<rootDir>/__tests__/utils\"]\n})\n"
  },
  {
    "path": "packages/mobx-react/jest.setup.ts",
    "content": "import \"@testing-library/jest-dom/extend-expect\"\nimport { configure } from \"mobx\"\n\nglobal.setImmediate = global.setImmediate || ((fn, ...args) => global.setTimeout(fn, 0, ...args))\n\nconfigure({ enforceActions: \"never\" })\n\n// @ts-ignore\nglobal.__DEV__ = true\n"
  },
  {
    "path": "packages/mobx-react/package.json",
    "content": "{\n    \"name\": \"mobx-react\",\n    \"version\": \"9.2.1\",\n    \"description\": \"React bindings for MobX. Create fully reactive components.\",\n    \"source\": \"src/index.ts\",\n    \"main\": \"dist/index.js\",\n    \"umd:main\": \"dist/mobxreact.umd.production.min.js\",\n    \"unpkg\": \"dist/mobxreact.umd.production.min.js\",\n    \"jsdelivr\": \"dist/mobxreact.umd.production.min.js\",\n    \"jsnext:main\": \"dist/mobxreact.esm.js\",\n    \"module\": \"dist/mobxreact.esm.js\",\n    \"react-native\": \"dist/mobxreact.esm.js\",\n    \"types\": \"dist/index.d.ts\",\n    \"typings\": \"dist/index.d.ts\",\n    \"files\": [\n        \"src\",\n        \"dist\",\n        \"LICENSE\",\n        \"CHANGELOG.md\",\n        \"README.md\",\n        \"batching*\"\n    ],\n    \"sideEffects\": false,\n    \"repository\": {\n        \"type\": \"git\",\n        \"url\": \"https://github.com/mobxjs/mobx.git\"\n    },\n    \"author\": \"Michel Weststrate\",\n    \"license\": \"MIT\",\n    \"funding\": {\n        \"type\": \"opencollective\",\n        \"url\": \"https://opencollective.com/mobx\"\n    },\n    \"bugs\": {\n        \"url\": \"https://github.com/mobxjs/mobx/issues\"\n    },\n    \"homepage\": \"https://mobx.js.org\",\n    \"dependencies\": {\n        \"mobx-react-lite\": \"^4.1.1\"\n    },\n    \"peerDependencies\": {\n        \"mobx\": \"^6.9.0\",\n        \"react\": \"^16.8.0 || ^17 || ^18 || ^19\"\n    },\n    \"peerDependenciesMeta\": {\n        \"react-dom\": {\n            \"optional\": true\n        },\n        \"react-native\": {\n            \"optional\": true\n        }\n    },\n    \"devDependencies\": {\n        \"mobx\": \"^6.15.0\",\n        \"mobx-react-lite\": \"^4.1.1\",\n        \"expose-gc\": \"^1.0.0\"\n    },\n    \"keywords\": [\n        \"mobx\",\n        \"mobservable\",\n        \"react-component\",\n        \"react\",\n        \"reactjs\",\n        \"reactive\"\n    ],\n    \"scripts\": {\n        \"lint\": \"eslint src/**/* --ext .js,.ts,.tsx\",\n        \"build\": \"node ../../scripts/build.js mobxReact\",\n        \"build:test\": \"yarn build --target test\",\n        \"test\": \"jest\",\n        \"test:size\": \"yarn import-size --report . observer\",\n        \"test:types\": \"tsc --noEmit\",\n        \"test:check\": \"yarn test:types\",\n        \"prepublishOnly\": \"yarn build --target publish\"\n    }\n}\n"
  },
  {
    "path": "packages/mobx-react/src/Provider.tsx",
    "content": "import React from \"react\"\nimport { shallowEqual } from \"./utils/utils\"\nimport { IValueMap } from \"./types/IValueMap\"\n\nexport const MobXProviderContext = React.createContext<IValueMap>({})\n\nexport interface ProviderProps extends IValueMap {\n    children: React.ReactNode\n}\n\nexport function Provider(props: ProviderProps) {\n    const { children, ...stores } = props\n    const parentValue = React.useContext(MobXProviderContext)\n    const mutableProviderRef = React.useRef({ ...parentValue, ...stores })\n    const value = mutableProviderRef.current\n\n    if (__DEV__) {\n        const newValue = { ...value, ...stores } // spread in previous state for the context based stores\n        if (!shallowEqual(value, newValue)) {\n            throw new Error(\n                \"MobX Provider: The set of provided stores has changed. See: https://github.com/mobxjs/mobx-react#the-set-of-provided-stores-has-changed-error.\"\n            )\n        }\n    }\n\n    return <MobXProviderContext.Provider value={value}>{children}</MobXProviderContext.Provider>\n}\n\nProvider.displayName = \"MobXProvider\"\n"
  },
  {
    "path": "packages/mobx-react/src/disposeOnUnmount.ts",
    "content": "import React from \"react\"\nimport { patch } from \"./utils/utils\"\n\nconst reactMajorVersion = Number.parseInt(React.version.split(\".\")[0])\nlet warnedAboutDisposeOnUnmountDeprecated = false\n\ntype Disposer = () => void\n\nconst protoStoreKey = Symbol(\"disposeOnUnmountProto\")\nconst instStoreKey = Symbol(\"disposeOnUnmountInst\")\n\nfunction runDisposersOnWillUnmount() {\n    ;[...(this[protoStoreKey] || []), ...(this[instStoreKey] || [])].forEach(propKeyOrFunction => {\n        const prop =\n            typeof propKeyOrFunction === \"string\" ? this[propKeyOrFunction] : propKeyOrFunction\n        if (prop !== undefined && prop !== null) {\n            if (Array.isArray(prop)) prop.map(f => f())\n            else prop()\n        }\n    })\n}\n\n/**\n * @deprecated `disposeOnUnmount` is not compatible with React 18 and higher.\n */\nexport function disposeOnUnmount(target: React.Component<any, any>, propertyKey: PropertyKey): void\n\n/**\n * @deprecated `disposeOnUnmount` is not compatible with React 18 and higher.\n */\nexport function disposeOnUnmount<TF extends Disposer | Array<Disposer>>(\n    target: React.Component<any, any>,\n    fn: TF\n): TF\n\n/**\n * @deprecated `disposeOnUnmount` is not compatible with React 18 and higher.\n */\nexport function disposeOnUnmount(\n    target: React.Component<any, any>,\n    propertyKeyOrFunction: PropertyKey | Disposer | Array<Disposer>\n): PropertyKey | Disposer | Array<Disposer> | void {\n    if (Array.isArray(propertyKeyOrFunction)) {\n        return propertyKeyOrFunction.map(fn => disposeOnUnmount(target, fn))\n    }\n\n    if (!warnedAboutDisposeOnUnmountDeprecated) {\n        if (reactMajorVersion >= 18) {\n            console.error(\n                \"[mobx-react] disposeOnUnmount is not compatible with React 18 and higher. Don't use it.\"\n            )\n        } else {\n            console.warn(\n                \"[mobx-react] disposeOnUnmount is deprecated. It won't work correctly with React 18 and higher.\"\n            )\n        }\n        warnedAboutDisposeOnUnmountDeprecated = true\n    }\n\n    const c = Object.getPrototypeOf(target).constructor\n    const c2 = Object.getPrototypeOf(target.constructor)\n    // Special case for react-hot-loader\n    const c3 = Object.getPrototypeOf(Object.getPrototypeOf(target))\n    if (\n        !(\n            c === React.Component ||\n            c === React.PureComponent ||\n            c2 === React.Component ||\n            c2 === React.PureComponent ||\n            c3 === React.Component ||\n            c3 === React.PureComponent\n        )\n    ) {\n        throw new Error(\n            \"[mobx-react] disposeOnUnmount only supports direct subclasses of React.Component or React.PureComponent.\"\n        )\n    }\n\n    if (\n        typeof propertyKeyOrFunction !== \"string\" &&\n        typeof propertyKeyOrFunction !== \"function\" &&\n        !Array.isArray(propertyKeyOrFunction)\n    ) {\n        throw new Error(\n            \"[mobx-react] disposeOnUnmount only works if the parameter is either a property key or a function.\"\n        )\n    }\n\n    // decorator's target is the prototype, so it doesn't have any instance properties like props\n    const isDecorator = typeof propertyKeyOrFunction === \"string\"\n\n    // add property key / function we want run (disposed) to the store\n    const componentWasAlreadyModified = !!target[protoStoreKey] || !!target[instStoreKey]\n    const store = isDecorator\n        ? // decorators are added to the prototype store\n          target[protoStoreKey] || (target[protoStoreKey] = [])\n        : // functions are added to the instance store\n          target[instStoreKey] || (target[instStoreKey] = [])\n\n    store.push(propertyKeyOrFunction)\n\n    // tweak the component class componentWillUnmount if not done already\n    if (!componentWasAlreadyModified) {\n        patch(target, \"componentWillUnmount\", runDisposersOnWillUnmount)\n    }\n\n    // return the disposer as is if invoked as a non decorator\n    if (typeof propertyKeyOrFunction !== \"string\") {\n        return propertyKeyOrFunction\n    }\n}\n"
  },
  {
    "path": "packages/mobx-react/src/globals.d.ts",
    "content": "declare const __DEV__: boolean\n"
  },
  {
    "path": "packages/mobx-react/src/index.ts",
    "content": "import { observable } from \"mobx\"\nimport { Component } from \"react\"\n\nif (!Component) {\n    throw new Error(\"mobx-react requires React to be available\")\n}\n\nif (!observable) {\n    throw new Error(\"mobx-react requires mobx to be available\")\n}\n\nexport {\n    Observer,\n    useObserver,\n    useAsObservableSource,\n    useLocalStore,\n    isUsingStaticRendering,\n    useStaticRendering,\n    enableStaticRendering,\n    observerBatching,\n    useLocalObservable\n} from \"mobx-react-lite\"\n\nexport { observer } from \"./observer\"\n\nexport { MobXProviderContext, Provider, ProviderProps } from \"./Provider\"\nexport { inject } from \"./inject\"\nexport { disposeOnUnmount } from \"./disposeOnUnmount\"\nexport { PropTypes } from \"./propTypes\"\nexport { IWrappedComponent } from \"./types/IWrappedComponent\"\n"
  },
  {
    "path": "packages/mobx-react/src/inject.ts",
    "content": "import React from \"react\"\nimport { observer } from \"./observer\"\nimport { copyStaticProperties } from \"./utils/utils\"\nimport { MobXProviderContext } from \"./Provider\"\nimport { IReactComponent } from \"./types/IReactComponent\"\nimport { IValueMap } from \"./types/IValueMap\"\nimport { IWrappedComponent } from \"./types/IWrappedComponent\"\nimport { IStoresToProps } from \"./types/IStoresToProps\"\n\n/**\n * Store Injection\n */\nfunction createStoreInjector(\n    grabStoresFn: IStoresToProps,\n    component: IReactComponent<any>,\n    injectNames: string,\n    makeReactive: boolean\n): IReactComponent<any> {\n    // Support forward refs\n    let Injector: IReactComponent<any> = React.forwardRef((props, ref) => {\n        const newProps = { ...props }\n        const context = React.useContext(MobXProviderContext)\n        Object.assign(newProps, grabStoresFn(context || {}, newProps) || {})\n\n        if (ref) {\n            newProps.ref = ref\n        }\n\n        return React.createElement(component, newProps)\n    })\n\n    if (makeReactive) Injector = observer(Injector)\n    Injector[\"isMobxInjector\"] = true // assigned late to suppress observer warning\n\n    // Static fields from component should be visible on the generated Injector\n    copyStaticProperties(component, Injector)\n    Injector[\"wrappedComponent\"] = component\n    Injector.displayName = getInjectName(component, injectNames)\n    return Injector\n}\n\nfunction getInjectName(component: IReactComponent<any>, injectNames: string): string {\n    let displayName\n    const componentName =\n        component.displayName ||\n        component.name ||\n        (component.constructor && component.constructor.name) ||\n        \"Component\"\n    if (injectNames) displayName = \"inject-with-\" + injectNames + \"(\" + componentName + \")\"\n    else displayName = \"inject(\" + componentName + \")\"\n    return displayName\n}\n\nfunction grabStoresByName(\n    storeNames: Array<string>\n): (\n    baseStores: IValueMap,\n    nextProps: React.ClassAttributes<any>\n) => React.PropsWithRef<any> | undefined {\n    return function (baseStores, nextProps) {\n        storeNames.forEach(function (storeName) {\n            if (\n                storeName in nextProps // prefer props over stores\n            )\n                return\n            if (!(storeName in baseStores))\n                throw new Error(\n                    \"MobX injector: Store '\" +\n                        storeName +\n                        \"' is not available! Make sure it is provided by some Provider\"\n                )\n            nextProps[storeName] = baseStores[storeName]\n        })\n        return nextProps\n    }\n}\n\nexport function inject(\n    ...stores: Array<string>\n): <T extends IReactComponent<any>>(\n    target: T\n) => T & (T extends IReactComponent<infer P> ? IWrappedComponent<P> : never)\nexport function inject<S extends IValueMap = {}, P extends IValueMap = {}, I extends IValueMap = {}, C extends IValueMap = {}>(\n    fn: IStoresToProps<S, P, I, C>\n): <T extends IReactComponent>(target: T) => T & IWrappedComponent<P>\n\n/**\n * higher order component that injects stores to a child.\n * takes either a varargs list of strings, which are stores read from the context,\n * or a function that manually maps the available stores from the context to props:\n * storesToProps(mobxStores, props, context) => newProps\n */\nexport function inject(/* fn(stores, nextProps) or ...storeNames */ ...storeNames: Array<any>) {\n    if (typeof arguments[0] === \"function\") {\n        let grabStoresFn = arguments[0]\n        return (componentClass: React.ComponentClass<any, any>) =>\n            createStoreInjector(grabStoresFn, componentClass, grabStoresFn.name, true)\n    } else {\n        return (componentClass: React.ComponentClass<any, any>) =>\n            createStoreInjector(\n                grabStoresByName(storeNames),\n                componentClass,\n                storeNames.join(\"-\"),\n                false\n            )\n    }\n}\n"
  },
  {
    "path": "packages/mobx-react/src/observer.tsx",
    "content": "import * as React from \"react\"\nimport { observer as observerLite } from \"mobx-react-lite\"\n\nimport { makeClassComponentObserver } from \"./observerClass\"\nimport { IReactComponent } from \"./types/IReactComponent\"\n\n/**\n * Observer function / decorator\n */\nexport function observer<T extends IReactComponent>(component: T, context: ClassDecoratorContext): void\nexport function observer<T extends IReactComponent>(component: T): T\nexport function observer<T extends IReactComponent>(component: T, context?: ClassDecoratorContext): T {\n    if (context && context.kind !== \"class\") {\n        throw new Error(\"The @observer decorator can be used on classes only\")\n    }\n    if (component[\"isMobxInjector\"] === true) {\n        console.warn(\n            \"Mobx observer: You are trying to use `observer` on a component that already has `inject`. Please apply `observer` before applying `inject`\"\n        )\n    }\n\n    if (\n        Object.prototype.isPrototypeOf.call(React.Component, component) ||\n        Object.prototype.isPrototypeOf.call(React.PureComponent, component)\n    ) {\n        // Class component\n        return makeClassComponentObserver(component as React.ComponentClass<any, any>) as T\n    } else {\n        // Function component\n        return observerLite(component as React.FunctionComponent<any>) as T\n    }\n}\n"
  },
  {
    "path": "packages/mobx-react/src/observerClass.ts",
    "content": "import { PureComponent, Component, ComponentClass, ClassAttributes } from \"react\"\nimport {\n    _allowStateChanges,\n    Reaction,\n    _allowStateReadsStart,\n    _allowStateReadsEnd,\n    _getGlobalState\n} from \"mobx\"\nimport {\n    isUsingStaticRendering,\n    _observerFinalizationRegistry as observerFinalizationRegistry\n} from \"mobx-react-lite\"\nimport { shallowEqual, patch } from \"./utils/utils\"\n\nconst administrationSymbol = Symbol(\"ObserverAdministration\")\nconst isMobXReactObserverSymbol = Symbol(\"isMobXReactObserver\")\n\nlet observablePropDescriptors: PropertyDescriptorMap\nif (__DEV__) {\n    observablePropDescriptors = {\n        props: createObservablePropDescriptor(\"props\"),\n        state: createObservablePropDescriptor(\"state\"),\n        context: createObservablePropDescriptor(\"context\")\n    }\n}\n\ntype ObserverAdministration = {\n    reaction: Reaction | null // also serves as disposed flag\n    forceUpdate: Function | null\n    mounted: boolean // we could use forceUpdate as mounted flag\n    reactionInvalidatedBeforeMount: boolean\n    name: string\n    // Used only on __DEV__\n    props: any\n    state: any\n    context: any\n}\n\nfunction getAdministration(component: Component): ObserverAdministration {\n    // We create administration lazily, because we can't patch constructor\n    // and the exact moment of initialization partially depends on React internals.\n    // At the time of writing this, the first thing invoked is one of the observable getter/setter (state/props/context).\n    return (component[administrationSymbol] ??= {\n        reaction: null,\n        mounted: false,\n        reactionInvalidatedBeforeMount: false,\n        forceUpdate: null,\n        name: getDisplayName(component.constructor as ComponentClass),\n        state: undefined,\n        props: undefined,\n        context: undefined\n    })\n}\n\nexport function makeClassComponentObserver(\n    componentClass: ComponentClass<any, any>\n): ComponentClass<any, any> {\n    const { prototype } = componentClass\n\n    if (componentClass[isMobXReactObserverSymbol]) {\n        const displayName = getDisplayName(componentClass)\n        throw new Error(\n            `The provided component class (${displayName}) has already been declared as an observer component.`\n        )\n    } else {\n        componentClass[isMobXReactObserverSymbol] = true\n    }\n\n    if (prototype.componentWillReact) {\n        throw new Error(\"The componentWillReact life-cycle event is no longer supported\")\n    }\n    if (componentClass[\"__proto__\"] !== PureComponent) {\n        if (!prototype.shouldComponentUpdate) {\n            prototype.shouldComponentUpdate = observerSCU\n        } else if (prototype.shouldComponentUpdate !== observerSCU) {\n            // n.b. unequal check, instead of existence check, as @observer might be on superclass as well\n            throw new Error(\n                \"It is not allowed to use shouldComponentUpdate in observer based components.\"\n            )\n        }\n    }\n\n    if (__DEV__) {\n        Object.defineProperties(prototype, observablePropDescriptors)\n    }\n\n    const originalRender = prototype.render\n    if (typeof originalRender !== \"function\") {\n        const displayName = getDisplayName(componentClass)\n        throw new Error(\n            `[mobx-react] class component (${displayName}) is missing \\`render\\` method.` +\n                `\\n\\`observer\\` requires \\`render\\` being a function defined on prototype.` +\n                `\\n\\`render = () => {}\\` or \\`render = function() {}\\` is not supported.`\n        )\n    }\n\n    prototype.render = function () {\n        Object.defineProperty(this, \"render\", {\n            // There is no safe way to replace render, therefore it's forbidden.\n            configurable: false,\n            writable: false,\n            value: isUsingStaticRendering()\n                ? originalRender\n                : createReactiveRender.call(this, originalRender)\n        })\n        return this.render()\n    }\n\n    const originalComponentDidMount = prototype.componentDidMount\n    prototype.componentDidMount = function () {\n        if (__DEV__ && this.componentDidMount !== Object.getPrototypeOf(this).componentDidMount) {\n            const displayName = getDisplayName(componentClass)\n            throw new Error(\n                `[mobx-react] \\`observer(${displayName}).componentDidMount\\` must be defined on prototype.` +\n                    `\\n\\`componentDidMount = () => {}\\` or \\`componentDidMount = function() {}\\` is not supported.`\n            )\n        }\n\n        // `componentDidMount` may not be called at all. React can abandon the instance after `render`.\n        // That's why we use finalization registry to dispose reaction created during render.\n        // Happens with `<Suspend>` see #3492\n        //\n        // `componentDidMount` can be called immediately after `componentWillUnmount` without calling `render` in between.\n        // Happens with `<StrictMode>`see #3395.\n        //\n        // If `componentDidMount` is called, it's guaranteed to run synchronously with render (similary to `useLayoutEffect`).\n        // Therefore we don't have to worry about external (observable) state being updated before mount (no state version checking).\n        //\n        // Things may change: \"In the future, React will provide a feature that lets components preserve state between unmounts\"\n\n        const admin = getAdministration(this)\n\n        admin.mounted = true\n\n        // Component instance committed, prevent reaction disposal.\n        observerFinalizationRegistry.unregister(this)\n\n        // We don't set forceUpdate before mount because it requires a reference to `this`,\n        // therefore `this` could NOT be garbage collected before mount,\n        // preventing reaction disposal by FinalizationRegistry and leading to memory leak.\n        // As an alternative we could have `admin.instanceRef = new WeakRef(this)`, but lets avoid it if possible.\n        admin.forceUpdate = () => this.forceUpdate()\n\n        if (!admin.reaction || admin.reactionInvalidatedBeforeMount) {\n            // Missing reaction:\n            // 1. Instance was unmounted (reaction disposed) and immediately remounted without running render #3395.\n            // 2. Reaction was disposed by finalization registry before mount. Shouldn't ever happen for class components:\n            // `componentDidMount` runs synchronously after render, but our registry are deferred (can't run in between).\n            // In any case we lost subscriptions to observables, so we have to create new reaction and re-render to resubscribe.\n            // The reaction will be created lazily by following render.\n\n            // Reaction invalidated before mount:\n            // 1. A descendant's `componenDidMount` invalidated it's parent #3730\n\n            admin.forceUpdate()\n        }\n        return originalComponentDidMount?.apply(this, arguments)\n    }\n\n    // TODO@major Overly complicated \"patch\" is only needed to support the deprecated @disposeOnUnmount\n    patch(prototype, \"componentWillUnmount\", function () {\n        if (isUsingStaticRendering()) {\n            return\n        }\n        const admin = getAdministration(this)\n        admin.reaction?.dispose()\n        admin.reaction = null\n        admin.forceUpdate = null\n        admin.mounted = false\n        admin.reactionInvalidatedBeforeMount = false\n    })\n\n    return componentClass\n}\n\n// Generates a friendly name for debugging\nfunction getDisplayName(componentClass: ComponentClass) {\n    return componentClass.displayName || componentClass.name || \"<component>\"\n}\n\nfunction createReactiveRender(originalRender: any) {\n    const boundOriginalRender = originalRender.bind(this)\n\n    const admin = getAdministration(this)\n\n    function reactiveRender() {\n        if (!admin.reaction) {\n            // Create reaction lazily to support re-mounting #3395\n            admin.reaction = createReaction(admin)\n            if (!admin.mounted) {\n                // React can abandon this instance and never call `componentDidMount`/`componentWillUnmount`,\n                // we have to make sure reaction will be disposed.\n                observerFinalizationRegistry.register(this, admin, this)\n            }\n        }\n\n        let error: unknown = undefined\n        let renderResult = undefined\n        admin.reaction.track(() => {\n            try {\n                // TODO@major\n                // Optimization: replace with _allowStateChangesStart/End (not available in mobx@6.0.0)\n                renderResult = _allowStateChanges(false, boundOriginalRender)\n            } catch (e) {\n                error = e\n            }\n        })\n        if (error) {\n            throw error\n        }\n        return renderResult\n    }\n\n    return reactiveRender\n}\n\nfunction createReaction(admin: ObserverAdministration) {\n    return new Reaction(`${admin.name}.render()`, () => {\n        if (!admin.mounted) {\n            // This is neccessary to avoid react warning about calling forceUpdate on component that isn't mounted yet.\n            // This happens when component is abandoned after render - our reaction is already created and reacts to changes.\n            // `componenDidMount` runs synchronously after `render`, so unlike functional component, there is no delay during which the reaction could be invalidated.\n            // However `componentDidMount` runs AFTER it's descendants' `componentDidMount`, which CAN invalidate the reaction, see #3730. Therefore remember and forceUpdate on mount.\n            admin.reactionInvalidatedBeforeMount = true\n            return\n        }\n\n        try {\n            admin.forceUpdate?.()\n        } catch (error) {\n            admin.reaction?.dispose()\n            admin.reaction = null\n        }\n    })\n}\n\nfunction observerSCU(nextProps: ClassAttributes<any>, nextState: any): boolean {\n    if (isUsingStaticRendering()) {\n        console.warn(\n            \"[mobx-react] It seems that a re-rendering of a React component is triggered while in static (server-side) mode. Please make sure components are rendered only once server-side.\"\n        )\n    }\n    // update on any state changes (as is the default)\n    if (this.state !== nextState) {\n        return true\n    }\n    // update if props are shallowly not equal, inspired by PureRenderMixin\n    // we could return just 'false' here, and avoid the `skipRender` checks etc\n    // however, it is nicer if lifecycle events are triggered like usually,\n    // so we return true here if props are shallowly modified.\n    return !shallowEqual(this.props, nextProps)\n}\n\nfunction createObservablePropDescriptor(key: \"props\" | \"state\" | \"context\") {\n    return {\n        configurable: true,\n        enumerable: true,\n        get() {\n            const admin = getAdministration(this)\n            const derivation = _getGlobalState().trackingDerivation\n            if (derivation && derivation !== admin.reaction) {\n                throw new Error(\n                    `[mobx-react] Cannot read \"${admin.name}.${key}\" in a reactive context, as it isn't observable.\n                    Please use component lifecycle method to copy the value into a local observable first.\n                    See https://github.com/mobxjs/mobx/blob/main/packages/mobx-react/README.md#note-on-using-props-and-state-in-derivations`\n                )\n            }\n            return admin[key]\n        },\n        set(value) {\n            getAdministration(this)[key] = value\n        }\n    }\n}\n"
  },
  {
    "path": "packages/mobx-react/src/propTypes.ts",
    "content": "import { isObservableArray, isObservableObject, isObservableMap, untracked } from \"mobx\"\n\n// Copied from React.PropTypes\nfunction createChainableTypeChecker(validator: React.Validator<any>): React.Requireable<any> {\n    function checkType(\n        isRequired: boolean,\n        props: any,\n        propName: string,\n        componentName: string,\n        location: string,\n        propFullName: string,\n        ...rest: any[]\n    ) {\n        return untracked(() => {\n            componentName = componentName || \"<<anonymous>>\"\n            propFullName = propFullName || propName\n            if (props[propName] == null) {\n                if (isRequired) {\n                    const actual = props[propName] === null ? \"null\" : \"undefined\"\n                    return new Error(\n                        \"The \" +\n                            location +\n                            \" `\" +\n                            propFullName +\n                            \"` is marked as required \" +\n                            \"in `\" +\n                            componentName +\n                            \"`, but its value is `\" +\n                            actual +\n                            \"`.\"\n                    )\n                }\n                return null\n            } else {\n                // @ts-ignore rest arg is necessary for some React internals - fails tests otherwise\n                return validator(props, propName, componentName, location, propFullName, ...rest)\n            }\n        })\n    }\n\n    const chainedCheckType: any = checkType.bind(null, false)\n    // Add isRequired to satisfy Requirable\n    chainedCheckType.isRequired = checkType.bind(null, true)\n    return chainedCheckType\n}\n\n// Copied from React.PropTypes\nfunction isSymbol(propType: any, propValue: any): boolean {\n    // Native Symbol.\n    if (propType === \"symbol\") {\n        return true\n    }\n\n    // 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol'\n    if (propValue[\"@@toStringTag\"] === \"Symbol\") {\n        return true\n    }\n\n    // Fallback for non-spec compliant Symbols which are polyfilled.\n    if (typeof Symbol === \"function\" && propValue instanceof Symbol) {\n        return true\n    }\n\n    return false\n}\n\n// Copied from React.PropTypes\nfunction getPropType(propValue: any): string {\n    const propType = typeof propValue\n    if (Array.isArray(propValue)) {\n        return \"array\"\n    }\n    if (propValue instanceof RegExp) {\n        // Old webkits (at least until Android 4.0) return 'function' rather than\n        // 'object' for typeof a RegExp. We'll normalize this here so that /bla/\n        // passes PropTypes.object.\n        return \"object\"\n    }\n    if (isSymbol(propType, propValue)) {\n        return \"symbol\"\n    }\n    return propType\n}\n\n// This handles more types than `getPropType`. Only used for error messages.\n// Copied from React.PropTypes\nfunction getPreciseType(propValue: any): string {\n    const propType = getPropType(propValue)\n    if (propType === \"object\") {\n        if (propValue instanceof Date) {\n            return \"date\"\n        } else if (propValue instanceof RegExp) {\n            return \"regexp\"\n        }\n    }\n    return propType\n}\n\nfunction createObservableTypeCheckerCreator(\n    allowNativeType: any,\n    mobxType: any\n): React.Requireable<any> {\n    return createChainableTypeChecker((props, propName, componentName, location, propFullName) => {\n        return untracked(() => {\n            if (allowNativeType) {\n                if (getPropType(props[propName]) === mobxType.toLowerCase()) return null\n            }\n            let mobxChecker\n            switch (mobxType) {\n                case \"Array\":\n                    mobxChecker = isObservableArray\n                    break\n                case \"Object\":\n                    mobxChecker = isObservableObject\n                    break\n                case \"Map\":\n                    mobxChecker = isObservableMap\n                    break\n                default:\n                    throw new Error(`Unexpected mobxType: ${mobxType}`)\n            }\n            const propValue = props[propName]\n            if (!mobxChecker(propValue)) {\n                const preciseType = getPreciseType(propValue)\n                const nativeTypeExpectationMessage = allowNativeType\n                    ? \" or javascript `\" + mobxType.toLowerCase() + \"`\"\n                    : \"\"\n                return new Error(\n                    \"Invalid prop `\" +\n                        propFullName +\n                        \"` of type `\" +\n                        preciseType +\n                        \"` supplied to\" +\n                        \" `\" +\n                        componentName +\n                        \"`, expected `mobx.Observable\" +\n                        mobxType +\n                        \"`\" +\n                        nativeTypeExpectationMessage +\n                        \".\"\n                )\n            }\n            return null\n        })\n    })\n}\n\nfunction createObservableArrayOfTypeChecker(\n    allowNativeType: boolean,\n    typeChecker: React.Validator<any>\n) {\n    return createChainableTypeChecker(\n        (props, propName, componentName, location, propFullName, ...rest) => {\n            return untracked(() => {\n                if (typeof typeChecker !== \"function\") {\n                    return new Error(\n                        \"Property `\" +\n                            propFullName +\n                            \"` of component `\" +\n                            componentName +\n                            \"` has \" +\n                            \"invalid PropType notation.\"\n                    )\n                } else {\n                    let error = createObservableTypeCheckerCreator(allowNativeType, \"Array\")(\n                        props,\n                        propName,\n                        componentName,\n                        location,\n                        propFullName\n                    )\n\n                    if (error instanceof Error) return error\n                    const propValue = props[propName]\n                    for (let i = 0; i < propValue.length; i++) {\n                        error = (typeChecker as React.Validator<any>)(\n                            propValue,\n                            i as any,\n                            componentName,\n                            location,\n                            propFullName + \"[\" + i + \"]\",\n                            ...rest\n                        )\n                        if (error instanceof Error) return error\n                    }\n\n                    return null\n                }\n            })\n        }\n    )\n}\n\nconst observableArray = createObservableTypeCheckerCreator(false, \"Array\")\nconst observableArrayOf = createObservableArrayOfTypeChecker.bind(null, false)\nconst observableMap = createObservableTypeCheckerCreator(false, \"Map\")\nconst observableObject = createObservableTypeCheckerCreator(false, \"Object\")\nconst arrayOrObservableArray = createObservableTypeCheckerCreator(true, \"Array\")\nconst arrayOrObservableArrayOf = createObservableArrayOfTypeChecker.bind(null, true)\nconst objectOrObservableObject = createObservableTypeCheckerCreator(true, \"Object\")\n\nexport const PropTypes = {\n    observableArray,\n    observableArrayOf,\n    observableMap,\n    observableObject,\n    arrayOrObservableArray,\n    arrayOrObservableArrayOf,\n    objectOrObservableObject\n}\n"
  },
  {
    "path": "packages/mobx-react/src/types/IReactComponent.ts",
    "content": "export type IReactComponent<P = any> =\n    | React.ClassicComponentClass<P>\n    | React.ComponentClass<P>\n    | React.FunctionComponent<P>\n    | React.ForwardRefExoticComponent<P>\n"
  },
  {
    "path": "packages/mobx-react/src/types/IStoresToProps.ts",
    "content": "import { IValueMap } from \"./IValueMap\"\nexport type IStoresToProps<\n    S extends IValueMap = {},\n    P extends IValueMap = {},\n    I extends IValueMap = {},\n    C extends IValueMap = {}\n> = (stores: S, nextProps: P, context?: C) => I\n"
  },
  {
    "path": "packages/mobx-react/src/types/IValueMap.ts",
    "content": "export type IValueMap = Record<string, any>\n"
  },
  {
    "path": "packages/mobx-react/src/types/IWrappedComponent.ts",
    "content": "import { IReactComponent } from \"./IReactComponent\"\nexport type IWrappedComponent<P> = {\n    wrappedComponent: IReactComponent<P>\n}\n"
  },
  {
    "path": "packages/mobx-react/src/utils/utils.ts",
    "content": "export function shallowEqual(objA: any, objB: any): boolean {\n    //From: https://github.com/facebook/fbjs/blob/c69904a511b900266935168223063dd8772dfc40/packages/fbjs/src/core/shallowEqual.js\n    if (is(objA, objB)) {\n        return true\n    }\n    if (typeof objA !== \"object\" || objA === null || typeof objB !== \"object\" || objB === null) {\n        return false\n    }\n    const keysA = Object.keys(objA)\n    const keysB = Object.keys(objB)\n    if (keysA.length !== keysB.length) {\n        return false\n    }\n    for (let i = 0; i < keysA.length; i++) {\n        if (!Object.hasOwnProperty.call(objB, keysA[i]) || !is(objA[keysA[i]], objB[keysA[i]])) {\n            return false\n        }\n    }\n    return true\n}\n\nfunction is(x: any, y: any): boolean {\n    // From: https://github.com/facebook/fbjs/blob/c69904a511b900266935168223063dd8772dfc40/packages/fbjs/src/core/shallowEqual.js\n    if (x === y) {\n        return x !== 0 || 1 / x === 1 / y\n    } else {\n        return x !== x && y !== y\n    }\n}\n\n// based on https://github.com/mridgway/hoist-non-react-statics/blob/master/src/index.js\nconst hoistBlackList = {\n    $$typeof: 1,\n    render: 1,\n    compare: 1,\n    type: 1,\n    childContextTypes: 1,\n    contextType: 1,\n    contextTypes: 1,\n    defaultProps: 1,\n    getDefaultProps: 1,\n    getDerivedStateFromError: 1,\n    getDerivedStateFromProps: 1,\n    mixins: 1,\n    displayName: 1,\n    propTypes: 1\n}\n\nexport function copyStaticProperties(base: object, target: object): void {\n    const protoProps = Object.getOwnPropertyNames(Object.getPrototypeOf(base))\n    Object.getOwnPropertyNames(base).forEach(key => {\n        if (!hoistBlackList[key] && protoProps.indexOf(key) === -1) {\n            Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(base, key)!)\n        }\n    })\n}\n\n/**\n * Helper to set `prop` to `this` as non-enumerable (hidden prop)\n * @param target\n * @param prop\n * @param value\n */\nexport function setHiddenProp(target: object, prop: any, value: any): void {\n    if (!Object.hasOwnProperty.call(target, prop)) {\n        Object.defineProperty(target, prop, {\n            enumerable: false,\n            configurable: true,\n            writable: true,\n            value\n        })\n    } else {\n        target[prop] = value\n    }\n}\n\n/**\n * Utilities for patching componentWillUnmount, to make sure @disposeOnUnmount works correctly icm with user defined hooks\n * and the handler provided by mobx-react\n */\nconst mobxMixins = Symbol(\"patchMixins\")\nconst mobxPatchedDefinition = Symbol(\"patchedDefinition\")\n\nexport interface Mixins extends Record<string, any> {\n    locks: number\n    methods: Array<Function>\n}\n\nfunction getMixins(target: object, methodName: string): Mixins {\n    const mixins = (target[mobxMixins] = target[mobxMixins] || {})\n    const methodMixins = (mixins[methodName] = mixins[methodName] || {})\n    methodMixins.locks = methodMixins.locks || 0\n    methodMixins.methods = methodMixins.methods || []\n    return methodMixins\n}\n\nfunction wrapper(realMethod: Function, mixins: Mixins, ...args: Array<any>) {\n    // locks are used to ensure that mixins are invoked only once per invocation, even on recursive calls\n    mixins.locks++\n\n    try {\n        let retVal\n        if (realMethod !== undefined && realMethod !== null) {\n            retVal = realMethod.apply(this, args)\n        }\n\n        return retVal\n    } finally {\n        mixins.locks--\n        if (mixins.locks === 0) {\n            mixins.methods.forEach(mx => {\n                mx.apply(this, args)\n            })\n        }\n    }\n}\n\nfunction wrapFunction(realMethod: Function, mixins: Mixins): (...args: Array<any>) => any {\n    const fn = function (...args: Array<any>) {\n        wrapper.call(this, realMethod, mixins, ...args)\n    }\n    return fn\n}\n\nexport function patch(target: object, methodName: string, mixinMethod: Function): void {\n    const mixins = getMixins(target, methodName)\n\n    if (mixins.methods.indexOf(mixinMethod) < 0) {\n        mixins.methods.push(mixinMethod)\n    }\n\n    const oldDefinition = Object.getOwnPropertyDescriptor(target, methodName)\n    if (oldDefinition && oldDefinition[mobxPatchedDefinition]) {\n        // already patched definition, do not repatch\n        return\n    }\n\n    const originalMethod = target[methodName]\n    const newDefinition = createDefinition(\n        target,\n        methodName,\n        oldDefinition ? oldDefinition.enumerable : undefined,\n        mixins,\n        originalMethod\n    )\n\n    Object.defineProperty(target, methodName, newDefinition)\n}\n\nfunction createDefinition(\n    target: object,\n    methodName: string,\n    enumerable: any,\n    mixins: Mixins,\n    originalMethod: Function\n): PropertyDescriptor {\n    let wrappedFunc = wrapFunction(originalMethod, mixins)\n\n    return {\n        // @ts-ignore\n        [mobxPatchedDefinition]: true,\n        get: function () {\n            return wrappedFunc\n        },\n        set: function (value) {\n            if (this === target) {\n                wrappedFunc = wrapFunction(value, mixins)\n            } else {\n                // when it is an instance of the prototype/a child prototype patch that particular case again separately\n                // since we need to store separate values depending on wether it is the actual instance, the prototype, etc\n                // e.g. the method for super might not be the same as the method for the prototype which might be not the same\n                // as the method for the instance\n                const newDefinition = createDefinition(this, methodName, enumerable, mixins, value)\n                Object.defineProperty(this, methodName, newDefinition)\n            }\n        },\n        configurable: true,\n        enumerable: enumerable\n    }\n}\n"
  },
  {
    "path": "packages/mobx-react/tsconfig.json",
    "content": "{\n    \"extends\": \"../../tsconfig.json\",\n    \"compilerOptions\": {\n        \"rootDir\": \"src\",\n        \"lib\": [\"es6\", \"DOM\"]\n    },\n    \"include\": [\"src\"]\n}\n"
  },
  {
    "path": "packages/mobx-react/tsconfig.test.json",
    "content": "{\n    \"extends\": \"../../tsconfig.test.json\",\n    \"compilerOptions\": {\n        \"lib\": [\"esnext\", \"dom\"]\n    }\n}\n"
  },
  {
    "path": "packages/mobx-react/tsdx.config.js",
    "content": "module.exports = {\n    rollup(config) {\n        return {\n            ...config,\n            output: {\n                ...config.output,\n                globals: {\n                    react: \"React\",\n                    mobx: \"mobx\",\n                    \"react-dom\": \"ReactDOM\",\n                    \"mobx-react-lite\": \"mobxReactLite\"\n                }\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "packages/mobx-react-lite/.eslintignore",
    "content": "dist/\nlib/\nes/\n"
  },
  {
    "path": "packages/mobx-react-lite/.gitignore",
    "content": "/node_modules/\n\nes/\nlib/\ndist/\ncoverage/\n\n.DS_Store\n\nnpm-debug.log*\nyarn-debug.log*\nyarn-error.log*\n"
  },
  {
    "path": "packages/mobx-react-lite/CHANGELOG.md",
    "content": "# mobx-react-lite\n\n## 4.1.1\n\n### Patch Changes\n\n-   [`2e703388eda4ba3eefed2bf1f5ca3958980978c3`](https://github.com/mobxjs/mobx/commit/2e703388eda4ba3eefed2bf1f5ca3958980978c3) [#4584](https://github.com/mobxjs/mobx/pull/4584) Thanks [@mweststrate](https://github.com/mweststrate)! - Fix type definition of `observer`, when used in combination with a Higher Order Component. By @mbest in #4576\n\n## 4.1.0\n\n### Minor Changes\n\n-   [`2587df31a1a967a6b385b7ab2d9f0d42fc94e4b0`](https://github.com/mobxjs/mobx/commit/2587df31a1a967a6b385b7ab2d9f0d42fc94e4b0) [#3985](https://github.com/mobxjs/mobx/pull/3985) Thanks [@imjordanxd](https://github.com/imjordanxd)! - \\* Added React 19 support, fixes #3986\n\n## 4.0.7\n\n### Patch Changes\n\n-   [`61abc53f`](https://github.com/mobxjs/mobx/commit/61abc53ff10554d1d5ce3e85466f6beda4d63fa2) [#3852](https://github.com/mobxjs/mobx/pull/3852) Thanks [@mweststrate](https://github.com/mweststrate)! - Patched the release process, forcing release to get everything in pristine state.\n\n*   [`7bbb523a`](https://github.com/mobxjs/mobx/commit/7bbb523a7b81229570e0e2a176b989bfc74c4634) [#3842](https://github.com/mobxjs/mobx/pull/3842) Thanks [@r0b1n](https://github.com/r0b1n)! - Prevent warnings when using `mobx-react-lite` with Rollup\n\n## 4.0.6\n\n### Patch Changes\n\n-   [`b970cbb4`](https://github.com/mobxjs/mobx/commit/b970cbb4dd2e43516d37f3f01c956cab3540d4d3) [#3830](https://github.com/mobxjs/mobx/pull/3830) Thanks [@dmitrytavern](https://github.com/dmitrytavern)! - fix #3826: components make two renders because of the different state of the snapshots\n\n*   [`1b8ab199`](https://github.com/mobxjs/mobx/commit/1b8ab199df5e73d384cc40ec2d13915a690c14f3) [#3831](https://github.com/mobxjs/mobx/pull/3831) Thanks [@kitsuned](https://github.com/kitsuned)! - fix: ensure observer component name is only set when configurable\n\n## 4.0.5\n\n### Patch Changes\n\n-   [`87e5dfb5`](https://github.com/mobxjs/mobx/commit/87e5dfb52a84869d62b6343887a1c8659aee595d) [#3763](https://github.com/mobxjs/mobx/pull/3763) Thanks [@mweststrate](https://github.com/mweststrate)! - Switched observer implementation from using global to local state version. Fixes #3728\n\n## 4.0.4\n\n### Patch Changes\n\n-   [`3ceeb865`](https://github.com/mobxjs/mobx/commit/3ceeb8651e328c4c7211c875696b3f5269fea834) [#3732](https://github.com/mobxjs/mobx/pull/3732) Thanks [@urugator](https://github.com/urugator)! - fix: #3734: `isolateGlobalState: true` makes observer stop to react to store changes\n\n## 4.0.3\n\n### Patch Changes\n\n-   [`58bb052c`](https://github.com/mobxjs/mobx/commit/58bb052ca41b8592e5bd5c3003b68ec52da53f33) [#3670](https://github.com/mobxjs/mobx/pull/3670) Thanks [@urugator](https://github.com/urugator)! - fix #3669: SSR: `useSyncExternalStore` throws due to missing `getServerSnapshot`\n\n*   [`473cb3f5`](https://github.com/mobxjs/mobx/commit/473cb3f5fc8bf43abdd1c9c7857fe2820d2291fe) [#3718](https://github.com/mobxjs/mobx/pull/3718) Thanks [@mweststrate](https://github.com/mweststrate)! - - Fixed `observer` in `StrictMode` #3671\n    -   **[BREAKING CHANGE]** Class component's `props`/`state`/`context` are no longer observable. Attempt to use these in any derivation other than component's `render` throws and error. For details see https://github.com/mobxjs/mobx/blob/main/packages/mobx-react/README.md#note-on-using-props-and-state-in-derivations\n    -   Extending or applying `observer` classes is now explicitly forbidden\n\n## 4.0.2\n\n### Patch Changes\n\n-   [`f86df867`](https://github.com/mobxjs/mobx/commit/f86df86784fa92d793ca4d1b97a3dd954355f7dd) [#3667](https://github.com/mobxjs/mobx/pull/3667) Thanks [@tony](https://github.com/tony)! - Fix package dependency for use-sync-external-store.\n\n## 4.0.1\n\n### Patch Changes\n\n-   [`8e58fa95`](https://github.com/mobxjs/mobx/commit/8e58fa958908f632a2c49d22c259fda135781455) [#3664](https://github.com/mobxjs/mobx/pull/3664) Thanks [@mweststrate](https://github.com/mweststrate)! - (Hopefully) fixed release process for mobx-react-lite\n\n## 4.0.0\n\n### Major Changes\n\n-   [`44a2cf42`](https://github.com/mobxjs/mobx/commit/44a2cf42dec7635f639ddbfb19202ebc710bac54) [#3590](https://github.com/mobxjs/mobx/pull/3590) Thanks [@urugator](https://github.com/urugator)! - Components now use `useSyncExternalStore`, which should prevent tearing - you have to update mobx, otherwise it should behave as previously.<br>\n    Improved displayName/name handling as discussed in #3438.<br>\n\n## 3.4.3\n\n### Patch Changes\n\n-   [`dfeb1f5d`](https://github.com/mobxjs/mobx/commit/dfeb1f5d18acb8a995d4fa78374173d419fec16e) [#3651](https://github.com/mobxjs/mobx/pull/3651) Thanks [@urugator](https://github.com/urugator)! - fix #3650 regression clearTimers -> clearTimes\n\n## 3.4.2\n\n### Patch Changes\n\n-   [`7acaf305`](https://github.com/mobxjs/mobx/commit/7acaf305f81ac5457a8de272e42dd5634a97eb88) [#3645](https://github.com/mobxjs/mobx/pull/3645) Thanks [@urugator](https://github.com/urugator)! - fix FinalizationRegistry support check #3643\n\n## 3.4.1\n\n### Patch Changes\n\n-   [`4ef8ff3f`](https://github.com/mobxjs/mobx/commit/4ef8ff3f84ec8ae893d8c84031664ea388d78091) [#3598](https://github.com/mobxjs/mobx/pull/3598) Thanks [@urugator](https://github.com/urugator)! - refactor reaction tracking\n\n## 3.4.0\n\n### Minor Changes\n\n-   [`4c5e75cd`](https://github.com/mobxjs/mobx/commit/4c5e75cdfec08c04ad774c70dca0629bd2c77016) [#3382](https://github.com/mobxjs/mobx/pull/3382) Thanks [@iChenLei](https://github.com/iChenLei)! - replace the deprecated react type definition with recommended type definition\n\n*   [`bd4b70d8`](https://github.com/mobxjs/mobx/commit/bd4b70d8ded29673af8161aa42fb88dc4ad4420e) [#3387](https://github.com/mobxjs/mobx/pull/3387) Thanks [@mweststrate](https://github.com/mweststrate)! - Added experimental / poor man's support for React 18. Fixes #3363, #2526. Supersedes #3005\n\n    -   Updated tests, test / build infra, peerDependencies to React 18\n    -   **[breaking icmw upgrading to React 18]** Already deprecated hooks like `useMutableSource` will trigger warnings in React 18, which is correct and those shouldn't be used anymore.\n    -   **[breaking icmw upgrading to React 18]** When using React 18, it is important that `act` is used in **unit tests** around every programmatic mutation. Without it, changes won't propagate!\n    -   The React 18 support is poor man's support; that is, we don't do anything yet to play nicely with Suspense features. Although e.g. [startTransition](https://github.com/mweststrate/platform-app/commit/bdd995773ddc6551235a4d2b0a4c9bd57d30510e) basically works, MobX as is doesn't respect the Suspense model and will always reflect the latest state that is being rendered with, so tearing might occur. I think this is in theoretically addressable by using `useSyncExternalStore` and capturing the current values together with the dependency tree of every component instance. However that isn't included in this pull request 1) it would be a breaking change, whereas the current change is still compatible with React 16 and 17. 2) I want to collect use cases where the tearing leads to problems first to build a better problem understanding. If you run into the problem, please submit an issue describing your scenario, and a PR with a unit tests demonstrating the problem in simplified form. For further discussion see #2526, #3005\n\n## 3.3.0\n\n### Minor Changes\n\n-   [`59b42c28`](https://github.com/mobxjs/mobx/commit/59b42c2826208435353ce6bf154ae59077edcc05) [#3282](https://github.com/mobxjs/mobx/pull/3282) Thanks [@urugator](https://github.com/urugator)! - support `observable(forwardRef(fn))`, deprecate `observable(fn, { forwardRef: true })`, solve #2527, #3267\n\n## 3.2.3\n\n### Patch Changes\n\n-   [`4887d200`](https://github.com/mobxjs/mobx/commit/4887d200ba5e1563717a0b4f55e09b9984437990) [#3192](https://github.com/mobxjs/mobx/pull/3192) Thanks [@urugator](https://github.com/urugator)! - Support customizing `displayName` on anonymous components [#2721](https://github.com/mobxjs/mobx/issues/2721).\n\n## 3.2.2\n\n### Patch Changes\n\n-   [`2dcfec09`](https://github.com/mobxjs/mobx/commit/2dcfec093533bd12bb564580b14ce6037ee1ebac) [#3172](https://github.com/mobxjs/mobx/pull/3172) Thanks [@urugator](https://github.com/urugator)! - support legacy context\n\n## 3.2.1\n\n### Patch Changes\n\n-   [`320544a5`](https://github.com/mobxjs/mobx/commit/320544a5d0defb1a1524c83c7a5d0a9dee9de001) [#2983](https://github.com/mobxjs/mobx/pull/2983) Thanks [@urugator](https://github.com/urugator)! - Allow force update to be called infinitely times\n\n*   [`10c762cc`](https://github.com/mobxjs/mobx/commit/10c762cce4871f3599bac6acc2c56776e0b4badd) [#2995](https://github.com/mobxjs/mobx/pull/2995) Thanks [@Bnaya](https://github.com/Bnaya)! - Reduce useObserver gc pressure\n\n## 3.2.0\n\n### Patch Changes\n\n-   Updated dependencies [[`28f8a11d`](https://github.com/mobxjs/mobx/commit/28f8a11d8b94f1aca2eec4ae9c5f45c5ea2f4362)]:\n    -   mobx@6.1.0\n\n## 3.1.7\n\n### Patch Changes\n\n-   [`592e6e99`](https://github.com/mobxjs/mobx/commit/592e6e996c2d5264e162cfb0921a071c1d815c92) [#2743](https://github.com/mobxjs/mobx/pull/2743) Thanks [@vkrol](https://github.com/vkrol)! - Remove `sideEffects` section in `mobx-react-lite` `package.json`\n\n-   Updated dependencies [[`6b304232`](https://github.com/mobxjs/mobx/commit/6b30423266e5418a3f20389d0bd0eae31f3384d2), [`83b84fd3`](https://github.com/mobxjs/mobx/commit/83b84fd354f2253fdd8ea556e217a92fc2633c00), [`65c7b73b`](https://github.com/mobxjs/mobx/commit/65c7b73b7f0b1a69a1a2786b5f484419d129d10b), [`989390d4`](https://github.com/mobxjs/mobx/commit/989390d46bbe9941b61ac6c6d1292f96445e7cc3), [`dea1cf18`](https://github.com/mobxjs/mobx/commit/dea1cf189b0f43929f4f626229d34a80bd10212e), [`592e6e99`](https://github.com/mobxjs/mobx/commit/592e6e996c2d5264e162cfb0921a071c1d815c92)]:\n    -   mobx@6.0.5\n\n## 3.1.6\n\n### Patch Changes\n\n-   [`2f3dcb27`](https://github.com/mobxjs/mobx/commit/2f3dcb274f795ffca4ae724b6b4795958620838d) Thanks [@FredyC](https://github.com/FredyC)! - Fix names of UMD exports [#2517](https://github.com/mobxjs/mobx/issues/2617)\n\n-   Updated dependencies [[`79a09f49`](https://github.com/mobxjs/mobx/commit/79a09f49a9f2baddbab8d89e9a7ac07cffadf624)]:\n    -   mobx@6.0.4\n\n## 3.1.5\n\n### Patch Changes\n\n-   [`01a050f7`](https://github.com/mobxjs/mobx/commit/01a050f7603183e6833b7fd948adb4fbe1437f5a) Thanks [@FredyC](https://github.com/FredyC)! - Fix use of react-dom vs react-native\n\n    The `es` folder content is compiled only without transpilation to keep `utils/reactBatchedUpdates` which exists in DOM and RN versions. The bundled `esm` is still kept around too, especially the prod/dev ones that should be utilized in modern browser environments.\n\n## 3.1.4\n\n### Patch Changes\n\n-   [`8bbbc7c0`](https://github.com/mobxjs/mobx/commit/8bbbc7c0df77cd79530add5db2d6a04cfe6d84b1) Thanks [@FredyC](https://github.com/FredyC)! - Fix names of dist files (for real now). Third time is the charm 😅\n\n## 3.1.3\n\n### Patch Changes\n\n-   [`b7aa9d35`](https://github.com/mobxjs/mobx/commit/b7aa9d35432888ee5dd80a6c9dcbc18b04a0346c) Thanks [@FredyC](https://github.com/FredyC)! - Fixed wrong package name for dist files\n\n## 3.1.2\n\n### Patch Changes\n\n-   [`5239db80`](https://github.com/mobxjs/mobx/commit/5239db80cf000026906c28a035725933d4dd6823) Thanks [@FredyC](https://github.com/FredyC)! - Fixed release with missing dist files\n\n## 3.1.1\n\n### Patch Changes\n\n-   [`81a2f865`](https://github.com/mobxjs/mobx/commit/81a2f8654d9656e2e831176e45cbf926fbc364e0) Thanks [@FredyC](https://github.com/FredyC)! - ESM bundles without NODE_ENV present are available in dist folder. This useful for consumption in browser environment that supports ESM Choose either `esm.production.min.js` or `esm.development.js` from `dist` folder.\n\n## 3.1.0\n\n### Minor Changes\n\n-   [`a0e5fea`](https://github.com/mobxjs/mobx-react-lite/commit/a0e5feaeede68b0bac035f60bf2a7edff3fa1269) [#329](https://github.com/mobxjs/mobx-react-lite/pull/329) Thanks [@RoystonS](https://github.com/RoystonS)! - expose `clearTimers` function to tidy up background timers, allowing test frameworks such as Jest to exit immediately\n\n### Patch Changes\n\n-   [`fafb136`](https://github.com/mobxjs/mobx-react-lite/commit/fafb136cce2847b83174cbd15af803442a9a0023) [#332](https://github.com/mobxjs/mobx-react-lite/pull/332) Thanks [@Bnaya](https://github.com/Bnaya)! - Introduce alternative way for managing cleanup of reactions.\n    This is internal change and shouldn't affect functionality of the library.\n\n## 3.0.1\n\n### Patch Changes\n\n-   [`570e8d5`](https://github.com/mobxjs/mobx-react-lite/commit/570e8d594bac415cf9a6c6771080fec043161d0b) [#328](https://github.com/mobxjs/mobx-react-lite/pull/328) Thanks [@mweststrate](https://github.com/mweststrate)! - If observable data changed between mount and useEffect, the render reaction would incorrectly be disposed causing incorrect suspension of upstream computed values\n\n*   [`1d6f0a8`](https://github.com/mobxjs/mobx-react-lite/commit/1d6f0a8dd0ff34d7e7cc71946ed670c31193572d) [#326](https://github.com/mobxjs/mobx-react-lite/pull/326) Thanks [@FredyC](https://github.com/FredyC)! - No important changes, just checking new setup for releases.\n\n> Prior 3.0.0 see GitHub releases for changelog\n"
  },
  {
    "path": "packages/mobx-react-lite/LICENSE",
    "content": "The MIT License (MIT)\n\nCopyright (c) 2015 Michel Weststrate\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": "packages/mobx-react-lite/README.md",
    "content": "# mobx-react-lite\n\n[![CircleCI](https://circleci.com/gh/mobxjs/mobx-react-lite.svg?style=svg)](https://circleci.com/gh/mobxjs/mobx-react-lite)\n[![Coverage Status](https://coveralls.io/repos/github/mobxjs/mobx-react-lite/badge.svg)](https://coveralls.io/github/mobxjs/mobx-react-lite)\n[![NPM downloads](https://img.shields.io/npm/dm/mobx-react-lite.svg?style=flat)](https://npmjs.com/package/mobx-react-lite)[![Minzipped size](https://img.shields.io/bundlephobia/minzip/mobx-react-lite.svg)](https://bundlephobia.com/result?p=mobx-react-lite)\n[![Discuss on Github](https://img.shields.io/badge/discuss%20on-GitHub-orange)](https://github.com/mobxjs/mobx/discussions)\n[![View changelog](https://img.shields.io/badge/changelogs.xyz-Explore%20Changelog-brightgreen)](https://changelogs.xyz/mobx-react-lite)\n\nThis is a lighter version of [mobx-react](https://github.com/mobxjs/mobx-react) which supports React **functional components only** and as such makes the library slightly faster and smaller (_only 1.5kB gzipped_). Note however that it is possible to use `<Observer>` inside the render of class components.\nUnlike `mobx-react`, it doesn't `Provider`/`inject`, as `useContext` can be used instead.\n\n## Compatibility table (major versions)\n\n| mobx | mobx-react-lite | Browser                                        |\n| ---- | --------------- | ---------------------------------------------- |\n| 6    | 3               | Modern browsers (IE 11+ in compatibility mode) |\n| 5    | 2               | Modern browsers                                |\n| 4    | 2               | IE 11+, RN w/o Proxy support                   |\n\n`mobx-react-lite` requires React 16.8 or higher.\n\n## User Guide 👉 https://mobx.js.org/react-integration.html\n\n---\n\n## API reference ⚒\n\n### **`observer<P>(baseComponent: FunctionComponent<P>): FunctionComponent<P>`**\n\nThe observer converts a component into a reactive component, which tracks which observables are used automatically and re-renders the component when one of these values changes.\nCan only be used for function components. For class component support see the `mobx-react` package.\n\n### **`<Observer>{renderFn}</Observer>`**\n\nIs a React component, which applies observer to an anonymous region in your component. `<Observer>` can be used both inside class and function components.\n\n### **`useLocalObservable<T>(initializer: () => T, annotations?: AnnotationsMap<T>): T`**\n\nCreates an observable object with the given properties, methods and computed values.\n\nNote that computed values cannot directly depend on non-observable values, but only on observable values, so it might be needed to sync properties into the observable using `useEffect` (see the example below at `useAsObservableSource`).\n\n`useLocalObservable` is a short-hand for:\n\n`const [state] = useState(() => observable(initializer(), annotations, { autoBind: true }))`\n\n### **`enableStaticRendering(enable: true)`**\n\nCall `enableStaticRendering(true)` when running in an SSR environment, in which `observer` wrapped components should never re-render, but cleanup after the first rendering automatically. Use `isUsingStaticRendering()` to inspect the current setting.\n\n---\n\n## Deprecated APIs\n\n### **`useObserver<T>(fn: () => T, baseComponentName = \"observed\", options?: IUseObserverOptions): T`** (deprecated)\n\n_This API is deprecated in 3.\\*. It is often used wrong (e.g. to select data rather than for rendering, and `<Observer>` better decouples the rendering from the component updates_\n\n```ts\ninterface IUseObserverOptions {\n    // optional custom hook that should make a component re-render (or not) upon changes\n    // Supported in 2.x only\n    useForceUpdate: () => () => void\n}\n```\n\nIt allows you to use an observer like behaviour, but still allowing you to optimize the component in any way you want (e.g. using memo with a custom areEqual, using forwardRef, etc.) and to declare exactly the part that is observed (the render phase).\n\n### **`useLocalStore<T, S>(initializer: () => T, source?: S): T`** (deprecated)\n\n_This API is deprecated in 3.\\*. Use `useLocalObservable` instead. They do roughly the same, but `useLocalObservable` accepts an set of annotations as second argument, rather than a `source` object. Using `source` is not recommended, see the deprecation message at `useAsObservableSource` for details_\n\nLocal observable state can be introduced by using the useLocalStore hook, that runs its initializer function once to create an observable store and keeps it around for a lifetime of a component.\n\nThe annotations are similar to the annotations that are passed in to MobX's [`observable`](https://mobx.js.org/observable.html#available-annotations) API, and can be used to override the automatic member inference of specific fields.\n\n### **`useAsObservableSource<T>(source: T): T`** (deprecated)\n\nThe useAsObservableSource hook can be used to turn any set of values into an observable object that has a stable reference (the same object is returned every time from the hook).\n\n_This API is deprecated in 3.\\* as it relies on observables to be updated during rendering which is an anti-pattern. Instead, use `useEffect` to synchronize non-observable values with values. Example:_\n\n```javascript\n// Before:\nfunction Measurement({ unit }) {\n    const observableProps = useAsObservableSource({ unit })\n    const state = useLocalStore(() => ({\n        length: 0,\n        get lengthWithUnit() {\n            // lengthWithUnit can only depend on observables, hence the above conversion with `useAsObservableSource`\n            return observableProps.unit === \"inch\"\n                ? `${this.length / 2.54} inch`\n                : `${this.length} cm`\n        }\n    }))\n\n    return <h1>{state.lengthWithUnit}</h1>\n}\n\n// After:\nfunction Measurement({ unit }) {\n    const state = useLocalObservable(() => ({\n        unit, // the initial unit\n        length: 0,\n        get lengthWithUnit() {\n            // lengthWithUnit can only depend on observables, hence the above conversion with `useAsObservableSource`\n            return this.unit === \"inch\" ? `${this.length / 2.54} inch` : `${this.length} cm`\n        }\n    }))\n\n    useEffect(() => {\n        // sync the unit from 'props' into the observable 'state'\n        state.unit = unit\n    }, [unit])\n\n    return <h1>{state.lengthWithUnit}</h1>\n}\n```\n\nNote that, at your own risk, it is also possible to not use `useEffect`, but do `state.unit = unit` instead in the rendering.\nThis is closer to the old behavior, but React will warn correctly about this if this would affect the rendering of other components.\n\n## Observer batching (deprecated)\n\n_Note: configuring observer batching is only needed when using `mobx-react-lite` 2.0.* or 2.1.*. From 2.2 onward it will be configured automatically based on the availability of react-dom / react-native packages_\n\n[Check out the elaborate explanation](https://github.com/mobxjs/mobx-react/pull/787#issuecomment-573599793).\n\nIn short without observer batching the React doesn't guarantee the order component rendering in some cases. We highly recommend that you configure batching to avoid these random surprises.\n\nImport one of these before any React rendering is happening, typically `index.js/ts`. For Jest tests you can utilize [setupFilesAfterEnv](https://jestjs.io/docs/en/configuration#setupfilesafterenv-array).\n\n**React DOM:**\n\n> import 'mobx-react-lite/batchingForReactDom'\n\n**React Native:**\n\n> import 'mobx-react-lite/batchingForReactNative'\n\n### Opt-out\n\nTo opt-out from batching in some specific cases, simply import the following to silence the warning.\n\n> import 'mobx-react-lite/batchingOptOut'\n\n### Custom batched updates\n\nAbove imports are for a convenience to utilize standard versions of batching. If you for some reason have customized version of batched updates, you can do the following instead.\n\n```js\nimport { observerBatching } from \"mobx-react-lite\"\nobserverBatching(customBatchedUpdates)\n```\n\n## Testing\n\nRunning the full test suite now requires node 14+\nBut the library itself does not have this limitation\n\nIn order to avoid memory leaks due to aborted renders from React\nfiber handling or React `StrictMode`, on environments that does not support [FinalizationRegistry](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/FinalizationRegistry), this library needs to\nrun timers to tidy up the remains of the aborted renders.\n\nThis can cause issues with test frameworks such as Jest\nwhich require that timers be cleaned up before the tests\ncan exit.\n\n### **`clearTimers()`**\n\nCall `clearTimers()` in the `afterEach` of your tests to ensure\nthat `mobx-react-lite` cleans up immediately and allows tests\nto exit.\n"
  },
  {
    "path": "packages/mobx-react-lite/__tests__/.eslintrc.yaml",
    "content": "env:\n    jest: true\nrules:\n    \"react/display-name\": \"off\"\n    \"react/prop-types\": \"off\"\n"
  },
  {
    "path": "packages/mobx-react-lite/__tests__/ObserverComponent.test.tsx",
    "content": "import mockConsole from \"jest-mock-console\"\nimport * as mobx from \"mobx\"\nimport * as React from \"react\"\nimport { act, cleanup, render } from \"@testing-library/react\"\n\nimport { Observer } from \"../src\"\n\nafterEach(cleanup)\n\ndescribe(\"regions should rerender component\", () => {\n    const execute = () => {\n        const data = mobx.observable.box(\"hi\")\n        const Comp = () => (\n            <div>\n                <Observer>{() => <span>{data.get()}</span>}</Observer>\n                <li>{data.get()}</li>\n            </div>\n        )\n        return { ...render(<Comp />), data }\n    }\n\n    test(\"init state is correct\", () => {\n        const { container } = execute()\n        expect(container.querySelector(\"span\")!.innerHTML).toBe(\"hi\")\n        expect(container.querySelector(\"li\")!.innerHTML).toBe(\"hi\")\n    })\n\n    test(\"set the data to hello\", async () => {\n        const { container, data } = execute()\n        act(() => {\n            data.set(\"hello\")\n        })\n        expect(container.querySelector(\"span\")!.innerHTML).toBe(\"hello\")\n        expect(container.querySelector(\"li\")!.innerHTML).toBe(\"hi\")\n    })\n})\n\nit(\"renders null if no children/render prop is supplied a function\", () => {\n    const restoreConsole = mockConsole()\n    const Comp = () => <Observer />\n    const { container } = render(<Comp />)\n    expect(container).toMatchInlineSnapshot(`<div />`)\n    restoreConsole()\n})\n\nit.skip(\"prop types checks for children/render usage\", () => {\n    const Comp = () => (\n        <Observer render={() => <span>children</span>}>{() => <span>children</span>}</Observer>\n    )\n    const restoreConsole = mockConsole(\"error\")\n    render(<Comp />)\n    // tslint:disable-next-line:no-console\n    expect(console.error).toHaveBeenCalledWith(\n        expect.stringContaining(\"Do not use children and render in the same time\")\n    )\n    restoreConsole()\n})\n"
  },
  {
    "path": "packages/mobx-react-lite/__tests__/__snapshots__/observer.test.tsx.snap",
    "content": "// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing\n\nexports[`changing state in render should fail 1`] = `\n<div>\n  <div>\n    4\n  </div>\n</div>\n`;\n\nexports[`changing state in render should fail 2`] = `\n<div>\n  <div>\n    4\n  </div>\n</div>\n`;\n\nexports[`issue 12 init state is correct 1`] = `\n<div>\n  <div>\n    <span>\n      coffee\n      !\n    </span>\n    <span>\n      tea\n    </span>\n  </div>\n</div>\n`;\n\nexports[`issue 12 init state is correct 2`] = `\n<div>\n  <div>\n    <span>\n      coffee\n      !\n    </span>\n    <span>\n      tea\n    </span>\n  </div>\n</div>\n`;\n\nexports[`issue 12 run transaction 1`] = `\n<div>\n  <div>\n    <span>\n      soup\n    </span>\n  </div>\n</div>\n`;\n\nexports[`issue 12 run transaction 2`] = `\n<div>\n  <div>\n    <span>\n      soup\n    </span>\n  </div>\n</div>\n`;\n\nexports[`issue 309 isObserverBatched is still defined and yields true by default 1`] = `\n[MockFunction] {\n  \"calls\": [\n    [\n      \"[MobX] Deprecated\",\n    ],\n  ],\n  \"results\": [\n    {\n      \"type\": \"return\",\n      \"value\": undefined,\n    },\n  ],\n}\n`;\n\nexports[`issue 309 isObserverBatched is still defined and yields true by default 2`] = `\n[MockFunction] {\n  \"calls\": [\n    [\n      \"[MobX] Deprecated\",\n    ],\n  ],\n  \"results\": [\n    {\n      \"type\": \"return\",\n      \"value\": undefined,\n    },\n  ],\n}\n`;\n\nexports[`observer(cmp, { forwardRef: true }) + useImperativeHandle 1`] = `\n[MockFunction] {\n  \"calls\": [\n    [\n      \"[mobx-react-lite] \\`observer(fn, { forwardRef: true })\\` is deprecated, use \\`observer(React.forwardRef(fn))\\`\",\n    ],\n  ],\n  \"results\": [\n    {\n      \"type\": \"return\",\n      \"value\": undefined,\n    },\n  ],\n}\n`;\n\nexports[`useImperativeHandle and forwardRef should work with useObserver 1`] = `[MockFunction]`;\n"
  },
  {
    "path": "packages/mobx-react-lite/__tests__/__snapshots__/printDebugValue.test.ts.snap",
    "content": "// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing\n\nexports[`printDebugValue 1`] = `\n{\n  \"dependencies\": [\n    {\n      \"name\": \"ObservableObject@1.euro\",\n    },\n    {\n      \"dependencies\": [\n        {\n          \"name\": \"ObservableObject@1.euro\",\n        },\n      ],\n      \"name\": \"ObservableObject@1.pound\",\n    },\n  ],\n  \"name\": \"Autorun@2\",\n}\n`;\n\nexports[`printDebugValue 2`] = `\n{\n  \"name\": \"Autorun@2\",\n}\n`;\n"
  },
  {
    "path": "packages/mobx-react-lite/__tests__/__snapshots__/useAsObservableSource.deprecated.test.tsx.snap",
    "content": "// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing\n\nexports[`base useAsObservableSource should work with <Observer> 1`] = `\n[MockFunction] {\n  \"calls\": [\n    [\n      \"[mobx-react-lite] 'useAsObservableSource' is deprecated, please store the values directly in an observable, for example by using 'useLocalObservable', and sync future updates using 'useEffect' when needed. See the README for examples.\",\n    ],\n    [\n      \"[mobx-react-lite] 'useLocalStore' is deprecated, use 'useLocalObservable' instead.\",\n    ],\n  ],\n  \"results\": [\n    {\n      \"type\": \"return\",\n      \"value\": undefined,\n    },\n    {\n      \"type\": \"return\",\n      \"value\": undefined,\n    },\n  ],\n}\n`;\n"
  },
  {
    "path": "packages/mobx-react-lite/__tests__/__snapshots__/useLocalStore.deprecated.test.tsx.snap",
    "content": "// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing\n\nexports[`base useLocalStore should work 1`] = `\n[MockFunction] {\n  \"calls\": [\n    [\n      \"[mobx-react-lite] 'useLocalStore' is deprecated, use 'useLocalObservable' instead.\",\n    ],\n  ],\n  \"results\": [\n    {\n      \"type\": \"return\",\n      \"value\": undefined,\n    },\n  ],\n}\n`;\n\nexports[`is used to keep observable within component body with props and useObserver 1`] = `\n[MockFunction] {\n  \"calls\": [\n    [\n      \"[mobx-react-lite] 'useAsObservableSource' is deprecated, please store the values directly in an observable, for example by using 'useLocalObservable', and sync future updates using 'useEffect' when needed. See the README for examples.\",\n    ],\n  ],\n  \"results\": [\n    {\n      \"type\": \"return\",\n      \"value\": undefined,\n    },\n  ],\n}\n`;\n"
  },
  {
    "path": "packages/mobx-react-lite/__tests__/api.test.ts",
    "content": "const api = require(\"../src/index.ts\")\n\ntest(\"correct api should be exposed\", function () {\n    expect(\n        Object.keys(api)\n            .filter(key => api[key] !== undefined)\n            .sort()\n    ).toEqual(\n        [\n            \"isUsingStaticRendering\",\n            \"enableStaticRendering\",\n            \"observer\",\n            \"Observer\",\n            \"useLocalObservable\",\n            \"useLocalStore\",\n            \"useAsObservableSource\",\n            \"clearTimers\",\n            \"useObserver\",\n            \"isObserverBatched\",\n            \"observerBatching\",\n            \"useStaticRendering\",\n            \"_observerFinalizationRegistry\"\n        ].sort()\n    )\n})\n"
  },
  {
    "path": "packages/mobx-react-lite/__tests__/assertEnvironment.test.ts",
    "content": "afterEach(() => {\n    jest.resetModules()\n    jest.resetAllMocks()\n})\n\nit(\"throws if react is not installed\", () => {\n    jest.mock(\"react\", () => ({}))\n    expect(() => require(\"../src/utils/assertEnvironment.ts\")).toThrowErrorMatchingInlineSnapshot(\n        `\"mobx-react-lite requires React with Hooks support\"`\n    )\n})\n\nit(\"throws if mobx is not installed\", () => {\n    jest.mock(\"react\", () => ({ useState: true }))\n    jest.mock(\"mobx\", () => ({}))\n    expect(() => require(\"../src/utils/assertEnvironment.ts\")).toThrowErrorMatchingInlineSnapshot(\n        `\"mobx-react-lite@3 requires mobx at least version 6 to be available\"`\n    )\n})\n\nexport default \"Cannot use import statement outside a module\"\n"
  },
  {
    "path": "packages/mobx-react-lite/__tests__/enforceActions.test.tsx",
    "content": "import * as mobx from \"mobx\"\nimport { _resetGlobalState } from \"mobx\"\nimport * as React from \"react\"\nimport { useEffect } from \"react\"\nimport { observer, useLocalObservable } from \"mobx-react\"\nimport { render } from \"@testing-library/react\"\n\nlet consoleWarnMock: jest.SpyInstance | undefined\nafterEach(() => {\n    consoleWarnMock?.mockRestore()\n})\n\nafterEach(() => {\n    _resetGlobalState()\n})\n\ndescribe(\"enforcing actions\", () => {\n    it(\"'never' should work\", () => {\n        consoleWarnMock = jest.spyOn(console, \"warn\").mockImplementation(() => {})\n        mobx.configure({ enforceActions: \"never\" })\n\n        const Parent = observer(() => {\n            const obs = useLocalObservable(() => ({\n                x: 1\n            }))\n            useEffect(() => {\n                obs.x++\n            }, [])\n\n            return <div>{obs.x}</div>\n        })\n\n        render(<Parent />)\n        expect(consoleWarnMock).not.toHaveBeenCalled()\n    })\n\n    it(\"'observed' should work\", () => {\n        consoleWarnMock = jest.spyOn(console, \"warn\").mockImplementation(() => {})\n        mobx.configure({ enforceActions: \"observed\" })\n\n        const Parent = observer(() => {\n            const obs = useLocalObservable(() => ({\n                x: 1\n            }))\n            useEffect(() => {\n                obs.x++\n            }, [])\n\n            return <div>{obs.x}</div>\n        })\n\n        render(<Parent />)\n        expect(consoleWarnMock).toHaveBeenCalledTimes(1)\n    })\n\n    it(\"'always' should work\", () => {\n        consoleWarnMock = jest.spyOn(console, \"warn\").mockImplementation(() => {})\n        mobx.configure({ enforceActions: \"always\" })\n\n        const Parent = observer(() => {\n            const obs = useLocalObservable(() => ({\n                x: 1\n            }))\n            useEffect(() => {\n                obs.x++\n            }, [])\n\n            return <div>{obs.x}</div>\n        })\n\n        render(<Parent />)\n        expect(consoleWarnMock).toHaveBeenCalledTimes(1)\n    })\n})\n"
  },
  {
    "path": "packages/mobx-react-lite/__tests__/observer.test.tsx",
    "content": "import { act, cleanup, fireEvent, render } from \"@testing-library/react\"\nimport mockConsole from \"jest-mock-console\"\nimport * as mobx from \"mobx\"\nimport React from \"react\"\n\nimport { observer, useObserver, isObserverBatched, enableStaticRendering } from \"../src\"\n\nconst getDNode = (obj: any, prop?: string) => mobx.getObserverTree(obj, prop)\n\nafterEach(cleanup)\n\nlet consoleWarnMock: jest.SpyInstance | undefined\nafterEach(() => {\n    consoleWarnMock?.mockRestore()\n})\n\nfunction runTestSuite(mode: \"observer\" | \"useObserver\") {\n    function obsComponent<P extends object>(\n        component: React.FunctionComponent<P>,\n        forceMemo = false\n    ) {\n        if (mode === \"observer\") {\n            return observer(component)\n        } else {\n            const c = (props: P) => {\n                consoleWarnMock = jest.spyOn(console, \"warn\").mockImplementation(() => {})\n                return useObserver(() => {\n                    return component(props)\n                })\n            }\n            return forceMemo ? React.memo(c) : c\n        }\n    }\n\n    describe(`nestedRendering - ${mode}`, () => {\n        const execute = () => {\n            // init element\n            const store = mobx.observable({\n                todos: [\n                    {\n                        completed: false,\n                        title: \"a\"\n                    }\n                ]\n            })\n\n            const renderings = {\n                item: 0,\n                list: 0\n            }\n\n            const TodoItem = obsComponent(({ todo }: { todo: (typeof store.todos)[0] }) => {\n                renderings.item++\n                return <li>|{todo.title}</li>\n            }, true)\n\n            const TodoList = obsComponent(() => {\n                renderings.list++\n                return (\n                    <div>\n                        <span>{store.todos.length}</span>\n                        {store.todos.map((todo, idx) => (\n                            <TodoItem key={idx} todo={todo} />\n                        ))}\n                    </div>\n                )\n            }, true)\n            const rendered = render(<TodoList />)\n            return { ...rendered, store, renderings }\n        }\n\n        test(\"first rendering\", () => {\n            const { getAllByText, renderings } = execute()\n            expect(renderings.list).toBe(1)\n            expect(renderings.item).toBe(1)\n            expect(getAllByText(\"1\")).toHaveLength(1)\n            expect(getAllByText(\"|a\")).toHaveLength(1)\n        })\n\n        test(\"inner store changed\", () => {\n            const { store, getAllByText, renderings } = execute()\n            act(() => {\n                store.todos[0].title += \"a\"\n            })\n            expect(renderings.list).toBe(1)\n            expect(renderings.item).toBe(2)\n            expect(getAllByText(\"1\")).toHaveLength(1)\n            expect(getAllByText(\"|aa\")).toHaveLength(1)\n            expect(getDNode(store, \"todos\").observers!.length).toBe(1)\n            expect(getDNode(store.todos[0], \"title\").observers!.length).toBe(1)\n        })\n\n        test(\"rerendering with outer store added\", () => {\n            const { store, container, getAllByText, renderings } = execute()\n            act(() => {\n                store.todos.push({\n                    completed: true,\n                    title: \"b\"\n                })\n            })\n            expect(container.querySelectorAll(\"li\").length).toBe(2)\n            expect(getAllByText(\"2\")).toHaveLength(1)\n            expect(getAllByText(\"|b\")).toHaveLength(1)\n            expect(renderings.list).toBe(2)\n            expect(renderings.item).toBe(2)\n            expect(getDNode(store.todos[1], \"title\").observers!.length).toBe(1)\n            expect(getDNode(store.todos[1], \"completed\").observers).toBeFalsy()\n        })\n\n        test(\"rerendering with outer store pop\", () => {\n            const { store, container, renderings } = execute()\n            let oldTodo\n            act(() => {\n                oldTodo = store.todos.pop()\n            })\n            expect(renderings.list).toBe(2)\n            expect(renderings.item).toBe(1)\n            expect(container.querySelectorAll(\"li\").length).toBe(0)\n            expect(getDNode(oldTodo, \"title\").observers).toBeFalsy()\n            expect(getDNode(oldTodo, \"completed\").observers).toBeFalsy()\n        })\n    })\n\n    describe(\"isObjectShallowModified detects when React will update the component\", () => {\n        const store = mobx.observable({ count: 0 })\n        let counterRenderings = 0\n        const Counter = obsComponent(function TodoItem() {\n            counterRenderings++\n            return <div>{store.count}</div>\n        })\n\n        test(\"does not assume React will update due to NaN prop\", () => {\n            // @ts-ignore Not sure what this test does, the value is not used\n            render(<Counter value={NaN} />)\n            act(() => {\n                store.count++\n            })\n            expect(counterRenderings).toBe(2)\n        })\n    })\n\n    describe(\"keep views alive\", () => {\n        const execute = () => {\n            const data = mobx.observable({\n                x: 3,\n                yCalcCount: 0,\n                get y() {\n                    this.yCalcCount++\n                    return this.x * 2\n                },\n                z: \"hi\"\n            })\n            const TestComponent = obsComponent(() => {\n                return (\n                    <div>\n                        {data.z}\n                        {data.y}\n                    </div>\n                )\n            })\n            return { ...render(<TestComponent />), data }\n        }\n\n        test(\"init state\", () => {\n            const { data, queryByText } = execute()\n            expect(data.yCalcCount).toBe(1)\n            expect(queryByText(\"hi6\")).toBeTruthy()\n        })\n\n        test(\"rerender should not need a recomputation of data.y\", () => {\n            const { data, queryByText } = execute()\n            act(() => {\n                data.z = \"hello\"\n            })\n            expect(data.yCalcCount).toBe(1)\n            expect(queryByText(\"hello6\")).toBeTruthy()\n        })\n    })\n\n    describe(\"does not keep views alive when using static rendering\", () => {\n        const execute = () => {\n            enableStaticRendering(true)\n            let renderCount = 0\n            const data = mobx.observable({\n                z: \"hi\"\n            })\n\n            const TestComponent = obsComponent(() => {\n                renderCount++\n                return <div>{data.z}</div>\n            })\n\n            return { ...render(<TestComponent />), data, getRenderCount: () => renderCount }\n        }\n\n        afterEach(() => {\n            enableStaticRendering(false)\n        })\n\n        test(\"init state is correct\", () => {\n            const { getRenderCount, getByText } = execute()\n            expect(getRenderCount()).toBe(1)\n            expect(getByText(\"hi\")).toBeTruthy()\n        })\n\n        test(\"no re-rendering on static rendering\", () => {\n            const { getRenderCount, getByText, data } = execute()\n            act(() => {\n                data.z = \"hello\"\n            })\n            expect(getRenderCount()).toBe(1)\n            expect(getByText(\"hi\")).toBeTruthy()\n            expect(getDNode(data, \"z\").observers!).toBeFalsy()\n        })\n    })\n\n    describe(\"issue 12\", () => {\n        const createData = () =>\n            mobx.observable({\n                selected: \"coffee\",\n                items: [\n                    {\n                        name: \"coffee\"\n                    },\n                    {\n                        name: \"tea\"\n                    }\n                ]\n            })\n\n        interface IItem {\n            name: string\n        }\n        interface IRowProps {\n            item: IItem\n            selected: string\n        }\n        const Row: React.FC<IRowProps> = props => {\n            return (\n                <span>\n                    {props.item.name}\n                    {props.selected === props.item.name ? \"!\" : \"\"}\n                </span>\n            )\n        }\n        /** table stateles component */\n        const Table = obsComponent<{ data: { items: IItem[]; selected: string } }>(props => {\n            return (\n                <div>\n                    {props.data.items.map(item => (\n                        <Row key={item.name} item={item} selected={props.data.selected} />\n                    ))}\n                </div>\n            )\n        })\n\n        test(\"init state is correct\", () => {\n            const data = createData()\n            const { container } = render(<Table data={data} />)\n            expect(container).toMatchSnapshot()\n        })\n\n        test(\"run transaction\", () => {\n            const data = createData()\n            const { container } = render(<Table data={data} />)\n            act(() => {\n                mobx.transaction(() => {\n                    data.items[1].name = \"boe\"\n                    data.items.splice(0, 2, { name: \"soup\" })\n                    data.selected = \"tea\"\n                })\n            })\n            expect(container).toMatchSnapshot()\n        })\n    })\n\n    describe(\"issue 309\", () => {\n        test(\"isObserverBatched is still defined and yields true by default\", () => {\n            consoleWarnMock = jest.spyOn(console, \"warn\").mockImplementation(() => {})\n            expect(isObserverBatched()).toBe(true)\n            expect(consoleWarnMock).toMatchSnapshot()\n        })\n    })\n\n    test(\"changing state in render should fail\", () => {\n        // This test is most likely obsolete ... exception is not thrown\n        const data = mobx.observable.box(2)\n        const Comp = obsComponent(() => {\n            if (data.get() === 3) {\n                try {\n                    data.set(4) // wouldn't throw first time for lack of observers.. (could we tighten this?)\n                } catch (err) {\n                    expect(err).toBeInstanceOf(Error)\n                    expect(err).toMatch(\n                        /Side effects like changing state are not allowed at this point/\n                    )\n                }\n            }\n            return <div>{data.get()}</div>\n        })\n        const { container } = render(<Comp />)\n        act(() => {\n            data.set(3)\n        })\n        expect(container).toMatchSnapshot()\n        mobx._resetGlobalState()\n    })\n\n    describe(\"should render component even if setState called with exactly the same props\", () => {\n        const execute = () => {\n            let renderCount = 0\n            const Component = obsComponent(() => {\n                const [, setState] = React.useState({})\n                const onClick = () => {\n                    setState({})\n                }\n                renderCount++\n                return <div onClick={onClick} data-testid=\"clickableDiv\" />\n            })\n            return { ...render(<Component />), getCount: () => renderCount }\n        }\n\n        test(\"renderCount === 1\", () => {\n            const { getCount } = execute()\n            expect(getCount()).toBe(1)\n        })\n\n        test(\"after click once renderCount === 2\", async () => {\n            const { getCount, getByTestId } = execute()\n            fireEvent.click(getByTestId(\"clickableDiv\"))\n            expect(getCount()).toBe(2)\n        })\n\n        test(\"after click twice renderCount === 3\", async () => {\n            const { getCount, getByTestId } = execute()\n            fireEvent.click(getByTestId(\"clickableDiv\"))\n            fireEvent.click(getByTestId(\"clickableDiv\"))\n            expect(getCount()).toBe(3)\n        })\n    })\n\n    describe(\"it rerenders correctly when useMemo is wrapping observable\", () => {\n        const execute = () => {\n            let renderCount = 0\n            const createProps = () => {\n                const odata = mobx.observable({ x: 1 })\n                const data = { y: 1 }\n                function doStuff() {\n                    data.y++\n                    odata.x++\n                }\n                return { odata, data, doStuff }\n            }\n\n            const Component = obsComponent((props: any) => {\n                const computed = React.useMemo(() => props.odata.x, [props.odata.x])\n\n                renderCount++\n                return (\n                    <span onClick={props.doStuff}>\n                        {props.odata.x}-{props.data.y}-{computed}\n                    </span>\n                )\n            })\n\n            const rendered = render(<Component {...createProps()} />)\n            return {\n                ...rendered,\n                getCount: () => renderCount,\n                span: rendered.container.querySelector(\"span\")!\n            }\n        }\n\n        test(\"init renderCount === 1\", () => {\n            const { span, getCount } = execute()\n            expect(getCount()).toBe(1)\n            expect(span.innerHTML).toBe(\"1-1-1\")\n        })\n\n        test(\"after click renderCount === 2\", async () => {\n            const { span, getCount } = execute()\n            fireEvent.click(span)\n            expect(getCount()).toBe(2)\n            expect(span.innerHTML).toBe(\"2-2-2\")\n        })\n\n        test(\"after click twice renderCount === 3\", async () => {\n            const { span, getCount } = execute()\n            fireEvent.click(span)\n            fireEvent.click(span)\n            expect(getCount()).toBe(3)\n            expect(span.innerHTML).toBe(\"3-3-3\")\n        })\n    })\n\n    describe(\"should not re-render on shallow equal new props\", () => {\n        const execute = () => {\n            const renderings = {\n                child: 0,\n                parent: 0\n            }\n            const data = { x: 1 }\n            const odata = mobx.observable({ y: 1 })\n\n            const Child = obsComponent((props: any) => {\n                renderings.child++\n                return <span>{props.data.x}</span>\n            }, true)\n            const Parent = obsComponent(() => {\n                renderings.parent++\n                // tslint:disable-next-line no-unused-expression\n                odata.y /// depend\n                return <Child data={data} />\n            }, true)\n            return { ...render(<Parent />), renderings, odata }\n        }\n\n        test(\"init state is correct\", () => {\n            const { container, renderings } = execute()\n            expect(renderings.parent).toBe(1)\n            expect(renderings.child).toBe(1)\n            expect(container.querySelector(\"span\")!.innerHTML).toBe(\"1\")\n        })\n\n        test(\"after odata change\", async () => {\n            const { container, renderings, odata } = execute()\n            act(() => {\n                odata.y++\n            })\n            expect(renderings.parent).toBe(2)\n            expect(renderings.child).toBe(1)\n            expect(container.querySelector(\"span\")!.innerHTML).toBe(\"1\")\n        })\n    })\n\n    describe(\"error handling\", () => {\n        test(\"errors should propagate\", () => {\n            const x = mobx.observable.box(1)\n            const errorsSeen: any[] = []\n\n            class ErrorBoundary extends React.Component<{ children: any }> {\n                public static getDerivedStateFromError() {\n                    return { hasError: true }\n                }\n\n                public state = {\n                    hasError: false\n                }\n\n                public componentDidCatch(error: any, info: any) {\n                    errorsSeen.push(\"\" + error)\n                }\n\n                public render() {\n                    if (this.state.hasError) {\n                        return <span>Saw error!</span>\n                    }\n                    return this.props.children\n                }\n            }\n\n            const C = obsComponent(() => {\n                if (x.get() === 42) {\n                    throw new Error(\"The meaning of life!\")\n                }\n                return <span>{x.get()}</span>\n            })\n\n            const restoreConsole = mockConsole()\n            try {\n                const rendered = render(\n                    <ErrorBoundary>\n                        <C />\n                    </ErrorBoundary>\n                )\n                expect(rendered.container.querySelector(\"span\")!.innerHTML).toBe(\"1\")\n                act(() => {\n                    x.set(42)\n                })\n                expect(errorsSeen).toEqual([\"Error: The meaning of life!\"])\n                expect(rendered.container.querySelector(\"span\")!.innerHTML).toBe(\"Saw error!\")\n            } finally {\n                restoreConsole()\n            }\n        })\n    })\n}\n\nrunTestSuite(\"observer\")\nrunTestSuite(\"useObserver\")\n\ntest(\"observer(cmp, { forwardRef: true }) + useImperativeHandle\", () => {\n    consoleWarnMock = jest.spyOn(console, \"warn\").mockImplementation(() => {})\n\n    interface IMethods {\n        focus(): void\n    }\n\n    interface IProps {\n        value: string\n        ref: React.Ref<IMethods>\n    }\n\n    const FancyInput = observer<IProps>(\n        (props: IProps, ref: React.Ref<IMethods>) => {\n            const inputRef = React.useRef<HTMLInputElement>(null)\n            React.useImperativeHandle(\n                ref,\n                () => ({\n                    focus: () => {\n                        inputRef.current!.focus()\n                    }\n                }),\n                []\n            )\n            return <input ref={inputRef} defaultValue={props.value} />\n        },\n        { forwardRef: true }\n    )\n\n    const cr = React.createRef<IMethods>()\n    render(<FancyInput ref={cr} value=\"\" />)\n    expect(cr).toBeTruthy()\n    expect(cr.current).toBeTruthy()\n    expect(typeof cr.current!.focus).toBe(\"function\")\n    expect(consoleWarnMock).toMatchSnapshot()\n})\n\ntest(\"observer(forwardRef(cmp)) + useImperativeHandle\", () => {\n    interface IMethods {\n        focus(): void\n    }\n\n    interface IProps {\n        value: string\n    }\n\n    const FancyInput = observer(\n        React.forwardRef((props: IProps, ref: React.Ref<IMethods>) => {\n            const inputRef = React.useRef<HTMLInputElement>(null)\n            React.useImperativeHandle(\n                ref,\n                () => ({\n                    focus: () => {\n                        inputRef.current!.focus()\n                    }\n                }),\n                []\n            )\n            return <input ref={inputRef} defaultValue={props.value} />\n        })\n    )\n\n    const cr = React.createRef<IMethods>()\n    render(<FancyInput ref={cr} value=\"\" />)\n    expect(cr).toBeTruthy()\n    expect(cr.current).toBeTruthy()\n    expect(typeof cr.current!.focus).toBe(\"function\")\n})\n\ntest(\"useImperativeHandle and forwardRef should work with useObserver\", () => {\n    consoleWarnMock = jest.spyOn(console, \"warn\").mockImplementation(() => {})\n    interface IMethods {\n        focus(): void\n    }\n\n    interface IProps {\n        value: string\n    }\n\n    const FancyInput = React.memo(\n        React.forwardRef((props: IProps, ref: React.Ref<IMethods>) => {\n            const inputRef = React.useRef<HTMLInputElement>(null)\n            React.useImperativeHandle(\n                ref,\n                () => ({\n                    focus: () => {\n                        inputRef.current!.focus()\n                    }\n                }),\n                []\n            )\n            return useObserver(() => {\n                return <input ref={inputRef} defaultValue={props.value} />\n            })\n        })\n    )\n\n    const cr = React.createRef<IMethods>()\n    render(<FancyInput ref={cr} value=\"\" />)\n    expect(cr).toBeTruthy()\n    expect(cr.current).toBeTruthy()\n    expect(typeof cr.current!.focus).toBe(\"function\")\n    expect(consoleWarnMock).toMatchSnapshot()\n})\n\ntest(\"observer should work with custom HOC and infer correct type\", () => {\n    const validateChildrenWrapper = <T extends {}>(component: React.FC<T>): React.FC<T> => {\n        const wrapper: React.FC<T> = (...args) => {\n            const result = component(...args)\n            if (result && React.isValidElement(result) && result.type === \"div\") {\n                return result\n            }\n            throw new Error(\"Only <div> allowed as root element\")\n        }\n        wrapper.displayName = component.displayName || component.name\n        return wrapper\n    }\n\n    interface IProps {\n        value: string\n    }\n\n    const TestComponent: React.FC<IProps> = observer(\n        validateChildrenWrapper(function TestComponent({ value }) {\n            return <div>{value}</div>\n        })\n    )\n\n    const rendered = render(<TestComponent value=\"1\" />)\n    expect(rendered.container.querySelector(\"div\")!.innerHTML).toBe(\"1\")\n})\n\nit(\"should hoist known statics only\", () => {\n    function isNumber() {\n        return null\n    }\n\n    function MyHipsterComponent() {\n        return null\n    }\n    MyHipsterComponent.defaultProps = { x: 3 }\n    MyHipsterComponent.propTypes = { x: isNumber }\n    MyHipsterComponent.randomStaticThing = 3\n    MyHipsterComponent.type = \"Nope!\"\n    MyHipsterComponent.compare = \"Nope!\"\n    MyHipsterComponent.render = \"Nope!\"\n\n    const wrapped = observer(MyHipsterComponent)\n    expect(wrapped.randomStaticThing).toEqual(3)\n    expect(wrapped.defaultProps).toEqual({ x: 3 })\n    expect(wrapped.propTypes).toEqual({ x: isNumber })\n    expect(wrapped.type).toBeInstanceOf(Function) // And not \"Nope!\"; this is the wrapped component, the property is introduced by memo\n    expect(wrapped.compare).toBe(null) // another memo field\n    expect(wrapped.render).toBe(undefined)\n})\n\nit(\"should inherit original name/displayName #3438\", () => {\n    function Name() {\n        return null\n    }\n    Name.displayName = \"DisplayName\"\n    const TestComponent = observer(Name)\n\n    expect((TestComponent as any).type.name).toBe(\"Name\")\n    expect((TestComponent as any).type.displayName).toBe(\"DisplayName\")\n})\n\ntest(\"parent / childs render in the right order\", done => {\n    // See: https://jsfiddle.net/gkaemmer/q1kv7hbL/13/\n    const events: string[] = []\n\n    class User {\n        public name = \"User's name\"\n        constructor() {\n            mobx.makeObservable(this, {\n                name: mobx.observable\n            })\n        }\n    }\n\n    class Store {\n        public user: User | null = new User()\n        public logout() {\n            this.user = null\n        }\n        constructor() {\n            mobx.makeObservable(this, {\n                user: mobx.observable,\n                logout: mobx.action\n            })\n        }\n    }\n\n    const store = new Store()\n\n    function tryLogout() {\n        try {\n            store.logout()\n            expect(true).toBeTruthy()\n        } catch (e) {\n            // t.fail(e)\n        }\n    }\n\n    const Parent = observer(() => {\n        events.push(\"parent\")\n        if (!store.user) {\n            return <span>Not logged in.</span>\n        }\n        return (\n            <div>\n                <Child />\n                <button onClick={tryLogout}>Logout</button>\n            </div>\n        )\n    })\n\n    const Child = observer(() => {\n        events.push(\"child\")\n        if (!store.user) {\n            return null\n        }\n        return <span>Logged in as: {store.user.name}</span>\n    })\n\n    render(<Parent />)\n\n    tryLogout()\n    expect(events).toEqual([\"parent\", \"child\"])\n    done()\n})\n\nit(\"should have overload for props with children\", () => {\n    interface IProps {\n        value: string\n    }\n    const TestComponent = observer<IProps>(({ value }) => {\n        return null\n    })\n\n    render(<TestComponent value=\"1\" />)\n\n    // this test has no `expect` calls as it verifies whether such component compiles or not\n})\n\nit(\"should have overload for empty options\", () => {\n    // empty options are not really making sense now, but we shouldn't rely on `forwardRef`\n    // being specified in case other options are added in the future\n\n    interface IProps {\n        value: string\n    }\n    const TestComponent = observer<IProps>(({ value }) => {\n        return null\n    }, {})\n\n    render(<TestComponent value=\"1\" />)\n\n    // this test has no `expect` calls as it verifies whether such component compiles or not\n})\n\nit(\"should have overload for props with children when forwardRef\", () => {\n    interface IMethods {\n        focus(): void\n    }\n\n    interface IProps {\n        value: string\n    }\n    const TestComponent = observer<IProps, IMethods>(\n        ({ value }, ref) => {\n            return null\n        },\n        { forwardRef: true }\n    )\n\n    render(<TestComponent value=\"1\" />)\n\n    // this test has no `expect` calls as it verifies whether such component compiles or not\n})\n\nit(\"should preserve generic parameters\", () => {\n    interface IColor {\n        name: string\n        css: string\n    }\n\n    interface ITestComponentProps<T> {\n        value: T\n        callback: (value: T) => void\n    }\n    const TestComponent = observer(<T extends unknown>(props: ITestComponentProps<T>) => {\n        return null\n    })\n\n    function callbackString(value: string) {\n        return\n    }\n    function callbackColor(value: IColor) {\n        return\n    }\n\n    render(<TestComponent value=\"1\" callback={callbackString} />)\n    render(\n        <TestComponent value={{ name: \"red\", css: \"rgb(255, 0, 0)\" }} callback={callbackColor} />\n    )\n\n    // this test has no `expect` calls as it verifies whether such component compiles or not\n})\n\nit(\"should preserve generic parameters when forwardRef\", () => {\n    interface IMethods {\n        focus(): void\n    }\n\n    interface IColor {\n        name: string\n        css: string\n    }\n\n    interface ITestComponentProps<T> {\n        value: T\n        callback: (value: T) => void\n    }\n    const TestComponent = observer(\n        <T extends unknown>(props: ITestComponentProps<T>, ref: React.Ref<IMethods>) => {\n            return null\n        },\n        { forwardRef: true }\n    )\n\n    function callbackString(value: string) {\n        return\n    }\n    function callbackColor(value: IColor) {\n        return\n    }\n\n    render(<TestComponent value=\"1\" callback={callbackString} />)\n    render(\n        <TestComponent value={{ name: \"red\", css: \"rgb(255, 0, 0)\" }} callback={callbackColor} />\n    )\n\n    // this test has no `expect` calls as it verifies whether such component compiles or not\n})\n\nit(\"should keep original props types\", () => {\n    interface TestComponentProps {\n        a: number\n    }\n\n    function TestComponent({ a }: TestComponentProps): JSX.Element | null {\n        return null\n    }\n\n    const ObserverTestComponent = observer(TestComponent)\n\n    const element = React.createElement(ObserverTestComponent, { a: 1 })\n    render(element)\n\n    // this test has no `expect` calls as it verifies whether such component compiles or not\n})\n\n// describe(\"206 - @observer should produce usefull errors if it throws\", () => {\n//     const data = mobx.observable({ x: 1 })\n//     let renderCount = 0\n\n//     const emmitedErrors = []\n//     const disposeErrorsHandler = onError(error => {\n//         emmitedErrors.push(error)\n//     })\n\n//     @observer\n//     class Child extends React.Component {\n//         render() {\n//             renderCount++\n//             if (data.x === 42) throw new Error(\"Oops!\")\n//             return <span>{data.x}</span>\n//         }\n//     }\n\n//     beforeAll(async done => {\n//         await asyncReactDOMRender(<Child />, testRoot)\n//         done()\n//     })\n\n//     test(\"init renderCount should === 1\", () => {\n//         expect(renderCount).toBe(1)\n//     })\n\n//     test(\"catch exception\", () => {\n//         expect(() => {\n//             withConsole(() => {\n//                 data.x = 42\n//             })\n//         }).toThrow(/Oops!/)\n//         expect(renderCount).toBe(3) // React fiber will try to replay the rendering, so the exception gets thrown a second time\n//     })\n\n//     test(\"component recovers!\", async () => {\n//         await sleepHelper(500)\n//         data.x = 3\n//         TestUtils.renderIntoDocument(<Child />)\n//         expect(renderCount).toBe(4)\n//         expect(emmitedErrors).toEqual([new Error(\"Oops!\"), new Error(\"Oops!\")]) // see above comment\n//     })\n// })\n\n// test(\"195 - async componentWillMount does not work\", async () => {\n//     const renderedValues = []\n\n//     @observer\n//     class WillMount extends React.Component {\n//         @mobx.observable\n//         counter = 0\n\n//         @mobx.action\n//         inc = () => this.counter++\n\n//         componentWillMount() {\n//             setTimeout(() => this.inc(), 300)\n//         }\n\n//         render() {\n//             renderedValues.push(this.counter)\n//             return (\n//                 <p>\n//                     {this.counter}\n//                     <button onClick={this.inc}>+</button>\n//                 </p>\n//             )\n//         }\n//     }\n//     TestUtils.renderIntoDocument(<WillMount />)\n\n//     await sleepHelper(500)\n//     expect(renderedValues).toEqual([0, 1])\n// })\n\n// test.skip(\"195 - should throw if trying to overwrite lifecycle methods\", () => {\n//     // Test disabled, see #231...\n\n//     @observer\n//     class WillMount extends React.Component {\n//         componentWillMount = () => {}\n\n//         render() {\n//             return null\n//         }\n//     }\n//     expect(TestUtils.renderIntoDocument(<WillMount />)).toThrow(\n//         /Cannot assign to read only property 'componentWillMount'/\n//     )\n// })\n\nit(\"dependencies should not become temporarily unobserved\", async () => {\n    jest.spyOn(React, \"useEffect\")\n\n    let p: Promise<any>[] = []\n    const cleanups: any[] = []\n\n    async function runEffects() {\n        await Promise.all(p.splice(0))\n    }\n\n    // @ts-ignore\n    React.useEffect.mockImplementation(effect => {\n        p.push(\n            new Promise<void>(resolve => {\n                setTimeout(() => {\n                    act(() => {\n                        cleanups.push(effect())\n                    })\n                    resolve()\n                }, 10)\n            })\n        )\n    })\n\n    let computed = 0\n    let renders = 0\n\n    const store = mobx.makeAutoObservable({\n        x: 1,\n        get double() {\n            computed++\n            return this.x * 2\n        },\n        inc() {\n            this.x++\n        }\n    })\n\n    const doubleDisposed = jest.fn()\n    const reactionFired = jest.fn()\n\n    mobx.onBecomeUnobserved(store, \"double\", doubleDisposed)\n\n    const TestComponent = observer(() => {\n        renders++\n        return <div>{store.double}</div>\n    })\n\n    const r = render(<TestComponent />)\n\n    expect(computed).toBe(1)\n    expect(renders).toBe(1)\n    expect(doubleDisposed).toHaveBeenCalledTimes(0)\n\n    store.inc()\n    expect(computed).toBe(2) // change propagated\n    expect(renders).toBe(1) // but not yet rendered\n    expect(doubleDisposed).toHaveBeenCalledTimes(0) // if we dispose to early, this fails!\n\n    // Bug: change the state, before the useEffect fires, can cause the reaction to be disposed\n    mobx.reaction(() => store.x, reactionFired)\n    expect(reactionFired).toHaveBeenCalledTimes(0)\n    expect(computed).toBe(2) // Not 3!\n    expect(renders).toBe(1)\n    expect(doubleDisposed).toHaveBeenCalledTimes(0)\n\n    await runEffects()\n    expect(reactionFired).toHaveBeenCalledTimes(0)\n    expect(computed).toBe(2) // Not 3!\n    expect(renders).toBe(2)\n    expect(doubleDisposed).toHaveBeenCalledTimes(0)\n\n    r.unmount()\n    cleanups.filter(Boolean).forEach(f => f())\n    expect(reactionFired).toHaveBeenCalledTimes(0)\n    expect(computed).toBe(2)\n    expect(renders).toBe(2)\n    expect(doubleDisposed).toHaveBeenCalledTimes(1)\n})\n\nit.skip(\"Legacy context support\", () => {\n    const contextKey = \"key\"\n    const contextValue = \"value\"\n\n    function ContextConsumer(_, context) {\n        expect(context[contextKey]).toBe(contextValue)\n        return null\n    }\n\n    ContextConsumer.contextTypes = {\n        [contextKey]: () => null\n    }\n\n    const ObserverContextConsumer = observer(ContextConsumer)\n\n    class ContextProvider extends React.Component {\n        getChildContext() {\n            return { [contextKey]: contextValue }\n        }\n\n        render() {\n            return <ObserverContextConsumer />\n        }\n    }\n\n    ;(ContextProvider as any).childContextTypes = {\n        [contextKey]: () => null\n    }\n\n    render(<ContextProvider />)\n})\n\nit(\"Throw when trying to set contextType on observer\", () => {\n    const NamedObserver = observer(function TestCmp() {\n        return null\n    })\n    const AnonymousObserver = observer(() => null)\n    expect(() => {\n        ;(NamedObserver as any).contextTypes = {}\n    }).toThrow(/\\[mobx-react-lite\\] `TestCmp.contextTypes` must be set before applying `observer`./)\n    expect(() => {\n        ;(AnonymousObserver as any).contextTypes = {}\n    }).toThrow(\n        /\\[mobx-react-lite\\] `Component.contextTypes` must be set before applying `observer`./\n    )\n})\n\ntest(\"Anonymous component displayName #3192\", () => {\n    // React prints errors even if we catch em\n    const consoleErrorSpy = jest.spyOn(console, \"error\").mockImplementation(() => {})\n\n    // Simulate returning something not renderable:\n    // Error: n_a_m_e(...):\n    // The point is to get correct displayName in error msg.\n\n    let memoError\n    let observerError\n\n    // @ts-ignore\n    const MemoCmp = React.memo(() => {\n        return { hello: \"world\" }\n    })\n    // @ts-ignore\n    const ObserverCmp = observer(() => {\n        return { hello: \"world\" }\n    })\n\n    ObserverCmp.displayName = MemoCmp.displayName = \"n_a_m_e\"\n\n    try {\n        render(<MemoCmp />)\n    } catch (error) {\n        memoError = error\n    }\n\n    try {\n        // @ts-ignore\n        render(<ObserverCmp />)\n    } catch (error) {\n        observerError = error\n    }\n\n    expect(memoError).toBeInstanceOf(Error)\n    expect(observerError).toBeInstanceOf(Error)\n\n    expect(memoError.message.includes(MemoCmp.displayName))\n    expect(MemoCmp.displayName).toEqual(ObserverCmp.displayName)\n    expect(observerError.message).toEqual(memoError.message)\n    consoleErrorSpy.mockRestore()\n})\n\ntest(\"StrictMode #3671\", async () => {\n    const o = mobx.observable({ x: 0 })\n\n    const Cmp = observer(() => o.x as any)\n\n    const { container, unmount } = render(\n        <React.StrictMode>\n            <Cmp />\n        </React.StrictMode>\n    )\n\n    expect(container).toHaveTextContent(\"0\")\n    act(\n        mobx.action(() => {\n            o.x++\n        })\n    )\n    expect(container).toHaveTextContent(\"1\")\n})\n\ntest(\"`isolateGlobalState` shouldn't break reactivity #3734\", async () => {\n    mobx.configure({ isolateGlobalState: true })\n\n    const o = mobx.observable({ x: 0 })\n\n    const Cmp = observer(() => o.x as any)\n\n    const { container, unmount } = render(<Cmp />)\n\n    expect(container).toHaveTextContent(\"0\")\n    act(\n        mobx.action(() => {\n            o.x++\n        })\n    )\n    expect(container).toHaveTextContent(\"1\")\n    unmount()\n\n    mobx._resetGlobalState()\n})\n"
  },
  {
    "path": "packages/mobx-react-lite/__tests__/printDebugValue.test.ts",
    "content": "import { $mobx, autorun, observable } from \"mobx\"\nimport { printDebugValue } from \"../src/utils/printDebugValue\"\n\ntest(\"printDebugValue\", () => {\n    const money = observable({\n        euro: 10,\n        get pound() {\n            return this.euro / 1.15\n        }\n    })\n\n    const disposer = autorun(() => {\n        const { euro, pound } = money\n        if (euro === pound) {\n            // tslint:disable-next-line: no-console\n            console.log(\"Weird..\")\n        }\n    })\n\n    const value = (disposer as any)[$mobx]\n\n    expect(printDebugValue(value)).toMatchSnapshot()\n\n    disposer()\n\n    expect(printDebugValue(value)).toMatchSnapshot()\n})\n"
  },
  {
    "path": "packages/mobx-react-lite/__tests__/strictAndConcurrentMode.test.tsx",
    "content": "import { act, cleanup, render } from \"@testing-library/react\"\nimport mockConsole from \"jest-mock-console\"\nimport * as mobx from \"mobx\"\nimport * as React from \"react\"\n\nimport { useObserver } from \"../src/useObserver\"\n\nafterEach(cleanup)\n\ntest(\"uncommitted observing components should not attempt state changes\", () => {\n    const store = mobx.observable({ count: 0 })\n\n    const TestComponent = () => useObserver(() => <div>{store.count}</div>)\n\n    // Render our observing component wrapped in StrictMode\n    const rendering = render(\n        <React.StrictMode>\n            <TestComponent />\n        </React.StrictMode>\n    )\n\n    // That will have caused our component to have been rendered\n    // more than once, but when we unmount it'll only unmount once.\n    rendering.unmount()\n\n    // Trigger a change to the observable. If the reactions were\n    // not disposed correctly, we'll see some console errors from\n    // React StrictMode because we're calling state mutators to\n    // trigger an update.\n    const restoreConsole = mockConsole()\n    try {\n        act(() => {\n            store.count++\n        })\n\n        // Check to see if any console errors were reported.\n        // tslint:disable-next-line: no-console\n        expect(console.error).not.toHaveBeenCalled()\n    } finally {\n        restoreConsole()\n    }\n})\n\ntest(`observable changes before first commit are not lost`, async () => {\n    const store = mobx.observable({ value: \"initial\" })\n\n    const TestComponent = () =>\n        useObserver(() => {\n            const res = <div>{store.value}</div>\n            // Change our observable. This is happening between the initial render of\n            // our component and its initial commit, so it isn't fully mounted yet.\n            // We want to ensure that the change isn't lost.\n            store.value = \"changed\"\n            return res\n        })\n\n    const rootNode = document.createElement(\"div\")\n    document.body.appendChild(rootNode)\n\n    const rendering = render(\n        <React.StrictMode>\n            <TestComponent />\n        </React.StrictMode>\n    )\n\n    expect(rendering.baseElement.textContent).toBe(\"changed\")\n})\n"
  },
  {
    "path": "packages/mobx-react-lite/__tests__/strictAndConcurrentModeUsingFinalizationRegistry.test.tsx",
    "content": "import { cleanup, render, waitFor } from \"@testing-library/react\"\nimport * as mobx from \"mobx\"\nimport * as React from \"react\"\nimport { useObserver } from \"../src/useObserver\"\nimport gc from \"expose-gc/function\"\nimport { observerFinalizationRegistry } from \"../src/utils/observerFinalizationRegistry\"\n\nif (typeof globalThis.FinalizationRegistry !== \"function\") {\n    throw new Error(\"This test must run with node >= 14\")\n}\n\nexpect(observerFinalizationRegistry).toBeInstanceOf(globalThis.FinalizationRegistry)\n\nafterEach(cleanup)\n\nfunction nextFrame() {\n    return new Promise(accept => setTimeout(accept, 1))\n}\n\nasync function gc_cycle() {\n    await nextFrame()\n    gc()\n    await nextFrame()\n}\n\ntest(\"uncommitted components should not leak observations\", async () => {\n    jest.setTimeout(30_000)\n    const store = mobx.observable({ count1: 0, count2: 0 })\n\n    // Track whether counts are observed\n    let count1IsObserved = false\n    let count2IsObserved = false\n    mobx.onBecomeObserved(store, \"count1\", () => (count1IsObserved = true))\n    mobx.onBecomeUnobserved(store, \"count1\", () => (count1IsObserved = false))\n    mobx.onBecomeObserved(store, \"count2\", () => (count2IsObserved = true))\n    mobx.onBecomeUnobserved(store, \"count2\", () => (count2IsObserved = false))\n\n    const TestComponent1 = () => useObserver(() => <div>{store.count1}</div>)\n    const TestComponent2 = () => useObserver(() => <div>{store.count2}</div>)\n\n    // Render, then remove only #2\n    const rendering = render(\n        <React.StrictMode>\n            <TestComponent1 />\n            <TestComponent2 />\n        </React.StrictMode>\n    )\n    rendering.rerender(\n        <React.StrictMode>\n            <TestComponent1 />\n        </React.StrictMode>\n    )\n\n    // Allow gc to kick in in case to let finalization registry cleanup\n    await gc_cycle()\n\n    // Can take a while (especially on CI) before gc actually calls the registry\n    await waitFor(\n        () => {\n            // count1 should still be being observed by Component1,\n            // but count2 should have had its reaction cleaned up.\n            expect(count1IsObserved).toBeTruthy()\n            expect(count2IsObserved).toBeFalsy()\n        },\n        {\n            timeout: 15_000,\n            interval: 200\n        }\n    )\n})\n"
  },
  {
    "path": "packages/mobx-react-lite/__tests__/strictAndConcurrentModeUsingTimers.test.tsx",
    "content": "import \"./utils/killFinalizationRegistry\"\nimport { act, cleanup, render } from \"@testing-library/react\"\nimport * as mobx from \"mobx\"\nimport * as React from \"react\"\nimport { useObserver } from \"../src/useObserver\"\nimport {\n    REGISTRY_FINALIZE_AFTER,\n    REGISTRY_SWEEP_INTERVAL\n} from \"../src/utils/UniversalFinalizationRegistry\"\nimport { observerFinalizationRegistry } from \"../src/utils/observerFinalizationRegistry\"\nimport { TimerBasedFinalizationRegistry } from \"../src/utils/UniversalFinalizationRegistry\"\n\nexpect(observerFinalizationRegistry).toBeInstanceOf(TimerBasedFinalizationRegistry)\n\nconst registry = observerFinalizationRegistry as TimerBasedFinalizationRegistry<unknown>\n\nafterEach(cleanup)\n\ntest(\"uncommitted components should not leak observations\", async () => {\n    registry.finalizeAllImmediately()\n\n    // Unfortunately, Jest fake timers don't mock out Date.now, so we fake\n    // that out in parallel to Jest useFakeTimers\n    let fakeNow = Date.now()\n    jest.useFakeTimers()\n    jest.spyOn(Date, \"now\").mockImplementation(() => fakeNow)\n\n    const store = mobx.observable({ count1: 0, count2: 0 })\n\n    // Track whether counts are observed\n    let count1IsObserved = false\n    let count2IsObserved = false\n    mobx.onBecomeObserved(store, \"count1\", () => (count1IsObserved = true))\n    mobx.onBecomeUnobserved(store, \"count1\", () => (count1IsObserved = false))\n    mobx.onBecomeObserved(store, \"count2\", () => (count2IsObserved = true))\n    mobx.onBecomeUnobserved(store, \"count2\", () => (count2IsObserved = false))\n\n    const TestComponent1 = () => useObserver(() => <div>{store.count1}</div>)\n    const TestComponent2 = () => useObserver(() => <div>{store.count2}</div>)\n\n    // Render, then remove only #2\n    const rendering = render(\n        <React.StrictMode>\n            <TestComponent1 />\n            <TestComponent2 />\n        </React.StrictMode>\n    )\n    rendering.rerender(\n        <React.StrictMode>\n            <TestComponent1 />\n        </React.StrictMode>\n    )\n\n    // Allow any reaction-disposal cleanup timers to run\n    const skip = Math.max(REGISTRY_FINALIZE_AFTER, REGISTRY_SWEEP_INTERVAL)\n    fakeNow += skip\n    jest.advanceTimersByTime(skip)\n\n    // count1 should still be being observed by Component1,\n    // but count2 should have had its reaction cleaned up.\n    expect(count1IsObserved).toBeTruthy()\n    expect(count2IsObserved).toBeFalsy()\n})\n\ntest(\"cleanup timer should not clean up recently-pended reactions\", () => {\n    // If we're not careful with timings, it's possible to get the\n    // following scenario:\n    // 1. Component instance A is being created; it renders, we put its reaction R1 into the cleanup list\n    // 2. Strict/Concurrent mode causes that render to be thrown away\n    // 3. Component instance A is being created; it renders, we put its reaction R2 into the cleanup list\n    // 4. The MobX reaction timer from 5 seconds ago kicks in and cleans up all reactions from uncommitted\n    //    components, including R1 and R2\n    // 5. The commit phase runs for component A, but reaction R2 has already been disposed. Game over.\n\n    // This unit test attempts to replicate that scenario:\n    registry.finalizeAllImmediately()\n\n    // Unfortunately, Jest fake timers don't mock out Date.now, so we fake\n    // that out in parallel to Jest useFakeTimers\n    const fakeNow = Date.now()\n    jest.useFakeTimers()\n    jest.spyOn(Date, \"now\").mockImplementation(() => fakeNow)\n\n    const store = mobx.observable({ count: 0 })\n\n    // Track whether the count is observed\n    let countIsObserved = false\n    mobx.onBecomeObserved(store, \"count\", () => (countIsObserved = true))\n    mobx.onBecomeUnobserved(store, \"count\", () => (countIsObserved = false))\n\n    const TestComponent1 = () => useObserver(() => <div>{store.count}</div>)\n\n    const rendering = render(\n        // We use StrictMode here, but it would be helpful to switch this to use real\n        // concurrent mode: we don't have a true async render right now so this test\n        // isn't as thorough as it could be.\n        <React.StrictMode>\n            <TestComponent1 />\n        </React.StrictMode>\n    )\n\n    // We need to trigger our cleanup timer to run. We can't do this simply\n    // by running all jest's faked timers as that would allow the scheduled\n    // `useEffect` calls to run, and we want to simulate our cleanup timer\n    // getting in between those stages.\n\n    // We force our cleanup loop to run even though enough time hasn't _really_\n    // elapsed.  In theory, it won't do anything because not enough time has\n    // elapsed since the reactions were queued, and so they won't be disposed.\n    registry.sweep()\n\n    // Advance time enough to allow any timer-queued effects to run\n    jest.advanceTimersByTime(500)\n\n    // Now allow the useEffect calls to run to completion.\n    act(() => {\n        // no-op, but triggers effect flushing\n    })\n\n    // count should still be observed\n    expect(countIsObserved).toBeTruthy()\n})\n\n// TODO: MWE: disabled during React 18 migration, not sure how to express it icmw with testing-lib,\n// and using new React renderRoot will fail icmw JSDOM\ntest.skip(\"component should recreate reaction if necessary\", () => {\n    // There _may_ be very strange cases where the reaction gets tidied up\n    // but is actually still needed.  This _really_ shouldn't happen.\n    // e.g. if we're using Suspense and the component starts to render,\n    // but then gets paused for 60 seconds, and then comes back to life.\n    // With the implementation of React at the time of writing this, React\n    // will actually fully re-render that component (discarding previous\n    // hook slots) before going ahead with a commit, but it's unwise\n    // to depend on such an implementation detail.  So we must cope with\n    // the component having had its reaction tidied and still going on to\n    // be committed.  In that case we recreate the reaction and force\n    // an update.\n\n    // This unit test attempts to replicate that scenario:\n\n    registry.finalizeAllImmediately()\n\n    // Unfortunately, Jest fake timers don't mock out Date.now, so we fake\n    // that out in parallel to Jest useFakeTimers\n    let fakeNow = Date.now()\n    jest.useFakeTimers()\n    jest.spyOn(Date, \"now\").mockImplementation(() => fakeNow)\n\n    const store = mobx.observable({ count: 0 })\n\n    // Track whether the count is observed\n    let countIsObserved = false\n    mobx.onBecomeObserved(store, \"count\", () => (countIsObserved = true))\n    mobx.onBecomeUnobserved(store, \"count\", () => (countIsObserved = false))\n\n    const TestComponent1 = () => useObserver(() => <div>{store.count}</div>)\n\n    const rendering = render(\n        <React.StrictMode>\n            <TestComponent1 />\n        </React.StrictMode>\n    )\n\n    // We need to trigger our cleanup timer to run. We don't want\n    // to allow Jest's effects to run, however: we want to simulate the\n    // case where the component is rendered, then the reaction gets cleaned up,\n    // and _then_ the component commits.\n\n    // Force everything to be disposed.\n    const skip = Math.max(REGISTRY_FINALIZE_AFTER, REGISTRY_SWEEP_INTERVAL)\n    fakeNow += skip\n    registry.sweep()\n\n    // The reaction should have been cleaned up.\n    expect(countIsObserved).toBeFalsy()\n\n    // Whilst nobody's looking, change the observable value\n    store.count = 42\n\n    // Now allow the useEffect calls to run to completion,\n    // re-awakening the component.\n    jest.advanceTimersByTime(500)\n    act(() => {\n        // no-op, but triggers effect flushing\n    })\n\n    // count should be observed once more.\n    expect(countIsObserved).toBeTruthy()\n    // and the component should have rendered enough to\n    // show the latest value, which was set whilst it\n    // wasn't even looking.\n    expect(rendering.baseElement.textContent).toContain(\"42\")\n})\n"
  },
  {
    "path": "packages/mobx-react-lite/__tests__/transactions.test.tsx",
    "content": "import * as mobx from \"mobx\"\nimport * as React from \"react\"\nimport { act, render } from \"@testing-library/react\"\n\nimport { observer } from \"../src\"\n\ntest(\"mobx issue 50\", done => {\n    const foo = {\n        a: mobx.observable.box(true),\n        b: mobx.observable.box(false),\n        c: mobx.computed((): boolean => {\n            // console.log(\"evaluate c\")\n            return foo.b.get()\n        })\n    }\n    function flipStuff() {\n        mobx.transaction(() => {\n            foo.a.set(!foo.a.get())\n            foo.b.set(!foo.b.get())\n        })\n    }\n    let asText = \"\"\n    let willReactCount = 0\n    mobx.autorun(() => (asText = [foo.a.get(), foo.b.get(), foo.c.get()].join(\":\")))\n    const Test = observer(() => {\n        willReactCount++\n        return <div id=\"x\">{[foo.a.get(), foo.b.get(), foo.c.get()].join(\",\")}</div>\n    })\n\n    render(<Test />)\n\n    setImmediate(() => {\n        act(() => {\n            flipStuff()\n        })\n        expect(asText).toBe(\"false:true:true\")\n        expect(document.getElementById(\"x\")!.innerHTML).toBe(\"false,true,true\")\n        expect(willReactCount).toBe(2)\n        done()\n    })\n})\n\nit(\"should respect transaction\", async () => {\n    const a = mobx.observable.box(2)\n    const loaded = mobx.observable.box(false)\n    const valuesSeen = [] as number[]\n\n    const Component = observer(() => {\n        valuesSeen.push(a.get())\n        if (loaded.get()) {\n            return <div>{a.get()}</div>\n        }\n        return <div>loading</div>\n    })\n\n    const { container } = render(<Component />)\n\n    act(() => {\n        mobx.transaction(() => {\n            a.set(3)\n            a.set(4)\n            loaded.set(true)\n        })\n    })\n\n    expect(container.textContent!.replace(/\\s+/g, \"\")).toBe(\"4\")\n    expect(valuesSeen.sort()).toEqual([2, 4].sort())\n})\n"
  },
  {
    "path": "packages/mobx-react-lite/__tests__/tsconfig.json",
    "content": "{\n    \"extends\": \"../tsconfig.test.json\"\n}\n"
  },
  {
    "path": "packages/mobx-react-lite/__tests__/useAsObservableSource.deprecated.test.tsx",
    "content": "import { act, cleanup, render, renderHook } from \"@testing-library/react\"\nimport { autorun, configure, observable } from \"mobx\"\nimport * as React from \"react\"\nimport { useEffect, useState } from \"react\"\n\nimport { Observer, observer, useAsObservableSource, useLocalStore } from \"../src\"\nimport { resetMobx } from \"./utils\"\n\nafterEach(cleanup)\nafterEach(resetMobx)\n\nlet consoleWarnMock: jest.SpyInstance | undefined\nafterEach(() => {\n    consoleWarnMock?.mockRestore()\n})\n\ndescribe(\"base useAsObservableSource should work\", () => {\n    it(\"with <Observer>\", () => {\n        consoleWarnMock = jest.spyOn(console, \"warn\").mockImplementation(() => {})\n        let counterRender = 0\n        let observerRender = 0\n\n        function Counter({ multiplier }: { multiplier: number }) {\n            counterRender++\n            const observableProps = useAsObservableSource({ multiplier })\n\n            const store = useLocalStore(() => ({\n                count: 10,\n                get multiplied() {\n                    return observableProps.multiplier * this.count\n                },\n                inc() {\n                    this.count += 1\n                }\n            }))\n\n            return (\n                <Observer>\n                    {() => {\n                        observerRender++\n                        return (\n                            <div>\n                                Multiplied count: <span>{store.multiplied}</span>\n                                <button id=\"inc\" onClick={store.inc}>\n                                    Increment\n                                </button>\n                            </div>\n                        )\n                    }}\n                </Observer>\n            )\n        }\n\n        function Parent() {\n            const [multiplier, setMultiplier] = useState(1)\n\n            return (\n                <div>\n                    <Counter multiplier={multiplier} />\n                    <button id=\"incmultiplier\" onClick={() => setMultiplier(m => m + 1)} />\n                </div>\n            )\n        }\n\n        const { container } = render(<Parent />)\n\n        expect(container.querySelector(\"span\")!.innerHTML).toBe(\"10\")\n        expect(counterRender).toBe(1)\n        expect(observerRender).toBe(1)\n\n        act(() => {\n            ;(container.querySelector(\"#inc\")! as any).click()\n        })\n        expect(container.querySelector(\"span\")!.innerHTML).toBe(\"11\")\n        expect(counterRender).toBe(1)\n        expect(observerRender).toBe(2)\n\n        act(() => {\n            ;(container.querySelector(\"#incmultiplier\")! as any).click()\n        })\n        expect(container.querySelector(\"span\")!.innerHTML).toBe(\"22\")\n        expect(counterRender).toBe(2)\n        expect(observerRender).toBe(4)\n        expect(consoleWarnMock).toMatchSnapshot()\n    })\n\n    it(\"with observer()\", () => {\n        let counterRender = 0\n\n        const Counter = observer(({ multiplier }: { multiplier: number }) => {\n            counterRender++\n\n            const observableProps = useAsObservableSource({ multiplier })\n            const store = useLocalStore(() => ({\n                count: 10,\n                get multiplied() {\n                    return observableProps.multiplier * this.count\n                },\n                inc() {\n                    this.count += 1\n                }\n            }))\n\n            return (\n                <div>\n                    Multiplied count: <span>{store.multiplied}</span>\n                    <button id=\"inc\" onClick={store.inc}>\n                        Increment\n                    </button>\n                </div>\n            )\n        })\n\n        function Parent() {\n            const [multiplier, setMultiplier] = useState(1)\n\n            return (\n                <div>\n                    <Counter multiplier={multiplier} />\n                    <button id=\"incmultiplier\" onClick={() => setMultiplier(m => m + 1)} />\n                </div>\n            )\n        }\n\n        const { container } = render(<Parent />)\n\n        expect(container.querySelector(\"span\")!.innerHTML).toBe(\"10\")\n        expect(counterRender).toBe(1)\n\n        act(() => {\n            ;(container.querySelector(\"#inc\")! as any).click()\n        })\n        expect(container.querySelector(\"span\")!.innerHTML).toBe(\"11\")\n        expect(counterRender).toBe(2)\n\n        act(() => {\n            ;(container.querySelector(\"#incmultiplier\")! as any).click()\n        })\n        expect(container.querySelector(\"span\")!.innerHTML).toBe(\"22\")\n        expect(counterRender).toBe(4) // One from props, second from updating local observable (setState during render)\n    })\n})\n\ntest(\"useAsObservableSource with effects should work\", () => {\n    const multiplierSeenByEffect: number[] = []\n    const valuesSeenByEffect: number[] = []\n    const thingsSeenByEffect: Array<[number, number, number]> = []\n\n    function Counter({ multiplier }: { multiplier: number }) {\n        const observableProps = useAsObservableSource({ multiplier })\n        const store = useLocalStore(() => ({\n            count: 10,\n            get multiplied() {\n                return observableProps.multiplier * this.count\n            },\n            inc() {\n                this.count += 1\n            }\n        }))\n\n        useEffect(\n            () =>\n                autorun(() => {\n                    multiplierSeenByEffect.push(observableProps.multiplier)\n                }),\n            []\n        )\n        useEffect(\n            () =>\n                autorun(() => {\n                    valuesSeenByEffect.push(store.count)\n                }),\n            []\n        )\n        useEffect(\n            () =>\n                autorun(() => {\n                    thingsSeenByEffect.push([\n                        observableProps.multiplier,\n                        store.multiplied,\n                        multiplier\n                    ]) // multiplier is trapped!\n                }),\n            []\n        )\n\n        return (\n            <button id=\"inc\" onClick={store.inc}>\n                Increment\n            </button>\n        )\n    }\n\n    function Parent() {\n        const [multiplier, setMultiplier] = useState(1)\n\n        return (\n            <div>\n                <Counter multiplier={multiplier} />\n                <button id=\"incmultiplier\" onClick={() => setMultiplier(m => m + 1)} />\n            </div>\n        )\n    }\n\n    const { container } = render(<Parent />)\n\n    act(() => {\n        ;(container.querySelector(\"#inc\")! as any).click()\n    })\n\n    act(() => {\n        ;(container.querySelector(\"#incmultiplier\")! as any).click()\n    })\n\n    expect(valuesSeenByEffect).toEqual([10, 11])\n    expect(multiplierSeenByEffect).toEqual([1, 2])\n    expect(thingsSeenByEffect).toEqual([\n        [1, 10, 1],\n        [1, 11, 1],\n        [2, 22, 1]\n    ])\n})\n\ndescribe(\"combining observer with props and stores\", () => {\n    it(\"keeps track of observable values\", () => {\n        const TestComponent = observer((props: any) => {\n            const localStore = useLocalStore(() => ({\n                get value() {\n                    return props.store.x + 5 * props.store.y\n                }\n            }))\n\n            return <div>{localStore.value}</div>\n        })\n        const store = observable({ x: 5, y: 1 })\n        const { container } = render(<TestComponent store={store} />)\n        const div = container.querySelector(\"div\")!\n        expect(div.textContent).toBe(\"10\")\n        act(() => {\n            store.y = 2\n        })\n        expect(div.textContent).toBe(\"15\")\n        act(() => {\n            store.x = 10\n        })\n        expect(div.textContent).toBe(\"20\")\n    })\n\n    it(\"allows non-observables to be used if specified as as source\", () => {\n        const renderedValues: number[] = []\n\n        const TestComponent = observer((props: any) => {\n            const obsProps = useAsObservableSource({ y: props.y })\n            const localStore = useLocalStore(() => ({\n                get value() {\n                    return props.store.x + 5 * obsProps.y\n                }\n            }))\n\n            renderedValues.push(localStore.value)\n            return <div>{localStore.value}</div>\n        })\n        const store = observable({ x: 5 })\n        const { container, rerender } = render(<TestComponent store={store} y={1} />)\n        const div = container.querySelector(\"div\")!\n        expect(div.textContent).toBe(\"10\")\n        rerender(<TestComponent store={store} y={2} />)\n        expect(div.textContent).toBe(\"15\")\n        act(() => {\n            store.x = 10\n        })\n\n        expect(renderedValues).toEqual([\n            10,\n            15, // props change\n            15, // local observable change (setState during render)\n            20\n        ])\n\n        // TODO: re-enable this line. When debugging, the correct value is returned from render,\n        // which is also visible with renderedValues, however, querying the dom doesn't show the correct result\n        // possible a bug with @testing-library/react?\n        // expect(container.querySelector(\"div\")!.textContent).toBe(\"20\") // TODO: somehow this change is not visible in the tester!\n    })\n})\n\ndescribe(\"enforcing actions\", () => {\n    it(\"'never' should work\", () => {\n        configure({ enforceActions: \"never\" })\n        const onError = jest.fn()\n        renderHook(\n            () => {\n                const [thing, setThing] = React.useState(\"world\")\n                useAsObservableSource({ hello: thing })\n                useEffect(() => setThing(\"react\"), [])\n            },\n            {\n                wrapper: class extends React.Component<React.PropsWithChildren> {\n                    componentDidCatch = onError\n                    render() {\n                        return this.props.children\n                    }\n                }\n            }\n        )\n        expect(onError).not.toHaveBeenCalled()\n    })\n    it(\"only when 'observed' should work\", () => {\n        configure({ enforceActions: \"observed\" })\n        const onError = jest.fn()\n        renderHook(\n            () => {\n                const [thing, setThing] = React.useState(\"world\")\n                useAsObservableSource({ hello: thing })\n                useEffect(() => setThing(\"react\"), [])\n            },\n            {\n                wrapper: class extends React.Component<React.PropsWithChildren> {\n                    componentDidCatch = onError\n                    render() {\n                        return this.props.children\n                    }\n                }\n            }\n        )\n        expect(onError).not.toHaveBeenCalled()\n    })\n    it(\"'always' should work\", () => {\n        configure({ enforceActions: \"always\" })\n        const onError = jest.fn()\n        renderHook(\n            () => {\n                const [thing, setThing] = React.useState(\"world\")\n                useAsObservableSource({ hello: thing })\n                useEffect(() => setThing(\"react\"), [])\n            },\n            {\n                wrapper: class extends React.Component<React.PropsWithChildren> {\n                    componentDidCatch = onError\n                    render() {\n                        return this.props.children\n                    }\n                }\n            }\n        )\n        expect(onError).not.toHaveBeenCalled()\n    })\n})\n"
  },
  {
    "path": "packages/mobx-react-lite/__tests__/useAsObservableSource.test.tsx",
    "content": "import { act, cleanup, render, renderHook } from \"@testing-library/react\"\nimport mockConsole from \"jest-mock-console\"\nimport { autorun, configure, observable } from \"mobx\"\nimport * as React from \"react\"\nimport { useEffect, useState } from \"react\"\n\nimport { Observer, observer, useLocalObservable } from \"../src\"\nimport { resetMobx } from \"./utils\"\nimport { useObserver } from \"../src/useObserver\"\n\nafterEach(cleanup)\nafterEach(resetMobx)\n\ndescribe(\"base useAsObservableSource should work\", () => {\n    it(\"with useObserver\", () => {\n        let counterRender = 0\n        let observerRender = 0\n\n        function Counter({ multiplier }: { multiplier: number }) {\n            counterRender++\n            const observableProps = useLocalObservable(() => ({ multiplier }))\n            Object.assign(observableProps, { multiplier })\n            const store = useLocalObservable(() => ({\n                count: 10,\n                get multiplied() {\n                    return observableProps.multiplier * this.count\n                },\n                inc() {\n                    this.count += 1\n                }\n            }))\n\n            return useObserver(\n                () => (\n                    observerRender++,\n                    (\n                        <div>\n                            Multiplied count: <span>{store.multiplied}</span>\n                            <button id=\"inc\" onClick={store.inc}>\n                                Increment\n                            </button>\n                        </div>\n                    )\n                )\n            )\n        }\n\n        function Parent() {\n            const [multiplier, setMultiplier] = useState(1)\n\n            return (\n                <div>\n                    <Counter multiplier={multiplier} />\n                    <button id=\"incmultiplier\" onClick={() => setMultiplier(m => m + 1)} />\n                </div>\n            )\n        }\n\n        const { container } = render(<Parent />)\n\n        expect(container.querySelector(\"span\")!.innerHTML).toBe(\"10\")\n        expect(counterRender).toBe(1)\n        expect(observerRender).toBe(1)\n\n        act(() => {\n            ;(container.querySelector(\"#inc\")! as any).click()\n        })\n        expect(container.querySelector(\"span\")!.innerHTML).toBe(\"11\")\n        expect(counterRender).toBe(2) // 1 would be better!\n        expect(observerRender).toBe(2)\n\n        act(() => {\n            ;(container.querySelector(\"#incmultiplier\")! as any).click()\n        })\n        expect(container.querySelector(\"span\")!.innerHTML).toBe(\"22\")\n        expect(counterRender).toBe(4) // TODO: avoid double rendering here!\n        expect(observerRender).toBe(4) // TODO: avoid double rendering here!\n    })\n\n    it(\"with <Observer>\", () => {\n        let counterRender = 0\n        let observerRender = 0\n\n        function Counter({ multiplier }: { multiplier: number }) {\n            counterRender++\n            const store = useLocalObservable(() => ({\n                multiplier,\n                count: 10,\n                get multiplied() {\n                    return this.multiplier * this.count\n                },\n                inc() {\n                    this.count += 1\n                }\n            }))\n\n            useEffect(() => {\n                store.multiplier = multiplier\n            }, [multiplier])\n            return (\n                <Observer>\n                    {() => {\n                        observerRender++\n                        return (\n                            <div>\n                                Multiplied count: <span>{store.multiplied}</span>\n                                <button id=\"inc\" onClick={store.inc}>\n                                    Increment\n                                </button>\n                            </div>\n                        )\n                    }}\n                </Observer>\n            )\n        }\n\n        function Parent() {\n            const [multiplier, setMultiplier] = useState(1)\n\n            return (\n                <div>\n                    <Counter multiplier={multiplier} />\n                    <button id=\"incmultiplier\" onClick={() => setMultiplier(m => m + 1)} />\n                </div>\n            )\n        }\n\n        const { container } = render(<Parent />)\n\n        expect(container.querySelector(\"span\")!.innerHTML).toBe(\"10\")\n        expect(counterRender).toBe(1)\n        expect(observerRender).toBe(1)\n\n        act(() => {\n            ;(container.querySelector(\"#inc\")! as any).click()\n        })\n        expect(container.querySelector(\"span\")!.innerHTML).toBe(\"11\")\n        expect(counterRender).toBe(1)\n        expect(observerRender).toBe(2)\n\n        act(() => {\n            ;(container.querySelector(\"#incmultiplier\")! as any).click()\n        })\n        expect(container.querySelector(\"span\")!.innerHTML).toBe(\"22\")\n        expect(counterRender).toBe(2)\n        expect(observerRender).toBe(4)\n    })\n\n    it(\"with observer()\", () => {\n        let counterRender = 0\n\n        const Counter = observer(({ multiplier }: { multiplier: number }) => {\n            counterRender++\n\n            const store = useLocalObservable(() => ({\n                multiplier,\n                count: 10,\n                get multiplied() {\n                    return this.multiplier * this.count\n                },\n                inc() {\n                    this.count += 1\n                }\n            }))\n\n            useEffect(() => {\n                store.multiplier = multiplier\n            }, [multiplier])\n\n            return (\n                <div>\n                    Multiplied count: <span>{store.multiplied}</span>\n                    <button id=\"inc\" onClick={store.inc}>\n                        Increment\n                    </button>\n                </div>\n            )\n        })\n\n        function Parent() {\n            const [multiplier, setMultiplier] = useState(1)\n\n            return (\n                <div>\n                    <Counter multiplier={multiplier} />\n                    <button id=\"incmultiplier\" onClick={() => setMultiplier(m => m + 1)} />\n                </div>\n            )\n        }\n\n        const { container } = render(<Parent />)\n\n        expect(container.querySelector(\"span\")!.innerHTML).toBe(\"10\")\n        expect(counterRender).toBe(1)\n\n        act(() => {\n            ;(container.querySelector(\"#inc\")! as any).click()\n        })\n        expect(container.querySelector(\"span\")!.innerHTML).toBe(\"11\")\n        expect(counterRender).toBe(2)\n\n        act(() => {\n            ;(container.querySelector(\"#incmultiplier\")! as any).click()\n        })\n        expect(container.querySelector(\"span\")!.innerHTML).toBe(\"22\")\n        expect(counterRender).toBe(4) // One from props, second from updating local observable with effect\n    })\n})\n\ntest(\"useAsObservableSource with effects should work\", () => {\n    const multiplierSeenByEffect: number[] = []\n    const valuesSeenByEffect: number[] = []\n    const thingsSeenByEffect: Array<[number, number, number]> = []\n\n    function Counter({ multiplier }: { multiplier: number }) {\n        const store = useLocalObservable(() => ({\n            multiplier,\n            count: 10,\n            get multiplied() {\n                return this.multiplier * this.count\n            },\n            inc() {\n                this.count += 1\n            }\n        }))\n\n        useEffect(() => {\n            store.multiplier = multiplier\n        }, [multiplier])\n\n        useEffect(\n            () =>\n                autorun(() => {\n                    multiplierSeenByEffect.push(store.multiplier)\n                }),\n            []\n        )\n        useEffect(\n            () =>\n                autorun(() => {\n                    valuesSeenByEffect.push(store.count)\n                }),\n            []\n        )\n        useEffect(\n            () =>\n                autorun(() => {\n                    thingsSeenByEffect.push([store.multiplier, store.multiplied, multiplier]) // multiplier is trapped!\n                }),\n            []\n        )\n\n        return (\n            <button id=\"inc\" onClick={store.inc}>\n                Increment\n            </button>\n        )\n    }\n\n    function Parent() {\n        const [multiplier, setMultiplier] = useState(1)\n\n        return (\n            <div>\n                <Counter multiplier={multiplier} />\n                <button id=\"incmultiplier\" onClick={() => setMultiplier(m => m + 1)} />\n            </div>\n        )\n    }\n\n    const { container } = render(<Parent />)\n\n    act(() => {\n        ;(container.querySelector(\"#inc\")! as any).click()\n    })\n\n    act(() => {\n        ;(container.querySelector(\"#incmultiplier\")! as any).click()\n    })\n\n    expect(valuesSeenByEffect).toEqual([10, 11])\n    expect(multiplierSeenByEffect).toEqual([1, 2])\n    expect(thingsSeenByEffect).toEqual([\n        [1, 10, 1],\n        [1, 11, 1],\n        [2, 22, 1]\n    ])\n})\n\ndescribe(\"combining observer with props and stores\", () => {\n    it(\"keeps track of observable values\", () => {\n        const TestComponent = observer((props: any) => {\n            const localStore = useLocalObservable(() => ({\n                get value() {\n                    return props.store.x + 5 * props.store.y\n                }\n            }))\n\n            return <div>{localStore.value}</div>\n        })\n        const store = observable({ x: 5, y: 1 })\n        const { container } = render(<TestComponent store={store} />)\n        const div = container.querySelector(\"div\")!\n        expect(div.textContent).toBe(\"10\")\n        act(() => {\n            store.y = 2\n        })\n        expect(div.textContent).toBe(\"15\")\n        act(() => {\n            store.x = 10\n        })\n        expect(div.textContent).toBe(\"20\")\n    })\n\n    it(\"allows non-observables to be used if specified as as source\", () => {\n        const renderedValues: number[] = []\n\n        const TestComponent = observer((props: any) => {\n            const localStore = useLocalObservable(() => ({\n                y: props.y,\n                get value() {\n                    return props.store.x + 5 * this.y\n                }\n            }))\n            localStore.y = props.y\n            renderedValues.push(localStore.value)\n            return <div>{localStore.value}</div>\n        })\n        const store = observable({ x: 5 })\n        const { container, rerender } = render(<TestComponent store={store} y={1} />)\n        const div = container.querySelector(\"div\")!\n        expect(div.textContent).toBe(\"10\")\n        rerender(<TestComponent store={store} y={2} />)\n        expect(div.textContent).toBe(\"15\")\n        act(() => {\n            store.x = 10\n        })\n\n        expect(renderedValues).toEqual([\n            10,\n            15, // props change\n            15, // local observable change during render (localStore.y = props.y)\n            20\n        ])\n\n        expect(container.querySelector(\"div\")!.textContent).toBe(\"20\")\n    })\n})\n\ndescribe(\"enforcing actions\", () => {\n    it(\"'never' should work\", () => {\n        configure({ enforceActions: \"never\" })\n        const onError = jest.fn()\n        renderHook(\n            () => {\n                const [thing, setThing] = React.useState(\"world\")\n                useLocalObservable(() => ({ hello: thing }))\n                useEffect(() => setThing(\"react\"), [])\n            },\n            {\n                wrapper: class extends React.Component<React.PropsWithChildren> {\n                    componentDidCatch = onError\n                    render() {\n                        return this.props.children\n                    }\n                }\n            }\n        )\n        expect(onError).not.toHaveBeenCalled()\n    })\n    it(\"only when 'observed' should work\", () => {\n        configure({ enforceActions: \"observed\" })\n        const onError = jest.fn()\n        renderHook(\n            () => {\n                const [thing, setThing] = React.useState(\"world\")\n                useLocalObservable(() => ({ hello: thing }))\n                useEffect(() => setThing(\"react\"), [])\n            },\n            {\n                wrapper: class extends React.Component<React.PropsWithChildren> {\n                    componentDidCatch = onError\n                    render() {\n                        return this.props.children\n                    }\n                }\n            }\n        )\n        expect(onError).not.toHaveBeenCalled()\n    })\n    it(\"'always' should work\", () => {\n        configure({ enforceActions: \"always\" })\n        const onError = jest.fn()\n        renderHook(\n            () => {\n                const [thing, setThing] = React.useState(\"world\")\n                useLocalObservable(() => ({ hello: thing }))\n                useEffect(() => setThing(\"react\"), [])\n            },\n            {\n                wrapper: class extends React.Component<React.PropsWithChildren> {\n                    componentDidCatch = onError\n                    render() {\n                        return this.props.children\n                    }\n                }\n            }\n        )\n        expect(onError).not.toHaveBeenCalled()\n    })\n})\n\nit(\"doesn't update a component while rendering a different component - #274\", () => {\n    // https://github.com/facebook/react/pull/17099\n\n    const Parent = observer((props: any) => {\n        const observableProps = useLocalObservable(() => props)\n        useEffect(() => {\n            Object.assign(observableProps, props)\n        }, [props])\n\n        return <Child observableProps={observableProps} />\n    })\n\n    const Child = observer(({ observableProps }: any) => {\n        return observableProps.foo\n    })\n\n    const { container, rerender } = render(<Parent foo={1} />)\n    expect(container.textContent).toBe(\"1\")\n\n    const restoreConsole = mockConsole()\n    rerender(<Parent foo={2} />)\n    expect(console.error).not.toHaveBeenCalled()\n    restoreConsole()\n    expect(container.textContent).toBe(\"2\")\n})\n"
  },
  {
    "path": "packages/mobx-react-lite/__tests__/useLocalObservable.test.tsx",
    "content": "import * as mobx from \"mobx\"\nimport * as React from \"react\"\nimport { act, cleanup, fireEvent, render, renderHook } from \"@testing-library/react\"\n\nimport { Observer, observer, useLocalObservable } from \"../src\"\nimport { useEffect, useState } from \"react\"\nimport { autorun } from \"mobx\"\nimport { useObserver } from \"../src/useObserver\"\n\nafterEach(cleanup)\n\nlet consoleWarnMock: jest.SpyInstance | undefined\nafterEach(() => {\n    consoleWarnMock?.mockRestore()\n})\n\ntest(\"base useLocalStore should work\", () => {\n    let counterRender = 0\n    let observerRender = 0\n    let outerStoreRef: any\n\n    function Counter() {\n        counterRender++\n        const store = (outerStoreRef = useLocalObservable(() => ({\n            count: 0,\n            count2: 0, // not used in render\n            inc() {\n                this.count += 1\n            }\n        })))\n\n        return useObserver(() => {\n            observerRender++\n            return (\n                <div>\n                    Count: <span>{store.count}</span>\n                    <button onClick={store.inc}>Increment</button>\n                </div>\n            )\n        })\n    }\n\n    const { container } = render(<Counter />)\n\n    expect(container.querySelector(\"span\")!.innerHTML).toBe(\"0\")\n    expect(counterRender).toBe(1)\n    expect(observerRender).toBe(1)\n\n    act(() => {\n        container.querySelector(\"button\")!.click()\n    })\n    expect(container.querySelector(\"span\")!.innerHTML).toBe(\"1\")\n    expect(counterRender).toBe(2)\n    expect(observerRender).toBe(2)\n\n    act(() => {\n        outerStoreRef.count++\n    })\n    expect(container.querySelector(\"span\")!.innerHTML).toBe(\"2\")\n    expect(counterRender).toBe(3)\n    expect(observerRender).toBe(3)\n\n    act(() => {\n        outerStoreRef.count2++\n    })\n    // No re-render!\n    expect(container.querySelector(\"span\")!.innerHTML).toBe(\"2\")\n    expect(counterRender).toBe(3)\n    expect(observerRender).toBe(3)\n})\n\ndescribe(\"is used to keep observable within component body\", () => {\n    it(\"value can be changed over renders\", () => {\n        const TestComponent = () => {\n            const obs = useLocalObservable(() => ({\n                x: 1,\n                y: 2\n            }))\n            return (\n                <div onClick={() => (obs.x += 1)}>\n                    {obs.x}-{obs.y}\n                </div>\n            )\n        }\n        const { container, rerender } = render(<TestComponent />)\n        const div = container.querySelector(\"div\")!\n        expect(div.textContent).toBe(\"1-2\")\n        fireEvent.click(div)\n        // observer not used, need to render from outside\n        rerender(<TestComponent />)\n        expect(div.textContent).toBe(\"2-2\")\n    })\n\n    it(\"works with observer as well\", () => {\n        let renderCount = 0\n\n        const TestComponent = observer(() => {\n            renderCount++\n\n            const obs = useLocalObservable(() => ({\n                x: 1,\n                y: 2\n            }))\n            return (\n                <div onClick={() => (obs.x += 1)}>\n                    {obs.x}-{obs.y}\n                </div>\n            )\n        })\n        const { container } = render(<TestComponent />)\n        const div = container.querySelector(\"div\")!\n        expect(div.textContent).toBe(\"1-2\")\n        fireEvent.click(div)\n        expect(div.textContent).toBe(\"2-2\")\n        fireEvent.click(div)\n        expect(div.textContent).toBe(\"3-2\")\n\n        expect(renderCount).toBe(3)\n    })\n\n    it(\"actions can be used\", () => {\n        const TestComponent = observer(() => {\n            const obs = useLocalObservable(() => ({\n                x: 1,\n                y: 2,\n                inc() {\n                    obs.x += 1\n                }\n            }))\n            return (\n                <div onClick={obs.inc}>\n                    {obs.x}-{obs.y}\n                </div>\n            )\n        })\n        const { container } = render(<TestComponent />)\n        const div = container.querySelector(\"div\")!\n        expect(div.textContent).toBe(\"1-2\")\n        fireEvent.click(div)\n        expect(div.textContent).toBe(\"2-2\")\n    })\n\n    it(\"computed properties works as well\", () => {\n        const TestComponent = observer(() => {\n            const obs = useLocalObservable(() => ({\n                x: 1,\n                y: 2,\n                get z() {\n                    return obs.x + obs.y\n                }\n            }))\n            return <div onClick={() => (obs.x += 1)}>{obs.z}</div>\n        })\n        const { container } = render(<TestComponent />)\n        const div = container.querySelector(\"div\")!\n        expect(div.textContent).toBe(\"3\")\n        fireEvent.click(div)\n        expect(div.textContent).toBe(\"4\")\n    })\n\n    it(\"computed properties can use local functions\", () => {\n        const TestComponent = observer(() => {\n            const obs = useLocalObservable(() => ({\n                x: 1,\n                y: 2,\n                getMeThatX() {\n                    return this.x\n                },\n                get z() {\n                    return this.getMeThatX() + obs.y\n                }\n            }))\n            return <div onClick={() => (obs.x += 1)}>{obs.z}</div>\n        })\n        const { container } = render(<TestComponent />)\n        const div = container.querySelector(\"div\")!\n        expect(div.textContent).toBe(\"3\")\n        fireEvent.click(div)\n        expect(div.textContent).toBe(\"4\")\n    })\n\n    it(\"transactions are respected\", () => {\n        const seen: number[] = []\n\n        const TestComponent = observer(() => {\n            const obs = useLocalObservable(() => ({\n                x: 1,\n                inc(delta: number) {\n                    this.x += delta\n                    this.x += delta\n                }\n            }))\n\n            useEffect(\n                () =>\n                    autorun(() => {\n                        seen.push(obs.x)\n                    }),\n                []\n            )\n\n            return (\n                <div\n                    onClick={() => {\n                        obs.inc(2)\n                    }}\n                >\n                    Test\n                </div>\n            )\n        })\n        const { container } = render(<TestComponent />)\n        const div = container.querySelector(\"div\")!\n        fireEvent.click(div)\n        expect(seen).toEqual([1, 5]) // No 3!\n    })\n\n    it(\"Map can used instead of object\", () => {\n        const TestComponent = observer(() => {\n            const map = useLocalObservable(() => new Map([[\"initial\", 10]]))\n            return (\n                <div onClick={() => map.set(\"later\", 20)}>\n                    {Array.from(map).map(([key, value]) => (\n                        <div key={key}>\n                            {key} - {value}\n                        </div>\n                    ))}\n                </div>\n            )\n        })\n        const { container } = render(<TestComponent />)\n        const div = container.querySelector(\"div\")!\n        expect(div.textContent).toBe(\"initial - 10\")\n        fireEvent.click(div)\n        expect(div.textContent).toBe(\"initial - 10later - 20\")\n    })\n\n    describe(\"with props\", () => {\n        it(\"and useObserver\", () => {\n            let counterRender = 0\n            let observerRender = 0\n\n            function Counter({ multiplier }: { multiplier: number }) {\n                counterRender++\n\n                const store = useLocalObservable(() => ({\n                    multiplier,\n                    count: 10,\n                    get multiplied() {\n                        return this.multiplier * this.count\n                    },\n                    inc() {\n                        this.count += 1\n                    }\n                }))\n                useEffect(() => {\n                    store.multiplier = multiplier\n                }, [multiplier])\n\n                return useObserver(\n                    () => (\n                        observerRender++,\n                        (\n                            <div>\n                                Multiplied count: <span>{store.multiplied}</span>\n                                <button id=\"inc\" onClick={store.inc}>\n                                    Increment\n                                </button>\n                            </div>\n                        )\n                    )\n                )\n            }\n\n            function Parent() {\n                const [multiplier, setMultiplier] = useState(1)\n\n                return (\n                    <div>\n                        <Counter multiplier={multiplier} />\n                        <button id=\"incmultiplier\" onClick={() => setMultiplier(m => m + 1)} />\n                    </div>\n                )\n            }\n\n            const { container } = render(<Parent />)\n\n            expect(container.querySelector(\"span\")!.innerHTML).toBe(\"10\")\n            expect(counterRender).toBe(1)\n            expect(observerRender).toBe(1)\n\n            act(() => {\n                ;(container.querySelector(\"#inc\")! as any).click()\n            })\n            expect(container.querySelector(\"span\")!.innerHTML).toBe(\"11\")\n            expect(counterRender).toBe(2) // 1 would be better!\n            expect(observerRender).toBe(2)\n\n            act(() => {\n                ;(container.querySelector(\"#incmultiplier\")! as any).click()\n            })\n            expect(container.querySelector(\"span\")!.innerHTML).toBe(\"22\")\n            expect(counterRender).toBe(4) // TODO: avoid double rendering here!\n            expect(observerRender).toBe(4) // TODO: avoid double rendering here!\n        })\n\n        it(\"with <Observer>\", () => {\n            let counterRender = 0\n            let observerRender = 0\n\n            function Counter({ multiplier }: { multiplier: number }) {\n                counterRender++\n\n                const store = useLocalObservable(() => ({\n                    multiplier,\n                    count: 10,\n                    get multiplied() {\n                        return this.multiplier * this.count\n                    },\n                    inc() {\n                        this.count += 1\n                    }\n                }))\n                useEffect(() => {\n                    store.multiplier = multiplier\n                }, [multiplier])\n\n                return (\n                    <Observer>\n                        {() => {\n                            observerRender++\n                            return (\n                                <div>\n                                    Multiplied count: <span>{store.multiplied}</span>\n                                    <button id=\"inc\" onClick={store.inc}>\n                                        Increment\n                                    </button>\n                                </div>\n                            )\n                        }}\n                    </Observer>\n                )\n            }\n\n            function Parent() {\n                const [multiplier, setMultiplier] = useState(1)\n\n                return (\n                    <div>\n                        <Counter multiplier={multiplier} />\n                        <button id=\"incmultiplier\" onClick={() => setMultiplier(m => m + 1)} />\n                    </div>\n                )\n            }\n\n            const { container } = render(<Parent />)\n\n            expect(container.querySelector(\"span\")!.innerHTML).toBe(\"10\")\n            expect(counterRender).toBe(1)\n            expect(observerRender).toBe(1)\n\n            act(() => {\n                ;(container.querySelector(\"#inc\")! as any).click()\n            })\n            expect(container.querySelector(\"span\")!.innerHTML).toBe(\"11\")\n            expect(counterRender).toBe(1)\n            expect(observerRender).toBe(2)\n\n            act(() => {\n                ;(container.querySelector(\"#incmultiplier\")! as any).click()\n            })\n            expect(container.querySelector(\"span\")!.innerHTML).toBe(\"22\")\n            expect(counterRender).toBe(2)\n            expect(observerRender).toBe(4)\n        })\n\n        it(\"with observer()\", () => {\n            let counterRender = 0\n\n            const Counter = observer(({ multiplier }: { multiplier: number }) => {\n                counterRender++\n\n                const store = useLocalObservable(() => ({\n                    multiplier,\n                    count: 10,\n                    get multiplied() {\n                        return this.multiplier * this.count\n                    },\n                    inc() {\n                        this.count += 1\n                    }\n                }))\n                useEffect(() => {\n                    store.multiplier = multiplier\n                }, [multiplier])\n                return (\n                    <div>\n                        Multiplied count: <span>{store.multiplied}</span>\n                        <button id=\"inc\" onClick={store.inc}>\n                            Increment\n                        </button>\n                    </div>\n                )\n            })\n\n            function Parent() {\n                const [multiplier, setMultiplier] = useState(1)\n\n                return (\n                    <div>\n                        <Counter multiplier={multiplier} />\n                        <button id=\"incmultiplier\" onClick={() => setMultiplier(m => m + 1)} />\n                    </div>\n                )\n            }\n\n            const { container } = render(<Parent />)\n\n            expect(container.querySelector(\"span\")!.innerHTML).toBe(\"10\")\n            expect(counterRender).toBe(1)\n\n            act(() => {\n                ;(container.querySelector(\"#inc\")! as any).click()\n            })\n            expect(container.querySelector(\"span\")!.innerHTML).toBe(\"11\")\n            expect(counterRender).toBe(2)\n\n            act(() => {\n                ;(container.querySelector(\"#incmultiplier\")! as any).click()\n            })\n            expect(container.querySelector(\"span\")!.innerHTML).toBe(\"22\")\n            expect(counterRender).toBe(4) // One from props, second from updating local observable with effect\n        })\n    })\n})\n\ndescribe(\"enforcing actions\", () => {\n    it(\"'never' should work\", () => {\n        mobx.configure({ enforceActions: \"never\" })\n        consoleWarnMock = jest.spyOn(console, \"warn\").mockImplementation(() => {})\n\n        const onError = jest.fn()\n        const { result } = renderHook(\n            () => {\n                const [multiplier, setMultiplier] = React.useState(2)\n                const store = useLocalObservable(() => ({\n                    multiplier,\n                    count: 10,\n                    get multiplied() {\n                        return this.multiplier * this.count\n                    },\n                    inc() {\n                        this.count += 1\n                    }\n                }))\n                useEffect(() => {\n                    store.multiplier = multiplier\n                }, [multiplier])\n                useEffect(() => setMultiplier(3), [])\n            },\n            {\n                wrapper: class extends React.Component<React.PropsWithChildren> {\n                    componentDidCatch = onError\n                    render() {\n                        return this.props.children\n                    }\n                }\n            }\n        )\n\n        expect(onError).not.toHaveBeenCalled()\n        expect(consoleWarnMock).not.toHaveBeenCalled()\n    })\n    it(\"only when 'observed' should work\", () => {\n        mobx.configure({ enforceActions: \"observed\" })\n        consoleWarnMock = jest.spyOn(console, \"warn\").mockImplementation(() => {})\n\n        const onError = jest.fn()\n        renderHook(\n            () => {\n                const [multiplier, setMultiplier] = React.useState(2)\n                const store = useLocalObservable(() => ({\n                    multiplier,\n                    count: 10,\n                    get multiplied() {\n                        return this.multiplier * this.count\n                    },\n                    inc() {\n                        this.count += 1\n                    }\n                }))\n                useEffect(() => {\n                    store.multiplier = multiplier\n                }, [multiplier])\n                useEffect(() => setMultiplier(3), [])\n            },\n            {\n                wrapper: class extends React.Component<React.PropsWithChildren> {\n                    componentDidCatch = onError\n                    render() {\n                        return this.props.children\n                    }\n                }\n            }\n        )\n\n        expect(onError).not.toHaveBeenCalled()\n        expect(consoleWarnMock).not.toHaveBeenCalled()\n    })\n    it(\"'always' should work\", () => {\n        mobx.configure({ enforceActions: \"always\" })\n        consoleWarnMock = jest.spyOn(console, \"warn\").mockImplementation(() => {})\n\n        const onError = jest.fn()\n        renderHook(\n            () => {\n                const [multiplier, setMultiplier] = React.useState(2)\n                const store = useLocalObservable(() => ({\n                    multiplier,\n                    count: 10,\n                    get multiplied() {\n                        return this.multiplier * this.count\n                    },\n                    inc() {\n                        this.count += 1\n                    }\n                }))\n                useEffect(() => {\n                    store.multiplier = multiplier\n                }, [multiplier])\n                useEffect(() => setMultiplier(3), [])\n            },\n            {\n                wrapper: class extends React.Component<React.PropsWithChildren> {\n                    componentDidCatch = onError\n                    render() {\n                        return this.props.children\n                    }\n                }\n            }\n        )\n\n        expect(onError).not.toHaveBeenCalled()\n        expect(consoleWarnMock).toHaveBeenCalledTimes(2)\n    })\n})\n"
  },
  {
    "path": "packages/mobx-react-lite/__tests__/useLocalStore.deprecated.test.tsx",
    "content": "import * as React from \"react\"\nimport { act, cleanup, fireEvent, render } from \"@testing-library/react\"\n\nimport { Observer, observer, useLocalStore } from \"../src\"\nimport { useEffect, useState } from \"react\"\nimport { autorun } from \"mobx\"\n\nafterEach(cleanup)\n\nlet consoleWarnMock: jest.SpyInstance | undefined\nafterEach(() => {\n    consoleWarnMock?.mockRestore()\n})\n\ntest(\"base useLocalStore should work\", () => {\n    consoleWarnMock = jest.spyOn(console, \"warn\").mockImplementation(() => {})\n    let counterRender = 0\n    let observerRender = 0\n    let outerStoreRef: any\n\n    function Counter() {\n        counterRender++\n        const store = (outerStoreRef = useLocalStore(() => ({\n            count: 0,\n            count2: 0, // not used in render\n            inc() {\n                this.count += 1\n            }\n        })))\n\n        return (\n            <Observer>\n                {() => {\n                    observerRender++\n                    return (\n                        <div>\n                            Count: <span>{store.count}</span>\n                            <button onClick={store.inc}>Increment</button>\n                        </div>\n                    )\n                }}\n            </Observer>\n        )\n    }\n\n    const { container } = render(<Counter />)\n\n    expect(container.querySelector(\"span\")!.innerHTML).toBe(\"0\")\n    expect(counterRender).toBe(1)\n    expect(observerRender).toBe(1)\n\n    act(() => {\n        container.querySelector(\"button\")!.click()\n    })\n    expect(container.querySelector(\"span\")!.innerHTML).toBe(\"1\")\n    expect(counterRender).toBe(1)\n    expect(observerRender).toBe(2)\n\n    act(() => {\n        outerStoreRef.count++\n    })\n    expect(container.querySelector(\"span\")!.innerHTML).toBe(\"2\")\n    expect(counterRender).toBe(1)\n    expect(observerRender).toBe(3)\n\n    act(() => {\n        outerStoreRef.count2++\n    })\n    // No re-render!\n    expect(container.querySelector(\"span\")!.innerHTML).toBe(\"2\")\n    expect(counterRender).toBe(1)\n    expect(observerRender).toBe(3)\n    expect(consoleWarnMock).toMatchSnapshot()\n})\n\ndescribe(\"is used to keep observable within component body\", () => {\n    it(\"value can be changed over renders\", () => {\n        const TestComponent = () => {\n            const obs = useLocalStore(() => ({\n                x: 1,\n                y: 2\n            }))\n            return (\n                <div onClick={() => (obs.x += 1)}>\n                    {obs.x}-{obs.y}\n                </div>\n            )\n        }\n        const { container, rerender } = render(<TestComponent />)\n        const div = container.querySelector(\"div\")!\n        expect(div.textContent).toBe(\"1-2\")\n        fireEvent.click(div)\n        // observer not used, need to render from outside\n        rerender(<TestComponent />)\n        expect(div.textContent).toBe(\"2-2\")\n    })\n\n    it(\"works with observer as well\", () => {\n        let renderCount = 0\n\n        const TestComponent = observer(() => {\n            renderCount++\n\n            const obs = useLocalStore(() => ({\n                x: 1,\n                y: 2\n            }))\n            return (\n                <div onClick={() => (obs.x += 1)}>\n                    {obs.x}-{obs.y}\n                </div>\n            )\n        })\n        const { container } = render(<TestComponent />)\n        const div = container.querySelector(\"div\")!\n        expect(div.textContent).toBe(\"1-2\")\n        fireEvent.click(div)\n        expect(div.textContent).toBe(\"2-2\")\n        fireEvent.click(div)\n        expect(div.textContent).toBe(\"3-2\")\n\n        expect(renderCount).toBe(3)\n    })\n\n    it(\"actions can be used\", () => {\n        const TestComponent = observer(() => {\n            const obs = useLocalStore(() => ({\n                x: 1,\n                y: 2,\n                inc() {\n                    obs.x += 1\n                }\n            }))\n            return (\n                <div onClick={obs.inc}>\n                    {obs.x}-{obs.y}\n                </div>\n            )\n        })\n        const { container } = render(<TestComponent />)\n        const div = container.querySelector(\"div\")!\n        expect(div.textContent).toBe(\"1-2\")\n        fireEvent.click(div)\n        expect(div.textContent).toBe(\"2-2\")\n    })\n\n    it(\"computed properties works as well\", () => {\n        const TestComponent = observer(() => {\n            const obs = useLocalStore(() => ({\n                x: 1,\n                y: 2,\n                get z() {\n                    return obs.x + obs.y\n                }\n            }))\n            return <div onClick={() => (obs.x += 1)}>{obs.z}</div>\n        })\n        const { container } = render(<TestComponent />)\n        const div = container.querySelector(\"div\")!\n        expect(div.textContent).toBe(\"3\")\n        fireEvent.click(div)\n        expect(div.textContent).toBe(\"4\")\n    })\n\n    it(\"computed properties can use local functions\", () => {\n        const TestComponent = observer(() => {\n            const obs = useLocalStore(() => ({\n                x: 1,\n                y: 2,\n                getMeThatX() {\n                    return this.x\n                },\n                get z() {\n                    return this.getMeThatX() + obs.y\n                }\n            }))\n            return <div onClick={() => (obs.x += 1)}>{obs.z}</div>\n        })\n        const { container } = render(<TestComponent />)\n        const div = container.querySelector(\"div\")!\n        expect(div.textContent).toBe(\"3\")\n        fireEvent.click(div)\n        expect(div.textContent).toBe(\"4\")\n    })\n\n    it(\"transactions are respected\", () => {\n        const seen: number[] = []\n\n        const TestComponent = observer(() => {\n            const obs = useLocalStore(() => ({\n                x: 1,\n                inc(delta: number) {\n                    this.x += delta\n                    this.x += delta\n                }\n            }))\n\n            useEffect(\n                () =>\n                    autorun(() => {\n                        seen.push(obs.x)\n                    }),\n                []\n            )\n\n            return (\n                <div\n                    onClick={() => {\n                        obs.inc(2)\n                    }}\n                >\n                    Test\n                </div>\n            )\n        })\n        const { container } = render(<TestComponent />)\n        const div = container.querySelector(\"div\")!\n        fireEvent.click(div)\n        expect(seen).toEqual([1, 5]) // No 3!\n    })\n\n    it(\"Map can used instead of object\", () => {\n        const TestComponent = observer(() => {\n            const map = useLocalStore(() => new Map([[\"initial\", 10]]))\n            return (\n                <div onClick={() => map.set(\"later\", 20)}>\n                    {Array.from(map).map(([key, value]) => (\n                        <div key={key}>\n                            {key} - {value}\n                        </div>\n                    ))}\n                </div>\n            )\n        })\n        const { container } = render(<TestComponent />)\n        const div = container.querySelector(\"div\")!\n        expect(div.textContent).toBe(\"initial - 10\")\n        fireEvent.click(div)\n        expect(div.textContent).toBe(\"initial - 10later - 20\")\n    })\n\n    describe(\"with props\", () => {\n        it(\"and useObserver\", () => {\n            consoleWarnMock = jest.spyOn(console, \"warn\").mockImplementation(() => {})\n            let counterRender = 0\n            let observerRender = 0\n\n            function Counter({ multiplier }: { multiplier: number }) {\n                counterRender++\n\n                const store = useLocalStore(\n                    props => ({\n                        count: 10,\n                        get multiplied() {\n                            return props.multiplier * this.count\n                        },\n                        inc() {\n                            this.count += 1\n                        }\n                    }),\n                    { multiplier }\n                )\n\n                return (\n                    <Observer>\n                        {() => (\n                            observerRender++,\n                            (\n                                <div>\n                                    Multiplied count: <span>{store.multiplied}</span>\n                                    <button id=\"inc\" onClick={store.inc}>\n                                        Increment\n                                    </button>\n                                </div>\n                            )\n                        )}\n                    </Observer>\n                )\n            }\n\n            function Parent() {\n                const [multiplier, setMultiplier] = useState(1)\n\n                return (\n                    <div>\n                        <Counter multiplier={multiplier} />\n                        <button id=\"incmultiplier\" onClick={() => setMultiplier(m => m + 1)} />\n                    </div>\n                )\n            }\n\n            const { container } = render(<Parent />)\n\n            expect(container.querySelector(\"span\")!.innerHTML).toBe(\"10\")\n            expect(counterRender).toBe(1)\n            expect(observerRender).toBe(1)\n\n            act(() => {\n                ;(container.querySelector(\"#inc\")! as any).click()\n            })\n            expect(container.querySelector(\"span\")!.innerHTML).toBe(\"11\")\n            expect(counterRender).toBe(1) // or 2\n            expect(observerRender).toBe(2)\n\n            act(() => {\n                ;(container.querySelector(\"#incmultiplier\")! as any).click()\n            })\n            expect(container.querySelector(\"span\")!.innerHTML).toBe(\"22\")\n            expect(counterRender).toBe(2)\n            expect(observerRender).toBe(4)\n            expect(consoleWarnMock).toMatchSnapshot()\n        })\n\n        it(\"with <Observer>\", () => {\n            let counterRender = 0\n            let observerRender = 0\n\n            function Counter({ multiplier }: { multiplier: number }) {\n                counterRender++\n\n                const store = useLocalStore(\n                    props => ({\n                        count: 10,\n                        get multiplied() {\n                            return props.multiplier * this.count\n                        },\n                        inc() {\n                            this.count += 1\n                        }\n                    }),\n                    { multiplier }\n                )\n\n                return (\n                    <Observer>\n                        {() => {\n                            observerRender++\n                            return (\n                                <div>\n                                    Multiplied count: <span>{store.multiplied}</span>\n                                    <button id=\"inc\" onClick={store.inc}>\n                                        Increment\n                                    </button>\n                                </div>\n                            )\n                        }}\n                    </Observer>\n                )\n            }\n\n            function Parent() {\n                const [multiplier, setMultiplier] = useState(1)\n\n                return (\n                    <div>\n                        <Counter multiplier={multiplier} />\n                        <button id=\"incmultiplier\" onClick={() => setMultiplier(m => m + 1)} />\n                    </div>\n                )\n            }\n\n            const { container } = render(<Parent />)\n\n            expect(container.querySelector(\"span\")!.innerHTML).toBe(\"10\")\n            expect(counterRender).toBe(1)\n            expect(observerRender).toBe(1)\n\n            act(() => {\n                ;(container.querySelector(\"#inc\")! as any).click()\n            })\n            expect(container.querySelector(\"span\")!.innerHTML).toBe(\"11\")\n            expect(counterRender).toBe(1)\n            expect(observerRender).toBe(2)\n\n            act(() => {\n                ;(container.querySelector(\"#incmultiplier\")! as any).click()\n            })\n            expect(container.querySelector(\"span\")!.innerHTML).toBe(\"22\")\n            expect(counterRender).toBe(2)\n            expect(observerRender).toBe(4)\n        })\n\n        it(\"with observer()\", () => {\n            let counterRender = 0\n\n            const Counter = observer(({ multiplier }: { multiplier: number }) => {\n                counterRender++\n\n                const store = useLocalStore(\n                    props => ({\n                        count: 10,\n                        get multiplied() {\n                            return props.multiplier * this.count\n                        },\n                        inc() {\n                            this.count += 1\n                        }\n                    }),\n                    { multiplier }\n                )\n\n                return (\n                    <div>\n                        Multiplied count: <span>{store.multiplied}</span>\n                        <button id=\"inc\" onClick={store.inc}>\n                            Increment\n                        </button>\n                    </div>\n                )\n            })\n\n            function Parent() {\n                const [multiplier, setMultiplier] = useState(1)\n\n                return (\n                    <div>\n                        <Counter multiplier={multiplier} />\n                        <button id=\"incmultiplier\" onClick={() => setMultiplier(m => m + 1)} />\n                    </div>\n                )\n            }\n\n            const { container } = render(<Parent />)\n\n            expect(container.querySelector(\"span\")!.innerHTML).toBe(\"10\")\n            expect(counterRender).toBe(1)\n\n            act(() => {\n                ;(container.querySelector(\"#inc\")! as any).click()\n            })\n            expect(container.querySelector(\"span\")!.innerHTML).toBe(\"11\")\n            expect(counterRender).toBe(2)\n\n            act(() => {\n                ;(container.querySelector(\"#incmultiplier\")! as any).click()\n            })\n            expect(container.querySelector(\"span\")!.innerHTML).toBe(\"22\")\n            expect(counterRender).toBe(4) // One from props, second from updating source (setState during render)\n        })\n    })\n})\n"
  },
  {
    "path": "packages/mobx-react-lite/__tests__/utils/killFinalizationRegistry.ts",
    "content": "// We want to be able to test reaction cleanup code that based on FinalizationRegistry & timers on the same run\n// For that we import this file on the beginning on the timer based test to the feature detection will pick the timers impl\n// @ts-ignore\nglobal.FinalizationRegistry = undefined\n"
  },
  {
    "path": "packages/mobx-react-lite/__tests__/utils.ts",
    "content": "import { configure } from \"mobx\"\n\nexport function resetMobx(): void {\n    configure({ enforceActions: \"never\" })\n}\n\nexport function enableDevEnvironment() {\n    process.env.NODE_ENV === \"development\"\n    return function () {\n        process.env.NODE_ENV === \"production\"\n    }\n}\n\nexport function sleep(time: number) {\n    return new Promise<void>(res => {\n        setTimeout(res, time)\n    })\n}\n"
  },
  {
    "path": "packages/mobx-react-lite/batchingForReactDom.js",
    "content": "if (\"production\" !== process.env.NODE_ENV) {\n    console.warn(\"[mobx-react-lite] importing batchingForReactDom is no longer needed\")\n}\n"
  },
  {
    "path": "packages/mobx-react-lite/batchingForReactNative.js",
    "content": "if (\"production\" !== process.env.NODE_ENV) {\n    console.warn(\"[mobx-react-lite] importing batchingForReactNative is no longer needed\")\n}\n"
  },
  {
    "path": "packages/mobx-react-lite/batchingOptOut.js",
    "content": "if (\"production\" !== process.env.NODE_ENV) {\n    console.warn(\"[mobx-react-lite] importing batchingOptOut is no longer needed\")\n}\n"
  },
  {
    "path": "packages/mobx-react-lite/jest.config.js",
    "content": "const buildConfig = require(\"../../jest.base.config\")\n\nmodule.exports = buildConfig(__dirname, {\n    testRegex: \"__tests__/.*\\\\.tsx?$\",\n    setupFilesAfterEnv: [`<rootDir>/jest.setup.ts`],\n    testPathIgnorePatterns: [\"node_modules\", \"<rootDir>/__tests__/utils\"]\n})\n"
  },
  {
    "path": "packages/mobx-react-lite/jest.setup.ts",
    "content": "import \"@testing-library/jest-dom/extend-expect\"\nimport { configure } from \"mobx\"\n\nglobal.setImmediate = global.setImmediate || ((fn, ...args) => global.setTimeout(fn, 0, ...args))\n\nconfigure({ enforceActions: \"never\" })\n\n// @ts-ignore\nglobal.__DEV__ = true\n"
  },
  {
    "path": "packages/mobx-react-lite/package.json",
    "content": "{\n    \"name\": \"mobx-react-lite\",\n    \"version\": \"4.1.1\",\n    \"description\": \"Lightweight React bindings for MobX based on React 16.8+ and Hooks\",\n    \"source\": \"src/index.ts\",\n    \"main\": \"dist/index.js\",\n    \"umd:main\": \"dist/mobxreact.umd.production.min.js\",\n    \"unpkg\": \"dist/mobxreactlite.umd.production.min.js\",\n    \"jsdelivr\": \"dist/mobxreactlite.umd.production.min.js\",\n    \"jsnext:main\": \"dist/mobxreactlite.esm.production.min.js\",\n    \"module\": \"es/index.js\",\n    \"react-native\": \"es/index.js\",\n    \"types\": \"dist/index.d.ts\",\n    \"typings\": \"dist/index.d.ts\",\n    \"files\": [\n        \"src\",\n        \"dist/\",\n        \"lib/\",\n        \"es/\",\n        \"LICENSE\",\n        \"CHANGELOG.md\",\n        \"README.md\",\n        \"batching*\"\n    ],\n    \"repository\": {\n        \"type\": \"git\",\n        \"url\": \"https://github.com/mobxjs/mobx.git\"\n    },\n    \"author\": \"Daniel K.\",\n    \"license\": \"MIT\",\n    \"funding\": {\n        \"type\": \"opencollective\",\n        \"url\": \"https://opencollective.com/mobx\"\n    },\n    \"bugs\": {\n        \"url\": \"https://github.com/mobxjs/mobx/issues\"\n    },\n    \"homepage\": \"https://mobx.js.org\",\n    \"dependencies\": {\n        \"use-sync-external-store\": \"^1.4.0\"\n    },\n    \"peerDependencies\": {\n        \"mobx\": \"^6.9.0\",\n        \"react\": \"^16.8.0 || ^17 || ^18 || ^19\"\n    },\n    \"peerDependenciesMeta\": {\n        \"react-dom\": {\n            \"optional\": true\n        },\n        \"react-native\": {\n            \"optional\": true\n        }\n    },\n    \"devDependencies\": {\n        \"mobx\": \"^6.15.0\",\n        \"expose-gc\": \"^1.0.0\"\n    },\n    \"keywords\": [\n        \"mobx\",\n        \"mobservable\",\n        \"react-component\",\n        \"react\",\n        \"reactjs\",\n        \"reactive\",\n        \"hooks\",\n        \"observer\",\n        \"useLocalObservable\"\n    ],\n    \"scripts\": {\n        \"lint\": \"eslint src/**/* --ext .js,.ts,.tsx\",\n        \"build\": \"node ../../scripts/build.js mobxReactLite\",\n        \"build:test\": \"yarn build --target test\",\n        \"build:cjs\": \"tsc --project tsconfig.build.cjs.json\",\n        \"build:es\": \"tsc --project tsconfig.build.es.json\",\n        \"test\": \"jest\",\n        \"test:size\": \"yarn import-size --report . observer useLocalObservable\",\n        \"test:types\": \"tsc --noEmit\",\n        \"test:check\": \"yarn test:types\",\n        \"prepublishOnly\": \"cd ../mobx && yarn build --target publish && cd ../mobx-react-lite && yarn build --target publish && yarn build:cjs && yarn build:es\"\n    }\n}\n"
  },
  {
    "path": "packages/mobx-react-lite/src/ObserverComponent.ts",
    "content": "import { useObserver } from \"./useObserver\"\n\n// TODO: this type could be improved in the next major release:\n// type IObserverProps = { children: () => React.ReactNode, render?: never } | { children?: never, render: () => React.ReactNode }\ninterface IObserverProps {\n    children?(): React.ReactElement | null\n    render?(): React.ReactElement | null\n}\n\nfunction ObserverComponent({ children, render }: IObserverProps) {\n    if (children && render) {\n        console.error(\n            \"MobX Observer: Do not use children and render in the same time in `Observer`\"\n        )\n    }\n    const component = children || render\n    if (typeof component !== \"function\") {\n        return null\n    }\n    return useObserver(component)\n}\nif (\"production\" !== process.env.NODE_ENV) {\n    ObserverComponent.propTypes = {\n        children: ObserverPropsCheck,\n        render: ObserverPropsCheck\n    }\n}\nObserverComponent.displayName = \"Observer\"\n\nexport { ObserverComponent as Observer }\n\nfunction ObserverPropsCheck(\n    props: { [k: string]: any },\n    key: string,\n    componentName: string,\n    location: any,\n    propFullName: string\n) {\n    const extraKey = key === \"children\" ? \"render\" : \"children\"\n    const hasProp = typeof props[key] === \"function\"\n    const hasExtraProp = typeof props[extraKey] === \"function\"\n    if (hasProp && hasExtraProp) {\n        return new Error(\n            \"MobX Observer: Do not use children and render in the same time in`\" + componentName\n        )\n    }\n\n    if (hasProp || hasExtraProp) {\n        return null\n    }\n    return new Error(\n        \"Invalid prop `\" +\n            propFullName +\n            \"` of type `\" +\n            typeof props[key] +\n            \"` supplied to\" +\n            \" `\" +\n            componentName +\n            \"`, expected `function`.\"\n    )\n}\n"
  },
  {
    "path": "packages/mobx-react-lite/src/index.ts",
    "content": "import \"./utils/assertEnvironment\"\n\nimport { unstable_batchedUpdates as batch } from \"./utils/reactBatchedUpdates\"\nimport { observerBatching } from \"./utils/observerBatching\"\nimport { useDeprecated } from \"./utils/utils\"\nimport { useObserver as useObserverOriginal } from \"./useObserver\"\nimport { enableStaticRendering } from \"./staticRendering\"\nimport { observerFinalizationRegistry } from \"./utils/observerFinalizationRegistry\"\n\nobserverBatching(batch)\n\nexport { isUsingStaticRendering, enableStaticRendering } from \"./staticRendering\"\nexport { observer, IObserverOptions } from \"./observer\"\nexport { Observer } from \"./ObserverComponent\"\nexport { useLocalObservable } from \"./useLocalObservable\"\nexport { useLocalStore } from \"./useLocalStore\"\nexport { useAsObservableSource } from \"./useAsObservableSource\"\n\nexport { observerFinalizationRegistry as _observerFinalizationRegistry }\nexport const clearTimers = observerFinalizationRegistry[\"finalizeAllImmediately\"] ?? (() => {})\n\nexport function useObserver<T>(fn: () => T, baseComponentName: string = \"observed\"): T {\n    if (\"production\" !== process.env.NODE_ENV) {\n        useDeprecated(\n            \"[mobx-react-lite] 'useObserver(fn)' is deprecated. Use `<Observer>{fn}</Observer>` instead, or wrap the entire component in `observer`.\"\n        )\n    }\n    return useObserverOriginal(fn, baseComponentName)\n}\n\nexport { isObserverBatched, observerBatching } from \"./utils/observerBatching\"\n\nexport function useStaticRendering(enable: boolean) {\n    if (\"production\" !== process.env.NODE_ENV) {\n        console.warn(\n            \"[mobx-react-lite] 'useStaticRendering' is deprecated, use 'enableStaticRendering' instead\"\n        )\n    }\n    enableStaticRendering(enable)\n}\n"
  },
  {
    "path": "packages/mobx-react-lite/src/observer.ts",
    "content": "import { forwardRef, memo } from \"react\"\n\nimport { isUsingStaticRendering } from \"./staticRendering\"\nimport { useObserver } from \"./useObserver\"\n\nlet warnObserverOptionsDeprecated = true\nlet warnLegacyContextTypes = true\n\nconst hasSymbol = typeof Symbol === \"function\" && Symbol.for\nconst isFunctionNameConfigurable =\n    Object.getOwnPropertyDescriptor(() => {}, \"name\")?.configurable ?? false\n\n// Using react-is had some issues (and operates on elements, not on types), see #608 / #609\nconst ReactForwardRefSymbol = hasSymbol\n    ? Symbol.for(\"react.forward_ref\")\n    : typeof forwardRef === \"function\" && forwardRef((props: any) => null)[\"$$typeof\"]\n\nconst ReactMemoSymbol = hasSymbol\n    ? Symbol.for(\"react.memo\")\n    : typeof memo === \"function\" && memo((props: any) => null)[\"$$typeof\"]\n\n/**\n * @deprecated Observer options will be removed in the next major version of mobx-react-lite.\n * Look at the individual properties for alternatives.\n */\nexport interface IObserverOptions {\n    /**\n     * @deprecated Pass a `React.forwardRef` component to observer instead of using the options object\n     * e.g. `observer(React.forwardRef(fn))`\n     */\n    readonly forwardRef?: boolean\n}\n\nexport function observer<P extends object, TRef = {}>(\n    baseComponent: React.ForwardRefRenderFunction<TRef, P>,\n    options: IObserverOptions & {\n        /**\n         * @deprecated Pass a `React.forwardRef` component to observer instead of using the options object\n         * e.g. `observer(React.forwardRef(fn))`\n         */\n        forwardRef: true\n    }\n): React.MemoExoticComponent<\n    React.ForwardRefExoticComponent<React.PropsWithoutRef<P> & React.RefAttributes<TRef>>\n>\n\nexport function observer<P extends object>(\n    baseComponent: React.FunctionComponent<P>,\n    options?: IObserverOptions\n): React.FunctionComponent<P>\n\nexport function observer<P extends object, TRef = {}>(\n    baseComponent: React.ForwardRefExoticComponent<\n        React.PropsWithoutRef<P> & React.RefAttributes<TRef>\n    >\n): React.MemoExoticComponent<\n    React.ForwardRefExoticComponent<React.PropsWithoutRef<P> & React.RefAttributes<TRef>>\n>\nexport function observer<\n    C extends React.FunctionComponent<any> | React.ForwardRefRenderFunction<any>,\n    Options extends IObserverOptions\n>(\n    baseComponent: C,\n    options?: Options\n): Options extends { forwardRef: true }\n    ? C extends React.ForwardRefRenderFunction<infer TRef, infer P>\n        ? C &\n              React.MemoExoticComponent<\n                  React.ForwardRefExoticComponent<\n                      React.PropsWithoutRef<P> & React.RefAttributes<TRef>\n                  >\n              >\n        : never /* forwardRef set for a non forwarding component */\n    : C & { displayName: string }\n\n// n.b. base case is not used for actual typings or exported in the typing files\nexport function observer<P extends object, TRef = {}>(\n    baseComponent:\n        | React.ForwardRefRenderFunction<TRef, P>\n        | React.FunctionComponent<P>\n        | React.ForwardRefExoticComponent<React.PropsWithoutRef<P> & React.RefAttributes<TRef>>,\n    // TODO remove in next major\n    options?: IObserverOptions\n) {\n    if (process.env.NODE_ENV !== \"production\" && warnObserverOptionsDeprecated && options) {\n        warnObserverOptionsDeprecated = false\n        console.warn(\n            `[mobx-react-lite] \\`observer(fn, { forwardRef: true })\\` is deprecated, use \\`observer(React.forwardRef(fn))\\``\n        )\n    }\n\n    if (ReactMemoSymbol && baseComponent[\"$$typeof\"] === ReactMemoSymbol) {\n        throw new Error(\n            `[mobx-react-lite] You are trying to use \\`observer\\` on a function component wrapped in either another \\`observer\\` or \\`React.memo\\`. The observer already applies 'React.memo' for you.`\n        )\n    }\n\n    // The working of observer is explained step by step in this talk: https://www.youtube.com/watch?v=cPF4iBedoF0&feature=youtu.be&t=1307\n    if (isUsingStaticRendering()) {\n        return baseComponent\n    }\n\n    let useForwardRef = options?.forwardRef ?? false\n    let render = baseComponent\n\n    const baseComponentName = baseComponent.displayName || baseComponent.name\n\n    // If already wrapped with forwardRef, unwrap,\n    // so we can patch render and apply memo\n    if (ReactForwardRefSymbol && baseComponent[\"$$typeof\"] === ReactForwardRefSymbol) {\n        useForwardRef = true\n        render = baseComponent[\"render\"]\n        if (typeof render !== \"function\") {\n            throw new Error(\n                `[mobx-react-lite] \\`render\\` property of ForwardRef was not a function`\n            )\n        }\n    }\n\n    let observerComponent = (props: any, ref: React.Ref<TRef>) => {\n        return useObserver(() => render(props, ref), baseComponentName)\n    }\n\n    // Inherit original name and displayName, see #3438\n    ;(observerComponent as React.FunctionComponent).displayName = baseComponent.displayName\n\n    if (isFunctionNameConfigurable) {\n        Object.defineProperty(observerComponent, \"name\", {\n            value: baseComponent.name,\n            writable: true,\n            configurable: true\n        })\n    }\n\n    // Support legacy context: `contextTypes` must be applied before `memo`\n    if ((baseComponent as any).contextTypes) {\n        ;(observerComponent as React.FunctionComponent).contextTypes = (\n            baseComponent as any\n        ).contextTypes\n\n        if (process.env.NODE_ENV !== \"production\" && warnLegacyContextTypes) {\n            warnLegacyContextTypes = false\n            console.warn(\n                `[mobx-react-lite] Support for Legacy Context in function components will be removed in the next major release.`\n            )\n        }\n    }\n\n    if (useForwardRef) {\n        // `forwardRef` must be applied prior `memo`\n        // `forwardRef(observer(cmp))` throws:\n        // \"forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...))\"\n        observerComponent = forwardRef(observerComponent)\n    }\n\n    // memo; we are not interested in deep updates\n    // in props; we assume that if deep objects are changed,\n    // this is in observables, which would have been tracked anyway\n    observerComponent = memo(observerComponent)\n\n    copyStaticProperties(baseComponent, observerComponent)\n\n    if (\"production\" !== process.env.NODE_ENV) {\n        Object.defineProperty(observerComponent, \"contextTypes\", {\n            set() {\n                throw new Error(\n                    `[mobx-react-lite] \\`${\n                        this.displayName || this.type?.displayName || this.type?.name || \"Component\"\n                    }.contextTypes\\` must be set before applying \\`observer\\`.`\n                )\n            }\n        })\n    }\n\n    return observerComponent\n}\n\n// based on https://github.com/mridgway/hoist-non-react-statics/blob/master/src/index.js\nconst hoistBlackList: any = {\n    $$typeof: true,\n    render: true,\n    compare: true,\n    type: true,\n    // Don't redefine `displayName`,\n    // it's defined as getter-setter pair on `memo` (see #3192).\n    displayName: true\n}\n\nfunction copyStaticProperties(base: any, target: any) {\n    Object.keys(base).forEach(key => {\n        if (!hoistBlackList[key]) {\n            Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(base, key)!)\n        }\n    })\n}\n"
  },
  {
    "path": "packages/mobx-react-lite/src/staticRendering.ts",
    "content": "let globalIsUsingStaticRendering = false\n\nexport function enableStaticRendering(enable: boolean) {\n    globalIsUsingStaticRendering = enable\n}\n\nexport function isUsingStaticRendering(): boolean {\n    return globalIsUsingStaticRendering\n}\n"
  },
  {
    "path": "packages/mobx-react-lite/src/useAsObservableSource.ts",
    "content": "import { useDeprecated } from \"./utils/utils\"\nimport { observable, runInAction } from \"mobx\"\nimport { useState } from \"react\"\n\nexport function useAsObservableSource<TSource extends object>(current: TSource): TSource {\n    if (\"production\" !== process.env.NODE_ENV)\n        useDeprecated(\n            \"[mobx-react-lite] 'useAsObservableSource' is deprecated, please store the values directly in an observable, for example by using 'useLocalObservable', and sync future updates using 'useEffect' when needed. See the README for examples.\"\n        )\n    // We're deliberately not using idiomatic destructuring for the hook here.\n    // Accessing the state value as an array element prevents TypeScript from generating unnecessary helpers in the resulting code.\n    // For further details, please refer to mobxjs/mobx#3842.\n    const res = useState(() => observable(current, {}, { deep: false }))[0]\n    runInAction(() => {\n        Object.assign(res, current)\n    })\n    return res\n}\n"
  },
  {
    "path": "packages/mobx-react-lite/src/useLocalObservable.ts",
    "content": "import { observable, AnnotationsMap } from \"mobx\"\nimport { useState } from \"react\"\n\nexport function useLocalObservable<TStore extends Record<string, any>>(\n    initializer: () => TStore,\n    annotations?: AnnotationsMap<TStore, never>\n): TStore {\n    return useState(() => observable(initializer(), annotations, { autoBind: true }))[0]\n}\n"
  },
  {
    "path": "packages/mobx-react-lite/src/useLocalStore.ts",
    "content": "import { observable } from \"mobx\"\nimport { useState } from \"react\"\n\nimport { useDeprecated } from \"./utils/utils\"\nimport { useAsObservableSource } from \"./useAsObservableSource\"\n\nexport function useLocalStore<TStore extends Record<string, any>>(initializer: () => TStore): TStore\nexport function useLocalStore<TStore extends Record<string, any>, TSource extends object>(\n    initializer: (source: TSource) => TStore,\n    current: TSource\n): TStore\nexport function useLocalStore<TStore extends Record<string, any>, TSource extends object>(\n    initializer: (source?: TSource) => TStore,\n    current?: TSource\n): TStore {\n    if (\"production\" !== process.env.NODE_ENV) {\n        useDeprecated(\n            \"[mobx-react-lite] 'useLocalStore' is deprecated, use 'useLocalObservable' instead.\"\n        )\n    }\n    const source = current && useAsObservableSource(current)\n    return useState(() => observable(initializer(source), undefined, { autoBind: true }))[0]\n}\n"
  },
  {
    "path": "packages/mobx-react-lite/src/useObserver.ts",
    "content": "import { Reaction } from \"mobx\"\nimport React from \"react\"\nimport { printDebugValue } from \"./utils/printDebugValue\"\nimport { isUsingStaticRendering } from \"./staticRendering\"\nimport { observerFinalizationRegistry } from \"./utils/observerFinalizationRegistry\"\nimport { useSyncExternalStore } from \"use-sync-external-store/shim\"\n\n// Do not store `admRef` (even as part of a closure!) on this object,\n// otherwise it will prevent GC and therefore reaction disposal via FinalizationRegistry.\ntype ObserverAdministration = {\n    reaction: Reaction | null // also serves as disposed flag\n    onStoreChange: Function | null // also serves as mounted flag\n    // stateVersion that 'ticks' for every time the reaction fires\n    // tearing is still present,\n    // because there is no cross component synchronization,\n    // but we can use `useSyncExternalStore` API.\n    // TODO: optimize to use number?\n    stateVersion: any\n    name: string\n    // These don't depend on state/props, therefore we can keep them here instead of `useCallback`\n    subscribe: Parameters<typeof React.useSyncExternalStore>[0]\n    getSnapshot: Parameters<typeof React.useSyncExternalStore>[1]\n}\n\nfunction createReaction(adm: ObserverAdministration) {\n    adm.reaction = new Reaction(`observer${adm.name}`, () => {\n        adm.stateVersion = Symbol()\n        // onStoreChange won't be available until the component \"mounts\".\n        // If state changes in between initial render and mount,\n        // `useSyncExternalStore` should handle that by checking the state version and issuing update.\n        adm.onStoreChange?.()\n    })\n}\n\nexport function useObserver<T>(render: () => T, baseComponentName: string = \"observed\"): T {\n    if (isUsingStaticRendering()) {\n        return render()\n    }\n\n    const admRef = React.useRef<ObserverAdministration | null>(null)\n\n    if (!admRef.current) {\n        // First render\n        const adm: ObserverAdministration = {\n            reaction: null,\n            onStoreChange: null,\n            stateVersion: Symbol(),\n            name: baseComponentName,\n            subscribe(onStoreChange: () => void) {\n                // Do NOT access admRef here!\n                observerFinalizationRegistry.unregister(adm)\n                adm.onStoreChange = onStoreChange\n                if (!adm.reaction) {\n                    // We've lost our reaction and therefore all subscriptions, occurs when:\n                    // 1. Timer based finalization registry disposed reaction before component mounted.\n                    // 2. React \"re-mounts\" same component without calling render in between (typically <StrictMode>).\n                    // We have to recreate reaction and schedule re-render to recreate subscriptions,\n                    // even if state did not change.\n                    createReaction(adm)\n                    // `onStoreChange` won't force update if subsequent `getSnapshot` returns same value.\n                    // So we make sure that is not the case\n                    adm.stateVersion = Symbol()\n                }\n\n                return () => {\n                    // Do NOT access admRef here!\n                    adm.onStoreChange = null\n                    adm.reaction?.dispose()\n                    adm.reaction = null\n                }\n            },\n            getSnapshot() {\n                // Do NOT access admRef here!\n                return adm.stateVersion\n            }\n        }\n\n        admRef.current = adm\n    }\n\n    const adm = admRef.current!\n\n    if (!adm.reaction) {\n        // First render or reaction was disposed by registry before subscribe\n        createReaction(adm)\n        // StrictMode/ConcurrentMode/Suspense may mean that our component is\n        // rendered and abandoned multiple times, so we need to track leaked\n        // Reactions.\n        observerFinalizationRegistry.register(admRef, adm, adm)\n    }\n\n    React.useDebugValue(adm.reaction!, printDebugValue)\n\n    useSyncExternalStore(\n        // Both of these must be stable, otherwise it would keep resubscribing every render.\n        adm.subscribe,\n        adm.getSnapshot,\n        adm.getSnapshot\n    )\n\n    // render the original component, but have the\n    // reaction track the observables, so that rendering\n    // can be invalidated (see above) once a dependency changes\n    let renderResult!: T\n    let exception\n    adm.reaction!.track(() => {\n        try {\n            renderResult = render()\n        } catch (e) {\n            exception = e\n        }\n    })\n\n    if (exception) {\n        throw exception // re-throw any exceptions caught during rendering\n    }\n\n    return renderResult\n}\n"
  },
  {
    "path": "packages/mobx-react-lite/src/utils/UniversalFinalizationRegistry.ts",
    "content": "export declare class FinalizationRegistryType<T> {\n    constructor(finalize: (value: T) => void)\n    register(target: object, value: T, token?: object): void\n    unregister(token: object): void\n}\n\ndeclare const FinalizationRegistry: typeof FinalizationRegistryType | undefined\n\nexport const REGISTRY_FINALIZE_AFTER = 10_000\nexport const REGISTRY_SWEEP_INTERVAL = 10_000\n\nexport class TimerBasedFinalizationRegistry<T> implements FinalizationRegistryType<T> {\n    private registrations: Map<unknown, { value: T; registeredAt: number }> = new Map()\n    private sweepTimeout: ReturnType<typeof setTimeout> | undefined\n\n    constructor(private readonly finalize: (value: T) => void) {}\n\n    // Token is actually required with this impl\n    register(target: object, value: T, token?: object) {\n        this.registrations.set(token, {\n            value,\n            registeredAt: Date.now()\n        })\n        this.scheduleSweep()\n    }\n\n    unregister(token: unknown) {\n        this.registrations.delete(token)\n    }\n\n    // Bound so it can be used directly as setTimeout callback.\n    sweep = (maxAge = REGISTRY_FINALIZE_AFTER) => {\n        // cancel timeout so we can force sweep anytime\n        clearTimeout(this.sweepTimeout)\n        this.sweepTimeout = undefined\n\n        const now = Date.now()\n        this.registrations.forEach((registration, token) => {\n            if (now - registration.registeredAt >= maxAge) {\n                this.finalize(registration.value)\n                this.registrations.delete(token)\n            }\n        })\n\n        if (this.registrations.size > 0) {\n            this.scheduleSweep()\n        }\n    }\n\n    // Bound so it can be exported directly as clearTimers test utility.\n    finalizeAllImmediately = () => {\n        this.sweep(0)\n    }\n\n    private scheduleSweep() {\n        if (this.sweepTimeout === undefined) {\n            this.sweepTimeout = setTimeout(this.sweep, REGISTRY_SWEEP_INTERVAL)\n        }\n    }\n}\n\nexport const UniversalFinalizationRegistry =\n    typeof FinalizationRegistry !== \"undefined\"\n        ? FinalizationRegistry\n        : TimerBasedFinalizationRegistry\n"
  },
  {
    "path": "packages/mobx-react-lite/src/utils/assertEnvironment.ts",
    "content": "import { makeObservable } from \"mobx\"\nimport { useState } from \"react\"\n\nif (!useState) {\n    throw new Error(\"mobx-react-lite requires React with Hooks support\")\n}\nif (!makeObservable) {\n    throw new Error(\"mobx-react-lite@3 requires mobx at least version 6 to be available\")\n}\n"
  },
  {
    "path": "packages/mobx-react-lite/src/utils/observerBatching.ts",
    "content": "import { configure } from \"mobx\"\n\nexport function defaultNoopBatch(callback: () => void) {\n    callback()\n}\n\nexport function observerBatching(reactionScheduler: any) {\n    if (!reactionScheduler) {\n        reactionScheduler = defaultNoopBatch\n        if (\"production\" !== process.env.NODE_ENV) {\n            console.warn(\n                \"[MobX] Failed to get unstable_batched updates from react-dom / react-native\"\n            )\n        }\n    }\n    configure({ reactionScheduler })\n}\n\nexport const isObserverBatched = () => {\n    if (\"production\" !== process.env.NODE_ENV) {\n        console.warn(\"[MobX] Deprecated\")\n    }\n\n    return true\n}\n"
  },
  {
    "path": "packages/mobx-react-lite/src/utils/observerFinalizationRegistry.ts",
    "content": "import { Reaction } from \"mobx\"\nimport { UniversalFinalizationRegistry } from \"./UniversalFinalizationRegistry\"\n\nexport const observerFinalizationRegistry = new UniversalFinalizationRegistry(\n    (adm: { reaction: Reaction | null }) => {\n        adm.reaction?.dispose()\n        adm.reaction = null\n    }\n)\n"
  },
  {
    "path": "packages/mobx-react-lite/src/utils/printDebugValue.ts",
    "content": "import { getDependencyTree, Reaction } from \"mobx\"\n\nexport function printDebugValue(v: Reaction) {\n    return getDependencyTree(v)\n}\n"
  },
  {
    "path": "packages/mobx-react-lite/src/utils/reactBatchedUpdates.native.ts",
    "content": "// @ts-ignore\nexport { unstable_batchedUpdates } from \"react-native\"\n"
  },
  {
    "path": "packages/mobx-react-lite/src/utils/reactBatchedUpdates.ts",
    "content": "export { unstable_batchedUpdates } from \"react-dom\"\n"
  },
  {
    "path": "packages/mobx-react-lite/src/utils/utils.ts",
    "content": "const deprecatedMessages: string[] = []\n\nexport function useDeprecated(msg: string) {\n    if (!deprecatedMessages.includes(msg)) {\n        deprecatedMessages.push(msg)\n        console.warn(msg)\n    }\n}\n"
  },
  {
    "path": "packages/mobx-react-lite/tsconfig.build.cjs.json",
    "content": "{\n    \"extends\": \"./tsconfig.build.json\",\n    \"compilerOptions\": {\n        \"outDir\": \"lib\",\n        \"module\": \"CommonJS\"\n    }\n}\n"
  },
  {
    "path": "packages/mobx-react-lite/tsconfig.build.es.json",
    "content": "{\n    \"extends\": \"./tsconfig.build.json\",\n    \"compilerOptions\": {\n        \"outDir\": \"es\",\n        \"module\": \"ESNext\"\n    }\n}\n"
  },
  {
    "path": "packages/mobx-react-lite/tsconfig.build.json",
    "content": "{\n    \"extends\": \"./tsconfig.json\",\n    \"compilerOptions\": {\n        \"esModuleInterop\": true,\n        \"target\": \"ES5\",\n        \"noEmit\": false,\n        \"declaration\": false\n    }\n}\n"
  },
  {
    "path": "packages/mobx-react-lite/tsconfig.json",
    "content": "{\n    \"extends\": \"../../tsconfig.json\",\n    \"compilerOptions\": {\n        \"rootDir\": \"src\",\n        \"lib\": [\"ESNext\", \"DOM\"]\n    },\n    \"include\": [\"src\"]\n}\n"
  },
  {
    "path": "packages/mobx-react-lite/tsconfig.test.json",
    "content": "{\n    \"extends\": \"../../tsconfig.test.json\",\n    \"compilerOptions\": {\n        \"lib\": [\"esnext\", \"dom\"]\n    }\n}\n"
  },
  {
    "path": "packages/mobx-react-lite/tsdx.config.js",
    "content": "module.exports = {\n    rollup(config) {\n        return {\n            ...config,\n            output: {\n                ...config.output,\n                globals: {\n                    react: \"React\",\n                    mobx: \"mobx\",\n                    \"react-dom\": \"ReactDOM\"\n                }\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "packages/mobx-undecorate/CHANGELOG.md",
    "content": "# mobx-undecorate\n\n## 1.3.0\n\n### Minor Changes\n\n-   [`c8f3b081`](https://github.com/mobxjs/mobx/commit/c8f3b0817fd74644e285909e2a40cea45a5cc013) [#3478](https://github.com/mobxjs/mobx/pull/3478) Thanks [@urugator](https://github.com/urugator)! - partial fix #3460: replace `action` with `override` if field uses override keyword\n\n### Patch Changes\n\n-   [`988aa3a1`](https://github.com/mobxjs/mobx/commit/988aa3a198f0e0fd33623cb21b33d75db6b2f70a) [#3617](https://github.com/mobxjs/mobx/pull/3617) Thanks [@urugator](https://github.com/urugator)! - fix: preserve non-null assertion operator on undecorated props\n\n## 1.2.0\n\n### Minor Changes\n\n-   [`be5684b2`](https://github.com/mobxjs/mobx/commit/be5684b2421ab7c72bb9a2bdc2f40761e9c53c41) [#3164](https://github.com/mobxjs/mobx/pull/3164) Thanks [@Grsmto](https://github.com/Grsmto)! - add support for default export classes + fix eslint-plugin-react compatibility\n\n## 1.1.1\n\n### Patch Changes\n\n-   [`6273bfb8`](https://github.com/mobxjs/mobx/commit/6273bfb8076347687010cbd046dc740f5744e691) [#3145](https://github.com/mobxjs/mobx/pull/3145) Thanks [@urugator](https://github.com/urugator)! - fix #3142 allow white spaces in cwd\n\n## 1.1.0\n\n### Minor Changes\n\n-   [`737cc0bf`](https://github.com/mobxjs/mobx/commit/737cc0bf7ae787ec6c36e1550772a574f67e87d5) [#2818](https://github.com/mobxjs/mobx/pull/2818) Thanks [@jeremy-coleman](https://github.com/jeremy-coleman)! - modify cli to use system path for jscodeshift instead of relative path\n\n## 1.0.7\n\n### Patch Changes\n\n-   [`c6b1c5d4`](https://github.com/mobxjs/mobx/commit/c6b1c5d4062c332cb09fcb6c64ec1d2dee69a7a2) [#2785](https://github.com/mobxjs/mobx/pull/2785) Thanks [@iChenLei](https://github.com/iChenLei)! - add parseTsAsNonJsx flag for mobx-undecorate\n\n## 1.0.6\n\n### Patch Changes\n\n-   [`3f5087c0`](https://github.com/mobxjs/mobx/commit/3f5087c000cb92ef3c234af365db747e35487c10) [#2767](https://github.com/mobxjs/mobx/pull/2767) Thanks [@iChenLei](https://github.com/iChenLei)! - mobx-undecorate don't crash when node's loc is null\n\n## 1.0.5\n\n### Patch Changes\n\n-   [`695108c3`](https://github.com/mobxjs/mobx/commit/695108c38d60a05cc9cef01b07e06109b1333017) [#2727](https://github.com/mobxjs/mobx/pull/2727) Thanks [@vkrol](https://github.com/vkrol)! - Do not create generic arguments if `keepDecorators` passed\n\n## 1.0.4\n\n### Patch Changes\n\n-   [`88d3e886`](https://github.com/mobxjs/mobx/commit/88d3e88656ad0add08039ede42041102b895a95e) Thanks [@urugator](https://github.com/urugator)! - Fix [#2540](https://github.com/mobxjs/mobx/issues/2540) makeObservable not added to imports\n\n*   [`88d3e886`](https://github.com/mobxjs/mobx/commit/88d3e88656ad0add08039ede42041102b895a95e) Thanks [@urugator](https://github.com/urugator)! - Fix [#2558](https://github.com/mobxjs/mobx/issues/2558) Undecorate removes non-mobx decorator\n\n## 1.0.2\n\n-   Fixed support for JSX\n"
  },
  {
    "path": "packages/mobx-undecorate/LICENSE",
    "content": "The MIT License (MIT)\n\nCopyright (c) 2015 Michel Weststrate\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": "packages/mobx-undecorate/README.md",
    "content": "# mobx-undecorate\n\nUpdate MobX 4/5 code to be conformant to MobX 6.\n\nTo run this codemod:\n\n-   Go to your source files directory\n-   Run `npx mobx-undecorate`\n\nThe following MobX 4/5 APIs will be converted to their MobX 6 equivalents:\n\n-   `@computed`\n-   `@action`\n-   `@observable`\n-   `@observer`\n-   `@inject`\n-   `decorate`\n\n### Options\n\nThe following flags are accepted:\n\n-   `--ignoreImports`: normally the codemod will only convert decorators if they are imported from a MobX package, using import statements like `import {observable} from \"mobx\"`. This flag ignores checking for imports statements and converts all `@computed`, `@action`, `@observable`, `@observer` and `@inject` calls.\n-   `--keepDecorators`: don't rewrite decorators but keep them as they are, and generate the required `makeObservable` calls. Use this option if you intend to keep using decorators after updating to MobX 6.\n-   `--decoratorsAfterExport`: set this flag only if you have `decoratorsBeforeExport: false` in your Babel configuration, otherwise you will get an error like: `SyntaxError: Decorators must be placed *before* the 'export' keyword. You can set the 'decoratorsBeforeExport' option to false`.\n-   `--parseTsAsNonJsx`: parse ts file as non-jsx, and other file as same as before. see more details -> [mobxjs/mobx#issues2754](https://github.com/mobxjs/mobx/issues/2754)\n"
  },
  {
    "path": "packages/mobx-undecorate/__tests__/cli.spec.tsx",
    "content": "import { execSync } from \"child_process\"\nimport { join, dirname } from \"path\"\nimport { readFileSync, writeFileSync, mkdirSync } from \"fs\"\nconst dedent = require(\"dedent-js\")\n\ntest(\"run cli #2506 #3142\", () => {\n    // #3142 - the white space must be in cwd\n    const cwd = join(__dirname, \"fixtures\", \"some path\")\n    const testFile = join(cwd, \"some file.tsx\")\n    const baseContent = dedent(`import { observable } from \"mobx\";\n    class Test {\n        @observable x = 1;\n    }\n    `)\n    mkdirSync(dirname(testFile), { recursive: true })\n    writeFileSync(testFile, baseContent)\n    execSync(\"node ../../../cli.js\", { cwd })\n    expect(readFileSync(testFile, \"utf8\")).toMatchInlineSnapshot(`\n        \"import { observable, makeObservable } from \"mobx\";\n        class Test {\n            x = 1;\n\n            constructor() {\n                makeObservable(this, {\n                    x: observable\n                });\n            }\n        }\"\n    `)\n})\n\ntest(\"run cli with --parseTsAsNonJsx #2754\", () => {\n    const testNonJsxFile = join(__dirname, \"fixtures\", \"some nonjsx\", \"some nonjsx.ts\")\n    const testJsxFile = join(__dirname, \"fixtures\", \"some nonjsx\", \"some jsx.tsx\")\n    const nonJsxContent = dedent(`\n        import { useSearch } from \"./useSearch\"\n        import { observable } from \"mobx\"\n\n        class Test {\n            @observable x = 1\n        }\n        \n        export function useAlias(): string {\n            const parsedSearch = useSearch()\n            return (<string>parsedSearch.alias || \"\").toUpperCase()\n        }\n    `)\n    const jsxContent = dedent(`\n        import React from 'react'\n        import {observer} from 'mobx-react'\n        \n        @observer\n        class X extends React.Component {\n            render() {\n                return <div>hi</div>\n            }\n        }\n    `)\n\n    mkdirSync(dirname(testNonJsxFile), { recursive: true })\n    writeFileSync(testNonJsxFile, nonJsxContent)\n    writeFileSync(testJsxFile, jsxContent)\n    execSync(\"node ../../cli.js --parseTsAsNonJsx\", {\n        cwd: join(__dirname, \"fixtures\")\n    })\n    expect(readFileSync(testNonJsxFile, \"utf8\")).toMatchInlineSnapshot(`\n        \"import { useSearch } from \"./useSearch\"\n        import { observable, makeObservable } from \"mobx\";\n\n        class Test {\n            x = 1;\n\n            constructor() {\n                makeObservable(this, {\n                    x: observable\n                });\n            }\n        }\n\n        export function useAlias(): string {\n            const parsedSearch = useSearch()\n            return (<string>parsedSearch.alias || \"\").toUpperCase()\n        }\"\n    `)\n    expect(readFileSync(testJsxFile, \"utf8\")).toMatchInlineSnapshot(`\n        \"import React from 'react'\n        import {observer} from 'mobx-react'\n\n        const X = observer(class X extends React.Component {\n            render() {\n                return <div>hi</div>\n            }\n        });\"\n    `)\n})\n"
  },
  {
    "path": "packages/mobx-undecorate/__tests__/fixtures/.gitignore",
    "content": "*some*"
  },
  {
    "path": "packages/mobx-undecorate/__tests__/tsconfig.json",
    "content": "{\n    \"extends\": \"../../../tsconfig.test.json\"\n}\n"
  },
  {
    "path": "packages/mobx-undecorate/__tests__/undecorate.spec.ts",
    "content": "import { applyTransform } from \"jscodeshift/dist/testUtils\"\nconst dedent = require(\"dedent-js\")\nimport * as u from \"../src/undecorate\"\n\nfunction convert(\n    source: string,\n    options: {\n        ignoreImports?: boolean\n        keepDecorators?: boolean\n        decoratorsAfterExport?: boolean\n    } = {}\n): string {\n    return applyTransform(u, options, { source: dedent(source), path: \"unittest\" }, {})\n}\n\ndescribe(\"general\", () => {\n    test(\"basic observable\", () => {\n        expect(\n            convert(`import { observable } from \"mobx\"\n\n  class Box {\n      /*0*/\n      @observable\n      /*1*/\n      field /*2 */ = /*3*/ 1 /*4*/\n  }`)\n        ).toMatchInlineSnapshot(`\n            \"import { observable, makeObservable } from \"mobx\";\n\n            class Box {\n                /*0*/\n                /*1*/\n                field /*2 */ = /*3*/ 1; /*4*/\n\n                constructor() {\n                    makeObservable(this, {\n                        field: observable\n                    });\n                }\n            }\"\n        `)\n    })\n\n    test(\"basic observable - skip imports\", () => {\n        expect(\n            convert(\n                `\n  class Box {\n      /*0*/\n      @observable\n      /*1*/\n      field /*2 */ = /*3*/ 1 /*4*/\n  }`,\n                { ignoreImports: true }\n            )\n        ).toMatchInlineSnapshot(`\n            \"class Box {\n                /*0*/\n                /*1*/\n                field /*2 */ = /*3*/ 1; /*4*/\n\n                constructor() {\n                    makeObservable(this, {\n                        field: observable\n                    });\n                }\n            }\"\n        `)\n    })\n\n    test(\"basic observable - skip imports - keepDecorators\", () => {\n        expect(\n            convert(\n                `\n  class Box {\n      /*0*/\n      @observable\n      /*1*/\n      field /*2 */ = /*3*/ 1 /*4*/\n  }`,\n                { ignoreImports: true, keepDecorators: true }\n            )\n        ).toMatchInlineSnapshot(`\n            \"class Box {\n                /*0*/\n                @observable\n                /*1*/\n                field /*2 */ = /*3*/ 1 /*4*/\n\n                constructor() {\n                    makeObservable(this);\n                }\n            }\"\n        `)\n    })\n\n    test(\"class with method and extends\", () => {\n        expect(\n            convert(`\n          import { observable } from \"mobx\"\n\n          class ExtendsHasMethod extends Box {\n              @observable x = 1\n\n              // test\n              method() {\n                  console.log(\"hi\")\n              }\n          }\n        `)\n        ).toMatchInlineSnapshot(`\n            \"import { observable, makeObservable } from \"mobx\";\n\n            class ExtendsHasMethod extends Box {\n                x = 1;\n\n                constructor() {\n                    // TODO: [mobx-undecorate] verify the constructor arguments and the arguments of this automatically generated super call\n                    super();\n\n                    makeObservable(this, {\n                        x: observable\n                    });\n                }\n\n                // test\n                method() {\n                    console.log(\"hi\")\n                }\n            }\"\n        `)\n    })\n\n    test(\"class with constructor\", () => {\n        expect(\n            convert(`\n          import { observable } from \"mobx\"\n\n          class ExtendsHasConstructor {\n              @observable x = 1\n\n              constructor() {\n                  console.log(\"hi\")\n              }\n          }`)\n        ).toMatchInlineSnapshot(`\n            \"import { observable, makeObservable } from \"mobx\";\n\n            class ExtendsHasConstructor {\n                x = 1;\n\n                constructor() {\n                    makeObservable(this, {\n                        x: observable\n                    });\n\n                    console.log(\"hi\")\n                }\n            }\"\n        `)\n    })\n\n    test(\"extended class with constructor\", () => {\n        expect(\n            convert(`\n          import { observable } from \"mobx\"\n\n          class ExtendsHasConstructorSuper extends Box {\n              @observable x = 1\n\n              constructor() {\n                  super()\n                  console.log(\"hi\")\n              }\n          }\n        `)\n        ).toMatchInlineSnapshot(`\n            \"import { observable, makeObservable } from \"mobx\";\n\n            class ExtendsHasConstructorSuper extends Box {\n                x = 1;\n\n                constructor() {\n                    super()\n\n                    makeObservable(this, {\n                        x: observable\n                    });\n\n                    console.log(\"hi\")\n                }\n            }\"\n        `)\n    })\n})\n\ndescribe(\"action\", () => {\n    test(\"field - bound - named\", () => {\n        expect(\n            convert(`\n            import { action } from \"mobx\"\n\n            class Box {\n                @action.bound(\"test\")\n                x = (arg: number) => {\n                    console.log('hi')\n                }\n            }\n            `)\n        ).toMatchInlineSnapshot(`\n            \"import { action, makeObservable } from \"mobx\";\n\n            class Box {\n                x = (arg: number) => {\n                    console.log('hi')\n                };\n\n                constructor() {\n                    makeObservable(this, {\n                        x: action.bound(\"test\")\n                    });\n                }\n            }\"\n        `)\n    })\n\n    test(\"method - bound - named\", () => {\n        expect(\n            convert(`\n            import { action } from \"mobx\"\n\n            class Box {\n                @action.bound(\"test\")\n                async x(arg: number): boolean {\n                    console.log('hi')\n                    return true\n                }\n            }\n            `)\n        ).toMatchInlineSnapshot(`\n            \"import { action, makeObservable } from \"mobx\";\n\n            class Box {\n                constructor() {\n                    makeObservable(this, {\n                        x: action.bound(\"test\")\n                    });\n                }\n\n                async x(arg: number): boolean {\n                    console.log('hi')\n                    return true\n                }\n            }\"\n        `)\n    })\n\n    test(\"method - bound - named - generator\", () => {\n        expect(\n            convert(`\n            import { action } from \"mobx\"\n\n            class Box {\n                @action.bound(\"test\")\n                * x(arg: number): boolean {\n                    console.log('hi')\n                    return true\n                }\n            }\n            `)\n        ).toMatchInlineSnapshot(`\n            \"import { action, makeObservable } from \"mobx\";\n\n            class Box {\n                constructor() {\n                    makeObservable(this, {\n                        x: action.bound(\"test\")\n                    });\n                }\n\n                *x(arg: number): boolean {\n                    console.log('hi')\n                    return true\n                }\n            }\"\n        `)\n    })\n\n    test(\"field - named\", () => {\n        expect(\n            convert(`\n            import { action } from \"mobx\"\n\n            class Box {\n                @action(\"test\")\n                x = async (arg: number): boolean => {\n                    console.log('hi')\n                    return true\n                }\n            }\n            `)\n        ).toMatchInlineSnapshot(`\n            \"import { action, makeObservable } from \"mobx\";\n\n            class Box {\n                x = async (arg: number): boolean => {\n                    console.log('hi')\n                    return true\n                };\n\n                constructor() {\n                    makeObservable(this, {\n                        x: action(\"test\")\n                    });\n                }\n            }\"\n        `)\n    })\n\n    test(\"field - unnamed\", () => {\n        expect(\n            convert(`\n            import { action } from \"mobx\"\n\n            class Box {\n                @action\n                x = (arg: number): boolean => {\n                    console.log('hi')\n                    return true\n                }\n            }\n            `)\n        ).toMatchInlineSnapshot(`\n            \"import { action, makeObservable } from \"mobx\";\n\n            class Box {\n                x = (arg: number): boolean => {\n                    console.log('hi')\n                    return true\n                };\n\n                constructor() {\n                    makeObservable(this, {\n                        x: action\n                    });\n                }\n            }\"\n        `)\n    })\n\n    test(\"method - bound - unnamed\", () => {\n        expect(\n            convert(`\n            import { action } from \"mobx\"\n\n            class Box {\n                @action.bound\n                x (arg: number): boolean {\n                    console.log('hi')\n                    return true\n                }\n            }\n            `)\n        ).toMatchInlineSnapshot(`\n            \"import { action, makeObservable } from \"mobx\";\n\n            class Box {\n                constructor() {\n                    makeObservable(this, {\n                        x: action.bound\n                    });\n                }\n\n                x(arg: number): boolean {\n                    console.log('hi')\n                    return true\n                }\n            }\"\n        `)\n    })\n\n    test(\"method - unbound - named\", () => {\n        expect(\n            convert(`\n            import { action } from \"mobx\"\n\n            class Box {\n                @action(\"test\")\n                x (arg: number): boolean {\n                    console.log('hi')\n                    return true\n                }\n            }\n            `)\n        ).toMatchInlineSnapshot(`\n            \"import { action, makeObservable } from \"mobx\";\n\n            class Box {\n                constructor() {\n                    makeObservable(this, {\n                        x: action(\"test\")\n                    });\n                }\n\n                x(arg: number): boolean {\n                    console.log('hi')\n                    return true\n                }\n            }\"\n        `)\n    })\n\n    test(\"method - unbound - unnamed\", () => {\n        expect(\n            convert(`\n            import { action } from \"mobx\"\n\n            class Box {\n                @action\n                x (arg: number): boolean {\n                    console.log('hi')\n                    return true\n                }\n            }\n            `)\n        ).toMatchInlineSnapshot(`\n            \"import { action, makeObservable } from \"mobx\";\n\n            class Box {\n                constructor() {\n                    makeObservable(this, {\n                        x: action\n                    });\n                }\n\n                x(arg: number): boolean {\n                    console.log('hi')\n                    return true\n                }\n            }\"\n        `)\n    })\n\n    test(\"method - unbound - computed name\", () => {\n        expect(\n            convert(`\n            import { action } from \"mobx\"\n\n            class Box {\n                @action\n                ['x' + 'y'](arg: number): boolean {\n                    console.log('hi')\n                    return true\n                }\n            }\n            `)\n        ).toMatchInlineSnapshot(`\n            \"import { action, makeObservable } from \"mobx\";\n\n            class Box {\n                constructor() {\n                    makeObservable(this, {\n                        ['x' + 'y']: action\n                    });\n                }\n\n                ['x' + 'y'](arg: number): boolean {\n                    console.log('hi')\n                    return true\n                }\n            }\"\n        `)\n    })\n\n    test(\"method - override\", () => {\n        expect(\n            convert(`\n            import { action } from \"mobx\"\n\n            class Box extends Shape {\n                constructor(arg) {\n                    super(arg)\n                }\n\n                @action\n                override method(arg: number): boolean {\n                    console.log('hi')\n                    return true\n                }\n            }\n            `)\n        ).toMatchInlineSnapshot(`\n            \"import { action, override, makeObservable } from \"mobx\";\n\n            class Box extends Shape {\n                constructor(arg) {\n                    super(arg)\n\n                    makeObservable(this, {\n                        method: override\n                    });\n                }\n\n                override method(arg: number): boolean {\n                    console.log('hi')\n                    return true\n                }\n            }\"\n        `)\n    })\n\n    test(\"method - override - keepDecorators\", () => {\n        expect(\n            convert(\n                `\n            import { action } from \"mobx\"\n\n            class Box extends Shape {\n                constructor(arg) {\n                    super(arg)\n                }\n\n                @action\n                override method(arg: number): boolean {\n                    console.log('hi')\n                    return true\n                }\n            }\n            `,\n                { keepDecorators: true }\n            )\n        ).toMatchInlineSnapshot(`\n            \"import { action, override, makeObservable } from \"mobx\";\n\n            class Box extends Shape {\n                constructor(arg) {\n                    super(arg)\n                    makeObservable(this);\n                }\n\n                @override\n                override method(arg: number): boolean {\n                    console.log('hi')\n                    return true\n                }\n            }\"\n        `)\n    })\n})\n\ndescribe(\"observable\", () => {\n    test(\"observable \", () => {\n        expect(\n            convert(`\n      import { observable } from \"mobx\"\n\n      class Box {\n          @observable x = 1\n      }\n    `)\n        ).toMatchInlineSnapshot(`\n            \"import { observable, makeObservable } from \"mobx\";\n\n            class Box {\n                x = 1;\n\n                constructor() {\n                    makeObservable(this, {\n                        x: observable\n                    });\n                }\n            }\"\n        `)\n    })\n\n    test(\"observable - shallow \", () => {\n        expect(\n            convert(`\n          import { observable } from \"mobx\"\n\n          class Box {\n            @observable.shallow x = 1\n        }\n        `)\n        ).toMatchInlineSnapshot(`\n            \"import { observable, makeObservable } from \"mobx\";\n\n              class Box {\n                x = 1;\n\n                constructor() {\n                  makeObservable(this, {\n                    x: observable.shallow\n                  });\n                }\n              }\"\n        `)\n    })\n\n    test(\"observable - shallow - computed name \", () => {\n        expect(\n            convert(`\n              import { observable } from \"mobx\"\n\n              class Box {\n                @observable.shallow ['x'] = 1\n            }\n            `)\n        ).toMatchInlineSnapshot(`\n            \"import { observable, makeObservable } from \"mobx\";\n\n              class Box {\n                ['x'] = 1;\n\n                constructor() {\n                  makeObservable(this, {\n                    [\"x\"]: observable.shallow\n                  });\n                }\n              }\"\n        `)\n    })\n})\n\ndescribe(\"computed\", () => {\n    test(\"computed \", () => {\n        expect(\n            convert(`\n      import { computed } from \"mobx\"\n\n      class Box {\n          @computed get x() {\n              return 1;\n          }\n      }\n    `)\n        ).toMatchInlineSnapshot(`\n            \"import { computed, makeObservable } from \"mobx\";\n\n            class Box {\n                constructor() {\n                    makeObservable(this, {\n                        x: computed\n                    });\n                }\n\n                get x() {\n                    return 1;\n                }\n            }\"\n        `)\n    })\n\n    test(\"computed - setter\", () => {\n        expect(\n            convert(`\n      import { computed } from \"mobx\"\n\n      class Box {\n          @computed get x() {\n              return 1;\n          }\n          set x(v) {\n              console.log(v)\n          }\n      }\n    `)\n        ).toMatchInlineSnapshot(`\n            \"import { computed, makeObservable } from \"mobx\";\n\n            class Box {\n                constructor() {\n                    makeObservable(this, {\n                        x: computed\n                    });\n                }\n\n                get x() {\n                    return 1;\n                }\n                set x(v) {\n                    console.log(v)\n                }\n            }\"\n        `)\n    })\n\n    test(\"computed - setter - options\", () => {\n        expect(\n            convert(`\n      import { computed } from \"mobx\"\n\n      class Box {\n          @computed({ name: \"test\" }) get x() {\n              return 1;\n          }\n          set y(z) {\n              console.log(\"wrong\");\n          }\n          set x(v) {\n              console.log(v)\n          }\n      }\n    `)\n        ).toMatchInlineSnapshot(`\n            \"import { computed, makeObservable } from \"mobx\";\n\n            class Box {\n                constructor() {\n                    makeObservable(this, {\n                        x: computed({ name: \"test\" })\n                    });\n                }\n\n                get x() {\n                    return 1;\n                }\n                set y(z) {\n                    console.log(\"wrong\");\n                }\n                set x(v) {\n                    console.log(v)\n                }\n            }\"\n        `)\n    })\n\n    test(\"computed - setter - struct\", () => {\n        expect(\n            convert(`\n      import { computed } from \"mobx\"\n\n      class Box {\n          @computed.struct get x() {\n              return 1;\n          }\n          set x(v) {\n              console.log(v)\n          }\n      }\n    `)\n        ).toMatchInlineSnapshot(`\n            \"import { computed, makeObservable } from \"mobx\";\n\n            class Box {\n                constructor() {\n                    makeObservable(this, {\n                        x: computed.struct\n                    });\n                }\n\n                get x() {\n                    return 1;\n                }\n                set x(v) {\n                    console.log(v)\n                }\n            }\"\n        `)\n    })\n})\n\ndescribe(\"decorate\", () => {\n    test(\"basic\", () => {\n        expect(\n            convert(`\n            import { observable, decorate, computed, action } from \"mobx\"\n\n            class Box {\n                width = 3\n                height = 2\n\n                // gets the size of the thing\n                get size() {\n                    return this.width * this.height\n                }\n\n                // make it twice as large\n                double() {\n                    this.width *= 2;\n                }\n            }\n\n            decorate(Box, {\n                width: observable,\n                height: observable.shallow,\n                size: computed,\n                double: action\n            })\n        `)\n        ).toMatchInlineSnapshot(`\n            \"import { observable, computed, action, makeObservable } from \"mobx\"\n\n            class Box {\n                width = 3\n                height = 2\n\n                constructor() {\n                    makeObservable(this, {\n                        width: observable,\n                        height: observable.shallow,\n                        size: computed,\n                        double: action\n                    });\n                }\n\n                // gets the size of the thing\n                get size() {\n                    return this.width * this.height\n                }\n\n                // make it twice as large\n                double() {\n                    this.width *= 2;\n                }\n            }\"\n        `)\n    })\n\n    test(\"multiple targets\", () => {\n        expect(\n            convert(`\n            import { observable, decorate, computed, action } from \"mobx\"\n\n            test(\"a\", () => {\n                class Box {\n                    width = 3\n                }\n\n                decorate(Box, {\n                    width: observable,\n                })\n            })\n\n            test(\"b\", () => {\n                class Box {\n                    method() {}\n                }\n\n                decorate(Box, {\n                    method: action\n                })\n            })\n        `)\n        ).toMatchInlineSnapshot(`\n            \"import { observable, computed, action, makeObservable } from \"mobx\"\n\n            test(\"a\", () => {\n                class Box {\n                    width = 3\n\n                    constructor() {\n                        makeObservable(this, {\n                            width: observable,\n                        });\n                    }\n                }\n            })\n\n            test(\"b\", () => {\n                class Box {\n                    constructor() {\n                        makeObservable(this, {\n                            method: action\n                        });\n                    }\n\n                    method() {}\n                }\n            })\"\n        `)\n    })\n\n    test(\"handle undeclared observable members\", () => {\n        expect(\n            convert(`\n            import { observable, decorate, computed, action } from \"mobx\"\n\n            class Box {\n\n            }\n\n            decorate(Box, {\n                // stuff\n                width: observable,\n                height: observable.shallow,\n            })\n        `)\n        ).toMatchInlineSnapshot(`\n            \"import { observable, computed, action, makeObservable } from \"mobx\"\n\n            class Box {\n                constructor() {\n                    makeObservable(this, {\n                        // stuff\n                        width: observable,\n                        height: observable.shallow,\n                    });\n                }\n            }\"\n        `)\n    })\n\n    test(\"handle non-classes - 1\", () => {\n        expect(\n            convert(`\n            import { observable, decorate, computed, action } from \"mobx\"\n\n            const box = {\n\n            }\n\n            decorate(box, {\n                width: observable,\n                height: observable.shallow,\n            })\n        `)\n        ).toMatchInlineSnapshot(`\n            \"import { observable, computed, action, makeObservable } from \"mobx\"\n\n            const box = {\n\n            }\n\n            makeObservable(box, {\n                width: observable,\n                height: observable.shallow,\n            })\"\n        `)\n    })\n\n    test(\"handle non-classes - 2\", () => {\n        expect(\n            convert(`\n            import { observable, decorate, computed, action } from \"mobx\"\n\n            decorate({}, {\n                width: observable,\n                height: observable.shallow,\n            })\n        `)\n        ).toMatchInlineSnapshot(`\n            \"import { observable, computed, action, makeObservable } from \"mobx\"\n\n            makeObservable({}, {\n                width: observable,\n                height: observable.shallow,\n            })\"\n        `)\n    })\n})\n\ndescribe(\"privates\", () => {\n    test(\"create generic arguments for makeObservable\", () => {\n        expect(\n            convert(\n                `\n                import { observable, decorate, computed, action } from \"mobx\"\n    \n    class TryToGetThis {\n        @observable\n        private privateField1: number = 1\n        @observable\n        protected privateField2 = 1\n        @observable\n        public publicField: string = \"test\"\n      }\n                `\n            )\n        ).toMatchInlineSnapshot(`\n            \"import { observable, computed, action, makeObservable } from \"mobx\"\n\n            class TryToGetThis {\n                        private privateField1: number = 1;\n                        protected privateField2 = 1;\n                        public publicField: string = \"test\";\n\n                        constructor() {\n                                    makeObservable<TryToGetThis, \"privateField1\" | \"privateField2\">(this, {\n                                                privateField1: observable,\n                                                privateField2: observable,\n                                                publicField: observable\n                                    });\n                        }\n            }\"\n        `)\n    })\n\n    test(\"do not create generic arguments for makeObservable - keepDecorators\", () => {\n        expect(\n            convert(\n                `\n                import { observable, decorate, computed, action } from \"mobx\"\n    \n    class TryToGetThis {\n        @observable\n        private privateField1: number = 1\n        @observable\n        protected privateField2 = 1\n        @observable\n        public publicField: string = \"test\"\n      }\n                `,\n                {\n                    keepDecorators: true\n                }\n            )\n        ).toMatchInlineSnapshot(`\n            \"import { observable, computed, action, makeObservable } from \"mobx\"\n\n            class TryToGetThis {\n                        @observable\n                        private privateField1: number = 1\n                        @observable\n                        protected privateField2 = 1\n                        @observable\n                        public publicField: string = \"test\"\n\n                        constructor() {\n                                    makeObservable(this);\n                        }\n            }\"\n        `)\n    })\n})\n\ndescribe(\"@observer\", () => {\n    test(\"class comp\", () => {\n        expect(\n            convert(`\n        import {observer} from 'mobx-react'\n\n        /* 1 */\n        @observer /* 2 */ class X extends React.Component {\n            render() {\n                return <div>hi</div>\n            }\n        }\n\n        `)\n        ).toMatchInlineSnapshot(`\n            \"import {observer} from 'mobx-react'\n\n            /* 1 */\n            const X = observer(class /* 2 */ X extends React.Component {\n                render() {\n                    return <div>hi</div>\n                }\n            });\"\n        `)\n    })\n\n    test(\"class comp with export before\", () => {\n        expect(\n            convert(`\n        import {observer} from 'mobx-react-lite'\n\n\n        /* 1 */\n        @observer /* 2 */ export /* 3 */ class X extends React.Component {\n\n        }\n\n        `)\n        ).toMatchInlineSnapshot(`\n            \"import {observer} from 'mobx-react-lite'\n\n\n            /* 1 */\n            export const X = observer(class /* 2 */ /* 3 */ X extends React.Component {\n\n            });\"\n        `)\n    })\n\n    test(\"class comp with export after\", () => {\n        expect(\n            convert(\n                `\n        import {observer} from 'mobx-react-lite'\n\n\n        /* 1 */\n        export /* 2 */ @observer /* 3 */ class X extends React.Component {\n\n        }\n\n        `,\n                { decoratorsAfterExport: true }\n            )\n        ).toMatchInlineSnapshot(`\n            \"import {observer} from 'mobx-react-lite'\n\n\n            /* 1 */\n            export const X = observer(class /* 2 */ /* 3 */ X extends React.Component {\n\n            });\"\n        `)\n    })\n\n    test(\"class comp with inject\", () => {\n        expect(\n            convert(`\n        import {observer, inject} from 'mobx-react'\n\n\n        /* 1 */\n        @inject(\"test\") /* 2 */ export /* 3 */ class X extends React.Component {\n\n        }\n\n        `)\n        ).toMatchInlineSnapshot(`\n            \"import {observer, inject} from 'mobx-react'\n\n\n            /* 1 */\n            export const X = inject(\"test\")(class /* 2 */ /* 3 */ X extends React.Component {\n\n            });\"\n        `)\n    })\n\n    test(\"class comp with inject and observer\", () => {\n        expect(\n            convert(`\n        import {observer, inject} from 'mobx-react'\n\n\n        /* 1 */\n        @inject(\"test\") @observer /* 2 */ export /* 3 */ class X extends React.Component {\n\n        }\n\n        `)\n        ).toMatchInlineSnapshot(`\n            \"import {observer, inject} from 'mobx-react'\n\n\n            /* 1 */\n            export const X = inject(\"test\")(observer(class /* 2 */ /* 3 */ X extends React.Component {\n\n            }));\"\n        `)\n    })\n\n    test(\"class comp with local fields - 1\", () => {\n        expect(\n            convert(\n                `\n        import {observer, inject} from 'mobx-react'\n        import {observable} from \"mobx\"\n        import {Component} from \"react\"\n\n        @observer class X extends React.Component {\n            @observable field =  1\n        }\n\n        `,\n                { keepDecorators: false }\n            )\n        ).toMatchInlineSnapshot(`\n            \"import {observer, inject} from 'mobx-react'\n            import { observable, makeObservable } from \"mobx\";\n            import {Component} from \"react\"\n\n            const X = observer(class X extends React.Component {\n                field = 1;\n\n                constructor(props) {\n                    super(props);\n\n                    makeObservable(this, {\n                        field: observable\n                    });\n                }\n            });\"\n        `)\n    })\n\n    test(\"class comp with local fields preserves Props generic\", () => {\n        expect(\n            convert(\n                `\n        import {observer, inject} from 'mobx-react'\n        import {observable} from \"mobx\"\n        import {PureComponent} from \"react\"\n\n        @observer class X extends PureComponent<{x: boolean}> {\n            @observable field =  1\n        }\n\n        `,\n                { keepDecorators: false }\n            )\n        ).toMatchInlineSnapshot(`\n            \"import {observer, inject} from 'mobx-react'\n            import { observable, makeObservable } from \"mobx\";\n            import {PureComponent} from \"react\"\n\n            const X = observer(class X extends PureComponent<{x: boolean}> {\n                field = 1;\n\n                constructor(props: {x: boolean}) {\n                    super(props);\n\n                    makeObservable(this, {\n                        field: observable\n                    });\n                }\n            });\"\n        `)\n    })\n\n    test(\"class comp with local fields preserves Props generic\", () => {\n        expect(\n            convert(\n                `\n        import {observer, inject} from 'mobx-react'\n        import {observable} from \"mobx\"\n        import {PureComponent} from \"react\"\n\n        @observer class X extends PureComponent<{x: boolean}> {\n            @observable field =  1\n        }\n\n        `,\n                { keepDecorators: true }\n            )\n        ).toMatchInlineSnapshot(`\n            \"import {observer, inject} from 'mobx-react'\n            import { observable, makeObservable } from \"mobx\";\n            import {PureComponent} from \"react\"\n\n            @observer class X extends PureComponent<{x: boolean}> {\n                @observable field =  1\n\n                constructor(props: {x: boolean}) {\n                    super(props);\n                    makeObservable(this);\n                }\n            }\"\n        `)\n    })\n\n    test(\"makeObservable gets added to the non-type import #2415\", () => {\n        expect(\n            convert(\n                `\n        import type { IReactionDisposer } from 'mobx';\n        import { reaction, observable } from 'mobx';\n\n        export default class Store {\n            @observable counter = 0;\n\n            removeReaction: IReactionDisposer;\n\n            constructor() {\n                this.removeReaction = reaction(() => this.counter, () => {\n                    console.log('it changed');\n                });\n            }\n\n            cleanup() {\n                this.removeReaction();\n            }\n        }\n        `\n            )\n        ).toMatchInlineSnapshot(`\n            \"import type { IReactionDisposer } from 'mobx';\n            import { reaction, observable, makeObservable } from 'mobx';\n\n            export default class Store {\n                counter = 0;\n\n                removeReaction: IReactionDisposer;\n\n                constructor() {\n                    makeObservable(this, {\n                        counter: observable\n                    });\n\n                    this.removeReaction = reaction(() => this.counter, () => {\n                        console.log('it changed');\n                    });\n                }\n\n                cleanup() {\n                    this.removeReaction();\n                }\n            }\"\n        `)\n    })\n})\n\ntest(\"weird syntaxes\", () => {\n    expect(\n        convert(`\n        import { observable } from 'mobx';\n\n        type NamedTuple = [first: string, other: number, ...rest: Boolean[]]\n\n        class X {\n            @observable x = 3;\n        }\n\n        class Y {\n            async fn() { await tes() }\n\n            *generatorFn() {\n                yield 3\n            }\n\n            doesJSX() {\n                return <hi {...there}>Stuff {/*with comments */}</hi>\n            }\n        }\n        `)\n    ).toMatchInlineSnapshot(`\n        \"import { observable, makeObservable } from 'mobx';\n\n        type NamedTuple = [first: string, other: number, ...rest: Boolean[]]\n\n        class X {\n            x = 3;\n\n            constructor() {\n                makeObservable(this, {\n                    x: observable\n                });\n            }\n        }\n\n        class Y {\n            async fn() { await tes() }\n\n            *generatorFn() {\n                yield 3\n            }\n\n            doesJSX() {\n                return <hi {...there}>Stuff {/*with comments */}</hi>\n            }\n        }\"\n    `)\n})\n\ntest(\"class comp with observer and decorator from another package\", () => {\n    expect(\n        convert(`\n    import {observer} from 'mobx-react'\n    import {withRouter} from 'react-router-dom'\n    /* 1 */\n    @withRouter @observer /* 2 */ export /* 3 */ class X extends React.Component {}\n    `)\n    ).toMatchInlineSnapshot(`\n        \"import {observer} from 'mobx-react'\n        import {withRouter} from 'react-router-dom'\n        /* 1 */\n        export const X = withRouter(observer(class /* 2 */ /* 3 */ X extends React.Component {}));\"\n    `)\n})\n\ntest(\"class comp with observer, inject and decorator from another package\", () => {\n    expect(\n        convert(`\n    import {observer, inject} from 'mobx-react'\n    import {withRouter} from 'react-router-dom'\n    /* 1 */\n    @withRouter @inject(\"test\") @observer /* 2 */ export /* 3 */ class X extends React.Component {}\n    `)\n    ).toMatchInlineSnapshot(`\n        \"import {observer, inject} from 'mobx-react'\n        import {withRouter} from 'react-router-dom'\n        /* 1 */\n        export const X = withRouter(\n          inject(\"test\")(observer(class /* 2 */ /* 3 */ X extends React.Component {}))\n        );\"\n    `)\n})\n\ntest(\"makeObservable not added to imports #2540\", () => {\n    expect(\n        convert(`\n        import { decorate, observable, action } from 'mobx';\n        class TestStore\n        {\n            testValue = 1;\n            testFunc = () =>\n            {\n                this.testValue++;\n            }\n        }\n        decorate(TestStore, {\n            testValue: observable,\n            testFunc: action\n        });\n        `)\n    ).toMatchInlineSnapshot(`\n        \"import { observable, action, makeObservable } from 'mobx';\n        class TestStore\n        {\n            testValue = 1;\n            testFunc = () =>\n            {\n                this.testValue++;\n            }\n\n            constructor() {\n                makeObservable(this, {\n                    testValue: observable,\n                    testFunc: action\n                });\n            }\n        }\"\n    `)\n})\n\ntest(\"class default export comp with observer and inject\", () => {\n    expect(\n        convert(`\n        import {observer, inject} from 'mobx-react'\n        \n        @inject(\"test\") @observer export default class X extends React.Component {}\n    `)\n    ).toMatchInlineSnapshot(`\n        \"import {observer, inject} from 'mobx-react'\n\n        class X extends React.Component {}\n        export default inject(\"test\")(observer(X));\"\n    `)\n})\n\ntest(\"class default export comp with observer and inject\", () => {\n    expect(\n        convert(`\n        import {observer, inject} from 'mobx-react'\n        import {withRouter} from 'react-router-dom'\n\n        @inject(\"test\") @observer class X extends React.Component {}\n\n        export default withRouter(X)\n\n    `)\n    ).toMatchInlineSnapshot(`\n        \"import {observer, inject} from 'mobx-react'\n        import {withRouter} from 'react-router-dom'\n\n        class X extends React.Component {}\n\n        export default withRouter(inject(\"test\")(observer(X)))\"\n    `)\n})\n\ntest(\"non-null assertion operator is preserved\", () => {\n    expect(\n        convert(`\n        import { observable } from 'mobx';\n        class X {\n          @observable todos!: ObservableMap<string, TodoModel>\n        }\n    `)\n    ).toMatchInlineSnapshot(`\n        \"import { observable, makeObservable } from 'mobx';\n        class X {\n          todos!: ObservableMap<string, TodoModel>;\n\n          constructor() {\n            makeObservable(this, {\n              todos: observable\n            });\n          }\n        }\"\n    `)\n})\n"
  },
  {
    "path": "packages/mobx-undecorate/cli.js",
    "content": "#!/usr/bin/env node\nconst path = require(\"path\")\nconst cp = require(\"child_process\")\nconst fs = require(\"fs\")\n\n/**\n * @example getCommandPath(\"jscodeshift\")\n * //-> C:\\Users\\name\\AppData\\Local\\npm-cache\\_npx\\234242somehash\\node_modules\\.bin\\jscodeshift.cmd\n * //-> linux/path/npm-cache/_npx/234242somehash/node_modules/.bin/jscodeshift\n */\nconst getCommandPath = binCommand => {\n  const cmd = process.platform === 'win32' ? `${binCommand}.cmd` : binCommand;\n  /**\n   * Normally, for executing bins from a project you would use path.resolve(__dirname, 'node_modules', '.bin', cmd) \n   * but NPX is wierd. You might think running npx mobx-undecorate installs mobx-undecorate, BUT IT DOESNT. \n   * It creates a randomly hashed folder with an unnamed package.json with mobx-undecorate as its only dependency. \n   * This causes a flattening of all peers in the same node_modules dir.\n   * They probably did it this way to dedupe nested deps.\n   * \n   * This following logic checks for both folder structure and platform bin file extension.\n  */\n  let COMMAND_PATH_SIBLING = path.resolve(__dirname, '..', '.bin', cmd)\n  let COMMAND_PATH_NESTED = path.resolve(__dirname, 'node_modules', '.bin', cmd)\n\n  var COMMAND_PATH\n\n  if (fs.existsSync(COMMAND_PATH_NESTED)) {\n    COMMAND_PATH = COMMAND_PATH_NESTED\n  }\n  else if (fs.existsSync(COMMAND_PATH_SIBLING)) {\n    COMMAND_PATH = COMMAND_PATH_SIBLING\n  }\n  else {\n    throw new Error(\"cannot find jscodeshift path\")\n    process.exit(0)\n  }\n  return COMMAND_PATH\n\n}\n\nconst spawnBin = (binCommand, args) => {\n  return cp.spawn(getCommandPath(binCommand), args, {\n    cwd: path.resolve(__dirname),\n    stdio: 'inherit',\n    shell: true\n  })\n\n}\n\n\nif (process.argv.includes(\"--help\")) {\n  console.log(`[MOBX-UNDECORATE]:\n  If experiencing problems, you may also install jscodeshift and mobx-undecorate locally and run \n  npx jscodeshift -t ./node_modules/mobx-undecorate/src/undecorate.ts --extensions=js,jsx,ts,tsx <directory>\n\n[JSCODESHIFT HELP]:\n`)\n}\n\n\nfunction interpret_cli_args() {\n\n  //first 2 args of argv are the node.exe path and the path of this file.\n  var USER_ARGS = process.argv.slice(2)\n\n  /**\n   * find args that dont include a \"=\" and set the input to the next index value in process.argv.\n   * Gotta do this because process.argv is delimited by spaces, so --dir src is actually 2 separate args\n   * so if an arg starts with -- and doesn't include a \"=\" \n   * we can just search for the arg by its --name and add 1 to the index position for lookup\n   * This will return -1 if nothing is found\n   */\n\n  let arg_without_equal = USER_ARGS\n    .slice()\n    .filter(v => !v.includes(\"=\"))\n    .findIndex(kwarg => (kwarg.includes(\"--dir\") || kwarg.includes(\"--path\")))\n    ;\n\n  var arg_with_equal = USER_ARGS\n    .slice()\n    .find(v => (v.includes(\"--dir=\") || v.includes(\"--path=\")))\n\n\n  //use cwd as default, but will override it with user args if they exist for --dir or --path\n  var PARSED_INPUT = \"\"\n\n  let is_arg_directory_only = process.argv[2] && fs.existsSync(path.resolve(process.cwd(), (process.argv[2] || \"\")))\n\n  if (is_arg_directory_only) {\n    PARSED_INPUT = process.argv[2]\n  }\n\n  if (arg_without_equal > -1) {\n    PARSED_INPUT = USER_ARGS[arg_without_equal + 1]\n  }\n\n  if (arg_with_equal) {\n    PARSED_INPUT = arg_with_equal.split(\"=\")[1]\n  }\n\n  return PARSED_INPUT\n\n}\n\n\nspawnBin(\"jscodeshift\", [\n  \"--extensions=js,jsx,ts,tsx\",\n  ...process.argv.filter(arg => arg.startsWith(\"--\")),\n  \"-t\", `\"${path.join(__dirname, \"src\", \"undecorate.ts\")}\"`,\n\n  //this is arg to tell jscodeshift the dir to transform or fallback to process.cwd()\n  //originally just hard coded to process.cwd()\n  `\"${path.join(process.cwd(), interpret_cli_args())}\"`\n\n]);\n\n\n"
  },
  {
    "path": "packages/mobx-undecorate/jest.config.js",
    "content": "const buildConfig = require(\"../../jest.base.config\")\n\nmodule.exports = buildConfig(__dirname, {\n    testRegex: \"__tests__/.*\\\\.spec\\\\.(t|j)sx?$\"\n})\n"
  },
  {
    "path": "packages/mobx-undecorate/package.json",
    "content": "{\n    \"name\": \"mobx-undecorate\",\n    \"version\": \"1.3.0\",\n    \"description\": \"Migrate MobX 4/5 to MobX 6\",\n    \"bin\": \"cli.js\",\n    \"repository\": {\n        \"type\": \"git\",\n        \"url\": \"https://github.com/mobxjs/mobx.git\"\n    },\n    \"author\": \"Michel Weststrate\",\n    \"license\": \"MIT\",\n    \"funding\": {\n        \"type\": \"opencollective\",\n        \"url\": \"https://opencollective.com/mobx\"\n    },\n    \"bugs\": {\n        \"url\": \"https://github.com/mobxjs/mobx/issues\"\n    },\n    \"files\": [\n        \"cli.js\",\n        \"src\",\n        \"LICENSE\",\n        \"README.md\"\n    ],\n    \"homepage\": \"https://mobx.js.org/\",\n    \"dependencies\": {\n        \"@babel/core\": \"^7.9.0\",\n        \"@babel/parser\": \"^7.18.9\",\n        \"@babel/plugin-proposal-class-properties\": \"^7.8.3\",\n        \"@babel/plugin-proposal-decorators\": \"^7.8.3\",\n        \"@babel/plugin-transform-runtime\": \"^7.9.0\",\n        \"@babel/preset-env\": \"^7.9.5\",\n        \"@babel/preset-typescript\": \"^7.9.0\",\n        \"@babel/runtime\": \"^7.9.2\",\n        \"dedent-js\": \"^1.0.1\",\n        \"jscodeshift\": \"^0.11.0\"\n    },\n    \"devDependencies\": {\n        \"@types/jscodeshift\": \"^0.11.6\"\n    },\n    \"keywords\": [\n        \"mobx\"\n    ],\n    \"scripts\": {\n        \"test\": \"jest\"\n    }\n}\n"
  },
  {
    "path": "packages/mobx-undecorate/src/undecorate.ts",
    "content": "import {\n    API,\n    FileInfo,\n    Decorator,\n    ASTPath,\n    ClassProperty,\n    Node,\n    ClassDeclaration,\n    ClassMethod,\n    ObjectExpression,\n    Identifier\n} from \"jscodeshift\"\n\ninterface MobxUndecorateOptions {\n    ignoreImports?: boolean\n    keepDecorators?: boolean\n    decoratorsAfterExport?: boolean\n    parseTsAsNonJsx?: boolean\n}\n\nconst validPackages = [\"mobx\", \"mobx-react\", \"mobx-react-lite\"]\nconst validDecorators = [\"action\", \"observable\", \"computed\", \"observer\", \"inject\"]\n\nconst babylon = require(\"@babel/parser\")\n\nconst defaultOptions = {\n    sourceType: \"module\",\n    allowImportExportEverywhere: true,\n    allowReturnOutsideFunction: true,\n    startLine: 1,\n    tokens: true,\n    plugins: [\n        // \"estree\",\n        [\"decorators\", { decoratorsBeforeExport: true }],\n        \"asyncGenerators\",\n        \"bigInt\",\n        \"classProperties\",\n        \"classPrivateProperties\",\n        \"classPrivateMethods\",\n        \"legacy-decorators\",\n        \"doExpressions\",\n        \"dynamicImport\",\n        \"exportDefaultFrom\",\n        \"exportNamespaceFrom\",\n        \"functionBind\",\n        \"functionSent\",\n        \"importMeta\",\n        \"logicalAssignment\",\n        \"nullishCoalescingOperator\",\n        \"numericSeparator\",\n        \"objectRestSpread\",\n        \"optionalCatchBinding\",\n        \"optionalChaining\",\n        [\"pipelineOperator\", { proposal: \"minimal\" }],\n        \"throwExpressions\",\n        \"typescript\",\n        \"jsx\"\n    ]\n}\n\nlet decoratorsBeforeExport = true // hack to get the options into the parser\n\nconst safeRemoveJsxPlugin = () => {\n    const jsxPluginIdx = defaultOptions.plugins.findIndex(plugin => plugin === \"jsx\")\n    jsxPluginIdx !== -1 && defaultOptions.plugins.splice(jsxPluginIdx, 1)\n}\n\nconst safeAddJsxPlugin = () => {\n    const jsxPluginIdx = defaultOptions.plugins.findIndex(plugin => plugin === \"jsx\")\n    jsxPluginIdx === -1 && defaultOptions.plugins.push(\"jsx\")\n}\n\nconst checkParseTsAsNonJsxFlag = (fileInfo: FileInfo, options?: MobxUndecorateOptions) => {\n    if (options?.parseTsAsNonJsx && fileInfo?.path?.endsWith(\"ts\")) {\n        safeRemoveJsxPlugin()\n    } else {\n        safeAddJsxPlugin()\n    }\n}\n\nexport const parser = {\n    parse(code) {\n        return babylon.parse(code, defaultOptions)\n    }\n}\n\nexport default function transform(\n    fileInfo: FileInfo,\n    api: API,\n    options?: MobxUndecorateOptions\n): any {\n    /**\n     * @summary for decoratorsBeforeExport flag\n     */\n    decoratorsBeforeExport = !options?.decoratorsAfterExport\n    // @ts-ignore\n    defaultOptions.plugins[0][1].decoratorsBeforeExport = !!decoratorsBeforeExport\n    /**\n     * @summary for parseTsAsNonJsx flag\n     */\n    if (options?.parseTsAsNonJsx) {\n        checkParseTsAsNonJsxFlag(fileInfo, options)\n    }\n\n    const j = api.jscodeshift\n    const superCall = j.expressionStatement(j.callExpression(j.super(), []))\n    superCall.comments = [\n        j.commentLine(\n            \" TODO: [mobx-undecorate] verify the constructor arguments and the arguments of this automatically generated super call\"\n        )\n    ]\n    const reactSuperCall = j.expressionStatement(\n        j.callExpression(j.super(), [j.identifier(\"props\")])\n    )\n    const source = j(fileInfo.source)\n    const lines = fileInfo.source.split(\"\\n\")\n    let changed = false\n    let needsInitializeImport = false\n    let importOverride = false\n    const decoratorsUsed = new Set<string>(options?.ignoreImports ? validDecorators : [])\n    let usesDecorate = options?.ignoreImports ? true : false\n    let hasReact = options?.ignoreImports ? true : false\n\n    // error TS2321: Excessive stack depth comparing types 'ArrayType<ImportDeclaration>' and 'ArrayType<T>'\n    // @ts-ignore\n    source.find(j.ImportDeclaration).forEach(im => {\n        if (im.value.source.value === \"react\") {\n            hasReact = true\n        }\n        if (validPackages.includes(im.value.source.value as string)) {\n            let decorateIndex = -1\n            im.value.specifiers?.forEach((specifier, idx) => {\n                // imported decorator\n                if (\n                    j.ImportSpecifier.check(specifier) &&\n                    typeof specifier.imported.name === \"string\" && // dunno what IdentifierKind is\n                    validDecorators.includes(specifier.imported.name)\n                ) {\n                    decoratorsUsed.add(specifier.imported.name)\n                }\n                // imported decorate call\n                if (j.ImportSpecifier.check(specifier) && specifier.imported.name === \"decorate\") {\n                    usesDecorate = true\n                    decorateIndex = idx\n                }\n            })\n            if (decorateIndex !== -1) {\n                im.value.specifiers?.splice(decorateIndex, 1)\n            }\n        }\n    })\n\n    // rewrite all decorate calls to class decorators\n    if (usesDecorate) {\n        source\n            .find(j.CallExpression)\n            .filter(\n                callPath =>\n                    j.Identifier.check(callPath.value.callee) &&\n                    callPath.value.callee.name === \"decorate\"\n            )\n            .forEach(callPath => {\n                let canRemoveDecorateCall = true\n                if (callPath.value.arguments.length !== 2) {\n                    warn(\"Expected a decorate call with two arguments\", callPath.value)\n                    return\n                }\n                const target = callPath.value.arguments[0]\n                const decorators = callPath.value.arguments[1]\n\n                if (!j.Identifier.check(target)) {\n                    // not targeting a class, just swap it with makeObservable\n                    changed = true\n                    // @ts-ignore // TODO: or \"observable\" ?\n                    callPath.value.callee.name = \"makeObservable\"\n                    needsInitializeImport = true\n                    return\n                }\n                const declarations = callPath.scope.getBindings()[target.name]\n                if (declarations.length === 0) {\n                    warn(\n                        `Expected exactly one class declaration for '${target.name}' but found ${declarations.length}`,\n                        target\n                    )\n                    return\n                }\n                const targetDeclaration = declarations[0].parentPath.value\n                if (!j.ClassDeclaration.check(targetDeclaration)) {\n                    // not targeting a class, just swap it with makeObservable\n                    changed = true\n                    // @ts-ignore // TODO: or \"observable\" ?\n                    callPath.value.callee.name = \"makeObservable\"\n                    needsInitializeImport = true\n                    return\n                }\n                const clazz: ClassDeclaration = targetDeclaration\n                // @ts-ignore\n                createConstructor(clazz, decorators, [])\n                needsInitializeImport = true\n\n                // Remove the callPath (and wrapping expressionStatement)\n                if (canRemoveDecorateCall) {\n                    callPath.parent.prune()\n                }\n                changed = true\n            })\n    }\n\n    // rewrite all class proprty decorators\n    source.find(j.ClassDeclaration).forEach(clazzPath => {\n        const clazz = clazzPath.value\n        const effects = {\n            membersMap: [] as any\n        }\n\n        clazz.body.body = clazz.body.body.map(prop => {\n            if (j.ClassProperty.check(prop) || j.ClassMethod.check(prop)) {\n                return handleProperty(prop as any, effects, clazzPath)\n            }\n            return prop\n        })\n\n        if (effects.membersMap.length) {\n            changed = true\n            let privates: string[] = []\n            const members = j.objectExpression(\n                effects.membersMap.map(([key, value, computed, isPrivate]) => {\n                    // loose the comments, as they are already in the field definition\n                    const { comments, ...k } = key\n                    const { comments: comments2, ...v } = value\n                    const prop = j.objectProperty(k, v)\n                    if (v.name === \"override\") {\n                        importOverride = true\n                    }\n                    prop.computed = !!computed\n                    if (isPrivate) {\n                        privates.push(k.name)\n                    }\n                    return prop\n                })\n            )\n            createConstructor(clazz, members, privates)\n            needsInitializeImport = true\n        }\n\n        // rewrite all @observer / @inject\n        if (!options?.keepDecorators && decoratorsUsed.has(\"observer\")) {\n            handleObserverAndInject(clazzPath)\n        }\n    })\n\n    if (needsInitializeImport && !options?.ignoreImports) {\n        // @ts-ignore\n        const mobxImport = source\n            .find(j.ImportDeclaration)\n            .filter(im => im.value.source.value === \"mobx\")\n            .nodes()\n            .filter(node => node.importKind === \"value\")[0]\n        if (!mobxImport) {\n            console.warn(\n                \"Failed to find mobx import, can't add makeObservable as dependency in \" +\n                    fileInfo.path\n            )\n        } else {\n            if (!mobxImport.specifiers) {\n                mobxImport.specifiers = []\n            }\n            if (importOverride) {\n                mobxImport.specifiers.push(j.importSpecifier(j.identifier(\"override\")))\n            }\n            mobxImport.specifiers.push(j.importSpecifier(j.identifier(\"makeObservable\")))\n        }\n    }\n    if (!decoratorsUsed.size && !usesDecorate) {\n        return // no mobx in this file\n    }\n    if (changed) {\n        return source.toSource()\n    }\n\n    function handleObserverAndInject(clazzPath: ASTPath<ClassDeclaration>) {\n        const clazz = clazzPath.value\n        const decorators = (clazz as any).decorators ?? []\n        const defaultExportPath = source.find(j.ExportDefaultDeclaration).paths()[0]\n\n        const isObserver = dec =>\n            j.Decorator.check(dec) &&\n            j.Identifier.check(dec.expression) &&\n            dec.expression.name === \"observer\"\n\n        const isInject = dec =>\n            j.Decorator.check(dec) &&\n            j.CallExpression.check(dec.expression) &&\n            j.Identifier.check(dec.expression.callee) &&\n            dec.expression.callee.name === \"inject\"\n\n        const hasObserverOrInject = decorators.some(dec => isObserver(dec) || isInject(dec))\n        if (!hasObserverOrInject) {\n            return\n        }\n\n        // If module uses default export\n        if (defaultExportPath && clazz.id) {\n            // If class is exported directly on the class declaration (`export default class ...`)\n            if (j.ClassDeclaration.check(defaultExportPath.node.declaration)) {\n                let newDefaultExportDefExpr = j.exportDefaultSpecifier(clazz.id)\n\n                newDefaultExportDefExpr.exported = decorators.reduceRight(\n                    (newDefaultExportId, dec) => {\n                        return j.callExpression(dec.expression, [newDefaultExportId])\n                    },\n                    newDefaultExportDefExpr.exported\n                )\n\n                const exportDecl = j.exportDefaultDeclaration(newDefaultExportDefExpr.exported)\n\n                // re-create the class\n                const newClassDefExpr = j.classExpression(clazz.id, clazz.body, clazz.superClass)\n                newClassDefExpr.superTypeParameters = clazz.superTypeParameters\n                newClassDefExpr.typeParameters = clazz.typeParameters\n                newClassDefExpr.implements = clazz.implements\n\n                const newClassDefDecl = j.classDeclaration(\n                    newClassDefExpr.id ?? null,\n                    newClassDefExpr.body,\n                    newClassDefExpr.superClass\n                )\n\n                // Insert module default export after class declaration\n                defaultExportPath.insertAfter(exportDecl)\n                // Replace old class with new class\n                defaultExportPath.replace(newClassDefDecl)\n\n                changed = true\n            } else {\n                const newDefaultExportDefExpr = j.exportDefaultSpecifier(clazz.id!)\n                const decorators = (clazz as any).decorators ?? []\n                const newClassExport = decorators.reduceRight((newDefaultExportId, dec) => {\n                    return j.callExpression(dec.expression, [newDefaultExportId])\n                }, newDefaultExportDefExpr.exported)\n\n                source\n                    .find(j.ExportDefaultDeclaration)\n                    .find(j.Identifier, (value: Identifier) => value.name === clazz.id!.name)\n                    .replaceWith(newClassExport)\n\n                const newDecorators = decorators.some(dec => !isObserver(dec) && !isInject(dec))\n\n                ;(clazz as any).decorators = newDecorators\n\n                changed = true\n            }\n        } else {\n            // re-create the class\n            let newClassDefExpr: any = j.classExpression(clazz.id, clazz.body, clazz.superClass)\n            newClassDefExpr.superTypeParameters = clazz.superTypeParameters\n            newClassDefExpr.typeParameters = clazz.typeParameters\n            newClassDefExpr.implements = clazz.implements\n            // wrap with decorators\n            newClassDefExpr = decorators.reduceRight((newClassDefExpr, dec) => {\n                return j.callExpression(dec.expression, [newClassDefExpr])\n            }, newClassDefExpr)\n\n            const decl = j.variableDeclaration(\"const\", [\n                j.variableDeclarator(j.identifier(clazz.id!.name.toString()), newClassDefExpr)\n            ])\n            decl.comments = clazz.comments\n            clazzPath.replace(decl)\n\n            changed = true\n        }\n    }\n\n    function handleProperty(\n        property: ClassProperty & /* | or ClassMethod */ {\n            decorators: Decorator[]\n            accessibility: \"private\" | \"protected\" | \"public\"\n        },\n        effects: {\n            membersMap: [[any, any, boolean, boolean]]\n        },\n        clazzPath: ASTPath<ClassDeclaration>\n    ): ClassProperty | ClassMethod {\n        const decorators = property.decorators\n        if (!decorators || decorators.length === 0) {\n            return property\n        }\n        if (decorators.length > 1) {\n            warn(\"Found multiple decorators, skipping..\", property.decorators[0])\n            return property\n        }\n        const decorator = decorators[0]\n        if (!j.Decorator.check(decorator)) {\n            return property\n        }\n        let expr = decorator.expression\n        if (j.Identifier.check(expr) && !decoratorsUsed.has(expr.name)) {\n            warn(`Found non-mobx decorator @${expr.name}`, decorator)\n            return property\n        }\n        if (property.static) {\n            warn(`Static properties are not supported ${property.key.loc?.source}`, property)\n            return property\n        }\n\n        if (options?.keepDecorators !== true) {\n            property.decorators.splice(0)\n        }\n\n        // Replace decorator with @override\n        if ((property as any).override) {\n            const overrideDecorator = j.decorator(j.identifier(\"override\"))\n            if (options?.keepDecorators) {\n                property.decorators[0] = overrideDecorator\n            }\n            expr = overrideDecorator.expression\n        }\n\n        effects.membersMap.push([\n            property.key,\n            expr,\n            property.computed ?? false,\n            property.accessibility === \"private\" || property.accessibility === \"protected\"\n        ])\n        return property\n    }\n\n    function createConstructor(\n        clazz: ClassDeclaration,\n        members: ObjectExpression,\n        privates: string[]\n    ) {\n        // makeObservable(this, { members })\n        const initializeObservablesCall = j.expressionStatement(\n            j.callExpression(\n                j.identifier(\"makeObservable\"),\n                options?.keepDecorators ? [j.thisExpression()] : [j.thisExpression(), members]\n            )\n        )\n        if (privates.length && !options?.keepDecorators) {\n            if (typeof clazz.id!.name !== \"string\") {\n                throw new Error(\"Unexpected type\")\n            }\n            // @ts-ignore\n            initializeObservablesCall.expression.typeArguments = j.tsTypeParameterInstantiation([\n                j.tsTypeReference(j.identifier(clazz.id!.name)),\n                j.tsUnionType(\n                    // @ts-ignore\n                    privates.map(member => j.tsLiteralType(j.stringLiteral(member)))\n                )\n            ])\n        }\n\n        const needsSuper = !!clazz.superClass\n        let constructorIndex = clazz.body.body.findIndex(\n            member => j.ClassMethod.check(member) && member.kind === \"constructor\"\n        )\n\n        // create a constructor\n        if (constructorIndex === -1) {\n            if (needsSuper) {\n                warn(\n                    `Generated new constructor for class ${clazz.id?.name}. But since the class does have a base class, it might be needed to revisit the arguments that are passed to \\`super()\\``,\n                    clazz\n                )\n            }\n\n            let superClassName = j.Identifier.check(clazz.superClass)\n                ? clazz.superClass.name\n                : j.MemberExpression.check(clazz.superClass)\n                ? j.Identifier.check(clazz.superClass.property)\n                    ? clazz.superClass.property.name\n                    : \"\"\n                : \"\"\n\n            // if this clazz is a react component, we now that the constructor and super call have one argument, the props\n            let isReactComponent =\n                hasReact && [\"Component\", \"PureComponent\"].includes(superClassName)\n            let propsType = isReactComponent && clazz.superTypeParameters?.params[0]\n            const propsParam = j.identifier(\"props\")\n            // reuse the generic if we found it\n            if (propsType) {\n                propsParam.typeAnnotation = j.tsTypeAnnotation(propsType as any)\n            }\n            // create the constructor\n            const constructorDecl = j.methodDefinition(\n                \"constructor\",\n                j.identifier(\"constructor\"),\n                j.functionExpression(\n                    null,\n                    isReactComponent ? [propsParam] : [],\n                    j.blockStatement(\n                        needsSuper\n                            ? [\n                                  isReactComponent ? reactSuperCall : superCall,\n                                  initializeObservablesCall\n                              ]\n                            : [initializeObservablesCall]\n                    )\n                )\n            )\n\n            const firstMethodIndex = clazz.body.body.findIndex(member =>\n                j.ClassMethod.check(member)\n            )\n            if (firstMethodIndex === -1) {\n                clazz.body.body.push(constructorDecl)\n            } else {\n                clazz.body.body.splice(firstMethodIndex, 0, constructorDecl)\n            }\n        } else {\n            const c: ClassMethod = clazz.body.body[constructorIndex] as any\n            j.ClassMethod.assert(c)\n            const firstStatement = c.body.body[0]\n            const hasSuper =\n                firstStatement &&\n                j.ExpressionStatement.check(firstStatement) &&\n                j.CallExpression.check(firstStatement.expression) &&\n                j.Super.check(firstStatement.expression.callee)\n            c.body.body.splice(hasSuper ? 1 : 0, 0, initializeObservablesCall)\n        }\n    }\n\n    function warn(msg: string, node: Node) {\n        if (process.env.NODE_ENV === \"test\") {\n            return\n        }\n        if (node.loc) {\n            const line = lines[node.loc.start.line - 1]\n            const shortline = line.replace(/^\\s*/, \"\")\n            console.warn(\n                `[mobx:undecorate] ${msg} at (${fileInfo.path}:${node.loc.start.line}:${\n                    node.loc.start.column\n                }):\\n\\t${shortline}\\n\\t${\"^\".padStart(\n                    node.loc.start.column + 1 - line.indexOf(shortline),\n                    \" \"\n                )}\\n`\n            )\n        } else {\n            console.warn(`[mobx:undecorate] ${msg} at (${fileInfo.path})\\n`)\n        }\n    }\n}\n"
  },
  {
    "path": "packages/mobx-undecorate/tsconfig.json",
    "content": "{\n    \"extends\": \"../../tsconfig.json\",\n    \"compilerOptions\": {\n        \"rootDir\": \"src\"\n    },\n    \"include\": [\"src\"]\n}\n"
  },
  {
    "path": "scripts/build.js",
    "content": "const fs = require(\"fs-extra\")\nconst execa = require(\"execa\")\nconst minimist = require(\"minimist\")\n\nconst stdio = [\"ignore\", \"inherit\", \"pipe\"]\nconst opts = { stdio }\n\nconst {\n    _: [packageName],\n    target\n} = minimist(process.argv.slice(2))\n\n// build to publish needs to do more things so it's slower\n// for the CI run and local testing this is not necessary\nconst isPublish = target === \"publish\"\n\n// for running tests in CI we need CJS only\nconst isTest = target === \"test\"\n\nconst run = async () => {\n    // TSDX converts passed name argument to lowercase for file name\n    const pkgPrefix = `${packageName.toLowerCase()}.`\n\n    const tempMove = name => fs.move(`dist/${pkgPrefix}${name}`, `temp/${pkgPrefix}${name}`)\n    const moveTemp = name => fs.move(`temp/${pkgPrefix}${name}`, `dist/${pkgPrefix}${name}`)\n\n    const build = (format, env) => {\n        const args = [\"build\", \"--name\", packageName, \"--format\", format]\n        if (env) {\n            args.push(\"--env\", env)\n        }\n        return execa(\"tsdx\", args, opts)\n    }\n\n    if (isPublish) {\n        await fs.emptyDir(\"temp\")\n        // build dev/prod ESM bundles that can be consumed in browser without NODE_ENV annoyance\n        // and these builds cannot be run in parallel because tsdx doesn't allow to change target dir\n        await build(\"esm\", \"development\")\n        // tsdx will purge dist folder, so it's necessary to move these\n        await tempMove(`esm.development.js`)\n        await tempMove(`esm.development.js.map`)\n\n        // cannot build these concurrently\n        await build(\"esm\", \"production\")\n        await tempMove(`esm.production.min.js`)\n        await tempMove(`esm.production.min.js.map`)\n    }\n\n    await build(isTest ? \"cjs\" : \"esm,cjs,umd\").catch(err => {\n        throw new Error(`build failed: ${err.stderr}`)\n    })\n\n    if (isPublish) {\n        // move ESM bundles back to dist folder and remove temp\n        await moveTemp(`esm.development.js`)\n        await moveTemp(`esm.development.js.map`)\n        await moveTemp(`esm.production.min.js`)\n        await moveTemp(`esm.production.min.js.map`)\n        await fs.remove(\"temp\")\n    }\n}\n\nrun().catch(err => {\n    console.error(err)\n    process.exit(1)\n})\n"
  },
  {
    "path": "sponsors.md",
    "content": "# MobX Sponsors\n\nThis is the list of individual or one time contributions!\n\nOur monthly donors can be found on open collective https://opencollective.com/mobx#contributors!\nMonthly donations can be done through https://opencollective.com/mobx.\n\nWant to make a one-time contribution? https://mobxjs.github.io/mobx/donate.html\n\n-   Anders Sjöberg\n-   Andrei Zvonimir Crnković\n-   Andy Kogut\n-   Anri Asaturov\n-   Bayu Fitri Andrianto\n-   Benjamin Gruenbaum\n-   Chance Snow\n-   Chris Richard\n-   Code Hat Programming Inc.\n-   Constantine Genchevsky\n-   Dane Hitchcox\n-   Daniel Nakov\n-   Darko Kukovec\n-   Derek Knox\n-   Dominik Nowik\n-   Dong Woo Gim\n-   Dushko Jordanovski\n-   GumoIsland\n-   Graham Kaemmer\n-   Greg Zapp\n-   Ivan Nikitin\n-   James Athanassakis\n-   James McElwain\n-   Jeff Hansen\n-   Joinbox\n-   Jorge Luis Acosta\n-   Juwan Wheatley\n-   Karolis Astrauka\n-   Kevin Samuel\n-   Konrad Mazanowski\n-   Marcel Ryser\n-   Matt Ruby\n-   Matthieu Dumont\n-   Mattia Manzati\n-   Michael Fisher\n-   Michael Mazurczak\n-   Michael Tiller\n-   Mihail Diordiev\n-   Nikolay Ivanov\n-   Uncomon\n-   Pavel Ravits\n-   Pascal Van Hecke\n-   Peng Zhenqing\n-   Rafal Filipek\n-   Rainer Wittmann\n-   Raj Sekaran\n-   Rob Searle\n-   Steven Pérez\n-   Surafel D\n-   Tanguy Krotoff\n-   Taylor Goolsby\n-   Thibault Maekelbergh\n-   Timor Zhiyentayev\n-   Timothy Durant\n-   Vojtech Novak\n-   Wilfried Reiter\n-   Wilson Lee\n-   Yousuf Nejati\n-   Zheng Renzhe\n-   Zhenqing Peng\n\nOr... Become my personal Patreon! https://www.patreon.com/mweststrate\n\nPatrons:\n\n-   Micheal Tiller\n-   Goran Mandić\n-   Micheal Hicke\n-   @guidojo\n-   Ronal Chanou\n-   Kim Joar Bekkelund\n-   Tőrös Egon Richárd\n-   Lucas Nascimento\n-   Jason Hendriksen\n"
  },
  {
    "path": "tsconfig.json",
    "content": "{\n    \"compilerOptions\": {\n        \"target\": \"es6\",\n        \"module\": \"esnext\",\n        \"moduleResolution\": \"node\",\n        \"lib\": [\"esnext\"],\n        \"downlevelIteration\": true,\n        \"alwaysStrict\": true,\n        \"sourceMap\": true,\n        \"declaration\": true,\n        \"removeComments\": false,\n        \"strict\": true,\n        \"noImplicitReturns\": true,\n        \"noUnusedLocals\": true,\n        \"noImplicitAny\": false,\n        \"noImplicitThis\": false,\n        \"noEmit\": true,\n        \"experimentalDecorators\": true,\n        \"useDefineForClassFields\": true,\n        \"jsx\": \"react\",\n        \"esModuleInterop\": true,\n        \"skipLibCheck\": true\n    },\n    \"exclude\": [\"__tests__\"]\n}\n"
  },
  {
    "path": "tsconfig.test.json",
    "content": "{\n    \"extends\": \"./tsconfig.json\",\n    \"compilerOptions\": {\n        // \"module\": \"commonjs\",\n        \"allowJs\": true,\n        \"noUnusedLocals\": false\n    }\n}\n"
  },
  {
    "path": "website/core/Footer.js",
    "content": "/**\n * Copyright (c) 2017-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\nconst React = require(\"react\")\n\nclass Footer extends React.Component {\n    docUrl(doc, language) {\n        const baseUrl = this.props.config.baseUrl\n        const docsUrl = this.props.config.docsUrl\n        const docsPart = `${docsUrl ? `${docsUrl}/` : \"\"}`\n        const langPart = `${language ? `${language}/` : \"\"}`\n        return `${baseUrl}${docsPart}${langPart}${doc}`\n    }\n\n    pageUrl(doc, language) {\n        const baseUrl = this.props.config.baseUrl\n        return baseUrl + (language ? `${language}/` : \"\") + doc\n    }\n\n    render() {\n        return (\n            <footer className=\"nav-footer\" id=\"footer\">\n                <section className=\"sitemap\">\n                    <a href={this.props.config.baseUrl} className=\"nav-home\">\n                        {this.props.config.footerIcon && (\n                            <img\n                                src={this.props.config.baseUrl + this.props.config.footerIcon}\n                                alt={this.props.config.title}\n                                width=\"66\"\n                                height=\"58\"\n                            />\n                        )}\n                    </a>\n                    <div>\n                        <h5>Docs</h5>\n                        <a href={this.docUrl(\"README.html#introduction\")}>About MobX</a>\n                        <a href={this.docUrl(\"the-gist-of-mobx.html\")}>The gist of MobX</a>\n                    </div>\n                    <div>\n                        <h5>Community</h5>\n                        {/* <a href={this.pageUrl('users.html', this.props.language)}>\n              User Showcase\n            </a> */}\n                        <a href=\"https://github.com/mobxjs/mobx/discussions\" target=\"_blank\" rel=\"noreferrer noopener\">GitHub discussions (NEW)</a>\n                        <a\n                            href=\"https://stackoverflow.com/questions/tagged/mobx\"\n                            target=\"_blank\"\n                            rel=\"noreferrer noopener\"\n                        >\n                            Stack Overflow\n                        </a>\n                    </div>\n                    <div>\n                        <h5>More</h5>\n                        <a\n                            className=\"github-button\"\n                            href={this.props.config.repoUrl}\n                            data-icon=\"octicon-star\"\n                            data-count-href=\"/facebook/docusaurus/stargazers\"\n                            data-show-count=\"true\"\n                            data-count-aria-label=\"# stargazers on GitHub\"\n                            aria-label=\"Star this project on GitHub\"\n                        >\n                            Star\n                        </a>\n                        {this.props.config.twitterUsername && (\n                            <div className=\"social\">\n                                <a\n                                    href={`https://twitter.com/${this.props.config.twitterUsername\n                                        }`}\n                                    className=\"twitter-follow-button\"\n                                >\n                                    Follow @{this.props.config.twitterUsername}\n                                </a>\n                            </div>\n                        )}\n                        {this.props.config.facebookAppId && (\n                            <div className=\"social\">\n                                <div\n                                    className=\"fb-like\"\n                                    data-href={this.props.config.url}\n                                    data-colorscheme=\"dark\"\n                                    data-layout=\"standard\"\n                                    data-share=\"true\"\n                                    data-width=\"225\"\n                                    data-show-faces=\"false\"\n                                />\n                            </div>\n                        )}\n                    </div>\n                </section>\n            </footer>\n        )\n    }\n}\n\nmodule.exports = Footer\n"
  },
  {
    "path": "website/i18n/en.json",
    "content": "{\n  \"_comment\": \"This file is auto-generated by write-translations.js\",\n  \"localized-strings\": {\n    \"next\": \"Next\",\n    \"previous\": \"Previous\",\n    \"tagline\": \"Simple, scalable state management\",\n    \"docs\": {\n      \"about-this-documentation\": {\n        \"title\": \"About this documentation\",\n        \"sidebar_label\": \"About this documentation\"\n      },\n      \"actions\": {\n        \"title\": \"Updating state using actions\",\n        \"sidebar_label\": \"Actions\"\n      },\n      \"analyzing-reactivity\": {\n        \"title\": \"Analyzing reactivity\",\n        \"sidebar_label\": \"Analyzing reactivity {🚀}\"\n      },\n      \"api\": {\n        \"title\": \"MobX API Reference\",\n        \"sidebar_label\": \"API\"\n      },\n      \"backers-sponsors\": {\n        \"title\": \"MobX Backers and Sponsors\"\n      },\n      \"best/debugging-mobx\": {\n        \"title\": \"Analyzing reactivity\"\n      },\n      \"best/decorators\": {\n        \"title\": \"Enabling decorators\"\n      },\n      \"best/store\": {\n        \"title\": \"Defining data stores\"\n      },\n      \"best/what-does-mobx-react-to\": {\n        \"title\": \"Understanding reactivity\"\n      },\n      \"collection-utilities\": {\n        \"title\": \"Collection utilities\",\n        \"sidebar_label\": \"Collection utilities {🚀}\"\n      },\n      \"computeds-with-args\": {\n        \"title\": \"Computeds with arguments\",\n        \"sidebar_label\": \"Computeds with arguments {🚀}\"\n      },\n      \"computeds\": {\n        \"title\": \"Deriving information with computeds\",\n        \"sidebar_label\": \"Computeds\"\n      },\n      \"configuration\": {\n        \"title\": \"Configuration\",\n        \"sidebar_label\": \"Configuration {🚀}\"\n      },\n      \"custom-observables\": {\n        \"title\": \"Creating custom observables\",\n        \"sidebar_label\": \"Custom observables {🚀}\"\n      },\n      \"defining-data-stores\": {\n        \"title\": \"Defining data stores\",\n        \"sidebar_label\": \"Defining data stores\"\n      },\n      \"enabling-decorators\": {\n        \"title\": \"Decorators\",\n        \"sidebar_label\": \"Decorators {🚀}\"\n      },\n      \"faq/migrate-to-6\": {\n        \"title\": \"Migrating from MobX 4/5\"\n      },\n      \"installation\": {\n        \"title\": \"Installation\",\n        \"sidebar_label\": \"Installation\"\n      },\n      \"intercept-and-observe\": {\n        \"title\": \"Intercept & Observe\",\n        \"sidebar_label\": \"Intercept & Observe {🚀}\"\n      },\n      \"intro/concepts\": {\n        \"title\": \"The gist of MobX\"\n      },\n      \"intro/how-to-read\": {\n        \"title\": \"About this documentation\"\n      },\n      \"intro/installation\": {\n        \"title\": \"Installation\"\n      },\n      \"lazy-observables\": {\n        \"title\": \"Creating lazy observables\",\n        \"sidebar_label\": \"Lazy observables {🚀}\"\n      },\n      \"LINKS\": {\n        \"title\": \"LINKS\"\n      },\n      \"migrating-from-4-or-5\": {\n        \"title\": \"Migrating from MobX 4/5\",\n        \"sidebar_label\": \"Migrating from MobX 4/5 {🚀}\"\n      },\n      \"mobx-utils\": {\n        \"title\": \"MobX-utils\",\n        \"sidebar_label\": \"MobX-utils {🚀}\"\n      },\n      \"observable-state\": {\n        \"title\": \"Creating observable state\",\n        \"sidebar_label\": \"Observable state\"\n      },\n      \"react-integration\": {\n        \"title\": \"React integration\",\n        \"sidebar_label\": \"React integration\"\n      },\n      \"react-optimizations\": {\n        \"title\": \"Optimizing React component rendering\",\n        \"sidebar_label\": \"React optimizations {🚀}\"\n      },\n      \"react/react-integration\": {\n        \"title\": \"React integration\"\n      },\n      \"react/react-performance\": {\n        \"title\": \"Optimizing React component rendering\"\n      },\n      \"reactions\": {\n        \"title\": \"Running side effects with reactions\",\n        \"sidebar_label\": \"Reactions {🚀}\"\n      },\n      \"README\": {\n        \"title\": \"About MobX\",\n        \"sidebar_label\": \"About MobX\"\n      },\n      \"refguide/action\": {\n        \"title\": \"Updating state using actions\"\n      },\n      \"refguide/api\": {\n        \"title\": \"MobX API overview\"\n      },\n      \"refguide/autorun\": {\n        \"title\": \"Running side effects with reactions\"\n      },\n      \"refguide/computed-with-args\": {\n        \"title\": \"Computeds with arguments\"\n      },\n      \"refguide/computed\": {\n        \"title\": \"Deriving information with computeds\"\n      },\n      \"refguide/configure\": {\n        \"title\": \"Configuration\"\n      },\n      \"refguide/extending\": {\n        \"title\": \"Creating custom observables\"\n      },\n      \"refguide/mobx-utils\": {\n        \"title\": \"MobX-utils\"\n      },\n      \"refguide/modifiers\": {\n        \"title\": \"Observable modifiers\"\n      },\n      \"refguide/object-api\": {\n        \"title\": \"Collection utilities\"\n      },\n      \"refguide/object\": {\n        \"title\": \"Observable Objects\"\n      },\n      \"refguide/observable\": {\n        \"title\": \"Creating observable state\"\n      },\n      \"refguide/observe\": {\n        \"title\": \"Intercept & Observe\"\n      },\n      \"refguide/on-become-observed\": {\n        \"title\": \"Creating lazy observables\"\n      },\n      \"refguide/set\": {\n        \"title\": \"Observable Sets\"\n      },\n      \"subclassing\": {\n        \"title\": \"Subclassing\",\n        \"sidebar_label\": \"Subclassing\"\n      },\n      \"the-gist-of-mobx\": {\n        \"title\": \"The gist of MobX\",\n        \"sidebar_label\": \"The gist of MobX\"\n      },\n      \"understanding-reactivity\": {\n        \"title\": \"Understanding reactivity\",\n        \"sidebar_label\": \"Understanding reactivity\"\n      }\n    },\n    \"links\": {\n      \"API Reference\": \"API Reference\",\n      \"中文\": \"中文\",\n      \"한국어\": \"한국어\",\n      \"Sponsors\": \"Sponsors\",\n      \"GitHub\": \"GitHub\"\n    },\n    \"categories\": {\n      \"Introduction\": \"Introduction\",\n      \"MobX core\": \"MobX core\",\n      \"MobX and React\": \"MobX and React\",\n      \"Tips & Tricks\": \"Tips & Tricks\",\n      \"Fine-tuning\": \"Fine-tuning\"\n    }\n  },\n  \"pages-strings\": {\n    \"Help Translate|recruit community translators for your project\": \"Help Translate\",\n    \"Edit this Doc|recruitment message asking to edit the doc source\": \"Edit\",\n    \"Translate this Doc|recruitment message asking to translate the docs\": \"Translate\"\n  }\n}\n"
  },
  {
    "path": "website/package.json",
    "content": "{\n  \"scripts\": {\n    \"examples\": \"docusaurus-examples\",\n    \"start\": \"docusaurus-start\",\n    \"build\": \"docusaurus-build\",\n    \"publish-gh-pages\": \"docusaurus-publish\",\n    \"write-translations\": \"docusaurus-write-translations\",\n    \"version\": \"docusaurus-version\",\n    \"rename-version\": \"docusaurus-rename-version\"\n  },\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"https://github.com/mobxjs/mobx.git\"\n  },\n  \"author\": \"Michel Weststrate\",\n  \"license\": \"MIT\",\n  \"funding\": {\n    \"type\": \"opencollective\",\n    \"url\": \"https://opencollective.com/mobx\"\n  },\n  \"bugs\": {\n    \"url\": \"https://github.com/mobxjs/mobx/issues\"\n  },\n  \"homepage\": \"https://mobx.js.org/\",\n  \"devDependencies\": {\n    \"docusaurus\": \"^1.14.4\"\n  },\n  \"dependencies\": {\n    \"@docusaurus/plugin-google-gtag\": \"^3.2.1\"\n  }\n}\n"
  },
  {
    "path": "website/sidebars.json",
    "content": "{\n  \"docs\": {\n    \"Introduction\": [\n      \"README\",\n      \"about-this-documentation\",\n      \"installation\",\n      \"the-gist-of-mobx\"\n    ],\n    \"MobX core\": [\n      \"observable-state\",\n      \"actions\",\n      \"computeds\",\n      \"reactions\",\n      \"api\"\n    ],\n    \"MobX and React\": [\n      \"react-integration\",\n      \"react-optimizations\"\n    ],\n    \"Tips & Tricks\": [\n      \"defining-data-stores\",\n      \"understanding-reactivity\",\n      \"subclassing\",\n      \"analyzing-reactivity\",\n      \"computeds-with-args\",\n      \"mobx-utils\",\n      \"custom-observables\",\n      \"lazy-observables\",\n      \"collection-utilities\",\n      \"intercept-and-observe\"\n    ],\n    \"Fine-tuning\": [\n      \"configuration\",\n      \"enabling-decorators\",\n      \"migrating-from-4-or-5\"\n    ]\n  }\n}\n"
  },
  {
    "path": "website/siteConfig.js",
    "content": "/**\n * Copyright (c) 2017-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// See https://docusaurus.io/docs/site-config for all the possible\n// site configuration options.\n\n// List of projects/orgs using your project for the users page.\nconst users = [\n    {\n        caption: \"User1\",\n        // You will need to prepend the image path with your baseUrl\n        // if it is not '/', like: '/test-site/img/image.jpg'.\n        image: \"/img/undraw_open_source.svg\",\n        infoLink: \"https://www.facebook.com\",\n        pinned: true\n    }\n]\n\nconst siteConfig = {\n    algolia: {\n        apiKey: '500db32fbdbd53a814f42aafdfa26bd4',\n        indexName: 'mobxjs',\n    },\n    title: \"MobX 🇺🇦\", // Title for your website.\n    tagline: \"Simple, scalable state management\",\n\n    // For github.io type URLs, you would set the url and baseUrl like:\n    //   url: 'https://facebook.github.io',\n    //   baseUrl: '/test-site/',\n    url: \"https://mobx.js.org\", // Your website URL\n    baseUrl: \"/\", // Base URL for your project */\n    docsUrl: \"\", // trim 'docs/ prefix\n    cname: \"mobx.js.org\", // needed for github pages to work under a domain\n    // Used for publishing and more\n\n    projectName: \"mobx\",\n    organizationName: \"mobxjs\",\n\n    // URL for editing docs, usage example: editUrl + 'en/doc1.md'.\n    // If this field is omitted, there will be no \"Edit this Doc\" button\n    // for each document.\n    editUrl: \"https://github.com/mobxjs/mobx/edit/main/docs/\",\n\n    // For top-level user or org sites, the organization is still the same.\n    // e.g., for the https://JoelMarcey.github.io site, it would be set like...\n    //   organizationName: 'JoelMarcey'\n\n    // For no header links in the top nav bar -> headerLinks: [],\n    headerLinks: [\n        { doc: \"api\", label: \"API Reference\" },\n        { href: \"https://zh.mobx.js.org\", label: \"中文\" },\n        { href: \"https://ko.mobx.js.org\", label: \"한국어\" },\n        { doc: \"backers-sponsors\", label: \"Sponsors\" },\n        { href: \"https://github.com/mobxjs/mobx\", label: \"GitHub\" }\n    ],\n\n    // docsSideNavCollapsible: true,\n\n    // If you have users set above, you add it here:\n    users,\n\n    /* path to images for header/footer */\n    headerIcon: \"img/mobx.png\",\n    footerIcon: \"img/mobx.png\",\n    favicon: \"img/favicon.png\",\n\n    /* Colors for website */\n    colors: {\n        primaryColor: \"#035193\",\n        secondaryColor: \"#023866\"\n    },\n\n    /* Custom fonts for website */\n    /*\nfonts: {\nmyFont: [\n\"Times New Roman\",\n\"Serif\"\n],\nmyOtherFont: [\n\"-apple-system\",\n\"system-ui\"\n]\n},\n*/\n\n    // This copyright info is used in /core/Footer.js and blog RSS/Atom feeds.\n    copyright: `Copyright © ${new Date().getFullYear()} Your Name or Your Company Name`,\n\n    highlight: {\n        // Highlight.js theme to use for syntax highlighting in code blocks.\n        theme: \"default\"\n    },\n\n    // Add custom scripts here that would be placed in <script> tags.\n    scripts: [\n        \"/js/scripts.js\",\n        \"https://buttons.github.io/buttons.js\",\n    ],\n\n    // On page navigation for the current documentation page.\n    onPageNav: \"separate\",\n    // No .html extensions for paths.\n    cleanUrl: false, // similar to old gitbook\n\n    // Open Graph and Twitter card images.\n    ogImage: \"img/undraw_online.svg\",\n    twitterImage: \"img/undraw_tweetstorm.svg\",\n\n    // Show documentation's last contributor's name.\n    // enableUpdateBy: true,\n\n    // Show documentation's last update time.\n    // enableUpdateTime: true,\n\n    // You may provide arbitrary config keys to be used as needed by your\n    // template. For example, if you need your repo's URL...\n    repoUrl: \"https://github.com/mobxjs/mobx\",\n    gaGtag: true,\n    gaTrackingId: \"G-7XBWTSGJ80\",\n}\n\nmodule.exports = siteConfig\n"
  },
  {
    "path": "website/static/css/custom.css",
    "content": "/* your custom css */\n\n\n/*\nDocusaurus's default displays img tags as block.\nNumerous images in the main README.md relied on default (inline-block) img tag styling\nwhen this project was migrated initially.\n\nOverride that style here\n*/\narticle p img {\n  display: inline-block;\n}\n\n@media only screen and (min-device-width: 360px) and (max-device-width: 736px) {\n}\n\n@media only screen and (max-width: 735px) {\n  .nav-footer .sitemap .nav-home {\n    margin-left: -10px;\n  }\n}\n\n@media only screen and (min-width: 1024px) {\n}\n\n@media only screen and (max-width: 1023px) {\n}\n\n@media only screen and (min-width: 1400px) {\n}\n\n@media only screen and (min-width: 1500px) {\n}\n\n/* Transform Github link. Lifted from Redux's CSS */\n/* https://github.com/reduxjs/redux/blob/master/website/static/css/custom.css#L134 */\n\n.navigationSlider .slidingNav ul a[href*=\"github\"] {\n  font-size: 0;\n}\n\n.navigationSlider .slidingNav ul a[href*=\"github\"]::before {\n  content : \"\";\n  width : 32px;\n  height : 32px;\n  background: url(\"/img/github-brand.svg\");\n}\n\n.detail {\n    font-size: 0.8em;\n    color: #979797;\n}\n\n/* no fixed header, it makes linking ugly as headers disappear */\n@media only screen and (min-width: 1024px)  {\n    .fixedHeaderContainer {\n        position: unset !important;\n    }\n\n    .navPusher {\n        padding-top: 0px !important;\n        margin-top: -40px !important;\n    }\n    .onPageNav {\n        top: 70px !important;\n    }\n    .docsNavContainer {\n        top: 30px !important;\n    }\n}\n\n\ndetails {\n    background-color: aliceblue;\n    font-size: 0.8em;\n    padding: 4px 8px;\n    border-radius: 4px;\n}\n\ndetails > summary {\n    color: navy;\n    cursor: pointer;\n}\n\ndetails[open] > summary {\n    margin-bottom: 8px;\n}\n\n.tabs {\n    background: #efefef\n}\n\n.tab-content {\n    padding: 1.25rem 1.5rem;\n}\n\n.tab-content .hljs {\n    padding: 1.25rem 0px;\n}\n\n.benefits  {\n    display: flex;\n    align-items: center;\n    flex-direction: column;\n}\n\n .benefits > div {\n    width: 80%;\n    display: flex;\n    align-items: center;\n}\n\n.benefits .pic {\n    font-size: 40px;\n    margin-right: 40px;\n}\n\n@media (max-width: 480px) {\n  .slidingNav::before {\n    text-align: left;\n    padding-left: 60px;\n  }\n}\n\n/* Cheat sheet link */\n.cheat {\n    text-align: center;\n}\n.cheat button {\n    cursor: pointer;\n    text-align: center;\n    background: #035193;\n    color: white;\n    padding: 8px;\n    border: none;\n    border-radius: 4px;\n    margin-left: auto;\n    margin-right: auto;\n    font-weight: bold;\n}\n\n/* Carbon */\n#carbonads {\n    font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Oxygen-Sans, Ubuntu,\n        Cantarell, \"Helvetica Neue\", Helvetica, Arial, sans-serif;\n}\n\n#carbonads {\n    display: block;\n    overflow: hidden;\n    max-width: 728px;\n    position: relative;\n    background-color: hsl(0, 0%, 99%);\n    border: solid 1px #eee;\n    font-size: 22px;\n    box-sizing: content-box;\n    margin-left: auto;\n    margin-right: auto;\n    margin-bottom: 20px;\n}\n\n#carbonads > span {\n    display: block;\n}\n\n#carbonads a {\n    color: inherit;\n    text-decoration: none;\n}\n\n#carbonads a:hover {\n    color: inherit;\n}\n\n.carbon-wrap {\n    display: flex;\n    align-items: center;\n}\n\n.carbon-img {\n    display: block;\n    margin: 0;\n    line-height: 1;\n}\n\n.carbon-img img {\n    display: block;\n    height: 90px;\n    width: auto;\n}\n\n.carbon-text {\n    display: block;\n    padding: 0 1em;\n    line-height: 1.35;\n    text-align: left;\n}\n\n.carbon-poweredby {\n    display: block;\n    position: absolute;\n    bottom: 0;\n    right: 0;\n    padding: 6px 10px;\n    background: repeating-linear-gradient(\n            -45deg,\n            transparent,\n            transparent 5px,\n            hsla(0, 0%, 0%, 0.025) 5px,\n            hsla(0, 0%, 0%, 0.025) 10px\n        )\n        hsla(203, 11%, 95%, 0.8);\n    text-align: center;\n    text-transform: uppercase;\n    letter-spacing: 0.5px;\n    font-weight: 600;\n    font-size: 8px;\n    border-top-left-radius: 4px;\n    line-height: 1;\n}\n\n@media only screen and (min-width: 320px) and (max-width: 759px) {\n    .carbon-text {\n        font-size: 14px;\n    }\n}\n\n.tip-anchor {\n    margin-left: 8px;\n\n}\n.tip-anchor::after {\n    content: \"∞\"\n}\n\nblockquote {\n    color: #444a50;\n}\n\na:hover {\n    text-decoration: underline;\n}\n\nsmall {\n    font-size: smaller;\n}\n"
  },
  {
    "path": "website/static/getting-started.html",
    "content": "<!DOCTYPE html>\n<html>\n\n<head>\n    <meta charset='utf-8'>\n    <meta http-equiv=\"X-UA-Compatible\" content=\"chrome=1\">\n    <meta name=\"description\" content=\"Ten minute introduction to MobX + React\">\n\n    <link rel=\"stylesheet\" href=\"assets/getting-started-assets/style.css\" />\n    <link rel=\"preconnect\" href=\"https://fonts.googleapis.com\">\n    <link rel=\"preconnect\" href=\"https://fonts.gstatic.com\" crossorigin>\n    <link href=\"https://fonts.googleapis.com/css2?family=PT+Serif:ital,wght@0,400;0,700;1,400;1,700&display=swap\" rel=\"stylesheet\">\n\n    <link rel=\"shortcut icon\" type=\"image/png\" href=\"assets/getting-started-assets/images/favicon.png\" />\n\n    <title>MobX: Ten minute introduction to MobX and React</title>\n</head>\n\n<body>\n    <div class=\"github-fork-ribbon-wrapper right-bottom fixed\">\n        <div class=\"github-fork-ribbon\">\n            <a href=\"https://github.com/mobxjs/mobx\">Fork me on GitHub</a>\n        </div>\n    </div>\n    <table class=\"root\">\n        <tr>\n            <td class=\"left\">\n              <div class=\"left-content-wrapper\">\n                <div class=\"left-content\">\n                    <header>\n                        <a href=\"index.html\" style=\"float:left\">\n\t\t\t\t\t\t<img style=\"width: 120px; padding-right: 20px;\" src=\"assets/getting-started-assets/images/mobservable.png\" id=\"logo\" /></a>\n                        <h1 id=\"project_title\">MobX</h1>\n                        <h2 id=\"project_tagline\" style=\"font-size: 18pt\">Ten minute introduction to MobX and React</h2>\n                        <hr/>\n                    </header>\n\n                    <section id=\"main_content\">\n                        <p>\n                            <a href=\"https://github.com/mobxjs/mobx\"><code>MobX</code></a> is a simple, scalable and battle tested state management solution.\n\t\t\t\t\t\t\tThis tutorial will teach you all the important concepts of MobX in ten minutes.\n                            MobX is a standalone library, but most people are using it with React and this tutorial focuses on that combination.\n                        </p>\n                        <h3>The core idea</h3>\n\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\tState is the heart of each application and there is no quicker way to create buggy, unmanageable applications than by\n\t\t\t\t\t\t\tproducing an inconsistent state or state that is out-of-sync with local variables that linger around.\n\t\t\t\t\t\t\tHence many state management solutions try to restrict the ways in which you can modify state, for example by making state immutable.\n\t\t\t\t\t\t\tBut this introduces new problems; data needs to be normalized, referential integrity can no longer be guaranteed and it becomes next to impossible to use powerful concepts like classes in case you fancy those.\n\t\t\t\t\t\t</p><p>\n\t\t\t\t\t\t\tMobX makes state management simple again by addressing the root issue: it makes it impossible to produce an inconsistent state.\n\t\t\t\t\t\t\tThe strategy to achieve that is simple:\n\t\t\t\t\t\t\t<em>Make sure that everything that can be derived from the application state, will be derived. Automatically.</em>\n\t\t\t\t\t\t</p>\n\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\tConceptually MobX treats your application like a spreadsheet.\n                        <p>\n\t\t\t\t\t\t\t<img src=\"assets/getting-started-assets/overview.png\" width=\"100%\" />\n\t\t\t\t\t\t<ol>\n\t\t\t\t\t\t\t<li>\n\t\t\t\t\t\t\tFirst of all, there is the <em>application state</em>.\n\t\t\t\t\t\t\tGraphs of objects, arrays, primitives, references that forms the model of your application.\n\t\t\t\t\t\t\tThese values are the &ldquo;data cells&rdquo; of your application.\n\t\t\t\t\t\t\t</li>\n                            <li>Secondly there are <em>derivations</em>.\n\t\t\t\t\t\t\t\tBasically, any value that can be computed automatically from the state of your application.\n            \t\t\t\t\tThese derivations, or computed values, can range from\n                                simple values, like the number of unfinished todos, to complex stuff like a visual HTML\n                                representation of your todos. In spreadsheet terms: these are the formulas and charts of\n                                your application.\n                            </li>\n                            <li><em>Reactions</em> are very similar to derivations. The main difference is these functions don't produce a\n                                value. Instead, they run automatically to perform some task.\n                                Usually this is I/O related.\n                                They make sure that the DOM is updated or\n                                that network requests are made automatically at the right time.\n                            </li>\n                            <li>Finally there are <em>actions</em>. Actions are all the things that alter the <em>state</em>.\n                            MobX will make sure that all changes to the application\n                                state caused by your actions are automatically processed by all derivations and reactions.\n                                Synchronously and glitch-free.\n                            </li>\n                        </ol>\n                        <h3>A simple todo store...</h3>\n                        <p>\n                            Enough theory, seeing it in action probably explains more than carefully reading the above stuff. For originality's sake\n                            let's start with a very simple ToDo store.\n                            Note that all the code blocks below are editable,\n                            So use the <em>run code</em> buttons to execute them.\n                            Below is a very straightforward <code>TodoStore</code> that maintains a collection of todos.\n                            No MobX involved yet.\n                        </p>\n\n                        <textarea spellcheck=\"false\" class=\"prettyprint\" id=\"code1\" rows=\"25\">\nclass TodoStore {\n  todos = [];\n\n  get completedTodosCount() {\n    return this.todos.filter(\n      todo => todo.completed === true\n    ).length;\n  }\n\n  report() {\n    if (this.todos.length === 0)\n      return \"<none>\";\n    const nextTodo = this.todos.find(todo => todo.completed === false);\n    return `Next todo: \"${nextTodo ? nextTodo.task : \"<none>\"}\". ` +\n      `Progress: ${this.completedTodosCount}/${this.todos.length}`;\n  }\n\n  addTodo(task) {\n    this.todos.push({\n      task: task,\n      completed: false,\n      assignee: null\n    });\n  }\n}\n\nconst todoStore = new TodoStore();\n                        </textarea>\n                        <p>We just created a <code>todoStore</code> instance with a <code>todos</code> collection.\n                            Time to fill the todoStore with some objects.\n                            To make sure we see the effects of our changes we invoke <code>todoStore.report</code> after each change and log it.\n                            Note that the report intentionally always prints the <em>first</em> task only.\n                            It makes this example a bit artificial, but as we will see later on it nicely demonstrates that MobX's dependency tracking is dynamic.\n                        </p>\n\n                        <textarea spellcheck=\"false\" class=\"prettyprint\" id=\"code2\" rows=\"15\">\ntodoStore.addTodo(\"read MobX tutorial\");\nconsole.log(todoStore.report());\n\ntodoStore.addTodo(\"try MobX\");\nconsole.log(todoStore.report());\n\ntodoStore.todos[0].completed = true;\nconsole.log(todoStore.report());\n\ntodoStore.todos[1].task = \"try MobX in own project\";\nconsole.log(todoStore.report());\n\ntodoStore.todos[0].task = \"grok MobX tutorial\";\nconsole.log(todoStore.report());\n                        </textarea>\n                        <button onClick=\"runCode(['#code1', '#code2'])\" class=\"btn-run\">Run code</button>\n\n                        <h3>Becoming reactive</h3>\n                        <p>So far, there is nothing special about this code.\n                            But what if we didn't have to call <code>report</code> explicitly,\n                            but that we could declare instead that it should be invoked upon each <em>relevant</em> state change?\n                            That would free us from the responsibility of calling <code>report</code> from any place in our code\n                            base that <em>might</em> affect the report. We do want to be sure the latest report is printed.\n                            But we don't wanna be bothered by organizing that.\n                        </p>\n                        <p>\n                            Luckily that is exactly what MobX can do for us. Automatically execute code that solely depends on state.\n                            So that our <code>report</code> function updates automatically, just like a chart in a spreadsheet.\n                            To achieve that, the <code>TodoStore</code> has to become observable so that MobX can track all the changes that are being made.\n                            Let's alter the class just enough to achieve that.\n                        </p>\n                        <p>Also, the <code>completedTodosCount</code> property could be derived automatically from the todo\n                            list. By using the <code>observable</code> and <code>computed</code> annotations we can introduce observable properties on an\n                            object.\n                            In the example below we use <code>makeObservable</code> to show the annotations explicitly,\n                            but we could have used <code>makeAutoObservable(this)</code> instead to simplify this process.\n                        </p>\n                        <textarea spellcheck=\"false\" class=\"prettyprint\" id=\"code3\" rows=\"8\">\nclass ObservableTodoStore {\n  todos = [];\n  pendingRequests = 0;\n\n  constructor() {\n    makeObservable(this, {\n      todos: observable,\n      pendingRequests: observable,\n      completedTodosCount: computed,\n      report: computed,\n      addTodo: action,\n    });\n    autorun(() => console.log(this.report));\n  }\n\n  get completedTodosCount() {\n    return this.todos.filter(\n      todo => todo.completed === true\n    ).length;\n  }\n\n  get report() {\n    if (this.todos.length === 0)\n      return \"<none>\";\n    const nextTodo = this.todos.find(todo => todo.completed === false);\n    return `Next todo: \"${nextTodo ? nextTodo.task : \"<none>\"}\". ` +\n      `Progress: ${this.completedTodosCount}/${this.todos.length}`;\n  }\n\n  addTodo(task) {\n    this.todos.push({\n      task: task,\n      completed: false,\n      assignee: null\n    });\n  }\n}\n\nconst observableTodoStore = new ObservableTodoStore();\n                        </textarea>\n\n                        <p>That's it! We marked some properties as being <code>observable</code> to signal MobX that these values can change over time.\n                            The computations are decorated with <code>computed</code> to identify that these can be derived from the state and caches as long as no underlying state changed.\n                        </p>\n                        <p>\n                            The <code>pendingRequests</code> and <code>assignee</code> attributes are not used so far,\n                            but will be used later in this tutorial.\n                        </p>\n                        <p>\n                            In the constructor we created a small function that prints the <code>report</code> and\n                            wrapped it in <code>autorun</code>. Autorun creates a <em>reaction</em> that runs once, and after\n                            that automatically re-runs whenever any observable data that was used inside the function changes.\n                            Because <code>report</code> uses the observable <code>todos</code> property, it will print the\n                            report whenever appropriate. This is demonstrated in the next listing. Just press the <em>run</em> button:\n                        </p>\n\n                        <textarea spellcheck=\"false\" class=\"prettyprint\" id=\"code4\" rows=\"6\">\nobservableTodoStore.addTodo(\"read MobX tutorial\");\nobservableTodoStore.addTodo(\"try MobX\");\nobservableTodoStore.todos[0].completed = true;\nobservableTodoStore.todos[1].task = \"try MobX in own project\";\nobservableTodoStore.todos[0].task = \"grok MobX tutorial\";\n                        </textarea>\n                        <button onClick=\"runCode(['#code1', '#code3', '#code4'])\" class=\"btn-run\">Run code</button>\n\n                        <p>Pure fun, right? The <code>report</code> did print automatically, synchronously and without leaking\n                            intermediate values. If you investigate the log carefully, you will see that the fifth line\n                            didn't result in a new log-line. Because the report did not <em>actually</em> change as a result\n                            of the rename, although the backing data did. On the other hand, changing the name of the first\n                            todo did update the report, since that name is actively used in the report.\n                            This demonstrates nicely that\n                            not just the <code>todos</code> array is being observed by the <code>autorun</code>, but also\n                            the individual properties inside the todo items.\n                        </p>\n                        <h3 id=\"reactive-reactjs-components\">Making React reactive</h3>\n                        <p>Ok, so far we made a silly report reactive. Time to build a reactive user interface around this very\n                            same store. React components are (despite their name) not reactive out of the box.\n                            The <code>observer</code> HoC wrapper from the <code>mobx-react-lite</code> package fixes that by\n                            basically wrapping the React component in <code>autorun</code>. This\n                            keeps the component in sync with the state. This is conceptually not different from what we did\n                            with the <code>report</code> before.\n                        </p>\n                        <p>\n                            The next listing defines a few React components.\n                            The only MobX specific code in there is the <code>observer</code> wrapping.\n                            That is enough to make sure that each component individually re-renders when relevant data changes.\n                            We don't have to call state <code>useState</code> setters anymore,\n                            nor do we have to figure out how to subscribe to the proper parts\n                            of the application state using selectors or higher order components that need configuration.\n                            Basically, all components have become smart. Yet they are defined in a dumb, declarative manner.\n                        </p>\n                        <p>\n                            Press the <em>Run code</em> button to see the code below in action. The listing is editable so\n                            feel free to play with it. Try for example to remove all the <code>observer</code> calls, or\n                            just the one decorating the <code>TodoView</code>. The numbers in the preview on the right highlight\n                            how often a component is rendered.\n                        </p>\n                        <textarea spellcheck=\"false\" class=\"\" id=\"react1\" rows=\"44\">\nconst TodoList = observer(({store}) => {\n  const onNewTodo = () => {\n    store.addTodo(prompt('Enter a new todo:','coffee plz'));\n  }\n\n  return (\n    <div>\n      { store.report }\n      <ul>\n        { store.todos.map(\n          (todo, idx) => <TodoView todo={ todo } key={ idx } />\n        ) }\n      </ul>\n      { store.pendingRequests > 0 ? <marquee>Loading...</marquee> : null }\n      <button onClick={ onNewTodo }>New Todo</button>\n      <small> (double-click a todo to edit)</small>\n      <RenderCounter />\n    </div>\n  );\n})\n\nconst TodoView = observer(({todo}) => {\n  const onToggleCompleted = () => {\n    todo.completed = !todo.completed;\n  }\n\n  const onRename = () => {\n    todo.task = prompt('Task name', todo.task) || todo.task;\n  }\n\n  return (\n    <li onDoubleClick={ onRename }>\n      <input\n        type='checkbox'\n        checked={ todo.completed }\n        onChange={ onToggleCompleted }\n      />\n      { todo.task }\n      { todo.assignee\n        ? <small>{ todo.assignee.name }</small>\n        : null\n      }\n      <RenderCounter />\n    </li>\n  );\n})\n\nReactDOM.render(\n  <TodoList store={ observableTodoStore } />,\n  document.getElementById('reactjs-app')\n);\n                        </textarea>\n                        <button onClick=\"runCode(['#code1', '#code3', '#code4', '#react1'])\" class=\"btn-run\">Run code</button>\n\n                        <p>\n                            The next listing nicely demonstrates that we only have to alter the data, without doing any further bookkeeping.\n                            MobX will automatically derive and update the relevant parts of the user interface again from the state in the store.\n                        </p>\n\n                        <textarea spellcheck=\"false\" class=\"\" id=\"play1\" rows=\"8\">\nconst store = observableTodoStore;\nstore.todos[0].completed = !store.todos[0].completed;\nstore.todos[1].task = \"Random todo \" + Math.random();\nstore.todos.push({ task: \"Find a fine cheese\", completed: true });\n// etc etc.. add your own statements here...\n                        </textarea>\n                        <button onClick=\"if (typeof observableTodoStore === 'undefined') { runCode(['#code1', '#code3', '#code4', '#react1']) } runCode(['#play1'])\"\n                        class=\"btn-run\">Run code</button>\n                        <button id=\"runline-btn\" onClick=\"runCodePerLine()\" class=\"btn-run\">Run line-by-line</button>\n                        <p>&nbsp;</p>\n\n                        <h3>Working with references</h3>\n                        <p>\n                            So far we have created observable objects (both prototyped and plain objects), arrays and primitives. You might be wondering,\n                            how are references handled in MobX? Is my state allowed to form a graph? In the previous listings\n                            you might have noticed that there is an <code>assignee</code> property\n                            on the todos. Let's give them some values by introducing another &ldquo;store&rdquo; (ok, it's just\n                            a glorified array) containing people, and assign tasks to them.\n                        </p>\n                        <textarea spellcheck=\"false\" class=\"\" id=\"store2\" rows=\"8\">\nconst peopleStore = observable([\n  { name: \"Michel\" },\n  { name: \"Me\" }\n]);\nobservableTodoStore.todos[0].assignee = peopleStore[0];\nobservableTodoStore.todos[1].assignee = peopleStore[1];\npeopleStore[0].name = \"Michel Weststrate\";\n                        </textarea>\n                        <button onClick=\"runCode(['#code1', '#code3', '#code4', '#react1', '#store2'])\" class=\"btn-run\">Run code</button>\n                        <p>We now have two independent stores. One with people and one with todos. To assign an <code>assignee</code>\n                            to a person from the people store, we just assigned a reference. These changes will be picked\n                            up automatically by the <code>TodoView</code>. With MobX there is no need to normalize data first\n                            and to write selectors to make sure our components will be updated. In fact, it doesn't even\n                            matter where the data is stored. As long as objects are made <em>observable</em>, MobX will be\n                            able to track them. Real JavaScript references will just work. MobX will track them automatically\n                            if they are relevant for a derivation. To test that, just try changing your name in the next\n                            input box (make sure you have pressed the above <em>Run code</em> button first!).\n                        </p>\n                        <hr/>\n                        <p style=\"text-align:center\">Your name:\n                            <input onkeyup=\"peopleStore[1].name = event.target.value\" />\n                        </p>\n                        <hr/>\n                        <p>By the way, the HTML of the above input box is simply: <pre>&lt;input onkeyup=\"peopleStore[1].name = event.target.value\" /&gt;</pre></p>\n\n                        <h3>Asynchronous actions</h3>\n                        <p>Since everything in our small Todo application is derived from the state, it really doesn't matter <em>when</em> state is changed.\n                            That makes creating asynchronous actions really straightforward.\n                            Just press the the following button (multiple times) to emulate asynchronously loading new todo items:\n                        </p>\n                        <hr/>\n                        <p style=\"text-align:center\">\n                            <button onclick=\"observableTodoStore.pendingRequests++; setTimeout(function() { observableTodoStore.addTodo('Random Todo ' + Math.random()); observableTodoStore.pendingRequests--;  }, 2000);\">Load todo</button>\n                        </p>\n                        <hr/>\n                        <p>The code behind that is really straightforward.\n                            We start with updating the store property <code>pendingRequests</code> to have the UI reflect the current loading status.\n                            Once loading is finished, we update the todos of the store and decrease the <code>pendingRequests</code> counter again.\n                            Just compare this snippet with the earlier <code>TodoList</code> definition to see how the pendingRequests property is used.\n                        </p><p>\n                            Note that the timeout function is wrapped in <code>action</code>. This isn't strictly necessary,\n                            but it makes sure that both mutations are processed in a single transaction, making sure any observers are only notified after both updates have completed.\n<pre>observableTodoStore.pendingRequests++;\nsetTimeout(action(() => {\n  observableTodoStore.addTodo('Random Todo ' + Math.random());\n  observableTodoStore.pendingRequests--;\n}), 2000);</pre>\n                        </p>\n\n                        <h3>Conclusion</h3>\n                        <p>\n                            That's all! No boilerplate. Just some simple, declarative components that form our complete UI. And which are derived completely,\n                            reactively from our state. You are now ready to start using the <code>mobx</code> and <code>mobx-react-lite</code> packages in your own applications.\n                            A short summary of the things you learned so far:\n                        </p>\n                        <ol>\n                            <li>\n                                Use the <code>observable</code> decorator or <code>observable(object or array)</code> functions to make objects trackable for MobX.\n                            </li>\n                            <li>\n                                The <code>computed</code> decorator can be used to create functions that can automatically derive value from the state and cache them.\n                            </li>\n                            <li>\n                                Use <code>autorun</code> to automatically run functions that depend on some observable state.\n                                This is useful for logging, making network requests, etc.\n                            </li>\n                            <li>\n                                Use the <code>observer</code> wrapper from the <code>mobx-react-lite</code> package to make your React components truly reactive.\n                                They will update automatically and\n                                efficiently. Even when used in large complex applications with large amounts of data.\n                            </li>\n                        </ol>\n                        <p>\n                            Feel free to play around a bit longer with the editable code blocks above to get a basic feeling how MobX reacts to all your\n                            changes. You could for example add a log statement to the <code>report</code> function to see when it is called.\n                            Or don't show the <code>report</code> at all and see how that\n                            influences the rendering of the <code>TodoList</code>. Or show it only under specific circumstances...\n                        </p>\n\n                        <h3>MobX doesn't dictate architecture</h3>\n                        <p>\n                          Please note that the above examples are contrived and it is recommended to use proper engineering practices like\n                            encapsulating logic in methods, organize them in stores or controllers, view-models etc.\n                            Many different architectural patterns can be applied, and some are further discussed inside the official docs.\n                            The above examples, and the examples in the official documentation show how MobX <em>could</em> be used, not how it <em>must</em> be used.\n                            Or, as somebody on HackerNews put it:\n                            <blockquote><em>\n&ldquo;MobX, it's been mentioned elsewhere but I can't help but sing its praises.\nWriting in MobX means that using controllers/ dispatchers/ actions/ supervisors or another form of managing dataflow returns to being an architectural concern you can pattern to your application's needs,\nrather than being something that's required by default for anything more than a Todo app.&rdquo;\n                            </em></blockquote>\n                        </p>\n\n                        <div style=\"text-align:center;\">\n                            <a class=\"github-button\" href=\"https://github.com/mobxjs/mobx\" data-icon=\"octicon-star\" data-style=\"small\" data-count-href=\"/mobxjs/mobx/stargazers\"\n                            data-count-api=\"/repos/mobxjs/mobx#stargazers_count\" data-count-aria-label=\"# stargazers on GitHub\"\n                            aria-label=\"Star mobxjs/mobx on GitHub\">Star</a>\n                            <a href=\"https://twitter.com/share\" class=\"twitter-share-button\" data-via=\"mweststrate\" data-hashtags=\"mobx\">Tweet</a>\n                        </div>\n\n                    </section>\n\n                    <footer>\n                        <p class=\"copyright\">MobX is maintained by <a href=\"https://twitter.com/mweststrate\">mweststrate</a></p>\n                    </footer>\n                </div>\n              </div>\n            </td>\n            <td class=\"right\">\n                <div class=\"right-content\">\n                    <h3>React preview</h3>\n                    <div id=\"reactjs-app\">\n\t\t\t\t\t\t<p style=\"text-align: center\">Read on and press any <em>run</em> buttons you encounter!</p>\n\t\t\t\t\t</div>\n                    <hr/>\n                    <h3>Console log\n                        <button onclick=\"clearConsole();\" id=\"clear-btn\">clear</button>\n                    </h3>\n                    <div id=\"consoleout\"></div>\n                </div>\n            </td>\n        </tr>\n    </table>\n    <link rel=\"stylesheet\" href=\"https://cdnjs.cloudflare.com/ajax/libs/github-fork-ribbon-css/0.1.1/gh-fork-ribbon.min.css\" />\n    <script src=\"assets/getting-started-assets/javascripts/jquery-2.1.4.min.js\"></script>\n    <script src=\"assets/getting-started-assets/javascripts/codemirror/lib/codemirror.js\"></script>\n    <link rel=\"stylesheet\" href=\"assets/getting-started-assets/javascripts/codemirror/lib/codemirror.css\">\n    <link rel=\"stylesheet\" href=\"assets/getting-started-assets/javascripts/codemirror/theme/xq-light.css\">\n    <script src=\"assets/getting-started-assets/javascripts/codemirror/javascript/javascript.js\"></script>\n\n    <script src=\"https://unpkg.com/react@16.13.1/umd/react.development.js\"></script>\n    <script src=\"https://unpkg.com/react-dom@16.13.1/umd/react-dom.development.js\"></script>\n    <script src=\"assets/getting-started-assets/babel.min.js\"></script>\n    <script src=\"https://unpkg.com/mobx@6.0.0-rc.8/dist/mobx.umd.development.js\"></script>\n    <script src=\"https://unpkg.com/mobx-react-lite@3.0.0-beta.1/dist/mobxreactlite.umd.development.js\"></script>\n    <script src=\"assets/getting-started-assets/script.js\"></script>\n    <script type=\"text/javascript\">\n        var gaJsHost = ((\"https:\" == document.location.protocol) ? \"https://ssl.\" : \"http://www.\");\n        document.write(unescape(\"%3Cscript src='\" + gaJsHost + \"google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E\"));\n    </script>\n    <script type=\"text/javascript\">\n        try {\n          var pageTracker = _gat._getTracker(\"UA-65632006-1\");\n          pageTracker._trackPageview();\n        } catch(err) {}\n    </script>\n    <script async defer id=\"github-bjs\" src=\"https://buttons.github.io/buttons.js\"></script>\n    <script>\n        !function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');\n    </script>\n</body>\n\n</html>\n"
  },
  {
    "path": "website/static/index.html",
    "content": "<!DOCTYPE HTML>\n<html lang=\"en-US\">\n  <head>\n    <meta charset=\"UTF-8\">\n    <meta http-equiv=\"refresh\" content=\"0; url=/README.html\">\n    <script type=\"text/javascript\">\n      window.location.href = '/README.html';\n    </script>\n    <title>MobX</title>\n  </head>\n  <body>\n    If you are not redirected automatically, follow this <a href=\"/README.html\">link</a>.\n  </body>\n</html>\n"
  },
  {
    "path": "website/static/js/scripts.js",
    "content": "function openTarget() {\n    var hash = location.hash.substring(1);\n    if(hash) var details = document.getElementById(hash);\n    if(details && details.tagName.toLowerCase() === 'details') {\n        details.open = true;\n        // seems to interfere with scroll spy otherwise (which triggers at 100 ms)\n        setTimeout(function() {\n            details.scrollIntoView();\n        }, 150)\n    }\n}\nfunction addTooltipToRockets() {\n    var classNames = ['navGroups', 'onPageNav', 'post', 'docs-prevnext'];\n    var rocketRegex = /🚀/g;\n\n    for (var className of classNames) {\n        var els = document.getElementsByClassName(className);\n        for (var el of els) {\n            el.innerHTML = el.innerHTML.replace(rocketRegex, '<span title=\"Advanced feature\">🚀</span>');\n        }\n    }\n}\nwindow.addEventListener('hashchange', openTarget);\nwindow.addEventListener('DOMContentLoaded', function() {\n    addTooltipToRockets();\n    openTarget();\n});\n"
  }
]